/** * Question-pause detection (2026-09). * * A run that stops to ask a human a question exits 0 — `ask_human` returns * normally and `wait_for_answer` returns `{ pending: true }` after at most * 180s (`teamshare-backend/src/modules/mcp/tools/human.ts`). Nothing throws, so * from the CLI's point of view the turn ENDED CLEANLY and the run was a * SUCCESS. That produced three false signals: * * 1. the task was forced to `in_review`, which reads as "done" while a * question is still unanswered, * 2. the closing comment claimed "Harness finished the session", * 3. (fixed elsewhere) the resume then worked in the linked folder, which holds * none of the task's work — see `docs/agent-guides/resume-on-answer.md`. * * This module answers the one question that separates them: is there still an * OPEN question on this task? It reuses `getTaskQuestions`, the same call * `build.ts` already uses as a "question already open" guard, so there is no * new endpoint and no new backend contract. * * Best-effort by design: any failure answers `false`. A probe must never fail a * run, and a run whose question was already answered while it finished IS a * completed run. */ /** Minimal API surface — only what the probe needs. */ export interface QuestionProbeApi { getTaskQuestions(taskId: string): Promise<{ open: unknown; }>; } export interface PauseState { /** The run ended with an unanswered question on the task. */ paused: boolean; /** The question body, for the "waiting on your answer to: …" comment. */ questionBody?: string; /** True when the probe could not be completed (treated as not paused). */ probeFailed?: boolean; } /** * Did this run end because it is waiting on a human answer? * * Only meaningful when the run itself did not fail — a crashed run with an open * question is a failure to report, not a pause to wait on. */ export declare function detectQuestionPause(api: QuestionProbeApi | null, taskId: string | null | undefined, opts?: { harnessFailed?: boolean; }): Promise; /** * Closing summary for a paused run. Distinct from the "harness finished" * summary so the board does not read as complete while a human owes an answer. */ export declare function pauseSummary(questionBody?: string): string; /** * The ToolRun status a finished research session reports (2026-10). * * `ask_human` ends the turn and the process exits 0, so a clean exit is NOT * proof the run finished: a pending question means PAUSED. This is exported so * the mapping is testable without spawning a harness, and so the bridge never * re-derives "paused" from a status string by hand. */ export declare function researchRunStatus(exitCode: number, paused: boolean): 'completed' | 'failed' | 'paused';