diff options
| author | joshualitt <[email protected]> | 2025-08-06 10:50:02 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-06 17:50:02 +0000 |
| commit | 6133bea388a2de69c71a6be6f1450707f2ce4dfb (patch) | |
| tree | 367de1d618069ea80e47d7e86c4fb8f82ad032a7 /packages/cli/src/ui/hooks/atCommandProcessor.ts | |
| parent | 882a97aff998b2f19731e9966d135f1db5a59914 (diff) | |
feat(core): Introduce `DeclarativeTool` and `ToolInvocation`. (#5613)
Diffstat (limited to 'packages/cli/src/ui/hooks/atCommandProcessor.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/atCommandProcessor.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/packages/cli/src/ui/hooks/atCommandProcessor.ts b/packages/cli/src/ui/hooks/atCommandProcessor.ts index 165b7b30..cef2f811 100644 --- a/packages/cli/src/ui/hooks/atCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/atCommandProcessor.ts @@ -8,6 +8,7 @@ import * as fs from 'fs/promises'; import * as path from 'path'; import { PartListUnion, PartUnion } from '@google/genai'; import { + AnyToolInvocation, Config, getErrorMessage, isNodeError, @@ -254,7 +255,7 @@ export async function handleAtCommand({ `Path ${pathName} not found directly, attempting glob search.`, ); try { - const globResult = await globTool.execute( + const globResult = await globTool.buildAndExecute( { pattern: `**/*${pathName}*`, path: dir, @@ -411,12 +412,14 @@ export async function handleAtCommand({ }; let toolCallDisplay: IndividualToolCallDisplay; + let invocation: AnyToolInvocation | undefined = undefined; try { - const result = await readManyFilesTool.execute(toolArgs, signal); + invocation = readManyFilesTool.build(toolArgs); + const result = await invocation.execute(signal); toolCallDisplay = { callId: `client-read-${userMessageTimestamp}`, name: readManyFilesTool.displayName, - description: readManyFilesTool.getDescription(toolArgs), + description: invocation.getDescription(), status: ToolCallStatus.Success, resultDisplay: result.returnDisplay || @@ -466,7 +469,9 @@ export async function handleAtCommand({ toolCallDisplay = { callId: `client-read-${userMessageTimestamp}`, name: readManyFilesTool.displayName, - description: readManyFilesTool.getDescription(toolArgs), + description: + invocation?.getDescription() ?? + 'Error attempting to execute tool to read files', status: ToolCallStatus.Error, resultDisplay: `Error reading files (${contentLabelsForDisplay.join(', ')}): ${getErrorMessage(error)}`, confirmationDetails: undefined, |
