Elffuss BraidHub

kikocis/continue public

7dd3a742e7cd · 44.3 KiBRawPermalink
1import {
2 DataDestination,
3 ModelRole,
4 PromptTemplates,
5} from "@continuedev/config-yaml";
6import Parser from "web-tree-sitter";
7import { CodebaseIndexer } from "./indexing/CodebaseIndexer";
8import { LLMConfigurationStatuses } from "./llm/constants";
9
10declare global {
11 interface Window {
12 ide?: "vscode";
13 windowId: string;
14 serverUrl: string;
15 vscMachineId: string;
16 vscMediaUrl: string;
17 fullColorTheme?: {
18 rules?: {
19 token?: string;
20 foreground?: string;
21 }[];
22 };
23 colorThemeName?: string;
24 workspacePaths?: string[];
25 postIntellijMessage?: (
26 messageType: string,
27 data: any,
28 messageIde: string,
29 ) => void;
30 }
31}
32
33export interface ChunkWithoutID {
34 content: string;
35 startLine: number;
36 endLine: number;
37 signature?: string;
38 otherMetadata?: { [key: string]: any };
39}
40
41export interface Chunk extends ChunkWithoutID {
42 digest: string;
43 filepath: string;
44 index: number; // Index of the chunk in the document at filepath
45}
46
47export interface IndexingProgressUpdate {
48 progress: number;
49 desc: string;
50 shouldClearIndexes?: boolean;
51 status:
52 | "loading"
53 | "waiting"
54 | "indexing"
55 | "done"
56 | "failed"
57 | "paused"
58 | "disabled"
59 | "cancelled";
60 debugInfo?: string;
61 warnings?: string[];
62}
63
64// This is more or less a V2 of IndexingProgressUpdate for docs etc.
65export interface IndexingStatus {
66 id: string;
67 type: "docs";
68 progress: number;
69 description: string;
70 status: "indexing" | "complete" | "paused" | "failed" | "aborted" | "pending";
71 embeddingsProviderId?: string;
72 isReindexing?: boolean;
73 debugInfo?: string;
74 title: string;
75 icon?: string;
76 url?: string;
77}
78
79export type PromptTemplateFunction = (
80 history: ChatMessage[],
81 otherData: Record<string, string>,
82) => string | ChatMessage[];
83
84export type PromptTemplate = string | PromptTemplateFunction;
85
86type RequiredLLMOptions =
87 | "uniqueId"
88 | "contextLength"
89 | "embeddingId"
90 | "maxEmbeddingChunkSize"
91 | "maxEmbeddingBatchSize"
92 | "completionOptions";
93
94export interface ILLM
95 extends Omit<LLMOptions, RequiredLLMOptions>,
96 Required<Pick<LLMOptions, RequiredLLMOptions>> {
97 get providerName(): string;
98 get underlyingProviderName(): string;
99
100 autocompleteOptions?: Partial<TabAutocompleteOptions>;
101
102 complete(
103 prompt: string,
104 signal: AbortSignal,
105 options?: LLMFullCompletionOptions,
106 ): Promise<string>;
107
108 streamComplete(
109 prompt: string,
110 signal: AbortSignal,
111 options?: LLMFullCompletionOptions,
112 ): AsyncGenerator<string, PromptLog>;
113
114 streamFim(
115 prefix: string,
116 suffix: string,
117 signal: AbortSignal,
118 options?: LLMFullCompletionOptions,
119 ): AsyncGenerator<string, PromptLog>;
120
121 streamChat(
122 messages: ChatMessage[],
123 signal: AbortSignal,
124 options?: LLMFullCompletionOptions,
125 messageOptions?: MessageOption,
126 ): AsyncGenerator<ChatMessage, PromptLog>;
127
128 chat(
129 messages: ChatMessage[],
130 signal: AbortSignal,
131 options?: LLMFullCompletionOptions,
132 ): Promise<ChatMessage>;
133
134 compileChatMessages(
135 messages: ChatMessage[],
136 options: LLMFullCompletionOpeions,
137 ): CompiledChatMessagesReport;
138
139 embed(chunks: string[]): Promise<number[][]>;
140
141 rerank(query: string, chunks: Chunk[]): Promise<number[]>;
142
143 countTokens(text: string): number;
144
145 supportsImages(): boolean;
146
147 supportsCompletions(): boolean;
148
149 supportsPrefill(): boolean;
150
151 supportsFim(): boolean;
152
153 listModels(): Promise<string[]>;
154
155 renderPromptTemplate(
156 template: PromptTemplate,
157 history: ChatMessage[],
158 otherData: Record<string, string>,
159 canPutWordsInModelsMouth?: boolean,
160 ): string | ChatMessage[];
161
162 getConfigurationStatus(): LLMConfigurationStatuses;
163}
164
165export interface ModelInstaller {
166 installModel(
167 modelName: string,
168 signal: AbortSignal,
169 progressReporter?: (task: string, increment: number, total: number) => void,
170 ): Promise<any>;
171
172 isInstallingModel(modelName: string): Promise<boolean>;
173}
174
175export type ContextProviderType = "normal" | "query" | "submenu";
176
177export interface ContextProviderDescription {
178 title: ContextProviderName;
179 displayTitle: string;
180 description: string;
181 renderInlineAs?: string;
182 type: ContextProviderType;
183 dependsOnIndexing?: boolean;
184}
185
186export type FetchFunction = (url: string | URL, init?: any) => Promise<any>;
187
188export interface ContextProviderExtras {
189 config: ContinueConfig;
190 fullInput: string;
191 embeddingsProvider: ILLM | null;
192 reranker: ILLM | null;
193 llm: ILLM;
194 ide: IDE;
195 selectedCode: RangeInFile[];
196 fetch: FetchFunction;
197 isInAgentMode: boolean;
198}
199
200export interface LoadSubmenuItemsArgs {
201 config: ContinueConfig;
202 ide: IDE;
203 fetch: FetchFunction;
204}
205
206export interface CustomContextProvider {
207 title: string;
208 displayTitle?: string;
209 description?: string;
210 renderInlineAs?: string;
211 type?: ContextProviderType;
212 loadSubmenuItems?: (
213 args: LoadSubmenuItemsArgs,
214 ) => Promise<ContextSubmenuItem[]>;
215
216 getContextItems(
217 query: string,
218 extras: ContextProviderExtras,
219 ): Promise<ContextItem[]>;
220}
221
222export interface ContextSubmenuItem {
223 id: string;
224 title: string;
225 description: string;
226 icon?: string;
227 metadata?: any;
228}
229
230export interface ContextSubmenuItemWithProvider extends ContextSubmenuItem {
231 providerTitle: string;
232}
233
234export interface SiteIndexingConfig {
235 title: string;
236 startUrl: string;
237 maxDepth?: number;
238 faviconUrl?: string;
239 useLocalCrawling?: boolean;
240 sourceFile?: string;
241}
242
243export interface DocsIndexingDetails {
244 startUrl: string;
245 config: SiteIndexingConfig;
246 indexingStatus: IndexingStatus | undefined;
247 chunks: Chunk[];
248}
249
250export interface IContextProvider {
251 get description(): ContextProviderDescription;
252
253 getContextItems(
254 query: string,
255 extras: ContextProviderExtras,
256 ): Promise<ContextItem[]>;
257
258 loadSubmenuItems(args: LoadSubmenuItemsArgs): Promise<ContextSubmenuItem[]>;
259
260 get deprecationMessage(): string | null;
261}
262
263export interface Session {
264 sessionId: string;
265 title: string;
266 workspaceDirectory: string;
267 history: ChatHistoryItem[];
268}
269
270export interface SessionMetadata {
271 sessionId: string;
272 title: string;
273 dateCreated: string;
274 workspaceDirectory: string;
275}
276
277export interface RangeInFile {
278 filepath: string;
279 range: Range;
280}
281
282export interface Location {
283 filepath: string;
284 position: Position;
285}
286
287export interface FileWithContents {
288 filepath: string;
289 contents: string;
290}
291
292export interface Range {
293 start: Position;
294 end: Position;
295}
296
297export interface Position {
298 line: number;
299 character: number;
300}
301
302export interface FileEdit {
303 filepath: string;
304 range: Range;
305 replacement: string;
306}
307
308export interface ContinueError {
309 title: string;
310 message: string;
311}
312
313export interface CompletionOptions extends BaseCompletionOptions {
314 model: string;
315}
316
317export type ChatMessageRole =
318 | "user"
319 | "assistant"
320 | "thinking"
321 | "system"
322 | "tool";
323
324export type TextMessagePart = {
325 type: "text";
326 text: string;
327};
328
329export type ImageMessagePart = {
330 type: "imageUrl";
331 imageUrl: { url: string };
332};
333
334export type MessagePart = TextMessagePart | ImageMessagePart;
335
336export type MessageContent = string | MessagePart[];
337
338export interface ToolCall {
339 id: string;
340 type: "function";
341 function: {
342 name: string;
343 arguments: string;
344 };
345}
346
347export interface ToolCallDelta {
348 id?: string;
349 type?: "function";
350 function?: {
351 name?: string;
352 arguments?: string;
353 };
354}
355
356export interface ToolResultChatMessage {
357 role: "tool";
358 content: string;
359 toolCallId: string;
360}
361
362export interface UserChatMessage {
363 role: "user";
364 content: MessageContent;
365}
366
367export interface ThinkingChatMessage {
368 role: "thinking";
369 content: MessageContent;
370 signature?: string;
371 redactedThinking?: string;
372 toolCalls?: ToolCallDelta[];
373}
374
375/**
376 * This is meant to be equivalent to the OpenAI [usage object](https://platform.openai.com/docs/api-reference/chat/object#chat/object-usage)
377 * but potentially with additional information that is needed for other providers.
378 */
379export interface Usage {
380 completionTokens: number;
381 promptTokens: number;
382 promptTokensDetails?: {
383 cachedTokens?: number;
384 /** This an Anthropic-specific property */
385 cacheWriteTokens?: number;
386 audioTokens?: number;
387 };
388 completionTokensDetails?: {
389 acceptedPredictionTokens?: number;
390 reasoningTokens?: number;
391 rejectedPredictionTokens?: number;
392 audioTokens?: number;
393 };
394}
395
396export interface AssistantChatMessage {
397 role: "assistant";
398 content: MessageContent;
399 toolCalls?: ToolCallDelta[];
400 usage?: Usage;
401}
402
403export interface SystemChatMessage {
404 role: "system";
405 content: string;
406}
407
408export type ChatMessage =
409 | UserChatMessage
410 | AssistantChatMessage
411 | ThinkingChatMessage
412 | SystemChatMessage
413 | ToolResultChatMessage;
414
415export interface ContextItemId {
416 providerTitle: string;
417 itemId: string;
418}
419
420export type ContextItemUriTypes = "file" | "url";
421
422export interface ContextItemUri {
423 type: ContextItemUriTypes;
424 value: string;
425}
426
427export interface ContextItem {
428 content: string;
429 name: string;
430 description: string;
431 editing?: boolean;
432 editable?: boolean;
433 icon?: string;
434 uri?: ContextItemUri;
435 hidden?: boolean;
436 status?: string;
437}
438
439export interface ContextItemWithId extends ContextItem {
440 id: ContextItemId;
441}
442
443export interface InputModifiers {
444 useCodebase: boolean;
445 noContext: boolean;
446}
447
448export interface SymbolWithRange extends RangeInFile {
449 name: string;
450 type: Parser.SyntaxNode["type"];
451 content: string;
452}
453
454export type FileSymbolMap = Record<string, SymbolWithRange[]>;
455
456export interface PromptLog {
457 modelTitle: string;
458 modelProvider: string;
459 completionOptions: CompletionOptions;
460 prompt: string;
461 completion: string;
462}
463
464export type MessageModes = "chat" | "agent" | "plan";
465
466export type ToolStatus =
467 | "generating" // Tool call arguments are being streamed from the LLM
468 | "generated" // Tool call is complete and ready for execution (awaiting approval)
469 | "calling" // Tool is actively being executed
470 | "errored" // Tool execution failed with an error
471 | "done" // Tool execution completed successfully
472 | "canceled"; // Tool call was canceled by user or system
473
474// Will exist only on "assistant" messages with tool calls
475interface ToolCallState {
476 toolCallId: string;
477 toolCall: ToolCall;
478 status: ToolStatus;
479 parsedArgs: any;
480 output?: ContextItem[];
481 tool?: Tool;
482}
483
484interface Reasoning {
485 active: boolean;
486 text: string;
487 startAt: number;
488 endAt?: number;
489}
490
491export interface ChatHistoryItem {
492 message: ChatMessage;
493 contextItems: ContextItemWithId[];
494 editorState?: any;
495 modifiers?: InputModifiers;
496 promptLogs?: PromptLog[];
497 toolCallStates?: ToolCallState[];
498 isGatheringContext?: boolean;
499 reasoning?: Reasoning;
500 appliedRules?: RuleWithSource[];
501 conversationSummary?: string;
502}
503
504export interface LLMFullCompletionOptions extends BaseCompletionOptions {
505 log?: boolean;
506 model?: string;
507}
508
509export type ToastType = "info" | "error" | "warning";
510
511export interface LLMInteractionBase {
512 interactionId: string;
513 timestamp: number;
514}
515
516export interface LLMInteractionStartChat extends LLMInteractionBase {
517 kind: "startChat";
518 messages: ChatMessage[];
519 options: CompletionOptions;
520 provider: string;
521}
522
523export interface LLMInteractionStartComplete extends LLMInteractionBase {
524 kind: "startComplete";
525 prompt: string;
526 options: CompletionOptions;
527 provider: string;
528}
529
530export interface LLMInteractionStartFim extends LLMInteractionBase {
531 kind: "startFim";
532 prefix: string;
533 suffix: string;
534 options: CompletionOptions;
535 provider: string;
536}
537
538export interface LLMInteractionChunk extends LLMInteractionBase {
539 kind: "chunk";
540 chunk: string;
541}
542
543export interface LLMInteractionMessage extends LLMInteractionBase {
544 kind: "message";
545 message: ChatMessage;
546}
547
548export interface LLMInteractionEnd extends LLMInteractionBase {
549 promptTokens: number;
550 generatedTokens: number;
551 thinkingTokens: number;
552 usage: Usage | undefined;
553}
554
555export interface LLMInteractionSuccess extends LLMInteractionEnd {
556 kind: "success";
557}
558
559export interface LLMInteractionCancel extends LLMInteractionEnd {
560 kind: "cancel";
561}
562
563export interface LLMInteractionError extends LLMInteractionEnd {
564 kind: "error";
565 name: string;
566 message: string;
567}
568
569export type LLMInteractionItem =
570 | LLMInteractionStartChat
571 | LLMInteractionStartComplete
572 | LLMInteractionStartFim
573 | LLMInteractionChunk
574 | LLMInteractionMessage
575 | LLMInteractionSuccess
576 | LLMInteractionCancel
577 | LLMInteractionError;
578
579// When we log a LLM interaction, we want to add the interactionId and timestamp
580// in the logger code, so we need a type that omits these members from *each*
581// member of the union. This can be done by using the distributive behavior of
582// conditional types in Typescript.
583//
584// www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
585// https://stackoverflow.com/questions/57103834/typescript-omit-a-property-from-all-interfaces-in-a-union-but-keep-the-union-s
586type DistributiveOmit<T, K extends PropertyKey> = T extends unknown
587 ? Omit<T, K>
588 : never;
589
590export type LLMInteractionItemDetails = DistributiveOmit<
591 LLMInteractionItem,
592 "interactionId" | "timestamp"
593>;
594
595export interface ILLMInteractionLog {
596 logItem(item: LLMInteractionItemDetails): void;
597}
598
599export interface ILLMLogger {
600 createInteractionLog(): ILLMInteractionLog;
601}
602
603export interface LLMOptions {
604 model: string;
605
606 title?: string;
607 uniqueId?: string;
608 baseAgentSystemMessage?: string;
609 basePlanSystemMessage?: string;
610 baseChatSystemMessage?: string;
611 autocompleteOptions?: Partial<TabAutocompleteOptions>;
612 contextLength?: number;
613 maxStopWords?: number;
614 completionOptions?: CompletionOptions;
615 requestOptions?: RequestOptions;
616 template?: TemplateType;
617 promptTemplates?: Partial<Record<keyof PromptTemplates, PromptTemplate>>;
618 templateMessages?: (messages: ChatMessage[]) => string;
619 logger?: ILLMLogger;
620 llmRequestHook?: (model: string, prompt: string) => any;
621 apiKey?: string;
622
623 // continueProperties
624 apiKeyLocation?: string;
625 envSecretLocations?: Record<string, string>;
626 apiBase?: string;
627 orgScopeId?: string | null;
628
629 onPremProxyUrl?: string | null;
630
631 aiGatewaySlug?: string;
632 cacheBehavior?: CacheBehavior;
633 capabilities?: ModelCapability;
634 roles?: ModelRole[];
635
636 useLegacyCompletionsEndpoint?: boolean;
637
638 // Embedding options
639 embeddingId?: string;
640 maxEmbeddingChunkSize?: number;
641 maxEmbeddingBatchSize?: number;
642
643 // Cloudflare options
644 accountId?: string;
645
646 // Azure options
647 deployment?: string;
648 apiVersion?: string;
649 apiType?: string;
650
651 // AWS options
652 profile?: string;
653 modelArn?: string;
654 accessKeyId?: string;
655 secretAccessKey?: string;
656
657 // AWS and VertexAI Options
658 region?: string;
659
660 // VertexAI and Watsonx Options
661 projectId?: string;
662
663 // IBM watsonx Options
664 deploymentId?: string;
665
666 env?: Record<string, string | number | boolean>;
667
668 sourceFile?: string;
669 isFromAutoDetect?: boolean;
670}
671
672type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<
673 T,
674 Exclude<keyof T, Keys>
675> &
676 {
677 [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
678 }[Keys];
679
680export interface CustomLLMWithOptionals {
681 options: LLMOptions;
682 streamCompletion?: (
683 prompt: string,
684 signal: AbortSignal,
685 options: CompletionOptions,
686 fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>,
687 ) => AsyncGenerator<string>;
688 streamChat?: (
689 messages: ChatMessage[],
690 signal: AbortSignal,
691 options: CompletionOptions,
692 fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>,
693 ) => AsyncGenerator<ChatMessage | string>;
694 listModels?: (
695 fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>,
696 ) => Promise<string[]>;
697}
698
699/**
700 * The LLM interface requires you to specify either `streamCompletion` or `streamChat` (or both).
701 */
702export type CustomLLM = RequireAtLeastOne<
703 CustomLLMWithOptionals,
704 "streamCompletion" | "streamChat"
705>;
706
707// IDE
708
709export type DiffType = "new" | "old" | "same";
710
711export interface DiffObject {
712 type: DiffType;
713}
714
715export interface DiffLine extends DiffObject {
716 line: string;
717}
718
719interface DiffChar extends DiffObject {
720 char: string;
721 oldIndex?: number; // Character index assuming a flattened line string.
722 newIndex?: number;
723 oldCharIndexInLine?: number; // Character index assuming new lines reset the character index to 0.
724 newCharIndexInLine?: number;
725 oldLineIndex?: number;
726 newLineIndex?: number;
727}
728
729export interface Problem {
730 filepath: string;
731 range: Range;
732 message: string;
733}
734
735export interface Thread {
736 name: string;
737 id: number;
738}
739
740export type IdeType = "vscode" | "jetbrains";
741
742export interface IdeInfo {
743 ideType: IdeType;
744 name: string;
745 version: string;
746 remoteName: string;
747 extensionVersion: string;
748 isPrerelease: boolean;
749}
750
751export interface BranchAndDir {
752 branch: string;
753 directory: string;
754}
755
756export interface IndexTag extends BranchAndDir {
757 artifactId: string;
758}
759
760export enum FileType {
761 Unkown = 0,
762 File = 1,
763 Directory = 2,
764 SymbolicLink = 64,
765}
766
767export interface IdeSettings {
768 remoteConfigServerUrl: string | undefined;
769 remoteConfigSyncPeriod: number;
770 userToken: string;
771 continueTestEnvironment: "none" | "production" | "staging" | "local";
772 pauseCodebaseIndexOnStart: boolean;
773}
774
775export interface FileStats {
776 size: number;
777 lastModified: number;
778}
779
780/** Map of file name to stats */
781export type FileStatsMap = {
782 [path: string]: FileStats;
783};
784
785export interface IDE {
786 getIdeInfo(): Promise<IdeInfo>;
787
788 getIdeSettings(): Promise<IdeSettings>;
789
790 getDiff(includeUnstaged: boolean): Promise<string[]>;
791
792 getClipboardContent(): Promise<{ text: string; copiedAt: string }>;
793
794 isTelemetryEnabled(): Promise<boolean>;
795
796 isWorkspaceRemote(): Promise<boolean>;
797
798 getUniqueId(): Promise<string>;
799
800 getTerminalContents(): Promise<string>;
801
802 getDebugLocals(threadIndex: number): Promise<string>;
803
804 getTopLevelCallStackSources(
805 threadIndex: number,
806 stackDepth: number,
807 ): Promise<string[]>;
808
809 getAvailableThreads(): Promise<Thread[]>;
810
811 getWorkspaceDirs(): Promise<string[]>;
812
813 fileExists(fileUri: string): Promise<boolean>;
814
815 writeFile(path: string, contents: string): Promise<void>;
816
817 showVirtualFile(title: string, contents: string): Promise<void>;
818
819 openFile(path: string): Promise<void>;
820
821 openUrl(url: string): Promise<void>;
822
823 runCommand(command: string, options?: TerminalOptions): Promise<void>;
824
825 saveFile(fileUri: string): Promise<void>;
826
827 readFile(fileUri: string): Promise<string>;
828
829 readRangeInFile(fileUri: string, range: Range): Promise<string>;
830
831 showLines(fileUri: string, startLine: number, endLine: number): Promise<void>;
832
833 getOpenFiles(): Promise<string[]>;
834
835 getCurrentFile(): Promise<
836 | undefined
837 | {
838 isUntitled: boolean;
839 path: string;
840 contents: string;
841 }
842 >;
843
844 getPinnedFiles(): Promise<string[]>;
845
846 getSearchResults(query: string, maxResults?: number): Promise<string>;
847
848 getFileResults(pattern: string, maxResults?: number): Promise<string[]>;
849
850 subprocess(command: string, cwd?: string): Promise<[string, string]>;
851
852 getProblems(fileUri?: string | undefined): Promise<Problem[]>;
853
854 getBranch(dir: string): Promise<string>;
855
856 getTags(artifactId: string): Promise<IndexTag[]>;
857
858 getRepoName(dir: string): Promise<string | undefined>;
859
860 showToast(
861 type: ToastType,
862 message: string,
863 ...otherParams: any[]
864 ): Promise<any>;
865
866 getGitRootPath(dir: string): Promise<string | undefined>;
867
868 listDir(dir: string): Promise<[string, FileType][]>;
869
870 getFileStats(files: string[]): Promise<FileStatsMap>;
871
872 // Secret Storage
873 readSecrets(keys: string[]): Promise<Record<string, string>>;
874
875 writeSecrets(secrets: { [key: string]: string }): Promise<void>;
876
877 // LSP
878 gotoDefinition(location: Location): Promise<RangeInFile[]>;
879 gotoTypeDefinition(location: Location): Promise<RangeInFile[]>; // TODO: add to jetbrains
880 getSignatureHelp(location: Location): Promise<SignatureHelp | null>; // TODO: add to jetbrains
881 getReferences(location: Location): Promise<RangeInFile[]>;
882 getDocumentSymbols(textDocumentIdentifier: string): Promise<DocumentSymbol[]>;
883
884 // Callbacks
885 onDidChangeActiveTextEditor(callback: (fileUri: string) => void): void;
886}
887
888// Slash Commands
889
890export interface ContinueSDK {
891 ide: IDE;
892 llm: ILLM;
893 addContextItem: (item: ContextItemWithId) => void;
894 history: ChatMessage[];
895 input: string;
896 params?: { [key: string]: any } | undefined;
897 contextItems: ContextItemWithId[];
898 selectedCode: RangeInFile[];
899 config: ContinueConfig;
900 fetch: FetchFunction;
901 completionOptions?: LLMFullCompletionOptions;
902 abortController: AbortController;
903}
904
905/* Be careful changing SlashCommand or SlashCommandDescription, config.ts can break */
906export interface SlashCommandDescription {
907 name: string;
908 description: string;
909 prompt?: string;
910 params?: { [key: string]: any };
911}
912
913export interface SlashCommand extends SlashCommandDescription {
914 run: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>;
915}
916
917export interface SlashCommandWithSource extends SlashCommandDescription {
918 run?: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>; // Optional - only needed for legacy
919 source: SlashCommandSource;
920 promptFile?: string;
921 overrideSystemMessage?: string;
922}
923
924export type SlashCommandSource =
925 | "built-in-legacy"
926 | "built-in"
927 | "json-custom-command"
928 | "config-ts-slash-command"
929 | "yaml-prompt-block"
930 | "mcp-prompt"
931 | "prompt-file-v1"
932 | "prompt-file-v2"
933 | "invokable-rule";
934
935export interface SlashCommandDescWithSource extends SlashCommandDescription {
936 isLegacy: boolean; // Maps to if slashcommand.run exists
937 source: SlashCommandSource;
938 promptFile?: string;
939 mcpServerName?: string;
940 mcpArgs?: MCPPromptArgs;
941}
942
943// Config
944
945export type StepName =
946 | "AnswerQuestionChroma"
947 | "GenerateShellCommandStep"
948 | "EditHighlightedCodeStep"
949 | "ShareSessionStep"
950 | "CommentCodeStep"
951 | "ClearHistoryStep"
952 | "StackOverflowStep"
953 | "OpenConfigStep"
954 | "GenerateShellCommandStep"
955 | "DraftIssueStep";
956
957export type ContextProviderName =
958 | "diff"
959 | "terminal"
960 | "debugger"
961 | "open"
962 | "google"
963 | "search"
964 | "tree"
965 | "http"
966 | "codebase"
967 | "problems"
968 | "folder"
969 | "jira"
970 | "postgres"
971 | "database"
972 | "code"
973 | "docs"
974 | "gitlab-mr"
975 | "os"
976 | "currentFile"
977 | "greptile"
978 | "outline"
979 | "continue-proxy"
980 | "highlights"
981 | "file"
982 | "issue"
983 | "repo-map"
984 | "url"
985 | "commit"
986 | "web"
987 | "discord"
988 | "clipboard"
989 | string;
990
991export type TemplateType =
992 | "llama2"
993 | "alpaca"
994 | "zephyr"
995 | "phi2"
996 | "phind"
997 | "anthropic"
998 | "chatml"
999 | "none"
1000 | "openchat"
1001 | "deepseek"
1002 | "xwin-coder"
1003 | "neural-chat"
1004 | "codellama-70b"
1005 | "llava"
1006 | "gemma"
1007 | "granite"
1008 | "llama3"
1009 | "codestral";
1010
1011export interface RequestOptions {
1012 timeout?: number;
1013 verifySsl?: boolean;
1014 caBundlePath?: string | string[];
1015 proxy?: string;
1016 headers?: { [key: string]: string };
1017 extraBodyProperties?: { [key: string]: any };
1018 noProxy?: string[];
1019 clientCertificate?: ClientCertificateOptions;
1020}
1021
1022export interface CacheBehavior {
1023 cacheSystemMessage?: boolean;
1024 cacheConversation?: boolean;
1025}
1026
1027export interface ClientCertificateOptions {
1028 cert: string;
1029 key: string;
1030 passphrase?: string;
1031}
1032
1033export interface StepWithParams {
1034 name: StepName;
1035 params: { [key: string]: any };
1036}
1037
1038export interface ContextProviderWithParams {
1039 name: ContextProviderName;
1040 params: { [key: string]: any };
1041}
1042
1043export interface CustomCommand {
1044 name: string;
1045 prompt: string;
1046 description?: string;
1047 sourceFile?: string;
1048}
1049
1050export interface Prediction {
1051 type: "content";
1052 content:
1053 | string
1054 | {
1055 type: "text";
1056 text: string;
1057 }[];
1058}
1059
1060export interface ToolExtras {
1061 ide: IDE;
1062 llm: ILLM;
1063 fetch: FetchFunction;
1064 tool: Tool;
1065 toolCallId?: string;
1066 onPartialOutput?: (params: {
1067 toolCallId: string;
1068 contextItems: ContextItem[];
1069 }) => void;
1070 config: ContinueConfig;
1071 codeBaseIndexer?: CodebaseIndexer;
1072}
1073
1074export type ToolPolicy =
1075 | "allowedWithPermission"
1076 | "allowedWithoutPermission"
1077 | "disabled";
1078
1079export interface Tool {
1080 type: "function";
1081 function: {
1082 name: string;
1083 description?: string;
1084 parameters?: Record<string, any>;
1085 strict?: boolean | null;
1086 };
1087
1088 displayTitle: string;
1089 wouldLikeTo?: string;
1090 isCurrently?: string;
1091 hasAlready?: string;
1092 readonly: boolean;
1093 isInstant?: boolean;
1094 uri?: string;
1095 faviconUrl?: string;
1096 group: string;
1097 originalFunctionName?: string;
1098 systemMessageDescription?: {
1099 prefix: string;
1100 exampleArgs?: Array<[string, string | number]>;
1101 };
1102 defaultToolPolicy?: ToolPolicy;
1103}
1104
1105interface ToolChoice {
1106 type: "function";
1107 function: {
1108 name: string;
1109 };
1110}
1111
1112export interface ConfigDependentToolParams {
1113 rules: RuleWithSource[];
1114 enableExperimentalTools: boolean;
1115 isSignedIn: boolean;
1116 isRemote: boolean;
1117 modelName: string | undefined;
1118}
1119
1120export type GetTool = (params: ConfigDependentToolParams) => Tool;
1121
1122export interface BaseCompletionOptions {
1123 temperature?: number;
1124 topP?: number;
1125 topK?: number;
1126 minP?: number;
1127 presencePenalty?: number;
1128 frequencyPenalty?: number;
1129 mirostat?: number;
1130 stop?: string[];
1131 maxTokens?: number;
1132 numThreads?: number;
1133 useMmap?: boolean;
1134 keepAlive?: number;
1135 numGpu?: number;
1136 raw?: boolean;
1137 stream?: boolean;
1138 prediction?: Prediction;
1139 tools?: Tool[];
1140 toolChoice?: ToolChoice;
1141 reasoning?: boolean;
1142 reasoningBudgetTokens?: number;
1143 promptCaching?: boolean;
1144}
1145
1146export interface ModelCapability {
1147 uploadImage?: boolean;
1148 tools?: boolean;
1149 nextEdit?: boolean;
1150}
1151
1152export interface ModelDescription {
1153 title: string;
1154 provider: string;
1155 underlyingProviderName: string;
1156 model: string;
1157 apiKey?: string;
1158
1159 apiBase?: string;
1160 apiKeyLocation?: string;
1161 envSecretLocations?: Record<string, string>;
1162 orgScopeId?: string | null;
1163
1164 onPremProxyUrl?: string | null;
1165
1166 contextLength?: number;
1167 maxStopWords?: number;
1168 template?: TemplateType;
1169 completionOptions?: BaseCompletionOptions;
1170 baseAgentSystemMessage?: string;
1171 basePlanSystemMessage?: string;
1172 baseChatSystemMessage?: string;
1173 requestOptions?: RequestOptions;
1174 promptTemplates?: { [key: string]: string };
1175 cacheBehavior?: CacheBehavior;
1176 capabilities?: ModelCapability;
1177 roles?: ModelRole[];
1178 configurationStatus?: LLMConfigurationStatuses;
1179
1180 sourceFile?: string;
1181 isFromAutoDetect?: boolean;
1182}
1183
1184export interface JSONEmbedOptions {
1185 apiBase?: string;
1186 apiKey?: string;
1187 model?: string;
1188 deployment?: string;
1189 apiType?: string;
1190 apiVersion?: string;
1191 requestOptions?: RequestOptions;
1192 maxEmbeddingChunkSize?: number;
1193 maxEmbeddingBatchSize?: number;
1194
1195 // AWS options
1196 profile?: string;
1197
1198 // AWS and VertexAI Options
1199 region?: string;
1200
1201 // VertexAI and Watsonx Options
1202 projectId?: string;
1203}
1204
1205export interface EmbeddingsProviderDescription extends JSONEmbedOptions {
1206 provider: string;
1207}
1208
1209export interface RerankerDescription {
1210 name: string;
1211 params?: { [key: string]: any };
1212}
1213
1214// TODO: We should consider renaming this to AutocompleteOptions.
1215export interface TabAutocompleteOptions {
1216 disable: boolean;
1217 maxPromptTokens: number;
1218 debounceDelay: number;
1219 modelTimeout: number;
1220 maxSuffixPercentage: number;
1221 prefixPercentage: number;
1222 transform?: boolean;
1223 template?: string;
1224 multilineCompletions: "always" | "never" | "auto";
1225 slidingWindowPrefixPercentage: number;
1226 slidingWindowSize: number;
1227 useCache: boolean;
1228 onlyMyCode: boolean;
1229 useRecentlyEdited: boolean;
1230 useRecentlyOpened: boolean;
1231 disableInFiles?: string[];
1232 useImports?: boolean;
1233 showWhateverWeHaveAtXMs?: number;
1234 // true = enabled, false = disabled, number = enabled with priority
1235 experimental_includeClipboard: boolean | number;
1236 experimental_includeRecentlyVisitedRanges: boolean | number;
1237 experimental_includeRecentlyEditedRanges: boolean | number;
1238 experimental_includeDiff: boolean | number;
1239 experimental_enableStaticContextualization: boolean;
1240}
1241
1242export interface StdioOptions {
1243 type: "stdio";
1244 command: string;
1245 args: string[];
1246 env?: Record<string, string>;
1247 cwd?: string;
1248 requestOptions?: RequestOptions;
1249}
1250
1251export interface WebSocketOptions {
1252 type: "websocket";
1253 url: string;
1254 requestOptions?: RequestOptions;
1255}
1256
1257export interface SSEOptions {
1258 type: "sse";
1259 url: string;
1260 requestOptions?: RequestOptions;
1261}
1262
1263export interface StreamableHTTPOptions {
1264 type: "streamable-http";
1265 url: string;
1266 requestOptions?: RequestOptions;
1267}
1268
1269export type TransportOptions =
1270 | StdioOptions
1271 | WebSocketOptions
1272 | SSEOptions
1273 | StreamableHTTPOptions;
1274
1275export interface MCPOptions {
1276 name: string;
1277 id: string;
1278 transport: TransportOptions;
1279 faviconUrl?: string;
1280 timeout?: number;
1281}
1282
1283export type MCPConnectionStatus =
1284 | "connecting"
1285 | "connected"
1286 | "error"
1287 | "authenticating"
1288 | "not-connected";
1289
1290export type MCPPromptArgs = {
1291 name: string;
1292 description?: string;
1293 required?: boolean;
1294}[];
1295
1296export interface MCPPrompt {
1297 name: string;
1298 description?: string;
1299 arguments?: MCPPromptArgs;
1300}
1301
1302// Leaving here to ideate on
1303// export type ContinueConfigSource = "local-yaml" | "local-json" | "hub-assistant" | "hub"
1304
1305// https://modelcontextprotocol.io/docs/concepts/resources#direct-resources
1306export interface MCPResource {
1307 name: string;
1308 uri: string;
1309 description?: string;
1310 mimeType?: string;
1311}
1312
1313// https://modelcontextprotocol.io/docs/concepts/resources#resource-templates
1314export interface MCPResourceTemplate {
1315 uriTemplate: string;
1316 name: string;
1317 description?: string;
1318 mimeType?: string;
1319}
1320
1321export interface MCPTool {
1322 name: string;
1323 description?: string;
1324 inputSchema: {
1325 type: "object";
1326 properties?: Record<string, any>;
1327 };
1328}
1329
1330export interface MCPServerStatus extends MCPOptions {
1331 status: MCPConnectionStatus;
1332 errors: string[];
1333 isProtectedResource: boolean;
1334
1335 prompts: MCPPrompt[];
1336 tools: MCPTool[];
1337 resources: MCPResource[];
1338 resourceTemplates: MCPResourceTemplate[];
1339 sourceFile?: string;
1340}
1341
1342export interface ContinueUIConfig {
1343 codeBlockToolbarPosition?: "top" | "bottom";
1344 fontSize?: number;
1345 displayRawMarkdown?: boolean;
1346 showChatScrollbar?: boolean;
1347 codeWrap?: boolean;
1348 showSessionTabs?: boolean;
1349 autoAcceptEditToolDiffs?: boolean;
1350}
1351
1352export interface ContextMenuConfig {
1353 comment?: string;
1354 docstring?: string;
1355 fix?: string;
1356 optimize?: string;
1357 fixGrammar?: string;
1358}
1359
1360export interface ExperimentalModelRoles {
1361 repoMapFileSelection?: string;
1362 inlineEdit?: string;
1363 applyCodeBlock?: string;
1364}
1365
1366export interface ExperimentalMCPOptions {
1367 transport: TransportOptions;
1368 faviconUrl?: string;
1369 timeout?: number;
1370}
1371
1372export type ApplyStateStatus =
1373 | "not-started" // Apply state created but not necessarily streaming
1374 | "streaming" // Changes are being applied to the file
1375 | "done" // All changes have been applied, awaiting user to accept/reject
1376 | "closed"; // All changes have been applied. Note that for new files, we immediately set the status to "closed"
1377
1378export interface ApplyState {
1379 streamId: string;
1380 status?: ApplyStateStatus;
1381 numDiffs?: number;
1382 filepath?: string;
1383 fileContent?: string;
1384 originalFileContent?: string;
1385 toolCallId?: string;
1386}
1387
1388export interface StreamDiffLinesPayload {
1389 prefix: string;
1390 highlighted: string;
1391 suffix: string;
1392 input: string;
1393 language: string | undefined;
1394 modelTitle: string | undefined;
1395 includeRulesInSystemMessage: boolean;
1396 fileUri?: string;
1397}
1398
1399export interface HighlightedCodePayload {
1400 rangeInFileWithContents: RangeInFileWithContents;
1401 prompt?: string;
1402 shouldRun?: boolean;
1403}
1404
1405export interface AcceptOrRejectDiffPayload {
1406 filepath?: string;
1407 streamId?: string;
1408}
1409
1410export interface ShowFilePayload {
1411 filepath: string;
1412}
1413
1414export interface ApplyToFilePayload {
1415 streamId: string;
1416 filepath?: string;
1417 text: string;
1418 toolCallId?: string;
1419 isSearchAndReplace?: boolean;
1420}
1421
1422export interface RangeInFileWithContents {
1423 filepath: string;
1424 range: {
1425 start: { line: number; character: number };
1426 end: { line: number; character: number };
1427 };
1428 contents: string;
1429}
1430
1431export interface RangeInFileWithNextEditInfo {
1432 filepath: string;
1433 range: Range;
1434 fileContents: string;
1435 editText: string;
1436 afterCursorPos: Position;
1437 beforeCursorPos: Position;
1438 workspaceDir: string;
1439}
1440
1441export type SetCodeToEditPayload = RangeInFileWithContents | FileWithContents;
1442
1443/**
1444 * Signature help represents the signature of something
1445 * callable. There can be multiple signatures but only one
1446 * active and only one active parameter.
1447 */
1448export class SignatureHelp {
1449 /**
1450 * One or more signatures.
1451 */
1452 signatures: SignatureInformation[];
1453
1454 /**
1455 * The active signature.
1456 */
1457 activeSignature: number;
1458
1459 /**
1460 * The active parameter of the active signature.
1461 */
1462 activeParameter: number;
1463}
1464
1465/**
1466 * Represents the signature of something callable. A signature
1467 * can have a label, like a function-name, a doc-comment, and
1468 * a set of parameters.
1469 */
1470export class SignatureInformation {
1471 /**
1472 * The label of this signature. Will be shown in
1473 * the UI.
1474 */
1475 label: string;
1476
1477 /**
1478 * The parameters of this signature.
1479 */
1480 parameters: ParameterInformation[];
1481
1482 /**
1483 * The index of the active parameter.
1484 *
1485 * If provided, this is used in place of {@linkcode SignatureHelp.activeParameter}.
1486 */
1487 activeParameter?: number;
1488}
1489
1490/**
1491 * Represents a parameter of a callable-signature. A parameter can
1492 * have a label and a doc-comment.
1493 */
1494export class ParameterInformation {
1495 /**
1496 * The label of this signature.
1497 *
1498 * Either a string or inclusive start and exclusive end offsets within its containing
1499 * {@link SignatureInformation.label signature label}. *Note*: A label of type string must be
1500 * a substring of its containing signature information's {@link SignatureInformation.label label}.
1501 */
1502 label: string | [number, number];
1503}
1504
1505/**
1506 * Represents the configuration for a quick action in the Code Lens.
1507 * Quick actions are custom commands that can be added to function and class declarations.
1508 */
1509export interface QuickActionConfig {
1510 /**
1511 * The title of the quick action that will display in the Code Lens.
1512 */
1513 title: string;
1514
1515 /**
1516 * The prompt that will be sent to the model when the quick action is invoked,
1517 * with the function or class body concatenated.
1518 */
1519 prompt: string;
1520
1521 /**
1522 * If `true`, the result of the quick action will be sent to the chat panel.
1523 * If `false`, the streamed result will be inserted into the document.
1524 *
1525 * Defaults to `false`.
1526 */
1527 sendToChat: boolean;
1528}
1529
1530export type DefaultContextProvider = ContextProviderWithParams & {
1531 query?: string;
1532};
1533
1534export interface ExperimentalConfig {
1535 contextMenuPrompts?: ContextMenuConfig;
1536 modelRoles?: ExperimentalModelRoles;
1537 defaultContext?: DefaultContextProvider[];
1538 promptPath?: string;
1539 enableExperimentalTools?: boolean;
1540 onlyUseSystemMessageTools?: boolean;
1541
1542 /**
1543 * Quick actions are a way to add custom commands to the Code Lens of
1544 * function and class declarations.
1545 */
1546 quickActions?: QuickActionConfig[];
1547
1548 /**
1549 * Automatically read LLM chat responses aloud using system TTS models
1550 */
1551 readResponseTTS?: boolean;
1552
1553 /**
1554 * If set to true, we will attempt to pull down and install an instance of Chromium
1555 * that is compatible with the current version of Puppeteer.
1556 * This is needed to crawl a large number of documentation sites that are dynamically rendered.
1557 */
1558 useChromiumForDocsCrawling?: boolean;
1559 modelContextProtocolServers?: ExperimentalMCPOptions[];
1560
1561 /**
1562 * If enabled, will add the current file as context.
1563 */
1564 useCurrentFileAsContext?: boolean;
1565
1566 /**
1567 * If enabled, @codebase will only use tool calling
1568 * instead of embeddings, FTS, recently edited files, etc.
1569 */
1570 codebaseToolCallingOnly?: boolean;
1571
1572 /**
1573 * If enabled, static contextualization will be used to
1574 * gather context for the model where necessary.
1575 */
1576 enableStaticContextualization?: boolean;
1577}
1578
1579export interface AnalyticsConfig {
1580 provider: string;
1581 url?: string;
1582 clientKey?: string;
1583}
1584
1585export interface JSONModelDescription {
1586 title: string;
1587 provider: string;
1588 underlyingProviderName: string;
1589 model: string;
1590 apiKey?: string;
1591 apiBase?: string;
1592
1593 contextLength?: number;
1594 maxStopWords?: number;
1595 template?: TemplateType;
1596 completionOptions?: BaseCompletionOptions;
1597 systemMessage?: string;
1598 requestOptions?: RequestOptions;
1599 cacheBehavior?: CacheBehavior;
1600
1601 region?: string;
1602 profile?: string;
1603 modelArn?: string;
1604 apiType?: "openai" | "azure";
1605 apiVersion?: string;
1606 deployment?: string;
1607 projectId?: string;
1608 accountId?: string;
1609 aiGatewaySlug?: string;
1610 useLegacyCompletionsEndpoint?: boolean;
1611 deploymentId?: string;
1612 isFromAutoDetect?: boolean;
1613}
1614
1615// config.json
1616export interface SerializedContinueConfig {
1617 env?: string[];
1618 allowAnonymousTelemetry?: boolean;
1619 models: JSONModelDescription[];
1620 systemMessage?: string;
1621 completionOptions?: BaseCompletionOptions;
1622 requestOptions?: RequestOptions;
1623 slashCommands?: SlashCommandDescription[];
1624 customCommands?: CustomCommand[];
1625 contextProviders?: ContextProviderWithParams[];
1626 disableIndexing?: boolean;
1627 disableSessionTitles?: boolean;
1628 userToken?: string;
1629 embeddingsProvider?: EmbeddingsProviderDescription;
1630 tabAutocompleteModel?: JSONModelDescription | JSONModelDescription[];
1631 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1632 ui?: ContinueUIConfig;
1633 reranker?: RerankerDescription;
1634 experimental?: ExperimentalConfig;
1635 analytics?: AnalyticsConfig;
1636 docs?: SiteIndexingConfig[];
1637 data?: DataDestination[];
1638}
1639
1640export type ConfigMergeType = "merge" | "overwrite";
1641
1642export type ContinueRcJson = Partial<SerializedContinueConfig> & {
1643 mergeBehavior: ConfigMergeType;
1644};
1645
1646// config.ts - give users simplified interfaces
1647export interface Config {
1648 /** If set to true, Continue will collect anonymous usage data to improve the product. If set to false, we will collect nothing. Read here to learn more: https://docs.continue.dev/telemetry */
1649 allowAnonymousTelemetry?: boolean;
1650 /** Each entry in this array will originally be a JSONModelDescription, the same object from your config.json, but you may add CustomLLMs.
1651 * A CustomLLM requires you only to define an AsyncGenerator that calls the LLM and yields string updates. You can choose to define either `streamCompletion` or `streamChat` (or both).
1652 * Continue will do the rest of the work to construct prompt templates, handle context items, prune context, etc.
1653 */
1654 models: (CustomLLM | JSONModelDescription)[];
1655 /** A system message to be followed by all of your models */
1656 systemMessage?: string;
1657 /** The default completion options for all models */
1658 completionOptions?: BaseCompletionOptions;
1659 /** Request options that will be applied to all models and context providers */
1660 requestOptions?: RequestOptions;
1661 /** The list of slash commands that will be available in the sidebar */
1662 slashCommands?: (SlashCommand | SlashCommandWithSource)[];
1663 /** Each entry in this array will originally be a ContextProviderWithParams, the same object from your config.json, but you may add CustomContextProviders.
1664 * A CustomContextProvider requires you only to define a title and getContextItems function. When you type '@title <query>', Continue will call `getContextItems(query)`.
1665 */
1666 contextProviders?: (CustomContextProvider | ContextProviderWithParams)[];
1667 /** If set to true, Continue will not index your codebase for retrieval */
1668 disableIndexing?: boolean;
1669 /** If set to true, Continue will not make extra requests to the LLM to generate a summary title of each session. */
1670 disableSessionTitles?: boolean;
1671 /** An optional token to identify a user. Not used by Continue unless you write custom coniguration that requires such a token */
1672 userToken?: string;
1673 /** The provider used to calculate embeddings. If left empty, Continue will use transformers.js to calculate the embeddings with all-MiniLM-L6-v2 */
1674 embeddingsProvider?: EmbeddingsProviderDescription | ILLM;
1675 /** The model that Continue will use for tab autocompletions. */
1676 tabAutocompleteModel?:
1677 | CustomLLM
1678 | JSONModelDescription
1679 | (CustomLLM | JSONModelDescription)[];
1680 /** Options for tab autocomplete */
1681 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1682 /** UI styles customization */
1683 ui?: ContinueUIConfig;
1684 /** Options for the reranker */
1685 reranker?: RerankerDescription | ILLM;
1686 /** Experimental configuration */
1687 experimental?: ExperimentalConfig;
1688 /** Analytics configuration */
1689 analytics?: AnalyticsConfig;
1690 docs?: SiteIndexingConfig[];
1691 data?: DataDestination[];
1692}
1693
1694// in the actual Continue source code
1695export interface ContinueConfig {
1696 allowAnonymousTelemetry?: boolean;
1697 // systemMessage?: string;
1698 completionOptions?: BaseCompletionOptions;
1699 requestOptions?: RequestOptions;
1700 slashCommands: SlashCommandWithSource[];
1701 contextProviders: IContextProvider[];
1702 disableSessionTitles?: boolean;
1703 disableIndexing?: boolean;
1704 userToken?: string;
1705 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1706 ui?: ContinueUIConfig;
1707 experimental?: ExperimentalConfig;
1708 analytics?: AnalyticsConfig;
1709 docs?: SiteIndexingConfig[];
1710 tools: Tool[];
1711 mcpServerStatuses: MCPServerStatus[];
1712 rules: RuleWithSource[];
1713 modelsByRole: Record<ModelRole, ILLM[]>;
1714 selectedModelByRole: Record<ModelRole, ILLM | null>;
1715 data?: DataDestination[];
1716}
1717
1718export interface BrowserSerializedContinueConfig {
1719 allowAnonymousTelemetry?: boolean;
1720 // systemMessage?: string;
1721 completionOptions?: BaseCompletionOptions;
1722 requestOptions?: RequestOptions;
1723 slashCommands: SlashCommandDescWithSource[];
1724 contextProviders: ContextProviderDescription[];
1725 disableIndexing?: boolean;
1726 disableSessionTitles?: boolean;
1727 userToken?: string;
1728 ui?: ContinueUIConfig;
1729 experimental?: ExperimentalConfig;
1730 analytics?: AnalyticsConfig;
1731 docs?: SiteIndexingConfig[];
1732 tools: Tool[];
1733 mcpServerStatuses: MCPServerStatus[];
1734 rules: RuleWithSource[];
1735 usePlatform: boolean;
1736 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1737 modelsByRole: Record<ModelRole, ModelDescription[]>;
1738 selectedModelByRole: Record<ModelRole, ModelDescription | null>;
1739}
1740
1741// DOCS SUGGESTIONS AND PACKAGE INFO
1742export interface FilePathAndName {
1743 path: string;
1744 name: string;
1745}
1746
1747export interface PackageFilePathAndName extends FilePathAndName {
1748 packageRegistry: string; // e.g. npm, pypi
1749}
1750
1751export type ParsedPackageInfo = {
1752 name: string;
1753 packageFile: PackageFilePathAndName;
1754 language: string;
1755 version: string;
1756};
1757
1758export type PackageDetails = {
1759 docsLink?: string;
1760 docsLinkWarning?: string;
1761 title?: string;
1762 description?: string;
1763 repo?: string;
1764 license?: string;
1765};
1766
1767export type PackageDetailsSuccess = PackageDetails & {
1768 docsLink: string;
1769};
1770
1771export type PackageDocsResult = {
1772 packageInfo: ParsedPackageInfo;
1773} & (
1774 | { error: string; details?: never }
1775 | { details: PackageDetailsSuccess; error?: never }
1776);
1777
1778export interface TerminalOptions {
1779 reuseTerminal?: boolean;
1780 terminalName?: string;
1781 waitForCompletion?: boolean;
1782}
1783
1784export type RuleSource =
1785 | "default-chat"
1786 | "default-plan"
1787 | "default-agent"
1788 | "model-options-chat"
1789 | "model-options-plan"
1790 | "model-options-agent"
1791 | "rules-block"
1792 | "colocated-markdown"
1793 | "json-systemMessage"
1794 | ".continuerules";
1795
1796export interface RuleWithSource {
1797 name?: string;
1798 slug?: string;
1799 source: RuleSource;
1800 globs?: string | string[];
1801 regex?: string | string[];
1802 rule: string;
1803 description?: string;
1804 ruleFile?: string;
1805 alwaysApply?: boolean;
1806}
1807export interface CompleteOnboardingPayload {
1808 mode: OnboardingModes;
1809 provider?: string;
1810 apiKey?: string;
1811}
1812
1813export interface CompiledMessagesResult {
1814 compiledChatMessages: ChatMessage[];
1815 didPrune: boolean;
1816 contextPercentage: number;
1817}
1818
1819export interface MessageOption {
1820 precompiled: boolean;
1821}
1822
1823/* LSP-specific interfaces. */
1824
1825// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind.
1826// We shift this one index down to match vscode.SymbolKind.
1827export enum SymbolKind {
1828 File = 0,
1829 Module = 1,
1830 Namespace = 2,
1831 Package = 3,
1832 Class = 4,
1833 Method = 5,
1834 Property = 6,
1835 Field = 7,
1836 Constructor = 8,
1837 Enum = 9,
1838 Interface = 10,
1839 Function = 11,
1840 Variable = 12,
1841 Constant = 13,
1842 String = 14,
1843 Number = 15,
1844 Boolean = 16,
1845 Array = 17,
1846 Object = 18,
1847 Key = 19,
1848 Null = 20,
1849 EnumMember = 21,
1850 Struct = 22,
1851 Event = 23,
1852 Operator = 24,
1853 TypeParameter = 25,
1854}
1855
1856// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag.
1857export namespace SymbolTag {
1858 export const Deprecated: 1 = 1;
1859}
1860
1861// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag.
1862export type SymbolTag = 1;
1863
1864// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentSymbol.
1865export interface DocumentSymbol {
1866 name: string;
1867 detail?: string;
1868 kind: SymbolKind;
1869 tags?: SymbolTag[];
1870 deprecated?: boolean;
1871 range: Range;
1872 selectionRange: Range;
1873 children?: DocumentSymbol[];
1874}