Elffuss BraidHub

kikocis/continue public

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