import type { CallbackDeliveryOptions, CallbackDeliveryOutcome, DeliverCallbackInput } from "./callback-outbox-policy.js"; import { type CallbackAttemptOutcome, type CallbackTransport, type CallbackTransportDeliverInput } from "./callback-transport.js"; import { type AgentMessage, type Conversation } from "./protocol.js"; export type CallbackWakeAcknowledgementStatus = "started" | "in_flight" | "ok" | "error" | "timeout"; export interface CallbackProcessDelivery { status: number; stdout: string; stderr: string; } export interface CallbackSpawnResult { status: number | null; stdout?: string | null; stderr?: string | null; error?: Error; } interface CallbackSpawnOptions { encoding: "utf8"; maxBuffer: number; timeout: number; killSignal: "SIGKILL"; env: NodeJS.ProcessEnv; } export type CallbackSpawnSync = (command: string, args: string[], options: CallbackSpawnOptions) => CallbackSpawnResult; export interface CallbackProcessDeliveryObservation { logPath: string; conversation: Conversation; message: AgentMessage; event: string; runtimeEvent: string; delivery: CallbackProcessDelivery; detail?: Record; } export interface OpenClawCallbackTransportPorts { now(): Date; environment(): NodeJS.ProcessEnv; redactConversation(conversation: Conversation): unknown; recordCallbackProcessDelivery(observation: CallbackProcessDeliveryObservation): void; spawnSync?: CallbackSpawnSync; } export type OpenClawCallbackDeliveryOptions = CallbackDeliveryOptions; export type DeliverOpenClawCallbackInput = DeliverCallbackInput; export interface DeliverGatewayMethodInput { method: string; openclawBin?: string; gatewayUrl?: string; token?: string; sessionKey?: string; statePath: string; logPath: string; conversation: Conversation; message: AgentMessage; } export interface DeliverChatSendInput { openclawBin?: string; gatewayUrl?: string; token?: string; params: Record; } export interface OpenClawCallbackTransport extends CallbackTransport { readonly kind: "openclaw_gateway_v1"; deliver(input: CallbackTransportDeliverInput): CallbackAttemptOutcome; deliverCallback(input: DeliverOpenClawCallbackInput): CallbackDeliveryOutcome; deliverGatewayMethod(input: DeliverGatewayMethodInput): CallbackProcessDelivery; deliverChatSend(input: DeliverChatSendInput): CallbackProcessDelivery; } export interface CallbackWakeAcknowledgement { runId: string; status: CallbackWakeAcknowledgementStatus; } export declare function parseChatSendAcknowledgement(text: unknown, expectedRunId: string): CallbackWakeAcknowledgement; export declare function createOpenClawCallbackTransport(ports: OpenClawCallbackTransportPorts): OpenClawCallbackTransport; export {};