import * as hono from 'hono'; import { Hono, Context, Next } from 'hono'; import { S as StudioApiAdapter, P as PreviewDocumentStore, M as MediaProcessingJobState } from './mediaProxyPreview-DbBhbfB4.js'; export { L as LintResult, a as PreviewApiAdapter, R as RenderJobState, b as RenderRange, c as ResolvedProject, d as StudioRefusal, e as StudioRefusalWhy, f as StudioSelectionResponse, g as StudioSelectionSnapshot, h as StudioSelectionTextField } from './mediaProxyPreview-DbBhbfB4.js'; export { PREVIEW_ALLOWED_HOSTS_ENV, previewAllowedHostsFromEnv } from './helpers/requestIdentity.js'; export { C as ClosedWindow, D as DEFAULT_HISTORY_ROOT, S as HISTORY_START, H as HistoryClosedError, a as HistoryEntry, b as HistoryEntrySide, c as HistoryFileChange, d as HistoryListItem, e as HistoryResult, f as HistoryTarget, g as HistoryWho, h as HistoryWindow, M as MAX_WINDOW_IDLE_MS, P as ProjectHistory, i as ProjectHistoryOptions, j as ProjectHistoryView, U as UNDO_MODES, k as UndoMode, o as openProjectHistory, r as readProjectHistory } from './projectHistory-CiT3Mvsj.js'; export { ArtifactCapture, ArtifactInput, ArtifactRecord, HistoryBusyError, HistoryIdError, HistoryRefusedError, InPlaceOutcome, ProjectHistoryRecord, PrunedHistory, REFUSAL_REASONS, ReclaimedHistory, RefusalReason, RenderRecord, VideoState, artifactDirectory, beginArtifactCapture, finishSnapshotRun, forgetRecordedArtifacts, historyCache, isHistoryId, isUncopiedMedia, listProjectHistories, onRestoredInPlace, pruneGoneProjectHistories, reclaimUncopiedBlobs, recordArtifact, recordArtifacts, recordRenderSuccess, registerRenderOutput, retainSnapshotOutput } from './history/index.js'; export { CACHE_DIR_NAME as PROXY_CACHE_DIR_NAME } from './helpers/proxyTranscoder.js'; export { walkDir } from './helpers/safePath.js'; export { stampProjectHfIds, stampProjectHfIdsAsync } from './helpers/hfIdPersist.js'; import { SourceMutationTarget } from './helpers/sourceMutation.js'; export { PatchOperation, dedupeClonedCompositionId, findTargetElement, parseSourceDocument, patchElementInHtml, removeElementFromHtml, splitElementInHtml } from './helpers/sourceMutation.js'; export { MIME_TYPES, getMimeType } from './helpers/mime.js'; import { AddressInfo } from 'node:net'; export { MAX_OPEN_MEDIA_RANGE_BYTES, openRangeEnd } from './helpers/mediaRange.js'; export { ScreenshotClip, clearElementScreenshotIsolation, getElementScreenshotClip, thumbnailSeekReadyInBrowser } from './helpers/screenshotClip.js'; export { STUDIO_MANUAL_EDITS_PATH, StudioManualEditsRenderScriptOptions, createStudioManualEditsRenderBodyScript, createStudioPositionSeekReapplyScript } from './helpers/manualEditsRenderScript.js'; export { STUDIO_MOTION_PATH, StudioMotionRenderScriptOptions, createStudioMotionRenderBodyScript } from './helpers/studioMotionRenderScript.js'; export { decodeWellFormedEscapes } from '@hyperframes/parsers/asset-paths'; export { isSafePath } from '@hyperframes/core/safe-path'; export { serviceWorkerScriptFetch } from '@hyperframes/core/studio-preview-mark'; import '@hyperframes/core'; import 'sharp'; import '@hyperframes/parsers'; import '@hyperframes/core/compiler'; import './helpers/mediaCodecMap.js'; interface CaptureSandboxOption { /** * Serve thumbnail capture documents (`?hf-capture`) in an opaque origin. Default off. Turn it on * only with a thumbnail renderer that calls `grantCaptureLoads` on each capture page before loading * it; without that grant its captures lose fonts, module scripts, nested scenes and video pixels. */ sandboxThumbnailCaptures?: boolean; } interface CaptureLoad { url: string; method: string; resourceType: string; } declare function captureLoadGrant(load: CaptureLoad, captureUrl: string): "read" | "preflight" | null; type Header = { name: string; value: string; }; interface CaptureCdpSession { send(method: string, params?: object): Promise; on(event: "Fetch.requestPaused", handler: (event: { requestId: string; request: { url: string; method: string; }; resourceType: string; responseStatusCode?: number; responseHeaders?: Header[]; }) => void): unknown; } /** Call on the capture page's own session before it navigates; keep the session for the page's life. */ declare function grantCaptureLoads(cdp: CaptureCdpSession, captureUrl: string): Promise; interface StudioApiOptions extends CaptureSandboxOption { allowedHosts?: readonly string[]; subCompositionDeadlineMs?: number; sandboxDirectOpens?: boolean; } declare function createStudioApi(adapter: StudioApiAdapter, options?: StudioApiOptions): Hono; declare function refuseServiceWorkerScripts(c: Context, next: Next): Promise<(Response & hono.TypedResponse<"Forbidden", 403, "text">) | undefined>; declare function inertRefusal(status: 400 | 404, fixedMessage: string): Response; declare function carriesOAuthReturn(urlOrRequestTarget: string): boolean; declare function refuseOAuthReturn(): Response; declare const MAX_UPLOAD_BYTES: number; declare const STUDIO_SIGNATURE_MANIFEST_PATHS: readonly [".hyperframes/studio-manual-edits.json", ".hyperframes/studio-motion.json"]; /** * Whether a write at `changedPath` can change `createProjectSignature(projectDir)`. * * Owned here because it is the exact complement of what the walk below collects, * and a second copy of that reasoning drifts the moment either set changes. A * watcher that invalidates on everything is not merely wasteful: `.thumbnails/` * is written by the thumbnail route on every capture, and each capture reads the * preview, so an unfiltered watcher discards the memo on roughly every request of * the one workload the memo exists for. * * The watcher shares `isProjectIgnoredDir` but drops all of `.hyperframes/`; the two * manifest files read from inside it are let through first so motion-state saves invalidate. * * Every segment is tested, not just the parents, so a directory event on an * excluded dir itself (`unlinkDir .thumbnails`) is filtered too. The cost is that * a *file* literally named `dist` at the project root reads as excluded; the walk * would collect it, so it is a false negative, and no real project has one. */ declare function affectsProjectSignature(projectDir: string, changedPath: string): boolean; /** * Creates a stable preview cache-busting signature for project source plus Studio manifests. * `excluding` (project-relative paths) leaves those files out. */ declare function createProjectSignature(projectDir: string, excluding?: ReadonlySet): string; /** `createProjectSignature` without blocking the event loop: the same signature, with the walk and reads awaited. */ declare function createProjectSignatureAsync(projectDir: string, excluding?: ReadonlySet): Promise; /** * Compositions whose rendered frames a write at `changedPath` can change, or `null` for all * of them: assets, a root head edit, and any file the root does not mount reach every * composition. A head-preserving root write changes only the root's own frames. */ declare function compositionsAffectedBy(projectDir: string, changedPath: string): string[] | null; declare function affectsPreview(projectDir: string, changedPath: string): boolean; interface ProxyCacheCleanupOptions { maxBytes?: number; maxIdleMs?: number; staleTempMs?: number; minSweepIntervalMs?: number; protectedPaths?: ReadonlySet; now?: number; dryRun?: boolean; } interface ProxyCacheCleanupResult { removed: string[]; bytesBefore: number; bytesAfter: number; skipped: boolean; } /** * Opportunistically bounds a project's transparent-proxy cache. Cleanup is * synchronous because callers already perform filesystem bookkeeping on the * preview request path, but rate limiting keeps the directory scan off the * hot path. Errors intentionally bubble so callers can warn without turning * a cache-maintenance failure into a preview failure. */ declare function cleanupProxyCache(cacheDir: string, options?: ProxyCacheCleanupOptions): ProxyCacheCleanupResult; interface DuplicateElementResult { html: string; matched: boolean; newId: string | null; } declare function duplicateElementInHtml(source: string, target: SourceMutationTarget, newId: string, at: number, fallbackDuration?: number): DuplicateElementResult; interface FileMutationInput { sourceFile: string; absPath: string; before?: string; after: string; expectedVersion?: string; } interface AppliedFileMutation { sourceFile: string; changed: boolean; before: string; after: string; backupPath: string | null; version: string; writeToken: string | null; } /** Applies prepared HTML mutations with the same journal and receipt semantics as Studio. */ declare function applyFileMutations(projectDir: string, mutations: readonly FileMutationInput[], requestToken?: string, writeFile?: WriteFile): AppliedFileMutation[]; type WriteFile = (path: string, content: string, encoding: "utf-8") => void; /** The bundler options every adapter's `bundle()` uses. This route serves project files under a * ``, so assets keep their URLs: inlined base64 multiplies the document per reference. * The lint route owns linting, so the bundle skips its own contract lint. */ declare const PREVIEW_BUNDLE_OPTIONS: { readonly runtime: "placeholder"; readonly inlineAssets: false; readonly staticGuard: false; readonly sceneParts: true; }; /** One built preview document under the project's `.hyperframes/preview`. `salt` names the server build; the * user's private `secret` signs each document, so one the project shipped is never served. A miss costs a rebuild. */ declare function createPreviewDocumentStore(projectDir: string, salt: string, secret: string): PreviewDocumentStore; declare function requestSubPath(url: string, route: string): string | null; declare function originForListeningAddress(address: AddressInfo | string | null | undefined, protocol?: "http" | "https", bindHost?: string): string | undefined; interface FileWriteReceipt { path: string; version: string; writeToken: string; from?: string; } /** Strong content version used as both the JSON version and HTTP ETag. */ declare function fileContentVersion(content: string | Uint8Array): string; /** The version a deletion's receipt is kept under: a deleted file has no bytes to hash. */ declare const DELETED_VERSION = "\"deleted\""; /** A validator from a file's inode, change time and size, or null while the change is under three * seconds old. Change time, not mtime: copy tools (`cp -p`, rsync, robocopy) set mtime back but not * ctime, which Node reads from NTFS ChangeTime on Windows. A same-size rewrite within one tick keeps * both, so only a settled file is tagged. */ declare function settledFileTag(stat: { ino: number; ctimeMs: number; size: number; }, now?: number): string | null; /** * Attach one API write's identity to the watcher echo for its exact bytes. * * Reading is non-destructive: one watcher event fans out to every open SSE * subscriber, and a receipt removed by the first reader leaves the rest seeing * an unlabelled change and reloading the preview on Studio's own edit. Only the * TTL removes a receipt. */ declare function identifyFileWrite(filePath: string, expectedVersion: string): FileWriteReceipt | null; /** * @deprecated Renamed to {@link identifyFileWrite}, which despite this alias's * name does NOT consume the receipt: one watcher event fans out to every SSE * subscriber, so a destructive read left all but the first reloading on Studio's * own write. Kept for one release; call `identifyFileWrite` instead. */ declare const consumeFileWriteReceipt: typeof identifyFileWrite; /** * Build a standalone HTML page for a sub-composition. * * Uses the project's own index.html `` so all dependencies (GSAP, fonts, * Lottie, reset styles, runtime) are preserved — instead of building a minimal * page from scratch that would miss important scripts/styles. * * Three dispatch modes, tried in order: * 1. `