import { type CodaliRuntimeAgentInput, type CodaliRuntimeEvent, type CodaliRuntimeInput, type CodaliRuntimePolicy, type CodaliRuntimeProviderInput, type CodaliRuntimeResult, type CodaliRuntimeTelemetry, type CodaliRuntimeToolManifest } from "./CodaliRuntime.js"; import type { ProviderMessage, ProviderUsage } from "../providers/ProviderTypes.js"; export type CodaliJobStageKind = "router" | "planner" | "worker" | "adjudicator" | "synthesizer" | "verifier" | "repair" | (string & {}); export type CodaliJobStageStatus = "completed" | "failed" | "skipped"; export type CodaliJobStatus = "succeeded" | "failed" | "partial" | "needs_clarification"; export interface CodaliJobStageDefinition { id: string; kind: CodaliJobStageKind; role?: string; title?: string; goal?: string; prompt?: string; dependsOn?: string[]; optional?: boolean; maxSteps?: number; maxToolCalls?: number; timeoutMs?: number; mode?: CodaliRuntimePolicy["mode"]; agent?: CodaliRuntimeAgentInput; provider?: CodaliRuntimeProviderInput; response?: CodaliRuntimeInput["response"]; outputSchema?: Record; metadata?: Record; } export interface CodaliJobBudgets { maxRuntimeMs?: number; maxToolCalls?: number; maxFollowups?: number; maxParallelStages?: number; } export interface CodaliJobAgentPolicy { defaultAgent?: CodaliRuntimeAgentInput; defaultProvider?: CodaliRuntimeProviderInput; stageAgents?: Record; stageProviders?: Record; preferSmallLocal?: boolean; allowCloudFallback?: boolean; metadata?: Record; } export interface CodaliJobResponsePolicy { format?: "text" | "json" | "json_schema"; schema?: Record; requireEvidence?: boolean; metadata?: Record; } export interface CodaliJobRequest { id?: string; jobType: string; input?: unknown; context?: Record; tenant?: Record; requester?: Record; toolManifest?: CodaliRuntimeToolManifest; stages?: CodaliJobStageDefinition[]; budgets?: CodaliJobBudgets; agentPolicy?: CodaliJobAgentPolicy; response?: CodaliJobResponsePolicy; metadata?: Record; } export interface CodaliEvidenceCard { id?: string; stageId?: string; source?: string; title?: string; summary?: string; confidence?: number; metadata?: Record; } export interface CodaliVerifierResult { passed: boolean; summary?: string; issues?: string[]; repairPrompt?: string; metadata?: Record; } export interface CodaliJobRuntimeError { stageId?: string; code: string; message: string; retryable?: boolean; } export interface CodaliJobStageResult { id: string; kind: CodaliJobStageKind; status: CodaliJobStageStatus; attempt: number; output: string; parsedOutput?: Record; usage?: ProviderUsage; messages: ProviderMessage[]; toolCallsExecuted: number; touchedFiles: string[]; warnings: string[]; telemetry?: CodaliRuntimeTelemetry; evidence: CodaliEvidenceCard[]; verifier?: CodaliVerifierResult; startedAt: string; endedAt: string; durationMs: number; agentSlug?: string; model?: string; error?: CodaliJobRuntimeError; metadata?: Record; } export type CodaliJobEvent = { type: "job_start"; runId: string; jobId: string; jobType: string; at: string; } | { type: "stage_start"; runId: string; jobId: string; stageId: string; kind: CodaliJobStageKind; attempt: number; at: string; } | { type: "stage_result"; runId: string; jobId: string; stageId: string; kind: CodaliJobStageKind; status: CodaliJobStageStatus; durationMs: number; toolCallsExecuted: number; at: string; } | { type: "stage_error"; runId: string; jobId: string; stageId: string; kind: CodaliJobStageKind; code: string; message: string; at: string; } | { type: "runtime_event"; runId: string; jobId: string; stageId: string; event: CodaliRuntimeEvent; at: string; } | { type: "job_result"; runId: string; jobId: string; status: CodaliJobStatus; stageCount: number; toolCallsExecuted: number; at: string; }; export interface CodaliJobTelemetryStage { id: string; kind: CodaliJobStageKind; status: CodaliJobStageStatus; attempt: number; durationMs: number; toolCallsExecuted: number; agentSlug?: string; model?: string; errorCode?: string; } export interface CodaliJobTelemetry { runId: string; runtime: "codali"; mode: "job"; jobId: string; jobType: string; status: CodaliJobStatus; stageCount: number; toolCallCount: number; calledTools: string[]; consideredTools: string[]; warnings: string[]; errors: CodaliJobRuntimeError[]; stages: CodaliJobTelemetryStage[]; } export interface CodaliJobRuntimeResult { output: string; status: CodaliJobStatus; runId: string; jobId: string; jobType: string; stages: CodaliJobStageResult[]; evidence: CodaliEvidenceCard[]; verifier?: CodaliVerifierResult; messages: ProviderMessage[]; usage?: ProviderUsage; toolCallsExecuted: number; touchedFiles: string[]; warnings: string[]; errors: CodaliJobRuntimeError[]; events: CodaliJobEvent[]; telemetry: CodaliJobTelemetry; metadata?: Record; } export type CodaliTaskRunner = (input: CodaliRuntimeInput) => Promise; export interface CodaliJobRuntimeInput { request: CodaliJobRequest; runtime: Omit & { messages?: ProviderMessage[]; metadata?: CodaliRuntimeInput["metadata"]; onEvent?: CodaliRuntimeInput["onEvent"]; }; onEvent?: (event: CodaliJobEvent) => void | Promise; runTask?: CodaliTaskRunner; } export declare const runCodaliJob: (input: CodaliJobRuntimeInput) => Promise; //# sourceMappingURL=CodaliJobRuntime.d.ts.map