Elffuss BraidHub

kikocis/continue public

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