/** * Waiting for the user's approval of an agent's outbound action (#66416). * * When an agent-held token (a Genspark sandbox, an OpenClaw VM) sends outside * the user's organization, `--yes` does not count: the server parks the call * and answers `status: "pending_human_approval"` with an `approval_id`. Only * the user can decide, in Genspark (the CLI has no way to approve). This * module waits a bounded time for that decision, polling the read-only * `GET /agent_approvals/`, and re-issues the identical call once the user * has decided — the server then sends it (approved) or reports the decline. * Out of budget, the original envelope is printed as-is: it tells the agent * to re-run the same command after the user approves. * * Decisions are pure functions; the loop takes its I/O as parameters. All * progress goes to stderr; the caller prints exactly one envelope. */ import type { ApiResponse } from './types.js'; export declare const STATUS_PENDING_HUMAN_APPROVAL = "pending_human_approval"; export declare const DEFAULT_WAIT_SECONDS = 90; export interface HumanApprovalInfo { id: string; expiresAt?: number; } /** The approval a parked call waits for, or null for any other envelope. */ export declare function extractHumanApproval(envelope: ApiResponse): HumanApprovalInfo | null; /** * Seconds to wait: `GSK_APPROVAL_WAIT_SECONDS` when it is a non-negative * integer (0 = do not wait), else the default — short enough to fit an agent * shell's command timeout. */ export declare function approvalWaitSeconds(raw: string | undefined): number; export type ApprovalState = 'pending' | 'approved' | 'rejected' | 'expired'; /** Whether to keep polling (`pending`) or re-issue the call (a decision). */ export declare function nextApprovalStep(state: unknown): 'poll' | 'rerun' | 'stop'; export interface HumanApprovalIo { pollState: () => Promise; rerun: () => Promise; notify: (line: string) => void; sleep: (ms: number) => Promise; nowMs: () => number; } /** * Wait for the user's decision on `approval`, then re-issue the call once. * Returns the envelope to print: the re-issued call's, or `original` when * the budget ran out, the request expired, or polling failed. */ export declare function waitForHumanApproval(original: ApiResponse, approval: HumanApprovalInfo, budgetSeconds: number, io: HumanApprovalIo): Promise; //# sourceMappingURL=humanApproval.d.ts.map