@litfamily/litclaude 1.0.64 → 1.0.65

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.
@@ -25,7 +25,8 @@ import { BURST_MS, POWER_MS, SCENE, composeScene, lookArgs, lookColors, sceneKey
25
25
  import { composeBand, composeEvidence } from "../lib/mod/frame.mjs";
26
26
  import { TIMINGS } from "../lib/mod/motion.mjs";
27
27
  import { renderBand, renderRows } from "../lib/mod/render.mjs";
28
- import { accentFromSettings, drawsRoundCaps, effectiveMotion, normalizeModSettings, resolveGlyphs } from "../lib/mod/settings.mjs";
28
+ import { findNerdFont, fontFolders, glyphSetting, roundCaps } from "../lib/mod/round.mjs";
29
+ import { accentFromSettings, effectiveMotion, normalizeModSettings, resolveGlyphs } from "../lib/mod/settings.mjs";
29
30
  import { composeSvgCard } from "../lib/mod/svg-card.mjs";
30
31
  import { chipStates, litSkillId, noteSkill } from "../lib/mod/skills.mjs";
31
32
  import { TOAST_GAP_MS, gateToast, statusChanges, statusOf } from "../lib/mod/toasts.mjs";
@@ -130,6 +131,7 @@ const createLive = (options) => ({
130
131
  answeredBoundary: null,
131
132
  noColor: false,
132
133
  roundCaps: false,
134
+ glyphEnv: "auto",
133
135
  // The loaded and installed LitClaude versions (restart chip), and when the installed one was read.
134
136
  versions: null,
135
137
  versionPaths: null,
@@ -150,6 +152,32 @@ async function readVersions($, live, now) {
150
152
  live.versions = await readPluginVersions(stateIo($), live.versionPaths).catch(() => null);
151
153
  }
152
154
 
155
+ // Whether this terminal draws round caps (lib/mod/round.mjs), asked once a session.
156
+ async function readRoundCaps($, live) {
157
+ const env = {
158
+ LITCLAUDE_HUD_GLYPHS: await $.env.get("LITCLAUDE_HUD_GLYPHS"),
159
+ WT_SESSION: await $.env.get("WT_SESSION"),
160
+ KITTY_WINDOW_ID: await $.env.get("KITTY_WINDOW_ID"),
161
+ TERM: await $.env.get("TERM"),
162
+ TERM_PROGRAM: await $.env.get("TERM_PROGRAM"),
163
+ SSH_CONNECTION: await $.env.get("SSH_CONNECTION"),
164
+ HOME: await $.env.get("HOME"),
165
+ XDG_DATA_HOME: await $.env.get("XDG_DATA_HOME"),
166
+ LOCALAPPDATA: await $.env.get("LOCALAPPDATA"),
167
+ WINDIR: await $.env.get("WINDIR"),
168
+ };
169
+ live.glyphEnv = glyphSetting(env);
170
+ // The fonts of the machine Claude Code runs on are not the ones on screen over SSH.
171
+ if (env.SSH_CONNECTION) live.iconFont = { present: false, path: null, note: "icon font not used: over SSH the fonts here are not the ones on screen" };
172
+ live.roundCaps = await roundCaps({ env, hasFont: () => findNerdFont((path) => $.fs.list(path), fontFolders(env)) }).catch(() => false);
173
+ }
174
+
175
+ // The status line's glyph variable wins over the card's option, so both surfaces take one form.
176
+ function glyphsFor(live, settings, surface) {
177
+ const option = live.glyphEnv === "basic" ? "basic" : live.glyphEnv !== "auto" && settings.glyphs === "basic" ? "auto" : settings.glyphs;
178
+ return resolveGlyphs(option, surface, live.iconFont.present, live.roundCaps);
179
+ }
180
+
153
181
  const stateIo = ($) => ({
154
182
  stat: (path) => $.fs.stat(path, { resolve: true }),
155
183
  read: (path) => $.fs.read(path),
@@ -508,7 +536,7 @@ export const register = (on, options) => {
508
536
  live.accent = accentFromSettings(hostSettings, await $.env.get("LITCLAUDE_HUD_ACCENT"));
509
537
  // NO_COLOR (no-color.org): set and not empty, the card draws no colour and does not move.
510
538
  live.noColor = Boolean(await $.env.get("NO_COLOR"));
511
- live.roundCaps = drawsRoundCaps({ WT_SESSION: await $.env.get("WT_SESSION"), TERM_PROGRAM: await $.env.get("TERM_PROGRAM") });
539
+ await readRoundCaps($, live);
512
540
  live.reducedMotion = hostSettings?.prefersReducedMotion === true;
513
541
  live.motion = effectiveMotion(live.motion, hostSettings);
514
542
  live.lookSet = await setLook($, live);
@@ -672,7 +700,7 @@ export const register = (on, options) => {
672
700
  on("ui.render", { component: "AbovePrompt" }, async ($, e, next) => {
673
701
  const settings = normalizeModSettings(options);
674
702
  const motion = live.noColor ? "off" : effectiveMotion(settings.motion, { prefersReducedMotion: live.reducedMotion });
675
- const glyphs = live.noColor ? "basic" : resolveGlyphs(settings.glyphs, e.surface, live.iconFont.present, live.roundCaps);
703
+ const glyphs = live.noColor ? "basic" : glyphsFor(live, settings, e.surface);
676
704
  const color = !live.noColor;
677
705
  const model = live.model;
678
706
  if (!model || settings.band === "off" || e.props.hasSurvey || (!model.visible && !live.exiting)) return next(e);
@@ -731,7 +759,7 @@ export const register = (on, options) => {
731
759
 
732
760
  on("ui.render", { component: "Pane", requestId: PANE }, async ($, e) => {
733
761
  const settings = normalizeModSettings(options);
734
- const glyphs = resolveGlyphs(settings.glyphs, e.surface, live.iconFont.present, live.roundCaps);
762
+ const glyphs = glyphsFor(live, settings, e.surface);
735
763
  const elements = $.ui.resolve(e);
736
764
  const columns = Math.max(20, e.props.bodyColumns ?? 60);
737
765
  const now = await $.clock.now();
@@ -2,7 +2,9 @@
2
2
  // (ignition orange, signal lime, ivory, carbon navy) and the backdrop scene drawn behind the
3
3
  // conversation. The terminal draws no look; its band and spinner stay as they are.
4
4
  //
5
- // The scene is an instrument panel with the conversation mounted in it. The desktop draws the scene
5
+ // The scene is an instrument panel at a synthwave sunset, with the conversation mounted in it: a star
6
+ // field over a sky that goes from indigo to hot pink, a sliced sun standing low behind the column, a
7
+ // ridge on each side and a grid floor in perspective that runs towards the viewer. The desktop draws the scene
6
8
  // across the whole content frame and frosts a centred column over it: the column is the transcript
7
9
  // measure (768 px unless the person widened it), fully blurred, with a 48 px blur ramp outside it.
8
10
  // So the scene has two zones, measured in CSS pixels from the box's centre: the sharp gutters
@@ -17,8 +19,8 @@
17
19
  // run powers the panel up: working (the spark burns the fuse towards the next cell), asking (signal
18
20
  // rings from the cell the work waits at, a lime frame) and done (the fuse ignites end to end,
19
21
  // bursts open in the gutters, then the verify cell settles lime). Going from idle to a run plays a
20
- // power-on (the frame ignites outward from the column on a spring); going back plays a slower
21
- // power-down.
22
+ // power-on (the frame ignites outward from the column on a spring and the sun rises); going back plays
23
+ // a slower power-down, and the sun sinks behind the column again.
22
24
  //
23
25
  // Motion is physical: the spark runs on a solved spring and settles at its cell, cells kick and
24
26
  // follow through, embers rise against drag and sparks fall under gravity, and parts that move
@@ -152,14 +154,18 @@ const springStops = (z, n = 32) => {
152
154
  return Array.from({ length: n + 1 }, (_, i) => (i === n ? 1 : springX(z, (i / n) * T)));
153
155
  };
154
156
  const dragStops = (k, n = 24) => Array.from({ length: n + 1 }, (_, i) => (1 - Math.exp((-k * i) / n)) / (1 - Math.exp(-k)));
157
+ // A line of the floor, a share `p` of the way from the horizon to the viewer: 0 at the horizon, 1 at
158
+ // the foot of the box.
159
+ const FLOOR_DEPTH = 5;
160
+ const floorAt = (p) => (1 / (1 + FLOOR_DEPTH * (1 - p)) - 1 / (1 + FLOOR_DEPTH)) / (1 - 1 / (1 + FLOOR_DEPTH));
155
161
  const linear = (values) => `linear(${values.map((v) => +v.toFixed(3)).join(",")})`;
156
162
  const curve = (values, bezier) => Object.freeze({ linear: linear(values), bezier, values: Object.freeze(values) });
157
163
 
158
164
  /**
159
165
  * The spring and drag curves, each a `linear()` and the cubic-bezier fitted to it. `travel` carries
160
166
  * the spark (accelerates from rest, overshoots 2 %), `ignite` settles a kicked cell (one 8 %
161
- * overshoot), `enter` brings a part in with no overshoot, `drag` slows what flies out and `rise` an
162
- * ember climbing through warm air.
167
+ * overshoot), `enter` brings a part in with no overshoot, `drag` slows what flies out, `rise` an
168
+ * ember climbing through warm air and `floor` a line of the floor coming nearer in perspective.
163
169
  */
164
170
  export const EASE = Object.freeze({
165
171
  travel: curve(springStops(0.78), "cubic-bezier(.28,.32,.1,1.2)"),
@@ -167,6 +173,7 @@ export const EASE = Object.freeze({
167
173
  enter: curve(springStops(1), "cubic-bezier(.2,.2,.15,1.05)"),
168
174
  drag: curve(dragStops(4.5), "cubic-bezier(.22,1,.55,.95)"),
169
175
  rise: curve(dragStops(2.2), "cubic-bezier(.2,.48,.45,.85)"),
176
+ floor: curve(Array.from({ length: 25 }, (_, i) => floorAt(i / 24)), "cubic-bezier(.71,.11,.89,.38)"),
170
177
  });
171
178
  // Curves a bezier draws exactly or well enough: a fall (t²), an exit, a breath, a gather before a
172
179
  // release, and the fast first push of a kick.
@@ -212,8 +219,10 @@ const streakFrames = (name, from, span, reach, longest) => {
212
219
 
213
220
  // Colour tokens. `edge` outlines cells, `sh*` are the hard offset shadows, `mark` the readouts and
214
221
  // registration marks, `tag*` the flat state block.
215
- const TOKENS_DARK = "--bg:#080D14;--grid:#111B2A;--major:#1A2738;--dense:#22324A;--rail:#2A3647;--edge:#3E4D63;--idle:#1C2636;--lit:#FF6337;--hot:#FFB08F;--ok:#D7F75B;--ink:#080D14;--core:#FFF4E6;--halo:#FF6337;--sig:#D7F75B;--em2:#D7F75B;--sh:#000000;--shl:#8A2C08;--sho:#53660F;--mark:#6E7A8C;--tagi:#2A3647;--tagt:#F2EFDF;--frm:#2A3647;--act:#FFB08F;--emr:#C23A1E";
216
- const TOKENS_LIGHT = "--bg:#EBE7D5;--grid:#DED9C5;--major:#CFC9B2;--dense:#CEC8B0;--rail:#ADA892;--edge:#0B111A;--idle:#DDD8C3;--lit:#FF6337;--hot:#E74800;--ok:#D7F75B;--ink:#080D14;--core:#B83A00;--halo:#FF8F71;--sig:#7E9A12;--em2:#6F8A0A;--sh:#0B111A;--shl:#0B111A;--sho:#0B111A;--mark:#6A6E76;--tagi:#0B111A;--tagt:#F2EFDF;--frm:#ADA892;--act:#99320C;--emr:#A3311A";
222
+ // `sk*` run the sky from the top down to the horizon, `sn*` the sun, `fg` is the floor's neon, `fl*`
223
+ // its ground, `rg` the ridge and `cm` the calm column.
224
+ const TOKENS_DARK = "--bg:#0A0918;--dense:#3A2A66;--rail:#3B2C63;--edge:#5B4A8C;--idle:#2A2146;--lit:#FF6337;--hot:#FFB08F;--ok:#D7F75B;--ink:#080D14;--core:#FFF4E6;--halo:#FF5A4D;--sig:#D7F75B;--em2:#D7F75B;--sh:#000000;--shl:#8A2C08;--sho:#53660F;--mark:#8C82B0;--tagi:#3B2C63;--tagt:#F2EFDF;--frm:#46357A;--act:#FFB08F;--emr:#F0287F;--sk0:#0A0918;--sk1:#1C0F3D;--sk2:#4B1560;--sk3:#A3246F;--sn0:#FFE27A;--sn1:#FF8A3C;--sn2:#FF2D8A;--fg:#C64BFF;--fl0:#2A0D45;--fl1:#0A0918;--rg:#150A2E;--rge:#FF4FB0;--str:#D8CCFF;--vio:#B48CFF;--cya:#5FD7FF;--cm:#1A0B3C";
225
+ const TOKENS_LIGHT = "--bg:#EBE7D5;--dense:#D9C3D6;--rail:#B7A3BC;--edge:#0B111A;--idle:#DDD0D3;--lit:#FF6337;--hot:#E74800;--ok:#D7F75B;--ink:#080D14;--core:#B83A00;--halo:#FF8F71;--sig:#7E9A12;--em2:#6F8A0A;--sh:#0B111A;--shl:#0B111A;--sho:#0B111A;--mark:#6A6076;--tagi:#0B111A;--tagt:#F2EFDF;--frm:#B7A3BC;--act:#99320C;--emr:#C2185B;--sk0:#EFEAE0;--sk1:#F3DED8;--sk2:#F8C6B8;--sk3:#F59AA6;--sn0:#FFD071;--sn1:#FF9560;--sn2:#FF5C93;--fg:#B25CC7;--fl0:#E9BFD0;--fl1:#EBE7D5;--rg:#D9A9C4;--rge:#B14A8F;--str:#A884B5;--vio:#8A5BD0;--cya:#2B8FB8;--cm:#F0E6DC";
217
226
 
218
227
  // Embers per mood: [right column, left column], how bright they burn, and the lifetimes a near
219
228
  // ember draws from (far ones live twice as long). Every lifetime divides the 24 s clock. Idle is
@@ -251,6 +260,23 @@ const SPARK_INK = ["sc", "sl", "sr", "sr"];
251
260
  const DRIP_SPAN = [21, 29, 38];
252
261
  // The ticker in the left gutter: rows of mostly dots, some marks, a block now and then.
253
262
  const TICK = ["·", "·", "·", "·", ":", "|", "+", "▪"];
263
+ // The horizon, as a share of the box's height, and the sun that stands on it: its radius in its own
264
+ // drawing (which shrinks with a low box), its slices as heights in radii, and how far it is sunk at rest.
265
+ const HORIZON = 80;
266
+ const SUN_R = 540;
267
+ const SUN_SLICES = Object.freeze([[1, 0.62], [0.585, 0.44], [0.395, 0.285], [0.235, 0.15], [0.095, 0]]);
268
+ export const SUNK = Object.freeze({ idle: 350, working: 0, asking: 90, done: 0 });
269
+ const SUN_PATH = SUN_SLICES.map(([top, foot]) => {
270
+ const [w0, w1] = [top, foot].map((d) => Math.round(SUN_R * Math.sqrt(1 - d * d)));
271
+ const [y0, y1] = [top, foot].map((d) => Math.round(-SUN_R * d));
272
+ return `M${-w1} ${y1}A${SUN_R} ${SUN_R} 0 0 1 ${-w0} ${y0}H${w0}A${SUN_R} ${SUN_R} 0 0 1 ${w1} ${y1}Z`;
273
+ }).join("");
274
+ // The floor's lines: those running to the vanishing point, and how many roll towards the viewer.
275
+ const FLOOR_LINES = 8;
276
+ const FLOOR_FAN = Array.from({ length: 81 }, (_, i) => i - 40).map((k) => `M${k * 48} 0L${k * 300} 100`).join("");
277
+ // The right side's ridge, from the gutter's inner edge out; the left side mirrors it.
278
+ const RIDGE = "M380 0L440 -22L486 -10L540 -46L584 -26L640 -70L700 -34L748 -58L820 -24L890 -66L960 -30L1040 -52L1120 -18L1220 -44L1400 -12V0Z";
279
+ const STAR_DOTS = [[14, 20, 1.1], [52, 96, 0.8], [88, 40, 1.5], [118, 150, 0.9], [150, 74, 0.8], [182, 24, 1.2], [214, 118, 1], [236, 190, 1.4], [34, 178, 1], [96, 214, 0.8], [170, 204, 1.1], [250, 60, 0.8]];
254
280
  // Nothing the finish draws reaches the title strip above the band.
255
281
  const TOP = 44;
256
282
  // The power change: how long the power-on and the power-down play, in ms.
@@ -291,10 +317,10 @@ export const composeScene = (state, { still = false, clockMs = 0, power = null }
291
317
  const powering = !still && power && power.ageMs < POWER_MS[power.dir] ? power.dir : null;
292
318
  css.push(`svg{${TOKENS_DARK};--t:${phase}s;--pa:${powering ? n2(power.ageMs / 1000) : 0}s;}`, `@media (prefers-color-scheme: light){svg{${TOKENS_LIGHT}}}`);
293
319
  css.push(
294
- ".bg{fill:var(--bg)}.gd{fill:var(--grid)}.mj{fill:var(--major)}.dn{fill:var(--dense)}.rl{stroke:var(--rail)}.fz{stroke:var(--idle)}.rr{fill:var(--rail)}",
320
+ ".bg{fill:var(--bg)}.dn{fill:var(--dense)}.rl{stroke:var(--rail)}.fz{stroke:var(--idle)}.rr{fill:var(--rail)}",
295
321
  ".lt{fill:var(--lit)}.ok{fill:var(--ok)}.ik{fill:var(--ink)}.ol{fill:none;stroke:var(--edge)}.sh{fill:var(--sh)}.shl{fill:var(--shl)}.sho{fill:var(--sho)}",
296
- ".bn{stroke:var(--lit)}.wr{stroke:var(--hot)}.sp{stroke:var(--core)}.ss{stroke:var(--lit)}.em{fill:var(--lit)}.eo{fill:var(--em2)}",
297
- ".sg{fill:none;stroke:var(--sig)}.sw1{stroke:var(--sig)}.sw2{stroke:var(--lit)}.c0{stop-color:var(--bg)}.h0{stop-color:var(--halo)}.s0{stop-color:var(--sig)}",
322
+ ".bn{stroke:url(#fu)}.wr{stroke:var(--hot)}.sp{stroke:var(--core)}.ss{stroke:var(--lit)}.em{fill:var(--lit)}.eo{fill:var(--em2)}",
323
+ ".sg{fill:none;stroke:var(--sig)}.sw1{stroke:var(--sig)}.sw2{stroke:var(--lit)}.c0{stop-color:var(--cm)}.h0{stop-color:var(--halo)}.s0{stop-color:var(--sig)}",
298
324
  `.mk{stroke:var(--mark);fill:none}.rd{fill:var(--mark);font:500 10px ${MONO};letter-spacing:.08em}.lb{fill:var(--mark);font:500 9px ${MONO};letter-spacing:.06em}`,
299
325
  `.tg{font:700 10px ${MONO};letter-spacing:.08em}.tgi{fill:var(--tagi)}.tgt{fill:var(--tagt)}.tgk{fill:var(--ink)}`,
300
326
  // The frame: dim at rest, its run colour (orange, lime while asking or done) when lit.
@@ -302,11 +328,13 @@ export const composeScene = (state, { still = false, clockMs = 0, power = null }
302
328
  `.gl{text-anchor:middle;dominant-baseline:central}.t1{font:500 11px ${MONO}}.t2{font:700 14px ${MONO}}.t3{font:700 19px ${MONO}}`,
303
329
  ".sc{fill:var(--core)}.so{fill:var(--sig)}.sl{fill:var(--lit)}.sr{fill:var(--emr)}.eg,.ek{fill:var(--lit)}.mkf{fill:var(--mark)}.e0{stop-color:var(--emr)}.off{opacity:0}",
304
330
  `svg{--c0:${running ? "var(--sig)" : "var(--lit)"}}`,
305
- ".fd{stroke:var(--frm);fill:none}.fdf{fill:var(--frm)}.fa{stroke:var(--fon);fill:none}.faf{fill:var(--fon)}.ra{fill:var(--act)}",
331
+ ".fd{stroke:var(--frm);fill:none}.fdf{fill:var(--frm)}.fa{stroke:url(#nf);fill:none}.faf{fill:var(--fon)}.ra{fill:var(--act)}",
332
+ ".k0s{stop-color:var(--sk0)}.k1s{stop-color:var(--sk1)}.k2s{stop-color:var(--sk2)}.k3s{stop-color:var(--sk3)}.u0{stop-color:var(--sn0)}.u1{stop-color:var(--sn1)}.u2{stop-color:var(--sn2)}.f0{stop-color:var(--fl0)}.f1{stop-color:var(--fl1)}.g0{stop-color:var(--fg)}.fo{stop-color:var(--fon)}.vi{stop-color:var(--vio)}.cy{stop-color:var(--cya)}.li{stop-color:var(--lit)}",
333
+ ".stf{fill:var(--str)}.rgf{fill:var(--rg);stroke:var(--rge)}.fln{stroke:url(#fv);fill:none}.flh{stroke:var(--fg);fill:none}",
306
334
  `svg{--fon:${lime ? "var(--sig)" : "var(--lit)"}}`,
307
335
  // The gutters, by the room the box leaves beside the glass.
308
336
  `@media (max-width: ${WIDE - 1}px){.wd{display:none}}`,
309
- `@media (max-width: ${ROOMY - 1}px){.gt{display:none}.el,.er{display:none}.pl{transform:translateX(${TUCK}px)}.pr{transform:translateX(-${TUCK}px)}}`,
337
+ `@media (max-width: ${ROOMY - 1}px){.gt{display:none}.el,.er{display:none}.sn{opacity:.3}.pl{transform:translateX(${TUCK}px)}.pr{transform:translateX(-${TUCK}px)}.pl,.pr{opacity:.82}}`,
310
338
  );
311
339
 
312
340
  // Positions from the box's centre: `mid` opens a group there, `at` a cell's place on the fuse.
@@ -315,21 +343,41 @@ export const composeScene = (state, { still = false, clockMs = 0, power = null }
315
343
  const sideOf = (index) => (index === 0 ? "pl" : index === CELLS.length - 1 ? "pr" : "");
316
344
  const at = (index, inner) => `${mid(FUSE_Y, sideOf(index))}<g transform="translate(${CELLS[index].dx} 0)">${inner}</g>${end}`;
317
345
 
318
- // Ground: graph paper (fine and major lines), a warm sky along the top, halftone strips at both
319
- // box edges, a calm centre, heat beds at the foot of each gutter, a dithered band behind the fuse.
346
+ // Ground: the sky and its stars, a ridge on each side, the sun low behind the column, the floor, a
347
+ // calm column where the conversation sits, halftone strips at both box edges, heat beds at the foot
348
+ // of each gutter, a dithered band behind the fuse.
320
349
  const strip = (side, width) => {
321
- const cols = [3, 2, 1].map((dot, i) => `<rect class="${anim("", `dr z ${side === "l" ? "" : "q7"}`)}" fill="url(#h${dot})" x="${side === "l" ? i * 24 : -width + (2 - i) * (width / 3)}" y="-8" width="${width / 3}" height="100%"/>`).join("");
350
+ const cols = [3, 2, 1].map((dot, i) => `<rect fill="url(#h${dot})" x="${side === "l" ? i * 24 : -width + (2 - i) * (width / 3)}" y="0" width="${width / 3}" height="${HORIZON}%"/>`).join("");
322
351
  return side === "l" ? cols : `<svg x="100%" overflow="visible">${cols}</svg>`;
323
352
  };
324
353
  const bed = running ? 0.55 : 0.18;
354
+ // Twinkling stars in the gutters, and a shooting star now and then while a run is on.
355
+ const twinkles = Array.from({ length: 14 }, (_, i) => `<circle class="${anim("stf", `tw tw${i % 3} z q${i % 8}`)}" cx="${(i % 2 ? 1 : -1) * (GUTTER + 10 + Math.round(rand() * 420))}" cy="${n2(16 + rand() * 46)}%" r="${n2(1 + rand() * 1.1)}" opacity="${running ? 0.8 : 0.4}"/>`).join("");
356
+ const shoot = (side, lag) => `<g class="sho${lag} z" opacity="0"><line class="ssr" x1="0" y1="0" x2="${side * 70}" y2="-24" stroke-width="1.6" stroke-linecap="round" transform="translate(${side * (GUTTER + 240)} 0)"/></g>`;
357
+ // The sun: sunk behind the column at rest, up on the horizon in a run; its reflection on the floor.
358
+ const sunk = SUNK[mood];
359
+ const sunLight = { idle: 0.45, working: 0.95, asking: 0.8, done: 1 }[mood];
360
+ const glowLight = { idle: 0.3, working: 0.8, asking: 0.65, done: 1 }[mood];
361
+ const sun = `${mid(`${HORIZON - 60}%`, "sn")}<ellipse class="${anim("", "sgl z q2")}" cy="60%" rx="820" ry="52%" fill="url(#sg)" opacity="${glowLight}"/>`
362
+ + `<svg x="-560" width="1120" height="60%" viewBox="-560 -560 1120 560" preserveAspectRatio="xMidYMax meet" overflow="hidden"><g class="${powering ? `su${powering}` : ""}" transform="translate(0 ${sunk})" opacity="${sunLight}"><path d="${SUN_PATH}" fill="url(#su)"/></g></svg>${end}`;
363
+ const rows8 = Array.from({ length: FLOOR_LINES }, (_, i) => {
364
+ const p = (i + 0.35) / FLOOR_LINES;
365
+ return `<path class="flh${running && !still ? ` flr z fq${i}` : ""}" d="M-2000 0H2000" stroke-width=".75" transform="translate(0 ${n2(floorAt(p) * 100)})" opacity="${n2(Math.min(1, p * 2.4))}"/>`;
366
+ }).join("");
367
+ vars.push(...Array.from({ length: FLOOR_LINES }, (_, i) => `.fq${i}{--d:-${n2((i + 0.35) * 8 / FLOOR_LINES)}s}`));
368
+ const gleam = [[4, 5, 540], [16, 7, 470], [32, 9, 390], [54, 12, 300], [78, 14, 200]].map(([y, h, w], i) => `<g class="${running ? anim("", `gm gm${i % 3} z q${i}`) : ""}" opacity="${n2((running ? 0.85 : 0.22) - i * 0.04)}"><rect x="${-w}" y="${y}" width="${w * 2}" height="${h}" fill="url(#gl)"/></g>`).join("");
369
+ const floor = `<rect fill="url(#flg)" class="fls" y="${HORIZON}%" width="100%" height="${100 - HORIZON}%"/>${mid(`${HORIZON}%`)}<svg x="-2000" width="4000" height="${100 - HORIZON}%" viewBox="-2000 0 4000 100" preserveAspectRatio="none"><g opacity="${running ? 0.9 : 0.4}"><path class="fln" d="${FLOOR_FAN}" vector-effect="non-scaling-stroke" stroke-width="1.2"/>${rows8}</g>${gleam}</svg><rect x="-2000" y="-1.5" width="4000" height="3" fill="url(#hz)" opacity="${running ? 1 : 0.5}"/>${end}`;
325
370
  body.push(
326
371
  '<rect class="bg" width="100%" height="100%"/>',
327
- '<rect fill="url(#gp)" width="100%" height="100%"/>',
328
- '<rect fill="url(#gp2)" width="100%" height="100%"/>',
329
- `<rect class="${anim("", "sy z")}" fill="url(#sky)" width="100%" height="280" opacity="${running ? 0.9 : 0.35}"/>`,
372
+ `<rect fill="url(#sky)" width="100%" height="${HORIZON}%" opacity="${running ? 1 : 0.62}"/>`,
373
+ `<rect fill="url(#stp)" width="100%" height="56%" opacity="${running ? 0.6 : 0.35}"/>`,
374
+ `${mid(0)}${twinkles}${running && !still ? `<svg y="20%" overflow="visible">${shoot(1, 0)}${shoot(-1, 1)}</svg>` : ""}${end}`,
375
+ sun,
376
+ `${mid(`${HORIZON}%`)}${[1, -1].map((s) => `<path class="rgf" d="${RIDGE}" transform="scale(${s} 1)" stroke-width="1.4" stroke-opacity="${running ? 0.9 : 0.35}"/>`).join("")}${end}`,
377
+ floor,
378
+ `${mid(0)}<rect x="-${GUTTER}" width="${2 * GUTTER}" height="100%" fill="url(#calm)"/>${end}`,
330
379
  strip("l", 72),
331
380
  strip("r", 72),
332
- '<rect fill="url(#calm)" width="100%" height="100%"/>',
333
381
  `${mid(0)}<svg y="100%" overflow="visible"><ellipse class="${anim("", "hb2 z")}" cx="${-GUTTER - 140}" rx="240" ry="300" fill="url(#ho)" opacity="${bed}"/><ellipse class="${anim("", "hb3 z q5")}" cx="${GUTTER + 140}" rx="280" ry="340" fill="url(#${lime ? "hl" : "ho"})" opacity="${n2(bed * 1.1)}"/></svg>${end}`,
334
382
  // The gentle fire at the foot of each gutter while a run is on: soft tongues of pre-blurred
335
383
  // light that sway and breathe, under the hard glyphs.
@@ -598,11 +646,19 @@ export const composeScene = (state, { still = false, clockMs = 0, power = null }
598
646
  `@keyframes rg{0%{transform:scale(1);${tf(EASE.drag)}}80%{transform:scale(5.2)}100%{transform:scale(5.2)}}.rg{animation:rg 3s infinite}`,
599
647
  `@keyframes rf{0%{opacity:0;${tf(EASE.enter)}}5%{opacity:.85;${tf(BEZIER.exit)}}80%{opacity:0}100%{opacity:0}}.rf{animation:rf 3s infinite}`,
600
648
  `@keyframes hm{0%{opacity:.15;${tf(EASE.enter)}}22%{opacity:.55;${tf(BEZIER.sine)}}100%{opacity:.15}}.hm{animation:hm 6s infinite}`,
649
+ // The sunset: stars twinkle, a star shoots, the floor's lines roll nearer, the reflection wavers and
650
+ // the sun's glow breathes; the sun rises at the power-on and sinks at the power-down.
651
+ `@keyframes tw{0%{opacity:.25}50%{opacity:${quiet ? 0.5 : 1}}100%{opacity:.25}}.tw{animation:tw var(--td) infinite}.tw0{--td:4s}.tw1{--td:6s}.tw2{--td:8s}`,
652
+ `@keyframes sgl{0%{opacity:${n2(glowLight * 0.72)}}50%{opacity:${glowLight}}100%{opacity:${n2(glowLight * 0.72)}}}.sgl{animation:sgl 8s infinite}`,
653
+ ...(running ? [
654
+ `@keyframes sho{0%{transform:translate(0,0);opacity:0}1%{opacity:1}7%{opacity:.8}9%{transform:translate(-260px,90px);opacity:0}100%{transform:translate(-260px,90px);opacity:0}}.sho0{animation:sho 12s infinite}@keyframes shl{0%{transform:translate(0,0);opacity:0}1%{opacity:1}7%{opacity:.8}9%{transform:translate(260px,90px);opacity:0}100%{transform:translate(260px,90px);opacity:0}}.sho1{--d:-5s;animation:shl 12s infinite}.ssr{stroke:var(--str)}`,
655
+ `@keyframes flr{0%{transform:translateY(0);opacity:0;${tf(EASE.floor)}}20%{opacity:1}100%{transform:translateY(100px);opacity:1}}.flr{animation:flr 8s infinite}`,
656
+ "@keyframes gm{0%{transform:scaleX(1)}50%{transform:scaleX(.84)}100%{transform:scaleX(1)}}.gm{animation:gm var(--gd) infinite}.gm0{--gd:3s}.gm1{--gd:4s}.gm2{--gd:4.8s}",
657
+ ] : []),
658
+ ...(powering ? [`@keyframes su{0%{transform:translateY(${powering === "on" ? SUNK.idle : 0}px);opacity:${powering === "on" ? 0.45 : 0.95};${tf(EASE.enter)}}100%{transform:translateY(${sunk}px);opacity:${sunLight}}}.suon{animation:su 1s both}.suoff{animation:su 1.8s both}`] : []),
601
659
  // Slow ambient breaths, each on its own period so none of them line up.
602
660
  `@keyframes hb{0%{opacity:${quiet ? 0.12 : 0.4}}50%{opacity:${quiet ? 0.2 : 0.7}}100%{opacity:${quiet ? 0.12 : 0.4}}}.hb2{animation:hb 12s infinite}.hb3{animation:hb 8s infinite}`,
603
- `@keyframes sy{0%{opacity:${quiet ? 0.3 : 0.75}}50%{opacity:${quiet ? 0.4 : 0.95}}100%{opacity:${quiet ? 0.3 : 0.75}}}.sy{animation:sy 24s infinite}`,
604
661
  `@keyframes hp{0%{opacity:${n2(haloOpacity * 0.7)}}50%{opacity:${haloOpacity}}100%{opacity:${n2(haloOpacity * 0.7)}}}.hp{animation:hp ${mood === "working" ? 4.8 : 6}s infinite}`,
605
- "@keyframes dr{0%{transform:translate(0,0)}100%{transform:translate(0,-6px)}}.dr{animation:dr 6s infinite alternate}",
606
662
  // The clock: one digit a second, read off the shared clock.
607
663
  `@keyframes ck{0%{transform:translate(${inner + 28}px,-36px)}100%{transform:translate(${inner + 28}px,${-36 - CLOCK_S * 14}px)}}.ck{animation:ck ${CLOCK_S}s steps(${CLOCK_S},end) infinite}`,
608
664
  // The power change, once: the lit frame ignites outward from the column on a spring (the rule,
@@ -622,7 +678,7 @@ export const composeScene = (state, { still = false, clockMs = 0, power = null }
622
678
  `@keyframes bs{0%{transform:translate(0,0);opacity:0;${tf(EASE.drag)}}4%{opacity:1}55%{opacity:.9;${tf(BEZIER.exit)}}100%{transform:translate(var(--r),0);opacity:0}}.bs{animation:bs var(--bl) both}`,
623
679
  `@keyframes gv{0%{transform:translate(0,0);${tf(BEZIER.gravity)}}100%{transform:translate(0,48px)}}.gv{animation:gv 1.6s both}`,
624
680
  // Element curves, after the shorthands that would reset them.
625
- `.st,.sst{animation-timing-function:linear}.ew,.hb2,.hb3,.sy,.hp,.dr,.fk{${tf(BEZIER.sine)}}`,
681
+ `.st,.sst{animation-timing-function:linear}.ew,.hb2,.hb3,.hp,.fk,.tw,.sgl,.gm{${tf(BEZIER.sine)}}`,
626
682
  ...REACH.map((px, i) => `.r${i}{--r:${px}px}`),
627
683
  ...LIFE.map((s, i) => `.bl${i}{--bl:${s}s}`),
628
684
  ...JITTER.map((s, i) => `.j${i}{--j:${s}s}`),
@@ -633,7 +689,7 @@ export const composeScene = (state, { still = false, clockMs = 0, power = null }
633
689
  // The shared clock, last so it wins: every looping part starts where the session's clock is;
634
690
  // the one-shots start when the scene loads, the power change less the time since it began.
635
691
  ".z{animation-delay:calc(var(--d,0s) - var(--t))}",
636
- ".pwn,.pwf,.pgw{animation-delay:calc(var(--k,0s) - var(--pa))}",
692
+ ".pwn,.pwf,.pgw,.suon,.suoff{animation-delay:calc(var(--k,0s) - var(--pa))}",
637
693
  ".ig,.gr,.kw,.kf,.ag,.swp,.sst{animation-delay:calc(var(--k,0s) - var(--age,0s))}",
638
694
  ".gv{animation-delay:calc(var(--bd) - var(--age,0s))}.bs,.b0,.b1,.b2{animation-delay:calc(var(--bd) + var(--j) - var(--age,0s))}",
639
695
  "@media (prefers-reduced-motion: reduce){*{animation:none!important}}",
@@ -642,20 +698,30 @@ export const composeScene = (state, { still = false, clockMs = 0, power = null }
642
698
 
643
699
  const dots = (id, size, cls) => `<pattern id="${id}" width="8" height="8" patternUnits="userSpaceOnUse"><rect class="${cls}" x="${(8 - size) / 2}" y="${(8 - size) / 2}" width="${size}" height="${size}"/></pattern>`;
644
700
  const defs = [
645
- '<pattern id="gp" width="16" height="16" patternUnits="userSpaceOnUse"><rect class="gd" width="16" height="1"/><rect class="gd" width="1" height="16"/></pattern>',
646
- '<pattern id="gp2" width="128" height="128" patternUnits="userSpaceOnUse"><rect class="mj" width="128" height="1"/><rect class="mj" width="1" height="128"/></pattern>',
647
701
  dots("h3", 3, "dn"), dots("h2", 2, "dn"), dots("h1", 1, "dn"),
648
- '<pattern id="dt" width="4" height="4" patternUnits="userSpaceOnUse"><rect class="gd" width="2" height="2"/><rect class="gd" x="2" y="2" width="2" height="2"/></pattern>',
702
+ '<pattern id="dt" width="4" height="4" patternUnits="userSpaceOnUse"><rect class="dn" width="2" height="2" opacity=".35"/><rect class="dn" x="2" y="2" width="2" height="2" opacity=".35"/></pattern>',
649
703
  '<pattern id="ru" width="8" height="4" patternUnits="userSpaceOnUse"><rect class="rr" width="1" height="4"/></pattern>',
650
704
  '<pattern id="ru2" width="64" height="8" patternUnits="userSpaceOnUse"><rect class="rr" width="2" height="8"/></pattern>',
651
705
  // The frame's ticks: a short one every 16 px, a long one every 64.
652
706
  '<pattern id="tk" width="6" height="64" patternUnits="userSpaceOnUse"><rect class="fdf" y="0" width="6" height="2"/><rect class="fdf" x="2" y="16" width="4" height="1"/><rect class="fdf" x="2" y="32" width="4" height="1"/><rect class="fdf" x="2" y="48" width="4" height="1"/></pattern>',
653
- '<linearGradient id="sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" class="h0" stop-opacity=".2"/><stop offset="1" class="h0" stop-opacity="0"/></linearGradient>',
654
- '<radialGradient id="calm" cx=".5" cy=".55" r=".36"><stop offset="0" class="c0" stop-opacity="1"/><stop offset=".55" class="c0" stop-opacity=".92"/><stop offset="1" class="c0" stop-opacity="0"/></radialGradient>',
707
+ // The sunset: the sky, its tiled stars, the sun and its glow, the floor's ground, neon and reflection.
708
+ '<linearGradient id="sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" class="k0s"/><stop offset=".45" class="k1s"/><stop offset=".78" class="k2s"/><stop offset="1" class="k3s"/></linearGradient>',
709
+ `<pattern id="stp" width="264" height="232" patternUnits="userSpaceOnUse">${STAR_DOTS.map(([x, y, r]) => `<circle class="stf" cx="${x}" cy="${y}" r="${r}"/>`).join("")}</pattern>`,
710
+ `<linearGradient id="su" gradientUnits="userSpaceOnUse" x1="0" x2="0" y1="${-SUN_R}" y2="0"><stop offset="0" class="u0"/><stop offset=".5" class="u1"/><stop offset="1" class="u2"/></linearGradient>`,
711
+ '<radialGradient id="sg"><stop offset="0" class="u1" stop-opacity=".75"/><stop offset=".45" class="u2" stop-opacity=".42"/><stop offset=".75" class="u2" stop-opacity=".12"/><stop offset="1" class="u2" stop-opacity="0"/></radialGradient>',
712
+ '<linearGradient id="flg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" class="f0"/><stop offset="1" class="f1"/></linearGradient>',
713
+ '<linearGradient id="fv" gradientUnits="userSpaceOnUse" x1="0" x2="0" y1="0" y2="100"><stop offset="0" class="g0" stop-opacity=".25"/><stop offset="1" class="g0" stop-opacity=".85"/></linearGradient>',
714
+ '<linearGradient id="gl"><stop offset="0" class="u2" stop-opacity="0"/><stop offset=".3" class="u2" stop-opacity=".8"/><stop offset=".5" class="u0"/><stop offset=".7" class="u2" stop-opacity=".8"/><stop offset="1" class="u2" stop-opacity="0"/></linearGradient>',
715
+ '<linearGradient id="hz" gradientUnits="userSpaceOnUse" x1="-1400" x2="1400" y1="0" y2="0"><stop offset="0" class="g0" stop-opacity=".3"/><stop offset=".32" class="u2"/><stop offset=".5" class="u0"/><stop offset=".68" class="u2"/><stop offset="1" class="g0" stop-opacity=".3"/></linearGradient>',
716
+ // The frame's neon, from the mood's colour down through pink and violet, and the fuse's.
717
+ '<linearGradient id="nf" gradientUnits="userSpaceOnUse" x1="0" x2="0" y1="120" y2="96%"><stop offset="0" class="fo"/><stop offset=".34" class="u2"/><stop offset=".68" class="vi"/><stop offset="1" class="cy"/></linearGradient>',
718
+ `<linearGradient id="fu" gradientUnits="userSpaceOnUse" x1="${-PV - 420}" x2="${-PV + 60}" y1="0" y2="0"><stop offset="0" class="vi"/><stop offset=".5" class="u2"/><stop offset="1" class="li"/></linearGradient>`,
719
+ // The calm column: the scene goes quiet where the conversation sits.
720
+ '<linearGradient id="calm"><stop offset="0" class="c0" stop-opacity="0"/><stop offset=".08" class="c0" stop-opacity=".7"/><stop offset=".5" class="c0" stop-opacity=".78"/><stop offset=".92" class="c0" stop-opacity=".7"/><stop offset="1" class="c0" stop-opacity="0"/></linearGradient>',
655
721
  '<radialGradient id="ho"><stop offset="0" class="h0" stop-opacity=".5"/><stop offset=".4" class="h0" stop-opacity=".14"/><stop offset="1" class="h0" stop-opacity="0"/></radialGradient>',
656
722
  // Pre-blurred light: a far ember and a tongue of fire, soft with no filter to redraw.
657
723
  '<radialGradient id="eb"><stop offset="0" class="h0" stop-opacity=".95"/><stop offset=".3" class="h0" stop-opacity=".45"/><stop offset="1" class="h0" stop-opacity="0"/></radialGradient>',
658
- '<radialGradient id="fl"><stop offset="0" class="h0" stop-opacity=".42"/><stop offset=".45" class="e0" stop-opacity=".16"/><stop offset="1" class="e0" stop-opacity="0"/></radialGradient>',
724
+ '<radialGradient id="fl"><stop offset="0" class="u1" stop-opacity=".34"/><stop offset=".45" class="e0" stop-opacity=".16"/><stop offset="1" class="e0" stop-opacity="0"/></radialGradient>',
659
725
  '<radialGradient id="hl"><stop offset="0" class="s0" stop-opacity=".5"/><stop offset=".4" class="s0" stop-opacity=".14"/><stop offset="1" class="s0" stop-opacity="0"/></radialGradient>',
660
726
  // Below the title strip, in the scene's own space and in a fuse cell's.
661
727
  `<clipPath id="cb"><rect y="${TOP}" width="100%" height="100%"/></clipPath>`,
@@ -316,9 +316,9 @@ const topEdge = (model, sample, { width, glyphs, accent, edge, look, paint, rain
316
316
  const TRACK = "#2a2340";
317
317
  const roundGauge = (cells, glyphs) => {
318
318
  if (!glyphs.capLeft) return cells.map(({ glyph, color }) => (glyph === "█" ? span(" ", { bg: color }) : span(glyph, { fg: color })));
319
- const paint = cells.map(({ glyph, color }) => (glyph === "█" ? color : TRACK));
320
- return paint.map((color, i) => (i === 0 ? span(glyphs.capLeft, { fg: color }) : i === paint.length - 1 ? span(glyphs.capRight, { fg: color }) : span(" ", { bg: color })));
319
+ return roundCells(cells.map(({ glyph, color }) => (glyph === "█" ? color : TRACK)), glyphs);
321
320
  };
321
+ const roundCells = (paint, glyphs) => paint.map((color, i) => (i === 0 ? span(glyphs.capLeft, { fg: color }) : i === paint.length - 1 ? span(glyphs.capRight, { fg: color }) : span(" ", { bg: color })));
322
322
 
323
323
  // ●● 2 lanes 1:07: a dot per lane (amber once stalled, dim and still while idle), the count and the longest lane's
324
324
  // clock. While LitClaude works a light walks across the dots (full motion) or they breathe (subtle),
@@ -844,9 +844,12 @@ const bottomEdge = (model, sample, { width, glyphs, accent, edge, look, paint, r
844
844
  segments.push(segment("ctx", 1, [span("ctx ", { fg: PALETTE.dim }), span(`${context}%`, { fg: rainbow ? rainbow(0.8) : accent, bold: Boolean(rainbow) })], " · "));
845
845
  const filled = Math.max(0, Math.min(5, Math.round(context / 20)));
846
846
  // The rewind look turns every cell of the bar, filled or not, so even 0% shows the colour.
847
- const cells = rainbow
847
+ const fill = (i) => (rainbow ? rainbow(i / 5) : model.ctxWarning ? PALETTE.amber : gradientAt([PALETTE.violet, accent], i / 4));
848
+ const cells = glyphs.capLeft
849
+ ? roundCells(Array.from({ length: 5 }, (_, i) => (i < filled ? fill(i) : rainbow ? lerpColor(rainbow(i / 5), HUD.empty, 0.5) : TRACK)), glyphs)
850
+ : rainbow
848
851
  ? [...Array(5)].map((_, i) => span(i < filled ? "▰" : "▱", { fg: i < filled ? rainbow(i / 5) : lerpColor(rainbow(i / 5), HUD.empty, 0.5) }))
849
- : [...Array.from({ length: filled }, (_, i) => span("▰", { fg: model.ctxWarning ? PALETTE.amber : gradientAt([PALETTE.violet, accent], i / 4) })), span("▱".repeat(5 - filled), { fg: TRACK_EDGE })];
852
+ : [...Array.from({ length: filled }, (_, i) => span("▰", { fg: fill(i) })), span("▱".repeat(5 - filled), { fg: TRACK_EDGE })];
850
853
  segments.push(segment("ctxbar", 2, cells, " "));
851
854
  }
852
855
  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) })], " · ")));
@@ -0,0 +1,61 @@
1
+ // The one answer to "does this terminal draw the round caps (U+E0B6, U+E0B4)?", for the status line, the
2
+ // card and the installer. The person's glyph setting wins; then terminals that draw the caps themselves;
3
+ // over SSH the fonts here are not the ones on screen; otherwise a Nerd Font installed here, told by file
4
+ // names alone. No Node built-ins: the card reads folders through the host, the rest through lib/round-caps.mjs.
5
+
6
+ const EXPLICIT = ["nerd", "round", "basic"];
7
+ const FONT_NAME = /(?:nerd[ _-]?font|[a-z0-9]NF[MP]?[-_. ]).*\.(?:ttf|otf|ttc)$/iu;
8
+ const MAX_NAMES = 4000;
9
+ const MAX_FOLDERS = 200;
10
+ const MAX_LEVELS = 3;
11
+
12
+ /** `LITCLAUDE_HUD_GLYPHS`, then the card's `glyphs` option; "auto" when neither chooses. */
13
+ export const glyphSetting = (env, option) => [env?.LITCLAUDE_HUD_GLYPHS, option].find((value) => EXPLICIT.includes(value)) ?? "auto";
14
+
15
+ export const drawsRoundCaps = (env) => Boolean(env?.WT_SESSION || env?.KITTY_WINDOW_ID)
16
+ || env?.TERM === "xterm-kitty" || /^(?:vscode|wezterm|ghostty)$/iu.test(env?.TERM_PROGRAM ?? "");
17
+
18
+ /** Every platform's font folders the environment names; one that is not here is simply empty. */
19
+ export const fontFolders = (env) => {
20
+ const home = env?.HOME?.trim();
21
+ const data = env?.XDG_DATA_HOME?.trim() || (home && `${home}/.local/share`);
22
+ return [
23
+ home && `${home}/Library/Fonts`, "/Library/Fonts",
24
+ data && `${data}/fonts`, home && `${home}/.fonts`, "/usr/local/share/fonts", "/usr/share/fonts",
25
+ env?.LOCALAPPDATA && `${env.LOCALAPPDATA}/Microsoft/Windows/Fonts`, env?.WINDIR && `${env.WINDIR}/Fonts`,
26
+ ].filter(Boolean);
27
+ };
28
+
29
+ /** Whether a Nerd Font's file name is in `folders`. `list(path)` gives { name, kind, isLink } entries; no font is opened. */
30
+ export const findNerdFont = async (list, folders) => {
31
+ let names = 0;
32
+ let opened = 0;
33
+ let level = folders;
34
+ for (let depth = 0; depth < MAX_LEVELS; depth += 1) {
35
+ const below = [];
36
+ for (const folder of level) {
37
+ opened += 1;
38
+ if (opened > MAX_FOLDERS) return false;
39
+ let entries = [];
40
+ try {
41
+ entries = await list(folder);
42
+ } catch {
43
+ // A missing or unreadable folder holds no font we can name.
44
+ }
45
+ for (const entry of Array.isArray(entries) ? entries : []) {
46
+ names += 1;
47
+ if (names > MAX_NAMES) return false;
48
+ if ((entry.kind === "file" || entry.isLink) && FONT_NAME.test(entry.name)) return true;
49
+ if (entry.kind !== "file" && !entry.isLink) below.push(`${folder}/${entry.name}`);
50
+ }
51
+ }
52
+ level = below;
53
+ }
54
+ return false;
55
+ };
56
+
57
+ /** `hasFont` is asked only when neither the setting nor the terminal has answered, and never over SSH. */
58
+ export const roundCaps = async ({ env, setting = glyphSetting(env), hasFont }) => {
59
+ if (setting !== "auto") return setting !== "basic";
60
+ return drawsRoundCaps(env) || (!env?.SSH_CONNECTION && await hasFont());
61
+ };
@@ -35,18 +35,15 @@ export const normalizeModSettings = (options) => ({
35
35
  export const effectiveMotion = (motion, hostSettings) => (hostSettings?.prefersReducedMotion === true ? "off" : motion);
36
36
 
37
37
  // The glyph set one surface draws. Private-use Nerd Font glyphs only reach the terminal, which
38
- // draws with the person's own fonts; `auto` uses them there when the icon font is installed. The
39
- // desktop app and the other surfaces always get the basic set.
38
+ // draws with the person's own fonts; `auto` uses them there when the icon font is installed, and only
39
+ // the round caps where round.mjs says the terminal draws those. The desktop app and the other surfaces
40
+ // always get the basic set.
40
41
  export const resolveGlyphs = (preference, surface, iconFontPresent, roundCaps = false) => {
41
42
  if (surface !== "terminal") return "basic";
42
43
  if (preference === "auto") return iconFontPresent ? "nerd" : roundCaps ? "round" : "basic";
43
44
  return preference === "nerd" ? "nerd" : "basic";
44
45
  };
45
46
 
46
- // Windows Terminal (1.21 and later) and VS Code draw the two round caps themselves, whatever font is
47
- // set, so `auto` rounds the pills there without the icon font and keeps every other symbol basic.
48
- export const drawsRoundCaps = (env) => Boolean(env?.WT_SESSION) || env?.TERM_PROGRAM === "vscode";
49
-
50
47
  const BASIC = Object.freeze({
51
48
  capLeft: "",
52
49
  capRight: "",