export declare const CALLBACK_ROUTE_SCHEMA = "agent-knock-knock/callback-route"; export declare const CALLBACK_ROUTE_VERSION: 1; export declare const CALLBACK_ENVELOPE_SCHEMA = "agent-knock-knock/callback-envelope"; export declare const CALLBACK_ENVELOPE_VERSION: 1; export interface CallbackRouteCapabilitiesV1 { wake?: boolean; respond?: boolean; } /** * Immutable reference to one administrator-authorized callback destination. * Secrets and executable/network configuration remain behind the trusted * profile resolver and must never be persisted in this route. */ export interface CallbackRouteV1 { schema: typeof CALLBACK_ROUTE_SCHEMA; version: typeof CALLBACK_ROUTE_VERSION; transport: string; profile_id: string; profile_revision: string; controller_session_id: string; capabilities?: CallbackRouteCapabilitiesV1; } export type CallbackEnvelopeSourceV1 = { kind: "managed_turn"; session_id: string; turn_id: string; conversation_id: string; } | { kind: "terminal_watch"; watch_id: string; terminal_id: string; }; export interface CallbackEnvelopeEventV1 { id: string; type: string; body: string; requires_response: boolean; metadata?: Record; } export interface CallbackEnvelopeRouteV1 { transport: string; profile_id: string; profile_revision: string; controller_session_id: string; } /** Canonical host-neutral payload persisted before transport delivery. */ export interface CallbackEnvelopeV1 { schema: typeof CALLBACK_ENVELOPE_SCHEMA; version: typeof CALLBACK_ENVELOPE_VERSION; delivery_id: string; idempotency_key: string; route: CallbackEnvelopeRouteV1; source: CallbackEnvelopeSourceV1; event: CallbackEnvelopeEventV1; } export type CallbackAttemptOutcome = { disposition: "accepted"; accepted_at: string; acceptance_id: string; evidence?: Record; } | { disposition: "retryable_failure"; error_code: string; evidence?: Record; } | { disposition: "permanent_failure"; error_code: string; evidence?: Record; } | { disposition: "uncertain"; error_code: string; observed_at: string; evidence?: Record; }; export interface CallbackTransportAttemptV1 { number: number; id: string; } /** * Trusted in-process compatibility context. It is not part of the canonical * envelope, must not be persisted, and must never be exposed to a model. */ export interface CallbackTransportContextV1 { statePath?: string; logPath?: string; conversation?: unknown; message?: unknown; legacyOptions?: Record; } export interface CallbackTransportDeliverInput { route: CallbackRouteV1; envelope: CallbackEnvelopeV1; attempt: CallbackTransportAttemptV1; context?: CallbackTransportContextV1; reportCheckpoint?(outcome: CallbackAttemptOutcome): void; } /** * One bounded, non-throwing attempt; retry/lease policy remains owned by the * AKK outbox. A transport must convert every expected delivery failure into a * typed outcome. The caller treats an unexpected throw or malformed return as * uncertain because a side effect may already have happened. */ export interface CallbackTransport { readonly kind: string; deliver(input: CallbackTransportDeliverInput): CallbackAttemptOutcome; } export interface LegacyOpenClawCallbackRouteInput { controllerSessionId: unknown; gatewayMethod?: unknown; openclawBin?: unknown; gatewayUrl?: unknown; } export interface TerminalWatchOpenClawCallbackRouteInput { controllerSessionId: unknown; openclawBin?: unknown; /** * Exact-task Watches may advertise response authority to their owning Host. * This does not itself authorize terminal input: Status must still mint a * controller-incarnation-bound private interaction offer and the CLI must * recapture the same exact native questionnaire under its mutation locks. */ respond?: boolean; } export interface CallbackRouteCandidate { callbackRoute?: unknown; legacyOpenClaw?: LegacyOpenClawCallbackRouteInput; } export interface CreateCallbackEnvelopeInput { route: CallbackRouteV1; source: CallbackEnvelopeSourceV1; event: CallbackEnvelopeEventV1; deliveryId?: string; idempotencyKey?: string; } export declare function parseCallbackRoute(value: unknown): CallbackRouteV1; /** * Resolve candidates in explicit priority order. A present generic route is * authoritative: malformed data throws and never falls back to a legacy host. */ export declare function resolveCallbackRoute(...candidates: CallbackRouteCandidate[]): CallbackRouteV1 | undefined; export declare function hasCallbackRoute(...candidates: CallbackRouteCandidate[]): boolean; export declare function callbackEnvelopeMatchesRoute(envelope: CallbackEnvelopeV1, route: CallbackRouteV1): boolean; export declare function createLegacyOpenClawCallbackRoute(input: LegacyOpenClawCallbackRouteInput): CallbackRouteV1; /** * Terminal Watch resumes the controller conversation directly through * chat.send. Keep this authority separate from the managed-Turn Gateway * method carried by a Send command so both creation and delivery hash the * same immutable callback profile. */ export declare function createTerminalWatchOpenClawCallbackRoute(input: TerminalWatchOpenClawCallbackRouteInput): CallbackRouteV1; export declare function createCallbackEnvelope(input: CreateCallbackEnvelopeInput): CallbackEnvelopeV1; export declare function parseCallbackAttemptOutcome(value: unknown): CallbackAttemptOutcome;