/** * Coding verification + incomplete-todo completion gate (CLI host). * * Chain (first failure wins): * 1) Incomplete multi-item todo_write checklist (Grok TodoGate light, retryLimit 2) * 2) Edited code under fix/implement intent without fresh green verification after last edit * 3) Verification-shaped background command still running while finishing * 4) Latest verification result is red while finishing / claiming success * 5) Recent tool failure ignored under a done/success claim * 6) Fan-out/create_subagent with FAILED children while claiming overall done * 7) Fix/bug intent with edits but zero investigation tools (debug soft nudge) * * Soft: low retryLimit, clear coding / multi-step intents only. */ import type { Message } from '../core/session/session-jsonl.js'; import { extractLatestTodosFromMessages, type ParsedTodoItem } from '../context/message-tool-helpers.js'; export { extractLatestTodosFromMessages, type ParsedTodoItem }; export interface CodingCompletionGateRequest { sessionKey: string; runId: string; turn: number; response: string; stopReason?: string; messages: Message[]; totalToolCalls: number; toolCallsByName: Record; } export type CodingCompletionGateResult = { ok: true; } | { ok: false; reason: string; correction?: string; retryLimit?: number; }; /** * True when the session ever invoked a verify-class tool / verify-shaped exec. * Sticky (does not require post-edit freshness). Prefer * `hasFreshGreenVerificationAfterLastEdit` for completion honesty. */ export declare function hasVerificationEvidence(messages: Message[], toolCallsByName: Record): boolean; /** * Ordered post-condition: a green verification *result* must appear after the * last code-mutation tool_use. Stale greens (verify then more edits) do not count. * Bare tool_use / still-running bg start without a terminal result does not count. * * @param options.requireRuntimeTests When true (fix/implement intents), a green * code_diagnostics-only result is not enough — need run_tests / verify_fix * or a verification-shaped exec after the last edit. */ export declare function hasFreshGreenVerificationAfterLastEdit(messages: Message[], options?: { requireRuntimeTests?: boolean; }): boolean; /** * Soft gate: multi-item todo checklist still has open work. * Grok TodoGate parity (light): up to two corrections. */ export declare function evaluateTodoCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not finish while a background create_subagent is still running * (STARTED without a later terminal subagent_status SUCCESS/FAILED for that task). * Also block success claims when the parent stopped the child without admitting cancel. */ export declare function evaluateRunningBackgroundSubagentGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not finish while a verification-shaped background command is * still running (e.g. exec_background npm test). Wait for exit + green evidence. */ export declare function evaluateRunningBackgroundVerifyGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * True when the parent delegated fix/implement work via subagents and is finishing * without parent-level runtime verification and without green suite text in child summaries. */ export declare function hasUnverifiedDelegatedMutation(messages: Message[], toolCallsByName: Record, userText: string, response: string): boolean; /** * Soft gate: edits under coding-change intent require a *fresh* green verification * result after the last code mutation (not a stale green from earlier in the run). * Also covers parent-only completion after delegated subagent mutations. */ export declare function evaluateCodingCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: latest *runtime* verification tool result is red while finishing. * A later green code_diagnostics / bare tsc does not clear a still-red suite. * When this run edited code, reject even "quiet" done prose (no explicit success claim). */ export declare function evaluateVerificationOutcomeGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: recent tool failures must not be ignored under a completion claim. */ export declare function evaluateFailureDrivenGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: fix/bug/implement intent + edits with zero investigation tools. * Engineering-partner discipline — locate (or reproduce) before patching. */ export declare function evaluateDebugInvestigationGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent Storybook outcomes without a storybook-shaped exec. * Catches "I ran storybook / storybook build passed". */ export declare function evaluateInventedStorybookCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent mutation/fuzz-test outcomes without matching exec. * Catches "I ran stryker/cargo fuzz and mutation/fuzz tests passed". */ export declare function evaluateInventedMutationFuzzCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent lighthouse/a11y audit outcomes without matching exec. * Catches "I ran lighthouse/axe and accessibility passed". */ export declare function evaluateInventedLighthouseA11yCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent contract/visual-regression test outcomes without matching exec. * Catches "I ran pact/schemathesis/chromatic and they passed". */ export declare function evaluateInventedContractVisualCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent smoke/load/perf-test outcomes without matching exec. * Catches "I ran smoke tests" / "I ran k6 load tests and they passed". */ export declare function evaluateInventedSmokeLoadCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent security-audit outcomes without an audit-shaped exec. * Catches "I ran npm audit / cargo audit and there are no vulnerabilities". */ export declare function evaluateInventedAuditCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent coverage outcomes without a coverage-shaped exec. */ export declare function evaluateInventedCoverageCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent snapshot-update outcomes without a snapshot-shaped exec. */ export declare function evaluateInventedSnapshotCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent e2e/browser-test outcomes without a matching exec. * Catches "I ran playwright/cypress and e2e passed" without e2e-shaped commands. */ export declare function evaluateInventedE2eCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent codegen outcomes without a codegen-shaped exec. * Catches "I ran prisma generate / graphql-codegen / openapi generate". */ export declare function evaluateInventedCodegenCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent DB seed outcomes without a seed-shaped exec. */ export declare function evaluateInventedSeedCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent formatter outcomes without a format-shaped exec. * Catches "I ran prettier / formatted the codebase" without matching commands. */ export declare function evaluateInventedFormatCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent DB migration outcomes without a migrate-shaped exec. */ export declare function evaluateInventedMigrateCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent package publish / deploy outcomes without matching exec. * Catches "I published to npm" / "I deployed to production" without publish/deploy-shaped commands. */ export declare function evaluateInventedPublishDeployCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent docker/container outcomes without docker/podman exec. */ export declare function evaluateInventedDockerCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent "dev server started / service is running" without * exec_background (or a still-running background process). */ export declare function evaluateInventedBackgroundServerCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent CodeGraph navigation results without codegraph tools. */ export declare function evaluateInventedCodegraphCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent package-manager install outcomes without a matching exec. * Catches "I ran npm install / pnpm i / yarn install" when no install-shaped * exec ran this turn. */ export declare function evaluateInventedInstallCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent git/VCS outcomes without a git-shaped exec. * Catches "I committed/pushed/opened a PR" when no exec/exec_background * command containing git (or gh pr) ran this turn. */ export declare function evaluateInventedGitCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent file mutations without edit tools. * Catches "I edited/wrote X.ts" when no edit_file/write_file/multi_edit/ * apply_patch/move_file ran this turn. */ export declare function evaluateInventedEditCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent verification outcomes without verify tools. * Catches "tests passed" / "typecheck clean" claims when no run_tests / * verify_fix / code_diagnostics / verification-shaped exec ran. */ export declare function evaluateInventedVerificationCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: web research honesty for this turn. * - Claims web search/fetch results or cites live web without web tools. */ export declare function evaluateWebToolsCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: device/fleet honesty for this turn. * - Claims board exec/telemetry/fleet batch without device tools. */ export declare function evaluateDeviceCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: browser/vision honesty for this turn. * - Claims browser clicked/filled/navigated without browser tools. * - Claims screenshot/vision analysis without vision tools. */ export declare function evaluateBrowserVisionCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: plan/eval/structured-output honesty for this turn. * - Claims plan approved/completed without plan tools. * - Claims eval suite passed without eval. * - Claims structured JSON emitted without generate_structured. */ export declare function evaluatePlanEvalCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: do not invent user interview answers. * Claims the user chose/approved an option without ask_user_question this turn. */ export declare function evaluateAskUserCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: long-term memory honesty for this turn. * - Claims stored/saved a memory without memory_write. * - Claims deleted a memory without memory_delete. */ export declare function evaluateMemoryCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: skill marketplace honesty for this turn. * - Installed without load_skill but claims loaded/ready. * - Only searched SkillHub but claims installed/loaded (search ≠ install). */ export declare function evaluateSkillLoadCompletionGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Soft gate: parent claimed done after fan_out/create_subagent with FAILED * children without acknowledging incomplete merge / re-running failed angles. */ export declare function evaluateFanOutMergeGate(request: CodingCompletionGateRequest): CodingCompletionGateResult; /** * Compose host completion gates: structured-output is handled inside MossAgent * before this runs. Chain todo → coding evidence → running bg verify → outcome → * failure-driven → fan-out merge → debug investigation → extra. */ export declare function createCliCompletionGate(extra?: (request: CodingCompletionGateRequest) => Promise | CodingCompletionGateResult, options?: { /** Called when a gate rejects completion (CLI can print a status line). */ onReject?: (decision: Extract) => void; }): (request: CodingCompletionGateRequest) => Promise; //# sourceMappingURL=coding-completion-gate.d.ts.map