@shadevkumar/agent-wrapped 0.2.0 → 0.4.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/README.md +12 -6
- package/dist/build.js +21 -4
- package/dist/chapters.js +46 -0
- package/dist/claude-cli.js +27 -0
- package/dist/cli.js +65 -21
- package/dist/files.js +37 -0
- package/dist/letter.js +10 -20
- package/dist/moments.js +121 -8
- package/dist/personality.js +12 -2
- package/dist/read-worker.js +18 -0
- package/dist/screen.js +78 -0
- package/dist/sources/claude.js +4 -4
- package/dist/sources/codex.js +40 -13
- package/dist/sources/cursor.js +81 -0
- package/dist/story/index.html +15 -10
- package/dist/story/link.d.ts +4 -0
- package/dist/story/link.js +54 -0
- package/dist/story/story.js +830 -120
- package/dist/story.js +22 -3
- package/dist/types.js +25 -9
- package/dist/words.js +23 -1
- package/package.json +5 -1
package/dist/screen.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { emitKeypressEvents } from "node:readline";
|
|
2
|
+
// What the command shows while it runs, on stderr, so --json output stays
|
|
3
|
+
// clean. In a terminal each step updates in place; piped, it prints plain lines.
|
|
4
|
+
const out = process.stderr;
|
|
5
|
+
const live = out.isTTY === true;
|
|
6
|
+
const color = live && !process.env.NO_COLOR;
|
|
7
|
+
const paint = (code) => (s) => (color ? `\x1b[${code}m${s}\x1b[0m` : s);
|
|
8
|
+
export const dim = paint("2");
|
|
9
|
+
export const bold = paint("1");
|
|
10
|
+
const green = paint("32");
|
|
11
|
+
export function line(text = "") {
|
|
12
|
+
out.write(`${text}\n`);
|
|
13
|
+
}
|
|
14
|
+
function redraw(text) {
|
|
15
|
+
if (live)
|
|
16
|
+
out.write(`\r\x1b[2K${text}`);
|
|
17
|
+
}
|
|
18
|
+
const FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
19
|
+
// Shows `doing` while `work` runs (with a spinner when the work lets the
|
|
20
|
+
// screen redraw), then a tick and what was done.
|
|
21
|
+
export async function step(doing, work, done) {
|
|
22
|
+
const started = Date.now();
|
|
23
|
+
let frame = 0;
|
|
24
|
+
redraw(` ${dim(FRAMES[0])} ${doing}`);
|
|
25
|
+
const spin = live ? setInterval(() => redraw(` ${dim(FRAMES[++frame % FRAMES.length])} ${doing}`), 80) : undefined;
|
|
26
|
+
// Let the first frame draw before work that holds the process.
|
|
27
|
+
await new Promise((r) => setImmediate(r));
|
|
28
|
+
try {
|
|
29
|
+
const result = await work();
|
|
30
|
+
const seconds = (Date.now() - started) / 1000;
|
|
31
|
+
const text = ` ${green("✓")} ${done(result)}${seconds >= 2 ? dim(` ${seconds.toFixed(0)}s`) : ""}`;
|
|
32
|
+
if (live)
|
|
33
|
+
redraw(`${text}\n`);
|
|
34
|
+
else
|
|
35
|
+
line(text);
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
clearInterval(spin);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// A choice made with the arrow keys and Enter. Without a terminal to ask in,
|
|
43
|
+
// the first option is the answer.
|
|
44
|
+
export async function choose(question, options) {
|
|
45
|
+
const input = process.stdin;
|
|
46
|
+
if (!live || !input.isTTY)
|
|
47
|
+
return options[0].value;
|
|
48
|
+
let at = 0;
|
|
49
|
+
const draw = () => redraw(` ${bold("?")} ${question} ${options.map((o, i) => (i === at ? bold(`❯ ${o.label}`) : dim(` ${o.label}`))).join(" ")} ${dim("← → Enter")}`);
|
|
50
|
+
emitKeypressEvents(input);
|
|
51
|
+
input.setRawMode(true);
|
|
52
|
+
input.resume();
|
|
53
|
+
draw();
|
|
54
|
+
const value = await new Promise((resolve) => {
|
|
55
|
+
const onKey = (_, key) => {
|
|
56
|
+
if (key.ctrl && key.name === "c") {
|
|
57
|
+
input.setRawMode(false);
|
|
58
|
+
line();
|
|
59
|
+
process.exit(130);
|
|
60
|
+
}
|
|
61
|
+
if (["left", "up"].includes(key.name ?? ""))
|
|
62
|
+
at = (at + options.length - 1) % options.length;
|
|
63
|
+
else if (["right", "down", "tab"].includes(key.name ?? ""))
|
|
64
|
+
at = (at + 1) % options.length;
|
|
65
|
+
else if (key.name === "return") {
|
|
66
|
+
input.off("keypress", onKey);
|
|
67
|
+
resolve(options[at].value);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
draw();
|
|
71
|
+
};
|
|
72
|
+
input.on("keypress", onKey);
|
|
73
|
+
});
|
|
74
|
+
input.setRawMode(false);
|
|
75
|
+
input.pause();
|
|
76
|
+
redraw(` ${green("✓")} ${question} ${dim(options[at].label)}\n`);
|
|
77
|
+
return value;
|
|
78
|
+
}
|
package/dist/sources/claude.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extname, join } from "node:path";
|
|
2
2
|
import { coverage, findFiles, localDay, namesFromPath, readJson, readJsonl, toDate } from "../files.js";
|
|
3
|
-
import {
|
|
3
|
+
import { commandKinds, emptyHarvest } from "../types.js";
|
|
4
4
|
// Claude Code keeps three things in ~/.claude:
|
|
5
5
|
// - history.jsonl: every prompt typed, kept long term
|
|
6
6
|
// - stats-cache.json: older token totals per model, up to `lastComputedDate`
|
|
@@ -115,9 +115,9 @@ function actionsIn(row) {
|
|
|
115
115
|
const path = b.input?.file_path ?? b.input?.notebook_path;
|
|
116
116
|
if (EDIT_TOOLS.has(b.name) && typeof path === "string")
|
|
117
117
|
out.push([b.id, { kind: "edit", ext: extname(path).toLowerCase() }]);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
if (b.name === "Bash")
|
|
119
|
+
for (const kind of commandKinds(String(b.input?.command ?? "")))
|
|
120
|
+
out.push([`${b.id}|${kind}`, { kind }]);
|
|
121
121
|
}
|
|
122
122
|
return out;
|
|
123
123
|
}
|
package/dist/sources/codex.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync, readdirSync } from "node:fs";
|
|
2
2
|
import { extname, join } from "node:path";
|
|
3
3
|
import { DatabaseSync } from "node:sqlite";
|
|
4
|
-
import { coverage, lastJsonLine, namesFromGitUrl, namesFromPath, toDate } from "../files.js";
|
|
5
|
-
import {
|
|
4
|
+
import { coverage, firstJsonLine, lastJsonLine, namesFromGitUrl, namesFromPath, toDate } from "../files.js";
|
|
5
|
+
import { commandKinds, emptyHarvest } from "../types.js";
|
|
6
6
|
// Codex keeps, in ~/.codex:
|
|
7
7
|
// - state_N.sqlite `threads`: one row per thread, with its token total
|
|
8
8
|
// - thread_history_N.sqlite: every message and turn, kept long term
|
|
@@ -13,6 +13,7 @@ export function harvestCodex(home) {
|
|
|
13
13
|
const root = join(home, ".codex");
|
|
14
14
|
const h = emptyHarvest();
|
|
15
15
|
const human = new Map(); // thread id -> started by a person
|
|
16
|
+
const forks = forkedThreads(root);
|
|
16
17
|
const state = openLatest(root, "state");
|
|
17
18
|
if (state) {
|
|
18
19
|
try {
|
|
@@ -37,7 +38,7 @@ export function harvestCodex(home) {
|
|
|
37
38
|
if (split) {
|
|
38
39
|
h.usage.push({ agent: "codex", model, at, ...split });
|
|
39
40
|
}
|
|
40
|
-
else if (Number(t.tokens_used) > 0) {
|
|
41
|
+
else if (Number(t.tokens_used) > 0 && !forks.has(t.id)) {
|
|
41
42
|
h.totals.push({ agent: "codex", model, at, tokens: Number(t.tokens_used) });
|
|
42
43
|
}
|
|
43
44
|
}
|
|
@@ -110,8 +111,7 @@ export function harvestCodex(home) {
|
|
|
110
111
|
h.actions.push({ agent: "codex", at, kind: "edit", ext: extname(path).toLowerCase() });
|
|
111
112
|
}
|
|
112
113
|
else {
|
|
113
|
-
const kind
|
|
114
|
-
if (kind)
|
|
114
|
+
for (const kind of commandKinds(firstString(item.head, "command") ?? ""))
|
|
115
115
|
h.actions.push({ agent: "codex", at, kind });
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -161,21 +161,48 @@ function messageText(json) {
|
|
|
161
161
|
return "";
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
//
|
|
164
|
+
// A forked or resumed thread's running total starts from the total of the
|
|
165
|
+
// thread it came from, which is already counted there. Its own tokens are
|
|
166
|
+
// its final total less what it started with, before its first turn.
|
|
165
167
|
function rolloutUsage(path) {
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
if (!
|
|
168
|
+
const isCount = (r) => r.type === "event_msg" && r.payload?.type === "token_count" && !!r.payload.info?.total_token_usage;
|
|
169
|
+
const last = lastJsonLine(path, '"token_count"', isCount)?.payload.info;
|
|
170
|
+
if (!last)
|
|
169
171
|
return null;
|
|
170
|
-
const
|
|
172
|
+
const first = firstJsonLine(path, '"token_count"', isCount)?.payload.info;
|
|
173
|
+
// `input_tokens` includes cached tokens.
|
|
174
|
+
const own = (key) => (last.total_token_usage[key] ?? 0) - (first.total_token_usage[key] ?? 0) + (first.last_token_usage?.[key] ?? first.total_token_usage[key] ?? 0);
|
|
175
|
+
const cached = own("cached_input_tokens");
|
|
171
176
|
return {
|
|
172
|
-
input: (
|
|
177
|
+
input: own("input_tokens") - cached,
|
|
173
178
|
cacheRead: cached,
|
|
174
|
-
cacheWrite:
|
|
179
|
+
cacheWrite: own("cache_write_input_tokens"),
|
|
175
180
|
cacheWrite1h: 0,
|
|
176
|
-
output:
|
|
181
|
+
output: own("output_tokens"),
|
|
177
182
|
};
|
|
178
183
|
}
|
|
184
|
+
// Threads forked from another, whose log starts with the other thread's
|
|
185
|
+
// history (their first item sits far into it). Their totals include the
|
|
186
|
+
// other thread's tokens, with no way left to tell how many, so a thread
|
|
187
|
+
// known only by its total is left unpriced: the cost stays a floor.
|
|
188
|
+
const FORKED_AFTER_ORDINAL = 100;
|
|
189
|
+
function forkedThreads(root) {
|
|
190
|
+
const history = openLatest(root, "thread_history");
|
|
191
|
+
if (!history)
|
|
192
|
+
return new Set();
|
|
193
|
+
try {
|
|
194
|
+
const rows = history
|
|
195
|
+
.prepare("select thread_id from thread_items group by thread_id having min(rollout_ordinal) > ?")
|
|
196
|
+
.all(FORKED_AFTER_ORDINAL);
|
|
197
|
+
return new Set(rows.map((r) => String(r.thread_id)));
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
return new Set();
|
|
201
|
+
}
|
|
202
|
+
finally {
|
|
203
|
+
history.close();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
179
206
|
// Codex numbers its database files (state_5.sqlite); open the newest, read-only.
|
|
180
207
|
function openLatest(root, prefix) {
|
|
181
208
|
if (!existsSync(root))
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { readdirSync } from "node:fs";
|
|
2
|
+
import { extname, join } from "node:path";
|
|
3
|
+
import { coverage, readJsonl, toDate } from "../files.js";
|
|
4
|
+
import { commandKinds, emptyHarvest } from "../types.js";
|
|
5
|
+
// Cursor's agent keeps one transcript per chat in
|
|
6
|
+
// ~/.cursor/projects/<folder>/agent-transcripts/<chat>/<chat>.jsonl. A line is
|
|
7
|
+
// a user or assistant message; only the person's lines carry a time, written
|
|
8
|
+
// into the text as <timestamp>, with what they typed in <user_query>. Lines
|
|
9
|
+
// without both are instructions Cursor added itself. The same chat can be
|
|
10
|
+
// saved under two folders, so each prompt and action counts once.
|
|
11
|
+
export function harvestCursor(home) {
|
|
12
|
+
const root = join(home, ".cursor", "projects");
|
|
13
|
+
const h = emptyHarvest();
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
for (const folder of list(root)) {
|
|
16
|
+
// The folder is the project path with dashes ("Users-me-acme-portal").
|
|
17
|
+
h.privateNames.add(folder.toLowerCase());
|
|
18
|
+
for (const chat of list(join(root, folder, "agent-transcripts"))) {
|
|
19
|
+
let at = null; // the person's latest prompt, the time of what follows
|
|
20
|
+
let step = 0;
|
|
21
|
+
for (const row of readJsonl(join(root, folder, "agent-transcripts", chat, `${chat}.jsonl`))) {
|
|
22
|
+
const content = Array.isArray(row.message?.content) ? row.message.content : [];
|
|
23
|
+
if (row.role === "user") {
|
|
24
|
+
const prompt = parsePrompt(content.map((b) => b?.text ?? "").join(""));
|
|
25
|
+
if (!prompt)
|
|
26
|
+
continue;
|
|
27
|
+
at = prompt.at;
|
|
28
|
+
step = 0;
|
|
29
|
+
const id = `${chat}|${at.getTime()}|${prompt.text}`;
|
|
30
|
+
if (seen.has(id))
|
|
31
|
+
continue;
|
|
32
|
+
seen.add(id);
|
|
33
|
+
h.prompts.push({ agent: "cursor", text: prompt.text, at, session: chat });
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (row.role !== "assistant" || !at)
|
|
37
|
+
continue;
|
|
38
|
+
for (const b of content) {
|
|
39
|
+
if (b?.type !== "tool_use")
|
|
40
|
+
continue;
|
|
41
|
+
const id = `${chat}|${at.getTime()}|${step++}`;
|
|
42
|
+
if (seen.has(id))
|
|
43
|
+
continue;
|
|
44
|
+
seen.add(id);
|
|
45
|
+
const path = b.input?.path;
|
|
46
|
+
if (EDIT_TOOLS.has(b.name) && typeof path === "string")
|
|
47
|
+
h.actions.push({ agent: "cursor", at, kind: "edit", ext: extname(path).toLowerCase() });
|
|
48
|
+
if (b.name === "Shell")
|
|
49
|
+
for (const kind of commandKinds(String(b.input?.command ?? "")))
|
|
50
|
+
h.actions.push({ agent: "cursor", at, kind });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
h.coverage.push(coverage("cursor", "prompts", h.prompts.map((p) => p.at)));
|
|
56
|
+
return h;
|
|
57
|
+
}
|
|
58
|
+
const EDIT_TOOLS = new Set(["StrReplace", "Write", "EditNotebook"]);
|
|
59
|
+
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
60
|
+
// "<timestamp>Friday, Aug 7, 2026, 5:58 PM (UTC+5:30)</timestamp>
|
|
61
|
+
// <user_query>fix it</user_query>" -> the time and "fix it".
|
|
62
|
+
export function parsePrompt(raw) {
|
|
63
|
+
const time = raw.match(/<timestamp>[^<]*?(\w{3}) (\d{1,2}), (\d{4}), (\d{1,2}):(\d{2}) ([AP]M) \(UTC([+-])(\d{1,2})(?::(\d{2}))?\)<\/timestamp>/);
|
|
64
|
+
const query = raw.match(/<user_query>([\s\S]*?)<\/user_query>/);
|
|
65
|
+
const month = MONTHS.indexOf(time?.[1] ?? "");
|
|
66
|
+
const text = query?.[1]?.trim();
|
|
67
|
+
if (!time || !text || month < 0)
|
|
68
|
+
return null;
|
|
69
|
+
const hour = (Number(time[4]) % 12) + (time[6] === "PM" ? 12 : 0);
|
|
70
|
+
const offset = (time[7] === "-" ? -1 : 1) * (Number(time[8]) * 60 + Number(time[9] ?? 0));
|
|
71
|
+
const at = toDate(Date.UTC(Number(time[3]), month, Number(time[2]), hour, Number(time[5])) - offset * 60_000);
|
|
72
|
+
return at ? { at, text } : null;
|
|
73
|
+
}
|
|
74
|
+
function list(dir) {
|
|
75
|
+
try {
|
|
76
|
+
return readdirSync(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith(".")).map((d) => d.name);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
}
|
package/dist/story/index.html
CHANGED
|
@@ -81,6 +81,10 @@ canvas#stage { width: 100%; height: 100%; display: block; touch-action: manipula
|
|
|
81
81
|
.bars i { display: block; height: 100%; width: 0; background: var(--ink); }
|
|
82
82
|
.controls { position: absolute; top: 28px; right: 16px; display: flex; gap: 8px; transition: opacity .5s; }
|
|
83
83
|
.controls button { padding: 9px 12px 10px; font-size: 12px; }
|
|
84
|
+
.controls button.icon { padding: 9px 11px 10px; }
|
|
85
|
+
.icon svg { display: block; width: 12px; height: 12px; fill: currentColor; }
|
|
86
|
+
.icon .tri, .icon[aria-pressed="true"] .bar { display: none; }
|
|
87
|
+
.icon[aria-pressed="true"] .tri { display: inline; }
|
|
84
88
|
.idle .controls { opacity: 0; }
|
|
85
89
|
.idle .controls:focus-within { opacity: 1; }
|
|
86
90
|
|
|
@@ -161,10 +165,9 @@ a.button[hidden] { display: none; }
|
|
|
161
165
|
/* Home: the keys type moments from Shadev's story; everything else stays quiet. */
|
|
162
166
|
#home {
|
|
163
167
|
background: radial-gradient(110% 60% at 50% -10%, rgba(255, 255, 255, 0.07), transparent 65%), var(--page);
|
|
164
|
-
animation: appear .35s ease-out both;
|
|
165
168
|
}
|
|
166
|
-
#home
|
|
167
|
-
|
|
169
|
+
html.home #home[hidden] { display: grid !important; }
|
|
170
|
+
html.home:not(.fonts-in) #home { visibility: hidden; }
|
|
168
171
|
#home > div { max-width: 780px; }
|
|
169
172
|
.typing {
|
|
170
173
|
--k: min(62px, calc((100vw - 32px - 9 * 8px) / 9.2));
|
|
@@ -215,10 +218,11 @@ a.button[hidden] { display: none; }
|
|
|
215
218
|
.github:hover { color: var(--ink); }
|
|
216
219
|
.github:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
|
|
217
220
|
.github svg { width: 22px; height: 22px; fill: currentColor; }
|
|
218
|
-
@media (prefers-reduced-motion: reduce) { .typing-note { opacity: 1; }
|
|
221
|
+
@media (prefers-reduced-motion: reduce) { .typing-note { opacity: 1; } }
|
|
219
222
|
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
220
223
|
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
|
|
221
224
|
</style>
|
|
225
|
+
<!--HOME-->
|
|
222
226
|
</head>
|
|
223
227
|
<body>
|
|
224
228
|
<main class="player" id="player">
|
|
@@ -226,6 +230,7 @@ a.button[hidden] { display: none; }
|
|
|
226
230
|
<canvas id="stage" width="1080" height="1920" aria-hidden="true"></canvas>
|
|
227
231
|
<div class="bars" id="bars"></div>
|
|
228
232
|
<div class="controls">
|
|
233
|
+
<button id="pause" class="icon" aria-pressed="false" aria-label="Pause" aria-keyshortcuts="Space"><svg viewBox="0 0 12 12" aria-hidden="true"><rect class="bar" x="2" y="1.5" width="2.6" height="9" rx="0.6"/><rect class="bar" x="7.4" y="1.5" width="2.6" height="9" rx="0.6"/><path class="tri" d="M3 1.6v8.8a.6.6 0 0 0 .9.5l7-4.4a.6.6 0 0 0 0-1l-7-4.4a.6.6 0 0 0-.9.5z"/></svg></button>
|
|
229
234
|
<button id="sound" aria-pressed="true">Sound on</button>
|
|
230
235
|
<button id="save-now">Save this card</button>
|
|
231
236
|
<button id="skip">Skip to sharing</button>
|
|
@@ -233,7 +238,7 @@ a.button[hidden] { display: none; }
|
|
|
233
238
|
<div class="start" id="start">
|
|
234
239
|
<div>
|
|
235
240
|
<button class="primary" id="play">Play my story</button>
|
|
236
|
-
<p id="start-note">Sound on for the full effect. Tap the right side to go on, the left to go back.
|
|
241
|
+
<p id="start-note">Sound on for the full effect. Tap the right side to go on, the left to go back. Space pauses, and S saves a card.</p>
|
|
237
242
|
</div>
|
|
238
243
|
</div>
|
|
239
244
|
</div>
|
|
@@ -245,13 +250,13 @@ a.button[hidden] { display: none; }
|
|
|
245
250
|
<img id="share-preview" alt="Your story's summary card">
|
|
246
251
|
<div>
|
|
247
252
|
<h1 id="share-title" tabindex="-1">Share your story</h1>
|
|
248
|
-
<p class="lede">Anyone with the link can watch it play, keys and sound included.
|
|
253
|
+
<p class="lede">Anyone with the link can watch it play, keys and sound included. Sharing saves what's on these cards on agent-wrapped.shadev.space, so the link can be short. Nothing else from your logs leaves your computer.</p>
|
|
249
254
|
<p class="note" id="offline" hidden>Share links turn on once the public player page is online. For now, save the video or the card.</p>
|
|
250
255
|
<div class="row">
|
|
251
256
|
<button class="primary" id="copy-link" data-needs-link>Copy link</button>
|
|
252
257
|
<button id="share-link" hidden>Share</button>
|
|
253
|
-
<a class="button" id="post-x"
|
|
254
|
-
<a class="button" id="post-linkedin"
|
|
258
|
+
<a class="button" id="post-x" href="#" data-needs-link>Post on X</a>
|
|
259
|
+
<a class="button" id="post-linkedin" href="#" data-needs-link>Post on LinkedIn</a>
|
|
255
260
|
</div>
|
|
256
261
|
<fieldset class="choices">
|
|
257
262
|
<legend>Cards in your story. Tap one to leave it out of the link.</legend>
|
|
@@ -269,7 +274,7 @@ a.button[hidden] { display: none; }
|
|
|
269
274
|
<section class="ending" id="ending" aria-labelledby="ending-title" hidden>
|
|
270
275
|
<div>
|
|
271
276
|
<h1 id="ending-title" tabindex="-1">Make your own</h1>
|
|
272
|
-
<p class="lede">Run this in your terminal. It reads your Claude Code and
|
|
277
|
+
<p class="lede">Run this in your terminal. It reads your Claude Code, Codex and Cursor logs on your computer, and nothing leaves it unless you share.</p>
|
|
273
278
|
<div class="command">
|
|
274
279
|
<code>npx @shadevkumar/agent-wrapped</code>
|
|
275
280
|
<button class="primary" data-copy-command>Copy</button>
|
|
@@ -292,7 +297,7 @@ a.button[hidden] { display: none; }
|
|
|
292
297
|
<div class="typing" id="home-keys" aria-hidden="true"></div>
|
|
293
298
|
<p class="typing-note" id="home-note" aria-hidden="true"></p>
|
|
294
299
|
<h1 id="home-title"><span>Agent Wrapped 2026</span></h1>
|
|
295
|
-
<p class="lede">Your year with Claude Code and
|
|
300
|
+
<p class="lede">Your year with Claude Code, Codex and Cursor, played back in keyboard keys.</p>
|
|
296
301
|
<div class="command">
|
|
297
302
|
<code>npx @shadevkumar/agent-wrapped</code>
|
|
298
303
|
<button class="primary" data-copy-command>Copy</button>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// A shared story travels inside its link, after "#v2.". To keep links short,
|
|
2
|
+
// a link holds only the values, in the order below, never the field names.
|
|
3
|
+
// Fields are only ever added at the end of a list, so an older link still
|
|
4
|
+
// reads: a field it doesn't have comes back missing.
|
|
5
|
+
//
|
|
6
|
+
// The page and the site build both use this file.
|
|
7
|
+
|
|
8
|
+
const listOf = (fields) => ({ list: fields });
|
|
9
|
+
|
|
10
|
+
const FIELDS = [
|
|
11
|
+
["range", ["from", "to"]],
|
|
12
|
+
"prompts",
|
|
13
|
+
"activeDays",
|
|
14
|
+
"sessions",
|
|
15
|
+
["topTypo", ["spelling", "word", "count"]],
|
|
16
|
+
["spellings", ["word", "spellings", "ways"]],
|
|
17
|
+
["slip", ["meant", "hit", "count"]],
|
|
18
|
+
["topPrompts", listOf(["text", "count"])],
|
|
19
|
+
["catchphrase", ["text", "sessions"]],
|
|
20
|
+
["night", ["latest", "prompts"]],
|
|
21
|
+
["streak", ["days", "from", "to"]],
|
|
22
|
+
["agents", ["claude", "codex", "cursor", "hours", "bothDays"]],
|
|
23
|
+
["money", ["atLeastUsd", "pricesAsOf"]],
|
|
24
|
+
["talk", [["nickname", ["word", "count"]], "please", "thanks", "checkIns"]],
|
|
25
|
+
["work", ["since", "tests", "commits", "stops", "languages"]],
|
|
26
|
+
["chapters", listOf(["from", "to", "name"])],
|
|
27
|
+
["personality", ["name", "line", "traits"]],
|
|
28
|
+
["letter", ["text"]],
|
|
29
|
+
"period",
|
|
30
|
+
["shipped", ["since", "pushes", "prs", "deploys", ["biggestWeek", ["from", "to", "commits"]]]],
|
|
31
|
+
["crashouts", ["count", ["worstDay", ["day", "count"]], "word"]],
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export function toLink(data, fields = FIELDS) {
|
|
35
|
+
return fields.map((f) => {
|
|
36
|
+
const [key, inner] = typeof f === "string" ? [f] : f;
|
|
37
|
+
const value = data[key];
|
|
38
|
+
if (value === undefined || value === null) return null;
|
|
39
|
+
if (!inner) return value;
|
|
40
|
+
return inner.list ? value.map((item) => toLink(item, inner.list)) : toLink(value, inner);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function fromLink(values, fields = FIELDS) {
|
|
45
|
+
const data = {};
|
|
46
|
+
fields.forEach((f, i) => {
|
|
47
|
+
const [key, inner] = typeof f === "string" ? [f] : f;
|
|
48
|
+
const value = values[i];
|
|
49
|
+
if (value === undefined) return;
|
|
50
|
+
if (value === null || !inner) data[key] = value;
|
|
51
|
+
else data[key] = inner.list ? value.map((item) => fromLink(item, inner.list)) : fromLink(value, inner);
|
|
52
|
+
});
|
|
53
|
+
return data;
|
|
54
|
+
}
|