Watch
0
0
Fork
You've already forked hyperhive
0

swarm: /clear starts an agent's next turn on a fresh session

This commit is contained in:
iris 2026-11-16 01:01:31 +01:00
commit fb9d4b5040

View file

@ -4,6 +4,7 @@ import assert from "node:assert/strict";
import { test } from "node:test";
import {
completion,
controlRoute,
enterSends,
matchCommands,
menuQuery,
@ -98,3 +99,17 @@ test("Enter sends once the selected command is already typed in full", () => {
assert.equal(enterSends("/comp", cmd("compact")), false);
assert.equal(enterSends("/", cmd("compact")), false);
});
test("exactly /clear, with the backend's command of that name, is a new session", () => {
const list = [cmd("compact"), cmd("clear")];
assert.equal(controlRoute("/clear", list), "new-session");
assert.equal(controlRoute("/clear ", list), "new-session");
assert.equal(controlRoute("/clear it", list), null);
assert.equal(controlRoute("/compact", list), null);
assert.equal(controlRoute("clear", list), null);
});
test("without the backend's /clear command, or with a skill of that name, it is text", () => {
assert.equal(controlRoute("/clear", []), null);
assert.equal(controlRoute("/clear", [cmd("clear", "skill")]), null);
});