Elffuss BraidHub

kikocis/continue public

3ff29c567dd0 · 9.5 KiBRawPermalink
1import {
2 BlockType,
3 ConfigResult,
4 DevDataLogEvent,
5 ModelRole,
6} from "@continuedev/config-yaml";
7import { ToolPolicy } from "@continuedev/terminal-security";
8
9import {
10 AutocompleteInput,
11 RecentlyEditedRange,
12} from "../autocomplete/util/types";
13import { SharedConfigSchema } from "../config/sharedConfig";
14import { GlobalContextModelSelections } from "../util/GlobalContext";
15
16import {
17 BrowserSerializedContinueConfig,
18 ChatMessage,
19 CompiledMessagesResult,
20 CompleteOnboardingPayload,
21 ContextItem,
22 ContextItemWithId,
23 ContextSubmenuItem,
24 DiffLine,
25 DocsIndexingDetails,
26 ExperimentalModelRoles,
27 FileSymbolMap,
28 IdeSettings,
29 LLMFullCompletionOptions,
30 MCPServerStatus,
31 MessageOption,
32 ModelDescription,
33 PromptLog,
34 RangeInFile,
35 RangeInFileWithNextEditInfo,
36 SerializedContinueConfig,
37 Session,
38 BaseSessionMetadata,
39 SiteIndexingConfig,
40 SlashCommandDescWithSource,
41 StreamDiffLinesPayload,
42 ToolCall,
43} from "../";
44import { AutocompleteCodeSnippet } from "../autocomplete/snippets/types";
45import { GetLspDefinitionsFunction } from "../autocomplete/types";
46import { ConfigHandler } from "../config/ConfigHandler";
47import { SerializedOrgWithProfiles } from "../config/ProfileLifecycleManager";
48import {
49 ControlPlaneEnv,
50 ControlPlaneSessionInfo,
51} from "../control-plane/AuthTypes";
52import {
53 FreeTrialStatus,
54 RemoteSessionMetadata,
55} from "../control-plane/client";
56import { ProcessedItem } from "../nextEdit/NextEditPrefetchQueue";
57import { NextEditOutcome } from "../nextEdit/types";
58
59export enum OnboardingModes {
60 API_KEY = "API Key",
61 LOCAL = "Local",
62 MODELS_ADD_ON = "Models Add-On",
63}
64
65export interface ListHistoryOptions {
66 offset?: number;
67 limit?: number;
68}
69
70export type ToCoreFromIdeOrWebviewProtocol = {
71 // Special
72 ping: [string, string];
73 abort: [undefined, void];
74 cancelApply: [undefined, void];
75
76 // History
77 "history/list": [
78 ListHistoryOptions,
79 (BaseSessionMetadata | RemoteSessionMetadata)[],
80 ];
81 "history/delete": [{ id: string }, void];
82 "history/load": [{ id: string }, Session];
83 "history/loadRemote": [{ remoteId: string }, Session];
84 "history/save": [Session, void];
85 "history/share": [{ id: string; outputDir?: string }, void];
86 "history/clear": [undefined, void];
87 "devdata/log": [DevDataLogEvent, void];
88 "config/addOpenAiKey": [string, void];
89 "config/addModel": [
90 {
91 model: SerializedContinueConfig["models"][number];
92 role?: keyof ExperimentalModelRoles;
93 },
94 void,
95 ];
96 "config/addLocalWorkspaceBlock": [{ blockType: BlockType }, void];
97 "config/newPromptFile": [undefined, void];
98 "config/newAssistantFile": [undefined, void];
99 "config/ideSettingsUpdate": [IdeSettings, void];
100 "config/getSerializedProfileInfo": [
101 undefined,
102 {
103 result: ConfigResult<BrowserSerializedContinueConfig>;
104 profileId: string | null;
105 organizations: SerializedOrgWithProfiles[];
106 selectedOrgId: string | null;
107 },
108 ];
109 "config/deleteModel": [{ title: string }, void];
110 "config/refreshProfiles": [
111 (
112 | undefined
113 | {
114 reason?: string;
115 selectOrgId?: string;
116 selectProfileId?: string;
117 }
118 ),
119 void,
120 ];
121 "config/openProfile": [
122 { profileId: string | undefined; element?: { sourceFile?: string } },
123 void,
124 ];
125 "config/updateSharedConfig": [SharedConfigSchema, SharedConfigSchema];
126 "config/updateSelectedModel": [
127 {
128 profileId: string;
129 role: ModelRole;
130 title: string | null;
131 },
132 GlobalContextModelSelections,
133 ];
134 "context/getContextItems": [
135 {
136 name: string;
137 query: string;
138 fullInput: string;
139 selectedCode: RangeInFile[];
140 isInAgentMode: boolean;
141 },
142 ContextItemWithId[],
143 ];
144
145 "mcp/reloadServer": [
146 {
147 id: string;
148 },
149 void,
150 ];
151 "mcp/disconnectServer": [{ id: string }, void];
152 "mcp/getDisconnectedServers": [undefined, string[]];
153 "mcp/getPrompt": [
154 {
155 serverName: string;
156 promptName: string;
157 args?: Record<string, string>;
158 },
159 {
160 prompt: string;
161 description: string | undefined;
162 },
163 ];
164 "mcp/startAuthentication": [MCPServerStatus, void];
165 "mcp/removeAuthentication": [MCPServerStatus, void];
166
167 "context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap];
168 "context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]];
169 "autocomplete/complete": [AutocompleteInput, string[]];
170 "context/addDocs": [SiteIndexingConfig, void];
171 "context/removeDocs": [Pick<SiteIndexingConfig, "startUrl">, void];
172 "context/indexDocs": [{ reIndex: boolean }, void];
173 "autocomplete/cancel": [undefined, void];
174 "autocomplete/accept": [{ completionId: string }, void];
175 "nextEdit/predict": [
176 {
177 input: AutocompleteInput;
178 options?: {
179 withChain?: boolean;
180 usingFullFileDiff?: boolean;
181 };
182 },
183 NextEditOutcome | undefined,
184 ];
185 "nextEdit/reject": [{ completionId: string }, void];
186 "nextEdit/accept": [{ completionId: string }, void];
187 "nextEdit/startChain": [undefined, void];
188 "nextEdit/deleteChain": [undefined, void];
189 "nextEdit/isChainAlive": [undefined, boolean];
190 "nextEdit/queue/getProcessedCount": [undefined, number];
191 "nextEdit/queue/dequeueProcessed": [undefined, ProcessedItem | null];
192 "nextEdit/queue/processOne": [
193 {
194 ctx: {
195 completionId: string;
196 manuallyPassFileContents?: string;
197 manuallyPassPrefix?: string;
198 selectedCompletionInfo?: {
199 text: string;
200 range: Range;
201 };
202 isUntitledFile: boolean;
203 recentlyVisitedRanges: AutocompleteCodeSnippet[];
204 recentlyEditedRanges: RecentlyEditedRange[];
205 };
206 recentlyVisitedRanges: AutocompleteCodeSnippet[];
207 recentlyEditedRanges: RecentlyEditedRange[];
208 },
209 void,
210 ];
211 "nextEdit/queue/clear": [undefined, void];
212 "nextEdit/queue/abort": [undefined, void];
213 "llm/complete": [
214 {
215 prompt: string;
216 completionOptions: LLMFullCompletionOptions;
217 title: string;
218 },
219 string,
220 ];
221 "llm/listModels": [{ title: string }, string[] | undefined];
222 "llm/streamChat": [
223 {
224 messages: ChatMessage[];
225 completionOptions: LLMFullCompletionOptions;
226 title: string;
227 messageOptions?: MessageOption;
228 legacySlashCommandData?: {
229 command: SlashCommandDescWithSource;
230 input: string;
231 contextItems: ContextItemWithId[];
232 historyIndex: number;
233 selectedCode: RangeInFile[];
234 };
235 },
236 AsyncGenerator<ChatMessage, PromptLog>,
237 ];
238 streamDiffLines: [StreamDiffLinesPayload, AsyncGenerator<DiffLine>];
239 "llm/compileChat": [
240 { messages: ChatMessage[]; options: LLMFullCompletionOptions },
241 CompiledMessagesResult,
242 ];
243 "chatDescriber/describe": [
244 {
245 text: string;
246 },
247 string | undefined,
248 ];
249 "conversation/compact": [
250 {
251 index: number;
252 sessionId: string;
253 },
254 string | undefined,
255 ];
256 "stats/getTokensPerDay": [
257 undefined,
258 { day: string; promptTokens: number; generatedTokens: number }[],
259 ];
260 "stats/getTokensPerModel": [
261 undefined,
262 { model: string; promptTokens: number; generatedTokens: number }[],
263 ];
264 "tts/kill": [undefined, void];
265
266 // Codebase indexing
267 "index/setPaused": [boolean, void];
268 "index/forceReIndex": [
269 undefined | { dirs?: string[]; shouldClearIndexes?: boolean },
270 void,
271 ];
272 "index/indexingProgressBarInitialized": [undefined, void];
273 "onboarding/complete": [CompleteOnboardingPayload, void];
274
275 // File changes
276 "files/changed": [{ uris?: string[] }, void];
277 "files/opened": [{ uris?: string[] }, void];
278 "files/created": [{ uris?: string[] }, void];
279 "files/deleted": [{ uris?: string[] }, void];
280 "files/closed": [{ uris?: string[] }, void];
281 "files/smallEdit": [
282 {
283 actions: RangeInFileWithNextEditInfo[];
284 configHandler: ConfigHandler;
285 getDefsFromLspFunction: GetLspDefinitionsFunction;
286 recentlyEditedRanges: RecentlyEditedRange[];
287 recentlyVisitedRanges: AutocompleteCodeSnippet[];
288 },
289 void,
290 ];
291
292 // Docs etc. Indexing. TODO move codebase to this
293 "indexing/reindex": [{ type: string; id: string }, void];
294 "indexing/abort": [{ type: string; id: string }, void];
295 "indexing/setPaused": [{ type: string; id: string; paused: boolean }, void];
296 "docs/getSuggestedDocs": [undefined, void];
297 "docs/initStatuses": [undefined, void];
298 "docs/getDetails": [{ startUrl: string }, DocsIndexingDetails];
299 "docs/getIndexedPages": [{ startUrl: string }, string[]];
300 addAutocompleteModel: [{ model: ModelDescription }, void];
301
302 "auth/getAuthUrl": [{ useOnboarding: boolean }, { url: string }];
303 "tools/call": [
304 { toolCall: ToolCall },
305 { contextItems: ContextItem[]; errorMessage?: string },
306 ];
307 "tools/evaluatePolicy": [
308 { toolName: string; basePolicy: ToolPolicy; args: Record<string, unknown> },
309 { policy: ToolPolicy; displayValue?: string },
310 ];
311 "clipboardCache/add": [{ content: string }, void];
312 "controlPlane/openUrl": [{ path: string; orgSlug?: string }, void];
313 "controlPlane/getEnvironment": [undefined, ControlPlaneEnv];
314 "controlPlane/getFreeTrialStatus": [undefined, FreeTrialStatus | null];
315 "controlPlane/getModelsAddOnUpgradeUrl": [
316 { vsCodeUriScheme?: string },
317 { url: string } | null,
318 ];
319 isItemTooBig: [{ item: ContextItemWithId }, boolean];
320 didChangeControlPlaneSessionInfo: [
321 { sessionInfo: ControlPlaneSessionInfo | undefined },
322 void,
323 ];
324 "process/markAsBackgrounded": [{ toolCallId: string }, void];
325 "process/isBackgrounded": [{ toolCallId: string }, boolean];
326 "process/killTerminalProcess": [{ toolCallId: string }, void];
327 "mdm/setLicenseKey": [{ licenseKey: string }, boolean];
328};