first commit
This commit is contained in:
28
tests/state-context.test.ts
Normal file
28
tests/state-context.test.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtemp } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { resolve } from "node:path";
|
||||
import { FileSystemStateContextManager } from "../src/agents/state-context.js";
|
||||
|
||||
test("state/context manager builds fresh contexts from handoff storage", async () => {
|
||||
const root = await mkdtemp(resolve(tmpdir(), "ai-ops-state-"));
|
||||
const manager = new FileSystemStateContextManager({
|
||||
rootDirectory: root,
|
||||
});
|
||||
|
||||
await manager.initializeSession("session-1");
|
||||
await manager.writeHandoff("session-1", {
|
||||
nodeId: "coder",
|
||||
payload: {
|
||||
task: "build feature",
|
||||
attempt: 1,
|
||||
},
|
||||
});
|
||||
|
||||
const first = await manager.buildFreshNodeContext("session-1", "coder");
|
||||
first.handoff.payload.task = "mutated";
|
||||
|
||||
const second = await manager.buildFreshNodeContext("session-1", "coder");
|
||||
assert.equal(second.handoff.payload.task, "build feature");
|
||||
});
|
||||
Reference in New Issue
Block a user