Elffuss BraidHub

kikocis/continue public

9df0fa5d79c7 · 7.5 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 "conversation/compact": [
190 {
191 index: number;
192 sessionId: string;
193 },
194 string | undefined,
195 ];
196 "stats/getTokensPerDay": [
197 undefined,
198 { day: string; promptTokens: number; generatedTokens: number }[],
199 ];
200 "stats/getTokensPerModel": [
201 undefined,
202 { model: string; promptTokens: number; generatedTokens: number }[],
203 ];
204 "tts/kill": [undefined, void];
205
206 // Codebase indexing
207 "index/setPaused": [boolean, void];
208 "index/forceReIndex": [
209 undefined | { dirs?: string[]; shouldClearIndexes?: boolean },
210 void,
211 ];
212 "index/indexingProgressBarInitialized": [undefined, void];
213 "onboarding/complete": [CompleteOnboardingPayload, void];
214
215 // File changes
216 "files/changed": [{ uris?: string[] }, void];
217 "files/opened": [{ uris?: string[] }, void];
218 "files/created": [{ uris?: string[] }, void];
219 "files/deleted": [{ uris?: string[] }, void];
220 "files/closed": [{ uris?: string[] }, void];
221 "files/smallEdit": [
222 {
223 actions: RangeInFileWithNextEditInfo[];
224 configHandler: ConfigHandler;
225 getDefsFromLspFunction: GetLspDefinitionsFunction;
226 recentlyEditedRanges: RecentlyEditedRange[];
227 recentlyVisitedRanges: AutocompleteCodeSnippet[];
228 },
229 void,
230 ];
231
232 // Docs etc. Indexing. TODO move codebase to this
233 "indexing/reindex": [{ type: string; id: string }, void];
234 "indexing/abort": [{ type: string; id: string }, void];
235 "indexing/setPaused": [{ type: string; id: string; paused: boolean }, void];
236 "docs/getSuggestedDocs": [undefined, void];
237 "docs/initStatuses": [undefined, void];
238 "docs/getDetails": [{ startUrl: string }, DocsIndexingDetails];
239 addAutocompleteModel: [{ model: ModelDescription }, void];
240
241 "auth/getAuthUrl": [{ useOnboarding: boolean }, { url: string }];
242 "tools/call": [
243 { toolCall: ToolCall },
244 { contextItems: ContextItem[]; errorMessage?: string },
245 ];
246 "clipboardCache/add": [{ content: string }, void];
247 "controlPlane/openUrl": [{ path: string; orgSlug?: string }, void];
248 "controlPlane/getFreeTrialStatus": [undefined, FreeTrialStatus | null];
249 "controlPlane/getModelsAddOnUpgradeUrl": [
250 { vsCodeUriScheme?: string },
251 { url: string } | null,
252 ];
253 isItemTooBig: [{ item: ContextItemWithId }, boolean];
254 didChangeControlPlaneSessionInfo: [
255 { sessionInfo: ControlPlaneSessionInfo | undefined },
256 void,
257 ];
258 "process/markAsBackgrounded": [{ toolCallId: string }, void];
259 "process/isBackgrounded": [{ toolCallId: string }, boolean];
260 "mdm/setLicenseKey": [{ licenseKey: string }, boolean];
261};