aontu 0.62.0 → 0.63.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 (356) hide show
  1. package/README.md +1 -1
  2. package/dist/agentsmd.js +0 -27
  3. package/dist/agentsmd.js.map +1 -1
  4. package/dist/alias.js.map +1 -1
  5. package/dist/allow.js +0 -92
  6. package/dist/allow.js.map +1 -1
  7. package/dist/aontu.d.ts +1 -1
  8. package/dist/aontu.js +1 -79
  9. package/dist/aontu.js.map +1 -1
  10. package/dist/aontumodel.d.ts +4 -0
  11. package/dist/aontumodel.js +33 -0
  12. package/dist/aontumodel.js.map +1 -0
  13. package/dist/cli.js +101 -620
  14. package/dist/cli.js.map +1 -1
  15. package/dist/ctx.js +0 -48
  16. package/dist/ctx.js.map +1 -1
  17. package/dist/diff.js +0 -32
  18. package/dist/diff.js.map +1 -1
  19. package/dist/err.js +0 -40
  20. package/dist/err.js.map +1 -1
  21. package/dist/escape.js +0 -45
  22. package/dist/escape.js.map +1 -1
  23. package/dist/exactjson.d.ts +0 -35
  24. package/dist/exactjson.js +0 -131
  25. package/dist/exactjson.js.map +1 -1
  26. package/dist/format.js +13 -203
  27. package/dist/format.js.map +1 -1
  28. package/dist/grammar.d.ts +9 -0
  29. package/dist/grammar.js +54 -0
  30. package/dist/grammar.js.map +1 -0
  31. package/dist/graph.js +0 -26
  32. package/dist/graph.js.map +1 -1
  33. package/dist/hcanon.js +0 -82
  34. package/dist/hcanon.js.map +1 -1
  35. package/dist/helpdoc.js +1 -1
  36. package/dist/helpdoc.js.map +1 -1
  37. package/dist/hints.d.ts +0 -6
  38. package/dist/hints.js +54 -55
  39. package/dist/hints.js.map +1 -1
  40. package/dist/jsonschema.js +0 -114
  41. package/dist/jsonschema.js.map +1 -1
  42. package/dist/keyorder.d.ts +0 -7
  43. package/dist/keyorder.js +0 -41
  44. package/dist/keyorder.js.map +1 -1
  45. package/dist/lang.js +17 -915
  46. package/dist/lang.js.map +1 -1
  47. package/dist/lower.js +11 -61
  48. package/dist/lower.js.map +1 -1
  49. package/dist/lsp-server.js +0 -16
  50. package/dist/lsp-server.js.map +1 -1
  51. package/dist/lsp.d.ts +1 -1
  52. package/dist/lsp.js +12 -159
  53. package/dist/lsp.js.map +1 -1
  54. package/dist/mcp-server.js +0 -26
  55. package/dist/mcp-server.js.map +1 -1
  56. package/dist/mcp.js +0 -113
  57. package/dist/mcp.js.map +1 -1
  58. package/dist/mod-tool.js +0 -130
  59. package/dist/mod-tool.js.map +1 -1
  60. package/dist/mod.js +0 -162
  61. package/dist/mod.js.map +1 -1
  62. package/dist/patch.js +0 -217
  63. package/dist/patch.js.map +1 -1
  64. package/dist/provenance.js +0 -140
  65. package/dist/provenance.js.map +1 -1
  66. package/dist/query.js +0 -75
  67. package/dist/query.js.map +1 -1
  68. package/dist/reach.js +0 -43
  69. package/dist/reach.js.map +1 -1
  70. package/dist/relation.js +0 -61
  71. package/dist/relation.js.map +1 -1
  72. package/dist/render.js +20 -135
  73. package/dist/render.js.map +1 -1
  74. package/dist/report-sarif.d.ts +0 -11
  75. package/dist/report-sarif.js +0 -28
  76. package/dist/report-sarif.js.map +1 -1
  77. package/dist/sig.js +0 -35
  78. package/dist/sig.js.map +1 -1
  79. package/dist/sigdecl.js +1 -1
  80. package/dist/sigdecl.js.map +1 -1
  81. package/dist/siggate.js +0 -4
  82. package/dist/siggate.js.map +1 -1
  83. package/dist/site.js +3 -29
  84. package/dist/site.js.map +1 -1
  85. package/dist/subsume.d.ts +0 -10
  86. package/dist/subsume.js +0 -137
  87. package/dist/subsume.js.map +1 -1
  88. package/dist/template.d.ts +2 -1
  89. package/dist/template.js +58 -138
  90. package/dist/template.js.map +1 -1
  91. package/dist/trim.js +0 -41
  92. package/dist/trim.js.map +1 -1
  93. package/dist/tsconfig.tsbuildinfo +1 -1
  94. package/dist/type.js.map +1 -1
  95. package/dist/unify.js +12 -242
  96. package/dist/unify.js.map +1 -1
  97. package/dist/utility.js +0 -22
  98. package/dist/utility.js.map +1 -1
  99. package/dist/val/AbnfFuncVal.d.ts +18 -0
  100. package/dist/val/AbnfFuncVal.js +132 -0
  101. package/dist/val/AbnfFuncVal.js.map +1 -0
  102. package/dist/val/AbsentVal.d.ts +11 -0
  103. package/dist/val/AbsentVal.js +30 -0
  104. package/dist/val/AbsentVal.js.map +1 -0
  105. package/dist/val/AggFuncVal.d.ts +10 -1
  106. package/dist/val/AggFuncVal.js +104 -116
  107. package/dist/val/AggFuncVal.js.map +1 -1
  108. package/dist/val/ArithFuncVal.js +0 -12
  109. package/dist/val/ArithFuncVal.js.map +1 -1
  110. package/dist/val/BagVal.js +1 -78
  111. package/dist/val/BagVal.js.map +1 -1
  112. package/dist/val/BigDecimalVal.js +0 -16
  113. package/dist/val/BigDecimalVal.js.map +1 -1
  114. package/dist/val/BigIntegerVal.js +0 -16
  115. package/dist/val/BigIntegerVal.js.map +1 -1
  116. package/dist/val/CloseFuncVal.js +0 -9
  117. package/dist/val/CloseFuncVal.js.map +1 -1
  118. package/dist/val/CmpFuncVal.js +2 -59
  119. package/dist/val/CmpFuncVal.js.map +1 -1
  120. package/dist/val/ConjunctVal.js +0 -29
  121. package/dist/val/ConjunctVal.js.map +1 -1
  122. package/dist/val/ConstraintVal.js +0 -500
  123. package/dist/val/ConstraintVal.js.map +1 -1
  124. package/dist/val/ContainerKindVal.js +0 -2
  125. package/dist/val/ContainerKindVal.js.map +1 -1
  126. package/dist/val/CopyFuncVal.js +0 -3
  127. package/dist/val/CopyFuncVal.js.map +1 -1
  128. package/dist/val/Decimal.js +0 -179
  129. package/dist/val/Decimal.js.map +1 -1
  130. package/dist/val/DeprecateFuncVal.js.map +1 -1
  131. package/dist/val/DisjunctVal.js +0 -152
  132. package/dist/val/DisjunctVal.js.map +1 -1
  133. package/dist/val/EachFuncVal.js +0 -3
  134. package/dist/val/EachFuncVal.js.map +1 -1
  135. package/dist/val/EmitFuncVal.d.ts +1 -1
  136. package/dist/val/EmitFuncVal.js +6 -119
  137. package/dist/val/EmitFuncVal.js.map +1 -1
  138. package/dist/val/ExpectVal.js +0 -62
  139. package/dist/val/ExpectVal.js.map +1 -1
  140. package/dist/val/FilterFuncVal.js +0 -25
  141. package/dist/val/FilterFuncVal.js.map +1 -1
  142. package/dist/val/FuncBaseVal.d.ts +1 -0
  143. package/dist/val/FuncBaseVal.js +7 -127
  144. package/dist/val/FuncBaseVal.js.map +1 -1
  145. package/dist/val/GraphAtomVal.js +0 -15
  146. package/dist/val/GraphAtomVal.js.map +1 -1
  147. package/dist/val/HideFuncVal.js +0 -13
  148. package/dist/val/HideFuncVal.js.map +1 -1
  149. package/dist/val/IntegerVal.js +0 -61
  150. package/dist/val/IntegerVal.js.map +1 -1
  151. package/dist/val/JunctionVal.js +0 -20
  152. package/dist/val/JunctionVal.js.map +1 -1
  153. package/dist/val/KeyFuncVal.js +0 -46
  154. package/dist/val/KeyFuncVal.js.map +1 -1
  155. package/dist/val/ListVal.js +0 -57
  156. package/dist/val/ListVal.js.map +1 -1
  157. package/dist/val/LowerFuncVal.js +0 -11
  158. package/dist/val/LowerFuncVal.js.map +1 -1
  159. package/dist/val/MapVal.js +0 -151
  160. package/dist/val/MapVal.js.map +1 -1
  161. package/dist/val/MatchFuncVal.js +0 -27
  162. package/dist/val/MatchFuncVal.js.map +1 -1
  163. package/dist/val/{FormFuncVal.d.ts → MaybeFuncVal.d.ts} +5 -5
  164. package/dist/val/MaybeFuncVal.js +50 -0
  165. package/dist/val/MaybeFuncVal.js.map +1 -0
  166. package/dist/val/MoveFuncVal.js +0 -18
  167. package/dist/val/MoveFuncVal.js.map +1 -1
  168. package/dist/val/NilVal.js +0 -60
  169. package/dist/val/NilVal.js.map +1 -1
  170. package/dist/val/NomFuncVal.js +8 -42
  171. package/dist/val/NomFuncVal.js.map +1 -1
  172. package/dist/val/NumberVal.js +0 -15
  173. package/dist/val/NumberVal.js.map +1 -1
  174. package/dist/val/OpBaseVal.d.ts +1 -0
  175. package/dist/val/OpBaseVal.js +3 -15
  176. package/dist/val/OpBaseVal.js.map +1 -1
  177. package/dist/val/PackFuncVal.js +0 -34
  178. package/dist/val/PackFuncVal.js.map +1 -1
  179. package/dist/val/PathFuncVal.js +0 -6
  180. package/dist/val/PathFuncVal.js.map +1 -1
  181. package/dist/val/PathVal.js +0 -41
  182. package/dist/val/PathVal.js.map +1 -1
  183. package/dist/val/PlaceVal.js +0 -25
  184. package/dist/val/PlaceVal.js.map +1 -1
  185. package/dist/val/PlusOpVal.d.ts +1 -7
  186. package/dist/val/PlusOpVal.js +13 -74
  187. package/dist/val/PlusOpVal.js.map +1 -1
  188. package/dist/val/PrefFuncVal.js +0 -1
  189. package/dist/val/PrefFuncVal.js.map +1 -1
  190. package/dist/val/PrefVal.js +0 -167
  191. package/dist/val/PrefVal.js.map +1 -1
  192. package/dist/val/RecurseVal.js +0 -55
  193. package/dist/val/RecurseVal.js.map +1 -1
  194. package/dist/val/RefVal.js +0 -282
  195. package/dist/val/RefVal.js.map +1 -1
  196. package/dist/val/ReferFuncVal.js +0 -232
  197. package/dist/val/ReferFuncVal.js.map +1 -1
  198. package/dist/val/ScalarKindVal.js +0 -49
  199. package/dist/val/ScalarKindVal.js.map +1 -1
  200. package/dist/val/ScalarVal.js +0 -11
  201. package/dist/val/ScalarVal.js.map +1 -1
  202. package/dist/val/StrFuncVal.js +0 -18
  203. package/dist/val/StrFuncVal.js.map +1 -1
  204. package/dist/val/SuperFuncVal.js +0 -32
  205. package/dist/val/SuperFuncVal.js.map +1 -1
  206. package/dist/val/TopVal.js +0 -1
  207. package/dist/val/TopVal.js.map +1 -1
  208. package/dist/val/TranslateFuncVal.js +1 -3
  209. package/dist/val/TranslateFuncVal.js.map +1 -1
  210. package/dist/val/UpperFuncVal.js +0 -11
  211. package/dist/val/UpperFuncVal.js.map +1 -1
  212. package/dist/val/Val.d.ts +1 -0
  213. package/dist/val/Val.js +2 -133
  214. package/dist/val/Val.js.map +1 -1
  215. package/dist/val/VarVal.js +0 -12
  216. package/dist/val/VarVal.js.map +1 -1
  217. package/dist/val/arith.js +0 -37
  218. package/dist/val/arith.js.map +1 -1
  219. package/dist/val/caserange.js +0 -61
  220. package/dist/val/caserange.js.map +1 -1
  221. package/dist/val/members.js +0 -6
  222. package/dist/val/members.js.map +1 -1
  223. package/dist/val/numcmp.js +0 -11
  224. package/dist/val/numcmp.js.map +1 -1
  225. package/dist/val/numkind.js +0 -145
  226. package/dist/val/numkind.js.map +1 -1
  227. package/dist/val/valutil.js +0 -16
  228. package/dist/val/valutil.js.map +1 -1
  229. package/dist/vet.js +0 -461
  230. package/dist/vet.js.map +1 -1
  231. package/dist/view.js +0 -414
  232. package/dist/view.js.map +1 -1
  233. package/dist/walk.js +0 -41
  234. package/dist/walk.js.map +1 -1
  235. package/grammar/aontu.abnf +8 -6
  236. package/grammar/aontu.gbnf +4 -4
  237. package/grammar/aontu.lark +4 -4
  238. package/grammar/aontu.tmLanguage.json +1 -1
  239. package/package.json +4 -2
  240. package/src/agentsmd.ts +0 -35
  241. package/src/alias.ts +0 -39
  242. package/src/allow.ts +1 -96
  243. package/src/aontu.ts +3 -110
  244. package/src/aontumodel.ts +32 -0
  245. package/src/cli.ts +113 -682
  246. package/src/ctx.ts +0 -103
  247. package/src/diff.ts +0 -40
  248. package/src/err.ts +0 -40
  249. package/src/escape.ts +0 -46
  250. package/src/exactjson.ts +0 -131
  251. package/src/format.ts +14 -257
  252. package/src/grammar.ts +72 -0
  253. package/src/graph.ts +0 -61
  254. package/src/hcanon.ts +0 -82
  255. package/src/helpdoc.ts +1 -1
  256. package/src/hints.ts +66 -57
  257. package/src/jsonschema.ts +0 -123
  258. package/src/keyorder.ts +0 -42
  259. package/src/lang.ts +19 -931
  260. package/src/lower.ts +12 -62
  261. package/src/lsp-server.ts +0 -16
  262. package/src/lsp.ts +12 -180
  263. package/src/mcp-server.ts +0 -31
  264. package/src/mcp.ts +0 -130
  265. package/src/mod-tool.ts +0 -158
  266. package/src/mod.ts +0 -178
  267. package/src/patch.ts +0 -232
  268. package/src/provenance.ts +0 -183
  269. package/src/query.ts +0 -84
  270. package/src/reach.ts +0 -53
  271. package/src/relation.ts +0 -84
  272. package/src/render.ts +20 -172
  273. package/src/report-sarif.ts +0 -48
  274. package/src/sig.ts +0 -35
  275. package/src/sigdecl.ts +1 -1
  276. package/src/siggate.ts +0 -30
  277. package/src/site.ts +3 -29
  278. package/src/subsume.ts +1 -161
  279. package/src/template.ts +69 -140
  280. package/src/trim.ts +0 -53
  281. package/src/type.ts +2 -45
  282. package/src/unify.ts +13 -251
  283. package/src/utility.ts +0 -31
  284. package/src/val/AbnfFuncVal.ts +181 -0
  285. package/src/val/AbsentVal.ts +54 -0
  286. package/src/val/AggFuncVal.ts +152 -188
  287. package/src/val/ArithFuncVal.ts +0 -20
  288. package/src/val/BagVal.ts +1 -78
  289. package/src/val/BigDecimalVal.ts +0 -16
  290. package/src/val/BigIntegerVal.ts +0 -16
  291. package/src/val/CloseFuncVal.ts +0 -9
  292. package/src/val/CmpFuncVal.ts +4 -166
  293. package/src/val/ConjunctVal.ts +0 -33
  294. package/src/val/ConstraintVal.ts +2 -537
  295. package/src/val/ContainerKindVal.ts +0 -18
  296. package/src/val/CopyFuncVal.ts +0 -5
  297. package/src/val/Decimal.ts +1 -185
  298. package/src/val/DeprecateFuncVal.ts +0 -10
  299. package/src/val/DisjunctVal.ts +0 -157
  300. package/src/val/EachFuncVal.ts +0 -40
  301. package/src/val/EmitFuncVal.ts +8 -208
  302. package/src/val/ExpectVal.ts +0 -62
  303. package/src/val/FilterFuncVal.ts +0 -55
  304. package/src/val/FuncBaseVal.ts +9 -130
  305. package/src/val/GraphAtomVal.ts +0 -42
  306. package/src/val/HideFuncVal.ts +0 -15
  307. package/src/val/IntegerVal.ts +0 -61
  308. package/src/val/JunctionVal.ts +0 -20
  309. package/src/val/KeyFuncVal.ts +0 -48
  310. package/src/val/ListVal.ts +0 -59
  311. package/src/val/LowerFuncVal.ts +0 -12
  312. package/src/val/MapVal.ts +0 -151
  313. package/src/val/MatchFuncVal.ts +0 -59
  314. package/src/val/MaybeFuncVal.ts +86 -0
  315. package/src/val/MoveFuncVal.ts +0 -20
  316. package/src/val/NilVal.ts +0 -60
  317. package/src/val/NomFuncVal.ts +8 -95
  318. package/src/val/NumberVal.ts +0 -16
  319. package/src/val/OpBaseVal.ts +4 -17
  320. package/src/val/PackFuncVal.ts +0 -63
  321. package/src/val/PathFuncVal.ts +0 -32
  322. package/src/val/PathVal.ts +0 -66
  323. package/src/val/PlaceVal.ts +0 -45
  324. package/src/val/PlusOpVal.ts +18 -75
  325. package/src/val/PrefFuncVal.ts +0 -1
  326. package/src/val/PrefVal.ts +0 -179
  327. package/src/val/RecurseVal.ts +0 -81
  328. package/src/val/RefVal.ts +1 -285
  329. package/src/val/ReferFuncVal.ts +0 -255
  330. package/src/val/ScalarKindVal.ts +0 -50
  331. package/src/val/ScalarVal.ts +0 -12
  332. package/src/val/StrFuncVal.ts +0 -44
  333. package/src/val/SuperFuncVal.ts +0 -42
  334. package/src/val/TopVal.ts +0 -1
  335. package/src/val/TranslateFuncVal.ts +1 -51
  336. package/src/val/UpperFuncVal.ts +0 -12
  337. package/src/val/Val.ts +3 -192
  338. package/src/val/VarVal.ts +0 -15
  339. package/src/val/arith.ts +0 -92
  340. package/src/val/caserange.ts +0 -62
  341. package/src/val/members.ts +0 -23
  342. package/src/val/numcmp.ts +1 -27
  343. package/src/val/numkind.ts +0 -149
  344. package/src/val/valutil.ts +0 -16
  345. package/src/vet.ts +1 -582
  346. package/src/view.ts +0 -507
  347. package/src/walk.ts +0 -41
  348. package/dist/std.d.ts +0 -3
  349. package/dist/std.js +0 -672
  350. package/dist/std.js.map +0 -1
  351. package/dist/val/FormFuncVal.js +0 -55
  352. package/dist/val/FormFuncVal.js.map +0 -1
  353. package/dist/val/NamerFuncVal.d.ts +0 -12
  354. package/dist/val/NamerFuncVal.js +0 -176
  355. package/dist/val/NamerFuncVal.js.map +0 -1
  356. package/src/std.ts +0 -683
package/src/query.ts CHANGED
@@ -1,32 +1,6 @@
1
1
  /* Copyright (c) 2025 Richard Rodger, MIT License */
2
2
  import { includeOpts } from './utility'
3
3
 
4
- // THE QUERY SURFACE (G7 phase 1,
5
- // docs/capability-review/g7-machine-access.md): select one node of an
6
- // evaluated document by path and render it — the slice an agent asks
7
- // for, instead of the whole file as one JSON blob.
8
- //
9
- // Evaluation is still GLOBAL. Unification has no partial mode to sell:
10
- // the whole document is evaluated and then one node is selected. What
11
- // `get` buys is the SIZE OF THE ANSWER, not the cost of producing it.
12
- //
13
- // The three projections are lattice ABSTRACTIONS, and each is defined
14
- // so that the view it prints is a valid Aontu document that SUBSUMES
15
- // the truth — generalisation, never distortion:
16
- //
17
- // - `types` replaces every concrete leaf with its own kind, using
18
- // the lattice's own superior() rather than a table of this file's
19
- // opinions: {"replicas":3} becomes {"replicas":integer}.
20
- // - `depth n` keeps structure to depth n and renders every elided
21
- // subtree as `top` — "no further information at this tier".
22
- // - `keys` is `depth 1` degenerated to a listing.
23
- //
24
- // That property is not a promise here: every projection row of
25
- // test/spec/query.tsv asserts subsume(view, truth) == 'subsumes' in
26
- // both runners, which G3 made mechanically checkable.
27
- //
28
- // Projections are NOT canonical form and are never fed to G6's hash,
29
- // which is why they are named views rather than spellings of --canon.
30
4
 
31
5
  import { Aontu } from './aontu'
32
6
  import type { TrustOptions } from './type'
@@ -49,13 +23,6 @@ export type QueryOptions = {
49
23
  // it resolves from its own directory (vet's schemaPath precedent).
50
24
  path?: string
51
25
 
52
- // The trust profile this run evaluates under (G5, docs/trust.md).
53
- // The source arrives from a caller, so the caller must be able to
54
- // say what it may reach: without this the include chain is the
55
- // default one, and `@"../../etc/passwd.aon"` reads whatever the
56
- // process can. (`@"x.js"` no longer executes -- ADR-012 refuses the
57
- // extension -- but reading is enough.) A server passes
58
- // `{include:'none'}`.
59
26
  trust?: TrustOptions
60
27
 
61
28
  // Extensions additionally read as text (the CLI's `--text-ext`).
@@ -67,8 +34,6 @@ export type QueryOptions = {
67
34
  export type QueryReport = {
68
35
  ok: boolean
69
36
  out: string
70
- // Empty when ok. G2's finding shape, deliberately: `get` invents no
71
- // error format (G7's own rule).
72
37
  findings: VetFinding[]
73
38
  }
74
39
 
@@ -76,10 +41,6 @@ export type QueryReport = {
76
41
  const TOP = 'top'
77
42
 
78
43
 
79
- // The nearest key at the parent of a path that named nothing, by a
80
- // plain edit distance over the sibling names — the "did you mean"
81
- // half of the no_path contract. Undefined when nothing is close
82
- // enough to be worth suggesting.
83
44
  export function nearestKey(
84
45
  want: string, have: string[]): string | undefined {
85
46
  let best: string | undefined
@@ -135,20 +96,12 @@ function pathText(path: string): string {
135
96
  }
136
97
 
137
98
 
138
- // The projection walk, exported for the direct unit tests (ADR-002,
139
- // ts/test/coverage3.test.ts): a junction member that is itself a
140
- // junction of more than one term keeps its parens, and no SOURCE
141
- // reaches that arm because norm flattens junctions at unification.
142
99
  export function projectFor(
143
100
  v: any, view: QueryView, depth: number): string {
144
101
  return project(v, view, depth)
145
102
  }
146
103
 
147
104
 
148
- // The canon-shaped views. One walk, two knobs: `types` generalises
149
- // each leaf through the lattice, `depth` elides below its level. Bags
150
- // recurse (their canon getters would render children through plain
151
- // canon, which neither knob can reach); everything else is a leaf.
152
105
  function project(v: any, view: QueryView, depth: number): string {
153
106
  if (depth <= 0) {
154
107
  return TOP
@@ -173,10 +126,6 @@ function project(v: any, view: QueryView, depth: number): string {
173
126
  keys.map((k) => project(v.peg[k], view, depth - 1)).join(',') +
174
127
  ']'
175
128
  }
176
- // Junctions and prefs are TRANSPARENT: not a structural tier (so
177
- // they do not spend a level of depth) but not a leaf either (so
178
- // `*8080|integer` generalises to `*integer|integer` rather than
179
- // collapsing to `top` and throwing the alternatives away).
180
129
  if (true === v?.isPref) {
181
130
  return '*' + project(v.peg, view, depth)
182
131
  }
@@ -188,12 +137,6 @@ function project(v: any, view: QueryView, depth: number): string {
188
137
  .join(true === v.isConjunct ? '&' : '|')
189
138
  }
190
139
 
191
- // A LEAF. Under `types` a CONCRETE scalar lifts to its own kind —
192
- // superior() is the lattice's answer, so the view subsumes the truth
193
- // by construction and not by this file's good intentions. Everything
194
- // else is already an abstraction (a kind marker, a constraint, an
195
- // unresolved reference) and is left alone: lifting `integer` to
196
- // `number` would generalise a shape view that was already a shape.
197
140
  return 'types' === view && true === v?.isScalar ? v.superior().canon : v.canon
198
141
  }
199
142
 
@@ -227,17 +170,7 @@ function finding(
227
170
  }
228
171
 
229
172
 
230
- // A document that does not stand up has no node to select. The
231
- // engine's own first error IS the report: the query surface adds
232
- // nothing to a diagnosis the evaluator already made. The path is the
233
- // DOCUMENT — what failed is the whole thing standing up, not the node
234
- // the caller asked about, which may never have existed.
235
173
  export function evalFailure(ctx: any): VetFinding {
236
- // ctx.err is never empty at a call site: every failure that reaches
237
- // one collected an error first — a parse that did not stand up, a
238
- // root that came back nil. Not coalesced, on the vet siteOf
239
- // precedent: an impossible state should fail loudly rather than be
240
- // quietly papered over with a made-up code.
241
174
  const err: any = ctx.err[0]
242
175
  return finding(err.why, '$', err.msg)
243
176
  }
@@ -292,12 +225,6 @@ export function get(
292
225
  }
293
226
 
294
227
  if ('json' === view) {
295
- // GENERATION CAN FAIL WHERE UNIFICATION DID NOT: `k: integer` is a
296
- // perfectly good unified document and not a concrete value, so the
297
- // json view of it is an error, exactly as `aontu file.aon` on the
298
- // same document is. Under `collect` the failure lands on the
299
- // context rather than throwing, so it has to be read back — the Go
300
- // port's Gen returns it as an error and the two must agree.
301
228
  const before = ctx.err.length
302
229
  const gen = node.gen(ctx)
303
230
  if (before < ctx.err.length) {
@@ -331,13 +258,6 @@ export type WhyReport = {
331
258
  }
332
259
 
333
260
 
334
- // WHY does the value at this path hold? Evaluate with the provenance
335
- // recorder on, select the node, and answer the ordered contributions
336
- // that met there — the positive twin of G2's error report.
337
- //
338
- // Two evaluations are NOT needed: the recorder rides the one run this
339
- // call makes. What it costs is site materialisation and one map entry
340
- // per path met, which an instrumented run pays knowingly.
341
261
  export function why(
342
262
  src: string, path: string, opts?: QueryOptions): WhyReport {
343
263
  const options = opts ?? {}
@@ -346,10 +266,6 @@ export function why(
346
266
  const ctx = aontu.ctx({ collect: true, prov })
347
267
  const parseOpts = null == options.path ? undefined : { path: options.path }
348
268
 
349
- // Parse and unify SEPARATELY, so the parsed tree can be stamped
350
- // before the fixpoint runs: a contribution is a value the author
351
- // wrote, and after unification there is no longer any way to tell
352
- // one from a value the engine minted on the way.
353
269
  const parsed: any = aontu.parse(src, parseOpts, ctx)
354
270
  if (0 < ctx.err.length || null == parsed) {
355
271
  return { ok: false, findings: [evalFailure(ctx)] }
package/src/reach.ts CHANGED
@@ -1,33 +1,6 @@
1
1
  /* Copyright (c) 2025 Richard Rodger, MIT License */
2
2
  import { includeOpts } from './utility'
3
3
 
4
- // REACHABILITY OVER THE LINK GRAPH (the review's finding J,
5
- // use-cases/REVIEW.md): "ship a transitive `reaches(a, b)` check verb".
6
- //
7
- // `relations` answers questions about the edge set as a whole --- is it
8
- // acyclic, does every edge have its inverse, is every far end what the
9
- // relation says it is. This answers the question that needs the CLOSURE
10
- // rather than the edges: does anything `a` depends on, at any remove,
11
- // end up at `b`? That is the shape of every blast-radius question an
12
- // operator asks ("if the billing database goes, what falls over?") and
13
- // every containment question a policy asks ("nothing in the public tier
14
- // may reach the ledger"), and neither can be expressed by looking one
15
- // edge at a time.
16
- //
17
- // It is a VERB and not a constraint, for the same reason acyclicity is
18
- // (docs/reference-language.md, "Declared relations"): reachability is
19
- // global and non-monotone. One more edge can make an unreachable pair
20
- // reachable, so a lattice citizen asserting non-reachability could be
21
- // true and then false, and the lattice guarantee is that more
22
- // information never falsifies what has already been observed.
23
- //
24
- // TRANSITIVE, NOT REFLEXIVE-TRANSITIVE: `reaches(a, a)` is true only
25
- // when a path of one or more edges returns to `a`, which is the useful
26
- // answer (it says the graph has a cycle through `a`) rather than the
27
- // vacuous one.
28
- //
29
- // The Go twin is go/reach.go; what the two ports must agree on --- the
30
- // verdict and the path --- is test/spec/reach.tsv.
31
4
 
32
5
  import { Aontu } from './aontu'
33
6
  import { failureFinding } from './vet'
@@ -42,15 +15,8 @@ export type ReachVerdict = 'reaches' | 'unreachable' | 'error'
42
15
  export type ReachReport = {
43
16
  verdict: ReachVerdict
44
17
 
45
- // The path found, as `$.dotted` node paths from the source to the
46
- // destination, both included. Present ONLY on `reaches`: a path is
47
- // the evidence for the answer, and there is no evidence for a
48
- // negative one.
49
18
  path?: string[]
50
19
 
51
- // WHY the graph could not be looked at, in vet's finding shape (the
52
- // review's finding F): a document that does not stand up, or an
53
- // endpoint that names no node. Present ONLY on `error`.
54
20
  errors?: VetFinding[]
55
21
  }
56
22
 
@@ -62,9 +28,6 @@ export type ReachOptions = {
62
28
  // docs/trust.md).
63
29
  trust?: TrustOptions
64
30
 
65
- // Extensions additionally read as text (the CLI's `--text-ext`).
66
- // Rides beside `trust` because it is the other half of what an
67
- // include may read.
68
31
  textExt?: string[]
69
32
  // Follow only edges under this relation. Absent means follow every
70
33
  // edge, which is the whole graph and the commoner question.
@@ -72,10 +35,6 @@ export type ReachOptions = {
72
35
  }
73
36
 
74
37
 
75
- // The segments a `$.dotted` endpoint spells, or undefined when it is
76
- // not one. Reachability is between TREE POSITIONS (ADR-014), so an
77
- // endpoint is a path and nothing else --- the same spelling the report
78
- // prints back.
79
38
  export function parseNodePath(s: string): string[] | undefined {
80
39
  if ('$' === s) {
81
40
  return []
@@ -88,9 +47,6 @@ export function parseNodePath(s: string): string[] | undefined {
88
47
  }
89
48
 
90
49
 
91
- // Whether a path names a node of the evaluated tree. An endpoint that
92
- // exists but has no edges is a perfectly good question with the answer
93
- // `unreachable`; only one that names NOTHING is an error.
94
50
  function nodeAt(root: any, path: string[]): boolean {
95
51
  let node: any = root
96
52
  for (const seg of path) {
@@ -112,10 +68,6 @@ function endpointFinding(name: string, known: string[]): VetFinding {
112
68
  class: 'reference',
113
69
  severity: 'error',
114
70
  path: '$',
115
- // NOT "unreachable". An endpoint that names no node is a question
116
- // the document cannot answer, and answering it `no` would report a
117
- // typo as a fact about the model --- the fail-open shape this
118
- // review exists to retire.
119
71
  message: `${name} names no node in this document.`,
120
72
  sites: [],
121
73
  ...(0 === known.length ? {} : {
@@ -182,11 +134,6 @@ export function reachCheck(
182
134
  list.sort(cmpCodePoint)
183
135
  }
184
136
 
185
- // BREADTH-FIRST, so the path reported is a SHORTEST one --- the
186
- // evidence an operator wants is the tightest chain, not whichever the
187
- // walk happened to find first --- and, with the successors sorted, a
188
- // determined one: among shortest paths, the first in code-point order
189
- // at the first step that distinguishes them.
190
137
  const prev = new Map<string, string>()
191
138
  const seen = new Set<string>()
192
139
  let front: string[] = [from]
package/src/relation.ts CHANGED
@@ -1,29 +1,6 @@
1
1
  /* Copyright (c) 2025 Richard Rodger, MIT License */
2
2
  import { includeOpts } from './utility'
3
3
 
4
- // RELATION GRAPH VERDICTS (RELATIONS.0.md §3.3, replacing the G4
5
- // phase 5 magic-key pass): acyclicity and inverse consistency over
6
- // the edge set, DECLARED by the graph atoms -- `acyclic()` and
7
- // `inverse(name)` conjoined at the field whose key is the predicate
8
- // -- and decided AFTER unification, never by it.
9
- //
10
- // Why not in the lattice. Both properties are GLOBAL and NON-MONOTONE:
11
- // an acyclic graph becomes cyclic when one more edge unifies in, and an
12
- // inverse that is present becomes absent when the far side is narrowed.
13
- // The lattice guarantee is that more information never falsifies what
14
- // has been observed, so a constraint that could be true and then false
15
- // is not a constraint the lattice may hold. These are facts about the
16
- // finished model, so the atoms only REGISTER during unification
17
- // (GraphAtomVal.register, onto ctx._reldecls), and the verdict lands
18
- // at GENERATION -- the sizing atoms' model -- where no more
19
- // information can arrive. The `relations` verb reports the same
20
- // verdict from the same declarations: one decision, two surfaces.
21
- //
22
- // The old declaration channel -- a `relations:` key at the document
23
- // root, read by name -- is GONE, discharging ADR-010's grandfather
24
- // clause: the engine no longer knows any spellable key. The target
25
- // half of the old declaration is `rel(t)`'s flow at the site, which
26
- // checks by unifying rather than by a report-layer probe.
27
4
 
28
5
  import { Aontu } from './aontu'
29
6
  import { failureFinding } from './vet'
@@ -40,13 +17,9 @@ export type RelationVerdict = 'pass' | 'fail' | 'error'
40
17
 
41
18
  export type RelationFinding = {
42
19
  code: string
43
- // The relation the finding is about.
44
20
  relation: string
45
21
  // Where the offending edge is written, as a `$.dotted.path`.
46
22
  at: string
47
- // For a cycle, the node paths it runs through, in the order the walk
48
- // found them, closing back on the first. For a missing inverse, the
49
- // two ends and the relation that should have mirrored it.
50
23
  detail: string[]
51
24
  }
52
25
 
@@ -54,18 +27,8 @@ export type RelationReport = {
54
27
  verdict: RelationVerdict
55
28
  findings: RelationFinding[]
56
29
 
57
- // WHY the graph could not be looked at, in the same finding shape
58
- // vet reports in (the review's finding F). `findings` is about the
59
- // GRAPH and stays that way; a document that does not stand up has no
60
- // graph to have findings about, and an `error` verdict used to
61
- // arrive with an empty list -- something is wrong, and nothing about
62
- // what. Present ONLY on an `error` verdict.
63
30
  errors?: VetFinding[]
64
31
 
65
- // How many relation declarations the document makes (G11 phase 4).
66
- // ZERO is the answer that matters: `pass` over no declarations means
67
- // nothing was checked, and without this the two are one word.
68
- // Absent unless the run asked for it (`RelationOptions.count`).
69
32
  declared?: number
70
33
  }
71
34
 
@@ -73,9 +36,6 @@ export type RelationOptions = {
73
36
  // Where the document CAME FROM, so a relative `@"file"` load inside
74
37
  // it resolves from its own directory (trimCheck's precedent).
75
38
  path?: string
76
- // The include capability this document evaluates under (G5,
77
- // docs/trust.md). vet's precedent: the verb passes the profile the
78
- // caller asked for, and an absent option means today's default.
79
39
  trust?: TrustOptions
80
40
 
81
41
  // Extensions additionally read as text (the CLI's `--text-ext`).
@@ -83,20 +43,10 @@ export type RelationOptions = {
83
43
  // include may read.
84
44
  textExt?: string[]
85
45
 
86
- // Count the relation declarations the document makes (G11 phase 4),
87
- // so a caller can tell a graph that CHECKED CLEAN from one there was
88
- // nothing to check. `pass` is the same word for both, which is the
89
- // whole reason this exists. Absent from the report unless asked for,
90
- // so no existing caller's report changes shape -- `vet --coverage`
91
- // sets the precedent.
92
46
  count?: boolean
93
47
  }
94
48
 
95
49
 
96
- // The first cycle reachable from `start`, as the node paths it runs
97
- // through, or undefined. Depth-first with the path as the stack, and
98
- // the successors visited in sorted order, so the cycle a report names
99
- // is the same one in both ports.
100
50
  function findCycle(
101
51
  start: string,
102
52
  succ: Map<string, string[]>,
@@ -130,16 +80,11 @@ function findCycle(
130
80
  }
131
81
 
132
82
 
133
- // The verdict itself, pure over what the evaluation produced: the
134
- // registered declarations and the edge set. Shared by the generation
135
- // hook (relationErrors) and the `relations` verb, so the two surfaces
136
- // cannot disagree.
137
83
  export function relationFindings(
138
84
  decls: Map<string, RelDecl>, graph: Graph
139
85
  ): RelationFinding[] {
140
86
  const findings: RelationFinding[] = []
141
87
 
142
- // The edge set, indexed the two ways the checks read it.
143
88
  const byRelation = new Map<string, Edge[]>()
144
89
  const pairs = new Set<string>()
145
90
  for (const e of graph.edges) {
@@ -215,11 +160,6 @@ export function relationFindings(
215
160
  }
216
161
  }
217
162
 
218
- // SORTED, because a report is read by a machine that diffs it: by the
219
- // position the offending edge is written at, then by code, then by
220
- // the detail (two inverse declarations on one predicate can flag one
221
- // edge twice). The sort is STABLE and the predicates were iterated
222
- // in sorted order, so what order remains is fixed anyway.
223
163
  findings.sort((a, b) =>
224
164
  cmpCodePoint(a.at, b.at) || cmpCodePoint(a.code, b.code)
225
165
  || cmpCodePoint(a.detail.join(' '), b.detail.join(' ')))
@@ -228,11 +168,6 @@ export function relationFindings(
228
168
  }
229
169
 
230
170
 
231
- // The generation hook (Aontu.generate, between unification success
232
- // and value generation): each finding becomes a LOCATED evaluation
233
- // error at the offending edge, exactly as an unmet sizing atom
234
- // refuses at generation. Findings name node paths and positions the
235
- // document spelled, so the walk to the site cannot miss.
236
171
  export function relationErrors(ctx: any, root: any): void {
237
172
  const decls: Map<string, RelDecl> = ctx._reldecls
238
173
  if (0 === decls.size) {
@@ -250,11 +185,6 @@ export function relationErrors(ctx: any, root: any): void {
250
185
  }
251
186
  node = node?.peg?.[seg]
252
187
  }
253
- // No unwrap AFTER the walk: a finding's `at` names an edge
254
- // element, and an edge's element is a string -- an atom-wrapped
255
- // element mints no edge in the first place (the graph visit
256
- // descends atoms only at field values), so the walk cannot end on
257
- // an atom.
258
188
  ctx.adderr(makeNilErr(ctx, f.code, node, undefined, 'relate', {
259
189
  relation: f.relation,
260
190
  detail: f.detail.join(' -> '),
@@ -285,25 +215,11 @@ export function relationCheck(
285
215
  }
286
216
 
287
217
  const decls: Map<string, RelDecl> = (ctx as any)._reldecls
288
- // The count rides every report from here down: the engine knows it
289
- // at exactly this point, and a caller asking "was there anything to
290
- // check?" should not have to evaluate the document a second time to
291
- // find out.
292
218
  const counted = true === options.count ? { declared: decls.size } : {}
293
219
  if (0 === decls.size) {
294
220
  return { verdict: 'pass', findings: [], ...counted }
295
221
  }
296
222
 
297
- // NOR IS A DOCUMENT THAT CANNOT BE GENERATED. Unification can
298
- // succeed over a tree that still holds an unsettled disjunction --
299
- // more than one alternative admitted, which `disjunct_no_gen`
300
- // refuses at generation -- and the graph walk cannot read inside
301
- // one: the links in every alternative are invisible, so a mirror
302
- // the document plainly writes is missing from the edge set and
303
- // `inverse(n)` calls it missing. Generation is therefore asked
304
- // FIRST, on a collecting context of its own, and what it says is
305
- // the answer. Generation is what the atoms' verdict lands at, so
306
- // this is the same order the engine itself now runs in.
307
223
  const gctx = ctx.clone({ err: [], collect: true })
308
224
  root.gen(gctx)
309
225
  if (0 < gctx.err.length) {