/** * Investigate agent loop. Reads a GitHub issue, runs a Claude * tool-use loop with read-only repo tools, and emits a validated * BugProfile. * * alpha.2b — real LLM integration. PR opening (creating a branch * + pushing the bug-profile.yaml + opening the PR) lands in * alpha.2c; this returns the profile to the caller for now. * * Pattern mirrors brew/agent.ts's runTurn loop but smaller: * - read-only tools (no write_file, no justify_diff_overflow) * - single conversation, not multi-turn ratchet * - output validated against bug-profile schema */ import { type BugProfile } from "./schema.js"; export interface InvestigateContext { repoRoot: string; anthropicApiKey: string; model: string; /** Filled in by the caller; the LLM doesn't pick the bug-id. */ bugId: string; /** CLI version stamp for `investigated_by`. */ cliVersion: string; issue: { number: number; title: string; body: string; /** Prior comments (oldest first), already filtered to non-bot. */ priorComments: string[]; }; /** Used to stamp `created_at` deterministically in tests. */ now?: () => Date; } export interface InvestigateResult { profile: BugProfile; /** USD spent on the investigation round. */ spendUsd: number; /** Number of LLM rounds (1 round = one LLM call + tool execution). */ rounds: number; /** True if the agent emitted a `` block instead of a profile. */ halted: boolean; /** Halt reason from the agent (only set when halted=true). */ haltReason?: string; /** Raw final-round text the agent emitted (debugging aid). */ finalText: string; } export declare function runInvestigation(ctx: InvestigateContext): Promise; /** * Extract the YAML body from a `...` block, * parse + validate it. Throws on missing block / invalid YAML / failed * schema validation. The agent prompt explicitly requires the block; * a missing block is a contract violation. */ export declare function parseBugProfileBlock(finalText: string, ctx: InvestigateContext): BugProfile; /** * Minimal YAML subset parser. Handles the shape investigate emits: * - top-level scalar `key: value` (string, number, or quoted string) * - `key:` followed by ` - "string"` list items * - `key:` followed by indented `child: value` pairs (one level deep) * - block scalars `key: |` followed by indented lines * * NOT a general YAML parser. We avoid pulling `yaml` dep into this * module; the agent's output has a constrained shape that this can * cover. Falls back to throwing on anything outside that shape, which * surfaces parser drift as a clear error rather than silent miss. */ export declare function parseSimpleYaml(src: string): Record; //# sourceMappingURL=agent.d.ts.map