/** * Approval-gate coordinator for the hooteams bridge (`--team`). * * The orchestrator pauses a task by emitting a `task_paused` TeamEvent * (question + options) and waits for `POST /tasks/:id/resume`. This class * turns that wire contract into the TUI's options pane: it queues gates as * they arrive (one prompt on screen at a time), answers the server with the * chosen option, and dismisses prompts that another surface (hoocanvas, * another attached hoocode) answered first — the server enforces * first-answer-wins and 409s stale answers. * * The coordinator is UI-agnostic: the host injects `present` (show a gate, * resolve with the answer, undefined on skip, abort signal on dismissal), * which interactive mode backs with its AskOptions pane. */ import type { TeamPendingApproval, TeamViewEvent } from "./team-view.js"; /** One approval gate, as queued for presentation. */ export interface TeamApproval { taskId: string; question: string; options: string[]; /** Role that paused; absent for gates fetched from /tasks/pending. */ role?: string; } export interface TeamApprovalHost { /** * Show the gate and resolve with the chosen option (free-form answers * allowed), or undefined when the user skips it. The signal aborts when * the gate is dismissed (answered elsewhere); resolve promptly then. */ present(approval: TeamApproval, signal: AbortSignal): Promise; /** Deliver the answer: POST /tasks/:id/resume. Rejects on stale/HTTP errors. */ resume(taskId: string, option: string): Promise; info(message: string): void; warn(message: string): void; } export declare class TeamApprovalCoordinator { private readonly host; private readonly queue; private current; constructor(host: TeamApprovalHost); /** Feed every TeamEvent from the shared /events subscription. */ handleEvent(event: TeamViewEvent): void; /** Queue gates that opened before we attached (GET /tasks/pending). */ enqueuePending(pending: TeamPendingApproval): void; /** Number of gates waiting behind the one on screen. Exposed for tests. */ queuedCount(): number; /** Task id of the gate currently on screen, if any. Exposed for tests. */ presentedTaskId(): string | undefined; private enqueue; /** Drop a gate another surface settled: silently when queued, with a notice when on screen. */ private dismiss; private pump; } //# sourceMappingURL=team-approvals.d.ts.map