Elffuss BraidHub

kikocis/continue public

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