import { type ProviderAdapter, type ProviderBudgetTracker, type ProviderGenerationRequestV1, type ProviderGenerationResultV1, type ProviderToolCallV1, type ProviderToolDefinitionV1 } from "../llms/provider.ts"; import { type ContextBudgetV1, type ContextManifestV1 } from "../memory/context.ts"; import { CompilerToolExecutor } from "../memory/compiler-tools.ts"; import type { ProjectProfileV1 } from "../tools/analysis/analyzer-types.ts"; export interface ProviderToolLoopOptions { adapter: ProviderAdapter; budget?: ProviderBudgetTracker; request: ProviderGenerationRequestV1; validateFinal: (value: unknown) => T; /** * Convert a final-artifact validation failure into one bounded correction * turn. Tool validation and provider-envelope errors remain fail-closed. */ repairFinal?: (value: unknown, error: unknown) => string | undefined; tools?: readonly ProviderToolDefinitionV1[]; /** Exact host validator, run for the whole batch before the first execution. */ validateToolCall?: (call: ProviderToolCallV1) => void; executeTool?: (call: ProviderToolCallV1) => Promise; /** * A validated tool may itself be the terminal artifact. This is used by * selected-code edits so replacement text is submitted through the edit tool * and never needs a second, potentially different model response. */ terminalAfterTools?: (calls: readonly ProviderToolCallV1[], outputs: readonly unknown[]) => { value: T; } | undefined; /** A run may authorize fewer calls; the absolute implementation cap is 8. */ maxToolCalls?: number; } export interface ProviderToolLoopResult { value: T; turns: readonly ProviderGenerationResultV1[]; toolCalls: number; } /** * Run provider turns until a locally validated final value is produced. * Intermediate tool envelopes pass through the same provider boundary, * cumulative budget accounting, secret scan, and clone checks as final output. */ export declare function runProviderToolLoop(options: ProviderToolLoopOptions): Promise>; export interface AgentContextCoordinatorOptions { root: string; profile: ProjectProfileV1; executor: CompilerToolExecutor; offline?: boolean; secretPolicy?: "block" | "redact"; budget: ContextBudgetV1; officialDocumentationHosts?: readonly string[]; } export interface ContextToolResultV1 { schemaVersion: 1; requestId: string; ok: boolean; evidence: ContextManifestV1["evidence"]; exclusions: ContextManifestV1["exclusions"]; remaining: { requests: number; items: number; bytes: number; estimatedTokens: number; }; error?: { code: string; message: string; }; } /** Append-only context materializer shared by every target and retry in a run. */ export declare class AgentContextCoordinator { #private; constructor(options: AgentContextCoordinatorOptions); execute(call: ProviderToolCallV1): Promise; get manifest(): ContextManifestV1; get manifestHash(): string; get contextRequests(): number; } //# sourceMappingURL=provider-tool-loop.d.ts.map