diff --git a/.github/workflows/continue-detailed-review.yaml b/.github/workflows/continue-detailed-review.yaml index f3b527328..4ec1ba510 100644 --- a/.github/workflows/continue-detailed-review.yaml +++ b/.github/workflows/continue-detailed-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 steps: - name: Run Detailed PR Review - uses: continuedev/continue/actions/detailed-review@8373ac24010df1110cd00512f925b63813362da1 + uses: continuedev/continue/actions/detailed-review@3ebd8232440080aa8891909753f69d75a87b2c86 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: continuedev diff --git a/.github/workflows/continue-general-review.yaml b/.github/workflows/continue-general-review.yaml index ed5345043..57bc76c85 100644 --- a/.github/workflows/continue-general-review.yaml +++ b/.github/workflows/continue-general-review.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 10 steps: - name: Run Continue PR Review Action - uses: continuedev/continue/actions/general-review@8373ac24010df1110cd00512f925b63813362da1 + uses: continuedev/continue/actions/general-review@3ebd8232440080aa8891909753f69d75a87b2c86 with: continue-api-key: ${{ secrets.CONTINUE_API_KEY }} continue-org: "continuedev" diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 12ac77caf..370acb854 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -84,6 +84,9 @@ jobs: AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }} AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} + VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} + RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }} + INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }} gui-checks: runs-on: ubuntu-latest @@ -217,6 +220,8 @@ jobs: AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} + RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }} + INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }} vscode-get-test-file-matrix: runs-on: ubuntu-latest diff --git a/.github/workflows/release-config-yaml.yml b/.github/workflows/release-config-yaml.yml index fea1c31d4..cae9b51ae 100644 --- a/.github/workflows/release-config-yaml.yml +++ b/.github/workflows/release-config-yaml.yml @@ -32,3 +32,5 @@ jobs: AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} + RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }} + INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }} diff --git a/.github/workflows/release-fetch.yml b/.github/workflows/release-fetch.yml index fb4636a21..4254d03ff 100644 --- a/.github/workflows/release-fetch.yml +++ b/.github/workflows/release-fetch.yml @@ -32,3 +32,5 @@ jobs: AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} + RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }} + INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }} diff --git a/.github/workflows/release-llm-info.yml b/.github/workflows/release-llm-info.yml index 7a94eba59..bc41ca21e 100644 --- a/.github/workflows/release-llm-info.yml +++ b/.github/workflows/release-llm-info.yml @@ -23,4 +23,7 @@ jobs: AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }} AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} - AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} \ No newline at end of file + AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} + VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} + RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }} + INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }} diff --git a/.github/workflows/release-openai-adapters.yml b/.github/workflows/release-openai-adapters.yml index e2a6b0622..ea83b5e93 100644 --- a/.github/workflows/release-openai-adapters.yml +++ b/.github/workflows/release-openai-adapters.yml @@ -32,3 +32,5 @@ jobs: AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} + RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }} + INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }} diff --git a/.github/workflows/reusable-release.yml b/.github/workflows/reusable-release.yml index 5f243f6bc..e763aa04c 100644 --- a/.github/workflows/reusable-release.yml +++ b/.github/workflows/reusable-release.yml @@ -32,6 +32,10 @@ on: required: false VOYAGE_API_KEY: required: false + RELACE_API_KEY: + required: false + INCEPTION_API_KEY: + required: false permissions: contents: write @@ -77,6 +81,8 @@ jobs: AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} + RELACE_API_KEY: ${{ secrets.RELACE_API_KEY }} + INCEPTION_API_KEY: ${{ secrets.INCEPTION_API_KEY }} - name: Release env: diff --git a/binary/package-lock.json b/binary/package-lock.json index 92756d546..001e69a8e 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -56,6 +56,7 @@ "@continuedev/fetch": "file:../packages/fetch", "@continuedev/llm-info": "file:../packages/llm-info", "@continuedev/openai-adapters": "file:../packages/openai-adapters", + "@continuedev/terminal-security": "file:../packages/terminal-security", "@modelcontextprotocol/sdk": "^1.12.0", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.1.1", diff --git a/core/config/load.ts b/core/config/load.ts index 370695bd3..b7150fd4c 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -215,8 +215,8 @@ function applyRequestOptionsToModels( // Prepare models for (const model of models) { model.requestOptions = { - ...model.requestOptions, ...config.requestOptions, + ...model.requestOptions, }; if (roles !== undefined) { model.roles = model.roles ?? roles; @@ -545,6 +545,7 @@ async function intermediateToFinalConfig({ // Trigger MCP server refreshes (Config is reloaded again once connected!) const mcpManager = MCPManagerSingleton.getInstance(); + const orgPolicy = PolicySingleton.getInstance().policy; if (orgPolicy?.policy?.allowMcpServers === false) { await mcpManager.shutdown(); @@ -555,6 +556,7 @@ async function intermediateToFinalConfig({ id: `continue-mcp-server-${index + 1}`, name: `MCP Server`, ...server, + requestOptions: config.requestOptions, }), ), false, diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index d0c268967..693fde2a2 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -187,7 +187,6 @@ export default async function doLoadConfig(options: { const mcpManager = MCPManagerSingleton.getInstance(); const mcpServerStatuses = mcpManager.getStatuses(); - // Slightly hacky just need connection's client to make slash command for now const serializableStatuses = mcpServerStatuses.map((server) => { const { client, ...rest } = server; return rest; diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 19202e7fd..915eb74f7 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -4,6 +4,7 @@ import { ConfigResult, ConfigValidationError, isAssistantUnrolledNonNullable, + mergeConfigYamlRequestOptions, mergeUnrolledAssistants, ModelRole, PackageIdentifier, @@ -34,10 +35,7 @@ import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants"; import { unrollLocalYamlBlocks } from "./loadLocalYamlBlocks"; import { LocalPlatformClient } from "./LocalPlatformClient"; import { llmsFromModelConfig } from "./models"; -import { - convertYamlMcpToContinueMcp, - convertYamlRuleToContinueRule, -} from "./yamlToContinueConfig"; +import { convertYamlRuleToContinueRule } from "./yamlToContinueConfig"; async function loadConfigYaml(options: { overrideConfigYaml: AssistantUnrolled | undefined; @@ -155,16 +153,15 @@ async function loadConfigYaml(options: { }; } -async function configYamlToContinueConfig(options: { +export async function configYamlToContinueConfig(options: { config: AssistantUnrolled; ide: IDE; - ideSettings: IdeSettings; ideInfo: IdeInfo; uniqueId: string; llmLogger: ILLMLogger; workOsAccessToken: string | undefined; }): Promise<{ config: ContinueConfig; errors: ConfigValidationError[] }> { - let { config, ide, ideSettings, ideInfo, uniqueId, llmLogger } = options; + let { config, ide, ideInfo, uniqueId, llmLogger } = options; const localErrors: ConfigValidationError[] = []; @@ -192,6 +189,7 @@ async function configYamlToContinueConfig(options: { summarize: null, }, rules: [], + requestOptions: { ...config.requestOptions }, }; // Right now, if there are any missing packages in the config, then we will just throw an error @@ -226,7 +224,13 @@ async function configYamlToContinueConfig(options: { } } - continueConfig.data = config.data; + continueConfig.data = config.data?.map((d) => ({ + ...d, + requestOptions: mergeConfigYamlRequestOptions( + d.requestOptions, + continueConfig.requestOptions, + ), + })); continueConfig.docs = config.docs?.map((doc) => ({ title: doc.name, startUrl: doc.startUrl, @@ -250,12 +254,6 @@ async function configYamlToContinueConfig(options: { }); }); - continueConfig.experimental = { - modelContextProtocolServers: config.mcpServers?.map( - convertYamlMcpToContinueMcp, - ), - }; - // Prompt files - try { const promptFiles = await getAllPromptFiles(ide, undefined, true); @@ -307,9 +305,7 @@ async function configYamlToContinueConfig(options: { try { const llms = await llmsFromModelConfig({ model, - ide, uniqueId, - ideSettings, llmLogger, config: continueConfig, }); @@ -394,6 +390,7 @@ async function configYamlToContinueConfig(options: { // Trigger MCP server refreshes (Config is reloaded again once connected!) const mcpManager = MCPManagerSingleton.getInstance(); + const orgPolicy = PolicySingleton.getInstance().policy; if (orgPolicy?.policy?.allowMcpServers === false) { await mcpManager.shutdown(); @@ -406,6 +403,10 @@ async function configYamlToContinueConfig(options: { transport: { type: "stdio", args: [], + requestOptions: mergeConfigYamlRequestOptions( + server.requestOptions, + config.requestOptions, + ), ...(server as any), // TODO: fix the types on mcpServers in config-yaml }, timeout: server.connectionTimeout, @@ -464,7 +465,6 @@ export async function loadContinueConfigFromYaml(options: { await configYamlToContinueConfig({ config: configYamlResult.config, ide, - ideSettings, ideInfo, uniqueId, llmLogger, diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index 45cbdcbfb..05fa48853 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -1,12 +1,9 @@ -import { ModelConfig } from "@continuedev/config-yaml"; - import { - ContinueConfig, - IDE, - IdeSettings, - ILLMLogger, - LLMOptions, -} from "../.."; + mergeConfigYamlRequestOptions, + ModelConfig, +} from "@continuedev/config-yaml"; + +import { ContinueConfig, ILLMLogger, LLMOptions } from "../.."; import { BaseLLM } from "../../llm"; import { LLMClasses } from "../../llm/llms"; @@ -29,14 +26,12 @@ function getModelClass( async function modelConfigToBaseLLM({ model, uniqueId, - ideSettings, llmLogger, config, isFromAutoDetect, }: { model: ModelConfig; uniqueId: string; - ideSettings: IdeSettings; llmLogger: ILLMLogger; config: ContinueConfig; isFromAutoDetect?: boolean; @@ -49,6 +44,11 @@ async function modelConfigToBaseLLM({ const { capabilities, ...rest } = model; + const mergedRequestOptions = mergeConfigYamlRequestOptions( + rest.requestOptions, + config.requestOptions, + ); + let options: LLMOptions = { ...rest, contextLength: model.defaultCompletionOptions?.contextLength, @@ -74,6 +74,7 @@ async function modelConfigToBaseLLM({ }, autocompleteOptions: model.autocompleteOptions, isFromAutoDetect, + requestOptions: mergedRequestOptions, }; // Model capabilities - need to be undefined if not found @@ -154,17 +155,13 @@ async function modelConfigToBaseLLM({ async function autodetectModels({ llm, model, - ide, uniqueId, - ideSettings, llmLogger, config, }: { llm: BaseLLM; model: ModelConfig; - ide: IDE; uniqueId: string; - ideSettings: IdeSettings; llmLogger: ILLMLogger; config: ContinueConfig; }): Promise { @@ -183,7 +180,6 @@ async function autodetectModels({ name: modelName, }, uniqueId, - ideSettings, llmLogger, config, isFromAutoDetect: true, @@ -199,23 +195,18 @@ async function autodetectModels({ export async function llmsFromModelConfig({ model, - ide, uniqueId, - ideSettings, llmLogger, config, }: { model: ModelConfig; - ide: IDE; uniqueId: string; - ideSettings: IdeSettings; llmLogger: ILLMLogger; config: ContinueConfig; }): Promise { const baseLlm = await modelConfigToBaseLLM({ model, uniqueId, - ideSettings, llmLogger, config, }); @@ -227,9 +218,7 @@ export async function llmsFromModelConfig({ const models = await autodetectModels({ llm: baseLlm, model, - ide, uniqueId, - ideSettings, llmLogger, config, }); diff --git a/core/config/yaml/models.vitest.ts b/core/config/yaml/models.vitest.ts new file mode 100644 index 000000000..4b5f33887 --- /dev/null +++ b/core/config/yaml/models.vitest.ts @@ -0,0 +1,355 @@ +import { ModelConfig } from "@continuedev/config-yaml"; +import { beforeEach, describe, expect, it, vi } from "vitest"; + +import { ContinueConfig, ILLMLogger } from "../.."; +import { llmsFromModelConfig } from "./models"; + +// Mock the LLM classes +vi.mock("../../llm/llms", () => ({ + LLMClasses: [ + class MockOpenAI { + static providerName = "openai"; + static defaultOptions = { + completionOptions: { + maxTokens: 2048, + }, + }; + + constructor(options: any) { + Object.assign(this, options); + } + + async listModels() { + return ["gpt-4", "gpt-3.5-turbo"]; + } + }, + class MockAnthropic { + static providerName = "anthropic"; + static defaultOptions = { + completionOptions: { + maxTokens: 4096, + }, + }; + + constructor(options: any) { + Object.assign(this, options); + } + + async listModels() { + return ["claude-3-5-sonnet-20241022", "claude-3-haiku-20240307"]; + } + }, + ], +})); + +describe("llmsFromModelConfig requestOptions merging", () => { + let mockLLMLogger: ILLMLogger; + let mockConfig: ContinueConfig; + + beforeEach(() => { + mockLLMLogger = { log: vi.fn() } as any; + mockConfig = { + requestOptions: { + timeout: 30000, + headers: { + "User-Agent": "Continue/1.0.0", + }, + proxy: "global-proxy", + }, + contextProviders: [], + mcpServerStatuses: [], + rules: [], + selectedModelByRole: { + apply: null, + autocomplete: null, + chat: null, + edit: null, + embed: null, + rerank: null, + summarize: null, + }, + modelsByRole: { + apply: [], + autocomplete: [], + chat: [], + edit: [], + embed: [], + rerank: [], + summarize: [], + }, + slashCommands: [], + tools: [], + allowAnonymousTelemetry: false, + } as ContinueConfig; + vi.clearAllMocks(); + }); + + it("should merge model requestOptions with config requestOptions", async () => { + const model: ModelConfig = { + name: "test-openai", + provider: "openai", + model: "gpt-4", + requestOptions: { + timeout: 60000, + headers: { + Authorization: "Bearer token123", + }, + proxy: "model-proxy", + }, + }; + + const result = await llmsFromModelConfig({ + model, + uniqueId: "test-id", + llmLogger: mockLLMLogger, + config: mockConfig, + }); + + expect(result).toHaveLength(1); + const llm = result[0]; + + // The LLM should have merged requestOptions + expect(llm.requestOptions).toEqual({ + timeout: 60000, // model-specific takes precedence + headers: { + "User-Agent": "Continue/1.0.0", // from global request options + Authorization: "Bearer token123", // from model + }, + proxy: "model-proxy", // model-specific takes precedence + }); + }); + + it("should use config requestOptions when model has no requestOptions", async () => { + const model: ModelConfig = { + name: "test-openai", + provider: "openai", + model: "gpt-4", + // no requestOptions + }; + + const result = await llmsFromModelConfig({ + model, + uniqueId: "test-id", + llmLogger: mockLLMLogger, + config: mockConfig, + }); + + expect(result).toHaveLength(1); + const llm = result[0]; + + // The LLM should have config requestOptions + expect(llm.requestOptions).toEqual(mockConfig.requestOptions); + }); + + it("should use model requestOptions when config has no requestOptions", async () => { + const model: ModelConfig = { + name: "test-openai", + provider: "openai", + model: "gpt-4", + requestOptions: { + timeout: 45000, + headers: { + "API-Key": "secret", + }, + }, + }; + + const configWithoutOptions = { ...mockConfig }; + delete configWithoutOptions.requestOptions; + + const result = await llmsFromModelConfig({ + model, + uniqueId: "test-id", + llmLogger: mockLLMLogger, + config: configWithoutOptions, + }); + + expect(result).toHaveLength(1); + const llm = result[0]; + + // The LLM should have model requestOptions + expect(llm.requestOptions).toEqual(model.requestOptions); + }); + + it("should handle empty headers correctly in merge", async () => { + const model: ModelConfig = { + name: "test-openai", + provider: "openai", + model: "gpt-4", + requestOptions: { + timeout: 60000, + headers: {}, + }, + }; + + const configWithEmptyHeaders = { + ...mockConfig, + requestOptions: { + ...mockConfig.requestOptions!, + headers: {}, + }, + }; + + const result = await llmsFromModelConfig({ + model, + uniqueId: "test-id", + llmLogger: mockLLMLogger, + config: configWithEmptyHeaders, + }); + + expect(result).toHaveLength(1); + const llm = result[0]; + + // When headers merge to empty object, they should be undefined + expect(llm.requestOptions).toEqual({ + timeout: 60000, + proxy: "global-proxy", + headers: undefined, + }); + }); + + it("should handle autodetect models with merged requestOptions", async () => { + const model: ModelConfig = { + name: "autodetect-openai", + provider: "openai", + model: "AUTODETECT", + requestOptions: { + timeout: 120000, + headers: { + "X-Custom": "autodetect", + }, + }, + }; + + const result = await llmsFromModelConfig({ + model, + uniqueId: "test-id", + llmLogger: mockLLMLogger, + config: mockConfig, + }); + + // Should return multiple models from listModels() + expect(result.length).toBeGreaterThan(0); + + // Each detected model should have the merged requestOptions + result.forEach((llm) => { + expect(llm.requestOptions).toEqual({ + timeout: 120000, // model-specific takes precedence + headers: { + "User-Agent": "Continue/1.0.0", // from global request options + "X-Custom": "autodetect", // from model + }, + proxy: "global-proxy", // from global request options + }); + }); + }); + + it("should handle unknown provider gracefully", async () => { + const model: ModelConfig = { + name: "unknown-provider", + provider: "unknown", + model: "unknown-model", + requestOptions: { + timeout: 60000, + }, + }; + + const result = await llmsFromModelConfig({ + model, + uniqueId: "test-id", + llmLogger: mockLLMLogger, + config: mockConfig, + }); + + // Should return empty array for unknown provider + expect(result).toHaveLength(0); + }); + + it("should preserve other model properties while merging requestOptions", async () => { + const model: ModelConfig = { + name: "test-anthropic", + provider: "anthropic", + model: "claude-3-5-sonnet-20241022", + roles: ["chat", "summarize"], + capabilities: ["tool_use", "image_input"], + defaultCompletionOptions: { + temperature: 0.7, + maxTokens: 1000, + }, + requestOptions: { + timeout: 90000, + }, + }; + + const result = await llmsFromModelConfig({ + model, + uniqueId: "test-id", + llmLogger: mockLLMLogger, + config: mockConfig, + }); + + expect(result).toHaveLength(1); + const llm = result[0]; + + // Should preserve model properties + expect(llm.title).toBe("test-anthropic"); + expect(llm.completionOptions?.temperature).toBe(0.7); + expect(llm.completionOptions?.maxTokens).toBe(1000); + expect(llm.capabilities?.tools).toBe(true); + expect(llm.capabilities?.uploadImage).toBe(true); + + // Should have merged requestOptions + expect(llm.requestOptions).toEqual({ + timeout: 90000, + headers: { + "User-Agent": "Continue/1.0.0", + }, + proxy: "global-proxy", + }); + }); + + it("should handle complex header merging scenarios", async () => { + const model: ModelConfig = { + name: "complex-headers", + provider: "openai", + model: "gpt-4", + requestOptions: { + headers: { + Authorization: "Bearer model-token", + Accept: "application/json", // Should override config Accept + "X-Model-Specific": "true", + }, + }, + }; + + const configWithMoreHeaders = { + ...mockConfig, + requestOptions: { + ...mockConfig.requestOptions!, + headers: { + ...mockConfig.requestOptions!.headers, + Accept: "text/plain", // Should be overridden by model + "Cache-Control": "no-cache", + }, + }, + }; + + const result = await llmsFromModelConfig({ + model, + uniqueId: "test-id", + llmLogger: mockLLMLogger, + config: configWithMoreHeaders, + }); + + expect(result).toHaveLength(1); + const llm = result[0]; + + expect(llm.requestOptions?.headers).toEqual({ + "User-Agent": "Continue/1.0.0", // from global request options + "Cache-Control": "no-cache", // from global request options + Authorization: "Bearer model-token", // from model + Accept: "application/json", // from model (overrides config) + "X-Model-Specific": "true", // from model + }); + }); +}); diff --git a/core/core.ts b/core/core.ts index c340fb624..9888a78b6 100644 --- a/core/core.ts +++ b/core/core.ts @@ -18,6 +18,7 @@ import { CodebaseIndexer } from "./indexing/CodebaseIndexer"; import DocsService from "./indexing/docs/DocsService"; import { countTokens } from "./llm/countTokens"; import Ollama from "./llm/llms/Ollama"; +import Lemonade from "./llm/llms/Lemonade"; import { EditAggregator } from "./nextEdit/context/aggregateEdits"; import { createNewPromptFileV2 } from "./promptFiles/createNewPromptFile"; import { callTool } from "./tools/callTool"; @@ -1263,6 +1264,9 @@ export class Core { if (msg.data.title === "Ollama") { const models = await new Ollama({ model: "" }).listModels(); return models; + } else if (msg.data.title === "Lemonade") { + const models = await new Lemonade({ model: "" }).listModels(); + return models; } else { return undefined; } @@ -1348,6 +1352,8 @@ export class Core { selectedCode, reranker: config.selectedModelByRole.rerank, fetch: (url, init) => + // Important note: context providers fetch uses global request options not LLM request options + // Because LLM calls are handled separately fetchwithRequestOptions(url, init, config.requestOptions), isInAgentMode: msg.data.isInAgentMode, }); diff --git a/core/index.d.ts b/core/index.d.ts index 86008cec8..ae2633595 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1099,6 +1099,7 @@ export interface Tool { exampleArgs?: Array<[string, string | number]>; }; defaultToolPolicy?: ToolPolicy; + toolCallIcon?: string; evaluateToolCallPolicy?: ( basePolicy: ToolPolicy, parsedArgs: Record, @@ -1281,6 +1282,7 @@ export interface MCPOptions { transport: TransportOptions; faviconUrl?: string; timeout?: number; + requestOptions?: RequestOptions; } export type MCPConnectionStatus = diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts index c7738a0fa..2b231a5b1 100644 --- a/core/indexing/ignore.ts +++ b/core/indexing/ignore.ts @@ -203,6 +203,13 @@ export const DEFAULT_IGNORE_DIRS = [ ...ADDITIONAL_INDEXING_IGNORE_DIRS, ]; +export const DEFAULT_IGNORES = [ + ...DEFAULT_IGNORE_FILETYPES, + ...DEFAULT_IGNORE_DIRS, +]; + +export const defaultIgnoresGlob = `!{${DEFAULT_IGNORES.join(",")}}`; + // Create ignore instances export const defaultSecurityIgnoreFile = ignore().add( DEFAULT_SECURITY_IGNORE_FILETYPES, diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 369a9cb9a..2ccc325cf 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -45,6 +45,7 @@ import { const PROVIDER_HANDLES_TEMPLATING: string[] = [ "lmstudio", + "lemonade", "openai", "nvidia", "ollama", @@ -67,6 +68,7 @@ const PROVIDER_HANDLES_TEMPLATING: string[] = [ const PROVIDER_SUPPORTS_IMAGES: string[] = [ "openai", "ollama", + "lemonade", "cohere", "gemini", "msty", diff --git a/core/llm/countTokens.ts b/core/llm/countTokens.ts index 9d1badd0c..0749fbdfb 100644 --- a/core/llm/countTokens.ts +++ b/core/llm/countTokens.ts @@ -85,7 +85,7 @@ function encodingForModel(modelName: string): Encoding { function countImageTokens(content: MessagePart): number { if (content.type === "imageUrl") { - return 85; + return 1024; } throw new Error("Non-image content type"); } diff --git a/core/llm/index.ts b/core/llm/index.ts index f8fefd381..58808a80e 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -30,6 +30,7 @@ import { TemplateType, Usage, } from "../index.js"; +import { isLemonadeInstalled } from "../util/lemonadeHelper.js"; import { Logger } from "../util/Logger.js"; import mergeJson from "../util/merge.js"; import { renderChatMessage } from "../util/messageContent.js"; @@ -503,6 +504,24 @@ export abstract class BaseLLM implements ILLM { : "Unable to connect to local Ollama instance. Ollama may not be installed or may not running."; throw new Error(message); } + if ( + e.code === "ECONNREFUSED" && + e.message.includes("http://localhost:8000") + ) { + const isInstalled = await isLemonadeInstalled(); + let message: string; + if (process.platform === "linux") { + // On Linux, isLemonadeInstalled checks if it's running (via health endpoint) + message = + "Unable to connect to local Lemonade instance. Please ensure Lemonade is running. Visit http://lemonade-server.ai for setup instructions."; + } else { + // On Windows, we can check if it's installed + message = isInstalled + ? "Unable to connect to local Lemonade instance. Lemonade server may not be running." + : "Unable to connect to local Lemonade instance. Lemonade may not be installed or may not be running."; + } + throw new Error(message); + } } throw e; } @@ -537,18 +556,14 @@ export abstract class BaseLLM implements ILLM { } private _formatChatMessage(msg: ChatMessage): string { - let contentToShow = ""; - if (msg.role === "tool") { - contentToShow = msg.content; - } else if (msg.role === "assistant" && msg.toolCalls?.length) { - contentToShow = msg.toolCalls + let contentToShow = renderChatMessage(msg); + if (msg.role === "assistant" && msg.toolCalls?.length) { + contentToShow += msg.toolCalls ?.map( (toolCall) => `${toolCall.function?.name}(${toolCall.function?.arguments})`, ) .join("\n"); - } else if ("content" in msg) { - contentToShow = renderChatMessage(msg); } return `<${msg.role}>\n${contentToShow}\n\n`; diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index 74c950350..fdaac3290 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -68,6 +68,17 @@ class Anthropic extends BaseLLM { return finalOptions; } + private buildTextPart(text: string, addCaching: boolean) { + const part: any = { + type: "text", + text, + }; + if (addCaching) { + part.cache_control = { type: "ephemeral" }; + } + return part; + } + private convertMessage(message: ChatMessage, addCaching: boolean): any { if (message.role === "tool") { return { @@ -81,14 +92,30 @@ class Anthropic extends BaseLLM { ], }; } else if (message.role === "assistant" && message.toolCalls) { - return { - role: "assistant", - content: message.toolCalls.map((toolCall) => ({ + const parts: any[] = []; + if (message.content) { + if (typeof message.content === "string") { + parts.push(this.buildTextPart(message.content, addCaching)); + } else if (message.content.length > 0) { + const textContent = message.content.filter((p) => p.type === "text"); + const textParts = textContent.map((part, idx) => { + const cache = idx === textContent.length - 1 && addCaching; + return this.buildTextPart(part.text, cache); + }); + parts.push(...textParts); + } + } + parts.push( + ...message.toolCalls.map((toolCall) => ({ type: "tool_use", id: toolCall.id, name: toolCall.function?.name, input: safeParseToolCallArgs(toolCall), })), + ); + return { + role: "assistant", + content: parts, }; } else if (message.role === "thinking" && !message.redactedThinking) { return { @@ -154,9 +181,7 @@ class Anthropic extends BaseLLM { public convertMessages(msgs: ChatMessage[]): any[] { // should be public for use within VertexAI - const filteredmessages = msgs.filter( - (m) => m.role !== "system" && !!m.content, - ); + const filteredmessages = msgs.filter((m) => m.role !== "system"); const lastTwoUserMsgIndices = filteredmessages .map((msg, index) => (msg.role === "user" ? index : -1)) .filter((index) => index !== -1) diff --git a/core/llm/llms/Lemonade.ts b/core/llm/llms/Lemonade.ts new file mode 100644 index 000000000..94860f929 --- /dev/null +++ b/core/llm/llms/Lemonade.ts @@ -0,0 +1,12 @@ +import { LLMOptions } from "../../index.js"; + +import OpenAI from "./OpenAI.js"; + +class Lemonade extends OpenAI { + static providerName = "lemonade"; + static defaultOptions: Partial = { + apiBase: "http://localhost:8000/api/v1/", + }; +} + +export default Lemonade; diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index d94008322..0a239fce9 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -269,6 +269,11 @@ class Ollama extends BaseLLM implements ModelInstaller { return this.modelMap[this.model] ?? this.model; } + get contextLength() { + const DEFAULT_OLLAMA_CONTEXT_LENGTH = 8192; // twice of https://github.com/ollama/ollama/blob/29ddfc2cab7f5a83a96c3133094f67b22e4f27d1/envconfig/config.go#L185 + return this._contextLength ?? DEFAULT_OLLAMA_CONTEXT_LENGTH; + } + private _getModelFileParams( options: CompletionOptions, ): OllamaModelFileParams { diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index 27006aea1..83166b6a2 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -174,7 +174,7 @@ class OpenAI extends BaseLLM { protected _getHeaders() { return { "Content-Type": "application/json", - Authorization: `Bearer ${this.apiKey}`, + ...(this.apiKey && { Authorization: `Bearer ${this.apiKey}` }), "api-key": this.apiKey ?? "", // For Azure }; } diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 7a058ced7..bb4301576 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -33,6 +33,7 @@ import Kindo from "./Kindo"; import LlamaCpp from "./LlamaCpp"; import Llamafile from "./Llamafile"; import LlamaStack from "./LlamaStack"; +import Lemonade from "./Lemonade"; import LMStudio from "./LMStudio"; import Mistral from "./Mistral"; import MockLLM from "./Mock"; @@ -82,6 +83,7 @@ export const LLMClasses = [ LlamaCpp, OpenAI, OVHcloud, + Lemonade, LMStudio, Mistral, Bedrock, diff --git a/core/llm/streamChat.ts b/core/llm/streamChat.ts index bef15522e..d1a0d4fe0 100644 --- a/core/llm/streamChat.ts +++ b/core/llm/streamChat.ts @@ -95,7 +95,7 @@ export async function* llmStreamChat( ...init, signal: abortController.signal, }, - config.requestOptions, + model.requestOptions, ), completionOptions, abortController, diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index ed40733a5..35867336f 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -374,9 +374,8 @@ export function isRecommendedAgentModel(modelName: string): boolean { [/o[134]/], [/deepseek/, /r1|reasoner/], [/gemini/, /2\.5/, /pro/], - [/gpt/, /4/], [/gpt-5/], - [/claude/, /sonnet/, /3\.5|3\.7|3-5|3-7|-4/], + [/claude/, /sonnet/, /3\.7|3-7|-4/], [/claude/, /opus/, /-4/], ]; for (const combo of recs) { diff --git a/core/package-lock.json b/core/package-lock.json index fcf619b59..48c1cb090 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -152,10 +152,10 @@ }, "../packages/config-yaml": { "name": "@continuedev/config-yaml", - "version": "1.0.96", + "version": "1.14.0", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-types": "file:../config-types", + "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", "zod": "^3.24.2" }, @@ -179,17 +179,22 @@ }, "../packages/fetch": { "name": "@continuedev/fetch", - "version": "1.0.16", + "version": "1.1.0", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-types": "file:../config-types", + "@continuedev/config-types": "^1.0.14", "follow-redirects": "^1.15.6", "http-proxy-agent": "^7.0.2", "https-proxy-agent": "^7.0.5", "node-fetch": "^3.3.2" }, "devDependencies": { + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^9.2.6", + "@semantic-release/npm": "^10.0.6", "@types/follow-redirects": "^1.14.4", + "semantic-release": "^21.1.2", "typescript": "^5.0.0", "vitest": "^3.2.0" } @@ -199,20 +204,25 @@ "version": "1.0.9", "license": "Apache-2.0", "devDependencies": { + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^9.2.6", + "@semantic-release/npm": "^10.0.6", "@types/node": "^22.15.29", + "semantic-release": "^21.1.2", "typescript": "^5.5.2" } }, "../packages/openai-adapters": { "name": "@continuedev/openai-adapters", - "version": "1.5.1", + "version": "1.14.0", "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-bedrock-runtime": "^3.842.0", "@aws-sdk/credential-providers": "^3.840.0", "@continuedev/config-types": "^1.0.14", - "@continuedev/config-yaml": "^1.8.0", - "@continuedev/fetch": "^1.0.16", + "@continuedev/config-yaml": "^1.14.0", + "@continuedev/fetch": "^1.1.0", "dotenv": "^16.5.0", "google-auth-library": "^10.1.0", "json-schema": "^0.4.0", diff --git a/core/tools/definitions/createRuleBlock.ts b/core/tools/definitions/createRuleBlock.ts index 7dcb8cd51..2b8f1c4ed 100644 --- a/core/tools/definitions/createRuleBlock.ts +++ b/core/tools/definitions/createRuleBlock.ts @@ -84,4 +84,5 @@ For example:`, ["alwaysApply", "false"], ], }, + toolCallIcon: "PencilIcon", }; diff --git a/core/tools/definitions/fetchUrlContent.ts b/core/tools/definitions/fetchUrlContent.ts index 6927b60bf..2498dcc59 100644 --- a/core/tools/definitions/fetchUrlContent.ts +++ b/core/tools/definitions/fetchUrlContent.ts @@ -30,4 +30,5 @@ export const fetchUrlContentTool: Tool = { prefix: `To fetch the content of a URL, use the ${BuiltInToolNames.FetchUrlContent} tool. For example, to read the contents of a webpage, you might respond with:`, exampleArgs: [["url", "https://example.com"]], }, + toolCallIcon: "GlobeAltIcon", }; diff --git a/core/tools/definitions/globSearch.ts b/core/tools/definitions/globSearch.ts index 6e11f84dd..5159ea3ea 100644 --- a/core/tools/definitions/globSearch.ts +++ b/core/tools/definitions/globSearch.ts @@ -13,7 +13,7 @@ export const globSearchTool: Tool = { function: { name: BuiltInToolNames.FileGlobSearch, description: - "Search for files recursively in the project using glob patterns. Supports ** for recursive directory search. Output may be truncated; use targeted patterns", + "Search for files recursively in the project using glob patterns. Supports ** for recursive directory search. Will not show many build, cache, secrets dirs/files (can use ls tool instead). Output may be truncated; use targeted patterns", parameters: { type: "object", required: ["pattern"], @@ -30,4 +30,5 @@ export const globSearchTool: Tool = { prefix: `To return a list of files based on a glob search pattern, use the ${BuiltInToolNames.FileGlobSearch} tool`, exampleArgs: [["pattern", "*.py"]], }, + toolCallIcon: "MagnifyingGlassIcon", }; diff --git a/core/tools/definitions/grepSearch.ts b/core/tools/definitions/grepSearch.ts index 75107d90b..c9e78d62d 100644 --- a/core/tools/definitions/grepSearch.ts +++ b/core/tools/definitions/grepSearch.ts @@ -13,7 +13,7 @@ export const grepSearchTool: Tool = { function: { name: BuiltInToolNames.GrepSearch, description: - "Perform a search over the repository using ripgrep. Output may be truncated, so use targeted queries", + "Perform a search over the repository using ripgrep. Will not include results for many build, cache, secrets dirs/files. Output may be truncated, so use targeted queries", parameters: { type: "object", required: ["query"], @@ -31,4 +31,5 @@ export const grepSearchTool: Tool = { prefix: `To perform a grep search within the project, call the ${BuiltInToolNames.GrepSearch} tool with the query pattern to match. For example:`, exampleArgs: [["query", ".*main_services.*"]], }, + toolCallIcon: "MagnifyingGlassIcon", }; diff --git a/core/tools/definitions/ls.ts b/core/tools/definitions/ls.ts index aefe16302..49ac5b1c6 100644 --- a/core/tools/definitions/ls.ts +++ b/core/tools/definitions/ls.ts @@ -38,4 +38,5 @@ export const lsTool: Tool = { ["recursive", "false"], ], }, + toolCallIcon: "FolderIcon", }; diff --git a/core/tools/definitions/readCurrentlyOpenFile.ts b/core/tools/definitions/readCurrentlyOpenFile.ts index 5afab5ae4..87d1adc22 100644 --- a/core/tools/definitions/readCurrentlyOpenFile.ts +++ b/core/tools/definitions/readCurrentlyOpenFile.ts @@ -24,4 +24,5 @@ export const readCurrentlyOpenFileTool: Tool = { prefix: `To view the user's currently open file, use the ${BuiltInToolNames.ReadCurrentlyOpenFile} tool. If the user is asking about a file and you don't see any code, use this to check the current file`, }, + toolCallIcon: "DocumentTextIcon", }; diff --git a/core/tools/definitions/readFile.ts b/core/tools/definitions/readFile.ts index d63b59b16..ee6c1c91c 100644 --- a/core/tools/definitions/readFile.ts +++ b/core/tools/definitions/readFile.ts @@ -31,4 +31,5 @@ export const readFileTool: Tool = { exampleArgs: [["filepath", "path/to/the_file.txt"]], }, defaultToolPolicy: "allowedWithoutPermission", + toolCallIcon: "DocumentIcon", }; diff --git a/core/tools/definitions/readFileRange.ts b/core/tools/definitions/readFileRange.ts index 672b9f431..41a7bfcfd 100644 --- a/core/tools/definitions/readFileRange.ts +++ b/core/tools/definitions/readFileRange.ts @@ -48,4 +48,5 @@ export const readFileRangeTool: Tool = { ], }, defaultToolPolicy: "allowedWithoutPermission", + toolCallIcon: "DocumentIcon", }; diff --git a/core/tools/definitions/searchWeb.ts b/core/tools/definitions/searchWeb.ts index aa1555e15..7740cb45a 100644 --- a/core/tools/definitions/searchWeb.ts +++ b/core/tools/definitions/searchWeb.ts @@ -30,4 +30,5 @@ export const searchWebTool: Tool = { prefix: `To search the web, use the ${BuiltInToolNames.SearchWeb} tool with a natural language query. For example, to search for the current weather, you would respond with:`, exampleArgs: [["query", "What is the current weather in San Francisco?"]], }, + toolCallIcon: "GlobeAltIcon", }; diff --git a/core/tools/definitions/viewDiff.ts b/core/tools/definitions/viewDiff.ts index 14d6176f2..4c397a04b 100644 --- a/core/tools/definitions/viewDiff.ts +++ b/core/tools/definitions/viewDiff.ts @@ -23,4 +23,5 @@ export const viewDiffTool: Tool = { prefix: `To view the current git diff, use the ${BuiltInToolNames.ViewDiff} tool. This will show you the changes made in the working directory compared to the last commit.`, }, defaultToolPolicy: "allowedWithoutPermission", + toolCallIcon: "CodeBracketIcon", }; diff --git a/core/tools/definitions/viewRepoMap.ts b/core/tools/definitions/viewRepoMap.ts index 0d1d94046..176855e2b 100644 --- a/core/tools/definitions/viewRepoMap.ts +++ b/core/tools/definitions/viewRepoMap.ts @@ -23,4 +23,5 @@ export const viewRepoMapTool: Tool = { prefix: `To view the repository map, use the ${BuiltInToolNames.ViewRepoMap} tool. This will provide a visual representation of the project's structure and organization.`, }, defaultToolPolicy: "allowedWithPermission", + toolCallIcon: "MapIcon", }; diff --git a/core/tools/definitions/viewSubdirectory.ts b/core/tools/definitions/viewSubdirectory.ts index 4ef686445..f8776716f 100644 --- a/core/tools/definitions/viewSubdirectory.ts +++ b/core/tools/definitions/viewSubdirectory.ts @@ -30,4 +30,5 @@ export const viewSubdirectoryTool: Tool = { exampleArgs: [["directory_path", "path/to/subdirectory"]], }, defaultToolPolicy: "allowedWithPermission", + toolCallIcon: "FolderOpenIcon", }; diff --git a/core/tools/index.ts b/core/tools/index.ts index 3a45ea295..e021a601c 100644 --- a/core/tools/index.ts +++ b/core/tools/index.ts @@ -1,10 +1,10 @@ import { ConfigDependentToolParams, Tool } from ".."; +import { isRecommendedAgentModel } from "../llm/toolSupport"; import * as toolDefinitions from "./definitions"; // I'm writing these as functions because we've messed up 3 TIMES by pushing to const, causing duplicate tool definitions on subsequent config loads. export const getBaseToolDefinitions = () => [ toolDefinitions.readFileTool, - toolDefinitions.createNewFileTool, toolDefinitions.runTerminalCommandTool, toolDefinitions.globSearchTool, @@ -13,7 +13,6 @@ export const getBaseToolDefinitions = () => [ toolDefinitions.lsTool, toolDefinitions.createRuleBlock, toolDefinitions.fetchUrlContentTool, - toolDefinitions.singleFindAndReplaceTool, ]; export const getConfigDependentToolDefinitions = ( @@ -38,10 +37,11 @@ export const getConfigDependentToolDefinitions = ( ); } - if (modelName?.includes("claude") || modelName?.includes("gpt-5")) { + if (modelName && isRecommendedAgentModel(modelName)) { tools.push(toolDefinitions.multiEditTool); } else { tools.push(toolDefinitions.editFileTool); + tools.push(toolDefinitions.singleFindAndReplaceTool); } // missing support for remote os calls: https://github.com/microsoft/vscode/issues/252269 diff --git a/core/util/GlobalContext.ts b/core/util/GlobalContext.ts index 59daf21c9..0a1778395 100644 --- a/core/util/GlobalContext.ts +++ b/core/util/GlobalContext.ts @@ -44,9 +44,8 @@ export type GlobalContextType = { isSupportedLanceDbCpuTargetForLinux: boolean; sharedConfig: SharedConfigSchema; failedDocs: SiteIndexingConfig[]; - shownDeprecatedProviderWarnings: { - [providerTitle: string]: boolean; - }; + shownDeprecatedProviderWarnings: { [providerTitle: string]: boolean }; + autoUpdateCli: boolean; mcpOauthStorage: { [serverUrl: string]: { clientInformation?: OAuthClientInformationFull; @@ -66,16 +65,7 @@ export class GlobalContext { ) { const filepath = getGlobalContextFilePath(); if (!fs.existsSync(filepath)) { - fs.writeFileSync( - filepath, - JSON.stringify( - { - [key]: value, - }, - null, - 2, - ), - ); + fs.writeFileSync(filepath, JSON.stringify({ [key]: value }, null, 2)); } else { const data = fs.readFileSync(filepath, "utf-8"); @@ -113,10 +103,7 @@ export class GlobalContext { } // Recreate the file with salvaged values plus the new value - const newData = { - ...salvaged, - [key]: value, - }; + const newData = { ...salvaged, [key]: value }; fs.writeFileSync(filepath, JSON.stringify(newData, null, 2)); return; @@ -174,10 +161,7 @@ export class GlobalContext { newValues: Partial, ): SharedConfigSchema { const currentSharedConfig = this.getSharedConfig(); - const updatedSharedConfig = { - ...currentSharedConfig, - ...newValues, - }; + const updatedSharedConfig = { ...currentSharedConfig, ...newValues }; this.update("sharedConfig", updatedSharedConfig); return updatedSharedConfig; } @@ -189,10 +173,7 @@ export class GlobalContext { ): GlobalContextModelSelections { const currentSelections = this.get("selectedModelsByProfileId") ?? {}; const forProfile = currentSelections[profileId] ?? {}; - const newSelections = { - ...forProfile, - [role]: title, - }; + const newSelections = { ...forProfile, [role]: title }; this.update("selectedModelsByProfileId", { ...currentSelections, diff --git a/core/util/lemonadeHelper.ts b/core/util/lemonadeHelper.ts new file mode 100644 index 000000000..ff8d4dfbc --- /dev/null +++ b/core/util/lemonadeHelper.ts @@ -0,0 +1,59 @@ +import { exec } from "node:child_process"; +import { IDE } from ".."; + +export async function isLemonadeInstalled(): Promise { + // On Windows, check if lemonade-server command exists + if (process.platform === "win32") { + return new Promise((resolve, _reject) => { + exec("where.exe lemonade-server", (error, _stdout, _stderr) => { + resolve(!error); + }); + }); + } + + // On Linux, check if the health endpoint is accessible + try { + const response = await fetch("http://localhost:8000/api/v1/health", { + method: "GET", + signal: AbortSignal.timeout(3000), // 3 second timeout + }); + + if (response.ok) { + const data = await response.json(); + return data.status === "ok"; + } + return false; + } catch { + return false; + } +} + +export async function startLocalLemonade(ide: IDE): Promise { + let startCommand: string | undefined; + + switch (process.platform) { + case "linux": // Linux + // On Linux, direct users to start Lemonade manually + return ide.showToast( + "info", + "Please start Lemonade manually. Visit https://lemonade-server.ai for instructions.", + ); + + case "win32": // Windows + startCommand = "lemonade-server serve\n"; + break; + + default: + return ide.showToast( + "error", + "Cannot start Lemonade: platform not supported!", + ); + } + + if (startCommand) { + return ide.runCommand(startCommand, { + reuseTerminal: true, + terminalName: "Start Lemonade", + }); + } +} diff --git a/docs/customize/model-providers/assets/tetrate-get-api-key.png b/docs/customize/model-providers/assets/tetrate-get-api-key.png new file mode 100644 index 000000000..e6f88b4bd Binary files /dev/null and b/docs/customize/model-providers/assets/tetrate-get-api-key.png differ diff --git a/docs/customize/model-providers/assets/tetrate-remix.png b/docs/customize/model-providers/assets/tetrate-remix.png index c64d1d86d..a418f8a81 100644 Binary files a/docs/customize/model-providers/assets/tetrate-remix.png and b/docs/customize/model-providers/assets/tetrate-remix.png differ diff --git a/docs/customize/model-providers/assets/tetrate-sign-in.png b/docs/customize/model-providers/assets/tetrate-sign-in.png new file mode 100644 index 000000000..0833ab383 Binary files /dev/null and b/docs/customize/model-providers/assets/tetrate-sign-in.png differ diff --git a/docs/customize/model-providers/more/lemonade.mdx b/docs/customize/model-providers/more/lemonade.mdx new file mode 100644 index 000000000..79afd957d --- /dev/null +++ b/docs/customize/model-providers/more/lemonade.mdx @@ -0,0 +1,81 @@ +--- +title: "Lemonade Server" +description: "Configure Lemonade Server with Continue for refreshingly fast local LLM inference on GPUs and NPUs" +--- + + + Get started with [Lemonade Server](https://lemonade-server.ai/) - Refreshingly fast LLMs on GPUs and NPUs with seamless Continue integration + + +## Overview + +Lemonade Server provides optimized local LLM inference with support for GPU and NPU hardware acceleration. It offers an OpenAI-compatible API that seamlessly integrates with Continue and other open-source platforms. + +## Installation + +Download and install Lemonade Server from [lemonade-server.ai](https://lemonade-server.ai/). + +## Configuration + +Lemonade Server is available directly in the Continue UI as a provider. You can select it from the model provider dropdown without manual configuration. + +### Option 1: Using the Continue UI (Recommended) + +1. Click on the model selector dropdown in Continue +2. Select "Add Model" +3. Choose "Lemonade Server" from the provider list +4. Continue will automatically configure the connection + +### Option 2: Manual Configuration + +If you need custom settings, you can manually configure Lemonade: + + + + ```yaml title="config.yaml" + models: + - name: Lemonade + provider: lemonade + model: + apiBase: http://localhost:8000/api/v1/ + ``` + + + ```json title="config.json" + { + "models": [ + { + "title": "Lemonade", + "provider": "lemonade", + "model": "", + "apiBase": "http://localhost:8000/api/v1/" + } + ] + } + ``` + + + +## Getting Started + +1. **Install Lemonade Server**: Download from [lemonade-server.ai](https://lemonade-server.ai/) +2. **Start the server**: Launch Lemonade Server (runs on `http://localhost:8000/api/v1/` by default) +3. **Add to Continue**: Select Lemonade Server from the model provider dropdown in Continue +4. **Load a model**: Choose your preferred model through the interface + +## Hardware Support + +Lemonade Server automatically detects and optimizes for available hardware: +- **NPU**: Neural Processing Unit acceleration for efficient inference +- **GPU**: Full GPU acceleration support +- **CPU**: Optimized CPU fallback when accelerators are unavailable + +## Key Features + +- OpenAI-compatible API for seamless integration +- Support for popular model formats +- Automatic hardware detection and optimization +- Integration with Continue, Open WebUI, Gaia, and AnythingLLM +- Active open-source community + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Lemonade.ts) \ No newline at end of file diff --git a/docs/customize/model-providers/top-level/tetrate_agent_router_service.mdx b/docs/customize/model-providers/top-level/tetrate_agent_router_service.mdx index 648e3800e..a074eef7d 100644 --- a/docs/customize/model-providers/top-level/tetrate_agent_router_service.mdx +++ b/docs/customize/model-providers/top-level/tetrate_agent_router_service.mdx @@ -3,81 +3,250 @@ title: "Tetrate Agent Router Service" sidebarTitle: "Tetrate Agent Router Service" slug: ../tetrate-agent-router-service --- - -The **Tetrate Agent Router Service** provides a unified Gateway for accessing various AI models with fast inference capabilities as well as embedding services. +The **Tetrate Agent Router Service** provides a unified Gateway for accessing various AI models with fast inference capabilities. This gateway acts as an intelligent router that can distribute requests across multiple model providers, offering enterprise-grade reliability and performance optimization. -## Getting Started + +Want to get started quickly? Sign up for the [Tetrate Agent Router Service](https://router.tetrate.ai/) to get an API key, then use [Tetrate on Continue Hub](https://hub.continue.dev/tetrate) to get started fast. + -1. Obtain an API key from the [Agent Router Service portal](https://api.router.tetrate.ai/) -2. Configure Continue to use Agent Router Service as your model provider +## Setup -## Configuring Models + + +Visit the [Agent Router Service portal](https://router.tetrate.ai/) and create an account to get your API key +Tetrate sign in page + -You can also quickly use models from Tetrate on the Cotninue Hub by visiting Tetrate on the Continue Hub [here](https://hub.continue.dev/tetrate). The easiest way if you don't see the model you want to use is to remix one of the models on the Tetrate page and change the model to the one you want to use. + +Go to the [API keys page](https://router.tetrate.ai/api-keys) to get your key +Tetrate get API key + + + +- Choose a configuration method below. +- If you use the Continue VS Code extension, install version `>=1.2.3`. + + + + + +### Quickstart with Continue Hub + +Fastest way: use preconfigured models from Tetrate on Continue Hub + + + +Open [Tetrate on Continue Hub](https://hub.continue.dev/tetrate) and pick a model (e.g., [Claude Sonnet 4](https://hub.continue.dev/tetrate/claude-sonnet-4)) + + + +Click "Use Model", or "Remix" to change the model ID if needed + + + +Add your API key to Continue. See [adding secrets in Continue Hub](/hub/secrets/secret-types) and [managing local secrets in the FAQ](/faqs#managing-local-secrets-and-environment-variables) + +Add it as a Continue Hub secret named `TETRATE_API_KEY` to reuse across projects. + + + ![Remix a model from Tetrate on Continue Hub](../assets/tetrate-remix.png) -### Available Models + +If a model is missing, remix a similar one and set the `model` field to the target ID. + -Agent Router Service supports routing to various models. -Go to the [Agent Router Service model catalog](https://router.tetrate.ai/models) for a full list of supported models. +### Configuration Methods -## Configuration Options + + + Use a Tetrate model block from the Hub or define it directly in your local agent configuration. + + + Use a Tetrate model block from the Hub or define your own on the Hub. + + + Create a local model block for reuse across agents without publishing it to the Hub. + + -As Agent Router Service is an OpenAI API compatible provider, you can configure it like any other OpenAI API compatible provider. Therefore you will be setting `provider: openai` and `apiBase: https://api.router.tetrate.ai/v1`. -Update your Continue configuration file (`~/.continue/config.yaml`) with your Agent Router Service API key: +### Configuration Examples + +**Click a tab** to see an example. + + + -### On your local machine +**When to use**: Simple local setups (like using the VS Code extension) when you don't need shared or published blocks. -#### In your config.yaml +Use a Tetrate model block from the Hub in your local agent configuration: -```yaml title="config.yaml" +```yaml title="~/.continue/config.yaml" +name: Local Agent +version: 1.0.0 +schema: v1 models: - - name: - provider: openai - model: - apiKey: - apiBase: https://api.router.tetrate.ai/v1 + - uses: tetrate/claude-sonnet-4 + with: + TETRATE_API_KEY: ${{ secrets.TETRATE_API_KEY }} +context: + - provider: code + - provider: docs + - provider: diff + - provider: terminal + - provider: problems + - provider: folder + - provider: codebase ``` -#### As a local model block +Or define the model directly: -Review the configuration reference for [model blocks](/reference#models) and using [local blocks](/reference#local-blocks). Ensure you look at the roles and capabilities section and review the [model capabilities guide](/customize/deep-dives/model-capabilities). +```yaml title="~/.continue/config.yaml" +name: Local Agent +version: 1.0.0 +schema: v1 +models: + - name: Claude Sonnet 4 + provider: tars + model: claude-4-sonnet-20250514 + apiKey: ${{ secrets.TETRATE_API_KEY }} + roles: + - chat + - edit + - apply + capabilities: + - tool_use +context: + - provider: code + - provider: docs + - provider: diff + - provider: terminal + - provider: problems + - provider: folder + - provider: codebase +``` + + +**When to use**: Share configurations across teams or contribute to the community. -```yaml title="model_name.yaml" - name: - models: - - name: - provider: openai - model: - apiKey: ${{ inputs.TETRATE_API_KEY }} - apiBase: https://api.router.tetrate.ai/v1 - roles: - - chat - - edit - - apply - capabilities: - - tool_use +**The Model Block:** + +```yaml title="tetrate/claude-sonnet-4" +name: Claude Sonnet 4 +version: 1.0.14 +schema: v1 +models: + - name: Claude Sonnet 4 - Tetrate + provider: tars + model: claude-4-sonnet-20250514 + apiKey: ${{ inputs.TETRATE_API_KEY }} + roles: + - chat + - edit + - apply + capabilities: + - tool_use +``` +View the model block `tetrate/claude-sonnet-4` on the [Continue Hub](https://hub.continue.dev/tetrate/claude-sonnet-4). + +**Reference it in your Agent configuration:** + +```yaml title="my-agent" +name: My Agent +version: 1.0.0 +schema: v1 +models: + - uses: tetrate/claude-sonnet-4 + with: + TETRATE_API_KEY: ${{ secrets.TETRATE_API_KEY }} +context: + - uses: continuedev/diff-context + - uses: continuedev/terminal-context + - uses: continuedev/file-context +``` + +To customize, see the [model block creation guide](/hub/blocks/create-a-block). + + + + + +**When to use**: Reuse configurations across agents and keep them local or in GitHub (not on Continue Hub). + +**The Local Model Block:** + +Name the file `my-claude-4-model.yaml` so you can reference it in the Agent. + + +```yaml title="~/.continue/models/my-claude-4-model.yaml" +name: Claude Sonnet 4 +version: 1.0.1 +schema: v1 +models: + - name: Claude Sonnet 4 + provider: tars + model: claude-4-sonnet-20250514 + apiKey: ${{ inputs.TETRATE_API_KEY }} + roles: + - chat + - edit + - apply + capabilities: + - tool_use +``` +Reference it as `my-claude-4-model` in your Agent configuration: + +```yaml title="~/.continue/agents/simple-agent.yaml" +name: Simple Agent +version: 1.0.0 +schema: v1 +models: + - uses: my-claude-4-model + with: + TETRATE_API_KEY: ${{ secrets.TETRATE_API_KEY }} +context: + - uses: continuedev/diff-context + - uses: continuedev/terminal-context + - uses: continuedev/file-context ``` -### On Model Block on Continue Hub -Learn how to use model blocks on Continue Hub [here](/hub/blocks/create-a-block). + +Learn more about [model blocks](/reference#models) and [local blocks](/reference#local-blocks). + -```yaml title="model_name.yaml" - name: - models: - - name: - provider: openai - model: - apiKey: ${{ inputs.TETRATE_API_KEY }} - apiBase: https://api.router.tetrate.ai/v1 - roles: - - chat - - edit - - apply - capabilities: - - tool_use -``` + + + +--- + +## Troubleshooting Common Issues + + + + Verify your API key is active and has no extra spaces. + + + Confirm the model ID matches the Tetrate catalog. + + + Check your network or try a less-loaded model. Contact Tetrate support if issues persist. + + + Validate YAML syntax and review error messages in Continue. If using Hub, ensure the block is published. + + + +--- + +## Join the Community +Connect with Tetrate and other builders for help and discussion. + + + +Get answers, insights, and best practices for secure, scalable infrastructure + + diff --git a/docs/docs.json b/docs/docs.json index d6469ae2f..2d8fca1ae 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -233,6 +233,7 @@ "guides/codebase-documentation-awareness", "guides/cli", "guides/continuous-ai", + "guides/posthog-github-continuous-ai", "guides/continuous-ai-readiness-assessment", "guides/plan-mode-guide", "guides/ollama-guide", @@ -354,10 +355,6 @@ "source": "/hub/blocks", "destination": "/hub/blocks/intro" }, - { - "source": "/hub/agents/intro", - "destination": "/hub/agents/intro" - }, { "source": "/customize", "destination": "/customization/overview" diff --git a/docs/guides/overview.mdx b/docs/guides/overview.mdx index 19b639758..306804c3f 100644 --- a/docs/guides/overview.mdx +++ b/docs/guides/overview.mdx @@ -14,6 +14,7 @@ description: "Comprehensive collection of practical guides for Continue includin - [Continuous AI: A Developer's Guide](/guides/continuous-ai) - Integrating AI into development workflows - [How to Use Continue CLI (cn)](/guides/cli) - Command-line interface for Continue - [Continuous AI Readiness Assessment](/guides/continuous-ai-readiness-assessment) - Evaluate team readiness for Continuous AI adoption +- [PostHog Session Analysis with Continue CLI](/guides/posthog-github-continuous-ai) - Analyze user behavior data to optimize your codebase with automatic issue creation ## What Advanced Tutorials Are Available diff --git a/docs/guides/posthog-github-continuous-ai.mdx b/docs/guides/posthog-github-continuous-ai.mdx new file mode 100644 index 000000000..1127f8166 --- /dev/null +++ b/docs/guides/posthog-github-continuous-ai.mdx @@ -0,0 +1,496 @@ +--- +title: "Building a Continuous AI Workflow with PostHog and GitHub" +description: "Build an automated system that continuously monitors PostHog session recordings, analyzes UX issues using Continue CLI, and creates GitHub issues automatically." +sidebarTitle: "PostHog Session Analysis with Continue CLI" +--- + + + A fully automated workflow that uses Continue CLI to fetch PostHog session + data, analyze user experience issues with AI, and automatically create GitHub + issues with specific technical recommendations + + +## Prerequisites + +Before starting, ensure you have: + +- GitHub repository where you want to create issues +- PostHog account with **[session recordings enabled and collecting data](https://posthog.com/docs/session-replay/installation)** +- Node.js 18+ installed locally +- Continue CLI account with **active credits** (required for API usage) + + + + ```bash + npm i -g @continuedev/cli + ``` + + + + 1. Visit [Continue Organizations](https://hub.continue.dev/settings/organizations) + 2. Sign up or log in to your Continue account + 3. Navigate to your organization settings + 4. Click **"API Keys"** and then **"+ New API Key"** + 5. Copy the API key immediately (you won't see it again!) + 6. Login to the CLI: `cn login` + + + + Continue CLI will securely store your API keys as secrets that can be referenced in prompts. + + + + + Continue CLI handles all the complex API interactions - you just need to + provide the right prompts! + + +## Step 1: Set Up Your Credentials + +First, you'll need to gather your API credentials and add them as secrets in Continue CLI. + +### Get Your PostHog API Credentials + +You need a **Personal API Key** (not a Project API key) to access session recordings: + +1. Go to [Personal API Keys](https://app.posthog.com/settings/user-api-keys) in PostHog +2. Click **+ Create a personal API Key** +3. Name it "Continue CLI Session Analysis" +4. Select these scopes: + - `session_recording:read` - **Required** for accessing session data + - `insight:read` - Optional, for additional analytics +5. Copy the key immediately (you won't see it again!) + + + **Find Your Project Details**: Your Project ID is in your PostHog URL: + `https://app.posthog.com/project/YOUR_PROJECT_ID` + + +### Get Your GitHub Personal Access Token + +1. Go to [GitHub Personal Access Tokens](https://github.com/settings/personal-access-tokens/new) +2. Click **"Generate new token (classic)"** +3. Name it "Continue CLI PostHog Analysis" +4. Select these scopes: + - `repo` (or just `public_repo` if your repository is public) + - `issues:write` - **Required** for creating issues +5. Copy the token immediately + +### Add Secrets to Continue CLI + +Use Continue CLI's built-in environment setup helper: + +```bash +cn -p "Help me set up my environment for PostHog session analysis. Please: +1. Check if I have the required secrets configured in Continue CLI: + - POSTHOG_API_KEY + - POSTHOG_PROJECT_ID + - POSTHOG_HOST + - GITHUB_PAT +2. If any are missing, guide me through: + - How to get PostHog Personal API Key from PostHog settings + - How to find my PostHog Project ID from the URL + - How to create a GitHub Personal Access Token with issues:write permission + - How to add these as secrets in Continue CLI +3. Help me identify my GitHub repository owner and name by: + - Checking git remote origin URL + - Or asking me to provide them +4. Test the API connections by making a simple API call to both PostHog and GitHub to verify the credentials work. +Please walk me through this setup process step by step." +``` + + + Continue CLI will guide you through adding secrets and testing your API + connections. Follow the prompts to add: - `POSTHOG_API_KEY`: Your PostHog + Personal API Key - `POSTHOG_PROJECT_ID`: Your PostHog Project ID - + `POSTHOG_HOST`: `https://us.posthog.com` (or your custom PostHog host) - + `GITHUB_PAT`: Your GitHub Personal Access Token + + +## Step 2: Analyze PostHog Sessions with Continue CLI + +Now you'll use Continue CLI to fetch PostHog session data and analyze it for UX issues. Continue CLI handles all the API calls and analysis automatically. + +### Run the Analysis + +Use this prompt with Continue CLI to fetch and analyze your PostHog sessions: + +```bash +cn -p "I need you to help me analyze PostHog session recordings to identify UX issues. Please: + +1. First, fetch session recordings from PostHog using these details: + - Use the POSTHOG_API_KEY, POSTHOG_PROJECT_ID, and POSTHOG_HOST from my secrets + - API endpoint: {POSTHOG_HOST}/api/projects/{POSTHOG_PROJECT_ID}/session_recordings/?limit=20 + - Include Authorization header: 'Bearer {POSTHOG_API_KEY}' + +2. Filter the sessions to find problematic ones with either: + - console_error_count > 0 (JavaScript errors) + - recording_duration > 300 (sessions longer than 5 minutes) + +3. Analyze the filtered sessions and create exactly 3 GitHub issues for the most critical UX problems. + +4. Format each issue like this: +### 1. **Issue Title Here** +**Problem**: One sentence describing the user problem +**Technical Causes**: Brief technical explanation +**Affected Pages**: List the URLs +**Recommended Fix**: +- Specific action item 1 +- Specific action item 2 +**Priority**: **HIGH** or **MEDIUM** or **LOW** +**Impact**: Quantify the impact (e.g., 'Affects 80% of sessions') + +Please make the API call, analyze the data, and provide the 3 formatted issues. Base all recommendations on actual patterns in the session data." +``` + + + **What Continue CLI Does:** - Makes authenticated API calls to PostHog using + your stored secrets - Fetches and filters session recordings automatically - + Analyzes patterns in the data using AI - Generates structured issue + descriptions ready for GitHub + + + + Save the analysis output to a file by adding `> analysis-results.txt` to the + command if you want to review it later. + + +## Step 3: Create GitHub Issues Automatically + +Now use Continue CLI to create GitHub issues from your analysis results: + +```bash +cn -p "I have analyzed PostHog session data and identified UX issues. Now I need you to create GitHub issues using the GitHub API. + +Use these details from my secrets: +- GITHUB_PAT: My GitHub Personal Access Token +- Repository: Extract from git remote or ask me to specify + +For each issue in my analysis: +1. Parse the issue title, body content, and priority level +2. Create a GitHub issue via API POST to: https://api.github.com/repos/{owner}/{repo}/issues +3. Use these headers: + - Authorization: token {GITHUB_PAT} + - Accept: application/vnd.github.v3+json + - Content-Type: application/json +4. Set labels based on priority: + - HIGH: [\"bug\", \"high-priority\", \"user-experience\", \"automated\"] + - MEDIUM: [\"enhancement\", \"medium-priority\", \"user-experience\", \"automated\"] + - LOW: [\"low-priority\", \"user-experience\", \"automated\"] +5. Format the issue title as: \"🔍 UX Issue: {original title}\" + +Please create the GitHub issues and confirm they were successfully created with issue numbers and URLs. +" +``` + + +**Repository Labels Required**: Make sure your GitHub repository has these labels: +- `bug`, `enhancement` +- `high-priority`, `medium-priority`, `low-priority` +- `user-experience`, `automated` + +Create missing labels in your repo at: **Settings → Labels → New label** + + + + + **What Continue CLI Does:** - Parses your analysis results automatically - + Makes authenticated GitHub API calls using your stored token - Creates + properly formatted issues with appropriate labels - Checks for duplicate + issues to avoid spam - Provides confirmation with issue URLs + + +## Step 4: Set Up Automated GitHub Actions Workflow + +Create a GitHub Actions workflow that runs your Continue CLI analysis automatically on a schedule. + +### Add GitHub Secrets + +First, add these secrets to your GitHub repository: + +1. Go to **Repository Settings → Secrets and variables → Actions** +2. Click **"New repository secret"** and add: + - `CONTINUE_API_KEY`: Your Continue API key from hub.continue.dev + - `POSTHOG_API_KEY`: Your PostHog Personal API Key + - `POSTHOG_PROJECT_ID`: Your PostHog Project ID + - `POSTHOG_HOST`: `https://us.posthog.com` (or your custom PostHog host) + - `GITHUB_PAT`: Your GitHub Personal Access Token + +### Create GitHub Actions Workflow + +Create `.github/workflows/posthog-analysis.yml` in your repository: + +```yaml +name: PostHog Session Analysis with Continue CLI + +on: + schedule: + - cron: "0 6 * * *" # Run at 6 AM UTC daily + workflow_dispatch: # Allow manual triggering + +jobs: + analyze: + runs-on: ubuntu-latest + + permissions: + contents: read + issues: write + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "18" + + - name: Install Continue CLI + run: | + npm install -g @continuedev/cli + echo "✅ Continue CLI installed" + cn --version + + - name: Set up environment variables + run: | + echo "POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}" >> $GITHUB_ENV + echo "POSTHOG_PROJECT_ID=${{ secrets.POSTHOG_PROJECT_ID }}" >> $GITHUB_ENV + echo "POSTHOG_HOST=${{ secrets.POSTHOG_HOST || 'https://us.posthog.com' }}" >> $GITHUB_ENV + echo "GITHUB_PAT=${{ secrets.GITHUB_PAT }}" >> $GITHUB_ENV + echo "GITHUB_OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV + echo "GITHUB_REPO=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV + + - name: Authenticate with Continue CLI + run: | + # Set Continue API key + export CONTINUE_API_KEY="${{ secrets.CONTINUE_API_KEY }}" + # Login to Continue CLI + if ! cn auth login --api-key "$CONTINUE_API_KEY"; then + echo "❌ Failed to authenticate with Continue CLI" + exit 1 + fi + echo "✅ Continue CLI authenticated" + + - name: Run PostHog Session Analysis + run: | + echo "🎬 Starting PostHog session analysis..." + # Create the analysis prompt + cat > analysis_prompt.txt << 'EOF' + I need you to help me analyze PostHog session recordings to identify UX issues. Please: + + 1. First, fetch session recordings from PostHog using these details: + - Use the POSTHOG_API_KEY, POSTHOG_PROJECT_ID, and POSTHOG_HOST from environment variables + - API endpoint: $POSTHOG_HOST/api/projects/$POSTHOG_PROJECT_ID/session_recordings/?limit=20 + - Include Authorization header: "Bearer $POSTHOG_API_KEY" + + 2. Filter the sessions to find problematic ones with either: + - console_error_count > 0 (JavaScript errors) + - recording_duration > 300 (sessions longer than 5 minutes) + + 3. Analyze the filtered sessions and create exactly 3 GitHub issues for the most critical UX problems. + + 4. Format each issue like this: + ### 1. **Issue Title Here** + **Problem**: One sentence describing the user problem + **Technical Causes**: Brief technical explanation + **Affected Pages**: List the URLs + **Recommended Fix**: + - Specific action item 1 + - Specific action item 2 + **Priority**: **HIGH** or **MEDIUM** or **LOW** + **Impact**: Quantify the impact (e.g., 'Affects 80% of sessions') + + Please make the API call, analyze the data, and provide the 3 formatted issues. Base all recommendations on actual patterns in the session data. + + Environment context: + - POSTHOG_API_KEY: $POSTHOG_API_KEY + - POSTHOG_PROJECT_ID: $POSTHOG_PROJECT_ID + - POSTHOG_HOST: $POSTHOG_HOST + - GitHub Repo: $GITHUB_OWNER/$GITHUB_REPO + EOF + + # Run the analysis + cn < analysis_prompt.txt > analysis-results.txt 2>&1 + + # Check if analysis completed + if [ ! -s analysis-results.txt ]; then + echo "❌ Analysis failed or produced no output" + exit 1 + fi + + echo "✅ Analysis completed" + echo "📄 Analysis results preview:" + head -20 analysis-results.txt + + - name: Create GitHub Issues from Analysis + run: | + echo "📝 Creating GitHub issues from analysis..." + # Create the issue creation prompt + cat > issue_prompt.txt << 'EOF' + I have analyzed PostHog session data and identified UX issues. Now I need you to create GitHub issues using the GitHub API. + + Use these details from environment variables: + - GITHUB_PAT: My GitHub Personal Access Token + - Repository: $GITHUB_OWNER/$GITHUB_REPO + + For each issue in my analysis: + 1. Parse the issue title, body content, and priority level + 2. Create a GitHub issue via API POST to: https://api.github.com/repos/$GITHUB_OWNER/$GITHUB_REPO/issues + 3. Use these headers: + - Authorization: token $GITHUB_PAT + - Accept: application/vnd.github.v3+json + - Content-Type: application/json + 4. Set labels based on priority: + - HIGH: ["bug", "high-priority", "user-experience", "automated"] + - MEDIUM: ["enhancement", "medium-priority", "user-experience", "automated"] + - LOW: ["low-priority", "user-experience", "automated"] + 5. Format the issue title as: "🔍 UX Issue: {original title}" + + Please create the GitHub issues and confirm they were successfully created with issue numbers and URLs. + + Here's my analysis to process: + EOF + + # Append the analysis results to the prompt + cat analysis-results.txt >> issue_prompt.txt + + # Run the issue creation + cn < issue_prompt.txt > issue-creation-results.txt 2>&1 + + echo "✅ Issue creation completed" + echo "📄 Issue creation results:" + cat issue-creation-results.txt + + - name: Upload Analysis Artifacts + uses: actions/upload-artifact@v4 + if: always() + with: + name: analysis-results-${{ github.run_number }} + path: | + analysis-results.txt + issue-creation-results.txt + retention-days: 30 + + - name: Summary + run: | + echo "✅ PostHog analysis workflow completed!" + echo "📊 Check the artifacts for detailed analysis results" + echo "🐛 Check your repository issues for newly created UX issues" +``` + +## Step 5: Testing Your Workflow + +### Test Locally First + +Before setting up automation, test the workflow locally: + +**Test 1: Session Analysis** + +```bash +cn -p "[Paste the PostHog analysis prompt from Step 2]" +``` + +Expected: Analysis output with 3 formatted GitHub issues + +**Test 2: Issue Creation** + +```bash +cn -p "[Paste the GitHub issue creation prompt from Step 3 with your analysis results]" +``` + +Expected: Confirmation of GitHub issues created with URLs + +### Test the GitHub Actions Workflow + +1. **Manual Trigger**: Go to **Actions** tab in your repository and manually trigger the workflow +2. **Check Artifacts**: Download the analysis results from the workflow run +3. **Verify Issues**: Check that GitHub issues were created in your repository + + + **Success Indicators:** - PostHog API returns session data (not empty) - + Continue CLI generates analysis with identified issues - GitHub issues are + created with proper labels and formatting - Workflow completes without errors + + +## Troubleshooting + +If you encounter issues, use this helpful prompt to diagnose problems: + +```bash +cn -p "Help me set up my environment for PostHog session analysis. Please: + +1. Check if I have the required secrets configured in Continue CLI: + - POSTHOG_API_KEY + - POSTHOG_PROJECT_ID + - POSTHOG_HOST + - GITHUB_PAT + +2. If any are missing, guide me through: + - How to get PostHog Personal API Key from PostHog settings + - How to find my PostHog Project ID from the URL + - How to create a GitHub Personal Access Token with issues:write permission + - How to add these as secrets in Continue CLI + +3. Help me identify my GitHub repository owner and name by: + - Checking git remote origin URL + - Or asking me to provide them + +4. Test the API connections by making a simple API call to both PostHog and GitHub to verify the credentials work. + +Please walk me through this setup process step by step." +``` + +## What You've Built + +After completing this guide, you have a complete **Continuous AI system** that: + +✅ **Monitors user experience** - Automatically fetches and analyzes PostHog session data +✅ **Identifies problems intelligently** - Uses AI to spot patterns and technical issues +✅ **Creates actionable tasks** - Generates GitHub issues with specific recommendations +✅ **Runs autonomously** - Operates daily without manual intervention using GitHub Actions +✅ **Scales with your team** - Handles growing amounts of session data automatically + + + Your system now operates at **[Level 2 Continuous + AI](https://blog.continue.dev/what-is-continuous-ai-a-developers-guide/)** - + AI handles routine analysis tasks with human oversight through GitHub issue + review and prioritization. + + +## Security Best Practices + + + **Protect Your API Keys:** - Store all credentials as GitHub Secrets, never in + code - Use Continue CLI's secure secret storage - Limit token scopes to + minimum required permissions - Rotate API keys regularly (every 90 days + recommended) - Monitor token usage for unusual activity + + +## Advanced Prompts + +Consider enhancing your workflow with these advanced Continue CLI prompts: + + + + "Analyze PostHog performance metrics alongside session recordings to + identify slow page loads affecting user experience" + + + "Cross-reference JavaScript console errors with user actions to identify the + root cause of UX issues" + + + "Analyze how PostHog feature flags impact user behavior in session + recordings" + + + "Create Slack alerts when critical UX issues are detected in PostHog + sessions" + + + +## Next Steps + +1. **Monitor your first issues** - Review the GitHub issues created and implement fixes +2. **Measure impact** - Track how resolved issues improve PostHog metrics +3. **Refine prompts** - Adjust the Continue CLI prompts based on issue quality +4. **Scale the system** - Add more data sources or create specialized analysis workflows diff --git a/docs/reference.mdx b/docs/reference.mdx index 8da668f9f..2738d55e9 100644 --- a/docs/reference.mdx +++ b/docs/reference.mdx @@ -403,6 +403,7 @@ The [Model Context Protocol](https://modelcontextprotocol.io/introduction) is a - `env`: An optional map of environment variables for the server process. - `cwd`: An optional working directory to run the command in. Can be absolute or relative path. - `connectionTimeout`: An optional connection timeout number to the server in milliseconds. +- `requestOptions`: Optional request options for `sse` and `streamable-http` servers. Same format as [model requestOptions](#models). **Example:** diff --git a/extensions/cli/package.json b/extensions/cli/package.json index be7b11ac7..7f212fab6 100644 --- a/extensions/cli/package.json +++ b/extensions/cli/package.json @@ -37,7 +37,7 @@ "license": "Apache-2.0", "repository": { "type": "git", - "url": "https://github.com/continuedev/cli.git" + "url": "https://github.com/continuedev/continue.git" }, "bugs": { "url": "https://github.com/continuedev/continue/issues" diff --git a/extensions/cli/src/commands/commands.ts b/extensions/cli/src/commands/commands.ts index 82e4a8a71..fe88d1a5e 100644 --- a/extensions/cli/src/commands/commands.ts +++ b/extensions/cli/src/commands/commands.ts @@ -40,6 +40,11 @@ export const SYSTEM_SLASH_COMMANDS: SystemCommand[] = [ description: "Sign out of your current session", category: "system", }, + { + name: "update", + description: "Update the Continue CLI", + category: "system", + }, { name: "whoami", description: "Check who you're currently logged in as", diff --git a/extensions/cli/src/infoScreen.ts b/extensions/cli/src/infoScreen.ts index 2a95bf363..fc495c94c 100644 --- a/extensions/cli/src/infoScreen.ts +++ b/extensions/cli/src/infoScreen.ts @@ -9,13 +9,10 @@ import { } from "./auth/workos.js"; import { services } from "./services/index.js"; import { getCurrentSession, getSessionFilePath } from "./session.js"; -import { posthogService } from "./telemetry/posthogService.js"; import { logger } from "./util/logger.js"; import { getVersion } from "./version.js"; export async function handleInfoSlashCommand() { - posthogService.capture("useSlashCommand", { name: "info" }); - const infoLines = []; // Version and working directory info diff --git a/extensions/cli/src/services/UpdateService.ts b/extensions/cli/src/services/UpdateService.ts new file mode 100644 index 000000000..6d1c893bc --- /dev/null +++ b/extensions/cli/src/services/UpdateService.ts @@ -0,0 +1,241 @@ +import { exec, spawn } from "child_process"; +import { promisify } from "util"; + +import { GlobalContext } from "core/util/GlobalContext.js"; + +import { logger } from "src/util/logger.js"; + +import { compareVersions, getLatestVersion, getVersion } from "../version.js"; + +import { BaseService } from "./BaseService.js"; +import { serviceContainer } from "./ServiceContainer.js"; +import { UpdateServiceState, UpdateStatus } from "./types.js"; +const execAsync = promisify(exec); + +/** + * Service for checking and performing CLI updates + */ +export class UpdateService extends BaseService { + constructor() { + super("update", { + autoUpdate: true, + isAutoUpdate: true, + status: UpdateStatus.IDLE, + message: "", + error: null, + isUpdateAvailable: false, + latestVersion: null, + currentVersion: getVersion(), + }); + } + + /** + * Initialize the update service + */ + async doInitialize(headless?: boolean) { + // Don't automatically check in tests/headless + if (!headless && process.env.NODE_ENV !== "test") { + void this.checkAndAutoUpdate(); + } + + return this.currentState; + } + + private async checkAndAutoUpdate() { + // First get auto update setting from global context + const globalContext = new GlobalContext(); + const autoUpdate = globalContext.get("autoUpdateCli") ?? true; + this.setState({ + autoUpdate, + }); + + try { + // Check for updates + this.setState({ + status: UpdateStatus.CHECKING, + message: "Checking for updates", + }); + + const latestVersion = await getLatestVersion(); + this.setState({ + latestVersion, + }); + + if (!latestVersion) { + this.setState({ + status: UpdateStatus.IDLE, + message: "Continue CLI", + isUpdateAvailable: false, + }); + return; + } + + const comparison = compareVersions( + this.currentState.currentVersion, + latestVersion, + ); + const isUpdateAvailable = comparison === "older"; + this.setState({ + isUpdateAvailable, + }); + + if (this.currentState.currentVersion === "0.0.0-dev") { + this.setState({ + status: UpdateStatus.IDLE, + message: `Continue CLI`, + isUpdateAvailable, + latestVersion, + }); + return; // Uncomment to test auto-update behavior in dev + } + + // If update is available, automatically update + if ( + autoUpdate && + isUpdateAvailable && + this.currentState.status !== "updating" && + !process.env.CONTINUE_CLI_AUTO_UPDATED //Already auto updated, preventing sequential auto-update + ) { + await this.performUpdate(true); + } else { + this.setState({ + status: UpdateStatus.IDLE, + message: isUpdateAvailable + ? `Update available: v${latestVersion}` + : `Continue CLI v${this.currentState.currentVersion}`, + isUpdateAvailable, + latestVersion, + }); + } + } catch (error: any) { + logger.error("Error checking for updates:", error); + this.setState({ + status: UpdateStatus.ERROR, + message: `Continue CLI v${this.currentState.currentVersion}`, + error, + }); + } + } + + public async setAutoUpdate(value: boolean) { + const globalContext = new GlobalContext(); + globalContext.update("autoUpdateCli", value); + this.setState({ + autoUpdate: value, + }); + } + + // TODO this is a hack because our service state update code is broken + // Currently all things that need update use serviceContainer.set manually + // Rather than actually using the stateChanged event + setState(newState: Partial): void { + super.setState(newState); + serviceContainer.set("update", this.currentState); + } + + async performUpdate(isAutoUpdate?: boolean) { + if (this.currentState.status === "updating") { + return; + } + + try { + this.setState({ + isAutoUpdate, + status: UpdateStatus.UPDATING, + message: `${isAutoUpdate ? "Auto-updating" : "Updating"} to v${this.currentState.latestVersion}`, + }); + + // Install the update + const { stdout, stderr } = await execAsync("npm i -g @continuedev/cli"); + logger.debug("Update output:", { stdout, stderr }); + + if (stderr) { + const errLines = stderr.split("\n"); + for (const line of errLines) { + const lower = line.toLowerCase().trim(); + if ( + !line || + lower.includes("debugger") || + lower.includes("npm warn") + ) { + continue; + } + this.setState({ + status: UpdateStatus.ERROR, + message: `Error updating to v${this.currentState.latestVersion}`, + error: new Error(stderr), + }); + return; + } + } + + this.setState({ + status: UpdateStatus.UPDATED, + message: `${isAutoUpdate ? "Auto-updated to" : "Restart for"} v${this.currentState.latestVersion}`, + isUpdateAvailable: false, + }); + if (isAutoUpdate) { + this.restartCLI(); + } + } catch (error: any) { + logger.error("Error updating CLI:", error); + this.setState({ + status: UpdateStatus.ERROR, + message: isAutoUpdate ? "Auto-update failed" : "Update failed", + error, + }); + setTimeout(() => { + this.setState({ + status: UpdateStatus.IDLE, + message: `/update to v${this.currentState.latestVersion}`, + }); + }, 4000); + } + } + + private restartCLI(): void { + try { + const entryPoint = process.argv[1]; + const cliArgs = process.argv.slice(2); + const nodeExecutable = process.execPath; + + logger.debug( + `Preparing for CLI restart with: ${nodeExecutable} ${entryPoint} ${cliArgs.join( + " ", + )}`, + ); + + // Halt/clean up parent cn process + try { + // Remove all input listeners + global.clearTimeout = () => {}; + global.clearInterval = () => {}; + process.stdin.removeAllListeners(); + process.stdin.pause(); + // console.clear(); // Don't want to clear things that were in console before cn started + } catch (e) { + logger.debug("Error cleaning up terminal:", e); + } + + // Spawn a new detached cn process + const child = spawn(nodeExecutable, [entryPoint, ...cliArgs], { + detached: true, + stdio: "inherit", + env: { + ...process.env, + CONTINUE_CLI_AUTO_UPDATED: "true", + }, + }); + + // I did not find a way on existing to avoid a bug where next process has input glitches without leaving parent in place + // So instead of existing, parent will exit when child exits + // process.exit(0); + child.on("exit", (code) => { + process.exit(code); + }); + child.unref(); + } catch (error) { + logger.error("Failed to restart CLI:", error); + } + } +} diff --git a/extensions/cli/src/services/index.ts b/extensions/cli/src/services/index.ts index ae53965ab..068f53542 100644 --- a/extensions/cli/src/services/index.ts +++ b/extensions/cli/src/services/index.ts @@ -21,6 +21,7 @@ import { ServiceInitOptions, ServiceInitResult, } from "./types.js"; +import { UpdateService } from "./UpdateService.js"; // Service instances const authService = new AuthService(); @@ -31,6 +32,7 @@ const mcpService = new MCPService(); const fileIndexService = new FileIndexService(); const resourceMonitoringService = new ResourceMonitoringService(); const chatHistoryService = new ChatHistoryService(); +const updateService = new UpdateService(); /** * Initialize all services and register them with the service container @@ -132,6 +134,12 @@ export async function initializeServices( [], // No dependencies ); + serviceContainer.register( + SERVICE_NAMES.UPDATE, + () => updateService.initialize(), + [], // No dependencies + ); + serviceContainer.register( SERVICE_NAMES.API_CLIENT, async () => { @@ -283,17 +291,9 @@ export function reloadService(serviceName: string) { * Check if all core services are ready */ export function areServicesReady(): boolean { - return [ - SERVICE_NAMES.TOOL_PERMISSIONS, - SERVICE_NAMES.AUTH, - SERVICE_NAMES.API_CLIENT, - SERVICE_NAMES.CONFIG, - SERVICE_NAMES.MODEL, - SERVICE_NAMES.MCP, - SERVICE_NAMES.FILE_INDEX, - SERVICE_NAMES.RESOURCE_MONITORING, - SERVICE_NAMES.CHAT_HISTORY, - ].every((name) => serviceContainer.isReady(name)); + return Object.values(SERVICE_NAMES).every((name) => + serviceContainer.isReady(name), + ); } /** @@ -317,6 +317,7 @@ export const services = { resourceMonitoring: resourceMonitoringService, systemMessage: systemMessageService, chatHistory: chatHistoryService, + updateService: updateService, } as const; // Export the service container for advanced usage diff --git a/extensions/cli/src/services/types.ts b/extensions/cli/src/services/types.ts index 18fb2cbae..ae1c80b53 100644 --- a/extensions/cli/src/services/types.ts +++ b/extensions/cli/src/services/types.ts @@ -81,6 +81,25 @@ export interface MCPServiceState { prompts: MCPPrompt[]; } +export enum UpdateStatus { + IDLE = "idle", + CHECKING = "checking", + UPDATING = "updating", + UPDATED = "updated", + ERROR = "error", +} + +export interface UpdateServiceState { + autoUpdate: boolean; + isAutoUpdate: boolean; + status: UpdateStatus; + message: string; + error?: Error | null; + isUpdateAvailable: boolean; + latestVersion: string | null; + currentVersion: string; +} + export interface ApiClientServiceState { apiClient: DefaultApiInterface | null; } @@ -92,8 +111,8 @@ export interface ToolPermissionServiceState { originalPolicies?: ToolPermissions; } -export type { FileIndexServiceState } from "./FileIndexService.js"; export type { ChatHistoryState } from "./ChatHistoryService.js"; +export type { FileIndexServiceState } from "./FileIndexService.js"; /** * Service names as constants to prevent typos @@ -109,6 +128,7 @@ export const SERVICE_NAMES = { RESOURCE_MONITORING: "resourceMonitoring", SYSTEM_MESSAGE: "systemMessage", CHAT_HISTORY: "chatHistory", + UPDATE: "update", } as const; /** diff --git a/extensions/cli/src/slashCommands.ts b/extensions/cli/src/slashCommands.ts index d708a1c7d..c4673a7d5 100644 --- a/extensions/cli/src/slashCommands.ts +++ b/extensions/cli/src/slashCommands.ts @@ -48,12 +48,10 @@ async function handleHelp(_args: string[], _assistant: AssistantConfig) { ` Type ${chalk.cyan("/")} to see available slash commands`, ` Type ${chalk.cyan("!")} followed by a command to execute bash directly`, ].join("\n"); - posthogService.capture("useSlashCommand", { name: "help" }); return { output: helpMessage }; } async function handleLogin() { - posthogService.capture("useSlashCommand", { name: "login" }); try { const newAuthState = await services.auth.login(); await reloadService(SERVICE_NAMES.AUTH); @@ -79,7 +77,6 @@ async function handleLogin() { } async function handleLogout() { - posthogService.capture("useSlashCommand", { name: "logout" }); try { await services.auth.logout(); return { @@ -95,7 +92,6 @@ async function handleLogout() { } function handleWhoami() { - posthogService.capture("useSlashCommand", { name: "whoami" }); if (isAuthenticated()) { const config = loadAuthConfig(); if (config && isAuthenticatedConfig(config)) { @@ -118,8 +114,6 @@ function handleWhoami() { } async function handleFork() { - posthogService.capture("useSlashCommand", { name: "fork" }); - try { const currentSession = getCurrentSession(); const forkCommand = `cn --fork ${currentSession.sessionId}`; @@ -148,15 +142,12 @@ async function handleFork() { const commandHandlers: Record = { help: handleHelp, clear: () => { - posthogService.capture("useSlashCommand", { name: "clear" }); return { clear: true, output: "Chat history cleared" }; }, exit: () => { - posthogService.capture("useSlashCommand", { name: "exit" }); return { exit: true, output: "Goodbye!" }; }, config: () => { - posthogService.capture("useSlashCommand", { name: "config" }); return { openConfigSelector: true }; }, login: handleLogin, @@ -165,38 +156,25 @@ const commandHandlers: Record = { info: handleInfoSlashCommand, model: () => ({ openModelSelector: true }), compact: () => { - posthogService.capture("useSlashCommand", { name: "compact" }); return { compact: true }; }, mcp: () => { - posthogService.capture("useSlashCommand", { name: "mcp" }); return { openMcpSelector: true }; }, resume: () => { - posthogService.capture("useSlashCommand", { name: "resume" }); return { openSessionSelector: true }; }, fork: handleFork, - init: (args, assistant) => { - posthogService.capture("useSlashCommand", { name: "init" }); - return handleInit(args, assistant); + init: handleInit, + update: () => { + return { openUpdateSelector: true }; }, }; export async function handleSlashCommands( input: string, assistant: AssistantConfig, -): Promise<{ - output?: string; - exit?: boolean; - newInput?: string; - clear?: boolean; - openConfigSelector?: boolean; - openModelSelector?: boolean; - openMCPSelector?: boolean; - openSessionSelector?: boolean; - compact?: boolean; -} | null> { +): Promise { // Only trigger slash commands if slash is the very first character if (!input.startsWith("/") || !input.trim().startsWith("/")) { return null; diff --git a/extensions/cli/src/stream/streamChatResponse.ts b/extensions/cli/src/stream/streamChatResponse.ts index 4c1c45cc5..e70f6ddb4 100644 --- a/extensions/cli/src/stream/streamChatResponse.ts +++ b/extensions/cli/src/stream/streamChatResponse.ts @@ -16,9 +16,11 @@ import { telemetryService } from "../telemetry/telemetryService.js"; import { ToolCall } from "../tools/index.js"; import { chatCompletionStreamWithBackoff, + isContextLengthError, withExponentialBackoff, } from "../util/exponentialBackoff.js"; import { logger } from "../util/logger.js"; +import { validateContextLength } from "../util/tokenizer.js"; import { getAllTools, handleToolCalls } from "./handleToolCalls.js"; import { handleAutoCompaction } from "./streamChatResponse.autoCompaction.js"; @@ -148,6 +150,12 @@ export async function processStreamingResponse( tools, } = options; + // Validate context length before making the request + const validation = validateContextLength(chatHistory, model); + if (!validation.isValid) { + throw new Error(`Context length validation failed: ${validation.error}`); + } + // Get fresh system message and inject it const systemMessage = await systemMessageService.getSystemMessage(); const openaiChatHistory = convertFromUnifiedHistoryWithSystemMessage( @@ -277,6 +285,13 @@ export async function processStreamingResponse( shouldContinue: false, }; } + + // Handle context length errors with helpful message + if (isContextLengthError(error)) { + logger.debug(`Context length exceeded: ${error}`); + throw new Error(`Context length exceeded: ${error}`); + } + throw error; } diff --git a/extensions/cli/src/tools/index.tsx b/extensions/cli/src/tools/index.tsx index a4cb3dcb7..cc51f0e01 100644 --- a/extensions/cli/src/tools/index.tsx +++ b/extensions/cli/src/tools/index.tsx @@ -6,8 +6,10 @@ import { serviceContainer, } from "../services/index.js"; import type { ToolPermissionServiceState } from "../services/ToolPermissionService.js"; +import type { ModelServiceState } from "../services/types.js"; import { telemetryService } from "../telemetry/telemetryService.js"; import { logger } from "../util/logger.js"; +import { isModelCapable } from "../utils/index.js"; import { editTool } from "./edit.js"; import { exitTool } from "./exit.js"; @@ -66,9 +68,53 @@ function getDynamicTools(): Tool[] { return dynamicTools; } -// Get all builtin tools including dynamic ones +// Check if the current model is capable and should exclude Edit tool +function shouldExcludeEditTool(): boolean { + try { + const modelServiceResult = getServiceSync( + SERVICE_NAMES.MODEL, + ); + + if ( + modelServiceResult.state === "ready" && + modelServiceResult.value?.model + ) { + const { name, provider, model } = modelServiceResult.value.model; + + // Check if model is capable + const isCapable = isModelCapable(provider, name, model); + + logger.debug("Capability-based tool filtering", { + provider, + name, + isCapable, + willExcludeEdit: isCapable, + }); + + return isCapable; + } + } catch (error) { + logger.debug("Error checking model capability for tool filtering", { + error, + }); + } + return false; +} + +// Get all builtin tools including dynamic ones, with capability-based filtering export function getAllBuiltinTools(): Tool[] { - return [...BUILTIN_TOOLS, ...getDynamicTools()]; + let builtinTools = [...BUILTIN_TOOLS]; + + // Apply capability-based filtering for edit tools + // If model is capable, exclude editTool in favor of multiEditTool + if (shouldExcludeEditTool()) { + builtinTools = builtinTools.filter((tool) => tool.name !== editTool.name); + logger.debug( + "Excluded Edit tool for capable model - MultiEdit will be used instead", + ); + } + + return [...builtinTools, ...getDynamicTools()]; } export function getToolDisplayName(toolName: string): string { diff --git a/extensions/cli/src/tools/multiEdit.ts b/extensions/cli/src/tools/multiEdit.ts index 2164c6742..351a37afe 100644 --- a/extensions/cli/src/tools/multiEdit.ts +++ b/extensions/cli/src/tools/multiEdit.ts @@ -9,7 +9,6 @@ import { getLanguageFromFilePath, } from "../telemetry/utils.js"; -import { editTool } from "./edit.js"; import { readFilesSet, readFileTool } from "./readFile.js"; import { Tool } from "./types.js"; import { generateDiff } from "./writeFile.js"; @@ -133,8 +132,8 @@ export const multiEditTool: Tool = { displayName: "MultiEdit", readonly: false, isBuiltIn: true, - description: `This is a tool for making multiple edits to a single file in one operation. It is built on top of the ${editTool.name} tool and allows you to perform multiple find-and-replace operations efficiently. -Prefer this tool over the ${editTool.name} tool when you need to make multiple edits to the same file. + description: `This is a tool for making multiple edits to a single file in one operation. It allows you to perform multiple find-and-replace operations efficiently. +This tool is ideal when you need to make multiple edits to the same file. To make multiple edits to a file, provide the following: 1. file_path: The absolute path to the file to modify (must be absolute, not relative) diff --git a/extensions/cli/src/ui/LoadingText.tsx b/extensions/cli/src/ui/LoadingText.tsx new file mode 100644 index 000000000..9d19cc5c4 --- /dev/null +++ b/extensions/cli/src/ui/LoadingText.tsx @@ -0,0 +1,33 @@ +import { Text } from "ink"; +import React, { useEffect, useState } from "react"; + +interface LoadingTextProps { + text: string; + color?: string; + interval?: number; +} + +export const LoadingText: React.FC = ({ + text, + color = "gray", + interval = 300, +}) => { + const [dotsCount, setDotsCount] = useState(1); + + useEffect(() => { + const timer = setInterval(() => { + setDotsCount((current) => (current % 3) + 1); + }, interval); + + return () => clearInterval(timer); + }, [interval]); + + const dots = ".".repeat(dotsCount); + + return ( + + {text} + {dots} + + ); +}; diff --git a/extensions/cli/src/ui/TUIChat.tsx b/extensions/cli/src/ui/TUIChat.tsx index 4efede92b..c310b50ed 100644 --- a/extensions/cli/src/ui/TUIChat.tsx +++ b/extensions/cli/src/ui/TUIChat.tsx @@ -14,6 +14,7 @@ import { ConfigServiceState, MCPServiceState, ModelServiceState, + UpdateServiceState, } from "../services/types.js"; import { logger } from "../util/logger.js"; @@ -93,7 +94,8 @@ function useTUIChatServices(remoteUrl?: string) { model: ModelServiceState; mcp: MCPServiceState; apiClient: ApiClientServiceState; - }>(["auth", "config", "model", "mcp", "apiClient"]); + update: UpdateServiceState; + }>(["auth", "config", "model", "mcp", "apiClient", "update"]); return { services, allServicesReady, isRemoteMode }; } @@ -207,6 +209,7 @@ const TUIChat: React.FC = ({ onShowConfigSelector: () => navigateTo("config"), onShowModelSelector: () => navigateTo("model"), onShowMCPSelector: () => navigateTo("mcp"), + onShowUpdateSelector: () => navigateTo("update"), onShowSessionSelector: () => navigateTo("session"), onLoginPrompt: handleLoginPrompt, onReload: handleReload, diff --git a/extensions/cli/src/ui/UpdateNotification.test.tsx b/extensions/cli/src/ui/UpdateNotification.test.tsx index f4670dbda..5dc4c89a0 100644 --- a/extensions/cli/src/ui/UpdateNotification.test.tsx +++ b/extensions/cli/src/ui/UpdateNotification.test.tsx @@ -1,10 +1,3 @@ -// Mock the version module before any other imports -vi.mock("../version.js", () => ({ - getVersion: vi.fn(), - getLatestVersion: vi.fn(), - compareVersions: vi.fn(), -})); - // Mock useTerminalSize hook vi.mock("./hooks/useTerminalSize.js", () => ({ useTerminalSize: () => ({ columns: 80, rows: 24 }), @@ -30,93 +23,202 @@ import { render } from "ink-testing-library"; import React from "react"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -import * as versionModule from "../version.js"; +import { UpdateStatus } from "../services/types.js"; import { UpdateNotification } from "./UpdateNotification.js"; -const mockVersionModule = vi.mocked(versionModule); +// Mock useServices hook +const mockUseServices = vi.fn(); +vi.mock("../hooks/useService.js", () => ({ + useServices: () => mockUseServices(), +})); describe("UpdateNotification", () => { - let originalNodeEnv: string | undefined; - beforeEach(() => { vi.clearAllMocks(); - originalNodeEnv = process.env.NODE_ENV; - // Default mock implementations - mockVersionModule.getLatestVersion.mockResolvedValue("1.0.1"); - mockVersionModule.compareVersions.mockReturnValue("older"); + // Default mock implementation - no update available + mockUseServices.mockReturnValue({ + services: { + update: { + autoUpdate: true, + status: UpdateStatus.IDLE, + message: "Continue CLI v1.0.0", + error: null, + isUpdateAvailable: false, + latestVersion: null, + currentVersion: "1.0.0", + }, + }, + }); }); afterEach(() => { - // Restore original NODE_ENV - if (originalNodeEnv === undefined) { - delete process.env.NODE_ENV; - } else { - process.env.NODE_ENV = originalNodeEnv; - } + vi.clearAllMocks(); }); - it("should not check for updates when version ends with -dev", async () => { - // Set NODE_ENV to non-test value to enable update checks - process.env.NODE_ENV = "development"; - mockVersionModule.getVersion.mockReturnValue("1.0.0-dev"); + it("should show default message when no update is available", () => { + const { lastFrame } = render(); - render(); - - // Wait a bit to ensure useEffect has run - await new Promise((resolve) => setTimeout(resolve, 50)); - - // getLatestVersion should not have been called for dev versions - expect(mockVersionModule.getLatestVersion).not.toHaveBeenCalled(); + expect(lastFrame()).toContain("◉ Continue CLI v1.0.0"); }); - it("should check for updates when version does not end with -dev", async () => { - // Set NODE_ENV to non-test value to enable update checks - process.env.NODE_ENV = "development"; - mockVersionModule.getVersion.mockReturnValue("1.0.0"); + it("should show update available message when update is available", () => { + mockUseServices.mockReturnValue({ + services: { + update: { + autoUpdate: true, + status: UpdateStatus.IDLE, + message: "Update available: v1.0.1", + error: null, + isUpdateAvailable: true, + latestVersion: "1.0.1", + currentVersion: "1.0.0", + }, + }, + }); - render(); + const { lastFrame } = render(); - // Wait a bit to ensure useEffect has run - await new Promise((resolve) => setTimeout(resolve, 50)); - - // getLatestVersion should have been called for non-dev versions - expect(mockVersionModule.getLatestVersion).toHaveBeenCalled(); + expect(lastFrame()).toContain("◉ Update available: v1.0.1"); }); - it("should handle various dev version formats", async () => { - // Set NODE_ENV to non-test value to enable update checks - process.env.NODE_ENV = "development"; - const devVersions = ["1.0.0-dev", "2.1.3-dev", "0.5.0-dev"]; + it("should show checking message when checking for updates", () => { + mockUseServices.mockReturnValue({ + services: { + update: { + autoUpdate: true, + status: UpdateStatus.CHECKING, + message: "Checking for updates", + error: null, + isUpdateAvailable: false, + latestVersion: null, + currentVersion: "1.0.0", + }, + }, + }); - for (const version of devVersions) { - vi.clearAllMocks(); - mockVersionModule.getVersion.mockReturnValue(version); + const { lastFrame } = render(); - render(); - - // Wait a bit to ensure useEffect has run - await new Promise((resolve) => setTimeout(resolve, 50)); - - expect(mockVersionModule.getLatestVersion).not.toHaveBeenCalled(); - } + expect(lastFrame()).toContain("◉ Checking for updates"); }); - it("should still check for updates with other version suffixes", async () => { - // Set NODE_ENV to non-test value to enable update checks - process.env.NODE_ENV = "development"; - const nonDevVersions = ["1.0.0-beta", "1.0.0-alpha", "1.0.0-rc1"]; + it("should show updating message when updating", () => { + mockUseServices.mockReturnValue({ + services: { + update: { + autoUpdate: true, + status: UpdateStatus.UPDATING, + message: "Updating to v1.0.1", + error: null, + isUpdateAvailable: false, + latestVersion: "1.0.1", + currentVersion: "1.0.0", + }, + }, + }); - for (const version of nonDevVersions) { - vi.clearAllMocks(); - mockVersionModule.getVersion.mockReturnValue(version); + const { lastFrame } = render(); - render(); + expect(lastFrame()).toContain("◉ Updating to v1.0.1"); + }); - // Wait a bit to ensure useEffect has run - await new Promise((resolve) => setTimeout(resolve, 50)); + it("should show updated message when update completes", () => { + mockUseServices.mockReturnValue({ + services: { + update: { + autoUpdate: true, + status: UpdateStatus.UPDATED, + message: "Auto-updated to v1.0.1", + error: null, + isUpdateAvailable: false, + latestVersion: "1.0.1", + currentVersion: "1.0.0", + }, + }, + }); - expect(mockVersionModule.getLatestVersion).toHaveBeenCalled(); - } + const { lastFrame } = render(); + + expect(lastFrame()).toContain("◉ Auto-updated to v1.0.1"); + }); + + it("should show error message when update fails", () => { + mockUseServices.mockReturnValue({ + services: { + update: { + autoUpdate: true, + status: UpdateStatus.ERROR, + message: "Update failed", + error: new Error("Update error"), + isUpdateAvailable: true, + latestVersion: "1.0.1", + currentVersion: "1.0.0", + }, + }, + }); + + const { lastFrame } = render(); + + expect(lastFrame()).toContain("◉ Update failed"); + }); + + it("should show remote mode when in remote mode and no update available", () => { + mockUseServices.mockReturnValue({ + services: { + update: { + autoUpdate: true, + status: UpdateStatus.IDLE, + message: "Continue CLI v1.0.0", + error: null, + isUpdateAvailable: false, + latestVersion: null, + currentVersion: "1.0.0", + }, + }, + }); + + const { lastFrame } = render(); + + expect(lastFrame()).toContain("◉ Remote Mode"); + }); + + it("should show update message even in remote mode when update is available", () => { + mockUseServices.mockReturnValue({ + services: { + update: { + autoUpdate: true, + status: UpdateStatus.IDLE, + message: "Update available: v1.0.1", + error: null, + isUpdateAvailable: true, + latestVersion: "1.0.1", + currentVersion: "1.0.0", + }, + }, + }); + + const { lastFrame } = render(); + + expect(lastFrame()).toContain("◉ Update available: v1.0.1"); + }); + + it("should show default message when update service has no message", () => { + mockUseServices.mockReturnValue({ + services: { + update: { + autoUpdate: true, + status: UpdateStatus.IDLE, + message: "", + error: null, + isUpdateAvailable: false, + latestVersion: null, + currentVersion: "1.0.0", + }, + }, + }); + + const { lastFrame } = render(); + + expect(lastFrame()).toContain("◉ Continue CLI"); }); }); diff --git a/extensions/cli/src/ui/UpdateNotification.tsx b/extensions/cli/src/ui/UpdateNotification.tsx index 8f1c47738..833422692 100644 --- a/extensions/cli/src/ui/UpdateNotification.tsx +++ b/extensions/cli/src/ui/UpdateNotification.tsx @@ -1,79 +1,54 @@ import { Text } from "ink"; -import React, { useEffect, useMemo, useState } from "react"; +import React, { useMemo } from "react"; -import { compareVersions, getLatestVersion, getVersion } from "../version.js"; +import { useServices } from "../hooks/useService.js"; +import { + SERVICE_NAMES, + UpdateServiceState, + UpdateStatus, +} from "../services/types.js"; import { useTerminalSize } from "./hooks/useTerminalSize.js"; interface UpdateNotificationProps { isRemoteMode?: boolean; } - const UpdateNotification: React.FC = ({ isRemoteMode = false, }) => { - const [updateAvailable, setUpdateAvailable] = useState(false); - const [latestVersion, setLatestVersion] = useState(""); - const [currentVersion] = useState(getVersion()); const { columns } = useTerminalSize(); - useEffect(() => { - // Skip update check in test environment - if (process.env.NODE_ENV === "test") { - return; + const { services } = useServices<{ + update: UpdateServiceState; + }>([SERVICE_NAMES.UPDATE]); + + const color = useMemo(() => { + switch (services.update?.status) { + case UpdateStatus.UPDATING: + case UpdateStatus.CHECKING: + return "yellow"; + case UpdateStatus.UPDATED: + return "green"; + case UpdateStatus.ERROR: + return "red"; + default: + return "dim"; } - - // Skip update check for development versions - if (currentVersion.endsWith("-dev")) { - return; - } - - const abortController = new AbortController(); - - const checkForUpdate = async () => { - try { - const latest = await getLatestVersion(abortController.signal); - if (latest) { - setLatestVersion(latest); - const comparison = compareVersions(currentVersion, latest); - setUpdateAvailable(comparison === "older"); - } - } catch (error) { - // Silently fail - we don't want to interrupt the user experience - if (error instanceof Error && error.name !== "AbortError") { - console.debug("Failed to check for updates:", error); - } - } - }; - - // Check for updates but don't block - checkForUpdate(); - - // Cleanup function to abort the request when component unmounts - return () => { - abortController.abort(); - }; - }, [currentVersion]); + }, [services.update?.status]); const text = useMemo(() => { - if (columns < 75) { - return `v${latestVersion} available`; + if (!services.update?.message) { + return "Continue CLI"; } - return `Update available: v${latestVersion} (npm i -g @continuedev/cli)`; - }, [columns, latestVersion]); - if (!updateAvailable) { - if (isRemoteMode) { - return ◉ Remote Mode; - } - return ( - - ● Continue CLI - - ); + return services.update.message; + }, [columns, services.update?.message]); + + if (!services.update?.isUpdateAvailable && isRemoteMode) { + return ◉ Remote Mode; } - return {text}; + return {`◉ ${text}`}; }; export { UpdateNotification }; diff --git a/extensions/cli/src/ui/UpdateSelector.tsx b/extensions/cli/src/ui/UpdateSelector.tsx new file mode 100644 index 000000000..ce795046f --- /dev/null +++ b/extensions/cli/src/ui/UpdateSelector.tsx @@ -0,0 +1,93 @@ +import React, { useMemo, useState } from "react"; + +import { useService } from "../hooks/useService.js"; +import { services } from "../services/index.js"; +import type { UpdateServiceState } from "../services/types.js"; +import { SERVICE_NAMES } from "../services/types.js"; + +import { Selector, SelectorOption } from "./Selector.js"; + +interface UpdateSelectorProps { + onCancel: () => void; +} + +interface UpdateOption extends SelectorOption { + action: "run" | "toggle-auto" | "back"; +} + +export const UpdateSelector: React.FC = ({ onCancel }) => { + const [selectedIndex, setSelectedIndex] = useState(0); + const updateServiceState = useService( + SERVICE_NAMES.UPDATE, + ); + + const updateState = updateServiceState.value; + + const isWorking = + updateServiceState.state === "loading" || + updateState?.status === "checking" || + updateState?.status === "updating"; + + const error: string | null = useMemo(() => { + if (updateServiceState.state === "error") { + return updateServiceState.error?.message || "Update service error"; + } + if (updateState?.status === "error") { + return updateState.message || "Update failed"; + } + return null; + }, [updateServiceState.state, updateServiceState.error, updateState]); + + const loadingMessage = useMemo(() => { + if (!updateState) return "Preparing update..."; + return updateState.message || "Working..."; + }, [updateState]); + + const options: UpdateOption[] = useMemo(() => { + const runLabel = updateState?.latestVersion + ? `Run update to v${updateState.latestVersion}` + : "Run update"; + + const autoUpdateLabel = updateState?.autoUpdate + ? "Turn off auto-updates" + : "Turn on auto-updates"; + + return [ + { id: "run-update", name: runLabel, action: "run" }, + { id: "toggle-auto", name: autoUpdateLabel, action: "toggle-auto" }, + { id: "back", name: "Back", action: "back" }, + ]; + }, [updateState?.latestVersion, updateState?.autoUpdate]); + + const handleSelect = async (option: UpdateOption) => { + switch (option.action) { + case "run": + // Perform a manual update (not auto-update) + await services.updateService.performUpdate(false); + return; // Keep selector open to show status changes + case "toggle-auto": + // Toggle auto-update setting + const newValue = !updateState?.autoUpdate; + await services.updateService.setAutoUpdate(newValue); + return; // Keep selector open to show updated label + case "back": + onCancel(); + return; + } + }; + + return ( + + ); +}; diff --git a/extensions/cli/src/ui/components/ScreenContent.tsx b/extensions/cli/src/ui/components/ScreenContent.tsx index 0cbd602ac..b163c946e 100644 --- a/extensions/cli/src/ui/components/ScreenContent.tsx +++ b/extensions/cli/src/ui/components/ScreenContent.tsx @@ -1,6 +1,8 @@ import { Box, Text } from "ink"; import React from "react"; +import { UpdateServiceState } from "src/services/types.js"; + import { listSessions } from "../../session.js"; import { ConfigSelector } from "../ConfigSelector.js"; import type { NavigationScreen } from "../context/NavigationContext.js"; @@ -9,6 +11,7 @@ import { MCPSelector } from "../MCPSelector.js"; import { ModelSelector } from "../ModelSelector.js"; import { SessionSelector } from "../SessionSelector.js"; import type { ConfigOption, ModelOption } from "../types/selectorTypes.js"; +import { UpdateSelector } from "../UpdateSelector.js"; import { UserInput } from "../UserInput.js"; import { ToolPermissionSelector } from "./ToolPermissionSelector.js"; @@ -42,6 +45,14 @@ interface ScreenContentProps { onImageInClipboardChange?: (hasImage: boolean) => void; } +function hideScreenContent(state?: UpdateServiceState) { + return ( + (state?.status === "checking" && state?.autoUpdate) || + (state?.isAutoUpdate && + (state?.status === "updating" || state?.status === "updated")) + ); +} + export const ScreenContent: React.FC = ({ isScreenActive, navState, @@ -65,6 +76,10 @@ export const ScreenContent: React.FC = ({ isRemoteMode, onImageInClipboardChange, }) => { + if (hideScreenContent(services.update)) { + return null; + } + // Login prompt if (isScreenActive("login") && navState.screenData) { return ( @@ -106,6 +121,10 @@ export const ScreenContent: React.FC = ({ return ; } + if (isScreenActive("update")) { + return ; + } + // Model selector if (isScreenActive("model")) { return ( diff --git a/extensions/cli/src/ui/context/NavigationContext.tsx b/extensions/cli/src/ui/context/NavigationContext.tsx index 1742d8ee8..a13dc99ff 100644 --- a/extensions/cli/src/ui/context/NavigationContext.tsx +++ b/extensions/cli/src/ui/context/NavigationContext.tsx @@ -1,9 +1,9 @@ import React, { createContext, + ReactNode, + useCallback, useContext, useReducer, - useCallback, - ReactNode, } from "react"; /** @@ -17,6 +17,7 @@ export type NavigationScreen = | "free-trial" // Free trial transition UI | "login" // Login prompt | "mcp" // MCP selector + | "update" // Update selector | "session"; // Session selector interface NavigationState { diff --git a/extensions/cli/src/ui/hooks/useChat.helpers.ts b/extensions/cli/src/ui/hooks/useChat.helpers.ts index 58be45d60..83fcadd21 100644 --- a/extensions/cli/src/ui/hooks/useChat.helpers.ts +++ b/extensions/cli/src/ui/hooks/useChat.helpers.ts @@ -48,6 +48,7 @@ interface ProcessSlashCommandResultOptions { setChatHistory: React.Dispatch>; onShowConfigSelector: () => void; onShowModelSelector?: () => void; + onShowUpdateSelector?: () => void; onShowMCPSelector?: () => void; onShowSessionSelector?: () => void; onClear?: () => void; @@ -61,6 +62,7 @@ export function processSlashCommandResult({ chatHistory, setChatHistory, onShowConfigSelector, + onShowUpdateSelector, onShowModelSelector, onShowMCPSelector, onShowSessionSelector, @@ -75,6 +77,11 @@ export function processSlashCommandResult({ return null; } + if (result.openUpdateSelector) { + onShowUpdateSelector?.(); + return null; + } + if (result.openConfigSelector) { onShowConfigSelector(); return null; diff --git a/extensions/cli/src/ui/hooks/useChat.ts b/extensions/cli/src/ui/hooks/useChat.ts index 1bb2cd10e..32a2e6570 100644 --- a/extensions/cli/src/ui/hooks/useChat.ts +++ b/extensions/cli/src/ui/hooks/useChat.ts @@ -55,6 +55,7 @@ export function useChat({ additionalPrompts, onShowConfigSelector, onShowModelSelector, + onShowUpdateSelector, onShowMCPSelector, onShowSessionSelector, onLoginPrompt: _onLoginPrompt, @@ -419,6 +420,7 @@ export function useChat({ onShowModelSelector, onShowMCPSelector, onShowSessionSelector, + onShowUpdateSelector, onClear, }); diff --git a/extensions/cli/src/ui/hooks/useChat.types.ts b/extensions/cli/src/ui/hooks/useChat.types.ts index a9a840184..8e937802b 100644 --- a/extensions/cli/src/ui/hooks/useChat.types.ts +++ b/extensions/cli/src/ui/hooks/useChat.types.ts @@ -15,6 +15,7 @@ export interface UseChatProps { additionalPrompts?: string[]; onShowConfigSelector: () => void; onShowMCPSelector: () => void; + onShowUpdateSelector: () => void; onShowModelSelector?: () => void; onShowSessionSelector?: () => void; onLoginPrompt?: (promptText: string) => Promise; @@ -57,6 +58,7 @@ export interface SlashCommandResult { openConfigSelector?: boolean; openModelSelector?: boolean; openMcpSelector?: boolean; + openUpdateSelector?: boolean; openSessionSelector?: boolean; compact?: boolean; } diff --git a/extensions/cli/src/util/exponentialBackoff.ts b/extensions/cli/src/util/exponentialBackoff.ts index 1f3ae4e32..926049efa 100644 --- a/extensions/cli/src/util/exponentialBackoff.ts +++ b/extensions/cli/src/util/exponentialBackoff.ts @@ -77,10 +77,40 @@ function isConnectionError(errorMessage: string): boolean { ); } +/** + * Checks if the error indicates a context length issue (non-retryable) + */ +export function isContextLengthError(error: any): boolean { + const errorMessage = error.message?.toLowerCase() || ""; + const contextLengthPatterns = [ + // Anthropic Claude + "input length and max_tokens exceed context limit", + "decrease input length or max_tokens", + // OpenAI + "maximum context length", + "reduce the length of the messages", + // Mistral + "tokens in the prompt exceeds", + "use a shorter prompt", + // Generic patterns + "context_length_exceeded", + "invalid_request_error", + ]; + + return contextLengthPatterns.some((pattern) => + errorMessage.includes(pattern), + ); +} + /** * Determines if an error is retryable based on the error type and status code */ function isRetryableError(error: any): boolean { + // Context length errors are never retryable - they need user intervention + if (isContextLengthError(error)) { + return false; + } + // Network errors are retryable if (isNetworkError(error)) { return true; diff --git a/extensions/cli/src/util/tokenizer.contextValidation.test.ts b/extensions/cli/src/util/tokenizer.contextValidation.test.ts new file mode 100644 index 000000000..79377ab48 --- /dev/null +++ b/extensions/cli/src/util/tokenizer.contextValidation.test.ts @@ -0,0 +1,62 @@ +import { ModelConfig } from "@continuedev/config-yaml"; +import { describe, expect, it } from "vitest"; + +import { validateContextLength } from "./tokenizer.js"; + +describe("validateContextLength", () => { + const createMockModel = ( + contextLength: number, + maxTokens?: number, + ): ModelConfig => ({ + name: "test-model", + model: "test", + provider: "openai", + defaultCompletionOptions: { + contextLength, + maxTokens, + }, + }); + + const createMockHistory = (messageCount: number, contentLength = 100) => { + return Array.from({ length: messageCount }, (_, i) => ({ + message: { + role: "user" as const, + content: "x".repeat(contentLength), // Roughly contentLength/4 tokens + }, + contextItems: [], + })); + }; + + it("should pass validation when within context limits", () => { + const model = createMockModel(1000, 200); + const chatHistory = createMockHistory(5, 40); // ~50 tokens total + + const result = validateContextLength(chatHistory, model); + + expect(result.isValid).toBe(true); + expect(result.error).toBeUndefined(); + }); + + it("should fail validation when input + maxTokens exceeds context limit", () => { + const model = createMockModel(1000, 800); + const chatHistory = createMockHistory(20, 100); // ~500+ tokens + + const result = validateContextLength(chatHistory, model); + + expect(result.isValid).toBe(false); + expect(result.error).toContain("Context length exceeded"); + expect(result.error).toContain("input"); + expect(result.error).toContain("max_tokens"); + expect(result.error).toContain("context_limit"); + }); + + it("should handle large models with appropriate scaling", () => { + const model = createMockModel(200_000, 64_000); // Claude-like model + const chatHistory = createMockHistory(100, 1000); // Large conversation + + const result = validateContextLength(chatHistory, model); + + expect(result.contextLimit).toBe(200_000); + expect(result.maxTokens).toBe(64_000); + }); +}); diff --git a/extensions/cli/src/util/tokenizer.test.ts b/extensions/cli/src/util/tokenizer.test.ts index ac24a56a6..1ceccafe6 100644 --- a/extensions/cli/src/util/tokenizer.test.ts +++ b/extensions/cli/src/util/tokenizer.test.ts @@ -78,14 +78,14 @@ describe("tokenizer", () => { role: "user", content: [ { type: "text", text: "Hello" }, // 5 chars -> ~2 tokens - { type: "imageUrl", imageUrl: { url: "test.jpg" } }, // +85 tokens + { type: "imageUrl", imageUrl: { url: "test.jpg" } }, // +1024 tokens ], }, contextItems: [], }; const tokenCount = countChatHistoryItemTokens(historyItem); - expect(tokenCount).toBe(89); // 2 + 85 + 2 role tokens + expect(tokenCount).toBe(1028); // 2 + 1024 + 2 role tokens }); it("should count tokens for tool calls", () => { diff --git a/extensions/cli/src/util/tokenizer.ts b/extensions/cli/src/util/tokenizer.ts index 229e5dfef..df9754967 100644 --- a/extensions/cli/src/util/tokenizer.ts +++ b/extensions/cli/src/util/tokenizer.ts @@ -47,7 +47,7 @@ export function countChatHistoryItemTokens( // Images and other content types have their own token costs // but we'll use a rough estimate for now if (part.type === "imageUrl") { - tokenCount += 85; // Rough estimate for image tokens + tokenCount += 1024; // Rough estimate for image tokens } } } @@ -192,3 +192,46 @@ export function getAutoCompactMessage(model: ModelConfig): string { const limit = getModelContextLimit(model); return `Approaching context limit (${(limit / 1000).toFixed(0)}K tokens). Auto-compacting chat history...`; } + +/** + * Validates that the input tokens + max_tokens don't exceed context limit + * @param chatHistory The chat history to validate + * @param model The model configuration + * @returns Validation result with error details if invalid + */ +export function validateContextLength( + chatHistory: ChatHistoryItem[], + model: ModelConfig, +): { + isValid: boolean; + error?: string; + inputTokens?: number; + contextLimit?: number; + maxTokens?: number; +} { + const inputTokens = countChatHistoryTokens(chatHistory); + const contextLimit = getModelContextLimit(model); + const maxTokens = model.defaultCompletionOptions?.maxTokens || 0; + + // If maxTokens is not set, use 35% default reservation for output + const reservedForOutput = + maxTokens > 0 ? maxTokens : Math.ceil(contextLimit * 0.35); + const totalRequired = inputTokens + reservedForOutput; + + if (totalRequired > contextLimit) { + return { + isValid: false, + error: `Context length exceeded: input (${inputTokens.toLocaleString()}) + max_tokens (${reservedForOutput.toLocaleString()}) = ${totalRequired.toLocaleString()} > context_limit (${contextLimit.toLocaleString()})`, + inputTokens, + contextLimit, + maxTokens: reservedForOutput, + }; + } + + return { + isValid: true, + inputTokens, + contextLimit, + maxTokens: reservedForOutput, + }; +} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt index ba1f4a571..97230ebdb 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt @@ -45,6 +45,76 @@ class IntelliJIDE( private val continuePluginService: ContinuePluginService, ) : IDE { + + // Security-focused ignore patterns - should always be excluded for security reasons + private val DEFAULT_SECURITY_IGNORE_FILETYPES = listOf( + // Environment and configuration files with secrets + "*.env", "*.env.*", ".env*", "config.json", "config.yaml", "config.yml", + "settings.json", "appsettings.json", "appsettings.*.json", + + // Certificate and key files + "*.key", "*.pem", "*.p12", "*.pfx", "*.crt", "*.cer", "*.jks", + "*.keystore", "*.truststore", + + // Database files that may contain sensitive data + "*.db", "*.sqlite", "*.sqlite3", "*.mdb", "*.accdb", + + // Credential and secret files + "*.secret", "*.secrets", "credentials", "credentials.*", "auth.json", + "token", "token.*", "*.token", + + // Backup files that might contain sensitive data + "*.bak", "*.backup", "*.old", "*.orig", + + // Docker secrets + "docker-compose.override.yml", "docker-compose.override.yaml", + + // SSH and GPG + "id_rsa", "id_dsa", "id_ecdsa", "id_ed25519", "*.ppk", "*.gpg" + ) + + private val DEFAULT_SECURITY_IGNORE_DIRS = listOf( + // Environment and configuration directories + ".env/", "env/", + + // Cloud provider credential directories + ".aws/", ".gcp/", ".azure/", ".kube/", ".docker/", + + // Secret directories + "secrets/", ".secrets/", "private/", ".private/", "certs/", + "certificates/", "keys/", ".ssh/", ".gnupg/", ".gpg/", + + // Temporary directories that might contain sensitive data + "tmp/secrets/", "temp/secrets/", ".tmp/" + ) + + // Additional non-security patterns for general indexing exclusion + private val ADDITIONAL_SEARCH_IGNORE_FILETYPES = listOf( + "*.DS_Store", "*-lock.json", "*.lock", "*.log", "*.ttf", "*.png", + "*.jpg", "*.jpeg", "*.gif", "*.mp4", "*.svg", "*.ico", "*.pdf", + "*.zip", "*.gz", "*.tar", "*.dmg", "*.tgz", "*.rar", "*.7z", + "*.exe", "*.dll", "*.obj", "*.o", "*.o.d", "*.a", "*.lib", + "*.so", "*.dylib", "*.ncb", "*.sdf", "*.woff", "*.woff2", + "*.eot", "*.cur", "*.avi", "*.mpg", "*.mpeg", "*.mov", "*.mp3", + "*.mkv", "*.webm", "*.jar", "*.onnx", "*.parquet", "*.pqt", + "*.wav", "*.webp", "*.wasm", "*.plist", "*.profraw", "*.gcda", + "*.gcno", "go.sum", "*.gitignore", "*.gitkeep", "*.continueignore", + "*.csv", "*.uasset", "*.pdb", "*.bin", "*.pag", "*.swp", "*.jsonl" + ) + + private val ADDITIONAL_SEARCH_IGNORE_DIRS = listOf( + ".git/", ".svn/", "node_modules/", "dist/", "build/", "Build/", + "target/", "out/", "bin/", ".pytest_cache/", ".vscode-test/", + "__pycache__/", "site-packages/", ".gradle/", ".mvn/", ".cache/", + "gems/", "vendor/", ".venv/", "venv/", ".vscode/", ".idea/", ".vs/", + ".continue/" + ) + + // Combined patterns for use in ripgrep + private val DEFAULT_IGNORES = DEFAULT_SECURITY_IGNORE_FILETYPES + + DEFAULT_SECURITY_IGNORE_DIRS + + ADDITIONAL_SEARCH_IGNORE_FILETYPES + + ADDITIONAL_SEARCH_IGNORE_DIRS private val gitService = GitService(project, continuePluginService) private val fileUtils = FileUtils(project) @@ -335,6 +405,9 @@ class IntelliJIDE( val ideInfo = this.getIdeInfo() if (ideInfo.remoteName == "local") { try { + // Create a single combined ignore pattern using glob brace expansion + val defaultIgnorePattern = DEFAULT_IGNORES.joinToString(",") { it } + var commandArgs = mutableListOf( ripgrep, "--files", @@ -343,7 +416,9 @@ class IntelliJIDE( "--ignore-file", ".continueignore", "--ignore-file", - ".gitignore" + ".gitignore", + "--glob", + "!{${defaultIgnorePattern}}" ) if (maxResults != null) { commandArgs.add("--max-count") @@ -370,6 +445,9 @@ class IntelliJIDE( val ideInfo = this.getIdeInfo() if (ideInfo.remoteName == "local") { try { + // Create a single combined ignore pattern for ripgrep + val defaultIgnorePattern = DEFAULT_IGNORES.joinToString(",") { it } + val commandArgs = mutableListOf( ripgrep, "-i", @@ -379,7 +457,9 @@ class IntelliJIDE( ".gitignore", "-C", "2", - "--heading" + "--heading", + "--glob", + "!{${defaultIgnorePattern}}" // Exclude all default ignores using brace expansion ) // Conditionally add maxResults flag diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index a0fa56130..3e6594b6b 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.3.3", + "version": "1.3.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.3.3", + "version": "1.3.10", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "file:../../packages/config-types", @@ -231,17 +231,22 @@ }, "../../packages/fetch": { "name": "@continuedev/fetch", - "version": "1.0.16", + "version": "1.1.0", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-types": "file:../config-types", + "@continuedev/config-types": "^1.0.14", "follow-redirects": "^1.15.6", "http-proxy-agent": "^7.0.2", "https-proxy-agent": "^7.0.5", "node-fetch": "^3.3.2" }, "devDependencies": { + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^9.2.6", + "@semantic-release/npm": "^10.0.6", "@types/follow-redirects": "^1.14.4", + "semantic-release": "^21.1.2", "typescript": "^5.0.0", "vitest": "^3.2.0" } diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 1000445e8..9753fcc0a 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.3.9", + "version": "1.3.10", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" diff --git a/extensions/vscode/src/VsCodeIde.ts b/extensions/vscode/src/VsCodeIde.ts index f8773f1ff..e19d091ae 100644 --- a/extensions/vscode/src/VsCodeIde.ts +++ b/extensions/vscode/src/VsCodeIde.ts @@ -3,6 +3,7 @@ import { exec } from "node:child_process"; import { Range } from "core"; import { EXTENSION_NAME } from "core/control-plane/env"; +import { DEFAULT_IGNORES, defaultIgnoresGlob } from "core/indexing/ignore"; import * as URI from "uri-js"; import * as vscode from "vscode"; @@ -452,7 +453,9 @@ class VsCodeIde implements IDE { resolve(output); } else if (code === 1) { // No matches - resolve("No matches found"); + resolve( + "No matches found. Build, secrets, etc. dirs and files are not included.", + ); } else { reject(new Error(`Process exited with code ${code}`)); } @@ -464,6 +467,8 @@ class VsCodeIde implements IDE { pattern: string, maxResults?: number, ): Promise { + // Create a single combined ignore pattern for ripgrep (calculated once) + if (vscode.env.remoteName) { // TODO better tests for this remote search implementation // throw new Error("Ripgrep not supported, this workspace is remote"); @@ -475,6 +480,11 @@ class VsCodeIde implements IDE { ); const ignoreGlobs: Set = new Set(); + // Add default ignores from core + for (const pattern of DEFAULT_IGNORES) { + ignoreGlobs.add(pattern); + } + for (const file of ignoreFiles) { const content = await this.ideUtils.readFile(file); if (content === null) { @@ -535,6 +545,7 @@ class VsCodeIde implements IDE { return results.map((result) => vscode.workspace.asRelativePath(result)); } else { const results: string[] = []; + // Create a single combined ignore pattern using glob brace expansion for (const dir of await this.getWorkspaceDirs()) { const dirResults = await this.runRipgrepQuery(dir, [ "--files", @@ -544,6 +555,8 @@ class VsCodeIde implements IDE { ".continueignore", "--ignore-file", ".gitignore", + "--glob", + defaultIgnoresGlob, ...(maxResults ? ["--max-count", String(maxResults)] : []), ]); @@ -566,6 +579,7 @@ class VsCodeIde implements IDE { throw new Error("Ripgrep not supported, this workspace is remote"); } const results: string[] = []; + for (const dir of await this.getWorkspaceDirs()) { const dirResults = await this.runRipgrepQuery(dir, [ "-i", // Case-insensitive search @@ -576,6 +590,9 @@ class VsCodeIde implements IDE { "-C", "2", // Show 2 lines of context "--heading", // Only show filepath once per result + // Use a single glob with all default ignores + "--glob", + defaultIgnoresGlob, ...(maxResults ? ["-m", maxResults.toString()] : []), "-e", query, // Pattern to search for diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 2efb25f51..05dd18300 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -9,6 +9,7 @@ import { Core } from "core/core"; import { walkDirAsync } from "core/indexing/walkDir"; import { isModelInstaller } from "core/llm"; import { startLocalOllama } from "core/util/ollamaHelper"; +import { startLocalLemonade } from "core/util/lemonadeHelper"; import { getConfigJsonPath, getConfigYamlPath } from "core/util/paths"; import { Telemetry } from "core/util/posthog"; import * as vscode from "vscode"; @@ -620,6 +621,9 @@ const getCommandsMap: ( "continue.startLocalOllama": () => { startLocalOllama(ide); }, + "continue.startLocalLemonade": () => { + startLocalLemonade(ide); + }, "continue.installModel": async ( modelName: string, llmProvider: ILLM | undefined, diff --git a/extensions/vscode/src/diff/vertical/handler.ts b/extensions/vscode/src/diff/vertical/handler.ts index 869e5962d..3f3806a7c 100644 --- a/extensions/vscode/src/diff/vertical/handler.ts +++ b/extensions/vscode/src/diff/vertical/handler.ts @@ -76,6 +76,39 @@ export class VerticalDiffHandler implements vscode.Disposable { this.disposables.push(disposable); } + /** ensures the current target file is open and focused before performing edits*/ + private async ensureCurrentFileIsFocused() { + const targetUri = this.editor.document.uri; + const active = vscode.window.activeTextEditor; + if ( + active && + URI.equal(active.document.uri.toString(), targetUri.toString()) + ) { + this.editor = active; + return; + } + + const visible = vscode.window.visibleTextEditors.find((foundEditor) => + URI.equal(foundEditor.document.uri.toString(), targetUri.toString()), + ); + if (visible) { + await vscode.window.showTextDocument(visible.document, { + preview: false, + preserveFocus: false, + viewColumn: visible.viewColumn, + }); + this.editor = vscode.window.activeTextEditor ?? visible; + return; + } + + const doc = await vscode.workspace.openTextDocument(targetUri); + const editor = await vscode.window.showTextDocument(doc, { + preview: false, + preserveFocus: false, + }); + this.editor = editor; + } + public get range(): vscode.Range { const startLine = Math.min(this.startLine, this.endLine); const endLine = Math.max(this.startLine, this.endLine); @@ -296,6 +329,8 @@ export class VerticalDiffHandler implements vscode.Disposable { // Diff is messed up without this delay. await new Promise((resolve) => setTimeout(resolve, 100)); + await this.ensureCurrentFileIsFocused(); + // First, we reset the original diff by rejecting all pending diff blocks const blocks = this.editorToVerticalDiffCodeLens.get(this.fileUri) ?? []; for (const block of blocks.reverse()) { @@ -443,6 +478,7 @@ export class VerticalDiffHandler implements vscode.Disposable { } private async insertTextAboveLine(index: number, text: string) { + await this.ensureCurrentFileIsFocused(); await this.editor.edit( (editBuilder) => { const lineCount = this.editor.document.lineCount; @@ -471,6 +507,7 @@ export class VerticalDiffHandler implements vscode.Disposable { private async deleteLinesAt(index: number, numLines = 1) { const startLine = new vscode.Position(index, 0); + await this.ensureCurrentFileIsFocused(); await this.editor.edit( (editBuilder) => { editBuilder.delete( @@ -482,6 +519,7 @@ export class VerticalDiffHandler implements vscode.Disposable { } private async deleteRangeLines(ranges: vscode.Range[]) { + await this.ensureCurrentFileIsFocused(); await this.editor.edit( (editBuilder) => { for (const range of ranges) { diff --git a/extensions/vscode/src/diff/vertical/manager.ts b/extensions/vscode/src/diff/vertical/manager.ts index 797f1fc7d..e338656af 100644 --- a/extensions/vscode/src/diff/vertical/manager.ts +++ b/extensions/vscode/src/diff/vertical/manager.ts @@ -51,7 +51,7 @@ export class VerticalDiffManager { this.fileUriToHandler.get(fileUri)?.clear(false); this.fileUriToHandler.delete(fileUri); } - const editor = vscode.window.activeTextEditor; // TODO might cause issues if user switches files + const editor = vscode.window.activeTextEditor; if (editor && URI.equal(editor.document.uri.toString(), fileUri)) { const handler = new VerticalDiffHandler( startLine, diff --git a/extensions/vscode/src/util/errorHandling.ts b/extensions/vscode/src/util/errorHandling.ts index 40428cadd..c4b1f1c79 100644 --- a/extensions/vscode/src/util/errorHandling.ts +++ b/extensions/vscode/src/util/errorHandling.ts @@ -3,13 +3,41 @@ import { isModelInstaller } from "core/llm"; import * as vscode from "vscode"; /** - * @param error Handles common LLM errors. Currently only handles Ollama-related errors. + * @param error Handles common LLM errors. Currently handles Ollama and Lemonade-related errors. * @returns true if error is handled, false otherwise */ export async function handleLLMError(error: unknown): Promise { if (!error || !(error instanceof Error) || !error.message) { return false; } + + // Handle Lemonade errors + if (error.message.toLowerCase().includes("lemonade")) { + let message: string = error.message; + let options: string[] | undefined; + + // For Windows, offer to start Lemonade if it's installed but not running + if ( + process.platform === "win32" && + message.includes("Lemonade server may not be running") + ) { + options = ["Start Lemonade", "Setup Instructions"]; + } else { + // For all other cases (Linux, not installed, etc.), direct to setup instructions + options = ["Setup Instructions"]; + } + + vscode.window.showErrorMessage(message, ...options).then((val) => { + if (val === "Setup Instructions") { + vscode.env.openExternal(vscode.Uri.parse("https://lemonade-server.ai")); + } else if (val === "Start Lemonade") { + vscode.commands.executeCommand("continue.startLocalLemonade"); + } + }); + return true; + } + + // Handle Ollama errors if (!error.message.toLowerCase().includes("ollama")) { return false; } diff --git a/extensions/vscode/src/webviewProtocol.ts b/extensions/vscode/src/webviewProtocol.ts index 324219a51..765e7a8c7 100644 --- a/extensions/vscode/src/webviewProtocol.ts +++ b/extensions/vscode/src/webviewProtocol.ts @@ -107,7 +107,7 @@ export class VsCodeWebviewProtocol if (e.cause) { if (e.cause.name === "ConnectTimeoutError") { - message = `Connection timed out. If you expect it to take a long time to connect, you can increase the timeout in config.json by setting "requestOptions": { "timeout": 10000 }. You can find the full config reference here: https://docs.continue.dev/reference/config`; + message = `Connection timed out. If you expect it to take a long time to connect, you can increase the timeout in your config by setting "requestOptions": { "timeout": 10000 }. You can find the full config reference here: https://docs.continue.dev/reference/config`; } else if (e.cause.code === "ECONNREFUSED") { message = `Connection was refused. This likely means that there is no server running at the specified URL. If you are running your own server you may need to set the "apiBase" parameter in config.json. For example, you can set up an OpenAI-compatible server like here: https://docs.continue.dev/reference/Model%20Providers/openai#openai-compatible-servers--apis`; } else { diff --git a/gui/package-lock.json b/gui/package-lock.json index 019afc943..962b06471 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -234,10 +234,11 @@ } }, "../packages/config-yaml": { - "version": "1.0.96", + "name": "@continuedev/config-yaml", + "version": "1.14.0", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-types": "file:../config-types", + "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", "zod": "^3.24.2" }, @@ -260,6 +261,7 @@ } }, "../packages/terminal-security": { + "name": "@continuedev/terminal-security", "version": "1.0.0", "license": "Apache-2.0", "dependencies": { @@ -269,7 +271,7 @@ "@types/node": "^20.11.19", "@types/shell-quote": "^1.7.5", "typescript": "^5.5.2", - "vitest": "^1.6.0" + "vitest": "^3.2.4" } }, "node_modules/@adobe/css-tools": { diff --git a/gui/public/logos/lemonade.png b/gui/public/logos/lemonade.png new file mode 100644 index 000000000..3e8347404 Binary files /dev/null and b/gui/public/logos/lemonade.png differ diff --git a/gui/src/components/AssistantAndOrgListbox/AssistantOption.tsx b/gui/src/components/AssistantAndOrgListbox/AssistantOption.tsx index 35ce80c7e..e811a9217 100644 --- a/gui/src/components/AssistantAndOrgListbox/AssistantOption.tsx +++ b/gui/src/components/AssistantAndOrgListbox/AssistantOption.tsx @@ -1,4 +1,7 @@ -import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; +import { + Cog6ToothIcon, + ExclamationTriangleIcon, +} from "@heroicons/react/24/outline"; import { ProfileDescription } from "core/config/ProfileLifecycleManager"; import { useContext, useMemo } from "react"; import { useNavigate } from "react-router-dom"; @@ -48,7 +51,7 @@ export function AssistantOption({ disabled={hasFatalErrors} onClick={!hasFatalErrors ? handleOptionClick : undefined} fontSizeModifier={-2} - className={selected ? "bg-list-active text-list-active-foreground" : ""} + className={`group ${selected ? "bg-list-active text-list-active-foreground" : ""}`} >
@@ -62,6 +65,20 @@ export function AssistantOption({
+ {profile.errors && profile.errors?.length > 0 && (
diff --git a/gui/src/components/AssistantAndOrgListbox/index.tsx b/gui/src/components/AssistantAndOrgListbox/index.tsx index 5629df5aa..55db674be 100644 --- a/gui/src/components/AssistantAndOrgListbox/index.tsx +++ b/gui/src/components/AssistantAndOrgListbox/index.tsx @@ -2,9 +2,7 @@ import { ArrowPathIcon, ArrowRightStartOnRectangleIcon, Cog6ToothIcon, - PencilIcon, PlusIcon, - WrenchScrewdriverIcon, } from "@heroicons/react/24/outline"; import { isOnPremSession } from "core/control-plane/AuthTypes"; import { useContext, useEffect, useRef } from "react"; @@ -155,7 +153,7 @@ export function AssistantAndOrgListbox({ className="max-h-32 -translate-x-1.5 overflow-y-auto pb-0" style={{ zIndex: 200 }} > -
+
Agents @@ -193,7 +191,7 @@ export function AssistantAndOrgListbox({ {shouldRenderOrgInfo && ( <> -
+
Organizations @@ -232,34 +230,6 @@ export function AssistantAndOrgListbox({ {/* Settings Section */} {variant !== "sidebar" && (
- -
); @@ -245,8 +259,21 @@ function ModelSelect() { /> -
- Models +
+ Models +
+ +
@@ -274,36 +301,26 @@ function ModelSelect() { {!isConfigLoading && ( <> - - {selectedProfile?.profileType === "local" && ( - - - - Add Chat model - - + <> + + + + + Add Chat model + + + )} - - - - Configure models - - -
+
{getMetaKeyLabel()}' to toggle model diff --git a/gui/src/components/modelSelection/Toggle.tsx b/gui/src/components/modelSelection/Toggle.tsx deleted file mode 100644 index 02f99e974..000000000 --- a/gui/src/components/modelSelection/Toggle.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import styled from "styled-components"; -import { - defaultBorderRadius, - lightGray, - vscInputBackground, - vscListActiveBackground, - vscListActiveForeground, -} from ".."; - -const TopDiv = styled.div` - display: flex; - align-items: center; - text-align: center; - margin: auto; - width: fit-content; - cursor: pointer; - - border: 1px solid ${lightGray}; - - background-color: ${vscInputBackground}; - border-radius: ${defaultBorderRadius}; - - &:hover { - background-color: ${lightGray}55; - } -`; - -const SubDiv = styled.div<{ selected: boolean }>` - text-align: center; - padding: 8px 12px; - border-radius: ${defaultBorderRadius}; - - transition: all 0.2s ease-in-out; - - ${(props) => - props.selected && - ` - background-color: ${vscListActiveBackground}; - color: ${vscListActiveForeground}; - `} -`; - -function Toggle(props: { - optionOne: string; - optionTwo: string; - selected: boolean; - onClick: () => void; -}) { - return ( - - {props.optionOne} - {props.optionTwo} - - ); -} - -export default Toggle; diff --git a/gui/src/hooks/useRenderDebug.tsx b/gui/src/hooks/useRenderDebug.tsx new file mode 100644 index 000000000..2a86247eb --- /dev/null +++ b/gui/src/hooks/useRenderDebug.tsx @@ -0,0 +1,70 @@ +import { CSSProperties, useEffect, useRef } from "react"; + +/** + * useRenderDebug + * + * Developer utility to visualize component re-renders. + * + * - Returns a `ref` to attach to a container element and a `count` that + * increments on every render of the component using this hook. + * - On each render, it briefly adds a CSS class (default: `rerender-flash`) + * to the element for a quick visual flash. + * - Use together with to show the render count inline. + * + * Options: + * - enabled: boolean to toggle the effect (default true) + * - flashClassName: class added on each render (default `rerender-flash`) + * - flashDurationMs: duration of the flash animation in ms (default 180) + */ + +export function useRenderDebug(options?: { + enabled?: boolean; + flashClassName?: string; + flashDurationMs?: number; +}) { + const { + enabled = true, + flashClassName = "rerender-flash", + flashDurationMs = 180, + } = options || {}; + + const ref = useRef(null); + const countRef = useRef(0); + countRef.current += 1; + + useEffect(() => { + if (!enabled || !ref.current) return; + const el = ref.current; + el.classList.add(flashClassName); + const t = setTimeout( + () => el.classList.remove(flashClassName), + flashDurationMs, + ); + return () => { + clearTimeout(t); + // Ensure we don't leave the flash class applied on cleanup + el.classList.remove(flashClassName); + }; + }); + + return { ref, count: countRef.current, countRef } as const; +} + +export function RenderCountBadge(props: { + count: number; + title?: string; + style?: CSSProperties; + className?: string; +}) { + // Simple badge for use with useRenderDebug; keep lightweight. + const { count, title = `Renders: ${count}`, style, className } = props; + return ( + + R{count} + + ); +} diff --git a/gui/src/index.css b/gui/src/index.css index 6ef5e902e..fce97497e 100644 --- a/gui/src/index.css +++ b/gui/src/index.css @@ -119,3 +119,28 @@ body { .scroll-container:is(:hover, :focus)::-webkit-scrollbar { display: block; /* Show scrollbar only on hover or focus */ } + +/* Debug: visible flash when component re-renders */ +@keyframes rerenderFlash { + 0% { + box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.9) inset; + } + 100% { + box-shadow: 0 0 0 0 rgba(255, 0, 0, 0) inset; + } +} + +.rerender-flash { + animation: rerenderFlash 180ms ease-out; +} + +.render-count { + display: inline-block; + margin-right: 6px; + padding: 0 4px; + border-radius: 3px; + background: rgba(255, 0, 0, 0.15); + color: rgba(255, 0, 0, 0.9); + font-weight: 600; + letter-spacing: 0.02em; +} diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index e7b6d1bf0..cba89d3f3 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -566,6 +566,38 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n packages: [models.grokBeta], apiKeyUrl: "https://console.x.ai/", }, + lemonade: { + title: "Lemonade", + provider: "lemonade", + description: + "High-performance local LLM inference with AMD hardware optimization", + longDescription: + "Lemonade provides optimized local LLM inference with support for AMD NPU, GPU, and CPU acceleration. Visit [lemonade-server.ai](https://lemonade-server.ai/) for installation and setup instructions. Once the Lemonade server is running, you can begin using Continue with your local models.", + icon: "lemonade.png", + tags: [ModelProviderTags.Local, ModelProviderTags.OpenSource], + params: { + apiBase: "http://localhost:8000/api/v1/", + }, + packages: [ + { + ...models.AUTODETECT, + params: { + ...models.AUTODETECT.params, + title: "Lemonade", + }, + }, + ...openSourceModels, + ], + collectInputFor: [ + ...completionParamsInputsConfigs, + { + ...apiBaseInput, + defaultValue: "http://localhost:8000/api/v1/", + required: true, + }, + ], + downloadUrl: "http://lemonade-server.ai", + }, lmstudio: { title: "LM Studio", provider: "lmstudio", diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index 4e654566f..953184d7d 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -1,5 +1,5 @@ import { isOnPremSession } from "core/control-plane/AuthTypes"; -import React, { useEffect, useState } from "react"; +import React, { useState } from "react"; import { useNavigate, useSearchParams } from "react-router-dom"; import { AssistantAndOrgListbox } from "../../components/AssistantAndOrgListbox"; import Alert from "../../components/gui/Alert"; @@ -14,17 +14,11 @@ function ConfigPage() { useNavigationListener(); const navigate = useNavigate(); const [searchParams] = useSearchParams(); - const [activeTab, setActiveTab] = useState("settings"); + const [activeTab, setActiveTab] = useState(() => { + return searchParams.get("tab") || "settings"; + }); const { session, organizations } = useAuth(); - // Set initial tab from URL parameter - useEffect(() => { - const tab = searchParams.get("tab"); - if (tab) { - setActiveTab(tab); - } - }, [searchParams]); - const allTabs = getAllTabs(); const shouldRenderOrgInfo = session && organizations.length > 1 && !isOnPremSession(session); diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 4be689dae..cd39c5185 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -49,6 +49,8 @@ import { cancelStream } from "../../redux/thunks/cancelStream"; import { EmptyChatBody } from "./EmptyChatBody"; import { ExploreDialogWatcher } from "./ExploreDialogWatcher"; import { useAutoScroll } from "./useAutoScroll"; +import { useStore } from "react-redux"; +import { RootState } from "../../redux/store"; // Helper function to find the index of the latest conversation summary function findLatestSummaryIndex(history: ChatHistoryItem[]): number { @@ -98,13 +100,11 @@ function fallbackRender({ error, resetErrorBoundary }: any) { export function Chat() { const dispatch = useAppDispatch(); const ideMessenger = useContext(IdeMessengerContext); + const reduxStore = useStore(); const onboardingCard = useOnboardingCard(); const showSessionTabs = useAppSelector( (store) => store.config.config.ui?.showSessionTabs, ); - const selectedModels = useAppSelector( - (store) => store.config?.config.selectedModelByRole, - ); const isStreaming = useAppSelector((state) => state.session.isStreaming); const [stepsOpen] = useState<(boolean | undefined)[]>([]); const mainTextInputRef = useRef(null); @@ -115,7 +115,6 @@ export function Chat() { (state) => state.config.config.ui?.showChatScrollbar, ); const codeToEdit = useAppSelector((state) => state.editModeState.codeToEdit); - const mode = useAppSelector((store) => store.session.mode); const isInEdit = useAppSelector((store) => store.session.isInEdit); const lastSessionId = useAppSelector((state) => state.session.lastSessionId); @@ -152,9 +151,6 @@ export function Chat() { isStreaming, ); - const pendingToolCalls = useAppSelector(selectPendingToolCalls); - const pendingApplyStates = useAppSelector(selectDoneApplyStates); - const sendInput = useCallback( ( editorState: JSONContent, @@ -162,8 +158,16 @@ export function Chat() { index?: number, editorToClearOnSend?: Editor, ) => { + const stateSnapshot = reduxStore.getState(); + const latestPendingToolCalls = selectPendingToolCalls(stateSnapshot); + const latestPendingApplyStates = selectDoneApplyStates(stateSnapshot); + const isCurrentlyInEdit = stateSnapshot.session.isInEdit; + const codeToEditSnapshot = stateSnapshot.editModeState.codeToEdit; + const selectedModelByRole = + stateSnapshot.config.config.selectedModelByRole; + // Cancel all pending tool calls - pendingToolCalls.forEach((toolCallState) => { + latestPendingToolCalls.forEach((toolCallState) => { dispatch( cancelToolCall({ toolCallId: toolCallState.toolCallId, @@ -172,19 +176,20 @@ export function Chat() { }); // Reject all pending apply states - pendingApplyStates.forEach((applyState) => { + latestPendingApplyStates.forEach((applyState) => { if (applyState.status !== "closed") { ideMessenger.post("rejectDiff", applyState); } }); - const model = isInEdit - ? (selectedModels?.edit ?? selectedModels?.chat) - : selectedModels?.chat; + const model = isCurrentlyInEdit + ? (selectedModelByRole.edit ?? selectedModelByRole.chat) + : selectedModelByRole.chat; + if (!model) { return; } - if (isInEdit && codeToEdit.length === 0) { + if (isCurrentlyInEdit && codeToEditSnapshot.length === 0) { return; } @@ -212,11 +217,11 @@ export function Chat() { // } // } - if (isInEdit) { + if (isCurrentlyInEdit) { void dispatch( streamEditThunk({ editorState, - codeToEdit, + codeToEdit: codeToEditSnapshot, }), ); } else { @@ -227,15 +232,7 @@ export function Chat() { } } }, - [ - history, - selectedModels, - mode, - isInEdit, - codeToEdit, - pendingToolCalls, - pendingApplyStates, - ], + [dispatch, ideMessenger, reduxStore], ); useWebviewListener( diff --git a/gui/src/pages/gui/ToolCallDiv/FindAndReplace.test.tsx b/gui/src/pages/gui/ToolCallDiv/FindAndReplace.test.tsx index e12959d85..966cb075b 100644 --- a/gui/src/pages/gui/ToolCallDiv/FindAndReplace.test.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FindAndReplace.test.tsx @@ -19,9 +19,16 @@ vi.mock("../../../components/ui", () => ({ useFontSize: () => 14, })); -vi.mock("../../../util/clientTools/findAndReplaceUtils", () => ({ - performFindAndReplace: vi.fn(), -})); +vi.mock("../../../util/clientTools/findAndReplaceUtils", async () => { + const actual = await vi.importActual( + "../../../util/clientTools/findAndReplaceUtils", + ); + + return { + performFindAndReplace: vi.fn(), + trimEmptyLines: actual.trimEmptyLines, + }; +}); vi.mock("./utils", () => ({ getStatusIcon: vi.fn(() =>
✓
), diff --git a/gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx b/gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx index a06af78c2..d69517740 100644 --- a/gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx @@ -13,7 +13,10 @@ import { selectApplyStateByToolCallId, selectToolCallById, } from "../../../redux/selectors/selectToolCalls"; -import { performFindAndReplace } from "../../../util/clientTools/findAndReplaceUtils"; +import { + performFindAndReplace, + trimEmptyLines, +} from "../../../util/clientTools/findAndReplaceUtils"; import { cn } from "../../../util/cn"; import { getStatusIcon } from "./utils"; @@ -313,14 +316,16 @@ export function FindAndReplaceDisplay({ const showMiddleEllipses = !isFirst && !isLast && lines.length > MAX_SAME_LINES * 2 + 1; - const startLines = showStartEllipsis + let startLines = showStartEllipsis ? lines.slice(-MAX_SAME_LINES) : showMiddleEllipses || showEndEllipsis ? lines.slice(0, MAX_SAME_LINES) : lines; - const endLines = showMiddleEllipses + startLines = trimEmptyLines({ lines: startLines, fromEnd: false }); + let endLines = showMiddleEllipses ? lines.slice(-MAX_SAME_LINES) : []; + endLines = trimEmptyLines({ lines: endLines, fromEnd: true }); return (
diff --git a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx index 7f5b7e6e7..b9fa4777d 100644 --- a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx +++ b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx @@ -43,18 +43,6 @@ export function SimpleToolCallUI({ } } - function handleToggleClick() { - if (isToggleable) { - setOpen((prev) => !prev); - } - } - - function handleIconClick() { - if (isSingleItem) { - openContextItem(shownContextItems[0], ideMessenger); - } - } - return (
@@ -69,7 +57,6 @@ export function SimpleToolCallUI({ icon={Icon} isToggleable={isToggleable} open={shouldShowContent} - onClick={isToggleable ? handleToggleClick : handleIconClick} isClickable={isSingleItem} /> diff --git a/gui/src/pages/gui/ToolCallDiv/index.tsx b/gui/src/pages/gui/ToolCallDiv/index.tsx index fc5edf61f..40e5e8cd5 100644 --- a/gui/src/pages/gui/ToolCallDiv/index.tsx +++ b/gui/src/pages/gui/ToolCallDiv/index.tsx @@ -1,4 +1,7 @@ -import { ArrowRightIcon } from "@heroicons/react/24/outline"; +import { + ArrowRightIcon, + MagnifyingGlassIcon, +} from "@heroicons/react/24/outline"; import { ToolCallState } from "core"; import { BuiltInToolNames } from "core/tools/builtIn"; import { useState } from "react"; @@ -7,7 +10,7 @@ import FunctionSpecificToolCallDiv from "./FunctionSpecificToolCallDiv"; import { GroupedToolCallHeader } from "./GroupedToolCallHeader"; import { SimpleToolCallUI } from "./SimpleToolCallUI"; import { ToolCallDisplay } from "./ToolCallDisplay"; -import { getStatusIcon, toolCallIcons } from "./utils"; +import { getIconByName, getStatusIcon } from "./utils"; interface ToolCallDivProps { toolCallStates: ToolCallState[]; @@ -37,7 +40,10 @@ export function ToolCallDiv({ (tool) => toolCallState.toolCall.function?.name === tool.function.name, ); const functionName = toolCallState.toolCall.function?.name; - const icon = functionName && toolCallIcons[functionName]; + const icon = + functionName && tool?.toolCallIcon + ? getIconByName(tool.toolCallIcon) + : undefined; if (icon) { return ( diff --git a/gui/src/pages/gui/ToolCallDiv/utils.tsx b/gui/src/pages/gui/ToolCallDiv/utils.tsx index d5648b082..fe18123f4 100644 --- a/gui/src/pages/gui/ToolCallDiv/utils.tsx +++ b/gui/src/pages/gui/ToolCallDiv/utils.tsx @@ -1,25 +1,11 @@ -import { - ArrowRightIcon, - CheckIcon, - CodeBracketIcon, - DocumentIcon, - DocumentTextIcon, - FolderIcon, - FolderOpenIcon, - GlobeAltIcon, - MagnifyingGlassIcon, - MapIcon, - PencilIcon, - XMarkIcon, -} from "@heroicons/react/24/outline"; +import * as Icons from "@heroicons/react/24/outline"; import { ContextItem, ContextItemWithId, ToolCallState, ToolStatus, } from "core"; -import { BuiltInToolNames } from "core/tools/builtIn"; -import { ComponentType } from "react"; +import { ComponentType, SVGProps } from "react"; import { vscButtonBackground } from "../../../components"; import Spinner from "../../../components/gui/Spinner"; @@ -70,19 +56,16 @@ export function getGroupActionVerb(toolCallStates: ToolCallState[]): string { return "Performing"; } -export const toolCallIcons: Record = { - [BuiltInToolNames.FileGlobSearch]: MagnifyingGlassIcon, - [BuiltInToolNames.GrepSearch]: MagnifyingGlassIcon, - [BuiltInToolNames.LSTool]: FolderIcon, - [BuiltInToolNames.ReadCurrentlyOpenFile]: DocumentTextIcon, - [BuiltInToolNames.ReadFile]: DocumentIcon, - [BuiltInToolNames.FetchUrlContent]: GlobeAltIcon, - [BuiltInToolNames.SearchWeb]: GlobeAltIcon, - [BuiltInToolNames.ViewDiff]: CodeBracketIcon, - [BuiltInToolNames.ViewRepoMap]: MapIcon, - [BuiltInToolNames.ViewSubdirectory]: FolderOpenIcon, - [BuiltInToolNames.CreateRuleBlock]: PencilIcon, -}; +type IconName = keyof typeof Icons; + +type Icon = ComponentType> | undefined; + +export function getIconByName(name: string): Icon | null { + if (name in Icons) { + return Icons[name as IconName] as Icon; + } + return null; +} export function getStatusIcon(state: ToolStatus) { switch (state) { @@ -90,12 +73,12 @@ export function getStatusIcon(state: ToolStatus) { case "calling": return ; case "generated": - return ; + return ; case "done": - return ; + return ; case "canceled": case "errored": - return ; + return ; } } diff --git a/gui/src/util/clientTools/findAndReplaceUtils.test.ts b/gui/src/util/clientTools/findAndReplaceUtils.test.ts index 68ab333b9..c898439b3 100644 --- a/gui/src/util/clientTools/findAndReplaceUtils.test.ts +++ b/gui/src/util/clientTools/findAndReplaceUtils.test.ts @@ -4,6 +4,7 @@ import { EMPTY_NON_FIRST_EDIT_MESSAGE, FOUND_MULTIPLE_FIND_STRINGS_ERROR, performFindAndReplace, + trimEmptyLines, validateCreatingForMultiEdit, validateSingleEdit, } from "./findAndReplaceUtils"; @@ -454,3 +455,23 @@ describe("validateCreatingForMultiEdit", () => { }); }); }); + +describe("trimEmptyLines", () => { + it("trims leading empty lines from start", () => { + const input = ["", "", "a", "", "b"]; + const result = trimEmptyLines({ lines: input, fromEnd: false }); + expect(result).toEqual(["a", "", "b"]); + }); + + it("trims trailing empty lines from end", () => { + const input = ["a", "", "b", "", ""]; + const result = trimEmptyLines({ lines: input, fromEnd: true }); + expect(result).toEqual(["a", "", "b"]); + }); + + it("returns empty array when all lines are empty", () => { + const input = ["", "", ""]; + const result = trimEmptyLines({ lines: input, fromEnd: false }); + expect(result).toEqual([]); + }); +}); diff --git a/gui/src/util/clientTools/findAndReplaceUtils.ts b/gui/src/util/clientTools/findAndReplaceUtils.ts index 6828e1695..d610fb88d 100644 --- a/gui/src/util/clientTools/findAndReplaceUtils.ts +++ b/gui/src/util/clientTools/findAndReplaceUtils.ts @@ -95,3 +95,22 @@ export function validateCreatingForMultiEdit(edits: EditOperation[]) { return isCreating; } + +export function trimEmptyLines({ + lines, + fromEnd, +}: { + lines: string[]; + fromEnd: boolean; +}): string[] { + lines = fromEnd ? lines.toReversed() : lines.slice(); + const newLines: string[] = []; + let shouldContinueRemoving = true; + for (let index = 0; index < lines.length; index++) { + const line = lines[index]; + if (shouldContinueRemoving && line.trim() === "") continue; + shouldContinueRemoving = false; + newLines.push(line); + } + return fromEnd ? newLines.reverse() : newLines; +} diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index 39306dbab..378825d67 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.14.0", + "version": "1.17.0", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-yaml/src/converter.ts b/packages/config-yaml/src/converter.ts index 40e1f226a..4be3702ec 100644 --- a/packages/config-yaml/src/converter.ts +++ b/packages/config-yaml/src/converter.ts @@ -193,6 +193,7 @@ export function convertJsonToYamlConfig(configJson: ConfigJson): ConfigYaml { prompts, mcpServers, docs, + requestOptions: configJson.requestOptions, }; return configYaml; diff --git a/packages/config-yaml/src/interfaces/slugs.ts b/packages/config-yaml/src/interfaces/slugs.ts index 2215468d2..18b168577 100644 --- a/packages/config-yaml/src/interfaces/slugs.ts +++ b/packages/config-yaml/src/interfaces/slugs.ts @@ -1,3 +1,5 @@ +import os from "node:os"; + export interface PackageSlug { ownerSlug: string; packageSlug: string; @@ -61,13 +63,18 @@ export function decodePackageIdentifier(identifier: string): PackageIdentifier { fileUri: identifier.substring(7), }; } - // Otherwise, it's a slug - else { + // support ~ by replacing with home directory + else if (identifier.startsWith("~")) { return { - uriType: "slug", - fullSlug: decodeFullSlug(identifier), + uriType: "file", + fileUri: identifier.replace("~", os.homedir()), }; } + // Otherwise, it's a slug + return { + uriType: "slug", + fullSlug: decodeFullSlug(identifier), + }; } export enum VirtualTags { diff --git a/packages/config-yaml/src/load/merge.test.ts b/packages/config-yaml/src/load/merge.test.ts new file mode 100644 index 000000000..9d09de26f --- /dev/null +++ b/packages/config-yaml/src/load/merge.test.ts @@ -0,0 +1,235 @@ +import { describe, expect, it } from "@jest/globals"; +import type { RequestOptions } from "../schemas/models.js"; +import { mergeConfigYamlRequestOptions } from "./merge.js"; + +describe("mergeConfigYamlRequestOptions", () => { + it("should return undefined when both base and global are undefined", () => { + const result = mergeConfigYamlRequestOptions(undefined, undefined); + expect(result).toBeUndefined(); + }); + + it("should return global when base is undefined", () => { + const global: RequestOptions = { + timeout: 5000, + verifySsl: true, + headers: { Authorization: "Bearer token" }, + }; + const result = mergeConfigYamlRequestOptions(undefined, global); + expect(result).toEqual(global); + }); + + it("should return base when global is undefined", () => { + const base: RequestOptions = { + timeout: 3000, + verifySsl: false, + headers: { "X-Custom": "value" }, + }; + const result = mergeConfigYamlRequestOptions(base, undefined); + expect(result).toEqual(base); + }); + + it("should merge headers from both objects", () => { + const base: RequestOptions = { + headers: { "X-Base": "base-value", "X-Common": "base-common" }, + }; + const global: RequestOptions = { + headers: { "X-Global": "global-value", "X-Common": "global-common" }, + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result?.headers).toEqual({ + "X-Global": "global-value", + "X-Common": "base-common", // base overrides global + "X-Base": "base-value", + }); + }); + + it("should override simple values with base values", () => { + const base: RequestOptions = { + timeout: 3000, + verifySsl: false, + proxy: "http://base-proxy.com", + }; + const global: RequestOptions = { + timeout: 5000, + verifySsl: true, + proxy: "http://global-proxy.com", + caBundlePath: "/path/to/ca", + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result).toEqual({ + timeout: 3000, // base overrides + verifySsl: false, // base overrides + proxy: "http://base-proxy.com", // base overrides + caBundlePath: "/path/to/ca", // only in global + headers: undefined, + }); + }); + + it("should handle noProxy array properly (base overrides)", () => { + const base: RequestOptions = { + noProxy: ["localhost", "127.0.0.1"], + }; + const global: RequestOptions = { + noProxy: ["192.168.1.1", "example.com"], + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result?.noProxy).toEqual(["localhost", "127.0.0.1"]); // base overrides completely + }); + + it("should handle extraBodyProperties (base overrides)", () => { + const base: RequestOptions = { + extraBodyProperties: { baseProp: "baseValue", common: "base" }, + }; + const global: RequestOptions = { + extraBodyProperties: { globalProp: "globalValue", common: "global" }, + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result?.extraBodyProperties).toEqual({ + baseProp: "baseValue", + common: "base", + }); // base overrides completely + }); + + it("should handle clientCertificate (base overrides)", () => { + const base: RequestOptions = { + clientCertificate: { + cert: "base-cert", + key: "base-key", + passphrase: "base-pass", + }, + }; + const global: RequestOptions = { + clientCertificate: { + cert: "global-cert", + key: "global-key", + }, + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result?.clientCertificate).toEqual({ + cert: "base-cert", + key: "base-key", + passphrase: "base-pass", + }); // base overrides completely + }); + + it("should return undefined headers when both have empty headers", () => { + const base: RequestOptions = { + headers: {}, + timeout: 1000, + }; + const global: RequestOptions = { + headers: {}, + verifySsl: true, + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result?.headers).toBeUndefined(); + expect(result?.timeout).toBe(1000); + expect(result?.verifySsl).toBe(true); + }); + + it("should handle caBundlePath as string", () => { + const base: RequestOptions = { + caBundlePath: "/base/ca.pem", + }; + const global: RequestOptions = { + caBundlePath: "/global/ca.pem", + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result?.caBundlePath).toBe("/base/ca.pem"); // base overrides + }); + + it("should handle caBundlePath as array", () => { + const base: RequestOptions = { + caBundlePath: ["/base/ca1.pem", "/base/ca2.pem"], + }; + const global: RequestOptions = { + caBundlePath: ["/global/ca.pem"], + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result?.caBundlePath).toEqual(["/base/ca1.pem", "/base/ca2.pem"]); // base overrides + }); + + it("should preserve all fields from base when global has different fields", () => { + const base: RequestOptions = { + timeout: 3000, + headers: { "X-Base": "value" }, + noProxy: ["localhost"], + }; + const global: RequestOptions = { + verifySsl: true, + proxy: "http://proxy.com", + caBundlePath: "/ca.pem", + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result).toEqual({ + timeout: 3000, + verifySsl: true, + proxy: "http://proxy.com", + caBundlePath: "/ca.pem", + headers: { "X-Base": "value" }, + noProxy: ["localhost"], + }); + }); + + it("should handle complex header merging scenario", () => { + const base: RequestOptions = { + headers: { + Authorization: "Bearer base-token", + "X-Custom-Header": "base-custom", + "Content-Type": "application/json", + }, + }; + const global: RequestOptions = { + headers: { + Authorization: "Bearer global-token", + "X-Global-Header": "global-value", + "Accept-Language": "en-US", + }, + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result?.headers).toEqual({ + Authorization: "Bearer base-token", // base overrides + "X-Global-Header": "global-value", // from global + "Accept-Language": "en-US", // from global + "X-Custom-Header": "base-custom", // from base + "Content-Type": "application/json", // from base + }); + }); + + it("should handle all possible fields", () => { + const base: RequestOptions = { + timeout: 1000, + verifySsl: false, + caBundlePath: ["/base/ca.pem"], + proxy: "http://base-proxy.com", + headers: { "X-Base": "base" }, + extraBodyProperties: { baseProp: true }, + noProxy: ["base.local"], + clientCertificate: { cert: "base-cert", key: "base-key" }, + }; + const global: RequestOptions = { + timeout: 2000, + verifySsl: true, + caBundlePath: ["/global/ca.pem"], + proxy: "http://global-proxy.com", + headers: { "X-Global": "global" }, + extraBodyProperties: { globalProp: false }, + noProxy: ["global.local"], + clientCertificate: { cert: "global-cert", key: "global-key" }, + }; + const result = mergeConfigYamlRequestOptions(base, global); + expect(result).toEqual({ + timeout: 1000, // base overrides + verifySsl: false, // base overrides + caBundlePath: ["/base/ca.pem"], // base overrides + proxy: "http://base-proxy.com", // base overrides + headers: { + "X-Global": "global", + "X-Base": "base", + }, // merged + extraBodyProperties: { baseProp: true }, // base overrides + noProxy: ["base.local"], // base overrides + clientCertificate: { cert: "base-cert", key: "base-key" }, // base overrides + }); + }); +}); diff --git a/packages/config-yaml/src/load/merge.ts b/packages/config-yaml/src/load/merge.ts index 568650b93..ebd2e9633 100644 --- a/packages/config-yaml/src/load/merge.ts +++ b/packages/config-yaml/src/load/merge.ts @@ -1,3 +1,4 @@ +import { RequestOptions } from "../browser.js"; import { AssistantUnrolled, ConfigYaml } from "../schemas/index.js"; export function mergePackages( @@ -14,6 +15,10 @@ export function mergePackages( prompts: [...(current.prompts ?? []), ...(incoming.prompts ?? [])], docs: [...(current.docs ?? []), ...(incoming.docs ?? [])], env: { ...current.env, ...incoming.env }, + requestOptions: mergeConfigYamlRequestOptions( + current.requestOptions, + incoming.requestOptions, + ), }; } @@ -31,5 +36,35 @@ export function mergeUnrolledAssistants( mcpServers: [...(current.mcpServers ?? []), ...(incoming.mcpServers ?? [])], prompts: [...(current.prompts ?? []), ...(incoming.prompts ?? [])], env: { ...current.env, ...incoming.env }, + requestOptions: mergeConfigYamlRequestOptions( + current.requestOptions, + incoming.requestOptions, + ), + }; +} + +export function mergeConfigYamlRequestOptions( + base: RequestOptions | undefined, + global: RequestOptions | undefined, +): RequestOptions | undefined { + if (!base && !global) { + return undefined; + } + if (!base) { + return global; + } + if (!global) { + return base; + } + + const headers = { + ...global.headers, + ...base.headers, + }; + + return { + ...global, + ...base, // base overrides for simple values as well as noProxy and extraBodyProperties + headers: Object.keys(headers).length === 0 ? undefined : headers, // headers are the only thing that really merge }; } diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index 80a9d62e1..f7476c255 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -1,5 +1,6 @@ import * as YAML from "yaml"; import { ZodError } from "zod"; +import { mergeConfigYamlRequestOptions, RequestOptions } from "../browser.js"; import { PlatformClient, Registry } from "../interfaces/index.js"; import { encodeSecretLocation } from "../interfaces/SecretResult.js"; import { @@ -203,6 +204,7 @@ export interface BaseUnrollAssistantOptions { injectBlocks?: PackageIdentifier[]; allowlistedBlocks?: PackageSlug[]; blocklistedBlocks?: PackageSlug[]; + injectRequestOptions?: RequestOptions; } export interface DoNotRenderSecretsUnrollAssistantOptions @@ -274,6 +276,7 @@ export async function unrollAssistantFromContent( options.injectBlocks, options.allowlistedBlocks, options.blocklistedBlocks, + options.injectRequestOptions, ); // Back to a string so we can fill in template variables @@ -302,14 +305,14 @@ export async function unrollAssistantFromContent( const renderedYaml = renderTemplateData(templatedYaml, { secrets }); // Parse again and replace models with proxy versions where secrets weren't rendered - const finalConfig = useProxyForUnrenderedSecrets( + const renderedConfig = useProxyForUnrenderedSecrets( parseAssistantUnrolled(renderedYaml), id, options.orgScopeId, options.onPremProxyUrl, ); - return { config: finalConfig, errors, configLoadInterrupted }; + return { config: renderedConfig, errors, configLoadInterrupted }; } function isPackageAllowed( @@ -350,6 +353,7 @@ export async function unrollBlocks( injectBlocks: PackageIdentifier[] | undefined, allowlistedBlocks?: PackageSlug[], blocklistedBlocks?: PackageSlug[], + injectRequestOptions?: RequestOptions, ): Promise> { const errors: ConfigValidationError[] = []; @@ -363,11 +367,27 @@ export async function unrollBlocks( const unrolledAssistant: AssistantUnrolled = { name: assistant.name, version: assistant.version, + requestOptions: assistant.requestOptions, }; + if (injectRequestOptions) { + unrolledAssistant.requestOptions = mergeConfigYamlRequestOptions( + assistant.requestOptions, + injectRequestOptions, + ); + } else { + unrolledAssistant.requestOptions = assistant.requestOptions; + } + const sections: (keyof Omit< ConfigYaml, - "name" | "version" | "rules" | "schema" | "metadata" | "env" + | "name" + | "version" + | "rules" + | "schema" + | "metadata" + | "env" + | "requestOptions" >)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"]; // Process all sections in parallel diff --git a/packages/config-yaml/src/markdown/createMarkdownRule.ts b/packages/config-yaml/src/markdown/createMarkdownRule.ts index 0fdf522f8..b868bbb51 100644 --- a/packages/config-yaml/src/markdown/createMarkdownRule.ts +++ b/packages/config-yaml/src/markdown/createMarkdownRule.ts @@ -36,6 +36,7 @@ export function createRuleMarkdown( globs?: string | string[]; regex?: string | string[]; alwaysApply?: boolean; + invokable?: boolean; } = {}, ): string { const frontmatter: RuleFrontmatter = {}; @@ -54,6 +55,10 @@ export function createRuleMarkdown( frontmatter.description = options.description.trim(); } + if (options.invokable !== undefined) { + frontmatter.invokable = options.invokable; + } + if (options.alwaysApply !== undefined) { frontmatter.alwaysApply = options.alwaysApply; } diff --git a/packages/config-yaml/src/schemas/index.ts b/packages/config-yaml/src/schemas/index.ts index e4a15d7bb..0dc3b4e42 100644 --- a/packages/config-yaml/src/schemas/index.ts +++ b/packages/config-yaml/src/schemas/index.ts @@ -117,6 +117,7 @@ export const baseConfigYamlSchema = z.object({ schema: z.string().optional(), metadata: z.record(z.string()).and(commonMetadataSchema.partial()).optional(), env: envRecord.optional(), + requestOptions: requestOptionsSchema.optional(), }); const modelsUsesSchema = z @@ -262,6 +263,7 @@ export const configSchema = z.object({ api_base: z.string().optional(), api_key: z.string().optional(), env: envRecord.optional(), + requestOptions: requestOptionsSchema.optional(), }); export type Config = z.infer; diff --git a/packages/continue-sdk/package-lock.json b/packages/continue-sdk/package-lock.json index 651df69e9..90b6b3401 100644 --- a/packages/continue-sdk/package-lock.json +++ b/packages/continue-sdk/package-lock.json @@ -20,10 +20,10 @@ }, "../config-yaml": { "name": "@continuedev/config-yaml", - "version": "1.0.96", + "version": "1.14.0", "license": "Apache-2.0", "dependencies": { - "@continuedev/config-types": "file:../config-types", + "@continuedev/config-types": "^1.0.14", "yaml": "^2.6.1", "zod": "^3.24.2" }, diff --git a/packages/llm-info/src/providers/os.ts b/packages/llm-info/src/providers/os.ts index 91ade3237..c0428ad1a 100644 --- a/packages/llm-info/src/providers/os.ts +++ b/packages/llm-info/src/providers/os.ts @@ -4,5 +4,6 @@ export const OsLlms: Omit[] = [ { model: "starcoder2:3b", displayName: "StarCoder 2 3B", + contextLength: 8192, }, ]; diff --git a/packages/openai-adapters/package-lock.json b/packages/openai-adapters/package-lock.json index 0540c75ea..cefe01486 100644 --- a/packages/openai-adapters/package-lock.json +++ b/packages/openai-adapters/package-lock.json @@ -1,12 +1,12 @@ { "name": "@continuedev/openai-adapters", - "version": "1.14.0", + "version": "1.15.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/openai-adapters", - "version": "1.14.0", + "version": "1.15.0", "license": "Apache-2.0", "dependencies": { "@aws-sdk/client-bedrock-runtime": "^3.842.0", @@ -180,29 +180,29 @@ } }, "node_modules/@aws-sdk/client-bedrock-runtime": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-bedrock-runtime/-/client-bedrock-runtime-3.888.0.tgz", - "integrity": "sha512-XuTayKaxjQkBtasJp4+mzXwE06k8YML+VKMcYEq096JFC4/bwQA1TrF/T8wlE6Xw6FD/XU2OUdLfq3j/QgEOgA==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-bedrock-runtime/-/client-bedrock-runtime-3.890.0.tgz", + "integrity": "sha512-pgYxjMEed4UTlBGPqU/XjLIrfGDXvDftvqZjXqfwb/ZVNHzU/WIIKv79U9US4ESx6OJoIjlv/ovbH6SxS4VX7Q==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/core": "3.888.0", - "@aws-sdk/credential-provider-node": "3.888.0", - "@aws-sdk/eventstream-handler-node": "3.887.0", + "@aws-sdk/core": "3.890.0", + "@aws-sdk/credential-provider-node": "3.890.0", + "@aws-sdk/eventstream-handler-node": "3.890.0", "@aws-sdk/middleware-eventstream": "3.887.0", "@aws-sdk/middleware-host-header": "3.887.0", "@aws-sdk/middleware-logger": "3.887.0", "@aws-sdk/middleware-recursion-detection": "3.887.0", - "@aws-sdk/middleware-user-agent": "3.888.0", - "@aws-sdk/middleware-websocket": "3.887.0", - "@aws-sdk/region-config-resolver": "3.887.0", - "@aws-sdk/token-providers": "3.888.0", + "@aws-sdk/middleware-user-agent": "3.890.0", + "@aws-sdk/middleware-websocket": "3.890.0", + "@aws-sdk/region-config-resolver": "3.890.0", + "@aws-sdk/token-providers": "3.890.0", "@aws-sdk/types": "3.887.0", - "@aws-sdk/util-endpoints": "3.887.0", + "@aws-sdk/util-endpoints": "3.890.0", "@aws-sdk/util-user-agent-browser": "3.887.0", - "@aws-sdk/util-user-agent-node": "3.888.0", - "@smithy/config-resolver": "^4.2.1", + "@aws-sdk/util-user-agent-node": "3.890.0", + "@smithy/config-resolver": "^4.2.2", "@smithy/core": "^3.11.0", "@smithy/eventstream-serde-browser": "^4.1.1", "@smithy/eventstream-serde-config-resolver": "^4.2.1", @@ -211,22 +211,22 @@ "@smithy/hash-node": "^4.1.1", "@smithy/invalid-dependency": "^4.1.1", "@smithy/middleware-content-length": "^4.1.1", - "@smithy/middleware-endpoint": "^4.2.1", - "@smithy/middleware-retry": "^4.2.1", + "@smithy/middleware-endpoint": "^4.2.2", + "@smithy/middleware-retry": "^4.2.2", "@smithy/middleware-serde": "^4.1.1", "@smithy/middleware-stack": "^4.1.1", - "@smithy/node-config-provider": "^4.2.1", + "@smithy/node-config-provider": "^4.2.2", "@smithy/node-http-handler": "^4.2.1", "@smithy/protocol-http": "^5.2.1", - "@smithy/smithy-client": "^4.6.1", + "@smithy/smithy-client": "^4.6.2", "@smithy/types": "^4.5.0", "@smithy/url-parser": "^4.1.1", "@smithy/util-base64": "^4.1.0", "@smithy/util-body-length-browser": "^4.1.0", "@smithy/util-body-length-node": "^4.1.0", - "@smithy/util-defaults-mode-browser": "^4.1.1", - "@smithy/util-defaults-mode-node": "^4.1.1", - "@smithy/util-endpoints": "^3.1.1", + "@smithy/util-defaults-mode-browser": "^4.1.2", + "@smithy/util-defaults-mode-node": "^4.1.2", + "@smithy/util-endpoints": "^3.1.2", "@smithy/util-middleware": "^4.1.1", "@smithy/util-retry": "^4.1.1", "@smithy/util-stream": "^4.3.1", @@ -253,46 +253,46 @@ } }, "node_modules/@aws-sdk/client-cognito-identity": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.888.0.tgz", - "integrity": "sha512-FsHdPF9iXnCGp3oOsEl1EHR0pc0sw0emlhG67QxfMj4imPwspsypTaPslkILe+0aAwKYW64i7J9Vd4JCQKVxgQ==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.890.0.tgz", + "integrity": "sha512-1aBk2LnjbEghJLbOkHYWoaPwYNDR4jeCNCv+rcbVp12+3YN5Z+bdWusnzA5/zmMmkfMTjkcQtTQJwN5uw7sp4Q==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/core": "3.888.0", - "@aws-sdk/credential-provider-node": "3.888.0", + "@aws-sdk/core": "3.890.0", + "@aws-sdk/credential-provider-node": "3.890.0", "@aws-sdk/middleware-host-header": "3.887.0", "@aws-sdk/middleware-logger": "3.887.0", "@aws-sdk/middleware-recursion-detection": "3.887.0", - "@aws-sdk/middleware-user-agent": "3.888.0", - "@aws-sdk/region-config-resolver": "3.887.0", + "@aws-sdk/middleware-user-agent": "3.890.0", + "@aws-sdk/region-config-resolver": "3.890.0", "@aws-sdk/types": "3.887.0", - "@aws-sdk/util-endpoints": "3.887.0", + "@aws-sdk/util-endpoints": "3.890.0", "@aws-sdk/util-user-agent-browser": "3.887.0", - "@aws-sdk/util-user-agent-node": "3.888.0", - "@smithy/config-resolver": "^4.2.1", + "@aws-sdk/util-user-agent-node": "3.890.0", + "@smithy/config-resolver": "^4.2.2", "@smithy/core": "^3.11.0", "@smithy/fetch-http-handler": "^5.2.1", "@smithy/hash-node": "^4.1.1", "@smithy/invalid-dependency": "^4.1.1", "@smithy/middleware-content-length": "^4.1.1", - "@smithy/middleware-endpoint": "^4.2.1", - "@smithy/middleware-retry": "^4.2.1", + "@smithy/middleware-endpoint": "^4.2.2", + "@smithy/middleware-retry": "^4.2.2", "@smithy/middleware-serde": "^4.1.1", "@smithy/middleware-stack": "^4.1.1", - "@smithy/node-config-provider": "^4.2.1", + "@smithy/node-config-provider": "^4.2.2", "@smithy/node-http-handler": "^4.2.1", "@smithy/protocol-http": "^5.2.1", - "@smithy/smithy-client": "^4.6.1", + "@smithy/smithy-client": "^4.6.2", "@smithy/types": "^4.5.0", "@smithy/url-parser": "^4.1.1", "@smithy/util-base64": "^4.1.0", "@smithy/util-body-length-browser": "^4.1.0", "@smithy/util-body-length-node": "^4.1.0", - "@smithy/util-defaults-mode-browser": "^4.1.1", - "@smithy/util-defaults-mode-node": "^4.1.1", - "@smithy/util-endpoints": "^3.1.1", + "@smithy/util-defaults-mode-browser": "^4.1.2", + "@smithy/util-defaults-mode-node": "^4.1.2", + "@smithy/util-endpoints": "^3.1.2", "@smithy/util-middleware": "^4.1.1", "@smithy/util-retry": "^4.1.1", "@smithy/util-utf8": "^4.1.0", @@ -303,45 +303,45 @@ } }, "node_modules/@aws-sdk/client-sso": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.888.0.tgz", - "integrity": "sha512-8CLy/ehGKUmekjH+VtZJ4w40PqDg3u0K7uPziq/4P8Q7LLgsy8YQoHNbuY4am7JU3HWrqLXJI9aaz1+vPGPoWA==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.890.0.tgz", + "integrity": "sha512-vefYNwh/K5V5YiJpFJfoMPNqsoiRTqD7ZnkvR0cjJdwhOIwFnSKN1vz0OMjySTQmVMcG4JKGVul82ou7ErtOhQ==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/core": "3.888.0", + "@aws-sdk/core": "3.890.0", "@aws-sdk/middleware-host-header": "3.887.0", "@aws-sdk/middleware-logger": "3.887.0", "@aws-sdk/middleware-recursion-detection": "3.887.0", - "@aws-sdk/middleware-user-agent": "3.888.0", - "@aws-sdk/region-config-resolver": "3.887.0", + "@aws-sdk/middleware-user-agent": "3.890.0", + "@aws-sdk/region-config-resolver": "3.890.0", "@aws-sdk/types": "3.887.0", - "@aws-sdk/util-endpoints": "3.887.0", + "@aws-sdk/util-endpoints": "3.890.0", "@aws-sdk/util-user-agent-browser": "3.887.0", - "@aws-sdk/util-user-agent-node": "3.888.0", - "@smithy/config-resolver": "^4.2.1", + "@aws-sdk/util-user-agent-node": "3.890.0", + "@smithy/config-resolver": "^4.2.2", "@smithy/core": "^3.11.0", "@smithy/fetch-http-handler": "^5.2.1", "@smithy/hash-node": "^4.1.1", "@smithy/invalid-dependency": "^4.1.1", "@smithy/middleware-content-length": "^4.1.1", - "@smithy/middleware-endpoint": "^4.2.1", - "@smithy/middleware-retry": "^4.2.1", + "@smithy/middleware-endpoint": "^4.2.2", + "@smithy/middleware-retry": "^4.2.2", "@smithy/middleware-serde": "^4.1.1", "@smithy/middleware-stack": "^4.1.1", - "@smithy/node-config-provider": "^4.2.1", + "@smithy/node-config-provider": "^4.2.2", "@smithy/node-http-handler": "^4.2.1", "@smithy/protocol-http": "^5.2.1", - "@smithy/smithy-client": "^4.6.1", + "@smithy/smithy-client": "^4.6.2", "@smithy/types": "^4.5.0", "@smithy/url-parser": "^4.1.1", "@smithy/util-base64": "^4.1.0", "@smithy/util-body-length-browser": "^4.1.0", "@smithy/util-body-length-node": "^4.1.0", - "@smithy/util-defaults-mode-browser": "^4.1.1", - "@smithy/util-defaults-mode-node": "^4.1.1", - "@smithy/util-endpoints": "^3.1.1", + "@smithy/util-defaults-mode-browser": "^4.1.2", + "@smithy/util-defaults-mode-node": "^4.1.2", + "@smithy/util-endpoints": "^3.1.2", "@smithy/util-middleware": "^4.1.1", "@smithy/util-retry": "^4.1.1", "@smithy/util-utf8": "^4.1.0", @@ -352,19 +352,19 @@ } }, "node_modules/@aws-sdk/core": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.888.0.tgz", - "integrity": "sha512-L3S2FZywACo4lmWv37Y4TbefuPJ1fXWyWwIJ3J4wkPYFJ47mmtUPqThlVrSbdTHkEjnZgJe5cRfxk0qCLsFh1w==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.890.0.tgz", + "integrity": "sha512-CT+yjhytHdyKvV3Nh/fqBjnZ8+UiQZVz4NMm4LrPATgVSOdfygXHqrWxrPTVgiBtuJWkotg06DF7+pTd5ekLBw==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/types": "3.887.0", "@aws-sdk/xml-builder": "3.887.0", "@smithy/core": "^3.11.0", - "@smithy/node-config-provider": "^4.2.1", - "@smithy/property-provider": "^4.0.5", + "@smithy/node-config-provider": "^4.2.2", + "@smithy/property-provider": "^4.1.1", "@smithy/protocol-http": "^5.2.1", - "@smithy/signature-v4": "^5.1.3", - "@smithy/smithy-client": "^4.6.1", + "@smithy/signature-v4": "^5.2.1", + "@smithy/smithy-client": "^4.6.2", "@smithy/types": "^4.5.0", "@smithy/util-base64": "^4.1.0", "@smithy/util-body-length-browser": "^4.1.0", @@ -378,14 +378,14 @@ } }, "node_modules/@aws-sdk/credential-provider-cognito-identity": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.888.0.tgz", - "integrity": "sha512-mGKLEAFsIaYci219lL42L22fEkbdwLSEuqeBN2D4LzNsbuGyLuE9vIRSOZr/wbHJ3UegI+1eCn0cF+qDgP4cdg==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.890.0.tgz", + "integrity": "sha512-dOA8rAFwBvADqsNkk9+9YPgqHxO+PUTUs3Fx9v0dBCHQx56GdXuf4ts08zb7o3HhjUTwZbtCNP7DW6oNO+nR6g==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/client-cognito-identity": "3.888.0", + "@aws-sdk/client-cognito-identity": "3.890.0", "@aws-sdk/types": "3.887.0", - "@smithy/property-provider": "^4.0.5", + "@smithy/property-provider": "^4.1.1", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -394,14 +394,14 @@ } }, "node_modules/@aws-sdk/credential-provider-env": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.888.0.tgz", - "integrity": "sha512-shPi4AhUKbIk7LugJWvNpeZA8va7e5bOHAEKo89S0Ac8WDZt2OaNzbh/b9l0iSL2eEyte8UgIsYGcFxOwIF1VA==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.890.0.tgz", + "integrity": "sha512-BtsUa2y0Rs8phmB2ScZ5RuPqZVmxJJXjGfeiXctmLFTxTwoayIK1DdNzOWx6SRMPVc3s2RBGN4vO7T1TwN+ajA==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/core": "3.888.0", + "@aws-sdk/core": "3.890.0", "@aws-sdk/types": "3.887.0", - "@smithy/property-provider": "^4.0.5", + "@smithy/property-provider": "^4.1.1", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -410,18 +410,18 @@ } }, "node_modules/@aws-sdk/credential-provider-http": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.888.0.tgz", - "integrity": "sha512-Jvuk6nul0lE7o5qlQutcqlySBHLXOyoPtiwE6zyKbGc7RVl0//h39Lab7zMeY2drMn8xAnIopL4606Fd8JI/Hw==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.890.0.tgz", + "integrity": "sha512-0sru3LVwsuGYyzbD90EC/d5HnCZ9PL4O9BA2LYT6b9XceC005Oj86uzE47LXb+mDhTAt3T6ZO0+ZcVQe0DDi8w==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/core": "3.888.0", + "@aws-sdk/core": "3.890.0", "@aws-sdk/types": "3.887.0", "@smithy/fetch-http-handler": "^5.2.1", "@smithy/node-http-handler": "^4.2.1", - "@smithy/property-provider": "^4.0.5", + "@smithy/property-provider": "^4.1.1", "@smithy/protocol-http": "^5.2.1", - "@smithy/smithy-client": "^4.6.1", + "@smithy/smithy-client": "^4.6.2", "@smithy/types": "^4.5.0", "@smithy/util-stream": "^4.3.1", "tslib": "^2.6.2" @@ -431,22 +431,22 @@ } }, "node_modules/@aws-sdk/credential-provider-ini": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.888.0.tgz", - "integrity": "sha512-M82ItvS5yq+tO6ZOV1ruaVs2xOne+v8HW85GFCXnz8pecrzYdgxh6IsVqEbbWruryG/mUGkWMbkBZoEsy4MgyA==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.890.0.tgz", + "integrity": "sha512-Mxv7ByftHKH7dE6YXu9gQ6ODXwO1iSO32t8tBrZLS3g8K1knWADIqDFv3yErQtJ8hp27IDxbAbVH/1RQdSkmhA==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/core": "3.888.0", - "@aws-sdk/credential-provider-env": "3.888.0", - "@aws-sdk/credential-provider-http": "3.888.0", - "@aws-sdk/credential-provider-process": "3.888.0", - "@aws-sdk/credential-provider-sso": "3.888.0", - "@aws-sdk/credential-provider-web-identity": "3.888.0", - "@aws-sdk/nested-clients": "3.888.0", + "@aws-sdk/core": "3.890.0", + "@aws-sdk/credential-provider-env": "3.890.0", + "@aws-sdk/credential-provider-http": "3.890.0", + "@aws-sdk/credential-provider-process": "3.890.0", + "@aws-sdk/credential-provider-sso": "3.890.0", + "@aws-sdk/credential-provider-web-identity": "3.890.0", + "@aws-sdk/nested-clients": "3.890.0", "@aws-sdk/types": "3.887.0", - "@smithy/credential-provider-imds": "^4.0.7", - "@smithy/property-provider": "^4.0.5", - "@smithy/shared-ini-file-loader": "^4.0.5", + "@smithy/credential-provider-imds": "^4.1.2", + "@smithy/property-provider": "^4.1.1", + "@smithy/shared-ini-file-loader": "^4.2.0", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -455,21 +455,21 @@ } }, "node_modules/@aws-sdk/credential-provider-node": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.888.0.tgz", - "integrity": "sha512-KCrQh1dCDC8Y+Ap3SZa6S81kHk+p+yAaOQ5jC3dak4zhHW3RCrsGR/jYdemTOgbEGcA6ye51UbhWfrrlMmeJSA==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.890.0.tgz", + "integrity": "sha512-zbPz3mUtaBdch0KoH8/LouRDcYSzyT2ecyCOo5OAFVil7AxT1jvsn4vX78FlnSVpZ4mLuHY8pHTVGi235XiyBA==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/credential-provider-env": "3.888.0", - "@aws-sdk/credential-provider-http": "3.888.0", - "@aws-sdk/credential-provider-ini": "3.888.0", - "@aws-sdk/credential-provider-process": "3.888.0", - "@aws-sdk/credential-provider-sso": "3.888.0", - "@aws-sdk/credential-provider-web-identity": "3.888.0", + "@aws-sdk/credential-provider-env": "3.890.0", + "@aws-sdk/credential-provider-http": "3.890.0", + "@aws-sdk/credential-provider-ini": "3.890.0", + "@aws-sdk/credential-provider-process": "3.890.0", + "@aws-sdk/credential-provider-sso": "3.890.0", + "@aws-sdk/credential-provider-web-identity": "3.890.0", "@aws-sdk/types": "3.887.0", - "@smithy/credential-provider-imds": "^4.0.7", - "@smithy/property-provider": "^4.0.5", - "@smithy/shared-ini-file-loader": "^4.0.5", + "@smithy/credential-provider-imds": "^4.1.2", + "@smithy/property-provider": "^4.1.1", + "@smithy/shared-ini-file-loader": "^4.2.0", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -478,15 +478,15 @@ } }, "node_modules/@aws-sdk/credential-provider-process": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.888.0.tgz", - "integrity": "sha512-+aX6piSukPQ8DUS4JAH344GePg8/+Q1t0+kvSHAZHhYvtQ/1Zek3ySOJWH2TuzTPCafY4nmWLcQcqvU1w9+4Lw==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.890.0.tgz", + "integrity": "sha512-dWZ54TI1Q+UerF5YOqGiCzY+x2YfHsSQvkyM3T4QDNTJpb/zjiVv327VbSOULOlI7gHKWY/G3tMz0D9nWI7YbA==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/core": "3.888.0", + "@aws-sdk/core": "3.890.0", "@aws-sdk/types": "3.887.0", - "@smithy/property-provider": "^4.0.5", - "@smithy/shared-ini-file-loader": "^4.0.5", + "@smithy/property-provider": "^4.1.1", + "@smithy/shared-ini-file-loader": "^4.2.0", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -495,17 +495,17 @@ } }, "node_modules/@aws-sdk/credential-provider-sso": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.888.0.tgz", - "integrity": "sha512-b1ZJji7LJ6E/j1PhFTyvp51in2iCOQ3VP6mj5H6f5OUnqn7efm41iNMoinKr87n0IKZw7qput5ggXVxEdPhouA==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.890.0.tgz", + "integrity": "sha512-ajYCZ6f2+98w8zG/IXcQ+NhWYoI5qPUDovw+gMqMWX/jL1cmZ9PFAwj2Vyq9cbjum5RNWwPLArWytTCgJex4AQ==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/client-sso": "3.888.0", - "@aws-sdk/core": "3.888.0", - "@aws-sdk/token-providers": "3.888.0", + "@aws-sdk/client-sso": "3.890.0", + "@aws-sdk/core": "3.890.0", + "@aws-sdk/token-providers": "3.890.0", "@aws-sdk/types": "3.887.0", - "@smithy/property-provider": "^4.0.5", - "@smithy/shared-ini-file-loader": "^4.0.5", + "@smithy/property-provider": "^4.1.1", + "@smithy/shared-ini-file-loader": "^4.2.0", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -514,15 +514,16 @@ } }, "node_modules/@aws-sdk/credential-provider-web-identity": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.888.0.tgz", - "integrity": "sha512-7P0QNtsDzMZdmBAaY/vY1BsZHwTGvEz3bsn2bm5VSKFAeMmZqsHK1QeYdNsFjLtegnVh+wodxMq50jqLv3LFlA==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.890.0.tgz", + "integrity": "sha512-qZ2Mx7BeYR1s0F/H6wePI0MAmkFswmBgrpgMCOt2S4b2IpQPnUa2JbxY3GwW2WqX3nV0KjPW08ctSLMmlq/tKA==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/core": "3.888.0", - "@aws-sdk/nested-clients": "3.888.0", + "@aws-sdk/core": "3.890.0", + "@aws-sdk/nested-clients": "3.890.0", "@aws-sdk/types": "3.887.0", - "@smithy/property-provider": "^4.0.5", + "@smithy/property-provider": "^4.1.1", + "@smithy/shared-ini-file-loader": "^4.2.0", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -531,28 +532,28 @@ } }, "node_modules/@aws-sdk/credential-providers": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-providers/-/credential-providers-3.888.0.tgz", - "integrity": "sha512-If2AnDiJJLT889imXn6cEM4WoduPgTye/vYiVXZaDqMvjk+tJVbA9uFuv1ixF3DHMC6aE0LU9cTjXX+I4TayFg==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-providers/-/credential-providers-3.890.0.tgz", + "integrity": "sha512-3RZ1jpU4CLdGplJJO9Oe7Elt6mkKppHCSZ6b7kiftoYbbc3B0ZtRDDDnMa3OMMSgxi+WphefbEbN+4/gGdHziw==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/client-cognito-identity": "3.888.0", - "@aws-sdk/core": "3.888.0", - "@aws-sdk/credential-provider-cognito-identity": "3.888.0", - "@aws-sdk/credential-provider-env": "3.888.0", - "@aws-sdk/credential-provider-http": "3.888.0", - "@aws-sdk/credential-provider-ini": "3.888.0", - "@aws-sdk/credential-provider-node": "3.888.0", - "@aws-sdk/credential-provider-process": "3.888.0", - "@aws-sdk/credential-provider-sso": "3.888.0", - "@aws-sdk/credential-provider-web-identity": "3.888.0", - "@aws-sdk/nested-clients": "3.888.0", + "@aws-sdk/client-cognito-identity": "3.890.0", + "@aws-sdk/core": "3.890.0", + "@aws-sdk/credential-provider-cognito-identity": "3.890.0", + "@aws-sdk/credential-provider-env": "3.890.0", + "@aws-sdk/credential-provider-http": "3.890.0", + "@aws-sdk/credential-provider-ini": "3.890.0", + "@aws-sdk/credential-provider-node": "3.890.0", + "@aws-sdk/credential-provider-process": "3.890.0", + "@aws-sdk/credential-provider-sso": "3.890.0", + "@aws-sdk/credential-provider-web-identity": "3.890.0", + "@aws-sdk/nested-clients": "3.890.0", "@aws-sdk/types": "3.887.0", - "@smithy/config-resolver": "^4.2.1", + "@smithy/config-resolver": "^4.2.2", "@smithy/core": "^3.11.0", - "@smithy/credential-provider-imds": "^4.0.7", - "@smithy/node-config-provider": "^4.2.1", - "@smithy/property-provider": "^4.0.5", + "@smithy/credential-provider-imds": "^4.1.2", + "@smithy/node-config-provider": "^4.2.2", + "@smithy/property-provider": "^4.1.1", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -561,13 +562,13 @@ } }, "node_modules/@aws-sdk/eventstream-handler-node": { - "version": "3.887.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-handler-node/-/eventstream-handler-node-3.887.0.tgz", - "integrity": "sha512-BFzSgyrbCOr9O2bOZCq7uOw4fuJP0Lpt7++41YNfzAXInNSYcSKFLDhmnrDnSSqJ+yC7SWOAiPYSV5o66YNzFA==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/eventstream-handler-node/-/eventstream-handler-node-3.890.0.tgz", + "integrity": "sha512-Jl58RLWlNgbmnk6r7kQRzXaUdDebcd3ZBRfM4sHJmd5TNWViqfdh8xYlhZFfSjSNw6eAPOfaZbAJWkQCNWJNqw==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/types": "3.887.0", - "@smithy/eventstream-codec": "^4.0.5", + "@smithy/eventstream-codec": "^4.1.1", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -636,14 +637,14 @@ } }, "node_modules/@aws-sdk/middleware-user-agent": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.888.0.tgz", - "integrity": "sha512-ZkcUkoys8AdrNNG7ATjqw2WiXqrhTvT+r4CIK3KhOqIGPHX0p0DQWzqjaIl7ZhSUToKoZ4Ud7MjF795yUr73oA==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.890.0.tgz", + "integrity": "sha512-x4+gLrOFGN7PnfxCaQbs3QEF8bMQE4CVxcOp066UEJqr2Pn4yB12Q3O+YntOtESK5NcTxIh7JlhGss95EHzNng==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/core": "3.888.0", + "@aws-sdk/core": "3.890.0", "@aws-sdk/types": "3.887.0", - "@aws-sdk/util-endpoints": "3.887.0", + "@aws-sdk/util-endpoints": "3.890.0", "@smithy/core": "^3.11.0", "@smithy/protocol-http": "^5.2.1", "@smithy/types": "^4.5.0", @@ -654,20 +655,20 @@ } }, "node_modules/@aws-sdk/middleware-websocket": { - "version": "3.887.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-websocket/-/middleware-websocket-3.887.0.tgz", - "integrity": "sha512-qEv2c3sritwdYUERMYmLCt3kw/MI8or0s1C8/y5CyINJ5DAlwlnyHbKxKvG0+QuUXEctpuhji2ZO3Cb0kmYD2Q==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-websocket/-/middleware-websocket-3.890.0.tgz", + "integrity": "sha512-t6iJhlh7S0lAWpC10t+7QAn7jlNfNweXJgb/rTtp9FMh/DA2+7o0zTHllFaZ1GsKuEbCU/pRDKvzvnOeTrL5WA==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/types": "3.887.0", "@aws-sdk/util-format-url": "3.887.0", - "@smithy/eventstream-codec": "^4.0.5", + "@smithy/eventstream-codec": "^4.1.1", "@smithy/eventstream-serde-browser": "^4.1.1", "@smithy/fetch-http-handler": "^5.2.1", "@smithy/protocol-http": "^5.2.1", - "@smithy/signature-v4": "^5.1.3", + "@smithy/signature-v4": "^5.2.1", "@smithy/types": "^4.5.0", - "@smithy/util-hex-encoding": "^4.0.0", + "@smithy/util-hex-encoding": "^4.1.0", "tslib": "^2.6.2" }, "engines": { @@ -675,45 +676,45 @@ } }, "node_modules/@aws-sdk/nested-clients": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.888.0.tgz", - "integrity": "sha512-py4o4RPSGt+uwGvSBzR6S6cCBjS4oTX5F8hrHFHfPCdIOMVjyOBejn820jXkCrcdpSj3Qg1yUZXxsByvxc9Lyg==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.890.0.tgz", + "integrity": "sha512-D5qVNd+qlqdL8duJShzffAqPllGRA4tG7n/GEpL13eNfHChPvGkkUFBMrxSgCAETaTna13G6kq+dMO+SAdbm1A==", "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/core": "3.888.0", + "@aws-sdk/core": "3.890.0", "@aws-sdk/middleware-host-header": "3.887.0", "@aws-sdk/middleware-logger": "3.887.0", "@aws-sdk/middleware-recursion-detection": "3.887.0", - "@aws-sdk/middleware-user-agent": "3.888.0", - "@aws-sdk/region-config-resolver": "3.887.0", + "@aws-sdk/middleware-user-agent": "3.890.0", + "@aws-sdk/region-config-resolver": "3.890.0", "@aws-sdk/types": "3.887.0", - "@aws-sdk/util-endpoints": "3.887.0", + "@aws-sdk/util-endpoints": "3.890.0", "@aws-sdk/util-user-agent-browser": "3.887.0", - "@aws-sdk/util-user-agent-node": "3.888.0", - "@smithy/config-resolver": "^4.2.1", + "@aws-sdk/util-user-agent-node": "3.890.0", + "@smithy/config-resolver": "^4.2.2", "@smithy/core": "^3.11.0", "@smithy/fetch-http-handler": "^5.2.1", "@smithy/hash-node": "^4.1.1", "@smithy/invalid-dependency": "^4.1.1", "@smithy/middleware-content-length": "^4.1.1", - "@smithy/middleware-endpoint": "^4.2.1", - "@smithy/middleware-retry": "^4.2.1", + "@smithy/middleware-endpoint": "^4.2.2", + "@smithy/middleware-retry": "^4.2.2", "@smithy/middleware-serde": "^4.1.1", "@smithy/middleware-stack": "^4.1.1", - "@smithy/node-config-provider": "^4.2.1", + "@smithy/node-config-provider": "^4.2.2", "@smithy/node-http-handler": "^4.2.1", "@smithy/protocol-http": "^5.2.1", - "@smithy/smithy-client": "^4.6.1", + "@smithy/smithy-client": "^4.6.2", "@smithy/types": "^4.5.0", "@smithy/url-parser": "^4.1.1", "@smithy/util-base64": "^4.1.0", "@smithy/util-body-length-browser": "^4.1.0", "@smithy/util-body-length-node": "^4.1.0", - "@smithy/util-defaults-mode-browser": "^4.1.1", - "@smithy/util-defaults-mode-node": "^4.1.1", - "@smithy/util-endpoints": "^3.1.1", + "@smithy/util-defaults-mode-browser": "^4.1.2", + "@smithy/util-defaults-mode-node": "^4.1.2", + "@smithy/util-endpoints": "^3.1.2", "@smithy/util-middleware": "^4.1.1", "@smithy/util-retry": "^4.1.1", "@smithy/util-utf8": "^4.1.0", @@ -724,15 +725,15 @@ } }, "node_modules/@aws-sdk/region-config-resolver": { - "version": "3.887.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.887.0.tgz", - "integrity": "sha512-VdSMrIqJ3yjJb/fY+YAxrH/lCVv0iL8uA+lbMNfQGtO5tB3Zx6SU9LEpUwBNX8fPK1tUpI65CNE4w42+MY/7Mg==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.890.0.tgz", + "integrity": "sha512-VfdT+tkF9groRYNzKvQCsCGDbOQdeBdzyB1d6hWiq22u13UafMIoskJ1ec0i0H1X29oT6mjTitfnvPq1UiKwzQ==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/types": "3.887.0", - "@smithy/node-config-provider": "^4.2.1", + "@smithy/node-config-provider": "^4.2.2", "@smithy/types": "^4.5.0", - "@smithy/util-config-provider": "^4.0.0", + "@smithy/util-config-provider": "^4.1.0", "@smithy/util-middleware": "^4.1.1", "tslib": "^2.6.2" }, @@ -741,16 +742,16 @@ } }, "node_modules/@aws-sdk/token-providers": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.888.0.tgz", - "integrity": "sha512-WA3NF+3W8GEuCMG1WvkDYbB4z10G3O8xuhT7QSjhvLYWQ9CPt3w4VpVIfdqmUn131TCIbhCzD0KN/1VJTjAjyw==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.890.0.tgz", + "integrity": "sha512-+pK/0iQEpPmnztbAw0NNmb+B5pPy8VLu+Ab4SJLgVp41RE9NO13VQtrzUbh61TTAVMrzqWlLQ2qmAl2Fk4VNgw==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/core": "3.888.0", - "@aws-sdk/nested-clients": "3.888.0", + "@aws-sdk/core": "3.890.0", + "@aws-sdk/nested-clients": "3.890.0", "@aws-sdk/types": "3.887.0", - "@smithy/property-provider": "^4.0.5", - "@smithy/shared-ini-file-loader": "^4.0.5", + "@smithy/property-provider": "^4.1.1", + "@smithy/shared-ini-file-loader": "^4.2.0", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -772,15 +773,15 @@ } }, "node_modules/@aws-sdk/util-endpoints": { - "version": "3.887.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.887.0.tgz", - "integrity": "sha512-kpegvT53KT33BMeIcGLPA65CQVxLUL/C3gTz9AzlU/SDmeusBHX4nRApAicNzI/ltQ5lxZXbQn18UczzBuwF1w==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.890.0.tgz", + "integrity": "sha512-nJ8v1x9ZQKzMRK4dS4oefOMIHqb6cguctTcx1RB9iTaFOR5pP7bvq+D4mvNZ6vBxiHg1dQGBUUgl5XJmdR7atQ==", "license": "Apache-2.0", "dependencies": { "@aws-sdk/types": "3.887.0", "@smithy/types": "^4.5.0", "@smithy/url-parser": "^4.1.1", - "@smithy/util-endpoints": "^3.1.1", + "@smithy/util-endpoints": "^3.1.2", "tslib": "^2.6.2" }, "engines": { @@ -827,14 +828,14 @@ } }, "node_modules/@aws-sdk/util-user-agent-node": { - "version": "3.888.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.888.0.tgz", - "integrity": "sha512-rSB3OHyuKXotIGfYEo//9sU0lXAUrTY28SUUnxzOGYuQsAt0XR5iYwBAp+RjV6x8f+Hmtbg0PdCsy1iNAXa0UQ==", + "version": "3.890.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.890.0.tgz", + "integrity": "sha512-s85NkCxKoAlUvx7UP7OelxLqwTi27Tps9/Q+4N+9rEUjThxEnDsqJSStJ1XiYhddz1xc/vxMvPjYN0qX6EKPtA==", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/middleware-user-agent": "3.888.0", + "@aws-sdk/middleware-user-agent": "3.890.0", "@aws-sdk/types": "3.887.0", - "@smithy/node-config-provider": "^4.2.1", + "@smithy/node-config-provider": "^4.2.2", "@smithy/types": "^4.5.0", "tslib": "^2.6.2" }, @@ -1444,9 +1445,9 @@ } }, "node_modules/@continuedev/config-yaml": { - "version": "1.14.0", - "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.14.0.tgz", - "integrity": "sha512-MRi2SKTLkXme/lyFZruXGhWsaH9eMHvgkj/gAQcAhe6LxvbEOt2SyG7IS/t/8fDRJ2pXIjK/FtJpdKarXokJpA==", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.15.1.tgz", + "integrity": "sha512-Q6eXQyj7pqOWV/3fwmKmeriOkpOdZYTZOf2A4L3xUCyqzjIayAu8GJxSP0uxwPu0ppwQx9lbrl3oF+i3DGITAQ==", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", @@ -1458,9 +1459,9 @@ } }, "node_modules/@continuedev/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-tDrl2RT325dwpjkZdBc0vOniN9BHSO4zlA3XEZrkM9FHkQNQ2hqlRNrcfoyKjxMgKFiTUkk0KX9A0KH0i2skJg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.2.1.tgz", + "integrity": "sha512-mUq6918QwsutUp65hB/xNLAa0fgjE6JQ5fzMjGlqBp4Q6BQq65HTAtwaBq5PdjPWX72akwhRiGiLOeR0Y2dULg==", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", @@ -1979,6 +1980,7 @@ "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", @@ -2982,9 +2984,9 @@ } }, "node_modules/@octokit/core": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.3.tgz", - "integrity": "sha512-oNXsh2ywth5aowwIa7RKtawnkdH6LgU1ztfP9AIUCQCvzysB+WeU8o2kyyosDPwBZutPpjZDKPQGIzzrfTWweQ==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.4.tgz", + "integrity": "sha512-jOT8V1Ba5BdC79sKrRWDdMT5l1R+XNHTPR6CPWzUP2EcfAcvIHZWF0eAbmRcpOOP5gVIwnqNg0C4nvh6Abc3OA==", "dev": true, "license": "MIT", "dependencies": { @@ -2992,7 +2994,7 @@ "@octokit/graphql": "^9.0.1", "@octokit/request": "^10.0.2", "@octokit/request-error": "^7.0.0", - "@octokit/types": "^14.0.0", + "@octokit/types": "^15.0.0", "before-after-hook": "^4.0.0", "universal-user-agent": "^7.0.0" }, @@ -3014,6 +3016,23 @@ "node": ">= 20" } }, + "node_modules/@octokit/endpoint/node_modules/@octokit/openapi-types": { + "version": "25.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.1.0.tgz", + "integrity": "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/endpoint/node_modules/@octokit/types": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz", + "integrity": "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^25.1.0" + } + }, "node_modules/@octokit/graphql": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.1.tgz", @@ -3029,13 +3048,30 @@ "node": ">= 20" } }, - "node_modules/@octokit/openapi-types": { + "node_modules/@octokit/graphql/node_modules/@octokit/openapi-types": { "version": "25.1.0", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.1.0.tgz", "integrity": "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA==", "dev": true, "license": "MIT" }, + "node_modules/@octokit/graphql/node_modules/@octokit/types": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz", + "integrity": "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^25.1.0" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "26.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-26.0.0.tgz", + "integrity": "sha512-7AtcfKtpo77j7Ts73b4OWhOZHTKo/gGY8bB3bNBQz4H+GRSWqx2yvj8TXRsbdTE0eRmYmXOEY66jM7mJ7LzfsA==", + "dev": true, + "license": "MIT" + }, "node_modules/@octokit/plugin-paginate-rest": { "version": "13.1.1", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-13.1.1.tgz", @@ -3052,6 +3088,23 @@ "@octokit/core": ">=6" } }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { + "version": "25.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.1.0.tgz", + "integrity": "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz", + "integrity": "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^25.1.0" + } + }, "node_modules/@octokit/plugin-retry": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-8.0.1.tgz", @@ -3070,6 +3123,23 @@ "@octokit/core": ">=7" } }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": { + "version": "25.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.1.0.tgz", + "integrity": "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-retry/node_modules/@octokit/types": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz", + "integrity": "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^25.1.0" + } + }, "node_modules/@octokit/plugin-throttling": { "version": "11.0.1", "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-11.0.1.tgz", @@ -3087,6 +3157,23 @@ "@octokit/core": "^7.0.0" } }, + "node_modules/@octokit/plugin-throttling/node_modules/@octokit/openapi-types": { + "version": "25.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.1.0.tgz", + "integrity": "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-throttling/node_modules/@octokit/types": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz", + "integrity": "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^25.1.0" + } + }, "node_modules/@octokit/request": { "version": "10.0.3", "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.3.tgz", @@ -3117,7 +3204,14 @@ "node": ">= 20" } }, - "node_modules/@octokit/types": { + "node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": { + "version": "25.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.1.0.tgz", + "integrity": "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/request-error/node_modules/@octokit/types": { "version": "14.1.0", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz", "integrity": "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g==", @@ -3127,6 +3221,33 @@ "@octokit/openapi-types": "^25.1.0" } }, + "node_modules/@octokit/request/node_modules/@octokit/openapi-types": { + "version": "25.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.1.0.tgz", + "integrity": "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/request/node_modules/@octokit/types": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz", + "integrity": "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^25.1.0" + } + }, + "node_modules/@octokit/types": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-15.0.0.tgz", + "integrity": "sha512-8o6yDfmoGJUIeR9OfYU0/TUJTnMPG2r68+1yEdUeG2Fdqpj8Qetg0ziKIgcBm0RW/j29H41WP37CYCEhp6GoHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^26.0.0" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -3134,6 +3255,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "engines": { "node": ">=14" } @@ -5549,7 +5671,8 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/base64-js": { "version": "1.5.1", @@ -5617,6 +5740,7 @@ "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -5635,9 +5759,9 @@ } }, "node_modules/browserslist": { - "version": "4.26.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.26.0.tgz", - "integrity": "sha512-P9go2WrP9FiPwLv3zqRD/Uoxo0RSHjzFCiQz7d4vbmwNqQFo9T9WCeP/Qn5EbcKQY6DBbkxEXNcpJOmncNrb7A==", + "version": "4.26.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.26.2.tgz", + "integrity": "sha512-ECFzp6uFOSB+dcZ5BK/IBaGWssbSYBHvuMeMt3MMFyhI0Z8SqGgEkBLARgpRH3hutIgPVsALcMwbDrJqPxQ65A==", "dev": true, "funding": [ { @@ -5656,7 +5780,7 @@ "license": "MIT", "peer": true, "dependencies": { - "baseline-browser-mapping": "^2.8.2", + "baseline-browser-mapping": "^2.8.3", "caniuse-lite": "^1.0.30001741", "electron-to-chromium": "^1.5.218", "node-releases": "^2.0.21", @@ -5739,9 +5863,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001741", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001741.tgz", - "integrity": "sha512-QGUGitqsc8ARjLdgAfxETDhRbJ0REsP6O3I96TAth/mVjh2cYzN2u+3AzPP3aVSm2FehEItaJw1xd+IGBXWeSw==", + "version": "1.0.30001743", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001743.tgz", + "integrity": "sha512-e6Ojr7RV14Un7dz6ASD0aZDmQPT/A+eZU+nuTNfjqmRrmkmQlnTNWH0SKmqagx9PeW87UVqapSurtAXifmtdmw==", "dev": true, "funding": [ { @@ -5826,6 +5950,7 @@ } ], "license": "MIT", + "peer": true, "engines": { "node": ">=8" } @@ -6543,7 +6668,8 @@ "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", @@ -6581,7 +6707,8 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/emojilib": { "version": "2.4.0", @@ -7132,6 +7259,7 @@ "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "cross-spawn": "^7.0.6", "signal-exit": "^4.0.1" @@ -7149,6 +7277,7 @@ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, "license": "ISC", + "peer": true, "engines": { "node": ">=14" }, @@ -7324,6 +7453,7 @@ "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", @@ -7584,6 +7714,7 @@ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=0.8.19" } @@ -7855,6 +7986,7 @@ "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", "dev": true, "license": "BlueOak-1.0.0", + "peer": true, "dependencies": { "@isaacs/cliui": "^8.0.2" }, @@ -9904,6 +10036,7 @@ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "brace-expansion": "^2.0.1" }, @@ -9930,6 +10063,7 @@ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, "license": "ISC", + "peer": true, "engines": { "node": ">=16 || 14 >=14.17" } @@ -12999,7 +13133,8 @@ "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", "dev": true, - "license": "BlueOak-1.0.0" + "license": "BlueOak-1.0.0", + "peer": true }, "node_modules/parent-module": { "version": "1.0.1", @@ -13108,6 +13243,7 @@ "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dev": true, "license": "BlueOak-1.0.0", + "peer": true, "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" @@ -13124,7 +13260,8 @@ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", "dev": true, - "license": "ISC" + "license": "ISC", + "peer": true }, "node_modules/path-type": { "version": "4.0.0", @@ -14363,6 +14500,7 @@ "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", @@ -14382,6 +14520,7 @@ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -14397,6 +14536,7 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=8" } @@ -14406,7 +14546,8 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/string-width-cjs/node_modules/strip-ansi": { "version": "6.0.1", @@ -14414,6 +14555,7 @@ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -14427,6 +14569,7 @@ "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ansi-regex": "^6.0.1" }, @@ -14444,6 +14587,7 @@ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -14457,6 +14601,7 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=8" } @@ -15534,6 +15679,7 @@ "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", @@ -15553,6 +15699,7 @@ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -15571,6 +15718,7 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=8" } @@ -15580,7 +15728,8 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/wrap-ansi-cjs/node_modules/string-width": { "version": "4.2.3", @@ -15588,6 +15737,7 @@ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -15603,6 +15753,7 @@ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -15616,6 +15767,7 @@ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -15637,6 +15789,7 @@ "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", "dev": true, "license": "ISC", + "peer": true, "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" @@ -15651,6 +15804,7 @@ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, "license": "ISC", + "peer": true, "engines": { "node": ">=14" }, diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index 076ce76cb..c2b11cd4a 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/openai-adapters", - "version": "1.14.0", + "version": "1.15.0", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/openai-adapters/src/apis/Anthropic.ts b/packages/openai-adapters/src/apis/Anthropic.ts index 617e8e6f4..27c0c6f86 100644 --- a/packages/openai-adapters/src/apis/Anthropic.ts +++ b/packages/openai-adapters/src/apis/Anthropic.ts @@ -140,9 +140,25 @@ export class AnthropicApi implements BaseLlmApi { ], }; } else if (message.role === "assistant" && message.tool_calls) { - return { - role: "assistant", - content: message.tool_calls.map((toolCall) => { + const parts: any[] = []; + if (message.content) { + if (typeof message.content === "string") { + parts.push({ + type: "text", + text: message.content, + }); + } else if (message.content.length > 0) { + parts.push( + message.content.map((c) => ({ + type: "text", + text: c.type === "text" ? c.text : c.refusal, + })), + ); + } + } + + parts.push( + ...message.tool_calls.map((toolCall) => { // Type guard for function tool calls if (toolCall.type === "function" && "function" in toolCall) { return { @@ -158,6 +174,10 @@ export class AnthropicApi implements BaseLlmApi { throw new Error(`Unsupported tool call type: ${toolCall.type}`); } }), + ); + return { + role: "assistant", + content: parts, }; } diff --git a/packages/openai-adapters/src/test/main.test.ts b/packages/openai-adapters/src/test/main.test.ts index 0652c36b4..60c05236a 100644 --- a/packages/openai-adapters/src/test/main.test.ts +++ b/packages/openai-adapters/src/test/main.test.ts @@ -12,6 +12,7 @@ dotenv.config(); export interface TestConfigOptions { skipTools: boolean; expectUsage?: boolean; + skipSystemMessage?: boolean; } function testConfig(_config: ModelConfig & { options?: TestConfigOptions }) { @@ -98,9 +99,9 @@ const TESTS: Omit[] = [ }, { provider: "mistral", - model: "codestral", + model: "codestral-latest", apiKey: process.env.MISTRAL_API_KEY!, - roles: ["chat"], + roles: ["chat", "autocomplete"], options: { skipTools: false, expectUsage: true, @@ -150,6 +151,7 @@ const TESTS: Omit[] = [ options: { skipTools: true, expectUsage: true, + skipSystemMessage: true, }, }, { diff --git a/packages/openai-adapters/src/test/util.ts b/packages/openai-adapters/src/test/util.ts index f637dec7e..c36e56848 100644 --- a/packages/openai-adapters/src/test/util.ts +++ b/packages/openai-adapters/src/test/util.ts @@ -210,26 +210,28 @@ export function testChat( }); test("should acknowledge system message in chat", async () => { - const response = await api.chatCompletionNonStream( - { - model, - messages: [ - { - role: "system", - content: - "Regardless of what is asked of you, your answer should start with 'RESPONSE: '.", - }, - { role: "user", content: "Who are you?" }, - ], - stream: false, - }, - new AbortController().signal, - ); - expect(response.choices.length).toBeGreaterThan(0); - const completion = response.choices[0].message.content; - expect(typeof completion).toBe("string"); - expect(completion?.length).toBeGreaterThan(0); - expect(completion?.startsWith("RESPONSE: ")).toBe(true); + if (options?.skipSystemMessage !== true) { + const response = await api.chatCompletionNonStream( + { + model, + messages: [ + { + role: "system", + content: + "Regardless of what is asked of you, your answer should start with 'RESPONSE: '.", + }, + { role: "user", content: "Who are you?" }, + ], + stream: false, + }, + new AbortController().signal, + ); + expect(response.choices.length).toBeGreaterThan(0); + const completion = response.choices[0].message.content; + expect(typeof completion).toBe("string"); + expect(completion?.length).toBeGreaterThan(0); + expect(completion?.startsWith("RESPONSE: ")).toBe(true); + } }); if (options?.skipTools === false) { @@ -315,14 +317,14 @@ export function testChat( arguments: '{"name":"Nate"}', name: "say_hello", }, - id: "tool_call_1", + id: "toolcall1", // mistral requires alphanumeric length of 9 type: "function", }, ], }, { role: "tool", - tool_call_id: "tool_call_1", + tool_call_id: "toolcall1", content: "Nate was greeted", }, ],