import type { Conversation } from "./protocol.js"; import type { TerminalControlRef } from "./terminal-agent-adapter.js"; import type { CanonicalMutationResource, CanonicalMutationResources, CanonicalMutationScopes, CanonicalStateMutationResources, CanonicalStateMutationScopes } from "./mutation-transaction.js"; import type { TerminalDispatchApplicationPorts, TerminalDispatchAuditEvent } from "./terminal-dispatch-application.js"; import type { TerminalDispatchLedgerDocument } from "./terminal-dispatch-ledger-codec.js"; export interface TerminalDispatchStateResource { statePath: string; logPath: string; } export interface BoundTerminalDispatchRoute { terminalControl: TerminalControlRef; terminalKey: string; storeDir: string; statePath: string; logPath: string; } export interface ExpectedTerminalDispatchRoute { terminalControl: TerminalControlRef; terminalKey: string; storeDir: string; statePath: string; logPath: string; } type ScopedOperation = (scopes: CanonicalStateMutationScopes, resources: CanonicalStateMutationResources, ...args: Args) => Result; export interface TerminalDispatchCapabilityRepositories { state: { save: ScopedOperation<[conversation: Conversation], void>; }; ledger: { save: ScopedOperation<[ ledger: TerminalDispatchLedgerDocument, phase?: "ordinary" | "final" ], void>; restore: ScopedOperation<[ reason: string, terminalInputNotStartedAt?: string ], void>; }; audit: { append: ScopedOperation<[event: TerminalDispatchAuditEvent], void>; appendPreparedMessage: ScopedOperation<[], void>; }; rollbackBeforeInput: ScopedOperation<[], boolean>; } export interface TerminalDispatchLocalApplicationPorts { synchronizeStageProgress: TerminalDispatchApplicationPorts["synchronizeStageProgress"]; audit: Pick; } export declare function bindTerminalDispatchRoute(scopes: CanonicalStateMutationScopes, resources: CanonicalStateMutationResources): BoundTerminalDispatchRoute; export declare function assertTerminalDispatchRouteMatches(route: BoundTerminalDispatchRoute, expected: ExpectedTerminalDispatchRoute): void; export declare function withExactTerminalDispatchRoute(route: BoundTerminalDispatchRoute, expected: ExpectedTerminalDispatchRoute, operation: (route: BoundTerminalDispatchRoute) => Result): Result; export declare function terminalDispatchStateMutationResource(scopes: CanonicalMutationScopes, resources: CanonicalMutationResources, statePath: string, logPath: string): CanonicalMutationResource; export declare function terminalDispatchStateResourceForStore(storeDir: string, statePath: string, logPath: string): CanonicalMutationResource; export declare function terminalDispatchStateLockPath(resource: CanonicalMutationResource): string; export declare function bindTerminalDispatchCapabilities({ scopes, resources, repositories, local }: { scopes: CanonicalStateMutationScopes; resources: CanonicalStateMutationResources; repositories: TerminalDispatchCapabilityRepositories; local: TerminalDispatchLocalApplicationPorts; }): { applicationPorts: TerminalDispatchApplicationPorts; }; export {};