universal-physics-tensor 11.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 (287) hide show
  1. package/README.md +36 -34
  2. package/data/applied-cases.json +1892 -0
  3. package/data/applied-cases.schema.json +194 -0
  4. package/data/atlas/atlas.json +21 -21
  5. package/data/atlas/atlas.jsonld +1 -1
  6. package/data/atlas/diffusion.json +5 -5
  7. package/data/atlas/oscillators.json +7 -7
  8. package/data/atlas/waves.json +11 -11
  9. package/data/bridge-catalog.json +20 -4
  10. package/data/units.json +6 -25
  11. package/dist/atlas/benchmark/stats.d.ts.map +1 -1
  12. package/dist/atlas/benchmark/stats.js +6 -20
  13. package/dist/atlas/benchmark/stats.js.map +1 -1
  14. package/dist/atlas/physjs-entries.generated.d.ts +13 -4
  15. package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
  16. package/dist/atlas/physjs-entries.generated.js +15 -4
  17. package/dist/atlas/physjs-entries.generated.js.map +1 -1
  18. package/dist/atlas/physjs-reviewed.js +2 -2
  19. package/dist/atlas/physjs-reviewed.js.map +1 -1
  20. package/dist/cases/catalog-checks.d.ts +10 -0
  21. package/dist/cases/catalog-checks.d.ts.map +1 -0
  22. package/dist/cases/catalog-checks.js +241 -0
  23. package/dist/cases/catalog-checks.js.map +1 -0
  24. package/dist/cases/catalog.d.ts +83 -0
  25. package/dist/cases/catalog.d.ts.map +1 -0
  26. package/dist/cases/catalog.js +118 -0
  27. package/dist/cases/catalog.js.map +1 -0
  28. package/dist/cases/engine.d.ts +13 -0
  29. package/dist/cases/engine.d.ts.map +1 -0
  30. package/dist/cases/engine.js +179 -0
  31. package/dist/cases/engine.js.map +1 -0
  32. package/dist/cases/index.d.ts.map +1 -1
  33. package/dist/cases/index.js +5 -7
  34. package/dist/cases/index.js.map +1 -1
  35. package/dist/cases/methods.d.ts +215 -0
  36. package/dist/cases/methods.d.ts.map +1 -0
  37. package/dist/cases/methods.js +743 -0
  38. package/dist/cases/methods.js.map +1 -0
  39. package/dist/cases/types.d.ts +12 -0
  40. package/dist/cases/types.d.ts.map +1 -1
  41. package/dist/cases/types.js.map +1 -1
  42. package/dist/cli/args.d.ts +2 -0
  43. package/dist/cli/args.d.ts.map +1 -1
  44. package/dist/cli/args.js.map +1 -1
  45. package/dist/cli/command.d.ts +3 -0
  46. package/dist/cli/command.d.ts.map +1 -1
  47. package/dist/cli/command.js.map +1 -1
  48. package/dist/cli/commands/_discovery-opts.d.ts +1 -0
  49. package/dist/cli/commands/_discovery-opts.d.ts.map +1 -1
  50. package/dist/cli/commands/_discovery-opts.js +1 -0
  51. package/dist/cli/commands/_discovery-opts.js.map +1 -1
  52. package/dist/cli/commands/discover.d.ts.map +1 -1
  53. package/dist/cli/commands/discover.js +116 -71
  54. package/dist/cli/commands/discover.js.map +1 -1
  55. package/dist/cli/commands/evaluate.js +2 -2
  56. package/dist/cli/commands/evaluate.js.map +1 -1
  57. package/dist/cli/commands/explain.d.ts.map +1 -1
  58. package/dist/cli/commands/explain.js +22 -2
  59. package/dist/cli/commands/explain.js.map +1 -1
  60. package/dist/cli/commands/ground.d.ts.map +1 -1
  61. package/dist/cli/commands/ground.js +6 -1
  62. package/dist/cli/commands/ground.js.map +1 -1
  63. package/dist/cli/commands/map.d.ts.map +1 -1
  64. package/dist/cli/commands/map.js +9 -6
  65. package/dist/cli/commands/map.js.map +1 -1
  66. package/dist/cli/determination.d.ts +1 -0
  67. package/dist/cli/determination.d.ts.map +1 -1
  68. package/dist/cli/determination.js.map +1 -1
  69. package/dist/cli/flag-help.d.ts +1 -0
  70. package/dist/cli/flag-help.d.ts.map +1 -1
  71. package/dist/cli/flag-help.js +1 -0
  72. package/dist/cli/flag-help.js.map +1 -1
  73. package/dist/cli/graphs.d.ts +2 -0
  74. package/dist/cli/graphs.d.ts.map +1 -1
  75. package/dist/cli/graphs.js +1 -0
  76. package/dist/cli/graphs.js.map +1 -1
  77. package/dist/cli/main.d.ts +1 -0
  78. package/dist/cli/main.d.ts.map +1 -1
  79. package/dist/cli/main.js +1 -0
  80. package/dist/cli/main.js.map +1 -1
  81. package/dist/cli/output.d.ts +8 -0
  82. package/dist/cli/output.d.ts.map +1 -1
  83. package/dist/cli/output.js +8 -0
  84. package/dist/cli/output.js.map +1 -1
  85. package/dist/cli/statuses.d.ts.map +1 -1
  86. package/dist/cli/statuses.js +12 -2
  87. package/dist/cli/statuses.js.map +1 -1
  88. package/dist/cli/version.d.ts +1 -0
  89. package/dist/cli/version.d.ts.map +1 -1
  90. package/dist/cli/version.js +1 -0
  91. package/dist/cli/version.js.map +1 -1
  92. package/dist/cli-api.d.ts +2 -0
  93. package/dist/cli-api.d.ts.map +1 -1
  94. package/dist/cli-api.js +2 -0
  95. package/dist/cli-api.js.map +1 -1
  96. package/dist/composition/canonical-graph.d.ts +2 -2
  97. package/dist/composition/canonical-graph.js +2 -2
  98. package/dist/composition/canonical-graph.js.map +1 -1
  99. package/dist/composition/consequence.d.ts +15 -5
  100. package/dist/composition/consequence.d.ts.map +1 -1
  101. package/dist/composition/consequence.js +6 -4
  102. package/dist/composition/consequence.js.map +1 -1
  103. package/dist/composition/discovery.d.ts +78 -14
  104. package/dist/composition/discovery.d.ts.map +1 -1
  105. package/dist/composition/discovery.js +73 -23
  106. package/dist/composition/discovery.js.map +1 -1
  107. package/dist/composition/expr-eval.d.ts +1 -1
  108. package/dist/composition/expr-eval.d.ts.map +1 -1
  109. package/dist/composition/expr-eval.js +4 -4
  110. package/dist/composition/expr-eval.js.map +1 -1
  111. package/dist/composition/expr-simplify.d.ts +10 -14
  112. package/dist/composition/expr-simplify.d.ts.map +1 -1
  113. package/dist/composition/expr-simplify.js +49 -52
  114. package/dist/composition/expr-simplify.js.map +1 -1
  115. package/dist/composition/grounding.d.ts.map +1 -1
  116. package/dist/composition/grounding.js +19 -7
  117. package/dist/composition/grounding.js.map +1 -1
  118. package/dist/composition/mathts-quiet.d.ts +4 -6
  119. package/dist/composition/mathts-quiet.d.ts.map +1 -1
  120. package/dist/composition/mathts-quiet.js +4 -14
  121. package/dist/composition/mathts-quiet.js.map +1 -1
  122. package/dist/composition/own-equation-magnitude.d.ts +95 -0
  123. package/dist/composition/own-equation-magnitude.d.ts.map +1 -0
  124. package/dist/composition/own-equation-magnitude.js +270 -0
  125. package/dist/composition/own-equation-magnitude.js.map +1 -0
  126. package/dist/composition/probe/backend-protocol.d.ts +3 -0
  127. package/dist/composition/probe/backend-protocol.d.ts.map +1 -1
  128. package/dist/composition/probe/backend-protocol.js.map +1 -1
  129. package/dist/composition/probe/candidate-store.d.ts +1 -0
  130. package/dist/composition/probe/candidate-store.d.ts.map +1 -1
  131. package/dist/composition/probe/candidate-store.js +1 -0
  132. package/dist/composition/probe/candidate-store.js.map +1 -1
  133. package/dist/composition/probe/corpus.d.ts +4 -2
  134. package/dist/composition/probe/corpus.d.ts.map +1 -1
  135. package/dist/composition/probe/corpus.js +3 -3
  136. package/dist/composition/probe/corpus.js.map +1 -1
  137. package/dist/composition/probe/dataset.d.ts +1 -0
  138. package/dist/composition/probe/dataset.d.ts.map +1 -1
  139. package/dist/composition/probe/dataset.js.map +1 -1
  140. package/dist/composition/probe/experiment-design.d.ts +2 -0
  141. package/dist/composition/probe/experiment-design.d.ts.map +1 -1
  142. package/dist/composition/probe/experiment-design.js.map +1 -1
  143. package/dist/composition/probe/falsify.d.ts +2 -0
  144. package/dist/composition/probe/falsify.d.ts.map +1 -1
  145. package/dist/composition/probe/falsify.js.map +1 -1
  146. package/dist/composition/probe/fit.d.ts +1 -0
  147. package/dist/composition/probe/fit.d.ts.map +1 -1
  148. package/dist/composition/probe/fit.js.map +1 -1
  149. package/dist/composition/probe/generator.d.ts +3 -0
  150. package/dist/composition/probe/generator.d.ts.map +1 -1
  151. package/dist/composition/probe/generator.js +5 -6
  152. package/dist/composition/probe/generator.js.map +1 -1
  153. package/dist/composition/probe/limits.d.ts +1 -0
  154. package/dist/composition/probe/limits.d.ts.map +1 -1
  155. package/dist/composition/probe/limits.js.map +1 -1
  156. package/dist/composition/probe/pipeline.d.ts +5 -0
  157. package/dist/composition/probe/pipeline.d.ts.map +1 -1
  158. package/dist/composition/probe/pipeline.js +64 -21
  159. package/dist/composition/probe/pipeline.js.map +1 -1
  160. package/dist/composition/probe/power-law.d.ts.map +1 -1
  161. package/dist/composition/probe/power-law.js +3 -7
  162. package/dist/composition/probe/power-law.js.map +1 -1
  163. package/dist/composition/probe/problem.d.ts +1 -0
  164. package/dist/composition/probe/problem.d.ts.map +1 -1
  165. package/dist/composition/probe/problem.js.map +1 -1
  166. package/dist/composition/probe/residual.d.ts +1 -0
  167. package/dist/composition/probe/residual.d.ts.map +1 -1
  168. package/dist/composition/probe/residual.js +1 -0
  169. package/dist/composition/probe/residual.js.map +1 -1
  170. package/dist/composition/probe/run-manifest.d.ts +1 -0
  171. package/dist/composition/probe/run-manifest.d.ts.map +1 -1
  172. package/dist/composition/probe/run-manifest.js.map +1 -1
  173. package/dist/composition/probe/scalar-search.d.ts +50 -0
  174. package/dist/composition/probe/scalar-search.d.ts.map +1 -0
  175. package/dist/composition/probe/scalar-search.js +169 -0
  176. package/dist/composition/probe/scalar-search.js.map +1 -0
  177. package/dist/composition/probe/scoring.d.ts +1 -0
  178. package/dist/composition/probe/scoring.d.ts.map +1 -1
  179. package/dist/composition/probe/scoring.js.map +1 -1
  180. package/dist/composition/probe/study.d.ts +2 -2
  181. package/dist/composition/probe/study.d.ts.map +1 -1
  182. package/dist/composition/probe/study.js +6 -10
  183. package/dist/composition/probe/study.js.map +1 -1
  184. package/dist/composition/probe/t-tail.d.ts +3 -4
  185. package/dist/composition/probe/t-tail.d.ts.map +1 -1
  186. package/dist/composition/probe/t-tail.js +7 -10
  187. package/dist/composition/probe/t-tail.js.map +1 -1
  188. package/dist/composition/proposed-bridges.d.ts +11 -2
  189. package/dist/composition/proposed-bridges.d.ts.map +1 -1
  190. package/dist/composition/proposed-bridges.js +7 -5
  191. package/dist/composition/proposed-bridges.js.map +1 -1
  192. package/dist/composition/rational-exponent.d.ts +2 -2
  193. package/dist/composition/rational-exponent.d.ts.map +1 -1
  194. package/dist/composition/rational-exponent.js +4 -4
  195. package/dist/composition/rational-exponent.js.map +1 -1
  196. package/dist/composition/representative-values.d.ts.map +1 -1
  197. package/dist/composition/representative-values.js +6 -0
  198. package/dist/composition/representative-values.js.map +1 -1
  199. package/dist/composition/retrodiction.d.ts +15 -0
  200. package/dist/composition/retrodiction.d.ts.map +1 -1
  201. package/dist/composition/retrodiction.js +10 -3
  202. package/dist/composition/retrodiction.js.map +1 -1
  203. package/dist/composition/user-equation.d.ts +1 -0
  204. package/dist/composition/user-equation.d.ts.map +1 -1
  205. package/dist/composition/user-equation.js +1 -0
  206. package/dist/composition/user-equation.js.map +1 -1
  207. package/dist/core/constants.d.ts +12 -11
  208. package/dist/core/constants.d.ts.map +1 -1
  209. package/dist/core/constants.js +24 -21
  210. package/dist/core/constants.js.map +1 -1
  211. package/dist/diff/bridge-ast-gradient.d.ts +27 -23
  212. package/dist/diff/bridge-ast-gradient.d.ts.map +1 -1
  213. package/dist/diff/bridge-ast-gradient.js +75 -173
  214. package/dist/diff/bridge-ast-gradient.js.map +1 -1
  215. package/dist/dimensional/ast-types.d.ts +15 -0
  216. package/dist/dimensional/ast-types.d.ts.map +1 -1
  217. package/dist/dimensional/ast-types.js.map +1 -1
  218. package/dist/dimensional/curvature-composite.d.ts +1 -1
  219. package/dist/dimensional/curvature-composite.js.map +1 -1
  220. package/dist/dimensional/exact-scale.d.ts +41 -11
  221. package/dist/dimensional/exact-scale.d.ts.map +1 -1
  222. package/dist/dimensional/exact-scale.js +115 -123
  223. package/dist/dimensional/exact-scale.js.map +1 -1
  224. package/dist/dimensional/mathts-unit-delegation.d.ts +29 -0
  225. package/dist/dimensional/mathts-unit-delegation.d.ts.map +1 -0
  226. package/dist/dimensional/mathts-unit-delegation.js +187 -0
  227. package/dist/dimensional/mathts-unit-delegation.js.map +1 -0
  228. package/dist/dimensional/mathts-unit-wrapper.d.ts +33 -0
  229. package/dist/dimensional/mathts-unit-wrapper.d.ts.map +1 -0
  230. package/dist/dimensional/mathts-unit-wrapper.js +190 -0
  231. package/dist/dimensional/mathts-unit-wrapper.js.map +1 -0
  232. package/dist/dimensional/scalar-lowering.d.ts +21 -0
  233. package/dist/dimensional/scalar-lowering.d.ts.map +1 -0
  234. package/dist/dimensional/scalar-lowering.js +45 -0
  235. package/dist/dimensional/scalar-lowering.js.map +1 -0
  236. package/dist/dimensional/unit-data.d.ts +5 -1
  237. package/dist/dimensional/unit-data.d.ts.map +1 -1
  238. package/dist/dimensional/unit-data.js +28 -4
  239. package/dist/dimensional/unit-data.js.map +1 -1
  240. package/dist/dimensional/units.d.ts +2 -0
  241. package/dist/dimensional/units.d.ts.map +1 -1
  242. package/dist/dimensional/units.js +59 -3
  243. package/dist/dimensional/units.js.map +1 -1
  244. package/dist/dimensional/validator.d.ts +2 -0
  245. package/dist/dimensional/validator.d.ts.map +1 -1
  246. package/dist/dimensional/validator.js.map +1 -1
  247. package/dist/index.js.map +1 -1
  248. package/dist/numerical/connection-lowering-helpers.d.ts +3 -1
  249. package/dist/numerical/connection-lowering-helpers.d.ts.map +1 -1
  250. package/dist/numerical/connection-lowering-helpers.js +11 -15
  251. package/dist/numerical/connection-lowering-helpers.js.map +1 -1
  252. package/dist/numerical/pderiv.d.ts.map +1 -1
  253. package/dist/numerical/pderiv.js +2 -6
  254. package/dist/numerical/pderiv.js.map +1 -1
  255. package/dist/numerical/quadrature.js +3 -3
  256. package/dist/numerical/quadrature.js.map +1 -1
  257. package/dist/numerical/statistics.js +1 -1
  258. package/dist/numerical/statistics.js.map +1 -1
  259. package/dist/numerical/strides.d.ts +3 -2
  260. package/dist/numerical/strides.d.ts.map +1 -1
  261. package/dist/numerical/strides.js +3 -10
  262. package/dist/numerical/strides.js.map +1 -1
  263. package/package.json +9 -12
  264. package/dist/cases/brownian-sphere.d.ts +0 -68
  265. package/dist/cases/brownian-sphere.d.ts.map +0 -1
  266. package/dist/cases/brownian-sphere.js +0 -355
  267. package/dist/cases/brownian-sphere.js.map +0 -1
  268. package/dist/cases/damped-resonator.d.ts +0 -23
  269. package/dist/cases/damped-resonator.d.ts.map +0 -1
  270. package/dist/cases/damped-resonator.js +0 -221
  271. package/dist/cases/damped-resonator.js.map +0 -1
  272. package/dist/cases/kepler-rv.d.ts +0 -13
  273. package/dist/cases/kepler-rv.d.ts.map +0 -1
  274. package/dist/cases/kepler-rv.js +0 -173
  275. package/dist/cases/kepler-rv.js.map +0 -1
  276. package/dist/cases/lumped-cooling.d.ts +0 -51
  277. package/dist/cases/lumped-cooling.d.ts.map +0 -1
  278. package/dist/cases/lumped-cooling.js +0 -259
  279. package/dist/cases/lumped-cooling.js.map +0 -1
  280. package/dist/cases/resistor-noise.d.ts +0 -14
  281. package/dist/cases/resistor-noise.d.ts.map +0 -1
  282. package/dist/cases/resistor-noise.js +0 -215
  283. package/dist/cases/resistor-noise.js.map +0 -1
  284. package/dist/cases/skin-depth.d.ts +0 -17
  285. package/dist/cases/skin-depth.d.ts.map +0 -1
  286. package/dist/cases/skin-depth.js +0 -170
  287. package/dist/cases/skin-depth.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.js","sourceRoot":"","sources":["../../src/cases/methods.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,kBA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M,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,GAAG,CAAC,sBAAsB,CAAE,CAAC;AAEtF,KAAK,MAAM,GAAG,IAAI,uBAAuB,CAAC,kBAAkB,EAAE,EAAE,iBAAiB,CAAC,EAAE,CAAC;IACnF,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC","sourcesContent":["/**\n * Numeric methods and case runners for applied cases (Part B catalog).\n *\n * @module cases/methods\n */\nimport { findRoot } from '@danielsimonjr/mathts-functions';\nimport { C_SI, EPS0_SI, G_SI, H_SI, K_B_SI, MU0_SI, SIGMA_SB_SI } from '../core/constants.js';\nimport { convertValue } from '../dimensional/units.js';\nimport { catalogRelations } from '../bridges/catalog-load.js';\nimport { evaluateCatalogRelation } from '../bridges/relation-eval.js';\nimport { integrateRK4 } from '../numerical/null-ray-integrator.js';\nimport { adaptiveQuadrature } from './quadrature.js';\nimport { appliedCaseCatalog, appliedCaseRecord, assembleAppliedCase, catalogSemanticProblems } from './catalog.js';\nimport { runAppliedCaseEngine, usesCatalogEngine, registerCaseMethods } from './engine.js';\nimport { check, requirePositive, signedRelativeDifference, type AppliedCase, type CaseResult, type LumpedRadiating } from './types.js';\n\n/** Lumped body with radiative cooling parameters (re-export). */\nexport type { LumpedRadiating } from './types.js';\n\n// --- skin-depth.ts ---\nconst SKIN_DEPTH_ID = 'case-skin-depth';\n\n/** ωε/σ ceiling: the displacement current then moves the penetration depth by ≈ ωε/(2σ) ≤ 0.5%. @internal */\nexport const MAX_DISPLACEMENT_RATIO = 0.01;\n\n/** l/δ ceiling for a local (classical) conductivity. @internal */\nexport const MAX_MFP_RATIO = 0.1;\n\n/** ωτ ceiling: the Drude σ(ω) = σ0/(1 − iωτ) is then within 0.5% of σ0 in modulus. @internal */\nexport const MAX_OMEGA_TAU = 0.1;\n\n/** d/δ floor: the field reaching the back face is then ≤ e^{−5} ≈ 0.7% of the surface field. @internal */\nexport const MIN_THICKNESS_RATIO = 5;\n\n/**\n * δ_Maxwell/δ for the plane wave k² = ω²με + iωμσ, as a function of r = ωε/σ:\n * 1/Im k = δ √(√(1 + r²) + r), written without the cancellation of |z| − Re z.\n * @internal\n */\nexport function maxwellDepthFactor(r: number): number {\n return Math.sqrt(Math.hypot(1, r) + r);\n}\n\n/** Parent penetration depth δ_M from classical δ and r = ωε/σ. @internal */\nexport function skinDeltaMaxwellM(\n _inputs: Readonly<Record<string, number>>,\n outputs: Readonly<Record<string, number | null>>,\n): number {\n const delta = outputs.delta_m;\n const r = outputs.displacement_ratio;\n if (delta === null || r === null || !Number.isFinite(delta) || !Number.isFinite(r)) {\n throw new Error('skinDeltaMaxwellM: need finite delta_m and displacement_ratio');\n }\n return delta * maxwellDepthFactor(r);\n}\n/**\n * Evaluate the skin-depth applied case at the given SI inputs.\n * @internal\n */\nexport function runCaseSkinDepth(i: Readonly<Record<string, number>>): CaseResult {\n requirePositive(SKIN_DEPTH_ID, i, ['rho_ohm_m', 'f_Hz', 'mu_r', 'eps_r', 'l_mfp_m', 'v_carrier_m_per_s', 'thickness_m']);\n const { rho_ohm_m: rho, f_Hz: f, mu_r: muR, eps_r: epsR, l_mfp_m: l, v_carrier_m_per_s: v, thickness_m: d } = i as Record<string, number>;\n const omega = 2 * Math.PI * f;\n const mu = muR * MU0_SI;\n const delta = Math.sqrt((2 * rho) / (omega * mu));\n const r = omega * epsR * EPS0_SI * rho;\n const deltaMaxwell = delta * maxwellDepthFactor(r);\n const omegaTau = (omega * l) / v;\n return {\n outputs: {\n omega_per_s: omega,\n delta_m: delta,\n R_s_ohm: rho / delta,\n delta_maxwell_m: deltaMaxwell,\n maxwell_deviation: delta / deltaMaxwell - 1,\n displacement_ratio: r,\n mfp_ratio: l / delta,\n omega_tau: omegaTau,\n thickness_ratio: d / delta,\n back_field_ratio: Math.exp(-d / delta),\n },\n checks: [\n check('good-conductor', 'good conductor: conduction current ≫ displacement current', 'ωε/σ', r, '<=', MAX_DISPLACEMENT_RATIO,\n 'chosen threshold for ≪ 1: the parent penetration depth then differs from δ by ≈ ωε/(2σ) ≤ 0.5%'),\n check('local', 'local conductivity: the carriers\\' mean free path well inside the skin depth, l ≪ δ', 'l/δ', l / delta, '<=', MAX_MFP_RATIO,\n 'chosen threshold for ≪ 1; beyond it the current at a point depends on the field over a path l and the anomalous skin effect sets in (Pippard 1947; Reuter & Sondheimer 1948)'),\n check('dc-conductivity', 'DC conductivity: the drive is slow beside the carrier relaxation, ωτ ≪ 1', 'ω l/v', omegaTau, '<=', MAX_OMEGA_TAU,\n 'chosen threshold for ≪ 1: the Drude σ(ω) = σ0/(1 − iωτ) is then within 0.5% of σ0 in modulus'),\n check('thick', 'the conductor is a half-space for the field: d ≫ δ', 'd/δ', d / delta, '>=', MIN_THICKNESS_RATIO,\n 'chosen threshold: the half-space field at the back face is then ≤ e^{−5} ≈ 0.7% of the surface field'),\n ],\n unchecked: [\n 'ρ, μ_r and ε_r are the values at the conductor\\'s temperature and at f; τ = l/v assumes one carrier species with one speed',\n 'the conductor is planar on the scale of δ (a wire of radius a needs a ≫ δ, not checked here)',\n ],\n };\n \n}\n\n// --- kepler-rv.ts ---\nconst KEPLER_RV_ID = 'case-kepler-rv';\n\n/** The Julian year, the year BE-52 takes (s): the unit table's `julian_year` row (`yr`). @internal */\nexport const JULIAN_YEAR_S = convertValue('1 yr', 's').value;\n\n/** m_p/M_* ceiling: the test-mass K then exceeds the two-body K by (1 + q)^{2/3} − 1 ≤ 0.67%. @internal */\nexport const MAX_MASS_RATIO = 0.01;\n\n/** Ceiling on the stellar radius over the periastron separation, for point masses. @internal */\nexport const MAX_RADIUS_RATIO = 0.1;\n\n/** G(M_* + m_p)/(c² a) ceiling for Newtonian gravity. @internal */\nexport const MAX_WEAK_FIELD = 1e-4;\n\n/** e·Δω accumulated over the record (rad) ceiling for a fixed ellipse. @internal */\nexport const MAX_APSIDAL_MISFIT = 0.01;\n/**\n * Evaluate the Kepler radial-velocity applied case at the given SI inputs.\n * @internal\n */\nexport function runCaseKeplerRv(i: Readonly<Record<string, number>>): CaseResult {\n requirePositive(KEPLER_RV_ID, i, ['M_star_kg', 'm_p_kg', 'P_s', 'sin_i', 'R_star_m', 'T_obs_s']);\n const { M_star_kg: M, m_p_kg: m, P_s: P, eccentricity: e, sin_i: sinI, R_star_m: R, T_obs_s: tObs } = i as Record<string, number>;\n if (!Number.isFinite(e) || e < 0 || e >= 1) throw new Error(`${KEPLER_RV_ID}: eccentricity must be in [0, 1) (got ${e})`);\n if (sinI > 1) throw new Error(`${KEPLER_RV_ID}: sin_i must be in (0, 1] (got ${sinI})`);\n const total = M + m;\n const a = Math.cbrt((G_SI * total * P * P) / (4 * Math.PI * Math.PI));\n const root = Math.sqrt(1 - e * e);\n const n13 = Math.cbrt((2 * Math.PI * G_SI) / P);\n const K = (n13 * m * sinI) / Math.cbrt(M * M) / root;\n const K2b = (n13 * m * sinI) / Math.cbrt(total * total) / root;\n const rPeri = a * (1 - e);\n const weak = (G_SI * total) / (C_SI * C_SI * a);\n const advance = catalogRelations().find((row) => row.target === 'perihelion-advance');\n if (advance === undefined) throw new Error(`${KEPLER_RV_ID}: the perihelion relation is not in the catalog`);\n const dphi = evaluateCatalogRelation(advance, { mass: total, 'semi-major-axis': a, eccentricity: e });\n const misfit = (e * dphi * tObs) / P;\n return {\n outputs: {\n q: m / M,\n a_m: a,\n a_star_m: (a * m) / total,\n K_m_per_s: K,\n K_two_body_m_per_s: K2b,\n two_body_deviation: K / K2b - 1,\n r_peri_m: rPeri,\n weak_field: weak,\n dphi_rad_per_orbit: dphi,\n omega_dot_deg_per_yr: ((dphi / P) * JULIAN_YEAR_S * 180) / Math.PI,\n apsidal_misfit: misfit,\n },\n checks: [\n check('test-mass', 'the companion is light beside the star, m_p ≪ M_*', 'm_p/M_*', m / M, '<=', MAX_MASS_RATIO,\n 'chosen threshold: the test-mass K then exceeds the two-body K by (1 + q)^{2/3} − 1 ≤ 0.67%'),\n check('point-mass', 'point masses: the star is small beside the closest approach, R_* ≪ r_p', 'R_*/(a(1 − e))', R / rPeri, '<=', MAX_RADIUS_RATIO,\n 'chosen threshold: tidal and rotational quadrupole terms scale as (R_*/r)² times a Love number or J2 (each < 1), kept ≤ 1%'),\n check('weak-field', 'Newtonian gravity: G(M_* + m_p)/(c²a) ≪ 1', 'G(M_* + m_p)/(c² a)', weak, '<=', MAX_WEAK_FIELD,\n 'chosen threshold: the 1PN corrections to the P–a relation and to the orbital velocity are of this relative order'),\n check('apsidal', 'a fixed ellipse over the record: the GR apsidal advance does not reshape the RV curve', 'e Δω T_obs/P', misfit, '<=', MAX_APSIDAL_MISFIT,\n 'chosen threshold: beyond the mean longitude (absorbed by the fitted phase), v_r depends on ω only at O(e), so the misfit is of order e Δω K; its coefficient (order one) is not encoded'),\n ],\n unchecked: [\n 'no third body: an outer companion adds its own reflex signal and perturbs P and ω',\n 'the companion\\'s radius is also small beside r_p (only the star\\'s is checked)',\n ],\n };\n \n}\n\n// --- damped-resonator.ts ---\nconst DAMPED_RESONATOR_ID = 'case-damped-resonator';\n\n/** Q floor for the single-Lorentzian (near-resonance) form of the spectrum. @internal */\nexport const MIN_Q_LORENTZIAN = 10;\n\n/** (1/t_obs)/linewidth ceiling: the record resolves the line. @internal */\nexport const MAX_RESOLUTION_RATIO = 0.1;\n\n/**\n * √(k_BT/k)/A ceiling. Thermal motion of one mode is x = X cos ω_d t + Y sin ω_d t\n * with ⟨X²⟩ = ⟨Y²⟩ = k_BT/k (equipartition), so the envelope of the ring-down\n * plus it is Rician with ⟨A_obs²⟩ = A² + 2k_BT/k (Rice 1944); at the ceiling\n * √(1 + 2·0.01) − 1 ≈ 0.0100.\n * @internal\n */\nexport const MAX_THERMAL_RATIO = 0.1;\n\n/**\n * FWHM in Hz of |∫₀ᵀ e^{−(α + iΔω)t} dt|², the near-resonance power spectrum of\n * a ring-down x0 e^{−αt} cos(ω_d t) recorded for T. The negative-frequency\n * pole is dropped, which is the Q ≫ 1 approximation. The peak is at Δω = 0:\n * the integrand is positive, so |X(Δω)| ≤ X(0).\n * @internal\n */\nexport function windowedLinewidthHz(alpha: number, T: number): number {\n const oneMinusE = -Math.expm1(-alpha * T);\n const E = 1 - oneMinusE;\n // (1 − E)² + 4E sin²(ΔωT/2) is 1 − 2E cos(ΔωT) + E² without its cancellation near Δω = 0.\n const power = (dw: number) => (oneMinusE ** 2 + 4 * E * Math.sin((dw * T) / 2) ** 2) / (alpha * alpha + dw * dw);\n const half = power(0) / 2;\n const h = (alpha + 1 / T) / 200;\n let lo = 0;\n let hi = h;\n for (let k = 1; power(hi) > half; k++) {\n if (k > 1e6) throw new Error(`${DAMPED_RESONATOR_ID}: no half-power point found (α = ${alpha}, T = ${T})`);\n lo = hi;\n hi += h;\n }\n // The crossing inside the first step past half power, by MathTS `findRoot` (Brent) on the\n // order-one residual power/half − 1, to the bracket's floating-point resolution.\n const crossing = findRoot((dw) => power(dw) / half - 1, lo, hi, { tol: 4 * Number.EPSILON * hi, maxIter: 200 });\n return crossing / Math.PI;\n}\n\n/** Catalog engine: FWHM of the truncated ring-down spectrum (null when overdamped). @internal */\nexport function windowedLinewidthCatalogHz(\n inputs: Readonly<Record<string, number>>,\n outputs: Readonly<Record<string, number | null>>,\n): number | null {\n if (inputs.Q! <= 0.5) return null;\n const alpha = outputs.alpha_per_s;\n if (alpha === null || !Number.isFinite(alpha)) return null;\n return windowedLinewidthHz(alpha, inputs.t_obs_s!);\n}\n\n/**\n * Evaluate the damped-resonator applied case at the given SI inputs.\n * @internal\n */\nexport function runCaseDampedResonator(i: Readonly<Record<string, number>>): CaseResult {\n requirePositive(DAMPED_RESONATOR_ID, i, ['f0_Hz', 'Q', 't_obs_s']);\n const { f0_Hz: f0, Q, x0_m: x0, t_s: t, t_obs_s: tObs } = i as Record<string, number>;\n if (!Number.isFinite(x0)) throw new Error(`${DAMPED_RESONATOR_ID}: x0_m must be finite (got ${x0})`);\n if (!Number.isFinite(t) || t < 0) throw new Error(`${DAMPED_RESONATOR_ID}: t_s must be a finite number ≥ 0 (got ${t})`);\n const w0 = 2 * Math.PI * f0;\n const alpha = w0 / (2 * Q);\n const linewidth = f0 / Q;\n const underdamped = Q > 0.5;\n const root = underdamped ? Math.sqrt(1 - 1 / (4 * Q * Q)) : NaN;\n const wd = w0 * root;\n const decay = Math.exp(-alpha * t);\n const windowed = underdamped ? windowedLinewidthHz(alpha, tObs) : null;\n const envelope = underdamped ? (Math.abs(x0) * decay) / root : null;\n const checks = [\n check('underdamped', 'underdamped: the solution rings (Q > 1/2)', 'Q', Q, '>', 0.5,\n 'exact: at Q ≤ 1/2 the solution is a sum of real exponentials, with no ring-down, f_d or envelope'),\n check('single-lorentzian', 'high Q: the line near f0 is one Lorentzian', 'Q', Q, '>=', MIN_Q_LORENTZIAN,\n 'chosen threshold for Q ≫ 1: the windowed spectrum drops the negative-frequency pole'),\n check('resolved', 'the record resolves the line: 1/t_obs ≪ f0/Q', '(1/t_obs)/(f0/Q)', 1 / tObs / linewidth, '<=', MAX_RESOLUTION_RATIO,\n 'chosen threshold for ≪ 1; see windowed_excess for the broadening it allows'),\n check('in-record', 'the read-out time lies inside the record', 't/t_obs', t / tObs, '<=', 1,\n 'exact: an envelope read after the record ends was not measured'),\n ];\n const unchecked = underdamped\n ? ['the damping is viscous (velocity-proportional) and the same over the whole ring-down']\n : ['for Q ≤ 1/2 the displacement is x0 (r₂e^{r₁t} − r₁e^{r₂t})/(r₂ − r₁) with real r₁, r₂; this case does not evaluate it'];\n if ((i.T_K === undefined) !== (i.k_N_per_m === undefined)) throw new Error(`${DAMPED_RESONATOR_ID}: give T_K and k_N_per_m together, or neither`);\n let xTh: number | null = null;\n if (i.T_K !== undefined) {\n requirePositive(DAMPED_RESONATOR_ID, i, ['T_K', 'k_N_per_m']);\n xTh = Math.sqrt((K_B_SI * i.T_K) / i.k_N_per_m!);\n if (envelope !== null) {\n checks.push(\n check('above-thermal', 'the ring-down stands above the thermal motion at t', '√(k_BT/k)/A(t)', xTh / envelope, '<=', MAX_THERMAL_RATIO,\n 'chosen threshold: the RMS envelope √(A² + 2k_BT/k) then exceeds A by ≤ 1%'),\n );\n }\n unchecked.push('the thermal motion is in equilibrium with the damping bath at T and uncorrelated with the release; the read-out adds no noise of its own');\n }\n return {\n outputs: {\n alpha_per_s: alpha,\n tau_s: 1 / alpha,\n linewidth_Hz: linewidth,\n f_d_Hz: underdamped ? f0 * root : null,\n x_m: underdamped ? x0 * decay * (Math.cos(wd * t) + (alpha / wd) * Math.sin(wd * t)) : null,\n envelope_m: envelope,\n resolution_Hz: 1 / tObs,\n linewidth_windowed_Hz: windowed,\n windowed_excess: windowed === null ? null : windowed / linewidth - 1,\n x_th_rms_m: xTh,\n envelope_rms_m: xTh === null || envelope === null ? null : Math.sqrt(envelope * envelope + 2 * xTh * xTh),\n },\n checks,\n unchecked,\n };\n \n}\n\n// --- resistor-noise.ts ---\nconst RESISTOR_NOISE_ID = 'case-resistor-noise';\n\n/** h f_hi/(k_B T) ceiling: the Planck factor x/(eˣ−1) is then within x/2 ≤ 0.5% of 1. @internal */\nexport const CLASSICAL_MAX_X = 0.01;\n\n/** 2π f_hi R_eff C_in ceiling: the input RC pole then passes 1/(1+w²) ≥ 99% at f_hi. @internal */\nexport const FLAT_BAND_MAX_WRC = 0.1;\n\n/**\n * Ceiling on σ(S_R)/S_R = 1/(φ√(B t_avg)): the resistor's noise power, left after\n * subtracting an exactly known amplifier power, scatters by ≤ 1%. The total\n * power scatters by 1/√(B t_avg) (Dicke 1946); φ is the resistor's share of it.\n * @internal\n */\nexport const AMPLIFIER_MAX_REL_SIGMA = 0.01;\n\n/** Nyquist's thermal spectral density at f, shaped by the input RC; `x/expm1(x)` → 1 as x → 0. */\nfunction parentDensity(f: number, T: number, rEff: number, c: number): number {\n const x = (H_SI * f) / (K_B_SI * T);\n const planck = x === 0 ? 1 : x / Math.expm1(x);\n const w = 2 * Math.PI * f * rEff * c;\n return (4 * K_B_SI * T * rEff * planck) / (1 + w * w);\n}\n/**\n * Evaluate the resistor thermal-noise applied case at the given SI inputs.\n * @internal\n */\nexport function runCaseResistorNoise(i: Readonly<Record<string, number>>): CaseResult {\n requirePositive(RESISTOR_NOISE_ID, i, ['T_K', 'R_ohm', 'R_in_ohm', 'f_hi_Hz', 't_avg_s']);\n const { T_K: T, R_ohm: R, R_in_ohm: Rin, C_in_F: C, f_lo_Hz: fLo, f_hi_Hz: fHi, t_avg_s: tAvg } = i as Record<string, number>;\n if (!Number.isFinite(C) || C < 0) throw new Error(`${RESISTOR_NOISE_ID}: C_in_F must be a finite number ≥ 0 (got ${C})`);\n if (!Number.isFinite(fLo) || fLo < 0 || fLo >= fHi) throw new Error(`${RESISTOR_NOISE_ID}: need 0 ≤ f_lo_Hz < f_hi_Hz (got ${fLo}, ${fHi})`);\n const B = fHi - fLo;\n const rEff = (R * Rin) / (R + Rin);\n const noise = catalogRelations().find((row) => row.target === 'voltage-noise-density');\n if (noise === undefined) throw new Error(`${RESISTOR_NOISE_ID}: the resistor-noise relation is not in the catalog`);\n const spectral = (temperature: number, ohms: number): number =>\n evaluateCatalogRelation(noise, { 'johnson-temperature': temperature, resistance: ohms });\n const S = spectral(T, rEff);\n const S0 = spectral(T, R);\n const vRms = Math.sqrt(S * B);\n const vParent = Math.sqrt(adaptiveQuadrature((f) => parentDensity(f, T, rEff, C), fLo, fHi));\n const x = (H_SI * fHi) / (K_B_SI * T);\n const wrc = 2 * Math.PI * fHi * rEff * C;\n const checks = [\n check('classical', 'flat, classical spectrum: hf ≪ k_BT across the band', 'h f_hi/(k_B T)', x, '<=', CLASSICAL_MAX_X,\n 'chosen threshold for ≪ 1: the Planck factor at f_hi is then within x/2 ≤ 0.5% of 1'),\n check('flat-band', 'the input RC pole lies above the band', '2π f_hi R_eff C_in', wrc, '<=', FLAT_BAND_MAX_WRC,\n 'chosen threshold for ≪ 1: the RC low-pass then passes ≥ 99% of the density at f_hi'),\n ];\n const unchecked = [\n 'R_in is a physical resistance at T; an actively synthesized or cold input adds less noise than its resistance would, ' +\n 'down to the resistor alone divided by the input: V_rms,0 · R_in/(R + R_in)',\n 'no DC current through R, so no 1/f excess noise',\n ];\n const withAmplifier = i.e_n2_V2_per_Hz !== undefined || i.i_n2_A2_per_Hz !== undefined;\n let amp: { total: number; fraction: number; tN: number } | null = null;\n if (withAmplifier) {\n const en2 = i.e_n2_V2_per_Hz ?? 0;\n const in2 = i.i_n2_A2_per_Hz ?? 0;\n for (const [k, v] of [['e_n2_V2_per_Hz', en2], ['i_n2_A2_per_Hz', in2]] as const) {\n if (!Number.isFinite(v) || v < 0) throw new Error(`${RESISTOR_NOISE_ID}: ${k} must be a finite number ≥ 0 (got ${v})`);\n }\n const excess = en2 + in2 * rEff * rEff;\n const fraction = S / (S + excess);\n amp = { total: Math.sqrt((S + excess) * B), fraction, tN: excess / (4 * K_B_SI * rEff) };\n checks.push(\n check('amplifier', \"the resistor's noise is resolved above the amplifier's in t_avg\", '1/(φ √(B t_avg))', 1 / (fraction * Math.sqrt(B * tAvg)), '<=',\n AMPLIFIER_MAX_REL_SIGMA,\n \"chosen threshold: after subtracting the amplifier's power (known exactly, e.g. from a long shorted-input run) the resistor's power scatters by ≤ 1%\"),\n );\n unchecked.push(\n `e_n and i_n are white over the band and uncorrelated${i.e_n2_V2_per_Hz === undefined ? '; e_n was not given and is taken as 0' : ''}` +\n `${i.i_n2_A2_per_Hz === undefined ? '; i_n was not given and is taken as 0' : ''}`,\n );\n }\n return {\n outputs: {\n B_Hz: B,\n R_eff_ohm: rEff,\n S_V_V2_per_Hz: S,\n V_rms_unloaded_V: Math.sqrt(S0 * B),\n V_rms_V: vRms,\n loading_ratio: Math.sqrt(S / S0),\n V_rms_parent_V: vParent,\n parent_deviation: vRms / vParent - 1,\n V_rms_rel_sigma: 1 / (2 * Math.sqrt(B * tAvg)),\n V_rms_total_V: amp?.total ?? null,\n resistor_fraction: amp?.fraction ?? null,\n T_n_K: amp?.tN ?? null,\n },\n checks,\n unchecked,\n };\n \n}\n\n// --- lumped-cooling.ts ---\nconst LUMPED_COOLING_ID = 'case-lumped-cooling';\n\n/** The Stefan–Boltzmann constant (W m⁻² K⁻⁴) is `core/constants`'s; re-exported so the record's module-export table keeps its row. @internal */\nexport { SIGMA_SB_SI } from '../core/constants.js';\n\n/** Bi = h L_c/k ceiling, L_c = V/A (Incropera §5.2, eq. 5.10). @internal */\nexport const MAX_BIOT = 0.1;\n\n/** h_rad,max/h ceiling for a loss linear in T − T∞. @internal */\nexport const MAX_RADIATION_RATIO = 0.1;\n\n\n/**\n * T(t) of ρcV dT/dt = −A[h(T − T∞) + εσ_SB(T⁴ − T∞⁴)] for a sphere (V/A =\n * a/3), by classical RK4 (`integrateRK4`, MathTS `solveODESystem` with `dt`,\n * one call per step) with each step 1/100 of the local relaxation time\n * ρca/(3(h + 4εσ_SB T³)). Stops early once |T − T∞| is below 1e-15 |T0 − T∞|.\n * @internal\n */\nexport function lumpedRadiatingTemperature(p: LumpedRadiating): number {\n const k = 3 / (p.rho * p.c * p.a);\n const f = (_t: number, y: readonly number[]): number[] => {\n const T = y[0]!;\n return [-k * (p.h * (T - p.Tinf) + p.eps * SIGMA_SB_SI * (T ** 4 - p.Tinf ** 4))];\n };\n const floor = 1e-15 * Math.abs(p.T0 - p.Tinf);\n let T = p.T0;\n let s = 0;\n while (s < p.t && Math.abs(T - p.Tinf) > floor) {\n const rate = k * (p.h + 4 * p.eps * SIGMA_SB_SI * Math.max(T, p.Tinf) ** 3);\n const dt = Math.min(p.t - s, 0.01 / rate);\n T = integrateRK4(f, [T], s, s + dt, 1)[0] ?? Number.NaN;\n s += dt;\n }\n return T;\n}\n\n/**\n * The first n roots of 1 − ζ cot ζ = Bi (Bi = h a/k, radius-based): the n-th\n * lies in ((n−1)π, nπ), where the left side runs from −∞ (0 for n = 1) to +∞.\n * Each is MathTS `findRoot` (Brent) on that interval, pulled in from the\n * poles by a few ulps of kπ, since the solver evaluates both ends: at 0 the\n * function is 0/0, and at an exact multiple of π `Math.tan` has no sign to\n * trust. The tolerance is the bracket's own floating-point resolution.\n * @internal\n */\nexport function sphereEigenvalues(biRadius: number, n: number): number[] {\n const f = (z: number) => 1 - z / Math.tan(z) - biRadius;\n const roots: number[] = [];\n for (let k = 1; k <= n; k++) {\n const hi = k * Math.PI;\n const inset = 8 * Number.EPSILON * hi;\n const lo = k === 1 ? Number.MIN_VALUE : (k - 1) * Math.PI + inset;\n roots.push(findRoot(f, lo, hi - inset, { tol: 4 * Number.EPSILON * hi, maxIter: 200 }));\n }\n return roots;\n}\n\n/**\n * θ/θ0 = (T − T∞)/(T0 − T∞) from the series solution of the sphere with a\n * convective surface, at Fourier number Fo = αt/a², for the volume mean, the\n * centre and the surface. Terms are summed until e^{−ζ²Fo} < 1e-18.\n * @throws Error when Fo is so small that the series would need over 1e5 terms.\n * @internal\n */\nexport function sphereSeries(biRadius: number, fo: number): { mean: number; centre: number; surface: number } {\n if (fo === 0) return { mean: 1, centre: 1, surface: 1 };\n const terms = Math.ceil(Math.sqrt(42 / fo) / Math.PI) + 2;\n if (terms > 1e5) throw new Error(`${LUMPED_COOLING_ID}: Fo = ${fo} is too small for the series (needs ${terms} terms)`);\n let mean = 0;\n let centre = 0;\n let surface = 0;\n for (const z of sphereEigenvalues(biRadius, terms)) {\n const s = Math.sin(z);\n const c = Math.cos(z);\n const cn = (4 * (s - z * c)) / (2 * z - Math.sin(2 * z));\n const decay = Math.exp(-z * z * fo);\n centre += cn * decay;\n surface += (cn * decay * s) / z;\n mean += (cn * decay * 3 * (s - z * c)) / z ** 3;\n }\n return { mean, centre, surface };\n}\n/**\n * Evaluate the lumped thermal cooling applied case at the given SI inputs.\n * @internal\n */\nexport function runCaseLumpedCooling(i: Readonly<Record<string, number>>): CaseResult {\n requirePositive(LUMPED_COOLING_ID, i, ['a_m', 'rho_kg_per_m3', 'c_J_per_kg_K', 'k_W_per_m_K', 'h_W_per_m2_K', 'T0_K', 'T_inf_K']);\n const {\n a_m: a, rho_kg_per_m3: rho, c_J_per_kg_K: c, k_W_per_m_K: k, h_W_per_m2_K: h,\n emissivity: eps, T0_K: T0, T_inf_K: Tinf, t_s: t,\n } = i as Record<string, number>;\n if (!Number.isFinite(eps) || eps < 0 || eps > 1) throw new Error(`${LUMPED_COOLING_ID}: emissivity must be in [0, 1] (got ${eps})`);\n if (!Number.isFinite(t) || t < 0) throw new Error(`${LUMPED_COOLING_ID}: t_s must be a finite number ≥ 0 (got ${t})`);\n const tau = (rho * c * a) / (3 * h);\n const bi = (h * (a / 3)) / k;\n const biRadius = (h * a) / k;\n const alpha = k / (rho * c);\n const fo = (alpha * t) / (a * a);\n const theta = Math.exp(-t / tau);\n const series = sphereSeries(biRadius, fo);\n const dT0 = T0 - Tinf;\n const Tmax = Math.max(T0, Tinf);\n const hRad = eps * SIGMA_SB_SI * (Tmax + Tinf) * (Tmax * Tmax + Tinf * Tinf);\n const volume = (4 / 3) * Math.PI * a ** 3;\n const biRadiating = ((h + hRad) * (a / 3)) / k;\n const tRadiating = biRadiating <= MAX_BIOT ? lumpedRadiatingTemperature({ a, rho, c, h, eps, T0, Tinf, t }) : null;\n return {\n outputs: {\n tau_s: tau,\n Bi: bi,\n Bi_radius: biRadius,\n alpha_m2_per_s: alpha,\n Fo: fo,\n theta,\n T_K: Tinf + dT0 * theta,\n Q_J: rho * c * volume * dT0 * -Math.expm1(-t / tau),\n theta_parent_mean: series.mean,\n parent_deviation: theta / series.mean - 1,\n T_centre_K: Tinf + dT0 * series.centre,\n T_surface_K: Tinf + dT0 * series.surface,\n h_rad_max_W_per_m2_K: hRad,\n Bi_radiating: biRadiating,\n T_radiating_K: tRadiating,\n },\n checks: [\n check('lumped', 'one temperature for the sphere: internal conduction fast beside surface loss, Bi ≪ 1', 'h (a/3)/k', bi, '<=', MAX_BIOT,\n 'the conventional criterion Bi ≤ 0.1 with L_c = V/A (Incropera §5.2); parent_deviation shows the error it leaves at t'),\n check('linear-loss', 'the loss is linear in T − T∞: radiation small beside convection', 'εσ_SB(T_max + T∞)(T_max² + T∞²)/h', hRad / h, '<=', MAX_RADIATION_RATIO,\n 'chosen threshold: the neglected radiative conductance is ≤ 10% of h at the hottest point of the run (Incropera eq. 1.9 linearization)'),\n ],\n unchecked: [\n 'h is uniform over the sphere and constant in time; for natural convection it falls as the sphere approaches T∞',\n 'ρ, c and k are constant over [min(T0, T∞), max(T0, T∞)]',\n ],\n };\n \n}\n\n// --- brownian-sphere.ts ---\nconst BROWNIAN_SPHERE_ID = 'case-brownian-sphere';\n\n/** Standard gravity (CGPM 1901), for the sedimentation speed: the unit table's `standard_gravity` row, read as newtons per kilogram-force. @internal */\nexport const G_STANDARD = convertValue('1 kgf/kg', 'm/s^2').value;\n\n/** The thresholds `ab-stokes-einstein` states: Re ≤ 0.1 and τ_p/t ≤ 0.01. @internal */\nexport const MAX_RE = 0.1;\n/** τ_p/t ceiling beside the Stokes–Einstein regime. @internal */\nexport const MAX_TAU_P_RATIO = 0.01;\n\n/** Ceiling on the memory term's own share of the MSD, |MSD_H/MSD_OU − 1|. @internal */\nexport const MAX_MEMORY_CORRECTION = 0.01;\n\n/** (v_s t)²/(2Dt) ceiling along gravity when the vertical axis is tracked. @internal */\nexport const MAX_DRIFT_RATIO = 0.01;\n\n/** Ceiling on |MSD/MSD_wall − 1|: the wall's correction to the tracked MSD is negligible. @internal */\nexport const MAX_WALL_CORRECTION = 0.01;\n\n/** Ceiling on the last retained Faxén term (a/h)⁵/16 over the series' value. @internal */\nexport const MAX_FAXEN_LAST_TERM = 0.01;\n\n/** Ceiling on √(2 D_⊥ t)/(h − a): the height, and so D_∥ and D_⊥, barely change over t. @internal */\nexport const MAX_WALL_EXCURSION = 0.1;\n\n/** t − τ(1 − e^{−t/τ}) in units of τ, i.e. x − (1 − e^{−x}), without its cancellation at small x. @internal */\nexport function ballisticDeficit(x: number): number {\n return x < 1e-3 ? x * x * (1 / 2 - x / 6 + (x * x) / 24 - (x * x * x) / 120) : x + Math.expm1(-x);\n}\n\n/**\n * MSD/(2Dt) per axis for a sphere with fluid inertia: added mass and the Basset\n * memory force, in an unbounded incompressible fluid, velocities in equilibrium.\n *\n * The velocity autocorrelation has the Laplace transform\n * Ĉ(s) = k_BT/(M s + γ(1 + √(s τ_f))), M = m + m_f/2, from the frequency-dependent\n * Stokes drag γ(1 + √(sτ_f)) + s m_f/2 (Stokes 1851; the Basset 1888 term is its\n * √s part; Hinch 1975, J. Fluid Mech. 72, 499; Clercx & Schram 1992, Phys. Rev.\n * A 46, 1942). Its poles in √s both have negative real part, so Ĉ has none on the\n * principal sheet and C(t) is the branch-cut integral\n * C(t) = (k_BT/πγ) ∫₀^∞ e^{−ut} √(τ_f u)/((1 − τ_p u)² + τ_f u) du, τ_p = M/γ.\n * Then ⟨Δx²⟩ = 2∫₀ᵗ (t − s) C(s) ds, and with v = ut,\n * MSD/(2Dt) = (1/π) ∫₀^∞ √(βv) (v − 1 + e^{−v}) / (v² ((1 − αv)² + βv)) dv, α = τ_p/t, β = τ_f/t,\n * integrated here over ln v by MathTS `quad` (adaptive Gauss–Kronrod), split at v = 1, 1/β and around\n * the near-resonance at v = 1/α (width √(β/α) in ln v; β/α ≤ 9 for any densities).\n *\n * Limits: → 1 − 2√(τ_f/(πt)) + (τ_f − τ_p)/t for t ≫ τ_p, τ_f (expanding Ĉ in √s),\n * whose second derivative is the VACF tail k_BT/(12 ρ_f (πνt)^{3/2}); → t/(2τ_p)\n * for t ≪ τ_p, i.e. ⟨Δx²⟩ → (k_BT/M) t². Requires β > 0: without memory the\n * poles reach the principal sheet and this integral no longer holds them.\n * @internal\n */\nexport function hydrodynamicMsdRatio(alpha: number, beta: number): number {\n const f = (y: number) => {\n const v = Math.exp(y);\n const lag = 1 - alpha * v;\n return (Math.sqrt(beta * v) * (ballisticDeficit(v) / v)) / (lag * lag + beta * v);\n };\n const peak = -Math.log(alpha);\n const w = Math.min(1, Math.sqrt(beta / alpha));\n const points = [0, -Math.log(beta), peak, ...[1, 2, 4].flatMap((k) => [peak - k * w, peak + k * w])].sort((x, y) => x - y);\n // The integrand falls as v^{3/2} below and v^{−3/2} above the breakpoints: e^{−75} at ±50 in ln v.\n const edges = [points[0]! - 50, ...points, points[points.length - 1]! + 50];\n let sum = 0;\n for (let k = 1; k < edges.length; k++) if (edges[k]! > edges[k - 1]!) sum += adaptiveQuadrature(f, edges[k - 1]!, edges[k]!, 1e-12);\n return sum / Math.PI;\n}\n\n/**\n * D_∥/D₀ for a sphere translating parallel to a plane wall, centre at h:\n * 1 − (9/16)ξ + (1/8)ξ³ − (45/256)ξ⁴ − (1/16)ξ⁵, ξ = a/h (Faxén 1923, method of\n * reflections, as quoted in Happel & Brenner 1965, Low Reynolds Number\n * Hydrodynamics, ch. 7). A series in a/h, truncated:\n * its error is not bounded here, and near contact it misses the logarithmic\n * lubrication divergence of the drag.\n * @internal\n */\nexport function faxenParallel(aOverH: number): number {\n const x = aOverH;\n return 1 - (9 / 16) * x + (1 / 8) * x ** 3 - (45 / 256) * x ** 4 - (1 / 16) * x ** 5;\n}\n\n/**\n * λ = F/(6πηaU) for a sphere approaching a plane wall head-on, centre at h > a,\n * exact in Stokes flow (Brenner 1961, Chem. Eng. Sci. 16, 242, bispherical coordinates):\n * λ = (4/3) sinh α Σₙ n(n+1)/((2n−1)(2n+3)) · [(2 sinh(2n+1)α + (2n+1) sinh 2α) /\n * (4 sinh²(n+½)α − (2n+1)² sinh²α) − 1], cosh α = h/a. D_⊥ = D₀/λ.\n *\n * The bracket is rewritten over 4 sinh²(n+½)α so that no sinh overflows; its\n * terms fall as e^{−(2n+1)α}, so near contact (α → 0) the sum needs ~40/α terms,\n * and the low-n denominators lose ~α⁻² of relative precision to cancellation.\n * Limits: λ → 1 + (9/8)(a/h) far away (Lorentz 1907); λ → a/δ + (1/5) ln(a/δ) +\n * 0.971 as the gap δ = h − a → 0 (Cox & Brenner 1967, Chem. Eng. Sci. 22, 1753).\n * @throws Error if h/a ≤ 1.\n * @internal\n */\nexport function brennerPerpendicular(hOverA: number): number {\n if (!(hOverA > 1)) throw new Error(`brennerPerpendicular: need h/a > 1 (got ${hOverA})`);\n const al = Math.acosh(hOverA);\n const s = Math.sinh(al);\n const s2a = Math.sinh(2 * al);\n let sum = 0;\n for (let n = 1; ; n++) {\n const x = (n + 0.5) * al;\n const k = 2 * n + 1;\n const inv4Sinh2 = Math.exp(-2 * x) / Math.expm1(-2 * x) ** 2;\n const cothMinus1 = 2 / Math.expm1(2 * x);\n const bracket = (cothMinus1 + k * s2a * inv4Sinh2 + k * k * s * s * inv4Sinh2) / (1 - k * k * s * s * inv4Sinh2);\n const term = ((n * (n + 1)) / ((2 * n - 1) * (2 * n + 3))) * bracket;\n sum += term;\n if (term < 1e-17 * sum) break;\n if (n > 1e7) throw new Error(`brennerPerpendicular: no convergence at h/a = ${hOverA}`);\n }\n return (4 / 3) * s * sum;\n}\n/** Regime tag string for the brownian-sphere case at the current inputs and outputs. */\nexport function brownianSphereRegimeAt(\n inputs: Readonly<Record<string, number>>,\n outputs: Readonly<Record<string, number | null>>,\n): string {\n const re = outputs.Re;\n const m = outputs.m_kg;\n const gamma = outputs.gamma_kg_per_s;\n const t = inputs.t_s;\n if (re == null || m == null || gamma == null || t == null) return '';\n return `upt regime diffusion --at Re=${re} m=${m} gamma=${gamma} t=${t}`;\n}\n\n/**\n * Evaluate the brownian-sphere applied case at the given SI inputs.\n * @internal\n */\nexport function runCaseBrownianSphere(i: Readonly<Record<string, number>>): CaseResult {\n requirePositive(BROWNIAN_SPHERE_ID, i, ['T_K', 'eta_Pa_s', 'a_m', 'rho_p_kg_per_m3', 'rho_f_kg_per_m3', 't_s']);\n const { T_K: T, eta_Pa_s: eta, a_m: a, rho_p_kg_per_m3: rhoP, rho_f_kg_per_m3: rhoF, t_s: t, d } = i as Record<string, number>;\n if (d !== 1 && d !== 2 && d !== 3) throw new Error(`${BROWNIAN_SPHERE_ID}: d must be 1, 2 or 3 (got ${d})`);\n const kT = K_B_SI * T;\n const gamma = 6 * Math.PI * eta * a;\n const D = kT / gamma;\n const msd = 2 * d * D * t;\n const volume = (4 / 3) * Math.PI * a ** 3;\n const m = volume * rhoP;\n const tauP = (m + 0.5 * volume * rhoF) / gamma;\n const tauF = (rhoF * a * a) / eta;\n const vSed = ((2 / 9) * (rhoP - rhoF) * G_STANDARD * a * a) / eta;\n const re = (rhoF * a * Math.max(Math.sqrt(kT / m), Math.abs(vSed))) / eta;\n const tauBare = m / gamma;\n const msdLangevin = 2 * d * D * tauBare * ballisticDeficit(t / tauBare);\n const msdHydro = msd * hydrodynamicMsdRatio(tauP / t, tauF / t);\n const msdAddedMass = 2 * d * D * tauP * ballisticDeficit(t / tauP);\n const memory = msdHydro / msdAddedMass - 1;\n const checks = [\n check('creeping-flow', 'creeping flow around the sphere, Re ≪ 1', 'ρ_f a max(√(k_BT/m), |v_s|)/η', re, '<=', MAX_RE,\n \"the threshold ab-stokes-einstein states: a chosen machine form of Re ≪ 1\"),\n check('overdamped', 'overdamped times t ≫ τ_p', '(m + m_f/2)/(γ t)', tauP / t, '<=', MAX_TAU_P_RATIO,\n \"ab-stokes-einstein's m/(γt) ≤ 0.01, with the added mass m_f/2 included (stricter)\"),\n check('memory', 'past the hydrodynamic memory, t ≫ τ_f = ρ_f a²/η', '|MSD_H/MSD_OU − 1|', Math.abs(memory), '<=', MAX_MEMORY_CORRECTION,\n 'chosen threshold: the Basset memory changes the MSD by ≤ 1% at t (computed, not estimated; ≈ 2√(τ_f/(πt)) at t ≫ τ_f)'),\n ];\n const unchecked = ['the particle is a rigid sphere and a is its hydrodynamic radius (a coating or a shell changes it)'];\n let wall: { dPar: number; dPerp: number; msdWall: number } | null = null;\n if (i.h_m !== undefined) {\n const h = i.h_m;\n if (!Number.isFinite(h) || !(h > a)) throw new Error(`${BROWNIAN_SPHERE_ID}: h_m must be a finite distance > a_m, centre to wall (got ${h})`);\n const faxen = faxenParallel(a / h);\n const lambda = brennerPerpendicular(h / a);\n const dPar = D * faxen;\n const dPerp = D / lambda;\n const msdWall = 2 * t * (Math.min(d, 2) * dPar + (d === 3 ? dPerp : 0));\n wall = { dPar, dPerp, msdWall };\n const excursion = Math.sqrt(2 * dPerp * t) + (Math.abs(vSed) * t) / lambda;\n checks.push(\n check('faxen-range', 'the Faxén series in a/h holds for D_∥', '(a/h)⁵/16 ÷ (D_∥/D)', (a / h) ** 5 / 16 / faxen, '<=', MAX_FAXEN_LAST_TERM,\n 'chosen threshold: the last retained term is ≤ 1% of the series — a size estimate of the truncation, not a bound; D_⊥ (Brenner) is exact at any h > a'),\n check('wall', 'the wall correction to the tracked MSD is negligible', '|MSD/MSD_w − 1|', Math.abs(msd / msdWall - 1), '<=', MAX_WALL_CORRECTION,\n 'chosen threshold: the unbounded-fluid D is then within 1% for the tracked axes; otherwise read MSD_wall_m2'),\n check('wall-static', 'the height barely changes over t', '(√(2 D_⊥ t) + |v_s| t/λ)/(h − a)', excursion / (h - a), '<=', MAX_WALL_EXCURSION,\n 'chosen threshold: diffusion plus wall-slowed sedimentation normal to the wall move the sphere by ≤ 10% of the gap, so D_∥, D_⊥ taken at h hold over t'),\n );\n unchecked.push(\n 'the wall is plane, rigid, no-slip and horizontal, and the gap h − a is many molecular sizes and roughness heights (no surface forces, no lubrication-scale slip)',\n );\n }\n if (d === 3) {\n checks.push(\n check('drift', 'sedimentation drift negligible along gravity over t', '(v_s t)²/(2 D t)', (vSed * t) ** 2 / (2 * D * t), '<=',\n MAX_DRIFT_RATIO, 'chosen threshold: the vertical MSD then carries ≤ 1% from the deterministic drift'),\n );\n } else {\n unchecked.push(\n `the ${d === 1 ? 'tracked axis is' : 'tracked axes are'} horizontal, so sedimentation (${Number(Math.abs(vSed * t).toPrecision(3))} m over t) moves the sphere out of the plane but not along ${d === 1 ? 'it' : 'them'}`,\n );\n }\n return {\n outputs: {\n gamma_kg_per_s: gamma,\n D_m2_per_s: D,\n MSD_m2: msd,\n rms_displacement_m: Math.sqrt(msd),\n m_kg: m,\n tau_p_s: tauP,\n tau_f_s: tauF,\n v_sed_m_per_s: vSed,\n Re: re,\n MSD_langevin_m2: msdLangevin,\n langevin_deviation: msd / msdLangevin - 1,\n MSD_hydro_m2: msdHydro,\n hydro_correction_m2: msdHydro - msd,\n hydro_deviation: msd / msdHydro - 1,\n memory_correction: memory,\n D_parallel_m2_per_s: wall?.dPar ?? null,\n D_perp_m2_per_s: wall?.dPerp ?? null,\n MSD_wall_m2: wall?.msdWall ?? null,\n wall_deviation: wall === null ? null : msd / wall.msdWall - 1,\n },\n checks,\n unchecked,\n };\n \n}\n\nconst RUN_BY_ID: Readonly<Record<string, (i: Readonly<Record<string, number>>) => CaseResult>> = {\n 'case-skin-depth': runCaseSkinDepth,\n 'case-kepler-rv': runCaseKeplerRv,\n 'case-damped-resonator': runCaseDampedResonator,\n 'case-resistor-noise': runCaseResistorNoise,\n 'case-lumped-cooling': runCaseLumpedCooling,\n 'case-brownian-sphere': runCaseBrownianSphere,\n};\n\nfunction buildAppliedCase(id: string): AppliedCase {\n const record = appliedCaseRecord(id);\n const legacy = RUN_BY_ID[id]!;\n const run = usesCatalogEngine(record)\n ? (inputs: Readonly<Record<string, number>>) => runAppliedCaseEngine(record, inputs)\n : legacy;\n const regimeAt = id === 'case-brownian-sphere' ? brownianSphereRegimeAt : undefined;\n return assembleAppliedCase(record, { run, regimeAt });\n}\n\n/** Case id → case assembled from the catalog and a runner. @internal */\nexport const APPLIED_CASE_RUNNERS: ReadonlyMap<string, AppliedCase> = new Map(\n appliedCaseCatalog().cases.map((row) => [row.id, buildAppliedCase(row.id)]),\n);\n\n/** Names exported numeric methods for catalog validation. @internal */\nexport const CASE_METHOD_NAMES: ReadonlySet<string> = new Set([\n 'maxwellDepthFactor',\n 'skinDeltaMaxwellM',\n 'windowedLinewidthCatalogHz',\n 'windowedLinewidthHz',\n 'lumpedRadiatingTemperature',\n 'sphereEigenvalues',\n 'sphereSeries',\n 'ballisticDeficit',\n 'hydrodynamicMsdRatio',\n 'faxenParallel',\n 'brennerPerpendicular',\n 'brownianSphereRegimeAt',\n 'runCaseResistorNoise',\n 'runCaseSkinDepth',\n 'runCaseKeplerRv',\n 'runCaseDampedResonator',\n 'runCaseLumpedCooling',\n 'runCaseBrownianSphere',\n]);\n\n/** Named numeric methods invoked from catalog output `method` fields. */\nexport const CASE_METHODS: Record<string, (...args: never[]) => unknown> = {\n maxwellDepthFactor,\n skinDeltaMaxwellM,\n windowedLinewidthCatalogHz,\n windowedLinewidthHz,\n lumpedRadiatingTemperature,\n sphereEigenvalues,\n sphereSeries,\n ballisticDeficit,\n hydrodynamicMsdRatio,\n faxenParallel,\n brennerPerpendicular,\n brownianSphereRegimeAt,\n runCaseResistorNoise,\n runCaseSkinDepth,\n runCaseKeplerRv,\n runCaseDampedResonator,\n runCaseLumpedCooling,\n runCaseBrownianSphere,\n};\n\nregisterCaseMethods(CASE_METHODS);\n\n/** Assembled skin-depth applied case (catalog + runner). */\nexport const SKIN_DEPTH_CASE = APPLIED_CASE_RUNNERS.get('case-skin-depth')!;\n/** Assembled Kepler RV applied case (catalog + runner). */\nexport const KEPLER_RV_CASE = APPLIED_CASE_RUNNERS.get('case-kepler-rv')!;\n/** Assembled damped-resonator applied case (catalog + runner). */\nexport const DAMPED_RESONATOR_CASE = APPLIED_CASE_RUNNERS.get('case-damped-resonator')!;\n/** Assembled resistor-noise applied case (catalog + runner). */\nexport const RESISTOR_NOISE_CASE = APPLIED_CASE_RUNNERS.get('case-resistor-noise')!;\n/** Assembled lumped-cooling applied case (catalog + runner). */\nexport const LUMPED_COOLING_CASE = APPLIED_CASE_RUNNERS.get('case-lumped-cooling')!;\n/** Assembled brownian-sphere applied case (catalog + runner). */\nexport const BROWNIAN_SPHERE_CASE = APPLIED_CASE_RUNNERS.get('case-brownian-sphere')!;\n\nfor (const msg of catalogSemanticProblems(appliedCaseCatalog(), CASE_METHOD_NAMES)) {\n throw new Error(msg);\n}\n"]}
@@ -80,6 +80,18 @@ export interface CaseResult {
80
80
  /** Premises stated but not checked at these inputs. */
81
81
  readonly unchecked: readonly string[];
82
82
  }
83
+ /** Parameters of the lumped equation with the radiative loss kept, in SI units. @internal */
84
+ export interface LumpedRadiating {
85
+ readonly a: number;
86
+ readonly rho: number;
87
+ readonly c: number;
88
+ /** ≥ 0; 0 is pure radiation. */
89
+ readonly h: number;
90
+ readonly eps: number;
91
+ readonly T0: number;
92
+ readonly Tinf: number;
93
+ readonly t: number;
94
+ }
83
95
  /** An applied case. @internal */
84
96
  export interface AppliedCase {
85
97
  readonly id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cases/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,C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C,CAAC;QACpB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,KAAK,CAAC,qCAAqC,CAAC,GAAG,CAAC,CAAC;IACpI,CAAC;AACH,CAAC","sourcesContent":["/**\n * An applied case: one complete measurement problem, qualified end to end.\n *\n * A bridge evaluator answers \"what does this formula give\"; a case answers\n * \"what should this experiment read, under which premises, and how would I\n * know the premises fail\". Each case states the parent (field, vector or\n * frequency-resolved) equation beside the scalar simplification it evaluates,\n * the observable with its unit, the boundary and initial conditions, the\n * regime checks with their thresholds, what the uncertainty treatment does not\n * cover, and the route to a measurement comparison.\n *\n * A case carries no evidence tag. Where it rests on a catalog bridge or an\n * atlas bridge it names the record, and the evidence stays that record's.\n *\n * @module cases/types\n */\nimport type { EvaluatorParameter } from '../bridges/evaluators.js';\n\n/** One derived number a case reports. @internal */\nexport interface CaseOutput {\n readonly key: string;\n readonly symbol: string;\n /** A unit expression; `''` for dimensionless. */\n readonly unit: string;\n readonly meaning: string;\n}\n\n/**\n * One regime inequality, evaluated at the given inputs. The bound is a chosen\n * numerical reading of a \"≪\" and says so in `threshold`.\n * @internal\n */\nexport interface CaseCheck {\n readonly id: string;\n /** The physical premise the inequality stands for. */\n readonly premise: string;\n /** The checked quantity, written out. */\n readonly quantity: string;\n readonly value: number;\n readonly op: '<=' | '>=' | '>';\n readonly bound: number;\n /** Why this bound: what it guarantees, or that it is a chosen threshold. */\n readonly threshold: string;\n readonly holds: boolean;\n}\n\n/**\n * A comparison of one output with a reference — the parent model evaluated\n * numerically, or the ideal a finite measurement approaches. Reported beside\n * the checks, never merged into them: a small deviation at one point does not\n * establish the premises.\n * @internal\n */\nexport interface CaseComparison {\n /** What the reference is. */\n readonly reference: string;\n readonly valueKey: string;\n readonly referenceKey: string;\n /**\n * Output holding value/reference − 1. The glossary for that output is\n * `signedRelativeDifference`: the residual is negative when the value is\n * smaller than the reference.\n */\n readonly deviationKey: string;\n readonly method: string;\n}\n\n/**\n * Glossary for a comparison residual value/reference − 1.\n * \"Excess\" would name a surplus. This residual is negative when `value` is smaller than `reference`.\n * @internal\n */\nexport function signedRelativeDifference(value: string, reference: string, note?: string): string {\n const base = `signed relative difference of the ${value} relative to the ${reference}`;\n return note === undefined ? base : `${base}; ${note}`;\n}\n\n/** A worked invocation. `fails` lists exactly the checks it violates. @internal */\nexport interface CaseExample {\n readonly args: readonly string[];\n readonly note: string;\n readonly fails: readonly string[];\n}\n\n/** What a case evaluates to. A `null` output is undefined outside its premise. @internal */\nexport interface CaseResult {\n readonly outputs: Readonly<Record<string, number | null>>;\n readonly checks: readonly CaseCheck[];\n /** Premises stated but not checked at these inputs. */\n readonly unchecked: readonly string[];\n}\n\n/** An applied case. @internal */\nexport interface AppliedCase {\n readonly id: string;\n readonly title: string;\n readonly parameters: readonly EvaluatorParameter[];\n readonly governing: {\n /** The parent equations, which this case does NOT evaluate as its answer. */\n readonly parent: readonly string[];\n /** The scalar simplification it evaluates. */\n readonly scalar: readonly string[];\n /** What the simplification keeps and what it drops. */\n readonly distinction: string;\n };\n /** Key of the output a measurement reads. */\n readonly observable: string;\n readonly outputs: readonly CaseOutput[];\n readonly conditions: readonly string[];\n readonly comparison?: CaseComparison;\n /** Left out of the model and of any --sigma propagation. */\n readonly notIncluded: readonly string[];\n readonly measurement: readonly string[];\n /** Catalog bridges (`be-58`), atlas records (`ab-…`, `model-…`) and canonical entries it rests on. */\n readonly links: readonly { readonly id: string; readonly role: string }[];\n readonly examples: { readonly valid: CaseExample; readonly failures: readonly CaseExample[] };\n /**\n * The `upt regime --at` line implied by a result, when the case's outputs\n * are not the regime's coordinate names.\n */\n regimeAt?(inputs: Readonly<Record<string, number>>, outputs: Readonly<Record<string, number | null>>): string;\n /** @throws Error on an input outside the model's domain (a negative radius, f_lo ≥ f_hi). */\n run(inputs: Readonly<Record<string, number>>): CaseResult;\n}\n\n/** Build a CaseCheck from one evaluated inequality and mark whether it holds. @internal */\nexport const check = (\n id: string,\n premise: string,\n quantity: string,\n value: number,\n op: CaseCheck['op'],\n bound: number,\n threshold: string,\n): CaseCheck => ({\n id,\n premise,\n quantity,\n value,\n op,\n bound,\n threshold,\n holds: op === '<=' ? value <= bound : op === '>=' ? value >= bound : value > bound,\n});\n\n/** Reject missing, non-finite or non-positive inputs for the listed case parameters. @internal */\nexport function requirePositive(caseId: string, inputs: Readonly<Record<string, number>>, keys: readonly string[]): void {\n for (const k of keys) {\n const v = inputs[k];\n if (v === undefined || !Number.isFinite(v) || !(v > 0)) throw new Error(`${caseId}: ${k} must be a finite number > 0 (got ${v})`);\n }\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cases/types.ts"],"names":[],"mappings":"AAmEA;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAa,EAAE,SAAiB,EAAE,IAAa;IACtF,MAAM,IAAI,GAAG,qCAAqC,KAAK,oBAAoB,SAAS,EAAE,CAAC;IACvF,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,IAAI,EAAE,CAAC;AACxD,CAAC;AA+DD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,EAAU,EACV,OAAe,EACf,QAAgB,EAChB,KAAa,EACb,EAAmB,EACnB,KAAa,EACb,SAAiB,EACN,EAAE,CAAC,CAAC;IACf,EAAE;IACF,OAAO;IACP,QAAQ;IACR,KAAK;IACL,EAAE;IACF,KAAK;IACL,SAAS;IACT,KAAK,EAAE,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK;CACnF,CAAC,CAAC;AAEH,kGAAkG;AAClG,MAAM,UAAU,eAAe,CAAC,MAAc,EAAE,MAAwC,EAAE,IAAuB;IAC/G,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,KAAK,CAAC,qCAAqC,CAAC,GAAG,CAAC,CAAC;IACpI,CAAC;AACH,CAAC","sourcesContent":["/**\n * An applied case: one complete measurement problem, qualified end to end.\n *\n * A bridge evaluator answers \"what does this formula give\"; a case answers\n * \"what should this experiment read, under which premises, and how would I\n * know the premises fail\". Each case states the parent (field, vector or\n * frequency-resolved) equation beside the scalar simplification it evaluates,\n * the observable with its unit, the boundary and initial conditions, the\n * regime checks with their thresholds, what the uncertainty treatment does not\n * cover, and the route to a measurement comparison.\n *\n * A case carries no evidence tag. Where it rests on a catalog bridge or an\n * atlas bridge it names the record, and the evidence stays that record's.\n *\n * @module cases/types\n */\nimport type { EvaluatorParameter } from '../bridges/evaluators.js';\n\n/** One derived number a case reports. @internal */\nexport interface CaseOutput {\n readonly key: string;\n readonly symbol: string;\n /** A unit expression; `''` for dimensionless. */\n readonly unit: string;\n readonly meaning: string;\n}\n\n/**\n * One regime inequality, evaluated at the given inputs. The bound is a chosen\n * numerical reading of a \"≪\" and says so in `threshold`.\n * @internal\n */\nexport interface CaseCheck {\n readonly id: string;\n /** The physical premise the inequality stands for. */\n readonly premise: string;\n /** The checked quantity, written out. */\n readonly quantity: string;\n readonly value: number;\n readonly op: '<=' | '>=' | '>';\n readonly bound: number;\n /** Why this bound: what it guarantees, or that it is a chosen threshold. */\n readonly threshold: string;\n readonly holds: boolean;\n}\n\n/**\n * A comparison of one output with a reference — the parent model evaluated\n * numerically, or the ideal a finite measurement approaches. Reported beside\n * the checks, never merged into them: a small deviation at one point does not\n * establish the premises.\n * @internal\n */\nexport interface CaseComparison {\n /** What the reference is. */\n readonly reference: string;\n readonly valueKey: string;\n readonly referenceKey: string;\n /**\n * Output holding value/reference − 1. The glossary for that output is\n * `signedRelativeDifference`: the residual is negative when the value is\n * smaller than the reference.\n */\n readonly deviationKey: string;\n readonly method: string;\n}\n\n/**\n * Glossary for a comparison residual value/reference − 1.\n * \"Excess\" would name a surplus. This residual is negative when `value` is smaller than `reference`.\n * @internal\n */\nexport function signedRelativeDifference(value: string, reference: string, note?: string): string {\n const base = `signed relative difference of the ${value} relative to the ${reference}`;\n return note === undefined ? base : `${base}; ${note}`;\n}\n\n/** A worked invocation. `fails` lists exactly the checks it violates. @internal */\nexport interface CaseExample {\n readonly args: readonly string[];\n readonly note: string;\n readonly fails: readonly string[];\n}\n\n/** What a case evaluates to. A `null` output is undefined outside its premise. @internal */\nexport interface CaseResult {\n readonly outputs: Readonly<Record<string, number | null>>;\n readonly checks: readonly CaseCheck[];\n /** Premises stated but not checked at these inputs. */\n readonly unchecked: readonly string[];\n}\n\n/** Parameters of the lumped equation with the radiative loss kept, in SI units. @internal */\nexport interface LumpedRadiating {\n readonly a: number;\n readonly rho: number;\n readonly c: number;\n /** ≥ 0; 0 is pure radiation. */\n readonly h: number;\n readonly eps: number;\n readonly T0: number;\n readonly Tinf: number;\n readonly t: number;\n}\n\n/** An applied case. @internal */\nexport interface AppliedCase {\n readonly id: string;\n readonly title: string;\n readonly parameters: readonly EvaluatorParameter[];\n readonly governing: {\n /** The parent equations, which this case does NOT evaluate as its answer. */\n readonly parent: readonly string[];\n /** The scalar simplification it evaluates. */\n readonly scalar: readonly string[];\n /** What the simplification keeps and what it drops. */\n readonly distinction: string;\n };\n /** Key of the output a measurement reads. */\n readonly observable: string;\n readonly outputs: readonly CaseOutput[];\n readonly conditions: readonly string[];\n readonly comparison?: CaseComparison;\n /** Left out of the model and of any --sigma propagation. */\n readonly notIncluded: readonly string[];\n readonly measurement: readonly string[];\n /** Catalog bridges (`be-58`), atlas records (`ab-…`, `model-…`) and canonical entries it rests on. */\n readonly links: readonly { readonly id: string; readonly role: string }[];\n readonly examples: { readonly valid: CaseExample; readonly failures: readonly CaseExample[] };\n /**\n * The `upt regime --at` line implied by a result, when the case's outputs\n * are not the regime's coordinate names.\n */\n regimeAt?(inputs: Readonly<Record<string, number>>, outputs: Readonly<Record<string, number | null>>): string;\n /** @throws Error on an input outside the model's domain (a negative radius, f_lo ≥ f_hi). */\n run(inputs: Readonly<Record<string, number>>): CaseResult;\n}\n\n/** Build a CaseCheck from one evaluated inequality and mark whether it holds. @internal */\nexport const check = (\n id: string,\n premise: string,\n quantity: string,\n value: number,\n op: CaseCheck['op'],\n bound: number,\n threshold: string,\n): CaseCheck => ({\n id,\n premise,\n quantity,\n value,\n op,\n bound,\n threshold,\n holds: op === '<=' ? value <= bound : op === '>=' ? value >= bound : value > bound,\n});\n\n/** Reject missing, non-finite or non-positive inputs for the listed case parameters. @internal */\nexport function requirePositive(caseId: string, inputs: Readonly<Record<string, number>>, keys: readonly string[]): void {\n for (const k of keys) {\n const v = inputs[k];\n if (v === undefined || !Number.isFinite(v) || !(v > 0)) throw new Error(`${caseId}: ${k} must be a finite number > 0 (got ${v})`);\n }\n}\n"]}
@@ -7,6 +7,7 @@
7
7
  * options: every later token is a positional, whatever it starts with.
8
8
  * Single left-to-right scan, zero dependencies.
9
9
  */
10
+ /** One flag that a command accepts, with its value style and help text. */
10
11
  export interface FlagSpec {
11
12
  name: string;
12
13
  valueStyle: 'attached' | 'next' | 'either' | 'none';
@@ -28,6 +29,7 @@ export interface FlagSpec {
28
29
  export declare const END_OF_OPTIONS = "--";
29
30
  /** The tokens before a bare `--`: the ones the dispatcher may read as options. */
30
31
  export declare function optionTokens(argv: readonly string[]): readonly string[];
32
+ /** The options and positional arguments that the parser read from one argument list. */
31
33
  export interface ParsedArgs {
32
34
  flags: Map<string, string[]>;
33
35
  positionals: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpD,0EAA0E;IAC1E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;uCAEmC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,0CAA0C;AAC1C,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,CAGvE;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,mGAAmG;IACnG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,mFAAmF;AACnF,eAAO,MAAM,cAAc,EAAE,eAA4B,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CASzG;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,QAAQ,EAAE,EACjB,KAAK,GAAE,eAAgC,GACtC,UAAU,CA+EZ"}
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,2EAA2E;AAC3E,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpD,0EAA0E;IAC1E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;uCAEmC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,0CAA0C;AAC1C,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,CAGvE;AAED,wFAAwF;AACxF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,mGAAmG;IACnG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,mFAAmF;AACnF,eAAO,MAAM,cAAc,EAAE,eAA4B,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CASzG;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,QAAQ,EAAE,EACjB,KAAK,GAAE,eAAgC,GACtC,UAAU,CA+EZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names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C,EAAE,CAAC;gBAChD,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;oBACxB,MAAM,MAAM,CAAC,SAAS,IAAI,CAAC,IAAI,2BAA2B,OAAO,KAAK,IAAI,EAAE,CAAC,CAAC;gBAChF,CAAC;gBACD,KAAK,GAAG,EAAE,CAAC;YACb,CAAC;iBAAM,CAAC;gBACN,KAAK,GAAG,IAAI,CAAC;gBACb,CAAC,EAAE,CAAC;YACN,CAAC;QACH,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACrB,MAAM,MAAM,CAAC,SAAS,IAAI,CAAC,IAAI,+BAA+B,OAAO,KAAK,IAAI,EAAE,CAAC,CAAC;YACpF,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,sBAAsB,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACxD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAChC,CAAC","sourcesContent":["/**\n * Hand-written declarative flag parser for the UPT CLI.\n *\n * Only tokens starting with `--` are treated as flags; everything else\n * (including `name=value` and `name:dim` positionals) passes through to\n * `positionals` untouched and in original order. A bare `--` ends the\n * options: every later token is a positional, whatever it starts with.\n * Single left-to-right scan, zero dependencies.\n */\n\nimport { UsageError } from './errors.js';\n\nexport interface FlagSpec {\n name: string; // e.g. '--source'\n valueStyle: 'attached' | 'next' | 'either' | 'none';\n /** The flag may be given more than once; the values are kept in order. */\n repeatable?: boolean;\n /** For 'either'/'next' styles: a missing value stores '' instead of throwing —\n * exists for old-CLI fidelity (--equation's empty-value diagnostic belongs to\n * the command, not the parser). */\n optionalValue?: boolean;\n /**\n * One sentence printed by `upt help` and by `docs/CLI.md`.\n * A registered command's flags set this. The parser does not read it.\n */\n description?: string;\n /** Printed default, when the command has one. Omit when there is no default. */\n defaultValue?: string;\n}\n\n/** The token that ends option parsing. */\nexport const END_OF_OPTIONS = '--';\n\n/** The tokens before a bare `--`: the ones the dispatcher may read as options. */\nexport function optionTokens(argv: readonly string[]): readonly string[] {\n const end = argv.indexOf(END_OF_OPTIONS);\n return end === -1 ? argv : argv.slice(0, end);\n}\n\nexport interface ParsedArgs {\n flags: Map<string, string[]>; // name (no dashes) -> raw values ('' for none-style)\n positionals: string[];\n}\n\n/**\n * How many positional arguments a command reads. A command declares it on its registration;\n * absent means none, and every positional is then a stray token (cli/README.md §Hardening:\n * nothing typed is silently dropped).\n */\nexport interface PositionalArity {\n /** The most positionals the command reads; `Infinity` for a list. The token past it is refused. */\n readonly max: number;\n}\n\n/** No positional is read. The parser's default when a command declares nothing. */\nexport const NO_POSITIONALS: PositionalArity = { max: 0 };\n\n/**\n * Refuse the positional past `max` as a usage error naming the token and the command:\n * `upt audit: unexpected argument 'junk' (audit takes no positional arguments; see upt help audit)`.\n * `command` may carry a subverb (`probe scan`), whose first word is the help target.\n */\nexport function refuseExtraPositionals(command: string, positionals: readonly string[], max: number): void {\n if (positionals.length <= max) return;\n const takes =\n max === 0\n ? `${command} takes no positional arguments`\n : `${command} takes at most ${max} positional argument${max === 1 ? '' : 's'}`;\n throw new UsageError(\n `upt ${command}: unexpected argument '${positionals[max]}' (${takes}; see upt help ${command.split(' ')[0]})`,\n );\n}\n\n/**\n * Parse `argv` against the command's flag specs. `positionals` is the command's declared arity\n * (`Command.positionals`); a token past it, or any token when none is declared, is a `UsageError`.\n */\nexport function parseArgs(\n command: string,\n argv: string[],\n specs: FlagSpec[],\n arity: PositionalArity = NO_POSITIONALS,\n): ParsedArgs {\n const bySpecName = new Map<string, FlagSpec>();\n for (const spec of specs) bySpecName.set(spec.name, spec);\n\n const flags = new Map<string, string[]>();\n const positionals: string[] = [];\n const hint = `(see upt help ${command})`;\n // Every flag refusal names the command first, as every other refusal does (`upt audit: ...`).\n const refuse = (message: string): UsageError => new UsageError(`upt ${command}: ${message}`);\n\n for (let i = 0; i < argv.length; i++) {\n const token = argv[i];\n if (token === END_OF_OPTIONS) {\n positionals.push(...argv.slice(i + 1));\n break;\n }\n if (!token.startsWith('--')) {\n positionals.push(token);\n continue;\n }\n\n const eqIndex = token.indexOf('=');\n const flagName = eqIndex === -1 ? token : token.slice(0, eqIndex);\n const attachedValue = eqIndex === -1 ? undefined : token.slice(eqIndex + 1);\n\n const spec = bySpecName.get(flagName);\n if (!spec) {\n // The three file options belong to `upt`, not to a command, and are read only before the command.\n if (flagName === '--record' || flagName === '--replay' || flagName === '--show-record') {\n throw refuse(\n `unknown flag '${flagName}' for '${command}' ${hint}; ${flagName} is an option of upt itself and goes before the command: upt ${flagName}=FILE ${command} ...`,\n );\n }\n throw refuse(`unknown flag '${flagName}' for '${command}' ${hint}`);\n }\n\n let value: string;\n if (attachedValue !== undefined) {\n if (spec.valueStyle === 'next') {\n throw refuse(\n `flag '${spec.name}' does not accept an attached value; use '${spec.name} VALUE' for '${command}' ${hint}`\n );\n }\n if (spec.valueStyle === 'none') {\n throw refuse(`flag '${spec.name}' takes no value for '${command}' ${hint}`);\n }\n value = attachedValue;\n } else if (spec.valueStyle === 'attached') {\n throw refuse(`flag '${spec.name}' requires '${spec.name}=VALUE' for '${command}' ${hint}`);\n } else if (spec.valueStyle === 'none') {\n value = '';\n } else {\n // 'next' or 'either' with no attached value: consume the next token.\n const next = argv[i + 1];\n if (next === undefined || next.startsWith('--')) {\n if (!spec.optionalValue) {\n throw refuse(`flag '${spec.name}' requires a value for '${command}' ${hint}`);\n }\n value = '';\n } else {\n value = next;\n i++;\n }\n }\n\n const key = spec.name.slice(2);\n const existing = flags.get(key);\n if (existing) {\n if (!spec.repeatable) {\n throw refuse(`flag '${spec.name}' given more than once for '${command}' ${hint}`);\n }\n existing.push(value);\n } else {\n flags.set(key, [value]);\n }\n }\n\n refuseExtraPositionals(command, positionals, arity.max);\n return { flags, positionals };\n}\n"]}
1
+ {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAqBzC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC,kFAAkF;AAClF,MAAM,UAAU,YAAY,CAAC,IAAuB;IAClD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACzC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC;AAkBD,mFAAmF;AACnF,MAAM,CAAC,MAAM,cAAc,GAAoB,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAe,EAAE,WAA8B,EAAE,GAAW;IACjG,IAAI,WAAW,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO;IACtC,MAAM,KAAK,GACT,GAAG,KAAK,CAAC;QACP,CAAC,CAAC,GAAG,OAAO,gCAAgC;QAC5C,CAAC,CAAC,GAAG,OAAO,kBAAkB,GAAG,uBAAuB,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IACnF,MAAM,IAAI,UAAU,CAClB,OAAO,OAAO,0BAA0B,WAAW,CAAC,GAAG,CAAC,MAAM,KAAK,kBAAkB,OAAO,CAAC,KAAK,CAAC,GAAG,CAA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.\n *\n * Only tokens starting with `--` are treated as flags; everything else\n * (including `name=value` and `name:dim` positionals) passes through to\n * `positionals` untouched and in original order. A bare `--` ends the\n * options: every later token is a positional, whatever it starts with.\n * Single left-to-right scan, zero dependencies.\n */\n\nimport { UsageError } from './errors.js';\n\n/** One flag that a command accepts, with its value style and help text. */\nexport interface FlagSpec {\n name: string; // e.g. '--source'\n valueStyle: 'attached' | 'next' | 'either' | 'none';\n /** The flag may be given more than once; the values are kept in order. */\n repeatable?: boolean;\n /** For 'either'/'next' styles: a missing value stores '' instead of throwing —\n * exists for old-CLI fidelity (--equation's empty-value diagnostic belongs to\n * the command, not the parser). */\n optionalValue?: boolean;\n /**\n * One sentence printed by `upt help` and by `docs/CLI.md`.\n * A registered command's flags set this. The parser does not read it.\n */\n description?: string;\n /** Printed default, when the command has one. Omit when there is no default. */\n defaultValue?: string;\n}\n\n/** The token that ends option parsing. */\nexport const END_OF_OPTIONS = '--';\n\n/** The tokens before a bare `--`: the ones the dispatcher may read as options. */\nexport function optionTokens(argv: readonly string[]): readonly string[] {\n const end = argv.indexOf(END_OF_OPTIONS);\n return end === -1 ? argv : argv.slice(0, end);\n}\n\n/** The options and positional arguments that the parser read from one argument list. */\nexport interface ParsedArgs {\n flags: Map<string, string[]>; // name (no dashes) -> raw values ('' for none-style)\n positionals: string[];\n}\n\n/**\n * How many positional arguments a command reads. A command declares it on its registration;\n * absent means none, and every positional is then a stray token (cli/README.md §Hardening:\n * nothing typed is silently dropped).\n */\nexport interface PositionalArity {\n /** The most positionals the command reads; `Infinity` for a list. The token past it is refused. */\n readonly max: number;\n}\n\n/** No positional is read. The parser's default when a command declares nothing. */\nexport const NO_POSITIONALS: PositionalArity = { max: 0 };\n\n/**\n * Refuse the positional past `max` as a usage error naming the token and the command:\n * `upt audit: unexpected argument 'junk' (audit takes no positional arguments; see upt help audit)`.\n * `command` may carry a subverb (`probe scan`), whose first word is the help target.\n */\nexport function refuseExtraPositionals(command: string, positionals: readonly string[], max: number): void {\n if (positionals.length <= max) return;\n const takes =\n max === 0\n ? `${command} takes no positional arguments`\n : `${command} takes at most ${max} positional argument${max === 1 ? '' : 's'}`;\n throw new UsageError(\n `upt ${command}: unexpected argument '${positionals[max]}' (${takes}; see upt help ${command.split(' ')[0]})`,\n );\n}\n\n/**\n * Parse `argv` against the command's flag specs. `positionals` is the command's declared arity\n * (`Command.positionals`); a token past it, or any token when none is declared, is a `UsageError`.\n */\nexport function parseArgs(\n command: string,\n argv: string[],\n specs: FlagSpec[],\n arity: PositionalArity = NO_POSITIONALS,\n): ParsedArgs {\n const bySpecName = new Map<string, FlagSpec>();\n for (const spec of specs) bySpecName.set(spec.name, spec);\n\n const flags = new Map<string, string[]>();\n const positionals: string[] = [];\n const hint = `(see upt help ${command})`;\n // Every flag refusal names the command first, as every other refusal does (`upt audit: ...`).\n const refuse = (message: string): UsageError => new UsageError(`upt ${command}: ${message}`);\n\n for (let i = 0; i < argv.length; i++) {\n const token = argv[i];\n if (token === END_OF_OPTIONS) {\n positionals.push(...argv.slice(i + 1));\n break;\n }\n if (!token.startsWith('--')) {\n positionals.push(token);\n continue;\n }\n\n const eqIndex = token.indexOf('=');\n const flagName = eqIndex === -1 ? token : token.slice(0, eqIndex);\n const attachedValue = eqIndex === -1 ? undefined : token.slice(eqIndex + 1);\n\n const spec = bySpecName.get(flagName);\n if (!spec) {\n // The three file options belong to `upt`, not to a command, and are read only before the command.\n if (flagName === '--record' || flagName === '--replay' || flagName === '--show-record') {\n throw refuse(\n `unknown flag '${flagName}' for '${command}' ${hint}; ${flagName} is an option of upt itself and goes before the command: upt ${flagName}=FILE ${command} ...`,\n );\n }\n throw refuse(`unknown flag '${flagName}' for '${command}' ${hint}`);\n }\n\n let value: string;\n if (attachedValue !== undefined) {\n if (spec.valueStyle === 'next') {\n throw refuse(\n `flag '${spec.name}' does not accept an attached value; use '${spec.name} VALUE' for '${command}' ${hint}`\n );\n }\n if (spec.valueStyle === 'none') {\n throw refuse(`flag '${spec.name}' takes no value for '${command}' ${hint}`);\n }\n value = attachedValue;\n } else if (spec.valueStyle === 'attached') {\n throw refuse(`flag '${spec.name}' requires '${spec.name}=VALUE' for '${command}' ${hint}`);\n } else if (spec.valueStyle === 'none') {\n value = '';\n } else {\n // 'next' or 'either' with no attached value: consume the next token.\n const next = argv[i + 1];\n if (next === undefined || next.startsWith('--')) {\n if (!spec.optionalValue) {\n throw refuse(`flag '${spec.name}' requires a value for '${command}' ${hint}`);\n }\n value = '';\n } else {\n value = next;\n i++;\n }\n }\n\n const key = spec.name.slice(2);\n const existing = flags.get(key);\n if (existing) {\n if (!spec.repeatable) {\n throw refuse(`flag '${spec.name}' given more than once for '${command}' ${hint}`);\n }\n existing.push(value);\n } else {\n flags.set(key, [value]);\n }\n }\n\n refuseExtraPositionals(command, positionals, arity.max);\n return { flags, positionals };\n}\n"]}
@@ -11,6 +11,7 @@
11
11
  */
12
12
  import type { ParsedArgs, FlagSpec, PositionalArity } from './args.js';
13
13
  import type * as cliApi from '../cli-api.js';
14
+ /** The arguments, API and output functions that a command's `run` receives. */
14
15
  export interface CommandCtx {
15
16
  args: ParsedArgs;
16
17
  api: typeof cliApi;
@@ -20,10 +21,12 @@ export interface CommandCtx {
20
21
  }
21
22
  /** README / docs/CLI.md grouping. The generator is the only reader. */
22
23
  export type CommandGroup = 'evaluate' | 'explore' | 'discovery' | 'data' | 'utilities';
24
+ /** A subverb of a command, such as `probe scan`, with its one-line summary. */
23
25
  export interface CommandSub {
24
26
  readonly name: string;
25
27
  readonly summary: string;
26
28
  }
29
+ /** One verb of the `upt` CLI: its name, flags, help text and `run` handler. */
27
30
  export interface Command {
28
31
  name: string;
29
32
  aliases: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/cli/command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO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AE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACxE,CAAC;AAED;;;6EAG6E;AAC7E,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,eAAe,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;yEAEyE;AACzE,MAAM,UAAU,oBAAoB;IAClC,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC","sourcesContent":["/**\n * Command registry + the `Command`/`CommandCtx` contract for the UPT CLI.\n *\n * A `Command` is a self-contained verb handler: its own flag specs, its own\n * help block, and a `run` that receives an injected `CommandCtx` (never\n * reaches for `process.stdout`/`process.argv` itself, so it is trivially\n * testable in-process). `main.ts` owns dispatch (`runCli`); this module only\n * owns the registry those commands plug into — new commands register\n * themselves (typically from their own module's top-level side effect, or\n * from a barrel later tasks import) without `runCli`'s body ever changing.\n */\n\nimport type { ParsedArgs, FlagSpec, PositionalArity } from './args.js';\nimport type * as cliApi from '../cli-api.js';\n\nexport interface CommandCtx {\n args: ParsedArgs;\n api: typeof cliApi; // injected so tests can stub; main.ts passes the real barrel\n out: (line?: string) => void; // console.log semantics: write((line ?? '') + '\\n')\n err: (line?: string) => void; // same semantics on stderr\n write: (s: string) => void; // raw stdout write, no newline (diagram output only)\n}\n\n/** README / docs/CLI.md grouping. The generator is the only reader. */\nexport type CommandGroup = 'evaluate' | 'explore' | 'discovery' | 'data' | 'utilities';\n\nexport interface CommandSub {\n readonly name: string;\n readonly summary: string;\n}\n\nexport interface Command {\n name: string;\n aliases: string[];\n flags: FlagSpec[];\n help: string; // per-command usage block; the Flags section is renderFlagCatalog(flags)\n /** One line for the README table and docs/CLI.md. */\n summary?: string;\n /** One real invocation, including the `upt` word. */\n example?: string;\n group?: CommandGroup;\n /** Subverbs, when the command has them. `probe` is the one that does. */\n subcommands?: readonly CommandSub[];\n /**\n * The positional arguments the command reads. Absent: none, and a stray token is a usage\n * error (exit 2) naming the token and the command, checked once by the parser the dispatcher\n * runs (`parseArgs`), so `run` never sees a token it would drop. A command that reads\n * positionals declares how many (`{ max: Infinity }` for a list).\n */\n positionals?: PositionalArity;\n run(ctx: CommandCtx): Promise<number>; // 0 on success; throws UsageError/CliError otherwise\n}\n\nconst registry = new Map<string, Command>();\n\n/** Register a command under its name and every alias. Later registrations for\n * an already-taken name/alias overwrite the earlier one (keeps this usable\n * from tests that re-register a stub across cases). */\nexport function registerCommand(command: Command): void {\n registry.set(command.name, command);\n for (const alias of command.aliases) registry.set(alias, command);\n}\n\n/** Look up a command by its primary name or any alias. */\nexport function resolveCommand(nameOrAlias: string): Command | undefined {\n return registry.get(nameOrAlias);\n}\n\n/**\n * The PRIMARY names of every registered command, sorted (aliases excluded).\n *\n * The authority on what the CLI can run. `upt --help` is this list, each\n * command's own `help`, so a command registered without a help entry is still\n * named; `tests/cli/help-covers-registry.test.ts` compares the two. `upt chain`\n * is registered and omitted from that text.\n */\nexport function listCommandNames(): string[] {\n return [...new Set([...registry.values()].map((c) => c.name))].sort();\n}\n\n/** Test-only registration hook. Same behavior as `registerCommand` — kept as\n * a distinct, deliberately-unexciting name so it reads as test scaffolding\n * (not part of the CLI's own porting surface) at call sites in\n * `tests/cli/*.test.ts`. Not re-exported from `cli-api.ts` or `index.ts`. */\nexport function registerForTest(command: Command): void {\n registerCommand(command);\n}\n\n/** Test-only reset hook: clears every registered command (including\n * aliases). Lets test files register stub commands without leaking them\n * across files that share the module registry within a single worker. */\nexport function clearRegistryForTest(): void {\n registry.clear();\n}\n"]}
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/cli/command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA8CH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;AAE5C;;uDAEuD;AACvD,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpC,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO;QAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACpE,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,OAAO,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACxE,CAAC;AAED;;;6EAG6E;AAC7E,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,eAAe,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;yEAEyE;AACzE,MAAM,UAAU,oBAAoB;IAClC,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC","sourcesContent":["/**\n * Command registry + the `Command`/`CommandCtx` contract for the UPT CLI.\n *\n * A `Command` is a self-contained verb handler: its own flag specs, its own\n * help block, and a `run` that receives an injected `CommandCtx` (never\n * reaches for `process.stdout`/`process.argv` itself, so it is trivially\n * testable in-process). `main.ts` owns dispatch (`runCli`); this module only\n * owns the registry those commands plug into — new commands register\n * themselves (typically from their own module's top-level side effect, or\n * from a barrel later tasks import) without `runCli`'s body ever changing.\n */\n\nimport type { ParsedArgs, FlagSpec, PositionalArity } from './args.js';\nimport type * as cliApi from '../cli-api.js';\n\n/** The arguments, API and output functions that a command's `run` receives. */\nexport interface CommandCtx {\n args: ParsedArgs;\n api: typeof cliApi; // injected so tests can stub; main.ts passes the real barrel\n out: (line?: string) => void; // console.log semantics: write((line ?? '') + '\\n')\n err: (line?: string) => void; // same semantics on stderr\n write: (s: string) => void; // raw stdout write, no newline (diagram output only)\n}\n\n/** README / docs/CLI.md grouping. The generator is the only reader. */\nexport type CommandGroup = 'evaluate' | 'explore' | 'discovery' | 'data' | 'utilities';\n\n/** A subverb of a command, such as `probe scan`, with its one-line summary. */\nexport interface CommandSub {\n readonly name: string;\n readonly summary: string;\n}\n\n/** One verb of the `upt` CLI: its name, flags, help text and `run` handler. */\nexport interface Command {\n name: string;\n aliases: string[];\n flags: FlagSpec[];\n help: string; // per-command usage block; the Flags section is renderFlagCatalog(flags)\n /** One line for the README table and docs/CLI.md. */\n summary?: string;\n /** One real invocation, including the `upt` word. */\n example?: string;\n group?: CommandGroup;\n /** Subverbs, when the command has them. `probe` is the one that does. */\n subcommands?: readonly CommandSub[];\n /**\n * The positional arguments the command reads. Absent: none, and a stray token is a usage\n * error (exit 2) naming the token and the command, checked once by the parser the dispatcher\n * runs (`parseArgs`), so `run` never sees a token it would drop. A command that reads\n * positionals declares how many (`{ max: Infinity }` for a list).\n */\n positionals?: PositionalArity;\n run(ctx: CommandCtx): Promise<number>; // 0 on success; throws UsageError/CliError otherwise\n}\n\nconst registry = new Map<string, Command>();\n\n/** Register a command under its name and every alias. Later registrations for\n * an already-taken name/alias overwrite the earlier one (keeps this usable\n * from tests that re-register a stub across cases). */\nexport function registerCommand(command: Command): void {\n registry.set(command.name, command);\n for (const alias of command.aliases) registry.set(alias, command);\n}\n\n/** Look up a command by its primary name or any alias. */\nexport function resolveCommand(nameOrAlias: string): Command | undefined {\n return registry.get(nameOrAlias);\n}\n\n/**\n * The PRIMARY names of every registered command, sorted (aliases excluded).\n *\n * The authority on what the CLI can run. `upt --help` is this list, each\n * command's own `help`, so a command registered without a help entry is still\n * named; `tests/cli/help-covers-registry.test.ts` compares the two. `upt chain`\n * is registered and omitted from that text.\n */\nexport function listCommandNames(): string[] {\n return [...new Set([...registry.values()].map((c) => c.name))].sort();\n}\n\n/** Test-only registration hook. Same behavior as `registerCommand` — kept as\n * a distinct, deliberately-unexciting name so it reads as test scaffolding\n * (not part of the CLI's own porting surface) at call sites in\n * `tests/cli/*.test.ts`. Not re-exported from `cli-api.ts` or `index.ts`. */\nexport function registerForTest(command: Command): void {\n registerCommand(command);\n}\n\n/** Test-only reset hook: clears every registered command (including\n * aliases). Lets test files register stub commands without leaking them\n * across files that share the module registry within a single worker. */\nexport function clearRegistryForTest(): void {\n registry.clear();\n}\n"]}
@@ -13,5 +13,6 @@
13
13
  import type { ParsedArgs } from '../args.js';
14
14
  import type { CommandCtx } from '../command.js';
15
15
  import type { DiscoveryOptions } from '../../composition/discovery.js';
16
+ /** Read the `--max-orders` and `--anchor` flags into discovery options. A bad value throws. */
16
17
  export declare function parseDiscoveryOpts(api: CommandCtx['api'], flags: ParsedArgs['flags']): DiscoveryOptions;
17
18
  //# sourceMappingURL=_discovery-opts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_discovery-opts.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/_discovery-opts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAGvE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,gBAAgB,CA4FvG"}
1
+ {"version":3,"file":"_discovery-opts.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/_discovery-opts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAGvE,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,gBAAgB,CA4FvG"}
@@ -1,5 +1,6 @@
1
1
  import { CliError, UsageError } from '../errors.js';
2
2
  import { realFlag } from '../numeric-flag.js';
3
+ /** Read the `--max-orders` and `--anchor` flags into discovery options. A bad value throws. */
3
4
  export function parseDiscoveryOpts(api, flags) {
4
5
  const opts = {};
5
6
  const moValues = flags.get('max-orders');
@@ -1 +1 @@
1
- {"version":3,"file":"_discovery-opts.js","sourceRoot":"","sources":["../../../src/cli/commands/_discovery-opts.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C,MAAM,UAAU,kBAAkB,CAAC,GAAsB,EAAE,KAA0B;IACnF,MAAM,IAAI,GAA4E,EAAE,CAAC;IAEzF,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1C,2FAA2F;QAC3F,uFAAuF;QACvF,MAAM,CAAC,GAAG,QAAQ,CAAC,EAAE,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;QAC5C,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACV,MAAM,IAAI,QAAQ,CAAC,gEAAgE,GAAG,IAAI,CAAC,CAAC;QAC9F,CAAC;QACD,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,MAAM,EAAE,GAA2B,EAAE,CAAC;IACtC,MAAM,KAAK,GAAkD,EAAE,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ACX,IAAI,CAAC,YAAY,GAAG,CAAC,wBAAwB;YAAE,MAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACvF,MAAM,CAAC,CAAC;IACV,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACtD,MAAM,GAAG,GAAG,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,IAAI,CAAC;QACjE,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAClB,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM;QAAE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAElD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * Shared `--max-orders`/`--anchor` parsing — used by both `discover` and\n * `map`'s `--proposed` overlay. In the old CLI, `map`'s `proposedJunctions`\n * passed the raw args straight through `parseDiscoveryOpts` (bin/upt.mjs line\n * 392), so `map --proposed --max-orders=N` genuinely tuned the proposed\n * overlay — the two commands share this validation, not just the shape.\n *\n * Transposed verbatim from bin/upt.mjs's `parseDiscoveryOpts()` (lines\n * 596-632). The two error messages are pinned byte-exact by\n * `tests/cli/upt-discover-opts.test.ts` (which drives the OLD bin, still\n * green and untouched) — do not reword them.\n */\nimport type { ParsedArgs } from '../args.js';\nimport type { CommandCtx } from '../command.js';\nimport { CliError, UsageError } from '../errors.js';\nimport { realFlag } from '../numeric-flag.js';\nimport type { DiscoveryOptions } from '../../composition/discovery.js';\nimport type { Dimension } from '../../dimensional/types.js';\n\nexport function parseDiscoveryOpts(api: CommandCtx['api'], flags: ParsedArgs['flags']): DiscoveryOptions {\n const opts: { maxOrdersOfMagnitude?: number; groundTruth?: Record<string, number> } = {};\n\n const moValues = flags.get('max-orders');\n if (moValues && moValues.length > 0) {\n const raw = moValues[moValues.length - 1];\n // The grammar first: an empty, hex or non-numeric token is a malformed invocation (exit 2,\n // naming the flag and the token). A well-formed negative value is a bad value: exit 1.\n const n = realFlag('', '--max-orders', raw);\n if (n < 0) {\n throw new CliError(`upt: --max-orders must be a non-negative finite number, got \"${raw}\".`);\n }\n opts.maxOrdersOfMagnitude = n;\n }\n\n const gt: Record<string, number> = {};\n const pairs: { name: string; raw: string; pair: string }[] = [];\n for (const x of flags.get('anchor') ?? []) {\n for (const pair of x.split(',')) {\n const split = api.splitAssignment(pair);\n if (split === null) {\n throw new UsageError(`upt: --anchor expects k=v with a finite numeric value, got \"${pair}\".`);\n }\n const { name: k, raw: v } = split;\n // An empty value is a bad value (exit 1), as `x=` is on every other binding.\n if (v === '') throw new CliError(`upt: --anchor '${k}' has no value ('${pair}'); give k=v with a finite numeric value`);\n pairs.push({ name: k, raw: v, pair });\n }\n }\n const seenAnchor = new Set<string>();\n for (const p of pairs) {\n if (seenAnchor.has(p.name)) throw new CliError(`upt: --anchor '${p.name}' is given twice ('${p.pair}'); give one value per name`);\n seenAnchor.add(p.name);\n }\n const siblings = pairs.map((p) => ({ name: p.name, raw: p.raw }));\n // Every quantity either graph names, with its dimension: an anchor is a value of one of them.\n const quantities = new Map<string, Dimension>();\n for (const edge of [...api.CATALOG_GRAPH, ...api.CANONICAL_GRAPH]) {\n for (const q of [edge.target, ...edge.sources]) quantities.set(q.name, q.dim);\n }\n const quantityNames = new Set(quantities.keys());\n const rawValues: Record<string, number> = {};\n for (const p of pairs) {\n const resolved = api.resolveQuantityName(p.name, quantityNames);\n const dim = resolved === null ? undefined : quantities.get(resolved);\n if (resolved === null || dim === undefined) {\n // An anchor on a name no graph holds would be read, printed as the anchor, and change nothing.\n throw new CliError(`upt: --anchor '${p.pair}': '${p.name}' is not a quantity in either graph (\\`upt search ${p.name}\\` looks for one)`);\n }\n try {\n const read = api.readNamedBinding(p.name, p.raw, { siblings });\n if (!Number.isFinite(read.value)) {\n throw new CliError(`upt: --anchor expects k=v with a finite numeric value, got \"${p.pair}\".`);\n }\n // A bare number is already in SI. A value with a unit must be the quantity's dimension:\n // `mass=1s` is not a mass of 1 kg.\n if (read.dimensioned && !api.dimensionsEqual(read.dimension, dim)) {\n throw new CliError(\n `upt: --anchor '${p.pair}' is ${api.format(read.dimension)}, but ${resolved} is ${api.format(dim)}`,\n );\n }\n rawValues[p.name] = read.value;\n } catch (e) {\n // A bad value is exit 1 on every command; a missing `=` was refused as usage above.\n if (e instanceof CliError) throw e;\n if (e instanceof api.TemperatureBindingError) {\n throw new CliError(`upt: --anchor '${p.pair}' is not a temperature. ${e.message}`);\n }\n // Not a number: the pinned sentence. Any other unit error (an unknown unit, an ambiguous\n // one) says what it found, so it is passed on with the anchor it came from.\n if (e instanceof api.BindingNumberError) {\n throw new CliError(`upt: --anchor expects k=v with a finite numeric value, got \"${p.pair}\".`);\n }\n if (e instanceof api.UnitError) {\n throw new CliError(`upt: --anchor '${p.pair}': ${e.message}`);\n }\n throw e;\n }\n }\n try {\n api.assertSynonymAgreement(rawValues);\n } catch (e) {\n if (e instanceof api.SynonymDisagreementError) throw new CliError(`upt: ${e.message}`);\n throw e;\n }\n for (const [name, value] of Object.entries(rawValues)) {\n const key = api.resolveQuantityName(name, quantityNames) ?? name;\n gt[key] = value;\n }\n if (Object.keys(gt).length) opts.groundTruth = gt;\n\n return opts;\n}\n"]}
1
+ {"version":3,"file":"_discovery-opts.js","sourceRoot":"","sources":["../../../src/cli/commands/_discovery-opts.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C,+FAA+F;AAC/F,MAAM,UAAU,kBAAkB,CAAC,GAAsB,EAAE,KAA0B;IACnF,MAAM,IAAI,GAA4E,EAAE,CAAC;IAEzF,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzC,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YACD,yFAAyF;YACzF,4EAA4E;YAC5E,IAAI,CAAC,YAAY,GAAG,CAAC,kBAAkB,EAAE,CAAC;gBACxC,MAAM,IAAI,QAAQ,CAAC,+DAA+D,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;YAChG,CAAC;YACD,IAAI,CAAC,YAAY,GAAG,CAAC,SAAS,EAAE,CAAC;gBAC/B,MAAM,IAAI,QAAQ,CAAC,kBAAkB,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAChE,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IACD,IAAI,CAAC;QACH,GAAG,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,GAAG,CAAC,wBAAwB;YAAE,MAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACvF,MAAM,CAAC,CAAC;IACV,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACtD,MAAM,GAAG,GAAG,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,IAAI,CAAC;QACjE,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAClB,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM;QAAE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAElD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * Shared `--max-orders`/`--anchor` parsing — used by both `discover` and\n * `map`'s `--proposed` overlay. In the old CLI, `map`'s `proposedJunctions`\n * passed the raw args straight through `parseDiscoveryOpts` (bin/upt.mjs line\n * 392), so `map --proposed --max-orders=N` genuinely tuned the proposed\n * overlay — the two commands share this validation, not just the shape.\n *\n * Transposed verbatim from bin/upt.mjs's `parseDiscoveryOpts()` (lines\n * 596-632). The two error messages are pinned byte-exact by\n * `tests/cli/upt-discover-opts.test.ts` (which drives the OLD bin, still\n * green and untouched) — do not reword them.\n */\nimport type { ParsedArgs } from '../args.js';\nimport type { CommandCtx } from '../command.js';\nimport { CliError, UsageError } from '../errors.js';\nimport { realFlag } from '../numeric-flag.js';\nimport type { DiscoveryOptions } from '../../composition/discovery.js';\nimport type { Dimension } from '../../dimensional/types.js';\n\n/** Read the `--max-orders` and `--anchor` flags into discovery options. A bad value throws. */\nexport function parseDiscoveryOpts(api: CommandCtx['api'], flags: ParsedArgs['flags']): DiscoveryOptions {\n const opts: { maxOrdersOfMagnitude?: number; groundTruth?: Record<string, number> } = {};\n\n const moValues = flags.get('max-orders');\n if (moValues && moValues.length > 0) {\n const raw = moValues[moValues.length - 1];\n // The grammar first: an empty, hex or non-numeric token is a malformed invocation (exit 2,\n // naming the flag and the token). A well-formed negative value is a bad value: exit 1.\n const n = realFlag('', '--max-orders', raw);\n if (n < 0) {\n throw new CliError(`upt: --max-orders must be a non-negative finite number, got \"${raw}\".`);\n }\n opts.maxOrdersOfMagnitude = n;\n }\n\n const gt: Record<string, number> = {};\n const pairs: { name: string; raw: string; pair: string }[] = [];\n for (const x of flags.get('anchor') ?? []) {\n for (const pair of x.split(',')) {\n const split = api.splitAssignment(pair);\n if (split === null) {\n throw new UsageError(`upt: --anchor expects k=v with a finite numeric value, got \"${pair}\".`);\n }\n const { name: k, raw: v } = split;\n // An empty value is a bad value (exit 1), as `x=` is on every other binding.\n if (v === '') throw new CliError(`upt: --anchor '${k}' has no value ('${pair}'); give k=v with a finite numeric value`);\n pairs.push({ name: k, raw: v, pair });\n }\n }\n const seenAnchor = new Set<string>();\n for (const p of pairs) {\n if (seenAnchor.has(p.name)) throw new CliError(`upt: --anchor '${p.name}' is given twice ('${p.pair}'); give one value per name`);\n seenAnchor.add(p.name);\n }\n const siblings = pairs.map((p) => ({ name: p.name, raw: p.raw }));\n // Every quantity either graph names, with its dimension: an anchor is a value of one of them.\n const quantities = new Map<string, Dimension>();\n for (const edge of [...api.CATALOG_GRAPH, ...api.CANONICAL_GRAPH]) {\n for (const q of [edge.target, ...edge.sources]) quantities.set(q.name, q.dim);\n }\n const quantityNames = new Set(quantities.keys());\n const rawValues: Record<string, number> = {};\n for (const p of pairs) {\n const resolved = api.resolveQuantityName(p.name, quantityNames);\n const dim = resolved === null ? undefined : quantities.get(resolved);\n if (resolved === null || dim === undefined) {\n // An anchor on a name no graph holds would be read, printed as the anchor, and change nothing.\n throw new CliError(`upt: --anchor '${p.pair}': '${p.name}' is not a quantity in either graph (\\`upt search ${p.name}\\` looks for one)`);\n }\n try {\n const read = api.readNamedBinding(p.name, p.raw, { siblings });\n if (!Number.isFinite(read.value)) {\n throw new CliError(`upt: --anchor expects k=v with a finite numeric value, got \"${p.pair}\".`);\n }\n // A bare number is already in SI. A value with a unit must be the quantity's dimension:\n // `mass=1s` is not a mass of 1 kg.\n if (read.dimensioned && !api.dimensionsEqual(read.dimension, dim)) {\n throw new CliError(\n `upt: --anchor '${p.pair}' is ${api.format(read.dimension)}, but ${resolved} is ${api.format(dim)}`,\n );\n }\n rawValues[p.name] = read.value;\n } catch (e) {\n // A bad value is exit 1 on every command; a missing `=` was refused as usage above.\n if (e instanceof CliError) throw e;\n if (e instanceof api.TemperatureBindingError) {\n throw new CliError(`upt: --anchor '${p.pair}' is not a temperature. ${e.message}`);\n }\n // Not a number: the pinned sentence. Any other unit error (an unknown unit, an ambiguous\n // one) says what it found, so it is passed on with the anchor it came from.\n if (e instanceof api.BindingNumberError) {\n throw new CliError(`upt: --anchor expects k=v with a finite numeric value, got \"${p.pair}\".`);\n }\n if (e instanceof api.UnitError) {\n throw new CliError(`upt: --anchor '${p.pair}': ${e.message}`);\n }\n throw e;\n }\n }\n try {\n api.assertSynonymAgreement(rawValues);\n } catch (e) {\n if (e instanceof api.SynonymDisagreementError) throw new CliError(`upt: ${e.message}`);\n throw e;\n }\n for (const [name, value] of Object.entries(rawValues)) {\n const key = api.resolveQuantityName(name, quantityNames) ?? name;\n gt[key] = value;\n }\n if (Object.keys(gt).length) opts.groundTruth = gt;\n\n return opts;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/discover.ts"],"names":[],"mappings":"AAQA,OAAO,EAAmB,KAAK,OAAO,EAAmB,MAAM,eAAe,CAAC;AAmc/E,eAAO,MAAM,OAAO,EAAE,OASrB,CAAC"}
1
+ {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/discover.ts"],"names":[],"mappings":"AAQA,OAAO,EAAmB,KAAK,OAAO,EAAmB,MAAM,eAAe,CAAC;AA8f/E,eAAO,MAAM,OAAO,EAAE,OASrB,CAAC"}