import type { CapabilityEnvelope, EvidenceBundle, EvidenceRef, GateOutcome } from "../autonomy/contracts.ts"; import { type EvidenceFindingDraft } from "../autonomy/evidence-finding-projection.ts"; import { RESEARCH_LANE_SYSTEM_PROMPT } from "../provider-prompt-contracts.ts"; export { RESEARCH_LANE_SYSTEM_PROMPT }; /** * Pure orchestration for one autonomous research pass: gate -> bounded isolated completion -> * parse -> evidence bundle. The model executor is injected so this stays provider-free and * session-free; production wires `AgentSession.runIsolatedCompletion` in. * * The lane is read-only by construction: the host may provide a classified read-only child tool * surface, and the output is an `EvidenceBundle` whose model-synthesized findings are untrusted. */ /** Static across calls so callers can use `cacheRetention: "short"` and only pay for the variable tail. */ export interface ResearchCompletion { text: string; costUsd: number; stopReason: string; } export interface ResearchRunnerOptions { query: string; /** Bounded, pre-redacted context handed to the research model (goal text, open requirements). */ context?: string; /** Stripped research envelope - never the foreground/architect envelope. */ envelope: CapabilityEnvelope; /** * Pointer-first workspace sources (repo-relative path + bounded excerpt, never file bodies) that * inform the pass. They are rendered into the user prompt and carried into the evidence bundle; * omitted / empty reproduces the pre-collector behavior exactly. */ sources?: readonly EvidenceRef[]; /** Budget for this pass; a post-hoc breach marks the run budget_exhausted (spend stays visible). */ maxUsd: number; maxSources: number; maxFindings: number; /** Wall-clock budget in milliseconds; 0 disables. */ maxWallClockMs: number; /** Executes one isolated completion. Production: AgentSession.runIsolatedCompletion. */ complete: (args: { systemPrompt: string; userPrompt: string; signal?: AbortSignal; }) => Promise; /** External cancellation (e.g. session disposal). */ signal?: AbortSignal; } export type ResearchRunStatus = "succeeded" | "failed" | "canceled" | "timeout" | "budget_exhausted"; export interface ResearchRunResult { status: ResearchRunStatus; reasonCode: string; /** Underlying executor error for `completion_error` outcomes; absent for policy outcomes. */ reasonDetail?: string; gateOutcome: GateOutcome; bundle?: EvidenceBundle; costUsd: number; } export declare function buildResearchUserPrompt(args: { query: string; context?: string; sources?: readonly EvidenceRef[]; maxFindings: number; }): string; export interface ParsedResearchFindings { findings: EvidenceFindingDraft[]; } export declare function parseResearchFindings(text: string, maxFindings: number): ParsedResearchFindings | undefined; export declare function runResearch(options: ResearchRunnerOptions): Promise; //# sourceMappingURL=research-runner.d.ts.map