/**
 * The artifact asset-resolution contract.
 *
 * Every artifact render context resolves workspace-asset references in exactly
 * ONE way, chosen once per render as an explicit `AssetResolution` value:
 *
 *   token    — in-app canvas / present + headless Playwright render (PNG/PDF/
 *              inspect). URLs stay `/api/assets/...` and carry the `?at=`
 *              capability token; CSP allowlists `<origin>/api/assets/` only.
 *   share    — public share page. URLs are the token-scoped
 *              `/api/share/<token>/asset/...` surface; CSP allowlists exactly
 *              that token's path — never `/api/share/` broadly.
 *   relative — self-contained HTML export. Bundled refs become relative
 *              `./assets/...` paths; unbundled refs become labeled inline
 *              placeholders. CSP carries NO network sources, unconditionally
 *              (`file:` only, for opening from disk) — an exported file never
 *              phones home, and a copy hosted on an http origin cannot beacon
 *              same-origin either.
 *   none     — no asset access (unsaved previews, tests).
 *
 * Both document builders (`buildArtifactSrcdoc` in the web runtime and
 * `buildArtifactHtmlExport` in core) derive the URL rewrite AND the CSP from
 * the SAME resolution value via `applyAssetResolution` / `artifactCsp`, so a
 * context can never mix models — "URLs from one scheme, CSP from another"
 * (the share-page broken-images class) is unrepresentable.
 *
 * Fail-closed: a malformed origin or share token yields NO network source and
 * NO rewrite rather than a permissive or splicable CSP.
 */
export type AssetResolution = {
    mode: 'token';
    /** Artifact-asset capability token (`?at=`). Null while the mint is in
     *  flight — the CSP already allowlists `/api/assets/` so the rebuilt
     *  document with the token doesn't change policy, only URLs. */
    token: string | null;
    /** App origin the asset URLs resolve against (CSP sources need an
     *  absolute origin; the sandboxed iframe inherits the parent base URL). */
    origin: string;
} | {
    mode: 'share';
    shareToken: string;
    origin: string;
} | {
    mode: 'relative';
    /** Decoded `assetId/filename` identity keys actually written into the
     *  export bundle. Refs NOT in the set render as labeled placeholders —
     *  never absolutized back to the workspace. Omitted = relativize all
     *  (caller bundles every ref). */
    bundledKeys?: Set<string>;
} | {
    mode: 'none';
};
export declare function isValidShareToken(token: string): boolean;
/**
 * The network source expressions (if any) the resolution adds to the asset
 * CSP directives (`img-src` / `media-src` / `font-src`).
 *
 * D4 invariants (pinned by tests):
 *  - token    → `<origin>/api/assets/` and nothing else
 *  - share    → `<origin>/api/share/<token>/asset/` (the exact token path)
 *  - relative → `file:` ONLY, so the bundled `./assets/...` files load when
 *               the export is opened from disk. Deliberately NOT `'self'`:
 *               on an http(s)-hosted copy, `'self'` would let artifact JS
 *               beacon same-origin via img/media/font loads — "no network,
 *               unconditionally" means a hosted export shows placeholders
 *               instead (codex P1). A hostable export would be its own
 *               explicit mode, not a widening of this one.
 *  - none     → nothing
 */
export declare function artifactCspAssetSources(resolution: AssetResolution): string[];
/**
 * The full iframe/document Content-Security-Policy for an artifact render.
 * Single definition for BOTH builders (web srcdoc + core HTML export) so the
 * policy can't drift between contexts. The asset directives are derived from
 * the resolution; everything else is the fixed sandbox posture (inline + blob
 * scripts allowed, no eval, no network, no frames/objects/forms).
 *
 * `allowBaseOrigin` — the Playwright render path injects `<base href>` so
 * root-relative asset URLs resolve in a `setContent` document; `base-uri`
 * must then allow exactly that origin (everything else keeps `'none'`).
 */
export declare function artifactCsp(resolution?: AssetResolution, opts?: {
    allowBaseOrigin?: string;
}): string;
/**
 * Rewrite every workspace-asset URL in a built document according to the
 * resolution. This is the ONLY url-rewrite exit in both builders — the same
 * value that produced the CSP produces the URLs.
 */
export declare function applyAssetResolution(html: string, resolution?: AssetResolution): string;
