@shadevkumar/agent-wrapped 0.5.0 → 0.5.2

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 CHANGED
@@ -6,9 +6,9 @@ Your life with AI coding agents, wrapped.
6
6
  npx @shadevkumar/agent-wrapped
7
7
  ```
8
8
 
9
- It reads your Claude Code, Codex and Cursor logs on your computer and turns them into a short animated story made of keyboard keys, with a quiet lofi loop underneath: your year in chapters, your most-typed typo, every way you've spelled "everything", the key you hit when you meant another, how you talk to your agents, your crashouts, your latest prompt after midnight, your streak, what your agents got done, what you shipped, and what all that work would cost at public API prices. It ends with your personality and a letter from your agents.
9
+ It reads your Claude Code, Codex and Cursor logs on your computer and turns them into a short animated story made of keyboard keys, with a quiet lofi loop underneath: your year in chapters, your most-typed typo, every way you've spelled "everything", the key you hit when you meant another, how you talk to your agents, your crashouts, how late your latest night ran, your streak, what your agents got done, what you shipped, and what all that work would cost at public API prices. It ends with your personality and a letter from your agents.
10
10
 
11
- It asks whether to cover everything so far or only the last 30 days. Each card stays up long enough to read it; press Space, the pause button, or press and hold to stop on one.
11
+ It asks whether to cover this year so far or only the last 30 days. A year's story starts on 1 January; made in January, it covers the year that just ended. Each card stays up long enough to read it; press Space, the pause button, or press and hold to stop on one.
12
12
 
13
13
  Then you share it. One link plays your whole story for anyone who opens it, keys and sound included, and ends by showing them how to make their own. You can leave cards out first, or save a video for places that don't take links. While you watch, the buttons fade away so a screenshot shows only the card, and pressing S saves the card on screen.
14
14
 
@@ -37,7 +37,9 @@ Nothing is uploaded unless you share. The story is one HTML file written to your
37
37
  | Cursor | `~/.cursor/projects/*/agent-transcripts/*/*.jsonl` | the prompts you typed to Cursor's agent, and the same tests, commits and edits |
38
38
  | Git | `git config --global user.name` | the first word of your name, when your Claude account has none |
39
39
 
40
- Everything is opened read-only. For what the agents did, only the kind is kept (a test run, a commit, a push, a pull request, a deploy, a stop) and, for an edit, the file type: never a command, a file name or any output. Cursor doesn't log tokens or how long its agent worked, so Cursor adds prompts and work but no hours or cost. Claude Code deletes full transcripts after about 30 days, so older Claude token use and work can be missing. The prompts themselves go back further.
40
+ Everything is opened read-only. For what the agents did, only the kind is kept (a test run, a commit, a push, a pull request, a deploy, a stop) and, for an edit, the file type: never a command, a file name or any output. Cursor doesn't log tokens or how long its agent worked, so Cursor adds prompts and work but no hours or cost. Claude Code deletes full transcripts after about 30 days, so older Claude token use, hours and work can be missing. The prompts themselves go back further. That is why the story says "at least" before its hours.
41
+
42
+ A late night is the prompts you sent between midnight and 5 AM. If you were still going at 5, the night runs on until your first break of more than an hour. From 6 AM it is morning: a night that was still going then only counts if none of your nights ended sooner. The story shows the latest one.
41
43
 
42
44
  ## How the cost is worked out
43
45
 
@@ -54,7 +56,7 @@ Prices are in `src/pricing.ts`, with the date they were read and their source pa
54
56
  | Flag | What it does |
55
57
  | --- | --- |
56
58
  | `--last-month` | Make the story from the last 30 days only |
57
- | `--everything` | Make it from everything so far, without asking |
59
+ | `--year` | Make it from this year, without asking (`--everything` does the same) |
58
60
  | `--no-ai` | Don't ask your `claude` command: a template letter, and chapters named by their top words |
59
61
  | `--no-open` | Write the story file without opening it |
60
62
  | `--json` | Print the numbers behind the story instead of making it |
package/dist/cli.js CHANGED
@@ -13,14 +13,17 @@ import { pickPersonality } from "./personality.js";
13
13
  import { bold, choose, dim, line, step } from "./screen.js";
14
14
  import { readInBackground } from "./read-worker.js";
15
15
  import { storyData } from "./story.js";
16
- import { harvestSince, mergeHarvests } from "./types.js";
16
+ import { harvestSince, mergeHarvests, storyYear } from "./types.js";
17
17
  import { Words } from "./words.js";
18
- const HELP = `Agent Wrapped 2026: your year with Claude Code, Codex and Cursor, played back in keyboard keys.
18
+ const today = new Date();
19
+ const year = storyYear(today);
20
+ const yearOver = today.getFullYear() !== year; // January: the story is last year's
21
+ const HELP = `Agent Wrapped ${year}: your year with Claude Code, Codex and Cursor, played back in keyboard keys.
19
22
 
20
23
  Usage: npx @shadevkumar/agent-wrapped [options]
21
24
 
22
25
  --last-month Make the story from the last 30 days only
23
- --everything Make it from everything so far, without asking
26
+ --year Make it from ${year}, without asking
24
27
  --no-ai Don't ask your claude command: a template letter, and chapters named by their top words
25
28
  --no-open Write the story file without opening it
26
29
  --json Print the numbers behind the story instead of making it
@@ -34,23 +37,25 @@ const home = homedir();
34
37
  const useAi = !args.has("--no-ai");
35
38
  const n = (x) => Math.round(x).toLocaleString("en-US");
36
39
  line();
37
- line(` ${bold("Agent Wrapped 2026")}`);
40
+ line(` ${bold(`Agent Wrapped ${year}`)}`);
38
41
  line(` ${dim("Reads your agents' logs on this computer. Nothing is uploaded.")}`);
39
42
  line();
40
43
  const span = args.has("--last-month")
41
44
  ? "month"
42
- : args.has("--everything") || args.has("--json")
45
+ : args.has("--year") || args.has("--everything") || args.has("--json") // --everything is --year's old name
43
46
  ? "year"
44
47
  : await choose("Which stretch should your story cover?", [
45
- { label: "Everything so far", value: "year" },
48
+ { label: yearOver ? `All of ${year}` : `${year} so far`, value: "year" },
46
49
  { label: "The last 30 days", value: "month" },
47
50
  ]);
48
- const since = span === "month" ? new Date(Date.now() - 30 * 86_400_000) : null;
51
+ // A year's story runs from 1 January, so older logs don't count towards it.
52
+ const since = span === "month" ? new Date(today.getTime() - 30 * 86_400_000) : new Date(year, 0, 1);
53
+ const before = span === "month" ? undefined : new Date(year + 1, 0, 1);
49
54
  // All three are read at once; each line ticks when its agent is done.
50
55
  const reading = ["claude", "codex", "cursor"].map((source) => readInBackground(source, home));
51
56
  const parts = [];
52
57
  for (const [i, name] of ["Claude Code", "Codex", "Cursor"].entries()) {
53
- parts.push(await step(`Reading ${name}`, async () => (since ? harvestSince(await reading[i], since) : reading[i]), (h) => `${name} ${dim(h.prompts.length ? `${n(h.prompts.length)} prompts` : "none on this computer")}`));
58
+ parts.push(await step(`Reading ${name}`, async () => harvestSince(await reading[i], since, before), (h) => `${name} ${dim(h.prompts.length ? `${n(h.prompts.length)} prompts` : "none on this computer")}`));
54
59
  }
55
60
  const harvest = mergeHarvests(parts);
56
61
  const words = new Words(harvest.privateNames);
@@ -61,9 +66,9 @@ if (args.has("--json")) {
61
66
  }
62
67
  if (wrapped.totals.prompts === 0) {
63
68
  line();
64
- line(since
69
+ line(span === "month"
65
70
  ? " No prompts from the last 30 days on this computer. Try it without --last-month."
66
- : " No Claude Code, Codex or Cursor prompts on this computer, so there's no story yet.");
71
+ : ` No Claude Code, Codex or Cursor prompts from ${year} on this computer, so there's no story yet.${yearOver ? " Try --last-month for the last 30 days." : ""}`);
67
72
  process.exit(1);
68
73
  }
69
74
  const personality = pickPersonality(wrapped);
package/dist/letter.js CHANGED
@@ -6,7 +6,7 @@ Write a short letter from their agents to them. Rules:
6
6
  - Use two or three of the facts given, quoting their words exactly as given.
7
7
  - Never invent numbers, names, projects or events that are not in the facts.
8
8
  - End with a short sign-off line from "your agents".`;
9
- // "02:34" -> "2:34 AM". Late-night times run from midnight to 5 AM.
9
+ // "02:34" -> "2:34 AM". A late night ends before 6 AM.
10
10
  export const clock = (hhmm) => `${Number(hhmm.slice(0, 2)) % 12 || 12}:${hhmm.slice(3)} AM`;
11
11
  export function factsFor(w, p, span = "year") {
12
12
  const facts = [
package/dist/moments.js CHANGED
@@ -3,6 +3,10 @@ import { apiCost, PRICES_AS_OF } from "./pricing.js";
3
3
  import { AGENTS, usageTokens } from "./types.js";
4
4
  import { findTypos, keySlips, tokenize, Words } from "./words.js";
5
5
  const LATE_NIGHT_END_HOUR = 5;
6
+ // A night still going at 5 AM runs on until the first break this long. From
7
+ // 6 AM it is morning.
8
+ const NIGHT_BREAK_MINUTES = 60;
9
+ const MORNING_HOUR = 6;
6
10
  // Repeats under a second apart are the logs writing a message twice, not a person.
7
11
  const DOUBLE_SEND_MIN_MS = 1_000;
8
12
  const DOUBLE_SEND_MAX_MS = 120_000;
@@ -254,19 +258,17 @@ function rhythm(prompts, days) {
254
258
  const byWeekday = new Array(7).fill(0);
255
259
  const perDay = new Map();
256
260
  let late = 0;
257
- let latestMinute = -1;
258
261
  for (const p of prompts) {
259
262
  const hour = p.at.getHours();
260
263
  byHour[hour]++;
261
264
  byWeekday[p.at.getDay()]++;
262
265
  const day = localDay(p.at);
263
266
  perDay.set(day, (perDay.get(day) ?? 0) + 1);
264
- if (hour < LATE_NIGHT_END_HOUR) {
267
+ if (hour < LATE_NIGHT_END_HOUR)
265
268
  late++;
266
- latestMinute = Math.max(latestMinute, hour * 60 + p.at.getMinutes());
267
- }
268
269
  }
269
270
  const busiest = [...perDay].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))[0];
271
+ const night = latestNight(prompts);
270
272
  return {
271
273
  byHour,
272
274
  byWeekday,
@@ -275,10 +277,54 @@ function rhythm(prompts, days) {
275
277
  lateNight: {
276
278
  prompts: late,
277
279
  share: share(late, prompts.length),
278
- latest: latestMinute < 0 ? null : `${pad(Math.floor(latestMinute / 60))}:${pad(latestMinute % 60)}`,
280
+ latest: night ? `${pad(Math.floor(night.minute / 60))}:${pad(night.minute % 60)}` : null,
281
+ latestDay: night?.day ?? null,
279
282
  },
280
283
  };
281
284
  }
285
+ // When the latest night ended, in minutes past midnight, and on which day.
286
+ // A night is the prompts between midnight and 5 AM. One still going at 5 runs
287
+ // on for as long as the breaks stay under an hour, so a prompt at 5:20 after
288
+ // one at 4:59 is the same night, and the first prompt after a sleep is not.
289
+ // A night still going at 6 AM has turned into a morning: it only counts, up to
290
+ // its last prompt before 6, when no night ended sooner. So the time shown is
291
+ // when you stopped, not always 5:59.
292
+ // `prompts` are sorted, oldest first.
293
+ export function latestNight(prompts) {
294
+ const mornings = new Map(); // local day -> minutes past midnight, up to 6:59
295
+ for (const p of prompts) {
296
+ if (p.at.getHours() > MORNING_HOUR)
297
+ continue;
298
+ const day = localDay(p.at);
299
+ if (!mornings.has(day))
300
+ mornings.set(day, []);
301
+ mornings.get(day).push(p.at.getHours() * 60 + p.at.getMinutes());
302
+ }
303
+ let ended = null;
304
+ let ranOn = null;
305
+ for (const [day, minutes] of mornings) {
306
+ let end = -1;
307
+ let pastSix = false;
308
+ for (const m of minutes) {
309
+ if (m >= LATE_NIGHT_END_HOUR * 60 && (end < 0 || m - end > NIGHT_BREAK_MINUTES))
310
+ break;
311
+ if (m >= MORNING_HOUR * 60) {
312
+ pastSix = true;
313
+ break;
314
+ }
315
+ end = m;
316
+ }
317
+ if (end < 0)
318
+ continue;
319
+ if (pastSix) {
320
+ if (end > (ranOn?.minute ?? -1))
321
+ ranOn = { minute: end, day };
322
+ }
323
+ else if (end > (ended?.minute ?? -1))
324
+ ended = { minute: end, day };
325
+ }
326
+ return ended ?? ranOn;
327
+ }
282
328
  // `days` are sorted, unique local days (YYYY-MM-DD).
283
329
  export function longestStreak(days) {
284
330
  if (days.length === 0)
@@ -70,12 +70,16 @@ export function harvestCodex(home) {
70
70
  catch {
71
71
  h.coverage.push(coverage("codex", "prompts", []));
72
72
  }
73
+ // Some turns have no start time, only when they ended and how long they
74
+ // ran. Older histories have no end time either; there the start is used as is.
75
+ const ended = hasColumn(history, "thread_turns", "completed_at");
73
76
  try {
77
+ const start = ended ? "coalesce(started_at, completed_at - duration_ms / 1000)" : "started_at";
74
78
  const turns = history
75
- .prepare("select started_at, duration_ms from thread_turns where duration_ms > 0")
79
+ .prepare(`select ${start} as started_at, duration_ms from thread_turns where duration_ms > 0`)
76
80
  .all();
77
81
  for (const t of turns) {
78
- const at = toDate(Number(t.started_at) * 1000);
82
+ const at = seconds(t.started_at);
79
83
  if (at)
80
84
  h.turns.push({ agent: "codex", at, durationMs: Number(t.duration_ms) });
81
85
  }
@@ -84,8 +88,9 @@ export function harvestCodex(home) {
84
88
  // Without turn timings the story skips agent hours; prompts still count.
85
89
  }
86
90
  try {
87
- for (const t of history.prepare("select started_at from thread_turns where status = 'interrupted'").all()) {
88
- const at = toDate(Number(t.started_at) * 1000);
91
+ const start = ended ? "coalesce(started_at, completed_at)" : "started_at";
92
+ for (const t of history.prepare(`select ${start} as started_at from thread_turns where status = 'interrupted'`).all()) {
93
+ const at = seconds(t.started_at);
89
94
  if (at)
90
95
  h.actions.push({ agent: "codex", at, kind: "stop" });
91
96
  }
@@ -125,6 +130,18 @@ export function harvestCodex(home) {
125
130
  }
126
131
  return h;
127
132
  }
133
+ // A time Codex keeps in seconds. One it didn't keep is no time, not 1970.
134
+ function seconds(value) {
135
+ return value === null || value === undefined ? null : toDate(Number(value) * 1000);
136
+ }
137
+ function hasColumn(db, table, column) {
138
+ try {
139
+ return db.prepare(`pragma table_info(${table})`).all().some((c) => c.name === column);
140
+ }
141
+ catch {
142
+ return false;
143
+ }
144
+ }
128
145
  // The first "key":"value" string in a piece of JSON that may be cut off.
129
146
  function firstString(json, key) {
130
147
  const m = json.match(new RegExp(`"${key}":("(?:[^"\\\\]|\\\\.)*")`));
@@ -17,7 +17,7 @@ const FIELDS = [
17
17
  ["slip", ["meant", "hit", "count"]],
18
18
  ["topPrompts", listOf(["text", "count"])],
19
19
  ["catchphrase", ["text", "sessions"]],
20
- ["night", ["latest", "prompts"]],
20
+ ["night", ["latest", "prompts", "day"]],
21
21
  ["streak", ["days", "from", "to"]],
22
22
  ["agents", ["claude", "codex", "cursor", "hours", "bothDays"]],
23
23
  ["money", ["atLeastUsd", "pricesAsOf"]],
@@ -187,7 +187,7 @@ const fade = (t, at, dur = 0.45) => (REDUCED ? 1 : easeOut((t - at) / dur));
187
187
  const num = (n) => Math.round(n).toLocaleString("en-US");
188
188
  const day = (iso) =>
189
189
  new Date(`${iso}T12:00:00`).toLocaleDateString("en-US", { month: "short", day: "numeric" });
190
- // "02:34" -> "2:34 AM". Late-night times run from midnight to 5 AM.
190
+ // "02:34" -> "2:34 AM". A late night ends before 6 AM.
191
191
  const clock = (hhmm) => `${Number(hhmm.slice(0, 2)) % 12 || 12}:${hhmm.slice(3)} AM`;
192
192
  const month = (ym) => new Date(`${ym}-15T12:00:00`).toLocaleDateString("en-US", { month: "short" });
193
193
 
@@ -990,21 +990,22 @@ function buildCards(D) {
990
990
  alt: `Your year in chapters: ${list.map((c) => `${months(c)}, ${c.name}`).join("; ")}.`,
991
991
  head: (ctx, t, fx, cw, b) => text(ctx, b, "Your year in chapters", 0, { ...big(70), color: cw.ink }),
992
992
  visual(ctx, t, fx, cw, b) {
993
- // One text size for every row: the largest the longest name fits at.
993
+ // One text size for every row: the largest the longest name fits at,
994
+ // down to 30. A name still too long takes two lines.
994
995
  const right = (c) => ({ text: months(c), size: 34, family: "Geist", weight: 400 });
995
- const size = Math.min(
996
- ...list.map((c) => {
997
- const room = b.w - 100 - textWidth(ctx, right(c).text, 36, right(c));
998
- return clamp((40 * room) / textWidth(ctx, c.name, 40, { family: "Geist", weight: 500 }), 26, 40);
999
- }),
1000
- );
996
+ const name = { family: "Geist", weight: 500 };
997
+ const room = (c) => b.w - 100 - textWidth(ctx, right(c).text, 36, right(c));
998
+ const size = Math.min(...list.map((c) => clamp((40 * room(c)) / textWidth(ctx, c.name, 40, name), 30, 40)));
1001
999
  list.forEach((c, i) => {
1002
1000
  const at = 0.6 + i * 0.35;
1003
1001
  fx.key(at);
1004
1002
  const local = REDUCED ? 9 : t - at;
1005
1003
  if (local < 0) return;
1006
- const label = { text: c.name, size, family: "Geist", weight: 500 };
1007
- cap(ctx, b.x + b.w / 2, 70 + i * 160, b.w * easeOut(local / 0.5), 120, "", { ...cw, left: true, lines: [label], right: right(c), press: pressAt(local) });
1004
+ ctx.save();
1005
+ ctx.font = font(size, name);
1006
+ const lines = wrap(ctx, c.name, room(c)).slice(0, 2).map((text) => ({ text, size, ...name }));
1007
+ ctx.restore();
1008
+ cap(ctx, b.x + b.w / 2, 70 + i * 160, b.w * easeOut(local / 0.5), 120, "", { ...cw, left: true, lines, right: right(c), press: pressAt(local) });
1008
1009
  });
1009
1010
  },
1010
1011
  words: (ctx, t, fx, cw, b) =>
@@ -1194,12 +1195,15 @@ function buildCards(D) {
1194
1195
  if (D.night) {
1195
1196
  const n = D.night;
1196
1197
  add({
1197
- id: "night", name: "Late night", ready: 2.5,
1198
- alt: `The latest you were still prompting: ${clock(n.latest)}. ${num(n.prompts)} prompts between midnight and 5 AM.`,
1198
+ id: "night", name: "Late night", ready: n.day ? 2.8 : 2.5,
1199
+ alt: `The latest you were still prompting: ${clock(n.latest)}${n.day ? `, on ${day(n.day)}` : ""}. ${num(n.prompts)} prompts between midnight and 5 AM.`,
1199
1200
  head: (ctx, t, fx, cw, b) => text(ctx, b, "The latest you were still prompting", 0, { ...say(54), color: cw.soft }),
1200
1201
  visual: (ctx, t, fx, cw, b) => typeRow(ctx, b, [...chars(clock(n.latest).slice(0, -3)), " AM"], 110, 190, t, 0.6, fx, cw, { plain, step: 0.15 }),
1201
- words: (ctx, t, fx, cw, b) =>
1202
- text(ctx, b, `${num(n.prompts)} prompts between midnight and 5 AM. We were up too.`, 0, { ...big(68), color: cw.ink, alpha: fade(t, 1.9) }),
1202
+ words(ctx, t, fx, cw, b) {
1203
+ // A link shared before nights had a day says only the time.
1204
+ const y = n.day ? text(ctx, b, `That was ${day(n.day)}.`, 0, { ...say(), color: cw.soft, alpha: fade(t, 1.6) }) + 24 : 0;
1205
+ text(ctx, b, `${num(n.prompts)} prompts between midnight and 5 AM. We were up too.`, y, { ...big(68), color: cw.ink, alpha: fade(t, n.day ? 2.2 : 1.9) });
1206
+ },
1203
1207
  });
1204
1208
  }
1205
1209
 
@@ -1237,21 +1241,28 @@ function buildCards(D) {
1237
1241
 
1238
1242
  if (D.agents) {
1239
1243
  const a = D.agents;
1240
- const parts = [["Codex", a.codex], ["Claude", a.claude], ["Cursor", a.cursor ?? 0]].filter(([, v]) => v > 0);
1241
- const split = ["", "", ", split between two of us", ", split between three of us"][parts.length];
1242
- // Cursor doesn't log how long it worked, so a Cursor-only year has no hours.
1243
- const title = a.hours >= 1 ? `${num(a.hours)} hours of work${split}.` : `Your prompts${split || ", all to one of us"}.`;
1244
+ // The bars are each agent's share of your prompts, biggest first.
1245
+ const parts = [["Codex", a.codex], ["Claude", a.claude], ["Cursor", a.cursor ?? 0]].filter(([, v]) => v > 0).sort((x, y) => y[1] - x[1]);
1246
+ const percent = (share) => (share < 0.005 ? "<1" : Math.round(share * 100));
1247
+ const split = `Your prompts${["", ", all to one of us", ", split between two of us", ", split between three of us"][parts.length]}.`;
1248
+ // The hours are a floor: Claude Code keeps how long it worked for about a
1249
+ // month, and Cursor doesn't log it, so a Cursor-only year has no hours.
1250
+ const hours = a.hours >= 1 ? `At least ${num(a.hours)} hours of work.` : "";
1244
1251
  add({
1245
1252
  id: "agents", name: "Your agents", ready: 2.5,
1246
- alt: `${num(a.hours)} hours of agent work. ${parts.map(([name, share]) => `${name} ${Math.round(share * 100)} percent`).join(", ")}.`,
1247
- head: (ctx, t, fx, cw, b) => text(ctx, b, title, 0, { ...big(72), color: cw.ink }),
1253
+ alt: `${hours ? `${hours} ` : ""}Your prompts: ${parts.map(([name, share]) => `${name} ${percent(share)} percent`).join(", ")}.`,
1254
+ head(ctx, t, fx, cw, b) {
1255
+ if (!hours) return text(ctx, b, split, 0, { ...big(72), color: cw.ink });
1256
+ const y = text(ctx, b, hours, 0, { ...big(72), color: cw.ink });
1257
+ return text(ctx, b, split, y + 18, { ...say(), color: cw.soft });
1258
+ },
1248
1259
  visual(ctx, t, fx, cw, b) {
1249
1260
  parts.forEach(([name, share], i) => {
1250
1261
  const at = 0.7 + i * 0.4;
1251
1262
  fx.key(at);
1252
1263
  const local = REDUCED ? 9 : t - at;
1253
1264
  if (local < 0) return;
1254
- const label = { text: `${name} ${Math.round(share * 100)}%`, size: 48, family: "Geist", weight: 500 };
1265
+ const label = { text: `${name} ${percent(share)}%`, size: 48, family: "Geist", weight: 500 };
1255
1266
  const least = textWidth(ctx, label.text, 52, label) + 100;
1256
1267
  const w = Math.max(least, b.w * share) * easeOut(local / 0.6);
1257
1268
  cap(ctx, b.x + w / 2, 95 + i * 230, w, 170, "", { ...cw, left: true, lines: [label], press: pressAt(local) });
@@ -1434,7 +1445,7 @@ function buildCards(D) {
1434
1445
 
1435
1446
  const tiles = [
1436
1447
  [num(D.prompts), "prompts"],
1437
- D.agents ? [num(D.agents.hours), "hours of agent work"] : null,
1448
+ D.agents?.hours >= 1 ? [num(D.agents.hours), "hours of agent work"] : null,
1438
1449
  D.topTypo ? [`${D.topTypo.spelling} ×${num(D.topTypo.count)}`, "my favourite typo"] : null,
1439
1450
  D.night ? [clock(D.night.latest), "latest you were still prompting"] : D.streak ? [`${D.streak.days} days`, "longest streak"] : null,
1440
1451
  ].filter(Boolean);
package/dist/story.js CHANGED
@@ -33,7 +33,7 @@ export function storyData(w, personality, letter, chapterNames = w.chapters.map(
33
33
  topPrompts: w.voice.topPrompts.slice(0, 4),
34
34
  catchphrase: pickCatchphrase(w.voice.catchphrases),
35
35
  night: w.rhythm.lateNight.latest && w.rhythm.lateNight.prompts >= 5
36
- ? { latest: w.rhythm.lateNight.latest, prompts: w.rhythm.lateNight.prompts }
36
+ ? { latest: w.rhythm.lateNight.latest, prompts: w.rhythm.lateNight.prompts, day: w.rhythm.lateNight.latestDay ?? undefined }
37
37
  : null,
38
38
  streak: streak && streak.days >= 5 ? streak : null,
39
39
  agents: w.totals.prompts
package/dist/types.js CHANGED
@@ -21,9 +21,10 @@ export function commandKinds(command) {
21
21
  export function emptyHarvest() {
22
22
  return { prompts: [], usage: [], totals: [], turns: [], actions: [], coverage: [], privateNames: new Set() };
23
23
  }
24
- // Only what happened from `since` on. What each source covered is kept as read.
25
- export function harvestSince(h, since) {
26
- const recent = (list) => list.filter((x) => x.at >= since);
24
+ // Only what happened from `since` on, and before `before` when there is one.
25
+ // What each source covered is kept as read.
26
+ export function harvestSince(h, since, before) {
27
+ const recent = (list) => list.filter((x) => x.at >= since && (!before || x.at < before));
27
28
  return {
28
29
  ...h,
29
30
  prompts: recent(h.prompts),
@@ -33,6 +34,11 @@ export function harvestSince(h, since) {
33
34
  actions: recent(h.actions),
34
35
  };
35
36
  }
37
+ // The year a story made on `today` covers: this one, or in January the one
38
+ // that just ended, so a story made on New Year's Day is still last year's.
39
+ export function storyYear(today) {
40
+ return today.getMonth() === 0 ? today.getFullYear() - 1 : today.getFullYear();
41
+ }
36
42
  export function mergeHarvests(parts) {
37
43
  const out = emptyHarvest();
38
44
  for (const p of parts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shadevkumar/agent-wrapped",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Your year with AI coding agents, played back in keyboard keys. Reads Claude Code and Codex logs on your computer.",
5
5
  "keywords": [
6
6
  "claude-code",