fix(tool-output-truncator): accept model context limit cache state

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-03-08 02:10:56 +09:00
parent fdabebe889
commit b5e222b792
2 changed files with 18 additions and 1 deletions
+14
View File
@@ -19,6 +19,20 @@ describe("createToolOutputTruncatorHook", () => {
hook = createToolOutputTruncatorHook({} as never)
})
it("passes modelContextLimitsCache through to createDynamicTruncator", () => {
const ctx = {} as never
const modelContextLimitsCache = new Map<string, number>()
const modelCacheState = {
anthropicContext1MEnabled: false,
modelContextLimitsCache,
}
truncateSpy.mockClear()
createToolOutputTruncatorHook(ctx, { modelCacheState })
expect(truncateSpy).toHaveBeenLastCalledWith(ctx, modelCacheState)
})
describe("tool.execute.after", () => {
const createInput = (tool: string) => ({
tool,
+4 -1
View File
@@ -27,7 +27,10 @@ const TOOL_SPECIFIC_MAX_TOKENS: Record<string, number> = {
}
interface ToolOutputTruncatorOptions {
modelCacheState?: { anthropicContext1MEnabled: boolean }
modelCacheState?: {
anthropicContext1MEnabled: boolean
modelContextLimitsCache?: Map<string, number>
}
experimental?: ExperimentalConfig
}