diff --git a/.continue/rules/bigger-picture-description-rules.yaml b/.continue/rules/bigger-picture-description-rules.yaml new file mode 100644 index 000000000..4e076e88a --- /dev/null +++ b/.continue/rules/bigger-picture-description-rules.yaml @@ -0,0 +1,13 @@ +name: bigger-picture-description-rules +version: 0.0.1 +schema: v1 +rules: + - name: bigger-picture-description-rules + rule: >- + When a user asks how a certain part of the code works: + + 1. Describe what the code does in isolation. + + 2. If the code interacts with other parts of the codebase, describe how the code is imported and used in other parts of the codebase. + + 3. When describing each use-case, include the parent function for clarity. diff --git a/.continue/rules/llm-specificity.md b/.continue/rules/llm-specificity.md new file mode 100644 index 000000000..4ff15c9e7 --- /dev/null +++ b/.continue/rules/llm-specificity.md @@ -0,0 +1,11 @@ +--- +globs: core/llm/llms/**/*.{ts,test.ts} +description: Tailor recommendations for LLM code based on which specific LLM is being used. +--- + +# LLM Model Specificity + +- Refer to the file name and names of big classes to determine which LLM is being used in a file. +- Ground all observations and recommendations with knowledge of that LLM. +- Consider items such as context length, architecture, speed, and such. +- Pay attention to the parent classes in these files. diff --git a/.gitignore b/.gitignore index c40a9558d..0e528088c 100644 --- a/.gitignore +++ b/.gitignore @@ -144,6 +144,7 @@ Icon? .continuerc.json .aider* +*.notes.md notes.md *.notes.md diff --git a/core/config/load.ts b/core/config/load.ts index e3d83a6b6..9948071fb 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -51,7 +51,6 @@ import { LLMReranker } from "../llm/llms/llm"; import TransformersJsEmbeddingsProvider from "../llm/llms/TransformersJsEmbeddingsProvider"; import { slashCommandFromPromptFileV1 } from "../promptFiles/v1/slashCommandFromPromptFile"; import { getAllPromptFiles } from "../promptFiles/v2/getPromptFiles"; -import { allTools } from "../tools"; import { copyOf } from "../util"; import { GlobalContext } from "../util/GlobalContext"; import mergeJson from "../util/merge"; @@ -67,6 +66,7 @@ import { } from "../util/paths"; import { localPathToUri } from "../util/pathToUri"; +import { baseToolDefinitions } from "../tools"; import { modifyAnyConfigWithSharedConfig } from "./sharedConfig"; import { getModelByRole, @@ -529,7 +529,7 @@ async function intermediateToFinalConfig({ const continueConfig: ContinueConfig = { ...config, contextProviders, - tools: [...allTools], + tools: [...baseToolDefinitions], mcpServerStatuses: [], slashCommands: config.slashCommands ?? [], modelsByRole: { diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index cc1b98e49..863c4d447 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -25,6 +25,7 @@ import { ControlPlaneClient } from "../../control-plane/client.js"; import { getControlPlaneEnv } from "../../control-plane/env.js"; import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js"; import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; +import { getConfigDependentToolDefinitions } from "../../tools"; import { encodeMCPToolUri } from "../../tools/callTool"; import { getConfigJsonPath, getConfigYamlPath } from "../../util/paths"; import { localPathOrUriToPath } from "../../util/pathToUri"; @@ -176,12 +177,21 @@ export default async function doLoadConfig(options: { ); newConfig.slashCommands.push(...serverSlashCommands); - const submenuItems = server.resources.map((resource) => ({ - title: resource.name, - description: resource.description ?? resource.name, - id: resource.uri, - icon: server.faviconUrl, - })); + const submenuItems = server.resources + .map((resource) => ({ + title: resource.name, + description: resource.description ?? resource.name, + id: resource.uri, + icon: server.faviconUrl, + })) + .concat( + server.resourceTemplates.map((template) => ({ + title: template.name, + description: template.description ?? template.name, + id: template.uriTemplate, + icon: server.faviconUrl, + })), + ); if (submenuItems.length > 0) { const serverContextProvider = new MCPContextProvider({ submenuItems, @@ -193,6 +203,12 @@ export default async function doLoadConfig(options: { } } + newConfig.tools.push( + ...getConfigDependentToolDefinitions({ + rules: newConfig.rules, + }), + ); + // Detect duplicate tool names const counts: Record = {}; newConfig.tools.forEach((tool) => { @@ -202,6 +218,7 @@ export default async function doLoadConfig(options: { counts[tool.function.name] = 1; } }); + Object.entries(counts).forEach(([toolName, count]) => { if (count > 1) { errors!.push({ @@ -211,6 +228,26 @@ export default async function doLoadConfig(options: { } }); + const ruleCounts: Record = {}; + newConfig.rules.forEach((rule) => { + if (rule.name) { + if (ruleCounts[rule.name]) { + ruleCounts[rule.name] = ruleCounts[rule.name] + 1; + } else { + ruleCounts[rule.name] = 1; + } + } + }); + + Object.entries(ruleCounts).forEach(([ruleName, count]) => { + if (count > 1) { + errors!.push({ + fatal: false, + message: `Duplicate (${count}) rules named "${ruleName}" detected. This may cause unexpected behavior`, + }); + } + }); + newConfig.allowAnonymousTelemetry = newConfig.allowAnonymousTelemetry && (await ide.isTelemetryEnabled()); diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 0a0dd03fc..daeecf57e 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -36,11 +36,11 @@ import FreeTrial from "../../llm/llms/FreeTrial"; import TransformersJsEmbeddingsProvider from "../../llm/llms/TransformersJsEmbeddingsProvider"; import { slashCommandFromPromptFileV1 } from "../../promptFiles/v1/slashCommandFromPromptFile"; import { getAllPromptFiles } from "../../promptFiles/v2/getPromptFiles"; -import { allTools } from "../../tools"; import { GlobalContext } from "../../util/GlobalContext"; import { modifyAnyConfigWithSharedConfig } from "../sharedConfig"; import { getControlPlaneEnvSync } from "../../control-plane/env"; +import { baseToolDefinitions } from "../../tools"; import { getCleanUriPath } from "../../util/uri"; import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants"; import { LocalPlatformClient } from "./LocalPlatformClient"; @@ -193,7 +193,7 @@ async function configYamlToContinueConfig(options: { const continueConfig: ContinueConfig = { slashCommands: [], - tools: [...allTools], + tools: [...baseToolDefinitions], mcpServerStatuses: [], contextProviders: [], modelsByRole: { diff --git a/core/context/mcp/MCPConnection.test.ts b/core/context/mcp/MCPConnection.test.ts index b9dae9ee2..f8f146f07 100644 --- a/core/context/mcp/MCPConnection.test.ts +++ b/core/context/mcp/MCPConnection.test.ts @@ -111,6 +111,7 @@ describe("MCPConnection", () => { errors: [], prompts: [], resources: [], + resourceTemplates: [], tools: [], status: "not-connected", }); diff --git a/core/context/mcp/MCPConnection.ts b/core/context/mcp/MCPConnection.ts index 72de75f92..c66a93ed3 100644 --- a/core/context/mcp/MCPConnection.ts +++ b/core/context/mcp/MCPConnection.ts @@ -3,14 +3,15 @@ import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; -import { WebSocketClientTransport } from "@modelcontextprotocol/sdk/client/websocket.js"; import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; +import { WebSocketClientTransport } from "@modelcontextprotocol/sdk/client/websocket.js"; import { MCPConnectionStatus, MCPOptions, MCPPrompt, MCPResource, + MCPResourceTemplate, MCPServerStatus, MCPTool, } from "../.."; @@ -37,6 +38,7 @@ class MCPConnection { public prompts: MCPPrompt[] = []; public tools: MCPTool[] = []; public resources: MCPResource[] = []; + public resourceTemplates: MCPResourceTemplate[] = []; private transport: Transport; private connectionPromise: Promise | null = null; private stdioOutput: { stdout: string; stderr: string } = { @@ -72,6 +74,7 @@ class MCPConnection { errors: this.errors, prompts: this.prompts, resources: this.resources, + resourceTemplates: this.resourceTemplates, tools: this.tools, status: this.status, }; @@ -95,6 +98,7 @@ class MCPConnection { this.tools = []; this.prompts = []; this.resources = []; + this.resourceTemplates = []; this.errors = []; this.stdioOutput = { stdout: "", stderr: "" }; @@ -169,6 +173,23 @@ class MCPConnection { } this.errors.push(errorMessage); } + + // Resource templates + try { + const { resourceTemplates } = + await this.client.listResourceTemplates( + {}, + { signal: timeoutController.signal }, + ); + + this.resourceTemplates = resourceTemplates; + } catch (e) { + let errorMessage = `Error loading resource templates for MCP Server ${this.options.name}`; + if (e instanceof Error) { + errorMessage += `: ${e.message}`; + } + this.errors.push(errorMessage); + } } // Tools <—> Tools @@ -337,9 +358,12 @@ class MCPConnection { requestInit: { headers: options.transport.requestOptions?.headers }, }); case "streamable-http": - return new StreamableHTTPClientTransport(new URL(options.transport.url), { - requestInit: { headers: options.transport.requestOptions?.headers }, - }); + return new StreamableHTTPClientTransport( + new URL(options.transport.url), + { + requestInit: { headers: options.transport.requestOptions?.headers }, + }, + ); default: throw new Error( `Unsupported transport type: ${(options.transport as any).type}`, diff --git a/core/context/providers/MCPContextProvider.ts b/core/context/providers/MCPContextProvider.ts index 71f071f37..6465d6b63 100644 --- a/core/context/providers/MCPContextProvider.ts +++ b/core/context/providers/MCPContextProvider.ts @@ -20,6 +20,7 @@ class MCPContextProvider extends BaseContextProvider { displayTitle: "MCP", description: "Model Context Protocol", type: "submenu", + renderInlineAs: "", }; override get description(): ContextProviderDescription { return { @@ -27,6 +28,7 @@ class MCPContextProvider extends BaseContextProvider { displayTitle: this.options["serverName"] ? `${this.options["serverName"]} resources` : "MCP", + renderInlineAs: "", description: "Model Context Protocol", type: "submenu", }; @@ -47,6 +49,18 @@ class MCPContextProvider extends BaseContextProvider { super(options); } + /** + * Continue experimentally supports resource templates (https://modelcontextprotocol.io/docs/concepts/resources#resource-templates) + * by allowing specifically just the "query" variable in the template, which we will update with the full input of the user in the input box + */ + private insertInputToUriTemplate(uri: string, query: string): string { + const TEMPLATE_VAR = "query"; + if (uri.includes(`{${TEMPLATE_VAR}}`)) { + return uri.replace(`{${TEMPLATE_VAR}}`, encodeURIComponent(query)); + } + return uri; + } + async getContextItems( query: string, extras: ContextProviderExtras, @@ -58,7 +72,9 @@ class MCPContextProvider extends BaseContextProvider { throw new Error(`No MCP connection found for ${mcpId}`); } - const { contents } = await connection.client.readResource({ uri }); + const { contents } = await connection.client.readResource({ + uri: this.insertInputToUriTemplate(uri, extras.fullInput), + }); return await Promise.all( contents.map(async (resource) => { diff --git a/core/control-plane/AuthTypes.ts b/core/control-plane/AuthTypes.ts index c926efac1..3b79d91ae 100644 --- a/core/control-plane/AuthTypes.ts +++ b/core/control-plane/AuthTypes.ts @@ -13,14 +13,10 @@ export interface OnPremSessionInfo { export type ControlPlaneSessionInfo = HubSessionInfo | OnPremSessionInfo; -export function isHubSession( +export function isOnPremSession( sessionInfo: ControlPlaneSessionInfo | undefined, -): sessionInfo is HubSessionInfo { - return ( - sessionInfo !== undefined && - (sessionInfo.AUTH_TYPE === AuthType.WorkOsProd || - sessionInfo.AUTH_TYPE === AuthType.WorkOsStaging) - ); +): sessionInfo is OnPremSessionInfo { + return sessionInfo !== undefined && sessionInfo.AUTH_TYPE === AuthType.OnPrem; } export enum AuthType { diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index e3513ac2d..d2653e246 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -12,7 +12,7 @@ import fetch, { RequestInit, Response } from "node-fetch"; import { OrganizationDescription } from "../config/ProfileLifecycleManager.js"; import { IdeSettings, ModelDescription } from "../index.js"; -import { ControlPlaneSessionInfo, isHubSession } from "./AuthTypes.js"; +import { ControlPlaneSessionInfo, isOnPremSession } from "./AuthTypes.js"; import { getControlPlaneEnv } from "./env.js"; export interface ControlPlaneWorkspace { @@ -63,17 +63,16 @@ export class ControlPlaneClient { async getAccessToken(): Promise { const sessionInfo = await this.sessionInfoPromise; - return isHubSession(sessionInfo) ? sessionInfo.accessToken : undefined; + return isOnPremSession(sessionInfo) ? undefined : sessionInfo?.accessToken; } private async request(path: string, init: RequestInit): Promise { const sessionInfo = await this.sessionInfoPromise; - const hubSession = isHubSession(sessionInfo); - - const accessToken = hubSession ? sessionInfo.accessToken : undefined; + const onPremSession = isOnPremSession(sessionInfo); + const accessToken = await this.getAccessToken(); // Bearer token not necessary for on-prem auth type - if (!accessToken && hubSession) { + if (!accessToken && !onPremSession) { throw new Error("No access token"); } diff --git a/core/core.ts b/core/core.ts index 6b5f9814e..497e64c66 100644 --- a/core/core.ts +++ b/core/core.ts @@ -723,6 +723,7 @@ export class Core { }; return await callTool(tool, toolCall.function.arguments, { + config, ide: this.ide, llm: config.selectedModelByRole.chat, fetch: (url, init) => diff --git a/core/index.d.ts b/core/index.d.ts index 794c03ce0..1f5d0d4a5 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -975,6 +975,7 @@ export interface ToolExtras { toolCallId: string; contextItems: ContextItem[]; }) => void; + config: ContinueConfig; } export interface Tool { @@ -1004,6 +1005,12 @@ interface ToolChoice { }; } +export interface ConfigDependentToolParams { + rules: RuleWithSource[]; +} + +export type GetTool = (params: ConfigDependentToolParams) => Tool; + export interface BaseCompletionOptions { temperature?: number; topP?: number; @@ -1141,7 +1148,7 @@ export interface StreamableHTTPOptions { requestOptions?: RequestOptions; } -export type TransportOptions = +export type TransportOptions = | StdioOptions | WebSocketOptions | SSEOptions @@ -1174,6 +1181,7 @@ export interface MCPPrompt { // Leaving here to ideate on // export type ContinueConfigSource = "local-yaml" | "local-json" | "hub-assistant" | "hub" +// https://modelcontextprotocol.io/docs/concepts/resources#direct-resources export interface MCPResource { name: string; uri: string; @@ -1181,6 +1189,14 @@ export interface MCPResource { mimeType?: string; } +// https://modelcontextprotocol.io/docs/concepts/resources#resource-templates +export interface MCPResourceTemplate { + uriTemplate: string; + name: string; + description?: string; + mimeType?: string; +} + export interface MCPTool { name: string; description?: string; @@ -1197,6 +1213,7 @@ export interface MCPServerStatus extends MCPOptions { prompts: MCPPrompt[]; tools: MCPTool[]; resources: MCPResource[]; + resourceTemplates: MCPResourceTemplate[]; } export interface ContinueUIConfig { diff --git a/core/indexing/utils.test.ts b/core/indexing/utils.test.ts index f432da023..414fb6ff5 100644 --- a/core/indexing/utils.test.ts +++ b/core/indexing/utils.test.ts @@ -11,8 +11,7 @@ test("tagToString returns full tag string when under length limit", () => { expect(tagToString(tag)).toBe("/normal/path/to/repo::main::12345"); }); -test("tagToString truncates beginning of directory when path is too long", () => { - // Create a very long directory path that exceeds MAX_DIR_LENGTH (200) +test("tagToString truncates beginning of directory when path is too long and adds hash for uniqueness", () => { const longPrefix = "/very/long/path/that/will/be/truncated/"; const importantSuffix = "/user/important-project/src/feature"; const longPath = longPrefix + "x".repeat(200) + importantSuffix; @@ -25,18 +24,14 @@ test("tagToString truncates beginning of directory when path is too long", () => const result = tagToString(tag); - // The result should keep the important suffix part - expect(result).toContain(importantSuffix); - // The result should NOT contain the beginning of the path - expect(result).not.toContain(longPrefix); - // The result should include the branch and artifactId expect(result).toContain("::feature-branch::67890"); - // The result should be within the MAX_TABLE_NAME_LENGTH limit (240) expect(result.length).toBeLessThanOrEqual(240); + expect(result).toMatch(/^[a-f0-9]{8}_/); + expect(result).toContain(importantSuffix); }); test("tagToString preserves branch and artifactId exactly, even when truncating", () => { - const longPath = "/a".repeat(300); // Much longer than MAX_DIR_LENGTH + const longPath = "/a".repeat(300); const tag: IndexTag = { directory: longPath, branch: "release-v2.0", @@ -45,14 +40,56 @@ test("tagToString preserves branch and artifactId exactly, even when truncating" const result = tagToString(tag); - // Should contain the exact branch and artifactId expect(result).toContain("::release-v2.0::build-123"); - // Should contain the end of the path - expect(result).toContain("/a/a/a"); - // Should not contain the full original path (it should be truncated) - expect(result.length).toBeLessThan( - longPath.length + "::release-v2.0::build-123".length, - ); - // The result should be within the MAX_TABLE_NAME_LENGTH limit + expect(result).toMatch(/^[a-f0-9]{8}_/); expect(result.length).toBeLessThanOrEqual(240); }); + +test("tagToString ensures uniqueness for different long paths that would otherwise collide", () => { + const basePath = "/very/long/base/path/that/exceeds/limits/"; + const commonSuffix = "/same/ending/path"; + + const tag1: IndexTag = { + directory: basePath + "different1" + "x".repeat(100) + commonSuffix, + branch: "main", + artifactId: "12345", + }; + + const tag2: IndexTag = { + directory: basePath + "different2" + "y".repeat(100) + commonSuffix, + branch: "main", + artifactId: "12345", + }; + + const fullString1 = `${tag1.directory}::${tag1.branch}::${tag1.artifactId}`; + const fullString2 = `${tag2.directory}::${tag2.branch}::${tag2.artifactId}`; + + const result1 = tagToString(tag1); + const result2 = tagToString(tag2); + + expect(result1).not.toBe(result2); + expect(result1.length).toBeLessThanOrEqual(240); + expect(result2.length).toBeLessThanOrEqual(240); + + if (fullString1.length > 240) { + expect(result1).toMatch(/^[a-f0-9]{8}_/); + expect(result2).toMatch(/^[a-f0-9]{8}_/); + } else { + expect(result1).toBe(fullString1); + expect(result2).toBe(fullString2); + } +}); + +test("tagToString produces consistent results for the same input", () => { + const tag: IndexTag = { + directory: + "/some/very/long/path/that/exceeds/the/maximum/length/limit/for/directory/names/in/the/system", + branch: "develop", + artifactId: "test-123", + }; + + const result1 = tagToString(tag); + const result2 = tagToString(tag); + + expect(result1).toBe(result2); +}); diff --git a/core/indexing/utils.ts b/core/indexing/utils.ts index 0713507f0..40ef7c39a 100644 --- a/core/indexing/utils.ts +++ b/core/indexing/utils.ts @@ -1,3 +1,4 @@ +import crypto from "crypto"; import { IndexTag } from ".."; // Maximum length for table names to stay under OS filename limits @@ -18,8 +19,8 @@ const MAX_DIR_LENGTH = 200; * * To handle long paths: * 1. First tries the full string - most backwards compatible - * 2. If too long, truncates directory from the beginning to maintain uniqueness - * (since final parts of paths are more unique than prefixes) + * 2. If too long, truncates directory from the beginning and adds a hash prefix + * to ensure uniqueness while preserving the more readable end parts * 3. Finally ensures entire string stays under MAX_TABLE_NAME_LENGTH for OS compatibility * * @param tag The tag containing directory, branch, and artifactId @@ -32,14 +33,22 @@ export function tagToString(tag: IndexTag): string { return result; } + // Create a hash of the full directory path to ensure uniqueness + const dirHash = crypto + .createHash("md5") + .update(tag.directory) + .digest("hex") + .slice(0, 8); + + // Calculate how much space we have for the directory after accounting for hash, separators, branch, and artifactId + const nonDirLength = `${dirHash}_::${tag.branch}::${tag.artifactId}`.length; + const maxDirForTruncated = MAX_TABLE_NAME_LENGTH - nonDirLength; + // Truncate from the beginning of directory path to preserve the more unique end parts - const dir = - tag.directory.length > MAX_DIR_LENGTH - ? tag.directory.slice(tag.directory.length - MAX_DIR_LENGTH) + const truncatedDir = + tag.directory.length > maxDirForTruncated + ? tag.directory.slice(tag.directory.length - maxDirForTruncated) : tag.directory; - return `${dir}::${tag.branch}::${tag.artifactId}`.slice( - 0, - MAX_TABLE_NAME_LENGTH, - ); + return `${dirHash}_${truncatedDir}::${tag.branch}::${tag.artifactId}`; } diff --git a/core/tools/builtIn.ts b/core/tools/builtIn.ts index 9f70b1a22..892cc3ff8 100644 --- a/core/tools/builtIn.ts +++ b/core/tools/builtIn.ts @@ -10,6 +10,7 @@ export enum BuiltInToolNames { ViewDiff = "builtin_view_diff", LSTool = "builtin_ls", CreateRuleBlock = "builtin_create_rule_block", + RequestRule = "builtin_request_rule", // excluded from allTools for now ViewRepoMap = "builtin_view_repo_map", @@ -18,4 +19,4 @@ export enum BuiltInToolNames { export const BUILT_IN_GROUP_NAME = "Built-In"; -export const CLIENT_TOOLS = [BuiltInToolNames.EditExistingFile]; +export const CLIENT_TOOLS_IMPLS = [BuiltInToolNames.EditExistingFile]; diff --git a/core/tools/callTool.ts b/core/tools/callTool.ts index 34501550b..243c162bb 100644 --- a/core/tools/callTool.ts +++ b/core/tools/callTool.ts @@ -10,6 +10,7 @@ import { grepSearchImpl } from "./implementations/grepSearch"; import { lsToolImpl } from "./implementations/lsTool"; import { readCurrentlyOpenFileImpl } from "./implementations/readCurrentlyOpenFile"; import { readFileImpl } from "./implementations/readFile"; +import { requestRuleImpl } from "./implementations/requestRule"; import { runTerminalCommandImpl } from "./implementations/runTerminalCommand"; import { searchWebImpl } from "./implementations/searchWeb"; import { viewDiffImpl } from "./implementations/viewDiff"; @@ -157,6 +158,8 @@ async function callBuiltInTool( return await readCurrentlyOpenFileImpl(args, extras); case BuiltInToolNames.CreateRuleBlock: return await createRuleBlockImpl(args, extras); + case BuiltInToolNames.RequestRule: + return await requestRuleImpl(args, extras); default: throw new Error(`Tool "${functionName}" not found`); } diff --git a/core/tools/definitions/globSearch.ts b/core/tools/definitions/globSearch.ts index 3cbc43d52..5c2375124 100644 --- a/core/tools/definitions/globSearch.ts +++ b/core/tools/definitions/globSearch.ts @@ -6,7 +6,7 @@ export const globSearchTool: Tool = { displayTitle: "Glob File Search", wouldLikeTo: 'find file matches for "{{{ pattern }}}"', isCurrently: 'finding file matches for "{{{ pattern }}}"', - hasAlready: 'retreived file matches for "{{{ pattern }}}"', + hasAlready: 'retrieved file matches for "{{{ pattern }}}"', readonly: true, isInstant: true, group: BUILT_IN_GROUP_NAME, diff --git a/core/tools/definitions/requestRule.test.ts b/core/tools/definitions/requestRule.test.ts new file mode 100644 index 000000000..e1d0feb81 --- /dev/null +++ b/core/tools/definitions/requestRule.test.ts @@ -0,0 +1,237 @@ +import { RuleWithSource } from "../.."; +import { getRequestRuleDescription } from "./requestRule"; + +describe("getRequestRuleDescription", () => { + it("should return no rules message when no agent-requested rules exist", () => { + const rules: RuleWithSource[] = [ + { + name: "Always Apply Rule", + description: "This rule always applies", + source: "default-chat", + rule: "Always use semicolons", + alwaysApply: true, + ruleFile: "/path/to/rule1.md", + }, + { + name: "Rule with Globs", + description: "This rule has globs", + source: "rules-block", + rule: "Use TypeScript", + globs: "**/*.ts", + ruleFile: "/path/to/rule2.md", + }, + ]; + + const result = getRequestRuleDescription(rules); + + expect(result).toBe( + "Use this tool to select additional rules, specifically based on their descriptions. Available rules:\nNo rules available.", + ); + }); + + it("should return formatted rules when agent-requested rules exist", () => { + const rules: RuleWithSource[] = [ + { + name: "Agent Rule 1", + description: "First agent-requested rule", + source: "rules-block", + rule: "Use consistent formatting", + alwaysApply: false, + ruleFile: "/path/to/agent-rule1.md", + }, + { + name: "Agent Rule 2", + description: "Second agent-requested rule", + source: "default-agent", + rule: "Follow naming conventions", + alwaysApply: false, + ruleFile: "/path/to/agent-rule2.md", + }, + // These should be filtered out + { + name: "Always Apply Rule", + description: "This rule always applies", + source: "default-chat", + rule: "Always use semicolons", + alwaysApply: true, + ruleFile: "/path/to/rule1.md", + }, + { + name: "Rule with Globs", + description: "This rule has globs", + source: "rules-block", + rule: "Use TypeScript", + globs: "**/*.ts", + ruleFile: "/path/to/rule2.md", + }, + ]; + + const result = getRequestRuleDescription(rules); + + const expected = + "Use this tool to select additional rules, specifically based on their descriptions. Available rules:\n" + + "Agent Rule 1: First agent-requested rule\n" + + "Agent Rule 2: Second agent-requested rule"; + + expect(result).toBe(expected); + }); + + it("should handle rules with missing description", () => { + const rules: RuleWithSource[] = [ + { + name: "Rule Without Description", + source: "rules-block", + rule: "Some rule content", + alwaysApply: false, + ruleFile: "/path/to/no-desc-rule.md", + }, + ]; + + const result = getRequestRuleDescription(rules); + + const expected = + "Use this tool to select additional rules, specifically based on their descriptions. Available rules:\n" + + "Rule Without Description: undefined"; + + expect(result).toBe(expected); + }); + + it("should handle rules with missing name", () => { + const rules: RuleWithSource[] = [ + { + description: "Rule without name", + source: "rules-block", + rule: "Some rule content", + alwaysApply: false, + ruleFile: "/path/to/no-name-rule.md", + }, + ]; + + const result = getRequestRuleDescription(rules); + + const expected = + "Use this tool to select additional rules, specifically based on their descriptions. Available rules:\n" + + "undefined: Rule without name"; + + expect(result).toBe(expected); + }); + + it("should handle rules with missing ruleFile", () => { + const rules: RuleWithSource[] = [ + { + name: "Rule Without File", + description: "Rule without file path", + source: "rules-block", + rule: "Some rule content", + alwaysApply: false, + }, + ]; + + const result = getRequestRuleDescription(rules); + + const expected = + "Use this tool to select additional rules, specifically based on their descriptions. Available rules:\n" + + "Rule Without File: Rule without file path"; + + expect(result).toBe(expected); + }); + + it("should filter out rules with alwaysApply undefined (truthy)", () => { + const rules: RuleWithSource[] = [ + { + name: "Rule with undefined alwaysApply", + description: "This should be filtered out", + source: "rules-block", + rule: "Some rule", + ruleFile: "/path/to/rule.md", + // alwaysApply is undefined, which is truthy in the filter condition + }, + { + name: "Valid Agent Rule", + description: "This should be included", + source: "rules-block", + rule: "Some rule", + alwaysApply: false, + ruleFile: "/path/to/valid-rule.md", + }, + ]; + + const result = getRequestRuleDescription(rules); + + const expected = + "Use this tool to select additional rules, specifically based on their descriptions. Available rules:\n" + + "Valid Agent Rule: This should be included"; + + expect(result).toBe(expected); + }); + + it("should filter out rules with any globs defined", () => { + const rules: RuleWithSource[] = [ + { + name: "Rule with string globs", + description: "This should be filtered out", + source: "rules-block", + rule: "Some rule", + alwaysApply: false, + globs: "**/*.ts", + ruleFile: "/path/to/rule1.md", + }, + { + name: "Rule with array globs", + description: "This should also be filtered out", + source: "rules-block", + rule: "Some rule", + alwaysApply: false, + globs: ["**/*.ts", "**/*.js"], + ruleFile: "/path/to/rule2.md", + }, + { + name: "Valid Agent Rule", + description: "This should be included", + source: "rules-block", + rule: "Some rule", + alwaysApply: false, + ruleFile: "/path/to/valid-rule.md", + }, + ]; + + const result = getRequestRuleDescription(rules); + + const expected = + "Use this tool to select additional rules, specifically based on their descriptions. Available rules:\n" + + "Valid Agent Rule: This should be included"; + + expect(result).toBe(expected); + }); + + it("should handle empty rules array", () => { + const rules: RuleWithSource[] = []; + + const result = getRequestRuleDescription(rules); + + expect(result).toBe( + "Use this tool to select additional rules, specifically based on their descriptions. Available rules:\nNo rules available.", + ); + }); + + it("should handle single agent-requested rule", () => { + const rules: RuleWithSource[] = [ + { + name: "Single Rule", + description: "The only agent-requested rule", + source: "rules-block", + rule: "Follow this guideline", + alwaysApply: false, + ruleFile: "/path/to/single-rule.md", + }, + ]; + + const result = getRequestRuleDescription(rules); + + const expected = + "Use this tool to select additional rules, specifically based on their descriptions. Available rules:\n" + + "Single Rule: The only agent-requested rule"; + + expect(result).toBe(expected); + }); +}); diff --git a/core/tools/definitions/requestRule.ts b/core/tools/definitions/requestRule.ts new file mode 100644 index 000000000..cb60cda73 --- /dev/null +++ b/core/tools/definitions/requestRule.ts @@ -0,0 +1,52 @@ +import { ConfigDependentToolParams, GetTool } from "../.."; +import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; + +export interface RequestRuleArgs { + name: string; +} + +export function getRequestRuleDescription( + rules: ConfigDependentToolParams["rules"], +): string { + // Must be explicitly false and no globs + const agentRequestedRules = rules.filter( + (rule) => rule.alwaysApply === false && !rule.globs, + ); + + const prefix = + "Use this tool to select additional rules, specifically based on their descriptions. Available rules:\n"; + + const body = agentRequestedRules + .map((rule) => `${rule.name}: ${rule.description}`) + .join("\n"); + + if (body.length === 0) { + return prefix + "No rules available."; + } + + return prefix + body; +} + +export const requestRuleTool: GetTool = ({ rules }) => ({ + type: "function", + displayTitle: "Request Rules", + wouldLikeTo: "request rule {{{ name }}}", + isCurrently: "reading rule {{{ name }}}", + hasAlready: "read rule {{{ name }}}", + group: BUILT_IN_GROUP_NAME, + readonly: false, + function: { + name: BuiltInToolNames.RequestRule, + description: getRequestRuleDescription(rules), + parameters: { + type: "object", + required: ["name"], + properties: { + name: { + type: "string", + description: "Name of the rule", + }, + }, + }, + }, +}); diff --git a/core/tools/implementations/requestRule.ts b/core/tools/implementations/requestRule.ts new file mode 100644 index 000000000..86aff6280 --- /dev/null +++ b/core/tools/implementations/requestRule.ts @@ -0,0 +1,28 @@ +import { ToolImpl } from "."; +import { parseMarkdownRule } from "../../config/markdown/parseMarkdownRule"; + +export const requestRuleImpl: ToolImpl = async (args, extras) => { + // Find the rule by name in the config + const rule = extras.config.rules.find((r) => r.name === args.name); + + if (!rule || !rule.ruleFile) { + throw new Error( + `Rule with name "${args.name}" not found or has no file path`, + ); + } + + const fileContent = await extras.ide.readFile(rule.ruleFile); + const { markdown, frontmatter } = parseMarkdownRule(fileContent); + + return [ + { + name: frontmatter.name ?? "", + description: frontmatter.description ?? "", + content: markdown, + uri: { + type: "file", + value: rule.ruleFile, + }, + }, + ]; +}; diff --git a/core/tools/index.ts b/core/tools/index.ts index d89cf8744..f7ed3be4b 100644 --- a/core/tools/index.ts +++ b/core/tools/index.ts @@ -1,3 +1,4 @@ +import { ConfigDependentToolParams, Tool } from ".."; import { createNewFileTool } from "./definitions/createNewFile"; import { createRuleBlock } from "./definitions/createRuleBlock"; import { editFileTool } from "./definitions/editFile"; @@ -6,11 +7,12 @@ import { grepSearchTool } from "./definitions/grepSearch"; import { lsTool } from "./definitions/lsTool"; import { readCurrentlyOpenFileTool } from "./definitions/readCurrentlyOpenFile"; import { readFileTool } from "./definitions/readFile"; +import { requestRuleTool } from "./definitions/requestRule"; import { runTerminalCommandTool } from "./definitions/runTerminalCommand"; import { searchWebTool } from "./definitions/searchWeb"; import { viewDiffTool } from "./definitions/viewDiff"; -export const allTools = [ +export const baseToolDefinitions = [ readFileTool, editFileTool, createNewFileTool, @@ -26,3 +28,7 @@ export const allTools = [ // viewSubdirectoryTool, // viewRepoMapTool, ]; + +export const getConfigDependentToolDefinitions = ( + params: ConfigDependentToolParams, +): Tool[] => [requestRuleTool(params)]; diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index b9981e11f..533553649 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension pluginName=continue-intellij-extension pluginRepositoryUrl=https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion=1.0.19 +pluginVersion=1.0.21 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild=223 # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt index 357757fe0..0ee4c2bd0 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt @@ -132,18 +132,18 @@ class GetTheme { val inputPlaceholder = namedColor("TextField.inactiveForeground") val listHoverBackground = namedColor("List.hoverBackground") ?: slightChange(background) - val actionHoverBackground = namedColor("ActionButton.hoverBackground") ?: namedColor("Button.darcula.hoverBackground") + val listHoverForeground = namedColor("List.hoverForeground") ?: slightChange(foreground) - val tableOddRow = namedColor("Table.hoverBackground") ?: namedColor("Table.stripeColor") - val listSelectionForeground = namedColor("List.selectionForeground") + val tableOddRow = namedColor("Table.hoverBackground") ?: namedColor("Table.stripeColor") - val description = namedColor("Label.disabledForeground") ?: namedColor("Label.infoForeground") + val description = namedColor("Label.infoForeground") ?: namedColor("Label.disabledForeground") ?: foreground val mutedDescription = namedColor("Component.infoForeground") ?: namedColor("ContextHelp.foreground") ?: namedColor("TextField.placeholderForeground") ?: namedColor("Label.disabledForeground") ?: namedColor("ToolTip.foreground") + ?: description val link = namedColor("Link.activeForeground") @@ -201,8 +201,8 @@ class GetTheme { "find-match" to findMatchBackground, "find-match-selected" to findMatchSelectedBackground, "list-hover" to listHoverBackground, - "list-active" to actionHoverBackground, - "list-active-foreground" to listSelectionForeground + "list-active" to listHoverBackground, + "list-active-foreground" to listHoverForeground ).mapValues { toHex(it.value) } return theme } catch (error: Error) { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt index d0527313a..7b146316b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt @@ -504,10 +504,16 @@ class IdeProtocolClient( val editor = EditorUtils.getEditor(project) val rif = editor?.getHighlightedRIF() ?: return + val serializedRif = com.github.continuedev.continueintellijextension.RangeInFileWithContents( + filepath = rif.filepath, + range = rif.range, + contents = rif.contents + ) + continuePluginService.sendToWebview( "highlightedCode", HighlightedCodePayload( - rangeInFileWithContents = rif, + rangeInFileWithContents = serializedRif, shouldRun = edit ) ) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt index 86862a096..c12ab1b82 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt @@ -232,7 +232,7 @@ data class ApplyState( ) data class HighlightedCodePayload( - val rangeInFileWithContents: RangeInFileWithContents, + val rangeInFileWithContents: com.github.continuedev.continueintellijextension.RangeInFileWithContents, val prompt: String? = null, val shouldRun: Boolean? = null ) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 5634027da..f2db4b382 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.39", + "version": "1.1.40", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.39", + "version": "1.1.40", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", @@ -110,7 +110,7 @@ "@continuedev/fetch": "^1.0.10", "@continuedev/llm-info": "^1.0.8", "@continuedev/openai-adapters": "^1.0.25", - "@modelcontextprotocol/sdk": "^1.5.0", + "@modelcontextprotocol/sdk": "^1.12.0", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.1.1", "@typescript-eslint/eslint-plugin": "^7.8.0", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 101b3de67..c33561f1f 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.1.40", + "version": "1.1.41", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" diff --git a/gui/src/components/ModeSelect/ModeSelect.tsx b/gui/src/components/ModeSelect/ModeSelect.tsx index 22a9975ca..75046e476 100644 --- a/gui/src/components/ModeSelect/ModeSelect.tsx +++ b/gui/src/components/ModeSelect/ModeSelect.tsx @@ -72,7 +72,7 @@ export function ModeSelect() {
diff --git a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx index 07ec23c56..75c0f0725 100644 --- a/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/mcp/MCPSection.tsx @@ -113,11 +113,15 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) { data-tooltip-id={resourcesTooltipId} > - {server.resources.length} + + {server.resources.length + server.resourceTemplates.length} + - {server.resources.map((resource, idx) => ( - {resource.name} - ))} + {[...server.resources, ...server.resourceTemplates].map( + (resource, idx) => ( + {resource.name} + ), + )} {server.resources.length === 0 && ( No resources )} diff --git a/gui/src/components/ui/Listbox.tsx b/gui/src/components/ui/Listbox.tsx index 1659a06b6..c03efa848 100644 --- a/gui/src/components/ui/Listbox.tsx +++ b/gui/src/components/ui/Listbox.tsx @@ -72,7 +72,7 @@ const ListboxOption = React.forwardRef( ref={ref} {...props} className={cn( - "text-vsc-foreground flex select-none flex-row items-center justify-between px-2 py-1", + "text-foreground flex select-none flex-row items-center justify-between px-2 py-1", props.disabled ? "opacity-50" : "background-transparent hover:bg-list-active hover:text-list-active-foreground cursor-pointer opacity-100", diff --git a/gui/src/pages/config/AccountButton.tsx b/gui/src/pages/config/AccountButton.tsx index 2d6d06b4f..d30e638a0 100644 --- a/gui/src/pages/config/AccountButton.tsx +++ b/gui/src/pages/config/AccountButton.tsx @@ -1,6 +1,6 @@ import { UserCircleIcon } from "@heroicons/react/24/solid"; -import { isHubSession } from "core/control-plane/AuthTypes"; +import { isOnPremSession } from "core/control-plane/AuthTypes"; import { SecondaryButton } from "../../components"; import { Popover, @@ -29,7 +29,7 @@ export function AccountButton() { } // No login button for on-prem deployments - if (!isHubSession(session)) { + if (isOnPremSession(session)) { return null; } diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 75fb48c4b..c3e8ac512 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -333,17 +333,16 @@ export function Chat() { "assistant" && item.message.toolCalls && item.toolCallState ? ( -
+
{item.message.toolCalls?.map((toolCall, i) => { return ( -
- -
+ ); })}
diff --git a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx index 3342eabda..07b7838a7 100644 --- a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx +++ b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx @@ -1,8 +1,8 @@ -import { ChevronDownIcon, ChevronRightIcon } from "@heroicons/react/24/outline"; +import { ChevronRightIcon } from "@heroicons/react/24/outline"; import { ContextItemWithId, Tool, ToolCallState } from "core"; import { ComponentType, useMemo, useState } from "react"; import { ContextItemsPeekItem } from "../../../components/mainInput/belowMainInput/ContextItemsPeek"; -import { ArgsItems } from "./ToolCallArgs"; +import { ArgsItems, ArgsToggleIcon } from "./ToolCallArgs"; import { ToolCallStatusMessage } from "./ToolCallStatusMessage"; interface SimpleToolCallUIProps { @@ -32,49 +32,35 @@ export function SimpleToolCallUI({ }, [toolCallState.parsedArgs]); return ( -
-
+
+
setOpen((prev) => !prev)} onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} data-testid="context-items-peek" > -
+
{Icon && !isHovered && !open ? ( - + ) : ( - <> - - - + )}
- - - +
- {/*
- {args.length > 0 ? ( - - ) : null} -
*/} + {args.length > 0 ? ( + + ) : null}
)) ) : ( -
+
No tool call output
)} diff --git a/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx b/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx index 6f313236d..dcfd186c7 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx @@ -24,22 +24,20 @@ export function ToolCallDisplay({ return ( <> -
+
-
-
+
+
{icon}
{tool?.faviconUrl && ( )} -
- -
+
{!!args.length ? ( - - {/* {`{}`} */} +
{isShowing ? "Hide args" : "Show args"} @@ -52,11 +51,13 @@ export const ArgsItems = ({ args, isShowing }: ArgsItemsProps) => { } return ( -
+
{args.map(([key, value]) => (
{key}: - {value.toString()} + + {JSON.stringify(value)} +
))}
diff --git a/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx b/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx index 7a25a7605..40a5f06ef 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx @@ -1,7 +1,5 @@ import { Tool, ToolCallState } from "core"; import Mustache from "mustache"; -import { ReactNode } from "react"; -import { getFontSize } from "../../../util"; import { useFontSize } from "../../../components/ui/font"; interface ToolCallStatusMessageProps { @@ -16,35 +14,26 @@ export function ToolCallStatusMessage({ const fontSize = useFontSize(); if (!tool) return "Agent tool use"; - const defaultToolDescription = ( - <> - {tool.displayTitle ?? tool.function.name} tool - - ); + const toolName = tool.displayTitle ?? tool.function.name; + const defaultToolDescription = `${toolName} tool`; - const futureMessage = tool.wouldLikeTo ? ( - Mustache.render(tool.wouldLikeTo, toolCallState.parsedArgs) - ) : ( - <> - use the {defaultToolDescription} - - ); + const futureMessage: string = tool.wouldLikeTo + ? Mustache.render(tool.wouldLikeTo, toolCallState.parsedArgs) + : `use the ${defaultToolDescription}`; + // TODO go back and replace arg string values and tool names with tags + // to make them more readable let intro = ""; - let message: ReactNode = ""; + let message = ""; if ( toolCallState.status === "done" || (tool.isInstant && toolCallState.status === "calling") ) { intro = ""; - message = tool.hasAlready ? ( - Mustache.render(tool.hasAlready, toolCallState.parsedArgs) - ) : ( - <> - used the {defaultToolDescription} - - ); + message = tool.hasAlready + ? Mustache.render(tool.hasAlready, toolCallState.parsedArgs) + : `used the ${defaultToolDescription}`; } else if (toolCallState.status === "generating") { intro = "is generating output to"; message = futureMessage; @@ -53,13 +42,9 @@ export function ToolCallStatusMessage({ message = futureMessage; } else if (toolCallState.status === "calling") { intro = "is"; - message = tool.isCurrently ? ( - Mustache.render(tool.isCurrently, toolCallState.parsedArgs) - ) : ( - <> - calling the {defaultToolDescription} - - ); + message = tool.isCurrently + ? Mustache.render(tool.isCurrently, toolCallState.parsedArgs) + : `calling the ${defaultToolDescription}`; } else if ( toolCallState.status === "canceled" || toolCallState.status === "errored" @@ -68,8 +53,12 @@ export function ToolCallStatusMessage({ message = futureMessage; } return ( -
- Continue {intro} {message} +
+ {`Continue ${intro} ${message}`}
); } diff --git a/gui/src/pages/gui/ToolCallDiv/index.tsx b/gui/src/pages/gui/ToolCallDiv/index.tsx index 39d14cd0a..c919c0ca1 100644 --- a/gui/src/pages/gui/ToolCallDiv/index.tsx +++ b/gui/src/pages/gui/ToolCallDiv/index.tsx @@ -80,16 +80,14 @@ export function ToolCallDiv(props: ToolCallDivProps) { if (icon) { return ( -
- -
+ ); } diff --git a/gui/src/redux/slices/uiSlice.ts b/gui/src/redux/slices/uiSlice.ts index 4105d3319..b8961a0b1 100644 --- a/gui/src/redux/slices/uiSlice.ts +++ b/gui/src/redux/slices/uiSlice.ts @@ -56,6 +56,7 @@ export const uiSlice = createSlice({ [BuiltInToolNames.ViewDiff]: "allowedWithoutPermission", [BuiltInToolNames.LSTool]: "allowedWithoutPermission", [BuiltInToolNames.CreateRuleBlock]: "allowedWithPermission", + [BuiltInToolNames.RequestRule]: "disabled", }, toolGroupSettings: { [BUILT_IN_GROUP_NAME]: "include", diff --git a/gui/src/redux/thunks/callCurrentTool.ts b/gui/src/redux/thunks/callCurrentTool.ts index f6f408238..84270fdd8 100644 --- a/gui/src/redux/thunks/callCurrentTool.ts +++ b/gui/src/redux/thunks/callCurrentTool.ts @@ -1,6 +1,6 @@ import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; import { ContextItem } from "core"; -import { CLIENT_TOOLS } from "core/tools/builtIn"; +import { CLIENT_TOOLS_IMPLS } from "core/tools/builtIn"; import { callClientTool } from "../../util/clientTools/callClientTool"; import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; import { selectSelectedChatModel } from "../slices/configSlice"; @@ -51,7 +51,7 @@ export const callCurrentTool = createAsyncThunk( // Errors that occur outside specifically calling the tool // Should not be caught here - should be handled as normal stream errors if ( - CLIENT_TOOLS.find( + CLIENT_TOOLS_IMPLS.find( (toolName) => toolName === toolCallState.toolCall.function.name, ) ) {