wrapped-agents 1.1.0 → 1.2.0
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/SKILL.md +5 -3
- package/package.json +1 -1
- package/page/story.html +213 -83
- package/src/cli.mjs +18 -2
- package/src/stats/awards.mjs +12 -1
- package/src/stats/compare.mjs +24 -0
- package/src/stats/index.mjs +24 -3
- package/src/stats/roast.mjs +1 -1
- package/src/stats/tiers.mjs +11 -8
- package/src/stats/twin.mjs +2 -2
package/SKILL.md
CHANGED
|
@@ -12,23 +12,25 @@ Build the user's year with AI coding agents, wrapped. All numbers come from the
|
|
|
12
12
|
Run, in a terminal (read-only over the user's agent logs; writes only to the temp folder):
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npx -y wrapped-agents@1.
|
|
15
|
+
npx -y wrapped-agents@1.2.0 --json --no-open
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
It prints the path of `wrapped-<year>.json`. Before running, tell the user in one sentence: it reads their local agent logs (~/.claude, ~/.codex, Cursor, ~/.gemini, ~/.qwen, OpenCode, ~/.pi, ~/.vibe) read-only and nothing about their usage leaves the machine.
|
|
19
19
|
|
|
20
|
-
No Node? Use the first that exists: `bunx wrapped-agents@1.
|
|
20
|
+
No Node? Use the first that exists: `bunx wrapped-agents@1.2.0 --json --no-open` · `deno run -A npm:wrapped-agents@1.2.0 --json --no-open` · or `git clone --depth 1 --branch v1.2.0 https://github.com/LeonardoDaviti/agent-wrapped "$TMPDIR/agent-wrapped" && node "$TMPDIR/agent-wrapped/src/cli.mjs" --json --no-open`. If none works, say so and point to https://leonardodaviti.github.io/agent-wrapped.
|
|
21
21
|
|
|
22
22
|
If a sandbox blocks reading a folder, ask the user once for read access; otherwise continue and mention which harness was skipped.
|
|
23
23
|
|
|
24
24
|
## 2 · Write the roast
|
|
25
25
|
|
|
26
26
|
From the printed `wrapped-<year>.json` only, write one roast line: ≤ 12 words, citing a number copied exactly from it; roast habits, never the person, no project names.
|
|
27
|
+
Also write one funny line for the tokens slide: pick a work from `compare.options`, use its `times` exactly, and land the punchline on one of the user's real quirks from the file (please ×, Esc ×, "you're right" ×, top one-word prompt, busiest day); savage, specific, ≤ 16 words.
|
|
28
|
+
Also write one playful guess at what happened on `busiest.date` (≤ 20 words).
|
|
27
29
|
|
|
28
30
|
## 3 · Render and open
|
|
29
31
|
|
|
30
32
|
```bash
|
|
31
|
-
npx -y wrapped-agents@1.
|
|
33
|
+
npx -y wrapped-agents@1.2.0 --from "<path to wrapped-<year>.json>" --roast "<your line>" --quip "<your tokens line>" --day "<your busiest-day guess>" --roast-by "<your harness, e.g. Claude Code>"
|
|
32
34
|
```
|
|
33
35
|
|
|
34
36
|
If `handle.github` in the file is null, ask the user for their GitHub username first and add `--handle <name>`. If they ask for a different look, add `--skin <wrapped|anthropic|claude-code|codex|opencode|pi|hermes|mistral-vibe|yours>` (default: their most-used harness and its own theme).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrapped-agents",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Your year with AI coding agents, wrapped. Claude Code, Codex, Cursor, Gemini CLI, Qwen Code, OpenCode, Pi, Mistral Vibe. Runs locally; your usage data never leaves your machine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/page/story.html
CHANGED
|
@@ -11,7 +11,11 @@ html{background:#070707}
|
|
|
11
11
|
body{color:var(--fg);font-family:var(--body);-webkit-font-smoothing:antialiased;overscroll-behavior-y:none}
|
|
12
12
|
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
|
|
13
13
|
/* ---------- the stage: one 9:16 frame ---------- */
|
|
14
|
-
#stage{position:relative;height:100vh;height:100dvh;display:grid;place-items:center;overflow:hidden;
|
|
14
|
+
#stage{position:relative;height:100vh;height:100dvh;display:grid;place-items:center;overflow:hidden;isolation:isolate}
|
|
15
|
+
/* the world behind the frame: the skin's own background, blurred and dimmed, lit by its accents (never part of an export) */
|
|
16
|
+
#stage::before{content:"";position:absolute;inset:-90px;z-index:-2;transform:translateZ(0);filter:blur(44px) saturate(1.35) brightness(var(--wdim,.6));background:radial-gradient(44% 54% at 14% 20%,color-mix(in srgb,var(--li) 55%,transparent),transparent 72%),radial-gradient(48% 58% at 88% 82%,color-mix(in srgb,var(--pk) 50%,transparent),transparent 72%),radial-gradient(38% 42% at 78% 8%,color-mix(in srgb,var(--lv) 34%,transparent),transparent 72%),var(--bg)}
|
|
17
|
+
#stage::after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(80% 90% at 50% 50%,transparent 40%,#0008)}
|
|
18
|
+
#stage.full::before,#stage.full::after{display:none}
|
|
15
19
|
#frame{position:relative;overflow:hidden;background:var(--bg);user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;touch-action:pan-y;-webkit-tap-highlight-color:transparent;contain:layout paint}
|
|
16
20
|
#frame.boxed{border-radius:22px;box-shadow:0 40px 120px #000a,0 0 0 1px #ffffff14}
|
|
17
21
|
#view{position:absolute;left:0;top:0;transform-origin:0 0}
|
|
@@ -23,10 +27,14 @@ button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webki
|
|
|
23
27
|
#b-save{right:12px}
|
|
24
28
|
#toast{position:absolute;z-index:7;left:50%;bottom:22px;transform:translate(-50%,20px);opacity:0;pointer-events:none;background:var(--pp);color:var(--opp);font:600 14px/1 var(--fm);padding:12px 16px;border-radius:99px;white-space:nowrap;transition:opacity .25s,transform .35s cubic-bezier(.2,.9,.3,1.2)}
|
|
25
29
|
#toast.on{opacity:1;transform:translate(-50%,0)}
|
|
26
|
-
.nav{position:absolute;top:50%;width:52px;height:52px;margin-top:-26px;border-radius:50%;display:grid;place-items:center;color:#fff;background:#
|
|
27
|
-
.nav:hover{opacity:1;background:#
|
|
30
|
+
.nav{position:absolute;top:50%;width:52px;height:52px;margin-top:-26px;border-radius:50%;display:grid;place-items:center;color:#fff;background:#00000059;box-shadow:inset 0 0 0 1px #ffffff26;opacity:.8;transition:opacity .2s,background .2s}
|
|
31
|
+
.nav:hover{opacity:1;background:#000000a6}.nav svg{width:22px;height:22px}
|
|
28
32
|
.nav[hidden]{display:none}
|
|
29
|
-
#cue{position:absolute;bottom:10px;left:50%;margin-left:-14px;width:28px;height:28px;color:#fff;opacity:.
|
|
33
|
+
#cue{position:absolute;bottom:10px;left:50%;margin-left:-14px;width:28px;height:28px;color:#fff;opacity:.6;filter:drop-shadow(0 1px 2px #000c)}
|
|
34
|
+
button:focus-visible{outline:3px solid var(--chrome,var(--fg));outline-offset:3px}
|
|
35
|
+
.nav:focus-visible,.wbar button:focus-visible{outline-color:#fff;opacity:1}
|
|
36
|
+
.slide button:focus-visible{outline:7px solid var(--fg);outline-offset:6px}
|
|
37
|
+
html.embed,html.embed body{overflow:hidden;height:100%}html.embed #report,html.embed #cue,html.embed [data-act=report]{display:none!important}
|
|
30
38
|
/* ---------- slides: 1080 wide, 1920+ tall, scaled into the frame ---------- */
|
|
31
39
|
.slide{position:absolute;inset:0;overflow:hidden;background:var(--bg);color:var(--fg);display:flex;flex-direction:column;padding:104px 44px 44px;font-family:var(--body);font-variant-numeric:tabular-nums;-webkit-font-smoothing:antialiased;text-rendering:geometricPrecision}
|
|
32
40
|
.slide.x{padding-top:60px}
|
|
@@ -43,16 +51,17 @@ button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webki
|
|
|
43
51
|
.lab{font-size:30px;opacity:.62}
|
|
44
52
|
.pill{display:inline-block;border-radius:99px;padding:14px 28px;font-size:30px;background:var(--pp);color:var(--opp);white-space:nowrap}
|
|
45
53
|
.fit{white-space:nowrap}
|
|
46
|
-
.top{flex:none;display:flex;justify-content:space-between;align-items:center;font-size:30px;margin-bottom:46px}
|
|
54
|
+
.top{flex:none;display:flex;justify-content:space-between;align-items:center;font-size:30px;margin-bottom:46px;padding-right:70px}
|
|
55
|
+
.caret{display:inline-block;width:.55em;height:1.05em;margin-left:4px;vertical-align:-.18em;background:currentColor;animation:caret 1.1s steps(1) infinite}@keyframes caret{50%{opacity:0}}
|
|
47
56
|
.foot{flex:none;margin-top:auto;padding-top:34px;display:flex;justify-content:space-between;align-items:center;gap:20px}
|
|
48
57
|
.gh{display:inline-flex;align-items:center;gap:12px;white-space:nowrap}
|
|
49
58
|
.gh svg{fill:currentColor;flex:none}
|
|
50
59
|
.logo{flex:none;border-radius:calc(var(--r) * 1.2);background:var(--lg);display:grid;grid-template-columns:repeat(5,1fr);gap:9px;padding:30px}
|
|
51
60
|
.logo i{border-radius:7px}
|
|
52
|
-
.logo{overflow:hidden}
|
|
61
|
+
.logo{overflow:hidden;color:var(--lgc,var(--ink))}
|
|
53
62
|
.logo .lw{grid-column:1/-1;grid-row:1/-1;padding:14px;display:grid;min-width:0;min-height:0;overflow:hidden}
|
|
54
63
|
.logo .lw svg,.mark svg{display:block;width:100%;height:100%;min-height:0}
|
|
55
|
-
.mark{display:grid;place-items:center;flex:none}
|
|
64
|
+
.mark{display:grid;place-items:center;flex:none;color:var(--mkc,var(--fg))}
|
|
56
65
|
.mark svg{width:100%;height:100%}
|
|
57
66
|
.bar{display:block;height:100%;transform-origin:0 50%}
|
|
58
67
|
.hl{background:var(--ink);color:var(--li);padding:0 14px;border-radius:12px;font-weight:800}
|
|
@@ -68,16 +77,22 @@ button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webki
|
|
|
68
77
|
.heat b{flex:1;display:flex;flex-direction:column;gap:4px}
|
|
69
78
|
.heat i{aspect-ratio:1;border-radius:3px;background:var(--sf)}
|
|
70
79
|
/* receipt */
|
|
71
|
-
.paper{background:var(--paper);color:#111;border-radius:6px;padding:
|
|
80
|
+
.paper{background:var(--paper);color:#111;border-radius:6px;padding:50px 60px 66px;font:600 31px/1.45 "JetBrains Mono","Commit Mono",monospace;-webkit-mask:radial-gradient(14px at 50% 100%,#0000 98%,#000) 0 0/40px 100%;mask:radial-gradient(14px at 50% 100%,#0000 98%,#000) 0 0/40px 100%;display:flex;flex-direction:column}
|
|
72
81
|
.paper .ln{display:flex;justify-content:space-between;gap:20px}
|
|
73
82
|
.paper .sub{opacity:.55;font-size:25px;margin-bottom:10px}
|
|
74
83
|
.paper hr{border:0;border-top:4px dashed #111;margin:26px 0}
|
|
84
|
+
/* quiz */
|
|
85
|
+
.qz{display:flex;align-items:center;gap:30px;width:100%;height:190px;padding:0 44px;background:var(--sf);color:var(--fg);text-align:left;transition:background .3s,color .3s,opacity .3s}
|
|
86
|
+
.qz .qs{opacity:0;transition:opacity .3s}
|
|
87
|
+
.qz.qy{background:var(--li);color:var(--ink)}.qz.qy .qs{opacity:1}
|
|
88
|
+
.qz.qn{opacity:.4}
|
|
75
89
|
/* share controls */
|
|
76
90
|
.btn{display:flex;align-items:center;justify-content:center;gap:16px;border-radius:calc(var(--r) * .7 + 10px);font-size:40px;height:118px;padding:0 34px;cursor:pointer;white-space:nowrap}
|
|
77
91
|
.btn svg{width:40px;height:40px;flex:none}
|
|
78
92
|
.seg3{display:flex;border-radius:99px;background:var(--sf);padding:8px;gap:6px}
|
|
79
|
-
.seg3 button{flex:1;height:84px;border-radius:99px;font-size:30px;font-family:var(--fm);font-weight:600;letter-spacing:.04em;opacity:.7}
|
|
80
|
-
.seg3 button
|
|
93
|
+
.seg3 button{flex:1;height:84px;border-radius:99px;font-size:30px;font-family:var(--fm);font-weight:600;letter-spacing:.04em;opacity:.7;transition:opacity .2s}
|
|
94
|
+
.seg3 button:hover{opacity:1}
|
|
95
|
+
.seg3 button[aria-pressed=true]{background:var(--pp);color:var(--opp);opacity:1}
|
|
81
96
|
.sw{width:64px;height:64px;border-radius:50%;flex:none;box-shadow:inset 0 0 0 3px #ffffff30}
|
|
82
97
|
.sw[aria-pressed=true]{outline:5px solid var(--fg);outline-offset:6px}
|
|
83
98
|
.tog{display:flex;align-items:center;gap:22px;font-size:32px}
|
|
@@ -110,7 +125,7 @@ button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webki
|
|
|
110
125
|
.rl b{font-weight:700;min-width:140px}
|
|
111
126
|
.rl span{opacity:.7}
|
|
112
127
|
#host{position:fixed;left:-40000px;top:0;pointer-events:none;contain:strict}
|
|
113
|
-
@media (prefers-reduced-motion:reduce){#toast,.tog i,.tog i::after{transition:none}}
|
|
128
|
+
@media (prefers-reduced-motion:reduce){.caret{animation:none}#toast,.tog i,.tog i::after,.qz,.qz .qs{transition:none}}
|
|
114
129
|
</style>
|
|
115
130
|
</head><body>
|
|
116
131
|
<main id="stage">
|
|
@@ -250,9 +265,9 @@ if (typeof location !== 'undefined' && /[?&]embed=1/.test(location.search)) docu
|
|
|
250
265
|
typeof addEventListener === 'function' && addEventListener('message', e => { const m = e.data; if (m && m.awSkin && window.AW && window.AW.setSkin) window.AW.setSkin(m.awSkin); });
|
|
251
266
|
const SITE = 'https://leonardodaviti.github.io/agent-wrapped/', REPO = 'leonardodaviti/agent-wrapped';
|
|
252
267
|
const HARNESS = { 'claude-code': 'Claude Code', codex: 'Codex', pi: 'Pi', 'mistral-vibe': 'Mistral Vibe', opencode: 'OpenCode', hermes: 'Hermes', 'gemini-cli': 'Gemini CLI', cursor: 'Cursor', copilot: 'Copilot CLI', goose: 'Goose', aider: 'Aider', cline: 'Cline' };
|
|
253
|
-
const LABELS = { harness: 'Harness of the Year', model: 'Model of the Year', tokens: 'Tokens', spendings: 'Spendings', prompts: 'Prompts', sessions: 'Sessions', streak: 'Streak', marathon: 'Marathon', swarm: 'Swarm', peakHour: 'Peak hour', politeness: 'Politeness', backseat: 'Backseat driver', lines: 'Lines written', mostResumed: 'Most resumed', wordOfYear: 'Word of the Year', agentClass: 'Agent class', tier: 'Top X%', skill: 'Skill of the Year', rateLimits: 'Rate limits', age: 'Agentic Age', twin: 'Agent Twin', youreRight: '“You’re right”', modelRace: 'Model race', caps: 'ALL CAPS', screenshots: 'Screenshots', compactions: 'Compactions', prs: 'Shipped', ctrlZ: 'Ctrl+Z Award', roast: 'Roast' };
|
|
268
|
+
const LABELS = { harness: 'Harness of the Year', model: 'Model of the Year', tokens: 'Tokens', spendings: 'Spendings', prompts: 'Prompts', sessions: 'Sessions', streak: 'Streak', marathon: 'Marathon', swarm: 'Swarm', peakHour: 'Peak hour', politeness: 'Politeness', backseat: 'Backseat driver', lines: 'Lines written', mostResumed: 'Most resumed', wordOfYear: 'Word of the Year', agentClass: 'Agent class', tier: 'Top X%', skill: 'Skill of the Year', tool: 'Tool of the Year', rateLimits: 'Rate limits', age: 'Agentic Age', twin: 'Agent Twin', youreRight: '“You’re right”', modelRace: 'Model race', caps: 'ALL CAPS', screenshots: 'Screenshots', compactions: 'Compactions', prs: 'Shipped', ctrlZ: 'Ctrl+Z Award', roast: 'Roast' };
|
|
254
269
|
// order in which award values ride along in the QR link (most wanted first)
|
|
255
|
-
const QR_AWARDS = ['peakHour', 'politeness', 'backseat', 'youreRight', 'spendings', 'marathon', 'wordOfYear', 'lines', 'ctrlZ', 'prs', '
|
|
270
|
+
const QR_AWARDS = ['tool', 'skill', 'peakHour', 'politeness', 'backseat', 'youreRight', 'spendings', 'marathon', 'wordOfYear', 'lines', 'ctrlZ', 'prs', 'rateLimits', 'mostResumed', 'screenshots', 'caps', 'compactions', 'modelRace'];
|
|
256
271
|
|
|
257
272
|
/** the compact subset that travels in the #d= fragment; drops optional fields until the QR fits (v15, ECC M) */
|
|
258
273
|
function compact(W, maxBytes = QR.capacity(15)) {
|
|
@@ -273,6 +288,11 @@ function compact(W, maxBytes = QR.capacity(15)) {
|
|
|
273
288
|
...QR_AWARDS.map(id => o => aw[id] && ((o.a = o.a || {})[id] = aw[id])),
|
|
274
289
|
o => W.twin?.why && (o.X = [W.twin.name, W.twin.match, W.twin.why]),
|
|
275
290
|
o => W.spendings?.usd && (o.u = [W.spendings.usd, W.spendings.perDay || 0]),
|
|
291
|
+
o => W.compare?.text && (o.c = W.compare.text),
|
|
292
|
+
o => W.quiz?.choices?.includes(W.quiz.answer) && (o.q = [...W.quiz.choices.slice(0, 3), W.quiz.choices.indexOf(W.quiz.answer)]),
|
|
293
|
+
o => W.busiest?.date && (o.b = [W.busiest.date, W.busiest.prompts ?? null, W.busiest.peakHour ?? null]),
|
|
294
|
+
o => W.busiest?.date && W.dayLine && (o.b = [W.busiest.date, W.busiest.prompts ?? null, W.busiest.peakHour ?? null, W.dayLine]),
|
|
295
|
+
o => W.roastBy && (o.w = W.roastBy),
|
|
276
296
|
];
|
|
277
297
|
const size = o => SITE.length + 3 + B64U.enc(JSON.stringify(o)).length;
|
|
278
298
|
let o = base;
|
|
@@ -293,7 +313,9 @@ function expand(c) {
|
|
|
293
313
|
models: (c.M || []).map(([label, s]) => ({ label, share: s / 100 })),
|
|
294
314
|
series: {}, spendings: c.u ? { usd: c.u[0], perDay: c.u[1], byModel: [] } : null,
|
|
295
315
|
tier: c.T ? { label: c.T[0], power: c.T[1] || '' } : null, age: c.A != null ? { years: c.A, why: [] } : null,
|
|
296
|
-
twin: c.X ? { name: c.X[0], match: c.X[1], why: c.X[2] || '' } : null, awards, roast: c.r || null,
|
|
316
|
+
twin: c.X ? { name: c.X[0], match: c.X[1], why: c.X[2] || '' } : null, awards, roast: c.r || null, compare: c.c ? { text: c.c } : null,
|
|
317
|
+
quiz: c.q ? { choices: c.q.slice(0, -1), answer: c.q[c.q.at(-1)], share: (c.M?.[0]?.[0] === c.q[c.q.at(-1)] ? c.M[0][1] : 0) / 100 } : null,
|
|
318
|
+
busiest: c.b ? { date: c.b[0], prompts: c.b[1], peakHour: c.b[2] } : null, dayLine: c.b?.[3] || null, roastBy: c.w || null, privacy: { projectsHidden: true } };
|
|
297
319
|
}
|
|
298
320
|
// </share>
|
|
299
321
|
|
|
@@ -326,12 +348,22 @@ if (W?.theme?.yours && typeof W.theme.yours === 'object') {
|
|
|
326
348
|
const SKINS = Object.keys(SK);
|
|
327
349
|
// free bundled faces stand in when a brand face is not installed (all OFL, inlined by render.mjs)
|
|
328
350
|
const withFallback = v => v.replace(/(^|,)\s*Inter\b(?![^,]*")/, '$1Inter,"Mona Sans"').replace(/"JetBrains Mono"/, '"JetBrains Mono","Commit Mono"').replace(/"EB Garamond"/, '"EB Garamond",Lora');
|
|
351
|
+
// WCAG contrast between two CSS colours (a gradient counts as its last, solid layer); best(bg, a, b…) → the option that reads best on bg
|
|
352
|
+
const lum = v => { let h = (String(v || '').match(/#[0-9a-f]{3,8}\b/gi) || []).pop(); if (!h) return null; h = h.slice(1); if (h.length < 6) h = [...h].map(c => c + c).join(''); return [0, 2, 4].reduce((s, i, n) => { const c = parseInt(h.slice(i, i + 2), 16) / 255; return s + (c <= .03928 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4) * [.2126, .7152, .0722][n]; }, 0); };
|
|
353
|
+
const contrast = (a, b) => { const x = lum(a), y = lum(b); return x == null || y == null ? 0 : (Math.max(x, y) + .05) / (Math.min(x, y) + .05); };
|
|
354
|
+
const best = (bg, ...opts) => opts.reduce((a, b) => contrast(b, bg) > contrast(a, bg) ? b : a);
|
|
329
355
|
let skin = SK[Q.get('skin')] ? Q.get('skin') : SK[W?.theme?.skin] ? W.theme.skin : 'wrapped';
|
|
330
356
|
function applySkin(name) {
|
|
331
357
|
skin = SK[name] ? name : 'wrapped';
|
|
332
358
|
const st = document.documentElement.style, k = SK[skin];
|
|
333
359
|
TOKENS.forEach(t => st.removeProperty('--' + t));
|
|
334
360
|
for (const [a, b] of Object.entries(k)) if (a !== 'logo') st.setProperty('--' + a, a === 'fd' || a === 'fm' ? withFallback(b) : b);
|
|
361
|
+
// derived: what a currentColor logo wears on the logo tile (--lg) and on an ink badge, and for "yours" the text on its pill / blue tile
|
|
362
|
+
const cs = getComputedStyle(document.documentElement), g = t => cs.getPropertyValue('--' + t).trim();
|
|
363
|
+
st.setProperty('--lgc', best(g('lg'), g('ink'), g('fg'))); st.setProperty('--mkc', best(g('ink'), g('fg'), g('lg')));
|
|
364
|
+
st.setProperty('--lit', contrast(g('li'), g('bg')) >= 2.2 ? g('li') : ['gr', 'bl', 'or', 'pk', 'lv'].map(g).find(c => contrast(c, g('bg')) >= 2.5) || g('fg')); // accent text on the slide background
|
|
365
|
+
st.setProperty('--wdim', lum(g('bg')) > .35 ? '.82' : '.6'); // a light skin keeps a light world
|
|
366
|
+
if (skin === 'yours') { k.opp || st.setProperty('--opp', best(g('pp'), g('ink'), g('fg'))); k.obl || st.setProperty('--obl', best(g('bl'), g('ink'), g('fg'))); }
|
|
335
367
|
document.documentElement.dataset.skin = skin;
|
|
336
368
|
}
|
|
337
369
|
|
|
@@ -365,7 +397,28 @@ const logoTile = (px = 264) => {
|
|
|
365
397
|
};
|
|
366
398
|
const top = (dark) => `<div class="top M N in"${dark ? ' style="color:var(--ink)"' : ''}><span class="gh">${GH(32)}${esc(handle())}${W.year ? `<span style="opacity:.55">· ${W.year}</span>` : ''}</span></div>`;
|
|
367
399
|
const INSTALL = 'npx wrapped-agents';
|
|
368
|
-
const
|
|
400
|
+
const CTA = () => `wrap my ${W?.year || 'year'}`;
|
|
401
|
+
// the call to action under every card, on one line: the hook, then the exact command in a code pill
|
|
402
|
+
// the CTA typed into the current skin's own agent input box (one box, one line; caret blinks live, still in exports)
|
|
403
|
+
const CHAT = {
|
|
404
|
+
'claude-code': { box: 'border:3px solid #8a8a8a;border-radius:18px;padding:20px 28px', p: '<b style="color:#8a8a8a">></b>', cmd: '#d77757' },
|
|
405
|
+
codex: { box: 'background:color-mix(in srgb,currentColor 9%,transparent);padding:22px 28px', p: '<b>›</b>', cmd: null },
|
|
406
|
+
'gemini-cli': { box: 'border:3px solid transparent;border-radius:16px;padding:20px 28px;background:linear-gradient(#0b0b0b,#0b0b0b) padding-box,linear-gradient(90deg,#4796e4,#847ace,#c3677f) border-box;color:#f3f0e8', p: '<b style="color:#847ace">></b>', cmd: '#4796e4' },
|
|
407
|
+
'mistral-vibe': { box: 'border:3px solid transparent;border-radius:6px;padding:20px 28px;background:linear-gradient(#000,#000) padding-box,linear-gradient(90deg,#ffd800,#ff8205,#e10500) border-box;color:#fff', p: '<b style="color:#ff8205">></b>', cmd: '#ffd800' },
|
|
408
|
+
opencode: { box: 'border-left:8px solid #fab283;background:color-mix(in srgb,currentColor 8%,transparent);padding:22px 28px', p: '', cmd: '#fab283', meta: 'Build · wrapped-agents' },
|
|
409
|
+
pi: { box: 'border-top:3px solid currentColor;border-bottom:3px solid currentColor;padding:18px 4px', p: '', cmd: null },
|
|
410
|
+
cursor: { box: 'background:#1d1d1d;color:#e4e4e4;border:2px solid #343434;border-radius:22px;padding:22px 28px', p: '', cmd: '#e4e4e4', meta: 'Agent ▾ Auto', send: '#e4e4e4;color:#1d1d1d' },
|
|
411
|
+
anthropic: { box: 'background:#fff;color:#141413;border:2px solid #e3dfd5;border-radius:28px;padding:22px 28px;box-shadow:0 6px 20px rgba(0,0,0,.08)', p: '', cmd: '#c6613f', sans: 1, send: '#c6613f;color:#fff' },
|
|
412
|
+
};
|
|
413
|
+
const foot = () => {
|
|
414
|
+
const c = CHAT[skin === 'qwen-code' ? 'gemini-cli' : skin] || { box: 'border:3px solid currentColor;border-radius:16px;padding:20px 28px', p: '<b>❯</b>', cmd: null };
|
|
415
|
+
const font = c.sans ? 'font:500 34px/1.25 var(--body)' : 'font:500 31px/1.25 var(--fm)';
|
|
416
|
+
const text = `${CTA()} with <span style="${c.cmd ? `color:${c.cmd};` : ''}font-weight:700">${INSTALL}</span><span class="caret"${c.sans ? ' style="width:3px"' : ''}></span>`;
|
|
417
|
+
const send = c.send ? `<span style="flex:none;margin-left:auto;width:54px;height:54px;border-radius:${c.sans ? 14 : 99}px;display:grid;place-items:center;background:${c.send};font:700 30px/1 var(--body)">↑</span>` : '';
|
|
418
|
+
return `<div class="foot" style="display:block;white-space:nowrap"><div class="chat" style="${c.box};${font};letter-spacing:0;text-transform:none;text-align:left">
|
|
419
|
+
<div style="display:flex;align-items:center;gap:16px">${c.p ? `<span style="flex:none">${c.p}</span>` : ''}<span style="overflow:hidden;text-overflow:ellipsis">${text}</span>${c.meta ? '' : send}</div>
|
|
420
|
+
${c.meta ? `<div style="display:flex;align-items:center;gap:16px;margin-top:14px;font-size:22px;opacity:.6">${c.meta}${send ? `<span style="margin-left:auto;opacity:1">${send}</span>` : ''}</div>` : ''}</div></div>`;
|
|
421
|
+
};
|
|
369
422
|
const cnt = (v, f = 'n', to = v) => `<span data-n="${v}" data-f="${f}" data-to="${to}">${FMT[f](v, to)}</span>`;
|
|
370
423
|
const COLORS = ['li', 'pk', 'lv', 'or', 'bl'];
|
|
371
424
|
|
|
@@ -376,10 +429,15 @@ const S = {};
|
|
|
376
429
|
S.tokens = {
|
|
377
430
|
ok: () => T().tokens > 0, dur: 5500, chrome: 'ink',
|
|
378
431
|
html: () => {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const
|
|
432
|
+
// the comparison comes from the stats engine (a different work each run, counted on input + output only); old wrap files fall back to the fixed line
|
|
433
|
+
const t = T().tokens, hp = t / 1.45e6, cmp = typeof W.compare?.text === 'string' && W.compare.text.trim(), hl = x => `<b class="hl">${x}</b>`;
|
|
434
|
+
// highlight the multiple: the engine's own number when the text carries it (a title like "1984" must not win), else the number before "times", else the first one
|
|
435
|
+
const x2 = +(+W.compare?.times || 0).toPrecision(2), opt = cmp && (W.compare.options || []).find(o => o?.times && cmp.includes(o.work) && cmp.includes(o.times));
|
|
436
|
+
const want = opt ? String(opt.times) : x2 >= 100 ? N(x2) : x2 >= 10 ? x2.toFixed(0) : x2 ? x2.toFixed(1) : '', re = want && new RegExp('(?<![\\d,.])' + want.replace('.', '\\.') + '(?![\\d,])');
|
|
437
|
+
const line = cmp ? esc(cmp).replace(re && re.test(cmp) ? re : /\d[\d,.]*(?=\s+times)/.test(cmp) ? /\d[\d,.]*(?=\s+times)/ : /\d[\d,.]*\d|\d/, hl)
|
|
438
|
+
: hp >= 10 ? `That’s every Harry Potter book, read ${hl(N(+hp.toPrecision(2)))} times.`
|
|
439
|
+
: `That’s ${hl(N(Math.max(1, t / 1.2e5)))} novels’ worth of words.`;
|
|
440
|
+
const pills = [T().toolCalls ? N(T().toolCalls) + ' tool calls' : ''].filter(Boolean);
|
|
383
441
|
return `<div class="slide" style="background:var(--li);color:var(--ink)">${top(1)}
|
|
384
442
|
<div class="M in" style="font-size:40px">This year your agents burned</div><div class="grow"></div>
|
|
385
443
|
<div class="H fit in" style="font-size:300px">${cnt(t, 'b')}</div><div class="H in" style="font-size:130px;margin-top:14px">tokens.</div>
|
|
@@ -411,6 +469,39 @@ S.harness = {
|
|
|
411
469
|
run: el => $$('.bar', el).forEach((b, i) => grow(b, 'scaleX', 500 + i * 120)),
|
|
412
470
|
};
|
|
413
471
|
|
|
472
|
+
// guess your #1 model: three choices, then the race is the reveal
|
|
473
|
+
let quizDone = false, STILL = false; // STILL: building an export, slides render their final state
|
|
474
|
+
S.quiz = {
|
|
475
|
+
ok: () => { const q = W.quiz; return Array.isArray(q?.choices) && q.choices.length > 1 && q.choices.includes(q.answer); },
|
|
476
|
+
dur: 8000, reset: () => { quizDone = false; }, end: () => quizReveal(),
|
|
477
|
+
html: () => {
|
|
478
|
+
const q = W.quiz, open = STATIC || STILL || quizDone, ask = String(q.question || 'Which model did you use most?');
|
|
479
|
+
return `<div class="slide">${top()}
|
|
480
|
+
<div class="M lab in">Before the reveal</div><div class="H in" style="font-size:${ask.length > 34 ? 112 : 140}px;margin-top:24px">${esc(ask)}</div>
|
|
481
|
+
<div class="grow" style="min-height:40px"></div>
|
|
482
|
+
<div class="col" style="gap:22px">${q.choices.slice(0, 3).map((c, i) => `<button class="qz tile in ctl${open ? (c === q.answer ? ' qy' : ' qn') : ''}" data-quiz="${i}"><span class="M" style="font-size:30px;opacity:.55;flex:none">${i + 1}</span><span class="H fit" style="font-size:92px;flex:1;min-width:0">${esc(c)}</span>${c === q.answer && q.share ? `<span class="M qs" style="font-size:34px;flex:none">${pct(q.share)}</span>` : ''}</button>`).join('')}</div>
|
|
483
|
+
<div class="M in qa" style="font-size:32px;margin-top:40px;min-height:44px">${open ? esc(quizLine()) : 'Pick one'}</div>
|
|
484
|
+
${foot()}</div>`;
|
|
485
|
+
},
|
|
486
|
+
};
|
|
487
|
+
const quizLine = say => `${say ? say + ' ' : ''}${W.quiz.answer}${W.quiz.share ? ' · ' + pct(W.quiz.share) + ' of your tokens' : ''}`;
|
|
488
|
+
/** pick = the chosen label, or undefined when the countdown ran out */
|
|
489
|
+
function quizReveal(pick) {
|
|
490
|
+
const el = $('.slide.live', view), q = W.quiz;
|
|
491
|
+
if (!el || el.dataset.key !== 'quiz' || quizDone) return;
|
|
492
|
+
quizDone = true;
|
|
493
|
+
const motion = !STATIC && !reduced();
|
|
494
|
+
$$('[data-quiz]', el).forEach(b => {
|
|
495
|
+
const c = q.choices[+b.dataset.quiz], right = c === q.answer; b.classList.add(right ? 'qy' : 'qn');
|
|
496
|
+
if (!motion) return;
|
|
497
|
+
if (right) b.animate([{ transform: 'scale(.96)' }, { transform: 'none' }], { duration: SP.pop.ms, easing: SP.pop.easing });
|
|
498
|
+
else if (c === pick) b.animate([0, -24, 20, -14, 8, 0].map(x => ({ transform: `translateX(${x}px)` })), { duration: 420, easing: 'ease-out' });
|
|
499
|
+
});
|
|
500
|
+
const qa = $('.qa', el); if (qa) qa.textContent = quizLine(pick === undefined ? 'Time’s up.' : pick === q.answer ? 'You knew it.' : 'Not quite.');
|
|
501
|
+
if (prog) { prog.onfinish = null; prog.finish(); }
|
|
502
|
+
after(1900, next);
|
|
503
|
+
}
|
|
504
|
+
|
|
414
505
|
// model race: month by month, then the year
|
|
415
506
|
function raceFrames() {
|
|
416
507
|
const R = W.series?.race;
|
|
@@ -432,11 +523,11 @@ S.race = {
|
|
|
432
523
|
const col = i => C(COLORS[rank.indexOf(i) % 5]), tot = F.at(-1).tot || fin.reduce((a, b) => a + b, 0) || 1, mx = Math.max(...fin) || 1;
|
|
433
524
|
const win = models[rank[0]], wm = (W.models || []).find(m => m.label === win);
|
|
434
525
|
return `<div class="slide">${top()}
|
|
435
|
-
<div class="M lab in">Model race · ${W.year || ''}</div><div class="H in" style="font-size:150px;margin-top:24px">Who ruled<br><span class="rm" style="color:var(--li)">${esc(F.at(-1).label)}</span>?</div>
|
|
526
|
+
<div class="M lab in">Model race · ${W.year || ''}</div><div class="H in" style="font-size:150px;margin-top:24px">Who ruled<br><span class="rm" style="color:var(--lit,var(--li))">${esc(F.at(-1).label)}</span>?</div>
|
|
436
527
|
<div class="race in grow" style="margin-top:80px;min-height:${n * RACE_ROW}px">${rank.slice(0, n).map((i, r) => `<div class="rr" data-i="${i}" style="transform:translateY(${r * RACE_ROW}px)">
|
|
437
528
|
<div class="rn H"><span class="fit" style="min-width:0">${esc(models[i])}</span><span class="M rv">${Math.round(fin[i] / tot * 100)}%</span></div>
|
|
438
529
|
<div class="rt"><i style="background:${col(i)};transform:scaleX(${Math.max(.02, fin[i] / mx)})"></i></div></div>`).join('')}</div>
|
|
439
|
-
<div class="row in" style="align-items:baseline;justify-content:space-between;margin-top:20px"><span class="M lab">Model of the Year</span><span class="H fit" style="font-size:64px;color:var(--li)">${esc(win)}${wm?.share ? ` · ${Math.round(wm.share * 100)}%` : ''}</span></div>
|
|
530
|
+
<div class="row in" style="align-items:baseline;justify-content:space-between;margin-top:20px"><span class="M lab" style="flex:none">Model of the Year</span><span class="H fit" style="font-size:64px;color:var(--lit,var(--li));flex:1;min-width:0;text-align:right">${esc(win)}${wm?.share ? ` · ${Math.round(wm.share * 100)}%` : ''}</span></div>
|
|
440
531
|
${foot()}</div>`;
|
|
441
532
|
},
|
|
442
533
|
run: el => {
|
|
@@ -463,7 +554,7 @@ S.race = {
|
|
|
463
554
|
};
|
|
464
555
|
const order = vals => vals.map((v, i) => [v, i]).sort((a, b) => b[0] - a[0] || a[1] - b[1]).map(x => x[1]);
|
|
465
556
|
|
|
466
|
-
//
|
|
557
|
+
// the card: "My {year}", the bento of the year's awards. It is a story slide, the share-slide preview and what Save card exports
|
|
467
558
|
function heatCells() {
|
|
468
559
|
const days = W.series?.days, y = W.year;
|
|
469
560
|
if (!days || !y || !Object.keys(days).length) return null;
|
|
@@ -479,29 +570,45 @@ function heatCells() {
|
|
|
479
570
|
}
|
|
480
571
|
return cols;
|
|
481
572
|
}
|
|
482
|
-
const head = (w) => `<div class="row" style="align-items:center;gap:40px;margin-bottom:30px;flex:none">${logoTile(
|
|
573
|
+
const head = (w, px = 236) => `<div class="row" style="align-items:center;gap:40px;margin-bottom:30px;flex:none">${logoTile(px)}<div style="min-width:0;flex:1">
|
|
483
574
|
<div class="H fit in" style="font-size:150px">${w}</div><div class="row in" style="gap:24px;align-items:center;margin-top:22px;flex-wrap:wrap">
|
|
484
|
-
<span class="M N gh" style="font-size:36px">${GH(40)}
|
|
575
|
+
<span class="M N gh" style="font-size:36px;max-width:100%;min-width:0">${GH(40)}<span style="overflow:hidden;text-overflow:ellipsis">${esc(handle())}</span></span>${W.tier?.label ? `<span class="pill M">${esc(W.tier.label)}</span>` : ''}</div></div></div>`;
|
|
576
|
+
const pct = x => { const p = Math.round((x || 0) * 100); return p < 1 && x > 0 ? '<1%' : p + '%'; };
|
|
577
|
+
function ballot() {
|
|
578
|
+
const h = W.harnesses?.[0], m = W.models?.[0], pick = (id, fb) => { const a = AW(id); return a?.value ? a : fb || null; };
|
|
579
|
+
return [['Harness', pick('harness', h && { value: h.label || HARNESS[h.id] || h.id, detail: h.share ? pct(h.share) + ' of prompts' : '' })],
|
|
580
|
+
['Model', pick('model', m && { value: m.label, detail: m.share ? pct(m.share) + ' of tokens' : '' })],
|
|
581
|
+
['Skill', pick('skill')]].filter(r => r[1]);
|
|
582
|
+
}
|
|
583
|
+
// a long one-word value (a skill id) breaks once, near its middle, so fit() can keep it large
|
|
584
|
+
const two = v => { v = String(v ?? ''); if (v.length < 10) return esc(v); let at = -1; [...v].forEach((c, i) => { if (/[-_ /.:]/.test(c) && i < v.length - 1 && Math.abs(i + 1 - v.length / 2) < Math.abs(at + 1 - v.length / 2)) at = i; }); return at < 0 ? esc(v) : esc(v.slice(0, at + 1)) + '<br>' + esc(v.slice(at + 1).trim()); };
|
|
485
585
|
S.bento = {
|
|
486
|
-
ok: () => T().prompts > 0, dur: 6500,
|
|
586
|
+
ok: () => T().prompts > 0 || ballot().length > 0, dur: 6500,
|
|
487
587
|
html: () => {
|
|
488
|
-
const t = T(),
|
|
489
|
-
const
|
|
588
|
+
const t = T(), heat = heatCells(), rows = Object.fromEntries(ballot()), H = (W.harnesses || []).slice(0, 12), mx = Math.max(...H.map(h => h.share || 0), .01);
|
|
589
|
+
const tok = AW('tokens')?.value || (t.tokens > 0 ? BIG(t.tokens) : ''), usd = AW('spendings')?.value || (W.spendings?.usd ? '≈ ' + USD(W.spendings.usd) : ''), sw = AW('swarm'), agents = num(sw?.value) ?? t.subagents, rl = AW('rateLimits');
|
|
590
|
+
// THE FIVE TILES, in one place. Two big ones: { value, detail }. Three small ones: [label, value html, detail, colour token]; an entry with no value is left out.
|
|
591
|
+
const hw = rows.Harness, mw = rows.Model, share = W.models?.[0]?.share ?? (num(mw?.detail) ?? 0) / 100;
|
|
592
|
+
const small = [
|
|
593
|
+
['Skill of the Year', rows.Skill && two(rows.Skill.value), rows.Skill?.detail, 'lv'],
|
|
594
|
+
rl && num(rl.value) != null ? ['Limits reached', cnt(num(rl.value)), rl.detail, 'or'] : ['Agents spawned', agents != null && cnt(agents), sw?.detail, 'or'],
|
|
595
|
+
['Tokens', t.tokens > 0 ? cnt(t.tokens, 'b') : esc(tok), usd, 'bl'],
|
|
596
|
+
].filter(x => x[1]);
|
|
490
597
|
const cls = W.tier?.power || AW('agentClass')?.value, slogan = AW('agentClass')?.detail;
|
|
491
598
|
return `<div class="slide">
|
|
492
599
|
${head('My ' + (W.year || ''))}
|
|
493
600
|
<div class="col grow" style="gap:26px">
|
|
494
601
|
<div class="row" style="flex:1.5;min-height:0">
|
|
495
|
-
<div class="tile in" style="flex:1.35;background:var(--li);color:var(--ink);display:flex;flex-direction:column"
|
|
496
|
-
${
|
|
497
|
-
|
|
498
|
-
|
|
602
|
+
<div class="tile in" style="flex:1.35;min-width:0;background:var(--li);color:var(--ink);display:flex;flex-direction:column">${hw ? `<div class="M" style="font-size:28px">Harness of the Year</div><div class="H fit" style="font-size:150px;margin-top:40px">${esc(hw.value)}</div>${hw.detail ? `<div style="font-size:42px;font-weight:800;margin-top:16px">${esc(hw.detail)}</div>` : ''}
|
|
603
|
+
${H.length > 1 ? `<div class="mb" style="margin-top:auto;display:flex;gap:8px;align-items:flex-end;height:110px">${H.map(h => `<i class="bar" style="flex:1;height:${Math.max(8, (h.share || 0) / mx * 110)}px;border-radius:6px;background:var(--ink);opacity:${(.25 + (h.share || 0) / mx * .75).toFixed(2)};transform-origin:50% 100%"></i>`).join('')}</div>` : ''}`
|
|
604
|
+
: `<div class="M" style="font-size:28px">Prompts</div><div class="H fit" style="font-size:150px;margin-top:40px">${cnt(t.prompts)}</div>`}</div>
|
|
605
|
+
${mw ? `<div class="tile in" style="flex:1;min-width:0;background:var(--pk);color:var(--ink);display:flex;flex-direction:column"><div class="M" style="font-size:28px">Model of the Year</div><div class="H fit" style="font-size:190px;margin-top:30px">${esc(mw.value)}</div>${mw.detail ? `<div style="font-size:42px;font-weight:800;margin-top:16px">${esc(mw.detail)}</div>` : ''}
|
|
606
|
+
${share > 0 ? `<div class="sq" style="margin-top:auto;display:flex;gap:10px">${Array.from({ length: 5 }, (_, i) => { const f = Math.round(Math.max(0, Math.min(1, share * 5 - i)) * 100); return `<i style="width:44px;height:44px;border-radius:12px;background:linear-gradient(90deg,var(--ink) ${f}%,color-mix(in srgb,var(--ink) 22%,transparent) ${f}%)"></i>`; }).join('')}</div>` : ''}</div>` : ''}
|
|
499
607
|
</div>
|
|
500
|
-
${small.length ? `<div class="row" style="flex:1;min-height:0">${small.map(([a, v, c]) => `<div class="tile in" style="flex:1;background:${C(c)};color:${c === 'bl' ? 'var(--obl)' : 'var(--ink)'};display:flex;flex-direction:column;justify-content:space-between"><div class="M" style="font-size:26px">${a}</div><div class="H fit" style="font-size:88px">${
|
|
608
|
+
${small.length ? `<div class="row" style="flex:1;min-height:0">${small.map(([a, v, d, c]) => `<div class="tile in" style="flex:1 1 0;min-width:0;background:${C(c)};color:${c === 'bl' ? 'var(--obl)' : 'var(--ink)'};display:flex;flex-direction:column;justify-content:space-between"><div class="M" style="font-size:26px">${a}</div><div><div class="H fit" style="font-size:88px;line-height:.95">${v}</div>${d ? `<div class="M N" style="font-size:22px;opacity:.75;margin-top:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">${esc(d)}</div>` : ''}</div></div>`).join('')}</div>` : ''}
|
|
501
609
|
${cls ? `<div class="tile in" style="flex:none;border:4px solid var(--fg);padding:28px 40px;display:flex;justify-content:space-between;align-items:center;gap:30px"><div class="col" style="flex:none;gap:10px"><span class="M" style="font-size:28px">Agent class</span>${slogan ? `<span style="font-size:26px;opacity:.7;max-width:420px">${esc(slogan)}</span>` : ''}</div><span class="H fit" style="font-size:68px;min-width:0;text-align:right">${esc(cls)}</span></div>` : ''}
|
|
502
610
|
</div>
|
|
503
611
|
${heat ? `<div class="heat in" style="margin-top:30px">${heat.map(c => `<b>${c.map(s => `<i${s ? ` style="${s}"` : ''}></i>`).join('')}</b>`).join('')}</div>` : ''}
|
|
504
|
-
${W.coverage?.length ? `<div class="M N in" style="font-size:24px;opacity:.55;margin-top:22px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">${W.coverage.map(c => `${esc(c.label)} since ${md(c.from)}`).join(' · ')}</div>` : ''}
|
|
505
612
|
${foot()}</div>`;
|
|
506
613
|
},
|
|
507
614
|
run: el => {
|
|
@@ -511,29 +618,40 @@ S.bento = {
|
|
|
511
618
|
},
|
|
512
619
|
};
|
|
513
620
|
|
|
514
|
-
//
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
|
|
621
|
+
// the busiest day of the year (and the hour it peaked)
|
|
622
|
+
const DAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
623
|
+
const agentName = () => W.roastBy || W.harnesses?.[0]?.label || 'your agent';
|
|
624
|
+
S.day = {
|
|
625
|
+
ok: () => /^\d{4}-\d\d-\d\d/.test(W.busiest?.date || ''), dur: () => W.dayLine ? 7500 : 5500, chrome: 'ink',
|
|
518
626
|
html: () => {
|
|
519
|
-
const
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
627
|
+
const b = W.busiest, d = new Date(b.date.slice(0, 10) + 'T12:00:00'), wd = isNaN(d) ? '' : DAYS[d.getDay()];
|
|
628
|
+
const line = typeof W.dayLine === 'string' && W.dayLine.trim(), hour = Number.isFinite(+b.peakHour) && b.peakHour != null ? String(Math.round(+b.peakHour)).padStart(2, '0') + ':00' : '';
|
|
629
|
+
return `<div class="slide" style="background:var(--lv);color:var(--ink)">${top(1)}
|
|
630
|
+
<div class="M in" style="font-size:40px">Your busiest day</div><div class="grow"></div>
|
|
631
|
+
<div class="H fit in" style="font-size:340px">${md(b.date)}</div>
|
|
632
|
+
${wd ? `<div class="H in" style="font-size:110px;margin-top:14px">a ${wd}.</div>` : ''}
|
|
633
|
+
<div class="grow"></div>
|
|
634
|
+
<div class="row in" style="gap:22px">
|
|
635
|
+
${b.prompts != null ? `<div class="tile" style="flex:1.25 1 0;min-width:0;background:var(--ink);color:var(--lv)"><div class="M" style="font-size:28px">prompts in one day</div><div class="H fit" style="font-size:150px;margin-top:26px">${cnt(b.prompts)}</div></div>` : ''}
|
|
636
|
+
${hour ? `<div class="tile" style="flex:1 1 0;min-width:0;box-shadow:inset 0 0 0 5px var(--ink)"><div class="M" style="font-size:28px">mostly at</div><div class="H fit" style="font-size:150px;margin-top:26px">${hour}</div></div>` : ''}
|
|
637
|
+
</div>
|
|
638
|
+
${line ? `<div class="in" style="margin-top:44px"><div style="font-size:50px;font-weight:700;line-height:1.2">“${esc(line)}”</div><div class="M" style="font-size:26px;margin-top:18px;opacity:.7">— ${esc(agentName())}’s guess</div></div>` : ''}
|
|
639
|
+
${foot()}</div>`;
|
|
640
|
+
},
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
// top 5 skills and models, Spotify-style
|
|
644
|
+
S.top5 = {
|
|
645
|
+
ok: () => ['skills', 'models'].some(k => Array.isArray(W.top5?.[k]) && W.top5[k].length > 0), dur: 7500,
|
|
646
|
+
html: () => {
|
|
647
|
+
const t = W.top5, L = (k, title, f) => Array.isArray(t[k]) && t[k].length ? { title, rows: t[k].slice(0, 5).filter(r => Array.isArray(r)).map(([n, v]) => [n, f(v)]) } : null;
|
|
648
|
+
const cols = [L('skills', 'Skills', v => N(v) + ' runs'), L('models', 'Models', v => pct(v) + ' of tokens')].filter(Boolean), wide = cols.length < 2, fs = wide ? 110 : 76;
|
|
649
|
+
const col = c => `<div class="col" style="flex:1 1 0;min-width:0;justify-content:space-between;gap:30px"><div class="in"><span class="pill M">${c.title}</span></div>${c.rows.map(([n, v], i) => `<div class="row in" style="gap:20px;align-items:baseline"><span class="H" style="font-size:${fs}px;line-height:1;opacity:.35;flex:none;width:${wide ? 96 : 62}px">${i + 1}</span><div style="min-width:0;flex:1"><div class="H fit" style="font-size:${fs}px;line-height:1.05${i ? '' : ';color:var(--lit,var(--li))'}">${esc(n)}</div><div class="M N" style="font-size:${wide ? 30 : 26}px;opacity:.6;margin-top:10px">${v}</div></div></div>`).join('')}</div>`;
|
|
525
650
|
return `<div class="slide">${top()}
|
|
526
|
-
<div class="M lab in">
|
|
527
|
-
<div class="grow
|
|
528
|
-
<svg viewBox="-500 -500 1000 1000" style="width:min(100%,900px);height:min(100%,900px);overflow:visible">
|
|
529
|
-
${[0, 6, 12, 18].map(k => { const a = k / 24 * Math.PI * 2 - Math.PI / 2; return `<text x="${(Math.cos(a) * 180).toFixed(1)}" y="${(Math.sin(a) * 180 + 10).toFixed(1)}" text-anchor="middle" font-size="28" fill="currentColor" opacity=".45" style="font-family:var(--fm)">${String(k).padStart(2, '0')}</text>`; }).join('')}
|
|
530
|
-
${(h || Array.from({ length: 24 }, (_, k) => k === peak ? 1 : .12)).map((v, k) => `<g transform="rotate(${k * 15 - 90})"><rect class="hb" x="230" y="-15" width="${Math.max(30, v / mx * 250).toFixed(1)}" height="30" rx="15" fill="${top3.includes(k) ? C('li') : C('lv')}" style="transform-box:fill-box;transform-origin:0 50%"/></g>`).join('')}
|
|
531
|
-
<text y="-6" text-anchor="middle" font-size="120" fill="currentColor" style="font-family:var(--fd);font-weight:var(--fw);letter-spacing:var(--ls);font-style:var(--fst)">${String(peak).padStart(2, '0')}:00</text>
|
|
532
|
-
<text y="58" text-anchor="middle" font-size="28" fill="currentColor" opacity=".6" letter-spacing="5" style="font-family:var(--fm)">PEAK HOUR</text></svg></div>
|
|
533
|
-
<div class="row in" style="justify-content:space-between;align-items:baseline;flex-wrap:wrap;gap:10px 30px"><span class="M" style="font-size:32px">${esc(nightTxt)}</span>${bd ? `<span class="M" style="font-size:32px;opacity:.6">Busiest on ${bd}</span>` : ''}</div>
|
|
651
|
+
<div class="M lab in">On repeat</div><div class="H in" style="font-size:170px;margin-top:24px">Top 5</div>
|
|
652
|
+
<div class="row grow" style="gap:44px;margin-top:64px;max-height:1150px">${cols.map(col).join('')}</div>
|
|
534
653
|
${foot()}</div>`;
|
|
535
654
|
},
|
|
536
|
-
run: el => $$('.hb', el).forEach((b, i) => grow(b, 'scaleX', 400 + i * 28)),
|
|
537
655
|
};
|
|
538
656
|
|
|
539
657
|
// manners: please vs Esc
|
|
@@ -575,17 +693,17 @@ S.age = {
|
|
|
575
693
|
const wp = why.map(w => /(\d+)-word prompts/.exec(w)).find(Boolean), late = why.some(w => /after 2[2-4]/.test(w));
|
|
576
694
|
const line = [wp ? `Old enough for <span style="white-space:nowrap">${wp[1]}-word</span> prompts.` : '', late ? 'Young enough to code at 2 a.m.' : ''].filter(Boolean).join(' ');
|
|
577
695
|
return `<div class="slide" style="padding:0">
|
|
578
|
-
${A ? `<div class="col pt" style="flex
|
|
696
|
+
${A ? `<div class="col pt" style="flex:1;background:var(--pk);color:var(--ink);padding:104px 44px 50px;min-height:0">${top(1)}
|
|
579
697
|
<div class="M in" style="font-size:34px">Your agentic age is</div>
|
|
580
|
-
<div class="row" style="align-items:flex-end;gap:40px;flex:1;min-height:0"><div class="H in" style="font-size:${X ? 460 : 640}px;letter-spacing:-.07em;line-height:.8">${cnt(A.years)}</div>
|
|
581
|
-
${line ? `<div class="in" style="font-size:46px;font-weight:800;line-height:1.12;padding-bottom:20px">${line}</div>` : ''}</div>
|
|
698
|
+
<div class="row" style="align-items:flex-end;gap:40px;flex:1;min-height:0"><div class="H in" style="flex:none;font-size:${Math.round((X ? 460 : 640) * Math.min(1, 2 / String(Math.round(A.years)).length))}px;letter-spacing:-.07em;line-height:.8">${cnt(A.years)}</div>
|
|
699
|
+
${line ? `<div class="in" style="min-width:0;font-size:46px;font-weight:800;line-height:1.12;padding-bottom:20px">${line}</div>` : ''}</div>
|
|
582
700
|
${why.length ? `<div class="row in" style="flex-wrap:wrap;gap:14px;margin-top:34px">${why.map(w => `<span class="pill M N" style="font-size:28px;background:var(--ink);color:var(--pk)">${esc(w)}</span>`).join('')}</div>` : ''}</div>` : ''}
|
|
583
701
|
${X ? `<div class="col${A ? '' : ' pt'}" style="flex:1;padding:${A ? 60 : 104}px 44px 44px;min-height:0">${A ? '' : top()}
|
|
584
702
|
<div class="M lab in">Your agent twin</div><div class="H fit in" style="font-size:120px;margin-top:20px">${esc(X.name)}</div>
|
|
585
|
-
<div class="row" style="gap:30px;margin-top:
|
|
586
|
-
<div class="tile in" style="flex:1;background:var(--li);color:var(--ink);transform:rotate(-3deg);display:flex;flex-direction:column;justify-content:space-between"><span class="M" style="font-size:26px">you</span><span class="H" style="font-size:150px">✦</span><span class="M N gh" style="font-size:26px">${GH(26)}
|
|
703
|
+
<div class="row" style="gap:30px;margin-top:36px;flex:1;min-height:240px;max-height:420px">
|
|
704
|
+
<div class="tile in" style="flex:1;background:var(--li);color:var(--ink);transform:rotate(-3deg);display:flex;flex-direction:column;justify-content:space-between"><span class="M" style="font-size:26px">you</span><span class="H" style="font-size:150px">✦</span><span class="M N gh" style="font-size:26px;max-width:100%">${GH(26)}<span style="overflow:hidden;text-overflow:ellipsis">${esc(handle())}</span></span></div>
|
|
587
705
|
<div class="tile in" style="flex:1;background:var(--lv);color:var(--ink);transform:rotate(3deg);display:flex;flex-direction:column;justify-content:space-between"><span class="M" style="font-size:26px">twin</span><span class="H" style="font-size:150px">∞</span><span class="M N" style="font-size:26px">${esc(X.why || X.name)}</span></div></div>
|
|
588
|
-
<div class="row in" style="align-items:baseline;gap:20px;margin-top:
|
|
706
|
+
<div class="row in" style="align-items:baseline;gap:20px;margin-top:28px"><span class="H" style="font-size:150px">${cnt(X.match || 0)}</span><span class="M" style="font-size:34px">% match</span></div>
|
|
589
707
|
${foot()}</div>` : ''}
|
|
590
708
|
${X ? '' : `<div style="padding:0 44px 44px">${foot()}</div>`}</div>`;
|
|
591
709
|
},
|
|
@@ -607,8 +725,8 @@ S.spend = {
|
|
|
607
725
|
<div class="paper" style="width:840px;max-height:100%"><div style="text-align:center;font-size:46px;font-weight:800">SPENDINGS ${W.year || ''}</div><div style="text-align:center;opacity:.6;font-size:26px">${esc(handle())} · AT API LIST PRICES</div><hr>
|
|
608
726
|
${shown.map(([a, b, c]) => `<div class="ln"><span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${esc(a)}</span><span style="flex:none">${b}</span></div>${c ? `<div class="sub"> ${c}</div>` : ''}`).join('')}${more > 0 ? `<div class="sub">+ ${more} more</div>` : ''}
|
|
609
727
|
<hr><div class="ln" style="font-size:46px;font-weight:800"><span>TOTAL</span><span>${esc(total)}</span></div>
|
|
610
|
-
${s.perDay ? `<div class="tot" style="margin:
|
|
611
|
-
<div style="height:
|
|
728
|
+
${s.perDay ? `<div class="tot" style="margin:26px 0 22px;background:#111;color:var(--li);text-align:center;border-radius:20px;padding:30px"><div class="H fit" style="font-size:110px">${USD(s.perDay)}/day</div><div style="font-size:26px;margin-top:8px">IF YOU PAID PER TOKEN</div></div>` : ''}
|
|
729
|
+
<div style="height:80px;flex:none;margin-top:${s.perDay ? 0 : 30}px;background:repeating-linear-gradient(90deg,#111 0 4px,transparent 4px 9px,#111 9px 11px,transparent 11px 17px)"></div>
|
|
612
730
|
<div style="text-align:center;opacity:.6;font-size:22px;margin-top:10px">${[pd && 'LIST PRICES ' + pd, cache].filter(Boolean).join(' · ')}</div></div></div>
|
|
613
731
|
${foot()}</div>`;
|
|
614
732
|
},
|
|
@@ -650,7 +768,7 @@ S.share = {
|
|
|
650
768
|
<div class="row grow" style="margin-top:56px;gap:40px;align-items:center;min-height:620px">
|
|
651
769
|
<button class="in ctl" data-act="wall" aria-label="Wall" style="flex:none;width:346px;height:615px;position:relative;border-radius:calc(var(--r) * .6 + 8px);overflow:hidden;transform:rotate(-3deg);box-shadow:0 40px 120px #0009"><div class="mini" style="position:absolute;left:0;top:0;width:1080px;height:1920px;transform:scale(.3204);transform-origin:0 0;pointer-events:none">${miniCard() || wallHTML({ mini: 1 })}</div></button>
|
|
652
770
|
<div class="col in" style="flex:1;min-width:0;gap:26px;align-items:flex-start">
|
|
653
|
-
${VIEWER ? `<div class="H" style="font-size:72px"
|
|
771
|
+
${VIEWER ? `<div class="H" style="font-size:72px">${CTA()}</div><div class="M N" style="font-size:30px;line-height:1.5;overflow-wrap:anywhere;opacity:.8">${INSTALL}</div>`
|
|
654
772
|
: `<div class="qr" style="width:100%;max-width:420px;aspect-ratio:1">${qrSVG(shareURL(W))}</div><div class="M N" style="font-size:30px;display:flex;gap:14px;align-items:center"><svg viewBox="0 0 24 24" style="width:38px;height:38px" fill="none" stroke="currentColor" stroke-width="2"><rect x="6" y="2" width="12" height="20" rx="3"/><path d="M10 18h4"/></svg>→ phone</div>`}
|
|
655
773
|
</div></div>
|
|
656
774
|
<div class="seg3 in ctl" role="group" aria-label="Size" style="margin-top:46px">${Object.entries(SIZES).map(([k, [w, h, l]]) => `<button data-size="${k}" aria-pressed="${k === size}">${l} <span style="opacity:.55">${w}×${h}</span></button>`).join('')}</div>
|
|
@@ -667,7 +785,8 @@ S.share = {
|
|
|
667
785
|
// wall: every award on one card (the share image)
|
|
668
786
|
function miniCard() { try { return S.bento.html().replace('<div class="slide', '<div class="slide x'); } catch { return ''; } }
|
|
669
787
|
function wallHTML({ mini } = {}) {
|
|
670
|
-
const
|
|
788
|
+
const first = ['harness', 'model', 'skill', 'tool'], rank = a => first.indexOf(a.id) + 1 || 9; // the four awards lead; no sessions / active days / subagents tiles
|
|
789
|
+
const aw = (W.awards || []).filter(a => a.value && !['sessions', 'activeDays', 'subagents'].includes(a.id)).sort((a, b) => rank(a) - rank(b)).map(a => [a.label || LABELS[a.id] || a.id, red(a.value)]);
|
|
671
790
|
if (W.roast) aw.push(['Roast', '“' + (W.roast.split(/(?<=[.!?])\s/)[0] || W.roast).slice(0, 40) + '”']);
|
|
672
791
|
const hs = (W.harnesses || []).map(h => h.label || HARNESS[h.id] || h.id).slice(0, 4).join(' · ');
|
|
673
792
|
return `<div class="slide${mini ? ' x' : ''}" style="padding-top:${mini ? 60 : ''}px">${head(String(W.year || ''))}
|
|
@@ -700,9 +819,11 @@ const grow = (el, axis, delay) => anim(el, [{ transform: `${axis}(0)` }, { trans
|
|
|
700
819
|
// a tiny clock for JS-driven tweens (count-ups, race). Runs only while a tween is alive; freezes on pause
|
|
701
820
|
const TK = { list: [], raf: 0, t: 0, last: 0 };
|
|
702
821
|
function tween(ms, fn, delay = 0) { if (STATIC) return fn(1, 0); if (reduced()) return fn(1, 0); TK.list.push({ start: TK.t + delay, ms, fn, done: false }); kick(); }
|
|
703
|
-
|
|
822
|
+
// a one-shot on the same clock, so it waits while the story is paused (unlike setTimeout) and dies with its slide
|
|
823
|
+
function after(ms, fn) { if (STATIC) return; TK.list.push({ start: TK.t + ms, ms: 1, fn: p => p >= 1 && fn() }); kick(); }
|
|
824
|
+
function kick() { if (!TK.raf && !paused()) { TK.last = 0; TK.raf = requestAnimationFrame(tick); } } // the first frame after a (re)start only sets the clock
|
|
704
825
|
function tick(now) {
|
|
705
|
-
TK.raf = 0; const dt = Math.min(50, now - TK.last); TK.last = now; TK.t += dt;
|
|
826
|
+
TK.raf = 0; const dt = TK.last ? Math.max(0, Math.min(50, now - TK.last)) : 0; TK.last = now; TK.t += dt;
|
|
706
827
|
TK.list = TK.list.filter(tw => { const p = (TK.t - tw.start) / tw.ms; if (p < 0) return true; tw.fn(Math.min(1, p), dt); return p < 1; });
|
|
707
828
|
if (TK.list.length && !paused()) TK.raf = requestAnimationFrame(tick);
|
|
708
829
|
}
|
|
@@ -726,11 +847,13 @@ function enter(el, def) {
|
|
|
726
847
|
function fit(root) {
|
|
727
848
|
$$('.fit', root).forEach(el => {
|
|
728
849
|
if (el.dataset.fs) el.style.fontSize = el.dataset.fs; else el.dataset.fs = el.style.fontSize || getComputedStyle(el).fontSize;
|
|
729
|
-
let fs = parseFloat(getComputedStyle(el).fontSize);
|
|
850
|
+
let fs = parseFloat(getComputedStyle(el).fontSize); const min = Math.ceil(fs * .4); // below 40% a name is unreadable: stop shrinking and end it with an ellipsis
|
|
730
851
|
for (let i = 0; i < 5; i++) {
|
|
731
852
|
const max = el.clientWidth || el.parentElement.clientWidth, w = el.scrollWidth;
|
|
732
853
|
if (!max || w <= max + 1) break;
|
|
733
|
-
fs = Math.floor(fs * max / w * .985);
|
|
854
|
+
fs = Math.floor(fs * max / w * .985);
|
|
855
|
+
if (fs <= min) { el.style.fontSize = min + 'px'; el.style.overflow = 'hidden'; el.style.textOverflow = 'ellipsis'; break; }
|
|
856
|
+
el.style.fontSize = fs + 'px';
|
|
734
857
|
}
|
|
735
858
|
});
|
|
736
859
|
}
|
|
@@ -741,8 +864,9 @@ let list = [], cur = 0, prog = null, LW = 1080, LH = 1920;
|
|
|
741
864
|
const why = new Set();
|
|
742
865
|
const paused = () => why.size > 0;
|
|
743
866
|
const durOf = d => typeof d.dur === 'function' ? d.dur() : d.dur;
|
|
867
|
+
const ORDER = ['tokens', 'quiz', 'race', 'harness', 'day', 'top5', 'manners', 'right', 'age', 'spend', 'roast', 'bento', 'share'];
|
|
744
868
|
function build() {
|
|
745
|
-
list =
|
|
869
|
+
list = ORDER.filter(key => { try { return S[key].ok(); } catch (e) { return false; } }).map(key => ({ key, ...S[key] }));
|
|
746
870
|
segEl.innerHTML = list.map(() => '<b><i></i></b>').join('');
|
|
747
871
|
}
|
|
748
872
|
function slideHTML(key) { return key === 'wall' ? wallHTML() : S[key].html(); }
|
|
@@ -759,6 +883,7 @@ function mount(i, animate) {
|
|
|
759
883
|
function go(i, dir = 1, animate = !STATIC) {
|
|
760
884
|
i = Math.max(0, Math.min(list.length - 1, i));
|
|
761
885
|
TK.list.length = 0; cur = i;
|
|
886
|
+
list[i].reset && list[i].reset();
|
|
762
887
|
const old = $$('.slide.live', view);
|
|
763
888
|
const el = mount(i, animate);
|
|
764
889
|
old.forEach(o => {
|
|
@@ -772,7 +897,7 @@ function go(i, dir = 1, animate = !STATIC) {
|
|
|
772
897
|
progress();
|
|
773
898
|
$('#b-prev').hidden = cur === 0; $('#b-next').hidden = cur === list.length - 1;
|
|
774
899
|
$('#b-save').hidden = false;
|
|
775
|
-
if (paused()) pauseSlide(
|
|
900
|
+
if (paused()) pauseSlide();
|
|
776
901
|
}
|
|
777
902
|
const next = () => cur < list.length - 1 && go(cur + 1, 1);
|
|
778
903
|
const prev = () => go(cur - 1, -1);
|
|
@@ -782,18 +907,21 @@ function progress() {
|
|
|
782
907
|
segs.forEach((s, k) => s.style.transform = k < cur || (k === cur && (!d || STATIC)) ? 'scaleX(1)' : 'scaleX(0)');
|
|
783
908
|
if (!d || STATIC) return;
|
|
784
909
|
prog = segs[cur].animate([{ transform: 'scaleX(0)' }, { transform: 'scaleX(1)' }], { duration: d, easing: 'linear', fill: 'forwards' });
|
|
785
|
-
prog.onfinish = () => next();
|
|
786
|
-
if (paused()) prog
|
|
787
|
-
}
|
|
788
|
-
function pauseSlide(on) {
|
|
789
|
-
const el = $('.slide.live', view);
|
|
790
|
-
el && el.getAnimations({ subtree: true }).forEach(a => on ? a.pause() : a.play());
|
|
910
|
+
prog.onfinish = () => (list[cur].end ? list[cur].end() : next());
|
|
911
|
+
if (paused()) hold(prog);
|
|
791
912
|
}
|
|
913
|
+
// pause()/play() only take effect on the next frame, and a hidden tab paints none: the pause stayed pending, play() on return
|
|
914
|
+
// dropped it, and every animation jumped ahead by the time spent away. Setting currentTime completes the pause at once.
|
|
915
|
+
// Only what was really running is held, so finished fill:both animations are never replayed on resume.
|
|
916
|
+
const held = new Set();
|
|
917
|
+
const hold = a => { if (!a || a.playState !== 'running') return; a.pause(); try { a.currentTime = a.currentTime; } catch (e) { } held.add(a); };
|
|
918
|
+
const release = () => { for (const a of held) a.playState === 'paused' && a.play(); held.clear(); };
|
|
919
|
+
function pauseSlide() { const el = $('.slide.live', view); el && el.getAnimations({ subtree: true }).forEach(hold); }
|
|
792
920
|
function setPause(reason, on) {
|
|
793
921
|
const was = paused(); on ? why.add(reason) : why.delete(reason);
|
|
794
922
|
if (was === paused()) return;
|
|
795
|
-
if (paused()) { prog
|
|
796
|
-
else {
|
|
923
|
+
if (paused()) { hold(prog); pauseSlide(); cancelAnimationFrame(TK.raf); TK.raf = 0; }
|
|
924
|
+
else { release(); TK.list.length && kick(); }
|
|
797
925
|
}
|
|
798
926
|
function remountCurrent() { if (!list[cur]) return; const el = $('.slide.live', view); el && el.remove(); mount(cur, false); }
|
|
799
927
|
function setSkin(k) {
|
|
@@ -807,6 +935,7 @@ function layout() {
|
|
|
807
935
|
let fw, fh;
|
|
808
936
|
if (r <= 9 / 16 + .001) { fw = vw; LW = 1080; LH = Math.min(2400, Math.round(1080 * vh / vw)); fh = Math.round(fw * LH / LW); frame.classList.remove('boxed'); }
|
|
809
937
|
else { const m = vw > 700 ? 48 : 0; fh = vh - m; fw = Math.round(fh * 9 / 16); LW = 1080; LH = 1920; frame.classList.toggle('boxed', m > 0); }
|
|
938
|
+
$('#stage').classList.toggle('full', fw >= vw && fh >= vh);
|
|
810
939
|
const s = fw / LW;
|
|
811
940
|
frame.style.width = fw + 'px'; frame.style.height = fh + 'px';
|
|
812
941
|
view.style.width = LW + 'px'; view.style.height = LH + 'px'; view.style.transform = `scale(${s})`;
|
|
@@ -828,6 +957,7 @@ frame.addEventListener('pointerdown', e => {
|
|
|
828
957
|
frame.addEventListener('pointermove', e => { if (ptr && Math.hypot(e.clientX - ptr.x, e.clientY - ptr.y) > 14) cancelPtr(); });
|
|
829
958
|
const cancelPtr = () => { clearTimeout(holdT); if (ptr?.held) setPause('hold', false); ptr = null; };
|
|
830
959
|
frame.addEventListener('pointercancel', cancelPtr);
|
|
960
|
+
addEventListener('blur', cancelPtr); // a press that ends in another window never sends pointerup
|
|
831
961
|
frame.addEventListener('pointerleave', e => e.pointerType === 'mouse' && cancelPtr());
|
|
832
962
|
frame.addEventListener('pointerup', e => {
|
|
833
963
|
if (!ptr) return; clearTimeout(holdT);
|
|
@@ -840,7 +970,8 @@ frame.addEventListener('contextmenu', e => e.preventDefault());
|
|
|
840
970
|
$('#b-prev').onclick = () => prev(); $('#b-next').onclick = () => next();
|
|
841
971
|
$('#b-save').onclick = () => saveCurrent();
|
|
842
972
|
document.addEventListener('click', e => {
|
|
843
|
-
const b = e.target.closest('[data-act],[data-size],[data-skin]'); if (!b) return;
|
|
973
|
+
const b = e.target.closest('[data-act],[data-size],[data-skin],[data-quiz]'); if (!b) return;
|
|
974
|
+
if (b.dataset.quiz) return quizReveal(W.quiz.choices[+b.dataset.quiz]);
|
|
844
975
|
if (b.dataset.size) { size = b.dataset.size; $$('[data-size]').forEach(x => x.setAttribute('aria-pressed', x.dataset.size === size)); return; }
|
|
845
976
|
if (b.dataset.skin) { setSkin(b.dataset.skin); return; }
|
|
846
977
|
const a = b.dataset.act;
|
|
@@ -862,6 +993,7 @@ addEventListener('keydown', e => {
|
|
|
862
993
|
if (k === 's') return $('#wall').hidden ? saveCurrent() : save('wall');
|
|
863
994
|
if (k === 'r') return $('#report').scrollIntoView({ behavior: reduced() ? 'auto' : 'smooth' });
|
|
864
995
|
if (!inStory || !$('#wall').hidden) return;
|
|
996
|
+
if (list[cur]?.key === 'quiz' && W.quiz.choices[+k - 1] != null && +k <= 3) return quizReveal(W.quiz.choices[+k - 1]);
|
|
865
997
|
if (k === 'ArrowRight' || k === ' ' || k === 'l') { e.preventDefault(); next(); }
|
|
866
998
|
else if (k === 'ArrowLeft' || k === 'h') { e.preventDefault(); prev(); }
|
|
867
999
|
else if (k === 'p' || k === 'k') setPause('user', !why.has('user'));
|
|
@@ -898,21 +1030,19 @@ function fontsFor(css) {
|
|
|
898
1030
|
}
|
|
899
1031
|
function vars() {
|
|
900
1032
|
const cs = getComputedStyle(document.documentElement);
|
|
901
|
-
return ['paper', 'body', ...TOKENS].map(t => `--${t}:${cs.getPropertyValue('--' + t).trim()}`).filter(s => !/:$/.test(s)).join(';');
|
|
1033
|
+
return ['paper', 'body', 'lgc', 'mkc', 'lit', ...TOKENS].map(t => `--${t}:${cs.getPropertyValue('--' + t).trim()}`).filter(s => !/:$/.test(s)).join(';');
|
|
902
1034
|
}
|
|
903
1035
|
function buildSVG(key, sz = size) {
|
|
904
1036
|
const [w, h] = SIZES[sz] || sz, lw = Math.round(1920 * w / h), lh = 1920;
|
|
905
1037
|
const host = $('#host'); host.style.width = lw + 'px'; host.style.height = lh + 'px';
|
|
906
|
-
host.innerHTML = slideHTML(key);
|
|
1038
|
+
STILL = true; try { host.innerHTML = slideHTML(key); } finally { STILL = false; }
|
|
907
1039
|
const el = host.firstElementChild; el.classList.add('x');
|
|
908
1040
|
fit(el);
|
|
909
1041
|
const v = vars(), css = $('#aw-css').textContent;
|
|
910
1042
|
const fonts = fontsFor(getComputedStyle(document.documentElement).getPropertyValue('--fd') + ',' + getComputedStyle(document.documentElement).getPropertyValue('--fm') + ',"JetBrains Mono"');
|
|
911
1043
|
const xhtml = new XMLSerializer().serializeToString(el);
|
|
912
1044
|
host.innerHTML = '';
|
|
913
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${lw} ${lh}"><foreignObject x="0" y="0" width="${lw}" height="${lh}"><div xmlns="http://www.w3.org/1999/xhtml" style="position:relative;width:${lw}px;height:${lh}px;${esc(v)}"><style><![CDATA[${fonts}\n${css}]]
|
|
914
|
-
html.embed,html.embed body{overflow:hidden;height:100%}html.embed #report,html.embed [data-a="report"]{display:none!important}
|
|
915
|
-
</style>${xhtml}</div></foreignObject></svg>`;
|
|
1045
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${lw} ${lh}"><foreignObject x="0" y="0" width="${lw}" height="${lh}"><div xmlns="http://www.w3.org/1999/xhtml" style="position:relative;width:${lw}px;height:${lh}px;${esc(v)}"><style><![CDATA[${fonts}\n${css}]]></style>${xhtml}</div></foreignObject></svg>`;
|
|
916
1046
|
return { svg, w, h };
|
|
917
1047
|
}
|
|
918
1048
|
async function exportPNG(key, sz = size) {
|
|
@@ -930,7 +1060,7 @@ function download(blob, name) {
|
|
|
930
1060
|
const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = name;
|
|
931
1061
|
document.body.appendChild(a); a.click(); a.remove(); setTimeout(() => URL.revokeObjectURL(a.href), 5000);
|
|
932
1062
|
}
|
|
933
|
-
const CAPTION = () => `my ${W.year || ''} with AI agents 🫠
|
|
1063
|
+
const CAPTION = () => `my ${W.year || ''} with AI agents 🫠 wrap yours: ${INSTALL}`;
|
|
934
1064
|
async function copyCaption() {
|
|
935
1065
|
try { await navigator.clipboard.writeText(CAPTION()); return true; }
|
|
936
1066
|
catch (e) { const t = document.createElement('textarea'); t.value = CAPTION(); t.style.cssText = 'position:fixed;opacity:0'; document.body.appendChild(t); t.select(); let ok = false; try { ok = document.execCommand('copy'); } catch (_) { } t.remove(); return ok; }
|
package/src/cli.mjs
CHANGED
|
@@ -23,6 +23,8 @@ usage: npx wrapped-agents [options]
|
|
|
23
23
|
--json build wrapped.json only and print its path (for agents)
|
|
24
24
|
--from <file> render from an existing wrapped.json instead of reading logs
|
|
25
25
|
--roast "<line>" your agent's roast (≤ 12 words, numbers from this wrap)
|
|
26
|
+
--quip "<line>" your agent's funny line for the tokens slide (numbers from compare.options)
|
|
27
|
+
--day "<line>" your agent's guess at what happened on your busiest day
|
|
26
28
|
--roast-by <name> who wrote it, e.g. "Claude Code" (shown under the roast)
|
|
27
29
|
--no-roast no roast slide
|
|
28
30
|
--show-projects show project names (hidden by default)
|
|
@@ -44,6 +46,8 @@ function args(argv) {
|
|
|
44
46
|
else if (k === '--roast') a.roast = v();
|
|
45
47
|
else if (k === '--no-roast') a.roast = '';
|
|
46
48
|
else if (k === '--roast-by') a.roastBy = v();
|
|
49
|
+
else if (k === '--quip') a.quip = v();
|
|
50
|
+
else if (k === '--day') a.day = v();
|
|
47
51
|
else if (k === '--show-projects') a.showProjects = true;
|
|
48
52
|
else if (k === '--no-git') a.git = false;
|
|
49
53
|
else if (k === '--no-open') a.open = false;
|
|
@@ -66,11 +70,11 @@ function openFile(file) {
|
|
|
66
70
|
try { spawn(cmd[0], cmd[1], { detached: true, stdio: 'ignore' }).unref(); return true; } catch { return false; }
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
function cleanRoast(s) {
|
|
73
|
+
function cleanRoast(s, max = 14) {
|
|
70
74
|
const r = String(s || '').replace(/\s+/g, ' ').trim();
|
|
71
75
|
if (!r) return null;
|
|
72
76
|
const words = r.split(' ');
|
|
73
|
-
return words.length >
|
|
77
|
+
return words.length > max ? words.slice(0, max).join(' ') + '…' : r;
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
async function main() {
|
|
@@ -99,6 +103,7 @@ async function main() {
|
|
|
99
103
|
log(` done in ${((Date.now() - t0) / 1000).toFixed(1)} s`);
|
|
100
104
|
}
|
|
101
105
|
|
|
106
|
+
delete wrapped.letter; // retired: no agent letter slide
|
|
102
107
|
if (a.handle) wrapped.handle = { ...(wrapped.handle || {}), github: a.handle, display: a.handle };
|
|
103
108
|
if (a.skin) wrapped.theme = { ...(wrapped.theme || {}), skin: a.skin };
|
|
104
109
|
if (a.roast !== undefined) {
|
|
@@ -107,6 +112,17 @@ async function main() {
|
|
|
107
112
|
// every number in the roast must exist in this wrap (agents sometimes reuse numbers from an older run)
|
|
108
113
|
if (wrapped.roast && !roastNumbersOk(wrapped, wrapped.roast)) log(`warning: the roast cites numbers that aren't in this wrap; please re-write it from wrapped-${wrapped.year}.json`);
|
|
109
114
|
}
|
|
115
|
+
if (a.quip !== undefined && wrapped.compare) {
|
|
116
|
+
const q = cleanRoast(a.quip, 18);
|
|
117
|
+
if (q && !roastNumbersOk(wrapped, q)) log(`warning: the quip cites numbers that aren't in this wrap (use compare.options); please re-write it`);
|
|
118
|
+
if (q) { wrapped.compare.text = q; wrapped.compare.by = a.roastBy || 'your agent'; }
|
|
119
|
+
}
|
|
120
|
+
for (const [key, val, max] of [['dayLine', a.day, 20]]) {
|
|
121
|
+
if (val === undefined) continue;
|
|
122
|
+
const t = String(val).replace(/\s+/g, ' ').trim(), words = t.split(' ');
|
|
123
|
+
wrapped[key] = t ? (words.length > max ? words.slice(0, max).join(' ') + '…' : t) : null;
|
|
124
|
+
if (wrapped[key] && !roastNumbersOk(wrapped, wrapped[key])) log(`warning: --${key === 'dayLine' ? 'day' : key} cites numbers that aren't in this wrap; please re-write it`);
|
|
125
|
+
}
|
|
110
126
|
if (a.showProjects) wrapped.privacy = { ...(wrapped.privacy || {}), projectsHidden: false };
|
|
111
127
|
|
|
112
128
|
fs.mkdirSync(a.out, { recursive: true });
|
package/src/stats/awards.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// An award whose data is unknown (null) is omitted, never invented.
|
|
3
3
|
|
|
4
4
|
export const AWARD_IDS = ['harness', 'model', 'tokens', 'spendings', 'prompts', 'sessions', 'streak', 'marathon', 'swarm',
|
|
5
|
-
'peakHour', 'politeness', 'backseat', 'lines', 'mostResumed', 'wordOfYear', 'agentClass', 'tier', 'skill', 'rateLimits',
|
|
5
|
+
'peakHour', 'politeness', 'backseat', 'lines', 'mostResumed', 'wordOfYear', 'agentClass', 'tier', 'skill', 'tool', 'rateLimits',
|
|
6
6
|
'age', 'twin', 'youreRight', 'modelRace', 'caps', 'screenshots', 'compactions', 'prs', 'ctrlZ', 'roast'];
|
|
7
7
|
|
|
8
8
|
export const num = n => Math.round(n).toLocaleString('en-US');
|
|
@@ -83,6 +83,11 @@ export function buildAwards(ctx) {
|
|
|
83
83
|
if (sk) add('skill', 'Skill of the Year', sk[0], `${num(sk[1])} runs`, 'skill calls');
|
|
84
84
|
else if (mcp) add('skill', 'Skill of the Year', mcp[0], `${num(mcp[1])} MCP calls`, 'MCP calls');
|
|
85
85
|
|
|
86
|
+
// Tool of the Year
|
|
87
|
+
const tools = mergeTools(m.tools);
|
|
88
|
+
const tl = top(tools);
|
|
89
|
+
if (tl) add('tool', 'Tool of the Year', tl[0], `${num(tl[1])} calls`, 'tool calls, merged across harnesses');
|
|
90
|
+
|
|
86
91
|
if (m.rateLimits) add('rateLimits', 'Rate limits', `${num(m.rateLimits.hits)} hit${m.rateLimits.hits === 1 ? '' : 's'}`,
|
|
87
92
|
m.rateLimits.days ? `on ${m.rateLimits.days}+ days` : '', 'limit messages');
|
|
88
93
|
|
|
@@ -130,3 +135,9 @@ function top(map) {
|
|
|
130
135
|
for (const [k, v] of Object.entries(map)) if (v > 0 && (!best || v > best[1])) best = [k, v];
|
|
131
136
|
return best;
|
|
132
137
|
}
|
|
138
|
+
|
|
139
|
+
// same tool under different harness names counts once (Bash / exec / bash / run_shell_command …)
|
|
140
|
+
const TOOL = { bash: 'Bash', exec: 'Bash', shell: 'Bash', local_shell: 'Bash', run_shell_command: 'Bash', exec_command: 'Bash', terminal: 'Bash',
|
|
141
|
+
read: 'Read', read_file: 'Read', view: 'Read', edit: 'Edit', multiedit: 'Edit', str_replace: 'Edit', apply_patch: 'Edit', replace: 'Edit', write: 'Write', write_file: 'Write',
|
|
142
|
+
grep: 'Grep', search: 'Grep', glob: 'Glob', websearch: 'WebSearch', web_search: 'WebSearch', webfetch: 'WebFetch', web_fetch: 'WebFetch', agent: 'Agent', task: 'Agent', spawn_agent: 'Agent', send_message: 'SendMessage', sendmessage: 'SendMessage', todowrite: 'TodoWrite', todo_write: 'TodoWrite' };
|
|
143
|
+
export function mergeTools(t) { const out = {}; for (const [k, v] of Object.entries(t || {})) { const n = TOOL[k.toLowerCase()] || k; out[n] = (out[n] || 0) + v; } return out; }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Facts for the tokens slide's comparison line. The joke itself is written by the user's own agent (SKILL.md, --quip);
|
|
2
|
+
// without an agent the page shows a plain factual line. Compares only what was read + written (input + output), never cache.
|
|
3
|
+
// Token counts ≈ words × 1.33 (English prose, modern BPE tokenizers); words from public word counts.
|
|
4
|
+
export const WORKS = [
|
|
5
|
+
['Pride and Prejudice', 122_000], ['The Great Gatsby', 47_000], ['Moby-Dick', 210_000], ['Dune', 188_000],
|
|
6
|
+
['War and Peace', 587_000], ['The Lord of the Rings', 481_000], ['every Harry Potter book', 1_084_000],
|
|
7
|
+
['the complete works of Shakespeare', 884_000], ['the King James Bible', 783_000], ['The Hobbit', 95_000],
|
|
8
|
+
['Frankenstein', 75_000], ['Crime and Punishment', 211_000], ['Don Quixote', 430_000], ['Ulysses', 265_000],
|
|
9
|
+
['The Odyssey', 134_000], ['A Game of Thrones', 298_000], ['Les Misérables', 545_000], ['Alice in Wonderland', 27_000],
|
|
10
|
+
['The Hitchhiker’s Guide to the Galaxy', 46_000], ['1984', 89_000], ['English Wikipedia', 4_900_000_000],
|
|
11
|
+
].map(([name, words]) => ({ name, tokens: Math.round(words * 1.33) }));
|
|
12
|
+
|
|
13
|
+
const fmt = x => x >= 100 ? Math.round(x).toLocaleString('en-US') : x >= 10 ? x.toFixed(0) : x.toFixed(1);
|
|
14
|
+
|
|
15
|
+
/** up to 6 random works whose multiple reads well (3×–200k×), plus a plain factual default line; rnd injectable */
|
|
16
|
+
export function tokenComparison(ioTokens, rnd = Math.random) {
|
|
17
|
+
if (!ioTokens) return null;
|
|
18
|
+
const fits = WORKS.filter(w => { const x = ioTokens / w.tokens; return x >= 3 && x <= 200_000; });
|
|
19
|
+
const pool = (fits.length ? fits : WORKS).slice();
|
|
20
|
+
for (let i = pool.length - 1; i > 0; i--) { const j = Math.floor(rnd() * (i + 1)); [pool[i], pool[j]] = [pool[j], pool[i]]; }
|
|
21
|
+
const options = pool.slice(0, 6).map(w => ({ work: w.name, times: fmt(+(ioTokens / w.tokens).toPrecision(2)) }));
|
|
22
|
+
const o = options[0];
|
|
23
|
+
return { ioTokens, options, text: `That’s ${o.work}, ${o.times} times.`, by: null };
|
|
24
|
+
}
|
package/src/stats/index.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { tokenComparison } from './compare.mjs';
|
|
2
|
+
import { mergeTools } from './awards.mjs';
|
|
1
3
|
// Stats engine: HarnessFacts[] (+ optional Extras) → Wrapped (CONTRACT §4). Pure: no I/O, no network.
|
|
2
4
|
import { spendings, normalizeModel, modelLabel, PRICES } from './spendings.mjs';
|
|
3
5
|
import { tierFor } from './tiers.mjs';
|
|
@@ -154,12 +156,13 @@ export function buildWrapped(facts, { year, extras = null, handle = null, now =
|
|
|
154
156
|
const modelIds = Object.keys(m.models);
|
|
155
157
|
const tokens = facts.some(f => f.models) ? modelIds.reduce((a, id) => a + tokSum(m.models[id]), 0) : null;
|
|
156
158
|
const cacheRead = modelIds.reduce((a, id) => a + (m.models[id].cacheRead || 0), 0);
|
|
159
|
+
const io = modelIds.reduce((a, id) => a + (m.models[id].input || 0) + (m.models[id].output || 0), 0);
|
|
157
160
|
// readers report toolCalls incl. counts from before tool names exist (e.g. Claude Code stats-cache); fall back to summing names
|
|
158
161
|
const toolCalls = facts.some(f => f.toolCalls) ? facts.reduce((a, f) => a + (f.toolCalls || (f.tools ? Object.values(f.tools).reduce((x, y) => x + y, 0) : 0)), 0) : (m.tools ? Object.values(m.tools).reduce((a, b) => a + b, 0) : null);
|
|
159
162
|
const totals = {
|
|
160
163
|
prompts: m.prompts, sessions: m.sessions, activeDays: activeDates.length,
|
|
161
164
|
streak: { days: streak.days, from: streak.from, to: streak.to },
|
|
162
|
-
tokens, cacheShare: tokens ? r2(cacheRead / tokens) : null,
|
|
165
|
+
tokens, ioTokens: io || null, cacheShare: tokens ? r2(cacheRead / tokens) : null,
|
|
163
166
|
toolCalls, subagents: m.subagents,
|
|
164
167
|
};
|
|
165
168
|
|
|
@@ -182,8 +185,24 @@ export function buildWrapped(facts, { year, extras = null, handle = null, now =
|
|
|
182
185
|
};
|
|
183
186
|
const raceWinners = raceWinnersOf(series.race);
|
|
184
187
|
|
|
188
|
+
// story extras: busiest day, top 5 lists, "guess your #1 model" quiz
|
|
189
|
+
const dayList = Object.entries(series.days).sort((a, b) => b[1] - a[1]);
|
|
190
|
+
const busiest = dayList.length ? { date: dayList[0][0], prompts: dayList[0][1],
|
|
191
|
+
peakHour: (m.hours || []).indexOf(Math.max(...(m.hours || [0]))) } : null;
|
|
192
|
+
const topN = (o, n = 5) => Object.entries(o || {}).filter(([, v]) => v > 0).sort((a, b) => b[1] - a[1]).slice(0, n);
|
|
193
|
+
const top5 = { tools: topN(mergeTools(m.tools)), skills: topN(m.skills), models: models.slice(0, 5).map(x => [x.label, x.share]) };
|
|
194
|
+
const DECOYS = ['Opus 5.5', 'Sonnet 5.5', 'GPT-6 Astra', 'Gemini 3 Pro', 'Opus 5', 'Devstral 2', 'Qwen3 Coder', 'Haiku 5.5'];
|
|
195
|
+
let quiz = null;
|
|
196
|
+
if (models.length) {
|
|
197
|
+
const answer = models[0].label;
|
|
198
|
+
const pool = [...models.slice(1, 3).map(x => x.label), ...DECOYS].filter((x, i, a) => x !== answer && a.indexOf(x) === i);
|
|
199
|
+
const choices = [answer, ...pool.slice(0, 2)];
|
|
200
|
+
for (let i = choices.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [choices[i], choices[j]] = [choices[j], choices[i]]; }
|
|
201
|
+
quiz = { question: 'Which model did you use most?', choices, answer, share: models[0].share };
|
|
202
|
+
}
|
|
203
|
+
|
|
185
204
|
// tier, age, twin
|
|
186
|
-
const tier = tierFor(m.prompts, totals.activeDays);
|
|
205
|
+
const tier = tierFor(m.prompts, totals.activeDays, totals.tokens);
|
|
187
206
|
const hTot = m.hours ? m.hours.reduce((a, b) => a + b, 0) : 0;
|
|
188
207
|
const wTot = m.weekdays ? m.weekdays.reduce((a, b) => a + b, 0) : 0;
|
|
189
208
|
const shares = {
|
|
@@ -196,7 +215,7 @@ export function buildWrapped(facts, { year, extras = null, handle = null, now =
|
|
|
196
215
|
const ageR = m.prompts ? agenticAge({ ...shares, streakDays: streak.days }) : null;
|
|
197
216
|
const coAuthored = extras && extras.commits ? Object.values(extras.commits.coAuthored || {}).reduce((a, b) => a + b, 0) : null;
|
|
198
217
|
const twin = m.prompts ? agentTwin({
|
|
199
|
-
...shares, agentClass: tier.power,
|
|
218
|
+
...shares, agentClass: tier.power, topTier: tier.top === 1,
|
|
200
219
|
subagentsPerSession: m.subagents != null && m.sessions ? m.subagents / m.sessions : null,
|
|
201
220
|
longestActiveHours: m.longest ? m.longest.activeHours : null,
|
|
202
221
|
harnessShares: harnesses.map(h => h.share), coAuthoredCommits: coAuthored,
|
|
@@ -208,6 +227,8 @@ export function buildWrapped(facts, { year, extras = null, handle = null, now =
|
|
|
208
227
|
|
|
209
228
|
const w = {
|
|
210
229
|
schema: 1, year, generatedAt: now.toISOString(),
|
|
230
|
+
compare: tokenComparison(totals.ioTokens),
|
|
231
|
+
busiest, top5, quiz, dayLine: null,
|
|
211
232
|
handle: h,
|
|
212
233
|
coverage: facts.map(f => ({ harness: f.harness, label: f.label, from: f.coverage?.from ?? null, to: f.coverage?.to ?? null, notes: f.coverage?.notes || [] })),
|
|
213
234
|
theme: pickTheme(top),
|
package/src/stats/roast.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The roast is written by the user's own agent (see SKILL.md). We only check it cites numbers that exist in this wrap.
|
|
2
2
|
export function roastNumbersOk(w, roast) {
|
|
3
|
-
const hay = JSON.stringify(w.awards || []) + JSON.stringify(w.totals || {});
|
|
3
|
+
const hay = JSON.stringify(w.awards || []) + JSON.stringify(w.totals || {}) + JSON.stringify(w.compare?.options || []) + JSON.stringify(w.busiest || {}) + JSON.stringify(w.top5 || {});
|
|
4
4
|
const nums = String(roast || '').match(/\d[\d,.]*/g) || [];
|
|
5
5
|
return nums.every(n => { const t = n.replace(/[.,]$/, ''); return hay.includes(t) || hay.includes(t.replace(/[,.]/g, '')); });
|
|
6
6
|
}
|
package/src/stats/tiers.mjs
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
// Top X%: fixed tiers on score = prompts × active days (spec §16). Thresholds are published, not percentiles.
|
|
2
2
|
export const TIERS = [
|
|
3
|
-
{ top: 1, min: 1_000_000, power: '
|
|
4
|
-
{ top: 5, min: 300_000, power: '
|
|
5
|
-
{ top: 10, min: 100_000, power: '
|
|
6
|
-
{ top: 25, min: 20_000, power: '
|
|
7
|
-
{ top: 50, min: 3_000, power: '
|
|
8
|
-
{ top: 80, min: 0, power: '
|
|
3
|
+
{ top: 1, min: 1_000_000, power: 'Tokenmaxxer', line: 'Limits are a suggestion.' },
|
|
4
|
+
{ top: 5, min: 300_000, power: 'Vibe Engineer', line: 'Vibes, but with tests.' },
|
|
5
|
+
{ top: 10, min: 100_000, power: 'Cracked Vibecoder', line: 'Ships first, reads the diff later.' },
|
|
6
|
+
{ top: 25, min: 20_000, power: 'Vibecoder', line: 'Accept all. Pray.' },
|
|
7
|
+
{ top: 50, min: 3_000, power: 'Prompt Enjoyer', line: 'Two heads, one keyboard.' },
|
|
8
|
+
{ top: 80, min: 0, power: 'Vibe Tourist', line: 'Just here for the vibes.' },
|
|
9
9
|
];
|
|
10
|
+
// past this many tokens (all of them, cache included) the class is the meme itself
|
|
11
|
+
export const UNLIMITED = { tokens: 200_000_000_000, power: 'Unlimited Tokens', line: 'Rate limits fear you.' };
|
|
10
12
|
|
|
11
13
|
/** → { score, top, label, power } (line is extra, used by the agentClass award, not in wrapped.tier) */
|
|
12
|
-
export function tierFor(prompts, activeDays) {
|
|
14
|
+
export function tierFor(prompts, activeDays, tokens = 0) {
|
|
13
15
|
const score = Math.max(0, Math.round((prompts || 0) * (activeDays || 0)));
|
|
14
16
|
const t = TIERS.find(t => score >= t.min);
|
|
15
|
-
|
|
17
|
+
const c = tokens >= UNLIMITED.tokens ? UNLIMITED : t;
|
|
18
|
+
return { score, top: t.top, label: `Top ${t.top}%`, power: c.power, line: c.line };
|
|
16
19
|
}
|
package/src/stats/twin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Agent Twin (spec §17, draft archetypes). First match wins; Swarm Conductor is skipped when the
|
|
2
|
-
// agent class
|
|
2
|
+
// agent class is already top tier.
|
|
3
3
|
// Match % = 60 + 10 × (value − threshold) / threshold, rounded, capped at 99 (Tinkerer = 60).
|
|
4
4
|
// Owner 2026: The Marathoner, 60 + 10 × (197.85 − 48) / 48 = 91.2 → 91.
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ const pct = x => Math.round(x * 100);
|
|
|
8
8
|
const match = (v, t) => Math.min(99, Math.max(60, Math.round(60 + 10 * (v - t) / t)));
|
|
9
9
|
|
|
10
10
|
export const ARCHETYPES = [
|
|
11
|
-
{ name: 'The Swarm Conductor', test: p => !/swarm/i.test(p.agentClass || '') && p.subagentsPerSession != null && p.subagentsPerSession > 2,
|
|
11
|
+
{ name: 'The Swarm Conductor', test: p => !p.topTier && !/swarm/i.test(p.agentClass || '') && p.subagentsPerSession != null && p.subagentsPerSession > 2,
|
|
12
12
|
match: p => match(p.subagentsPerSession, 2), why: p => `${p.subagentsPerSession.toFixed(1)} subagents per session` },
|
|
13
13
|
{ name: 'The Night Architect', test: p => p.lateShare != null && p.lateShare > 0.30,
|
|
14
14
|
match: p => match(p.lateShare, 0.30), why: p => `${pct(p.lateShare)}% after 22:00` },
|