@litfamily/litclaude 1.0.42 → 1.0.43

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.
@@ -34,7 +34,7 @@
34
34
 
35
35
  import { gauge, knownFacts } from "../rewind/gauge.mjs";
36
36
  import { textWidth, truncateToWidth } from "./layout.mjs";
37
- import { LOOKS, laneColor, lookOf } from "./looks.mjs";
37
+ import { CLUB_GLINT, CLUB_GOLD, CLUB_PILL, CLUB_STOPS, LOOKS, laneColor, lookOf } from "./looks.mjs";
38
38
  import { barCells, gradientAt, lerpColor, rainbowAt } from "./motion.mjs";
39
39
  import { glyphSet } from "./settings.mjs";
40
40
  import { formatDuration } from "./view.mjs";
@@ -142,6 +142,17 @@ const rainbowPill = (text, rainbow, from, glyphs, bold = true) => {
142
142
  : [span(" ", { bg: rainbowCell(rainbow, at(0)) }), ...body, span(" ", { bg: rainbowCell(rainbow, at(chars.length - 1)) })];
143
143
  };
144
144
 
145
+ // The club look's `CLUB ✦`: dark ink on a fill graded gold to rose, a cell at a time, each cap in
146
+ // the colour of the cell beside it.
147
+ const clubPill = (text, glyphs) => {
148
+ const chars = [...text];
149
+ const fill = (i) => gradientAt(CLUB_PILL, chars.length <= 1 ? 0 : i / (chars.length - 1));
150
+ const body = chars.map((ch, i) => span(ch, { fg: PILL.ink, bg: fill(i), bold: true }));
151
+ return glyphs.capLeft
152
+ ? [span(glyphs.capLeft, { fg: fill(0) }), ...body, span(glyphs.capRight, { fg: fill(chars.length - 1) })]
153
+ : [span(" ", { bg: fill(0) }), ...body, span(" ", { bg: fill(chars.length - 1) })];
154
+ };
155
+
145
156
  const inkOf = (accent) => ({ done: lerpColor(accent, PALETTE.dim, 0.45), now: accent, todo: PALETTE.dim, warn: PALETTE.amber });
146
157
 
147
158
  // Colour of one phase in this frame: the crossfade from its previous state, then the amber mix for
@@ -220,12 +231,12 @@ const cometOn = (sample, edge, width, look = null) => {
220
231
 
221
232
  // While LitClaude works the brand pill breathes from its pink toward the flame orange and back.
222
233
  // The rewind look turns it through the rainbow instead, lightened so its dark ink stays readable;
223
- // YOUR TURN holds it amber.
234
+ // YOUR TURN holds it amber, the club look gold.
224
235
  const brandSpans = (sample, glyphs, rainbow = null, look = null) => {
225
236
  const reveal = revealText("🔥 LIT", sample.pills[0]);
226
237
  if (reveal === null) return [];
227
238
  if (rainbow) return rainbowPill(reveal, rainbow, 0, glyphs);
228
- const fill = look === "turn" ? PALETTE.amber : sample.ambient ? lerpColor(PILL.brand, PALETTE.orange, 0.85 * sample.ambient.breath) : PILL.brand;
239
+ const fill = look === "turn" ? PALETTE.amber : look === "club" ? CLUB_GOLD : sample.ambient ? lerpColor(PILL.brand, PALETTE.orange, 0.85 * sample.ambient.breath) : PILL.brand;
229
240
  return pill(litText(reveal, { fg: PILL.ink, bg: fill, bold: true }, sample.completion?.shimmer ?? null), fill, glyphs);
230
241
  };
231
242
  // `REWIND <<` while the rewind look is on, each letter a step further round the hue wheel, lightened
@@ -240,6 +251,7 @@ const indicatorSpans = (model, sample, glyphs, accent, rainbow = null, look = nu
240
251
  const lanes = model.workflow.verdicts;
241
252
  return [span(`${LOOKS.review.label} ${lanes.filter(({ state }) => state === "pass" || state === "fail").length}/${lanes.length}`, { fg: accent, bold: true })];
242
253
  }
254
+ if (look === "club") return clubPill(`${LOOKS.club.label} ✦`, glyphs);
243
255
  if (model.idle) return [span("idle", { fg: PALETTE.dim })];
244
256
  const flow = model.workflow;
245
257
  if (flow && flow.current >= 0) {
@@ -258,12 +270,14 @@ const indicatorSpans = (model, sample, glyphs, accent, rainbow = null, look = nu
258
270
  // then the discipline shortens, then it goes too.
259
271
  // A newer LitClaude installed than the one loaded adds `restart to <version>` before the
260
272
  // indicator, dropped first when the edge has no room for it.
273
+ // The club look sets a sparkle at each corner of the title: `✧` before the brand, `✦` after the name.
261
274
  const topEdge = (model, sample, { width, glyphs, accent, edge, look, paint, rainbow }) => {
262
- const brand = brandSpans(sample, glyphs, rainbow, look);
275
+ const sparkle = look === "club";
276
+ const brand = [...(sparkle ? [span("✧ ", { fg: CLUB_STOPS[1] })] : []), ...brandSpans(sample, glyphs, rainbow, look)];
263
277
  const indicator = indicatorSpans(model, sample, glyphs, accent, rainbow, look);
264
278
  const name = model.title ?? "ready";
265
- const nameStyle = model.idle && !rainbow ? { fg: PALETTE.dim } : { fg: accent, bold: true };
266
- const title = (text) => (text ? [span(" · ", { fg: PALETTE.dim }), span(text, nameStyle)] : []);
279
+ const nameStyle = look === "club" ? { fg: CLUB_STOPS[1] } : model.idle && !rainbow ? { fg: PALETTE.dim } : { fg: accent, bold: true };
280
+ const title = (text) => (text ? [span(" · ", { fg: PALETTE.dim }), span(text, nameStyle), ...(sparkle ? [span(" ✦", { fg: CLUB_GOLD })] : [])] : []);
267
281
  const fixed = textWidth("╭─ ") + rowWidth(brand) + 1 + 1;
268
282
  const fits = (spans) => fixed + rowWidth(title(name)) + 1 + rowWidth(spans) + textWidth(" ─╮") <= width;
269
283
  const chip = model.restart ? [span(`restart to ${model.restart}`, { fg: PALETTE.amber }), span(" · ", { fg: PALETTE.dim }), ...indicator] : null;
@@ -701,8 +715,18 @@ const awayHint = (room, accent) => {
701
715
  return hint ? [span(hint[0], { fg: PALETTE.dim }), span(hint[1], { fg: accent }), ...(hint[2] ? [span(hint[2], { fg: PALETTE.dim })] : [])] : [];
702
716
  };
703
717
 
718
+ // The club card's quiet `invited by @<id>` chip, on the muted pill.
719
+ const inviteChip = (model, glyphs) => (model.invitedBy
720
+ ? pill([span("invited by ", { fg: PILL.mutedText, bg: PILL.muted }), span(`@${model.invitedBy}`, { fg: CLUB_STOPS[1], bg: PILL.muted, bold: true })], PILL.muted, glyphs)
721
+ : null);
722
+ // `row` with the chip at its right end, two cells apart at least, or null when they do not both fit.
723
+ const withChip = (row, chip, inner) => (chip && rowWidth(row) + 2 + rowWidth(chip) <= inner
724
+ ? fitRow([...row, span(" ".repeat(inner - rowWidth(row) - rowWidth(chip))), ...chip], inner)
725
+ : null);
726
+
704
727
  const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
705
728
  const chips = model.skills;
729
+ const invite = inviteChip(model, glyphs);
706
730
  if (chips.length === 0) {
707
731
  if (!model.idle && model.next && !model.workflow?.next) return fitRow([span("▸ ", { fg: accent }), span(truncateToWidth(model.next, inner - 2), { fg: PALETTE.white })], inner);
708
732
  if (!model.idle) return fitRow([span("no LitFamily skill yet in this request", { fg: PALETTE.dim })], inner);
@@ -711,6 +735,10 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
711
735
  [span("no skill yet · type ", { fg: PALETTE.dim }), span("lit <task>", { fg: accent })],
712
736
  [span("type ", { fg: PALETTE.dim }), span("lit <task>", { fg: accent })],
713
737
  ];
738
+ for (const hint of hints) {
739
+ const shown = withChip(hint, invite, inner);
740
+ if (shown) return shown;
741
+ }
714
742
  return fitRow(hints.find((hint) => rowWidth(hint) <= inner) ?? hints.at(-1), inner);
715
743
  }
716
744
  const row = inner >= 30 ? [span("skills", { fg: PALETTE.dim })] : [];
@@ -729,7 +757,7 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
729
757
  }
730
758
  if (shown < chips.length) row.push(...(row.length ? [span(" ")] : []), ...mutedPill(`+${chips.length - shown}`, glyphs));
731
759
  if (model.away) return fitRow([...row, ...awayHint(inner - rowWidth(row), accent)], inner);
732
- return sparkled(row, inner, sample, rainbow);
760
+ return withChip(row, invite, inner) ?? sparkled(row, inner, sample, rainbow);
733
761
  };
734
762
 
735
763
  const noticeRow = (sample, inner) => {
@@ -800,15 +828,41 @@ const bottomEdge = (model, sample, { width, glyphs, accent, edge, look, paint, r
800
828
 
801
829
  // The border: red or amber under a warning, otherwise the accent. Idle it is a calm, dim accent;
802
830
  // while LitClaude works it sits a step above the accent and breathes brighter toward white with the
803
- // brand pill. YOUR TURN breathes amber over TIMINGS.breath, and holds it with motion off.
831
+ // brand pill. YOUR TURN breathes amber over TIMINGS.breath, and holds it with motion off. The club
832
+ // look's border is gold (its rules and sides are painted with CLUB_STOPS).
804
833
  const edgeColor = (model, sample, accent, look) => {
805
834
  if (model.warnings.some(({ tone }) => tone === "red")) return PALETTE.red;
806
835
  if (look === "turn") return sample.ambient ? lerpColor(lerpColor(PALETTE.amber, PALETTE.faint, 0.5), PALETTE.amber, sample.ambient.breath) : PALETTE.amber;
807
836
  if (model.warnings.length) return PALETTE.amber;
837
+ if (look === "club") return CLUB_GOLD;
808
838
  if (model.idle) return lerpColor(PALETTE.faint, accent, 0.35);
809
839
  return lerpColor(accent, "#ffffff", 0.15 + 0.3 * (sample.ambient?.breath ?? 0));
810
840
  };
811
841
 
842
+ // How far the glint's light reaches either side of its centre, in cells.
843
+ const GLINT_REACH = 8;
844
+
845
+ // The club ring's colour at a border cell (`col`, `y`) of a card `width` by `height`: CLUB_STOPS laid
846
+ // clockwise from the top-left corner, so the ring closes gold on gold. `glint` (0 to 1 across its
847
+ // pass, or null) lays a warm white light over the top edge, entering and leaving off the card.
848
+ const clubRing = (width, height, glint) => {
849
+ const right = width - 1;
850
+ const bottom = height - 1;
851
+ const perimeter = 2 * right + 2 * bottom;
852
+ const along = (col, y) => {
853
+ if (y === 0) return col;
854
+ if (y === bottom) return right + bottom + (right - col);
855
+ return col === right ? right + y : 2 * right + bottom + (bottom - y);
856
+ };
857
+ const center = glint === null ? null : glint * (width + 2 * GLINT_REACH) - GLINT_REACH;
858
+ return (col, y) => {
859
+ const base = gradientAt(CLUB_STOPS, along(col, y) / perimeter);
860
+ if (center === null || y !== 0) return base;
861
+ const k = Math.max(0, 1 - Math.abs(col - center) / GLINT_REACH);
862
+ return k > 0 ? lerpColor(base, CLUB_GLINT, 0.8 * k) : base;
863
+ };
864
+ };
865
+
812
866
  /**
813
867
  * The card for one frame: `{ mode: "card", border, width, rows }`, five rows (top edge, workflow
814
868
  * map or phase track, detail line, chips row, bottom edge), with the thread rows between the detail
@@ -832,19 +886,34 @@ export const composeBand = (model, sample, { columns, glyphs: glyphMode = "basic
832
886
  const lanes = look === "review" ? model.workflow.verdicts : null;
833
887
  const laneAt = (col) => Math.min(lanes.length - 1, Math.floor((col * lanes.length) / width));
834
888
  const lanePaint = lanes ? (col) => laneColor(laneAt(col), lanes[laneAt(col)].state) : null;
835
- const paint = [0, 1, 2, 3, 4].map((r) => (painted ? (col) => rainbow(col / width + r * 0.04) : r === 0 || r === 4 ? lanePaint : null));
836
- const side = (row, r) => (paint[r]
837
- ? [span("│", { fg: paint[r](0) }), span(" "), ...row, span(" "), span("│", { fg: paint[r](width - 1) })]
838
- : [span("│ ", { fg: edge }), ...row, span(" │", { fg: edge })]);
839
- const options = { width, inner, glyphs, accent, edge, look, rainbow, paint };
889
+ const options = { width, inner, glyphs, accent, edge, look, rainbow };
840
890
  const middle = sample.completion ? completionRow(sample, inner) : sample.notice ? noticeRow(sample, inner) : chipsRow(model, sample, options);
891
+ // The rows between the edges, each with the paint slot its sides take (thread rows share the detail line's).
892
+ const body = [
893
+ [model.workflow ? mapRow(model, sample, options) : phaseRow(model, sample, options), 1],
894
+ [detailRow(model, sample, options), 2],
895
+ ...(model.threads ? threadRows(model, sample, options).map((row) => [row, 2]) : []),
896
+ [middle, 3],
897
+ ];
898
+ // The club look's ring: its velvet laid clockwise round the whole border, with the glint's light
899
+ // crossing the top edge while a pass runs. Without warnings only; it never touches the body.
900
+ const ring = look === "club" && model.warnings.length === 0 ? clubRing(width, body.length + 2, sample.glint ?? null) : null;
901
+ const paint = [0, 1, 2, 3, 4].map((r) => {
902
+ if (painted) return (col) => rainbow(col / width + r * 0.04);
903
+ if (ring) return r === 0 ? (col) => ring(col, 0) : r === 4 ? (col) => ring(col, body.length + 1) : null;
904
+ return r === 0 || r === 4 ? lanePaint : null;
905
+ });
906
+ const side = (row, r, y) => {
907
+ const at = ring ? (col) => ring(col, y) : paint[r];
908
+ return at
909
+ ? [span("│", { fg: at(0) }), span(" "), ...row, span(" "), span("│", { fg: at(width - 1) })]
910
+ : [span("│ ", { fg: edge }), ...row, span(" │", { fg: edge })];
911
+ };
912
+ const edges = { ...options, paint };
841
913
  const rows = [
842
- topEdge(model, sample, options),
843
- side(model.workflow ? mapRow(model, sample, options) : phaseRow(model, sample, options), 1),
844
- side(detailRow(model, sample, options), 2),
845
- ...(model.threads ? threadRows(model, sample, options).map((row) => side(row, 2)) : []),
846
- side(middle, 3),
847
- bottomEdge(model, sample, options),
914
+ topEdge(model, sample, edges),
915
+ ...body.map(([row, r], index) => side(row, r, index + 1)),
916
+ bottomEdge(model, sample, edges),
848
917
  ];
849
918
  return {
850
919
  mode: "card",
@@ -7,14 +7,27 @@
7
7
  // review review-work: the top and bottom rules split into the five review lanes
8
8
  // turn waiting on the user: an amber border breathing over TIMINGS.breath, `YOUR TURN`
9
9
  // done a plan, goal, review or release finished: one rainbow spray of embers
10
+ // club the idle card once `lit invite` recorded an inviter (plans/invite-pilot.md): a gold →
11
+ // rose → violet ring round all four borders with a slow gold glint along the top (full
12
+ // motion only), a gold LIT pill, `CLUB ✦` on a gold-gradient pill, sparkles at the
13
+ // title's corners and an `invited by @<id>` chip; below every other look
10
14
 
11
15
  export const LOOKS = Object.freeze({
12
16
  rewind: Object.freeze({ label: "REWIND <<", palette: "rainbow", comet: "bottom-leftward", pill: "rainbow" }),
13
17
  review: Object.freeze({ label: "REVIEW", palette: "lanes", comet: "none", pill: "accent" }),
14
18
  turn: Object.freeze({ label: "YOUR TURN", palette: "amber", comet: "none", pill: "amber" }),
15
19
  done: Object.freeze({ label: "DONE", palette: "rainbow", comet: "none", pill: "brand" }),
20
+ club: Object.freeze({ label: "CLUB", palette: "velvet", comet: "none", pill: "gold" }),
16
21
  });
17
22
 
23
+ // The club look's velvet: gold through rose to violet and back to gold, laid round the border so
24
+ // the ring closes in the same colour it starts with. CLUB_GOLD fills its LIT pill under dark ink,
25
+ // CLUB_PILL grades the `CLUB ✦` pill and CLUB_GLINT is the light that runs along the top.
26
+ export const CLUB_STOPS = Object.freeze(["#ffd75f", "#ff8fbf", "#b48cff", "#ff8fbf", "#ffd75f"]);
27
+ export const CLUB_GOLD = "#ffd75f";
28
+ export const CLUB_PILL = Object.freeze(["#ffd75f", "#ffb38a", "#ff8fbf"]);
29
+ export const CLUB_GLINT = "#fff6d6";
30
+
18
31
  export const LOOK_BY_SKILL = Object.freeze({ "lit-adhd": "rewind", "lit-rewind": "rewind", "review-work": "review" });
19
32
  const BY_SKILL = new Map(Object.entries(LOOK_BY_SKILL));
20
33
 
@@ -36,6 +36,11 @@ export const TIMINGS = Object.freeze({
36
36
  clock: 1000,
37
37
  hue: 4800,
38
38
  sparks: 3600,
39
+ // The club look's glint along the top border (full motion only): the first pass waits
40
+ // `clubGlintRest`, each pass lasts `clubGlint`, and passes start `clubGlintPeriod` apart.
41
+ clubGlint: 1400,
42
+ clubGlintRest: 1200,
43
+ clubGlintPeriod: 3600,
39
44
  });
40
45
 
41
46
  // full: the approved motion, and while LitClaude works the brand breathes, a light sweeps the active
@@ -1,15 +1,17 @@
1
- // The LIT band's four userConfig options. The manifest declares them as plain strings without an
1
+ // The LIT band's five userConfig options. The manifest declares them as plain strings without an
2
2
  // `options` list, because Claude Code 2.1.270 and older refuse a whole plugin whose userConfig has
3
3
  // one; the values are checked here instead, and anything unknown falls back to the default (the
4
4
  // first choice). `notify` raises a notification through the person's own channel when LIT work
5
5
  // completes or a LIT turn longer than three minutes ends; `finish+sound` adds a sound only where
6
- // the plugin ships one, and none ships yet, so it notifies like `finish`.
6
+ // the plugin ships one, and none ships yet, so it notifies like `finish`. `club` lets an invited
7
+ // card wear the club look while idle (plans/invite-pilot.md).
7
8
 
8
9
  export const MOD_CHOICES = Object.freeze({
9
10
  motion: ["full", "subtle", "off"],
10
11
  glyphs: ["auto", "nerd", "basic"],
11
12
  band: ["always", "auto", "off"],
12
13
  notify: ["off", "finish", "finish+sound"],
14
+ club: ["on", "off"],
13
15
  });
14
16
 
15
17
  const pick = (value, choices) => {
@@ -22,6 +24,7 @@ export const normalizeModSettings = (options) => ({
22
24
  glyphs: pick(options?.glyphs, MOD_CHOICES.glyphs),
23
25
  band: pick(options?.band, MOD_CHOICES.band),
24
26
  notify: pick(options?.notify, MOD_CHOICES.notify),
27
+ club: pick(options?.club, MOD_CHOICES.club),
25
28
  });
26
29
 
27
30
  // Claude Code's own `prefersReducedMotion` setting (/config "Reduce motion") turns the band's motion
@@ -519,6 +519,24 @@ export const readLitSnapshot = async (io, { cwd, sessionId, env = {} }) => {
519
519
  };
520
520
  };
521
521
 
522
+ // Where `lit invite` keeps its record (lib/invite.mjs inviteHome): LITCLAUDE_HOME, else ~/.litclaude.
523
+ export const inviteRoot = (env) => {
524
+ // Untrimmed, like lib/invite.mjs and resolveHome, so the card reads the file the CLI wrote.
525
+ const home = env?.LITCLAUDE_HOME;
526
+ if (home) return normalizePath(home);
527
+ return env?.HOME?.trim() ? joinPath(env.HOME.trim(), ".litclaude") : null;
528
+ };
529
+ // lib/invite.mjs's id rule; the band cannot import that module, which writes.
530
+ const INVITE_ID = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/u;
531
+
532
+ /** The recorded inviter's id from a real, well-formed invite.json under inviteRoot (read guarded), or null. */
533
+ export const readInvited = async (io, env) => {
534
+ const root = inviteRoot(env);
535
+ if (!root) return null;
536
+ const record = await readGuardedJson(io, root, "invite.json", 4096);
537
+ return record?.version === 1 && typeof record.invitedBy === "string" && INVITE_ID.test(record.invitedBy) ? record.invitedBy : null;
538
+ };
539
+
522
540
  /**
523
541
  * The LitClaude version Claude Code installed, from its `installed_plugins.json` record: the
524
542
  * `litclaude@…` entry, user scope first. Anything unreadable or malformed gives null.
@@ -22,7 +22,7 @@
22
22
 
23
23
  import { gauge, knownFacts } from "../rewind/gauge.mjs";
24
24
  import { textWidth, truncateToWidth } from "./layout.mjs";
25
- import { LOOKS, lookOf } from "./looks.mjs";
25
+ import { CLUB_GLINT, CLUB_GOLD, CLUB_PILL, CLUB_STOPS, LOOKS, lookOf } from "./looks.mjs";
26
26
  import { TIMINGS, barCells, gradientAt, rainbowAt } from "./motion.mjs";
27
27
 
28
28
  const C = Object.freeze({
@@ -105,6 +105,7 @@ const indicatorOf = (model, accent) => {
105
105
  if (model.completion) return { label: "DONE ✓", fill: C.green };
106
106
  if (model.look === "turn") return { label: LOOKS.turn.label, fill: C.amber };
107
107
  if (model.look === "review") return { label: `${LOOKS.review.label} ${model.workflow.verdicts.filter(({ state }) => state === "pass" || state === "fail").length}/${model.workflow.verdicts.length}`, fill: accent };
108
+ if (model.look === "club") return { label: `${LOOKS.club.label} ✦`, fill: CLUB_GOLD };
108
109
  if (model.idle) return { label: "idle", fill: C.dim, plain: true };
109
110
  const flow = model.workflow;
110
111
  if (flow?.paused && flow.current >= 0) return { label: `${flow.stages[flow.current].id.toUpperCase()} ||`, fill: C.dim };
@@ -116,23 +117,32 @@ const indicatorOf = (model, accent) => {
116
117
  return { label: "LIVE ●", fill: accent };
117
118
  };
118
119
 
119
- // The rewind look draws the LIT pill and a `REWIND <<` indicator in the turning rainbow.
120
+ // The rewind look draws the LIT pill and a `REWIND <<` indicator in the turning rainbow; the club
121
+ // look a gold pill after a `✧`, a rose title closed by a `✦`, and `CLUB ✦` on its gold-gradient pill.
120
122
  const topRow = (model, accent, animate, rewind = false) => {
121
123
  const { width, pad } = SVG_CARD;
122
124
  const y = ROW_Y[0];
125
+ const club = model.look === "club";
126
+ const lead = club ? text(pad, y, "✧", { fill: CLUB_STOPS[1] }) : "";
127
+ const from = club ? pad + widthOf("✧ ") : pad;
123
128
  const brand = rewind
124
- ? pill(pad, y, "🔥 LIT", { fill: "url(#lit-rainbow)", ink: C.ink, veil: true })
125
- : pill(pad, y, "🔥 LIT", { fill: C.pink, ink: C.ink, breath: animate.breath ? C.orange : null });
129
+ ? pill(from, y, "🔥 LIT", { fill: "url(#lit-rainbow)", ink: C.ink, veil: true })
130
+ : pill(from, y, "🔥 LIT", { fill: club ? CLUB_GOLD : C.pink, ink: C.ink, breath: animate.breath ? C.orange : null });
126
131
  const indicator = rewind && !model.completion ? { label: "REWIND <<", fill: "url(#lit-rainbow)" } : indicatorOf(model, accent);
132
+ // The club pill is 16 wider than the bare indicator text; it ends where the text would.
133
+ const pillWide = club ? 16 : 0;
127
134
  // A newer LitClaude installed than the one loaded: `restart to <version>` left of the indicator.
128
135
  const chip = model.restart ? `restart to ${model.restart}` : null;
129
- const chipEnd = width - pad - widthOf(indicator.label) - 16;
130
- const right = text(width - pad, y, indicator.label, { fill: indicator.fill, bold: !indicator.plain, anchor: "end" })
131
- + (chip ? text(chipEnd, y, chip, { fill: C.amber, anchor: "end" }) : "");
132
- const room = width - pad - widthOf(indicator.label) - 16 - (chip ? widthOf(chip) + 16 : 0) - brand.end - widthOf(" · ");
136
+ const chipEnd = width - pad - widthOf(indicator.label) - 16 - pillWide;
137
+ const label = club
138
+ ? pill(width - pad - widthOf(indicator.label) - 16, y, indicator.label, { fill: "url(#lit-club-pill)", ink: C.ink }).markup
139
+ : text(width - pad, y, indicator.label, { fill: indicator.fill, bold: !indicator.plain, anchor: "end" });
140
+ const right = label + (chip ? text(chipEnd, y, chip, { fill: C.amber, anchor: "end" }) : "");
141
+ const tail = club ? " ✦" : "";
142
+ const room = width - pad - widthOf(indicator.label) - 16 - pillWide - (chip ? widthOf(chip) + 16 : 0) - brand.end - widthOf(" · ") - widthOf(tail);
133
143
  const name = truncateToWidth(model.title ?? "ready", Math.max(4, Math.floor(room / SVG_CARD.cell)));
134
- const title = run(brand.end + 4, y, [[" · ", { fill: C.dim }], [name, model.idle && !rewind ? { fill: C.dim } : { fill: accent, bold: true }]]);
135
- return brand.markup + title.markup + right;
144
+ const title = run(brand.end + 4, y, [[" · ", { fill: C.dim }], [name, club ? { fill: CLUB_STOPS[1] } : model.idle && !rewind ? { fill: C.dim } : { fill: accent, bold: true }], ...(club ? [[tail, { fill: CLUB_GOLD }]] : [])]);
145
+ return lead + brand.markup + title.markup + right;
136
146
  };
137
147
 
138
148
  const rightOfPhases = (model, withProgress = true) => {
@@ -310,6 +320,18 @@ const detailRowSvg = (model, accent, animate) => {
310
320
  const TONES = Object.freeze({ pink: [C.pink, "#ff6fae", "🔥"], amber: [C.amber, C.amber, "⚠"], red: [C.red, C.red, "✗"] });
311
321
 
312
322
  // Skill chips, or the notice or the finish while one is up, or the hint while nothing has fired.
323
+ // The club card's quiet `invited by @<id>` chip on the muted pill, ending at the card's right pad;
324
+ // drawn only when it clears whatever the row already holds (ending at `after`) by 16.
325
+ const inviteChipSvg = (model, y, after) => {
326
+ if (!model.invitedBy || after === null) return "";
327
+ const handle = `@${model.invitedBy}`;
328
+ const w = widthOf(`invited by ${handle}`) + 16;
329
+ const x = SVG_CARD.width - SVG_CARD.pad - w;
330
+ if (x < after + 16) return "";
331
+ return `<rect x="${x.toFixed(1)}" y="${y - PILL_H + 6}" width="${w.toFixed(1)}" height="${PILL_H}" rx="${PILL_H / 2}" fill="${C.muted}"/>`
332
+ + run(x + 8, y, [["invited by ", { fill: C.mutedText }], [handle, { fill: CLUB_STOPS[1], bold: true }]]).markup;
333
+ };
334
+
313
335
  const middleRow = (model, accent, animate, shift = 0, rewind = false) => {
314
336
  const { width, pad } = SVG_CARD;
315
337
  const y = ROW_Y[3] + shift;
@@ -325,7 +347,8 @@ const middleRow = (model, accent, animate, shift = 0, rewind = false) => {
325
347
  if (model.skills.length === 0) {
326
348
  if (!model.idle && model.next && !model.workflow?.next) return run(pad, y, [["▸ ", { fill: accent }], [truncateToWidth(model.next, Math.floor((room - pad) / SVG_CARD.cell) - 2), { fill: C.white }]]).markup;
327
349
  if (!model.idle) return text(pad, y, "no LitFamily skill yet in this request", { fill: C.dim });
328
- return run(pad, y, [["no LitFamily skill yet · type ", { fill: C.dim }], ["lit <task>", { fill: accent }], [" to start one", { fill: C.dim }]]).markup;
350
+ const hint = run(pad, y, [["no LitFamily skill yet · type ", { fill: C.dim }], ["lit <task>", { fill: accent }], [" to start one", { fill: C.dim }]]);
351
+ return hint.markup + inviteChipSvg(model, y, hint.end);
329
352
  }
330
353
  const out = [text(pad, y, "skills", { fill: C.dim })];
331
354
  let x = pad + widthOf("skills") + 10;
@@ -349,6 +372,7 @@ const middleRow = (model, accent, animate, shift = 0, rewind = false) => {
349
372
  });
350
373
  if (rewind && animate.sweep && x !== null) out.push(sparksSvg(x, width - pad, y));
351
374
  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);
375
+ else out.push(inviteChipSvg(model, y, x));
352
376
  return out.join("");
353
377
  };
354
378
 
@@ -509,6 +533,25 @@ const rainbowDefs = (animate) => {
509
533
  return `<defs><linearGradient id="lit-rainbow" x1="0" x2="1" y1="0" y2="1">${stops.join("")}</linearGradient></defs>`;
510
534
  };
511
535
 
536
+ // The club look's ring: gold on the left side through rose to violet on the right, so the top edge
537
+ // and the bottom edge each carry the whole velvet and the ring closes gold on gold at the left, as
538
+ // the terminal card lays it clockwise. The pill gradient fills `CLUB ✦`.
539
+ const gradientStops = (stops) => stops.map((color, i) => `<stop offset="${(i / (stops.length - 1)).toFixed(3)}" stop-color="${color}"/>`).join("");
540
+ const clubDefs = () => `<defs><linearGradient id="lit-club" x1="0" x2="1" y1="0" y2="0">${gradientStops(CLUB_STOPS.slice(0, 3))}</linearGradient>`
541
+ + `<linearGradient id="lit-club-pill" x1="0" x2="1" y1="0" y2="0">${gradientStops(CLUB_PILL)}</linearGradient></defs>`;
542
+
543
+ // The club glint (full motion only): a warm light crossing the top edge left to right in
544
+ // TIMINGS.clubGlint, then off the card until the next pass, TIMINGS.clubGlintPeriod apart. The first
545
+ // pass waits TIMINGS.clubGlintRest, as on the terminal card.
546
+ const clubGlintSvg = (width) => {
547
+ const reach = 120;
548
+ const pass = (TIMINGS.clubGlint / TIMINGS.clubGlintPeriod).toFixed(3);
549
+ return `<defs><linearGradient id="lit-club-glint" gradientUnits="userSpaceOnUse" x1="${-reach}" x2="0" y1="0" y2="0">`
550
+ + `<stop offset="0" stop-color="${CLUB_GLINT}" stop-opacity="0"/><stop offset="0.5" stop-color="${CLUB_GLINT}" stop-opacity="0.95"/><stop offset="1" stop-color="${CLUB_GLINT}" stop-opacity="0"/>`
551
+ + `<animateTransform attributeName="gradientTransform" type="translate" values="0 0;${width + reach} 0;${width + reach} 0" keyTimes="0;${pass};1" dur="${TIMINGS.clubGlintPeriod}ms" begin="${TIMINGS.clubGlintRest}ms" repeatCount="indefinite"/>`
552
+ + `</linearGradient></defs><line x1="15" y1="1.25" x2="${width - 15}" y2="1.25" stroke="url(#lit-club-glint)" stroke-width="2.5" stroke-linecap="round"/>`;
553
+ };
554
+
512
555
  /** What the card says, for a reader that cannot see the drawing. */
513
556
  export const svgCardAlt = (model) => {
514
557
  const parts = [`LIT ${model.rewind ? "rewind" : model.idle ? "idle" : "working"}`];
@@ -544,12 +587,13 @@ export const composeSvgCard = (model, { motion = "full", accent = "#5fd7ff" } =
544
587
  const rewind = (model.rewind === true || (!model.idle && lookOf(model.discipline) === "rewind")) && model.warnings.length === 0;
545
588
  const working = (!model.idle || rewind) && motion !== "off";
546
589
  const animate = { breath: working, sweep: working && motion === "full", comet: working && motion === "full" };
547
- const edge = rewind ? "url(#lit-rainbow)" : borderColor(model, accent);
590
+ const club = model.look === "club" && model.warnings.length === 0;
591
+ const edge = rewind ? "url(#lit-rainbow)" : club ? "url(#lit-club)" : borderColor(model, accent);
548
592
  const perimeter = 1000;
549
- const defs = (rewind ? rainbowDefs(animate.breath) : "") + (animate.sweep
593
+ const defs = (rewind ? rainbowDefs(animate.breath) : club ? clubDefs() : "") + (animate.sweep
550
594
  ? `<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>`
551
595
  : "");
552
- 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"' : ""}>`
596
+ 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 && !club ? "1.5" : "2.5"}"${model.idle && !rewind && !club ? ' stroke-opacity="0.8"' : ""}>`
553
597
  + (animate.breath && !model.warnings.length ? `<animate attributeName="stroke-opacity" values="0.85;1;0.85" ${loop(TIMINGS.breath, BREATH_PHASE)}/>` : "")
554
598
  + "</rect>";
555
599
  const comet = animate.comet
@@ -564,6 +608,7 @@ export const composeSvgCard = (model, { motion = "full", accent = "#5fd7ff" } =
564
608
  middleRow(model, accent, animate, shift, rewind),
565
609
  bottomRow(model, accent, shift),
566
610
  ].join("");
567
- 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>`;
568
- return { source, alt: svgCardAlt(model), animated: working };
611
+ const glint = club && motion === "full" ? clubGlintSvg(width) : "";
612
+ 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}${glint}${body}</svg>`;
613
+ return { source, alt: svgCardAlt(model), animated: working || glint !== "" };
569
614
  };
@@ -45,10 +45,18 @@ const ambientOf = (model, now, profile, previous = null) => {
45
45
  return { on, at: on && previous?.on ? previous.at : now };
46
46
  };
47
47
 
48
+ // The club look's glint runs on the idle card, so it keeps its own clock apart from the ambient
49
+ // loop: between passes nothing moves and the surface waits for the next one (glintWait).
50
+ const glintOf = (model, now, profile, previous = null) => {
51
+ const on = Boolean(profile.ambient?.sweep) && model.visible && model.look === "club";
52
+ return { on, at: on && previous?.on ? previous.at : now };
53
+ };
54
+
48
55
  export const createTimeline = (model, now, profile) => {
49
56
  const restAt = now + entryEnd(profile);
50
57
  return {
51
58
  ambient: ambientOf(model, now, profile),
59
+ glint: glintOf(model, now, profile),
52
60
  enterAt: now,
53
61
  exitAt: null,
54
62
  fill: { from: 0, to: fractionOf(model), at: restAt, dur: profile.duration(TIMINGS.fill) },
@@ -90,6 +98,7 @@ export const advanceTimeline = (timeline, model, now, profile) => {
90
98
  }
91
99
  next.chips = chipsOf(model, now, timeline.chips);
92
100
  next.ambient = ambientOf(model, now, profile, timeline.ambient);
101
+ next.glint = glintOf(model, now, profile, timeline.glint);
93
102
  next.step = stepOf(model, now);
94
103
  next.lanes = lanesOf(model, now);
95
104
  return next;
@@ -101,6 +110,28 @@ export const clockShown = (timeline) => timeline.exitAt === null && Boolean(time
101
110
  /** True while the ambient loop runs; the surface module then keeps a slower frame timer going. */
102
111
  export const ambientActive = (timeline, profile) => Boolean(profile.ambient) && timeline.exitAt === null && timeline.ambient.on;
103
112
 
113
+ // Where the club glint stands: 0 to 1 across the current pass, or null between passes, before the
114
+ // first one and while the glint is off.
115
+ const glintAt = (timeline, now) => {
116
+ if (!timeline.glint?.on || timeline.exitAt !== null) return null;
117
+ const elapsed = now - timeline.glint.at - TIMINGS.clubGlintRest;
118
+ if (elapsed < 0) return null;
119
+ const into = elapsed % TIMINGS.clubGlintPeriod;
120
+ return into < TIMINGS.clubGlint ? into / TIMINGS.clubGlint : null;
121
+ };
122
+
123
+ /**
124
+ * How long the surface may wait before its next frame for the club glint: a frame interval while a
125
+ * pass runs, the time left until the next pass otherwise, and null when the glint is off.
126
+ */
127
+ export const glintWait = (timeline, now, profile) => {
128
+ if (!profile.ambient?.sweep || !timeline.glint?.on || timeline.exitAt !== null) return null;
129
+ const elapsed = now - timeline.glint.at - TIMINGS.clubGlintRest;
130
+ if (elapsed < 0) return -elapsed;
131
+ const into = elapsed % TIMINGS.clubGlintPeriod;
132
+ return into < TIMINGS.clubGlint ? TIMINGS.ambientFrame : TIMINGS.clubGlintPeriod - into;
133
+ };
134
+
104
135
  // The rewind look's sparks: fixed seeds (a small LCG, so every surface draws the same sky), each a
105
136
  // starting place, a drift speed and a twinkle offset.
106
137
  const SPARK_SEEDS = (() => {
@@ -217,6 +248,7 @@ export const sampleTimeline = (timeline, now, profile) => {
217
248
  completion,
218
249
  chips,
219
250
  ambient: ambientSample(timeline, now, profile),
251
+ glint: glintAt(timeline, now),
220
252
  step: timeline.step ? { name: timeline.step.name, elapsedMs: timeline.step.base + Math.max(0, now - timeline.step.at) } : null,
221
253
  lanes: timeline.lanes ? { elapsedMs: timeline.lanes.base + Math.max(0, now - timeline.lanes.at) } : null,
222
254
  spin: Math.floor(Math.max(0, now) / TIMINGS.spin) % 4,
@@ -460,7 +460,7 @@ export const restartVersion = ({ loaded = null, installed = null } = {}) => {
460
460
  return order > 0 ? installed.slice(0, 40) : null;
461
461
  };
462
462
 
463
- export const buildBandModel = ({ snapshot, agents = [], activity = EMPTY_ACTIVITY, usage = null, now, band = "always", isWorking = false, notice = null, completion = null, skills = [], lastDiscipline = null, git = null, step = null, threadReserve = 0, lists = EMPTY_LISTS, tasks = EMPTY_TASKS, turnStartedAt = null, waiting = null, versions = null }) => {
463
+ export const buildBandModel = ({ snapshot, agents = [], activity = EMPTY_ACTIVITY, usage = null, now, band = "always", isWorking = false, notice = null, completion = null, skills = [], lastDiscipline = null, git = null, step = null, threadReserve = 0, lists = EMPTY_LISTS, tasks = EMPTY_TASKS, turnStartedAt = null, waiting = null, versions = null, club = false, invitedBy = null }) => {
464
464
  const discipline = snapshot.ignition?.discipline ?? null;
465
465
  const progress = progressOf(snapshot);
466
466
  const completing = completion !== null;
@@ -490,15 +490,20 @@ export const buildBandModel = ({ snapshot, agents = [], activity = EMPTY_ACTIVIT
490
490
  const lit = skills.some(({ state }) => state === "current");
491
491
  const workflow = buildWorkflow({ snapshot, skills, completion, now });
492
492
  const title = discipline ?? skills.find(({ state }) => state === "current")?.id ?? lastDiscipline;
493
- const look = selectLook({ snapshot, discipline, skills, workflow, completion, waiting, now, turnStartedAt });
493
+ const chosen = selectLook({ snapshot, discipline, skills, workflow, completion, waiting, now, turnStartedAt });
494
+ // `club` (an inviter recorded and the club option on) dresses only the idle card, and never
495
+ // shows a band that `band: auto` would hide.
496
+ const look = chosen ?? (club === true && !active && !lit ? "club" : null);
494
497
  const rewind = look === "rewind";
495
- const visible = band === "off" ? false : band === "always" || active || lit || look !== null || notice !== null || completion !== null || warnings.length > 0;
498
+ const visible = band === "off" ? false : band === "always" || active || lit || chosen !== null || notice !== null || completion !== null || warnings.length > 0;
496
499
  return {
497
500
  visible,
498
501
  idle: !active && !lit,
499
502
  restart: restartVersion(versions ?? undefined),
500
503
  look,
501
504
  rewind,
505
+ // Who invited this machine, for the club card's chip; null on every other look.
506
+ invitedBy: look === "club" && typeof invitedBy === "string" ? invitedBy : null,
502
507
  waiting: waiting?.reason ?? null,
503
508
  away: !active && !lit && !rewind && skills.length > 0 && now - Math.max(...skills.map(({ at }) => (Number.isFinite(at) ? at : now))) >= BREAK_MS,
504
509
  discipline,
@@ -50,6 +50,15 @@ const assertLockDirectory = (lockDir, expected) => {
50
50
  return identity;
51
51
  };
52
52
 
53
+ // A contender that loses a stale takeover finds the lock removed or replaced by the winner's
54
+ // fresh directory. That is a lost race to retry, not a failure; a symlink still fails closed.
55
+ const lockWasReplaced = (lockDir, expected) => {
56
+ const details = lstatSync(lockDir, { throwIfNoEntry: false });
57
+ if (!details) return true;
58
+ if (details.isSymbolicLink() || !details.isDirectory()) return false;
59
+ return !sameDirectory(directoryIdentity(details), expected);
60
+ };
61
+
53
62
  // Destructive cleanup is commit-by-rename: once the checked path is moved to a private
54
63
  // quarantine, a pathname replacement cannot make us remove the replacement. Re-checking the
55
64
  // moved entry catches Linux inode reuse (ctime/birthtime differ even when dev+ino are forged).
@@ -304,7 +313,8 @@ export const acquireOwnerLock = (lockDir, { timeoutMs = 500, staleMs = 30_000 }
304
313
  }
305
314
  }
306
315
  } catch (takeoverError) {
307
- if (!["ENOENT", "EEXIST", "ENOTEMPTY"].includes(takeoverError?.code)) {
316
+ if (!["ENOENT", "EEXIST", "ENOTEMPTY"].includes(takeoverError?.code)
317
+ && !lockWasReplaced(lockDir, lockDirectory)) {
308
318
  throw new OwnerLockError("stale lock takeover failed", 65);
309
319
  }
310
320
  }
@@ -25,8 +25,21 @@ export const planLinesOutsideFences = (text) => {
25
25
  return visible;
26
26
  };
27
27
 
28
+ // A task waits on the user when its line holds `BLOCKED:` outside inline code, or an indented body
29
+ // line under it starts with `BLOCKED:`. A mention such as `BLOCKED:` in backticks is not a marker.
30
+ const blockedLine = (line) => /\bBLOCKED:/u.test(line.replace(/`[^`]*`/gu, ""));
31
+ const blockedBodyLine = (line) => /^[ \t]+(?:[-*][ \t]+)?BLOCKED:/u.test(line);
32
+
28
33
  /** Parse the exact column-zero checkbox grammar consumed by start-work. */
29
- export const parsePlanTaskRows = (text) => planLinesOutsideFences(text).flatMap(({ line, index }) => {
30
- const match = /^- \[([ xX])\]\s+(.+?)\s*$/u.exec(line);
31
- return match ? [{ checked: match[1].toLowerCase() === "x", text: match[2], line, index }] : [];
32
- });
34
+ export const parsePlanTaskRows = (text) => {
35
+ const visible = planLinesOutsideFences(text);
36
+ return visible.flatMap(({ line, index }, at) => {
37
+ const match = /^- \[([ xX])\]\s+(.+?)\s*$/u.exec(line);
38
+ if (!match) return [];
39
+ let blocked = blockedLine(match[2]);
40
+ for (let next = at + 1; !blocked && next < visible.length && /^(?:[ \t]|$)/u.test(visible[next].line); next += 1) {
41
+ blocked = blockedBodyLine(visible[next].line);
42
+ }
43
+ return [{ checked: match[1].toLowerCase() === "x", text: match[2], line, index, ...(blocked ? { blocked } : {}) }];
44
+ });
45
+ };