@litfamily/litopencode 1.0.7 → 1.0.9
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/CHANGELOG.md +18 -0
- package/README-Ko-KR.md +314 -31
- package/README.md +312 -29
- package/dist/activation-primary-prompts.d.ts +1 -0
- package/dist/activation-primary-prompts.js +16 -0
- package/dist/activation-probe.js +4 -1
- package/dist/activation-prompt-utils.d.ts +1 -1
- package/dist/activation-routing.d.ts +6 -1
- package/dist/activation-routing.js +174 -16
- package/dist/activation-workflow-prompts.d.ts +1 -1
- package/dist/activation-workflow-prompts.js +18 -17
- package/dist/activation.d.ts +3 -2
- package/dist/activation.js +6 -6
- package/dist/agents/defaults.js +14 -6
- package/dist/cli/command-aliases.js +24 -22
- package/dist/cli/doctor.js +3 -0
- package/dist/cli/install-report.d.ts +1 -0
- package/dist/cli/install-report.js +4 -0
- package/dist/cli/install.js +7 -4
- package/dist/cli/managed-skill-assets.d.ts +1 -1
- package/dist/cli/managed-skill-assets.js +15 -5
- package/dist/cli/motion-runtime.d.ts +6 -0
- package/dist/cli/motion-runtime.js +46 -0
- package/dist/cli/native-skill-install.js +32 -9
- package/dist/cli/native-skill-integrity.js +1 -0
- package/dist/cli/native-skills.d.ts +2 -0
- package/dist/cli/native-skills.js +2 -1
- package/dist/cli/office-dependencies.d.ts +14 -0
- package/dist/cli/office-dependencies.js +24 -0
- package/dist/cli.js +13 -3
- package/dist/commands.d.ts +2 -11
- package/dist/commands.js +9 -17
- package/dist/deliverable-hedge-guard.d.ts +20 -21
- package/dist/deliverable-hedge-guard.js +234 -275
- package/dist/features.d.ts +81 -2
- package/dist/features.js +80 -13
- package/dist/hooks.d.ts +3 -2
- package/dist/hooks.js +4 -4
- package/dist/ignition.d.ts +1 -1
- package/dist/ignition.js +15 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/interface-handoff.d.ts +1 -0
- package/dist/interface-handoff.js +1 -0
- package/dist/motion-image-reads.d.ts +6 -0
- package/dist/motion-image-reads.js +46 -0
- package/dist/server.js +13 -11
- package/dist/skill-renames.d.ts +4 -2
- package/dist/skill-renames.js +12 -4
- package/dist/skills.d.ts +31 -3
- package/dist/skills.js +53 -9
- package/dist/tools.js +4 -4
- package/docs/ab/S11/baseline-desktop.webp +0 -0
- package/docs/ab/S11/baseline-phone.webp +0 -0
- package/docs/ab/S11/lit-desktop.webp +0 -0
- package/docs/ab/S11/lit-phone.webp +0 -0
- package/docs/ab/S3/baseline-desktop.webp +0 -0
- package/docs/ab/S3/baseline-phone.webp +0 -0
- package/docs/ab/S3/lit-desktop.webp +0 -0
- package/docs/ab/S3/lit-phone.webp +0 -0
- package/docs/ab/S4/baseline-desktop.webp +0 -0
- package/docs/ab/S4/baseline-phone.webp +0 -0
- package/docs/ab/S4/lit-desktop.webp +0 -0
- package/docs/ab/S4/lit-phone.webp +0 -0
- package/docs/ab/S5/lit-slides.webp +0 -0
- package/docs/ab/S7/lit-diagram.webp +0 -0
- package/docs/ab/S8/baseline-slides.webp +0 -0
- package/docs/ab/S8/lit-slides.webp +0 -0
- package/docs/ab/S9/lit-pages.webp +0 -0
- package/docs/assets/cover-motion-still.webp +0 -0
- package/docs/assets/cover-motion.webp +0 -0
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/assets/skills/autoconference.webp +0 -0
- package/docs/assets/skills/automatic-guards.webp +0 -0
- package/docs/assets/skills/autoresearch.webp +0 -0
- package/docs/assets/skills/browser-drive.webp +0 -0
- package/docs/assets/skills/debugging.webp +0 -0
- package/docs/assets/skills/deep-interview.webp +0 -0
- package/docs/assets/skills/doctor-installer.webp +0 -0
- package/docs/assets/skills/durable-litgoal.webp +0 -0
- package/docs/assets/skills/frontend-ui-ux.webp +0 -0
- package/docs/assets/skills/lit-burnoff-file.webp +0 -0
- package/docs/assets/skills/lit-burnoff.webp +0 -0
- package/docs/assets/skills/lit-code.webp +0 -0
- package/docs/assets/skills/lit-commit.webp +0 -0
- package/docs/assets/skills/lit-comprehend.webp +0 -0
- package/docs/assets/skills/lit-crucible.webp +0 -0
- package/docs/assets/skills/lit-diagram-drawer.webp +0 -0
- package/docs/assets/skills/lit-docx.webp +0 -0
- package/docs/assets/skills/lit-fetch.webp +0 -0
- package/docs/assets/skills/lit-handoff.webp +0 -0
- package/docs/assets/skills/lit-humanizer.webp +0 -0
- package/docs/assets/skills/lit-init.webp +0 -0
- package/docs/assets/skills/lit-plan.webp +0 -0
- package/docs/assets/skills/lit-pptx.webp +0 -0
- package/docs/assets/skills/lit-recap.webp +0 -0
- package/docs/assets/skills/lit-scientific-visualization.webp +0 -0
- package/docs/assets/skills/lit-typographic-motion.webp +0 -0
- package/docs/assets/skills/litresearch.webp +0 -0
- package/docs/assets/skills/litwork.webp +0 -0
- package/docs/assets/skills/lsp-setup.webp +0 -0
- package/docs/assets/skills/lsp.webp +0 -0
- package/docs/assets/skills/readme-studio.webp +0 -0
- package/docs/assets/skills/refactor.webp +0 -0
- package/docs/assets/skills/review-work.webp +0 -0
- package/docs/assets/skills/rules.webp +0 -0
- package/docs/assets/skills/start-work.webp +0 -0
- package/docs/assets/skills/structural-search.webp +0 -0
- package/docs/assets/skills/visual-qa.webp +0 -0
- package/docs/assets/skills/wikify.webp +0 -0
- package/docs/reference-Ko-KR.md +5 -1
- package/docs/reference.md +6 -2
- package/package.json +1 -1
- package/rules/bundled-rules/lit-humanizer.md +12 -0
- package/skills/autoconference/SKILL.md +1 -1
- package/skills/autoconference/assets/report_template.md +1 -1
- package/skills/autoresearch/references/type-checklists.md +1 -1
- package/skills/browser-drive/SKILL.md +19 -5
- package/skills/browser-drive/scripts/capability-probe.mjs +26 -5
- package/skills/frontend-ui-ux/SKILL.md +10 -15
- package/skills/frontend-ui-ux/data/THIRD-PARTY-NOTICE.txt +10 -0
- package/skills/frontend-ui-ux/references/adaptive-layout.md +3 -11
- package/skills/frontend-ui-ux/references/brand-and-imagery.md +6 -11
- package/skills/frontend-ui-ux/references/complete-contract.md +10 -3
- package/skills/frontend-ui-ux/references/composition.md +1 -7
- package/skills/frontend-ui-ux/references/craft-floor.md +94 -0
- package/skills/frontend-ui-ux/references/creative-directions.md +1 -7
- package/skills/frontend-ui-ux/references/evidence-review.md +2 -12
- package/skills/frontend-ui-ux/references/implementation-platforms.md +1 -4
- package/skills/frontend-ui-ux/references/inclusive-interface.md +1 -3
- package/skills/frontend-ui-ux/references/interaction-motion.md +1 -7
- package/skills/frontend-ui-ux/references/motion-guide.md +125 -0
- package/skills/frontend-ui-ux/references/operating-lanes.md +2 -8
- package/skills/frontend-ui-ux/references/product-direction.md +1 -6
- package/skills/frontend-ui-ux/references/production.md +12 -5
- package/skills/frontend-ui-ux/references/redesign-playbook.md +1 -7
- package/skills/frontend-ui-ux/references/slop-register.md +103 -0
- package/skills/frontend-ui-ux/references/system-foundations.md +1 -8
- package/skills/frontend-ui-ux/references/taste-direction.md +4 -11
- package/skills/frontend-ui-ux/references/visual-language.md +1 -6
- package/skills/frontend-ui-ux/references/visual-reconstruction.md +2 -7
- package/skills/frontend-ui-ux/scripts/probe-page.mjs +326 -0
- package/skills/frontend-ui-ux/scripts/probe-server.mjs +24 -0
- package/skills/frontend-ui-ux/scripts/probe-static.mjs +42 -0
- package/skills/frontend-ui-ux/scripts/probe-thresholds.json +86 -0
- package/skills/frontend-ui-ux/scripts/probe.mjs +183 -0
- package/skills/lit-comprehend/SKILL.md +10 -11
- package/skills/lit-comprehend/references/artifact-template.md +2 -18
- package/skills/lit-comprehend/scripts/verify-explainer.ts +0 -14
- package/skills/lit-diagram-drawer/NOTICE.md +33 -0
- package/skills/lit-diagram-drawer/SKILL.md +101 -0
- package/skills/lit-diagram-drawer/assets/examples/type-architecture-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-architecture-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-architecture-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-bar-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-bar-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-bar-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-beeswarm-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-beeswarm-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-beeswarm-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-bubble-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-bubble-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-bubble-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-bump-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-bump-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-bump-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-data-flow-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-data-flow-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-data-flow-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-datalake-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-datalake-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-datalake-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-db-schema-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-db-schema-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-db-schema-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-dependency-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-dependency-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-dependency-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-deployment-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-deployment-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-deployment-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-dp-integration-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-dp-integration-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-dp-integration-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-er-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-er-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-er-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-fishbone-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-fishbone-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-fishbone-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-flowchart-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-flowchart-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-flowchart-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-gantt-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-gantt-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-gantt-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-heatmap-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-heatmap-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-heatmap-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-high-level-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-high-level-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-high-level-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-import-drawio-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-import-drawio-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-import-drawio-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-it-state-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-it-state-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-it-state-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-journey-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-journey-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-journey-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-kanban-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-kanban-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-kanban-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-layers-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-layers-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-layers-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-line-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-line-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-line-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-loop-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-loop-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-loop-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-marimekko-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-marimekko-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-marimekko-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-medallion-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-medallion-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-medallion-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-nested-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-nested-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-nested-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-org-chart-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-org-chart-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-org-chart-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-polar-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-polar-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-polar-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-process-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-process-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-process-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-pyramid-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-pyramid-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-pyramid-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-quadrant-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-quadrant-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-quadrant-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-queue-animated-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-queue-animated-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-queue-animated-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-radar-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-radar-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-radar-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-ridgeline-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-ridgeline-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-ridgeline-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-sankey-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-sankey-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-sankey-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-scatter-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-scatter-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-scatter-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-sequence-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-sequence-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-sequence-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-slopegraph-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-slopegraph-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-slopegraph-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-state-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-state-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-state-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-story-map-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-story-map-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-story-map-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-streamgraph-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-streamgraph-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-streamgraph-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-swimlane-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-swimlane-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-swimlane-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-timeline-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-timeline-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-timeline-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-tree-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-tree-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-tree-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-treemap-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-treemap-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-treemap-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-uml-class-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-uml-class-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-uml-class-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-venn-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-venn-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-venn-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-wardley-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-wardley-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-wardley-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-waterfall-dark.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-waterfall-full.html +1 -0
- package/skills/lit-diagram-drawer/assets/examples/type-waterfall-light.html +1 -0
- package/skills/lit-diagram-drawer/assets/fonts/OFL.txt +94 -0
- package/skills/lit-diagram-drawer/assets/fonts/PretendardVariable.woff2 +0 -0
- package/skills/lit-diagram-drawer/assets/fonts/provenance.json +23 -0
- package/skills/lit-diagram-drawer/assets/icons.html +231 -0
- package/skills/lit-diagram-drawer/assets/licenses/devicon-MIT.txt +20 -0
- package/skills/lit-diagram-drawer/assets/licenses/diagram-design-MIT.txt +21 -0
- package/skills/lit-diagram-drawer/assets/licenses/log-z-MIT.txt +21 -0
- package/skills/lit-diagram-drawer/assets/licenses/simple-icons-CC0.md +30 -0
- package/skills/lit-diagram-drawer/assets/licenses/tabler-MIT.txt +21 -0
- package/skills/lit-diagram-drawer/examples/01-service-architecture/after.html +1 -0
- package/skills/lit-diagram-drawer/examples/01-service-architecture/brief.md +33 -0
- package/skills/lit-diagram-drawer/examples/02-release-decision/after.html +1 -0
- package/skills/lit-diagram-drawer/examples/02-release-decision/brief.md +18 -0
- package/skills/lit-diagram-drawer/examples/03-data-retention/after.html +1 -0
- package/skills/lit-diagram-drawer/examples/03-data-retention/brief.md +19 -0
- package/skills/lit-diagram-drawer/examples/04-oauth-sequence/after.html +1 -0
- package/skills/lit-diagram-drawer/examples/04-oauth-sequence/brief.md +17 -0
- package/skills/lit-diagram-drawer/examples/05-review-lanes/after.html +1 -0
- package/skills/lit-diagram-drawer/examples/05-review-lanes/brief.md +17 -0
- package/skills/lit-diagram-drawer/examples/06-rollout-gates/after.html +1 -0
- package/skills/lit-diagram-drawer/examples/06-rollout-gates/brief.md +17 -0
- package/skills/lit-diagram-drawer/examples/07-deployment-boundary/after.html +1 -0
- package/skills/lit-diagram-drawer/examples/07-deployment-boundary/brief.md +19 -0
- package/skills/lit-diagram-drawer/examples/08-policy-traces/after.html +1 -0
- package/skills/lit-diagram-drawer/examples/08-policy-traces/brief.md +20 -0
- package/skills/lit-diagram-drawer/references/accessibility.md +37 -0
- package/skills/lit-diagram-drawer/references/export.md +17 -0
- package/skills/lit-diagram-drawer/references/import-drawio.md +13 -0
- package/skills/lit-diagram-drawer/references/import-excalidraw.md +11 -0
- package/skills/lit-diagram-drawer/references/import-mermaid.md +12 -0
- package/skills/lit-diagram-drawer/references/import-schema.md +28 -0
- package/skills/lit-diagram-drawer/references/korean-typography.md +34 -0
- package/skills/lit-diagram-drawer/references/motion.md +29 -0
- package/skills/lit-diagram-drawer/references/office-pptx-docx.md +28 -0
- package/skills/lit-diagram-drawer/references/output-spec.md +48 -0
- package/skills/lit-diagram-drawer/references/primitive-annotation.md +12 -0
- package/skills/lit-diagram-drawer/references/primitive-icons.md +21 -0
- package/skills/lit-diagram-drawer/references/primitive-sketchy.md +11 -0
- package/skills/lit-diagram-drawer/references/primitive-terminal.md +11 -0
- package/skills/lit-diagram-drawer/references/profiles.md +24 -0
- package/skills/lit-diagram-drawer/references/semantic-patterns.md +27 -0
- package/skills/lit-diagram-drawer/references/style-guide.md +67 -0
- package/skills/lit-diagram-drawer/references/type-architecture.md +51 -0
- package/skills/lit-diagram-drawer/references/type-bar.md +51 -0
- package/skills/lit-diagram-drawer/references/type-beeswarm.md +49 -0
- package/skills/lit-diagram-drawer/references/type-bubble.md +49 -0
- package/skills/lit-diagram-drawer/references/type-bump.md +49 -0
- package/skills/lit-diagram-drawer/references/type-catalog.json +1433 -0
- package/skills/lit-diagram-drawer/references/type-data-flow.md +51 -0
- package/skills/lit-diagram-drawer/references/type-datalake.md +49 -0
- package/skills/lit-diagram-drawer/references/type-db-schema.md +49 -0
- package/skills/lit-diagram-drawer/references/type-dependency.md +49 -0
- package/skills/lit-diagram-drawer/references/type-deployment.md +49 -0
- package/skills/lit-diagram-drawer/references/type-dp-integration.md +49 -0
- package/skills/lit-diagram-drawer/references/type-dp-security-matrix.md +49 -0
- package/skills/lit-diagram-drawer/references/type-er.md +49 -0
- package/skills/lit-diagram-drawer/references/type-fishbone.md +49 -0
- package/skills/lit-diagram-drawer/references/type-flowchart.md +49 -0
- package/skills/lit-diagram-drawer/references/type-gantt.md +49 -0
- package/skills/lit-diagram-drawer/references/type-heatmap.md +53 -0
- package/skills/lit-diagram-drawer/references/type-high-level-vertical.md +53 -0
- package/skills/lit-diagram-drawer/references/type-high-level.md +53 -0
- package/skills/lit-diagram-drawer/references/type-import-drawio.md +53 -0
- package/skills/lit-diagram-drawer/references/type-import-excalidraw.md +53 -0
- package/skills/lit-diagram-drawer/references/type-import-mermaid.md +53 -0
- package/skills/lit-diagram-drawer/references/type-it-state.md +54 -0
- package/skills/lit-diagram-drawer/references/type-journey.md +54 -0
- package/skills/lit-diagram-drawer/references/type-kanban.md +54 -0
- package/skills/lit-diagram-drawer/references/type-layers.md +54 -0
- package/skills/lit-diagram-drawer/references/type-line.md +54 -0
- package/skills/lit-diagram-drawer/references/type-loop-terminal.md +53 -0
- package/skills/lit-diagram-drawer/references/type-loop.md +54 -0
- package/skills/lit-diagram-drawer/references/type-marimekko.md +54 -0
- package/skills/lit-diagram-drawer/references/type-medallion.md +54 -0
- package/skills/lit-diagram-drawer/references/type-nested.md +59 -0
- package/skills/lit-diagram-drawer/references/type-org-chart.md +58 -0
- package/skills/lit-diagram-drawer/references/type-paved-road-animated.md +72 -0
- package/skills/lit-diagram-drawer/references/type-polar.md +67 -0
- package/skills/lit-diagram-drawer/references/type-policy-trace-animated.md +69 -0
- package/skills/lit-diagram-drawer/references/type-process.md +58 -0
- package/skills/lit-diagram-drawer/references/type-pyramid.md +59 -0
- package/skills/lit-diagram-drawer/references/type-quadrant-consultant.md +60 -0
- package/skills/lit-diagram-drawer/references/type-quadrant.md +57 -0
- package/skills/lit-diagram-drawer/references/type-queue-animated.md +63 -0
- package/skills/lit-diagram-drawer/references/type-radar.md +57 -0
- package/skills/lit-diagram-drawer/references/type-ridgeline.md +63 -0
- package/skills/lit-diagram-drawer/references/type-sankey.md +68 -0
- package/skills/lit-diagram-drawer/references/type-scatter.md +60 -0
- package/skills/lit-diagram-drawer/references/type-sequence-oauth.md +66 -0
- package/skills/lit-diagram-drawer/references/type-sequence.md +63 -0
- package/skills/lit-diagram-drawer/references/type-slopegraph.md +65 -0
- package/skills/lit-diagram-drawer/references/type-state-lifecycle.md +53 -0
- package/skills/lit-diagram-drawer/references/type-state.md +59 -0
- package/skills/lit-diagram-drawer/references/type-story-map.md +52 -0
- package/skills/lit-diagram-drawer/references/type-streamgraph.md +53 -0
- package/skills/lit-diagram-drawer/references/type-swimlane.md +52 -0
- package/skills/lit-diagram-drawer/references/type-timeline.md +52 -0
- package/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +57 -0
- package/skills/lit-diagram-drawer/references/type-tree.md +54 -0
- package/skills/lit-diagram-drawer/references/type-treemap.md +54 -0
- package/skills/lit-diagram-drawer/references/type-uml-class.md +52 -0
- package/skills/lit-diagram-drawer/references/type-venn.md +51 -0
- package/skills/lit-diagram-drawer/references/type-wardley.md +52 -0
- package/skills/lit-diagram-drawer/references/type-waterfall.md +54 -0
- package/skills/lit-diagram-drawer/references/verifier-guide.md +59 -0
- package/skills/lit-diagram-drawer/scripts/block-registry.mjs +43 -0
- package/skills/lit-diagram-drawer/scripts/brief-contract.mjs +94 -0
- package/skills/lit-diagram-drawer/scripts/capability-probe.mjs +132 -0
- package/skills/lit-diagram-drawer/scripts/check-visible-text.mjs +15 -0
- package/skills/lit-diagram-drawer/scripts/craft-thresholds.json +15 -0
- package/skills/lit-diagram-drawer/scripts/diagram-metrics.mjs +216 -0
- package/skills/lit-diagram-drawer/scripts/doctor.mjs +8 -0
- package/skills/lit-diagram-drawer/scripts/drawio-extract.mjs +214 -0
- package/skills/lit-diagram-drawer/scripts/excalidraw-extract.mjs +151 -0
- package/skills/lit-diagram-drawer/scripts/export.mjs +133 -0
- package/skills/lit-diagram-drawer/scripts/import-shared.mjs +130 -0
- package/skills/lit-diagram-drawer/scripts/mermaid-extract.mjs +173 -0
- package/skills/lit-diagram-drawer/scripts/office-safety.mjs +120 -0
- package/skills/lit-diagram-drawer/scripts/renderer-safety.mjs +46 -0
- package/skills/lit-diagram-drawer/scripts/test-block-registry.mjs +20 -0
- package/skills/lit-diagram-drawer/scripts/test-brief-contract.mjs +27 -0
- package/skills/lit-diagram-drawer/scripts/test-importers.mjs +119 -0
- package/skills/lit-diagram-drawer/scripts/test-office-safety.mjs +67 -0
- package/skills/lit-diagram-drawer/scripts/test-sequence-verifier.mjs +28 -0
- package/skills/lit-diagram-drawer/scripts/test-visual-quality.mjs +68 -0
- package/skills/lit-diagram-drawer/scripts/verify-all.mjs +74 -0
- package/skills/lit-diagram-drawer/scripts/verify-brief.mjs +47 -0
- package/skills/lit-diagram-drawer/scripts/verify-coverage.mjs +56 -0
- package/skills/lit-diagram-drawer/scripts/verify-diagram.mjs +26 -0
- package/skills/lit-diagram-drawer/scripts/verify-motion.mjs +12 -0
- package/skills/lit-diagram-drawer/scripts/verify-type.mjs +48 -0
- package/skills/lit-diagram-drawer/scripts/visual-quality.mjs +363 -0
- package/skills/lit-docx/LICENSE-MIT.txt +21 -0
- package/skills/lit-docx/SKILL.md +78 -0
- package/skills/lit-docx/references/frontmatter_schema.md +42 -0
- package/skills/lit-docx/references/journal_style_spec.md +17 -0
- package/skills/lit-docx/references/markdown_quality_checklist.md +37 -0
- package/skills/lit-docx/references/slop_phrase_list.yaml +58 -0
- package/skills/lit-docx/references/slop_rules.md +35 -0
- package/skills/lit-docx/requirements.in +5 -0
- package/skills/lit-docx/requirements.lock +289 -0
- package/skills/lit-docx/run.py +64 -0
- package/skills/lit-docx/scripts/clean_markdown.py +95 -0
- package/skills/lit-docx/scripts/convert_md_to_docx.py +1047 -0
- package/skills/lit-docx/scripts/convert_md_to_pdf.py +281 -0
- package/skills/lit-docx/scripts/convert_pdf.py +130 -0
- package/skills/lit-docx/scripts/craft-thresholds.json +11 -0
- package/skills/lit-docx/scripts/craft_docx.py +83 -0
- package/skills/lit-docx/scripts/edit_docx.py +297 -0
- package/skills/lit-docx/scripts/embed_images.py +78 -0
- package/skills/lit-docx/scripts/generate_docx_templates.py +491 -0
- package/skills/lit-docx/scripts/slop_lint.py +485 -0
- package/skills/lit-docx/scripts/visual_audit.py +41 -0
- package/skills/lit-docx/templates/docx/acs.docx +0 -0
- package/skills/lit-docx/templates/docx/elsevier.docx +0 -0
- package/skills/lit-docx/templates/docx/ieee.docx +0 -0
- package/skills/lit-docx/templates/docx/korean-generic.docx +0 -0
- package/skills/lit-docx/templates/docx/nature.docx +0 -0
- package/skills/lit-docx/templates/latex/acs/README.md +5 -0
- package/skills/lit-docx/templates/latex/acs/template.tex +37 -0
- package/skills/lit-docx/templates/latex/elsevier/README.md +5 -0
- package/skills/lit-docx/templates/latex/elsevier/template.tex +38 -0
- package/skills/lit-docx/templates/latex/ieee/README.md +5 -0
- package/skills/lit-docx/templates/latex/ieee/template.tex +37 -0
- package/skills/lit-docx/templates/latex/korean-generic/README.md +5 -0
- package/skills/lit-docx/templates/latex/korean-generic/template.tex +37 -0
- package/skills/lit-docx/templates/latex/nature/README.md +5 -0
- package/skills/lit-docx/templates/latex/nature/template.tex +37 -0
- package/skills/lit-docx/templates/registry.yaml +1366 -0
- package/skills/lit-humanizer/NOTICE +160 -0
- package/skills/lit-humanizer/SKILL.md +122 -0
- package/skills/lit-humanizer/assets/always-on-rule.md +9 -0
- package/skills/lit-humanizer/assets/report-skeleton.md +25 -0
- package/skills/lit-humanizer/assets/slide-text-skeleton.md +28 -0
- package/skills/lit-humanizer/examples/accessibility-note/after.md +7 -0
- package/skills/lit-humanizer/examples/accessibility-note/before.md +7 -0
- package/skills/lit-humanizer/examples/api-reference/after.md +9 -0
- package/skills/lit-humanizer/examples/api-reference/before.md +15 -0
- package/skills/lit-humanizer/examples/changelog/after.md +5 -0
- package/skills/lit-humanizer/examples/changelog/before.md +12 -0
- package/skills/lit-humanizer/examples/code-comments/after.md +10 -0
- package/skills/lit-humanizer/examples/code-comments/before.md +19 -0
- package/skills/lit-humanizer/examples/commit/after.md +5 -0
- package/skills/lit-humanizer/examples/commit/before.md +7 -0
- package/skills/lit-humanizer/examples/data-release/after.md +7 -0
- package/skills/lit-humanizer/examples/data-release/before.md +9 -0
- package/skills/lit-humanizer/examples/english-essay/after.md +5 -0
- package/skills/lit-humanizer/examples/english-essay/before.md +5 -0
- package/skills/lit-humanizer/examples/incident-update/after.md +7 -0
- package/skills/lit-humanizer/examples/incident-update/before.md +7 -0
- package/skills/lit-humanizer/examples/ko-essay/after.md +7 -0
- package/skills/lit-humanizer/examples/ko-essay/before.md +9 -0
- package/skills/lit-humanizer/examples/ko-report/after.md +9 -0
- package/skills/lit-humanizer/examples/ko-report/before.md +13 -0
- package/skills/lit-humanizer/examples/ko-slide/after.md +19 -0
- package/skills/lit-humanizer/examples/ko-slide/before.md +21 -0
- package/skills/lit-humanizer/examples/meeting-brief/after.md +9 -0
- package/skills/lit-humanizer/examples/meeting-brief/before.md +11 -0
- package/skills/lit-humanizer/examples/policy-faq/after.md +9 -0
- package/skills/lit-humanizer/examples/policy-faq/before.md +9 -0
- package/skills/lit-humanizer/examples/pr/after.md +15 -0
- package/skills/lit-humanizer/examples/pr/before.md +17 -0
- package/skills/lit-humanizer/examples/project-update/after.md +7 -0
- package/skills/lit-humanizer/examples/project-update/before.md +9 -0
- package/skills/lit-humanizer/examples/readme/after.md +12 -0
- package/skills/lit-humanizer/examples/readme/before.md +14 -0
- package/skills/lit-humanizer/examples/report/after.md +13 -0
- package/skills/lit-humanizer/examples/report/before.md +11 -0
- package/skills/lit-humanizer/examples/research-abstract/after.md +5 -0
- package/skills/lit-humanizer/examples/research-abstract/before.md +5 -0
- package/skills/lit-humanizer/examples/slides/after.md +19 -0
- package/skills/lit-humanizer/examples/slides/before.md +19 -0
- package/skills/lit-humanizer/examples/troubleshooting/after.md +11 -0
- package/skills/lit-humanizer/examples/troubleshooting/before.md +11 -0
- package/skills/lit-humanizer/fixtures/ko-metrics-golden.json +49 -0
- package/skills/lit-humanizer/fixtures/office/minimal.docx +0 -0
- package/skills/lit-humanizer/fixtures/office/minimal.pptx +0 -0
- package/skills/lit-humanizer/fixtures/pos-real.txt +26 -0
- package/skills/lit-humanizer/fixtures/rule-cases.json +306 -0
- package/skills/lit-humanizer/references/code-patterns.md +468 -0
- package/skills/lit-humanizer/references/deliverable-channels.md +111 -0
- package/skills/lit-humanizer/references/en-patterns-checklist.md +43 -0
- package/skills/lit-humanizer/references/en-patterns-content.md +243 -0
- package/skills/lit-humanizer/references/en-patterns-structure.md +375 -0
- package/skills/lit-humanizer/references/en-patterns.md +57 -0
- package/skills/lit-humanizer/references/ko-metrics.md +33 -0
- package/skills/lit-humanizer/references/ko-patterns-a-d.md +659 -0
- package/skills/lit-humanizer/references/ko-patterns-e-j.md +387 -0
- package/skills/lit-humanizer/references/ko-patterns.md +31 -0
- package/skills/lit-humanizer/references/rewrite-playbook.md +54 -0
- package/skills/lit-humanizer/references/taxonomy.md +153 -0
- package/skills/lit-humanizer/rules.json +884 -0
- package/skills/lit-humanizer/scripts/core.mjs +208 -0
- package/skills/lit-humanizer/scripts/detect.mjs +91 -0
- package/skills/lit-humanizer/scripts/extract_office_text.py +89 -0
- package/skills/lit-humanizer/scripts/guard-scan.mjs +36 -0
- package/skills/lit-humanizer/scripts/ko-metrics.mjs +124 -0
- package/skills/lit-humanizer/scripts/test-fixtures.mjs +54 -0
- package/skills/lit-humanizer/scripts/test-ko-metrics.mjs +27 -0
- package/skills/lit-pptx/FORBIDDEN_TERMS.json +55 -0
- package/skills/lit-pptx/NOTICE.md +3 -0
- package/skills/lit-pptx/SKILL.md +76 -0
- package/skills/lit-pptx/agents/analyst.md +49 -0
- package/skills/lit-pptx/agents/antithesis.md +59 -0
- package/skills/lit-pptx/agents/architect.md +44 -0
- package/skills/lit-pptx/agents/critic.md +42 -0
- package/skills/lit-pptx/agents/synthesizer.md +47 -0
- package/skills/lit-pptx/agents/thesis.md +33 -0
- package/skills/lit-pptx/assets/azure/circle-lg.png +0 -0
- package/skills/lit-pptx/assets/azure/circle-md.png +0 -0
- package/skills/lit-pptx/assets/azure/circle-sm.png +0 -0
- package/skills/lit-pptx/fonts/a2z-font/A2Z-Black.otf +0 -0
- package/skills/lit-pptx/fonts/a2z-font/A2Z-Bold.otf +0 -0
- package/skills/lit-pptx/fonts/a2z-font/A2Z-Light.otf +0 -0
- package/skills/lit-pptx/fonts/a2z-font/A2Z-Medium.otf +0 -0
- package/skills/lit-pptx/fonts/a2z-font/A2Z-Regular.otf +0 -0
- package/skills/lit-pptx/fonts/a2z-font/OFL.txt +94 -0
- package/skills/lit-pptx/fonts/a2z-font/SOURCE.md +29 -0
- package/skills/lit-pptx/package-lock.json +747 -0
- package/skills/lit-pptx/package.json +13 -0
- package/skills/lit-pptx/pretendard-font/LICENSE.txt +94 -0
- package/skills/lit-pptx/pretendard-font/public/static/LitOpenCodeSans-Bold.otf +0 -0
- package/skills/lit-pptx/pretendard-font/public/static/LitOpenCodeSans-Regular.otf +0 -0
- package/skills/lit-pptx/requirements.in +2 -0
- package/skills/lit-pptx/requirements.lock +285 -0
- package/skills/lit-pptx/run.mjs +71 -0
- package/skills/lit-pptx/scripts/check_ooxml.py +47 -0
- package/skills/lit-pptx/scripts/compile-deck.js +447 -0
- package/skills/lit-pptx/scripts/craft-thresholds.json +26 -0
- package/skills/lit-pptx/scripts/craft_extras.py +224 -0
- package/skills/lit-pptx/scripts/embed_fonts.py +204 -0
- package/skills/lit-pptx/scripts/layout_inventory.py +70 -0
- package/skills/lit-pptx/scripts/learn_template.py +433 -0
- package/skills/lit-pptx/scripts/lib/derive-palette.js +176 -0
- package/skills/lit-pptx/scripts/lib/directive-parser.js +244 -0
- package/skills/lit-pptx/scripts/lib/font-map.js +79 -0
- package/skills/lit-pptx/scripts/lib/gen-bg.js +85 -0
- package/skills/lit-pptx/scripts/lib/gen-gradient-assets.js +36 -0
- package/skills/lit-pptx/scripts/lib/layout-resolver.js +737 -0
- package/skills/lit-pptx/scripts/lib/markdown-loader.js +136 -0
- package/skills/lit-pptx/scripts/lib/render-adapter-html.js +364 -0
- package/skills/lit-pptx/scripts/lib/render-adapter-pptx.js +1848 -0
- package/skills/lit-pptx/scripts/lib/slide-ast.js +534 -0
- package/skills/lit-pptx/scripts/lib/spec-validator.js +94 -0
- package/skills/lit-pptx/scripts/lib/template-registry.js +355 -0
- package/skills/lit-pptx/scripts/qa_deck.py +773 -0
- package/skills/lit-pptx/scripts/validate_pptx.py +206 -0
- package/skills/lit-pptx/specs/markdown-slide-spec-v1.md +251 -0
- package/skills/lit-pptx/specs/markdown-slide-spec-v2.md +223 -0
- package/skills/lit-pptx/specs/slide-ast-v1.schema.json +229 -0
- package/skills/lit-pptx/specs/slide-ast-v2.schema.json +144 -0
- package/skills/lit-pptx/specs/template-enrollment-contract.md +379 -0
- package/skills/lit-pptx/templates/bauhaus_light.css +4 -0
- package/skills/lit-pptx/templates/boilerplate_professional.css +508 -0
- package/skills/lit-pptx/templates/enrolled/AZURE-A2Z/capabilities.yaml +146 -0
- package/skills/lit-pptx/templates/enrolled/AZURE-A2Z/layout-mapping.yaml +454 -0
- package/skills/lit-pptx/templates/enrolled/AZURE-A2Z/template.yaml +37 -0
- package/skills/lit-pptx/templates/enrolled/AZURE-PRO/capabilities.yaml +154 -0
- package/skills/lit-pptx/templates/enrolled/AZURE-PRO/layout-mapping.yaml +483 -0
- package/skills/lit-pptx/templates/enrolled/AZURE-PRO/template.yaml +37 -0
- package/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/capabilities.yaml +179 -0
- package/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/layout-mapping.yaml +299 -0
- package/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/template.yaml +45 -0
- package/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/capabilities.yaml +181 -0
- package/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/layout-mapping.yaml +299 -0
- package/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/template.yaml +44 -0
- package/skills/lit-scientific-visualization/SKILL.md +2 -0
- package/skills/lit-typographic-motion/NOTICE +23 -0
- package/skills/lit-typographic-motion/SKILL.md +77 -0
- package/skills/lit-typographic-motion/THIRD_PARTY_NOTICES +25 -0
- package/skills/lit-typographic-motion/audio-analysis.py +52 -0
- package/skills/lit-typographic-motion/engine/browser.mjs +83 -0
- package/skills/lit-typographic-motion/engine/constants.mjs +177 -0
- package/skills/lit-typographic-motion/engine/contrast.mjs +101 -0
- package/skills/lit-typographic-motion/engine/encode.mjs +46 -0
- package/skills/lit-typographic-motion/engine/flash.mjs +216 -0
- package/skills/lit-typographic-motion/engine/look.mjs +166 -0
- package/skills/lit-typographic-motion/engine/page/common.js +105 -0
- package/skills/lit-typographic-motion/engine/page/engine.js +451 -0
- package/skills/lit-typographic-motion/engine/page/gl.js +213 -0
- package/skills/lit-typographic-motion/engine/page/lines.js +88 -0
- package/skills/lit-typographic-motion/engine/page/passes.js +144 -0
- package/skills/lit-typographic-motion/engine/page/post.js +119 -0
- package/skills/lit-typographic-motion/engine/page/scenes.js +187 -0
- package/skills/lit-typographic-motion/engine/page/type.js +321 -0
- package/skills/lit-typographic-motion/engine/png.mjs +139 -0
- package/skills/lit-typographic-motion/engine/sound.mjs +291 -0
- package/skills/lit-typographic-motion/engine/stage/capture.mjs +133 -0
- package/skills/lit-typographic-motion/engine/stage/clock.js +171 -0
- package/skills/lit-typographic-motion/engine/stage/frame-worker.mjs +47 -0
- package/skills/lit-typographic-motion/engine/stage/gate.mjs +119 -0
- package/skills/lit-typographic-motion/engine/stage/qa-page.js +158 -0
- package/skills/lit-typographic-motion/engine/stage/qa.mjs +208 -0
- package/skills/lit-typographic-motion/engine/stage/render.mjs +418 -0
- package/skills/lit-typographic-motion/engine/stage/scan.mjs +162 -0
- package/skills/lit-typographic-motion/engine/stage/stage-kit.js +310 -0
- package/skills/lit-typographic-motion/engine/stills.mjs +60 -0
- package/skills/lit-typographic-motion/engine/text.mjs +126 -0
- package/skills/lit-typographic-motion/engine/timing.mjs +289 -0
- package/skills/lit-typographic-motion/engine/treatment.mjs +254 -0
- package/skills/lit-typographic-motion/fonts/Archivo-100-400.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/Archivo-100-700.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/Archivo-100-900.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/Archivo-125-400.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/Archivo-125-700.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/Archivo-125-900.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/Archivo-75-400.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/Archivo-75-700.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/Archivo-75-900.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/Archivo-OFL.txt +93 -0
- package/skills/lit-typographic-motion/fonts/Silkscreen-Bold.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/Silkscreen-OFL.txt +93 -0
- package/skills/lit-typographic-motion/fonts/Silkscreen-Regular.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/VT323-OFL.txt +93 -0
- package/skills/lit-typographic-motion/fonts/VT323-Regular.ttf +0 -0
- package/skills/lit-typographic-motion/fonts/pins.json +44 -0
- package/skills/lit-typographic-motion/fonts/stroke/CREDITS +52 -0
- package/skills/lit-typographic-motion/fonts/stroke/EMSAllure.svg +216 -0
- package/skills/lit-typographic-motion/fonts/stroke/EMSFelix.svg +216 -0
- package/skills/lit-typographic-motion/fonts/stroke/EMSOsmotron.svg +216 -0
- package/skills/lit-typographic-motion/fonts/stroke/EMSReadability.svg +216 -0
- package/skills/lit-typographic-motion/fonts/stroke/EMSTech.svg +217 -0
- package/skills/lit-typographic-motion/fonts/stroke/OFL.txt +85 -0
- package/skills/lit-typographic-motion/gate.mjs +593 -0
- package/skills/lit-typographic-motion/package-lock.json +78 -0
- package/skills/lit-typographic-motion/package.json +11 -0
- package/skills/lit-typographic-motion/probe.mjs +74 -0
- package/skills/lit-typographic-motion/references/authoring.md +110 -0
- package/skills/lit-typographic-motion/references/craft-loop.md +110 -0
- package/skills/lit-typographic-motion/references/runtime.md +88 -0
- package/skills/lit-typographic-motion/references/stage.md +164 -0
- package/skills/lit-typographic-motion/references/style-bibles.md +88 -0
- package/skills/lit-typographic-motion/references/treatment.md +143 -0
- package/skills/lit-typographic-motion/references/type-craft.md +55 -0
- package/skills/lit-typographic-motion/render.mjs +654 -0
- package/skills/lit-typographic-motion/requirements-audio.in +1 -0
- package/skills/lit-typographic-motion/requirements-audio.txt +790 -0
- package/skills/lit-typographic-motion/runtime.mjs +259 -0
- package/skills/lit-typographic-motion/word-timing-models.json +25 -0
- package/skills/litresearch/SKILL.md +41 -12
- package/skills/managed-skill-manifest.json +2367 -63
- package/skills/skill-rename-aliases.json +6 -1
- package/tools/check-pack-payload.mjs +22 -1
- package/tools/check-payload-substance.mjs +2 -2
- package/tools/payload-reference-exemptions.json +4 -0
- package/tools/payload-substance-allowlist.json +2 -3
- package/tools/payload-substance-parity.json +7 -7
- package/tools/version-manifests.json +4 -4
- package/skills/lit-korean/SKILL.md +0 -231
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
// `render.mjs stage`: the stage path. The model's page is filmed frame by frame on a virtual clock:
|
|
2
|
+
// the master browser steps and captures every frame while a worker pool decodes and audits the last
|
|
3
|
+
// ones; a fresh browser replays the clock from 0 to re-capture the determinism samples; and the QA
|
|
4
|
+
// replay (qa.mjs) measures the text. The master never changes a style. Every frame and track passes
|
|
5
|
+
// through this renderer, then the gate decides what is delivered.
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import { spawn } from "node:child_process";
|
|
8
|
+
import { once } from "node:events";
|
|
9
|
+
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
|
|
10
|
+
import os from "node:os";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import { performance } from "node:perf_hooks";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
import { Worker } from "node:worker_threads";
|
|
15
|
+
import { EXIT } from "../constants.mjs";
|
|
16
|
+
import { findChrome, loadPlaywright, which } from "../browser.mjs";
|
|
17
|
+
import { ExcursionDetector, auditSequence, flashGeometryFor } from "../flash.mjs";
|
|
18
|
+
import { areaResize, decodePng, encodePng } from "../png.mjs";
|
|
19
|
+
import { encodeMaster, encodePreview, previewRungs, previewSize, write } from "../encode.mjs";
|
|
20
|
+
import { stillsPlan, writeStillsSet } from "../stills.mjs";
|
|
21
|
+
import { fnv1a32 } from "../text.mjs";
|
|
22
|
+
import { SOUND_EXIT, muxTrack, resolveTrack, soundChecks } from "../sound.mjs";
|
|
23
|
+
import { frameSize, keepFirstTreatment, loadTreatment } from "../treatment.mjs";
|
|
24
|
+
import { inspectWarmState, pins, skillRoot } from "../../runtime.mjs";
|
|
25
|
+
import { previewEncoderRung } from "../../probe.mjs";
|
|
26
|
+
import { openStage, stageFonts } from "./capture.mjs";
|
|
27
|
+
import { analyseQa, captureQa, qaPageSource } from "./qa.mjs";
|
|
28
|
+
import { StageError, scanStage, stageSha } from "./scan.mjs";
|
|
29
|
+
|
|
30
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
31
|
+
const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
32
|
+
const log = (line) => process.stderr.write(`${line}\n`);
|
|
33
|
+
const exit = (code, name, detail) => Object.assign(new Error(`${name} (${code}): ${detail}`), { exitCode: code });
|
|
34
|
+
|
|
35
|
+
// A small ordered worker pool: frames go in as PNG bytes and come back decoded and audited.
|
|
36
|
+
class FramePool {
|
|
37
|
+
constructor(size) {
|
|
38
|
+
this.workers = Array.from({ length: size }, () => new Worker(path.join(here, "frame-worker.mjs")));
|
|
39
|
+
this.pending = new Map();
|
|
40
|
+
this.next = 0;
|
|
41
|
+
this.id = 0;
|
|
42
|
+
for (const worker of this.workers) worker.on("message", (message) => {
|
|
43
|
+
const job = this.pending.get(message.id);
|
|
44
|
+
this.pending.delete(message.id);
|
|
45
|
+
if (message.error) job.reject(new StageError(17, "STAGE_CONTRACT_ERROR", message.error));
|
|
46
|
+
else job.resolve(message);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
run(png, width, height, preview) {
|
|
50
|
+
const id = this.id++;
|
|
51
|
+
const worker = this.workers[this.next++ % this.workers.length];
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
this.pending.set(id, { resolve, reject });
|
|
54
|
+
worker.postMessage({ id, png, width, height, preview }, [png.buffer]);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async close() { await Promise.all(this.workers.map((worker) => worker.terminate())); }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Sample frames for the determinism replay: frame 0, the last frame and the first frame of every
|
|
61
|
+
// beat, spread evenly to at most 16; beat midpoints are added until there are at least 8.
|
|
62
|
+
export function determinismSamples(beats, fps, frameCount) {
|
|
63
|
+
const clamp = (f) => Math.max(0, Math.min(frameCount - 1, Math.round(f)));
|
|
64
|
+
let picks = [...new Set([0, frameCount - 1, ...beats.map((beat) => clamp(beat.t0 * fps))])].sort((a, b) => a - b);
|
|
65
|
+
if (picks.length > 16) picks = Array.from({ length: 16 }, (_, i) => picks[Math.round((i * (picks.length - 1)) / 15)]);
|
|
66
|
+
for (const beat of beats) {
|
|
67
|
+
if (picks.length >= 8) break;
|
|
68
|
+
picks.push(clamp(((beat.t0 + beat.t1) / 2) * fps));
|
|
69
|
+
picks = [...new Set(picks)].sort((a, b) => a - b);
|
|
70
|
+
}
|
|
71
|
+
for (let k = 1; picks.length < Math.min(8, frameCount); k++) {
|
|
72
|
+
picks.push(clamp((k * frameCount) / 9));
|
|
73
|
+
picks = [...new Set(picks)].sort((a, b) => a - b);
|
|
74
|
+
}
|
|
75
|
+
return picks;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// The first 64x64 tile (in raster order) where two RGBA frames differ.
|
|
79
|
+
export function firstDifferingRegion(a, b, width, height, tile = 64) {
|
|
80
|
+
for (let ty = 0; ty < height; ty += tile) for (let tx = 0; tx < width; tx += tile) {
|
|
81
|
+
for (let y = ty; y < Math.min(height, ty + tile); y++) {
|
|
82
|
+
const start = (y * width + tx) * 4, end = (y * width + Math.min(width, tx + tile)) * 4;
|
|
83
|
+
if (Buffer.compare(a.subarray(start, end), b.subarray(start, end)) !== 0) return { x: tx, y: ty, width: Math.min(tile, width - tx), height: Math.min(tile, height - ty) };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Poster: PNG at maximum compression; the size steps down until it fits the 1 MB cap.
|
|
90
|
+
function posterPng(rgba, width, height) {
|
|
91
|
+
let w = width, h = height, pixels = rgba;
|
|
92
|
+
for (let attempt = 0; attempt < 5; attempt++) {
|
|
93
|
+
const png = encodePng(w, h, pixels, 4, 9, true);
|
|
94
|
+
if (png.length <= 1_000_000 || attempt === 4) return { png, width: w, height: h };
|
|
95
|
+
const nw = Math.round(w * 0.8 / 2) * 2, nh = Math.round(h * 0.8 / 2) * 2;
|
|
96
|
+
pixels = areaResize(rgba, width, height, nw, nh, 4);
|
|
97
|
+
w = nw; h = nh;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function progress(runDir, fields) {
|
|
103
|
+
writeFileSync(path.join(runDir, "progress.json"), JSON.stringify({ ...fields, updatedAt: new Date().toISOString() }) + "\n");
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Everything needed before a browser starts: the treatment, the stage scan, the cache and Chrome.
|
|
107
|
+
export function prepareStage(out) {
|
|
108
|
+
const { treatment } = loadTreatment(out);
|
|
109
|
+
if (treatment.path !== "stage") throw exit(16, "BLOCKED_TREATMENT_INVALID", "field path: this treatment takes the type path; render it with `render.mjs film --brief <brief.json> --out <dir>`");
|
|
110
|
+
keepFirstTreatment(out, treatment);
|
|
111
|
+
const stageDir = path.join(out, "stage");
|
|
112
|
+
if (!existsSync(path.join(stageDir, "index.html"))) throw new StageError(17, "STAGE_CONTRACT_ERROR", `no stage page at ${path.join(stageDir, "index.html")}; write it first (references/stage.md)`);
|
|
113
|
+
const scan = scanStage(stageDir);
|
|
114
|
+
const state = inspectWarmState();
|
|
115
|
+
if (state.blocked) throw exit(state.blocked.exit, state.blocked.name, `${state.blocked.detail}; fix: ${state.fix}`);
|
|
116
|
+
const chrome = findChrome();
|
|
117
|
+
if (!chrome.path) throw exit(EXIT.BLOCKED_NO_CHROME, "BLOCKED_NO_CHROME", `${chrome.missing}; fix: install Chrome or set CHROME_PATH`);
|
|
118
|
+
const { width, height } = frameSize(treatment);
|
|
119
|
+
const fps = treatment.fps ?? 60;
|
|
120
|
+
const seed = Number.isSafeInteger(treatment.seed) ? treatment.seed >>> 0 : fnv1a32(treatment.request);
|
|
121
|
+
return { treatment, stageDir, scan, state, chromePath: chrome.path, width, height, fps, seed, fonts: stageFonts(skillRoot, state, pins) };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Opens a stage browser, loads the page and checks its contract against the treatment.
|
|
125
|
+
async function openChecked(chromium, context, profile, extraInit) {
|
|
126
|
+
const stage = await openStage(chromium, { chromePath: context.chromePath, profile, stageDir: context.stageDir, width: context.width, height: context.height, fps: context.fps, seed: context.seed, fonts: context.fonts, extraInit });
|
|
127
|
+
try {
|
|
128
|
+
const { definition, webgl } = await stage.load(context.scan.rasters.map((raster) => `/${raster.rel}`));
|
|
129
|
+
if (!definition) throw new StageError(17, "STAGE_CONTRACT_ERROR", "the page never called LitStage.define({ width, height, fps, duration, render }) or set window.litStage");
|
|
130
|
+
if (definition.width !== context.width || definition.height !== context.height) throw new StageError(17, "STAGE_CONTRACT_ERROR", `the page defines ${definition.width}x${definition.height}; the treatment's ${context.treatment.format} needs ${context.width}x${context.height}`);
|
|
131
|
+
if ((definition.fps ?? 60) !== context.fps) throw new StageError(17, "STAGE_CONTRACT_ERROR", `the page defines ${definition.fps} fps; the treatment renders at ${context.fps}`);
|
|
132
|
+
if (!(Number.isFinite(definition.duration) && definition.duration > 0)) throw new StageError(17, "STAGE_CONTRACT_ERROR", "the page's duration must be a positive number of seconds");
|
|
133
|
+
if (webgl.failed) throw exit(EXIT.BLOCKED_NO_WEBGL2, "BLOCKED_NO_WEBGL2", "the page asked for a WebGL context and the software renderer gave none; fix: check SwiftShader availability");
|
|
134
|
+
return { stage, definition, webgl };
|
|
135
|
+
} catch (error) {
|
|
136
|
+
await stage.close();
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Captures `frames` (sorted) in one browser by stepping every frame from 0. The stills round skips the
|
|
142
|
+
// compositor wait and the capture on frames it does not keep. The determinism replay (`exact`) repeats
|
|
143
|
+
// the master's own sequence instead, settling and capturing every frame and keeping only the samples:
|
|
144
|
+
// the raster of a frame can depend on whether earlier frames were captured, so only the same sequence
|
|
145
|
+
// is a fair comparison.
|
|
146
|
+
async function captureSampled(stage, frames, { exact = false } = {}) {
|
|
147
|
+
const shots = new Map();
|
|
148
|
+
const wanted = new Set(frames);
|
|
149
|
+
let cursor = 0;
|
|
150
|
+
for (const frame of frames) {
|
|
151
|
+
if (exact) {
|
|
152
|
+
for (; cursor < frame; cursor++) { await stage.step(cursor, true); await stage.capture(); }
|
|
153
|
+
} else if (frame > cursor) await stage.stepRange(cursor, frame - 1);
|
|
154
|
+
await stage.step(frame, true);
|
|
155
|
+
if (wanted.has(frame)) await stage.check();
|
|
156
|
+
shots.set(frame, await stage.capture());
|
|
157
|
+
cursor = frame + 1;
|
|
158
|
+
}
|
|
159
|
+
return shots;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function decodeRgba(png) {
|
|
163
|
+
const image = decodePng(png);
|
|
164
|
+
if (image.channels === 4) return image.pixels;
|
|
165
|
+
const out = Buffer.alloc(image.width * image.height * 4);
|
|
166
|
+
for (let i = 0, j = 0; i < image.pixels.length; i += image.channels, j += 4) { out[j] = image.pixels[i]; out[j + 1] = image.pixels[i + 1]; out[j + 2] = image.pixels[i + 2]; out[j + 3] = 255; }
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// The stage's cuts are the treatment's beat starts, on the frame grid.
|
|
171
|
+
function stageCuts(context) {
|
|
172
|
+
return context.treatment.beats.map((beat) => Math.round(beat.t0 * context.fps) / context.fps);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function stillsFor(context, frameCount) {
|
|
176
|
+
const { treatment, fps } = context;
|
|
177
|
+
const cuts = treatment.beats.slice(1).map((beat) => Math.round(beat.t0 * fps)).filter((f) => f > 0 && f < frameCount);
|
|
178
|
+
return stillsPlan({ beats: treatment.beats, cuts, frameCount, fps });
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function stageTargets(context, frameCount) {
|
|
182
|
+
const beats = context.treatment.beats;
|
|
183
|
+
const mid = (beat) => Math.max(0, Math.min(frameCount - 1, Math.round(((beat.t0 + Math.min(beat.t1, frameCount / context.fps)) / 2) * context.fps)));
|
|
184
|
+
return { posterFrame: mid(beats[Math.floor(beats.length / 2)]), stillFrame: mid(beats.at(-1)) };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// The full master capture: every frame stepped, captured, audited and piped to the encoder.
|
|
188
|
+
async function captureMaster(context, stage, frameCount, keep, previewSources, runDir) {
|
|
189
|
+
const { width, height, fps } = context;
|
|
190
|
+
const pool = new FramePool(Math.max(2, Math.min(6, os.availableParallelism() - 3)));
|
|
191
|
+
const master = encodeMaster(path.join(runDir, "film.mp4"), width, height, fps);
|
|
192
|
+
const detector = new ExcursionDetector(flashGeometryFor(width, height));
|
|
193
|
+
const logFd = openSync(path.join(runDir, "stage-frames.jsonl"), "w");
|
|
194
|
+
const pvDir = path.join(runDir, "pv-src");
|
|
195
|
+
rmSync(pvDir, { recursive: true, force: true });
|
|
196
|
+
mkdirSync(pvDir, { recursive: true });
|
|
197
|
+
const pv = previewSize(previewRungs()[0][0], width, height);
|
|
198
|
+
const kept = new Map();
|
|
199
|
+
const hashes = new Map();
|
|
200
|
+
const stepMs = [], frameMs = [];
|
|
201
|
+
const queue = [];
|
|
202
|
+
const started = performance.now();
|
|
203
|
+
let consumed = 0;
|
|
204
|
+
const consume = async (job) => {
|
|
205
|
+
const result = await job.promise;
|
|
206
|
+
const record = detector.push(result.cells);
|
|
207
|
+
hashes.set(job.frame, result.hash);
|
|
208
|
+
writeSync(logFd, JSON.stringify({ frame: job.frame, rgbaSha256: result.hash, p995L: result.p995L, transitions: { up: record.up, down: record.down, redUp: record.redUp, redDown: record.redDown }, fullStep: record.fullStep }) + "\n");
|
|
209
|
+
await write(master.child, Buffer.from(result.rgba.buffer, result.rgba.byteOffset, result.rgba.byteLength));
|
|
210
|
+
if (result.previewPng) writeFileSync(path.join(pvDir, `f${job.frame}.png`), result.previewPng);
|
|
211
|
+
consumed += 1;
|
|
212
|
+
};
|
|
213
|
+
try {
|
|
214
|
+
for (let frame = 0; frame < frameCount; frame++) {
|
|
215
|
+
const t0 = performance.now();
|
|
216
|
+
await stage.step(frame, true);
|
|
217
|
+
if (frame % 30 === 0) await stage.check();
|
|
218
|
+
const t1 = performance.now();
|
|
219
|
+
const png = await stage.capture();
|
|
220
|
+
if (keep.has(frame)) kept.set(frame, png);
|
|
221
|
+
stepMs.push(t1 - t0);
|
|
222
|
+
frameMs.push(performance.now() - t0);
|
|
223
|
+
queue.push({ frame, promise: pool.run(new Uint8Array(png), width, height, previewSources.has(frame) ? pv : null) });
|
|
224
|
+
if (queue.length >= 8) await consume(queue.shift());
|
|
225
|
+
if (frame % 30 === 0) progress(runDir, { phase: "master", frame, frameCount, elapsedSec: Number(((performance.now() - started) / 1000).toFixed(1)) });
|
|
226
|
+
}
|
|
227
|
+
await stage.check();
|
|
228
|
+
while (queue.length) await consume(queue.shift());
|
|
229
|
+
} catch (error) {
|
|
230
|
+
master.child.kill("SIGKILL");
|
|
231
|
+
closeSync(logFd);
|
|
232
|
+
await pool.close();
|
|
233
|
+
throw error;
|
|
234
|
+
}
|
|
235
|
+
closeSync(logFd);
|
|
236
|
+
await pool.close();
|
|
237
|
+
master.child.stdin.end();
|
|
238
|
+
const [status] = await once(master.child, "close");
|
|
239
|
+
if (status !== 0) throw new Error(`ffmpeg master encode failed: ${master.stderr().trim()}`);
|
|
240
|
+
const sorted = (list) => [...list].sort((a, b) => a - b);
|
|
241
|
+
const pct = (list, q) => { const s = sorted(list); return Number(s[Math.min(s.length - 1, Math.floor(q * s.length))].toFixed(1)); };
|
|
242
|
+
return { kept, hashes, consumed, timing: { frames: frameCount, stepP50: pct(stepMs, 0.5), frameP50: pct(frameMs, 0.5), frameP95: pct(frameMs, 0.95), masterSec: Number(((performance.now() - started) / 1000).toFixed(1)) } };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Preview: decimated master frames only, on the long-edge ladder; the exact frames handed to the
|
|
246
|
+
// encoder are audited as a loop.
|
|
247
|
+
async function buildPreview(context, runDir, frameCount) {
|
|
248
|
+
const { width, height, fps } = context;
|
|
249
|
+
const encoder = previewEncoderRung(which("ffmpeg"));
|
|
250
|
+
const top = previewSize(previewRungs()[0][0], width, height);
|
|
251
|
+
const durationSec = frameCount / fps;
|
|
252
|
+
const records = [];
|
|
253
|
+
for (const [longEdge, rungFps] of previewRungs()) {
|
|
254
|
+
const pvFps = Math.min(rungFps, fps);
|
|
255
|
+
const size = previewSize(longEdge, width, height);
|
|
256
|
+
const dir = path.join(runDir, "pv", `${longEdge}-${pvFps}`);
|
|
257
|
+
rmSync(dir, { recursive: true, force: true });
|
|
258
|
+
mkdirSync(dir, { recursive: true });
|
|
259
|
+
const count = Math.floor(durationSec * pvFps);
|
|
260
|
+
const frames = [];
|
|
261
|
+
for (let k = 0; k < count; k++) {
|
|
262
|
+
const source = Math.min(frameCount - 1, Math.round((k * fps) / pvFps));
|
|
263
|
+
const src = decodePng(readFileSync(path.join(runDir, "pv-src", `f${source}.png`)));
|
|
264
|
+
const pixels = size.width === top.width ? src.pixels : areaResize(src.pixels, top.width, top.height, size.width, size.height, 4);
|
|
265
|
+
writeFileSync(path.join(dir, `p${String(k).padStart(5, "0")}.png`), encodePng(size.width, size.height, pixels, 4, 1));
|
|
266
|
+
frames.push(pixels);
|
|
267
|
+
}
|
|
268
|
+
const file = await encodePreview(runDir, dir, pvFps, count, encoder);
|
|
269
|
+
const bytes = statSync(file).size;
|
|
270
|
+
log(`preview ${encoder} ${size.width}x${size.height} @ ${pvFps} fps: ${bytes} B`);
|
|
271
|
+
if (bytes <= 3_000_000 || longEdge === previewRungs().at(-1)[0]) {
|
|
272
|
+
const audit = auditSequence(frames, size.width, size.height, pvFps, true);
|
|
273
|
+
audit.records.forEach((record, k) => records.push({ stream: "preview", previewFrame: k, transitions: { up: record.up, down: record.down, redUp: record.redUp, redDown: record.redDown }, fullStep: record.fullStep }));
|
|
274
|
+
rmSync(path.join(runDir, "pv"), { recursive: true, force: true });
|
|
275
|
+
return { encoder, width: size.width, height: size.height, fps: pvFps, bytes, records };
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function previewSourceFrames(fps, frameCount) {
|
|
282
|
+
const sources = new Set();
|
|
283
|
+
for (const [, rungFps] of previewRungs()) {
|
|
284
|
+
const pvFps = Math.min(rungFps, fps);
|
|
285
|
+
const count = Math.floor((frameCount / fps) * pvFps);
|
|
286
|
+
for (let k = 0; k < count; k++) sources.add(Math.min(frameCount - 1, Math.round((k * fps) / pvFps)));
|
|
287
|
+
}
|
|
288
|
+
return sources;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Moves the previous round's exports aside so a new render never mixes with them.
|
|
292
|
+
function clearExports(out, runDir) {
|
|
293
|
+
const previous = path.join(runDir, "previous-round");
|
|
294
|
+
rmSync(previous, { recursive: true, force: true });
|
|
295
|
+
for (const name of ["film.mp4", "preview.webp", "preview.gif", "poster.png", "reduced-motion.png", "gate-report.txt", "manifest.json"]) {
|
|
296
|
+
for (const source of [path.join(out, name), path.join(out, "withheld", name), path.join(runDir, name)]) {
|
|
297
|
+
if (!existsSync(source)) continue;
|
|
298
|
+
mkdirSync(previous, { recursive: true });
|
|
299
|
+
renameSync(source, path.join(previous, `${path.basename(path.dirname(source))}-${name}`));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
rmSync(path.join(out, "withheld"), { recursive: true, force: true });
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export async function renderStage(out, { round = 1, stillsOnly = false } = {}) {
|
|
306
|
+
const context = prepareStage(out);
|
|
307
|
+
const runDir = path.join(out, ".run");
|
|
308
|
+
mkdirSync(runDir, { recursive: true });
|
|
309
|
+
const noFfmpeg = !stillsOnly && !which("ffmpeg");
|
|
310
|
+
const chromium = await loadPlaywright(context.state.nodeDir);
|
|
311
|
+
const began = performance.now();
|
|
312
|
+
const opened = await openChecked(chromium, context, path.join(runDir, "sm"));
|
|
313
|
+
const { stage, definition, webgl } = opened;
|
|
314
|
+
const frameCount = Math.round(definition.duration * context.fps);
|
|
315
|
+
const plan = stillsFor(context, frameCount);
|
|
316
|
+
const { posterFrame, stillFrame } = stageTargets(context, frameCount);
|
|
317
|
+
let stills;
|
|
318
|
+
try {
|
|
319
|
+
if (stillsOnly || noFfmpeg) {
|
|
320
|
+
const shots = await captureSampled(stage, plan.all);
|
|
321
|
+
const frames = new Map([...shots].map(([frame, png]) => [frame, decodeRgba(png)]));
|
|
322
|
+
stills = writeStillsSet(out, { width: context.width, height: context.height, fps: context.fps, frames, plan, round, pathName: "stage", beats: context.treatment.beats });
|
|
323
|
+
resolveTrack(out, context.treatment, { frameCount, fps: context.fps, cuts: stageCuts(context) });
|
|
324
|
+
writeFileSync(path.join(runDir, "stills-timing.json"), JSON.stringify({ frames: plan.all.length, totalSec: Number(((performance.now() - began) / 1000).toFixed(1)) }) + "\n");
|
|
325
|
+
if (noFfmpeg) throw exit(EXIT.BLOCKED_NO_FFMPEG_FOR_VIDEO, "BLOCKED_NO_FFMPEG_FOR_VIDEO", "ffmpeg not found on PATH; the stills and contact sheet were written; fix: install ffmpeg, or keep working from `stage --stills-only`, which needs no ffmpeg");
|
|
326
|
+
return { stillsOnly: true, stills, frameCount };
|
|
327
|
+
}
|
|
328
|
+
clearExports(out, runDir);
|
|
329
|
+
const samples = determinismSamples(context.treatment.beats, context.fps, frameCount);
|
|
330
|
+
const keep = new Set([...plan.all, ...samples, posterFrame, stillFrame]);
|
|
331
|
+
const replay = (async () => {
|
|
332
|
+
const opened2 = await openChecked(chromium, context, path.join(runDir, "sd"));
|
|
333
|
+
try { return await captureSampled(opened2.stage, samples, { exact: true }); } finally { await opened2.stage.close(); }
|
|
334
|
+
})();
|
|
335
|
+
const qa = (async () => {
|
|
336
|
+
const opened3 = await openChecked(chromium, context, path.join(runDir, "sq"), qaPageSource());
|
|
337
|
+
try { return await captureQa(opened3.stage, context, frameCount); } finally { await opened3.stage.close(); }
|
|
338
|
+
})();
|
|
339
|
+
replay.catch(() => {});
|
|
340
|
+
qa.catch(() => {});
|
|
341
|
+
const master = await captureMaster(context, stage, frameCount, keep, previewSourceFrames(context.fps, frameCount), runDir);
|
|
342
|
+
const replayShots = await replay;
|
|
343
|
+
progress(runDir, { phase: "finishing", frame: frameCount, frameCount });
|
|
344
|
+
// Determinism: SHA-256 of decoded RGBA, never PNG bytes.
|
|
345
|
+
const determinism = { method: "fresh browser, clock replayed sequentially from 0", frames: [] };
|
|
346
|
+
for (const frame of samples) {
|
|
347
|
+
const replayRgba = decodeRgba(replayShots.get(frame));
|
|
348
|
+
const entry = { frame, master: master.hashes.get(frame), replay: sha256(replayRgba) };
|
|
349
|
+
if (entry.master !== entry.replay) entry.region = firstDifferingRegion(decodeRgba(master.kept.get(frame)), replayRgba, context.width, context.height);
|
|
350
|
+
determinism.frames.push(entry);
|
|
351
|
+
}
|
|
352
|
+
writeFileSync(path.join(runDir, "determinism.json"), JSON.stringify(determinism, null, 2) + "\n");
|
|
353
|
+
const mismatch = determinism.frames.find((entry) => entry.master !== entry.replay);
|
|
354
|
+
if (mismatch) {
|
|
355
|
+
await Promise.allSettled([qa]);
|
|
356
|
+
const r = mismatch.region;
|
|
357
|
+
throw new StageError(18, "STAGE_NONDETERMINISTIC", `frame ${mismatch.frame} (${(mismatch.frame / context.fps).toFixed(2)} s) differs from a fresh replay${r ? `; first differing region ${r.width}x${r.height} at (${r.x}, ${r.y})` : ""}`);
|
|
358
|
+
}
|
|
359
|
+
const qaResult = analyseQa(await qa, context);
|
|
360
|
+
writeFileSync(path.join(runDir, "qa.json"), JSON.stringify(qaResult, null, 2) + "\n");
|
|
361
|
+
if (qaResult.missing.length) throw new StageError(17, "STAGE_CONTRACT_ERROR", `copy line never found on screen: ${qaResult.missing.map((line) => `"${line}"`).join(", ")}`);
|
|
362
|
+
const frames = new Map([...plan.all].map((frame) => [frame, decodeRgba(master.kept.get(frame))]));
|
|
363
|
+
stills = writeStillsSet(out, { width: context.width, height: context.height, fps: context.fps, frames, plan, round, pathName: "stage", beats: context.treatment.beats });
|
|
364
|
+
const poster = posterPng(decodeRgba(master.kept.get(posterFrame)), context.width, context.height);
|
|
365
|
+
writeFileSync(path.join(runDir, "poster.png"), poster.png);
|
|
366
|
+
writeFileSync(path.join(runDir, "reduced-motion.png"), encodePng(context.width, context.height, decodeRgba(master.kept.get(stillFrame)), 4, 9, true));
|
|
367
|
+
const preview = await buildPreview(context, runDir, frameCount);
|
|
368
|
+
rmSync(path.join(runDir, "pv-src"), { recursive: true, force: true });
|
|
369
|
+
if (preview) {
|
|
370
|
+
const fd = openSync(path.join(runDir, "stage-frames.jsonl"), "a");
|
|
371
|
+
for (const record of preview.records) writeSync(fd, JSON.stringify(record) + "\n");
|
|
372
|
+
closeSync(fd);
|
|
373
|
+
}
|
|
374
|
+
// Every planned track is muxed and checked on the decoded stream (exit 20 on a failure).
|
|
375
|
+
const track = resolveTrack(out, context.treatment, { frameCount, fps: context.fps, cuts: stageCuts(context) });
|
|
376
|
+
if (track.mode !== "none") {
|
|
377
|
+
const mixed = path.join(runDir, "film-audio.mp4");
|
|
378
|
+
muxTrack(path.join(runDir, "film.mp4"), track, frameCount / context.fps, mixed);
|
|
379
|
+
renameSync(mixed, path.join(runDir, "film.mp4"));
|
|
380
|
+
const failing = Object.entries(soundChecks(path.join(runDir, "film.mp4"), frameCount / context.fps, track.mode)).find(([, row]) => !row.pass && !row.warn);
|
|
381
|
+
if (failing) throw exit(SOUND_EXIT, "SOUND_INVALID", failing[1].detail);
|
|
382
|
+
}
|
|
383
|
+
const { mode, label, lufs, peakDbfs, palette, key, tempo } = track;
|
|
384
|
+
const sound = { mode, label, ...(track.file ? { file: path.relative(out, track.file) } : {}), ...(lufs !== undefined ? { lufs, peakDbfs, palette, key, tempo } : {}) };
|
|
385
|
+
const manifest = {
|
|
386
|
+
schemaVersion: 1, path: "stage", format: context.treatment.format, resolution: [context.width, context.height], fps: context.fps, frameCount,
|
|
387
|
+
durationSec: frameCount / context.fps, targetDurationSec: context.treatment.durationSec, seed: context.seed, craftRound: round,
|
|
388
|
+
chromeFlags: stage.flags, webgl, previewEncoder: preview?.encoder ?? null,
|
|
389
|
+
preview: preview ? { width: preview.width, height: preview.height, fps: preview.fps, bytes: preview.bytes } : null,
|
|
390
|
+
posterFrame, posterSize: [poster.width, poster.height], stillFrame, determinismFrames: samples,
|
|
391
|
+
timing: { ...master.timing, totalSec: Number(((performance.now() - began) / 1000).toFixed(1)) },
|
|
392
|
+
sound, qa: { file: ".run/qa.json", samples: qaResult.samples.length, trackFrames: qaResult.trackFrames, allowedFaces: qaResult.allowedFaces },
|
|
393
|
+
treatmentSha256: sha256(readFileSync(path.join(out, "treatment.json"))), stageSha256: stageSha(context.stageDir),
|
|
394
|
+
stillsSha256: sha256(readFileSync(path.join(out, "stills", "stills.json"))), pageErrors: stage.errors.slice(0, 5), missingAssets: stage.missing.slice(0, 5),
|
|
395
|
+
generatedAt: new Date().toISOString()
|
|
396
|
+
};
|
|
397
|
+
writeFileSync(path.join(out, "manifest.json"), JSON.stringify(manifest, null, 2) + "\n");
|
|
398
|
+
progress(runDir, { phase: "done", frame: frameCount, frameCount });
|
|
399
|
+
return { stillsOnly: false, stills, frameCount, manifest };
|
|
400
|
+
} finally {
|
|
401
|
+
await stage.close();
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// `render.mjs stage [--detach]`: a detached run writes its log and exit code under .run/ so a host
|
|
406
|
+
// tool timeout never kills a long render.
|
|
407
|
+
export function detachStage(out, args) {
|
|
408
|
+
const runDir = path.join(out, ".run");
|
|
409
|
+
mkdirSync(runDir, { recursive: true });
|
|
410
|
+
const logFile = path.join(runDir, "render.log");
|
|
411
|
+
rmSync(path.join(runDir, "render-exit.json"), { force: true });
|
|
412
|
+
const fd = openSync(logFile, "w");
|
|
413
|
+
const child = spawn(process.execPath, [path.join(skillRoot, "render.mjs"), "stage", ...args.filter((arg) => arg !== "--detach"), "--exit-file", path.join(runDir, "render-exit.json")], { detached: true, stdio: ["ignore", fd, fd] });
|
|
414
|
+
child.unref();
|
|
415
|
+
closeSync(fd);
|
|
416
|
+
return { pid: child.pid, logFile, progressFile: path.join(runDir, "progress.json"), exitFile: path.join(runDir, "render-exit.json") };
|
|
417
|
+
}
|
|
418
|
+
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Pre-flight scan of a stage directory, before any browser starts. It refuses what the capture can
|
|
2
|
+
// never make deterministic or offline: external URLs and preconnect hints (exit 19), forbidden
|
|
3
|
+
// elements and APIs, flipbooks and animated rasters, and a raster budget overrun (exit 17). The same
|
|
4
|
+
// rules also run live in the page (clock.js); this scan names the file and line first.
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
6
|
+
import { lstatSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
|
|
9
|
+
export const STAGE_CONTRACT = 17;
|
|
10
|
+
export const STAGE_NETWORK = 19;
|
|
11
|
+
export const rasterExtensions = new Set([".png", ".jpg", ".jpeg", ".webp", ".gif"]);
|
|
12
|
+
const textExtensions = new Set([".html", ".htm", ".js", ".mjs", ".css", ".svg", ".json"]);
|
|
13
|
+
export const contentTypes = Object.freeze({
|
|
14
|
+
".html": "text/html; charset=utf-8", ".htm": "text/html; charset=utf-8", ".js": "text/javascript; charset=utf-8", ".mjs": "text/javascript; charset=utf-8",
|
|
15
|
+
".css": "text/css; charset=utf-8", ".svg": "image/svg+xml", ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp",
|
|
16
|
+
".gif": "image/gif", ".wav": "audio/wav", ".woff": "font/woff", ".woff2": "font/woff2", ".ttf": "font/ttf", ".otf": "font/otf", ".json": "application/json"
|
|
17
|
+
});
|
|
18
|
+
export const rasterLimits = Object.freeze({ files: 24, bytes: 8 * 1024 * 1024, sameSizeFlipbook: 10 });
|
|
19
|
+
// XML namespace identifiers are names, not requests.
|
|
20
|
+
const namespaceUris = /https?:\/\/www\.w3\.org\/(?:2000\/svg|1999\/xlink|1999\/xhtml|XML\/1998\/namespace|2000\/xmlns\/?|1998\/Math\/MathML)/gu;
|
|
21
|
+
|
|
22
|
+
export class StageError extends Error {
|
|
23
|
+
constructor(code, name, detail) { super(`${name} (${code}): ${detail}`); this.exitCode = code; this.stageName = name; }
|
|
24
|
+
}
|
|
25
|
+
const contract = (detail) => new StageError(STAGE_CONTRACT, "STAGE_CONTRACT_ERROR", detail);
|
|
26
|
+
const network = (detail) => new StageError(STAGE_NETWORK, "STAGE_NETWORK_REQUEST", detail);
|
|
27
|
+
|
|
28
|
+
export function listStage(stageDir) {
|
|
29
|
+
const files = [];
|
|
30
|
+
const walk = (rel) => {
|
|
31
|
+
for (const entry of readdirSync(path.join(stageDir, rel), { withFileTypes: true })) {
|
|
32
|
+
const next = rel ? `${rel}/${entry.name}` : entry.name;
|
|
33
|
+
const full = path.join(stageDir, next);
|
|
34
|
+
if (lstatSync(full).isSymbolicLink()) {
|
|
35
|
+
const target = realpathSync(full);
|
|
36
|
+
if (!insideDir(realpathSync(stageDir), target)) throw contract(`${next} is a symlink that leaves the stage directory`);
|
|
37
|
+
}
|
|
38
|
+
if (entry.isDirectory()) walk(next); else files.push(next);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
walk("");
|
|
42
|
+
return files.sort();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function insideDir(root, target) {
|
|
46
|
+
const relative = path.relative(root, target);
|
|
47
|
+
return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const lineOf = (text, index) => text.slice(0, index).split("\n").length;
|
|
51
|
+
|
|
52
|
+
// Width and height from a raster header, plus whether it animates.
|
|
53
|
+
export function rasterInfo(bytes, ext) {
|
|
54
|
+
if (ext === ".png") {
|
|
55
|
+
if (bytes.readUInt32BE(0) !== 0x89504e47) return null;
|
|
56
|
+
let offset = 8, animated = false;
|
|
57
|
+
while (offset + 8 <= bytes.length) {
|
|
58
|
+
const length = bytes.readUInt32BE(offset), type = bytes.toString("ascii", offset + 4, offset + 8);
|
|
59
|
+
if (type === "acTL") animated = true;
|
|
60
|
+
if (type === "IDAT" || type === "IEND") break;
|
|
61
|
+
offset += 12 + length;
|
|
62
|
+
}
|
|
63
|
+
return { width: bytes.readUInt32BE(16), height: bytes.readUInt32BE(20), animated };
|
|
64
|
+
}
|
|
65
|
+
if (ext === ".gif") {
|
|
66
|
+
const width = bytes.readUInt16LE(6), height = bytes.readUInt16LE(8);
|
|
67
|
+
let offset = 13 + (bytes[10] & 0x80 ? 3 * 2 ** ((bytes[10] & 7) + 1) : 0), images = 0;
|
|
68
|
+
const skipBlocks = () => { while (offset < bytes.length && bytes[offset] !== 0) offset += bytes[offset] + 1; offset += 1; };
|
|
69
|
+
while (offset < bytes.length) {
|
|
70
|
+
const marker = bytes[offset];
|
|
71
|
+
if (marker === 0x3b) break;
|
|
72
|
+
if (marker === 0x21) { offset += 2; skipBlocks(); continue; }
|
|
73
|
+
if (marker === 0x2c) {
|
|
74
|
+
images += 1;
|
|
75
|
+
const flags = bytes[offset + 9];
|
|
76
|
+
offset += 10 + (flags & 0x80 ? 3 * 2 ** ((flags & 7) + 1) : 0) + 1;
|
|
77
|
+
skipBlocks();
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
return { width, height, animated: images > 1 };
|
|
83
|
+
}
|
|
84
|
+
if (ext === ".webp") {
|
|
85
|
+
if (bytes.toString("ascii", 0, 4) !== "RIFF" || bytes.toString("ascii", 8, 12) !== "WEBP") return null;
|
|
86
|
+
let offset = 12, width = 0, height = 0, animated = false;
|
|
87
|
+
while (offset + 8 <= bytes.length) {
|
|
88
|
+
const type = bytes.toString("ascii", offset, offset + 4), size = bytes.readUInt32LE(offset + 4), data = offset + 8;
|
|
89
|
+
if (type === "ANIM" || type === "ANMF") animated = true;
|
|
90
|
+
if (type === "VP8X") { animated ||= Boolean(bytes[data] & 0x02); width = 1 + bytes.readUIntLE(data + 4, 3); height = 1 + bytes.readUIntLE(data + 7, 3); }
|
|
91
|
+
else if (type === "VP8 " && !width) { width = bytes.readUInt16LE(data + 6) & 0x3fff; height = bytes.readUInt16LE(data + 8) & 0x3fff; }
|
|
92
|
+
else if (type === "VP8L" && !width) { const b = bytes.readUInt32LE(data + 1); width = (b & 0x3fff) + 1; height = ((b >> 14) & 0x3fff) + 1; }
|
|
93
|
+
offset = data + size + (size & 1);
|
|
94
|
+
}
|
|
95
|
+
return { width, height, animated };
|
|
96
|
+
}
|
|
97
|
+
if (ext === ".jpg" || ext === ".jpeg") {
|
|
98
|
+
let offset = 2;
|
|
99
|
+
while (offset + 9 < bytes.length) {
|
|
100
|
+
if (bytes[offset] !== 0xff) { offset += 1; continue; }
|
|
101
|
+
const marker = bytes[offset + 1];
|
|
102
|
+
if (marker >= 0xc0 && marker <= 0xcf && ![0xc4, 0xc8, 0xcc].includes(marker)) return { height: bytes.readUInt16BE(offset + 5), width: bytes.readUInt16BE(offset + 7), animated: false };
|
|
103
|
+
offset += 2 + bytes.readUInt16BE(offset + 2);
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Throws a StageError for the first violation; returns the raster list for pre-decoding.
|
|
111
|
+
export function scanStage(stageDir) {
|
|
112
|
+
const files = listStage(stageDir);
|
|
113
|
+
if (!files.includes("index.html")) throw contract("stage/index.html is missing");
|
|
114
|
+
const rasters = [];
|
|
115
|
+
let rasterBytes = 0;
|
|
116
|
+
for (const rel of files) {
|
|
117
|
+
const ext = path.extname(rel).toLowerCase();
|
|
118
|
+
const full = path.join(stageDir, rel);
|
|
119
|
+
if (!Object.hasOwn(contentTypes, ext)) throw contract(`${rel}: ${ext || "extensionless"} files are not served on the stage`);
|
|
120
|
+
if (rasterExtensions.has(ext)) {
|
|
121
|
+
const bytes = readFileSync(full);
|
|
122
|
+
const info = rasterInfo(bytes, ext);
|
|
123
|
+
if (!info) throw contract(`${rel} is not a readable ${ext.slice(1)} image`);
|
|
124
|
+
if (info.animated) throw contract(`${rel} is an animated raster; animate on the stage instead`);
|
|
125
|
+
rasters.push({ rel, ...info, bytes: bytes.length });
|
|
126
|
+
rasterBytes += bytes.length;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (!textExtensions.has(ext)) continue;
|
|
130
|
+
const text = readFileSync(full, "utf8").replace(namespaceUris, "");
|
|
131
|
+
// Comments are not requests: drop block, HTML and line comments before looking for URLs.
|
|
132
|
+
const scripted = [".js", ".mjs", ".html", ".htm"].includes(ext);
|
|
133
|
+
const code = ext === ".json" ? text : text.replace(/\/\*[\s\S]*?\*\//gu, " ").replace(/<!--[\s\S]*?-->/gu, " ").replace(scripted ? /(^|[\s;{}(,>])\/\/[^\n]*/gu : /$^/u, "$1");
|
|
134
|
+
const external = code.match(/https?:\/\/[^\s"'`)<>]+/u);
|
|
135
|
+
if (external) throw network(`${rel}:${lineOf(code, external.index)} names an external URL (${external[0]})`);
|
|
136
|
+
const protocolRelative = code.match(/(?:\b(?:src|href|action|poster|data|srcset)\s*=\s*["']?|url\(\s*["']?|\bimport\s*(?:\(\s*)?["']|\bfetch\s*\(\s*["'])\/\/[^\s"'/)]/u);
|
|
137
|
+
if (protocolRelative) throw network(`${rel}:${lineOf(code, protocolRelative.index)} names a protocol-relative URL`);
|
|
138
|
+
const hint = code.match(/<link\b[^>]*\brel\s*=\s*["']?(?:preconnect|dns-prefetch|prefetch|prerender)\b/iu);
|
|
139
|
+
if (hint) throw network(`${rel}:${lineOf(code, hint.index)} has a ${hint[0].match(/preconnect|dns-prefetch|prefetch|prerender/iu)[0]} link`);
|
|
140
|
+
const channel = code.match(/\b(?:WebSocket|WebTransport|RTCPeerConnection)\b/u);
|
|
141
|
+
if (channel) throw network(`${rel}:${lineOf(code, channel.index)} uses ${channel[0]}`);
|
|
142
|
+
if (ext === ".html" || ext === ".htm" || ext === ".svg") {
|
|
143
|
+
const element = code.match(/<(video|audio|iframe|object|embed|frame)\b/iu);
|
|
144
|
+
if (element) throw contract(`${rel}:${lineOf(code, element.index)} has a <${element[1].toLowerCase()}> element`);
|
|
145
|
+
}
|
|
146
|
+
const api = code.match(/\bnew\s+Audio\s*\(|\b(?:webkit)?AudioContext\b|\bOfflineAudioContext\b|\bnew\s+(?:Shared)?Worker\s*\(|\bSharedWorker\b|serviceWorker\s*\.\s*register/u);
|
|
147
|
+
if (api) throw contract(`${rel}:${lineOf(code, api.index)} uses ${api[0].trim()}`);
|
|
148
|
+
}
|
|
149
|
+
if (rasters.length > rasterLimits.files) throw contract(`${rasters.length} raster files; the stage allows at most ${rasterLimits.files}`);
|
|
150
|
+
if (rasterBytes > rasterLimits.bytes) throw contract(`${rasterBytes} bytes of rasters; the stage allows at most ${rasterLimits.bytes}`);
|
|
151
|
+
const bySize = new Map();
|
|
152
|
+
for (const raster of rasters) bySize.set(`${raster.width}x${raster.height}`, [...(bySize.get(`${raster.width}x${raster.height}`) ?? []), raster.rel]);
|
|
153
|
+
for (const [size, list] of bySize) if (list.length >= rasterLimits.sameSizeFlipbook) throw contract(`${list.length} rasters share the size ${size} (a flipbook); rasters are textures and stills, never a frame sequence`);
|
|
154
|
+
return { files, rasters };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// One hash over every stage file's name and bytes: a render records it, the done check compares it.
|
|
158
|
+
export function stageSha(stageDir) {
|
|
159
|
+
const hash = createHash("sha256");
|
|
160
|
+
for (const rel of listStage(stageDir)) { hash.update(rel); hash.update(readFileSync(path.join(stageDir, rel))); }
|
|
161
|
+
return hash.digest("hex");
|
|
162
|
+
}
|