mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Refactor: Move tool directives to individual files in tool-directives directory
This commit is contained in:
parent
d08b0d300d
commit
d5ac15923a
31 changed files with 264 additions and 146 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import { TextDirective, Directive, LogDirective, ToolDirective } from "./directives"
|
||||
import { ToolParamName } from "../../shared/tools"
|
||||
import { TextDirective, Directive, LogDirective, ToolDirective, ToolParamName } from "./directives"
|
||||
|
||||
export interface ParsingState {
|
||||
contentBlocks: Directive[]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { ToolName } from "@roo-code/types"
|
||||
import { ToolParamName } from "../../../shared/tools"
|
||||
import { ToolParamName } from "./tool-directives"
|
||||
|
||||
export interface ToolDirective {
|
||||
type: "tool_use"
|
||||
|
|
|
|||
|
|
@ -2,3 +2,6 @@ export type { Directive } from "./Directive"
|
|||
export type { TextDirective } from "./TextDirective"
|
||||
export type { ToolDirective } from "./ToolDirective"
|
||||
export type { LogDirective } from "./LogDirective"
|
||||
export type { ToolParamName, ToolResponse } from "./tool-directives"
|
||||
|
||||
export { toolParamNames } from "./tool-directives"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for accessing a resource provided by an MCP server.
|
||||
*/
|
||||
export interface AccessMcpResourceToolDirective extends ToolDirective {
|
||||
name: "access_mcp_resource"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "server_name" | "uri">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for asking a follow-up question to the user.
|
||||
*/
|
||||
export interface AskFollowupQuestionToolDirective extends ToolDirective {
|
||||
name: "ask_followup_question"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "question" | "follow_up">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for attempting to complete a task.
|
||||
*/
|
||||
export interface AttemptCompletionToolDirective extends ToolDirective {
|
||||
name: "attempt_completion"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "result" | "command">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for performing browser actions.
|
||||
*/
|
||||
export interface BrowserActionToolDirective extends ToolDirective {
|
||||
name: "browser_action"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "action" | "url" | "coordinate" | "text" | "size">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for searching the codebase.
|
||||
*/
|
||||
export interface CodebaseSearchToolDirective extends ToolDirective {
|
||||
name: "codebase_search"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "query" | "path">>
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for executing a command on the system.
|
||||
*/
|
||||
export interface ExecuteCommandToolDirective extends ToolDirective {
|
||||
name: "execute_command"
|
||||
// Pick<Record<ToolParamName, string>, "command"> makes "command" required, but Partial<> makes it optional
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "command" | "cwd">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for fetching instructions to perform a task.
|
||||
*/
|
||||
export interface FetchInstructionsToolDirective extends ToolDirective {
|
||||
name: "fetch_instructions"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "task">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for inserting content into a file at a specific line.
|
||||
*/
|
||||
export interface InsertCodeBlockToolDirective extends ToolDirective {
|
||||
name: "insert_content"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "path" | "line" | "content">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for listing definition names from source code.
|
||||
*/
|
||||
export interface ListCodeDefinitionNamesToolDirective extends ToolDirective {
|
||||
name: "list_code_definition_names"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "path">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for listing files and directories.
|
||||
*/
|
||||
export interface ListFilesToolDirective extends ToolDirective {
|
||||
name: "list_files"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "path" | "recursive">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for creating a new task instance.
|
||||
*/
|
||||
export interface NewTaskToolDirective extends ToolDirective {
|
||||
name: "new_task"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "mode" | "message">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for reading the contents of a file.
|
||||
*/
|
||||
export interface ReadFileToolDirective extends ToolDirective {
|
||||
name: "read_file"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "args" | "path" | "start_line" | "end_line">>
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for searching and replacing text or patterns in a file.
|
||||
*/
|
||||
export interface SearchAndReplaceToolDirective extends ToolDirective {
|
||||
name: "search_and_replace"
|
||||
params: Required<Pick<Record<ToolParamName, string>, "path" | "search" | "replace">> &
|
||||
Partial<Pick<Record<ToolParamName, string>, "use_regex" | "ignore_case" | "start_line" | "end_line">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for performing a regex search across files.
|
||||
*/
|
||||
export interface SearchFilesToolDirective extends ToolDirective {
|
||||
name: "search_files"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "path" | "regex" | "file_pattern">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for switching to a different mode.
|
||||
*/
|
||||
export interface SwitchModeToolDirective extends ToolDirective {
|
||||
name: "switch_mode"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "mode_slug" | "reason">>
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* List of parameter names that can be used in tool directives.
|
||||
*/
|
||||
export const toolParamNames = [
|
||||
"command",
|
||||
"path",
|
||||
"content",
|
||||
"line_count",
|
||||
"regex",
|
||||
"file_pattern",
|
||||
"recursive",
|
||||
"action",
|
||||
"url",
|
||||
"coordinate",
|
||||
"text",
|
||||
"server_name",
|
||||
"tool_name",
|
||||
"arguments",
|
||||
"uri",
|
||||
"question",
|
||||
"result",
|
||||
"diff",
|
||||
"mode_slug",
|
||||
"reason",
|
||||
"line",
|
||||
"mode",
|
||||
"message",
|
||||
"cwd",
|
||||
"follow_up",
|
||||
"task",
|
||||
"size",
|
||||
"search",
|
||||
"replace",
|
||||
"use_regex",
|
||||
"ignore_case",
|
||||
"args",
|
||||
"start_line",
|
||||
"end_line",
|
||||
"query",
|
||||
"args",
|
||||
] as const
|
||||
|
||||
/**
|
||||
* Type representing a parameter name for tool directives.
|
||||
*/
|
||||
export type ToolParamName = (typeof toolParamNames)[number]
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import { Anthropic } from "@anthropic-ai/sdk"
|
||||
|
||||
/**
|
||||
* Type representing the response from a tool execution.
|
||||
*/
|
||||
export type ToolResponse = string | Array<Anthropic.TextBlockParam | Anthropic.ImageBlockParam>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for using a tool provided by an MCP server.
|
||||
*/
|
||||
export interface UseMcpToolToolDirective extends ToolDirective {
|
||||
name: "use_mcp_tool"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "server_name" | "tool_name" | "arguments">>
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { ToolDirective } from "../ToolDirective"
|
||||
import { ToolParamName } from "./ToolParamName"
|
||||
|
||||
/**
|
||||
* Directive for writing content to a file.
|
||||
*/
|
||||
export interface WriteToFileToolDirective extends ToolDirective {
|
||||
name: "write_to_file"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "path" | "content" | "line_count">>
|
||||
}
|
||||
21
src/core/message-parsing/directives/tool-directives/index.ts
Normal file
21
src/core/message-parsing/directives/tool-directives/index.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
export type { ToolResponse } from "./ToolResponse"
|
||||
export type { ToolParamName } from "./ToolParamName"
|
||||
export type { ExecuteCommandToolDirective } from "./ExecuteCommandToolDirective"
|
||||
export type { ReadFileToolDirective } from "./ReadFileToolDirective"
|
||||
export type { FetchInstructionsToolDirective } from "./FetchInstructionsToolDirective"
|
||||
export type { WriteToFileToolDirective } from "./WriteToFileToolDirective"
|
||||
export type { InsertCodeBlockToolDirective } from "./InsertCodeBlockToolDirective"
|
||||
export type { CodebaseSearchToolDirective } from "./CodebaseSearchToolDirective"
|
||||
export type { SearchFilesToolDirective } from "./SearchFilesToolDirective"
|
||||
export type { ListFilesToolDirective } from "./ListFilesToolDirective"
|
||||
export type { ListCodeDefinitionNamesToolDirective } from "./ListCodeDefinitionNamesToolDirective"
|
||||
export type { BrowserActionToolDirective } from "./BrowserActionToolDirective"
|
||||
export type { UseMcpToolToolDirective } from "./UseMcpToolToolDirective"
|
||||
export type { AccessMcpResourceToolDirective } from "./AccessMcpResourceToolDirective"
|
||||
export type { AskFollowupQuestionToolDirective } from "./AskFollowupQuestionToolDirective"
|
||||
export type { AttemptCompletionToolDirective } from "./AttemptCompletionToolDirective"
|
||||
export type { SwitchModeToolDirective } from "./SwitchModeToolDirective"
|
||||
export type { NewTaskToolDirective } from "./NewTaskToolDirective"
|
||||
export type { SearchAndReplaceToolDirective } from "./SearchAndReplaceToolDirective"
|
||||
|
||||
export { toolParamNames } from "./ToolParamName"
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
import * as sax from "sax"
|
||||
import { BaseDirectiveHandler } from "./BaseDirectiveHandler"
|
||||
import { ParseContext } from "../ParseContext"
|
||||
import { ToolParamName } from "../../../shared/tools"
|
||||
import { ToolDirective } from "../directives"
|
||||
import { ToolDirective, ToolParamName } from "../directives"
|
||||
|
||||
export class ToolDirectiveHandler extends BaseDirectiveHandler {
|
||||
readonly tagName: string
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { type ToolName, toolNames } from "@roo-code/types"
|
||||
import { TextDirective, ToolDirective } from "./directives"
|
||||
import { ToolParamName, toolParamNames } from "../../shared/tools"
|
||||
import { ToolParamName, toolParamNames } from "./directives"
|
||||
|
||||
export type AssistantMessageContent = TextDirective | ToolDirective
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@ import { serializeError } from "serialize-error"
|
|||
import type { ToolName, ClineAsk, ToolProgressStatus } from "@roo-code/types"
|
||||
import { TelemetryService } from "@roo-code/telemetry"
|
||||
|
||||
import type { LogDirective } from "./directives/LogDirective"
|
||||
import type { LogDirective, ToolParamName, ToolResponse } from "./directives"
|
||||
|
||||
import { defaultModeSlug, getModeBySlug } from "../../shared/modes"
|
||||
import type { ToolParamName, ToolResponse } from "../../shared/tools"
|
||||
|
||||
import { fetchInstructionsTool } from "../tools/fetchInstructionsTool"
|
||||
import { listFilesTool } from "../tools/listFilesTool"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ import { readLines } from "../../../integrations/misc/read-lines"
|
|||
import { extractTextFromFile } from "../../../integrations/misc/extract-text"
|
||||
import { parseSourceCodeDefinitionsForFile } from "../../../services/tree-sitter"
|
||||
import { isBinaryFile } from "isbinaryfile"
|
||||
import { ReadFileToolDirective, ToolParamName, ToolResponse } from "../../../shared/tools"
|
||||
import {
|
||||
ToolParamName,
|
||||
ToolResponse,
|
||||
ReadFileToolDirective,
|
||||
} from "../../../core/message-parsing/directives/tool-directives"
|
||||
import { readFileTool } from "../readFileTool"
|
||||
import { formatResponse } from "../../prompts/responses"
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,8 @@ import { isPathOutsideWorkspace } from "../../../utils/pathUtils"
|
|||
import { getReadablePath } from "../../../utils/path"
|
||||
import { unescapeHtmlEntities } from "../../../utils/text-normalization"
|
||||
import { everyLineHasLineNumbers, stripLineNumbers } from "../../../integrations/misc/extract-text"
|
||||
import { ToolResponse } from "../../../shared/tools"
|
||||
import { writeToFileTool } from "../writeToFileTool"
|
||||
import { ToolDirective } from "../../message-parsing/directives"
|
||||
import { ToolDirective, ToolResponse } from "../../message-parsing/directives"
|
||||
|
||||
jest.mock("path", () => {
|
||||
const originalPath = jest.requireActual("path")
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import { TelemetryService } from "@roo-code/telemetry"
|
|||
|
||||
import { Task } from "../task/Task"
|
||||
import {
|
||||
ToolResponse,
|
||||
AskApproval,
|
||||
HandleError,
|
||||
PushToolResult,
|
||||
|
|
@ -15,7 +14,7 @@ import {
|
|||
import { formatResponse } from "../prompts/responses"
|
||||
import { type ExecuteCommandOptions, executeCommand } from "./executeCommandTool"
|
||||
import { EXPERIMENT_IDS, experiments, experimentDefault } from "../../shared/experiments"
|
||||
import { ToolDirective } from "../message-parsing/directives"
|
||||
import { ToolDirective, ToolResponse } from "../message-parsing/directives"
|
||||
|
||||
export async function attemptCompletionTool(
|
||||
cline: Task,
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ import { TelemetryService } from "@roo-code/telemetry"
|
|||
|
||||
import { Task } from "../task/Task"
|
||||
|
||||
import { AskApproval, HandleError, PushToolResult, RemoveClosingTag, ToolResponse } from "../../shared/tools"
|
||||
import { AskApproval, HandleError, PushToolResult, RemoveClosingTag } from "../../shared/tools"
|
||||
import { formatResponse } from "../prompts/responses"
|
||||
import { unescapeHtmlEntities } from "../../utils/text-normalization"
|
||||
import { ExitCodeDetails, RooTerminalCallbacks, RooTerminalProcess } from "../../integrations/terminal/types"
|
||||
import { TerminalRegistry } from "../../integrations/terminal/TerminalRegistry"
|
||||
import { Terminal } from "../../integrations/terminal/Terminal"
|
||||
import { ToolDirective } from "../message-parsing/directives"
|
||||
import { ToolDirective, ToolResponse } from "../message-parsing/directives"
|
||||
|
||||
class ShellIntegrationError extends Error {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
import { Anthropic } from "@anthropic-ai/sdk"
|
||||
|
||||
import type { ClineAsk, ToolProgressStatus, ToolGroup, ToolName } from "@roo-code/types"
|
||||
import { ToolDirective } from "../core/message-parsing/directives/"
|
||||
|
||||
export type ToolResponse = string | Array<Anthropic.TextBlockParam | Anthropic.ImageBlockParam>
|
||||
import { ToolResponse } from "../core/message-parsing/directives/tool-directives"
|
||||
|
||||
export type AskApproval = (
|
||||
type: ClineAsk,
|
||||
|
|
@ -21,133 +18,7 @@ export type AskFinishSubTaskApproval = () => Promise<boolean>
|
|||
|
||||
export type ToolDescription = () => string
|
||||
|
||||
export const toolParamNames = [
|
||||
"command",
|
||||
"path",
|
||||
"content",
|
||||
"line_count",
|
||||
"regex",
|
||||
"file_pattern",
|
||||
"recursive",
|
||||
"action",
|
||||
"url",
|
||||
"coordinate",
|
||||
"text",
|
||||
"server_name",
|
||||
"tool_name",
|
||||
"arguments",
|
||||
"uri",
|
||||
"question",
|
||||
"result",
|
||||
"diff",
|
||||
"mode_slug",
|
||||
"reason",
|
||||
"line",
|
||||
"mode",
|
||||
"message",
|
||||
"cwd",
|
||||
"follow_up",
|
||||
"task",
|
||||
"size",
|
||||
"search",
|
||||
"replace",
|
||||
"use_regex",
|
||||
"ignore_case",
|
||||
"args",
|
||||
"start_line",
|
||||
"end_line",
|
||||
"query",
|
||||
"args",
|
||||
] as const
|
||||
|
||||
export type ToolParamName = (typeof toolParamNames)[number]
|
||||
|
||||
export interface ExecuteCommandToolDirective extends ToolDirective {
|
||||
name: "execute_command"
|
||||
// Pick<Record<ToolParamName, string>, "command"> makes "command" required, but Partial<> makes it optional
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "command" | "cwd">>
|
||||
}
|
||||
|
||||
export interface ReadFileToolDirective extends ToolDirective {
|
||||
name: "read_file"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "args" | "path" | "start_line" | "end_line">>
|
||||
}
|
||||
|
||||
export interface FetchInstructionsToolDirective extends ToolDirective {
|
||||
name: "fetch_instructions"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "task">>
|
||||
}
|
||||
|
||||
export interface WriteToFileToolDirective extends ToolDirective {
|
||||
name: "write_to_file"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "path" | "content" | "line_count">>
|
||||
}
|
||||
|
||||
export interface InsertCodeBlockToolDirective extends ToolDirective {
|
||||
name: "insert_content"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "path" | "line" | "content">>
|
||||
}
|
||||
|
||||
export interface CodebaseSearchToolDirective extends ToolDirective {
|
||||
name: "codebase_search"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "query" | "path">>
|
||||
}
|
||||
|
||||
export interface SearchFilesToolDirective extends ToolDirective {
|
||||
name: "search_files"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "path" | "regex" | "file_pattern">>
|
||||
}
|
||||
|
||||
export interface ListFilesToolDirective extends ToolDirective {
|
||||
name: "list_files"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "path" | "recursive">>
|
||||
}
|
||||
|
||||
export interface ListCodeDefinitionNamesToolDirective extends ToolDirective {
|
||||
name: "list_code_definition_names"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "path">>
|
||||
}
|
||||
|
||||
export interface BrowserActionToolDirective extends ToolDirective {
|
||||
name: "browser_action"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "action" | "url" | "coordinate" | "text" | "size">>
|
||||
}
|
||||
|
||||
export interface UseMcpToolToolDirective extends ToolDirective {
|
||||
name: "use_mcp_tool"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "server_name" | "tool_name" | "arguments">>
|
||||
}
|
||||
|
||||
export interface AccessMcpResourceToolDirective extends ToolDirective {
|
||||
name: "access_mcp_resource"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "server_name" | "uri">>
|
||||
}
|
||||
|
||||
export interface AskFollowupQuestionToolDirective extends ToolDirective {
|
||||
name: "ask_followup_question"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "question" | "follow_up">>
|
||||
}
|
||||
|
||||
export interface AttemptCompletionToolDirective extends ToolDirective {
|
||||
name: "attempt_completion"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "result" | "command">>
|
||||
}
|
||||
|
||||
export interface SwitchModeToolDirective extends ToolDirective {
|
||||
name: "switch_mode"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "mode_slug" | "reason">>
|
||||
}
|
||||
|
||||
export interface NewTaskToolDirective extends ToolDirective {
|
||||
name: "new_task"
|
||||
params: Partial<Pick<Record<ToolParamName, string>, "mode" | "message">>
|
||||
}
|
||||
|
||||
export interface SearchAndReplaceToolDirective extends ToolDirective {
|
||||
name: "search_and_replace"
|
||||
params: Required<Pick<Record<ToolParamName, string>, "path" | "search" | "replace">> &
|
||||
Partial<Pick<Record<ToolParamName, string>, "use_regex" | "ignore_case" | "start_line" | "end_line">>
|
||||
}
|
||||
import { toolParamNames, ToolParamName } from "../core/message-parsing/directives/tool-directives"
|
||||
|
||||
// Define tool group configuration
|
||||
export type ToolGroupConfig = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue