Elffuss BraidHub

kikocis/continue public

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