feat(tools): Centralize shell tool summarization (#4009)

This commit is contained in:
N. Taylor Mullen
2025-07-12 21:09:12 -07:00
committed by GitHub
parent 09a3b7d5e1
commit 44ef0408f3
6 changed files with 51 additions and 58 deletions

View File

@@ -5,7 +5,6 @@
*/
import { FunctionDeclaration, PartListUnion, Schema } from '@google/genai';
import { Summarizer, defaultSummarizer } from '../utils/summarizer.js';
/**
* Interface representing the base Tool functionality
@@ -44,16 +43,6 @@ export interface Tool<
*/
canUpdateOutput: boolean;
/**
* A function that summarizes the result of the tool execution.
*/
summarizer?: Summarizer;
/**
* Whether the tool's display output should be summarized
*/
shouldSummarizeDisplay?: boolean;
/**
* Validates the parameters for the tool
* Should be called from both `shouldConfirmExecute` and `execute`
@@ -109,8 +98,6 @@ export abstract class BaseTool<
* @param isOutputMarkdown Whether the tool's output should be rendered as markdown
* @param canUpdateOutput Whether the tool supports live (streaming) output
* @param parameterSchema JSON Schema defining the parameters
* @param summarizer Function to summarize the tool's output
* @param shouldSummarizeDisplay Whether the tool's display output should be summarized
*/
constructor(
readonly name: string,
@@ -119,8 +106,6 @@ export abstract class BaseTool<
readonly parameterSchema: Schema,
readonly isOutputMarkdown: boolean = true,
readonly canUpdateOutput: boolean = false,
readonly summarizer: Summarizer = defaultSummarizer,
readonly shouldSummarizeDisplay: boolean = false,
) {}
/**