Elffuss BraidHub

kikocis/continue public

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