import type { LocalOpenAiCompatibleRunnerConfig, LocalRunnerAuthMode, LocalRunnerKind, LocalRunnerResponseFormatStrategy } from "@mcoda/shared"; export type ProviderRole = "system" | "user" | "assistant" | "tool"; export interface ProviderToolDefinition { name: string; description?: string; inputSchema?: Record; } export interface ProviderToolCall { id: string; name: string; args: unknown; } export type AgentStatusPhase = "thinking" | "executing" | "patching" | "done"; export type AgentEvent = { type: "token"; content: string; } | { type: "tool_call"; name: string; args: unknown; } | { type: "tool_result"; name: string; output: string; ok?: boolean; errorCode?: string; retryable?: boolean; } | { type: "status"; phase: AgentStatusPhase; message?: string; } | { type: "error"; message: string; }; export interface ProviderResponseFormat { type: "json" | "json_schema" | "text" | "gbnf"; schema?: Record; grammar?: string; } export interface ProviderMessage { role: ProviderRole; content: string; name?: string; toolCallId?: string; } export interface ProviderUsage { inputTokens?: number; outputTokens?: number; totalTokens?: number; } export interface ProviderRequest { messages: ProviderMessage[]; tools?: ProviderToolDefinition[]; toolChoice?: "auto" | "none" | { name: string; }; maxTokens?: number; temperature?: number; responseFormat?: ProviderResponseFormat; stream?: boolean; onEvent?: (event: AgentEvent) => void; onToken?: (token: string) => void; streamFlushMs?: number; } export interface ProviderResponse { message: ProviderMessage; toolCalls?: ProviderToolCall[]; usage?: ProviderUsage; raw?: unknown; } export interface ProviderConfig { model: string; /** Agent this provider serves, so failures can name it. */ agentSlug?: string; apiKey?: string; baseUrl?: string; timeoutMs?: number; localRunner?: LocalOpenAiCompatibleRunnerConfig; runnerKind?: LocalRunnerKind; authMode?: LocalRunnerAuthMode; dummyBearerToken?: string; headers?: Record; extraBody?: Record; responseFormatStrategy?: LocalRunnerResponseFormatStrategy; healthPath?: string; modelsPath?: string; requireModelInRequest?: boolean; supportsStreaming?: boolean; supportsTools?: boolean; supportsJsonSchema?: boolean; supportsGbnf?: boolean; } export interface Provider { name: string; /** * Whether this adapter can return `ProviderResponse.toolCalls`. * * Distinct from an agent's advertised `supportsTools`: a CLI-backed agent may * well have tools of its own, but this adapter drives it through a text * interface and can never surface a structured tool call. Treating the two as * the same produces a plan full of tool tasks and then zero tool calls, with * nothing in the trace explaining why. * * Undefined is read as false. */ supportsToolCalls?: boolean; generate(request: ProviderRequest): Promise; } export declare const providerSupportsToolCalls: (provider: Provider) => boolean; //# sourceMappingURL=ProviderTypes.d.ts.map