aontu 0.57.0 → 0.59.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 (132) hide show
  1. package/README.md +2 -2
  2. package/dist/agentsmd.js +1 -1
  3. package/dist/alias.d.ts +3 -0
  4. package/dist/alias.js +59 -0
  5. package/dist/alias.js.map +1 -0
  6. package/dist/aontu.d.ts +4 -2
  7. package/dist/aontu.js +12 -3
  8. package/dist/aontu.js.map +1 -1
  9. package/dist/cli.d.ts +3 -1
  10. package/dist/cli.js +486 -4
  11. package/dist/cli.js.map +1 -1
  12. package/dist/ctx.d.ts +4 -0
  13. package/dist/ctx.js +3 -0
  14. package/dist/ctx.js.map +1 -1
  15. package/dist/err.js +6 -3
  16. package/dist/err.js.map +1 -1
  17. package/dist/format.js +8 -2
  18. package/dist/format.js.map +1 -1
  19. package/dist/hints.js +40 -9
  20. package/dist/hints.js.map +1 -1
  21. package/dist/lang.js +409 -58
  22. package/dist/lang.js.map +1 -1
  23. package/dist/lower.d.ts +20 -0
  24. package/dist/lower.js +575 -0
  25. package/dist/lower.js.map +1 -0
  26. package/dist/lsp.d.ts +1 -1
  27. package/dist/lsp.js +1 -1
  28. package/dist/lsp.js.map +1 -1
  29. package/dist/mcp-server.js +1 -1
  30. package/dist/mcp.d.ts +1 -0
  31. package/dist/mcp.js +40 -3
  32. package/dist/mcp.js.map +1 -1
  33. package/dist/render.d.ts +53 -0
  34. package/dist/render.js +542 -0
  35. package/dist/render.js.map +1 -0
  36. package/dist/sigdecl.js +1 -1
  37. package/dist/sigdecl.js.map +1 -1
  38. package/dist/std.d.ts +2 -0
  39. package/dist/std.js +498 -2
  40. package/dist/std.js.map +1 -1
  41. package/dist/template.d.ts +5 -0
  42. package/dist/template.js +257 -0
  43. package/dist/template.js.map +1 -0
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/dist/type.d.ts +2 -0
  46. package/dist/type.js.map +1 -1
  47. package/dist/unify.js +43 -0
  48. package/dist/unify.js.map +1 -1
  49. package/dist/val/AggFuncVal.d.ts +1 -1
  50. package/dist/val/AggFuncVal.js +10 -21
  51. package/dist/val/AggFuncVal.js.map +1 -1
  52. package/dist/val/BagVal.js +1 -1
  53. package/dist/val/BagVal.js.map +1 -1
  54. package/dist/val/ConstraintVal.js +1 -1
  55. package/dist/val/DisjunctVal.js +33 -2
  56. package/dist/val/DisjunctVal.js.map +1 -1
  57. package/dist/val/EachFuncVal.d.ts +1 -1
  58. package/dist/val/EachFuncVal.js +8 -13
  59. package/dist/val/EachFuncVal.js.map +1 -1
  60. package/dist/val/EmitFuncVal.d.ts +23 -4
  61. package/dist/val/EmitFuncVal.js +298 -28
  62. package/dist/val/EmitFuncVal.js.map +1 -1
  63. package/dist/val/FilterFuncVal.js +8 -4
  64. package/dist/val/FilterFuncVal.js.map +1 -1
  65. package/dist/val/FormFuncVal.d.ts +14 -0
  66. package/dist/val/FormFuncVal.js +55 -0
  67. package/dist/val/FormFuncVal.js.map +1 -0
  68. package/dist/val/FuncBaseVal.js +36 -13
  69. package/dist/val/FuncBaseVal.js.map +1 -1
  70. package/dist/val/ListVal.js +9 -1
  71. package/dist/val/ListVal.js.map +1 -1
  72. package/dist/val/MapVal.d.ts +2 -1
  73. package/dist/val/MapVal.js +2 -1
  74. package/dist/val/MapVal.js.map +1 -1
  75. package/dist/val/PackFuncVal.d.ts +1 -1
  76. package/dist/val/PackFuncVal.js +22 -18
  77. package/dist/val/PackFuncVal.js.map +1 -1
  78. package/dist/val/PlaceVal.js +7 -2
  79. package/dist/val/PlaceVal.js.map +1 -1
  80. package/dist/val/RefVal.d.ts +3 -0
  81. package/dist/val/RefVal.js +181 -18
  82. package/dist/val/RefVal.js.map +1 -1
  83. package/dist/val/Val.d.ts +8 -1
  84. package/dist/val/Val.js +39 -1
  85. package/dist/val/Val.js.map +1 -1
  86. package/dist/val/members.d.ts +9 -0
  87. package/dist/val/members.js +52 -0
  88. package/dist/val/members.js.map +1 -0
  89. package/grammar/aontu.abnf +1 -1
  90. package/grammar/aontu.gbnf +1 -1
  91. package/grammar/aontu.lark +1 -1
  92. package/grammar/aontu.tmLanguage.json +1 -1
  93. package/package.json +1 -1
  94. package/skill/SKILL.md +4 -4
  95. package/skill/error-codes.md +1 -1
  96. package/skill/examples.md +1 -1
  97. package/skill/grammar-card.md +1 -1
  98. package/src/agentsmd.ts +1 -1
  99. package/src/alias.ts +112 -0
  100. package/src/aontu.ts +20 -2
  101. package/src/cli.ts +528 -4
  102. package/src/ctx.ts +18 -0
  103. package/src/err.ts +6 -3
  104. package/src/format.ts +12 -2
  105. package/src/hints.ts +47 -9
  106. package/src/lang.ts +453 -63
  107. package/src/lower.ts +636 -0
  108. package/src/lsp.ts +1 -1
  109. package/src/mcp-server.ts +1 -1
  110. package/src/mcp.ts +43 -4
  111. package/src/render.ts +727 -0
  112. package/src/sigdecl.ts +1 -1
  113. package/src/std.ts +506 -1
  114. package/src/template.ts +291 -0
  115. package/src/type.ts +10 -1
  116. package/src/unify.ts +47 -0
  117. package/src/val/AggFuncVal.ts +10 -21
  118. package/src/val/BagVal.ts +1 -1
  119. package/src/val/ConstraintVal.ts +1 -1
  120. package/src/val/DisjunctVal.ts +33 -2
  121. package/src/val/EachFuncVal.ts +8 -16
  122. package/src/val/EmitFuncVal.ts +376 -39
  123. package/src/val/FilterFuncVal.ts +11 -4
  124. package/src/val/FormFuncVal.ts +119 -0
  125. package/src/val/FuncBaseVal.ts +36 -13
  126. package/src/val/ListVal.ts +9 -1
  127. package/src/val/MapVal.ts +3 -2
  128. package/src/val/PackFuncVal.ts +23 -19
  129. package/src/val/PlaceVal.ts +7 -2
  130. package/src/val/RefVal.ts +193 -20
  131. package/src/val/Val.ts +75 -4
  132. package/src/val/members.ts +86 -0
package/dist/render.js ADDED
@@ -0,0 +1,542 @@
1
+ "use strict";
2
+ /* Copyright (c) 2025 Richard Rodger, MIT License */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.render = render;
5
+ exports.renderProfile = renderProfile;
6
+ exports.renderValue = renderValue;
7
+ // THE RENDERER (docs/design/RENDER.0.md; docs/capability-review/
8
+ // g9-transformation.md §3). `render` evaluates a document, takes the
9
+ // value at `--at` (the root by default), vets it against the bundled
10
+ // `aontu:code` vocabulary, and folds `code.units` into bytes;
11
+ // `renderValue` is the fold alone, over `generate()` output. The fold
12
+ // is pure and total: it never touches the Val tree, never reads or
13
+ // writes a file, never sorts and never iterates a map, and every piece
14
+ // of a fragment carries its own depth (`at`), so the renderer owns
15
+ // every prefix and no piece nests another (the second amendment's
16
+ // fragment algebra, RENDER.0.md D2 and D6).
17
+ //
18
+ // WHAT THIS PHASE RENDERS (RENDER.0.md P3): fragments -- a line, a
19
+ // blank run, a raw block, a bare string piece, a reference inline --
20
+ // and the `text` escape, under a profile that knows its language. The
21
+ // one bundled profile is `aontu:lang/text`, which every fragment-only
22
+ // unit falls back to; a declaration (`record`, `enum`, ...) needs a
23
+ // LOWERING, which P5 brings with the TypeScript and Go profiles, and
24
+ // until then is `render_profile`.
25
+ const aontu_1 = require("./aontu");
26
+ const vet_1 = require("./vet");
27
+ const hcanon_1 = require("./hcanon");
28
+ const err_1 = require("./err");
29
+ const keyorder_1 = require("./keyorder");
30
+ const utility_1 = require("./utility");
31
+ const lower_1 = require("./lower");
32
+ const VOCABULARY = '@"aontu:code"';
33
+ // The bundled profiles, by lang: aontu:lang/<lang>.
34
+ const BUNDLED_LANGS = ['go', 'text', 'typescript'];
35
+ const PROFILE_VOCABULARY = '@"aontu:profile"';
36
+ function finding(code, cls, path, message) {
37
+ return { code, class: cls, severity: 'error', path, message, sites: [] };
38
+ }
39
+ function errorReport(errors) {
40
+ return { verdict: 'error', units: [], lossy: [], errors };
41
+ }
42
+ // The verb's evaluation, before the fold (RENDER.0.md D1): evaluate,
43
+ // anchor, vet the anchored value against the vocabulary as `aontu vet`
44
+ // would, and generate the MEET of the two -- so the vocabulary's
45
+ // defaults (`at: 0`, `n: 1`, `reindent: true`) are in the instance the
46
+ // fold reads, whether or not the document included the vocabulary
47
+ // itself. THE VET AND THE MEET READ THE SETTLED VALUE, re-sourced
48
+ // through its hash form (valid source that evaluates to the same
49
+ // value), not the document's text: a fragment's lines are what a
50
+ // transform COMPUTED -- an `emit`, a `join` -- and the vocabulary's
51
+ // alternatives are tried against values, not against calls that are
52
+ // still waiting to fire. A finding from that vet therefore addresses
53
+ // the instance by path, which is the addressing every render finding
54
+ // uses (G9 §3); a document that does not stand up at all is reported
55
+ // with its own sites, before any of this.
56
+ function render(src, options) {
57
+ const opts = options ?? {};
58
+ const aontu = new aontu_1.Aontu((0, utility_1.includeOpts)(opts));
59
+ // THE RECORDER (P7), on for a run that was asked for a trace or a
60
+ // coverage report and off for every other. Its presence is the one
61
+ // switch: the read set fills as references resolve, and the two
62
+ // riders that carry a read address and a dispatch stamp are written
63
+ // only while it is there.
64
+ const rec = true === opts.trace || true === opts.coverage;
65
+ const reads = rec ? new Set() : undefined;
66
+ // COLLECT MODE, so a syntax error arrives on the context rather than
67
+ // as a throw (the jsonschema and vet precedent; no try/catch, for
68
+ // the reason those verbs have none).
69
+ const actx = aontu.ctx({ collect: true, reads });
70
+ const root = aontu.unify(src, { path: opts.path, collect: true }, actx);
71
+ if (0 < actx.err.length || true === root?.isNil) {
72
+ return errorReport([(0, vet_1.failureFinding)(actx, opts.path, root)]);
73
+ }
74
+ let node = root;
75
+ if (null != opts.at && '' !== opts.at) {
76
+ const found = (0, vet_1.anchorAt)(root, opts.at);
77
+ if (null == found) {
78
+ // The anchor names nothing: a `no_path` nil through the finding
79
+ // shape every other refusal here uses.
80
+ const nil = (0, err_1.makeNilErr)(actx, 'no_path', root, undefined, 'at');
81
+ actx.err.push(nil);
82
+ return errorReport([(0, vet_1.failureFinding)(actx, opts.path, root)]);
83
+ }
84
+ node = found;
85
+ }
86
+ // UNDER NO CALLER CAPABILITY, here and in the meet below: the
87
+ // vocabulary is the engine's own and the instance is a canon, which
88
+ // includes nothing, so the caller's include capability -- which
89
+ // governs the DOCUMENT -- has nothing to govern here, and `none`
90
+ // must not deny the renderer its own schema.
91
+ const value = (0, hcanon_1.hcanon)(node);
92
+ const report = (0, vet_1.vet)(VOCABULARY, value);
93
+ if ('valid' !== report.verdict) {
94
+ return errorReport(report.findings);
95
+ }
96
+ // The meet, keyed: the vocabulary's root holds `code`, and so does
97
+ // the instance's (a value the vet admitted is a map), and a document
98
+ // with no `code` at all is the vocabulary's own empty instance.
99
+ const codeVal = node.peg.code;
100
+ const instance = new aontu_1.Aontu().generate(VOCABULARY + (undefined === codeVal ? '' : '\ncode: ' + (0, hcanon_1.hcanon)(codeVal)));
101
+ const folded = renderValue(instance, opts);
102
+ // THE TWO REPORTS ARE JOINED TO THE FOLD BY PATH (P7), which is what
103
+ // lets the fold stay the pure total function D6 asks for: the
104
+ // dispatch stamps ride the VALUE, the instance the fold reads is
105
+ // that value re-sourced through its hash form, and a piece is at the
106
+ // same path in both. Nothing to report on `error`: there are no
107
+ // units to attribute pieces to.
108
+ if (rec && 'error' !== folded.verdict) {
109
+ const marks = emitted(node);
110
+ const trace = traceOf(marks, instance, folded.units);
111
+ // AN EMPTY TRACE IS NO TRACE, in both ports: Go omits an empty
112
+ // slice, and a report shape that differed by port would be the one
113
+ // thing the shared rows exist to refuse. A run that emitted no
114
+ // piece has nothing to attribute, and the coverage report says so
115
+ // in its own words.
116
+ if (0 < trace.length) {
117
+ folded.trace = trace;
118
+ }
119
+ if (true === opts.coverage) {
120
+ const cov = coverOf(root, node, reads, opts, marks, instance, folded.units);
121
+ if (undefined === cov) {
122
+ const nil = (0, err_1.makeNilErr)(actx, 'no_path', root, undefined, 'coverageAt');
123
+ actx.err.push(nil);
124
+ return errorReport([(0, vet_1.failureFinding)(actx, opts.path, root)]);
125
+ }
126
+ folded.coverage = cov;
127
+ }
128
+ }
129
+ return folded;
130
+ }
131
+ // ---------------------------------------------------------------------
132
+ // THE TRACE AND THE COVERAGE REPORT (RENDER.0.md D11, P7).
133
+ // The one walk order both ports walk in: a list by index, a map by key
134
+ // in code-point order. `fn` answers whether to descend.
135
+ function walkVals(root, fn) {
136
+ const walk = (v, path) => {
137
+ if (null == v || true !== v.isVal || !fn(v, path)) {
138
+ return;
139
+ }
140
+ if (true === v.isList && null != v.peg) {
141
+ for (let i = 0; i < v.peg.length; i++) {
142
+ walk(v.peg[i], [...path, String(i)]);
143
+ }
144
+ }
145
+ else if (true === v.isMap && null != v.peg) {
146
+ for (const k of Object.keys(v.peg).sort(keyorder_1.cmpCodePoint)) {
147
+ // AN ALIAS DECLARATION IS NOT A MEMBER, here for the reason
148
+ // every fold has it (./val/members.ts): `%wire = …` holds a
149
+ // value the document never generates, so it is neither a piece
150
+ // to trace nor model that could be called dead.
151
+ if (!v.aliasKeys.includes(k)) {
152
+ walk(v.peg[k], [...path, k]);
153
+ }
154
+ }
155
+ }
156
+ };
157
+ walk(root, []);
158
+ }
159
+ // A path as an address: `$`, then a dot before every segment.
160
+ function addr(path) {
161
+ return '$' + path.map((seg) => '.' + seg).join('');
162
+ }
163
+ // Every piece a dispatch stamped, under the anchored value, in
164
+ // document order. The path is relative to the anchor, which is where
165
+ // the instance the fold reads is rooted too.
166
+ function emitted(node) {
167
+ const out = [];
168
+ walkVals(node, (v, path) => {
169
+ if (null != v.emitted) {
170
+ out.push({ path: addr(path), mark: v.emitted });
171
+ }
172
+ return true;
173
+ });
174
+ return out;
175
+ }
176
+ // The trace: one entry per stamped piece that a RENDERED unit holds. A
177
+ // piece is IN the unit whose path prefixes its own, which is the whole
178
+ // of the question -- no path is parsed, and a stamp that lies under no
179
+ // unit at all (a rule set held under a key of its own, and referred to
180
+ // from a unit) simply matches nothing. A unit the run did not render
181
+ // (`--unit` names one) has no bytes for a piece of it to be in, so it
182
+ // is not among the prefixes either.
183
+ function traceOf(marks, instance, units) {
184
+ const pre = [];
185
+ unitList(instance).forEach((u, i) => {
186
+ if (units.some((r) => r.path === u.path)) {
187
+ pre.push({ at: '$.code.units.' + i, path: u.path });
188
+ }
189
+ });
190
+ const out = [];
191
+ for (const m of marks) {
192
+ const hit = pre.find((p) => m.path === p.at || m.path.startsWith(p.at + '.'));
193
+ if (undefined === hit) {
194
+ continue;
195
+ }
196
+ out.push({ unit: hit.path, piece: m.path, node: m.mark.node, rule: m.mark.rule });
197
+ }
198
+ return out;
199
+ }
200
+ // Every proper ancestor of an address, `$` included.
201
+ function ancestors(a) {
202
+ const parts = a.split('.');
203
+ const out = [];
204
+ for (let i = 1; i < parts.length; i++) {
205
+ out.push(parts.slice(0, i).join('.'));
206
+ }
207
+ return out;
208
+ }
209
+ // Is the value at `a` covered by the set -- the address itself in it,
210
+ // or an address above it? An address ABOVE it covers the whole subtree:
211
+ // a reference that read `$.schema` read everything under it, and a rule
212
+ // that emitted a unit emitted every declaration in it.
213
+ function covered(set, a) {
214
+ if (set.has(a)) {
215
+ return true;
216
+ }
217
+ for (const up of ancestors(a)) {
218
+ if (set.has(up)) {
219
+ return true;
220
+ }
221
+ }
222
+ return false;
223
+ }
224
+ // THE COVERAGE REPORT (P7). Dead model is measured over the DOCUMENT
225
+ // ROOT, or under `coverageAt` when a document keeps its model under one
226
+ // key (X-3, decided here): the read set is absolute, so a narrower
227
+ // measure is a narrower walk, not a different origin. The render's own
228
+ // output -- `code` under the anchor -- is not model and is never
229
+ // walked into: nothing reads it, so every document would otherwise
230
+ // report it dead.
231
+ function coverOf(root, node, reads, opts, marks, instance, units) {
232
+ // THE ANCHOR IS THE ONE render() ALREADY FOUND, so `code` under it is
233
+ // named without asking a second time: `--at` is resolved before the
234
+ // vet, and an anchor that named nothing never reached here.
235
+ const codeAddr = addr(node.path.concat('code'));
236
+ let from = root;
237
+ let base = [];
238
+ if (null != opts.coverageAt && '' !== opts.coverageAt) {
239
+ const found = (0, vet_1.anchorAt)(root, opts.coverageAt);
240
+ if (null == found) {
241
+ return undefined;
242
+ }
243
+ from = found;
244
+ base = found.path;
245
+ }
246
+ // The two questions asked of the read set, as sets: is this address
247
+ // read (or under one that is), and does a read lie BELOW it?
248
+ const above = new Set(reads);
249
+ const below = new Set();
250
+ for (const r of reads) {
251
+ for (const up of ancestors(r)) {
252
+ below.add(up);
253
+ }
254
+ }
255
+ const dead = [];
256
+ walkVals(from, (_v, path) => {
257
+ const a = addr(base.concat(path));
258
+ if (a === codeAddr || covered(above, a)) {
259
+ return false;
260
+ }
261
+ // THE ROOT OF THE MEASURE IS NEVER ITSELF DEAD MODEL, and is
262
+ // descended into whatever the read set holds. A document that is
263
+ // only a transform reads nothing above its own model, and naming
264
+ // the root there would report the whole document dead while its
265
+ // one live subtree sat inside it.
266
+ if (below.has(a) || 0 === path.length) {
267
+ return true;
268
+ }
269
+ dead.push(a);
270
+ return false;
271
+ });
272
+ // A SILENT HOLE: a declaration of a rendered unit that no stamp
273
+ // touches -- neither its own, nor one on the unit above it, nor one
274
+ // on a piece inside it.
275
+ const stamped = new Set(marks.map((m) => m.path));
276
+ const inside = new Set();
277
+ for (const m of marks) {
278
+ for (const up of ancestors(m.path)) {
279
+ inside.add(up);
280
+ }
281
+ }
282
+ const unruled = [];
283
+ unitList(instance).forEach((unit, i) => {
284
+ if (!units.some((u) => u.path === unit.path)) {
285
+ return;
286
+ }
287
+ const decls = unit.decls;
288
+ decls.forEach((_d, j) => {
289
+ const a = '$.code.units.' + i + '.decls.' + j;
290
+ if (!covered(stamped, a) && !inside.has(a)) {
291
+ unruled.push({ unit: unit.path, path: a });
292
+ }
293
+ });
294
+ });
295
+ return { read: [...reads].sort(keyorder_1.cmpCodePoint), dead, unruled };
296
+ }
297
+ // The bundled text profile, evaluated once: the profile of a unit
298
+ // whose declarations are fragments and text escapes only.
299
+ const bundled = {};
300
+ // A bundled profile, evaluated once: the meet of aontu:lang/<lang>
301
+ // with the vocabulary, so its defaults are in it.
302
+ function bundledProfile(lang) {
303
+ if (!BUNDLED_LANGS.includes(lang)) {
304
+ return undefined;
305
+ }
306
+ if (undefined === bundled[lang]) {
307
+ bundled[lang] = new aontu_1.Aontu().generate('@"aontu:lang/' + lang + '"').profile;
308
+ }
309
+ return bundled[lang];
310
+ }
311
+ // PROFILE SELECTION, per unit (RENDER.0.md D5): a caller-supplied
312
+ // profile whose `lang` is the unit's; else the bundled profile of that
313
+ // `lang`; else `aontu:lang/text`, if and only if every declaration in
314
+ // the unit is a fragment or a text escape; else nothing, which the
315
+ // caller reports as `render_profile`. The unit's inline `profile` is
316
+ // merged over whichever base was found.
317
+ function profileFor(lang, given, fragOnly) {
318
+ const supplied = (given ?? []).find((p) => p?.lang === lang);
319
+ if (undefined !== supplied) {
320
+ return supplied;
321
+ }
322
+ const own = bundledProfile(lang);
323
+ if (undefined !== own) {
324
+ return own;
325
+ }
326
+ return fragOnly ? bundledProfile('text') : undefined;
327
+ }
328
+ function isMap(v) {
329
+ return null != v && 'object' === typeof v && !Array.isArray(v);
330
+ }
331
+ // An inline profile merged over its base, map by map, the inline
332
+ // value winning at a leaf; keys in code-point order, so the merge is
333
+ // the same in both ports.
334
+ function mergeProfile(base, over) {
335
+ const out = { ...base };
336
+ for (const k of Object.keys(over).sort(keyorder_1.cmpCodePoint)) {
337
+ out[k] = isMap(base[k]) && isMap(over[k]) ?
338
+ mergeProfile(base[k], over[k]) : over[k];
339
+ }
340
+ return out;
341
+ }
342
+ // THE FOLD (RENDER.0.md D6). `pad(at)` is `indent.unit` repeated
343
+ // `indent.width × at` times; a line is `pad + text + LF`, and an empty
344
+ // text emits no pad; a blank is its terminators alone; a raw block's
345
+ // lines each get the pad unless `reindent: false`, which emits them
346
+ // at column 0 verbatim -- and common leading indentation is never
347
+ // stripped. A reference inline is its name, verbatim (a
348
+ // declaration-capable profile puts it through its identifier rules,
349
+ // P5). Nothing is trimmed (D3): the text is the transform's.
350
+ // A profile with no indent -- a caller-supplied map the vocabulary
351
+ // never filled -- takes the vocabulary's own default, two spaces.
352
+ function pad(profile, at) {
353
+ const indent = profile.indent ?? { unit: ' ', width: 2 };
354
+ return (indent.unit ?? ' ').repeat((indent.width ?? 2) * at);
355
+ }
356
+ function line(profile, at, text) {
357
+ return ('' === text ? '' : pad(profile, at)) + text + '\n';
358
+ }
359
+ // A reference inline is its name: through the profile's identifier
360
+ // rules under a lowering, verbatim under text.
361
+ function inline(piece, ctx) {
362
+ if ('string' === typeof piece) {
363
+ return piece;
364
+ }
365
+ return undefined === ctx ? piece.name : (0, lower_1.ident)(piece.name, 'record', ctx, '', false);
366
+ }
367
+ function foldPiece(piece, profile, unit, path, lossy, ctx) {
368
+ if ('string' === typeof piece) {
369
+ return line(profile, 0, piece);
370
+ }
371
+ if ('line' === piece.k) {
372
+ return line(profile, piece.at ?? 0, piece.of.map((p) => inline(p, ctx)).join(''));
373
+ }
374
+ if ('blank' === piece.k) {
375
+ return '\n'.repeat(piece.n ?? 1);
376
+ }
377
+ lossy.push({
378
+ unit, path, tier: 3, construct: 'raw',
379
+ reason: 'verbatim text: the renderer re-indents it and checks nothing else',
380
+ });
381
+ const at = piece.at ?? 0;
382
+ const reindent = piece.reindent ?? true;
383
+ const lines = piece.text.split('\n');
384
+ if ('' === lines[lines.length - 1]) {
385
+ lines.pop();
386
+ }
387
+ return lines.map((l) => reindent ? line(profile, at, l) : l + '\n').join('');
388
+ }
389
+ // A PROFILE DOCUMENT (RENDER.0.md D5), evaluated the way `render`
390
+ // evaluates its own: under the caller's include options, then vetted
391
+ // against aontu:profile as a settled value and met with that vocabulary
392
+ // so its defaults (`indent.width: 2`, ...) are in it. The answer is the
393
+ // `profile` map the fold reads -- what `--profile <file>` hands to
394
+ // RenderOptions.profiles -- or the findings that refused the document:
395
+ // one that does not stand up, or one the vocabulary rejects.
396
+ function renderProfile(src, options) {
397
+ const opts = options ?? {};
398
+ const aontu = new aontu_1.Aontu((0, utility_1.includeOpts)(opts));
399
+ const actx = aontu.ctx({ collect: true });
400
+ const root = aontu.unify(src, { path: opts.path, collect: true }, actx);
401
+ if (0 < actx.err.length || true === root?.isNil) {
402
+ return { errors: [(0, vet_1.failureFinding)(actx, opts.path, root)] };
403
+ }
404
+ const report = (0, vet_1.vet)(PROFILE_VOCABULARY, (0, hcanon_1.hcanon)(root));
405
+ if ('valid' !== report.verdict) {
406
+ return { errors: report.findings };
407
+ }
408
+ // The meet, keyed as render's is: the vocabulary requires `profile`,
409
+ // so a value the vet admitted has one.
410
+ const instance = new aontu_1.Aontu().generate(PROFILE_VOCABULARY + '\nprofile: ' + (0, hcanon_1.hcanon)(root.peg.profile));
411
+ return { profile: instance.profile };
412
+ }
413
+ // The instance's unit list, or none: `code` is the vocabulary's own
414
+ // key and is always there, `units` is not. One reader, so the fold,
415
+ // the trace and the coverage report all see the same list.
416
+ function unitList(instance) {
417
+ return Array.isArray(instance?.code?.units) ? instance.code.units : [];
418
+ }
419
+ // The fold alone, over `generate()` output: the instance is
420
+ // `{code: {units: [...]}}` as the vocabulary shapes it, with its
421
+ // defaults filled -- which is what `render` hands over, and what a
422
+ // caller of this function is responsible for.
423
+ function renderValue(instance, options) {
424
+ const opts = options ?? {};
425
+ const errors = [];
426
+ const lossy = [];
427
+ const units = [];
428
+ const list = unitList(instance);
429
+ const seen = [];
430
+ let selected = 0;
431
+ list.forEach((unit, i) => {
432
+ const upath = '$.code.units.' + i;
433
+ const path = unit.path;
434
+ const lang = unit.lang;
435
+ // A UNIT PATH IS RELATIVE, DESCENDS, AND IS ITS OWN (RENDER.0.md
436
+ // D8): an absolute path, a `..` segment or a repeat of another
437
+ // unit's path is refused before anything is written.
438
+ if (path.startsWith('/')) {
439
+ errors.push(finding('render_path', 'parse', upath + '.path', 'the unit path ' + path + ' is absolute.'));
440
+ return;
441
+ }
442
+ if (path.split('/').includes('..')) {
443
+ errors.push(finding('render_path', 'parse', upath + '.path', 'the unit path ' + path + ' climbs out of the output directory.'));
444
+ return;
445
+ }
446
+ if (seen.includes(path)) {
447
+ errors.push(finding('render_path', 'parse', upath + '.path', 'the unit path ' + path + ' repeats another unit\'s.'));
448
+ return;
449
+ }
450
+ seen.push(path);
451
+ if (undefined !== opts.unit && opts.unit !== path) {
452
+ return;
453
+ }
454
+ selected++;
455
+ const decls = unit.decls;
456
+ const fragOnly = decls.every((d) => 'frag' === d.k || 'text' === d.k);
457
+ const base = profileFor(lang, opts.profiles, fragOnly);
458
+ if (undefined === base) {
459
+ errors.push(finding('render_profile', 'parse', upath + '.lang', 'no profile renders ' + lang + ': a declaration needs a lowering, and ' +
460
+ 'only fragments and text escapes render under aontu:lang/text.'));
461
+ return;
462
+ }
463
+ const profile = null == unit.profile ? base : mergeProfile(base, unit.profile);
464
+ // THE LOWERING (D5, P5), when the profile names one: the unit's
465
+ // header -- banner, package clause, imports -- and each declaration
466
+ // as pieces the fold takes, a blank line between two lowered
467
+ // declarations. A fragment or a text escape owns its own blanks.
468
+ const family = profile.lowering;
469
+ const ctx = undefined === family ? undefined
470
+ : { profile, family, unit: path, lossy };
471
+ let text = '';
472
+ if (undefined !== ctx) {
473
+ const header = (0, lower_1.lowerHeader)(unit, instance?.code?.source, ctx);
474
+ for (const piece of header) {
475
+ text += foldPiece(piece, profile, path, upath, lossy, ctx);
476
+ }
477
+ if (0 < header.length && 0 < decls.length) {
478
+ text += '\n';
479
+ }
480
+ }
481
+ let lowered = false;
482
+ decls.forEach((decl, j) => {
483
+ const dpath = upath + '.decls.' + j;
484
+ if ('frag' === decl.k) {
485
+ lowered = false;
486
+ lossy.push({
487
+ unit: path, path: dpath, tier: 2, construct: 'frag',
488
+ reason: 'a fragment says nothing about ' + lang + ' syntax',
489
+ });
490
+ decl.of.forEach((piece, n) => {
491
+ text += foldPiece(piece, profile, path, dpath + '.of.' + n, lossy, ctx);
492
+ });
493
+ }
494
+ else if ('text' === decl.k) {
495
+ lowered = false;
496
+ if (decl.lang !== lang) {
497
+ errors.push(finding('render_lang', 'conflict', dpath + '.lang', 'the text escape is ' + decl.lang + ' in a ' + lang + ' unit.'));
498
+ return;
499
+ }
500
+ lossy.push({
501
+ unit: path, path: dpath, tier: 3, construct: 'text',
502
+ reason: 'verbatim ' + lang + ': the renderer checks nothing in it',
503
+ });
504
+ text += decl.text;
505
+ }
506
+ else if (undefined !== ctx) {
507
+ if (lowered) {
508
+ text += '\n';
509
+ }
510
+ for (const piece of (0, lower_1.lowerDecl)(decl, dpath, ctx)) {
511
+ text += foldPiece(piece, profile, path, dpath, lossy, ctx);
512
+ }
513
+ lowered = true;
514
+ }
515
+ else {
516
+ errors.push(finding('render_profile', 'parse', dpath + '.k', 'a ' + decl.k + ' declaration has no lowering under the ' +
517
+ profile.lang + ' profile.'));
518
+ }
519
+ });
520
+ units.push({ path, lang, text });
521
+ });
522
+ if (undefined !== opts.unit && 0 === selected) {
523
+ errors.push(finding('render_unit', 'reference', '$.code.units', 'no unit has the path ' + opts.unit + '.'));
524
+ }
525
+ if (true === opts.strict) {
526
+ for (const loss of lossy) {
527
+ if (3 === loss.tier) {
528
+ errors.push(finding('render_strict', 'conflict', loss.path, 'the ' + loss.construct + ' in ' + loss.unit +
529
+ ' is an opaque escape, refused under strict.'));
530
+ }
531
+ }
532
+ }
533
+ if (0 < errors.length) {
534
+ return errorReport(errors);
535
+ }
536
+ return {
537
+ verdict: 0 < lossy.length ? 'lossy' : 'ok',
538
+ units,
539
+ lossy,
540
+ };
541
+ }
542
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;;;AAGpD,iEAAiE;AACjE,qEAAqE;AACrE,qEAAqE;AACrE,8DAA8D;AAC9D,sEAAsE;AACtE,mEAAmE;AACnE,uEAAuE;AACvE,mEAAmE;AACnE,kEAAkE;AAClE,4CAA4C;AAC5C,EAAE;AACF,mEAAmE;AACnE,qEAAqE;AACrE,sEAAsE;AACtE,sEAAsE;AACtE,oEAAoE;AACpE,qEAAqE;AACrE,kCAAkC;AAElC,mCAA+B;AAC/B,+BAAqD;AAErD,qCAAiC;AACjC,+BAAkC;AAClC,yCAAyC;AACzC,uCAAuC;AAEvC,mCAAuD;AAwGvD,MAAM,UAAU,GAAG,eAAe,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,IAAI,EACxD,MAAM,GAAG,IAAI,CAAC,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC,IAAI;oBAC5C,6CAA6C,CAAC,CAAC,CAAA;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,OAAO,WAAW,CAAC,MAAM,CAAC,CAAA;IAC5B,CAAC;IACD,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;QAC1C,KAAK;QACL,KAAK;KACN,CAAA;AACH,CAAC"}
package/dist/sigdecl.js CHANGED
@@ -6,6 +6,6 @@ exports.SIGDECL = void 0;
6
6
  // test/spec/signature.tsv — DO NOT EDIT. The declaration is the
7
7
  // source (docs/design/SIGNATURES.0.md); ts/test/sig.test.ts asserts
8
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\nesc(s: string, variant?: string) : string\nusc(s: string, variant?: string) : string\nrep(s: string, text p: string, text sub: string) : string\nsplit(s: string, sep: string|constraint) : list\nemit(s: map|list, template t: map|list) : list\n";
9
+ 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\nform(d: map|list, template t: any) : list\nfilter(d: map|list, trial c: any) : map|list\nmatch(s: any, ...pr: (trial any, any), dflt?: any) : any\nadd(a: number, b: number) : number\nsub(a: number, b: number) : number\nmul(a: number, b: number) : number\ndiv(a: number, b: number) : number\nmod(a: number, b: number) : number\nrem(a: number, b: number) : number\nsum(d: map|list) : number\nleast(d: map|list) : number\ngreatest(d: map|list) : number\npick(d: map|list, projector k: string|integer) : any\njoin(d: map|list, sep?: string) : string\nesc(s: string, variant?: string) : string\nusc(s: string, variant?: string) : string\nrep(s: string, text p: string, text sub: string) : string\nsplit(s: string, sep: string|constraint) : list\nemit(s: map|list, template t: map|list) : list\n";
10
10
  exports.SIGDECL = SIGDECL;
11
11
  //# sourceMappingURL=sigdecl.js.map
@@ -1 +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,8pFAA8pF,CAAA;QAErpF,OAAO"}
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,ysFAAysF,CAAA;QAEhsF,OAAO"}
package/dist/std.d.ts CHANGED
@@ -1 +1,3 @@
1
1
  export declare const STD_SOURCES: Record<string, string>;
2
+ export declare const AONTU_SCHEME = "aontu:";
3
+ export declare const AONTU_MODELS: string[];