herdr-orchestra 6.48.4 → 6.48.5

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,20 @@
2
2
 
3
3
  All notable changes. Versions follow [semantic versioning](https://semver.org).
4
4
 
5
+ ## [6.48.5] - 2026-12-03
6
+
7
+ `orch team up` now puts the lead in the `team` tab too. Before, the coders and the reviewer opened in the `team` tab and the lead stayed alone in its own tab, so you could not watch the lead and its team at the same time. Now the lead's pane moves into the `team` tab, top left, and the team fills the rest. The lead keeps running: only its place changes, nothing is restarted or closed. Its pane is at least as big as any other (2 agents: the lead on top across the whole width, the 2 below; 3 agents: a 2×2 grid). A big team still spills into `team 2`, without the lead. `orch team tidy` does the same for panes that are already open.
8
+
9
+ The lead stays where it is, and orch says why in one `NOTE` line, when herdr can't find the lead's pane, when herdr can't move it, when the screen is so small it fits only one agent a tab, or when the lead already sits beside agents of this run. `orch team up --here` works as before.
10
+
11
+ Example (`orch team up` with codex-1, codex-2 and the reviewer):
12
+ ```
13
+ OPENED codex-1: pane w1:p3 in app-wt/codex-1 ...
14
+ TAB the lead and the team are in the herdr tab "team", the lead top left (`orch team tidy` moves panes opened by hand there too)
15
+ ```
16
+
17
+ No agent gets any new text to read: the lead's playbooks, wake-ups, task files and review prompts are unchanged. The one line `orch team up` prints at the end got shorter.
18
+
5
19
  ## [6.48.4] - 2026-12-03
6
20
 
7
21
  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+`).
package/README.md CHANGED
@@ -135,7 +135,7 @@ Version choice, first match wins: `--version` flag › `ORCH_VERSION` env › `.
135
135
 
136
136
  `orch agents launch <kind> --model <id>` prints the command with the model (`--role reviewer` gives the reviewer's command: for Claude Code its edit tools are off, it only reads the change and writes its review file); `orch models` lists the models and their tiers. Use whatever your installed agents already reach.
137
137
 
138
- **Only one tool installed, or just one window open?** Open only the lead and start the plan playbook. The lead sees it is alone and builds the team from its own tool: `orch team codex` picks coders and a reviewer of that tool on the models the catalog allows, spread over its tiers, and the lead writes them into the plan. When you say go, `orch team up` opens their panes in a herdr tab of their own called `team`, as a grid of equal panes (2 side by side, 3 as two on top and the reviewer below, 4 as 2×2; a fifth goes to `team 2`, and a small screen gets fewer per tab), each in its own folder and on its model, and names them. The lead keeps its whole tab. `orch team tidy` moves panes that are already open (by hand, or next to the lead) into that grid; `orch team up --here` splits next to the lead as before. You never type either command yourself (you can: `orch team codex --coders 1`, `orch team up --dry-run`). Each pane is a separate session of the same tool, on your existing login.
138
+ **Only one tool installed, or just one window open?** Open only the lead and start the plan playbook. The lead sees it is alone and builds the team from its own tool: `orch team codex` picks coders and a reviewer of that tool on the models the catalog allows, spread over its tiers, and the lead writes them into the plan. When you say go, `orch team up` opens their panes in a herdr tab of their own called `team`, as a grid of equal panes (2 side by side, 3 as two on top and the reviewer below, 4 as 2×2; a fifth goes to `team 2`, and a small screen gets fewer per tab), each in its own folder and on its model, and names them. The lead's pane moves into that tab too, top left, so you see the lead and its team together (it keeps running; if herdr can't move it, it stays where it is and orch says so). `orch team tidy` moves panes that are already open (by hand, or next to the lead) into that grid; `orch team up --here` splits next to the lead as before. You never type either command yourself (you can: `orch team codex --coders 1`, `orch team up --dry-run`). Each pane is a separate session of the same tool, on your existing login.
139
139
 
140
140
  ```
141
141
  you (1 Codex pane) ──► $orch-plan add a login page
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.48.4
1
+ 6.48.5
Binary file
package/bin/orch CHANGED
@@ -9080,16 +9080,18 @@ def herdr_screen(pane=None):
9080
9080
  return ws, (w if isinstance(w, int) and w > 0 else None), (h if isinstance(h, int) and h > 0 else None)
9081
9081
 
9082
9082
 
9083
- def team_grid(n, width, height):
9083
+ def team_grid(n, width, height, lead=False):
9084
9084
  """How many panes go in one team tab, and the rows for n of them: [panes in row 1, row 2, ...]. Every pane gets
9085
9085
  at least PANE_MIN_COLS x PANE_MIN_ROWS of a screen this size (2 across when the size is unknown), at most
9086
- TEAM_MAX_PER_TAB per tab, rows as even as they can be (3 -> [2, 1], 4 -> [2, 2])."""
9086
+ TEAM_MAX_PER_TAB per tab, rows as even as they can be (3 -> [2, 1], 4 -> [2, 2]). lead: n counts the lead too,
9087
+ who takes one more place and sits first in the row with the fewest panes, so it is as big as any (3 -> [1, 2])."""
9087
9088
  cols = max(1, width // PANE_MIN_COLS) if width else 2
9088
9089
  rows = max(1, height // PANE_MIN_ROWS) if height else 2
9089
- cap = max(1, min(TEAM_MAX_PER_TAB, cols * rows))
9090
+ cap = max(1, min(TEAM_MAX_PER_TAB + (1 if lead else 0), cols * rows))
9090
9091
  n = min(n, cap)
9091
9092
  r = max(1, -(-n // min(cols, n))) if n else 0
9092
- return cap, [n // r + (1 if i < n % r else 0) for i in range(r)]
9093
+ out = [n // r + (1 if i < n % r else 0) for i in range(r)]
9094
+ return cap, out[::-1] if lead else out
9093
9095
 
9094
9096
 
9095
9097
  def build_grid(rows, first, split):
@@ -9127,22 +9129,61 @@ def _new_pane_id(ok, data, out, key="pane"):
9127
9129
  return pid or (re.search(r'"pane_id"\s*:\s*"([\w:.-]+)"', out or "") or [None, None])[1]
9128
9130
 
9129
9131
 
9130
- def team_tab_panes(new, dry=False, lead_pane=None, st=None):
9132
+ def herdr_tab_panes(pane):
9133
+ """The pane ids in the tab `pane` sits in, from `herdr pane layout` (empty when herdr can't tell)."""
9134
+ ok, data, _ = _herdr_json([HERDR, "pane", "layout", "--pane", pane])
9135
+ return {d["pane_id"] for d, _ in (_dicts_with(data, "pane_id") if ok and data is not None else [])}
9136
+
9137
+
9138
+ def lead_to_team_tab(lead_pane, ws, label, dry, q):
9139
+ """Move the lead's pane into a new tab `label`, focused: the lead keeps running, only its place changes. Returns
9140
+ (pane id, tab id) once moved; (None, None) after a NOTE that it stays where it is. dry: prints the command."""
9141
+ cmd = [HERDR, "pane", "move", lead_pane, "--new-tab"] + (["--workspace", ws] if ws else []) + ["--label", label]
9142
+ if dry:
9143
+ print(f"WOULD lead: {q(cmd)}")
9144
+ return lead_pane, f"<tab {label}>"
9145
+ ok, data, out = _herdr_json(cmd)
9146
+ res = ((data or {}).get("result") or {}).get("move_result") if ok and isinstance(data, dict) else None
9147
+ pane = (res or {}).get("pane") if isinstance(res, dict) else None
9148
+ pid, tab = _find_key(pane, "pane_id"), _find_key(pane, "tab_id")
9149
+ if pid and tab:
9150
+ return pid, tab
9151
+ print(f"NOTE the lead stays in its own tab: herdr could not move pane {lead_pane} "
9152
+ f"({out.splitlines()[-1] if out else 'no output'})")
9153
+ return None, None
9154
+
9155
+
9156
+ def team_tab_panes(new, dry=False, lead_pane=None, st=None, with_lead=False):
9131
9157
  """Open one pane per (name, folder) in `new`, in new herdr tabs ("team", "team 2", ...) laid out by team_grid.
9158
+ with_lead: the lead's pane moves into the first tab, top left (lead_to_team_tab), the team beside and below it.
9132
9159
  Returns ({name: pane id, None when herdr refused; dry: the command it would run}, {name: why it failed},
9133
- [tab labels]). When herdr can't make the first tab (an older herdr), returns ({}, {}, []) after a NOTE, and
9134
- team up opens the panes next to this one as before."""
9160
+ [tab labels], lead moved). When herdr can't make the first tab (an older herdr), returns ({}, {}, [], False)
9161
+ after a NOTE, and team up opens the panes next to this one as before."""
9135
9162
  ws, w, h = herdr_screen(lead_pane)
9136
9163
  cap, _ = team_grid(len(new), w, h)
9137
9164
  placed, errs, labels = {}, {}, []
9138
9165
  q = lambda c: " ".join(shlex.quote(str(x)) for x in c)
9139
- for c, i in enumerate(range(0, len(new), cap)):
9140
- chunk, label = new[i:i + cap], team_tab_label(c, st)
9141
- _, rows = team_grid(len(chunk), w, h)
9166
+ lead_tab = None
9167
+ if with_lead and lead_pane:
9168
+ if team_grid(len(new) + 1, w, h, lead=True)[0] < 2:
9169
+ print(f"NOTE the lead stays in its own tab: this screen ({w}x{h}) fits one agent a tab")
9170
+ else:
9171
+ lead_pane, lead_tab = lead_to_team_tab(lead_pane, ws, team_tab_label(0, st), dry, q)
9172
+ chunks, i = [], 0
9173
+ while i < len(new):
9174
+ k = team_grid(len(new) + 1, w, h, lead=True)[0] - 1 if lead_tab and not chunks else cap
9175
+ chunks.append(new[i:i + k])
9176
+ i += k
9177
+ for c, chunk in enumerate(chunks):
9178
+ label, lead_here = team_tab_label(c, st), bool(lead_tab) and c == 0
9179
+ rows = team_grid(len(chunk) + 1, w, h, lead=True)[1] if lead_here else team_grid(len(chunk), w, h)[1]
9180
+ slots = ([("lead", None)] if lead_here else []) + chunk
9142
9181
  tab_cmd = [HERDR, "tab", "create"] + (["--workspace", ws] if ws else []) + \
9143
9182
  ["--cwd", chunk[0][1], "--label", label, "--no-focus"]
9144
9183
 
9145
9184
  def first():
9185
+ if lead_here:
9186
+ return lead_pane
9146
9187
  if dry:
9147
9188
  placed[chunk[0][0]] = f"new tab: {q(tab_cmd)}"
9148
9189
  return f"<{chunk[0][0]}>"
@@ -9153,7 +9194,7 @@ def team_tab_panes(new, dry=False, lead_pane=None, st=None):
9153
9194
  return pid
9154
9195
 
9155
9196
  def split(cur, direction, ratio, slot):
9156
- name, d = chunk[slot]
9197
+ name, d = slots[slot]
9157
9198
  cmd = [HERDR, "pane", "split", cur, "--direction", direction, "--ratio", f"{ratio:.3f}",
9158
9199
  "--cwd", d, "--no-focus"]
9159
9200
  if dry:
@@ -9165,24 +9206,24 @@ def team_tab_panes(new, dry=False, lead_pane=None, st=None):
9165
9206
  errs[name] = out.splitlines()[-1] if out else "no output"
9166
9207
  return pid
9167
9208
 
9168
- pids = build_grid(rows, first, split)
9169
- if c == 0 and not pids[0] and not dry:
9209
+ pids = build_grid(rows, first, split)[1 if lead_here else 0:]
9210
+ if c == 0 and not lead_here and not pids[0] and not dry:
9170
9211
  print(f"NOTE herdr could not open a tab for the team ({errs.get(chunk[0][0])}), so the panes open "
9171
9212
  f"next to this one")
9172
- return {}, {}, []
9213
+ return {}, {}, [], False
9173
9214
  if not dry:
9174
9215
  placed.update({n: p for (n, _), p in zip(chunk, pids)})
9175
9216
  for (n, _), p in zip(chunk, pids):
9176
9217
  if not p and n not in errs:
9177
9218
  errs[n] = "the pane it splits from was not opened"
9178
9219
  labels.append(label)
9179
- return placed, errs, labels
9220
+ return placed, errs, labels, bool(lead_tab)
9180
9221
 
9181
9222
 
9182
9223
  def team_tidy(args):
9183
9224
  """Move the coders' and the reviewer's panes that are open now (opened by hand, or by an older orch next to the
9184
- lead) into team tabs, as a grid of equal panes, the same layout `orch team up` opens. The agents keep running
9185
- and keep their names. Never moves the lead's pane or the pane this runs in."""
9225
+ lead) into team tabs, as a grid of equal panes, the same layout `orch team up` opens: the lead's pane joins the
9226
+ first, top left. The agents and the lead keep running and keep their names."""
9186
9227
  usage = "usage: orch team tidy [--dry-run]"
9187
9228
  if any(a != "--dry-run" for a in args):
9188
9229
  die(usage)
@@ -9212,10 +9253,23 @@ def team_tidy(args):
9212
9253
  ws, w, h = herdr_screen(lead_pane)
9213
9254
  cap, _ = team_grid(len(panes), w, h)
9214
9255
  q = lambda c: " ".join(shlex.quote(str(x)) for x in c)
9215
- failed, labels = 0, []
9216
- for c, i in enumerate(range(0, len(panes), cap)):
9217
- chunk, label, tab = panes[i:i + cap], team_tab_label(c, st), [None]
9218
- _, rows = team_grid(len(chunk), w, h)
9256
+ failed, labels, lead_tab = 0, [], None
9257
+ if not lead_pane:
9258
+ print("NOTE the lead stays in its own tab: herdr can't find the lead's pane")
9259
+ elif team_grid(len(panes) + 1, w, h, lead=True)[0] < 2:
9260
+ print(f"NOTE the lead stays in its own tab: this screen ({w}x{h}) fits one agent a tab")
9261
+ else:
9262
+ lead_pane, lead_tab = lead_to_team_tab(lead_pane, ws, team_tab_label(0, st), dry, q)
9263
+ chunks, i = [], 0
9264
+ while i < len(panes):
9265
+ k = team_grid(len(panes) + 1, w, h, lead=True)[0] - 1 if lead_tab and not chunks else cap
9266
+ chunks.append(panes[i:i + k])
9267
+ i += k
9268
+ for c, chunk in enumerate(chunks):
9269
+ label, lead_here = team_tab_label(c, st), bool(lead_tab) and c == 0
9270
+ tab = [lead_tab if lead_here else None]
9271
+ rows = team_grid(len(chunk) + 1, w, h, lead=True)[1] if lead_here else team_grid(len(chunk), w, h)[1]
9272
+ slots = ([("lead", lead_pane)] if lead_here else []) + chunk
9219
9273
 
9220
9274
  def move(cmd, name, old):
9221
9275
  if dry:
@@ -9232,12 +9286,14 @@ def team_tidy(args):
9232
9286
  return pid
9233
9287
 
9234
9288
  def first():
9235
- n, p = chunk[0]
9289
+ n, p = slots[0]
9290
+ if lead_here:
9291
+ return p
9236
9292
  return move([HERDR, "pane", "move", p, "--new-tab"] + (["--workspace", ws] if ws else []) +
9237
9293
  ["--label", label, "--no-focus"], n, p)
9238
9294
 
9239
9295
  def split(cur, direction, ratio, slot):
9240
- n, p = chunk[slot]
9296
+ n, p = slots[slot]
9241
9297
  if not dry and not tab[0]:
9242
9298
  print(f"FAILED {n}: herdr did not say which tab \"{label}\" is, so pane {p} stays where it is")
9243
9299
  return None
@@ -9248,8 +9304,9 @@ def team_tidy(args):
9248
9304
  labels.append(label)
9249
9305
  if dry:
9250
9306
  return
9251
- print(f"TEAM TIDY: {'done' if not failed else f'{failed} pane(s) not moved — see above'}; the team is in the "
9252
- f"herdr tab{'s' if len(labels) > 1 else ''} " + ", ".join(f'"{t}"' for t in labels))
9307
+ print(f"TEAM TIDY: {'done' if not failed else f'{failed} pane(s) not moved — see above'}; the "
9308
+ f"{'lead and the team are' if lead_tab else 'team is'} in the herdr tab{'s' if len(labels) > 1 else ''} "
9309
+ + ", ".join(f'"{t}"' for t in labels))
9253
9310
  if failed:
9254
9311
  sys.exit(3)
9255
9312
 
@@ -9277,18 +9334,21 @@ def team_up(args):
9277
9334
  die(f"run `orch start` first: it makes each coder's folder ({', '.join(missing_dirs)} have none yet)")
9278
9335
  # after a restart: panes that only lost their name get it back, and a coder's own pane that came back as a
9279
9336
  # plain shell gets its agent started again, instead of a second pane next to it
9280
- lead_pane = agent_pane(st["lead"]["name"]) if (st.get("lead") or {}).get("name") else None
9337
+ lead_pane = (st.get("lead") or {}).get("pane") or \
9338
+ (agent_pane(st["lead"]["name"]) if (st.get("lead") or {}).get("name") else None)
9281
9339
  empty = {} if dry else rename_lost(dict(st, lead=None), hints=False, keep_out=[lead_pane] if lead_pane else [])
9282
- todo = []
9340
+ todo, running = [], []
9283
9341
  for name, w, d in agents:
9284
9342
  if w.get("pane"):
9285
9343
  ok, _, _ = _herdr_json([HERDR, "pane", "get", w["pane"]])
9286
9344
  print(f"ok {name}: pane {w['pane']}" if ok else
9287
9345
  f"STALE {name}: pane {w['pane']} is gone — remove `@pane:` from plan.md, `orch sync`, then "
9288
9346
  f"`orch team up` again")
9347
+ running.append(w["pane"] if ok else None)
9289
9348
  continue
9290
9349
  if herdr_state(name) is not None:
9291
9350
  print(f"ok {name}: already running")
9351
+ running.append(agent_pane(name))
9292
9352
  continue
9293
9353
  todo.append((name, w, d))
9294
9354
  if not todo:
@@ -9305,12 +9365,16 @@ def team_up(args):
9305
9365
  failed += 1
9306
9366
  continue
9307
9367
  runnable.append((name, w, d, v))
9308
- # new panes go in a herdr tab of their own ("team"), as a grid of equal panes, so the lead keeps its whole
9309
- # screen and every agent stays readable; --here (or a herdr that can't make tabs) splits next to this pane
9368
+ # new panes go in a herdr tab of their own ("team"), as a grid of equal panes, the lead's pane moved in top left
9369
+ # so the developer sees them all; --here (or a herdr that can't make tabs) splits next to this pane
9310
9370
  new = [(n, d) for n, w, d, v in runnable if not empty.get(n)]
9311
- placed, errs, tabs = {}, {}, []
9371
+ placed, errs, tabs, lead_moved = {}, {}, [], False
9312
9372
  if new and "--here" not in args:
9313
- placed, errs, tabs = team_tab_panes(new, dry, lead_pane, st)
9373
+ # the lead joins the team's tab, unless it already sits with agents of this run (it has its team in view)
9374
+ with_lead = bool(lead_pane) and not (set(running + list(empty.values())) - {None}) & herdr_tab_panes(lead_pane)
9375
+ if not lead_pane:
9376
+ print("NOTE the lead stays in its own tab: herdr can't find the lead's pane")
9377
+ placed, errs, tabs, lead_moved = team_tab_panes(new, dry, lead_pane, st, with_lead)
9314
9378
  for name, w, d, v in runnable:
9315
9379
  kind, model = w.get("kind"), w.get("model")
9316
9380
  cmd = launch_cmd(kind, v, model, strict=False, role="reviewer" if name == st.get("reviewer") else None, cwd=d)
@@ -9384,9 +9448,9 @@ def team_up(args):
9384
9448
  f"in pane {pid}")
9385
9449
  pane_labels(st, force=True) # each pane says who it is: "agy-2 · coder", "rev-1 · reviewer", "lead"
9386
9450
  if tabs and not dry:
9387
- print(f"TAB the team is in the herdr tab{'s' if len(tabs) > 1 else ''} " + ", ".join(f'"{t}"' for t in tabs)
9388
- + ", so the lead keeps its whole screen — switch tabs to watch them (`orch team tidy` moves panes "
9389
- "opened by hand there too)")
9451
+ print(f"TAB the {'lead and the team are' if lead_moved else 'team is'} in the herdr tab"
9452
+ f"{'s' if len(tabs) > 1 else ''} " + ", ".join(f'"{t}"' for t in tabs)
9453
+ + (", the lead top left" if lead_moved else "") + " (`orch team tidy` moves panes opened by hand there too)")
9390
9454
  print("TEAM UP: done — run `orch start` again; every agent should show herdr=found" if not failed else
9391
9455
  f"TEAM UP: {failed} agent(s) not ready — see above, then `orch team up` again")
9392
9456
  if failed:
@@ -11507,10 +11571,10 @@ USAGE = """usage: orch <command> [args]
11507
11571
  team up [--dry-run] [--here] [--mode panes|subagent]
11508
11572
  open a herdr pane for every agent in the plan herdr can't find, in its folder, and name it,
11509
11573
  in a herdr tab of their own ("team") as a grid of equal panes (at most 4 a tab, fewer on a
11510
- small screen; more go to "team 2"), so the lead keeps its whole screen. --here: split
11574
+ small screen; more go to "team 2"); the lead's pane moves in, top left. --here: split
11511
11575
  next to this pane instead (subagent mode: no panes; sets up the Pi subagents instead)
11512
11576
  team tidy [--dry-run] move the coder and reviewer panes already open (by hand, or next to the lead) into that
11513
- team tab grid; they keep running and keep their names. Never moves the lead's pane
11577
+ team tab grid, the lead top left; all keep running and keep their names
11514
11578
  mode [panes|subagent] [--agent <kind>] this agent's mode, or save one: panes (herdr panes, the default for
11515
11579
  every agent) or subagent (one Pi window; Pi only). Saved per agent in
11516
11580
  ~/.config/herdr-orchestra/config.json ("modes": {"pi": "subagent"}); ORCH_MODE=panes|subagent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herdr-orchestra",
3
- "version": "6.48.4",
3
+ "version": "6.48.5",
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": {