feat(core): Unified Context Management and Tool Distillation. (#24157)

This commit is contained in:
joshualitt
2026-03-30 15:29:59 -07:00
committed by GitHub
parent 117a2d3844
commit dfba0e91e2
22 changed files with 1717 additions and 314 deletions
@@ -19,6 +19,7 @@ import {
import { isAbortError } from '../utils/errors.js';
import { SHELL_TOOL_NAME } from '../tools/tool-names.js';
import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
import { ToolOutputDistillationService } from '../services/toolDistillationService.js';
import { executeToolWithHooks } from '../core/coreToolHookTriggers.js';
import {
saveTruncatedToolOutput,
@@ -196,6 +197,15 @@ export class ToolExecutor {
call: ToolCall,
content: PartListUnion,
): Promise<{ truncatedContent: PartListUnion; outputFile?: string }> {
if (this.config.isAutoDistillationEnabled()) {
const distiller = new ToolOutputDistillationService(
this.config,
this.context.geminiClient,
this.context.promptId,
);
return distiller.distill(call.request.name, call.request.callId, content);
}
const toolName = call.request.name;
const callId = call.request.callId;
let outputFile: string | undefined;