@litfamily/litclaude 1.0.45 → 1.0.46
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 +13 -0
- package/README.md +8 -8
- package/README_ko-KR.md +8 -8
- package/docs/assets/readme/badge-version.svg +1 -1
- package/package.json +1 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/lib/canonical-skill-resources.mjs +8 -8
- package/plugins/litclaude/lib/mod/state.mjs +12 -0
- package/plugins/litclaude/lib/mod/view.mjs +9 -3
- package/plugins/litclaude/lib/rewind/collect.mjs +6 -2
- package/plugins/litclaude/skills/lit-typographic-motion/SKILL.md +1 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover.mjs +1 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-gate.mjs +1 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-serve.mjs +126 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage.mjs +1 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/stage-kit.js +40 -1
- package/plugins/litclaude/skills/lit-typographic-motion/references/stage.md +43 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.46 - 2026-11-01
|
|
4
|
+
|
|
5
|
+
- A film stage can declare chroma-keyed overlay clips in `stage/clips/clips.json` (id, directory, frame count, fps).
|
|
6
|
+
Declared frames are checked against the clip limits and exempt from the flipbook rule; undeclared frame sets are
|
|
7
|
+
still refused. A page shows a clip frame-exactly from film time with `LitStage.clip`. Cover mode takes no clips.
|
|
8
|
+
- lit-adhd no longer reports a session that stopped as a lane still at work. A paused frame left in its workflow
|
|
9
|
+
stack from an earlier day kept the session marked as waiting on you, and that mark was exempt from the Stop hook's
|
|
10
|
+
idle record, so the brief said to wait for a lane that was not running. A session that stopped now reads idle or
|
|
11
|
+
ended; one that asked you a question, or holds a start-work approval, still waits.
|
|
12
|
+
- The LitClaude card no longer shows a cancelled or finished start-work as running. Another session's workflow stack
|
|
13
|
+
keeps its start-work step until that session ends, and the card drew it from the stack alone. It now checks
|
|
14
|
+
`boulder.json` and leaves out a start-work whose plan only cancelled or completed works ran.
|
|
15
|
+
|
|
3
16
|
## 1.0.45 - 2026-10-30
|
|
4
17
|
|
|
5
18
|
- lit-adhd no longer tells this session to `lit continue` a paused workflow, or `go` on its own run, while other
|
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
1
|
+
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/assets/cover-motion.webp" width="100%" alt="LitFamily motion cover: seven armored robots power on one by one, the LitClaude robot wakes with glowing eyes and a lit frame, then LITFAMILY and KEEP THE WORK LIT. light up." /></picture></p>
|
|
2
2
|
|
|
3
3
|
<h1 align="center">LitClaude</h1>
|
|
4
4
|
<p align="center"><strong>Keep the work lit.</strong></p>
|
|
5
5
|
<p align="center">A Claude Code plugin that helps every session plan the work, build it, check it, and leave a note the next session can pick up.</p>
|
|
6
6
|
<p align="center">
|
|
7
|
-
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
8
|
-
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
7
|
+
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/assets/readme/badge-version.svg" alt="1.0.46" />
|
|
8
|
+
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/assets/readme/badge-license.svg" alt="MIT license" /></a>
|
|
9
9
|
</p>
|
|
10
10
|
<p align="center">
|
|
11
|
-
<a href="https://github.com/wjgoarxiv/litclaude#readme">Full guide and skills gallery on GitHub</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
11
|
+
<a href="https://github.com/wjgoarxiv/litclaude#readme">Full guide and skills gallery on GitHub</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/README_ko-KR.md">한국어</a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
Add `lit` to a Claude Code prompt and Claude pins the goal, writes a failing test first,
|
|
@@ -77,7 +77,7 @@ the `/plugin` menu.
|
|
|
77
77
|
## More
|
|
78
78
|
|
|
79
79
|
- [Full guide and skills gallery on GitHub](https://github.com/wjgoarxiv/litclaude#readme)
|
|
80
|
-
- [Privacy and network behavior](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
81
|
-
- [Migration and ownership conflicts](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
82
|
-
- [Release history](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
83
|
-
- [MIT license](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
80
|
+
- [Privacy and network behavior](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/privacy.md)
|
|
81
|
+
- [Migration and ownership conflicts](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/migration.md)
|
|
82
|
+
- [Release history](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/CHANGELOG.md)
|
|
83
|
+
- [MIT license](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/LICENSE)
|
package/README_ko-KR.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
1
|
+
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/assets/cover-motion.webp" width="100%" alt="LitFamily 모션 커버: 일곱 로봇 패널이 차례로 켜지고, LitClaude 로봇의 눈과 테두리가 빛난 뒤 LITFAMILY와 KEEP THE WORK LIT. 문구가 밝아지는 영상" /></picture></p>
|
|
2
2
|
|
|
3
3
|
<h1 align="center">LitClaude</h1>
|
|
4
4
|
<p align="center"><strong>Keep the work lit.</strong></p>
|
|
5
5
|
<p align="center">Claude Code에서 세션마다 계획하고, 만들고, 확인한 뒤 다음 세션이 이어받을 기록을 남기게 돕는 플러그인입니다.</p>
|
|
6
6
|
<p align="center">
|
|
7
|
-
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
8
|
-
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
7
|
+
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/assets/readme/badge-version.svg" alt="1.0.46" />
|
|
8
|
+
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/assets/readme/badge-license.svg" alt="MIT license" /></a>
|
|
9
9
|
</p>
|
|
10
10
|
<p align="center">
|
|
11
|
-
<a href="https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md">전체 안내와 스킬 갤러리는 GitHub에서</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
11
|
+
<a href="https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md">전체 안내와 스킬 갤러리는 GitHub에서</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/README.md">English</a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
Claude Code 프롬프트에 `lit`을 붙이면 Claude가 목표를 고정하고, 실패하는 테스트를 먼저 쓰고,
|
|
@@ -75,7 +75,7 @@ npx @litfamily/litclaude@latest uninstall
|
|
|
75
75
|
## 더 보기
|
|
76
76
|
|
|
77
77
|
- [전체 안내와 스킬 갤러리 (GitHub)](https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md)
|
|
78
|
-
- [개인정보와 네트워크 동작](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
79
|
-
- [이전과 소유권 충돌](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
80
|
-
- [변경 이력](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
81
|
-
- [MIT 라이선스](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
78
|
+
- [개인정보와 네트워크 동작](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/privacy.md)
|
|
79
|
+
- [이전과 소유권 충돌](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/docs/migration.md)
|
|
80
|
+
- [변경 이력](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/CHANGELOG.md)
|
|
81
|
+
- [MIT 라이선스](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.46/LICENSE)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="146" height="20" role="img" aria-label="release: 1.0.
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="146" height="20" role="img" aria-label="release: 1.0.46"><title>release: 1.0.46</title><g shape-rendering="crispEdges"><rect width="49" height="20" fill="#080d14"/><rect x="49" width="97" height="20" fill="#ff6337"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text x="255" y="140" textLength="390" transform="scale(.1)">release</text><text x="965" y="140" textLength="870" transform="scale(.1)" fill="#080D14">1.0.46</text></g></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litfamily/litclaude",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"description": "Claude Code plugin: add lit to a prompt and Claude plans, tests, checks and reviews the work, then leaves a handoff for the next session.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
|
|
|
26
26
|
["lib/rename-aliases.mjs", "3ee93aec10d0dbe785c554ab3040173ee94fde27da1b440a54b0513e5d11a508"],
|
|
27
27
|
["lib/render_pages.py", "56312e376659a83a8547f60491ca2eac8ef2f3ddd763132cac0016f4d0cce542"],
|
|
28
28
|
["lib/rewind/brief.mjs", "11904c66063ff7c66556c22d198be746768ef0b5a31d40e3b4c6988dbf4b537c"],
|
|
29
|
-
["lib/rewind/collect.mjs", "
|
|
29
|
+
["lib/rewind/collect.mjs", "ffac66406d182a131b79197f4038fc43b205d73da2fc25dce34a10d12781ac91"],
|
|
30
30
|
["lib/rewind/gauge.mjs", "347095c1d36492bb996a679b67847261d15388b29962ed2ebaabec3cf0a5d9df"],
|
|
31
31
|
["lib/rewind/next-step.mjs", "75936e3f80ce3328f0a1487a5001dd73c625c996f14d43e4ffbc07c70b56fdd2"],
|
|
32
32
|
["lib/rewind/redact.mjs", "5bff5f69191f2ec07720f2dde20a850730fed884efb47a43f2604d7295a1615a"],
|
|
@@ -822,7 +822,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
|
|
|
822
822
|
["skills/lit-schematic/scripts/scaffold.mjs", "0934eef6321c69ce06730343ebb48c84494d7e8e28bda3c2dd0cfa14f85088db"],
|
|
823
823
|
["skills/lit-team/SKILL.md", "48f67ed6990ab36a9303ea0aa06b488d845b3608c247ba4aa1c07f866b848166"],
|
|
824
824
|
["skills/lit-team/scripts/team.mjs", "2c6df317dbe726315676e8632cba0a229653e80a9fe8456eaa617d4185e9577f"],
|
|
825
|
-
["skills/lit-typographic-motion/SKILL.md", "
|
|
825
|
+
["skills/lit-typographic-motion/SKILL.md", "80a757ddc97a4abd110a3b980348c7703db8bb678a4c095059d4817b26e8ee36"],
|
|
826
826
|
["skills/lit-typographic-motion/engine/NOTICE", "6734178ad953e5f40585d000c13e4803e670d9e8982b7f6ef0395d47a9eedf30"],
|
|
827
827
|
["skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES", "886c7e1b43afcb8b0e04d30cd3e941b35f5f03838ad31523ad3607586f877bf1"],
|
|
828
828
|
["skills/lit-typographic-motion/engine/audio/beat_grid.py", "bd2b3ab2a522371c4b2ccf65d888c5553b8bce95a78bf2839271622b8f8ec51f"],
|
|
@@ -852,7 +852,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
|
|
|
852
852
|
["skills/lit-typographic-motion/engine/node/cover-sheet.mjs", "2be97f3034364bf1bbb8c9ee9257a032f0fed9dda2a77ba4e245476dfa440c92"],
|
|
853
853
|
["skills/lit-typographic-motion/engine/node/cover-treatment.mjs", "cae66ea0450f208757d91e6e0272525dcba1e974c692571129f3b644aa0ca97c"],
|
|
854
854
|
["skills/lit-typographic-motion/engine/node/cover-worker.mjs", "c2af1efba3f0d1a08331a5dbb23bc4c32ba9449c4472da8140a48c5726d6053b"],
|
|
855
|
-
["skills/lit-typographic-motion/engine/node/cover.mjs", "
|
|
855
|
+
["skills/lit-typographic-motion/engine/node/cover.mjs", "48cac4ea6f891c0c14fdee2462de25ab8f72844945e6e680718ba46f2a3d34f5"],
|
|
856
856
|
["skills/lit-typographic-motion/engine/node/coverage.mjs", "1ac00bcb4526dde4318fbf899a4a3633288db335efd1a40e1903a73d0f7b4f2b"],
|
|
857
857
|
["skills/lit-typographic-motion/engine/node/done.mjs", "f90ffaa64ac4c77de7158460147c406eb729de1e7fe7edf061392ac6cd36df42"],
|
|
858
858
|
["skills/lit-typographic-motion/engine/node/encode.mjs", "29205272e1ec50ff29acfb4b02d92e713e2a3321eea5f01065a8b8c7ef88f799"],
|
|
@@ -872,10 +872,10 @@ export const canonicalSkillResourceManifest = Object.freeze(
|
|
|
872
872
|
["skills/lit-typographic-motion/engine/node/sound-cli.mjs", "e262c42f69b6c3ef0272f7c0f3bae9aa4ddcd2bc19f09eaed181b63fe63ace9f"],
|
|
873
873
|
["skills/lit-typographic-motion/engine/node/sound.mjs", "9f07961f118176d7a7a3580e02b6d6e17248a305510c28187b1995bc82254254"],
|
|
874
874
|
["skills/lit-typographic-motion/engine/node/stage-capture.mjs", "df061c2847a43156edec18a1d6ed54c42b01b42a24575adb32d640c6697a54b7"],
|
|
875
|
-
["skills/lit-typographic-motion/engine/node/stage-gate.mjs", "
|
|
875
|
+
["skills/lit-typographic-motion/engine/node/stage-gate.mjs", "3faefb8868446dcff600f69d7cd681966e4f7c2d09f3ec8bf330a221679f9a31"],
|
|
876
876
|
["skills/lit-typographic-motion/engine/node/stage-qa.mjs", "409c5fd3dc17bb998647245b6bb2bf58b96d2a6538f96c7d8ca9e2847c5988fe"],
|
|
877
|
-
["skills/lit-typographic-motion/engine/node/stage-serve.mjs", "
|
|
878
|
-
["skills/lit-typographic-motion/engine/node/stage.mjs", "
|
|
877
|
+
["skills/lit-typographic-motion/engine/node/stage-serve.mjs", "adef6d7c13c38bd111459ccf2a2a39908472358a48d90355f0ae56f0b5af0089"],
|
|
878
|
+
["skills/lit-typographic-motion/engine/node/stage.mjs", "4387a235dd2ad6158a42dc1242886285d46285390b6ef25eef37cfbb0908fb42"],
|
|
879
879
|
["skills/lit-typographic-motion/engine/node/stills.mjs", "be783fa50136be4dcbee7edfac8fcd60e3130ba7aeebb53cb11251a7c49ddbb7"],
|
|
880
880
|
["skills/lit-typographic-motion/engine/node/styles.mjs", "16533b7d404781788d25d0d7d0be3d876f0e4b05d13df929d04f871c1c86109b"],
|
|
881
881
|
["skills/lit-typographic-motion/engine/node/treatment.mjs", "4cbf449bf7d4611c5803ed21dbd6449b326358bd82a180be78c559bd0e9e8482"],
|
|
@@ -887,7 +887,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
|
|
|
887
887
|
["skills/lit-typographic-motion/engine/stage/init.js", "c5b76f3e3242ab5d4f39abda72eb4040af2e6c8c329c71f8def99ef023d91832"],
|
|
888
888
|
["skills/lit-typographic-motion/engine/stage/loop-kit.js", "dd2839c093c20ae1a0deca3a7a7099af2b4700e70ebcd38435d3bf6ff16f121f"],
|
|
889
889
|
["skills/lit-typographic-motion/engine/stage/qa.js", "9240b2b2f15955ccaec7b8447b69ce7335ffcea95336ed262323a4392f610b22"],
|
|
890
|
-
["skills/lit-typographic-motion/engine/stage/stage-kit.js", "
|
|
890
|
+
["skills/lit-typographic-motion/engine/stage/stage-kit.js", "6edc53b56a0a702150b029a85730dc8942ed92b52d9bcb901b9bc5fa6e9d3f0b"],
|
|
891
891
|
["skills/lit-typographic-motion/engine/vendor/three/LICENSE", "4c40a1ef62450b857c3b2aaf294936304cd552d965fbcd9d32d4c5bcf4ba4454"],
|
|
892
892
|
["skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js", "85869bdd22f7cf0b22e68dcefe6cb710480af0f5c901a76f7a7764fd07fc8014"],
|
|
893
893
|
["skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js", "d20aeaf7077c459a8d952d215738d7b44fba028440bb862d84b622a34f0c80bb"],
|
|
@@ -965,7 +965,7 @@ export const canonicalSkillResourceManifest = Object.freeze(
|
|
|
965
965
|
["skills/lit-typographic-motion/references/look.md", "fc0e09d9d2af4841d4490c0c35474275393ca175afab5f6092496f00d3a79568"],
|
|
966
966
|
["skills/lit-typographic-motion/references/runtime.md", "c9f3febf0fb86afcd326ecc92e118bc9d82e471c500d6b298563102ef84197d2"],
|
|
967
967
|
["skills/lit-typographic-motion/references/sound.md", "7073e16c8a082d36527087614e00b8471feee339061b527e9b392f9a3f78ff3a"],
|
|
968
|
-
["skills/lit-typographic-motion/references/stage.md", "
|
|
968
|
+
["skills/lit-typographic-motion/references/stage.md", "6f44235acf220ea463774043acddf8fbc63ec5f2babf5c53e81fa4e63fad7bbd"],
|
|
969
969
|
["skills/lit-typographic-motion/references/studio.md", "02e88aa9540057bcd60dfb8adb126110d17e67c7e8dcea55e9c079e2b76f8159"],
|
|
970
970
|
["skills/lit-typographic-motion/references/style-bibles.md", "2b7a6117d4774fec7a18cf0cf0d7fb26cf3b642b6688a60169de9336e46836da"],
|
|
971
971
|
["skills/lit-typographic-motion/references/treatment.md", "0456ec5d17356be3d3f1b2b28394d723f9ec511a677901191ed6323abd36f548"],
|
|
@@ -222,6 +222,17 @@ export const parseBoulder = (state, sessionId) => {
|
|
|
222
222
|
};
|
|
223
223
|
};
|
|
224
224
|
|
|
225
|
+
// Plan file names whose start-work is over: every work of the project that was cancelled or
|
|
226
|
+
// completed, minus any plan a live (active or paused) work runs again. Another session's stack keeps
|
|
227
|
+
// its start-work frame until that session ends, so the card asks boulder.json whether it still runs.
|
|
228
|
+
export const settledPlansOf = (state) => {
|
|
229
|
+
const works = state && state.works && typeof state.works === "object" ? Object.values(state.works) : [];
|
|
230
|
+
const planOf = (work) => (typeof work?.active_plan === "string" ? work.active_plan.split("/").at(-1) : "");
|
|
231
|
+
const live = new Set(works.filter((work) => ["active", "paused"].includes(work?.status)).map(planOf));
|
|
232
|
+
return [...new Set(works.filter((work) => ["cancelled", "completed"].includes(work?.status)).map(planOf))]
|
|
233
|
+
.filter((name) => name && !live.has(name));
|
|
234
|
+
};
|
|
235
|
+
|
|
225
236
|
const CRITERION_STATUSES = new Set(["pass", "fail", "blocked", "pending"]);
|
|
226
237
|
|
|
227
238
|
export const parseGoals = (state, sessionId) => {
|
|
@@ -509,6 +520,7 @@ export const readLitSnapshot = async (io, { cwd, sessionId, env = {} }) => {
|
|
|
509
520
|
ignition: parseIgnition(ignition, sessionId),
|
|
510
521
|
work,
|
|
511
522
|
completedWorkIds: completed,
|
|
523
|
+
settledPlans: settledPlansOf(boulder),
|
|
512
524
|
goal: parseGoals(goals, sessionId),
|
|
513
525
|
autoloop: parseAutoloop(autoloop),
|
|
514
526
|
litPlan: parseLitPlanTurn(litPlan, sessionId),
|
|
@@ -278,6 +278,11 @@ const seenAt = (other) => Math.max(Number.isFinite(other.at) ? other.at : -Infin
|
|
|
278
278
|
const STATE_ORDER = { running: 0, idle: 1 };
|
|
279
279
|
const runningFirst = (a, b) => (STATE_ORDER[a.state] ?? 2) - (STATE_ORDER[b.state] ?? 2) || b.seenAt - a.seenAt;
|
|
280
280
|
|
|
281
|
+
// Another session's start-work frame outlives its work: cancelling or finishing the work does not
|
|
282
|
+
// touch that session's stack. A frame whose plan only settled works ran (snapshot.settledPlans, from
|
|
283
|
+
// boulder.json) is over, so the top of another session is its last frame that is not.
|
|
284
|
+
const topLiveFrame = (other, settledPlans) => other?.frames?.findLast((frame) => !(frame.skill === "start-work" && frame.planRef && settledPlans.includes(frame.planRef.split("/").at(-1)))) ?? null;
|
|
285
|
+
|
|
281
286
|
// herdr lanes of this project: sessions whose hooks ran in a herdr pane (their liveness record keeps
|
|
282
287
|
// the pane id), drawn as lanes named `<top skill or claude> · <pane>`. This session, and any session
|
|
283
288
|
// in this session's own pane, are never listed.
|
|
@@ -291,7 +296,8 @@ const herdrLanesOf = (snapshot, others, now) => {
|
|
|
291
296
|
const other = others.find((candidate) => candidate.sessionId === id);
|
|
292
297
|
const live = currentLiveness(entry, other?.at);
|
|
293
298
|
if (live?.state === "ended" || (!live && other?.ended) || now - Math.max(entry.at, other?.at ?? -Infinity) > OTHER_SESSION_MS) return null;
|
|
294
|
-
const
|
|
299
|
+
const topFrame = topLiveFrame(other, snapshot.settledPlans ?? []);
|
|
300
|
+
const top = topFrame ? frameThread(topFrame, 0, {}, false, null, now) : { name: "claude", stage: null, done: null, total: null, state: "running", doneAt: null, active: false, elapsedMs: null };
|
|
295
301
|
return { ...top, key: `herdr-${entry.herdrPane}`, sessionId: id, name: `${top.name} · ${entry.herdrPane}`, state: otherState(top, live), seenAt: Math.max(entry.at, other?.at ?? -Infinity) };
|
|
296
302
|
})
|
|
297
303
|
.filter((thread) => thread && lingering(thread, now))
|
|
@@ -332,10 +338,10 @@ const threadsOf = ({ snapshot, lanes, tasks, lists, now, threadReserve }) => {
|
|
|
332
338
|
const others = (snapshot.workflow?.others ?? [])
|
|
333
339
|
.filter((other) => {
|
|
334
340
|
const live = currentLiveness(other.liveness, other.at);
|
|
335
|
-
return (live ? live.state !== "ended" : !other.ended) && !inHerdr.has(other.sessionId) && now - seenAt(other) <= OTHER_SESSION_MS && other.
|
|
341
|
+
return (live ? live.state !== "ended" : !other.ended) && !inHerdr.has(other.sessionId) && now - seenAt(other) <= OTHER_SESSION_MS && topLiveFrame(other, snapshot.settledPlans ?? []);
|
|
336
342
|
})
|
|
337
343
|
.map((other) => {
|
|
338
|
-
const thread = frameThread(other.
|
|
344
|
+
const thread = frameThread(topLiveFrame(other, snapshot.settledPlans ?? []), 0, {}, false, null, now);
|
|
339
345
|
return { ...thread, key: `session-${other.id8}`, session: other.id8, state: otherState(thread, currentLiveness(other.liveness, other.at)), seenAt: seenAt(other) };
|
|
340
346
|
})
|
|
341
347
|
.filter((thread) => lingering(thread, now))
|
|
@@ -422,14 +422,18 @@ export const collectRewind = ({
|
|
|
422
422
|
}
|
|
423
423
|
const recentRuns = (runs ?? []).filter((run) => now - run.atMs <= sinceMs).sort((a, b) => b.atMs - a.atMs);
|
|
424
424
|
for (const session of sessions) {
|
|
425
|
-
|
|
425
|
+
// A paused frame in a stack can be a day old, so it alone does not keep a session that stopped
|
|
426
|
+
// from reading as waiting (and as a lane at work); a question it asked, or a boundary, does.
|
|
427
|
+
const pausedOnly = session.waitingReason === "paused workflow";
|
|
428
|
+
if ((sessionId && session.sessionId === sessionId) || (session.status === "waiting-on-user" && !pausedOnly)) continue;
|
|
426
429
|
const live = newestLiveness.get(session.sessionId);
|
|
427
430
|
const run = recentRuns.find((item) => item.sessionId === session.sessionId);
|
|
428
|
-
if (run && !(live?.state === "alive" && live.atMs > run.atMs)) {
|
|
431
|
+
if (!pausedOnly && run && !(live?.state === "alive" && live.atMs > run.atMs)) {
|
|
429
432
|
session.status = "done";
|
|
430
433
|
session.finishedPlan = run.plan;
|
|
431
434
|
} else if (live && live.state !== "alive" && live.atMs >= (session.lastMs ?? 0) - LIVENESS_SLACK_MS) {
|
|
432
435
|
session.status = live.state === "ended" ? "ended" : "idle";
|
|
436
|
+
delete session.waitingReason;
|
|
433
437
|
}
|
|
434
438
|
}
|
|
435
439
|
sessions.sort((a, b) => statusRank[a.status] - statusRank[b.status] || (b.lastMs ?? 0) - (a.lastMs ?? 0));
|
|
@@ -124,7 +124,7 @@ Done needs all of: a valid treatment; gate PASS; at least two look rounds, the f
|
|
|
124
124
|
| 14 | BLOCKED_DEPS_NOT_PREWARMED | Tell the user to run `litclaude-ai motion-runtime install` outside this session. |
|
|
125
125
|
| 15 | BLOCKED_FONT_FETCH | A cached font is missing or its sha256 differs; same fix. |
|
|
126
126
|
| 16 | BLOCKED_TREATMENT_INVALID | Fix the named field. |
|
|
127
|
-
| 17 | STAGE_CONTRACT_ERROR | Fix the named element, API, raster, size or missing copy line. |
|
|
127
|
+
| 17 | STAGE_CONTRACT_ERROR | Fix the named element, API, raster, clip, size or missing copy line. |
|
|
128
128
|
| 18 | STAGE_NONDETERMINISTIC | Seed it or drive it from `t`. |
|
|
129
129
|
| 19 | STAGE_NETWORK_REQUEST | Remove the named URL; everything is local. |
|
|
130
130
|
| 20 | SOUND_INVALID | Fix the planned sound. |
|
|
@@ -216,7 +216,7 @@ function prepare({ out, env, log }) {
|
|
|
216
216
|
const treatment = asBlocked(() => loadCoverTreatment(out));
|
|
217
217
|
const stageDir = path.join(out, COVER_STAGE);
|
|
218
218
|
if (!existsSync(path.join(stageDir, "index.html"))) throw new BlockedError(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${path.join(stageDir, "index.html")} is missing; write the cover page first (references/cover.md)`);
|
|
219
|
-
const scan = scanStage(stageDir);
|
|
219
|
+
const scan = scanStage(stageDir, { clips: false });
|
|
220
220
|
for (const w of scan.warnings) log(`warning: ${w}`);
|
|
221
221
|
const { assets } = checkAssets({ out, treatment, rasters: scan.rasters, coverDir: COVER_STAGE });
|
|
222
222
|
return { treatment, stageDir, assets, faces: stageFonts(env) };
|
|
@@ -164,6 +164,7 @@ export function formatStageReport({ gate, manifest, outputs, round, framesViewed
|
|
|
164
164
|
`format / duration / fps: ${manifest.format} ${manifest.width}x${manifest.height}, ${manifest.durationSec} s (treatment ${manifest.treatmentDurationSec} s) @ ${manifest.fps} fps, ${manifest.frameCount} frames`,
|
|
165
165
|
`renderer: ${manifest.renderer} (${manifest.rung ?? "software"} rung, stage flags: ${manifest.chromeFlags.join(" ")})`,
|
|
166
166
|
...(manifest.plate ? [`plate: Blender ${manifest.plate.blender}, ${manifest.plate.engine} ${manifest.plate.device}, ${manifest.plate.samples} spp, ${manifest.plate.frames} frames at ${manifest.plate.fps} fps`] : []),
|
|
167
|
+
...(manifest.clips?.length ? [`clips: ${manifest.clips.map((c) => `${c.id} ${c.frames} frames at ${c.fps} fps`).join(", ")} (keyed overlays, chosen from film time)`] : []),
|
|
167
168
|
`sound: ${manifest.sound?.mode ?? "none"}${manifest.sound?.label ? ` (${manifest.sound.label})` : ""}`,
|
|
168
169
|
"",
|
|
169
170
|
`QA gate: ${gate.pass ? "PASS" : "FAIL"}`,
|
|
@@ -9,6 +9,7 @@ import { fileURLToPath } from "node:url";
|
|
|
9
9
|
import { EXIT } from "../core/constants.mjs";
|
|
10
10
|
import { readPlate } from "./blender.mjs";
|
|
11
11
|
import { BlockedError } from "./chrome.mjs";
|
|
12
|
+
import { decodePng } from "./png.mjs";
|
|
12
13
|
import { checkFont, fontLocation, fontsDir, loadFontManifest } from "./runtime.mjs";
|
|
13
14
|
|
|
14
15
|
export const STAGE_ORIGIN = "http://lit.stage";
|
|
@@ -28,6 +29,13 @@ export const CONTENT_TYPES = Object.freeze({
|
|
|
28
29
|
});
|
|
29
30
|
export const RASTER = Object.freeze([".png", ".jpg", ".jpeg", ".webp", ".gif"]);
|
|
30
31
|
export const RASTER_LIMITS = Object.freeze({ count: 24, bytes: 8 * 1024 * 1024, flipbook: 10 });
|
|
32
|
+
// Keyed overlay clips (references/stage.md, Clips): frame sequences declared in stage/clips/clips.json
|
|
33
|
+
// are held to these caps instead of RASTER_LIMITS. A clip is a sticker on the film, never the film:
|
|
34
|
+
// 8-bit RGBA PNG frames with real transparency, at most `side` px on the long side, at most 30 fps.
|
|
35
|
+
export const CLIP_LIMITS = Object.freeze({
|
|
36
|
+
clips: 12, framesPerClip: 360, framesTotal: 1500, bytesPerClip: 40 * 1024 * 1024, bytesTotal: 128 * 1024 * 1024, side: 720, fps: 30,
|
|
37
|
+
});
|
|
38
|
+
export const CLIPS_DIR = "clips";
|
|
31
39
|
|
|
32
40
|
// The product's verified faces as CSS families. Archivo's widths are one family at three stretches.
|
|
33
41
|
const FAMILIES = [
|
|
@@ -107,7 +115,7 @@ function pngInfo(b) {
|
|
|
107
115
|
if (type === "IDAT" || type === "IEND") break;
|
|
108
116
|
o += 12 + len;
|
|
109
117
|
}
|
|
110
|
-
return { width: b.readUInt32BE(16), height: b.readUInt32BE(20), animated };
|
|
118
|
+
return { width: b.readUInt32BE(16), height: b.readUInt32BE(20), animated, bitDepth: b[24], colorType: b[25] };
|
|
111
119
|
}
|
|
112
120
|
function jpegInfo(b) {
|
|
113
121
|
if (b[0] !== 0xff || b[1] !== 0xd8) return null;
|
|
@@ -165,6 +173,97 @@ export function rasterInfo(file) {
|
|
|
165
173
|
return null;
|
|
166
174
|
}
|
|
167
175
|
|
|
176
|
+
// ---- declared clips: stage/clips/clips.json and the frame folders it names ----
|
|
177
|
+
const clipFail = (message) => new BlockedError(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${message}`);
|
|
178
|
+
const clipFrame = (i) => `frame_${String(i).padStart(4, "0")}.png`;
|
|
179
|
+
const CLIP_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,39}$/u;
|
|
180
|
+
const CLIP_DIR = /^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/u;
|
|
181
|
+
|
|
182
|
+
/** The clips stage/clips/clips.json declares ([] without the file), checked for shape only. Throws exit 17. */
|
|
183
|
+
export function declaredClips(stageDir, limits = CLIP_LIMITS) {
|
|
184
|
+
const file = path.join(stageDir, CLIPS_DIR, "clips.json");
|
|
185
|
+
if (!existsSync(file)) return [];
|
|
186
|
+
let doc;
|
|
187
|
+
try {
|
|
188
|
+
doc = JSON.parse(readFileSync(file, "utf8"));
|
|
189
|
+
} catch (error) {
|
|
190
|
+
throw clipFail(`${CLIPS_DIR}/clips.json is not valid JSON (${error.message})`);
|
|
191
|
+
}
|
|
192
|
+
if (!doc || !Array.isArray(doc.clips)) throw clipFail(`${CLIPS_DIR}/clips.json needs { "clips": [ { "id", "dir", "count", "fps" } ] }`);
|
|
193
|
+
if (doc.clips.length > limits.clips) throw clipFail(`${doc.clips.length} clips declared (at most ${limits.clips} clips)`);
|
|
194
|
+
const ids = new Set();
|
|
195
|
+
const dirs = new Set();
|
|
196
|
+
return doc.clips.map((c, n) => {
|
|
197
|
+
const at = `${CLIPS_DIR}/clips.json clip #${n + 1}`;
|
|
198
|
+
if (!c || typeof c !== "object") throw clipFail(`${at} is not an object`);
|
|
199
|
+
if (typeof c.id !== "string" || !CLIP_ID.test(c.id)) throw clipFail(`${at}: id must be a plain token of letters, digits, - and _ (got ${JSON.stringify(c.id)})`);
|
|
200
|
+
if (ids.has(c.id)) throw clipFail(`${at}: duplicate id ${c.id}`);
|
|
201
|
+
ids.add(c.id);
|
|
202
|
+
if (typeof c.dir !== "string" || !CLIP_DIR.test(c.dir) || c.dir.includes("..")) throw clipFail(`clip "${c.id}": dir must be a folder name directly under ${CLIPS_DIR}/ (got ${JSON.stringify(c.dir)})`);
|
|
203
|
+
if (dirs.has(c.dir)) throw clipFail(`clip "${c.id}": dir ${c.dir} is already declared by another clip`);
|
|
204
|
+
dirs.add(c.dir);
|
|
205
|
+
if (!Number.isInteger(c.count) || c.count < 1) throw clipFail(`clip "${c.id}": count must be a whole number of frames (got ${JSON.stringify(c.count)})`);
|
|
206
|
+
if (!Number.isInteger(c.fps) || c.fps < 1 || c.fps > limits.fps) throw clipFail(`clip "${c.id}": fps must be a whole number from 1 to ${limits.fps} (got ${JSON.stringify(c.fps)})`);
|
|
207
|
+
return { id: c.id, dir: c.dir, count: c.count, fps: c.fps };
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Check every declared clip against its bytes: exactly frame_0001.png..frame_<count>.png in
|
|
213
|
+
* clips/<dir>/, each an 8-bit non-animated RGBA PNG of one size within the overlay cap, with real
|
|
214
|
+
* transparency in the first, middle and last frame, and the per-clip and total caps. Returns
|
|
215
|
+
* [{ id, dir, count, fps, width, height, bytes, frames }] where `frames` are stage-relative paths.
|
|
216
|
+
*/
|
|
217
|
+
export function scanClips(stageDir, { limits = CLIP_LIMITS, files = listStage(stageDir) } = {}) {
|
|
218
|
+
const decls = declaredClips(stageDir, limits);
|
|
219
|
+
let totalFrames = 0;
|
|
220
|
+
let totalBytes = 0;
|
|
221
|
+
const clips = decls.map((d) => {
|
|
222
|
+
const prefix = `${CLIPS_DIR}${path.sep}${d.dir}${path.sep}`;
|
|
223
|
+
if (d.count > limits.framesPerClip) throw clipFail(`clip "${d.id}": ${d.count} frames (at most ${limits.framesPerClip} per clip)`);
|
|
224
|
+
const have = new Map(files.filter((f) => f.rel.startsWith(prefix) && RASTER.includes(path.extname(f.rel).toLowerCase())).map((f) => [f.rel.slice(prefix.length), f]));
|
|
225
|
+
const frames = [];
|
|
226
|
+
for (let i = 1; i <= d.count; i++) {
|
|
227
|
+
const f = have.get(clipFrame(i));
|
|
228
|
+
if (!f) throw clipFail(`clip "${d.id}": ${CLIPS_DIR}/${d.dir}/${clipFrame(i)} is missing (declared ${d.count} frames, named frame_0001.png onward)`);
|
|
229
|
+
frames.push(f);
|
|
230
|
+
}
|
|
231
|
+
if (have.size !== d.count) {
|
|
232
|
+
const stray = [...have.keys()].find((name) => !frames.some((f) => f.rel.endsWith(`${path.sep}${name}`)));
|
|
233
|
+
throw clipFail(`clip "${d.id}": ${CLIPS_DIR}/${d.dir}/${stray} is not one of the ${d.count} declared frames; raise count or remove it`);
|
|
234
|
+
}
|
|
235
|
+
let size = null;
|
|
236
|
+
for (const f of frames) {
|
|
237
|
+
const info = rasterInfo(f.real);
|
|
238
|
+
if (path.extname(f.rel).toLowerCase() !== ".png" || !info) throw clipFail(`clip "${d.id}": ${f.rel} is not a readable PNG`);
|
|
239
|
+
if (info.animated) throw clipFail(`clip "${d.id}": ${f.rel} is an animated image; a clip is a folder of still frames`);
|
|
240
|
+
if (info.colorType !== 6 || info.bitDepth !== 8) throw clipFail(`clip "${d.id}": ${f.rel} must be an 8-bit RGBA PNG with an alpha channel (a keyed frame), not an opaque image`);
|
|
241
|
+
if (Math.max(info.width, info.height) > limits.side) throw clipFail(`clip "${d.id}": ${f.rel} is ${info.width}x${info.height}; a clip is an overlay of at most ${limits.side} px on the long side`);
|
|
242
|
+
if (size && (size.width !== info.width || size.height !== info.height)) throw clipFail(`clip "${d.id}": ${f.rel} is ${info.width}x${info.height} but frame_0001.png is ${size.width}x${size.height}; one size per clip`);
|
|
243
|
+
size = { width: info.width, height: info.height };
|
|
244
|
+
}
|
|
245
|
+
const bytes = frames.reduce((s, f) => s + f.bytes, 0);
|
|
246
|
+
if (bytes > limits.bytesPerClip) throw clipFail(`clip "${d.id}": ${(bytes / 1048576).toFixed(1)} MB (at most ${(limits.bytesPerClip / 1048576).toFixed(0)} MB per clip)`);
|
|
247
|
+
for (const f of [frames[0], frames[Math.floor((frames.length - 1) / 2)], frames[frames.length - 1]]) {
|
|
248
|
+
let pixels;
|
|
249
|
+
try {
|
|
250
|
+
({ pixels } = decodePng(readFileSync(f.real)));
|
|
251
|
+
} catch (error) {
|
|
252
|
+
throw clipFail(`clip "${d.id}": ${f.rel} cannot be decoded (${error.message}); use a non-interlaced 8-bit RGBA PNG`);
|
|
253
|
+
}
|
|
254
|
+
let keyed = false;
|
|
255
|
+
for (let i = 3; i < pixels.length && !keyed; i += 4) keyed = pixels[i] < 255;
|
|
256
|
+
if (!keyed) throw clipFail(`clip "${d.id}": ${f.rel} has no transparent pixel; a clip is keyed, not a full-frame video`);
|
|
257
|
+
}
|
|
258
|
+
totalFrames += d.count;
|
|
259
|
+
totalBytes += bytes;
|
|
260
|
+
return { ...d, ...size, bytes, frames: frames.map((f) => f.rel) };
|
|
261
|
+
});
|
|
262
|
+
if (totalFrames > limits.framesTotal) throw clipFail(`${totalFrames} clip frames in all (at most ${limits.framesTotal})`);
|
|
263
|
+
if (totalBytes > limits.bytesTotal) throw clipFail(`${(totalBytes / 1048576).toFixed(1)} MB of clip frames in all (at most ${(limits.bytesTotal / 1048576).toFixed(0)} MB)`);
|
|
264
|
+
return clips;
|
|
265
|
+
}
|
|
266
|
+
|
|
168
267
|
// ---- the static pre-flight scan ----
|
|
169
268
|
const TEXT = new Set([".html", ".js", ".mjs", ".css", ".svg", ".json"]);
|
|
170
269
|
const NAMESPACES = /^http:\/\/www\.w3\.org\/(?:2000\/svg|1999\/xlink|1999\/xhtml|XML\/1998\/namespace|2000\/xmlns\/?)$/u;
|
|
@@ -183,9 +282,11 @@ const NETWORK_API = /\bnew\s+(WebSocket|WebTransport|RTCPeerConnection|EventSour
|
|
|
183
282
|
|
|
184
283
|
/**
|
|
185
284
|
* Scan the stage dir before launch. Throws exit 17 (contract) or 19 (network) naming the file and
|
|
186
|
-
* the thing found; returns { files, rasters, warnings, plate } otherwise (plate: the Blender plate,
|
|
285
|
+
* the thing found; returns { files, rasters, warnings, plate, clips } otherwise (plate: the Blender plate,
|
|
286
|
+
* or null; clips: the declared keyed clips, checked by scanClips, whose frames are not page rasters).
|
|
287
|
+
* `clips: false` (cover mode) ignores clips.json, so a declared folder is held to the raster limits.
|
|
187
288
|
*/
|
|
188
|
-
export function scanStage(stageDir) {
|
|
289
|
+
export function scanStage(stageDir, { clips: allowClips = true } = {}) {
|
|
189
290
|
if (!existsSync(path.join(stageDir, "index.html"))) throw new BlockedError(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${path.join(stageDir, "index.html")} is missing; write the stage page first (references/stage.md)`);
|
|
190
291
|
const files = listStage(stageDir);
|
|
191
292
|
const warnings = [];
|
|
@@ -195,6 +296,8 @@ export function scanStage(stageDir) {
|
|
|
195
296
|
const plate = readPlate(stageDir, "plate");
|
|
196
297
|
const preview = readPlate(stageDir, "plate-preview");
|
|
197
298
|
const listed = new Set([plate, preview].filter(Boolean).flatMap((p) => p.frames.map((f) => path.join(p.dir, f.name))));
|
|
299
|
+
const clips = allowClips ? scanClips(stageDir, { files }) : [];
|
|
300
|
+
for (const c of clips) for (const rel of c.frames) listed.add(rel);
|
|
198
301
|
for (const f of files) {
|
|
199
302
|
const ext = path.extname(f.rel).toLowerCase();
|
|
200
303
|
if (!CONTENT_TYPES[ext] && f.rel !== "scene.py") warnings.push(`${f.rel}: not a servable type; the page cannot load it`);
|
|
@@ -234,7 +337,24 @@ export function scanStage(stageDir) {
|
|
|
234
337
|
for (const [size, names] of bySize) {
|
|
235
338
|
if (names.length >= RASTER_LIMITS.flipbook) throw new BlockedError(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${names.length} rasters of ${size} look like a flipbook; animate the page, not a frame sequence`);
|
|
236
339
|
}
|
|
237
|
-
return { files, rasters, warnings, plate };
|
|
340
|
+
return { files, rasters, warnings, plate, clips };
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* window.LitClips for LitStage.clip: id -> { src, count, fps, width, height }, written from clips.json and
|
|
345
|
+
* the first frame's header. null when the stage declares no clips (or one the scan would refuse).
|
|
346
|
+
*/
|
|
347
|
+
function clipsScript(stageDir) {
|
|
348
|
+
let table;
|
|
349
|
+
try {
|
|
350
|
+
table = Object.fromEntries(declaredClips(stageDir).map((c) => {
|
|
351
|
+
const info = rasterInfo(path.join(stageDir, CLIPS_DIR, c.dir, clipFrame(1)));
|
|
352
|
+
return [c.id, { src: `${CLIPS_DIR}/${c.dir}`, count: c.count, fps: c.fps, width: info.width, height: info.height }];
|
|
353
|
+
}));
|
|
354
|
+
} catch {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
return Object.keys(table).length ? `window.LitClips = ${JSON.stringify(table)};\n` : null;
|
|
238
358
|
}
|
|
239
359
|
|
|
240
360
|
/**
|
|
@@ -242,6 +362,7 @@ export function scanStage(stageDir) {
|
|
|
242
362
|
* type } | { kind: "blocked", reason } | { kind: "missing" }, and records every refusal.
|
|
243
363
|
*/
|
|
244
364
|
export function stageRouter({ stageDir, faces, style = null, threeDir = THREE_DIR }) {
|
|
365
|
+
const clipsJs = clipsScript(stageDir);
|
|
245
366
|
const root = realpathSync(stageDir);
|
|
246
367
|
const css = fontsCss(faces);
|
|
247
368
|
const byRoute = new Map(faces.map((f) => [f.route, f.file]));
|
|
@@ -265,6 +386,7 @@ export function stageRouter({ stageDir, faces, style = null, threeDir = THREE_DI
|
|
|
265
386
|
if (pathname === "/lit/stage-kit.js") return { kind: "file", file: KIT_FILE, type: CONTENT_TYPES[".js"] };
|
|
266
387
|
if (pathname === "/lit/loop-kit.js") return { kind: "file", file: LOOP_KIT_FILE, type: CONTENT_TYPES[".js"] };
|
|
267
388
|
if (pathname === "/lit/fonts.css") return { kind: "body", body: css, type: CONTENT_TYPES[".css"] };
|
|
389
|
+
if (clipsJs && pathname === "/lit/clips.js") return { kind: "body", body: clipsJs, type: CONTENT_TYPES[".js"] };
|
|
268
390
|
if (pathname.startsWith("/lit/three/")) {
|
|
269
391
|
// A backslash is a separator on Windows, so it is refused with `..`; the realpath must stay inside
|
|
270
392
|
// the vendored folder, so a link out of it is refused too.
|
|
@@ -505,6 +505,7 @@ export async function renderStage({ out, round = 1, stillsOnly = false, env = pr
|
|
|
505
505
|
frameCount, seed: treatment.seed, renderer: finalState.webglRenderer ?? "no WebGL", rung: ctx.rung, chromeFlags: master.flags, usesWebGL: finalState.usesWebGL,
|
|
506
506
|
cuts, stills: { sha256: stills.sha256, poster: plan.poster, reduced: plan.reduced }, posterEncoding: poster,
|
|
507
507
|
geometry: geometryFor(width, height),
|
|
508
|
+
clips: scan.clips.map((c) => ({ id: c.id, frames: c.count, fps: c.fps, width: c.width, height: c.height, bytes: c.bytes })),
|
|
508
509
|
plate: scan.plate ? { blender: scan.plate.blender, engine: scan.plate.engine, device: scan.plate.device, samples: scan.plate.samples, fps: scan.plate.fps, frames: scan.plate.frames.length } : null,
|
|
509
510
|
sound: { mode: sound.mode, label: sound.label, file: sound.file ? path.relative(out, sound.file) : null, sha256: sound.file ? sha256(readFileSync(sound.file)) : null, lufs: sound.bed?.lufs ?? null },
|
|
510
511
|
preview: { encoder: preview.encoder, rung: preview.rung, attempts: preview.attempts },
|
|
@@ -759,6 +759,45 @@
|
|
|
759
759
|
};
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
+
// A declared keyed clip (stage/clips/clips.json, served as window.LitClips by /lit/clips.js): one
|
|
763
|
+
// wrapper at `box` over the film, holding the clip's frame for t. The frame is a pure function of
|
|
764
|
+
// film time, floor((t - start) * fps) + 1 within from..to, so no <video> and no real clock is
|
|
765
|
+
// involved. Before `start` and after `to` the wrapper is hidden (null) unless `hold` keeps the last
|
|
766
|
+
// frame or `loop` wraps by frame index. The wrapper is the element a page scales or fades; the
|
|
767
|
+
// <img> inside is replaced on a frame change, so the renderer waits for its decode before capture.
|
|
768
|
+
function clip({ parent, id, box } = {}) {
|
|
769
|
+
const all = root.LitClips;
|
|
770
|
+
if (!all) throw new Error('LitStage.clip: load <script src="/lit/clips.js"></script> before the kit helpers; the stage declares no clips (clips/clips.json)');
|
|
771
|
+
const c = all[id];
|
|
772
|
+
if (!c) throw new Error(`LitStage.clip: no clip "${id}" in clips/clips.json (declared: ${Object.keys(all).join(", ")})`);
|
|
773
|
+
if (!parent || !box || !(box.w > 0) || !(box.h > 0)) throw new Error("LitStage.clip: needs { parent, id, box: { x, y, w, h } }");
|
|
774
|
+
const wrap = document.createElement("div");
|
|
775
|
+
wrap.setAttribute("data-lit-clip", id);
|
|
776
|
+
Object.assign(wrap.style, { position: "absolute", left: `${box.x}px`, top: `${box.y}px`, width: `${box.w}px`, height: `${box.h}px`, display: "none", pointerEvents: "none" });
|
|
777
|
+
parent.append(wrap);
|
|
778
|
+
let shown = 0;
|
|
779
|
+
let img = null;
|
|
780
|
+
return (t, { start = 0, from = 1, to = c.count, loop = false, hold = false } = {}) => {
|
|
781
|
+
if (!(from >= 1 && to <= c.count && from <= to)) throw new Error(`LitStage.clip: from..to must lie within 1..${c.count} (got ${from}..${to})`);
|
|
782
|
+
const n = to - from + 1;
|
|
783
|
+
const k = Math.floor((t - start) * c.fps + 1e-6);
|
|
784
|
+
const i = k < 0 ? 0 : k < n ? from + k : loop ? from + (k % n) : hold ? to : 0;
|
|
785
|
+
wrap.style.display = i ? "block" : "none";
|
|
786
|
+
if (!i) return null;
|
|
787
|
+
if (i !== shown) {
|
|
788
|
+
const next = document.createElement("img");
|
|
789
|
+
next.src = `${c.src}/frame_${String(i).padStart(4, "0")}.png`;
|
|
790
|
+
next.alt = "";
|
|
791
|
+
Object.assign(next.style, { display: "block", width: "100%", height: "100%", objectFit: "contain" });
|
|
792
|
+
if (img) img.replaceWith(next);
|
|
793
|
+
else wrap.append(next);
|
|
794
|
+
img = next;
|
|
795
|
+
shown = i;
|
|
796
|
+
}
|
|
797
|
+
return wrap;
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
|
|
762
801
|
// ---- the page contract ----
|
|
763
802
|
const FORMATS = [[1920, 1080], [1080, 1920]];
|
|
764
803
|
function define(spec) {
|
|
@@ -779,6 +818,6 @@
|
|
|
779
818
|
clipRect, clipCircle, maskLinear, wipe,
|
|
780
819
|
mix, rgba,
|
|
781
820
|
clamp, lerp, invLerp, remap, smoothstep,
|
|
782
|
-
shot, zone, place, tokens, plate,
|
|
821
|
+
shot, zone, place, tokens, plate, clip,
|
|
783
822
|
});
|
|
784
823
|
})(typeof window !== "undefined" ? window : globalThis);
|
|
@@ -12,7 +12,8 @@ Start every page from `motion.mjs scaffold --out <dir>`, which writes the struct
|
|
|
12
12
|
SVG, PNG, JPG, WebP, JS, CSS and WAV files beside it. Nothing else is served.
|
|
13
13
|
- The page loads the fonts, the style and the kit from the renderer's own routes:
|
|
14
14
|
`<link rel="stylesheet" href="/lit/fonts.css">`, `<link rel="stylesheet" href="/lit/style.css">`,
|
|
15
|
-
`<script src="/lit/style.js"></script>` and `<script src="/lit/stage-kit.js"></script
|
|
15
|
+
`<script src="/lit/style.js"></script>` and `<script src="/lit/stage-kit.js"></script>`; a page
|
|
16
|
+
with clips also loads `<script src="/lit/clips.js"></script>` (Clips).
|
|
16
17
|
- Each shot's copy sits in its layout's type zone, in a type-role class and a colour class of the style;
|
|
17
18
|
the gate's style rules check the result (`studio.md`).
|
|
18
19
|
- The page calls `LitStage.define({ width, height, fps, duration, render })`, or sets
|
|
@@ -92,6 +93,8 @@ Every primitive is a pure function of its inputs. `LitStage` holds them all.
|
|
|
92
93
|
- `clamp`, `lerp`, `invLerp`, `remap(x, a, b, c, d)` and `smoothstep(a, b, x)` for arithmetic.
|
|
93
94
|
- `text(el, { decor })` marks a text run; `text({ content, x, y, w, h })` registers canvas text
|
|
94
95
|
(see Text).
|
|
96
|
+
- `clip({ parent, id, box })` shows a declared keyed clip (Clips): `const boom = clip({ parent, id: "boom",
|
|
97
|
+
box: { x: 1200, y: 300, w: 520, h: 511 } }); boom(t, { start: 2.1 });`.
|
|
95
98
|
- The style and the timeline (`studio.md`): `shot(t)` (the shot at `t`, with `p`, `local`,
|
|
96
99
|
`enter(delay, dur)`, `exit(dur)`), `zone(layout, part)` and `place(el, layout, part)` (a layout zone in
|
|
97
100
|
pixels), `tokens()` (the style's eases, durations, staggers and springs per object class).
|
|
@@ -115,6 +118,44 @@ Any other family falls back to a system face. The QA replay reports that, and fa
|
|
|
115
118
|
text. Set Korean copy in Pretendard. Never ask for a weight the family does not have (the browser
|
|
116
119
|
would synthesize a fake bold), and never animate tracking or width on Hangul.
|
|
117
120
|
|
|
121
|
+
## Clips
|
|
122
|
+
|
|
123
|
+
Real keyed footage (a reaction clip, a spinning-cat loop shot on green screen) joins the film as a
|
|
124
|
+
layer inside the page: the video is keyed outside the renderer into an 8-bit RGBA PNG per frame, the
|
|
125
|
+
frames are declared, and the page picks the frame from film time. A declared clip is exempt from the
|
|
126
|
+
flipbook and count rule; every other raster keeps its limits. Nothing is encoded by hand: the
|
|
127
|
+
frames are captured with the page, so the flash audit, the determinism replay and the text checks
|
|
128
|
+
run on the final pixels as for any other film.
|
|
129
|
+
|
|
130
|
+
1. Copy each clip's frames into the run's stage folder as `stage/clips/<dir>/frame_0001.png`,
|
|
131
|
+
`frame_0002.png`, and so on, with no gaps and no other image in the folder.
|
|
132
|
+
2. Declare them in `stage/clips/clips.json`:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{ "clips": [ { "id": "boom", "dir": "01-vine-boom", "count": 122, "fps": 30 } ] }
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`id` is the name the page uses; `dir` is a folder directly under `clips/`; `count` is the number of
|
|
139
|
+
frames; `fps` is the clip's own rate, 1 to 30. A clip used twice is declared once.
|
|
140
|
+
3. The page loads `<script src="/lit/clips.js"></script>` after the kit, registers each use with
|
|
141
|
+
`LitStage.clip({ parent, id, box })` once, and calls the returned `show(t, opts)` from `render(t)`.
|
|
142
|
+
`parent` is the element the clip sits in; `box` is its place in pixels, the frame fitted inside
|
|
143
|
+
it. `show` returns the clip's wrapper element, or `null` while hidden; scale, fade or move that
|
|
144
|
+
wrapper from `t` like any other layer. The frame is `floor((t - start) * fps) + 1`, counted
|
|
145
|
+
from `from`, so the cue is plain arithmetic: a clip whose own sound starts at frame 85 and must
|
|
146
|
+
land on a cue at 0.12 s has `start = 0.12 - 84 / 30`. Options: `start` (film seconds, default 0),
|
|
147
|
+
`from` and `to` (the frame range, default the whole clip), `loop` (wrap by frame index), `hold`
|
|
148
|
+
(keep the last frame). Before `start` and past `to`, without `loop` or `hold`, the clip is hidden.
|
|
149
|
+
|
|
150
|
+
The scan refuses, with exit 17 and the clip named: more than 12 clips, 360 frames in a clip or 1500
|
|
151
|
+
in all, 40 MB in a clip or 128 MB in all, a frame whose long side is above 720 px (a clip is an
|
|
152
|
+
overlay, not the film), a frame rate above 30, frames of mixed sizes, a missing or extra frame, a
|
|
153
|
+
frame that is not an 8-bit RGBA PNG or has no transparent pixel in the first, middle and last frame
|
|
154
|
+
(an opaque video is not keyed), an animated image, and a duplicate `id`. A folder that is not
|
|
155
|
+
declared, or any frame sequence beside a declared clip, is a flipbook as before. Cover mode takes
|
|
156
|
+
no clips. Keep clips clear of copy: the text checks look at DOM text, so a clip laid over a line is
|
|
157
|
+
yours to catch on the stills. The manifest and report list each clip.
|
|
158
|
+
|
|
118
159
|
## Clock
|
|
119
160
|
|
|
120
161
|
The renderer owns time. It steps a virtual clock frame by frame from 0 and captures the frames in
|
|
@@ -143,7 +184,7 @@ region. For variation, use `LitStage.rand(<seed>)`.
|
|
|
143
184
|
CDN.
|
|
144
185
|
- Rasters: at most 24 raster images and 8 MB in total. Ten or more rasters of the same size (a
|
|
145
186
|
flipbook), or any animated GIF, APNG or WebP, is exit 17. Rasters are textures and stills, never a
|
|
146
|
-
frame sequence.
|
|
187
|
+
frame sequence. The one frame sequence a page may carry is a declared keyed clip (Clips).
|
|
147
188
|
- Hand-encoded films are not the deliverable: no frame loop encoded by hand, no screen recording,
|
|
148
189
|
no raster flipbook. Every frame passes through the renderer.
|
|
149
190
|
|