herdr-orchestra 6.47.3 → 6.48.1
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 +42 -0
- package/VERSION +1 -1
- package/bin/__pycache__/orchcpython-314.pyc +0 -0
- package/bin/orch +246 -12
- package/package.json +1 -1
- package/playbooks/plan.md +6 -2
- package/playbooks/run.md +2 -0
- package/view/index.html +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes. Versions follow [semantic versioning](https://semver.org).
|
|
4
4
|
|
|
5
|
+
## [6.48.1] - 2026-12-02
|
|
6
|
+
|
|
7
|
+
`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.
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
```
|
|
11
|
+
AGENTS
|
|
12
|
+
● codex-1 codex M2 · building
|
|
13
|
+
role: senior frontend engineer
|
|
14
|
+
skills: frontend-developer (codex can't see its folder), ghost-skill (not in this repo)
|
|
15
|
+
|
|
16
|
+
TOKENS read live from each agent's own log
|
|
17
|
+
in cached out
|
|
18
|
+
◆ lead-1 codex 50k 30k 4k
|
|
19
|
+
● codex-1 codex 100k 76k 7k M2 now 44k
|
|
20
|
+
○ rev-1 codex 8k 6k 1k
|
|
21
|
+
○ oc-1 opencode n/a: orch can't read opencode's logs yet
|
|
22
|
+
total 158k 112k 12k
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Which agents can show live numbers: Claude Code, Codex and Pi save the token count after every reply, so they show live. Antigravity (agy) is read the same way, but it has not yet been checked on a real machine whether agy writes its log while it works or only at the end. OpenCode logs are not read yet, so OpenCode agents show "n/a" with that reason, never a guessed number.
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- `orch board`: TOKENS part (in, cached, out per agent; "Mn now" for the running job; total), "+Nk now" on a building milestone, and a role and skills line under each busy coder. A skill the coder's tool can't see, or that is not in the repo, is marked.
|
|
29
|
+
- `orch view`: "Tokens per agent (live)" in the Time and tokens card, the total includes running jobs, and each busy coder shows its role and skills. The page gets a fresh copy every 10 seconds while a job runs.
|
|
30
|
+
- `orch status --json`: `agent_tokens`, plus `step_role` and `skills` on busy coders.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- The board and the view read the logs themselves (read only). A log is read again only when its size or change time changed. The lead reads no new text and gets no new wake-ups.
|
|
34
|
+
|
|
35
|
+
## [6.48.0] - 2026-12-02
|
|
36
|
+
|
|
37
|
+
The lead now follows a repository's own delivery standard. When `AGENTS.md` points to one (a doc, a checklist, a skill or a link that says what every change must deliver), the lead reads it while planning, writes the requirements that apply to this change into the plan, makes sure every coder's brief spells them out as plain instructions (so a coder that does not have that doc or skill can still follow them), and checks each one at the end. A repository whose `AGENTS.md` names no delivery standard gets exactly the same plan and run as before.
|
|
38
|
+
|
|
39
|
+
Example: `AGENTS.md` says "follow docs/delivery.md", which asks for a changelog entry and a test for new behaviour. Before, the plan said `## Global instructions` `none` and nothing checked the changelog. Now it says `Delivery standard (from AGENTS.md: docs/delivery.md):` `- Every new behaviour gets a test in the same change`, the last milestone has the acceptance criterion `CHANGELOG.md has a line under [Unreleased] for this change` with CHANGELOG.md in its Likely files, and the summary gets a "Delivery standard" section with one checked line per requirement.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
- `playbooks/plan.md`: step 2 reads the delivery standard `AGENTS.md` points to (or asks the developer when it can't be opened); a new `Delivery standard` rule (also printed for quick runs) puts it at the top of `## Global instructions` as concrete instructions, gives once-per-change items to one milestone, and keeps PR requirements as `- PR:` lines; step 10 tells the developer about it.
|
|
43
|
+
- `playbooks/run.md`: before the first dispatch the lead makes each requirement a concrete instruction in the brief; `orch answer` / `orch fix` texts name requirements in words; ALL_DONE adds a "Delivery standard" section with evidence, offers `orch fix` for a missed one, and adds PR requirements to summary.md (the PR description).
|
|
44
|
+
- No change to orch commands, approval holds or event handling.
|
|
45
|
+
- `AGENTS.md` (and `CLAUDE.md`, which points to it) for anyone working on this repo: the token budget rule (measure what the lead reads on main vs the branch, put the table in the PR, wake-up text never grows) plus the full-check, version and never-push-to-main rules.
|
|
46
|
+
|
|
5
47
|
## [6.47.3] - 2026-12-02
|
|
6
48
|
|
|
7
49
|
The shared lead playbooks no longer name any agent. Every lead (Claude Code, Codex, AGY, Pi, OpenCode or any other) reads the same `orch lead plan` and `orch lead run` text, and that text listed every agent's picker tool ("`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_question` in Antigravity…"), one agent's limit ("Claude Code takes 4 at a time"), one agent's error ("Codex's unavailable in Default mode") and "e.g. `ask_question` in Antigravity" for "Keep this team?". Now each agent's tool name and limits come only from the one `QUESTION PICKER` line orch prints for the agent that is running (unchanged since 6.29.0), and the shared text just says "use the picker that line names".
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.48.1
|
|
Binary file
|
package/bin/orch
CHANGED
|
@@ -2475,8 +2475,31 @@ TOKEN_GLOBS = {"claude": "*/*.jsonl", "codex": "**/rollout-*.jsonl*", "pi": "*/*
|
|
|
2475
2475
|
"agy": "*/.system_generated/logs/transcript_full.jsonl"}
|
|
2476
2476
|
|
|
2477
2477
|
|
|
2478
|
+
_TOK_TEXT = {}
|
|
2479
|
+
|
|
2480
|
+
|
|
2478
2481
|
def _tok_text(path):
|
|
2482
|
+
"""A log's text. The live board reads the same logs every few seconds: a file that has not changed since the last
|
|
2483
|
+
read is not read again (kept by size and change time, the last few files only)."""
|
|
2479
2484
|
p = str(path)
|
|
2485
|
+
try:
|
|
2486
|
+
s = os.stat(p)
|
|
2487
|
+
sig = (s.st_mtime_ns, s.st_size)
|
|
2488
|
+
except OSError:
|
|
2489
|
+
sig = None
|
|
2490
|
+
hit = _TOK_TEXT.get(p)
|
|
2491
|
+
if sig and hit and hit[0] == sig:
|
|
2492
|
+
return hit[1]
|
|
2493
|
+
text = _tok_text_read(p)
|
|
2494
|
+
if sig:
|
|
2495
|
+
_TOK_TEXT.pop(p, None)
|
|
2496
|
+
_TOK_TEXT[p] = (sig, text)
|
|
2497
|
+
while len(_TOK_TEXT) > 12:
|
|
2498
|
+
_TOK_TEXT.pop(next(iter(_TOK_TEXT)))
|
|
2499
|
+
return text
|
|
2500
|
+
|
|
2501
|
+
|
|
2502
|
+
def _tok_text_read(p):
|
|
2480
2503
|
if p.endswith(".zst"):
|
|
2481
2504
|
if not shutil.which("zstd"):
|
|
2482
2505
|
raise TokenNA("the log is compressed (.zst) and the `zstd` tool is not installed")
|
|
@@ -2912,6 +2935,148 @@ def token_lines(acct):
|
|
|
2912
2935
|
return out
|
|
2913
2936
|
|
|
2914
2937
|
|
|
2938
|
+
# ---- live tokens per agent, for the board and the browser view (6.48.1). The board process reads the logs, never
|
|
2939
|
+
# the lead: a running job's tokens are its log from the job's start to now, so they move after each reply the tool
|
|
2940
|
+
# writes. Read only, and a log is read again only when it changed.
|
|
2941
|
+
_LIVE_FIND, _LIVE_MISS, _LIVE_WIN = {}, {}, {}
|
|
2942
|
+
|
|
2943
|
+
|
|
2944
|
+
def _tok_sig(kind, path):
|
|
2945
|
+
files = [Path(path)]
|
|
2946
|
+
if kind == "claude":
|
|
2947
|
+
files += sorted((Path(path).with_suffix("") / "subagents").glob("*.jsonl"))
|
|
2948
|
+
sig = []
|
|
2949
|
+
for f in files:
|
|
2950
|
+
with contextlib.suppress(OSError):
|
|
2951
|
+
s = f.stat()
|
|
2952
|
+
sig.append((str(f), s.st_mtime_ns, s.st_size))
|
|
2953
|
+
return tuple(sig)
|
|
2954
|
+
|
|
2955
|
+
|
|
2956
|
+
def token_live(st, agent, kind, marker, start, end=None):
|
|
2957
|
+
"""One job's tokens up to now (end None: still running) or up to its end: {"in", "cached", "out"}, {"na": why},
|
|
2958
|
+
or None (no reply in the tool's log yet)."""
|
|
2959
|
+
if not kind:
|
|
2960
|
+
return {"na": "orch does not know which tool this agent runs"}
|
|
2961
|
+
if kind not in TOKEN_KINDS:
|
|
2962
|
+
return {"na": f"orch can't read {kind}'s logs yet"}
|
|
2963
|
+
if not marker:
|
|
2964
|
+
return {"na": "no job prompt to find the log by"}
|
|
2965
|
+
path = _LIVE_FIND.get((kind, marker))
|
|
2966
|
+
if not path or not Path(path).exists():
|
|
2967
|
+
if time.time() - _LIVE_MISS.get((kind, marker), 0) < 10: # not there 10s ago: don't search every redraw
|
|
2968
|
+
return None
|
|
2969
|
+
path = token_log_find(kind, marker, start, (st.get("token_logs") or {}).get(agent) or [])
|
|
2970
|
+
if not path:
|
|
2971
|
+
_LIVE_MISS[(kind, marker)] = time.time()
|
|
2972
|
+
return None
|
|
2973
|
+
_LIVE_FIND[(kind, marker)] = path
|
|
2974
|
+
key, sig = (kind, path, start, end), _tok_sig(kind, path)
|
|
2975
|
+
hit = _LIVE_WIN.get(key)
|
|
2976
|
+
if hit and hit[0] == sig:
|
|
2977
|
+
return hit[1]
|
|
2978
|
+
try:
|
|
2979
|
+
acc = token_window(kind, path, start, end + 1 if end else float("inf"))
|
|
2980
|
+
r = {"in": acc["in"], "cached": acc["cached"], "out": acc["out"]} if acc["replies"] else None
|
|
2981
|
+
except TokenNA as e:
|
|
2982
|
+
r = {"na": str(e)}
|
|
2983
|
+
_LIVE_WIN[key] = (sig, r)
|
|
2984
|
+
if len(_LIVE_WIN) > 200:
|
|
2985
|
+
_LIVE_WIN.pop(next(iter(_LIVE_WIN)))
|
|
2986
|
+
return r
|
|
2987
|
+
|
|
2988
|
+
|
|
2989
|
+
def agent_tokens(st):
|
|
2990
|
+
"""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}]"""
|
|
2992
|
+
rows, t_now = {}, now()
|
|
2993
|
+
|
|
2994
|
+
def row(name, role, kind):
|
|
2995
|
+
if name not in rows:
|
|
2996
|
+
rows[name] = {"name": name, "role": role, "kind": kind, "in": 0, "cached": 0, "out": 0, "known": 0,
|
|
2997
|
+
"jobs": 0, "na": [], "task": None, "now": None}
|
|
2998
|
+
return rows[name]
|
|
2999
|
+
|
|
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)
|
|
3008
|
+
ld, run = st.get("lead") or {}, st.get("run") or {}
|
|
3009
|
+
if ld.get("name"):
|
|
3010
|
+
r = row(ld["name"], "lead", ld.get("kind"))
|
|
3011
|
+
if run.get("started"):
|
|
3012
|
+
u = token_live(st, ld["name"], ld.get("kind"), f"in the run on {st.get('branch')} need the lead",
|
|
3013
|
+
run["started"], run.get("ended"))
|
|
3014
|
+
saved = run.get("lead_tokens")
|
|
3015
|
+
if (u is None or "na" in u) and isinstance(saved, dict) and "na" not in saved:
|
|
3016
|
+
u = saved
|
|
3017
|
+
add(r, u or {"na": "orch has not woken the lead in this run yet"})
|
|
3018
|
+
for n, w in st.get("workers", {}).items():
|
|
3019
|
+
row(n, "coder", w.get("kind"))
|
|
3020
|
+
if st.get("reviewer"):
|
|
3021
|
+
row(st["reviewer"], "reviewer", (st.get("reviewer_info") or {}).get("kind"))
|
|
3022
|
+
for tid in st.get("order", []):
|
|
3023
|
+
t = st["tasks"].get(tid) or {}
|
|
3024
|
+
for a in t.get("attempts") or []:
|
|
3025
|
+
if not isinstance(a, dict) or not a.get("agent") or not (a.get("tok_marker") or a.get("tokens")):
|
|
3026
|
+
continue
|
|
3027
|
+
r = row(a["agent"], "reviewer" if a.get("kind") == "reviewer" else "coder",
|
|
3028
|
+
a.get("tok_kind") or agent_kind_of(st, a["agent"]))
|
|
3029
|
+
u = a.get("tokens")
|
|
3030
|
+
if u is None: # finished a moment ago: orch saves it after a short wait
|
|
3031
|
+
u = token_live(st, a["agent"], r["kind"], a["tok_marker"], a.get("start", 0), a.get("end", t_now))
|
|
3032
|
+
if u is None:
|
|
3033
|
+
if t_now - a.get("end", t_now) < TOKEN_GIVE_UP_S:
|
|
3034
|
+
continue
|
|
3035
|
+
u = {"na": f"no {r['kind']} log has this job's prompt"}
|
|
3036
|
+
add(r, u if isinstance(u, dict) else {"na": "not read"})
|
|
3037
|
+
w = t.get("wait") or {}
|
|
3038
|
+
if w.get("agent") and w.get("prompt") and t.get("status") in ACTIVE:
|
|
3039
|
+
r = row(w["agent"], "reviewer" if w.get("kind") == "reviewer" else "coder", agent_kind_of(st, w["agent"]))
|
|
3040
|
+
u = token_live(st, w["agent"], r["kind"], token_marker(w["prompt"]), w.get("started", w.get("since", 0)))
|
|
3041
|
+
r["task"], r["now"] = tid, u or {"in": 0, "cached": 0, "out": 0}
|
|
3042
|
+
if u:
|
|
3043
|
+
add(r, u)
|
|
3044
|
+
return list(rows.values())
|
|
3045
|
+
|
|
3046
|
+
|
|
3047
|
+
def agent_steps(st):
|
|
3048
|
+
"""For each coder on a milestone now: the milestone's role and the skills the plan gave it, each with a note when
|
|
3049
|
+
the coder's tool can't see that skill's folder. {agent: {"task", "role", "skills": [{"name", "note"}]}}"""
|
|
3050
|
+
busy = {}
|
|
3051
|
+
for n, w in st.get("workers", {}).items():
|
|
3052
|
+
if w.get("task"):
|
|
3053
|
+
busy[n] = (w["task"], w.get("kind"))
|
|
3054
|
+
if not busy:
|
|
3055
|
+
return {}
|
|
3056
|
+
try:
|
|
3057
|
+
secs, _ = plan_sections()
|
|
3058
|
+
except OSError:
|
|
3059
|
+
secs = {}
|
|
3060
|
+
reg = registry(required=False) or {}
|
|
3061
|
+
try:
|
|
3062
|
+
skills = project_skills(ROOT, reg)
|
|
3063
|
+
except OSError:
|
|
3064
|
+
skills = []
|
|
3065
|
+
names = {s["name"] for s in skills}
|
|
3066
|
+
out = {}
|
|
3067
|
+
for n, (tid, kind) in busy.items():
|
|
3068
|
+
t = st["tasks"].get(tid) or {}
|
|
3069
|
+
want = plan_skills(secs[tid]) if tid in secs else []
|
|
3070
|
+
v = reg.get(kind) if kind else None
|
|
3071
|
+
sees = ({s["name"] for s in agent_project_view(ROOT, kind, v, skills)["skills"]}
|
|
3072
|
+
if v and v.get("project_skills_reads") else None)
|
|
3073
|
+
out[n] = {"task": tid, "role": t.get("role") or "",
|
|
3074
|
+
"skills": [{"name": w_, "note": "not in this repo" if w_ not in names else
|
|
3075
|
+
f"{kind} can't see its folder" if sees is not None and w_ not in sees else ""}
|
|
3076
|
+
for w_ in want]}
|
|
3077
|
+
return out
|
|
3078
|
+
|
|
3079
|
+
|
|
2915
3080
|
def finding_axis(f):
|
|
2916
3081
|
"""Which of the reviewer's two questions a finding answers: "spec" (built what was asked?) or "rules" (follows
|
|
2917
3082
|
the repo's written rules?); None for a review written before 6.6.0 that does not say."""
|
|
@@ -9600,6 +9765,18 @@ def view_model(st=None, recent=40):
|
|
|
9600
9765
|
agents.append({"name": st["reviewer"], "role": "reviewer", "kind": ri.get("kind"), "model": ri.get("model"),
|
|
9601
9766
|
"tier": ri.get("tier"), "task": busy, "state": "reviewing" if busy else
|
|
9602
9767
|
"compacting" if ri.get("compacting") else "free"})
|
|
9768
|
+
try:
|
|
9769
|
+
steps = agent_steps(st)
|
|
9770
|
+
except Exception: # a broken plan or registry never stops the board
|
|
9771
|
+
steps = {}
|
|
9772
|
+
for a in agents:
|
|
9773
|
+
sp = steps.get(a["name"])
|
|
9774
|
+
if sp and sp["task"] == a.get("task"):
|
|
9775
|
+
a["step_role"], a["skills"] = sp["role"], sp["skills"]
|
|
9776
|
+
try:
|
|
9777
|
+
atok = agent_tokens(st)
|
|
9778
|
+
except Exception:
|
|
9779
|
+
atok = []
|
|
9603
9780
|
groups = [m["group"] for m in ms]
|
|
9604
9781
|
run = st.get("run") or {}
|
|
9605
9782
|
return {
|
|
@@ -9620,7 +9797,7 @@ def view_model(st=None, recent=40):
|
|
|
9620
9797
|
"cached": tacct["lead"]["cached"], "out": tacct["lead"]["out"]}},
|
|
9621
9798
|
"usage": {"total": _usage_sum([u for v in by_model.values() for u in v]),
|
|
9622
9799
|
"by_model": {k: _usage_sum(v) for k, v in by_model.items()}},
|
|
9623
|
-
"milestones": ms, "agents": agents,
|
|
9800
|
+
"milestones": ms, "agents": agents, "agent_tokens": atok,
|
|
9624
9801
|
"lead": ({"name": st["lead"]["name"], "unread": len(unread_events(st)),
|
|
9625
9802
|
"open": len([e for e in st.get("lead_events", []) if event_open(st, e)])} if st.get("lead") else None),
|
|
9626
9803
|
"recent": view_events(recent)[::-1],
|
|
@@ -9726,13 +9903,15 @@ def serve_view(port, lan, token, opened):
|
|
|
9726
9903
|
self.send_header("Content-Type", "text/event-stream")
|
|
9727
9904
|
self.send_header("Cache-Control", "no-store")
|
|
9728
9905
|
self.end_headers()
|
|
9729
|
-
last, beat = None, time.time()
|
|
9906
|
+
last, beat, running = None, time.time(), False
|
|
9730
9907
|
try:
|
|
9731
9908
|
while True:
|
|
9732
9909
|
k = _view_snapshot_key()
|
|
9733
|
-
if k != last:
|
|
9910
|
+
if k != last or running and time.time() - beat > 10: # live tokens: again every 10s
|
|
9734
9911
|
last = k
|
|
9735
|
-
|
|
9912
|
+
vm_ = view_model()
|
|
9913
|
+
running = any(r.get("task") for r in vm_.get("agent_tokens") or [])
|
|
9914
|
+
self.wfile.write(f"event: state\ndata: {json.dumps(vm_)}\n\n".encode())
|
|
9736
9915
|
self.wfile.flush()
|
|
9737
9916
|
beat = time.time()
|
|
9738
9917
|
elif time.time() - beat > 15:
|
|
@@ -10530,7 +10709,11 @@ def render_board(vm, width=100, color=True, sel=None, note=""):
|
|
|
10530
10709
|
+ (" · " + c("r", f"{cn['needs_you']} needs you") if cn["needs_you"] else "")
|
|
10531
10710
|
+ c("d", f" · {_fmt_min(vm['time']['driven_s'])} so far"
|
|
10532
10711
|
+ (f" of ~{_fmt_min(vm['time']['estimate_s'])}" if vm["time"].get("estimate_s") else ""))]
|
|
10533
|
-
tk = vm.get("tokens") or {}
|
|
10712
|
+
tk = dict(vm.get("tokens") or {})
|
|
10713
|
+
at = vm.get("agent_tokens") or []
|
|
10714
|
+
if any(r["known"] for r in at): # the live count: finished jobs and the jobs running now
|
|
10715
|
+
tk["total"] = sum(r["in"] + r["out"] for r in at)
|
|
10716
|
+
tk["partial"] = any(r["na"] for r in at)
|
|
10534
10717
|
if tk.get("total") or tk.get("lead"):
|
|
10535
10718
|
ld = tk.get("lead") or {}
|
|
10536
10719
|
out.append(c("d", f"tokens {_tk(tk.get('total'))}{'+' if tk.get('partial') else ''} so far"
|
|
@@ -10541,6 +10724,7 @@ def render_board(vm, width=100, color=True, sel=None, note=""):
|
|
|
10541
10724
|
out += notes
|
|
10542
10725
|
out += ["", c("d", "MILESTONES")]
|
|
10543
10726
|
ms = {m["id"]: m for m in vm["milestones"]}
|
|
10727
|
+
live_now = {r["task"]: r.get("now") for r in at if r.get("task")}
|
|
10544
10728
|
rows = board_rows(vm)
|
|
10545
10729
|
picked = rows[sel] if sel is not None and sel < len(rows) else None
|
|
10546
10730
|
name_w = max(18, min(34, width - 52))
|
|
@@ -10555,6 +10739,9 @@ def render_board(vm, width=100, color=True, sel=None, note=""):
|
|
|
10555
10739
|
if mt:
|
|
10556
10740
|
extra += (" " if extra else "") + (f"{_tk(mt['total'])}{'+' if mt['partial'] else ''} tok"
|
|
10557
10741
|
if mt["total"] else "tokens n/a")
|
|
10742
|
+
nw = live_now.get(m["id"])
|
|
10743
|
+
if nw and "na" not in nw:
|
|
10744
|
+
extra += (" " if extra else "") + f"+{_tk(nw['in'] + nw['out'])} now"
|
|
10558
10745
|
if g == "waiting" and m["deps"]:
|
|
10559
10746
|
word = "waits for " + ",".join(d for d in m["deps"] if ms.get(d, {}).get("group") != "landed") \
|
|
10560
10747
|
if any(ms.get(d, {}).get("group") != "landed" for d in m["deps"]) else "ready"
|
|
@@ -10578,16 +10765,62 @@ def render_board(vm, width=100, color=True, sel=None, note=""):
|
|
|
10578
10765
|
out.append(f"{mark}{c(col, '◆' if a['role'] == 'lead' else '●' if busy else '○')} "
|
|
10579
10766
|
f"{a['name']:<12} {str(a.get('kind') or ''):<8} {str(a.get('tier') or ''):<7} "
|
|
10580
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:
|
|
10777
|
+
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} "
|
|
10780
|
+
if r.get("kind") and r["kind"] not in TOKEN_KINDS:
|
|
10781
|
+
out.append(head + c("d", f"n/a: orch can't read {r['kind']}'s logs yet"))
|
|
10782
|
+
continue
|
|
10783
|
+
if not r["known"] and r["na"]:
|
|
10784
|
+
out.append(head + c("d", cut(f"n/a: {r['na'][0]}", width - 25)))
|
|
10785
|
+
continue
|
|
10786
|
+
if not r["known"] and not r.get("task"):
|
|
10787
|
+
out.append(head + c("d", "no jobs yet"))
|
|
10788
|
+
continue
|
|
10789
|
+
tnote = []
|
|
10790
|
+
if r.get("task"):
|
|
10791
|
+
nw = r.get("now") or {}
|
|
10792
|
+
tnote.append(f"{r['task']} now {_tk(nw.get('in', 0) + nw.get('out', 0))}" if "na" not in nw else
|
|
10793
|
+
f"{r['task']} now n/a")
|
|
10794
|
+
if r["na"]:
|
|
10795
|
+
tnote.append(f"+ {len(r['na'])} job(s) n/a")
|
|
10796
|
+
out.append(head + f"{_tk(r['in']):>7} {_tk(r['cached']):>8} {_tk(r['out']):>7}"
|
|
10797
|
+
+ (c("d", " " + " · ".join(tnote)) if tnote else ""))
|
|
10798
|
+
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}")
|
|
10800
|
+
+ (c("d", " + some jobs n/a") if any(r["na"] for r in at) else ""))
|
|
10581
10801
|
if vm.get("recent"):
|
|
10582
10802
|
out += ["", c("d", "LAST EVENTS")]
|
|
10583
10803
|
for e in vm["recent"][:6]:
|
|
10584
10804
|
out.append(c("d", time.strftime("%H:%M", time.localtime(e["ts"] or 0))) + f" {e['task']} {e['from']} → {e['to']}"
|
|
10585
10805
|
+ (c("d", f" {cut(e.get('why') or '', 50)}") if e.get("why") else ""))
|
|
10586
|
-
if note
|
|
10587
|
-
|
|
10588
|
-
out
|
|
10589
|
-
|
|
10590
|
-
|
|
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")]
|
|
10808
|
+
return BoardLines(out + foot, foot=len(foot))
|
|
10809
|
+
|
|
10810
|
+
|
|
10811
|
+
class BoardLines(list):
|
|
10812
|
+
"""The board's lines; `foot` = how many at the end (the note and the keys) must stay on a short screen."""
|
|
10813
|
+
def __init__(self, lines, foot=0):
|
|
10814
|
+
super().__init__(lines)
|
|
10815
|
+
self.foot = foot
|
|
10816
|
+
|
|
10817
|
+
|
|
10818
|
+
def fit_screen(lines, height):
|
|
10819
|
+
"""The lines that fit the screen: on a short one the middle is cut, never the note and the keys at the end."""
|
|
10820
|
+
foot = getattr(lines, "foot", 0)
|
|
10821
|
+
if len(lines) <= height or not foot or height <= foot + 2:
|
|
10822
|
+
return list(lines[:height])
|
|
10823
|
+
return list(lines[:height - foot - 1]) + ["…"] + list(lines[-foot:])
|
|
10591
10824
|
|
|
10592
10825
|
|
|
10593
10826
|
def board_tree(vm):
|
|
@@ -10850,7 +11083,8 @@ def cmd_board(args):
|
|
|
10850
11083
|
while True:
|
|
10851
11084
|
k = _view_snapshot_key()
|
|
10852
11085
|
live = screen != "run" and ch is not None and ch["kind"] == "live"
|
|
10853
|
-
|
|
11086
|
+
running = any(r.get("task") for r in vm.get("agent_tokens") or []) # live tokens: look every 10s
|
|
11087
|
+
if k != last or time.time() - fetched > (2 if live else 10 if running else 30): # unsaved files: 2s
|
|
10854
11088
|
last, need = k, True
|
|
10855
11089
|
if need or redraw:
|
|
10856
11090
|
size = shutil.get_terminal_size((100, 40))
|
|
@@ -10876,7 +11110,7 @@ def cmd_board(args):
|
|
|
10876
11110
|
need = redraw = False
|
|
10877
11111
|
lines = board_error_lines(e, "this run" if screen == "run" else f"{mid}'s changes",
|
|
10878
11112
|
"[q] close" if screen == "run" else "[q] back")
|
|
10879
|
-
sys.stdout.write("\x1b[H\x1b[2J" + "\n".join(lines
|
|
11113
|
+
sys.stdout.write("\x1b[H\x1b[2J" + "\n".join(fit_screen(lines, size.lines)))
|
|
10880
11114
|
sys.stdout.flush()
|
|
10881
11115
|
r, _, _ = select.select([sys.stdin], [], [], 0.5)
|
|
10882
11116
|
if not r:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "herdr-orchestra",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.48.1",
|
|
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/playbooks/plan.md
CHANGED
|
@@ -26,6 +26,7 @@ Feature request = the user's message that asked you to run this playbook.
|
|
|
26
26
|
|
|
27
27
|
## 2. Research (read-only, before planning anything)
|
|
28
28
|
- Read `AGENTS.md` / `CLAUDE.md` / `README` and any spec the request points to.
|
|
29
|
+
- **The repo's delivery standard.** If `AGENTS.md` points to a delivery standard that changes must follow (a doc such as `docs/delivery.md`, a checklist, a skill, a link), open it and read it: a skill is its `SKILL.md` (in the repo or in your skills folder), a link only if you can reach it. Keep the requirements that apply to THIS change, for example a changelog entry, a version bump, tests for new behaviour, docs for a new option, a section in the PR description, screenshots of a UI change. You write them into the plan (the `Delivery standard` rule, step 9; a quick run uses the same rule). If it points to something you can't open, ask the developer (step 2a): paste it, or plan without it. If `AGENTS.md` names no delivery standard, skip this: the plan gets no delivery-standard block and everything works as before.
|
|
29
30
|
- **The project's skills**, when the `PROJECT SKILLS` line above lists some: `orch onboard skills` says what each one is for. You give each milestone the ones that fit (`Skills:`, step 9); never one that line says orch does the job of.
|
|
30
31
|
- Map the parts of the codebase the feature touches: entry points, the modules and files involved, existing patterns to follow (how similar features are built), data models and tables, tests and how they run.
|
|
31
32
|
- **Monorepo?** (workspaces in `package.json`/`pnpm-workspace.yaml`/`turbo.json`/`nx.json`, or folders like `apps/*`, `packages/*`, `backend/` + `frontend/`, `server/` + `client/`): list each app/package the feature touches, what it owns (API, web UI, mobile, shared types), and how each one is checked. For a feature that spans backend and frontend, understand BOTH sides well enough to write the contract between them: endpoints, request/response fields, where the shared types live. When each side has its own quicker check (e.g. `cd frontend && npm test`), note it for a `Check <side>:` line (step 9a).
|
|
@@ -73,6 +74,7 @@ If any is false, use the full process: run `orch lead plan full` and follow its
|
|
|
73
74
|
- **Team: one coder, no reviewer.** Your pane is named `lead` already (`orch lead plan` did it; if it printed a rename command, run it). Pick ONE coder pane whose model fits the tier (a free pane of any kind; if only you are open, `orch team <your kind> --coders 1 --no-reviewer`). `Reviewer: none`, unless the developer wrote `quick review:`: then one reviewer pane and `Review: yes`. Why no reviewer: a quick change is small and stays out of risky areas, the check command (lint, types, tests) still has to pass before it lands, and the developer looks at UI changes in the browser anyway; the reviewer is often the slowest step of a small run.
|
|
74
75
|
- **One milestone** that holds every change in the request, with **one acceptance criterion per change**, so the coder and the summary go through them one by one.
|
|
75
76
|
- **Fields:** only `Tier`, `Estimate`, `Likely files`, `Goal`, `Acceptance criteria` and the `Context` facts the coder needs to find their way (plus `Skills:` when a project skill fits). Leave out `Feature breakdown`, `Why separate`, `Needs`, `Model why`, `Role`, `Interfaces` (none) and `Prefer` unless one really helps. A backend change gets an acceptance criterion a test can prove (e.g. "GET /orders returns `createdAt` as ISO 8601; a test covers it").
|
|
77
|
+
- **Delivery standard** (only when step 2 found one): its block goes under `## Global instructions` in place of `none`, and what is done once for the change (a changelog entry, a docs line) becomes an acceptance criterion with its file in `Likely files`. A requirement that needs a file a quick run can't touch (a package manifest for a version bump, CI) makes it a full run.
|
|
76
78
|
- **Header:** `Mode: quick`, your `Quick because:` line, `Isolation: shared`, `Setup command: none` (shared mode uses your folder as it is), the `Check command`, `Estimate` = the milestone's.
|
|
77
79
|
- **Don't run the check yourself.** The event manager runs it before any work starts and tells you if it is already red (then handle it as in `orch lead run`, "Red baseline").
|
|
78
80
|
- Write the plan (format below), run `orch sync` and fix every ERROR, then write the developer five lines at most in your chat as text (a command's output is folded away, so it doesn't count): the changes (one per line), the coder and model, the estimate and your `Quick because:`. Then let the developer choose the models (the block "Let the developer choose the models" below), and when they keep the team, say "Say **go**, or **full** if you want the normal process." **STOP** and wait for go, as in a full plan: the developer sees the short plan before anything changes.
|
|
@@ -225,7 +227,7 @@ Workers: claude-1 (claude: sonnet), claude-2 (claude: haiku), codex-1 (codex: gp
|
|
|
225
227
|
Reviewer: reviewer (claude: opus) | none (developer: <why>)
|
|
226
228
|
|
|
227
229
|
## Global instructions
|
|
228
|
-
<constraints for every milestone, e.g. the developer's "Must not" rules — or "none">
|
|
230
|
+
<the Delivery standard block first, when the repo has one (rule below); constraints for every milestone, e.g. the developer's "Must not" rules — or "none">
|
|
229
231
|
|
|
230
232
|
## Feature breakdown
|
|
231
233
|
- <one line per real piece of work: what changes and where>
|
|
@@ -315,6 +317,7 @@ Rules for every milestone:
|
|
|
315
317
|
- **No how**: no code blocks, no function names to create, no numbered implementation steps. `orch sync` warns if it sees them.
|
|
316
318
|
- **Estimate**: from step 6, on every milestone and in the header. `orch sync` refuses a value that is not a time (`40m`, `1h30m`, `2h`) and warns when one is missing.
|
|
317
319
|
- **Tier, Needs, Model why**: from step 6, on every milestone. The model in `Workers:` is what the pane really runs, never a wish. `orch sync` refuses a denied model and warns when no coder reaches a milestone's tier or the reviewer is weaker than the work.
|
|
320
|
+
- **Delivery standard** (only when step 2 found one; otherwise leave it out): put a block at the top of `## Global instructions`, which every coder and the reviewer get in their task file. First line `Delivery standard (from <where AGENTS.md points>):`, then one requirement per line, each a concrete instruction a coder can follow without the doc or skill it comes from: `- Add a line under "## [Unreleased]" in CHANGELOG.md that says what changed`, not `- Follow the release checklist`. These say what the change must deliver, not how to build it. A requirement done once for the whole change (a version bump, a changelog entry, a docs page) goes to ONE milestone, usually the last to land: an acceptance criterion there and its file in `Likely files`, so parallel milestones don't fight over the file. A requirement about the PR itself (its title, a description section, a linked ticket) goes in the block as `- PR: <requirement>`: coders don't open the PR, so the lead handles it at the end of the run.
|
|
318
321
|
<!-- /quick -->
|
|
319
322
|
- **Skills**: the project's skills that fit this milestone (`Skills: frontend-developer, test-driven-development`), by the names `orch onboard skills` prints. orch lists them in the coder's task file with what each is for. Leave the line out when none fits. Never a skill that runs the work itself (its own worktree, merging, helper agents): orch tells coders not to use those in a run, and `orch sync` warns.
|
|
320
323
|
- **Prefer**: a worker kind or name from `Workers:` when a tool (not a model) suits the work better, otherwise `any`. A preference, not a lock; the tier comes first.
|
|
@@ -329,7 +332,8 @@ Rules for every milestone:
|
|
|
329
332
|
- Run `orch plan show` and write its cards in your own chat reply, as they are. **Running the command is not showing it**: agents fold command output away, so the developer sees only what you write as text. The cards are each milestone in plain words, what it waits for and why, who builds it on which model, how long, and the order. Fix every `WARN no Plain: line` first. Then add, in plain words too:
|
|
330
333
|
- the estimate for the whole feature, and for each milestone its tier and `Model why` (who builds it on which model comes next, in the team table);
|
|
331
334
|
- the research facts that shaped the plan, the answers from step 2a and where they went, and all open questions;
|
|
332
|
-
- which milestones are hard to undo and why (the cards say so), and the new glossary words
|
|
335
|
+
- which milestones are hard to undo and why (the cards say so), and the new glossary words;
|
|
336
|
+
- the delivery standard, when the repo has one: where it comes from and its requirements for this change, in a few words.
|
|
333
337
|
Keep code words (file names, functions, endpoints) out of what you write here: they are in plan.md for whoever wants them.
|
|
334
338
|
<!-- quick: Let the developer choose the models (from step 10) -->
|
|
335
339
|
**Let the developer choose the models.** Only now, after the plan cards and everything above (in a quick run, its five lines) are written in your chat as text; never while you are still researching or planning, and never in the same breath as running the commands. Order: plan cards, then the team table, then the question; the "Plan written…" lines below come once they keep the team.
|
package/playbooks/run.md
CHANGED
|
@@ -41,6 +41,7 @@ A run behaves like a call stack. You **dispatch** work and **pause**. The **even
|
|
|
41
41
|
|
|
42
42
|
## 1. Start the run (the developer said go)
|
|
43
43
|
1. Run `orch sync`. Stop on ERROR; report every WARN.
|
|
44
|
+
- **Delivery standard**, when `## Global instructions` in plan.md starts with a `Delivery standard` block (no block: skip this). orch writes each coder's brief (its task file) from its milestone and the Global instructions, and the brief must work on its own, even for a coder that does not have the doc or skill the standard comes from. Read the block and the milestones once, before the first dispatch: every requirement is a concrete instruction (what to do, and where), and each one done once for the change is an acceptance criterion of one milestone with its file in `Likely files`. Rewrite a line that only names the doc or skill ("follow the release checklist") into what it asks for, then `orch sync` again. Later, any text you give a coder (`orch answer`, `orch fix`, a fact you add after a failure) says the requirement that applies in words, never only the skill's name.
|
|
44
45
|
2. Run `orch start`. It checks that herdr can wake you: it names your pane `lead` if it is not named yet (`NAMED`), or refuses with `NO LEAD` and the exact `herdr agent rename <pane> lead` command; give that to the developer and stop. `orch dispatch` makes the same check. If a worker or the reviewer shows `herdr=NOT FOUND`, run `orch team up`: it opens a pane for each missing agent in a herdr tab called `team` (your tab stays whole), in its folder (its worktree, or the repo), starts it on its plan model and gives it its plan name. Then run `orch start` again. If team up reports `WAITING` (the new pane shows a first-run question such as "trust this folder" or a sign-in) or `FAILED`, or a worker shows `STALE pane`, tell the developer exactly what to do in which pane (`orch agents launch <kind> --model <id>` gives the start command), and stop. `WARN agent <kind>: …` means a launch flag in the registry is out of date for the installed tool; show it (`orch doctor <kind>` has the detail). Workers shown as `detect:off` are fine.
|
|
45
46
|
3. Dispatch every milestone whose dependencies are met: `orch dispatch M1 M2`. It prints who can take each one, and starts the event manager if none is running. If it says it could not start it, ask the developer to run `orch autopilot` in a terminal.
|
|
46
47
|
- `--to <worker>` gives a milestone to one coder; `--tier high` asks for a stronger model than the plan says. Use them only with a reason, and tell the developer.
|
|
@@ -93,6 +94,7 @@ If you changed plan.md by hand, run `orch sync` (it works once the event manager
|
|
|
93
94
|
- **"Design decisions & study notes"** for the developer (include any milestone that needed a stronger model than planned, and what that says about the plan).
|
|
94
95
|
- **"Checked by the lead"**. Go through every acceptance criterion and every behaviour the feature promised. Whatever can be settled by running a command or by reading the code, YOU settle now, and write one line each with the evidence: the command and its result, or `file:line`. This covers: a criterion "Checked automatically" marks `no evidence recorded` or `NOT met`, "the comment / doc / config says X", "the endpoint returns 400 for Y" (run its test, or read the test that covers it), "the migration adds column Z", "no leftover TODO or debug output". You may run the check command, single tests and read-only commands (`grep`, `git log`, `git diff --stat`), and open the few files you need; you still never edit application code. If a check of yours fails, it is a defect, not a checklist item: tell the developer and offer `orch fix Mn "<what is wrong>"`.
|
|
95
96
|
- **"Manual verification checklist"**: ONLY what a person must see or do, because no command and no reading of code can settle it. That is: how the UI looks (layout, spacing, colours, dark mode, a small screen), how it behaves in a real browser or on a real device (click-through flows, focus, animation, how fast it feels), and anything that needs an outside account or hardware (a real email arriving, a payment in the provider's test mode, a push notification, a printer). Write each item so the developer can do it without reading code: `- [ ] <where to go and what to do> → <what they should see>`. Test for every item: "could I, or a test, have checked this?" If yes, it does not belong here: check it and move it to "Checked by the lead". Never write "review the code", "read the comments", "confirm the tests pass" or "check the function handles X" as a manual item. If nothing needs a person (a pure backend, CLI or docs change), write `Nothing to check by hand: <one line why>` instead of inventing items.
|
|
97
|
+
- **"Delivery standard"** (quick and full runs, only when plan.md's Global instructions has a `Delivery standard` block): one line per requirement, met or not, with the evidence (`git diff --stat` shows CHANGELOG.md changed, VERSION reads 1.4.0, the test that covers the new behaviour). A requirement not met is a defect: tell the developer and offer `orch fix Mn "<the requirement, in words>"`. A `PR:` requirement (a description section, a linked ticket): `orch finish` uses summary.md as the PR description, so add what it asks for to summary.md; what you can't know (a ticket number) or a PR title it wants, tell the developer to add when they open the PR.
|
|
96
98
|
3. Tell the developer: "All tasks landed on <branch>. Review .orchestrate/summary.md. I checked <n> things myself; <k> were deferred with your approval and are NOT done (listed as follow-ups). <m> need your eyes:", then the manual checklist items themselves, numbered, one per line (`orch manual` prints them as orch reads them), or: nothing needs checking by hand. Then: "Run `orch finish`: it re-runs the check (or reuses it when it already passed on exactly these files), removes the worktrees and hidden refs, pushes <branch> and opens a PR into <base> (`orch finish --no-push` to only clean up)." Run `orch finish` yourself only when the developer says so: it pushes. It opens the PR itself when `gh` is installed; if it prints `OPEN A PR`, give the developer the link, and if they ask you to open it, use exactly the title and `.orchestrate/pr-body.md` it names. Never add a "Generated with …", `Co-Authored-By` or session line to a commit or a PR of the run: they are the developer's. When you ran `orch finish` yourself, post the MANUAL TESTS list it printed in your chat, numbered and word for word, under "Try these by hand before you merge" (when the developer runs it in a terminal, you are woken with `FINISHED` and do the same). **STOP.**
|
|
97
99
|
4. **The developer asks for a change after the summary** (for example "the login button should be blue"). Do not plan again. Find the milestone that built that part (the summary's Tasks list and Likely files tell you), then run `orch fix Mn "<the change, in the developer's words>"`. It adds one small follow-up milestone to `plan.md`, sends it straight to the coder who built Mn, and starts the event manager; the check and the review (when Mn had one) still run. If it prints `LOST` and `WAITS` (exit 3), herdr can't find that coder or the reviewer (their panes were reopened and lost their names): tell the developer the exact fix it printed (usually `herdr agent rename <pane> <name>`, or `orch resume`); the fix starts by itself once herdr finds them. Name another coder only when the developer asks: `--to <worker>`. Then **STOP**: you are woken with ALL_DONE again, and the new summary keeps the old one in `.orchestrate/summary.prev.md`, so carry your notes and checklist over and add what changed. Never type into a coder's pane yourself.
|
|
98
100
|
|
package/view/index.html
CHANGED
|
@@ -255,7 +255,8 @@ function agents(v) {
|
|
|
255
255
|
const col = a.role === "lead" ? "#e5a93b" : !a.task ? "#626979" : a.role === "reviewer" ? "#b392f0" : "#7aa2f7";
|
|
256
256
|
return `<div class="ag"><i class="dot" style="background:${col}"></i><span class="n">${esc(a.name)}</span>
|
|
257
257
|
<span class="w" style="color:${col}">${esc(a.task ? a.task + " · " + a.state : a.state)}</span>
|
|
258
|
-
<span class="k">${esc([a.role, a.kind, a.model, a.tier].filter(Boolean).join(" · "))}</span
|
|
258
|
+
<span class="k">${esc([a.role, a.kind, a.model, a.tier].filter(Boolean).join(" · "))}</span>${a.step_role || a.skills ? `
|
|
259
|
+
<span class="k">${esc([a.step_role ? "role: " + a.step_role : "", "skills: " + ((a.skills || []).map((x) => x.name + (x.note ? " (" + x.note + ")" : "")).join(", ") || "none for this step")].filter(Boolean).join(" · "))}</span>` : ""}</div>`;
|
|
259
260
|
}).join("") || `<div class="muted">No agents in this run.</div>`;
|
|
260
261
|
}
|
|
261
262
|
|
|
@@ -351,9 +352,13 @@ function cost(v) {
|
|
|
351
352
|
}).join("");
|
|
352
353
|
const T = v.tokens || {}, L = T.lead;
|
|
353
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
|
+
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>`;
|
|
357
|
+
const liveTot = AT.some((r) => r.known) ? AT.reduce((n, r) => n + r.in + r.out, 0) : 0; // running jobs included
|
|
358
|
+
const agTok = AT.length ? `<div class="h" style="margin:10px 0 4px">Tokens per agent (live)</div><table>${AT.map(arow).join("")}</table>` : "";
|
|
354
359
|
$("cost").innerHTML = `<div class="card"><div class="h" style="margin-bottom:6px">Time and tokens</div>
|
|
355
360
|
<div style="margin-bottom:8px">${mins(so)} so far${est ? ` of ~${mins(est)} planned` : ""}</div>
|
|
356
|
-
<table>${rows}${lead}<tr><td><b>Total tokens</b></td><td><b>${T.total ? tk(T.total) + (T.partial ? "+" : "") : "none yet"}</b></td></tr></table
|
|
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}
|
|
357
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>`;
|
|
358
363
|
}
|
|
359
364
|
|