add truncation for all tools

This commit is contained in:
Aiden Cline
2026-01-07 02:01:23 -06:00
parent 0ffe496869
commit 6590c1641f
2 changed files with 16 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ import { CodeSearchTool } from "./codesearch"
import { Flag } from "@/flag/flag"
import { Log } from "@/util/log"
import { LspTool } from "./lsp"
import { Truncate } from "../session/truncation"
export namespace ToolRegistry {
const log = Log.create({ service: "tool.registry" })
@@ -64,10 +65,11 @@ export namespace ToolRegistry {
description: def.description,
execute: async (args, ctx) => {
const result = await def.execute(args as any, ctx)
const out = Truncate.output(result)
return {
title: "",
output: result,
metadata: {},
output: out.truncated ? out.content : result,
metadata: { truncated: out.truncated },
}
},
}),