/** * Approval broker — request/response correlation for anything that needs an * explicit human decision: trade plans, remote permission prompts, ask-user * questions surfaced to a dashboard. * * The requester parks on a Promise; whoever holds the other end (TUI prompt, * panel client over WebSocket, headless auto-policy) resolves it by id. One * broker per session. */ export interface ApprovalRequest { requestId: string; sessionId: string; kind: 'trade-plan' | 'tool-permission' | 'ask-user'; /** Short human-readable headline. */ title: string; /** Full body — markdown-ish text rendered by the answering surface. */ description: string; /** Answer choices. Free-text replies map to `message` on the decision. */ options: string[]; createdAt: number; /** Undefined = wait indefinitely (interactive). */ timeoutMs?: number; /** Kind-specific payload (e.g. the TradePlan object). */ payload?: unknown; } export interface ApprovalDecision { /** One of request.options, or 'timeout'. */ choice: string; /** Free-text detail (e.g. requested changes). */ message?: string; } /** What a requester supplies — the broker (or harness) stamps id + createdAt. */ export type ApprovalRequestInput = Omit & { requestId?: string; createdAt?: number; }; export type ApprovalPromptFn = (req: ApprovalRequestInput) => Promise; export declare class ApprovalBroker { private pendingMap; private listeners; request(req: Omit): Promise; respond(requestId: string, decision: ApprovalDecision): boolean; pending(): ApprovalRequest[]; onRequest(listener: (req: ApprovalRequest) => void): () => void; /** Resolve everything as cancelled — session teardown. */ cancelAll(reason?: string): void; }