universal-physics-tensor 0.5.0 → 0.7.0
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 +66 -105
- package/dist/bridges/catalog-adapter.d.ts +116 -0
- package/dist/bridges/catalog-adapter.d.ts.map +1 -0
- package/dist/bridges/catalog-adapter.js +302 -0
- package/dist/bridges/catalog-adapter.js.map +1 -0
- package/dist/bridges/equations/_be-helpers.d.ts +145 -0
- package/dist/bridges/equations/_be-helpers.d.ts.map +1 -0
- package/dist/bridges/equations/_be-helpers.js +179 -0
- package/dist/bridges/equations/_be-helpers.js.map +1 -0
- package/dist/bridges/equations/be-11-decoherence-master.d.ts +1 -2
- package/dist/bridges/equations/be-11-decoherence-master.d.ts.map +1 -1
- package/dist/bridges/equations/be-11-decoherence-master.js +9 -20
- package/dist/bridges/equations/be-11-decoherence-master.js.map +1 -1
- package/dist/bridges/equations/be-12-coherence-length.d.ts +7 -1
- package/dist/bridges/equations/be-12-coherence-length.d.ts.map +1 -1
- package/dist/bridges/equations/be-12-coherence-length.js +8 -16
- package/dist/bridges/equations/be-12-coherence-length.js.map +1 -1
- package/dist/bridges/equations/be-13-einstein-trace.d.ts +51 -3
- package/dist/bridges/equations/be-13-einstein-trace.d.ts.map +1 -1
- package/dist/bridges/equations/be-13-einstein-trace.js +74 -17
- package/dist/bridges/equations/be-13-einstein-trace.js.map +1 -1
- package/dist/bridges/equations/be-14-ryu-takayanagi.d.ts +10 -4
- package/dist/bridges/equations/be-14-ryu-takayanagi.d.ts.map +1 -1
- package/dist/bridges/equations/be-14-ryu-takayanagi.js +6 -17
- package/dist/bridges/equations/be-14-ryu-takayanagi.js.map +1 -1
- package/dist/bridges/equations/be-15-emergence.d.ts +7 -1
- package/dist/bridges/equations/be-15-emergence.d.ts.map +1 -1
- package/dist/bridges/equations/be-15-emergence.js +12 -22
- package/dist/bridges/equations/be-15-emergence.js.map +1 -1
- package/dist/bridges/equations/be-16-landauer.d.ts +7 -1
- package/dist/bridges/equations/be-16-landauer.d.ts.map +1 -1
- package/dist/bridges/equations/be-16-landauer.js +5 -13
- package/dist/bridges/equations/be-16-landauer.js.map +1 -1
- package/dist/bridges/equations/be-17-einstein-cartan.d.ts +26 -13
- package/dist/bridges/equations/be-17-einstein-cartan.d.ts.map +1 -1
- package/dist/bridges/equations/be-17-einstein-cartan.js +28 -31
- package/dist/bridges/equations/be-17-einstein-cartan.js.map +1 -1
- package/dist/bridges/equations/be-18-higgs-mass.d.ts +7 -1
- package/dist/bridges/equations/be-18-higgs-mass.d.ts.map +1 -1
- package/dist/bridges/equations/be-18-higgs-mass.js +5 -16
- package/dist/bridges/equations/be-18-higgs-mass.js.map +1 -1
- package/dist/bridges/equations/be-19-quantum-bounce.d.ts +38 -3
- package/dist/bridges/equations/be-19-quantum-bounce.d.ts.map +1 -1
- package/dist/bridges/equations/be-19-quantum-bounce.js +69 -20
- package/dist/bridges/equations/be-19-quantum-bounce.js.map +1 -1
- package/dist/bridges/equations/be-20-vacuum-energy.d.ts +20 -1
- package/dist/bridges/equations/be-20-vacuum-energy.d.ts.map +1 -1
- package/dist/bridges/equations/be-20-vacuum-energy.js +36 -15
- package/dist/bridges/equations/be-20-vacuum-energy.js.map +1 -1
- package/dist/bridges/equations/be-21-kss-bound.d.ts +2 -0
- package/dist/bridges/equations/be-21-kss-bound.d.ts.map +1 -1
- package/dist/bridges/equations/be-21-kss-bound.js +4 -10
- package/dist/bridges/equations/be-21-kss-bound.js.map +1 -1
- package/dist/bridges/equations/be-22-topological-entanglement.d.ts +6 -9
- package/dist/bridges/equations/be-22-topological-entanglement.d.ts.map +1 -1
- package/dist/bridges/equations/be-22-topological-entanglement.js +9 -21
- package/dist/bridges/equations/be-22-topological-entanglement.js.map +1 -1
- package/dist/bridges/equations/be-23-syk-planckian.d.ts +7 -1
- package/dist/bridges/equations/be-23-syk-planckian.d.ts.map +1 -1
- package/dist/bridges/equations/be-23-syk-planckian.js +11 -25
- package/dist/bridges/equations/be-23-syk-planckian.js.map +1 -1
- package/dist/bridges/equations/be-24-foerster-fret.d.ts +7 -1
- package/dist/bridges/equations/be-24-foerster-fret.d.ts.map +1 -1
- package/dist/bridges/equations/be-24-foerster-fret.js +8 -16
- package/dist/bridges/equations/be-24-foerster-fret.js.map +1 -1
- package/dist/bridges/equations/be-25-iit-phi.d.ts +7 -1
- package/dist/bridges/equations/be-25-iit-phi.d.ts.map +1 -1
- package/dist/bridges/equations/be-25-iit-phi.js +12 -16
- package/dist/bridges/equations/be-25-iit-phi.js.map +1 -1
- package/dist/bridges/equations/be-25-orch-or.d.ts +6 -3
- package/dist/bridges/equations/be-25-orch-or.d.ts.map +1 -1
- package/dist/bridges/equations/be-25-orch-or.js +8 -17
- package/dist/bridges/equations/be-25-orch-or.js.map +1 -1
- package/dist/bridges/equations/be-26-dna-tunneling.d.ts +6 -3
- package/dist/bridges/equations/be-26-dna-tunneling.d.ts.map +1 -1
- package/dist/bridges/equations/be-26-dna-tunneling.js +11 -26
- package/dist/bridges/equations/be-26-dna-tunneling.js.map +1 -1
- package/dist/bridges/equations/be-27-effective-temperature.d.ts +7 -1
- package/dist/bridges/equations/be-27-effective-temperature.d.ts.map +1 -1
- package/dist/bridges/equations/be-27-effective-temperature.js +8 -16
- package/dist/bridges/equations/be-27-effective-temperature.js.map +1 -1
- package/dist/bridges/equations/be-28-onsager-entropy-production.d.ts +7 -1
- package/dist/bridges/equations/be-28-onsager-entropy-production.d.ts.map +1 -1
- package/dist/bridges/equations/be-28-onsager-entropy-production.js +9 -13
- package/dist/bridges/equations/be-28-onsager-entropy-production.js.map +1 -1
- package/dist/bridges/equations/be-29-jarzynski.d.ts +7 -1
- package/dist/bridges/equations/be-29-jarzynski.d.ts.map +1 -1
- package/dist/bridges/equations/be-29-jarzynski.js +8 -13
- package/dist/bridges/equations/be-29-jarzynski.js.map +1 -1
- package/dist/bridges/equations/be-30-flm-first-law.d.ts +11 -2
- package/dist/bridges/equations/be-30-flm-first-law.d.ts.map +1 -1
- package/dist/bridges/equations/be-30-flm-first-law.js +10 -21
- package/dist/bridges/equations/be-30-flm-first-law.js.map +1 -1
- package/dist/bridges/equations/be-31-causal-set-bd.d.ts +7 -1
- package/dist/bridges/equations/be-31-causal-set-bd.d.ts.map +1 -1
- package/dist/bridges/equations/be-31-causal-set-bd.js +11 -25
- package/dist/bridges/equations/be-31-causal-set-bd.js.map +1 -1
- package/dist/bridges/equations/be-32-quantum-reference-frame.d.ts +6 -9
- package/dist/bridges/equations/be-32-quantum-reference-frame.d.ts.map +1 -1
- package/dist/bridges/equations/be-32-quantum-reference-frame.js +8 -18
- package/dist/bridges/equations/be-32-quantum-reference-frame.js.map +1 -1
- package/dist/bridges/equations/be-33-hertz-millis.d.ts +53 -28
- package/dist/bridges/equations/be-33-hertz-millis.d.ts.map +1 -1
- package/dist/bridges/equations/be-33-hertz-millis.js +55 -51
- package/dist/bridges/equations/be-33-hertz-millis.js.map +1 -1
- package/dist/bridges/equations/be-34-kibble-zurek.d.ts +6 -3
- package/dist/bridges/equations/be-34-kibble-zurek.d.ts.map +1 -1
- package/dist/bridges/equations/be-34-kibble-zurek.js +15 -26
- package/dist/bridges/equations/be-34-kibble-zurek.js.map +1 -1
- package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts +6 -9
- package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts.map +1 -1
- package/dist/bridges/equations/be-35-conformal-bootstrap.js +9 -21
- package/dist/bridges/equations/be-35-conformal-bootstrap.js.map +1 -1
- package/dist/bridges/equations/be-36-gw-speed-bound.d.ts +7 -1
- package/dist/bridges/equations/be-36-gw-speed-bound.d.ts.map +1 -1
- package/dist/bridges/equations/be-36-gw-speed-bound.js +5 -13
- package/dist/bridges/equations/be-36-gw-speed-bound.js.map +1 -1
- package/dist/bridges/equations/be-37-shapiro-delay.d.ts +4 -2
- package/dist/bridges/equations/be-37-shapiro-delay.d.ts.map +1 -1
- package/dist/bridges/equations/be-37-shapiro-delay.js +22 -37
- package/dist/bridges/equations/be-37-shapiro-delay.js.map +1 -1
- package/dist/bridges/equations/be-38-mond.d.ts +7 -1
- package/dist/bridges/equations/be-38-mond.d.ts.map +1 -1
- package/dist/bridges/equations/be-38-mond.js +9 -19
- package/dist/bridges/equations/be-38-mond.js.map +1 -1
- package/dist/bridges/equations/be-39-asymptotic-safety.d.ts +66 -2
- package/dist/bridges/equations/be-39-asymptotic-safety.d.ts.map +1 -1
- package/dist/bridges/equations/be-39-asymptotic-safety.js +128 -20
- package/dist/bridges/equations/be-39-asymptotic-safety.js.map +1 -1
- package/dist/bridges/equations/be-40-composite-higgs.d.ts +7 -1
- package/dist/bridges/equations/be-40-composite-higgs.d.ts.map +1 -1
- package/dist/bridges/equations/be-40-composite-higgs.js +10 -22
- package/dist/bridges/equations/be-40-composite-higgs.js.map +1 -1
- package/dist/bridges/equations/be-41-swampland.d.ts +6 -3
- package/dist/bridges/equations/be-41-swampland.d.ts.map +1 -1
- package/dist/bridges/equations/be-41-swampland.js +11 -23
- package/dist/bridges/equations/be-41-swampland.js.map +1 -1
- package/dist/bridges/equations/be-42-hawking-temperature.d.ts +2 -0
- package/dist/bridges/equations/be-42-hawking-temperature.d.ts.map +1 -1
- package/dist/bridges/equations/be-42-hawking-temperature.js +5 -13
- package/dist/bridges/equations/be-42-hawking-temperature.js.map +1 -1
- package/dist/bridges/equations/be-43-er-epr.d.ts +7 -1
- package/dist/bridges/equations/be-43-er-epr.d.ts.map +1 -1
- package/dist/bridges/equations/be-43-er-epr.js +5 -13
- package/dist/bridges/equations/be-43-er-epr.js.map +1 -1
- package/dist/bridges/equations/be-44-soft-hair.d.ts +7 -1
- package/dist/bridges/equations/be-44-soft-hair.d.ts.map +1 -1
- package/dist/bridges/equations/be-44-soft-hair.js +5 -13
- package/dist/bridges/equations/be-44-soft-hair.js.map +1 -1
- package/dist/bridges/equations/be-45-tcc.d.ts +7 -1
- package/dist/bridges/equations/be-45-tcc.d.ts.map +1 -1
- package/dist/bridges/equations/be-45-tcc.js +10 -22
- package/dist/bridges/equations/be-45-tcc.js.map +1 -1
- package/dist/bridges/equations/be-46-multiverse-measure.d.ts +7 -1
- package/dist/bridges/equations/be-46-multiverse-measure.d.ts.map +1 -1
- package/dist/bridges/equations/be-46-multiverse-measure.js +9 -19
- package/dist/bridges/equations/be-46-multiverse-measure.js.map +1 -1
- package/dist/bridges/equations/be-47-bbn-dark-sector.d.ts +7 -1
- package/dist/bridges/equations/be-47-bbn-dark-sector.d.ts.map +1 -1
- package/dist/bridges/equations/be-47-bbn-dark-sector.js +14 -16
- package/dist/bridges/equations/be-47-bbn-dark-sector.js.map +1 -1
- package/dist/bridges/equations/be-48-grw-localization.d.ts +7 -1
- package/dist/bridges/equations/be-48-grw-localization.d.ts.map +1 -1
- package/dist/bridges/equations/be-48-grw-localization.js +15 -20
- package/dist/bridges/equations/be-48-grw-localization.js.map +1 -1
- package/dist/bridges/equations/be-49-quantum-darwinism.d.ts +7 -1
- package/dist/bridges/equations/be-49-quantum-darwinism.d.ts.map +1 -1
- package/dist/bridges/equations/be-49-quantum-darwinism.js +10 -22
- package/dist/bridges/equations/be-49-quantum-darwinism.js.map +1 -1
- package/dist/bridges/equations/be-50-wheeler-feynman.d.ts +42 -12
- package/dist/bridges/equations/be-50-wheeler-feynman.d.ts.map +1 -1
- package/dist/bridges/equations/be-50-wheeler-feynman.js +84 -20
- package/dist/bridges/equations/be-50-wheeler-feynman.js.map +1 -1
- package/dist/bridges/equations/be-53-yang-mills-beta.d.ts +158 -0
- package/dist/bridges/equations/be-53-yang-mills-beta.d.ts.map +1 -0
- package/dist/bridges/equations/be-53-yang-mills-beta.js +175 -0
- package/dist/bridges/equations/be-53-yang-mills-beta.js.map +1 -0
- package/dist/bridges/equations/be-54-randall-sundrum-brane.d.ts +117 -0
- package/dist/bridges/equations/be-54-randall-sundrum-brane.d.ts.map +1 -0
- package/dist/bridges/equations/be-54-randall-sundrum-brane.js +213 -0
- package/dist/bridges/equations/be-54-randall-sundrum-brane.js.map +1 -0
- package/dist/bridges/gravitational-lensing.d.ts +13 -2
- package/dist/bridges/gravitational-lensing.d.ts.map +1 -1
- package/dist/bridges/gravitational-lensing.js +17 -6
- package/dist/bridges/gravitational-lensing.js.map +1 -1
- package/dist/bridges/index.d.ts +40 -1
- package/dist/bridges/index.d.ts.map +1 -1
- package/dist/bridges/index.js +130 -48
- package/dist/bridges/index.js.map +1 -1
- package/dist/bridges/perihelion-precession-labeled.d.ts +46 -0
- package/dist/bridges/perihelion-precession-labeled.d.ts.map +1 -0
- package/dist/bridges/perihelion-precession-labeled.js +54 -0
- package/dist/bridges/perihelion-precession-labeled.js.map +1 -0
- package/dist/bridges/perihelion-precession.d.ts +18 -3
- package/dist/bridges/perihelion-precession.d.ts.map +1 -1
- package/dist/bridges/perihelion-precession.js +22 -8
- package/dist/bridges/perihelion-precession.js.map +1 -1
- package/dist/core/axes-registry.d.ts +67 -0
- package/dist/core/axes-registry.d.ts.map +1 -0
- package/dist/core/axes-registry.js +75 -0
- package/dist/core/axes-registry.js.map +1 -0
- package/dist/core/cell.d.ts +176 -0
- package/dist/core/cell.d.ts.map +1 -0
- package/dist/core/cell.js +166 -0
- package/dist/core/cell.js.map +1 -0
- package/dist/core/constants.d.ts +50 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +50 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/flux-rules.d.ts +176 -0
- package/dist/core/flux-rules.d.ts.map +1 -0
- package/dist/core/flux-rules.js +329 -0
- package/dist/core/flux-rules.js.map +1 -0
- package/dist/core/labeled-tensor.d.ts +143 -0
- package/dist/core/labeled-tensor.d.ts.map +1 -0
- package/dist/core/labeled-tensor.js +275 -0
- package/dist/core/labeled-tensor.js.map +1 -0
- package/dist/core/regime-registry.d.ts +169 -0
- package/dist/core/regime-registry.d.ts.map +1 -0
- package/dist/core/regime-registry.js +174 -0
- package/dist/core/regime-registry.js.map +1 -0
- package/dist/core/regime-rule-install.d.ts +26 -0
- package/dist/core/regime-rule-install.d.ts.map +1 -0
- package/dist/core/regime-rule-install.js +90 -0
- package/dist/core/regime-rule-install.js.map +1 -0
- package/dist/core/regimes-builtins.d.ts +22 -0
- package/dist/core/regimes-builtins.d.ts.map +1 -0
- package/dist/core/regimes-builtins.js +96 -0
- package/dist/core/regimes-builtins.js.map +1 -0
- package/dist/core/tensor.d.ts +112 -0
- package/dist/core/tensor.d.ts.map +1 -1
- package/dist/core/tensor.js +366 -0
- package/dist/core/tensor.js.map +1 -1
- package/dist/core/types.d.ts +7 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/universal-index.d.ts +97 -0
- package/dist/core/universal-index.d.ts.map +1 -0
- package/dist/core/universal-index.js +70 -0
- package/dist/core/universal-index.js.map +1 -0
- package/dist/diff/bridge-gradient.d.ts +94 -0
- package/dist/diff/bridge-gradient.d.ts.map +1 -0
- package/dist/diff/bridge-gradient.js +83 -0
- package/dist/diff/bridge-gradient.js.map +1 -0
- package/dist/diff/bridge-specs.d.ts +68 -0
- package/dist/diff/bridge-specs.d.ts.map +1 -0
- package/dist/diff/bridge-specs.js +96 -0
- package/dist/diff/bridge-specs.js.map +1 -0
- package/dist/dimensional/bridge-check.d.ts.map +1 -1
- package/dist/dimensional/bridge-check.js +8 -0
- package/dist/dimensional/bridge-check.js.map +1 -1
- package/dist/dimensional/connection-validators.d.ts +13 -6
- package/dist/dimensional/connection-validators.d.ts.map +1 -1
- package/dist/dimensional/connection-validators.js +1 -1
- package/dist/dimensional/connection-validators.js.map +1 -1
- package/dist/dimensional/curvature-composite.d.ts +90 -0
- package/dist/dimensional/curvature-composite.d.ts.map +1 -0
- package/dist/dimensional/curvature-composite.js +57 -0
- package/dist/dimensional/curvature-composite.js.map +1 -0
- package/dist/dimensional/curvature-invariants.d.ts +90 -0
- package/dist/dimensional/curvature-invariants.d.ts.map +1 -0
- package/dist/dimensional/curvature-invariants.js +64 -0
- package/dist/dimensional/curvature-invariants.js.map +1 -0
- package/dist/dimensional/curvature.d.ts +82 -41
- package/dist/dimensional/curvature.d.ts.map +1 -1
- package/dist/dimensional/curvature.js +19 -11
- package/dist/dimensional/curvature.js.map +1 -1
- package/dist/dimensional/einstein-equation.d.ts +126 -0
- package/dist/dimensional/einstein-equation.d.ts.map +1 -0
- package/dist/dimensional/einstein-equation.js +122 -0
- package/dist/dimensional/einstein-equation.js.map +1 -0
- package/dist/dimensional/field-equation-helpers.d.ts +82 -0
- package/dist/dimensional/field-equation-helpers.d.ts.map +1 -0
- package/dist/dimensional/field-equation-helpers.js +123 -0
- package/dist/dimensional/field-equation-helpers.js.map +1 -0
- package/dist/dimensional/friedmann-equation.d.ts +148 -0
- package/dist/dimensional/friedmann-equation.d.ts.map +1 -0
- package/dist/dimensional/friedmann-equation.js +150 -0
- package/dist/dimensional/friedmann-equation.js.map +1 -0
- package/dist/dimensional/gauge-field.d.ts +182 -0
- package/dist/dimensional/gauge-field.d.ts.map +1 -0
- package/dist/dimensional/gauge-field.js +134 -0
- package/dist/dimensional/gauge-field.js.map +1 -0
- package/dist/dimensional/killing-validators.d.ts +94 -0
- package/dist/dimensional/killing-validators.d.ts.map +1 -0
- package/dist/dimensional/killing-validators.js +66 -0
- package/dist/dimensional/killing-validators.js.map +1 -0
- package/dist/dimensional/klein-gordon-equation.d.ts +113 -0
- package/dist/dimensional/klein-gordon-equation.d.ts.map +1 -0
- package/dist/dimensional/klein-gordon-equation.js +98 -0
- package/dist/dimensional/klein-gordon-equation.js.map +1 -0
- package/dist/dimensional/rg-flow.d.ts +156 -0
- package/dist/dimensional/rg-flow.d.ts.map +1 -0
- package/dist/dimensional/rg-flow.js +150 -0
- package/dist/dimensional/rg-flow.js.map +1 -0
- package/dist/dimensional/stress-energy-validators.d.ts +74 -0
- package/dist/dimensional/stress-energy-validators.d.ts.map +1 -0
- package/dist/dimensional/stress-energy-validators.js +47 -0
- package/dist/dimensional/stress-energy-validators.js.map +1 -0
- package/dist/dimensional/tensor-trace.d.ts +128 -0
- package/dist/dimensional/tensor-trace.d.ts.map +1 -0
- package/dist/dimensional/tensor-trace.js +95 -0
- package/dist/dimensional/tensor-trace.js.map +1 -0
- package/dist/dimensional/tensor.d.ts +6 -8
- package/dist/dimensional/tensor.d.ts.map +1 -1
- package/dist/dimensional/tensor.js +3 -1
- package/dist/dimensional/tensor.js.map +1 -1
- package/dist/dimensional/validator-registry.d.ts +90 -0
- package/dist/dimensional/validator-registry.d.ts.map +1 -0
- package/dist/dimensional/validator-registry.js +131 -0
- package/dist/dimensional/validator-registry.js.map +1 -0
- package/dist/dimensional/validator.d.ts +12 -2
- package/dist/dimensional/validator.d.ts.map +1 -1
- package/dist/dimensional/validator.js +60 -75
- package/dist/dimensional/validator.js.map +1 -1
- package/dist/dimensional/weyl-validators.d.ts +84 -0
- package/dist/dimensional/weyl-validators.d.ts.map +1 -0
- package/dist/dimensional/weyl-validators.js +84 -0
- package/dist/dimensional/weyl-validators.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -1
- package/dist/numerical/be37-covariant-eikonal.d.ts +37 -2
- package/dist/numerical/be37-covariant-eikonal.d.ts.map +1 -1
- package/dist/numerical/be37-covariant-eikonal.js +51 -14
- package/dist/numerical/be37-covariant-eikonal.js.map +1 -1
- package/dist/numerical/christoffel-flat.d.ts +49 -0
- package/dist/numerical/christoffel-flat.d.ts.map +1 -0
- package/dist/numerical/christoffel-flat.js +86 -0
- package/dist/numerical/christoffel-flat.js.map +1 -0
- package/dist/numerical/curvature-lowering-helpers.d.ts +76 -57
- package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.js +203 -64
- package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
- package/dist/numerical/derivative-lowering.d.ts +67 -0
- package/dist/numerical/derivative-lowering.d.ts.map +1 -0
- package/dist/numerical/derivative-lowering.js +243 -0
- package/dist/numerical/derivative-lowering.js.map +1 -0
- package/dist/numerical/einstein-equation.d.ts +106 -0
- package/dist/numerical/einstein-equation.d.ts.map +1 -0
- package/dist/numerical/einstein-equation.js +172 -0
- package/dist/numerical/einstein-equation.js.map +1 -0
- package/dist/numerical/engine-registry.js +4 -4
- package/dist/numerical/engine-registry.js.map +1 -1
- package/dist/numerical/geodesic-integrator.d.ts +7 -4
- package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
- package/dist/numerical/geodesic-integrator.js +5 -1
- package/dist/numerical/geodesic-integrator.js.map +1 -1
- package/dist/numerical/gl4-integrator.d.ts +57 -9
- package/dist/numerical/gl4-integrator.d.ts.map +1 -1
- package/dist/numerical/gl4-integrator.js +63 -16
- package/dist/numerical/gl4-integrator.js.map +1 -1
- package/dist/numerical/killing.d.ts +157 -0
- package/dist/numerical/killing.d.ts.map +1 -0
- package/dist/numerical/killing.js +242 -0
- package/dist/numerical/killing.js.map +1 -0
- package/dist/numerical/kretschmann.d.ts +62 -0
- package/dist/numerical/kretschmann.d.ts.map +1 -0
- package/dist/numerical/kretschmann.js +88 -0
- package/dist/numerical/kretschmann.js.map +1 -0
- package/dist/numerical/lowering-utils.d.ts +47 -0
- package/dist/numerical/lowering-utils.d.ts.map +1 -0
- package/dist/numerical/lowering-utils.js +64 -0
- package/dist/numerical/lowering-utils.js.map +1 -0
- package/dist/numerical/lowering.d.ts +1 -29
- package/dist/numerical/lowering.d.ts.map +1 -1
- package/dist/numerical/lowering.js +226 -415
- package/dist/numerical/lowering.js.map +1 -1
- package/dist/numerical/mathts-engine.js +8 -8
- package/dist/numerical/mathts-engine.js.map +1 -1
- package/dist/numerical/metric-inverse.d.ts.map +1 -1
- package/dist/numerical/metric-inverse.js +28 -0
- package/dist/numerical/metric-inverse.js.map +1 -1
- package/dist/numerical/null-ic.d.ts +40 -0
- package/dist/numerical/null-ic.d.ts.map +1 -0
- package/dist/numerical/null-ic.js +50 -0
- package/dist/numerical/null-ic.js.map +1 -0
- package/dist/numerical/null-ray-integrator.d.ts +3 -2
- package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
- package/dist/numerical/null-ray-integrator.js +6 -3
- package/dist/numerical/null-ray-integrator.js.map +1 -1
- package/dist/numerical/painleve-gullstrand-metric.d.ts +74 -0
- package/dist/numerical/painleve-gullstrand-metric.d.ts.map +1 -0
- package/dist/numerical/painleve-gullstrand-metric.js +121 -0
- package/dist/numerical/painleve-gullstrand-metric.js.map +1 -0
- package/dist/numerical/pderiv.d.ts +35 -3
- package/dist/numerical/pderiv.d.ts.map +1 -1
- package/dist/numerical/pderiv.js +47 -12
- package/dist/numerical/pderiv.js.map +1 -1
- package/dist/numerical/perihelion-finder.d.ts +57 -0
- package/dist/numerical/perihelion-finder.d.ts.map +1 -1
- package/dist/numerical/perihelion-finder.js +57 -0
- package/dist/numerical/perihelion-finder.js.map +1 -1
- package/dist/numerical/tensor-engine.d.ts +2 -2
- package/dist/numerical/tensor-engine.d.ts.map +1 -1
- package/dist/numerical/weyl-lowering.d.ts +60 -0
- package/dist/numerical/weyl-lowering.d.ts.map +1 -0
- package/dist/numerical/weyl-lowering.js +111 -0
- package/dist/numerical/weyl-lowering.js.map +1 -0
- package/package.json +9 -7
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `LabeledTensor` — engine-level tensor wrapped with
|
|
3
|
+
* `UniversalIndex`-tagged metadata. The catalog-facing surface
|
|
4
|
+
* for physics-axis-aware contractions.
|
|
5
|
+
*
|
|
6
|
+
* Phase 2 + Phase 3 of v0.7 Proposal 1 (Intelligent Index Layer).
|
|
7
|
+
*
|
|
8
|
+
* Composition (Decision #5): `LabeledTensor` owns an `EngineTensor`,
|
|
9
|
+
* a `TensorEngine`, and a labels record. The engine handle is the
|
|
10
|
+
* boundary — `LabeledTensor` doesn't reach into the underlying
|
|
11
|
+
* Float64Array / MathTS handle. Contract matching is strictly
|
|
12
|
+
* `UniversalIndexId` equality (Decision #3) — two indices with the
|
|
13
|
+
* same `axis` and `name` but distinct `id`s do NOT contract.
|
|
14
|
+
*
|
|
15
|
+
* Design: `docs/planning/v0.7-Proposal-1-Design.md` Decisions
|
|
16
|
+
* #1, #3, #5, #6, #7, #9.
|
|
17
|
+
*
|
|
18
|
+
* Cross-Phase Invariants preserved:
|
|
19
|
+
* - #1 adapter-on-top: this module does NOT import
|
|
20
|
+
* `src/dimensional/tensor.ts` or `src/numerical/lowering.ts`.
|
|
21
|
+
* - #4 `TensorSymbolNode` + `computeContraction` UNCHANGED.
|
|
22
|
+
* - #5 `TensorEngine` interface UNCHANGED (consumes, doesn't
|
|
23
|
+
* extend).
|
|
24
|
+
*
|
|
25
|
+
* @module core/labeled-tensor
|
|
26
|
+
*/
|
|
27
|
+
import { UPTError } from '../dimensional/errors.js';
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// Error classes (Phase 3 surface, declared here for co-location with
|
|
30
|
+
// the guards that throw them)
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
/**
|
|
33
|
+
* Thrown by the `LabeledTensor` constructor when the labels record
|
|
34
|
+
* doesn't agree with the underlying tensor's rank
|
|
35
|
+
* (`Object.keys(labels).length !== tensor.shape.length`).
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export class LabeledTensorConstructionError extends UPTError {
|
|
40
|
+
labelCount;
|
|
41
|
+
tensorRank;
|
|
42
|
+
constructor(labelCount, tensorRank) {
|
|
43
|
+
super(`LabeledTensor: labels record has ${labelCount} entries but ` +
|
|
44
|
+
`tensor rank is ${tensorRank}. Every tensor axis must carry exactly ` +
|
|
45
|
+
`one UniversalIndex label.`);
|
|
46
|
+
this.name = 'LabeledTensorConstructionError';
|
|
47
|
+
this.labelCount = labelCount;
|
|
48
|
+
this.tensorRank = tensorRank;
|
|
49
|
+
Object.setPrototypeOf(this, LabeledTensorConstructionError.prototype);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Thrown by `contract` when two `UniversalIndex` values share an
|
|
54
|
+
* `id` but disagree on `axis`. Per Decision #7, this is a physics
|
|
55
|
+
* error caught at the wrapper level. Impossible if both operands
|
|
56
|
+
* use the `Axes` registry; defensive against off-registry
|
|
57
|
+
* `makeIndex` consumers.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export class AxisMismatchError extends UPTError {
|
|
62
|
+
indexId;
|
|
63
|
+
leftAxis;
|
|
64
|
+
rightAxis;
|
|
65
|
+
constructor(indexId, leftAxis, rightAxis) {
|
|
66
|
+
super(`LabeledTensor.contract: indices with the same id '${indexId}' ` +
|
|
67
|
+
`disagree on axis ('${leftAxis}' vs '${rightAxis}'). Cross-axis ` +
|
|
68
|
+
`contraction is a physics error.`);
|
|
69
|
+
this.name = 'AxisMismatchError';
|
|
70
|
+
this.indexId = indexId;
|
|
71
|
+
this.leftAxis = leftAxis;
|
|
72
|
+
this.rightAxis = rightAxis;
|
|
73
|
+
Object.setPrototypeOf(this, AxisMismatchError.prototype);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Thrown by `contract` when the same `UniversalIndexId` appears in
|
|
78
|
+
* more than one non-contracted (free) position across the two
|
|
79
|
+
* operands. Same physical axis showing up free on both sides is
|
|
80
|
+
* physically meaningful (joint distribution) but the einsum
|
|
81
|
+
* machinery has no canonical way to disambiguate.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
export class IdentityConflictError extends UPTError {
|
|
86
|
+
indexId;
|
|
87
|
+
constructor(indexId) {
|
|
88
|
+
super(`LabeledTensor.contract: UniversalIndexId '${indexId}' appears as a ` +
|
|
89
|
+
`free axis on both operands. Same physical axis on both sides is ` +
|
|
90
|
+
`ambiguous — rename or contract one side first.`);
|
|
91
|
+
this.name = 'IdentityConflictError';
|
|
92
|
+
this.indexId = indexId;
|
|
93
|
+
Object.setPrototypeOf(this, IdentityConflictError.prototype);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Thrown by `reshape` when the requested shape would change the
|
|
98
|
+
* tensor rank. v0.7.0 allows only axis-by-axis size change;
|
|
99
|
+
* rank-changing reshape is deferred to v0.8.0+ (`mergeAxes` /
|
|
100
|
+
* `splitAxis` helpers).
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
export class RankPreservationError extends UPTError {
|
|
105
|
+
fromRank;
|
|
106
|
+
toRank;
|
|
107
|
+
constructor(fromRank, toRank) {
|
|
108
|
+
super(`LabeledTensor.reshape: cannot change rank from ${fromRank} to ` +
|
|
109
|
+
`${toRank}. v0.7.0 supports only same-rank reshape; use a future ` +
|
|
110
|
+
`mergeAxes / splitAxis helper for rank changes.`);
|
|
111
|
+
this.name = 'RankPreservationError';
|
|
112
|
+
this.fromRank = fromRank;
|
|
113
|
+
this.toRank = toRank;
|
|
114
|
+
Object.setPrototypeOf(this, RankPreservationError.prototype);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
// canonicalLabelOrder — Risk 2 mitigation
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
/**
|
|
121
|
+
* Stable lexicographic ordering of label keys. JavaScript's
|
|
122
|
+
* `Object.entries` preserves string-key insertion order, but we
|
|
123
|
+
* route all label-key→axis-position mapping through this helper
|
|
124
|
+
* so the contract algorithm doesn't accidentally depend on
|
|
125
|
+
* constructor-call ordering.
|
|
126
|
+
*
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
export function canonicalLabelOrder(labels) {
|
|
130
|
+
return Object.keys(labels).sort();
|
|
131
|
+
}
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
// LabeledTensor (wrapper class)
|
|
134
|
+
// ---------------------------------------------------------------------------
|
|
135
|
+
/**
|
|
136
|
+
* Engine-agnostic wrapper carrying physics-axis-tagged metadata over
|
|
137
|
+
* an opaque `EngineTensor`. Two `LabeledTensor`s contract over
|
|
138
|
+
* shared `UniversalIndexId` values; non-shared ids become the
|
|
139
|
+
* result's free axes.
|
|
140
|
+
*
|
|
141
|
+
* Construction enforces `Object.keys(labels).length === tensor.shape.length`.
|
|
142
|
+
*
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
export class LabeledTensor {
|
|
146
|
+
tensor;
|
|
147
|
+
engine;
|
|
148
|
+
labels;
|
|
149
|
+
constructor(tensor, engine, labels) {
|
|
150
|
+
const labelCount = Object.keys(labels).length;
|
|
151
|
+
if (labelCount !== tensor.shape.length) {
|
|
152
|
+
throw new LabeledTensorConstructionError(labelCount, tensor.shape.length);
|
|
153
|
+
}
|
|
154
|
+
this.tensor = tensor;
|
|
155
|
+
this.engine = engine;
|
|
156
|
+
this.labels = labels;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Identity-aware contraction (Decision #3): match labels by
|
|
160
|
+
* `UniversalIndexId` equality only. Returns a new `LabeledTensor`
|
|
161
|
+
* whose free labels are the union of both operands' free labels
|
|
162
|
+
* minus the contracted ids, evaluated in `this`-first,
|
|
163
|
+
* `other`-second canonical order.
|
|
164
|
+
*
|
|
165
|
+
* Throws:
|
|
166
|
+
* - `AxisMismatchError` if a shared id disagrees on axis.
|
|
167
|
+
* - `IdentityConflictError` if a non-shared id appears free on
|
|
168
|
+
* both operands.
|
|
169
|
+
*
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
contract(other) {
|
|
173
|
+
if (this.engine !== other.engine) {
|
|
174
|
+
throw new UPTError(`LabeledTensor.contract: engine mismatch (${this.engine.name} vs ` +
|
|
175
|
+
`${other.engine.name}). Both operands must share an engine.`);
|
|
176
|
+
}
|
|
177
|
+
const leftOrder = canonicalLabelOrder(this.labels);
|
|
178
|
+
const rightOrder = canonicalLabelOrder(other.labels);
|
|
179
|
+
// Build id → (operand, axis-position) sites.
|
|
180
|
+
const sites = new Map();
|
|
181
|
+
leftOrder.forEach((key, axis) => {
|
|
182
|
+
const idx = this.labels[key];
|
|
183
|
+
const list = sites.get(idx.id) ?? [];
|
|
184
|
+
list.push({ operand: 0, axis, key, axisName: idx.axis });
|
|
185
|
+
sites.set(idx.id, list);
|
|
186
|
+
});
|
|
187
|
+
rightOrder.forEach((key, axis) => {
|
|
188
|
+
const idx = other.labels[key];
|
|
189
|
+
const list = sites.get(idx.id) ?? [];
|
|
190
|
+
list.push({ operand: 1, axis, key, axisName: idx.axis });
|
|
191
|
+
sites.set(idx.id, list);
|
|
192
|
+
});
|
|
193
|
+
// Classify each id: contracted (in both operands) vs free (in one).
|
|
194
|
+
const contractions = [];
|
|
195
|
+
const free = [];
|
|
196
|
+
const resultLabels = {};
|
|
197
|
+
for (const [id, occurrences] of sites) {
|
|
198
|
+
if (occurrences.length === 1) {
|
|
199
|
+
// Free axis on exactly one operand. Carry through.
|
|
200
|
+
const o = occurrences[0];
|
|
201
|
+
free.push({ operand: o.operand, axis: o.axis });
|
|
202
|
+
// Preserve the original label key if no collision; otherwise
|
|
203
|
+
// suffix with operand index (rare — only when both operands
|
|
204
|
+
// use the same string key for *different* ids).
|
|
205
|
+
const key = resultLabels[o.key] ? `${o.key}_${o.operand}` : o.key;
|
|
206
|
+
resultLabels[key] = o.operand === 0
|
|
207
|
+
? this.labels[o.key]
|
|
208
|
+
: other.labels[o.key];
|
|
209
|
+
}
|
|
210
|
+
else if (occurrences.length === 2) {
|
|
211
|
+
const [a, b] = occurrences;
|
|
212
|
+
if (a.operand === b.operand) {
|
|
213
|
+
// Same id appears twice in one operand: that's a tensor-self-
|
|
214
|
+
// contraction situation; flag as free conflict.
|
|
215
|
+
throw new IdentityConflictError(id);
|
|
216
|
+
}
|
|
217
|
+
if (a.axisName !== b.axisName) {
|
|
218
|
+
throw new AxisMismatchError(id, a.axisName, b.axisName);
|
|
219
|
+
}
|
|
220
|
+
contractions.push({ pair: [[a.operand, a.axis], [b.operand, b.axis]] });
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
// 3+ occurrences across the two operands: triple+ contraction,
|
|
224
|
+
// not supported by the binary einsum primitive. Reject.
|
|
225
|
+
throw new IdentityConflictError(id);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const spec = { contractions, free };
|
|
229
|
+
const resultTensor = this.engine.einsum(spec, this.tensor, other.tensor);
|
|
230
|
+
return new LabeledTensor(resultTensor, this.engine, resultLabels);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Reorder axes per the given permutation of label keys. The new
|
|
234
|
+
* label record reflects the new axis order; the engine handles
|
|
235
|
+
* the storage-level permutation via `engine.transpose`.
|
|
236
|
+
*
|
|
237
|
+
* @public
|
|
238
|
+
*/
|
|
239
|
+
transpose(newKeyOrder) {
|
|
240
|
+
const currentOrder = canonicalLabelOrder(this.labels);
|
|
241
|
+
if (newKeyOrder.length !== currentOrder.length) {
|
|
242
|
+
throw new UPTError(`LabeledTensor.transpose: new key order has ${newKeyOrder.length} ` +
|
|
243
|
+
`entries but tensor has ${currentOrder.length} axes.`);
|
|
244
|
+
}
|
|
245
|
+
const currentIndex = new Map(currentOrder.map((k, i) => [k, i]));
|
|
246
|
+
const perm = [];
|
|
247
|
+
for (const key of newKeyOrder) {
|
|
248
|
+
const pos = currentIndex.get(key);
|
|
249
|
+
if (pos === undefined) {
|
|
250
|
+
throw new UPTError(`LabeledTensor.transpose: key '${String(key)}' not found in labels.`);
|
|
251
|
+
}
|
|
252
|
+
perm.push(pos);
|
|
253
|
+
}
|
|
254
|
+
const transposedTensor = this.engine.transpose(this.tensor, perm);
|
|
255
|
+
return new LabeledTensor(transposedTensor, this.engine, this.labels);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Per-axis size change. Rank must be preserved (Decision #5);
|
|
259
|
+
* rank-changing reshape throws `RankPreservationError`. v0.8.0+
|
|
260
|
+
* may add `mergeAxes` / `splitAxis` for rank-changing operations.
|
|
261
|
+
*
|
|
262
|
+
* Labels survive unchanged (axis identity is preserved across a
|
|
263
|
+
* size-only reshape).
|
|
264
|
+
*
|
|
265
|
+
* @public
|
|
266
|
+
*/
|
|
267
|
+
reshape(shape) {
|
|
268
|
+
if (shape.length !== this.tensor.shape.length) {
|
|
269
|
+
throw new RankPreservationError(this.tensor.shape.length, shape.length);
|
|
270
|
+
}
|
|
271
|
+
const reshapedTensor = this.engine.reshape(this.tensor, shape);
|
|
272
|
+
return new LabeledTensor(reshapedTensor, this.engine, this.labels);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=labeled-tensor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labeled-tensor.js","sourceRoot":"","sources":["../../src/core/labeled-tensor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,8EAA8E;AAC9E,qEAAqE;AACrE,8BAA8B;AAC9B,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,OAAO,8BAA+B,SAAQ,QAAQ;IAC1C,UAAU,CAAS;IACnB,UAAU,CAAS;IACnC,YAAY,UAAkB,EAAE,UAAkB;QAChD,KAAK,CACH,oCAAoC,UAAU,eAAe;YAC7D,kBAAkB,UAAU,yCAAyC;YACrE,2BAA2B,CAC5B,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAC;QAC7C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,8BAA8B,CAAC,SAAS,CAAC,CAAC;IACxE,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAkB,SAAQ,QAAQ;IAC7B,OAAO,CAAmB;IAC1B,QAAQ,CAAW;IACnB,SAAS,CAAW;IACpC,YACE,OAAyB,E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MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAClE,OAAO,IAAI,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;;;OASG;IACI,OAAO,CAAC,KAA4B;QACzC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC9C,MAAM,IAAI,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1E,CAAC;QACD,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC/D,OAAO,IAAI,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACrE,CAAC;CACF"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `RegimeType` extension system — v0.8 Proposal 5.
|
|
3
|
+
*
|
|
4
|
+
* Per P5 Decision #1, this module ships the extension MECHANISM
|
|
5
|
+
* (`defineRegime`, `lookupRegime`, `listRegimesByAxis`,
|
|
6
|
+
* `provenanceFor`) PLUS the eight v0.6-shipped closed-union values
|
|
7
|
+
* pre-registered (per Phase 2 — see `src/core/regimes-builtins.ts`).
|
|
8
|
+
* Closed taxonomy of new physics-regime built-ins is deferred to
|
|
9
|
+
* v0.9 per Decision #1 framing.
|
|
10
|
+
*
|
|
11
|
+
* Per P5 Adam-H1 reconciliation, Phase 4's per-cell regime field
|
|
12
|
+
* ships as a sibling registry (`regimesForCell`) keyed by cell id
|
|
13
|
+
* rather than as a new field on `BridgeCell` (avoids the
|
|
14
|
+
* `cellToBridge` adapter round-trip that would strip unknown
|
|
15
|
+
* fields).
|
|
16
|
+
*
|
|
17
|
+
* Per P5 Eve-M2 reconciliation, `FluxRuleKind` is extended with
|
|
18
|
+
* `'regime-consistency'` discriminator in this commit (Phase 4
|
|
19
|
+
* rule fires from `addCell`).
|
|
20
|
+
*
|
|
21
|
+
* @module core/regime-registry
|
|
22
|
+
*/
|
|
23
|
+
import type { AxisName } from './universal-index.js';
|
|
24
|
+
/**
|
|
25
|
+
* Provenance for a registered regime. Tracks WHO registered the
|
|
26
|
+
* regime (the catalog source or downstream package name) and WHEN.
|
|
27
|
+
* Per P5 Decision #4.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export interface RegimeProvenance {
|
|
32
|
+
/** The package or module that registered this regime. */
|
|
33
|
+
readonly registeredBy: string;
|
|
34
|
+
/** ISO-8601 timestamp string. Filled in by `defineRegime`. */
|
|
35
|
+
readonly registeredAt: string;
|
|
36
|
+
/** Optional citation (URL, DOI, or free-text). */
|
|
37
|
+
readonly citation?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The base shape every registered regime carries. Implementation
|
|
41
|
+
* detail: callers always interact via the per-axis convenience
|
|
42
|
+
* APIs (`defineScale`, `defineForce`, ... — Phase 3) which
|
|
43
|
+
* narrow `axis` to a literal at the type level.
|
|
44
|
+
*
|
|
45
|
+
* Per P5 Decision #2 (locked field set): `axis`, `tag`,
|
|
46
|
+
* `displayName`, `tags?`, `limits?`, `provenance`.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export interface RegimeValueBase {
|
|
51
|
+
readonly axis: AxisName;
|
|
52
|
+
readonly tag: string;
|
|
53
|
+
readonly displayName: string;
|
|
54
|
+
readonly tags?: ReadonlyArray<string>;
|
|
55
|
+
readonly limits?: {
|
|
56
|
+
readonly min?: number;
|
|
57
|
+
readonly max?: number;
|
|
58
|
+
};
|
|
59
|
+
readonly provenance: RegimeProvenance;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Spec passed to `defineRegime` to register a new regime value
|
|
63
|
+
* under a given axis. The `provenance.registeredAt` field is
|
|
64
|
+
* filled by `defineRegime` (so callers don't have to thread the
|
|
65
|
+
* timestamp themselves).
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export interface RegimeSpec<Axis extends AxisName = AxisName> {
|
|
70
|
+
readonly axis: Axis;
|
|
71
|
+
readonly tag: string;
|
|
72
|
+
readonly displayName: string;
|
|
73
|
+
readonly tags?: ReadonlyArray<string>;
|
|
74
|
+
readonly limits?: {
|
|
75
|
+
readonly min?: number;
|
|
76
|
+
readonly max?: number;
|
|
77
|
+
};
|
|
78
|
+
readonly provenance: Omit<RegimeProvenance, 'registeredAt'> & {
|
|
79
|
+
readonly registeredAt?: string;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Thrown when `defineRegime` receives a spec that contradicts an
|
|
84
|
+
* already-registered (axis, tag) pair. Carries both specs for
|
|
85
|
+
* diagnosis. Per P5 Decision #4 + Eve-L1 reconciliation
|
|
86
|
+
* (idempotent re-registration with the SAME spec is allowed;
|
|
87
|
+
* collisions throw).
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
export declare class RegimeCollisionError extends Error {
|
|
92
|
+
readonly axis: AxisName;
|
|
93
|
+
readonly tag: string;
|
|
94
|
+
constructor(axis: AxisName, tag: string, existing: RegimeValueBase, incoming: RegimeSpec);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Register a regime under its `(axis, tag)` coordinate. Idempotent
|
|
98
|
+
* for identical re-registrations; throws `RegimeCollisionError`
|
|
99
|
+
* for the same `(axis, tag)` with different content.
|
|
100
|
+
*
|
|
101
|
+
* Returns the canonicalized `RegimeValueBase` (with
|
|
102
|
+
* `provenance.registeredAt` filled in if omitted).
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
export declare function defineRegime<Axis extends AxisName>(spec: RegimeSpec<Axis>): RegimeValueBase;
|
|
107
|
+
/**
|
|
108
|
+
* Look up a registered regime by `(axis, tag)`. Returns `undefined`
|
|
109
|
+
* if not registered.
|
|
110
|
+
*
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
export declare function lookupRegime(axis: AxisName, tag: string): RegimeValueBase | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Enumerate all regimes registered under a given axis. Returns
|
|
116
|
+
* a snapshot array (safe to iterate without holding a registry
|
|
117
|
+
* reference).
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
export declare function listRegimesByAxis(axis: AxisName): ReadonlyArray<RegimeValueBase>;
|
|
122
|
+
/**
|
|
123
|
+
* Get the provenance of a specific `(axis, tag)` regime. Helper
|
|
124
|
+
* for audit-tooling that needs to know who registered what.
|
|
125
|
+
*
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
export declare function provenanceFor(axis: AxisName, tag: string): RegimeProvenance | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Attach regime values to a cell by its `id`. Per P5 Adam-M1
|
|
131
|
+
* resolution, regimes ride on a sibling registry rather than as a
|
|
132
|
+
* `BridgeCell.regimes?` field — this preserves the P3 surface
|
|
133
|
+
* contract (no new `BridgeCell` fields) and avoids the
|
|
134
|
+
* `cellToBridge` adapter round-trip.
|
|
135
|
+
*
|
|
136
|
+
* Idempotent (same id + same regime set is a no-op).
|
|
137
|
+
*
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
export declare function attachRegimesToCell(cellId: string, regimes: ReadonlyArray<RegimeValueBase>): void;
|
|
141
|
+
/**
|
|
142
|
+
* Get the regimes attached to a cell by its `id`. Returns
|
|
143
|
+
* `undefined` if no regimes are attached.
|
|
144
|
+
*
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
export declare function getCellRegimes(cellId: string): ReadonlyArray<RegimeValueBase> | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Clear all registered regimes AND all cell attachments. Test-only
|
|
150
|
+
* helper — DO NOT call from production code.
|
|
151
|
+
*
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
154
|
+
export declare function _resetRegistryForTesting(): void;
|
|
155
|
+
type AxisConvenience<Axis extends AxisName> = (spec: Omit<RegimeSpec<Axis>, 'axis'>) => RegimeValueBase;
|
|
156
|
+
/** Register a regime on the `'scale'` axis. @public */
|
|
157
|
+
export declare const defineScale: AxisConvenience<'scale'>;
|
|
158
|
+
/** Register a regime on the `'force'` axis. @public */
|
|
159
|
+
export declare const defineForce: AxisConvenience<'force'>;
|
|
160
|
+
/** Register a regime on the `'symmetry'` axis. @public */
|
|
161
|
+
export declare const defineSymmetry: AxisConvenience<'symmetry'>;
|
|
162
|
+
/** Register a regime on the `'information'` axis. @public */
|
|
163
|
+
export declare const defineInformation: AxisConvenience<'information'>;
|
|
164
|
+
/** Register a regime on the `'dimension'` axis. @public */
|
|
165
|
+
export declare const defineDimension: AxisConvenience<'dimension'>;
|
|
166
|
+
/** Register a regime on the `'topology'` axis. @public */
|
|
167
|
+
export declare const defineTopology: AxisConvenience<'topology'>;
|
|
168
|
+
export {};
|
|
169
|
+
//# sourceMappingURL=regime-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regime-registry.d.ts","sourceRoot":"","sources":["../../src/core/regime-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,8DAA8D;IAC9D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,CAAC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CAChB,CAAC;AAE9C,2DAA2D;AAC3D,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,WAAW,CACd,CAAC;AAE5C,0DAA0D;AAC1D,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,UAAU,CACb,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `RegimeType` extension system — v0.8 Proposal 5.
|
|
3
|
+
*
|
|
4
|
+
* Per P5 Decision #1, this module ships the extension MECHANISM
|
|
5
|
+
* (`defineRegime`, `lookupRegime`, `listRegimesByAxis`,
|
|
6
|
+
* `provenanceFor`) PLUS the eight v0.6-shipped closed-union values
|
|
7
|
+
* pre-registered (per Phase 2 — see `src/core/regimes-builtins.ts`).
|
|
8
|
+
* Closed taxonomy of new physics-regime built-ins is deferred to
|
|
9
|
+
* v0.9 per Decision #1 framing.
|
|
10
|
+
*
|
|
11
|
+
* Per P5 Adam-H1 reconciliation, Phase 4's per-cell regime field
|
|
12
|
+
* ships as a sibling registry (`regimesForCell`) keyed by cell id
|
|
13
|
+
* rather than as a new field on `BridgeCell` (avoids the
|
|
14
|
+
* `cellToBridge` adapter round-trip that would strip unknown
|
|
15
|
+
* fields).
|
|
16
|
+
*
|
|
17
|
+
* Per P5 Eve-M2 reconciliation, `FluxRuleKind` is extended with
|
|
18
|
+
* `'regime-consistency'` discriminator in this commit (Phase 4
|
|
19
|
+
* rule fires from `addCell`).
|
|
20
|
+
*
|
|
21
|
+
* @module core/regime-registry
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Thrown when `defineRegime` receives a spec that contradicts an
|
|
25
|
+
* already-registered (axis, tag) pair. Carries both specs for
|
|
26
|
+
* diagnosis. Per P5 Decision #4 + Eve-L1 reconciliation
|
|
27
|
+
* (idempotent re-registration with the SAME spec is allowed;
|
|
28
|
+
* collisions throw).
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export class RegimeCollisionError extends Error {
|
|
33
|
+
axis;
|
|
34
|
+
tag;
|
|
35
|
+
constructor(axis, tag, existing, incoming) {
|
|
36
|
+
super(`RegimeRegistry.defineRegime: cannot re-register (${axis}, '${tag}') ` +
|
|
37
|
+
`with a different displayName ('${existing.displayName}' vs ` +
|
|
38
|
+
`'${incoming.displayName}'). Identical re-registrations are ` +
|
|
39
|
+
`idempotent; only conflicting specs throw.`);
|
|
40
|
+
this.name = 'RegimeCollisionError';
|
|
41
|
+
this.axis = axis;
|
|
42
|
+
this.tag = tag;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
// Private singleton storage
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
const registry = new Map();
|
|
49
|
+
function ensureAxisMap(axis) {
|
|
50
|
+
let m = registry.get(axis);
|
|
51
|
+
if (!m) {
|
|
52
|
+
m = new Map();
|
|
53
|
+
registry.set(axis, m);
|
|
54
|
+
}
|
|
55
|
+
return m;
|
|
56
|
+
}
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Public API (Phase 1)
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
/**
|
|
61
|
+
* Register a regime under its `(axis, tag)` coordinate. Idempotent
|
|
62
|
+
* for identical re-registrations; throws `RegimeCollisionError`
|
|
63
|
+
* for the same `(axis, tag)` with different content.
|
|
64
|
+
*
|
|
65
|
+
* Returns the canonicalized `RegimeValueBase` (with
|
|
66
|
+
* `provenance.registeredAt` filled in if omitted).
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
export function defineRegime(spec) {
|
|
71
|
+
const axisMap = ensureAxisMap(spec.axis);
|
|
72
|
+
const existing = axisMap.get(spec.tag);
|
|
73
|
+
const canonical = {
|
|
74
|
+
axis: spec.axis,
|
|
75
|
+
tag: spec.tag,
|
|
76
|
+
displayName: spec.displayName,
|
|
77
|
+
...(spec.tags ? { tags: spec.tags } : {}),
|
|
78
|
+
...(spec.limits ? { limits: spec.limits } : {}),
|
|
79
|
+
provenance: {
|
|
80
|
+
registeredBy: spec.provenance.registeredBy,
|
|
81
|
+
registeredAt: spec.provenance.registeredAt ?? new Date().toISOString(),
|
|
82
|
+
...(spec.provenance.citation ? { citation: spec.provenance.citation } : {}),
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
if (existing) {
|
|
86
|
+
// Idempotency check: identical (modulo timestamp).
|
|
87
|
+
if (existing.displayName !== canonical.displayName ||
|
|
88
|
+
existing.provenance.registeredBy !== canonical.provenance.registeredBy) {
|
|
89
|
+
throw new RegimeCollisionError(spec.axis, spec.tag, existing, spec);
|
|
90
|
+
}
|
|
91
|
+
return existing;
|
|
92
|
+
}
|
|
93
|
+
axisMap.set(spec.tag, canonical);
|
|
94
|
+
return canonical;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Look up a registered regime by `(axis, tag)`. Returns `undefined`
|
|
98
|
+
* if not registered.
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
export function lookupRegime(axis, tag) {
|
|
103
|
+
return registry.get(axis)?.get(tag);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Enumerate all regimes registered under a given axis. Returns
|
|
107
|
+
* a snapshot array (safe to iterate without holding a registry
|
|
108
|
+
* reference).
|
|
109
|
+
*
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
export function listRegimesByAxis(axis) {
|
|
113
|
+
const m = registry.get(axis);
|
|
114
|
+
return m ? [...m.values()] : [];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get the provenance of a specific `(axis, tag)` regime. Helper
|
|
118
|
+
* for audit-tooling that needs to know who registered what.
|
|
119
|
+
*
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
export function provenanceFor(axis, tag) {
|
|
123
|
+
return lookupRegime(axis, tag)?.provenance;
|
|
124
|
+
}
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// Phase 4 — per-cell regime attachment (sibling registry per Adam-M1)
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
const cellRegimes = new Map();
|
|
129
|
+
/**
|
|
130
|
+
* Attach regime values to a cell by its `id`. Per P5 Adam-M1
|
|
131
|
+
* resolution, regimes ride on a sibling registry rather than as a
|
|
132
|
+
* `BridgeCell.regimes?` field — this preserves the P3 surface
|
|
133
|
+
* contract (no new `BridgeCell` fields) and avoids the
|
|
134
|
+
* `cellToBridge` adapter round-trip.
|
|
135
|
+
*
|
|
136
|
+
* Idempotent (same id + same regime set is a no-op).
|
|
137
|
+
*
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
export function attachRegimesToCell(cellId, regimes) {
|
|
141
|
+
cellRegimes.set(cellId, regimes);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get the regimes attached to a cell by its `id`. Returns
|
|
145
|
+
* `undefined` if no regimes are attached.
|
|
146
|
+
*
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
149
|
+
export function getCellRegimes(cellId) {
|
|
150
|
+
return cellRegimes.get(cellId);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Clear all registered regimes AND all cell attachments. Test-only
|
|
154
|
+
* helper — DO NOT call from production code.
|
|
155
|
+
*
|
|
156
|
+
* @internal
|
|
157
|
+
*/
|
|
158
|
+
export function _resetRegistryForTesting() {
|
|
159
|
+
registry.clear();
|
|
160
|
+
cellRegimes.clear();
|
|
161
|
+
}
|
|
162
|
+
/** Register a regime on the `'scale'` axis. @public */
|
|
163
|
+
export const defineScale = (s) => defineRegime({ ...s, axis: 'scale' });
|
|
164
|
+
/** Register a regime on the `'force'` axis. @public */
|
|
165
|
+
export const defineForce = (s) => defineRegime({ ...s, axis: 'force' });
|
|
166
|
+
/** Register a regime on the `'symmetry'` axis. @public */
|
|
167
|
+
export const defineSymmetry = (s) => defineRegime({ ...s, axis: 'symmetry' });
|
|
168
|
+
/** Register a regime on the `'information'` axis. @public */
|
|
169
|
+
export const defineInformation = (s) => defineRegime({ ...s, axis: 'information' });
|
|
170
|
+
/** Register a regime on the `'dimension'` axis. @public */
|
|
171
|
+
export const defineDimension = (s) => defineRegime({ ...s, axis: 'dimension' });
|
|
172
|
+
/** Register a regime on the `'topology'` axis. @public */
|
|
173
|
+
export const defineTopology = (s) => defineRegime({ ...s, axis: 'topology' });
|
|
174
|
+
//# sourceMappingURL=regime-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regime-registry.js","sourceRoot":"","sources":["../../src/core/regime-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA8DH;;;;;;;;GAQG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7B,IAAI,CAAW;IACf,GAAG,CAAS;IAC5B,YAAY,IAAc,EAAE,GAAW,EAAE,QAAyB,EAAE,QAAoB;QACtF,KAAK,CACH,oDAAoD,IAAI,MAAM,GAAG,KAAK;YACtE,kCAAkC,QAAQ,CAAC,WAAW,OAAO;YAC7D,IAAI,QAAQ,CAAC,WAAW,qCAAqC;YAC7D,2CAA2C,CAC5C,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;CACF;AAED,8EAA8E;AAC9E,4BAA4B;AAC5B,8EAA8E;AAE9E,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0C,CAAC;AAEnE,SAAS,aAAa,CAAC,IAAc;IACnC,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;QACd,QAAQ,CAAC,GAAG,CAAC,IAAI,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C;IACjB,WAAW,CAAC,KAAK,EAAE,CAAC;AACtB,CAAC;AAUD,uDAAuD;AACvD,MAAM,CAAC,MAAM,WAAW,GAA6B,CAAC,CAAC,EAAE,EAAE,CACzD,YAAY,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAExC,uDAAuD;AACvD,MAAM,CAAC,MAAM,WAAW,GAA6B,CAAC,CAAC,EAAE,EAAE,CACzD,YAAY,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAExC,0DAA0D;AAC1D,MAAM,CAAC,MAAM,cAAc,GAAgC,CAAC,CAAC,EAAE,EAAE,CAC/D,YAAY,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;AAE3C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,iBAAiB,GAAmC,CAAC,CAAC,EAAE,EAAE,CACrE,YAAY,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;AAE9C,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAiC,CAAC,CAAC,EAAE,EAAE,CACjE,YAAY,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;AAE5C,0DAA0D;AAC1D,MAAM,CAAC,MAAM,cAAc,GAAgC,CAAC,CAAC,EAAE,EAAE,CAC/D,YAAY,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wiring: installs P5's `RegimeConsistency` rule body into the
|
|
3
|
+
* flux-rules registry. Importing this module activates Rule 4
|
|
4
|
+
* (regime-consistency, WARNING tier) on every `UniversalTensor`.
|
|
5
|
+
*
|
|
6
|
+
* Phase 4 of v0.8 Proposal 5.
|
|
7
|
+
*
|
|
8
|
+
* The rule body checks: for each attached regime on a cell (via
|
|
9
|
+
* `getCellRegimes(cell.id)`), does the regime's axis MATCH a
|
|
10
|
+
* coordinate axis the cell occupies? If not, emit a warning.
|
|
11
|
+
* Example: a `LawCell` with `scales: ['classical']` attached to
|
|
12
|
+
* a regime whose `axis === 'scale'` but `tag === 'quantum'`
|
|
13
|
+
* — the cell sits in classical coords but is tagged with a quantum
|
|
14
|
+
* regime → warning.
|
|
15
|
+
*
|
|
16
|
+
* Per P5 Adam-M2 reconciliation, cells carry PLURAL axis arrays
|
|
17
|
+
* (`LawCell.scales`, `LawCell.forces`); the rule reads any of them
|
|
18
|
+
* and matches against the regime tag.
|
|
19
|
+
*
|
|
20
|
+
* Importing this module installs the rule. Consumers who don't
|
|
21
|
+
* want regime checks can simply skip the import.
|
|
22
|
+
*
|
|
23
|
+
* @module core/regime-rule-install
|
|
24
|
+
*/
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=regime-rule-install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regime-rule-install.d.ts","sourceRoot":"","sources":["../../src/core/regime-rule-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
|