summaryrefslogtreecommitdiff
path: root/packages/cli/src
diff options
context:
space:
mode:
authorTaylor Mullen <[email protected]>2025-04-20 22:10:23 -0400
committerN. Taylor Mullen <[email protected]>2025-04-20 22:13:55 -0400
commit63f864cdd79a0357ec1e0474586fb00a0ec7d91b (patch)
tree4f70dd65b2cd0eef5e147fa514488ba259a327e6 /packages/cli/src
parentc095091853b70affdd9cf2cc6cc590451c658c1f (diff)
Fix read-file from exploding with path not found error.
- There were a few hiccups here. Somehow 2.5-flash wasn't actually abiding by our tool schema. Instead it was inferring `path`. To semi-combat this I've renamed `file_path` -> `path`. - We weren't elevating errors that were created via schema validation. Instead both the `glob` and `read-file.ts` now surface this. - In error scenarios (like failing schema) we were improperly surfacing these as success cases because we were overriding tool status.
Diffstat (limited to 'packages/cli/src')
-rw-r--r--packages/cli/src/tools/read-file.tool.ts5
-rw-r--r--packages/cli/src/ui/hooks/useGeminiStream.ts13
2 files changed, 13 insertions, 5 deletions
diff --git a/packages/cli/src/tools/read-file.tool.ts b/packages/cli/src/tools/read-file.tool.ts
index bbf9eafb..206267be 100644
--- a/packages/cli/src/tools/read-file.tool.ts
+++ b/packages/cli/src/tools/read-file.tool.ts
@@ -38,8 +38,7 @@ export class ReadFileTool extends BaseTool<ReadFileToolParams, ToolResult> {
* Delegates validation to the core logic
*/
validateToolParams(_params: ReadFileToolParams): string | null {
- // Currently allowing any path. Add validation if needed.
- return null;
+ return this.coreLogic.validateToolParams(_params);
}
/**
@@ -62,7 +61,7 @@ export class ReadFileTool extends BaseTool<ReadFileToolParams, ToolResult> {
/**
* Delegates execution to the core logic
*/
- async execute(params: ReadFileToolParams): Promise<ToolResult> {
+ execute(params: ReadFileToolParams): Promise<ToolResult> {
return this.coreLogic.execute(params);
}
}
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts
index 6e3e8e84..21a9f508 100644
--- a/packages/cli/src/ui/hooks/useGeminiStream.ts
+++ b/packages/cli/src/ui/hooks/useGeminiStream.ts
@@ -330,7 +330,13 @@ export const useGeminiStream = (
...item,
tools: item.tools.map((tool) =>
tool.callId === callId
- ? { ...tool, status: ToolCallStatus.Invoked }
+ ? {
+ ...tool,
+ status:
+ tool.status === ToolCallStatus.Error
+ ? ToolCallStatus.Error
+ : ToolCallStatus.Invoked,
+ }
: tool,
),
};
@@ -362,7 +368,10 @@ export const useGeminiStream = (
tool.callId === callId
? {
...tool,
- status: ToolCallStatus.Success,
+ status:
+ tool.status === ToolCallStatus.Error
+ ? ToolCallStatus.Error
+ : ToolCallStatus.Success,
resultDisplay: result.returnDisplay,
}
: tool,