herdr-orchestra 6.48.2 → 6.48.4

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,58 @@
2
2
 
3
3
  All notable changes. Versions follow [semantic versioning](https://semver.org).
4
4
 
5
+ ## [6.48.4] - 2026-12-03
6
+
7
+ The board's Tokens tab has a new **fresh** column: in minus cached, the part the agent read new. A coder can show "10.8M in" and look very costly, but most of that is its own chat read again from the cache, which costs much less. Fresh shows the part that really costs. It is in each agent's row, the total row, the top line (`tokens 257k so far · fresh 57k`), the agent details (total, now and each milestone) and the browser view's tokens per agent. The numbers are the ones the board already reads from each agent's own log, so no agent spends a single extra token. A tool whose log gives no cached number shows fresh as "n/a", and the total fresh then reads "at least" (`57k+`).
8
+
9
+ Example (Tokens tab):
10
+ ```
11
+ in cached fresh out
12
+ ◆ lead-1 (lead) codex 50k 30k 20k 4k
13
+ ○ claude-1 (coder) claude 36k 32k 4k 3k
14
+ ○ agy-3 (coder) agy 4k 0 n/a 300
15
+ total 90k 62k 24k+ 7k
16
+ fresh = in minus cached: what the agent read new. Cached is its own chat read again, much cheaper.
17
+ ```
18
+
19
+ ## [6.48.3] - 2026-12-02
20
+
21
+ `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.
22
+
23
+ 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.
24
+
25
+ Example (Enter on codex-1):
26
+ ```
27
+ orch board · agent 18:47 · live
28
+
29
+ ● codex-1 (coder)
30
+ tool: codex
31
+ model: gpt-6.2-sol (medium)
32
+ state: M2 · building
33
+ step role: senior frontend engineer
34
+ pane: codex-1 · coder · M2
35
+
36
+ TOKENS read live from its own log
37
+ in cached out
38
+ total 100k 76k 7k
39
+ now (M2) 40k 30k 4k
40
+ M2 40k 30k 4k
41
+ M3 60k 46k 3k
42
+
43
+ MILESTONES 1 landed of 2
44
+ ● M2 Card building 1m
45
+ ✔ M3 Codex step landed 8m
46
+
47
+ [j] jump to its pane [f] changed files [esc ⌫ q] back
48
+ ```
49
+
50
+ ### Changed
51
+ - 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.
52
+
53
+ ### Added
54
+ - `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.
55
+ - Every agent name on the board shows its job in brackets.
56
+
5
57
  ## [6.48.2] - 2026-12-02
6
58
 
7
59
  `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.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.48.2
1
+ 6.48.4
Binary file
package/bin/orch CHANGED
@@ -2652,6 +2652,16 @@ def token_log_find(kind, marker, since, known=()):
2652
2652
  return None
2653
2653
 
2654
2654
 
2655
+ def _nc(u):
2656
+ return {"nocache": True} if u.get("nocache") else {}
2657
+
2658
+
2659
+ def _fresh(u):
2660
+ """Fresh = in minus cached: what the agent read new (the cached part is its own chat read again, much cheaper).
2661
+ None when the tool's log gives no cached number."""
2662
+ return None if u.get("nocache") else max(0, int(u.get("in") or 0) - int(u.get("cached") or 0))
2663
+
2664
+
2655
2665
  def _tok_add(acc, ts, start, end, inp, cached, out):
2656
2666
  if ts is None or ts < start or ts > end:
2657
2667
  return
@@ -2666,7 +2676,7 @@ def token_window(kind, path, start, end):
2666
2676
  Raises TokenNA when the log has no token counts at all."""
2667
2677
  acc = {"in": 0, "cached": 0, "out": 0, "replies": 0}
2668
2678
  text = _tok_text(path)
2669
- seen_counts = False
2679
+ seen_counts = seen_cache = False
2670
2680
  if kind == "claude":
2671
2681
  files = [text] + [_tok_text(s) for s in sorted((Path(path).with_suffix("") / "subagents").glob("*.jsonl"))]
2672
2682
  for tx in files:
@@ -2677,6 +2687,7 @@ def token_window(kind, path, start, end):
2677
2687
  if d.get("type") != "assistant" or not isinstance(u, dict):
2678
2688
  continue
2679
2689
  seen_counts = True
2690
+ seen_cache |= "cache_read_input_tokens" in u
2680
2691
  key = (m.get("id"), d.get("requestId")) if m.get("id") else d.get("uuid") or id(d)
2681
2692
  ts = _tok_ts(d.get("timestamp"))
2682
2693
  row = (int(u.get("input_tokens") or 0) + int(u.get("cache_creation_input_tokens") or 0)
@@ -2696,6 +2707,7 @@ def token_window(kind, path, start, end):
2696
2707
  if not isinstance(tot, dict):
2697
2708
  continue
2698
2709
  seen_counts = True
2710
+ seen_cache |= "cached_input_tokens" in tot
2699
2711
  ts = _tok_ts(d.get("timestamp"))
2700
2712
  if ts is None:
2701
2713
  continue
@@ -2719,6 +2731,7 @@ def token_window(kind, path, start, end):
2719
2731
  if not isinstance(u, dict) or d.get("type") == "message" and m.get("role") != "assistant":
2720
2732
  continue
2721
2733
  seen_counts = True
2734
+ seen_cache |= "cacheRead" in u
2722
2735
  _tok_add(acc, _tok_ts(d.get("timestamp")) or _tok_ts(m.get("timestamp")), start, end,
2723
2736
  int(u.get("input") or 0) + int(u.get("cacheRead") or 0) + int(u.get("cacheWrite") or 0),
2724
2737
  u.get("cacheRead"), u.get("output"))
@@ -2730,6 +2743,7 @@ def token_window(kind, path, start, end):
2730
2743
  if not any(k in d for k in ("input_tokens", "output_tokens")):
2731
2744
  continue
2732
2745
  seen_counts = True
2746
+ seen_cache |= "cache_read_tokens" in d
2733
2747
  _tok_add(acc, _tok_ts(d.get("created_at")), start, end,
2734
2748
  int(d.get("input_tokens") or 0) + int(d.get("cache_read_tokens") or 0),
2735
2749
  d.get("cache_read_tokens"), d.get("output_tokens"))
@@ -2739,6 +2753,8 @@ def token_window(kind, path, start, end):
2739
2753
  raise TokenNA(f"orch can't read {kind}'s logs")
2740
2754
  if not seen_counts:
2741
2755
  raise TokenNA(f"{kind}'s log has no token counts")
2756
+ if not seen_cache:
2757
+ acc["nocache"] = True # the log gives no cached number: "fresh" (in minus cached) shows n/a
2742
2758
  return acc
2743
2759
 
2744
2760
 
@@ -2779,7 +2795,7 @@ def token_measure(st, agent, kind, marker, start, end, cap=None):
2779
2795
  logs[agent] = (known + [path])[-6:]
2780
2796
  if not acc["replies"]:
2781
2797
  return None if now() - end < TOKEN_GIVE_UP_S else {"na": "no replies in the log during this job"}
2782
- return {"in": acc["in"], "cached": acc["cached"], "out": acc["out"], "log": kind}
2798
+ return {"in": acc["in"], "cached": acc["cached"], "out": acc["out"], "log": kind, **_nc(acc)}
2783
2799
 
2784
2800
 
2785
2801
  def token_fill(st, force=False):
@@ -2878,6 +2894,7 @@ def _tok_merge(rows):
2878
2894
  acc["na"].append((u or {}).get("na") if isinstance(u, dict) else "not read yet")
2879
2895
  continue
2880
2896
  acc["known"] += 1
2897
+ acc.update(_nc(u))
2881
2898
  for k in ("in", "cached", "out"):
2882
2899
  acc[k] += int(u.get(k) or 0)
2883
2900
  return acc
@@ -2942,6 +2959,11 @@ def _tk(n):
2942
2959
  return f"{n / 1e6:.1f}M" if n >= 1_000_000 else f"{round(n / 1000)}k" if n >= 1000 else str(n)
2943
2960
 
2944
2961
 
2962
+ def _tkf(u):
2963
+ f = _fresh(u)
2964
+ return "n/a" if f is None else _tk(f)
2965
+
2966
+
2945
2967
  def _tok_cell(u, who=""):
2946
2968
  if not u:
2947
2969
  return "-"
@@ -3021,7 +3043,7 @@ def token_live(st, agent, kind, marker, start, end=None):
3021
3043
  return hit[1]
3022
3044
  try:
3023
3045
  acc = token_window(kind, path, start, end + 1 if end else float("inf"))
3024
- r = {"in": acc["in"], "cached": acc["cached"], "out": acc["out"]} if acc["replies"] else None
3046
+ r = {"in": acc["in"], "cached": acc["cached"], "out": acc["out"], **_nc(acc)} if acc["replies"] else None
3025
3047
  except TokenNA as e:
3026
3048
  r = {"na": str(e)}
3027
3049
  _LIVE_WIN[key] = (sig, r)
@@ -3032,23 +3054,27 @@ def token_live(st, agent, kind, marker, start, end=None):
3032
3054
 
3033
3055
  def agent_tokens(st):
3034
3056
  """Tokens per agent (lead, each coder, the reviewer): every finished job plus the one it runs now, read live.
3035
- [{name, role, kind, in, cached, out, known, jobs, na: [why], task: running milestone, now: its tokens so far}]"""
3057
+ [{name, role, kind, in, cached, out, known, jobs, na: [why], task: running milestone, now: its tokens so far,
3058
+ per: {milestone: the same counts for its jobs on that milestone}}]"""
3036
3059
  rows, t_now = {}, now()
3037
3060
 
3038
3061
  def row(name, role, kind):
3039
3062
  if name not in rows:
3040
3063
  rows[name] = {"name": name, "role": role, "kind": kind, "in": 0, "cached": 0, "out": 0, "known": 0,
3041
- "jobs": 0, "na": [], "task": None, "now": None}
3064
+ "jobs": 0, "na": [], "task": None, "now": None, "per": {}}
3042
3065
  return rows[name]
3043
3066
 
3044
- def add(r, u):
3045
- r["jobs"] += 1
3046
- if "na" in u:
3047
- r["na"].append(u["na"])
3048
- return
3049
- r["known"] += 1
3050
- for k in ("in", "cached", "out"):
3051
- r[k] += int(u.get(k) or 0)
3067
+ def add(r, u, tid=None):
3068
+ for x in [r] + ([r["per"].setdefault(tid, {"in": 0, "cached": 0, "out": 0, "known": 0, "jobs": 0, "na": []})]
3069
+ if tid else []):
3070
+ x["jobs"] += 1
3071
+ if "na" in u:
3072
+ x["na"].append(u["na"])
3073
+ continue
3074
+ x["known"] += 1
3075
+ x.update(_nc(u))
3076
+ for k in ("in", "cached", "out"):
3077
+ x[k] += int(u.get(k) or 0)
3052
3078
  ld, run = st.get("lead") or {}, st.get("run") or {}
3053
3079
  if ld.get("name"):
3054
3080
  r = row(ld["name"], "lead", ld.get("kind"))
@@ -3077,14 +3103,14 @@ def agent_tokens(st):
3077
3103
  if t_now - a.get("end", t_now) < TOKEN_GIVE_UP_S:
3078
3104
  continue
3079
3105
  u = {"na": f"no {r['kind']} log has this job's prompt"}
3080
- add(r, u if isinstance(u, dict) else {"na": "not read"})
3106
+ add(r, u if isinstance(u, dict) else {"na": "not read"}, tid)
3081
3107
  w = t.get("wait") or {}
3082
3108
  if w.get("agent") and w.get("prompt") and t.get("status") in ACTIVE:
3083
3109
  r = row(w["agent"], "reviewer" if w.get("kind") == "reviewer" else "coder", agent_kind_of(st, w["agent"]))
3084
3110
  u = token_live(st, w["agent"], r["kind"], token_marker(w["prompt"]), w.get("started", w.get("since", 0)))
3085
3111
  r["task"], r["now"] = tid, u or {"in": 0, "cached": 0, "out": 0}
3086
3112
  if u:
3087
- add(r, u)
3113
+ add(r, u, tid)
3088
3114
  return list(rows.values())
3089
3115
 
3090
3116
 
@@ -9773,6 +9799,13 @@ def view_model(st=None, recent=40):
9773
9799
  by_model.setdefault(a["model"], []).append(a["usage"])
9774
9800
  open_ev = [e for e in st.get("lead_events", []) if e.get("task") == tid and e["kind"] in LEAD_BLOCKING
9775
9801
  and event_open(st, e)]
9802
+ by_agent = {} # each agent's time and jobs on this milestone (the board's details)
9803
+ for a in atts + ([{"agent": w.get("agent"), "kind": w.get("kind"), "secs": cur}] if cur else []):
9804
+ if a.get("agent"):
9805
+ b = by_agent.setdefault(a["agent"], {"secs": 0, "jobs": 0, "review": False})
9806
+ b["secs"] += int(a.get("secs") or 0)
9807
+ b["jobs"] += 1
9808
+ b["review"] = b["review"] or a.get("kind") == "reviewer"
9776
9809
  ms.append({
9777
9810
  "id": tid, "title": t.get("title", tid), "plain": t.get("plain") or "",
9778
9811
  "desc": (t.get("plain") or t.get("title") or tid).strip(),
@@ -9790,7 +9823,7 @@ def view_model(st=None, recent=40):
9790
9823
  "attempts": [{"kind": a.get("kind"), "agent": a.get("agent"), "model": a.get("model"),
9791
9824
  "tier": a.get("tier"), "secs": a.get("secs"), "outcome": a.get("outcome")}
9792
9825
  for a in atts[-12:]],
9793
- "files": t.get("files", [])[:20],
9826
+ "files": t.get("files", [])[:20], "by_agent": by_agent,
9794
9827
  })
9795
9828
  agents = []
9796
9829
  if st.get("lead"):
@@ -9818,7 +9851,9 @@ def view_model(st=None, recent=40):
9818
9851
  steps = agent_steps(st)
9819
9852
  except Exception: # a broken plan or registry never stops the board
9820
9853
  steps = {}
9854
+ labels = pane_label_map(st)
9821
9855
  for a in agents:
9856
+ a["pane"], a["label"] = agent_info(st, a["name"]).get("pane"), labels.get(a["name"]) # the board's details
9822
9857
  sp = steps.get(a["name"])
9823
9858
  if sp and sp["task"] == a.get("task"):
9824
9859
  a["step_role"], a["skills"] = sp["role"], sp["skills"]
@@ -10735,6 +10770,11 @@ def changes_tree_lines(ch, width=100, color=True, sel=None):
10735
10770
  return out, rows
10736
10771
 
10737
10772
 
10773
+ def _named(name, role):
10774
+ """An agent's name on the board, always in full, with its job in brackets: `codex-1 (coder)`."""
10775
+ return f"{name} ({role})" if name and role else str(name or "")
10776
+
10777
+
10738
10778
  def _fmt_min(s):
10739
10779
  if s is None:
10740
10780
  return "?"
@@ -10767,7 +10807,11 @@ def render_board(vm, width=100, color=True, sel=None, note="", tab=None):
10767
10807
  tk["partial"] = any(r["na"] for r in at)
10768
10808
  if tk.get("total") or tk.get("lead"):
10769
10809
  ld = tk.get("lead") or {}
10770
- out.append(c("d", f"tokens {_tk(tk.get('total'))}{'+' if tk.get('partial') else ''} so far"
10810
+ kn = [r for r in at if r["known"]]
10811
+ fr = ("" if not kn else " · fresh n/a" if all(r.get("nocache") for r in kn) else
10812
+ f" · fresh {_tk(sum(_fresh(r) or 0 for r in kn))}"
10813
+ f"{'+' if tk.get('partial') or any(r.get('nocache') for r in kn) else ''}")
10814
+ out.append(c("d", f"tokens {_tk(tk.get('total'))}{'+' if tk.get('partial') else ''} so far{fr}"
10771
10815
  + (f" · lead {_tk(ld['total'])}" if ld.get("total") else
10772
10816
  " · lead: not available" if ld.get("na") else "")))
10773
10817
  if vm.get("all_done"):
@@ -10787,7 +10831,7 @@ def render_board(vm, width=100, color=True, sel=None, note="", tab=None):
10787
10831
  def line(m, pre, sub):
10788
10832
  g = m["group"]
10789
10833
  word = m["word"] + (f" {m['fix']}" if m["status"] == "needs-fix" and m.get("fix") else "")
10790
- who = m.get("worker") or ""
10834
+ who = _named(m.get("worker"), "coder")
10791
10835
  extra = (f"{_fmt_min(m['spent_s'])} of ~{_fmt_min(m['estimate_s'])}" if m.get("started")
10792
10836
  and m.get("estimate_s") else f"{_fmt_min(m['spent_s'])}" if m["spent_s"] else "")
10793
10837
  mt = m.get("tokens")
@@ -10810,7 +10854,7 @@ def render_board(vm, width=100, color=True, sel=None, note="", tab=None):
10810
10854
  if m["group"] == "needs_you" and (m.get("question") or m.get("reason")):
10811
10855
  out.append(" " + sub + c("r", cut(f"\"{m.get('question') or m.get('reason')}\"", width - len(sub) - 2)))
10812
10856
 
10813
- nw_ = max([12] + [len(str(a.get("name") or "")) for a in (vm.get("agents") or []) + at]) # names in full
10857
+ nw_ = max([12] + [len(_named(a.get("name"), a.get("role"))) for a in (vm.get("agents") or []) + at]) # in full
10814
10858
 
10815
10859
  def agents_part():
10816
10860
  for i, a in enumerate(vm["agents"]):
@@ -10818,7 +10862,7 @@ def render_board(vm, width=100, color=True, sel=None, note="", tab=None):
10818
10862
  col = "a" if a["role"] == "lead" else ("p" if a["role"] == "reviewer" else "b") if a.get("task") else "d"
10819
10863
  mark = "›" if picked == ("a", i) else " "
10820
10864
  out.append(f"{mark}{c(col, '◆' if a['role'] == 'lead' else '●' if busy else '○')} "
10821
- f"{a['name']:<{nw_}} {str(a.get('kind') or ''):<8} {str(a.get('tier') or ''):<7} "
10865
+ f"{_named(a['name'], a['role']):<{nw_}} {str(a.get('kind') or ''):<8} {str(a.get('tier') or ''):<7} "
10822
10866
  + c(col if busy else "d", (f"{a['task']} · " if a.get("task") else "") + a["state"]))
10823
10867
  if a.get("step_role") or a.get("skills"):
10824
10868
  sk = ", ".join(x["name"] + (f" ({x['note']})" if x.get("note") else "") for x in a.get("skills") or [])
@@ -10830,13 +10874,15 @@ def render_board(vm, width=100, color=True, sel=None, note="", tab=None):
10830
10874
  if not at:
10831
10875
  out.append(c("d", "No token counts yet: they show once an agent has done a job."))
10832
10876
  return
10877
+ pk = " " if tab == "t" and sel is not None else "" # picking a row: a column for the › mark
10833
10878
  out.extend(([c("d", "TOKENS") + c("d", " read live from each agent's own log")] if tab is None else
10834
10879
  [c("d", "read live from each agent's own log")])
10835
- + [c("d", f" {'':<{nw_}} {'':<8} {'in':>7} {'cached':>8} {'out':>7}")])
10836
- for r in at:
10880
+ + [c("d", f"{pk} {'':<{nw_}} {'':<8} {'in':>7} {'cached':>8} {'fresh':>7} {'out':>7}")])
10881
+ for i, r in enumerate(at):
10837
10882
  col = "a" if r["role"] == "lead" else "p" if r["role"] == "reviewer" else "b"
10838
- mark = c(col, "◆" if r["role"] == "lead" else "●" if r.get("task") else "○")
10839
- head = f"{mark} {r['name']:<{nw_}} {str(r.get('kind') or ''):<8} "
10883
+ mark = (("›" if picked == ("t", i) else " ") if pk else "") \
10884
+ + c(col, "◆" if r["role"] == "lead" else "●" if r.get("task") else "○")
10885
+ head = f"{mark} {_named(r['name'], r['role']):<{nw_}} {str(r.get('kind') or ''):<8} "
10840
10886
  if r.get("kind") and r["kind"] not in TOKEN_KINDS:
10841
10887
  out.append(head + c("d", f"n/a: orch can't read {r['kind']}'s logs yet"))
10842
10888
  continue
@@ -10853,12 +10899,17 @@ def render_board(vm, width=100, color=True, sel=None, note="", tab=None):
10853
10899
  f"{r['task']} now n/a")
10854
10900
  if r["na"]:
10855
10901
  tnote.append(f"+ {len(r['na'])} job(s) n/a")
10856
- out.append(head + f"{_tk(r['in']):>7} {_tk(r['cached']):>8} {_tk(r['out']):>7}"
10902
+ out.append(head + f"{_tk(r['in']):>7} {_tk(r['cached']):>8} {_tkf(r):>7} {_tk(r['out']):>7}"
10857
10903
  + (c("d", " " + " · ".join(tnote)) if tnote else ""))
10858
10904
  tot_in, tot_out = sum(r["in"] for r in at), sum(r["out"] for r in at)
10859
- out.append(c("B", f" {'total':<{nw_ + 9}} {_tk(tot_in):>7} {_tk(sum(r['cached'] for r in at)):>8} {_tk(tot_out):>7}")
10905
+ kn = [r for r in at if r["known"]]
10906
+ tfr = "n/a" if kn and all(r.get("nocache") for r in kn) else \
10907
+ _tk(sum(_fresh(r) or 0 for r in kn)) + ("+" if any(r.get("nocache") for r in kn) else "")
10908
+ out.append(c("B", f"{pk} {'total':<{nw_ + 9}} {_tk(tot_in):>7} {_tk(sum(r['cached'] for r in at)):>8} {tfr:>7} {_tk(tot_out):>7}")
10860
10909
  + (c("d", " + some jobs n/a") if any(r["na"] for r in at) else ""))
10861
10910
  if tab == "t":
10911
+ out.append(c("d", "fresh = in minus cached: what the agent read new. Cached is its own chat read again, "
10912
+ "much cheaper."))
10862
10913
  per = [f"{m['id']} " + (f"{_tk(m['tokens']['total'])}{'+' if m['tokens']['partial'] else ''}"
10863
10914
  if m.get("tokens") and m["tokens"]["total"] else "–") for m in vm["milestones"]]
10864
10915
  if per:
@@ -10878,11 +10929,12 @@ def render_board(vm, width=100, color=True, sel=None, note="", tab=None):
10878
10929
  for e in vm["recent"][:6]:
10879
10930
  out.append(c("d", time.strftime("%H:%M", time.localtime(e["ts"] or 0))) + f" {e['task']} {e['from']} → {e['to']}"
10880
10931
  + (c("d", f" {cut(e.get('why') or '', 50)}") if e.get("why") else ""))
10881
- keys = {None: "[↑↓] pick [enter] a milestone's changed files / jump to an agent [f] changed files [w] web view "
10882
- "[q] close",
10932
+ keys = {None: "[↑↓] pick [enter] a milestone's changed files / an agent's details [f] changed files "
10933
+ "[w] web view [q] close",
10883
10934
  "m": "[tab ←→ 1-3] switch [↑↓] pick [enter] changed files [f] files [w] web [q] close",
10884
- "a": "[tab ←→ 1-3] switch [↑↓] pick [enter] jump to that agent [f] files [w] web [q] close",
10885
- "t": "[tab ←→ 1-3] switch [f] files [w] web [q] close"}[tab]
10935
+ "a": "[tab ←→ 1-3] switch [↑↓] pick [enter] details ([j] there: jump to that agent) [f] files [w] web "
10936
+ "[q] close",
10937
+ "t": "[tab ←→ 1-3] switch [↑↓] pick [enter] that agent's details [f] files [w] web [q] close"}[tab]
10886
10938
  foot = (["", c("a", note)] if note else []) + ["", c("d", keys)]
10887
10939
  return BoardLines(out + foot, foot=len(foot))
10888
10940
 
@@ -10933,8 +10985,10 @@ BOARD_TABS = (("m", "Milestones"), ("a", "Agents"), ("t", "Tokens")) # the liv
10933
10985
 
10934
10986
  def board_rows(vm, tab=None):
10935
10987
  """What [↑↓] moves through on the board: the Milestones tab its milestones (board order), the Agents tab its
10936
- agents, the Tokens tab nothing; with no tab (the whole board) every milestone, then every agent."""
10988
+ agents, the Tokens tab its token rows; with no tab (the whole board) every milestone, then every agent."""
10937
10989
  ms = [("m", tid) for tid, _, _ in board_tree(vm)] if tab in (None, "m") else []
10990
+ if tab == "t":
10991
+ return [("t", i) for i in range(len(vm.get("agent_tokens") or []))]
10938
10992
  return ms + ([("a", i) for i in range(len(vm.get("agents", [])))] if tab in (None, "a") else [])
10939
10993
 
10940
10994
 
@@ -10956,6 +11010,85 @@ def board_default_milestone(vm, row=None):
10956
11010
  return (landed[-1] if landed else ms[0])["id"] if ms else None
10957
11011
 
10958
11012
 
11013
+ def board_agent_names(vm, tab):
11014
+ """The agent each row of the Agents or Tokens tab opens with [enter] (names, in the tab's order)."""
11015
+ return [a["name"] for a in (vm.get("agent_tokens") if tab == "t" else vm.get("agents")) or []]
11016
+
11017
+
11018
+ def render_agent(vm, name, width=100, color=True, note=""):
11019
+ """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
11020
+ milestone) and its milestones. Read from the same run summary as the board: no agent is asked anything."""
11021
+ def c(k, s):
11022
+ return f"\x1b[{_C[k]}m{s}\x1b[0m" if color and k else s
11023
+
11024
+ def cut(s, n):
11025
+ return s if len(s) <= n else s[:max(0, n - 1)] + "…"
11026
+ a = next((x for x in vm.get("agents") or [] if x["name"] == name), None) or {}
11027
+ r = next((x for x in vm.get("agent_tokens") or [] if x["name"] == name), None)
11028
+ keys = "[j] jump to its pane [f] changed files [esc ⌫ q] back"
11029
+ foot = (["", c("a", note)] if note else []) + ["", c("d", keys)]
11030
+ out = [c("a", "orch board · agent") + c("d", f" {time.strftime('%H:%M')} · live"), ""]
11031
+ if not a and not r:
11032
+ return BoardLines(out + [f"No agent named {name} in this run."] + foot, foot=len(foot))
11033
+ role, kind = a.get("role") or (r or {}).get("role") or "?", a.get("kind") or (r or {}).get("kind")
11034
+ col = "a" if role == "lead" else "p" if role == "reviewer" else "b"
11035
+ task = a.get("task") or (r or {}).get("task")
11036
+ out.append(c(col, "◆ " if role == "lead" else "● " if task else "○ ") + c("B", _named(name, role)))
11037
+ model = a.get("model") or "not known"
11038
+ rows = [("tool", kind or "not known"),
11039
+ ("model", model + (f" ({a['tier']})" if a.get("tier") else "")),
11040
+ ("state", (f"{task} · " if task and role != "lead" else "") + (a.get("state") or ("working" if task else "free")))]
11041
+ if a.get("step_role"):
11042
+ rows.append(("step role", a["step_role"]))
11043
+ if role == "coder":
11044
+ sk = ", ".join(x["name"] + (f" ({x['note']})" if x.get("note") else "") for x in a.get("skills") or [])
11045
+ rows.append(("skills", sk or "none for this step"))
11046
+ rows.append(("pane", (a.get("label") or name) + (f" (herdr pane {a['pane']})" if a.get("pane") else "")))
11047
+ out += [c("d", f" {k + ':':<11}") + cut(str(v), width - 14) for k, v in rows]
11048
+
11049
+ out += ["", c("d", "TOKENS") + c("d", " read live from its own log · fresh = in minus cached (read new)")]
11050
+ nums = lambda u: f"{_tk(u['in']):>7} {_tk(u['cached']):>8} {_tkf(u):>7} {_tk(u['out']):>7}"
11051
+ if not kind:
11052
+ out.append(" n/a: orch does not know which tool this agent runs")
11053
+ elif kind not in TOKEN_KINDS:
11054
+ out.append(f" n/a: orch can't read {kind}'s logs yet, so no number is shown (never a guess)")
11055
+ elif not r or (not r["jobs"] and not r.get("task")):
11056
+ out.append(c("d", " no jobs yet"))
11057
+ else:
11058
+ out.append(c("d", f" {'':<16} {'in':>7} {'cached':>8} {'fresh':>7} {'out':>7}"))
11059
+ tot = "whole run" if role == "lead" else "total"
11060
+ 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"]
11061
+ else nums(r)) + (c("d", f" + {len(r['na'])} job(s) n/a") if r["known"] and r["na"] else ""))
11062
+ if r.get("task"):
11063
+ nw = r.get("now") or {}
11064
+ out.append(f" {'now (' + r['task'] + ')':<16} " + (c("d", cut(f"n/a: {nw['na']}", width - 20)) if "na" in nw
11065
+ else nums({"in": 0, "cached": 0, "out": 0, **nw})))
11066
+ order = [m["id"] for m in vm.get("milestones", [])]
11067
+ for tid in sorted(r.get("per") or {}, key=lambda t: order.index(t) if t in order else len(order)):
11068
+ u = r["per"][tid]
11069
+ out.append(f" {tid:<16} " + (nums(u) if u["known"] else c("d", cut(f"n/a: {u['na'][0]}", width - 20)))
11070
+ + (c("d", f" + {len(u['na'])} job(s) n/a: {u['na'][0]}") if u["known"] and u["na"] else ""))
11071
+ if role == "lead":
11072
+ out.append(c("d", " the lead works for the whole run, so it has no count per milestone"))
11073
+
11074
+ mine = [m for m in vm.get("milestones", []) if name in (m.get("by_agent") or {}) or m.get("worker") == name]
11075
+ landed = [m for m in mine if m["group"] == "landed"]
11076
+ out += ["", c("d", "MILESTONES") + c("d", f" {len(landed)} landed of {len(mine)}" if mine else "")]
11077
+ if not mine:
11078
+ out.append(c("d", " none yet" if role != "lead" else " the lead plans and steers; it builds no milestone"))
11079
+ tw = min(max([0] + [len(f" ○ {m['id']} {m['title']}") for m in mine]), max(20, width - 40))
11080
+ ww = max([0] + [len(m["word"]) for m in mine])
11081
+ for m in mine:
11082
+ b = (m.get("by_agent") or {}).get(name) or {"secs": 0, "jobs": 0, "review": False}
11083
+ g = m["group"]
11084
+ what = "reviewed" if b["review"] and role == "reviewer" else ""
11085
+ extra = f"{_fmt_min(b['secs'])}" + (f" · {b['jobs']} jobs" if b["jobs"] > 1 else "") + (f" · {what}" if what else "")
11086
+ head = cut(f" {_GROUP_ICON[g]} {m['id']} {m['title']}", tw).ljust(tw)
11087
+ out.append(head.replace(_GROUP_ICON[g], c(_GROUP_C[g], _GROUP_ICON[g]), 1)
11088
+ + " " + c(_GROUP_C[g], m["word"].ljust(ww)) + c("d", f" {extra}"))
11089
+ return BoardLines(out + foot, foot=len(foot))
11090
+
11091
+
10959
11092
  def board_error_lines(e, what="this run", back="[q] close"):
10960
11093
  """What the live board shows when drawing failed, instead of ending (herdr would close the popup and the error
10961
11094
  with it). The full traceback is saved for a bug report; the board tries again when the run changes."""
@@ -10991,7 +11124,7 @@ def render_changes(ch, width=100, height=40, color=True, sel=0, top=0):
10991
11124
  head = [c("a", "orch board · changed files") + c("d", f" {time.strftime('%H:%M')}"
10992
11125
  + (" · live" if ch["kind"] == "live" else "")),
10993
11126
  c(_GROUP_C.get(g, "d"), f"{_GROUP_ICON.get(g, '○')} ") + c("B", _safe(f"{ch['id']} {ch['title']}", width - 30))
10994
- + c("d", f" {VIEW_WORDS.get(ch['status'], ch['status'])}" + (f" · {ch['worker']}" if ch.get("worker") else "")),
11127
+ + c("d", f" {VIEW_WORDS.get(ch['status'], ch['status'])}" + (f" · {_named(ch['worker'], 'coder')}" if ch.get("worker") else "")),
10995
11128
  c("d", _safe(ch["note"], width))]
10996
11129
  tot = ch["totals"]
10997
11130
  if ch["files"]:
@@ -11141,10 +11274,11 @@ def cmd_changes(args):
11141
11274
 
11142
11275
 
11143
11276
  def cmd_board(args):
11144
- """orch board [--once] [--tab milestones|agents|tokens] [--no-color] -> the run as text, redrawn when it changes
11145
- (for a herdr pane or popup). Three tabs under the top lines: Milestones, Agents, Tokens ([tab], [←→] or 1-3).
11146
- [f] or [enter] on a milestone opens its changed files, [enter] on a file its diff; q goes back one screen.
11147
- [enter] on an agent jumps to it; in the board popup (prefix+a) it also closes the popup."""
11277
+ """orch board [--once] [--tab milestones|agents|tokens] [--agent <name>] [--no-color] -> the run as text, redrawn
11278
+ when it changes (for a herdr pane or popup). Three tabs under the top lines: Milestones, Agents, Tokens ([tab],
11279
+ [←→] or 1-3). [f] or [enter] on a milestone opens its changed files, [enter] on a file its diff; q goes back one
11280
+ screen. [enter] on an agent (Agents or Tokens tab) opens its details; [j] there jumps to its pane, and in the
11281
+ board popup (prefix+a) also closes the popup. --once --agent <name> prints one agent's details."""
11148
11282
  # live needs a keyboard and a screen: with stdin or stdout not a terminal, draw once (termios would fail)
11149
11283
  once = "--once" in args or not (sys.stdout.isatty() and sys.stdin.isatty())
11150
11284
  color = "--no-color" not in args and sys.stdout.isatty() and not os.environ.get("NO_COLOR")
@@ -11154,8 +11288,14 @@ def cmd_board(args):
11154
11288
  tab = next((k for k, w in BOARD_TABS if want in (k, w.lower())), None) or \
11155
11289
  die("usage: orch board [--once] [--tab milestones|agents|tokens]")
11156
11290
  if once:
11157
- print("\n".join(render_board(view_model(), shutil.get_terminal_size((100, 40)).columns, color,
11158
- tab=tab if "--tab" in args else None)))
11291
+ vm, cols = view_model(), shutil.get_terminal_size((100, 40)).columns
11292
+ if "--agent" in args:
11293
+ name = (args[args.index("--agent") + 1:] or [""])[0]
11294
+ if name not in board_agent_names(vm, "a") + board_agent_names(vm, "t"):
11295
+ die(f"no agent named {name or '?'} in this run (`orch board --once --tab agents` lists them)")
11296
+ print("\n".join(render_agent(vm, name, cols, color)))
11297
+ return
11298
+ print("\n".join(render_board(vm, cols, color, tab=tab if "--tab" in args else None)))
11159
11299
  return
11160
11300
  import select
11161
11301
  import termios
@@ -11167,6 +11307,7 @@ def cmd_board(args):
11167
11307
  screen, vm, need, redraw = "run", {}, True, True # need: read the run (and git) again; redraw: draw again
11168
11308
  mid, ch, fsel, ftop = None, None, 0, 0 # the changed-files screen: milestone, its changes, picked file, scroll
11169
11309
  dfile, dlines, derr, dtop = None, [], None, 0 # the diff screen
11310
+ aname, back = None, "run" # the agent details screen; where q on the changed files goes
11170
11311
  try:
11171
11312
  # TCSANOW, not the default TCSAFLUSH: that throws away every key typed while the board was starting up
11172
11313
  tty.setcbreak(fd, termios.TCSANOW)
@@ -11183,7 +11324,7 @@ def cmd_board(args):
11183
11324
  if need:
11184
11325
  fetched = time.time()
11185
11326
  vm = view_model()
11186
- if screen != "run":
11327
+ if screen in ("files", "diff"):
11187
11328
  st = _board_state()
11188
11329
  ch = milestone_changes(st, mid)
11189
11330
  if screen == "diff":
@@ -11191,6 +11332,8 @@ def cmd_board(args):
11191
11332
  need = redraw = False
11192
11333
  if screen == "run":
11193
11334
  lines = render_board(vm, size.columns, color, sel, note, tab)
11335
+ elif screen == "agent":
11336
+ lines = render_agent(vm, aname, size.columns, color, note)
11194
11337
  elif screen == "files":
11195
11338
  fsel = min(fsel, max(0, len(ch["files"]) - 1))
11196
11339
  lines, ftop = render_changes(ch, size.columns, size.lines, color, fsel, ftop)
@@ -11199,7 +11342,8 @@ def cmd_board(args):
11199
11342
  lines, dtop = render_diff(ch, f, dlines, size.columns, size.lines, color, dtop, derr)
11200
11343
  except Exception as e: # noqa: BLE001 - a popup closes when its program ends: show it, keep going
11201
11344
  need = redraw = False
11202
- lines = board_error_lines(e, "this run" if screen == "run" else f"{mid}'s changes",
11345
+ lines = board_error_lines(e, "this run" if screen == "run" else f"{aname}'s details"
11346
+ if screen == "agent" else f"{mid}'s changes",
11203
11347
  "[q] close" if screen == "run" else "[q] back")
11204
11348
  sys.stdout.write("\x1b[H\x1b[2J" + "\n".join(fit_screen(lines, size.lines)))
11205
11349
  sys.stdout.flush()
@@ -11231,7 +11375,7 @@ def cmd_board(args):
11231
11375
  ids = [m["id"] for m in vm.get("milestones", [])]
11232
11376
  n = len(ch["files"]) if ch else 0
11233
11377
  if key in ("q", "Q", "\x1b"):
11234
- screen, ch, need = "run", None, True
11378
+ screen, ch, need = back, None, True
11235
11379
  elif key in (UP, "k") and n:
11236
11380
  fsel = max(0, fsel - 1)
11237
11381
  elif key in (DOWN, "j") and n:
@@ -11243,6 +11387,27 @@ def cmd_board(args):
11243
11387
  dfile, dtop, screen, need = ch["files"][fsel], 0, "diff", True
11244
11388
  redraw = True
11245
11389
  continue
11390
+ if screen == "agent":
11391
+ if key in ("q", "Q", "\x1b", "\x7f", "\x08", LEFT, "h"):
11392
+ screen, note, back = "run", "", "run"
11393
+ elif key in ("j", "J"):
11394
+ r2 = subprocess.run([HERDR, "agent", "focus", aname], text=True, capture_output=True)
11395
+ if r2.returncode == 0 and os.environ.get("HERDR_PLUGIN_ID") == VIEW_PLUGIN_ID:
11396
+ closed_by = f"j (jumped to {aname})" # in the popup: get out of the way of the agent
11397
+ break
11398
+ rl = next((x.get("role") for x in (vm.get("agents") or []) + (vm.get("agent_tokens") or [])
11399
+ if x["name"] == aname), None)
11400
+ note = f"{'jumped to' if r2.returncode == 0 else 'herdr could not focus'} {_named(aname, rl)}"
11401
+ elif key in ("f", "F"):
11402
+ a = next((x for x in vm.get("agents") or [] if x["name"] == aname), {})
11403
+ mine = [m["id"] for m in vm.get("milestones", []) if aname in (m.get("by_agent") or {})]
11404
+ mid = a.get("task") or (mine[-1] if mine else None)
11405
+ if mid:
11406
+ screen, back, ch, fsel, ftop, need = "files", "agent", None, 0, 0, True
11407
+ else:
11408
+ note = f"{aname} has no milestone yet"
11409
+ redraw = True
11410
+ continue
11246
11411
  rows = board_rows(vm, tab)
11247
11412
  n = len(rows)
11248
11413
  if key in ("q", "Q", "\x1b"):
@@ -11267,13 +11432,10 @@ def cmd_board(args):
11267
11432
  screen, ch, fsel, ftop, need = "files", None, 0, 0, True
11268
11433
  else:
11269
11434
  note = "no milestones in this run yet"
11270
- elif key in ("\r", "\n") and sel is not None and n:
11271
- a = vm["agents"][rows[sel][1]]
11272
- r2 = subprocess.run([HERDR, "agent", "focus", a["name"]], text=True, capture_output=True)
11273
- if r2.returncode == 0 and os.environ.get("HERDR_PLUGIN_ID") == VIEW_PLUGIN_ID:
11274
- closed_by = f"enter (jumped to {a['name']})" # in the popup: get out of the way of the agent
11275
- break
11276
- note = f"jumped to {a['name']}" if r2.returncode == 0 else f"herdr could not focus {a['name']}"
11435
+ elif key in ("\r", "\n") and sel is not None and sel < n: # an agent (Agents or Tokens tab)
11436
+ names = board_agent_names(vm, "t" if rows[sel][0] == "t" else "a")
11437
+ if rows[sel][1] < len(names):
11438
+ aname, screen, note = names[rows[sel][1]], "agent", ""
11277
11439
  elif key in ("w", "W"):
11278
11440
  r2 = subprocess.run([sys.executable, os.path.abspath(__file__), "view", "--bg"], text=True,
11279
11441
  capture_output=True, cwd=ROOT)
@@ -11396,9 +11558,10 @@ USAGE = """usage: orch <command> [args]
11396
11558
  "needs you" alert, time and cost, replay. --lan: also from your phone, with a secret link
11397
11559
  view stop|status|herdr-config|plugin link|key|unlink|refresh|app link|unlink
11398
11560
  stop it / show its link / sidebar lines for herdr's config / the optional herdr plugin
11399
- board [--once] [--tab milestones|agents|tokens] the run as text, redrawn when it changes: for a herdr pane or
11400
- popup (any terminal); tabs Milestones, Agents, Tokens ([tab], [←→] or 1-3);
11401
- [f] or [enter] on a milestone shows its changed files, [enter] on a file its diff
11561
+ board [--once] [--tab milestones|agents|tokens] [--agent <name>] the run as text, redrawn when it changes: for
11562
+ a herdr pane or popup (any terminal); tabs Milestones, Agents, Tokens ([tab], [←→] or 1-3);
11563
+ [f] or [enter] on a milestone shows its changed files, [enter] on a file its diff;
11564
+ [enter] on an agent its details (tokens, milestones), [j] there jumps to its pane
11402
11565
  changes [Mn [file]] [--json] what each milestone changed: files with +/- counts, or one file's diff
11403
11566
  (live while a coder works, unsaved files included; landed = its commit). Read-only
11404
11567
  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.2",
3
+ "version": "6.48.4",
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": {
package/view/index.html CHANGED
@@ -353,13 +353,13 @@ function cost(v) {
353
353
  const T = v.tokens || {}, L = T.lead;
354
354
  const lead = L ? `<tr><td class="muted">lead (whole run)</td><td>${L.total != null ? tk(L.total) + " tok" : "tokens n/a (" + esc(L.na) + ")"}</td></tr>` : "";
355
355
  const AT = v.agent_tokens || [], readable = ["claude", "codex", "pi", "agy"];
356
- const arow = (r) => `<tr><td class="muted" style="white-space:nowrap">${esc(r.name)} <span class="faint">${esc(r.role)}</span></td><td>${r.kind && !readable.includes(r.kind) ? "n/a (orch can't read " + esc(r.kind) + "'s logs yet)" : !r.known && r.na.length ? "n/a (" + esc(r.na[0]) + ")" : !r.known && !r.task ? "no jobs yet" : "in " + tk(r.in) + " (" + tk(r.cached) + " cached) · out " + tk(r.out) + (r.task && r.now && r.now.na == null ? " · " + esc(r.task) + " now " + tk(r.now.in + r.now.out) : "") + (r.na.length ? " · " + r.na.length + " job(s) n/a" : "")}</td></tr>`;
356
+ const arow = (r) => `<tr><td class="muted" style="white-space:nowrap">${esc(r.name)} <span class="faint">${esc(r.role)}</span></td><td>${r.kind && !readable.includes(r.kind) ? "n/a (orch can't read " + esc(r.kind) + "'s logs yet)" : !r.known && r.na.length ? "n/a (" + esc(r.na[0]) + ")" : !r.known && !r.task ? "no jobs yet" : "in " + tk(r.in) + " (" + tk(r.cached) + " cached, " + (r.nocache ? "n/a" : tk(r.in - r.cached)) + " fresh) · out " + tk(r.out) + (r.task && r.now && r.now.na == null ? " · " + esc(r.task) + " now " + tk(r.now.in + r.now.out) : "") + (r.na.length ? " · " + r.na.length + " job(s) n/a" : "")}</td></tr>`;
357
357
  const liveTot = AT.some((r) => r.known) ? AT.reduce((n, r) => n + r.in + r.out, 0) : 0; // running jobs included
358
358
  const agTok = AT.length ? `<div class="h" style="margin:10px 0 4px">Tokens per agent (live)</div><table>${AT.map(arow).join("")}</table>` : "";
359
359
  $("cost").innerHTML = `<div class="card"><div class="h" style="margin-bottom:6px">Time and tokens</div>
360
360
  <div style="margin-bottom:8px">${mins(so)} so far${est ? ` of ~${mins(est)} planned` : ""}</div>
361
361
  <table>${rows}${lead}<tr><td><b>Total tokens</b></td><td><b>${liveTot ? tk(liveTot) + (AT.some((r) => r.na.length) ? "+" : "") : T.total ? tk(T.total) + (T.partial ? "+" : "") : "none yet"}</b></td></tr></table>${agTok}
362
- <div class="faint" style="font-size:11px;margin-top:6px">Read from each agent's own log. In = what it read (cached = its own chat read again, much cheaper), out = what it wrote. + = some jobs not available.</div></div>`;
362
+ <div class="faint" style="font-size:11px;margin-top:6px">Read from each agent's own log. In = what it read (cached = its own chat read again, much cheaper; fresh = in minus cached, what it read new), out = what it wrote. + = some jobs not available.</div></div>`;
363
363
  }
364
364
 
365
365
  function timeline(v) {