@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
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
// src/motion-gate.ts — the film completion gate.
|
|
2
|
+
//
|
|
3
|
+
// A turn routed to the film skill is done when the skill's own done-check says so, not when a command
|
|
4
|
+
// ran. Three hook events cooperate through one small record, `.litcodex/motion/turn.json`:
|
|
5
|
+
// UserPromptSubmit arms the turn for a film prompt, and removes the record for any other prompt;
|
|
6
|
+
// PostToolUse records every `render.mjs <subcommand>` run of a shell call (its output folder,
|
|
7
|
+
// round and exit), after expanding the shell variables the call set itself;
|
|
8
|
+
// Stop blocks the turn until the last output folder passes the done-check.
|
|
9
|
+
//
|
|
10
|
+
// The record belongs to one session. A model that works inside the film folder is still found: every
|
|
11
|
+
// lookup walks up from the hook's cwd to the nearest folder that holds this session's record. A missing
|
|
12
|
+
// or unreadable treatment, gate report or look record is a block with a named reason (the skill's
|
|
13
|
+
// done-check reports it). Only this module's own state fails open. After MOTION_MAX_BLOCKS reminders the
|
|
14
|
+
// hook blocks once more to tell the model to say, in the reply, that the film is not done and why. A blocked
|
|
15
|
+
// environment goes straight to that notice, and a finished film that carries a downgrade, labels or open
|
|
16
|
+
// look items blocks once so the reply says so. Frames viewed are whatever the done-check reads from
|
|
17
|
+
// look.json; this module never parses a transcript.
|
|
18
|
+
import { existsSync, mkdirSync, rmSync } from "node:fs";
|
|
19
|
+
import { homedir } from "node:os";
|
|
20
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
21
|
+
import { pathToFileURL } from "node:url";
|
|
22
|
+
import { plainDirsOrMissing, readSmallJson, writeFileAtomic } from "./live-step.js";
|
|
23
|
+
import { resolveSkillPath } from "./modes.js";
|
|
24
|
+
export const MOTION_MAX_BLOCKS = 2;
|
|
25
|
+
const MOTION_DIR = ".litcodex/motion";
|
|
26
|
+
const MOTION_FILE = "turn.json";
|
|
27
|
+
const MAX_RUNS = 12;
|
|
28
|
+
const MAX_TURN_BYTES = 16_384;
|
|
29
|
+
/** Exit codes the renderer reserves for a blocked environment (MO-A-45); the turn cannot finish by trying again. */
|
|
30
|
+
const BLOCKED_EXITS = new Set([10, 11, 12, 14, 15, 21, 22]);
|
|
31
|
+
/** The renderer prints `<NAME>: <message>` for a blocked run and sets no exit line, so the name stands in for the code. */
|
|
32
|
+
const EXIT_BY_NAME = Object.freeze({
|
|
33
|
+
BLOCKED_NO_CHROME: 10,
|
|
34
|
+
BLOCKED_NO_WEBGL2: 11,
|
|
35
|
+
BLOCKED_NO_FFMPEG_FOR_VIDEO: 12,
|
|
36
|
+
GATE_FAIL_QA: 13,
|
|
37
|
+
BLOCKED_DEPS_NOT_PREWARMED: 14,
|
|
38
|
+
BLOCKED_FONT_FETCH: 15,
|
|
39
|
+
BLOCKED_TREATMENT_INVALID: 16,
|
|
40
|
+
BLOCKED_NO_COVER_ENCODER: 21,
|
|
41
|
+
BLOCKED_ASSET_MISSING: 22,
|
|
42
|
+
});
|
|
43
|
+
const SUBCOMMANDS = "stage|cover-gate|cover|film|gate|sound|look|stills|sheet|video|perf|completion";
|
|
44
|
+
const COMMAND = new RegExp(`\\brender\\.mjs["']?\\s+(${SUBCOMMANDS})\\b([^\\n;&|]*)`, "u");
|
|
45
|
+
const SHELL_TOOL = /^Bash$/u;
|
|
46
|
+
function isRecord(value) {
|
|
47
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
48
|
+
}
|
|
49
|
+
export function motionTurnPath(root) {
|
|
50
|
+
return join(root, MOTION_DIR, MOTION_FILE);
|
|
51
|
+
}
|
|
52
|
+
function readTurn(root) {
|
|
53
|
+
const path = motionTurnPath(root);
|
|
54
|
+
if (!existsSync(path))
|
|
55
|
+
return { kind: "none" };
|
|
56
|
+
const raw = readSmallJson(path, MAX_TURN_BYTES);
|
|
57
|
+
if (!isRecord(raw) ||
|
|
58
|
+
typeof raw["sessionId"] !== "string" ||
|
|
59
|
+
!Number.isInteger(raw["blockCount"]) ||
|
|
60
|
+
!Array.isArray(raw["runs"]))
|
|
61
|
+
return { kind: "bad" };
|
|
62
|
+
return { kind: "turn", turn: raw };
|
|
63
|
+
}
|
|
64
|
+
function writeTurn(root, turn) {
|
|
65
|
+
try {
|
|
66
|
+
if (!plainDirsOrMissing(root, MOTION_DIR))
|
|
67
|
+
return false;
|
|
68
|
+
mkdirSync(join(root, MOTION_DIR), { recursive: true });
|
|
69
|
+
writeFileAtomic(motionTurnPath(root), `${JSON.stringify(turn)}\n`);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The nearest folder up the tree from `cwd` whose record belongs to `sessionId`. The model often works
|
|
78
|
+
* inside the film folder, and that folder is not the one the prompt armed. A record of another session is
|
|
79
|
+
* not this turn's; an unreadable one of this folder ends the search as "bad" so the caller fails open.
|
|
80
|
+
*/
|
|
81
|
+
export function findMotionTurnRoot(cwd, sessionId) {
|
|
82
|
+
for (let dir = resolve(cwd);; dir = dirname(dir)) {
|
|
83
|
+
const read = readTurn(dir);
|
|
84
|
+
if (read.kind === "bad")
|
|
85
|
+
return "bad";
|
|
86
|
+
if (read.kind === "turn" && read.turn.sessionId === sessionId)
|
|
87
|
+
return { root: dir, turn: read.turn };
|
|
88
|
+
if (dirname(dir) === dir)
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** Arm the turn for a film prompt: a fresh record, no runs, no reminders yet. */
|
|
93
|
+
export function armMotionTurn(cwd, sessionId, now = Date.now()) {
|
|
94
|
+
return writeTurn(cwd, { sessionId, promptAt: now, runs: [], blockCount: 0, warned: false, notified: false });
|
|
95
|
+
}
|
|
96
|
+
/** A prompt that is not a film prompt ends the gate for this session; nothing else is touched. */
|
|
97
|
+
export function disarmMotionTurn(cwd, sessionId) {
|
|
98
|
+
try {
|
|
99
|
+
const found = findMotionTurnRoot(cwd, sessionId);
|
|
100
|
+
if (found === null)
|
|
101
|
+
return;
|
|
102
|
+
if (found === "bad")
|
|
103
|
+
rmSync(motionTurnPath(resolve(cwd)), { force: true });
|
|
104
|
+
else
|
|
105
|
+
rmSync(motionTurnPath(found.root), { force: true });
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// A stale record only costs one extra reminder; a prompt hook never fails because of it.
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const unquote = (value) => value.replace(/^["']|["']$/gu, "");
|
|
112
|
+
/** `$NAME` and `${NAME}` from the assignments the command made. A name it never set stays as written. */
|
|
113
|
+
function expandVars(value, vars) {
|
|
114
|
+
return value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}|\$([A-Za-z_][A-Za-z0-9_]*)/gu, (whole, braced, bare) => {
|
|
115
|
+
return vars.get(braced ?? bare ?? "") ?? whole;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/** The folder a leading `cd <dir>` of the same command line moved to, else the hook's own cwd. */
|
|
119
|
+
function workdirAfterCd(before, workdir) {
|
|
120
|
+
let dir = workdir;
|
|
121
|
+
for (const match of before.matchAll(/(?:^|[;&|(]\s*)cd\s+("[^"]*"|'[^']*'|[^\s;&|]+)/gu)) {
|
|
122
|
+
const target = match[1] === undefined ? "" : unquote(match[1]);
|
|
123
|
+
if (target === "" || target.includes("$") || target.includes("`"))
|
|
124
|
+
return "";
|
|
125
|
+
dir = target.startsWith("~") ? join(homedir(), target.slice(1)) : isAbsolute(target) ? target : join(dir, target);
|
|
126
|
+
}
|
|
127
|
+
return dir;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Parse one shell call that runs `render.mjs <subcommand> ...`. Variables the same command set earlier
|
|
131
|
+
* (`D=/x/film && node "$R" stage --out "$D"`, also `${D}`) are expanded first. An output path that still
|
|
132
|
+
* holds a `$` after that, or a command substitution, is unknown (`out: null`), never guessed.
|
|
133
|
+
*/
|
|
134
|
+
export function parseMotionCommand(command, workdir) {
|
|
135
|
+
const vars = new Map();
|
|
136
|
+
for (const m of command.matchAll(/(?:^|[\s;&|(])(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=("[^"]*"|'[^']*'|[^\s;&|]*)/gu)) {
|
|
137
|
+
const name = m[1];
|
|
138
|
+
const value = m[2];
|
|
139
|
+
if (name !== undefined && value !== undefined)
|
|
140
|
+
vars.set(name, expandVars(unquote(value), vars));
|
|
141
|
+
}
|
|
142
|
+
const expanded = expandVars(command, vars);
|
|
143
|
+
const match = COMMAND.exec(expanded);
|
|
144
|
+
if (!match)
|
|
145
|
+
return null;
|
|
146
|
+
const mode = match[1] ?? "";
|
|
147
|
+
const tokens = [...(match[2] ?? "").matchAll(/"[^"]*"|'[^']*'|\S+/gu)].map((m) => unquote(m[0]));
|
|
148
|
+
let outValue;
|
|
149
|
+
let roundValue;
|
|
150
|
+
let stillsOnly = false;
|
|
151
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
152
|
+
const token = tokens[i] ?? "";
|
|
153
|
+
if (token === "--stills-only")
|
|
154
|
+
stillsOnly = true;
|
|
155
|
+
else if (token === "--out")
|
|
156
|
+
outValue = tokens[++i];
|
|
157
|
+
else if (token.startsWith("--out="))
|
|
158
|
+
outValue = token.slice("--out=".length);
|
|
159
|
+
else if (token === "--round")
|
|
160
|
+
roundValue = tokens[++i];
|
|
161
|
+
else if (token.startsWith("--round="))
|
|
162
|
+
roundValue = token.slice("--round=".length);
|
|
163
|
+
}
|
|
164
|
+
const base = workdirAfterCd(expanded.slice(0, match.index), workdir);
|
|
165
|
+
const abs = (path) => {
|
|
166
|
+
if (path === undefined || path === "" || base === "")
|
|
167
|
+
return null;
|
|
168
|
+
if (path.includes("$") || path.includes("`"))
|
|
169
|
+
return null;
|
|
170
|
+
if (path.startsWith("~"))
|
|
171
|
+
return join(homedir(), path.slice(1));
|
|
172
|
+
return isAbsolute(path) ? resolve(path) : resolve(base, path);
|
|
173
|
+
};
|
|
174
|
+
// cover-gate judges a decoded file; it is not a render, so it never becomes the folder the gate checks.
|
|
175
|
+
const out = mode === "cover-gate" ? null : abs(outValue);
|
|
176
|
+
const round = roundValue === undefined || !/^\d+$/u.test(roundValue) ? null : Number(roundValue);
|
|
177
|
+
return { mode, out, round, stillsOnly };
|
|
178
|
+
}
|
|
179
|
+
function responseText(response) {
|
|
180
|
+
if (typeof response === "string")
|
|
181
|
+
return response;
|
|
182
|
+
if (!isRecord(response))
|
|
183
|
+
return "";
|
|
184
|
+
return [response["stdout"], response["stderr"], response["output"]].filter((p) => typeof p === "string").join("\n");
|
|
185
|
+
}
|
|
186
|
+
/** The run's exit: a numeric field the host sends, else an `exit <code>` line, else a blocked name the renderer printed. */
|
|
187
|
+
export function exitCodeOf(response) {
|
|
188
|
+
if (isRecord(response)) {
|
|
189
|
+
const meta = isRecord(response["metadata"]) ? response["metadata"] : {};
|
|
190
|
+
for (const value of [response["exit_code"], response["exitCode"], meta["exit_code"]])
|
|
191
|
+
if (typeof value === "number" && Number.isInteger(value))
|
|
192
|
+
return value;
|
|
193
|
+
}
|
|
194
|
+
const text = responseText(response);
|
|
195
|
+
const lines = [...text.matchAll(/^exit (\d+)\b/gmu)];
|
|
196
|
+
const last = lines[lines.length - 1]?.[1];
|
|
197
|
+
if (last !== undefined)
|
|
198
|
+
return Number(last);
|
|
199
|
+
const named = /^([A-Z][A-Z0-9_]+):/mu.exec(text)?.[1];
|
|
200
|
+
return named !== undefined && named in EXIT_BY_NAME ? (EXIT_BY_NAME[named] ?? null) : null;
|
|
201
|
+
}
|
|
202
|
+
/** Record a finished shell call that ran `render.mjs`. Silent for anything else, and never throws. */
|
|
203
|
+
export function recordMotionTool(input, now = Date.now()) {
|
|
204
|
+
try {
|
|
205
|
+
if (!isRecord(input))
|
|
206
|
+
return null;
|
|
207
|
+
const { session_id: sessionId, cwd, tool_name: tool, tool_input: toolInput } = input;
|
|
208
|
+
if (typeof sessionId !== "string" || sessionId === "" || typeof cwd !== "string" || !isAbsolute(cwd))
|
|
209
|
+
return null;
|
|
210
|
+
if (typeof tool !== "string" || !SHELL_TOOL.test(tool) || !isRecord(toolInput))
|
|
211
|
+
return null;
|
|
212
|
+
const command = typeof toolInput["command"] === "string" ? toolInput["command"] : toolInput["cmd"];
|
|
213
|
+
if (typeof command !== "string")
|
|
214
|
+
return null;
|
|
215
|
+
const parsed = parseMotionCommand(command, cwd);
|
|
216
|
+
if (parsed === null)
|
|
217
|
+
return null;
|
|
218
|
+
const found = findMotionTurnRoot(cwd, sessionId);
|
|
219
|
+
if (found === null || found === "bad")
|
|
220
|
+
return null;
|
|
221
|
+
const run = { ...parsed, exitCode: exitCodeOf(input["tool_response"]), at: now };
|
|
222
|
+
const turn = { ...found.turn, runs: [...found.turn.runs, run].slice(-MAX_RUNS) };
|
|
223
|
+
return writeTurn(found.root, turn) ? turn : null;
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const notDoneNotice = (reasons) => `lit-typographic-motion: the film is not done (${reasons.join("; ")}). Stop rendering now and say in the reply, in plain words, that the film is not done and why, and what the user can run to finish it.`;
|
|
230
|
+
/**
|
|
231
|
+
* The installed film skill's done-check, imported by absolute path. Null when the skill or its module is
|
|
232
|
+
* missing (the gate cannot judge, so it fails open); a check that throws on a render folder it cannot read
|
|
233
|
+
* is a not-complete verdict that names the cause.
|
|
234
|
+
*/
|
|
235
|
+
export const installedEvaluator = async (outDir) => {
|
|
236
|
+
let evaluate;
|
|
237
|
+
try {
|
|
238
|
+
const module = resolve(dirname(resolveSkillPath("lit-typographic-motion")), "engine", "completion.mjs");
|
|
239
|
+
if (!existsSync(module))
|
|
240
|
+
return null;
|
|
241
|
+
const loaded = (await import(pathToFileURL(module).href));
|
|
242
|
+
evaluate = loaded.evaluateCompletion;
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
if (typeof evaluate !== "function")
|
|
248
|
+
return null;
|
|
249
|
+
try {
|
|
250
|
+
return evaluate(outDir);
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
const message = error instanceof Error ? error.message.split("\n")[0] : "unreadable render state";
|
|
254
|
+
return { status: "not complete", reason: `the render state in ${outDir} could not be read (${message})` };
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
/** Decide whether the Stop event may end a film turn. Allows when there is no armed turn or this gate cannot judge. */
|
|
258
|
+
export async function evaluateMotionStop(input) {
|
|
259
|
+
const found = findMotionTurnRoot(input.cwd, input.sessionId);
|
|
260
|
+
if (found === null)
|
|
261
|
+
return { action: "allow", why: "not-a-motion-turn" };
|
|
262
|
+
if (found === "bad")
|
|
263
|
+
return { action: "allow", why: "unreadable-turn-state" };
|
|
264
|
+
const { root, turn } = found;
|
|
265
|
+
if (turn.notified)
|
|
266
|
+
return { action: "allow", why: "notified" };
|
|
267
|
+
const last = [...turn.runs].reverse().find((r) => r.out !== null) ?? null;
|
|
268
|
+
let verdict;
|
|
269
|
+
if (last === null) {
|
|
270
|
+
verdict = { status: "not complete", reason: "no render command ran in this turn" };
|
|
271
|
+
}
|
|
272
|
+
else if (last.exitCode !== null && BLOCKED_EXITS.has(last.exitCode)) {
|
|
273
|
+
verdict = {
|
|
274
|
+
status: "BLOCKED",
|
|
275
|
+
reason: `the render is BLOCKED (exit ${last.exitCode}); report the blocked state and its fix command`,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
const judged = await (input.evaluate ?? installedEvaluator)(last.out ?? "");
|
|
280
|
+
if (judged === null)
|
|
281
|
+
return { action: "allow", why: "done-check-unavailable" };
|
|
282
|
+
verdict = judged;
|
|
283
|
+
}
|
|
284
|
+
if (verdict.status === "complete" || verdict.status === "DONE_UNVIEWED") {
|
|
285
|
+
const say = [
|
|
286
|
+
...(verdict.status === "DONE_UNVIEWED" ? [verdict.reason] : []),
|
|
287
|
+
...(verdict.labels ?? []),
|
|
288
|
+
...(verdict.downgraded ?? []).map((d) => `downgraded: ${d}`),
|
|
289
|
+
...(verdict.openItems ?? []).map((o) => `open item: ${o}`),
|
|
290
|
+
];
|
|
291
|
+
if (say.length === 0)
|
|
292
|
+
return { action: "allow", why: "done" };
|
|
293
|
+
writeTurn(root, { ...turn, notified: true });
|
|
294
|
+
return {
|
|
295
|
+
action: "block",
|
|
296
|
+
why: verdict.status,
|
|
297
|
+
reason: `lit-typographic-motion: the film is finished. The reply must say plainly: ${say.join("; ")}.`,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
if (verdict.status === "BLOCKED" || turn.blockCount >= MOTION_MAX_BLOCKS) {
|
|
301
|
+
writeTurn(root, { ...turn, notified: true, warned: true });
|
|
302
|
+
return { action: "block", why: "not-done-notice", reason: notDoneNotice([verdict.reason]) };
|
|
303
|
+
}
|
|
304
|
+
writeTurn(root, { ...turn, blockCount: turn.blockCount + 1 });
|
|
305
|
+
return {
|
|
306
|
+
action: "block",
|
|
307
|
+
why: "not-done",
|
|
308
|
+
reason: `lit-typographic-motion is not done: ${verdict.reason}. Finish the loop in references/look.md: render, open every listed still, record the look round, and render again when the gate or a look answer asks for it. \`render.mjs completion --out <dir>\` prints this verdict.`,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
@@ -65,6 +65,10 @@ export function typeLedCue(prompt) {
|
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
67
|
export const FILM_SUBCOMMANDS = Object.freeze([
|
|
68
|
+
"scaffold",
|
|
69
|
+
"styles",
|
|
70
|
+
"assets --url <link>",
|
|
71
|
+
"blender [--preview|--final]",
|
|
68
72
|
"stage [--stills-only]",
|
|
69
73
|
"cover [--window t0,t1]",
|
|
70
74
|
"film [--stills-only]",
|
|
@@ -91,7 +95,7 @@ export function motionRouteContext(litLoopSkillPath, prompt) {
|
|
|
91
95
|
"Path rule: the type path only when the words themselves are the film (kinetic type, a lyric or quote video, a title sequence, typographic motion, or supplied words with no other subject) at 16:9. Every other film, and every 9:16 film, takes the stage path: you author the visuals in HTML, CSS, SVG or Canvas and the renderer captures them.",
|
|
92
96
|
"Hand-encoded films are not the deliverable; every frame and track goes through the renderer.",
|
|
93
97
|
"A README, hero or banner loop takes cover mode: references/cover.md.",
|
|
94
|
-
`Renderer: node "${renderer}" <subcommand> --out <dir>; subcommands: ${FILM_SUBCOMMANDS.join(", ")}.`,
|
|
98
|
+
`Renderer: node "${renderer}" <subcommand> --out <dir>; subcommands: ${FILM_SUBCOMMANDS.join(", ")}. A Stop check holds the turn until \`completion --out <dir>\` reports complete.`,
|
|
95
99
|
...(cue ? [`type-led cue found: ${cue}`] : []),
|
|
96
100
|
].join("\n");
|
|
97
101
|
}
|
|
@@ -17,6 +17,6 @@ export declare function rearmLitPlanIfSatisfied(repoRoot: string, sessionId: str
|
|
|
17
17
|
* already satisfied, or when the block cap is spent; otherwise block until a checkbox plan newer than
|
|
18
18
|
* the activation exists. Fail-open on any fs error.
|
|
19
19
|
*/
|
|
20
|
-
export declare function evaluatePlanPersistence(repoRoot: string, sessionId: string): PlanPersistenceDecision;
|
|
20
|
+
export declare function evaluatePlanPersistence(repoRoot: string, sessionId: string, now?: number): PlanPersistenceDecision;
|
|
21
21
|
/** Codex Stop hook output for a block decision (single line + newline). */
|
|
22
22
|
export declare function formatStopBlockOutput(reason: string): string;
|
|
@@ -8,8 +8,12 @@
|
|
|
8
8
|
// PLAN_PERSISTENCE_MAX_BLOCKS blocks are issued per session so a model that keeps interviewing (or a
|
|
9
9
|
// user who abandons the plan) can never be trapped in a Stop loop. Every fs failure is FAIL-OPEN.
|
|
10
10
|
import { mkdirSync, readdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { homedir } from "node:os";
|
|
11
12
|
import { isAbsolute, join } from "node:path";
|
|
13
|
+
import { scopeRootGaps, scopeRootLine } from "./plan-scope-roots.js";
|
|
14
|
+
import { writeNext } from "./rewind.js";
|
|
12
15
|
import { normalizeSessionId } from "./state-paths.js";
|
|
16
|
+
import { recordStackEvent } from "./workflow-stack.js";
|
|
13
17
|
export const PLAN_PERSISTENCE_DIR = ".litcodex/lit-plan";
|
|
14
18
|
export const PLAN_PERSISTENCE_PLANS_DIR = ".litcodex/plans";
|
|
15
19
|
export const PLAN_PERSISTENCE_MAX_BLOCKS = 2;
|
|
@@ -37,12 +41,14 @@ function readState(path) {
|
|
|
37
41
|
typeof record["satisfied"] !== "boolean") {
|
|
38
42
|
return null;
|
|
39
43
|
}
|
|
44
|
+
const warned = record["scopeWarned"];
|
|
40
45
|
return {
|
|
41
46
|
version: STATE_VERSION,
|
|
42
47
|
sessionId: record["sessionId"],
|
|
43
48
|
activatedAt: record["activatedAt"],
|
|
44
49
|
blocks: record["blocks"],
|
|
45
50
|
satisfied: record["satisfied"],
|
|
51
|
+
...(Array.isArray(warned) ? { scopeWarned: warned.filter((name) => typeof name === "string") } : {}),
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
54
|
catch {
|
|
@@ -102,7 +108,7 @@ function newestPlanSince(repoRoot, since) {
|
|
|
102
108
|
return null;
|
|
103
109
|
try {
|
|
104
110
|
const body = readFileSync(join(dir, newest.file), "utf8");
|
|
105
|
-
return { file: newest.file, taskRows: body.split(/\r?\n/).filter((line) => TASK_ROW.test(line)).length };
|
|
111
|
+
return { file: newest.file, taskRows: body.split(/\r?\n/).filter((line) => TASK_ROW.test(line)).length, body };
|
|
106
112
|
}
|
|
107
113
|
catch {
|
|
108
114
|
return null;
|
|
@@ -114,12 +120,18 @@ function blockReason(detail) {
|
|
|
114
120
|
"(plan Markdown on stdin; `## Todos` rows as `- [ ] N. <title>` at column zero). " +
|
|
115
121
|
`If approval is still pending, ask for it explicitly and end the turn; this guard blocks at most ${PLAN_PERSISTENCE_MAX_BLOCKS} turns per session.`);
|
|
116
122
|
}
|
|
123
|
+
function scopeReason(file, gaps) {
|
|
124
|
+
return (`The saved plan ${PLAN_PERSISTENCE_PLANS_DIR}/${file} names paths outside this project that no \`Scope roots:\` line covers, ` +
|
|
125
|
+
"so start-work would pause at the first touch of each. Add these lines at column zero near the top of the plan " +
|
|
126
|
+
`(widen \`read\` to the actions each todo needs), then end the turn:\n${gaps.map(scopeRootLine).join("\n")}\n` +
|
|
127
|
+
"This is advisory and shown once for this plan; leave the plan as it is if the run should ask instead.");
|
|
128
|
+
}
|
|
117
129
|
/**
|
|
118
130
|
* Decide whether the Stop for `sessionId` may end. Pass when no activation exists, when the guard is
|
|
119
131
|
* already satisfied, or when the block cap is spent; otherwise block until a checkbox plan newer than
|
|
120
132
|
* the activation exists. Fail-open on any fs error.
|
|
121
133
|
*/
|
|
122
|
-
export function evaluatePlanPersistence(repoRoot, sessionId) {
|
|
134
|
+
export function evaluatePlanPersistence(repoRoot, sessionId, now = Date.now()) {
|
|
123
135
|
const path = statePath(repoRoot, sessionId);
|
|
124
136
|
if (path === null)
|
|
125
137
|
return PASS;
|
|
@@ -128,12 +140,36 @@ export function evaluatePlanPersistence(repoRoot, sessionId) {
|
|
|
128
140
|
return PASS;
|
|
129
141
|
const newest = newestPlanSince(repoRoot, state.activatedAt);
|
|
130
142
|
if (newest !== null && newest.taskRows > 0) {
|
|
143
|
+
const warned = state.scopeWarned ?? [];
|
|
144
|
+
const gaps = warned.includes(newest.file)
|
|
145
|
+
? []
|
|
146
|
+
: scopeRootGaps(newest.body, repoRoot, process.env["HOME"] ?? homedir());
|
|
147
|
+
if (gaps.length > 0) {
|
|
148
|
+
try {
|
|
149
|
+
writeState(path, { ...state, scopeWarned: [...warned, newest.file] });
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return PASS;
|
|
153
|
+
}
|
|
154
|
+
return { decision: "block", reason: scopeReason(newest.file, gaps) };
|
|
155
|
+
}
|
|
131
156
|
try {
|
|
132
157
|
writeState(path, { ...state, satisfied: true });
|
|
133
158
|
}
|
|
134
159
|
catch {
|
|
135
160
|
// Losing the satisfied mark only means the next Stop re-checks the (already valid) plan.
|
|
136
161
|
}
|
|
162
|
+
// The saved plan's name rides on the lit-plan frame, so the work that follows it counts the plan's checkboxes.
|
|
163
|
+
recordStackEvent(repoRoot, sessionId, {
|
|
164
|
+
type: "move",
|
|
165
|
+
family: "main",
|
|
166
|
+
stage: "plan",
|
|
167
|
+
scope: "nearest",
|
|
168
|
+
done: true,
|
|
169
|
+
ref: { plan: `${PLAN_PERSISTENCE_PLANS_DIR}/${newest.file}` },
|
|
170
|
+
}, new Date());
|
|
171
|
+
// One `go` in this session within the go window starts the plan just saved.
|
|
172
|
+
writeNext(repoRoot, sessionId, { kind: "start-plan", text: `start work on ${newest.file}`, plan: newest.file }, now);
|
|
137
173
|
return PASS;
|
|
138
174
|
}
|
|
139
175
|
if (state.blocks >= PLAN_PERSISTENCE_MAX_BLOCKS)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Absolute paths the plan's todos name outside `projectRoot` that no `Scope roots:` line covers, in order of
|
|
3
|
+
* first mention. Empty when the plan is covered.
|
|
4
|
+
*/
|
|
5
|
+
export declare function scopeRootGaps(text: string, projectRoot: string, home: string): string[];
|
|
6
|
+
/** The line a planner pastes to declare `path`; read access is the default to widen deliberately. */
|
|
7
|
+
export declare function scopeRootLine(path: string): string;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// src/plan-scope-roots.ts — the advisory `Scope roots:` check for a saved lit-plan.
|
|
2
|
+
//
|
|
3
|
+
// start-work later grants only the project and the roots a plan declares on its own column-zero lines,
|
|
4
|
+
// `Scope roots: <path> (<actions>)`. A todo that names an absolute path outside the project without such a
|
|
5
|
+
// line pauses the run at its first touch of that path, so the Stop gate points it out once while the planner
|
|
6
|
+
// can still add the line. Only todo rows and their indented continuation count; fenced code and inline code
|
|
7
|
+
// that holds a command are examples, not targets. `/` and the bare home folder never cover anything.
|
|
8
|
+
import { posix } from "node:path";
|
|
9
|
+
const FENCE = /^\s*(?:```|~~~)/u;
|
|
10
|
+
const TODO_ROW = /^- \[[ xX]\] /u;
|
|
11
|
+
const SCOPE_LINE = /^Scope roots:\s+(\S+)\s+\([^)]*\)\s*$/u;
|
|
12
|
+
const PATH = /(?<![\w:/.~-])(~?\/[A-Za-z0-9._~@%+/-]+)/gu;
|
|
13
|
+
const TRAILING = /[.,;:]+$/u;
|
|
14
|
+
function expand(path, home) {
|
|
15
|
+
return posix.normalize(path.startsWith("~/") ? `${home}${path.slice(1)}` : path).replace(/(.)\/$/u, "$1");
|
|
16
|
+
}
|
|
17
|
+
/** Plan text names POSIX paths whatever the host, so the comparison stays POSIX too. */
|
|
18
|
+
function inside(path, dir) {
|
|
19
|
+
const rel = posix.relative(dir, path);
|
|
20
|
+
return rel === "" || (!rel.startsWith("..") && !posix.isAbsolute(rel));
|
|
21
|
+
}
|
|
22
|
+
/** Inline code that is a bare path stays as the path; one that holds a command is dropped. */
|
|
23
|
+
function withoutCommands(line) {
|
|
24
|
+
return line.replace(/`([^`]*)`/gu, (_whole, body) => (/\s/u.test(body.trim()) ? " " : ` ${body} `));
|
|
25
|
+
}
|
|
26
|
+
/** Lines outside fenced code, each tagged with whether it belongs to a todo row. */
|
|
27
|
+
function proseLines(text) {
|
|
28
|
+
const out = [];
|
|
29
|
+
let fenced = false;
|
|
30
|
+
let todo = false;
|
|
31
|
+
for (const line of text.split(/\r?\n/u)) {
|
|
32
|
+
if (FENCE.test(line)) {
|
|
33
|
+
fenced = !fenced;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (fenced)
|
|
37
|
+
continue;
|
|
38
|
+
if (TODO_ROW.test(line))
|
|
39
|
+
todo = true;
|
|
40
|
+
else if (line.trim() !== "" && !/^\s/u.test(line))
|
|
41
|
+
todo = false;
|
|
42
|
+
out.push({ line, todo });
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Absolute paths the plan's todos name outside `projectRoot` that no `Scope roots:` line covers, in order of
|
|
48
|
+
* first mention. Empty when the plan is covered.
|
|
49
|
+
*/
|
|
50
|
+
export function scopeRootGaps(text, projectRoot, home) {
|
|
51
|
+
const lines = proseLines(text);
|
|
52
|
+
const homeDir = expand(home, home);
|
|
53
|
+
const roots = lines
|
|
54
|
+
.map(({ line }) => SCOPE_LINE.exec(line)?.[1])
|
|
55
|
+
.filter((root) => root !== undefined)
|
|
56
|
+
.map((root) => expand(root, home))
|
|
57
|
+
.filter((root) => root !== "/" && root !== homeDir);
|
|
58
|
+
const gaps = [];
|
|
59
|
+
for (const { line, todo } of lines) {
|
|
60
|
+
if (!todo)
|
|
61
|
+
continue;
|
|
62
|
+
for (const match of withoutCommands(line).matchAll(PATH)) {
|
|
63
|
+
const path = expand((match[1] ?? "").replace(TRAILING, ""), home);
|
|
64
|
+
if (path.length < 2 || inside(path, projectRoot))
|
|
65
|
+
continue;
|
|
66
|
+
if (roots.some((root) => inside(path, root)) || gaps.includes(path))
|
|
67
|
+
continue;
|
|
68
|
+
gaps.push(path);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return gaps;
|
|
72
|
+
}
|
|
73
|
+
/** The line a planner pastes to declare `path`; read access is the default to widen deliberately. */
|
|
74
|
+
export function scopeRootLine(path) {
|
|
75
|
+
return `Scope roots: ${path} (read)`;
|
|
76
|
+
}
|
|
@@ -34,10 +34,28 @@ const AUTH_HEADER_SECRET = /\b((?:(?:Proxy-Authorization|Authorization)[ \t]*:[
|
|
|
34
34
|
// dashboard" is ordinary prose, so the payload must look like a credential.
|
|
35
35
|
const BARE_AUTH_SCHEME_SECRET = new RegExp(`\\b((?:Bearer|Basic)[ \t]+)(${PROSE_VALUE}[^\\s"'\`]+)`, "giu");
|
|
36
36
|
const GENERIC_AUTH_HEADER_SECRET = /\b((?:Proxy-Authorization|Authorization)[ \t]*:[ \t]*)([^\r\n]*\S[^\r\n]*)(?=\r?$)/gimu;
|
|
37
|
+
// JSON and quoted maps close the key's quote before the colon (`"api_token": "..."`), which the `key: value`
|
|
38
|
+
// rules above cannot see. The value is a quoted string (escapes allowed) or a bare scalar.
|
|
39
|
+
const JSON_VALUE = String.raw `("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s,}\]"']+)`;
|
|
40
|
+
const JSON_HIGH_SIGNAL_KEY_VALUE_SECRET = new RegExp(String.raw `(["'][A-Za-z0-9_-]*?(?:api[_-]?key|api[_-]?token|access[_-]?token|auth[_-]?token|client[_-]?secret|credentials?|passphrase|passwd|password|private[_-]?key|refresh[_-]?token|secret[_-]?key|authorization)(?:[_-][A-Za-z0-9_-]*)?["']\s*:\s*)${JSON_VALUE}`, "giu");
|
|
41
|
+
// `auth`, `secret` and `token` are also everyday words: a quoted value with spaces is prose and stays.
|
|
42
|
+
const JSON_AMBIGUOUS_KEY_VALUE_SECRET = new RegExp(String.raw `(["'][A-Za-z0-9_-]*?(?:auth|secret|token)(?:[_-][A-Za-z0-9_-]*)?["']\s*:\s*)${JSON_VALUE}`, "giu");
|
|
37
43
|
const URI_USERINFO = /((?:[a-z][a-z0-9+.-]*:\/\/|\/\/))[^/?#\s]*@/giu;
|
|
38
44
|
const PRIVATE_KEY_SECRET = /-----BEGIN [A-Z0-9 ]*PRIVATE KEY(?: BLOCK)?-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY(?: BLOCK)?-----/giu;
|
|
39
45
|
const PRIVATE_KEY_MARKER_SECRET = /-----(?:BEGIN|END) [A-Z0-9 ]*PRIVATE KEY(?: BLOCK)?-----/giu;
|
|
46
|
+
const redactedJsonValue = (value) => {
|
|
47
|
+
const quote = value[0];
|
|
48
|
+
return quote === '"' || quote === "'" ? `${quote}${REDACTED_SECRET}${quote}` : REDACTED_SECRET;
|
|
49
|
+
};
|
|
40
50
|
const REDACTION_RULES = Object.freeze([
|
|
51
|
+
{
|
|
52
|
+
pattern: JSON_HIGH_SIGNAL_KEY_VALUE_SECRET,
|
|
53
|
+
replacement: (match) => `${match[1] ?? ""}${redactedJsonValue(match[2] ?? "")}`,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
pattern: JSON_AMBIGUOUS_KEY_VALUE_SECRET,
|
|
57
|
+
replacement: (match) => /\s/u.test(match[2] ?? "") ? match[0] : `${match[1] ?? ""}${redactedJsonValue(match[2] ?? "")}`,
|
|
58
|
+
},
|
|
41
59
|
{ pattern: URI_USERINFO, replacement: (match) => match[1] ?? "" },
|
|
42
60
|
{ pattern: PRIVATE_KEY_SECRET, replacement: () => REDACTED_SECRET },
|
|
43
61
|
{ pattern: PRIVATE_KEY_MARKER_SECRET, replacement: () => REDACTED_SECRET },
|
|
@@ -10,6 +10,15 @@ export interface ReentryContext {
|
|
|
10
10
|
readonly active: string | null;
|
|
11
11
|
/** Approved or running work a bare `lit` should resume; null when there is none. */
|
|
12
12
|
readonly resume: ResumeWork | null;
|
|
13
|
+
/** The paused spine a `lit continue` brings back, with the stage and count it left; absent when none. */
|
|
14
|
+
readonly frame?: ResumedFrame | null;
|
|
15
|
+
}
|
|
16
|
+
/** A paused frame of the workflow stack, as `lit continue` names it to the model. */
|
|
17
|
+
export interface ResumedFrame {
|
|
18
|
+
readonly skill: string;
|
|
19
|
+
readonly stage: string | null;
|
|
20
|
+
readonly n?: number;
|
|
21
|
+
readonly total?: number;
|
|
13
22
|
}
|
|
14
23
|
export declare const NO_REENTRY: ReentryContext;
|
|
15
24
|
export type Entry = {
|
|
@@ -19,11 +28,13 @@ export type Entry = {
|
|
|
19
28
|
readonly kind: "continue";
|
|
20
29
|
readonly confirm: boolean;
|
|
21
30
|
readonly route: LitMode;
|
|
31
|
+
readonly frame?: ResumedFrame;
|
|
22
32
|
} | {
|
|
23
33
|
readonly kind: "resume";
|
|
24
34
|
readonly work: ResumeWork;
|
|
25
35
|
readonly active: boolean;
|
|
26
36
|
readonly route: LitMode;
|
|
37
|
+
readonly frame?: ResumedFrame;
|
|
27
38
|
};
|
|
28
39
|
/** The route this session last sent an activation for, or null when nothing readable is saved. */
|
|
29
40
|
export declare function readActiveRoute(cwd: string, sessionId: string): string | null;
|
|
@@ -37,8 +48,12 @@ export declare function clearActiveRoute(cwd: string, sessionId: string): void;
|
|
|
37
48
|
* or lit-loop goals that are not all complete. A finished plan resumes nothing.
|
|
38
49
|
*/
|
|
39
50
|
export declare function readResumeWork(cwd: string, sessionId: string): ResumeWork | null;
|
|
51
|
+
/** True for exactly `lit continue`: the way back from a side discipline to the work it paused. */
|
|
52
|
+
export declare function isLitContinue(prompt: string): boolean;
|
|
40
53
|
/** True for a bare `lit` or `lit continue`: the prompt carries no task and no route of its own. */
|
|
41
54
|
export declare function isBareLit(prompt: string): boolean;
|
|
55
|
+
/** True for `lit new …` or `lit restart …`: the work starts again instead of continuing. */
|
|
56
|
+
export declare function isRestartPrompt(prompt: string): boolean;
|
|
42
57
|
/**
|
|
43
58
|
* How a matched lit-family route enters. start-work always gets its full activation: its prompt carries
|
|
44
59
|
* the write grant. `lit new …` and `lit restart …` start again. A bare `lit` or `lit continue` carries on
|