@jjanczur/tyran 0.1.21 → 0.1.23

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.
@@ -11,7 +11,7 @@
11
11
  {
12
12
  "name": "tyran",
13
13
  "description": "A task conductor for Claude Code: multi-agent orchestration with an enforced evidence contract, repo-specific learning, and update-safe local evolution.",
14
- "version": "0.1.21",
14
+ "version": "0.1.23",
15
15
  "source": "./",
16
16
  "author": {
17
17
  "name": "Jacek Janczura",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tyran",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "A task conductor for Claude Code: multi-agent orchestration with an enforced evidence contract, repo-specific learning, and update-safe local evolution.",
5
5
  "author": {
6
6
  "name": "Jacek Janczura",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,98 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.23 — 2026-08-15
4
+
5
+ ### The sandbox Spend tab shows spend
6
+
7
+ The published sample board met a reader with an error where the feature should
8
+ have been: no `cost.json` is served beside a static page, and the tab said so
9
+ honestly and uselessly. It now ships one, generated by **`rollup()` itself** —
10
+ the same function the board server calls — from invented transcripts. A
11
+ hand-written payload would render today and drift silently the first time a
12
+ field moved, on the one page whose whole job is to show what the product looks
13
+ like.
14
+
15
+ The numbers are invented and the page says so: the rate card is labelled
16
+ `sample-rates (invented)` and the models are `sample-large` / `sample-small`,
17
+ because **Tyran does not know what anyone pays** and a demo that reads like a
18
+ price list teaches the opposite. A test fails if a real model name appears
19
+ there — the rule that model names live only under `tiers:` has no sandbox
20
+ exemption.
21
+
22
+ What a reader now sees: 4.5 M tokens over 404 requests, 16.97 under that
23
+ invented rate card, a **55% conductor share**, the composition bar at 91%
24
+ cache read, and all three ranked charts with the tokens/cost toggle live.
25
+
26
+ ## 0.1.22 — 2026-08-15
27
+
28
+ ### A sandbox board you can click, published with the docs
29
+
30
+ A screenshot cannot be clicked and a GIF cannot be paused, so the docs now
31
+ publish the **real page** at
32
+ [jjanczur.github.io/tyran/sandbox/](https://jjanczur.github.io/tyran/sandbox/)
33
+ — rendered by the same `scripts/board.mjs` an operator runs, from two invented
34
+ initiatives committed under `site/sandbox/`. Click the tabs, filter the lanes,
35
+ select a card.
36
+
37
+ Two things a static copy has to solve, and both are solved in the generator
38
+ rather than by hand. **Ages**: the agent strip is aged in the reader's browser
39
+ against event timestamps, so a frozen page would read as a graveyard within a
40
+ month — every timestamp is shifted at build time so the newest event lands six
41
+ minutes before the build, with the original spacing intact. **Honesty**: the
42
+ 30-second refresh is stripped (it would also snap a reader back to the first
43
+ tab mid-click) and a banner says what the page is. Both replacements throw if
44
+ their anchor moves, because a silent no-op there publishes a page that claims
45
+ to be someone's live board.
46
+
47
+ ### The board, for someone who left it running overnight
48
+
49
+ - **The queue count is in the browser tab title.** The page is meant to be left
50
+ open while agents work; a background tab was saying nothing at all, because
51
+ the count existed only on a tab you had to be looking at.
52
+ - **"Changed since you marked seen."** The board is a snapshot and the journal
53
+ is a timeline: coming back to ten lanes meant re-reading all of them to find
54
+ the two that moved. Press **Mark seen** and the next visit names how many
55
+ tickets changed lane, badges each one, and says in the detail panel which
56
+ lane it came from. The baseline moves only on that press — never on load,
57
+ because the page reloads itself every 30 seconds and an auto-updating
58
+ baseline would make "since you last looked" mean "in the last half minute",
59
+ which is the same as showing nothing.
60
+ - **A filter over the lanes**, matching ticket id, title and initiative. Ten
61
+ lanes across dozens of initiatives is a pile; the lane headings keep their
62
+ counts as `n of N`, so a filtered zero still reads as a fact rather than an
63
+ absence.
64
+ - **A merged ticket names who did it.** The card's agent list empties the
65
+ moment an agent reports, so every `done` card showed nobody — and "who
66
+ touched this" is a question asked about finished work, not running work. The
67
+ fold has kept the list since spawns learned to name a ticket; only the board
68
+ dropped it. `worked_by` is deduplicated and naturally ordered, because
69
+ `board.json` is compared byte for byte and spawn order is not an order.
70
+ - **Nothing-started no longer looks like nothing-finished.** A fresh
71
+ initiative and a fully stalled one both rendered `0% · 0 of 0 merged`.
72
+ - **A 404 on spend is an answer, not a failure.** No such route means the page
73
+ is not being served by the board server — a copy on a docs site, a file
74
+ behind some other host — and it now says so calmly, while a 503 stays loud.
75
+
76
+ ### The client script is now proved to parse
77
+
78
+ Every other assertion about the page matches strings in the rendered HTML,
79
+ which a page that cannot run would satisfy just as well. The whole client is
80
+ one template literal, so a backtick inside a **comment** terminates it and the
81
+ module stops loading — which is exactly how this was found, by a comment that
82
+ quoted an identifier. The suite now compiles the emitted script.
83
+
84
+ ### Documentation
85
+
86
+ The GIF is larger (1180px), and under it, in the README and on both doc
87
+ surfaces, a link to the sandbox. `docs/board.md`'s **Opening it** section is
88
+ the one place that says how to open the dashboard: the serve command and the
89
+ URL it prints, the `open`/`xdg-open`/`start` line for the file, what differs
90
+ between them, and that `/tyran:status` does it for you inside a session.
91
+
92
+ `CLAUDE.md` now specifies `npm run build` for the site rather than
93
+ `npx astro build` — the sandbox is generated first, and calling astro directly
94
+ publishes a site whose sandbox link 404s.
95
+
3
96
  ## 0.1.21 — 2026-08-14
4
97
 
5
98
  ### The board said "all is well" in five different ways it should not have
package/README.md CHANGED
@@ -27,30 +27,49 @@ plan is somewhere in the scrollback, and *"the tests pass"* is a sentence
27
27
  rather than something you can check. Start a new session and you start
28
28
  explaining from the beginning.
29
29
 
30
- Tyran is a plugin that moves the work off the chat window. You describe a task;
31
- it interviews you until the goal is unambiguous, sizes it, and drives
32
- **fresh-context subagents** through it — a scout that only reads, an
33
- implementer per story on its own branch, a reviewer holding no editing tools so
34
- it cannot patch what it is grading. Every decision, spawn, report, merge and
35
- open question is appended to a journal **committed to your repo**, and every
36
- file you read afterwards is generated from that journal. A restart, a
37
- compaction and a colleague on another branch all read the same thing.
38
-
39
- Two rules are what make that worth the trouble. A report containing no raw
40
- command output is **rejected by a hook**, not by good intentions. And every
41
- write is classified against a policy file you own **before it happens**, so
42
- *autonomous* is a setting with a blast radius rather than a promise.
43
-
44
- ![The Tyran dashboard, recorded live, moving through its four tabs: Overview with what is waiting on you and the strip of running agents each showing the time since it last signalled; Board, where selecting a ticket opens its initiative, agents and spend; Waiting on you, the open questions above the commands that answer them; and Spend, toggling the same split between tokens and cost](assets/board-demo.gif)
30
+ Tyran is an orchestrator. You describe a task; it interviews you until the goal
31
+ is unambiguous, sizes it, plans it, and hands each piece to a **dedicated
32
+ subagent with fresh context and a model tier matched to how hard that piece
33
+ actually is** — cheap for a mechanical sweep, expensive for a security
34
+ boundary, never one model for a whole session. They run in parallel, as an
35
+ Agent Team where the platform offers one.
36
+
37
+ That is a cost lever and a quality lever at the same time. The conductor holds
38
+ the plan and never accumulates its agents' transcripts, which is where the
39
+ tokens in a long session actually go; and an agent that never saw the last six
40
+ failed attempts cannot inherit them, so the second opinion is a real one.
41
+
42
+ **It learns your repo while it works.** Setup reads how the repo is really
43
+ worked — stack, validation commands, how things get deployed — rather than
44
+ asking you to describe it. A retrospective after every initiative writes what
45
+ it learnt into `.tyran/knowledge/`, and a failure that repeats graduates out of
46
+ `MISTAKES.md` into a rule. Meanwhile every decision, spawn, report, merge and
47
+ open question is appended to a journal **committed to your repo**, so a
48
+ restart, a compaction and a colleague on another branch all read the same
49
+ thing.
50
+
51
+ All of it is one plugin, and it comes with a **dashboard**: what every agent is
52
+ doing right now, which questions are waiting on you, and what the work cost —
53
+ in the tokens the platform itself reported, per model, per agent and per
54
+ ticket.
55
+
56
+ Underneath, **deterministic hooks hold the line**: a report with no raw command
57
+ output is rejected, every write is classified against a policy file you own
58
+ before it happens, and a commit carrying a secret is refused. Mechanisms rather
59
+ than instructions — which is the whole argument.
60
+
61
+ <p align="center">
62
+ <img src="assets/board-demo.gif" width="100%" alt="The Tyran dashboard, recorded live, moving through its four tabs: Overview with what is waiting on you and the strip of running agents each showing the time since it last signalled; Board, where selecting a ticket opens its initiative, agents and spend; Waiting on you, the open questions above the commands that answer them; and Spend, toggling the same split between tokens and cost">
63
+ </p>
64
+
65
+ <p align="center">
66
+ <b><a href="https://jjanczur.github.io/tyran/sandbox/">▶ Open the sandbox board</a></b> —
67
+ the real page with sample data, in your browser. Click the tabs, filter the
68
+ lanes, select a card.
69
+ </p>
45
70
 
46
71
  ## What it gives you
47
72
 
48
- - **A model tier per role, resolved from one config file.** Model names appear
49
- in exactly one place; skills, agents and policies are written in role names.
50
- The expensive tier is kept for security review, arbitration and final
51
- acceptance, and the first two sit on a floor no profile or risk flag crosses.
52
- - **Fresh context for every subagent.** Handoffs are self-contained, so the
53
- conductor holds the plan and never accumulates its agents' transcripts.
54
73
  - **Reports that carry evidence, or are refused.** A `SubagentStop` hook
55
74
  rejects a report with no raw command output — measured on 55 real reports
56
75
  from this project's own agents: 53 pass, and both misses were not reports. It
@@ -59,9 +78,11 @@ write is classified against a policy file you own **before it happens**, so
59
78
  - **State you can read without a session.** The journal is the single source of
60
79
  truth; `STATE.md`, `PROGRESS.md`, `BOARD.md`, `board.json` and `board.html`
61
80
  are generated projections of it.
62
- - **A retrospective after every initiative.** It writes durable facts about
63
- your repo into `.tyran/knowledge/`, and repeated failures graduate out of
64
- `MISTAKES.md` into rules.
81
+ - **The routing table is one file.** Model names appear in exactly one place;
82
+ skills, agents and policies are written in role names, so a deprecation is a
83
+ one-line edit. The expensive tier is reserved for security review,
84
+ arbitration and final acceptance, and those two sit on a floor no cost
85
+ profile or risk flag can cross.
65
86
  - **A spend ledger.** `npx @jjanczur/tyran cost` reports what the work cost, in
66
87
  the tokens the platform itself reported, per model, per agent type and per
67
88
  ticket — read out of the transcripts Claude Code already writes. Money
@@ -231,7 +252,7 @@ enforces the cap (4352 of 5000 characters). What each one assumes, when it
231
252
  fires and who invokes it, is in
232
253
  [skills and agents](https://jjanczur.github.io/tyran/skills/); the prompts
233
254
  themselves are in [`skills/`](skills/) and [`agents/`](agents/). Behind all of
234
- it: 1306 unit tests, run with `node --test "tests/**/*.test.mjs"`.
255
+ it: 1314 unit tests, run with `node --test "tests/**/*.test.mjs"`.
235
256
 
236
257
  ## Documentation
237
258
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjanczur/tyran",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "Command-line scripts for the Tyran task conductor (doctor, journal, schema, and repo tooling) for CI and terminals outside Claude Code. Installing this package does NOT install the Claude Code plugin — add that separately with `/plugin marketplace add jjanczur/tyran` inside Claude Code.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -105,6 +105,17 @@ h3{font-family:var(--font);color:var(--heading);font-size:.85rem;margin:1.1rem 0
105
105
  .damaged{background:var(--bg-raised);border-left:3px solid var(--brass);border-radius:.45rem;padding:.42rem .65rem;margin:.3rem 0;font-family:var(--mono);font-size:.78rem;color:var(--brass-bright)}
106
106
  .err{background:var(--bg-raised);border-left:3px solid var(--clay);border-radius:.45rem;padding:.6rem .75rem;color:var(--clay-bright);font-size:.85rem}
107
107
 
108
+ /* ---- what moved while you were away ---- */
109
+ .moved{background:var(--brass-low);border:1px solid var(--brass-edge);border-radius:var(--radius);padding:.5rem .75rem;margin:.6rem 0;display:flex;gap:.6rem;align-items:center;flex-wrap:wrap;color:var(--brass-bright);font-size:.85rem}
110
+ .markseen{background:var(--bg-raised);color:var(--text);border:1px solid var(--hairline);border-radius:.4rem;padding:.25rem .6rem;font:inherit;font-size:.78rem;cursor:pointer}
111
+ .markseen:hover{border-color:var(--brass-edge);color:var(--brass-bright)}
112
+ .card .movedtag{display:inline-block;background:var(--brass-low);color:var(--brass-bright);border:1px solid var(--brass-edge);border-radius:.3rem;padding:0 .3rem;font-size:.65rem;margin-left:.3rem;letter-spacing:.04em}
113
+
114
+ /* ---- filter ---- */
115
+ .filter{display:flex;gap:.6rem;align-items:center;margin:.5rem 0 .7rem}
116
+ .filter input{background:var(--bg-sunken);color:var(--text);border:1px solid var(--hairline);border-radius:.4rem;padding:.35rem .6rem;font:inherit;font-size:.82rem;min-width:20rem;max-width:100%}
117
+ .filter input:focus{outline:none;border-color:var(--steel-edge)}
118
+
108
119
  /* ---- the files an initiative actually has ---- */
109
120
  .files{display:flex;flex-direction:column;gap:.2rem;margin-top:.3rem}
110
121
  .file{display:flex;gap:.5rem;align-items:baseline;flex-wrap:wrap;font-size:.76rem}
@@ -221,6 +232,54 @@ if (data.schema !== 1) {
221
232
  var cost = null;
222
233
  var costError = null;
223
234
 
235
+ // The queue count, in the browser tab. The whole point of this page is that
236
+ // you can leave it open while agents work overnight, and a background tab
237
+ // was saying nothing at all — the count existed only on a tab you had to be
238
+ // looking at to see.
239
+ try {
240
+ document.title = (asks.length > 0 ? '(' + asks.length + ') ' : '') + 'Tyran board';
241
+ } catch (e) { /* a title is a nicety; never let it take the page down */ }
242
+
243
+ // ---- what moved since you last acknowledged it ------------------------
244
+ //
245
+ // The page is a snapshot; the journal is a timeline. Someone who leaves
246
+ // agents running overnight comes back to ten lanes and has to re-read all
247
+ // of them to find the two that moved.
248
+ //
249
+ // The baseline is only replaced when the operator presses "Mark seen" —
250
+ // deliberately NOT on load, because the page reloads itself every 30
251
+ // seconds and an auto-updating baseline would mean "since you last looked"
252
+ // was always "since half a minute ago", which is the same as nothing.
253
+ // localStorage can throw outright (Safari over file://, a private window),
254
+ // so every access degrades to "no baseline" rather than to a broken page.
255
+ var SEEN_KEY = 'tyran-board-seen-v1';
256
+ var laneOfCard = {};
257
+ Object.keys(lanes).forEach(function (lane) {
258
+ (lanes[lane] || []).forEach(function (c) { laneOfCard[(c.init || '') + '/' + c.id] = lane; });
259
+ });
260
+ var readSeen = function () {
261
+ try {
262
+ var raw = localStorage.getItem(SEEN_KEY);
263
+ return raw ? JSON.parse(raw) : null;
264
+ } catch (e) { return null; }
265
+ };
266
+ var writeSeen = function () {
267
+ try {
268
+ localStorage.setItem(SEEN_KEY, JSON.stringify({ at: new Date().toISOString(), cards: laneOfCard }));
269
+ return true;
270
+ } catch (e) { return false; }
271
+ };
272
+ var seen = readSeen();
273
+ var moved = {};
274
+ var movedCount = 0;
275
+ if (seen && seen.cards) {
276
+ Object.keys(laneOfCard).forEach(function (key) {
277
+ var was = seen.cards[key];
278
+ if (was === undefined) { moved[key] = 'new'; movedCount += 1; }
279
+ else if (was !== laneOfCard[key]) { moved[key] = was; movedCount += 1; }
280
+ });
281
+ }
282
+
224
283
  var app = document.getElementById('app');
225
284
  var head = el('div');
226
285
  head.appendChild(el('h1', null, 'Tyran board'));
@@ -325,7 +384,14 @@ if (data.schema !== 1) {
325
384
  ovTiles.appendChild(tile('waiting on you', String(asks.length),
326
385
  asks.length === 0 ? 'nothing blocked on a decision' : 'answer them on the next tab', asks.length > 0 ? 'lead' : null));
327
386
  ovTiles.appendChild(tile('agents running', String(agents.length), 'across ' + (totals.initiatives || 0) + ' initiative(s)'));
328
- ovTiles.appendChild(tile('progress', (totals.percent || 0) + '%', (totals.merged || 0) + ' of ' + (totals.tickets || 0) + ' merged'));
387
+ // An initiative with no tickets used to read "0% · 0 of 0 merged", which is
388
+ // exactly what a fully stalled one reads. Nothing-started and
389
+ // nothing-finished are different situations and deserve different words.
390
+ ovTiles.appendChild((totals.tickets || 0) === 0
391
+ ? tile('progress', '—', (totals.initiatives || 0) === 0
392
+ ? 'no initiatives yet — run /tyran to start one'
393
+ : 'no tickets declared yet')
394
+ : tile('progress', (totals.percent || 0) + '%', (totals.merged || 0) + ' of ' + totals.tickets + ' merged'));
329
395
  // Counted by the server, from the lanes AND the agents. Counting lanes here
330
396
  // read zero while an agent chip on the same screen said "blocked", because a
331
397
  // ticket parked by an override leaves no card in the blocked lane.
@@ -336,6 +402,31 @@ if (data.schema !== 1) {
336
402
  laneCount('blocked') + ' blocked · ' + laneCount('changes-requested') + ' changes requested · '
337
403
  + blockedAgents + ' agent(s) blocked', stuck > 0 ? 'warn' : null));
338
404
  ov.appendChild(ovTiles);
405
+
406
+ // The bar only appears once there IS a baseline: on a first visit nothing
407
+ // has "changed", and saying so would be noise on the one screen that is
408
+ // supposed to be only signal.
409
+ if (seen) {
410
+ var since = el('div', movedCount > 0 ? 'moved' : 'hint');
411
+ since.appendChild(el('span', null, movedCount > 0
412
+ ? movedCount + ' ticket(s) changed lane since you marked seen (' + seen.at + ')'
413
+ : 'Nothing has moved since you marked seen (' + seen.at + ').'));
414
+ var mark = el('button', 'markseen', 'Mark seen');
415
+ mark.addEventListener('click', function () {
416
+ if (writeSeen()) location.reload();
417
+ else since.appendChild(el('span', 'note', ' — this browser refused to store it'));
418
+ });
419
+ since.appendChild(mark);
420
+ ov.appendChild(since);
421
+ } else {
422
+ var first = el('div', 'hint');
423
+ first.appendChild(el('span', null, 'Mark this board seen and the next visit will tell you what moved while you were away.'));
424
+ var firstBtn = el('button', 'markseen', 'Mark seen');
425
+ firstBtn.addEventListener('click', function () { if (writeSeen()) location.reload(); });
426
+ first.appendChild(firstBtn);
427
+ ov.appendChild(first);
428
+ }
429
+
339
430
  ov.appendChild(el('h2', null, 'Agents'));
340
431
  // Named, not implied by the order: the strip is sorted stalest-first by the
341
432
  // server, and a reader who does not know that reads the first chip as the
@@ -391,8 +482,13 @@ if (data.schema !== 1) {
391
482
  dl.appendChild(el('dd', null, v));
392
483
  };
393
484
  row('lane', lane);
485
+ var was = moved[(card.init || '') + '/' + card.id];
486
+ if (was) row('since you marked seen', was === 'new' ? 'new ticket' : 'moved out of ' + was);
394
487
  row('initiative', card.init);
395
488
  row('agents', card.agents && card.agents.length ? card.agents.join(', ') : null);
489
+ // Who ever held it, which is the question people ask about a ticket that
490
+ // is already done — precisely when the running-agents list is empty.
491
+ row('worked by', card.worked_by && card.worked_by.length ? card.worked_by.join(', ') : null);
396
492
  row('note', card.annotation);
397
493
  if (cost) {
398
494
  var hit = (cost.by_ticket || []).filter(function (r) { return r.ticket === card.id; })[0];
@@ -419,14 +515,33 @@ if (data.schema !== 1) {
419
515
  }
420
516
  detail.appendChild(box);
421
517
  };
518
+ // A filter, because ten lanes across dozens of initiatives is a pile.
519
+ // Substring over the id, the title and the initiative — no query language,
520
+ // nothing to learn, and it never hides a lane HEADING, so "0" after
521
+ // filtering still reads as a fact about the lane rather than as an
522
+ // absence.
523
+ var filterRow = el('div', 'filter');
524
+ var filterInput = el('input');
525
+ filterInput.setAttribute('type', 'search');
526
+ filterInput.setAttribute('placeholder', 'filter by ticket, title or initiative');
527
+ filterInput.setAttribute('aria-label', 'filter tickets');
528
+ var filterCount = el('span', 'note');
529
+ filterRow.appendChild(filterInput);
530
+ filterRow.appendChild(filterCount);
531
+ bd.appendChild(filterRow);
532
+
533
+ var allCards = [];
422
534
  Object.keys(lanes).forEach(function (lane) {
423
535
  var cards = lanes[lane];
424
536
  var box = el('div', 'lane ' + lane);
425
537
  var h = el('h4');
426
538
  h.appendChild(el('span', null, lane));
427
- h.appendChild(el('span', 'count', ' (' + cards.length + ')'));
539
+ var count = el('span', 'count', ' (' + cards.length + ')');
540
+ h.appendChild(count);
428
541
  box.appendChild(h);
429
- if (cards.length === 0) box.appendChild(el('div', 'empty', '—'));
542
+ var emptyMark = el('div', 'empty', '—');
543
+ if (cards.length === 0) box.appendChild(emptyMark);
544
+ var buttons = [];
430
545
  cards.forEach(function (c) {
431
546
  var button = el('button', 'card');
432
547
  button.setAttribute('type', 'button');
@@ -434,13 +549,36 @@ if (data.schema !== 1) {
434
549
  button.appendChild(el('span', 'id', c.id));
435
550
  if (c.title) button.appendChild(el('span', null, ' — ' + c.title));
436
551
  if (c.init) button.appendChild(el('span', 'init', ' ' + c.init));
552
+ // The badge is the whole point of the baseline: it puts what moved in
553
+ // front of you instead of asking you to compare ten lanes by eye.
554
+ if (moved[(c.init || '') + '/' + c.id]) button.appendChild(el('span', 'movedtag', 'moved'));
437
555
  if (c.agents && c.agents.length) button.appendChild(el('span', 'note', 'agents: ' + c.agents.join(', ')));
438
556
  if (c.annotation) button.appendChild(el('span', 'note', c.annotation));
439
557
  button.addEventListener('click', function () { showDetail(c, lane, button); });
440
558
  box.appendChild(button);
559
+ buttons.push(button);
560
+ allCards.push({ card: c, button: button, hay: ((c.id || '') + ' ' + (c.title || '') + ' ' + (c.init || '')).toLowerCase() });
441
561
  });
442
562
  lanesWrap.appendChild(box);
563
+ box.tyranApply = function (q) {
564
+ var shown = 0;
565
+ buttons.forEach(function (b, i) {
566
+ var hit = q === '' || ((cards[i].id || '') + ' ' + (cards[i].title || '') + ' ' + (cards[i].init || '')).toLowerCase().indexOf(q) !== -1;
567
+ b.style.display = hit ? '' : 'none';
568
+ if (hit) shown += 1;
569
+ });
570
+ count.textContent = q === '' ? ' (' + cards.length + ')' : ' (' + shown + ' of ' + cards.length + ')';
571
+ emptyMark.style.display = shown === 0 && cards.length > 0 ? '' : (cards.length === 0 ? '' : 'none');
572
+ return shown;
573
+ };
443
574
  });
575
+ var applyFilter = function () {
576
+ var q = filterInput.value.trim().toLowerCase();
577
+ var shown = 0;
578
+ [].forEach.call(lanesWrap.children, function (box) { shown += box.tyranApply(q); });
579
+ filterCount.textContent = q === '' ? '' : shown + ' of ' + allCards.length + ' ticket(s)';
580
+ };
581
+ filterInput.addEventListener('input', applyFilter);
444
582
  bd.appendChild(lanesWrap);
445
583
  bd.appendChild(detail);
446
584
 
@@ -601,9 +739,18 @@ if (data.schema !== 1) {
601
739
  if (typeof fetch === 'function') {
602
740
  fetch('cost.json', { headers: { accept: 'application/json' } })
603
741
  .then(function (r) {
742
+ // 404 is not a failure, it is an ANSWER: no such route, so this page
743
+ // is not being served by the board server — a copy on a docs site, a
744
+ // file behind some other static host. Distinct from a 503, which
745
+ // means the reader ran and could not finish.
746
+ if (r.status === 404) return { absent: true };
604
747
  return r.json().then(function (body) { return { ok: r.ok, body: body }; });
605
748
  })
606
749
  .then(function (res) {
750
+ if (res.absent) {
751
+ showCostFailure('Spend is not served on this page. Run the board against your own repo to see it: npx @jjanczur/tyran board --dir .tyran --serve');
752
+ return;
753
+ }
607
754
  var payload = res.body;
608
755
  if (!res.ok) {
609
756
  showCostFailure('Spend could not be read: ' + ((payload && payload.error) || 'the server refused the request') + '.');
@@ -171,6 +171,13 @@ export function naturalCompare(a, b) {
171
171
  }
172
172
 
173
173
  /** Stable sort by a natural key; ties keep their original (journal) order. */
174
+ /** Deduplicated and naturally ordered — a board.json array is compared byte
175
+ * for byte, so "the order the journal happened to spawn them in" is not a
176
+ * property this can rest on. */
177
+ function sortedUnique(values) {
178
+ return [...new Set(values)].sort(naturalCompare);
179
+ }
180
+
174
181
  function sortByKey(items, keyOf) {
175
182
  return items
176
183
  .map((item, i) => [item, i])
@@ -695,6 +702,13 @@ export function boardOf(state) {
695
702
  id: t.id,
696
703
  title: t.title,
697
704
  agents: runningByTicket.get(t.id) ?? [],
705
+ // Everyone who ever held it, not only whoever holds it now. `agents`
706
+ // empties the moment an agent reports, so a merged ticket carried no
707
+ // trace of who did the work — and "who touched this" is a question
708
+ // people ask about FINISHED tickets, never about running ones. The fold
709
+ // has kept the list since spawns learned to name a ticket; only the
710
+ // board dropped it.
711
+ worked_by: sortedUnique(t.agents),
698
712
  since: t.lastTs,
699
713
  annotation: annotations.length > 0 ? annotations.join(' · ') : null,
700
714
  });