import type { EditorTransport } from '../contract/transport.js'; import type { PygmalionDesignSessionStatus, PygmalionDevMirrorStatus, PygmalionRevertResult, PygmalionHistoryResult, PygmalionSourceRefs } from '../contract/types.js'; import type { InspectApplyPayload } from './inspect.js'; import type { InspectApplyResult, InspectImpactResult, InspectPreviewResult } from './host.js'; export type { PygmalionDesignSessionStatus, PygmalionDevMirrorStatus, PygmalionIntegrationState, PygmalionRevertResult, PygmalionHistoryResult, PygmalionSessionOperation, PygmalionSourceRef, PygmalionSourceRefs, PygmalionVisualOperation, PygmalionVisualRevertOperation, } from '../contract/types.js'; export interface PygmalionProjectRuntimeOptions { /** * The transport every request goes through. Defaults to the enclosing * editor runtime's transport when the hook renders inside one, and to a * same-origin Vite transport otherwise. Pass the same transport to * `createEditorRuntime` so the editor and this hook talk to one service. */ transport?: EditorTransport; sessionId?: string; sessionStorageKey?: string; autoStart?: boolean; formatApplyMessage?: (session: PygmalionDesignSessionStatus, applied: number) => string | undefined; /** Compare the canonical impact screen before and after application using the transport's QA capture service. */ visualQa?: { eligibleFrameIds: readonly string[]; }; } export interface PygmalionProjectRuntime { mirror: PygmalionDevMirrorStatus; session: PygmalionDesignSessionStatus | null; ready: boolean; /** Keep the last canvas visible, but suspend interaction and capture until the new source is ready. */ transitioning: boolean; appOrigin: string | null; previewRevision: string; /** * Source SHA of previewRevision, without the session mutation counter. * Artifact bundles are stamped with this, so hosts must build artifact cache * namespaces from it instead of parsing previewRevision themselves. */ previewSourceRevision: string; refresh(manual?: boolean, sourceRef?: string): Promise; /** * Repoints the mirror at another git ref without restarting the dev server. * Pass PYGMALION_WORKTREE_SOURCE_REF to preview uncommitted work. * The artifact cache is keyed by source SHA, so a switch invalidates it. */ switchSource(sourceRef: string, options?: { discardEdits?: boolean; }): Promise; /** * Revisions `switchSource` can be given. Empty until listed, so a host can * offer a choice instead of asking for a ref string. */ sourceRefs: PygmalionSourceRefs; loadSourceRefs(): Promise; previewVisual(payload: InspectApplyPayload): Promise; inspectImpact(componentFiles: string[]): Promise; applyVisual(payload: InspectApplyPayload): Promise; revertLastVisual(options?: { signal?: AbortSignal; }): Promise; redoLastVisual(options?: { signal?: AbortSignal; }): Promise; restoreVisualRevision(revision: number, options?: { signal?: AbortSignal; }): Promise; loadSessionHistory(options?: { signal?: AbortSignal; }): Promise; } /** * A general-purpose browser runtime that consumes the Vite plugin's dev mirror and design session API. * The host only provides the route/fixture catalog and display text, and the Git·preview life cycle is left to this hook. */ export declare function usePygmalionProject(options?: PygmalionProjectRuntimeOptions): PygmalionProjectRuntime;