Terminal & host

panto-herdr

rock 0.5.1-1Source

Reports panto lifecycle state and session identity to Herdr. Activates only when HERDR_ENV=1 and HERDR_PANE_ID is nonempty. Uses HERDR_BIN_PATH, falling back to herdr on PATH.

For the classic Herdr TUI only. On the native Herdr app, herdr-core, Rex, Orca, or another OSC 7501-capable host, use panto-report-status instead. Choose the reporter for your host rather than enabling both. Orca v1.4.245 supports OSC 7501 for custom programs.

Install

TOML
[extensions]
rocks = ["panto-herdr"]

Then run panto update and start a new panto session.

Only the outermost panto in a pane reports. It sets PANTO_HERDR_OWNER to <pane>@<pid>, so /new in that process keeps reporting while a panto launched from its shell (a panto -p test, say) inherits the marker and stays silent instead of claiming, then releasing, the pane.

Driving panto in Herdr

Panto is a custom-reported agent, not a built-in Herdr kind. In Herdr 0.8.2 and 0.9.0, agent start, agent prompt, and agent send-keys cannot control panto, and renaming it does not fix that.

Once per activation the extension injects this limitation and the supported approach into the live conversation, without appending a system message to the session store at startup.

Use panto subagents or Lua workflows for delegated work. When the user asks for a separate primary session, create a tab (or their requested layout), read the returned pane ID, and drive it:

SH
herdr tab create --workspace "$HERDR_WORKSPACE_ID" --cwd "$PWD" --no-focus
# Read <pane-id> from result.root_pane.pane_id; don't guess it.
herdr pane run <pane-id> 'panto -m <requested-provider:model>'
herdr agent wait <pane-id> --until idle --until done --timeout 30000
herdr pane run <pane-id> 'Your prompt'
herdr pane read <pane-id> --source recent-unwrapped --lines 80

Despite its name, pane run sends text plus Enter to the current application; it does not require a shell. It honors bracketed-paste mode, unlike raw pane send-text. Use pane send-keys for individual interactive keys.

If agent wait returns agent_not_found during startup, retry with a bounded startup deadline. Do not send the prompt until panto is detected and idle.

Check the target is ready before sending text. Pane input has no agent-level approval guards: never answer an approval or question without user authorization. Keep explicit model requests; a separate primary is not subject to delegated-subagent model restrictions.

agent list, get, read, wait, and rename can address custom-reported panto agents. For completion, wait with --until working after submission, then --until idle --until done, each with a timeout:

SH
herdr agent wait <pane-id> --until working --timeout 30000
herdr agent wait <pane-id> --until idle --until done --timeout 300000

An immediate idle wait can return the pre-submit state, and a very short turn can finish before working is observed. On timeout, inspect state and output rather than blindly resubmitting.

  • Default waits also accept blocked, so success is not proof of readiness.
  • done is background completion, not a block; accept it alongside idle.
  • These waits track the whole session, not individual turns.

Reporting

panto eventHerdr state
session_readyidle unless background work is active
turn_start, agent_submission, render_thinking, render_tool_details, render_assistant_textworking
command_startworking (compacting for /compact, shell for ! / !!, else cmd:<name>)
command_end, turn_endidle unless background work is active
render_compactionrefines already-active foreground work; never opens work
background_work_start / background_work_endbalanced work counter; remains working until all work ends
session_endreleases the agent report

The reporter publishes panto_session_id and panto_session_path through pane report-metadata, using panto.ext.session_info().

These are custom tokens on pane get and agent get, not native agent session references: Herdr 0.8.2 discards native session-reference fields from custom sources. Tokens are refreshed when identity changes and cleared on normal exit.

Use the JSONL path to inspect transcripts when scrollback is insufficient; it is on the panto host and may not exist until the session is persisted. After an unclean exit tokens can be stale, so verify the pane's current occupant. Automatic Herdr restart and resume still needs native Herdr support.

Reports are asynchronous: microsecond wall-time sequence seeds plus an increasing per-activation counter. - A failed current report is retried once. Obsolete failures cannot replay old state over a newer report or release.

  • State and metadata track their latest reports independently, so a state change does not suppress a pending metadata retry.
  • After exhaustion panto logs the error, and the next lifecycle event can retry the same state.
  • JSON output is discarded. Diagnostics go through panto's normal logger; PANTO_DEBUG=1 redirects them from stderr to its session debug log.
  • Shutdown release is best-effort within panto's bounded teardown.

Blocked-state limitation: panto exposes no general event for an interactive decision opening or closing.

This extension cannot reliably report blocked for arbitrary extension UIs, and does not guess from assistant text, tool names, or screen contents. Such UIs can remain reported as idle or working, so inspect the pane before sending input.

Check

SH
lua _selfcheck.lua
# Or: panto lua _selfcheck.lua

The check stubs panto and luv; it never controls a live Herdr pane.