Skip to content

HerdrDriver

Defined in: src/herdr.ts:205

new HerdrDriver(runner?, asyncRunner?): HerdrDriver

Defined in: src/herdr.ts:206

Runner = defaultRunner

AsyncRunner = defaultAsyncRunner

HerdrDriver

closeTab(tabId): void

Defined in: src/herdr.ts:490

Best-effort: close a tab by id (takes its panes + any agent down with it).

string

void


list(): HerdrAgent[]

Defined in: src/herdr.ts:211

HerdrAgent[]


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).

string

Promise<string[]>


panes(): HerdrPane[]

Defined in: src/herdr.ts:239

Every pane across all tabs (pane list). Includes idle shell panes left behind by exited agents.

HerdrPane[]


read(target, source?, lines?): string

Defined in: src/herdr.ts:425

Read an agent’s terminal buffer as plain text (default: the visible viewport).

string

"visible" | "recent"

number = 200

string


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.

string

"visible" | "recent"

number = 200

Promise<string>


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.

string

string

void


send(target, text): void

Defined in: src/herdr.ts:396

Write literal text to an agent’s PTY (no implicit Enter).

string

string

void


start(name, cwd, argv, env?): HerdrAgent

Defined in: src/herdr.ts:329

string

string

string[]

Record<string, string>

HerdrAgent


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.

string

void


tabs(): HerdrTab[]

Defined in: src/herdr.ts:227

Every tab in the workspace — including husks with no live agent (tab list).

HerdrTab[]