Elffuss BraidHub

kikocis/continue public

c04584525d2e · 44.2 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}
670
671type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<
672 T,
673 Exclude<keyof T, Keys>
674> &
675 {
676 [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
677 }[Keys];
678
679export interface CustomLLMWithOptionals {
680 options: LLMOptions;
681 streamCompletion?: (
682 prompt: string,
683 signal: AbortSignal,
684 options: CompletionOptions,
685 fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>,
686 ) => AsyncGenerator<string>;
687 streamChat?: (
688 messages: ChatMessage[],
689 signal: AbortSignal,
690 options: CompletionOptions,
691 fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>,
692 ) => AsyncGenerator<ChatMessage | string>;
693 listModels?: (
694 fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>,
695 ) => Promise<string[]>;
696}
697
698/**
699 * The LLM interface requires you to specify either `streamCompletion` or `streamChat` (or both).
700 */
701export type CustomLLM = RequireAtLeastOne<
702 CustomLLMWithOptionals,
703 "streamCompletion" | "streamChat"
704>;
705
706// IDE
707
708export type DiffType = "new" | "old" | "same";
709
710export interface DiffObject {
711 type: DiffType;
712}
713
714export interface DiffLine extends DiffObject {
715 line: string;
716}
717
718interface DiffChar extends DiffObject {
719 char: string;
720 oldIndex?: number; // Character index assuming a flattened line string.
721 newIndex?: number;
722 oldCharIndexInLine?: number; // Character index assuming new lines reset the character index to 0.
723 newCharIndexInLine?: number;
724 oldLineIndex?: number;
725 newLineIndex?: number;
726}
727
728export interface Problem {
729 filepath: string;
730 range: Range;
731 message: string;
732}
733
734export interface Thread {
735 name: string;
736 id: number;
737}
738
739export type IdeType = "vscode" | "jetbrains";
740
741export interface IdeInfo {
742 ideType: IdeType;
743 name: string;
744 version: string;
745 remoteName: string;
746 extensionVersion: string;
747 isPrerelease: boolean;
748}
749
750export interface BranchAndDir {
751 branch: string;
752 directory: string;
753}
754
755export interface IndexTag extends BranchAndDir {
756 artifactId: string;
757}
758
759export enum FileType {
760 Unkown = 0,
761 File = 1,
762 Directory = 2,
763 SymbolicLink = 64,
764}
765
766export interface IdeSettings {
767 remoteConfigServerUrl: string | undefined;
768 remoteConfigSyncPeriod: number;
769 userToken: string;
770 continueTestEnvironment: "none" | "production" | "staging" | "local";
771 pauseCodebaseIndexOnStart: boolean;
772}
773
774export interface FileStats {
775 size: number;
776 lastModified: number;
777}
778
779/** Map of file name to stats */
780export type FileStatsMap = {
781 [path: string]: FileStats;
782};
783
784export interface IDE {
785 getIdeInfo(): Promise<IdeInfo>;
786
787 getIdeSettings(): Promise<IdeSettings>;
788
789 getDiff(includeUnstaged: boolean): Promise<string[]>;
790
791 getClipboardContent(): Promise<{ text: string; copiedAt: string }>;
792
793 isTelemetryEnabled(): Promise<boolean>;
794
795 isWorkspaceRemote(): Promise<boolean>;
796
797 getUniqueId(): Promise<string>;
798
799 getTerminalContents(): Promise<string>;
800
801 getDebugLocals(threadIndex: number): Promise<string>;
802
803 getTopLevelCallStackSources(
804 threadIndex: number,
805 stackDepth: number,
806 ): Promise<string[]>;
807
808 getAvailableThreads(): Promise<Thread[]>;
809
810 getWorkspaceDirs(): Promise<string[]>;
811
812 fileExists(fileUri: string): Promise<boolean>;
813
814 writeFile(path: string, contents: string): Promise<void>;
815
816 showVirtualFile(title: string, contents: string): Promise<void>;
817
818 openFile(path: string): Promise<void>;
819
820 openUrl(url: string): Promise<void>;
821
822 runCommand(command: string, options?: TerminalOptions): Promise<void>;
823
824 saveFile(fileUri: string): Promise<void>;
825
826 readFile(fileUri: string): Promise<string>;
827
828 readRangeInFile(fileUri: string, range: Range): Promise<string>;
829
830 showLines(fileUri: string, startLine: number, endLine: number): Promise<void>;
831
832 getOpenFiles(): Promise<string[]>;
833
834 getCurrentFile(): Promise<
835 | undefined
836 | {
837 isUntitled: boolean;
838 path: string;
839 contents: string;
840 }
841 >;
842
843 getPinnedFiles(): Promise<string[]>;
844
845 getSearchResults(query: string, maxResults?: number): Promise<string>;
846
847 getFileResults(pattern: string, maxResults?: number): Promise<string[]>;
848
849 subprocess(command: string, cwd?: string): Promise<[string, string]>;
850
851 getProblems(fileUri?: string | undefined): Promise<Problem[]>;
852
853 getBranch(dir: string): Promise<string>;
854
855 getTags(artifactId: string): Promise<IndexTag[]>;
856
857 getRepoName(dir: string): Promise<string | undefined>;
858
859 showToast(
860 type: ToastType,
861 message: string,
862 ...otherParams: any[]
863 ): Promise<any>;
864
865 getGitRootPath(dir: string): Promise<string | undefined>;
866
867 listDir(dir: string): Promise<[string, FileType][]>;
868
869 getFileStats(files: string[]): Promise<FileStatsMap>;
870
871 // Secret Storage
872 readSecrets(keys: string[]): Promise<Record<string, string>>;
873
874 writeSecrets(secrets: { [key: string]: string }): Promise<void>;
875
876 // LSP
877 gotoDefinition(location: Location): Promise<RangeInFile[]>;
878 gotoTypeDefinition(location: Location): Promise<RangeInFile[]>; // TODO: add to jetbrains
879 getSignatureHelp(location: Location): Promise<SignatureHelp | null>; // TODO: add to jetbrains
880 getReferences(location: Location): Promise<RangeInFile[]>;
881 getDocumentSymbols(textDocumentIdentifier: string): Promise<DocumentSymbol[]>;
882
883 // Callbacks
884 onDidChangeActiveTextEditor(callback: (fileUri: string) => void): void;
885}
886
887// Slash Commands
888
889export interface ContinueSDK {
890 ide: IDE;
891 llm: ILLM;
892 addContextItem: (item: ContextItemWithId) => void;
893 history: ChatMessage[];
894 input: string;
895 params?: { [key: string]: any } | undefined;
896 contextItems: ContextItemWithId[];
897 selectedCode: RangeInFile[];
898 config: ContinueConfig;
899 fetch: FetchFunction;
900 completionOptions?: LLMFullCompletionOptions;
901 abortController: AbortController;
902}
903
904/* Be careful changing SlashCommand or SlashCommandDescription, config.ts can break */
905export interface SlashCommandDescription {
906 name: string;
907 description: string;
908 prompt?: string;
909 params?: { [key: string]: any };
910}
911
912export interface SlashCommand extends SlashCommandDescription {
913 run: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>;
914}
915
916export interface SlashCommandWithSource extends SlashCommandDescription {
917 run?: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>; // Optional - only needed for legacy
918 source: SlashCommandSource;
919 promptFile?: string;
920 overrideSystemMessage?: string;
921}
922
923export type SlashCommandSource =
924 | "built-in-legacy"
925 | "built-in"
926 | "json-custom-command"
927 | "config-ts-slash-command"
928 | "yaml-prompt-block"
929 | "mcp-prompt"
930 | "prompt-file-v1"
931 | "prompt-file-v2"
932 | "invokable-rule";
933
934export interface SlashCommandDescWithSource extends SlashCommandDescription {
935 isLegacy: boolean; // Maps to if slashcommand.run exists
936 source: SlashCommandSource;
937 promptFile?: string;
938 mcpServerName?: string;
939 mcpArgs?: MCPPromptArgs;
940}
941
942// Config
943
944export type StepName =
945 | "AnswerQuestionChroma"
946 | "GenerateShellCommandStep"
947 | "EditHighlightedCodeStep"
948 | "ShareSessionStep"
949 | "CommentCodeStep"
950 | "ClearHistoryStep"
951 | "StackOverflowStep"
952 | "OpenConfigStep"
953 | "GenerateShellCommandStep"
954 | "DraftIssueStep";
955
956export type ContextProviderName =
957 | "diff"
958 | "terminal"
959 | "debugger"
960 | "open"
961 | "google"
962 | "search"
963 | "tree"
964 | "http"
965 | "codebase"
966 | "problems"
967 | "folder"
968 | "jira"
969 | "postgres"
970 | "database"
971 | "code"
972 | "docs"
973 | "gitlab-mr"
974 | "os"
975 | "currentFile"
976 | "greptile"
977 | "outline"
978 | "continue-proxy"
979 | "highlights"
980 | "file"
981 | "issue"
982 | "repo-map"
983 | "url"
984 | "commit"
985 | "web"
986 | "discord"
987 | "clipboard"
988 | string;
989
990export type TemplateType =
991 | "llama2"
992 | "alpaca"
993 | "zephyr"
994 | "phi2"
995 | "phind"
996 | "anthropic"
997 | "chatml"
998 | "none"
999 | "openchat"
1000 | "deepseek"
1001 | "xwin-coder"
1002 | "neural-chat"
1003 | "codellama-70b"
1004 | "llava"
1005 | "gemma"
1006 | "granite"
1007 | "llama3"
1008 | "codestral";
1009
1010export interface RequestOptions {
1011 timeout?: number;
1012 verifySsl?: boolean;
1013 caBundlePath?: string | string[];
1014 proxy?: string;
1015 headers?: { [key: string]: string };
1016 extraBodyProperties?: { [key: string]: any };
1017 noProxy?: string[];
1018 clientCertificate?: ClientCertificateOptions;
1019}
1020
1021export interface CacheBehavior {
1022 cacheSystemMessage?: boolean;
1023 cacheConversation?: boolean;
1024}
1025
1026export interface ClientCertificateOptions {
1027 cert: string;
1028 key: string;
1029 passphrase?: string;
1030}
1031
1032export interface StepWithParams {
1033 name: StepName;
1034 params: { [key: string]: any };
1035}
1036
1037export interface ContextProviderWithParams {
1038 name: ContextProviderName;
1039 params: { [key: string]: any };
1040}
1041
1042export interface CustomCommand {
1043 name: string;
1044 prompt: string;
1045 description?: string;
1046 sourceFile?: string;
1047}
1048
1049export interface Prediction {
1050 type: "content";
1051 content:
1052 | string
1053 | {
1054 type: "text";
1055 text: string;
1056 }[];
1057}
1058
1059export interface ToolExtras {
1060 ide: IDE;
1061 llm: ILLM;
1062 fetch: FetchFunction;
1063 tool: Tool;
1064 toolCallId?: string;
1065 onPartialOutput?: (params: {
1066 toolCallId: string;
1067 contextItems: ContextItem[];
1068 }) => void;
1069 config: ContinueConfig;
1070 codeBaseIndexer?: CodebaseIndexer;
1071}
1072
1073export type ToolPolicy =
1074 | "allowedWithPermission"
1075 | "allowedWithoutPermission"
1076 | "disabled";
1077
1078export interface Tool {
1079 type: "function";
1080 function: {
1081 name: string;
1082 description?: string;
1083 parameters?: Record<string, any>;
1084 strict?: boolean | null;
1085 };
1086
1087 displayTitle: string;
1088 wouldLikeTo?: string;
1089 isCurrently?: string;
1090 hasAlready?: string;
1091 readonly: boolean;
1092 isInstant?: boolean;
1093 uri?: string;
1094 faviconUrl?: string;
1095 group: string;
1096 originalFunctionName?: string;
1097 systemMessageDescription?: {
1098 prefix: string;
1099 exampleArgs?: Array<[string, string | number]>;
1100 };
1101 defaultToolPolicy?: ToolPolicy;
1102}
1103
1104interface ToolChoice {
1105 type: "function";
1106 function: {
1107 name: string;
1108 };
1109}
1110
1111export interface ConfigDependentToolParams {
1112 rules: RuleWithSource[];
1113 enableExperimentalTools: boolean;
1114 isSignedIn: boolean;
1115}
1116
1117export type GetTool = (params: ConfigDependentToolParams) => Tool;
1118
1119export interface BaseCompletionOptions {
1120 temperature?: number;
1121 topP?: number;
1122 topK?: number;
1123 minP?: number;
1124 presencePenalty?: number;
1125 frequencyPenalty?: number;
1126 mirostat?: number;
1127 stop?: string[];
1128 maxTokens?: number;
1129 numThreads?: number;
1130 useMmap?: boolean;
1131 keepAlive?: number;
1132 numGpu?: number;
1133 raw?: boolean;
1134 stream?: boolean;
1135 prediction?: Prediction;
1136 tools?: Tool[];
1137 toolChoice?: ToolChoice;
1138 reasoning?: boolean;
1139 reasoningBudgetTokens?: number;
1140 promptCaching?: boolean;
1141}
1142
1143export interface ModelCapability {
1144 uploadImage?: boolean;
1145 tools?: boolean;
1146 nextEdit?: boolean;
1147}
1148
1149export interface ModelDescription {
1150 title: string;
1151 provider: string;
1152 underlyingProviderName: string;
1153 model: string;
1154 apiKey?: string;
1155
1156 apiBase?: string;
1157 apiKeyLocation?: string;
1158 envSecretLocations?: Record<string, string>;
1159 orgScopeId?: string | null;
1160
1161 onPremProxyUrl?: string | null;
1162
1163 contextLength?: number;
1164 maxStopWords?: number;
1165 template?: TemplateType;
1166 completionOptions?: BaseCompletionOptions;
1167 baseAgentSystemMessage?: string;
1168 basePlanSystemMessage?: string;
1169 baseChatSystemMessage?: string;
1170 requestOptions?: RequestOptions;
1171 promptTemplates?: { [key: string]: string };
1172 cacheBehavior?: CacheBehavior;
1173 capabilities?: ModelCapability;
1174 roles?: ModelRole[];
1175 configurationStatus?: LLMConfigurationStatuses;
1176
1177 sourceFile?: string;
1178}
1179
1180export interface JSONEmbedOptions {
1181 apiBase?: string;
1182 apiKey?: string;
1183 model?: string;
1184 deployment?: string;
1185 apiType?: string;
1186 apiVersion?: string;
1187 requestOptions?: RequestOptions;
1188 maxEmbeddingChunkSize?: number;
1189 maxEmbeddingBatchSize?: number;
1190
1191 // AWS options
1192 profile?: string;
1193
1194 // AWS and VertexAI Options
1195 region?: string;
1196
1197 // VertexAI and Watsonx Options
1198 projectId?: string;
1199}
1200
1201export interface EmbeddingsProviderDescription extends JSONEmbedOptions {
1202 provider: string;
1203}
1204
1205export interface RerankerDescription {
1206 name: string;
1207 params?: { [key: string]: any };
1208}
1209
1210// TODO: We should consider renaming this to AutocompleteOptions.
1211export interface TabAutocompleteOptions {
1212 disable: boolean;
1213 maxPromptTokens: number;
1214 debounceDelay: number;
1215 modelTimeout: number;
1216 maxSuffixPercentage: number;
1217 prefixPercentage: number;
1218 transform?: boolean;
1219 template?: string;
1220 multilineCompletions: "always" | "never" | "auto";
1221 slidingWindowPrefixPercentage: number;
1222 slidingWindowSize: number;
1223 useCache: boolean;
1224 onlyMyCode: boolean;
1225 useRecentlyEdited: boolean;
1226 useRecentlyOpened: boolean;
1227 disableInFiles?: string[];
1228 useImports?: boolean;
1229 showWhateverWeHaveAtXMs?: number;
1230 // true = enabled, false = disabled, number = enabled with priority
1231 experimental_includeClipboard: boolean | number;
1232 experimental_includeRecentlyVisitedRanges: boolean | number;
1233 experimental_includeRecentlyEditedRanges: boolean | number;
1234 experimental_includeDiff: boolean | number;
1235 experimental_enableStaticContextualization: boolean;
1236}
1237
1238export interface StdioOptions {
1239 type: "stdio";
1240 command: string;
1241 args: string[];
1242 env?: Record<string, string>;
1243 cwd?: string;
1244 requestOptions?: RequestOptions;
1245}
1246
1247export interface WebSocketOptions {
1248 type: "websocket";
1249 url: string;
1250 requestOptions?: RequestOptions;
1251}
1252
1253export interface SSEOptions {
1254 type: "sse";
1255 url: string;
1256 requestOptions?: RequestOptions;
1257}
1258
1259export interface StreamableHTTPOptions {
1260 type: "streamable-http";
1261 url: string;
1262 requestOptions?: RequestOptions;
1263}
1264
1265export type TransportOptions =
1266 | StdioOptions
1267 | WebSocketOptions
1268 | SSEOptions
1269 | StreamableHTTPOptions;
1270
1271export interface MCPOptions {
1272 name: string;
1273 id: string;
1274 transport: TransportOptions;
1275 faviconUrl?: string;
1276 timeout?: number;
1277}
1278
1279export type MCPConnectionStatus =
1280 | "connecting"
1281 | "connected"
1282 | "error"
1283 | "authenticating"
1284 | "not-connected";
1285
1286export type MCPPromptArgs = {
1287 name: string;
1288 description?: string;
1289 required?: boolean;
1290}[];
1291
1292export interface MCPPrompt {
1293 name: string;
1294 description?: string;
1295 arguments?: MCPPromptArgs;
1296}
1297
1298// Leaving here to ideate on
1299// export type ContinueConfigSource = "local-yaml" | "local-json" | "hub-assistant" | "hub"
1300
1301// https://modelcontextprotocol.io/docs/concepts/resources#direct-resources
1302export interface MCPResource {
1303 name: string;
1304 uri: string;
1305 description?: string;
1306 mimeType?: string;
1307}
1308
1309// https://modelcontextprotocol.io/docs/concepts/resources#resource-templates
1310export interface MCPResourceTemplate {
1311 uriTemplate: string;
1312 name: string;
1313 description?: string;
1314 mimeType?: string;
1315}
1316
1317export interface MCPTool {
1318 name: string;
1319 description?: string;
1320 inputSchema: {
1321 type: "object";
1322 properties?: Record<string, any>;
1323 };
1324}
1325
1326export interface MCPServerStatus extends MCPOptions {
1327 status: MCPConnectionStatus;
1328 errors: string[];
1329 isProtectedResource: boolean;
1330
1331 prompts: MCPPrompt[];
1332 tools: MCPTool[];
1333 resources: MCPResource[];
1334 resourceTemplates: MCPResourceTemplate[];
1335 sourceFile?: string;
1336}
1337
1338export interface ContinueUIConfig {
1339 codeBlockToolbarPosition?: "top" | "bottom";
1340 fontSize?: number;
1341 displayRawMarkdown?: boolean;
1342 showChatScrollbar?: boolean;
1343 codeWrap?: boolean;
1344 showSessionTabs?: boolean;
1345 autoAcceptEditToolDiffs?: boolean;
1346}
1347
1348export interface ContextMenuConfig {
1349 comment?: string;
1350 docstring?: string;
1351 fix?: string;
1352 optimize?: string;
1353 fixGrammar?: string;
1354}
1355
1356export interface ExperimentalModelRoles {
1357 repoMapFileSelection?: string;
1358 inlineEdit?: string;
1359 applyCodeBlock?: string;
1360}
1361
1362export interface ExperimentalMCPOptions {
1363 transport: TransportOptions;
1364 faviconUrl?: string;
1365 timeout?: number;
1366}
1367
1368export type ApplyStateStatus =
1369 | "not-started" // Apply state created but not necessarily streaming
1370 | "streaming" // Changes are being applied to the file
1371 | "done" // All changes have been applied, awaiting user to accept/reject
1372 | "closed"; // All changes have been applied. Note that for new files, we immediately set the status to "closed"
1373
1374export interface ApplyState {
1375 streamId: string;
1376 status?: ApplyStateStatus;
1377 numDiffs?: number;
1378 filepath?: string;
1379 fileContent?: string;
1380 originalFileContent?: string;
1381 toolCallId?: string;
1382}
1383
1384export interface StreamDiffLinesPayload {
1385 prefix: string;
1386 highlighted: string;
1387 suffix: string;
1388 input: string;
1389 language: string | undefined;
1390 modelTitle: string | undefined;
1391 includeRulesInSystemMessage: boolean;
1392 fileUri?: string;
1393}
1394
1395export interface HighlightedCodePayload {
1396 rangeInFileWithContents: RangeInFileWithContents;
1397 prompt?: string;
1398 shouldRun?: boolean;
1399}
1400
1401export interface AcceptOrRejectDiffPayload {
1402 filepath?: string;
1403 streamId?: string;
1404}
1405
1406export interface ShowFilePayload {
1407 filepath: string;
1408}
1409
1410export interface ApplyToFilePayload {
1411 streamId: string;
1412 filepath?: string;
1413 text: string;
1414 toolCallId?: string;
1415 isSearchAndReplace?: boolean;
1416}
1417
1418export interface RangeInFileWithContents {
1419 filepath: string;
1420 range: {
1421 start: { line: number; character: number };
1422 end: { line: number; character: number };
1423 };
1424 contents: string;
1425}
1426
1427export interface RangeInFileWithNextEditInfo {
1428 filepath: string;
1429 range: Range;
1430 fileContents: string;
1431 editText: string;
1432 afterCursorPos: Position;
1433 beforeCursorPos: Position;
1434 workspaceDir: string;
1435}
1436
1437export type SetCodeToEditPayload = RangeInFileWithContents | FileWithContents;
1438
1439/**
1440 * Signature help represents the signature of something
1441 * callable. There can be multiple signatures but only one
1442 * active and only one active parameter.
1443 */
1444export class SignatureHelp {
1445 /**
1446 * One or more signatures.
1447 */
1448 signatures: SignatureInformation[];
1449
1450 /**
1451 * The active signature.
1452 */
1453 activeSignature: number;
1454
1455 /**
1456 * The active parameter of the active signature.
1457 */
1458 activeParameter: number;
1459}
1460
1461/**
1462 * Represents the signature of something callable. A signature
1463 * can have a label, like a function-name, a doc-comment, and
1464 * a set of parameters.
1465 */
1466export class SignatureInformation {
1467 /**
1468 * The label of this signature. Will be shown in
1469 * the UI.
1470 */
1471 label: string;
1472
1473 /**
1474 * The parameters of this signature.
1475 */
1476 parameters: ParameterInformation[];
1477
1478 /**
1479 * The index of the active parameter.
1480 *
1481 * If provided, this is used in place of {@linkcode SignatureHelp.activeParameter}.
1482 */
1483 activeParameter?: number;
1484}
1485
1486/**
1487 * Represents a parameter of a callable-signature. A parameter can
1488 * have a label and a doc-comment.
1489 */
1490export class ParameterInformation {
1491 /**
1492 * The label of this signature.
1493 *
1494 * Either a string or inclusive start and exclusive end offsets within its containing
1495 * {@link SignatureInformation.label signature label}. *Note*: A label of type string must be
1496 * a substring of its containing signature information's {@link SignatureInformation.label label}.
1497 */
1498 label: string | [number, number];
1499}
1500
1501/**
1502 * Represents the configuration for a quick action in the Code Lens.
1503 * Quick actions are custom commands that can be added to function and class declarations.
1504 */
1505export interface QuickActionConfig {
1506 /**
1507 * The title of the quick action that will display in the Code Lens.
1508 */
1509 title: string;
1510
1511 /**
1512 * The prompt that will be sent to the model when the quick action is invoked,
1513 * with the function or class body concatenated.
1514 */
1515 prompt: string;
1516
1517 /**
1518 * If `true`, the result of the quick action will be sent to the chat panel.
1519 * If `false`, the streamed result will be inserted into the document.
1520 *
1521 * Defaults to `false`.
1522 */
1523 sendToChat: boolean;
1524}
1525
1526export type DefaultContextProvider = ContextProviderWithParams & {
1527 query?: string;
1528};
1529
1530export interface ExperimentalConfig {
1531 contextMenuPrompts?: ContextMenuConfig;
1532 modelRoles?: ExperimentalModelRoles;
1533 defaultContext?: DefaultContextProvider[];
1534 promptPath?: string;
1535 enableExperimentalTools?: boolean;
1536 onlyUseSystemMessageTools?: boolean;
1537
1538 /**
1539 * Quick actions are a way to add custom commands to the Code Lens of
1540 * function and class declarations.
1541 */
1542 quickActions?: QuickActionConfig[];
1543
1544 /**
1545 * Automatically read LLM chat responses aloud using system TTS models
1546 */
1547 readResponseTTS?: boolean;
1548
1549 /**
1550 * If set to true, we will attempt to pull down and install an instance of Chromium
1551 * that is compatible with the current version of Puppeteer.
1552 * This is needed to crawl a large number of documentation sites that are dynamically rendered.
1553 */
1554 useChromiumForDocsCrawling?: boolean;
1555 modelContextProtocolServers?: ExperimentalMCPOptions[];
1556
1557 /**
1558 * If enabled, will add the current file as context.
1559 */
1560 useCurrentFileAsContext?: boolean;
1561
1562 /**
1563 * If enabled, @codebase will only use tool calling
1564 * instead of embeddings, FTS, recently edited files, etc.
1565 */
1566 codebaseToolCallingOnly?: boolean;
1567
1568 /**
1569 * If enabled, static contextualization will be used to
1570 * gather context for the model where necessary.
1571 */
1572 enableStaticContextualization?: boolean;
1573}
1574
1575export interface AnalyticsConfig {
1576 provider: string;
1577 url?: string;
1578 clientKey?: string;
1579}
1580
1581export interface JSONModelDescription {
1582 title: string;
1583 provider: string;
1584 underlyingProviderName: string;
1585 model: string;
1586 apiKey?: string;
1587 apiBase?: string;
1588
1589 contextLength?: number;
1590 maxStopWords?: number;
1591 template?: TemplateType;
1592 completionOptions?: BaseCompletionOptions;
1593 systemMessage?: string;
1594 requestOptions?: RequestOptions;
1595 cacheBehavior?: CacheBehavior;
1596
1597 region?: string;
1598 profile?: string;
1599 modelArn?: string;
1600 apiType?: "openai" | "azure";
1601 apiVersion?: string;
1602 deployment?: string;
1603 projectId?: string;
1604 accountId?: string;
1605 aiGatewaySlug?: string;
1606 useLegacyCompletionsEndpoint?: boolean;
1607 deploymentId?: string;
1608}
1609
1610// config.json
1611export interface SerializedContinueConfig {
1612 env?: string[];
1613 allowAnonymousTelemetry?: boolean;
1614 models: JSONModelDescription[];
1615 systemMessage?: string;
1616 completionOptions?: BaseCompletionOptions;
1617 requestOptions?: RequestOptions;
1618 slashCommands?: SlashCommandDescription[];
1619 customCommands?: CustomCommand[];
1620 contextProviders?: ContextProviderWithParams[];
1621 disableIndexing?: boolean;
1622 disableSessionTitles?: boolean;
1623 userToken?: string;
1624 embeddingsProvider?: EmbeddingsProviderDescription;
1625 tabAutocompleteModel?: JSONModelDescription | JSONModelDescription[];
1626 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1627 ui?: ContinueUIConfig;
1628 reranker?: RerankerDescription;
1629 experimental?: ExperimentalConfig;
1630 analytics?: AnalyticsConfig;
1631 docs?: SiteIndexingConfig[];
1632 data?: DataDestination[];
1633}
1634
1635export type ConfigMergeType = "merge" | "overwrite";
1636
1637export type ContinueRcJson = Partial<SerializedContinueConfig> & {
1638 mergeBehavior: ConfigMergeType;
1639};
1640
1641// config.ts - give users simplified interfaces
1642export interface Config {
1643 /** 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 */
1644 allowAnonymousTelemetry?: boolean;
1645 /** Each entry in this array will originally be a JSONModelDescription, the same object from your config.json, but you may add CustomLLMs.
1646 * 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).
1647 * Continue will do the rest of the work to construct prompt templates, handle context items, prune context, etc.
1648 */
1649 models: (CustomLLM | JSONModelDescription)[];
1650 /** A system message to be followed by all of your models */
1651 systemMessage?: string;
1652 /** The default completion options for all models */
1653 completionOptions?: BaseCompletionOptions;
1654 /** Request options that will be applied to all models and context providers */
1655 requestOptions?: RequestOptions;
1656 /** The list of slash commands that will be available in the sidebar */
1657 slashCommands?: (SlashCommand | SlashCommandWithSource)[];
1658 /** Each entry in this array will originally be a ContextProviderWithParams, the same object from your config.json, but you may add CustomContextProviders.
1659 * A CustomContextProvider requires you only to define a title and getContextItems function. When you type '@title <query>', Continue will call `getContextItems(query)`.
1660 */
1661 contextProviders?: (CustomContextProvider | ContextProviderWithParams)[];
1662 /** If set to true, Continue will not index your codebase for retrieval */
1663 disableIndexing?: boolean;
1664 /** If set to true, Continue will not make extra requests to the LLM to generate a summary title of each session. */
1665 disableSessionTitles?: boolean;
1666 /** An optional token to identify a user. Not used by Continue unless you write custom coniguration that requires such a token */
1667 userToken?: string;
1668 /** The provider used to calculate embeddings. If left empty, Continue will use transformers.js to calculate the embeddings with all-MiniLM-L6-v2 */
1669 embeddingsProvider?: EmbeddingsProviderDescription | ILLM;
1670 /** The model that Continue will use for tab autocompletions. */
1671 tabAutocompleteModel?:
1672 | CustomLLM
1673 | JSONModelDescription
1674 | (CustomLLM | JSONModelDescription)[];
1675 /** Options for tab autocomplete */
1676 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1677 /** UI styles customization */
1678 ui?: ContinueUIConfig;
1679 /** Options for the reranker */
1680 reranker?: RerankerDescription | ILLM;
1681 /** Experimental configuration */
1682 experimental?: ExperimentalConfig;
1683 /** Analytics configuration */
1684 analytics?: AnalyticsConfig;
1685 docs?: SiteIndexingConfig[];
1686 data?: DataDestination[];
1687}
1688
1689// in the actual Continue source code
1690export interface ContinueConfig {
1691 allowAnonymousTelemetry?: boolean;
1692 // systemMessage?: string;
1693 completionOptions?: BaseCompletionOptions;
1694 requestOptions?: RequestOptions;
1695 slashCommands: SlashCommandWithSource[];
1696 contextProviders: IContextProvider[];
1697 disableSessionTitles?: boolean;
1698 disableIndexing?: boolean;
1699 userToken?: string;
1700 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1701 ui?: ContinueUIConfig;
1702 experimental?: ExperimentalConfig;
1703 analytics?: AnalyticsConfig;
1704 docs?: SiteIndexingConfig[];
1705 tools: Tool[];
1706 mcpServerStatuses: MCPServerStatus[];
1707 rules: RuleWithSource[];
1708 modelsByRole: Record<ModelRole, ILLM[]>;
1709 selectedModelByRole: Record<ModelRole, ILLM | null>;
1710 data?: DataDestination[];
1711}
1712
1713export interface BrowserSerializedContinueConfig {
1714 allowAnonymousTelemetry?: boolean;
1715 // systemMessage?: string;
1716 completionOptions?: BaseCompletionOptions;
1717 requestOptions?: RequestOptions;
1718 slashCommands: SlashCommandDescWithSource[];
1719 contextProviders: ContextProviderDescription[];
1720 disableIndexing?: boolean;
1721 disableSessionTitles?: boolean;
1722 userToken?: string;
1723 ui?: ContinueUIConfig;
1724 experimental?: ExperimentalConfig;
1725 analytics?: AnalyticsConfig;
1726 docs?: SiteIndexingConfig[];
1727 tools: Tool[];
1728 mcpServerStatuses: MCPServerStatus[];
1729 rules: RuleWithSource[];
1730 usePlatform: boolean;
1731 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1732 modelsByRole: Record<ModelRole, ModelDescription[]>;
1733 selectedModelByRole: Record<ModelRole, ModelDescription | null>;
1734}
1735
1736// DOCS SUGGESTIONS AND PACKAGE INFO
1737export interface FilePathAndName {
1738 path: string;
1739 name: string;
1740}
1741
1742export interface PackageFilePathAndName extends FilePathAndName {
1743 packageRegistry: string; // e.g. npm, pypi
1744}
1745
1746export type ParsedPackageInfo = {
1747 name: string;
1748 packageFile: PackageFilePathAndName;
1749 language: string;
1750 version: string;
1751};
1752
1753export type PackageDetails = {
1754 docsLink?: string;
1755 docsLinkWarning?: string;
1756 title?: string;
1757 description?: string;
1758 repo?: string;
1759 license?: string;
1760};
1761
1762export type PackageDetailsSuccess = PackageDetails & {
1763 docsLink: string;
1764};
1765
1766export type PackageDocsResult = {
1767 packageInfo: ParsedPackageInfo;
1768} & (
1769 | { error: string; details?: never }
1770 | { details: PackageDetailsSuccess; error?: never }
1771);
1772
1773export interface TerminalOptions {
1774 reuseTerminal?: boolean;
1775 terminalName?: string;
1776 waitForCompletion?: boolean;
1777}
1778
1779export type RuleSource =
1780 | "default-chat"
1781 | "default-plan"
1782 | "default-agent"
1783 | "model-options-chat"
1784 | "model-options-plan"
1785 | "model-options-agent"
1786 | "rules-block"
1787 | "colocated-markdown"
1788 | "json-systemMessage"
1789 | ".continuerules";
1790
1791export interface RuleWithSource {
1792 name?: string;
1793 slug?: string;
1794 source: RuleSource;
1795 globs?: string | string[];
1796 regex?: string | string[];
1797 rule: string;
1798 description?: string;
1799 ruleFile?: string;
1800 alwaysApply?: boolean;
1801}
1802export interface CompleteOnboardingPayload {
1803 mode: OnboardingModes;
1804 provider?: string;
1805 apiKey?: string;
1806}
1807
1808export interface CompiledMessagesResult {
1809 compiledChatMessages: ChatMessage[];
1810 didPrune: boolean;
1811 contextPercentage: number;
1812}
1813
1814export interface MessageOption {
1815 precompiled: boolean;
1816}
1817
1818/* LSP-specific interfaces. */
1819
1820// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind.
1821// We shift this one index down to match vscode.SymbolKind.
1822export enum SymbolKind {
1823 File = 0,
1824 Module = 1,
1825 Namespace = 2,
1826 Package = 3,
1827 Class = 4,
1828 Method = 5,
1829 Property = 6,
1830 Field = 7,
1831 Constructor = 8,
1832 Enum = 9,
1833 Interface = 10,
1834 Function = 11,
1835 Variable = 12,
1836 Constant = 13,
1837 String = 14,
1838 Number = 15,
1839 Boolean = 16,
1840 Array = 17,
1841 Object = 18,
1842 Key = 19,
1843 Null = 20,
1844 EnumMember = 21,
1845 Struct = 22,
1846 Event = 23,
1847 Operator = 24,
1848 TypeParameter = 25,
1849}
1850
1851// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag.
1852export namespace SymbolTag {
1853 export const Deprecated: 1 = 1;
1854}
1855
1856// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag.
1857export type SymbolTag = 1;
1858
1859// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentSymbol.
1860export interface DocumentSymbol {
1861 name: string;
1862 detail?: string;
1863 kind: SymbolKind;
1864 tags?: SymbolTag[];
1865 deprecated?: boolean;
1866 range: Range;
1867 selectionRange: Range;
1868 children?: DocumentSymbol[];
1869}