Elffuss BraidHub

kikocis/continue public

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