@litfamily/litcodex 1.0.30 → 1.0.32

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 (394) hide show
  1. package/README-Ko-KR.md +13 -12
  2. package/README.md +13 -12
  3. package/TRADEMARK.md +12 -0
  4. package/dist/install/generated-skill-payload-hashes.d.ts +188 -82
  5. package/dist/install/generated-skill-payload-hashes.js +188 -82
  6. package/dist/install/skill-catalog.d.ts +1 -1
  7. package/dist/install/skill-catalog.js +12 -1
  8. package/dist/install/skill-resource-hashes.d.ts +1 -1
  9. package/dist/install/skill-resource-hashes.js +1 -1
  10. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
  11. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  12. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  13. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  14. package/marketplace/plugins/litcodex/components/lit-loop/directive.md +10 -4
  15. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-adhd.md +194 -0
  16. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-handoff.md +2 -0
  17. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-hijack.md +219 -0
  18. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-plan.md +2 -1
  19. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-recap.md +2 -0
  20. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-schematic.md +199 -0
  21. package/marketplace/plugins/litcodex/components/lit-loop/directives/litwork.md +2 -1
  22. package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.d.ts +10 -0
  23. package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.js +67 -0
  24. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.d.ts +1 -1
  25. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.js +128 -8
  26. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.d.ts +19 -0
  27. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.js +58 -0
  28. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.d.ts +30 -0
  29. package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.js +97 -7
  30. package/marketplace/plugins/litcodex/components/lit-loop/dist/cli.js +13 -3
  31. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.d.ts +2 -0
  32. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.js +8 -9
  33. package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.d.ts +5 -0
  34. package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.js +23 -0
  35. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +8 -0
  36. package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +126 -13
  37. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.d.ts +1 -1
  38. package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.js +29 -13
  39. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.d.ts +13 -0
  40. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.js +85 -0
  41. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.d.ts +55 -0
  42. package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.js +227 -0
  43. package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.d.ts +5 -1
  44. package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.js +17 -1
  45. package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.d.ts +6 -0
  46. package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.js +6 -0
  47. package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.d.ts +1 -1
  48. package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.js +25 -1
  49. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.d.ts +79 -0
  50. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.js +310 -0
  51. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.js +5 -1
  52. package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.d.ts +1 -1
  53. package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.js +38 -2
  54. package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-scope-roots.d.ts +7 -0
  55. package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-scope-roots.js +76 -0
  56. package/marketplace/plugins/litcodex/components/lit-loop/dist/redaction.js +18 -0
  57. package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.d.ts +15 -0
  58. package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.js +46 -9
  59. package/marketplace/plugins/litcodex/components/lit-loop/dist/restart-chip.d.ts +6 -0
  60. package/marketplace/plugins/litcodex/components/lit-loop/dist/restart-chip.js +59 -0
  61. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.d.ts +10 -0
  62. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.js +88 -0
  63. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.d.ts +20 -0
  64. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.js +94 -0
  65. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.d.ts +6 -0
  66. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.js +41 -0
  67. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.d.ts +3 -0
  68. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.js +40 -0
  69. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.d.ts +48 -0
  70. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.js +292 -0
  71. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.d.ts +168 -0
  72. package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.js +867 -0
  73. package/marketplace/plugins/litcodex/components/lit-loop/dist/route-heads.js +45 -3
  74. package/marketplace/plugins/litcodex/components/lit-loop/dist/run-panel.js +1 -0
  75. package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.d.ts +6 -0
  76. package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.js +35 -0
  77. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.d.ts +3 -0
  78. package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.js +15 -5
  79. package/marketplace/plugins/litcodex/components/lit-loop/dist/session-liveness.d.ts +16 -0
  80. package/marketplace/plugins/litcodex/components/lit-loop/dist/session-liveness.js +90 -0
  81. package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-mention-scope.js +6 -0
  82. package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.d.ts +8 -0
  83. package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.js +57 -0
  84. package/marketplace/plugins/litcodex/components/lit-loop/dist/statusline.js +8 -3
  85. package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.d.ts +50 -0
  86. package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.js +183 -0
  87. package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.d.ts +1 -1
  88. package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.js +29 -5
  89. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.d.ts +10 -0
  90. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.js +11 -1
  91. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.d.ts +139 -0
  92. package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.js +518 -0
  93. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  94. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  95. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  96. package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.d.ts +6 -0
  97. package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.js +65 -0
  98. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  99. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  100. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  101. package/marketplace/plugins/litcodex/hooks/hooks.json +24 -0
  102. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +6 -0
  103. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/components.css +414 -0
  104. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/fonts.json +22 -0
  105. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
  106. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
  107. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
  108. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
  109. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
  110. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
  111. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
  112. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
  113. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/ui.js +228 -0
  114. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/brand-and-imagery.md +1 -1
  115. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/complete-contract.md +1 -0
  116. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/craft-floor.md +2 -2
  117. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/default-editorial-pixel.json +15 -8
  118. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/design-choice.md +19 -0
  119. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/house-styles.md +235 -0
  120. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/motion-guide.md +2 -2
  121. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/probe-and-review.md +6 -0
  122. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/production-interview.md +2 -0
  123. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/slop-register.md +4 -4
  124. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
  125. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/lock-probe.mjs +196 -0
  126. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/page-probe.mjs +22 -4
  127. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
  128. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/probe.mjs +59 -13
  129. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/rule-data.mjs +38 -4
  130. package/marketplace/plugins/litcodex/skills/lit-adhd/SKILL.md +185 -0
  131. package/marketplace/plugins/litcodex/skills/lit-adhd/agents/openai.yaml +6 -0
  132. package/marketplace/plugins/litcodex/skills/lit-adhd/references/card-examples.md +163 -0
  133. package/marketplace/plugins/litcodex/skills/lit-adhd/references/status-taxonomy.md +45 -0
  134. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/SKILL.md +18 -7
  135. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/style-guide.md +20 -11
  136. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
  137. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
  138. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-swimlane.md +1 -1
  139. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +1 -1
  140. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree.md +3 -3
  141. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
  142. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/verifier-guide.md +1 -0
  143. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +1 -2
  144. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
  145. package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +12 -3
  146. package/marketplace/plugins/litcodex/skills/lit-docx/references/direction-step.md +6 -3
  147. package/marketplace/plugins/litcodex/skills/lit-hijack/SKILL.md +449 -0
  148. package/marketplace/plugins/litcodex/skills/lit-hijack/agents/openai.yaml +6 -0
  149. package/marketplace/plugins/litcodex/skills/lit-hijack/references/capture-and-provenance.md +100 -0
  150. package/marketplace/plugins/litcodex/skills/lit-hijack/references/clean-room-build.md +111 -0
  151. package/marketplace/plugins/litcodex/skills/lit-hijack/references/distil-and-licence.md +102 -0
  152. package/marketplace/plugins/litcodex/skills/lit-hijack/references/gap-and-port-design.md +125 -0
  153. package/marketplace/plugins/litcodex/skills/lit-hijack/references/parity-and-report.md +108 -0
  154. package/marketplace/plugins/litcodex/skills/lit-hijack/scripts/hijack.mjs +1050 -0
  155. package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +13 -4
  156. package/marketplace/plugins/litcodex/skills/lit-plan/SKILL.md +9 -2
  157. package/marketplace/plugins/litcodex/skills/lit-plan/references/full-workflow.md +2 -1
  158. package/marketplace/plugins/litcodex/skills/lit-pptx/NOTICE +1 -0
  159. package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +35 -8
  160. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
  161. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
  162. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
  163. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/SOURCE.md +21 -0
  164. package/marketplace/plugins/litcodex/skills/lit-pptx/references/anti-slop-checklist.md +5 -2
  165. package/marketplace/plugins/litcodex/skills/lit-pptx/references/authoring-guide.md +3 -4
  166. package/marketplace/plugins/litcodex/skills/lit-pptx/references/density-and-fill.md +20 -6
  167. package/marketplace/plugins/litcodex/skills/lit-pptx/references/direction-step.md +26 -8
  168. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/14-engineering-review-computational-brutalism-ko.md +173 -0
  169. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/15-launch-pitch-neo-brutalism-ko.md +154 -0
  170. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/16-design-lecture-bauhaus-ko.md +139 -0
  171. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/17-community-programme-riso-ko.md +158 -0
  172. package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/18-public-data-briefing-newsroom-ko.md +179 -0
  173. package/marketplace/plugins/litcodex/skills/lit-pptx/references/layout-families.md +42 -27
  174. package/marketplace/plugins/litcodex/skills/lit-pptx/references/title-treatments.md +31 -27
  175. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/bauhaus.md +136 -0
  176. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/chalk.md +1 -1
  177. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/computational-brutalism.md +145 -0
  178. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/neo-brutalism.md +155 -0
  179. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/newsroom.md +141 -0
  180. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/riso.md +133 -0
  181. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/signal.md +1 -1
  182. package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/studio.md +1 -1
  183. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/compile-deck.js +1 -1
  184. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/craft_extras.py +136 -94
  185. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/embed_fonts.py +13 -1
  186. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
  187. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
  188. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-pack.js +386 -579
  189. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
  190. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
  191. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/office-run.mjs +2 -1
  192. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/qa_deck.py +7 -13
  193. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/render_pages.py +124 -0
  194. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
  195. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
  196. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
  197. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +100 -0
  198. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
  199. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
  200. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
  201. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
  202. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
  203. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
  204. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
  205. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
  206. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
  207. package/marketplace/plugins/litcodex/skills/lit-recap/SKILL.md +2 -0
  208. package/marketplace/plugins/litcodex/skills/lit-schematic/SKILL.md +198 -0
  209. package/marketplace/plugins/litcodex/skills/lit-schematic/agents/openai.yaml +6 -0
  210. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
  211. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
  212. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
  213. package/marketplace/plugins/litcodex/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
  214. package/marketplace/plugins/litcodex/skills/lit-schematic/references/cutaway-outputs.md +70 -0
  215. package/marketplace/plugins/litcodex/skills/lit-schematic/references/isometric-craft.md +101 -0
  216. package/marketplace/plugins/litcodex/skills/lit-schematic/references/journal-figures.md +72 -0
  217. package/marketplace/plugins/litcodex/skills/lit-schematic/references/kit-api.md +134 -0
  218. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pfd-and-layout.md +53 -0
  219. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-drafting.md +103 -0
  220. package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-symbols.md +163 -0
  221. package/marketplace/plugins/litcodex/skills/lit-schematic/references/verification.md +100 -0
  222. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/doctor.mjs +57 -0
  223. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
  224. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/fonts.mjs +28 -0
  225. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
  226. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
  227. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
  228. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
  229. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
  230. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
  231. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/png.mjs +132 -0
  232. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
  233. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/route.mjs +218 -0
  234. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
  235. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
  236. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
  237. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/motion.mjs +129 -0
  238. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/qa.mjs +92 -0
  239. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/render.mjs +233 -0
  240. package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/scaffold.mjs +60 -0
  241. package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/SKILL.md +34 -8
  242. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/SKILL.md +18 -14
  243. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +12 -0
  244. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/assets.mjs +388 -0
  245. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender/runner.py +221 -0
  246. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender.mjs +132 -0
  247. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/board.mjs +142 -0
  248. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/constants.mjs +6 -0
  249. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-assets.mjs +7 -4
  250. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-capture.mjs +8 -7
  251. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-init.js +14 -2
  252. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-treatment.mjs +38 -3
  253. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover.mjs +19 -4
  254. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/driver.mjs +8 -8
  255. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/gallery.mjs +147 -0
  256. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/house.mjs +45 -0
  257. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/image.mjs +89 -0
  258. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/look.mjs +58 -25
  259. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/runtime.mjs +59 -14
  260. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/safe-read.mjs +32 -0
  261. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/scaffold.mjs +208 -0
  262. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/score.mjs +668 -0
  263. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/sound.mjs +174 -31
  264. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-gate.mjs +45 -3
  265. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-kit.js +99 -1
  266. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.js +8 -1
  267. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.mjs +180 -11
  268. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-render.mjs +42 -12
  269. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-worker.mjs +7 -4
  270. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage.mjs +96 -10
  271. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/styles.mjs +233 -0
  272. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/treatment.mjs +291 -14
  273. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
  274. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
  275. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
  276. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
  277. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/expected.json +33 -0
  278. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
  279. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/cover.md +44 -7
  280. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/depth.md +156 -0
  281. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/design-choice.md +22 -0
  282. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/quality-gate.md +29 -7
  283. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/runtime.md +1 -1
  284. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/sound.md +87 -0
  285. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/stage.md +19 -7
  286. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/studio.md +246 -0
  287. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/style-bibles.md +2 -2
  288. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/treatment.md +41 -21
  289. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/render.mjs +51 -4
  290. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/paper.json +185 -0
  291. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/swiss-signal.json +188 -0
  292. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/terminalcore.json +182 -0
  293. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/tidal.json +187 -0
  294. package/marketplace/plugins/litcodex/skills/litresearch/SKILL.md +7 -0
  295. package/marketplace/plugins/litcodex/skills/litwork/SKILL.md +2 -1
  296. package/marketplace/plugins/litcodex/skills/readme-studio/SKILL.md +10 -0
  297. package/marketplace/plugins/litcodex/skills/review-work/SKILL.md +7 -1
  298. package/marketplace/plugins/litcodex/skills/start-work/SKILL.md +11 -1
  299. package/node_modules/@litcodex/lit-loop/directive.md +10 -4
  300. package/node_modules/@litcodex/lit-loop/directives/lit-adhd.md +194 -0
  301. package/node_modules/@litcodex/lit-loop/directives/lit-handoff.md +2 -0
  302. package/node_modules/@litcodex/lit-loop/directives/lit-hijack.md +219 -0
  303. package/node_modules/@litcodex/lit-loop/directives/lit-plan.md +2 -1
  304. package/node_modules/@litcodex/lit-loop/directives/lit-recap.md +2 -0
  305. package/node_modules/@litcodex/lit-loop/directives/lit-schematic.md +199 -0
  306. package/node_modules/@litcodex/lit-loop/directives/litwork.md +2 -1
  307. package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.d.ts +10 -0
  308. package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.js +67 -0
  309. package/node_modules/@litcodex/lit-loop/dist/card-html.d.ts +1 -1
  310. package/node_modules/@litcodex/lit-loop/dist/card-html.js +128 -8
  311. package/node_modules/@litcodex/lit-loop/dist/card-looks.d.ts +19 -0
  312. package/node_modules/@litcodex/lit-loop/dist/card-looks.js +58 -0
  313. package/node_modules/@litcodex/lit-loop/dist/card-status.d.ts +30 -0
  314. package/node_modules/@litcodex/lit-loop/dist/card-status.js +97 -7
  315. package/node_modules/@litcodex/lit-loop/dist/cli.js +13 -3
  316. package/node_modules/@litcodex/lit-loop/dist/codex-hook.d.ts +2 -0
  317. package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +8 -9
  318. package/node_modules/@litcodex/lit-loop/dist/control-chars.d.ts +5 -0
  319. package/node_modules/@litcodex/lit-loop/dist/control-chars.js +23 -0
  320. package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +8 -0
  321. package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +126 -13
  322. package/node_modules/@litcodex/lit-loop/dist/hud.d.ts +1 -1
  323. package/node_modules/@litcodex/lit-loop/dist/hud.js +29 -13
  324. package/node_modules/@litcodex/lit-loop/dist/lane-events.d.ts +13 -0
  325. package/node_modules/@litcodex/lit-loop/dist/lane-events.js +85 -0
  326. package/node_modules/@litcodex/lit-loop/dist/lane-state.d.ts +55 -0
  327. package/node_modules/@litcodex/lit-loop/dist/lane-state.js +227 -0
  328. package/node_modules/@litcodex/lit-loop/dist/live-step.d.ts +5 -1
  329. package/node_modules/@litcodex/lit-loop/dist/live-step.js +17 -1
  330. package/node_modules/@litcodex/lit-loop/dist/markers.d.ts +6 -0
  331. package/node_modules/@litcodex/lit-loop/dist/markers.js +6 -0
  332. package/node_modules/@litcodex/lit-loop/dist/modes.d.ts +1 -1
  333. package/node_modules/@litcodex/lit-loop/dist/modes.js +25 -1
  334. package/node_modules/@litcodex/lit-loop/dist/motion-gate.d.ts +79 -0
  335. package/node_modules/@litcodex/lit-loop/dist/motion-gate.js +310 -0
  336. package/node_modules/@litcodex/lit-loop/dist/motion-route.js +5 -1
  337. package/node_modules/@litcodex/lit-loop/dist/plan-persistence.d.ts +1 -1
  338. package/node_modules/@litcodex/lit-loop/dist/plan-persistence.js +38 -2
  339. package/node_modules/@litcodex/lit-loop/dist/plan-scope-roots.d.ts +7 -0
  340. package/node_modules/@litcodex/lit-loop/dist/plan-scope-roots.js +76 -0
  341. package/node_modules/@litcodex/lit-loop/dist/redaction.js +18 -0
  342. package/node_modules/@litcodex/lit-loop/dist/reentry.d.ts +15 -0
  343. package/node_modules/@litcodex/lit-loop/dist/reentry.js +46 -9
  344. package/node_modules/@litcodex/lit-loop/dist/restart-chip.d.ts +6 -0
  345. package/node_modules/@litcodex/lit-loop/dist/restart-chip.js +59 -0
  346. package/node_modules/@litcodex/lit-loop/dist/rewind-cli.d.ts +10 -0
  347. package/node_modules/@litcodex/lit-loop/dist/rewind-cli.js +88 -0
  348. package/node_modules/@litcodex/lit-loop/dist/rewind-go.d.ts +20 -0
  349. package/node_modules/@litcodex/lit-loop/dist/rewind-go.js +94 -0
  350. package/node_modules/@litcodex/lit-loop/dist/rewind-look.d.ts +6 -0
  351. package/node_modules/@litcodex/lit-loop/dist/rewind-look.js +41 -0
  352. package/node_modules/@litcodex/lit-loop/dist/rewind-redact.d.ts +3 -0
  353. package/node_modules/@litcodex/lit-loop/dist/rewind-redact.js +40 -0
  354. package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.d.ts +48 -0
  355. package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.js +292 -0
  356. package/node_modules/@litcodex/lit-loop/dist/rewind.d.ts +168 -0
  357. package/node_modules/@litcodex/lit-loop/dist/rewind.js +867 -0
  358. package/node_modules/@litcodex/lit-loop/dist/route-heads.js +45 -3
  359. package/node_modules/@litcodex/lit-loop/dist/run-panel.js +1 -0
  360. package/node_modules/@litcodex/lit-loop/dist/schematic-route.d.ts +6 -0
  361. package/node_modules/@litcodex/lit-loop/dist/schematic-route.js +35 -0
  362. package/node_modules/@litcodex/lit-loop/dist/screen-card.d.ts +3 -0
  363. package/node_modules/@litcodex/lit-loop/dist/screen-card.js +15 -5
  364. package/node_modules/@litcodex/lit-loop/dist/session-liveness.d.ts +16 -0
  365. package/node_modules/@litcodex/lit-loop/dist/session-liveness.js +90 -0
  366. package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.js +6 -0
  367. package/node_modules/@litcodex/lit-loop/dist/stack-hook.d.ts +8 -0
  368. package/node_modules/@litcodex/lit-loop/dist/stack-hook.js +57 -0
  369. package/node_modules/@litcodex/lit-loop/dist/statusline.js +8 -3
  370. package/node_modules/@litcodex/lit-loop/dist/threads.d.ts +50 -0
  371. package/node_modules/@litcodex/lit-loop/dist/threads.js +183 -0
  372. package/node_modules/@litcodex/lit-loop/dist/trigger.d.ts +1 -1
  373. package/node_modules/@litcodex/lit-loop/dist/trigger.js +29 -5
  374. package/node_modules/@litcodex/lit-loop/dist/workflow-map.d.ts +10 -0
  375. package/node_modules/@litcodex/lit-loop/dist/workflow-map.js +11 -1
  376. package/node_modules/@litcodex/lit-loop/dist/workflow-stack.d.ts +139 -0
  377. package/node_modules/@litcodex/lit-loop/dist/workflow-stack.js +518 -0
  378. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  379. package/node_modules/@litcodex/lit-loop/skills/lit-adhd/SKILL.md +185 -0
  380. package/node_modules/@litcodex/lit-loop/skills/lit-hijack/SKILL.md +449 -0
  381. package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +13 -4
  382. package/node_modules/@litcodex/lit-loop/skills/lit-plan/SKILL.md +9 -2
  383. package/node_modules/@litcodex/lit-loop/skills/lit-recap/SKILL.md +2 -0
  384. package/node_modules/@litcodex/lit-loop/skills/lit-schematic/SKILL.md +198 -0
  385. package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/SKILL.md +34 -8
  386. package/node_modules/@litcodex/lit-loop/skills/litresearch/SKILL.md +7 -0
  387. package/node_modules/@litcodex/lit-loop/skills/litwork/SKILL.md +2 -1
  388. package/node_modules/@litcodex/lit-loop/skills/review-work/SKILL.md +7 -1
  389. package/node_modules/@litcodex/lit-loop/skills/start-work/SKILL.md +11 -1
  390. package/package.json +3 -2
  391. package/readme-assets/badge-version.svg +1 -1
  392. package/readme-assets/skills/lit-adhd.webp +0 -0
  393. package/readme-assets/skills/lit-hijack.webp +0 -0
  394. package/readme-assets/skills/lit-schematic.webp +0 -0
@@ -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
+ }
@@ -0,0 +1,168 @@
1
+ export declare const ADHD_DIR = ".litcodex/adhd";
2
+ /** A session written to in the last quarter hour is still running. */
3
+ export declare const ACTIVE_MS: number;
4
+ /** How long a briefed next step stays runnable by `go`. */
5
+ export declare const GO_WINDOW_MS: number;
6
+ export declare const DEFAULT_SINCE_MS: number;
7
+ export declare const DEFAULT_MAX = 12;
8
+ export type SessionStatus = "waiting-on-user" | "active" | "idle" | "done" | "ended" | "unknown";
9
+ /** `handoff` is shown, never run: a `go` over it starts nothing. */
10
+ export type NextKind = "resume-frame" | "approve-boundary" | "continue-work" | "start-plan" | "handoff" | "none";
11
+ export interface NextStep {
12
+ readonly kind: NextKind;
13
+ readonly text: string;
14
+ readonly skill?: string;
15
+ readonly stage?: string | null;
16
+ readonly n?: number;
17
+ readonly total?: number;
18
+ readonly plan?: string;
19
+ }
20
+ export interface RewindSession {
21
+ readonly id: string;
22
+ readonly shortId: string;
23
+ readonly current: boolean;
24
+ readonly cwd: string | null;
25
+ readonly status: SessionStatus;
26
+ readonly lastAt: number | null;
27
+ /** The worktree folder this session runs in (redacted), so the brief can group by it. */
28
+ readonly tree: string | null;
29
+ /** The session's own stage gauge from its workflow stack; null unless both counts are real. */
30
+ readonly gauge: string | null;
31
+ /** What is known when there is no gauge, in words: `12 steps · 4m · last: apply_patch`. */
32
+ readonly facts: string;
33
+ readonly title: string | null;
34
+ readonly lastUser: string | null;
35
+ readonly lastAgent: string | null;
36
+ /** What the session last reported, in plain words, for the card's "done" line. */
37
+ readonly done: string | null;
38
+ /** What this session needs from the person, in plain words, for the card's "next" line. */
39
+ readonly needs: string;
40
+ /** The tools it used most, most used first (at most three); names only, never counted. */
41
+ readonly tools: readonly string[];
42
+ /** Files `apply_patch` touched in the part of the record that was read (a floor when the record was cut). */
43
+ readonly edited: number;
44
+ /** What its last tool call was about, as `apply_patch “card.ts”`; a program or file base name, never a command line. */
45
+ readonly doing: string | null;
46
+ }
47
+ /** One line of a worktree's timeline: finished (with its date), under way now, or still ahead. */
48
+ export interface RewindMilestone {
49
+ readonly state: "done" | "now" | "later";
50
+ readonly label: string;
51
+ readonly date: string | null;
52
+ }
53
+ export interface RewindWorktree {
54
+ readonly path: string;
55
+ readonly branch: string | null;
56
+ readonly lastCommit: string | null;
57
+ /** The worktree's roadmap gauge: its start-work plan, else its lit-loop goals, else null. */
58
+ readonly gauge: string | null;
59
+ readonly work: {
60
+ readonly status: string;
61
+ readonly done: number;
62
+ readonly total: number;
63
+ readonly gauge: string | null;
64
+ } | null;
65
+ readonly goals: {
66
+ readonly done: number;
67
+ readonly total: number;
68
+ readonly gauge: string | null;
69
+ } | null;
70
+ readonly openPlans: readonly OpenPlan[];
71
+ /** Plans in the window with every row ticked; they count as done. */
72
+ readonly finishedPlans: readonly string[];
73
+ /** Plan files too large to read, counted so the brief can say it left them out. */
74
+ readonly skippedPlans: number;
75
+ /** Recent commits (done, dated), the step under way, and the next open plan rows. */
76
+ readonly milestones: readonly RewindMilestone[];
77
+ readonly paused: readonly {
78
+ readonly session: string;
79
+ readonly label: string;
80
+ }[];
81
+ readonly handoff: string | null;
82
+ }
83
+ export type SourceState = "ok" | "unknown";
84
+ export interface RewindResult {
85
+ readonly generatedAt: string;
86
+ readonly codexHome: string | null;
87
+ readonly sessions: readonly RewindSession[];
88
+ readonly worktrees: readonly RewindWorktree[];
89
+ readonly next: NextStep;
90
+ /**
91
+ * A step to recommend when `next.kind` is `none`, chosen from the records: a session that waits on the user, a
92
+ * paused workflow, an open plan item, the latest active session, the latest ended one. Shown, never recorded.
93
+ */
94
+ readonly suggestion: string;
95
+ /** The window read, so the brief can say how far back it looked. */
96
+ readonly scope: {
97
+ readonly sinceMs: number;
98
+ readonly worktrees: number;
99
+ };
100
+ readonly sources: {
101
+ readonly sessions: SourceState;
102
+ readonly git: SourceState;
103
+ readonly state: SourceState;
104
+ };
105
+ readonly budget: {
106
+ readonly limit: number;
107
+ readonly used: number;
108
+ readonly exhausted: boolean;
109
+ };
110
+ }
111
+ /** Runs git in a folder and returns its stdout, or null when it fails. Injectable for tests. */
112
+ export type GitRunner = (cwd: string, args: readonly string[]) => string | null;
113
+ export declare const runGit: GitRunner;
114
+ export interface RewindOptions {
115
+ readonly env: NodeJS.ProcessEnv;
116
+ readonly cwd: string;
117
+ readonly here?: boolean;
118
+ readonly sinceMs?: number;
119
+ readonly max?: number;
120
+ /** The session asking; its next-step note is written for `go`. */
121
+ readonly sessionId?: string | null;
122
+ readonly now?: number;
123
+ readonly git?: GitRunner;
124
+ /** Overrides the Codex home (a test seam; the command reads `CODEX_HOME` or `~/.codex`). */
125
+ readonly codexHome?: string | null;
126
+ /** Overrides the whole-run read allowance in bytes (a test seam). */
127
+ readonly budgetBytes?: number;
128
+ }
129
+ /** `7d`, `36h`, `90m` as milliseconds; null for anything else. */
130
+ export declare function parseSince(text: string): number | null;
131
+ /** UUIDv7 ids open with a timestamp, so sessions started minutes apart share the first 8 characters; use the random tail then. */
132
+ export declare function shortIdOf(id: string): string;
133
+ export interface OpenPlan {
134
+ readonly name: string;
135
+ readonly done: number;
136
+ readonly total: number;
137
+ readonly gauge: string | null;
138
+ /** When the plan file last changed; null when that cannot be read. */
139
+ readonly changedMs: number | null;
140
+ }
141
+ /** The open plan `name` (a file under `.litcodex/plans`), or null when it is finished, a scaffold or missing. */
142
+ export declare function openPlanNamed(cwd: string, name: string): OpenPlan | null;
143
+ /**
144
+ * The one step worth taking next, in priority order: the paused frame of this session's stack, then a boundary
145
+ * waiting for an answer (shown, never started), then work already under way, then the single open plan.
146
+ */
147
+ export declare function chooseNext(cwd: string, sessionId: string | null): NextStep;
148
+ /** Save the briefed step for `go`, or remove a stale one when there is nothing to run. Never throws. */
149
+ export declare function writeNext(cwd: string, sessionId: string, next: NextStep, now: number): void;
150
+ export declare function collectRewind(options: RewindOptions): RewindResult;
151
+ /**
152
+ * The step to recommend when nothing can run on `go`, so the brief never ends on "nothing". In order: a session
153
+ * that waits on the user, a paused workflow, the open plan item of a worktree where a session is live, any
154
+ * open plan item, the latest other active session, the latest other ended one. It is shown, never recorded.
155
+ */
156
+ export declare function suggestionOf(sessions: readonly RewindSession[], worktrees: readonly RewindWorktree[]): string;
157
+ /** The three-line opener in plain words: done so far, doing now, next. */
158
+ export declare function briefHeadline(result: RewindResult): string;
159
+ /** Ended sessions, one table row each, newest first: they are history, so no card. One line per row at 120 columns. */
160
+ export declare function endedTable(sessions: readonly RewindSession[], now: number, width?: number): string[];
161
+ /**
162
+ * The brief as Markdown limited to what the Codex terminal draws: bold, emoji, lists, a table and a fenced box.
163
+ * Never `#` headings or `>` quotes, which it prints as raw marks. A three-line opener, a card for every session
164
+ * that has not ended, grouped by worktree with each worktree's roadmap (done ✓ with its date, now ▶, later ○), one table
165
+ * row for every ended session, and the one recommended next step in a box. A progress gauge appears only when
166
+ * both counts are real; otherwise the known facts are written out in words.
167
+ */
168
+ export declare function renderBrief(result: RewindResult, width?: number): string;