Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions apps/cli/src/ui/components/tools/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,7 @@ export type ToolCategory =
| "other"

export function getToolCategory(toolName: string): ToolCategory {
const fileReadTools = [
"readFile",
"read_file",
"fetchInstructions",
"fetch_instructions",
"listFilesTopLevel",
"listFilesRecursive",
"list_files",
]
const fileReadTools = ["readFile", "read_file", "skill", "listFilesTopLevel", "listFilesRecursive", "list_files"]

const fileWriteTools = [
"editedExistingFile",
Expand Down
6 changes: 2 additions & 4 deletions apps/cli/src/ui/components/tools/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ export function getToolDisplayName(toolName: string): string {
// File read operations
readFile: "Read",
read_file: "Read",
fetchInstructions: "Fetch Instructions",
fetch_instructions: "Fetch Instructions",
skill: "Load Skill",
listFilesTopLevel: "List Files",
listFilesRecursive: "List Files (Recursive)",
list_files: "List Files",
Expand Down Expand Up @@ -107,8 +106,7 @@ export function getToolIconName(toolName: string): IconName {
// File read operations
readFile: "file",
read_file: "file",
fetchInstructions: "file",
fetch_instructions: "file",
skill: "file",
listFilesTopLevel: "folder",
listFilesRecursive: "folder",
list_files: "folder",
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/global-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ export const globalSettingsSchema = z.object({
telemetrySetting: telemetrySettingsSchema.optional(),

mcpEnabled: z.boolean().optional(),
enableMcpServerCreation: z.boolean().optional(),

mode: z.string().optional(),
modeApiConfigs: z.record(z.string(), z.string()).optional(),
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export const toolNames = [
"attempt_completion",
"switch_mode",
"new_task",
"fetch_instructions",
"codebase_search",
"update_todo_list",
"run_slash_command",
"skill",
"generate_image",
"custom_tool",
] as const
Expand Down
6 changes: 3 additions & 3 deletions packages/types/src/vscode-extension-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ export type ExtensionState = Pick<
experiments: Experiments // Map of experiment IDs to their enabled state

mcpEnabled: boolean
enableMcpServerCreation: boolean

mode: string
customModes: ModeConfig[]
Expand Down Expand Up @@ -499,7 +498,6 @@ export interface WebviewMessage {
| "deleteMessageConfirm"
| "submitEditedMessage"
| "editMessageConfirm"
| "enableMcpServerCreation"
| "remoteControlEnabled"
| "taskSyncEnabled"
| "searchCommits"
Expand Down Expand Up @@ -779,7 +777,6 @@ export interface ClineSayTool {
| "codebaseSearch"
| "readFile"
| "readCommandOutput"
| "fetchInstructions"
| "listFilesTopLevel"
| "listFilesRecursive"
| "searchFiles"
Expand All @@ -790,6 +787,7 @@ export interface ClineSayTool {
| "imageGenerated"
| "runSlashCommand"
| "updateTodoList"
| "skill"
path?: string
// For readCommandOutput
readStart?: number
Expand Down Expand Up @@ -836,6 +834,8 @@ export interface ClineSayTool {
args?: string
source?: string
description?: string
// Properties for skill tool
skill?: string
}

// Must keep in sync with system prompt.
Expand Down
34 changes: 18 additions & 16 deletions src/core/assistant-message/NativeToolCallParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,14 +449,6 @@ export class NativeToolCallParser {
}
break

case "fetch_instructions":
if (partialArgs.task !== undefined) {
nativeArgs = {
task: partialArgs.task,
}
}
break

case "generate_image":
if (partialArgs.prompt !== undefined || partialArgs.path !== undefined) {
nativeArgs = {
Expand All @@ -476,6 +468,15 @@ export class NativeToolCallParser {
}
break

case "skill":
if (partialArgs.skill !== undefined) {
nativeArgs = {
skill: partialArgs.skill,
args: partialArgs.args,
}
}
break

case "search_files":
if (partialArgs.path !== undefined || partialArgs.regex !== undefined) {
nativeArgs = {
Expand Down Expand Up @@ -736,14 +737,6 @@ export class NativeToolCallParser {
}
break

case "fetch_instructions":
if (args.task !== undefined) {
nativeArgs = {
task: args.task,
} as NativeArgsFor<TName>
}
break

case "generate_image":
if (args.prompt !== undefined && args.path !== undefined) {
nativeArgs = {
Expand All @@ -763,6 +756,15 @@ export class NativeToolCallParser {
}
break

case "skill":
if (args.skill !== undefined) {
nativeArgs = {
skill: args.skill,
args: args.args,
} as NativeArgsFor<TName>
}
break

case "search_files":
if (args.path !== undefined && args.regex !== undefined) {
nativeArgs = {
Expand Down
21 changes: 10 additions & 11 deletions src/core/assistant-message/presentAssistantMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type { ToolParamName, ToolResponse, ToolUse, McpToolUse } from "../../sha
import { AskIgnoredError } from "../task/AskIgnoredError"
import { Task } from "../task/Task"

import { fetchInstructionsTool } from "../tools/FetchInstructionsTool"
import { listFilesTool } from "../tools/ListFilesTool"
import { readFileTool } from "../tools/ReadFileTool"
import { readCommandOutputTool } from "../tools/ReadCommandOutputTool"
Expand All @@ -34,6 +33,7 @@ import { attemptCompletionTool, AttemptCompletionCallbacks } from "../tools/Atte
import { newTaskTool } from "../tools/NewTaskTool"
import { updateTodoListTool } from "../tools/UpdateTodoListTool"
import { runSlashCommandTool } from "../tools/RunSlashCommandTool"
import { skillTool } from "../tools/SkillTool"
import { generateImageTool } from "../tools/GenerateImageTool"
import { applyDiffTool as applyDiffToolClass } from "../tools/ApplyDiffTool"
import { isValidToolName, validateToolUse } from "../tools/validateToolUse"
Expand Down Expand Up @@ -370,8 +370,6 @@ export async function presentAssistantMessage(cline: Task) {
return readFileTool.getReadFileToolDescription(block.name, block.nativeArgs)
}
return readFileTool.getReadFileToolDescription(block.name, block.params)
case "fetch_instructions":
return `[${block.name} for '${block.params.task}']`
case "write_to_file":
return `[${block.name} for '${block.params.path}']`
case "apply_diff":
Expand Down Expand Up @@ -417,6 +415,8 @@ export async function presentAssistantMessage(cline: Task) {
}
case "run_slash_command":
return `[${block.name} for '${block.params.command}'${block.params.args ? ` with args: ${block.params.args}` : ""}]`
case "skill":
return `[${block.name} for '${block.params.skill}'${block.params.args ? ` with args: ${block.params.args}` : ""}]`
case "generate_image":
return `[${block.name} for '${block.params.path}']`
default:
Expand Down Expand Up @@ -805,13 +805,6 @@ export async function presentAssistantMessage(cline: Task) {
pushToolResult,
})
break
case "fetch_instructions":
await fetchInstructionsTool.handle(cline, block as ToolUse<"fetch_instructions">, {
askApproval,
handleError,
pushToolResult,
})
break
case "list_files":
await listFilesTool.handle(cline, block as ToolUse<"list_files">, {
askApproval,
Expand Down Expand Up @@ -915,6 +908,13 @@ export async function presentAssistantMessage(cline: Task) {
pushToolResult,
})
break
case "skill":
await skillTool.handle(cline, block as ToolUse<"skill">, {
askApproval,
handleError,
pushToolResult,
})
break
case "generate_image":
await checkpointSaveAndMark(cline)
await generateImageTool.handle(cline, block as ToolUse<"generate_image">, {
Expand Down Expand Up @@ -1094,7 +1094,6 @@ function containsXmlToolMarkup(text: string): boolean {
"codebase_search",
"edit_file",
"execute_command",
"fetch_instructions",
"generate_image",
"list_files",
"new_task",
Expand Down
13 changes: 5 additions & 8 deletions src/core/auto-approval/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,11 @@ export async function checkAutoApproval({
return { decision: "approve" }
}

if (tool?.tool === "fetchInstructions") {
if (tool.content === "create_mode") {
return state.alwaysAllowModeSwitch === true ? { decision: "approve" } : { decision: "ask" }
}

if (tool.content === "create_mcp_server") {
return state.alwaysAllowMcp === true ? { decision: "approve" } : { decision: "ask" }
}
// The skill tool only loads pre-defined instructions from built-in, global, or project skills.
// It does not read arbitrary files - skills must be explicitly installed/defined by the user.
// Auto-approval is intentional to provide a seamless experience when loading task instructions.
if (tool.tool === "skill") {
return { decision: "approve" }
}

if (tool?.tool === "switchMode") {
Expand Down
4 changes: 0 additions & 4 deletions src/core/prompts/__tests__/add-custom-instructions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ describe("addCustomInstructions", () => {
undefined, // customModes
undefined, // globalCustomInstructions
undefined, // experiments
true, // enableMcpServerCreation
undefined, // language
undefined, // rooIgnoreInstructions
undefined, // partialReadsEnabled
Expand All @@ -233,7 +232,6 @@ describe("addCustomInstructions", () => {
undefined, // customModes
undefined, // globalCustomInstructions
undefined, // experiments
true, // enableMcpServerCreation
undefined, // language
undefined, // rooIgnoreInstructions
undefined, // partialReadsEnabled
Expand All @@ -257,7 +255,6 @@ describe("addCustomInstructions", () => {
undefined, // customModes,
undefined, // globalCustomInstructions
undefined, // experiments
false, // enableMcpServerCreation
undefined, // language
undefined, // rooIgnoreInstructions
undefined, // partialReadsEnabled
Expand All @@ -280,7 +277,6 @@ describe("addCustomInstructions", () => {
undefined, // customModes,
undefined, // globalCustomInstructions
undefined, // experiments
true, // enableMcpServerCreation
undefined, // language
undefined, // rooIgnoreInstructions
true, // partialReadsEnabled
Expand Down
3 changes: 0 additions & 3 deletions src/core/prompts/__tests__/custom-system-prompt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ describe("File-Based Custom System Prompt", () => {
undefined, // customModes
undefined, // globalCustomInstructions
undefined, // experiments
true, // enableMcpServerCreation
undefined, // language
undefined, // rooIgnoreInstructions
undefined, // partialReadsEnabled
Expand Down Expand Up @@ -142,7 +141,6 @@ describe("File-Based Custom System Prompt", () => {
undefined, // customModes
undefined, // globalCustomInstructions
undefined, // experiments
true, // enableMcpServerCreation
undefined, // language
undefined, // rooIgnoreInstructions
undefined, // partialReadsEnabled
Expand Down Expand Up @@ -187,7 +185,6 @@ describe("File-Based Custom System Prompt", () => {
undefined, // customModes
undefined, // globalCustomInstructions
undefined, // experiments
true, // enableMcpServerCreation
undefined, // language
undefined, // rooIgnoreInstructions
undefined, // partialReadsEnabled
Expand Down
Loading
Loading