import { GetWorkspaceCaptureFileResponse, GetWorkspaceCaptureResponse, WorkspaceCaptureManifest, WorkspaceCaptureStats } from "@opengeni/contracts"; import type { WorkspaceCaptureRow } from "@opengeni/db"; export declare const CAPTURE_INLINE_MANIFEST_MAX_BYTES: number; export declare const CAPTURE_INLINE_FILE_MAX_BYTES: number; export declare const CAPTURE_SIGNED_URL_TTL_SECONDS = 300; export type CaptureStoragePort = { getObjectBytes: (key: string) => Promise<{ bytes: Uint8Array; } | null>; createGetUrl: (args: { key: string; expiresInSeconds?: number; }) => Promise<{ url: string; expiresAt: Date; }>; }; type LoadedManifest = { manifest: WorkspaceCaptureManifest; byteLength: number; stats: WorkspaceCaptureStats; }; /** * Process-local cache for immutable capture manifests. Capture rows point at a * revision-specific object key, so a successfully validated blob is safe to * reuse as long as the row identity still matches. Both entry count and bytes * are bounded; large signed-manifest responses bypass the cache. */ export declare class WorkspaceCaptureManifestCache { #private; readonly maxEntries: number; readonly maxBytes: number; constructor(maxEntries?: number, maxBytes?: number); get(row: WorkspaceCaptureRow): LoadedManifest | null; getInlineResponse(row: WorkspaceCaptureRow): Extract | null; setInlineResponse(row: WorkspaceCaptureRow, response: Extract): void; set(row: WorkspaceCaptureRow, loaded: LoadedManifest): void; } /** * Shape the GET …/workspace/capture response from a loaded row. `{available:false}` * when there is no capture yet, the row is not in the `available` state, or its * manifest blob has been GC'd (all graceful cold-fallback states — never errors). * Inline manifest for ≤2MB, signed URL above. */ /** Awaited before a signed capture URL is returned to the caller: the route * records the metadata-only issuance audit fact. A throwing recorder fails * the serve closed - no recorded fact, no bearer capability. */ export type CaptureSignedUrlIssuanceRecorder = (fact: { kind: "capture_manifest" | "capture_file"; revision: number; expiresAt: string; }) => Promise; export declare function serveWorkspaceCapture(row: WorkspaceCaptureRow | null, storage: CaptureStoragePort, cache?: WorkspaceCaptureManifestCache, onSignedUrlIssued?: CaptureSignedUrlIssuanceRecorder): Promise; /** * Shape the GET …/workspace/capture/file response from a loaded row (the row * already resolved to the requested revision, or the latest). Throws * HTTPException(404) when there is no capture, the path is not in the manifest, * or the file was deleted. Returns a metadata-only marker for a tooLarge file (or * a captured file whose after-image blob is missing). Inline content for ≤256KB, * signed URL above. */ export declare function serveWorkspaceCaptureFile(row: WorkspaceCaptureRow | null, path: string, storage: CaptureStoragePort, onSignedUrlIssued?: CaptureSignedUrlIssuanceRecorder): Promise; export {};