universal-physics-tensor 10.0.0 → 12.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.
Files changed (835) hide show
  1. package/README.md +39 -36
  2. package/bin/upt.mjs +13 -1
  3. package/data/applied-cases.json +1892 -0
  4. package/data/applied-cases.schema.json +194 -0
  5. package/data/atlas/atlas.json +25 -25
  6. package/data/atlas/atlas.jsonld +1 -1
  7. package/data/atlas/diffusion.json +6 -6
  8. package/data/atlas/oscillators.json +7 -7
  9. package/data/atlas/waves.json +14 -14
  10. package/data/atlas/witness-results.json +11 -11
  11. package/data/bridge-catalog.json +389 -230
  12. package/data/bridge-catalog.schema.json +45 -7
  13. package/data/units.json +6 -25
  14. package/dist/atlas/applicability.d.ts.map +1 -1
  15. package/dist/atlas/applicability.js +21 -15
  16. package/dist/atlas/applicability.js.map +1 -1
  17. package/dist/atlas/benchmark/hybrid-retrieval.d.ts +9 -1
  18. package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
  19. package/dist/atlas/benchmark/hybrid-retrieval.js +15 -13
  20. package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
  21. package/dist/atlas/benchmark/loader.js +2 -2
  22. package/dist/atlas/benchmark/loader.js.map +1 -1
  23. package/dist/atlas/benchmark/stats.d.ts +2 -2
  24. package/dist/atlas/benchmark/stats.d.ts.map +1 -1
  25. package/dist/atlas/benchmark/stats.js +9 -15
  26. package/dist/atlas/benchmark/stats.js.map +1 -1
  27. package/dist/atlas/catalog-formal-ref.d.ts +26 -3
  28. package/dist/atlas/catalog-formal-ref.d.ts.map +1 -1
  29. package/dist/atlas/catalog-formal-ref.js +52 -5
  30. package/dist/atlas/catalog-formal-ref.js.map +1 -1
  31. package/dist/atlas/chain-pipeline.d.ts.map +1 -1
  32. package/dist/atlas/chain-pipeline.js +7 -8
  33. package/dist/atlas/chain-pipeline.js.map +1 -1
  34. package/dist/atlas/diffusion/bridges-closure.d.ts +0 -4
  35. package/dist/atlas/diffusion/bridges-closure.d.ts.map +1 -1
  36. package/dist/atlas/diffusion/bridges-closure.js +8 -12
  37. package/dist/atlas/diffusion/bridges-closure.js.map +1 -1
  38. package/dist/atlas/diffusion/bridges.d.ts.map +1 -1
  39. package/dist/atlas/diffusion/bridges.js +27 -39
  40. package/dist/atlas/diffusion/bridges.js.map +1 -1
  41. package/dist/atlas/diffusion/dimensions.d.ts +6 -14
  42. package/dist/atlas/diffusion/dimensions.d.ts.map +1 -1
  43. package/dist/atlas/diffusion/dimensions.js +8 -16
  44. package/dist/atlas/diffusion/dimensions.js.map +1 -1
  45. package/dist/atlas/diffusion/models.d.ts +3 -3
  46. package/dist/atlas/diffusion/models.d.ts.map +1 -1
  47. package/dist/atlas/diffusion/models.js +5 -10
  48. package/dist/atlas/diffusion/models.js.map +1 -1
  49. package/dist/atlas/diffusion/numerics.d.ts +16 -4
  50. package/dist/atlas/diffusion/numerics.d.ts.map +1 -1
  51. package/dist/atlas/diffusion/numerics.js +38 -24
  52. package/dist/atlas/diffusion/numerics.js.map +1 -1
  53. package/dist/atlas/link-prediction.d.ts +106 -3
  54. package/dist/atlas/link-prediction.d.ts.map +1 -1
  55. package/dist/atlas/link-prediction.js +212 -66
  56. package/dist/atlas/link-prediction.js.map +1 -1
  57. package/dist/atlas/oscillators/bridges-coarse.d.ts.map +1 -1
  58. package/dist/atlas/oscillators/bridges-coarse.js +7 -11
  59. package/dist/atlas/oscillators/bridges-coarse.js.map +1 -1
  60. package/dist/atlas/oscillators/bridges-exact.d.ts.map +1 -1
  61. package/dist/atlas/oscillators/bridges-exact.js +6 -7
  62. package/dist/atlas/oscillators/bridges-exact.js.map +1 -1
  63. package/dist/atlas/oscillators/bridges-limits.d.ts +3 -16
  64. package/dist/atlas/oscillators/bridges-limits.d.ts.map +1 -1
  65. package/dist/atlas/oscillators/bridges-limits.js +23 -34
  66. package/dist/atlas/oscillators/bridges-limits.js.map +1 -1
  67. package/dist/atlas/oscillators/dimensions.d.ts +9 -21
  68. package/dist/atlas/oscillators/dimensions.d.ts.map +1 -1
  69. package/dist/atlas/oscillators/dimensions.js +9 -21
  70. package/dist/atlas/oscillators/dimensions.js.map +1 -1
  71. package/dist/atlas/oscillators/limit-witnesses.d.ts +2 -2
  72. package/dist/atlas/oscillators/limit-witnesses.d.ts.map +1 -1
  73. package/dist/atlas/oscillators/limit-witnesses.js +17 -15
  74. package/dist/atlas/oscillators/limit-witnesses.js.map +1 -1
  75. package/dist/atlas/oscillators/models.d.ts.map +1 -1
  76. package/dist/atlas/oscillators/models.js +2 -6
  77. package/dist/atlas/oscillators/models.js.map +1 -1
  78. package/dist/atlas/oscillators/pendulum-motion.d.ts +29 -6
  79. package/dist/atlas/oscillators/pendulum-motion.d.ts.map +1 -1
  80. package/dist/atlas/oscillators/pendulum-motion.js +60 -40
  81. package/dist/atlas/oscillators/pendulum-motion.js.map +1 -1
  82. package/dist/atlas/oscillators/phase-translation.d.ts +0 -11
  83. package/dist/atlas/oscillators/phase-translation.d.ts.map +1 -1
  84. package/dist/atlas/oscillators/phase-translation.js +3 -4
  85. package/dist/atlas/oscillators/phase-translation.js.map +1 -1
  86. package/dist/atlas/oscillators/position-translation.d.ts +68 -7
  87. package/dist/atlas/oscillators/position-translation.d.ts.map +1 -1
  88. package/dist/atlas/oscillators/position-translation.js +123 -12
  89. package/dist/atlas/oscillators/position-translation.js.map +1 -1
  90. package/dist/atlas/oscillators/rejections.d.ts +0 -2
  91. package/dist/atlas/oscillators/rejections.d.ts.map +1 -1
  92. package/dist/atlas/oscillators/rejections.js +0 -7
  93. package/dist/atlas/oscillators/rejections.js.map +1 -1
  94. package/dist/atlas/physjs-entries.generated.d.ts +35 -25
  95. package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
  96. package/dist/atlas/physjs-entries.generated.js +37 -25
  97. package/dist/atlas/physjs-entries.generated.js.map +1 -1
  98. package/dist/atlas/physjs-ref.d.ts +34 -31
  99. package/dist/atlas/physjs-ref.d.ts.map +1 -1
  100. package/dist/atlas/physjs-ref.js +55 -53
  101. package/dist/atlas/physjs-ref.js.map +1 -1
  102. package/dist/atlas/physjs-reviewed.d.ts +1 -1
  103. package/dist/atlas/physjs-reviewed.js +15 -15
  104. package/dist/atlas/physjs-reviewed.js.map +1 -1
  105. package/dist/atlas/poster/statements.d.ts +0 -19
  106. package/dist/atlas/poster/statements.d.ts.map +1 -1
  107. package/dist/atlas/poster/statements.js +1 -1
  108. package/dist/atlas/poster/statements.js.map +1 -1
  109. package/dist/atlas/proof-target.d.ts +1 -1
  110. package/dist/atlas/proof-target.js +1 -1
  111. package/dist/atlas/proof-target.js.map +1 -1
  112. package/dist/atlas/regime.d.ts +1 -1
  113. package/dist/atlas/regime.d.ts.map +1 -1
  114. package/dist/atlas/regime.js +1 -1
  115. package/dist/atlas/regime.js.map +1 -1
  116. package/dist/atlas/text-overlap.d.ts +23 -0
  117. package/dist/atlas/text-overlap.d.ts.map +1 -0
  118. package/dist/atlas/text-overlap.js +41 -0
  119. package/dist/atlas/text-overlap.js.map +1 -0
  120. package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
  121. package/dist/atlas/waves/bridges-closure.js +2 -6
  122. package/dist/atlas/waves/bridges-closure.js.map +1 -1
  123. package/dist/atlas/waves/bridges.d.ts.map +1 -1
  124. package/dist/atlas/waves/bridges.js +32 -48
  125. package/dist/atlas/waves/bridges.js.map +1 -1
  126. package/dist/atlas/waves/models.d.ts +5 -6
  127. package/dist/atlas/waves/models.d.ts.map +1 -1
  128. package/dist/atlas/waves/models.js +7 -13
  129. package/dist/atlas/waves/models.js.map +1 -1
  130. package/dist/atlas/waves/numerics.d.ts.map +1 -1
  131. package/dist/atlas/waves/numerics.js +10 -3
  132. package/dist/atlas/waves/numerics.js.map +1 -1
  133. package/dist/atlas/witness-numeric.d.ts +30 -0
  134. package/dist/atlas/witness-numeric.d.ts.map +1 -1
  135. package/dist/atlas/witness-numeric.js +53 -0
  136. package/dist/atlas/witness-numeric.js.map +1 -1
  137. package/dist/atlas/witness-specs.d.ts.map +1 -1
  138. package/dist/atlas/witness-specs.js +19 -0
  139. package/dist/atlas/witness-specs.js.map +1 -1
  140. package/dist/atlas/witness-symbolic.d.ts +75 -3
  141. package/dist/atlas/witness-symbolic.d.ts.map +1 -1
  142. package/dist/atlas/witness-symbolic.js +116 -10
  143. package/dist/atlas/witness-symbolic.js.map +1 -1
  144. package/dist/bridges/catalog-load.d.ts.map +1 -1
  145. package/dist/bridges/catalog-load.js +13 -8
  146. package/dist/bridges/catalog-load.js.map +1 -1
  147. package/dist/bridges/catalog-types.d.ts +26 -2
  148. package/dist/bridges/catalog-types.d.ts.map +1 -1
  149. package/dist/bridges/catalog-types.js +11 -1
  150. package/dist/bridges/catalog-types.js.map +1 -1
  151. package/dist/bridges/evaluation-errors.d.ts +31 -1
  152. package/dist/bridges/evaluation-errors.d.ts.map +1 -1
  153. package/dist/bridges/evaluation-errors.js +20 -2
  154. package/dist/bridges/evaluation-errors.js.map +1 -1
  155. package/dist/bridges/evaluator-inputs.d.ts.map +1 -1
  156. package/dist/bridges/evaluator-inputs.js +7 -5
  157. package/dist/bridges/evaluator-inputs.js.map +1 -1
  158. package/dist/bridges/evaluators.d.ts.map +1 -1
  159. package/dist/bridges/evaluators.js +27 -12
  160. package/dist/bridges/evaluators.js.map +1 -1
  161. package/dist/bridges/expr-parse.d.ts +11 -0
  162. package/dist/bridges/expr-parse.d.ts.map +1 -1
  163. package/dist/bridges/expr-parse.js +14 -5
  164. package/dist/bridges/expr-parse.js.map +1 -1
  165. package/dist/bridges/holds.d.ts +35 -3
  166. package/dist/bridges/holds.d.ts.map +1 -1
  167. package/dist/bridges/holds.js +117 -23
  168. package/dist/bridges/holds.js.map +1 -1
  169. package/dist/bridges/notices.d.ts.map +1 -1
  170. package/dist/bridges/notices.js +5 -5
  171. package/dist/bridges/notices.js.map +1 -1
  172. package/dist/bridges/relation-eval.d.ts +4 -4
  173. package/dist/bridges/relation-eval.d.ts.map +1 -1
  174. package/dist/bridges/relation-eval.js +15 -16
  175. package/dist/bridges/relation-eval.js.map +1 -1
  176. package/dist/bridges/sensitivity.d.ts.map +1 -1
  177. package/dist/bridges/sensitivity.js +3 -3
  178. package/dist/bridges/sensitivity.js.map +1 -1
  179. package/dist/bridges/validity.d.ts +33 -0
  180. package/dist/bridges/validity.d.ts.map +1 -0
  181. package/dist/bridges/validity.js +67 -0
  182. package/dist/bridges/validity.js.map +1 -0
  183. package/dist/canonical/entries/atomic.js +1 -3
  184. package/dist/canonical/entries/atomic.js.map +1 -1
  185. package/dist/canonical/entries/condensed-matter.d.ts.map +1 -1
  186. package/dist/canonical/entries/condensed-matter.js +4 -5
  187. package/dist/canonical/entries/condensed-matter.js.map +1 -1
  188. package/dist/canonical/entries/dimensional-classics.d.ts.map +1 -1
  189. package/dist/canonical/entries/dimensional-classics.js +3 -4
  190. package/dist/canonical/entries/dimensional-classics.js.map +1 -1
  191. package/dist/canonical/entries/electromagnetism.d.ts.map +1 -1
  192. package/dist/canonical/entries/electromagnetism.js +4 -10
  193. package/dist/canonical/entries/electromagnetism.js.map +1 -1
  194. package/dist/canonical/entries/fluids-waves.d.ts.map +1 -1
  195. package/dist/canonical/entries/fluids-waves.js +3 -7
  196. package/dist/canonical/entries/fluids-waves.js.map +1 -1
  197. package/dist/canonical/entries/mechanics.d.ts.map +1 -1
  198. package/dist/canonical/entries/mechanics.js +4 -6
  199. package/dist/canonical/entries/mechanics.js.map +1 -1
  200. package/dist/canonical/entries/nonmonomial.d.ts.map +1 -1
  201. package/dist/canonical/entries/nonmonomial.js +9 -17
  202. package/dist/canonical/entries/nonmonomial.js.map +1 -1
  203. package/dist/canonical/entries/relativity.d.ts.map +1 -1
  204. package/dist/canonical/entries/relativity.js +6 -6
  205. package/dist/canonical/entries/relativity.js.map +1 -1
  206. package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts.map +1 -1
  207. package/dist/canonical/entries/thermo-nuclear-cosmo.js +6 -10
  208. package/dist/canonical/entries/thermo-nuclear-cosmo.js.map +1 -1
  209. package/dist/canonical/fixed-points.d.ts +94 -0
  210. package/dist/canonical/fixed-points.d.ts.map +1 -0
  211. package/dist/canonical/fixed-points.js +81 -0
  212. package/dist/canonical/fixed-points.js.map +1 -0
  213. package/dist/canonical/linkage.d.ts.map +1 -1
  214. package/dist/canonical/linkage.js +25 -44
  215. package/dist/canonical/linkage.js.map +1 -1
  216. package/dist/canonical/normal-form.d.ts.map +1 -1
  217. package/dist/canonical/normal-form.js +5 -11
  218. package/dist/canonical/normal-form.js.map +1 -1
  219. package/dist/canonical/structural.d.ts +21 -21
  220. package/dist/canonical/structural.d.ts.map +1 -1
  221. package/dist/canonical/structural.js +40 -19
  222. package/dist/canonical/structural.js.map +1 -1
  223. package/dist/cases/catalog-checks.d.ts +10 -0
  224. package/dist/cases/catalog-checks.d.ts.map +1 -0
  225. package/dist/cases/catalog-checks.js +241 -0
  226. package/dist/cases/catalog-checks.js.map +1 -0
  227. package/dist/cases/catalog.d.ts +83 -0
  228. package/dist/cases/catalog.d.ts.map +1 -0
  229. package/dist/cases/catalog.js +118 -0
  230. package/dist/cases/catalog.js.map +1 -0
  231. package/dist/cases/engine.d.ts +13 -0
  232. package/dist/cases/engine.d.ts.map +1 -0
  233. package/dist/cases/engine.js +179 -0
  234. package/dist/cases/engine.js.map +1 -0
  235. package/dist/cases/index.d.ts.map +1 -1
  236. package/dist/cases/index.js +5 -7
  237. package/dist/cases/index.js.map +1 -1
  238. package/dist/cases/methods.d.ts +215 -0
  239. package/dist/cases/methods.d.ts.map +1 -0
  240. package/dist/cases/methods.js +743 -0
  241. package/dist/cases/methods.js.map +1 -0
  242. package/dist/cases/quadrature.d.ts +7 -9
  243. package/dist/cases/quadrature.d.ts.map +1 -1
  244. package/dist/cases/quadrature.js +28 -32
  245. package/dist/cases/quadrature.js.map +1 -1
  246. package/dist/cases/types.d.ts +12 -0
  247. package/dist/cases/types.d.ts.map +1 -1
  248. package/dist/cases/types.js.map +1 -1
  249. package/dist/cli/args.d.ts +25 -1
  250. package/dist/cli/args.d.ts.map +1 -1
  251. package/dist/cli/args.js +30 -8
  252. package/dist/cli/args.js.map +1 -1
  253. package/dist/cli/bindings.d.ts.map +1 -1
  254. package/dist/cli/bindings.js +5 -4
  255. package/dist/cli/bindings.js.map +1 -1
  256. package/dist/cli/command.d.ts +11 -1
  257. package/dist/cli/command.d.ts.map +1 -1
  258. package/dist/cli/command.js.map +1 -1
  259. package/dist/cli/commands/_atlas-map.d.ts +0 -9
  260. package/dist/cli/commands/_atlas-map.d.ts.map +1 -1
  261. package/dist/cli/commands/_atlas-map.js +8 -18
  262. package/dist/cli/commands/_atlas-map.js.map +1 -1
  263. package/dist/cli/commands/_atlas-route.d.ts.map +1 -1
  264. package/dist/cli/commands/_atlas-route.js +6 -2
  265. package/dist/cli/commands/_atlas-route.js.map +1 -1
  266. package/dist/cli/commands/_discovery-opts.d.ts +1 -0
  267. package/dist/cli/commands/_discovery-opts.d.ts.map +1 -1
  268. package/dist/cli/commands/_discovery-opts.js +9 -9
  269. package/dist/cli/commands/_discovery-opts.js.map +1 -1
  270. package/dist/cli/commands/atlas.d.ts.map +1 -1
  271. package/dist/cli/commands/atlas.js +8 -5
  272. package/dist/cli/commands/atlas.js.map +1 -1
  273. package/dist/cli/commands/audit.d.ts.map +1 -1
  274. package/dist/cli/commands/audit.js +8 -1
  275. package/dist/cli/commands/audit.js.map +1 -1
  276. package/dist/cli/commands/axes.d.ts.map +1 -1
  277. package/dist/cli/commands/axes.js +20 -1
  278. package/dist/cli/commands/axes.js.map +1 -1
  279. package/dist/cli/commands/confront.d.ts.map +1 -1
  280. package/dist/cli/commands/confront.js +8 -14
  281. package/dist/cli/commands/confront.js.map +1 -1
  282. package/dist/cli/commands/derive.d.ts.map +1 -1
  283. package/dist/cli/commands/derive.js +22 -22
  284. package/dist/cli/commands/derive.js.map +1 -1
  285. package/dist/cli/commands/discover.d.ts.map +1 -1
  286. package/dist/cli/commands/discover.js +122 -73
  287. package/dist/cli/commands/discover.js.map +1 -1
  288. package/dist/cli/commands/eval.d.ts.map +1 -1
  289. package/dist/cli/commands/eval.js +1 -0
  290. package/dist/cli/commands/eval.js.map +1 -1
  291. package/dist/cli/commands/evaluate.d.ts.map +1 -1
  292. package/dist/cli/commands/evaluate.js +67 -39
  293. package/dist/cli/commands/evaluate.js.map +1 -1
  294. package/dist/cli/commands/explain.d.ts.map +1 -1
  295. package/dist/cli/commands/explain.js +24 -3
  296. package/dist/cli/commands/explain.js.map +1 -1
  297. package/dist/cli/commands/ground.d.ts.map +1 -1
  298. package/dist/cli/commands/ground.js +7 -1
  299. package/dist/cli/commands/ground.js.map +1 -1
  300. package/dist/cli/commands/map.d.ts.map +1 -1
  301. package/dist/cli/commands/map.js +84 -11
  302. package/dist/cli/commands/map.js.map +1 -1
  303. package/dist/cli/commands/metric.d.ts.map +1 -1
  304. package/dist/cli/commands/metric.js +12 -9
  305. package/dist/cli/commands/metric.js.map +1 -1
  306. package/dist/cli/commands/path.d.ts +10 -0
  307. package/dist/cli/commands/path.d.ts.map +1 -1
  308. package/dist/cli/commands/path.js +25 -3
  309. package/dist/cli/commands/path.js.map +1 -1
  310. package/dist/cli/commands/probe.d.ts.map +1 -1
  311. package/dist/cli/commands/probe.js +59 -16
  312. package/dist/cli/commands/probe.js.map +1 -1
  313. package/dist/cli/commands/regime.d.ts.map +1 -1
  314. package/dist/cli/commands/regime.js +1 -0
  315. package/dist/cli/commands/regime.js.map +1 -1
  316. package/dist/cli/commands/retrieve.d.ts.map +1 -1
  317. package/dist/cli/commands/retrieve.js +1 -0
  318. package/dist/cli/commands/retrieve.js.map +1 -1
  319. package/dist/cli/commands/search.d.ts.map +1 -1
  320. package/dist/cli/commands/search.js +1 -0
  321. package/dist/cli/commands/search.js.map +1 -1
  322. package/dist/cli/commands/symbolic.d.ts.map +1 -1
  323. package/dist/cli/commands/symbolic.js +19 -28
  324. package/dist/cli/commands/symbolic.js.map +1 -1
  325. package/dist/cli/commands/testplan.d.ts.map +1 -1
  326. package/dist/cli/commands/testplan.js +4 -2
  327. package/dist/cli/commands/testplan.js.map +1 -1
  328. package/dist/cli/determination.d.ts +1 -0
  329. package/dist/cli/determination.d.ts.map +1 -1
  330. package/dist/cli/determination.js.map +1 -1
  331. package/dist/cli/expr-print.d.ts +0 -2
  332. package/dist/cli/expr-print.d.ts.map +1 -1
  333. package/dist/cli/expr-print.js +7 -31
  334. package/dist/cli/expr-print.js.map +1 -1
  335. package/dist/cli/flag-help.d.ts +1 -0
  336. package/dist/cli/flag-help.d.ts.map +1 -1
  337. package/dist/cli/flag-help.js +1 -0
  338. package/dist/cli/flag-help.js.map +1 -1
  339. package/dist/cli/graphs.d.ts +2 -0
  340. package/dist/cli/graphs.d.ts.map +1 -1
  341. package/dist/cli/graphs.js +1 -0
  342. package/dist/cli/graphs.js.map +1 -1
  343. package/dist/cli/main.d.ts +8 -0
  344. package/dist/cli/main.d.ts.map +1 -1
  345. package/dist/cli/main.js +19 -3
  346. package/dist/cli/main.js.map +1 -1
  347. package/dist/cli/numeric-flag.d.ts +12 -0
  348. package/dist/cli/numeric-flag.d.ts.map +1 -0
  349. package/dist/cli/numeric-flag.js +44 -0
  350. package/dist/cli/numeric-flag.js.map +1 -0
  351. package/dist/cli/output.d.ts +28 -0
  352. package/dist/cli/output.d.ts.map +1 -1
  353. package/dist/cli/output.js +23 -0
  354. package/dist/cli/output.js.map +1 -1
  355. package/dist/cli/record-reach.js +2 -2
  356. package/dist/cli/record-reach.js.map +1 -1
  357. package/dist/cli/record-tables.d.ts.map +1 -1
  358. package/dist/cli/record-tables.js +6 -5
  359. package/dist/cli/record-tables.js.map +1 -1
  360. package/dist/cli/record.d.ts +1 -5
  361. package/dist/cli/record.d.ts.map +1 -1
  362. package/dist/cli/record.js +9 -8
  363. package/dist/cli/record.js.map +1 -1
  364. package/dist/cli/search-index.d.ts.map +1 -1
  365. package/dist/cli/search-index.js +7 -6
  366. package/dist/cli/search-index.js.map +1 -1
  367. package/dist/cli/statuses.d.ts +0 -2
  368. package/dist/cli/statuses.d.ts.map +1 -1
  369. package/dist/cli/statuses.js +12 -9
  370. package/dist/cli/statuses.js.map +1 -1
  371. package/dist/cli/stored-results.d.ts +7 -0
  372. package/dist/cli/stored-results.d.ts.map +1 -0
  373. package/dist/cli/stored-results.js +23 -0
  374. package/dist/cli/stored-results.js.map +1 -0
  375. package/dist/cli/version.d.ts +1 -0
  376. package/dist/cli/version.d.ts.map +1 -1
  377. package/dist/cli/version.js +8 -5
  378. package/dist/cli/version.js.map +1 -1
  379. package/dist/cli-api.d.ts +36 -5
  380. package/dist/cli-api.d.ts.map +1 -1
  381. package/dist/cli-api.js +30 -4
  382. package/dist/cli-api.js.map +1 -1
  383. package/dist/composition/algebraic-equivalence.d.ts +43 -0
  384. package/dist/composition/algebraic-equivalence.d.ts.map +1 -0
  385. package/dist/composition/algebraic-equivalence.js +115 -0
  386. package/dist/composition/algebraic-equivalence.js.map +1 -0
  387. package/dist/composition/axes.d.ts +0 -6
  388. package/dist/composition/axes.d.ts.map +1 -1
  389. package/dist/composition/axes.js +6 -6
  390. package/dist/composition/axes.js.map +1 -1
  391. package/dist/composition/axis-audit.d.ts +47 -20
  392. package/dist/composition/axis-audit.d.ts.map +1 -1
  393. package/dist/composition/axis-audit.js +82 -9
  394. package/dist/composition/axis-audit.js.map +1 -1
  395. package/dist/composition/bridge-analysis.d.ts +17 -0
  396. package/dist/composition/bridge-analysis.d.ts.map +1 -1
  397. package/dist/composition/bridge-analysis.js +102 -55
  398. package/dist/composition/bridge-analysis.js.map +1 -1
  399. package/dist/composition/canonical-compare.d.ts +40 -0
  400. package/dist/composition/canonical-compare.d.ts.map +1 -1
  401. package/dist/composition/canonical-compare.js +122 -24
  402. package/dist/composition/canonical-compare.js.map +1 -1
  403. package/dist/composition/canonical-graph.d.ts +3 -3
  404. package/dist/composition/canonical-graph.d.ts.map +1 -1
  405. package/dist/composition/canonical-graph.js +11 -38
  406. package/dist/composition/canonical-graph.js.map +1 -1
  407. package/dist/composition/canonical-json.js +2 -2
  408. package/dist/composition/canonical-json.js.map +1 -1
  409. package/dist/composition/catalog-graph.d.ts.map +1 -1
  410. package/dist/composition/catalog-graph.js +2 -5
  411. package/dist/composition/catalog-graph.js.map +1 -1
  412. package/dist/composition/chain-candidate.d.ts +8 -0
  413. package/dist/composition/chain-candidate.d.ts.map +1 -1
  414. package/dist/composition/chain-candidate.js +9 -2
  415. package/dist/composition/chain-candidate.js.map +1 -1
  416. package/dist/composition/chain-match.d.ts +6 -3
  417. package/dist/composition/chain-match.d.ts.map +1 -1
  418. package/dist/composition/chain-match.js +4 -1
  419. package/dist/composition/chain-match.js.map +1 -1
  420. package/dist/composition/chain-result.d.ts.map +1 -1
  421. package/dist/composition/chain-result.js +2 -14
  422. package/dist/composition/chain-result.js.map +1 -1
  423. package/dist/composition/compose-symbolic.d.ts.map +1 -1
  424. package/dist/composition/compose-symbolic.js +3 -2
  425. package/dist/composition/compose-symbolic.js.map +1 -1
  426. package/dist/composition/compose.d.ts.map +1 -1
  427. package/dist/composition/compose.js +13 -5
  428. package/dist/composition/compose.js.map +1 -1
  429. package/dist/composition/composition-recovery.d.ts.map +1 -1
  430. package/dist/composition/composition-recovery.js +4 -7
  431. package/dist/composition/composition-recovery.js.map +1 -1
  432. package/dist/composition/consequence.d.ts +15 -5
  433. package/dist/composition/consequence.d.ts.map +1 -1
  434. package/dist/composition/consequence.js +6 -4
  435. package/dist/composition/consequence.js.map +1 -1
  436. package/dist/composition/discovery.d.ts +129 -9
  437. package/dist/composition/discovery.d.ts.map +1 -1
  438. package/dist/composition/discovery.js +171 -67
  439. package/dist/composition/discovery.js.map +1 -1
  440. package/dist/composition/edge.d.ts +21 -2
  441. package/dist/composition/edge.d.ts.map +1 -1
  442. package/dist/composition/edge.js +23 -1
  443. package/dist/composition/edge.js.map +1 -1
  444. package/dist/composition/enumerate.d.ts.map +1 -1
  445. package/dist/composition/enumerate.js +18 -3
  446. package/dist/composition/enumerate.js.map +1 -1
  447. package/dist/composition/evaluate-relation.d.ts +35 -11
  448. package/dist/composition/evaluate-relation.d.ts.map +1 -1
  449. package/dist/composition/evaluate-relation.js +60 -39
  450. package/dist/composition/evaluate-relation.js.map +1 -1
  451. package/dist/composition/explain.d.ts +3 -12
  452. package/dist/composition/explain.d.ts.map +1 -1
  453. package/dist/composition/explain.js +7 -20
  454. package/dist/composition/explain.js.map +1 -1
  455. package/dist/composition/expr-eval.d.ts +1 -1
  456. package/dist/composition/expr-eval.d.ts.map +1 -1
  457. package/dist/composition/expr-eval.js +6 -15
  458. package/dist/composition/expr-eval.js.map +1 -1
  459. package/dist/composition/expr-simplify.d.ts +26 -14
  460. package/dist/composition/expr-simplify.d.ts.map +1 -1
  461. package/dist/composition/expr-simplify.js +64 -72
  462. package/dist/composition/expr-simplify.js.map +1 -1
  463. package/dist/composition/formula-shape.d.ts +23 -4
  464. package/dist/composition/formula-shape.d.ts.map +1 -1
  465. package/dist/composition/formula-shape.js +57 -17
  466. package/dist/composition/formula-shape.js.map +1 -1
  467. package/dist/composition/graph-structure.d.ts +98 -0
  468. package/dist/composition/graph-structure.d.ts.map +1 -0
  469. package/dist/composition/graph-structure.js +167 -0
  470. package/dist/composition/graph-structure.js.map +1 -0
  471. package/dist/composition/graph-viz-svg.d.ts.map +1 -1
  472. package/dist/composition/graph-viz-svg.js +1 -1
  473. package/dist/composition/graph-viz-svg.js.map +1 -1
  474. package/dist/composition/graph-viz.d.ts.map +1 -1
  475. package/dist/composition/graph-viz.js +8 -37
  476. package/dist/composition/graph-viz.js.map +1 -1
  477. package/dist/composition/grounding.d.ts.map +1 -1
  478. package/dist/composition/grounding.js +19 -7
  479. package/dist/composition/grounding.js.map +1 -1
  480. package/dist/composition/identifiability.d.ts +91 -4
  481. package/dist/composition/identifiability.d.ts.map +1 -1
  482. package/dist/composition/identifiability.js +363 -6
  483. package/dist/composition/identifiability.js.map +1 -1
  484. package/dist/composition/index.d.ts +8 -4
  485. package/dist/composition/index.d.ts.map +1 -1
  486. package/dist/composition/index.js +3 -2
  487. package/dist/composition/index.js.map +1 -1
  488. package/dist/composition/mathts-quiet.d.ts +7 -8
  489. package/dist/composition/mathts-quiet.d.ts.map +1 -1
  490. package/dist/composition/mathts-quiet.js +7 -16
  491. package/dist/composition/mathts-quiet.js.map +1 -1
  492. package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -1
  493. package/dist/composition/mathts-scalar-symbols.js +2 -1
  494. package/dist/composition/mathts-scalar-symbols.js.map +1 -1
  495. package/dist/composition/own-equation-magnitude.d.ts +95 -0
  496. package/dist/composition/own-equation-magnitude.d.ts.map +1 -0
  497. package/dist/composition/own-equation-magnitude.js +270 -0
  498. package/dist/composition/own-equation-magnitude.js.map +1 -0
  499. package/dist/composition/probe/backend-protocol.d.ts +3 -0
  500. package/dist/composition/probe/backend-protocol.d.ts.map +1 -1
  501. package/dist/composition/probe/backend-protocol.js.map +1 -1
  502. package/dist/composition/probe/candidate-store.d.ts +1 -0
  503. package/dist/composition/probe/candidate-store.d.ts.map +1 -1
  504. package/dist/composition/probe/candidate-store.js +1 -0
  505. package/dist/composition/probe/candidate-store.js.map +1 -1
  506. package/dist/composition/probe/corpus.d.ts +8 -4
  507. package/dist/composition/probe/corpus.d.ts.map +1 -1
  508. package/dist/composition/probe/corpus.js +23 -12
  509. package/dist/composition/probe/corpus.js.map +1 -1
  510. package/dist/composition/probe/dataset.d.ts +18 -0
  511. package/dist/composition/probe/dataset.d.ts.map +1 -1
  512. package/dist/composition/probe/dataset.js +95 -50
  513. package/dist/composition/probe/dataset.js.map +1 -1
  514. package/dist/composition/probe/experiment-design.d.ts +7 -1
  515. package/dist/composition/probe/experiment-design.d.ts.map +1 -1
  516. package/dist/composition/probe/experiment-design.js +44 -24
  517. package/dist/composition/probe/experiment-design.js.map +1 -1
  518. package/dist/composition/probe/falsify.d.ts +2 -0
  519. package/dist/composition/probe/falsify.d.ts.map +1 -1
  520. package/dist/composition/probe/falsify.js +2 -0
  521. package/dist/composition/probe/falsify.js.map +1 -1
  522. package/dist/composition/probe/fit.d.ts +7 -0
  523. package/dist/composition/probe/fit.d.ts.map +1 -1
  524. package/dist/composition/probe/fit.js +46 -22
  525. package/dist/composition/probe/fit.js.map +1 -1
  526. package/dist/composition/probe/frontier.d.ts.map +1 -1
  527. package/dist/composition/probe/frontier.js +33 -15
  528. package/dist/composition/probe/frontier.js.map +1 -1
  529. package/dist/composition/probe/generator.d.ts +30 -1
  530. package/dist/composition/probe/generator.d.ts.map +1 -1
  531. package/dist/composition/probe/generator.js +58 -36
  532. package/dist/composition/probe/generator.js.map +1 -1
  533. package/dist/composition/probe/index.d.ts +14 -0
  534. package/dist/composition/probe/index.d.ts.map +1 -1
  535. package/dist/composition/probe/index.js +6 -0
  536. package/dist/composition/probe/index.js.map +1 -1
  537. package/dist/composition/probe/limits.d.ts +25 -1
  538. package/dist/composition/probe/limits.d.ts.map +1 -1
  539. package/dist/composition/probe/limits.js +53 -11
  540. package/dist/composition/probe/limits.js.map +1 -1
  541. package/dist/composition/probe/pipeline.d.ts +5 -0
  542. package/dist/composition/probe/pipeline.d.ts.map +1 -1
  543. package/dist/composition/probe/pipeline.js +73 -24
  544. package/dist/composition/probe/pipeline.js.map +1 -1
  545. package/dist/composition/probe/power-law.d.ts +121 -0
  546. package/dist/composition/probe/power-law.d.ts.map +1 -0
  547. package/dist/composition/probe/power-law.js +251 -0
  548. package/dist/composition/probe/power-law.js.map +1 -0
  549. package/dist/composition/probe/problem.d.ts +8 -4
  550. package/dist/composition/probe/problem.d.ts.map +1 -1
  551. package/dist/composition/probe/problem.js +177 -49
  552. package/dist/composition/probe/problem.js.map +1 -1
  553. package/dist/composition/probe/report.js +1 -1
  554. package/dist/composition/probe/report.js.map +1 -1
  555. package/dist/composition/probe/residual.d.ts +7 -1
  556. package/dist/composition/probe/residual.d.ts.map +1 -1
  557. package/dist/composition/probe/residual.js +10 -7
  558. package/dist/composition/probe/residual.js.map +1 -1
  559. package/dist/composition/probe/run-manifest.d.ts +1 -0
  560. package/dist/composition/probe/run-manifest.d.ts.map +1 -1
  561. package/dist/composition/probe/run-manifest.js.map +1 -1
  562. package/dist/composition/probe/scalar-search.d.ts +50 -0
  563. package/dist/composition/probe/scalar-search.d.ts.map +1 -0
  564. package/dist/composition/probe/scalar-search.js +169 -0
  565. package/dist/composition/probe/scalar-search.js.map +1 -0
  566. package/dist/composition/probe/scoring.d.ts +1 -0
  567. package/dist/composition/probe/scoring.d.ts.map +1 -1
  568. package/dist/composition/probe/scoring.js.map +1 -1
  569. package/dist/composition/probe/structure.d.ts +82 -17
  570. package/dist/composition/probe/structure.d.ts.map +1 -1
  571. package/dist/composition/probe/structure.js +129 -55
  572. package/dist/composition/probe/structure.js.map +1 -1
  573. package/dist/composition/probe/study.d.ts +31 -9
  574. package/dist/composition/probe/study.d.ts.map +1 -1
  575. package/dist/composition/probe/study.js +235 -184
  576. package/dist/composition/probe/study.js.map +1 -1
  577. package/dist/composition/probe/t-tail.d.ts +16 -0
  578. package/dist/composition/probe/t-tail.d.ts.map +1 -0
  579. package/dist/composition/probe/t-tail.js +29 -0
  580. package/dist/composition/probe/t-tail.js.map +1 -0
  581. package/dist/composition/probe/types.d.ts +3 -0
  582. package/dist/composition/probe/types.d.ts.map +1 -1
  583. package/dist/composition/probe/types.js.map +1 -1
  584. package/dist/composition/proposed-bridges.d.ts +52 -12
  585. package/dist/composition/proposed-bridges.d.ts.map +1 -1
  586. package/dist/composition/proposed-bridges.js +107 -60
  587. package/dist/composition/proposed-bridges.js.map +1 -1
  588. package/dist/composition/quantity-clusters.d.ts +48 -0
  589. package/dist/composition/quantity-clusters.d.ts.map +1 -0
  590. package/dist/composition/quantity-clusters.js +98 -0
  591. package/dist/composition/quantity-clusters.js.map +1 -0
  592. package/dist/composition/rational-exponent.d.ts +40 -0
  593. package/dist/composition/rational-exponent.d.ts.map +1 -0
  594. package/dist/composition/rational-exponent.js +65 -0
  595. package/dist/composition/rational-exponent.js.map +1 -0
  596. package/dist/composition/representative-values.d.ts +22 -0
  597. package/dist/composition/representative-values.d.ts.map +1 -1
  598. package/dist/composition/representative-values.js +29 -0
  599. package/dist/composition/representative-values.js.map +1 -1
  600. package/dist/composition/retrodiction.d.ts +15 -0
  601. package/dist/composition/retrodiction.d.ts.map +1 -1
  602. package/dist/composition/retrodiction.js +12 -4
  603. package/dist/composition/retrodiction.js.map +1 -1
  604. package/dist/composition/user-equation.d.ts +1 -0
  605. package/dist/composition/user-equation.d.ts.map +1 -1
  606. package/dist/composition/user-equation.js +3 -2
  607. package/dist/composition/user-equation.js.map +1 -1
  608. package/dist/core/assignment.d.ts +19 -0
  609. package/dist/core/assignment.d.ts.map +1 -0
  610. package/dist/core/assignment.js +19 -0
  611. package/dist/core/assignment.js.map +1 -0
  612. package/dist/core/compare.d.ts +32 -0
  613. package/dist/core/compare.d.ts.map +1 -0
  614. package/dist/core/compare.js +46 -0
  615. package/dist/core/compare.js.map +1 -0
  616. package/dist/core/constants.d.ts +42 -41
  617. package/dist/core/constants.d.ts.map +1 -1
  618. package/dist/core/constants.js +71 -51
  619. package/dist/core/constants.js.map +1 -1
  620. package/dist/core/data-file.d.ts +7 -0
  621. package/dist/core/data-file.d.ts.map +1 -1
  622. package/dist/core/data-file.js +17 -0
  623. package/dist/core/data-file.js.map +1 -1
  624. package/dist/core/format.d.ts +36 -0
  625. package/dist/core/format.d.ts.map +1 -0
  626. package/dist/core/format.js +39 -0
  627. package/dist/core/format.js.map +1 -0
  628. package/dist/core/hash.d.ts +14 -0
  629. package/dist/core/hash.d.ts.map +1 -0
  630. package/dist/core/hash.js +17 -0
  631. package/dist/core/hash.js.map +1 -0
  632. package/dist/core/json-schema.d.ts +2 -0
  633. package/dist/core/json-schema.d.ts.map +1 -1
  634. package/dist/core/json-schema.js +14 -13
  635. package/dist/core/json-schema.js.map +1 -1
  636. package/dist/core/labeled-tensor.d.ts.map +1 -1
  637. package/dist/core/labeled-tensor.js +0 -8
  638. package/dist/core/labeled-tensor.js.map +1 -1
  639. package/dist/core/mathts-read.d.ts +25 -0
  640. package/dist/core/mathts-read.d.ts.map +1 -0
  641. package/dist/core/mathts-read.js +51 -0
  642. package/dist/core/mathts-read.js.map +1 -0
  643. package/dist/core/tensor.d.ts.map +1 -1
  644. package/dist/core/tensor.js +24 -0
  645. package/dist/core/tensor.js.map +1 -1
  646. package/dist/core/types.d.ts +5 -5
  647. package/dist/diff/bridge-ast-gradient.d.ts +27 -23
  648. package/dist/diff/bridge-ast-gradient.d.ts.map +1 -1
  649. package/dist/diff/bridge-ast-gradient.js +75 -173
  650. package/dist/diff/bridge-ast-gradient.js.map +1 -1
  651. package/dist/diff/bridge-gradient.d.ts +19 -6
  652. package/dist/diff/bridge-gradient.d.ts.map +1 -1
  653. package/dist/diff/bridge-gradient.js +19 -11
  654. package/dist/diff/bridge-gradient.js.map +1 -1
  655. package/dist/diff/bridge-specs.d.ts.map +1 -1
  656. package/dist/diff/bridge-specs.js +3 -0
  657. package/dist/diff/bridge-specs.js.map +1 -1
  658. package/dist/dimensional/algebra.d.ts +18 -0
  659. package/dist/dimensional/algebra.d.ts.map +1 -1
  660. package/dist/dimensional/algebra.js +41 -1
  661. package/dist/dimensional/algebra.js.map +1 -1
  662. package/dist/dimensional/ast-builders.d.ts +7 -0
  663. package/dist/dimensional/ast-builders.d.ts.map +1 -1
  664. package/dist/dimensional/ast-builders.js +11 -0
  665. package/dist/dimensional/ast-builders.js.map +1 -1
  666. package/dist/dimensional/ast-leaves.d.ts +81 -0
  667. package/dist/dimensional/ast-leaves.d.ts.map +1 -0
  668. package/dist/dimensional/ast-leaves.js +146 -0
  669. package/dist/dimensional/ast-leaves.js.map +1 -0
  670. package/dist/dimensional/ast-types.d.ts +15 -0
  671. package/dist/dimensional/ast-types.d.ts.map +1 -1
  672. package/dist/dimensional/ast-types.js.map +1 -1
  673. package/dist/dimensional/buckingham.d.ts.map +1 -1
  674. package/dist/dimensional/buckingham.js +15 -27
  675. package/dist/dimensional/buckingham.js.map +1 -1
  676. package/dist/dimensional/constant-rows.js +9 -9
  677. package/dist/dimensional/constant-rows.js.map +1 -1
  678. package/dist/dimensional/curvature-composite.d.ts +1 -1
  679. package/dist/dimensional/curvature-composite.js.map +1 -1
  680. package/dist/dimensional/dimension-inference.d.ts.map +1 -1
  681. package/dist/dimensional/dimension-inference.js +1 -2
  682. package/dist/dimensional/dimension-inference.js.map +1 -1
  683. package/dist/dimensional/errors.d.ts +1 -1
  684. package/dist/dimensional/errors.d.ts.map +1 -1
  685. package/dist/dimensional/errors.js +1 -15
  686. package/dist/dimensional/errors.js.map +1 -1
  687. package/dist/dimensional/exact-scale.d.ts +24 -11
  688. package/dist/dimensional/exact-scale.d.ts.map +1 -1
  689. package/dist/dimensional/exact-scale.js +122 -130
  690. package/dist/dimensional/exact-scale.js.map +1 -1
  691. package/dist/dimensional/gauge-field.d.ts.map +1 -1
  692. package/dist/dimensional/gauge-field.js +2 -2
  693. package/dist/dimensional/gauge-field.js.map +1 -1
  694. package/dist/dimensional/hyphen-names.d.ts +12 -2
  695. package/dist/dimensional/hyphen-names.d.ts.map +1 -1
  696. package/dist/dimensional/hyphen-names.js +44 -19
  697. package/dist/dimensional/hyphen-names.js.map +1 -1
  698. package/dist/dimensional/mathts-unit-delegation.d.ts +29 -0
  699. package/dist/dimensional/mathts-unit-delegation.d.ts.map +1 -0
  700. package/dist/dimensional/mathts-unit-delegation.js +187 -0
  701. package/dist/dimensional/mathts-unit-delegation.js.map +1 -0
  702. package/dist/dimensional/mathts-unit-wrapper.d.ts +33 -0
  703. package/dist/dimensional/mathts-unit-wrapper.d.ts.map +1 -0
  704. package/dist/dimensional/mathts-unit-wrapper.js +190 -0
  705. package/dist/dimensional/mathts-unit-wrapper.js.map +1 -0
  706. package/dist/dimensional/metric.d.ts.map +1 -1
  707. package/dist/dimensional/metric.js +0 -1
  708. package/dist/dimensional/metric.js.map +1 -1
  709. package/dist/dimensional/scalar-lowering.d.ts +21 -0
  710. package/dist/dimensional/scalar-lowering.d.ts.map +1 -0
  711. package/dist/dimensional/scalar-lowering.js +45 -0
  712. package/dist/dimensional/scalar-lowering.js.map +1 -0
  713. package/dist/dimensional/symbolic-constants.d.ts +9 -0
  714. package/dist/dimensional/symbolic-constants.d.ts.map +1 -1
  715. package/dist/dimensional/symbolic-constants.js +13 -1
  716. package/dist/dimensional/symbolic-constants.js.map +1 -1
  717. package/dist/dimensional/types.d.ts +36 -0
  718. package/dist/dimensional/types.d.ts.map +1 -1
  719. package/dist/dimensional/types.js +45 -7
  720. package/dist/dimensional/types.js.map +1 -1
  721. package/dist/dimensional/unit-data.d.ts +5 -1
  722. package/dist/dimensional/unit-data.d.ts.map +1 -1
  723. package/dist/dimensional/unit-data.js +30 -6
  724. package/dist/dimensional/unit-data.js.map +1 -1
  725. package/dist/dimensional/units.d.ts +2 -0
  726. package/dist/dimensional/units.d.ts.map +1 -1
  727. package/dist/dimensional/units.js +59 -3
  728. package/dist/dimensional/units.js.map +1 -1
  729. package/dist/dimensional/validator.d.ts +2 -0
  730. package/dist/dimensional/validator.d.ts.map +1 -1
  731. package/dist/dimensional/validator.js.map +1 -1
  732. package/dist/index.d.ts +9 -3
  733. package/dist/index.d.ts.map +1 -1
  734. package/dist/index.js +10 -4
  735. package/dist/index.js.map +1 -1
  736. package/dist/numerical/christoffel-flat.d.ts.map +1 -1
  737. package/dist/numerical/christoffel-flat.js +3 -2
  738. package/dist/numerical/christoffel-flat.js.map +1 -1
  739. package/dist/numerical/connection-lowering-helpers.d.ts +3 -1
  740. package/dist/numerical/connection-lowering-helpers.d.ts.map +1 -1
  741. package/dist/numerical/connection-lowering-helpers.js +11 -15
  742. package/dist/numerical/connection-lowering-helpers.js.map +1 -1
  743. package/dist/numerical/covariant-eikonal.d.ts.map +1 -1
  744. package/dist/numerical/covariant-eikonal.js +34 -11
  745. package/dist/numerical/covariant-eikonal.js.map +1 -1
  746. package/dist/numerical/curvature-lowering-helpers.js +3 -2
  747. package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
  748. package/dist/numerical/errors.d.ts.map +1 -1
  749. package/dist/numerical/errors.js +0 -3
  750. package/dist/numerical/errors.js.map +1 -1
  751. package/dist/numerical/finite-difference.d.ts +22 -0
  752. package/dist/numerical/finite-difference.d.ts.map +1 -0
  753. package/dist/numerical/finite-difference.js +27 -0
  754. package/dist/numerical/finite-difference.js.map +1 -0
  755. package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
  756. package/dist/numerical/geodesic-integrator.js +22 -14
  757. package/dist/numerical/geodesic-integrator.js.map +1 -1
  758. package/dist/numerical/geometrized.d.ts.map +1 -1
  759. package/dist/numerical/geometrized.js +0 -1
  760. package/dist/numerical/geometrized.js.map +1 -1
  761. package/dist/numerical/mathts-engine.d.ts.map +1 -1
  762. package/dist/numerical/mathts-engine.js +10 -24
  763. package/dist/numerical/mathts-engine.js.map +1 -1
  764. package/dist/numerical/metric-inverse.d.ts.map +1 -1
  765. package/dist/numerical/metric-inverse.js +83 -46
  766. package/dist/numerical/metric-inverse.js.map +1 -1
  767. package/dist/numerical/null-ray-integrator.d.ts +2 -1
  768. package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
  769. package/dist/numerical/null-ray-integrator.js +12 -12
  770. package/dist/numerical/null-ray-integrator.js.map +1 -1
  771. package/dist/numerical/painleve-gullstrand-metric.js +2 -2
  772. package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
  773. package/dist/numerical/pderiv.d.ts.map +1 -1
  774. package/dist/numerical/pderiv.js +2 -6
  775. package/dist/numerical/pderiv.js.map +1 -1
  776. package/dist/numerical/perihelion-finder.d.ts +0 -36
  777. package/dist/numerical/perihelion-finder.d.ts.map +1 -1
  778. package/dist/numerical/perihelion-finder.js +41 -87
  779. package/dist/numerical/perihelion-finder.js.map +1 -1
  780. package/dist/numerical/quadrature.d.ts.map +1 -1
  781. package/dist/numerical/quadrature.js +11 -13
  782. package/dist/numerical/quadrature.js.map +1 -1
  783. package/dist/numerical/rk4-trajectory.d.ts +10 -0
  784. package/dist/numerical/rk4-trajectory.d.ts.map +1 -0
  785. package/dist/numerical/rk4-trajectory.js +37 -0
  786. package/dist/numerical/rk4-trajectory.js.map +1 -0
  787. package/dist/numerical/schwarzschild.d.ts +14 -0
  788. package/dist/numerical/schwarzschild.d.ts.map +1 -0
  789. package/dist/numerical/schwarzschild.js +17 -0
  790. package/dist/numerical/schwarzschild.js.map +1 -0
  791. package/dist/numerical/spacetime-metrics.d.ts +12 -0
  792. package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
  793. package/dist/numerical/spacetime-metrics.js +72 -56
  794. package/dist/numerical/spacetime-metrics.js.map +1 -1
  795. package/dist/numerical/statistics.d.ts +24 -0
  796. package/dist/numerical/statistics.d.ts.map +1 -0
  797. package/dist/numerical/statistics.js +52 -0
  798. package/dist/numerical/statistics.js.map +1 -0
  799. package/dist/numerical/strides.d.ts +3 -2
  800. package/dist/numerical/strides.d.ts.map +1 -1
  801. package/dist/numerical/strides.js +3 -10
  802. package/dist/numerical/strides.js.map +1 -1
  803. package/dist/numerical/tensor-engine.d.ts +21 -0
  804. package/dist/numerical/tensor-engine.d.ts.map +1 -1
  805. package/dist/numerical/tensor-engine.js +12 -0
  806. package/dist/numerical/tensor-engine.js.map +1 -1
  807. package/dist/relations/regime.d.ts +10 -0
  808. package/dist/relations/regime.d.ts.map +1 -1
  809. package/dist/relations/regime.js +18 -1
  810. package/dist/relations/regime.js.map +1 -1
  811. package/package.json +9 -12
  812. package/dist/cases/brownian-sphere.d.ts +0 -68
  813. package/dist/cases/brownian-sphere.d.ts.map +0 -1
  814. package/dist/cases/brownian-sphere.js +0 -354
  815. package/dist/cases/brownian-sphere.js.map +0 -1
  816. package/dist/cases/damped-resonator.d.ts +0 -23
  817. package/dist/cases/damped-resonator.d.ts.map +0 -1
  818. package/dist/cases/damped-resonator.js +0 -224
  819. package/dist/cases/damped-resonator.js.map +0 -1
  820. package/dist/cases/kepler-rv.d.ts +0 -13
  821. package/dist/cases/kepler-rv.d.ts.map +0 -1
  822. package/dist/cases/kepler-rv.js +0 -172
  823. package/dist/cases/kepler-rv.js.map +0 -1
  824. package/dist/cases/lumped-cooling.d.ts +0 -46
  825. package/dist/cases/lumped-cooling.d.ts.map +0 -1
  826. package/dist/cases/lumped-cooling.js +0 -261
  827. package/dist/cases/lumped-cooling.js.map +0 -1
  828. package/dist/cases/resistor-noise.d.ts +0 -14
  829. package/dist/cases/resistor-noise.d.ts.map +0 -1
  830. package/dist/cases/resistor-noise.js +0 -215
  831. package/dist/cases/resistor-noise.js.map +0 -1
  832. package/dist/cases/skin-depth.d.ts +0 -21
  833. package/dist/cases/skin-depth.d.ts.map +0 -1
  834. package/dist/cases/skin-depth.js +0 -174
  835. package/dist/cases/skin-depth.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"explain.js","sourceRoot":"","sources":["../../../src/cli/commands/explain.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAiC,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,mFAAmF;AACnF,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,MAAM,KAAK,GAAe;IACxB,UAAU,CAAC,SAAS,EAAE,mDAAmD,CAAC;IAC1E,SAAS;CACV,CAAC;AAEF,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;4DAwB+C,CAAC;AAE7D;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,GAAsB,EAAE,IAAuB;IACjE,MAAM,MAAM,GAAG,IAAI,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OAAO,CAAC,CAAC","sourcesContent":["/**\n * `upt explain` — explain how the graph determines a quantity: the\n * identifiability verdict, recovered value, derivation chains, and whether\n * the inputs are dimensionally sufficient. Transposed verbatim from\n * bin/upt.mjs's `explain()` + `parseKnown()` (lines 183-235), plus\n * `--source` (the old CLI's module-level `GRAPH` was always the catalog\n * graph) and `--json`.\n *\n * `parseKnown`'s two-mode positional contract (bare names XOR name=value,\n * never mixed) and its malformed-input rejections are pinned by\n * `tests/cli/upt-explain-inputs.test.ts` against the old bin — ported here\n * unchanged, with `process.exit(2)` sites converted to `UsageError` (same\n * message text; `main.ts`'s catch maps it to exit 2).\n */\nimport type { FlagSpec } from '../args.js';\nimport { registerCommand, type Command, type CommandCtx } from '../command.js';\nimport { commandHelp, JSON_FLAG, sourceFlag } from '../flag-help.js';\nimport { resolveGraph } from '../graphs.js';\nimport { emitJson } from '../output.js';\nimport { splitAssignments } from '../bindings.js';\nimport { UsageError, CliError } from '../errors.js';\nimport { searchNameWords } from '../search-index.js';\n\n/** How many `upt search` hits a NOT COVERED answer lists before \"… and N more\". */\nconst SEARCH_HITS_SHOWN = 5;\n\nconst FLAGS: FlagSpec[] = [\n sourceFlag('catalog', 'Which graph to read: catalog, canonical, or both.'),\n JSON_FLAG,\n];\n\nconst HELP = `upt explain <quantity> [name=value | name] ...\n [--source=catalog|canonical|both] [--json]\n Explain how the graph determines a quantity: the identifiability\n verdict, recovered value, derivation chains, and whether the inputs\n are dimensionally sufficient. A name that is not a quantity of the\n graph is reported NOT COVERED, with a one-edit name and what \\`upt search\\`\n finds for its words, and exits 1. A shared token such as \\`length\\` is\n not a near name. An evaluate key (\\`I_W_per_m2\\`, \\`B_T\\`, \\`T_K\\`, \\`g_00\\`)\n is the graph quantity that edge records. A name that does not resolve\n exits 1. --source picks the graph (default\n catalog); the result names the source it used.\n --source=both also prints the other quantity name when a canonical\n equation restates a catalog bridge under a different name, and says\n whether the two recovered values agree.\n A value is a number, a unit (mass=1Msun) or a constant expression\n (mass=1*M_sun). A bare number is already in the quantity's unit.\n T, temperature, temp, and T_K are kelvin: an energy on that name is\n k_B T, using boltzmann-constant, k_B, or kB when one of those is\n bound, and any other dimension is an error.\n A tagged quantity converts into that unit (GeV, bit, nat, J/K).\n magnetic-field and magnetic-flux-density are one vacuum B: a value\n given under either name is available under the other. The same\n number under both spellings is one input. Two different numbers\n are an error, and no frequency is recovered.\n e.g. upt explain hawking-temperature mass=1.989e30`;\n\n/**\n * Two modes, never mixed: bare names (structural analysis) OR name=value\n * (adds value recovery). Malformed inputs are rejected with a `UsageError`\n * rather than silently coerced — `mass=abc`→dropped, `mass=`→0,\n * `mass=1e500`→∞, and a bare name alongside a valued one were all silent\n * wrong-physics footguns.\n */\nfunction parseKnown(api: CommandCtx['api'], args: readonly string[]): { known: string[] | Record<string, number>; notes: string[] } {\n const valued = args.filter((a) => a.includes('='));\n if (valued.length === 0) return { known: [...args], notes: [] }; // names mode\n\n if (valued.length !== args.length) {\n const bare = args.filter((a) => !a.includes('=')).join(', ');\n throw new UsageError(\n `upt: cannot mix bare names (${bare}) with name=value inputs. `\n + 'Use all names (structural) or all name=value (with recovery). See `upt help`.'\n );\n }\n\n const assignments = splitAssignments('explain', args).map((a) => ({ name: a.name, raw: a.raw, assignment: a.token }));\n const siblings = assignments.map((a) => ({ name: a.name, raw: a.raw }));\n const values: Record<string, number> = {};\n const notes: string[] = [];\n for (const a of assignments) {\n let read: ReturnType<CommandCtx['api']['readNamedBinding']>;\n try {\n read = api.readNamedBinding(a.name, a.raw, { siblings });\n } catch (e) {\n if (e instanceof api.SynonymDisagreementError) throw new CliError(`upt explain: ${e.message}`);\n if (e instanceof api.TemperatureBindingError) {\n throw new CliError(`upt explain: '${a.assignment}' is not a temperature. ${e.message}`);\n }\n // A bad value is exit 1, as on eval and evaluate; a missing `=` was refused as usage above.\n throw new CliError(`upt explain: '${a.assignment}' is not a finite number or a known unit. ${(e as Error).message}`);\n }\n if (a.raw === '' || !Number.isFinite(read.value)) {\n throw new CliError(`upt explain: '${a.assignment}' is not a finite number. Expected ${a.name}=<number or unit>.`);\n }\n values[a.name] = read.value;\n // Unit-convention notes were already on the binding and explain did not\n // print them. The temperature reading adds a note; the reader returns that\n // one on its own field.\n if (read.temperatureNote !== undefined && !notes.includes(read.temperatureNote)) notes.push(read.temperatureNote);\n }\n return { known: values, notes };\n}\n\n/**\n * A bridge id (`be-NN`) is a graph EDGE, not a quantity NODE — `explain`\n * derives quantities, so it can never resolve a bridge id and would emit a bare\n * \"no derivation path\". Recognise a catalog bridge id and redirect helpfully,\n * tailored by grounding tier (closed-form evaluator vs graph-computable,\n * data-confronted or not). Returns `null` for non-bridge targets (fall through\n * to the normal graph explain).\n */\nfunction bridgeRedirect(\n api: CommandCtx['api'],\n target: string,\n): { id: number; tier: string; hasGraphEdge: boolean; hasDataConfrontation: boolean; hint: string } | null {\n const id = api.catalogIdNumber(target);\n if (id === undefined) return null;\n const b = api.auditCoverage().bridges.find((x) => x.id === id);\n if (!b) return null;\n\n let hint = `${target} is a bridge equation (a relation between quantities), not a graph quantity — \\`explain\\` derives quantities from the composition graph.`;\n hint += b.hasGraphEdge\n ? ` Its quantities appear in \\`upt map\\`; explain one of them to see its derivations.`\n : ` It is a closed-form evaluator bridge (no composition-graph edge), evaluated directly rather than through the graph.`;\n hint += b.hasDataConfrontation\n ? ` See \\`upt confront ${target}\\` for its real-data confrontation.`\n : ` It has no committed data confrontation (see \\`upt coverage\\`).`;\n return {\n id,\n tier: b.tier,\n hasGraphEdge: b.hasGraphEdge,\n hasDataConfrontation: b.hasDataConfrontation,\n hint,\n };\n}\n\n/** A canonical equation and the catalog bridge it restates, when those two target names differ. */\nfunction restatementPartner(\n api: CommandCtx['api'],\n target: string,\n): { name: string; canonicalId: string; bridgeId: number } | null {\n const norm = (s: string): string => s.replaceAll('_', '-').toLowerCase();\n const want = norm(target);\n for (const eq of api.CANONICAL_EQUATIONS) {\n if (eq.restatesBridge === undefined) continue;\n const bridgeId = Number(eq.restatesBridge);\n if (!Number.isInteger(bridgeId)) continue;\n const catalog = api.CATALOG_GRAPH.find((e) => e.beId === bridgeId);\n if (catalog === undefined) continue;\n const canonName = eq.dimensional.target.name;\n const catName = catalog.target.name;\n if (norm(canonName) === norm(catName)) continue;\n if (norm(canonName) === want) return { name: catName, canonicalId: eq.id, bridgeId };\n if (norm(catName) === want) return { name: canonName, canonicalId: eq.id, bridgeId };\n }\n return null;\n}\n\nfunction printExplanation(\n api: CommandCtx['api'],\n out: CommandCtx['out'],\n target: string,\n label: string,\n x: ReturnType<CommandCtx['api']['explainQuantity']>,\n): void {\n out(`\\n● ${target} [source: ${label}]`);\n out(` ${x.summary}`);\n if (x.derivations.length) {\n out(' derivations:');\n for (const d of x.derivations) {\n const val = d.value !== undefined ? ` = ${api.formatQuantity(d.value)}` : '';\n const chain =\n d.leafInputs.join(',') !== d.sources.join(',') ? ` [from leaves: ${d.leafInputs.join(', ')}]` : '';\n out(` - ${d.edge} (${d.label})${val}${chain}`);\n if (d.dimensionalForm) out(` ${d.dimensionalForm.formula}`);\n }\n }\n if (x.blockingFrontier.length) {\n out(` to determine it, also supply: ${x.blockingFrontier.join(', ')}`);\n }\n}\n\n/** Relative agreement of two recovered values. Absent when either value is missing. */\nfunction valuesAgree(a: number | undefined, b: number | undefined): boolean | undefined {\n if (a === undefined || b === undefined || !Number.isFinite(a) || !Number.isFinite(b)) return undefined;\n const scale = Math.max(Math.abs(a), Math.abs(b));\n if (scale === 0) return a === b;\n return Math.abs(a - b) / scale <= 1e-6;\n}\n\nfunction rebind(\n api: CommandCtx['api'],\n known: string[] | Record<string, number>,\n aliases: ReadonlyMap<string, string>,\n graphNames: ReadonlySet<string>,\n): string[] | Record<string, number> {\n const rewrite = (key: string): string => {\n const hit = api.resolveQuantityName(key, graphNames, aliases);\n if (hit === null) {\n throw new CliError(\n `upt explain: '${key}' did not resolve to a quantity. ` +\n 'A failed lookup is not a derivation, and this command does not exit 0.',\n );\n }\n return hit;\n };\n if (Array.isArray(known)) return known.map(rewrite);\n const out: Record<string, number> = {};\n for (const [key, value] of Object.entries(known)) {\n if (api.resolveQuantityName(key, graphNames, aliases) === null) {\n // A constant is not a graph quantity: the equation already uses the\n // registered value, so a stated value is checked, never bound.\n let constant: string | null;\n try {\n constant = api.constantAgreement(key, value);\n } catch (e) {\n if (e instanceof api.ConstantDisagreementError) throw new CliError(`upt explain: ${e.message}`);\n throw e;\n }\n if (constant !== null) continue;\n }\n const name = rewrite(key);\n if (Object.hasOwn(out, name) && out[name] !== value) {\n throw new CliError(`upt explain: '${name}' is given twice.`);\n }\n out[name] = value;\n }\n return out;\n}\n\nasync function run(ctx: CommandCtx): Promise<number> {\n const { args, api, out } = ctx;\n\n const [target, ...rest] = args.positionals;\n if (!target) {\n throw new UsageError('upt explain needs a quantity name. See `upt help`.');\n }\n\n // A bridge id is an edge, not a quantity — redirect before touching the graph.\n const redirect = bridgeRedirect(api, target);\n if (redirect) {\n // A bridge id names a CATALOG bridge whatever --source says; say so rather than print a source it did not use.\n if (args.flags.has('json')) {\n emitJson({ command: 'explain', source: 'catalog', result: { kind: 'bridge-redirect', ...redirect } }, ctx.write);\n return 0;\n }\n out(`\\n● ${target} [source: catalog bridge registry; a bridge id names a catalog bridge whatever --source says]`);\n out(` ${redirect.hint}`);\n return 0;\n }\n\n const { graph, label, source } = resolveGraph(api, args.flags);\n // A name that is not a quantity of this graph is NOT COVERED (persona finding\n // C4). It used to get the same \"no derivation path\" answer as a real quantity\n // the inputs cannot reach, and exit 0. Underscores resolve like hyphens.\n const names = new Set(graph.flatMap((e) => [e.target.name, ...e.sources.map((s) => s.name)]));\n // A dimensionless group the equation multiplies (sound-speed's gamma) is an\n // optional input, not a graph node. It resolves as a binding and not as a target.\n const inputNames = new Set(names);\n const edgeIds = new Set(graph.map((e) => e.id));\n for (const group of api.CANONICAL_GROUP_PREFACTORS) {\n if (edgeIds.has(group.id)) inputNames.add(group.group);\n }\n let resolvedTarget = api.resolveQuantityName(target, names);\n if (resolvedTarget === null) {\n const near = api.nearQuantityNames(target, names);\n // A single token one edit from exactly one quantity is that quantity.\n // A hyphenated miss stays a suggestion: `hawkng-temperature` exits 1.\n if (!/[-_\\s]/.test(target) && near.length === 1) {\n resolvedTarget = near[0]!;\n }\n }\n if (resolvedTarget === null) {\n const near = api.nearQuantityNames(target, names);\n // Audit I5: a law or model name (`schrodinger-equation`) is not a quantity; name what\n // `upt search` finds for its words. A shared token is not a near name.\n const found = searchNameWords(api, target);\n const shown = found?.matches.slice(0, SEARCH_HITS_SHOWN) ?? [];\n const searchLine =\n found === null\n ? ''\n : `\\n \\`upt search ${found.words.join(' ')}\\` finds ${found.matches.length}:` +\n shown.map((m) => `\\n ${m.entry.id} (${m.entry.kind.replace('-', ' ')}) — ${m.entry.command}`).join('') +\n (found.matches.length > shown.length ? `\\n … and ${found.matches.length - shown.length} more` : '');\n throw new CliError(\n `upt explain: '${target}' is not a quantity in the ${source} graph: NOT COVERED.` +\n (near.length > 0\n ? ` did you mean: ${near.join(', ')}?`\n : ' `upt canonical` and `upt map` list the vocabulary.') +\n searchLine,\n );\n }\n const aliases = api.aliasesForTarget(graph, resolvedTarget);\n const parsed = parseKnown(api, rest);\n for (const note of parsed.notes) ctx.err(note);\n if (!Array.isArray(parsed.known)) {\n try {\n api.assertSynonymAgreement(parsed.known);\n } catch (e) {\n if (e instanceof api.SynonymDisagreementError) throw new CliError(`upt explain: ${e.message}`);\n throw e;\n }\n }\n const rebound = rebind(api, parsed.known, aliases, inputNames);\n const known = api.shareSynonyms(rebound, names);\n let x;\n try {\n x = api.explainQuantity(graph, resolvedTarget, known);\n } catch (e) {\n if (e instanceof api.CarrierSignError || e instanceof api.SynonymDisagreementError) {\n throw new CliError(`upt explain: ${e.message}`);\n }\n throw e;\n }\n // Every route refused the point (a validity domain, opposite carrier signs, a formula with\n // no finite value there) and no value recovered: the inputs are a bad value, exit 1, the\n // code `upt evaluate` gives the same failure. A refusal beside a recovered value from\n // another route stays in the report, and an unset coefficient is not a bad value: it is\n // the edge's own state, reported as \"no recovered number\" (exit 0).\n const refusals = x.refusals ?? [];\n if (x.recoveredValue === undefined && refusals.length > 0 && refusals.every((r) => r.kind !== 'coefficient-unset')) {\n throw new CliError(`upt explain: ${refusals.map((r) => r.reason).join('; ')}`);\n }\n const partner = source === 'both' ? restatementPartner(api, resolvedTarget) : null;\n const partnerKnown = partner !== null && names.has(partner.name);\n const partnerExplanation = partnerKnown ? api.explainQuantity(graph, partner!.name, known) : undefined;\n const agree = valuesAgree(x.recoveredValue, partnerExplanation?.recoveredValue);\n\n if (args.flags.has('json')) {\n emitJson(\n {\n command: 'explain',\n source,\n result:\n partner !== null && partnerExplanation !== undefined\n ? {\n ...x,\n restatement: {\n canonicalId: partner.canonicalId,\n bridgeId: partner.bridgeId,\n otherName: partner.name,\n valuesAgree: agree,\n explanation: partnerExplanation,\n },\n }\n : x,\n },\n ctx.write,\n );\n return 0;\n }\n\n printExplanation(api, out, target, label, x);\n if (partner !== null && partnerExplanation !== undefined) {\n printExplanation(api, out, partner.name, label, partnerExplanation);\n const who = `${partner.canonicalId} restates be-${partner.bridgeId}`;\n if (agree === true) {\n out(` ${resolvedTarget} and ${partner.name} are one restatement (${who}). Values agree.`);\n } else if (agree === false) {\n const ratio = x.recoveredValue! / partnerExplanation.recoveredValue!;\n out(\n ` ${resolvedTarget} and ${partner.name} are one restatement (${who}). ` +\n `Values DISAGREE: ${resolvedTarget} / ${partner.name} = ${api.formatQuantity(ratio)}.`,\n );\n } else {\n out(` ${resolvedTarget} and ${partner.name} are one restatement (${who}).`);\n }\n }\n return 0;\n}\n\nexport const command: Command = {\n name: 'explain',\n aliases: [],\n flags: FLAGS,\n help: commandHelp(HELP, FLAGS),\n summary: 'Show how the graph determines a quantity, or say that it does not cover that name.',\n example: 'upt explain hawking-temperature mass=1Msun',\n group: 'explore',\n run,\n};\n\nregisterCommand(command);\n"]}
1
+ {"version":3,"file":"explain.js","sourceRoot":"","sources":["../../../src/cli/commands/explain.ts"],"names":[],"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,kBAAkB,CAAC,cAAe,CAAC;YACrE,GAAG,CACD,KAAK,cAAc,QAAQ,OAAO,CAAC,IAAI,yBAAyB,GAAG,KAAK;gBACtE,oBAAoB,cAAc,MAAM,OAAO,CAAC,IAAI,MAAM,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CACzF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,cAAc,QAAQ,OAAO,CAAC,IAAI,yBAAyB,GAAG,IAAI,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAY;IAC9B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE;IAC9B,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC;IAC9B,OAAO,EAAE,oFAAoF;IAC7F,OAAO,EAAE,4CAA4C;IACrD,KAAK,EAAE,SAAS;IAChB,GAAG;CACJ,CAAC;AAEF,eAAe,CAAC,OAAO,CAAC,CAAC","sourcesContent":["/**\n * `upt explain` — explain how the graph determines a quantity: the\n * identifiability verdict, recovered value, derivation chains, and whether\n * the inputs are dimensionally sufficient. Transposed verbatim from\n * bin/upt.mjs's `explain()` + `parseKnown()` (lines 183-235), plus\n * `--source` (the old CLI's module-level `GRAPH` was always the catalog\n * graph) and `--json`.\n *\n * `parseKnown`'s two-mode positional contract (bare names XOR name=value,\n * never mixed) and its malformed-input rejections are pinned by\n * `tests/cli/upt-explain-inputs.test.ts` against the old bin — ported here\n * unchanged, with `process.exit(2)` sites converted to `UsageError` (same\n * message text; `main.ts`'s catch maps it to exit 2).\n */\nimport type { FlagSpec } from '../args.js';\nimport { registerCommand, type Command, type CommandCtx } from '../command.js';\nimport { commandHelp, JSON_FLAG, sourceFlag } from '../flag-help.js';\nimport { resolveGraph } from '../graphs.js';\nimport { emitJson } from '../output.js';\nimport { splitAssignments } from '../bindings.js';\nimport { UsageError, CliError } from '../errors.js';\nimport { searchNameWords } from '../search-index.js';\n\n/** The exact SI dimension, as the barrel's `dimensionsEqual` takes it. */\ntype QuantityDimension = Parameters<CommandCtx['api']['dimensionsEqual']>[0];\n\n/** How many `upt search` hits a NOT COVERED answer lists before \"… and N more\". */\nconst SEARCH_HITS_SHOWN = 5;\n\nconst FLAGS: FlagSpec[] = [\n sourceFlag('catalog', 'Which graph to read: catalog, canonical, or both.'),\n JSON_FLAG,\n];\n\nconst HELP = `upt explain <quantity> [name=value | name] ...\n [--source=catalog|canonical|both] [--json]\n Explain how the graph determines a quantity: the identifiability\n verdict, recovered value, derivation chains, and whether the inputs\n are dimensionally sufficient. A name that is not a quantity of the\n graph is reported NOT COVERED, with a one-edit name and what \\`upt search\\`\n finds for its words, and exits 1. A shared token such as \\`length\\` is\n not a near name. An evaluate key (\\`I_W_per_m2\\`, \\`B_T\\`, \\`T_K\\`, \\`g_00\\`)\n is the graph quantity that edge records. A name that does not resolve\n exits 1. --source picks the graph (default\n catalog); the result names the source it used.\n --source=both also prints the other quantity name when a canonical\n equation restates a catalog bridge under a different name, and says\n whether the two recovered values agree.\n A value is a number, a unit (mass=1Msun) or a constant expression\n (mass=1*M_sun). A bare number is already in the quantity's unit.\n T, temperature, temp, and T_K are kelvin: an energy on that name is\n k_B T, using boltzmann-constant, k_B, or kB when one of those is\n bound, and any other dimension is an error.\n A tagged quantity converts into that unit (GeV, bit, nat, J/K).\n magnetic-field and magnetic-flux-density are one vacuum B: a value\n given under either name is available under the other. The same\n number under both spellings is one input. Two different numbers\n are an error, and no frequency is recovered.\n e.g. upt explain hawking-temperature mass=1.989e30`;\n\n/**\n * The quantity dimension the graph carries for a resolved input name.\n * `inputNames` and `aliases` are the same lookups `rebind` uses, so a name the\n * rebind accepts is checked, and a name outside the graph (a dimensionless\n * group such as `gamma`) has no dimension and is not checked here.\n */\ninterface BindingDimensions {\n readonly inputNames: ReadonlySet<string>;\n readonly aliases: ReadonlyMap<string, string>;\n readonly dims: ReadonlyMap<string, QuantityDimension>;\n}\n\n/**\n * Two modes, never mixed: bare names (structural analysis) OR name=value\n * (adds value recovery). Malformed inputs are rejected with a `UsageError`\n * rather than silently coerced — `mass=abc`→dropped, `mass=`→0,\n * `mass=1e500`→∞, and a bare name alongside a valued one were all silent\n * wrong-physics footguns.\n */\nfunction parseKnown(\n api: CommandCtx['api'],\n args: readonly string[],\n dimensions: BindingDimensions,\n): { known: string[] | Record<string, number>; notes: string[] } {\n const valued = args.filter((a) => a.includes('='));\n if (valued.length === 0) return { known: [...args], notes: [] }; // names mode\n\n if (valued.length !== args.length) {\n const bare = args.filter((a) => !a.includes('=')).join(', ');\n throw new UsageError(\n `upt: cannot mix bare names (${bare}) with name=value inputs. `\n + 'Use all names (structural) or all name=value (with recovery). See `upt help`.'\n );\n }\n\n const assignments = splitAssignments('explain', args).map((a) => ({ name: a.name, raw: a.raw, assignment: a.token }));\n const siblings = assignments.map((a) => ({ name: a.name, raw: a.raw }));\n const values: Record<string, number> = {};\n const notes: string[] = [];\n for (const a of assignments) {\n let read: ReturnType<CommandCtx['api']['readNamedBinding']>;\n try {\n read = api.readNamedBinding(a.name, a.raw, { siblings });\n } catch (e) {\n if (e instanceof api.SynonymDisagreementError) throw new CliError(`upt explain: ${e.message}`);\n if (e instanceof api.TemperatureBindingError) {\n throw new CliError(`upt explain: '${a.assignment}' is not a temperature. ${e.message}`);\n }\n // A bad value is exit 1, as on eval and evaluate; a missing `=` was refused as usage above.\n throw new CliError(`upt explain: '${a.assignment}' is not a finite number or a known unit. ${(e as Error).message}`);\n }\n if (a.raw === '' || !Number.isFinite(read.value)) {\n throw new CliError(`upt explain: '${a.assignment}' is not a finite number. Expected ${a.name}=<number or unit>.`);\n }\n values[a.name] = read.value;\n // A dimensioned value must be the quantity's dimension (issues #542, #537):\n // `nu=500nm` used to keep the 5e-7 scale and drop the length, so a metre\n // was read as a hertz. A bare number is already in the quantity's unit.\n // The message is the same sentence `bindingInUnit` gives `upt evaluate`,\n // with the quantity's own dimension where evaluate states a declared unit.\n const resolved = api.resolveQuantityName(a.name, dimensions.inputNames, dimensions.aliases);\n const quantityDim = resolved === null ? undefined : dimensions.dims.get(resolved);\n if (read.dimensioned && quantityDim !== undefined && !api.dimensionsEqual(read.dimension, quantityDim)) {\n throw new CliError(\n `upt explain: '${a.assignment}': '${a.raw.trim()}' is ${api.format(read.dimension)}, ` +\n `but this input is ${api.format(quantityDim)} (${resolved})`,\n );\n }\n // Unit-convention notes were already on the binding and explain did not\n // print them. The temperature reading adds a note; the reader returns that\n // one on its own field.\n if (read.temperatureNote !== undefined && !notes.includes(read.temperatureNote)) notes.push(read.temperatureNote);\n }\n return { known: values, notes };\n}\n\n/**\n * A bridge id (`be-NN`) is a graph EDGE, not a quantity NODE — `explain`\n * derives quantities, so it can never resolve a bridge id and would emit a bare\n * \"no derivation path\". Recognise a catalog bridge id and redirect helpfully,\n * tailored by grounding tier (closed-form evaluator vs graph-computable,\n * data-confronted or not). Returns `null` for non-bridge targets (fall through\n * to the normal graph explain).\n */\nfunction bridgeRedirect(\n api: CommandCtx['api'],\n target: string,\n): { id: number; tier: string; hasGraphEdge: boolean; hasDataConfrontation: boolean; hint: string } | null {\n const id = api.catalogIdNumber(target);\n if (id === undefined) return null;\n const b = api.auditCoverage().bridges.find((x) => x.id === id);\n if (!b) return null;\n\n let hint = `${target} is a bridge equation (a relation between quantities), not a graph quantity — \\`explain\\` derives quantities from the composition graph.`;\n hint += b.hasGraphEdge\n ? ` Its quantities appear in \\`upt map\\`; explain one of them to see its derivations.`\n : ` It is a closed-form evaluator bridge (no composition-graph edge), evaluated directly rather than through the graph.`;\n hint += b.hasDataConfrontation\n ? ` See \\`upt confront ${target}\\` for its real-data confrontation.`\n : ` It has no committed data confrontation (see \\`upt coverage\\`).`;\n return {\n id,\n tier: b.tier,\n hasGraphEdge: b.hasGraphEdge,\n hasDataConfrontation: b.hasDataConfrontation,\n hint,\n };\n}\n\n/** A canonical equation and the catalog bridge it restates, when those two target names differ. */\nfunction restatementPartner(\n api: CommandCtx['api'],\n target: string,\n): { name: string; canonicalId: string; bridgeId: number } | null {\n const norm = (s: string): string => api.foldName(s).toLowerCase();\n const want = norm(target);\n for (const eq of api.CANONICAL_EQUATIONS) {\n if (eq.restatesBridge === undefined) continue;\n const bridgeId = Number(eq.restatesBridge);\n if (!Number.isInteger(bridgeId)) continue;\n const catalog = api.CATALOG_GRAPH.find((e) => e.beId === bridgeId);\n if (catalog === undefined) continue;\n const canonName = eq.dimensional.target.name;\n const catName = catalog.target.name;\n if (norm(canonName) === norm(catName)) continue;\n if (norm(canonName) === want) return { name: catName, canonicalId: eq.id, bridgeId };\n if (norm(catName) === want) return { name: canonName, canonicalId: eq.id, bridgeId };\n }\n return null;\n}\n\nfunction printExplanation(\n api: CommandCtx['api'],\n out: CommandCtx['out'],\n target: string,\n label: string,\n x: ReturnType<CommandCtx['api']['explainQuantity']>,\n): void {\n out(`\\n● ${target} [source: ${label}]`);\n out(` ${x.summary}`);\n if (x.derivations.length) {\n out(' derivations:');\n for (const d of x.derivations) {\n const val = d.value !== undefined ? ` = ${api.formatQuantity(d.value)}` : '';\n const chain =\n d.leafInputs.join(',') !== d.sources.join(',') ? ` [from leaves: ${d.leafInputs.join(', ')}]` : '';\n out(` - ${d.edge} (${d.label})${val}${chain}`);\n if (d.dimensionalForm) out(` ${d.dimensionalForm.formula}`);\n }\n }\n if (x.blockingFrontier.length) {\n out(` to determine it, also supply: ${x.blockingFrontier.join(', ')}`);\n }\n}\n\n/** Relative agreement of two recovered values. Absent when either value is missing. */\nfunction valuesAgree(a: number | undefined, b: number | undefined): boolean | undefined {\n if (a === undefined || b === undefined || !Number.isFinite(a) || !Number.isFinite(b)) return undefined;\n const scale = Math.max(Math.abs(a), Math.abs(b));\n if (scale === 0) return a === b;\n return Math.abs(a - b) / scale <= 1e-6;\n}\n\nfunction rebind(\n api: CommandCtx['api'],\n known: string[] | Record<string, number>,\n aliases: ReadonlyMap<string, string>,\n graphNames: ReadonlySet<string>,\n): string[] | Record<string, number> {\n const rewrite = (key: string): string => {\n const hit = api.resolveQuantityName(key, graphNames, aliases);\n if (hit === null) {\n throw new CliError(\n `upt explain: '${key}' did not resolve to a quantity. ` +\n 'A failed lookup is not a derivation, and this command does not exit 0.',\n );\n }\n return hit;\n };\n if (Array.isArray(known)) return known.map(rewrite);\n const out: Record<string, number> = {};\n for (const [key, value] of Object.entries(known)) {\n if (api.resolveQuantityName(key, graphNames, aliases) === null) {\n // A constant is not a graph quantity: the equation already uses the\n // registered value, so a stated value is checked, never bound.\n let constant: string | null;\n try {\n constant = api.constantAgreement(key, value);\n } catch (e) {\n if (e instanceof api.ConstantDisagreementError) throw new CliError(`upt explain: ${e.message}`);\n throw e;\n }\n if (constant !== null) continue;\n }\n const name = rewrite(key);\n if (Object.hasOwn(out, name) && out[name] !== value) {\n throw new CliError(`upt explain: '${name}' is given twice.`);\n }\n out[name] = value;\n }\n return out;\n}\n\nasync function run(ctx: CommandCtx): Promise<number> {\n const { args, api, out } = ctx;\n\n const [target, ...rest] = args.positionals;\n if (!target) {\n throw new UsageError('upt explain needs a quantity name. See `upt help`.');\n }\n\n // A bridge id is an edge, not a quantity — redirect before touching the graph.\n const redirect = bridgeRedirect(api, target);\n if (redirect) {\n // A bridge id names a CATALOG bridge whatever --source says; say so rather than print a source it did not use.\n if (args.flags.has('json')) {\n emitJson({ command: 'explain', source: 'catalog', result: { kind: 'bridge-redirect', ...redirect } }, ctx.write);\n return 0;\n }\n out(`\\n● ${target} [source: catalog bridge registry; a bridge id names a catalog bridge whatever --source says]`);\n out(` ${redirect.hint}`);\n return 0;\n }\n\n const { graph, label, source } = resolveGraph(api, args.flags);\n // A name that is not a quantity of this graph is NOT COVERED (persona finding\n // C4). It used to get the same \"no derivation path\" answer as a real quantity\n // the inputs cannot reach, and exit 0. Underscores resolve like hyphens.\n const names = new Set(graph.flatMap((e) => [e.target.name, ...e.sources.map((s) => s.name)]));\n // A dimensionless group the equation multiplies (sound-speed's gamma) is an\n // optional input, not a graph node. It resolves as a binding and not as a target.\n const inputNames = new Set(names);\n const edgeIds = new Set(graph.map((e) => e.id));\n for (const group of api.CANONICAL_GROUP_PREFACTORS) {\n if (edgeIds.has(group.id)) inputNames.add(group.group);\n }\n let resolvedTarget = api.resolveQuantityName(target, names);\n if (resolvedTarget === null) {\n const near = api.nearQuantityNames(target, names);\n // A single token one edit from exactly one quantity is that quantity.\n // A hyphenated miss stays a suggestion: `hawkng-temperature` exits 1.\n if (!/[-_\\s]/.test(target) && near.length === 1) {\n resolvedTarget = near[0]!;\n }\n }\n if (resolvedTarget === null) {\n const near = api.nearQuantityNames(target, names);\n // Audit I5: a law or model name (`schrodinger-equation`) is not a quantity; name what\n // `upt search` finds for its words. A shared token is not a near name.\n const found = searchNameWords(api, target);\n const shown = found?.matches.slice(0, SEARCH_HITS_SHOWN) ?? [];\n const searchLine =\n found === null\n ? ''\n : `\\n \\`upt search ${found.words.join(' ')}\\` finds ${found.matches.length}:` +\n shown.map((m) => `\\n ${m.entry.id} (${m.entry.kind.replace('-', ' ')}) — ${m.entry.command}`).join('') +\n (found.matches.length > shown.length ? `\\n … and ${found.matches.length - shown.length} more` : '');\n throw new CliError(\n `upt explain: '${target}' is not a quantity in the ${source} graph: NOT COVERED.` +\n (near.length > 0\n ? ` did you mean: ${near.join(', ')}?`\n : ' `upt canonical` and `upt map` list the vocabulary.') +\n searchLine,\n );\n }\n const aliases = api.aliasesForTarget(graph, resolvedTarget);\n // The dimension of each graph quantity, from the nodes the edges already\n // carry (projected from `data/quantities.json`): the check\n // `parseKnown` makes for a dimensioned binding, in the terms this graph uses.\n const dims = new Map<string, QuantityDimension>();\n for (const e of graph) {\n dims.set(e.target.name, e.target.dim);\n for (const s of e.sources) dims.set(s.name, s.dim);\n }\n const parsed = parseKnown(api, rest, { inputNames, aliases, dims });\n for (const note of parsed.notes) ctx.err(note);\n if (!Array.isArray(parsed.known)) {\n try {\n api.assertSynonymAgreement(parsed.known);\n } catch (e) {\n if (e instanceof api.SynonymDisagreementError) throw new CliError(`upt explain: ${e.message}`);\n throw e;\n }\n }\n const rebound = rebind(api, parsed.known, aliases, inputNames);\n const known = api.shareSynonyms(rebound, names);\n let x;\n try {\n x = api.explainQuantity(graph, resolvedTarget, known);\n } catch (e) {\n if (e instanceof api.CarrierSignError || e instanceof api.SynonymDisagreementError) {\n throw new CliError(`upt explain: ${e.message}`);\n }\n throw e;\n }\n // Every route refused the point (a validity domain, opposite carrier signs, a formula with\n // no finite value there) and no value recovered: the inputs are a bad value, exit 1, the\n // code `upt evaluate` gives the same failure. A refusal beside a recovered value from\n // another route stays in the report, and an unset coefficient is not a bad value: it is\n // the edge's own state, reported as \"no recovered number\" (exit 0).\n const refusals = x.refusals ?? [];\n if (x.recoveredValue === undefined && refusals.length > 0 && refusals.every((r) => r.kind !== 'coefficient-unset')) {\n throw new CliError(`upt explain: ${refusals.map((r) => r.reason).join('; ')}`);\n }\n const partner = source === 'both' ? restatementPartner(api, resolvedTarget) : null;\n const partnerKnown = partner !== null && names.has(partner.name);\n const partnerExplanation = partnerKnown ? api.explainQuantity(graph, partner!.name, known) : undefined;\n const agree = valuesAgree(x.recoveredValue, partnerExplanation?.recoveredValue);\n\n if (args.flags.has('json')) {\n emitJson(\n {\n command: 'explain',\n source,\n result:\n partner !== null && partnerExplanation !== undefined\n ? {\n ...x,\n restatement: {\n canonicalId: partner.canonicalId,\n bridgeId: partner.bridgeId,\n otherName: partner.name,\n valuesAgree: agree,\n explanation: partnerExplanation,\n },\n }\n : x,\n },\n ctx.write,\n );\n return 0;\n }\n\n printExplanation(api, out, target, label, x);\n if (partner !== null && partnerExplanation !== undefined) {\n printExplanation(api, out, partner.name, label, partnerExplanation);\n const who = `${partner.canonicalId} restates be-${partner.bridgeId}`;\n if (agree === true) {\n out(` ${resolvedTarget} and ${partner.name} are one restatement (${who}). Values agree.`);\n } else if (agree === false) {\n const ratio = x.recoveredValue! / partnerExplanation.recoveredValue!;\n out(\n ` ${resolvedTarget} and ${partner.name} are one restatement (${who}). ` +\n `Values DISAGREE: ${resolvedTarget} / ${partner.name} = ${api.formatQuantity(ratio)}.`,\n );\n } else {\n out(` ${resolvedTarget} and ${partner.name} are one restatement (${who}).`);\n }\n }\n return 0;\n}\n\nexport const command: Command = {\n name: 'explain',\n aliases: [],\n positionals: { max: Infinity },\n flags: FLAGS,\n help: commandHelp(HELP, FLAGS),\n summary: 'Show how the graph determines a quantity, or say that it does not cover that name.',\n example: 'upt explain hawking-temperature mass=1Msun',\n group: 'explore',\n run,\n};\n\nregisterCommand(command);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ground.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/ground.ts"],"names":[],"mappings":"AAaA,OAAO,EAAmB,KAAK,OAAO,EAAmB,MAAM,eAAe,CAAC;AA6H/E,eAAO,MAAM,OAAO,EAAE,OASrB,CAAC"}
1
+ {"version":3,"file":"ground.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/ground.ts"],"names":[],"mappings":"AAaA,OAAO,EAAmB,KAAK,OAAO,EAAmB,MAAM,eAAe,CAAC;AAkI/E,eAAO,MAAM,OAAO,EAAE,OAUrB,CAAC"}
@@ -91,7 +91,7 @@ async function run(ctx) {
91
91
  source,
92
92
  anchor: { groundTruth: groundTruthAnchor(api, opts) },
93
93
  options: { ...opts },
94
- result: { a: cand.a, b: cand.b, verdict: cand.verdict, grounding: g },
94
+ result: { a: cand.a, b: cand.b, verdict: cand.verdict, grounding: g, magnitudeDerived: cand.magnitudeDerived ?? [] },
95
95
  }, ctx.write);
96
96
  return 0;
97
97
  }
@@ -100,6 +100,11 @@ async function run(ctx) {
100
100
  out(EPISTEMICS + '\n');
101
101
  out(` passed: ${g.passed.join(', ') || '—'}`);
102
102
  out(` gaps: ${g.gaps.join(', ') || '—'}`);
103
+ // A magnitude-clash row's grounding states no magnitude line, so where a magnitude came from its
104
+ // own equation is said here, for every verdict.
105
+ if ((cand.magnitudeDerived ?? []).length > 0) {
106
+ out(` magnitude: ${cand.magnitudeDerived.join(', ')} from its own equation (the sourced table and the constants, not the anchor)`);
107
+ }
103
108
  out(` ceiling: mechanism-tested ${g.mechanismTested} · data-tested ${g.dataTested} ` +
104
109
  '(permanent for a dimensional candidate — see `upt confront`)');
105
110
  return 0;
@@ -107,6 +112,7 @@ async function run(ctx) {
107
112
  export const command = {
108
113
  name: 'ground',
109
114
  aliases: [],
115
+ positionals: { max: 2 },
110
116
  flags: FLAGS,
111
117
  help: commandHelp(HELP, FLAGS),
112
118
  summary: 'Show which falsifiers ran on one discovery candidate, and which abstained.',
@@ -1 +1 @@
1
- {"version":3,"file":"ground.js","sourceRoot":"","sources":["../../../src/cli/commands/ground.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAiC,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAmB,MAAM,cAAc,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,MAAM,KAAK,GAAe;IACxB,UAAU,CAAC,SAAS,EAAE,2FAA2F,CAAC;IAClH;QACE,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,UAAU;QACtB,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,gDAAgD;QAC7D,YAAY,EAAE,YAAY;KAC3B;IACD;QACE,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE,UAAU;QACtB,WAAW,EAAE,uEAAuE;QACpF,YAAY,EAA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C,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1D,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACvB,GAAG,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IAChD,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IAC9C,GAAG,CACD,+BAA+B,CAAC,CAAC,eAAe,kBAAkB,CAAC,CAAC,UAAU,GAAG;QAC/E,8DAA8D,CACjE,CAAC;IACF,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAY;IAC9B,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC;IAC9B,OAAO,EAAE,4EAA4E;IACrF,OAAO,EAAE,+CAA+C;IACxD,KAAK,EAAE,WAAW;IAClB,GAAG;CACJ,CAAC;AAEF,eAAe,CAAC,OAAO,CAAC,CAAC","sourcesContent":["/**\n * `upt ground <quantityA> <quantityB>` — the epistemic-grounding ledger for a\n * single discovery candidate a≡b: which falsifiers passed, which abstained (gaps),\n * and the honest permanent ceiling (no mechanism test, no data test). Lets you\n * interrogate one candidate directly instead of scanning all of `upt discover`.\n *\n * It runs the same funnel as `upt discover` over the same `--source` graph and\n * `--anchor`/`--max-orders` options, so a pair `discover` printed can be\n * grounded by repeating those flags. A pair missing from the selected graph is\n * looked up in the others, and a hit is named: a candidate of another scope\n * must not be reported as though it never existed.\n */\nimport type { FlagSpec } from '../args.js';\nimport { registerCommand, type Command, type CommandCtx } from '../command.js';\nimport { commandHelp, JSON_FLAG, sourceFlag } from '../flag-help.js';\nimport { resolveGraph, groundTruthAnchor, groundTruthLine, type SourceName } from '../graphs.js';\nimport { emitJson } from '../output.js';\nimport { UsageError, CliError } from '../errors.js';\nimport { parseDiscoveryOpts } from './_discovery-opts.js';\nimport { DISCOVER_MAX_ORDERS_DEFAULT } from '../library-defaults.js';\n\nconst FLAGS: FlagSpec[] = [\n sourceFlag('catalog', 'Which graph to read: catalog, canonical, or both. Use the same value as the discover run.'),\n {\n name: '--anchor',\n valueStyle: 'attached',\n repeatable: true,\n description: 'Override a numeric anchor as k=v or k=v,k2=v2.',\n defaultValue: 'mass=M_sun',\n },\n {\n name: '--max-orders',\n valueStyle: 'attached',\n description: 'Magnitude-clash threshold. A larger value keeps more pairs promising.',\n defaultValue: DISCOVER_MAX_ORDERS_DEFAULT,\n },\n JSON_FLAG,\n];\n\nconst HELP = `upt ground <quantityA> <quantityB> [--source=catalog|canonical|both]\n [--anchor=k=v,...] [--max-orders=N] [--json]\n The epistemic-grounding ledger for one discovery candidate a≡b: which\n falsifiers PASSED, which ABSTAINED (gaps), and the honest ceiling — no\n mechanism test, no data test (permanent for a dimensional candidate;\n real mechanism/data live in \\`upt confront\\`).\n Pass the same --source (default catalog), --anchor and --max-orders\n as the \\`upt discover\\` run that listed the pair.`;\n\nconst EPISTEMICS =\n '(candidate grounding is a review surface; mechanism/data live in `upt confront`, not candidate space)';\n\nconst ALL_SOURCES: readonly SourceName[] = ['catalog', 'canonical', 'both'];\n\nasync function run(ctx: CommandCtx): Promise<number> {\n const { args, api, out } = ctx;\n const { graph, label, source } = resolveGraph(api, args.flags);\n const opts = parseDiscoveryOpts(api, args.flags);\n const [a, b] = args.positionals;\n if (!a || !b) {\n throw new UsageError('upt ground needs two quantity names (a b). See `upt help`.');\n }\n\n const pairs = (c: { a: string; b: string }) => (c.a === a && c.b === b) || (c.a === b && c.b === a);\n // A graph's funnel runs only when both names are quantities of that graph: a\n // name no graph carries is answered without running three funnels.\n const quantities = (edges: readonly { target: { name: string }; sources: readonly { name: string }[] }[]): Set<string> =>\n new Set(edges.flatMap((e) => [e.target.name, ...e.sources.map((q) => q.name)]));\n const bothNamed = (edges: Parameters<typeof quantities>[0]): boolean => {\n const names = quantities(edges);\n return names.has(a) && names.has(b);\n };\n // A name no graph holds is a bad argument (exit 1). A pair every graph holds and no\n // funnel pairs is a computed absence: exit 0 with its envelope, the rule `search` with no\n // match and `confront` with a refusal follow (Tom's review of #502).\n const graphs = ALL_SOURCES.map((s) => (s === source ? graph : resolveGraph(api, new Map([['source', [s]]])).graph));\n const held = new Set(graphs.flatMap((g) => [...quantities(g)]));\n for (const name of [a, b]) {\n if (!held.has(name)) throw new CliError(`upt ground: '${name}' is not a quantity of any graph (${ALL_SOURCES.join(', ')})`);\n }\n const cand = bothNamed(graph) ? api.rankDiscoveries(graph, opts).find(pairs) : undefined;\n if (!cand) {\n const elsewhere = ALL_SOURCES.filter((s) => s !== source).filter((s) => {\n const other = graphs[ALL_SOURCES.indexOf(s)]!;\n return bothNamed(other) && api.rankDiscoveries(other, opts).some(pairs);\n });\n const anchorFlags = (args.flags.get('anchor') ?? []).map((v) => ` --anchor=${v}`).join('');\n const ordersFlag = args.flags.has('max-orders') ? ` --max-orders=${args.flags.get('max-orders')!.at(-1)}` : '';\n const sentence =\n elsewhere.length > 0\n ? `'${a}' ≟ '${b}' is not a candidate in the ${source} graph, but it is in ` +\n `${elsewhere.join(' and ')}: upt ground --source=${elsewhere[0]}${anchorFlags}${ordersFlag} ${a} ${b}`\n : `no discovery candidate pairs '${a}' with '${b}' in any of ${ALL_SOURCES.join(', ')} — ` +\n 'they may not share a dimension, or are already connected (not a cross-cluster coincidence).';\n if (args.flags.has('json')) {\n emitJson(\n {\n command: 'ground',\n source,\n anchor: { groundTruth: groundTruthAnchor(api, opts) },\n options: { ...opts },\n result: { a, b, candidate: null, searched: [...ALL_SOURCES], elsewhere, note: sentence },\n },\n ctx.write,\n );\n return 0;\n }\n out(`\\n● ${a} ≟ ${b} [no candidate] [source: ${label}]`);\n out(` ${sentence}`);\n return 0;\n }\n\n const g = api.describeGrounding(cand);\n if (args.flags.has('json')) {\n emitJson(\n {\n command: 'ground',\n source,\n anchor: { groundTruth: groundTruthAnchor(api, opts) },\n options: { ...opts },\n result: { a: cand.a, b: cand.b, verdict: cand.verdict, grounding: g },\n },\n ctx.write,\n );\n return 0;\n }\n\n out(`\\n● ${cand.a} ≟ ${cand.b} [${cand.verdict}] [source: ${label}]`);\n out(` ${groundTruthLine(groundTruthAnchor(api, opts))}`);\n out(EPISTEMICS + '\\n');\n out(` passed: ${g.passed.join(', ') || '—'}`);\n out(` gaps: ${g.gaps.join(', ') || '—'}`);\n out(\n ` ceiling: mechanism-tested ${g.mechanismTested} · data-tested ${g.dataTested} ` +\n '(permanent for a dimensional candidate — see `upt confront`)',\n );\n return 0;\n}\n\nexport const command: Command = {\n name: 'ground',\n aliases: [],\n flags: FLAGS,\n help: commandHelp(HELP, FLAGS),\n summary: 'Show which falsifiers ran on one discovery candidate, and which abstained.',\n example: 'upt ground landauer-erasure-energy gap-energy',\n group: 'discovery',\n run,\n};\n\nregisterCommand(command);\n"]}
1
+ {"version":3,"file":"ground.js","sourceRoot":"","sources":["../../../src/cli/commands/ground.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAiC,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAmB,MAAM,cAAc,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,MAAM,KAAK,GAAe;IACxB,UAAU,CAAC,SAAS,EAAE,2FAA2F,CAAC;IAClH;QACE,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,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,CAAC,OAAO,CAAC,CAAC","sourcesContent":["/**\n * `upt ground <quantityA> <quantityB>` — the epistemic-grounding ledger for a\n * single discovery candidate a≡b: which falsifiers passed, which abstained (gaps),\n * and the honest permanent ceiling (no mechanism test, no data test). Lets you\n * interrogate one candidate directly instead of scanning all of `upt discover`.\n *\n * It runs the same funnel as `upt discover` over the same `--source` graph and\n * `--anchor`/`--max-orders` options, so a pair `discover` printed can be\n * grounded by repeating those flags. A pair missing from the selected graph is\n * looked up in the others, and a hit is named: a candidate of another scope\n * must not be reported as though it never existed.\n */\nimport type { FlagSpec } from '../args.js';\nimport { registerCommand, type Command, type CommandCtx } from '../command.js';\nimport { commandHelp, JSON_FLAG, sourceFlag } from '../flag-help.js';\nimport { resolveGraph, groundTruthAnchor, groundTruthLine, type SourceName } from '../graphs.js';\nimport { emitJson } from '../output.js';\nimport { UsageError, CliError } from '../errors.js';\nimport { parseDiscoveryOpts } from './_discovery-opts.js';\nimport { DISCOVER_MAX_ORDERS_DEFAULT } from '../library-defaults.js';\n\nconst FLAGS: FlagSpec[] = [\n sourceFlag('catalog', 'Which graph to read: catalog, canonical, or both. Use the same value as the discover run.'),\n {\n name: '--anchor',\n valueStyle: 'attached',\n repeatable: true,\n description: 'Override a numeric anchor as k=v or k=v,k2=v2.',\n defaultValue: 'mass=M_sun',\n },\n {\n name: '--max-orders',\n valueStyle: 'attached',\n description: 'Magnitude-clash threshold. A larger value keeps more pairs promising.',\n defaultValue: DISCOVER_MAX_ORDERS_DEFAULT,\n },\n JSON_FLAG,\n];\n\nconst HELP = `upt ground <quantityA> <quantityB> [--source=catalog|canonical|both]\n [--anchor=k=v,...] [--max-orders=N] [--json]\n The epistemic-grounding ledger for one discovery candidate a≡b: which\n falsifiers PASSED, which ABSTAINED (gaps), and the honest ceiling — no\n mechanism test, no data test (permanent for a dimensional candidate;\n real mechanism/data live in \\`upt confront\\`).\n Pass the same --source (default catalog), --anchor and --max-orders\n as the \\`upt discover\\` run that listed the pair.`;\n\nconst EPISTEMICS =\n '(candidate grounding is a review surface; mechanism/data live in `upt confront`, not candidate space)';\n\nconst ALL_SOURCES: readonly SourceName[] = ['catalog', 'canonical', 'both'];\n\nasync function run(ctx: CommandCtx): Promise<number> {\n const { args, api, out } = ctx;\n const { graph, label, source } = resolveGraph(api, args.flags);\n const opts = parseDiscoveryOpts(api, args.flags);\n const [a, b] = args.positionals;\n if (!a || !b) {\n throw new UsageError('upt ground needs two quantity names (a b). See `upt help`.');\n }\n\n const pairs = (c: { a: string; b: string }) => (c.a === a && c.b === b) || (c.a === b && c.b === a);\n // A graph's funnel runs only when both names are quantities of that graph: a\n // name no graph carries is answered without running three funnels.\n const quantities = (edges: readonly { target: { name: string }; sources: readonly { name: string }[] }[]): Set<string> =>\n new Set(edges.flatMap((e) => [e.target.name, ...e.sources.map((q) => q.name)]));\n const bothNamed = (edges: Parameters<typeof quantities>[0]): boolean => {\n const names = quantities(edges);\n return names.has(a) && names.has(b);\n };\n // A name no graph holds is a bad argument (exit 1). A pair every graph holds and no\n // funnel pairs is a computed absence: exit 0 with its envelope, the rule `search` with no\n // match and `confront` with a refusal follow (Tom's review of #502).\n const graphs = ALL_SOURCES.map((s) => (s === source ? graph : resolveGraph(api, new Map([['source', [s]]])).graph));\n const held = new Set(graphs.flatMap((g) => [...quantities(g)]));\n for (const name of [a, b]) {\n if (!held.has(name)) throw new CliError(`upt ground: '${name}' is not a quantity of any graph (${ALL_SOURCES.join(', ')})`);\n }\n const cand = bothNamed(graph) ? api.rankDiscoveries(graph, opts).find(pairs) : undefined;\n if (!cand) {\n const elsewhere = ALL_SOURCES.filter((s) => s !== source).filter((s) => {\n const other = graphs[ALL_SOURCES.indexOf(s)]!;\n return bothNamed(other) && api.rankDiscoveries(other, opts).some(pairs);\n });\n const anchorFlags = (args.flags.get('anchor') ?? []).map((v) => ` --anchor=${v}`).join('');\n const ordersFlag = args.flags.has('max-orders') ? ` --max-orders=${args.flags.get('max-orders')!.at(-1)}` : '';\n const sentence =\n elsewhere.length > 0\n ? `'${a}' ≟ '${b}' is not a candidate in the ${source} graph, but it is in ` +\n `${elsewhere.join(' and ')}: upt ground --source=${elsewhere[0]}${anchorFlags}${ordersFlag} ${a} ${b}`\n : `no discovery candidate pairs '${a}' with '${b}' in any of ${ALL_SOURCES.join(', ')} — ` +\n 'they may not share a dimension, or are already connected (not a cross-cluster coincidence).';\n if (args.flags.has('json')) {\n emitJson(\n {\n command: 'ground',\n source,\n anchor: { groundTruth: groundTruthAnchor(api, opts) },\n options: { ...opts },\n result: { a, b, candidate: null, searched: [...ALL_SOURCES], elsewhere, note: sentence },\n },\n ctx.write,\n );\n return 0;\n }\n out(`\\n● ${a} ≟ ${b} [no candidate] [source: ${label}]`);\n out(` ${sentence}`);\n return 0;\n }\n\n const g = api.describeGrounding(cand);\n if (args.flags.has('json')) {\n emitJson(\n {\n command: 'ground',\n source,\n anchor: { groundTruth: groundTruthAnchor(api, opts) },\n options: { ...opts },\n result: { a: cand.a, b: cand.b, verdict: cand.verdict, grounding: g, magnitudeDerived: cand.magnitudeDerived ?? [] },\n },\n ctx.write,\n );\n return 0;\n }\n\n out(`\\n● ${cand.a} ≟ ${cand.b} [${cand.verdict}] [source: ${label}]`);\n out(` ${groundTruthLine(groundTruthAnchor(api, opts))}`);\n out(EPISTEMICS + '\\n');\n out(` passed: ${g.passed.join(', ') || '—'}`);\n out(` gaps: ${g.gaps.join(', ') || '—'}`);\n // A magnitude-clash row's grounding states no magnitude line, so where a magnitude came from its\n // own equation is said here, for every verdict.\n if ((cand.magnitudeDerived ?? []).length > 0) {\n out(` magnitude: ${cand.magnitudeDerived!.join(', ')} from its own equation (the sourced table and the constants, not the anchor)`);\n }\n out(\n ` ceiling: mechanism-tested ${g.mechanismTested} · data-tested ${g.dataTested} ` +\n '(permanent for a dimensional candidate — see `upt confront`)',\n );\n return 0;\n}\n\nexport const command: Command = {\n name: 'ground',\n aliases: [],\n positionals: { max: 2 },\n flags: FLAGS,\n help: commandHelp(HELP, FLAGS),\n summary: 'Show which falsifiers ran on one discovery candidate, and which abstained.',\n example: 'upt ground landauer-erasure-energy gap-energy',\n group: 'discovery',\n run,\n};\n\nregisterCommand(command);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/map.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAmB,KAAK,OAAO,EAAmB,MAAM,eAAe,CAAC;AAS/E,OAAO,KAAK,EACV,UAAU,EAOX,MAAM,kBAAkB,CAAC;AAmI1B;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,CAazG;AAkmBD,eAAO,MAAM,OAAO,EAAE,OASrB,CAAC"}
1
+ {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/map.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAmB,KAAK,OAAO,EAAmB,MAAM,eAAe,CAAC;AAU/E,OAAO,KAAK,EACV,UAAU,EAUX,MAAM,kBAAkB,CAAC;AAoJ1B;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,CAazG;AA6qBD,eAAO,MAAM,OAAO,EAAE,OASrB,CAAC"}
@@ -19,6 +19,7 @@ import { resolveGraph, coreAnchor, coreLine, groundTruthAnchor, groundTruthLine
19
19
  import { emitJson } from '../output.js';
20
20
  import { publishedUrl } from '../published-url.js';
21
21
  import { UsageError, CliError, EXIT_CHECK_FAILED } from '../errors.js';
22
+ import { integerFlag } from '../numeric-flag.js';
22
23
  import { classifyDetermination } from '../determination.js';
23
24
  import { parseDiscoveryOpts } from './_discovery-opts.js';
24
25
  import * as atlasMap from './_atlas-map.js';
@@ -55,8 +56,15 @@ const FLAGS = [
55
56
  { name: '--bind-short', valueStyle: 'none', description: 'Bind a one-letter catalog name in --equation. Without it, those names are reported and not bound.' },
56
57
  { name: '--natural', valueStyle: 'none', description: 'Set ħ = c = 1 when a dimension difference is a power of those constants.' },
57
58
  { name: '--geometrized', valueStyle: 'none', description: 'With the natural-unit rules, also set G = 1.' },
59
+ { name: '--communities', valueStyle: 'none', description: 'Also print the layout communities (Louvain, heuristic) of the largest component. A drawing aid, not physics.' },
60
+ { name: '--cycles', valueStyle: 'none', description: 'Also print the derivation cycles: strongly connected components of the directed source→target quantity graph.' },
61
+ { name: '--rank-hubs', valueStyle: 'none', description: 'Also rank quantities by betweenness centrality (normalised). Computed only when asked.' },
58
62
  JSON_FLAG,
59
63
  ];
64
+ /** How many hubs `--rank-hubs` prints in text; `--json` carries every quantity. */
65
+ const HUBS_SHOWN = 10;
66
+ /** Flags that add a structure section to the text and --json forms, and mean nothing on a diagram. */
67
+ const STRUCTURE_FLAGS = ['communities', 'cycles', 'rank-hubs'];
60
68
  const HELP = `upt map [--source=catalog|canonical|both] [--format=text|mermaid|dot|svg]
61
69
  [--proposed [--anchor=k=v,...] [--max-orders=N]] [--out=PATH]
62
70
  [--equation "TARGET = EXPR" [--equation-only] [--verbose] [--bind-short]
@@ -141,6 +149,14 @@ const HELP = `upt map [--source=catalog|canonical|both] [--format=text|mermaid|d
141
149
  unresolved are counted apart.
142
150
  Every atlas view states how many of the atlas's models and bridges it
143
151
  shows, in text, --json and --format=mermaid|dot|svg.
152
+ --communities, --cycles and --rank-hubs each add one section to the
153
+ text report (and a key to --json); they do not apply to a diagram.
154
+ --communities lists the layout communities (Louvain, heuristic) of the
155
+ largest component: where a drawing may place quantities together, never
156
+ a physics claim. --cycles lists the derivation cycles (strongly
157
+ connected components of the directed source→target quantity graph),
158
+ where over-determination lives. --rank-hubs ranks quantities by
159
+ betweenness centrality (normalised; computed only when asked).
144
160
  e.g. upt map --relation=derivation --source=both
145
161
  upt map --around=temperature --depth=2 --source=catalog
146
162
  upt map --route=model-pendulum,model-lc
@@ -208,9 +224,6 @@ function parseFilter(raw, allowed, flag) {
208
224
  }
209
225
  return raw;
210
226
  }
211
- // Convert the derived identity-consequence proposals into viz junctions
212
- // (gray-dashed, status 'proposed'). The library never imports proposed-bridges;
213
- // the CLI does the conversion, keeping the epistemic firewall intact.
214
227
  function proposedJunctions(api, graph, flags) {
215
228
  const opts = parseDiscoveryOpts(api, flags);
216
229
  const ranked = api.rankDiscoveries(graph, opts);
@@ -220,6 +233,7 @@ function proposedJunctions(api, graph, flags) {
220
233
  status: 'proposed',
221
234
  sources: (p.governing || []).map((g) => g.name),
222
235
  target: p.target.name,
236
+ magnitudeEvidence: p.derivedFrom.identification.magnitudeEvidence,
223
237
  }));
224
238
  }
225
239
  // Build the catalog quantity name→dimension map for the chosen graph, then run
@@ -346,8 +360,46 @@ function printEquationReport(api, model, user, out, comparisons = []) {
346
360
  }
347
361
  }
348
362
  }
363
+ /** Compute only the sections asked for; `rankHubs` is the betweenness pass the default path never runs. */
364
+ async function structureSections(api, graph, flags) {
365
+ return {
366
+ ...(flags.has('communities') ? { communities: api.communitiesOf(graph) } : {}),
367
+ ...(flags.has('cycles') ? { cycles: api.derivationCycles(graph) } : {}),
368
+ ...(flags.has('rank-hubs') ? { hubs: await api.rankHubs(graph) } : {}),
369
+ };
370
+ }
371
+ /** The text of the structure sections, in flag order; empty when none was asked for. A number goes through `formatQuantity`. */
372
+ function structureLines(s, formatQuantity) {
373
+ const lines = [];
374
+ if (s.communities !== undefined) {
375
+ const c = s.communities;
376
+ lines.push(` ${c.method} of the largest component (${c.componentSize} quantities) — a drawing aid, not physics:`);
377
+ if (c.communities.length === 0)
378
+ lines.push(' none (the graph has no component)');
379
+ c.communities.forEach((com, i) => lines.push(` ${i + 1}. (${com.size}) ${com.quantities.join(', ')}`));
380
+ lines.push('');
381
+ }
382
+ if (s.cycles !== undefined) {
383
+ const head = s.cycles.length === 0 ? 'none — the quantity graph is acyclic' : String(s.cycles.length);
384
+ lines.push(` derivation cycles (strongly connected components of source→target, where over-determination lives): ${head}`);
385
+ for (const cyc of s.cycles)
386
+ lines.push(` {${cyc.quantities.join(', ')}} closed by ${cyc.edges.join(', ')}`);
387
+ lines.push('');
388
+ }
389
+ if (s.hubs !== undefined) {
390
+ const shown = Math.min(HUBS_SHOWN, s.hubs.length);
391
+ lines.push(` hubs by betweenness centrality (normalised; top ${shown} of ${s.hubs.length} quantities; a cut quantity of the drawing, not a central law):`);
392
+ for (const h of s.hubs.slice(0, shown))
393
+ lines.push(` ${h.quantity.padEnd(40)} ${formatQuantity(h.betweenness, 3)} (degree ${h.degree})`);
394
+ lines.push('');
395
+ }
396
+ // Sections are separated by one blank line; the closing line of the report brings its own.
397
+ while (lines.length > 0 && lines[lines.length - 1] === '')
398
+ lines.pop();
399
+ return lines;
400
+ }
349
401
  /** Flags that shape the equation graph, and so mean nothing on an atlas view. */
350
- const GRAPH_ONLY_FLAGS = ['source', 'around', 'depth', 'equation', 'equation-only', 'proposed', 'max-orders', 'anchor'];
402
+ const GRAPH_ONLY_FLAGS = ['source', 'around', 'depth', 'equation', 'equation-only', 'proposed', 'max-orders', 'anchor', ...STRUCTURE_FLAGS];
351
403
  /** Flags that only an atlas view reads. */
352
404
  const ATLAS_ONLY_FLAGS = ['all-routes', 'max-routes', 'stored', 'run'];
353
405
  async function runAtlasView(ctx, route, family, observable) {
@@ -371,8 +423,9 @@ async function runAtlasView(ctx, route, family, observable) {
371
423
  const maxRaw = lastValue(args.flags, 'max-routes');
372
424
  if (maxRaw !== undefined && !allRoutes)
373
425
  throw new CliError('upt map: --max-routes needs --all-routes');
374
- const maxRoutes = maxRaw === undefined ? atlasMap.DEFAULT_MAX_ROUTES : Number(maxRaw);
375
- if (!Number.isInteger(maxRoutes) || maxRoutes < 1 || maxRoutes > atlasMap.MAX_ROUTES_CEILING) {
426
+ // The grammar first (`0x10` is usage, exit 2); the 1..ceiling range after (exit 1).
427
+ const maxRoutes = maxRaw === undefined ? atlasMap.DEFAULT_MAX_ROUTES : integerFlag('map', '--max-routes', maxRaw);
428
+ if (maxRoutes < 1 || maxRoutes > atlasMap.MAX_ROUTES_CEILING) {
376
429
  throw new CliError(`upt map: --max-routes=${maxRaw} must be an integer from 1 to ${atlasMap.MAX_ROUTES_CEILING}`);
377
430
  }
378
431
  if (args.flags.has('stored') && args.flags.has('run')) {
@@ -512,8 +565,9 @@ async function runReport(ctx) {
512
565
  let focus = null;
513
566
  let fullGraph = wholeGraph;
514
567
  if (around !== undefined) {
515
- const depth = depthRaw === undefined ? DEFAULT_DEPTH : Number(depthRaw);
516
- if (!Number.isInteger(depth) || depth < 1 || depth > MAX_DEPTH)
568
+ // The grammar first (`1e1` is usage, exit 2); the 1..MAX_DEPTH range after (exit 1).
569
+ const depth = depthRaw === undefined ? DEFAULT_DEPTH : integerFlag('map', '--depth', depthRaw);
570
+ if (depth < 1 || depth > MAX_DEPTH)
517
571
  throw new CliError(`upt map: --depth=${depthRaw} must be an integer from 1 to ${MAX_DEPTH}`);
518
572
  const known = new Set(wholeGraph.flatMap((e) => [...e.sources.map((q) => q.name), e.target.name]));
519
573
  const name = api.resolveQuantityName(around, known);
@@ -555,6 +609,13 @@ async function runReport(ctx) {
555
609
  if (isJson && fmt !== 'text') {
556
610
  throw new UsageError('upt: pick one output form: --json or --format');
557
611
  }
612
+ const structureAsked = STRUCTURE_FLAGS.filter((f) => args.flags.has(f));
613
+ if (structureAsked.length > 0 && fmt !== 'text') {
614
+ const named = structureAsked.map((f) => `--${f}`).join(', ');
615
+ throw new UsageError(`upt map: ${named} print${structureAsked.length === 1 ? 's' : ''} text or --json; ${structureAsked.length === 1 ? 'it does' : 'they do'} not apply to --format=${fmt}`);
616
+ }
617
+ // Computed only when asked, over the same filtered edge list the linkage map reads.
618
+ const structure = await structureSections(api, graph, args.flags);
558
619
  // --equation injects a user-supplied "TARGET = EXPR" as a 'user' junction.
559
620
  let user = null;
560
621
  let comparisons = [];
@@ -599,7 +660,9 @@ async function runReport(ctx) {
599
660
  // whole catalog, and the model then judges each overlay junction under the
600
661
  // same filter as every other junction. Computed once for every output form.
601
662
  const proposed = args.flags.has('proposed') ? proposedJunctions(api, wholeGraph, args.flags) : null;
602
- const overlay = (extra) => [...(proposed ?? []), ...extra];
663
+ // The drawing reads a plain junction; the magnitude-evidence flag is the list's and `--json`'s.
664
+ const drawn = (proposed ?? []).map((p) => ({ id: p.id, label: p.label, status: p.status, sources: p.sources, target: p.target }));
665
+ const overlay = (extra) => [...drawn, ...extra];
603
666
  if (isJson) {
604
667
  const linkage = api.linkageMap(graph);
605
668
  let landing;
@@ -629,10 +692,13 @@ async function runReport(ctx) {
629
692
  anchor,
630
693
  result: {
631
694
  ...(equation != null && (equationOnly || !args.flags.has('verbose')) ? {} : { linkage }),
632
- ...(proposed === null ? {} : { proposed: proposed.map((p) => ({ id: p.id, target: p.target, sources: p.sources })) }),
695
+ ...(proposed === null
696
+ ? {}
697
+ : { proposed: proposed.map((p) => ({ id: p.id, target: p.target, sources: p.sources, magnitudeEvidence: p.magnitudeEvidence })) }),
633
698
  ...(edgeLegend !== null ? { filter: edgeStats } : {}),
634
699
  ...(focus !== null ? { focus } : {}),
635
700
  ...(user ? { landing, userEquation } : {}),
701
+ ...structure,
636
702
  },
637
703
  }, write);
638
704
  return exitCode;
@@ -716,7 +782,8 @@ async function runReport(ctx) {
716
782
  for (const p of proposed) {
717
783
  // No free input: every governing quantity of the derived relation is a registered constant.
718
784
  const sources = p.sources.length === 0 ? '{} (no sources: every input is a registered constant)' : `{${p.sources.join(', ')}}`;
719
- out(` ${p.id}: ${p.target} ← ${sources}`);
785
+ const evidence = p.magnitudeEvidence ? '' : ' (from an identification with no magnitude evidence)';
786
+ out(` ${p.id}: ${p.target} ← ${sources}${evidence}`);
720
787
  }
721
788
  if (proposed.length === 0)
722
789
  out(' (none at this anchor and --max-orders)');
@@ -734,6 +801,12 @@ async function runReport(ctx) {
734
801
  }
735
802
  out(` ○ isolated (${m.isolated.length}) — share no quantity with any other edge:`);
736
803
  out(` ${m.isolated.length === 0 ? 'none' : m.isolated.join(', ')}`);
804
+ const structureText = structureLines(structure, api.formatQuantity);
805
+ if (structureText.length > 0) {
806
+ out('');
807
+ for (const line of structureText)
808
+ out(line);
809
+ }
737
810
  out('\n (a structural map — shared-quantity connectivity, NOT a credibility signal)');
738
811
  return exitCode;
739
812
  }