@litfamily/litcodex 1.0.29 → 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.
- package/README-Ko-KR.md +11 -11
- package/README.md +11 -11
- package/dist/install/generated-skill-payload-hashes.d.ts +191 -85
- package/dist/install/generated-skill-payload-hashes.js +191 -85
- package/dist/install/marketplace.js +10 -1
- package/dist/install/skill-catalog.d.ts +1 -1
- package/dist/install/skill-catalog.js +12 -1
- package/dist/install/skill-resource-hashes.d.ts +1 -1
- package/dist/install/skill-resource-hashes.js +1 -1
- package/marketplace/.agents/plugins/marketplace.json +4 -1
- package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +14 -2
- package/marketplace/plugins/litcodex/assets/screenshot-lit-ignited.png +0 -0
- package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
- package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
- package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/directive.md +10 -4
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-adhd.md +191 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-handoff.md +2 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-hijack.md +219 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-recap.md +2 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-schematic.md +199 -0
- package/marketplace/plugins/litcodex/components/lit-loop/directives/litwork.md +2 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.d.ts +10 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/adhd-suggest.js +67 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-html.js +128 -8
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.d.ts +19 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-looks.js +58 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.d.ts +27 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.js +94 -7
- package/marketplace/plugins/litcodex/components/lit-loop/dist/cli.js +13 -3
- package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.d.ts +2 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.js +8 -9
- package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.d.ts +5 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/control-chars.js +23 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.d.ts +8 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hook-cli.js +118 -11
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/hud.js +29 -13
- package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.d.ts +13 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-events.js +85 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.d.ts +55 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/lane-state.js +227 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.d.ts +5 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/live-step.js +17 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/markers.js +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/modes.js +25 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.d.ts +79 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-gate.js +310 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.js +5 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.js +10 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/redaction.js +18 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.d.ts +15 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/reentry.js +46 -9
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.d.ts +10 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-cli.js +88 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.d.ts +20 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-go.js +84 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-look.js +41 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-redact.js +40 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.d.ts +48 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind-rollout.js +292 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.d.ts +162 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.js +773 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/route-heads.js +44 -2
- package/marketplace/plugins/litcodex/components/lit-loop/dist/run-panel.js +1 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/schematic-route.js +35 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.d.ts +3 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/screen-card.js +15 -5
- package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-mention-scope.js +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.d.ts +8 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/stack-hook.js +57 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/statusline.js +8 -3
- package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.d.ts +50 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/threads.js +178 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.js +31 -6
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.d.ts +10 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-map.js +11 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.d.ts +132 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.js +488 -0
- package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
- package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/README.md +15 -21
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/parse.js +49 -10
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/picomatch.js +14 -2
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/lib/scan.js +30 -18
- package/marketplace/plugins/litcodex/components/rules/node_modules/picomatch/package.json +3 -2
- package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/dist/codex-hook.js +65 -0
- package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
- package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
- package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
- package/marketplace/plugins/litcodex/hooks/hooks.json +24 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +6 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/components.css +414 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/fonts.json +22 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/kit/ui.js +228 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/brand-and-imagery.md +1 -1
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/complete-contract.md +1 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/craft-floor.md +2 -2
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/default-editorial-pixel.json +15 -8
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/design-choice.md +19 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/house-styles.md +235 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/motion-guide.md +2 -2
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/probe-and-review.md +6 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/production-interview.md +2 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/slop-register.md +4 -4
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/lock-probe.mjs +196 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/page-probe.mjs +22 -4
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/probe.mjs +59 -13
- package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/rule-data.mjs +38 -4
- package/marketplace/plugins/litcodex/skills/lit-adhd/SKILL.md +181 -0
- package/marketplace/plugins/litcodex/skills/lit-adhd/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-adhd/references/card-examples.md +147 -0
- package/marketplace/plugins/litcodex/skills/lit-adhd/references/status-taxonomy.md +37 -0
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/SKILL.md +18 -7
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/style-guide.md +20 -11
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-swimlane.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree.md +3 -3
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/verifier-guide.md +1 -0
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +1 -2
- package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
- package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +12 -3
- package/marketplace/plugins/litcodex/skills/lit-docx/references/direction-step.md +6 -3
- package/marketplace/plugins/litcodex/skills/lit-hijack/SKILL.md +449 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/references/capture-and-provenance.md +100 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/references/clean-room-build.md +111 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/references/distil-and-licence.md +102 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/references/gap-and-port-design.md +125 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/references/parity-and-report.md +108 -0
- package/marketplace/plugins/litcodex/skills/lit-hijack/scripts/hijack.mjs +1050 -0
- package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +13 -4
- package/marketplace/plugins/litcodex/skills/lit-plan/SKILL.md +6 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/NOTICE +1 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +35 -8
- package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/jetbrains-mono/SOURCE.md +21 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/anti-slop-checklist.md +5 -2
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/authoring-guide.md +3 -4
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/density-and-fill.md +20 -6
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/direction-step.md +26 -8
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/14-engineering-review-computational-brutalism-ko.md +173 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/15-launch-pitch-neo-brutalism-ko.md +154 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/16-design-lecture-bauhaus-ko.md +139 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/17-community-programme-riso-ko.md +158 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/examples/18-public-data-briefing-newsroom-ko.md +179 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/layout-families.md +42 -27
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/title-treatments.md +31 -27
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/bauhaus.md +136 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/chalk.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/computational-brutalism.md +145 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/neo-brutalism.md +155 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/newsroom.md +141 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/riso.md +133 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/signal.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/references/tonalities/studio.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/compile-deck.js +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/craft_extras.py +136 -94
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/embed_fonts.py +13 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-pack.js +386 -579
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/office-run.mjs +2 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/qa_deck.py +7 -13
- package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/render_pages.py +124 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +100 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
- package/marketplace/plugins/litcodex/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
- package/marketplace/plugins/litcodex/skills/lit-recap/SKILL.md +2 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/SKILL.md +198 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/cutaway-outputs.md +70 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/isometric-craft.md +101 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/journal-figures.md +72 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/kit-api.md +134 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/pfd-and-layout.md +53 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-drafting.md +103 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/pid-symbols.md +163 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/references/verification.md +100 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/doctor.mjs +57 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/fonts.mjs +28 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/png.mjs +132 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/route.mjs +218 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/motion.mjs +129 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/qa.mjs +92 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/render.mjs +233 -0
- package/marketplace/plugins/litcodex/skills/lit-schematic/scripts/scaffold.mjs +60 -0
- package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/SKILL.md +34 -8
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/SKILL.md +18 -14
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +12 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/assets.mjs +388 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender/runner.py +221 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/blender.mjs +132 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/board.mjs +142 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/constants.mjs +6 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-assets.mjs +7 -4
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-capture.mjs +8 -7
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-init.js +14 -2
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover-treatment.mjs +38 -3
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/cover.mjs +19 -4
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/driver.mjs +8 -8
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/gallery.mjs +147 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/house.mjs +45 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/image.mjs +89 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/look.mjs +58 -25
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/runtime.mjs +59 -14
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/safe-read.mjs +32 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/scaffold.mjs +208 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/score.mjs +668 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/sound.mjs +174 -31
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-gate.mjs +45 -3
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-kit.js +99 -1
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.js +8 -1
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.mjs +180 -11
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-render.mjs +42 -12
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-worker.mjs +7 -4
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage.mjs +96 -10
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/styles.mjs +233 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/treatment.mjs +291 -14
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/expected.json +33 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/cover.md +44 -7
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/depth.md +156 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/design-choice.md +22 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/quality-gate.md +29 -7
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/runtime.md +1 -1
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/sound.md +87 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/stage.md +19 -7
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/studio.md +246 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/style-bibles.md +2 -2
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/treatment.md +41 -21
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/requirements-audio.txt +3 -3
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/render.mjs +51 -4
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/paper.json +185 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/swiss-signal.json +188 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/terminalcore.json +182 -0
- package/marketplace/plugins/litcodex/skills/lit-typographic-motion/styles/tidal.json +187 -0
- package/marketplace/plugins/litcodex/skills/litresearch/SKILL.md +7 -0
- package/marketplace/plugins/litcodex/skills/litwork/SKILL.md +2 -1
- package/marketplace/plugins/litcodex/skills/lsp-setup/SKILL.md +2 -1
- package/marketplace/plugins/litcodex/skills/readme-studio/SKILL.md +10 -0
- package/marketplace/plugins/litcodex/skills/readme-studio/templates/hyperframes-cover/package-lock.json +3 -3
- package/marketplace/plugins/litcodex/skills/readme-studio/templates/remotion-cover/package-lock.json +3 -3
- package/marketplace/plugins/litcodex/skills/review-work/SKILL.md +7 -1
- package/marketplace/plugins/litcodex/skills/start-work/SKILL.md +10 -0
- package/node_modules/@litcodex/lit-loop/directive.md +10 -4
- package/node_modules/@litcodex/lit-loop/directives/lit-adhd.md +191 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-handoff.md +2 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-hijack.md +219 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-recap.md +2 -0
- package/node_modules/@litcodex/lit-loop/directives/lit-schematic.md +199 -0
- package/node_modules/@litcodex/lit-loop/directives/litwork.md +2 -1
- package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.d.ts +10 -0
- package/node_modules/@litcodex/lit-loop/dist/adhd-suggest.js +67 -0
- package/node_modules/@litcodex/lit-loop/dist/card-html.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/card-html.js +128 -8
- package/node_modules/@litcodex/lit-loop/dist/card-looks.d.ts +19 -0
- package/node_modules/@litcodex/lit-loop/dist/card-looks.js +58 -0
- package/node_modules/@litcodex/lit-loop/dist/card-status.d.ts +27 -0
- package/node_modules/@litcodex/lit-loop/dist/card-status.js +94 -7
- package/node_modules/@litcodex/lit-loop/dist/cli.js +13 -3
- package/node_modules/@litcodex/lit-loop/dist/codex-hook.d.ts +2 -0
- package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +8 -9
- package/node_modules/@litcodex/lit-loop/dist/control-chars.d.ts +5 -0
- package/node_modules/@litcodex/lit-loop/dist/control-chars.js +23 -0
- package/node_modules/@litcodex/lit-loop/dist/hook-cli.d.ts +8 -0
- package/node_modules/@litcodex/lit-loop/dist/hook-cli.js +118 -11
- package/node_modules/@litcodex/lit-loop/dist/hud.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/hud.js +29 -13
- package/node_modules/@litcodex/lit-loop/dist/lane-events.d.ts +13 -0
- package/node_modules/@litcodex/lit-loop/dist/lane-events.js +85 -0
- package/node_modules/@litcodex/lit-loop/dist/lane-state.d.ts +55 -0
- package/node_modules/@litcodex/lit-loop/dist/lane-state.js +227 -0
- package/node_modules/@litcodex/lit-loop/dist/live-step.d.ts +5 -1
- package/node_modules/@litcodex/lit-loop/dist/live-step.js +17 -1
- package/node_modules/@litcodex/lit-loop/dist/markers.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/markers.js +6 -0
- package/node_modules/@litcodex/lit-loop/dist/modes.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/modes.js +25 -1
- package/node_modules/@litcodex/lit-loop/dist/motion-gate.d.ts +79 -0
- package/node_modules/@litcodex/lit-loop/dist/motion-gate.js +310 -0
- package/node_modules/@litcodex/lit-loop/dist/motion-route.js +5 -1
- package/node_modules/@litcodex/lit-loop/dist/plan-persistence.js +10 -0
- package/node_modules/@litcodex/lit-loop/dist/redaction.js +18 -0
- package/node_modules/@litcodex/lit-loop/dist/reentry.d.ts +15 -0
- package/node_modules/@litcodex/lit-loop/dist/reentry.js +46 -9
- package/node_modules/@litcodex/lit-loop/dist/rewind-cli.d.ts +10 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-cli.js +88 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-go.d.ts +20 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-go.js +84 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-look.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-look.js +41 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-redact.d.ts +3 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-redact.js +40 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.d.ts +48 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind-rollout.js +292 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind.d.ts +162 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind.js +773 -0
- package/node_modules/@litcodex/lit-loop/dist/route-heads.js +44 -2
- package/node_modules/@litcodex/lit-loop/dist/run-panel.js +1 -0
- package/node_modules/@litcodex/lit-loop/dist/schematic-route.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/schematic-route.js +35 -0
- package/node_modules/@litcodex/lit-loop/dist/screen-card.d.ts +3 -0
- package/node_modules/@litcodex/lit-loop/dist/screen-card.js +15 -5
- package/node_modules/@litcodex/lit-loop/dist/skill-mention-scope.js +6 -0
- package/node_modules/@litcodex/lit-loop/dist/stack-hook.d.ts +8 -0
- package/node_modules/@litcodex/lit-loop/dist/stack-hook.js +57 -0
- package/node_modules/@litcodex/lit-loop/dist/statusline.js +8 -3
- package/node_modules/@litcodex/lit-loop/dist/threads.d.ts +50 -0
- package/node_modules/@litcodex/lit-loop/dist/threads.js +178 -0
- package/node_modules/@litcodex/lit-loop/dist/trigger.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/trigger.js +31 -6
- package/node_modules/@litcodex/lit-loop/dist/workflow-map.d.ts +10 -0
- package/node_modules/@litcodex/lit-loop/dist/workflow-map.js +11 -1
- package/node_modules/@litcodex/lit-loop/dist/workflow-stack.d.ts +132 -0
- package/node_modules/@litcodex/lit-loop/dist/workflow-stack.js +488 -0
- package/node_modules/@litcodex/lit-loop/package.json +1 -1
- package/node_modules/@litcodex/lit-loop/skills/lit-adhd/SKILL.md +181 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-hijack/SKILL.md +449 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +13 -4
- package/node_modules/@litcodex/lit-loop/skills/lit-plan/SKILL.md +6 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-recap/SKILL.md +2 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-schematic/SKILL.md +198 -0
- package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/SKILL.md +34 -8
- package/node_modules/@litcodex/lit-loop/skills/litresearch/SKILL.md +7 -0
- package/node_modules/@litcodex/lit-loop/skills/litwork/SKILL.md +2 -1
- package/node_modules/@litcodex/lit-loop/skills/review-work/SKILL.md +7 -1
- package/node_modules/@litcodex/lit-loop/skills/start-work/SKILL.md +10 -0
- package/package.json +2 -2
- package/readme-assets/badge-version.svg +1 -1
- package/readme-assets/skills/lit-adhd.webp +0 -0
- package/readme-assets/skills/lit-hijack.webp +0 -0
- package/readme-assets/skills/lit-schematic.webp +0 -0
|
@@ -9,9 +9,13 @@
|
|
|
9
9
|
// write of the card server, the time a card opened, lives in live-step.ts.
|
|
10
10
|
import { closeSync, fstatSync, readdirSync, readSync } from "node:fs";
|
|
11
11
|
import { basename, isAbsolute, join } from "node:path";
|
|
12
|
+
import { lookOf, REVIEW_LANE_IDS } from "./card-looks.js";
|
|
13
|
+
import { cleanDeep, cleanLines } from "./control-chars.js";
|
|
12
14
|
import { codexHomeFrom, openRegularFile, plainDirs, readLiveStep, readThreadPointer, } from "./live-step.js";
|
|
13
15
|
import { normalizeSessionId } from "./state-paths.js";
|
|
16
|
+
import { readThreads, threadLines } from "./threads.js";
|
|
14
17
|
import { readWorkflowSignals, workflowMapCells, workflowMapText, workflowTurn, } from "./workflow-map.js";
|
|
18
|
+
import { breadcrumb, frameNote, readStack, stackGauge, stackRow } from "./workflow-stack.js";
|
|
15
19
|
/** The rollout header carries the base instructions, so it is read up to this many bytes. */
|
|
16
20
|
const MAX_ROLLOUT_HEADER_BYTES = 256 * 1024;
|
|
17
21
|
/** The newest token count sits near the end of the rollout; only this much of the tail is read. */
|
|
@@ -268,6 +272,7 @@ function ready(thread, workspace, cardOpenedAt, now) {
|
|
|
268
272
|
thread,
|
|
269
273
|
state: "ready",
|
|
270
274
|
mode: null,
|
|
275
|
+
look: null,
|
|
271
276
|
ignitedAt: null,
|
|
272
277
|
map: null,
|
|
273
278
|
step: null,
|
|
@@ -277,12 +282,36 @@ function ready(thread, workspace, cardOpenedAt, now) {
|
|
|
277
282
|
turnEndedAt: null,
|
|
278
283
|
working: false,
|
|
279
284
|
usage: null,
|
|
285
|
+
stack: null,
|
|
286
|
+
threads: null,
|
|
287
|
+
reviewLanes: null,
|
|
280
288
|
branch: null,
|
|
281
289
|
workspace,
|
|
282
290
|
cardOpenedAt,
|
|
283
291
|
now,
|
|
284
292
|
};
|
|
285
293
|
}
|
|
294
|
+
/** The paused frames under the running one, read from the thread's own stack; null when nothing is paused. */
|
|
295
|
+
function readCardStack(cwd, thread) {
|
|
296
|
+
try {
|
|
297
|
+
const stack = readStack(cwd, thread);
|
|
298
|
+
const row = stackRow(stack);
|
|
299
|
+
const crumb = breadcrumb(stack);
|
|
300
|
+
const top = stack.frames.at(-1);
|
|
301
|
+
if (row === null || crumb === null || top === undefined || !stack.frames.some((f) => f.status === "paused"))
|
|
302
|
+
return null;
|
|
303
|
+
const framed = (f) => ({
|
|
304
|
+
name: f.skill ?? f.family ?? "work",
|
|
305
|
+
stage: f.stage,
|
|
306
|
+
gauge: stackGauge(f),
|
|
307
|
+
note: frameNote(f),
|
|
308
|
+
});
|
|
309
|
+
return { breadcrumb: crumb, row, paused: stack.frames.slice(0, -1).map(framed), running: framed(top) };
|
|
310
|
+
}
|
|
311
|
+
catch {
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
286
315
|
/**
|
|
287
316
|
* Whether the model is still on the turn while no tool runs. A record that knows its turn says so
|
|
288
317
|
* directly (open until Stop, unless it has gone quiet for the stale window); an older record without
|
|
@@ -331,11 +360,53 @@ export function readCardStatus(threadId, env, now = Date.now(), options = {}) {
|
|
|
331
360
|
const stage = drawn?.cells.find((cell) => cell.state === "current")?.key;
|
|
332
361
|
const finished = !recorded && turnOver && !open && drawn?.family === "main" && stage !== undefined && FINISHING_STAGES.has(stage);
|
|
333
362
|
const map = finished && drawn !== null ? finishedMap(drawn) : drawn;
|
|
334
|
-
|
|
363
|
+
const state = recorded || finished ? "complete" : "ignited";
|
|
364
|
+
const working = step !== null || turnWorking(live, lastStepAt, now);
|
|
365
|
+
const cardStack = readCardStack(cwd, thread);
|
|
366
|
+
// The look: a completion first, then the session waiting on the user, then the skill's own look.
|
|
367
|
+
// When the mode has no look (a scoped or implicit skill load that the hook never routed), the
|
|
368
|
+
// stack's active top frame can carry it: family "main" + stage "review" → "review".
|
|
369
|
+
// The "turn" look fires only when the last assistant message asked something (question mark,
|
|
370
|
+
// approval phrase) or reported BLOCKED — not on every finished turn.
|
|
371
|
+
let skillLook = lookOf(turn.mode);
|
|
372
|
+
let reviewFrame;
|
|
373
|
+
try {
|
|
374
|
+
const stack = readStack(cwd, thread);
|
|
375
|
+
reviewFrame = stack.frames.find((f) => f.family === "main" && f.stage === "review" && f.status === "active");
|
|
376
|
+
if (skillLook === null && reviewFrame !== undefined) {
|
|
377
|
+
skillLook = "review";
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
catch {
|
|
381
|
+
// The card shows what it can; a missing stack does not break the read.
|
|
382
|
+
}
|
|
383
|
+
const waitReason = live?.waitReason ?? null;
|
|
384
|
+
const waitingOnUser = !working && state === "ignited" && turnOver && waitReason !== null;
|
|
385
|
+
// The done look fires only for an explicit plan/goal completion (recorded signal), not for a
|
|
386
|
+
// routine turn that implicitly finishes at a finishing stage.
|
|
387
|
+
const doneLook = state === "complete" && recorded;
|
|
388
|
+
const look = doneLook ? "done" : waitingOnUser ? "turn" : skillLook;
|
|
389
|
+
// Review lane states from the workflow stack's verdicts.
|
|
390
|
+
let reviewLanes = null;
|
|
391
|
+
if (skillLook === "review" && reviewFrame !== undefined) {
|
|
392
|
+
reviewLanes = REVIEW_LANE_IDS.map((id) => {
|
|
393
|
+
const v = reviewFrame.verdicts[id];
|
|
394
|
+
if (v === "pass")
|
|
395
|
+
return "pass";
|
|
396
|
+
if (v === "fail")
|
|
397
|
+
return "fail";
|
|
398
|
+
if (v === "running")
|
|
399
|
+
return "running";
|
|
400
|
+
return "dim";
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
// Every string here came from a record; none of it may carry a terminal control.
|
|
404
|
+
return cleanDeep({
|
|
335
405
|
version: 1,
|
|
336
406
|
thread,
|
|
337
|
-
state
|
|
407
|
+
state,
|
|
338
408
|
mode: turn.mode,
|
|
409
|
+
look,
|
|
339
410
|
ignitedAt: turn.startedAt,
|
|
340
411
|
map,
|
|
341
412
|
step,
|
|
@@ -343,13 +414,16 @@ export function readCardStatus(threadId, env, now = Date.now(), options = {}) {
|
|
|
343
414
|
lastTool: live?.lastTool ? toolDisplayName(live.lastTool) : null,
|
|
344
415
|
turnStartedAt: live?.turnStartedAt ?? null,
|
|
345
416
|
turnEndedAt: turnOver ? live.turnEndedAt : null,
|
|
346
|
-
working
|
|
417
|
+
working,
|
|
347
418
|
usage: rollout ? readUsage(thread, env) : null,
|
|
419
|
+
stack: cardStack,
|
|
420
|
+
threads: readThreads(cwd, thread, now, signals),
|
|
421
|
+
reviewLanes,
|
|
348
422
|
branch: readBranch(cwd),
|
|
349
423
|
workspace,
|
|
350
424
|
cardOpenedAt,
|
|
351
425
|
now,
|
|
352
|
-
};
|
|
426
|
+
});
|
|
353
427
|
}
|
|
354
428
|
/** Minutes and seconds, `m:ss`. */
|
|
355
429
|
export function clock(ms) {
|
|
@@ -359,14 +433,27 @@ export function clock(ms) {
|
|
|
359
433
|
/** The card as plain text, for hosts that cannot draw it (the terminal `codex`). */
|
|
360
434
|
export function cardStatusText(status) {
|
|
361
435
|
if (status.state === "ready")
|
|
362
|
-
return "🔥 LIT · ready — no LIT skill in this thread yet. Type `lit <task>` to start one.";
|
|
363
|
-
const
|
|
436
|
+
return "🔥 LIT · ready — no LIT skill in this thread yet. Type `lit <task>` to start one, or `lit adhd` after a break.";
|
|
437
|
+
const lookLabel = status.look === "turn"
|
|
438
|
+
? " YOUR TURN"
|
|
439
|
+
: status.look === "rewind"
|
|
440
|
+
? " REWIND <<"
|
|
441
|
+
: status.look === "review"
|
|
442
|
+
? " REVIEW"
|
|
443
|
+
: "";
|
|
444
|
+
const lines = [
|
|
445
|
+
`🔥 LIT ${status.state === "complete" ? "COMPLETE ✓" : "IGNITED"} · ${status.mode ?? "lit"}${lookLabel}`,
|
|
446
|
+
];
|
|
364
447
|
if (status.map !== null) {
|
|
365
448
|
lines.push(workflowMapText(status.map));
|
|
366
449
|
if (status.map.next !== null)
|
|
367
450
|
lines.push(`next ▸ ${status.map.next}`);
|
|
368
451
|
}
|
|
452
|
+
if (status.threads)
|
|
453
|
+
lines.push(...threadLines(status.threads));
|
|
454
|
+
else if (status.stack)
|
|
455
|
+
lines.push(status.stack.row);
|
|
369
456
|
if (status.step !== null)
|
|
370
457
|
lines.push(`⠹ ${status.step.tool} · ${clock(status.now - status.step.startedAt)}`);
|
|
371
|
-
return lines.join("\n");
|
|
458
|
+
return cleanLines(lines.join("\n"));
|
|
372
459
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// src/cli.ts — M06-owned component bin dispatcher (A2 §3/§6.4, A3 addendum A1).
|
|
3
3
|
//
|
|
4
|
-
// Bin `litcodex-lit-loop` → dist/cli.js, the target the aggregate hooks.json invokes. Knows
|
|
5
|
-
//
|
|
4
|
+
// Bin `litcodex-lit-loop` → dist/cli.js, the target the aggregate hooks.json invokes. Knows four route
|
|
5
|
+
// prefixes — `hook`, `loop`, `rewind` and `stage` — and NO `config` route (config migration is
|
|
6
6
|
// owned by the separate litcodex-ai installer bin, not this dispatcher).
|
|
7
7
|
//
|
|
8
8
|
// Exit-code table (A3 addendum A1.2):
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
//
|
|
15
15
|
// `main` NEVER calls process.exit (the shebang wrapper does); it resolves exactly one integer, so
|
|
16
16
|
// the dispatcher is unit-testable with an injected argv array.
|
|
17
|
-
import { runPostCompactHookCli, runPostToolUseLiveHookCli, runPreToolUseCreateGoalGuardCli, runPreToolUseLiveHookCli, runSessionStartHookCli, runStopPlanPersistenceHookCli, runUserPromptSubmitHookCli, } from "./hook-cli.js";
|
|
17
|
+
import { runPostCompactHookCli, runPostToolUseLiveHookCli, runPreToolUseCreateGoalGuardCli, runPreToolUseLiveHookCli, runSessionStartHookCli, runStopPlanPersistenceHookCli, runSubagentHookCli, runUserPromptSubmitHookCli, } from "./hook-cli.js";
|
|
18
18
|
import { loopCommand } from "./loop-cli.js";
|
|
19
|
+
import { rewindCommand, stageCommand } from "./rewind-cli.js";
|
|
19
20
|
const UNKNOWN_COMMAND = "lit-loop: unknown command\n";
|
|
20
21
|
/**
|
|
21
22
|
* Dispatch one argv vector to a route and resolve its exit code. Pure of process.exit; writes only
|
|
@@ -39,6 +40,10 @@ export async function main(argv, stdin, stdout, stderr) {
|
|
|
39
40
|
return runPreToolUseLiveHookCli(stdin, stdout, stderr);
|
|
40
41
|
if (subcommand === "post-tool-use-live")
|
|
41
42
|
return runPostToolUseLiveHookCli(stdin, stdout, stderr);
|
|
43
|
+
if (subcommand === "subagent-start")
|
|
44
|
+
return runSubagentHookCli("start", stdin);
|
|
45
|
+
if (subcommand === "subagent-stop")
|
|
46
|
+
return runSubagentHookCli("stop", stdin);
|
|
42
47
|
stderr.write(UNKNOWN_COMMAND);
|
|
43
48
|
return 1;
|
|
44
49
|
}
|
|
@@ -47,6 +52,11 @@ export async function main(argv, stdin, stdout, stderr) {
|
|
|
47
52
|
// and never calls process.exit. The `doctor` subcommand is still the M09 stub until M11/T16.
|
|
48
53
|
return loopCommand(argv.slice(3), { stdout, stderr, stdin });
|
|
49
54
|
}
|
|
55
|
+
// `rewind` prints the lit-adhd brief data; `stage` records the stage and k/n of the work on top of the stack.
|
|
56
|
+
if (command === "rewind")
|
|
57
|
+
return rewindCommand(argv.slice(3), { stdout, stderr });
|
|
58
|
+
if (command === "stage")
|
|
59
|
+
return stageCommand(argv.slice(3), { stdout, stderr });
|
|
50
60
|
stderr.write(UNKNOWN_COMMAND);
|
|
51
61
|
return 1;
|
|
52
62
|
}
|
|
@@ -21,6 +21,8 @@ export type HookDecision = {
|
|
|
21
21
|
readonly stdout: string;
|
|
22
22
|
readonly mode: LitMode;
|
|
23
23
|
readonly entry?: "continue";
|
|
24
|
+
/** True when the film context was added, so the completion gate (motion-gate.ts) arms the turn. */
|
|
25
|
+
readonly film?: true;
|
|
24
26
|
} | {
|
|
25
27
|
readonly kind: "noop";
|
|
26
28
|
};
|
|
@@ -27,6 +27,7 @@ import { BROWSER_DRIVE_MODE_SPEC, HANDOFF_MODE_SPEC, modeForToken, resolveSkillP
|
|
|
27
27
|
import { motionRouteContext } from "./motion-route.js";
|
|
28
28
|
import { continueContext, enterRoute, entryNotes, NO_REENTRY } from "./reentry.js";
|
|
29
29
|
import { loadRouteContext, loadSkillInvocationContext } from "./route-context.js";
|
|
30
|
+
import { classifySchematicRequest } from "./schematic-route.js";
|
|
30
31
|
import { isExactBareScientificVisualizationPrompt, isScientificVisualizationWhitespaceNearMiss, shouldSuppressScientificVisualizationInjection, } from "./scientific-visualization-route.js";
|
|
31
32
|
import { matchRenamedSkillInvocation, skillRenameNote } from "./skill-renames.js";
|
|
32
33
|
import { maskMarkdownCode, matchLitTrigger } from "./trigger.js";
|
|
@@ -220,7 +221,8 @@ export function runUserPromptSubmitHook(input, reentry = () => NO_REENTRY) {
|
|
|
220
221
|
if (match === null) {
|
|
221
222
|
return { kind: "noop" };
|
|
222
223
|
}
|
|
223
|
-
|
|
224
|
+
// A bare `lit` that asks for a drawing of real equipment takes the schematic route, not the generic lit-loop one.
|
|
225
|
+
const mode = modeForToken(match.token === "lit" && classifySchematicRequest(input.prompt) ? "lit-schematic" : match.token);
|
|
224
226
|
// Whether this session already holds the contract comes from the session's saved state (reentry.ts), not the transcript.
|
|
225
227
|
const decision = shouldSuppressInjection(input.prompt, transcriptPath, mode.openMarker, { transcriptDedupe: false });
|
|
226
228
|
if (decision.suppress) {
|
|
@@ -230,20 +232,17 @@ export function runUserPromptSubmitHook(input, reentry = () => NO_REENTRY) {
|
|
|
230
232
|
const keeps = entry.kind === "continue" || (entry.kind === "resume" && entry.active);
|
|
231
233
|
const route = entry.kind === "first" ? mode.mode : entry.route;
|
|
232
234
|
const context = keeps ? continueContext(route, entry) : loadDirectiveForModeFailSilent(mode);
|
|
235
|
+
const film = mode.skillName === "lit-loop" ? motionRouteContext(mode.skillPath, input.prompt) : "";
|
|
233
236
|
const stdout = context === ""
|
|
234
237
|
? ""
|
|
235
|
-
: formatAdditionalContextOutput([
|
|
236
|
-
context,
|
|
237
|
-
...(keeps ? [] : entryNotes(entry)),
|
|
238
|
-
mode.skillName === "lit-loop" ? motionRouteContext(mode.skillPath, input.prompt) : "",
|
|
239
|
-
skillRenameNote(match.raw),
|
|
240
|
-
]
|
|
238
|
+
: formatAdditionalContextOutput([context, ...(keeps ? [] : entryNotes(entry)), film, skillRenameNote(match.raw)]
|
|
241
239
|
.filter(Boolean)
|
|
242
240
|
.join("\n"), route);
|
|
243
241
|
if (stdout === "") {
|
|
244
242
|
return { kind: "noop" };
|
|
245
243
|
}
|
|
244
|
+
const filmMark = film === "" ? {} : { film: true };
|
|
246
245
|
return keeps
|
|
247
|
-
? { kind: "inject", stdout, mode: route, entry: "continue" }
|
|
248
|
-
: { kind: "inject", stdout, mode: mode.mode };
|
|
246
|
+
? { kind: "inject", stdout, mode: route, entry: "continue", ...filmMark }
|
|
247
|
+
: { kind: "inject", stdout, mode: mode.mode, ...filmMark };
|
|
249
248
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function clean(text: string): string;
|
|
2
|
+
/** Every string inside a plain value, cleaned; numbers, booleans and null pass through. */
|
|
3
|
+
export declare function cleanDeep<T>(value: T): T;
|
|
4
|
+
/** A multi-line text with each line cleaned; the line breaks stay. */
|
|
5
|
+
export declare function cleanLines(text: string): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/control-chars.ts — record text is data. Strings that came from a repository, a rollout or a state file
|
|
2
|
+
// are stripped of C0/C1 controls (ESC, CSI, OSC and BEL among them) and of zero-width and bidi format
|
|
3
|
+
// characters before the brief, the text HUD or the card text prints them. A leaf module, so the card, the
|
|
4
|
+
// HUD and the collector can all use it.
|
|
5
|
+
const CONTROL = /[\u0000-\u001f\u007f-\u009f---]/gu;
|
|
6
|
+
export function clean(text) {
|
|
7
|
+
return text.replace(CONTROL, "");
|
|
8
|
+
}
|
|
9
|
+
/** Every string inside a plain value, cleaned; numbers, booleans and null pass through. */
|
|
10
|
+
export function cleanDeep(value) {
|
|
11
|
+
if (typeof value === "string")
|
|
12
|
+
return clean(value);
|
|
13
|
+
if (Array.isArray(value))
|
|
14
|
+
return value.map((item) => cleanDeep(item));
|
|
15
|
+
if (value !== null && typeof value === "object") {
|
|
16
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, cleanDeep(item)]));
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
/** A multi-line text with each line cleaned; the line breaks stay. */
|
|
21
|
+
export function cleanLines(text) {
|
|
22
|
+
return text.split("\n").map(clean).join("\n");
|
|
23
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type MotionEvaluator } from "./motion-gate.js";
|
|
1
2
|
/** Hard cap on stdin to bound memory / ReDoS exposure inside the 5 s Codex hook budget. 8 MB. */
|
|
2
3
|
export declare const MAX_STDIN_BYTES = 8000000;
|
|
3
4
|
/** Machine-readable error envelope emitted to stderr on a NON-zero exit. */
|
|
@@ -19,6 +20,8 @@ export declare function runUserPromptSubmitHookCli(stdin: NodeJS.ReadableStream,
|
|
|
19
20
|
export interface AutoHandoffHookOptions {
|
|
20
21
|
readonly env?: NodeJS.ProcessEnv;
|
|
21
22
|
readonly now?: number;
|
|
23
|
+
/** Replaces the installed film skill's done-check in the Stop gate; tests only. */
|
|
24
|
+
readonly evaluateMotion?: MotionEvaluator;
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
27
|
* Asks the model to open the LIT card for this LIT turn, so the live card sits next to the newest turn
|
|
@@ -46,3 +49,8 @@ export interface LiveStepHookOptions {
|
|
|
46
49
|
export declare function runPreToolUseLiveHookCli(stdin: NodeJS.ReadableStream, _stdout: NodeJS.WritableStream, _stderr: NodeJS.WritableStream, options?: LiveStepHookOptions): Promise<number>;
|
|
47
50
|
/** Catch-all PostToolUse: clear the live step this call set. Prints nothing; exits 0 on every input. */
|
|
48
51
|
export declare function runPostToolUseLiveHookCli(stdin: NodeJS.ReadableStream, _stdout: NodeJS.WritableStream, _stderr: NodeJS.WritableStream, options?: LiveStepHookOptions): Promise<number>;
|
|
52
|
+
/**
|
|
53
|
+
* SubagentStart and SubagentStop: a child agent began or ended, so its lane row appears or leaves. Prints
|
|
54
|
+
* nothing and exits 0 on every input, including one whose payload shape is not the one probed.
|
|
55
|
+
*/
|
|
56
|
+
export declare function runSubagentHookCli(kind: "start" | "stop", stdin: NodeJS.ReadableStream, options?: LiveStepHookOptions): Promise<number>;
|
|
@@ -8,14 +8,20 @@
|
|
|
8
8
|
// and NEVER throws.
|
|
9
9
|
import { isAbsolute } from "node:path";
|
|
10
10
|
import { Writable } from "node:stream";
|
|
11
|
+
import { adhdSuggestion } from "./adhd-suggest.js";
|
|
11
12
|
import { claimReloadContext, evaluateAutoHandoffStop, recordCompaction, takeReloadContext } from "./auto-handoff.js";
|
|
12
13
|
import { applyAutoHandoffRoute, clearManagedCompactionWhenOff, parseAutoHandoffRoute, } from "./auto-handoff-settings.js";
|
|
13
14
|
import { applyPreToolUseCreateGoalGuard, isLitUserPromptSubmitInput, runUserPromptSubmitHook } from "./codex-hook.js";
|
|
14
|
-
import {
|
|
15
|
+
import { laneScope, subagentEvent, toolLaneEvents } from "./lane-events.js";
|
|
16
|
+
import { recordLaneEvent } from "./lane-state.js";
|
|
17
|
+
import { detectWaitReason, endLiveStep, recordLiveStepEnd, recordLiveStepStart, recordTurnStart, writeThreadPointer, } from "./live-step.js";
|
|
18
|
+
import { armMotionTurn, disarmMotionTurn, evaluateMotionStop, recordMotionTool, } from "./motion-gate.js";
|
|
15
19
|
import { evaluatePlanPersistence, formatStopBlockOutput, rearmLitPlanIfSatisfied, recordLitPlanActivation, } from "./plan-persistence.js";
|
|
16
|
-
import { clearActiveRoute, isBareLit, readActiveRoute, readResumeWork, recordActiveRoute } from "./reentry.js";
|
|
20
|
+
import { clearActiveRoute, isBareLit, isLitContinue, readActiveRoute, readResumeWork, recordActiveRoute, } from "./reentry.js";
|
|
21
|
+
import { isBoundaryAnswer, isGoPrompt, takeGo } from "./rewind-go.js";
|
|
17
22
|
import { workflowCard } from "./screen-card.js";
|
|
18
23
|
import { screenColor } from "./screen-status.js";
|
|
24
|
+
import { applyPromptToStack, frameToResume } from "./stack-hook.js";
|
|
19
25
|
import { recordWorkflowTurn, workflowStopLine, workflowTurn } from "./workflow-map.js";
|
|
20
26
|
/** Hard cap on stdin to bound memory / ReDoS exposure inside the 5 s Codex hook budget. 8 MB. */
|
|
21
27
|
export const MAX_STDIN_BYTES = 8_000_000;
|
|
@@ -102,13 +108,61 @@ export async function runUserPromptSubmitHookCli(stdin, stdout, stderr, repoRoot
|
|
|
102
108
|
return 0;
|
|
103
109
|
}
|
|
104
110
|
clearManagedCompactionWhenOff(hookCwd(parsed, repoRoot), auto.env ?? process.env);
|
|
111
|
+
// `lit approve` / `lit deny` answer a start-work boundary; the lifecycle hook owns them, so this one stays out.
|
|
112
|
+
if (isLitUserPromptSubmitInput(parsed) && isBoundaryAnswer(parsed.prompt))
|
|
113
|
+
return 0;
|
|
114
|
+
// `go` after a lit-adhd brief runs the one step the brief named, as if the user had typed that step.
|
|
115
|
+
let goNote = null;
|
|
116
|
+
if (isLitUserPromptSubmitInput(parsed) && isGoPrompt(parsed.prompt)) {
|
|
117
|
+
const scope = hookSessionScope(parsed, repoRoot);
|
|
118
|
+
const go = scope === null ? null : takeGo(scope.cwd, scope.sessionId, auto.now ?? Date.now());
|
|
119
|
+
if (go?.kind === "hint") {
|
|
120
|
+
stdout.write(withReloadContext("", go.text) ?? "");
|
|
121
|
+
return 0;
|
|
122
|
+
}
|
|
123
|
+
if (go?.kind === "run") {
|
|
124
|
+
parsed = { ...parsed, prompt: go.prompt };
|
|
125
|
+
goNote = go.note;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
105
128
|
const pointer = hookSessionScope(parsed, repoRoot);
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
129
|
+
const savedRoute = pointer === null ? null : readActiveRoute(pointer.cwd, pointer.sessionId);
|
|
130
|
+
// An active lit-plan owns the persistence gate, so `lit continue` stays inside it rather than leaving it armed.
|
|
131
|
+
const litContinue = pointer !== null &&
|
|
132
|
+
savedRoute !== "lit-plan" &&
|
|
133
|
+
isLitUserPromptSubmitInput(parsed) &&
|
|
134
|
+
isLitContinue(parsed.prompt);
|
|
135
|
+
// `lit continue` over a side discipline returns to the paused spine, at the stage and count it left.
|
|
136
|
+
const spine = litContinue ? frameToResume(pointer.cwd, pointer.sessionId) : null;
|
|
137
|
+
const decision = runUserPromptSubmitHook(parsed, () => {
|
|
138
|
+
const saved = savedRoute;
|
|
139
|
+
return {
|
|
140
|
+
active: spine !== null && saved !== null ? spine.skill : saved,
|
|
141
|
+
resume: pointer === null ? null : readResumeWork(pointer.cwd, pointer.sessionId),
|
|
142
|
+
frame: spine === null
|
|
143
|
+
? null
|
|
144
|
+
: {
|
|
145
|
+
skill: spine.skill ?? "work",
|
|
146
|
+
stage: spine.stage,
|
|
147
|
+
...(spine.n === undefined ? {} : { n: spine.n }),
|
|
148
|
+
...(spine.total === undefined ? {} : { total: spine.total }),
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
// A film prompt arms the completion gate for this session; any other prompt disarms it.
|
|
153
|
+
if (pointer !== null && isLitUserPromptSubmitInput(parsed)) {
|
|
154
|
+
if (decision.kind === "inject" && decision.film === true)
|
|
155
|
+
armMotionTurn(pointer.cwd, pointer.sessionId, auto.now);
|
|
156
|
+
else
|
|
157
|
+
disarmMotionTurn(pointer.cwd, pointer.sessionId);
|
|
158
|
+
}
|
|
159
|
+
// A read-only brief never takes the saved route: the work under it keeps its contract and its place.
|
|
160
|
+
if (pointer !== null && decision.kind === "inject" && decision.mode !== "lit-adhd") {
|
|
161
|
+
recordActiveRoute(pointer.cwd, pointer.sessionId, spine?.skill ?? decision.mode);
|
|
162
|
+
}
|
|
163
|
+
if (pointer !== null && isLitUserPromptSubmitInput(parsed) && (litContinue || decision.kind === "inject")) {
|
|
164
|
+
applyPromptToStack(pointer.cwd, pointer.sessionId, parsed.prompt, { continued: litContinue, mode: decision.kind === "inject" ? decision.mode : null }, auto.now === undefined ? undefined : new Date(auto.now));
|
|
165
|
+
}
|
|
112
166
|
// Only a LIT thread gets a pointer: this prompt ignites LIT, or an earlier one already did.
|
|
113
167
|
if (pointer !== null && (decision.kind === "inject" || workflowTurn(pointer.cwd, pointer.sessionId) !== null)) {
|
|
114
168
|
writeThreadPointer(auto.env ?? process.env, pointer.sessionId, pointer.cwd, auto.now);
|
|
@@ -129,7 +183,8 @@ export async function runUserPromptSubmitHookCli(stdin, stdout, stderr, repoRoot
|
|
|
129
183
|
const own = decision.kind === "inject"
|
|
130
184
|
? withCardOffer(withWorkflowMap(decision.stdout, parsed, decision.mode, env), pointer, auto, decision.entry === "continue")
|
|
131
185
|
: "";
|
|
132
|
-
const
|
|
186
|
+
const noted = goNote === null || own === "" ? own : (withReloadContext(own, goNote) ?? own);
|
|
187
|
+
const output = withAutoHandoffReload(noted, parsed, repoRoot, auto);
|
|
133
188
|
if (output !== "")
|
|
134
189
|
stdout.write(output);
|
|
135
190
|
return 0;
|
|
@@ -328,7 +383,18 @@ export async function runStopPlanPersistenceHookCli(stdin, stdout, stderr, repoR
|
|
|
328
383
|
// A subagent's Stop carries the parent's session id; the parent's turn is still running.
|
|
329
384
|
if (isSubagent(parsed))
|
|
330
385
|
return 0;
|
|
331
|
-
|
|
386
|
+
const motion = await evaluateMotionStop({
|
|
387
|
+
cwd: scope.cwd,
|
|
388
|
+
sessionId: scope.sessionId,
|
|
389
|
+
...(auto.now === undefined ? {} : { now: auto.now }),
|
|
390
|
+
...(auto.evaluateMotion === undefined ? {} : { evaluate: auto.evaluateMotion }),
|
|
391
|
+
});
|
|
392
|
+
if (motion.action === "block") {
|
|
393
|
+
stdout.write(formatStopBlockOutput(motion.reason));
|
|
394
|
+
return 0;
|
|
395
|
+
}
|
|
396
|
+
const lastMsg = typeof record["last_assistant_message"] === "string" ? record["last_assistant_message"] : null;
|
|
397
|
+
endLiveStep(scope.cwd, scope.sessionId, auto.now, true, detectWaitReason(lastMsg));
|
|
332
398
|
const env = auto.env ?? process.env;
|
|
333
399
|
const line = typeof record["turn_id"] === "string"
|
|
334
400
|
? workflowStopLine(scope.cwd, scope.sessionId, record["turn_id"], {
|
|
@@ -371,6 +437,16 @@ export async function runSessionStartHookCli(stdin, stdout, stderr, repoRoot = p
|
|
|
371
437
|
return event.exit;
|
|
372
438
|
clearManagedCompactionWhenOff(hookCwd(event.parsed, repoRoot), auto.env ?? process.env);
|
|
373
439
|
const record = event.parsed;
|
|
440
|
+
if (typeof record === "object" &&
|
|
441
|
+
record !== null &&
|
|
442
|
+
(record["source"] === "startup" || record["source"] === "resume")) {
|
|
443
|
+
const opened = hookSessionScope(record, repoRoot);
|
|
444
|
+
const offer = opened === null ? null : adhdSuggestion(opened.cwd, opened.sessionId);
|
|
445
|
+
if (offer !== null) {
|
|
446
|
+
stdout.write(`${JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: offer } })}\n`);
|
|
447
|
+
}
|
|
448
|
+
return 0;
|
|
449
|
+
}
|
|
374
450
|
if (typeof record !== "object" || record === null || record["source"] !== "compact")
|
|
375
451
|
return 0;
|
|
376
452
|
const scope = hookSessionScope(record, repoRoot);
|
|
@@ -461,8 +537,39 @@ export async function runPostToolUseLiveHookCli(stdin, _stdout, _stderr, options
|
|
|
461
537
|
if (event.exit !== null)
|
|
462
538
|
return 0;
|
|
463
539
|
const scope = toolEventScope(event.parsed);
|
|
540
|
+
const now = options.now ?? Date.now();
|
|
464
541
|
if (scope !== null && !OWN_CARD_TOOL.test(scope.tool))
|
|
465
|
-
recordLiveStepEnd(scope.cwd, scope.sessionId, scope,
|
|
542
|
+
recordLiveStepEnd(scope.cwd, scope.sessionId, scope, now);
|
|
543
|
+
recordLanes(event.parsed, toolLaneEvents, now);
|
|
544
|
+
// A shell call that ran the film renderer is noted for the completion gate (motion-gate.ts).
|
|
545
|
+
recordMotionTool(event.parsed, now);
|
|
546
|
+
return 0;
|
|
547
|
+
}
|
|
548
|
+
/** Fold a hook payload's lane events into the session's lane records; only a LIT thread has lanes to draw. */
|
|
549
|
+
function recordLanes(parsed, read, now) {
|
|
550
|
+
try {
|
|
551
|
+
const scope = laneScope(parsed);
|
|
552
|
+
if (scope === null || workflowTurn(scope.cwd, scope.sessionId) === null)
|
|
553
|
+
return;
|
|
554
|
+
for (const laneEvent of read(parsed))
|
|
555
|
+
recordLaneEvent(scope.cwd, scope.sessionId, laneEvent, now);
|
|
556
|
+
}
|
|
557
|
+
catch {
|
|
558
|
+
// Lanes only decorate the card; a hook never fails because of them.
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* SubagentStart and SubagentStop: a child agent began or ended, so its lane row appears or leaves. Prints
|
|
563
|
+
* nothing and exits 0 on every input, including one whose payload shape is not the one probed.
|
|
564
|
+
*/
|
|
565
|
+
export async function runSubagentHookCli(kind, stdin, options = {}) {
|
|
566
|
+
const event = await readHookEvent(stdin, nullSink());
|
|
567
|
+
if (event.exit !== null)
|
|
568
|
+
return 0;
|
|
569
|
+
recordLanes(event.parsed, (parsed) => {
|
|
570
|
+
const laneEvent = subagentEvent(parsed, kind);
|
|
571
|
+
return laneEvent === null ? [] : [laneEvent];
|
|
572
|
+
}, options.now ?? Date.now());
|
|
466
573
|
return 0;
|
|
467
574
|
}
|
|
468
575
|
/** Swallows the parse errors the shared reader reports; the live-step hooks stay silent. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CardStatus } from "./card-status.js";
|
|
2
|
+
export { clean } from "./control-chars.js";
|
|
2
3
|
export interface HudSession {
|
|
3
4
|
readonly id: string;
|
|
4
5
|
readonly cwd: string;
|
|
@@ -31,7 +32,6 @@ export declare function listSessions(env: NodeJS.ProcessEnv): HudSession[];
|
|
|
31
32
|
export declare function pickSession(env: NodeJS.ProcessEnv, wanted?: string | null): HudSession | null;
|
|
32
33
|
/** Everything one frame needs, read once. Never throws and never writes. */
|
|
33
34
|
export declare function readHud(env: NodeJS.ProcessEnv, wanted: string | null, now: number): HudView;
|
|
34
|
-
export declare function clean(text: string): string;
|
|
35
35
|
/** The card with every record-derived string stripped of control characters. */
|
|
36
36
|
export declare function cleanStatus(status: CardStatus): CardStatus;
|
|
37
37
|
/** Terminal cells a plain string takes: CJK and emoji take two, combining marks none. */
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
import { lstatSync, readdirSync } from "node:fs";
|
|
12
12
|
import { join } from "node:path";
|
|
13
13
|
import { cardStatusText, readCardStatus } from "./card-status.js";
|
|
14
|
+
import { clean, cleanDeep } from "./control-chars.js";
|
|
14
15
|
import { codexHomeFrom, liveStepPath, plainDirsOrMissing, readLiveStep, readSmallJson, readThreadPointer, threadPointerPath, } from "./live-step.js";
|
|
15
16
|
import { LIT_LOOP_DIR, LIT_LOOP_GOALS, normalizeSessionId } from "./state-paths.js";
|
|
16
17
|
import { workflowTurn } from "./workflow-map.js";
|
|
18
|
+
export { clean } from "./control-chars.js";
|
|
17
19
|
const POINTER_DIR = "litcodex/lit-loop/threads";
|
|
18
20
|
const MAX_LIVE_STEP_BYTES = 4_096;
|
|
19
21
|
/** The cap the workflow map itself reads its state files under. */
|
|
@@ -183,19 +185,9 @@ export function readHud(env, wanted, now) {
|
|
|
183
185
|
return { wanted, session: null, status: null, unreadable: ["LIT records"] };
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
|
-
/** C0/C1 controls (ESC, CSI, BEL among them) plus zero-width and bidi format characters. */
|
|
187
|
-
const CONTROL = /[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069]/gu;
|
|
188
|
-
export function clean(text) {
|
|
189
|
-
return text.replace(CONTROL, "");
|
|
190
|
-
}
|
|
191
188
|
/** The card with every record-derived string stripped of control characters. */
|
|
192
189
|
export function cleanStatus(status) {
|
|
193
|
-
return
|
|
194
|
-
...status,
|
|
195
|
-
mode: status.mode === null ? null : clean(status.mode),
|
|
196
|
-
step: status.step === null ? null : { ...status.step, tool: clean(status.step.tool) },
|
|
197
|
-
map: status.map === null ? null : { ...status.map, next: status.map.next === null ? null : clean(status.map.next) },
|
|
198
|
-
};
|
|
190
|
+
return cleanDeep(status);
|
|
199
191
|
}
|
|
200
192
|
const MARK = /^\p{M}$/u;
|
|
201
193
|
const WIDE_EMOJI = /^\p{Emoji_Presentation}$/u;
|
|
@@ -257,6 +249,22 @@ function age(lastSeen, now) {
|
|
|
257
249
|
const BOLD = "\u001b[1m";
|
|
258
250
|
const DIM = "\u001b[2m";
|
|
259
251
|
const RESET = "\u001b[0m";
|
|
252
|
+
const AMBER_FG = "\u001b[38;2;255;175;60m";
|
|
253
|
+
const GREEN_FG = "\u001b[38;2;107;219;143m";
|
|
254
|
+
/** 256-colour codes, one per cell: red, orange, yellow, green, cyan, blue, violet, pink. */
|
|
255
|
+
const RAINBOW = [203, 209, 221, 114, 80, 75, 141, 205];
|
|
256
|
+
/** One line tinted cell by cell through the rainbow; still, never animated. */
|
|
257
|
+
function rainbowLine(line) {
|
|
258
|
+
let index = 0;
|
|
259
|
+
let out = BOLD;
|
|
260
|
+
for (const cell of cells(line)) {
|
|
261
|
+
if (cell.text === " ")
|
|
262
|
+
out += cell.text;
|
|
263
|
+
else
|
|
264
|
+
out += `\u001b[38;5;${RAINBOW[index++ % RAINBOW.length]}m${cell.text}`;
|
|
265
|
+
}
|
|
266
|
+
return `${out}${RESET}`;
|
|
267
|
+
}
|
|
260
268
|
/** One frame as text: a header, the card, and at most one "cannot read" line. Pure. */
|
|
261
269
|
export function renderHud(view, options) {
|
|
262
270
|
const width = Math.max(10, Math.floor(options.width));
|
|
@@ -280,17 +288,25 @@ export function renderHud(view, options) {
|
|
|
280
288
|
else {
|
|
281
289
|
const { id, folder, lastSeen } = view.session;
|
|
282
290
|
lines.push({ text: `${id.slice(0, SHORT_ID)} · ${clean(folder)} · ${age(lastSeen, options.now)}`, style: DIM });
|
|
291
|
+
const look = view.status?.look ?? null;
|
|
292
|
+
const tint = look === "turn" ? AMBER_FG : look === "done" ? GREEN_FG : "";
|
|
283
293
|
cardStatusText(cleanStatus(view.status))
|
|
284
294
|
.split("\n")
|
|
285
295
|
.forEach((text, index) => {
|
|
286
|
-
lines.push({
|
|
296
|
+
lines.push({
|
|
297
|
+
text,
|
|
298
|
+
style: index === 0 ? `${BOLD}${tint}` : tint || "",
|
|
299
|
+
rainbow: index === 0 && look === "rewind",
|
|
300
|
+
});
|
|
287
301
|
});
|
|
288
302
|
}
|
|
289
303
|
if (view.unreadable.length > 0)
|
|
290
304
|
lines.push({ text: `cannot read ${view.unreadable.join(", ")}`, style: DIM });
|
|
291
305
|
return lines
|
|
292
|
-
.map(({ text, style }) => {
|
|
306
|
+
.map(({ text, style, rainbow }) => {
|
|
293
307
|
const line = fit(clean(text), width);
|
|
308
|
+
if (options.color && rainbow === true)
|
|
309
|
+
return rainbowLine(line);
|
|
294
310
|
return options.color && style !== "" ? `${style}${line}${RESET}` : line;
|
|
295
311
|
})
|
|
296
312
|
.join("\n");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type LaneCounts, type LaneEvent } from "./lane-state.js";
|
|
2
|
+
export interface LaneScope {
|
|
3
|
+
readonly sessionId: string;
|
|
4
|
+
readonly cwd: string;
|
|
5
|
+
}
|
|
6
|
+
/** The session and workspace a payload names; null unless both are present and the workspace is absolute. */
|
|
7
|
+
export declare function laneScope(parsed: unknown): LaneScope | null;
|
|
8
|
+
/** The lane event a `SubagentStart` or `SubagentStop` payload carries, or null. */
|
|
9
|
+
export declare function subagentEvent(parsed: unknown, kind: "start" | "stop"): LaneEvent | null;
|
|
10
|
+
/** Done and total of an `update_plan` list (`plan: [{ step, status }]`); null for an empty or odd one. */
|
|
11
|
+
export declare function planCounts(toolInput: unknown): LaneCounts | null;
|
|
12
|
+
/** The lane events one `PostToolUse` payload carries: a spawn's name, an `update_plan` count, a child's step. */
|
|
13
|
+
export declare function toolLaneEvents(parsed: unknown): LaneEvent[];
|