@pixel-point/toolcraft 0.0.18 → 0.0.19
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/package.json +1 -1
- package/src/generate-demand-only-lifecycle.test.mjs +9 -1
- package/src/generate-performance-iteration-execution.test.mjs +3 -3
- package/src/generate-test-delivery-architecture-assertions.mjs +11 -73
- package/src/generate-test-demand-only-lifecycle.mjs +34 -36
- package/src/generate-test-dependency-sandbox.mjs +4 -1
- package/src/generate-test-doc-assertions.mjs +55 -53
- package/src/generate-test-doc-assertions.test.mjs +1 -1
- package/src/generate-test-doc-policy-assertions.mjs +1 -1
- package/src/generate-test-export-doc-assertions.mjs +53 -0
- package/src/generate-test-file-assertions.mjs +51 -8
- package/src/generate-test-integrity-assertions.mjs +5 -2
- package/src/generate-test-integrity-manifest-assertions.mjs +16 -5
- package/src/generate-test-integrity-ownership-assertions.mjs +36 -4
- package/src/generate-test-package-assertions.mjs +4 -0
- package/src/generate-test-product-fixture.mjs +1 -1
- package/src/generate-test-product-fixture.test.mjs +35 -38
- package/src/generate-test-product-iteration.mjs +0 -1
- package/src/generate-test-product-iteration.test.mjs +0 -1
- package/src/generate-test-runtime-boundary-assertions.mjs +20 -0
- package/src/generate-test-standalone-assertions.mjs +0 -16
- package/src/generate-test-standalone-delivery-stages.mjs +2 -86
- package/src/generate.test.mjs +4 -0
- package/src/generated-integrity-manifest.test.mjs +5 -2
- package/src/generated-source-policy.test.mjs +0 -4
- package/src/package-json.mjs +5 -0
- package/src/package-json.test.mjs +21 -0
- package/src/package-manager.mjs +2 -0
- package/src/package-manager.test.mjs +8 -0
- package/src/packaged-template-fallback-helpers.mjs +254 -0
- package/src/packaged-template-fallback.test.mjs +121 -46
- package/src/packaged-template-runtime-assertions.mjs +150 -0
- package/templates/runtime/contracts/component-contracts.choices.test.ts +18 -3
- package/templates/runtime/contracts/component-contracts.choices.ts +8 -3
- package/templates/runtime/contracts/component-contracts.inputs.ts +2 -1
- package/templates/runtime/contracts/component-contracts.runtime-acceptance.test.ts +18 -4
- package/templates/runtime/contracts/component-contracts.runtime-shell.test.ts +1 -1
- package/templates/runtime/contracts/component-contracts.runtime.ts +7 -4
- package/templates/runtime/contracts/component-contracts.visual.test.ts +20 -0
- package/templates/runtime/contracts/component-contracts.visual.ts +4 -0
- package/templates/runtime/contracts/decision-contracts.test.ts +18 -12
- package/templates/runtime/contracts/decision-contracts.ts +4 -4
- package/templates/runtime/contracts/performance-verification-policy.test.ts +12 -12
- package/templates/runtime/contracts/performance-verification-policy.ts +8 -8
- package/templates/runtime/export/artifact-download.ts +1 -0
- package/templates/runtime/export/artifact-frame-renderer.ts +2 -15
- package/templates/runtime/export/artifact-frame-state.ts +16 -0
- package/templates/runtime/export/artifact-scene-frame.test.ts +3 -3
- package/templates/runtime/export/artifact-scene-frame.ts +3 -3
- package/templates/runtime/export/export-error.ts +5 -0
- package/templates/runtime/export/export-renderer-coverage.ts +54 -0
- package/templates/runtime/export/image-artifact-export.ts +2 -2
- package/templates/runtime/export/index.ts +13 -0
- package/templates/runtime/export/product-export-renderer.test.ts +38 -4
- package/templates/runtime/export/product-export-renderer.ts +0 -41
- package/templates/runtime/export/product-svg-export-renderer.ts +21 -0
- package/templates/runtime/export/svg-artifact-export.test.ts +98 -0
- package/templates/runtime/export/svg-artifact-export.ts +120 -0
- package/templates/runtime/export/svg-document.test.ts +221 -0
- package/templates/runtime/export/svg-document.ts +400 -0
- package/templates/runtime/export/svg-policy.ts +47 -0
- package/templates/runtime/index.ts +1 -0
- package/templates/runtime/react/app-shell/runtime-public-api.test.tsx +10 -0
- package/templates/runtime/react/app-shell/settings-transfer.test.ts +21 -0
- package/templates/runtime/react/app-shell/toolcraft-app.scene-export.test.tsx +46 -1
- package/templates/runtime/react/app-shell/toolcraft-app.tsx +7 -2
- package/templates/runtime/react/canvas/canvas-shell-interactions.test.tsx +30 -0
- package/templates/runtime/react/canvas/canvas-shell-pinch-interactions.test.tsx +155 -0
- package/templates/runtime/react/canvas/canvas-shell-rendering.test.tsx +1 -1
- package/templates/runtime/react/canvas/canvas-shell.tsx +16 -5
- package/templates/runtime/react/canvas/canvas-viewport-geometry.ts +133 -0
- package/templates/runtime/react/canvas/use-canvas-viewport-interactions.ts +285 -36
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.color-applicability-layout.test.tsx +134 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.color-layout.test.tsx +16 -1
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.render-isolation.test.tsx +2 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.scene-export-actions.test.tsx +39 -0
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.setup-controls.test.tsx +3 -3
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.source-collection.test.tsx +1 -4
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.source-color-bank.test.tsx +2 -2
- package/templates/runtime/react/controls-panel/__tests__/controls-panel.vector-interaction.test.tsx +6 -6
- package/templates/runtime/react/controls-panel/actions/controls-panel-actions.ts +2 -2
- package/templates/runtime/react/controls-panel/actions/export-action-runner.ts +40 -11
- package/templates/runtime/react/controls-panel/layout/controls-panel-layout.tsx +31 -2
- package/templates/runtime/react/controls-panel/layout/controls-panel-section.tsx +4 -1
- package/templates/runtime/react/controls-panel/renderers/controls-panel-action-renderer.tsx +2 -1
- package/templates/runtime/react/controls-panel/renderers/controls-panel-basic-renderers.tsx +2 -52
- package/templates/runtime/react/controls-panel/values/controls-panel-color-values.ts +1 -9
- package/templates/runtime/react/controls-panel/values/controls-panel-spatial-values.ts +7 -2
- package/templates/runtime/react/orientation-gizmo/orientation-gizmo-math.ts +9 -69
- package/templates/runtime/schema/artifact-export-actions.test.ts +47 -0
- package/templates/runtime/schema/artifact-export-actions.ts +49 -0
- package/templates/runtime/schema/types.ts +1 -0
- package/templates/runtime/state/canvas-background-state.ts +1 -16
- package/templates/runtime/state/canvas-state.ts +32 -20
- package/templates/runtime/state/control-value-codecs.test.ts +98 -0
- package/templates/runtime/state/control-value-codecs.ts +700 -0
- package/templates/runtime/state/control-value-normalization.test.ts +1 -1
- package/templates/runtime/state/control-value-normalization.ts +127 -135
- package/templates/runtime/state/controls-reducer.ts +26 -3
- package/templates/runtime/state/create-template-state.test.ts +30 -0
- package/templates/runtime/state/create-template-state.ts +52 -31
- package/templates/runtime/state/orientation-pose.ts +80 -0
- package/templates/runtime/state/persistence-control-values.test.ts +59 -0
- package/templates/runtime/state/reducer-controls.test.ts +45 -0
- package/templates/runtime/state/reducer-media-reset.test.ts +1 -1
- package/templates/runtime/state/reducer-timeline.test.ts +70 -0
- package/templates/runtime/state/timeline-reducer.ts +40 -2
- package/templates/runtime/testing/performance-schema-queries.ts +2 -2
- package/templates/starter/AGENTS.md +21 -22
- package/templates/starter/docs/toolcraft/README.md +6 -6
- package/templates/starter/docs/toolcraft/acceptance-testing.md +20 -20
- package/templates/starter/docs/toolcraft/agent-worklog.md +88 -1
- package/templates/starter/docs/toolcraft/assembly-workflow.md +7 -6
- package/templates/starter/docs/toolcraft/component-rules.md +2 -2
- package/templates/starter/docs/toolcraft/core/layout.md +6 -1
- package/templates/starter/docs/toolcraft/core/media-upload.md +1 -1
- package/templates/starter/docs/toolcraft/core/performance.md +8 -10
- package/templates/starter/docs/toolcraft/core/reference-study.md +80 -19
- package/templates/starter/docs/toolcraft/core/runtime-boundary.md +2 -1
- package/templates/starter/docs/toolcraft/core/setup-export.md +43 -13
- package/templates/starter/docs/toolcraft/decision-contract.md +2 -2
- package/templates/starter/docs/toolcraft/performance.md +8 -10
- package/templates/starter/docs/toolcraft/renderer-technique.md +2 -2
- package/templates/starter/docs/toolcraft/schema-reference.md +8 -8
- package/templates/starter/docs/toolcraft/workflow.md +14 -14
- package/templates/starter/e2e/app-browser-infinity-canvas-evidence.spec.ts +38 -0
- package/templates/starter/e2e/app-browser-motion-reference-requirements.spec.ts +411 -0
- package/templates/starter/e2e/app-browser-proof-session.spec.ts +85 -0
- package/templates/starter/e2e/app-browser-runtime-requirements.spec.ts +62 -0
- package/templates/starter/e2e/app-browser-selection-scope-evidence.spec.ts +137 -0
- package/templates/starter/e2e/browser-infinity-canvas-svg-evidence.ts +42 -0
- package/templates/starter/e2e/browser-layer-evidence-helpers.ts +15 -36
- package/templates/starter/e2e/browser-product-raster-snapshot.ts +213 -0
- package/templates/starter/e2e/browser-proof-session.ts +43 -15
- package/templates/starter/e2e/browser-proof-surface-action.ts +79 -0
- package/templates/starter/e2e/browser-proof-types.ts +15 -0
- package/templates/starter/e2e/browser-runtime-evidence-requirements.ts +22 -6
- package/templates/starter/e2e/browser-selection-scope-evidence.ts +269 -0
- package/templates/starter/e2e/browser-semantic-evidence-test-helpers.ts +97 -0
- package/templates/starter/e2e/browser-svg-export-evidence.spec.ts +79 -0
- package/templates/starter/e2e/browser-svg-export-evidence.ts +152 -0
- package/templates/starter/e2e/export-artifact-helpers.ts +70 -0
- package/templates/starter/e2e/product-observable-helpers.ts +8 -129
- package/templates/starter/e2e/svg-artifact-inspection.spec.ts +136 -0
- package/templates/starter/e2e/svg-artifact-inspection.ts +331 -0
- package/templates/starter/e2e/svg-download-test-fixtures.ts +34 -0
- package/templates/starter/e2e/toolcraft-delivery-catalog-reporter.ts +198 -15
- package/templates/starter/e2e/toolcraft-feature-verification-reporter.spec.ts +149 -0
- package/templates/starter/e2e/toolcraft-feature-verification-reporter.ts +223 -0
- package/templates/starter/package.json +2 -0
- package/templates/starter/scripts/check-toolcraft-docs.mjs +1 -0
- package/templates/starter/scripts/create-toolcraft-motion-reference-study.mjs +233 -0
- package/templates/starter/scripts/create-toolcraft-motion-reference-study.test.mjs +459 -0
- package/templates/starter/scripts/playwright-test-title-selection.d.mts +45 -0
- package/templates/starter/scripts/run-browser-performance-test-helpers.mjs +0 -27
- package/templates/starter/scripts/run-browser-performance.mjs +0 -6
- package/templates/starter/scripts/run-browser-performance.test.mjs +5 -13
- package/templates/starter/scripts/run-delivery-verification-test-helpers.mjs +0 -34
- package/templates/starter/scripts/run-delivery-verification.test.mjs +135 -31
- package/templates/starter/scripts/run-feature-verification.mjs +212 -0
- package/templates/starter/scripts/run-feature-verification.test.mjs +226 -0
- package/templates/starter/scripts/toolcraft-checkpoint-delivery-state.mjs +21 -8
- package/templates/starter/scripts/toolcraft-checkpoint-delivery-state.test.mjs +32 -92
- package/templates/starter/scripts/toolcraft-checkpoint-transaction.mjs +28 -6
- package/templates/starter/scripts/toolcraft-checkpoint-transaction.test.mjs +8 -63
- package/templates/starter/scripts/toolcraft-delivery-anchor.mjs +28 -8
- package/templates/starter/scripts/toolcraft-delivery-anchor.test.mjs +50 -61
- package/templates/starter/scripts/toolcraft-delivery-architecture-inventory.mjs +0 -4
- package/templates/starter/scripts/toolcraft-delivery-architecture-policy.mjs +0 -1
- package/templates/starter/scripts/toolcraft-delivery-evidence.test.mjs +2 -3
- package/templates/starter/scripts/toolcraft-delivery-executor.mjs +5 -1
- package/templates/starter/scripts/toolcraft-delivery-executor.test.mjs +5 -12
- package/templates/starter/scripts/toolcraft-delivery-functional-context.d.mts +1 -48
- package/templates/starter/scripts/toolcraft-delivery-functional-context.mjs +2 -30
- package/templates/starter/scripts/toolcraft-delivery-functional-context.test.mjs +4 -166
- package/templates/starter/scripts/toolcraft-delivery-functional-initial.test.mjs +4 -20
- package/templates/starter/scripts/toolcraft-delivery-lifecycle.mjs +43 -192
- package/templates/starter/scripts/toolcraft-delivery-performance-iteration-lifecycle.test.mjs +79 -440
- package/templates/starter/scripts/toolcraft-delivery-plan-authority.test.mjs +102 -297
- package/templates/starter/scripts/toolcraft-delivery-plan-construction.mjs +46 -97
- package/templates/starter/scripts/toolcraft-delivery-plan-test-helpers.mjs +125 -0
- package/templates/starter/scripts/toolcraft-delivery-plan-validation.test.mjs +58 -0
- package/templates/starter/scripts/toolcraft-delivery-plan.d.mts +19 -31
- package/templates/starter/scripts/toolcraft-delivery-plan.mjs +254 -252
- package/templates/starter/scripts/toolcraft-delivery-plan.test.mjs +29 -457
- package/templates/starter/scripts/toolcraft-delivery-receipt-performance.test.mjs +1 -1
- package/templates/starter/scripts/toolcraft-delivery-receipt-strictness.test.mjs +3 -72
- package/templates/starter/scripts/toolcraft-delivery-receipt-test-helpers.mjs +7 -36
- package/templates/starter/scripts/toolcraft-delivery-receipt.d.mts +3 -5
- package/templates/starter/scripts/toolcraft-delivery-receipt.mjs +15 -31
- package/templates/starter/scripts/toolcraft-delivery-receipt.test.mjs +28 -20
- package/templates/starter/scripts/toolcraft-delivery-receipt.types.test.mts +22 -30
- package/templates/starter/scripts/toolcraft-feature-verification-plan.d.mts +20 -0
- package/templates/starter/scripts/toolcraft-feature-verification-plan.mjs +146 -0
- package/templates/starter/scripts/toolcraft-feature-verification-plan.test.mjs +96 -0
- package/templates/starter/scripts/toolcraft-functional-proof-model.d.mts +3 -18
- package/templates/starter/scripts/toolcraft-functional-proof-model.mjs +39 -127
- package/templates/starter/scripts/toolcraft-functional-proof-model.test.mjs +25 -362
- package/templates/starter/scripts/toolcraft-functional-proof-model.types.test.mts +6 -83
- package/templates/starter/scripts/toolcraft-functional-proof-primitives.d.mts +11 -0
- package/templates/starter/scripts/toolcraft-functional-proof-primitives.mjs +61 -0
- package/templates/starter/scripts/toolcraft-functional-proof-primitives.test.mjs +43 -0
- package/templates/starter/scripts/toolcraft-integrity-policy.mjs +13 -0
- package/templates/starter/scripts/toolcraft-integrity-test-utils.mjs +1 -1
- package/templates/starter/scripts/toolcraft-layer-evidence-facade.test.mjs +58 -22
- package/templates/starter/scripts/toolcraft-motion-reference-analysis-protocol.mjs +111 -0
- package/templates/starter/scripts/toolcraft-motion-reference-analysis-protocol.test.mjs +116 -0
- package/templates/starter/scripts/toolcraft-motion-reference-artifacts.d.mts +37 -0
- package/templates/starter/scripts/toolcraft-motion-reference-artifacts.mjs +308 -0
- package/templates/starter/scripts/toolcraft-motion-reference-artifacts.test.mjs +420 -0
- package/templates/starter/scripts/toolcraft-motion-reference-artifacts.types.test.mts +50 -0
- package/templates/starter/scripts/toolcraft-motion-reference-command-options.mjs +195 -0
- package/templates/starter/scripts/toolcraft-motion-reference-command-options.test.mjs +224 -0
- package/templates/starter/scripts/toolcraft-motion-reference-contact-sheet.mjs +122 -0
- package/templates/starter/scripts/toolcraft-motion-reference-contact-sheet.test.mjs +153 -0
- package/templates/starter/scripts/toolcraft-motion-reference-evidence-assembly.mjs +270 -0
- package/templates/starter/scripts/toolcraft-motion-reference-evidence.test.mjs +432 -0
- package/templates/starter/scripts/toolcraft-motion-reference-ffmpeg-output.mjs +275 -0
- package/templates/starter/scripts/toolcraft-motion-reference-ffmpeg-output.test.mjs +294 -0
- package/templates/starter/scripts/toolcraft-motion-reference-group-inventory.mjs +148 -0
- package/templates/starter/scripts/toolcraft-motion-reference-image-filter-graph.mjs +101 -0
- package/templates/starter/scripts/toolcraft-motion-reference-image-filter-graph.test.mjs +124 -0
- package/templates/starter/scripts/toolcraft-motion-reference-image-source.mjs +259 -0
- package/templates/starter/scripts/toolcraft-motion-reference-image-source.test.mjs +338 -0
- package/templates/starter/scripts/toolcraft-motion-reference-image-timing.mjs +96 -0
- package/templates/starter/scripts/toolcraft-motion-reference-image-timing.test.mjs +81 -0
- package/templates/starter/scripts/toolcraft-motion-reference-lock-recovery.test.mjs +144 -0
- package/templates/starter/scripts/toolcraft-motion-reference-media-source.mjs +165 -0
- package/templates/starter/scripts/toolcraft-motion-reference-media-source.test.mjs +299 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-discovery.test.mjs +142 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-isolation.test.mjs +234 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-journal-schema.mjs +122 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-journal-store.mjs +89 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-journal-store.test.mjs +74 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-journal.mjs +264 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-journal.test.mjs +377 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-lease.mjs +254 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-lease.test.mjs +130 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-staging.mjs +128 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication-staging.test.mjs +209 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication.fixtures.mjs +88 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication.mjs +249 -0
- package/templates/starter/scripts/toolcraft-motion-reference-publication.test.mjs +433 -0
- package/templates/starter/scripts/toolcraft-motion-reference-review-output.mjs +38 -0
- package/templates/starter/scripts/toolcraft-motion-reference-review-output.test.mjs +29 -0
- package/templates/starter/scripts/toolcraft-motion-reference-root-safety.test.mjs +84 -0
- package/templates/starter/scripts/toolcraft-motion-reference-roots.mjs +83 -0
- package/templates/starter/scripts/toolcraft-motion-reference-sampling.mjs +283 -0
- package/templates/starter/scripts/toolcraft-motion-reference-sampling.test.mjs +480 -0
- package/templates/starter/scripts/toolcraft-motion-reference-stage-registry.mjs +39 -0
- package/templates/starter/scripts/toolcraft-motion-reference-stage-registry.test.mjs +59 -0
- package/templates/starter/scripts/toolcraft-motion-reference-stage.mjs +71 -0
- package/templates/starter/scripts/toolcraft-motion-reference-stage.test.mjs +61 -0
- package/templates/starter/scripts/toolcraft-motion-review-numeric.mjs +74 -0
- package/templates/starter/scripts/toolcraft-motion-review-numeric.test.mjs +65 -0
- package/templates/starter/scripts/toolcraft-motion-review-partitioning.mjs +268 -0
- package/templates/starter/scripts/toolcraft-motion-review-partitioning.test.mjs +329 -0
- package/templates/starter/scripts/toolcraft-motion-review-protected-units.mjs +120 -0
- package/templates/starter/scripts/toolcraft-motion-review-protected-units.test.mjs +111 -0
- package/templates/starter/scripts/toolcraft-performance-escalation-policy.test.mjs +77 -345
- package/templates/starter/scripts/toolcraft-performance-receipt-validation.test.mjs +19 -21
- package/templates/starter/scripts/toolcraft-product-boundary-ast.mjs +1 -1
- package/templates/starter/scripts/toolcraft-product-export-boundary.mjs +10 -1
- package/templates/starter/scripts/toolcraft-product-export-boundary.test.mjs +5 -1
- package/templates/starter/scripts/toolcraft-product-observable-facade.test.mjs +46 -1
- package/templates/starter/scripts/toolcraft-receipt-boundary.test.mjs +0 -1
- package/templates/starter/scripts/toolcraft-source-inventory.d.mts +5 -0
- package/templates/starter/scripts/toolcraft-source-inventory.mjs +25 -14
- package/templates/starter/scripts/toolcraft-source-inventory.test.mjs +48 -0
- package/templates/starter/scripts/toolcraft-source-ownership.mjs +0 -1
- package/templates/starter/scripts/toolcraft-source-ownership.test.mjs +30 -5
- package/templates/starter/scripts/toolcraft-verification-receipt-test-helpers.mjs +5 -26
- package/templates/starter/scripts/toolcraft-verification-receipt.d.mts +0 -7
- package/templates/starter/scripts/toolcraft-verification-receipt.mjs +3 -47
- package/templates/starter/scripts/toolcraft-verification-receipt.test.mjs +6 -87
- package/templates/starter/scripts/toolcraft-vitest-runtime-contract.d.mts +19 -0
- package/templates/starter/scripts/toolcraft-vitest-runtime-contract.mjs +107 -0
- package/templates/starter/scripts/toolcraft-vitest-runtime-contract.test.mjs +114 -0
- package/templates/starter/scripts/toolcraft-vitest-runtime-evidence-reporter.mjs +13 -2
- package/templates/starter/scripts/toolcraft-vitest-runtime-evidence-reporter.test.mjs +110 -0
- package/templates/starter/src/app/acceptance/artifact-export-intent.ts +51 -20
- package/templates/starter/src/app/acceptance/canvas-coverage.ts +1 -0
- package/templates/starter/src/app/acceptance/color-bank-labels.ts +11 -15
- package/templates/starter/src/app/acceptance/color-row-grouping.ts +33 -0
- package/templates/starter/src/app/acceptance/control-acceptance-coverage.ts +0 -11
- package/templates/starter/src/app/acceptance/control-acceptance-policy.ts +2 -3
- package/templates/starter/src/app/acceptance/control-component-rules.ts +0 -10
- package/templates/starter/src/app/acceptance/control-labels.ts +30 -1
- package/templates/starter/src/app/acceptance/control-layout-section-rules.ts +18 -0
- package/templates/starter/src/app/acceptance/export-artifact-coverage.ts +25 -17
- package/templates/starter/src/app/acceptance/feature-verification-selection.test.ts +295 -0
- package/templates/starter/src/app/acceptance/feature-verification-selection.ts +161 -0
- package/templates/starter/src/app/acceptance/infinity-canvas.ts +10 -0
- package/templates/starter/src/app/acceptance/interaction-ownership-intent.ts +19 -1
- package/templates/starter/src/app/acceptance/interaction-ownership.ts +18 -2
- package/templates/starter/src/app/acceptance/motion-reference-evidence-validation.mjs +65 -0
- package/templates/starter/src/app/acceptance/motion-reference-evidence-windows.mjs +301 -0
- package/templates/starter/src/app/acceptance/motion-reference-evidence.d.mts +11 -0
- package/templates/starter/src/app/acceptance/motion-reference-evidence.mjs +145 -0
- package/templates/starter/src/app/acceptance/motion-reference-study-behaviors.ts +162 -0
- package/templates/starter/src/app/acceptance/motion-reference-study-coverage.ts +206 -0
- package/templates/starter/src/app/acceptance/motion-reference-study-identity.ts +129 -0
- package/templates/starter/src/app/acceptance/motion-reference-study-partitions.ts +186 -0
- package/templates/starter/src/app/acceptance/motion-reference-study.ts +90 -0
- package/templates/starter/src/app/acceptance/output-export-actions.test.ts +9 -1
- package/templates/starter/src/app/acceptance/output-export-actions.ts +14 -22
- package/templates/starter/src/app/acceptance/output-export-layout-rules.ts +5 -1
- package/templates/starter/src/app/acceptance/output-export-model.ts +4 -0
- package/templates/starter/src/app/acceptance/output-export.ts +4 -1
- package/templates/starter/src/app/acceptance/reference-study-types.ts +167 -17
- package/templates/starter/src/app/acceptance/runtime-coverage.ts +6 -1
- package/templates/starter/src/app/acceptance/selection-scope.test.ts +200 -0
- package/templates/starter/src/app/acceptance/selection-scope.ts +151 -0
- package/templates/starter/src/app/acceptance/transfer-mode-types.ts +114 -0
- package/templates/starter/src/app/acceptance/types.ts +43 -118
- package/templates/starter/src/app/acceptance/validate-coverage.ts +14 -3
- package/templates/starter/src/app/starter-acceptance-data.ts +1 -0
- package/templates/starter/src/app/starter-acceptance.animation-intent.test.ts +3 -0
- package/templates/starter/src/app/starter-acceptance.artifact-export-intent.test.ts +81 -8
- package/templates/starter/src/app/starter-acceptance.background-export.test.ts +2 -0
- package/templates/starter/src/app/starter-acceptance.canvas-sizing.test.ts +2 -0
- package/templates/starter/src/app/starter-acceptance.color-row-grouping.test.ts +118 -0
- package/templates/starter/src/app/starter-acceptance.compound-part-coverage.test.ts +1 -1
- package/templates/starter/src/app/starter-acceptance.contract-fixtures.ts +1 -0
- package/templates/starter/src/app/starter-acceptance.control-applicability.test.ts +1 -0
- package/templates/starter/src/app/starter-acceptance.control-label-context.test.ts +1 -0
- package/templates/starter/src/app/starter-acceptance.control-labels.test.ts +78 -3
- package/templates/starter/src/app/starter-acceptance.control-naming-rules.test.ts +77 -1
- package/templates/starter/src/app/starter-acceptance.custom-control-fit-check.test.ts +1 -1
- package/templates/starter/src/app/starter-acceptance.export-artifact.test.ts +74 -3
- package/templates/starter/src/app/starter-acceptance.export-test-utils.ts +5 -1
- package/templates/starter/src/app/starter-acceptance.image-export-settings.test.ts +2 -0
- package/templates/starter/src/app/starter-acceptance.interaction-ownership.test.ts +19 -3
- package/templates/starter/src/app/starter-acceptance.layers.test.ts +2 -1
- package/templates/starter/src/app/starter-acceptance.media-upload.test.ts +28 -0
- package/templates/starter/src/app/starter-acceptance.motion-reference-evidence.test.ts +17 -0
- package/templates/starter/src/app/starter-acceptance.motion-reference-identity.test.ts +163 -0
- package/templates/starter/src/app/starter-acceptance.motion-reference-mapping.test.ts +133 -0
- package/templates/starter/src/app/starter-acceptance.motion-reference-ownership.test.ts +121 -0
- package/templates/starter/src/app/starter-acceptance.motion-reference-partitions.test.ts +210 -0
- package/templates/starter/src/app/starter-acceptance.motion-reference-test-utils.ts +313 -0
- package/templates/starter/src/app/starter-acceptance.output-export-intent.test.ts +78 -4
- package/templates/starter/src/app/starter-acceptance.product-output-export.test.ts +6 -1
- package/templates/starter/src/app/starter-acceptance.product-readiness.test.ts +18 -1
- package/templates/starter/src/app/starter-acceptance.product-worklog.test.ts +123 -2
- package/templates/starter/src/app/starter-acceptance.reference-custom-timeline.test.ts +2 -0
- package/templates/starter/src/app/starter-acceptance.reference-foundation.test.ts +8 -0
- package/templates/starter/src/app/starter-acceptance.reference-timeline.test.ts +7 -0
- package/templates/starter/src/app/starter-acceptance.section-cohesion.test.ts +2 -0
- package/templates/starter/src/app/starter-acceptance.timeline-playback.test.ts +5 -0
- package/templates/starter/src/app/starter-acceptance.ts +34 -8
- package/templates/starter/src/app/starter-acceptance.video-export-settings.test.ts +2 -0
- package/templates/starter/src/app/starter-acceptance.video-reference-study.test.ts +34 -236
- package/templates/starter/src/app/starter-acceptance.view-interaction.test.ts +4 -0
- package/templates/starter/src/app/starter-acceptance.worklog-test-utils.ts +122 -6
- package/templates/starter/src/app/starter-acceptance.worklog.test.ts +152 -16
- package/templates/starter/src/app/starter-performance.gates.test.ts +20 -18
- package/templates/starter/src/app/starter-performance.lifecycle.test.ts +22 -6
- package/templates/starter/src/app/test-evidence/browser-runtime-contract.ts +3 -0
- package/templates/starter/tsconfig.json +1 -0
- package/templates/starter/scripts/toolcraft-browser-impact-selection.mjs +0 -26
- package/templates/starter/scripts/toolcraft-delivery-framework-refresh.test.mjs +0 -141
- package/templates/starter/scripts/toolcraft-delivery-functional-changed.test.mjs +0 -468
- package/templates/starter/scripts/toolcraft-delivery-functional-model-lifecycle.test.mjs +0 -254
- package/templates/starter/scripts/toolcraft-delivery-functional-semantic-regression.test.mjs +0 -135
- package/templates/starter/scripts/toolcraft-delivery-performance-iteration-durability.test.mjs +0 -329
- package/templates/starter/scripts/toolcraft-delivery-plan-errors.test.mjs +0 -430
- package/templates/starter/scripts/toolcraft-delivery-plan-functional-model.test.mjs +0 -358
- package/templates/starter/scripts/toolcraft-functional-proof-regression-fixtures.mjs +0 -298
- package/templates/starter/scripts/toolcraft-verification-impact-inventory.d.mts +0 -62
- package/templates/starter/scripts/toolcraft-verification-impact-inventory.mjs +0 -344
- package/templates/starter/scripts/toolcraft-verification-impact-inventory.test.mjs +0 -204
- package/templates/starter/scripts/toolcraft-verification-impact-performance-candidates.test.mjs +0 -210
- package/templates/starter/scripts/toolcraft-verification-impact-resolution.mjs +0 -344
- package/templates/starter/scripts/toolcraft-verification-impact-resolution.test.mjs +0 -270
- package/templates/starter/scripts/toolcraft-verification-impact-semantic-resolution.test.mjs +0 -449
- package/templates/starter/scripts/toolcraft-verification-impact-support-resolution.test.mjs +0 -195
- package/templates/starter/scripts/toolcraft-verification-impact.d.mts +0 -132
- package/templates/starter/scripts/toolcraft-verification-impact.mjs +0 -169
- package/templates/starter/scripts/toolcraft-verification-impact.test.mjs +0 -300
- package/templates/starter/scripts/toolcraft-verification-input-roles.mjs +0 -197
- package/templates/starter/scripts/toolcraft-verification-input-roles.test.mjs +0 -225
- package/templates/starter/src/app/acceptance/video-reference-study.ts +0 -217
- package/templates/starter/src/app/starter-verification-impact.json +0 -15
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TOOLCRAFT_MOTION_ANALYSIS_COMPONENT_MAX,
|
|
3
|
+
TOOLCRAFT_MOTION_FFMPEG_TIMESTAMP_TOLERANCE_SECONDS,
|
|
4
|
+
} from "./toolcraft-motion-reference-analysis-protocol.mjs";
|
|
5
|
+
|
|
6
|
+
function fail(message) {
|
|
7
|
+
throw new TypeError(`Invalid Toolcraft motion FFmpeg output: ${message}`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function isRecord(value) {
|
|
11
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function finiteNumber(value, label) {
|
|
15
|
+
if (typeof value === "number") {
|
|
16
|
+
if (Number.isFinite(value)) return value;
|
|
17
|
+
fail(`${label} must be finite`);
|
|
18
|
+
}
|
|
19
|
+
if (typeof value !== "string" ||
|
|
20
|
+
!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/iu.test(value.trim())) {
|
|
21
|
+
fail(`${label} must be a finite locale-independent number`);
|
|
22
|
+
}
|
|
23
|
+
const parsed = Number(value);
|
|
24
|
+
if (!Number.isFinite(parsed)) fail(`${label} must be finite`);
|
|
25
|
+
return parsed;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function optionalFiniteNumber(value, label) {
|
|
29
|
+
if (value === undefined || value === null || value === "" || value === "N/A") {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
return finiteNumber(value, label);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function positiveInteger(value, label) {
|
|
36
|
+
const parsed = typeof value === "string" && /^\d+$/u.test(value) ?
|
|
37
|
+
Number(value) : value;
|
|
38
|
+
if (!Number.isInteger(parsed) || parsed <= 0) fail(`${label} must be positive`);
|
|
39
|
+
return parsed;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function nominalFrameRate(value) {
|
|
43
|
+
if (value === undefined || value === null || value === "" || value === "0/0") {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const match = typeof value === "string" ?
|
|
47
|
+
/^(\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)$/u.exec(value.trim()) : null;
|
|
48
|
+
if (!match) fail("visual stream frame rate must be a positive rational");
|
|
49
|
+
const numerator = finiteNumber(match[1], "frame-rate numerator");
|
|
50
|
+
const denominator = finiteNumber(match[2], "frame-rate denominator");
|
|
51
|
+
if (numerator <= 0 || denominator <= 0) fail("visual stream frame rate must be positive");
|
|
52
|
+
return numerator / denominator;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function pixelFormatHasAlpha(document, pixelFormat) {
|
|
56
|
+
if (!Array.isArray(document.pixel_formats)) {
|
|
57
|
+
fail("ffprobe pixel format descriptors are required");
|
|
58
|
+
}
|
|
59
|
+
const matches = document.pixel_formats.filter((descriptor) =>
|
|
60
|
+
isRecord(descriptor) && descriptor.name === pixelFormat);
|
|
61
|
+
if (matches.length === 0) fail(`pixel format descriptor ${pixelFormat} is missing`);
|
|
62
|
+
if (matches.length > 1) fail(`duplicate pixel format descriptor ${pixelFormat}`);
|
|
63
|
+
const descriptor = matches[0];
|
|
64
|
+
if (!Number.isInteger(descriptor.nb_components) || descriptor.nb_components <= 0 ||
|
|
65
|
+
!Array.isArray(descriptor.components) ||
|
|
66
|
+
descriptor.components.length !== descriptor.nb_components ||
|
|
67
|
+
descriptor.components.some((component) =>
|
|
68
|
+
!isRecord(component) || !Number.isInteger(component.index) ||
|
|
69
|
+
component.index <= 0 || !Number.isInteger(component.bit_depth) ||
|
|
70
|
+
component.bit_depth <= 0)) {
|
|
71
|
+
fail(`pixel format descriptor ${pixelFormat} has an invalid component model`);
|
|
72
|
+
}
|
|
73
|
+
if (!isRecord(descriptor.flags) ||
|
|
74
|
+
descriptor.flags.alpha !== 0 && descriptor.flags.alpha !== 1) {
|
|
75
|
+
fail(`pixel format descriptor ${pixelFormat} has an invalid alpha flag`);
|
|
76
|
+
}
|
|
77
|
+
return descriptor.flags.alpha === 1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function normalizeToolcraftMotionToolVersion(stdout, tool) {
|
|
81
|
+
if (tool !== "ffmpeg" && tool !== "ffprobe") {
|
|
82
|
+
fail("tool version owner must be ffmpeg or ffprobe");
|
|
83
|
+
}
|
|
84
|
+
if (typeof stdout !== "string") fail(`${tool} version output must be text`);
|
|
85
|
+
const match = new RegExp(`^\\s*${tool}\\s+version\\s+([^\\s]+)`, "iu").exec(stdout);
|
|
86
|
+
if (!match) fail(`${tool} version output is missing`);
|
|
87
|
+
return `${tool} ${match[1]}`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function parseToolcraftMotionFfprobeJson(stdout) {
|
|
91
|
+
let document;
|
|
92
|
+
try {
|
|
93
|
+
document = JSON.parse(stdout);
|
|
94
|
+
} catch {
|
|
95
|
+
fail("expected valid ffprobe JSON");
|
|
96
|
+
}
|
|
97
|
+
if (!isRecord(document)) {
|
|
98
|
+
fail("ffprobe JSON must be an object");
|
|
99
|
+
}
|
|
100
|
+
const visualStream = Array.isArray(document.streams) ?
|
|
101
|
+
document.streams.find((stream) =>
|
|
102
|
+
isRecord(stream) && stream.codec_type === "video") :
|
|
103
|
+
undefined;
|
|
104
|
+
if (!visualStream) fail("a visual stream is required");
|
|
105
|
+
const width = positiveInteger(visualStream.width, "visual stream width");
|
|
106
|
+
const height = positiveInteger(visualStream.height, "visual stream height");
|
|
107
|
+
if (!width || !height) fail("visual stream dimensions are required");
|
|
108
|
+
if (typeof visualStream.pix_fmt !== "string" || visualStream.pix_fmt.length === 0) {
|
|
109
|
+
fail("visual stream pixel format is required");
|
|
110
|
+
}
|
|
111
|
+
if (!Array.isArray(document.frames) || document.frames.length === 0) {
|
|
112
|
+
fail("at least one decoded frame is required");
|
|
113
|
+
}
|
|
114
|
+
const decodedFrameTimes = document.frames.map((frame, index) => {
|
|
115
|
+
if (!isRecord(frame)) fail(`decoded frame ${index} must be an object`);
|
|
116
|
+
return finiteNumber(
|
|
117
|
+
frame.best_effort_timestamp_time ?? frame.pts_time,
|
|
118
|
+
`decoded frame ${index} timestamp`,
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
decodedFrameTimes.forEach((time, index) => {
|
|
122
|
+
if (index > 0 && time <= decodedFrameTimes[index - 1]) {
|
|
123
|
+
fail("decoded frame timestamps must be strictly increasing");
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
const timelineOrigin = decodedFrameTimes[0];
|
|
127
|
+
const frameTimes = decodedFrameTimes.map((time) => time - timelineOrigin);
|
|
128
|
+
const decodedFrameCount = frameTimes.length;
|
|
129
|
+
if (visualStream.nb_frames !== undefined && visualStream.nb_frames !== "N/A" &&
|
|
130
|
+
positiveInteger(visualStream.nb_frames, "visual stream frame count") !==
|
|
131
|
+
decodedFrameCount) {
|
|
132
|
+
fail("visual stream frame count must match decoded frame records");
|
|
133
|
+
}
|
|
134
|
+
const averageRate = nominalFrameRate(visualStream.avg_frame_rate);
|
|
135
|
+
const rate = averageRate ?? nominalFrameRate(visualStream.r_frame_rate);
|
|
136
|
+
const frameTail = rate ? 1 / rate : frameTimes.length > 1 ?
|
|
137
|
+
frameTimes.at(-1) - frameTimes.at(-2) : 0;
|
|
138
|
+
const decodedDuration = frameTimes.at(-1) + frameTail;
|
|
139
|
+
const format = isRecord(document.format) ? document.format : {};
|
|
140
|
+
const rawDuration = optionalFiniteNumber(
|
|
141
|
+
format.duration ?? visualStream.duration, "visual duration",
|
|
142
|
+
);
|
|
143
|
+
const declaredStart = optionalFiniteNumber(
|
|
144
|
+
format.start_time ?? visualStream.start_time, "visual start time",
|
|
145
|
+
);
|
|
146
|
+
let declaredDuration;
|
|
147
|
+
if (rawDuration !== undefined) {
|
|
148
|
+
if (declaredStart !== undefined && declaredStart > 0 &&
|
|
149
|
+
rawDuration > decodedDuration +
|
|
150
|
+
TOOLCRAFT_MOTION_FFMPEG_TIMESTAMP_TOLERANCE_SECONDS) {
|
|
151
|
+
declaredDuration = rawDuration - declaredStart;
|
|
152
|
+
} else if (declaredStart !== undefined ||
|
|
153
|
+
rawDuration <= decodedDuration +
|
|
154
|
+
TOOLCRAFT_MOTION_FFMPEG_TIMESTAMP_TOLERANCE_SECONDS ||
|
|
155
|
+
Math.abs(timelineOrigin) <=
|
|
156
|
+
TOOLCRAFT_MOTION_FFMPEG_TIMESTAMP_TOLERANCE_SECONDS) {
|
|
157
|
+
declaredDuration = rawDuration;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const durationSeconds = declaredDuration !== undefined &&
|
|
161
|
+
decodedDuration - declaredDuration <=
|
|
162
|
+
TOOLCRAFT_MOTION_FFMPEG_TIMESTAMP_TOLERANCE_SECONDS ?
|
|
163
|
+
declaredDuration : Math.max(decodedDuration, declaredDuration ?? 0);
|
|
164
|
+
if (!(durationSeconds > 0)) fail("visual duration must be positive");
|
|
165
|
+
const rawVersion = isRecord(document.program_version) ?
|
|
166
|
+
document.program_version.version : undefined;
|
|
167
|
+
if (typeof rawVersion !== "string" || rawVersion.trim().length === 0) {
|
|
168
|
+
fail("ffprobe version metadata is required");
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
decodedFrameCount,
|
|
172
|
+
durationSeconds,
|
|
173
|
+
ffprobeVersion: normalizeToolcraftMotionToolVersion(
|
|
174
|
+
`ffprobe version ${rawVersion.trim()}`, "ffprobe",
|
|
175
|
+
),
|
|
176
|
+
frameTimes,
|
|
177
|
+
hasAlpha: pixelFormatHasAlpha(document, visualStream.pix_fmt),
|
|
178
|
+
height,
|
|
179
|
+
...(rate === undefined ? {} : { nominalFrameRate: rate }),
|
|
180
|
+
pixelFormat: visualStream.pix_fmt,
|
|
181
|
+
width,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function completeRecord(records, record) {
|
|
186
|
+
if (!record) return;
|
|
187
|
+
if (record.channel !== "color" && record.channel !== "alpha") {
|
|
188
|
+
fail(`frame ${record.frameIndex} has an invalid channel`);
|
|
189
|
+
}
|
|
190
|
+
const key = `${record.channel}:${record.frameIndex}`;
|
|
191
|
+
if (records.has(key)) fail(`duplicate ${record.channel} frame record ${record.frameIndex}`);
|
|
192
|
+
records.set(key, record);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function parseSignalValue(record, key) {
|
|
196
|
+
if (!record.values.has(key)) fail(`frame ${record.frameIndex} is missing ${key}`);
|
|
197
|
+
const value = finiteNumber(record.values.get(key), `${key} for frame ${record.frameIndex}`);
|
|
198
|
+
if (value < 0 || value > TOOLCRAFT_MOTION_ANALYSIS_COMPONENT_MAX) {
|
|
199
|
+
fail(`${key} must be between 0 and ${TOOLCRAFT_MOTION_ANALYSIS_COMPONENT_MAX}`);
|
|
200
|
+
}
|
|
201
|
+
return value;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function sortedChannelRecords(records, channel) {
|
|
205
|
+
const values = [...records.values()].filter((record) => record.channel === channel)
|
|
206
|
+
.sort((left, right) => left.frameIndex - right.frameIndex);
|
|
207
|
+
values.forEach((record, index) => {
|
|
208
|
+
if (record.frameIndex !== index) fail(`missing frame record ${index} for ${channel}`);
|
|
209
|
+
});
|
|
210
|
+
return values;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export function parseToolcraftMotionSignalstats(stdout, { requireAlpha = false } = {}) {
|
|
214
|
+
if (typeof stdout !== "string" || stdout.trim().length === 0) {
|
|
215
|
+
fail("signalstats output is required");
|
|
216
|
+
}
|
|
217
|
+
const records = new Map();
|
|
218
|
+
let current;
|
|
219
|
+
for (const rawLine of stdout.split(/\r?\n/u)) {
|
|
220
|
+
const line = rawLine.trim();
|
|
221
|
+
if (line.length === 0) continue;
|
|
222
|
+
const header = /^frame:(\d+)\s+pts:\S+\s+pts_time:(\S+)$/u.exec(line);
|
|
223
|
+
if (header) {
|
|
224
|
+
completeRecord(records, current);
|
|
225
|
+
current = {
|
|
226
|
+
channel: "color",
|
|
227
|
+
frameIndex: Number(header[1]),
|
|
228
|
+
timeSeconds: finiteNumber(header[2], `frame ${header[1]} timestamp`),
|
|
229
|
+
values: new Map(),
|
|
230
|
+
};
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
if (!current) fail("signalstats metadata appeared before a frame record");
|
|
234
|
+
const separator = line.indexOf("=");
|
|
235
|
+
if (separator < 1) continue;
|
|
236
|
+
const key = line.slice(0, separator);
|
|
237
|
+
const value = line.slice(separator + 1);
|
|
238
|
+
if (key === "toolcraft.channel") {
|
|
239
|
+
current.channel = value;
|
|
240
|
+
} else if (key.startsWith("lavfi.signalstats.")) {
|
|
241
|
+
if (current.values.has(key)) fail(`duplicate ${key} in frame ${current.frameIndex}`);
|
|
242
|
+
current.values.set(key, value);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
completeRecord(records, current);
|
|
246
|
+
const color = sortedChannelRecords(records, "color");
|
|
247
|
+
if (color.length === 0) fail("at least one color frame record is required");
|
|
248
|
+
const alpha = sortedChannelRecords(records, "alpha");
|
|
249
|
+
if (requireAlpha && alpha.length !== color.length) {
|
|
250
|
+
fail("one alpha record is required for every color frame");
|
|
251
|
+
}
|
|
252
|
+
if (alpha.length > 0 && alpha.length !== color.length) {
|
|
253
|
+
fail("alpha and color frame counts must agree");
|
|
254
|
+
}
|
|
255
|
+
return color.map((record, index) => {
|
|
256
|
+
if (index > 0 && record.timeSeconds <= color[index - 1].timeSeconds) {
|
|
257
|
+
fail("frame timestamps must be strictly increasing");
|
|
258
|
+
}
|
|
259
|
+
const alphaRecord = alpha[index];
|
|
260
|
+
if (alphaRecord && (alphaRecord.frameIndex !== record.frameIndex ||
|
|
261
|
+
alphaRecord.timeSeconds !== record.timeSeconds)) {
|
|
262
|
+
fail("alpha and color frame timestamps must agree");
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
...(alphaRecord ? {
|
|
266
|
+
alphaDifference: parseSignalValue(alphaRecord, "lavfi.signalstats.YDIF"),
|
|
267
|
+
} : {}),
|
|
268
|
+
frameIndex: record.frameIndex,
|
|
269
|
+
timeSeconds: record.timeSeconds,
|
|
270
|
+
uDifference: parseSignalValue(record, "lavfi.signalstats.UDIF"),
|
|
271
|
+
vDifference: parseSignalValue(record, "lavfi.signalstats.VDIF"),
|
|
272
|
+
yDifference: parseSignalValue(record, "lavfi.signalstats.YDIF"),
|
|
273
|
+
};
|
|
274
|
+
});
|
|
275
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
normalizeToolcraftMotionToolVersion,
|
|
6
|
+
parseToolcraftMotionFfprobeJson,
|
|
7
|
+
parseToolcraftMotionSignalstats,
|
|
8
|
+
} from "./toolcraft-motion-reference-ffmpeg-output.mjs";
|
|
9
|
+
import {
|
|
10
|
+
createToolcraftMotionLoopSeamScore,
|
|
11
|
+
toolcraftMotionAnalysisChangeScore,
|
|
12
|
+
} from "./toolcraft-motion-reference-analysis-protocol.mjs";
|
|
13
|
+
|
|
14
|
+
function pixelFormatDescriptor(name, { alpha = true, components = alpha ? 4 : 3 } = {}) {
|
|
15
|
+
return {
|
|
16
|
+
components: Array.from({ length: components }, (_, index) => ({
|
|
17
|
+
bit_depth: 8,
|
|
18
|
+
index: index + 1,
|
|
19
|
+
})),
|
|
20
|
+
flags: { alpha: alpha ? 1 : 0 },
|
|
21
|
+
name,
|
|
22
|
+
nb_components: components,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function probeJson(overrides = {}) {
|
|
27
|
+
return JSON.stringify({
|
|
28
|
+
format: { duration: "0.100000" },
|
|
29
|
+
frames: [
|
|
30
|
+
{ best_effort_timestamp_time: "0.000000" },
|
|
31
|
+
{ best_effort_timestamp_time: "0.033333" },
|
|
32
|
+
{ best_effort_timestamp_time: "0.066667" },
|
|
33
|
+
],
|
|
34
|
+
program_version: { version: "8.0.1-2 tool build" },
|
|
35
|
+
pixel_formats: [pixelFormatDescriptor("yuva444p")],
|
|
36
|
+
streams: [{
|
|
37
|
+
codec_type: "video",
|
|
38
|
+
duration: "0.100000",
|
|
39
|
+
height: 360,
|
|
40
|
+
nb_frames: "3",
|
|
41
|
+
pix_fmt: "yuva444p",
|
|
42
|
+
r_frame_rate: "30/1",
|
|
43
|
+
width: 640,
|
|
44
|
+
}],
|
|
45
|
+
...overrides,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function statsRecord(frame, time, {
|
|
50
|
+
alpha,
|
|
51
|
+
channel = "color",
|
|
52
|
+
u = 0,
|
|
53
|
+
v = 0,
|
|
54
|
+
y = 0,
|
|
55
|
+
} = {}) {
|
|
56
|
+
return [
|
|
57
|
+
`frame:${frame} pts:${frame} pts_time:${time}`,
|
|
58
|
+
`toolcraft.channel=${channel}`,
|
|
59
|
+
`lavfi.signalstats.YDIF=${alpha ?? y}`,
|
|
60
|
+
...(channel === "alpha" ? [] : [
|
|
61
|
+
`lavfi.signalstats.UDIF=${u}`,
|
|
62
|
+
`lavfi.signalstats.VDIF=${v}`,
|
|
63
|
+
]),
|
|
64
|
+
].join("\n");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
test("normalizes visual ffprobe metadata and authoritative decoded timing", () => {
|
|
68
|
+
assert.deepEqual(parseToolcraftMotionFfprobeJson(probeJson()), {
|
|
69
|
+
decodedFrameCount: 3,
|
|
70
|
+
durationSeconds: 0.1,
|
|
71
|
+
ffprobeVersion: "ffprobe 8.0.1-2",
|
|
72
|
+
frameTimes: [0, 0.033333, 0.066667],
|
|
73
|
+
hasAlpha: true,
|
|
74
|
+
height: 360,
|
|
75
|
+
nominalFrameRate: 30,
|
|
76
|
+
pixelFormat: "yuva444p",
|
|
77
|
+
width: 640,
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test("normalizes positive and negative decoded timestamp origins to source time zero", () => {
|
|
82
|
+
for (const origin of [10, -1]) {
|
|
83
|
+
const document = JSON.parse(probeJson());
|
|
84
|
+
document.frames = [origin, origin + 0.033333, origin + 0.066667]
|
|
85
|
+
.map((time) => ({ best_effort_timestamp_time: String(time) }));
|
|
86
|
+
const result = parseToolcraftMotionFfprobeJson(JSON.stringify(document));
|
|
87
|
+
assert.equal(result.frameTimes[0], 0);
|
|
88
|
+
assert.ok(Math.abs(result.frameTimes[1] - 0.033333) < 1e-9);
|
|
89
|
+
assert.ok(Math.abs(result.frameTimes[2] - 0.066667) < 1e-9);
|
|
90
|
+
assert.equal(result.durationSeconds, 0.1);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("normalizes shifted container duration to the decoded zero-origin timeline", () => {
|
|
95
|
+
const document = JSON.parse(probeJson());
|
|
96
|
+
document.format = { duration: "12.000000", start_time: "10.000000" };
|
|
97
|
+
document.frames = Array.from({ length: 60 }, (_, index) => ({
|
|
98
|
+
best_effort_timestamp_time: (10 + index / 30).toFixed(6),
|
|
99
|
+
}));
|
|
100
|
+
document.streams[0] = {
|
|
101
|
+
...document.streams[0],
|
|
102
|
+
duration: "11.966667",
|
|
103
|
+
nb_frames: "60",
|
|
104
|
+
start_time: "10.000000",
|
|
105
|
+
};
|
|
106
|
+
const result = parseToolcraftMotionFfprobeJson(JSON.stringify(document));
|
|
107
|
+
assert.equal(result.frameTimes[0], 0);
|
|
108
|
+
assert.ok(Math.abs(result.frameTimes.at(-1) - 59 / 30) < 1e-6);
|
|
109
|
+
assert.ok(Math.abs(result.durationSeconds - 2) < 1e-6);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("preserves declared trailing duration after the last decoded frame", () => {
|
|
113
|
+
const document = JSON.parse(probeJson());
|
|
114
|
+
document.format = { duration: "0.125000", start_time: "0.000000" };
|
|
115
|
+
document.streams[0].start_time = "0.000000";
|
|
116
|
+
assert.equal(parseToolcraftMotionFfprobeJson(JSON.stringify(document)).durationSeconds,
|
|
117
|
+
0.125);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("rejects malformed probe JSON and missing or invalid visual metadata", () => {
|
|
121
|
+
assert.throws(() => parseToolcraftMotionFfprobeJson("{"), /valid ffprobe JSON/iu);
|
|
122
|
+
assert.throws(() => parseToolcraftMotionFfprobeJson(JSON.stringify({
|
|
123
|
+
frames: [], streams: [{ codec_type: "audio" }],
|
|
124
|
+
})), /visual stream/iu);
|
|
125
|
+
assert.throws(() => parseToolcraftMotionFfprobeJson(probeJson({
|
|
126
|
+
streams: [{ codec_type: "video", height: 0, pix_fmt: "rgb24", width: 640 }],
|
|
127
|
+
})), /dimensions|height/iu);
|
|
128
|
+
assert.throws(() => parseToolcraftMotionFfprobeJson(probeJson({
|
|
129
|
+
frames: [],
|
|
130
|
+
})), /decoded frame/iu);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test("returns stable domain errors for adversarial nested ffprobe collections", () => {
|
|
134
|
+
const documents = [];
|
|
135
|
+
const invalidStreams = JSON.parse(probeJson());
|
|
136
|
+
invalidStreams.streams = [null, 7, []];
|
|
137
|
+
documents.push(invalidStreams);
|
|
138
|
+
const invalidFrames = JSON.parse(probeJson());
|
|
139
|
+
invalidFrames.frames = [null];
|
|
140
|
+
documents.push(invalidFrames);
|
|
141
|
+
const invalidDescriptors = JSON.parse(probeJson());
|
|
142
|
+
invalidDescriptors.pixel_formats = [null, 7, []];
|
|
143
|
+
documents.push(invalidDescriptors);
|
|
144
|
+
const invalidComponents = JSON.parse(probeJson());
|
|
145
|
+
invalidComponents.pixel_formats[0].components = [null, 7, []];
|
|
146
|
+
invalidComponents.pixel_formats[0].nb_components = 3;
|
|
147
|
+
documents.push(invalidComponents);
|
|
148
|
+
|
|
149
|
+
for (const document of documents) {
|
|
150
|
+
assert.throws(() => parseToolcraftMotionFfprobeJson(JSON.stringify(document)),
|
|
151
|
+
(error) => error instanceof TypeError &&
|
|
152
|
+
error.message.startsWith("Invalid Toolcraft motion FFmpeg output:"));
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test("falls back from an unavailable average rate to the decoded stream rate", () => {
|
|
157
|
+
const document = JSON.parse(probeJson());
|
|
158
|
+
document.streams[0].avg_frame_rate = "0/0";
|
|
159
|
+
document.streams[0].r_frame_rate = "30000/1001";
|
|
160
|
+
|
|
161
|
+
assert.equal(parseToolcraftMotionFfprobeJson(JSON.stringify(document)).nominalFrameRate,
|
|
162
|
+
30000 / 1001);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("derives alpha from the exact ffprobe descriptor rather than its name", () => {
|
|
166
|
+
for (const pixelFormat of ["ayuv64le", "vuya"]) {
|
|
167
|
+
const document = JSON.parse(probeJson());
|
|
168
|
+
document.streams[0].pix_fmt = pixelFormat;
|
|
169
|
+
document.pixel_formats = [pixelFormatDescriptor(pixelFormat)];
|
|
170
|
+
assert.equal(parseToolcraftMotionFfprobeJson(JSON.stringify(document)).hasAlpha, true);
|
|
171
|
+
}
|
|
172
|
+
const nonalpha = JSON.parse(probeJson());
|
|
173
|
+
nonalpha.streams[0].pix_fmt = "yuv420p10le";
|
|
174
|
+
nonalpha.pixel_formats = [pixelFormatDescriptor("yuv420p10le", { alpha: false })];
|
|
175
|
+
assert.equal(parseToolcraftMotionFfprobeJson(JSON.stringify(nonalpha)).hasAlpha, false);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test("rejects missing, duplicate, and structurally mismatched pixel descriptors", () => {
|
|
179
|
+
assert.throws(() => parseToolcraftMotionFfprobeJson(probeJson({
|
|
180
|
+
pixel_formats: [],
|
|
181
|
+
})), /pixel format descriptor/iu);
|
|
182
|
+
assert.throws(() => parseToolcraftMotionFfprobeJson(probeJson({
|
|
183
|
+
pixel_formats: [
|
|
184
|
+
pixelFormatDescriptor("yuva444p"), pixelFormatDescriptor("yuva444p"),
|
|
185
|
+
],
|
|
186
|
+
})), /duplicate.*descriptor/iu);
|
|
187
|
+
assert.throws(() => parseToolcraftMotionFfprobeJson(probeJson({
|
|
188
|
+
pixel_formats: [{
|
|
189
|
+
...pixelFormatDescriptor("yuva444p"), nb_components: 3,
|
|
190
|
+
}],
|
|
191
|
+
})), /component/iu);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test("rejects missing, nonfinite, duplicate, and out-of-order timestamps", () => {
|
|
195
|
+
const invalidFrames = [
|
|
196
|
+
[{ best_effort_timestamp_time: "0" }, {}],
|
|
197
|
+
[{ best_effort_timestamp_time: "0" }, { best_effort_timestamp_time: "NaN" }],
|
|
198
|
+
[{ best_effort_timestamp_time: "0" }, { best_effort_timestamp_time: "0" }],
|
|
199
|
+
[{ best_effort_timestamp_time: "0.1" }, { best_effort_timestamp_time: "0.05" }],
|
|
200
|
+
];
|
|
201
|
+
for (const frames of invalidFrames) {
|
|
202
|
+
assert.throws(() => parseToolcraftMotionFfprobeJson(probeJson({ frames })),
|
|
203
|
+
/timestamp/iu);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
test("parses complete color and conditional alpha signalstats records", () => {
|
|
208
|
+
const stdout = [
|
|
209
|
+
statsRecord(0, "0.000000", { y: 0 }),
|
|
210
|
+
statsRecord(0, "0.000000", { alpha: 0, channel: "alpha" }),
|
|
211
|
+
statsRecord(1, "0.033333", { u: 51, v: 12, y: 0 }),
|
|
212
|
+
statsRecord(1, "0.033333", { alpha: 102, channel: "alpha" }),
|
|
213
|
+
].join("\n");
|
|
214
|
+
const records = parseToolcraftMotionSignalstats(stdout, { requireAlpha: true });
|
|
215
|
+
|
|
216
|
+
assert.deepEqual(records, [{
|
|
217
|
+
alphaDifference: 0,
|
|
218
|
+
frameIndex: 0,
|
|
219
|
+
timeSeconds: 0,
|
|
220
|
+
uDifference: 0,
|
|
221
|
+
vDifference: 0,
|
|
222
|
+
yDifference: 0,
|
|
223
|
+
}, {
|
|
224
|
+
alphaDifference: 102,
|
|
225
|
+
frameIndex: 1,
|
|
226
|
+
timeSeconds: 0.033333,
|
|
227
|
+
uDifference: 51,
|
|
228
|
+
vDifference: 12,
|
|
229
|
+
yDifference: 0,
|
|
230
|
+
}]);
|
|
231
|
+
assert.equal(toolcraftMotionAnalysisChangeScore(records[1]), 102 / 255);
|
|
232
|
+
assert.equal(toolcraftMotionAnalysisChangeScore(records[0]), 0);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
test("requires one complete color record and exactly one conditional alpha record", () => {
|
|
236
|
+
assert.throws(() => parseToolcraftMotionSignalstats(
|
|
237
|
+
statsRecord(0, "0", { channel: "color", u: 2, y: 1 }).replace(
|
|
238
|
+
"lavfi.signalstats.VDIF=0", "",
|
|
239
|
+
),
|
|
240
|
+
), /VDIF/iu);
|
|
241
|
+
assert.throws(() => parseToolcraftMotionSignalstats(
|
|
242
|
+
statsRecord(0, "0", { channel: "color", y: 1 }), { requireAlpha: true },
|
|
243
|
+
), /alpha/iu);
|
|
244
|
+
assert.throws(() => parseToolcraftMotionSignalstats([
|
|
245
|
+
statsRecord(0, "0", { y: 1 }),
|
|
246
|
+
statsRecord(0, "0", { y: 2 }),
|
|
247
|
+
].join("\n")), /duplicate/iu);
|
|
248
|
+
assert.throws(() => parseToolcraftMotionSignalstats([
|
|
249
|
+
statsRecord(0, "0", { y: 1 }),
|
|
250
|
+
statsRecord(2, "0.2", { y: 2 }),
|
|
251
|
+
].join("\n")), /missing frame/iu);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
test("rejects nonfinite, localized, and out-of-order signalstats values", () => {
|
|
255
|
+
assert.throws(() => parseToolcraftMotionSignalstats(
|
|
256
|
+
statsRecord(0, "0", { y: "Infinity" }),
|
|
257
|
+
), /finite/iu);
|
|
258
|
+
assert.throws(() => parseToolcraftMotionSignalstats(
|
|
259
|
+
statsRecord(0, "0,25", { y: "1,25" }),
|
|
260
|
+
), /finite/iu);
|
|
261
|
+
assert.throws(() => parseToolcraftMotionSignalstats([
|
|
262
|
+
statsRecord(0, "0.1", { y: 1 }),
|
|
263
|
+
statsRecord(1, "0.05", { y: 2 }),
|
|
264
|
+
].join("\n")), /increasing/iu);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
test("normalizes tool versions without volatile build or locale text", () => {
|
|
268
|
+
assert.equal(normalizeToolcraftMotionToolVersion(
|
|
269
|
+
"ffmpeg version 8.0.1-2 Copyright (c) 2000-2026 the FFmpeg developers\nconfiguration: --enable-x",
|
|
270
|
+
"ffmpeg",
|
|
271
|
+
), "ffmpeg 8.0.1-2");
|
|
272
|
+
assert.equal(normalizeToolcraftMotionToolVersion(
|
|
273
|
+
"ffprobe version n8.0-static built with Apple clang\nBibliotheken-Versionen:",
|
|
274
|
+
"ffprobe",
|
|
275
|
+
), "ffprobe n8.0-static");
|
|
276
|
+
assert.throws(() => normalizeToolcraftMotionToolVersion("unrelated", "ffmpeg"),
|
|
277
|
+
/ffmpeg version/iu);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
test("requires an exact two-record last-to-first seam", () => {
|
|
281
|
+
const records = parseToolcraftMotionSignalstats([
|
|
282
|
+
statsRecord(0, "0", { y: 0 }),
|
|
283
|
+
statsRecord(1, "1", { u: 51 }),
|
|
284
|
+
].join("\n"));
|
|
285
|
+
assert.equal(createToolcraftMotionLoopSeamScore(2, records), 51 / 255);
|
|
286
|
+
assert.throws(() => createToolcraftMotionLoopSeamScore(2, records.slice(0, 1)),
|
|
287
|
+
/exactly two/iu);
|
|
288
|
+
assert.throws(() => createToolcraftMotionLoopSeamScore(2, [...records, {
|
|
289
|
+
...records[1], frameIndex: 2, timeSeconds: 2,
|
|
290
|
+
}]), /exactly two/iu);
|
|
291
|
+
assert.throws(() => createToolcraftMotionLoopSeamScore(2, [
|
|
292
|
+
records[1], records[0],
|
|
293
|
+
]), /indices|increasing/iu);
|
|
294
|
+
});
|