Watch
0
0
Fork
You've already forked hyperhive
0

an archetype's prompt prefills the new agent's agents.md in the create form

This commit is contained in:
atlas 2026-11-11 00:40:40 +01:00 • committed by mara
commit a5470d82ae

View file

@ -5,6 +5,7 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import {
agentsMdAfterPick,
agentsMdBody,
agentsMdRefusal,
} from "../src/pages/CreateAgentAgentsMd.ts";
@ -41,3 +42,29 @@ test("other failures stay with the general error", () => {
assert.equal(agentsMdRefusal({ status: 400 }), null);
assert.equal(agentsMdRefusal({ detail: "agents_md is too long" }), null);
});
test("a pick fills an empty box with the archetype's prompt", () => {
assert.equal(agentsMdAfterPick("", "", "Review only."), "Review only.");
assert.equal(agentsMdAfterPick(" \n", "", "Review only."), "Review only.");
});
test("a pick keeps text the operator typed or edited", () => {
assert.equal(agentsMdAfterPick("# mine", "", "Review only."), "# mine");
assert.equal(
agentsMdAfterPick("Review only. Also x.", "Review only.", "Triage."),
"Review only. Also x.",
);
});
test("a pick over an unedited prefill swaps it, and none clears it", () => {
assert.equal(
agentsMdAfterPick("Review only.", "Review only.", "Triage."),
"Triage.",
);
assert.equal(agentsMdAfterPick("Review only.", "Review only.", ""), "");
});
test("an archetype without a prompt leaves the box as it is", () => {
assert.equal(agentsMdAfterPick("# mine", "", ""), "# mine");
assert.equal(agentsMdAfterPick("", "", ""), "");
});