import { type NativeRecordRepository } from "./codex-native-record-store.js"; import { type CodexNativeStateRepository, type PersistedNativeInteraction } from "./codex-native-state-store.js"; import type { CodexNativeIdentity, CodexNativeReceipt, CodexNativeSnapshot, NativeInteraction, NativeInteractionResponse } from "./codex-native-types.js"; export type NativeResponseValue = NativeInteractionResponse | { answer: string; }; export interface NativeResponseInput { target: CodexNativeIdentity; nativeId: string; controllerSession: string; interactionId: string; responseId: string; response: NativeResponseValue; } export interface CodexNativeResponseRecord { schema: "agent-knock-knock/codex-native-response"; version: 1; revision: number; id: string; created_at: string; updated_at: string; target: CodexNativeIdentity; native_id: string; controller_session: string; response_id: string; interaction: PersistedNativeInteraction; response: NativeResponseValue; baseline_item_ids: string[]; baseline_item_status?: string; client_user_message_id?: string; state: "reserved" | "sent" | "confirmed" | "uncertain" | "not_sent"; /** Only explicit, proven-before-dispatch retries increment this counter. */ attempts?: number; not_sent_history?: { attempt: number; observed_at: string; error_code?: string; }[]; evidence?: "exact_async_answer_observed" | "native_item_advanced" | "native_turn_settled" | "native_task_continued"; error_code?: string; } export type CodexNativeResponseRepository = NativeRecordRepository; export declare function createCodexNativeResponseStore(storeDir: string, locks: { acquire(lockPath: string): () => void; }): CodexNativeResponseRepository; export interface NativeResponseDependencies { repository: CodexNativeResponseRepository; tasks: CodexNativeStateRepository; observe(target: CodexNativeIdentity, exactTurnId?: string): Promise; respond(target: CodexNativeIdentity, interaction: NativeInteraction, response: NativeInteractionResponse): Promise<{ dispatchState: "sent"; }>; answerAsync(target: CodexNativeIdentity, interaction: NativeInteraction, input: { answer: string; clientUserMessageId: string; }): Promise; now?(): Date; randomUUID?(): string; } export declare function createCodexNativeResponseService(deps: NativeResponseDependencies): { respond: (input: NativeResponseInput, watchAuthority?: { turnId: string; check(): void; }) => Promise; reconcile: (id: string) => Promise; status: (id: string) => CodexNativeResponseRecord; list: () => CodexNativeResponseRecord[]; respondWatch(watchId: string, input: Omit): Promise; };