@altopelago/sansa 0.9.0 → 0.10.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/CHANGELOG.md CHANGED
@@ -5,6 +5,156 @@ All notable changes to this package are documented here.
5
5
  This project follows Semantic Versioning while it remains pre-1.0. Minor
6
6
  versions may still include breaking changes when the SANSA specifications move.
7
7
 
8
+ ## Unreleased
9
+
10
+ No notable changes yet.
11
+
12
+ ## 0.10.0 - 2026-09-01
13
+
14
+ ### Breaking
15
+
16
+ - Renamed the AEON temporal literal family from `zrut` to `wtc` across query,
17
+ instruction, mutation, workbench, fixture, declaration, and documentation
18
+ surfaces.
19
+ - Changed qualifier datatype clarifiers to one bracketed list. String
20
+ clarifiers must now be quoted, multiple values use comma separation inside
21
+ the same brackets, and numeric clarifiers such as `radix[16]` are represented
22
+ as numbers. Repeated clarifier lists and unquoted string clarifiers are
23
+ rejected.
24
+
25
+ ### Added
26
+
27
+ - Added experimental `traverseGraph(...)` and `traverseGraphSequence(...)`
28
+ APIs for declared, directed relationship traversal with ordered path
29
+ provenance.
30
+ - Added experimental graph capability metadata covering schema-version
31
+ applicability, semantic-type constraints, edge cardinality, cycle policy,
32
+ authorization hooks, and explicit traversal budgets.
33
+
34
+ ### Changed
35
+
36
+ - Updated address, instruction, mutation, query, fixture, stress, and API
37
+ contract surfaces to use the unified AEON datatype clarifier grammar.
38
+
39
+ ### Security
40
+
41
+ - Graph traversal requires explicit budgets and applies an independent
42
+ authorization decision to every traversal step without granting authority to
43
+ composed Query reads.
44
+
45
+ ## 0.9.1 - 2026-08-02
46
+
47
+ ### Added
48
+
49
+ - Added explicit Shared AEON Value Semantics profile hooks for string comparison,
50
+ ordering, and case mapping.
51
+ - Added `aeonValueSemanticsDefaultProfile`,
52
+ `createIntlValueSemanticsProfile(...)`, and
53
+ `createFrenchValueSemanticsProfile(...)`.
54
+ - Added `createNaturalAsciiValueSemanticsProfile(...)` and the
55
+ `aeon.value.string.natural.ascii.v1` profile for deterministic numeric-region
56
+ string ordering.
57
+ - Added Query `valueSemantics` evaluation option so consumers can select default
58
+ or domain-specific string semantics.
59
+ - Added minimum structural equality and reference-form equality coverage to the
60
+ standalone value-semantics helper.
61
+ - Added experimental SANSA.Mutate structured planning and host-adapter apply
62
+ APIs for exact `create`, `replace`, `remove`, ordered `insert`, and
63
+ same-container `move`.
64
+ - Added experimental SANSA.Mutate structured preconditions evaluated during
65
+ planning with the SANSA.Query expression evaluator.
66
+ - Added default apply-time rechecking of preserved SANSA.Mutate preconditions
67
+ before mutation hooks run.
68
+ - Added experimental SANSA.Mutate `maxOperations` and `maxPreconditions`
69
+ budgets for planning and apply.
70
+ - Added explicit SANSA.Mutate apply report addresses for mutation role,
71
+ affected binding, and resulting binding diagnostics.
72
+ - Added SANSA.Mutate plan-level `sourceProvenance` preservation for structured
73
+ request envelopes.
74
+ - Added SANSA.Mutate plan-level portability warning preservation for locally
75
+ accepted non-portable targets.
76
+ - Added explicit SANSA.Mutate adapter capability flags for operation support and
77
+ stable/atomic apply capability advertisement.
78
+ - Added an experimental browser SANSA Mutate Workbench for structured JSON
79
+ mutation requests against `.aeon` source fixtures.
80
+ - Added experimental SANSA.Instruction parsing, lowering, CLI tooling, and
81
+ Mutate Workbench integration for conservative mutation verbs.
82
+ - Added SANSA.Instruction `append` source syntax as an alias for
83
+ `insert last`.
84
+ - Added SANSA.Instruction `require` clauses that lower into structured
85
+ SANSA.Mutate preconditions.
86
+ - Added SANSA.Instruction `because` and `by` clauses that preserve inert
87
+ source-level claimed provenance.
88
+ - Added SANSA.Instruction CTS coverage for quoted create member names,
89
+ attribute-space create destinations, candidate-relative remove/append/move,
90
+ repeated require preconditions, target-surface datatype rejection, and illegal
91
+ positional create destinations.
92
+ - Added SANSA.Instruction negative CTS coverage for candidate-relative lowering
93
+ misses and downstream Mutate planning failures for non-ordered containers,
94
+ invalid anchors, and cross-container or self-anchored moves.
95
+ - Added SANSA.Instruction parse/value CTS coverage for comments, complex
96
+ datatype intent, malformed container literals, invalid quoted create
97
+ destinations, nested datatype unions, and literal-only value payloads.
98
+ - Added SANSA.Instruction CTS coverage for quoted address-member create
99
+ destinations, selector-as-create-destination rejection, typed replace values,
100
+ date values, and SANSA selector values.
101
+ - Added Mutate Workbench diagnostic examples for duplicate object fields,
102
+ literal-only value failures, invalid create member names, lower-phase target
103
+ misses, lower-phase anchor misses, and JSON tuple target rejection.
104
+ - Added Mutate Workbench policy-boundary examples for allowed operations,
105
+ default-deny failures, and explicit-deny failures.
106
+ - Added experimental SANSA.Mutate target-surface validation for AEON,
107
+ JSON-compatible, and custom representability checks.
108
+ - Added a workbench-only experimental SANSA.Mutate policy plan filter for
109
+ trusted consumer authorization tests.
110
+
111
+ ### Changed
112
+
113
+ - Updated `isValue(...)` to use the concrete-value basis: infinities and
114
+ containers are values, while Missing, explicit null, explicit absence values,
115
+ NaN, and Binding Sets are not.
116
+ - Kept default Query string ordering on deterministic Unicode scalar value
117
+ order unless an explicit value-semantics profile is supplied.
118
+ - Updated TypeScript declarations for SANSA.Instruction values to include
119
+ object, list, tuple, node, SANSA address, and reference literal payloads.
120
+ - Rejected duplicate object field names in SANSA.Instruction object value
121
+ literals instead of silently keeping the last value.
122
+ - Updated Mutate Workbench error responses so instruction parse failures expose
123
+ their parse phase and nested cause diagnostics in text mode.
124
+ - Clarified Instruction and Mutate documentation around parse, lower, plan,
125
+ policy, target-surface, and apply phase boundaries.
126
+ - Added Instruction coverage for repeated same-verb mutation rejection and
127
+ direct `require` precondition planning failures.
128
+ - Clarified Instruction ordered placement vocabulary and added coverage for
129
+ append canonicalization plus direct `insert after` and `move last` forms.
130
+ - Clarified Instruction value-intent boundaries for typed scalars, typed
131
+ containers, nested container literals, and target-neutral lowering.
132
+ - Clarified Instruction target-surface behavior for AEON and JSON, including
133
+ JSON-compatible containers and parameterized datatype rejection.
134
+ - Improved target-surface diagnostics so CLI and Workbench text output expose
135
+ target format, rejected datatype, and rejected value path when available.
136
+ - Improved experimental policy diagnostics so Workbench and CTS output can
137
+ identify the affected rule, policy field, policy scope, and invalid matcher
138
+ address when available.
139
+ - Expanded Instruction/Mutate target-surface coverage for type-first values on
140
+ ordered inserts and AEON parameterized container datatype families.
141
+ - Moved Mutate Workbench examples into a shared catalog module so UI rendering
142
+ and runtime tests use the same grouped example source.
143
+ - Added declared Mutate Workbench catalog expectations and runtime coverage for
144
+ every structured and Instruction example variant.
145
+ - Added operation-count and selected text-snippet assertions for representative
146
+ successful Mutate Workbench catalog examples.
147
+ - Updated the Mutate Workbench status chip and catalog metadata so parse,
148
+ lower, plan, policy, target, and apply phases remain visible in the UI and
149
+ tests.
150
+
151
+ ### Security
152
+
153
+ - Require explicit trusted or constrained activation authority before Query
154
+ `path(...)` resolves a structured SANSA Address Literal, with parsed
155
+ structural-root checks, selector capability restrictions, contextual and
156
+ parent containment checks, and dynamic binding bounds.
157
+
8
158
  ## 0.9.0 - 2026-07-24
9
159
 
10
160
  Initial public pre-1.0 release of `@altopelago/sansa`.
package/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # SANSA
2
2
 
3
- Shared Semantic Address NameSpace Abstraction (SANSA) address, resolve, and query parser/evaluator model.
3
+ Shared Semantic Address NameSpace Abstraction (SANSA) address, resolve, query, instruction, and mutation-planning model.
4
4
 
5
- This package is the first implementation package for SANSA Address, SANSA Resolve, and SANSA.Query. It parses and renders SANSA address expressions, resolves those expressions against a host-supplied namespace adapter, parses the SANSA.Query clause and expression surfaces, and evaluates a bounded query subset over host-neutral bindings. It also exposes the Shared AEON Value Semantics minimum consumer contract used by Query for ordinary scalar, equality, and ordering behavior. It does not inspect host values directly beyond host-exposed binding metadata, apply host-specific authorization, or assign semantics to qualifiers.
5
+ This package is the first implementation package for SANSA Address, SANSA Resolve, and SANSA.Query, with experimental SANSA.Instruction parsing/lowering and an experimental structured-plan API for SANSA.Mutate. It parses and renders SANSA address expressions, resolves those expressions against a host-supplied namespace adapter, parses the SANSA.Query clause and expression surfaces, and evaluates a bounded query subset over host-neutral bindings. It also exposes the Shared AEON Value Semantics minimum consumer contract used by Query for concrete value predicates, equality, ordering behavior, and string profile hooks. The experimental Instruction API parses human-authored change intents, lowers them into structured Mutate requests, and can bridge into mutation planning. The experimental Mutate API plans exact create, replace, remove, insert, and same-container move operations, preserves datatype/kind value intent, enforces operation/precondition/value budgets, validates target-surface representability through a separate post-plan API, and applies plans only through host-supplied mutation hooks. It does not inspect host values directly beyond host-exposed binding metadata, apply host-specific authorization, provide transactions, decide schema legality, or assign semantics to qualifiers.
6
6
 
7
- Implementation capability metadata is recorded in [docs/capabilities.json](docs/capabilities.json). The package currently advertises `AEON.ValueSemantics`, `SANSA.Addressing`, `SANSA.Resolve`, `SANSA.Query`, Query budget controls, the experimental `validation` Query policy, and experimental `SANSA.Transform` library extensions for `objectFrom` and `fieldsFrom`.
7
+ Implementation capability metadata is recorded in [docs/capabilities.json](docs/capabilities.json). The package currently advertises `AEON.ValueSemantics`, `SANSA.Addressing`, `SANSA.Resolve`, `SANSA.Query`, Query budget controls, the experimental `validation` Query policy, experimental `SANSA.Transform` library extensions for `objectFrom` and `fieldsFrom`, experimental `SANSA.Instruction` parse/lower/plan bridging, an experimental `SANSA.Mutate` plan API, and the workbench-only experimental `sansa.mutate.policy.planFilter` slice.
8
+
9
+ CTS snapshot claims are recorded in [conformance/cts-claims.json](conformance/cts-claims.json).
8
10
 
9
11
  ## Current Scope
10
12
 
@@ -24,6 +26,12 @@ Implementation capability metadata is recorded in [docs/capabilities.json](docs/
24
26
  - query comment stripping, clause-order validation, and canonical query rendering
25
27
  - SANSA.Query expression parsing for resolution expressions, literals, comparisons, Boolean operators, membership, cardinality operators, function-call shape, and projection shape
26
28
  - SANSA.Query evaluation for `from`, Boolean `where`, `order by`, `offset`, `limit`, and `select` over literals, resolution expressions, comparisons, Boolean operators, membership, cardinality predicates, built-in string functions, function-like operators, and projection expressions
29
+ - experimental SANSA.Mutate structured planning for exact `create`, `replace`, `remove`, ordered `insert`, and same-container `move`
30
+ - experimental SANSA.Mutate value-intent preservation and operation, precondition, and value budgets
31
+ - experimental SANSA.Mutate target-surface validation for AEON, JSON-compatible, and custom target representability checks
32
+ - experimental workbench-only SANSA.Mutate policy plan filter for trusted consumer authorization tests
33
+ - experimental mutation apply through explicit host mutation hooks with stale-target checks
34
+ - experimental SANSA.Instruction parsing, candidate-relative lowering, and mutation-planner bridging for conservative mutation verbs
27
35
 
28
36
  Host implementations decide which qualifier surface they accept. This parser accepts the SANSA qualifier grammar and preserves it structurally.
29
37
 
@@ -43,9 +51,12 @@ npm run cts:value-semantics
43
51
  npm run cts:resolve
44
52
  npm run cts:query
45
53
  npm run cts:query:experimental
54
+ npm run cts:instruction
55
+ npm run cts:mutate
46
56
  ```
47
57
 
48
58
  The default Query CTS lane runs core conformance and skips experimental extension cases. `cts:query:experimental` includes experimental extension coverage.
59
+ The Instruction and Mutate CTS lanes are experimental and are not included in `npm run cts` while SANSA.Instruction and SANSA.Mutate remain proposal-stage. The Mutate lane includes structured planning, apply, target-surface, and experimental policy plan-filter cases.
49
60
 
50
61
  ## Query Tool
51
62
 
@@ -69,9 +80,59 @@ npm run query:web
69
80
 
70
81
  Then open `http://127.0.0.1:4173/tools/query-web/`.
71
82
 
83
+ The same local server also exposes the experimental Mutate Workbench:
84
+
85
+ ```bash
86
+ npm run mutate:web
87
+ ```
88
+
89
+ Then open `http://127.0.0.1:4173/tools/mutate-web/`.
90
+
91
+ The Mutate Workbench accepts either structured mutation-request JSON or
92
+ proposal-stage SANSA Instruction source, then uses the same plan/apply preview
93
+ surface. It also includes an experimental target selector so planned mutations
94
+ can be checked against AEON or JSON-compatible representation surfaces before
95
+ apply/render. JSON responses include `targetProfile` metadata that names the
96
+ selected representability boundary. Its phase model is intentionally explicit: parse Instruction
97
+ source when present, lower to exact structured mutation operations, plan through
98
+ SANSA.Mutate, run optional consumer policy, run optional target-surface
99
+ validation, then preview or apply through host mutation hooks.
100
+ The optional policy panel is a workbench-only prototype of the experimental
101
+ `sansa.mutate.policy.planFilter` slice for trusted consumer authorization tests;
102
+ its current boundary is documented in
103
+ [docs/mutate-policy.md](docs/mutate-policy.md).
104
+
105
+ Both the CLI and browser workbench can select an explicit query value-semantics
106
+ profile, such as the default codepoint profile, the Natural ASCII numeric-region
107
+ profile, or the French locale profile, to test comparison, ordering, and
108
+ case-mapping behavior under different consumer contexts.
109
+
72
110
  Full CLI, workbench, Query semantics, and recipe details live in
73
111
  [docs/query-tool.md](docs/query-tool.md).
74
112
 
113
+ Library use of Query `path(...)` requires explicit dynamic-address authority.
114
+ Use `addressActivation: "trusted"` only when the caller already controls the
115
+ query, Address values, and exposed namespace. Cross-boundary consumers should
116
+ provide constrained structural roots, selector capabilities, and result bounds;
117
+ reading an Address value does not authorize resolving it.
118
+
119
+ ## Instruction Tool
120
+
121
+ The package includes an experimental instruction tool for exercising
122
+ SANSA.Instruction parse, lower, and plan behavior:
123
+
124
+ ```bash
125
+ npm run instruction -- --mode parse --instruction 'replace $.inventory.items[1].qty with :int32 10'
126
+ npm run instruction -- --mode lower --instruction $'from $.inventory.items.*\nwhere .sku == "B-200"\nreplace .qty with :int32, 10'
127
+ npm run instruction -- --mode plan --instruction $'because "manual correction"\nby "Bob"\nfrom $.inventory.items.*\nwhere .sku == "B-200"\nreplace .qty with :int32, 10'
128
+ ```
129
+
130
+ The default fixture is [fixtures/query-inventory.json](fixtures/query-inventory.json).
131
+ Instruction `because` and `by` clauses are preserved as claimed source
132
+ provenance only; authorization, actor identity, and audit evidence remain host
133
+ responsibilities.
134
+ Full details live in [docs/instruction-tool.md](docs/instruction-tool.md).
135
+
75
136
  ## Release Notes
76
137
 
77
138
  Release history lives in [CHANGELOG.md](CHANGELOG.md).
@@ -82,11 +143,17 @@ Release history lives in [CHANGELOG.md](CHANGELOG.md).
82
143
  import {
83
144
  evaluateQuery,
84
145
  evaluateValueSemanticsOperation,
146
+ applyMutationPlan,
147
+ lowerInstruction,
85
148
  parseAddress,
149
+ parseInstruction,
150
+ planInstruction,
151
+ planMutation,
86
152
  parseQuery,
87
153
  parseQueryExpression,
88
154
  renderAddress,
89
- resolveAddress
155
+ resolveAddress,
156
+ validateMutationPlanTarget
90
157
  } from "@altopelago/sansa";
91
158
 
92
159
  const result = parseAddress('$.inventory:csv[","]');
@@ -141,6 +208,42 @@ const ordinary = evaluateValueSemanticsOperation("isValue", {
141
208
  if (ordinary.ok) {
142
209
  console.log(ordinary.value);
143
210
  }
211
+
212
+ const mutation = planMutation({ op: "replace", target: "$.inventory.sku", value: "B-200" }, {
213
+ root,
214
+ mutate: {
215
+ replace(target, value) {
216
+ target.value = value;
217
+ return { binding: target };
218
+ }
219
+ }
220
+ });
221
+
222
+ if (mutation.ok) {
223
+ const targetSurface = validateMutationPlanTarget(mutation.plan, "aeon");
224
+
225
+ if (targetSurface.ok) {
226
+ const applied = applyMutationPlan(mutation.plan, {
227
+ root,
228
+ mutate: {
229
+ replace(target, value) {
230
+ target.value = value;
231
+ return { binding: target };
232
+ }
233
+ }
234
+ });
235
+ console.log(applied.ok);
236
+ }
237
+ }
238
+
239
+ const instructionPlan = planInstruction(
240
+ 'replace $.inventory.sku with "B-200"',
241
+ { root }
242
+ );
243
+
244
+ if (instructionPlan.ok) {
245
+ console.log(instructionPlan.plan.operations.length);
246
+ }
144
247
  ```
145
248
 
146
249
  Each query result carries the source candidate `address` when the namespace exposes one. The projected selection or object lives in `result.value`.
@@ -0,0 +1,19 @@
1
+ # Conformance Claims
2
+
3
+ This directory records the CTS snapshots claimed by the standalone SANSA
4
+ implementation package.
5
+
6
+ `cts-claims.json` is machine-readable implementation metadata. It identifies the
7
+ exact CTS snapshot ids that the package claims, plus the local command used to
8
+ run each lane.
9
+
10
+ Validate the claim file against the sibling CTS checkout with:
11
+
12
+ ```bash
13
+ npm run validate:cts-claims
14
+ ```
15
+
16
+ Claims marked `experimental` are implemented prototype or proposal-stage slices.
17
+ They are useful for tracking progress, but they are not part of the default
18
+ stable SANSA conformance claim while those specification surfaces remain
19
+ proposal-stage.
@@ -0,0 +1,53 @@
1
+ {
2
+ "claim_format": "aeonite.cts-claims.v1",
3
+ "repository": "AltoPelago/sansa",
4
+ "implementation": "@altopelago/sansa",
5
+ "implementation_version": "0.10.0",
6
+ "cts_repository": "aeonite-org/aeonite-cts",
7
+ "cts_protocol": "cts.protocol.v1",
8
+ "claims": [
9
+ {
10
+ "surface": "value-semantics",
11
+ "snapshot_id": "value-semantics-cts-v1-snapshot-0.1",
12
+ "status": "claimed",
13
+ "command": "npm run cts:value-semantics"
14
+ },
15
+ {
16
+ "surface": "sansa-address-parser",
17
+ "snapshot_id": "sansa-address-parser-cts-v1-snapshot-0.1",
18
+ "status": "claimed",
19
+ "command": "npm run cts:address"
20
+ },
21
+ {
22
+ "surface": "sansa-resolve",
23
+ "snapshot_id": "sansa-resolve-cts-v1-snapshot-0.1",
24
+ "status": "claimed",
25
+ "command": "npm run cts:resolve"
26
+ },
27
+ {
28
+ "surface": "sansa-query-parser",
29
+ "snapshot_id": "sansa-query-parser-cts-v1-snapshot-0.2",
30
+ "status": "claimed",
31
+ "command": "npm run cts:query",
32
+ "notes": "The default command excludes experimental extension cases."
33
+ },
34
+ {
35
+ "surface": "sansa-query-experimental",
36
+ "snapshot_id": "sansa-query-parser-cts-v1-snapshot-0.2",
37
+ "status": "experimental",
38
+ "command": "npm run cts:query:experimental"
39
+ },
40
+ {
41
+ "surface": "sansa-instruction",
42
+ "snapshot_id": "sansa-instruction-cts-v1-snapshot-0.2",
43
+ "status": "experimental",
44
+ "command": "npm run cts:instruction"
45
+ },
46
+ {
47
+ "surface": "sansa-mutate",
48
+ "snapshot_id": "sansa-mutate-cts-v1-snapshot-0.1",
49
+ "status": "experimental",
50
+ "command": "npm run cts:mutate"
51
+ }
52
+ ]
53
+ }