HerdrDriver
Defined in: src/herdr.ts:205
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new HerdrDriver(
runner?,asyncRunner?):HerdrDriver
Defined in: src/herdr.ts:206
Parameters
Section titled “Parameters”runner?
Section titled “runner?”Runner = defaultRunner
asyncRunner?
Section titled “asyncRunner?”AsyncRunner = defaultAsyncRunner
Returns
Section titled “Returns”HerdrDriver
Methods
Section titled “Methods”closeTab()
Section titled “closeTab()”closeTab(
tabId):void
Defined in: src/herdr.ts:490
Best-effort: close a tab by id (takes its panes + any agent down with it).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
list()
Section titled “list()”list():
HerdrAgent[]
Defined in: src/herdr.ts:211
Returns
Section titled “Returns”paneForegroundProcs()
Section titled “paneForegroundProcs()”paneForegroundProcs(
paneId):Promise<string[]>
Defined in: src/herdr.ts:261
Async: returns the foreground process names in a pane (pane process-info).
For a husk pane (idle shell) this is ["zsh"]; for a live agent pane it includes
"claude" and companion processes.
A JSON parse failure (missing/malformed reply) returns [] — the caller can treat
an unreadable pane as “no known foreground processes”. A thrown CLI error (e.g.
herdr lacks the subcommand) propagates — callers must distinguish “shell-only”
(["zsh"]) from “subcommand unavailable” (throw).
Parameters
Section titled “Parameters”paneId
Section titled “paneId”string
Returns
Section titled “Returns”Promise<string[]>
panes()
Section titled “panes()”panes():
HerdrPane[]
Defined in: src/herdr.ts:239
Every pane across all tabs (pane list). Includes idle shell panes left behind by exited agents.
Returns
Section titled “Returns”read()
Section titled “read()”read(
target,source?,lines?):string
Defined in: src/herdr.ts:425
Read an agent’s terminal buffer as plain text (default: the visible viewport).
Parameters
Section titled “Parameters”target
Section titled “target”string
source?
Section titled “source?”"visible" | "recent"
lines?
Section titled “lines?”number = 200
Returns
Section titled “Returns”string
readAsync()
Section titled “readAsync()”readAsync(
target,source?,lines?):Promise<string>
Defined in: src/herdr.ts:436
Async sibling of read — same args/timeout/maintenance guard, but spawns via
promisify(execFile) so it never blocks Bun’s single loop. Use this from the
poll loop (the poller reads the visible buffer for EVERY running agent every
probe cadence in the interim heartbeat path); the sync read would freeze the
live web terminal under that fan-out.
Parameters
Section titled “Parameters”target
Section titled “target”string
source?
Section titled “source?”"visible" | "recent"
lines?
Section titled “lines?”number = 200
Returns
Section titled “Returns”Promise<string>
relabel()
Section titled “relabel()”relabel(
terminalId,newName):void
Defined in: src/herdr.ts:467
Rename a live agent and its dedicated tab so a background re-name (the LLM namer) is reflected in the herdr UI, not just shepherd’s DB. Resolves the agent (and its tabId) FRESH from the live list by terminal id — the live list is the source of truth; a cached tabId may be stale. Best-effort: a dead/already-renamed agent must never crash the caller, so every step is guarded.
Parameters
Section titled “Parameters”terminalId
Section titled “terminalId”string
newName
Section titled “newName”string
Returns
Section titled “Returns”void
send()
Section titled “send()”send(
target,text):void
Defined in: src/herdr.ts:396
Write literal text to an agent’s PTY (no implicit Enter).
Parameters
Section titled “Parameters”target
Section titled “target”string
string
Returns
Section titled “Returns”void
start()
Section titled “start()”start(
name,cwd,argv,env?):HerdrAgent
Defined in: src/herdr.ts:329
Parameters
Section titled “Parameters”string
string
string[]
Record<string, string>
Returns
Section titled “Returns”stop()
Section titled “stop()”stop(
terminalId):void
Defined in: src/herdr.ts:454
Best-effort teardown of the agent backing a terminal id. Closes the agent’s whole
TAB, not just its pane: every agent gets its own dedicated tab, so closing only the
pane left an empty husk tab behind. Resolves terminalId → current tabId FRESH from
the live list — the live list is the source of truth; the agent may have ended or been
relabeled, so a cached tabId may be stale. Under herdr 0.7 an exited agent persists as
a husk that retains its terminalId, so stop() still finds and closes its tab. The no-op
path fires only when the pane is truly gone from the list; the orphan sweep handles any
residue in that case.
Parameters
Section titled “Parameters”terminalId
Section titled “terminalId”string
Returns
Section titled “Returns”void
tabs()
Section titled “tabs()”tabs():
HerdrTab[]
Defined in: src/herdr.ts:227
Every tab in the workspace — including husks with no live agent (tab list).
Returns
Section titled “Returns”HerdrTab[]