Elffuss BraidHub

kikocis/continue public

fd84b2d5fd91 · 7.2 KiBRawPermalink
1import {
2 BlockType,
3 ConfigResult,
4 DevDataLogEvent,
5 ModelRole,
6} from "@continuedev/config-yaml";
7
8import {
9 AutocompleteInput,
10 RecentlyEditedRange,
11} from "../autocomplete/util/types";
12import { SharedConfigSchema } from "../config/sharedConfig";
13import { GlobalContextModelSelections } from "../util/GlobalContext";
14
15import {
16 BrowserSerializedContinueConfig,
17 ChatMessage,
18 CompiledMessagesResult,
19 CompleteOnboardingPayload,
20 ContextItem,
21 ContextItemWithId,
22 ContextSubmenuItem,
23 DiffLine,
24 DocsIndexingDetails,
25 ExperimentalModelRoles,
26 FileSymbolMap,
27 IdeSettings,
28 LLMFullCompletionOptions,
29 MessageOption,
30 ModelDescription,
31 PromptLog,
32 RangeInFile,
33 RangeInFileWithNextEditInfo,
34 SerializedContinueConfig,
35 Session,
36 SessionMetadata,
37 SiteIndexingConfig,
38 SlashCommandDescWithSource,
39 StreamDiffLinesPayload,
40 ToolCall,
41} from "../";
42import { AutocompleteCodeSnippet } from "../autocomplete/snippets/types";
43import { GetLspDefinitionsFunction } from "../autocomplete/types";
44import { ConfigHandler } from "../config/ConfigHandler";
45import { SerializedOrgWithProfiles } from "../config/ProfileLifecycleManager";
46import { ControlPlaneSessionInfo } from "../control-plane/AuthTypes";
47import { FreeTrialStatus } from "../control-plane/client";
48
49export enum OnboardingModes {
50 API_KEY = "API Key",
51 LOCAL = "Local",
52 MODELS_ADD_ON = "Models Add-On",
53}
54
55export interface ListHistoryOptions {
56 offset?: number;
57 limit?: number;
58}
59
60export type ToCoreFromIdeOrWebviewProtocol = {
61 // Special
62 ping: [string, string];
63 abort: [undefined, void];
64 cancelApply: [undefined, void];
65
66 // History
67 "history/list": [ListHistoryOptions, SessionMetadata[]];
68 "history/delete": [{ id: string }, void];
69 "history/load": [{ id: string }, Session];
70 "history/save": [Session, void];
71 "history/clear": [undefined, void];
72 "devdata/log": [DevDataLogEvent, void];
73 "config/addOpenAiKey": [string, void];
74 "config/addModel": [
75 {
76 model: SerializedContinueConfig["models"][number];
77 role?: keyof ExperimentalModelRoles;
78 },
79 void,
80 ];
81 "config/addLocalWorkspaceBlock": [{ blockType: BlockType }, void];
82 "config/newPromptFile": [undefined, void];
83 "config/ideSettingsUpdate": [IdeSettings, void];
84 "config/getSerializedProfileInfo": [
85 undefined,
86 {
87 result: ConfigResult<BrowserSerializedContinueConfig>;
88 profileId: string | null;
89 organizations: SerializedOrgWithProfiles[];
90 selectedOrgId: string;
91 },
92 ];
93 "config/deleteModel": [{ title: string }, void];
94 "config/reload": [undefined, ConfigResult<BrowserSerializedContinueConfig>];
95 "config/refreshProfiles": [
96 (
97 | undefined
98 | {
99 selectOrgId?: string;
100 selectProfileId?: string;
101 }
102 ),
103 void,
104 ];
105 "config/openProfile": [{ profileId: string | undefined }, void];
106 "config/updateSharedConfig": [SharedConfigSchema, SharedConfigSchema];
107 "config/updateSelectedModel": [
108 {
109 profileId: string;
110 role: ModelRole;
111 title: string | null;
112 },
113 GlobalContextModelSelections,
114 ];
115 "context/getContextItems": [
116 {
117 name: string;
118 query: string;
119 fullInput: string;
120 selectedCode: RangeInFile[];
121 isInAgentMode: boolean;
122 },
123 ContextItemWithId[],
124 ];
125 "mcp/reloadServer": [
126 {
127 id: string;
128 },
129 void,
130 ];
131 "mcp/getPrompt": [
132 {
133 serverName: string;
134 promptName: string;
135 args?: Record<string, string>;
136 },
137 {
138 prompt: string;
139 description: string | undefined;
140 },
141 ];
142 "context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap];
143 "context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]];
144 "autocomplete/complete": [AutocompleteInput, string[]];
145 "context/addDocs": [SiteIndexingConfig, void];
146 "context/removeDocs": [Pick<SiteIndexingConfig, "startUrl">, void];
147 "context/indexDocs": [{ reIndex: boolean }, void];
148 "autocomplete/cancel": [undefined, void];
149 "autocomplete/accept": [{ completionId: string }, void];
150 "llm/complete": [
151 {
152 prompt: string;
153 completionOptions: LLMFullCompletionOptions;
154 title: string;
155 },
156 string,
157 ];
158 "llm/listModels": [{ title: string }, string[] | undefined];
159 "llm/streamChat": [
160 {
161 messages: ChatMessage[];
162 completionOptions: LLMFullCompletionOptions;
163 title: string;
164 messageOptions?: MessageOption;
165 legacySlashCommandData?: {
166 command: SlashCommandDescWithSource;
167 input: string;
168 contextItems: ContextItemWithId[];
169 historyIndex: number;
170 selectedCode: RangeInFile[];
171 };
172 },
173 AsyncGenerator<ChatMessage, PromptLog>,
174 ];
175 streamDiffLines: [StreamDiffLinesPayload, AsyncGenerator<DiffLine>];
176 "llm/compileChat": [
177 { messages: ChatMessage[]; options: LLMFullCompletionOptions },
178 CompiledMessagesResult,
179 ];
180 "chatDescriber/describe": [
181 {
182 text: string;
183 },
184 string | undefined,
185 ];
186 "stats/getTokensPerDay": [
187 undefined,
188 { day: string; promptTokens: number; generatedTokens: number }[],
189 ];
190 "stats/getTokensPerModel": [
191 undefined,
192 { model: string; promptTokens: number; generatedTokens: number }[],
193 ];
194 "tts/kill": [undefined, void];
195
196 // Codebase indexing
197 "index/setPaused": [boolean, void];
198 "index/forceReIndex": [
199 undefined | { dirs?: string[]; shouldClearIndexes?: boolean },
200 void,
201 ];
202 "index/indexingProgressBarInitialized": [undefined, void];
203 "onboarding/complete": [CompleteOnboardingPayload, void];
204
205 // File changes
206 "files/changed": [{ uris?: string[] }, void];
207 "files/opened": [{ uris?: string[] }, void];
208 "files/created": [{ uris?: string[] }, void];
209 "files/deleted": [{ uris?: string[] }, void];
210 "files/closed": [{ uris?: string[] }, void];
211 "files/smallEdit": [
212 {
213 actions: RangeInFileWithNextEditInfo[];
214 configHandler: ConfigHandler;
215 getDefsFromLspFunction: GetLspDefinitionsFunction;
216 recentlyEditedRanges: RecentlyEditedRange[];
217 recentlyVisitedRanges: AutocompleteCodeSnippet[];
218 },
219 void,
220 ];
221
222 // Docs etc. Indexing. TODO move codebase to this
223 "indexing/reindex": [{ type: string; id: string }, void];
224 "indexing/abort": [{ type: string; id: string }, void];
225 "indexing/setPaused": [{ type: string; id: string; paused: boolean }, void];
226 "docs/getSuggestedDocs": [undefined, void];
227 "docs/initStatuses": [undefined, void];
228 "docs/getDetails": [{ startUrl: string }, DocsIndexingDetails];
229 addAutocompleteModel: [{ model: ModelDescription }, void];
230
231 "auth/getAuthUrl": [{ useOnboarding: boolean }, { url: string }];
232 "tools/call": [
233 { toolCall: ToolCall },
234 { contextItems: ContextItem[]; errorMessage?: string },
235 ];
236 "clipboardCache/add": [{ content: string }, void];
237 "controlPlane/openUrl": [{ path: string; orgSlug?: string }, void];
238 "controlPlane/getFreeTrialStatus": [undefined, FreeTrialStatus | null];
239 "controlPlane/getModelsAddOnUpgradeUrl": [
240 { vsCodeUriScheme?: string },
241 { url: string } | null,
242 ];
243 isItemTooBig: [{ item: ContextItemWithId }, boolean];
244 didChangeControlPlaneSessionInfo: [
245 { sessionInfo: ControlPlaneSessionInfo | undefined },
246 void,
247 ];
248 "process/markAsBackgrounded": [{ toolCallId: string }, void];
249 "process/isBackgrounded": [{ toolCallId: string }, boolean];
250 "mdm/setLicenseKey": [{ licenseKey: string }, boolean];
251};