- Converted all tool implementations from factory functions to class-based architecture. - Updated SDK exports to expose tool classes instead of create*Tool factory functions. - Refactored tool instantiation patterns across all built-in tools and test files. - Added proper TypeScript typing with AgentToolResult and AgentToolUpdateCallback interfaces.
27 lines
770 B
TypeScript
27 lines
770 B
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import { OutputSink } from "../../src/core/streaming-output";
|
|
|
|
function makeLargeOutput(size: number): string {
|
|
return "x".repeat(size);
|
|
}
|
|
|
|
describe("OutputSink", () => {
|
|
it("spills to disk and truncates large output", async () => {
|
|
const largeOutput = makeLargeOutput(60_000);
|
|
const sink = new OutputSink(10, 70_000);
|
|
const writer = sink.getWriter();
|
|
|
|
await writer.write(largeOutput);
|
|
await writer.close();
|
|
|
|
const result = sink.dump();
|
|
|
|
expect(result.truncated).toBe(true);
|
|
expect(result.fullOutputPath).toBeDefined();
|
|
expect(result.output.length).toBeLessThan(largeOutput.length);
|
|
|
|
const fullOutput = await Bun.file(result.fullOutputPath!).text();
|
|
expect(fullOutput).toBe(largeOutput);
|
|
});
|
|
});
|