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

+10 -4
View File
@@ -151,12 +151,17 @@ export function gateAfter(status, seenWorking) {
* "--help") would otherwise be read by hc as an option and fail with a usage
* error. Everything after `--` is the text, whatever it looks like.
*
* `force` is `--force`: "type even if the program is blocked" (hc 0.1.21).
* Only the person's own Enter, answering an agent that waits for them, asks
* for it - the queue never does.
*
* @param {string} terminal
* @param {string} text
* @param {{force?:boolean}} [options]
* @returns {string[]}
*/
export function sendArgs(terminal, text) {
return ["send", "--json", terminal, "--", text];
export function sendArgs(terminal, text, { force = false } = {}) {
return ["send", "--json", ...(force ? ["--force"] : []), terminal, "--", text];
}
/**
@@ -185,10 +190,11 @@ export function parseSendArgs(args) {
*
* @param {Ctx} ctx
* @param {string} text
* @param {{force?:boolean}} [options] - `force`: type even if the agent is blocked
* @returns {Promise<Result>}
*/
export async function sendNow(ctx, text) {
const res = await callHc(ctx, sendArgs(ctx.terminal, text));
export async function sendNow(ctx, text, options = {}) {
const res = await callHc(ctx, sendArgs(ctx.terminal, text, options));
if (res.failure) {
// The runner itself failed - there is no exit code to report.