Elffuss BraidHub

kikocis/continue public

3ff29c567dd0 · 45.0 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";
176export type ContextIndexingType =
177 | "chunk"
178 | "embeddings"
179 | "fullTextSearch"
180 | "codeSnippets";
181
182export interface ContextProviderDescription {
183 title: ContextProviderName;
184 displayTitle: string;
185 description: string;
186 renderInlineAs?: string;
187 type: ContextProviderType;
188 dependsOnIndexing?: ContextIndexingType[];
189}
190
191export type FetchFunction = (url: string | URL, init?: any) => Promise<any>;
192
193export interface ContextProviderExtras {
194 config: ContinueConfig;
195 fullInput: string;
196 embeddingsProvider: ILLM | null;
197 reranker: ILLM | null;
198 llm: ILLM;
199 ide: IDE;
200 selectedCode: RangeInFile[];
201 fetch: FetchFunction;
202 isInAgentMode: boolean;
203}
204
205export interface LoadSubmenuItemsArgs {
206 config: ContinueConfig;
207 ide: IDE;
208 fetch: FetchFunction;
209}
210
211export interface CustomContextProvider {
212 title: string;
213 displayTitle?: string;
214 description?: string;
215 renderInlineAs?: string;
216 type?: ContextProviderType;
217 loadSubmenuItems?: (
218 args: LoadSubmenuItemsArgs,
219 ) => Promise<ContextSubmenuItem[]>;
220
221 getContextItems(
222 query: string,
223 extras: ContextProviderExtras,
224 ): Promise<ContextItem[]>;
225}
226
227export interface ContextSubmenuItem {
228 id: string;
229 title: string;
230 description: string;
231 icon?: string;
232 metadata?: any;
233}
234
235export interface ContextSubmenuItemWithProvider extends ContextSubmenuItem {
236 providerTitle: string;
237}
238
239export interface SiteIndexingConfig {
240 title: string;
241 startUrl: string;
242 maxDepth?: number;
243 faviconUrl?: string;
244 useLocalCrawling?: boolean;
245 sourceFile?: string;
246}
247
248export interface DocsIndexingDetails {
249 startUrl: string;
250 config: SiteIndexingConfig;
251 indexingStatus: IndexingStatus | undefined;
252 chunks: Chunk[];
253}
254
255export interface IContextProvider {
256 get description(): ContextProviderDescription;
257
258 getContextItems(
259 query: string,
260 extras: ContextProviderExtras,
261 ): Promise<ContextItem[]>;
262
263 loadSubmenuItems(args: LoadSubmenuItemsArgs): Promise<ContextSubmenuItem[]>;
264
265 get deprecationMessage(): string | null;
266}
267
268export interface Session {
269 sessionId: string;
270 title: string;
271 workspaceDirectory: string;
272 history: ChatHistoryItem[];
273}
274
275export interface BaseSessionMetadata {
276 sessionId: string;
277 title: string;
278 dateCreated: string;
279 workspaceDirectory: string;
280}
281
282export interface RangeInFile {
283 filepath: string;
284 range: Range;
285}
286
287export interface Location {
288 filepath: string;
289 position: Position;
290}
291
292export interface FileWithContents {
293 filepath: string;
294 contents: string;
295}
296
297export interface Range {
298 start: Position;
299 end: Position;
300}
301
302export interface Position {
303 line: number;
304 character: number;
305}
306
307export interface FileEdit {
308 filepath: string;
309 range: Range;
310 replacement: 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 prompt: string;
460 completion: string;
461}
462
463export type MessageModes = "chat" | "agent" | "plan";
464
465export type ToolStatus =
466 | "generating" // Tool call arguments are being streamed from the LLM
467 | "generated" // Tool call is complete and ready for execution (awaiting approval)
468 | "calling" // Tool is actively being executed
469 | "errored" // Tool execution failed with an error
470 | "done" // Tool execution completed successfully
471 | "canceled"; // Tool call was canceled by user or system
472
473// Will exist only on "assistant" messages with tool calls
474interface ToolCallState {
475 toolCallId: string;
476 toolCall: ToolCall;
477 status: ToolStatus;
478 parsedArgs: any;
479 output?: ContextItem[];
480 tool?: Tool;
481}
482
483interface Reasoning {
484 active: boolean;
485 text: string;
486 startAt: number;
487 endAt?: number;
488}
489
490export interface ChatHistoryItem {
491 message: ChatMessage;
492 contextItems: ContextItemWithId[];
493 editorState?: any;
494 modifiers?: InputModifiers;
495 promptLogs?: PromptLog[];
496 toolCallStates?: ToolCallState[];
497 isGatheringContext?: boolean;
498 reasoning?: Reasoning;
499 appliedRules?: RuleWithSource[];
500 conversationSummary?: string;
501}
502
503export interface LLMFullCompletionOptions extends BaseCompletionOptions {
504 log?: boolean;
505 model?: string;
506}
507
508export type ToastType = "info" | "error" | "warning";
509
510export interface LLMInteractionBase {
511 interactionId: string;
512 timestamp: number;
513}
514
515export interface LLMInteractionStartChat extends LLMInteractionBase {
516 kind: "startChat";
517 messages: ChatMessage[];
518 options: CompletionOptions;
519 provider: string;
520}
521
522export interface LLMInteractionStartComplete extends LLMInteractionBase {
523 kind: "startComplete";
524 prompt: string;
525 options: CompletionOptions;
526 provider: string;
527}
528
529export interface LLMInteractionStartFim extends LLMInteractionBase {
530 kind: "startFim";
531 prefix: string;
532 suffix: string;
533 options: CompletionOptions;
534 provider: string;
535}
536
537export interface LLMInteractionChunk extends LLMInteractionBase {
538 kind: "chunk";
539 chunk: string;
540}
541
542export interface LLMInteractionMessage extends LLMInteractionBase {
543 kind: "message";
544 message: ChatMessage;
545}
546
547export interface LLMInteractionEnd extends LLMInteractionBase {
548 promptTokens: number;
549 generatedTokens: number;
550 thinkingTokens: number;
551 usage: Usage | undefined;
552}
553
554export interface LLMInteractionSuccess extends LLMInteractionEnd {
555 kind: "success";
556}
557
558export interface LLMInteractionCancel extends LLMInteractionEnd {
559 kind: "cancel";
560}
561
562export interface LLMInteractionError extends LLMInteractionEnd {
563 kind: "error";
564 name: string;
565 message: string;
566}
567
568export type LLMInteractionItem =
569 | LLMInteractionStartChat
570 | LLMInteractionStartComplete
571 | LLMInteractionStartFim
572 | LLMInteractionChunk
573 | LLMInteractionMessage
574 | LLMInteractionSuccess
575 | LLMInteractionCancel
576 | LLMInteractionError;
577
578// When we log a LLM interaction, we want to add the interactionId and timestamp
579// in the logger code, so we need a type that omits these members from *each*
580// member of the union. This can be done by using the distributive behavior of
581// conditional types in Typescript.
582//
583// www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
584// https://stackoverflow.com/questions/57103834/typescript-omit-a-property-from-all-interfaces-in-a-union-but-keep-the-union-s
585type DistributiveOmit<T, K extends PropertyKey> = T extends unknown
586 ? Omit<T, K>
587 : never;
588
589export type LLMInteractionItemDetails = DistributiveOmit<
590 LLMInteractionItem,
591 "interactionId" | "timestamp"
592>;
593
594export interface ILLMInteractionLog {
595 logItem(item: LLMInteractionItemDetails): void;
596}
597
598export interface ILLMLogger {
599 createInteractionLog(): ILLMInteractionLog;
600}
601
602export interface LLMOptions {
603 model: string;
604
605 title?: string;
606 uniqueId?: string;
607 baseAgentSystemMessage?: string;
608 basePlanSystemMessage?: string;
609 baseChatSystemMessage?: string;
610 autocompleteOptions?: Partial<TabAutocompleteOptions>;
611 contextLength?: number;
612 maxStopWords?: number;
613 completionOptions?: CompletionOptions;
614 requestOptions?: RequestOptions;
615 template?: TemplateType;
616 promptTemplates?: Partial<Record<keyof PromptTemplates, PromptTemplate>>;
617 templateMessages?: (messages: ChatMessage[]) => string;
618 logger?: ILLMLogger;
619 llmRequestHook?: (model: string, prompt: string) => any;
620 apiKey?: string;
621
622 // continueProperties
623 apiKeyLocation?: string;
624 envSecretLocations?: Record<string, string>;
625 apiBase?: string;
626 orgScopeId?: string | null;
627
628 onPremProxyUrl?: string | null;
629
630 aiGatewaySlug?: string;
631 cacheBehavior?: CacheBehavior;
632 capabilities?: ModelCapability;
633 roles?: ModelRole[];
634
635 useLegacyCompletionsEndpoint?: boolean;
636
637 // Embedding options
638 embeddingId?: string;
639 maxEmbeddingChunkSize?: number;
640 maxEmbeddingBatchSize?: number;
641
642 // Cloudflare options
643 accountId?: string;
644
645 // Azure options
646 deployment?: string;
647 apiVersion?: string;
648 apiType?: string;
649
650 // AWS options
651 profile?: string;
652 modelArn?: string;
653 accessKeyId?: string;
654 secretAccessKey?: string;
655
656 // AWS and VertexAI Options
657 region?: string;
658
659 // VertexAI and Watsonx Options
660 projectId?: string;
661
662 // IBM watsonx Options
663 deploymentId?: string;
664
665 env?: Record<string, string | number | boolean>;
666
667 sourceFile?: string;
668 isFromAutoDetect?: boolean;
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 getExternalUri?(uri: string): Promise<string>;
823
824 runCommand(command: string, options?: TerminalOptions): Promise<void>;
825
826 saveFile(fileUri: string): Promise<void>;
827
828 readFile(fileUri: string): Promise<string>;
829
830 readRangeInFile(fileUri: string, range: Range): Promise<string>;
831
832 showLines(fileUri: string, startLine: number, endLine: number): Promise<void>;
833
834 getOpenFiles(): Promise<string[]>;
835
836 getCurrentFile(): Promise<
837 | undefined
838 | {
839 isUntitled: boolean;
840 path: string;
841 contents: string;
842 }
843 >;
844
845 getPinnedFiles(): Promise<string[]>;
846
847 getSearchResults(query: string, maxResults?: number): Promise<string>;
848
849 getFileResults(pattern: string, maxResults?: number): Promise<string[]>;
850
851 subprocess(command: string, cwd?: string): Promise<[string, string]>;
852
853 getProblems(fileUri?: string | undefined): Promise<Problem[]>;
854
855 getBranch(dir: string): Promise<string>;
856
857 getTags(artifactId: string): Promise<IndexTag[]>;
858
859 getRepoName(dir: string): Promise<string | undefined>;
860
861 showToast(
862 type: ToastType,
863 message: string,
864 ...otherParams: any[]
865 ): Promise<any>;
866
867 getGitRootPath(dir: string): Promise<string | undefined>;
868
869 listDir(dir: string): Promise<[string, FileType][]>;
870
871 getFileStats(files: string[]): Promise<FileStatsMap>;
872
873 // Secret Storage
874 readSecrets(keys: string[]): Promise<Record<string, string>>;
875
876 writeSecrets(secrets: { [key: string]: string }): Promise<void>;
877
878 // LSP
879 gotoDefinition(location: Location): Promise<RangeInFile[]>;
880 gotoTypeDefinition(location: Location): Promise<RangeInFile[]>; // TODO: add to jetbrains
881 getSignatureHelp(location: Location): Promise<SignatureHelp | null>; // TODO: add to jetbrains
882 getReferences(location: Location): Promise<RangeInFile[]>;
883 getDocumentSymbols(textDocumentIdentifier: string): Promise<DocumentSymbol[]>;
884
885 // Callbacks
886 onDidChangeActiveTextEditor(callback: (fileUri: string) => void): void;
887}
888
889// Slash Commands
890
891export interface ContinueSDK {
892 ide: IDE;
893 llm: ILLM;
894 addContextItem: (item: ContextItemWithId) => void;
895 history: ChatMessage[];
896 input: string;
897 params?: { [key: string]: any } | undefined;
898 contextItems: ContextItemWithId[];
899 selectedCode: RangeInFile[];
900 config: ContinueConfig;
901 fetch: FetchFunction;
902 completionOptions?: LLMFullCompletionOptions;
903 abortController: AbortController;
904}
905
906/* Be careful changing SlashCommand or SlashCommandDescription, config.ts can break */
907export interface SlashCommandDescription {
908 name: string;
909 description: string;
910 prompt?: string;
911 params?: { [key: string]: any };
912}
913
914export interface SlashCommand extends SlashCommandDescription {
915 run: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>;
916}
917
918export interface SlashCommandWithSource extends SlashCommandDescription {
919 run?: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>; // Optional - only needed for legacy
920 source: SlashCommandSource;
921 promptFile?: string;
922 overrideSystemMessage?: string;
923}
924
925export type SlashCommandSource =
926 | "built-in-legacy"
927 | "built-in"
928 | "json-custom-command"
929 | "config-ts-slash-command"
930 | "yaml-prompt-block"
931 | "mcp-prompt"
932 | "prompt-file-v1"
933 | "prompt-file-v2"
934 | "invokable-rule";
935
936export interface SlashCommandDescWithSource extends SlashCommandDescription {
937 isLegacy: boolean; // Maps to if slashcommand.run exists
938 source: SlashCommandSource;
939 promptFile?: string;
940 mcpServerName?: string;
941 mcpArgs?: MCPPromptArgs;
942}
943
944// Config
945
946export type StepName =
947 | "AnswerQuestionChroma"
948 | "GenerateShellCommandStep"
949 | "EditHighlightedCodeStep"
950 | "ShareSessionStep"
951 | "CommentCodeStep"
952 | "ClearHistoryStep"
953 | "StackOverflowStep"
954 | "OpenConfigStep"
955 | "GenerateShellCommandStep"
956 | "DraftIssueStep";
957
958export type ContextProviderName =
959 | "diff"
960 | "terminal"
961 | "debugger"
962 | "open"
963 | "google"
964 | "search"
965 | "tree"
966 | "http"
967 | "codebase"
968 | "problems"
969 | "folder"
970 | "jira"
971 | "postgres"
972 | "database"
973 | "code"
974 | "docs"
975 | "gitlab-mr"
976 | "os"
977 | "currentFile"
978 | "greptile"
979 | "outline"
980 | "continue-proxy"
981 | "highlights"
982 | "file"
983 | "issue"
984 | "repo-map"
985 | "url"
986 | "commit"
987 | "web"
988 | "discord"
989 | "clipboard"
990 | string;
991
992export type TemplateType =
993 | "llama2"
994 | "alpaca"
995 | "zephyr"
996 | "phi2"
997 | "phind"
998 | "anthropic"
999 | "chatml"
1000 | "none"
1001 | "openchat"
1002 | "deepseek"
1003 | "xwin-coder"
1004 | "neural-chat"
1005 | "codellama-70b"
1006 | "llava"
1007 | "gemma"
1008 | "granite"
1009 | "llama3"
1010 | "codestral";
1011
1012export interface RequestOptions {
1013 timeout?: number;
1014 verifySsl?: boolean;
1015 caBundlePath?: string | string[];
1016 proxy?: string;
1017 headers?: { [key: string]: string };
1018 extraBodyProperties?: { [key: string]: any };
1019 noProxy?: string[];
1020 clientCertificate?: ClientCertificateOptions;
1021}
1022
1023export interface CacheBehavior {
1024 cacheSystemMessage?: boolean;
1025 cacheConversation?: boolean;
1026}
1027
1028export interface ClientCertificateOptions {
1029 cert: string;
1030 key: string;
1031 passphrase?: string;
1032}
1033
1034export interface StepWithParams {
1035 name: StepName;
1036 params: { [key: string]: any };
1037}
1038
1039export interface ContextProviderWithParams {
1040 name: ContextProviderName;
1041 params: { [key: string]: any };
1042}
1043
1044export interface CustomCommand {
1045 name: string;
1046 prompt: string;
1047 description?: string;
1048 sourceFile?: string;
1049}
1050
1051export interface Prediction {
1052 type: "content";
1053 content:
1054 | string
1055 | {
1056 type: "text";
1057 text: string;
1058 }[];
1059}
1060
1061export interface ToolExtras {
1062 ide: IDE;
1063 llm: ILLM;
1064 fetch: FetchFunction;
1065 tool: Tool;
1066 toolCallId?: string;
1067 onPartialOutput?: (params: {
1068 toolCallId: string;
1069 contextItems: ContextItem[];
1070 }) => void;
1071 config: ContinueConfig;
1072 codeBaseIndexer?: CodebaseIndexer;
1073}
1074
1075export interface Tool {
1076 type: "function";
1077 function: {
1078 name: string;
1079 description?: string;
1080 parameters?: Record<string, any>;
1081 strict?: boolean | null;
1082 };
1083
1084 displayTitle: string;
1085 wouldLikeTo?: string;
1086 isCurrently?: string;
1087 hasAlready?: string;
1088 readonly: boolean;
1089 isInstant?: boolean;
1090 uri?: string;
1091 faviconUrl?: string;
1092 group: string;
1093 originalFunctionName?: string;
1094 systemMessageDescription?: {
1095 prefix: string;
1096 exampleArgs?: Array<[string, string | number]>;
1097 };
1098 defaultToolPolicy?: ToolPolicy;
1099 toolCallIcon?: string;
1100 evaluateToolCallPolicy?: (
1101 basePolicy: ToolPolicy,
1102 parsedArgs: Record<string, unknown>,
1103 ) => ToolPolicy;
1104}
1105
1106interface ToolChoice {
1107 type: "function";
1108 function: {
1109 name: string;
1110 };
1111}
1112
1113export interface ConfigDependentToolParams {
1114 rules: RuleWithSource[];
1115 enableExperimentalTools: boolean;
1116 isSignedIn: boolean;
1117 isRemote: boolean;
1118 modelName: string | undefined;
1119}
1120
1121export type GetTool = (params: ConfigDependentToolParams) => Tool;
1122
1123export interface BaseCompletionOptions {
1124 temperature?: number;
1125 topP?: number;
1126 topK?: number;
1127 minP?: number;
1128 presencePenalty?: number;
1129 frequencyPenalty?: number;
1130 mirostat?: number;
1131 stop?: string[];
1132 maxTokens?: number;
1133 numThreads?: number;
1134 useMmap?: boolean;
1135 keepAlive?: number;
1136 numGpu?: number;
1137 raw?: boolean;
1138 stream?: boolean;
1139 prediction?: Prediction;
1140 tools?: Tool[];
1141 toolChoice?: ToolChoice;
1142 reasoning?: boolean;
1143 reasoningBudgetTokens?: number;
1144 promptCaching?: boolean;
1145}
1146
1147export interface ModelCapability {
1148 uploadImage?: boolean;
1149 tools?: boolean;
1150 nextEdit?: boolean;
1151}
1152
1153export interface ModelDescription {
1154 title: string;
1155 provider: string;
1156 underlyingProviderName: string;
1157 model: string;
1158 apiKey?: string;
1159
1160 apiBase?: string;
1161 apiKeyLocation?: string;
1162 envSecretLocations?: Record<string, string>;
1163 orgScopeId?: string | null;
1164
1165 onPremProxyUrl?: string | null;
1166
1167 contextLength?: number;
1168 maxStopWords?: number;
1169 template?: TemplateType;
1170 completionOptions?: BaseCompletionOptions;
1171 baseAgentSystemMessage?: string;
1172 basePlanSystemMessage?: string;
1173 baseChatSystemMessage?: string;
1174 requestOptions?: RequestOptions;
1175 promptTemplates?: { [key: string]: string };
1176 cacheBehavior?: CacheBehavior;
1177 capabilities?: ModelCapability;
1178 roles?: ModelRole[];
1179 configurationStatus?: LLMConfigurationStatuses;
1180
1181 sourceFile?: string;
1182 isFromAutoDetect?: boolean;
1183}
1184
1185export interface JSONEmbedOptions {
1186 apiBase?: string;
1187 apiKey?: string;
1188 model?: string;
1189 deployment?: string;
1190 apiType?: string;
1191 apiVersion?: string;
1192 requestOptions?: RequestOptions;
1193 maxEmbeddingChunkSize?: number;
1194 maxEmbeddingBatchSize?: number;
1195
1196 // AWS options
1197 profile?: string;
1198
1199 // AWS and VertexAI Options
1200 region?: string;
1201
1202 // VertexAI and Watsonx Options
1203 projectId?: string;
1204}
1205
1206export interface EmbeddingsProviderDescription extends JSONEmbedOptions {
1207 provider: string;
1208}
1209
1210export interface RerankerDescription {
1211 name: string;
1212 params?: { [key: string]: any };
1213}
1214
1215// TODO: We should consider renaming this to AutocompleteOptions.
1216export interface TabAutocompleteOptions {
1217 disable: boolean;
1218 maxPromptTokens: number;
1219 debounceDelay: number;
1220 modelTimeout: number;
1221 maxSuffixPercentage: number;
1222 prefixPercentage: number;
1223 transform?: boolean;
1224 template?: string;
1225 multilineCompletions: "always" | "never" | "auto";
1226 slidingWindowPrefixPercentage: number;
1227 slidingWindowSize: number;
1228 useCache: boolean;
1229 onlyMyCode: boolean;
1230 useRecentlyEdited: boolean;
1231 useRecentlyOpened: boolean;
1232 disableInFiles?: string[];
1233 useImports?: boolean;
1234 showWhateverWeHaveAtXMs?: number;
1235 // true = enabled, false = disabled, number = enabled with priority
1236 experimental_includeClipboard: boolean | number;
1237 experimental_includeRecentlyVisitedRanges: boolean | number;
1238 experimental_includeRecentlyEditedRanges: boolean | number;
1239 experimental_includeDiff: boolean | number;
1240 experimental_enableStaticContextualization: boolean;
1241}
1242
1243export interface StdioOptions {
1244 type: "stdio";
1245 command: string;
1246 args: string[];
1247 env?: Record<string, string>;
1248 cwd?: string;
1249 requestOptions?: RequestOptions;
1250}
1251
1252export interface WebSocketOptions {
1253 type: "websocket";
1254 url: string;
1255 requestOptions?: RequestOptions;
1256}
1257
1258export interface SSEOptions {
1259 type: "sse";
1260 url: string;
1261 requestOptions?: RequestOptions;
1262}
1263
1264export interface StreamableHTTPOptions {
1265 type: "streamable-http";
1266 url: string;
1267 requestOptions?: RequestOptions;
1268}
1269
1270export type TransportOptions =
1271 | StdioOptions
1272 | WebSocketOptions
1273 | SSEOptions
1274 | StreamableHTTPOptions;
1275
1276export interface MCPOptions {
1277 name: string;
1278 id: string;
1279 transport: TransportOptions;
1280 faviconUrl?: string;
1281 timeout?: number;
1282 requestOptions?: RequestOptions;
1283}
1284
1285export type MCPConnectionStatus =
1286 | "connecting"
1287 | "connected"
1288 | "error"
1289 | "authenticating"
1290 | "not-connected";
1291
1292export type MCPPromptArgs = {
1293 name: string;
1294 description?: string;
1295 required?: boolean;
1296}[];
1297
1298export interface MCPPrompt {
1299 name: string;
1300 description?: string;
1301 arguments?: MCPPromptArgs;
1302}
1303
1304// Leaving here to ideate on
1305// export type ContinueConfigSource = "local-yaml" | "local-json" | "hub-assistant" | "hub"
1306
1307// https://modelcontextprotocol.io/docs/concepts/resources#direct-resources
1308export interface MCPResource {
1309 name: string;
1310 uri: string;
1311 description?: string;
1312 mimeType?: string;
1313}
1314
1315// https://modelcontextprotocol.io/docs/concepts/resources#resource-templates
1316export interface MCPResourceTemplate {
1317 uriTemplate: string;
1318 name: string;
1319 description?: string;
1320 mimeType?: string;
1321}
1322
1323export interface MCPTool {
1324 name: string;
1325 description?: string;
1326 inputSchema: {
1327 type: "object";
1328 properties?: Record<string, any>;
1329 };
1330}
1331
1332export interface MCPServerStatus extends MCPOptions {
1333 status: MCPConnectionStatus;
1334 errors: string[];
1335 infos: string[];
1336 isProtectedResource: boolean;
1337
1338 prompts: MCPPrompt[];
1339 tools: MCPTool[];
1340 resources: MCPResource[];
1341 resourceTemplates: MCPResourceTemplate[];
1342 sourceFile?: string;
1343}
1344
1345export interface ContinueUIConfig {
1346 codeBlockToolbarPosition?: "top" | "bottom";
1347 fontSize?: number;
1348 displayRawMarkdown?: boolean;
1349 showChatScrollbar?: boolean;
1350 codeWrap?: boolean;
1351 showSessionTabs?: boolean;
1352 autoAcceptEditToolDiffs?: boolean;
1353 continueAfterToolRejection?: boolean;
1354}
1355
1356export interface ContextMenuConfig {
1357 comment?: string;
1358 docstring?: string;
1359 fix?: string;
1360 optimize?: string;
1361 fixGrammar?: string;
1362}
1363
1364export interface ExperimentalModelRoles {
1365 repoMapFileSelection?: string;
1366 inlineEdit?: string;
1367 applyCodeBlock?: string;
1368}
1369
1370export interface ExperimentalMCPOptions {
1371 transport: TransportOptions;
1372 faviconUrl?: string;
1373 timeout?: number;
1374}
1375
1376export type ApplyStateStatus =
1377 | "not-started" // Apply state created but not necessarily streaming
1378 | "streaming" // Changes are being applied to the file
1379 | "done" // All changes have been applied, awaiting user to accept/reject
1380 | "closed"; // All changes have been applied. Note that for new files, we immediately set the status to "closed"
1381
1382export interface ApplyState {
1383 streamId: string;
1384 status?: ApplyStateStatus;
1385 numDiffs?: number;
1386 filepath?: string;
1387 fileContent?: string;
1388 originalFileContent?: string;
1389 toolCallId?: string;
1390 autoFormattingDiff?: string;
1391}
1392
1393export type StreamDiffLinesType = "edit" | "apply";
1394interface StreamDiffLinesOptionsBase {
1395 type: StreamDiffLinesType;
1396 prefix: string;
1397 highlighted: string;
1398 suffix: string;
1399 input: string;
1400 language: string | undefined;
1401 modelTitle: string | undefined;
1402 includeRulesInSystemMessage: boolean;
1403 fileUri?: string;
1404}
1405
1406interface StreamDiffLinesOptionsEdit extends StreamDiffLinesOptionsBase {
1407 type: "edit";
1408}
1409
1410interface StreamDiffLinesOptionsApply extends StreamDiffLinesOptionsBase {
1411 type: "apply";
1412 newCode: string;
1413}
1414
1415type StreamDiffLinesPayload =
1416 | StreamDiffLinesOptionsApply
1417 | StreamDiffLinesOptionsEdit;
1418
1419export interface HighlightedCodePayload {
1420 rangeInFileWithContents: RangeInFileWithContents;
1421 prompt?: string;
1422 shouldRun?: boolean;
1423}
1424
1425export interface AcceptOrRejectDiffPayload {
1426 filepath?: string;
1427 streamId?: string;
1428}
1429
1430export interface ShowFilePayload {
1431 filepath: string;
1432}
1433
1434export interface ApplyToFilePayload {
1435 streamId: string;
1436 filepath?: string;
1437 text: string;
1438 toolCallId?: string;
1439 isSearchAndReplace?: boolean;
1440}
1441
1442export interface RangeInFileWithContents {
1443 filepath: string;
1444 range: {
1445 start: { line: number; character: number };
1446 end: { line: number; character: number };
1447 };
1448 contents: string;
1449}
1450
1451export interface RangeInFileWithNextEditInfo {
1452 filepath: string;
1453 range: Range;
1454 fileContents: string;
1455 editText: string;
1456 afterCursorPos: Position;
1457 beforeCursorPos: Position;
1458 workspaceDir: string;
1459}
1460
1461export type SetCodeToEditPayload = RangeInFileWithContents | FileWithContents;
1462
1463/**
1464 * Signature help represents the signature of something
1465 * callable. There can be multiple signatures but only one
1466 * active and only one active parameter.
1467 */
1468export class SignatureHelp {
1469 /**
1470 * One or more signatures.
1471 */
1472 signatures: SignatureInformation[];
1473
1474 /**
1475 * The active signature.
1476 */
1477 activeSignature: number;
1478
1479 /**
1480 * The active parameter of the active signature.
1481 */
1482 activeParameter: number;
1483}
1484
1485/**
1486 * Represents the signature of something callable. A signature
1487 * can have a label, like a function-name, a doc-comment, and
1488 * a set of parameters.
1489 */
1490export class SignatureInformation {
1491 /**
1492 * The label of this signature. Will be shown in
1493 * the UI.
1494 */
1495 label: string;
1496
1497 /**
1498 * The parameters of this signature.
1499 */
1500 parameters: ParameterInformation[];
1501
1502 /**
1503 * The index of the active parameter.
1504 *
1505 * If provided, this is used in place of {@linkcode SignatureHelp.activeParameter}.
1506 */
1507 activeParameter?: number;
1508}
1509
1510/**
1511 * Represents a parameter of a callable-signature. A parameter can
1512 * have a label and a doc-comment.
1513 */
1514export class ParameterInformation {
1515 /**
1516 * The label of this signature.
1517 *
1518 * Either a string or inclusive start and exclusive end offsets within its containing
1519 * {@link SignatureInformation.label signature label}. *Note*: A label of type string must be
1520 * a substring of its containing signature information's {@link SignatureInformation.label label}.
1521 */
1522 label: string | [number, number];
1523}
1524
1525/**
1526 * Represents the configuration for a quick action in the Code Lens.
1527 * Quick actions are custom commands that can be added to function and class declarations.
1528 */
1529export interface QuickActionConfig {
1530 /**
1531 * The title of the quick action that will display in the Code Lens.
1532 */
1533 title: string;
1534
1535 /**
1536 * The prompt that will be sent to the model when the quick action is invoked,
1537 * with the function or class body concatenated.
1538 */
1539 prompt: string;
1540
1541 /**
1542 * If `true`, the result of the quick action will be sent to the chat panel.
1543 * If `false`, the streamed result will be inserted into the document.
1544 *
1545 * Defaults to `false`.
1546 */
1547 sendToChat: boolean;
1548}
1549
1550export type DefaultContextProvider = ContextProviderWithParams & {
1551 query?: string;
1552};
1553
1554export interface ExperimentalConfig {
1555 contextMenuPrompts?: ContextMenuConfig;
1556 modelRoles?: ExperimentalModelRoles;
1557 defaultContext?: DefaultContextProvider[];
1558 promptPath?: string;
1559 enableExperimentalTools?: boolean;
1560 onlyUseSystemMessageTools?: boolean;
1561
1562 /**
1563 * Quick actions are a way to add custom commands to the Code Lens of
1564 * function and class declarations.
1565 */
1566 quickActions?: QuickActionConfig[];
1567
1568 /**
1569 * Automatically read LLM chat responses aloud using system TTS models
1570 */
1571 readResponseTTS?: boolean;
1572
1573 /**
1574 * If set to true, we will attempt to pull down and install an instance of Chromium
1575 * that is compatible with the current version of Puppeteer.
1576 * This is needed to crawl a large number of documentation sites that are dynamically rendered.
1577 */
1578 useChromiumForDocsCrawling?: boolean;
1579 modelContextProtocolServers?: ExperimentalMCPOptions[];
1580
1581 /**
1582 * If enabled, will add the current file as context.
1583 */
1584 useCurrentFileAsContext?: boolean;
1585
1586 /**
1587 * If enabled, @codebase will only use tool calling
1588 * instead of embeddings, FTS, recently edited files, etc.
1589 */
1590 codebaseToolCallingOnly?: boolean;
1591
1592 /**
1593 * If enabled, static contextualization will be used to
1594 * gather context for the model where necessary.
1595 */
1596 enableStaticContextualization?: boolean;
1597}
1598
1599export interface AnalyticsConfig {
1600 provider: string;
1601 url?: string;
1602 clientKey?: string;
1603}
1604
1605export interface JSONModelDescription {
1606 title: string;
1607 provider: string;
1608 underlyingProviderName: string;
1609 model: string;
1610 apiKey?: string;
1611 apiBase?: string;
1612
1613 contextLength?: number;
1614 maxStopWords?: number;
1615 template?: TemplateType;
1616 completionOptions?: BaseCompletionOptions;
1617 systemMessage?: string;
1618 requestOptions?: RequestOptions;
1619 cacheBehavior?: CacheBehavior;
1620
1621 region?: string;
1622 profile?: string;
1623 modelArn?: string;
1624 apiType?: "openai" | "azure";
1625 apiVersion?: string;
1626 deployment?: string;
1627 projectId?: string;
1628 accountId?: string;
1629 aiGatewaySlug?: string;
1630 useLegacyCompletionsEndpoint?: boolean;
1631 deploymentId?: string;
1632 isFromAutoDetect?: boolean;
1633}
1634
1635// config.json
1636export interface SerializedContinueConfig {
1637 env?: string[];
1638 allowAnonymousTelemetry?: boolean;
1639 models: JSONModelDescription[];
1640 systemMessage?: string;
1641 completionOptions?: BaseCompletionOptions;
1642 requestOptions?: RequestOptions;
1643 slashCommands?: SlashCommandDescription[];
1644 customCommands?: CustomCommand[];
1645 contextProviders?: ContextProviderWithParams[];
1646 disableIndexing?: boolean;
1647 disableSessionTitles?: boolean;
1648 userToken?: string;
1649 embeddingsProvider?: EmbeddingsProviderDescription;
1650 tabAutocompleteModel?: JSONModelDescription | JSONModelDescription[];
1651 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1652 ui?: ContinueUIConfig;
1653 reranker?: RerankerDescription;
1654 experimental?: ExperimentalConfig;
1655 analytics?: AnalyticsConfig;
1656 docs?: SiteIndexingConfig[];
1657 data?: DataDestination[];
1658}
1659
1660export type ConfigMergeType = "merge" | "overwrite";
1661
1662export type ContinueRcJson = Partial<SerializedContinueConfig> & {
1663 mergeBehavior: ConfigMergeType;
1664};
1665
1666// config.ts - give users simplified interfaces
1667export interface Config {
1668 /** 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 */
1669 allowAnonymousTelemetry?: boolean;
1670 /** Each entry in this array will originally be a JSONModelDescription, the same object from your config.json, but you may add CustomLLMs.
1671 * 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).
1672 * Continue will do the rest of the work to construct prompt templates, handle context items, prune context, etc.
1673 */
1674 models: (CustomLLM | JSONModelDescription)[];
1675 /** A system message to be followed by all of your models */
1676 systemMessage?: string;
1677 /** The default completion options for all models */
1678 completionOptions?: BaseCompletionOptions;
1679 /** Request options that will be applied to all models and context providers */
1680 requestOptions?: RequestOptions;
1681 /** The list of slash commands that will be available in the sidebar */
1682 slashCommands?: (SlashCommand | SlashCommandWithSource)[];
1683 /** Each entry in this array will originally be a ContextProviderWithParams, the same object from your config.json, but you may add CustomContextProviders.
1684 * A CustomContextProvider requires you only to define a title and getContextItems function. When you type '@title <query>', Continue will call `getContextItems(query)`.
1685 */
1686 contextProviders?: (CustomContextProvider | ContextProviderWithParams)[];
1687 /** If set to true, Continue will not index your codebase for retrieval */
1688 disableIndexing?: boolean;
1689 /** If set to true, Continue will not make extra requests to the LLM to generate a summary title of each session. */
1690 disableSessionTitles?: boolean;
1691 /** An optional token to identify a user. Not used by Continue unless you write custom coniguration that requires such a token */
1692 userToken?: string;
1693 /** The provider used to calculate embeddings. If left empty, Continue will use transformers.js to calculate the embeddings with all-MiniLM-L6-v2 */
1694 embeddingsProvider?: EmbeddingsProviderDescription | ILLM;
1695 /** The model that Continue will use for tab autocompletions. */
1696 tabAutocompleteModel?:
1697 | CustomLLM
1698 | JSONModelDescription
1699 | (CustomLLM | JSONModelDescription)[];
1700 /** Options for tab autocomplete */
1701 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1702 /** UI styles customization */
1703 ui?: ContinueUIConfig;
1704 /** Options for the reranker */
1705 reranker?: RerankerDescription | ILLM;
1706 /** Experimental configuration */
1707 experimental?: ExperimentalConfig;
1708 /** Analytics configuration */
1709 analytics?: AnalyticsConfig;
1710 docs?: SiteIndexingConfig[];
1711 data?: DataDestination[];
1712}
1713
1714// in the actual Continue source code
1715export interface ContinueConfig {
1716 allowAnonymousTelemetry?: boolean;
1717 // systemMessage?: string;
1718 completionOptions?: BaseCompletionOptions;
1719 requestOptions?: RequestOptions;
1720 slashCommands: SlashCommandWithSource[];
1721 contextProviders: IContextProvider[];
1722 disableSessionTitles?: boolean;
1723 disableIndexing?: boolean;
1724 userToken?: string;
1725 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1726 ui?: ContinueUIConfig;
1727 experimental?: ExperimentalConfig;
1728 analytics?: AnalyticsConfig;
1729 docs?: SiteIndexingConfig[];
1730 tools: Tool[];
1731 mcpServerStatuses: MCPServerStatus[];
1732 rules: RuleWithSource[];
1733 modelsByRole: Record<ModelRole, ILLM[]>;
1734 selectedModelByRole: Record<ModelRole, ILLM | null>;
1735 data?: DataDestination[];
1736}
1737
1738export interface BrowserSerializedContinueConfig {
1739 allowAnonymousTelemetry?: boolean;
1740 // systemMessage?: string;
1741 completionOptions?: BaseCompletionOptions;
1742 requestOptions?: RequestOptions;
1743 slashCommands: SlashCommandDescWithSource[];
1744 contextProviders: ContextProviderDescription[];
1745 disableIndexing?: boolean;
1746 disableSessionTitles?: boolean;
1747 userToken?: string;
1748 ui?: ContinueUIConfig;
1749 experimental?: ExperimentalConfig;
1750 analytics?: AnalyticsConfig;
1751 docs?: SiteIndexingConfig[];
1752 tools: Tool[];
1753 mcpServerStatuses: MCPServerStatus[];
1754 rules: RuleWithSource[];
1755 usePlatform: boolean;
1756 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1757 modelsByRole: Record<ModelRole, ModelDescription[]>;
1758 selectedModelByRole: Record<ModelRole, ModelDescription | null>;
1759}
1760
1761// DOCS SUGGESTIONS AND PACKAGE INFO
1762export interface FilePathAndName {
1763 path: string;
1764 name: string;
1765}
1766
1767export interface PackageFilePathAndName extends FilePathAndName {
1768 packageRegistry: string; // e.g. npm, pypi
1769}
1770
1771export type ParsedPackageInfo = {
1772 name: string;
1773 packageFile: PackageFilePathAndName;
1774 language: string;
1775 version: string;
1776};
1777
1778export type PackageDetails = {
1779 docsLink?: string;
1780 docsLinkWarning?: string;
1781 title?: string;
1782 description?: string;
1783 repo?: string;
1784 license?: string;
1785};
1786
1787export type PackageDetailsSuccess = PackageDetails & {
1788 docsLink: string;
1789};
1790
1791export type PackageDocsResult = {
1792 packageInfo: ParsedPackageInfo;
1793} & (
1794 | { error: string; details?: never }
1795 | { details: PackageDetailsSuccess; error?: never }
1796);
1797
1798export interface TerminalOptions {
1799 reuseTerminal?: boolean;
1800 terminalName?: string;
1801 waitForCompletion?: boolean;
1802}
1803
1804export type RuleSource =
1805 | "default-chat"
1806 | "default-plan"
1807 | "default-agent"
1808 | "model-options-chat"
1809 | "model-options-plan"
1810 | "model-options-agent"
1811 | "rules-block"
1812 | "colocated-markdown"
1813 | "json-systemMessage"
1814 | ".continuerules"
1815 | "agent-file";
1816
1817export interface RuleWithSource {
1818 name?: string;
1819 slug?: string;
1820 source: RuleSource;
1821 globs?: string | string[];
1822 regex?: string | string[];
1823 rule: string;
1824 description?: string;
1825 ruleFile?: string;
1826 alwaysApply?: boolean;
1827 invokable?: boolean;
1828}
1829export interface CompleteOnboardingPayload {
1830 mode: OnboardingModes;
1831 provider?: string;
1832 apiKey?: string;
1833}
1834
1835export interface CompiledMessagesResult {
1836 compiledChatMessages: ChatMessage[];
1837 didPrune: boolean;
1838 contextPercentage: number;
1839}
1840
1841export interface MessageOption {
1842 precompiled: boolean;
1843}
1844
1845/* LSP-specific interfaces. */
1846
1847// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind.
1848// We shift this one index down to match vscode.SymbolKind.
1849export enum SymbolKind {
1850 File = 0,
1851 Module = 1,
1852 Namespace = 2,
1853 Package = 3,
1854 Class = 4,
1855 Method = 5,
1856 Property = 6,
1857 Field = 7,
1858 Constructor = 8,
1859 Enum = 9,
1860 Interface = 10,
1861 Function = 11,
1862 Variable = 12,
1863 Constant = 13,
1864 String = 14,
1865 Number = 15,
1866 Boolean = 16,
1867 Array = 17,
1868 Object = 18,
1869 Key = 19,
1870 Null = 20,
1871 EnumMember = 21,
1872 Struct = 22,
1873 Event = 23,
1874 Operator = 24,
1875 TypeParameter = 25,
1876}
1877
1878// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag.
1879export namespace SymbolTag {
1880 export const Deprecated: 1 = 1;
1881}
1882
1883// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag.
1884export type SymbolTag = 1;
1885
1886// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentSymbol.
1887export interface DocumentSymbol {
1888 name: string;
1889 detail?: string;
1890 kind: SymbolKind;
1891 tags?: SymbolTag[];
1892 deprecated?: boolean;
1893 range: Range;
1894 selectionRange: Range;
1895 children?: DocumentSymbol[];
1896}