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.
- package/README.md +1 -1
- package/dist/agentsmd.js +0 -27
- package/dist/agentsmd.js.map +1 -1
- package/dist/alias.js.map +1 -1
- package/dist/allow.js +0 -92
- package/dist/allow.js.map +1 -1
- package/dist/aontu.d.ts +1 -1
- package/dist/aontu.js +1 -79
- package/dist/aontu.js.map +1 -1
- package/dist/aontumodel.d.ts +4 -0
- package/dist/aontumodel.js +33 -0
- package/dist/aontumodel.js.map +1 -0
- package/dist/cli.js +101 -620
- package/dist/cli.js.map +1 -1
- package/dist/ctx.js +0 -48
- package/dist/ctx.js.map +1 -1
- package/dist/diff.js +0 -32
- package/dist/diff.js.map +1 -1
- package/dist/err.js +0 -40
- package/dist/err.js.map +1 -1
- package/dist/escape.js +0 -45
- package/dist/escape.js.map +1 -1
- package/dist/exactjson.d.ts +0 -35
- package/dist/exactjson.js +0 -131
- package/dist/exactjson.js.map +1 -1
- package/dist/format.js +13 -203
- package/dist/format.js.map +1 -1
- package/dist/grammar.d.ts +9 -0
- package/dist/grammar.js +54 -0
- package/dist/grammar.js.map +1 -0
- package/dist/graph.js +0 -26
- package/dist/graph.js.map +1 -1
- package/dist/hcanon.js +0 -82
- package/dist/hcanon.js.map +1 -1
- package/dist/helpdoc.js +1 -1
- package/dist/helpdoc.js.map +1 -1
- package/dist/hints.d.ts +0 -6
- package/dist/hints.js +54 -55
- package/dist/hints.js.map +1 -1
- package/dist/jsonschema.js +0 -114
- package/dist/jsonschema.js.map +1 -1
- package/dist/keyorder.d.ts +0 -7
- package/dist/keyorder.js +0 -41
- package/dist/keyorder.js.map +1 -1
- package/dist/lang.js +17 -915
- package/dist/lang.js.map +1 -1
- package/dist/lower.js +11 -61
- package/dist/lower.js.map +1 -1
- package/dist/lsp-server.js +0 -16
- package/dist/lsp-server.js.map +1 -1
- package/dist/lsp.d.ts +1 -1
- package/dist/lsp.js +12 -159
- package/dist/lsp.js.map +1 -1
- package/dist/mcp-server.js +0 -26
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp.js +0 -113
- package/dist/mcp.js.map +1 -1
- package/dist/mod-tool.js +0 -130
- package/dist/mod-tool.js.map +1 -1
- package/dist/mod.js +0 -162
- package/dist/mod.js.map +1 -1
- package/dist/patch.js +0 -217
- package/dist/patch.js.map +1 -1
- package/dist/provenance.js +0 -140
- package/dist/provenance.js.map +1 -1
- package/dist/query.js +0 -75
- package/dist/query.js.map +1 -1
- package/dist/reach.js +0 -43
- package/dist/reach.js.map +1 -1
- package/dist/relation.js +0 -61
- package/dist/relation.js.map +1 -1
- package/dist/render.js +20 -135
- package/dist/render.js.map +1 -1
- package/dist/report-sarif.d.ts +0 -11
- package/dist/report-sarif.js +0 -28
- package/dist/report-sarif.js.map +1 -1
- package/dist/sig.js +0 -35
- package/dist/sig.js.map +1 -1
- package/dist/sigdecl.js +1 -1
- package/dist/sigdecl.js.map +1 -1
- package/dist/siggate.js +0 -4
- package/dist/siggate.js.map +1 -1
- package/dist/site.js +3 -29
- package/dist/site.js.map +1 -1
- package/dist/subsume.d.ts +0 -10
- package/dist/subsume.js +0 -137
- package/dist/subsume.js.map +1 -1
- package/dist/template.d.ts +2 -1
- package/dist/template.js +58 -138
- package/dist/template.js.map +1 -1
- package/dist/trim.js +0 -41
- package/dist/trim.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/type.js.map +1 -1
- package/dist/unify.js +12 -242
- package/dist/unify.js.map +1 -1
- package/dist/utility.js +0 -22
- package/dist/utility.js.map +1 -1
- package/dist/val/AbnfFuncVal.d.ts +18 -0
- package/dist/val/AbnfFuncVal.js +132 -0
- package/dist/val/AbnfFuncVal.js.map +1 -0
- package/dist/val/AbsentVal.d.ts +11 -0
- package/dist/val/AbsentVal.js +30 -0
- package/dist/val/AbsentVal.js.map +1 -0
- package/dist/val/AggFuncVal.d.ts +10 -1
- package/dist/val/AggFuncVal.js +104 -116
- package/dist/val/AggFuncVal.js.map +1 -1
- package/dist/val/ArithFuncVal.js +0 -12
- package/dist/val/ArithFuncVal.js.map +1 -1
- package/dist/val/BagVal.js +1 -78
- package/dist/val/BagVal.js.map +1 -1
- package/dist/val/BigDecimalVal.js +0 -16
- package/dist/val/BigDecimalVal.js.map +1 -1
- package/dist/val/BigIntegerVal.js +0 -16
- package/dist/val/BigIntegerVal.js.map +1 -1
- package/dist/val/CloseFuncVal.js +0 -9
- package/dist/val/CloseFuncVal.js.map +1 -1
- package/dist/val/CmpFuncVal.js +2 -59
- package/dist/val/CmpFuncVal.js.map +1 -1
- package/dist/val/ConjunctVal.js +0 -29
- package/dist/val/ConjunctVal.js.map +1 -1
- package/dist/val/ConstraintVal.js +0 -500
- package/dist/val/ConstraintVal.js.map +1 -1
- package/dist/val/ContainerKindVal.js +0 -2
- package/dist/val/ContainerKindVal.js.map +1 -1
- package/dist/val/CopyFuncVal.js +0 -3
- package/dist/val/CopyFuncVal.js.map +1 -1
- package/dist/val/Decimal.js +0 -179
- package/dist/val/Decimal.js.map +1 -1
- package/dist/val/DeprecateFuncVal.js.map +1 -1
- package/dist/val/DisjunctVal.js +0 -152
- package/dist/val/DisjunctVal.js.map +1 -1
- package/dist/val/EachFuncVal.js +0 -3
- package/dist/val/EachFuncVal.js.map +1 -1
- package/dist/val/EmitFuncVal.d.ts +1 -1
- package/dist/val/EmitFuncVal.js +6 -119
- package/dist/val/EmitFuncVal.js.map +1 -1
- package/dist/val/ExpectVal.js +0 -62
- package/dist/val/ExpectVal.js.map +1 -1
- package/dist/val/FilterFuncVal.js +0 -25
- package/dist/val/FilterFuncVal.js.map +1 -1
- package/dist/val/FuncBaseVal.d.ts +1 -0
- package/dist/val/FuncBaseVal.js +7 -127
- package/dist/val/FuncBaseVal.js.map +1 -1
- package/dist/val/GraphAtomVal.js +0 -15
- package/dist/val/GraphAtomVal.js.map +1 -1
- package/dist/val/HideFuncVal.js +0 -13
- package/dist/val/HideFuncVal.js.map +1 -1
- package/dist/val/IntegerVal.js +0 -61
- package/dist/val/IntegerVal.js.map +1 -1
- package/dist/val/JunctionVal.js +0 -20
- package/dist/val/JunctionVal.js.map +1 -1
- package/dist/val/KeyFuncVal.js +0 -46
- package/dist/val/KeyFuncVal.js.map +1 -1
- package/dist/val/ListVal.js +0 -57
- package/dist/val/ListVal.js.map +1 -1
- package/dist/val/LowerFuncVal.js +0 -11
- package/dist/val/LowerFuncVal.js.map +1 -1
- package/dist/val/MapVal.js +0 -151
- package/dist/val/MapVal.js.map +1 -1
- package/dist/val/MatchFuncVal.js +0 -27
- package/dist/val/MatchFuncVal.js.map +1 -1
- package/dist/val/{FormFuncVal.d.ts → MaybeFuncVal.d.ts} +5 -5
- package/dist/val/MaybeFuncVal.js +50 -0
- package/dist/val/MaybeFuncVal.js.map +1 -0
- package/dist/val/MoveFuncVal.js +0 -18
- package/dist/val/MoveFuncVal.js.map +1 -1
- package/dist/val/NilVal.js +0 -60
- package/dist/val/NilVal.js.map +1 -1
- package/dist/val/NomFuncVal.js +8 -42
- package/dist/val/NomFuncVal.js.map +1 -1
- package/dist/val/NumberVal.js +0 -15
- package/dist/val/NumberVal.js.map +1 -1
- package/dist/val/OpBaseVal.d.ts +1 -0
- package/dist/val/OpBaseVal.js +3 -15
- package/dist/val/OpBaseVal.js.map +1 -1
- package/dist/val/PackFuncVal.js +0 -34
- package/dist/val/PackFuncVal.js.map +1 -1
- package/dist/val/PathFuncVal.js +0 -6
- package/dist/val/PathFuncVal.js.map +1 -1
- package/dist/val/PathVal.js +0 -41
- package/dist/val/PathVal.js.map +1 -1
- package/dist/val/PlaceVal.js +0 -25
- package/dist/val/PlaceVal.js.map +1 -1
- package/dist/val/PlusOpVal.d.ts +1 -7
- package/dist/val/PlusOpVal.js +13 -74
- package/dist/val/PlusOpVal.js.map +1 -1
- package/dist/val/PrefFuncVal.js +0 -1
- package/dist/val/PrefFuncVal.js.map +1 -1
- package/dist/val/PrefVal.js +0 -167
- package/dist/val/PrefVal.js.map +1 -1
- package/dist/val/RecurseVal.js +0 -55
- package/dist/val/RecurseVal.js.map +1 -1
- package/dist/val/RefVal.js +0 -282
- package/dist/val/RefVal.js.map +1 -1
- package/dist/val/ReferFuncVal.js +0 -232
- package/dist/val/ReferFuncVal.js.map +1 -1
- package/dist/val/ScalarKindVal.js +0 -49
- package/dist/val/ScalarKindVal.js.map +1 -1
- package/dist/val/ScalarVal.js +0 -11
- package/dist/val/ScalarVal.js.map +1 -1
- package/dist/val/StrFuncVal.js +0 -18
- package/dist/val/StrFuncVal.js.map +1 -1
- package/dist/val/SuperFuncVal.js +0 -32
- package/dist/val/SuperFuncVal.js.map +1 -1
- package/dist/val/TopVal.js +0 -1
- package/dist/val/TopVal.js.map +1 -1
- package/dist/val/TranslateFuncVal.js +1 -3
- package/dist/val/TranslateFuncVal.js.map +1 -1
- package/dist/val/UpperFuncVal.js +0 -11
- package/dist/val/UpperFuncVal.js.map +1 -1
- package/dist/val/Val.d.ts +1 -0
- package/dist/val/Val.js +2 -133
- package/dist/val/Val.js.map +1 -1
- package/dist/val/VarVal.js +0 -12
- package/dist/val/VarVal.js.map +1 -1
- package/dist/val/arith.js +0 -37
- package/dist/val/arith.js.map +1 -1
- package/dist/val/caserange.js +0 -61
- package/dist/val/caserange.js.map +1 -1
- package/dist/val/members.js +0 -6
- package/dist/val/members.js.map +1 -1
- package/dist/val/numcmp.js +0 -11
- package/dist/val/numcmp.js.map +1 -1
- package/dist/val/numkind.js +0 -145
- package/dist/val/numkind.js.map +1 -1
- package/dist/val/valutil.js +0 -16
- package/dist/val/valutil.js.map +1 -1
- package/dist/vet.js +0 -461
- package/dist/vet.js.map +1 -1
- package/dist/view.js +0 -414
- package/dist/view.js.map +1 -1
- package/dist/walk.js +0 -41
- package/dist/walk.js.map +1 -1
- package/grammar/aontu.abnf +8 -6
- package/grammar/aontu.gbnf +4 -4
- package/grammar/aontu.lark +4 -4
- package/grammar/aontu.tmLanguage.json +1 -1
- package/package.json +4 -2
- package/src/agentsmd.ts +0 -35
- package/src/alias.ts +0 -39
- package/src/allow.ts +1 -96
- package/src/aontu.ts +3 -110
- package/src/aontumodel.ts +32 -0
- package/src/cli.ts +113 -682
- package/src/ctx.ts +0 -103
- package/src/diff.ts +0 -40
- package/src/err.ts +0 -40
- package/src/escape.ts +0 -46
- package/src/exactjson.ts +0 -131
- package/src/format.ts +14 -257
- package/src/grammar.ts +72 -0
- package/src/graph.ts +0 -61
- package/src/hcanon.ts +0 -82
- package/src/helpdoc.ts +1 -1
- package/src/hints.ts +66 -57
- package/src/jsonschema.ts +0 -123
- package/src/keyorder.ts +0 -42
- package/src/lang.ts +19 -931
- package/src/lower.ts +12 -62
- package/src/lsp-server.ts +0 -16
- package/src/lsp.ts +12 -180
- package/src/mcp-server.ts +0 -31
- package/src/mcp.ts +0 -130
- package/src/mod-tool.ts +0 -158
- package/src/mod.ts +0 -178
- package/src/patch.ts +0 -232
- package/src/provenance.ts +0 -183
- package/src/query.ts +0 -84
- package/src/reach.ts +0 -53
- package/src/relation.ts +0 -84
- package/src/render.ts +20 -172
- package/src/report-sarif.ts +0 -48
- package/src/sig.ts +0 -35
- package/src/sigdecl.ts +1 -1
- package/src/siggate.ts +0 -30
- package/src/site.ts +3 -29
- package/src/subsume.ts +1 -161
- package/src/template.ts +69 -140
- package/src/trim.ts +0 -53
- package/src/type.ts +2 -45
- package/src/unify.ts +13 -251
- package/src/utility.ts +0 -31
- package/src/val/AbnfFuncVal.ts +181 -0
- package/src/val/AbsentVal.ts +54 -0
- package/src/val/AggFuncVal.ts +152 -188
- package/src/val/ArithFuncVal.ts +0 -20
- package/src/val/BagVal.ts +1 -78
- package/src/val/BigDecimalVal.ts +0 -16
- package/src/val/BigIntegerVal.ts +0 -16
- package/src/val/CloseFuncVal.ts +0 -9
- package/src/val/CmpFuncVal.ts +4 -166
- package/src/val/ConjunctVal.ts +0 -33
- package/src/val/ConstraintVal.ts +2 -537
- package/src/val/ContainerKindVal.ts +0 -18
- package/src/val/CopyFuncVal.ts +0 -5
- package/src/val/Decimal.ts +1 -185
- package/src/val/DeprecateFuncVal.ts +0 -10
- package/src/val/DisjunctVal.ts +0 -157
- package/src/val/EachFuncVal.ts +0 -40
- package/src/val/EmitFuncVal.ts +8 -208
- package/src/val/ExpectVal.ts +0 -62
- package/src/val/FilterFuncVal.ts +0 -55
- package/src/val/FuncBaseVal.ts +9 -130
- package/src/val/GraphAtomVal.ts +0 -42
- package/src/val/HideFuncVal.ts +0 -15
- package/src/val/IntegerVal.ts +0 -61
- package/src/val/JunctionVal.ts +0 -20
- package/src/val/KeyFuncVal.ts +0 -48
- package/src/val/ListVal.ts +0 -59
- package/src/val/LowerFuncVal.ts +0 -12
- package/src/val/MapVal.ts +0 -151
- package/src/val/MatchFuncVal.ts +0 -59
- package/src/val/MaybeFuncVal.ts +86 -0
- package/src/val/MoveFuncVal.ts +0 -20
- package/src/val/NilVal.ts +0 -60
- package/src/val/NomFuncVal.ts +8 -95
- package/src/val/NumberVal.ts +0 -16
- package/src/val/OpBaseVal.ts +4 -17
- package/src/val/PackFuncVal.ts +0 -63
- package/src/val/PathFuncVal.ts +0 -32
- package/src/val/PathVal.ts +0 -66
- package/src/val/PlaceVal.ts +0 -45
- package/src/val/PlusOpVal.ts +18 -75
- package/src/val/PrefFuncVal.ts +0 -1
- package/src/val/PrefVal.ts +0 -179
- package/src/val/RecurseVal.ts +0 -81
- package/src/val/RefVal.ts +1 -285
- package/src/val/ReferFuncVal.ts +0 -255
- package/src/val/ScalarKindVal.ts +0 -50
- package/src/val/ScalarVal.ts +0 -12
- package/src/val/StrFuncVal.ts +0 -44
- package/src/val/SuperFuncVal.ts +0 -42
- package/src/val/TopVal.ts +0 -1
- package/src/val/TranslateFuncVal.ts +1 -51
- package/src/val/UpperFuncVal.ts +0 -12
- package/src/val/Val.ts +3 -192
- package/src/val/VarVal.ts +0 -15
- package/src/val/arith.ts +0 -92
- package/src/val/caserange.ts +0 -62
- package/src/val/members.ts +0 -23
- package/src/val/numcmp.ts +1 -27
- package/src/val/numkind.ts +0 -149
- package/src/val/valutil.ts +0 -16
- package/src/vet.ts +1 -582
- package/src/view.ts +0 -507
- package/src/walk.ts +0 -41
- package/dist/std.d.ts +0 -3
- package/dist/std.js +0 -672
- package/dist/std.js.map +0 -1
- package/dist/val/FormFuncVal.js +0 -55
- package/dist/val/FormFuncVal.js.map +0 -1
- package/dist/val/NamerFuncVal.d.ts +0 -12
- package/dist/val/NamerFuncVal.js +0 -176
- package/dist/val/NamerFuncVal.js.map +0 -1
- package/src/std.ts +0 -683
package/grammar/aontu.abnf
CHANGED
|
@@ -80,18 +80,20 @@ func = name %s"(" ws [ value *( ws %s"," ws value ) ws ] %s")"
|
|
|
80
80
|
|
|
81
81
|
; ORDER MATTERS where one name is a prefix of another: `refer` is
|
|
82
82
|
; listed before `re`, and `rem` before `re` as well.
|
|
83
|
-
name = %s"above" / %s"acyclic" / %s"add" / %s"below" / %s"close"
|
|
84
|
-
/ %s"copy" / %s"deprecate" / %s"div"
|
|
83
|
+
name = %s"abnf" / %s"above" / %s"acyclic" / %s"add" / %s"below" / %s"close"
|
|
84
|
+
/ %s"copyfiles" / %s"copy" / %s"deprecate" / %s"div"
|
|
85
85
|
/ %s"each" / %s"emit" / %s"esc" / %s"filter" / %s"greatest"
|
|
86
86
|
/ %s"hide"
|
|
87
87
|
/ %s"inverse" / %s"join" / %s"key" / %s"least"
|
|
88
|
-
/ %s"length" / %s"list" / %s"lower" / %s"map" / %s"match"
|
|
89
|
-
/ %s"max" / %s"min" / %s"mod" / %s"move"
|
|
88
|
+
/ %s"length" / %s"listitems" / %s"list" / %s"lower" / %s"map" / %s"match"
|
|
89
|
+
/ %s"maybe" / %s"max" / %s"min" / %s"mod" / %s"move"
|
|
90
90
|
/ %s"mul" / %s"must"
|
|
91
91
|
/ %s"neq"
|
|
92
|
-
/ %s"open" / %s"pack" / %s"path" / %s"pick" / %s"pref"
|
|
93
|
-
/ %s"refer" / %s"rel" / %s"rem" / %s"rep" / %s"re" / %s"split"
|
|
92
|
+
/ %s"open" / %s"pack" / %s"parse" / %s"path" / %s"pick" / %s"pref"
|
|
93
|
+
/ %s"refer" / %s"rel" / %s"rem" / %s"rep" / %s"re" / %s"sort" / %s"split"
|
|
94
94
|
/ %s"super"
|
|
95
|
+
/ %s"content" / %s"file" / %s"folder" / %s"fragment" / %s"inject"
|
|
96
|
+
/ %s"line" / %s"nom" / %s"project" / %s"slot" / %s"translate"
|
|
95
97
|
/ %s"sub" / %s"sum"
|
|
96
98
|
/ %s"type"
|
|
97
99
|
/ %s"unique" / %s"upper" / %s"usc"
|
package/grammar/aontu.gbnf
CHANGED
|
@@ -81,15 +81,15 @@ element ::= spread | value
|
|
|
81
81
|
func ::= name "(" ws ( value ( ws "," ws value )* ws )? ")"
|
|
82
82
|
|
|
83
83
|
name ::=
|
|
84
|
-
"above" | "acyclic" | "add" | "below" | "close" | "copy" | "deprecate" | "div"
|
|
84
|
+
"content" | "file" | "folder" | "fragment" | "inject" | "line" | "nom" | "project" | "slot" | "translate" | "abnf" | "above" | "acyclic" | "add" | "below" | "close" | "copyfiles" | "copy" | "deprecate" | "div"
|
|
85
85
|
| "each" | "emit" | "esc" | "filter" | "greatest"
|
|
86
86
|
| "hide"
|
|
87
87
|
| "inverse" | "join" | "key" | "least"
|
|
88
|
-
| "length" | "list" | "lower" | "map" | "match" | "max" | "min" | "mod" | "move"
|
|
88
|
+
| "length" | "listitems" | "list" | "lower" | "map" | "match" | "maybe" | "max" | "min" | "mod" | "move"
|
|
89
89
|
| "mul" | "must"
|
|
90
90
|
| "neq"
|
|
91
|
-
| "open" | "pack" | "path" | "pick" | "pref" | "refer" | "rel" | "rem" | "rep" | "re"
|
|
92
|
-
| "split" | "super"
|
|
91
|
+
| "open" | "pack" | "parse" | "path" | "pick" | "pref" | "refer" | "rel" | "rem" | "rep" | "re"
|
|
92
|
+
| "sort" | "split" | "super"
|
|
93
93
|
| "sub" | "sum"
|
|
94
94
|
| "type"
|
|
95
95
|
| "unique" | "upper" | "usc"
|
package/grammar/aontu.lark
CHANGED
|
@@ -62,15 +62,15 @@ element: spread
|
|
|
62
62
|
|
|
63
63
|
func: name "(" [value ("," value)*] ")"
|
|
64
64
|
|
|
65
|
-
name: "above" | "acyclic" | "add" | "below" | "close" | "copy" | "deprecate" | "div"
|
|
65
|
+
name: "content" | "file" | "folder" | "fragment" | "inject" | "line" | "nom" | "project" | "slot" | "translate" | "abnf" | "above" | "acyclic" | "add" | "below" | "close" | "copyfiles" | "copy" | "deprecate" | "div"
|
|
66
66
|
| "each" | "emit" | "esc" | "filter" | "greatest"
|
|
67
67
|
| "hide"
|
|
68
68
|
| "inverse" | "join" | "key" | "least"
|
|
69
|
-
| "length" | "list" | "lower" | "map" | "match" | "max" | "min" | "mod" | "move"
|
|
69
|
+
| "length" | "listitems" | "list" | "lower" | "map" | "match" | "maybe" | "max" | "min" | "mod" | "move"
|
|
70
70
|
| "mul" | "must"
|
|
71
71
|
| "neq"
|
|
72
|
-
| "open" | "pack" | "path" | "pick" | "pref" | "refer" | "rel" | "rem" | "rep" | "re"
|
|
73
|
-
| "split" | "super"
|
|
72
|
+
| "open" | "pack" | "parse" | "path" | "pick" | "pref" | "refer" | "rel" | "rem" | "rep" | "re"
|
|
73
|
+
| "sort" | "split" | "super"
|
|
74
74
|
| "sub" | "sum"
|
|
75
75
|
| "type"
|
|
76
76
|
| "unique" | "upper" | "usc"
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
|
|
112
112
|
"builtin": {
|
|
113
113
|
"comment": "The engine's function registry. `func: name \"(\" ...` in aontu.lark — only these names can be called, so a call to anything else is deliberately left uncoloured rather than dressed up as valid. The prefix family is spelled longest-first (refer|rel|rem|re) to keep the intent legible; the trailing \\b already makes the order immaterial, since a short alternative that swallowed the stem fails the boundary and backtracks.",
|
|
114
|
-
"match": "\\b(above|acyclic|add|below|close|copy|deprecate|div|each|emit|esc|filter|greatest|hide|inverse|join|key|least|length|list|lower|map|match|max|min|mod|move|mul|must|neq|open|pack|path|pick|pref|refer|rel|rem|rep|re|split|sub|sum|super|type|unique|upper|usc)\\b(?=\\s*\\()",
|
|
114
|
+
"match": "\\b(abnf|above|acyclic|add|below|close|content|copyfiles|copy|deprecate|div|each|emit|esc|file|filter|folder|fragment|greatest|hide|inject|inverse|join|key|least|length|line|listitems|list|lower|map|match|maybe|max|min|mod|move|mul|must|neq|nom|open|pack|parse|path|pick|pref|project|refer|rel|rem|rep|re|slot|sort|split|sub|sum|super|translate|type|unique|upper|usc)\\b(?=\\s*\\()",
|
|
115
115
|
"captures": {
|
|
116
116
|
"1": { "name": "support.function.builtin.aontu" }
|
|
117
117
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aontu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.0",
|
|
4
4
|
"main": "dist/aontu.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"types": "dist/aontu.d.ts",
|
|
@@ -64,6 +64,8 @@
|
|
|
64
64
|
"LICENSE"
|
|
65
65
|
],
|
|
66
66
|
"dependencies": {
|
|
67
|
+
"@tabnas/abnf": "0.4.13",
|
|
68
|
+
"@tabnas/bnf": "0.1.15",
|
|
67
69
|
"@tabnas/debug": "0.3.2",
|
|
68
70
|
"@tabnas/directive": "0.5.2",
|
|
69
71
|
"@tabnas/expr": "0.5.5",
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
"@tabnas/jsonc": "0.5.6",
|
|
74
76
|
"@tabnas/jsonic": "0.6.2",
|
|
75
77
|
"@tabnas/multisource": "0.5.2",
|
|
76
|
-
"@tabnas/parser": "0.
|
|
78
|
+
"@tabnas/parser": "0.9.7",
|
|
77
79
|
"@tabnas/path": "0.3.2",
|
|
78
80
|
"@tabnas/toml": "0.5.7",
|
|
79
81
|
"@tabnas/yaml": "0.5.7"
|
package/src/agentsmd.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
/* Copyright (c) 2025 Richard Rodger, MIT License */
|
|
2
2
|
import { includeOpts } from './utility'
|
|
3
3
|
|
|
4
|
-
// THE AGENTS.md STANZA (G7 phase 6,
|
|
5
|
-
// docs/capability-review/g7-machine-access.md): generated FROM the
|
|
6
|
-
// definition, so the prose entrypoint cannot drift from the formal
|
|
7
|
-
// source it points at.
|
|
8
|
-
//
|
|
9
|
-
// A hand-written "here is where the config lives" paragraph is stale
|
|
10
|
-
// the first time a key is renamed. This one is derived: the root keys
|
|
11
|
-
// come from the document, the pin comes from G6's canon-hash, and the
|
|
12
|
-
// commands are spelled with paths that exist. Re-running the verb
|
|
13
|
-
// after an edit produces the stanza that edit implies.
|
|
14
4
|
|
|
15
5
|
import { Aontu } from './aontu'
|
|
16
6
|
import type { TrustOptions } from './type'
|
|
@@ -34,11 +24,6 @@ export type AgentsMdReport = {
|
|
|
34
24
|
}
|
|
35
25
|
|
|
36
26
|
export type AgentsMdOptions = {
|
|
37
|
-
// How deep the SHAPE line projects, default 2 (G11 phase 7). Two
|
|
38
|
-
// levels name the root keys and say `top` under them, which tells an
|
|
39
|
-
// agent what the document is ABOUT and nothing it can act on; a
|
|
40
|
-
// caller that wants the fields asks for them. The default is
|
|
41
|
-
// unchanged, because the stanza is spliced into a file people read.
|
|
42
27
|
depth?: number
|
|
43
28
|
// The name the stanza should call the document. The engine never
|
|
44
29
|
// reads a file; the CLI passes what the author typed.
|
|
@@ -48,9 +33,6 @@ export type AgentsMdOptions = {
|
|
|
48
33
|
// (G5, docs/trust.md); vet's precedent.
|
|
49
34
|
trust?: TrustOptions
|
|
50
35
|
|
|
51
|
-
// Extensions additionally read as text (the CLI's `--text-ext`).
|
|
52
|
-
// Rides beside `trust` because it is the other half of what an
|
|
53
|
-
// include may read.
|
|
54
36
|
textExt?: string[]
|
|
55
37
|
}
|
|
56
38
|
|
|
@@ -70,12 +52,6 @@ export function agentsMd(
|
|
|
70
52
|
}
|
|
71
53
|
|
|
72
54
|
const keys = true === v.isMap ? Object.keys(v.peg).sort(cmpCodePoint) : []
|
|
73
|
-
// THE SHAPE IS A SECOND EVALUATION, and it runs under the same
|
|
74
|
-
// include options as the first. Taking `path` alone made it a
|
|
75
|
-
// narrower reader than the stanza around it: a document whose keys
|
|
76
|
-
// arrive through a `--text-ext` include listed those keys and then
|
|
77
|
-
// reported an EMPTY shape, because the read the shape came from
|
|
78
|
-
// refused the include the read above it had just honoured.
|
|
79
55
|
const shape = get(src, '$', {
|
|
80
56
|
view: 'types', depth: options.depth ?? 2,
|
|
81
57
|
path: options.path, ...includeOpts(options),
|
|
@@ -128,11 +104,6 @@ export function agentsMd(
|
|
|
128
104
|
}
|
|
129
105
|
|
|
130
106
|
|
|
131
|
-
// Splice the stanza into an existing document: replace what stands
|
|
132
|
-
// between the markers, or append when there is nothing to replace. A
|
|
133
|
-
// document is otherwise LEFT ALONE — the rest of an AGENTS.md is
|
|
134
|
-
// someone's prose, and a generator that rewrote it would be a
|
|
135
|
-
// generator nobody dared run twice.
|
|
136
107
|
export function agentsMdSplice(existing: string, stanza: string): string {
|
|
137
108
|
const from = existing.indexOf(AGENTSMD_BEGIN)
|
|
138
109
|
const to = existing.indexOf(AGENTSMD_END)
|
|
@@ -141,12 +112,6 @@ export function agentsMdSplice(existing: string, stanza: string): string {
|
|
|
141
112
|
? existing : existing + '\n'
|
|
142
113
|
return head + ('' === existing ? '' : '\n') + stanza
|
|
143
114
|
}
|
|
144
|
-
// Skip the end marker's line terminator, whatever it is, and only if
|
|
145
|
-
// it is there. The full note is on the Go twin (go/agentsmd.go): `+1`
|
|
146
|
-
// assumed one byte and got the CR of a CRLF document, leaving the LF
|
|
147
|
-
// to become a blank line on every regeneration -- and past the end of
|
|
148
|
-
// a document whose marker is its last content, where Go panicked and
|
|
149
|
-
// this side quietly did not.
|
|
150
115
|
let end = to + AGENTSMD_END.length
|
|
151
116
|
if ('\r' === existing[end]) {
|
|
152
117
|
end++
|
package/src/alias.ts
CHANGED
|
@@ -1,44 +1,5 @@
|
|
|
1
1
|
/* Copyright (c) 2021-2026 Richard Rodger, MIT License */
|
|
2
2
|
|
|
3
|
-
// ALIAS EXPANSION FOR CANON. An alias is a name for a value, and
|
|
4
|
-
// nothing more (docs/design/ALIASES.0.md §4): the declaration is
|
|
5
|
-
// erased from generation, canon and the hash, and a reference resolves
|
|
6
|
-
// to the value in place. One place a reference is NOT resolved in
|
|
7
|
-
// place is a spread template -- `[&: %unit]`, `{&: {a: %u}}` -- because
|
|
8
|
-
// a template applies to children that have not arrived, so it stands
|
|
9
|
-
// in the settled tree as the reference it was written as. Canon has
|
|
10
|
-
// erased the declaration, so the name alone would not reparse, and the
|
|
11
|
-
// hash of `t: {&: %u}` would differ from the hash of `t: {&: integer}`,
|
|
12
|
-
// which is the same document.
|
|
13
|
-
//
|
|
14
|
-
// This walk runs ONCE, after the last unification pass, and attaches
|
|
15
|
-
// to every standing alias reference the value it names, which its
|
|
16
|
-
// canon then renders instead of the name. The tree is not changed:
|
|
17
|
-
// the reference still stands, still resolves at each destination, and
|
|
18
|
-
// unification never reads the expansion.
|
|
19
|
-
//
|
|
20
|
-
// What a reference expands to. The ref-spread SNAPSHOT where one was
|
|
21
|
-
// taken (MapVal.snapshotRefSpread: a path-dependent template captured
|
|
22
|
-
// before its key()/path() resolved at the declaration), else the
|
|
23
|
-
// declaration's settled value at the root. The snapshot is the
|
|
24
|
-
// template the destinations actually saw; the settled value of
|
|
25
|
-
// `%row = {name: key()}` is `{name: "%row"}`, the leak the snapshot
|
|
26
|
-
// exists to prevent, and canon must not print it either.
|
|
27
|
-
//
|
|
28
|
-
// The knot. A recursive alias names itself inside its own template
|
|
29
|
-
// (`%json = null | ... | [&: %json] | {&: %json}`). Its expansion
|
|
30
|
-
// contains a reference to the name being expanded, and that reference
|
|
31
|
-
// keeps its name: canon cannot spell the declaration it erased, and
|
|
32
|
-
// an infinite unrolling is not a canon. Such a canon does not reparse
|
|
33
|
-
// on its own -- the one place alias erasure and canon convergence
|
|
34
|
-
// pull apart (use-cases/BUGS.md §82). Only the reference that closes
|
|
35
|
-
// the cycle is left as a name; everything up to it expands.
|
|
36
|
-
//
|
|
37
|
-
// Every value is visited once (templates are shared across
|
|
38
|
-
// destinations, and one declaration is reached through many
|
|
39
|
-
// references), children in code-point key order, so the two ports
|
|
40
|
-
// attach the same expansions in the same order and print one canon.
|
|
41
|
-
// Twin of expandAliases in go/alias.go.
|
|
42
3
|
|
|
43
4
|
import type { Val } from './type'
|
|
44
5
|
|
package/src/allow.ts
CHANGED
|
@@ -1,60 +1,5 @@
|
|
|
1
1
|
/* Copyright (c) 2025 Richard Rodger, MIT License */
|
|
2
2
|
|
|
3
|
-
// THE ROLE GATE: may an agent operating under a ROLE modify a SUBTREE?
|
|
4
|
-
//
|
|
5
|
-
// An agent about to change a model (`aontu set`, an overlay, a rewrite)
|
|
6
|
-
// asks first, and the answer comes from a ROLE MODEL that is itself an
|
|
7
|
-
// aontu document: one entry per role, each naming the subtrees the
|
|
8
|
-
// role may modify and, optionally, the ones it may not. Roles are
|
|
9
|
-
// arbitrary identifier strings -- `admin`, `dev`, `product`, `qa` --
|
|
10
|
-
// and the model is whatever its author writes, so the rules of the
|
|
11
|
-
// language (spreads, references, includes, `close()`) compose role
|
|
12
|
-
// models the way they compose everything else.
|
|
13
|
-
//
|
|
14
|
-
// The shape of a role is aontu too. It is conjoined with the model at
|
|
15
|
-
// evaluation, as a spread template over the roles map:
|
|
16
|
-
//
|
|
17
|
-
// roles: { &: { allow: [&: Entry] deny?: [&: Entry] } }
|
|
18
|
-
// Entry = string & re("^[$]") & re("[^.]$")
|
|
19
|
-
//
|
|
20
|
-
// so a malformed role -- `allow: "$.a"`, `deny: [1]`, an entry that is
|
|
21
|
-
// empty or does not start at the root or ends in a dot, a roles map
|
|
22
|
-
// that is a number -- is refused by the engine with the engine's own
|
|
23
|
-
// code and site, and this module never invents a finding shape of its
|
|
24
|
-
// own. The shape is a VALUE the model meets, not text appended to it:
|
|
25
|
-
// a model whose last line is an unclosed map or a dangling key would
|
|
26
|
-
// swallow appended text, and the shape would then apply to nothing.
|
|
27
|
-
// A role with no `allow` list allows nothing, because the template's
|
|
28
|
-
// empty list is what the tree holds for it.
|
|
29
|
-
//
|
|
30
|
-
// The lists are read from the WRITTEN tree, not from the generated
|
|
31
|
-
// document: a `hide()` mark keeps a list out of the output, and a gate
|
|
32
|
-
// that read the output would let a hidden `deny` vanish -- the wrong
|
|
33
|
-
// direction to be wrong in. Each entry must still be one concrete
|
|
34
|
-
// string: a kind (`string`) or anything else that does not generate is
|
|
35
|
-
// refused with the engine's `no_gen`.
|
|
36
|
-
//
|
|
37
|
-
// The rule is deliberately small, and it errs towards refusal:
|
|
38
|
-
//
|
|
39
|
-
// - A path is ALLOWED when some `allow` entry is an ancestor of it or
|
|
40
|
-
// equal to it. Being allowed `$.services` allows `$.services.auth`
|
|
41
|
-
// and `$.services.auth.replicas`; it does not allow `$` -- a change
|
|
42
|
-
// at the root reaches every sibling too.
|
|
43
|
-
// - A path is REFUSED when any `deny` entry INTERSECTS it: an
|
|
44
|
-
// ancestor, itself, or a descendant. Denied `$.services.*.tier`
|
|
45
|
-
// refuses `$.services.auth.tier` (the denied node), and it refuses
|
|
46
|
-
// `$.services.auth` and `$.services` too, because a change at
|
|
47
|
-
// either could rewrite the tier. Deny wins over allow whatever the
|
|
48
|
-
// order the entries were written in.
|
|
49
|
-
// - `*` in an entry matches exactly one segment, any key. It is the
|
|
50
|
-
// only pattern character; everything else is a key or a list index
|
|
51
|
-
// compared for equality, as a reference compares them.
|
|
52
|
-
// - A role is ONE KEY of the roles map, looked up as written, and a
|
|
53
|
-
// role the map does not declare may modify nothing.
|
|
54
|
-
//
|
|
55
|
-
// The answer names the entry that decided it, as a path INTO THE ROLE
|
|
56
|
-
// MODEL (`$.roles.dev.deny.0`), so `aontu why` can say who wrote the
|
|
57
|
-
// rule and where.
|
|
58
3
|
|
|
59
4
|
import { Aontu } from './aontu'
|
|
60
5
|
import { ConjunctVal } from './val/ConjunctVal'
|
|
@@ -78,7 +23,7 @@ export type AllowReason = 'allow' | 'deny' | 'uncovered' | 'no_role'
|
|
|
78
23
|
|
|
79
24
|
|
|
80
25
|
export type AllowDecision = {
|
|
81
|
-
path: string
|
|
26
|
+
path: string
|
|
82
27
|
allowed: boolean
|
|
83
28
|
reason: AllowReason
|
|
84
29
|
by?: string // the deciding entry's path in the role model
|
|
@@ -90,9 +35,6 @@ export type AllowReport = {
|
|
|
90
35
|
verdict: AllowVerdict
|
|
91
36
|
role: string
|
|
92
37
|
paths: AllowDecision[]
|
|
93
|
-
// G2's finding shape, as every verb reports: empty when the verdict
|
|
94
|
-
// is `allowed`, the engine's own failure when it is `error`, and
|
|
95
|
-
// the `no_path` of an undeclared role beside the refusals.
|
|
96
38
|
findings: VetFinding[]
|
|
97
39
|
}
|
|
98
40
|
|
|
@@ -106,10 +48,6 @@ export type AllowOptions = IncludeOptions & {
|
|
|
106
48
|
}
|
|
107
49
|
|
|
108
50
|
|
|
109
|
-
// One entry: a string that starts at the root and does not end in a
|
|
110
|
-
// dot. `re()` refuses a nested quantifier, so the two conditions are
|
|
111
|
-
// two patterns rather than one grammar; an empty segment in the middle
|
|
112
|
-
// is harmless, because the path split drops it as a reference does.
|
|
113
51
|
const ENTRY = 'string & re("^[$]") & re("[^.]$")'
|
|
114
52
|
|
|
115
53
|
// The shape every role must satisfy, in the language: a list of
|
|
@@ -117,10 +55,6 @@ const ENTRY = 'string & re("^[$]") & re("[^.]$")'
|
|
|
117
55
|
const ROLE_SHAPE = `{ allow: [&: ${ENTRY}] deny?: [&: ${ENTRY}] }`
|
|
118
56
|
|
|
119
57
|
|
|
120
|
-
// The shape document: a spread over the roles map at `at`, or -- when
|
|
121
|
-
// the roles map IS the document -- a top-level spread. Keys are quoted
|
|
122
|
-
// the way `aontu set` quotes an overlay line, so a segment may be a
|
|
123
|
-
// word the grammar spells otherwise.
|
|
124
58
|
function shapeSource(at: string): string {
|
|
125
59
|
const keys = pathParts(at).map((p) => JSON.stringify(p))
|
|
126
60
|
return 0 === keys.length
|
|
@@ -136,8 +70,6 @@ function pathText(parts: string[]): string {
|
|
|
136
70
|
}
|
|
137
71
|
|
|
138
72
|
|
|
139
|
-
// The finding shape `get` reports with, deliberately: the gate invents
|
|
140
|
-
// no error format of its own.
|
|
141
73
|
function finding(
|
|
142
74
|
code: string, path: string, message: string, note?: string): VetFinding {
|
|
143
75
|
return {
|
|
@@ -159,10 +91,6 @@ type Entry = {
|
|
|
159
91
|
}
|
|
160
92
|
|
|
161
93
|
|
|
162
|
-
// The entries of one list of the role, read from the tree. A concrete
|
|
163
|
-
// string is taken as written, hidden or not; anything else is asked
|
|
164
|
-
// to generate, which is where a kind or a hidden kind fails with the
|
|
165
|
-
// engine's own code, and where a preference answers with its default.
|
|
166
94
|
function readEntries(
|
|
167
95
|
list: any, by: string, ctx: any,
|
|
168
96
|
): { entries: Entry[], finding?: VetFinding } {
|
|
@@ -188,9 +116,6 @@ function segmentMatches(pattern: string, segment: string): boolean {
|
|
|
188
116
|
}
|
|
189
117
|
|
|
190
118
|
|
|
191
|
-
// The two subtrees share a node: one is an ancestor of the other, or
|
|
192
|
-
// they are the same. Checked over the shorter of the two, because the
|
|
193
|
-
// longer one only says where inside the shared subtree it goes on.
|
|
194
119
|
function intersects(entry: string[], path: string[]): boolean {
|
|
195
120
|
const n = Math.min(entry.length, path.length)
|
|
196
121
|
for (let i = 0; i < n; i++) {
|
|
@@ -202,9 +127,6 @@ function intersects(entry: string[], path: string[]): boolean {
|
|
|
202
127
|
}
|
|
203
128
|
|
|
204
129
|
|
|
205
|
-
// The entry is an ancestor of the path, or the path itself. A longer
|
|
206
|
-
// entry names something INSIDE the asked subtree, and a change to the
|
|
207
|
-
// subtree reaches its siblings, so it does not cover.
|
|
208
130
|
function covers(entry: string[], path: string[]): boolean {
|
|
209
131
|
return entry.length <= path.length && intersects(entry, path)
|
|
210
132
|
}
|
|
@@ -214,9 +136,6 @@ function decide(asked: string, allows: Entry[], denies: Entry[]): AllowDecision
|
|
|
214
136
|
const parts = pathParts(asked)
|
|
215
137
|
const path = pathText(parts)
|
|
216
138
|
|
|
217
|
-
// Deny first, and any intersection refuses: an entry above the path
|
|
218
|
-
// forbids the whole subtree it is in, and one below it forbids the
|
|
219
|
-
// change that would rewrite it from above.
|
|
220
139
|
for (const d of denies) {
|
|
221
140
|
if (intersects(d.parts, parts)) {
|
|
222
141
|
return { path, allowed: false, reason: 'deny', by: d.by, pattern: d.text }
|
|
@@ -247,14 +166,6 @@ export function allow(
|
|
|
247
166
|
const ctx = aontu.ctx({ collect: true })
|
|
248
167
|
const parseOpts = null == options.path ? undefined : { path: options.path }
|
|
249
168
|
|
|
250
|
-
// The model MEETS the shape as data meets a schema under vet: both
|
|
251
|
-
// parsed, conjoined, and unified ONCE. A parsed tree is single-use,
|
|
252
|
-
// and a model evaluated on its own and then met again has already
|
|
253
|
-
// resolved its references against itself, so a registry written
|
|
254
|
-
// `roles: close({ &: $.Role ... })` would fail its second pass with
|
|
255
|
-
// a `$.Role` it cannot find. The shape is parsed FIRST: the context
|
|
256
|
-
// takes the last parsed document as its root and as the text an
|
|
257
|
-
// error frame excerpts, and both must be the model's.
|
|
258
169
|
const shape = aontu.parse(shapeSource(at), undefined, ctx)
|
|
259
170
|
const model = aontu.parse(src, parseOpts, ctx)
|
|
260
171
|
if (0 < ctx.err.length) {
|
|
@@ -266,12 +177,6 @@ export function allow(
|
|
|
266
177
|
return errorReport(role, evalFailure(ctx))
|
|
267
178
|
}
|
|
268
179
|
|
|
269
|
-
// The shape made the roles map exist, so what can be missing is the
|
|
270
|
-
// ROLE -- and an undeclared role may modify nothing. That is the
|
|
271
|
-
// question's answer (refused), not a broken model (error), and the
|
|
272
|
-
// finding carries the nearest declared name. The role is one key,
|
|
273
|
-
// looked up as written: not a path, so a name may hold a dot, and
|
|
274
|
-
// an own key only, so a name the prototype has is not a role.
|
|
275
180
|
const roles: any = anchorAt(root, at)
|
|
276
181
|
const atRole = `${at}.${role}`
|
|
277
182
|
if (!Object.prototype.hasOwnProperty.call(roles.peg, role)) {
|
package/src/aontu.ts
CHANGED
|
@@ -35,22 +35,9 @@ import { format, unifiedDiff } from './format'
|
|
|
35
35
|
export type { LintFinding, FormatReport, FormatOptions } from './format'
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
// Kept in step with package.json by the `version` npm lifecycle script,
|
|
43
|
-
// which runs on `npm version` / `npm run repo-bump`. version.test.ts
|
|
44
|
-
// fails if the two ever drift.
|
|
45
|
-
const VERSION = '0.62.0'
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// A module file's VALUE, as far as it goes. COLLECTED, not raised: a
|
|
49
|
-
// module file that does not stand up has no `mod.main` to read, and
|
|
50
|
-
// the default entry name is the answer -- the resolution itself fails
|
|
51
|
-
// later, on the file that is not there, rather than here on a metadata
|
|
52
|
-
// read. That is what a collecting context does, so there is nothing to
|
|
53
|
-
// catch: it answers what it could generate and records the rest.
|
|
38
|
+
const VERSION = '0.63.0'
|
|
39
|
+
|
|
40
|
+
|
|
54
41
|
function genQuiet(val: any, aontu: Aontu): any {
|
|
55
42
|
return val.gen(aontu.ctx({ collect: true }))
|
|
56
43
|
}
|
|
@@ -64,25 +51,9 @@ class Aontu {
|
|
|
64
51
|
constructor(popts?: AontuOptions) {
|
|
65
52
|
this.opts = popts ?? {}
|
|
66
53
|
|
|
67
|
-
// THE MODULE EVALUATOR (G6 phase 2, ts/src/mod.ts). Resolving a
|
|
68
|
-
// module import needs two answers that only evaluation can give:
|
|
69
|
-
// what a module file SAYS (its `mod.main`), and what a module
|
|
70
|
-
// MEANS (its canon-hash, for the integrity check). Injected here
|
|
71
|
-
// rather than imported there, because the resolver runs inside a
|
|
72
|
-
// parse that this class started, and the file it runs in cannot
|
|
73
|
-
// import this one without closing a cycle around the language.
|
|
74
|
-
//
|
|
75
|
-
// COLLECTED, not raised: a module that leans on consumer context
|
|
76
|
-
// (a `$.x` its importer supplies) does not stand up alone, and its
|
|
77
|
-
// hash is still the hash of what it says — that residue is part of
|
|
78
|
-
// the hashed meaning, which is why `hcanon` keeps it in textual
|
|
79
|
-
// form (docs/capability-review/g6-distribution.md).
|
|
80
54
|
;(this.opts as any).mod = {
|
|
81
55
|
...((this.opts as any).mod ?? {}),
|
|
82
56
|
eval: (this.opts as any).mod?.eval ?? ((src: string, path: string) => {
|
|
83
|
-
// One deeper: a module verified from inside a module
|
|
84
|
-
// verification is one more level of nesting, and the resolver
|
|
85
|
-
// refuses past its bound (MODULE_MAX_DEPTH in ts/src/mod.ts).
|
|
86
57
|
const inner = new Aontu({
|
|
87
58
|
...this.opts,
|
|
88
59
|
mod: {
|
|
@@ -118,12 +89,6 @@ class Aontu {
|
|
|
118
89
|
}
|
|
119
90
|
|
|
120
91
|
|
|
121
|
-
// Parse source into a matching Val AST, not yet unified.
|
|
122
|
-
//
|
|
123
|
-
// NOTE: the returned Val is SINGLE-USE — unify()/generate() refine the
|
|
124
|
-
// tree in place (see Val.unify), so do not unify or generate the same
|
|
125
|
-
// parsed Val more than once, and do not share it across threads. Call
|
|
126
|
-
// parse() again for a fresh tree.
|
|
127
92
|
parse(src: string, opts?: AontuOptions, ac?: AontuContext): Val | undefined {
|
|
128
93
|
let out: Val | undefined
|
|
129
94
|
let errs: any[] = []
|
|
@@ -140,12 +105,6 @@ class Aontu {
|
|
|
140
105
|
errs.push(out)
|
|
141
106
|
}
|
|
142
107
|
else {
|
|
143
|
-
// A version-control conflict marker is refused BEFORE the parse
|
|
144
|
-
// (issue #5). None of `<`, `=` or `>` is an aontu operator, so a
|
|
145
|
-
// marker line is ordinary text and `<<<<<<< HEAD` parsed happily
|
|
146
|
-
// into the two-string list ["<<<<<<<","HEAD"] -- an unresolved
|
|
147
|
-
// merge became a plausible document instead of an error, and the
|
|
148
|
-
// report of it read as a failed `<` operation.
|
|
149
108
|
const marker = findConflictMarker(src)
|
|
150
109
|
if (-1 !== marker.offset) {
|
|
151
110
|
const nil: any = makeNilErr(ac, 'merge_conflict')
|
|
@@ -158,10 +117,6 @@ class Aontu {
|
|
|
158
117
|
|
|
159
118
|
if (0 === errs.length) {
|
|
160
119
|
out = runparse(src, this.lang, ac)
|
|
161
|
-
// The include MANIFEST (G5, docs/trust.md): the resolved include
|
|
162
|
-
// closure as `{ path, capability }`, sorted and deduplicated so
|
|
163
|
-
// it is deterministic — the "file set" of hermeticity clause 1
|
|
164
|
-
// made observable. Content hashing and pinning stay with G6.
|
|
165
120
|
out.deps = manifestOf(ac.manifest)
|
|
166
121
|
ac.root = out
|
|
167
122
|
}
|
|
@@ -207,10 +162,6 @@ class Aontu {
|
|
|
207
162
|
out = uni.res
|
|
208
163
|
|
|
209
164
|
out.deps = pval.deps
|
|
210
|
-
// THE DERIVED STRUCTURE (G4 phase 3): the edge set, computed
|
|
211
|
-
// once from the unified tree. Cheap on a document with no links
|
|
212
|
-
// — one guarded walk — and the thing impact analysis and the
|
|
213
|
-
// relation checks are traversals over.
|
|
214
165
|
out.graph = graphOf(out)
|
|
215
166
|
out.err = errs
|
|
216
167
|
ac.root = out
|
|
@@ -222,19 +173,6 @@ class Aontu {
|
|
|
222
173
|
}
|
|
223
174
|
|
|
224
175
|
|
|
225
|
-
// Generate output structure from source, which must parse and fully unify.
|
|
226
|
-
//
|
|
227
|
-
// The result is made of NATIVE values, and D9 puts two beyond what
|
|
228
|
-
// `JSON.stringify` can write: a `biginteger` (a `0d` literal with no
|
|
229
|
-
// fraction or exponent) generates as a native `bigint`, and a
|
|
230
|
-
// `bigdecimal` generates as a `Decimal`. Both are exact at any
|
|
231
|
-
// magnitude, which is the whole point of the leaves -- and both are
|
|
232
|
-
// confined to documents that opt in, so a `0d`-free document generates
|
|
233
|
-
// exactly what it always did.
|
|
234
|
-
//
|
|
235
|
-
// Serialise the result with `exactJSON` (exported alongside this
|
|
236
|
-
// class), NOT with `JSON.stringify`: the latter throws on a bigint and
|
|
237
|
-
// has no way to write exact digits as a JSON number.
|
|
238
176
|
generate(src: string, opts?: any, ac?: AontuContext): any {
|
|
239
177
|
try {
|
|
240
178
|
let out = undefined
|
|
@@ -247,7 +185,6 @@ class Aontu {
|
|
|
247
185
|
if (undefined !== pval && 0 === pval.err.length) {
|
|
248
186
|
|
|
249
187
|
let uval = this.unify(pval, undefined, ac)
|
|
250
|
-
// console.log('AONTU-GENERATE-UVAL', uval.constructor, uval.mark)
|
|
251
188
|
|
|
252
189
|
if (undefined !== uval && 0 === uval.err.length) {
|
|
253
190
|
|
|
@@ -255,23 +192,6 @@ class Aontu {
|
|
|
255
192
|
: 0 < ac.err.length ? undefined
|
|
256
193
|
: uval.gen(ac as any)
|
|
257
194
|
|
|
258
|
-
// The relation verdict (RELATIONS P2): declarations the
|
|
259
|
-
// graph atoms registered during unification are decided
|
|
260
|
-
// HERE, where no more information can arrive -- the sizing
|
|
261
|
-
// atoms' model. A violated declaration is a located
|
|
262
|
-
// evaluation error at the offending edge, and the generated
|
|
263
|
-
// value is discarded below.
|
|
264
|
-
//
|
|
265
|
-
// AFTER GENERATION, and only when generation SUCCEEDED. A
|
|
266
|
-
// document that cannot be generated has no finished model
|
|
267
|
-
// to have a graph verdict about: an unsettled disjunction
|
|
268
|
-
// leaves alternatives the graph walk cannot read, so a
|
|
269
|
-
// mirror the document writes is absent from the edge set
|
|
270
|
-
// and `inverse(n)` reports it missing -- a false finding,
|
|
271
|
-
// and one that buried the `disjunct_no_gen` that actually
|
|
272
|
-
// stopped the document. The check that a broken document is
|
|
273
|
-
// not blamed on its relations (`relations` verb, finding F)
|
|
274
|
-
// holds here too.
|
|
275
195
|
if (!uval.isNil && 0 === ac.err.length) {
|
|
276
196
|
relationErrors(ac as any, uval)
|
|
277
197
|
if (0 < ac.err.length) {
|
|
@@ -333,17 +253,6 @@ function handleErrors(errs: any[], out: Val | undefined, ac: AontuContext) {
|
|
|
333
253
|
}
|
|
334
254
|
|
|
335
255
|
|
|
336
|
-
// Locate the first version-control conflict marker in a source, as a
|
|
337
|
-
// 1-based row and column (offset -1 when there is none).
|
|
338
|
-
//
|
|
339
|
-
// The shape is git's, and it is matched exactly: SEVEN of `<`, `=` or `>`
|
|
340
|
-
// at the very start of a line, then either the end of that line or a
|
|
341
|
-
// space before the branch label. Requiring the run length and the line
|
|
342
|
-
// start is what keeps a document that legitimately writes `a:"<<<<<<<"`,
|
|
343
|
-
// or a row of `=` inside a string, from being refused -- the marker is
|
|
344
|
-
// recognised as the artifact it is, not as a suspicious character.
|
|
345
|
-
//
|
|
346
|
-
// Kept byte-identical to findConflictMarker in go/lang.go.
|
|
347
256
|
function findConflictMarker(src: string): {
|
|
348
257
|
offset: number, row: number, col: number
|
|
349
258
|
} {
|
|
@@ -444,17 +353,9 @@ export {
|
|
|
444
353
|
util,
|
|
445
354
|
formatExplain,
|
|
446
355
|
|
|
447
|
-
// D9 -- the generate contract. `exactJSON` is the supported way to
|
|
448
|
-
// turn `generate()` output into JSON when a document uses the exact
|
|
449
|
-
// leaves, and `Decimal` is the type a `bigdecimal` generates as (a
|
|
450
|
-
// `biginteger` generates as the language's own `bigint`).
|
|
451
356
|
exactJSON,
|
|
452
357
|
Decimal,
|
|
453
358
|
|
|
454
|
-
// G2 phase 2 -- the validation verb. The engine only: the CLI verb
|
|
455
|
-
// and the text/JSON renderers are phase 3, the Go port phase 4.
|
|
456
|
-
// `sarifReport` (phase 5) is library API so an embedder can emit the
|
|
457
|
-
// interchange form without shelling out.
|
|
458
359
|
vet,
|
|
459
360
|
sarifReport,
|
|
460
361
|
|
|
@@ -464,10 +365,6 @@ export {
|
|
|
464
365
|
subsume,
|
|
465
366
|
trimCheck,
|
|
466
367
|
|
|
467
|
-
// G6 -- the hash form and the canon-hash pin. `hcanon` is the
|
|
468
|
-
// unify-level canon plus the close()/type()/hide() wrappers that
|
|
469
|
-
// close its semantic gaps; `canonHash` is
|
|
470
|
-
// "aon1-" + base64url(SHA-256(UTF-8(hcanon(v)))).
|
|
471
368
|
hcanon,
|
|
472
369
|
canonHash,
|
|
473
370
|
|
|
@@ -497,10 +394,6 @@ export {
|
|
|
497
394
|
renderValue,
|
|
498
395
|
renderProfile,
|
|
499
396
|
|
|
500
|
-
// The template surface (docs/design/TEMPLATE.0.md): the two text
|
|
501
|
-
// transforms behind `aontu template`, and the marker an extension
|
|
502
|
-
// names. Neither evaluates anything -- a template is a spelling of
|
|
503
|
-
// a generator, so the transforms are text in and text out.
|
|
504
397
|
desugarTemplate,
|
|
505
398
|
resugarTemplate,
|
|
506
399
|
markerFor,
|