matchAgents
matchAgents(
sessions,agents):Map<string,HerdrAgent|null>
Defined in: src/herdr.ts:150
Resolve EVERY active session to its live herdr agent at once, arbitrating cross-session collisions so a dead session can’t steal a live sibling’s agent.
Pass 1 — exact terminalId (the stable-within-a-daemon fast path).
Pass 2 — cwd fallback for stale ids (e.g. after a herdr daemon restart). When 2+
still-unmatched sessions share a cwd (non-isolated same-repo), only an exact
agent-NAME match is safe. A session that is the SOLE one at its cwd adopts its lone
agent via matchAgent regardless of name, so an isolated session whose name drifted
from its herdr agent still re-pairs. Each agent is adopted by at most one session.
Parameters
Section titled “Parameters”sessions
Section titled “sessions”object[]
agents
Section titled “agents”Returns
Section titled “Returns”Map<string, HerdrAgent | null>