Elffuss BraidHub

kikocis/continue public

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