@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
|
@@ -2,38 +2,76 @@
|
|
|
2
2
|
// master capture never has its styles touched. At each QA sample (every beat midpoint plus two
|
|
3
3
|
// settled frames per beat) it captures A, hides all text ink, captures B, and restores. The ink
|
|
4
4
|
// mask is where A and B differ inside a run's rects; contrast then uses the Wave 1 measurement.
|
|
5
|
-
// Copy runs are held to contrast, title-safe and reading time; decor runs only warn on contrast.
|
|
5
|
+
// Copy runs are held to contrast, title-safe and reading time; decor runs only warn on contrast. A
|
|
6
|
+
// film that names a house style is also held to it: text over text (also across the cuts), copy off
|
|
7
|
+
// the style's colours, faces or type scale, copy outside its shot's type zone, and a rich film's
|
|
8
|
+
// regions left empty. `boardQA` runs the style rules alone at the beat midpoints and the cuts.
|
|
6
9
|
import { readFileSync } from "node:fs";
|
|
7
10
|
import { join } from "node:path";
|
|
8
11
|
import { measureContrast } from "./gate.mjs";
|
|
9
12
|
import { SKILL_ROOT } from "./fonts.mjs";
|
|
10
|
-
import { linearOf } from "./image.mjs";
|
|
13
|
+
import { linearOf, regionFill } from "./image.mjs";
|
|
11
14
|
import { capture, stepFrame } from "./stage.mjs";
|
|
15
|
+
import { LAYOUTS, ZONE_TOLERANCE, readStyle, scaleStep, styleAccents, styleFamilies, styleTextColors } from "./styles.mjs";
|
|
12
16
|
import { normalizeText, stripQuoted } from "./treatment.mjs";
|
|
13
17
|
import { readingFloor } from "./type.mjs";
|
|
14
18
|
|
|
15
|
-
const QA = Object.freeze({
|
|
19
|
+
const QA = Object.freeze({
|
|
20
|
+
inkDelta: 2,
|
|
21
|
+
minInk: 12,
|
|
22
|
+
visibleOpacity: 0.6,
|
|
23
|
+
settledOpacity: 0.95,
|
|
24
|
+
settledMovePx: 2,
|
|
25
|
+
probeFps: 10,
|
|
26
|
+
readingTolerance: 0.1,
|
|
27
|
+
decorShare: 0.25,
|
|
28
|
+
decorShareRich: 0.6,
|
|
29
|
+
presenceStd: 8 / 255,
|
|
30
|
+
largeShare: 0.03,
|
|
31
|
+
overlapShare: 0.08,
|
|
32
|
+
colourDistance: 12,
|
|
33
|
+
cutWindowSec: 0.4,
|
|
34
|
+
cutStep: 2,
|
|
35
|
+
emptyRegion: 0.15,
|
|
36
|
+
emptyRegionsMax: 2,
|
|
37
|
+
});
|
|
38
|
+
// The rules boardQA returns: the ones the board round can judge from midpoints and cut frames alone.
|
|
39
|
+
export const BOARD_RULES = Object.freeze(["TEXT-OVERLAP", "TEXT-ON-STYLE", "TEXT-ZONE"]);
|
|
16
40
|
// Internal family names start with the product family (Archivo Condensed Black, Pretendard Bold,
|
|
17
41
|
// Galmuri9 Regular), so a face matches by normalized prefix.
|
|
18
|
-
const PRODUCT_PREFIXES = ["archivo", "pretendard", "vt323", "galmuri9", "meslolgsnf"];
|
|
42
|
+
const PRODUCT_PREFIXES = ["archivo", "pretendard", "vt323", "galmuri9", "meslolgsnf", "jetbrainsmono"];
|
|
19
43
|
export const isProductFamily = (name) => PRODUCT_PREFIXES.some((prefix) => normalizeText(name).startsWith(prefix));
|
|
20
44
|
const INTERNAL_TERM = /\b(?:path|preset|gate|beat|treatment)\b/iu;
|
|
21
45
|
const FILE_NAME = /\b[\w-]+\.(?:html|json|js|mjs|css|png|svg|jpe?g|webp|wav|mp4)\b/iu;
|
|
22
46
|
|
|
23
47
|
export const qaScript = () => readFileSync(join(SKILL_ROOT, "engine", "stage-qa.js"), "utf8");
|
|
24
48
|
|
|
25
|
-
/**
|
|
26
|
-
|
|
49
|
+
/**
|
|
50
|
+
* QA sample frames: each beat's midpoint (for fonts and presence) and two settled frames; with
|
|
51
|
+
* `cuts`, also every second frame within 0.4 s of each cut (kind "cut"), where an outgoing and an
|
|
52
|
+
* incoming line can cross. A board round (`board`) skips the settled frames: the midpoints and the
|
|
53
|
+
* cut neighbours are what a stills-only look shows.
|
|
54
|
+
*/
|
|
55
|
+
export function qaSamples(treatment, fps, frameCount, { cuts = false, board = false } = {}) {
|
|
27
56
|
const clamp = (f) => Math.max(0, Math.min(frameCount - 1, f));
|
|
28
57
|
const samples = new Map();
|
|
29
58
|
treatment.beats.forEach((beat, i) => {
|
|
30
59
|
const span = beat.t1 - beat.t0;
|
|
31
60
|
samples.set(clamp(Math.round(((beat.t0 + beat.t1) / 2) * fps)), { beat: i, kind: "mid" });
|
|
61
|
+
if (board) return;
|
|
32
62
|
for (const at of [0.75, 0.9]) {
|
|
33
63
|
const f = clamp(Math.round((beat.t0 + at * span) * fps));
|
|
34
64
|
if (!samples.has(f)) samples.set(f, { beat: i, kind: "settled" });
|
|
35
65
|
}
|
|
36
66
|
});
|
|
67
|
+
if (cuts) {
|
|
68
|
+
const reach = Math.round(QA.cutWindowSec * fps);
|
|
69
|
+
treatment.beats.forEach((beat, i) => {
|
|
70
|
+
if (i === 0) return;
|
|
71
|
+
const at = Math.round(beat.t0 * fps);
|
|
72
|
+
for (let f = clamp(at - reach); f <= clamp(at + reach); f += QA.cutStep) if (!samples.has(f)) samples.set(f, { beat: f < at ? i - 1 : i, kind: "cut" });
|
|
73
|
+
});
|
|
74
|
+
}
|
|
37
75
|
return samples;
|
|
38
76
|
}
|
|
39
77
|
|
|
@@ -72,8 +110,8 @@ function inkIn(map, width, rect) {
|
|
|
72
110
|
* Replay the clock in the QA session and collect everything the text rules need. Returns the raw
|
|
73
111
|
* observations; `qaRules` turns them into gate rules.
|
|
74
112
|
*/
|
|
75
|
-
export async function collectQA({ session, treatment, fps, frameCount, width, height, pool }) {
|
|
76
|
-
const samples = qaSamples(treatment, fps, frameCount);
|
|
113
|
+
export async function collectQA({ session, treatment, fps, frameCount, width, height, pool, board = false }) {
|
|
114
|
+
const samples = qaSamples(treatment, fps, frameCount, { cuts: Boolean(treatment.style), board });
|
|
77
115
|
const probeEvery = Math.max(1, Math.round(fps / QA.probeFps));
|
|
78
116
|
const neighbours = new Set();
|
|
79
117
|
for (const f of samples.keys()) for (const d of [-2, 2]) neighbours.add(Math.max(0, Math.min(frameCount - 1, f + d)));
|
|
@@ -117,11 +155,110 @@ export async function collectQA({ session, treatment, fps, frameCount, width, he
|
|
|
117
155
|
}
|
|
118
156
|
}
|
|
119
157
|
const [a, b] = await Promise.all([pool.decode(pngA), pool.decode(pngB)]);
|
|
158
|
+
if (sample.kind === "cut") {
|
|
159
|
+
// Dozens of these per film: keep each run's ink count, not the two frames.
|
|
160
|
+
const map = inkMap(a.rgba, b.rgba, width, height);
|
|
161
|
+
observed.push({ frame: f, ...sample, state, inks: state.runs.map((run) => run.rects.reduce((sum, r) => sum + inkIn(map, width, r).count, 0)) });
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
120
164
|
observed.push({ frame: f, ...sample, state, a: a.rgba, b: b.rgba, fonts });
|
|
121
165
|
}
|
|
122
166
|
return { samples, track, positions, observed, probeEvery };
|
|
123
167
|
}
|
|
124
168
|
|
|
169
|
+
const area = (r) => Math.max(0, r[2] - r[0]) * Math.max(0, r[3] - r[1]);
|
|
170
|
+
const overlapArea = (a, b) => area([Math.max(a[0], b[0]), Math.max(a[1], b[1]), Math.min(a[2], b[2]), Math.min(a[3], b[3])]);
|
|
171
|
+
const totalArea = (rects) => rects.reduce((sum, r) => sum + area(r), 0);
|
|
172
|
+
|
|
173
|
+
/** [r, g, b] of a CSS colour string (rgb(), rgba() or #hex), or null. */
|
|
174
|
+
export function parseCssColour(value) {
|
|
175
|
+
const text = String(value ?? "").trim();
|
|
176
|
+
const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/u.exec(text);
|
|
177
|
+
if (rgb) return [Number(rgb[1]), Number(rgb[2]), Number(rgb[3])];
|
|
178
|
+
const hex = /^#([0-9a-f]{6})$/iu.exec(text);
|
|
179
|
+
return hex ? [0, 2, 4].map((i) => Number.parseInt(hex[1].slice(i, i + 2), 16)) : null;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* TEXT-OVERLAP: pairs of visible, non-decor text runs whose rects cover more than 8 % of the smaller
|
|
184
|
+
* run. `visible` is [{ run, count }] (run with rects and text, count its ink pixels). A decor run and
|
|
185
|
+
* a pseudo-element run (which reports its element's box) never count.
|
|
186
|
+
*/
|
|
187
|
+
export function overlapFaults(visible, frame, cut = false) {
|
|
188
|
+
const real = visible.filter(({ run }) => !run.decor && !run.pseudo && run.rects.length);
|
|
189
|
+
const faults = [];
|
|
190
|
+
for (let i = 0; i < real.length; i++)
|
|
191
|
+
for (let j = i + 1; j < real.length; j++) {
|
|
192
|
+
const [a, b] = [real[i].run, real[j].run];
|
|
193
|
+
let shared = 0;
|
|
194
|
+
for (const ra of a.rects) for (const rb of b.rects) shared += overlapArea(ra, rb);
|
|
195
|
+
if (shared > QA.overlapShare * Math.min(totalArea(a.rects), totalArea(b.rects))) faults.push(`${quote(a.text)} x ${quote(b.text)}@${frame}${cut ? " (cut)" : ""}`);
|
|
196
|
+
}
|
|
197
|
+
return faults;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* TEXT-ON-STYLE and TEXT-ZONE for one settled run against the film's house style. `isCopy` runs are
|
|
202
|
+
* held to the style's colours and faces and to their shot's type zone; every run to the type scale.
|
|
203
|
+
* Returns [{ kind: "colour" | "face" | "scale" | "scaleOther" | "zone", text }].
|
|
204
|
+
*/
|
|
205
|
+
export function styleFaults({ style, rich, format, width, height, layout, run, box, isCopy, frame }) {
|
|
206
|
+
const faults = [];
|
|
207
|
+
const where = `${quote(run.text)}@${frame}`;
|
|
208
|
+
if (isCopy) {
|
|
209
|
+
const rgb = parseCssColour(run.color);
|
|
210
|
+
const allowed = [...styleTextColors(style), ...(rich ? styleAccents(style).map((a) => a.color.toLowerCase()) : [])].map(parseCssColour);
|
|
211
|
+
if (!run.gradient && rgb && !allowed.some((c) => Math.hypot(c[0] - rgb[0], c[1] - rgb[1], c[2] - rgb[2]) <= QA.colourDistance)) faults.push({ kind: "colour", text: `${where} ${run.color}` });
|
|
212
|
+
if (run.family && !styleFamilies(style).has(run.family)) faults.push({ kind: "face", text: `${where} ${run.family}` });
|
|
213
|
+
}
|
|
214
|
+
if (!scaleStep(style, format, run.fontSizePx)) faults.push({ kind: isCopy ? "scale" : "scaleOther", text: `${where} ${Math.round(run.fontSizePx * 10) / 10}px` });
|
|
215
|
+
const zone = isCopy && layout ? LAYOUTS[format][layout]?.type : undefined;
|
|
216
|
+
if (isCopy && layout && zone === null) faults.push({ kind: "zone", text: `${where} in a full shot (no copy zone)` });
|
|
217
|
+
else if (zone) {
|
|
218
|
+
const [zx, zy, zw, zh] = [zone[0] * width, zone[1] * height, zone[2] * width, zone[3] * height];
|
|
219
|
+
const [tx, ty] = [width * ZONE_TOLERANCE, height * ZONE_TOLERANCE];
|
|
220
|
+
if (box[0] < zx - tx || box[1] < zy - ty || box[2] > zx + zw + tx || box[3] > zy + zh + ty) faults.push({ kind: "zone", text: `${where} outside the ${layout} type zone` });
|
|
221
|
+
}
|
|
222
|
+
return faults;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** The three house-style gate rules from the collected findings (see overlapFaults, styleFaults). */
|
|
226
|
+
export function styleRules({ style, format, found, crossed }) {
|
|
227
|
+
const list = (items, n = 4) => [...new Set(items)].slice(0, n).join("; ");
|
|
228
|
+
const steps = Object.entries(style.scale[format]).map(([k, v]) => `${k} ${v}`).join(", ");
|
|
229
|
+
const fails = [
|
|
230
|
+
found.colour.length ? `colour off the ${style.id} text roles (${style.textRoles.join(", ")}): ${list(found.colour, 3)}` : null,
|
|
231
|
+
found.face.length ? `face outside the style (${[...styleFamilies(style)].join(", ")}): ${list(found.face, 3)}` : null,
|
|
232
|
+
found.scale.length ? `size off the type scale (${steps} px, +-4 %): ${list(found.scale, 3)}` : null,
|
|
233
|
+
].filter(Boolean);
|
|
234
|
+
const rule = (id, name, status, detail) => ({ id, name, status, detail });
|
|
235
|
+
return [
|
|
236
|
+
found.overlap.length
|
|
237
|
+
? rule("TEXT-OVERLAP", "no text over text", "FAIL", `text over text: ${list(found.overlap)}`)
|
|
238
|
+
: rule("TEXT-OVERLAP", "no text over text", "PASS", `no two visible text runs overlap at the QA samples${crossed ? " or across the cuts" : ""}`),
|
|
239
|
+
fails.length
|
|
240
|
+
? rule("TEXT-ON-STYLE", "copy on the house style", "FAIL", fails.join("; "))
|
|
241
|
+
: found.scaleOther.length
|
|
242
|
+
? rule("TEXT-ON-STYLE", "copy on the house style", "WARN", `copy is on the ${style.id} style; other text off the scale: ${list(found.scaleOther, 3)}`)
|
|
243
|
+
: rule("TEXT-ON-STYLE", "copy on the house style", "PASS", `copy uses the ${style.id} colours, faces and type scale`),
|
|
244
|
+
found.zone.length ? rule("TEXT-ZONE", "copy inside its shot's type zone", "FAIL", list(found.zone)) : rule("TEXT-ZONE", "copy inside its shot's type zone", "PASS", "every settled copy run sits in its shot's type zone"),
|
|
245
|
+
];
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* RICH-FILL: a rich film fills its frame. At each beat midpoint at most two of the 12 regions may sit
|
|
250
|
+
* empty (busy share under 0.15); the end card may breathe, so one beat may miss. A minimal film keeps
|
|
251
|
+
* its negative space. `fills` is [{ beat, regions }].
|
|
252
|
+
*/
|
|
253
|
+
export function richFillRule(register, fills) {
|
|
254
|
+
const rule = (status, detail) => ({ id: "RICH-FILL", name: "a rich film fills the frame", status, detail });
|
|
255
|
+
if (register !== "rich") return rule("N/A", "minimal register: negative space is the point");
|
|
256
|
+
if (!fills.length) return rule("N/A", "region fill not measured");
|
|
257
|
+
const thin = fills.map(({ beat, regions }) => ({ beat, empty: regions.filter((v) => v < QA.emptyRegion).length })).filter((x) => x.empty > QA.emptyRegionsMax);
|
|
258
|
+
if (thin.length <= 1) return rule("PASS", `${fills.length - thin.length} of ${fills.length} beat midpoints fill the frame (at most ${QA.emptyRegionsMax} of 12 regions empty)`);
|
|
259
|
+
return rule("FAIL", `${thin.length} of ${fills.length} beat midpoints leave the frame empty: ${thin.map((x) => `beat ${x.beat + 1} has ${x.empty} of 12 regions empty`).join(", ")}; fill them with the world's parts: labelled panels, counters, a log, the product's own screens`);
|
|
260
|
+
}
|
|
261
|
+
|
|
125
262
|
/** Gate rules from the QA observations (director brief 6g checks and severities). */
|
|
126
263
|
export function qaRules({ treatment, width, height, fps, collected }) {
|
|
127
264
|
const lines = treatment.copy.lines.map(normalizeText);
|
|
@@ -129,6 +266,16 @@ export function qaRules({ treatment, width, height, fps, collected }) {
|
|
|
129
266
|
const safeText = `[${safe[0]},${safe[1]}]-[${safe[2]},${safe[3]}]`;
|
|
130
267
|
const largePx = QA.largeShare * Math.min(width, height);
|
|
131
268
|
const faults = { contrast: [], contrastWarn: [], safe: [], decor: [], decorShare: [], meta: new Set(), unlisted: new Set(), fonts: [], fontsWarn: [], state: [], canvas: new Set() };
|
|
269
|
+
const style = treatment.style ? readStyle(treatment.style) : null;
|
|
270
|
+
const format = width >= height ? "16:9" : "9:16";
|
|
271
|
+
const rich = treatment.register === "rich";
|
|
272
|
+
const findings = { overlap: [], colour: [], face: [], scale: [], scaleOther: [], zone: [] };
|
|
273
|
+
const perBeat = treatment.beats.map((beat, i) => ({ beat: i, layout: beat.layout ?? null, overlap: [], style: [], zone: [] }));
|
|
274
|
+
const fills = [];
|
|
275
|
+
const note = (beat, kind, text) => {
|
|
276
|
+
findings[kind].push(text);
|
|
277
|
+
perBeat[beat]?.[kind === "overlap" || kind === "zone" ? kind : "style"].push(text);
|
|
278
|
+
};
|
|
132
279
|
const found = new Set();
|
|
133
280
|
const request = normalizeText(treatment.request);
|
|
134
281
|
const requestBare = normalizeText(stripQuoted(treatment.request));
|
|
@@ -136,7 +283,12 @@ export function qaRules({ treatment, width, height, fps, collected }) {
|
|
|
136
283
|
let measured = 0;
|
|
137
284
|
let presence = 0;
|
|
138
285
|
let mids = 0;
|
|
139
|
-
|
|
286
|
+
// Cut samples carry only each run's ink count; they feed the text-over-text rule and nothing else.
|
|
287
|
+
for (const sample of collected.observed.filter((o) => o.kind === "cut")) {
|
|
288
|
+
const visible = sample.state.runs.map((run, i) => ({ run, count: sample.inks[i] })).filter(({ run, count }) => run.opacity >= QA.visibleOpacity && count >= QA.minInk);
|
|
289
|
+
for (const text of overlapFaults(visible, sample.frame, true)) note(sample.beat, "overlap", text);
|
|
290
|
+
}
|
|
291
|
+
for (const sample of collected.observed.filter((o) => o.kind !== "cut")) {
|
|
140
292
|
const { state, a, b, frame } = sample;
|
|
141
293
|
const map = inkMap(a, b, width, height);
|
|
142
294
|
const runs = state.runs.map((run) => ({ ...run, ...classify(run, lines) }));
|
|
@@ -158,6 +310,7 @@ export function qaRules({ treatment, width, height, fps, collected }) {
|
|
|
158
310
|
n++;
|
|
159
311
|
}
|
|
160
312
|
if (n && Math.sqrt(Math.max(0, sq / n - (sum / n) ** 2)) > QA.presenceStd) presence++;
|
|
313
|
+
if (rich) fills.push({ beat: sample.beat, regions: regionFill(a, width, height) });
|
|
161
314
|
}
|
|
162
315
|
const visibleText = [];
|
|
163
316
|
for (const run of runs) {
|
|
@@ -172,9 +325,10 @@ export function qaRules({ treatment, width, height, fps, collected }) {
|
|
|
172
325
|
if (run.isCopy && ink.box && (ink.box[0] < safe[0] || ink.box[1] < safe[1] || ink.box[2] > safe[2] || ink.box[3] > safe[3])) faults.safe.push(`${quote(run.text)}@${frame}`);
|
|
173
326
|
if (!run.decor && !run.isCopy) faults.unlisted.add(quote(run.text));
|
|
174
327
|
}
|
|
328
|
+
if (style) for (const text of overlapFaults(visibleText.map((v) => ({ run: v.run, count: v.ink.count })), frame)) note(sample.beat, "overlap", text);
|
|
175
329
|
const textInk = visibleText.reduce((sum, v) => sum + v.ink.count, 0);
|
|
176
330
|
const decorInk = visibleText.filter((v) => v.run.decor).reduce((sum, v) => sum + v.ink.count, 0);
|
|
177
|
-
if (textInk > 0 && decorInk / textInk > QA.decorShare) faults.decorShare.push(`${Math.round((decorInk / textInk) * 100)}% decor at frame ${frame}`);
|
|
331
|
+
if (textInk > 0 && decorInk / textInk > (rich ? QA.decorShareRich : QA.decorShare)) faults.decorShare.push(`${Math.round((decorInk / textInk) * 100)}% decor at frame ${frame}`);
|
|
178
332
|
const reading = [...runs.filter((r) => r.opacity >= QA.visibleOpacity && r.rects.length).map((r) => ({ y: r.rects[0][1], x: r.rects[0][0], text: r.norm })), ...state.registered.map((t) => ({ y: t.y, x: t.x, text: normalizeText(t.content) }))].sort((p, q) => p.y - q.y || p.x - q.x);
|
|
179
333
|
const joined = reading.map((r) => r.text).join("");
|
|
180
334
|
for (const line of lines) if (joined.includes(line) || reading.some((r) => r.text === line)) found.add(line);
|
|
@@ -198,6 +352,7 @@ export function qaRules({ treatment, width, height, fps, collected }) {
|
|
|
198
352
|
return !other || Math.max(...own.map((v, i) => Math.abs(v - other.box[i]))) >= QA.settledMovePx;
|
|
199
353
|
});
|
|
200
354
|
if (moved) continue;
|
|
355
|
+
if (style && !run.pseudo) for (const fault of styleFaults({ style, rich, format, width, height, layout: treatment.beats[sample.beat]?.layout, run, box: ink.box, isCopy: run.isCopy, frame })) note(sample.beat, fault.kind, fault.text);
|
|
201
356
|
const runMask = new Uint8Array(width * height);
|
|
202
357
|
for (const r of run.rects) for (let y = Math.max(0, Math.floor(r[1])); y < Math.min(height, Math.ceil(r[3])); y++) for (let x = Math.max(0, Math.floor(r[0])); x < Math.min(width, Math.ceil(r[2])); x++) if (map[y * width + x]) runMask[y * width + x] = 255;
|
|
203
358
|
const result = measureContrast({ bbox: ink.box, capHeightPx: run.fontSizePx, fill: run.gradient ? "gradient" : "solid", fontSizePx: run.fontSizePx, weight: run.weight }, { width, height, rgba: a, mask: runMask }, { scale: 1, largeFontPx: largePx });
|
|
@@ -231,13 +386,27 @@ export function qaRules({ treatment, width, height, fps, collected }) {
|
|
|
231
386
|
rule("QA-TITLE-SAFE", "copy inside title-safe", faults.safe.length ? "FAIL" : "PASS", `${faults.safe.length ? `${list(faults.safe)} outside ` : "every copy run inside "}${safeText}`),
|
|
232
387
|
rule("QA-READING", "copy reading floor", readingFaults.length ? "FAIL" : "PASS", readingFaults.length ? list(readingFaults) : `every copy run holds its reading floor (measured at ${QA.probeFps} fps)`),
|
|
233
388
|
rule("QA-COPY", "every copy line on screen", missing.length ? "FAIL" : "PASS", missing.length ? `never on screen: ${missing.map(quote).join(", ")}` : `${lines.length} copy line(s) found`),
|
|
234
|
-
rule("QA-DECOR",
|
|
389
|
+
rule("QA-DECOR", `decor text carries no copy, at most ${rich ? 60 : 25}% of text`, faults.decor.length || faults.decorShare.length ? "FAIL" : "PASS", faults.decor.length ? `decor run carries copy: ${list(faults.decor)}` : faults.decorShare.length ? list(faults.decorShare) : "decor text stays decor"),
|
|
235
390
|
rule("QA-META", "no request, idea, file name or internal term on screen", faults.meta.size ? "WARN" : "PASS", faults.meta.size ? `${list([...faults.meta])}; the look must answer it` : "no meta labels"),
|
|
236
391
|
rule("QA-UNLISTED", "text on screen is copy or decor", faults.unlisted.size ? "WARN" : "PASS", faults.unlisted.size ? `neither in copy.lines nor marked decor: ${list([...faults.unlisted])}; list it as copy or mark it decor` : "every visible run is copy or decor"),
|
|
237
392
|
rule("QA-FONTS", "only the product's faces", faults.fonts.length ? "FAIL" : faults.fontsWarn.length ? "WARN" : "PASS", faults.fonts.length ? list(faults.fonts) : faults.fontsWarn.length ? list(faults.fontsWarn) : "every sampled run renders in a product face"),
|
|
238
393
|
rule("QA-CANVAS", "canvas text", faults.canvas.size ? "WARN" : "PASS", faults.canvas.size ? `${[...faults.canvas].join("; ")}; the look must answer it` : "no unmeasured canvas text"),
|
|
239
394
|
rule("QA-STATE", "stable state while text is hidden", faults.state.length ? "WARN" : "PASS", faults.state.length ? `${list(faults.state, 2)} (samples discarded)` : "no state moved"),
|
|
240
395
|
rule("QA-PRESENCE", "something besides text on screen", mids && presence * 2 >= mids ? "PASS" : "WARN", `${presence} of ${mids} beat midpoints show non-text detail`),
|
|
396
|
+
...(style ? styleRules({ style, format, found: findings, crossed: collected.observed.some((o) => o.kind === "cut") }) : []),
|
|
397
|
+
...(treatment.register ? [richFillRule(treatment.register, fills)] : []),
|
|
241
398
|
],
|
|
399
|
+
perBeat,
|
|
242
400
|
};
|
|
243
401
|
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* The board round's text check (stills only, before any encode): replays the clock in `session`,
|
|
405
|
+
* samples the beat midpoints and the frames around every cut, and returns the three house-style rules
|
|
406
|
+
* with the findings per shot. No dead-air or fill rule: those need the whole film.
|
|
407
|
+
*/
|
|
408
|
+
export async function boardQA({ session, treatment, fps, frameCount, width, height, pool }) {
|
|
409
|
+
const collected = await collectQA({ session, treatment, fps, frameCount, width, height, pool, board: true });
|
|
410
|
+
const { rules, perBeat } = qaRules({ treatment, width, height, fps, collected });
|
|
411
|
+
return { rules: rules.filter((r) => BOARD_RULES.includes(r.id)), perBeat };
|
|
412
|
+
}
|
|
@@ -13,10 +13,13 @@ import { FONTS, verifyFonts } from "./fonts.mjs";
|
|
|
13
13
|
import { contactSheet, decodePng, downscale, encodePng } from "./image.mjs";
|
|
14
14
|
import { viewedFor } from "./look.mjs";
|
|
15
15
|
import { ffmpegProbe, firstLine, resolveRuntime, stageFlags } from "./runtime.mjs";
|
|
16
|
-
import { assertClean, capture, closeStage, DecodePool, fontRoutes,
|
|
16
|
+
import { assertClean, capture, closeStage, DecodePool, fontRoutes, openStageChecked, scanStage, stageFontFaults, stageRung, stageStyle, stepFrame } from "./stage.mjs";
|
|
17
17
|
import { evaluateStage, loadStageData, renderStageReport, stagePassed } from "./stage-gate.mjs";
|
|
18
18
|
import { prepareTrack, soundFailed } from "./sound.mjs";
|
|
19
|
-
import {
|
|
19
|
+
import { assetUsed } from "./assets.mjs";
|
|
20
|
+
import { writeBoard } from "./board.mjs";
|
|
21
|
+
import { recordHouse } from "./house.mjs";
|
|
22
|
+
import { boardQA, collectQA, qaRules, qaScript } from "./stage-qa.mjs";
|
|
20
23
|
import { fnv1a32 } from "./util.mjs";
|
|
21
24
|
|
|
22
25
|
const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
@@ -144,7 +147,13 @@ export async function runStage({ outDir, treatment, round, stillsOnly, log = ()
|
|
|
144
147
|
rmSync(join(outDir, "withheld"), { recursive: true, force: true });
|
|
145
148
|
let session = null;
|
|
146
149
|
try {
|
|
147
|
-
|
|
150
|
+
// One rung per round: a 3D film asks for the GPU, a Blender film needs its whole plate, and a GPU rung
|
|
151
|
+
// that does not start falls back (with a notice) for the master and every replay alike.
|
|
152
|
+
const ctx = { rung: stageRung(treatment, scan, outDir), notices: [] };
|
|
153
|
+
const style = stageStyle(treatment);
|
|
154
|
+
const open = (extra = {}) => openStageChecked({ runtime, outDir, scan, fonts, width, height, fps: fpsHint, seed, style, ...extra }, ctx);
|
|
155
|
+
session = await open();
|
|
156
|
+
for (const note of ctx.notices) log(note);
|
|
148
157
|
const { fps, frameCount } = checkContract(session.contract, treatment, format);
|
|
149
158
|
const plan = framePlan(treatment, fps, frameCount);
|
|
150
159
|
const kept = new Map();
|
|
@@ -154,11 +163,27 @@ export async function runStage({ outDir, treatment, round, stillsOnly, log = ()
|
|
|
154
163
|
const stills = writeStills({ outDir, plan, frames: kept, width, height, fps, round, kind: "stills-only" });
|
|
155
164
|
const track = prepareTrack({ outDir, treatment, frameCount, fps, cuts: treatment.beats.slice(1).map((b) => b.t0) });
|
|
156
165
|
for (const note of track.notes) log(note);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
166
|
+
// The board round: the style's text rules at the beat midpoints and around every cut, then one
|
|
167
|
+
// storyboard page. A failing board still gets written, so the look at it names the fix.
|
|
168
|
+
await closeStage(session);
|
|
169
|
+
session = null;
|
|
170
|
+
const qaSession = await open({ extraInit: qaScript() });
|
|
171
|
+
let check;
|
|
172
|
+
try {
|
|
173
|
+
check = await boardQA({ session: qaSession, treatment, fps, frameCount, width, height, pool });
|
|
174
|
+
} finally {
|
|
175
|
+
await closeStage(qaSession);
|
|
176
|
+
}
|
|
177
|
+
writeFileSync(join(runDir, "board-qa.json"), `${JSON.stringify(check, null, 2)}\n`);
|
|
178
|
+
const board = await writeBoard({ outDir, treatment, beatFiles: plan.beats.map((b) => join(stills.dir, `beat-${pad(b.index + 1)}.png`)), check, runtime, fonts });
|
|
179
|
+
writeFileSync(join(runDir, "stills-run.json"), `${JSON.stringify({ round, manifestSha256: board.manifestSha256, fps, frameCount, seconds: (Date.now() - started) / 1000 }, null, 2)}\n`);
|
|
180
|
+
log(`stills: ${stills.files.map((f) => join(stills.dir, f.file)).join(" ")} ${board.file}`);
|
|
181
|
+
log(`stills manifest: ${join(stills.dir, "manifest.json")} (sha256 ${board.manifestSha256})`);
|
|
160
182
|
if (!hasFfmpeg && !stillsOnly) requireFfmpeg();
|
|
161
|
-
|
|
183
|
+
const failed = check.rules.filter((r) => r.status === "FAIL");
|
|
184
|
+
if (failed.length) throw new Exit(EXIT.GATE_FAIL_QA, `GATE_FAIL_QA (board): ${failed.map((r) => `${r.id} ${r.detail}`).join("; ")}. The stills and the board are in ${stills.dir}; view them, fix the page and rerun the stills round.`);
|
|
185
|
+
log(`board: ${board.file}`);
|
|
186
|
+
log("stills-only: view the board and every still, then record the look round; this is not a finished film.");
|
|
162
187
|
return EXIT.OK;
|
|
163
188
|
}
|
|
164
189
|
|
|
@@ -189,7 +214,7 @@ export async function runStage({ outDir, treatment, round, stillsOnly, log = ()
|
|
|
189
214
|
const consume = async ({ f, png, d }) => {
|
|
190
215
|
if (d.width !== width || d.height !== height) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: captured ${d.width}x${d.height}, the format is ${width}x${height}`);
|
|
191
216
|
const flash = detector.ingestGrid(d.grid);
|
|
192
|
-
frameLog.write(`${JSON.stringify({ frame: f, pass: null, rgbaSha256: d.sha, flash, p995: Math.round(d.p995 * 1e4) / 1e4 })}\n`);
|
|
217
|
+
frameLog.write(`${JSON.stringify({ frame: f, pass: null, rgbaSha256: d.sha, flash, p995: Math.round(d.p995 * 1e4) / 1e4, p005: Math.round(d.p005 * 1e4) / 1e4, busy: Math.round(d.busy * 1e4) / 1e4 })}\n`);
|
|
193
218
|
masterSha.set(f, d.sha);
|
|
194
219
|
if (detSet.has(f)) writeFileSync(join(detDir, `${f}.png`), png);
|
|
195
220
|
keepFrame(kept, plan, f, png, d.rgba, width, height);
|
|
@@ -224,7 +249,7 @@ export async function runStage({ outDir, treatment, round, stillsOnly, log = ()
|
|
|
224
249
|
progress(outDir, { phase: "determinism and text QA", frame: 0, total: frameCount });
|
|
225
250
|
const determinism = { frames: [], region: null };
|
|
226
251
|
const replayDeterminism = async () => {
|
|
227
|
-
const replaySession = await
|
|
252
|
+
const replaySession = await open();
|
|
228
253
|
try {
|
|
229
254
|
await replay(replaySession, {
|
|
230
255
|
wanted: detSet,
|
|
@@ -242,7 +267,7 @@ export async function runStage({ outDir, treatment, round, stillsOnly, log = ()
|
|
|
242
267
|
}
|
|
243
268
|
};
|
|
244
269
|
const replayQA = async () => {
|
|
245
|
-
const qaSession = await
|
|
270
|
+
const qaSession = await open({ extraInit: qaScript() });
|
|
246
271
|
try {
|
|
247
272
|
const collected = await collectQA({ session: qaSession, treatment, fps, frameCount, width, height, pool });
|
|
248
273
|
return qaRules({ treatment, width, height, fps, collected });
|
|
@@ -276,8 +301,12 @@ export async function runStage({ outDir, treatment, round, stillsOnly, log = ()
|
|
|
276
301
|
targetDurationSec: treatment.durationSec,
|
|
277
302
|
round,
|
|
278
303
|
seed,
|
|
279
|
-
chromeFlags: stageFlags(width, height),
|
|
304
|
+
chromeFlags: stageFlags(width, height, process.platform, ctx.rung),
|
|
305
|
+
rung: ctx.rung,
|
|
280
306
|
renderer: report.webgl?.renderer ?? null,
|
|
307
|
+
plate: scan.plate ? { blender: scan.plate.blender, engine: scan.plate.engine, device: scan.plate.device, samples: scan.plate.samples, fps: scan.plate.fps, frames: scan.plate.frames.length } : null,
|
|
308
|
+
notices: ctx.notices,
|
|
309
|
+
assetUsed: assetUsed(treatment, scan.files),
|
|
281
310
|
webgl: report.webgl,
|
|
282
311
|
previewEncoder: pv.encoder,
|
|
283
312
|
stillsManifestSha256: stills.manifestSha256,
|
|
@@ -289,7 +318,7 @@ export async function runStage({ outDir, treatment, round, stillsOnly, log = ()
|
|
|
289
318
|
generatedAt: new Date().toISOString(),
|
|
290
319
|
};
|
|
291
320
|
writeFileSync(join(outDir, "manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`);
|
|
292
|
-
const notes = [...track.notes, `preview rung: ${pv.rung.width}x${pv.rung.height} @ ${pv.rung.fps} fps, ${pv.bytes} B, encoder ${pv.encoder}`, `stills manifest sha256 ${stills.manifestSha256}`];
|
|
321
|
+
const notes = [...ctx.notices, ...track.notes, `preview rung: ${pv.rung.width}x${pv.rung.height} @ ${pv.rung.fps} fps, ${pv.bytes} B, encoder ${pv.encoder}`, `stills manifest sha256 ${stills.manifestSha256}`];
|
|
293
322
|
const outcome = gateStage(outDir, { round, notes });
|
|
294
323
|
log(`report: ${join(outDir, "gate-report.txt")}`);
|
|
295
324
|
log(`stills manifest: ${join(stills.dir, "manifest.json")} (sha256 ${stills.manifestSha256})`);
|
|
@@ -298,6 +327,7 @@ export async function runStage({ outDir, treatment, round, stillsOnly, log = ()
|
|
|
298
327
|
if (qa.missing.length) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: copy line${qa.missing.length > 1 ? "s" : ""} never on screen: ${qa.missing.map((line) => `"${line}"`).join(", ")}; every copy line must appear in the film (as page text or registered canvas text). Report: ${join(outDir, "gate-report.txt")}`);
|
|
299
328
|
if (outcome.soundInvalid) throw new Exit(EXIT.SOUND_INVALID, `SOUND_INVALID: ${outcome.rules.filter((r) => r.sound && r.status === "FAIL").map((r) => `${r.id} ${r.detail}`).join("; ")}. Report: ${join(outDir, "gate-report.txt")}`);
|
|
300
329
|
if (outcome.passed) {
|
|
330
|
+
recordHouse(outDir, { style: treatment.style, path: treatment.path, format: treatment.format, durationSec: treatment.durationSec });
|
|
301
331
|
log(`GATE PASS: ${join(outDir, "film.mp4")}`);
|
|
302
332
|
return EXIT.OK;
|
|
303
333
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Stage frame worker: decodes one captured PNG to RGBA, hashes the decoded bytes (never the PNG),
|
|
2
|
-
// and computes the flash-audit cell grid
|
|
3
|
-
// orders frames and feeds ffmpeg while the next frame is being stepped.
|
|
2
|
+
// and computes the flash-audit cell grid, the luminance band (0.5 % and 99.5 %) and the busy-cell
|
|
3
|
+
// share, so the main thread only orders frames and feeds ffmpeg while the next frame is being stepped.
|
|
4
4
|
import { parentPort } from "node:worker_threads";
|
|
5
5
|
import { cellGrid, gridFor } from "./flash.mjs";
|
|
6
|
-
import { decodePng, downscale, encodePng,
|
|
6
|
+
import { busyShare, decodePng, downscale, encodePng, luminanceBand, rgbaSha256 } from "./image.mjs";
|
|
7
7
|
import { NEAR_BLACK } from "./constants.mjs";
|
|
8
8
|
|
|
9
9
|
parentPort.on("message", ({ id, png, analyze, preview }) => {
|
|
@@ -13,7 +13,10 @@ parentPort.on("message", ({ id, png, analyze, preview }) => {
|
|
|
13
13
|
const out = { id, width: image.width, height: image.height, sha: rgbaSha256(rgba) };
|
|
14
14
|
if (analyze) {
|
|
15
15
|
out.grid = cellGrid(rgba, image.width, image.height, gridFor(image.width, image.height));
|
|
16
|
-
|
|
16
|
+
const band = luminanceBand(rgba, 1 - NEAR_BLACK.percentile, NEAR_BLACK.percentile);
|
|
17
|
+
out.p995 = band.high;
|
|
18
|
+
out.p005 = band.low;
|
|
19
|
+
out.busy = busyShare(rgba, image.width, image.height);
|
|
17
20
|
}
|
|
18
21
|
if (preview) out.previewPng = encodePng(preview[0], preview[1], downscale(rgba, image.width, image.height, preview[0], preview[1]), 4, 3);
|
|
19
22
|
out.rgba = rgba;
|
|
@@ -6,9 +6,12 @@ import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync, statSyn
|
|
|
6
6
|
import { availableParallelism } from "node:os";
|
|
7
7
|
import { extname, join, relative, sep } from "node:path";
|
|
8
8
|
import { Worker } from "node:worker_threads";
|
|
9
|
-
import {
|
|
9
|
+
import { BLENDER, readPlate } from "./blender.mjs";
|
|
10
|
+
import { EXIT, Exit, INSTALL_COMMAND, SOFTWARE_GL, STAGE_ORIGIN } from "./constants.mjs";
|
|
10
11
|
import { launchStage } from "./driver.mjs";
|
|
11
12
|
import { FONTS, fontPath, SKILL_ROOT } from "./fonts.mjs";
|
|
13
|
+
import { firstLine } from "./runtime.mjs";
|
|
14
|
+
import { readStyle, styleCss, styleScript } from "./styles.mjs";
|
|
12
15
|
|
|
13
16
|
export const CONTENT_TYPES = Object.freeze({
|
|
14
17
|
".html": "text/html; charset=utf-8",
|
|
@@ -41,6 +44,11 @@ const NETWORK_API = /\bWebSocket\b|\bWebTransport\b|\bRTCPeerConnection\b|\bEven
|
|
|
41
44
|
|
|
42
45
|
const inside = (root, path) => path === root || path.startsWith(root + sep);
|
|
43
46
|
|
|
47
|
+
// The pinned three.js build and its two addons (engine/vendor/three, MIT, hashes in THIRD_PARTY_NOTICES),
|
|
48
|
+
// served at /lit/three/ for the 3D route (references/depth.md). A page reaches them through an import
|
|
49
|
+
// map; nothing is fetched and nothing else is served from this folder.
|
|
50
|
+
export const THREE_DIR = join(SKILL_ROOT, "engine", "vendor", "three");
|
|
51
|
+
|
|
44
52
|
/** Pixel size of a PNG, JPEG, WebP or GIF, and whether it is animated; null when unreadable. */
|
|
45
53
|
export function rasterInfo(bytes, ext) {
|
|
46
54
|
if (ext === ".png" && bytes.length > 24) {
|
|
@@ -82,8 +90,9 @@ export function rasterInfo(bytes, ext) {
|
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
/**
|
|
85
|
-
* Pre-flight scan of the stage folder before any browser starts. Returns the file list
|
|
86
|
-
*
|
|
93
|
+
* Pre-flight scan of the stage folder before any browser starts. Returns the file list, the raster
|
|
94
|
+
* URLs to decode and the Blender plate (or null); throws Exit 17 (contract) or 19 (network) naming
|
|
95
|
+
* the file and the reason.
|
|
87
96
|
*/
|
|
88
97
|
export function scanStage(stageDir) {
|
|
89
98
|
if (!existsSync(join(stageDir, "index.html"))) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: no stage/index.html in ${stageDir}; author the page first (references/stage.md)`);
|
|
@@ -103,13 +112,21 @@ export function scanStage(stageDir) {
|
|
|
103
112
|
if (!link.isSymbolicLink()) pending.push(path);
|
|
104
113
|
continue;
|
|
105
114
|
}
|
|
115
|
+
// A pipe, socket or device would block or flood the read below; the browser route refuses the same.
|
|
116
|
+
if (!statSync(real).isFile()) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${rel} is not a regular file`);
|
|
106
117
|
const ext = extname(name).toLowerCase();
|
|
107
|
-
if (!CONTENT_TYPES[ext]) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${rel} is not an allowed stage asset (${Object.keys(CONTENT_TYPES).join(" ")})`);
|
|
118
|
+
if (!CONTENT_TYPES[ext] && rel !== "scene.py") throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${rel} is not an allowed stage asset (${Object.keys(CONTENT_TYPES).join(" ")})`);
|
|
108
119
|
files.push({ rel, path: real, ext, bytes: statSync(real).size });
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
122
|
const rasters = [];
|
|
123
|
+
// A Blender plate and its preview stills are frames the runner wrote and plate.json lists by name
|
|
124
|
+
// and size; they are not page rasters. Anything the receipt does not list is held to the raster limits.
|
|
125
|
+
const plate = readPlate(root, "plate");
|
|
126
|
+
const preview = readPlate(root, "plate-preview");
|
|
127
|
+
const listed = new Set([plate, preview].filter(Boolean).flatMap((p) => p.frames.map((f) => `${p.dir}/${f.name}`)));
|
|
112
128
|
for (const file of files) {
|
|
129
|
+
if (RASTER_TYPES.has(file.ext) && listed.has(file.rel.split(sep).join("/"))) continue;
|
|
113
130
|
if (TEXT_TYPES.has(file.ext)) {
|
|
114
131
|
const text = readFileSync(file.path, "utf8");
|
|
115
132
|
for (const match of text.matchAll(ABSOLUTE_URL)) {
|
|
@@ -139,7 +156,7 @@ export function scanStage(stageDir) {
|
|
|
139
156
|
const bySize = new Map();
|
|
140
157
|
for (const r of rasters) bySize.set(r.size, (bySize.get(r.size) ?? 0) + 1);
|
|
141
158
|
for (const [size, count] of bySize) if (size !== "unknown" && count >= RASTER_LIMITS.flipbook) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${count} rasters of ${size} look like a flipbook; animate with the page, not a frame sequence`);
|
|
142
|
-
return { root, files, rasters: rasters.map((r) => `/${r.rel.split(sep).join("/")}`) };
|
|
159
|
+
return { root, files, rasters: rasters.map((r) => `/${r.rel.split(sep).join("/")}`), plate };
|
|
143
160
|
}
|
|
144
161
|
|
|
145
162
|
const FONT_FORMAT = { ".ttf": "truetype", ".otf": "opentype", ".woff": "woff", ".woff2": "woff2" };
|
|
@@ -172,9 +189,10 @@ export function stageFontFaults(faults) {
|
|
|
172
189
|
* Route every request. Only the synthetic origin is served: the kit, fonts.css, the faces, and
|
|
173
190
|
* files whose realpath lies inside the stage folder. Anything else is refused and recorded.
|
|
174
191
|
*/
|
|
175
|
-
export function stageRouter({ root, fonts, record }) {
|
|
192
|
+
export function stageRouter({ root, fonts, record, style = null }) {
|
|
176
193
|
const kit = readFileSync(join(SKILL_ROOT, "engine", "stage-kit.js"));
|
|
177
194
|
const loopKit = readFileSync(join(SKILL_ROOT, "engine", "loop-kit.js"));
|
|
195
|
+
const threeRoot = realpathSync(THREE_DIR);
|
|
178
196
|
return async (route) => {
|
|
179
197
|
const url = route.request().url();
|
|
180
198
|
if (!url.startsWith(`${STAGE_ORIGIN}/`)) {
|
|
@@ -192,6 +210,18 @@ export function stageRouter({ root, fonts, record }) {
|
|
|
192
210
|
if (path === "/lit/stage-kit.js") return route.fulfill({ status: 200, contentType: CONTENT_TYPES[".js"], body: kit });
|
|
193
211
|
if (path === "/lit/loop-kit.js") return route.fulfill({ status: 200, contentType: CONTENT_TYPES[".js"], body: loopKit });
|
|
194
212
|
if (path === "/lit/fonts.css") return route.fulfill({ status: 200, contentType: CONTENT_TYPES[".css"], body: fonts.css });
|
|
213
|
+
// The film's house style (references/studio.md): type, colour and zone tokens, and the shot timeline.
|
|
214
|
+
if (style && path === "/lit/style.css") return route.fulfill({ status: 200, contentType: CONTENT_TYPES[".css"], body: style.css });
|
|
215
|
+
if (style && path === "/lit/style.js") return route.fulfill({ status: 200, contentType: CONTENT_TYPES[".js"], body: style.js });
|
|
216
|
+
if (path.startsWith("/lit/three/")) {
|
|
217
|
+
const sub = path.slice("/lit/three/".length);
|
|
218
|
+
const file = join(threeRoot, ...sub.split("/"));
|
|
219
|
+
if (sub.split("/").includes("..") || !sub.endsWith(".js") || !existsSync(file) || !inside(threeRoot, realpathSync(file))) {
|
|
220
|
+
record.missing.push(path);
|
|
221
|
+
return route.fulfill({ status: 404, body: "" });
|
|
222
|
+
}
|
|
223
|
+
return route.fulfill({ status: 200, contentType: CONTENT_TYPES[".js"], body: readFileSync(file) });
|
|
224
|
+
}
|
|
195
225
|
const font = fonts.routes.get(path);
|
|
196
226
|
if (font) return route.fulfill({ status: 200, contentType: font.type, body: readFileSync(font.file) });
|
|
197
227
|
const rel = path === "/" ? "index.html" : path.replace(/^\/+/u, "");
|
|
@@ -218,18 +248,38 @@ export function stageRouter({ root, fonts, record }) {
|
|
|
218
248
|
};
|
|
219
249
|
}
|
|
220
250
|
|
|
251
|
+
/** The film's /lit/style.css and /lit/style.js from its treatment's house style, or null when it names none. */
|
|
252
|
+
export function stageStyle(treatment) {
|
|
253
|
+
if (!treatment.style) return null;
|
|
254
|
+
const style = readStyle(treatment.style);
|
|
255
|
+
return { css: styleCss(style, treatment.format), js: styleScript(style, treatment.format, treatment) };
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* The browser rung of a round: a three.js world asks for the GPU; a Blender film shows its path-traced
|
|
260
|
+
* plate under HTML type, so its page needs only the software rung, and it needs the plate, all of it.
|
|
261
|
+
*/
|
|
262
|
+
export function stageRung(treatment, scan, out) {
|
|
263
|
+
if (treatment.render3d !== "blender") return treatment.depth === "3d" ? "gpu" : "software";
|
|
264
|
+
const want = Math.round(treatment.durationSec * BLENDER.plateFps);
|
|
265
|
+
if (!scan.plate) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: render3d is blender but stage/plate/plate.json is missing or does not match its frames; render the plate first: blender --out ${out} --final (no Blender: set render3d to three and use the GPU rung)`);
|
|
266
|
+
if (scan.plate.frames.length !== want) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: the plate has ${scan.plate.frames.length} frames; a ${treatment.durationSec} s film needs ${want} at ${BLENDER.plateFps} fps (render it again: blender --out ${out} --final)`);
|
|
267
|
+
return "software";
|
|
268
|
+
}
|
|
269
|
+
|
|
221
270
|
const INIT = () => readFileSync(join(SKILL_ROOT, "engine", "stage-init.js"), "utf8");
|
|
222
271
|
|
|
223
272
|
/**
|
|
224
273
|
* Open one stage session: launch, route, inject the clock, load the page, load every face and
|
|
225
274
|
* decode every raster. Returns the session and the page's declared contract.
|
|
226
275
|
*/
|
|
227
|
-
export async function openStage({ runtime, outDir, scan, fonts, width, height, fps, seed, extraInit = null }) {
|
|
228
|
-
const session = await launchStage({ runtime, outDir, width, height });
|
|
276
|
+
export async function openStage({ runtime, outDir, scan, fonts, width, height, fps, seed, extraInit = null, style = null, rung = "software" }) {
|
|
277
|
+
const session = await launchStage({ runtime, outDir, width, height, rung });
|
|
229
278
|
const record = { blocked: [], rejected: [], missing: [], pageErrors: [], console: [] };
|
|
230
279
|
session.record = record;
|
|
231
280
|
try {
|
|
232
|
-
|
|
281
|
+
if (rung === "gpu") await probeGpu(session);
|
|
282
|
+
await session.context.route("**/*", stageRouter({ root: scan.root, fonts, record, style }));
|
|
233
283
|
await session.context.addInitScript({ content: INIT().replaceAll("__LIT_STAGE_CONFIG__", JSON.stringify({ fps, seed })) });
|
|
234
284
|
if (extraInit) await session.context.addInitScript({ content: extraInit });
|
|
235
285
|
session.page.on("pageerror", (error) => record.pageErrors.push(error.message));
|
|
@@ -249,6 +299,42 @@ export async function openStage({ runtime, outDir, scan, fonts, width, height, f
|
|
|
249
299
|
}
|
|
250
300
|
}
|
|
251
301
|
|
|
302
|
+
/** The GPU rung must give a page a WebGL2 context on a hardware renderer; anything else falls back. */
|
|
303
|
+
export async function probeGpu(session) {
|
|
304
|
+
const probe = await session.page.evaluate(() => {
|
|
305
|
+
const gl = document.createElement("canvas").getContext("webgl2");
|
|
306
|
+
if (!gl) return { ok: false, renderer: null };
|
|
307
|
+
const info = gl.getExtension("WEBGL_debug_renderer_info");
|
|
308
|
+
return { ok: true, renderer: info ? gl.getParameter(info.UNMASKED_RENDERER_WEBGL) : "unknown" };
|
|
309
|
+
});
|
|
310
|
+
if (!probe.ok) throw new Error("the GPU rung gave the page no WebGL2 context");
|
|
311
|
+
if (SOFTWARE_GL.some((needle) => String(probe.renderer).toLowerCase().includes(needle))) throw new Error(`the GPU rung gave a software renderer (${probe.renderer})`);
|
|
312
|
+
session.gpuRenderer = probe.renderer;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Open a stage session on the round's rung. `ctx` is { rung, notices } shared by the master and its
|
|
317
|
+
* replays: a 3D film asks for "gpu", and when that rung cannot launch, gives the page no WebGL2 or
|
|
318
|
+
* gives a software renderer, every browser of the round falls back to the software rung (one rung for
|
|
319
|
+
* master and replays) and a notice says so. A page contract fault is never swallowed by the fallback.
|
|
320
|
+
*/
|
|
321
|
+
export async function openStageChecked(options, ctx) {
|
|
322
|
+
if (ctx.rung === "gpu") {
|
|
323
|
+
try {
|
|
324
|
+
const session = await openStage({ ...options, rung: "gpu" });
|
|
325
|
+
const webgl = await session.page.evaluate(() => window.__litClock.report().webgl);
|
|
326
|
+
if (!webgl || webgl.ok) return session;
|
|
327
|
+
await closeStage(session);
|
|
328
|
+
ctx.notices.push("the 3D route asked for the GPU rung and the page got no WebGL there; rendered on the software rung (SwiftShader), slower, same frames");
|
|
329
|
+
} catch (error) {
|
|
330
|
+
if (error instanceof Exit) throw error;
|
|
331
|
+
ctx.notices.push(`the 3D route asked for the GPU rung and it did not start (${firstLine(String(error.message)).slice(0, 120)}); rendered on the software rung (SwiftShader), slower, same frames`);
|
|
332
|
+
}
|
|
333
|
+
ctx.rung = "software";
|
|
334
|
+
}
|
|
335
|
+
return openStage({ ...options, rung: "software" });
|
|
336
|
+
}
|
|
337
|
+
|
|
252
338
|
export async function closeStage(session) {
|
|
253
339
|
await session?.context?.close().catch(() => {});
|
|
254
340
|
}
|
|
@@ -262,7 +348,7 @@ export async function assertClean(session) {
|
|
|
262
348
|
const network = report.violations.filter((v) => v.kind === "network");
|
|
263
349
|
if (network.length) throw new Exit(EXIT.STAGE_NETWORK_REQUEST, `STAGE_NETWORK_REQUEST: the page used ${network.map((v) => v.name).join(", ")}; a stage page never opens a connection`);
|
|
264
350
|
if (report.violations.length) throw new Exit(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: the page used ${report.violations.map((v) => v.name).join(", ")}, which a stage page may not use`);
|
|
265
|
-
if (report.webgl && !report.webgl.ok) throw new Exit(EXIT.BLOCKED_NO_WEBGL2,
|
|
351
|
+
if (report.webgl && !report.webgl.ok) throw new Exit(EXIT.BLOCKED_NO_WEBGL2, `BLOCKED_NO_WEBGL2: the page requested a WebGL context and the ${session.rung ?? "software"} rung returned none`);
|
|
266
352
|
return report;
|
|
267
353
|
}
|
|
268
354
|
|