diff options
| author | Taylor Mullen <[email protected]> | 2025-04-21 10:53:11 -0400 |
|---|---|---|
| committer | N. Taylor Mullen <[email protected]> | 2025-04-21 11:07:09 -0400 |
| commit | 81f0f618f7ecc439e67447bf98065d87e22483c0 (patch) | |
| tree | 82851f180c8ba5263427e3586bc738590fc49153 /packages/cli/src/tools/web-fetch.tool.ts | |
| parent | e351baf10f06d2a1d1872bf2a6d7e9e709effed9 (diff) | |
Fix Gemini Code's (GC) smarts.
- The tl;dr; is that GC couldn't see what the user was saying when tool call events happened in response. The rason why this was happening was because we were instantly invoking tools that the model told us to invoke and then instantly re-requesting. This resulted in the bug because the genai APIs can't update the chat history before a full response has been completed (doesn't know how to update if it's incomplete).
- To address the above issue I had to do quite the large refactor. The gist is that now turns truly drive everything on the server (vs. a server client split). This ensured that when we got tool invocations we could control when/how re-requesting would happen and then also ensure that history was updated. This change also meant that the server would act as an event publisher to enable the client to react to events rather than try and weave in complex logic between the events.
- A BIG change that this changeset incudes is the removal of all of the CLI tools in favor of the server tools.
- Removed some dead code as part of this
- **NOTE: Confirmations are still broken (they were broken prior to this); however, I've set them up to be able to work in the future, I'll dot hat in a follow up to be less breaking to others.**
Fixes https://b.corp.google.com/issues/412320087
Diffstat (limited to 'packages/cli/src/tools/web-fetch.tool.ts')
| -rw-r--r-- | packages/cli/src/tools/web-fetch.tool.ts | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/packages/cli/src/tools/web-fetch.tool.ts b/packages/cli/src/tools/web-fetch.tool.ts deleted file mode 100644 index b543dd90..00000000 --- a/packages/cli/src/tools/web-fetch.tool.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @license - * Copyright 2025 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -// Import core logic and types from the server package -import { - WebFetchLogic, - WebFetchToolParams, - ToolResult, -} from '@gemini-code/server'; - -// Import CLI-specific base class and UI types -import { BaseTool } from './tools.js'; -import { ToolCallConfirmationDetails } from '../ui/types.js'; - -/** - * CLI wrapper for the WebFetch tool. - */ -export class WebFetchTool extends BaseTool<WebFetchToolParams, ToolResult> { - static readonly Name: string = WebFetchLogic.Name; // Use name from logic - - // Core logic instance from the server package - private coreLogic: WebFetchLogic; - - constructor() { - const coreLogicInstance = new WebFetchLogic(); - super( - WebFetchTool.Name, - 'WebFetch', // Define display name here - 'Fetches text content from a given URL. Handles potential network errors and non-success HTTP status codes.', // Define description here - (coreLogicInstance.schema.parameters as Record<string, unknown>) ?? {}, - ); - this.coreLogic = coreLogicInstance; - } - - validateToolParams(params: WebFetchToolParams): string | null { - // Delegate validation to core logic - return this.coreLogic.validateParams(params); - } - - getDescription(params: WebFetchToolParams): string { - // Delegate description generation to core logic - return this.coreLogic.getDescription(params); - } - - /** - * Define confirmation behavior (WebFetch likely doesn't need confirmation) - */ - async shouldConfirmExecute( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - params: WebFetchToolParams, - ): Promise<ToolCallConfirmationDetails | false> { - return Promise.resolve(false); - } - - /** - * Delegates execution to the core logic. - */ - async execute(params: WebFetchToolParams): Promise<ToolResult> { - return this.coreLogic.execute(params); - } -} |
