Elffuss BraidHub

kikocis/continue public

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