import { AutocompleteInput } from "../autocomplete/util/types"; import { ProfileDescription } from "../config/ConfigHandler"; import type { BrowserSerializedContinueConfig, ChatMessage, ContextItem, ContextItemWithId, ContextSubmenuItem, DiffLine, FileSymbolMap, IdeSettings, LLMFullCompletionOptions, ModelDescription, ModelRoles, RangeInFile, SerializedContinueConfig, Session, SessionMetadata, SiteIndexingConfig, ToolCall, } from "../"; export type ProtocolGeneratorType = AsyncGenerator<{ done?: boolean; content: T; }>; export type OnboardingModes = | "Local" | "Best" | "Custom" | "Quickstart" | "LocalAfterFreeTrial"; export interface ListHistoryOptions { offset?: number; limit?: number; } export type ToCoreFromIdeOrWebviewProtocol = { "update/modelChange": [string, void]; "update/selectTabAutocompleteModel": [string, void]; // Special ping: [string, string]; abort: [undefined, void]; // History "history/list": [ListHistoryOptions, SessionMetadata[]]; "history/delete": [{ id: string }, void]; "history/load": [{ id: string }, Session]; "history/save": [Session, void]; "devdata/log": [{ tableName: string; data: any }, void]; "config/addOpenAiKey": [string, void]; "config/addModel": [ { model: SerializedContinueConfig["models"][number]; role?: keyof ModelRoles; }, void, ]; "config/newPromptFile": [undefined, void]; "config/ideSettingsUpdate": [IdeSettings, void]; "config/getSerializedProfileInfo": [ undefined, { config: BrowserSerializedContinueConfig; profileId: string }, ]; "config/deleteModel": [{ title: string }, void]; "config/reload": [undefined, BrowserSerializedContinueConfig]; "config/listProfiles": [undefined, ProfileDescription[]]; "config/openProfile": [{ profileId: string | undefined }, void]; "context/getContextItems": [ { name: string; query: string; fullInput: string; selectedCode: RangeInFile[]; }, ContextItemWithId[], ]; "context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap]; "context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]]; "autocomplete/complete": [AutocompleteInput, string[]]; "context/addDocs": [SiteIndexingConfig, void]; "context/removeDocs": [Pick, void]; "context/indexDocs": [{ reIndex: boolean }, void]; "autocomplete/cancel": [undefined, void]; "autocomplete/accept": [{ completionId: string }, void]; "command/run": [ { input: string; history: ChatMessage[]; modelTitle: string; slashCommandName: string; contextItems: ContextItemWithId[]; params: any; historyIndex: number; selectedCode: RangeInFile[]; }, ProtocolGeneratorType, ]; "llm/complete": [ { prompt: string; completionOptions: LLMFullCompletionOptions; title: string; }, string, ]; "llm/listModels": [{ title: string }, string[] | undefined]; "llm/streamComplete": [ { prompt: string; completionOptions: LLMFullCompletionOptions; title: string; }, ProtocolGeneratorType, ]; "llm/streamChat": [ { messages: ChatMessage[]; completionOptions: LLMFullCompletionOptions; title: string; }, ProtocolGeneratorType, ]; streamDiffLines: [ { prefix: string; highlighted: string; suffix: string; input: string; language: string | undefined; modelTitle: string | undefined; }, ProtocolGeneratorType, ]; "chatDescriber/describe": [string, string | undefined]; "stats/getTokensPerDay": [ undefined, { day: string; promptTokens: number; generatedTokens: number }[], ]; "stats/getTokensPerModel": [ undefined, { model: string; promptTokens: number; generatedTokens: number }[], ]; "tts/kill": [undefined, void]; // Codebase indexing "index/setPaused": [boolean, void]; "index/forceReIndex": [ undefined | { dirs?: string[]; shouldClearIndexes?: boolean }, void, ]; "index/forceReIndexFiles": [undefined | { files?: string[] }, void]; "index/indexingProgressBarInitialized": [undefined, void]; completeOnboarding: [ { mode: OnboardingModes; }, void, ]; // Docs etc. Indexing. TODO move codebase to this "indexing/reindex": [{ type: string; id: string }, void]; "indexing/abort": [{ type: string; id: string }, void]; "indexing/setPaused": [{ type: string; id: string; paused: boolean }, void]; "docs/getSuggestedDocs": [undefined, void]; "docs/initStatuses": [undefined, void]; addAutocompleteModel: [{ model: ModelDescription }, void]; "profiles/switch": [{ id: string }, undefined]; "auth/getAuthUrl": [undefined, { url: string }]; "tools/call": [{ toolCall: ToolCall }, { contextItems: ContextItem[] }]; };