| 1 | import { |
| 2 | DataDestination, |
| 3 | ModelRole, |
| 4 | PromptTemplates, |
| 5 | } from "@continuedev/config-yaml"; |
| 6 | import Parser from "web-tree-sitter"; |
| 7 | import { CodebaseIndexer } from "./indexing/CodebaseIndexer"; |
| 8 | import { LLMConfigurationStatuses } from "./llm/constants"; |
| 9 | |
| 10 | declare 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 | |
| 33 | export interface ChunkWithoutID { |
| 34 | content: string; |
| 35 | startLine: number; |
| 36 | endLine: number; |
| 37 | signature?: string; |
| 38 | otherMetadata?: { [key: string]: any }; |
| 39 | } |
| 40 | |
| 41 | export interface Chunk extends ChunkWithoutID { |
| 42 | digest: string; |
| 43 | filepath: string; |
| 44 | index: number; // Index of the chunk in the document at filepath |
| 45 | } |
| 46 | |
| 47 | export 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. |
| 65 | export 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 | |
| 79 | export type PromptTemplateFunction = ( |
| 80 | history: ChatMessage[], |
| 81 | otherData: Record<string, string>, |
| 82 | ) => string | ChatMessage[]; |
| 83 | |
| 84 | export type PromptTemplate = string | PromptTemplateFunction; |
| 85 | |
| 86 | type RequiredLLMOptions = |
| 87 | | "uniqueId" |
| 88 | | "contextLength" |
| 89 | | "embeddingId" |
| 90 | | "maxEmbeddingChunkSize" |
| 91 | | "maxEmbeddingBatchSize" |
| 92 | | "completionOptions"; |
| 93 | |
| 94 | export 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 | |
| 165 | export 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 | |
| 175 | export type ContextProviderType = "normal" | "query" | "submenu"; |
| 176 | export type ContextIndexingType = |
| 177 | | "chunk" |
| 178 | | "embeddings" |
| 179 | | "fullTextSearch" |
| 180 | | "codeSnippets"; |
| 181 | |
| 182 | export interface ContextProviderDescription { |
| 183 | title: ContextProviderName; |
| 184 | displayTitle: string; |
| 185 | description: string; |
| 186 | renderInlineAs?: string; |
| 187 | type: ContextProviderType; |
| 188 | dependsOnIndexing?: ContextIndexingType[]; |
| 189 | } |
| 190 | |
| 191 | export type FetchFunction = (url: string | URL, init?: any) => Promise<any>; |
| 192 | |
| 193 | export interface ContextProviderExtras { |
| 194 | config: ContinueConfig; |
| 195 | fullInput: string; |
| 196 | embeddingsProvider: ILLM | null; |
| 197 | reranker: ILLM | null; |
| 198 | llm: ILLM; |
| 199 | ide: IDE; |
| 200 | selectedCode: RangeInFile[]; |
| 201 | fetch: FetchFunction; |
| 202 | isInAgentMode: boolean; |
| 203 | } |
| 204 | |
| 205 | export interface LoadSubmenuItemsArgs { |
| 206 | config: ContinueConfig; |
| 207 | ide: IDE; |
| 208 | fetch: FetchFunction; |
| 209 | } |
| 210 | |
| 211 | export interface CustomContextProvider { |
| 212 | title: string; |
| 213 | displayTitle?: string; |
| 214 | description?: string; |
| 215 | renderInlineAs?: string; |
| 216 | type?: ContextProviderType; |
| 217 | loadSubmenuItems?: ( |
| 218 | args: LoadSubmenuItemsArgs, |
| 219 | ) => Promise<ContextSubmenuItem[]>; |
| 220 | |
| 221 | getContextItems( |
| 222 | query: string, |
| 223 | extras: ContextProviderExtras, |
| 224 | ): Promise<ContextItem[]>; |
| 225 | } |
| 226 | |
| 227 | export interface ContextSubmenuItem { |
| 228 | id: string; |
| 229 | title: string; |
| 230 | description: string; |
| 231 | icon?: string; |
| 232 | metadata?: any; |
| 233 | } |
| 234 | |
| 235 | export interface ContextSubmenuItemWithProvider extends ContextSubmenuItem { |
| 236 | providerTitle: string; |
| 237 | } |
| 238 | |
| 239 | export interface SiteIndexingConfig { |
| 240 | title: string; |
| 241 | startUrl: string; |
| 242 | maxDepth?: number; |
| 243 | faviconUrl?: string; |
| 244 | useLocalCrawling?: boolean; |
| 245 | sourceFile?: string; |
| 246 | } |
| 247 | |
| 248 | export interface DocsIndexingDetails { |
| 249 | startUrl: string; |
| 250 | config: SiteIndexingConfig; |
| 251 | indexingStatus: IndexingStatus | undefined; |
| 252 | chunks: Chunk[]; |
| 253 | } |
| 254 | |
| 255 | export interface IContextProvider { |
| 256 | get description(): ContextProviderDescription; |
| 257 | |
| 258 | getContextItems( |
| 259 | query: string, |
| 260 | extras: ContextProviderExtras, |
| 261 | ): Promise<ContextItem[]>; |
| 262 | |
| 263 | loadSubmenuItems(args: LoadSubmenuItemsArgs): Promise<ContextSubmenuItem[]>; |
| 264 | |
| 265 | get deprecationMessage(): string | null; |
| 266 | } |
| 267 | |
| 268 | export interface Session { |
| 269 | sessionId: string; |
| 270 | title: string; |
| 271 | workspaceDirectory: string; |
| 272 | history: ChatHistoryItem[]; |
| 273 | } |
| 274 | |
| 275 | export interface BaseSessionMetadata { |
| 276 | sessionId: string; |
| 277 | title: string; |
| 278 | dateCreated: string; |
| 279 | workspaceDirectory: string; |
| 280 | } |
| 281 | |
| 282 | export interface RangeInFile { |
| 283 | filepath: string; |
| 284 | range: Range; |
| 285 | } |
| 286 | |
| 287 | export interface Location { |
| 288 | filepath: string; |
| 289 | position: Position; |
| 290 | } |
| 291 | |
| 292 | export interface FileWithContents { |
| 293 | filepath: string; |
| 294 | contents: string; |
| 295 | } |
| 296 | |
| 297 | export interface Range { |
| 298 | start: Position; |
| 299 | end: Position; |
| 300 | } |
| 301 | |
| 302 | export interface Position { |
| 303 | line: number; |
| 304 | character: number; |
| 305 | } |
| 306 | |
| 307 | export interface FileEdit { |
| 308 | filepath: string; |
| 309 | range: Range; |
| 310 | replacement: string; |
| 311 | } |
| 312 | |
| 313 | export interface CompletionOptions extends BaseCompletionOptions { |
| 314 | model: string; |
| 315 | } |
| 316 | |
| 317 | export type ChatMessageRole = |
| 318 | | "user" |
| 319 | | "assistant" |
| 320 | | "thinking" |
| 321 | | "system" |
| 322 | | "tool"; |
| 323 | |
| 324 | export type TextMessagePart = { |
| 325 | type: "text"; |
| 326 | text: string; |
| 327 | }; |
| 328 | |
| 329 | export type ImageMessagePart = { |
| 330 | type: "imageUrl"; |
| 331 | imageUrl: { url: string }; |
| 332 | }; |
| 333 | |
| 334 | export type MessagePart = TextMessagePart | ImageMessagePart; |
| 335 | |
| 336 | export type MessageContent = string | MessagePart[]; |
| 337 | |
| 338 | export interface ToolCall { |
| 339 | id: string; |
| 340 | type: "function"; |
| 341 | function: { |
| 342 | name: string; |
| 343 | arguments: string; |
| 344 | }; |
| 345 | } |
| 346 | |
| 347 | export interface ToolCallDelta { |
| 348 | id?: string; |
| 349 | type?: "function"; |
| 350 | function?: { |
| 351 | name?: string; |
| 352 | arguments?: string; |
| 353 | }; |
| 354 | } |
| 355 | |
| 356 | export interface ToolResultChatMessage { |
| 357 | role: "tool"; |
| 358 | content: string; |
| 359 | toolCallId: string; |
| 360 | } |
| 361 | |
| 362 | export interface UserChatMessage { |
| 363 | role: "user"; |
| 364 | content: MessageContent; |
| 365 | } |
| 366 | |
| 367 | export 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 | */ |
| 379 | export 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 | |
| 396 | export interface AssistantChatMessage { |
| 397 | role: "assistant"; |
| 398 | content: MessageContent; |
| 399 | toolCalls?: ToolCallDelta[]; |
| 400 | usage?: Usage; |
| 401 | } |
| 402 | |
| 403 | export interface SystemChatMessage { |
| 404 | role: "system"; |
| 405 | content: string; |
| 406 | } |
| 407 | |
| 408 | export type ChatMessage = |
| 409 | | UserChatMessage |
| 410 | | AssistantChatMessage |
| 411 | | ThinkingChatMessage |
| 412 | | SystemChatMessage |
| 413 | | ToolResultChatMessage; |
| 414 | |
| 415 | export interface ContextItemId { |
| 416 | providerTitle: string; |
| 417 | itemId: string; |
| 418 | } |
| 419 | |
| 420 | export type ContextItemUriTypes = "file" | "url"; |
| 421 | |
| 422 | export interface ContextItemUri { |
| 423 | type: ContextItemUriTypes; |
| 424 | value: string; |
| 425 | } |
| 426 | |
| 427 | export 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 | |
| 439 | export interface ContextItemWithId extends ContextItem { |
| 440 | id: ContextItemId; |
| 441 | } |
| 442 | |
| 443 | export interface InputModifiers { |
| 444 | useCodebase: boolean; |
| 445 | noContext: boolean; |
| 446 | } |
| 447 | |
| 448 | export interface SymbolWithRange extends RangeInFile { |
| 449 | name: string; |
| 450 | type: Parser.SyntaxNode["type"]; |
| 451 | content: string; |
| 452 | } |
| 453 | |
| 454 | export type FileSymbolMap = Record<string, SymbolWithRange[]>; |
| 455 | |
| 456 | export interface PromptLog { |
| 457 | modelTitle: string; |
| 458 | modelProvider: string; |
| 459 | prompt: string; |
| 460 | completion: string; |
| 461 | } |
| 462 | |
| 463 | export type MessageModes = "chat" | "agent" | "plan"; |
| 464 | |
| 465 | export 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 |
| 474 | interface ToolCallState { |
| 475 | toolCallId: string; |
| 476 | toolCall: ToolCall; |
| 477 | status: ToolStatus; |
| 478 | parsedArgs: any; |
| 479 | output?: ContextItem[]; |
| 480 | tool?: Tool; |
| 481 | } |
| 482 | |
| 483 | interface Reasoning { |
| 484 | active: boolean; |
| 485 | text: string; |
| 486 | startAt: number; |
| 487 | endAt?: number; |
| 488 | } |
| 489 | |
| 490 | export 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 | |
| 503 | export interface LLMFullCompletionOptions extends BaseCompletionOptions { |
| 504 | log?: boolean; |
| 505 | model?: string; |
| 506 | } |
| 507 | |
| 508 | export type ToastType = "info" | "error" | "warning"; |
| 509 | |
| 510 | export interface LLMInteractionBase { |
| 511 | interactionId: string; |
| 512 | timestamp: number; |
| 513 | } |
| 514 | |
| 515 | export interface LLMInteractionStartChat extends LLMInteractionBase { |
| 516 | kind: "startChat"; |
| 517 | messages: ChatMessage[]; |
| 518 | options: CompletionOptions; |
| 519 | provider: string; |
| 520 | } |
| 521 | |
| 522 | export interface LLMInteractionStartComplete extends LLMInteractionBase { |
| 523 | kind: "startComplete"; |
| 524 | prompt: string; |
| 525 | options: CompletionOptions; |
| 526 | provider: string; |
| 527 | } |
| 528 | |
| 529 | export interface LLMInteractionStartFim extends LLMInteractionBase { |
| 530 | kind: "startFim"; |
| 531 | prefix: string; |
| 532 | suffix: string; |
| 533 | options: CompletionOptions; |
| 534 | provider: string; |
| 535 | } |
| 536 | |
| 537 | export interface LLMInteractionChunk extends LLMInteractionBase { |
| 538 | kind: "chunk"; |
| 539 | chunk: string; |
| 540 | } |
| 541 | |
| 542 | export interface LLMInteractionMessage extends LLMInteractionBase { |
| 543 | kind: "message"; |
| 544 | message: ChatMessage; |
| 545 | } |
| 546 | |
| 547 | export interface LLMInteractionEnd extends LLMInteractionBase { |
| 548 | promptTokens: number; |
| 549 | generatedTokens: number; |
| 550 | thinkingTokens: number; |
| 551 | usage: Usage | undefined; |
| 552 | } |
| 553 | |
| 554 | export interface LLMInteractionSuccess extends LLMInteractionEnd { |
| 555 | kind: "success"; |
| 556 | } |
| 557 | |
| 558 | export interface LLMInteractionCancel extends LLMInteractionEnd { |
| 559 | kind: "cancel"; |
| 560 | } |
| 561 | |
| 562 | export interface LLMInteractionError extends LLMInteractionEnd { |
| 563 | kind: "error"; |
| 564 | name: string; |
| 565 | message: string; |
| 566 | } |
| 567 | |
| 568 | export 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 |
| 585 | type DistributiveOmit<T, K extends PropertyKey> = T extends unknown |
| 586 | ? Omit<T, K> |
| 587 | : never; |
| 588 | |
| 589 | export type LLMInteractionItemDetails = DistributiveOmit< |
| 590 | LLMInteractionItem, |
| 591 | "interactionId" | "timestamp" |
| 592 | >; |
| 593 | |
| 594 | export interface ILLMInteractionLog { |
| 595 | logItem(item: LLMInteractionItemDetails): void; |
| 596 | } |
| 597 | |
| 598 | export interface ILLMLogger { |
| 599 | createInteractionLog(): ILLMInteractionLog; |
| 600 | } |
| 601 | |
| 602 | export 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 | |
| 671 | type 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 | |
| 679 | export 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 | */ |
| 701 | export type CustomLLM = RequireAtLeastOne< |
| 702 | CustomLLMWithOptionals, |
| 703 | "streamCompletion" | "streamChat" |
| 704 | >; |
| 705 | |
| 706 | // IDE |
| 707 | |
| 708 | export type DiffType = "new" | "old" | "same"; |
| 709 | |
| 710 | export interface DiffObject { |
| 711 | type: DiffType; |
| 712 | } |
| 713 | |
| 714 | export interface DiffLine extends DiffObject { |
| 715 | line: string; |
| 716 | } |
| 717 | |
| 718 | interface 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 | |
| 728 | export interface Problem { |
| 729 | filepath: string; |
| 730 | range: Range; |
| 731 | message: string; |
| 732 | } |
| 733 | |
| 734 | export interface Thread { |
| 735 | name: string; |
| 736 | id: number; |
| 737 | } |
| 738 | |
| 739 | export type IdeType = "vscode" | "jetbrains"; |
| 740 | |
| 741 | export interface IdeInfo { |
| 742 | ideType: IdeType; |
| 743 | name: string; |
| 744 | version: string; |
| 745 | remoteName: string; |
| 746 | extensionVersion: string; |
| 747 | isPrerelease: boolean; |
| 748 | } |
| 749 | |
| 750 | export interface BranchAndDir { |
| 751 | branch: string; |
| 752 | directory: string; |
| 753 | } |
| 754 | |
| 755 | export interface IndexTag extends BranchAndDir { |
| 756 | artifactId: string; |
| 757 | } |
| 758 | |
| 759 | export enum FileType { |
| 760 | Unkown = 0, |
| 761 | File = 1, |
| 762 | Directory = 2, |
| 763 | SymbolicLink = 64, |
| 764 | } |
| 765 | |
| 766 | export interface IdeSettings { |
| 767 | remoteConfigServerUrl: string | undefined; |
| 768 | remoteConfigSyncPeriod: number; |
| 769 | userToken: string; |
| 770 | continueTestEnvironment: "none" | "production" | "staging" | "local"; |
| 771 | pauseCodebaseIndexOnStart: boolean; |
| 772 | } |
| 773 | |
| 774 | export interface FileStats { |
| 775 | size: number; |
| 776 | lastModified: number; |
| 777 | } |
| 778 | |
| 779 | /** Map of file name to stats */ |
| 780 | export type FileStatsMap = { |
| 781 | [path: string]: FileStats; |
| 782 | }; |
| 783 | |
| 784 | export 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 | getExternalUri?(uri: string): Promise<string>; |
| 823 | |
| 824 | runCommand(command: string, options?: TerminalOptions): Promise<void>; |
| 825 | |
| 826 | saveFile(fileUri: string): Promise<void>; |
| 827 | |
| 828 | readFile(fileUri: string): Promise<string>; |
| 829 | |
| 830 | readRangeInFile(fileUri: string, range: Range): Promise<string>; |
| 831 | |
| 832 | showLines(fileUri: string, startLine: number, endLine: number): Promise<void>; |
| 833 | |
| 834 | getOpenFiles(): Promise<string[]>; |
| 835 | |
| 836 | getCurrentFile(): Promise< |
| 837 | | undefined |
| 838 | | { |
| 839 | isUntitled: boolean; |
| 840 | path: string; |
| 841 | contents: string; |
| 842 | } |
| 843 | >; |
| 844 | |
| 845 | getPinnedFiles(): Promise<string[]>; |
| 846 | |
| 847 | getSearchResults(query: string, maxResults?: number): Promise<string>; |
| 848 | |
| 849 | getFileResults(pattern: string, maxResults?: number): Promise<string[]>; |
| 850 | |
| 851 | subprocess(command: string, cwd?: string): Promise<[string, string]>; |
| 852 | |
| 853 | getProblems(fileUri?: string | undefined): Promise<Problem[]>; |
| 854 | |
| 855 | getBranch(dir: string): Promise<string>; |
| 856 | |
| 857 | getTags(artifactId: string): Promise<IndexTag[]>; |
| 858 | |
| 859 | getRepoName(dir: string): Promise<string | undefined>; |
| 860 | |
| 861 | showToast( |
| 862 | type: ToastType, |
| 863 | message: string, |
| 864 | ...otherParams: any[] |
| 865 | ): Promise<any>; |
| 866 | |
| 867 | getGitRootPath(dir: string): Promise<string | undefined>; |
| 868 | |
| 869 | listDir(dir: string): Promise<[string, FileType][]>; |
| 870 | |
| 871 | getFileStats(files: string[]): Promise<FileStatsMap>; |
| 872 | |
| 873 | // Secret Storage |
| 874 | readSecrets(keys: string[]): Promise<Record<string, string>>; |
| 875 | |
| 876 | writeSecrets(secrets: { [key: string]: string }): Promise<void>; |
| 877 | |
| 878 | // LSP |
| 879 | gotoDefinition(location: Location): Promise<RangeInFile[]>; |
| 880 | gotoTypeDefinition(location: Location): Promise<RangeInFile[]>; // TODO: add to jetbrains |
| 881 | getSignatureHelp(location: Location): Promise<SignatureHelp | null>; // TODO: add to jetbrains |
| 882 | getReferences(location: Location): Promise<RangeInFile[]>; |
| 883 | getDocumentSymbols(textDocumentIdentifier: string): Promise<DocumentSymbol[]>; |
| 884 | |
| 885 | // Callbacks |
| 886 | onDidChangeActiveTextEditor(callback: (fileUri: string) => void): void; |
| 887 | } |
| 888 | |
| 889 | // Slash Commands |
| 890 | |
| 891 | export interface ContinueSDK { |
| 892 | ide: IDE; |
| 893 | llm: ILLM; |
| 894 | addContextItem: (item: ContextItemWithId) => void; |
| 895 | history: ChatMessage[]; |
| 896 | input: string; |
| 897 | params?: { [key: string]: any } | undefined; |
| 898 | contextItems: ContextItemWithId[]; |
| 899 | selectedCode: RangeInFile[]; |
| 900 | config: ContinueConfig; |
| 901 | fetch: FetchFunction; |
| 902 | completionOptions?: LLMFullCompletionOptions; |
| 903 | abortController: AbortController; |
| 904 | } |
| 905 | |
| 906 | /* Be careful changing SlashCommand or SlashCommandDescription, config.ts can break */ |
| 907 | export interface SlashCommandDescription { |
| 908 | name: string; |
| 909 | description: string; |
| 910 | prompt?: string; |
| 911 | params?: { [key: string]: any }; |
| 912 | } |
| 913 | |
| 914 | export interface SlashCommand extends SlashCommandDescription { |
| 915 | run: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>; |
| 916 | } |
| 917 | |
| 918 | export interface SlashCommandWithSource extends SlashCommandDescription { |
| 919 | run?: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>; // Optional - only needed for legacy |
| 920 | source: SlashCommandSource; |
| 921 | promptFile?: string; |
| 922 | overrideSystemMessage?: string; |
| 923 | } |
| 924 | |
| 925 | export type SlashCommandSource = |
| 926 | | "built-in-legacy" |
| 927 | | "built-in" |
| 928 | | "json-custom-command" |
| 929 | | "config-ts-slash-command" |
| 930 | | "yaml-prompt-block" |
| 931 | | "mcp-prompt" |
| 932 | | "prompt-file-v1" |
| 933 | | "prompt-file-v2" |
| 934 | | "invokable-rule"; |
| 935 | |
| 936 | export interface SlashCommandDescWithSource extends SlashCommandDescription { |
| 937 | isLegacy: boolean; // Maps to if slashcommand.run exists |
| 938 | source: SlashCommandSource; |
| 939 | promptFile?: string; |
| 940 | mcpServerName?: string; |
| 941 | mcpArgs?: MCPPromptArgs; |
| 942 | } |
| 943 | |
| 944 | // Config |
| 945 | |
| 946 | export type StepName = |
| 947 | | "AnswerQuestionChroma" |
| 948 | | "GenerateShellCommandStep" |
| 949 | | "EditHighlightedCodeStep" |
| 950 | | "ShareSessionStep" |
| 951 | | "CommentCodeStep" |
| 952 | | "ClearHistoryStep" |
| 953 | | "StackOverflowStep" |
| 954 | | "OpenConfigStep" |
| 955 | | "GenerateShellCommandStep" |
| 956 | | "DraftIssueStep"; |
| 957 | |
| 958 | export type ContextProviderName = |
| 959 | | "diff" |
| 960 | | "terminal" |
| 961 | | "debugger" |
| 962 | | "open" |
| 963 | | "google" |
| 964 | | "search" |
| 965 | | "tree" |
| 966 | | "http" |
| 967 | | "codebase" |
| 968 | | "problems" |
| 969 | | "folder" |
| 970 | | "jira" |
| 971 | | "postgres" |
| 972 | | "database" |
| 973 | | "code" |
| 974 | | "docs" |
| 975 | | "gitlab-mr" |
| 976 | | "os" |
| 977 | | "currentFile" |
| 978 | | "greptile" |
| 979 | | "outline" |
| 980 | | "continue-proxy" |
| 981 | | "highlights" |
| 982 | | "file" |
| 983 | | "issue" |
| 984 | | "repo-map" |
| 985 | | "url" |
| 986 | | "commit" |
| 987 | | "web" |
| 988 | | "discord" |
| 989 | | "clipboard" |
| 990 | | string; |
| 991 | |
| 992 | export type TemplateType = |
| 993 | | "llama2" |
| 994 | | "alpaca" |
| 995 | | "zephyr" |
| 996 | | "phi2" |
| 997 | | "phind" |
| 998 | | "anthropic" |
| 999 | | "chatml" |
| 1000 | | "none" |
| 1001 | | "openchat" |
| 1002 | | "deepseek" |
| 1003 | | "xwin-coder" |
| 1004 | | "neural-chat" |
| 1005 | | "codellama-70b" |
| 1006 | | "llava" |
| 1007 | | "gemma" |
| 1008 | | "granite" |
| 1009 | | "llama3" |
| 1010 | | "codestral"; |
| 1011 | |
| 1012 | export interface RequestOptions { |
| 1013 | timeout?: number; |
| 1014 | verifySsl?: boolean; |
| 1015 | caBundlePath?: string | string[]; |
| 1016 | proxy?: string; |
| 1017 | headers?: { [key: string]: string }; |
| 1018 | extraBodyProperties?: { [key: string]: any }; |
| 1019 | noProxy?: string[]; |
| 1020 | clientCertificate?: ClientCertificateOptions; |
| 1021 | } |
| 1022 | |
| 1023 | export interface CacheBehavior { |
| 1024 | cacheSystemMessage?: boolean; |
| 1025 | cacheConversation?: boolean; |
| 1026 | } |
| 1027 | |
| 1028 | export interface ClientCertificateOptions { |
| 1029 | cert: string; |
| 1030 | key: string; |
| 1031 | passphrase?: string; |
| 1032 | } |
| 1033 | |
| 1034 | export interface StepWithParams { |
| 1035 | name: StepName; |
| 1036 | params: { [key: string]: any }; |
| 1037 | } |
| 1038 | |
| 1039 | export interface ContextProviderWithParams { |
| 1040 | name: ContextProviderName; |
| 1041 | params: { [key: string]: any }; |
| 1042 | } |
| 1043 | |
| 1044 | export interface CustomCommand { |
| 1045 | name: string; |
| 1046 | prompt: string; |
| 1047 | description?: string; |
| 1048 | sourceFile?: string; |
| 1049 | } |
| 1050 | |
| 1051 | export interface Prediction { |
| 1052 | type: "content"; |
| 1053 | content: |
| 1054 | | string |
| 1055 | | { |
| 1056 | type: "text"; |
| 1057 | text: string; |
| 1058 | }[]; |
| 1059 | } |
| 1060 | |
| 1061 | export interface ToolExtras { |
| 1062 | ide: IDE; |
| 1063 | llm: ILLM; |
| 1064 | fetch: FetchFunction; |
| 1065 | tool: Tool; |
| 1066 | toolCallId?: string; |
| 1067 | onPartialOutput?: (params: { |
| 1068 | toolCallId: string; |
| 1069 | contextItems: ContextItem[]; |
| 1070 | }) => void; |
| 1071 | config: ContinueConfig; |
| 1072 | codeBaseIndexer?: CodebaseIndexer; |
| 1073 | } |
| 1074 | |
| 1075 | export interface Tool { |
| 1076 | type: "function"; |
| 1077 | function: { |
| 1078 | name: string; |
| 1079 | description?: string; |
| 1080 | parameters?: Record<string, any>; |
| 1081 | strict?: boolean | null; |
| 1082 | }; |
| 1083 | |
| 1084 | displayTitle: string; |
| 1085 | wouldLikeTo?: string; |
| 1086 | isCurrently?: string; |
| 1087 | hasAlready?: string; |
| 1088 | readonly: boolean; |
| 1089 | isInstant?: boolean; |
| 1090 | uri?: string; |
| 1091 | faviconUrl?: string; |
| 1092 | group: string; |
| 1093 | originalFunctionName?: string; |
| 1094 | systemMessageDescription?: { |
| 1095 | prefix: string; |
| 1096 | exampleArgs?: Array<[string, string | number]>; |
| 1097 | }; |
| 1098 | defaultToolPolicy?: ToolPolicy; |
| 1099 | toolCallIcon?: string; |
| 1100 | evaluateToolCallPolicy?: ( |
| 1101 | basePolicy: ToolPolicy, |
| 1102 | parsedArgs: Record<string, unknown>, |
| 1103 | ) => ToolPolicy; |
| 1104 | } |
| 1105 | |
| 1106 | interface ToolChoice { |
| 1107 | type: "function"; |
| 1108 | function: { |
| 1109 | name: string; |
| 1110 | }; |
| 1111 | } |
| 1112 | |
| 1113 | export interface ConfigDependentToolParams { |
| 1114 | rules: RuleWithSource[]; |
| 1115 | enableExperimentalTools: boolean; |
| 1116 | isSignedIn: boolean; |
| 1117 | isRemote: boolean; |
| 1118 | modelName: string | undefined; |
| 1119 | } |
| 1120 | |
| 1121 | export type GetTool = (params: ConfigDependentToolParams) => Tool; |
| 1122 | |
| 1123 | export interface BaseCompletionOptions { |
| 1124 | temperature?: number; |
| 1125 | topP?: number; |
| 1126 | topK?: number; |
| 1127 | minP?: number; |
| 1128 | presencePenalty?: number; |
| 1129 | frequencyPenalty?: number; |
| 1130 | mirostat?: number; |
| 1131 | stop?: string[]; |
| 1132 | maxTokens?: number; |
| 1133 | numThreads?: number; |
| 1134 | useMmap?: boolean; |
| 1135 | keepAlive?: number; |
| 1136 | numGpu?: number; |
| 1137 | raw?: boolean; |
| 1138 | stream?: boolean; |
| 1139 | prediction?: Prediction; |
| 1140 | tools?: Tool[]; |
| 1141 | toolChoice?: ToolChoice; |
| 1142 | reasoning?: boolean; |
| 1143 | reasoningBudgetTokens?: number; |
| 1144 | promptCaching?: boolean; |
| 1145 | } |
| 1146 | |
| 1147 | export interface ModelCapability { |
| 1148 | uploadImage?: boolean; |
| 1149 | tools?: boolean; |
| 1150 | nextEdit?: boolean; |
| 1151 | } |
| 1152 | |
| 1153 | export interface ModelDescription { |
| 1154 | title: string; |
| 1155 | provider: string; |
| 1156 | underlyingProviderName: string; |
| 1157 | model: string; |
| 1158 | apiKey?: string; |
| 1159 | |
| 1160 | apiBase?: string; |
| 1161 | apiKeyLocation?: string; |
| 1162 | envSecretLocations?: Record<string, string>; |
| 1163 | orgScopeId?: string | null; |
| 1164 | |
| 1165 | onPremProxyUrl?: string | null; |
| 1166 | |
| 1167 | contextLength?: number; |
| 1168 | maxStopWords?: number; |
| 1169 | template?: TemplateType; |
| 1170 | completionOptions?: BaseCompletionOptions; |
| 1171 | baseAgentSystemMessage?: string; |
| 1172 | basePlanSystemMessage?: string; |
| 1173 | baseChatSystemMessage?: string; |
| 1174 | requestOptions?: RequestOptions; |
| 1175 | promptTemplates?: { [key: string]: string }; |
| 1176 | cacheBehavior?: CacheBehavior; |
| 1177 | capabilities?: ModelCapability; |
| 1178 | roles?: ModelRole[]; |
| 1179 | configurationStatus?: LLMConfigurationStatuses; |
| 1180 | |
| 1181 | sourceFile?: string; |
| 1182 | isFromAutoDetect?: boolean; |
| 1183 | } |
| 1184 | |
| 1185 | export interface JSONEmbedOptions { |
| 1186 | apiBase?: string; |
| 1187 | apiKey?: string; |
| 1188 | model?: string; |
| 1189 | deployment?: string; |
| 1190 | apiType?: string; |
| 1191 | apiVersion?: string; |
| 1192 | requestOptions?: RequestOptions; |
| 1193 | maxEmbeddingChunkSize?: number; |
| 1194 | maxEmbeddingBatchSize?: number; |
| 1195 | |
| 1196 | // AWS options |
| 1197 | profile?: string; |
| 1198 | |
| 1199 | // AWS and VertexAI Options |
| 1200 | region?: string; |
| 1201 | |
| 1202 | // VertexAI and Watsonx Options |
| 1203 | projectId?: string; |
| 1204 | } |
| 1205 | |
| 1206 | export interface EmbeddingsProviderDescription extends JSONEmbedOptions { |
| 1207 | provider: string; |
| 1208 | } |
| 1209 | |
| 1210 | export interface RerankerDescription { |
| 1211 | name: string; |
| 1212 | params?: { [key: string]: any }; |
| 1213 | } |
| 1214 | |
| 1215 | // TODO: We should consider renaming this to AutocompleteOptions. |
| 1216 | export interface TabAutocompleteOptions { |
| 1217 | disable: boolean; |
| 1218 | maxPromptTokens: number; |
| 1219 | debounceDelay: number; |
| 1220 | modelTimeout: number; |
| 1221 | maxSuffixPercentage: number; |
| 1222 | prefixPercentage: number; |
| 1223 | transform?: boolean; |
| 1224 | template?: string; |
| 1225 | multilineCompletions: "always" | "never" | "auto"; |
| 1226 | slidingWindowPrefixPercentage: number; |
| 1227 | slidingWindowSize: number; |
| 1228 | useCache: boolean; |
| 1229 | onlyMyCode: boolean; |
| 1230 | useRecentlyEdited: boolean; |
| 1231 | useRecentlyOpened: boolean; |
| 1232 | disableInFiles?: string[]; |
| 1233 | useImports?: boolean; |
| 1234 | showWhateverWeHaveAtXMs?: number; |
| 1235 | // true = enabled, false = disabled, number = enabled with priority |
| 1236 | experimental_includeClipboard: boolean | number; |
| 1237 | experimental_includeRecentlyVisitedRanges: boolean | number; |
| 1238 | experimental_includeRecentlyEditedRanges: boolean | number; |
| 1239 | experimental_includeDiff: boolean | number; |
| 1240 | experimental_enableStaticContextualization: boolean; |
| 1241 | } |
| 1242 | |
| 1243 | export interface StdioOptions { |
| 1244 | type: "stdio"; |
| 1245 | command: string; |
| 1246 | args: string[]; |
| 1247 | env?: Record<string, string>; |
| 1248 | cwd?: string; |
| 1249 | } |
| 1250 | |
| 1251 | export interface WebSocketOptions { |
| 1252 | type: "websocket"; |
| 1253 | url: string; |
| 1254 | requestOptions?: RequestOptions; |
| 1255 | } |
| 1256 | |
| 1257 | export interface SSEOptions { |
| 1258 | type: "sse"; |
| 1259 | url: string; |
| 1260 | requestOptions?: RequestOptions; |
| 1261 | } |
| 1262 | |
| 1263 | export interface StreamableHTTPOptions { |
| 1264 | type: "streamable-http"; |
| 1265 | url: string; |
| 1266 | requestOptions?: RequestOptions; |
| 1267 | } |
| 1268 | |
| 1269 | export type TransportOptions = |
| 1270 | | StdioOptions |
| 1271 | | WebSocketOptions |
| 1272 | | SSEOptions |
| 1273 | | StreamableHTTPOptions; |
| 1274 | |
| 1275 | export type MCPConnectionStatus = |
| 1276 | | "connecting" |
| 1277 | | "connected" |
| 1278 | | "error" |
| 1279 | | "authenticating" |
| 1280 | | "not-connected"; |
| 1281 | |
| 1282 | export type MCPPromptArgs = { |
| 1283 | name: string; |
| 1284 | description?: string; |
| 1285 | required?: boolean; |
| 1286 | }[]; |
| 1287 | |
| 1288 | export interface MCPPrompt { |
| 1289 | name: string; |
| 1290 | description?: string; |
| 1291 | arguments?: MCPPromptArgs; |
| 1292 | } |
| 1293 | |
| 1294 | // Leaving here to ideate on |
| 1295 | // export type ContinueConfigSource = "local-yaml" | "local-json" | "hub-assistant" | "hub" |
| 1296 | |
| 1297 | // https://modelcontextprotocol.io/docs/concepts/resources#direct-resources |
| 1298 | export interface MCPResource { |
| 1299 | name: string; |
| 1300 | uri: string; |
| 1301 | description?: string; |
| 1302 | mimeType?: string; |
| 1303 | } |
| 1304 | |
| 1305 | // https://modelcontextprotocol.io/docs/concepts/resources#resource-templates |
| 1306 | export interface MCPResourceTemplate { |
| 1307 | uriTemplate: string; |
| 1308 | name: string; |
| 1309 | description?: string; |
| 1310 | mimeType?: string; |
| 1311 | } |
| 1312 | |
| 1313 | export interface MCPTool { |
| 1314 | name: string; |
| 1315 | description?: string; |
| 1316 | inputSchema: { |
| 1317 | type: "object"; |
| 1318 | properties?: Record<string, any>; |
| 1319 | }; |
| 1320 | } |
| 1321 | |
| 1322 | type BaseInternalMCPOptions = { |
| 1323 | id: string; |
| 1324 | name: string; |
| 1325 | faviconUrl?: string; |
| 1326 | timeout?: number; |
| 1327 | requestOptions?: RequestOptions; |
| 1328 | sourceFile?: string; |
| 1329 | }; |
| 1330 | |
| 1331 | export type InternalStdioMcpOptions = BaseInternalMCPOptions & { |
| 1332 | type?: "stdio"; |
| 1333 | command: string; |
| 1334 | args?: string[]; |
| 1335 | env?: Record<string, string>; |
| 1336 | cwd?: string; |
| 1337 | }; |
| 1338 | |
| 1339 | export type InternalStreamableHttpMcpOptions = BaseInternalMCPOptions & { |
| 1340 | type?: "streamable-http"; |
| 1341 | url: string; |
| 1342 | }; |
| 1343 | |
| 1344 | export type InternalSseMcpOptions = BaseInternalMCPOptions & { |
| 1345 | type?: "sse"; |
| 1346 | url: string; |
| 1347 | }; |
| 1348 | |
| 1349 | export type InternalWebsocketMcpOptions = BaseInternalMCPOptions & { |
| 1350 | type: "websocket"; // websocket requires explicit type |
| 1351 | url: string; |
| 1352 | }; |
| 1353 | |
| 1354 | export type InternalMcpOptions = |
| 1355 | | InternalStdioMcpOptions |
| 1356 | | InternalStreamableHttpMcpOptions |
| 1357 | | InternalSseMcpOptions |
| 1358 | | InternalWebsocketMcpOptions; |
| 1359 | |
| 1360 | export type MCPServerStatus = InternalMcpOptions & { |
| 1361 | status: MCPConnectionStatus; |
| 1362 | errors: string[]; |
| 1363 | infos: string[]; |
| 1364 | isProtectedResource: boolean; |
| 1365 | prompts: MCPPrompt[]; |
| 1366 | tools: MCPTool[]; |
| 1367 | resources: MCPResource[]; |
| 1368 | resourceTemplates: MCPResourceTemplate[]; |
| 1369 | sourceFile?: string; |
| 1370 | }; |
| 1371 | |
| 1372 | export interface ContinueUIConfig { |
| 1373 | codeBlockToolbarPosition?: "top" | "bottom"; |
| 1374 | fontSize?: number; |
| 1375 | displayRawMarkdown?: boolean; |
| 1376 | showChatScrollbar?: boolean; |
| 1377 | codeWrap?: boolean; |
| 1378 | showSessionTabs?: boolean; |
| 1379 | autoAcceptEditToolDiffs?: boolean; |
| 1380 | continueAfterToolRejection?: boolean; |
| 1381 | } |
| 1382 | |
| 1383 | export interface ContextMenuConfig { |
| 1384 | comment?: string; |
| 1385 | docstring?: string; |
| 1386 | fix?: string; |
| 1387 | optimize?: string; |
| 1388 | fixGrammar?: string; |
| 1389 | } |
| 1390 | |
| 1391 | export interface ExperimentalModelRoles { |
| 1392 | repoMapFileSelection?: string; |
| 1393 | inlineEdit?: string; |
| 1394 | applyCodeBlock?: string; |
| 1395 | } |
| 1396 | |
| 1397 | export interface ExperimentalMCPOptions { |
| 1398 | transport: TransportOptions; |
| 1399 | faviconUrl?: string; |
| 1400 | timeout?: number; |
| 1401 | } |
| 1402 | |
| 1403 | export type ApplyStateStatus = |
| 1404 | | "not-started" // Apply state created but not necessarily streaming |
| 1405 | | "streaming" // Changes are being applied to the file |
| 1406 | | "done" // All changes have been applied, awaiting user to accept/reject |
| 1407 | | "closed"; // All changes have been applied. Note that for new files, we immediately set the status to "closed" |
| 1408 | |
| 1409 | export interface ApplyState { |
| 1410 | streamId: string; |
| 1411 | status?: ApplyStateStatus; |
| 1412 | numDiffs?: number; |
| 1413 | filepath?: string; |
| 1414 | fileContent?: string; |
| 1415 | originalFileContent?: string; |
| 1416 | toolCallId?: string; |
| 1417 | autoFormattingDiff?: string; |
| 1418 | } |
| 1419 | |
| 1420 | export type StreamDiffLinesType = "edit" | "apply"; |
| 1421 | interface StreamDiffLinesOptionsBase { |
| 1422 | type: StreamDiffLinesType; |
| 1423 | prefix: string; |
| 1424 | highlighted: string; |
| 1425 | suffix: string; |
| 1426 | input: string; |
| 1427 | language: string | undefined; |
| 1428 | modelTitle: string | undefined; |
| 1429 | includeRulesInSystemMessage: boolean; |
| 1430 | fileUri?: string; |
| 1431 | } |
| 1432 | |
| 1433 | interface StreamDiffLinesOptionsEdit extends StreamDiffLinesOptionsBase { |
| 1434 | type: "edit"; |
| 1435 | } |
| 1436 | |
| 1437 | interface StreamDiffLinesOptionsApply extends StreamDiffLinesOptionsBase { |
| 1438 | type: "apply"; |
| 1439 | newCode: string; |
| 1440 | } |
| 1441 | |
| 1442 | type StreamDiffLinesPayload = |
| 1443 | | StreamDiffLinesOptionsApply |
| 1444 | | StreamDiffLinesOptionsEdit; |
| 1445 | |
| 1446 | export interface HighlightedCodePayload { |
| 1447 | rangeInFileWithContents: RangeInFileWithContents; |
| 1448 | prompt?: string; |
| 1449 | shouldRun?: boolean; |
| 1450 | } |
| 1451 | |
| 1452 | export interface AcceptOrRejectDiffPayload { |
| 1453 | filepath?: string; |
| 1454 | streamId?: string; |
| 1455 | } |
| 1456 | |
| 1457 | export interface ShowFilePayload { |
| 1458 | filepath: string; |
| 1459 | } |
| 1460 | |
| 1461 | export interface ApplyToFilePayload { |
| 1462 | streamId: string; |
| 1463 | filepath?: string; |
| 1464 | text: string; |
| 1465 | toolCallId?: string; |
| 1466 | isSearchAndReplace?: boolean; |
| 1467 | } |
| 1468 | |
| 1469 | export interface RangeInFileWithContents { |
| 1470 | filepath: string; |
| 1471 | range: { |
| 1472 | start: { line: number; character: number }; |
| 1473 | end: { line: number; character: number }; |
| 1474 | }; |
| 1475 | contents: string; |
| 1476 | } |
| 1477 | |
| 1478 | export interface RangeInFileWithNextEditInfo { |
| 1479 | filepath: string; |
| 1480 | range: Range; |
| 1481 | fileContents: string; |
| 1482 | editText: string; |
| 1483 | afterCursorPos: Position; |
| 1484 | beforeCursorPos: Position; |
| 1485 | workspaceDir: string; |
| 1486 | } |
| 1487 | |
| 1488 | export type SetCodeToEditPayload = RangeInFileWithContents | FileWithContents; |
| 1489 | |
| 1490 | /** |
| 1491 | * Signature help represents the signature of something |
| 1492 | * callable. There can be multiple signatures but only one |
| 1493 | * active and only one active parameter. |
| 1494 | */ |
| 1495 | export class SignatureHelp { |
| 1496 | /** |
| 1497 | * One or more signatures. |
| 1498 | */ |
| 1499 | signatures: SignatureInformation[]; |
| 1500 | |
| 1501 | /** |
| 1502 | * The active signature. |
| 1503 | */ |
| 1504 | activeSignature: number; |
| 1505 | |
| 1506 | /** |
| 1507 | * The active parameter of the active signature. |
| 1508 | */ |
| 1509 | activeParameter: number; |
| 1510 | } |
| 1511 | |
| 1512 | /** |
| 1513 | * Represents the signature of something callable. A signature |
| 1514 | * can have a label, like a function-name, a doc-comment, and |
| 1515 | * a set of parameters. |
| 1516 | */ |
| 1517 | export class SignatureInformation { |
| 1518 | /** |
| 1519 | * The label of this signature. Will be shown in |
| 1520 | * the UI. |
| 1521 | */ |
| 1522 | label: string; |
| 1523 | |
| 1524 | /** |
| 1525 | * The parameters of this signature. |
| 1526 | */ |
| 1527 | parameters: ParameterInformation[]; |
| 1528 | |
| 1529 | /** |
| 1530 | * The index of the active parameter. |
| 1531 | * |
| 1532 | * If provided, this is used in place of {@linkcode SignatureHelp.activeParameter}. |
| 1533 | */ |
| 1534 | activeParameter?: number; |
| 1535 | } |
| 1536 | |
| 1537 | /** |
| 1538 | * Represents a parameter of a callable-signature. A parameter can |
| 1539 | * have a label and a doc-comment. |
| 1540 | */ |
| 1541 | export class ParameterInformation { |
| 1542 | /** |
| 1543 | * The label of this signature. |
| 1544 | * |
| 1545 | * Either a string or inclusive start and exclusive end offsets within its containing |
| 1546 | * {@link SignatureInformation.label signature label}. *Note*: A label of type string must be |
| 1547 | * a substring of its containing signature information's {@link SignatureInformation.label label}. |
| 1548 | */ |
| 1549 | label: string | [number, number]; |
| 1550 | } |
| 1551 | |
| 1552 | /** |
| 1553 | * Represents the configuration for a quick action in the Code Lens. |
| 1554 | * Quick actions are custom commands that can be added to function and class declarations. |
| 1555 | */ |
| 1556 | export interface QuickActionConfig { |
| 1557 | /** |
| 1558 | * The title of the quick action that will display in the Code Lens. |
| 1559 | */ |
| 1560 | title: string; |
| 1561 | |
| 1562 | /** |
| 1563 | * The prompt that will be sent to the model when the quick action is invoked, |
| 1564 | * with the function or class body concatenated. |
| 1565 | */ |
| 1566 | prompt: string; |
| 1567 | |
| 1568 | /** |
| 1569 | * If `true`, the result of the quick action will be sent to the chat panel. |
| 1570 | * If `false`, the streamed result will be inserted into the document. |
| 1571 | * |
| 1572 | * Defaults to `false`. |
| 1573 | */ |
| 1574 | sendToChat: boolean; |
| 1575 | } |
| 1576 | |
| 1577 | export type DefaultContextProvider = ContextProviderWithParams & { |
| 1578 | query?: string; |
| 1579 | }; |
| 1580 | |
| 1581 | export interface ExperimentalConfig { |
| 1582 | contextMenuPrompts?: ContextMenuConfig; |
| 1583 | modelRoles?: ExperimentalModelRoles; |
| 1584 | defaultContext?: DefaultContextProvider[]; |
| 1585 | promptPath?: string; |
| 1586 | enableExperimentalTools?: boolean; |
| 1587 | onlyUseSystemMessageTools?: boolean; |
| 1588 | |
| 1589 | /** |
| 1590 | * Quick actions are a way to add custom commands to the Code Lens of |
| 1591 | * function and class declarations. |
| 1592 | */ |
| 1593 | quickActions?: QuickActionConfig[]; |
| 1594 | |
| 1595 | /** |
| 1596 | * Automatically read LLM chat responses aloud using system TTS models |
| 1597 | */ |
| 1598 | readResponseTTS?: boolean; |
| 1599 | |
| 1600 | /** |
| 1601 | * If set to true, we will attempt to pull down and install an instance of Chromium |
| 1602 | * that is compatible with the current version of Puppeteer. |
| 1603 | * This is needed to crawl a large number of documentation sites that are dynamically rendered. |
| 1604 | */ |
| 1605 | useChromiumForDocsCrawling?: boolean; |
| 1606 | modelContextProtocolServers?: ExperimentalMCPOptions[]; |
| 1607 | |
| 1608 | /** |
| 1609 | * If enabled, will add the current file as context. |
| 1610 | */ |
| 1611 | useCurrentFileAsContext?: boolean; |
| 1612 | |
| 1613 | /** |
| 1614 | * If enabled, @codebase will only use tool calling |
| 1615 | * instead of embeddings, FTS, recently edited files, etc. |
| 1616 | */ |
| 1617 | codebaseToolCallingOnly?: boolean; |
| 1618 | |
| 1619 | /** |
| 1620 | * If enabled, static contextualization will be used to |
| 1621 | * gather context for the model where necessary. |
| 1622 | */ |
| 1623 | enableStaticContextualization?: boolean; |
| 1624 | } |
| 1625 | |
| 1626 | export interface AnalyticsConfig { |
| 1627 | provider: string; |
| 1628 | url?: string; |
| 1629 | clientKey?: string; |
| 1630 | } |
| 1631 | |
| 1632 | export interface JSONModelDescription { |
| 1633 | title: string; |
| 1634 | provider: string; |
| 1635 | underlyingProviderName: string; |
| 1636 | model: string; |
| 1637 | apiKey?: string; |
| 1638 | apiBase?: string; |
| 1639 | |
| 1640 | contextLength?: number; |
| 1641 | maxStopWords?: number; |
| 1642 | template?: TemplateType; |
| 1643 | completionOptions?: BaseCompletionOptions; |
| 1644 | systemMessage?: string; |
| 1645 | requestOptions?: RequestOptions; |
| 1646 | cacheBehavior?: CacheBehavior; |
| 1647 | |
| 1648 | region?: string; |
| 1649 | profile?: string; |
| 1650 | modelArn?: string; |
| 1651 | apiType?: "openai" | "azure"; |
| 1652 | apiVersion?: string; |
| 1653 | deployment?: string; |
| 1654 | projectId?: string; |
| 1655 | accountId?: string; |
| 1656 | aiGatewaySlug?: string; |
| 1657 | useLegacyCompletionsEndpoint?: boolean; |
| 1658 | deploymentId?: string; |
| 1659 | isFromAutoDetect?: boolean; |
| 1660 | } |
| 1661 | |
| 1662 | // config.json |
| 1663 | export interface SerializedContinueConfig { |
| 1664 | env?: string[]; |
| 1665 | allowAnonymousTelemetry?: boolean; |
| 1666 | models: JSONModelDescription[]; |
| 1667 | systemMessage?: string; |
| 1668 | completionOptions?: BaseCompletionOptions; |
| 1669 | requestOptions?: RequestOptions; |
| 1670 | slashCommands?: SlashCommandDescription[]; |
| 1671 | customCommands?: CustomCommand[]; |
| 1672 | contextProviders?: ContextProviderWithParams[]; |
| 1673 | disableIndexing?: boolean; |
| 1674 | disableSessionTitles?: boolean; |
| 1675 | userToken?: string; |
| 1676 | embeddingsProvider?: EmbeddingsProviderDescription; |
| 1677 | tabAutocompleteModel?: JSONModelDescription | JSONModelDescription[]; |
| 1678 | tabAutocompleteOptions?: Partial<TabAutocompleteOptions>; |
| 1679 | ui?: ContinueUIConfig; |
| 1680 | reranker?: RerankerDescription; |
| 1681 | experimental?: ExperimentalConfig; |
| 1682 | analytics?: AnalyticsConfig; |
| 1683 | docs?: SiteIndexingConfig[]; |
| 1684 | data?: DataDestination[]; |
| 1685 | } |
| 1686 | |
| 1687 | export type ConfigMergeType = "merge" | "overwrite"; |
| 1688 | |
| 1689 | export type ContinueRcJson = Partial<SerializedContinueConfig> & { |
| 1690 | mergeBehavior: ConfigMergeType; |
| 1691 | }; |
| 1692 | |
| 1693 | // config.ts - give users simplified interfaces |
| 1694 | export interface Config { |
| 1695 | /** 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 */ |
| 1696 | allowAnonymousTelemetry?: boolean; |
| 1697 | /** Each entry in this array will originally be a JSONModelDescription, the same object from your config.json, but you may add CustomLLMs. |
| 1698 | * 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). |
| 1699 | * Continue will do the rest of the work to construct prompt templates, handle context items, prune context, etc. |
| 1700 | */ |
| 1701 | models: (CustomLLM | JSONModelDescription)[]; |
| 1702 | /** A system message to be followed by all of your models */ |
| 1703 | systemMessage?: string; |
| 1704 | /** The default completion options for all models */ |
| 1705 | completionOptions?: BaseCompletionOptions; |
| 1706 | /** Request options that will be applied to all models and context providers */ |
| 1707 | requestOptions?: RequestOptions; |
| 1708 | /** The list of slash commands that will be available in the sidebar */ |
| 1709 | slashCommands?: (SlashCommand | SlashCommandWithSource)[]; |
| 1710 | /** Each entry in this array will originally be a ContextProviderWithParams, the same object from your config.json, but you may add CustomContextProviders. |
| 1711 | * A CustomContextProvider requires you only to define a title and getContextItems function. When you type '@title <query>', Continue will call `getContextItems(query)`. |
| 1712 | */ |
| 1713 | contextProviders?: (CustomContextProvider | ContextProviderWithParams)[]; |
| 1714 | /** If set to true, Continue will not index your codebase for retrieval */ |
| 1715 | disableIndexing?: boolean; |
| 1716 | /** If set to true, Continue will not make extra requests to the LLM to generate a summary title of each session. */ |
| 1717 | disableSessionTitles?: boolean; |
| 1718 | /** An optional token to identify a user. Not used by Continue unless you write custom coniguration that requires such a token */ |
| 1719 | userToken?: string; |
| 1720 | /** The provider used to calculate embeddings. If left empty, Continue will use transformers.js to calculate the embeddings with all-MiniLM-L6-v2 */ |
| 1721 | embeddingsProvider?: EmbeddingsProviderDescription | ILLM; |
| 1722 | /** The model that Continue will use for tab autocompletions. */ |
| 1723 | tabAutocompleteModel?: |
| 1724 | | CustomLLM |
| 1725 | | JSONModelDescription |
| 1726 | | (CustomLLM | JSONModelDescription)[]; |
| 1727 | /** Options for tab autocomplete */ |
| 1728 | tabAutocompleteOptions?: Partial<TabAutocompleteOptions>; |
| 1729 | /** UI styles customization */ |
| 1730 | ui?: ContinueUIConfig; |
| 1731 | /** Options for the reranker */ |
| 1732 | reranker?: RerankerDescription | ILLM; |
| 1733 | /** Experimental configuration */ |
| 1734 | experimental?: ExperimentalConfig; |
| 1735 | /** Analytics configuration */ |
| 1736 | analytics?: AnalyticsConfig; |
| 1737 | docs?: SiteIndexingConfig[]; |
| 1738 | data?: DataDestination[]; |
| 1739 | } |
| 1740 | |
| 1741 | // in the actual Continue source code |
| 1742 | export interface ContinueConfig { |
| 1743 | allowAnonymousTelemetry?: boolean; |
| 1744 | // systemMessage?: string; |
| 1745 | completionOptions?: BaseCompletionOptions; |
| 1746 | requestOptions?: RequestOptions; |
| 1747 | slashCommands: SlashCommandWithSource[]; |
| 1748 | contextProviders: IContextProvider[]; |
| 1749 | disableSessionTitles?: boolean; |
| 1750 | disableIndexing?: boolean; |
| 1751 | userToken?: string; |
| 1752 | tabAutocompleteOptions?: Partial<TabAutocompleteOptions>; |
| 1753 | ui?: ContinueUIConfig; |
| 1754 | experimental?: ExperimentalConfig; |
| 1755 | analytics?: AnalyticsConfig; |
| 1756 | docs?: SiteIndexingConfig[]; |
| 1757 | tools: Tool[]; |
| 1758 | mcpServerStatuses: MCPServerStatus[]; |
| 1759 | rules: RuleWithSource[]; |
| 1760 | modelsByRole: Record<ModelRole, ILLM[]>; |
| 1761 | selectedModelByRole: Record<ModelRole, ILLM | null>; |
| 1762 | data?: DataDestination[]; |
| 1763 | } |
| 1764 | |
| 1765 | export interface BrowserSerializedContinueConfig { |
| 1766 | allowAnonymousTelemetry?: boolean; |
| 1767 | // systemMessage?: string; |
| 1768 | completionOptions?: BaseCompletionOptions; |
| 1769 | requestOptions?: RequestOptions; |
| 1770 | slashCommands: SlashCommandDescWithSource[]; |
| 1771 | contextProviders: ContextProviderDescription[]; |
| 1772 | disableIndexing?: boolean; |
| 1773 | disableSessionTitles?: boolean; |
| 1774 | userToken?: string; |
| 1775 | ui?: ContinueUIConfig; |
| 1776 | experimental?: ExperimentalConfig; |
| 1777 | analytics?: AnalyticsConfig; |
| 1778 | docs?: SiteIndexingConfig[]; |
| 1779 | tools: Tool[]; |
| 1780 | mcpServerStatuses: MCPServerStatus[]; |
| 1781 | rules: RuleWithSource[]; |
| 1782 | usePlatform: boolean; |
| 1783 | tabAutocompleteOptions?: Partial<TabAutocompleteOptions>; |
| 1784 | modelsByRole: Record<ModelRole, ModelDescription[]>; |
| 1785 | selectedModelByRole: Record<ModelRole, ModelDescription | null>; |
| 1786 | } |
| 1787 | |
| 1788 | // DOCS SUGGESTIONS AND PACKAGE INFO |
| 1789 | export interface FilePathAndName { |
| 1790 | path: string; |
| 1791 | name: string; |
| 1792 | } |
| 1793 | |
| 1794 | export interface PackageFilePathAndName extends FilePathAndName { |
| 1795 | packageRegistry: string; // e.g. npm, pypi |
| 1796 | } |
| 1797 | |
| 1798 | export type ParsedPackageInfo = { |
| 1799 | name: string; |
| 1800 | packageFile: PackageFilePathAndName; |
| 1801 | language: string; |
| 1802 | version: string; |
| 1803 | }; |
| 1804 | |
| 1805 | export type PackageDetails = { |
| 1806 | docsLink?: string; |
| 1807 | docsLinkWarning?: string; |
| 1808 | title?: string; |
| 1809 | description?: string; |
| 1810 | repo?: string; |
| 1811 | license?: string; |
| 1812 | }; |
| 1813 | |
| 1814 | export type PackageDetailsSuccess = PackageDetails & { |
| 1815 | docsLink: string; |
| 1816 | }; |
| 1817 | |
| 1818 | export type PackageDocsResult = { |
| 1819 | packageInfo: ParsedPackageInfo; |
| 1820 | } & ( |
| 1821 | | { error: string; details?: never } |
| 1822 | | { details: PackageDetailsSuccess; error?: never } |
| 1823 | ); |
| 1824 | |
| 1825 | export interface TerminalOptions { |
| 1826 | reuseTerminal?: boolean; |
| 1827 | terminalName?: string; |
| 1828 | waitForCompletion?: boolean; |
| 1829 | } |
| 1830 | |
| 1831 | export type RuleSource = |
| 1832 | | "default-chat" |
| 1833 | | "default-plan" |
| 1834 | | "default-agent" |
| 1835 | | "model-options-chat" |
| 1836 | | "model-options-plan" |
| 1837 | | "model-options-agent" |
| 1838 | | "rules-block" |
| 1839 | | "colocated-markdown" |
| 1840 | | "json-systemMessage" |
| 1841 | | ".continuerules" |
| 1842 | | "agent-file"; |
| 1843 | |
| 1844 | export interface RuleWithSource { |
| 1845 | name?: string; |
| 1846 | slug?: string; |
| 1847 | source: RuleSource; |
| 1848 | globs?: string | string[]; |
| 1849 | regex?: string | string[]; |
| 1850 | rule: string; |
| 1851 | description?: string; |
| 1852 | ruleFile?: string; |
| 1853 | alwaysApply?: boolean; |
| 1854 | invokable?: boolean; |
| 1855 | } |
| 1856 | export interface CompleteOnboardingPayload { |
| 1857 | mode: OnboardingModes; |
| 1858 | provider?: string; |
| 1859 | apiKey?: string; |
| 1860 | } |
| 1861 | |
| 1862 | export interface CompiledMessagesResult { |
| 1863 | compiledChatMessages: ChatMessage[]; |
| 1864 | didPrune: boolean; |
| 1865 | contextPercentage: number; |
| 1866 | } |
| 1867 | |
| 1868 | export interface MessageOption { |
| 1869 | precompiled: boolean; |
| 1870 | } |
| 1871 | |
| 1872 | /* LSP-specific interfaces. */ |
| 1873 | |
| 1874 | // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind. |
| 1875 | // We shift this one index down to match vscode.SymbolKind. |
| 1876 | export enum SymbolKind { |
| 1877 | File = 0, |
| 1878 | Module = 1, |
| 1879 | Namespace = 2, |
| 1880 | Package = 3, |
| 1881 | Class = 4, |
| 1882 | Method = 5, |
| 1883 | Property = 6, |
| 1884 | Field = 7, |
| 1885 | Constructor = 8, |
| 1886 | Enum = 9, |
| 1887 | Interface = 10, |
| 1888 | Function = 11, |
| 1889 | Variable = 12, |
| 1890 | Constant = 13, |
| 1891 | String = 14, |
| 1892 | Number = 15, |
| 1893 | Boolean = 16, |
| 1894 | Array = 17, |
| 1895 | Object = 18, |
| 1896 | Key = 19, |
| 1897 | Null = 20, |
| 1898 | EnumMember = 21, |
| 1899 | Struct = 22, |
| 1900 | Event = 23, |
| 1901 | Operator = 24, |
| 1902 | TypeParameter = 25, |
| 1903 | } |
| 1904 | |
| 1905 | // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag. |
| 1906 | export namespace SymbolTag { |
| 1907 | export const Deprecated: 1 = 1; |
| 1908 | } |
| 1909 | |
| 1910 | // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolTag. |
| 1911 | export type SymbolTag = 1; |
| 1912 | |
| 1913 | // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentSymbol. |
| 1914 | export interface DocumentSymbol { |
| 1915 | name: string; |
| 1916 | detail?: string; |
| 1917 | kind: SymbolKind; |
| 1918 | tags?: SymbolTag[]; |
| 1919 | deprecated?: boolean; |
| 1920 | range: Range; |
| 1921 | selectionRange: Range; |
| 1922 | children?: DocumentSymbol[]; |
| 1923 | } |