Elffuss BraidHub

kikocis/continue public

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