import type { IntegrationErrorCode, Judge } from "pi-typesafe"; import type { DoneGuardConfig } from "./config.js"; export type ToolOutcome = "read" | "mutation" | "check-pass" | "check-fail" | "unknown"; /** * What a finished tool call contributes to the run's evidence. Only write/edit count as code changes: shell side effects * (deleting a temp dir, installing a package) are too varied to demand a test run for. Custom tools are unknown. */ export declare function classifyToolResult(tool: string, input: Record, failed: boolean, output?: string): ToolOutcome; /** * Recognise a test/type-check runner's own summary in tool output: node:test, jest/vitest, pytest, cargo, go test, * tsc. Returns the outcome the summary reports, or undefined when no runner summary is present. */ export declare function checkSummary(output: string): "pass" | "fail" | undefined; export interface RunEvidence { mutations: number; checks: Array<{ call: string; passed: boolean; }>; checksBeforeMutation?: number; } export declare function emptyEvidence(): RunEvidence; export declare function recordOutcome(evidence: RunEvidence, outcome: ToolOutcome, input: Record, tool?: string): void; interface MessageLike { role: string; content?: unknown; stopReason?: unknown; } /** Text of the run's final assistant message, when it ended normally with text (not a tool call, error, or abort). */ export declare function finalAssistantText(messages: ReadonlyArray): string | undefined; /** The checks that ran after the latest change: only those ran on the code as it stands now. Earlier ones stay as history. */ export declare function freshChecks(evidence: RunEvidence): RunEvidence["checks"]; /** The check only makes sense when something changed and nothing proved that change works. */ export declare function needsDoneCheck(evidence: RunEvidence): boolean; export declare const doneQuestions: { claims_done: import("pi-typesafe").NoulQuestion; claims_verified: import("pi-typesafe").NoulQuestion; verification_applies: import("pi-typesafe").NoulQuestion; outcome: import("pi-typesafe").ChoiceQuestion<{ readonly complete: "The work is finished"; readonly partial: "Progress was made and remaining work is named"; readonly blocked: "A blocker is reported or the user is asked something"; readonly other: "None of these"; }>; }; export interface DoneJudgment { claimsDone: number; claimsVerified: number; verificationApplies: number; outcome: "complete" | "partial" | "blocked" | "other"; model: string; elapsedMs: number; } export interface DoneVerdict { unverified: boolean; /** The message says checks passed but none ran: stronger than an unverified claim. */ falseClaim: boolean; reasons: string[]; evidence: RunEvidence; judgment?: DoneJudgment; error?: string; errorCode?: IntegrationErrorCode; } export declare function buildDoneRequest(task: string | undefined, finalMessage: string, evidence: RunEvidence): { state: { task: string; final_message: string; run: { file_changes: number; checks_run: string[]; }; }; questions: { claims_done: import("pi-typesafe").NoulQuestion; claims_verified: import("pi-typesafe").NoulQuestion; verification_applies: import("pi-typesafe").NoulQuestion; outcome: import("pi-typesafe").ChoiceQuestion<{ readonly complete: "The work is finished"; readonly partial: "Progress was made and remaining work is named"; readonly blocked: "A blocker is reported or the user is asked something"; readonly other: "None of these"; }>; }; }; export interface DoneOptions { config: DoneGuardConfig; judge: Judge; timeoutMs: number; signal?: AbortSignal | undefined; } export declare function evaluateDone(task: string | undefined, finalMessage: string, evidence: RunEvidence, options: DoneOptions): Promise; /** Follow-up for the agent: verify or say plainly that nothing was verified. */ export declare function doneNudge(verdict: DoneVerdict): string; export declare function formatDone(verdict: DoneVerdict, template?: string): string; export {};