herdr-orchestra 6.48.1 → 6.48.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,74 @@
2
2
 
3
3
  All notable changes. Versions follow [semantic versioning](https://semver.org).
4
4
 
5
+ ## [6.48.3] - 2026-12-02
6
+
7
+ `orch board` can now show one agent in detail. On the Agents tab or the Tokens tab, pick an agent with up/down and press Enter. You see its tool, model, role, skills and what it does right now; its tokens (in, cached, out) in total, for the job it runs now, and for each milestone it worked on; its milestones with the time it spent on each; and its pane. Esc or Backspace goes back to the list. The numbers come from the same agent logs the board already reads, so no agent spends a single extra token. Where a tool keeps no counts (OpenCode, an old agy), it says "n/a" and why, never a guess.
8
+
9
+ Every agent name on the board now has its job in brackets: `codex-1 (coder)`, `rev-1 (reviewer)`, `lead-1 (lead)`, on the Milestones, Agents and Tokens tabs and in the details.
10
+
11
+ Example (Enter on codex-1):
12
+ ```
13
+ orch board · agent 18:47 · live
14
+
15
+ ● codex-1 (coder)
16
+ tool: codex
17
+ model: gpt-6.2-sol (medium)
18
+ state: M2 · building
19
+ step role: senior frontend engineer
20
+ pane: codex-1 · coder · M2
21
+
22
+ TOKENS read live from its own log
23
+ in cached out
24
+ total 100k 76k 7k
25
+ now (M2) 40k 30k 4k
26
+ M2 40k 30k 4k
27
+ M3 60k 46k 3k
28
+
29
+ MILESTONES 1 landed of 2
30
+ ● M2 Card building 1m
31
+ ✔ M3 Codex step landed 8m
32
+
33
+ [j] jump to its pane [f] changed files [esc ⌫ q] back
34
+ ```
35
+
36
+ ### Changed
37
+ - Enter on an agent (Agents tab) used to jump straight to its pane. It now opens the details, and `j` there jumps to the pane (in the board popup it still closes the popup too). The footer says so.
38
+
39
+ ### Added
40
+ - `orch board`: agent details from the Agents and Tokens tabs (Enter; Esc, Backspace or q back; `j` jump; `f` its milestone's changed files). `orch board --once --agent <name>` prints them once.
41
+ - Every agent name on the board shows its job in brackets.
42
+
43
+ ## [6.48.2] - 2026-12-02
44
+
45
+ `orch board` now has three tabs: Milestones, Agents and Tokens. The run's top lines (how many landed, time so far, total tokens, who needs you) stay on every tab, so nothing important is ever hidden. Switch with Tab, the left and right arrows, or the keys 1, 2 and 3. The board opens on Milestones. Every tab updates live, and the old keys still work: up/down to pick, Enter for a milestone's changed files (Milestones tab) or to jump to an agent (Agents tab), f, w and q. Agent names show in full, however long they are.
46
+
47
+ Example (the Agents tab):
48
+ ```
49
+ orch board · feat/rupee-flow 17:44 · live
50
+ 2 of 5 landed · 1 needs you · 38m so far of ~1h 10m
51
+ tokens 341k so far · lead 61k
52
+
53
+ 1 Milestones [2 Agents] 3 Tokens
54
+
55
+ ◆ lead claude high planning
56
+ ›● agy-2 agy medium M3 · building
57
+ ○ rupee-flow-review codex high free
58
+
59
+ [tab ←→ 1-3] switch [↑↓] pick [enter] jump to that agent [f] files [w] web [q] close
60
+ ```
61
+
62
+ Each agent's pane now carries a label that says who it is and what it does: `agy-2 · coder · M3`, `agy-2 · coder` when it is free, `rupee-flow-review · reviewer`, and `lead`. It changes when a coder moves to another milestone. orch sets it with herdr's `pane rename`, a pane label that is separate from the agent's name, so orch still finds every agent by its name.
63
+
64
+ ### Added
65
+ - `orch board`: tabs Milestones, Agents, Tokens (Tab, Shift+Tab, ←→, 1-3). The Tokens tab also lists each milestone's tokens. `orch board --once --tab agents` prints one tab; `--once` alone still prints the whole board.
66
+ - Pane labels: orch labels each agent's pane when a coder starts or finishes a milestone, and gives every label again on `orch team up` and `orch resume` (a herdr restart loses them). Only a label that changed is sent. `ORCH_PANE_LABELS=0` turns them off.
67
+
68
+ ### Changed
69
+ - The board no longer cuts or misaligns long agent names: the name column is as wide as the longest name.
70
+ - AGENTS.md: the token rule now covers every agent, not only the lead. A change must not raise the total tokens of a run (lead, coders, reviewer) without a reason, and must not make runs work worse. PRs report coder and reviewer text sizes too when they change.
71
+ - `orch view` (the browser page) has its own layout and is unchanged. The herdr desktop app's board runs `orch board`, so it gets the tabs too. The lead reads no new text.
72
+
5
73
  ## [6.48.1] - 2026-12-02
6
74
 
7
75
  `orch board` gets a TOKENS part: one row per agent (the lead, each coder, the reviewer) with what it read (in, and the cached part of that) and what it wrote (out), counted live. Before, a job's tokens showed only after the job ended. Now the job an agent is running counts too, read from the agent's own log from the job's start to now, so the numbers move after each reply the tool writes. The board looks again every 10 seconds while a job runs. Each coder that is on a milestone also shows that milestone's role and the skills the plan gave it.
package/README.md CHANGED
@@ -348,7 +348,7 @@ A subagent run: `/orch-plan` as usual (the plan's team is `Workers: coder (pi)`,
348
348
  Three views show a run while it goes; none of them changes it.
349
349
 
350
350
  - **`orch view`** opens the run as a live picture in your browser: the run ring, a milestone graph (arrows = "needs this first", red = needs you) with a one-line description under each milestone, the agents, the details of the milestone you click (with the exact `orch answer` command), time and cost against the estimate, a replay slider, and an optional browser alert when something needs you. `orch view --lan` also opens it to your phone on the same Wi-Fi, behind a secret link. `orch status` and the lead's "needs you" lines print its link while it runs.
351
- - **`orch board`** draws the same run as text for a Herdr pane; `orch view plugin link` adds a small Herdr plugin that opens it as a popup and `orch view plugin key` puts `prefix+a` in Herdr's config (Herdr 0.7.4+). In the Herdr desktop app, `orch view app link` adds the board to its command palette.
351
+ - **`orch board`** draws the same run as text for a Herdr pane, in three tabs under the run's top line: Milestones, Agents and Tokens (switch with Tab, ←→ or 1-3); `orch view plugin link` adds a small Herdr plugin that opens it as a popup and `orch view plugin key` puts `prefix+a` in Herdr's config (Herdr 0.7.4+). In the Herdr desktop app, `orch view app link` adds the board to its command palette.
352
352
  - **What each milestone changed**: press `f` on the board, or click a milestone in `orch view`, for its changed files by folder with `+/-` counts (live while the coder works, unsaved files included), and a file for its diff. `orch changes M2` prints the same. Read-only.
353
353
  - **Herdr's sidebar** names each agent by what it does (`codex-1 · M2 building`), set by the event manager on a separate thread, display only (Herdr 0.6.3+; `ORCH_SIDEBAR=0` turns it off). `orch view herdr-config` prints extra sidebar rows.
354
354
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.48.1
1
+ 6.48.3
Binary file
package/bin/orch CHANGED
@@ -263,6 +263,7 @@ def save(st):
263
263
  tmp = STATE.with_suffix(".tmp")
264
264
  tmp.write_text(json.dumps(st, indent=2))
265
265
  tmp.replace(STATE)
266
+ pane_labels(st)
266
267
  if _EVENTS:
267
268
  with (ORCH / "events.jsonl").open("a") as f:
268
269
  for ev in _EVENTS:
@@ -270,6 +271,49 @@ def save(st):
270
271
  _EVENTS.clear()
271
272
 
272
273
 
274
+ # ---- pane labels (6.48.2): each agent's pane says who it is and what it does, e.g. "agy-2 · coder · M3". herdr's
275
+ # `pane rename` sets a pane label (shown on the pane's border) that is separate from the agent's name, so orch still
276
+ # finds the agent by name. Only a label that changed is sent, so most saves don't call herdr at all.
277
+ PANE_LABELS = ".pane-labels.json" # in .orchestrate: the labels orch last gave each pane
278
+ PANE_LABEL_RETRY_S = 60 # an agent herdr can't find yet: try again after this long, not on every save
279
+
280
+
281
+ def pane_label_map(st):
282
+ """{agent name: its pane label} for the lead, every coder and the reviewer."""
283
+ out = {}
284
+ ld = (st.get("lead") or {}).get("name")
285
+ if ld:
286
+ out[ld] = "lead" if ld == "lead" else f"{ld} · lead"
287
+ for n, w in (st.get("workers") or {}).items():
288
+ out[n] = f"{n} · coder" + (f" · {w['task']}" if w.get("task") else "")
289
+ if st.get("reviewer"):
290
+ out[st["reviewer"]] = f"{st['reviewer']} · reviewer"
291
+ return out
292
+
293
+
294
+ def pane_labels(st, force=False):
295
+ """Give each agent's pane its label when it changed (a coder moved to another milestone, or was freed)."""
296
+ if os.environ.get("ORCH_PANE_LABELS", "1") == "0" or run_mode(st) != "panes":
297
+ return
298
+ want = pane_label_map(st)
299
+ p = ORCH / PANE_LABELS
300
+ try:
301
+ had = json.loads(p.read_text())
302
+ except (OSError, ValueError):
303
+ had = {}
304
+ now, changed = time.time(), False
305
+ for n, label in want.items():
306
+ h = had.get(n) or {}
307
+ if not force and h.get("label") == label and (h.get("ok") or now - h.get("ts", 0) < PANE_LABEL_RETRY_S):
308
+ continue
309
+ pane = agent_info(st, n).get("pane") or agent_pane(n)
310
+ ok = bool(pane) and _herdr_json([HERDR, "pane", "rename", pane, label])[0]
311
+ had[n], changed = {"label": label, "pane": pane, "ok": ok, "ts": now}, True
312
+ if changed:
313
+ with contextlib.suppress(OSError):
314
+ p.write_text(json.dumps(had))
315
+
316
+
273
317
  def fault(point):
274
318
  """Test hook: ORCH_FAULT=<point> kills orch (and the autopilot driving it) right here, like a crash."""
275
319
  if os.environ.get("ORCH_FAULT") != point:
@@ -2988,23 +3032,26 @@ def token_live(st, agent, kind, marker, start, end=None):
2988
3032
 
2989
3033
  def agent_tokens(st):
2990
3034
  """Tokens per agent (lead, each coder, the reviewer): every finished job plus the one it runs now, read live.
2991
- [{name, role, kind, in, cached, out, known, jobs, na: [why], task: running milestone, now: its tokens so far}]"""
3035
+ [{name, role, kind, in, cached, out, known, jobs, na: [why], task: running milestone, now: its tokens so far,
3036
+ per: {milestone: the same counts for its jobs on that milestone}}]"""
2992
3037
  rows, t_now = {}, now()
2993
3038
 
2994
3039
  def row(name, role, kind):
2995
3040
  if name not in rows:
2996
3041
  rows[name] = {"name": name, "role": role, "kind": kind, "in": 0, "cached": 0, "out": 0, "known": 0,
2997
- "jobs": 0, "na": [], "task": None, "now": None}
3042
+ "jobs": 0, "na": [], "task": None, "now": None, "per": {}}
2998
3043
  return rows[name]
2999
3044
 
3000
- def add(r, u):
3001
- r["jobs"] += 1
3002
- if "na" in u:
3003
- r["na"].append(u["na"])
3004
- return
3005
- r["known"] += 1
3006
- for k in ("in", "cached", "out"):
3007
- r[k] += int(u.get(k) or 0)
3045
+ def add(r, u, tid=None):
3046
+ for x in [r] + ([r["per"].setdefault(tid, {"in": 0, "cached": 0, "out": 0, "known": 0, "jobs": 0, "na": []})]
3047
+ if tid else []):
3048
+ x["jobs"] += 1
3049
+ if "na" in u:
3050
+ x["na"].append(u["na"])
3051
+ continue
3052
+ x["known"] += 1
3053
+ for k in ("in", "cached", "out"):
3054
+ x[k] += int(u.get(k) or 0)
3008
3055
  ld, run = st.get("lead") or {}, st.get("run") or {}
3009
3056
  if ld.get("name"):
3010
3057
  r = row(ld["name"], "lead", ld.get("kind"))
@@ -3033,14 +3080,14 @@ def agent_tokens(st):
3033
3080
  if t_now - a.get("end", t_now) < TOKEN_GIVE_UP_S:
3034
3081
  continue
3035
3082
  u = {"na": f"no {r['kind']} log has this job's prompt"}
3036
- add(r, u if isinstance(u, dict) else {"na": "not read"})
3083
+ add(r, u if isinstance(u, dict) else {"na": "not read"}, tid)
3037
3084
  w = t.get("wait") or {}
3038
3085
  if w.get("agent") and w.get("prompt") and t.get("status") in ACTIVE:
3039
3086
  r = row(w["agent"], "reviewer" if w.get("kind") == "reviewer" else "coder", agent_kind_of(st, w["agent"]))
3040
3087
  u = token_live(st, w["agent"], r["kind"], token_marker(w["prompt"]), w.get("started", w.get("since", 0)))
3041
3088
  r["task"], r["now"] = tid, u or {"in": 0, "cached": 0, "out": 0}
3042
3089
  if u:
3043
- add(r, u)
3090
+ add(r, u, tid)
3044
3091
  return list(rows.values())
3045
3092
 
3046
3093
 
@@ -9222,6 +9269,8 @@ def team_up(args):
9222
9269
  continue
9223
9270
  todo.append((name, w, d))
9224
9271
  if not todo:
9272
+ if not dry:
9273
+ pane_labels(st, force=True)
9225
9274
  print("TEAM UP: every agent in the plan is running")
9226
9275
  return
9227
9276
  failed, last, opened = 0, None, []
@@ -9310,6 +9359,7 @@ def team_up(args):
9310
9359
  + (f" (its last screen is in {short(saved)})" if saved else "") + ", then `orch team up` again")
9311
9360
  log_line(f"{run_tag(st)} QUIT {name}: {w.get('kind')} exited right after `orch team up` started it "
9312
9361
  f"in pane {pid}")
9362
+ pane_labels(st, force=True) # each pane says who it is: "agy-2 · coder", "rev-1 · reviewer", "lead"
9313
9363
  if tabs and not dry:
9314
9364
  print(f"TAB the team is in the herdr tab{'s' if len(tabs) > 1 else ''} " + ", ".join(f'"{t}"' for t in tabs)
9315
9365
  + ", so the lead keeps its whole screen — switch tabs to watch them (`orch team tidy` moves panes "
@@ -9477,6 +9527,8 @@ def cmd_resume(args):
9477
9527
  busy = [(tid, st["tasks"][tid]["wait"]) for tid in st["order"] if st["tasks"][tid].get("wait")]
9478
9528
  gap = account_downtime(st)
9479
9529
  save(st)
9530
+ if not from_manager:
9531
+ pane_labels(st, force=True) # a restart loses the pane labels too
9480
9532
  if from_manager and not gap:
9481
9533
  return
9482
9534
  if gap and (busy or not from_manager):
@@ -9724,6 +9776,13 @@ def view_model(st=None, recent=40):
9724
9776
  by_model.setdefault(a["model"], []).append(a["usage"])
9725
9777
  open_ev = [e for e in st.get("lead_events", []) if e.get("task") == tid and e["kind"] in LEAD_BLOCKING
9726
9778
  and event_open(st, e)]
9779
+ by_agent = {} # each agent's time and jobs on this milestone (the board's details)
9780
+ for a in atts + ([{"agent": w.get("agent"), "kind": w.get("kind"), "secs": cur}] if cur else []):
9781
+ if a.get("agent"):
9782
+ b = by_agent.setdefault(a["agent"], {"secs": 0, "jobs": 0, "review": False})
9783
+ b["secs"] += int(a.get("secs") or 0)
9784
+ b["jobs"] += 1
9785
+ b["review"] = b["review"] or a.get("kind") == "reviewer"
9727
9786
  ms.append({
9728
9787
  "id": tid, "title": t.get("title", tid), "plain": t.get("plain") or "",
9729
9788
  "desc": (t.get("plain") or t.get("title") or tid).strip(),
@@ -9741,7 +9800,7 @@ def view_model(st=None, recent=40):
9741
9800
  "attempts": [{"kind": a.get("kind"), "agent": a.get("agent"), "model": a.get("model"),
9742
9801
  "tier": a.get("tier"), "secs": a.get("secs"), "outcome": a.get("outcome")}
9743
9802
  for a in atts[-12:]],
9744
- "files": t.get("files", [])[:20],
9803
+ "files": t.get("files", [])[:20], "by_agent": by_agent,
9745
9804
  })
9746
9805
  agents = []
9747
9806
  if st.get("lead"):
@@ -9769,7 +9828,9 @@ def view_model(st=None, recent=40):
9769
9828
  steps = agent_steps(st)
9770
9829
  except Exception: # a broken plan or registry never stops the board
9771
9830
  steps = {}
9831
+ labels = pane_label_map(st)
9772
9832
  for a in agents:
9833
+ a["pane"], a["label"] = agent_info(st, a["name"]).get("pane"), labels.get(a["name"]) # the board's details
9773
9834
  sp = steps.get(a["name"])
9774
9835
  if sp and sp["task"] == a.get("task"):
9775
9836
  a["step_role"], a["skills"] = sp["role"], sp["skills"]
@@ -10686,6 +10747,11 @@ def changes_tree_lines(ch, width=100, color=True, sel=None):
10686
10747
  return out, rows
10687
10748
 
10688
10749
 
10750
+ def _named(name, role):
10751
+ """An agent's name on the board, always in full, with its job in brackets: `codex-1 (coder)`."""
10752
+ return f"{name} ({role})" if name and role else str(name or "")
10753
+
10754
+
10689
10755
  def _fmt_min(s):
10690
10756
  if s is None:
10691
10757
  return "?"
@@ -10693,7 +10759,9 @@ def _fmt_min(s):
10693
10759
  return f"{s // 3600}h {s % 3600 // 60}m" if s >= 3600 else f"{max(0, s) // 60}m"
10694
10760
 
10695
10761
 
10696
- def render_board(vm, width=100, color=True, sel=None, note=""):
10762
+ def render_board(vm, width=100, color=True, sel=None, note="", tab=None):
10763
+ """The board as lines. tab None: every part one under the other (`orch board --once`); "m", "a" or "t": the top
10764
+ lines, the tab bar and that tab only (the live board)."""
10697
10765
  def c(k, s):
10698
10766
  return f"\x1b[{_C[k]}m{s}\x1b[0m" if color and k else s
10699
10767
 
@@ -10722,17 +10790,21 @@ def render_board(vm, width=100, color=True, sel=None, note=""):
10722
10790
  if vm.get("all_done"):
10723
10791
  out.append(c("g", "ALL DONE — `orch finish` pushes the branch and opens the PR"))
10724
10792
  out += notes
10725
- out += ["", c("d", "MILESTONES")]
10793
+ if tab:
10794
+ out += ["", " ".join(c("a", f"[{i} {w}]") if k == tab else c("d", f" {i} {w} ")
10795
+ for i, (k, w) in enumerate(BOARD_TABS, 1))]
10796
+ if tab in (None, "m"):
10797
+ out += [""] + ([c("d", "MILESTONES")] if tab is None else [])
10726
10798
  ms = {m["id"]: m for m in vm["milestones"]}
10727
10799
  live_now = {r["task"]: r.get("now") for r in at if r.get("task")}
10728
- rows = board_rows(vm)
10800
+ rows = board_rows(vm, tab)
10729
10801
  picked = rows[sel] if sel is not None and sel < len(rows) else None
10730
10802
  name_w = max(18, min(34, width - 52))
10731
10803
 
10732
10804
  def line(m, pre, sub):
10733
10805
  g = m["group"]
10734
10806
  word = m["word"] + (f" {m['fix']}" if m["status"] == "needs-fix" and m.get("fix") else "")
10735
- who = m.get("worker") or ""
10807
+ who = _named(m.get("worker"), "coder")
10736
10808
  extra = (f"{_fmt_min(m['spent_s'])} of ~{_fmt_min(m['estimate_s'])}" if m.get("started")
10737
10809
  and m.get("estimate_s") else f"{_fmt_min(m['spent_s'])}" if m["spent_s"] else "")
10738
10810
  mt = m.get("tokens")
@@ -10755,33 +10827,40 @@ def render_board(vm, width=100, color=True, sel=None, note=""):
10755
10827
  if m["group"] == "needs_you" and (m.get("question") or m.get("reason")):
10756
10828
  out.append(" " + sub + c("r", cut(f"\"{m.get('question') or m.get('reason')}\"", width - len(sub) - 2)))
10757
10829
 
10758
- for tid, pre, sub in board_tree(vm):
10759
- line(ms[tid], pre, sub)
10760
- out += ["", c("d", "AGENTS")]
10761
- for i, a in enumerate(vm["agents"]):
10762
- busy = a.get("task") or a["role"] == "lead"
10763
- col = "a" if a["role"] == "lead" else ("p" if a["role"] == "reviewer" else "b") if a.get("task") else "d"
10764
- mark = "›" if picked == ("a", i) else " "
10765
- out.append(f"{mark}{c(col, '◆' if a['role'] == 'lead' else '●' if busy else '○')} "
10766
- f"{a['name']:<12} {str(a.get('kind') or ''):<8} {str(a.get('tier') or ''):<7} "
10767
- + c(col if busy else "d", (f"{a['task']} · " if a.get("task") else "") + a["state"]))
10768
- if a.get("step_role") or a.get("skills"):
10769
- sk = ", ".join(x["name"] + (f" ({x['note']})" if x.get("note") else "") for x in a.get("skills") or [])
10770
- if a.get("step_role"):
10771
- out.append(c("d", " role: ") + cut(a["step_role"], width - 11))
10772
- out.append(c("d", " skills: ") + (cut(sk, width - 13) if sk else c("d", "none for this step")))
10773
- if at:
10774
- out += ["", c("d", "TOKENS") + c("d", " read live from each agent's own log"),
10775
- c("d", f" {'':<12} {'':<8} {'in':>7} {'cached':>8} {'out':>7}")]
10776
- for r in at:
10830
+ nw_ = max([12] + [len(_named(a.get("name"), a.get("role"))) for a in (vm.get("agents") or []) + at]) # in full
10831
+
10832
+ def agents_part():
10833
+ for i, a in enumerate(vm["agents"]):
10834
+ busy = a.get("task") or a["role"] == "lead"
10835
+ col = "a" if a["role"] == "lead" else ("p" if a["role"] == "reviewer" else "b") if a.get("task") else "d"
10836
+ mark = "›" if picked == ("a", i) else " "
10837
+ out.append(f"{mark}{c(col, '◆' if a['role'] == 'lead' else '●' if busy else '○')} "
10838
+ f"{_named(a['name'], a['role']):<{nw_}} {str(a.get('kind') or ''):<8} {str(a.get('tier') or ''):<7} "
10839
+ + c(col if busy else "d", (f"{a['task']} · " if a.get("task") else "") + a["state"]))
10840
+ if a.get("step_role") or a.get("skills"):
10841
+ sk = ", ".join(x["name"] + (f" ({x['note']})" if x.get("note") else "") for x in a.get("skills") or [])
10842
+ if a.get("step_role"):
10843
+ out.append(c("d", " role: ") + cut(a["step_role"], width - 11))
10844
+ out.append(c("d", " skills: ") + (cut(sk, width - 13) if sk else c("d", "none for this step")))
10845
+
10846
+ def tokens_part():
10847
+ if not at:
10848
+ out.append(c("d", "No token counts yet: they show once an agent has done a job."))
10849
+ return
10850
+ pk = " " if tab == "t" and sel is not None else "" # picking a row: a column for the › mark
10851
+ out.extend(([c("d", "TOKENS") + c("d", " read live from each agent's own log")] if tab is None else
10852
+ [c("d", "read live from each agent's own log")])
10853
+ + [c("d", f"{pk} {'':<{nw_}} {'':<8} {'in':>7} {'cached':>8} {'out':>7}")])
10854
+ for i, r in enumerate(at):
10777
10855
  col = "a" if r["role"] == "lead" else "p" if r["role"] == "reviewer" else "b"
10778
- mark = c(col, "◆" if r["role"] == "lead" else "●" if r.get("task") else "○")
10779
- head = f"{mark} {r['name']:<12} {str(r.get('kind') or ''):<8} "
10856
+ mark = (("›" if picked == ("t", i) else " ") if pk else "") \
10857
+ + c(col, "◆" if r["role"] == "lead" else "●" if r.get("task") else "○")
10858
+ head = f"{mark} {_named(r['name'], r['role']):<{nw_}} {str(r.get('kind') or ''):<8} "
10780
10859
  if r.get("kind") and r["kind"] not in TOKEN_KINDS:
10781
10860
  out.append(head + c("d", f"n/a: orch can't read {r['kind']}'s logs yet"))
10782
10861
  continue
10783
10862
  if not r["known"] and r["na"]:
10784
- out.append(head + c("d", cut(f"n/a: {r['na'][0]}", width - 25)))
10863
+ out.append(head + c("d", cut(f"n/a: {r['na'][0]}", width - nw_ - 13)))
10785
10864
  continue
10786
10865
  if not r["known"] and not r.get("task"):
10787
10866
  out.append(head + c("d", "no jobs yet"))
@@ -10796,15 +10875,35 @@ def render_board(vm, width=100, color=True, sel=None, note=""):
10796
10875
  out.append(head + f"{_tk(r['in']):>7} {_tk(r['cached']):>8} {_tk(r['out']):>7}"
10797
10876
  + (c("d", " " + " · ".join(tnote)) if tnote else ""))
10798
10877
  tot_in, tot_out = sum(r["in"] for r in at), sum(r["out"] for r in at)
10799
- out.append(c("B", f" {'total':<21} {_tk(tot_in):>7} {_tk(sum(r['cached'] for r in at)):>8} {_tk(tot_out):>7}")
10878
+ out.append(c("B", f"{pk} {'total':<{nw_ + 9}} {_tk(tot_in):>7} {_tk(sum(r['cached'] for r in at)):>8} {_tk(tot_out):>7}")
10800
10879
  + (c("d", " + some jobs n/a") if any(r["na"] for r in at) else ""))
10801
- if vm.get("recent"):
10880
+ if tab == "t":
10881
+ per = [f"{m['id']} " + (f"{_tk(m['tokens']['total'])}{'+' if m['tokens']['partial'] else ''}"
10882
+ if m.get("tokens") and m["tokens"]["total"] else "–") for m in vm["milestones"]]
10883
+ if per:
10884
+ out.extend(["", c("d", "Per milestone: ") + cut(" · ".join(per), width - 18)])
10885
+
10886
+ if tab in (None, "m"):
10887
+ for tid, pre, sub in board_tree(vm):
10888
+ line(ms[tid], pre, sub)
10889
+ if tab in (None, "a"):
10890
+ out += ["", c("d", "AGENTS")] if tab is None else [""]
10891
+ agents_part()
10892
+ if tab == "t" or (tab is None and at):
10893
+ out.append("")
10894
+ tokens_part()
10895
+ if tab in (None, "m") and vm.get("recent"):
10802
10896
  out += ["", c("d", "LAST EVENTS")]
10803
10897
  for e in vm["recent"][:6]:
10804
10898
  out.append(c("d", time.strftime("%H:%M", time.localtime(e["ts"] or 0))) + f" {e['task']} {e['from']} → {e['to']}"
10805
10899
  + (c("d", f" {cut(e.get('why') or '', 50)}") if e.get("why") else ""))
10806
- foot = (["", c("a", note)] if note else []) + ["", c("d", "[↑↓] pick [enter] a milestone's changed files / jump "
10807
- "to an agent [f] changed files [w] web view [q] close")]
10900
+ keys = {None: "[↑↓] pick [enter] a milestone's changed files / an agent's details [f] changed files "
10901
+ "[w] web view [q] close",
10902
+ "m": "[tab ←→ 1-3] switch [↑↓] pick [enter] changed files [f] files [w] web [q] close",
10903
+ "a": "[tab ←→ 1-3] switch [↑↓] pick [enter] details ([j] there: jump to that agent) [f] files [w] web "
10904
+ "[q] close",
10905
+ "t": "[tab ←→ 1-3] switch [↑↓] pick [enter] that agent's details [f] files [w] web [q] close"}[tab]
10906
+ foot = (["", c("a", note)] if note else []) + ["", c("d", keys)]
10808
10907
  return BoardLines(out + foot, foot=len(foot))
10809
10908
 
10810
10909
 
@@ -10849,9 +10948,16 @@ def board_tree(vm):
10849
10948
  return rows
10850
10949
 
10851
10950
 
10852
- def board_rows(vm):
10853
- """What [↑↓] moves through on the board: every milestone (board order), then every agent."""
10854
- return [("m", tid) for tid, _, _ in board_tree(vm)] + [("a", i) for i in range(len(vm.get("agents", [])))]
10951
+ BOARD_TABS = (("m", "Milestones"), ("a", "Agents"), ("t", "Tokens")) # the live board's tabs (6.48.2)
10952
+
10953
+
10954
+ def board_rows(vm, tab=None):
10955
+ """What [↑↓] moves through on the board: the Milestones tab its milestones (board order), the Agents tab its
10956
+ agents, the Tokens tab its token rows; with no tab (the whole board) every milestone, then every agent."""
10957
+ ms = [("m", tid) for tid, _, _ in board_tree(vm)] if tab in (None, "m") else []
10958
+ if tab == "t":
10959
+ return [("t", i) for i in range(len(vm.get("agent_tokens") or []))]
10960
+ return ms + ([("a", i) for i in range(len(vm.get("agents", [])))] if tab in (None, "a") else [])
10855
10961
 
10856
10962
 
10857
10963
  def board_default_milestone(vm, row=None):
@@ -10872,6 +10978,85 @@ def board_default_milestone(vm, row=None):
10872
10978
  return (landed[-1] if landed else ms[0])["id"] if ms else None
10873
10979
 
10874
10980
 
10981
+ def board_agent_names(vm, tab):
10982
+ """The agent each row of the Agents or Tokens tab opens with [enter] (names, in the tab's order)."""
10983
+ return [a["name"] for a in (vm.get("agent_tokens") if tab == "t" else vm.get("agents")) or []]
10984
+
10985
+
10986
+ def render_agent(vm, name, width=100, color=True, note=""):
10987
+ """The board's detail view of one agent (6.48.3): who it is, what it does now, its tokens (in total, now and per
10988
+ milestone) and its milestones. Read from the same run summary as the board: no agent is asked anything."""
10989
+ def c(k, s):
10990
+ return f"\x1b[{_C[k]}m{s}\x1b[0m" if color and k else s
10991
+
10992
+ def cut(s, n):
10993
+ return s if len(s) <= n else s[:max(0, n - 1)] + "…"
10994
+ a = next((x for x in vm.get("agents") or [] if x["name"] == name), None) or {}
10995
+ r = next((x for x in vm.get("agent_tokens") or [] if x["name"] == name), None)
10996
+ keys = "[j] jump to its pane [f] changed files [esc ⌫ q] back"
10997
+ foot = (["", c("a", note)] if note else []) + ["", c("d", keys)]
10998
+ out = [c("a", "orch board · agent") + c("d", f" {time.strftime('%H:%M')} · live"), ""]
10999
+ if not a and not r:
11000
+ return BoardLines(out + [f"No agent named {name} in this run."] + foot, foot=len(foot))
11001
+ role, kind = a.get("role") or (r or {}).get("role") or "?", a.get("kind") or (r or {}).get("kind")
11002
+ col = "a" if role == "lead" else "p" if role == "reviewer" else "b"
11003
+ task = a.get("task") or (r or {}).get("task")
11004
+ out.append(c(col, "◆ " if role == "lead" else "● " if task else "○ ") + c("B", _named(name, role)))
11005
+ model = a.get("model") or "not known"
11006
+ rows = [("tool", kind or "not known"),
11007
+ ("model", model + (f" ({a['tier']})" if a.get("tier") else "")),
11008
+ ("state", (f"{task} · " if task and role != "lead" else "") + (a.get("state") or ("working" if task else "free")))]
11009
+ if a.get("step_role"):
11010
+ rows.append(("step role", a["step_role"]))
11011
+ if role == "coder":
11012
+ sk = ", ".join(x["name"] + (f" ({x['note']})" if x.get("note") else "") for x in a.get("skills") or [])
11013
+ rows.append(("skills", sk or "none for this step"))
11014
+ rows.append(("pane", (a.get("label") or name) + (f" (herdr pane {a['pane']})" if a.get("pane") else "")))
11015
+ out += [c("d", f" {k + ':':<11}") + cut(str(v), width - 14) for k, v in rows]
11016
+
11017
+ out += ["", c("d", "TOKENS") + c("d", " read live from its own log")]
11018
+ nums = lambda u: f"{_tk(u['in']):>7} {_tk(u['cached']):>8} {_tk(u['out']):>7}"
11019
+ if not kind:
11020
+ out.append(" n/a: orch does not know which tool this agent runs")
11021
+ elif kind not in TOKEN_KINDS:
11022
+ out.append(f" n/a: orch can't read {kind}'s logs yet, so no number is shown (never a guess)")
11023
+ elif not r or (not r["jobs"] and not r.get("task")):
11024
+ out.append(c("d", " no jobs yet"))
11025
+ else:
11026
+ out.append(c("d", f" {'':<16} {'in':>7} {'cached':>8} {'out':>7}"))
11027
+ tot = "whole run" if role == "lead" else "total"
11028
+ out.append(f" {tot:<16} " + (nums(r) if r["known"] else c("d", cut(f"n/a: {r['na'][0]}", width - 20)) if r["na"]
11029
+ else nums(r)) + (c("d", f" + {len(r['na'])} job(s) n/a") if r["known"] and r["na"] else ""))
11030
+ if r.get("task"):
11031
+ nw = r.get("now") or {}
11032
+ out.append(f" {'now (' + r['task'] + ')':<16} " + (c("d", cut(f"n/a: {nw['na']}", width - 20)) if "na" in nw
11033
+ else nums({"in": 0, "cached": 0, "out": 0, **nw})))
11034
+ order = [m["id"] for m in vm.get("milestones", [])]
11035
+ for tid in sorted(r.get("per") or {}, key=lambda t: order.index(t) if t in order else len(order)):
11036
+ u = r["per"][tid]
11037
+ out.append(f" {tid:<16} " + (nums(u) if u["known"] else c("d", cut(f"n/a: {u['na'][0]}", width - 20)))
11038
+ + (c("d", f" + {len(u['na'])} job(s) n/a: {u['na'][0]}") if u["known"] and u["na"] else ""))
11039
+ if role == "lead":
11040
+ out.append(c("d", " the lead works for the whole run, so it has no count per milestone"))
11041
+
11042
+ mine = [m for m in vm.get("milestones", []) if name in (m.get("by_agent") or {}) or m.get("worker") == name]
11043
+ landed = [m for m in mine if m["group"] == "landed"]
11044
+ out += ["", c("d", "MILESTONES") + c("d", f" {len(landed)} landed of {len(mine)}" if mine else "")]
11045
+ if not mine:
11046
+ out.append(c("d", " none yet" if role != "lead" else " the lead plans and steers; it builds no milestone"))
11047
+ tw = min(max([0] + [len(f" ○ {m['id']} {m['title']}") for m in mine]), max(20, width - 40))
11048
+ ww = max([0] + [len(m["word"]) for m in mine])
11049
+ for m in mine:
11050
+ b = (m.get("by_agent") or {}).get(name) or {"secs": 0, "jobs": 0, "review": False}
11051
+ g = m["group"]
11052
+ what = "reviewed" if b["review"] and role == "reviewer" else ""
11053
+ extra = f"{_fmt_min(b['secs'])}" + (f" · {b['jobs']} jobs" if b["jobs"] > 1 else "") + (f" · {what}" if what else "")
11054
+ head = cut(f" {_GROUP_ICON[g]} {m['id']} {m['title']}", tw).ljust(tw)
11055
+ out.append(head.replace(_GROUP_ICON[g], c(_GROUP_C[g], _GROUP_ICON[g]), 1)
11056
+ + " " + c(_GROUP_C[g], m["word"].ljust(ww)) + c("d", f" {extra}"))
11057
+ return BoardLines(out + foot, foot=len(foot))
11058
+
11059
+
10875
11060
  def board_error_lines(e, what="this run", back="[q] close"):
10876
11061
  """What the live board shows when drawing failed, instead of ending (herdr would close the popup and the error
10877
11062
  with it). The full traceback is saved for a bug report; the board tries again when the run changes."""
@@ -10907,7 +11092,7 @@ def render_changes(ch, width=100, height=40, color=True, sel=0, top=0):
10907
11092
  head = [c("a", "orch board · changed files") + c("d", f" {time.strftime('%H:%M')}"
10908
11093
  + (" · live" if ch["kind"] == "live" else "")),
10909
11094
  c(_GROUP_C.get(g, "d"), f"{_GROUP_ICON.get(g, '○')} ") + c("B", _safe(f"{ch['id']} {ch['title']}", width - 30))
10910
- + c("d", f" {VIEW_WORDS.get(ch['status'], ch['status'])}" + (f" · {ch['worker']}" if ch.get("worker") else "")),
11095
+ + c("d", f" {VIEW_WORDS.get(ch['status'], ch['status'])}" + (f" · {_named(ch['worker'], 'coder')}" if ch.get("worker") else "")),
10911
11096
  c("d", _safe(ch["note"], width))]
10912
11097
  tot = ch["totals"]
10913
11098
  if ch["files"]:
@@ -11057,14 +11242,28 @@ def cmd_changes(args):
11057
11242
 
11058
11243
 
11059
11244
  def cmd_board(args):
11060
- """orch board [--once] [--no-color] -> the run as text, redrawn when it changes (for a herdr pane or popup).
11061
- [f] or [enter] on a milestone opens its changed files, [enter] on a file its diff; q goes back one screen.
11062
- [enter] on an agent jumps to it; in the board popup (prefix+a) it also closes the popup."""
11245
+ """orch board [--once] [--tab milestones|agents|tokens] [--agent <name>] [--no-color] -> the run as text, redrawn
11246
+ when it changes (for a herdr pane or popup). Three tabs under the top lines: Milestones, Agents, Tokens ([tab],
11247
+ [←→] or 1-3). [f] or [enter] on a milestone opens its changed files, [enter] on a file its diff; q goes back one
11248
+ screen. [enter] on an agent (Agents or Tokens tab) opens its details; [j] there jumps to its pane, and in the
11249
+ board popup (prefix+a) also closes the popup. --once --agent <name> prints one agent's details."""
11063
11250
  # live needs a keyboard and a screen: with stdin or stdout not a terminal, draw once (termios would fail)
11064
11251
  once = "--once" in args or not (sys.stdout.isatty() and sys.stdin.isatty())
11065
11252
  color = "--no-color" not in args and sys.stdout.isatty() and not os.environ.get("NO_COLOR")
11253
+ tab = "m" # the live board opens on Milestones; --once prints the whole board
11254
+ if "--tab" in args:
11255
+ want = (args[args.index("--tab") + 1:] or [""])[0].lower()
11256
+ tab = next((k for k, w in BOARD_TABS if want in (k, w.lower())), None) or \
11257
+ die("usage: orch board [--once] [--tab milestones|agents|tokens]")
11066
11258
  if once:
11067
- print("\n".join(render_board(view_model(), shutil.get_terminal_size((100, 40)).columns, color)))
11259
+ vm, cols = view_model(), shutil.get_terminal_size((100, 40)).columns
11260
+ if "--agent" in args:
11261
+ name = (args[args.index("--agent") + 1:] or [""])[0]
11262
+ if name not in board_agent_names(vm, "a") + board_agent_names(vm, "t"):
11263
+ die(f"no agent named {name or '?'} in this run (`orch board --once --tab agents` lists them)")
11264
+ print("\n".join(render_agent(vm, name, cols, color)))
11265
+ return
11266
+ print("\n".join(render_board(vm, cols, color, tab=tab if "--tab" in args else None)))
11068
11267
  return
11069
11268
  import select
11070
11269
  import termios
@@ -11076,6 +11275,7 @@ def cmd_board(args):
11076
11275
  screen, vm, need, redraw = "run", {}, True, True # need: read the run (and git) again; redraw: draw again
11077
11276
  mid, ch, fsel, ftop = None, None, 0, 0 # the changed-files screen: milestone, its changes, picked file, scroll
11078
11277
  dfile, dlines, derr, dtop = None, [], None, 0 # the diff screen
11278
+ aname, back = None, "run" # the agent details screen; where q on the changed files goes
11079
11279
  try:
11080
11280
  # TCSANOW, not the default TCSAFLUSH: that throws away every key typed while the board was starting up
11081
11281
  tty.setcbreak(fd, termios.TCSANOW)
@@ -11092,14 +11292,16 @@ def cmd_board(args):
11092
11292
  if need:
11093
11293
  fetched = time.time()
11094
11294
  vm = view_model()
11095
- if screen != "run":
11295
+ if screen in ("files", "diff"):
11096
11296
  st = _board_state()
11097
11297
  ch = milestone_changes(st, mid)
11098
11298
  if screen == "diff":
11099
11299
  dlines, derr = file_diff(st, mid, dfile["path"])
11100
11300
  need = redraw = False
11101
11301
  if screen == "run":
11102
- lines = render_board(vm, size.columns, color, sel, note)
11302
+ lines = render_board(vm, size.columns, color, sel, note, tab)
11303
+ elif screen == "agent":
11304
+ lines = render_agent(vm, aname, size.columns, color, note)
11103
11305
  elif screen == "files":
11104
11306
  fsel = min(fsel, max(0, len(ch["files"]) - 1))
11105
11307
  lines, ftop = render_changes(ch, size.columns, size.lines, color, fsel, ftop)
@@ -11108,7 +11310,8 @@ def cmd_board(args):
11108
11310
  lines, dtop = render_diff(ch, f, dlines, size.columns, size.lines, color, dtop, derr)
11109
11311
  except Exception as e: # noqa: BLE001 - a popup closes when its program ends: show it, keep going
11110
11312
  need = redraw = False
11111
- lines = board_error_lines(e, "this run" if screen == "run" else f"{mid}'s changes",
11313
+ lines = board_error_lines(e, "this run" if screen == "run" else f"{aname}'s details"
11314
+ if screen == "agent" else f"{mid}'s changes",
11112
11315
  "[q] close" if screen == "run" else "[q] back")
11113
11316
  sys.stdout.write("\x1b[H\x1b[2J" + "\n".join(fit_screen(lines, size.lines)))
11114
11317
  sys.stdout.flush()
@@ -11140,7 +11343,7 @@ def cmd_board(args):
11140
11343
  ids = [m["id"] for m in vm.get("milestones", [])]
11141
11344
  n = len(ch["files"]) if ch else 0
11142
11345
  if key in ("q", "Q", "\x1b"):
11143
- screen, ch, need = "run", None, True
11346
+ screen, ch, need = back, None, True
11144
11347
  elif key in (UP, "k") and n:
11145
11348
  fsel = max(0, fsel - 1)
11146
11349
  elif key in (DOWN, "j") and n:
@@ -11152,11 +11355,41 @@ def cmd_board(args):
11152
11355
  dfile, dtop, screen, need = ch["files"][fsel], 0, "diff", True
11153
11356
  redraw = True
11154
11357
  continue
11155
- rows = board_rows(vm)
11358
+ if screen == "agent":
11359
+ if key in ("q", "Q", "\x1b", "\x7f", "\x08", LEFT, "h"):
11360
+ screen, note, back = "run", "", "run"
11361
+ elif key in ("j", "J"):
11362
+ r2 = subprocess.run([HERDR, "agent", "focus", aname], text=True, capture_output=True)
11363
+ if r2.returncode == 0 and os.environ.get("HERDR_PLUGIN_ID") == VIEW_PLUGIN_ID:
11364
+ closed_by = f"j (jumped to {aname})" # in the popup: get out of the way of the agent
11365
+ break
11366
+ rl = next((x.get("role") for x in (vm.get("agents") or []) + (vm.get("agent_tokens") or [])
11367
+ if x["name"] == aname), None)
11368
+ note = f"{'jumped to' if r2.returncode == 0 else 'herdr could not focus'} {_named(aname, rl)}"
11369
+ elif key in ("f", "F"):
11370
+ a = next((x for x in vm.get("agents") or [] if x["name"] == aname), {})
11371
+ mine = [m["id"] for m in vm.get("milestones", []) if aname in (m.get("by_agent") or {})]
11372
+ mid = a.get("task") or (mine[-1] if mine else None)
11373
+ if mid:
11374
+ screen, back, ch, fsel, ftop, need = "files", "agent", None, 0, 0, True
11375
+ else:
11376
+ note = f"{aname} has no milestone yet"
11377
+ redraw = True
11378
+ continue
11379
+ rows = board_rows(vm, tab)
11156
11380
  n = len(rows)
11157
11381
  if key in ("q", "Q", "\x1b"):
11158
11382
  closed_by = repr(key)
11159
11383
  break
11384
+ tabs = [k for k, _ in BOARD_TABS]
11385
+ to = {"1": 0, "2": 1, "3": 2}.get(key)
11386
+ if to is None and key in ("\t", RIGHT, "\x1b[Z", LEFT):
11387
+ to = (tabs.index(tab) + (1 if key in ("\t", RIGHT) else -1)) % len(tabs)
11388
+ if to is not None:
11389
+ if tabs[to] != tab:
11390
+ tab, sel, note = tabs[to], None, ""
11391
+ redraw = True
11392
+ continue
11160
11393
  if key in (UP, "k"):
11161
11394
  sel = (n - 1 if sel is None else max(0, sel - 1)) if n else None
11162
11395
  elif key in (DOWN, "j"):
@@ -11167,13 +11400,10 @@ def cmd_board(args):
11167
11400
  screen, ch, fsel, ftop, need = "files", None, 0, 0, True
11168
11401
  else:
11169
11402
  note = "no milestones in this run yet"
11170
- elif key in ("\r", "\n") and sel is not None and n:
11171
- a = vm["agents"][rows[sel][1]]
11172
- r2 = subprocess.run([HERDR, "agent", "focus", a["name"]], text=True, capture_output=True)
11173
- if r2.returncode == 0 and os.environ.get("HERDR_PLUGIN_ID") == VIEW_PLUGIN_ID:
11174
- closed_by = f"enter (jumped to {a['name']})" # in the popup: get out of the way of the agent
11175
- break
11176
- note = f"jumped to {a['name']}" if r2.returncode == 0 else f"herdr could not focus {a['name']}"
11403
+ elif key in ("\r", "\n") and sel is not None and sel < n: # an agent (Agents or Tokens tab)
11404
+ names = board_agent_names(vm, "t" if rows[sel][0] == "t" else "a")
11405
+ if rows[sel][1] < len(names):
11406
+ aname, screen, note = names[rows[sel][1]], "agent", ""
11177
11407
  elif key in ("w", "W"):
11178
11408
  r2 = subprocess.run([sys.executable, os.path.abspath(__file__), "view", "--bg"], text=True,
11179
11409
  capture_output=True, cwd=ROOT)
@@ -11296,8 +11526,10 @@ USAGE = """usage: orch <command> [args]
11296
11526
  "needs you" alert, time and cost, replay. --lan: also from your phone, with a secret link
11297
11527
  view stop|status|herdr-config|plugin link|key|unlink|refresh|app link|unlink
11298
11528
  stop it / show its link / sidebar lines for herdr's config / the optional herdr plugin
11299
- board [--once] the run as text, redrawn when it changes: for a herdr pane or popup (any terminal);
11300
- [f] or [enter] on a milestone shows its changed files, [enter] on a file its diff
11529
+ board [--once] [--tab milestones|agents|tokens] [--agent <name>] the run as text, redrawn when it changes: for
11530
+ a herdr pane or popup (any terminal); tabs Milestones, Agents, Tokens ([tab], [←→] or 1-3);
11531
+ [f] or [enter] on a milestone shows its changed files, [enter] on a file its diff;
11532
+ [enter] on an agent its details (tokens, milestones), [j] there jumps to its pane
11301
11533
  changes [Mn [file]] [--json] what each milestone changed: files with +/- counts, or one file's diff
11302
11534
  (live while a coder works, unsaved files included; landed = its commit). Read-only
11303
11535
  report [--json] [--no-tokens] estimate vs actual time (why longer, who), tokens per milestone, rounds,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herdr-orchestra",
3
- "version": "6.48.1",
3
+ "version": "6.48.3",
4
4
  "description": "Orchestrate AI coding agents (Claude Code, Codex, OpenCode, Amp, Pi) as one team: a lead plans, coders build, a reviewer checks, you get one PR. Runs in Herdr panes, or in one Pi window with subagents.",
5
5
  "license": "MIT",
6
6
  "bin": {