@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.
- package/README-Ko-KR.md +13 -12
- package/README.md +13 -12
- package/TRADEMARK.md +12 -0
- package/dist/install/generated-skill-payload-hashes.d.ts +188 -82
- package/dist/install/generated-skill-payload-hashes.js +188 -82
- 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/plugins/litcodex/.codex-plugin/plugin.json +1 -1
- 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 +194 -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-plan.md +2 -1
- 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 +30 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/card-status.js +97 -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 +126 -13
- 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.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-persistence.js +38 -2
- package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-scope-roots.d.ts +7 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/plan-scope-roots.js +76 -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/restart-chip.d.ts +6 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/restart-chip.js +59 -0
- 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 +94 -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 +168 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/rewind.js +867 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/route-heads.js +45 -3
- 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/session-liveness.d.ts +16 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/session-liveness.js +90 -0
- 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 +183 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.d.ts +1 -1
- package/marketplace/plugins/litcodex/components/lit-loop/dist/trigger.js +29 -5
- 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 +139 -0
- package/marketplace/plugins/litcodex/components/lit-loop/dist/workflow-stack.js +518 -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/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 +185 -0
- package/marketplace/plugins/litcodex/skills/lit-adhd/agents/openai.yaml +6 -0
- package/marketplace/plugins/litcodex/skills/lit-adhd/references/card-examples.md +163 -0
- package/marketplace/plugins/litcodex/skills/lit-adhd/references/status-taxonomy.md +45 -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 +9 -2
- package/marketplace/plugins/litcodex/skills/lit-plan/references/full-workflow.md +2 -1
- 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/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/readme-studio/SKILL.md +10 -0
- package/marketplace/plugins/litcodex/skills/review-work/SKILL.md +7 -1
- package/marketplace/plugins/litcodex/skills/start-work/SKILL.md +11 -1
- package/node_modules/@litcodex/lit-loop/directive.md +10 -4
- package/node_modules/@litcodex/lit-loop/directives/lit-adhd.md +194 -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-plan.md +2 -1
- 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 +30 -0
- package/node_modules/@litcodex/lit-loop/dist/card-status.js +97 -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 +126 -13
- 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.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/plan-persistence.js +38 -2
- package/node_modules/@litcodex/lit-loop/dist/plan-scope-roots.d.ts +7 -0
- package/node_modules/@litcodex/lit-loop/dist/plan-scope-roots.js +76 -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/restart-chip.d.ts +6 -0
- package/node_modules/@litcodex/lit-loop/dist/restart-chip.js +59 -0
- 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 +94 -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 +168 -0
- package/node_modules/@litcodex/lit-loop/dist/rewind.js +867 -0
- package/node_modules/@litcodex/lit-loop/dist/route-heads.js +45 -3
- 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/session-liveness.d.ts +16 -0
- package/node_modules/@litcodex/lit-loop/dist/session-liveness.js +90 -0
- 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 +183 -0
- package/node_modules/@litcodex/lit-loop/dist/trigger.d.ts +1 -1
- package/node_modules/@litcodex/lit-loop/dist/trigger.js +29 -5
- 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 +139 -0
- package/node_modules/@litcodex/lit-loop/dist/workflow-stack.js +518 -0
- package/node_modules/@litcodex/lit-loop/package.json +1 -1
- package/node_modules/@litcodex/lit-loop/skills/lit-adhd/SKILL.md +185 -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 +9 -2
- 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 +11 -1
- package/package.json +3 -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,14 @@
|
|
|
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";
|
|
15
|
+
import { installedPluginVersion, loadedPluginVersion, restartChip } from "./restart-chip.js";
|
|
13
16
|
import { normalizeSessionId } from "./state-paths.js";
|
|
17
|
+
import { readThreads, threadLines } from "./threads.js";
|
|
14
18
|
import { readWorkflowSignals, workflowMapCells, workflowMapText, workflowTurn, } from "./workflow-map.js";
|
|
19
|
+
import { breadcrumb, frameNote, readStack, stackGauge, stackRow } from "./workflow-stack.js";
|
|
15
20
|
/** The rollout header carries the base instructions, so it is read up to this many bytes. */
|
|
16
21
|
const MAX_ROLLOUT_HEADER_BYTES = 256 * 1024;
|
|
17
22
|
/** The newest token count sits near the end of the rollout; only this much of the tail is read. */
|
|
@@ -268,6 +273,7 @@ function ready(thread, workspace, cardOpenedAt, now) {
|
|
|
268
273
|
thread,
|
|
269
274
|
state: "ready",
|
|
270
275
|
mode: null,
|
|
276
|
+
look: null,
|
|
271
277
|
ignitedAt: null,
|
|
272
278
|
map: null,
|
|
273
279
|
step: null,
|
|
@@ -277,12 +283,36 @@ function ready(thread, workspace, cardOpenedAt, now) {
|
|
|
277
283
|
turnEndedAt: null,
|
|
278
284
|
working: false,
|
|
279
285
|
usage: null,
|
|
286
|
+
stack: null,
|
|
287
|
+
threads: null,
|
|
288
|
+
reviewLanes: null,
|
|
280
289
|
branch: null,
|
|
281
290
|
workspace,
|
|
282
291
|
cardOpenedAt,
|
|
283
292
|
now,
|
|
284
293
|
};
|
|
285
294
|
}
|
|
295
|
+
/** The paused frames under the running one, read from the thread's own stack; null when nothing is paused. */
|
|
296
|
+
function readCardStack(cwd, thread) {
|
|
297
|
+
try {
|
|
298
|
+
const stack = readStack(cwd, thread);
|
|
299
|
+
const row = stackRow(stack);
|
|
300
|
+
const crumb = breadcrumb(stack);
|
|
301
|
+
const top = stack.frames.at(-1);
|
|
302
|
+
if (row === null || crumb === null || top === undefined || !stack.frames.some((f) => f.status === "paused"))
|
|
303
|
+
return null;
|
|
304
|
+
const framed = (f) => ({
|
|
305
|
+
name: f.skill ?? f.family ?? "work",
|
|
306
|
+
stage: f.stage,
|
|
307
|
+
gauge: stackGauge(f),
|
|
308
|
+
note: frameNote(f),
|
|
309
|
+
});
|
|
310
|
+
return { breadcrumb: crumb, row, paused: stack.frames.slice(0, -1).map(framed), running: framed(top) };
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
286
316
|
/**
|
|
287
317
|
* Whether the model is still on the turn while no tool runs. A record that knows its turn says so
|
|
288
318
|
* directly (open until Stop, unless it has gone quiet for the stale window); an older record without
|
|
@@ -331,11 +361,53 @@ export function readCardStatus(threadId, env, now = Date.now(), options = {}) {
|
|
|
331
361
|
const stage = drawn?.cells.find((cell) => cell.state === "current")?.key;
|
|
332
362
|
const finished = !recorded && turnOver && !open && drawn?.family === "main" && stage !== undefined && FINISHING_STAGES.has(stage);
|
|
333
363
|
const map = finished && drawn !== null ? finishedMap(drawn) : drawn;
|
|
334
|
-
|
|
364
|
+
const state = recorded || finished ? "complete" : "ignited";
|
|
365
|
+
const working = step !== null || turnWorking(live, lastStepAt, now);
|
|
366
|
+
const cardStack = readCardStack(cwd, thread);
|
|
367
|
+
// The look: a completion first, then the session waiting on the user, then the skill's own look.
|
|
368
|
+
// When the mode has no look (a scoped or implicit skill load that the hook never routed), the
|
|
369
|
+
// stack's active top frame can carry it: family "main" + stage "review" → "review".
|
|
370
|
+
// The "turn" look fires only when the last assistant message asked something (question mark,
|
|
371
|
+
// approval phrase) or reported BLOCKED — not on every finished turn.
|
|
372
|
+
let skillLook = lookOf(turn.mode);
|
|
373
|
+
let reviewFrame;
|
|
374
|
+
try {
|
|
375
|
+
const stack = readStack(cwd, thread);
|
|
376
|
+
reviewFrame = stack.frames.find((f) => f.family === "main" && f.stage === "review" && f.status === "active");
|
|
377
|
+
if (skillLook === null && reviewFrame !== undefined) {
|
|
378
|
+
skillLook = "review";
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
catch {
|
|
382
|
+
// The card shows what it can; a missing stack does not break the read.
|
|
383
|
+
}
|
|
384
|
+
const waitReason = live?.waitReason ?? null;
|
|
385
|
+
const waitingOnUser = !working && state === "ignited" && turnOver && waitReason !== null;
|
|
386
|
+
// The done look fires only for an explicit plan/goal completion (recorded signal), not for a
|
|
387
|
+
// routine turn that implicitly finishes at a finishing stage.
|
|
388
|
+
const doneLook = state === "complete" && recorded;
|
|
389
|
+
const look = doneLook ? "done" : waitingOnUser ? "turn" : skillLook;
|
|
390
|
+
// Review lane states from the workflow stack's verdicts.
|
|
391
|
+
let reviewLanes = null;
|
|
392
|
+
if (skillLook === "review" && reviewFrame !== undefined) {
|
|
393
|
+
reviewLanes = REVIEW_LANE_IDS.map((id) => {
|
|
394
|
+
const v = reviewFrame.verdicts[id];
|
|
395
|
+
if (v === "pass")
|
|
396
|
+
return "pass";
|
|
397
|
+
if (v === "fail")
|
|
398
|
+
return "fail";
|
|
399
|
+
if (v === "running")
|
|
400
|
+
return "running";
|
|
401
|
+
return "dim";
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
// Every string here came from a record; none of it may carry a terminal control.
|
|
405
|
+
return cleanDeep({
|
|
335
406
|
version: 1,
|
|
336
407
|
thread,
|
|
337
|
-
state
|
|
408
|
+
state,
|
|
338
409
|
mode: turn.mode,
|
|
410
|
+
look,
|
|
339
411
|
ignitedAt: turn.startedAt,
|
|
340
412
|
map,
|
|
341
413
|
step,
|
|
@@ -343,13 +415,17 @@ export function readCardStatus(threadId, env, now = Date.now(), options = {}) {
|
|
|
343
415
|
lastTool: live?.lastTool ? toolDisplayName(live.lastTool) : null,
|
|
344
416
|
turnStartedAt: live?.turnStartedAt ?? null,
|
|
345
417
|
turnEndedAt: turnOver ? live.turnEndedAt : null,
|
|
346
|
-
working
|
|
418
|
+
working,
|
|
347
419
|
usage: rollout ? readUsage(thread, env) : null,
|
|
420
|
+
stack: cardStack,
|
|
421
|
+
threads: readThreads(cwd, thread, now, signals),
|
|
422
|
+
reviewLanes,
|
|
348
423
|
branch: readBranch(cwd),
|
|
349
424
|
workspace,
|
|
350
425
|
cardOpenedAt,
|
|
426
|
+
restart: restartChip(options.loadedVersion === undefined ? loadedPluginVersion() : options.loadedVersion, installedPluginVersion(env)),
|
|
351
427
|
now,
|
|
352
|
-
};
|
|
428
|
+
});
|
|
353
429
|
}
|
|
354
430
|
/** Minutes and seconds, `m:ss`. */
|
|
355
431
|
export function clock(ms) {
|
|
@@ -359,14 +435,28 @@ export function clock(ms) {
|
|
|
359
435
|
/** The card as plain text, for hosts that cannot draw it (the terminal `codex`). */
|
|
360
436
|
export function cardStatusText(status) {
|
|
361
437
|
if (status.state === "ready")
|
|
362
|
-
return "🔥 LIT · ready — no LIT skill in this thread yet. Type `lit <task>` to start one.";
|
|
363
|
-
const
|
|
438
|
+
return "🔥 LIT · ready — no LIT skill in this thread yet. Type `lit <task>` to start one, or `lit adhd` after a break.";
|
|
439
|
+
const lookLabel = status.look === "turn"
|
|
440
|
+
? " YOUR TURN"
|
|
441
|
+
: status.look === "rewind"
|
|
442
|
+
? " REWIND <<"
|
|
443
|
+
: status.look === "review"
|
|
444
|
+
? " REVIEW"
|
|
445
|
+
: "";
|
|
446
|
+
const chip = status.restart ? ` ↻ ${status.restart}` : "";
|
|
447
|
+
const lines = [
|
|
448
|
+
`🔥 LIT ${status.state === "complete" ? "COMPLETE ✓" : "IGNITED"} · ${status.mode ?? "lit"}${lookLabel}${chip}`,
|
|
449
|
+
];
|
|
364
450
|
if (status.map !== null) {
|
|
365
451
|
lines.push(workflowMapText(status.map));
|
|
366
452
|
if (status.map.next !== null)
|
|
367
453
|
lines.push(`next ▸ ${status.map.next}`);
|
|
368
454
|
}
|
|
455
|
+
if (status.threads)
|
|
456
|
+
lines.push(...threadLines(status.threads));
|
|
457
|
+
else if (status.stack)
|
|
458
|
+
lines.push(status.stack.row);
|
|
369
459
|
if (status.step !== null)
|
|
370
460
|
lines.push(`⠹ ${status.step.tool} · ${clock(status.now - status.step.startedAt)}`);
|
|
371
|
-
return lines.join("\n");
|
|
461
|
+
return cleanLines(lines.join("\n"));
|
|
372
462
|
}
|
|
@@ -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,21 @@
|
|
|
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 { recordLiveness } from "./session-liveness.js";
|
|
25
|
+
import { applyPromptToStack, frameToResume } from "./stack-hook.js";
|
|
19
26
|
import { recordWorkflowTurn, workflowStopLine, workflowTurn } from "./workflow-map.js";
|
|
20
27
|
/** Hard cap on stdin to bound memory / ReDoS exposure inside the 5 s Codex hook budget. 8 MB. */
|
|
21
28
|
export const MAX_STDIN_BYTES = 8_000_000;
|
|
@@ -102,13 +109,61 @@ export async function runUserPromptSubmitHookCli(stdin, stdout, stderr, repoRoot
|
|
|
102
109
|
return 0;
|
|
103
110
|
}
|
|
104
111
|
clearManagedCompactionWhenOff(hookCwd(parsed, repoRoot), auto.env ?? process.env);
|
|
112
|
+
// `lit approve` / `lit deny` answer a start-work boundary; the lifecycle hook owns them, so this one stays out.
|
|
113
|
+
if (isLitUserPromptSubmitInput(parsed) && isBoundaryAnswer(parsed.prompt))
|
|
114
|
+
return 0;
|
|
115
|
+
// `go` after a lit-adhd brief runs the one step the brief named, as if the user had typed that step.
|
|
116
|
+
let goNote = null;
|
|
117
|
+
if (isLitUserPromptSubmitInput(parsed) && isGoPrompt(parsed.prompt)) {
|
|
118
|
+
const scope = hookSessionScope(parsed, repoRoot);
|
|
119
|
+
const go = scope === null ? null : takeGo(scope.cwd, scope.sessionId, auto.now ?? Date.now());
|
|
120
|
+
if (go?.kind === "hint") {
|
|
121
|
+
stdout.write(withReloadContext("", go.text) ?? "");
|
|
122
|
+
return 0;
|
|
123
|
+
}
|
|
124
|
+
if (go?.kind === "run") {
|
|
125
|
+
parsed = { ...parsed, prompt: go.prompt };
|
|
126
|
+
goNote = go.note;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
105
129
|
const pointer = hookSessionScope(parsed, repoRoot);
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
130
|
+
const savedRoute = pointer === null ? null : readActiveRoute(pointer.cwd, pointer.sessionId);
|
|
131
|
+
// An active lit-plan owns the persistence gate, so `lit continue` stays inside it rather than leaving it armed.
|
|
132
|
+
const litContinue = pointer !== null &&
|
|
133
|
+
savedRoute !== "lit-plan" &&
|
|
134
|
+
isLitUserPromptSubmitInput(parsed) &&
|
|
135
|
+
isLitContinue(parsed.prompt);
|
|
136
|
+
// `lit continue` over a side discipline returns to the paused spine, at the stage and count it left.
|
|
137
|
+
const spine = litContinue ? frameToResume(pointer.cwd, pointer.sessionId) : null;
|
|
138
|
+
const decision = runUserPromptSubmitHook(parsed, () => {
|
|
139
|
+
const saved = savedRoute;
|
|
140
|
+
return {
|
|
141
|
+
active: spine !== null && saved !== null ? spine.skill : saved,
|
|
142
|
+
resume: pointer === null ? null : readResumeWork(pointer.cwd, pointer.sessionId),
|
|
143
|
+
frame: spine === null
|
|
144
|
+
? null
|
|
145
|
+
: {
|
|
146
|
+
skill: spine.skill ?? "work",
|
|
147
|
+
stage: spine.stage,
|
|
148
|
+
...(spine.n === undefined ? {} : { n: spine.n }),
|
|
149
|
+
...(spine.total === undefined ? {} : { total: spine.total }),
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
// A film prompt arms the completion gate for this session; any other prompt disarms it.
|
|
154
|
+
if (pointer !== null && isLitUserPromptSubmitInput(parsed)) {
|
|
155
|
+
if (decision.kind === "inject" && decision.film === true)
|
|
156
|
+
armMotionTurn(pointer.cwd, pointer.sessionId, auto.now);
|
|
157
|
+
else
|
|
158
|
+
disarmMotionTurn(pointer.cwd, pointer.sessionId);
|
|
159
|
+
}
|
|
160
|
+
// A read-only brief never takes the saved route: the work under it keeps its contract and its place.
|
|
161
|
+
if (pointer !== null && decision.kind === "inject" && decision.mode !== "lit-adhd") {
|
|
162
|
+
recordActiveRoute(pointer.cwd, pointer.sessionId, spine?.skill ?? decision.mode);
|
|
163
|
+
}
|
|
164
|
+
if (pointer !== null && isLitUserPromptSubmitInput(parsed) && (litContinue || decision.kind === "inject")) {
|
|
165
|
+
applyPromptToStack(pointer.cwd, pointer.sessionId, parsed.prompt, { continued: litContinue, mode: decision.kind === "inject" ? decision.mode : null }, auto.now === undefined ? undefined : new Date(auto.now));
|
|
166
|
+
}
|
|
112
167
|
// Only a LIT thread gets a pointer: this prompt ignites LIT, or an earlier one already did.
|
|
113
168
|
if (pointer !== null && (decision.kind === "inject" || workflowTurn(pointer.cwd, pointer.sessionId) !== null)) {
|
|
114
169
|
writeThreadPointer(auto.env ?? process.env, pointer.sessionId, pointer.cwd, auto.now);
|
|
@@ -129,7 +184,8 @@ export async function runUserPromptSubmitHookCli(stdin, stdout, stderr, repoRoot
|
|
|
129
184
|
const own = decision.kind === "inject"
|
|
130
185
|
? withCardOffer(withWorkflowMap(decision.stdout, parsed, decision.mode, env), pointer, auto, decision.entry === "continue")
|
|
131
186
|
: "";
|
|
132
|
-
const
|
|
187
|
+
const noted = goNote === null || own === "" ? own : (withReloadContext(own, goNote) ?? own);
|
|
188
|
+
const output = withAutoHandoffReload(noted, parsed, repoRoot, auto);
|
|
133
189
|
if (output !== "")
|
|
134
190
|
stdout.write(output);
|
|
135
191
|
return 0;
|
|
@@ -307,7 +363,7 @@ export async function runStopPlanPersistenceHookCli(stdin, stdout, stderr, repoR
|
|
|
307
363
|
// No tool runs once Stop fires: one whose PostToolUse never came (interrupted, or denied by another hook) is over.
|
|
308
364
|
// The turn itself closes only below, after the guards that can send the model back to work.
|
|
309
365
|
endLiveStep(scope.cwd, scope.sessionId, auto.now, false);
|
|
310
|
-
const persistence = evaluatePlanPersistence(scope.cwd, scope.sessionId);
|
|
366
|
+
const persistence = evaluatePlanPersistence(scope.cwd, scope.sessionId, auto.now);
|
|
311
367
|
if (persistence.decision === "block") {
|
|
312
368
|
stdout.write(formatStopBlockOutput(persistence.reason));
|
|
313
369
|
return 0;
|
|
@@ -328,8 +384,21 @@ export async function runStopPlanPersistenceHookCli(stdin, stdout, stderr, repoR
|
|
|
328
384
|
// A subagent's Stop carries the parent's session id; the parent's turn is still running.
|
|
329
385
|
if (isSubagent(parsed))
|
|
330
386
|
return 0;
|
|
331
|
-
|
|
387
|
+
const motion = await evaluateMotionStop({
|
|
388
|
+
cwd: scope.cwd,
|
|
389
|
+
sessionId: scope.sessionId,
|
|
390
|
+
...(auto.now === undefined ? {} : { now: auto.now }),
|
|
391
|
+
...(auto.evaluateMotion === undefined ? {} : { evaluate: auto.evaluateMotion }),
|
|
392
|
+
});
|
|
393
|
+
if (motion.action === "block") {
|
|
394
|
+
stdout.write(formatStopBlockOutput(motion.reason));
|
|
395
|
+
return 0;
|
|
396
|
+
}
|
|
397
|
+
const lastMsg = typeof record["last_assistant_message"] === "string" ? record["last_assistant_message"] : null;
|
|
398
|
+
endLiveStep(scope.cwd, scope.sessionId, auto.now, true, detectWaitReason(lastMsg));
|
|
332
399
|
const env = auto.env ?? process.env;
|
|
400
|
+
if (workflowTurn(scope.cwd, scope.sessionId) !== null)
|
|
401
|
+
recordLiveness(scope.cwd, scope.sessionId, "idle", env, auto.now);
|
|
333
402
|
const line = typeof record["turn_id"] === "string"
|
|
334
403
|
? workflowStopLine(scope.cwd, scope.sessionId, record["turn_id"], {
|
|
335
404
|
stopHookActive: record["stop_hook_active"] === true,
|
|
@@ -371,6 +440,16 @@ export async function runSessionStartHookCli(stdin, stdout, stderr, repoRoot = p
|
|
|
371
440
|
return event.exit;
|
|
372
441
|
clearManagedCompactionWhenOff(hookCwd(event.parsed, repoRoot), auto.env ?? process.env);
|
|
373
442
|
const record = event.parsed;
|
|
443
|
+
if (typeof record === "object" &&
|
|
444
|
+
record !== null &&
|
|
445
|
+
(record["source"] === "startup" || record["source"] === "resume")) {
|
|
446
|
+
const opened = hookSessionScope(record, repoRoot);
|
|
447
|
+
const offer = opened === null ? null : adhdSuggestion(opened.cwd, opened.sessionId);
|
|
448
|
+
if (offer !== null) {
|
|
449
|
+
stdout.write(`${JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: offer } })}\n`);
|
|
450
|
+
}
|
|
451
|
+
return 0;
|
|
452
|
+
}
|
|
374
453
|
if (typeof record !== "object" || record === null || record["source"] !== "compact")
|
|
375
454
|
return 0;
|
|
376
455
|
const scope = hookSessionScope(record, repoRoot);
|
|
@@ -461,8 +540,42 @@ export async function runPostToolUseLiveHookCli(stdin, _stdout, _stderr, options
|
|
|
461
540
|
if (event.exit !== null)
|
|
462
541
|
return 0;
|
|
463
542
|
const scope = toolEventScope(event.parsed);
|
|
464
|
-
|
|
465
|
-
|
|
543
|
+
const now = options.now ?? Date.now();
|
|
544
|
+
if (scope !== null && !OWN_CARD_TOOL.test(scope.tool)) {
|
|
545
|
+
recordLiveStepEnd(scope.cwd, scope.sessionId, scope, now);
|
|
546
|
+
if (workflowTurn(scope.cwd, scope.sessionId) !== null)
|
|
547
|
+
recordLiveness(scope.cwd, scope.sessionId, "alive", options.env ?? process.env, now);
|
|
548
|
+
}
|
|
549
|
+
recordLanes(event.parsed, toolLaneEvents, now);
|
|
550
|
+
// A shell call that ran the film renderer is noted for the completion gate (motion-gate.ts).
|
|
551
|
+
recordMotionTool(event.parsed, now);
|
|
552
|
+
return 0;
|
|
553
|
+
}
|
|
554
|
+
/** Fold a hook payload's lane events into the session's lane records; only a LIT thread has lanes to draw. */
|
|
555
|
+
function recordLanes(parsed, read, now) {
|
|
556
|
+
try {
|
|
557
|
+
const scope = laneScope(parsed);
|
|
558
|
+
if (scope === null || workflowTurn(scope.cwd, scope.sessionId) === null)
|
|
559
|
+
return;
|
|
560
|
+
for (const laneEvent of read(parsed))
|
|
561
|
+
recordLaneEvent(scope.cwd, scope.sessionId, laneEvent, now);
|
|
562
|
+
}
|
|
563
|
+
catch {
|
|
564
|
+
// Lanes only decorate the card; a hook never fails because of them.
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* SubagentStart and SubagentStop: a child agent began or ended, so its lane row appears or leaves. Prints
|
|
569
|
+
* nothing and exits 0 on every input, including one whose payload shape is not the one probed.
|
|
570
|
+
*/
|
|
571
|
+
export async function runSubagentHookCli(kind, stdin, options = {}) {
|
|
572
|
+
const event = await readHookEvent(stdin, nullSink());
|
|
573
|
+
if (event.exit !== null)
|
|
574
|
+
return 0;
|
|
575
|
+
recordLanes(event.parsed, (parsed) => {
|
|
576
|
+
const laneEvent = subagentEvent(parsed, kind);
|
|
577
|
+
return laneEvent === null ? [] : [laneEvent];
|
|
578
|
+
}, options.now ?? Date.now());
|
|
466
579
|
return 0;
|
|
467
580
|
}
|
|
468
581
|
/** 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[];
|