aontu 0.62.0 → 0.63.0

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