@litfamily/litclaude 1.0.62 → 1.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +14 -11
- package/README_ko-KR.md +11 -10
- package/bin/install-ui.mjs +485 -0
- package/bin/litclaude-ai.js +301 -51
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/hooks.md +12 -8
- package/package.json +1 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
- package/plugins/litclaude/bin/litclaude-hud.js +76 -12
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/hooks/lit-mod.mjs +5 -3
- package/plugins/litclaude/lib/hud-accent-palette.mjs +5 -2
- package/plugins/litclaude/lib/mod/frame.mjs +92 -47
- package/plugins/litclaude/lib/mod/motion.mjs +3 -15
- package/plugins/litclaude/lib/mod/settings.mjs +10 -3
- package/plugins/litclaude/lib/mod/sunset.mjs +118 -0
- package/plugins/litclaude/lib/mod/timeline.mjs +10 -25
- package/plugins/litclaude/lib/start-work-lifecycle.mjs +10 -3
|
@@ -37,12 +37,16 @@ export const effectiveMotion = (motion, hostSettings) => (hostSettings?.prefersR
|
|
|
37
37
|
// The glyph set one surface draws. Private-use Nerd Font glyphs only reach the terminal, which
|
|
38
38
|
// draws with the person's own fonts; `auto` uses them there when the icon font is installed. The
|
|
39
39
|
// desktop app and the other surfaces always get the basic set.
|
|
40
|
-
export const resolveGlyphs = (preference, surface, iconFontPresent) => {
|
|
40
|
+
export const resolveGlyphs = (preference, surface, iconFontPresent, roundCaps = false) => {
|
|
41
41
|
if (surface !== "terminal") return "basic";
|
|
42
|
-
if (preference === "auto") return iconFontPresent ? "nerd" : "basic";
|
|
42
|
+
if (preference === "auto") return iconFontPresent ? "nerd" : roundCaps ? "round" : "basic";
|
|
43
43
|
return preference === "nerd" ? "nerd" : "basic";
|
|
44
44
|
};
|
|
45
45
|
|
|
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
|
+
|
|
46
50
|
const BASIC = Object.freeze({
|
|
47
51
|
capLeft: "",
|
|
48
52
|
capRight: "",
|
|
@@ -73,7 +77,10 @@ const NERD = Object.freeze({
|
|
|
73
77
|
branch: "",
|
|
74
78
|
});
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
// BASIC with round caps.
|
|
81
|
+
const ROUND = Object.freeze({ ...BASIC, capLeft: "", capRight: "" });
|
|
82
|
+
|
|
83
|
+
export const glyphSet = (glyphs) => (glyphs === "nerd" ? NERD : glyphs === "round" ? ROUND : BASIC);
|
|
77
84
|
|
|
78
85
|
// The status line's accents (hud-accent-palette.mjs HUD_ACCENT_THEMES, kept equal by a test) as
|
|
79
86
|
// xterm 256-colour codes. The mod cannot import that file, so the card reads the same names here.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// The card's sunset: a half-sunk sun, twinkling stars, a shooting star now and then and a glittering
|
|
2
|
+
// sea, painted over the cells of the last three body rows that no text uses. Text always wins: the
|
|
3
|
+
// sun stays away while any of its cells is taken, and the sea keeps two cells clear of words.
|
|
4
|
+
|
|
5
|
+
import { textWidth } from "./layout.mjs";
|
|
6
|
+
import { lerpColor } from "./motion.mjs";
|
|
7
|
+
|
|
8
|
+
const FAINT = "#30363d";
|
|
9
|
+
const REWIND_SPARKS = Object.freeze([".", "*", "+", "'"]);
|
|
10
|
+
const span = (text, style = {}) => ({ text, ...style });
|
|
11
|
+
|
|
12
|
+
// Cells back to spans: neighbours join when they came from the same span (`from`) and look the same, and the
|
|
13
|
+
// blank gaps between words join, whatever colour their spaces carried.
|
|
14
|
+
const joinCells = (cells) => cells.reduce((out, { from, ...styled }) => {
|
|
15
|
+
const cell = from === "gap" ? { text: styled.text } : styled;
|
|
16
|
+
const last = out.at(-1);
|
|
17
|
+
if (last && last.from === from && last.fg === cell.fg && last.bg === cell.bg && Boolean(last.bold) === Boolean(cell.bold)) last.text += cell.text;
|
|
18
|
+
else out.push({ from, ...cell });
|
|
19
|
+
return out;
|
|
20
|
+
}, []).map(({ from, ...part }) => part);
|
|
21
|
+
// The sunset scene, drawn only in cells no text uses. t is the ambient loop's elapsed seconds, null while the card
|
|
22
|
+
// rests: the same scene then holds still and costs no frames. Shape glyphs never change, only their colour; what does
|
|
23
|
+
// change its glyph (the sea, the stars) is ASCII.
|
|
24
|
+
export const SUN_W = 18;
|
|
25
|
+
const SUN_DARK = "#1a1030";
|
|
26
|
+
const SUN_INK = [["#ffd24a", "#fff0a0"], ["#ff8f3c", "#ffc15a"], ["#ff2d8a", "#ff6b8f"]];
|
|
27
|
+
// The dome's outline in eighth-blocks, so it curves; inside, a thin dark slit over the second row and a thicker one over the third.
|
|
28
|
+
const SUN_CELLS = [0, 1, 2].map((r) => Array.from({ length: SUN_W }, (_, x) => {
|
|
29
|
+
const d = (x - (SUN_W - 1) / 2) / (SUN_W / 2);
|
|
30
|
+
const fill = Math.max(0, Math.min(8, Math.round(Math.sqrt(1 - d * d) * 24) - (2 - r) * 8));
|
|
31
|
+
if (fill === 0) return null;
|
|
32
|
+
if (fill < 8) return ["▁▂▃▄▅▆▇"[fill - 1]];
|
|
33
|
+
return r === 0 ? ["█"] : [r === 1 ? "▇" : "▆", SUN_DARK];
|
|
34
|
+
}));
|
|
35
|
+
const STARS = [[0, -30], [1, -24], [0, -18], [1, -13], [0, -9], [1, -5], [0, 22], [1, 25], [0, 29], [1, 32], [0, 35]];
|
|
36
|
+
// Colours come in eight steps, mixed once and kept, so a frame mixes nothing twice and equal neighbours merge.
|
|
37
|
+
const steps = new Map();
|
|
38
|
+
export const mixed = (a, b, k) => {
|
|
39
|
+
const n = Math.max(0, Math.min(8, Math.round(k * 8)));
|
|
40
|
+
const key = a + b + n;
|
|
41
|
+
if (!steps.has(key)) { if (steps.size > 4000) steps.clear(); steps.set(key, lerpColor(a, b, n / 8)); }
|
|
42
|
+
return steps.get(key);
|
|
43
|
+
};
|
|
44
|
+
// Each look keeps its own colours: the invited card's velvet, YOUR TURN's amber; the rewind sun turns with its rainbow.
|
|
45
|
+
const SUN_LOOK = {
|
|
46
|
+
club: { ink: [["#ffd75f", "#fff6d6"], ["#ffb38a", "#ffe0b8"], ["#ff8fbf", "#ffc4e2"]], sea: ["#ffd75f", "#ffb38a", "#ff8fbf", "#b48cff", "#6a5aa8"] },
|
|
47
|
+
turn: { ink: [["#ffc95a", "#fff0b8"], ["#ffaf3c", "#ffd98a"], ["#e08a1e", "#ffb95a"]], sea: ["#ffd98a", "#ffaf3c", "#e08a1e", "#9a6420", "#5a4020"] },
|
|
48
|
+
};
|
|
49
|
+
const SEA = ["#ffdc73", "#ff9a4a", "#ff4f8b", "#b457d6", "#5a46a8"];
|
|
50
|
+
// The sea's light dx cells from under the sun: waves that travel outward, brightest on the sun's path.
|
|
51
|
+
const seaCell = (dx, t, SEA_INK = SEA) => {
|
|
52
|
+
const far = Math.abs(dx);
|
|
53
|
+
const wave = Math.sin(far * 0.62 - t * 2.3) + 0.8 * Math.sin(dx * 0.31 + t * 1.1) + 0.6 * Math.sin(dx * 1.37 - t * 0.7);
|
|
54
|
+
const level = wave * 0.62 + 1.05 - far / 34;
|
|
55
|
+
if (level < 0.22) return null;
|
|
56
|
+
const hue = Math.min(3.99, far / 13);
|
|
57
|
+
const base = mixed(SEA_INK[Math.floor(hue)], SEA_INK[Math.floor(hue) + 1], hue % 1);
|
|
58
|
+
return { text: level > 1.0 ? "~" : level > 0.55 ? "-" : ".", fg: mixed(FAINT, base, Math.min(1, 0.18 + level * 0.55)), ...(level > 1.5 ? { bold: true } : {}) };
|
|
59
|
+
};
|
|
60
|
+
// A row as one entry per cell; a wide character's second cell is null and a mark stays with its character.
|
|
61
|
+
const toCells = (row) => {
|
|
62
|
+
const cells = [];
|
|
63
|
+
row.forEach((part, index) => {
|
|
64
|
+
const from = part.bg || part.text.trim() ? index : "gap";
|
|
65
|
+
for (const ch of part.text) {
|
|
66
|
+
const width = textWidth(ch);
|
|
67
|
+
const last = cells.findLast(Boolean);
|
|
68
|
+
if (width === 0 && last) last.text += ch;
|
|
69
|
+
else cells.push({ ...part, text: ch, from }, ...(width === 2 ? [null] : []));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return cells;
|
|
73
|
+
};
|
|
74
|
+
const isFree = (cell) => Boolean(cell) && cell.text === " " && !cell.bg;
|
|
75
|
+
// Paints the last three body rows: stars and now and then a shooting star over the sun, the sea on the third.
|
|
76
|
+
// Returns the rows and whether the sun found room; the sea keeps two cells clear of any text.
|
|
77
|
+
export const paintScene = (rows, at, t, dim, sunOk, { look = null, rainbow = null, lift = 1, sparks = null } = {}) => {
|
|
78
|
+
const ink = SUN_LOOK[look]?.ink ?? SUN_INK;
|
|
79
|
+
const s = t ?? 0;
|
|
80
|
+
const grids = rows.map(toCells);
|
|
81
|
+
const shade = (hex) => (dim ? mixed(hex, FAINT, 0.6) : hex);
|
|
82
|
+
const sun = sunOk && grids.every((grid) => grid.slice(at - 2, at + SUN_W + 2).every(isFree) && grid.length >= at + SUN_W + 2);
|
|
83
|
+
const mid = at + SUN_W / 2 - 0.5;
|
|
84
|
+
if (sun) {
|
|
85
|
+
for (const [r, dx] of STARS) {
|
|
86
|
+
const x = at + dx;
|
|
87
|
+
// A star stands clear of words, so it never reads as part of one.
|
|
88
|
+
if (!isFree(grids[r][x]) || ![-3, -2, -1, 1, 2, 3].every((n) => grids[r][x + n] === undefined || isFree(grids[r][x + n]))) continue;
|
|
89
|
+
const tw = 0.5 + 0.5 * Math.sin(s * 1.7 + dx * 2.1);
|
|
90
|
+
grids[r][x] = span(tw > 0.85 ? "*" : tw > 0.45 ? "+" : ".", { fg: mixed(FAINT, shade(dx % 2 ? "#a99bff" : "#ff9ad5"), 0.35 + 0.65 * tw) });
|
|
91
|
+
}
|
|
92
|
+
const dash = t === null ? 9 : s % 9;
|
|
93
|
+
if (dash < 1.1) {
|
|
94
|
+
const head = Math.round(at + SUN_W + 22 - (dash / 1.1) * 34);
|
|
95
|
+
["*", "-", "-", "."].forEach((ch, i) => { if (isFree(grids[0][head + i])) grids[0][head + i] = span(ch, { fg: mixed("#fff4e0", "#b457d6", i / 3), bold: i === 0 }); });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (!rainbow && (t !== null || sun)) {
|
|
99
|
+
const sea = grids[2];
|
|
100
|
+
const before = sea.map(isFree);
|
|
101
|
+
for (let x = 0; x < sea.length; x += 1) {
|
|
102
|
+
const open = before[x] && [1, 2, 3].every((n) => before[x - n] !== false && before[x + n] !== false);
|
|
103
|
+
const cell = open ? seaCell(x - mid, s, SUN_LOOK[look]?.sea) : null;
|
|
104
|
+
if (cell) sea[x] = span(cell.text, { fg: shade(cell.fg), ...(cell.bold ? { bold: true } : {}) });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (sun) {
|
|
108
|
+
SUN_CELLS.forEach((line, r) => line.forEach((cell, x) => {
|
|
109
|
+
if (!cell) return;
|
|
110
|
+
// Heat: light runs up the sun and ripples across it.
|
|
111
|
+
const heat = 0.5 + 0.5 * Math.sin(s * 2.1 + r * 1.5 + 0.55 * Math.sin(x * 0.8 + s * 1.6));
|
|
112
|
+
grids[r][at + x] = span(cell[0], { fg: rainbow ? mixed(rainbow(x / SUN_W / 2 + r * 0.12), "#ffffff", 0.45 + 0.25 * heat) : shade(mixed(ink[r][0], ink[r][1], t === null ? 0.25 : 0.25 + (heat - 0.25) * lift)), ...(cell[1] ? { bg: cell[1] } : {}) });
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
// The rewind sparks keep drifting, behind the sun.
|
|
116
|
+
if (rainbow && sparks) for (const { x, glyph } of sparks) { const at2 = Math.floor(grids[2].length * (0.35 + 0.65 * x)); if (isFree(grids[2][at2]) && isFree(grids[2][at2 - 1])) grids[2][at2] = span(REWIND_SPARKS[glyph], { fg: rainbow(x) }); }
|
|
117
|
+
return { rows: grids.map((grid) => joinCells(grid.filter(Boolean))), sun };
|
|
118
|
+
};
|
|
@@ -167,29 +167,13 @@ const sparksAt = (elapsed) => SPARK_SEEDS.map(({ start, speed, twinkle }) => {
|
|
|
167
167
|
// the card (`comet`, 0 to 1: the top rule left to right, then the bottom rule right to left),
|
|
168
168
|
// where the bright head stands on the rail leaving the current stage (`flow`, 0 to 1), how far the
|
|
169
169
|
// rewind look's hue has turned (`hue`, 0 to 1 over TIMINGS.hue) and its sparks (`sparks`, full only).
|
|
170
|
-
//
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
state = (state * 1103515245 + 12345) % 2147483648;
|
|
177
|
-
return state / 2147483648;
|
|
178
|
-
};
|
|
179
|
-
return Object.freeze(Array.from({ length: 24 }, () => Object.freeze({ offset: next(), drift: next() - 0.5, place: next(), pace: 0.75 + 0.5 * next() })));
|
|
180
|
-
})();
|
|
181
|
-
const placeOf = (seed, generation) => {
|
|
182
|
-
const v = Math.sin((seed.place * 977 + generation * 131.7) * 12.9898) * 43758.5453;
|
|
183
|
-
return v - Math.floor(v);
|
|
170
|
+
// Seconds of glint played so far: it stands still between passes, so whatever follows it never jumps.
|
|
171
|
+
const glintSeconds = (timeline, now) => {
|
|
172
|
+
if (!timeline.glint?.on || timeline.exitAt !== null) return null;
|
|
173
|
+
const elapsed = Math.max(0, now - timeline.glint.at - TIMINGS.clubGlintRest);
|
|
174
|
+
const into = Math.min(TIMINGS.clubGlint, elapsed % TIMINGS.clubGlintPeriod);
|
|
175
|
+
return (Math.floor(elapsed / TIMINGS.clubGlintPeriod) * TIMINGS.clubGlint + into) / 1000;
|
|
184
176
|
};
|
|
185
|
-
const particlesAt = (elapsed, style) => Object.fromEntries(style.rows.map((row, r) => [row, PARTICLE_SEEDS.slice(r * 12, r * 12 + style.count).map((seed) => {
|
|
186
|
-
const cycle = (elapsed * seed.pace) / style.life + seed.offset;
|
|
187
|
-
const generation = Math.floor(cycle);
|
|
188
|
-
const age = cycle - generation;
|
|
189
|
-
const x = placeOf(seed, generation) + seed.drift * 0.08 * age;
|
|
190
|
-
return { x: Math.min(0.999, Math.max(0, x)), age, glyph: Math.min(style.ramp.length - 1, Math.floor(age * style.ramp.length)) };
|
|
191
|
-
})]));
|
|
192
|
-
|
|
193
177
|
const ambientSample = (timeline, now, profile) => {
|
|
194
178
|
if (!ambientActive(timeline, profile)) return null;
|
|
195
179
|
const elapsed = Math.max(0, now - timeline.ambient.at);
|
|
@@ -197,12 +181,12 @@ const ambientSample = (timeline, now, profile) => {
|
|
|
197
181
|
const pass = ((elapsed % TIMINGS.sweep) / TIMINGS.sweep) * 1.6 - 0.3;
|
|
198
182
|
return {
|
|
199
183
|
breath,
|
|
184
|
+
t: profile.ambient.sweep ? elapsed / 1000 : null,
|
|
200
185
|
sweep: profile.ambient.sweep && pass >= -0.2 && pass <= 1.2 ? pass : null,
|
|
201
186
|
comet: profile.ambient.comet ? (elapsed % TIMINGS.comet) / TIMINGS.comet : null,
|
|
202
187
|
flow: profile.ambient.sweep ? (elapsed % TIMINGS.flow) / TIMINGS.flow : null,
|
|
203
188
|
hue: (elapsed % TIMINGS.hue) / TIMINGS.hue,
|
|
204
189
|
sparks: profile.ambient.sweep ? sparksAt(elapsed) : null,
|
|
205
|
-
particles: profile.particles ? { style: profile.particles, rows: particlesAt(elapsed, profile.particles) } : null,
|
|
206
190
|
};
|
|
207
191
|
};
|
|
208
192
|
|
|
@@ -216,7 +200,7 @@ export const timelineBusy = (timeline, now, profile) => {
|
|
|
216
200
|
if (timeline.notice && now < timeline.notice.at + d(TIMINGS.noticeIn)) return true;
|
|
217
201
|
if (timeline.leaving && now < timeline.leaving.at + d(TIMINGS.noticeOut)) return true;
|
|
218
202
|
if (timeline.completion && now < timeline.completion.at + d(TIMINGS.completion)) return true;
|
|
219
|
-
if (profile.
|
|
203
|
+
if (profile.shimmer && timeline.stage?.at !== null && timeline.stage?.at !== undefined && now < timeline.stage.at + TIMINGS.kick) return true;
|
|
220
204
|
return Object.values(timeline.chips).some((chip) => (chip.arrivedAt !== null && now < chip.arrivedAt + d(TIMINGS.shimmer))
|
|
221
205
|
|| (chip.from !== chip.state && now < chip.changedAt + d(TIMINGS.crossfade)));
|
|
222
206
|
};
|
|
@@ -285,9 +269,10 @@ export const sampleTimeline = (timeline, now, profile) => {
|
|
|
285
269
|
chips,
|
|
286
270
|
ambient: ambientSample(timeline, now, profile),
|
|
287
271
|
glint: glintAt(timeline, now),
|
|
272
|
+
glintT: glintSeconds(timeline, now),
|
|
288
273
|
step: timeline.step ? { name: timeline.step.name, elapsedMs: timeline.step.base + Math.max(0, now - timeline.step.at) } : null,
|
|
289
274
|
lanes: timeline.lanes ? { elapsedMs: timeline.lanes.base + Math.max(0, now - timeline.lanes.at) } : null,
|
|
290
|
-
kick: profile.
|
|
275
|
+
kick: profile.shimmer && timeline.stage?.at !== null && timeline.stage?.at !== undefined ? springKick(now - timeline.stage.at) : 0,
|
|
291
276
|
spin: Math.floor(Math.max(0, now) / TIMINGS.spin) % 4,
|
|
292
277
|
};
|
|
293
278
|
};
|
|
@@ -433,13 +433,19 @@ const idempotentReplay = (state, key, fingerprint) => {
|
|
|
433
433
|
const entry = state.idempotency[key];
|
|
434
434
|
if (!entry) return null;
|
|
435
435
|
if (entry.request_hash !== fingerprint) throw new StartWorkLifecycleError("idempotency key conflict", 409);
|
|
436
|
+
// A receipt keeps the response without its state copy; the replay attaches the current state.
|
|
437
|
+
// Entries written before receipts still carry their own state and replay as stored.
|
|
438
|
+
if (entry.state_omitted) return { ...clone(entry.response), state: publicState(state) };
|
|
436
439
|
return clone(entry.response);
|
|
437
440
|
};
|
|
438
441
|
|
|
439
442
|
const rememberIdempotency = (state, key, fingerprint, response) => {
|
|
443
|
+
// Storing `response.state` here kept a full copy of the state per key (16 keys reached ~1 MB).
|
|
444
|
+
const { state: omitted, ...receipt } = response;
|
|
440
445
|
state.idempotency[key] = {
|
|
441
446
|
request_hash: fingerprint,
|
|
442
|
-
response: clone(
|
|
447
|
+
response: clone(receipt),
|
|
448
|
+
...(omitted === undefined ? {} : { state_omitted: true }),
|
|
443
449
|
recorded_at: nowIso(),
|
|
444
450
|
};
|
|
445
451
|
};
|
|
@@ -2464,9 +2470,10 @@ export const startWorkFromInvocation = (root, { sessionId, promptId, plan = null
|
|
|
2464
2470
|
issuedBy: "user-invocation",
|
|
2465
2471
|
originPromptId: promptId,
|
|
2466
2472
|
});
|
|
2467
|
-
|
|
2473
|
+
// A replayed start reads the current state, where a finished work may already be trimmed away.
|
|
2474
|
+
const work = response.state.works[workId] ?? response.state.history.find(({ work_id: id }) => id === workId);
|
|
2468
2475
|
const inside = relative(canonicalRoot, planPath);
|
|
2469
|
-
return { started: { workId, plan: work.
|
|
2476
|
+
return { started: { workId, plan: work?.plan_name ?? planPath.split(/[\\/]/u).at(-1), next: work?.progress?.next_task ?? null, ...(inside && !inside.startsWith("..") && !isAbsolute(inside) ? { ref: inside.split(/[\\/]/u).join("/") } : {}) } };
|
|
2470
2477
|
};
|
|
2471
2478
|
|
|
2472
2479
|
const pendingFor = (state, sessionId) => {
|