Elffuss BraidHub

kikocis/continue public

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