aontu 0.62.0 → 0.64.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 (373) hide show
  1. package/README.md +7 -7
  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 +3 -3
  8. package/dist/aontu.js +4 -84
  9. package/dist/aontu.js.map +1 -1
  10. package/dist/aontumodel.d.ts +4 -0
  11. package/dist/aontumodel.js +27 -0
  12. package/dist/aontumodel.js.map +1 -0
  13. package/dist/casing.d.ts +5 -0
  14. package/dist/casing.js +90 -0
  15. package/dist/casing.js.map +1 -0
  16. package/dist/cli.d.ts +2 -2
  17. package/dist/cli.js +228 -935
  18. package/dist/cli.js.map +1 -1
  19. package/dist/ctx.js +0 -48
  20. package/dist/ctx.js.map +1 -1
  21. package/dist/diff.js +0 -32
  22. package/dist/diff.js.map +1 -1
  23. package/dist/err.js +0 -40
  24. package/dist/err.js.map +1 -1
  25. package/dist/escape.js +0 -45
  26. package/dist/escape.js.map +1 -1
  27. package/dist/exactjson.d.ts +0 -35
  28. package/dist/exactjson.js +0 -131
  29. package/dist/exactjson.js.map +1 -1
  30. package/dist/format.js +13 -203
  31. package/dist/format.js.map +1 -1
  32. package/dist/grammar.d.ts +9 -0
  33. package/dist/grammar.js +54 -0
  34. package/dist/grammar.js.map +1 -0
  35. package/dist/graph.js +0 -26
  36. package/dist/graph.js.map +1 -1
  37. package/dist/hcanon.js +0 -82
  38. package/dist/hcanon.js.map +1 -1
  39. package/dist/helpdoc.js +2 -2
  40. package/dist/helpdoc.js.map +1 -1
  41. package/dist/hints.d.ts +0 -6
  42. package/dist/hints.js +57 -55
  43. package/dist/hints.js.map +1 -1
  44. package/dist/jsonschema.js +0 -114
  45. package/dist/jsonschema.js.map +1 -1
  46. package/dist/keyorder.d.ts +0 -7
  47. package/dist/keyorder.js +0 -41
  48. package/dist/keyorder.js.map +1 -1
  49. package/dist/lang.js +17 -915
  50. package/dist/lang.js.map +1 -1
  51. package/dist/lsp-server.js +0 -16
  52. package/dist/lsp-server.js.map +1 -1
  53. package/dist/lsp.d.ts +1 -1
  54. package/dist/lsp.js +12 -159
  55. package/dist/lsp.js.map +1 -1
  56. package/dist/mcp-server.js +0 -26
  57. package/dist/mcp-server.js.map +1 -1
  58. package/dist/mcp.js +0 -149
  59. package/dist/mcp.js.map +1 -1
  60. package/dist/mod-tool.js +16 -131
  61. package/dist/mod-tool.js.map +1 -1
  62. package/dist/mod.js +0 -162
  63. package/dist/mod.js.map +1 -1
  64. package/dist/patch.js +0 -217
  65. package/dist/patch.js.map +1 -1
  66. package/dist/profile.d.ts +9 -0
  67. package/dist/profile.js +28 -0
  68. package/dist/profile.js.map +1 -0
  69. package/dist/provenance.js +0 -140
  70. package/dist/provenance.js.map +1 -1
  71. package/dist/query.js +0 -75
  72. package/dist/query.js.map +1 -1
  73. package/dist/reach.js +0 -43
  74. package/dist/reach.js.map +1 -1
  75. package/dist/relation.js +0 -61
  76. package/dist/relation.js.map +1 -1
  77. package/dist/report-sarif.d.ts +0 -11
  78. package/dist/report-sarif.js +0 -28
  79. package/dist/report-sarif.js.map +1 -1
  80. package/dist/sig.js +0 -35
  81. package/dist/sig.js.map +1 -1
  82. package/dist/sigdecl.js +1 -1
  83. package/dist/sigdecl.js.map +1 -1
  84. package/dist/siggate.js +0 -4
  85. package/dist/siggate.js.map +1 -1
  86. package/dist/site.js +3 -29
  87. package/dist/site.js.map +1 -1
  88. package/dist/subsume.d.ts +0 -10
  89. package/dist/subsume.js +0 -137
  90. package/dist/subsume.js.map +1 -1
  91. package/dist/template.d.ts +2 -1
  92. package/dist/template.js +58 -138
  93. package/dist/template.js.map +1 -1
  94. package/dist/trace.d.ts +21 -0
  95. package/dist/trace.js +107 -0
  96. package/dist/trace.js.map +1 -0
  97. package/dist/trim.js +0 -41
  98. package/dist/trim.js.map +1 -1
  99. package/dist/tsconfig.tsbuildinfo +1 -1
  100. package/dist/type.js.map +1 -1
  101. package/dist/unify.js +13 -248
  102. package/dist/unify.js.map +1 -1
  103. package/dist/utility.js +0 -22
  104. package/dist/utility.js.map +1 -1
  105. package/dist/val/AbnfFuncVal.d.ts +18 -0
  106. package/dist/val/AbnfFuncVal.js +132 -0
  107. package/dist/val/AbnfFuncVal.js.map +1 -0
  108. package/dist/val/AbsentVal.d.ts +11 -0
  109. package/dist/val/AbsentVal.js +30 -0
  110. package/dist/val/AbsentVal.js.map +1 -0
  111. package/dist/val/AggFuncVal.d.ts +10 -1
  112. package/dist/val/AggFuncVal.js +104 -116
  113. package/dist/val/AggFuncVal.js.map +1 -1
  114. package/dist/val/ArithFuncVal.js +0 -12
  115. package/dist/val/ArithFuncVal.js.map +1 -1
  116. package/dist/val/BagVal.js +1 -78
  117. package/dist/val/BagVal.js.map +1 -1
  118. package/dist/val/BigDecimalVal.js +0 -16
  119. package/dist/val/BigDecimalVal.js.map +1 -1
  120. package/dist/val/BigIntegerVal.js +0 -16
  121. package/dist/val/BigIntegerVal.js.map +1 -1
  122. package/dist/val/CloseFuncVal.js +0 -9
  123. package/dist/val/CloseFuncVal.js.map +1 -1
  124. package/dist/val/CmpFuncVal.d.ts +2 -0
  125. package/dist/val/CmpFuncVal.js +49 -72
  126. package/dist/val/CmpFuncVal.js.map +1 -1
  127. package/dist/val/ConjunctVal.js +0 -29
  128. package/dist/val/ConjunctVal.js.map +1 -1
  129. package/dist/val/ConstraintVal.js +0 -500
  130. package/dist/val/ConstraintVal.js.map +1 -1
  131. package/dist/val/ContainerKindVal.js +0 -2
  132. package/dist/val/ContainerKindVal.js.map +1 -1
  133. package/dist/val/CopyFuncVal.js +0 -3
  134. package/dist/val/CopyFuncVal.js.map +1 -1
  135. package/dist/val/Decimal.js +0 -179
  136. package/dist/val/Decimal.js.map +1 -1
  137. package/dist/val/DeprecateFuncVal.js.map +1 -1
  138. package/dist/val/DisjunctVal.js +0 -152
  139. package/dist/val/DisjunctVal.js.map +1 -1
  140. package/dist/val/EachFuncVal.js +0 -3
  141. package/dist/val/EachFuncVal.js.map +1 -1
  142. package/dist/val/EmitFuncVal.d.ts +1 -1
  143. package/dist/val/EmitFuncVal.js +6 -119
  144. package/dist/val/EmitFuncVal.js.map +1 -1
  145. package/dist/val/ExpectVal.js +0 -62
  146. package/dist/val/ExpectVal.js.map +1 -1
  147. package/dist/val/FilterFuncVal.js +0 -25
  148. package/dist/val/FilterFuncVal.js.map +1 -1
  149. package/dist/val/FuncBaseVal.d.ts +1 -0
  150. package/dist/val/FuncBaseVal.js +7 -127
  151. package/dist/val/FuncBaseVal.js.map +1 -1
  152. package/dist/val/GraphAtomVal.js +0 -15
  153. package/dist/val/GraphAtomVal.js.map +1 -1
  154. package/dist/val/HideFuncVal.js +0 -13
  155. package/dist/val/HideFuncVal.js.map +1 -1
  156. package/dist/val/IntegerVal.js +0 -61
  157. package/dist/val/IntegerVal.js.map +1 -1
  158. package/dist/val/JunctionVal.js +0 -20
  159. package/dist/val/JunctionVal.js.map +1 -1
  160. package/dist/val/KeyFuncVal.js +0 -46
  161. package/dist/val/KeyFuncVal.js.map +1 -1
  162. package/dist/val/ListVal.js +0 -57
  163. package/dist/val/ListVal.js.map +1 -1
  164. package/dist/val/LowerFuncVal.js +0 -11
  165. package/dist/val/LowerFuncVal.js.map +1 -1
  166. package/dist/val/MapVal.js +0 -151
  167. package/dist/val/MapVal.js.map +1 -1
  168. package/dist/val/MatchFuncVal.js +0 -27
  169. package/dist/val/MatchFuncVal.js.map +1 -1
  170. package/dist/val/{FormFuncVal.d.ts → MaybeFuncVal.d.ts} +5 -5
  171. package/dist/val/MaybeFuncVal.js +50 -0
  172. package/dist/val/MaybeFuncVal.js.map +1 -0
  173. package/dist/val/MoveFuncVal.js +0 -18
  174. package/dist/val/MoveFuncVal.js.map +1 -1
  175. package/dist/val/NilVal.js +0 -60
  176. package/dist/val/NilVal.js.map +1 -1
  177. package/dist/val/NomFuncVal.js +18 -54
  178. package/dist/val/NomFuncVal.js.map +1 -1
  179. package/dist/val/NumberVal.js +0 -15
  180. package/dist/val/NumberVal.js.map +1 -1
  181. package/dist/val/OpBaseVal.d.ts +1 -0
  182. package/dist/val/OpBaseVal.js +3 -15
  183. package/dist/val/OpBaseVal.js.map +1 -1
  184. package/dist/val/PackFuncVal.js +0 -34
  185. package/dist/val/PackFuncVal.js.map +1 -1
  186. package/dist/val/PathFuncVal.js +0 -6
  187. package/dist/val/PathFuncVal.js.map +1 -1
  188. package/dist/val/PathVal.js +0 -41
  189. package/dist/val/PathVal.js.map +1 -1
  190. package/dist/val/PlaceVal.js +0 -25
  191. package/dist/val/PlaceVal.js.map +1 -1
  192. package/dist/val/PlusOpVal.d.ts +1 -7
  193. package/dist/val/PlusOpVal.js +13 -74
  194. package/dist/val/PlusOpVal.js.map +1 -1
  195. package/dist/val/PrefFuncVal.js +0 -1
  196. package/dist/val/PrefFuncVal.js.map +1 -1
  197. package/dist/val/PrefVal.js +0 -167
  198. package/dist/val/PrefVal.js.map +1 -1
  199. package/dist/val/RecurseVal.js +0 -55
  200. package/dist/val/RecurseVal.js.map +1 -1
  201. package/dist/val/RefVal.js +0 -282
  202. package/dist/val/RefVal.js.map +1 -1
  203. package/dist/val/ReferFuncVal.js +3 -232
  204. package/dist/val/ReferFuncVal.js.map +1 -1
  205. package/dist/val/ScalarKindVal.js +0 -49
  206. package/dist/val/ScalarKindVal.js.map +1 -1
  207. package/dist/val/ScalarVal.js +0 -11
  208. package/dist/val/ScalarVal.js.map +1 -1
  209. package/dist/val/StrFuncVal.js +0 -18
  210. package/dist/val/StrFuncVal.js.map +1 -1
  211. package/dist/val/SuperFuncVal.js +0 -32
  212. package/dist/val/SuperFuncVal.js.map +1 -1
  213. package/dist/val/TopVal.js +0 -1
  214. package/dist/val/TopVal.js.map +1 -1
  215. package/dist/val/TranslateFuncVal.js +1 -3
  216. package/dist/val/TranslateFuncVal.js.map +1 -1
  217. package/dist/val/UpperFuncVal.js +0 -11
  218. package/dist/val/UpperFuncVal.js.map +1 -1
  219. package/dist/val/Val.d.ts +1 -0
  220. package/dist/val/Val.js +2 -133
  221. package/dist/val/Val.js.map +1 -1
  222. package/dist/val/VarVal.js +0 -12
  223. package/dist/val/VarVal.js.map +1 -1
  224. package/dist/val/arith.js +0 -37
  225. package/dist/val/arith.js.map +1 -1
  226. package/dist/val/caserange.js +0 -61
  227. package/dist/val/caserange.js.map +1 -1
  228. package/dist/val/members.js +0 -6
  229. package/dist/val/members.js.map +1 -1
  230. package/dist/val/numcmp.js +0 -11
  231. package/dist/val/numcmp.js.map +1 -1
  232. package/dist/val/numkind.js +0 -145
  233. package/dist/val/numkind.js.map +1 -1
  234. package/dist/val/valutil.js +0 -16
  235. package/dist/val/valutil.js.map +1 -1
  236. package/dist/vet.js +0 -461
  237. package/dist/vet.js.map +1 -1
  238. package/dist/view.js +0 -414
  239. package/dist/view.js.map +1 -1
  240. package/dist/walk.js +0 -41
  241. package/dist/walk.js.map +1 -1
  242. package/grammar/aontu.abnf +8 -6
  243. package/grammar/aontu.gbnf +4 -4
  244. package/grammar/aontu.lark +4 -4
  245. package/grammar/aontu.tmLanguage.json +1 -1
  246. package/package.json +4 -2
  247. package/skill/tasks.md +9 -7
  248. package/src/agentsmd.ts +0 -35
  249. package/src/alias.ts +0 -39
  250. package/src/allow.ts +1 -96
  251. package/src/aontu.ts +4 -116
  252. package/src/aontumodel.ts +26 -0
  253. package/src/casing.ts +95 -0
  254. package/src/cli.ts +258 -1024
  255. package/src/ctx.ts +0 -103
  256. package/src/diff.ts +0 -40
  257. package/src/err.ts +0 -40
  258. package/src/escape.ts +0 -46
  259. package/src/exactjson.ts +0 -131
  260. package/src/format.ts +14 -257
  261. package/src/grammar.ts +72 -0
  262. package/src/graph.ts +0 -61
  263. package/src/hcanon.ts +0 -82
  264. package/src/helpdoc.ts +2 -2
  265. package/src/hints.ts +69 -57
  266. package/src/jsonschema.ts +0 -123
  267. package/src/keyorder.ts +0 -42
  268. package/src/lang.ts +19 -931
  269. package/src/lsp-server.ts +0 -16
  270. package/src/lsp.ts +12 -180
  271. package/src/mcp-server.ts +0 -31
  272. package/src/mcp.ts +0 -169
  273. package/src/mod-tool.ts +18 -159
  274. package/src/mod.ts +0 -178
  275. package/src/patch.ts +0 -232
  276. package/src/profile.ts +42 -0
  277. package/src/provenance.ts +0 -183
  278. package/src/query.ts +0 -84
  279. package/src/reach.ts +0 -53
  280. package/src/relation.ts +0 -84
  281. package/src/report-sarif.ts +0 -48
  282. package/src/sig.ts +0 -35
  283. package/src/sigdecl.ts +1 -1
  284. package/src/siggate.ts +0 -30
  285. package/src/site.ts +3 -29
  286. package/src/subsume.ts +1 -161
  287. package/src/template.ts +69 -140
  288. package/src/trace.ts +157 -0
  289. package/src/trim.ts +0 -53
  290. package/src/type.ts +2 -45
  291. package/src/unify.ts +14 -257
  292. package/src/utility.ts +0 -31
  293. package/src/val/AbnfFuncVal.ts +181 -0
  294. package/src/val/AbsentVal.ts +54 -0
  295. package/src/val/AggFuncVal.ts +152 -188
  296. package/src/val/ArithFuncVal.ts +0 -20
  297. package/src/val/BagVal.ts +1 -78
  298. package/src/val/BigDecimalVal.ts +0 -16
  299. package/src/val/BigIntegerVal.ts +0 -16
  300. package/src/val/CloseFuncVal.ts +0 -9
  301. package/src/val/CmpFuncVal.ts +68 -184
  302. package/src/val/ConjunctVal.ts +0 -33
  303. package/src/val/ConstraintVal.ts +2 -537
  304. package/src/val/ContainerKindVal.ts +0 -18
  305. package/src/val/CopyFuncVal.ts +0 -5
  306. package/src/val/Decimal.ts +1 -185
  307. package/src/val/DeprecateFuncVal.ts +0 -10
  308. package/src/val/DisjunctVal.ts +0 -157
  309. package/src/val/EachFuncVal.ts +0 -40
  310. package/src/val/EmitFuncVal.ts +8 -208
  311. package/src/val/ExpectVal.ts +0 -62
  312. package/src/val/FilterFuncVal.ts +0 -55
  313. package/src/val/FuncBaseVal.ts +9 -130
  314. package/src/val/GraphAtomVal.ts +0 -42
  315. package/src/val/HideFuncVal.ts +0 -15
  316. package/src/val/IntegerVal.ts +0 -61
  317. package/src/val/JunctionVal.ts +0 -20
  318. package/src/val/KeyFuncVal.ts +0 -48
  319. package/src/val/ListVal.ts +0 -59
  320. package/src/val/LowerFuncVal.ts +0 -12
  321. package/src/val/MapVal.ts +0 -151
  322. package/src/val/MatchFuncVal.ts +0 -59
  323. package/src/val/MaybeFuncVal.ts +86 -0
  324. package/src/val/MoveFuncVal.ts +0 -20
  325. package/src/val/NilVal.ts +0 -60
  326. package/src/val/NomFuncVal.ts +10 -99
  327. package/src/val/NumberVal.ts +0 -16
  328. package/src/val/OpBaseVal.ts +4 -17
  329. package/src/val/PackFuncVal.ts +0 -63
  330. package/src/val/PathFuncVal.ts +0 -32
  331. package/src/val/PathVal.ts +0 -66
  332. package/src/val/PlaceVal.ts +0 -45
  333. package/src/val/PlusOpVal.ts +18 -75
  334. package/src/val/PrefFuncVal.ts +0 -1
  335. package/src/val/PrefVal.ts +0 -179
  336. package/src/val/RecurseVal.ts +0 -81
  337. package/src/val/RefVal.ts +1 -285
  338. package/src/val/ReferFuncVal.ts +4 -255
  339. package/src/val/ScalarKindVal.ts +0 -50
  340. package/src/val/ScalarVal.ts +0 -12
  341. package/src/val/StrFuncVal.ts +0 -44
  342. package/src/val/SuperFuncVal.ts +0 -42
  343. package/src/val/TopVal.ts +0 -1
  344. package/src/val/TranslateFuncVal.ts +1 -51
  345. package/src/val/UpperFuncVal.ts +0 -12
  346. package/src/val/Val.ts +3 -192
  347. package/src/val/VarVal.ts +0 -15
  348. package/src/val/arith.ts +0 -92
  349. package/src/val/caserange.ts +0 -62
  350. package/src/val/members.ts +0 -23
  351. package/src/val/numcmp.ts +1 -27
  352. package/src/val/numkind.ts +0 -149
  353. package/src/val/valutil.ts +0 -16
  354. package/src/vet.ts +1 -582
  355. package/src/view.ts +0 -507
  356. package/src/walk.ts +0 -41
  357. package/dist/lower.d.ts +0 -23
  358. package/dist/lower.js +0 -578
  359. package/dist/lower.js.map +0 -1
  360. package/dist/render.d.ts +0 -53
  361. package/dist/render.js +0 -547
  362. package/dist/render.js.map +0 -1
  363. package/dist/std.d.ts +0 -3
  364. package/dist/std.js +0 -672
  365. package/dist/std.js.map +0 -1
  366. package/dist/val/FormFuncVal.js +0 -55
  367. package/dist/val/FormFuncVal.js.map +0 -1
  368. package/dist/val/NamerFuncVal.d.ts +0 -12
  369. package/dist/val/NamerFuncVal.js +0 -176
  370. package/dist/val/NamerFuncVal.js.map +0 -1
  371. package/src/lower.ts +0 -636
  372. package/src/render.ts +0 -732
  373. 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) {
@@ -1,25 +1,5 @@
1
1
  /* Copyright (c) 2025 Richard Rodger, MIT License */
2
2
 
3
- // SARIF rendering for a vet report (G2 phase 5,
4
- // docs/capability-review/g2-validation-verb.md).
5
- //
6
- // A MINIMAL SARIF 2.1.0 profile, and deliberately nothing more: one
7
- // run, one `result` per finding, the finding's first site as the
8
- // primary location, its remaining sites under `relatedLocations`, and
9
- // the whole finding object embedded in `properties` so a SARIF consumer
10
- // still holds the native contract. No fixes, no code flows, no
11
- // baselines — the JSON report is the native contract, SARIF is the
12
- // interchange skin CI systems already ingest (GitHub code scanning
13
- // uploads, PR annotation).
14
- //
15
- // This is library API, not CLI plumbing, for the same reason the vet
16
- // engine is: an embedder (and G7's MCP server later) must be able to
17
- // emit the interchange form without shelling out. The Go twin is
18
- // go/report_sarif.go, and the two are held to byte parity over the
19
- // shared fixture pair in test/spec/files/vet-sarif/ — with the message
20
- // text and producer version redacted, exactly as test/spec/vet.tsv
21
- // carves the message out of its goldens, because prose and the two
22
- // independent version series are deliberately not in cross-port parity.
23
3
 
24
4
  import type { VetReport, VetFinding, VetSite } from './vet'
25
5
 
@@ -37,13 +17,6 @@ const SARIF_LEVEL: Record<string, string> = {
37
17
  }
38
18
 
39
19
 
40
- // A site's file is a filesystem path, and a SARIF artifactLocation.uri
41
- // is a URI reference: `#`, `%`, spaces and every other URI-significant
42
- // character must be percent-encoded or a consumer parses the path as
43
- // something else (text after `#` becomes a fragment). Encoded BY BYTE
44
- // over UTF-8, with RFC 3986's unreserved and path characters kept
45
- // literal, so the Go twin produces identical bytes from an identical
46
- // loop (go/report_sarif.go sarifURI).
47
20
  function sarifUri(path: string): string {
48
21
  const bytes = Buffer.from(path, 'utf8')
49
22
  let out = ''
@@ -75,11 +48,6 @@ function sarifLocation(site: VetSite): any {
75
48
 
76
49
 
77
50
  function sarifResult(finding: VetFinding): any {
78
- // The engine orders sites data-first (the thing to fix), so the first
79
- // site is the primary location and the rest are related — which for a
80
- // two-site conflict puts the schema's declaration under
81
- // `relatedLocations`, exactly where a code-scanning UI shows "the
82
- // other side".
83
51
  const result: any = {
84
52
  level: SARIF_LEVEL[finding.severity],
85
53
  locations: [sarifLocation(finding.sites[0])],
@@ -95,26 +63,10 @@ function sarifResult(finding: VetFinding): any {
95
63
  }
96
64
 
97
65
 
98
- /**
99
- * Render a vet report as SARIF 2.1.0 text (a minimal profile: one run,
100
- * one result per finding, the finding embedded in `properties`).
101
- *
102
- * @param report A report from `vet()`.
103
- * @param version The producer version for `tool.driver.version` —
104
- * the CLI passes its package version; the two ports'
105
- * version series are independent by design.
106
- * @returns The SARIF JSON text, indented two spaces, keys in
107
- * the canonical emitter's sorted order.
108
- */
109
66
  function sarifReport(report: VetReport, version: string): string {
110
67
  return exactJSON({
111
68
  $schema: 'https://json.schemastore.org/sarif-2.1.0.json',
112
69
  runs: [{
113
- // An `error` verdict means the run could not be set up (an
114
- // unusable schema): zero findings from a FAILED run must not
115
- // read like zero findings from a clean one, so the failure is
116
- // carried in SARIF's own invocation metadata rather than by an
117
- // indistinguishable empty result list.
118
70
  invocations: [{
119
71
  executionSuccessful: 'error' !== report.verdict,
120
72
  }],
package/src/sig.ts CHANGED
@@ -1,29 +1,5 @@
1
1
  /* Copyright (c) 2021-2026 Richard Rodger, MIT License */
2
2
 
3
- // THE SIGNATURE REGISTRY (docs/design/SIGNATURES.0.md). The call
4
- // surface of the built-in functions is DECLARED, in the signature
5
- // syntax itself, in test/spec/signature.tsv; this module is the
6
- // TypeScript half of the pair that reads it. The declaration text is
7
- // inlined at build time (ts/src/sigdecl.ts, `make sig`) and parsed at
8
- // initialisation by the signature grammar -- a custom tabnas grammar,
9
- // the same engine the aontu grammar itself is built on -- into the
10
- // registry the runtime signature checker, the error-message builder,
11
- // the docs table and the LSP all consume. Neither port authors a
12
- // table: go/sig.go parses the same text with the same grammar, and
13
- // the shared suite round-trips every line (render(parse(line)) is the
14
- // line) so the two parsers cannot drift.
15
- //
16
- // line = name '(' [ arg {',' arg} ] ')' ':' type
17
- // arg = [mode] name ['?'] ':' type
18
- // | '...' name ':' ( type | '(' [mode] type {',' [mode] type} ')' )
19
- // type = word {'|' word}
20
- // mode = 'capture' | 'template' | 'trial' | 'projector' | 'text'
21
- //
22
- // `value` mode is unmarked; the five marked modes are the vocabulary
23
- // plain pseudo-TypeScript cannot say (a captured spelling is not a
24
- // string value). The grammar is line-oriented: the loader strips
25
- // comment and blank lines and parses each declaration line alone, so
26
- // the grammar never sees line structure.
27
3
 
28
4
  import { Tabnas } from '@tabnas/parser'
29
5
 
@@ -59,11 +35,6 @@ const ARG_MODES: Record<string, boolean> = {
59
35
  }
60
36
 
61
37
 
62
- // The signature grammar, as a tabnas grammar plugin. Rules: sig (the
63
- // line) -> args -> arg -> argtype -> type | group -> gmember. Alts
64
- // match at most two tokens, the engine's shape; lists loop the
65
- // json-grammar way (the element rule replaces itself on ',' and
66
- // backtracks the closer for its parent to consume).
67
38
  function sigGrammar(tn: any) {
68
39
  tn.options({
69
40
  fixed: {
@@ -326,12 +297,6 @@ export type {
326
297
  FuncSig,
327
298
  }
328
299
 
329
- // The parsed registry, built once from the inlined declaration -- the
330
- // one source every consumer (the arity tables, the runtime gate, the
331
- // hints, the docs table, the LSP) reads. A parse failure here throws
332
- // at module load: the inlined text is repository content whose parse
333
- // the round-trip suite gates, so a failure is a build defect, not a
334
- // runtime condition. Twin: funcSig in go/sig.go.
335
300
  const funcSig: Record<string, FuncSig> =
336
301
  parseSigText(SIGDECL) /* node:coverage ignore next 9 */
337
302
 
package/src/sigdecl.ts CHANGED
@@ -6,6 +6,6 @@
6
6
  // this copy is identical with the shared file.
7
7
 
8
8
  const SIGDECL: string =
9
- "# The call surface: one declaration line per built-in function\n# (docs/design/SIGNATURES.0.md). THIS FILE IS THE SOURCE — both ports\n# carry a build-time-inlined copy (ts/src/sigdecl.ts, go/sigdecl.txt;\n# `make sig` regenerates both, and each port's suite asserts its copy\n# is byte-identical with this file) and parse it at initialisation\n# with the signature grammar, a tabnas grammar (ts/src/sig.ts,\n# go/sig.go). The suites also round-trip every line:\n# render(parse(line)) must be the line exactly, in both ports.\n#\n# The syntax (rendered TypeScript-ish, honest about argument MODES):\n# line = name '(' [ arg {',' arg} ] ')' ':' type\n# arg = [mode] name ['?'] ':' type\n# | '...' name ':' '(' [mode] type {',' [mode] type} ')'\n# type = word {'|' word}\n# mode = 'capture' | 'template' | 'trial' | 'projector' | 'text'\n# `value` mode is unmarked. `constraint` is the result word for\n# residuals whose meet depends on the peer; `any` is the honest type\n# where a function is a wrapper.\nupper(s: string|number, start?: integer|biginteger, len?: integer|biginteger) : string\nlower(s: string|number, start?: integer|biginteger, len?: integer|biginteger) : string\ncopy(v: any) : any\npref(v: any) : any\nsuper(t: any) : any\ntype(t: any) : any\nhide(v: any) : any\nclose(m: any) : any\nopen(m: any) : any\nmove(v: any) : any\npath(capture p?: path) : path\nmap() : map\nlist() : list\nmin(n: number|string) : constraint\nmax(n: number|string) : constraint\nabove(n: number|string) : constraint\nbelow(n: number|string) : constraint\nre(text p: string) : constraint\nlength(n: number|constraint) : constraint\nkey(up?: integer|biginteger) : string\nunique(projector k?: string) : constraint\nneq(...vals: number|string) : constraint\nmust(trial c: any, text msg: string) : constraint\ndeprecate(v: any, r?: map) : any\nacyclic() : constraint\ninverse(projector k: string) : constraint\nrefer(template t?: any) : constraint\nrel(template t?: any) : constraint\npack(d: map|list, template t: any) : map\neach(d: map|list, template t: any) : list\nfilter(d: map|list, trial c: any) : map|list\nmatch(s: any, ...pr: (trial any, any), dflt?: any) : any\nadd(a: number, b: number) : number\nsub(a: number, b: number) : number\nmul(a: number, b: number) : number\ndiv(a: number, b: number) : number\nmod(a: number, b: number) : number\nrem(a: number, b: number) : number\nsum(d: map|list) : number\nleast(d: map|list) : number\ngreatest(d: map|list) : number\npick(d: map|list, projector k: string|integer) : any\njoin(d: map|list, sep?: string) : string\nesc(s: string, variant?: string) : string\nusc(s: string, variant?: string) : string\nrep(s: string, text p: string, text sub: string) : string\nsplit(s: string, sep: string|constraint) : list\nemit(s: map|list, template t: map|list) : list\n"
9
+ "# The call surface: one declaration line per built-in function\n# (docs/design/SIGNATURES.0.md). THIS FILE IS THE SOURCE — both ports\n# carry a build-time-inlined copy (ts/src/sigdecl.ts, go/sigdecl.txt;\n# `make sig` regenerates both, and each port's suite asserts its copy\n# is byte-identical with this file) and parse it at initialisation\n# with the signature grammar, a tabnas grammar (ts/src/sig.ts,\n# go/sig.go). The suites also round-trip every line:\n# render(parse(line)) must be the line exactly, in both ports.\n#\n# The syntax (rendered TypeScript-ish, honest about argument MODES):\n# line = name '(' [ arg {',' arg} ] ')' ':' type\n# arg = [mode] name ['?'] ':' type\n# | '...' name ':' '(' [mode] type {',' [mode] type} ')'\n# type = word {'|' word}\n# mode = 'capture' | 'template' | 'trial' | 'projector' | 'text'\n# `value` mode is unmarked. `constraint` is the result word for\n# residuals whose meet depends on the peer; `any` is the honest type\n# where a function is a wrapper.\nupper(s: string|number, start?: integer|biginteger, len?: integer|biginteger) : string\nlower(s: string|number, start?: integer|biginteger, len?: integer|biginteger) : string\ncopy(v: any) : any\npref(v: any) : any\nsuper(t: any) : any\ntype(t: any) : any\nhide(v: any) : any\nmaybe(v: any) : any\nclose(m: any) : any\nopen(m: any) : any\nmove(v: any) : any\npath(capture p?: path) : path\nmap() : map\nlist() : list\nmin(n: number|string) : constraint\nmax(n: number|string) : constraint\nabove(n: number|string) : constraint\nbelow(n: number|string) : constraint\nre(text p: string) : constraint\nlength(n: number|constraint) : constraint\nkey(up?: integer|biginteger) : string\nunique(projector k?: string) : constraint\nneq(...vals: number|string) : constraint\nmust(trial c: any, text msg: string) : constraint\ndeprecate(v: any, r?: map) : any\nacyclic() : constraint\ninverse(projector k: string) : constraint\nrefer(template t?: any) : constraint\nrel(template t?: any) : constraint\npack(d: map|list, template t: any) : map\neach(d: map|list, template t: any) : list\nfilter(d: map|list, trial c: any) : map|list\nmatch(s: any, ...pr: (trial any, any), dflt?: any) : any\nadd(a: number, b: number) : number\nsub(a: number, b: number) : number\nmul(a: number, b: number) : number\ndiv(a: number, b: number) : number\nmod(a: number, b: number) : number\nrem(a: number, b: number) : number\nsum(d: map|list) : number\nleast(d: map|list) : number\ngreatest(d: map|list) : number\npick(d: map|list, projector k: string|integer) : any\nsort(d: map|list, projector k?: string|integer, dir?: string) : list\njoin(d: map|list, sep?: string) : string\nesc(s: string, variant?: string) : string\nusc(s: string, variant?: string) : string\nrep(s: string, text p: string, text sub: string) : string\nsplit(s: string, sep: string|constraint) : list\nemit(s: map|list, template t: map|list) : list\nabnf(g: string) : string\nparse(g: string, v?: string) : map|list|constraint\nnom(name: string, style?: string|list, acronyms?: list) : string|map\ntranslate(s: string, from: string, to?: string) : string\nproject(spec?: string|map, children?: list) : map\nfolder(spec: string|map, children?: list) : map\nfile(spec: string|map, children?: list) : map\ncontent(spec: string|map) : map\nline(spec: string|map) : map\nfragment(spec: string|map, children?: list) : map\nslot(spec: string|map, children?: list) : map\ninject(spec: string|map, children?: list) : map\ncopyfiles(spec: string|map) : map\nlistitems(spec: map, children?: list) : map\n"
10
10
 
11
11
  export { SIGDECL }
package/src/siggate.ts CHANGED
@@ -1,31 +1,5 @@
1
1
  /* Copyright (c) 2021-2026 Richard Rodger, MIT License */
2
2
 
3
- // THE RUNTIME SIGNATURE CHECKER (docs/design/SIGNATURES.0.md). One
4
- // argument gate, run by the shared function machinery
5
- // (FuncBaseVal.unify) just before a call resolves, when its arguments
6
- // are driven: for each VALUE-mode argument whose declared type is
7
- // scalar-kind words, the driven Val must be a concrete scalar of an
8
- // admitted kind. A failure refuses as `func_arg`, whose hint renders
9
- // the signature line and names the offending argument -- the
10
- // error-message builder the registry exists for.
11
- //
12
- // The gate owns exactly the argument-shape refusals that were bare
13
- // `invalid-arg` at the call: the case family's operand, the
14
- // arithmetic operands, join's separator, pick's key. Everything with
15
- // more meaning than a shape mismatch keeps its own code: the bag
16
- // arguments (`pack_data`, `each_data`, `filter_data`,
17
- // `aggregate_data` -- container words are not gate words), the
18
- // constraint atoms (not on this path at all -- their refusals ride
19
- // the residual), `key()` (whose level meaning `key_level` names, and
20
- // which is skipped here for that reason), and the capture, template,
21
- // trial, projector and text modes, none of which are read as values.
22
- //
23
- // What the gate refuses it must POSITIVELY identify: a concrete
24
- // scalar of a wrong kind, a map, a list, or a scalar KIND marker
25
- // where a value belongs. Anything else -- a preference, a residual, a
26
- // disjunct -- passes through to the builtin's own logic, which is
27
- // what keeps arith's unpref reading and join's deferral working.
28
- // Twin: sigRefuse in go/siggate.go.
29
3
 
30
4
  import type { Val } from './type'
31
5
  import { AontuContext } from './ctx'
@@ -44,10 +18,6 @@ import {
44
18
  } from './val/ScalarKindVal'
45
19
 
46
20
 
47
- // The scalar-kind words the gate enforces, each to its lattice
48
- // marker. A declared type is gate-checkable only when EVERY union
49
- // word is here: `any`, `constraint`, and the container words leave
50
- // the argument to the builtin.
51
21
  const SIG_KIND = new Map<string, any>([
52
22
  ['string', String],
53
23
  ['number', Number],