export type CompletionContentPartText = { type: "text"; text: string; }; export type CompletionContentPartImage = { type: "image"; base64Data: string; }; export type CompletionContentPart = CompletionContentPartText | CompletionContentPartImage; export type CompletionUserMessage = { role: "user"; content: string | CompletionContentPart[]; }; export type CompletionAssistantMessage = { role: "assistant"; content: string; }; export type CompletionInputMessage = CompletionUserMessage | CompletionAssistantMessage; export type FileContent = { path: string; content: string; }; export type StreamingFileParseResult = { type: "text"; content: string; } | { type: "end-file-block"; file: FileContent; } | { type: "start-file-block"; path: string; } | { type: "text-block"; content: string; }; export type ModelDescription = { key: string; name: string; maxOutputTokens: number; description?: string; }; export type ConfigLoaders = { configDir: string; }; export type CompletionFunc = (messages: CompletionInputMessage[], options: CompletionOptions, reload?: boolean) => Promise; export type InitResult = { created: string[]; skipped: string[]; }; export type LLMAPI = { getProviderName: () => string; completion: CompletionFunc; getModels: () => Promise; init: (options?: { storeKeysGlobally?: boolean; force?: boolean; }) => Promise; }; export type LLMProvider = { getName: () => string; getAPI: (configDir: string, globalConfigDir?: string, logger?: Logger) => LLMAPI; }; export type CompletionOptions = { model: string; maxTokens?: number; reloadConfig?: boolean; cancelCallback?: (cancel: () => void) => void; responseStreamCallback?: (data: string) => void; fileResultStreamCallback?: (data: StreamingFileParseResult) => void; tokenCounting?: "approx" | "disabled"; }; export type CompletionResult = { message: string; finishReason: "STOP" | "MAX_TOKENS"; usage?: { inputTokens: number; outputTokens: number; }; }; export type ParseFunc = (response: string) => Promise; export type ResponseParsers = "file-block"; export type Logger = { writeError: (text: string) => void; writeDebug: (text: string) => void; };