/** * FixCapture — turns a red → green transition into a memory, with nobody asking. * * The auto-capture that existed before this (test_oracle's "tests passing after changes to * a.ts") stored the one thing nobody searches for: that a suite passed. What a later session * actually has in hand is the *error* — CLAUDE.md tells it to search_memory with the error * message — and the answer it needs is "this exact failure was fixed by changing these files". * That pairing only exists across two runs of the same command, so this module keeps the * failing run's signature and the hash of every dirty file at that moment, and when the same * command next passes, the files whose content moved in between are the fix. * * State lives on disk (`.lemma/session/fix-capture.json`), not in the process: the failing run * and the passing one may arrive through different processes — the MCP server's * run_workspace_command, or the host's own Bash tool relayed by a PostToolUse hook * (`lemma-brain-ingest --hook-result`). Agents mostly run tests through their native shell, so * a capture that only saw Lemma's tools would see a fraction of the fixes. * * It never guesses: a pass with no file changed since the failure was flaky, and is recorded as * nothing at all. */ import { TheBrainV2 } from '../subconscious/TheBrainV2.js'; /** * Whether a command's pass/fail is a verdict on the code. Judged per shell segment on the * command's head, not anywhere in the text: `cat jest.config.js` mentions jest and is no * verdict, `CI=1 npx jest` and `cd app && npm test` are. */ export declare function isVerdictCommand(command: string): boolean; export interface CaptureOutcome { /** What happened, for the tool result — auto-capture must never be invisible. */ note: string; captured?: { id: string; query: string; files: string[]; }; pending?: boolean; } /** The failure, compressed to what identifies it — test titles, error lines, their locations. */ export declare function extractFailure(output: string): { headline: string; signature: string; }; /** * Feed one finished run of a command. Returns a note to append to the tool result (empty when * the command isn't a verdict command or nothing happened worth mentioning). */ export declare function recordCommandOutcome(input: { command: string; cwd?: string; passed: boolean; output: string; brain?: TheBrainV2; now?: number; /** The caller knows this is a test run (test_oracle) even if the command text doesn't say so. */ verdict?: boolean; }): CaptureOutcome; /** * Entry point for a host PostToolUse hook (Claude Code shape: `tool_name`, `tool_input.command`, * `tool_response`). Exit status isn't always in the payload, so when it's missing the verdict is * read from the output's own summary lines — and when that's ambiguous, nothing is recorded * rather than a guess. */ export declare function recordHookPayload(payload: unknown, cwd?: string): CaptureOutcome; /** * Pass/fail and combined output of a host Bash payload; null when the run was interrupted or * its verdict can't be told. Shared with HostRecall so both read a payload the same way. */ export declare function hookVerdict(p: Record): { passed: boolean; output: string; } | null; /** Pass/fail from a runner's own summary line; null when the output doesn't say. */ export declare function inferVerdict(output: string): boolean | null; //# sourceMappingURL=FixCapture.d.ts.map