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:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user