Elffuss BraidHub

kikocis/continue public

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