Elffuss BraidHub

kikocis/continue public

a1d9b27669b0 · 6.3 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 SlashCommandDescription,
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 "context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap];
122 "context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]];
123 "autocomplete/complete": [AutocompleteInput, string[]];
124 "context/addDocs": [SiteIndexingConfig, void];
125 "context/removeDocs": [Pick<SiteIndexingConfig, "startUrl">, void];
126 "context/indexDocs": [{ reIndex: boolean }, void];
127 "autocomplete/cancel": [undefined, void];
128 "autocomplete/accept": [{ completionId: string }, void];
129 "llm/complete": [
130 {
131 prompt: string;
132 completionOptions: LLMFullCompletionOptions;
133 title: string;
134 },
135 string,
136 ];
137 "llm/listModels": [{ title: string }, string[] | undefined];
138 "llm/streamChat": [
139 {
140 messages: ChatMessage[];
141 completionOptions: LLMFullCompletionOptions;
142 title: string;
143 legacySlashCommandData?: {
144 command: SlashCommandDescription;
145 input: string;
146 contextItems: ContextItemWithId[];
147 historyIndex: number;
148 selectedCode: RangeInFile[];
149 };
150 },
151 AsyncGenerator<ChatMessage, PromptLog>,
152 ];
153 streamDiffLines: [StreamDiffLinesPayload, AsyncGenerator<DiffLine>];
154 "chatDescriber/describe": [
155 {
156 text: string;
157 },
158 string | undefined,
159 ];
160 "stats/getTokensPerDay": [
161 undefined,
162 { day: string; promptTokens: number; generatedTokens: number }[],
163 ];
164 "stats/getTokensPerModel": [
165 undefined,
166 { model: string; promptTokens: number; generatedTokens: number }[],
167 ];
168 "tts/kill": [undefined, void];
169
170 // Codebase indexing
171 "index/setPaused": [boolean, void];
172 "index/forceReIndex": [
173 undefined | { dirs?: string[]; shouldClearIndexes?: boolean },
174 void,
175 ];
176 "index/indexingProgressBarInitialized": [undefined, void];
177 "onboarding/complete": [CompleteOnboardingPayload, void];
178
179 // File changes
180 "files/changed": [{ uris?: string[] }, void];
181 "files/opened": [{ uris?: string[] }, void];
182 "files/created": [{ uris?: string[] }, void];
183 "files/deleted": [{ uris?: string[] }, void];
184 "files/closed": [{ uris?: string[] }, void];
185
186 // Docs etc. Indexing. TODO move codebase to this
187 "indexing/reindex": [{ type: string; id: string }, void];
188 "indexing/abort": [{ type: string; id: string }, void];
189 "indexing/setPaused": [{ type: string; id: string; paused: boolean }, void];
190 "docs/getSuggestedDocs": [undefined, void];
191 "docs/initStatuses": [undefined, void];
192 "docs/getDetails": [{ startUrl: string }, DocsIndexingDetails];
193 addAutocompleteModel: [{ model: ModelDescription }, void];
194
195 "auth/getAuthUrl": [{ useOnboarding: boolean }, { url: string }];
196 "tools/call": [
197 { toolCall: ToolCall },
198 { contextItems: ContextItem[]; errorMessage?: string },
199 ];
200 "clipboardCache/add": [{ content: string }, void];
201 "controlPlane/openUrl": [{ path: string; orgSlug?: string }, void];
202 "controlPlane/getFreeTrialStatus": [undefined, FreeTrialStatus | null];
203 "controlPlane/getModelsAddOnUpgradeUrl": [
204 { vsCodeUriScheme?: string },
205 { url: string } | null,
206 ];
207 isItemTooBig: [{ item: ContextItemWithId }, boolean];
208 didChangeControlPlaneSessionInfo: [
209 { sessionInfo: ControlPlaneSessionInfo | undefined },
210 void,
211 ];
212 "process/markAsBackgrounded": [{ toolCallId: string }, void];
213 "process/isBackgrounded": [{ toolCallId: string }, boolean];
214 "mdm/setLicenseKey": [{ licenseKey: string }, boolean];
215};