mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-12 23:01:21 +00:00
refactor: improve type safety for fetch_instructions tool
- Export FetchInstructionsToolDirective type from tool-directives index - Add FetchInstructionsToolDirective to main directives exports - Update fetchInstructionsTool function to use specific type instead of generic ToolDirective - Add proper type import in presentAssistantMessage for fetch_instructions handling This improves type safety and makes the codebase more maintainable by using specific types instead of generic ones.
This commit is contained in:
parent
bfd5cd780e
commit
259643c10e
4 changed files with 12 additions and 4 deletions
|
|
@ -20,6 +20,7 @@ export type {
|
|||
SwitchModeToolDirective,
|
||||
NewTaskToolDirective,
|
||||
SearchAndReplaceToolDirective,
|
||||
FetchInstructionsToolDirective,
|
||||
} from "./tool-directives"
|
||||
export { type LogDirective, logLevels } from "./LogDirective"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ 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 { FetchInstructionsToolDirective } from "./FetchInstructionsToolDirective"
|
||||
export type { WriteToFileToolDirective } from "./WriteToFileToolDirective"
|
||||
export type { InsertCodeBlockToolDirective } from "./InsertCodeBlockToolDirective"
|
||||
export type { CodebaseSearchToolDirective } from "./CodebaseSearchToolDirective"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import type {
|
|||
NewTaskToolDirective,
|
||||
AttemptCompletionToolDirective,
|
||||
BrowserActionToolDirective,
|
||||
FetchInstructionsToolDirective,
|
||||
} from "./directives"
|
||||
|
||||
import { defaultModeSlug, getModeBySlug } from "../../shared/modes"
|
||||
|
|
@ -504,7 +505,13 @@ export async function presentAssistantMessage(cline: Task) {
|
|||
|
||||
break
|
||||
case "fetch_instructions":
|
||||
await fetchInstructionsTool(cline, block, askApproval, handleError, pushToolResult)
|
||||
await fetchInstructionsTool(
|
||||
cline,
|
||||
block as FetchInstructionsToolDirective,
|
||||
askApproval,
|
||||
handleError,
|
||||
pushToolResult,
|
||||
)
|
||||
break
|
||||
case "list_files":
|
||||
await listFilesTool(
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ import { fetchInstructions } from "../prompts/instructions/instructions"
|
|||
import { ClineSayTool } from "../../shared/ExtensionMessage"
|
||||
import { formatResponse } from "../prompts/responses"
|
||||
import { AskApproval, HandleError, PushToolResult } from "../../shared/tools"
|
||||
import { ToolDirective } from "../message-parsing/directives"
|
||||
import { FetchInstructionsToolDirective } from "../message-parsing/directives"
|
||||
|
||||
export async function fetchInstructionsTool(
|
||||
cline: Task,
|
||||
block: ToolDirective,
|
||||
block: FetchInstructionsToolDirective,
|
||||
askApproval: AskApproval,
|
||||
handleError: HandleError,
|
||||
pushToolResult: PushToolResult,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue