Elffuss BraidHub

kikocis/continue public

67b431a633b8 · 44.4 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 prompt: string;
460 completion: string;
461}
462
463export type MessageModes = "chat" | "agent" | "plan";
464
465export type ToolStatus =
466 | "generating" // Tool call arguments are being streamed from the LLM
467 | "generated" // Tool call is complete and ready for execution (awaiting approval)
468 | "calling" // Tool is actively being executed
469 | "errored" // Tool execution failed with an error
470 | "done" // Tool execution completed successfully
471 | "canceled"; // Tool call was canceled by user or system
472
473// Will exist only on "assistant" messages with tool calls
474interface ToolCallState {
475 toolCallId: string;
476 toolCall: ToolCall;
477 status: ToolStatus;
478 parsedArgs: any;
479 output?: ContextItem[];
480 tool?: Tool;
481}
482
483interface Reasoning {
484 active: boolean;
485 text: string;
486 startAt: number;
487 endAt?: number;
488}
489
490export interface ChatHistoryItem {
491 message: ChatMessage;
492 contextItems: ContextItemWithId[];
493 editorState?: any;
494 modifiers?: InputModifiers;
495 promptLogs?: PromptLog[];
496 toolCallStates?: ToolCallState[];
497 isGatheringContext?: boolean;
498 reasoning?: Reasoning;
499 appliedRules?: RuleWithSource[];
500 conversationSummary?: string;
501}
502
503export interface LLMFullCompletionOptions extends BaseCompletionOptions {
504 log?: boolean;
505 model?: string;
506}
507
508export type ToastType = "info" | "error" | "warning";
509
510export interface LLMInteractionBase {
511 interactionId: string;
512 timestamp: number;
513}
514
515export interface LLMInteractionStartChat extends LLMInteractionBase {
516 kind: "startChat";
517 messages: ChatMessage[];
518 options: CompletionOptions;
519 provider: string;
520}
521
522export interface LLMInteractionStartComplete extends LLMInteractionBase {
523 kind: "startComplete";
524 prompt: string;
525 options: CompletionOptions;
526 provider: string;
527}
528
529export interface LLMInteractionStartFim extends LLMInteractionBase {
530 kind: "startFim";
531 prefix: string;
532 suffix: string;
533 options: CompletionOptions;
534 provider: string;
535}
536
537export interface LLMInteractionChunk extends LLMInteractionBase {
538 kind: "chunk";
539 chunk: string;
540}
541
542export interface LLMInteractionMessage extends LLMInteractionBase {
543 kind: "message";
544 message: ChatMessage;
545}
546
547export interface LLMInteractionEnd extends LLMInteractionBase {
548 promptTokens: number;
549 generatedTokens: number;
550 thinkingTokens: number;
551 usage: Usage | undefined;
552}
553
554export interface LLMInteractionSuccess extends LLMInteractionEnd {
555 kind: "success";
556}
557
558export interface LLMInteractionCancel extends LLMInteractionEnd {
559 kind: "cancel";
560}
561
562export interface LLMInteractionError extends LLMInteractionEnd {
563 kind: "error";
564 name: string;
565 message: string;
566}
567
568export type LLMInteractionItem =
569 | LLMInteractionStartChat
570 | LLMInteractionStartComplete
571 | LLMInteractionStartFim
572 | LLMInteractionChunk
573 | LLMInteractionMessage
574 | LLMInteractionSuccess
575 | LLMInteractionCancel
576 | LLMInteractionError;
577
578// When we log a LLM interaction, we want to add the interactionId and timestamp
579// in the logger code, so we need a type that omits these members from *each*
580// member of the union. This can be done by using the distributive behavior of
581// conditional types in Typescript.
582//
583// www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
584// https://stackoverflow.com/questions/57103834/typescript-omit-a-property-from-all-interfaces-in-a-union-but-keep-the-union-s
585type DistributiveOmit<T, K extends PropertyKey> = T extends unknown
586 ? Omit<T, K>
587 : never;
588
589export type LLMInteractionItemDetails = DistributiveOmit<
590 LLMInteractionItem,
591 "interactionId" | "timestamp"
592>;
593
594export interface ILLMInteractionLog {
595 logItem(item: LLMInteractionItemDetails): void;
596}
597
598export interface ILLMLogger {
599 createInteractionLog(): ILLMInteractionLog;
600}
601
602export interface LLMOptions {
603 model: string;
604
605 title?: string;
606 uniqueId?: string;
607 baseAgentSystemMessage?: string;
608 basePlanSystemMessage?: string;
609 baseChatSystemMessage?: string;
610 autocompleteOptions?: Partial<TabAutocompleteOptions>;
611 contextLength?: number;
612 maxStopWords?: number;
613 completionOptions?: CompletionOptions;
614 requestOptions?: RequestOptions;
615 template?: TemplateType;
616 promptTemplates?: Partial<Record<keyof PromptTemplates, PromptTemplate>>;
617 templateMessages?: (messages: ChatMessage[]) => string;
618 logger?: ILLMLogger;
619 llmRequestHook?: (model: string, prompt: string) => any;
620 apiKey?: string;
621
622 // continueProperties
623 apiKeyLocation?: string;
624 envSecretLocations?: Record<string, string>;
625 apiBase?: string;
626 orgScopeId?: string | null;
627
628 onPremProxyUrl?: string | null;
629
630 aiGatewaySlug?: string;
631 cacheBehavior?: CacheBehavior;
632 capabilities?: ModelCapability;
633 roles?: ModelRole[];
634
635 useLegacyCompletionsEndpoint?: boolean;
636
637 // Embedding options
638 embeddingId?: string;
639 maxEmbeddingChunkSize?: number;
640 maxEmbeddingBatchSize?: number;
641
642 // Cloudflare options
643 accountId?: string;
644
645 // Azure options
646 deployment?: string;
647 apiVersion?: string;
648 apiType?: string;
649
650 // AWS options
651 profile?: string;
652 modelArn?: string;
653 accessKeyId?: string;
654 secretAccessKey?: string;
655
656 // AWS and VertexAI Options
657 region?: string;
658
659 // VertexAI and Watsonx Options
660 projectId?: string;
661
662 // IBM watsonx Options
663 deploymentId?: string;
664
665 env?: Record<string, string | number | boolean>;
666
667 sourceFile?: string;
668 isFromAutoDetect?: boolean;
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 interface Tool {
1074 type: "function";
1075 function: {
1076 name: string;
1077 description?: string;
1078 parameters?: Record<string, any>;
1079 strict?: boolean | null;
1080 };
1081
1082 displayTitle: string;
1083 wouldLikeTo?: string;
1084 isCurrently?: string;
1085 hasAlready?: string;
1086 readonly: boolean;
1087 isInstant?: boolean;
1088 uri?: string;
1089 faviconUrl?: string;
1090 group: string;
1091 originalFunctionName?: string;
1092 systemMessageDescription?: {
1093 prefix: string;
1094 exampleArgs?: Array<[string, string | number]>;
1095 };
1096 defaultToolPolicy?: ToolPolicy;
1097 evaluateToolCallPolicy?: (
1098 basePolicy: ToolPolicy,
1099 parsedArgs: Record<string, unknown>,
1100 ) => ToolPolicy;
1101}
1102
1103interface ToolChoice {
1104 type: "function";
1105 function: {
1106 name: string;
1107 };
1108}
1109
1110export interface ConfigDependentToolParams {
1111 rules: RuleWithSource[];
1112 enableExperimentalTools: boolean;
1113 isSignedIn: boolean;
1114 isRemote: boolean;
1115 modelName: string | undefined;
1116}
1117
1118export type GetTool = (params: ConfigDependentToolParams) => Tool;
1119
1120export interface BaseCompletionOptions {
1121 temperature?: number;
1122 topP?: number;
1123 topK?: number;
1124 minP?: number;
1125 presencePenalty?: number;
1126 frequencyPenalty?: number;
1127 mirostat?: number;
1128 stop?: string[];
1129 maxTokens?: number;
1130 numThreads?: number;
1131 useMmap?: boolean;
1132 keepAlive?: number;
1133 numGpu?: number;
1134 raw?: boolean;
1135 stream?: boolean;
1136 prediction?: Prediction;
1137 tools?: Tool[];
1138 toolChoice?: ToolChoice;
1139 reasoning?: boolean;
1140 reasoningBudgetTokens?: number;
1141 promptCaching?: boolean;
1142}
1143
1144export interface ModelCapability {
1145 uploadImage?: boolean;
1146 tools?: boolean;
1147 nextEdit?: boolean;
1148}
1149
1150export interface ModelDescription {
1151 title: string;
1152 provider: string;
1153 underlyingProviderName: string;
1154 model: string;
1155 apiKey?: string;
1156
1157 apiBase?: string;
1158 apiKeyLocation?: string;
1159 envSecretLocations?: Record<string, string>;
1160 orgScopeId?: string | null;
1161
1162 onPremProxyUrl?: string | null;
1163
1164 contextLength?: number;
1165 maxStopWords?: number;
1166 template?: TemplateType;
1167 completionOptions?: BaseCompletionOptions;
1168 baseAgentSystemMessage?: string;
1169 basePlanSystemMessage?: string;
1170 baseChatSystemMessage?: string;
1171 requestOptions?: RequestOptions;
1172 promptTemplates?: { [key: string]: string };
1173 cacheBehavior?: CacheBehavior;
1174 capabilities?: ModelCapability;
1175 roles?: ModelRole[];
1176 configurationStatus?: LLMConfigurationStatuses;
1177
1178 sourceFile?: string;
1179 isFromAutoDetect?: boolean;
1180}
1181
1182export interface JSONEmbedOptions {
1183 apiBase?: string;
1184 apiKey?: string;
1185 model?: string;
1186 deployment?: string;
1187 apiType?: string;
1188 apiVersion?: string;
1189 requestOptions?: RequestOptions;
1190 maxEmbeddingChunkSize?: number;
1191 maxEmbeddingBatchSize?: number;
1192
1193 // AWS options
1194 profile?: string;
1195
1196 // AWS and VertexAI Options
1197 region?: string;
1198
1199 // VertexAI and Watsonx Options
1200 projectId?: string;
1201}
1202
1203export interface EmbeddingsProviderDescription extends JSONEmbedOptions {
1204 provider: string;
1205}
1206
1207export interface RerankerDescription {
1208 name: string;
1209 params?: { [key: string]: any };
1210}
1211
1212// TODO: We should consider renaming this to AutocompleteOptions.
1213export interface TabAutocompleteOptions {
1214 disable: boolean;
1215 maxPromptTokens: number;
1216 debounceDelay: number;
1217 modelTimeout: number;
1218 maxSuffixPercentage: number;
1219 prefixPercentage: number;
1220 transform?: boolean;
1221 template?: string;
1222 multilineCompletions: "always" | "never" | "auto";
1223 slidingWindowPrefixPercentage: number;
1224 slidingWindowSize: number;
1225 useCache: boolean;
1226 onlyMyCode: boolean;
1227 useRecentlyEdited: boolean;
1228 useRecentlyOpened: boolean;
1229 disableInFiles?: string[];
1230 useImports?: boolean;
1231 showWhateverWeHaveAtXMs?: number;
1232 // true = enabled, false = disabled, number = enabled with priority
1233 experimental_includeClipboard: boolean | number;
1234 experimental_includeRecentlyVisitedRanges: boolean | number;
1235 experimental_includeRecentlyEditedRanges: boolean | number;
1236 experimental_includeDiff: boolean | number;
1237 experimental_enableStaticContextualization: boolean;
1238}
1239
1240export interface StdioOptions {
1241 type: "stdio";
1242 command: string;
1243 args: string[];
1244 env?: Record<string, string>;
1245 cwd?: string;
1246 requestOptions?: RequestOptions;
1247}
1248
1249export interface WebSocketOptions {
1250 type: "websocket";
1251 url: string;
1252 requestOptions?: RequestOptions;
1253}
1254
1255export interface SSEOptions {
1256 type: "sse";
1257 url: string;
1258 requestOptions?: RequestOptions;
1259}
1260
1261export interface StreamableHTTPOptions {
1262 type: "streamable-http";
1263 url: string;
1264 requestOptions?: RequestOptions;
1265}
1266
1267export type TransportOptions =
1268 | StdioOptions
1269 | WebSocketOptions
1270 | SSEOptions
1271 | StreamableHTTPOptions;
1272
1273export interface MCPOptions {
1274 name: string;
1275 id: string;
1276 transport: TransportOptions;
1277 faviconUrl?: string;
1278 timeout?: number;
1279}
1280
1281export type MCPConnectionStatus =
1282 | "connecting"
1283 | "connected"
1284 | "error"
1285 | "authenticating"
1286 | "not-connected";
1287
1288export type MCPPromptArgs = {
1289 name: string;
1290 description?: string;
1291 required?: boolean;
1292}[];
1293
1294export interface MCPPrompt {
1295 name: string;
1296 description?: string;
1297 arguments?: MCPPromptArgs;
1298}
1299
1300// Leaving here to ideate on
1301// export type ContinueConfigSource = "local-yaml" | "local-json" | "hub-assistant" | "hub"
1302
1303// https://modelcontextprotocol.io/docs/concepts/resources#direct-resources
1304export interface MCPResource {
1305 name: string;
1306 uri: string;
1307 description?: string;
1308 mimeType?: string;
1309}
1310
1311// https://modelcontextprotocol.io/docs/concepts/resources#resource-templates
1312export interface MCPResourceTemplate {
1313 uriTemplate: string;
1314 name: string;
1315 description?: string;
1316 mimeType?: string;
1317}
1318
1319export interface MCPTool {
1320 name: string;
1321 description?: string;
1322 inputSchema: {
1323 type: "object";
1324 properties?: Record<string, any>;
1325 };
1326}
1327
1328export interface MCPServerStatus extends MCPOptions {
1329 status: MCPConnectionStatus;
1330 errors: string[];
1331 isProtectedResource: boolean;
1332
1333 prompts: MCPPrompt[];
1334 tools: MCPTool[];
1335 resources: MCPResource[];
1336 resourceTemplates: MCPResourceTemplate[];
1337 sourceFile?: string;
1338}
1339
1340export interface ContinueUIConfig {
1341 codeBlockToolbarPosition?: "top" | "bottom";
1342 fontSize?: number;
1343 displayRawMarkdown?: boolean;
1344 showChatScrollbar?: boolean;
1345 codeWrap?: boolean;
1346 showSessionTabs?: boolean;
1347 autoAcceptEditToolDiffs?: boolean;
1348 continueAfterToolRejection?: boolean;
1349}
1350
1351export interface ContextMenuConfig {
1352 comment?: string;
1353 docstring?: string;
1354 fix?: string;
1355 optimize?: string;
1356 fixGrammar?: string;
1357}
1358
1359export interface ExperimentalModelRoles {
1360 repoMapFileSelection?: string;
1361 inlineEdit?: string;
1362 applyCodeBlock?: string;
1363}
1364
1365export interface ExperimentalMCPOptions {
1366 transport: TransportOptions;
1367 faviconUrl?: string;
1368 timeout?: number;
1369}
1370
1371export type ApplyStateStatus =
1372 | "not-started" // Apply state created but not necessarily streaming
1373 | "streaming" // Changes are being applied to the file
1374 | "done" // All changes have been applied, awaiting user to accept/reject
1375 | "closed"; // All changes have been applied. Note that for new files, we immediately set the status to "closed"
1376
1377export interface ApplyState {
1378 streamId: string;
1379 status?: ApplyStateStatus;
1380 numDiffs?: number;
1381 filepath?: string;
1382 fileContent?: string;
1383 originalFileContent?: string;
1384 toolCallId?: string;
1385}
1386
1387export interface StreamDiffLinesPayload {
1388 prefix: string;
1389 highlighted: string;
1390 suffix: string;
1391 input: string;
1392 language: string | undefined;
1393 modelTitle: string | undefined;
1394 includeRulesInSystemMessage: boolean;
1395 fileUri?: string;
1396}
1397
1398export interface HighlightedCodePayload {
1399 rangeInFileWithContents: RangeInFileWithContents;
1400 prompt?: string;
1401 shouldRun?: boolean;
1402}
1403
1404export interface AcceptOrRejectDiffPayload {
1405 filepath?: string;
1406 streamId?: string;
1407}
1408
1409export interface ShowFilePayload {
1410 filepath: string;
1411}
1412
1413export interface ApplyToFilePayload {
1414 streamId: string;
1415 filepath?: string;
1416 text: string;
1417 toolCallId?: string;
1418 isSearchAndReplace?: boolean;
1419}
1420
1421export interface RangeInFileWithContents {
1422 filepath: string;
1423 range: {
1424 start: { line: number; character: number };
1425 end: { line: number; character: number };
1426 };
1427 contents: string;
1428}
1429
1430export interface RangeInFileWithNextEditInfo {
1431 filepath: string;
1432 range: Range;
1433 fileContents: string;
1434 editText: string;
1435 afterCursorPos: Position;
1436 beforeCursorPos: Position;
1437 workspaceDir: string;
1438}
1439
1440export type SetCodeToEditPayload = RangeInFileWithContents | FileWithContents;
1441
1442/**
1443 * Signature help represents the signature of something
1444 * callable. There can be multiple signatures but only one
1445 * active and only one active parameter.
1446 */
1447export class SignatureHelp {
1448 /**
1449 * One or more signatures.
1450 */
1451 signatures: SignatureInformation[];
1452
1453 /**
1454 * The active signature.
1455 */
1456 activeSignature: number;
1457
1458 /**
1459 * The active parameter of the active signature.
1460 */
1461 activeParameter: number;
1462}
1463
1464/**
1465 * Represents the signature of something callable. A signature
1466 * can have a label, like a function-name, a doc-comment, and
1467 * a set of parameters.
1468 */
1469export class SignatureInformation {
1470 /**
1471 * The label of this signature. Will be shown in
1472 * the UI.
1473 */
1474 label: string;
1475
1476 /**
1477 * The parameters of this signature.
1478 */
1479 parameters: ParameterInformation[];
1480
1481 /**
1482 * The index of the active parameter.
1483 *
1484 * If provided, this is used in place of {@linkcode SignatureHelp.activeParameter}.
1485 */
1486 activeParameter?: number;
1487}
1488
1489/**
1490 * Represents a parameter of a callable-signature. A parameter can
1491 * have a label and a doc-comment.
1492 */
1493export class ParameterInformation {
1494 /**
1495 * The label of this signature.
1496 *
1497 * Either a string or inclusive start and exclusive end offsets within its containing
1498 * {@link SignatureInformation.label signature label}. *Note*: A label of type string must be
1499 * a substring of its containing signature information's {@link SignatureInformation.label label}.
1500 */
1501 label: string | [number, number];
1502}
1503
1504/**
1505 * Represents the configuration for a quick action in the Code Lens.
1506 * Quick actions are custom commands that can be added to function and class declarations.
1507 */
1508export interface QuickActionConfig {
1509 /**
1510 * The title of the quick action that will display in the Code Lens.
1511 */
1512 title: string;
1513
1514 /**
1515 * The prompt that will be sent to the model when the quick action is invoked,
1516 * with the function or class body concatenated.
1517 */
1518 prompt: string;
1519
1520 /**
1521 * If `true`, the result of the quick action will be sent to the chat panel.
1522 * If `false`, the streamed result will be inserted into the document.
1523 *
1524 * Defaults to `false`.
1525 */
1526 sendToChat: boolean;
1527}
1528
1529export type DefaultContextProvider = ContextProviderWithParams & {
1530 query?: string;
1531};
1532
1533export interface ExperimentalConfig {
1534 contextMenuPrompts?: ContextMenuConfig;
1535 modelRoles?: ExperimentalModelRoles;
1536 defaultContext?: DefaultContextProvider[];
1537 promptPath?: string;
1538 enableExperimentalTools?: boolean;
1539 onlyUseSystemMessageTools?: boolean;
1540
1541 /**
1542 * Quick actions are a way to add custom commands to the Code Lens of
1543 * function and class declarations.
1544 */
1545 quickActions?: QuickActionConfig[];
1546
1547 /**
1548 * Automatically read LLM chat responses aloud using system TTS models
1549 */
1550 readResponseTTS?: boolean;
1551
1552 /**
1553 * If set to true, we will attempt to pull down and install an instance of Chromium
1554 * that is compatible with the current version of Puppeteer.
1555 * This is needed to crawl a large number of documentation sites that are dynamically rendered.
1556 */
1557 useChromiumForDocsCrawling?: boolean;
1558 modelContextProtocolServers?: ExperimentalMCPOptions[];
1559
1560 /**
1561 * If enabled, will add the current file as context.
1562 */
1563 useCurrentFileAsContext?: boolean;
1564
1565 /**
1566 * If enabled, @codebase will only use tool calling
1567 * instead of embeddings, FTS, recently edited files, etc.
1568 */
1569 codebaseToolCallingOnly?: boolean;
1570
1571 /**
1572 * If enabled, static contextualization will be used to
1573 * gather context for the model where necessary.
1574 */
1575 enableStaticContextualization?: boolean;
1576}
1577
1578export interface AnalyticsConfig {
1579 provider: string;
1580 url?: string;
1581 clientKey?: string;
1582}
1583
1584export interface JSONModelDescription {
1585 title: string;
1586 provider: string;
1587 underlyingProviderName: string;
1588 model: string;
1589 apiKey?: string;
1590 apiBase?: string;
1591
1592 contextLength?: number;
1593 maxStopWords?: number;
1594 template?: TemplateType;
1595 completionOptions?: BaseCompletionOptions;
1596 systemMessage?: string;
1597 requestOptions?: RequestOptions;
1598 cacheBehavior?: CacheBehavior;
1599
1600 region?: string;
1601 profile?: string;
1602 modelArn?: string;
1603 apiType?: "openai" | "azure";
1604 apiVersion?: string;
1605 deployment?: string;
1606 projectId?: string;
1607 accountId?: string;
1608 aiGatewaySlug?: string;
1609 useLegacyCompletionsEndpoint?: boolean;
1610 deploymentId?: string;
1611 isFromAutoDetect?: boolean;
1612}
1613
1614// config.json
1615export interface SerializedContinueConfig {
1616 env?: string[];
1617 allowAnonymousTelemetry?: boolean;
1618 models: JSONModelDescription[];
1619 systemMessage?: string;
1620 completionOptions?: BaseCompletionOptions;
1621 requestOptions?: RequestOptions;
1622 slashCommands?: SlashCommandDescription[];
1623 customCommands?: CustomCommand[];
1624 contextProviders?: ContextProviderWithParams[];
1625 disableIndexing?: boolean;
1626 disableSessionTitles?: boolean;
1627 userToken?: string;
1628 embeddingsProvider?: EmbeddingsProviderDescription;
1629 tabAutocompleteModel?: JSONModelDescription | JSONModelDescription[];
1630 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1631 ui?: ContinueUIConfig;
1632 reranker?: RerankerDescription;
1633 experimental?: ExperimentalConfig;
1634 analytics?: AnalyticsConfig;
1635 docs?: SiteIndexingConfig[];
1636 data?: DataDestination[];
1637}
1638
1639export type ConfigMergeType = "merge" | "overwrite";
1640
1641export type ContinueRcJson = Partial<SerializedContinueConfig> & {
1642 mergeBehavior: ConfigMergeType;
1643};
1644
1645// config.ts - give users simplified interfaces
1646export interface Config {
1647 /** 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 */
1648 allowAnonymousTelemetry?: boolean;
1649 /** Each entry in this array will originally be a JSONModelDescription, the same object from your config.json, but you may add CustomLLMs.
1650 * 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).
1651 * Continue will do the rest of the work to construct prompt templates, handle context items, prune context, etc.
1652 */
1653 models: (CustomLLM | JSONModelDescription)[];
1654 /** A system message to be followed by all of your models */
1655 systemMessage?: string;
1656 /** The default completion options for all models */
1657 completionOptions?: BaseCompletionOptions;
1658 /** Request options that will be applied to all models and context providers */
1659 requestOptions?: RequestOptions;
1660 /** The list of slash commands that will be available in the sidebar */
1661 slashCommands?: (SlashCommand | SlashCommandWithSource)[];
1662 /** Each entry in this array will originally be a ContextProviderWithParams, the same object from your config.json, but you may add CustomContextProviders.
1663 * A CustomContextProvider requires you only to define a title and getContextItems function. When you type '@title <query>', Continue will call `getContextItems(query)`.
1664 */
1665 contextProviders?: (CustomContextProvider | ContextProviderWithParams)[];
1666 /** If set to true, Continue will not index your codebase for retrieval */
1667 disableIndexing?: boolean;
1668 /** If set to true, Continue will not make extra requests to the LLM to generate a summary title of each session. */
1669 disableSessionTitles?: boolean;
1670 /** An optional token to identify a user. Not used by Continue unless you write custom coniguration that requires such a token */
1671 userToken?: string;
1672 /** The provider used to calculate embeddings. If left empty, Continue will use transformers.js to calculate the embeddings with all-MiniLM-L6-v2 */
1673 embeddingsProvider?: EmbeddingsProviderDescription | ILLM;
1674 /** The model that Continue will use for tab autocompletions. */
1675 tabAutocompleteModel?:
1676 | CustomLLM
1677 | JSONModelDescription
1678 | (CustomLLM | JSONModelDescription)[];
1679 /** Options for tab autocomplete */
1680 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1681 /** UI styles customization */
1682 ui?: ContinueUIConfig;
1683 /** Options for the reranker */
1684 reranker?: RerankerDescription | ILLM;
1685 /** Experimental configuration */
1686 experimental?: ExperimentalConfig;
1687 /** Analytics configuration */
1688 analytics?: AnalyticsConfig;
1689 docs?: SiteIndexingConfig[];
1690 data?: DataDestination[];
1691}
1692
1693// in the actual Continue source code
1694export interface ContinueConfig {
1695 allowAnonymousTelemetry?: boolean;
1696 // systemMessage?: string;
1697 completionOptions?: BaseCompletionOptions;
1698 requestOptions?: RequestOptions;
1699 slashCommands: SlashCommandWithSource[];
1700 contextProviders: IContextProvider[];
1701 disableSessionTitles?: boolean;
1702 disableIndexing?: boolean;
1703 userToken?: string;
1704 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1705 ui?: ContinueUIConfig;
1706 experimental?: ExperimentalConfig;
1707 analytics?: AnalyticsConfig;
1708 docs?: SiteIndexingConfig[];
1709 tools: Tool[];
1710 mcpServerStatuses: MCPServerStatus[];
1711 rules: RuleWithSource[];
1712 modelsByRole: Record<ModelRole, ILLM[]>;
1713 selectedModelByRole: Record<ModelRole, ILLM | null>;
1714 data?: DataDestination[];
1715}
1716
1717export interface BrowserSerializedContinueConfig {
1718 allowAnonymousTelemetry?: boolean;
1719 // systemMessage?: string;
1720 completionOptions?: BaseCompletionOptions;
1721 requestOptions?: RequestOptions;
1722 slashCommands: SlashCommandDescWithSource[];
1723 contextProviders: ContextProviderDescription[];
1724 disableIndexing?: boolean;
1725 disableSessionTitles?: boolean;
1726 userToken?: string;
1727 ui?: ContinueUIConfig;
1728 experimental?: ExperimentalConfig;
1729 analytics?: AnalyticsConfig;
1730 docs?: SiteIndexingConfig[];
1731 tools: Tool[];
1732 mcpServerStatuses: MCPServerStatus[];
1733 rules: RuleWithSource[];
1734 usePlatform: boolean;
1735 tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
1736 modelsByRole: Record<ModelRole, ModelDescription[]>;
1737 selectedModelByRole: Record<ModelRole, ModelDescription | null>;
1738}
1739
1740// DOCS SUGGESTIONS AND PACKAGE INFO
1741export interface FilePathAndName {
1742 path: string;
1743 name: string;
1744}
1745
1746export interface PackageFilePathAndName extends FilePathAndName {
1747 packageRegistry: string; // e.g. npm, pypi
1748}
1749
1750export type ParsedPackageInfo = {
1751 name: string;
1752 packageFile: PackageFilePathAndName;
1753 language: string;
1754 version: string;
1755};
1756
1757export type PackageDetails = {
1758 docsLink?: string;
1759 docsLinkWarning?: string;
1760 title?: string;
1761 description?: string;
1762 repo?: string;
1763 license?: string;
1764};
1765
1766export type PackageDetailsSuccess = PackageDetails & {
1767 docsLink: string;
1768};
1769
1770export type PackageDocsResult = {
1771 packageInfo: ParsedPackageInfo;
1772} & (
1773 | { error: string; details?: never }
1774 | { details: PackageDetailsSuccess; error?: never }
1775);
1776
1777export interface TerminalOptions {
1778 reuseTerminal?: boolean;
1779 terminalName?: string;
1780 waitForCompletion?: boolean;
1781}
1782
1783export type RuleSource =
1784 | "default-chat"
1785 | "default-plan"
1786 | "default-agent"
1787 | "model-options-chat"
1788 | "model-options-plan"
1789 | "model-options-agent"
1790 | "rules-block"
1791 | "colocated-markdown"
1792 | "json-systemMessage"
1793 | ".continuerules";
1794
1795export interface RuleWithSource {
1796 name?: string;
1797 slug?: string;
1798 source: RuleSource;
1799 globs?: string | string[];
1800 regex?: string | string[];
1801 rule: string;
1802 description?: string;
1803 ruleFile?: string;
1804 alwaysApply?: boolean;
1805}
1806export interface CompleteOnboardingPayload {
1807 mode: OnboardingModes;
1808 provider?: string;
1809 apiKey?: string;
1810}
1811
1812export interface CompiledMessagesResult {
1813 compiledChatMessages: ChatMessage[];
1814 didPrune: boolean;
1815 contextPercentage: number;
1816}
1817
1818export interface MessageOption {
1819 precompiled: boolean;
1820}
1821
1822/* LSP-specific interfaces. */
1823
1824// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind.
1825// We shift this one index down to match vscode.SymbolKind.
1826export enum SymbolKind {
1827 File = 0,
1828 Module = 1,
1829 Namespace = 2,
1830 Package = 3,
1831 Class = 4,
1832 Method = 5,
1833 Property = 6,
1834 Field = 7,
1835 Constructor = 8,
1836 Enum = 9,
1837 Interface = 10,
1838 Function = 11,
1839 Variable = 12,
1840 Constant = 13,
1841 String = 14,
1842 Number = 15,
1843 Boolean = 16,
1844 Array = 17,
1845 Object = 18,
1846 Key = 19,
1847 Null = 20,
1848 EnumMember = 21,
1849 Struct = 22,
1850 Event = 23,
1851 Operator = 24,
1852 TypeParameter = 25,
1853}
1854
1855// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag.
1856export namespace SymbolTag {
1857 export const Deprecated: 1 = 1;
1858}
1859
1860// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag.
1861export type SymbolTag = 1;
1862
1863// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentSymbol.
1864export interface DocumentSymbol {
1865 name: string;
1866 detail?: string;
1867 kind: SymbolKind;
1868 tags?: SymbolTag[];
1869 deprecated?: boolean;
1870 range: Range;
1871 selectionRange: Range;
1872 children?: DocumentSymbol[];
1873}