Elffuss BraidHub

kikocis/continue public

4db7e4f9992e · 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 | "authenticating"
1282 | "not-connected";
1283
1284export type MCPPromptArgs = {
1285 name: string;
1286 description?: string;
1287 required?: boolean;
1288}[];
1289
1290export interface MCPPrompt {
1291 name: string;
1292 description?: string;
1293 arguments?: MCPPromptArgs;
1294}
1295
1296// Leaving here to ideate on
1297// export type ContinueConfigSource = "local-yaml" | "local-json" | "hub-assistant" | "hub"
1298
1299// https://modelcontextprotocol.io/docs/concepts/resources#direct-resources
1300export interface MCPResource {
1301 name: string;
1302 uri: string;
1303 description?: string;
1304 mimeType?: string;
1305}
1306
1307// https://modelcontextprotocol.io/docs/concepts/resources#resource-templates
1308export interface MCPResourceTemplate {
1309 uriTemplate: string;
1310 name: string;
1311 description?: string;
1312 mimeType?: string;
1313}
1314
1315export interface MCPTool {
1316 name: string;
1317 description?: string;
1318 inputSchema: {
1319 type: "object";
1320 properties?: Record<string, any>;
1321 };
1322}
1323
1324export interface MCPServerStatus extends MCPOptions {
1325 status: MCPConnectionStatus;
1326 errors: string[];
1327 isProtectedResource: boolean;
1328
1329 prompts: MCPPrompt[];
1330 tools: MCPTool[];
1331 resources: MCPResource[];
1332 resourceTemplates: MCPResourceTemplate[];
1333 sourceFile?: string;
1334}
1335
1336export interface ContinueUIConfig {
1337 codeBlockToolbarPosition?: "top" | "bottom";
1338 fontSize?: number;
1339 displayRawMarkdown?: boolean;
1340 showChatScrollbar?: boolean;
1341 codeWrap?: boolean;
1342 showSessionTabs?: boolean;
1343 autoAcceptEditToolDiffs?: boolean;
1344}
1345
1346export interface ContextMenuConfig {
1347 comment?: string;
1348 docstring?: string;
1349 fix?: string;
1350 optimize?: string;
1351 fixGrammar?: string;
1352}
1353
1354export interface ExperimentalModelRoles {
1355 repoMapFileSelection?: string;
1356 inlineEdit?: string;
1357 applyCodeBlock?: string;
1358}
1359
1360export interface ExperimentalMCPOptions {
1361 transport: TransportOptions;
1362 faviconUrl?: string;
1363 timeout?: number;
1364}
1365
1366export type ApplyStateStatus =
1367 | "not-started" // Apply state created but not necessarily streaming
1368 | "streaming" // Changes are being applied to the file
1369 | "done" // All changes have been applied, awaiting user to accept/reject
1370 | "closed"; // All changes have been applied. Note that for new files, we immediately set the status to "closed"
1371
1372export interface ApplyState {
1373 streamId: string;
1374 status?: ApplyStateStatus;
1375 numDiffs?: number;
1376 filepath?: string;
1377 fileContent?: string;
1378 originalFileContent?: string;
1379 toolCallId?: string;
1380}
1381
1382export interface StreamDiffLinesPayload {
1383 prefix: string;
1384 highlighted: string;
1385 suffix: string;
1386 input: string;
1387 language: string | undefined;
1388 modelTitle: string | undefined;
1389 includeRulesInSystemMessage: boolean;
1390 fileUri?: string;
1391}
1392
1393export interface HighlightedCodePayload {
1394 rangeInFileWithContents: RangeInFileWithContents;
1395 prompt?: string;
1396 shouldRun?: boolean;
1397}
1398
1399export interface AcceptOrRejectDiffPayload {
1400 filepath?: string;
1401 streamId?: string;
1402}
1403
1404export interface ShowFilePayload {
1405 filepath: string;
1406}
1407
1408export interface ApplyToFilePayload {
1409 streamId: string;
1410 filepath?: string;
1411 text: string;
1412 toolCallId?: string;
1413 isSearchAndReplace?: boolean;
1414}
1415
1416export interface RangeInFileWithContents {
1417 filepath: string;
1418 range: {
1419 start: { line: number; character: number };
1420 end: { line: number; character: number };
1421 };
1422 contents: string;
1423}
1424
1425export interface RangeInFileWithNextEditInfo {
1426 filepath: string;
1427 range: Range;
1428 fileContents: string;
1429 editText: string;
1430 afterCursorPos: Position;
1431 beforeCursorPos: Position;
1432 workspaceDir: string;
1433}
1434
1435export type SetCodeToEditPayload = RangeInFileWithContents | FileWithContents;
1436
1437/**
1438 * Signature help represents the signature of something
1439 * callable. There can be multiple signatures but only one
1440 * active and only one active parameter.
1441 */
1442export class SignatureHelp {
1443 /**
1444 * One or more signatures.
1445 */
1446 signatures: SignatureInformation[];
1447
1448 /**
1449 * The active signature.
1450 */
1451 activeSignature: number;
1452
1453 /**
1454 * The active parameter of the active signature.
1455 */
1456 activeParameter: number;
1457}
1458
1459/**
1460 * Represents the signature of something callable. A signature
1461 * can have a label, like a function-name, a doc-comment, and
1462 * a set of parameters.
1463 */
1464export class SignatureInformation {
1465 /**
1466 * The label of this signature. Will be shown in
1467 * the UI.
1468 */
1469 label: string;
1470
1471 /**
1472 * The parameters of this signature.
1473 */
1474 parameters: ParameterInformation[];
1475
1476 /**
1477 * The index of the active parameter.
1478 *
1479 * If provided, this is used in place of {@linkcode SignatureHelp.activeParameter}.
1480 */
1481 activeParameter?: number;
1482}
1483
1484/**
1485 * Represents a parameter of a callable-signature. A parameter can
1486 * have a label and a doc-comment.
1487 */
1488export class ParameterInformation {
1489 /**
1490 * The label of this signature.
1491 *
1492 * Either a string or inclusive start and exclusive end offsets within its containing
1493 * {@link SignatureInformation.label signature label}. *Note*: A label of type string must be
1494 * a substring of its containing signature information's {@link SignatureInformation.label label}.
1495 */
1496 label: string | [number, number];
1497}
1498
1499/**
1500 * Represents the configuration for a quick action in the Code Lens.
1501 * Quick actions are custom commands that can be added to function and class declarations.
1502 */
1503export interface QuickActionConfig {
1504 /**
1505 * The title of the quick action that will display in the Code Lens.
1506 */
1507 title: string;
1508
1509 /**
1510 * The prompt that will be sent to the model when the quick action is invoked,
1511 * with the function or class body concatenated.
1512 */
1513 prompt: string;
1514
1515 /**
1516 * If `true`, the result of the quick action will be sent to the chat panel.
1517 * If `false`, the streamed result will be inserted into the document.
1518 *
1519 * Defaults to `false`.
1520 */
1521 sendToChat: boolean;
1522}
1523
1524export type DefaultContextProvider = ContextProviderWithParams & {
1525 query?: string;
1526};
1527
1528export interface ExperimentalConfig {
1529 contextMenuPrompts?: ContextMenuConfig;
1530 modelRoles?: ExperimentalModelRoles;
1531 defaultContext?: DefaultContextProvider[];
1532 promptPath?: string;
1533 enableExperimentalTools?: boolean;
1534 onlyUseSystemMessageTools?: boolean;
1535
1536 /**
1537 * Quick actions are a way to add custom commands to the Code Lens of
1538 * function and class declarations.
1539 */
1540 quickActions?: QuickActionConfig[];
1541
1542 /**
1543 * Automatically read LLM chat responses aloud using system TTS models
1544 */
1545 readResponseTTS?: boolean;
1546
1547 /**
1548 * If set to true, we will attempt to pull down and install an instance of Chromium
1549 * that is compatible with the current version of Puppeteer.
1550 * This is needed to crawl a large number of documentation sites that are dynamically rendered.
1551 */
1552 useChromiumForDocsCrawling?: boolean;
1553 modelContextProtocolServers?: ExperimentalMCPOptions[];
1554
1555 /**
1556 * If enabled, will add the current file as context.
1557 */
1558 useCurrentFileAsContext?: boolean;
1559
1560 /**
1561 * If enabled, @codebase will only use tool calling
1562 * instead of embeddings, FTS, recently edited files, etc.
1563 */
1564 codebaseToolCallingOnly?: boolean;
1565
1566 /**
1567 * If enabled, static contextualization will be used to
1568 * gather context for the model where necessary.
1569 */
1570 enableStaticContextualization?: boolean;
1571}
1572
1573export interface AnalyticsConfig {
1574 provider: string;
1575 url?: string;
1576 clientKey?: string;
1577}
1578
1579export interface JSONModelDescription {
1580 title: string;
1581 provider: string;
1582 underlyingProviderName: string;
1583 model: string;
1584 apiKey?: string;
1585 apiBase?: string;
1586
1587 contextLength?: number;
1588 maxStopWords?: number;
1589 template?: TemplateType;
1590 completionOptions?: BaseCompletionOptions;
1591 systemMessage?: string;
1592 requestOptions?: RequestOptions;
1593 cacheBehavior?: CacheBehavior;
1594
1595 region?: string;
1596 profile?: string;
1597 modelArn?: string;
1598 apiType?: "openai" | "azure";
1599 apiVersion?: string;
1600 deployment?: string;
1601 projectId?: string;
1602 accountId?: string;
1603 aiGatewaySlug?: string;
1604 useLegacyCompletionsEndpoint?: boolean;
1605 deploymentId?: string;
1606}
1607
1608// config.json
1609export interface SerializedContinueConfig {
1610 env?: string[];
1611 allowAnonymousTelemetry?: boolean;
1612 models: JSONModelDescription[];
1613 systemMessage?: string;
1614 completionOptions?: BaseCompletionOptions;
1615 requestOptions?: RequestOptions;
1616 slashCommands?: SlashCommandDescription[];
1617 customCommands?: CustomCommand[];
1618 contextProviders?: ContextProviderWithParams[];
1619 disableIndexing?: boolean;
1620 disableSessionTitles?: boolean;
1621 userToken?: string;
1622 embeddingsProvider?: EmbeddingsProviderDescription;
1623 tabAutocompleteModel?: JSONModelDescription | JSONModelDescription[];
1624 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1625 ui?: ContinueUIConfig;
1626 reranker?: RerankerDescription;
1627 experimental?: ExperimentalConfig;
1628 analytics?: AnalyticsConfig;
1629 docs?: SiteIndexingConfig[];
1630 data?: DataDestination[];
1631}
1632
1633export type ConfigMergeType = "merge" | "overwrite";
1634
1635export type ContinueRcJson = Partial<SerializedContinueConfig> & {
1636 mergeBehavior: ConfigMergeType;
1637};
1638
1639// config.ts - give users simplified interfaces
1640export interface Config {
1641 /** 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 */
1642 allowAnonymousTelemetry?: boolean;
1643 /** Each entry in this array will originally be a JSONModelDescription, the same object from your config.json, but you may add CustomLLMs.
1644 * 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).
1645 * Continue will do the rest of the work to construct prompt templates, handle context items, prune context, etc.
1646 */
1647 models: (CustomLLM | JSONModelDescription)[];
1648 /** A system message to be followed by all of your models */
1649 systemMessage?: string;
1650 /** The default completion options for all models */
1651 completionOptions?: BaseCompletionOptions;
1652 /** Request options that will be applied to all models and context providers */
1653 requestOptions?: RequestOptions;
1654 /** The list of slash commands that will be available in the sidebar */
1655 slashCommands?: (SlashCommand | SlashCommandWithSource)[];
1656 /** Each entry in this array will originally be a ContextProviderWithParams, the same object from your config.json, but you may add CustomContextProviders.
1657 * A CustomContextProvider requires you only to define a title and getContextItems function. When you type '@title <query>', Continue will call `getContextItems(query)`.
1658 */
1659 contextProviders?: (CustomContextProvider | ContextProviderWithParams)[];
1660 /** If set to true, Continue will not index your codebase for retrieval */
1661 disableIndexing?: boolean;
1662 /** If set to true, Continue will not make extra requests to the LLM to generate a summary title of each session. */
1663 disableSessionTitles?: boolean;
1664 /** An optional token to identify a user. Not used by Continue unless you write custom coniguration that requires such a token */
1665 userToken?: string;
1666 /** The provider used to calculate embeddings. If left empty, Continue will use transformers.js to calculate the embeddings with all-MiniLM-L6-v2 */
1667 embeddingsProvider?: EmbeddingsProviderDescription | ILLM;
1668 /** The model that Continue will use for tab autocompletions. */
1669 tabAutocompleteModel?:
1670 | CustomLLM
1671 | JSONModelDescription
1672 | (CustomLLM | JSONModelDescription)[];
1673 /** Options for tab autocomplete */
1674 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1675 /** UI styles customization */
1676 ui?: ContinueUIConfig;
1677 /** Options for the reranker */
1678 reranker?: RerankerDescription | ILLM;
1679 /** Experimental configuration */
1680 experimental?: ExperimentalConfig;
1681 /** Analytics configuration */
1682 analytics?: AnalyticsConfig;
1683 data?: DataDestination[];
1684}
1685
1686// in the actual Continue source code
1687export interface ContinueConfig {
1688 allowAnonymousTelemetry?: boolean;
1689 // systemMessage?: string;
1690 completionOptions?: BaseCompletionOptions;
1691 requestOptions?: RequestOptions;
1692 slashCommands: SlashCommandWithSource[];
1693 contextProviders: IContextProvider[];
1694 disableSessionTitles?: boolean;
1695 disableIndexing?: boolean;
1696 userToken?: string;
1697 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1698 ui?: ContinueUIConfig;
1699 experimental?: ExperimentalConfig;
1700 analytics?: AnalyticsConfig;
1701 docs?: SiteIndexingConfig[];
1702 tools: Tool[];
1703 mcpServerStatuses: MCPServerStatus[];
1704 rules: RuleWithSource[];
1705 modelsByRole: Record<ModelRole, ILLM[]>;
1706 selectedModelByRole: Record<ModelRole, ILLM | null>;
1707 data?: DataDestination[];
1708}
1709
1710export interface BrowserSerializedContinueConfig {
1711 allowAnonymousTelemetry?: boolean;
1712 // systemMessage?: string;
1713 completionOptions?: BaseCompletionOptions;
1714 requestOptions?: RequestOptions;
1715 slashCommands: SlashCommandDescWithSource[];
1716 contextProviders: ContextProviderDescription[];
1717 disableIndexing?: boolean;
1718 disableSessionTitles?: boolean;
1719 userToken?: string;
1720 ui?: ContinueUIConfig;
1721 experimental?: ExperimentalConfig;
1722 analytics?: AnalyticsConfig;
1723 docs?: SiteIndexingConfig[];
1724 tools: Tool[];
1725 mcpServerStatuses: MCPServerStatus[];
1726 rules: RuleWithSource[];
1727 usePlatform: boolean;
1728 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1729 modelsByRole: Record<ModelRole, ModelDescription[]>;
1730 selectedModelByRole: Record<ModelRole, ModelDescription | null>;
1731}
1732
1733// DOCS SUGGESTIONS AND PACKAGE INFO
1734export interface FilePathAndName {
1735 path: string;
1736 name: string;
1737}
1738
1739export interface PackageFilePathAndName extends FilePathAndName {
1740 packageRegistry: string; // e.g. npm, pypi
1741}
1742
1743export type ParsedPackageInfo = {
1744 name: string;
1745 packageFile: PackageFilePathAndName;
1746 language: string;
1747 version: string;
1748};
1749
1750export type PackageDetails = {
1751 docsLink?: string;
1752 docsLinkWarning?: string;
1753 title?: string;
1754 description?: string;
1755 repo?: string;
1756 license?: string;
1757};
1758
1759export type PackageDetailsSuccess = PackageDetails & {
1760 docsLink: string;
1761};
1762
1763export type PackageDocsResult = {
1764 packageInfo: ParsedPackageInfo;
1765} & (
1766 | { error: string; details?: never }
1767 | { details: PackageDetailsSuccess; error?: never }
1768);
1769
1770export interface TerminalOptions {
1771 reuseTerminal?: boolean;
1772 terminalName?: string;
1773 waitForCompletion?: boolean;
1774}
1775
1776export type RuleSource =
1777 | "default-chat"
1778 | "default-plan"
1779 | "default-agent"
1780 | "model-options-chat"
1781 | "model-options-plan"
1782 | "model-options-agent"
1783 | "rules-block"
1784 | "colocated-markdown"
1785 | "json-systemMessage"
1786 | ".continuerules";
1787
1788export interface RuleWithSource {
1789 name?: string;
1790 slug?: string;
1791 source: RuleSource;
1792 globs?: string | string[];
1793 regex?: string | string[];
1794 rule: string;
1795 description?: string;
1796 ruleFile?: string;
1797 alwaysApply?: boolean;
1798}
1799export interface CompleteOnboardingPayload {
1800 mode: OnboardingModes;
1801 provider?: string;
1802 apiKey?: string;
1803}
1804
1805export interface CompiledMessagesResult {
1806 compiledChatMessages: ChatMessage[];
1807 didPrune: boolean;
1808 contextPercentage: number;
1809}
1810
1811export interface MessageOption {
1812 precompiled: boolean;
1813}
1814
1815/* LSP-specific interfaces. */
1816
1817// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind.
1818// We shift this one index down to match vscode.SymbolKind.
1819export enum SymbolKind {
1820 File = 0,
1821 Module = 1,
1822 Namespace = 2,
1823 Package = 3,
1824 Class = 4,
1825 Method = 5,
1826 Property = 6,
1827 Field = 7,
1828 Constructor = 8,
1829 Enum = 9,
1830 Interface = 10,
1831 Function = 11,
1832 Variable = 12,
1833 Constant = 13,
1834 String = 14,
1835 Number = 15,
1836 Boolean = 16,
1837 Array = 17,
1838 Object = 18,
1839 Key = 19,
1840 Null = 20,
1841 EnumMember = 21,
1842 Struct = 22,
1843 Event = 23,
1844 Operator = 24,
1845 TypeParameter = 25,
1846}
1847
1848// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag.
1849export namespace SymbolTag {
1850 export const Deprecated: 1 = 1;
1851}
1852
1853// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag.
1854export type SymbolTag = 1;
1855
1856// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentSymbol.
1857export interface DocumentSymbol {
1858 name: string;
1859 detail?: string;
1860 kind: SymbolKind;
1861 tags?: SymbolTag[];
1862 deprecated?: boolean;
1863 range: Range;
1864 selectionRange: Range;
1865 children?: DocumentSymbol[];
1866}