/** * Sift agent loop. Narrow red→green ratchet for bug fixes. * * Mirrors brew's iter loop in shape but smaller in every dimension: * - max 3 iterations (vs brew's 10) * - $0.50 budget cap (vs brew's $10) * - allowed_paths restricted to bug-profile.fix_scope * - test-runner is scoped to the regression test only * - no story manifest; the contract is just the regression test * * **Status: alpha.4a**. Single-iteration loop with no ratchet/revert. * Iteration loop + multi-turn ratchet ships in alpha.4b alongside * a brew/sift shared-engine refactor. */ import { type StackConfig, type RunResult } from "@slowcook-ai/stack-ts"; import { type BugProfile } from "../investigate/schema.js"; export interface SiftContext { repoRoot: string; anthropicApiKey: string; model: string; bugProfile: BugProfile; /** Repo-relative path to the regression test file. */ regressionTestPath: string; /** Read once at construction; passed through prompts. */ regressionTestSrc: string; stackConfig: StackConfig; /** Hard cap (seconds spend); default 3. */ maxIterations: number; /** USD spend cap; default 0.5. */ budgetUsd: number; now?: () => Date; } export interface SiftResult { /** True when the regression test ended green. */ green: boolean; /** Total iterations the agent took. */ iterations: number; /** Total spend in USD. */ spendUsd: number; /** Files written across the run. */ filesTouched: string[]; /** When green=false, why the run ended (`budget`, `iters`, `halt:`, etc.). */ haltReason?: string; /** Last test result for diagnostics. */ lastTestResult: RunResult | null; } export declare function runSift(ctx: SiftContext): Promise; export declare function isInFixScope(path: string, fixScope: ReadonlyArray): boolean; export declare function regressionStatus(result: RunResult, regressionPath: string): "red" | "green"; export declare function regressionFailureMessage(result: RunResult, regressionPath: string): string | undefined; export declare function parseHalt(text: string): string | null; //# sourceMappingURL=agent.d.ts.map