import { describe, expect, it } from "vitest"; import { assignmentPrompt, quoteAgentOutput, resumePrompt, } from "../agent-prompt.ts"; describe("agent prompt envelopes", () => { it("identifies fresh assignments", () => { expect( assignmentPrompt( { workflow: "research", phase: "synthesis", index: 2 }, "Synthesize evidence.", ), ).toBe(` Synthesize evidence. `); }); it("quotes producer identity and task without exposing interpolation syntax", () => { const quoted = quoteAgentOutput('{"finding":"a < b"}', [ { agentId: "gather#0", task: 'Inspect "parser" & docs' }, ]); expect(quoted).toContain( '', ); expect(quoted).toContain( '', ); expect(quoted).not.toContain("results[]"); }); it("marks continuation without exposing checkpoint internals", () => { const prompt = resumePrompt("synthesis#2", "synthesis", "Continue."); expect(prompt).toContain('from="ultra" kind="resume"'); expect(prompt).not.toContain("checkpoint"); }); });