Elffuss BraidHub

kikocis/continue public

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