import type { ConversationMode } from '../runtime/agentRuntimeContext.js'; import type { CacheEditsState, LlmStreamEvent, Message, Provider, PromptCacheContext, Tool } from '../types.js'; export interface NormalizedModelRequest { provider: Provider; messages: Message[]; tools: Tool[]; signal?: AbortSignal; /** Retry rounds; 1 disables all re-requests, including compatibility fallbacks. Omitted uses normal policy. */ maxAttempts?: number; responseFormat?: { type: 'json_schema'; json_schema: { name: string; schema: Record; strict?: boolean } }; promptCache?: PromptCacheContext; cacheRole?: PromptCacheContext['role']; conversationMode?: ConversationMode; cacheEdits?: CacheEditsState; /** Current-turn images must not be silently removed when they are required. */ visionPolicy?: 'required' | 'optional-history'; /** Override the idle watchdog for requests known to carry an unusually large * prompt (e.g. compaction sending most of the history at once); gateway * transport currently ignores this, timing there is server-side. */ idleTimeoutMs?: number; } /** Both local and gateway transports consume the same normalized request. */ export interface ModelProvider { readonly source: 'local' | 'gateway'; readonly descriptor: Provider; stream(request: NormalizedModelRequest): AsyncGenerator; }