Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
import { describe, expect, it } from "vite-plus/test";
import { ThreadId, TurnId } from "@akeru/contracts";
import { applyThreadDetailEvent } from "./threadReducer.ts";
import { baseEventFields, baseThread } from "./threadReducer.test-support.ts";
describe("applyThreadDetailEvent", () => {
describe("thread.proposed-plan-upserted", () => {
it("adds a proposed plan", () => {
const result = applyThreadDetailEvent(baseThread, {
...baseEventFields,
sequence: 11,
occurredAt: "2026-04-01T10:00:00.000Z",
aggregateKind: "thread",
aggregateId: ThreadId.make("thread-1"),
type: "thread.proposed-plan-upserted",
payload: {
threadId: ThreadId.make("thread-1"),
proposedPlan: {
id: "plan-1",
turnId: TurnId.make("turn-1"),
planMarkdown: "## Plan\n- Do stuff",
implementedAt: null,
implementationThreadId: null,
createdAt: "2026-04-01T10:00:00.000Z",
updatedAt: "2026-04-01T10:00:00.000Z",
},
},
});
expect(result.kind).toBe("updated");
if (result.kind === "updated") {
expect(result.thread.proposedPlans).toHaveLength(1);
expect(result.thread.proposedPlans[0]?.id).toBe("plan-1");
}
});
});
});