@altopelago/sansa 0.14.2 → 0.15.0-rc.2

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 (156) hide show
  1. package/CHANGELOG.md +118 -1
  2. package/README.md +96 -1
  3. package/conformance/README.md +8 -0
  4. package/conformance/aeonic-anchor-claims.json +133 -0
  5. package/conformance/aeonic-arithmetic-claims.json +60 -0
  6. package/conformance/aeonic-clock-claims.json +123 -0
  7. package/conformance/aeonic-comparison-claims.json +37 -0
  8. package/conformance/aeonic-datetime-claims.json +110 -0
  9. package/conformance/aeonic-rational-arithmetic-claims.json +72 -0
  10. package/conformance/aeonic-temporal-claims.json +105 -0
  11. package/conformance/cts-claims.json +17 -3
  12. package/conformance/results/aeonic-anchor-capacity.json +452 -0
  13. package/conformance/results/aeonic-anchor-snapshot-0.1.json +39 -0
  14. package/conformance/results/aeonic-arithmetic-snapshot-0.1.json +28 -0
  15. package/conformance/results/aeonic-clock-all-snapshot-0.1.json +49 -0
  16. package/conformance/results/aeonic-clock-arithmetic-snapshot-0.1.json +48 -0
  17. package/conformance/results/aeonic-clock-capacity.json +326 -0
  18. package/conformance/results/aeonic-clock-relations-snapshot-0.1.json +48 -0
  19. package/conformance/results/aeonic-comparison-snapshot-0.1.json +19 -0
  20. package/conformance/results/aeonic-datetime-all-snapshot-0.1.json +47 -0
  21. package/conformance/results/aeonic-datetime-arithmetic-snapshot-0.1.json +46 -0
  22. package/conformance/results/aeonic-datetime-capacity.json +302 -0
  23. package/conformance/results/aeonic-datetime-relations-snapshot-0.1.json +46 -0
  24. package/conformance/results/aeonic-rational-arithmetic-capacity.json +100 -0
  25. package/conformance/results/aeonic-rational-arithmetic-snapshot-0.2.json +30 -0
  26. package/conformance/results/aeonic-temporal-all-property-addressing-2026-11-16.json +39 -0
  27. package/conformance/results/aeonic-temporal-all-snapshot-0.1.json +39 -0
  28. package/conformance/results/aeonic-temporal-calendar-property-addressing-2026-11-16.json +38 -0
  29. package/conformance/results/aeonic-temporal-calendar-snapshot-0.1.json +38 -0
  30. package/conformance/results/aeonic-temporal-capacity-property-addressing-2026-11-16.json +136 -0
  31. package/conformance/results/aeonic-temporal-capacity.json +136 -0
  32. package/conformance/results/aeonic-temporal-relations-property-addressing-2026-11-16.json +38 -0
  33. package/conformance/results/aeonic-temporal-relations-snapshot-0.1.json +38 -0
  34. package/docs/aeonic-arithmetic.md +126 -0
  35. package/docs/aeonic-comparison.md +123 -0
  36. package/docs/aeonic-rational-arithmetic.md +167 -0
  37. package/docs/aeonic-temporal-civil-anchor.md +89 -0
  38. package/docs/aeonic-temporal-civil-clock.md +100 -0
  39. package/docs/aeonic-temporal-civil-date.md +124 -0
  40. package/docs/aeonic-temporal-civil-datetime.md +122 -0
  41. package/docs/api-contract.md +130 -3
  42. package/docs/capabilities.json +106 -2
  43. package/docs/child-identity-activation.md +93 -0
  44. package/docs/child-identity-candidate.md +60 -0
  45. package/docs/child-identity-tooling.md +31 -0
  46. package/docs/child-identity-workflows.md +102 -0
  47. package/docs/empty-keys-candidate.md +29 -0
  48. package/docs/migration-0.15.0.md +75 -0
  49. package/docs/property-addressing-implementation.md +118 -0
  50. package/docs/property-resolve-implementation.md +105 -0
  51. package/docs/property-selector-support.md +65 -0
  52. package/docs/property-selectors-api.d.ts +43 -0
  53. package/docs/property-selectors-api.pyi +27 -0
  54. package/docs/property-selectors-api.rs +48 -0
  55. package/docs/property-selectors-contract.md +168 -0
  56. package/docs/query-tool.md +32 -1
  57. package/docs/selector-cursor.md +45 -0
  58. package/docs/unicode-hardening.md +41 -0
  59. package/fixtures/address-v1.json +4 -3
  60. package/fixtures/child-identity-workflows/README.md +9 -0
  61. package/fixtures/child-identity-workflows/moved.aeon +10 -0
  62. package/fixtures/child-identity-workflows/original.aeon +10 -0
  63. package/fixtures/child-identity-workflows/reordered.aeon +10 -0
  64. package/fixtures/child-identity-workflows/replacement.aeon +10 -0
  65. package/fixtures/child-identity-workflows/workflows.json +89 -0
  66. package/fixtures/property-namespace-candidate-v1.json +336 -0
  67. package/fixtures/property-parser-candidate-v1.json +705 -0
  68. package/fixtures/property-query-candidate-v1.json +398 -0
  69. package/fixtures/property-resolve-candidate-v1.json +2702 -0
  70. package/fixtures/unicode-hardening-v1.json +401 -0
  71. package/package.json +30 -3
  72. package/scripts/calibrate-aeonic-anchor-capacity.py +294 -0
  73. package/scripts/calibrate-aeonic-clock-capacity.py +62 -0
  74. package/scripts/calibrate-aeonic-datetime-capacity.py +76 -0
  75. package/scripts/calibrate-aeonic-rational-capacity.py +85 -0
  76. package/scripts/calibrate-aeonic-temporal-capacity.py +95 -0
  77. package/scripts/cts-address.mjs +6 -2
  78. package/scripts/cts-aeonic-anchor.mjs +21 -0
  79. package/scripts/cts-aeonic-arithmetic-adapter.mjs +25 -0
  80. package/scripts/cts-aeonic-arithmetic.mjs +24 -0
  81. package/scripts/cts-aeonic-clock.mjs +24 -0
  82. package/scripts/cts-aeonic-comparison-adapter.mjs +30 -0
  83. package/scripts/cts-aeonic-comparison.mjs +25 -0
  84. package/scripts/cts-aeonic-datetime.mjs +24 -0
  85. package/scripts/cts-aeonic-rational-arithmetic-adapter.mjs +25 -0
  86. package/scripts/cts-aeonic-rational-arithmetic.mjs +24 -0
  87. package/scripts/cts-aeonic-temporal-civil-anchor-adapter.mjs +26 -0
  88. package/scripts/cts-aeonic-temporal-civil-clock-adapter.mjs +28 -0
  89. package/scripts/cts-aeonic-temporal-civil-date-adapter.mjs +28 -0
  90. package/scripts/cts-aeonic-temporal-civil-datetime-adapter.mjs +28 -0
  91. package/scripts/cts-aeonic-temporal.mjs +24 -0
  92. package/scripts/cts-instruction.mjs +4 -2
  93. package/scripts/cts-mutate.mjs +3 -2
  94. package/scripts/cts-resolve.mjs +17 -2
  95. package/scripts/playground.mjs +110 -0
  96. package/src/aeonic-arithmetic-binding.js +61 -0
  97. package/src/aeonic-arithmetic.d.ts +84 -0
  98. package/src/aeonic-arithmetic.js +276 -0
  99. package/src/aeonic-comparison.d.ts +86 -0
  100. package/src/aeonic-comparison.js +274 -0
  101. package/src/aeonic-convenience.d.ts +30 -0
  102. package/src/aeonic-convenience.js +45 -0
  103. package/src/aeonic-exact-number.js +34 -0
  104. package/src/aeonic-json.js +45 -0
  105. package/src/aeonic-rational-arithmetic.d.ts +86 -0
  106. package/src/aeonic-rational-arithmetic.js +417 -0
  107. package/src/aeonic-rational-json.js +51 -0
  108. package/src/aeonic-temporal-civil-anchor.d.ts +54 -0
  109. package/src/aeonic-temporal-civil-anchor.js +316 -0
  110. package/src/aeonic-temporal-civil-clock.d.ts +124 -0
  111. package/src/aeonic-temporal-civil-clock.js +388 -0
  112. package/src/aeonic-temporal-civil-date.d.ts +123 -0
  113. package/src/aeonic-temporal-civil-date.js +310 -0
  114. package/src/aeonic-temporal-civil-datetime.d.ts +138 -0
  115. package/src/aeonic-temporal-civil-datetime.js +501 -0
  116. package/src/index.d.ts +84 -1
  117. package/src/index.js +828 -183
  118. package/src/property-address.js +196 -0
  119. package/src/property-resolve.js +132 -0
  120. package/src/query-metadata.d.ts +16 -0
  121. package/src/query-metadata.js +25 -0
  122. package/src/selector-cursor.d.ts +19 -0
  123. package/src/selector-cursor.js +79 -0
  124. package/stress-tests/address/invalid.sansa-cases +0 -2
  125. package/stress-tests/address/valid.sansa-cases +3 -0
  126. package/tools/mutate-web/examples.mjs +1 -1
  127. package/tools/mutate-web/runtime.mjs +0 -2
  128. package/tools/playground/README.md +165 -0
  129. package/tools/playground/accessibility.js +91 -0
  130. package/tools/playground/aeon-highlight.js +77 -0
  131. package/tools/playground/aeon-source-composer.js +1077 -0
  132. package/tools/playground/anchor-examples.mjs +16 -0
  133. package/tools/playground/arithmetic-evaluator.mjs +28 -0
  134. package/tools/playground/arithmetic-model.mjs +187 -0
  135. package/tools/playground/arithmetic-worker.mjs +14 -0
  136. package/tools/playground/arithmetic.css +1 -0
  137. package/tools/playground/arithmetic.html +29 -0
  138. package/tools/playground/arithmetic.mjs +110 -0
  139. package/tools/playground/clock-examples.mjs +16 -0
  140. package/tools/playground/datetime-examples.mjs +22 -0
  141. package/tools/playground/examples.mjs +46 -0
  142. package/tools/playground/index.html +174 -0
  143. package/tools/playground/local.css +25 -0
  144. package/tools/playground/namespace.mjs +39 -0
  145. package/tools/playground/sansa-playground.js +1565 -0
  146. package/tools/playground/site.css +3914 -0
  147. package/tools/playground/temporal-examples.mjs +20 -0
  148. package/tools/playground/walkthrough.js +90 -0
  149. package/tools/playground/website-origin.json +16 -0
  150. package/tools/query-web/IDENTITY_SELECTORS.md +44 -0
  151. package/tools/query-web/app.js +4 -0
  152. package/tools/query-web/index.html +4 -0
  153. package/tools/query-web/runtime.mjs +70 -19
  154. package/tools/workflows/property-playground-assertions.mjs +33 -0
  155. package/tools/workflows/verify-child-identities.mjs +137 -0
  156. package/tools/workflows/verify-property-playground.mjs +48 -0
package/src/index.d.ts CHANGED
@@ -1,4 +1,18 @@
1
+ export * from './aeonic-temporal-civil-anchor.js';
2
+ export * from './aeonic-temporal-civil-clock.js';
3
+ export * from './aeonic-temporal-civil-datetime.js';
4
+ export * from './aeonic-temporal-civil-date.js';
5
+ export * from './aeonic-rational-arithmetic.js';
6
+ export * from './aeonic-convenience.js';
7
+ export * from './aeonic-arithmetic.js';
8
+ export * from './aeonic-comparison.js';
9
+
1
10
  export type SansaParseErrorCode =
11
+ | 'SANSA_UNKNOWN_PROPERTY_SELECTOR'
12
+ | 'SANSA_EXPECTED_PROPERTY_ARGUMENT'
13
+ | 'SANSA_PROPERTY_LIMIT_EXCEEDED'
14
+ | 'SANSA_EXPECTED_IDENTITY'
15
+ | 'SANSA_UNTERMINATED_IDENTITY'
2
16
  | 'SANSA_EMPTY_ADDRESS'
3
17
  | 'SANSA_EXPECTED_ROOT'
4
18
  | 'SANSA_EXPECTED_TOKEN'
@@ -81,6 +95,9 @@ export type SansaWarningCode =
81
95
  | 'SANSA_NON_PORTABLE_POSITION_INDEX';
82
96
 
83
97
  export interface SansaDiagnostic {
98
+ readonly limitKind?: 'payloadScalars' | 'selectors' | 'canonicalScalars';
99
+ readonly limit?: number;
100
+ readonly observed?: number;
84
101
  readonly code: SansaParseErrorCode;
85
102
  readonly message: string;
86
103
  readonly index: number;
@@ -129,6 +146,12 @@ export type SansaInstructionParseResult =
129
146
  | { readonly ok: false; readonly errors: readonly SansaDiagnostic[] };
130
147
 
131
148
  export type SansaResolveErrorCode =
149
+ | 'SANSA_RESOLVE_INVALID_ADDRESS'
150
+ | 'SANSA_RESOLVE_UNSUPPORTED_IDENTITY'
151
+ | 'SANSA_RESOLVE_INVALID_IDENTITY'
152
+ | 'SANSA_RESOLVE_AMBIGUOUS_IDENTITY'
153
+ | 'SANSA_RESOLVE_INVALID_IDENTITY_LIMIT'
154
+ | 'SANSA_RESOLVE_IDENTITY_LIMIT_EXCEEDED'
132
155
  | 'SANSA_RESOLVE_EXPECTED_NAMESPACE'
133
156
  | 'SANSA_RESOLVE_MISSING_ROOT'
134
157
  | 'SANSA_RESOLVE_UNSUPPORTED_CONTEXTUAL_ROOT'
@@ -140,7 +163,15 @@ export type SansaResolveErrorCode =
140
163
  | 'SANSA_RESOLVE_INVALID_BINDING_LIMIT'
141
164
  | 'SANSA_RESOLVE_BINDING_LIMIT_EXCEEDED'
142
165
  | 'SANSA_RESOLVE_EXACT_MULTIPLICITY_VIOLATION'
143
- | 'SANSA_RESOLVE_UNSUPPORTED_SELECTOR';
166
+ | 'SANSA_RESOLVE_UNSUPPORTED_SELECTOR'
167
+ | 'SANSA_RESOLVE_INVALID_PROPERTY_LIMIT'
168
+ | 'SANSA_RESOLVE_UNSUPPORTED_PROPERTY_SCOPE'
169
+ | 'SANSA_RESOLVE_UNSUPPORTED_KEY'
170
+ | 'SANSA_RESOLVE_UNSUPPORTED_TAG'
171
+ | 'SANSA_RESOLVE_PROPERTY_SCOPE_VIOLATION'
172
+ | 'SANSA_RESOLVE_INVALID_PROPERTY_METADATA'
173
+ | 'SANSA_RESOLVE_PROPERTY_ADAPTER_ERROR'
174
+ | 'SANSA_RESOLVE_PROPERTY_LIMIT_EXCEEDED';
144
175
 
145
176
  export type SansaGraphErrorCode =
146
177
  | 'SANSA_GRAPH_INVALID_INPUT'
@@ -224,6 +255,11 @@ export interface SansaResolveDiagnostic {
224
255
  readonly message: string;
225
256
  readonly index?: number;
226
257
  readonly selectorIndex?: number;
258
+ /** Authored identity selected by an identity-related resolution failure. */
259
+ readonly identity?: string;
260
+ readonly property?: 'key' | 'tag' | 'headTag';
261
+ readonly budget?: 'maxPropertyInspections';
262
+ readonly causeCode?: string;
227
263
  readonly limit?: number;
228
264
  readonly observed?: number;
229
265
  }
@@ -314,7 +350,30 @@ export interface SansaDatatypeNumberComponent {
314
350
  export type SansaDatatypeGenericComponent = SansaDatatypeDescriptor | SansaDatatypeNumberComponent;
315
351
  export type SansaDatatypeClarifierComponent = SansaDatatypeStringComponent | SansaDatatypeNumberComponent;
316
352
 
353
+ export type PropertyName = 'key' | 'tag' | 'headTag';
354
+ export type PropertyScopeRole = 'root' | 'inside' | 'outside';
355
+ export type PropertyNodeKind = 'NodeLiteral' | 'NodeHead' | 'Other';
356
+ export interface PropertyAccessContext<B extends object> {
357
+ readonly scopeRoot: B;
358
+ readonly evaluationRoot: B;
359
+ /** Present only while validating a yielded direct head of this owner. */
360
+ readonly directHeadOf?: B;
361
+ }
362
+ export interface PropertyAccessFault {
363
+ readonly type: 'SansaPropertyAccessFault';
364
+ readonly kind: 'invalidMetadata' | 'scopeViolation' | 'adapterFailure';
365
+ }
366
+ /** Callback faults are thrown, not returned as successful metadata. */
367
+ export interface PropertyAccess<B extends object> {
368
+ readonly scope: (binding: B, context: PropertyAccessContext<B>) => PropertyScopeRole;
369
+ readonly key?: (binding: B, context: PropertyAccessContext<B>) => string | undefined;
370
+ readonly nodeKind?: (binding: B, context: PropertyAccessContext<B>) => PropertyNodeKind;
371
+ readonly nodeTag?: (binding: B, context: PropertyAccessContext<B>) => string | undefined;
372
+ readonly nodeHeads?: (binding: B, context: PropertyAccessContext<B>) => Iterable<B>;
373
+ }
317
374
  export interface SansaResolveNamespace<TBinding extends object = SansaResolveBinding> {
375
+ /** Explicit authoritative property capability; no name/tag field fallback. */
376
+ readonly properties?: PropertyAccess<TBinding>;
318
377
  readonly root: TBinding | (() => TBinding | undefined);
319
378
  readonly contextualRoot?: TBinding;
320
379
  readonly children?: (binding: TBinding) => Iterable<TBinding> | readonly TBinding[] | undefined;
@@ -323,6 +382,8 @@ export interface SansaResolveNamespace<TBinding extends object = SansaResolveBin
323
382
  readonly position?: (binding: TBinding, index: number) => TBinding | undefined;
324
383
  readonly attributeSpace?: (binding: TBinding) => TBinding | undefined;
325
384
  readonly localSpace?: (binding: TBinding, name: string) => TBinding | undefined;
385
+ /** Presence explicitly supports authored structural identity inspection. */
386
+ readonly identity?: (binding: TBinding) => string | undefined;
326
387
  readonly name?: (binding: TBinding) => string | undefined;
327
388
  readonly index?: (binding: TBinding) => number | undefined;
328
389
  readonly semanticType?: (binding: TBinding) => string | undefined;
@@ -464,6 +525,12 @@ export type SansaGraphSequenceResult<TBinding extends object = SansaResolveBindi
464
525
  };
465
526
 
466
527
  export interface SansaResolveOptions<TBinding extends object = SansaResolveBinding> {
528
+ /** Standalone Resolve logical inspections; integer 0..1000000, default10000.
529
+ * No caller authority roots or mutable counter/session are accepted. */
530
+ readonly maxPropertyInspections?: number;
531
+ /** Logical child inspections; default 10000, including misses.
532
+ * For evaluateQuery, shared across all clauses/candidates in one invocation. */
533
+ readonly maxIdentityInspections?: number;
467
534
  readonly parse?: SansaParseOptions;
468
535
  readonly contextualRoot?: TBinding;
469
536
  readonly allowParentFromEffectiveRoot?: boolean;
@@ -497,6 +564,7 @@ export interface SansaQueryEvaluateOptions<TBinding extends object = SansaResolv
497
564
  }
498
565
 
499
566
  export type SansaAddressActivationSelectorCapability =
567
+ | 'childIdentity'
500
568
  | 'member'
501
569
  | 'position'
502
570
  | 'range'
@@ -511,7 +579,9 @@ export type SansaAddressActivationSelectorCapability =
511
579
 
512
580
  export interface SansaAddressActivationPolicy {
513
581
  readonly mode?: 'constrained' | 'trusted';
582
+ /** For childIdentity, canonical structural binding paths; scope is proven before scanning. */
514
583
  readonly allowedRoots?: readonly (string | SansaAddress)[];
584
+ /** childIdentity requires constrained mode; trusted mode does not enable it. */
515
585
  readonly allowedSelectors?: readonly SansaAddressActivationSelectorCapability[];
516
586
  readonly allowContextualRoot?: boolean;
517
587
  readonly maxAddressDepth?: number;
@@ -1459,7 +1529,20 @@ export interface RootSelector {
1459
1529
  readonly kind: 'absolute' | 'contextual';
1460
1530
  }
1461
1531
 
1532
+ export interface ChildIdentitySelector {
1533
+ readonly type: 'childIdentity';
1534
+ readonly identity: string;
1535
+ }
1536
+
1537
+ export interface PropertyFilterSelector {
1538
+ readonly type: 'propertyFilter';
1539
+ readonly property: 'key' | 'tag' | 'headTag';
1540
+ readonly value: string;
1541
+ }
1542
+
1462
1543
  export type SansaSelector =
1544
+ | PropertyFilterSelector
1545
+ | ChildIdentitySelector
1463
1546
  | MemberSelector
1464
1547
  | PositionSelector
1465
1548
  | PositionRangeSelector