chore: fix truncation logic and test duplications

This commit is contained in:
Spencer
2026-04-07 19:33:15 +00:00
parent ea4dd5ae35
commit 7cdfaaa6bd
6 changed files with 103 additions and 186 deletions

View File

@@ -9,7 +9,6 @@ import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import crypto from 'node:crypto';
import type { Config } from '../config/config.js';
import { debugLogger } from '../utils/debugLogger.js';
import {
type SandboxPermissions,
@@ -937,7 +936,7 @@ export class ShellToolInvocation extends BaseToolInvocation<
this.context.geminiClient,
signal,
);
const threshold = this.config.getTruncateToolOutputThreshold();
const threshold = this.context.config.getTruncateToolOutputThreshold();
const fullOutputFilePath =
threshold > 0 && totalBytesWritten >= threshold
? outputFilePath
@@ -945,7 +944,7 @@ export class ShellToolInvocation extends BaseToolInvocation<
const toolResult: ToolResult = {
llmContent: summary,
returnDisplay: typeof returnDisplayMessage !== 'undefined' ? returnDisplayMessage : returnDisplay,
returnDisplay,
fullOutputFilePath,
...executionError,
};
@@ -955,7 +954,7 @@ export class ShellToolInvocation extends BaseToolInvocation<
return toolResult;
}
const threshold = this.config.getTruncateToolOutputThreshold();
const threshold = this.context.config.getTruncateToolOutputThreshold();
const fullOutputFilePath =
threshold > 0 && totalBytesWritten >= threshold
? outputFilePath