/** * GH-747: a live SA_LIVE_AGENT repro (3 runs, 2 with prompt-only fix attempts) * consistently showed the chat model narrating "lancé/spawneé el subagente X" * while doing the work itself inline — no successful Agent/Task tool_use, no * real `workflow execute`/`workflow run --autonomous` dispatch. Prompt * wording changes alone did not override this strong narrative prior, so * this is a deterministic, code-level detector instead: parse the turn's raw * stream-json for a REAL spawn signal, and flag when the assistant's text * claims delegation without one. The claim-language regex is still a * heuristic on model text (can't be otherwise), but the "real signal" side * is grounded in actual tool_use/tool_result inspection, not another model * self-report. * * A candidate tool_use (Agent/Task, or a Bash `workflow execute`/`workflow * run --autonomous` call) only counts as a REAL spawn if its matching * tool_result did not come back `is_error: true`. Two live false negatives * both traced back to checking presence alone: (1) the model attempting a * real Agent call that the chat runtime's restricted `--allowedTools` (no * native subagent tool) rejected, and (2) `workflow run --autonomous` * failing fast (e.g. no delegated runtime installed) — in both cases the * model just proceeded to do the work itself without correcting its earlier * delegation claim. `workflow run` WITHOUT `--autonomous` is never a * candidate at all: that mode only transitions workflow state and hands the * CURRENT turn a playbook to execute inline — it never spawns anything, * successfully or not. */ export type DelegationHonestyCheck = { /** The assistant's text claims it delegated/spawned a subagent this turn. */ claimsDelegation: boolean; /** A real spawn actually happened AND succeeded: native Agent/Task * tool_use, or a Bash `workflow execute`/`workflow run --autonomous` call. */ realSpawnDetected: boolean; }; /** `true` when the model claimed delegation with no matching real spawn signal. */ export declare function isDishonestDelegationClaim(check: DelegationHonestyCheck): boolean; /** * Parses a turn's raw `--output-format stream-json` stdout for a real, * successful spawn signal and whether the accumulated assistant text claims * delegation. See the module doc comment for exactly what counts. */ export declare function checkDelegationHonesty(rawStreamJson: string): DelegationHonestyCheck;