aontu 0.61.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 (371) hide show
  1. package/README.md +4 -4
  2. package/dist/agentsmd.d.ts +1 -0
  3. package/dist/agentsmd.js +7 -28
  4. package/dist/agentsmd.js.map +1 -1
  5. package/dist/alias.js.map +1 -1
  6. package/dist/allow.d.ts +23 -0
  7. package/dist/allow.js +138 -0
  8. package/dist/allow.js.map +1 -0
  9. package/dist/aontu.d.ts +4 -2
  10. package/dist/aontu.js +4 -80
  11. package/dist/aontu.js.map +1 -1
  12. package/dist/aontumodel.d.ts +4 -0
  13. package/dist/aontumodel.js +33 -0
  14. package/dist/aontumodel.js.map +1 -0
  15. package/dist/cli.d.ts +10 -1
  16. package/dist/cli.js +877 -479
  17. package/dist/cli.js.map +1 -1
  18. package/dist/ctx.js +0 -48
  19. package/dist/ctx.js.map +1 -1
  20. package/dist/diff.js +0 -32
  21. package/dist/diff.js.map +1 -1
  22. package/dist/err.js +0 -40
  23. package/dist/err.js.map +1 -1
  24. package/dist/escape.js +0 -45
  25. package/dist/escape.js.map +1 -1
  26. package/dist/exactjson.d.ts +0 -35
  27. package/dist/exactjson.js +0 -131
  28. package/dist/exactjson.js.map +1 -1
  29. package/dist/format.js +55 -189
  30. package/dist/format.js.map +1 -1
  31. package/dist/grammar.d.ts +9 -0
  32. package/dist/grammar.js +54 -0
  33. package/dist/grammar.js.map +1 -0
  34. package/dist/graph.js +0 -26
  35. package/dist/graph.js.map +1 -1
  36. package/dist/hcanon.js +0 -82
  37. package/dist/hcanon.js.map +1 -1
  38. package/dist/helpdoc.d.ts +16 -0
  39. package/dist/helpdoc.js +59 -0
  40. package/dist/helpdoc.js.map +1 -0
  41. package/dist/hints.d.ts +0 -6
  42. package/dist/hints.js +59 -47
  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 +32 -877
  50. package/dist/lang.js.map +1 -1
  51. package/dist/lower.d.ts +3 -0
  52. package/dist/lower.js +14 -61
  53. package/dist/lower.js.map +1 -1
  54. package/dist/lsp-server.js +0 -16
  55. package/dist/lsp-server.js.map +1 -1
  56. package/dist/lsp.d.ts +1 -1
  57. package/dist/lsp.js +12 -159
  58. package/dist/lsp.js.map +1 -1
  59. package/dist/mcp-server.js +0 -26
  60. package/dist/mcp-server.js.map +1 -1
  61. package/dist/mcp.js +0 -113
  62. package/dist/mcp.js.map +1 -1
  63. package/dist/mod-tool.js +0 -130
  64. package/dist/mod-tool.js.map +1 -1
  65. package/dist/mod.js +0 -162
  66. package/dist/mod.js.map +1 -1
  67. package/dist/patch.js +0 -217
  68. package/dist/patch.js.map +1 -1
  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.d.ts +2 -0
  76. package/dist/relation.js +3 -58
  77. package/dist/relation.js.map +1 -1
  78. package/dist/render.js +33 -143
  79. package/dist/render.js.map +1 -1
  80. package/dist/report-sarif.d.ts +0 -11
  81. package/dist/report-sarif.js +0 -28
  82. package/dist/report-sarif.js.map +1 -1
  83. package/dist/sig.js +0 -35
  84. package/dist/sig.js.map +1 -1
  85. package/dist/sigdecl.js +1 -1
  86. package/dist/sigdecl.js.map +1 -1
  87. package/dist/siggate.js +0 -4
  88. package/dist/siggate.js.map +1 -1
  89. package/dist/site.js +3 -29
  90. package/dist/site.js.map +1 -1
  91. package/dist/subsume.d.ts +0 -10
  92. package/dist/subsume.js +0 -137
  93. package/dist/subsume.js.map +1 -1
  94. package/dist/template.d.ts +2 -1
  95. package/dist/template.js +58 -138
  96. package/dist/template.js.map +1 -1
  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 +12 -242
  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 +20 -0
  125. package/dist/val/CmpFuncVal.js +188 -0
  126. package/dist/val/CmpFuncVal.js.map +1 -0
  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.d.ts +1 -2
  141. package/dist/val/EachFuncVal.js +12 -29
  142. package/dist/val/EachFuncVal.js.map +1 -1
  143. package/dist/val/EmitFuncVal.d.ts +1 -1
  144. package/dist/val/EmitFuncVal.js +6 -119
  145. package/dist/val/EmitFuncVal.js.map +1 -1
  146. package/dist/val/ExpectVal.js +0 -62
  147. package/dist/val/ExpectVal.js.map +1 -1
  148. package/dist/val/FilterFuncVal.js +0 -25
  149. package/dist/val/FilterFuncVal.js.map +1 -1
  150. package/dist/val/FuncBaseVal.d.ts +1 -0
  151. package/dist/val/FuncBaseVal.js +7 -127
  152. package/dist/val/FuncBaseVal.js.map +1 -1
  153. package/dist/val/GraphAtomVal.js +0 -15
  154. package/dist/val/GraphAtomVal.js.map +1 -1
  155. package/dist/val/HideFuncVal.js +0 -13
  156. package/dist/val/HideFuncVal.js.map +1 -1
  157. package/dist/val/IntegerVal.js +0 -61
  158. package/dist/val/IntegerVal.js.map +1 -1
  159. package/dist/val/JunctionVal.js +0 -20
  160. package/dist/val/JunctionVal.js.map +1 -1
  161. package/dist/val/KeyFuncVal.js +0 -46
  162. package/dist/val/KeyFuncVal.js.map +1 -1
  163. package/dist/val/ListVal.js +0 -57
  164. package/dist/val/ListVal.js.map +1 -1
  165. package/dist/val/LowerFuncVal.js +11 -6
  166. package/dist/val/LowerFuncVal.js.map +1 -1
  167. package/dist/val/MapVal.js +0 -151
  168. package/dist/val/MapVal.js.map +1 -1
  169. package/dist/val/MatchFuncVal.js +0 -27
  170. package/dist/val/MatchFuncVal.js.map +1 -1
  171. package/dist/val/{FormFuncVal.d.ts → MaybeFuncVal.d.ts} +5 -5
  172. package/dist/val/MaybeFuncVal.js +50 -0
  173. package/dist/val/MaybeFuncVal.js.map +1 -0
  174. package/dist/val/MoveFuncVal.js +0 -18
  175. package/dist/val/MoveFuncVal.js.map +1 -1
  176. package/dist/val/NilVal.js +2 -36
  177. package/dist/val/NilVal.js.map +1 -1
  178. package/dist/val/NomFuncVal.d.ts +12 -0
  179. package/dist/val/NomFuncVal.js +153 -0
  180. package/dist/val/NomFuncVal.js.map +1 -0
  181. package/dist/val/NumberVal.js +0 -15
  182. package/dist/val/NumberVal.js.map +1 -1
  183. package/dist/val/OpBaseVal.d.ts +1 -0
  184. package/dist/val/OpBaseVal.js +3 -15
  185. package/dist/val/OpBaseVal.js.map +1 -1
  186. package/dist/val/PackFuncVal.js +0 -34
  187. package/dist/val/PackFuncVal.js.map +1 -1
  188. package/dist/val/PathFuncVal.js +0 -6
  189. package/dist/val/PathFuncVal.js.map +1 -1
  190. package/dist/val/PathVal.js +0 -41
  191. package/dist/val/PathVal.js.map +1 -1
  192. package/dist/val/PlaceVal.js +0 -25
  193. package/dist/val/PlaceVal.js.map +1 -1
  194. package/dist/val/PlusOpVal.d.ts +1 -7
  195. package/dist/val/PlusOpVal.js +13 -74
  196. package/dist/val/PlusOpVal.js.map +1 -1
  197. package/dist/val/PrefFuncVal.js +0 -1
  198. package/dist/val/PrefFuncVal.js.map +1 -1
  199. package/dist/val/PrefVal.js +0 -167
  200. package/dist/val/PrefVal.js.map +1 -1
  201. package/dist/val/RecurseVal.js +0 -55
  202. package/dist/val/RecurseVal.js.map +1 -1
  203. package/dist/val/RefVal.js +0 -282
  204. package/dist/val/RefVal.js.map +1 -1
  205. package/dist/val/ReferFuncVal.js +0 -232
  206. package/dist/val/ReferFuncVal.js.map +1 -1
  207. package/dist/val/ScalarKindVal.js +0 -49
  208. package/dist/val/ScalarKindVal.js.map +1 -1
  209. package/dist/val/ScalarVal.js +0 -11
  210. package/dist/val/ScalarVal.js.map +1 -1
  211. package/dist/val/StrFuncVal.js +0 -18
  212. package/dist/val/StrFuncVal.js.map +1 -1
  213. package/dist/val/SuperFuncVal.js +0 -32
  214. package/dist/val/SuperFuncVal.js.map +1 -1
  215. package/dist/val/TopVal.js +0 -1
  216. package/dist/val/TopVal.js.map +1 -1
  217. package/dist/val/TranslateFuncVal.d.ts +12 -0
  218. package/dist/val/TranslateFuncVal.js +99 -0
  219. package/dist/val/TranslateFuncVal.js.map +1 -0
  220. package/dist/val/UpperFuncVal.js +11 -6
  221. package/dist/val/UpperFuncVal.js.map +1 -1
  222. package/dist/val/Val.d.ts +1 -0
  223. package/dist/val/Val.js +2 -133
  224. package/dist/val/Val.js.map +1 -1
  225. package/dist/val/VarVal.js +0 -12
  226. package/dist/val/VarVal.js.map +1 -1
  227. package/dist/val/arith.js +0 -37
  228. package/dist/val/arith.js.map +1 -1
  229. package/dist/val/caserange.d.ts +3 -0
  230. package/dist/val/caserange.js +49 -0
  231. package/dist/val/caserange.js.map +1 -0
  232. package/dist/val/members.js +0 -6
  233. package/dist/val/members.js.map +1 -1
  234. package/dist/val/numcmp.js +0 -11
  235. package/dist/val/numcmp.js.map +1 -1
  236. package/dist/val/numkind.js +0 -145
  237. package/dist/val/numkind.js.map +1 -1
  238. package/dist/val/valutil.js +0 -16
  239. package/dist/val/valutil.js.map +1 -1
  240. package/dist/vet.d.ts +12 -0
  241. package/dist/vet.js +159 -412
  242. package/dist/vet.js.map +1 -1
  243. package/dist/view.js +0 -414
  244. package/dist/view.js.map +1 -1
  245. package/dist/walk.js +0 -41
  246. package/dist/walk.js.map +1 -1
  247. package/grammar/aontu.abnf +9 -7
  248. package/grammar/aontu.gbnf +5 -5
  249. package/grammar/aontu.lark +5 -5
  250. package/grammar/aontu.tmLanguage.json +1 -1
  251. package/package.json +4 -2
  252. package/skill/SKILL.md +8 -0
  253. package/skill/init/check.sh +28 -0
  254. package/skill/init/data.aon +12 -0
  255. package/skill/init/model.aon +19 -0
  256. package/skill/tasks.md +151 -0
  257. package/src/agentsmd.ts +8 -32
  258. package/src/alias.ts +0 -39
  259. package/src/allow.ts +221 -0
  260. package/src/aontu.ts +10 -108
  261. package/src/aontumodel.ts +32 -0
  262. package/src/cli.ts +1009 -540
  263. package/src/ctx.ts +0 -103
  264. package/src/diff.ts +0 -40
  265. package/src/err.ts +0 -40
  266. package/src/escape.ts +0 -46
  267. package/src/exactjson.ts +0 -131
  268. package/src/format.ts +63 -234
  269. package/src/grammar.ts +72 -0
  270. package/src/graph.ts +0 -61
  271. package/src/hcanon.ts +0 -82
  272. package/src/helpdoc.ts +77 -0
  273. package/src/hints.ts +72 -49
  274. package/src/jsonschema.ts +0 -123
  275. package/src/keyorder.ts +0 -42
  276. package/src/lang.ts +39 -895
  277. package/src/lower.ts +15 -65
  278. package/src/lsp-server.ts +0 -16
  279. package/src/lsp.ts +12 -180
  280. package/src/mcp-server.ts +0 -31
  281. package/src/mcp.ts +0 -130
  282. package/src/mod-tool.ts +0 -158
  283. package/src/mod.ts +0 -178
  284. package/src/patch.ts +0 -232
  285. package/src/provenance.ts +0 -183
  286. package/src/query.ts +0 -84
  287. package/src/reach.ts +0 -53
  288. package/src/relation.ts +7 -71
  289. package/src/render.ts +33 -180
  290. package/src/report-sarif.ts +0 -48
  291. package/src/sig.ts +0 -35
  292. package/src/sigdecl.ts +1 -1
  293. package/src/siggate.ts +0 -30
  294. package/src/site.ts +3 -29
  295. package/src/subsume.ts +1 -161
  296. package/src/template.ts +69 -140
  297. package/src/trim.ts +0 -53
  298. package/src/type.ts +2 -45
  299. package/src/unify.ts +13 -251
  300. package/src/utility.ts +0 -31
  301. package/src/val/AbnfFuncVal.ts +181 -0
  302. package/src/val/AbsentVal.ts +54 -0
  303. package/src/val/AggFuncVal.ts +152 -188
  304. package/src/val/ArithFuncVal.ts +0 -20
  305. package/src/val/BagVal.ts +1 -78
  306. package/src/val/BigDecimalVal.ts +0 -16
  307. package/src/val/BigIntegerVal.ts +0 -16
  308. package/src/val/CloseFuncVal.ts +0 -9
  309. package/src/val/CmpFuncVal.ts +249 -0
  310. package/src/val/ConjunctVal.ts +0 -33
  311. package/src/val/ConstraintVal.ts +2 -537
  312. package/src/val/ContainerKindVal.ts +0 -18
  313. package/src/val/CopyFuncVal.ts +0 -5
  314. package/src/val/Decimal.ts +1 -185
  315. package/src/val/DeprecateFuncVal.ts +0 -10
  316. package/src/val/DisjunctVal.ts +0 -157
  317. package/src/val/EachFuncVal.ts +12 -53
  318. package/src/val/EmitFuncVal.ts +8 -208
  319. package/src/val/ExpectVal.ts +0 -62
  320. package/src/val/FilterFuncVal.ts +0 -55
  321. package/src/val/FuncBaseVal.ts +9 -130
  322. package/src/val/GraphAtomVal.ts +0 -42
  323. package/src/val/HideFuncVal.ts +0 -15
  324. package/src/val/IntegerVal.ts +0 -61
  325. package/src/val/JunctionVal.ts +0 -20
  326. package/src/val/KeyFuncVal.ts +0 -48
  327. package/src/val/ListVal.ts +0 -59
  328. package/src/val/LowerFuncVal.ts +12 -7
  329. package/src/val/MapVal.ts +0 -151
  330. package/src/val/MatchFuncVal.ts +0 -59
  331. package/src/val/MaybeFuncVal.ts +86 -0
  332. package/src/val/MoveFuncVal.ts +0 -20
  333. package/src/val/NilVal.ts +2 -36
  334. package/src/val/NomFuncVal.ts +200 -0
  335. package/src/val/NumberVal.ts +0 -16
  336. package/src/val/OpBaseVal.ts +4 -17
  337. package/src/val/PackFuncVal.ts +0 -63
  338. package/src/val/PathFuncVal.ts +0 -32
  339. package/src/val/PathVal.ts +0 -66
  340. package/src/val/PlaceVal.ts +0 -45
  341. package/src/val/PlusOpVal.ts +18 -75
  342. package/src/val/PrefFuncVal.ts +0 -1
  343. package/src/val/PrefVal.ts +0 -179
  344. package/src/val/RecurseVal.ts +0 -81
  345. package/src/val/RefVal.ts +1 -285
  346. package/src/val/ReferFuncVal.ts +0 -255
  347. package/src/val/ScalarKindVal.ts +0 -50
  348. package/src/val/ScalarVal.ts +0 -12
  349. package/src/val/StrFuncVal.ts +0 -44
  350. package/src/val/SuperFuncVal.ts +0 -42
  351. package/src/val/TopVal.ts +0 -1
  352. package/src/val/TranslateFuncVal.ts +132 -0
  353. package/src/val/UpperFuncVal.ts +12 -7
  354. package/src/val/Val.ts +3 -192
  355. package/src/val/VarVal.ts +0 -15
  356. package/src/val/arith.ts +0 -92
  357. package/src/val/caserange.ts +53 -0
  358. package/src/val/members.ts +0 -23
  359. package/src/val/numcmp.ts +1 -27
  360. package/src/val/numkind.ts +0 -149
  361. package/src/val/valutil.ts +0 -16
  362. package/src/vet.ts +209 -504
  363. package/src/view.ts +0 -507
  364. package/src/walk.ts +0 -41
  365. package/dist/std.d.ts +0 -3
  366. package/dist/std.js +0 -637
  367. package/dist/std.js.map +0 -1
  368. package/dist/val/FormFuncVal.js +0 -55
  369. package/dist/val/FormFuncVal.js.map +0 -1
  370. package/src/std.ts +0 -648
  371. package/src/val/FormFuncVal.ts +0 -119
package/src/walk.ts CHANGED
@@ -1,22 +1,5 @@
1
1
  /* Copyright (c) 2025 Richard Rodger, MIT License */
2
2
 
3
- // One tree walk, two consumers: the language server collects NilVals
4
- // for diagnostics (ts/src/lsp.ts) and the validation verb both stamps
5
- // provenance and collects NilVals for findings (ts/src/vet.ts). They had
6
- // the same traversal written out twice, which is one copy too many for
7
- // something with three easy ways to be subtly wrong:
8
- //
9
- // - a Val's children live under `peg`, which is an ARRAY for lists,
10
- // conjuncts and disjuncts, and an OBJECT for maps;
11
- // - a spread constraint lives OFF-peg (`spread.cj`), so a value inside
12
- // a `&:` template is reachable only by following it deliberately;
13
- // - the `seen` set is a termination guard, not an optimisation, and
14
- // the non-Val guard is load-bearing too: a peg object can hold
15
- // entries that are not Vals.
16
- //
17
- // The visitor returns false to prune the subtree below a node, which is
18
- // how a nil collector stops at the nil rather than walking into the
19
- // operands it carries.
20
3
 
21
4
  export function walkVals(
22
5
  v: any,
@@ -52,40 +35,16 @@ export function walkVals(
52
35
  walkVals(spread, visit, seen)
53
36
  }
54
37
 
55
- // OFF-PEG VALUES THAT CAN BE REPORTED. A preference carries the type
56
- // yardstick it derived from its own value, and a `must` carries the
57
- // value it checks against; neither is a peg entry, and both can end
58
- // up as an operand of a failure — the preference's yardstick is what
59
- // `*1 & {}` conflicts with. A caller
60
- // that stamps provenance (ts/src/vet.ts) has to reach them, or a
61
- // report names the document such a value came from as "unknown",
62
- // and the two ports disagree about it (go/walk.go does the same).
63
38
  walkVals(v.superpeg, visit, seen)
64
39
  for (const must of (v.musts ?? [])) {
65
40
  walkVals(must?.v, visit, seen)
66
41
  }
67
42
 
68
- // A FAILURE'S OPERANDS, for the same reason and with the same
69
- // safety. They are not peg entries, and they are exactly what a
70
- // report names: a finding's sites are the nil's primary and
71
- // secondary (ts/src/vet.ts, siteOf). A visitor that PRUNES at a nil
72
- // never gets here -- collectNils returns false and this line is
73
- // behind that gate -- so a nil collector is unaffected. A visitor
74
- // that does not prune, and stamping provenance is the one that does
75
- // not, must reach them or a broken schema's finding names no file at
76
- // all (go/walk.go does the same).
77
43
  walkVals(v.primary, visit, seen)
78
44
  walkVals(v.secondary, visit, seen)
79
45
  }
80
46
 
81
47
 
82
- // Every NilVal in the tree, in walk order. Callers that need a stable
83
- // order across the two ports must sort — the walk follows raw key
84
- // order, and the hosts disagree about that (ts/src/keyorder.ts).
85
- //
86
- // The `seen` set is the caller's, not an internal detail: both callers
87
- // go on to dedup context-only errors against the nils already found,
88
- // which is only possible if they hold the set.
89
48
  export function collectNils(root: any, seen: Set<any>): any[] {
90
49
  const out: any[] = []
91
50
  walkVals(root, (v: any) => {
package/dist/std.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const STD_SOURCES: Record<string, string>;
2
- export declare const AONTU_SCHEME = "aontu:";
3
- export declare const AONTU_MODELS: string[];
package/dist/std.js DELETED
@@ -1,637 +0,0 @@
1
- "use strict";
2
- /* Copyright (c) 2025 Richard Rodger, MIT License */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.AONTU_MODELS = exports.AONTU_SCHEME = exports.STD_SOURCES = void 0;
5
- // THE BUNDLED VOCABULARY (G4 phase 4,
6
- // docs/capability-review/g4-identity-relations.md): `@"std/system"` is
7
- // served from the engine itself — no filesystem, no package resolution
8
- // — so a document may use it under every include capability except
9
- // `none`, and the hermeticity posture is not widened by a source that
10
- // never leaves the process.
11
- //
12
- // The TEXT is the shared artifact: go/std.go carries the same bytes,
13
- // and test/spec/std-system.tsv pins its canon and its canon-hash in
14
- // both engines, so the two copies cannot drift without a red suite.
15
- // It carries no backtick for that reason: one string literal per port,
16
- // and Go's raw string has no escape.
17
- const STD_SYSTEM = `# std/system --- the SYSTEM VOCABULARY (G4 phase 4). Ports, components
18
- # and relations need no syntax: they are schemas. Everything here is
19
- # ordinary unification --- conjunction, spreads, marks, defaults ---
20
- # so the vocabulary costs the language nothing, and an author who wants
21
- # a different one writes it the same way.
22
- #
23
- # EXPERIMENTAL until the distribution layer can version it by
24
- # canon-hash. Entity ids deliberately do NOT embed versions: fusing
25
- # identity and version makes "v1 and v2 describe the same entity"
26
- # inexpressible.
27
-
28
- std: {
29
-
30
- # One end of a connection.
31
- Port: type({
32
- direction: *in | out | inout
33
- protocol?: string
34
- })
35
-
36
- # A node with ports. Where a Component sits in the tree is what it
37
- # is a component OF -- containment is the document's own structure
38
- # and needs no mark of its own.
39
- Component: type({
40
- ports?: {&: $.std.Port}
41
- })
42
-
43
- # A component that is a service. Written out rather than as
44
- # $.std.Component & {kind: service}: a reference from one member of
45
- # this file to another does not survive being INCLUDED into a
46
- # document (the marks the include carries make the referring member
47
- # unusable), so the vocabulary states each schema on its own.
48
- Service: type({
49
- kind: service
50
- ports?: {&: $.std.Port}
51
- })
52
-
53
- # (The Relation schema that used to sit here is retired with the
54
- # relations: magic key, RELATIONS.0.md P2: a relation is declared
55
- # by the graph atoms at its field -- rel(t) & acyclic() &
56
- # inverse(name) -- and the target half is rel(t)'s flow.)
57
- }
58
- `;
59
- const STD_VIEW = `# std/view --- the FIGURE VOCABULARY (VIEWS.0.md, "6. The view
60
- # document"). A view document declares its figures as data, and a
61
- # declaration is just a map: this is the schema for one, so a typo is
62
- # refused where every other mistake in an aontu document is refused --
63
- # at evaluation, by unification -- rather than by the verb that reads
64
- # it afterwards.
65
- #
66
- # @"std/view"
67
- # @"./system.aon"
68
- #
69
- # views: {&: $.view.Figure} & {
70
- # arch: {kind: matrix, order: partition, out: "docs/arch.dsm.txt"}
71
- # }
72
- #
73
- # The keys ARE the view options: the command-line flags without the
74
- # dashes, one vocabulary for the CLI, the library and the file. The
75
- # poset is not among the kinds, because a view document declares
76
- # figures of the ONE document it includes and the poset compares
77
- # several.
78
- #
79
- # EXPERIMENTAL until the distribution layer can version it by
80
- # canon-hash. This file carries no backtick: it is one string literal
81
- # per port, and Go raw strings have no escape.
82
-
83
- view: {
84
-
85
- # One declared figure. The kind says what to draw and out says where
86
- # it belongs; everything else narrows the drawing, and each option
87
- # belongs to the kinds that read it.
88
- Figure: type({
89
- kind: doc | lattice | tree | matrix | graph | layer | sets | layers
90
- | ladder
91
- out: string
92
-
93
- # Every kind.
94
- as?: text | mermaid | dot | er | svg
95
- at?: string
96
- maxRows?: integer & min(0)
97
-
98
- # doc: how many levels of key to draw.
99
- depth?: integer & min(0)
100
-
101
- # tree, matrix, layer: the relation drawn. graph: the predicates
102
- # kept. tree: the subtrees drawn.
103
- relation?: string
104
- relations?: [&: string]
105
- roots?: [&: string]
106
-
107
- # matrix.
108
- order?: canon | partition
109
- closure?: boolean
110
-
111
- # graph, layer.
112
- groupBy?: string
113
- label?: string
114
- layers?: [&: string]
115
- edges?: upward | all | none
116
-
117
- # sets, layers.
118
- sets?: string
119
- member?: string
120
- universe?: string
121
- minDegree?: integer & min(0)
122
- maxCols?: integer & min(0)
123
- minSize?: integer & min(0)
124
- })
125
- }
126
- `;
127
- // THE LANGUAGE-SUPPLIED MODELS (docs/design/MODELS.0.md D1;
128
- // docs/design/RENDER.0.md P0 and P1). `aontu:NAME` is Node's device --
129
- // a prefix no relative path, package name or module path can spell --
130
- // so the resolver routes on it before any other leg and never touches
131
- // the filesystem for it. Held in String.raw so the backslashes of the
132
- // regexes reach the parser as written; no backtick, as above.
133
- //
134
- // aontu:code is the OUTPUT VOCABULARY: an instance of it is what a
135
- // transform evaluates to and what `aontu render` folds to bytes.
136
- // aontu:profile is the schema of a render profile, the data a unit of
137
- // one language is rendered under. Both are pinned by canon and hash
138
- // rows (test/spec/aontu-code.tsv, test/spec/aontu-profile.tsv).
139
- const STD_CODE = String.raw `# aontu:code --- THE OUTPUT VOCABULARY. An aontu transform evaluates to
140
- # an instance of this schema, and 'aontu render' turns the instance
141
- # into bytes. Because it is an ordinary schema, a transform's result is
142
- # checked by unification before anything is rendered.
143
- #
144
- # @"aontu:code"
145
- # code: { units: [ { path: "out.py", lang: "python", decls: [
146
- # { k: "frag", of: emit($.model, %rules) } ] } ] }
147
- #
148
- # TWO ESCAPES, both counted by the render report: {k: "text", lang,
149
- # text} carries verbatim target syntax, and 'x' is an open per-backend
150
- # rider. CONTAINER TYPES TAKE LEAVES ONLY: anything deeper is a named
151
- # alias declaration plus a {k: "ref"}, which keeps this schema's meet
152
- # linear. A FRAGMENT IS FLAT: each piece carries its own depth ('at'),
153
- # so the renderer owns every prefix and no piece nests another; a bare
154
- # string piece is a line at depth 0, and no inline text may hold a line
155
- # terminator -- that is checked here, before any renderer runs.
156
- #
157
- # THE ROOT IS NOT type()-MARKED, on purpose: 'aontu render' reads the
158
- # instance through generate(), and a type()-marked subtree does not
159
- # generate. A document that includes this vocabulary and writes no
160
- # units generates 'code: {units: []}', which is what it said.
161
- #
162
- # EXPERIMENTAL until the distribution layer can version it by
163
- # canon-hash.
164
-
165
- %name = string & re("^[A-Za-z_][A-Za-z0-9_]*$") & length(min(1) & max(255))
166
-
167
- %text = close({ k:"text" lang:string & length(min(1)) text:string })
168
-
169
- %doc = close({
170
- text: string
171
- deprecated?: close({ msg?:string use?:string since?:string })
172
- })
173
-
174
- %check = close({ c:"min" n:number exclusive:*false | boolean })
175
- | close({ c:"max" n:number exclusive:*false | boolean })
176
- | close({ c:"re" p:string })
177
- | close({ c:"len" min?:integer & min(0) max?:integer & min(0) })
178
- | close({ c:"unique" key?:%name })
179
- | close({ c:"ne" of:[&: string | number | boolean] })
180
- | close({ c:"must" note:string })
181
-
182
- %prim = close({
183
- k: "prim"
184
- prim: "string" | "int" | "bigint" | "float" | "decimal" | "bool" | "null" | "any"
185
- })
186
-
187
- %ref = close({ k:"ref" name:%name unit?:string })
188
- %leaf = %prim | %ref | %text
189
-
190
- %type = %leaf
191
- | close({ k:"list" of:%leaf })
192
- | close({ k:"map" key:%leaf of:%leaf })
193
- | close({ k:"opt" of:%leaf })
194
- | close({ k:"union" of:[&: %leaf] })
195
- | close({ k:"lit" of:[&: string | number | boolean | null] })
196
-
197
- %field = close({
198
- name: %name
199
- type: %type
200
- optional: *false | boolean
201
- doc?: %doc
202
- default?: string | number | boolean | null
203
- check?: [&: %check]
204
- rel?: close({ to:string name?:string })
205
- x?: {}
206
- })
207
-
208
- %member = close({ name:%name value?:string | number doc?:%doc x?:{} })
209
-
210
- %param = close({
211
- name: %name
212
- type: %type
213
- default?: string | number | boolean | null
214
- x?: {}
215
- })
216
-
217
- # THE FRAGMENT ALGEBRA. A line's inline pieces hold no terminator; a
218
- # blank is its terminators alone; a raw is the one piece that may carry
219
- # terminators, re-indented to its depth unless it says not to.
220
- %inline = string & re("^[^\n\r]*$") | %ref
221
- %line = close({ k:"line" at:*0 | integer & min(0) & max(64) of:[&: %inline] })
222
- %blank = close({ k:"blank" n:*1 | integer & min(1) & max(16) })
223
-
224
- %raw = close({
225
- k: "raw"
226
- at: *0 | integer & min(0) & max(64)
227
- text: string
228
- reindent: *true | boolean
229
- })
230
-
231
- %piece = %line | %blank | %raw | string & re("^[^\n\r]*$")
232
- %frag = close({ k:"frag" of:[&: %piece] })
233
- %body = %frag | close({ k:"abstract" })
234
-
235
- %record = close({
236
- k: "record"
237
- name: %name
238
- doc?: %doc
239
- open: *false | boolean
240
- fields: [&: %field]
241
- entity?: string
242
- check?: [&: %check]
243
- x?: {}
244
- })
245
-
246
- %enum = close({ k:"enum" name:%name doc?:%doc members:[&: %member] x?:{} })
247
-
248
- %alias = close({
249
- k: "alias"
250
- name: %name
251
- doc?: %doc
252
- type: %type
253
- check?: [&: %check]
254
- x?: {}
255
- })
256
-
257
- %const = close({
258
- k: "const"
259
- name: %name
260
- doc?: %doc
261
- type?: %type
262
- value: string | number | boolean | null
263
- x?: {}
264
- })
265
-
266
- %func = close({
267
- k: "func"
268
- name: %name
269
- doc?: %doc
270
- params: [&: %param]
271
- returns?: %type
272
- body: %body
273
- x?: {}
274
- })
275
-
276
- %decl = %record | %enum | %alias | %const | %func | %text | %frag
277
-
278
- %import = close({
279
- from: string & length(min(1))
280
- names?: [&: %name]
281
- alias?: %name
282
- x?: {}
283
- })
284
-
285
- %unit = close({
286
- path: string & length(min(1))
287
- lang: string & length(min(1))
288
- pkg?: string
289
- doc?: %doc
290
- imports?: [&: %import]
291
- decls: [&: %decl]
292
- profile?: {}
293
- x?: {}
294
- })
295
-
296
- %source = close({ path?:string hash?:string & re("^aon1-[A-Za-z0-9_-]+$") })
297
-
298
- code: close({ source?:%source units:[&: %unit] })
299
- `;
300
- const STD_PROFILE = String.raw `# aontu:profile --- THE PROFILE VOCABULARY. A profile is the data
301
- # 'aontu render' applies to a unit of one language, and it is DATA and
302
- # only data: a field belongs here only if the renderer applies it
303
- # without looking at the shape of any node. Anything else is a lowering
304
- # and lives in the transform.
305
- #
306
- # @"aontu:profile"
307
- # profile: { lang: "python", indent: { unit: " ", width: 4 } }
308
- #
309
- # Three profiles are bundled with the engine -- aontu:lang/typescript,
310
- # aontu:lang/go and aontu:lang/text -- and a unit is matched to one by
311
- # its 'lang'. A fragment-only unit needs nothing beyond 'indent'.
312
- #
313
- # THE ROOT IS NOT type()-MARKED, for the reason aontu:code's is not:
314
- # 'aontu render' reads a profile through generate().
315
- #
316
- # EXPERIMENTAL until the distribution layer can version it by
317
- # canon-hash.
318
-
319
- %name = string & re("^[A-Za-z_][A-Za-z0-9_]*$")
320
-
321
- %case = "as-is" | "camel" | "pascal" | "snake" | "screaming" | "kebab"
322
-
323
- %comment = close({ open?:string prefix?:string close?:string })
324
-
325
- %form = close({
326
- open: *"" | string
327
- close: *"" | string
328
- prec: *9 | integer & min(0) & max(9)
329
- childPrec: *0 | integer & min(0) & max(9)
330
- })
331
-
332
- %profile = close({
333
- lang: string & length(min(1))
334
- lowering?: "typescript" | "go"
335
- indent: close({
336
- unit: *" " | string & length(min(1))
337
- width: *2 | integer & min(0) & max(16)
338
- })
339
- comment?: close({ line?:%comment block?:%comment doc?:%comment })
340
- str?: close({
341
- quote: *"\"" | string & length(min(1) & max(1))
342
- escape: { &: string }
343
- })
344
- ident?: close({
345
- chars: *"ascii-word" | "ascii-word"
346
- reserved?: [&: string]
347
- case?: close({
348
- record?: %case
349
- field?: %case
350
- enum?: %case
351
- member?: %case
352
- const?: %case
353
- func?: %case
354
- param?: %case
355
- alias?: %case
356
- })
357
- acronyms?: [&: %name]
358
- })
359
- types?: close({
360
- prim?: { &: string }
361
- list?: %form
362
- map?: %form
363
- opt?: %form
364
- union?: %form
365
- lit?: %form
366
- })
367
- banner?: string
368
- })
369
-
370
- profile: %profile
371
- `;
372
- // The text profile (RENDER.0.md D5): the profile of a fragment-only
373
- // unit, and the fallback of every language without a lowering.
374
- const STD_LANG_TEXT = String.raw `# aontu:lang/text --- THE TEXT PROFILE. The profile of a unit whose
375
- # declarations are fragments and text escapes only: indentation, and
376
- # nothing else, since a fold over fragments applies nothing else. Every
377
- # language without a lowering renders under it (docs/design/RENDER.0.md
378
- # D5), and a reference inline renders as its name, verbatim.
379
- #
380
- # EXPERIMENTAL until the distribution layer can version it by
381
- # canon-hash.
382
-
383
- @"aontu:profile"
384
-
385
- profile: { lang:"text" indent:{ unit:" " width:2 } }
386
- `;
387
- // THE TYPESCRIPT PROFILE (docs/design/RENDER.0.md D5, P5): the data the
388
- // typescript lowering renders under -- two spaces, the JSDoc forms, the
389
- // JavaScript string escapes by decimal code point, the reserved words,
390
- // camel and pascal by role, no acronyms (TypeScript's `ledgerId` keeps
391
- // its `Id`), and the type forms whose precedences put the parens in
392
- // `(string | null)[]`. Byte-identical in both ports, pinned by hash.
393
- const STD_LANG_TYPESCRIPT = String.raw `# aontu:lang/typescript --- THE TYPESCRIPT PROFILE. The data a unit of
394
- # TypeScript renders under: indentation, the comment forms, the string
395
- # quote and its escape table, the identifier rules and the type forms.
396
- # The lowering of a declaration to an exported interface is code
397
- # (docs/design/RENDER.0.md D5); everything the lowering reads without
398
- # looking at the shape of a node is here.
399
- #
400
- # EXPERIMENTAL until the distribution layer can version it by
401
- # canon-hash.
402
-
403
- @"aontu:profile"
404
-
405
- profile: {
406
- lang: "typescript"
407
- lowering: "typescript"
408
- indent: { unit:" " width:2 }
409
- comment: line: prefix: "// "
410
- comment: block: { open:"/*" prefix:" * " close:" */" }
411
- comment: doc: { open:"/**" prefix:" * " close:" */" }
412
- str: quote: "\""
413
- str: escape: "8": "\\b"
414
- str: escape: "9": "\\t"
415
- str: escape: "10": "\\n"
416
- str: escape: "12": "\\f"
417
- str: escape: "13": "\\r"
418
- str: escape: "34": "\\\""
419
- str: escape: "92": "\\\\"
420
- ident: {
421
- chars: "ascii-word"
422
- reserved: [
423
- "await"
424
- "break"
425
- "case"
426
- "catch"
427
- "class"
428
- "const"
429
- "continue"
430
- "debugger"
431
- "default"
432
- "delete"
433
- "do"
434
- "else"
435
- "enum"
436
- "export"
437
- "extends"
438
- "false"
439
- "finally"
440
- "for"
441
- "function"
442
- "if"
443
- "implements"
444
- "import"
445
- "in"
446
- "instanceof"
447
- "interface"
448
- "let"
449
- "new"
450
- "null"
451
- "package"
452
- "private"
453
- "protected"
454
- "public"
455
- "return"
456
- "static"
457
- "super"
458
- "switch"
459
- "this"
460
- "throw"
461
- "true"
462
- "try"
463
- "typeof"
464
- "var"
465
- "void"
466
- "while"
467
- "with"
468
- "yield"
469
- ]
470
- case: record: "pascal"
471
- case: field: "camel"
472
- case: enum: "pascal"
473
- case: member: "pascal"
474
- case: const: "camel"
475
- case: func: "camel"
476
- case: param: "camel"
477
- case: alias: "pascal"
478
- acronyms: []
479
- }
480
- types: prim: string: "string"
481
- types: prim: int: "number"
482
- types: prim: bigint: "bigint"
483
- types: prim: float: "number"
484
- types: prim: decimal: "string"
485
- types: prim: bool: "boolean"
486
- types: prim: null: "null"
487
- types: prim: any: "unknown"
488
- types: list: { close:"[]" childPrec:2 }
489
- types: map: { open:"Record<" close:">" }
490
- types: opt: { close:" | null" prec:1 childPrec:2 }
491
- types: union: { prec:1 childPrec:2 }
492
- types: lit: prec: 1
493
- banner: "Code generated by aontu from {path}. DO NOT EDIT."
494
- }
495
- `;
496
- // THE GO PROFILE (docs/design/RENDER.0.md D5, P5): a tab, the line-comment
497
- // doc form, the Go string escapes, the 25 keywords, pascal by role with
498
- // the acronym set that makes `ledgerId` `LedgerID`, and the type forms
499
- // -- `[]T`, `map[K]V`, `*T` -- none of which needs a paren.
500
- // Byte-identical in both ports, pinned by hash.
501
- const STD_LANG_GO = String.raw `# aontu:lang/go --- THE GO PROFILE. The data a unit of Go renders
502
- # under: a tab of indentation, the comment forms, the string quote and
503
- # its escape table, the identifier rules -- pascal by role, and the
504
- # acronym set that spells ID and URL -- and the type forms. The lowering
505
- # of a declaration to a struct type is code (docs/design/RENDER.0.md D5);
506
- # everything the lowering reads without looking at the shape of a node
507
- # is here.
508
- #
509
- # EXPERIMENTAL until the distribution layer can version it by
510
- # canon-hash.
511
-
512
- @"aontu:profile"
513
-
514
- profile: {
515
- lang: "go"
516
- lowering: "go"
517
- indent: { unit:"\t" width:1 }
518
- comment: { line:prefix:"// " block:{ open:"/*" close:"*/" } doc:prefix:"// " }
519
- str: quote: "\""
520
- str: escape: "7": "\\a"
521
- str: escape: "8": "\\b"
522
- str: escape: "9": "\\t"
523
- str: escape: "10": "\\n"
524
- str: escape: "11": "\\v"
525
- str: escape: "12": "\\f"
526
- str: escape: "13": "\\r"
527
- str: escape: "34": "\\\""
528
- str: escape: "92": "\\\\"
529
- ident: {
530
- chars: "ascii-word"
531
- reserved: [
532
- "break"
533
- "case"
534
- "chan"
535
- "const"
536
- "continue"
537
- "default"
538
- "defer"
539
- "else"
540
- "fallthrough"
541
- "for"
542
- "func"
543
- "go"
544
- "goto"
545
- "if"
546
- "import"
547
- "interface"
548
- "map"
549
- "package"
550
- "range"
551
- "return"
552
- "select"
553
- "struct"
554
- "switch"
555
- "type"
556
- "var"
557
- ]
558
- case: record: "pascal"
559
- case: field: "pascal"
560
- case: enum: "pascal"
561
- case: member: "pascal"
562
- case: const: "pascal"
563
- case: func: "pascal"
564
- case: param: "camel"
565
- case: alias: "pascal"
566
- acronyms: [
567
- "ACL"
568
- "API"
569
- "ASCII"
570
- "CPU"
571
- "CSS"
572
- "DNS"
573
- "EOF"
574
- "GUID"
575
- "HTML"
576
- "HTTP"
577
- "HTTPS"
578
- "ID"
579
- "IP"
580
- "JSON"
581
- "LHS"
582
- "QPS"
583
- "RAM"
584
- "RHS"
585
- "RPC"
586
- "SLA"
587
- "SMTP"
588
- "SQL"
589
- "SSH"
590
- "TCP"
591
- "TLS"
592
- "TTL"
593
- "UDP"
594
- "UI"
595
- "UID"
596
- "UUID"
597
- "URI"
598
- "URL"
599
- "UTF8"
600
- "VM"
601
- "XML"
602
- "XMPP"
603
- "XSRF"
604
- "XSS"
605
- ]
606
- }
607
- types: prim: string: "string"
608
- types: prim: int: "int64"
609
- types: prim: bigint: "string"
610
- types: prim: float: "float64"
611
- types: prim: decimal: "string"
612
- types: prim: bool: "bool"
613
- types: prim: null: "any"
614
- types: prim: any: "any"
615
- types: list: open: "[]"
616
- types: map: open: "map["
617
- types: opt: open: "*"
618
- banner: "Code generated by aontu from {path}. DO NOT EDIT."
619
- }
620
- `;
621
- exports.STD_SOURCES = {
622
- 'std/system': STD_SYSTEM,
623
- 'std/system.aon': STD_SYSTEM,
624
- 'std/view': STD_VIEW,
625
- 'std/view.aon': STD_VIEW,
626
- 'aontu:code': STD_CODE,
627
- 'aontu:lang/go': STD_LANG_GO,
628
- 'aontu:lang/text': STD_LANG_TEXT,
629
- 'aontu:lang/typescript': STD_LANG_TYPESCRIPT,
630
- 'aontu:profile': STD_PROFILE,
631
- };
632
- // The scheme of a language-supplied model, and the names it serves --
633
- // the set the not-found message names, so a typo does not go looking
634
- // on disk.
635
- exports.AONTU_SCHEME = 'aontu:';
636
- exports.AONTU_MODELS = Object.keys(exports.STD_SOURCES).filter((k) => k.startsWith(exports.AONTU_SCHEME)).sort();
637
- //# sourceMappingURL=std.js.map