Open History to see the last commit
1import { describe, expect, it } from "@effect/vitest";
2import { DEFAULT_TEXT_GENERATION_MODEL, ProviderInstanceId } from "@t3tools/contracts";
3
4import { formatThreadForHandover, makeHandoverModelSelection } from "./ThreadHandover.ts";
5
6describe("thread handover", () => {
7 it("pins handover generation to Luna with high reasoning", () => {
8 expect(makeHandoverModelSelection(ProviderInstanceId.make("codex"))).toEqual({
9 instanceId: "codex",
10 model: DEFAULT_TEXT_GENERATION_MODEL,
11 options: [{ id: "reasoningEffort", value: "high" }],
12 });
13 expect(makeHandoverModelSelection(ProviderInstanceId.make("codex-renamed"))).toMatchObject({
14 instanceId: "codex-renamed",
15 model: DEFAULT_TEXT_GENERATION_MODEL,
16 });
17 });
18
19 it("formats thread metadata and both sides of the conversation", () => {
20 const contents = formatThreadForHandover({
21 title: "Continue the migration",
22 branch: "feature/migrate",
23 worktreePath: "/tmp/migrate",
24 messages: [
25 { role: "system", text: "System instructions must stay private." },
26 { role: "user", text: "Move the worker." },
27 { role: "assistant", text: "The worker moved and tests passed." },
28 ],
29 } as unknown as Parameters<typeof formatThreadForHandover>[0]);
30
31 expect(contents).toContain("Title: Continue the migration");
32 expect(contents).toContain("Branch: feature/migrate");
33 expect(contents).toContain("## User\n\nMove the worker.");
34 expect(contents).toContain("## Assistant\n\nThe worker moved and tests passed.");
35 expect(contents).not.toContain("System instructions must stay private.");
36 });
37});