import { type NativeQuestionnaireActionPlan, type NativeQuestionnaireInspection, type NativeQuestionnaireQuestion } from "./terminal-questionnaire-adapter.js"; import { type CodexAsyncQuestionDurableEvidence, type CodexAsyncQuestionInspection, type CodexAsyncQuestionOwnerPrivateActionPlan } from "./codex-async-question-adapter.js"; import { type TerminalInteractionAgent, type TerminalInteractionDeliveryMode, type TerminalInteractionResponseAuthority, type TerminalInteractionSubject, type TerminalInteractionSubjectProjection } from "./terminal-interaction-protocol.js"; export declare const TERMINAL_INTERACTION_AGGREGATE_SCHEMA: "agent-knock-knock/terminal-interaction-aggregate"; export declare const TERMINAL_INTERACTION_AGGREGATE_VERSION: 1; export declare const TERMINAL_INTERACTION_AGGREGATE_STATES: readonly ["pending", "reserved", "consumed", "response_uncertain", "superseded"]; export type TerminalInteractionAggregateState = typeof TERMINAL_INTERACTION_AGGREGATE_STATES[number]; export interface TerminalInteractionReservation { readonly attempt_id: string; readonly response_hash: string; readonly reserved_at: string; } export interface TerminalInteractionResolution { readonly resolved_at: string; /** Bounded machine code only; never persist raw screen/error/answer text. */ readonly reason_code: string; } export interface TerminalInteractionAggregate { readonly schema: typeof TERMINAL_INTERACTION_AGGREGATE_SCHEMA; readonly version: typeof TERMINAL_INTERACTION_AGGREGATE_VERSION; readonly subject: TerminalInteractionSubject; readonly interaction_id: string; readonly surface_id: string; readonly prompt_fingerprint: string; readonly response_authority: TerminalInteractionResponseAuthority; readonly current_step: number; readonly state: TerminalInteractionAggregateState; readonly created_at: string; readonly expires_at: string; readonly reservation?: TerminalInteractionReservation; readonly resolution?: TerminalInteractionResolution; } export type TerminalInteractionAggregateEvent = { /** Exact live recapture proved the same pending native surface. */ readonly type: "refresh"; readonly expires_at: string; readonly response_authority: TerminalInteractionResponseAuthority; } | { readonly type: "reserve"; readonly attempt_id: string; readonly response_hash: string; readonly at: string; } | { /** Exact proof that reservation completed but no terminal input began. */ readonly type: "release"; } | { readonly type: "consume"; readonly at: string; readonly reason_code: string; } | { readonly type: "response_uncertain"; readonly at: string; readonly reason_code: string; } | { readonly type: "supersede"; readonly at: string; readonly reason_code: string; }; export declare class TerminalInteractionTransitionError extends Error { constructor(message: string); } export interface BuildTerminalInteractionOfferInput { readonly subject: TerminalInteractionSubject; readonly agent: TerminalInteractionAgent; readonly agentVersion: string; /** Canonical endpoint/process incarnation data. It is hashed, never emitted. */ readonly canonicalTerminalIdentity: unknown; /** Exact accepted native task/thread/rollout identity. It is hashed, never emitted. */ readonly nativeTaskIdentity: unknown; readonly inspection: NativeTerminalInteractionInspection; readonly now: Date; readonly expiresAt?: string; readonly ttlMs?: number; readonly responseUncertain?: boolean; readonly responseAuthority: TerminalInteractionResponseAuthority; } export interface TerminalInteractionCoreOffer { readonly projection: TerminalInteractionSubjectProjection; readonly promptFingerprint: string; readonly surfaceId: string; /** Owner-private: never copy this field into callbacks or public Status. */ readonly actionPlan: NativeTerminalInteractionActionPlan; readonly nativeInspection: Exclude; } export interface CaptureTerminalInteractionInput extends Omit { readonly screen: string; readonly secret?: boolean; readonly codexAsyncQuestionEvidence?: readonly CodexAsyncQuestionDurableEvidence[]; } export type NativeTerminalInteractionActionPlan = NativeQuestionnaireActionPlan | CodexAsyncQuestionOwnerPrivateActionPlan; export type NativeTerminalInteractionInspection = NativeQuestionnaireInspection | NativeCodexAsyncQuestionInspection; export type NativeCodexAsyncQuestionInspection = { readonly status: "none"; } | { readonly status: "actionable"; readonly agent: "codex"; readonly interaction_kind: "async_question"; readonly profile: string; readonly current_step: number; readonly total_steps: number; readonly question: NativeQuestionnaireQuestion; readonly prompt_evidence: { readonly profile: string; readonly exact_region: string; readonly sha256: string; }; readonly action_plan: CodexAsyncQuestionOwnerPrivateActionPlan; readonly delivery_modes: readonly TerminalInteractionDeliveryMode[]; readonly async_inspection: Exclude; }; /** * Pure, subject-neutral offer builder. Monitor and Watch pass the same native * inspection through this function and therefore share semantic ids, * cross-source `surface_id`, public redaction, and executable/manual policy. */ export declare function buildTerminalInteractionOffer(input: BuildTerminalInteractionOfferInput): TerminalInteractionCoreOffer | undefined; /** Convenience capture entry point; the parser remains single-source. */ export declare function captureTerminalInteraction(input: CaptureTerminalInteractionInput): TerminalInteractionCoreOffer | undefined; export declare function createTerminalInteractionAggregate(projectionValue: unknown, createdAt: string): TerminalInteractionAggregate; export declare function hashTerminalInteractionResponse(value: unknown): string; export declare function reduceTerminalInteractionAggregate(currentValue: unknown, event: TerminalInteractionAggregateEvent): TerminalInteractionAggregate; export declare function validateTerminalInteractionAggregate(value: unknown): TerminalInteractionAggregate; export declare function aggregateMatchesProjection(aggregateValue: unknown, projectionValue: unknown): boolean;