import { type Tool, type ToolProvenance, type ToolRegistry, type ToolSessionRecord, type ToolShortId } from '@opensip-cli/core'; import type { CommandResult, ToolSessionReplay } from '@opensip-cli/contracts'; /** * One tool's session-replay capability as the host consumes it. `replaySession` * may be ASYNC (ADR-0054 M4-F): for a BUNDLED tool it runs the tool's in-host * `replaySession` closure and resolves synchronously; for an EXTERNAL tool it * forks a HOOK worker that imports the untrusted runtime and runs the replay * there (its code never executes in the host process). */ export interface CliSessionReplayContribution { readonly tool: ToolShortId; readonly replaySession: (stored: ToolSessionRecord) => ToolSessionReplay | Promise>; } /** * The injected capability that runs an EXTERNAL tool's session replay * out-of-process (ADR-0054 M4-F). It is INJECTED (not statically imported) so * `session-replay-registry.ts` does not depend on the dispatch chain — which * would form a module cycle, because this module is a TYPE dependency of * `commands/shared.ts` that the dispatch chain transitively imports. The * composition root (`build-command-registration-input.ts`, a bootstrap module the * dispatch chain never imports) supplies the real implementation. */ export type ExternalReplayDispatcher = (tool: Tool, provenance: ToolProvenance, stored: ToolSessionRecord) => Promise; /** Options for {@link SessionReplayRegistry.fromTools}. */ export interface SessionReplayRegistryOptions { /** The per-run provenance (drives the M4-F host/external gate). */ readonly provenance?: readonly ToolProvenance[]; /** Injected external-replay dispatcher (forks the replay HOOK worker). */ readonly dispatchExternalReplay?: ExternalReplayDispatcher; } export declare class SessionReplayRegistry { private readonly byTool; private constructor(); static empty(): SessionReplayRegistry; /** * Build the registry from the tools' `sessionReplay` contributions, honoring the * ADR-0054 M4-F host/external split: a BUNDLED tool keeps its in-host replay * closure; an EXTERNAL tool gets a worker-backed replay (the host never runs the * external `replaySession` in-process) via the injected * {@link ExternalReplayDispatcher}. * * @throws {Error} when two registered tools claim the same `tool` short id. */ static fromTools(registry: ToolRegistry, opts?: SessionReplayRegistryOptions): SessionReplayRegistry; get(tool: ToolShortId): CliSessionReplayContribution | undefined; } //# sourceMappingURL=session-replay-registry.d.ts.map