@krysoworks/kryso 0.0.0-stage → 2.0.0-rc.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/LICENSE +21 -0
- package/README.md +152 -2
- package/bin/kryso +31 -0
- package/bin/ship-it-status +14 -0
- package/bin/ship-ledger +14 -0
- package/bin/ship-loop +14 -0
- package/bin/ship-pass +14 -0
- package/bin/warden +14 -0
- package/dist/answer.d.ts +38 -0
- package/dist/answer.js +48 -0
- package/dist/bytes.d.ts +5 -0
- package/dist/bytes.js +35 -0
- package/dist/cleanup.d.ts +1 -0
- package/dist/cleanup.js +629 -0
- package/dist/commands.d.ts +48 -0
- package/dist/commands.js +293 -0
- package/dist/completions.d.ts +24 -0
- package/dist/completions.js +239 -0
- package/dist/daemon.d.ts +15 -0
- package/dist/daemon.js +23 -0
- package/dist/diagnose.d.ts +47 -0
- package/dist/diagnose.js +314 -0
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.js +241 -0
- package/dist/env.d.ts +9 -0
- package/dist/env.js +17 -0
- package/dist/evidence.d.ts +39 -0
- package/dist/evidence.js +327 -0
- package/dist/home.d.ts +3 -0
- package/dist/home.js +27 -0
- package/dist/install.d.ts +59 -0
- package/dist/install.js +137 -0
- package/dist/isolate.d.ts +28 -0
- package/dist/isolate.js +402 -0
- package/dist/leftovers.d.ts +5 -0
- package/dist/leftovers.js +156 -0
- package/dist/machine.d.ts +6 -0
- package/dist/machine.js +185 -0
- package/dist/palette.d.ts +147 -0
- package/dist/palette.js +167 -0
- package/dist/plan.d.ts +1 -0
- package/dist/plan.js +133 -0
- package/dist/proc.d.ts +23 -0
- package/dist/proc.js +23 -0
- package/dist/read.d.ts +1 -0
- package/dist/read.js +297 -0
- package/dist/readiness.d.ts +5 -0
- package/dist/readiness.js +64 -0
- package/dist/remote.d.ts +6 -0
- package/dist/remote.js +85 -0
- package/dist/self-update.d.ts +1 -0
- package/dist/self-update.js +224 -0
- package/dist/semver.d.ts +7 -0
- package/dist/semver.js +42 -0
- package/dist/style.d.ts +71 -0
- package/dist/style.js +187 -0
- package/dist/update.d.ts +47 -0
- package/dist/update.js +190 -0
- package/dist/work.d.ts +25 -0
- package/dist/work.js +449 -0
- package/dist/workflows.d.ts +4 -0
- package/dist/workflows.js +73 -0
- package/docker/entrypoint.sh +44 -0
- package/docker/runner.Dockerfile +39 -0
- package/package.json +65 -4
- package/scripts/install-skills.sh +607 -0
- package/skills/code-review/SKILL.md +231 -0
- package/skills/kryso/SKILL.md +107 -0
- package/skills/kryso/golden/help.rounded.ansi +23 -0
- package/skills/kryso/golden/help.square.ansi +23 -0
- package/skills/kryso/golden/help.txt +23 -0
- package/skills/kryso/golden/table-narrow.json +11 -0
- package/skills/kryso/golden/table-narrow.rounded.ansi +4 -0
- package/skills/kryso/golden/table-narrow.square.ansi +4 -0
- package/skills/kryso/golden/table.ansi +5 -0
- package/skills/kryso/golden/table.json +11 -0
- package/skills/kryso/ledger.sh +2146 -0
- package/skills/kryso/palette.json +57 -0
- package/skills/kryso/reference/resuming.md +30 -0
- package/skills/kryso/reference/routing.md +23 -0
- package/skills/kryso/reference/stage-1-claim.md +79 -0
- package/skills/kryso/reference/stage-2-build.md +133 -0
- package/skills/kryso/reference/stage-3-prove.md +51 -0
- package/skills/kryso/reference/stage-4-pr.md +76 -0
- package/skills/kryso/reference/stage-5-reconcile.md +81 -0
- package/skills/kryso/reference/stage-6-merge-or-park.md +73 -0
- package/skills/kryso/reference/stage-7-close-out.md +62 -0
- package/skills/kryso/reference/terminal.md +7 -0
- package/skills/kryso/ship-it-status.sh +1503 -0
- package/skills/kryso/ui.py +274 -0
- package/skills/kryso/ui.sh +609 -0
- package/skills/kryso-build/SKILL.md +168 -0
- package/skills/kryso-shift/SKILL.md +167 -0
- package/skills/kryso-shift/archive.py +2784 -0
- package/skills/kryso-shift/archive_checker.py +462 -0
- package/skills/kryso-shift/archive_checker_lambda.py +155 -0
- package/skills/kryso-shift/archive_health.py +364 -0
- package/skills/kryso-shift/archive_launchd.py +140 -0
- package/skills/kryso-shift/archive_remote.py +990 -0
- package/skills/kryso-shift/archiving-checker.md +140 -0
- package/skills/kryso-shift/archiving-keep.md +115 -0
- package/skills/kryso-shift/archiving-recovery.md +112 -0
- package/skills/kryso-shift/archiving-remote.md +166 -0
- package/skills/kryso-shift/archiving.md +146 -0
- package/skills/kryso-shift/coverage.schema.json +225 -0
- package/skills/kryso-shift/deadline.sh +254 -0
- package/skills/kryso-shift/feedback.schema.json +35 -0
- package/skills/kryso-shift/feedback.sh +228 -0
- package/skills/kryso-shift/history-manifest.schema.json +331 -0
- package/skills/kryso-shift/keep-after.sh +55 -0
- package/skills/kryso-shift/measure.sh +611 -0
- package/skills/kryso-shift/merge-ready.sh +207 -0
- package/skills/kryso-shift/outcome.schema.json +16 -0
- package/skills/kryso-shift/pass-rules.md +8 -0
- package/skills/kryso-shift/profile.schema.json +42 -0
- package/skills/kryso-shift/reader.sh +692 -0
- package/skills/kryso-shift/reads.sh +151 -0
- package/skills/kryso-shift/reference/allowance.md +21 -0
- package/skills/kryso-shift/reference/driver.md +95 -0
- package/skills/kryso-shift/reference/measuring.md +67 -0
- package/skills/kryso-shift/reference/outputs.md +21 -0
- package/skills/kryso-shift/reference/pass-script.md +115 -0
- package/skills/kryso-shift/reference/reconcile-and-merge.md +55 -0
- package/skills/kryso-shift/reference/second-reader.md +9 -0
- package/skills/kryso-shift/reference/sweeps.md +83 -0
- package/skills/kryso-shift/repair.schema.json +14 -0
- package/skills/kryso-shift/report-template.html +679 -0
- package/skills/kryso-shift/report.py +389 -0
- package/skills/kryso-shift/report_fixture.py +65 -0
- package/skills/kryso-shift/reporting.md +58 -0
- package/skills/kryso-shift/result.sh +91 -0
- package/skills/kryso-shift/runner.sh +1178 -0
- package/skills/kryso-shift/ship-loop.sh +3977 -0
- package/skills/kryso-shift/ship-pass.sh +4987 -0
- package/skills/kryso-shift/steps.jq +19 -0
- package/skills/kryso-shift/workflow.mjs +830 -0
- package/skills/kryso-shift/workflows/default.json +22 -0
- package/skills/kryso-shift/workflows/ralph.json +13 -0
- package/skills/kryso-watch/SKILL.md +100 -0
- package/skills/kryso-watch/answer.schema.json +23 -0
- package/skills/kryso-watch/base-refs.sh +44 -0
- package/skills/kryso-watch/board.sh +58 -0
- package/skills/kryso-watch/reference/config.md +23 -0
- package/skills/kryso-watch/reference/outputs.md +30 -0
- package/skills/kryso-watch/reference/report.md +29 -0
- package/skills/kryso-watch/reference/scheduler.md +32 -0
- package/skills/kryso-watch/reference/settlement.md +29 -0
- package/skills/kryso-watch/reference/shift.md +44 -0
- package/skills/kryso-watch/reference/shim-limits.md +22 -0
- package/skills/kryso-watch/reference/triage.md +26 -0
- package/skills/kryso-watch/schema.jq +40 -0
- package/skills/kryso-watch/settle.schema.json +36 -0
- package/skills/kryso-watch/stage-common.sh +187 -0
- package/skills/kryso-watch/stages/report.sh +525 -0
- package/skills/kryso-watch/stages/settle.sh +722 -0
- package/skills/kryso-watch/stages/shift.sh +466 -0
- package/skills/kryso-watch/stages/triage.sh +379 -0
- package/skills/kryso-watch/tracker.sh +27 -0
- package/skills/kryso-watch/triage.schema.json +77 -0
- package/skills/kryso-watch/warden.launchd.plist +50 -0
- package/skills/kryso-watch/warden.schema.json +98 -0
- package/skills/kryso-watch/warden.sh +1004 -0
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5
|
+
<title>Shipping run metrics</title>
|
|
6
|
+
<style>
|
|
7
|
+
:root {
|
|
8
|
+
color-scheme: light;
|
|
9
|
+
--plane: #f9f9f7;
|
|
10
|
+
--surface: #fcfcfb;
|
|
11
|
+
--surface-2: #f3f2ee;
|
|
12
|
+
--ink: #0b0b0b;
|
|
13
|
+
--ink-2: #52514e;
|
|
14
|
+
--muted: #6b6964;
|
|
15
|
+
--hairline: #e1e0d9;
|
|
16
|
+
--baseline: #c3c2b7;
|
|
17
|
+
--ring: rgba(11, 11, 11, .10);
|
|
18
|
+
--accent: #2a78d6;
|
|
19
|
+
--accent-ink: #1c5cab;
|
|
20
|
+
--accent-wash: rgba(42, 120, 214, .09);
|
|
21
|
+
--de-emphasis: #908e87;
|
|
22
|
+
--good: #0ca30c;
|
|
23
|
+
--critical: #d03b3b;
|
|
24
|
+
--s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
|
|
25
|
+
--shadow: 0 6px 24px -12px rgba(11, 11, 11, .28);
|
|
26
|
+
}
|
|
27
|
+
@media (prefers-color-scheme: dark) {
|
|
28
|
+
:root:not([data-theme="light"]) {
|
|
29
|
+
color-scheme: dark;
|
|
30
|
+
--plane: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
|
|
31
|
+
--ink: #ffffff; --ink-2: #c3c2b7; --muted: #95938c;
|
|
32
|
+
--hairline: #2c2c2a; --baseline: #383835; --ring: rgba(255, 255, 255, .10);
|
|
33
|
+
--accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: rgba(57, 135, 229, .14);
|
|
34
|
+
--de-emphasis: #6f6e69; --good: #0ca30c; --critical: #e66767;
|
|
35
|
+
--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
|
|
36
|
+
--shadow: 0 8px 28px -12px rgba(0, 0, 0, .8);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
:root[data-theme="dark"] {
|
|
40
|
+
color-scheme: dark;
|
|
41
|
+
--plane: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
|
|
42
|
+
--ink: #ffffff; --ink-2: #c3c2b7; --muted: #95938c;
|
|
43
|
+
--hairline: #2c2c2a; --baseline: #383835; --ring: rgba(255, 255, 255, .10);
|
|
44
|
+
--accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: rgba(57, 135, 229, .14);
|
|
45
|
+
--de-emphasis: #6f6e69; --good: #0ca30c; --critical: #e66767;
|
|
46
|
+
--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
|
|
47
|
+
--shadow: 0 8px 28px -12px rgba(0, 0, 0, .8);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
* { box-sizing: border-box; }
|
|
51
|
+
html { scrollbar-color: var(--baseline) transparent; }
|
|
52
|
+
body {
|
|
53
|
+
margin: 0; padding: 40px 32px 64px;
|
|
54
|
+
background: var(--plane); color: var(--ink);
|
|
55
|
+
font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
56
|
+
accent-color: var(--accent); caret-color: var(--accent);
|
|
57
|
+
}
|
|
58
|
+
::selection { background: var(--accent); color: #fff; }
|
|
59
|
+
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
|
|
60
|
+
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
|
|
61
|
+
h1 { font-size: 28px; line-height: 1.2; }
|
|
62
|
+
h2 { font-size: 16px; line-height: 1.3; }
|
|
63
|
+
h3 { font-size: 13px; }
|
|
64
|
+
p { margin: 0; }
|
|
65
|
+
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
|
|
66
|
+
button { font: inherit; color: inherit; }
|
|
67
|
+
code { font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-2); overflow-wrap: anywhere; }
|
|
68
|
+
|
|
69
|
+
.top { display: flex; flex-wrap: wrap; gap: 8px 40px; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
|
|
70
|
+
.top .lede { color: var(--ink-2); max-width: 70ch; }
|
|
71
|
+
|
|
72
|
+
.filters {
|
|
73
|
+
display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
|
|
74
|
+
position: sticky; top: 0; z-index: 5;
|
|
75
|
+
margin: 0 -32px; padding: 12px 32px;
|
|
76
|
+
background: color-mix(in oklab, var(--plane) 90%, transparent);
|
|
77
|
+
backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
|
|
78
|
+
border-bottom: 1px solid var(--hairline);
|
|
79
|
+
}
|
|
80
|
+
.filters input, .filters select {
|
|
81
|
+
height: 34px; padding: 0 10px; border: 1px solid var(--baseline); border-radius: 6px;
|
|
82
|
+
background: var(--surface); color: var(--ink); font: inherit; transition: border-color .15s;
|
|
83
|
+
}
|
|
84
|
+
.filters input { flex: 1 1 280px; min-width: 200px; }
|
|
85
|
+
.filters select { max-width: 200px; cursor: pointer; }
|
|
86
|
+
.filters input::placeholder { color: var(--muted); }
|
|
87
|
+
.filters input:hover, .filters select:hover { border-color: var(--muted); }
|
|
88
|
+
.filters input:focus-visible, .filters select:focus-visible { outline-offset: 0; border-color: var(--accent); }
|
|
89
|
+
.filters select.active { border-color: var(--accent); background: var(--accent-wash); }
|
|
90
|
+
.filters .reset { height: 34px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--accent-ink); cursor: pointer; }
|
|
91
|
+
.filters .reset:hover { background: var(--accent-wash); }
|
|
92
|
+
.filters .reset[disabled] { display: none; }
|
|
93
|
+
.filters .count { margin-left: auto; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
94
|
+
|
|
95
|
+
.figures {
|
|
96
|
+
display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
|
|
97
|
+
margin: 28px 0 0; padding: 0; list-style: none;
|
|
98
|
+
border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
|
|
99
|
+
}
|
|
100
|
+
.figures li { padding: 16px 20px; border-left: 1px solid var(--hairline); min-width: 0; }
|
|
101
|
+
.figures li:first-child { border-left: 0; padding-left: 0; }
|
|
102
|
+
.figures .label { display: block; color: var(--ink-2); font-size: 13px; }
|
|
103
|
+
.figures .value { display: block; font-size: 26px; font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; margin-top: 4px; }
|
|
104
|
+
.figures .value.unknown { color: var(--muted); font-weight: 500; }
|
|
105
|
+
.figures .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
|
|
106
|
+
.figures li.lead .value { font-size: 40px; letter-spacing: -0.025em; line-height: 1.1; }
|
|
107
|
+
|
|
108
|
+
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
|
|
109
|
+
.charts .wide { grid-column: 1 / -1; }
|
|
110
|
+
figure {
|
|
111
|
+
margin: 0; padding: 18px 20px 14px; background: var(--surface);
|
|
112
|
+
border: 1px solid var(--ring); border-radius: 10px; min-width: 0; position: relative;
|
|
113
|
+
display: flex; flex-direction: column;
|
|
114
|
+
}
|
|
115
|
+
figcaption { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; align-items: baseline; margin-bottom: 16px; }
|
|
116
|
+
figcaption .legend { justify-self: end; justify-content: flex-end; }
|
|
117
|
+
figcaption p { grid-column: 1 / -1; color: var(--ink-2); font-size: 13px; max-width: 80ch; }
|
|
118
|
+
.empty { padding: 28px 0; color: var(--muted); text-align: center; }
|
|
119
|
+
|
|
120
|
+
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--ink-2); }
|
|
121
|
+
.legend li { display: inline-flex; align-items: center; gap: 6px; }
|
|
122
|
+
.swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; background: var(--accent); }
|
|
123
|
+
.swatch.dim { background: var(--de-emphasis); }
|
|
124
|
+
.swatch.round { border-radius: 50%; }
|
|
125
|
+
|
|
126
|
+
.bars { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr); gap: 8px 14px; align-items: center; }
|
|
127
|
+
.bars .cat { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 24ch; }
|
|
128
|
+
.bars .cat.total { font-weight: 600; }
|
|
129
|
+
.bars .cat small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
|
|
130
|
+
.bars .track { height: 22px; display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
131
|
+
.bars .stack { display: flex; gap: 2px; height: 18px; flex: 1 1 auto; min-width: 0; }
|
|
132
|
+
.mark {
|
|
133
|
+
height: 18px; min-width: 2px; flex: none; background: var(--accent);
|
|
134
|
+
border-radius: 0 4px 4px 0; position: relative; transition: filter .15s;
|
|
135
|
+
}
|
|
136
|
+
.mark:hover { filter: brightness(1.15) saturate(1.1); }
|
|
137
|
+
.stack .mark { flex: var(--f) 1 0; border-radius: 0; display: flex; align-items: center; justify-content: center; color: #0b0b0b; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
138
|
+
.stack .mark:first-child { border-radius: 3px 0 0 3px; }
|
|
139
|
+
.stack .mark:last-child { border-radius: 0 4px 4px 0; }
|
|
140
|
+
.swatch.role-orchestrator, .mark.role-orchestrator { background: var(--s1); }
|
|
141
|
+
.swatch.role-build, .mark.role-build { background: var(--s2); }
|
|
142
|
+
.swatch.role-standards, .mark.role-standards { background: var(--s3); }
|
|
143
|
+
.swatch.role-spec, .mark.role-spec { background: var(--s4); }
|
|
144
|
+
.swatch.role-other, .mark.role-other { background: var(--s5); }
|
|
145
|
+
.stack .mark.role-orchestrator { color: #000; }
|
|
146
|
+
.bars .tip { font-size: 12px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; flex: none; }
|
|
147
|
+
.bars .tip small { color: var(--muted); font-size: 11px; margin-left: 4px; }
|
|
148
|
+
.mark[data-tip]::after {
|
|
149
|
+
content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 6;
|
|
150
|
+
padding: 6px 9px; border-radius: 6px; white-space: pre; font-size: 12px; font-weight: 400; line-height: 1.4; text-align: left;
|
|
151
|
+
color: var(--ink); background: var(--surface); border: 1px solid var(--ring); box-shadow: var(--shadow);
|
|
152
|
+
opacity: 0; transform: translate(-50%, 3px); pointer-events: none; transition: opacity .15s, transform .15s;
|
|
153
|
+
}
|
|
154
|
+
.bars > .track > .mark[data-tip]::after { left: 0; transform: translate(0, 3px); }
|
|
155
|
+
.mark[data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); }
|
|
156
|
+
.bars > .track > .mark[data-tip]:hover::after { transform: none; }
|
|
157
|
+
|
|
158
|
+
.scatter { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
|
|
159
|
+
.plot { position: relative; min-width: 560px; }
|
|
160
|
+
.plot svg { display: block; width: 100%; height: auto; overflow: visible; }
|
|
161
|
+
.plot .grid line { stroke: var(--hairline); stroke-width: 1; shape-rendering: crispEdges; }
|
|
162
|
+
.plot .axis line { stroke: var(--baseline); stroke-width: 1; shape-rendering: crispEdges; }
|
|
163
|
+
.plot text { fill: var(--muted); font-size: 11px; font-family: inherit; font-variant-numeric: tabular-nums; }
|
|
164
|
+
.plot .axis-title { fill: var(--ink-2); font-size: 12px; }
|
|
165
|
+
.plot .pt { fill: var(--de-emphasis); stroke: var(--surface); stroke-width: 1; transition: r .15s; }
|
|
166
|
+
.plot .pt.shipped { fill: var(--accent); }
|
|
167
|
+
.plot .pt.on { stroke: var(--ink); r: 6; }
|
|
168
|
+
.plot .hit { fill: transparent; cursor: pointer; outline: none; }
|
|
169
|
+
.plot .hit:focus-visible { stroke: var(--accent); stroke-width: 2; }
|
|
170
|
+
.tooltip {
|
|
171
|
+
position: absolute; z-index: 6; pointer-events: none; opacity: 0; transition: opacity .12s;
|
|
172
|
+
padding: 8px 10px; border-radius: 6px; font-size: 12px; line-height: 1.4; min-width: 180px; max-width: 300px;
|
|
173
|
+
color: var(--ink); background: var(--surface); border: 1px solid var(--ring); box-shadow: var(--shadow);
|
|
174
|
+
}
|
|
175
|
+
.tooltip.show { opacity: 1; }
|
|
176
|
+
.tooltip .v { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
|
|
177
|
+
.tooltip .k { color: var(--ink-2); overflow-wrap: anywhere; }
|
|
178
|
+
|
|
179
|
+
details > summary { cursor: pointer; color: var(--ink-2); font-size: 12px; list-style: none; display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; }
|
|
180
|
+
details > summary::-webkit-details-marker { display: none; }
|
|
181
|
+
details > summary::before {
|
|
182
|
+
content: ""; width: 12px; height: 12px; background: currentColor; transition: transform .15s;
|
|
183
|
+
-webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="black" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 3.5 10.5 8 6 12.5"/></svg>') center / contain no-repeat;
|
|
184
|
+
mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="black" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 3.5 10.5 8 6 12.5"/></svg>') center / contain no-repeat;
|
|
185
|
+
}
|
|
186
|
+
details[open] > summary::before { transform: rotate(90deg); }
|
|
187
|
+
details > summary:hover { color: var(--ink); }
|
|
188
|
+
.table-view { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--hairline); }
|
|
189
|
+
figure > :nth-last-child(2) { margin-bottom: 12px; }
|
|
190
|
+
.table-view .twin { margin-top: 8px; max-height: 280px; overflow: auto; }
|
|
191
|
+
.table-view table { font-size: 12px; }
|
|
192
|
+
.table-view th { background: var(--surface); }
|
|
193
|
+
|
|
194
|
+
.section { margin-top: 40px; }
|
|
195
|
+
.section-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
|
|
196
|
+
.section-head h2 { font-size: 18px; }
|
|
197
|
+
.section-head p { color: var(--ink-2); font-size: 13px; }
|
|
198
|
+
|
|
199
|
+
.scroll { overflow: auto; max-height: 76vh; background: var(--surface); border: 1px solid var(--ring); border-radius: 10px; }
|
|
200
|
+
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
|
|
201
|
+
th, td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
|
|
202
|
+
th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--ink-2); font-weight: 500; font-size: 12px; }
|
|
203
|
+
#runs th.sortable { cursor: pointer; user-select: none; transition: color .15s; }
|
|
204
|
+
#runs th.sortable:hover, #runs th[aria-sort="ascending"], #runs th[aria-sort="descending"] { color: var(--ink); }
|
|
205
|
+
th .sort { display: inline-block; width: 10px; height: 10px; margin-left: 4px; vertical-align: -1px; background: currentColor; opacity: 0;
|
|
206
|
+
-webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 6 8 10.5 12.5 6"/></svg>') center / contain no-repeat;
|
|
207
|
+
mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 6 8 10.5 12.5 6"/></svg>') center / contain no-repeat; }
|
|
208
|
+
th[aria-sort="descending"] .sort { opacity: 1; }
|
|
209
|
+
th[aria-sort="ascending"] .sort { opacity: 1; transform: rotate(180deg); }
|
|
210
|
+
.text { text-align: left; }
|
|
211
|
+
.num { font-variant-numeric: tabular-nums; }
|
|
212
|
+
td.unknown { color: var(--muted); }
|
|
213
|
+
td.emph { font-weight: 600; }
|
|
214
|
+
#runs th:first-child, #runs tbody tr:not(.detail) > td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; box-shadow: inset -1px 0 0 var(--hairline); }
|
|
215
|
+
#runs th:first-child { z-index: 3; background: var(--surface-2); }
|
|
216
|
+
#runs tbody tr:not(.detail):hover > td { background: var(--surface-2); }
|
|
217
|
+
#runs tbody tr.selected > td, #runs tbody tr.selected:hover > td { background: color-mix(in oklab, var(--accent) 8%, var(--surface)); }
|
|
218
|
+
.run-btn { all: unset; cursor: pointer; display: block; max-width: 30ch; overflow: hidden; text-overflow: ellipsis; color: var(--accent-ink); }
|
|
219
|
+
.run-btn .id { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color .15s; }
|
|
220
|
+
.run-btn:hover .id { text-decoration-color: currentColor; }
|
|
221
|
+
.run-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
|
|
222
|
+
.run-btn small { display: block; color: var(--muted); font-size: 11px; }
|
|
223
|
+
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; background: var(--de-emphasis); vertical-align: 1px; }
|
|
224
|
+
.dot.good { background: var(--good); }
|
|
225
|
+
.dot.critical { background: var(--critical); }
|
|
226
|
+
.dot.progress { background: var(--accent); }
|
|
227
|
+
.empty-row td { text-align: center; color: var(--muted); padding: 32px; }
|
|
228
|
+
|
|
229
|
+
tr.detail > td { background: var(--surface-2); padding: 0; text-align: left; white-space: normal; }
|
|
230
|
+
.detail-grid {
|
|
231
|
+
position: sticky; left: 0; width: min(1240px, calc(100vw - 66px));
|
|
232
|
+
display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 16px 32px; padding: 18px 20px 20px;
|
|
233
|
+
}
|
|
234
|
+
.detail-grid h3 { margin: 0 0 8px; }
|
|
235
|
+
.detail-grid h3 + * { margin-bottom: 18px; }
|
|
236
|
+
.detail-grid .box { overflow-x: auto; background: var(--surface); border: 1px solid var(--ring); border-radius: 6px; }
|
|
237
|
+
.detail-grid table { font-size: 12px; }
|
|
238
|
+
.detail-grid th { position: static; background: transparent; }
|
|
239
|
+
.detail-grid tr:last-child td { border-bottom: 0; }
|
|
240
|
+
dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 14px; font-size: 12px; }
|
|
241
|
+
dt { color: var(--ink-2); }
|
|
242
|
+
dd { margin: 0; overflow-wrap: anywhere; }
|
|
243
|
+
dd.unknown { color: var(--muted); }
|
|
244
|
+
.caveats { margin: 0; padding-left: 18px; font-size: 12px; color: var(--ink-2); }
|
|
245
|
+
.caveats li + li { margin-top: 4px; }
|
|
246
|
+
.raw-block { grid-column: 1 / -1; }
|
|
247
|
+
pre.raw { margin: 8px 0 0; padding: 12px; font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface); border: 1px solid var(--ring); border-radius: 6px; overflow: auto; max-height: 360px; color: var(--ink-2); }
|
|
248
|
+
|
|
249
|
+
.notes ul { margin: 10px 0 0; padding-left: 20px; max-width: 78ch; color: var(--ink-2); }
|
|
250
|
+
.notes li + li { margin-top: 6px; }
|
|
251
|
+
.excluded { margin-top: 18px; }
|
|
252
|
+
.excluded ul { font-size: 12px; }
|
|
253
|
+
|
|
254
|
+
@media (max-width: 1100px) {
|
|
255
|
+
.figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
256
|
+
.figures li:nth-child(4) { border-left: 0; padding-left: 0; }
|
|
257
|
+
.figures li:nth-child(n+4) { border-top: 1px solid var(--hairline); }
|
|
258
|
+
}
|
|
259
|
+
@media (max-width: 900px) {
|
|
260
|
+
.charts { grid-template-columns: minmax(0, 1fr); }
|
|
261
|
+
.detail-grid { grid-template-columns: 1fr; }
|
|
262
|
+
}
|
|
263
|
+
@media (max-width: 600px) {
|
|
264
|
+
figcaption { grid-template-columns: minmax(0, 1fr); }
|
|
265
|
+
figcaption .legend { justify-self: start; justify-content: flex-start; }
|
|
266
|
+
body { padding: 24px 16px 48px; }
|
|
267
|
+
.filters { margin: 0 -16px; padding: 10px 16px; }
|
|
268
|
+
.filters select { flex: 1 1 40%; max-width: none; }
|
|
269
|
+
.filters .count { margin-left: 0; }
|
|
270
|
+
h1 { font-size: 24px; }
|
|
271
|
+
.figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
272
|
+
.figures li, .figures li:nth-child(4) { padding: 14px 12px; border-left: 1px solid var(--hairline); }
|
|
273
|
+
.figures li:nth-child(odd) { border-left: 0; padding-left: 0; }
|
|
274
|
+
.figures li:nth-child(n+3) { border-top: 1px solid var(--hairline); }
|
|
275
|
+
.figures .value { font-size: 22px; }
|
|
276
|
+
.figures li.lead .value { font-size: 30px; }
|
|
277
|
+
figure { padding: 16px 14px 12px; }
|
|
278
|
+
.detail-grid { width: calc(100vw - 34px); padding: 14px; }
|
|
279
|
+
.stack .mark.narrow { font-size: 0; }
|
|
280
|
+
}
|
|
281
|
+
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
|
|
282
|
+
</style>
|
|
283
|
+
|
|
284
|
+
<header class="top">
|
|
285
|
+
<h1>Shipping run metrics</h1>
|
|
286
|
+
<p class="lede" id="lede"></p>
|
|
287
|
+
</header>
|
|
288
|
+
|
|
289
|
+
<div class="filters" id="filters" role="search">
|
|
290
|
+
<input type="search" id="filter" aria-label="Filter runs" placeholder="Filter by run, issue, PR, model, version or outcome">
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<ul class="figures" id="figures" aria-label="Headline figures"></ul>
|
|
294
|
+
|
|
295
|
+
<div class="charts" id="charts"></div>
|
|
296
|
+
|
|
297
|
+
<section class="section">
|
|
298
|
+
<div class="section-head">
|
|
299
|
+
<h2>Runs</h2>
|
|
300
|
+
<p>Sort by any column. Open a run for its layers, provenance and raw record. A dash is an unknown value, never a zero.</p>
|
|
301
|
+
</div>
|
|
302
|
+
<div class="scroll"><table id="runs"><thead><tr id="head"></tr></thead><tbody id="body"></tbody></table></div>
|
|
303
|
+
</section>
|
|
304
|
+
|
|
305
|
+
<section class="section notes">
|
|
306
|
+
<h2>How to read this</h2>
|
|
307
|
+
<ul id="notes"></ul>
|
|
308
|
+
<details class="excluded"><summary id="excluded-summary">Excluded sources</summary><ul id="excluded"></ul></details>
|
|
309
|
+
</section>
|
|
310
|
+
|
|
311
|
+
<script type="application/json" id="data">__REPORT_JSON__</script>
|
|
312
|
+
<script>
|
|
313
|
+
const report = JSON.parse(document.getElementById('data').textContent), rows = report.runs;
|
|
314
|
+
const ROLES = ['orchestrator', 'build', 'standards', 'spec', 'other'];
|
|
315
|
+
const SHIPPED = new Set(['shipped', 'done', 'closeout-incomplete']);
|
|
316
|
+
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
317
|
+
const by = id => document.getElementById(id);
|
|
318
|
+
// Every label is untrusted evidence, so nodes are built with text, never parsed markup.
|
|
319
|
+
function el(tag, attrs, ...kids) {
|
|
320
|
+
const node = tag.startsWith('svg:') ? document.createElementNS('http://www.w3.org/2000/svg', tag.slice(4)) : document.createElement(tag);
|
|
321
|
+
for (const [k, v] of Object.entries(attrs || {})) {
|
|
322
|
+
if (v == null || v === false) continue;
|
|
323
|
+
if (k === 'text') node.textContent = String(v);
|
|
324
|
+
else if (k.startsWith('on')) node[k] = v;
|
|
325
|
+
else node.setAttribute(k, String(v));
|
|
326
|
+
}
|
|
327
|
+
for (const kid of kids) if (kid != null && kid !== false) node.append(kid);
|
|
328
|
+
return node;
|
|
329
|
+
}
|
|
330
|
+
const fmt = (v, d = 2) => v == null ? '—' : typeof v === 'number' ? v.toLocaleString('en-US', { maximumFractionDigits: d }) : String(v);
|
|
331
|
+
const usd = v => v == null ? '—' : '$' + v.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
332
|
+
const compact = v => v == null ? '—' : v.toLocaleString('en-US', { notation: 'compact', maximumFractionDigits: 1 });
|
|
333
|
+
const minutes = s => s == null ? null : s / 60;
|
|
334
|
+
const sum = xs => xs.reduce((s, x) => s + (x ?? 0), 0);
|
|
335
|
+
const uniq = xs => [...new Set(xs.filter(x => x != null && x !== ''))];
|
|
336
|
+
function median(xs) { const a = xs.filter(x => x != null).sort((p, q) => p - q), h = a.length >> 1; return !a.length ? null : a.length % 2 ? a[h] : (a[h - 1] + a[h]) / 2; }
|
|
337
|
+
function semver(a, b) { const pa = String(a).match(/\d+/g) || [], pb = String(b).match(/\d+/g) || []; for (let i = 0; i < Math.max(pa.length, pb.length); i++) { const d = (Number(pa[i]) || 0) - (Number(pb[i]) || 0); if (d) return d; } return String(a).localeCompare(String(b)); }
|
|
338
|
+
function share(r, ...roles) { const ls = r.layers.filter(x => roles.includes(x.role)); return ls.length && ls.every(x => x.observed_cost_share_pct != null) ? sum(ls.map(x => x.observed_cost_share_pct)) : null; }
|
|
339
|
+
// Claude Code labels locally generated messages <synthetic>; it is not a priced model.
|
|
340
|
+
const realModels = r => (r.models || []).filter(m => m !== '<synthetic>');
|
|
341
|
+
const lines = r => r.changes && r.changes.additions != null && r.changes.deletions != null ? r.changes.additions + r.changes.deletions : null;
|
|
342
|
+
// Older report JSON has no started_at; its transcript window start is the same instant.
|
|
343
|
+
const started = r => r.started_at || (r.transcript_window && r.transcript_window.start_epoch ? new Date(r.transcript_window.start_epoch * 1000).toISOString() : null);
|
|
344
|
+
function day(iso) { const d = iso ? new Date(iso) : null; return d && !isNaN(d) ? `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}` : null; }
|
|
345
|
+
function when(iso) { const d = iso ? new Date(iso) : null, p = n => String(n).padStart(2, '0'); return d && !isNaN(d) ? `${d.getUTCDate()} ${MONTHS[d.getUTCMonth()]} ${p(d.getUTCHours())}:${p(d.getUTCMinutes())}` : null; }
|
|
346
|
+
const outcomeClass = o => SHIPPED.has(o) ? 'good' : ['failed', 'interrupted'].includes(o) ? 'critical' : ['review-ready', 'resumable'].includes(o) ? 'progress' : '';
|
|
347
|
+
|
|
348
|
+
// One filter row scopes every figure, chart and table row, so the numbers always agree.
|
|
349
|
+
const facets = [
|
|
350
|
+
['repository', 'All repositories', r => [r.repository]],
|
|
351
|
+
['outcome', 'All outcomes', r => [r.outcome]],
|
|
352
|
+
['model', 'All models', realModels],
|
|
353
|
+
['version', 'All tool versions', r => r.host_versions || []],
|
|
354
|
+
];
|
|
355
|
+
const filterBar = by('filters'), search = by('filter'), selects = [];
|
|
356
|
+
for (const [key, all, get] of facets) {
|
|
357
|
+
const counts = new Map();
|
|
358
|
+
rows.forEach(r => uniq(get(r)).forEach(v => counts.set(v, (counts.get(v) || 0) + 1)));
|
|
359
|
+
const values = [...counts.keys()].sort(key === 'version' ? semver : key === 'repository' || key === 'model' ? undefined : (a, b) => counts.get(b) - counts.get(a));
|
|
360
|
+
const select = el('select', { 'aria-label': all, onchange: draw }, el('option', { value: '', text: all }), ...values.map(v => el('option', { value: v, text: `${v} (${counts.get(v)})` })));
|
|
361
|
+
selects.push([select, get]);
|
|
362
|
+
filterBar.append(select);
|
|
363
|
+
}
|
|
364
|
+
const resetBtn = el('button', { class: 'reset', type: 'button', text: 'Clear', onclick: () => { search.value = ''; selects.forEach(([s]) => { s.value = ''; }); draw(); } });
|
|
365
|
+
const countEl = el('span', { class: 'count', 'aria-live': 'polite' });
|
|
366
|
+
filterBar.append(resetBtn, countEl);
|
|
367
|
+
|
|
368
|
+
function visible() {
|
|
369
|
+
const q = search.value.trim().toLowerCase();
|
|
370
|
+
return rows.filter(r => selects.every(([s, get]) => !s.value || get(r).includes(s.value))
|
|
371
|
+
&& (!q || JSON.stringify([r.run, r.repository, r.issue, r.pr, r.outcome, r.models, r.effort, r.host, r.host_versions, r.shipping_fingerprint]).toLowerCase().includes(q)));
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Headline figures. Repeated PR diffs would overstate delivered work, so lines count each PR once.
|
|
375
|
+
function figures(rs) {
|
|
376
|
+
const priced = rs.filter(r => r.reported_usd != null), spend = priced.length ? sum(priced.map(r => r.reported_usd)) : null;
|
|
377
|
+
const shipped = rs.filter(r => SHIPPED.has(r.outcome)).length;
|
|
378
|
+
const prs = new Map();
|
|
379
|
+
rs.forEach(r => { if (r.pr && r.changes && r.changes.additions != null) prs.set(r.pr, r.changes); });
|
|
380
|
+
const diffs = [...prs.values()];
|
|
381
|
+
const items = [
|
|
382
|
+
['Reported cost', usd(spend), `${priced.length} of ${rs.length} runs priced`, 'lead'],
|
|
383
|
+
['Shipped', fmt(shipped), rs.length ? `${Math.round(100 * shipped / rs.length)}% of runs shipped or done` : 'no runs'],
|
|
384
|
+
['Cost per shipped run', usd(shipped && spend != null ? spend / shipped : null), 'all priced spend over shipped runs'],
|
|
385
|
+
['Median run cost', usd(median(priced.map(r => r.reported_usd))), priced.length ? `highest ${usd(Math.max(...priced.map(r => r.reported_usd)))}` : 'nothing priced'],
|
|
386
|
+
['Median wall time', rs.some(r => r.wall_seconds != null) ? fmt(median(rs.map(r => minutes(r.wall_seconds))), 0) + ' min' : '—', rs.some(r => r.api_seconds != null) ? `${fmt(median(rs.map(r => minutes(r.api_seconds))), 0)} min of API time` : 'API time unknown'],
|
|
387
|
+
['Lines changed', diffs.length ? compact(sum(diffs.map(c => c.additions + c.deletions))) : '—', diffs.length ? `+${compact(sum(diffs.map(c => c.additions)))} −${compact(sum(diffs.map(c => c.deletions)))} over ${diffs.length} PRs` : 'no recorded diffs'],
|
|
388
|
+
];
|
|
389
|
+
by('figures').replaceChildren(...items.map(([label, value, sub, cls]) => el('li', { class: cls },
|
|
390
|
+
el('span', { class: 'label', text: label }),
|
|
391
|
+
el('span', { class: 'value' + (value === '—' ? ' unknown' : ''), text: value }),
|
|
392
|
+
el('span', { class: 'sub', text: sub }))));
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// Charts. Each figure carries a table twin, so no value is reachable only by hover.
|
|
396
|
+
function tableView(head, body) {
|
|
397
|
+
return el('details', { class: 'table-view' }, el('summary', { text: 'Show as table' }),
|
|
398
|
+
el('div', { class: 'twin' }, el('table', null,
|
|
399
|
+
el('thead', null, el('tr', null, ...head.map((h, i) => el('th', { class: i ? 'num' : 'text', text: h })))),
|
|
400
|
+
el('tbody', null, ...body.map(cells => el('tr', null, ...cells.map((c, i) => el('td', { class: i ? 'num' : 'text', text: c == null ? '—' : c }))))))));
|
|
401
|
+
}
|
|
402
|
+
function chart({ title, note, legend, wide }, content, twin) {
|
|
403
|
+
return el('figure', { class: wide ? 'wide' : null }, el('figcaption', null, el('h2', { text: title }), legend, el('p', { text: note })), content, twin);
|
|
404
|
+
}
|
|
405
|
+
const empty = text => el('p', { class: 'empty', text });
|
|
406
|
+
// Bar length stays proportional to the value; the reserve keeps the value label beside the longest bar.
|
|
407
|
+
const barWidth = f => `width:calc((100% - 84px) * ${Math.max(0, f).toFixed(4)})`;
|
|
408
|
+
|
|
409
|
+
function costByRepository(rs) {
|
|
410
|
+
const groups = new Map();
|
|
411
|
+
rs.forEach(r => {
|
|
412
|
+
const g = groups.get(r.repository) || { cost: 0, priced: 0, runs: 0, shipped: 0 };
|
|
413
|
+
g.runs++; if (SHIPPED.has(r.outcome)) g.shipped++;
|
|
414
|
+
if (r.reported_usd != null) { g.cost += r.reported_usd; g.priced++; }
|
|
415
|
+
groups.set(r.repository, g);
|
|
416
|
+
});
|
|
417
|
+
groups.forEach(g => { g.cost = g.priced ? g.cost : null; });
|
|
418
|
+
const list = [...groups].sort((a, b) => (b[1].cost ?? -1) - (a[1].cost ?? -1)), max = Math.max(1e-9, ...list.map(([, g]) => g.cost ?? 0));
|
|
419
|
+
const grid = el('div', { class: 'bars' });
|
|
420
|
+
list.forEach(([name, g]) => grid.append(el('div', { class: 'cat', title: name }, name, el('small', { text: `${g.runs} runs · ${g.shipped} shipped` })), el('div', { class: 'track' },
|
|
421
|
+
g.cost == null ? null : el('div', { class: 'mark', role: 'img', style: barWidth(g.cost / max), 'aria-label': `${name}: ${usd(g.cost)}, ${g.runs} runs, ${g.shipped} shipped`, 'data-tip': `${usd(g.cost)} reported\n${g.runs} runs · ${g.shipped} shipped · ${g.priced} priced` }),
|
|
422
|
+
el('span', { class: 'tip', text: usd(g.cost) }))));
|
|
423
|
+
return chart({ title: 'Reported cost by repository', note: 'Host-reported API-equivalent dollars over the priced runs in this selection.' },
|
|
424
|
+
list.length ? grid : empty('No runs in this selection.'),
|
|
425
|
+
tableView(['Repository', 'Reported $', 'Runs', 'Shipped', 'Priced'], list.map(([n, g]) => [n, usd(g.cost), g.runs, g.shipped, g.priced])));
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function layerShares(rs) {
|
|
429
|
+
const blank = () => Object.fromEntries(ROLES.map(r => [r, 0]));
|
|
430
|
+
const ALL = 'All selected runs', buckets = new Map([[ALL, blank()]]);
|
|
431
|
+
let covered = 0;
|
|
432
|
+
rs.forEach(r => {
|
|
433
|
+
const priced = r.layers.filter(l => l.reconstructed_usd != null);
|
|
434
|
+
if (!priced.length) return;
|
|
435
|
+
covered++;
|
|
436
|
+
const repo = buckets.get(r.repository) || blank();
|
|
437
|
+
priced.forEach(l => { const role = ROLES.includes(l.role) ? l.role : 'other'; buckets.get(ALL)[role] += l.reconstructed_usd; repo[role] += l.reconstructed_usd; });
|
|
438
|
+
buckets.set(r.repository, repo);
|
|
439
|
+
});
|
|
440
|
+
const total = b => sum(Object.values(b));
|
|
441
|
+
const list = [...buckets].filter(([, b]) => total(b) > 0).sort((a, b) => a[0] === ALL ? -1 : b[0] === ALL ? 1 : total(b[1]) - total(a[1]));
|
|
442
|
+
const grid = el('div', { class: 'bars' });
|
|
443
|
+
list.forEach(([name, b]) => {
|
|
444
|
+
const t = total(b);
|
|
445
|
+
grid.append(el('div', { class: 'cat' + (name === ALL ? ' total' : '') }, name, el('small', { text: `${usd(t)} reconstructed` })));
|
|
446
|
+
const stack = el('div', { class: 'stack', role: 'img', 'aria-label': `${name}: ` + ROLES.filter(r => b[r]).map(r => `${r} ${Math.round(100 * b[r] / t)}%`).join(', ') });
|
|
447
|
+
ROLES.forEach(role => {
|
|
448
|
+
if (!b[role]) return;
|
|
449
|
+
const pct = 100 * b[role] / t;
|
|
450
|
+
stack.append(el('div', { class: `mark role-${role}${pct < 20 ? ' narrow' : ''}`, style: `--f:${pct.toFixed(3)}`, 'data-tip': `${role}\n${usd(b[role])} · ${pct.toFixed(1)}%`, text: pct >= 10 ? `${Math.round(pct)}%` : null }));
|
|
451
|
+
});
|
|
452
|
+
grid.append(el('div', { class: 'track' }, stack));
|
|
453
|
+
});
|
|
454
|
+
const legend = el('ul', { class: 'legend', 'aria-label': 'Layers' }, ...ROLES.map(r => el('li', null, el('span', { class: `swatch role-${r}` }), r)));
|
|
455
|
+
return chart({ title: 'Where the observed spend went', legend, note: `Reconstructed transcript cost by layer for the ${covered} of ${rs.length} selected runs with priced transcripts. These are not shares of the reported cost.` },
|
|
456
|
+
list.length ? grid : empty('No priced transcript layers here. Run the reporter with --claude-projects and --prices.'),
|
|
457
|
+
tableView(['Scope', ...ROLES.map(r => `${r} %`), 'Reconstructed $'], list.map(([n, b]) => [n, ...ROLES.map(r => (100 * b[r] / total(b)).toFixed(1)), usd(total(b))])));
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function medianCost({ title, note, head }, rs, key, order) {
|
|
461
|
+
const groups = new Map();
|
|
462
|
+
rs.forEach(r => { const k = key(r); if (k == null || r.reported_usd == null) return; groups.set(k, [...(groups.get(k) || []), r.reported_usd]); });
|
|
463
|
+
const list = [...groups].map(([k, v]) => [k, median(v), v.length, Math.max(...v)]).sort(order || ((a, b) => b[1] - a[1]));
|
|
464
|
+
const max = Math.max(1e-9, ...list.map(x => x[1]));
|
|
465
|
+
const grid = el('div', { class: 'bars' });
|
|
466
|
+
list.forEach(([name, med, n, top]) => grid.append(el('div', { class: 'cat', title: name }, name, el('small', { text: `${n} priced runs` })), el('div', { class: 'track' },
|
|
467
|
+
el('div', { class: 'mark', role: 'img', style: barWidth(med / max), 'aria-label': `${name}: median ${usd(med)} over ${n} runs`, 'data-tip': `median ${usd(med)}\n${n} priced runs · highest ${usd(top)}` }),
|
|
468
|
+
el('span', { class: 'tip', text: usd(med) }))));
|
|
469
|
+
return chart({ title, note }, list.length ? grid : empty('Nothing priced in this selection.'),
|
|
470
|
+
tableView([head, 'Median $', 'Priced runs', 'Highest $'], list.map(([k, m, n, t]) => [k, usd(m), n, usd(t)])));
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function niceSteps(max, n) {
|
|
474
|
+
const raw = max / n, mag = Math.pow(10, Math.floor(Math.log10(raw))), step = [1, 2, 2.5, 5, 10].map(x => x * mag).find(x => x >= raw), out = [];
|
|
475
|
+
for (let v = 0; v <= max + 1e-9; v += step) out.push(Math.round(v * 1e6) / 1e6);
|
|
476
|
+
return out;
|
|
477
|
+
}
|
|
478
|
+
function scatter(rs) {
|
|
479
|
+
const pts = rs.filter(r => r.reported_usd != null && lines(r) > 0);
|
|
480
|
+
const meta = { wide: true, title: 'Cost against change size',
|
|
481
|
+
legend: el('ul', { class: 'legend', 'aria-label': 'Outcome' }, el('li', null, el('span', { class: 'swatch round' }), 'shipped or done'), el('li', null, el('span', { class: 'swatch round dim' }), 'every other outcome')),
|
|
482
|
+
note: `One dot per run with both a reported cost and a PR diff${rs.length - pts.length ? `. ${rs.length - pts.length} runs lack a cost or a non-empty diff and are not plotted` : ''}. A PR diff is a snapshot and can include later work. Select a dot to open its run.` };
|
|
483
|
+
const twin = tableView(['Run', 'Lines', 'Reported $', 'Outcome'], pts.map(r => [r.run, fmt(lines(r), 0), usd(r.reported_usd), r.outcome]));
|
|
484
|
+
if (!pts.length) return chart(meta, empty('No runs have both a cost and a recorded diff.'), twin);
|
|
485
|
+
// Draw at the rendered width so type stays at its set size instead of scaling with the page.
|
|
486
|
+
const W = Math.max(560, Math.round((by('charts').clientWidth || 1000) - 42)), H = 300, m = { t: 24, r: 16, b: 40, l: 52 };
|
|
487
|
+
const xs = pts.map(lines), lo = Math.floor(Math.log10(Math.min(...xs))), hi = Math.max(lo + 1, Math.ceil(Math.log10(Math.max(...xs))));
|
|
488
|
+
const ymax = Math.max(...pts.map(r => r.reported_usd)) * 1.06, ticks = niceSteps(ymax, 4), ytop = Math.max(ymax, ticks[ticks.length - 1]);
|
|
489
|
+
const X = v => m.l + (Math.log10(v) - lo) / (hi - lo) * (W - m.l - m.r), Y = v => H - m.b - v / ytop * (H - m.t - m.b);
|
|
490
|
+
const svg = el('svg:svg', { viewBox: `0 0 ${W} ${H}`, role: 'img', 'aria-label': `Reported cost against lines changed, ${pts.length} runs. Tab to the dots, then use the arrow keys.` });
|
|
491
|
+
const grid = el('svg:g', { class: 'grid' }), labels = el('svg:g');
|
|
492
|
+
ticks.forEach(v => { grid.append(el('svg:line', { x1: m.l, x2: W - m.r, y1: Y(v), y2: Y(v) })); labels.append(el('svg:text', { x: m.l - 8, y: Y(v) + 4, 'text-anchor': 'end', text: `$${fmt(v, 0)}` })); });
|
|
493
|
+
for (let p = lo; p <= hi; p++) { const v = Math.pow(10, p); grid.append(el('svg:line', { x1: X(v), x2: X(v), y1: m.t, y2: H - m.b })); labels.append(el('svg:text', { x: X(v), y: H - m.b + 16, 'text-anchor': 'middle', text: fmt(v, 0) })); }
|
|
494
|
+
labels.append(el('svg:text', { class: 'axis-title', x: W - m.r, y: H - 4, 'text-anchor': 'end', text: 'Lines added plus deleted, log scale' }),
|
|
495
|
+
el('svg:text', { class: 'axis-title', x: 0, y: 12, text: 'Reported $' }));
|
|
496
|
+
const axis = el('svg:g', { class: 'axis' }, el('svg:line', { x1: m.l, x2: W - m.r, y1: H - m.b, y2: H - m.b }));
|
|
497
|
+
const tip = el('div', { class: 'tooltip', 'aria-hidden': 'true' });
|
|
498
|
+
const dots = el('svg:g'), hits = el('svg:g'), stops = [];
|
|
499
|
+
pts.sort((a, b) => lines(a) - lines(b));
|
|
500
|
+
let lit = null;
|
|
501
|
+
const hide = () => { tip.classList.remove('show'); if (lit) lit.classList.remove('on'); };
|
|
502
|
+
pts.forEach(r => {
|
|
503
|
+
const cx = X(lines(r)), cy = Y(r.reported_usd);
|
|
504
|
+
const dot = el('svg:circle', { class: 'pt' + (SHIPPED.has(r.outcome) ? ' shipped' : ''), cx: cx.toFixed(1), cy: cy.toFixed(1), r: 4.5 });
|
|
505
|
+
const show = () => {
|
|
506
|
+
hide(); lit = dot; dot.classList.add('on');
|
|
507
|
+
tip.replaceChildren(el('div', { class: 'v', text: usd(r.reported_usd) }), el('div', { class: 'k', text: `${fmt(lines(r), 0)} lines · ${r.outcome}` }), el('div', { class: 'k', text: r.run }));
|
|
508
|
+
const right = cx > W * 0.7;
|
|
509
|
+
tip.style.left = right ? '' : `calc(${(100 * cx / W).toFixed(2)}% + 14px)`;
|
|
510
|
+
tip.style.right = right ? `calc(${(100 - 100 * cx / W).toFixed(2)}% + 14px)` : '';
|
|
511
|
+
tip.style.top = `calc(${(100 * cy / H).toFixed(2)}% - 20px)`;
|
|
512
|
+
tip.classList.add('show');
|
|
513
|
+
};
|
|
514
|
+
dots.append(dot);
|
|
515
|
+
const hit = el('svg:circle', { class: 'hit', cx: cx.toFixed(1), cy: cy.toFixed(1), r: 12, tabindex: stops.length ? -1 : 0, role: 'button', 'aria-label': `${r.run}: ${usd(r.reported_usd)}, ${fmt(lines(r), 0)} lines, ${r.outcome}`,
|
|
516
|
+
onpointerenter: show, onfocus: show, onpointerleave: hide, onblur: hide, onclick: () => openRun(r.run),
|
|
517
|
+
onkeydown: e => {
|
|
518
|
+
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); openRun(r.run); return; }
|
|
519
|
+
const step = { ArrowRight: 1, ArrowUp: 1, ArrowLeft: -1, ArrowDown: -1, Home: -Infinity, End: Infinity }[e.key];
|
|
520
|
+
if (step == null) return;
|
|
521
|
+
e.preventDefault();
|
|
522
|
+
const next = stops[Math.max(0, Math.min(stops.length - 1, stops.indexOf(hit) + (Number.isFinite(step) ? step : step * stops.length)))];
|
|
523
|
+
stops.forEach(h => h.setAttribute('tabindex', h === next ? 0 : -1));
|
|
524
|
+
if (next.focus) next.focus();
|
|
525
|
+
} });
|
|
526
|
+
stops.push(hit);
|
|
527
|
+
hits.append(hit);
|
|
528
|
+
});
|
|
529
|
+
svg.append(grid, axis, labels, dots, hits);
|
|
530
|
+
return chart(meta, el('div', { class: 'scatter' }, el('div', { class: 'plot' }, svg, tip)), twin);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// Runs table. A column no run has evidence for stays hidden; each run's detail still names it.
|
|
534
|
+
const has = get => rows.some(r => get(r) != null);
|
|
535
|
+
const cols = [
|
|
536
|
+
{ label: 'Run', get: r => r.run, text: true },
|
|
537
|
+
has(started) && { label: 'Started (UTC)', get: started, show: r => when(started(r)), text: true, desc: true },
|
|
538
|
+
{ label: 'Issue', get: r => r.issue, text: true },
|
|
539
|
+
{ label: 'Outcome', get: r => r.outcome, text: true, outcome: true },
|
|
540
|
+
has(r => r.attempt_changes) && { label: 'Attempt +', get: r => r.attempt_changes?.additions, digits: 0 },
|
|
541
|
+
has(r => r.attempt_changes) && { label: 'Attempt −', get: r => r.attempt_changes?.deletions, digits: 0 },
|
|
542
|
+
{ label: 'Total +', get: r => r.changes?.additions, digits: 0 },
|
|
543
|
+
{ label: 'Total −', get: r => r.changes?.deletions, digits: 0 },
|
|
544
|
+
{ label: 'Files', get: r => r.changes?.files, digits: 0 },
|
|
545
|
+
{ label: 'Diff basis', get: r => r.change_scope ? (r.change_scope.startsWith('PR') ? 'PR snapshot' : 'committed') : null, text: true },
|
|
546
|
+
{ label: 'Reported $', get: r => r.reported_usd, show: r => usd(r.reported_usd), emph: true },
|
|
547
|
+
{ label: 'Wall min', get: r => minutes(r.wall_seconds), digits: 1 },
|
|
548
|
+
{ label: 'API min', get: r => minutes(r.api_seconds), digits: 1 },
|
|
549
|
+
{ label: 'Tool', get: r => r.host, text: true },
|
|
550
|
+
{ label: 'Tool version', get: r => r.host_versions?.join(', ') || null, text: true },
|
|
551
|
+
has(r => r.shipping_fingerprint) && { label: 'Shipping fingerprint', get: r => r.shipping_fingerprint ? 'sha256:' + r.shipping_fingerprint.slice(0, 12) : null, text: true },
|
|
552
|
+
{ label: 'Model', get: r => r.models?.join(', ') || null, text: true },
|
|
553
|
+
{ label: 'Effort', get: r => r.effort, text: true },
|
|
554
|
+
{ label: 'Orch %', get: r => share(r, 'orchestrator'), digits: 0 },
|
|
555
|
+
{ label: 'Build %', get: r => share(r, 'build'), digits: 0 },
|
|
556
|
+
{ label: 'Review %', get: r => share(r, 'standards', 'spec'), digits: 0 },
|
|
557
|
+
{ label: 'Turns', get: r => r.turns, digits: 0 },
|
|
558
|
+
{ label: 'Mean context', get: r => r.context_mean, show: r => r.context_mean == null ? null : compact(r.context_mean) },
|
|
559
|
+
{ label: '$ / criterion', get: r => r.usd_per_criterion, show: r => r.usd_per_criterion == null ? null : usd(r.usd_per_criterion) },
|
|
560
|
+
{ label: 'Tokens', get: r => r.total_tokens, show: r => compact(r.total_tokens) },
|
|
561
|
+
].filter(Boolean);
|
|
562
|
+
let sortIndex = Math.max(0, cols.findIndex(c => c.get === started)), ascending = sortIndex === 0;
|
|
563
|
+
const expanded = new Set(), rowNodes = new Map(), btnNodes = new Map(), head = by('head');
|
|
564
|
+
cols.forEach((c, i) => head.append(el('th', { class: 'sortable ' + (c.text ? 'text' : 'num'), scope: 'col', 'aria-sort': 'none', tabindex: 0,
|
|
565
|
+
onclick: () => sortBy(i), onkeydown: e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); sortBy(i); } } }, c.label, el('span', { class: 'sort', 'aria-hidden': 'true' }))));
|
|
566
|
+
// Numbers and dates open largest or newest first; text opens A to Z.
|
|
567
|
+
function sortBy(i) { ascending = sortIndex === i ? !ascending : !!cols[i].text && !cols[i].desc; sortIndex = i; drawTable(visible()); }
|
|
568
|
+
function focusRun(run) { const btn = btnNodes.get(run); if (btn && btn.focus) btn.focus({ preventScroll: true }); }
|
|
569
|
+
function openRun(run) { expanded.add(run); drawTable(visible()); const row = rowNodes.get(run); if (row && row.scrollIntoView) row.scrollIntoView({ block: 'center', behavior: 'smooth' }); focusRun(run); }
|
|
570
|
+
|
|
571
|
+
function detailRow(r) {
|
|
572
|
+
const layerCols = [['Layer', l => l.role, 1], ['Tool version', l => l.host_versions?.join(', ') || null, 1], ['Model', l => l.models?.join(', ') || null, 1], ['Effort', l => l.efforts?.join(', ') || null, 1],
|
|
573
|
+
['Reconstructed $', l => l.reconstructed_usd == null ? null : usd(l.reconstructed_usd)], ['Share %', l => l.observed_cost_share_pct == null ? null : fmt(l.observed_cost_share_pct, 1)], ['Requests', l => l.requests == null ? null : fmt(l.requests, 0)],
|
|
574
|
+
['Input', l => l.usage ? compact(l.usage.input_tokens) : null], ['Output', l => l.usage ? compact(l.usage.output_tokens) : null], ['Cache read', l => l.usage ? compact(l.usage.cache_read_input_tokens) : null],
|
|
575
|
+
['Cache write', l => l.usage ? compact(l.usage.cache_creation_input_tokens) : null], ['Peak input', l => l.peak_input_tokens == null ? null : compact(l.peak_input_tokens)]];
|
|
576
|
+
const cell = (v, t) => el('td', { class: (t ? 'text' : 'num') + (v == null ? ' unknown' : ''), text: v ?? '—' });
|
|
577
|
+
const layers = r.layers.length
|
|
578
|
+
? el('div', { class: 'box' }, el('table', null, el('thead', null, el('tr', null, ...layerCols.map(([h, , t]) => el('th', { class: t ? 'text' : 'num', text: h })))),
|
|
579
|
+
el('tbody', null, ...r.layers.map(l => el('tr', null, ...layerCols.map(([, get, t]) => cell(get(l), t)))))))
|
|
580
|
+
: el('p', { class: 'ink-2', text: r.layer_basis === 'unavailable' ? 'No transcript layers for this run. Layer detail needs --claude-projects and --prices.' : r.layer_basis });
|
|
581
|
+
const contexts = r.host_contexts.length ? el('div', { class: 'box' }, el('table', null,
|
|
582
|
+
el('thead', null, el('tr', null, ...['Context', 'Model', 'Effort', 'Host $ incl. children', 'Wall s', 'API s', 'Turns', 'Mean context', 'Peak context'].map((h, i) => el('th', { class: i < 3 ? 'text' : 'num', text: h })))),
|
|
583
|
+
el('tbody', null, ...r.host_contexts.map(c => el('tr', null, cell(c.role, 1), cell((c.models || []).join(', ') || null, 1), cell(c.effort, 1),
|
|
584
|
+
cell(c.host_total_usd_including_children == null ? null : usd(c.host_total_usd_including_children)), cell(c.wall_seconds == null ? null : fmt(c.wall_seconds, 0)), cell(c.api_seconds == null ? null : fmt(c.api_seconds, 0)),
|
|
585
|
+
cell(c.transcript ? fmt(c.transcript.turns, 0) : null), cell(c.transcript ? compact(c.transcript.context_mean) : null), cell(c.transcript ? compact(c.transcript.context_peak) : null)))))) : null;
|
|
586
|
+
// The tool results the pass re-read most: each one's tokens times the turns that read it again.
|
|
587
|
+
const rereads = r.rereads?.length ? el('div', { class: 'box' }, el('table', null,
|
|
588
|
+
el('thead', null, el('tr', null, ...['Context', 'Turn', 'Tool', 'Command or path', 'Result', 'Re-read'].map((h, i) => el('th', { class: i === 1 || i > 3 ? 'num' : 'text', text: h })))),
|
|
589
|
+
el('tbody', null, ...r.rereads.map(x => el('tr', null, cell(x.role, 1), cell(fmt(x.turn, 0)), cell(x.tool, 1), cell(x.source, 1), cell(compact(x.result_tokens)), cell(compact(x.reread_tokens))))))) : null;
|
|
590
|
+
const dl = el('dl');
|
|
591
|
+
const add = (k, v, unknown) => { if (v == null || v === '') return; dl.append(el('dt', { text: k }), typeof v === 'string' ? el('dd', { class: unknown ? 'unknown' : null, text: v }) : el('dd', null, v)); };
|
|
592
|
+
add('Pull request', r.pr ? (/^https:\/\//.test(r.pr) ? el('a', { href: r.pr, rel: 'noopener noreferrer', target: '_blank', text: r.pr.replace(/^https:\/\/github\.com\//, '') }) : r.pr) : null);
|
|
593
|
+
add('PR snapshot', r.pr_snapshot_state ? `${r.pr_snapshot_state}, captured ${day(r.pr_snapshot_at) || r.pr_snapshot_at}` : null);
|
|
594
|
+
add('Diff basis', r.change_scope);
|
|
595
|
+
const a = r.attempt_changes;
|
|
596
|
+
add('Attempt diff', a ? `+${fmt(a.additions, 0)} −${fmt(a.deletions, 0)}` + (a.files != null ? `, ${fmt(a.files, 0)} files` : '') + (a.commits != null ? `, ${fmt(a.commits, 0)} commits` : '') : null);
|
|
597
|
+
add('Uncommitted edits', r.uncommitted === true ? 'yes, excluded from counts' : r.uncommitted === false ? 'none' : null);
|
|
598
|
+
add('Started', started(r) ? when(started(r)) + ' UTC' : null);
|
|
599
|
+
add('Engine', r.engine);
|
|
600
|
+
add('Tool', [r.host, r.recorded_host_version].filter(Boolean).join(' '));
|
|
601
|
+
add('Observed versions', r.host_versions?.length ? r.host_versions.join(', ') : 'unknown', !r.host_versions?.length);
|
|
602
|
+
add('Shipping fingerprint', r.shipping_fingerprint ? el('code', { text: 'sha256:' + r.shipping_fingerprint }) : 'unknown, no component manifest recorded', !r.shipping_fingerprint);
|
|
603
|
+
add('CI wait', r.ci_wait_seconds != null ? `${fmt(r.ci_wait_seconds, 0)} s` : null);
|
|
604
|
+
add('Gate queue', r.gate_queue_seconds != null ? `${fmt(r.gate_queue_seconds, 0)} s` : null);
|
|
605
|
+
add('Sub-agents', r.subagents != null ? fmt(r.subagents, 0) : null);
|
|
606
|
+
add('Criteria', r.criteria != null ? fmt(r.criteria, 0) : null);
|
|
607
|
+
add('Session', r.session_id ? el('code', { text: r.session_id }) : null);
|
|
608
|
+
add('Attempt', r.attempt_id ? el('code', { text: r.attempt_id }) : null);
|
|
609
|
+
add('Source', el('code', { text: r.source }));
|
|
610
|
+
add('Source SHA-256', el('code', { text: r.source_sha256 }));
|
|
611
|
+
const caveats = r.warnings.length ? el('ul', { class: 'caveats' }, ...r.warnings.map(w => el('li', { text: w }))) : null;
|
|
612
|
+
const left = el('div', null, el('h3', { text: 'Layers' }), layers);
|
|
613
|
+
if (contexts) left.append(el('h3', { text: 'Host contexts' }), contexts);
|
|
614
|
+
if (rereads) left.append(el('h3', { text: 'Re-read most' }), rereads);
|
|
615
|
+
if (caveats) left.append(el('h3', { text: 'Caveats' }), caveats);
|
|
616
|
+
return el('tr', { class: 'detail' }, el('td', { colspan: cols.length }, el('div', { class: 'detail-grid' }, left,
|
|
617
|
+
el('div', null, el('h3', { text: 'Provenance' }), dl),
|
|
618
|
+
el('details', { class: 'raw-block' }, el('summary', { text: 'Raw record' }), el('pre', { class: 'raw', 'data-raw': '', text: JSON.stringify(r, null, 2) })))));
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
function drawTable(rs) {
|
|
622
|
+
const col = cols[sortIndex];
|
|
623
|
+
rs = [...rs].sort((a, b) => {
|
|
624
|
+
const x = col.get(a), y = col.get(b);
|
|
625
|
+
if (x == null) return y == null ? 0 : 1;
|
|
626
|
+
if (y == null) return -1;
|
|
627
|
+
return (typeof x === 'number' && typeof y === 'number' ? x - y : String(x).localeCompare(String(y), 'en', { numeric: true })) * (ascending ? 1 : -1);
|
|
628
|
+
});
|
|
629
|
+
[...head.children].forEach((th, i) => th.setAttribute('aria-sort', i === sortIndex ? (ascending ? 'ascending' : 'descending') : 'none'));
|
|
630
|
+
const body = by('body');
|
|
631
|
+
body.replaceChildren();
|
|
632
|
+
rowNodes.clear();
|
|
633
|
+
btnNodes.clear();
|
|
634
|
+
if (!rs.length) { body.append(el('tr', { class: 'empty-row' }, el('td', { colspan: cols.length, text: 'No runs match these filters.' }))); return; }
|
|
635
|
+
for (const r of rs) {
|
|
636
|
+
const open = expanded.has(r.run), parts = String(r.run).split('/');
|
|
637
|
+
const tr = el('tr', { class: open ? 'selected' : null, 'data-run': r.run });
|
|
638
|
+
const btn = el('button', { class: 'run-btn', type: 'button', 'aria-expanded': String(open), title: r.run,
|
|
639
|
+
onclick: () => { expanded.has(r.run) ? expanded.delete(r.run) : expanded.add(r.run); drawTable(visible()); focusRun(r.run); } },
|
|
640
|
+
el('span', { class: 'id', text: parts.length > 1 ? parts.slice(1).join('/') : r.run }), parts.length > 1 ? el('small', { text: parts[0] }) : null);
|
|
641
|
+
tr.append(el('td', null, btn));
|
|
642
|
+
cols.slice(1).forEach(c => {
|
|
643
|
+
const shown = c.show ? c.show(r) : c.digits != null ? (c.get(r) == null ? null : fmt(c.get(r), c.digits)) : c.get(r);
|
|
644
|
+
const unknown = shown == null || shown === '—';
|
|
645
|
+
tr.append(el('td', { class: (c.text ? 'text' : 'num') + (unknown ? ' unknown' : '') + (c.emph && !unknown ? ' emph' : '') },
|
|
646
|
+
c.outcome && !unknown ? el('span', { class: 'dot ' + outcomeClass(r.outcome), 'aria-hidden': 'true' }) : null, unknown ? '—' : String(shown)));
|
|
647
|
+
});
|
|
648
|
+
body.append(tr);
|
|
649
|
+
rowNodes.set(r.run, tr);
|
|
650
|
+
btnNodes.set(r.run, btn);
|
|
651
|
+
if (open) body.append(detailRow(r));
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
function draw() {
|
|
656
|
+
const rs = visible(), filtered = !!search.value.trim() || selects.some(([s]) => s.value);
|
|
657
|
+
selects.forEach(([s]) => s.classList.toggle('active', !!s.value));
|
|
658
|
+
countEl.textContent = filtered ? `${rs.length} of ${rows.length} runs` : `${rows.length} runs`;
|
|
659
|
+
resetBtn.disabled = !filtered;
|
|
660
|
+
figures(rs);
|
|
661
|
+
by('charts').replaceChildren(costByRepository(rs), layerShares(rs),
|
|
662
|
+
medianCost({ title: 'Median run cost by model', head: 'Model', note: 'Runs that observed exactly one model, so no run counts twice.' }, rs, r => realModels(r).length === 1 ? realModels(r)[0] : null),
|
|
663
|
+
medianCost({ title: 'Median run cost by tool version', head: 'Tool version', note: 'Runs whose saved records or transcripts name exactly one host version.' }, rs, r => r.host_versions?.length === 1 ? r.host_versions[0] : null, (x, y) => semver(x[0], y[0])),
|
|
664
|
+
scatter(rs));
|
|
665
|
+
drawTable(rs);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
const dates = rows.map(started).filter(Boolean).sort(), repos = uniq(rows.map(r => r.repository));
|
|
669
|
+
const span = dates.length ? (day(dates[0]) === day(dates[dates.length - 1]) ? `, ${day(dates[0])}` : `, ${day(dates[0])} to ${day(dates[dates.length - 1])}`) : '';
|
|
670
|
+
by('lede').textContent = `${rows.length} runs across ${repos.length} ${repos.length === 1 ? 'repository' : 'repositories'}${span}. Built from saved evidence only, with ${report.excluded.length} unreadable or duplicate source${report.excluded.length === 1 ? '' : 's'} left out.`;
|
|
671
|
+
report.notes.forEach(n => by('notes').append(el('li', { text: n })));
|
|
672
|
+
by('excluded-summary').textContent = `${report.excluded.length} excluded source${report.excluded.length === 1 ? '' : 's'}`;
|
|
673
|
+
report.excluded.forEach(x => by('excluded').append(el('li', null, el('code', { text: x.source }), `: ${x.reason}`)));
|
|
674
|
+
search.oninput = draw;
|
|
675
|
+
let resizing;
|
|
676
|
+
if (typeof window !== 'undefined') window.addEventListener('resize', () => { clearTimeout(resizing); resizing = setTimeout(draw, 150); });
|
|
677
|
+
draw();
|
|
678
|
+
</script>
|
|
679
|
+
</html>
|