pi-mono/packages/coding-agent/test/compaction-nested-calls.test.ts
Armin Ronacher e94c9763db feat(codemode,coding-agent): rename the exec tool back to codemode
The tool is named codemode again and scripts configure it with a first-line // @options: {...} instead of the // @exec: pragma. yield_time_ms is gone; max_output_tokens and timeout_ms remain. Comments, docs, and tests no longer describe the tool in terms of another agent.
2026-09-27 23:22:48 +02:00

27 lines
1 KiB
TypeScript

import type { ToolResultMessage } from "@earendil-works/pi-ai/compat";
import { describe, expect, it } from "vitest";
import { computeFileLists, createFileOps, extractFileOpsFromMessage } from "../src/core/compaction/utils.ts";
describe("compaction file operations", () => {
it("include files touched by nested calls recorded on tool results", () => {
const result: ToolResultMessage = {
role: "toolResult",
toolCallId: "codemode-1",
toolName: "codemode",
content: [],
isError: false,
timestamp: 0,
nestedCalls: {
calls: [
{ id: "codemode-1/1", name: "read", arguments: { path: "a.ts" }, status: "ok" },
{ id: "codemode-1/2", name: "edit", arguments: { path: "b.ts", edits: [] }, status: "ok" },
{ id: "codemode-1/3", name: "write", argumentsBytes: 40000, status: "ok" },
],
complete: false,
},
};
const fileOps = createFileOps();
extractFileOpsFromMessage(result, fileOps);
expect(computeFileLists(fileOps)).toEqual({ readFiles: ["a.ts"], modifiedFiles: ["b.ts"] });
});
});