core: expose truncated output file path in tool metadata for easier access to full command results
This commit is contained in:
parent
257a486d38
commit
0960e4fe0f
3 changed files with 4 additions and 4 deletions
|
|
@ -69,7 +69,7 @@ export namespace ToolRegistry {
|
||||||
return {
|
return {
|
||||||
title: "",
|
title: "",
|
||||||
output: out.truncated ? out.content : result,
|
output: out.truncated ? out.content : result,
|
||||||
metadata: { truncated: out.truncated },
|
metadata: { truncated: out.truncated, outputPath: out.outputPath },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ export namespace Tool {
|
||||||
metadata: {
|
metadata: {
|
||||||
...result.metadata,
|
...result.metadata,
|
||||||
truncated: truncated.truncated,
|
truncated: truncated.truncated,
|
||||||
|
outputPath: truncated.outputPath,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -306,10 +306,9 @@ describe("tool.bash truncation", () => {
|
||||||
)
|
)
|
||||||
expect((result.metadata as any).truncated).toBe(true)
|
expect((result.metadata as any).truncated).toBe(true)
|
||||||
|
|
||||||
const match = result.output.match(/Full output written to: (.+)/)
|
const filepath = (result.metadata as any).outputPath
|
||||||
expect(match).toBeTruthy()
|
expect(filepath).toBeTruthy()
|
||||||
|
|
||||||
const filepath = match![1].split("\n")[0]
|
|
||||||
const saved = await Bun.file(filepath).text()
|
const saved = await Bun.file(filepath).text()
|
||||||
const lines = saved.trim().split("\n")
|
const lines = saved.trim().split("\n")
|
||||||
expect(lines.length).toBe(lineCount)
|
expect(lines.length).toBe(lineCount)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue