@litfamily/litclaude 1.0.38 → 1.0.39

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +8 -8
  3. package/README_ko-KR.md +8 -8
  4. package/docs/assets/readme/badge-version.svg +1 -1
  5. package/docs/hooks.md +11 -6
  6. package/package.json +1 -1
  7. package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
  8. package/plugins/litclaude/bin/litclaude-hook.js +31 -13
  9. package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
  10. package/plugins/litclaude/commands/lit-adhd.md +12 -8
  11. package/plugins/litclaude/commands/lit-rewind.md +12 -8
  12. package/plugins/litclaude/lib/canonical-skill-resources.mjs +18 -17
  13. package/plugins/litclaude/lib/mod/frame.mjs +87 -20
  14. package/plugins/litclaude/lib/mod/svg-card.mjs +64 -22
  15. package/plugins/litclaude/lib/mod/timeline.mjs +4 -3
  16. package/plugins/litclaude/lib/mod/view.mjs +53 -13
  17. package/plugins/litclaude/lib/rewind/brief.mjs +370 -0
  18. package/plugins/litclaude/lib/rewind/collect.mjs +39 -13
  19. package/plugins/litclaude/lib/rewind/gauge.mjs +28 -8
  20. package/plugins/litclaude/lib/rewind/suggest.mjs +51 -0
  21. package/plugins/litclaude/lib/rewind/transcripts.mjs +15 -0
  22. package/plugins/litclaude/skills/frontend-ui-ux/SKILL.md +8 -1
  23. package/plugins/litclaude/skills/frontend-ui-ux/references/production-interview.md +1 -1
  24. package/plugins/litclaude/skills/lit-adhd/SKILL.md +45 -28
  25. package/plugins/litclaude/skills/lit-adhd/references/card-examples.md +114 -58
  26. package/plugins/litclaude/skills/lit-adhd/scripts/rewind.mjs +1 -1
  27. package/plugins/litclaude/skills/lit-diagram-drawer/SKILL.md +12 -1
  28. package/plugins/litclaude/skills/lit-docx/SKILL.md +6 -1
  29. package/plugins/litclaude/skills/lit-docx/references/direction-step.md +8 -4
  30. package/plugins/litclaude/skills/lit-handoff/SKILL.md +1 -0
  31. package/plugins/litclaude/skills/lit-pptx/SKILL.md +6 -1
  32. package/plugins/litclaude/skills/lit-pptx/references/direction-step.md +4 -2
  33. package/plugins/litclaude/skills/lit-recap/SKILL.md +1 -0
  34. package/plugins/litclaude/skills/lit-schematic/SKILL.md +12 -1
  35. package/plugins/litclaude/skills/lit-typographic-motion/SKILL.md +10 -6
  36. package/plugins/litclaude/skills/readme-studio/SKILL.md +10 -0
  37. package/plugins/litclaude/skills/readme-studio/references/production-interview.md +2 -0
@@ -32,7 +32,7 @@
32
32
  // and move by colour alone (a colour change on `─` or `━` repaints), and the live step's spinner
33
33
  // and clock are ASCII.
34
34
 
35
- import { gauge } from "../rewind/gauge.mjs";
35
+ import { gauge, knownFacts } from "../rewind/gauge.mjs";
36
36
  import { textWidth, truncateToWidth } from "./layout.mjs";
37
37
  import { barCells, gradientAt, lerpColor, lookOf, rainbowAt } from "./motion.mjs";
38
38
  import { glyphSet } from "./settings.mjs";
@@ -128,6 +128,19 @@ const pill = (body, fill, glyphs) => (glyphs.capLeft
128
128
  ? [span(glyphs.capLeft, { fg: fill }), ...body, span(glyphs.capRight, { fg: fill })]
129
129
  : [span(" ", { bg: fill }), ...body, span(" ", { bg: fill })]);
130
130
 
131
+ // The rewind look's pills: each cell a step further round the hue wheel, lightened so the dark ink
132
+ // keeps its contrast, with each cap in the colour of the cell beside it.
133
+ const RAINBOW_SPREAD = 0.35;
134
+ const rainbowCell = (rainbow, at) => lerpColor(rainbow(at), "#ffffff", 0.3);
135
+ const rainbowPill = (text, rainbow, from, glyphs, bold = true) => {
136
+ const chars = [...text];
137
+ const at = (i) => from + (chars.length <= 1 ? 0 : (i / (chars.length - 1)) * RAINBOW_SPREAD);
138
+ const body = chars.map((ch, i) => span(ch, { fg: PILL.ink, bg: rainbowCell(rainbow, at(i)), bold }));
139
+ return glyphs.capLeft
140
+ ? [span(glyphs.capLeft, { fg: rainbowCell(rainbow, at(0)) }), ...body, span(glyphs.capRight, { fg: rainbowCell(rainbow, at(chars.length - 1)) })]
141
+ : [span(" ", { bg: rainbowCell(rainbow, at(0)) }), ...body, span(" ", { bg: rainbowCell(rainbow, at(chars.length - 1)) })];
142
+ };
143
+
131
144
  const inkOf = (accent) => ({ done: lerpColor(accent, PALETTE.dim, 0.45), now: accent, todo: PALETTE.dim, warn: PALETTE.amber });
132
145
 
133
146
  // Colour of one phase in this frame: the crossfade from its previous state, then the amber mix for
@@ -204,14 +217,20 @@ const cometOn = (sample, edge, width, look = null) => {
204
217
  };
205
218
 
206
219
  // While LitClaude works the brand pill breathes from its pink toward the flame orange and back.
207
- const brandSpans = (sample, glyphs) => {
220
+ // The rewind look turns it through the rainbow instead, lightened so its dark ink stays readable.
221
+ const brandSpans = (sample, glyphs, rainbow = null) => {
208
222
  const reveal = revealText("🔥 LIT", sample.pills[0]);
209
223
  if (reveal === null) return [];
224
+ if (rainbow) return rainbowPill(reveal, rainbow, 0, glyphs);
210
225
  const fill = sample.ambient ? lerpColor(PILL.brand, PALETTE.orange, 0.85 * sample.ambient.breath) : PILL.brand;
211
226
  return pill(litText(reveal, { fg: PILL.ink, bg: fill, bold: true }, sample.completion?.shimmer ?? null), fill, glyphs);
212
227
  };
213
- const indicatorSpans = (model, sample, glyphs, accent) => {
228
+ // `REWIND <<` while the rewind look is on, each letter a step further round the hue wheel, lightened
229
+ // to keep 4.5:1 on the card; the letters stay put and only their colours move.
230
+ const rewindSpans = (rainbow) => [..."REWIND <<"].map((ch, i) => span(ch, { fg: lerpColor(rainbow(i / 9), "#ffffff", 0.4), bold: true }));
231
+ const indicatorSpans = (model, sample, glyphs, accent, rainbow = null) => {
214
232
  if (sample.completion) return [span(`DONE ${glyphs.done}`, { fg: PALETTE.green, bold: true })];
233
+ if (rainbow) return rewindSpans(rainbow);
215
234
  if (model.idle) return [span("idle", { fg: PALETTE.dim })];
216
235
  const flow = model.workflow;
217
236
  if (flow && flow.current >= 0) {
@@ -228,11 +247,11 @@ const indicatorSpans = (model, sample, glyphs, accent) => {
228
247
 
229
248
  // ╭─ [🔥 LIT] · <discipline> ──── <PHASE ●> ─╮. On a narrow card the phase indicator goes first,
230
249
  // then the discipline shortens, then it goes too.
231
- const topEdge = (model, sample, { width, glyphs, accent, edge, look, paint }) => {
232
- const brand = brandSpans(sample, glyphs);
233
- const right = indicatorSpans(model, sample, glyphs, accent);
250
+ const topEdge = (model, sample, { width, glyphs, accent, edge, look, paint, rainbow }) => {
251
+ const brand = brandSpans(sample, glyphs, rainbow);
252
+ const right = indicatorSpans(model, sample, glyphs, accent, rainbow);
234
253
  const name = model.title ?? "ready";
235
- const nameStyle = model.idle ? { fg: PALETTE.dim } : { fg: accent, bold: true };
254
+ const nameStyle = model.idle && !rainbow ? { fg: PALETTE.dim } : { fg: accent, bold: true };
236
255
  const title = (text) => (text ? [span(" · ", { fg: PALETTE.dim }), span(text, nameStyle)] : []);
237
256
  const fixed = textWidth("╭─ ") + rowWidth(brand) + 1 + 1;
238
257
  const withRight = fixed + rowWidth(title(name)) + 1 + rowWidth(right) + textWidth(" ─╮");
@@ -298,12 +317,14 @@ const phaseTrack = (model, sample, { glyphs, accent, rail, short, rainbow }) =>
298
317
  const shown = revealText(state === "now" ? label : `${state === "done" ? "●" : "○"} ${label}`, sample.pills[index + 1]);
299
318
  if (shown === null) return;
300
319
  if (out.length) out.push(span(` ${glyphs.rail.repeat(rail)} `, { fg: rainbow ? rainbow(index / PHASES.length) : sample.phases[PHASES[index - 1]].to === "done" ? ink.done : PILL.rail }));
301
- if (state === "now") {
320
+ if (state === "now" && rainbow) {
321
+ out.push(...rainbowPill(shown.slice(0, label.length).padEnd(label.length), rainbow, index / PHASES.length, glyphs));
322
+ } else if (state === "now") {
302
323
  const fill = model.idle ? lerpColor(phaseColor(id, sample, ink), PILL.muted, 0.5) : phaseColor(id, sample, ink);
303
324
  const sweep = model.idle ? null : sample.ambient?.sweep ?? null;
304
325
  out.push(...pill(litText(shown.slice(0, label.length).padEnd(label.length), { fg: PILL.ink, bg: fill, bold: true }, sweep), fill, glyphs));
305
326
  } else {
306
- out.push(span(warned(id, sample) ? shown.replace(/^[●○]/u, glyphs.warn) : shown, { fg: phaseColor(id, sample, ink) }));
327
+ out.push(span(warned(id, sample) ? shown.replace(/^[●○]/u, glyphs.warn) : shown, { fg: rainbow && !warned(id, sample) ? rainbow(index / PHASES.length + 0.15) : phaseColor(id, sample, ink), bold: Boolean(rainbow) }));
307
328
  }
308
329
  });
309
330
  return out;
@@ -532,10 +553,43 @@ const THREAD_NAME = Object.freeze({ mid: PALETTE.white, last: "#d8e0e8" });
532
553
  * └─ ● lit-loop RED [▉░░░] 1/4 running
533
554
  * ┬ 2 lanes · 1 task in parallel
534
555
  * ├─ ● executor [▉▉░] 2/3 running
535
- * ├─ ● reviewer [???] 7/? running
536
- * └─ $ dev server shell [???] ?/? running
556
+ * ├─ ● reviewer ━━━━━ running · 7 steps · 2m · last: Read a.mjs
557
+ * └─ $ dev server shell ━━━━━ running 4m
558
+ *
559
+ * A thread with two real numbers draws its gauge. One without a total never draws a guess: an
560
+ * indeterminate pulse (fixed `━` cells whose light moves by colour while the card animates) and
561
+ * what is known in words. The rewind look turns the gauge cells and the pulse through its rainbow.
537
562
  */
538
- const threadRows = (model, { inner, glyphs }) => {
563
+ const PULSE_CELLS = 5;
564
+ const pulseSpans = (sample, rainbow, index) => {
565
+ const ambient = sample.ambient;
566
+ const at = ambient?.flow ?? (ambient ? ambient.breath : null);
567
+ const head = at === null ? -1 : Math.floor(((at + index * 0.17) % 1) * PULSE_CELLS);
568
+ return Array.from({ length: PULSE_CELLS }, (_, cell) => {
569
+ const base = rainbow ? rainbow(cell / PULSE_CELLS + index * 0.1) : PILL.rail;
570
+ return span("━", { fg: cell === head ? lerpColor(base, "#ffffff", rainbow ? 0.45 : 0.7) : rainbow ? lerpColor(base, PALETTE.faint, 0.35) : base });
571
+ });
572
+ };
573
+ const gaugeSpans = (text, rainbow, index) => {
574
+ if (!rainbow) return [span(text, { fg: PALETTE.white })];
575
+ const [, cells, count] = /^\[([▉░]+)\](.*)$/u.exec(text);
576
+ return [
577
+ span("[", { fg: PALETTE.white }),
578
+ ...[...cells].map((cell, i) => span(cell, { fg: cell === "▉" ? rainbow(i / cells.length + index * 0.1) : PALETTE.dim })),
579
+ span(`]${count}`, { fg: PALETTE.white }),
580
+ ];
581
+ };
582
+ const progressSpans = (thread, sample, rainbow, index, color) => {
583
+ const drawn = gauge(thread.done, thread.total);
584
+ if (drawn) return [span(" "), ...gaugeSpans(drawn, rainbow, index), span(` ${thread.state}`, { fg: color })];
585
+ const facts = knownFacts({ steps: thread.steps, elapsedMs: thread.elapsedMs, last: thread.last, state: thread.state });
586
+ const words = facts.startsWith(thread.state)
587
+ ? [span(facts, { fg: color })]
588
+ : [span(thread.state, { fg: color }), span(` · ${facts}`, { fg: PALETTE.dim })];
589
+ return [span(" "), ...pulseSpans(sample, rainbow, index), span(" "), ...words];
590
+ };
591
+
592
+ const threadRows = (model, sample, { inner, glyphs, rainbow }) => {
539
593
  const { chain, lanes, others, more, reserve } = model.threads;
540
594
  const lines = [];
541
595
  chain.forEach((thread, index) => lines.push({ thread, lead: index === 0 ? "" : `${" ".repeat(index - 1)}└─ `, last: true }));
@@ -571,8 +625,7 @@ const threadRows = (model, { inner, glyphs }) => {
571
625
  span(`${glyph} `, { fg: color }),
572
626
  span(name + " ".repeat(Math.max(0, nameWidth - textWidth(name))), { fg: line.last ? THREAD_NAME.last : THREAD_NAME.mid, bold: thread.active }),
573
627
  ...(stageWidth ? [span(` ${(thread.stage ?? "").slice(0, stageWidth).padEnd(stageWidth)}`, { fg: PALETTE.dim })] : []),
574
- span(` ${gauge(thread.done, thread.total)}`, { fg: PALETTE.white }),
575
- span(` ${thread.state}`, { fg: color }),
628
+ ...progressSpans(thread, sample, rainbow, index, color),
576
629
  ...(thread.session ? [span(` · other session ${thread.session}`, { fg: PALETTE.dim })] : []),
577
630
  ];
578
631
  }
@@ -622,6 +675,13 @@ const sparkled = (row, inner, sample, rainbow) => {
622
675
  return fitRow([...row, span(" "), ...sky], inner);
623
676
  };
624
677
 
678
+ // After a break the idle card offers the cross-session brief, in the longest form that fits.
679
+ const AWAY_HINTS = Object.freeze([[" · back? type ", "lit adhd", " to catch up"], [" · back? ", "lit adhd", ""], [" ", "lit adhd", ""]]);
680
+ const awayHint = (room, accent) => {
681
+ const hint = AWAY_HINTS.find((parts) => textWidth(parts.join("")) <= room);
682
+ return hint ? [span(hint[0], { fg: PALETTE.dim }), span(hint[1], { fg: accent }), ...(hint[2] ? [span(hint[2], { fg: PALETTE.dim })] : [])] : [];
683
+ };
684
+
625
685
  const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
626
686
  const chips = model.skills;
627
687
  if (chips.length === 0) {
@@ -638,7 +698,9 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
638
698
  let shown = 0;
639
699
  for (const chip of chips) {
640
700
  // While LitClaude works the light that crosses the active phase crosses this request's chips too.
641
- const entry = chipSpans(chip, sample.chips?.[chip.id], glyphs, accent, model.idle ? null : sample.ambient?.sweep ?? null);
701
+ const entry = rainbow && lookOf(chip.id) === "rewind"
702
+ ? rainbowPill(`${chip.state === "current" ? glyphs.bolt : glyphs.recentBolt} ${chip.id}`, rainbow, 0.5, glyphs)
703
+ : chipSpans(chip, sample.chips?.[chip.id], glyphs, accent, model.idle ? null : sample.ambient?.sweep ?? null);
642
704
  const gap = row.length ? [span(" ")] : [];
643
705
  const rest = chips.length - shown - 1;
644
706
  const reserve = rest > 0 ? 1 + rowWidth(mutedPill(`+${rest}`, glyphs)) : 0;
@@ -647,6 +709,7 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
647
709
  shown += 1;
648
710
  }
649
711
  if (shown < chips.length) row.push(...(row.length ? [span(" ")] : []), ...mutedPill(`+${chips.length - shown}`, glyphs));
712
+ if (model.away) return fitRow([...row, ...awayHint(inner - rowWidth(row), accent)], inner);
650
713
  return sparkled(row, inner, sample, rainbow);
651
714
  };
652
715
 
@@ -690,7 +753,7 @@ const levelColor = (percent) => (percent >= 90 ? HUD.red : percent >= 70 ? HUD.y
690
753
 
691
754
  // ╰─ ctx 42% ▰▰▱▱▱ · 5h 31% · 1w 12% · git main ───╯, or a warning first when one is up. The branch goes
692
755
  // first on a narrow card, then the weekly window, the five-hour one and the context bar.
693
- const bottomEdge = (model, sample, { width, glyphs, accent, edge, look, paint }) => {
756
+ const bottomEdge = (model, sample, { width, glyphs, accent, edge, look, paint, rainbow }) => {
694
757
  const { context, rates, git } = model.figures;
695
758
  const warning = model.warnings[0];
696
759
  const segments = [];
@@ -699,9 +762,13 @@ const bottomEdge = (model, sample, { width, glyphs, accent, edge, look, paint })
699
762
  segments.push(segment("warning", 0, [span(`${warning.tone === "red" ? glyphs.fail : "⚠"} ${warning.subject}`, { fg: color, bold: true }), span(` ${warning.text}`, { fg: color })], " · "));
700
763
  }
701
764
  if (context !== null) {
702
- segments.push(segment("ctx", 1, [span("ctx ", { fg: PALETTE.dim }), span(`${context}%`, { fg: accent })], " · "));
765
+ segments.push(segment("ctx", 1, [span("ctx ", { fg: PALETTE.dim }), span(`${context}%`, { fg: rainbow ? rainbow(0.8) : accent, bold: Boolean(rainbow) })], " · "));
703
766
  const filled = Math.max(0, Math.min(5, Math.round(context / 20)));
704
- segments.push(segment("ctxbar", 2, [span("▰".repeat(filled), { fg: accent }), span("▱".repeat(5 - filled), { fg: HUD.empty })], " "));
767
+ // The rewind look turns every cell of the bar, filled or not, so even 0% shows the colour.
768
+ const cells = rainbow
769
+ ? [...Array(5)].map((_, i) => span(i < filled ? "▰" : "▱", { fg: i < filled ? rainbow(i / 5) : lerpColor(rainbow(i / 5), HUD.empty, 0.5) }))
770
+ : [span("▰".repeat(filled), { fg: accent }), span("▱".repeat(5 - filled), { fg: HUD.empty })];
771
+ segments.push(segment("ctxbar", 2, cells, " "));
705
772
  }
706
773
  rates.forEach((rate, index) => segments.push(segment(`rate-${rate.label}`, 3 + index * 0.5, [span(`${rate.label} `, { fg: PALETTE.dim }), span(`${rate.percent}%`, { fg: levelColor(rate.percent) })], " · ")));
707
774
  if (git) segments.push(segment("git", 4, [span(`${glyphs.branch} `, { fg: PALETTE.dim }), span(git, { fg: accent })], " · "));
@@ -736,7 +803,7 @@ export const composeBand = (model, sample, { columns, glyphs: glyphMode = "basic
736
803
  const edge = edgeColor(model, sample, accent);
737
804
  // The rewind look's rainbow turns with the ambient hue (still at 0 with motion off). A warning
738
805
  // keeps the border its warning colour; the rails stay rainbow.
739
- const look = model.idle ? null : lookOf(model.discipline);
806
+ const look = model.rewind ? "rewind" : model.idle ? null : lookOf(model.discipline);
740
807
  const hue = sample.ambient?.hue ?? 0;
741
808
  const rainbow = look === "rewind" ? (position) => rainbowAt(position + hue) : null;
742
809
  const painted = rainbow && model.warnings.length === 0;
@@ -755,7 +822,7 @@ export const composeBand = (model, sample, { columns, glyphs: glyphMode = "basic
755
822
  topEdge(model, sample, options),
756
823
  side(model.workflow ? mapRow(model, sample, options) : phaseRow(model, sample, options), 1),
757
824
  side(detailRow(model, sample, options), 2),
758
- ...(model.threads ? threadRows(model, options).map((row) => side(row, 2)) : []),
825
+ ...(model.threads ? threadRows(model, sample, options).map((row) => side(row, 2)) : []),
759
826
  side(middle, 3),
760
827
  bottomEdge(model, sample, options),
761
828
  ],
@@ -20,7 +20,7 @@
20
20
  // Text is set in a monospace face and placed by counted cells (Hangul and emoji as two), so the
21
21
  // layout does not depend on measuring a font the drawing cannot see.
22
22
 
23
- import { gauge } from "../rewind/gauge.mjs";
23
+ import { gauge, knownFacts } from "../rewind/gauge.mjs";
24
24
  import { textWidth, truncateToWidth } from "./layout.mjs";
25
25
  import { TIMINGS, barCells, gradientAt, lookOf, rainbowAt } from "./motion.mjs";
26
26
 
@@ -88,10 +88,12 @@ const run = (x, y, pieces) => {
88
88
  };
89
89
 
90
90
  // A filled pill holding `label`, its left edge at `x`. `sweep` lays the moving light over it.
91
- const pill = (x, y, label, { fill, ink, bold = true, sweep = false, breath = null, breathPeak = 0.85 }) => {
91
+ // `veil` lays white over a rainbow fill so the dark ink keeps its contrast on every hue.
92
+ const pill = (x, y, label, { fill, ink, bold = true, sweep = false, breath = null, breathPeak = 0.85, veil = false }) => {
92
93
  const w = widthOf(label) + 16;
93
94
  const top = y - PILL_H + 6;
94
95
  const parts = [`<rect x="${x.toFixed(1)}" y="${top}" width="${w.toFixed(1)}" height="${PILL_H}" rx="${PILL_H / 2}" fill="${fill}"/>`];
96
+ if (veil) parts.push(`<rect x="${x.toFixed(1)}" y="${top}" width="${w.toFixed(1)}" height="${PILL_H}" rx="${PILL_H / 2}" fill="#ffffff" opacity="0.3"/>`);
95
97
  if (breath) parts.push(`<rect x="${x.toFixed(1)}" y="${top}" width="${w.toFixed(1)}" height="${PILL_H}" rx="${PILL_H / 2}" fill="${breath}" opacity="0"><animate attributeName="opacity" values="0;${breathPeak};0" ${loop(TIMINGS.breath, BREATH_PHASE)}/></rect>`);
96
98
  if (sweep) parts.push(`<rect x="${x.toFixed(1)}" y="${top}" width="${w.toFixed(1)}" height="${PILL_H}" rx="${PILL_H / 2}" fill="url(#lit-sweep)"/>`);
97
99
  parts.push(text(x + 8, y, label, { fill: ink, bold }));
@@ -111,15 +113,18 @@ const indicatorOf = (model, accent) => {
111
113
  return { label: "LIVE ●", fill: accent };
112
114
  };
113
115
 
114
- const topRow = (model, accent, animate) => {
116
+ // The rewind look draws the LIT pill and a `REWIND <<` indicator in the turning rainbow.
117
+ const topRow = (model, accent, animate, rewind = false) => {
115
118
  const { width, pad } = SVG_CARD;
116
119
  const y = ROW_Y[0];
117
- const brand = pill(pad, y, "🔥 LIT", { fill: C.pink, ink: C.ink, breath: animate.breath ? C.orange : null });
118
- const indicator = indicatorOf(model, accent);
120
+ const brand = rewind
121
+ ? pill(pad, y, "🔥 LIT", { fill: "url(#lit-rainbow)", ink: C.ink, veil: true })
122
+ : pill(pad, y, "🔥 LIT", { fill: C.pink, ink: C.ink, breath: animate.breath ? C.orange : null });
123
+ const indicator = rewind && !model.completion ? { label: "REWIND <<", fill: "url(#lit-rainbow)" } : indicatorOf(model, accent);
119
124
  const right = text(width - pad, y, indicator.label, { fill: indicator.fill, bold: !indicator.plain, anchor: "end" });
120
125
  const room = width - pad - widthOf(indicator.label) - 16 - brand.end - widthOf(" · ");
121
126
  const name = truncateToWidth(model.title ?? "ready", Math.max(4, Math.floor(room / SVG_CARD.cell)));
122
- const title = run(brand.end + 4, y, [[" · ", { fill: C.dim }], [name, model.idle ? { fill: C.dim } : { fill: accent, bold: true }]]);
127
+ const title = run(brand.end + 4, y, [[" · ", { fill: C.dim }], [name, model.idle && !rewind ? { fill: C.dim } : { fill: accent, bold: true }]]);
123
128
  return brand.markup + title.markup + right;
124
129
  };
125
130
 
@@ -298,7 +303,7 @@ const detailRowSvg = (model, accent, animate) => {
298
303
  const TONES = Object.freeze({ pink: [C.pink, "#ff6fae", "🔥"], amber: [C.amber, C.amber, "⚠"], red: [C.red, C.red, "✗"] });
299
304
 
300
305
  // Skill chips, or the notice or the finish while one is up, or the hint while nothing has fired.
301
- const middleRow = (model, accent, animate, shift = 0) => {
306
+ const middleRow = (model, accent, animate, shift = 0, rewind = false) => {
302
307
  const { width, pad } = SVG_CARD;
303
308
  const y = ROW_Y[3] + shift;
304
309
  const room = width - pad;
@@ -328,13 +333,33 @@ const middleRow = (model, accent, animate, shift = 0) => {
328
333
  x = null;
329
334
  return;
330
335
  }
331
- const drawn = pill(x, y, label, { fill: current ? accent : C.muted, ink: current ? C.ink : C.mutedText, bold: current, sweep: current && animate.sweep });
336
+ const tinted = rewind && lookOf(chip.id) === "rewind";
337
+ const drawn = tinted
338
+ ? pill(x, y, label, { fill: "url(#lit-rainbow)", ink: C.ink, veil: true, sweep: animate.sweep })
339
+ : pill(x, y, label, { fill: current ? accent : C.muted, ink: current ? C.ink : C.mutedText, bold: current, sweep: current && animate.sweep });
332
340
  out.push(drawn.markup);
333
341
  x = drawn.end + 8;
334
342
  });
343
+ if (rewind && animate.sweep && x !== null) out.push(sparksSvg(x, width - pad, y));
344
+ if (model.away && x !== null && x + widthOf("back? type lit adhd to catch up") <= room) out.push(run(x, y, [["back? type ", { fill: C.dim }], ["lit adhd", { fill: accent }], [" to catch up", { fill: C.dim }]]).markup);
335
345
  return out.join("");
336
346
  };
337
347
 
348
+ // The rewind look's sparks: ASCII stars drifting right to left through the room the chips leave,
349
+ // each fading in and out on its own slow loop (no faster than TIMINGS.sparks / 4 per twinkle).
350
+ const SPARK_SEEDS = Object.freeze([[0.08, 1.0, "*"], [0.22, 1.3, "+"], [0.37, 0.8, "."], [0.51, 1.1, "*"], [0.66, 0.9, "'"], [0.79, 1.4, "+"], [0.93, 0.7, "*"]]);
351
+ const sparksSvg = (from, to, y) => {
352
+ const span = to - from;
353
+ if (span < 60) return "";
354
+ return SPARK_SEEDS.map(([start, speed, glyph], i) => {
355
+ const x = from + start * span;
356
+ const dur = Math.round(TIMINGS.sparks / speed);
357
+ return `<text class="lit-spark" x="${x.toFixed(1)}" y="${y}" fill="${rainbowAt(start)}" opacity="0.8">${esc(glyph)}`
358
+ + `<animateTransform attributeName="transform" type="translate" values="0 0;${(-start * span).toFixed(1)} 0" ${loop(dur, 0)}/>`
359
+ + `<animate attributeName="opacity" values="0.3;0.9;0.3" ${loop(Math.round(TIMINGS.sparks / 2), i / SPARK_SEEDS.length)}/></text>`;
360
+ }).join("");
361
+ };
362
+
338
363
  // ctx 42% ▰▰▱▱▱ · 5h 31% · 1w 12% · git main, after a warning when one is up.
339
364
  const bottomRow = (model, accent, shift = 0) => {
340
365
  const { width, pad } = SVG_CARD;
@@ -374,16 +399,26 @@ const THREAD_FILL = Object.freeze({ running: ["●", C.green], paused: ["|", C.d
374
399
  const TASK_MARK = Object.freeze({ shell: "$", monitor: "~" });
375
400
  const plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
376
401
 
377
- // A gauge whose count is a lane's finished steps moves on every tool call it makes, and each new
378
- // drawing restarts the card's animations; past ten the drawing counts steps by tens.
379
- const threadGauge = ({ done, total, steps }) => (steps && total === null && done >= 10 ? `[???] ${Math.floor(done / 10) * 10}+/?` : gauge(done, total));
402
+ // What a thread with no total says instead of a gauge. Each new drawing restarts the card's
403
+ // animations, so the drawing leaves out the last step (it changes on every tool call) and counts
404
+ // steps by tens past ten.
405
+ const threadFacts = ({ steps, elapsedMs, state }) => knownFacts({ steps: Number.isInteger(steps) && steps >= 10 ? Math.floor(steps / 10) * 10 : steps, elapsedMs, state })
406
+ .replace(/^(\d+0) steps/u, (all, n) => (steps >= 10 ? `${n}+ steps` : all));
407
+ const PULSE = "━━━━━";
408
+ // The indeterminate pulse over a thread with no total: a light that slides along its track, or a
409
+ // still track with motion off.
410
+ const pulseSvg = (x, y, animate, fill) => {
411
+ const w = widthOf(PULSE);
412
+ if (!animate) return "";
413
+ return `<rect x="${x.toFixed(1)}" y="${y - 8}" width="${(w / 3).toFixed(1)}" height="4" rx="2" fill="${fill}" opacity="0.9"><animate attributeName="x" values="${x.toFixed(1)};${(x + (w * 2) / 3).toFixed(1)};${x.toFixed(1)}" ${loop(TIMINGS.flow * 2, 0.25)}/></rect>`;
414
+ };
380
415
 
381
416
  /**
382
417
  * The thread rows (view.mjs threadsOf), as the terminal card lays them out (frame.mjs threadRows):
383
418
  * the stack parent first with each child under it, lanes and background tasks under a fork line
384
419
  * when two or more run, other sessions last, `+N more` on the last row. Returns the markup.
385
420
  */
386
- const threadRowsSvg = (model) => {
421
+ const threadRowsSvg = (model, { animate = false, rewind = false } = {}) => {
387
422
  const { width, pad } = SVG_CARD;
388
423
  const { chain, lanes, others, laneCount = 0, taskCount = 0, more } = model.threads;
389
424
  const lines = [];
@@ -414,13 +449,18 @@ const threadRowsSvg = (model) => {
414
449
  const [stateMark, color] = THREAD_FILL[thread.state] ?? THREAD_FILL.running;
415
450
  const mark = thread.task ? TASK_MARK[thread.task] ?? "$" : stateMark;
416
451
  const name = truncateToWidth(thread.name, nameCells);
452
+ const drawn = gauge(thread.done, thread.total);
453
+ const facts = drawn ? null : threadFacts(thread);
454
+ const progress = drawn
455
+ ? [[` ${drawn}`, { fill: C.white }], [` ${thread.state}`, { fill: color }]]
456
+ : [[" ", {}], [PULSE, { fill: rewind ? "url(#lit-rainbow)" : C.rail, pulse: true }], [" ", {}],
457
+ ...(facts.startsWith(thread.state) ? [[facts, { fill: color }]] : [[thread.state, { fill: color }], [` · ${facts}`, { fill: C.dim }]])];
417
458
  const pieces = [
418
459
  [line.lead, { fill: C.dim }],
419
460
  [`${mark} `, { fill: color, bold: true }],
420
461
  [name + " ".repeat(Math.max(0, nameCells - textWidth(name))), { fill: C.white, bold: thread.active }],
421
462
  ...(stageCells ? [[` ${truncateToWidth(thread.stage ?? "", stageCells).padEnd(stageCells)}`, { fill: C.dim }]] : []),
422
- [` ${threadGauge(thread)}`, { fill: C.white }],
423
- [` ${thread.state}`, { fill: color }],
463
+ ...progress,
424
464
  ...(thread.session ? [[` · other session ${thread.session}`, { fill: C.dim }]] : []),
425
465
  ];
426
466
  // Pieces past the room are cut from the right, as the terminal card clips its rows.
@@ -436,6 +476,8 @@ const threadRowsSvg = (model) => {
436
476
  used += cells;
437
477
  }
438
478
  out.push(run(pad, y, kept).markup);
479
+ const before = kept.findIndex(([, style]) => style.pulse);
480
+ if (before >= 0) out.push(pulseSvg(pad + kept.slice(0, before).reduce((sum, [body]) => sum + widthOf(body), 0), y, animate, rewind ? "#ffffff" : C.white));
439
481
  });
440
482
  return out.join("");
441
483
  };
@@ -461,7 +503,7 @@ const rainbowDefs = (animate) => {
461
503
 
462
504
  /** What the card says, for a reader that cannot see the drawing. */
463
505
  export const svgCardAlt = (model) => {
464
- const parts = [`LIT ${model.idle ? "idle" : "working"}`];
506
+ const parts = [`LIT ${model.rewind ? "rewind" : model.idle ? "idle" : "working"}`];
465
507
  if (model.title) parts.push(model.title);
466
508
  const flow = model.workflow;
467
509
  const current = PHASES.find((id) => model.phases[id] === "now");
@@ -474,7 +516,7 @@ export const svgCardAlt = (model) => {
474
516
  }
475
517
  if (model.step) parts.push(`running ${model.step.name}`);
476
518
  const threads = model.threads ? [...model.threads.chain, ...model.threads.lanes, ...model.threads.others] : [];
477
- if (threads.length) parts.push(`threads ${threads.map((thread) => `${thread.name} ${gauge(thread.done, thread.total)} ${thread.state}`).join(", ")}${model.threads.more ? `, ${model.threads.more} more` : ""}`);
519
+ if (threads.length) parts.push(`threads ${threads.map((thread) => `${thread.name} ${gauge(thread.done, thread.total) ? `${gauge(thread.done, thread.total)} ${thread.state}` : threadFacts(thread)}`).join(", ")}${model.threads.more ? `, ${model.threads.more} more` : ""}`);
478
520
  if (model.skills.length) parts.push(`skills ${model.skills.map(({ id }) => id).join(", ")}`);
479
521
  const { context, rates } = model.figures;
480
522
  if (context !== null) parts.push(`context ${context}%`);
@@ -491,15 +533,15 @@ export const composeSvgCard = (model, { motion = "full", accent = "#5fd7ff" } =
491
533
  // The thread rows sit between the detail line and the chips; the card grows by their reserve.
492
534
  const shift = model.threads ? THREAD_ROW_H * model.threads.reserve : 0;
493
535
  const height = SVG_CARD.height + shift;
494
- const working = !model.idle && motion !== "off";
536
+ const rewind = (model.rewind === true || (!model.idle && lookOf(model.discipline) === "rewind")) && model.warnings.length === 0;
537
+ const working = (!model.idle || rewind) && motion !== "off";
495
538
  const animate = { breath: working, sweep: working && motion === "full", comet: working && motion === "full" };
496
- const rewind = !model.idle && model.warnings.length === 0 && lookOf(model.discipline) === "rewind";
497
539
  const edge = rewind ? "url(#lit-rainbow)" : borderColor(model, accent);
498
540
  const perimeter = 1000;
499
541
  const defs = (rewind ? rainbowDefs(animate.breath) : "") + (animate.sweep
500
542
  ? `<defs><linearGradient id="lit-sweep" x1="0" x2="1" y1="0" y2="0"><stop offset="0" stop-color="#fff" stop-opacity="0"/><stop offset="0.5" stop-color="#fff" stop-opacity="0.55"/><stop offset="1" stop-color="#fff" stop-opacity="0"/><animateTransform attributeName="gradientTransform" type="translate" values="-1.2 0;1.2 0" ${loop(TIMINGS.sweep, 0.5)}/></linearGradient></defs>`
501
543
  : "");
502
- const frame = `<rect x="1" y="1" width="${width - 2}" height="${height - 2}" rx="14" fill="${C.bg}" stroke="${edge}" stroke-width="${model.idle ? "1.5" : "2.5"}"${model.idle ? ' stroke-opacity="0.8"' : ""}>`
544
+ const frame = `<rect x="1" y="1" width="${width - 2}" height="${height - 2}" rx="14" fill="${C.bg}" stroke="${edge}" stroke-width="${model.idle && !rewind ? "1.5" : "2.5"}"${model.idle && !rewind ? ' stroke-opacity="0.8"' : ""}>`
503
545
  + (animate.breath && !model.warnings.length ? `<animate attributeName="stroke-opacity" values="0.85;1;0.85" ${loop(TIMINGS.breath, BREATH_PHASE)}/>` : "")
504
546
  + "</rect>";
505
547
  const comet = animate.comet
@@ -507,11 +549,11 @@ export const composeSvgCard = (model, { motion = "full", accent = "#5fd7ff" } =
507
549
  + `<defs><linearGradient id="lit-comet" x1="0" x2="1" y1="0" y2="1"><stop offset="0" stop-color="${C.orange}"/><stop offset="0.6" stop-color="${C.pink}"/><stop offset="1" stop-color="#ffffff"/></linearGradient></defs>`
508
550
  : "";
509
551
  const body = [
510
- topRow(model, accent, animate),
552
+ topRow(model, accent, animate, rewind),
511
553
  model.workflow ? mapRowSvg(model, accent, animate) : phaseRow(model, accent, animate),
512
554
  detailRowSvg(model, accent, animate),
513
- model.threads ? threadRowsSvg(model) : "",
514
- middleRow(model, accent, animate, shift),
555
+ model.threads ? threadRowsSvg(model, { animate: animate.sweep, rewind }) : "",
556
+ middleRow(model, accent, animate, shift, rewind),
515
557
  bottomRow(model, accent, shift),
516
558
  ].join("");
517
559
  const source = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" font-family="${FONT}" font-size="${SVG_CARD.font}">${defs}${frame}${comet}${body}</svg>`;
@@ -37,10 +37,11 @@ const chipsOf = (model, now, previous = null) => Object.fromEntries((model.skill
37
37
  return [chip.id, known];
38
38
  }));
39
39
 
40
- // The ambient loop runs while the card shows LitClaude at work, so motion itself says "active";
41
- // `at` is when the current run of work began, so the loop does not restart on every new model.
40
+ // The ambient loop runs while the card shows LitClaude at work, so motion itself says "active",
41
+ // and while the rewind look lingers after a brief; `at` is when the current run began, so the loop
42
+ // does not restart on every new model.
42
43
  const ambientOf = (model, now, profile, previous = null) => {
43
- const on = Boolean(profile.ambient) && model.visible && !model.idle;
44
+ const on = Boolean(profile.ambient) && model.visible && (!model.idle || model.rewind === true);
44
45
  return { on, at: on && previous?.on ? previous.at : now };
45
46
  };
46
47
 
@@ -2,6 +2,7 @@
2
2
  // (skills.mjs) and what Claude Code reports live (subagents, context and rate-limit usage). Pure: the mod calls these on each refresh and hands the result to the
3
3
  // band's surface module, which only draws and animates it.
4
4
 
5
+ import { lookOf } from "./motion.mjs";
5
6
  import { AUTOLOOP_LIMITS, GATE_LIMITS } from "./state.mjs";
6
7
  import { buildWorkflow } from "./workflow.mjs";
7
8
 
@@ -13,6 +14,13 @@ export const AGENT_STALE_MS = 30 * 60 * 1000;
13
14
  // The context warning starts this many points before the auto-handoff percent.
14
15
  export const CONTEXT_LEAD = 5;
15
16
 
17
+ // How long the rewind look stays after `lit adhd` was sent. The ignition keeps naming lit-adhd
18
+ // until the next prompt, so the look lasts while the user reads the brief, but no longer than this.
19
+ export const REWIND_LINGER_MS = 15 * 60 * 1000;
20
+
21
+ // How long the card must have sat idle since its newest skill before it offers `lit adhd`.
22
+ export const BREAK_MS = 30 * 60 * 1000;
23
+
16
24
  const LIVE_AGENT = new Set(["running", "pending", "waiting", "idle"]);
17
25
  const ENDED_AGENT = new Set(["completed", "failed", "killed"]);
18
26
  const NONTERMINAL_GOAL = new Set(["active", "blocked", "review_blocked", "needs_user_decision"]);
@@ -97,14 +105,24 @@ const countOrNull = (value) => (Number.isInteger(value) && value >= 0 ? value :
97
105
 
98
106
  // `lists` maps a loop (`main`, or a subagent's id) to what its tool calls say of its progress:
99
107
  // `steps`, the tool calls it finished; `todos`, the counts of its last TodoWrite; `tasks`, the
100
- // status of each task it created with TaskCreate (TaskUpdate moves them); `latest`, which of the two
101
- // lists it touched last. Only statuses are kept, never a todo's or a task's text.
108
+ // status of each task it created with TaskCreate (TaskUpdate moves them, and may give one to a lane
109
+ // by `owner`); `latest`, which of the two lists it touched last; `last`, its last finished step as a
110
+ // tool name and at most a file's base name. Only statuses are kept, never a todo's or a task's text.
102
111
  export const EMPTY_LISTS = Object.freeze({});
103
112
  const LIST_CAP = 200;
104
113
  const LOOP_CAP = 40;
105
114
  const TASK_STATUS = new Set(["pending", "in_progress", "completed"]);
106
115
 
107
- const loopEntry = (lists, loop) => lists[loop] ?? { steps: 0, todos: null, tasks: {}, latest: null };
116
+ const loopEntry = (lists, loop) => lists[loop] ?? { steps: 0, todos: null, tasks: {}, latest: null, last: null };
117
+ const OWNER = /^[\w .:-]{1,40}$/u;
118
+ // `Edit README.md`: the tool and the base name of the file it touched, nothing of its arguments.
119
+ const lastStepOf = (call) => {
120
+ const tool = stepName(call?.tool);
121
+ if (!tool) return null;
122
+ const path = typeof call.file_path === "string" ? call.file_path : typeof call.notebook_path === "string" ? call.notebook_path : null;
123
+ const base = path ? path.split(/[\\/]/u).pop().replace(/[^\w .@+-]/gu, "").slice(0, 28) : "";
124
+ return base ? `${tool} ${base}` : tool;
125
+ };
108
126
 
109
127
  /**
110
128
  * Folds one finished tool call of `loop` into `lists`: every call counts a step, a TodoWrite
@@ -116,6 +134,7 @@ export const noteLoopCall = (lists, loop, call, result) => {
116
134
  const next = { ...lists };
117
135
  const entry = { ...loopEntry(lists, loop) };
118
136
  entry.steps += 1;
137
+ entry.last = lastStepOf(call) ?? entry.last ?? null;
119
138
  if (call?.tool === "TodoWrite" && Array.isArray(call.todos)) {
120
139
  const todos = call.todos.slice(0, LIST_CAP);
121
140
  entry.todos = { done: todos.filter((todo) => todo?.status === "completed").length, total: todos.length };
@@ -123,13 +142,16 @@ export const noteLoopCall = (lists, loop, call, result) => {
123
142
  } else if (call?.tool === "TaskCreate" && typeof result?.task?.id === "string") {
124
143
  entry.tasks = { ...entry.tasks, [result.task.id.slice(0, 64)]: { status: "pending", seen: true } };
125
144
  entry.latest = "tasks";
126
- } else if (call?.tool === "TaskUpdate" && typeof call.taskId === "string" && (TASK_STATUS.has(call.status) || call.status === "deleted")) {
145
+ } else if (call?.tool === "TaskUpdate" && typeof call.taskId === "string" && (TASK_STATUS.has(call.status) || call.status === "deleted" || typeof call.owner === "string")) {
127
146
  const id = call.taskId.slice(0, 64);
128
147
  const owner = Object.keys(next).find((key) => key !== loop && next[key].tasks?.[id]);
129
148
  const target = owner ? { ...next[owner] } : entry;
130
149
  const tasks = { ...target.tasks };
131
150
  if (call.status === "deleted") delete tasks[id];
132
- else tasks[id] = { status: call.status, seen: tasks[id]?.seen ?? false };
151
+ else if (TASK_STATUS.has(call.status) || tasks[id]) {
152
+ const assignee = typeof call.owner === "string" && OWNER.test(call.owner.trim()) ? call.owner.trim() : tasks[id]?.owner;
153
+ tasks[id] = { status: TASK_STATUS.has(call.status) ? call.status : tasks[id].status, seen: tasks[id]?.seen ?? false, ...(assignee ? { owner: assignee } : {}) };
154
+ }
133
155
  target.tasks = Object.fromEntries(Object.entries(tasks).slice(-LIST_CAP));
134
156
  target.latest = "tasks";
135
157
  if (owner) next[owner] = target;
@@ -151,6 +173,13 @@ export const listProgress = (entry) => {
151
173
  return entry.todos ?? fromTasks;
152
174
  };
153
175
 
176
+ // The tasks any loop's list gave to `owner` by name, as `{ done, total }`, or null when none did.
177
+ const ownedProgress = (lists, owner) => {
178
+ if (!owner) return null;
179
+ const owned = Object.values(lists).flatMap((entry) => Object.values(entry?.tasks ?? {})).filter((task) => task.owner === owner);
180
+ return owned.length ? { done: owned.filter(({ status }) => status === "completed").length, total: owned.length } : null;
181
+ };
182
+
154
183
  // `tasks` maps a background task's id to `{ id, kind, name, at, until }`: a shell a Bash call left
155
184
  // running (its own `backgroundTaskId`) or a monitor, named by the call's description, never its
156
185
  // command. `until` is a monitor's deadline. A task ends with its notification, a TaskStop, its
@@ -207,8 +236,11 @@ const frameCount = (frame, snapshot, mainList) => {
207
236
  return mainList ?? { done: countOrNull(record?.n), total: null };
208
237
  };
209
238
 
210
- const frameThread = (frame, index, snapshot, active, mainList = null) => {
239
+ // A thread with no total carries what is known instead: its finished steps, how long it has run
240
+ // and its last step (knownFacts in rewind/gauge.mjs words them).
241
+ const frameThread = (frame, index, snapshot, active, mainList = null, now = null, mainEntry = null) => {
211
242
  const { done, total } = frameCount(frame, snapshot, active ? mainList : null);
243
+ const started = Number.isFinite(frame.at) ? frame.at : frame.record?.at;
212
244
  return {
213
245
  key: `frame-${index}`,
214
246
  name: frame.skill ?? frame.record?.family ?? "work",
@@ -217,11 +249,15 @@ const frameThread = (frame, index, snapshot, active, mainList = null) => {
217
249
  total,
218
250
  state: frame.record?.done ? "done" : frame.status === "paused" ? "paused" : frame.skill === "start-work" && snapshot.work?.status === "paused" ? "blocked" : "running",
219
251
  active,
252
+ steps: active && mainEntry ? mainEntry.steps : null,
253
+ last: active && mainEntry ? mainEntry.last ?? null : null,
254
+ elapsedMs: Number.isFinite(now) && Number.isFinite(started) ? Math.max(0, now - started) : null,
220
255
  };
221
256
  };
222
257
 
223
- // A lane's k/n: its own todo or task list, else the steps it has finished over an unknown total.
224
- const laneCount = (entry) => listProgress(entry) ?? { done: entry?.steps ?? 0, total: null, steps: true };
258
+ // A lane's k/n: its own todo or task list, then the tasks a loop gave it by name; else no total,
259
+ // with the steps it has finished and its last one.
260
+ const laneCount = (entry, lists, name) => listProgress(entry) ?? ownedProgress(lists, name) ?? { done: null, total: null, steps: entry?.steps ?? 0, last: entry?.last ?? null };
225
261
 
226
262
  /**
227
263
  * The live threads, or null while there is at most one: `{ chain, lanes, others, laneCount,
@@ -235,20 +271,21 @@ const laneCount = (entry) => listProgress(entry) ?? { done: entry?.steps ?? 0, t
235
271
  const threadsOf = ({ snapshot, lanes, tasks, lists, now, threadReserve }) => {
236
272
  const frames = snapshot.workflow?.stack?.frames ?? [];
237
273
  const mainList = listProgress(lists.main);
238
- const chain = frames.map((frame, index) => frameThread(frame, index, snapshot, index === frames.length - 1, mainList));
274
+ const chain = frames.map((frame, index) => frameThread(frame, index, snapshot, index === frames.length - 1, mainList, now, lists.main));
239
275
  const laneThreads = lanes.map((lane, index) => ({
240
276
  key: `lane-${lane.id ?? index}`,
241
277
  name: lane.name,
242
278
  stage: null,
243
- ...laneCount(lane.id ? lists[lane.id] : null),
279
+ ...laneCount(lane.id ? lists[lane.id] : null, lists, lane.name),
244
280
  state: lane.status === "stalled" ? "blocked" : lane.status === "idle" ? "idle" : "running",
245
281
  active: false,
282
+ elapsedMs: Number.isFinite(lane.elapsedMs) ? lane.elapsedMs : null,
246
283
  }));
247
- const taskThreads = tasks.map((task) => ({ key: `task-${task.id}`, name: task.name, stage: task.kind, done: null, total: null, state: "running", active: false, task: task.kind }));
284
+ const taskThreads = tasks.map((task) => ({ key: `task-${task.id}`, name: task.name, stage: task.kind, done: null, total: null, state: "running", active: false, task: task.kind, elapsedMs: Number.isFinite(task.at) ? Math.max(0, now - task.at) : null }));
248
285
  const parallel = [...laneThreads, ...taskThreads];
249
286
  const others = (snapshot.workflow?.others ?? [])
250
287
  .filter((other) => Number.isFinite(other.at) && now - other.at <= OTHER_SESSION_MS && other.frames?.length)
251
- .map((other) => ({ ...frameThread(other.frames.at(-1), 0, {}, false), key: `session-${other.id8}`, session: other.id8 }));
288
+ .map((other) => ({ ...frameThread(other.frames.at(-1), 0, {}, false, null, now), key: `session-${other.id8}`, session: other.id8 }));
252
289
  const total = chain.length + parallel.length + others.length;
253
290
  if (total < 2) return null;
254
291
  const room = Math.max(PARALLEL_ROWS, THREAD_ROWS - chain.length);
@@ -382,10 +419,13 @@ export const buildBandModel = ({ snapshot, agents = [], activity = EMPTY_ACTIVIT
382
419
  const lit = skills.some(({ state }) => state === "current");
383
420
  const workflow = buildWorkflow({ snapshot, skills, completion, now });
384
421
  const title = discipline ?? skills.find(({ state }) => state === "current")?.id ?? lastDiscipline;
385
- const visible = band === "off" ? false : band === "always" || active || lit || notice !== null || completion !== null || warnings.length > 0;
422
+ const rewind = lookOf(discipline) === "rewind" && Number.isFinite(snapshot.ignition?.at) && now - snapshot.ignition.at < REWIND_LINGER_MS;
423
+ const visible = band === "off" ? false : band === "always" || active || lit || rewind || notice !== null || completion !== null || warnings.length > 0;
386
424
  return {
387
425
  visible,
388
426
  idle: !active && !lit,
427
+ rewind,
428
+ away: !active && !lit && !rewind && skills.length > 0 && now - Math.max(...skills.map(({ at }) => (Number.isFinite(at) ? at : now))) >= BREAK_MS,
389
429
  discipline,
390
430
  title: workflow?.paused ? crumbOf(workflow.paused) : title,
391
431
  phases,