Elffuss BraidHub

kikocis/continue public

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