Skip to content

pi-herdr: pane run / send_text fail with "Expected JSON output" against herdr >= 0.7.5 #22

Description

@punk-dev-robot

Summary

herdr_pane with action: run or action: send_text always fails with:

Expected JSON output from herdr pane run w1:p20 echo hello

The command does execute — only the result reporting fails, so the tool looks broken to the model and it retries or gives up.

Cause

packages/pi-herdr/index.ts routes both verbs through execHerdrJson:

// line ~507
await execHerdrJson(["pane", "run", params.pane, params.command], signal);
// line ~553
await execHerdrJson(["pane", "send-text", params.pane, params.text], signal);

execHerdrJson throws when stdout is empty (line ~276):

if (!stdout) throw new Error(`Expected JSON output from herdr ${args.join(" ")}`);

But herdr 0.7.5 prints nothing on success for pane run and pane send-text, while other verbs still emit JSON envelopes:

$ herdr --version
herdr 0.7.5

$ herdr pane run w1:p2W 'echo probe123'   # no stdout
$ echo $?
0
$ herdr pane read w1:p2W --lines 5
> echo probe123
probe123                                   # the command did run

$ herdr pane list          # still JSON
{"id":"cli:pane:list","result":{...}}
$ herdr pane close w1:p31  # still JSON
{"id":"cli:pane:close","result":{"type":"ok"}}

Fix

Neither verb returns data, so exit-code checking is sufficient — use execHerdr instead of execHerdrJson at both call sites. read is already correct (execHerdrText).

-  await execHerdrJson(["pane", "run", params.pane, params.command], signal);
+  await execHerdr(["pane", "run", params.pane, params.command], signal);

-  await execHerdrJson(["pane", "send-text", params.pane, params.text], signal);
+  await execHerdr(["pane", "send-text", params.pane, params.text], signal);

Verified locally: after this change, herdr_pane action=run returns Submitted command to pane w1:p32 and the command runs as expected.

Worth checking whether herdr_agent prompt / send_keys hit the same path.

Environment

  • @ogulcancelik/pi-herdr 0.4.0
  • herdr 0.7.5
  • pi 0.82.1, macOS arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions