universal-physics-tensor 10.0.0 → 11.0.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 +4 -3
- package/bin/upt.mjs +13 -1
- package/data/atlas/atlas.json +25 -25
- package/data/atlas/atlas.jsonld +1 -1
- package/data/atlas/diffusion.json +6 -6
- package/data/atlas/oscillators.json +7 -7
- package/data/atlas/waves.json +14 -14
- package/data/atlas/witness-results.json +11 -11
- package/data/bridge-catalog.json +371 -228
- package/data/bridge-catalog.schema.json +45 -7
- package/dist/atlas/applicability.d.ts.map +1 -1
- package/dist/atlas/applicability.js +21 -15
- package/dist/atlas/applicability.js.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts +9 -1
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.js +15 -13
- package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
- package/dist/atlas/benchmark/loader.js +2 -2
- package/dist/atlas/benchmark/loader.js.map +1 -1
- package/dist/atlas/benchmark/stats.d.ts +2 -2
- package/dist/atlas/benchmark/stats.d.ts.map +1 -1
- package/dist/atlas/benchmark/stats.js +15 -7
- package/dist/atlas/benchmark/stats.js.map +1 -1
- package/dist/atlas/catalog-formal-ref.d.ts +26 -3
- package/dist/atlas/catalog-formal-ref.d.ts.map +1 -1
- package/dist/atlas/catalog-formal-ref.js +52 -5
- package/dist/atlas/catalog-formal-ref.js.map +1 -1
- package/dist/atlas/chain-pipeline.d.ts.map +1 -1
- package/dist/atlas/chain-pipeline.js +7 -8
- package/dist/atlas/chain-pipeline.js.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.d.ts +0 -4
- package/dist/atlas/diffusion/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.js +8 -12
- package/dist/atlas/diffusion/bridges-closure.js.map +1 -1
- package/dist/atlas/diffusion/bridges.d.ts.map +1 -1
- package/dist/atlas/diffusion/bridges.js +27 -39
- package/dist/atlas/diffusion/bridges.js.map +1 -1
- package/dist/atlas/diffusion/dimensions.d.ts +6 -14
- package/dist/atlas/diffusion/dimensions.d.ts.map +1 -1
- package/dist/atlas/diffusion/dimensions.js +8 -16
- package/dist/atlas/diffusion/dimensions.js.map +1 -1
- package/dist/atlas/diffusion/models.d.ts +3 -3
- package/dist/atlas/diffusion/models.d.ts.map +1 -1
- package/dist/atlas/diffusion/models.js +5 -10
- package/dist/atlas/diffusion/models.js.map +1 -1
- package/dist/atlas/diffusion/numerics.d.ts +16 -4
- package/dist/atlas/diffusion/numerics.d.ts.map +1 -1
- package/dist/atlas/diffusion/numerics.js +38 -24
- package/dist/atlas/diffusion/numerics.js.map +1 -1
- package/dist/atlas/link-prediction.d.ts +106 -3
- package/dist/atlas/link-prediction.d.ts.map +1 -1
- package/dist/atlas/link-prediction.js +212 -66
- package/dist/atlas/link-prediction.js.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.js +7 -11
- package/dist/atlas/oscillators/bridges-coarse.js.map +1 -1
- package/dist/atlas/oscillators/bridges-exact.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-exact.js +6 -7
- package/dist/atlas/oscillators/bridges-exact.js.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.d.ts +3 -16
- package/dist/atlas/oscillators/bridges-limits.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.js +23 -34
- package/dist/atlas/oscillators/bridges-limits.js.map +1 -1
- package/dist/atlas/oscillators/dimensions.d.ts +9 -21
- package/dist/atlas/oscillators/dimensions.d.ts.map +1 -1
- package/dist/atlas/oscillators/dimensions.js +9 -21
- package/dist/atlas/oscillators/dimensions.js.map +1 -1
- package/dist/atlas/oscillators/limit-witnesses.d.ts +2 -2
- package/dist/atlas/oscillators/limit-witnesses.d.ts.map +1 -1
- package/dist/atlas/oscillators/limit-witnesses.js +17 -15
- package/dist/atlas/oscillators/limit-witnesses.js.map +1 -1
- package/dist/atlas/oscillators/models.d.ts.map +1 -1
- package/dist/atlas/oscillators/models.js +2 -6
- package/dist/atlas/oscillators/models.js.map +1 -1
- package/dist/atlas/oscillators/pendulum-motion.d.ts +29 -6
- package/dist/atlas/oscillators/pendulum-motion.d.ts.map +1 -1
- package/dist/atlas/oscillators/pendulum-motion.js +60 -40
- package/dist/atlas/oscillators/pendulum-motion.js.map +1 -1
- package/dist/atlas/oscillators/phase-translation.d.ts +0 -11
- package/dist/atlas/oscillators/phase-translation.d.ts.map +1 -1
- package/dist/atlas/oscillators/phase-translation.js +3 -4
- package/dist/atlas/oscillators/phase-translation.js.map +1 -1
- package/dist/atlas/oscillators/position-translation.d.ts +68 -7
- package/dist/atlas/oscillators/position-translation.d.ts.map +1 -1
- package/dist/atlas/oscillators/position-translation.js +123 -12
- package/dist/atlas/oscillators/position-translation.js.map +1 -1
- package/dist/atlas/oscillators/rejections.d.ts +0 -2
- package/dist/atlas/oscillators/rejections.d.ts.map +1 -1
- package/dist/atlas/oscillators/rejections.js +0 -7
- package/dist/atlas/oscillators/rejections.js.map +1 -1
- package/dist/atlas/physjs-entries.generated.d.ts +25 -24
- package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
- package/dist/atlas/physjs-entries.generated.js +25 -24
- package/dist/atlas/physjs-entries.generated.js.map +1 -1
- package/dist/atlas/physjs-ref.d.ts +34 -31
- package/dist/atlas/physjs-ref.d.ts.map +1 -1
- package/dist/atlas/physjs-ref.js +55 -53
- package/dist/atlas/physjs-ref.js.map +1 -1
- package/dist/atlas/physjs-reviewed.d.ts +1 -1
- package/dist/atlas/physjs-reviewed.js +15 -15
- package/dist/atlas/physjs-reviewed.js.map +1 -1
- package/dist/atlas/poster/statements.d.ts +0 -19
- package/dist/atlas/poster/statements.d.ts.map +1 -1
- package/dist/atlas/poster/statements.js +1 -1
- package/dist/atlas/poster/statements.js.map +1 -1
- package/dist/atlas/proof-target.d.ts +1 -1
- package/dist/atlas/proof-target.js +1 -1
- package/dist/atlas/proof-target.js.map +1 -1
- package/dist/atlas/regime.d.ts +1 -1
- package/dist/atlas/regime.d.ts.map +1 -1
- package/dist/atlas/regime.js +1 -1
- package/dist/atlas/regime.js.map +1 -1
- package/dist/atlas/text-overlap.d.ts +23 -0
- package/dist/atlas/text-overlap.d.ts.map +1 -0
- package/dist/atlas/text-overlap.js +41 -0
- package/dist/atlas/text-overlap.js.map +1 -0
- package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/waves/bridges-closure.js +2 -6
- package/dist/atlas/waves/bridges-closure.js.map +1 -1
- package/dist/atlas/waves/bridges.d.ts.map +1 -1
- package/dist/atlas/waves/bridges.js +32 -48
- package/dist/atlas/waves/bridges.js.map +1 -1
- package/dist/atlas/waves/models.d.ts +5 -6
- package/dist/atlas/waves/models.d.ts.map +1 -1
- package/dist/atlas/waves/models.js +7 -13
- package/dist/atlas/waves/models.js.map +1 -1
- package/dist/atlas/waves/numerics.d.ts.map +1 -1
- package/dist/atlas/waves/numerics.js +10 -3
- package/dist/atlas/waves/numerics.js.map +1 -1
- package/dist/atlas/witness-numeric.d.ts +30 -0
- package/dist/atlas/witness-numeric.d.ts.map +1 -1
- package/dist/atlas/witness-numeric.js +53 -0
- package/dist/atlas/witness-numeric.js.map +1 -1
- package/dist/atlas/witness-specs.d.ts.map +1 -1
- package/dist/atlas/witness-specs.js +19 -0
- package/dist/atlas/witness-specs.js.map +1 -1
- package/dist/atlas/witness-symbolic.d.ts +75 -3
- package/dist/atlas/witness-symbolic.d.ts.map +1 -1
- package/dist/atlas/witness-symbolic.js +116 -10
- package/dist/atlas/witness-symbolic.js.map +1 -1
- package/dist/bridges/catalog-load.d.ts.map +1 -1
- package/dist/bridges/catalog-load.js +13 -8
- package/dist/bridges/catalog-load.js.map +1 -1
- package/dist/bridges/catalog-types.d.ts +26 -2
- package/dist/bridges/catalog-types.d.ts.map +1 -1
- package/dist/bridges/catalog-types.js +11 -1
- package/dist/bridges/catalog-types.js.map +1 -1
- package/dist/bridges/evaluation-errors.d.ts +31 -1
- package/dist/bridges/evaluation-errors.d.ts.map +1 -1
- package/dist/bridges/evaluation-errors.js +20 -2
- package/dist/bridges/evaluation-errors.js.map +1 -1
- package/dist/bridges/evaluator-inputs.d.ts.map +1 -1
- package/dist/bridges/evaluator-inputs.js +7 -5
- package/dist/bridges/evaluator-inputs.js.map +1 -1
- package/dist/bridges/evaluators.d.ts.map +1 -1
- package/dist/bridges/evaluators.js +27 -12
- package/dist/bridges/evaluators.js.map +1 -1
- package/dist/bridges/expr-parse.d.ts +11 -0
- package/dist/bridges/expr-parse.d.ts.map +1 -1
- package/dist/bridges/expr-parse.js +14 -5
- package/dist/bridges/expr-parse.js.map +1 -1
- package/dist/bridges/holds.d.ts +35 -3
- package/dist/bridges/holds.d.ts.map +1 -1
- package/dist/bridges/holds.js +117 -23
- package/dist/bridges/holds.js.map +1 -1
- package/dist/bridges/notices.d.ts.map +1 -1
- package/dist/bridges/notices.js +5 -5
- package/dist/bridges/notices.js.map +1 -1
- package/dist/bridges/relation-eval.d.ts +4 -4
- package/dist/bridges/relation-eval.d.ts.map +1 -1
- package/dist/bridges/relation-eval.js +15 -16
- package/dist/bridges/relation-eval.js.map +1 -1
- package/dist/bridges/sensitivity.d.ts.map +1 -1
- package/dist/bridges/sensitivity.js +3 -3
- package/dist/bridges/sensitivity.js.map +1 -1
- package/dist/bridges/validity.d.ts +33 -0
- package/dist/bridges/validity.d.ts.map +1 -0
- package/dist/bridges/validity.js +67 -0
- package/dist/bridges/validity.js.map +1 -0
- package/dist/canonical/entries/atomic.js +1 -3
- package/dist/canonical/entries/atomic.js.map +1 -1
- package/dist/canonical/entries/condensed-matter.d.ts.map +1 -1
- package/dist/canonical/entries/condensed-matter.js +4 -5
- package/dist/canonical/entries/condensed-matter.js.map +1 -1
- package/dist/canonical/entries/dimensional-classics.d.ts.map +1 -1
- package/dist/canonical/entries/dimensional-classics.js +3 -4
- package/dist/canonical/entries/dimensional-classics.js.map +1 -1
- package/dist/canonical/entries/electromagnetism.d.ts.map +1 -1
- package/dist/canonical/entries/electromagnetism.js +4 -10
- package/dist/canonical/entries/electromagnetism.js.map +1 -1
- package/dist/canonical/entries/fluids-waves.d.ts.map +1 -1
- package/dist/canonical/entries/fluids-waves.js +3 -7
- package/dist/canonical/entries/fluids-waves.js.map +1 -1
- package/dist/canonical/entries/mechanics.d.ts.map +1 -1
- package/dist/canonical/entries/mechanics.js +4 -6
- package/dist/canonical/entries/mechanics.js.map +1 -1
- package/dist/canonical/entries/nonmonomial.d.ts.map +1 -1
- package/dist/canonical/entries/nonmonomial.js +9 -17
- package/dist/canonical/entries/nonmonomial.js.map +1 -1
- package/dist/canonical/entries/relativity.d.ts.map +1 -1
- package/dist/canonical/entries/relativity.js +6 -6
- package/dist/canonical/entries/relativity.js.map +1 -1
- package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts.map +1 -1
- package/dist/canonical/entries/thermo-nuclear-cosmo.js +6 -10
- package/dist/canonical/entries/thermo-nuclear-cosmo.js.map +1 -1
- package/dist/canonical/fixed-points.d.ts +94 -0
- package/dist/canonical/fixed-points.d.ts.map +1 -0
- package/dist/canonical/fixed-points.js +81 -0
- package/dist/canonical/fixed-points.js.map +1 -0
- package/dist/canonical/linkage.d.ts.map +1 -1
- package/dist/canonical/linkage.js +25 -44
- package/dist/canonical/linkage.js.map +1 -1
- package/dist/canonical/normal-form.d.ts.map +1 -1
- package/dist/canonical/normal-form.js +5 -11
- package/dist/canonical/normal-form.js.map +1 -1
- package/dist/canonical/structural.d.ts +21 -21
- package/dist/canonical/structural.d.ts.map +1 -1
- package/dist/canonical/structural.js +40 -19
- package/dist/canonical/structural.js.map +1 -1
- package/dist/cases/brownian-sphere.d.ts +3 -3
- package/dist/cases/brownian-sphere.d.ts.map +1 -1
- package/dist/cases/brownian-sphere.js +6 -5
- package/dist/cases/brownian-sphere.js.map +1 -1
- package/dist/cases/damped-resonator.d.ts.map +1 -1
- package/dist/cases/damped-resonator.js +6 -9
- package/dist/cases/damped-resonator.js.map +1 -1
- package/dist/cases/kepler-rv.d.ts +1 -1
- package/dist/cases/kepler-rv.d.ts.map +1 -1
- package/dist/cases/kepler-rv.js +3 -2
- package/dist/cases/kepler-rv.js.map +1 -1
- package/dist/cases/lumped-cooling.d.ts +8 -3
- package/dist/cases/lumped-cooling.d.ts.map +1 -1
- package/dist/cases/lumped-cooling.js +21 -23
- package/dist/cases/lumped-cooling.js.map +1 -1
- package/dist/cases/quadrature.d.ts +7 -9
- package/dist/cases/quadrature.d.ts.map +1 -1
- package/dist/cases/quadrature.js +28 -32
- package/dist/cases/quadrature.js.map +1 -1
- package/dist/cases/resistor-noise.js +4 -4
- package/dist/cases/resistor-noise.js.map +1 -1
- package/dist/cases/skin-depth.d.ts +0 -4
- package/dist/cases/skin-depth.d.ts.map +1 -1
- package/dist/cases/skin-depth.js +3 -7
- package/dist/cases/skin-depth.js.map +1 -1
- package/dist/cli/args.d.ts +23 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +30 -8
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/bindings.d.ts.map +1 -1
- package/dist/cli/bindings.js +5 -4
- package/dist/cli/bindings.js.map +1 -1
- package/dist/cli/command.d.ts +8 -1
- package/dist/cli/command.d.ts.map +1 -1
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/commands/_atlas-map.d.ts +0 -9
- package/dist/cli/commands/_atlas-map.d.ts.map +1 -1
- package/dist/cli/commands/_atlas-map.js +8 -18
- package/dist/cli/commands/_atlas-map.js.map +1 -1
- package/dist/cli/commands/_atlas-route.d.ts.map +1 -1
- package/dist/cli/commands/_atlas-route.js +6 -2
- package/dist/cli/commands/_atlas-route.js.map +1 -1
- package/dist/cli/commands/_discovery-opts.d.ts.map +1 -1
- package/dist/cli/commands/_discovery-opts.js +8 -9
- package/dist/cli/commands/_discovery-opts.js.map +1 -1
- package/dist/cli/commands/atlas.d.ts.map +1 -1
- package/dist/cli/commands/atlas.js +8 -5
- package/dist/cli/commands/atlas.js.map +1 -1
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +8 -1
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/axes.d.ts.map +1 -1
- package/dist/cli/commands/axes.js +20 -1
- package/dist/cli/commands/axes.js.map +1 -1
- package/dist/cli/commands/confront.d.ts.map +1 -1
- package/dist/cli/commands/confront.js +8 -14
- package/dist/cli/commands/confront.js.map +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +22 -22
- package/dist/cli/commands/derive.js.map +1 -1
- package/dist/cli/commands/discover.d.ts.map +1 -1
- package/dist/cli/commands/discover.js +6 -2
- package/dist/cli/commands/discover.js.map +1 -1
- package/dist/cli/commands/eval.d.ts.map +1 -1
- package/dist/cli/commands/eval.js +1 -0
- package/dist/cli/commands/eval.js.map +1 -1
- package/dist/cli/commands/evaluate.d.ts.map +1 -1
- package/dist/cli/commands/evaluate.js +65 -37
- package/dist/cli/commands/evaluate.js.map +1 -1
- package/dist/cli/commands/explain.d.ts.map +1 -1
- package/dist/cli/commands/explain.js +2 -1
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/ground.d.ts.map +1 -1
- package/dist/cli/commands/ground.js +1 -0
- package/dist/cli/commands/ground.js.map +1 -1
- package/dist/cli/commands/map.d.ts.map +1 -1
- package/dist/cli/commands/map.js +75 -5
- package/dist/cli/commands/map.js.map +1 -1
- package/dist/cli/commands/metric.d.ts.map +1 -1
- package/dist/cli/commands/metric.js +12 -9
- package/dist/cli/commands/metric.js.map +1 -1
- package/dist/cli/commands/path.d.ts +10 -0
- package/dist/cli/commands/path.d.ts.map +1 -1
- package/dist/cli/commands/path.js +25 -3
- package/dist/cli/commands/path.js.map +1 -1
- package/dist/cli/commands/probe.d.ts.map +1 -1
- package/dist/cli/commands/probe.js +59 -16
- package/dist/cli/commands/probe.js.map +1 -1
- package/dist/cli/commands/regime.d.ts.map +1 -1
- package/dist/cli/commands/regime.js +1 -0
- package/dist/cli/commands/regime.js.map +1 -1
- package/dist/cli/commands/retrieve.d.ts.map +1 -1
- package/dist/cli/commands/retrieve.js +1 -0
- package/dist/cli/commands/retrieve.js.map +1 -1
- package/dist/cli/commands/search.d.ts.map +1 -1
- package/dist/cli/commands/search.js +1 -0
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/symbolic.d.ts.map +1 -1
- package/dist/cli/commands/symbolic.js +19 -28
- package/dist/cli/commands/symbolic.js.map +1 -1
- package/dist/cli/commands/testplan.d.ts.map +1 -1
- package/dist/cli/commands/testplan.js +4 -2
- package/dist/cli/commands/testplan.js.map +1 -1
- package/dist/cli/expr-print.d.ts +0 -2
- package/dist/cli/expr-print.d.ts.map +1 -1
- package/dist/cli/expr-print.js +7 -31
- package/dist/cli/expr-print.js.map +1 -1
- package/dist/cli/main.d.ts +7 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +18 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/numeric-flag.d.ts +12 -0
- package/dist/cli/numeric-flag.d.ts.map +1 -0
- package/dist/cli/numeric-flag.js +44 -0
- package/dist/cli/numeric-flag.js.map +1 -0
- package/dist/cli/output.d.ts +20 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +15 -0
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/record-reach.js +2 -2
- package/dist/cli/record-reach.js.map +1 -1
- package/dist/cli/record-tables.d.ts.map +1 -1
- package/dist/cli/record-tables.js +6 -5
- package/dist/cli/record-tables.js.map +1 -1
- package/dist/cli/record.d.ts +1 -5
- package/dist/cli/record.d.ts.map +1 -1
- package/dist/cli/record.js +9 -8
- package/dist/cli/record.js.map +1 -1
- package/dist/cli/search-index.d.ts.map +1 -1
- package/dist/cli/search-index.js +7 -6
- package/dist/cli/search-index.js.map +1 -1
- package/dist/cli/statuses.d.ts +0 -2
- package/dist/cli/statuses.d.ts.map +1 -1
- package/dist/cli/statuses.js +0 -7
- package/dist/cli/statuses.js.map +1 -1
- package/dist/cli/stored-results.d.ts +7 -0
- package/dist/cli/stored-results.d.ts.map +1 -0
- package/dist/cli/stored-results.js +23 -0
- package/dist/cli/stored-results.js.map +1 -0
- package/dist/cli/version.d.ts.map +1 -1
- package/dist/cli/version.js +7 -5
- package/dist/cli/version.js.map +1 -1
- package/dist/cli-api.d.ts +34 -5
- package/dist/cli-api.d.ts.map +1 -1
- package/dist/cli-api.js +28 -4
- package/dist/cli-api.js.map +1 -1
- package/dist/composition/algebraic-equivalence.d.ts +43 -0
- package/dist/composition/algebraic-equivalence.d.ts.map +1 -0
- package/dist/composition/algebraic-equivalence.js +115 -0
- package/dist/composition/algebraic-equivalence.js.map +1 -0
- package/dist/composition/axes.d.ts +0 -6
- package/dist/composition/axes.d.ts.map +1 -1
- package/dist/composition/axes.js +6 -6
- package/dist/composition/axes.js.map +1 -1
- package/dist/composition/axis-audit.d.ts +47 -20
- package/dist/composition/axis-audit.d.ts.map +1 -1
- package/dist/composition/axis-audit.js +82 -9
- package/dist/composition/axis-audit.js.map +1 -1
- package/dist/composition/bridge-analysis.d.ts +17 -0
- package/dist/composition/bridge-analysis.d.ts.map +1 -1
- package/dist/composition/bridge-analysis.js +102 -55
- package/dist/composition/bridge-analysis.js.map +1 -1
- package/dist/composition/canonical-compare.d.ts +40 -0
- package/dist/composition/canonical-compare.d.ts.map +1 -1
- package/dist/composition/canonical-compare.js +122 -24
- package/dist/composition/canonical-compare.js.map +1 -1
- package/dist/composition/canonical-graph.d.ts +1 -1
- package/dist/composition/canonical-graph.d.ts.map +1 -1
- package/dist/composition/canonical-graph.js +9 -36
- package/dist/composition/canonical-graph.js.map +1 -1
- package/dist/composition/canonical-json.js +2 -2
- package/dist/composition/canonical-json.js.map +1 -1
- package/dist/composition/catalog-graph.d.ts.map +1 -1
- package/dist/composition/catalog-graph.js +2 -5
- package/dist/composition/catalog-graph.js.map +1 -1
- package/dist/composition/chain-candidate.d.ts +8 -0
- package/dist/composition/chain-candidate.d.ts.map +1 -1
- package/dist/composition/chain-candidate.js +9 -2
- package/dist/composition/chain-candidate.js.map +1 -1
- package/dist/composition/chain-match.d.ts +6 -3
- package/dist/composition/chain-match.d.ts.map +1 -1
- package/dist/composition/chain-match.js +4 -1
- package/dist/composition/chain-match.js.map +1 -1
- package/dist/composition/chain-result.d.ts.map +1 -1
- package/dist/composition/chain-result.js +2 -14
- package/dist/composition/chain-result.js.map +1 -1
- package/dist/composition/compose-symbolic.d.ts.map +1 -1
- package/dist/composition/compose-symbolic.js +3 -2
- package/dist/composition/compose-symbolic.js.map +1 -1
- package/dist/composition/compose.d.ts.map +1 -1
- package/dist/composition/compose.js +13 -5
- package/dist/composition/compose.js.map +1 -1
- package/dist/composition/composition-recovery.d.ts.map +1 -1
- package/dist/composition/composition-recovery.js +4 -7
- package/dist/composition/composition-recovery.js.map +1 -1
- package/dist/composition/discovery.d.ts +56 -0
- package/dist/composition/discovery.d.ts.map +1 -1
- package/dist/composition/discovery.js +114 -60
- package/dist/composition/discovery.js.map +1 -1
- package/dist/composition/edge.d.ts +21 -2
- package/dist/composition/edge.d.ts.map +1 -1
- package/dist/composition/edge.js +23 -1
- package/dist/composition/edge.js.map +1 -1
- package/dist/composition/enumerate.d.ts.map +1 -1
- package/dist/composition/enumerate.js +18 -3
- package/dist/composition/enumerate.js.map +1 -1
- package/dist/composition/evaluate-relation.d.ts +35 -11
- package/dist/composition/evaluate-relation.d.ts.map +1 -1
- package/dist/composition/evaluate-relation.js +60 -39
- package/dist/composition/evaluate-relation.js.map +1 -1
- package/dist/composition/explain.d.ts +3 -12
- package/dist/composition/explain.d.ts.map +1 -1
- package/dist/composition/explain.js +7 -20
- package/dist/composition/explain.js.map +1 -1
- package/dist/composition/expr-eval.d.ts.map +1 -1
- package/dist/composition/expr-eval.js +2 -11
- package/dist/composition/expr-eval.js.map +1 -1
- package/dist/composition/expr-simplify.d.ts +16 -0
- package/dist/composition/expr-simplify.d.ts.map +1 -1
- package/dist/composition/expr-simplify.js +15 -20
- package/dist/composition/expr-simplify.js.map +1 -1
- package/dist/composition/formula-shape.d.ts +23 -4
- package/dist/composition/formula-shape.d.ts.map +1 -1
- package/dist/composition/formula-shape.js +57 -17
- package/dist/composition/formula-shape.js.map +1 -1
- package/dist/composition/graph-structure.d.ts +98 -0
- package/dist/composition/graph-structure.d.ts.map +1 -0
- package/dist/composition/graph-structure.js +167 -0
- package/dist/composition/graph-structure.js.map +1 -0
- package/dist/composition/graph-viz-svg.d.ts.map +1 -1
- package/dist/composition/graph-viz-svg.js +1 -1
- package/dist/composition/graph-viz-svg.js.map +1 -1
- package/dist/composition/graph-viz.d.ts.map +1 -1
- package/dist/composition/graph-viz.js +8 -37
- package/dist/composition/graph-viz.js.map +1 -1
- package/dist/composition/identifiability.d.ts +91 -4
- package/dist/composition/identifiability.d.ts.map +1 -1
- package/dist/composition/identifiability.js +363 -6
- package/dist/composition/identifiability.js.map +1 -1
- package/dist/composition/index.d.ts +8 -4
- package/dist/composition/index.d.ts.map +1 -1
- package/dist/composition/index.js +3 -2
- package/dist/composition/index.js.map +1 -1
- package/dist/composition/mathts-quiet.d.ts +4 -3
- package/dist/composition/mathts-quiet.d.ts.map +1 -1
- package/dist/composition/mathts-quiet.js +4 -3
- package/dist/composition/mathts-quiet.js.map +1 -1
- package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -1
- package/dist/composition/mathts-scalar-symbols.js +2 -1
- package/dist/composition/mathts-scalar-symbols.js.map +1 -1
- package/dist/composition/probe/corpus.d.ts +4 -2
- package/dist/composition/probe/corpus.d.ts.map +1 -1
- package/dist/composition/probe/corpus.js +20 -9
- package/dist/composition/probe/corpus.js.map +1 -1
- package/dist/composition/probe/dataset.d.ts +17 -0
- package/dist/composition/probe/dataset.d.ts.map +1 -1
- package/dist/composition/probe/dataset.js +95 -50
- package/dist/composition/probe/dataset.js.map +1 -1
- package/dist/composition/probe/experiment-design.d.ts +5 -1
- package/dist/composition/probe/experiment-design.d.ts.map +1 -1
- package/dist/composition/probe/experiment-design.js +44 -24
- package/dist/composition/probe/experiment-design.js.map +1 -1
- package/dist/composition/probe/falsify.d.ts.map +1 -1
- package/dist/composition/probe/falsify.js +2 -0
- package/dist/composition/probe/falsify.js.map +1 -1
- package/dist/composition/probe/fit.d.ts +6 -0
- package/dist/composition/probe/fit.d.ts.map +1 -1
- package/dist/composition/probe/fit.js +46 -22
- package/dist/composition/probe/fit.js.map +1 -1
- package/dist/composition/probe/frontier.d.ts.map +1 -1
- package/dist/composition/probe/frontier.js +33 -15
- package/dist/composition/probe/frontier.js.map +1 -1
- package/dist/composition/probe/generator.d.ts +27 -1
- package/dist/composition/probe/generator.d.ts.map +1 -1
- package/dist/composition/probe/generator.js +53 -30
- package/dist/composition/probe/generator.js.map +1 -1
- package/dist/composition/probe/index.d.ts +14 -0
- package/dist/composition/probe/index.d.ts.map +1 -1
- package/dist/composition/probe/index.js +6 -0
- package/dist/composition/probe/index.js.map +1 -1
- package/dist/composition/probe/limits.d.ts +24 -1
- package/dist/composition/probe/limits.d.ts.map +1 -1
- package/dist/composition/probe/limits.js +53 -11
- package/dist/composition/probe/limits.js.map +1 -1
- package/dist/composition/probe/pipeline.d.ts.map +1 -1
- package/dist/composition/probe/pipeline.js +10 -4
- package/dist/composition/probe/pipeline.js.map +1 -1
- package/dist/composition/probe/power-law.d.ts +121 -0
- package/dist/composition/probe/power-law.d.ts.map +1 -0
- package/dist/composition/probe/power-law.js +255 -0
- package/dist/composition/probe/power-law.js.map +1 -0
- package/dist/composition/probe/problem.d.ts +7 -4
- package/dist/composition/probe/problem.d.ts.map +1 -1
- package/dist/composition/probe/problem.js +177 -49
- package/dist/composition/probe/problem.js.map +1 -1
- package/dist/composition/probe/report.js +1 -1
- package/dist/composition/probe/report.js.map +1 -1
- package/dist/composition/probe/residual.d.ts +6 -1
- package/dist/composition/probe/residual.d.ts.map +1 -1
- package/dist/composition/probe/residual.js +9 -7
- package/dist/composition/probe/residual.js.map +1 -1
- package/dist/composition/probe/structure.d.ts +82 -17
- package/dist/composition/probe/structure.d.ts.map +1 -1
- package/dist/composition/probe/structure.js +129 -55
- package/dist/composition/probe/structure.js.map +1 -1
- package/dist/composition/probe/study.d.ts +31 -9
- package/dist/composition/probe/study.d.ts.map +1 -1
- package/dist/composition/probe/study.js +236 -181
- package/dist/composition/probe/study.js.map +1 -1
- package/dist/composition/probe/t-tail.d.ts +17 -0
- package/dist/composition/probe/t-tail.d.ts.map +1 -0
- package/dist/composition/probe/t-tail.js +32 -0
- package/dist/composition/probe/t-tail.js.map +1 -0
- package/dist/composition/probe/types.d.ts +3 -0
- package/dist/composition/probe/types.d.ts.map +1 -1
- package/dist/composition/probe/types.js.map +1 -1
- package/dist/composition/proposed-bridges.d.ts +41 -10
- package/dist/composition/proposed-bridges.d.ts.map +1 -1
- package/dist/composition/proposed-bridges.js +100 -55
- package/dist/composition/proposed-bridges.js.map +1 -1
- package/dist/composition/quantity-clusters.d.ts +48 -0
- package/dist/composition/quantity-clusters.d.ts.map +1 -0
- package/dist/composition/quantity-clusters.js +98 -0
- package/dist/composition/quantity-clusters.js.map +1 -0
- package/dist/composition/rational-exponent.d.ts +40 -0
- package/dist/composition/rational-exponent.d.ts.map +1 -0
- package/dist/composition/rational-exponent.js +65 -0
- package/dist/composition/rational-exponent.js.map +1 -0
- package/dist/composition/representative-values.d.ts +22 -0
- package/dist/composition/representative-values.d.ts.map +1 -1
- package/dist/composition/representative-values.js +23 -0
- package/dist/composition/representative-values.js.map +1 -1
- package/dist/composition/retrodiction.d.ts.map +1 -1
- package/dist/composition/retrodiction.js +2 -1
- package/dist/composition/retrodiction.js.map +1 -1
- package/dist/composition/user-equation.d.ts.map +1 -1
- package/dist/composition/user-equation.js +2 -2
- package/dist/composition/user-equation.js.map +1 -1
- package/dist/core/assignment.d.ts +19 -0
- package/dist/core/assignment.d.ts.map +1 -0
- package/dist/core/assignment.js +19 -0
- package/dist/core/assignment.js.map +1 -0
- package/dist/core/compare.d.ts +32 -0
- package/dist/core/compare.d.ts.map +1 -0
- package/dist/core/compare.js +46 -0
- package/dist/core/compare.js.map +1 -0
- package/dist/core/constants.d.ts +30 -30
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +47 -30
- package/dist/core/constants.js.map +1 -1
- package/dist/core/data-file.d.ts +7 -0
- package/dist/core/data-file.d.ts.map +1 -1
- package/dist/core/data-file.js +17 -0
- package/dist/core/data-file.js.map +1 -1
- package/dist/core/format.d.ts +36 -0
- package/dist/core/format.d.ts.map +1 -0
- package/dist/core/format.js +39 -0
- package/dist/core/format.js.map +1 -0
- package/dist/core/hash.d.ts +14 -0
- package/dist/core/hash.d.ts.map +1 -0
- package/dist/core/hash.js +17 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/json-schema.d.ts +2 -0
- package/dist/core/json-schema.d.ts.map +1 -1
- package/dist/core/json-schema.js +14 -13
- package/dist/core/json-schema.js.map +1 -1
- package/dist/core/labeled-tensor.d.ts.map +1 -1
- package/dist/core/labeled-tensor.js +0 -8
- package/dist/core/labeled-tensor.js.map +1 -1
- package/dist/core/mathts-read.d.ts +25 -0
- package/dist/core/mathts-read.d.ts.map +1 -0
- package/dist/core/mathts-read.js +51 -0
- package/dist/core/mathts-read.js.map +1 -0
- package/dist/core/tensor.d.ts.map +1 -1
- package/dist/core/tensor.js +24 -0
- package/dist/core/tensor.js.map +1 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/diff/bridge-gradient.d.ts +19 -6
- package/dist/diff/bridge-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-gradient.js +19 -11
- package/dist/diff/bridge-gradient.js.map +1 -1
- package/dist/diff/bridge-specs.d.ts.map +1 -1
- package/dist/diff/bridge-specs.js +3 -0
- package/dist/diff/bridge-specs.js.map +1 -1
- package/dist/dimensional/algebra.d.ts +18 -0
- package/dist/dimensional/algebra.d.ts.map +1 -1
- package/dist/dimensional/algebra.js +41 -1
- package/dist/dimensional/algebra.js.map +1 -1
- package/dist/dimensional/ast-builders.d.ts +7 -0
- package/dist/dimensional/ast-builders.d.ts.map +1 -1
- package/dist/dimensional/ast-builders.js +11 -0
- package/dist/dimensional/ast-builders.js.map +1 -1
- package/dist/dimensional/ast-leaves.d.ts +81 -0
- package/dist/dimensional/ast-leaves.d.ts.map +1 -0
- package/dist/dimensional/ast-leaves.js +146 -0
- package/dist/dimensional/ast-leaves.js.map +1 -0
- package/dist/dimensional/buckingham.d.ts.map +1 -1
- package/dist/dimensional/buckingham.js +15 -27
- package/dist/dimensional/buckingham.js.map +1 -1
- package/dist/dimensional/constant-rows.js +9 -9
- package/dist/dimensional/constant-rows.js.map +1 -1
- package/dist/dimensional/dimension-inference.d.ts.map +1 -1
- package/dist/dimensional/dimension-inference.js +1 -2
- package/dist/dimensional/dimension-inference.js.map +1 -1
- package/dist/dimensional/errors.d.ts +1 -1
- package/dist/dimensional/errors.d.ts.map +1 -1
- package/dist/dimensional/errors.js +1 -15
- package/dist/dimensional/errors.js.map +1 -1
- package/dist/dimensional/exact-scale.d.ts +0 -17
- package/dist/dimensional/exact-scale.d.ts.map +1 -1
- package/dist/dimensional/exact-scale.js +8 -8
- package/dist/dimensional/exact-scale.js.map +1 -1
- package/dist/dimensional/gauge-field.d.ts.map +1 -1
- package/dist/dimensional/gauge-field.js +2 -2
- package/dist/dimensional/gauge-field.js.map +1 -1
- package/dist/dimensional/hyphen-names.d.ts +12 -2
- package/dist/dimensional/hyphen-names.d.ts.map +1 -1
- package/dist/dimensional/hyphen-names.js +44 -19
- package/dist/dimensional/hyphen-names.js.map +1 -1
- package/dist/dimensional/metric.d.ts.map +1 -1
- package/dist/dimensional/metric.js +0 -1
- package/dist/dimensional/metric.js.map +1 -1
- package/dist/dimensional/symbolic-constants.d.ts +9 -0
- package/dist/dimensional/symbolic-constants.d.ts.map +1 -1
- package/dist/dimensional/symbolic-constants.js +13 -1
- package/dist/dimensional/symbolic-constants.js.map +1 -1
- package/dist/dimensional/types.d.ts +36 -0
- package/dist/dimensional/types.d.ts.map +1 -1
- package/dist/dimensional/types.js +45 -7
- package/dist/dimensional/types.js.map +1 -1
- package/dist/dimensional/unit-data.js +2 -2
- package/dist/dimensional/unit-data.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/numerical/christoffel-flat.d.ts.map +1 -1
- package/dist/numerical/christoffel-flat.js +3 -2
- package/dist/numerical/christoffel-flat.js.map +1 -1
- package/dist/numerical/covariant-eikonal.d.ts.map +1 -1
- package/dist/numerical/covariant-eikonal.js +34 -11
- package/dist/numerical/covariant-eikonal.js.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.js +3 -2
- package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
- package/dist/numerical/errors.d.ts.map +1 -1
- package/dist/numerical/errors.js +0 -3
- package/dist/numerical/errors.js.map +1 -1
- package/dist/numerical/finite-difference.d.ts +22 -0
- package/dist/numerical/finite-difference.d.ts.map +1 -0
- package/dist/numerical/finite-difference.js +27 -0
- package/dist/numerical/finite-difference.js.map +1 -0
- package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
- package/dist/numerical/geodesic-integrator.js +22 -14
- package/dist/numerical/geodesic-integrator.js.map +1 -1
- package/dist/numerical/geometrized.d.ts.map +1 -1
- package/dist/numerical/geometrized.js +0 -1
- package/dist/numerical/geometrized.js.map +1 -1
- package/dist/numerical/mathts-engine.d.ts.map +1 -1
- package/dist/numerical/mathts-engine.js +10 -24
- 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 +83 -46
- package/dist/numerical/metric-inverse.js.map +1 -1
- package/dist/numerical/null-ray-integrator.d.ts +2 -1
- package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
- package/dist/numerical/null-ray-integrator.js +12 -12
- package/dist/numerical/null-ray-integrator.js.map +1 -1
- package/dist/numerical/painleve-gullstrand-metric.js +2 -2
- package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
- package/dist/numerical/perihelion-finder.d.ts +0 -36
- package/dist/numerical/perihelion-finder.d.ts.map +1 -1
- package/dist/numerical/perihelion-finder.js +41 -87
- package/dist/numerical/perihelion-finder.js.map +1 -1
- package/dist/numerical/quadrature.d.ts.map +1 -1
- package/dist/numerical/quadrature.js +8 -10
- package/dist/numerical/quadrature.js.map +1 -1
- package/dist/numerical/rk4-trajectory.d.ts +10 -0
- package/dist/numerical/rk4-trajectory.d.ts.map +1 -0
- package/dist/numerical/rk4-trajectory.js +37 -0
- package/dist/numerical/rk4-trajectory.js.map +1 -0
- package/dist/numerical/schwarzschild.d.ts +14 -0
- package/dist/numerical/schwarzschild.d.ts.map +1 -0
- package/dist/numerical/schwarzschild.js +17 -0
- package/dist/numerical/schwarzschild.js.map +1 -0
- package/dist/numerical/spacetime-metrics.d.ts +12 -0
- package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
- package/dist/numerical/spacetime-metrics.js +72 -56
- package/dist/numerical/spacetime-metrics.js.map +1 -1
- package/dist/numerical/statistics.d.ts +24 -0
- package/dist/numerical/statistics.d.ts.map +1 -0
- package/dist/numerical/statistics.js +52 -0
- package/dist/numerical/statistics.js.map +1 -0
- package/dist/numerical/tensor-engine.d.ts +21 -0
- package/dist/numerical/tensor-engine.d.ts.map +1 -1
- package/dist/numerical/tensor-engine.js +12 -0
- package/dist/numerical/tensor-engine.js.map +1 -1
- package/dist/relations/regime.d.ts +10 -0
- package/dist/relations/regime.d.ts.map +1 -1
- package/dist/relations/regime.js +18 -1
- package/dist/relations/regime.js.map +1 -1
- package/package.json +7 -7
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EAA8C,KAAK,EAAE,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EAA8C,KAAK,EAAE,EAAE,MAAM,aAAa,CAAC;AAElF,OAAO,qBAAqB,CAAC;AAuB7B;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,GAAE,IAAI,CAAC,EAAE,EAAE,KAAK,CAAa,GAAG,MAAM,CAI3F;AAiBD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,EAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDhF"}
|
package/dist/cli/main.js
CHANGED
|
@@ -37,6 +37,19 @@ function stdoutRaw(s) {
|
|
|
37
37
|
process.stdout.write(s);
|
|
38
38
|
}
|
|
39
39
|
const defaultIo = { out: stdoutLine, err: stderrLine, write: stdoutRaw };
|
|
40
|
+
/** EX_SOFTWARE (sysexits.h): the exit code of a defect, an error `runCli` did not map. */
|
|
41
|
+
const EX_SOFTWARE = 70;
|
|
42
|
+
/**
|
|
43
|
+
* The last-resort handler `bin/upt.mjs` calls when `runCli` rethrows: a defect, since every
|
|
44
|
+
* usage error and value refusal was mapped to an exit code inside `runCli`. Prints one line,
|
|
45
|
+
* `upt: internal error: <message>` (the message, not the stack), and returns 70 (EX_SOFTWARE).
|
|
46
|
+
* A thrown value that is not an Error, or an Error with no message, prints as its string.
|
|
47
|
+
*/
|
|
48
|
+
export function reportInternalError(error, io = defaultIo) {
|
|
49
|
+
const message = error instanceof Error && error.message !== '' ? error.message : String(error);
|
|
50
|
+
io.err(`upt: internal error: ${message}`);
|
|
51
|
+
return EX_SOFTWARE;
|
|
52
|
+
}
|
|
40
53
|
const unknownCommandMessage = (name) => `Unknown command '${name}'. See \`upt help\`.`;
|
|
41
54
|
const GLOBAL_FILE_OPTION = /^--(record|replay|show-record)(?:=(.*))?$/;
|
|
42
55
|
/**
|
|
@@ -127,7 +140,7 @@ async function dispatch(argv, io) {
|
|
|
127
140
|
if (!explainCmd) {
|
|
128
141
|
throw new CliError("upt: the demo needs the 'explain' command, which is not registered yet");
|
|
129
142
|
}
|
|
130
|
-
const explainArgs = parseArgs('explain', ['hawking-temperature', 'mass=1.989e30'], explainCmd.flags);
|
|
143
|
+
const explainArgs = parseArgs('explain', ['hawking-temperature', 'mass=1.989e30'], explainCmd.flags, explainCmd.positionals);
|
|
131
144
|
const explainCtx = { args: explainArgs, api, out, err, write };
|
|
132
145
|
const explainStatus = await explainCmd.run(explainCtx);
|
|
133
146
|
if (explainStatus !== 0)
|
|
@@ -136,7 +149,7 @@ async function dispatch(argv, io) {
|
|
|
136
149
|
if (!priorityCmd) {
|
|
137
150
|
throw new CliError("upt: the demo needs the 'priority' command, which is not registered yet");
|
|
138
151
|
}
|
|
139
|
-
const priorityArgs = parseArgs('priority', [], priorityCmd.flags);
|
|
152
|
+
const priorityArgs = parseArgs('priority', [], priorityCmd.flags, priorityCmd.positionals);
|
|
140
153
|
const priorityCtx = { args: priorityArgs, api, out, err, write };
|
|
141
154
|
return await priorityCmd.run(priorityCtx);
|
|
142
155
|
}
|
|
@@ -183,7 +196,9 @@ async function dispatch(argv, io) {
|
|
|
183
196
|
out(command.help);
|
|
184
197
|
return 0;
|
|
185
198
|
}
|
|
186
|
-
|
|
199
|
+
// The parser refuses a positional past the command's declared arity (none when it
|
|
200
|
+
// declares none), so a token the command would not read never reaches `run`.
|
|
201
|
+
const parsed = parseArgs(command.name, rest, command.flags, command.positionals);
|
|
187
202
|
const ctx = { args: parsed, api, out, err, write };
|
|
188
203
|
return await command.run(ctx);
|
|
189
204
|
}
|
package/dist/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/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CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACzD,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,OAAO,CAAC,CAAC;QACX,CAAC;QAED,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAC5D,MAAM,GAAG,GAAe,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;QAC/D,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,UAAU,EAAE,CAAC;YAC5B,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACf,OAAO,CAAC,CAAC;QACX,CAAC;QACD,IAAI,CAAC,YAAY,QAAQ,EAAE,CAAC;YAC1B,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACf,OAAO,CAAC,CAAC;QACX,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC","sourcesContent":["/**\n * Verb-first dispatcher for the UPT CLI — `upt <command> [args...]`.\n *\n * Owns: top-level `help`/`version` handling, the no-args demo, unknown-verb\n * exit-2 contract, and per-command dispatch (parse -> run -> map thrown\n * UsageError/CliError to the documented exit codes). Individual commands are\n * plain data (see `command.ts`) registered via `registerCommand`; this file\n * never special-cases a command by name, so later tasks add commands without\n * touching `runCli`'s body.\n *\n * `main.ts` is the one place that imports the real `cli-api.js` barrel and\n * wires `out`/`err`/`write` to real stdio — every `Command.run` receives\n * those as an injected `CommandCtx`, never reaching for `process.*` itself,\n * which is what makes commands testable in-process against `dist/cli/*.js`.\n */\n\nimport * as api from '../cli-api.js';\nimport { UsageError, CliError } from './errors.js';\nimport { optionTokens, parseArgs } from './args.js';\nimport { packageVersion } from './version.js';\nimport { glossaryText } from './statuses.js';\nimport { listCommandNames, resolveCommand, type Command, type CommandCtx } from './command.js';\nimport { GLOBAL_FLAGS } from './flag-help.js';\nimport { renderTopLevelHelp } from './top-level-help.js';\nimport { recordInvocation, replayRecord, showRecord, type Io } from './record.js';\n// Side-effect import: registers every ported command (see commands/index.ts).\nimport './commands/index.js';\n\n// `Io` is the writer surface `runCli` needs. In production these wrap\n// `process.stdout`/`process.stderr` with exact `console.log`/`console.error`\n// semantics; tests pass a capturing stand-in as the optional second argument.\n\nfunction stdoutLine(line?: string): void {\n process.stdout.write((line ?? '') + '\\n');\n}\n\nfunction stderrLine(line?: string): void {\n process.stderr.write((line ?? '') + '\\n');\n}\n\nfunction stdoutRaw(s: string): void {\n process.stdout.write(s);\n}\n\nconst defaultIo: Io = { out: stdoutLine, err: stderrLine, write: stdoutRaw };\n\nconst unknownCommandMessage = (name: string): string => `Unknown command '${name}'. See \\`upt help\\`.`;\n\nconst GLOBAL_FILE_OPTION = /^--(record|replay|show-record)(?:=(.*))?$/;\n\n/**\n * Verb-first CLI entry point. `argv` is the command + its arguments (NOT\n * `process.argv` — callers slice off the node/script prefix themselves, as\n * `bin/upt.mjs` did with `process.argv.slice(2)`).\n *\n * Leading `--record=FILE` / `--replay=FILE` / `--show-record=FILE` / `--json`\n * are global options. `--json` is moved onto the command so the command's\n * own flag spec parses it. `upt <command> --help` prints that command.\n */\nconst NO_JSON_VERBS = new Set(['help', '--help', '-h', 'version', '--version', '-v']);\n\nexport async function runCli(argv: string[], io: Io = defaultIo): Promise<number> {\n const files: Partial<Record<'record' | 'replay' | 'show-record', string>> = {};\n let json = false;\n let i = 0;\n try {\n for (; i < argv.length; i++) {\n const m = GLOBAL_FILE_OPTION.exec(argv[i]);\n if (m) {\n const name = m[1] as keyof typeof files;\n if (!m[2]) throw new UsageError(`upt: '--${name}' requires '--${name}=FILE'`);\n if (files[name] !== undefined) throw new UsageError(`upt: '--${name}' given more than once`);\n files[name] = m[2];\n } else if (argv[i] === '--json') {\n if (json) throw new UsageError(`upt: '--json' given more than once`);\n json = true;\n } else {\n break;\n }\n }\n let rest = argv.slice(i);\n if (json && (files.replay !== undefined || files['show-record'] !== undefined)) {\n // `--replay` / `--show-record` consume --json themselves and take no command.\n } else if (json) {\n if (rest.length === 0) throw new UsageError(`upt: '--json' requires a command`);\n const verb = rest[0]!;\n if (NO_JSON_VERBS.has(verb)) throw new UsageError(`upt: '${verb}' does not take --json`);\n rest = [verb, '--json', ...rest.slice(1)];\n }\n if (i === 0 && !json) return await dispatch(argv, io);\n if (Object.keys(files).length > 1) {\n throw new UsageError('upt: use one of --record, --replay and --show-record at a time');\n }\n if (files.record !== undefined) return await recordInvocation(files.record, rest, dispatch, io, api);\n if (files.replay !== undefined || files['show-record'] !== undefined) {\n if (rest.length > 0) {\n throw new UsageError(`upt: '--${files.replay !== undefined ? 'replay' : 'show-record'}' takes no command (got '${rest[0]}')`);\n }\n if (files.replay !== undefined) return await replayRecord(files.replay, json, dispatch, io, api);\n return showRecord(files['show-record']!, json, io);\n }\n return await dispatch(rest, io);\n } catch (e) {\n if (e instanceof UsageError) {\n io.err(e.message);\n return 2;\n }\n if (e instanceof CliError) {\n io.err(e.message);\n return 1;\n }\n throw e;\n }\n}\n\nasync function dispatch(argv: string[], io: Io): Promise<number> {\n const { out, err, write } = io;\n\n try {\n const [cmd, ...rest] = argv;\n\n if (cmd === undefined) {\n // Byte-identical to bin/upt.mjs's `case undefined` (lines 861-865): a\n // banner line, then dispatch to the registered `explain` + `priority`\n // commands with their historical demo arguments.\n out('upt — bridge-inference CLI. Demo (run `upt help` for usage):');\n\n const explainCmd = resolveCommand('explain');\n if (!explainCmd) {\n throw new CliError(\"upt: the demo needs the 'explain' command, which is not registered yet\");\n }\n const explainArgs = parseArgs('explain', ['hawking-temperature', 'mass=1.989e30'], explainCmd.flags);\n const explainCtx: CommandCtx = { args: explainArgs, api, out, err, write };\n const explainStatus = await explainCmd.run(explainCtx);\n if (explainStatus !== 0) return explainStatus;\n\n const priorityCmd = resolveCommand('priority');\n if (!priorityCmd) {\n throw new CliError(\"upt: the demo needs the 'priority' command, which is not registered yet\");\n }\n const priorityArgs = parseArgs('priority', [], priorityCmd.flags);\n const priorityCtx: CommandCtx = { args: priorityArgs, api, out, err, write };\n return await priorityCmd.run(priorityCtx);\n }\n\n if (cmd === 'help' || cmd === '--help' || cmd === '-h') {\n if (rest.length > 1) throw new UsageError('upt help takes at most one command name');\n // `upt help -h` and `upt help --help` ask for the command list, as `upt help` does.\n const target = rest[0] === '--help' || rest[0] === '-h' ? undefined : rest[0];\n if (target === 'statuses') {\n out(glossaryText());\n return 0;\n }\n if (target !== undefined) {\n const command = resolveCommand(target);\n if (!command) throw new UsageError(unknownCommandMessage(target));\n out(command.help);\n return 0;\n }\n const commands: Command[] = [];\n for (const name of listCommandNames()) {\n const command = resolveCommand(name);\n if (command !== undefined) commands.push(command);\n }\n out(renderTopLevelHelp(commands, GLOBAL_FLAGS));\n return 0;\n }\n\n if (cmd === 'version' || cmd === '--version' || cmd === '-v') {\n if (rest.length > 0) throw new UsageError('upt version takes no arguments');\n out(packageVersion());\n return 0;\n }\n\n const command = resolveCommand(cmd);\n if (!command) {\n err(unknownCommandMessage(cmd));\n return 2;\n }\n\n // `-h` is `--help` on every command, as the global help says. A token after a\n // bare `--` is a positional, so it is not read as the help request.\n const options = optionTokens(rest);\n if (options.includes('--help') || options.includes('-h')) {\n out(command.help);\n return 0;\n }\n\n const parsed = parseArgs(command.name, rest, command.flags);\n const ctx: CommandCtx = { args: parsed, api, out, err, write };\n return await command.run(ctx);\n } catch (e) {\n if (e instanceof UsageError) {\n err(e.message);\n return 2;\n }\n if (e instanceof CliError) {\n err(e.message);\n return 1;\n }\n throw e;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,GAAG,MAAM,eAA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: top-level `help`/`version` handling, the no-args demo, unknown-verb\n * exit-2 contract, and per-command dispatch (parse -> run -> map thrown\n * UsageError/CliError to the documented exit codes). Individual commands are\n * plain data (see `command.ts`) registered via `registerCommand`; this file\n * never special-cases a command by name, so later tasks add commands without\n * touching `runCli`'s body.\n *\n * `main.ts` is the one place that imports the real `cli-api.js` barrel and\n * wires `out`/`err`/`write` to real stdio — every `Command.run` receives\n * those as an injected `CommandCtx`, never reaching for `process.*` itself,\n * which is what makes commands testable in-process against `dist/cli/*.js`.\n */\n\nimport * as api from '../cli-api.js';\nimport { UsageError, CliError } from './errors.js';\nimport { optionTokens, parseArgs } from './args.js';\nimport { packageVersion } from './version.js';\nimport { glossaryText } from './statuses.js';\nimport { listCommandNames, resolveCommand, type Command, type CommandCtx } from './command.js';\nimport { GLOBAL_FLAGS } from './flag-help.js';\nimport { renderTopLevelHelp } from './top-level-help.js';\nimport { recordInvocation, replayRecord, showRecord, type Io } from './record.js';\n// Side-effect import: registers every ported command (see commands/index.ts).\nimport './commands/index.js';\n\n// `Io` is the writer surface `runCli` needs. In production these wrap\n// `process.stdout`/`process.stderr` with exact `console.log`/`console.error`\n// semantics; tests pass a capturing stand-in as the optional second argument.\n\nfunction stdoutLine(line?: string): void {\n process.stdout.write((line ?? '') + '\\n');\n}\n\nfunction stderrLine(line?: string): void {\n process.stderr.write((line ?? '') + '\\n');\n}\n\nfunction stdoutRaw(s: string): void {\n process.stdout.write(s);\n}\n\nconst defaultIo: Io = { out: stdoutLine, err: stderrLine, write: stdoutRaw };\n\n/** EX_SOFTWARE (sysexits.h): the exit code of a defect, an error `runCli` did not map. */\nconst EX_SOFTWARE = 70;\n\n/**\n * The last-resort handler `bin/upt.mjs` calls when `runCli` rethrows: a defect, since every\n * usage error and value refusal was mapped to an exit code inside `runCli`. Prints one line,\n * `upt: internal error: <message>` (the message, not the stack), and returns 70 (EX_SOFTWARE).\n * A thrown value that is not an Error, or an Error with no message, prints as its string.\n */\nexport function reportInternalError(error: unknown, io: Pick<Io, 'err'> = defaultIo): number {\n const message = error instanceof Error && error.message !== '' ? error.message : String(error);\n io.err(`upt: internal error: ${message}`);\n return EX_SOFTWARE;\n}\n\nconst unknownCommandMessage = (name: string): string => `Unknown command '${name}'. See \\`upt help\\`.`;\n\nconst GLOBAL_FILE_OPTION = /^--(record|replay|show-record)(?:=(.*))?$/;\n\n/**\n * Verb-first CLI entry point. `argv` is the command + its arguments (NOT\n * `process.argv` — callers slice off the node/script prefix themselves, as\n * `bin/upt.mjs` did with `process.argv.slice(2)`).\n *\n * Leading `--record=FILE` / `--replay=FILE` / `--show-record=FILE` / `--json`\n * are global options. `--json` is moved onto the command so the command's\n * own flag spec parses it. `upt <command> --help` prints that command.\n */\nconst NO_JSON_VERBS = new Set(['help', '--help', '-h', 'version', '--version', '-v']);\n\nexport async function runCli(argv: string[], io: Io = defaultIo): Promise<number> {\n const files: Partial<Record<'record' | 'replay' | 'show-record', string>> = {};\n let json = false;\n let i = 0;\n try {\n for (; i < argv.length; i++) {\n const m = GLOBAL_FILE_OPTION.exec(argv[i]);\n if (m) {\n const name = m[1] as keyof typeof files;\n if (!m[2]) throw new UsageError(`upt: '--${name}' requires '--${name}=FILE'`);\n if (files[name] !== undefined) throw new UsageError(`upt: '--${name}' given more than once`);\n files[name] = m[2];\n } else if (argv[i] === '--json') {\n if (json) throw new UsageError(`upt: '--json' given more than once`);\n json = true;\n } else {\n break;\n }\n }\n let rest = argv.slice(i);\n if (json && (files.replay !== undefined || files['show-record'] !== undefined)) {\n // `--replay` / `--show-record` consume --json themselves and take no command.\n } else if (json) {\n if (rest.length === 0) throw new UsageError(`upt: '--json' requires a command`);\n const verb = rest[0]!;\n if (NO_JSON_VERBS.has(verb)) throw new UsageError(`upt: '${verb}' does not take --json`);\n rest = [verb, '--json', ...rest.slice(1)];\n }\n if (i === 0 && !json) return await dispatch(argv, io);\n if (Object.keys(files).length > 1) {\n throw new UsageError('upt: use one of --record, --replay and --show-record at a time');\n }\n if (files.record !== undefined) return await recordInvocation(files.record, rest, dispatch, io, api);\n if (files.replay !== undefined || files['show-record'] !== undefined) {\n if (rest.length > 0) {\n throw new UsageError(`upt: '--${files.replay !== undefined ? 'replay' : 'show-record'}' takes no command (got '${rest[0]}')`);\n }\n if (files.replay !== undefined) return await replayRecord(files.replay, json, dispatch, io, api);\n return showRecord(files['show-record']!, json, io);\n }\n return await dispatch(rest, io);\n } catch (e) {\n if (e instanceof UsageError) {\n io.err(e.message);\n return 2;\n }\n if (e instanceof CliError) {\n io.err(e.message);\n return 1;\n }\n throw e;\n }\n}\n\nasync function dispatch(argv: string[], io: Io): Promise<number> {\n const { out, err, write } = io;\n\n try {\n const [cmd, ...rest] = argv;\n\n if (cmd === undefined) {\n // Byte-identical to bin/upt.mjs's `case undefined` (lines 861-865): a\n // banner line, then dispatch to the registered `explain` + `priority`\n // commands with their historical demo arguments.\n out('upt — bridge-inference CLI. Demo (run `upt help` for usage):');\n\n const explainCmd = resolveCommand('explain');\n if (!explainCmd) {\n throw new CliError(\"upt: the demo needs the 'explain' command, which is not registered yet\");\n }\n const explainArgs = parseArgs('explain', ['hawking-temperature', 'mass=1.989e30'], explainCmd.flags, explainCmd.positionals);\n const explainCtx: CommandCtx = { args: explainArgs, api, out, err, write };\n const explainStatus = await explainCmd.run(explainCtx);\n if (explainStatus !== 0) return explainStatus;\n\n const priorityCmd = resolveCommand('priority');\n if (!priorityCmd) {\n throw new CliError(\"upt: the demo needs the 'priority' command, which is not registered yet\");\n }\n const priorityArgs = parseArgs('priority', [], priorityCmd.flags, priorityCmd.positionals);\n const priorityCtx: CommandCtx = { args: priorityArgs, api, out, err, write };\n return await priorityCmd.run(priorityCtx);\n }\n\n if (cmd === 'help' || cmd === '--help' || cmd === '-h') {\n if (rest.length > 1) throw new UsageError('upt help takes at most one command name');\n // `upt help -h` and `upt help --help` ask for the command list, as `upt help` does.\n const target = rest[0] === '--help' || rest[0] === '-h' ? undefined : rest[0];\n if (target === 'statuses') {\n out(glossaryText());\n return 0;\n }\n if (target !== undefined) {\n const command = resolveCommand(target);\n if (!command) throw new UsageError(unknownCommandMessage(target));\n out(command.help);\n return 0;\n }\n const commands: Command[] = [];\n for (const name of listCommandNames()) {\n const command = resolveCommand(name);\n if (command !== undefined) commands.push(command);\n }\n out(renderTopLevelHelp(commands, GLOBAL_FLAGS));\n return 0;\n }\n\n if (cmd === 'version' || cmd === '--version' || cmd === '-v') {\n if (rest.length > 0) throw new UsageError('upt version takes no arguments');\n out(packageVersion());\n return 0;\n }\n\n const command = resolveCommand(cmd);\n if (!command) {\n err(unknownCommandMessage(cmd));\n return 2;\n }\n\n // `-h` is `--help` on every command, as the global help says. A token after a\n // bare `--` is a positional, so it is not read as the help request.\n const options = optionTokens(rest);\n if (options.includes('--help') || options.includes('-h')) {\n out(command.help);\n return 0;\n }\n\n // The parser refuses a positional past the command's declared arity (none when it\n // declares none), so a token the command would not read never reaches `run`.\n const parsed = parseArgs(command.name, rest, command.flags, command.positionals);\n const ctx: CommandCtx = { args: parsed, api, out, err, write };\n return await command.run(ctx);\n } catch (e) {\n if (e instanceof UsageError) {\n err(e.message);\n return 2;\n }\n if (e instanceof CliError) {\n err(e.message);\n return 1;\n }\n throw e;\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The integer a flag was given, or a `UsageError` naming the flag and the token.
|
|
3
|
+
* `command` is the command word for the message (`''` for an option of upt itself);
|
|
4
|
+
* `label` names the flag (`--max-routes`, or `--sweep sample count` for one field of a value).
|
|
5
|
+
*/
|
|
6
|
+
export declare function integerFlag(command: string, label: string, raw: string): number;
|
|
7
|
+
/**
|
|
8
|
+
* The real number a flag was given, or a `UsageError` naming the flag and the token. The
|
|
9
|
+
* arguments are {@link integerFlag}'s. An exponent is a decimal form (`1e-3`); hex is not.
|
|
10
|
+
*/
|
|
11
|
+
export declare function realFlag(command: string, label: string, raw: string): number;
|
|
12
|
+
//# sourceMappingURL=numeric-flag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric-flag.d.ts","sourceRoot":"","sources":["../../src/cli/numeric-flag.ts"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAO/E;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAO5E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one reader of a numeric flag value for the UPT CLI.
|
|
3
|
+
*
|
|
4
|
+
* `Number()` accepts hex (`0x10`), binary, octal, an exponent on an integer (`1e1`), and reads
|
|
5
|
+
* `''` and whitespace as 0, so a flag read through it took a value the user did not type
|
|
6
|
+
* (`upt map --max-routes=0x10` ran with 16). An integer flag is digits with an optional sign; a
|
|
7
|
+
* real flag is a decimal with an optional fraction and exponent, the AST's one literal rule
|
|
8
|
+
* (`DECIMAL_LITERAL`, `src/dimensional/ast-leaves.ts`). A token outside the grammar is
|
|
9
|
+
* a malformed invocation (`UsageError`, exit 2) naming the flag and the token; a well-formed
|
|
10
|
+
* value outside the flag's range is the command's own value refusal (exit 1), judged after.
|
|
11
|
+
*
|
|
12
|
+
* @module cli/numeric-flag
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
import { DECIMAL_LITERAL } from '../dimensional/ast-leaves.js';
|
|
16
|
+
import { UsageError } from './errors.js';
|
|
17
|
+
/** `3`, `-2`, `+7`, `010`: digits with an optional sign, nothing else. */
|
|
18
|
+
const INTEGER = /^[+-]?\d+$/;
|
|
19
|
+
/** The help pointer, worded as the parser's unknown-flag message words it. */
|
|
20
|
+
function hint(command) {
|
|
21
|
+
return command === '' ? 'see upt help' : `see upt help ${command.split(' ')[0]}`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The integer a flag was given, or a `UsageError` naming the flag and the token.
|
|
25
|
+
* `command` is the command word for the message (`''` for an option of upt itself);
|
|
26
|
+
* `label` names the flag (`--max-routes`, or `--sweep sample count` for one field of a value).
|
|
27
|
+
*/
|
|
28
|
+
export function integerFlag(command, label, raw) {
|
|
29
|
+
if (!INTEGER.test(raw)) {
|
|
30
|
+
throw new UsageError(`upt${command === '' ? '' : ` ${command}`}: ${label} '${raw}' is not an integer (digits only, such as 3 or -2; ${hint(command)})`);
|
|
31
|
+
}
|
|
32
|
+
return Number(raw);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The real number a flag was given, or a `UsageError` naming the flag and the token. The
|
|
36
|
+
* arguments are {@link integerFlag}'s. An exponent is a decimal form (`1e-3`); hex is not.
|
|
37
|
+
*/
|
|
38
|
+
export function realFlag(command, label, raw) {
|
|
39
|
+
if (!DECIMAL_LITERAL.test(raw)) {
|
|
40
|
+
throw new UsageError(`upt${command === '' ? '' : ` ${command}`}: ${label} '${raw}' is not a number (a decimal such as 2, 0.5 or 1e-3; ${hint(command)})`);
|
|
41
|
+
}
|
|
42
|
+
return Number(raw);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=numeric-flag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric-flag.js","sourceRoot":"","sources":["../../src/cli/numeric-flag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,0EAA0E;AAC1E,MAAM,OAAO,GAAG,YAAY,CAAC;AAE7B,8EAA8E;AAC9E,SAAS,IAAI,CAAC,OAAe;IAC3B,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,gBAAgB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,KAAa,EAAE,GAAW;IACrE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,UAAU,CAClB,MAAM,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,KAAK,KAAK,KAAK,GAAG,sDAAsD,IAAI,CAAC,OAAO,CAAC,GAAG,CAClI,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE,KAAa,EAAE,GAAW;IAClE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,UAAU,CAClB,MAAM,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,KAAK,KAAK,KAAK,GAAG,wDAAwD,IAAI,CAAC,OAAO,CAAC,GAAG,CACpI,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC","sourcesContent":["/**\n * The one reader of a numeric flag value for the UPT CLI.\n *\n * `Number()` accepts hex (`0x10`), binary, octal, an exponent on an integer (`1e1`), and reads\n * `''` and whitespace as 0, so a flag read through it took a value the user did not type\n * (`upt map --max-routes=0x10` ran with 16). An integer flag is digits with an optional sign; a\n * real flag is a decimal with an optional fraction and exponent, the AST's one literal rule\n * (`DECIMAL_LITERAL`, `src/dimensional/ast-leaves.ts`). A token outside the grammar is\n * a malformed invocation (`UsageError`, exit 2) naming the flag and the token; a well-formed\n * value outside the flag's range is the command's own value refusal (exit 1), judged after.\n *\n * @module cli/numeric-flag\n * @internal\n */\nimport { DECIMAL_LITERAL } from '../dimensional/ast-leaves.js';\nimport { UsageError } from './errors.js';\n\n/** `3`, `-2`, `+7`, `010`: digits with an optional sign, nothing else. */\nconst INTEGER = /^[+-]?\\d+$/;\n\n/** The help pointer, worded as the parser's unknown-flag message words it. */\nfunction hint(command: string): string {\n return command === '' ? 'see upt help' : `see upt help ${command.split(' ')[0]}`;\n}\n\n/**\n * The integer a flag was given, or a `UsageError` naming the flag and the token.\n * `command` is the command word for the message (`''` for an option of upt itself);\n * `label` names the flag (`--max-routes`, or `--sweep sample count` for one field of a value).\n */\nexport function integerFlag(command: string, label: string, raw: string): number {\n if (!INTEGER.test(raw)) {\n throw new UsageError(\n `upt${command === '' ? '' : ` ${command}`}: ${label} '${raw}' is not an integer (digits only, such as 3 or -2; ${hint(command)})`,\n );\n }\n return Number(raw);\n}\n\n/**\n * The real number a flag was given, or a `UsageError` naming the flag and the token. The\n * arguments are {@link integerFlag}'s. An exponent is a decimal form (`1e-3`); hex is not.\n */\nexport function realFlag(command: string, label: string, raw: string): number {\n if (!DECIMAL_LITERAL.test(raw)) {\n throw new UsageError(\n `upt${command === '' ? '' : ` ${command}`}: ${label} '${raw}' is not a number (a decimal such as 2, 0.5 or 1e-3; ${hint(command)})`,\n );\n }\n return Number(raw);\n}\n"]}
|
package/dist/cli/output.d.ts
CHANGED
|
@@ -7,7 +7,27 @@
|
|
|
7
7
|
* deep-copies a value into a JSON-safe shape first, encoding NaN/Infinity
|
|
8
8
|
* as explicit strings so round-tripping through JSON preserves them.
|
|
9
9
|
*/
|
|
10
|
+
import { UsageError, type CliError } from './errors.js';
|
|
10
11
|
import type { AnchorScope } from './graphs.js';
|
|
12
|
+
/**
|
|
13
|
+
* The `--json` form of a refusal: no `result`; the error's kind (`usage` for a malformed
|
|
14
|
+
* invocation, `value` for a value the command refuses), the exit code the process returns,
|
|
15
|
+
* and the message the text mode prints on stderr.
|
|
16
|
+
*/
|
|
17
|
+
export interface JsonErrorEnvelope {
|
|
18
|
+
command: string;
|
|
19
|
+
error: {
|
|
20
|
+
kind: 'usage' | 'value';
|
|
21
|
+
exitCode: 1 | 2;
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Write a refusal as a JSON envelope on stdout and return the exit code it stands for: 2 for a
|
|
27
|
+
* `UsageError`, 1 for a `CliError`. A command that answers in JSON calls this instead of
|
|
28
|
+
* letting the dispatcher print the message on stderr, so a JSON consumer reads one stream.
|
|
29
|
+
*/
|
|
30
|
+
export declare function emitJsonError(command: string, e: UsageError | CliError, write?: (s: string) => void): 1 | 2;
|
|
11
31
|
/** The shape of every `--json` output: the command, what it read, and its result. */
|
|
12
32
|
export interface JsonEnvelope {
|
|
13
33
|
command: string;
|
package/dist/cli/output.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,qFAAqF;AACrF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;IACpD,4GAA4G;IAC5G,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,gHAAgH;IAChH,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,4GAA4G;IAC5G,wBAAwB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,C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OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,gHAAgH;IAChH,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,4GAA4G;IAC5G,wBAAwB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClE;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CA2C5C;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAqC,GAAG,IAAI,CAK7G"}
|
package/dist/cli/output.js
CHANGED
|
@@ -8,6 +8,21 @@
|
|
|
8
8
|
* as explicit strings so round-tripping through JSON preserves them.
|
|
9
9
|
*/
|
|
10
10
|
import { definitionsFor } from './statuses.js';
|
|
11
|
+
import { UsageError } from './errors.js';
|
|
12
|
+
/**
|
|
13
|
+
* Write a refusal as a JSON envelope on stdout and return the exit code it stands for: 2 for a
|
|
14
|
+
* `UsageError`, 1 for a `CliError`. A command that answers in JSON calls this instead of
|
|
15
|
+
* letting the dispatcher print the message on stderr, so a JSON consumer reads one stream.
|
|
16
|
+
*/
|
|
17
|
+
export function emitJsonError(command, e, write = (s) => process.stdout.write(s)) {
|
|
18
|
+
const usage = e instanceof UsageError;
|
|
19
|
+
const envelope = {
|
|
20
|
+
command,
|
|
21
|
+
error: { kind: usage ? 'usage' : 'value', exitCode: usage ? 2 : 1, message: e.message },
|
|
22
|
+
};
|
|
23
|
+
write(JSON.stringify(envelope, null, 2) + '\n');
|
|
24
|
+
return envelope.error.exitCode;
|
|
25
|
+
}
|
|
11
26
|
export function sanitize(v) {
|
|
12
27
|
if (typeof v === 'number') {
|
|
13
28
|
if (Number.isNaN(v))
|
package/dist/cli/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAiB,MAAM,aAAa,CAAC;AAaxD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAe,EACf,CAAwB,EACxB,KAAK,GAAwB,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAE3D,MAAM,KAAK,GAAG,CAAC,YAAY,UAAU,CAAC;IACtC,MAAM,QAAQ,GAAsB;QAClC,OAAO;QACP,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;KACxF,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAChD,OAAO,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;AACjC,CAAC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B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,UAAU;gBAAE,SAAS;YACjE,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAiB,EAAE,KAAK,GAAwB,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACrG,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC;IAChC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAC1F,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACxD,CAAC","sourcesContent":["/**\n * JSON output envelope for the UPT CLI.\n *\n * Physics results genuinely contain non-finite numbers (e.g. `anchoring:\n * Infinity` in the priority board). `JSON.stringify` silently turns those\n * into `null`, which is indistinguishable from an absent value. `sanitize`\n * deep-copies a value into a JSON-safe shape first, encoding NaN/Infinity\n * as explicit strings so round-tripping through JSON preserves them.\n */\n\nimport { definitionsFor } from './statuses.js';\nimport { UsageError, type CliError } from './errors.js';\nimport type { AnchorScope } from './graphs.js';\n\n/**\n * The `--json` form of a refusal: no `result`; the error's kind (`usage` for a malformed\n * invocation, `value` for a value the command refuses), the exit code the process returns,\n * and the message the text mode prints on stderr.\n */\nexport interface JsonErrorEnvelope {\n command: string;\n error: { kind: 'usage' | 'value'; exitCode: 1 | 2; message: string };\n}\n\n/**\n * Write a refusal as a JSON envelope on stdout and return the exit code it stands for: 2 for a\n * `UsageError`, 1 for a `CliError`. A command that answers in JSON calls this instead of\n * letting the dispatcher print the message on stderr, so a JSON consumer reads one stream.\n */\nexport function emitJsonError(\n command: string,\n e: UsageError | CliError,\n write: (s: string) => void = (s) => process.stdout.write(s),\n): 1 | 2 {\n const usage = e instanceof UsageError;\n const envelope: JsonErrorEnvelope = {\n command,\n error: { kind: usage ? 'usage' : 'value', exitCode: usage ? 2 : 1, message: e.message },\n };\n write(JSON.stringify(envelope, null, 2) + '\\n');\n return envelope.error.exitCode;\n}\n\n/** The shape of every `--json` output: the command, what it read, and its result. */\nexport interface JsonEnvelope {\n command: string;\n /**\n * The graph a command read. `'atlas'` is `upt map --route` / `--family`,\n * which read the atlas families rather than an equation graph.\n */\n source?: 'catalog' | 'canonical' | 'both' | 'atlas';\n /** What the result is anchored to (audit I3): the discovery ground truth, the established core, or both. */\n anchor?: AnchorScope;\n options?: Record<string, unknown>;\n epistemics?: string;\n /** `upt confront` — count of confrontations by rigor tier (stringent/moderate/loose). */\n rigorDistribution?: Record<string, number>;\n /** `upt confront` — count of confrontations by statistical object (σ-test, limit, consistency ratio, table). */\n statisticDistribution?: Record<string, number>;\n /** `upt confront` — preprocessing and independence counts, recorded vs not recorded, each counted apart. */\n dataHandlingDistribution?: Record<string, Record<string, number>>;\n /**\n * The meaning of each status the command can emit, from STATUS_GLOSSARY (audit I13). `emitJson`\n * fills it in; a command never sets it.\n */\n definitions?: Record<string, string>;\n result: unknown;\n /**\n * `upt recover` — two-edge symbolic chains examined against the canonical\n * registry, and the structural matches. A chain is never restates-canonical.\n */\n compositionRecovery?: unknown;\n}\n\nexport function sanitize(v: unknown): unknown {\n if (typeof v === 'number') {\n if (Number.isNaN(v)) return 'NaN';\n if (v === Infinity) return 'Infinity';\n if (v === -Infinity) return '-Infinity';\n return v;\n }\n\n if (typeof v === 'function') {\n // Caller decides how to represent \"no value here\" (omit vs. null) based\n // on context (object key vs. array slot); signal via undefined and let\n // the array/object branches below handle it.\n return undefined;\n }\n\n if (Array.isArray(v)) {\n const out: unknown[] = [];\n for (const item of v) {\n const sanitized = sanitize(item);\n out.push(typeof item === 'function' ? null : sanitized);\n }\n return out;\n }\n\n if (v instanceof Map) {\n const out: Record<string, unknown> = {};\n for (const [key, value] of v) {\n if (typeof value === 'function') continue;\n out[String(key)] = sanitize(value);\n }\n return out;\n }\n\n if (v !== null && typeof v === 'object') {\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(v)) {\n if (value === undefined || typeof value === 'function') continue;\n out[key] = sanitize(value);\n }\n return out;\n }\n\n return v;\n}\n\nexport function emitJson(env: JsonEnvelope, write: (s: string) => void = (s) => process.stdout.write(s)): void {\n const definitions = definitionsFor(env.command);\n const { result, ...head } = env;\n const full = Object.keys(definitions).length > 0 ? { ...head, definitions, result } : env;\n write(JSON.stringify(sanitize(full), null, 2) + '\\n');\n}\n"]}
|
package/dist/cli/record-reach.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* The same import graph gives the modules the command loads. Each one's source is hashed, so a
|
|
19
19
|
* change to a literal a module keeps private, which no constant table holds, is still named.
|
|
20
20
|
*/
|
|
21
|
-
import {
|
|
21
|
+
import { sha256Hex } from '../core/hash.js';
|
|
22
22
|
import { existsSync, readFileSync } from 'node:fs';
|
|
23
23
|
import { dirname, join, resolve, sep } from 'node:path';
|
|
24
24
|
import { MODULE_EXT, SOURCE_ROOT, tableName } from './record-tables.js';
|
|
@@ -157,7 +157,7 @@ function loadedModules(command) {
|
|
|
157
157
|
*/
|
|
158
158
|
export function sourceHash(file) {
|
|
159
159
|
try {
|
|
160
|
-
return
|
|
160
|
+
return sha256Hex(readFileSync(file));
|
|
161
161
|
}
|
|
162
162
|
catch (e) {
|
|
163
163
|
const code = e instanceof Error && 'code' in e && typeof e.code === 'string' ? e.code : 'error';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-reach.js","sourceRoot":"","sources":["../../src/cli/record-reach.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AAExF,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAC;AA2BlD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;AACzC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAU,EAAE;IACpC,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzB,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACpB,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/B,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,SAAS,WAAW,CAAC,IAAY,EAAE,IAAY;IAC7C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,IAAI,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACxC,IAAI,UAAU,KAAK,KAAK;QAAE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,E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AE,EAAE,CAAC,KAAK,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5G,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1G,CAAC;IACD,MAAM,WAAW,GAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAChF,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAChC,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Static attribution for an experiment record: which constants a command's code can reach\n * (design: `docs/planning/Experiment-Record-Replay-Design-Note.md`).\n *\n * The reach is derived from the import graph of the modules as they are on disk when the entry is\n * recorded, not declared by hand and not observed while the command runs. It is an UPPER BOUND:\n *\n * - from `cli/commands/<command>` every relative static and literal dynamic import is followed;\n * - a `cli/` module reaches the `cli-api` barrel through `ctx.api`, not through an import, so every\n * barrel export whose name occurs as a word in a reached `cli/` module adds its source module;\n * - a named export of a module-exports table is reached when a reached module imports it by name\n * or by namespace, re-exports it, or the table's own module mentions it outside its declaration;\n * - an object table is reached whole (`*`) when its module is reached.\n *\n * Comments and strings are not stripped, so a name mentioned only in a comment counts as reached:\n * that errs toward \"reachable\", never toward \"not reachable\".\n *\n * The same import graph gives the modules the command loads. Each one's source is hashed, so a\n * change to a literal a module keeps private, which no constant table holds, is still named.\n */\n\nimport { createHash } from 'node:crypto';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve, sep } from 'node:path';\nimport { MODULE_EXT, SOURCE_ROOT, tableName, type TableKind } from './record-tables.js';\n\nexport const REACH_METHOD = 'static-import-reach';\n\n/** The constant-table keys and module sources a recorded command can reach, by static import reach (it errs toward reachable). */\nexport interface Attribution {\n method: typeof REACH_METHOD;\n command: string;\n /** Table name -> the keys the command's code can reach, or `['*']` for the whole table. */\n tables: Record<string, string[]>;\n /**\n * Module name (as a table is named) -> SHA-256 of its source, for every module the command\n * loads. Absent from entries written before module sources were hashed.\n */\n modules?: Record<string, string>;\n}\n\n/** A reached module reads `names` of `file`, `*` for all of them. */\ninterface Read {\n file: string;\n names: string[] | '*';\n}\n\n/** `file` re-exports: `pairs` as `[exported, original]` (`original` `*` for a namespace), or everything. */\ninterface Reexport {\n file: string;\n pairs: [string, string][] | '*';\n}\n\nconst source = new Map<string, string>();\nconst read = (file: string): string => {\n let s = source.get(file);\n if (s === undefined) {\n s = readFileSync(file, 'utf8');\n source.set(file, s);\n }\n return s;\n};\n\nfunction resolveSpec(from: string, spec: string): string | null {\n if (!spec.startsWith('.')) return null;\n let file = resolve(dirname(from), spec);\n if (MODULE_EXT !== '.js') file = file.replace(/\\.js$/, MODULE_EXT);\n return existsSync(file) ? file : null;\n}\n\n/** `[exported-or-local, original]` for each value binding of an import or export clause. */\nfunction clausePairs(clause: string): [string, string][] | '*' {\n const ns = /\\*\\s*as\\s+([\\w$]+)/.exec(clause);\n if (ns) return [[ns[1], '*']];\n if (/^\\s*\\*\\s*$/.test(clause)) return '*';\n const pairs: [string, string][] = [];\n const braces = /\\{([^}]*)\\}/.exec(clause);\n if (braces) {\n for (const part of braces[1].split(',')) {\n const m = /^\\s*(type\\s+)?([\\w$]+)(?:\\s+as\\s+([\\w$]+))?/.exec(part);\n if (m && !m[1]) pairs.push([m[3] ?? m[2], m[2]]);\n }\n }\n const def = /^\\s*([\\w$]+)\\s*(,|$)/.exec(clause);\n if (def && def[1] !== 'type') pairs.push([def[1], 'default']);\n return pairs;\n}\n\nconst STATIC_FROM = /\\b(import|export)\\s+(type\\s+)?([^'\";]*?)\\s*from\\s*['\"]([^'\"]+)['\"]/g;\nconst SIDE_EFFECT = /\\bimport\\s*['\"]([^'\"]+)['\"]/g;\nconst DYNAMIC = /\\bimport\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g;\n\nconst parsed = new Map<string, { reads: Read[]; reexports: Reexport[] }>();\n\nfunction edges(file: string): { reads: Read[]; reexports: Reexport[] } {\n const hit = parsed.get(file);\n if (hit) return hit;\n const text = read(file);\n const reads: Read[] = [];\n const reexports: Reexport[] = [];\n for (const m of text.matchAll(STATIC_FROM)) {\n if (m[2]) continue;\n const target = resolveSpec(file, m[4]);\n if (!target) continue;\n const pairs = clausePairs(m[3]);\n if (m[1] === 'export') reexports.push({ file: target, pairs });\n else reads.push({ file: target, names: pairs === '*' || pairs.some(([, o]) => o === '*') ? '*' : pairs.map(([, o]) => o) });\n }\n for (const m of text.matchAll(SIDE_EFFECT)) {\n const target = resolveSpec(file, m[1]);\n if (target) reads.push({ file: target, names: [] });\n }\n for (const m of text.matchAll(DYNAMIC)) {\n const target = resolveSpec(file, m[1]);\n if (target) reads.push({ file: target, names: '*' });\n }\n const out = { reads, reexports };\n parsed.set(file, out);\n return out;\n}\n\nconst words = (text: string): Set<string> => new Set(text.match(/[A-Za-z_$][\\w$]*/g) ?? []);\n\n/** What a `cli/` module reaches through `ctx.api`: each `cli-api` export whose name occurs in it. */\nfunction apiReads(file: string): Read[] {\n const barrel = join(SOURCE_ROOT, `cli-api${MODULE_EXT}`);\n const w = words(read(file));\n const out: Read[] = [];\n for (const re of edges(barrel).reexports) {\n if (re.pairs === '*') out.push({ file: re.file, names: '*' });\n else for (const [exported, original] of re.pairs) if (w.has(exported)) out.push({ file: re.file, names: original === '*' ? '*' : [original] });\n }\n return out;\n}\n\n/** Comments that open a line: outside a multi-line template literal a line cannot begin code with\n * `/*` or `//`, so no code is removed. A comment after code stays, which errs toward \"reachable\". */\nconst withoutLeadingComments = (text: string): string =>\n text.replace(/^[ \\t]*\\/\\*[\\s\\S]*?\\*\\//gm, '').replace(/^[ \\t]*\\/\\/.*$/gm, '');\n\nconst mentions = (text: string, name: string): number =>\n text.match(new RegExp(`(?<![\\\\w$])${name.replace(/\\$/g, '\\\\$')}(?![\\\\w$])`, 'g'))?.length ?? 0;\n\nconst cache = new Map<string, Attribution | null>();\nconst loadedCache = new Map<string, { loaded: Set<string>; directReads: Read[] } | null>();\n\n/** Every module `command` loads, and what each reads, or null when the command has no module. */\nfunction loadedModules(command: string): { loaded: Set<string>; directReads: Read[] } | null {\n if (loadedCache.has(command)) return loadedCache.get(command)!;\n const seed = join(SOURCE_ROOT, 'cli', 'commands', `${command}${MODULE_EXT}`);\n if (!existsSync(seed)) {\n loadedCache.set(command, null);\n return null;\n }\n const cliDir = join(SOURCE_ROOT, 'cli') + sep;\n\n // Modules loaded: every import and re-export is followed, since loading runs top-level code.\n const loaded = new Set<string>();\n const directReads: Read[] = [];\n const queue = [seed];\n while (queue.length > 0) {\n const file = queue.pop()!;\n if (loaded.has(file)) continue;\n loaded.add(file);\n const { reads, reexports } = edges(file);\n const all = file.startsWith(cliDir) ? [...reads, ...apiReads(file)] : reads;\n directReads.push(...all);\n for (const t of [...all.map((r) => r.file), ...reexports.map((r) => r.file)]) if (!loaded.has(t)) queue.push(t);\n }\n const out = { loaded, directReads };\n loadedCache.set(command, out);\n return out;\n}\n\n/**\n * SHA-256 of one module's source. The module was found when the import graph was walked, so a\n * failed read is not \"absent\": the value keeps which kind of failure it was (`unreadable (EACCES)`,\n * `unreadable (EISDIR)`, ...), not one word for all of them.\n */\nexport function sourceHash(file: string): string {\n try {\n return createHash('sha256').update(readFileSync(file)).digest('hex');\n } catch (e) {\n const code = e instanceof Error && 'code' in e && typeof e.code === 'string' ? e.code : 'error';\n return `unreadable (${code})`;\n }\n}\n\n/**\n * SHA-256 of the source of every module `command` loads, keyed by module name, read from disk now\n * (not from the parse cache), or null when the command has no module of its own.\n */\nexport function moduleSources(command: string): Record<string, string> | null {\n const mods = loadedModules(command);\n if (!mods) return null;\n const out: Record<string, string> = {};\n for (const file of [...mods.loaded].sort()) out[tableName(file)] = sourceHash(file);\n return out;\n}\n\n/** The reach of `command`'s code into `tables`, or null when the command has no module of its own. */\nexport function staticReach(\n command: string,\n tables: Record<string, { values: Record<string, unknown> }>,\n kinds: Record<string, TableKind>,\n): Attribution | null {\n if (cache.has(command)) return cache.get(command)!;\n const mods = loadedModules(command);\n if (!mods) {\n cache.set(command, null);\n return null;\n }\n const { loaded, directReads } = mods;\n\n // Names read: an import reads its names; a re-export passes on only the names read from it.\n const namesOf = new Map<string, Set<string> | '*'>();\n const mark = (file: string, names: string[] | '*'): void => {\n const prev = namesOf.get(file) ?? new Set<string>();\n if (prev === '*') return;\n const fresh = names === '*' ? ['*'] : names.filter((n) => !prev.has(n));\n if (fresh.length === 0) {\n namesOf.set(file, prev);\n return;\n }\n namesOf.set(file, names === '*' ? '*' : new Set([...prev, ...fresh]));\n for (const re of edges(file).reexports) {\n if (re.pairs === '*') mark(re.file, names === '*' ? '*' : fresh);\n else {\n for (const [exported, original] of re.pairs) {\n if (names === '*' || fresh.includes(exported)) mark(re.file, original === '*' ? '*' : [original]);\n }\n }\n }\n };\n for (const r of directReads) mark(r.file, r.names);\n\n const out: Record<string, string[]> = {};\n for (const [name, table] of Object.entries(tables)) {\n const file = join(SOURCE_ROOT, `${name}${MODULE_EXT}`);\n const names = namesOf.get(file);\n if (!loaded.has(file) || tableName(file) !== name || names === undefined || (names !== '*' && names.size === 0)) continue;\n if (kinds[name] !== 'module-exports') {\n out[name] = ['*'];\n continue;\n }\n const own = withoutLeadingComments(read(file));\n const keys = Object.keys(table.values).filter((k) => names === '*' || names.has(k) || mentions(own, k) > 1);\n if (keys.length > 0) out[name] = keys.length === Object.keys(table.values).length ? ['*'] : keys.sort();\n }\n const attribution: Attribution = { method: REACH_METHOD, command, tables: out };\n cache.set(command, attribution);\n return attribution;\n}\n"]}
|
|
1
|
+
{"version":3,"file":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AAC,GAAG,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1G,CAAC;IACD,MAAM,WAAW,GAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAChF,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAChC,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Static attribution for an experiment record: which constants a command's code can reach\n * (design: `docs/planning/Experiment-Record-Replay-Design-Note.md`).\n *\n * The reach is derived from the import graph of the modules as they are on disk when the entry is\n * recorded, not declared by hand and not observed while the command runs. It is an UPPER BOUND:\n *\n * - from `cli/commands/<command>` every relative static and literal dynamic import is followed;\n * - a `cli/` module reaches the `cli-api` barrel through `ctx.api`, not through an import, so every\n * barrel export whose name occurs as a word in a reached `cli/` module adds its source module;\n * - a named export of a module-exports table is reached when a reached module imports it by name\n * or by namespace, re-exports it, or the table's own module mentions it outside its declaration;\n * - an object table is reached whole (`*`) when its module is reached.\n *\n * Comments and strings are not stripped, so a name mentioned only in a comment counts as reached:\n * that errs toward \"reachable\", never toward \"not reachable\".\n *\n * The same import graph gives the modules the command loads. Each one's source is hashed, so a\n * change to a literal a module keeps private, which no constant table holds, is still named.\n */\n\nimport { sha256Hex } from '../core/hash.js';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve, sep } from 'node:path';\nimport { MODULE_EXT, SOURCE_ROOT, tableName, type TableKind } from './record-tables.js';\n\nexport const REACH_METHOD = 'static-import-reach';\n\n/** The constant-table keys and module sources a recorded command can reach, by static import reach (it errs toward reachable). */\nexport interface Attribution {\n method: typeof REACH_METHOD;\n command: string;\n /** Table name -> the keys the command's code can reach, or `['*']` for the whole table. */\n tables: Record<string, string[]>;\n /**\n * Module name (as a table is named) -> SHA-256 of its source, for every module the command\n * loads. Absent from entries written before module sources were hashed.\n */\n modules?: Record<string, string>;\n}\n\n/** A reached module reads `names` of `file`, `*` for all of them. */\ninterface Read {\n file: string;\n names: string[] | '*';\n}\n\n/** `file` re-exports: `pairs` as `[exported, original]` (`original` `*` for a namespace), or everything. */\ninterface Reexport {\n file: string;\n pairs: [string, string][] | '*';\n}\n\nconst source = new Map<string, string>();\nconst read = (file: string): string => {\n let s = source.get(file);\n if (s === undefined) {\n s = readFileSync(file, 'utf8');\n source.set(file, s);\n }\n return s;\n};\n\nfunction resolveSpec(from: string, spec: string): string | null {\n if (!spec.startsWith('.')) return null;\n let file = resolve(dirname(from), spec);\n if (MODULE_EXT !== '.js') file = file.replace(/\\.js$/, MODULE_EXT);\n return existsSync(file) ? file : null;\n}\n\n/** `[exported-or-local, original]` for each value binding of an import or export clause. */\nfunction clausePairs(clause: string): [string, string][] | '*' {\n const ns = /\\*\\s*as\\s+([\\w$]+)/.exec(clause);\n if (ns) return [[ns[1], '*']];\n if (/^\\s*\\*\\s*$/.test(clause)) return '*';\n const pairs: [string, string][] = [];\n const braces = /\\{([^}]*)\\}/.exec(clause);\n if (braces) {\n for (const part of braces[1].split(',')) {\n const m = /^\\s*(type\\s+)?([\\w$]+)(?:\\s+as\\s+([\\w$]+))?/.exec(part);\n if (m && !m[1]) pairs.push([m[3] ?? m[2], m[2]]);\n }\n }\n const def = /^\\s*([\\w$]+)\\s*(,|$)/.exec(clause);\n if (def && def[1] !== 'type') pairs.push([def[1], 'default']);\n return pairs;\n}\n\nconst STATIC_FROM = /\\b(import|export)\\s+(type\\s+)?([^'\";]*?)\\s*from\\s*['\"]([^'\"]+)['\"]/g;\nconst SIDE_EFFECT = /\\bimport\\s*['\"]([^'\"]+)['\"]/g;\nconst DYNAMIC = /\\bimport\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g;\n\nconst parsed = new Map<string, { reads: Read[]; reexports: Reexport[] }>();\n\nfunction edges(file: string): { reads: Read[]; reexports: Reexport[] } {\n const hit = parsed.get(file);\n if (hit) return hit;\n const text = read(file);\n const reads: Read[] = [];\n const reexports: Reexport[] = [];\n for (const m of text.matchAll(STATIC_FROM)) {\n if (m[2]) continue;\n const target = resolveSpec(file, m[4]);\n if (!target) continue;\n const pairs = clausePairs(m[3]);\n if (m[1] === 'export') reexports.push({ file: target, pairs });\n else reads.push({ file: target, names: pairs === '*' || pairs.some(([, o]) => o === '*') ? '*' : pairs.map(([, o]) => o) });\n }\n for (const m of text.matchAll(SIDE_EFFECT)) {\n const target = resolveSpec(file, m[1]);\n if (target) reads.push({ file: target, names: [] });\n }\n for (const m of text.matchAll(DYNAMIC)) {\n const target = resolveSpec(file, m[1]);\n if (target) reads.push({ file: target, names: '*' });\n }\n const out = { reads, reexports };\n parsed.set(file, out);\n return out;\n}\n\nconst words = (text: string): Set<string> => new Set(text.match(/[A-Za-z_$][\\w$]*/g) ?? []);\n\n/** What a `cli/` module reaches through `ctx.api`: each `cli-api` export whose name occurs in it. */\nfunction apiReads(file: string): Read[] {\n const barrel = join(SOURCE_ROOT, `cli-api${MODULE_EXT}`);\n const w = words(read(file));\n const out: Read[] = [];\n for (const re of edges(barrel).reexports) {\n if (re.pairs === '*') out.push({ file: re.file, names: '*' });\n else for (const [exported, original] of re.pairs) if (w.has(exported)) out.push({ file: re.file, names: original === '*' ? '*' : [original] });\n }\n return out;\n}\n\n/** Comments that open a line: outside a multi-line template literal a line cannot begin code with\n * `/*` or `//`, so no code is removed. A comment after code stays, which errs toward \"reachable\". */\nconst withoutLeadingComments = (text: string): string =>\n text.replace(/^[ \\t]*\\/\\*[\\s\\S]*?\\*\\//gm, '').replace(/^[ \\t]*\\/\\/.*$/gm, '');\n\nconst mentions = (text: string, name: string): number =>\n text.match(new RegExp(`(?<![\\\\w$])${name.replace(/\\$/g, '\\\\$')}(?![\\\\w$])`, 'g'))?.length ?? 0;\n\nconst cache = new Map<string, Attribution | null>();\nconst loadedCache = new Map<string, { loaded: Set<string>; directReads: Read[] } | null>();\n\n/** Every module `command` loads, and what each reads, or null when the command has no module. */\nfunction loadedModules(command: string): { loaded: Set<string>; directReads: Read[] } | null {\n if (loadedCache.has(command)) return loadedCache.get(command)!;\n const seed = join(SOURCE_ROOT, 'cli', 'commands', `${command}${MODULE_EXT}`);\n if (!existsSync(seed)) {\n loadedCache.set(command, null);\n return null;\n }\n const cliDir = join(SOURCE_ROOT, 'cli') + sep;\n\n // Modules loaded: every import and re-export is followed, since loading runs top-level code.\n const loaded = new Set<string>();\n const directReads: Read[] = [];\n const queue = [seed];\n while (queue.length > 0) {\n const file = queue.pop()!;\n if (loaded.has(file)) continue;\n loaded.add(file);\n const { reads, reexports } = edges(file);\n const all = file.startsWith(cliDir) ? [...reads, ...apiReads(file)] : reads;\n directReads.push(...all);\n for (const t of [...all.map((r) => r.file), ...reexports.map((r) => r.file)]) if (!loaded.has(t)) queue.push(t);\n }\n const out = { loaded, directReads };\n loadedCache.set(command, out);\n return out;\n}\n\n/**\n * SHA-256 of one module's source. The module was found when the import graph was walked, so a\n * failed read is not \"absent\": the value keeps which kind of failure it was (`unreadable (EACCES)`,\n * `unreadable (EISDIR)`, ...), not one word for all of them.\n */\nexport function sourceHash(file: string): string {\n try {\n return sha256Hex(readFileSync(file));\n } catch (e) {\n const code = e instanceof Error && 'code' in e && typeof e.code === 'string' ? e.code : 'error';\n return `unreadable (${code})`;\n }\n}\n\n/**\n * SHA-256 of the source of every module `command` loads, keyed by module name, read from disk now\n * (not from the parse cache), or null when the command has no module of its own.\n */\nexport function moduleSources(command: string): Record<string, string> | null {\n const mods = loadedModules(command);\n if (!mods) return null;\n const out: Record<string, string> = {};\n for (const file of [...mods.loaded].sort()) out[tableName(file)] = sourceHash(file);\n return out;\n}\n\n/** The reach of `command`'s code into `tables`, or null when the command has no module of its own. */\nexport function staticReach(\n command: string,\n tables: Record<string, { values: Record<string, unknown> }>,\n kinds: Record<string, TableKind>,\n): Attribution | null {\n if (cache.has(command)) return cache.get(command)!;\n const mods = loadedModules(command);\n if (!mods) {\n cache.set(command, null);\n return null;\n }\n const { loaded, directReads } = mods;\n\n // Names read: an import reads its names; a re-export passes on only the names read from it.\n const namesOf = new Map<string, Set<string> | '*'>();\n const mark = (file: string, names: string[] | '*'): void => {\n const prev = namesOf.get(file) ?? new Set<string>();\n if (prev === '*') return;\n const fresh = names === '*' ? ['*'] : names.filter((n) => !prev.has(n));\n if (fresh.length === 0) {\n namesOf.set(file, prev);\n return;\n }\n namesOf.set(file, names === '*' ? '*' : new Set([...prev, ...fresh]));\n for (const re of edges(file).reexports) {\n if (re.pairs === '*') mark(re.file, names === '*' ? '*' : fresh);\n else {\n for (const [exported, original] of re.pairs) {\n if (names === '*' || fresh.includes(exported)) mark(re.file, original === '*' ? '*' : [original]);\n }\n }\n }\n };\n for (const r of directReads) mark(r.file, r.names);\n\n const out: Record<string, string[]> = {};\n for (const [name, table] of Object.entries(tables)) {\n const file = join(SOURCE_ROOT, `${name}${MODULE_EXT}`);\n const names = namesOf.get(file);\n if (!loaded.has(file) || tableName(file) !== name || names === undefined || (names !== '*' && names.size === 0)) continue;\n if (kinds[name] !== 'module-exports') {\n out[name] = ['*'];\n continue;\n }\n const own = withoutLeadingComments(read(file));\n const keys = Object.keys(table.values).filter((k) => names === '*' || names.has(k) || mentions(own, k) > 1);\n if (keys.length > 0) out[name] = keys.length === Object.keys(table.values).length ? ['*'] : keys.sort();\n }\n const attribution: Attribution = { method: REACH_METHOD, command, tables: out };\n cache.set(command, attribution);\n return attribution;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-tables.d.ts","sourceRoot":"","sources":["../../src/cli/record-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"record-tables.d.ts","sourceRoot":"","sources":["../../src/cli/record-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAaH,oFAAoF;AACpF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnD,uFAAuF;AACvF,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,uDAAuD;AACvD,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAEpD,mGAAmG;AACnG,eAAO,MAAM,WAAW,QAAiD,CAAC;AAC1E,eAAO,MAAM,UAAU,QAA0C,CAAC;AAElE,2FAA2F;AAC3F,eAAO,MAAM,gBAAgB,WAAY,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,KAAG,MACgC,CAAC;AA6BvG,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MACsC,CAAC;AAiChF,oGAAoG;AACpG,wBAAgB,cAAc,IAAI,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;CAAE,CAAC,CAoBrH"}
|
|
@@ -16,21 +16,22 @@
|
|
|
16
16
|
*
|
|
17
17
|
* A literal a module keeps private (not exported, not in one of the object tables) is in no table.
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
19
|
+
import { compareCodepoint } from '../core/compare.js';
|
|
20
|
+
import { sha256Hex } from '../core/hash.js';
|
|
20
21
|
import { readdirSync, statSync } from 'node:fs';
|
|
21
22
|
import { extname, join, relative, sep } from 'node:path';
|
|
22
23
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
23
24
|
import { CANONICAL_CONSTANTS } from '../composition/canonical-graph.js';
|
|
24
25
|
import { CONSTANTS as SYMBOLIC_CONSTANTS } from '../dimensional/symbolic-constants.js';
|
|
26
|
+
import { BASES } from '../dimensional/algebra.js';
|
|
25
27
|
import { unitTables } from '../dimensional/units.js';
|
|
26
|
-
const sha256 = (s) => createHash('sha256').update(s).digest('hex');
|
|
27
28
|
/** Source root (`dist/` when built, `src/` under a TypeScript loader) and its module extension. */
|
|
28
29
|
export const SOURCE_ROOT = fileURLToPath(new URL('../', import.meta.url));
|
|
29
30
|
export const MODULE_EXT = extname(fileURLToPath(import.meta.url));
|
|
30
31
|
/** Serialised with sorted keys so the fingerprint does not depend on declaration order. */
|
|
31
|
-
export const tableFingerprint = (values) =>
|
|
32
|
+
export const tableFingerprint = (values) => sha256Hex(JSON.stringify(Object.fromEntries(Object.keys(values).sort().map((k) => [k, values[k]]))));
|
|
32
33
|
/** Exponents in a fixed base order, independent of how `format()` names a dimension. */
|
|
33
|
-
const dimensionText = (d) =>
|
|
34
|
+
const dimensionText = (d) => BASES
|
|
34
35
|
.filter((b) => d[b] !== 0)
|
|
35
36
|
.map((b) => `${b}^${d[b]}`)
|
|
36
37
|
.join(' ') || '1';
|
|
@@ -101,7 +102,7 @@ export function constantTables() {
|
|
|
101
102
|
}
|
|
102
103
|
for (const [name, values] of Object.entries(objectTables()))
|
|
103
104
|
found.push([name, values, 'object']);
|
|
104
|
-
found.sort(([a], [b]) => (a
|
|
105
|
+
found.sort(([a], [b]) => compareCodepoint(a, b));
|
|
105
106
|
const tables = {};
|
|
106
107
|
const kinds = {};
|
|
107
108
|
for (const [name, values, kind] of found) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-tables.js","sourceRoot":"","sources":["../../src/cli/record-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,aAAa,E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AC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,MAAM,MAAM,GAAkC,EAAE,CAAC;QACjD,MAAM,KAAK,GAA8B,EAAE,CAAC;QAC5C,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;YAC5D,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACrB,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * The constant tables an experiment record fingerprints, each under its own name so replay can\n * say WHICH table changed (design: `docs/planning/Experiment-Record-Replay-Design-Note.md`).\n *\n * A table is named by the source module that holds it, relative to the source root and without\n * extension (`core/constants`, `dimensional/units`, `bridges/be58-johnson-nyquist-confrontation`).\n * Two kinds:\n *\n * - **module exports** — every numeric export of `core/constants` and of each module under\n * `bridges/` and `cases/`, found by listing those directories, so a module added later is\n * fingerprinted without being listed here;\n * - **object tables** — the unit and prefix tables of `dimensional/units` (with the SHA-256 of\n * `data/units.json`, the file they are read from), and the constant\n * registries `dimensional/symbolic-constants` and `composition/canonical-graph`, flattened to\n * `key.field` entries.\n *\n * A literal a module keeps private (not exported, not in one of the object tables) is in no table.\n */\n\nimport { createHash } from 'node:crypto';\nimport { readdirSync, statSync } from 'node:fs';\nimport { extname, join, relative, sep } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { CANONICAL_CONSTANTS } from '../composition/canonical-graph.js';\nimport { CONSTANTS as SYMBOLIC_CONSTANTS } from '../dimensional/symbolic-constants.js';\nimport type { Dimension } from '../dimensional/types.js';\nimport { unitTables } from '../dimensional/units.js';\n\n/** A serialisable primitive value that can be fingerprinted in a constant table. */\nexport type TableValue = number | string | boolean;\n\n/** A named table of constants and the SHA-256 fingerprint of its serialised values. */\nexport interface ConstantTable {\n values: Record<string, TableValue>;\n sha256: string;\n}\n\n/** The source shape used to build a constant table. */\nexport type TableKind = 'module-exports' | 'object';\n\nconst sha256 = (s: string): string => createHash('sha256').update(s).digest('hex');\n\n/** Source root (`dist/` when built, `src/` under a TypeScript loader) and its module extension. */\nexport const SOURCE_ROOT = fileURLToPath(new URL('../', import.meta.url));\nexport const MODULE_EXT = extname(fileURLToPath(import.meta.url));\n\n/** Serialised with sorted keys so the fingerprint does not depend on declaration order. */\nexport const tableFingerprint = (values: Record<string, TableValue>): string =>\n sha256(JSON.stringify(Object.fromEntries(Object.keys(values).sort().map((k) => [k, values[k]]))));\n\n/** Exponents in a fixed base order, independent of how `format()` names a dimension. */\nconst dimensionText = (d: Dimension): string =>\n (['L', 'M', 'T', 'I', 'Theta', 'N', 'J'] as const)\n .filter((b) => d[b] !== 0)\n .map((b) => `${b}^${d[b]}`)\n .join(' ') || '1';\n\nconst MODULE_EXPORT_ROOTS = ['core/constants', 'bridges', 'cases'];\n\nfunction moduleFiles(rel: string): string[] {\n const path = join(SOURCE_ROOT, rel);\n let isDir = false;\n try {\n isDir = statSync(path).isDirectory();\n } catch {\n return [path + MODULE_EXT];\n }\n if (!isDir) return [path];\n return readdirSync(path)\n .sort()\n .flatMap((f) => {\n const p = join(path, f);\n if (statSync(p).isDirectory()) return moduleFiles(join(rel, f));\n return f.endsWith(MODULE_EXT) && !f.endsWith(`.d${MODULE_EXT}`) && f !== `index${MODULE_EXT}` ? [p] : [];\n });\n}\n\nexport const tableName = (file: string): string =>\n relative(SOURCE_ROOT, file).slice(0, -MODULE_EXT.length).split(sep).join('/');\n\nfunction objectTables(): Record<string, Record<string, TableValue>> {\n const units: Record<string, TableValue> = {};\n const { units: unitMap, prefixes, celsiusOffsetK, sourceSha256 } = unitTables();\n for (const [sym, [scale, dim, prefixable, cycles]] of unitMap) {\n units[`${sym}.scale`] = scale;\n units[`${sym}.dimension`] = dimensionText(dim);\n units[`${sym}.prefixable`] = prefixable;\n // A cycle-counting row multiplies an angular input by 2π, so it changes a result like a scale does.\n units[`${sym}.cycles`] = cycles; // the cycle-count flag (Hz, rpm); the reader keeps the count and prints a note, it does not multiply by 2π\n }\n for (const [p, f] of prefixes) units[`prefix.${p}`] = f;\n units['degC.offsetK'] = celsiusOffsetK;\n // The whole file, so a refused spelling, a prefix letter, an affine row or a note is covered too.\n units['data/units.json.sha256'] = sourceSha256;\n const registry = (table: Readonly<Record<string, { value: number; dim: Dimension }>>): Record<string, TableValue> => {\n const out: Record<string, TableValue> = {};\n for (const [k, c] of Object.entries(table)) {\n out[`${k}.value`] = c.value;\n out[`${k}.dimension`] = dimensionText(c.dim);\n }\n return out;\n };\n return {\n 'dimensional/units': units,\n 'dimensional/symbolic-constants': registry(SYMBOLIC_CONSTANTS),\n 'composition/canonical-graph': registry(CANONICAL_CONSTANTS),\n };\n}\n\nlet cached: Promise<{ tables: Record<string, ConstantTable>; kinds: Record<string, TableKind> }> | undefined;\n\n/** Every table, keyed by name, sorted. Read once per process: tables are module-level constants. */\nexport function constantTables(): Promise<{ tables: Record<string, ConstantTable>; kinds: Record<string, TableKind> }> {\n cached ??= (async () => {\n const found: [string, Record<string, TableValue>, TableKind][] = [];\n for (const file of MODULE_EXPORT_ROOTS.flatMap(moduleFiles)) {\n const mod = (await import(pathToFileURL(file).href)) as Record<string, unknown>;\n const values: Record<string, TableValue> = {};\n for (const [k, v] of Object.entries(mod)) if (typeof v === 'number') values[k] = v;\n if (Object.keys(values).length > 0) found.push([tableName(file), values, 'module-exports']);\n }\n for (const [name, values] of Object.entries(objectTables())) found.push([name, values, 'object']);\n found.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));\n const tables: Record<string, ConstantTable> = {};\n const kinds: Record<string, TableKind> = {};\n for (const [name, values, kind] of found) {\n tables[name] = { values, sha256: tableFingerprint(values) };\n kinds[name] = kind;\n }\n return { tables, kinds };\n })();\n return cached;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"record-tables.js","sourceRoot":"","sources":["../../src/cli/record-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAcrD,mGAAmG;AACnG,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAElE,2FAA2F;AAC3F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAkC,EAAU,EAAE,CAC7E,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,I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AC,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;QAC9F,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAClG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACjD,MAAM,MAAM,GAAkC,EAAE,CAAC;QACjD,MAAM,KAAK,GAA8B,EAAE,CAAC;QAC5C,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;YAC5D,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACrB,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * The constant tables an experiment record fingerprints, each under its own name so replay can\n * say WHICH table changed (design: `docs/planning/Experiment-Record-Replay-Design-Note.md`).\n *\n * A table is named by the source module that holds it, relative to the source root and without\n * extension (`core/constants`, `dimensional/units`, `bridges/be58-johnson-nyquist-confrontation`).\n * Two kinds:\n *\n * - **module exports** — every numeric export of `core/constants` and of each module under\n * `bridges/` and `cases/`, found by listing those directories, so a module added later is\n * fingerprinted without being listed here;\n * - **object tables** — the unit and prefix tables of `dimensional/units` (with the SHA-256 of\n * `data/units.json`, the file they are read from), and the constant\n * registries `dimensional/symbolic-constants` and `composition/canonical-graph`, flattened to\n * `key.field` entries.\n *\n * A literal a module keeps private (not exported, not in one of the object tables) is in no table.\n */\n\nimport { compareCodepoint } from '../core/compare.js';\nimport { sha256Hex } from '../core/hash.js';\nimport { readdirSync, statSync } from 'node:fs';\nimport { extname, join, relative, sep } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { CANONICAL_CONSTANTS } from '../composition/canonical-graph.js';\nimport { CONSTANTS as SYMBOLIC_CONSTANTS } from '../dimensional/symbolic-constants.js';\nimport { BASES } from '../dimensional/algebra.js';\nimport type { Dimension } from '../dimensional/types.js';\nimport { unitTables } from '../dimensional/units.js';\n\n/** A serialisable primitive value that can be fingerprinted in a constant table. */\nexport type TableValue = number | string | boolean;\n\n/** A named table of constants and the SHA-256 fingerprint of its serialised values. */\nexport interface ConstantTable {\n values: Record<string, TableValue>;\n sha256: string;\n}\n\n/** The source shape used to build a constant table. */\nexport type TableKind = 'module-exports' | 'object';\n\n/** Source root (`dist/` when built, `src/` under a TypeScript loader) and its module extension. */\nexport const SOURCE_ROOT = fileURLToPath(new URL('../', import.meta.url));\nexport const MODULE_EXT = extname(fileURLToPath(import.meta.url));\n\n/** Serialised with sorted keys so the fingerprint does not depend on declaration order. */\nexport const tableFingerprint = (values: Record<string, TableValue>): string =>\n sha256Hex(JSON.stringify(Object.fromEntries(Object.keys(values).sort().map((k) => [k, values[k]]))));\n\n/** Exponents in a fixed base order, independent of how `format()` names a dimension. */\nconst dimensionText = (d: Dimension): string =>\n BASES\n .filter((b) => d[b] !== 0)\n .map((b) => `${b}^${d[b]}`)\n .join(' ') || '1';\n\nconst MODULE_EXPORT_ROOTS = ['core/constants', 'bridges', 'cases'];\n\nfunction moduleFiles(rel: string): string[] {\n const path = join(SOURCE_ROOT, rel);\n let isDir = false;\n try {\n isDir = statSync(path).isDirectory();\n } catch {\n return [path + MODULE_EXT];\n }\n if (!isDir) return [path];\n return readdirSync(path)\n .sort()\n .flatMap((f) => {\n const p = join(path, f);\n if (statSync(p).isDirectory()) return moduleFiles(join(rel, f));\n return f.endsWith(MODULE_EXT) && !f.endsWith(`.d${MODULE_EXT}`) && f !== `index${MODULE_EXT}` ? [p] : [];\n });\n}\n\nexport const tableName = (file: string): string =>\n relative(SOURCE_ROOT, file).slice(0, -MODULE_EXT.length).split(sep).join('/');\n\nfunction objectTables(): Record<string, Record<string, TableValue>> {\n const units: Record<string, TableValue> = {};\n const { units: unitMap, prefixes, celsiusOffsetK, sourceSha256 } = unitTables();\n for (const [sym, [scale, dim, prefixable, cycles]] of unitMap) {\n units[`${sym}.scale`] = scale;\n units[`${sym}.dimension`] = dimensionText(dim);\n units[`${sym}.prefixable`] = prefixable;\n // A cycle-counting row multiplies an angular input by 2π, so it changes a result like a scale does.\n units[`${sym}.cycles`] = cycles; // the cycle-count flag (Hz, rpm); the reader keeps the count and prints a note, it does not multiply by 2π\n }\n for (const [p, f] of prefixes) units[`prefix.${p}`] = f;\n units['degC.offsetK'] = celsiusOffsetK;\n // The whole file, so a refused spelling, a prefix letter, an affine row or a note is covered too.\n units['data/units.json.sha256'] = sourceSha256;\n const registry = (table: Readonly<Record<string, { value: number; dim: Dimension }>>): Record<string, TableValue> => {\n const out: Record<string, TableValue> = {};\n for (const [k, c] of Object.entries(table)) {\n out[`${k}.value`] = c.value;\n out[`${k}.dimension`] = dimensionText(c.dim);\n }\n return out;\n };\n return {\n 'dimensional/units': units,\n 'dimensional/symbolic-constants': registry(SYMBOLIC_CONSTANTS),\n 'composition/canonical-graph': registry(CANONICAL_CONSTANTS),\n };\n}\n\nlet cached: Promise<{ tables: Record<string, ConstantTable>; kinds: Record<string, TableKind> }> | undefined;\n\n/** Every table, keyed by name, sorted. Read once per process: tables are module-level constants. */\nexport function constantTables(): Promise<{ tables: Record<string, ConstantTable>; kinds: Record<string, TableKind> }> {\n cached ??= (async () => {\n const found: [string, Record<string, TableValue>, TableKind][] = [];\n for (const file of MODULE_EXPORT_ROOTS.flatMap(moduleFiles)) {\n const mod = (await import(pathToFileURL(file).href)) as Record<string, unknown>;\n const values: Record<string, TableValue> = {};\n for (const [k, v] of Object.entries(mod)) if (typeof v === 'number') values[k] = v;\n if (Object.keys(values).length > 0) found.push([tableName(file), values, 'module-exports']);\n }\n for (const [name, values] of Object.entries(objectTables())) found.push([name, values, 'object']);\n found.sort(([a], [b]) => compareCodepoint(a, b));\n const tables: Record<string, ConstantTable> = {};\n const kinds: Record<string, TableKind> = {};\n for (const [name, values, kind] of found) {\n tables[name] = { values, sha256: tableFingerprint(values) };\n kinds[name] = kind;\n }\n return { tables, kinds };\n })();\n return cached;\n}\n"]}
|
package/dist/cli/record.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export type Io = {
|
|
|
23
23
|
};
|
|
24
24
|
/** A CLI dispatcher invoked with argv and an isolated output sink. */
|
|
25
25
|
export type Dispatch = (argv: string[], io: Io) => Promise<number>;
|
|
26
|
-
export declare const RECORD_SCHEMA = "upt-record/2";
|
|
27
26
|
/** The toolchain, parser, peers and constants captured beside a CLI invocation. */
|
|
28
27
|
export interface RecordEnvironment {
|
|
29
28
|
uptVersion: string;
|
|
@@ -44,7 +43,7 @@ export interface RecordResult {
|
|
|
44
43
|
}
|
|
45
44
|
/** One JSON-lines record entry for a CLI invocation and its replay inputs. */
|
|
46
45
|
export interface RecordEntry {
|
|
47
|
-
schema:
|
|
46
|
+
schema: 'upt-record/2';
|
|
48
47
|
recordedAt: string;
|
|
49
48
|
argv: string[];
|
|
50
49
|
argvSha256: string;
|
|
@@ -76,9 +75,6 @@ export interface RecordInput {
|
|
|
76
75
|
sha256: string | null;
|
|
77
76
|
}
|
|
78
77
|
export declare const sha256: (s: string | Buffer) => string;
|
|
79
|
-
export declare const argvFingerprint: (argv: unknown) => string;
|
|
80
|
-
/** Hash a record entry after excluding its stored fingerprint field. */
|
|
81
|
-
export declare function entryFingerprint(entry: Partial<RecordEntry>): string;
|
|
82
78
|
/** Run `argv` exactly as without `--record`, then append its entry. An unexpected exception is
|
|
83
79
|
* recorded and rethrown, so recording never changes what the caller sees. */
|
|
84
80
|
export declare function recordInvocation(file: string, argv: string[], dispatch: Dispatch, io: Io, api: typeof cliApi): Promise<number>;
|
package/dist/cli/record.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/cli/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/cli/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAM7C,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAoC,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAI1F,iFAAiF;AACjF,MAAM,MAAM,EAAE,GAAG;IACf,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5B,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAKnE,mFAAmF;AACnF,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IACrC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CA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