@jjanczur/tyran 0.1.10 → 0.1.12
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +48 -0
- package/README.md +5 -3
- package/agents/implementer.md +23 -6
- package/agents/retro.md +4 -0
- package/agents/reviewer.md +4 -0
- package/agents/scout.md +4 -1
- package/bin/tyran.mjs +4 -0
- package/hooks/hooks.json +10 -0
- package/hooks/scripts/board-refresh.mjs +89 -0
- package/package.json +1 -1
- package/scripts/board-html.mjs +227 -0
- package/scripts/board.mjs +352 -0
- package/scripts/doctor.mjs +83 -2
- package/scripts/journal.mjs +73 -2
- package/scripts/project.mjs +435 -28
- package/skills/run/SKILL.md +30 -3
- package/skills/status/SKILL.md +5 -1
|
@@ -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.
|
|
14
|
+
"version": "0.1.12",
|
|
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.
|
|
3
|
+
"version": "0.1.12",
|
|
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,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.12 — 2026-08-13
|
|
4
|
+
|
|
5
|
+
### The board: every ticket in a lane, every question in front of you
|
|
6
|
+
|
|
7
|
+
The read-only dashboard the roadmap promised, built the only way this state
|
|
8
|
+
layer allows: as a projection. `BOARD.md`/`board.json` render next to every
|
|
9
|
+
journal with the other projections; `scripts/board.mjs` folds every
|
|
10
|
+
initiative into one `.tyran/state/BOARD.md`, `board.json` (schema 1) and
|
|
11
|
+
`board.html` — a self-contained page in the landing page's own stone/gold/
|
|
12
|
+
glow palette that refreshes itself, puts the waiting-on-you queue first
|
|
13
|
+
(question, recommendation, default), lights the agent strip with each
|
|
14
|
+
agent's own last signal, and computes ages in the browser so the artefact
|
|
15
|
+
itself stays clock-free and byte-checkable. `--serve` adds a loopback-only
|
|
16
|
+
always-fresh viewer.
|
|
17
|
+
|
|
18
|
+
Lanes derive strongest-verdict-first from events that already exist —
|
|
19
|
+
`merge`, reviews, reports, running spawns, dep satisfaction (an unknown dep
|
|
20
|
+
refuses to schedule), blockages, `ticket.status` overrides, operator asks
|
|
21
|
+
(`WAITING_ON_OPERATOR` gates; `answered` joins the pass set), and the
|
|
22
|
+
overnight pause. A `SubagentStop` probe re-renders after every agent, with
|
|
23
|
+
the CLI's own damaged-journal refusal mirrored so an empty render never
|
|
24
|
+
clobbers good state; doctor gains `board-absent` (info) and drift coverage
|
|
25
|
+
for the new pair; an unreadable initiative is a visible UNREADABLE entry.
|
|
26
|
+
|
|
27
|
+
## 0.1.11 — 2026-08-13
|
|
28
|
+
|
|
29
|
+
### The journal learns what agents are doing, finding, and waiting on
|
|
30
|
+
|
|
31
|
+
The closed event set grows 14 → 17 — the reviewed core change the journal
|
|
32
|
+
page names. `progress` is the agent's own mid-run signal (`started` ·
|
|
33
|
+
`working` · `blocked` · `unblocked`, a closed list emitted at four named
|
|
34
|
+
points, never part of spawn↔report pairing); `finding` is a claim about a named
|
|
35
|
+
area plus the proof for it, queryable by other agents (`F-<n>` ids issued
|
|
36
|
+
by `append`);
|
|
37
|
+
`ticket.status` is the conductor's lane override for exactly the three
|
|
38
|
+
states no lifecycle event can derive (`blocked` · `waiting-operator` ·
|
|
39
|
+
`parked`), cleared automatically by the next report, review or merge and
|
|
40
|
+
never counted as progress. Both new value sets are closed and rejected at
|
|
41
|
+
append naming the whole set; the free-text keys `detail`/`claim`/`proof`
|
|
42
|
+
cap at 2 000 codepoints — rejected, never truncated.
|
|
43
|
+
|
|
44
|
+
STATE.md gains `Open blockages` and `Findings` sections and a per-agent
|
|
45
|
+
`Last signal` column; doctor gains `spawn-blocked` (an agent whose own last
|
|
46
|
+
signal says blocked, past a threshold); the agent contracts gain the
|
|
47
|
+
emission points, the anti-duplication grep, and the implementer's "what you
|
|
48
|
+
did NOT do" report section; operator questions and mid-run ticket intake
|
|
49
|
+
now land as journal events, so the coming board can render them.
|
|
50
|
+
|
|
3
51
|
## 0.1.10 — 2026-08-13
|
|
4
52
|
|
|
5
53
|
### Overnight mode: the usage cliff becomes a wind-down
|
package/README.md
CHANGED
|
@@ -343,7 +343,7 @@ Tyran does, and that is the point of the "small curated core" row above —
|
|
|
343
343
|
oh-my-claudecode's own issue #2943 is titled "50+ skills exceeding context
|
|
344
344
|
description budget", which is the bill that arrives with the larger number.
|
|
345
345
|
Tyran's fourteen are held under a description budget CI enforces on every
|
|
346
|
-
push (
|
|
346
|
+
push (4352 of 5000 characters, and a test fails if this sentence and the
|
|
347
347
|
script ever disagree). That ceiling was 4000 for the first eight skills and
|
|
348
348
|
was raised once, deliberately, with the reason in the changelog — the
|
|
349
349
|
distinction being that #2943 describes a budget that was <i>exceeded</i>, and
|
|
@@ -359,7 +359,7 @@ Published on npm as [`@jjanczur/tyran`](https://www.npmjs.com/package/@jjanczur/
|
|
|
359
359
|
command stays `tyran` either way; only the registry name is scoped, the same
|
|
360
360
|
pattern as `@angular/cli` giving you `ng`. `bin/tyran.mjs` exposes the same
|
|
361
361
|
scripts the plugin's hooks and skills already call — `doctor`, `scan-repo`,
|
|
362
|
-
`tiers`, `journal`, `schema`, `knowledge`, `stop-check`,
|
|
362
|
+
`tiers`, `journal`, `schema`, `knowledge`, `board`, `overnight`, `statusline`, `stop-check`,
|
|
363
363
|
`scan-control-chars`, `desc-budget` — for a shell or a CI job with no Claude
|
|
364
364
|
Code session. Zero dependencies; `--help` lists them.
|
|
365
365
|
|
|
@@ -440,7 +440,9 @@ underlying script does.
|
|
|
440
440
|
telemetry sidecar, a wind-down gate near the subscription window, and a
|
|
441
441
|
watcher that resumes (or, on a days-away weekly reset, notifies and
|
|
442
442
|
holds) — see [docs/overnight.md](docs/overnight.md)
|
|
443
|
-
- [
|
|
443
|
+
- [x] Read-only dashboard: the kanban board — `BOARD.md`/`board.json` next to
|
|
444
|
+
every journal, one cross-initiative `board.html` in the landing page's
|
|
445
|
+
own palette, refreshed on every subagent stop, plus `board.mjs --serve`
|
|
444
446
|
|
|
445
447
|
## Where this came from
|
|
446
448
|
|
package/agents/implementer.md
CHANGED
|
@@ -15,6 +15,21 @@ commits and anything written to disk are in English.**
|
|
|
15
15
|
lease file as the handoff describes. Another agent's unexpired lease
|
|
16
16
|
means you do NOT start — you report back. Release it when you finish,
|
|
17
17
|
including when you finish by failing.
|
|
18
|
+
- **Signal at four points, no more** — `progress` events appended to the
|
|
19
|
+
MAIN checkout's journal (the handoff carries its absolute path):
|
|
20
|
+
`started` right after the lease (it is also the proof the lease protocol
|
|
21
|
+
was honoured) · `blocked` at the FIRST blockage, BEFORE attempting any
|
|
22
|
+
workaround · `unblocked` when it clears · `working` before the final
|
|
23
|
+
full validation run, the longest silent stretch you have. Shape:
|
|
24
|
+
`node ${CLAUDE_PLUGIN_ROOT}/scripts/journal.mjs append <abs-journal>
|
|
25
|
+
progress <init> --actor <you> --data
|
|
26
|
+
'{"agent":"<you>","state":"blocked","ticket":"T-n","detail":"..."}'`.
|
|
27
|
+
Four emissions per story; this is a closed list, not a diary.
|
|
28
|
+
- **Grep before you build.** Search for an existing implementation of the
|
|
29
|
+
thing you are about to write; if it exists, report it as a corrected
|
|
30
|
+
premise instead of duplicating it. Durable discoveries worth another
|
|
31
|
+
agent's time go into the journal as `finding` events (`area` + `claim`
|
|
32
|
+
are required, plus its `proof`) — not only into prose.
|
|
18
33
|
- **Verify the handoff's premises in the code.** A stale path, a wrong
|
|
19
34
|
assignment, a function that no longer exists — correct it and report the
|
|
20
35
|
correction EXPLICITLY instead of executing blindly. Premises about DATA
|
|
@@ -54,9 +69,11 @@ commits and anything written to disk are in English.**
|
|
|
54
69
|
and showing it still fails — not by asserting it. Take that baseline
|
|
55
70
|
after a `git fetch` run immediately beforehand; a stale remote once
|
|
56
71
|
turned a correct proof into a false accusation.
|
|
57
|
-
7. **Final report:** what was done ·
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
7. **Final report:** what was done · **what you did NOT do** (scope cut,
|
|
73
|
+
tests skipped, the input class you never exercised — name the worst case
|
|
74
|
+
for each, this section is a merge gate) · test and validation output ·
|
|
75
|
+
what the optimization pass changed · branch or PR · premises you
|
|
76
|
+
corrected · a verdict on every knowledge-brief entry id in your handoff
|
|
77
|
+
(helped, wrong, or unused — the retrospective folds these into the
|
|
78
|
+
store's counters) · open doubts. The open doubts are worth more than the
|
|
79
|
+
summary; do not tidy them away.
|
package/agents/retro.md
CHANGED
|
@@ -17,6 +17,10 @@ to disk is in English.**
|
|
|
17
17
|
the process itself).
|
|
18
18
|
2. The agents' reports from this initiative: corrected premises, escalations,
|
|
19
19
|
open doubts. This is the densest source of signal you have.
|
|
20
|
+
Alongside them, the journal's `finding` events (`journal.mjs query <file>
|
|
21
|
+
--ev finding`) — the claims agents recorded WITH proof, mid-run. Promote
|
|
22
|
+
the recurring ones into `.tyran/knowledge/` through the filter below; the
|
|
23
|
+
rest die with the initiative, which is correct.
|
|
20
24
|
3. `git log` for the initiative: reverts, fixes of your own regressions,
|
|
21
25
|
repeated phases.
|
|
22
26
|
4. The current state of `skills/`, `agents/`, `scripts/` and the docs — **so
|
package/agents/reviewer.md
CHANGED
|
@@ -25,6 +25,10 @@ that keeps you.
|
|
|
25
25
|
author's report with no raw command output you reject on sight, without
|
|
26
26
|
reading further. Run the tests yourself; for UI, drive the browser yourself
|
|
27
27
|
through `browser-check`. Paste what you got, with counts.
|
|
28
|
+
- **Signal `started` after taking your lease, `blocked`/`unblocked` when a
|
|
29
|
+
blockage genuinely stops the review** — `progress` events to the main
|
|
30
|
+
checkout's journal, path from the handoff. No `working` signal: your
|
|
31
|
+
`review` event is your completion, and it closes your spawn.
|
|
28
32
|
- Settle disputed measurements (font size, padding, colour) by dumping
|
|
29
33
|
computed styles to JSON, never by eye. An "it looks off" audit produces
|
|
30
34
|
wrong findings at roughly the rate it produces right ones.
|
package/agents/scout.md
CHANGED
|
@@ -17,7 +17,10 @@ disk is in English.**
|
|
|
17
17
|
2. **A finding is a claim plus its proof.** Every line you return is
|
|
18
18
|
`finding -> path:line, quoted fragment, or URL`. The conductor reads dozens
|
|
19
19
|
of these; there is no budget for warm-up paragraphs, and an unsourced
|
|
20
|
-
finding costs more than no finding because someone will act on it.
|
|
20
|
+
finding costs more than no finding because someone will act on it. Prefix
|
|
21
|
+
the ones that will outlive this task with `DURABLE:` — the conductor
|
|
22
|
+
journals those as `finding` events (rule 1 stands: you write nothing, not
|
|
23
|
+
even to the journal; the prefix is how a durable fact reaches it anyway).
|
|
21
24
|
3. **When you did not find something, say "I did not find it"** and list
|
|
22
25
|
where you looked. Never fill the gap with a guess. Anchor every grep over
|
|
23
26
|
env or config files (`grep -nE '^VARIABLE='`) — an unanchored grep matches
|
package/bin/tyran.mjs
CHANGED
|
@@ -80,6 +80,10 @@ export const COMMANDS = {
|
|
|
80
80
|
'statusline.mjs',
|
|
81
81
|
'Statusline helper that tees platform rate-limit telemetry into .tyran/state/usage.json for the usage gate.',
|
|
82
82
|
],
|
|
83
|
+
board: [
|
|
84
|
+
'board.mjs',
|
|
85
|
+
'Render the cross-initiative kanban board — BOARD.md, board.json and the board.html dashboard — from the journals under .tyran/state/.',
|
|
86
|
+
],
|
|
83
87
|
'stop-check': [
|
|
84
88
|
'stop-check.mjs',
|
|
85
89
|
'Check the .tyran/STOP operator brake that halts a running initiative before its next spawn or merge.',
|
package/hooks/hooks.json
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* board-refresh — the board is fresh after every agent, without anyone
|
|
4
|
+
* remembering to regenerate it.
|
|
5
|
+
*
|
|
6
|
+
* A SubagentStop PROBE, deliberately separate from the evidence gate that
|
|
7
|
+
* shares the event: a gate's output channel is a refusal channel, and a
|
|
8
|
+
* render failure must never refuse a report — while the evidence gate's own
|
|
9
|
+
* header refuses to drag the projection module into a gate's startup. Probes
|
|
10
|
+
* fail open by construction (`runProbe`); every failure here degrades to
|
|
11
|
+
* silence and the next merge re-renders anyway.
|
|
12
|
+
*
|
|
13
|
+
* Interleaving note: the evidence gate may append its `gate` event
|
|
14
|
+
* concurrently with this render. The journal's write lock serializes the
|
|
15
|
+
* writers; this probe may therefore render the pre-event state, which the
|
|
16
|
+
* next stop or merge corrects. A board is a projection, not a ledger.
|
|
17
|
+
*/
|
|
18
|
+
import { existsSync } from 'node:fs';
|
|
19
|
+
import { join, resolve } from 'node:path';
|
|
20
|
+
import { realpathSync } from 'node:fs';
|
|
21
|
+
import { fileURLToPath } from 'node:url';
|
|
22
|
+
import { resolveRepoRoot } from './session-start.mjs';
|
|
23
|
+
import { main, runProbe } from './hook-io.mjs';
|
|
24
|
+
|
|
25
|
+
export const DEADLINE_MS = 6000;
|
|
26
|
+
|
|
27
|
+
export async function refresh(input) {
|
|
28
|
+
const repoRoot = resolveRepoRoot(input);
|
|
29
|
+
if (repoRoot === null) return {};
|
|
30
|
+
const tyranDir = join(repoRoot, '.tyran');
|
|
31
|
+
if (!existsSync(join(tyranDir, 'state'))) return {};
|
|
32
|
+
try {
|
|
33
|
+
// Dynamic imports on purpose: nothing heavy loads before we know there is
|
|
34
|
+
// a state directory to render.
|
|
35
|
+
const [{ readdirSync, statSync }, projectModule, boardModule] = await Promise.all([
|
|
36
|
+
import('node:fs'),
|
|
37
|
+
import('../../scripts/project.mjs'),
|
|
38
|
+
import('../../scripts/board.mjs'),
|
|
39
|
+
]);
|
|
40
|
+
const stateDir = join(tyranDir, 'state');
|
|
41
|
+
for (const name of readdirSync(stateDir).sort()) {
|
|
42
|
+
const dir = join(stateDir, name);
|
|
43
|
+
try {
|
|
44
|
+
if (!statSync(dir).isDirectory()) continue;
|
|
45
|
+
const journal = join(dir, 'journal.jsonl');
|
|
46
|
+
if (!existsSync(journal)) continue;
|
|
47
|
+
const { files, state } = projectModule.projectFile(journal);
|
|
48
|
+
// The CLI's own refusal guard, mirrored: a journal with zero readable
|
|
49
|
+
// events and damage renders an EMPTY board — writing that over good
|
|
50
|
+
// projections would erase state exactly when the journal needs help.
|
|
51
|
+
if (state.total === 0 && (state.corruptLines + state.malformed > 0 || state.truncatedTail)) continue;
|
|
52
|
+
projectModule.writeAllAtomic(Object.entries(files).map(([f, content]) => [join(dir, f), content]));
|
|
53
|
+
} catch {
|
|
54
|
+
/* one broken initiative must not stop the rest */
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const rendered = boardModule.renderAll(tyranDir);
|
|
58
|
+
projectModule.writeAllAtomic(
|
|
59
|
+
Object.entries(rendered.files).map(([name, content]) => [join(stateDir, name), content]),
|
|
60
|
+
);
|
|
61
|
+
} catch {
|
|
62
|
+
/* a probe never speaks about its own failure; doctor reports staleness */
|
|
63
|
+
}
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function canonicalPath(path) {
|
|
68
|
+
const abs = resolve(path);
|
|
69
|
+
try {
|
|
70
|
+
return realpathSync(abs);
|
|
71
|
+
} catch {
|
|
72
|
+
return abs;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function isMainModule(moduleUrl) {
|
|
77
|
+
if (!process.argv[1]) return false;
|
|
78
|
+
return canonicalPath(process.argv[1]) === canonicalPath(fileURLToPath(moduleUrl));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (isMainModule(import.meta.url)) {
|
|
82
|
+
await main(() =>
|
|
83
|
+
runProbe({
|
|
84
|
+
event: 'SubagentStop',
|
|
85
|
+
deadlineMs: DEADLINE_MS,
|
|
86
|
+
handler: ({ input }) => refresh(input),
|
|
87
|
+
}),
|
|
88
|
+
);
|
|
89
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jjanczur/tyran",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
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": {
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { FORBIDDEN } from './invisible.mjs';
|
|
3
|
+
/**
|
|
4
|
+
* board-html — the one page an operator stares at overnight.
|
|
5
|
+
*
|
|
6
|
+
* Renders the cross-initiative board payload (see board.mjs) as a single
|
|
7
|
+
* self-contained HTML file: inline CSS, inline JS, no network requests, works
|
|
8
|
+
* over file://. A <meta refresh> keeps it current — fetch() of a sibling file
|
|
9
|
+
* is blocked over file:// in Chromium, so meta-refresh is the one reliable
|
|
10
|
+
* primitive; under `board.mjs --serve` the same refresh hits the server.
|
|
11
|
+
*
|
|
12
|
+
* ## Style: the landing page's system, not a new one
|
|
13
|
+
*
|
|
14
|
+
* Tokens are copied from `site/src/styles/landing.css` (operator-decided
|
|
15
|
+
* 2026-08-14): the stone/gold/glow palette read off the banner, system font
|
|
16
|
+
* stacks (no web fonts), dark only. The semantic mapping keeps the landing's
|
|
17
|
+
* own rules — gold is the ONE accent, so it marks the operator's waiting
|
|
18
|
+
* queue (the page's only call to action); the glow is a light source, so it
|
|
19
|
+
* lights the agent strip (literally the cold light off the agents' screens);
|
|
20
|
+
* red stays refusal (the PAUSED banner, the blocked lane); green stays the
|
|
21
|
+
* ledger `+` (the done lane).
|
|
22
|
+
*
|
|
23
|
+
* ## Safety
|
|
24
|
+
*
|
|
25
|
+
* Three layers, each pinned by a test that fails with the layer removed:
|
|
26
|
+
* board.json is already invisible-escaped (`jsonEscapeInvisible`); the JSON
|
|
27
|
+
* embedded in the page additionally escapes `<` as < so a journal value
|
|
28
|
+
* containing `</script>` cannot break out; and the client renders with
|
|
29
|
+
* createElement/textContent ONLY — no innerHTML anywhere.
|
|
30
|
+
*
|
|
31
|
+
* Determinism: the page shows "as of <newest event ts>", never the wall
|
|
32
|
+
* clock, so `--check` covers board.html byte-for-byte. Ages in the agent
|
|
33
|
+
* strip are computed client-side from Date.now() — the one place a clock is
|
|
34
|
+
* allowed, because it runs in the viewer's browser, not in the artifact.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
const CSS = `
|
|
38
|
+
:root{
|
|
39
|
+
--bg:#12100e;--bg-raised:#1c1917;--bg-sunken:#0d0c0a;
|
|
40
|
+
--text:#d9d2c6;--heading:#f5efe3;--muted:#a29788;
|
|
41
|
+
--hairline:#3b342c;--hairline-soft:#29241f;
|
|
42
|
+
--gold:#d4a017;--gold-bright:#e8bc4d;--gold-low:#2a2110;
|
|
43
|
+
--glow:#8fd8ea;--glow-dim:#1e3a44;
|
|
44
|
+
--red:#f2665e;--red-low:#35191a;--green:#8fce6a;
|
|
45
|
+
--display:ui-serif,'Iowan Old Style','Palatino Linotype',Palatino,'Book Antiqua',Georgia,'Times New Roman',serif;
|
|
46
|
+
--font:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;
|
|
47
|
+
--mono:ui-monospace,SFMono-Regular,'SF Mono',Menlo,Consolas,'Liberation Mono',monospace;
|
|
48
|
+
--radius:0.75rem;color-scheme:dark;
|
|
49
|
+
}
|
|
50
|
+
*{box-sizing:border-box}
|
|
51
|
+
body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);font-size:1rem;line-height:1.55;-webkit-font-smoothing:antialiased;padding:1.25rem}
|
|
52
|
+
main{max-width:68rem;margin:0 auto}
|
|
53
|
+
h1{font-family:var(--display);color:var(--heading);font-size:1.6rem;margin:0 0 .25rem}
|
|
54
|
+
h2{font-family:var(--display);color:var(--heading);font-size:1.05rem;margin:1.5rem 0 .5rem;border-bottom:1px solid var(--hairline-soft);padding-bottom:.3rem}
|
|
55
|
+
.meta{color:var(--muted);font-family:var(--mono);font-size:.8rem}
|
|
56
|
+
.paused{background:var(--red-low);border:1px solid var(--red);color:var(--red);border-radius:var(--radius);padding:.6rem .9rem;margin:.9rem 0;font-weight:600}
|
|
57
|
+
.ask{background:var(--gold-low);border:1px solid var(--gold);border-radius:var(--radius);padding:.7rem .9rem;margin:.5rem 0}
|
|
58
|
+
.ask .q{color:var(--gold-bright);font-size:1.05rem;font-weight:600}
|
|
59
|
+
.ask .row{margin-top:.25rem;font-size:.9rem}
|
|
60
|
+
.ask .label{color:var(--muted);text-transform:uppercase;font-size:.7rem;letter-spacing:.06em;margin-right:.4rem}
|
|
61
|
+
.agents{display:flex;flex-wrap:wrap;gap:.5rem}
|
|
62
|
+
.agent{background:var(--bg-raised);border:1px solid var(--glow-dim);border-left:3px solid var(--glow);border-radius:var(--radius);padding:.45rem .7rem;font-family:var(--mono);font-size:.8rem;min-width:14rem}
|
|
63
|
+
.agent .name{color:var(--glow);font-weight:600}
|
|
64
|
+
.agent .age-fresh{color:var(--green)}
|
|
65
|
+
.agent .age-warm{color:var(--gold-bright)}
|
|
66
|
+
.agent .age-cold{color:var(--red)}
|
|
67
|
+
.lanes{display:grid;grid-template-columns:repeat(auto-fill,minmax(15rem,1fr));gap:.7rem;align-items:start}
|
|
68
|
+
.lane{background:var(--bg-sunken);border:1px solid var(--hairline-soft);border-radius:var(--radius);padding:.6rem}
|
|
69
|
+
.lane h3{margin:0 0 .4rem;font-size:.8rem;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}
|
|
70
|
+
.lane h3 .count{color:var(--text)}
|
|
71
|
+
.lane.blocked{border-color:var(--red)}
|
|
72
|
+
.lane.blocked h3 .count{color:var(--red)}
|
|
73
|
+
.lane.done h3 .count{color:var(--green)}
|
|
74
|
+
.lane.waiting-operator{border-color:var(--gold-dim, #6d5410)}
|
|
75
|
+
.card{background:var(--bg-raised);border:1px solid var(--hairline);border-radius:.5rem;padding:.4rem .55rem;margin:.3rem 0;font-size:.85rem}
|
|
76
|
+
.card .id{font-family:var(--mono);color:var(--heading)}
|
|
77
|
+
.card .init{font-family:var(--mono);color:var(--muted);font-size:.7rem}
|
|
78
|
+
.card .note{color:var(--muted);font-size:.78rem;display:block}
|
|
79
|
+
.empty{color:var(--hairline);font-size:.8rem}
|
|
80
|
+
footer{margin-top:2rem;color:var(--muted);font-size:.75rem;border-top:1px solid var(--hairline-soft);padding-top:.6rem}
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The FORBIDDEN ranges as a regex character class, generated rather than
|
|
85
|
+
* retyped: this is the same question `escapeInvisible` answers, and ADR-21
|
|
86
|
+
* gives it one answer. Emitted as `\u{...}` escapes so this file's own bytes
|
|
87
|
+
* stay ASCII — writing the characters themselves is what the write guard
|
|
88
|
+
* refuses, and it refused this very edit once.
|
|
89
|
+
*/
|
|
90
|
+
const CLIENT_INVISIBLE_CLASS = FORBIDDEN.map(({ lo, hi }) => {
|
|
91
|
+
const cp = (n) => `\\u{${n.toString(16).toUpperCase()}}`;
|
|
92
|
+
return lo === hi ? cp(lo) : `${cp(lo)}-${cp(hi)}`;
|
|
93
|
+
}).join('');
|
|
94
|
+
|
|
95
|
+
const CLIENT_JS = `
|
|
96
|
+
'use strict';
|
|
97
|
+
var data = JSON.parse(document.getElementById('board-data').textContent);
|
|
98
|
+
if (data.schema !== 1) {
|
|
99
|
+
document.getElementById('app').textContent = 'This board.json is schema ' + data.schema + ' — regenerate with a newer Tyran.';
|
|
100
|
+
} else {
|
|
101
|
+
// board.json's escaping is LOSSLESS — JSON.parse hands the browser the
|
|
102
|
+
// original codepoints back — so the page is where invisibles must be
|
|
103
|
+
// neutralised. They cannot inject (textContent never parses markup), but an
|
|
104
|
+
// unterminated right-to-left override mirrors every character after it and
|
|
105
|
+
// rewrites the page a human is reading, and TAG characters map one-to-one
|
|
106
|
+
// onto ASCII while rendering as nothing. Escaped, never dropped: a value the
|
|
107
|
+
// operator cannot see is a value they cannot judge.
|
|
108
|
+
var INVISIBLE = new RegExp('[${CLIENT_INVISIBLE_CLASS}]', 'gu');
|
|
109
|
+
var show = function (value) {
|
|
110
|
+
return String(value).replace(INVISIBLE, function (ch) {
|
|
111
|
+
return '\\\\u' + ch.codePointAt(0).toString(16).toUpperCase();
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
var el = function (tag, cls, text) {
|
|
115
|
+
var node = document.createElement(tag);
|
|
116
|
+
if (cls) node.className = cls;
|
|
117
|
+
if (text !== undefined && text !== null) node.textContent = show(text);
|
|
118
|
+
return node;
|
|
119
|
+
};
|
|
120
|
+
var app = document.getElementById('app');
|
|
121
|
+
var head = el('div');
|
|
122
|
+
head.appendChild(el('h1', null, 'Tyran board'));
|
|
123
|
+
var totals = data.totals || {};
|
|
124
|
+
head.appendChild(el('div', 'meta',
|
|
125
|
+
(totals.agents || 0) + ' agent(s) running across ' + (totals.initiatives || 0) + ' initiative(s) · ' +
|
|
126
|
+
(totals.merged || 0) + '/' + (totals.tickets || 0) + ' tickets merged (' + (totals.percent || 0) + '%) · as of ' + (data.as_of || 'unknown')));
|
|
127
|
+
app.appendChild(head);
|
|
128
|
+
|
|
129
|
+
(data.paused || []).forEach(function (p) {
|
|
130
|
+
app.appendChild(el('div', 'paused', 'PAUSED — ' + p.init + ': gate ' + p.kind + ' (' + p.result + ') since ' + p.since));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
var asks = data.asks || [];
|
|
134
|
+
app.appendChild(el('h2', null, 'Waiting on you (' + asks.length + ')'));
|
|
135
|
+
if (asks.length === 0) app.appendChild(el('div', 'empty', 'nothing — the agents have what they need'));
|
|
136
|
+
asks.forEach(function (a) {
|
|
137
|
+
var card = el('div', 'ask');
|
|
138
|
+
card.appendChild(el('div', 'q', a.question || '(no question recorded — gate ' + a.kind + ')'));
|
|
139
|
+
[['recommendation', a.recommendation], ['default', a.default],
|
|
140
|
+
['ticket', a.ticket], ['initiative', a.init], ['since', a.since]].forEach(function (pair) {
|
|
141
|
+
if (pair[1] === null || pair[1] === undefined) return;
|
|
142
|
+
var row = el('div', 'row');
|
|
143
|
+
row.appendChild(el('span', 'label', pair[0]));
|
|
144
|
+
row.appendChild(el('span', null, pair[1]));
|
|
145
|
+
card.appendChild(row);
|
|
146
|
+
});
|
|
147
|
+
app.appendChild(card);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
var agents = data.agents || [];
|
|
151
|
+
app.appendChild(el('h2', null, 'Agents (' + agents.length + ')'));
|
|
152
|
+
var strip = el('div', 'agents');
|
|
153
|
+
if (agents.length === 0) strip.appendChild(el('div', 'empty', 'none running'));
|
|
154
|
+
agents.forEach(function (a) {
|
|
155
|
+
var chip = el('div', 'agent');
|
|
156
|
+
chip.appendChild(el('div', 'name', a.agent + (a.role ? ' · ' + a.role : '')));
|
|
157
|
+
chip.appendChild(el('div', null, (a.init ? a.init + ' · ' : '') + (a.ticket || 'no ticket') + ' · ' + a.state));
|
|
158
|
+
if (a.detail) chip.appendChild(el('div', 'note', a.detail));
|
|
159
|
+
var ageMs = a.last_signal ? Date.now() - Date.parse(a.last_signal) : null;
|
|
160
|
+
var cls = ageMs === null ? 'age-cold' : ageMs < 600000 ? 'age-fresh' : ageMs < 1800000 ? 'age-warm' : 'age-cold';
|
|
161
|
+
var ageText = ageMs === null ? 'no signal' : Math.round(ageMs / 60000) + ' min since last signal';
|
|
162
|
+
chip.appendChild(el('div', cls, ageText));
|
|
163
|
+
strip.appendChild(chip);
|
|
164
|
+
});
|
|
165
|
+
app.appendChild(strip);
|
|
166
|
+
|
|
167
|
+
app.appendChild(el('h2', null, 'Lanes'));
|
|
168
|
+
var lanesWrap = el('div', 'lanes');
|
|
169
|
+
Object.keys(data.lanes || {}).forEach(function (lane) {
|
|
170
|
+
var cards = data.lanes[lane];
|
|
171
|
+
var box = el('div', 'lane ' + lane);
|
|
172
|
+
var h = el('h3');
|
|
173
|
+
h.appendChild(el('span', null, lane + ' '));
|
|
174
|
+
h.appendChild(el('span', 'count', '(' + cards.length + ')'));
|
|
175
|
+
box.appendChild(h);
|
|
176
|
+
if (cards.length === 0) box.appendChild(el('div', 'empty', '—'));
|
|
177
|
+
cards.forEach(function (c) {
|
|
178
|
+
var card = el('div', 'card');
|
|
179
|
+
card.appendChild(el('span', 'id', c.id));
|
|
180
|
+
if (c.title) card.appendChild(el('span', null, ' — ' + c.title));
|
|
181
|
+
if (c.init) card.appendChild(el('span', 'init', ' ' + c.init));
|
|
182
|
+
if (c.agents && c.agents.length) card.appendChild(el('span', 'note', 'agents: ' + c.agents.join(', ')));
|
|
183
|
+
if (c.annotation) card.appendChild(el('span', 'note', c.annotation));
|
|
184
|
+
box.appendChild(card);
|
|
185
|
+
});
|
|
186
|
+
lanesWrap.appendChild(box);
|
|
187
|
+
});
|
|
188
|
+
app.appendChild(lanesWrap);
|
|
189
|
+
|
|
190
|
+
// An initiative the board could not read is the one thing this page must
|
|
191
|
+
// never omit: a missing card is indistinguishable from an initiative with
|
|
192
|
+
// no work, which is the "all is well" reading the board exists to prevent.
|
|
193
|
+
var errors = data.errors || [];
|
|
194
|
+
if (errors.length > 0) {
|
|
195
|
+
app.appendChild(el('h2', null, 'Unreadable (' + errors.length + ')'));
|
|
196
|
+
errors.forEach(function (e) {
|
|
197
|
+
app.appendChild(el('div', 'paused', 'UNREADABLE — ' + e.name + ': ' + e.error));
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
var foot = el('footer');
|
|
202
|
+
foot.appendChild(el('div', null, 'GENERATED by tyran scripts/board.mjs — do not edit. Refreshes every 30 s; ages are computed in this browser.'));
|
|
203
|
+
app.appendChild(foot);
|
|
204
|
+
}
|
|
205
|
+
`;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The page, from an already-serialized cross-board JSON string (the exact
|
|
209
|
+
* bytes of board.json, so the two artefacts can never disagree). The extra
|
|
210
|
+
* `<` escape is the script-element breakout layer.
|
|
211
|
+
*/
|
|
212
|
+
export function renderBoardHtml(payloadJsonText) {
|
|
213
|
+
const embedded = payloadJsonText.replace(/</g, '\\u003C');
|
|
214
|
+
return (
|
|
215
|
+
'<!doctype html>\n' +
|
|
216
|
+
'<!-- GENERATED by tyran scripts/board.mjs - DO NOT EDIT. Source of truth: the journals under .tyran/state/ -->\n' +
|
|
217
|
+
'<html lang="en"><head><meta charset="utf-8">\n' +
|
|
218
|
+
'<meta name="viewport" content="width=device-width, initial-scale=1">\n' +
|
|
219
|
+
'<meta http-equiv="refresh" content="30">\n' +
|
|
220
|
+
'<title>Tyran board</title>\n' +
|
|
221
|
+
`<style>${CSS}</style>\n` +
|
|
222
|
+
'</head><body><main id="app"></main>\n' +
|
|
223
|
+
`<script type="application/json" id="board-data">${embedded}</script>\n` +
|
|
224
|
+
`<script>${CLIENT_JS}</script>\n` +
|
|
225
|
+
'</body></html>\n'
|
|
226
|
+
);
|
|
227
|
+
}
|