type PlannerTask = { title: string; description: string; dependencies: number[]; suggestedModel?: string; verification?: string[]; }; type PlannerPayload = { mode: 'task' | 'overview'; tasks: PlannerTask[]; orderedTaskIds: string[]; dependencies: Array<[string, string]>; /** Overview mode: planner-decided combined-run grouping (partition). */ groups?: Array<{ name?: string; taskIds: string[]; }>; /** * Overview mode: the ORDERED barrier plan (stages → groups). The backend * re-validates it; it is passed through untouched. * * This was DROPPED here for as long as stages have existed: the plan file and * the MCP tool both carry them, the CLI normalises them, and this payload - * the only thing the backend ever sees - rebuilt `{ tasks, orderedTaskIds, * dependencies, groups }` and threw the stages away. A plan designed as 14 * barriers arrived as one flat group. */ stages?: Array>; /** Extra edges beyond the stage barrier (earlier group → later group). */ edges?: Array<{ fromGroup: string; toGroup: string; }>; planMarkdown?: string; acceptanceCriteria?: string; /** Short, structured summary of the whole plan (goal, order, risks). */ planSummary?: string; /** A better name for the plan/parent task, chosen by the planner. */ planTitle?: string; }; type EmitResult = (event: string, cmdId: string, payload: Record) => void; /** * An OVERVIEW result with no grouping is not a plan — and emitting it DESTROYS * the real one. * * THE INCIDENT (2026-11-08). `submit_plan` runs in the BACKEND process, so the * result file it writes lives on the server * (`/opt/render/.teamshare/state/planner-.json`). The CLI looks for that * file on the USER'S machine, finds nothing (it NEVER exists there against a * deployed backend), and the handler fell back to a headless answer with no * grouping. The backend's planner promise resolved with THAT and held the batch * `planner_held:no_groups`, writing nothing — while the real agent session was * still designing the plan (the V2 CLI client had exited, the service had not). * The plan page flipped to "Held / could not be produced" a minute in, and the * agent's real plan, delivered over MCP afterwards, answered `delivered:false` * because the promise it should have resolved was already gone. * * So an ungrouped overview result is NOT emitted at all: the MCP submit is the * delivery channel, and the backend keeps waiting for it until its own timeout. * Refusing to answer is strictly better than answering "nothing", because * nothing cannot be un-held. `TEAMSHARE_PLANNER_EMPTY_OVERVIEW_EMIT_MS` > 0 * restores the old behaviour after that delay (tests, or a deployment where the * MCP tool is genuinely unavailable). */ export declare const EMPTY_OVERVIEW_EMIT_MS: number; /** True when a payload actually decided how the work is grouped. */ export declare function hasGrouping(result: PlannerPayload): boolean; /** * Whether a planner result may be sent at all (see `EMPTY_OVERVIEW_EMIT_MS`). * Pure, so the rule is testable without spawning a harness. */ export declare function shouldEmitPlannerResult(result: PlannerPayload): boolean; export declare function handlePlannerRequest(data: Record, emit: EmitResult): Promise; export {};