Elffuss BraidHub

kikocis/continue public

2cf8097f3ed4 · 9.4 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/getPrompt": [
152 {
153 serverName: string;
154 promptName: string;
155 args?: Record<string, string>;
156 },
157 {
158 prompt: string;
159 description: string | undefined;
160 },
161 ];
162 "mcp/startAuthentication": [MCPServerStatus, void];
163 "mcp/removeAuthentication": [MCPServerStatus, void];
164
165 "context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap];
166 "context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]];
167 "autocomplete/complete": [AutocompleteInput, string[]];
168 "context/addDocs": [SiteIndexingConfig, void];
169 "context/removeDocs": [Pick<SiteIndexingConfig, "startUrl">, void];
170 "context/indexDocs": [{ reIndex: boolean }, void];
171 "autocomplete/cancel": [undefined, void];
172 "autocomplete/accept": [{ completionId: string }, void];
173 "nextEdit/predict": [
174 {
175 input: AutocompleteInput;
176 options?: {
177 withChain?: boolean;
178 usingFullFileDiff?: boolean;
179 };
180 },
181 NextEditOutcome | undefined,
182 ];
183 "nextEdit/reject": [{ completionId: string }, void];
184 "nextEdit/accept": [{ completionId: string }, void];
185 "nextEdit/startChain": [undefined, void];
186 "nextEdit/deleteChain": [undefined, void];
187 "nextEdit/isChainAlive": [undefined, boolean];
188 "nextEdit/queue/getProcessedCount": [undefined, number];
189 "nextEdit/queue/dequeueProcessed": [undefined, ProcessedItem | null];
190 "nextEdit/queue/processOne": [
191 {
192 ctx: {
193 completionId: string;
194 manuallyPassFileContents?: string;
195 manuallyPassPrefix?: string;
196 selectedCompletionInfo?: {
197 text: string;
198 range: Range;
199 };
200 isUntitledFile: boolean;
201 recentlyVisitedRanges: AutocompleteCodeSnippet[];
202 recentlyEditedRanges: RecentlyEditedRange[];
203 };
204 recentlyVisitedRanges: AutocompleteCodeSnippet[];
205 recentlyEditedRanges: RecentlyEditedRange[];
206 },
207 void,
208 ];
209 "nextEdit/queue/clear": [undefined, void];
210 "nextEdit/queue/abort": [undefined, void];
211 "llm/complete": [
212 {
213 prompt: string;
214 completionOptions: LLMFullCompletionOptions;
215 title: string;
216 },
217 string,
218 ];
219 "llm/listModels": [{ title: string }, string[] | undefined];
220 "llm/streamChat": [
221 {
222 messages: ChatMessage[];
223 completionOptions: LLMFullCompletionOptions;
224 title: string;
225 messageOptions?: MessageOption;
226 legacySlashCommandData?: {
227 command: SlashCommandDescWithSource;
228 input: string;
229 contextItems: ContextItemWithId[];
230 historyIndex: number;
231 selectedCode: RangeInFile[];
232 };
233 },
234 AsyncGenerator<ChatMessage, PromptLog>,
235 ];
236 streamDiffLines: [StreamDiffLinesPayload, AsyncGenerator<DiffLine>];
237 "llm/compileChat": [
238 { messages: ChatMessage[]; options: LLMFullCompletionOptions },
239 CompiledMessagesResult,
240 ];
241 "chatDescriber/describe": [
242 {
243 text: string;
244 },
245 string | undefined,
246 ];
247 "conversation/compact": [
248 {
249 index: number;
250 sessionId: string;
251 },
252 string | undefined,
253 ];
254 "stats/getTokensPerDay": [
255 undefined,
256 { day: string; promptTokens: number; generatedTokens: number }[],
257 ];
258 "stats/getTokensPerModel": [
259 undefined,
260 { model: string; promptTokens: number; generatedTokens: number }[],
261 ];
262 "tts/kill": [undefined, void];
263
264 // Codebase indexing
265 "index/setPaused": [boolean, void];
266 "index/forceReIndex": [
267 undefined | { dirs?: string[]; shouldClearIndexes?: boolean },
268 void,
269 ];
270 "index/indexingProgressBarInitialized": [undefined, void];
271 "onboarding/complete": [CompleteOnboardingPayload, void];
272
273 // File changes
274 "files/changed": [{ uris?: string[] }, void];
275 "files/opened": [{ uris?: string[] }, void];
276 "files/created": [{ uris?: string[] }, void];
277 "files/deleted": [{ uris?: string[] }, void];
278 "files/closed": [{ uris?: string[] }, void];
279 "files/smallEdit": [
280 {
281 actions: RangeInFileWithNextEditInfo[];
282 configHandler: ConfigHandler;
283 getDefsFromLspFunction: GetLspDefinitionsFunction;
284 recentlyEditedRanges: RecentlyEditedRange[];
285 recentlyVisitedRanges: AutocompleteCodeSnippet[];
286 },
287 void,
288 ];
289
290 // Docs etc. Indexing. TODO move codebase to this
291 "indexing/reindex": [{ type: string; id: string }, void];
292 "indexing/abort": [{ type: string; id: string }, void];
293 "indexing/setPaused": [{ type: string; id: string; paused: boolean }, void];
294 "docs/getSuggestedDocs": [undefined, void];
295 "docs/initStatuses": [undefined, void];
296 "docs/getDetails": [{ startUrl: string }, DocsIndexingDetails];
297 "docs/getIndexedPages": [{ startUrl: string }, string[]];
298 addAutocompleteModel: [{ model: ModelDescription }, void];
299
300 "auth/getAuthUrl": [{ useOnboarding: boolean }, { url: string }];
301 "tools/call": [
302 { toolCall: ToolCall },
303 { contextItems: ContextItem[]; errorMessage?: string },
304 ];
305 "tools/evaluatePolicy": [
306 { toolName: string; basePolicy: ToolPolicy; args: Record<string, unknown> },
307 { policy: ToolPolicy; displayValue?: string },
308 ];
309 "clipboardCache/add": [{ content: string }, void];
310 "controlPlane/openUrl": [{ path: string; orgSlug?: string }, void];
311 "controlPlane/getEnvironment": [undefined, ControlPlaneEnv];
312 "controlPlane/getFreeTrialStatus": [undefined, FreeTrialStatus | null];
313 "controlPlane/getModelsAddOnUpgradeUrl": [
314 { vsCodeUriScheme?: string },
315 { url: string } | null,
316 ];
317 isItemTooBig: [{ item: ContextItemWithId }, boolean];
318 didChangeControlPlaneSessionInfo: [
319 { sessionInfo: ControlPlaneSessionInfo | undefined },
320 void,
321 ];
322 "process/markAsBackgrounded": [{ toolCallId: string }, void];
323 "process/isBackgrounded": [{ toolCallId: string }, boolean];
324 "process/killTerminalProcess": [{ toolCallId: string }, void];
325 "mdm/setLicenseKey": [{ licenseKey: string }, boolean];
326};