import { atomicSaveJsonFile } from "./durable-json-file.js"; export declare const TERMINAL_USER_SEND_INTENT_SCHEMA = "agent-knock-knock/terminal-user-send-intent"; export declare const TERMINAL_USER_SEND_INTENT_VERSION = 1; export declare const TERMINAL_USER_SEND_INTENTS_DIRECTORY = "terminal-user-send-intents"; export type TerminalUserSendIntentStage = "reserved" | "zero_input_cancelled" | "enter_dispatched"; export type TerminalUserSendDeliveryMode = "managed" | "unmanaged"; export declare class TerminalUserSendIntentBoundaryConflictError extends Error { constructor(message: string); } export declare class TerminalUserSendIntentUncertainError extends Error { constructor(message: string); } export interface TerminalUserSendIntentBoundary { terminalRuntimeKey: string; physicalToken: string; messageId: string; requestHash: string; } export interface TerminalUserSendIntent { schema: typeof TERMINAL_USER_SEND_INTENT_SCHEMA; version: typeof TERMINAL_USER_SEND_INTENT_VERSION; terminal_runtime_key: string; physical_token: string; message_id: string; request_hash: string; stage: TerminalUserSendIntentStage; reserved_at: string; zero_input_cancelled_at?: string; enter_dispatched_at?: string; delivery_mode?: TerminalUserSendDeliveryMode; } export type TerminalUserSendIntentReserveResult = { outcome: "reserved"; intent: TerminalUserSendIntent; } | { outcome: "replay" | "uncertain"; stage: TerminalUserSendIntentStage; intent: TerminalUserSendIntent; }; export interface TerminalUserSendIntentRepository { pathFor(input: Pick): string; load(input: TerminalUserSendIntentBoundary): TerminalUserSendIntent | undefined; reserve(input: TerminalUserSendIntentBoundary): TerminalUserSendIntentReserveResult; cancelProvenZeroInput(input: TerminalUserSendIntentBoundary): boolean; complete(input: TerminalUserSendIntentBoundary, deliveryMode: TerminalUserSendDeliveryMode): TerminalUserSendIntent; } interface TerminalUserSendIntentRepositoryOptions { runtimeDir: string; now?: () => Date; ensureDirectory?: (directoryPath: string) => void; acquireLock?: (lockPath: string) => () => void; saveJson?: typeof atomicSaveJsonFile; } /** * Store-independent global idempotency for one explicit physical-terminal * Send. The path is keyed only by host message id, so the same id cannot move * between explicit, delegated, or differently targeted terminal entry points. * * The caller owns the physical-terminal lock. A reserved record means the * previous managed or unmanaged attempt may have started input; only a * completed record is safe to replay as success. The request body is never * stored. */ export declare function createTerminalUserSendIntentRepository(options: TerminalUserSendIntentRepositoryOptions): TerminalUserSendIntentRepository; export {};