@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
@@ -0,0 +1,84 @@
1
+ // src/rewind-go.ts — `go` after a lit-adhd brief runs the one step the brief named.
2
+ //
3
+ // The whole prompt `go`, `lit go`, `ㄱㄱ`, `고` or `진행` is read only when this session has a next-step note
4
+ // (`.litcodex/adhd/next-<session>.json`, written by the brief) and it is at most 30 minutes old. The note is
5
+ // bound to the session by its file name and deleted as soon as it is read, so one brief buys one `go`. The
6
+ // step is checked again against the saved state before it runs, and a boundary waiting for an answer is
7
+ // never started this way. A `go` that fits becomes the ordinary prompt of that step (`lit continue` or
8
+ // `start-work <plan>`), so it goes through the same routes, stack and contracts as if the user had typed it.
9
+ import { rmSync } from "node:fs";
10
+ import { isAbsolute, join } from "node:path";
11
+ import { clean } from "./control-chars.js";
12
+ import { plainDirsOrMissing, readSmallJson } from "./live-step.js";
13
+ import { ADHD_DIR, chooseNext, GO_WINDOW_MS } from "./rewind.js";
14
+ import { normalizeSessionId } from "./state-paths.js";
15
+ const GO_PROMPT = /^\s*(?:(?:lit\s+)?go|ㄱㄱ|고|진행)[\s.!?]*$/iu;
16
+ const MAX_NOTE_BYTES = 8 * 1024;
17
+ /** True for the whole prompt being a go word; `go ahead and fix it` is an ordinary request. */
18
+ export function isGoPrompt(prompt) {
19
+ return GO_PROMPT.test(prompt);
20
+ }
21
+ const KINDS = ["resume-frame", "approve-boundary", "continue-work", "start-plan"];
22
+ function readNote(cwd, sessionId) {
23
+ const id = normalizeSessionId(sessionId);
24
+ if (id === null || !isAbsolute(cwd) || !plainDirsOrMissing(cwd, ADHD_DIR))
25
+ return null;
26
+ const path = join(cwd, ADHD_DIR, `next-${id}.json`);
27
+ const record = readSmallJson(path, MAX_NOTE_BYTES);
28
+ if (record === null)
29
+ return null;
30
+ // Read once: the note is gone before it is judged, whatever the outcome.
31
+ try {
32
+ rmSync(path, { force: true });
33
+ }
34
+ catch {
35
+ // A note that cannot be removed still expires on its own.
36
+ }
37
+ if (typeof record !== "object" || Array.isArray(record))
38
+ return null;
39
+ const fields = record;
40
+ if (fields["sessionId"] !== sessionId && normalizeSessionId(String(fields["sessionId"])) !== id)
41
+ return null;
42
+ const kind = fields["kind"];
43
+ const at = fields["at"];
44
+ if (typeof kind !== "string" || !KINDS.includes(kind) || typeof at !== "number")
45
+ return null;
46
+ return {
47
+ kind: kind,
48
+ at,
49
+ plan: typeof fields["plan"] === "string" ? fields["plan"] : null,
50
+ text: typeof fields["text"] === "string" ? clean(fields["text"]) : "",
51
+ };
52
+ }
53
+ const EXPIRED = "The user said `go`, but the briefed next step is older than 30 minutes, so nothing was started. Tell the user that in one sentence and offer `lit adhd` for a fresh brief; start no other work.";
54
+ const STALE = "The user said `go`, but the briefed next step no longer holds, so nothing was started. Tell the user that in one sentence and offer `lit adhd` for a fresh brief; start no other work.";
55
+ const BOUNDARY = "The user said `go`, but the briefed step is a start-work boundary waiting for an answer. `go` never approves it: tell the user in one sentence to answer `lit approve` or `lit deny` themselves; start nothing.";
56
+ /**
57
+ * What a go-word prompt means in this session. Null when the session has no note (the prompt is then an
58
+ * ordinary one); a hint when a note existed but cannot run; otherwise the prompt to route in its place.
59
+ */
60
+ export function takeGo(cwd, sessionId, now) {
61
+ const note = readNote(cwd, sessionId);
62
+ if (note === null)
63
+ return null;
64
+ if (now - note.at > GO_WINDOW_MS || note.at > now + 60_000)
65
+ return { kind: "hint", text: EXPIRED };
66
+ if (note.kind === "approve-boundary")
67
+ return { kind: "hint", text: BOUNDARY };
68
+ const fresh = chooseNext(cwd, sessionId);
69
+ if (fresh.kind !== note.kind || (note.kind === "start-plan" && fresh.plan !== note.plan)) {
70
+ return { kind: "hint", text: STALE };
71
+ }
72
+ if (note.kind === "start-plan" && fresh.plan !== undefined) {
73
+ return { kind: "run", prompt: `start-work ${fresh.plan.replace(/\.md$/u, "")}`, note: `go: ${fresh.text}` };
74
+ }
75
+ return { kind: "run", prompt: "lit continue", note: `go: ${fresh.text}` };
76
+ }
77
+ const BOUNDARY_ANSWER = /^lit[ \t]+(?:approve|승인|deny|거절)$/u;
78
+ /**
79
+ * True for the whole prompt `lit approve`, `lit deny`, `lit 승인` or `lit 거절`. The start-work lifecycle hook
80
+ * owns these words; this hook stays silent for them so a bare `lit` never starts a loop on top of an answer.
81
+ */
82
+ export function isBoundaryAnswer(prompt) {
83
+ return prompt.length <= 512 && BOUNDARY_ANSWER.test(prompt.trim());
84
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Mark `sessionId` as running lit-adhd. The workspace is the one the session's pointer already names, so a run from a
3
+ * subfolder cannot leave state beside the wrong folder; with no pointer it is the run's own folder. A turn the hook
4
+ * already recorded as lit-adhd is left as it is, so that turn's Stop card still matches. Never throws.
5
+ */
6
+ export declare function markRewindLook(cwd: string, sessionId: string, env: NodeJS.ProcessEnv, now?: number): void;
@@ -0,0 +1,41 @@
1
+ // src/rewind-look.ts — turns the rewind look (rainbow card, tinted HUD line) on for the session that runs the lit-adhd
2
+ // brief. The UserPromptSubmit hook marks a typed `lit adhd`; every other route (a scoped `$litcodex:lit-adhd` mention,
3
+ // Codex loading the skill by itself, a collector run by hand) never reaches that hook, so the collector marks the look
4
+ // when it runs. The mark is the same turn record the hook writes, in the same session folder, so it ends the same way:
5
+ // the session's next LIT activation replaces it.
6
+ import { statSync } from "node:fs";
7
+ import { isAbsolute } from "node:path";
8
+ import { readThreadPointer, recordTurnStart, writeThreadPointer } from "./live-step.js";
9
+ import { recordWorkflowTurn, workflowTurn } from "./workflow-map.js";
10
+ const MODE = "lit-adhd";
11
+ function isFolder(path) {
12
+ try {
13
+ return statSync(path).isDirectory();
14
+ }
15
+ catch {
16
+ return false;
17
+ }
18
+ }
19
+ /**
20
+ * Mark `sessionId` as running lit-adhd. The workspace is the one the session's pointer already names, so a run from a
21
+ * subfolder cannot leave state beside the wrong folder; with no pointer it is the run's own folder. A turn the hook
22
+ * already recorded as lit-adhd is left as it is, so that turn's Stop card still matches. Never throws.
23
+ */
24
+ export function markRewindLook(cwd, sessionId, env, now = Date.now()) {
25
+ try {
26
+ const pointed = readThreadPointer(env, sessionId)?.cwd;
27
+ const root = pointed !== undefined && isFolder(pointed) ? pointed : cwd;
28
+ if (!isAbsolute(root) || !isFolder(root))
29
+ return;
30
+ if (workflowTurn(root, sessionId)?.mode !== MODE) {
31
+ recordWorkflowTurn(root, sessionId, `rewind-${now}`, MODE, now);
32
+ if (workflowTurn(root, sessionId)?.mode !== MODE)
33
+ return;
34
+ recordTurnStart(root, sessionId, now);
35
+ }
36
+ writeThreadPointer(env, sessionId, root, now);
37
+ }
38
+ catch {
39
+ // The brief is what the person asked for; the look only decorates it.
40
+ }
41
+ }
@@ -0,0 +1,3 @@
1
+ export declare const REWIND_MASK = "[redacted]";
2
+ /** A redactor bound to one environment and home, so the environment scan happens once per run. */
3
+ export declare function makeRedactor(env: NodeJS.ProcessEnv, home: string | null): (input: string) => string;
@@ -0,0 +1,40 @@
1
+ // src/rewind-redact.ts — redaction for every string the lit-adhd collector emits.
2
+ //
3
+ // Credential shapes and URI userinfo come from the shared set in redaction.ts; `NAME=value` pairs with a
4
+ // secret-like name lose their value; any substring equal to a current environment value of eight or more
5
+ // characters is replaced (compared here, never printed); the home directory becomes `~`. Path-shaped and
6
+ // locale or terminal values are not credentials and stay, or every path in the brief would be blanked.
7
+ import { REDACTED_SECRET, redactSecrets } from "./redaction.js";
8
+ export const REWIND_MASK = "[redacted]";
9
+ const SECRET_NAME = /KEY|TOKEN|SECRET|PASS|AUTH|COOKIE/iu;
10
+ const ASSIGNMENT = /\b([A-Za-z_][A-Za-z0-9_]*)=("[^"]*"|'[^']*'|[^\s"'`]+)/gu;
11
+ const PLAIN_ENV_NAMES = /^(?:PATH|HOME|PWD|OLDPWD|SHELL|USER|LOGNAME|LANG|LANGUAGE|TERM|TERM_PROGRAM|TERM_PROGRAM_VERSION|COLORTERM|EDITOR|VISUAL|PAGER|TMPDIR|SHLVL|LC_[A-Z]+|XPC_[A-Z_]+|__CF[A-Z_]*|COMMAND_MODE|_)$/u;
12
+ /** Environment values that could be credentials, longest first so a value inside another is not split. */
13
+ function envSecrets(env) {
14
+ return Object.entries(env)
15
+ .filter(([name, value]) => typeof value === "string" &&
16
+ value.length >= 8 &&
17
+ !PLAIN_ENV_NAMES.test(name) &&
18
+ !/^[~/]/u.test(value) &&
19
+ !value.includes(":/") &&
20
+ !/^(?:true|false|\d+)$/iu.test(value))
21
+ .map(([, value]) => value)
22
+ .sort((a, b) => b.length - a.length);
23
+ }
24
+ /** A redactor bound to one environment and home, so the environment scan happens once per run. */
25
+ export function makeRedactor(env, home) {
26
+ const values = envSecrets(env);
27
+ return (input) => {
28
+ if (input === "")
29
+ return input;
30
+ let text = input;
31
+ for (const value of values)
32
+ if (text.includes(value))
33
+ text = text.split(value).join(REWIND_MASK);
34
+ text = text.replace(ASSIGNMENT, (match, name) => SECRET_NAME.test(name) ? `${name}=${REWIND_MASK}` : match);
35
+ text = redactSecrets(text).split(REDACTED_SECRET).join(REWIND_MASK);
36
+ if (home !== null && home.length > 1)
37
+ text = text.split(home).join("~");
38
+ return text;
39
+ };
40
+ }
@@ -0,0 +1,48 @@
1
+ export declare const HEAD_BYTES: number;
2
+ export declare const TAIL_BYTES: number;
3
+ export declare const TOTAL_BYTES: number;
4
+ export interface RolloutFile {
5
+ readonly path: string;
6
+ readonly id: string;
7
+ readonly mtimeMs: number;
8
+ readonly size: number;
9
+ }
10
+ export type LastEvent = "user" | "agent" | "complete" | "tool" | "aborted" | null;
11
+ export interface RolloutFacts {
12
+ readonly id: string;
13
+ readonly cwd: string | null;
14
+ readonly startedAt: number | null;
15
+ readonly lastAt: number | null;
16
+ readonly firstUser: string | null;
17
+ readonly lastUser: string | null;
18
+ readonly lastAgent: string | null;
19
+ readonly last: LastEvent;
20
+ readonly subagent: boolean;
21
+ /** Tool calls seen in the window read; a floor, not a total, when `stepsPartial`. */
22
+ readonly steps: number;
23
+ readonly stepsPartial: boolean;
24
+ /** Name of the last tool the session called, as Codex records it. */
25
+ readonly lastTool: string | null;
26
+ /** What that last call was about, in a word or two: a patched file's base name or the program a shell call ran. */
27
+ readonly lastTarget: string | null;
28
+ /** Tool names with the number of calls seen in the window read, most used first. */
29
+ readonly tools: readonly (readonly [string, number])[];
30
+ /** Base names of the files `apply_patch` touched in the window read, in order, without repeats. */
31
+ readonly edited: readonly string[];
32
+ }
33
+ /** A byte allowance shared by every read of one run. */
34
+ export interface ByteBudget {
35
+ remaining: number;
36
+ exhausted: boolean;
37
+ }
38
+ export declare function newBudget(total?: number): ByteBudget;
39
+ /** Rollout files under `<home>/sessions`, newest first. Symlinks, other file types and deep trees are skipped. */
40
+ export declare function listRollouts(codexHome: string): RolloutFile[];
41
+ /** Facts from the head and tail records of one rollout. */
42
+ export declare function parseRollout(fileId: string, window: {
43
+ head: string;
44
+ tail: string | null;
45
+ headCut: boolean;
46
+ }): RolloutFacts;
47
+ /** Facts for one rollout, or null when it cannot be read (refused type, budget spent, unreadable). */
48
+ export declare function readRollout(file: RolloutFile, budget: ByteBudget): RolloutFacts | null;
@@ -0,0 +1,292 @@
1
+ // src/rewind-rollout.ts — reads Codex session records (rollout JSONL files) for the lit-adhd brief.
2
+ //
3
+ // Only Codex's own records under `<codex home>/sessions` are read, and only a bounded window of each: the
4
+ // head (where the session meta and the first request sit) and the tail (where the latest turn sits), both
5
+ // under one byte budget for the whole run. A symlink, a named pipe or a file that is not a regular file is
6
+ // refused before it is opened; a subagent's records are skipped. The format is private to Codex, so every
7
+ // field is read tolerantly and anything unreadable becomes "unknown" rather than an error.
8
+ import { closeSync, fstatSync, lstatSync, readdirSync, readSync } from "node:fs";
9
+ import { join } from "node:path";
10
+ import { openRegularFile } from "./live-step.js";
11
+ export const HEAD_BYTES = 256 * 1024;
12
+ export const TAIL_BYTES = 256 * 1024;
13
+ export const TOTAL_BYTES = 8 * 1024 * 1024;
14
+ const MAX_FILES = 3000;
15
+ const MAX_DEPTH = 4;
16
+ const ROLLOUT_NAME = /^rollout-.*?([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/u;
17
+ /** User messages Codex itself inserts: they are context, not something the user typed. */
18
+ const INJECTED = /^\s*(?:<environment_context>|<user_instructions>|<INSTRUCTIONS>|# AGENTS\.md|<turn_aborted>|<skill>|<user_shell_command>)/u;
19
+ export function newBudget(total = TOTAL_BYTES) {
20
+ return { remaining: total, exhausted: false };
21
+ }
22
+ /** Rollout files under `<home>/sessions`, newest first. Symlinks, other file types and deep trees are skipped. */
23
+ export function listRollouts(codexHome) {
24
+ const found = [];
25
+ const walk = (dir, depth) => {
26
+ if (depth > MAX_DEPTH || found.length >= MAX_FILES)
27
+ return;
28
+ let names;
29
+ try {
30
+ names = readdirSync(dir);
31
+ }
32
+ catch {
33
+ return;
34
+ }
35
+ for (const name of names) {
36
+ if (found.length >= MAX_FILES)
37
+ return;
38
+ const path = join(dir, name);
39
+ try {
40
+ const stat = lstatSync(path);
41
+ if (stat.isSymbolicLink())
42
+ continue;
43
+ if (stat.isDirectory())
44
+ walk(path, depth + 1);
45
+ else if (stat.isFile()) {
46
+ const match = ROLLOUT_NAME.exec(name);
47
+ if (match?.[1] !== undefined)
48
+ found.push({ path, id: match[1], mtimeMs: stat.mtimeMs, size: stat.size });
49
+ }
50
+ }
51
+ catch {
52
+ // A file that vanished or cannot be inspected is left out.
53
+ }
54
+ }
55
+ };
56
+ walk(join(codexHome, "sessions"), 0);
57
+ return found.sort((a, b) => b.mtimeMs - a.mtimeMs);
58
+ }
59
+ /** Read `length` bytes at `offset` from an open file, charging the budget; null when the budget cannot cover it. */
60
+ function readSlice(fd, offset, length, budget) {
61
+ if (length <= 0)
62
+ return "";
63
+ if (length > budget.remaining) {
64
+ budget.exhausted = true;
65
+ return null;
66
+ }
67
+ const buffer = Buffer.alloc(length);
68
+ let filled = 0;
69
+ while (filled < length) {
70
+ const read = readSync(fd, buffer, filled, length - filled, offset + filled);
71
+ if (read <= 0)
72
+ break;
73
+ filled += read;
74
+ }
75
+ budget.remaining -= filled;
76
+ return buffer.subarray(0, filled).toString("utf8");
77
+ }
78
+ function readWindow(file, budget) {
79
+ const fd = openRegularFile(file.path);
80
+ if (fd === null)
81
+ return null;
82
+ try {
83
+ const stat = fstatSync(fd);
84
+ if (!stat.isFile())
85
+ return null;
86
+ const headLength = Math.min(stat.size, HEAD_BYTES);
87
+ const head = readSlice(fd, 0, headLength, budget);
88
+ if (head === null)
89
+ return null;
90
+ if (stat.size <= HEAD_BYTES)
91
+ return { head, tail: null, headCut: false };
92
+ const tailStart = Math.max(HEAD_BYTES, stat.size - TAIL_BYTES);
93
+ const tail = readSlice(fd, tailStart, stat.size - tailStart, budget);
94
+ return { head, tail: tail ?? "", headCut: true };
95
+ }
96
+ catch {
97
+ return null;
98
+ }
99
+ finally {
100
+ closeSync(fd);
101
+ }
102
+ }
103
+ function isRecord(value) {
104
+ return typeof value === "object" && value !== null && !Array.isArray(value);
105
+ }
106
+ /** Whole JSON lines of a chunk; a line the chunk cut off at either end is dropped. */
107
+ function wholeLines(text, dropFirst, dropLast) {
108
+ const lines = text.split("\n");
109
+ if (dropLast)
110
+ lines.pop();
111
+ if (dropFirst)
112
+ lines.shift();
113
+ const out = [];
114
+ for (const line of lines) {
115
+ if (line.trim() === "")
116
+ continue;
117
+ try {
118
+ const record = JSON.parse(line);
119
+ if (isRecord(record))
120
+ out.push(record);
121
+ }
122
+ catch {
123
+ // A damaged line is skipped.
124
+ }
125
+ }
126
+ return out;
127
+ }
128
+ function textOf(content) {
129
+ if (typeof content === "string")
130
+ return content;
131
+ if (!Array.isArray(content))
132
+ return null;
133
+ const parts = content
134
+ .filter(isRecord)
135
+ .map((item) => (typeof item["text"] === "string" ? item["text"] : ""))
136
+ .filter((part) => part !== "");
137
+ return parts.length === 0 ? null : parts.join("\n");
138
+ }
139
+ const PATCH_FILE = /^\*\*\* (?:Add|Update|Delete) File: (.+)$/gmu;
140
+ const SAFE_PROGRAM = /^[\w.+-]{1,24}$/u;
141
+ /** Base name of a path, or null when it holds anything but plain file-name characters. */
142
+ function baseName(path) {
143
+ const name = path.trim().split(/[\\/]/u).at(-1) ?? "";
144
+ return /^[^\s\u0000-\u001f]{1,60}$/u.test(name) ? name : null;
145
+ }
146
+ /** The text of a call's input: custom tools carry a string, function calls a JSON string of arguments. */
147
+ function callInput(payload) {
148
+ const raw = payload["input"] ?? payload["arguments"];
149
+ return typeof raw === "string" ? raw : "";
150
+ }
151
+ /** The program a shell call starts, never its arguments: `npx` for `["npx","vitest"]` or `cmd: "git status"`. */
152
+ function programOf(payload) {
153
+ let args;
154
+ try {
155
+ args = JSON.parse(callInput(payload));
156
+ }
157
+ catch {
158
+ return null;
159
+ }
160
+ if (!isRecord(args))
161
+ return null;
162
+ let first;
163
+ if (typeof args["cmd"] === "string")
164
+ first = args["cmd"].trim().split(/\s+/u)[0];
165
+ else if (Array.isArray(args["command"])) {
166
+ const parts = args["command"].filter((part) => typeof part === "string");
167
+ const wrapped = /^(?:ba|z)?sh$/u.test(baseName(parts[0] ?? "") ?? "") && /^-l?c$/u.test(parts[1] ?? "");
168
+ first = wrapped ? parts[2]?.trim().split(/\s+/u)[0] : parts[0];
169
+ }
170
+ const name = first === undefined ? null : baseName(first);
171
+ return name !== null && SAFE_PROGRAM.test(name) ? name : null;
172
+ }
173
+ function stamp(value) {
174
+ if (typeof value !== "string")
175
+ return null;
176
+ const time = Date.parse(value);
177
+ return Number.isFinite(time) ? time : null;
178
+ }
179
+ /** Facts from the head and tail records of one rollout. */
180
+ export function parseRollout(fileId, window) {
181
+ const headRecords = wholeLines(window.head, false, window.headCut || window.tail !== null);
182
+ const tailRecords = window.tail === null ? [] : wholeLines(window.tail, true, false);
183
+ let id = fileId;
184
+ let cwd = null;
185
+ let startedAt = null;
186
+ let subagent = false;
187
+ let firstUser = null;
188
+ let lastUser = null;
189
+ let lastAgent = null;
190
+ let last = null;
191
+ let lastAt = null;
192
+ let steps = 0;
193
+ let lastTool = null;
194
+ let lastTarget = null;
195
+ const toolCount = new Map();
196
+ const edited = [];
197
+ const meta = headRecords.find((record) => record["type"] === "session_meta");
198
+ if (meta !== undefined && isRecord(meta["payload"])) {
199
+ const payload = meta["payload"];
200
+ if (typeof payload["id"] === "string" && payload["id"] !== "")
201
+ id = payload["id"];
202
+ if (typeof payload["cwd"] === "string" && payload["cwd"] !== "")
203
+ cwd = payload["cwd"];
204
+ startedAt = stamp(payload["timestamp"]) ?? stamp(meta["timestamp"]);
205
+ subagent = isRecord(payload["source"]) && "subagent" in payload["source"];
206
+ }
207
+ const visit = (record, first) => {
208
+ const payload = isRecord(record["payload"]) ? record["payload"] : null;
209
+ if (payload === null)
210
+ return;
211
+ const at = stamp(record["timestamp"]);
212
+ if (at !== null)
213
+ lastAt = Math.max(lastAt ?? at, at);
214
+ let user = null;
215
+ if (record["type"] === "event_msg") {
216
+ if (payload["type"] === "user_message" && typeof payload["message"] === "string")
217
+ user = payload["message"];
218
+ else if (payload["type"] === "agent_message" && typeof payload["message"] === "string") {
219
+ lastAgent = payload["message"];
220
+ last = "agent";
221
+ }
222
+ else if (payload["type"] === "task_complete") {
223
+ if (typeof payload["last_agent_message"] === "string")
224
+ lastAgent = payload["last_agent_message"];
225
+ last = "complete";
226
+ }
227
+ else if (payload["type"] === "turn_aborted")
228
+ last = "aborted";
229
+ }
230
+ else if (record["type"] === "response_item") {
231
+ if (payload["type"] === "message") {
232
+ const text = textOf(payload["content"]);
233
+ if (payload["role"] === "user" && text !== null && !INJECTED.test(text))
234
+ user = text;
235
+ else if (payload["role"] === "assistant" && text !== null) {
236
+ lastAgent = text;
237
+ last = "agent";
238
+ }
239
+ }
240
+ else if (payload["type"] === "function_call" ||
241
+ payload["type"] === "custom_tool_call" ||
242
+ payload["type"] === "local_shell_call") {
243
+ last = "tool";
244
+ steps += 1;
245
+ const name = payload["type"] === "local_shell_call" ? "shell" : payload["name"];
246
+ if (typeof name === "string" && /^[\w.:-]{1,48}$/u.test(name)) {
247
+ lastTool = name;
248
+ toolCount.set(name, (toolCount.get(name) ?? 0) + 1);
249
+ }
250
+ const patched = [...callInput(payload).replaceAll("\\n", "\n").matchAll(PATCH_FILE)]
251
+ .map((match) => baseName(match[1] ?? ""))
252
+ .filter((file) => file !== null);
253
+ for (const file of patched)
254
+ if (!edited.includes(file))
255
+ edited.push(file);
256
+ lastTarget = patched.at(-1) ?? programOf(payload);
257
+ }
258
+ }
259
+ if (user !== null && !INJECTED.test(user)) {
260
+ if (first && firstUser === null)
261
+ firstUser = user;
262
+ lastUser = user;
263
+ last = "user";
264
+ }
265
+ };
266
+ for (const record of headRecords)
267
+ visit(record, true);
268
+ for (const record of tailRecords)
269
+ visit(record, false);
270
+ return {
271
+ id,
272
+ cwd,
273
+ startedAt,
274
+ lastAt,
275
+ firstUser,
276
+ lastUser,
277
+ lastAgent,
278
+ last,
279
+ subagent,
280
+ steps,
281
+ stepsPartial: window.tail !== null,
282
+ lastTool,
283
+ lastTarget,
284
+ tools: [...toolCount].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])),
285
+ edited,
286
+ };
287
+ }
288
+ /** Facts for one rollout, or null when it cannot be read (refused type, budget spent, unreadable). */
289
+ export function readRollout(file, budget) {
290
+ const window = readWindow(file, budget);
291
+ return window === null ? null : parseRollout(file.id, window);
292
+ }