Enhance Beryl Agent detail and report views

This commit is contained in:
Beryl
2026-09-11 11:13:24 +08:00
parent 336bf88466
commit 15f067fff9
57 changed files with 1833 additions and 95 deletions
@@ -0,0 +1,22 @@
import { it, expect } from "vitest";
import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { SessionRegistry } from "../src/session.js";
import { updateTask, saveTask, loadTask } from "../src/task.js";
it("restores delivery requirements across process recreation, not completion", async () => {
const root = await mkdtemp(path.join(tmpdir(), "task-restore-"));
try {
const registry = new SessionRegistry(root);
const s = await registry.create();
const first = updateTask(undefined, "俄罗斯 Ozon 100元彩妆 PPT", "r1")!;
const task = updateTask(first, "改用 SW Ads 模板", "r2")!;
await saveTask(s.workspace, task);
const restored = new SessionRegistry(root);
await restored.restore();
expect(restored.require(s.sessionId).task?.instructions).toEqual(first.instructions.concat("改用 SW Ads 模板"));
expect((await loadTask(s.workspace))?.status).toBe("failed");
expect(updateTask(restored.require(s.sessionId).task, "继续", "r3")?.template).toBe("swads");
expect(updateTask(task, "卡在哪了", "r4")).toBeUndefined();
} finally { await rm(root, { recursive: true, force: true }); }
});