@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.
- package/CHANGELOG.md +118 -1
- package/README.md +96 -1
- package/conformance/README.md +8 -0
- package/conformance/aeonic-anchor-claims.json +133 -0
- package/conformance/aeonic-arithmetic-claims.json +60 -0
- package/conformance/aeonic-clock-claims.json +123 -0
- package/conformance/aeonic-comparison-claims.json +37 -0
- package/conformance/aeonic-datetime-claims.json +110 -0
- package/conformance/aeonic-rational-arithmetic-claims.json +72 -0
- package/conformance/aeonic-temporal-claims.json +105 -0
- package/conformance/cts-claims.json +17 -3
- package/conformance/results/aeonic-anchor-capacity.json +452 -0
- package/conformance/results/aeonic-anchor-snapshot-0.1.json +39 -0
- package/conformance/results/aeonic-arithmetic-snapshot-0.1.json +28 -0
- package/conformance/results/aeonic-clock-all-snapshot-0.1.json +49 -0
- package/conformance/results/aeonic-clock-arithmetic-snapshot-0.1.json +48 -0
- package/conformance/results/aeonic-clock-capacity.json +326 -0
- package/conformance/results/aeonic-clock-relations-snapshot-0.1.json +48 -0
- package/conformance/results/aeonic-comparison-snapshot-0.1.json +19 -0
- package/conformance/results/aeonic-datetime-all-snapshot-0.1.json +47 -0
- package/conformance/results/aeonic-datetime-arithmetic-snapshot-0.1.json +46 -0
- package/conformance/results/aeonic-datetime-capacity.json +302 -0
- package/conformance/results/aeonic-datetime-relations-snapshot-0.1.json +46 -0
- package/conformance/results/aeonic-rational-arithmetic-capacity.json +100 -0
- package/conformance/results/aeonic-rational-arithmetic-snapshot-0.2.json +30 -0
- package/conformance/results/aeonic-temporal-all-property-addressing-2026-11-16.json +39 -0
- package/conformance/results/aeonic-temporal-all-snapshot-0.1.json +39 -0
- package/conformance/results/aeonic-temporal-calendar-property-addressing-2026-11-16.json +38 -0
- package/conformance/results/aeonic-temporal-calendar-snapshot-0.1.json +38 -0
- package/conformance/results/aeonic-temporal-capacity-property-addressing-2026-11-16.json +136 -0
- package/conformance/results/aeonic-temporal-capacity.json +136 -0
- package/conformance/results/aeonic-temporal-relations-property-addressing-2026-11-16.json +38 -0
- package/conformance/results/aeonic-temporal-relations-snapshot-0.1.json +38 -0
- package/docs/aeonic-arithmetic.md +126 -0
- package/docs/aeonic-comparison.md +123 -0
- package/docs/aeonic-rational-arithmetic.md +167 -0
- package/docs/aeonic-temporal-civil-anchor.md +89 -0
- package/docs/aeonic-temporal-civil-clock.md +100 -0
- package/docs/aeonic-temporal-civil-date.md +124 -0
- package/docs/aeonic-temporal-civil-datetime.md +122 -0
- package/docs/api-contract.md +130 -3
- package/docs/capabilities.json +106 -2
- package/docs/child-identity-activation.md +93 -0
- package/docs/child-identity-candidate.md +60 -0
- package/docs/child-identity-tooling.md +31 -0
- package/docs/child-identity-workflows.md +102 -0
- package/docs/empty-keys-candidate.md +29 -0
- package/docs/migration-0.15.0.md +75 -0
- package/docs/property-addressing-implementation.md +118 -0
- package/docs/property-resolve-implementation.md +105 -0
- package/docs/property-selector-support.md +65 -0
- package/docs/property-selectors-api.d.ts +43 -0
- package/docs/property-selectors-api.pyi +27 -0
- package/docs/property-selectors-api.rs +48 -0
- package/docs/property-selectors-contract.md +168 -0
- package/docs/query-tool.md +32 -1
- package/docs/selector-cursor.md +45 -0
- package/docs/unicode-hardening.md +41 -0
- package/fixtures/address-v1.json +4 -3
- package/fixtures/child-identity-workflows/README.md +9 -0
- package/fixtures/child-identity-workflows/moved.aeon +10 -0
- package/fixtures/child-identity-workflows/original.aeon +10 -0
- package/fixtures/child-identity-workflows/reordered.aeon +10 -0
- package/fixtures/child-identity-workflows/replacement.aeon +10 -0
- package/fixtures/child-identity-workflows/workflows.json +89 -0
- package/fixtures/property-namespace-candidate-v1.json +336 -0
- package/fixtures/property-parser-candidate-v1.json +705 -0
- package/fixtures/property-query-candidate-v1.json +398 -0
- package/fixtures/property-resolve-candidate-v1.json +2702 -0
- package/fixtures/unicode-hardening-v1.json +401 -0
- package/package.json +30 -3
- package/scripts/calibrate-aeonic-anchor-capacity.py +294 -0
- package/scripts/calibrate-aeonic-clock-capacity.py +62 -0
- package/scripts/calibrate-aeonic-datetime-capacity.py +76 -0
- package/scripts/calibrate-aeonic-rational-capacity.py +85 -0
- package/scripts/calibrate-aeonic-temporal-capacity.py +95 -0
- package/scripts/cts-address.mjs +6 -2
- package/scripts/cts-aeonic-anchor.mjs +21 -0
- package/scripts/cts-aeonic-arithmetic-adapter.mjs +25 -0
- package/scripts/cts-aeonic-arithmetic.mjs +24 -0
- package/scripts/cts-aeonic-clock.mjs +24 -0
- package/scripts/cts-aeonic-comparison-adapter.mjs +30 -0
- package/scripts/cts-aeonic-comparison.mjs +25 -0
- package/scripts/cts-aeonic-datetime.mjs +24 -0
- package/scripts/cts-aeonic-rational-arithmetic-adapter.mjs +25 -0
- package/scripts/cts-aeonic-rational-arithmetic.mjs +24 -0
- package/scripts/cts-aeonic-temporal-civil-anchor-adapter.mjs +26 -0
- package/scripts/cts-aeonic-temporal-civil-clock-adapter.mjs +28 -0
- package/scripts/cts-aeonic-temporal-civil-date-adapter.mjs +28 -0
- package/scripts/cts-aeonic-temporal-civil-datetime-adapter.mjs +28 -0
- package/scripts/cts-aeonic-temporal.mjs +24 -0
- package/scripts/cts-instruction.mjs +4 -2
- package/scripts/cts-mutate.mjs +3 -2
- package/scripts/cts-resolve.mjs +17 -2
- package/scripts/playground.mjs +110 -0
- package/src/aeonic-arithmetic-binding.js +61 -0
- package/src/aeonic-arithmetic.d.ts +84 -0
- package/src/aeonic-arithmetic.js +276 -0
- package/src/aeonic-comparison.d.ts +86 -0
- package/src/aeonic-comparison.js +274 -0
- package/src/aeonic-convenience.d.ts +30 -0
- package/src/aeonic-convenience.js +45 -0
- package/src/aeonic-exact-number.js +34 -0
- package/src/aeonic-json.js +45 -0
- package/src/aeonic-rational-arithmetic.d.ts +86 -0
- package/src/aeonic-rational-arithmetic.js +417 -0
- package/src/aeonic-rational-json.js +51 -0
- package/src/aeonic-temporal-civil-anchor.d.ts +54 -0
- package/src/aeonic-temporal-civil-anchor.js +316 -0
- package/src/aeonic-temporal-civil-clock.d.ts +124 -0
- package/src/aeonic-temporal-civil-clock.js +388 -0
- package/src/aeonic-temporal-civil-date.d.ts +123 -0
- package/src/aeonic-temporal-civil-date.js +310 -0
- package/src/aeonic-temporal-civil-datetime.d.ts +138 -0
- package/src/aeonic-temporal-civil-datetime.js +501 -0
- package/src/index.d.ts +84 -1
- package/src/index.js +828 -183
- package/src/property-address.js +196 -0
- package/src/property-resolve.js +132 -0
- package/src/query-metadata.d.ts +16 -0
- package/src/query-metadata.js +25 -0
- package/src/selector-cursor.d.ts +19 -0
- package/src/selector-cursor.js +79 -0
- package/stress-tests/address/invalid.sansa-cases +0 -2
- package/stress-tests/address/valid.sansa-cases +3 -0
- package/tools/mutate-web/examples.mjs +1 -1
- package/tools/mutate-web/runtime.mjs +0 -2
- package/tools/playground/README.md +165 -0
- package/tools/playground/accessibility.js +91 -0
- package/tools/playground/aeon-highlight.js +77 -0
- package/tools/playground/aeon-source-composer.js +1077 -0
- package/tools/playground/anchor-examples.mjs +16 -0
- package/tools/playground/arithmetic-evaluator.mjs +28 -0
- package/tools/playground/arithmetic-model.mjs +187 -0
- package/tools/playground/arithmetic-worker.mjs +14 -0
- package/tools/playground/arithmetic.css +1 -0
- package/tools/playground/arithmetic.html +29 -0
- package/tools/playground/arithmetic.mjs +110 -0
- package/tools/playground/clock-examples.mjs +16 -0
- package/tools/playground/datetime-examples.mjs +22 -0
- package/tools/playground/examples.mjs +46 -0
- package/tools/playground/index.html +174 -0
- package/tools/playground/local.css +25 -0
- package/tools/playground/namespace.mjs +39 -0
- package/tools/playground/sansa-playground.js +1565 -0
- package/tools/playground/site.css +3914 -0
- package/tools/playground/temporal-examples.mjs +20 -0
- package/tools/playground/walkthrough.js +90 -0
- package/tools/playground/website-origin.json +16 -0
- package/tools/query-web/IDENTITY_SELECTORS.md +44 -0
- package/tools/query-web/app.js +4 -0
- package/tools/query-web/index.html +4 -0
- package/tools/query-web/runtime.mjs +70 -19
- package/tools/workflows/property-playground-assertions.mjs +33 -0
- package/tools/workflows/verify-child-identities.mjs +137 -0
- package/tools/workflows/verify-property-playground.mjs +48 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
// Adapted from AltoPelago/aeonic at 4efb42be227c1b1cd458a53155cebd51ffcc0154.
|
|
2
|
+
// Copyright (c) 2026 Patrik. MIT; see LICENSE and docs/aeonic-temporal-civil-anchor.md.
|
|
3
|
+
// Bounded UTF-8 counting keeps native/text APIs usable in browser workers.
|
|
4
|
+
function utf8Bytes(text, allowance) {
|
|
5
|
+
let bytes = 0;
|
|
6
|
+
for (const character of text) {
|
|
7
|
+
const point = character.codePointAt(0);
|
|
8
|
+
bytes += point <= 0x7f ? 1 : point <= 0x7ff ? 2 : point <= 0xffff ? 3 : 4;
|
|
9
|
+
if (bytes > allowance) break;
|
|
10
|
+
}
|
|
11
|
+
return bytes;
|
|
12
|
+
}
|
|
13
|
+
import { exceedsJsonDepth, parseStrictJson } from './aeonic-json.js';
|
|
14
|
+
import { RationalJsonNumber } from './aeonic-rational-json.js';
|
|
15
|
+
|
|
16
|
+
export const AEONIC_TEMPORAL_CIVIL_ANCHOR_PROFILE = 'aeonic.operations.temporal.civil-anchor.v1';
|
|
17
|
+
export const AEONIC_TEMPORAL_CIVIL_ANCHOR_DEFAULT_RESOURCE_LIMITS = Object.freeze({ maxRequestBytes: 65536, maxRequestDepth: 32,
|
|
18
|
+
maxTemporalCharacters: 1024, maxInputRanges: 128, maxInputPieces: 512, maxRelativeDayDigits: 256,
|
|
19
|
+
maxFractionDigits: 256, maxWork: 16384, maxIntermediatePieces: 4096, maxOutputPieces: 512, maxResultBytes: 131072 });
|
|
20
|
+
const TAGS = new Set(['civilClock', 'civilClockSet', 'civilDateTime', 'civilDateTimeSet', 'civilDate', 'civilDateSet', 'finiteNumber', 'exactNumber', 'exactRational',
|
|
21
|
+
'string', 'boolean', 'symbol', 'positiveInfinity', 'negativeInfinity', 'nan', 'explicitNull', 'explicitAbsence', 'toggle',
|
|
22
|
+
'hex', 'radix', 'encoding', 'separator', 'sansaAddress', 'referenceForm', 'temporal', 'container']);
|
|
23
|
+
const CLOCKS = ['hour', 'minute', 'second'], GRAINS = ['day', 'month', 'year'];
|
|
24
|
+
const NONE = 'none-declared', APPROX = 'approximation-declared';
|
|
25
|
+
const record = v => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
26
|
+
const scalar = v => typeof v === 'string' && !/[\uD800-\uDFFF]/u.test(v);
|
|
27
|
+
const identifier = v => scalar(v) && v.length > 0;
|
|
28
|
+
const pointer = (p, k) => scalar(k) ? p + '/' + k.replaceAll('~', '~0').replaceAll('/', '~1') : null;
|
|
29
|
+
function scalarOrder(a, b) {
|
|
30
|
+
const x = a[Symbol.iterator](), y = b[Symbol.iterator]();
|
|
31
|
+
for (;;) { const p = x.next(), q = y.next();
|
|
32
|
+
if (p.done || q.done) return p.done === q.done ? 0 : p.done ? -1 : 1;
|
|
33
|
+
if (p.value !== q.value) return p.value.codePointAt(0) - q.value.codePointAt(0);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
class Failure extends Error {
|
|
37
|
+
constructor(reason, stage, path) { super(reason); this.result = { outcome: 'diagnostic', reason, context: { stage, path } }; }
|
|
38
|
+
}
|
|
39
|
+
function stop(reason, stage, path) { throw new Failure(reason, stage, path); }
|
|
40
|
+
function guarded(action) { try { return action(); } catch (e) { if (e instanceof Failure) return e.result; throw e; } }
|
|
41
|
+
function required(v, fields, path, reason, stage) {
|
|
42
|
+
for (const k of fields) if (!Object.hasOwn(v, k)) stop(reason, stage, pointer(path, k));
|
|
43
|
+
}
|
|
44
|
+
function closed(v, fields, path, reason, stage) {
|
|
45
|
+
for (const k of Object.keys(v).sort(scalarOrder)) if (!fields.includes(k)) stop(reason, stage, pointer(path, k));
|
|
46
|
+
}
|
|
47
|
+
function configured(options) {
|
|
48
|
+
if (!record(options) || Object.keys(options).some(k => !['resourceLimits', 'capabilities'].includes(k))) throw new TypeError('Invalid trusted options');
|
|
49
|
+
const supplied = Object.hasOwn(options, 'resourceLimits') ? options.resourceLimits : {};
|
|
50
|
+
if (!record(supplied)) throw new TypeError('resourceLimits must be an object');
|
|
51
|
+
for (const [k, v] of Object.entries(supplied)) {
|
|
52
|
+
if (!Object.hasOwn(AEONIC_TEMPORAL_CIVIL_ANCHOR_DEFAULT_RESOURCE_LIMITS, k) || !Number.isSafeInteger(v) || v < 0) throw new TypeError('Invalid resource limit: ' + k);
|
|
53
|
+
}
|
|
54
|
+
const capabilities = Object.hasOwn(options, 'capabilities') ? options.capabilities : ['anchoring'];
|
|
55
|
+
if (!Array.isArray(capabilities) || capabilities.length !== 1 || !Object.hasOwn(capabilities, 0) || capabilities[0] !== 'anchoring') throw new TypeError('Invalid trusted capabilities');
|
|
56
|
+
return { limits: { ...AEONIC_TEMPORAL_CIVIL_ANCHOR_DEFAULT_RESOURCE_LIMITS, ...supplied }, available: new Set(['anchor']) };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Pure civil calendar: no host Date, timezone or floating-point epoch conversion.
|
|
60
|
+
const leap = y => y % 4 === 0 && (y % 100 !== 0 || y % 400 === 0);
|
|
61
|
+
const monthLength = (y, m) => m === 2 ? leap(y) ? 29 : 28 : [4, 6, 9, 11].includes(m) ? 30 : 31;
|
|
62
|
+
const yearStart = y => 365 * (y - 1) + Math.floor((y - 1) / 4) - Math.floor((y - 1) / 100) + Math.floor((y - 1) / 400) + 1;
|
|
63
|
+
function ordinal(y, m, d) { let n = yearStart(y) + d - 1; for (let k = 1; k < m; k++) n += monthLength(y, k); return n; }
|
|
64
|
+
const LAST = yearStart(10000) - 1;
|
|
65
|
+
function date(n) {
|
|
66
|
+
let lo = 1, hi = 9999;
|
|
67
|
+
while (lo < hi) { const mid = Math.ceil((lo + hi) / 2); if (yearStart(mid) <= n) lo = mid; else hi = mid - 1; }
|
|
68
|
+
let m = 1, d = n - yearStart(lo) + 1;
|
|
69
|
+
while (d > monthLength(lo, m)) { d -= monthLength(lo, m); m++; }
|
|
70
|
+
return { y: lo, m, d };
|
|
71
|
+
}
|
|
72
|
+
const fullText = n => { const d = date(n); return `${String(d.y).padStart(4, '0')}-${String(d.m).padStart(2, '0')}-${String(d.d).padStart(2, '0')}`; };
|
|
73
|
+
function literal(text, path, limits, full = false) {
|
|
74
|
+
if (typeof text !== 'string') stop('invalid_operand', 4, path);
|
|
75
|
+
characters([text], limits.maxTemporalCharacters, path);
|
|
76
|
+
const pattern = full ? /^[0-9]{4}-[0-9]{2}-[0-9]{2}$(?![\s\S])/u : /^(?:[0-9]{4}-|[0-9]{4}-[0-9]{2}|[0-9]{4}-[0-9]{2}-[0-9]{2})$(?![\s\S])/u;
|
|
77
|
+
if (typeof text !== 'string' || !pattern.test(text)) stop('invalid_operand', 4, path);
|
|
78
|
+
const y = Number(text.slice(0, 4)), m = text.length > 5 ? Number(text.slice(5, 7)) : 1, d = text.length > 7 ? Number(text.slice(8)) : 1;
|
|
79
|
+
if (y < 1 || m < 1 || m > 12 || d < 1 || d > monthLength(y, m)) stop('invalid_operand', 4, path);
|
|
80
|
+
const granularity = text.length === 5 ? 'year' : text.length === 7 ? 'month' : 'day';
|
|
81
|
+
const start = ordinal(y, m, d), end = granularity === 'year' ? yearStart(y + 1) - 1 : granularity === 'month' ? ordinal(y, m, monthLength(y, m)) : start;
|
|
82
|
+
return { ranges: [[start, end]], granularity };
|
|
83
|
+
}
|
|
84
|
+
function characters(values, limit, path) {
|
|
85
|
+
let n = 0; for (const value of values) for (const ch of value) if (++n > limit) stop('resource_limit', 4, path);
|
|
86
|
+
}
|
|
87
|
+
// Relative days and fractions stay textual. Only an admitted seven-digit
|
|
88
|
+
// calendar offset is converted; no BigInt, epoch seconds or fraction grid.
|
|
89
|
+
const C = (day, s, f = '') => ({ day, s, f });
|
|
90
|
+
function signedCompare(a, b) {
|
|
91
|
+
const an = a.startsWith('-'), bn = b.startsWith('-');
|
|
92
|
+
if (an !== bn) return an ? -1 : 1;
|
|
93
|
+
const x = an ? a.slice(1) : a, y = bn ? b.slice(1) : b;
|
|
94
|
+
const order = x.length !== y.length ? x.length < y.length ? -1 : 1 : x === y ? 0 : x < y ? -1 : 1;
|
|
95
|
+
return an ? -order : order;
|
|
96
|
+
}
|
|
97
|
+
const cmp = (a, b) => signedCompare(a.day, b.day) || (a.s !== b.s ? a.s < b.s ? -1 : 1 : a.f === b.f ? 0 : a.f < b.f ? -1 : 1);
|
|
98
|
+
const same = (a, b) => cmp(a, b) === 0;
|
|
99
|
+
const piece = (lo, hi = lo, il = true, ih = true) => ({ lo, hi, il, ih });
|
|
100
|
+
function dateOperand(v, limits, path) {
|
|
101
|
+
if (!record(v)) stop('invalid_operand', 4, path);
|
|
102
|
+
required(v, ['temporal'], path, 'invalid_operand', 4);
|
|
103
|
+
const t = v.temporal, at = path + '/temporal';
|
|
104
|
+
if (!record(t)) stop('invalid_operand', 4, at);
|
|
105
|
+
if (typeof t.category !== 'string' || !TAGS.has(t.category)) stop('invalid_operand', 4, at + '/category');
|
|
106
|
+
if (t.category === 'civilDateSet') required(v, ['originGranularity', 'history'], path, 'invalid_operand', 4);
|
|
107
|
+
closed(v, ['temporal', 'originGranularity', 'history'], path, 'invalid_operand', 4);
|
|
108
|
+
const history = Object.hasOwn(v, 'history') ? v.history : NONE;
|
|
109
|
+
if (![NONE, 'clamping-declared'].includes(history)) stop('invalid_operand', 4, path + '/history');
|
|
110
|
+
if (Object.hasOwn(v, 'originGranularity') && ![...GRAINS, 'undeclared'].includes(v.originGranularity)) stop('invalid_operand', 4, path + '/originGranularity');
|
|
111
|
+
if (!['civilDate', 'civilDateSet'].includes(t.category)) return { deferred: true };
|
|
112
|
+
if (t.category === 'civilDate') {
|
|
113
|
+
required(t, ['value'], at, 'invalid_operand', 4); closed(t, ['category', 'value'], at, 'invalid_operand', 4);
|
|
114
|
+
if (limits.maxInputRanges < 1) stop('resource_limit', 4, at);
|
|
115
|
+
const parsed = literal(t.value, at + '/value', limits);
|
|
116
|
+
return { ranges: parsed.ranges, origin: v.originGranularity ?? parsed.granularity, history };
|
|
117
|
+
}
|
|
118
|
+
required(t, ['ranges'], at, 'invalid_operand', 4); closed(t, ['category', 'ranges'], at, 'invalid_operand', 4);
|
|
119
|
+
if (!Array.isArray(t.ranges) || !t.ranges.length) stop('invalid_operand', 4, at + '/ranges');
|
|
120
|
+
if (t.ranges.length > limits.maxInputRanges) stop('resource_limit', 4, at + '/ranges');
|
|
121
|
+
const ranges = [];
|
|
122
|
+
for (let i = 0; i < t.ranges.length; i++) {
|
|
123
|
+
const r = t.ranges[i], p = at + '/ranges/' + i;
|
|
124
|
+
if (!record(r)) stop('invalid_operand', 4, p);
|
|
125
|
+
required(r, ['start', 'end'], p, 'invalid_operand', 4); closed(r, ['start', 'end'], p, 'invalid_operand', 4);
|
|
126
|
+
const start = literal(r.start, p + '/start', limits, true).ranges[0][0], end = literal(r.end, p + '/end', limits, true).ranges[0][0];
|
|
127
|
+
if (start > end) stop('invalid_operand', 4, p + '/end');
|
|
128
|
+
if (ranges.length && start <= ranges.at(-1)[1] + 1) stop('invalid_operand', 4, p + '/start');
|
|
129
|
+
ranges.push([start, end]);
|
|
130
|
+
}
|
|
131
|
+
return { ranges, origin: v.originGranularity, history };
|
|
132
|
+
}
|
|
133
|
+
function fields(text, path, limits, authored = false) {
|
|
134
|
+
if (typeof text !== 'string') stop('invalid_operand', 4, path);
|
|
135
|
+
characters([text], limits.maxTemporalCharacters, path);
|
|
136
|
+
const pattern = authored ? /^([0-9]{2}):(?:([0-9]{2})(?::([0-9]{2})(?:\.([0-9]+))?)?)?$(?![\s\S])/u
|
|
137
|
+
: /^([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]+))?$(?![\s\S])/u;
|
|
138
|
+
const m = pattern.exec(text); if (!m) stop('invalid_operand', 4, path);
|
|
139
|
+
const [_, hh, mm, ss, raw = ''] = m;
|
|
140
|
+
if (raw.length > limits.maxFractionDigits) stop('resource_limit', 4, path);
|
|
141
|
+
// Derived fractions must already be canonical. Authored trailing zeroes
|
|
142
|
+
// normalize in one backward pass, without repeated suffix regex searches.
|
|
143
|
+
if (!authored && raw.endsWith('0')) stop('invalid_operand', 4, path);
|
|
144
|
+
let end = raw.length;
|
|
145
|
+
if (authored) while (end > 0 && raw.charCodeAt(end - 1) === 48) end--;
|
|
146
|
+
const f = end === raw.length ? raw : raw.slice(0, end);
|
|
147
|
+
if (Number(hh) > 23 || Number(mm ?? 0) > 59 || Number(ss ?? 0) > 59) stop('invalid_operand', 4, path);
|
|
148
|
+
return { seconds: Number(hh) * 3600 + Number(mm ?? 0) * 60 + Number(ss ?? 0), f,
|
|
149
|
+
clock: ss !== undefined ? 'second' : mm !== undefined ? 'minute' : 'hour' };
|
|
150
|
+
}
|
|
151
|
+
function coordinate(v, path, limits) {
|
|
152
|
+
if (!record(v)) stop('invalid_operand', 4, path);
|
|
153
|
+
required(v, ['day', 'time'], path, 'invalid_operand', 4); closed(v, ['day', 'time'], path, 'invalid_operand', 4);
|
|
154
|
+
if (typeof v.day !== 'string') stop('invalid_operand', 4, path + '/day');
|
|
155
|
+
characters([v.day.startsWith('-') ? v.day.slice(1) : v.day], limits.maxRelativeDayDigits, path + '/day');
|
|
156
|
+
if (!/^(?:0|-?[1-9][0-9]*)$(?![\s\S])/u.test(v.day)) stop('invalid_operand', 4, path + '/day');
|
|
157
|
+
const t = fields(v.time, path + '/time', limits);
|
|
158
|
+
return C(v.day, t.seconds, t.f);
|
|
159
|
+
}
|
|
160
|
+
function clockOperand(v, limits, path) {
|
|
161
|
+
if (!record(v)) stop('invalid_operand', 4, path);
|
|
162
|
+
required(v, ['temporal'], path, 'invalid_operand', 4);
|
|
163
|
+
const t = v.temporal, at = path + '/temporal';
|
|
164
|
+
if (!record(t)) stop('invalid_operand', 4, at);
|
|
165
|
+
if (typeof t.category !== 'string' || !TAGS.has(t.category)) stop('invalid_operand', 4, at + '/category');
|
|
166
|
+
if (t.category === 'civilClockSet') required(v, ['originClockForm', 'history'], path, 'invalid_operand', 4);
|
|
167
|
+
closed(v, ['temporal', 'originClockForm', 'history'], path, 'invalid_operand', 4);
|
|
168
|
+
const h = Object.hasOwn(v, 'history') ? v.history : NONE;
|
|
169
|
+
if (![NONE, APPROX].includes(h)) stop('invalid_operand', 4, path + '/history');
|
|
170
|
+
if (Object.hasOwn(v, 'originClockForm') && ![...CLOCKS, 'undeclared'].includes(v.originClockForm)) stop('invalid_operand', 4, path + '/originClockForm');
|
|
171
|
+
if (!['civilClock', 'civilClockSet'].includes(t.category)) return { deferred: true };
|
|
172
|
+
let pieces, form;
|
|
173
|
+
if (t.category === 'civilClock') {
|
|
174
|
+
required(t, ['value'], at, 'invalid_operand', 4); closed(t, ['category', 'value'], at, 'invalid_operand', 4);
|
|
175
|
+
form = fields(t.value, at + '/value', limits, true);
|
|
176
|
+
if (limits.maxRelativeDayDigits < 1 || limits.maxInputPieces < 1) stop('resource_limit', 4, at);
|
|
177
|
+
const lo = C('0', form.seconds, form.f), width = form.clock === 'second' ? 0 : form.clock === 'minute' ? 60 : 3600;
|
|
178
|
+
pieces = [piece(lo, width ? C(String(Math.floor((lo.s + width) / 86400)), (lo.s + width) % 86400) : lo, true, !width)];
|
|
179
|
+
} else {
|
|
180
|
+
required(t, ['pieces'], at, 'invalid_operand', 4); closed(t, ['category', 'pieces'], at, 'invalid_operand', 4);
|
|
181
|
+
if (!Array.isArray(t.pieces) || !t.pieces.length) stop('invalid_operand', 4, at + '/pieces');
|
|
182
|
+
if (t.pieces.length > limits.maxInputPieces) stop('resource_limit', 4, at + '/pieces');
|
|
183
|
+
pieces = [];
|
|
184
|
+
for (let i = 0; i < t.pieces.length; i++) {
|
|
185
|
+
const p = t.pieces[i], where = at + '/pieces/' + i;
|
|
186
|
+
if (!record(p)) stop('invalid_operand', 4, where);
|
|
187
|
+
required(p, ['kind'], where, 'invalid_operand', 4);
|
|
188
|
+
if (!['point', 'interval'].includes(p.kind)) stop('invalid_operand', 4, where + '/kind');
|
|
189
|
+
const keys = p.kind === 'point' ? ['at'] : ['start', 'end', 'includeStart', 'includeEnd'];
|
|
190
|
+
required(p, keys, where, 'invalid_operand', 4); closed(p, ['kind', ...keys], where, 'invalid_operand', 4);
|
|
191
|
+
const lp = where + (p.kind === 'point' ? '/at' : '/start');
|
|
192
|
+
const lo = coordinate(p.kind === 'point' ? p.at : p.start, lp, limits); let q;
|
|
193
|
+
if (p.kind === 'point') q = piece(lo);
|
|
194
|
+
else {
|
|
195
|
+
const hi = coordinate(p.end, where + '/end', limits);
|
|
196
|
+
for (const key of ['includeStart', 'includeEnd']) if (typeof p[key] !== 'boolean') stop('invalid_operand', 4, where + '/' + key);
|
|
197
|
+
if (cmp(lo, hi) >= 0) stop('invalid_operand', 4, where + '/end');
|
|
198
|
+
q = piece(lo, hi, p.includeStart, p.includeEnd);
|
|
199
|
+
}
|
|
200
|
+
const previous = pieces.at(-1);
|
|
201
|
+
if (previous && (cmp(previous.hi, q.lo) > 0 || same(previous.hi, q.lo) && (previous.ih || q.il))) stop('invalid_operand', 4, lp);
|
|
202
|
+
pieces.push(q);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return { pieces, history: h, origin: v.originClockForm ?? form?.clock ?? 'undeclared' };
|
|
206
|
+
}
|
|
207
|
+
function selection(input) {
|
|
208
|
+
for (const key of ['context', 'policy']) {
|
|
209
|
+
if (!Object.hasOwn(input, key)) continue;
|
|
210
|
+
if (!record(input[key])) stop('invalid_policy', 3, '/input/' + key);
|
|
211
|
+
closed(input[key], ['profile'], '/input/' + key, 'invalid_policy', 3);
|
|
212
|
+
}
|
|
213
|
+
for (const key of ['context', 'policy']) if (Object.hasOwn(input[key] ?? {}, 'profile') && !identifier(input[key].profile)) stop('invalid_policy', 3, '/input/' + key + '/profile');
|
|
214
|
+
const p = input.policy ?? {};
|
|
215
|
+
const owner = Object.hasOwn(p, 'profile') ? 'policy' : Object.hasOwn(input.context ?? {}, 'profile') ? 'context' : null;
|
|
216
|
+
if (!owner) stop('invalid_policy', 3, '/input/policy/profile');
|
|
217
|
+
if (input[owner].profile !== AEONIC_TEMPORAL_CIVIL_ANCHOR_PROFILE) stop('unsupported_profile', 3, '/input/' + owner + '/profile');
|
|
218
|
+
return { profile: AEONIC_TEMPORAL_CIVIL_ANCHOR_PROFILE };
|
|
219
|
+
}
|
|
220
|
+
class PlannedText { constructor(length, render) { this.length = length; this.render = render; } }
|
|
221
|
+
function target(c, anchor, excludedEnd = false) {
|
|
222
|
+
if (signedCompare(c.day, String(1 - anchor)) < 0 || signedCompare(c.day, String(LAST + 1 - anchor)) > 0) stop('unrepresentable_result', 7, null);
|
|
223
|
+
const n = anchor + Number(c.day);
|
|
224
|
+
if (n === LAST + 1 && !(excludedEnd && c.s === 0 && c.f === '')) stop('unrepresentable_result', 7, null);
|
|
225
|
+
return n;
|
|
226
|
+
}
|
|
227
|
+
function coordinatePlan(c, anchor, excludedEnd = false) {
|
|
228
|
+
const n = target(c, anchor, excludedEnd);
|
|
229
|
+
if (n === LAST + 1) return { boundary: 'endOfDomain' };
|
|
230
|
+
return new PlannedText(19 + (c.f ? c.f.length + 1 : 0), () => fullText(n) + 'T' +
|
|
231
|
+
`${String(Math.floor(c.s / 3600)).padStart(2, '0')}:${String(Math.floor(c.s / 60) % 60).padStart(2, '0')}:${String(c.s % 60).padStart(2, '0')}${c.f ? '.' + c.f : ''}`);
|
|
232
|
+
}
|
|
233
|
+
function evaluate(request, limits, available) {
|
|
234
|
+
if (!record(request)) stop('invalid_operand', 2, null);
|
|
235
|
+
required(request, ['operation', 'input'], '', 'invalid_operand', 2);
|
|
236
|
+
closed(request, ['operation', 'input'], '', 'invalid_operand', 2);
|
|
237
|
+
if (!record(request.input)) stop('invalid_operand', 2, '/input');
|
|
238
|
+
const input = request.input;
|
|
239
|
+
closed(input, ['anchor', 'clock', 'context', 'policy'], '/input', 'invalid_operand', 2);
|
|
240
|
+
if (!identifier(request.operation)) stop('invalid_operand', 2, '/operation');
|
|
241
|
+
if (!available.has(request.operation)) stop('unsupported_operation', 2, '/operation');
|
|
242
|
+
required(input, ['anchor', 'clock'], '/input', 'invalid_operand', 2);
|
|
243
|
+
const policy = selection(input), a = dateOperand(input.anchor, limits, '/input/anchor'), c = clockOperand(input.clock, limits, '/input/clock');
|
|
244
|
+
if (a.deferred) stop('unsupported_domain', 5, '/input/anchor/temporal/category');
|
|
245
|
+
if (c.deferred) stop('unsupported_domain', 5, '/input/clock/temporal/category');
|
|
246
|
+
if (a.ranges.length + c.pieces.length > limits.maxWork || c.pieces.length > limits.maxIntermediatePieces) stop('resource_limit', 6, null);
|
|
247
|
+
if (a.ranges.length !== 1 || a.ranges[0][0] !== a.ranges[0][1]) stop('incompatible_operand', 6, '/input/anchor/temporal');
|
|
248
|
+
const anchor = a.ranges[0][0];
|
|
249
|
+
// Check every covered endpoint/domain before output admission and text planning.
|
|
250
|
+
for (const p of c.pieces) { target(p.lo, anchor); target(p.hi, anchor, !same(p.lo, p.hi) && !p.ih); }
|
|
251
|
+
if (c.pieces.length > limits.maxOutputPieces) stop('resource_limit', 7, null);
|
|
252
|
+
const pieces = c.pieces.map(p => same(p.lo, p.hi) ? { kind: 'point', at: coordinatePlan(p.lo, anchor) }
|
|
253
|
+
: { kind: 'interval', start: coordinatePlan(p.lo, anchor), end: coordinatePlan(p.hi, anchor, !p.ih), includeStart: p.il, includeEnd: p.ih });
|
|
254
|
+
return finish({ outcome: 'value', value: { temporal: { category: 'civilDateTimeSet', pieces },
|
|
255
|
+
originDateGranularity: a.origin, originClockForm: c.origin,
|
|
256
|
+
history: { clamping: a.history, approximation: c.history } },
|
|
257
|
+
metadata: { evaluation: 'exact-for-policy', clamping: 'not-applied', effectivePolicy: policy } }, limits);
|
|
258
|
+
}
|
|
259
|
+
function finish(planned, limits) {
|
|
260
|
+
let size = 0; const stack = [planned];
|
|
261
|
+
while (stack.length) {
|
|
262
|
+
const v = stack.pop();
|
|
263
|
+
if (v instanceof PlannedText) size += v.length + 2;
|
|
264
|
+
else if (typeof v === 'string') size += v.length + 2;
|
|
265
|
+
else if (typeof v === 'boolean') size += v ? 4 : 5;
|
|
266
|
+
else if (Array.isArray(v)) { size += 2 + Math.max(0, v.length - 1); for (const x of v) stack.push(x); }
|
|
267
|
+
else { const keys = Object.keys(v); size += 2 + Math.max(0, keys.length - 1); for (const k of keys) { size += k.length + 3; stack.push(v[k]); } }
|
|
268
|
+
if (size > limits.maxResultBytes) stop('resource_limit', 7, null);
|
|
269
|
+
}
|
|
270
|
+
const render = v => v instanceof PlannedText ? v.render() : Array.isArray(v) ? v.map(render) : record(v) ? Object.fromEntries(Object.entries(v).map(([k, x]) => [k, render(x)])) : v;
|
|
271
|
+
return render(planned);
|
|
272
|
+
}
|
|
273
|
+
function structuredText(value, limits) {
|
|
274
|
+
const stack = [{ value, depth: 1 }], active = new Set(), pieces = []; let bytes = 0;
|
|
275
|
+
function append(text) { bytes += utf8Bytes(text, limits.maxRequestBytes - bytes); if (bytes > limits.maxRequestBytes) stop('resource_limit', 1, null); pieces.push(text); }
|
|
276
|
+
while (stack.length) {
|
|
277
|
+
const task = stack.pop();
|
|
278
|
+
if (task.frame) {
|
|
279
|
+
const { item, array, keys, index, depth } = task, length = array ? item.length : keys.length;
|
|
280
|
+
if (index === length) { append(array ? ']' : '}'); active.delete(item); continue; }
|
|
281
|
+
if (index) append(','); const key = array ? index : keys[index];
|
|
282
|
+
if (!array) { if (key.length > limits.maxRequestBytes) stop('resource_limit', 1, null); append(JSON.stringify(key)); append(':'); }
|
|
283
|
+
stack.push({ ...task, index: index + 1 }, { value: item[key], depth: depth + 1 }); continue;
|
|
284
|
+
}
|
|
285
|
+
const item = task.value;
|
|
286
|
+
if (item instanceof RationalJsonNumber) { if (item.text.length > limits.maxRequestBytes) stop('resource_limit', 1, null); append(item.text); }
|
|
287
|
+
else if (item !== null && typeof item === 'object') {
|
|
288
|
+
if (task.depth > limits.maxRequestDepth) stop('resource_limit', 1, null);
|
|
289
|
+
if (active.has(item)) stop('invalid_operand', 2, null);
|
|
290
|
+
const array = Array.isArray(item);
|
|
291
|
+
if (!array && ![Object.prototype, null].includes(Object.getPrototypeOf(item))) throw new TypeError('Structured ingress requires JSON values');
|
|
292
|
+
append(array ? '[' : '{'); active.add(item);
|
|
293
|
+
stack.push({ frame: true, item, array, keys: array ? null : Object.keys(item), index: 0, depth: task.depth });
|
|
294
|
+
} else {
|
|
295
|
+
if (typeof item === 'string' && item.length > limits.maxRequestBytes) stop('resource_limit', 1, null);
|
|
296
|
+
if (typeof item === 'number' && !Number.isFinite(item)) throw new TypeError('Structured ingress requires JSON values');
|
|
297
|
+
const text = JSON.stringify(item); if (text === undefined) throw new TypeError('Structured ingress requires JSON values'); append(text);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return pieces.join('');
|
|
301
|
+
}
|
|
302
|
+
export function evaluateAeonicCivilAnchorText(text, options = {}) {
|
|
303
|
+
const { limits, available } = configured(options);
|
|
304
|
+
if (typeof text !== 'string') throw new TypeError('requestText must be text');
|
|
305
|
+
return guarded(() => {
|
|
306
|
+
if (!scalar(text)) stop('invalid_operand', 1, null);
|
|
307
|
+
if (text.length > limits.maxRequestBytes || utf8Bytes(text, limits.maxRequestBytes) > limits.maxRequestBytes || exceedsJsonDepth(text, limits.maxRequestDepth)) stop('resource_limit', 1, null);
|
|
308
|
+
let request; try { request = parseStrictJson(text); } catch (e) { if (e instanceof SyntaxError) stop('invalid_operand', 2, null); throw e; }
|
|
309
|
+
return evaluate(request, limits, available);
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
export function evaluateAeonicCivilAnchorStructuredJson(request, options = {}) {
|
|
313
|
+
const { limits } = configured(options);
|
|
314
|
+
return guarded(() => evaluateAeonicCivilAnchorText(structuredText(request, limits), options));
|
|
315
|
+
}
|
|
316
|
+
export const evaluateAeonicCivilAnchor = evaluateAeonicCivilAnchorStructuredJson;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { AeonicArithmeticOperand } from './aeonic-arithmetic.js';
|
|
2
|
+
|
|
3
|
+
export const AEONIC_TEMPORAL_CIVIL_CLOCK_PROFILE: 'aeonic.operations.temporal.civil-clock.v1';
|
|
4
|
+
export interface AeonicCivilClockResourceLimits {
|
|
5
|
+
readonly maxRequestBytes: number;
|
|
6
|
+
readonly maxRequestDepth: number;
|
|
7
|
+
readonly maxTemporalCharacters: number;
|
|
8
|
+
readonly maxInputPieces: number;
|
|
9
|
+
readonly maxIntermediatePieces: number;
|
|
10
|
+
readonly maxOutputPieces: number;
|
|
11
|
+
readonly maxWork: number;
|
|
12
|
+
readonly maxFractionDigits: number;
|
|
13
|
+
readonly maxRelativeDayDigits: number;
|
|
14
|
+
readonly maxCountCharacters: number;
|
|
15
|
+
readonly maxNumericCharacters: number;
|
|
16
|
+
readonly maxCoefficientDigits: number;
|
|
17
|
+
readonly maxExponentMagnitude: number;
|
|
18
|
+
readonly maxWorkspaceDigits: number;
|
|
19
|
+
readonly maxOutputCharacters: number;
|
|
20
|
+
readonly maxResultBytes: number;
|
|
21
|
+
}
|
|
22
|
+
export const AEONIC_TEMPORAL_CIVIL_CLOCK_DEFAULT_RESOURCE_LIMITS: Readonly<AeonicCivilClockResourceLimits>;
|
|
23
|
+
export interface AeonicCivilClockOptions {
|
|
24
|
+
readonly resourceLimits?: Partial<AeonicCivilClockResourceLimits>;
|
|
25
|
+
readonly capabilities?: readonly ('relations' | 'arithmetic')[];
|
|
26
|
+
}
|
|
27
|
+
export type AeonicCivilClockForm = 'hour' | 'minute' | 'second';
|
|
28
|
+
export type AeonicCivilClockOrigin = AeonicCivilClockForm | 'undeclared';
|
|
29
|
+
export type AeonicCivilClockHistory = 'none-declared' | 'approximation-declared';
|
|
30
|
+
export interface AeonicCivilClockCoordinate {
|
|
31
|
+
/** Canonical signed integer text: 0, 1, -1; no calendar date is assigned. */
|
|
32
|
+
readonly day: string;
|
|
33
|
+
/** Full canonical HH:MM:SS[.fraction], with no trailing fractional zeroes. */
|
|
34
|
+
readonly time: string;
|
|
35
|
+
}
|
|
36
|
+
export interface AeonicCivilClockPoint { readonly kind: 'point'; readonly at: AeonicCivilClockCoordinate }
|
|
37
|
+
export interface AeonicCivilClockInterval {
|
|
38
|
+
readonly kind: 'interval';
|
|
39
|
+
readonly start: AeonicCivilClockCoordinate;
|
|
40
|
+
readonly end: AeonicCivilClockCoordinate;
|
|
41
|
+
readonly includeStart: boolean;
|
|
42
|
+
readonly includeEnd: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface AeonicCivilClockSet {
|
|
45
|
+
readonly category: 'civilClockSet';
|
|
46
|
+
/** Nonempty canonical sorted pieces, preserving gaps and excluded endpoints. */
|
|
47
|
+
readonly pieces: readonly (AeonicCivilClockPoint | AeonicCivilClockInterval)[];
|
|
48
|
+
}
|
|
49
|
+
export interface AeonicAuthoredClockBundle {
|
|
50
|
+
readonly temporal: { readonly category: 'civilClock'; readonly value: string };
|
|
51
|
+
readonly originClockForm?: AeonicCivilClockOrigin;
|
|
52
|
+
readonly history?: AeonicCivilClockHistory;
|
|
53
|
+
}
|
|
54
|
+
export interface AeonicDerivedClockBundle {
|
|
55
|
+
readonly temporal: AeonicCivilClockSet;
|
|
56
|
+
readonly originClockForm: AeonicCivilClockOrigin;
|
|
57
|
+
readonly history: AeonicCivilClockHistory;
|
|
58
|
+
}
|
|
59
|
+
export interface AeonicMaterializedClockBundle extends AeonicAuthoredClockBundle {
|
|
60
|
+
readonly originClockForm: AeonicCivilClockOrigin;
|
|
61
|
+
readonly history: AeonicCivilClockHistory;
|
|
62
|
+
}
|
|
63
|
+
export type AeonicCivilClockOperand = AeonicAuthoredClockBundle | AeonicDerivedClockBundle;
|
|
64
|
+
export interface AeonicCivilClockProfile { readonly profile?: string }
|
|
65
|
+
export interface AeonicCivilClockRelationRequest {
|
|
66
|
+
readonly operation: 'equal' | 'compare' | 'relate';
|
|
67
|
+
readonly input: { readonly left: AeonicCivilClockOperand; readonly right: AeonicCivilClockOperand;
|
|
68
|
+
readonly context?: AeonicCivilClockProfile; readonly policy?: AeonicCivilClockProfile };
|
|
69
|
+
}
|
|
70
|
+
export interface AeonicCivilClockShiftRequest {
|
|
71
|
+
readonly operation: 'shiftClock';
|
|
72
|
+
readonly input: { readonly value: AeonicCivilClockOperand;
|
|
73
|
+
/** Finite authored or normalized exact decimal; rational amounts need explicit quantization first. */
|
|
74
|
+
readonly amount: AeonicArithmeticOperand;
|
|
75
|
+
readonly context?: AeonicCivilClockProfile; readonly policy?: AeonicCivilClockProfile };
|
|
76
|
+
}
|
|
77
|
+
export interface AeonicCivilClockOutputPolicy extends AeonicCivilClockProfile { readonly clockForm: AeonicCivilClockForm }
|
|
78
|
+
export interface AeonicCivilClockStepRequest {
|
|
79
|
+
readonly operation: 'step';
|
|
80
|
+
readonly input: { readonly value: AeonicCivilClockOperand; readonly context?: AeonicCivilClockProfile;
|
|
81
|
+
readonly policy: AeonicCivilClockOutputPolicy & { readonly count: string } };
|
|
82
|
+
}
|
|
83
|
+
export interface AeonicCivilClockMaterializeRequest {
|
|
84
|
+
readonly operation: 'materialize';
|
|
85
|
+
readonly input: { readonly value: AeonicCivilClockOperand; readonly context?: AeonicCivilClockProfile;
|
|
86
|
+
readonly policy: AeonicCivilClockOutputPolicy };
|
|
87
|
+
}
|
|
88
|
+
export type AeonicCivilClockArithmeticRequest = AeonicCivilClockShiftRequest | AeonicCivilClockStepRequest | AeonicCivilClockMaterializeRequest;
|
|
89
|
+
export type AeonicCivilClockRequest = AeonicCivilClockArithmeticRequest | AeonicCivilClockRelationRequest;
|
|
90
|
+
export interface AeonicCivilClockDiagnostic {
|
|
91
|
+
readonly outcome: 'diagnostic';
|
|
92
|
+
readonly reason: 'invalid_operand' | 'invalid_policy' | 'unsupported_profile' | 'unsupported_operation'
|
|
93
|
+
| 'unsupported_domain' | 'incompatible_operand' | 'unrepresentable_result' | 'resource_limit';
|
|
94
|
+
readonly context: { readonly stage: 1 | 2 | 3 | 4 | 5 | 6 | 7; readonly path: string | null };
|
|
95
|
+
readonly message?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface AeonicCivilClockMetadata {
|
|
98
|
+
readonly evaluation: 'exact-for-policy';
|
|
99
|
+
readonly effectivePolicy: { readonly profile: typeof AEONIC_TEMPORAL_CIVIL_CLOCK_PROFILE;
|
|
100
|
+
readonly count?: string; readonly clockForm?: AeonicCivilClockForm };
|
|
101
|
+
}
|
|
102
|
+
export interface AeonicCivilClockArithmeticValueResult {
|
|
103
|
+
readonly outcome: 'value';
|
|
104
|
+
readonly value: AeonicDerivedClockBundle | AeonicMaterializedClockBundle;
|
|
105
|
+
readonly metadata: AeonicCivilClockMetadata;
|
|
106
|
+
}
|
|
107
|
+
export interface AeonicCivilClockRelationValueResult {
|
|
108
|
+
readonly outcome: 'value';
|
|
109
|
+
readonly value: { readonly category: 'symbol'; readonly value: 'equal' | 'notEqual' | 'before' | 'after' | 'indeterminate'
|
|
110
|
+
| 'contains' | 'containedBy' | 'overlaps' | 'disjoint' };
|
|
111
|
+
readonly metadata: AeonicCivilClockMetadata & {
|
|
112
|
+
readonly operandHistory: { readonly left: AeonicCivilClockHistory; readonly right: AeonicCivilClockHistory };
|
|
113
|
+
readonly operandOrigin: { readonly left: AeonicCivilClockOrigin; readonly right: AeonicCivilClockOrigin };
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export type AeonicCivilClockArithmeticResult = AeonicCivilClockArithmeticValueResult | AeonicCivilClockDiagnostic;
|
|
117
|
+
export type AeonicCivilClockRelationResult = AeonicCivilClockRelationValueResult | AeonicCivilClockDiagnostic;
|
|
118
|
+
export type AeonicCivilClockResult = AeonicCivilClockArithmeticValueResult | AeonicCivilClockRelationValueResult | AeonicCivilClockDiagnostic;
|
|
119
|
+
/** Explicit profile selection required. Full returned bundles retain relative days for chaining. */
|
|
120
|
+
export function evaluateAeonicCivilClock(request: AeonicCivilClockArithmeticRequest, options?: AeonicCivilClockOptions): AeonicCivilClockArithmeticResult;
|
|
121
|
+
export function evaluateAeonicCivilClock(request: AeonicCivilClockRelationRequest, options?: AeonicCivilClockOptions): AeonicCivilClockRelationResult;
|
|
122
|
+
export function evaluateAeonicCivilClock(request: AeonicCivilClockRequest, options?: AeonicCivilClockOptions): AeonicCivilClockResult;
|
|
123
|
+
/** Verbatim logical JSON preserves duplicate-key and raw numeric evidence. */
|
|
124
|
+
export function evaluateAeonicCivilClockText(requestText: string, options?: AeonicCivilClockOptions): AeonicCivilClockResult;
|