@hyperscale0/udl 2.6.1 → 3.0.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 +2 -330
- package/LICENSING.md +1 -2
- package/README.md +3 -114
- package/TRADEMARKS.md +2 -2
- package/dist/diagnostics.d.ts +21 -201
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +29 -193
- package/dist/diagnostics.js.map +1 -1
- package/dist/evolution.d.ts +3 -132
- package/dist/evolution.d.ts.map +1 -1
- package/dist/evolution.js +29 -633
- package/dist/evolution.js.map +1 -1
- package/dist/finance.d.ts +5 -72
- package/dist/finance.d.ts.map +1 -1
- package/dist/finance.js +233 -737
- package/dist/finance.js.map +1 -1
- package/dist/index.d.ts +7 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -12
- package/dist/index.js.map +1 -1
- package/dist/instrument-references.d.ts.map +1 -1
- package/dist/instrument-references.js +3 -2
- package/dist/instrument-references.js.map +1 -1
- package/dist/schema.d.ts +2079 -4564
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +270 -1609
- package/dist/schema.js.map +1 -1
- package/dist/validation.d.ts +8 -104
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +653 -3271
- package/dist/validation.js.map +1 -1
- package/docs/README.md +147 -14
- package/package.json +7 -11
- package/spec/README.md +151 -164
- package/spec/darb.udl.json +249 -0
- package/spec/udl.schema.json +4104 -3202
- package/src/diagnostics.ts +51 -246
- package/src/evolution.ts +39 -1045
- package/src/finance.ts +287 -1127
- package/src/index.ts +18 -142
- package/src/instrument-references.ts +3 -2
- package/src/schema.ts +285 -1843
- package/src/validation.ts +870 -5611
- package/conformance/README.md +0 -82
- package/conformance/evolution/action-contract.expected.json +0 -10
- package/conformance/evolution/action-contract.live.udl +0 -44
- package/conformance/evolution/action-contract.next.udl +0 -45
- package/conformance/evolution/product-identity.expected.json +0 -10
- package/conformance/evolution/product-identity.live.udl +0 -55
- package/conformance/evolution/product-identity.next.udl +0 -55
- package/conformance/evolution/version-required.expected.json +0 -10
- package/conformance/evolution/version-required.live.udl +0 -55
- package/conformance/evolution/version-required.next.udl +0 -58
- package/conformance/invalid/action-without-transition.expected.json +0 -10
- package/conformance/invalid/action-without-transition.udl +0 -60
- package/conformance/invalid/agent-description-too-long.expected.json +0 -10
- package/conformance/invalid/agent-description-too-long.udl +0 -57
- package/conformance/invalid/blank-title.expected.json +0 -10
- package/conformance/invalid/blank-title.udl +0 -54
- package/conformance/invalid/call-binds-results.expected.json +0 -10
- package/conformance/invalid/call-binds-results.udl +0 -314
- package/conformance/invalid/call-unknown-action.expected.json +0 -10
- package/conformance/invalid/call-unknown-action.udl +0 -314
- package/conformance/invalid/composition-dial-duplicate-key.expected.json +0 -10
- package/conformance/invalid/composition-dial-duplicate-key.udl +0 -73
- package/conformance/invalid/depth-budget.expected.json +0 -10
- package/conformance/invalid/depth-budget.udl +0 -49
- package/conformance/invalid/duplicate-subject.expected.json +0 -10
- package/conformance/invalid/duplicate-subject.udl +0 -230
- package/conformance/invalid/forged-effects.expected.json +0 -10
- package/conformance/invalid/forged-effects.udl +0 -76
- package/conformance/invalid/format-version.expected.json +0 -10
- package/conformance/invalid/format-version.udl +0 -54
- package/conformance/invalid/instrument-id-not-snake-case.expected.json +0 -10
- package/conformance/invalid/instrument-id-not-snake-case.udl +0 -54
- package/conformance/invalid/invalid-aggregate-gate-shape.expected.json +0 -10
- package/conformance/invalid/invalid-aggregate-gate-shape.udl +0 -1819
- package/conformance/invalid/invalid-check-duration.expected.json +0 -10
- package/conformance/invalid/invalid-check-duration.udl +0 -219
- package/conformance/invalid/invalid-dial-anchor.expected.json +0 -10
- package/conformance/invalid/invalid-dial-anchor.udl +0 -219
- package/conformance/invalid/invalid-exception-parent-ref.expected.json +0 -10
- package/conformance/invalid/invalid-exception-parent-ref.udl +0 -2487
- package/conformance/invalid/invalid-exposure-shape.expected.json +0 -10
- package/conformance/invalid/invalid-exposure-shape.udl +0 -1819
- package/conformance/invalid/invalid-journeys.expected.json +0 -10
- package/conformance/invalid/invalid-journeys.udl +0 -77
- package/conformance/invalid/invalid-remainder.expected.json +0 -10
- package/conformance/invalid/invalid-remainder.udl +0 -220
- package/conformance/invalid/invalid-schema-keyword.expected.json +0 -10
- package/conformance/invalid/invalid-schema-keyword.udl +0 -220
- package/conformance/invalid/invalid-utf8.expected.json +0 -10
- package/conformance/invalid/invalid-utf8.udl +0 -1
- package/conformance/invalid/leaf-effect-mismatch.expected.json +0 -10
- package/conformance/invalid/leaf-effect-mismatch.udl +0 -314
- package/conformance/invalid/malformed-json.expected.json +0 -10
- package/conformance/invalid/malformed-json.udl +0 -1
- package/conformance/invalid/missing-create-action.expected.json +0 -10
- package/conformance/invalid/missing-create-action.udl +0 -48
- package/conformance/invalid/missing-exception-amount-field.expected.json +0 -10
- package/conformance/invalid/missing-exception-amount-field.udl +0 -2487
- package/conformance/invalid/missing-exception-contract.expected.json +0 -14
- package/conformance/invalid/missing-exception-contract.udl +0 -2523
- package/conformance/invalid/missing-exception-reason-field.expected.json +0 -10
- package/conformance/invalid/missing-exception-reason-field.udl +0 -2487
- package/conformance/invalid/not-an-object.expected.json +0 -10
- package/conformance/invalid/not-an-object.udl +0 -1
- package/conformance/invalid/payout-reconcile-not-a-bank-debit.expected.json +0 -10
- package/conformance/invalid/payout-reconcile-not-a-bank-debit.udl +0 -259
- package/conformance/invalid/piece-plan-without-partition.expected.json +0 -10
- package/conformance/invalid/piece-plan-without-partition.udl +0 -305
- package/conformance/invalid/private-action-independent-approval.expected.json +0 -10
- package/conformance/invalid/private-action-independent-approval.udl +0 -314
- package/conformance/invalid/quote-freeze-set-incomplete.expected.json +0 -10
- package/conformance/invalid/quote-freeze-set-incomplete.udl +0 -261
- package/conformance/invalid/quote-named-reference-gate.expected.json +0 -10
- package/conformance/invalid/quote-named-reference-gate.udl +0 -50
- package/conformance/invalid/reconcile-named-reference-gate.expected.json +0 -10
- package/conformance/invalid/reconcile-named-reference-gate.udl +0 -50
- package/conformance/invalid/unfund-order-not-reversed.expected.json +0 -10
- package/conformance/invalid/unfund-order-not-reversed.udl +0 -314
- package/conformance/invalid/unknown-key.expected.json +0 -10
- package/conformance/invalid/unknown-key.udl +0 -55
- package/conformance/invalid/unknown-reference-gate-field.expected.json +0 -10
- package/conformance/invalid/unknown-reference-gate-field.udl +0 -1819
- package/conformance/invalid/unknown-required-field.expected.json +0 -10
- package/conformance/invalid/unknown-required-field.udl +0 -220
- package/conformance/invalid/unreachable-state.expected.json +0 -10
- package/conformance/invalid/unreachable-state.udl +0 -55
- package/conformance/invalid/wrong-exception-amount-field.expected.json +0 -10
- package/conformance/invalid/wrong-exception-amount-field.udl +0 -2487
- package/conformance/invalid/wrong-exception-reason-field.expected.json +0 -10
- package/conformance/invalid/wrong-exception-reason-field.udl +0 -2487
- package/conformance/valid/agent-description.expected.json +0 -6
- package/conformance/valid/agent-description.udl +0 -66
- package/conformance/valid/attested.expected.json +0 -6
- package/conformance/valid/attested.udl +0 -251
- package/conformance/valid/cards.expected.json +0 -6
- package/conformance/valid/cards.udl +0 -1579
- package/conformance/valid/commerce-escrow.expected.json +0 -6
- package/conformance/valid/commerce-escrow.udl +0 -1512
- package/conformance/valid/compiled-crowdfunding.expected.json +0 -6
- package/conformance/valid/compiled-crowdfunding.udl +0 -1843
- package/conformance/valid/compiled-watch-club.expected.json +0 -6
- package/conformance/valid/compiled-watch-club.udl +0 -2486
- package/conformance/valid/complete-contract.expected.json +0 -6
- package/conformance/valid/complete-contract.udl +0 -218
- package/conformance/valid/effect-signatures.expected.json +0 -6
- package/conformance/valid/effect-signatures.udl +0 -75
- package/conformance/valid/hand-edited.expected.json +0 -6
- package/conformance/valid/hand-edited.udl +0 -1
- package/conformance/valid/insured-car-marketplace.expected.json +0 -6
- package/conformance/valid/insured-car-marketplace.udl +0 -1050
- package/conformance/valid/insured-travel.expected.json +0 -6
- package/conformance/valid/insured-travel.udl +0 -3469
- package/conformance/valid/minimal.expected.json +0 -6
- package/conformance/valid/minimal.udl +0 -62
- package/conformance/valid/piece-plan-calls.expected.json +0 -6
- package/conformance/valid/piece-plan-calls.udl +0 -314
- package/conformance/valid/protection.expected.json +0 -6
- package/conformance/valid/protection.udl +0 -1551
- package/conformance/valid/string-escaping.expected.json +0 -6
- package/conformance/valid/string-escaping.udl +0 -54
- package/conformance/valid/vocabulary.expected.json +0 -6
- package/conformance/valid/vocabulary.udl +0 -2012
- package/dist/allocation.d.ts +0 -60
- package/dist/allocation.d.ts.map +0 -1
- package/dist/allocation.js +0 -177
- package/dist/allocation.js.map +0 -1
- package/dist/check-profiles.d.ts +0 -57
- package/dist/check-profiles.d.ts.map +0 -1
- package/dist/check-profiles.js +0 -62
- package/dist/check-profiles.js.map +0 -1
- package/dist/distribution.d.ts +0 -15
- package/dist/distribution.d.ts.map +0 -1
- package/dist/distribution.js +0 -49
- package/dist/distribution.js.map +0 -1
- package/dist/effects.d.ts +0 -58
- package/dist/effects.d.ts.map +0 -1
- package/dist/effects.js +0 -1126
- package/dist/effects.js.map +0 -1
- package/dist/reference.d.ts +0 -3
- package/dist/reference.d.ts.map +0 -1
- package/dist/reference.js +0 -28
- package/dist/reference.js.map +0 -1
- package/dist/vocabulary.d.ts +0 -23
- package/dist/vocabulary.d.ts.map +0 -1
- package/dist/vocabulary.js +0 -1052
- package/dist/vocabulary.js.map +0 -1
- package/docs/funding-custody.md +0 -165
- package/docs/guide/01-a-document.md +0 -37
- package/docs/guide/02-money-steps.md +0 -23
- package/docs/guide/03-laws.md +0 -18
- package/docs/guide/04-fees-and-remainder.md +0 -36
- package/docs/guide/05-checks-updates-dials.md +0 -7
- package/docs/guide/06-effects.md +0 -11
- package/docs/guide/07-evolution.md +0 -11
- package/docs/guide/08-implementing.md +0 -13
- package/docs/guide/09-schedules-and-allocation.md +0 -132
- package/docs/llms-full.txt +0 -2008
- package/docs/llms.txt +0 -14
- package/docs/piece-plans.md +0 -148
- package/docs/reference/canonical.md +0 -16
- package/docs/reference/clauses.md +0 -1585
- package/docs/reference/cli.md +0 -24
- package/docs/reference/diagnostics.md +0 -38
- package/skills/udl/SKILL.md +0 -28
- package/src/allocation.ts +0 -259
- package/src/check-profiles.ts +0 -80
- package/src/distribution.ts +0 -61
- package/src/effects.ts +0 -1920
- package/src/reference.ts +0 -31
- package/src/vocabulary.ts +0 -1635
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperscale0/udl",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "The Universal Domain Language: format spec, parser, validator, canonical serializer, and evolution diff.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"udl",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"default": "./dist/index.js"
|
|
36
36
|
},
|
|
37
37
|
"./spec/*": "./spec/*",
|
|
38
|
-
"./conformance/*": "./conformance/*",
|
|
39
38
|
"./package.json": "./package.json"
|
|
40
39
|
},
|
|
41
40
|
"files": [
|
|
@@ -46,10 +45,8 @@
|
|
|
46
45
|
"README.md",
|
|
47
46
|
"SECURITY.md",
|
|
48
47
|
"TRADEMARKS.md",
|
|
49
|
-
"conformance",
|
|
50
48
|
"docs",
|
|
51
49
|
"dist",
|
|
52
|
-
"skills",
|
|
53
50
|
"spec",
|
|
54
51
|
"src"
|
|
55
52
|
],
|
|
@@ -60,18 +57,17 @@
|
|
|
60
57
|
"access": "public"
|
|
61
58
|
},
|
|
62
59
|
"scripts": {
|
|
63
|
-
"build": "
|
|
64
|
-
"
|
|
65
|
-
"
|
|
60
|
+
"build": "tsc -p tsconfig.build.json",
|
|
61
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
62
|
+
"test": "bun test test",
|
|
63
|
+
"docs:build": "bun scripts/docs.ts",
|
|
66
64
|
"postpack": "bun scripts/pack-exports.ts restore",
|
|
67
65
|
"prepack": "bun run build && bun scripts/pack-exports.ts apply",
|
|
68
66
|
"spec": "bun scripts/emit-spec.ts --write",
|
|
69
67
|
"spec:check": "bun scripts/emit-spec.ts --check",
|
|
70
|
-
"
|
|
71
|
-
"typecheck": "tsc -p tsconfig.json"
|
|
68
|
+
"check": "bun run spec:check && bun run docs:build && bun run typecheck && bun run build && bun test test"
|
|
72
69
|
},
|
|
73
70
|
"dependencies": {
|
|
74
|
-
"@cfworker/json-schema": "4.1.1",
|
|
75
71
|
"zod": "4.5.4"
|
|
76
72
|
},
|
|
77
73
|
"devDependencies": {
|
|
@@ -83,5 +79,5 @@
|
|
|
83
79
|
"Amir Ayub",
|
|
84
80
|
"Sara AlBakaawi"
|
|
85
81
|
],
|
|
86
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "b84ee93a5016401a5f8287745a2fb23ba5647e43"
|
|
87
83
|
}
|
package/spec/README.md
CHANGED
|
@@ -1,164 +1,151 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
and the
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
**Package version** is the semver of `@hyperscale0/udl`, declared in
|
|
153
|
-
`package.json`.
|
|
154
|
-
|
|
155
|
-
They move independently. In development mode, contract and schema shapes change
|
|
156
|
-
without deprecation paths or frozen compatibility promises.
|
|
157
|
-
|
|
158
|
-
The evolution diff API (`diffValidatedUdlEvolution` and `diffInstrumentEvolution`)
|
|
159
|
-
evaluates append-only rules between two admitted documents. The evolution codes
|
|
160
|
-
are explicit. `UDL7001` protects stored identities, subjects, instruments, fields,
|
|
161
|
-
lifecycles, actions, money clauses, gates, and policy against removal, renaming,
|
|
162
|
-
or tightening. `UDL7002` requires a version increase for a semantic change.
|
|
163
|
-
Evolution comparison admits the previous document first. A stored document
|
|
164
|
-
that fails admission is `invalid_previous`, not an evolution issue.
|
|
1
|
+
# UDL 3
|
|
2
|
+
|
|
3
|
+
UDL is the typed contract between an HSX program and its executor. The grammar
|
|
4
|
+
lives in `src/schema.ts`. Generate `udl.schema.json` with
|
|
5
|
+
`bun scripts/emit-spec.ts --write`. There is no migration reader for earlier UDL.
|
|
6
|
+
|
|
7
|
+
## Accounts and money
|
|
8
|
+
|
|
9
|
+
A document declares SAR once. Money is a nonnegative minor-unit decimal string
|
|
10
|
+
of at most 18 digits. Percentages are basis points, durations are positive integer
|
|
11
|
+
milliseconds, and dates are timestamps with explicit offsets.
|
|
12
|
+
|
|
13
|
+
An account field either binds a party or declares an account owned by the
|
|
14
|
+
instrument. `owner: "self"` replaces the separate custody concept. Wallet, pool,
|
|
15
|
+
receivable and entitlement are uses of accounts, not different field types.
|
|
16
|
+
An external account is marked `external: true`. Its bank binding belongs to the
|
|
17
|
+
executor; programs and callers never supply bank beneficiary ids. Account
|
|
18
|
+
creation and binding are executor work, not caller-controlled instructions.
|
|
19
|
+
Accounts declare `book: "cash" | "claim"`, defaulting to cash. Moves never cross books.
|
|
20
|
+
Only claim accounts may declare `contra: true` and permit a negative balance.
|
|
21
|
+
An external account must bind a party and use the cash book. A party-bound field
|
|
22
|
+
is keyed by owner, book and key across the product. Its optional key defaults
|
|
23
|
+
to `balance`, so payer and borrower can alias the same party account. An account
|
|
24
|
+
owned by self defaults its key to the field name and is provisioned per instance.
|
|
25
|
+
Named capital, profit income, debt and loss accounts declare explicit keys. `party.buyer` is the buyer's default cash account.
|
|
26
|
+
|
|
27
|
+
Disbursement moves cash from lender to borrower and claims from borrower debt to
|
|
28
|
+
principal and profit receivables. Repayment moves borrower cash to lender cash and
|
|
29
|
+
the same claim amounts from receivables back to borrower debt. Unearned profit is
|
|
30
|
+
cancelled by the claim move alone. Write-off moves the principal claim to the
|
|
31
|
+
lender's loss account, with no cash movement. Profit is earned when a piece is paid.
|
|
32
|
+
These are ordinary paired moves in HSX, not executor loan rules.
|
|
33
|
+
|
|
34
|
+
A value is `{literal: value}` or `{field: path}`. Paths start with `self`, `input`
|
|
35
|
+
or `party`. Reference fields allow typed traversal. Account paths expose locked,
|
|
36
|
+
read-only `.balance` and `.reserved` money values. `self.id`, `self.status`,
|
|
37
|
+
`self.createdAt` and `self.now` are sealed executor values. Callers cannot set
|
|
38
|
+
constants, calculated fields, account bindings or capture fields. Create supplies
|
|
39
|
+
declared typed references; later actions cannot replace them. A ref target is one
|
|
40
|
+
instrument id or a list of 1 to 16 distinct instrument ids. The stored value is
|
|
41
|
+
one instance id from any listed instrument. Path traversal exposes only fields
|
|
42
|
+
with compatible types on every target. Nested refs combine their target sets;
|
|
43
|
+
accounts must agree on owner, key, book, contra and external flags, and enums must
|
|
44
|
+
have the same values. A comparison or selection anchor must share a possible
|
|
45
|
+
reference target. An invoked input must accept every possible supplied target.
|
|
46
|
+
The executor checks the actual instance type at admission.
|
|
47
|
+
|
|
48
|
+
## Calculation and movement
|
|
49
|
+
|
|
50
|
+
Calculations form a finite dependency graph. `sum`, `subtract` and `minimum`
|
|
51
|
+
operate on money or integer fields, with operands of the same type as the target.
|
|
52
|
+
`rate`, `multiply`, `divide` and `shift` retain their typed operands. Rate and
|
|
53
|
+
division round down. Weighted shares also round down; residual minor units go
|
|
54
|
+
to the declared residual account. Cash and loss use this one rounding rule.
|
|
55
|
+
There is no largest-remainder allocation. Subtraction refuses a negative result. Integer results must
|
|
56
|
+
be safe integers. No calculation evaluates source text.
|
|
57
|
+
|
|
58
|
+
The only move instructions are `internal_transfer.create`,
|
|
59
|
+
`internal_transfer.reserve`, `internal_transfer.post` and `internal_transfer.void`.
|
|
60
|
+
Create and reserve declare an amount, from account and to account. Reserve captures
|
|
61
|
+
its executor-produced transfer identity into a declared self text field. Post and
|
|
62
|
+
void consume that identity. Callers cannot create or replace captured identities.
|
|
63
|
+
An external destination uses the same move vocabulary.
|
|
64
|
+
|
|
65
|
+
A loan, refund, payoff, write-off or distribution is library behavior built from
|
|
66
|
+
accounts, calculations and ordered moves. None has a privileged executor clause.
|
|
67
|
+
Outstanding principal is an account balance. A schedule consists of explicit
|
|
68
|
+
dated child records, with positions 1 through n in declaration order. The library
|
|
69
|
+
uses ordinary comparisons and aggregates to constrain those records. There is no
|
|
70
|
+
recurrence process, allocation bucket, partition expander or schedule requirement
|
|
71
|
+
in the UDL kernel.
|
|
72
|
+
|
|
73
|
+
## Admission and lifecycle
|
|
74
|
+
|
|
75
|
+
Actions declare typed input lists, requirements, an actor and an event. Lifecycle
|
|
76
|
+
edges name their source and destination states. Requirements and effects execute
|
|
77
|
+
atomically under the same account and reference locks. `set` copies typed values
|
|
78
|
+
to mutable fields. Action calculations read the locked snapshot and populate the
|
|
79
|
+
action draft before requirements. Ordered moves and invocations follow admission;
|
|
80
|
+
invariants check the completed transaction. A due instant
|
|
81
|
+
is inclusive; a deadline is exclusive. Clock delays never extend deadlines.
|
|
82
|
+
|
|
83
|
+
Requirements are compare, state, unique, aggregate, approval, evidence and hours.
|
|
84
|
+
A typed selection names one instrument or a bounded union, a reference field,
|
|
85
|
+
anchor, accepted states and row limit. Exceeding the limit refuses rather than
|
|
86
|
+
truncates. Optional equality filters apply to every selected type. An optional
|
|
87
|
+
window selects date values between `self.now - milliseconds` and `self.now`.
|
|
88
|
+
Aggregate sums use typed paths on the selected records, including account
|
|
89
|
+
balances. An invariant holds before and after every affected transaction.
|
|
90
|
+
|
|
91
|
+
`hours` converts a date path to its literal IANA timezone and accepts `[start,end)`.
|
|
92
|
+
A start greater than end wraps midnight; equal endpoints admit no time.
|
|
93
|
+
`evidence` declares subject, family, check, result and maxAge. The subject is an
|
|
94
|
+
account or text id. The executor selects the newest completed check for that
|
|
95
|
+
subject, family and kind, refuses stale evidence and requires the declared result.
|
|
96
|
+
|
|
97
|
+
An approval freezes target, action, material input, authenticated party, expiry
|
|
98
|
+
and Build identity. The executor produces the digest. A requirement consumes the
|
|
99
|
+
matching approved or declined decision once in the same transaction. `target`
|
|
100
|
+
defaults to self and `action` to the current action. `invoke` supplies typed inputs
|
|
101
|
+
to a linked action or bounded selection. Its graph is acyclic and bounded.
|
|
102
|
+
Public names grant no authority; clock and parent actors remain executor-owned.
|
|
103
|
+
|
|
104
|
+
A captured move exposes a sealed `.status` path with reserved, posted, settled,
|
|
105
|
+
reversed or voided. Voided means a reservation was released. Settled means the outbox received provider confirmation. Reversed
|
|
106
|
+
means provider failure produced a reversal move. A library payout reconciliation
|
|
107
|
+
compares that status with settled at its deadline. Account balances reflect the
|
|
108
|
+
immediate internal ledger and cannot prove an individual bank completion.
|
|
109
|
+
Aggregate bank reconciliation is an operations concern outside the contract.
|
|
110
|
+
There is no special reconciliation or exception-creation clause.
|
|
111
|
+
|
|
112
|
+
## Ten laws
|
|
113
|
+
|
|
114
|
+
1. Each concept has one concrete meaning.
|
|
115
|
+
2. Provider transport and credentials stay outside the contract.
|
|
116
|
+
3. Every state change emits its declared event.
|
|
117
|
+
4. Four transfer instructions are the only money movement vocabulary.
|
|
118
|
+
5. Instances have an opaque identity and money uses integer minor units.
|
|
119
|
+
6. Typed requirements and effects execute atomically.
|
|
120
|
+
7. Live additions preserve existing meaning; development estates may recreate.
|
|
121
|
+
8. Business names identify instruments and their public actions.
|
|
122
|
+
9. Waiting uses lifecycle states and clocks. Before admission, the executor
|
|
123
|
+
catches up actor: clock actions with due instants on the locked instance,
|
|
124
|
+
references and selected rows, in chronological order. Catch-up commits its
|
|
125
|
+
own transaction and events before the caller request is evaluated. A refused
|
|
126
|
+
caller request rolls back only its own drafts. Caller deadlines are refusal
|
|
127
|
+
boundaries; they never execute the caller action. Separate clock actions
|
|
128
|
+
carry expiry consequences. Requirements and selections observe the resulting
|
|
129
|
+
clock state.
|
|
130
|
+
10. References close, states are reachable, captures are linear, and terminal
|
|
131
|
+
instances have no remaining owned-account balances or reservations.
|
|
132
|
+
|
|
133
|
+
## Clause inventory
|
|
134
|
+
|
|
135
|
+
Document: `udl`, `version`, `product`, `title`, `currency`, `parties`, `instruments`.
|
|
136
|
+
Instrument: `id`, `title`, `summary`, `fields`, `calculate`, `lifecycle`, `actions`,
|
|
137
|
+
`actionOrder`, `invariants`, `examples`.
|
|
138
|
+
Action: `summary`, `publicAction`, `event`, `actor`, `input`, `requires`, `due`,
|
|
139
|
+
`deadline`, `set`, `calculate`, `moves`, `invoke`, `approval`.
|
|
140
|
+
|
|
141
|
+
The owner reduced the kernel on 17 September 2026. `allocation`, `allocate`,
|
|
142
|
+
`distribute`, `payout`, `reconcile`, `partitions`, `steps`, `drained`, the allocation
|
|
143
|
+
requirement and the schedule requirement were removed. They described library
|
|
144
|
+
work or duplicated accounts, comparisons and moves. The earlier UDL dialect's
|
|
145
|
+
JSON Schema fields, x-extensions, bind maps, pieceStage, contributionStage,
|
|
146
|
+
templateBinding, piecePlan, signedSum, engineOwned and captureEngine are absent.
|
|
147
|
+
Typed fields, calculations, account ownership and linear captures replace them.
|
|
148
|
+
|
|
149
|
+
`calculate.aggregate` reads a typed selection and yields its count or a money sum. `calculate.ratio` computes floor(amount * numerator / denominator) with arbitrary-precision intermediates and refuses a zero denominator. Numerator and denominator share a numeric type. Selection order is a list of typed ascending paths, followed by identity as the final tie-break. `invoke {instrument, action: "create", input}` creates a child record in the same transaction; its inputs resolve in the caller, and the ordinary create actor and requirements still apply.
|
|
150
|
+
|
|
151
|
+
`calculate.at` reads a typed list at a one-based position and refuses an out-of-range index. Its result has the list item type. Integer divide accepts integer operands and rounds down. Every move may capture its transfer identity into a declared self text field; reserve requires a capture. Captures and their status paths are executor-owned.
|