refactor: return complete tool results inline

This commit is contained in:
morluto
2026-09-29 07:08:46 +08:00
parent 2160d4fae5
commit 0d96275b68
535 changed files with 4084 additions and 13537 deletions
@@ -5,10 +5,7 @@ import { describe, expect, it } from "vitest";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
import {
paginateArtifactInventory,
scanArtifactInventory,
} from "../../../src/application/ArtifactInventory.js";
import { scanArtifactInventory } from "../../../src/application/ArtifactInventory.js";
const LIMITS = {
maxEntries: 10,
@@ -20,37 +17,18 @@ const LIMITS = {
} as const;
describe("artifact inventory snapshot", () => {
it("projects every page from the same completed scan", async () => {
it("retains the complete scan after the source directory changes", async () => {
const root = await createTestTempDirectory("rea-inventory-snapshot-");
await writeFile(join(root, "a.txt"), "a");
await writeFile(join(root, "b.txt"), "b");
const snapshot = await scanArtifactInventory(root, LIMITS);
await rm(join(root, "b.txt"));
const first = paginateArtifactInventory(snapshot, {
nodeOffset: 0,
nodeLimit: 1,
occurrenceOffset: 0,
occurrenceLimit: 2,
edgeOffset: 0,
edgeLimit: 1,
});
const second = paginateArtifactInventory(snapshot, {
nodeOffset: 1,
nodeLimit: 10,
occurrenceOffset: 2,
occurrenceLimit: 2,
edgeOffset: 1,
edgeLimit: 10,
});
expect(first.manifest).toEqual(second.manifest);
expect(
[...first.occurrences.items, ...second.occurrences.items].map(
({ logical_path: path }) => path,
),
).toEqual([".", "a.txt", "b.txt"]);
expect(first.occurrences.total).toBe(3);
expect(second.occurrences.total).toBe(3);
expect(snapshot.occurrences.map(({ logical_path: path }) => path)).toEqual([
".",
"a.txt",
"b.txt",
]);
expect(snapshot.manifest.occurrence_count).toBe(3);
});
});