@litfamily/litcodex 1.0.30 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/README-Ko-KR.md +11 -11
  2. package/README.md +11 -11
  3. package/dist/install/generated-skill-payload-hashes.d.ts +188 -82
  4. package/dist/install/generated-skill-payload-hashes.js +188 -82
  5. package/dist/install/skill-catalog.d.ts +1 -1
  6. package/dist/install/skill-catalog.js +12 -1
  7. package/dist/install/skill-resource-hashes.d.ts +1 -1
  8. package/dist/install/skill-resource-hashes.js +1 -1
  9. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
  10. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  11. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  12. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  13. package/marketplace/plugins/litcodex/components/lit-loop/directive.md +10 -4
  14. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-adhd.md +191 -0
  15. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-handoff.md +2 -0
  16. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-hijack.md +219 -0
  17. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-recap.md +2 -0
  18. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-schematic.md +199 -0
  19. package/marketplace/plugins/litcodex/components/lit-loop/directives/litwork.md +2 -1
  20. package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.d.ts +10 -0
  21. package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.js +67 -0
  22. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.d.ts +1 -1
  23. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.js +128 -8
  24. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.d.ts +19 -0
  25. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.js +58 -0
  26. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.d.ts +27 -0
  27. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.js +94 -7
  28. package/marketplace/plugins/litcodex/components/lit-loop/dist/cli.js +13 -3
  29. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.d.ts +2 -0
  30. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.js +8 -9
  31. package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.d.ts +5 -0
  32. package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.js +23 -0
  33. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +8 -0
  34. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +118 -11
  35. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.d.ts +1 -1
  36. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.js +29 -13
  37. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.d.ts +13 -0
  38. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.js +85 -0
  39. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.d.ts +55 -0
  40. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.js +227 -0
  41. package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.d.ts +5 -1
  42. package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.js +17 -1
  43. package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.d.ts +6 -0
  44. package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.js +6 -0
  45. package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.d.ts +1 -1
  46. package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.js +25 -1
  47. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.d.ts +79 -0
  48. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.js +310 -0
  49. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.js +5 -1
  50. package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.js +10 -0
  51. package/marketplace/plugins/litcodex/components/lit-loop/dist/redaction.js +18 -0
  52. package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.d.ts +15 -0
  53. package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.js +46 -9
  54. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.d.ts +10 -0
  55. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.js +88 -0
  56. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.d.ts +20 -0
  57. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.js +84 -0
  58. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.d.ts +6 -0
  59. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.js +41 -0
  60. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.d.ts +3 -0
  61. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.js +40 -0
  62. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.d.ts +48 -0
  63. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.js +292 -0
  64. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.d.ts +162 -0
  65. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.js +773 -0
  66. package/marketplace/plugins/litcodex/components/lit-loop/dist/route-heads.js +44 -2
  67. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-panel.js +1 -0
  68. package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.d.ts +6 -0
  69. package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.js +35 -0
  70. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.d.ts +3 -0
  71. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.js +15 -5
  72. package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-mention-scope.js +6 -0
  73. package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.d.ts +8 -0
  74. package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.js +57 -0
  75. package/marketplace/plugins/litcodex/components/lit-loop/dist/statusline.js +8 -3
  76. package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.d.ts +50 -0
  77. package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.js +178 -0
  78. package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.d.ts +1 -1
  79. package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.js +29 -5
  80. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.d.ts +10 -0
  81. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.js +11 -1
  82. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.d.ts +132 -0
  83. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.js +488 -0
  84. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  85. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  86. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  87. package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.d.ts +6 -0
  88. package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.js +65 -0
  89. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  90. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  91. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  92. package/marketplace/plugins/litcodex/hooks/hooks.json +24 -0
  93. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +6 -0
  94. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/components.css +414 -0
  95. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/fonts.json +22 -0
  96. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
  97. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
  98. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
  99. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
  100. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
  101. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
  102. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
  103. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
  104. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/ui.js +228 -0
  105. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/brand-and-imagery.md +1 -1
  106. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/complete-contract.md +1 -0
  107. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/craft-floor.md +2 -2
  108. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/default-editorial-pixel.json +15 -8
  109. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/design-choice.md +19 -0
  110. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/house-styles.md +235 -0
  111. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/motion-guide.md +2 -2
  112. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/probe-and-review.md +6 -0
  113. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/production-interview.md +2 -0
  114. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/slop-register.md +4 -4
  115. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
  116. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/lock-probe.mjs +196 -0
  117. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/page-probe.mjs +22 -4
  118. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
  119. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/probe.mjs +59 -13
  120. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/rule-data.mjs +38 -4
  121. package/marketplace/plugins/litcodex/skills/lit-adhd/SKILL.md +181 -0
  122. package/marketplace/plugins/litcodex/skills/lit-adhd/agents/openai.yaml +6 -0
  123. package/marketplace/plugins/litcodex/skills/lit-adhd/references/card-examples.md +147 -0
  124. package/marketplace/plugins/litcodex/skills/lit-adhd/references/status-taxonomy.md +37 -0
  125. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/SKILL.md +18 -7
  126. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/style-guide.md +20 -11
  127. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
  128. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
  129. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-swimlane.md +1 -1
  130. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +1 -1
  131. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree.md +3 -3
  132. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
  133. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/verifier-guide.md +1 -0
  134. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +1 -2
  135. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
  136. package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +12 -3
  137. package/marketplace/plugins/litcodex/skills/lit-docx/references/direction-step.md +6 -3
  138. package/marketplace/plugins/litcodex/skills/lit-hijack/SKILL.md +449 -0
  139. package/marketplace/plugins/litcodex/skills/lit-hijack/agents/openai.yaml +6 -0
  140. package/marketplace/plugins/litcodex/skills/lit-hijack/references/capture-and-provenance.md +100 -0
  141. package/marketplace/plugins/litcodex/skills/lit-hijack/references/clean-room-build.md +111 -0
  142. package/marketplace/plugins/litcodex/skills/lit-hijack/references/distil-and-licence.md +102 -0
  143. package/marketplace/plugins/litcodex/skills/lit-hijack/references/gap-and-port-design.md +125 -0
  144. package/marketplace/plugins/litcodex/skills/lit-hijack/references/parity-and-report.md +108 -0
  145. package/marketplace/plugins/litcodex/skills/lit-hijack/scripts/hijack.mjs +1050 -0
  146. package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +13 -4
  147. package/marketplace/plugins/litcodex/skills/lit-plan/SKILL.md +6 -0
  148. package/marketplace/plugins/litcodex/skills/lit-pptx/NOTICE +1 -0
  149. package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +35 -8
  150. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
  151. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
  152. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
  153. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/SOURCE.md +21 -0
  154. package/marketplace/plugins/litcodex/skills/lit-pptx/references/anti-slop-checklist.md +5 -2
  155. package/marketplace/plugins/litcodex/skills/lit-pptx/references/authoring-guide.md +3 -4
  156. package/marketplace/plugins/litcodex/skills/lit-pptx/references/density-and-fill.md +20 -6
  157. package/marketplace/plugins/litcodex/skills/lit-pptx/references/direction-step.md +26 -8
  158. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/14-engineering-review-computational-brutalism-ko.md +173 -0
  159. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/15-launch-pitch-neo-brutalism-ko.md +154 -0
  160. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/16-design-lecture-bauhaus-ko.md +139 -0
  161. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/17-community-programme-riso-ko.md +158 -0
  162. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/18-public-data-briefing-newsroom-ko.md +179 -0
  163. package/marketplace/plugins/litcodex/skills/lit-pptx/references/layout-families.md +42 -27
  164. package/marketplace/plugins/litcodex/skills/lit-pptx/references/title-treatments.md +31 -27
  165. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/bauhaus.md +136 -0
  166. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/chalk.md +1 -1
  167. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/computational-brutalism.md +145 -0
  168. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/neo-brutalism.md +155 -0
  169. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/newsroom.md +141 -0
  170. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/riso.md +133 -0
  171. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/signal.md +1 -1
  172. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/studio.md +1 -1
  173. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/compile-deck.js +1 -1
  174. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/craft_extras.py +136 -94
  175. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/embed_fonts.py +13 -1
  176. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
  177. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
  178. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-pack.js +386 -579
  179. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
  180. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
  181. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/office-run.mjs +2 -1
  182. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/qa_deck.py +7 -13
  183. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/render_pages.py +124 -0
  184. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
  185. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
  186. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
  187. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +100 -0
  188. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
  189. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
  190. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
  191. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
  192. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
  193. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
  194. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
  195. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
  196. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
  197. package/marketplace/plugins/litcodex/skills/lit-recap/SKILL.md +2 -0
  198. package/marketplace/plugins/litcodex/skills/lit-schematic/SKILL.md +198 -0
  199. package/marketplace/plugins/litcodex/skills/lit-schematic/agents/openai.yaml +6 -0
  200. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
  201. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
  202. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
  203. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
  204. package/marketplace/plugins/litcodex/skills/lit-schematic/references/cutaway-outputs.md +70 -0
  205. package/marketplace/plugins/litcodex/skills/lit-schematic/references/isometric-craft.md +101 -0
  206. package/marketplace/plugins/litcodex/skills/lit-schematic/references/journal-figures.md +72 -0
  207. package/marketplace/plugins/litcodex/skills/lit-schematic/references/kit-api.md +134 -0
  208. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pfd-and-layout.md +53 -0
  209. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-drafting.md +103 -0
  210. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-symbols.md +163 -0
  211. package/marketplace/plugins/litcodex/skills/lit-schematic/references/verification.md +100 -0
  212. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/doctor.mjs +57 -0
  213. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
  214. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/fonts.mjs +28 -0
  215. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
  216. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
  217. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
  218. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
  219. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
  220. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
  221. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/png.mjs +132 -0
  222. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
  223. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/route.mjs +218 -0
  224. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
  225. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
  226. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
  227. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/motion.mjs +129 -0
  228. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/qa.mjs +92 -0
  229. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/render.mjs +233 -0
  230. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/scaffold.mjs +60 -0
  231. package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/SKILL.md +34 -8
  232. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/SKILL.md +18 -14
  233. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +12 -0
  234. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/assets.mjs +388 -0
  235. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender/runner.py +221 -0
  236. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender.mjs +132 -0
  237. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/board.mjs +142 -0
  238. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/constants.mjs +6 -0
  239. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-assets.mjs +7 -4
  240. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-capture.mjs +8 -7
  241. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-init.js +14 -2
  242. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-treatment.mjs +38 -3
  243. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover.mjs +19 -4
  244. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/driver.mjs +8 -8
  245. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/gallery.mjs +147 -0
  246. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/house.mjs +45 -0
  247. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/image.mjs +89 -0
  248. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/look.mjs +58 -25
  249. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/runtime.mjs +59 -14
  250. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/safe-read.mjs +32 -0
  251. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/scaffold.mjs +208 -0
  252. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/score.mjs +668 -0
  253. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/sound.mjs +174 -31
  254. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-gate.mjs +45 -3
  255. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-kit.js +99 -1
  256. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.js +8 -1
  257. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.mjs +180 -11
  258. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-render.mjs +42 -12
  259. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-worker.mjs +7 -4
  260. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage.mjs +96 -10
  261. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/styles.mjs +233 -0
  262. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/treatment.mjs +291 -14
  263. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
  264. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
  265. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
  266. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
  267. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/expected.json +33 -0
  268. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
  269. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/cover.md +44 -7
  270. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/depth.md +156 -0
  271. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/design-choice.md +22 -0
  272. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/quality-gate.md +29 -7
  273. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/runtime.md +1 -1
  274. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/sound.md +87 -0
  275. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/stage.md +19 -7
  276. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/studio.md +246 -0
  277. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/style-bibles.md +2 -2
  278. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/treatment.md +41 -21
  279. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/render.mjs +51 -4
  280. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/paper.json +185 -0
  281. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/swiss-signal.json +188 -0
  282. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/terminalcore.json +182 -0
  283. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/tidal.json +187 -0
  284. package/marketplace/plugins/litcodex/skills/litresearch/SKILL.md +7 -0
  285. package/marketplace/plugins/litcodex/skills/litwork/SKILL.md +2 -1
  286. package/marketplace/plugins/litcodex/skills/readme-studio/SKILL.md +10 -0
  287. package/marketplace/plugins/litcodex/skills/review-work/SKILL.md +7 -1
  288. package/marketplace/plugins/litcodex/skills/start-work/SKILL.md +10 -0
  289. package/node_modules/@litcodex/lit-loop/directive.md +10 -4
  290. package/node_modules/@litcodex/lit-loop/directives/lit-adhd.md +191 -0
  291. package/node_modules/@litcodex/lit-loop/directives/lit-handoff.md +2 -0
  292. package/node_modules/@litcodex/lit-loop/directives/lit-hijack.md +219 -0
  293. package/node_modules/@litcodex/lit-loop/directives/lit-recap.md +2 -0
  294. package/node_modules/@litcodex/lit-loop/directives/lit-schematic.md +199 -0
  295. package/node_modules/@litcodex/lit-loop/directives/litwork.md +2 -1
  296. package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.d.ts +10 -0
  297. package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.js +67 -0
  298. package/node_modules/@litcodex/lit-loop/dist/card-html.d.ts +1 -1
  299. package/node_modules/@litcodex/lit-loop/dist/card-html.js +128 -8
  300. package/node_modules/@litcodex/lit-loop/dist/card-looks.d.ts +19 -0
  301. package/node_modules/@litcodex/lit-loop/dist/card-looks.js +58 -0
  302. package/node_modules/@litcodex/lit-loop/dist/card-status.d.ts +27 -0
  303. package/node_modules/@litcodex/lit-loop/dist/card-status.js +94 -7
  304. package/node_modules/@litcodex/lit-loop/dist/cli.js +13 -3
  305. package/node_modules/@litcodex/lit-loop/dist/codex-hook.d.ts +2 -0
  306. package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +8 -9
  307. package/node_modules/@litcodex/lit-loop/dist/control-chars.d.ts +5 -0
  308. package/node_modules/@litcodex/lit-loop/dist/control-chars.js +23 -0
  309. package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +8 -0
  310. package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +118 -11
  311. package/node_modules/@litcodex/lit-loop/dist/hud.d.ts +1 -1
  312. package/node_modules/@litcodex/lit-loop/dist/hud.js +29 -13
  313. package/node_modules/@litcodex/lit-loop/dist/lane-events.d.ts +13 -0
  314. package/node_modules/@litcodex/lit-loop/dist/lane-events.js +85 -0
  315. package/node_modules/@litcodex/lit-loop/dist/lane-state.d.ts +55 -0
  316. package/node_modules/@litcodex/lit-loop/dist/lane-state.js +227 -0
  317. package/node_modules/@litcodex/lit-loop/dist/live-step.d.ts +5 -1
  318. package/node_modules/@litcodex/lit-loop/dist/live-step.js +17 -1
  319. package/node_modules/@litcodex/lit-loop/dist/markers.d.ts +6 -0
  320. package/node_modules/@litcodex/lit-loop/dist/markers.js +6 -0
  321. package/node_modules/@litcodex/lit-loop/dist/modes.d.ts +1 -1
  322. package/node_modules/@litcodex/lit-loop/dist/modes.js +25 -1
  323. package/node_modules/@litcodex/lit-loop/dist/motion-gate.d.ts +79 -0
  324. package/node_modules/@litcodex/lit-loop/dist/motion-gate.js +310 -0
  325. package/node_modules/@litcodex/lit-loop/dist/motion-route.js +5 -1
  326. package/node_modules/@litcodex/lit-loop/dist/plan-persistence.js +10 -0
  327. package/node_modules/@litcodex/lit-loop/dist/redaction.js +18 -0
  328. package/node_modules/@litcodex/lit-loop/dist/reentry.d.ts +15 -0
  329. package/node_modules/@litcodex/lit-loop/dist/reentry.js +46 -9
  330. package/node_modules/@litcodex/lit-loop/dist/rewind-cli.d.ts +10 -0
  331. package/node_modules/@litcodex/lit-loop/dist/rewind-cli.js +88 -0
  332. package/node_modules/@litcodex/lit-loop/dist/rewind-go.d.ts +20 -0
  333. package/node_modules/@litcodex/lit-loop/dist/rewind-go.js +84 -0
  334. package/node_modules/@litcodex/lit-loop/dist/rewind-look.d.ts +6 -0
  335. package/node_modules/@litcodex/lit-loop/dist/rewind-look.js +41 -0
  336. package/node_modules/@litcodex/lit-loop/dist/rewind-redact.d.ts +3 -0
  337. package/node_modules/@litcodex/lit-loop/dist/rewind-redact.js +40 -0
  338. package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.d.ts +48 -0
  339. package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.js +292 -0
  340. package/node_modules/@litcodex/lit-loop/dist/rewind.d.ts +162 -0
  341. package/node_modules/@litcodex/lit-loop/dist/rewind.js +773 -0
  342. package/node_modules/@litcodex/lit-loop/dist/route-heads.js +44 -2
  343. package/node_modules/@litcodex/lit-loop/dist/run-panel.js +1 -0
  344. package/node_modules/@litcodex/lit-loop/dist/schematic-route.d.ts +6 -0
  345. package/node_modules/@litcodex/lit-loop/dist/schematic-route.js +35 -0
  346. package/node_modules/@litcodex/lit-loop/dist/screen-card.d.ts +3 -0
  347. package/node_modules/@litcodex/lit-loop/dist/screen-card.js +15 -5
  348. package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.js +6 -0
  349. package/node_modules/@litcodex/lit-loop/dist/stack-hook.d.ts +8 -0
  350. package/node_modules/@litcodex/lit-loop/dist/stack-hook.js +57 -0
  351. package/node_modules/@litcodex/lit-loop/dist/statusline.js +8 -3
  352. package/node_modules/@litcodex/lit-loop/dist/threads.d.ts +50 -0
  353. package/node_modules/@litcodex/lit-loop/dist/threads.js +178 -0
  354. package/node_modules/@litcodex/lit-loop/dist/trigger.d.ts +1 -1
  355. package/node_modules/@litcodex/lit-loop/dist/trigger.js +29 -5
  356. package/node_modules/@litcodex/lit-loop/dist/workflow-map.d.ts +10 -0
  357. package/node_modules/@litcodex/lit-loop/dist/workflow-map.js +11 -1
  358. package/node_modules/@litcodex/lit-loop/dist/workflow-stack.d.ts +132 -0
  359. package/node_modules/@litcodex/lit-loop/dist/workflow-stack.js +488 -0
  360. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  361. package/node_modules/@litcodex/lit-loop/skills/lit-adhd/SKILL.md +181 -0
  362. package/node_modules/@litcodex/lit-loop/skills/lit-hijack/SKILL.md +449 -0
  363. package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +13 -4
  364. package/node_modules/@litcodex/lit-loop/skills/lit-plan/SKILL.md +6 -0
  365. package/node_modules/@litcodex/lit-loop/skills/lit-recap/SKILL.md +2 -0
  366. package/node_modules/@litcodex/lit-loop/skills/lit-schematic/SKILL.md +198 -0
  367. package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/SKILL.md +34 -8
  368. package/node_modules/@litcodex/lit-loop/skills/litresearch/SKILL.md +7 -0
  369. package/node_modules/@litcodex/lit-loop/skills/litwork/SKILL.md +2 -1
  370. package/node_modules/@litcodex/lit-loop/skills/review-work/SKILL.md +7 -1
  371. package/node_modules/@litcodex/lit-loop/skills/start-work/SKILL.md +10 -0
  372. package/package.json +2 -2
  373. package/readme-assets/badge-version.svg +1 -1
  374. package/readme-assets/skills/lit-adhd.webp +0 -0
  375. package/readme-assets/skills/lit-hijack.webp +0 -0
  376. package/readme-assets/skills/lit-schematic.webp +0 -0
@@ -96,8 +96,18 @@ export function countPlanRows(markdown) {
96
96
  next: rows.find((row) => !row.done)?.label ?? null,
97
97
  };
98
98
  }
99
+ /** Done and total checkbox rows of a project-relative plan file; null when it cannot be read or holds none. */
100
+ export function planProgress(repoRoot, rel) {
101
+ if (typeof repoRoot !== "string" || !isAbsolute(repoRoot) || rel.includes("..") || isAbsolute(rel))
102
+ return null;
103
+ const text = readText(repoRoot, join(repoRoot, rel));
104
+ if (text === null)
105
+ return null;
106
+ const { done, total } = countPlanRows(text);
107
+ return total > 0 ? { done, total } : null;
108
+ }
99
109
  /** The counted checkbox rows in order, as start-work reads them. */
100
- function planRows(markdown) {
110
+ export function planRows(markdown) {
101
111
  const lines = markdown.split(/\r?\n/);
102
112
  const visible = [];
103
113
  let fence = null;
@@ -0,0 +1,132 @@
1
+ export declare const STACK_DIR = ".litcodex/workflow-stack";
2
+ export declare const MAX_FRAMES = 3;
3
+ export declare const MAX_HISTORY = 20;
4
+ export declare const MAX_STACK_BYTES: number;
5
+ /** A frame nobody touched for this long is dropped on the next event. */
6
+ export declare const STACK_DROP_MS: number;
7
+ /** Disciplines that only read: they neither pause the work under them nor appear as a frame. */
8
+ export declare const READ_ONLY_DISCIPLINES: readonly string[];
9
+ export declare const WORKFLOW_FAMILIES: Readonly<Record<string, readonly string[]>>;
10
+ export type FrameStatus = "active" | "paused";
11
+ export type FrameRole = "spine" | "side";
12
+ export interface StackFrame {
13
+ readonly skill: string | null;
14
+ readonly family: string | null;
15
+ readonly stage: string | null;
16
+ readonly role: FrameRole;
17
+ readonly status: FrameStatus;
18
+ readonly n?: number;
19
+ readonly total?: number;
20
+ readonly unit?: string;
21
+ readonly done?: boolean;
22
+ readonly ref?: {
23
+ readonly plan: string;
24
+ };
25
+ readonly verdicts: Readonly<Record<string, string>>;
26
+ readonly at: string;
27
+ readonly pausedAt?: string;
28
+ }
29
+ export interface StackHistoryEntry {
30
+ readonly event: string;
31
+ readonly skill: string | null;
32
+ readonly at: string;
33
+ }
34
+ export interface WorkflowStack {
35
+ readonly version: 1;
36
+ readonly sessionId: string | null;
37
+ readonly frames: readonly StackFrame[];
38
+ readonly history: readonly StackHistoryEntry[];
39
+ }
40
+ export type StackTransitionType = "started" | "paused" | "resumed" | "side.done" | "finished" | "dropped";
41
+ export interface StackTransition {
42
+ readonly type: StackTransitionType;
43
+ readonly skill: string | null;
44
+ readonly stage: string | null;
45
+ readonly n?: number;
46
+ readonly total?: number;
47
+ }
48
+ interface StageFields {
49
+ readonly family?: string;
50
+ readonly stage?: string;
51
+ readonly n?: number;
52
+ readonly total?: number;
53
+ readonly unit?: string;
54
+ readonly done?: boolean;
55
+ readonly verdicts?: Readonly<Record<string, string>>;
56
+ readonly ref?: {
57
+ readonly plan?: string;
58
+ };
59
+ readonly scope?: string;
60
+ }
61
+ export type StackEvent = {
62
+ readonly type: "start";
63
+ readonly skill: string;
64
+ readonly ref?: {
65
+ readonly plan?: string;
66
+ };
67
+ readonly restart?: boolean;
68
+ } | {
69
+ readonly type: "continue";
70
+ } | ({
71
+ readonly type: "move";
72
+ } & StageFields) | ({
73
+ readonly type: "record";
74
+ } & StageFields);
75
+ export declare function emptyStack(sessionId?: string | null): WorkflowStack;
76
+ /** A known stage of a known family in its stored spelling, or null. */
77
+ export declare function normalizeStage(family: unknown, stage: unknown): string | null;
78
+ /**
79
+ * Apply one event to the stack and return the next stack with the transitions it made (`started`,
80
+ * `paused`, `resumed`, `side.done`, `finished`, `dropped`), which the caller may log.
81
+ * Events: `start {skill, ref?, restart?}`, `continue`, `move {family, stage, n?, total?, unit?, done?,
82
+ * verdicts?, ref?, scope?}` (the hooks' observations) and `record {...same fields}` (the model's
83
+ * `loop stage` call, which updates the top frame or opens one).
84
+ */
85
+ export declare function applyStackEvent(stack: WorkflowStack | null | undefined, event: StackEvent, now?: Date): {
86
+ stack: WorkflowStack;
87
+ transitions: StackTransition[];
88
+ };
89
+ export declare function stackPath(cwd: string, sessionId: string): string | null;
90
+ /** The session's stack; a link, a non-file, an oversized or malformed file reads as empty. */
91
+ export declare function readStack(cwd: string, sessionId: string): WorkflowStack;
92
+ /** Write the whole stack through a temporary file; a link at the destination is replaced, never followed. */
93
+ export declare function writeStack(cwd: string, sessionId: string, stack: WorkflowStack): void;
94
+ /** Read, apply one event and write back; returns the transitions it made. Never throws. */
95
+ export declare function recordStackEvent(cwd: string, sessionId: string, event: StackEvent, now?: Date): {
96
+ stack: WorkflowStack;
97
+ transitions: StackTransition[];
98
+ };
99
+ /** Another session of the project counts as live while its stack was written this recently. */
100
+ export declare const OTHER_SESSION_MS: number;
101
+ export interface OtherStack {
102
+ readonly id: string;
103
+ readonly frames: readonly StackFrame[];
104
+ /** The newest time any of its frames moved. */
105
+ readonly at: number;
106
+ }
107
+ /**
108
+ * The stacks of the project's other sessions that moved within OTHER_SESSION_MS, newest first. It only
109
+ * reads: a link, an oversized or malformed file reads as empty, and an older session is simply dropped.
110
+ */
111
+ export declare function readOtherStacks(cwd: string, selfId: string, now?: number): OtherStack[];
112
+ /** The frame a bare `lit continue` should resume: the nearest spine below a side frame, else null. */
113
+ export declare function pausedSpine(stack: WorkflowStack): StackFrame | null;
114
+ /**
115
+ * `[▉▉▉░░] 3/5` when both counts are real, otherwise null. A count with no total is never drawn as a
116
+ * placeholder gauge: callers say what is known in words (`frameNote`) instead.
117
+ */
118
+ export declare function stackGauge(frame: Pick<StackFrame, "n" | "total">): string | null;
119
+ /** Up to ten cells; a larger total is scaled down so the bar never grows past ten. */
120
+ export declare function gaugeBar(done: number, total: number): string;
121
+ /** What a frame knows when it has no real gauge, in words: `step 2`, or an empty string. */
122
+ export declare function frameNote(frame: Pick<StackFrame, "n" | "total">): string;
123
+ /** One frame as a short label: `lit-loop WORK [▉▉░░░] 2/5`, or `lit-loop WORK step 2` without a total. */
124
+ export declare function frameLabel(frame: StackFrame): string;
125
+ /** `lit-loop ‖ > lit-brainstorm`: paused frames, then the running one after `>`; null for one frame or none. */
126
+ export declare function breadcrumb(stack: WorkflowStack): string | null;
127
+ /**
128
+ * The stack as one card row: paused frames with their stage and gauge, then the running frame after `>`,
129
+ * then the way back. Null while there is a single frame or none, since the map already shows that.
130
+ */
131
+ export declare function stackRow(stack: WorkflowStack): string | null;
132
+ export {};
@@ -0,0 +1,488 @@
1
+ // src/workflow-stack.ts — the session's workflow stack: where each running discipline stands, so asking
2
+ // for something in the middle of a loop or a plan run pauses that work instead of erasing it.
3
+ //
4
+ // The bottom frame is the spine (the main line of work: interview, plan, work, review, or a research
5
+ // run); a discipline started on top of it is a side frame. A successor in the main chain (plan after
6
+ // interview, work after plan, review after work) finishes the frame below it instead of pausing it.
7
+ // Asking for a skill already in the stack resumes its frame with its stage and count; `lit continue`
8
+ // on a side frame closes it and resumes the paused spine at the stage and k/n it left. Read-only
9
+ // disciplines never touch the stack.
10
+ //
11
+ // `applyStackEvent` is pure. The store writes one small file per session under
12
+ // `.litcodex/workflow-stack/`, whole, through a temporary file; every read and write fails open, so a
13
+ // hook never fails because of it. Frames keep skills, stages and counts only: never a prompt, a command
14
+ // or a path other than a project-relative plan name.
15
+ import { closeSync, fstatSync, lstatSync, mkdirSync, readdirSync, readSync } from "node:fs";
16
+ import { isAbsolute, join } from "node:path";
17
+ import { openRegularFile, plainDirs, plainDirsOrMissing, writeFileAtomic } from "./live-step.js";
18
+ import { normalizeSessionId } from "./state-paths.js";
19
+ export const STACK_DIR = ".litcodex/workflow-stack";
20
+ export const MAX_FRAMES = 3;
21
+ export const MAX_HISTORY = 20;
22
+ export const MAX_STACK_BYTES = 64 * 1024;
23
+ /** A frame nobody touched for this long is dropped on the next event. */
24
+ export const STACK_DROP_MS = 24 * 60 * 60 * 1000;
25
+ /** Disciplines that only read: they neither pause the work under them nor appear as a frame. */
26
+ export const READ_ONLY_DISCIPLINES = [
27
+ "lit-recap",
28
+ "lit-comprehend",
29
+ "lit-handoff",
30
+ "lit-adhd",
31
+ "lit-rewind",
32
+ ];
33
+ export const WORKFLOW_FAMILIES = {
34
+ main: ["interview", "plan", "work", "review", "done"],
35
+ research: ["decompose", "wave", "expand", "verify", "synthesis"],
36
+ loop: ["PIN", "RED", "GREEN", "VERIFY", "REVIEW", "RECORD"],
37
+ };
38
+ /** lit-loop writes eight steps; the map shows six, so SURFACE sits on VERIFY and CLEAN on RECORD. */
39
+ const STAGE_ALIASES = { SURFACE: "VERIFY", CLEAN: "RECORD" };
40
+ const STAGE_UNITS = ["task", "criterion", "iteration", "wave", "round"];
41
+ const VERDICT_STATES = ["pass", "fail", "pending", "running"];
42
+ const REVIEW_LANES = ["goal", "quality", "security", "qa", "context"];
43
+ const MAX_VERDICTS = 8;
44
+ /** Where each discipline enters the map. A discipline not listed here is always a side frame. */
45
+ const DISCIPLINE_ENTRY = {
46
+ "deep-interview": { family: "main", stage: "interview" },
47
+ "lit-brainstorm": { family: "main", stage: "interview" },
48
+ "lit-crucible": { family: "main", stage: "plan" },
49
+ "lit-plan": { family: "main", stage: "plan" },
50
+ "start-work": { family: "main", stage: "work" },
51
+ litwork: { family: "main", stage: "work" },
52
+ litgoal: { family: "main", stage: "work" },
53
+ "lit-loop": { family: "main", stage: "work" },
54
+ "review-work": { family: "main", stage: "review" },
55
+ litresearch: { family: "research", stage: "decompose" },
56
+ };
57
+ /** Order in the main chain; a newcomer of a higher rank succeeds the frame below it. */
58
+ const CHAIN_RANK = {
59
+ "deep-interview": 0,
60
+ "lit-brainstorm": 0,
61
+ "lit-crucible": 1,
62
+ "lit-plan": 1,
63
+ "start-work": 2,
64
+ litwork: 2,
65
+ litgoal: 2,
66
+ "lit-loop": 2,
67
+ "review-work": 3,
68
+ };
69
+ const PLAN_REF = /^(?:\.litcodex\/)?plans\/[A-Za-z0-9_-][A-Za-z0-9._-]*\.md$/u;
70
+ export function emptyStack(sessionId) {
71
+ return {
72
+ version: 1,
73
+ sessionId: typeof sessionId === "string" && sessionId ? sessionId : null,
74
+ frames: [],
75
+ history: [],
76
+ };
77
+ }
78
+ function lastIndexWhere(items, test) {
79
+ for (let index = items.length - 1; index >= 0; index -= 1)
80
+ if (test(items[index]))
81
+ return index;
82
+ return -1;
83
+ }
84
+ function countOf(value) {
85
+ return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 9999 ? value : undefined;
86
+ }
87
+ function planRef(ref) {
88
+ return ref && typeof ref.plan === "string" && PLAN_REF.test(ref.plan) && !ref.plan.includes("..")
89
+ ? { plan: ref.plan }
90
+ : undefined;
91
+ }
92
+ /** A known stage of a known family in its stored spelling, or null. */
93
+ export function normalizeStage(family, stage) {
94
+ if (typeof family !== "string" || !Object.hasOwn(WORKFLOW_FAMILIES, family))
95
+ return null;
96
+ const stages = WORKFLOW_FAMILIES[family] ?? [];
97
+ const raw = String(stage ?? "").trim();
98
+ const named = family === "loop" ? (STAGE_ALIASES[raw.toUpperCase()] ?? raw.toUpperCase()) : raw.toLowerCase();
99
+ return stages.includes(named) ? named : null;
100
+ }
101
+ function isSuccessor(skill, frame) {
102
+ const next = CHAIN_RANK[skill];
103
+ const below = frame.skill === null ? undefined : CHAIN_RANK[frame.skill];
104
+ return next !== undefined && below !== undefined && next > below;
105
+ }
106
+ function newFrame(skill, ref, role, at) {
107
+ const entry = DISCIPLINE_ENTRY[skill];
108
+ const frame = {
109
+ skill,
110
+ family: entry?.family ?? null,
111
+ stage: entry?.stage ?? null,
112
+ role,
113
+ status: "active",
114
+ verdicts: {},
115
+ at,
116
+ };
117
+ const plan = planRef(ref);
118
+ if (plan)
119
+ frame.ref = plan;
120
+ return frame;
121
+ }
122
+ /** A saved plan, or a review whose five lanes have all reported: what comes next replaces it. */
123
+ function isFinished(frame) {
124
+ return (frame.done === true ||
125
+ (frame.family === "main" &&
126
+ frame.stage === "review" &&
127
+ REVIEW_LANES.every((id) => ["pass", "fail"].includes(frame.verdicts?.[id] ?? ""))));
128
+ }
129
+ function snapshot(frame) {
130
+ return {
131
+ stage: frame.stage,
132
+ ...(frame.n === undefined ? {} : { n: frame.n }),
133
+ ...(frame.total === undefined ? {} : { total: frame.total }),
134
+ };
135
+ }
136
+ /**
137
+ * Apply one event to the stack and return the next stack with the transitions it made (`started`,
138
+ * `paused`, `resumed`, `side.done`, `finished`, `dropped`), which the caller may log.
139
+ * Events: `start {skill, ref?, restart?}`, `continue`, `move {family, stage, n?, total?, unit?, done?,
140
+ * verdicts?, ref?, scope?}` (the hooks' observations) and `record {...same fields}` (the model's
141
+ * `loop stage` call, which updates the top frame or opens one).
142
+ */
143
+ export function applyStackEvent(stack, event, now = new Date()) {
144
+ const at = now.toISOString();
145
+ const transitions = [];
146
+ const note = (type, frame) => {
147
+ transitions.push({ type, skill: frame.skill, ...snapshot(frame) });
148
+ };
149
+ let frames = (Array.isArray(stack?.frames) ? stack.frames : [])
150
+ .filter((frame) => now.getTime() - Date.parse(frame.at) <= STACK_DROP_MS)
151
+ .map((frame) => ({ ...frame }));
152
+ const pause = (frame) => {
153
+ if (frame.status === "paused")
154
+ return;
155
+ frame.status = "paused";
156
+ frame.pausedAt = at;
157
+ note("paused", frame);
158
+ };
159
+ const activate = (frame) => {
160
+ const wasPaused = frame.status === "paused";
161
+ frame.status = "active";
162
+ frame.at = at;
163
+ delete frame.pausedAt;
164
+ if (wasPaused)
165
+ note("resumed", frame);
166
+ };
167
+ const closeAbove = (index, type) => {
168
+ for (const frame of frames.slice(index + 1).reverse())
169
+ note(type, frame);
170
+ frames = frames.slice(0, index + 1);
171
+ };
172
+ const push = (frame) => {
173
+ frames.push(frame);
174
+ note("started", frame);
175
+ while (frames.length > MAX_FRAMES) {
176
+ const side = frames.findIndex((candidate, index) => index < frames.length - 1 && candidate.role === "side");
177
+ const [dropped] = frames.splice(side === -1 ? 0 : side, 1);
178
+ if (dropped)
179
+ note("dropped", dropped);
180
+ }
181
+ };
182
+ const start = (skill, ref, restart) => {
183
+ if (READ_ONLY_DISCIPLINES.includes(skill))
184
+ return;
185
+ const hasFamily = Object.hasOwn(DISCIPLINE_ENTRY, skill);
186
+ if (restart) {
187
+ closeAbove(-1, "finished");
188
+ push(newFrame(skill, ref, hasFamily ? "spine" : "side", at));
189
+ return;
190
+ }
191
+ const existing = lastIndexWhere(frames, (frame) => frame.skill === skill);
192
+ const found = existing === -1 ? undefined : frames[existing];
193
+ if (found) {
194
+ const wanted = planRef(ref);
195
+ const kept = found.ref?.plan;
196
+ if (!isFinished(found) && (!wanted || !kept || wanted.plan === kept)) {
197
+ closeAbove(existing, "side.done");
198
+ activate(found);
199
+ if (wanted)
200
+ found.ref = wanted;
201
+ return;
202
+ }
203
+ const role = found.role;
204
+ closeAbove(existing - 1, "finished");
205
+ const below = frames.at(-1);
206
+ if (below)
207
+ pause(below);
208
+ push(newFrame(skill, ref, role, at));
209
+ return;
210
+ }
211
+ let inherited = null;
212
+ let handed;
213
+ while (frames.length > 0 && isFinished(frames[frames.length - 1])) {
214
+ const done = frames.pop();
215
+ note("finished", done);
216
+ inherited = done.role;
217
+ handed = handed ?? done.ref;
218
+ }
219
+ // Work that follows a plan in the main chain carries the plan's name on, so its count is the plan's.
220
+ const carried = (from) => ref ?? ((CHAIN_RANK[skill] ?? -1) >= (CHAIN_RANK["start-work"] ?? 99) ? from : undefined);
221
+ const top = frames.at(-1);
222
+ if (!top) {
223
+ push(newFrame(skill, carried(handed), hasFamily ? (inherited ?? "spine") : "side", at));
224
+ }
225
+ else if (!frames.some((frame) => frame.role === "spine")) {
226
+ closeAbove(-1, "finished");
227
+ push(newFrame(skill, ref, hasFamily ? "spine" : "side", at));
228
+ }
229
+ else if (hasFamily && isSuccessor(skill, top)) {
230
+ frames.pop();
231
+ note(top.role === "spine" ? "finished" : "side.done", top);
232
+ push(newFrame(skill, carried(top.ref ?? handed), top.role, at));
233
+ }
234
+ else {
235
+ pause(top);
236
+ push(newFrame(skill, ref, "side", at));
237
+ }
238
+ };
239
+ const update = (frame, fields) => {
240
+ const named = normalizeStage(fields.family, fields.stage);
241
+ if (named === null || typeof fields.family !== "string")
242
+ return;
243
+ const sameStage = frame.family === fields.family && frame.stage === named;
244
+ frame.family = fields.family;
245
+ frame.stage = named;
246
+ const n = countOf(fields.n);
247
+ if (n !== undefined)
248
+ frame.n = n;
249
+ const total = countOf(fields.total);
250
+ if (total !== undefined)
251
+ frame.total = total;
252
+ if (fields.unit !== undefined && STAGE_UNITS.includes(fields.unit))
253
+ frame.unit = fields.unit;
254
+ if (typeof fields.done === "boolean")
255
+ frame.done = fields.done;
256
+ const plan = planRef(fields.ref);
257
+ if (plan)
258
+ frame.ref = plan;
259
+ const given = Object.entries(fields.verdicts ?? {}).filter(([name, state]) => /^[a-z][a-z0-9-]{0,23}$/u.test(name) && VERDICT_STATES.includes(state));
260
+ frame.verdicts = Object.fromEntries([...Object.entries(sameStage ? (frame.verdicts ?? {}) : {}), ...given].slice(-MAX_VERDICTS));
261
+ frame.at = at;
262
+ };
263
+ switch (event.type) {
264
+ case "start":
265
+ start(event.skill, event.ref, event.restart === true);
266
+ break;
267
+ case "continue": {
268
+ const top = frames.at(-1);
269
+ const spine = lastIndexWhere(frames, (frame) => frame.role === "spine");
270
+ const spineFrame = spine === -1 ? undefined : frames[spine];
271
+ if (top?.role === "side" && spineFrame) {
272
+ closeAbove(spine, "side.done");
273
+ activate(spineFrame);
274
+ }
275
+ break;
276
+ }
277
+ case "move": {
278
+ const target = event.scope === "nearest"
279
+ ? frames[lastIndexWhere(frames, (frame) => frame.family === event.family && frame.stage === event.stage)]
280
+ : frames.at(-1);
281
+ if (target && target.family === event.family && (event.scope === "nearest" || target.status === "active"))
282
+ update(target, event);
283
+ break;
284
+ }
285
+ case "record": {
286
+ const top = frames.at(-1);
287
+ if (top)
288
+ update(top, event);
289
+ else if (normalizeStage(event.family, event.stage) !== null) {
290
+ const frame = {
291
+ skill: null,
292
+ family: event.family ?? null,
293
+ stage: null,
294
+ role: "spine",
295
+ status: "active",
296
+ verdicts: {},
297
+ at,
298
+ };
299
+ update(frame, event);
300
+ push(frame);
301
+ }
302
+ break;
303
+ }
304
+ default:
305
+ break;
306
+ }
307
+ const last = frames.at(-1);
308
+ if (last && last.status !== "active")
309
+ activate(last);
310
+ const history = [
311
+ ...(Array.isArray(stack?.history) ? stack.history : []),
312
+ ...transitions.map(({ type, skill }) => ({ event: type, skill, at })),
313
+ ].slice(-MAX_HISTORY);
314
+ return { stack: { version: 1, sessionId: stack?.sessionId ?? null, frames, history }, transitions };
315
+ }
316
+ // ── Store ────────────────────────────────────────────────────────────────────
317
+ export function stackPath(cwd, sessionId) {
318
+ const id = normalizeSessionId(sessionId);
319
+ if (id === null || !isAbsolute(cwd))
320
+ return null;
321
+ return join(cwd, STACK_DIR, `${id}.json`);
322
+ }
323
+ function wellFormedFrame(value) {
324
+ if (typeof value !== "object" || value === null)
325
+ return false;
326
+ const frame = value;
327
+ return ((frame.skill === null || typeof frame.skill === "string") &&
328
+ (frame.role === "spine" || frame.role === "side") &&
329
+ (frame.status === "active" || frame.status === "paused") &&
330
+ typeof frame.at === "string" &&
331
+ Number.isFinite(Date.parse(frame.at)) &&
332
+ typeof frame.verdicts === "object" &&
333
+ frame.verdicts !== null);
334
+ }
335
+ /** The session's stack; a link, a non-file, an oversized or malformed file reads as empty. */
336
+ export function readStack(cwd, sessionId) {
337
+ const empty = emptyStack(sessionId);
338
+ const path = stackPath(cwd, sessionId);
339
+ if (path === null)
340
+ return empty;
341
+ let fd = null;
342
+ try {
343
+ if (!plainDirsOrMissing(cwd, STACK_DIR))
344
+ return empty;
345
+ fd = openRegularFile(path);
346
+ if (fd === null)
347
+ return empty;
348
+ const stat = fstatSync(fd);
349
+ if (!stat.isFile() || stat.size > MAX_STACK_BYTES)
350
+ return empty;
351
+ const buffer = Buffer.alloc(stat.size);
352
+ const read = readSync(fd, buffer, 0, stat.size, 0);
353
+ const parsed = JSON.parse(buffer.subarray(0, read).toString("utf8"));
354
+ const record = parsed;
355
+ if (!record || !Array.isArray(record.frames) || record.frames.length > MAX_FRAMES)
356
+ return empty;
357
+ if (!record.frames.every(wellFormedFrame))
358
+ return empty;
359
+ const history = Array.isArray(record.history) ? record.history.slice(-MAX_HISTORY) : [];
360
+ return { ...empty, frames: record.frames, history };
361
+ }
362
+ catch {
363
+ return empty;
364
+ }
365
+ finally {
366
+ if (fd !== null)
367
+ closeSync(fd);
368
+ }
369
+ }
370
+ /** Write the whole stack through a temporary file; a link at the destination is replaced, never followed. */
371
+ export function writeStack(cwd, sessionId, stack) {
372
+ const path = stackPath(cwd, sessionId);
373
+ if (path === null)
374
+ return;
375
+ try {
376
+ if (!plainDirsOrMissing(cwd, STACK_DIR))
377
+ return;
378
+ mkdirSync(join(cwd, STACK_DIR), { recursive: true });
379
+ const stat = lstatSync(join(cwd, STACK_DIR));
380
+ if (!stat.isDirectory())
381
+ return;
382
+ writeFileAtomic(path, `${JSON.stringify(stack)}\n`);
383
+ }
384
+ catch {
385
+ // The card shows the last good stack; a hook never fails because of it.
386
+ }
387
+ }
388
+ /** Read, apply one event and write back; returns the transitions it made. Never throws. */
389
+ export function recordStackEvent(cwd, sessionId, event, now = new Date()) {
390
+ try {
391
+ const result = applyStackEvent({ ...readStack(cwd, sessionId), sessionId }, event, now);
392
+ writeStack(cwd, sessionId, result.stack);
393
+ return result;
394
+ }
395
+ catch {
396
+ return { stack: emptyStack(sessionId), transitions: [] };
397
+ }
398
+ }
399
+ /** Another session of the project counts as live while its stack was written this recently. */
400
+ export const OTHER_SESSION_MS = 15 * 60 * 1000;
401
+ const MAX_OTHER_SESSIONS = 6;
402
+ const MAX_OTHER_FILES = 24;
403
+ /**
404
+ * The stacks of the project's other sessions that moved within OTHER_SESSION_MS, newest first. It only
405
+ * reads: a link, an oversized or malformed file reads as empty, and an older session is simply dropped.
406
+ */
407
+ export function readOtherStacks(cwd, selfId, now = Date.now()) {
408
+ try {
409
+ const own = normalizeSessionId(selfId);
410
+ if (!isAbsolute(cwd) || !plainDirs(cwd, STACK_DIR))
411
+ return [];
412
+ const found = [];
413
+ const names = readdirSync(join(cwd, STACK_DIR))
414
+ .filter((name) => name.endsWith(".json"))
415
+ .sort()
416
+ .slice(0, MAX_OTHER_FILES);
417
+ for (const name of names) {
418
+ const id = name.slice(0, -".json".length);
419
+ if (normalizeSessionId(id) !== id || id === own)
420
+ continue;
421
+ const frames = readStack(cwd, id).frames;
422
+ const at = Math.max(0, ...frames.map((frame) => Date.parse(frame.at)));
423
+ if (frames.length > 0 && now - at <= OTHER_SESSION_MS)
424
+ found.push({ id, frames, at });
425
+ }
426
+ return found.sort((a, b) => b.at - a.at || a.id.localeCompare(b.id)).slice(0, MAX_OTHER_SESSIONS);
427
+ }
428
+ catch {
429
+ return [];
430
+ }
431
+ }
432
+ // ── Reading a stack back ─────────────────────────────────────────────────────
433
+ /** The frame a bare `lit continue` should resume: the nearest spine below a side frame, else null. */
434
+ export function pausedSpine(stack) {
435
+ const top = stack.frames.at(-1);
436
+ if (!top || top.role !== "side")
437
+ return null;
438
+ const spine = stack.frames[lastIndexWhere(stack.frames, (frame) => frame.role === "spine")];
439
+ return spine && spine.status === "paused" ? spine : null;
440
+ }
441
+ /**
442
+ * `[▉▉▉░░] 3/5` when both counts are real, otherwise null. A count with no total is never drawn as a
443
+ * placeholder gauge: callers say what is known in words (`frameNote`) instead.
444
+ */
445
+ export function stackGauge(frame) {
446
+ const { n, total } = frame;
447
+ if (n === undefined || total === undefined || total <= 0)
448
+ return null;
449
+ return `${gaugeBar(Math.min(n, total), total)} ${n}/${total}`;
450
+ }
451
+ /** Up to ten cells; a larger total is scaled down so the bar never grows past ten. */
452
+ export function gaugeBar(done, total) {
453
+ const cells = Math.min(10, Math.max(1, total));
454
+ const filled = total <= 0 ? 0 : Math.min(cells, Math.round((done / total) * cells));
455
+ return `[${"▉".repeat(filled)}${"░".repeat(cells - filled)}]`;
456
+ }
457
+ /** What a frame knows when it has no real gauge, in words: `step 2`, or an empty string. */
458
+ export function frameNote(frame) {
459
+ return stackGauge(frame) === null && frame.n !== undefined ? `step ${frame.n}` : "";
460
+ }
461
+ /** One frame as a short label: `lit-loop WORK [▉▉░░░] 2/5`, or `lit-loop WORK step 2` without a total. */
462
+ export function frameLabel(frame) {
463
+ const name = frame.skill ?? frame.family ?? "work";
464
+ const stage = frame.stage ? ` ${frame.stage}` : "";
465
+ const counted = stackGauge(frame) ?? frameNote(frame);
466
+ return `${name}${stage}${counted === "" ? "" : ` ${counted}`}`;
467
+ }
468
+ /** `lit-loop ‖ > lit-brainstorm`: paused frames, then the running one after `>`; null for one frame or none. */
469
+ export function breadcrumb(stack) {
470
+ const frames = stack.frames;
471
+ if (frames.length < 2)
472
+ return null;
473
+ const names = frames.map((frame) => frame.skill ?? frame.family ?? "work");
474
+ const head = names.slice(0, -1).join(" ‖ ");
475
+ return `${head} ‖ > ${names.at(-1)}`;
476
+ }
477
+ /**
478
+ * The stack as one card row: paused frames with their stage and gauge, then the running frame after `>`,
479
+ * then the way back. Null while there is a single frame or none, since the map already shows that.
480
+ */
481
+ export function stackRow(stack) {
482
+ if (stack.frames.length < 2)
483
+ return null;
484
+ const labels = stack.frames.map((frame) => frameLabel(frame));
485
+ const running = labels.pop();
486
+ const paused = labels.join(" ‖ ");
487
+ return `⏸ ${paused} ‖ ▶ ${running} · back: lit continue`;
488
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litcodex/lit-loop",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "LitCodex Lit-Loop runtime: durable repo-native multi-goal orchestration with embedded success criteria and observable evidence audit.",
5
5
  "type": "module",
6
6
  "private": true,