Elffuss BraidHub

kikocis/continue public

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