histoire
Version:
A fast story book powered by Vite
55 lines • 2.53 kB
TypeScript
import type { Frame, Page } from 'playwright';
import type { LaunchPreviewBrowser } from './dependencies.js';
import type { PreviewHostRegistry, PreviewHostTarget } from './preview-host.js';
import type { ScreenshotSetupOwner } from './setup/types.js';
/** Browser session options shared by dev screenshots and deployed preview tests. */
export interface PreviewSessionOptions {
/** Optional peer resolution root. */
root: string;
/** Dedicated nonce host served by this process. */
host: PreviewHostRegistry;
/** Internally resolved exact target and appearance. */
target: PreviewHostTarget;
/** Injectable acquisition used by focused lifecycle tests. */
launch?: LaunchPreviewBrowser;
/** Runtime-owned progressive browser acquisition; explicit launch stays authoritative. */
setupOwner?: ScreenshotSetupOwner;
/** Whole preview deadline, including browser startup. */
timeoutMs?: number;
/** Screenshot/inspection fixed style policy; test execution preserves story styles. */
deterministicCapture?: boolean;
/** Visual testing requires consecutive decoded captures to stabilize. */
stableCapture?: boolean;
/** Fixed internal observer attaches before navigation; never supplied by MCP callers. */
observePage?: (page: Page) => void;
}
/** Fresh owned browser/context/page; creation itself never launches resources. */
export declare function createPreviewSession(options: PreviewSessionOptions): {
/** Exact owned page for fixed internal automation; never exposed as a tool. */
readonly page: Page;
/** Exact selected sandbox document, available after readiness. */
readonly frame: Frame;
/** Captured nonce identity used by deployed test request matching. */
readonly nonce: string;
/** Whole-session deadline also owns screenshot and deployed test waits. */
readonly timedOut: boolean;
/** Uncaught page error is distinct from caller cancellation. */
readonly pageFailed: boolean;
remaining: () => number;
isDocumentReady: (documentId: string) => Promise<boolean>;
waitForReady: () => Promise<{
page: Page;
frame: Frame;
nonce: string;
documentId: string;
}>;
close: () => Promise<void>;
/** Acquire and await sandbox plus variant readiness, fonts and two frames. */
open(externalSignal: AbortSignal): Promise<{
page: Page;
frame: Frame;
nonce: string;
documentId: string;
}>;
};
//# sourceMappingURL=session.d.ts.map