import { type TerminalCompletionEvidence } from "./terminal-agent-adapter.js"; import { type CodexRolloutAcceptanceIdentity, type CodexRolloutIdentity } from "./terminal-submission-facts.js"; /** * Durable identity for one already-running Codex task that was started by the * human in the TUI. The prompt itself is deliberately omitted; the exact root * user row is represented only by its SHA-256 digest and native turn UUID. */ export interface CodexHumanStartedActiveTaskAnchor { schema: "agent-knock-knock/codex-human-started-active-task-anchor"; version: 1; native_thread_id: string; process_uuid: string; process_birth: string; captured_at: string; rollout: CodexRolloutIdentity; turn_id: string; request_hash: string; codex_version: string; task_started_offset_bytes: number; user_message_offset_bytes: number; observed_end_offset_bytes: number; anchor_fingerprint: string; } export interface CaptureCodexHumanStartedActiveTaskOptions { currentIdentity: CodexRolloutAcceptanceIdentity; now?: Date; maxBytes?: number; } export interface ObserveCodexHumanStartedActiveTaskOptions { anchor: CodexHumanStartedActiveTaskAnchor; currentIdentity: CodexRolloutAcceptanceIdentity; maxBytes?: number; /** Last complete, stable JSONL boundary returned by a prior observation. */ resumeOffsetBytes?: number; } export type CodexHumanStartedActiveTaskObservation = { status: "pending"; observedEndOffsetBytes: number; safeResumeOffsetBytes: number; } | { status: "completed"; completion: TerminalCompletionEvidence & { outcome: "success" | "failure"; }; } | { status: "invalidated"; reason: string; } | { status: "unavailable"; reason: string; retryable: true; }; /** * Capture the latest active native task in an exact open Codex rollout. * This is intentionally separate from the pre-send acceptance anchor: all * task-start and root-user evidence already exists when this function runs. */ export declare function captureCodexHumanStartedActiveTaskAnchor(options: CaptureCodexHumanStartedActiveTaskOptions): CodexHumanStartedActiveTaskAnchor | undefined; /** Observe only the exact human-started task named by the persisted anchor. */ export declare function observeCodexHumanStartedActiveTask(options: ObserveCodexHumanStartedActiveTaskOptions): CodexHumanStartedActiveTaskObservation; export declare function validateCodexHumanStartedActiveTaskAnchor(value: unknown): CodexHumanStartedActiveTaskAnchor;