@litfamily/lithermes 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/README.md +299 -13
- package/README_Ko-KR.md +300 -14
- package/assets/lithermes-plugin/README.md +17 -6
- package/assets/lithermes-plugin/__init__.py +96 -21
- package/assets/lithermes-plugin/core.py +15 -6
- package/assets/lithermes-plugin/core_commands.py +140 -28
- package/assets/lithermes-plugin/core_contexts.py +88 -15
- package/assets/lithermes-plugin/core_contract.py +118 -9
- package/assets/lithermes-plugin/core_routing.py +197 -8
- package/assets/lithermes-plugin/deliverable_hedge_guard.py +378 -357
- package/assets/lithermes-plugin/diagnostics.py +76 -8
- package/assets/lithermes-plugin/humanizer_detector.py +348 -0
- package/assets/lithermes-plugin/humanizer_ko_metrics.py +108 -0
- package/assets/lithermes-plugin/humanizer_office.py +18 -0
- package/assets/lithermes-plugin/lit_mark.py +1 -1
- package/assets/lithermes-plugin/motion_receipts.py +80 -0
- package/assets/lithermes-plugin/payload-version.json +2240 -64
- package/assets/lithermes-plugin/plugin.yaml +1 -1
- package/assets/lithermes-plugin/rules/bundled-rules/lit-humanizer.md +14 -0
- package/assets/lithermes-plugin/skills/autoconference/assets/report_template.md +2 -1
- package/assets/lithermes-plugin/skills/autoconference/modes/ship/SKILL.md +11 -8
- package/assets/lithermes-plugin/skills/autoresearch/modes/ship/type-checklists.md +2 -2
- package/assets/lithermes-plugin/skills/browser-drive/ORIGIN.json +17 -0
- package/assets/lithermes-plugin/skills/browser-drive/SKILL.md +41 -16
- package/assets/lithermes-plugin/skills/browser-drive/scripts/capability_probe.py +122 -10
- package/assets/lithermes-plugin/skills/frontend-ui-ux/SKILL.md +45 -13
- package/assets/lithermes-plugin/skills/frontend-ui-ux/examples/phase-3-readme-ab/README.md +51 -0
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/README.md +44 -0
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/adaptive-layout.md +34 -62
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/brand-and-imagery.md +22 -70
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/complete-contract.md +18 -4
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/composition.md +27 -78
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/craft-floor.md +74 -0
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/creative-directions.md +25 -69
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/evidence-review.md +18 -97
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/implementation-platforms.md +23 -83
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/inclusive-interface.md +22 -70
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/interaction-motion.md +34 -68
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/motion-guide.md +62 -0
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/operating-lanes.md +14 -78
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/performance-delivery.md +22 -71
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/product-direction.md +17 -70
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/production.md +19 -7
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/redesign-playbook.md +23 -76
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/slop-register.md +69 -0
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/system-foundations.md +22 -67
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/visual-language.md +16 -72
- package/assets/lithermes-plugin/skills/frontend-ui-ux/references/visual-reconstruction.md +16 -81
- package/assets/lithermes-plugin/skills/frontend-ui-ux/resources/THIRD-PARTY-NOTICE.txt +15 -0
- package/assets/lithermes-plugin/skills/frontend-ui-ux/scripts/probe-page.js +311 -0
- package/assets/lithermes-plugin/skills/frontend-ui-ux/scripts/probe-rules.json +46 -0
- package/assets/lithermes-plugin/skills/frontend-ui-ux/scripts/probe.mjs +231 -0
- package/assets/lithermes-plugin/skills/lit-comprehend/SKILL.md +36 -25
- package/assets/lithermes-plugin/skills/lit-comprehend/references/artifact-template.md +45 -87
- package/assets/lithermes-plugin/skills/lit-comprehend/scripts/verify-explainer.py +3 -27
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/NOTICE +33 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/SKILL.md +308 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-architecture-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-architecture-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-architecture-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-bar-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-bar-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-bar-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-beeswarm-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-beeswarm-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-beeswarm-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-bubble-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-bubble-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-bubble-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-bump-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-bump-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-bump-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-data-flow-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-data-flow-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-data-flow-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-datalake-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-datalake-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-datalake-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-db-schema-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-db-schema-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-db-schema-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-dependency-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-dependency-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-dependency-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-deployment-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-deployment-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-deployment-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-dp-integration-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-dp-integration-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-dp-integration-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-er-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-er-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-er-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-fishbone-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-fishbone-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-fishbone-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-flowchart-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-flowchart-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-flowchart-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-gantt-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-gantt-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-gantt-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-heatmap-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-heatmap-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-heatmap-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-high-level-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-high-level-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-high-level-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-import-drawio-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-import-drawio-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-import-drawio-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-it-state-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-it-state-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-it-state-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-journey-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-journey-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-journey-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-kanban-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-kanban-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-kanban-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-layers-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-layers-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-layers-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-line-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-line-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-line-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-loop-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-loop-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-loop-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-marimekko-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-marimekko-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-marimekko-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-medallion-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-medallion-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-medallion-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-nested-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-nested-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-nested-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-org-chart-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-org-chart-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-org-chart-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-polar-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-polar-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-polar-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-process-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-process-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-process-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-pyramid-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-pyramid-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-pyramid-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-quadrant-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-quadrant-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-quadrant-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-queue-animated-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-queue-animated-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-queue-animated-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-radar-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-radar-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-radar-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-ridgeline-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-ridgeline-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-ridgeline-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-sankey-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-sankey-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-sankey-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-scatter-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-scatter-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-scatter-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-sequence-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-sequence-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-sequence-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-slopegraph-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-slopegraph-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-slopegraph-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-state-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-state-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-state-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-story-map-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-story-map-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-story-map-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-streamgraph-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-streamgraph-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-streamgraph-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-swimlane-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-swimlane-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-swimlane-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-timeline-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-timeline-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-timeline-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-tree-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-tree-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-tree-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-treemap-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-treemap-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-treemap-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-uml-class-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-uml-class-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-uml-class-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-venn-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-venn-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-venn-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-wardley-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-wardley-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-wardley-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-waterfall-dark.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-waterfall-full.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/examples/type-waterfall-light.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/fonts/OFL.txt +94 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/fonts/PretendardVariable.woff2 +0 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/fonts/provenance.json +22 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/icons.html +231 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/index.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/licenses/devicon-MIT.txt +20 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/licenses/diagram-design-MIT.txt +21 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/licenses/log-z-MIT.txt +21 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/licenses/simple-icons-CC0.md +30 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/assets/licenses/tabler-MIT.txt +21 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/01-service-architecture/after.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/01-service-architecture/brief.md +33 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/02-release-decision/after.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/02-release-decision/brief.md +18 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/03-data-retention/after.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/03-data-retention/brief.md +19 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/04-oauth-sequence/after.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/04-oauth-sequence/brief.md +17 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/05-review-lanes/after.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/05-review-lanes/brief.md +17 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/06-rollout-gates/after.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/06-rollout-gates/brief.md +17 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/07-deployment-boundary/after.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/07-deployment-boundary/brief.md +19 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/08-policy-traces/after.html +1 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/examples/08-policy-traces/brief.md +20 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/accessibility.md +37 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/export.md +29 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/import-drawio.md +21 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/import-excalidraw.md +14 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/import-mermaid.md +18 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/import-schema.md +28 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/korean-typography.md +34 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/motion.md +29 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/office-pptx-docx.md +40 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/output-spec.md +48 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/primitive-annotation.md +12 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/primitive-icons.md +21 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/primitive-sketchy.md +11 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/primitive-terminal.md +11 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/profiles.md +24 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/semantic-patterns.md +27 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/style-guide.md +67 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-architecture.md +51 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-bar.md +51 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-beeswarm.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-bubble.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-bump.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-catalog.json +1433 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-data-flow.md +51 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-datalake.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-db-schema.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-dependency.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-deployment.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-dp-integration.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-dp-security-matrix.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-er.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-fishbone.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-flowchart.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-gantt.md +49 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-heatmap.md +53 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-high-level-vertical.md +53 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-high-level.md +53 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-import-drawio.md +53 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-import-excalidraw.md +53 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-import-mermaid.md +53 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-it-state.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-journey.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-kanban.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-layers.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-line.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-loop-terminal.md +53 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-loop.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-marimekko.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-medallion.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-nested.md +59 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-org-chart.md +58 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-paved-road-animated.md +72 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-polar.md +67 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-policy-trace-animated.md +69 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-process.md +58 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-pyramid.md +59 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-quadrant-consultant.md +60 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-quadrant.md +57 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-queue-animated.md +63 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-radar.md +57 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-ridgeline.md +63 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-sankey.md +68 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-scatter.md +60 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-sequence-oauth.md +66 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-sequence.md +63 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-slopegraph.md +65 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-state-lifecycle.md +53 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-state.md +59 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-story-map.md +52 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-streamgraph.md +53 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-swimlane.md +52 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-timeline.md +52 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +57 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-tree.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-treemap.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-uml-class.md +52 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-venn.md +51 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-wardley.md +52 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/type-waterfall.md +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/references/verifier-guide.md +31 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/block-registry.mjs +43 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/browser-version.mjs +12 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/check-visible-text.py +12 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/diagram_brief.py +192 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/diagram_catalog.py +135 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/diagram_checks.py +123 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/diagram_cli.py +94 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/diagram_geometry.py +130 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/diagram_metrics.py +166 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/diagram_quality.py +293 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/diagram_quality_geometry.py +200 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/diagram_records.py +205 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/diagram_sequence.py +55 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/doctor.mjs +24 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/drawio_extract.py +209 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/drawio_source.py +188 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/excalidraw_extract.py +233 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/excalidraw_support.py +64 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/export.mjs +125 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/mermaid_extract.py +240 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/mermaid_source.py +39 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/office-safety.mjs +54 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/verify-all.py +12 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/verify-brief.py +12 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/verify-diagram.py +12 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/verify-motion.py +12 -0
- package/assets/lithermes-plugin/skills/lit-diagram-drawer/scripts/verify-type.py +12 -0
- package/assets/lithermes-plugin/skills/lit-docx/NOTICE +1 -0
- package/assets/lithermes-plugin/skills/lit-docx/SKILL.md +97 -0
- package/assets/lithermes-plugin/skills/lit-docx/references/frontmatter_schema.md +42 -0
- package/assets/lithermes-plugin/skills/lit-docx/references/journal_style_spec.md +17 -0
- package/assets/lithermes-plugin/skills/lit-docx/references/markdown_quality_checklist.md +37 -0
- package/assets/lithermes-plugin/skills/lit-docx/references/slop_phrase_list.yaml +58 -0
- package/assets/lithermes-plugin/skills/lit-docx/references/slop_rules.md +35 -0
- package/assets/lithermes-plugin/skills/lit-docx/scripts/clean_markdown.py +95 -0
- package/assets/lithermes-plugin/skills/lit-docx/scripts/convert_md_to_docx.py +1041 -0
- package/assets/lithermes-plugin/skills/lit-docx/scripts/convert_md_to_pdf.py +281 -0
- package/assets/lithermes-plugin/skills/lit-docx/scripts/convert_pdf.py +130 -0
- package/assets/lithermes-plugin/skills/lit-docx/scripts/edit_docx.py +297 -0
- package/assets/lithermes-plugin/skills/lit-docx/scripts/embed_images.py +78 -0
- package/assets/lithermes-plugin/skills/lit-docx/scripts/generate_docx_templates.py +491 -0
- package/assets/lithermes-plugin/skills/lit-docx/scripts/slop_lint.py +536 -0
- package/assets/lithermes-plugin/skills/lit-docx/scripts/visual_audit.py +41 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/docx/acs.docx +0 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/docx/elsevier.docx +0 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/docx/ieee.docx +0 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/docx/korean-generic.docx +0 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/docx/nature.docx +0 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/latex/acs/README.md +5 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/latex/acs/template.tex +37 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/latex/elsevier/README.md +5 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/latex/elsevier/template.tex +38 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/latex/ieee/README.md +5 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/latex/ieee/template.tex +37 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/latex/korean-generic/README.md +5 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/latex/korean-generic/template.tex +37 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/latex/nature/README.md +5 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/latex/nature/template.tex +37 -0
- package/assets/lithermes-plugin/skills/lit-docx/templates/registry.yaml +1366 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/NOTICE +170 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/SKILL.md +125 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/assets/report-skeleton.md +26 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/assets/slide-text-skeleton.md +30 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/accessibility-note/after.md +7 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/accessibility-note/before.md +7 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/api-reference/after.md +9 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/api-reference/before.md +15 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/changelog/after.md +5 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/changelog/before.md +12 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/code-comments/after.md +10 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/code-comments/before.md +19 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/commit/after.md +5 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/commit/before.md +7 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/data-release/after.md +7 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/data-release/before.md +9 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/detector-validation/ko-metrics-golden.json +49 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/detector-validation/pos-real.txt +26 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/detector-validation/rule-cases.json +306 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/english-essay/after.md +5 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/english-essay/before.md +5 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/incident-update/after.md +7 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/incident-update/before.md +7 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/ko-essay/after.md +7 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/ko-essay/before.md +9 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/ko-report/after.md +9 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/ko-report/before.md +13 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/ko-slide/after.md +19 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/ko-slide/before.md +21 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/meeting-brief/after.md +9 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/meeting-brief/before.md +11 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/policy-faq/after.md +9 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/policy-faq/before.md +9 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/pr/after.md +15 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/pr/before.md +17 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/project-update/after.md +7 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/project-update/before.md +9 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/readme/after.md +12 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/readme/before.md +14 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/report/after.md +13 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/report/before.md +11 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/research-abstract/after.md +5 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/research-abstract/before.md +5 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/slides/after.md +19 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/slides/before.md +19 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/troubleshooting/after.md +11 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/examples/troubleshooting/before.md +11 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/README.md +16 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/always-on-rule.md +9 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/code-patterns.md +468 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/deliverable-channels.md +111 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/en-patterns-checklist.md +43 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/en-patterns-content.md +243 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/en-patterns-structure.md +375 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/en-patterns.md +57 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/ko-metrics.md +33 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/ko-patterns-a-d.md +659 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/ko-patterns-e-j.md +387 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/ko-patterns.md +31 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/rewrite-playbook.md +54 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/references/taxonomy.md +153 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/rules.json +884 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/scripts/detect.py +17 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/scripts/extract_office_text.py +114 -0
- package/assets/lithermes-plugin/skills/lit-humanizer/scripts/ko_metrics.py +35 -0
- package/assets/lithermes-plugin/skills/lit-pptx/NOTICE +1 -0
- package/assets/lithermes-plugin/skills/lit-pptx/SKILL.md +109 -0
- package/assets/lithermes-plugin/skills/lit-pptx/agents/analyst.md +49 -0
- package/assets/lithermes-plugin/skills/lit-pptx/agents/antithesis.md +65 -0
- package/assets/lithermes-plugin/skills/lit-pptx/agents/architect.md +44 -0
- package/assets/lithermes-plugin/skills/lit-pptx/agents/critic.md +42 -0
- package/assets/lithermes-plugin/skills/lit-pptx/agents/synthesizer.md +47 -0
- package/assets/lithermes-plugin/skills/lit-pptx/agents/thesis.md +33 -0
- package/assets/lithermes-plugin/skills/lit-pptx/assets/azure/circle-lg.png +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/assets/azure/circle-md.png +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/assets/azure/circle-sm.png +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/bin/office.mjs +77 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/PRETENDARD-OFL.txt +94 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/A2Z-Black.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/A2Z-Bold.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/A2Z-ExtraBold.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/A2Z-ExtraLight.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/A2Z-Light.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/A2Z-Medium.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/A2Z-Regular.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/A2Z-SemiBold.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/A2Z-Thin.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/OFL.txt +94 -0
- package/assets/lithermes-plugin/skills/lit-pptx/fonts/a2z-font/SOURCE.md +29 -0
- package/assets/lithermes-plugin/skills/lit-pptx/pretendard-font/public/static/PretendardGOV-Bold.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/pretendard-font/public/static/PretendardGOV-Regular.otf +0 -0
- package/assets/lithermes-plugin/skills/lit-pptx/references/anti-slop-checklist.md +71 -0
- package/assets/lithermes-plugin/skills/lit-pptx/references/authoring-guide.md +139 -0
- package/assets/lithermes-plugin/skills/lit-pptx/references/consensus-protocol.md +125 -0
- package/assets/lithermes-plugin/skills/lit-pptx/references/data-display-cookbook.md +45 -0
- package/assets/lithermes-plugin/skills/lit-pptx/references/design-system-azure.md +58 -0
- package/assets/lithermes-plugin/skills/lit-pptx/runtime/package-lock.json +750 -0
- package/assets/lithermes-plugin/skills/lit-pptx/runtime/package.json +15 -0
- package/assets/lithermes-plugin/skills/lit-pptx/runtime/requirements.in +7 -0
- package/assets/lithermes-plugin/skills/lit-pptx/runtime/requirements.lock +391 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/compile-deck.js +447 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/craft_extras.py +215 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/embed_fonts.py +199 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/integrity.py +60 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/inventory.py +64 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/learn_template.py +433 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/derive-palette.js +176 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/directive-parser.js +244 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/font-map.js +79 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/gen-bg.js +85 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/gen-gradient-assets.js +36 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/layout-resolver.js +736 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/markdown-loader.js +136 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/render-adapter-html.js +357 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/render-adapter-pptx.js +1864 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/slide-ast.js +539 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/spec-validator.js +94 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/lib/template-registry.js +355 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/qa_deck.py +791 -0
- package/assets/lithermes-plugin/skills/lit-pptx/scripts/validate_pptx.py +206 -0
- package/assets/lithermes-plugin/skills/lit-pptx/slide-formats/markdown-slide-spec-v1.md +251 -0
- package/assets/lithermes-plugin/skills/lit-pptx/slide-formats/markdown-slide-spec-v2.md +221 -0
- package/assets/lithermes-plugin/skills/lit-pptx/slide-formats/slide-ast-v1.schema.json +229 -0
- package/assets/lithermes-plugin/skills/lit-pptx/slide-formats/slide-ast-v2.schema.json +144 -0
- package/assets/lithermes-plugin/skills/lit-pptx/slide-formats/template-enrollment-contract.md +228 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/AZURE-A2Z/capabilities.yaml +146 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/AZURE-A2Z/layout-mapping.yaml +384 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/AZURE-A2Z/template.yaml +37 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/AZURE-PRO/capabilities.yaml +154 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/AZURE-PRO/layout-mapping.yaml +405 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/AZURE-PRO/template.yaml +37 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/capabilities.yaml +179 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/layout-mapping.yaml +299 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/template.yaml +45 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/capabilities.yaml +181 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/layout-mapping.yaml +299 -0
- package/assets/lithermes-plugin/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/template.yaml +44 -0
- package/assets/lithermes-plugin/skills/lit-scientific-visualization/SKILL.md +2 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/SKILL.md +71 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/bin/audio.py +45 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/bin/motion.mjs +690 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/bin/runtime.mjs +299 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/NOTICE +23 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +55 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/browser.mjs +169 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/completion.mjs +52 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/constants.mjs +162 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/director.mjs +33 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/encode.mjs +191 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/flash.mjs +163 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/frame.mjs +428 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/gate.mjs +483 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/look.mjs +223 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/page.js +622 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/presets.mjs +170 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/scenes.mjs +242 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/sound.mjs +382 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/stage-gate.mjs +97 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/stage-init.js +186 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/stage-kit.js +389 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/stage-qa.mjs +358 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/stage-worker.mjs +33 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/stage.mjs +691 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/stills.mjs +71 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/stroke.mjs +231 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/timeline.mjs +177 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/treatment.mjs +244 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/type.mjs +183 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/engine/util.mjs +152 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/references/craft-loop.md +175 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/references/engine-contract.md +166 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/references/runtime.md +122 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/references/stage.md +261 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/references/style-bibles.md +122 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/references/treatment.md +164 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/references/type-craft.md +92 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/runtime/fonts.json +154 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/runtime/licenses/CREDITS +20 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/runtime/licenses/EMS-OFL.txt +91 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/runtime/package-lock.json +88 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/runtime/package.json +12 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/runtime/requirements.in +1 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/runtime/requirements.lock +727 -0
- package/assets/lithermes-plugin/skills/lit-typographic-motion/runtime/word-timing.json +9 -0
- package/assets/lithermes-plugin/skills/litresearch/SKILL.md +19 -18
- package/assets/lithermes-plugin/skills/litwork/SKILL.md +28 -0
- package/assets/lithermes-plugin/skills/visual-qa/references/complete-contract.md +3 -3
- package/package.json +1 -1
- package/readme-assets/ab-simple/s11-ui-baseline-desktop.webp +0 -0
- package/readme-assets/ab-simple/s11-ui-lithermes-desktop.webp +0 -0
- package/readme-assets/ab-simple/s3-ui-baseline-desktop.webp +0 -0
- package/readme-assets/ab-simple/s3-ui-lithermes-desktop.webp +0 -0
- package/readme-assets/ab-simple/s4-ui-baseline-desktop.webp +0 -0
- package/readme-assets/ab-simple/s4-ui-lithermes-desktop.webp +0 -0
- package/readme-assets/ab-simple/s5-office-baseline-slides.webp +0 -0
- package/readme-assets/ab-simple/s5-office-lithermes-slides.webp +0 -0
- package/readme-assets/ab-simple/s7-lithermes-diagram.webp +0 -0
- package/readme-assets/ab-simple/s8-office-baseline-slides.webp +0 -0
- package/readme-assets/ab-simple/s8-office-lithermes-slides.webp +0 -0
- package/readme-assets/ab-simple/s9-office-lithermes-pages.webp +0 -0
- package/readme-assets/badge-version.svg +1 -1
- package/readme-assets/cover-motion-still.webp +0 -0
- package/readme-assets/cover-motion.webp +0 -0
- package/readme-assets/skills/autoconference.webp +0 -0
- package/readme-assets/skills/autoresearch.webp +0 -0
- package/readme-assets/skills/browser-drive.webp +0 -0
- package/readme-assets/skills/comment-checker.webp +0 -0
- package/readme-assets/skills/debugging.webp +0 -0
- package/readme-assets/skills/deep-interview.webp +0 -0
- package/readme-assets/skills/frontend-ui-ux.webp +0 -0
- package/readme-assets/skills/lit-burnoff-file.webp +0 -0
- package/readme-assets/skills/lit-burnoff.webp +0 -0
- package/readme-assets/skills/lit-code.webp +0 -0
- package/readme-assets/skills/lit-commit.webp +0 -0
- package/readme-assets/skills/lit-comprehend.webp +0 -0
- package/readme-assets/skills/lit-crucible.webp +0 -0
- package/readme-assets/skills/lit-diagram-drawer.webp +0 -0
- package/readme-assets/skills/lit-docx.webp +0 -0
- package/readme-assets/skills/lit-handoff.webp +0 -0
- package/readme-assets/skills/lit-humanizer.webp +0 -0
- package/readme-assets/skills/lit-init.webp +0 -0
- package/readme-assets/skills/lit-plan.webp +0 -0
- package/readme-assets/skills/lit-pptx.webp +0 -0
- package/readme-assets/skills/lit-recap.webp +0 -0
- package/readme-assets/skills/lit-scientific-visualization.webp +0 -0
- package/readme-assets/skills/lit-typographic-motion.webp +0 -0
- package/readme-assets/skills/litgoal.webp +0 -0
- package/readme-assets/skills/litresearch.webp +0 -0
- package/readme-assets/skills/litwork.webp +0 -0
- package/readme-assets/skills/lsp-setup.webp +0 -0
- package/readme-assets/skills/lsp.webp +0 -0
- package/readme-assets/skills/readme-studio.webp +0 -0
- package/readme-assets/skills/refactor.webp +0 -0
- package/readme-assets/skills/review-work.webp +0 -0
- package/readme-assets/skills/rules.webp +0 -0
- package/readme-assets/skills/start-work.webp +0 -0
- package/readme-assets/skills/structural-search.webp +0 -0
- package/readme-assets/skills/visual-qa.webp +0 -0
- package/readme-assets/skills/wikify.webp +0 -0
- package/src/cli.js +40 -1
- package/src/lib/check.js +21 -0
- package/src/lib/install.js +262 -7
- package/src/lib/skillPayload.js +3 -3
- package/assets/lithermes-plugin/skills/lit-korean/SKILL.md +0 -237
- package/assets/lithermes-plugin/skills/lit-korean/references/quick-rules.md +0 -24
- package/assets/lithermes-plugin/skills/lit-korean/references/safety-checklist.md +0 -23
- package/readme-assets/cover.webp +0 -0
|
@@ -0,0 +1,691 @@
|
|
|
1
|
+
// Stage path: a model-authored page captured frame by frame. The page is
|
|
2
|
+
// served from a synthetic origin through CDP request interception (no socket
|
|
3
|
+
// listens), driven by the virtual clock in stage-init.js, captured on the
|
|
4
|
+
// software rung, piped into the pinned encode, replayed in a fresh Chrome for
|
|
5
|
+
// determinism, and gated. Nothing here fetches or installs.
|
|
6
|
+
import { createHash } from 'node:crypto';
|
|
7
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { dirname, extname, join, relative, resolve, sep } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { Worker } from 'node:worker_threads';
|
|
11
|
+
import { ALWAYS_FLAGS, EXIT, OUTPUT } from './constants.mjs';
|
|
12
|
+
import { chromeExecutable, launchCause, profileSockets } from './browser.mjs';
|
|
13
|
+
import { FlashDetector } from './flash.mjs';
|
|
14
|
+
import { encodePreview, ffprobe, hasFfmpeg, pngEncode, startMaster } from './encode.mjs';
|
|
15
|
+
import { FORMATS, loadTreatment } from './treatment.mjs';
|
|
16
|
+
import { recordFirstTreatment, writeJson, writeRunState } from './director.mjs';
|
|
17
|
+
import { stampStills, stillsPlan, writeStillsSet } from './stills.mjs';
|
|
18
|
+
import { runStageGate, renderStageReport } from './stage-gate.mjs';
|
|
19
|
+
import { produceSound, soundGate } from './sound.mjs';
|
|
20
|
+
import { runTextQa } from './stage-qa.mjs';
|
|
21
|
+
import { FONT_FILES } from './frame.mjs';
|
|
22
|
+
import { findCache, fontFile, fontState, hangulPath, runtimeRequire, WARM } from '../bin/runtime.mjs';
|
|
23
|
+
|
|
24
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
export const ORIGIN = 'http://lit.stage';
|
|
26
|
+
const sha = (data) => createHash('sha256').update(data).digest('hex');
|
|
27
|
+
const fail = (code, message, extra = {}) => Object.assign(new Error(message), { exitCode: code, ...extra });
|
|
28
|
+
|
|
29
|
+
export const CONTENT_TYPES = Object.freeze({
|
|
30
|
+
'.html': 'text/html; charset=utf-8', '.js': 'text/javascript; charset=utf-8', '.mjs': 'text/javascript; charset=utf-8',
|
|
31
|
+
'.css': 'text/css; charset=utf-8', '.svg': 'image/svg+xml', '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg',
|
|
32
|
+
'.webp': 'image/webp', '.gif': 'image/gif', '.wav': 'audio/wav', '.woff': 'font/woff', '.woff2': 'font/woff2',
|
|
33
|
+
'.ttf': 'font/ttf', '.otf': 'font/otf', '.json': 'application/json',
|
|
34
|
+
});
|
|
35
|
+
const RASTER = new Set(['.png', '.jpg', '.jpeg', '.webp', '.gif']);
|
|
36
|
+
const TEXTUAL = new Set(['.html', '.js', '.mjs', '.css', '.svg', '.json']);
|
|
37
|
+
export const RASTER_LIMITS = Object.freeze({ count: 24, bytes: 8 * 1024 * 1024, sameSize: 10 });
|
|
38
|
+
|
|
39
|
+
// The software rung only (SwiftShader, CPU raster): a mismatch between two
|
|
40
|
+
// captures can then only come from the page. Plus the stage set and the two
|
|
41
|
+
// keychain flags every Chrome launch carries.
|
|
42
|
+
export function stageFlags({ width, height }) {
|
|
43
|
+
return [
|
|
44
|
+
'--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--disable-gpu-rasterization',
|
|
45
|
+
'--run-all-compositor-stages-before-draw', '--disable-checker-imaging', '--disable-new-content-rendering-timeout',
|
|
46
|
+
'--disable-threaded-animation', '--disable-threaded-scrolling', '--disable-image-animation-resync', '--disable-lcd-text',
|
|
47
|
+
'--force-color-profile=srgb', '--hide-scrollbars', '--mute-audio', '--force-device-scale-factor=1', `--window-size=${width},${height}`,
|
|
48
|
+
'--disable-background-networking', '--disable-component-update', '--disable-sync', '--no-pings', '--metrics-recording-only',
|
|
49
|
+
'--host-resolver-rules=MAP * ~NOTFOUND , EXCLUDE lit.stage',
|
|
50
|
+
...ALWAYS_FLAGS,
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Static pre-flight over the stage dir.
|
|
56
|
+
|
|
57
|
+
function imageSize(bytes, ext) {
|
|
58
|
+
try {
|
|
59
|
+
if (ext === '.png' && bytes.readUInt32BE(12) === 0x49484452) return [bytes.readUInt32BE(16), bytes.readUInt32BE(20)];
|
|
60
|
+
if (ext === '.gif') return [bytes.readUInt16LE(6), bytes.readUInt16LE(8)];
|
|
61
|
+
if (ext === '.webp' && bytes.toString('ascii', 0, 4) === 'RIFF') {
|
|
62
|
+
const kind = bytes.toString('ascii', 12, 16);
|
|
63
|
+
if (kind === 'VP8X') return [1 + bytes.readUIntLE(24, 3), 1 + bytes.readUIntLE(27, 3)];
|
|
64
|
+
if (kind === 'VP8L') { const b = bytes.readUInt32LE(21); return [1 + (b & 0x3fff), 1 + ((b >> 14) & 0x3fff)]; }
|
|
65
|
+
if (kind === 'VP8 ') return [bytes.readUInt16LE(26) & 0x3fff, bytes.readUInt16LE(28) & 0x3fff];
|
|
66
|
+
}
|
|
67
|
+
if (ext === '.jpg' || ext === '.jpeg') {
|
|
68
|
+
let at = 2;
|
|
69
|
+
while (at < bytes.length) {
|
|
70
|
+
if (bytes[at] !== 0xff) { at++; continue; }
|
|
71
|
+
const marker = bytes[at + 1];
|
|
72
|
+
if (marker >= 0xc0 && marker <= 0xcf && ![0xc4, 0xc8, 0xcc].includes(marker)) return [bytes.readUInt16BE(at + 7), bytes.readUInt16BE(at + 5)];
|
|
73
|
+
at += 2 + bytes.readUInt16BE(at + 2);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch { /* an unreadable header is reported as an unknown size */ }
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function isAnimatedRaster(bytes, ext) {
|
|
81
|
+
if (ext === '.png') {
|
|
82
|
+
for (let at = 8; at + 8 <= bytes.length;) {
|
|
83
|
+
const length = bytes.readUInt32BE(at), type = bytes.toString('ascii', at + 4, at + 8);
|
|
84
|
+
if (type === 'acTL') return true;
|
|
85
|
+
if (type === 'IDAT' || type === 'IEND') return false;
|
|
86
|
+
at += 12 + length;
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (ext === '.webp') {
|
|
91
|
+
if (bytes.toString('ascii', 12, 16) === 'VP8X' && (bytes[20] & 0x02)) return true;
|
|
92
|
+
return bytes.includes(Buffer.from('ANIM'));
|
|
93
|
+
}
|
|
94
|
+
if (ext === '.gif') {
|
|
95
|
+
// Count image descriptors by walking the block structure.
|
|
96
|
+
let at = 13;
|
|
97
|
+
if (bytes[10] & 0x80) at += 3 * (2 ** ((bytes[10] & 0x07) + 1));
|
|
98
|
+
let frames = 0;
|
|
99
|
+
while (at < bytes.length) {
|
|
100
|
+
const block = bytes[at];
|
|
101
|
+
if (block === 0x3b) break;
|
|
102
|
+
if (block === 0x21) { at += 2; while (at < bytes.length && bytes[at]) at += bytes[at] + 1; at++; continue; }
|
|
103
|
+
if (block === 0x2c) {
|
|
104
|
+
frames++;
|
|
105
|
+
if (frames > 1) return true;
|
|
106
|
+
const packed = bytes[at + 9];
|
|
107
|
+
at += 10;
|
|
108
|
+
if (packed & 0x80) at += 3 * (2 ** ((packed & 0x07) + 1));
|
|
109
|
+
at++;
|
|
110
|
+
while (at < bytes.length && bytes[at]) at += bytes[at] + 1;
|
|
111
|
+
at++;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const URL_ABSOLUTE = /\bhttps?:\/\/(?!www\.w3\.org\/|lit\.stage\/)[^\s"'<>)`]+/giu;
|
|
122
|
+
const URL_PROTOCOL_RELATIVE = /(?:["'(=]\s*)\/\/[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+/gu;
|
|
123
|
+
const HINT_LINK = /rel\s*=\s*["']?\s*(?:preconnect|prefetch|dns-prefetch)\b/giu;
|
|
124
|
+
const FORBIDDEN_MARKUP = /<\s*(video|audio|iframe|object|embed|frame)\b/giu;
|
|
125
|
+
const FORBIDDEN_CREATE = /createElement(?:NS)?\s*\([^)]*?["'`](video|audio|iframe|object|embed|frame)["'`]\s*\)/giu;
|
|
126
|
+
|
|
127
|
+
function walk(dir, root, out = []) {
|
|
128
|
+
for (const name of readdirSync(dir)) {
|
|
129
|
+
const path = join(dir, name);
|
|
130
|
+
const st = lstatSync(path);
|
|
131
|
+
if (st.isSymbolicLink()) {
|
|
132
|
+
const real = realpathSync(path);
|
|
133
|
+
if (real !== root && !real.startsWith(root + sep)) out.push({ path, escape: true });
|
|
134
|
+
else if (statSync(real).isDirectory()) walk(path, root, out);
|
|
135
|
+
else out.push({ path, real });
|
|
136
|
+
} else if (st.isDirectory()) walk(path, root, out);
|
|
137
|
+
else if (st.isFile()) out.push({ path, real: path });
|
|
138
|
+
}
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function scanStage(stageDir) {
|
|
143
|
+
const root = realpathSync(stageDir);
|
|
144
|
+
const contract = [], network = [];
|
|
145
|
+
const files = walk(root, root);
|
|
146
|
+
const rasters = [];
|
|
147
|
+
for (const file of files) {
|
|
148
|
+
const rel = relative(root, file.path);
|
|
149
|
+
if (file.escape) { contract.push(`${rel} is a symlink that leaves the stage dir`); continue; }
|
|
150
|
+
const ext = extname(file.path).toLowerCase();
|
|
151
|
+
const bytes = readFileSync(file.real);
|
|
152
|
+
if (RASTER.has(ext)) {
|
|
153
|
+
rasters.push({ rel, bytes: bytes.length, size: imageSize(bytes, ext) });
|
|
154
|
+
if (isAnimatedRaster(bytes, ext)) contract.push(`${rel} is an animated ${ext.slice(1).toUpperCase()}; rasters are textures and stills, never motion`);
|
|
155
|
+
}
|
|
156
|
+
if (!TEXTUAL.has(ext)) continue;
|
|
157
|
+
const text = bytes.toString('utf8');
|
|
158
|
+
for (const m of text.matchAll(URL_ABSOLUTE)) network.push(`${rel}: absolute URL ${m[0].slice(0, 80)}`);
|
|
159
|
+
for (const m of text.matchAll(URL_PROTOCOL_RELATIVE)) network.push(`${rel}: protocol-relative URL ${m[0].replace(/^["'(=]\s*/u, '').slice(0, 80)}`);
|
|
160
|
+
for (const m of text.matchAll(HINT_LINK)) network.push(`${rel}: ${m[0].replace(/\s+/gu, ' ')} link`);
|
|
161
|
+
if (ext === '.html' || ext === '.svg') for (const m of text.matchAll(FORBIDDEN_MARKUP)) contract.push(`${rel}: <${m[1].toLowerCase()}> is forbidden on the stage`);
|
|
162
|
+
if (ext === '.html' || ext === '.js' || ext === '.mjs') for (const m of text.matchAll(FORBIDDEN_CREATE)) contract.push(`${rel}: createElement("${m[1].toLowerCase()}") is forbidden on the stage`);
|
|
163
|
+
}
|
|
164
|
+
const total = rasters.reduce((sum, r) => sum + r.bytes, 0);
|
|
165
|
+
if (rasters.length > RASTER_LIMITS.count) contract.push(`${rasters.length} raster images; the stage allows at most ${RASTER_LIMITS.count}`);
|
|
166
|
+
if (total > RASTER_LIMITS.bytes) contract.push(`rasters total ${total} bytes; the stage allows at most 8 MB`);
|
|
167
|
+
const bySize = new Map();
|
|
168
|
+
for (const r of rasters) if (r.size) { const key = r.size.join('x'); bySize.set(key, (bySize.get(key) || 0) + 1); }
|
|
169
|
+
for (const [key, count] of bySize) if (count >= RASTER_LIMITS.sameSize) contract.push(`${count} rasters of the same size ${key} read as a flipbook; draw motion, do not play frames`);
|
|
170
|
+
return { contract: [...new Set(contract)], network: [...new Set(network)], files: files.length, rasters: { count: rasters.length, bytes: total } };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
// Fonts: the verified faces, served from the pre-warmed cache (and the reused
|
|
175
|
+
// lit-pptx Pretendard pair), never shipped under this skill.
|
|
176
|
+
|
|
177
|
+
const FACE_ROUTES = [
|
|
178
|
+
['Pretendard', 400, '100%', 'pretendard-400'], ['Pretendard', 700, '100%', 'pretendard-700'],
|
|
179
|
+
...[75, 100, 125].flatMap((w) => [500, 700, 900].map((wt) => ['Archivo', wt, `${w}%`, `archivo-w${w}-${wt}`])),
|
|
180
|
+
['Galmuri9', 400, '100%', 'galmuri9'], ['VT323', 400, '100%', 'vt323'], ['MesloLGS NF', 400, '100%', 'meslo'],
|
|
181
|
+
['Silkscreen', 400, '100%', 'silkscreen-400'], ['Silkscreen', 700, '100%', 'silkscreen-700'],
|
|
182
|
+
];
|
|
183
|
+
|
|
184
|
+
export function fontRoutes(cache) {
|
|
185
|
+
const routes = new Map();
|
|
186
|
+
const faces = [];
|
|
187
|
+
for (const [family, weight, stretch, id] of FACE_ROUTES) {
|
|
188
|
+
const entry = FONT_FILES[id];
|
|
189
|
+
const file = entry.startsWith('lit-pptx:') ? hangulPath(entry.slice(9)) : fontFile(cache, entry);
|
|
190
|
+
const name = entry.split('/').pop().replace(/^lit-pptx:/, '');
|
|
191
|
+
routes.set(`/lit/fonts/${name}`, file);
|
|
192
|
+
const format = name.endsWith('.otf') ? 'opentype' : 'truetype';
|
|
193
|
+
faces.push(`@font-face { font-family: "${family}"; src: url("/lit/fonts/${name}") format("${format}"); font-weight: ${weight}; font-stretch: ${stretch}; font-style: normal; font-display: block; }`);
|
|
194
|
+
}
|
|
195
|
+
return { routes, css: `${faces.join('\n')}\n` };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ---------------------------------------------------------------------------
|
|
199
|
+
// Chrome + serving.
|
|
200
|
+
|
|
201
|
+
// Resolve a request path inside the stage dir: only files whose realpath lies
|
|
202
|
+
// inside it, with a known content type. `..` segments and symlinks that leave
|
|
203
|
+
// the dir are refused (and recorded as a contract break), never served.
|
|
204
|
+
export function stageFile(root, pathname) {
|
|
205
|
+
let path;
|
|
206
|
+
try { path = decodeURIComponent(pathname); } catch { return { status: 403, reason: `request for ${pathname} is not a valid path` }; }
|
|
207
|
+
if (path.split(/[/\\]/u).includes('..') || path.includes('\0')) return { status: 403, reason: `request for ${path} tried to leave the stage dir` };
|
|
208
|
+
const target = resolve(root, `.${path === '/' ? '/index.html' : path}`);
|
|
209
|
+
if (target !== root && !target.startsWith(root + sep)) return { status: 403, reason: `request for ${path} tried to leave the stage dir` };
|
|
210
|
+
let real = null;
|
|
211
|
+
try { real = realpathSync(target); } catch { return { status: 404 }; }
|
|
212
|
+
if (real !== root && !real.startsWith(root + sep)) return { status: 403, reason: `request for ${path} resolves outside the stage dir` };
|
|
213
|
+
const type = CONTENT_TYPES[extname(target).toLowerCase()];
|
|
214
|
+
if (!type || !statSync(real).isFile()) return { status: 404 };
|
|
215
|
+
return { status: 200, file: real, type };
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export async function openStage({ runtime, stageDir, profileRoot, width, height, seed, fontCss, fontFiles, env = process.env }) {
|
|
219
|
+
const chrome = chromeExecutable(env);
|
|
220
|
+
if (!chrome) throw fail(EXIT.BLOCKED_NO_CHROME, 'BLOCKED_NO_CHROME: Chrome/Chromium not found; install Chrome or set CHROME_PATH');
|
|
221
|
+
const { chromium } = runtime('playwright-core');
|
|
222
|
+
const flags = stageFlags({ width, height });
|
|
223
|
+
mkdirSync(profileRoot, { recursive: true });
|
|
224
|
+
const profile = join(profileRoot, 'p');
|
|
225
|
+
let context;
|
|
226
|
+
try {
|
|
227
|
+
context = await chromium.launchPersistentContext(profile, {
|
|
228
|
+
executablePath: chrome, headless: true, chromiumSandbox: true, args: flags, timeout: 30000,
|
|
229
|
+
viewport: { width, height }, deviceScaleFactor: 1, serviceWorkers: 'block',
|
|
230
|
+
});
|
|
231
|
+
} catch (error) {
|
|
232
|
+
rmSync(profile, { recursive: true, force: true });
|
|
233
|
+
throw fail(EXIT.BLOCKED_NO_CHROME, `BLOCKED_NO_CHROME: headless Chrome failed to launch on the software rung: ${launchCause(error)}`);
|
|
234
|
+
}
|
|
235
|
+
const page = context.pages()[0] || await context.newPage();
|
|
236
|
+
page.setDefaultTimeout(0);
|
|
237
|
+
const cdp = await context.newCDPSession(page);
|
|
238
|
+
const root = realpathSync(stageDir);
|
|
239
|
+
const kit = readFileSync(join(here, 'stage-kit.js'));
|
|
240
|
+
const blocked = [], contract = [];
|
|
241
|
+
const serve = async (event) => {
|
|
242
|
+
const { requestId, request } = event;
|
|
243
|
+
let url;
|
|
244
|
+
try { url = new URL(request.url); } catch { url = null; }
|
|
245
|
+
if (!url || url.origin !== ORIGIN) {
|
|
246
|
+
blocked.push(request.url.slice(0, 160));
|
|
247
|
+
return cdp.send('Fetch.failRequest', { requestId, errorReason: 'BlockedByClient' }).catch(() => {});
|
|
248
|
+
}
|
|
249
|
+
const reply = (status, type, body) => cdp.send('Fetch.fulfillRequest', {
|
|
250
|
+
requestId, responseCode: status,
|
|
251
|
+
responseHeaders: [{ name: 'Content-Type', value: type }, { name: 'Cache-Control', value: 'no-store' }],
|
|
252
|
+
body: Buffer.from(body).toString('base64'),
|
|
253
|
+
}).catch(() => {});
|
|
254
|
+
const path = decodeURIComponent(url.pathname);
|
|
255
|
+
if (path === '/lit/stage-kit.js') return reply(200, CONTENT_TYPES['.js'], kit);
|
|
256
|
+
if (path === '/lit/fonts.css') return reply(200, CONTENT_TYPES['.css'], fontCss);
|
|
257
|
+
if (fontFiles.has(path)) return reply(200, CONTENT_TYPES[extname(path).toLowerCase()] || 'font/ttf', readFileSync(fontFiles.get(path)));
|
|
258
|
+
const found = stageFile(root, path);
|
|
259
|
+
if (found.status === 403) { contract.push(found.reason); return reply(403, 'text/plain', 'forbidden'); }
|
|
260
|
+
if (found.status === 404) return reply(404, 'text/plain', 'not found');
|
|
261
|
+
return reply(200, found.type, readFileSync(found.file));
|
|
262
|
+
};
|
|
263
|
+
cdp.on('Fetch.requestPaused', (event) => { serve(event); });
|
|
264
|
+
await cdp.send('Fetch.enable', { patterns: [{ urlPattern: '*' }] });
|
|
265
|
+
const init = readFileSync(join(here, 'stage-init.js'), 'utf8').replace(/^\/\/.*\n/gmu, '');
|
|
266
|
+
await page.addInitScript({ content: `try { ${init.trim()}(${JSON.stringify({ seed, epochMs: 1767225600000 })}); } catch (error) { window.__litStageInitError = String(error && error.stack || error); }` });
|
|
267
|
+
const sockets = profileSockets(profile);
|
|
268
|
+
return {
|
|
269
|
+
page, cdp, flags, blocked, contract, sockets,
|
|
270
|
+
async load() {
|
|
271
|
+
await page.goto(`${ORIGIN}/index.html`, { waitUntil: 'load', timeout: 120000 });
|
|
272
|
+
return page.evaluate(() => {
|
|
273
|
+
const S = window.__litStage || {};
|
|
274
|
+
const film = S.film || window.litStage || null;
|
|
275
|
+
return { film: film && { width: film.width, height: film.height, fps: film.fps, duration: film.duration, hasRender: typeof film.render === 'function' }, violations: S.violations || [], errors: S.errors || [], initError: window.__litStageInitError || (typeof S.step === 'function' ? null : 'the stage init script did not run') };
|
|
276
|
+
});
|
|
277
|
+
},
|
|
278
|
+
prepare: (imageUrls) => page.evaluate((urls) => window.__litStage.prepare(urls), imageUrls),
|
|
279
|
+
step: (t, paint) => page.evaluate(([time, p]) => window.__litStage.step(time, { paint: p }), [t, paint]),
|
|
280
|
+
async capture() {
|
|
281
|
+
const shot = await cdp.send('Page.captureScreenshot', { format: 'png', optimizeForSpeed: true, captureBeyondViewport: false, fromSurface: true, clip: { x: 0, y: 0, width, height, scale: 1 } });
|
|
282
|
+
return Buffer.from(shot.data, 'base64');
|
|
283
|
+
},
|
|
284
|
+
async close() {
|
|
285
|
+
await context.close().catch(() => {});
|
|
286
|
+
rmSync(profile, { recursive: true, force: true });
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// ---------------------------------------------------------------------------
|
|
292
|
+
// A small pool that decodes captured PNGs and measures them off the main thread.
|
|
293
|
+
|
|
294
|
+
class DecodePool {
|
|
295
|
+
constructor(size, requireFrom) {
|
|
296
|
+
this.workers = Array.from({ length: size }, () => new Worker(new URL('./stage-worker.mjs', import.meta.url), { workerData: { requireFrom } }));
|
|
297
|
+
this.idle = [...this.workers];
|
|
298
|
+
this.queue = [];
|
|
299
|
+
this.pending = new Map();
|
|
300
|
+
this.next = 1;
|
|
301
|
+
for (const worker of this.workers) {
|
|
302
|
+
worker.on('message', (msg) => {
|
|
303
|
+
const job = this.pending.get(msg.id);
|
|
304
|
+
this.pending.delete(msg.id);
|
|
305
|
+
this.idle.push(worker);
|
|
306
|
+
this.pump();
|
|
307
|
+
if (msg.error) job.reject(new Error(msg.error)); else job.resolve(msg);
|
|
308
|
+
});
|
|
309
|
+
worker.on('error', (error) => { for (const job of this.pending.values()) job.reject(error); this.pending.clear(); });
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
run(png, options) {
|
|
313
|
+
return new Promise((resolve, reject) => { this.queue.push({ png, options, resolve, reject }); this.pump(); });
|
|
314
|
+
}
|
|
315
|
+
pump() {
|
|
316
|
+
while (this.idle.length && this.queue.length) {
|
|
317
|
+
const worker = this.idle.pop();
|
|
318
|
+
const job = this.queue.shift();
|
|
319
|
+
const id = this.next++;
|
|
320
|
+
this.pending.set(id, job);
|
|
321
|
+
const copy = job.png.buffer.slice(job.png.byteOffset, job.png.byteOffset + job.png.byteLength);
|
|
322
|
+
worker.postMessage({ id, png: copy, ...job.options }, [copy]);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
async close() { await Promise.all(this.workers.map((w) => w.terminate())); }
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// ---------------------------------------------------------------------------
|
|
329
|
+
// Determinism samples: frame 0, the last frame and every beat's first frame,
|
|
330
|
+
// spread evenly to at most 16, then beat midpoints until there are at least 8.
|
|
331
|
+
|
|
332
|
+
export function determinismSamples(totalFrames, beatFrames) {
|
|
333
|
+
const firsts = [...new Set([0, totalFrames - 1, ...beatFrames.map((b) => b.first)])].filter((f) => f >= 0 && f < totalFrames).sort((a, b) => a - b);
|
|
334
|
+
let picked = firsts;
|
|
335
|
+
if (picked.length > 16) {
|
|
336
|
+
const keep = new Set([0, totalFrames - 1]);
|
|
337
|
+
const inner = firsts.filter((f) => !keep.has(f));
|
|
338
|
+
for (let i = 0; i < 14; i++) keep.add(inner[Math.round((i * (inner.length - 1)) / 13)]);
|
|
339
|
+
picked = [...keep].sort((a, b) => a - b);
|
|
340
|
+
}
|
|
341
|
+
const set = new Set(picked);
|
|
342
|
+
for (const b of beatFrames) { if (set.size >= 8) break; set.add(b.mid); }
|
|
343
|
+
for (let k = 1; set.size < 8 && k < totalFrames; k++) set.add(Math.round((k * (totalFrames - 1)) / 9));
|
|
344
|
+
return [...set].sort((a, b) => a - b);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function firstDifference(a, b, width, height) {
|
|
348
|
+
let x0 = width, y0 = height, x1 = -1, y1 = -1;
|
|
349
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
350
|
+
const i = (y * width + x) * 4;
|
|
351
|
+
if (a[i] !== b[i] || a[i + 1] !== b[i + 1] || a[i + 2] !== b[i + 2]) { if (x < x0) x0 = x; if (y < y0) y0 = y; if (x > x1) x1 = x; if (y > y1) y1 = y; }
|
|
352
|
+
}
|
|
353
|
+
return x1 < 0 ? null : [x0, y0, x1, y1];
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// ---------------------------------------------------------------------------
|
|
357
|
+
|
|
358
|
+
function beatFramesOf(treatment, fps, totalFrames) {
|
|
359
|
+
return treatment.beats.map((beat, index) => {
|
|
360
|
+
const first = Math.min(totalFrames - 1, Math.max(0, Math.round(beat.t0 * fps)));
|
|
361
|
+
const last = Math.min(totalFrames - 1, Math.max(first, Math.round(beat.t1 * fps) - 1));
|
|
362
|
+
return { index, first, last, mid: Math.round((first + last) / 2) };
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function imageUrlsIn(stageDir) {
|
|
367
|
+
const root = realpathSync(stageDir);
|
|
368
|
+
return walk(root, root).filter((f) => !f.escape && RASTER.has(extname(f.path).toLowerCase()))
|
|
369
|
+
.map((f) => `${ORIGIN}/${relative(root, f.path).split(sep).map(encodeURIComponent).join('/')}`);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
async function loadStage(session, stage) {
|
|
373
|
+
const loaded = await stage.load();
|
|
374
|
+
if (loaded.initError) throw fail(1, `stage init failed: ${loaded.initError}`);
|
|
375
|
+
if (stage.blocked.length) throw fail(EXIT.STAGE_NETWORK_REQUEST, `STAGE_NETWORK_REQUEST: the page requested ${stage.blocked[0]}${stage.blocked.length > 1 ? ` (+${stage.blocked.length - 1} more)` : ''}; the stage is served offline`);
|
|
376
|
+
checkStep({ violations: loaded.violations, webglNull: false }, stage, 'load');
|
|
377
|
+
if (!loaded.film) throw fail(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: the page never called LitStage.define (or set window.litStage)${loaded.errors.length ? `; page error: ${loaded.errors[0]}` : ''}`);
|
|
378
|
+
const [w, h] = session.size;
|
|
379
|
+
if (loaded.film.width !== w || loaded.film.height !== h) {
|
|
380
|
+
throw fail(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: LitStage.define says ${loaded.film.width}x${loaded.film.height} but the treatment's ${session.treatment.format} format is ${w}x${h}`);
|
|
381
|
+
}
|
|
382
|
+
const fps = loaded.film.fps ?? 60;
|
|
383
|
+
if (!(fps === 60 || (fps === 30 && session.treatment.fps === 30))) throw fail(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: fps ${fps}; the stage runs at 60 (30 only when the treatment sets "fps": 30)`);
|
|
384
|
+
if (!(loaded.film.duration > 0 && loaded.film.duration <= 120)) throw fail(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: duration ${loaded.film.duration}`);
|
|
385
|
+
const prepared = await stage.prepare(imageUrlsIn(session.stageDir));
|
|
386
|
+
return { film: { ...loaded.film, fps }, faces: prepared.faces, errors: loaded.errors };
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Socket and peer APIs are network requests (exit 19); the other stubs are
|
|
390
|
+
// contract breaks (exit 17).
|
|
391
|
+
const NETWORK_APIS = new Set(['WebSocket', 'WebTransport', 'RTCPeerConnection', 'webkitRTCPeerConnection']);
|
|
392
|
+
|
|
393
|
+
function checkStep(result, stage, frame) {
|
|
394
|
+
if (stage.blocked.length) throw fail(EXIT.STAGE_NETWORK_REQUEST, `STAGE_NETWORK_REQUEST: frame ${frame} requested ${stage.blocked[0]}; the stage is served offline`);
|
|
395
|
+
const network = result.violations.filter((v) => NETWORK_APIS.has(v));
|
|
396
|
+
if (network.length) throw fail(EXIT.STAGE_NETWORK_REQUEST, `STAGE_NETWORK_REQUEST: the page used ${network.join(', ')} (seen by frame ${frame}); the stage is served offline`);
|
|
397
|
+
const problems = [...result.violations, ...stage.contract];
|
|
398
|
+
if (problems.length) throw fail(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${problems.join('; ')} (seen by frame ${frame})`);
|
|
399
|
+
if (result.webglNull) throw fail(EXIT.BLOCKED_NO_WEBGL2, 'BLOCKED_NO_WEBGL2: the page asked for a WebGL context and the software renderer returned none');
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
class StageSession {
|
|
403
|
+
constructor(flags) {
|
|
404
|
+
this.flags = flags;
|
|
405
|
+
this.out = resolve(flags.out || 'motion-output');
|
|
406
|
+
this.round = Number(flags.round || 1);
|
|
407
|
+
this.stillsOnly = Boolean(flags['stills-only']);
|
|
408
|
+
this.mode = this.stillsOnly ? 'stage-stills' : 'stage';
|
|
409
|
+
this.stageDir = join(this.out, 'stage');
|
|
410
|
+
this.warnings = [];
|
|
411
|
+
this.timing = [];
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
prepare() {
|
|
415
|
+
if (![1, 2, 3].includes(this.round)) throw fail(2, '--round must be 1, 2 or 3');
|
|
416
|
+
const { treatment } = loadTreatment(this.out, EXIT.BLOCKED_TREATMENT_INVALID);
|
|
417
|
+
if (treatment.path !== 'stage') throw fail(EXIT.BLOCKED_TREATMENT_INVALID, 'BLOCKED_TREATMENT_INVALID: field path: this treatment takes the type path; render it with `run --out DIR`');
|
|
418
|
+
recordFirstTreatment(this.out, treatment);
|
|
419
|
+
this.treatment = treatment;
|
|
420
|
+
this.size = FORMATS[treatment.format];
|
|
421
|
+
this.seed = Number.parseInt(sha(treatment.request).slice(0, 8), 16) >>> 0;
|
|
422
|
+
if (!existsSync(join(this.stageDir, 'index.html'))) throw fail(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: no stage/index.html in ${this.out}; author the page first (references/stage.md)`);
|
|
423
|
+
const scan = scanStage(this.stageDir);
|
|
424
|
+
this.scan = scan;
|
|
425
|
+
if (scan.contract.length) throw fail(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: ${scan.contract.join('; ')}`);
|
|
426
|
+
if (scan.network.length) throw fail(EXIT.STAGE_NETWORK_REQUEST, `STAGE_NETWORK_REQUEST: ${scan.network.join('; ')}; the stage is served offline`);
|
|
427
|
+
this.require = runtimeRequire();
|
|
428
|
+
this.cache = findCache();
|
|
429
|
+
const fonts = fontState();
|
|
430
|
+
if (!fonts.ok) throw fail(EXIT.BLOCKED_FONT_FETCH, `BLOCKED_FONT_FETCH: ${[...fonts.missing.map((f) => `missing ${f}`), ...fonts.mismatched.map((f) => `sha256 mismatch ${f}`)].join('; ')}; run \`${WARM}\` outside this session`);
|
|
431
|
+
this.PNG = this.require('pngjs').PNG;
|
|
432
|
+
this.fonts = fontRoutes(this.cache);
|
|
433
|
+
this.ffmpeg = hasFfmpeg();
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
open(tag) {
|
|
437
|
+
return openStage({
|
|
438
|
+
runtime: this.require, stageDir: this.stageDir, profileRoot: join(this.out, '.run', `${tag}${process.pid % 100000}`),
|
|
439
|
+
width: this.size[0], height: this.size[1], seed: this.seed, fontCss: this.fonts.css, fontFiles: this.fonts.routes,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// The master pass. With stills-only, every frame is still stepped (a page
|
|
444
|
+
// may keep state) but only the stills frames are painted and captured.
|
|
445
|
+
async master() {
|
|
446
|
+
const [W, H] = this.size;
|
|
447
|
+
const stage = await this.open('c');
|
|
448
|
+
this.stage = stage;
|
|
449
|
+
try {
|
|
450
|
+
const loaded = await loadStage(this, stage);
|
|
451
|
+
this.film = loaded.film;
|
|
452
|
+
this.faces = loaded.faces;
|
|
453
|
+
if (loaded.errors.length) this.warnings.push(`page errors while loading: ${loaded.errors.slice(0, 3).join(' / ')}`);
|
|
454
|
+
const fps = this.film.fps;
|
|
455
|
+
this.fps = fps;
|
|
456
|
+
this.totalFrames = Math.max(1, Math.round(this.film.duration * fps));
|
|
457
|
+
this.durationSec = this.totalFrames / fps;
|
|
458
|
+
this.beats = beatFramesOf(this.treatment, fps, this.totalFrames);
|
|
459
|
+
this.plan = stillsPlan({ totalFrames: this.totalFrames, beats: this.beats });
|
|
460
|
+
this.samples = determinismSamples(this.totalFrames, this.beats);
|
|
461
|
+
const wanted = new Set([...this.plan.frames, ...(this.stillsOnly ? [] : this.samples)]);
|
|
462
|
+
const pngs = new Map();
|
|
463
|
+
const encode = !this.stillsOnly && this.ffmpeg;
|
|
464
|
+
const pool = new DecodePool(3, join(this.cache, 'node', 'package.json'));
|
|
465
|
+
const runDir = join(this.out, '.run');
|
|
466
|
+
mkdirSync(runDir, { recursive: true });
|
|
467
|
+
const encoder = encode ? startMaster({ width: W, height: H, fps, output: join(runDir, 'video.mp4') }) : null;
|
|
468
|
+
const detector = new FlashDetector(W, H);
|
|
469
|
+
const previewDir = join(runDir, 'preview-src');
|
|
470
|
+
rmSync(previewDir, { recursive: true, force: true });
|
|
471
|
+
if (encode) mkdirSync(previewDir, { recursive: true });
|
|
472
|
+
const previewEvery = Math.max(1, Math.round(fps / 30));
|
|
473
|
+
const previewLong = OUTPUT.previewLadder[0][0];
|
|
474
|
+
const previewWidth = Math.round((W * previewLong) / Math.max(W, H));
|
|
475
|
+
this.records = [];
|
|
476
|
+
this.previewFrames = [];
|
|
477
|
+
let writing = Promise.resolve();
|
|
478
|
+
const inflight = [];
|
|
479
|
+
const started = process.hrtime.bigint();
|
|
480
|
+
for (let f = 0; f < this.totalFrames; f++) {
|
|
481
|
+
const capture = encode || wanted.has(f);
|
|
482
|
+
const t0 = process.hrtime.bigint();
|
|
483
|
+
const result = await stage.step(f / fps, capture);
|
|
484
|
+
checkStep(result, stage, f);
|
|
485
|
+
if (result.errors.length) this.warnings.push(`frame ${f}: ${result.errors[0]}`);
|
|
486
|
+
if (!capture) continue;
|
|
487
|
+
const png = await stage.capture();
|
|
488
|
+
this.timing.push(Number(process.hrtime.bigint() - t0) / 1e6);
|
|
489
|
+
if (wanted.has(f)) pngs.set(f, png);
|
|
490
|
+
if (!encode) continue;
|
|
491
|
+
const job = pool.run(png, { preview: f % previewEvery === 0 ? previewWidth : 0, width: W, height: H });
|
|
492
|
+
inflight.push(job);
|
|
493
|
+
const frame = f;
|
|
494
|
+
writing = writing.then(async () => {
|
|
495
|
+
const decoded = await job;
|
|
496
|
+
if (decoded.width !== W || decoded.height !== H) throw fail(EXIT.STAGE_CONTRACT_ERROR, `STAGE_CONTRACT_ERROR: frame ${frame} captured at ${decoded.width}x${decoded.height}, not ${W}x${H}`);
|
|
497
|
+
const rgba = Buffer.from(decoded.rgba);
|
|
498
|
+
const flash = detector.push(rgba);
|
|
499
|
+
await encoder.write(rgba);
|
|
500
|
+
if (decoded.small) {
|
|
501
|
+
const file = join(previewDir, `s${String(frame).padStart(5, '0')}.png`);
|
|
502
|
+
writeFileSync(file, pngEncode(this.PNG, Buffer.from(decoded.small), decoded.smallWidth, decoded.smallHeight, { level: 1, scratch: true }));
|
|
503
|
+
this.previewFrames[frame] = file;
|
|
504
|
+
}
|
|
505
|
+
this.records.push({ frame, rgbaSha256: decoded.sha, lumP995: decoded.lumP995, flash: { general: flash.general, generalBoth: flash.generalBoth, red: flash.red, redBoth: flash.redBoth }, fullFrameStep: Number(flash.fullFrameStep.toFixed(4)) });
|
|
506
|
+
});
|
|
507
|
+
if (inflight.length > 6) await inflight.shift();
|
|
508
|
+
if (f % 60 === 59) {
|
|
509
|
+
process.stderr.write(`motion stage: ${f + 1}/${this.totalFrames} frames\n`);
|
|
510
|
+
writeJson(join(runDir, 'progress.json'), { phase: 'master', frame: f + 1, totalFrames: this.totalFrames, elapsedSec: Number(process.hrtime.bigint() - started) / 1e9 });
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
await writing;
|
|
514
|
+
await pool.close();
|
|
515
|
+
this.masterSec = Number(process.hrtime.bigint() - started) / 1e9;
|
|
516
|
+
if (encoder) {
|
|
517
|
+
const done = await encoder.finish();
|
|
518
|
+
if (done.code !== 0) throw fail(1, `ffmpeg master encode failed: ${done.stderr.split('\n').filter(Boolean).at(-1) || done.code}`);
|
|
519
|
+
}
|
|
520
|
+
this.pngs = pngs;
|
|
521
|
+
} finally {
|
|
522
|
+
await stage.close();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// A fresh Chrome replays the clock from 0 and re-captures the samples. It
|
|
527
|
+
// paints and captures every frame, as the master did: Chrome re-rasters only
|
|
528
|
+
// what changed, and a capture is itself part of that history, so a replay
|
|
529
|
+
// that skipped paints or captures would carry a different raster state.
|
|
530
|
+
async determinism() {
|
|
531
|
+
const [W, H] = this.size;
|
|
532
|
+
const stage = await this.open('d');
|
|
533
|
+
const checks = [];
|
|
534
|
+
try {
|
|
535
|
+
await loadStage(this, stage);
|
|
536
|
+
const wanted = new Set(this.samples);
|
|
537
|
+
const last = Math.max(...this.samples);
|
|
538
|
+
for (let f = 0; f <= last; f++) {
|
|
539
|
+
const result = await stage.step(f / this.fps, true);
|
|
540
|
+
checkStep(result, stage, f);
|
|
541
|
+
const png = await stage.capture();
|
|
542
|
+
if (!wanted.has(f)) continue;
|
|
543
|
+
const rgba = this.PNG.sync.read(png).data;
|
|
544
|
+
const replay = sha(rgba);
|
|
545
|
+
const master = this.records.find((r) => r.frame === f)?.rgbaSha256;
|
|
546
|
+
const entry = { frame: f, master, replay, match: master === replay };
|
|
547
|
+
if (!entry.match) {
|
|
548
|
+
const original = this.PNG.sync.read(this.pngs.get(f)).data;
|
|
549
|
+
entry.region = firstDifference(original, rgba, W, H);
|
|
550
|
+
}
|
|
551
|
+
checks.push(entry);
|
|
552
|
+
if (!entry.match) break;
|
|
553
|
+
}
|
|
554
|
+
} finally {
|
|
555
|
+
await stage.close();
|
|
556
|
+
}
|
|
557
|
+
this.determinismResult = { checks, samples: this.samples };
|
|
558
|
+
const bad = checks.find((c) => !c.match);
|
|
559
|
+
if (bad) {
|
|
560
|
+
const r = bad.region ? `x ${bad.region[0]}-${bad.region[2]}, y ${bad.region[1]}-${bad.region[3]}` : 'no pixel region found';
|
|
561
|
+
throw fail(EXIT.STAGE_NONDETERMINISTIC, `STAGE_NONDETERMINISTIC: frame ${bad.frame} differs in a fresh replay (first differing region ${r}); something on the page reads a clock or randomness the virtual clock does not cover`, { determinism: this.determinismResult });
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
manifest(extra = {}) {
|
|
566
|
+
const [W, H] = this.size;
|
|
567
|
+
const timing = [...this.timing].sort((a, b) => a - b);
|
|
568
|
+
const pick = (q) => (timing.length ? Number(timing[Math.min(timing.length - 1, Math.ceil(q * timing.length) - 1)].toFixed(1)) : null);
|
|
569
|
+
return {
|
|
570
|
+
schemaVersion: 2, path: 'stage', format: this.treatment.format, fps: this.fps, resolution: [W, H], durationSec: this.durationSec,
|
|
571
|
+
targetDurationSec: this.treatment.durationSec, totalFrames: this.totalFrames, round: this.round, mode: this.mode,
|
|
572
|
+
treatment: { file: join(this.out, 'treatment.json'), sha256: sha(readFileSync(join(this.out, 'treatment.json'))) },
|
|
573
|
+
chromeFlags: this.stage?.flags || [], chromeSockets: this.stage?.sockets || [], renderer: 'SwiftShader (software rung)',
|
|
574
|
+
faces: this.faces, scan: this.scan, beats: this.beats, stills: this.plan, determinism: this.determinismResult || null,
|
|
575
|
+
frameTimeMs: { p50: pick(0.5), p95: pick(0.95), captured: timing.length }, masterSec: this.masterSec, warnings: this.warnings,
|
|
576
|
+
generatedAt: new Date().toISOString(), ...extra,
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export async function stageCommand(flags) {
|
|
582
|
+
if (flags.detach) return detach(flags);
|
|
583
|
+
const session = new StageSession(flags);
|
|
584
|
+
writeRunState(session.out, { exitCode: null, mode: session.mode, round: session.round, finished: false, path: 'stage' });
|
|
585
|
+
try {
|
|
586
|
+
session.prepare();
|
|
587
|
+
await session.master();
|
|
588
|
+
const stills = writeStillsSet({ out: session.out, PNG: session.PNG, pngs: session.pngs, plan: session.plan, size: session.size, round: session.round, mode: session.mode });
|
|
589
|
+
if (session.stillsOnly || !session.ffmpeg) {
|
|
590
|
+
const manifest = session.manifest({ stillsSet: stills.file });
|
|
591
|
+
writeJson(join(session.out, 'manifest.json'), manifest);
|
|
592
|
+
stampStills(session.out);
|
|
593
|
+
if (!session.ffmpeg && !session.stillsOnly) throw fail(EXIT.BLOCKED_NO_FFMPEG_FOR_VIDEO, `BLOCKED_NO_FFMPEG_FOR_VIDEO: stills and the contact sheet are in ${session.out}; ffmpeg is not on PATH, so no film was encoded`);
|
|
594
|
+
writeRunState(session.out, { exitCode: 0, mode: session.mode, round: session.round, finished: true, failed: [], path: 'stage' });
|
|
595
|
+
console.log(`stills: ${stills.files.map((f) => join(session.out, f.file)).join(' ')}`);
|
|
596
|
+
console.log('View every still, strip and the contact sheet, then record the round with `look` before the full render.');
|
|
597
|
+
return 0;
|
|
598
|
+
}
|
|
599
|
+
await session.determinism();
|
|
600
|
+
const run = join(session.out, '.run');
|
|
601
|
+
const sound = await produceSound({ out: session.out, treatment: session.treatment, fps: session.fps, totalFrames: session.totalFrames, cuts: session.beats.slice(1).map((b) => b.first / session.fps), video: join(run, 'video.mp4'), output: join(run, 'film.mp4') });
|
|
602
|
+
const [W, H] = session.size;
|
|
603
|
+
const poster = session.pngs.get(session.plan.poster);
|
|
604
|
+
writeFileSync(join(run, 'poster.png'), pngEncode(session.PNG, session.PNG.sync.read(poster).data, W, H, { level: 9 }));
|
|
605
|
+
const reduced = session.pngs.get(session.plan.reduced);
|
|
606
|
+
writeFileSync(join(run, 'reduced-motion.png'), pngEncode(session.PNG, session.PNG.sync.read(reduced).data, W, H, { level: 9 }));
|
|
607
|
+
const preview = encodePreview({ PNG: session.PNG, sourceFrames: session.previewFrames, masterFps: session.fps, durationSec: session.durationSec, workDir: run, minGlyphPx: 64, sourceWidth: W, sourceHeight: H });
|
|
608
|
+
rmSync(join(run, 'preview-src'), { recursive: true, force: true });
|
|
609
|
+
const qa = await runTextQa(session);
|
|
610
|
+
const films = join(run, 'film.mp4');
|
|
611
|
+
const exportsInfo = {
|
|
612
|
+
probe: existsSync(films) ? ffprobe(films) : null,
|
|
613
|
+
sizes: { film: existsSync(films) ? statSync(films).size : null, preview: preview.file ? statSync(preview.file).size : null, poster: statSync(join(run, 'poster.png')).size, reduced: statSync(join(run, 'reduced-motion.png')).size },
|
|
614
|
+
previewName: preview.encoder === 'gif' ? 'preview.gif' : 'preview.webp',
|
|
615
|
+
};
|
|
616
|
+
const manifest = session.manifest({ preview: { encoder: preview.encoder, width: preview.width, fps: preview.fps, attempts: preview.attempts }, sound: sound.summary, textQa: qa.summary, stillsSet: stills.file });
|
|
617
|
+
const gate = runStageGate({ manifest, treatment: session.treatment, records: session.records, previewRecords: preview.records, previewFps: preview.fps, exports: exportsInfo, sound, qa });
|
|
618
|
+
promoteStage(session.out, { withhold: gate.withhold, previewName: exportsInfo.previewName });
|
|
619
|
+
writeJson(join(session.out, 'manifest.json'), manifest);
|
|
620
|
+
stampStills(session.out);
|
|
621
|
+
writeFileSync(join(session.out, 'render.jsonl'), `${session.records.map((r) => JSON.stringify(r)).join('\n')}\n`);
|
|
622
|
+
writeJson(join(run, 'gate-data.json'), { previewRecords: preview.records, previewFps: preview.fps, previewName: exportsInfo.previewName, qa: qa.rules, soundMode: sound.summary.mode });
|
|
623
|
+
writeFileSync(join(session.out, 'gate-report.txt'), renderStageReport(manifest, gate, { out: session.out, previewName: exportsInfo.previewName }));
|
|
624
|
+
const code = gate.failed.length ? EXIT.GATE_FAIL_QA : EXIT.OK;
|
|
625
|
+
writeRunState(session.out, { exitCode: code, mode: session.mode, round: session.round, finished: true, failed: gate.failed, withheld: gate.withhold, path: 'stage' });
|
|
626
|
+
console.log(`motion stage ${gate.failed.length ? `QA FAIL (${gate.failed.join(', ')})` : 'QA PASS'}; report ${join(session.out, 'gate-report.txt')}${gate.withhold ? '; exports WITHHELD in withheld/' : ''}`);
|
|
627
|
+
console.log(`frame time p50 ${manifest.frameTimeMs.p50} ms, p95 ${manifest.frameTimeMs.p95} ms; master ${session.masterSec.toFixed(1)} s for ${session.totalFrames} frames`);
|
|
628
|
+
console.log('View the new stills set and record the last look round with `look` before `complete`.');
|
|
629
|
+
return code;
|
|
630
|
+
} catch (error) {
|
|
631
|
+
const code = error.exitCode ?? 1;
|
|
632
|
+
console.error(error.exitCode ? error.message : `motion internal error: ${error.stack || error.message}`);
|
|
633
|
+
writeRunState(session.out, { exitCode: code, mode: session.mode, round: session.round, finished: true, failed: [], path: 'stage', message: String(error.message).split('\n')[0] });
|
|
634
|
+
return code;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// `gate --out DIR` on a stage render: re-measure the exports and the sound,
|
|
639
|
+
// reuse the recorded frame, preview and text-QA rows, and rewrite only the
|
|
640
|
+
// report (manifest.json stays, so a recorded look round stays valid).
|
|
641
|
+
export async function stageRegate(out) {
|
|
642
|
+
try {
|
|
643
|
+
const manifest = JSON.parse(readFileSync(join(out, 'manifest.json'), 'utf8'));
|
|
644
|
+
const { treatment } = loadTreatment(out, EXIT.BLOCKED_TREATMENT_INVALID);
|
|
645
|
+
const data = JSON.parse(readFileSync(join(out, '.run', 'gate-data.json'), 'utf8'));
|
|
646
|
+
const records = readFileSync(join(out, 'render.jsonl'), 'utf8').trim().split('\n').map((line) => JSON.parse(line));
|
|
647
|
+
const where = (name) => [join(out, name), join(out, 'withheld', name)].find((f) => existsSync(f));
|
|
648
|
+
const film = where('film.mp4'), prev = where(data.previewName), poster = where('poster.png'), reduced = where('reduced-motion.png');
|
|
649
|
+
const exportsInfo = { probe: film ? ffprobe(film) : null, sizes: { film: film && statSync(film).size, preview: prev && statSync(prev).size, poster: poster && statSync(poster).size, reduced: reduced && statSync(reduced).size }, previewName: data.previewName };
|
|
650
|
+
const sound = data.soundMode === 'none' || !film ? { rules: [{ id: 'sound-stream', status: 'PASS', detail: 'no sound planned' }] } : { rules: soundGate({ file: film, mode: data.soundMode }).rules };
|
|
651
|
+
const gate = runStageGate({ manifest, treatment, records, previewRecords: data.previewRecords, previewFps: data.previewFps, exports: exportsInfo, sound, qa: { rules: data.qa } });
|
|
652
|
+
writeFileSync(join(out, 'gate-report.txt'), renderStageReport(manifest, gate, { out, previewName: data.previewName }));
|
|
653
|
+
const code = gate.failed.length ? EXIT.GATE_FAIL_QA : EXIT.OK;
|
|
654
|
+
writeRunState(out, { exitCode: code, mode: manifest.mode, round: manifest.round, finished: true, failed: gate.failed, withheld: gate.withhold, path: 'stage' });
|
|
655
|
+
console.log(readFileSync(join(out, 'gate-report.txt'), 'utf8'));
|
|
656
|
+
return code;
|
|
657
|
+
} catch (error) {
|
|
658
|
+
console.error(error.exitCode ? error.message : `motion internal error: ${error.stack || error.message}`);
|
|
659
|
+
return error.exitCode ?? 1;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
function promoteStage(out, { withhold, previewName }) {
|
|
664
|
+
const destination = withhold ? join(out, 'withheld') : out;
|
|
665
|
+
mkdirSync(destination, { recursive: true });
|
|
666
|
+
for (const name of ['film.mp4', previewName, 'poster.png', 'reduced-motion.png']) {
|
|
667
|
+
const staged = join(out, '.run', name);
|
|
668
|
+
if (withhold) rmSync(join(out, name), { force: true });
|
|
669
|
+
if (!existsSync(staged)) continue;
|
|
670
|
+
rmSync(join(destination, name), { force: true });
|
|
671
|
+
writeFileSync(join(destination, name), readFileSync(staged));
|
|
672
|
+
rmSync(staged, { force: true });
|
|
673
|
+
}
|
|
674
|
+
if (!withhold) rmSync(join(out, 'withheld'), { recursive: true, force: true });
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// --detach: the same render in a detached child that writes progress and
|
|
678
|
+
// run-state.json; the caller polls them instead of holding a long call open.
|
|
679
|
+
async function detach(flags) {
|
|
680
|
+
const { spawn } = await import('node:child_process');
|
|
681
|
+
const out = resolve(flags.out || 'motion-output');
|
|
682
|
+
mkdirSync(join(out, '.run'), { recursive: true });
|
|
683
|
+
const args = [join(here, '..', 'bin', 'motion.mjs'), 'stage', '--out', out, '--round', String(flags.round || 1), ...(flags['stills-only'] ? ['--stills-only'] : [])];
|
|
684
|
+
const log = join(out, '.run', 'stage.log');
|
|
685
|
+
const { openSync } = await import('node:fs');
|
|
686
|
+
const fd = openSync(log, 'w');
|
|
687
|
+
const child = spawn(process.execPath, args, { detached: true, stdio: ['ignore', fd, fd] });
|
|
688
|
+
child.unref();
|
|
689
|
+
console.log(`stage render detached (pid ${child.pid}); poll ${join(out, '.run', 'progress.json')} and ${join(out, 'run-state.json')} (finished: true); log ${log}`);
|
|
690
|
+
return 0;
|
|
691
|
+
}
|