aontu 0.53.0 → 0.55.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 (197) hide show
  1. package/dist/aontu.d.ts +3 -2
  2. package/dist/aontu.js +36 -7
  3. package/dist/aontu.js.map +1 -1
  4. package/dist/cli.d.ts +2 -1
  5. package/dist/cli.js +500 -8
  6. package/dist/cli.js.map +1 -1
  7. package/dist/ctx.d.ts +5 -0
  8. package/dist/ctx.js +1 -0
  9. package/dist/ctx.js.map +1 -1
  10. package/dist/diff.js.map +1 -1
  11. package/dist/err.js +7 -1
  12. package/dist/err.js.map +1 -1
  13. package/dist/graph.d.ts +2 -5
  14. package/dist/graph.js +83 -46
  15. package/dist/graph.js.map +1 -1
  16. package/dist/hcanon.js +9 -10
  17. package/dist/hcanon.js.map +1 -1
  18. package/dist/hints.js +94 -26
  19. package/dist/hints.js.map +1 -1
  20. package/dist/jsonschema.js +34 -0
  21. package/dist/jsonschema.js.map +1 -1
  22. package/dist/lang.js +593 -191
  23. package/dist/lang.js.map +1 -1
  24. package/dist/lsp.d.ts +1 -1
  25. package/dist/lsp.js +86 -6
  26. package/dist/lsp.js.map +1 -1
  27. package/dist/mcp.js +153 -6
  28. package/dist/mcp.js.map +1 -1
  29. package/dist/mod-tool.js +42 -8
  30. package/dist/mod-tool.js.map +1 -1
  31. package/dist/mod.d.ts +4 -0
  32. package/dist/mod.js +97 -2
  33. package/dist/mod.js.map +1 -1
  34. package/dist/patch.d.ts +5 -0
  35. package/dist/patch.js +25 -25
  36. package/dist/patch.js.map +1 -1
  37. package/dist/provenance.d.ts +1 -0
  38. package/dist/provenance.js +2 -1
  39. package/dist/provenance.js.map +1 -1
  40. package/dist/query.js.map +1 -1
  41. package/dist/reach.d.ts +1 -0
  42. package/dist/reach.js +49 -21
  43. package/dist/reach.js.map +1 -1
  44. package/dist/relation.d.ts +4 -0
  45. package/dist/relation.js +125 -200
  46. package/dist/relation.js.map +1 -1
  47. package/dist/sig.d.ts +25 -0
  48. package/dist/sig.js +277 -0
  49. package/dist/sig.js.map +1 -0
  50. package/dist/sigdecl.d.ts +2 -0
  51. package/dist/sigdecl.js +11 -0
  52. package/dist/sigdecl.js.map +1 -0
  53. package/dist/siggate.d.ts +4 -0
  54. package/dist/siggate.js +90 -0
  55. package/dist/siggate.js.map +1 -0
  56. package/dist/std.js +75 -16
  57. package/dist/std.js.map +1 -1
  58. package/dist/subsume.js +57 -10
  59. package/dist/subsume.js.map +1 -1
  60. package/dist/tsconfig.tsbuildinfo +1 -1
  61. package/dist/unify.d.ts +2 -2
  62. package/dist/unify.js +93 -114
  63. package/dist/unify.js.map +1 -1
  64. package/dist/utility.d.ts +1 -2
  65. package/dist/utility.js +7 -61
  66. package/dist/utility.js.map +1 -1
  67. package/dist/val/AggFuncVal.d.ts +12 -1
  68. package/dist/val/AggFuncVal.js +165 -3
  69. package/dist/val/AggFuncVal.js.map +1 -1
  70. package/dist/val/BagVal.d.ts +2 -0
  71. package/dist/val/BagVal.js +56 -8
  72. package/dist/val/BagVal.js.map +1 -1
  73. package/dist/val/ConstraintVal.js +33 -5
  74. package/dist/val/ConstraintVal.js.map +1 -1
  75. package/dist/val/ContainerKindVal.d.ts +35 -0
  76. package/dist/val/ContainerKindVal.js +99 -0
  77. package/dist/val/ContainerKindVal.js.map +1 -0
  78. package/dist/val/CopyFuncVal.js +0 -7
  79. package/dist/val/CopyFuncVal.js.map +1 -1
  80. package/dist/val/DisjunctVal.d.ts +1 -2
  81. package/dist/val/DisjunctVal.js +146 -39
  82. package/dist/val/DisjunctVal.js.map +1 -1
  83. package/dist/val/ExpectVal.js +37 -2
  84. package/dist/val/ExpectVal.js.map +1 -1
  85. package/dist/val/FuncBaseVal.d.ts +1 -0
  86. package/dist/val/FuncBaseVal.js +19 -8
  87. package/dist/val/FuncBaseVal.js.map +1 -1
  88. package/dist/val/GraphAtomVal.d.ts +39 -0
  89. package/dist/val/GraphAtomVal.js +184 -0
  90. package/dist/val/GraphAtomVal.js.map +1 -0
  91. package/dist/val/JunctionVal.js +22 -5
  92. package/dist/val/JunctionVal.js.map +1 -1
  93. package/dist/val/ListVal.js +27 -34
  94. package/dist/val/ListVal.js.map +1 -1
  95. package/dist/val/MapVal.d.ts +1 -0
  96. package/dist/val/MapVal.js +82 -35
  97. package/dist/val/MapVal.js.map +1 -1
  98. package/dist/val/PathFuncVal.d.ts +2 -2
  99. package/dist/val/PathFuncVal.js +75 -16
  100. package/dist/val/PathFuncVal.js.map +1 -1
  101. package/dist/val/PathVal.d.ts +25 -0
  102. package/dist/val/PathVal.js +150 -0
  103. package/dist/val/PathVal.js.map +1 -0
  104. package/dist/val/PlusOpVal.d.ts +2 -1
  105. package/dist/val/PlusOpVal.js +50 -35
  106. package/dist/val/PlusOpVal.js.map +1 -1
  107. package/dist/val/PrefVal.d.ts +2 -0
  108. package/dist/val/PrefVal.js +159 -32
  109. package/dist/val/PrefVal.js.map +1 -1
  110. package/dist/val/RecurseVal.d.ts +19 -0
  111. package/dist/val/RecurseVal.js +217 -0
  112. package/dist/val/RecurseVal.js.map +1 -0
  113. package/dist/val/RefVal.d.ts +2 -1
  114. package/dist/val/RefVal.js +105 -72
  115. package/dist/val/RefVal.js.map +1 -1
  116. package/dist/val/ReferFuncVal.d.ts +30 -7
  117. package/dist/val/ReferFuncVal.js +395 -94
  118. package/dist/val/ReferFuncVal.js.map +1 -1
  119. package/dist/val/ScalarKindVal.d.ts +4 -2
  120. package/dist/val/ScalarKindVal.js +12 -1
  121. package/dist/val/ScalarKindVal.js.map +1 -1
  122. package/dist/val/SuperFuncVal.d.ts +4 -2
  123. package/dist/val/SuperFuncVal.js +118 -14
  124. package/dist/val/SuperFuncVal.js.map +1 -1
  125. package/dist/val/TopVal.d.ts +1 -1
  126. package/dist/val/Val.d.ts +2 -3
  127. package/dist/val/Val.js +39 -20
  128. package/dist/val/Val.js.map +1 -1
  129. package/dist/val/arith.js +4 -1
  130. package/dist/val/arith.js.map +1 -1
  131. package/dist/vet.d.ts +1 -0
  132. package/dist/vet.js +32 -1
  133. package/dist/vet.js.map +1 -1
  134. package/dist/view.d.ts +90 -0
  135. package/dist/view.js +2168 -0
  136. package/dist/view.js.map +1 -0
  137. package/grammar/aontu.gbnf +18 -10
  138. package/grammar/aontu.lark +15 -10
  139. package/grammar/aontu.tmLanguage.json +184 -0
  140. package/package.json +10 -3
  141. package/skill/grammar-card.md +1 -2
  142. package/src/aontu.ts +37 -7
  143. package/src/cli.ts +553 -8
  144. package/src/ctx.ts +20 -0
  145. package/src/diff.ts +4 -2
  146. package/src/err.ts +8 -1
  147. package/src/graph.ts +125 -75
  148. package/src/hcanon.ts +9 -11
  149. package/src/hints.ts +112 -29
  150. package/src/jsonschema.ts +41 -0
  151. package/src/lang.ts +642 -203
  152. package/src/lsp.ts +75 -6
  153. package/src/mcp.ts +164 -6
  154. package/src/mod-tool.ts +48 -9
  155. package/src/mod.ts +110 -1
  156. package/src/patch.ts +31 -27
  157. package/src/provenance.ts +8 -1
  158. package/src/query.ts +4 -2
  159. package/src/reach.ts +52 -23
  160. package/src/relation.ts +139 -236
  161. package/src/sig.ts +345 -0
  162. package/src/sigdecl.ts +11 -0
  163. package/src/siggate.ts +144 -0
  164. package/src/std.ts +77 -16
  165. package/src/subsume.ts +59 -10
  166. package/src/unify.ts +102 -125
  167. package/src/utility.ts +7 -67
  168. package/src/val/AggFuncVal.ts +231 -4
  169. package/src/val/BagVal.ts +58 -9
  170. package/src/val/ConstraintVal.ts +34 -5
  171. package/src/val/ContainerKindVal.ts +158 -0
  172. package/src/val/CopyFuncVal.ts +0 -7
  173. package/src/val/DisjunctVal.ts +152 -40
  174. package/src/val/ExpectVal.ts +39 -4
  175. package/src/val/FuncBaseVal.ts +21 -8
  176. package/src/val/GraphAtomVal.ts +264 -0
  177. package/src/val/JunctionVal.ts +23 -6
  178. package/src/val/ListVal.ts +30 -37
  179. package/src/val/MapVal.ts +87 -39
  180. package/src/val/PathFuncVal.ts +107 -19
  181. package/src/val/PathVal.ts +221 -0
  182. package/src/val/PlusOpVal.ts +56 -37
  183. package/src/val/PrefVal.ts +186 -38
  184. package/src/val/RecurseVal.ts +285 -0
  185. package/src/val/RefVal.ts +105 -83
  186. package/src/val/ReferFuncVal.ts +445 -100
  187. package/src/val/ScalarKindVal.ts +12 -0
  188. package/src/val/SuperFuncVal.ts +137 -13
  189. package/src/val/TopVal.ts +1 -1
  190. package/src/val/Val.ts +44 -35
  191. package/src/val/arith.ts +4 -1
  192. package/src/vet.ts +41 -4
  193. package/src/view.ts +2882 -0
  194. package/dist/val/IdFuncVal.d.ts +0 -13
  195. package/dist/val/IdFuncVal.js +0 -54
  196. package/dist/val/IdFuncVal.js.map +0 -1
  197. package/src/val/IdFuncVal.ts +0 -91
package/dist/sig.js ADDED
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ /* Copyright (c) 2021-2026 Richard Rodger, MIT License */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.funcSig = void 0;
5
+ exports.parseSigLine = parseSigLine;
6
+ exports.parseSigText = parseSigText;
7
+ exports.renderSig = renderSig;
8
+ exports.renderSigArg = renderSigArg;
9
+ // THE SIGNATURE REGISTRY (docs/design/SIGNATURES.0.md). The call
10
+ // surface of the built-in functions is DECLARED, in the signature
11
+ // syntax itself, in test/spec/signature.tsv; this module is the
12
+ // TypeScript half of the pair that reads it. The declaration text is
13
+ // inlined at build time (ts/src/sigdecl.ts, `make sig`) and parsed at
14
+ // initialisation by the signature grammar -- a custom tabnas grammar,
15
+ // the same engine the aontu grammar itself is built on -- into the
16
+ // registry the runtime signature checker, the error-message builder,
17
+ // the docs table and the LSP all consume. Neither port authors a
18
+ // table: go/sig.go parses the same text with the same grammar, and
19
+ // the shared suite round-trips every line (render(parse(line)) is the
20
+ // line) so the two parsers cannot drift.
21
+ //
22
+ // line = name '(' [ arg {',' arg} ] ')' ':' type
23
+ // arg = [mode] name ['?'] ':' type
24
+ // | '...' name ':' ( type | '(' [mode] type {',' [mode] type} ')' )
25
+ // type = word {'|' word}
26
+ // mode = 'capture' | 'template' | 'trial' | 'projector' | 'text'
27
+ //
28
+ // `value` mode is unmarked; the five marked modes are the vocabulary
29
+ // plain pseudo-TypeScript cannot say (a captured spelling is not a
30
+ // string value). The grammar is line-oriented: the loader strips
31
+ // comment and blank lines and parses each declaration line alone, so
32
+ // the grammar never sees line structure.
33
+ const parser_1 = require("@tabnas/parser");
34
+ const sigdecl_1 = require("./sigdecl");
35
+ const ARG_MODES = {
36
+ capture: true, template: true, trial: true, projector: true, text: true,
37
+ };
38
+ // The signature grammar, as a tabnas grammar plugin. Rules: sig (the
39
+ // line) -> args -> arg -> argtype -> type | group -> gmember. Alts
40
+ // match at most two tokens, the engine's shape; lists loop the
41
+ // json-grammar way (the element rule replaces itself on ',' and
42
+ // backtracks the closer for its parent to consume).
43
+ function sigGrammar(tn) {
44
+ tn.options({
45
+ fixed: {
46
+ token: {
47
+ '#OP': '(',
48
+ '#CP': ')',
49
+ '#QM': '?',
50
+ '#PI': '|',
51
+ '#DD': '...',
52
+ },
53
+ },
54
+ rule: { start: 'sig' },
55
+ });
56
+ // Parse-level validation errors, collected by the actions: the
57
+ // engine's own errors cover token shape, these cover word choice (a
58
+ // mode that is not a mode). Read after parse by parseSigLine.
59
+ const errs = [];
60
+ tn.sigErrs = errs;
61
+ const mode = (word) => {
62
+ if (true !== ARG_MODES[word]) {
63
+ errs.push('mode:' + word);
64
+ return 'value';
65
+ }
66
+ return word;
67
+ };
68
+ tn.grammar({
69
+ ref: {
70
+ '@sig-bo': (r) => {
71
+ r.node = { name: '', args: [], out: '' };
72
+ r.u.words = [];
73
+ },
74
+ '@signame': (r) => {
75
+ r.node.name = String(r.o0.val);
76
+ },
77
+ '@sigargs': (r) => {
78
+ r.node.args = r.child.node;
79
+ },
80
+ '@sigout': (r) => {
81
+ r.node.out = r.u.words.join('|');
82
+ },
83
+ '@args-bo': (r) => {
84
+ r.node = [];
85
+ },
86
+ '@arg-bo': (r) => {
87
+ r.u.sig = { name: '', mode: 'value', type: '' };
88
+ },
89
+ '@arg-rest': (r) => {
90
+ r.u.sig.rest = true;
91
+ r.u.sig.name = String(r.o1.val);
92
+ },
93
+ '@arg-modename': (r) => {
94
+ r.u.sig.mode = mode(String(r.o0.val));
95
+ r.u.sig.name = String(r.o1.val);
96
+ },
97
+ '@arg-name': (r) => {
98
+ r.u.sig.name = String(r.o0.val);
99
+ },
100
+ '@arg-opt': (r) => {
101
+ r.u.sig.opt = true;
102
+ },
103
+ '@arg-done': (r) => {
104
+ const sig = r.u.sig;
105
+ const at = r.child.node;
106
+ if (Array.isArray(at)) {
107
+ sig.group = at;
108
+ sig.type = '';
109
+ }
110
+ else {
111
+ sig.type = String(at);
112
+ }
113
+ r.node.push(sig);
114
+ },
115
+ '@argtype-bo': (r) => {
116
+ r.u.words = [];
117
+ },
118
+ '@argtype-bc': (r) => {
119
+ r.node = 0 < r.u.words.length ?
120
+ r.u.words.join('|') : r.child.node;
121
+ },
122
+ '@type-word': (r) => {
123
+ r.parent.u.words.push(String(r.o0.val));
124
+ },
125
+ '@group-bo': (r) => {
126
+ r.node = [];
127
+ },
128
+ '@gm-two': (r) => {
129
+ r.u.gm = { mode: mode(String(r.o0.val)), type: String(r.o1.val) };
130
+ },
131
+ '@gm-one': (r) => {
132
+ r.u.gm = { mode: 'value', type: String(r.o0.val) };
133
+ },
134
+ '@gm-done': (r) => {
135
+ r.node.push(r.u.gm);
136
+ },
137
+ },
138
+ rule: {
139
+ sig: {
140
+ open: [
141
+ { s: '#TX #OP', a: '@signame', p: 'args' },
142
+ ],
143
+ close: [
144
+ { s: '#CL', p: 'type', a: '@sigargs' },
145
+ { s: '#ZZ', a: '@sigout' },
146
+ ],
147
+ },
148
+ args: {
149
+ open: [
150
+ { s: '#CP', b: 1 },
151
+ { p: 'arg' },
152
+ ],
153
+ close: [
154
+ { s: '#CP' },
155
+ ],
156
+ },
157
+ arg: {
158
+ open: [
159
+ { s: '#DD #TX', a: '@arg-rest' },
160
+ { s: '#TX #TX', a: '@arg-modename' },
161
+ { s: '#TX', a: '@arg-name' },
162
+ ],
163
+ close: [
164
+ { s: '#QM #CL', a: '@arg-opt', p: 'argtype' },
165
+ { s: '#CL', p: 'argtype' },
166
+ { s: '#CA', a: '@arg-done', r: 'arg' },
167
+ { s: '#CP', a: '@arg-done', b: 1 },
168
+ ],
169
+ },
170
+ argtype: {
171
+ open: [
172
+ { s: '#OP', p: 'group' },
173
+ { p: 'type' },
174
+ ],
175
+ close: [
176
+ {},
177
+ ],
178
+ },
179
+ type: {
180
+ open: [
181
+ { s: '#TX', a: '@type-word' },
182
+ ],
183
+ close: [
184
+ { s: '#PI', r: 'type' },
185
+ {},
186
+ ],
187
+ },
188
+ group: {
189
+ open: [
190
+ { p: 'gmember' },
191
+ ],
192
+ close: [
193
+ { s: '#CP' },
194
+ ],
195
+ },
196
+ gmember: {
197
+ open: [
198
+ { s: '#TX #TX', a: '@gm-two' },
199
+ { s: '#TX', a: '@gm-one' },
200
+ ],
201
+ close: [
202
+ { s: '#CA', a: '@gm-done', r: 'gmember' },
203
+ { s: '#CP', a: '@gm-done', b: 1 },
204
+ ],
205
+ },
206
+ },
207
+ });
208
+ }
209
+ let sigParser = undefined;
210
+ function makeSigParser() {
211
+ if (undefined === sigParser) {
212
+ sigParser = new parser_1.Tabnas({ plugins: [sigGrammar] });
213
+ }
214
+ return sigParser;
215
+ }
216
+ // Parse ONE declaration line. A malformed line is an Error: the
217
+ // declaration is repository content, read at build and test time, so
218
+ // failing loudly is the right shape (the round-trip suite holds the
219
+ // gate).
220
+ function parseSigLine(line) {
221
+ const tn = makeSigParser();
222
+ tn.sigErrs.length = 0;
223
+ const out = tn.parse(line);
224
+ if (0 < tn.sigErrs.length) {
225
+ throw new Error('signature: bad declaration ' +
226
+ tn.sigErrs.join(',') + ': ' + line);
227
+ }
228
+ if (null == out || '' === out.name || '' === out.out) {
229
+ throw new Error('signature: incomplete declaration: ' + line);
230
+ }
231
+ return out;
232
+ }
233
+ // Render one argument of a signature -- the piece the LSP's
234
+ // signatureHelp parameters share with the whole-line renderer.
235
+ function renderSigArg(a) {
236
+ const type = undefined === a.group ? a.type :
237
+ '(' + a.group.map((g) => ('value' === g.mode ? '' : g.mode + ' ') + g.type).join(', ') + ')';
238
+ return (true === a.rest ? '...' : '') +
239
+ ('value' === a.mode || true === a.rest ? '' : a.mode + ' ') +
240
+ a.name +
241
+ (true === a.opt ? '?' : '') +
242
+ ': ' + type;
243
+ }
244
+ // Render the canonical line for a parsed signature -- the round-trip
245
+ // twin of parseSigLine, and the one renderer every consumer (hints,
246
+ // docs, LSP) uses.
247
+ function renderSig(sig) {
248
+ return sig.name + '(' +
249
+ sig.args.map(renderSigArg).join(', ') + ') : ' + sig.out;
250
+ }
251
+ // Parse the whole declaration text: comment (#) and blank lines are
252
+ // the loader's to skip, one FuncSig per remaining line, name-keyed.
253
+ // A duplicate name is an error for the same reason a bad line is.
254
+ function parseSigText(text) {
255
+ const reg = {};
256
+ for (const rawline of text.split('\n')) {
257
+ const line = rawline.trim();
258
+ if ('' === line || line.startsWith('#')) {
259
+ continue;
260
+ }
261
+ const sig = parseSigLine(line);
262
+ if (undefined !== reg[sig.name]) {
263
+ throw new Error('signature: duplicate declaration: ' + sig.name);
264
+ }
265
+ reg[sig.name] = sig;
266
+ }
267
+ return reg;
268
+ }
269
+ // The parsed registry, built once from the inlined declaration -- the
270
+ // one source every consumer (the arity tables, the runtime gate, the
271
+ // hints, the docs table, the LSP) reads. A parse failure here throws
272
+ // at module load: the inlined text is repository content whose parse
273
+ // the round-trip suite gates, so a failure is a build defect, not a
274
+ // runtime condition. Twin: funcSig in go/sig.go.
275
+ const funcSig = parseSigText(sigdecl_1.SIGDECL); /* node:coverage ignore next 9 */
276
+ exports.funcSig = funcSig;
277
+ //# sourceMappingURL=sig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sig.js","sourceRoot":"","sources":["../src/sig.ts"],"names":[],"mappings":";AAAA,yDAA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+ "use strict";
2
+ /* Copyright (c) 2021-2026 Richard Rodger, MIT License */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SIGDECL = void 0;
5
+ // GENERATED by ts/scripts/sigdecl.cjs (`make sig`) from
6
+ // test/spec/signature.tsv — DO NOT EDIT. The declaration is the
7
+ // source (docs/design/SIGNATURES.0.md); ts/test/sig.test.ts asserts
8
+ // this copy is identical with the shared file.
9
+ const SIGDECL = "# 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) : string\nlower(s: string|number) : 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\n";
10
+ exports.SIGDECL = SIGDECL;
11
+ //# sourceMappingURL=sigdecl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sigdecl.js","sourceRoot":"","sources":["../src/sigdecl.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAEzD,wDAAwD;AACxD,gEAAgE;AAChE,oEAAoE;AACpE,+CAA+C;AAE/C,MAAM,OAAO,GACb,46EAA46E,CAAA;QAEn6E,OAAO"}
@@ -0,0 +1,4 @@
1
+ import type { Val } from './type';
2
+ import { AontuContext } from './ctx';
3
+ declare function sigRefuse(ctx: AontuContext, fn: any, args: Val[]): Val | undefined;
4
+ export { sigRefuse, };
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ /* Copyright (c) 2021-2026 Richard Rodger, MIT License */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.sigRefuse = sigRefuse;
5
+ const err_1 = require("./err");
6
+ const sig_1 = require("./sig");
7
+ const ScalarKindVal_1 = require("./val/ScalarKindVal");
8
+ // The scalar-kind words the gate enforces, each to its lattice
9
+ // marker. A declared type is gate-checkable only when EVERY union
10
+ // word is here: `any`, `constraint`, and the container words leave
11
+ // the argument to the builtin.
12
+ const SIG_KIND = new Map([
13
+ ['string', String],
14
+ ['number', Number],
15
+ ['integer', ScalarKindVal_1.Integer],
16
+ ['float', ScalarKindVal_1.Float],
17
+ ['biginteger', ScalarKindVal_1.BigInteger],
18
+ ['bigdecimal', ScalarKindVal_1.BigDecimal],
19
+ ['boolean', Boolean],
20
+ ['path', ScalarKindVal_1.Path],
21
+ ]);
22
+ function gateWords(type) {
23
+ const out = [];
24
+ for (const word of type.split('|')) {
25
+ const marker = SIG_KIND.get(word);
26
+ if (undefined === marker) {
27
+ return undefined;
28
+ }
29
+ out.push(marker);
30
+ }
31
+ return out;
32
+ }
33
+ // The declared type admits a driven Val when the Val is a concrete
34
+ // scalar whose leaf kind is, or sits below, one of the declared
35
+ // words -- the same walk subsumption makes, so `number` admits every
36
+ // numeric leaf and `string` admits a path value.
37
+ function admits(markers, arg) {
38
+ const leaf = arg.superior?.();
39
+ if (true !== arg.isScalar || true !== leaf?.isScalarKind) {
40
+ return false;
41
+ }
42
+ for (const marker of markers) {
43
+ if (marker === leaf.peg || (0, ScalarKindVal_1.kindSubsumes)(marker, leaf.peg)) {
44
+ return true;
45
+ }
46
+ }
47
+ return false;
48
+ }
49
+ // The gate. Answers the func_arg refusal, or undefined to let the
50
+ // call resolve.
51
+ function sigRefuse(ctx, fn, args) {
52
+ const sig = sig_1.funcSig[fn.funcname()];
53
+ // key() reads its level off the written peg and `key_level` names
54
+ // what is wrong with a bad one; the gate leaves the meaning where
55
+ // it lives.
56
+ if (undefined === sig || 'key' === sig.name) {
57
+ return undefined;
58
+ }
59
+ for (let i = 0; i < sig.args.length; i++) {
60
+ const a = sig.args[i];
61
+ if (true === a.rest) {
62
+ break;
63
+ }
64
+ if ('value' !== a.mode) {
65
+ continue;
66
+ }
67
+ const markers = gateWords(a.type);
68
+ if (undefined === markers) {
69
+ continue;
70
+ }
71
+ const arg = args[i];
72
+ if (undefined === arg || true === arg.isNil || true !== arg.done) {
73
+ continue;
74
+ }
75
+ const shaped = (true === arg.isScalar) ||
76
+ (true === arg.isMap) || (true === arg.isList) ||
77
+ (true === arg.isScalarKind);
78
+ if (shaped && !admits(markers, arg)) {
79
+ return (0, err_1.makeNilErr)(ctx, 'func_arg', fn, arg, undefined, {
80
+ func: sig.name,
81
+ sig: (0, sig_1.renderSig)(sig),
82
+ arg: a.name,
83
+ argn: '' + (i + 1),
84
+ got: arg.canon,
85
+ });
86
+ }
87
+ }
88
+ return undefined;
89
+ } /* node:coverage ignore next 5 */
90
+ //# sourceMappingURL=siggate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"siggate.js","sourceRoot":"","sources":["../src/siggate.ts"],"names":[],"mappings":";AAAA,yDAAyD;;QA8IvD,SAAS;AA/GX,+BAAkC;AAElC,+BAA0C;AAG1C,uDAO4B;AAG5B,+DAA+D;AAC/D,kEAAkE;AAClE,mEAAmE;AACnE,+BAA+B;AAC/B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAc;IACpC,CAAC,QAAQ,EAAE,MAAM,CAAC;IAClB,CAAC,QAAQ,EAAE,MAAM,CAAC;IAClB,CAAC,SAAS,EAAE,uBAAO,CAAC;IACpB,CAAC,OAAO,EAAE,qBAAK,CAAC;IAChB,CAAC,YAAY,EAAE,0BAAU,CAAC;IAC1B,CAAC,YAAY,EAAE,0BAAU,CAAC;IAC1B,CAAC,SAAS,EAAE,OAAO,CAAC;IACpB,CAAC,MAAM,EAAE,oBAAI,CAAC;CACf,CAAC,CAAA;AAGF,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,GAAG,GAAU,EAAE,CAAA;IACrB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACjC,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;YACzB,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAClB,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAGD,mEAAmE;AACnE,gEAAgE;AAChE,qEAAqE;AACrE,iDAAiD;AACjD,SAAS,MAAM,CAAC,OAAc,EAA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MAAM,GAAG,GAAQ,IAAI,CAAC,CAAC,CAAC,CAAA;QACxB,IAAI,SAAS,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,IAAI,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;YACjE,SAAQ;QACV,CAAC;QACD,MAAM,MAAM,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,QAAQ,CAAC;YACpC,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,MAAM,CAAC;YAC7C,CAAC,IAAI,KAAK,GAAG,CAAC,YAAY,CAAC,CAAA;QAC7B,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;YACpC,OAAO,IAAA,gBAAU,EAAC,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE;gBACrD,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,GAAG,EAAE,IAAA,eAAS,EAAC,GAAG,CAAC;gBACnB,GAAG,EAAE,CAAC,CAAC,IAAI;gBACX,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;gBAClB,GAAG,EAAE,GAAG,CAAC,KAAK;aACf,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC,CAAC,iCAAiC"}
package/dist/std.js CHANGED
@@ -33,9 +33,9 @@ std: {
33
33
  protocol?: string
34
34
  })
35
35
 
36
- # A node with ports. A Component that is not itself an entity is a
37
- # component OF its nearest identified ancestor, which is the
38
- # entity/component distinction and needs no mark of its own.
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
39
  Component: type({
40
40
  ports?: {&: $.std.Port}
41
41
  })
@@ -50,24 +50,83 @@ std: {
50
50
  ports?: {&: $.std.Port}
51
51
  })
52
52
 
53
- # A DECLARED RELATION. "target" is what the far end must satisfy,
54
- # "inverse" names the relation that must mirror it, and "acyclic"
55
- # asks that the edge set have no cycle. The last two are checked
56
- # AFTER unification, not by it: they are global and non-monotone ---
57
- # an acyclic graph becomes cyclic when one more edge unifies in ---
58
- # and no lattice citizen may be falsified by more information.
59
- Relation: type({
60
- target?: top
61
- inverse?: string
62
- acyclic?: *false | boolean
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 | tree | matrix | graph | layer | sets | layers | ladder
90
+ out: string
91
+
92
+ # Every kind.
93
+ as?: text | mermaid | dot | er | svg
94
+ at?: string
95
+ maxRows?: integer & min(0)
96
+
97
+ # doc: how many levels of key to draw.
98
+ depth?: integer & min(0)
99
+
100
+ # tree, matrix, layer: the relation drawn. graph: the predicates
101
+ # kept. tree: the subtrees drawn.
102
+ relation?: string
103
+ relations?: [&: string]
104
+ roots?: [&: string]
105
+
106
+ # matrix.
107
+ order?: canon | partition
108
+ closure?: boolean
109
+
110
+ # graph, layer.
111
+ groupBy?: string
112
+ label?: string
113
+ layers?: [&: string]
114
+ edges?: upward | all | none
115
+
116
+ # sets, layers.
117
+ sets?: string
118
+ member?: string
119
+ universe?: string
120
+ minDegree?: integer & min(0)
121
+ maxCols?: integer & min(0)
122
+ minSize?: integer & min(0)
63
123
  })
64
124
  }
65
125
  `;
66
- // The bundled sources, by the name a document writes. Both the bare
67
- // name and the `.aon` spelling resolve, because both are what an
68
- // author reaches for.
69
126
  exports.STD_SOURCES = {
70
127
  'std/system': STD_SYSTEM,
71
128
  'std/system.aon': STD_SYSTEM,
129
+ 'std/view': STD_VIEW,
130
+ 'std/view.aon': STD_VIEW,
72
131
  };
73
132
  //# sourceMappingURL=std.js.map
package/dist/std.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"std.js","sourceRoot":"","sources":["../src/std.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAEpD,sCAAsC;AACtC,uEAAuE;AACvE,uEAAuE;AACvE,mEAAmE;AACnE,sEAAsE;AACtE,4BAA4B;AAC5B,EAAE;AACF,qEAAqE;AACrE,oEAAoE;AACpE,oEAAoE;AACpE,uEAAuE;AACvE,qCAAqC;AAErC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDlB,CAAA;AAGD,oEAAoE;AACpE,iEAAiE;AACjE,sBAAsB;AACT,QAAA,WAAW,GAA2B;IACjD,YAAY,EAAE,UAAU;IACxB,gBAAgB,EAAE,UAAU;CAC7B,CAAA"}
1
+ {"version":3,"file":"std.js","sourceRoot":"","sources":["../src/std.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAEpD,sCAAsC;AACtC,uEAAuE;AACvE,uEAAuE;AACvE,mEAAmE;AACnE,sEAAsE;AACtE,4BAA4B;AAC5B,EAAE;AACF,qEAAqE;AACrE,oEAAoE;AACpE,oEAAoE;AACpE,uEAAuE;AACvE,qCAAqC;AAErC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyClB,CAAA;AAGD,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEhB,CAAA;AAGY,QAAA,WAAW,GAA2B;IACjD,YAAY,EAAE,UAAU;IACxB,gBAAgB,EAAE,UAAU;IAC5B,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,QAAQ;CACzB,CAAA"}
package/dist/subsume.js CHANGED
@@ -9,6 +9,7 @@ const vet_1 = require("./vet");
9
9
  const hcanon_1 = require("./hcanon");
10
10
  const ConstraintVal_1 = require("./val/ConstraintVal");
11
11
  const ScalarKindVal_1 = require("./val/ScalarKindVal");
12
+ const PathVal_1 = require("./val/PathVal");
12
13
  const PrefVal_1 = require("./val/PrefVal");
13
14
  const DEFAULT_GENERAL_URL = 'general';
14
15
  const DEFAULT_SPECIFIC_URL = 'specific';
@@ -253,6 +254,20 @@ function subsumeNode(state, path, g0, s0) {
253
254
  record(state, 'compat_narrowed', path, g, s, 'the general kind admits no such value');
254
255
  return 'no';
255
256
  }
257
+ // Container kinds (docs/design/PATHS.0.md): `map()` subsumes every
258
+ // map and itself, `list()` every list. The unit literals (`{}`,
259
+ // `[]`) already subsume through the container rules; only the kind
260
+ // former needs an arm.
261
+ if (true === g?.isContainerKind) {
262
+ const ga = g;
263
+ const sa = s;
264
+ if ((true === ga.isMapKind && (true === sa?.isMap || true === sa?.isMapKind))
265
+ || (true === ga.isListKind && (true === sa?.isList || true === sa?.isListKind))) {
266
+ return 'yes';
267
+ }
268
+ record(state, 'compat_narrowed', path, g, s, 'the general container kind admits no such value');
269
+ return 'no';
270
+ }
256
271
  // Constraint residuals.
257
272
  if (true === g?.isConstraint) {
258
273
  if (true === s?.isConstraint) {
@@ -283,8 +298,14 @@ function subsumeNode(state, path, g0, s0) {
283
298
  return 'no';
284
299
  }
285
300
  // Concrete scalars subsume only themselves (identity compares kind
286
- // as well as value).
301
+ // as well as value) -- except paths, whose meet is the prefix rule
302
+ // (ADR-016): a prefix admits every extension of itself, so it
303
+ // subsumes one, exactly as the meet answers the longer.
287
304
  if (true === g?.isScalar) {
305
+ if (true === g.isPath && true === s?.isPath &&
306
+ (0, PathVal_1.prefixMeet)(g.peg, s.peg) === s.peg) {
307
+ return 'yes';
308
+ }
288
309
  if (true === s?.isScalar && true === g.same?.(s)) {
289
310
  return 'yes';
290
311
  }
@@ -310,13 +331,29 @@ function subsumeNode(state, path, g0, s0) {
310
331
  const sk = s.peg.map((_, i) => '' + i);
311
332
  return subsumeBag(state, path, g, s, gk, sk, (v, k) => v.peg[Number(k)]);
312
333
  }
313
- // The ladder above is total in practice: every evaluated former is a
314
- // scalar, kind, constraint, map, list, disjunct, or top, or is caught
315
- // by admission (pref) or unresolved (ref, var, conjunct, expect,
316
- // func). The arm is kept because "in practice" is evaluation's
317
- // property, not this walk's, and a future value class (or a nil, see
318
- // the top rule) must land on an honest `undecided`, not fall out of
319
- // the walk with no answer.
334
+ // THE LADDER IS NOT TOTAL, and the formers that fall past it are the
335
+ // ones the evaluator MEANS to leave standing: a recursion, a
336
+ // relation and its graph atom, a `refer()` target constraint. None
337
+ // of them describes a set of values a structural walk can compare,
338
+ // so `undecided` is the honest answer for two DIFFERENT ones.
339
+ //
340
+ // For two IDENTICAL ones it is not. REFLEXIVITY IS A LAW -- every
341
+ // value admits itself -- and identity is the HASH FORM, the same
342
+ // rule the unresolved branch above applies and for the same reason:
343
+ // it costs nothing, because it runs only where the answer would
344
+ // otherwise be `undecided`. Without it a document that declares a
345
+ // relation, shares a template by reference or alias, or recurses did
346
+ // not subsume ITSELF, so `breaking` on the idiom the language exists
347
+ // for hard-failed and had to run --allow-undecided, which masks the
348
+ // genuine undecideds it exists to surface (use-cases/BUGS.md 64,
349
+ // and 28 before it).
350
+ //
351
+ // A NIL is the exception, and the reason the law is spelled here
352
+ // rather than in `unresolved`: a nil is not a value, so it admits
353
+ // nothing, itself included.
354
+ if (true !== g?.isNil && true !== s?.isNil && (0, hcanon_1.hcanon)(g) === (0, hcanon_1.hcanon)(s)) {
355
+ return 'yes';
356
+ }
320
357
  record(state, 'sub_unresolved', path, g, s, 'no subsumption rule covers this pair of value formers');
321
358
  return 'undecided';
322
359
  }
@@ -373,11 +410,21 @@ function subsumeBag(state, path, g, s, gKeys, sKeys, child) {
373
410
  }
374
411
  }
375
412
  // Spread templates: a path-dependent template's meaning depends on
376
- // where it lands, which no structural comparison can decide.
413
+ // where it lands, which no structural comparison can decide -- UNLESS
414
+ // the two templates are the same template. REFLEXIVITY IS A LAW and
415
+ // identity is the HASH FORM (the same rule the unresolved branch of
416
+ // subsumeNode applies): two byte-identical templates admit the same
417
+ // set wherever they land, so a document with a reference- or
418
+ // alias-valued template subsumes itself, and the comparison either
419
+ // side of the template is decided on its own merits rather than
420
+ // dragged to `undecided` (use-cases/BUGS.md 64). Where they are NOT
421
+ // identical, nothing structural can decide them and the fold stands.
377
422
  const gcj = g.spread?.cj;
378
423
  const scj = s.spread?.cj;
379
424
  if (null != gcj || null != scj) {
380
- if (true === gcj?.isPathDependent || true === scj?.isPathDependent) {
425
+ const sameTemplate = null != gcj && null != scj && (0, hcanon_1.hcanon)(gcj) === (0, hcanon_1.hcanon)(scj);
426
+ if (!sameTemplate &&
427
+ (true === gcj?.isPathDependent || true === scj?.isPathDependent)) {
381
428
  record(state, 'sub_path_dependent_spread', path, gcj ?? g, scj ?? s, 'a path-dependent spread template cannot be compared structurally');
382
429
  worse('undecided');
383
430
  }