Elffuss BraidHub

kikocis/continue public

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