feat: Enter answers a blocked agent with hc send --force (never from the queue)

Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
FactorandOvis Fast committed 2026-11-19 12:08:35 +01:00
1 parent 3b7b4618a3
commit d852c406dd
3 files changed
+46 -7

No files matched your search

+28
View File
@@ -33,3 +33,31 @@ test("parseSendArgs: not a send, or a send of another shape, is nothing", () =>
assert.equal(parseSendArgs(null), null);
assert.equal(parseSendArgs([]), null);
});
test("--force is only there when asked for, and before the `--`", async () => {
assert.deepEqual(sendArgs("t2", "yes", { force: true }), ["send", "--json", "--force", "t2", "--", "yes"]);
assert.deepEqual(sendArgs("t2", "yes", { force: false }), sendArgs("t2", "yes"));
assert.deepEqual(parseSendArgs(sendArgs("t2", "--force x", { force: true })), { terminal: "t2", text: "--force x", force: true });
assert.equal(parseSendArgs(sendArgs("t2", "--force")).force, false);
const calls = [];
const ctx = { terminal: "t2", hc: async (args) => (calls.push(args), ok) };
await sendNow(ctx, "yes", { force: true });
await sendNow(ctx, "yes");
assert.equal(calls[0].includes("--force"), true);
assert.equal(calls[1].includes("--force"), false);
});
test("the queue never forces: drain sends without --force", async () => {
const { createState, reduce } = await import("../mod/ovis-composer/state.js");
const { drain } = await import("../mod/ovis-composer/delivery.js");
const state = reduce(createState(), { type: "queue", agent: "t2", item: { id: "1", text: "q", createdAt: 1 } });
const calls = [];
const result = await drain(
{ agent: "t2", terminal: "t2", status: () => "idle", gate: () => true, hc: async (args) => (calls.push(args), ok) },
state,
);
assert.equal(result.sent, true);
assert.equal(calls.length, 1);
assert.equal(calls[0].includes("--force"), false);
});