9943f21f5c
- WorkflowFn first param is now ThreadInput { prompt, steps }
- threadId removed from WorkflowFnOptions and ThreadContext (engine-only)
- createRoleModerator seeds context from input.steps (fork/resume ready)
- New test: pre-filled steps skip already-completed roles
Closes #6
小橘 <xiaoju@shazhou.work>
25 lines
875 B
TypeScript
25 lines
875 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
|
|
import { decodeCrockfordToUint64 } from "../src/base32.js";
|
|
import { hashWorkflowBundleBytes } from "../src/hash.js";
|
|
|
|
describe("hashWorkflowBundleBytes", () => {
|
|
test("matches XXH64 reference for empty input", () => {
|
|
const encoder = new TextEncoder();
|
|
const digest = hashWorkflowBundleBytes(encoder.encode(""));
|
|
const decoded = decodeCrockfordToUint64(digest);
|
|
expect(decoded.ok).toBe(true);
|
|
if (decoded.ok) {
|
|
expect(decoded.value).toBe(0xef46_db37_51d8_e999n);
|
|
}
|
|
});
|
|
|
|
test("stable for identical content", () => {
|
|
const encoder = new TextEncoder();
|
|
const data = encoder.encode(
|
|
"export default async function* (input) { return { returnCode: 0, summary: input.prompt }; }\n",
|
|
);
|
|
expect(hashWorkflowBundleBytes(data)).toBe(hashWorkflowBundleBytes(data));
|
|
});
|
|
});
|