@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.
Files changed (213) hide show
  1. package/CHANGELOG.md +2 -330
  2. package/LICENSING.md +1 -2
  3. package/README.md +3 -114
  4. package/TRADEMARKS.md +2 -2
  5. package/dist/diagnostics.d.ts +21 -201
  6. package/dist/diagnostics.d.ts.map +1 -1
  7. package/dist/diagnostics.js +29 -193
  8. package/dist/diagnostics.js.map +1 -1
  9. package/dist/evolution.d.ts +3 -132
  10. package/dist/evolution.d.ts.map +1 -1
  11. package/dist/evolution.js +29 -633
  12. package/dist/evolution.js.map +1 -1
  13. package/dist/finance.d.ts +5 -72
  14. package/dist/finance.d.ts.map +1 -1
  15. package/dist/finance.js +233 -737
  16. package/dist/finance.js.map +1 -1
  17. package/dist/index.d.ts +7 -18
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +7 -12
  20. package/dist/index.js.map +1 -1
  21. package/dist/instrument-references.d.ts.map +1 -1
  22. package/dist/instrument-references.js +3 -2
  23. package/dist/instrument-references.js.map +1 -1
  24. package/dist/schema.d.ts +2079 -4564
  25. package/dist/schema.d.ts.map +1 -1
  26. package/dist/schema.js +270 -1609
  27. package/dist/schema.js.map +1 -1
  28. package/dist/validation.d.ts +8 -104
  29. package/dist/validation.d.ts.map +1 -1
  30. package/dist/validation.js +653 -3271
  31. package/dist/validation.js.map +1 -1
  32. package/docs/README.md +147 -14
  33. package/package.json +7 -11
  34. package/spec/README.md +151 -164
  35. package/spec/darb.udl.json +249 -0
  36. package/spec/udl.schema.json +4104 -3202
  37. package/src/diagnostics.ts +51 -246
  38. package/src/evolution.ts +39 -1045
  39. package/src/finance.ts +287 -1127
  40. package/src/index.ts +18 -142
  41. package/src/instrument-references.ts +3 -2
  42. package/src/schema.ts +285 -1843
  43. package/src/validation.ts +870 -5611
  44. package/conformance/README.md +0 -82
  45. package/conformance/evolution/action-contract.expected.json +0 -10
  46. package/conformance/evolution/action-contract.live.udl +0 -44
  47. package/conformance/evolution/action-contract.next.udl +0 -45
  48. package/conformance/evolution/product-identity.expected.json +0 -10
  49. package/conformance/evolution/product-identity.live.udl +0 -55
  50. package/conformance/evolution/product-identity.next.udl +0 -55
  51. package/conformance/evolution/version-required.expected.json +0 -10
  52. package/conformance/evolution/version-required.live.udl +0 -55
  53. package/conformance/evolution/version-required.next.udl +0 -58
  54. package/conformance/invalid/action-without-transition.expected.json +0 -10
  55. package/conformance/invalid/action-without-transition.udl +0 -60
  56. package/conformance/invalid/agent-description-too-long.expected.json +0 -10
  57. package/conformance/invalid/agent-description-too-long.udl +0 -57
  58. package/conformance/invalid/blank-title.expected.json +0 -10
  59. package/conformance/invalid/blank-title.udl +0 -54
  60. package/conformance/invalid/call-binds-results.expected.json +0 -10
  61. package/conformance/invalid/call-binds-results.udl +0 -314
  62. package/conformance/invalid/call-unknown-action.expected.json +0 -10
  63. package/conformance/invalid/call-unknown-action.udl +0 -314
  64. package/conformance/invalid/composition-dial-duplicate-key.expected.json +0 -10
  65. package/conformance/invalid/composition-dial-duplicate-key.udl +0 -73
  66. package/conformance/invalid/depth-budget.expected.json +0 -10
  67. package/conformance/invalid/depth-budget.udl +0 -49
  68. package/conformance/invalid/duplicate-subject.expected.json +0 -10
  69. package/conformance/invalid/duplicate-subject.udl +0 -230
  70. package/conformance/invalid/forged-effects.expected.json +0 -10
  71. package/conformance/invalid/forged-effects.udl +0 -76
  72. package/conformance/invalid/format-version.expected.json +0 -10
  73. package/conformance/invalid/format-version.udl +0 -54
  74. package/conformance/invalid/instrument-id-not-snake-case.expected.json +0 -10
  75. package/conformance/invalid/instrument-id-not-snake-case.udl +0 -54
  76. package/conformance/invalid/invalid-aggregate-gate-shape.expected.json +0 -10
  77. package/conformance/invalid/invalid-aggregate-gate-shape.udl +0 -1819
  78. package/conformance/invalid/invalid-check-duration.expected.json +0 -10
  79. package/conformance/invalid/invalid-check-duration.udl +0 -219
  80. package/conformance/invalid/invalid-dial-anchor.expected.json +0 -10
  81. package/conformance/invalid/invalid-dial-anchor.udl +0 -219
  82. package/conformance/invalid/invalid-exception-parent-ref.expected.json +0 -10
  83. package/conformance/invalid/invalid-exception-parent-ref.udl +0 -2487
  84. package/conformance/invalid/invalid-exposure-shape.expected.json +0 -10
  85. package/conformance/invalid/invalid-exposure-shape.udl +0 -1819
  86. package/conformance/invalid/invalid-journeys.expected.json +0 -10
  87. package/conformance/invalid/invalid-journeys.udl +0 -77
  88. package/conformance/invalid/invalid-remainder.expected.json +0 -10
  89. package/conformance/invalid/invalid-remainder.udl +0 -220
  90. package/conformance/invalid/invalid-schema-keyword.expected.json +0 -10
  91. package/conformance/invalid/invalid-schema-keyword.udl +0 -220
  92. package/conformance/invalid/invalid-utf8.expected.json +0 -10
  93. package/conformance/invalid/invalid-utf8.udl +0 -1
  94. package/conformance/invalid/leaf-effect-mismatch.expected.json +0 -10
  95. package/conformance/invalid/leaf-effect-mismatch.udl +0 -314
  96. package/conformance/invalid/malformed-json.expected.json +0 -10
  97. package/conformance/invalid/malformed-json.udl +0 -1
  98. package/conformance/invalid/missing-create-action.expected.json +0 -10
  99. package/conformance/invalid/missing-create-action.udl +0 -48
  100. package/conformance/invalid/missing-exception-amount-field.expected.json +0 -10
  101. package/conformance/invalid/missing-exception-amount-field.udl +0 -2487
  102. package/conformance/invalid/missing-exception-contract.expected.json +0 -14
  103. package/conformance/invalid/missing-exception-contract.udl +0 -2523
  104. package/conformance/invalid/missing-exception-reason-field.expected.json +0 -10
  105. package/conformance/invalid/missing-exception-reason-field.udl +0 -2487
  106. package/conformance/invalid/not-an-object.expected.json +0 -10
  107. package/conformance/invalid/not-an-object.udl +0 -1
  108. package/conformance/invalid/payout-reconcile-not-a-bank-debit.expected.json +0 -10
  109. package/conformance/invalid/payout-reconcile-not-a-bank-debit.udl +0 -259
  110. package/conformance/invalid/piece-plan-without-partition.expected.json +0 -10
  111. package/conformance/invalid/piece-plan-without-partition.udl +0 -305
  112. package/conformance/invalid/private-action-independent-approval.expected.json +0 -10
  113. package/conformance/invalid/private-action-independent-approval.udl +0 -314
  114. package/conformance/invalid/quote-freeze-set-incomplete.expected.json +0 -10
  115. package/conformance/invalid/quote-freeze-set-incomplete.udl +0 -261
  116. package/conformance/invalid/quote-named-reference-gate.expected.json +0 -10
  117. package/conformance/invalid/quote-named-reference-gate.udl +0 -50
  118. package/conformance/invalid/reconcile-named-reference-gate.expected.json +0 -10
  119. package/conformance/invalid/reconcile-named-reference-gate.udl +0 -50
  120. package/conformance/invalid/unfund-order-not-reversed.expected.json +0 -10
  121. package/conformance/invalid/unfund-order-not-reversed.udl +0 -314
  122. package/conformance/invalid/unknown-key.expected.json +0 -10
  123. package/conformance/invalid/unknown-key.udl +0 -55
  124. package/conformance/invalid/unknown-reference-gate-field.expected.json +0 -10
  125. package/conformance/invalid/unknown-reference-gate-field.udl +0 -1819
  126. package/conformance/invalid/unknown-required-field.expected.json +0 -10
  127. package/conformance/invalid/unknown-required-field.udl +0 -220
  128. package/conformance/invalid/unreachable-state.expected.json +0 -10
  129. package/conformance/invalid/unreachable-state.udl +0 -55
  130. package/conformance/invalid/wrong-exception-amount-field.expected.json +0 -10
  131. package/conformance/invalid/wrong-exception-amount-field.udl +0 -2487
  132. package/conformance/invalid/wrong-exception-reason-field.expected.json +0 -10
  133. package/conformance/invalid/wrong-exception-reason-field.udl +0 -2487
  134. package/conformance/valid/agent-description.expected.json +0 -6
  135. package/conformance/valid/agent-description.udl +0 -66
  136. package/conformance/valid/attested.expected.json +0 -6
  137. package/conformance/valid/attested.udl +0 -251
  138. package/conformance/valid/cards.expected.json +0 -6
  139. package/conformance/valid/cards.udl +0 -1579
  140. package/conformance/valid/commerce-escrow.expected.json +0 -6
  141. package/conformance/valid/commerce-escrow.udl +0 -1512
  142. package/conformance/valid/compiled-crowdfunding.expected.json +0 -6
  143. package/conformance/valid/compiled-crowdfunding.udl +0 -1843
  144. package/conformance/valid/compiled-watch-club.expected.json +0 -6
  145. package/conformance/valid/compiled-watch-club.udl +0 -2486
  146. package/conformance/valid/complete-contract.expected.json +0 -6
  147. package/conformance/valid/complete-contract.udl +0 -218
  148. package/conformance/valid/effect-signatures.expected.json +0 -6
  149. package/conformance/valid/effect-signatures.udl +0 -75
  150. package/conformance/valid/hand-edited.expected.json +0 -6
  151. package/conformance/valid/hand-edited.udl +0 -1
  152. package/conformance/valid/insured-car-marketplace.expected.json +0 -6
  153. package/conformance/valid/insured-car-marketplace.udl +0 -1050
  154. package/conformance/valid/insured-travel.expected.json +0 -6
  155. package/conformance/valid/insured-travel.udl +0 -3469
  156. package/conformance/valid/minimal.expected.json +0 -6
  157. package/conformance/valid/minimal.udl +0 -62
  158. package/conformance/valid/piece-plan-calls.expected.json +0 -6
  159. package/conformance/valid/piece-plan-calls.udl +0 -314
  160. package/conformance/valid/protection.expected.json +0 -6
  161. package/conformance/valid/protection.udl +0 -1551
  162. package/conformance/valid/string-escaping.expected.json +0 -6
  163. package/conformance/valid/string-escaping.udl +0 -54
  164. package/conformance/valid/vocabulary.expected.json +0 -6
  165. package/conformance/valid/vocabulary.udl +0 -2012
  166. package/dist/allocation.d.ts +0 -60
  167. package/dist/allocation.d.ts.map +0 -1
  168. package/dist/allocation.js +0 -177
  169. package/dist/allocation.js.map +0 -1
  170. package/dist/check-profiles.d.ts +0 -57
  171. package/dist/check-profiles.d.ts.map +0 -1
  172. package/dist/check-profiles.js +0 -62
  173. package/dist/check-profiles.js.map +0 -1
  174. package/dist/distribution.d.ts +0 -15
  175. package/dist/distribution.d.ts.map +0 -1
  176. package/dist/distribution.js +0 -49
  177. package/dist/distribution.js.map +0 -1
  178. package/dist/effects.d.ts +0 -58
  179. package/dist/effects.d.ts.map +0 -1
  180. package/dist/effects.js +0 -1126
  181. package/dist/effects.js.map +0 -1
  182. package/dist/reference.d.ts +0 -3
  183. package/dist/reference.d.ts.map +0 -1
  184. package/dist/reference.js +0 -28
  185. package/dist/reference.js.map +0 -1
  186. package/dist/vocabulary.d.ts +0 -23
  187. package/dist/vocabulary.d.ts.map +0 -1
  188. package/dist/vocabulary.js +0 -1052
  189. package/dist/vocabulary.js.map +0 -1
  190. package/docs/funding-custody.md +0 -165
  191. package/docs/guide/01-a-document.md +0 -37
  192. package/docs/guide/02-money-steps.md +0 -23
  193. package/docs/guide/03-laws.md +0 -18
  194. package/docs/guide/04-fees-and-remainder.md +0 -36
  195. package/docs/guide/05-checks-updates-dials.md +0 -7
  196. package/docs/guide/06-effects.md +0 -11
  197. package/docs/guide/07-evolution.md +0 -11
  198. package/docs/guide/08-implementing.md +0 -13
  199. package/docs/guide/09-schedules-and-allocation.md +0 -132
  200. package/docs/llms-full.txt +0 -2008
  201. package/docs/llms.txt +0 -14
  202. package/docs/piece-plans.md +0 -148
  203. package/docs/reference/canonical.md +0 -16
  204. package/docs/reference/clauses.md +0 -1585
  205. package/docs/reference/cli.md +0 -24
  206. package/docs/reference/diagnostics.md +0 -38
  207. package/skills/udl/SKILL.md +0 -28
  208. package/src/allocation.ts +0 -259
  209. package/src/check-profiles.ts +0 -80
  210. package/src/distribution.ts +0 -61
  211. package/src/effects.ts +0 -1920
  212. package/src/reference.ts +0 -31
  213. package/src/vocabulary.ts +0 -1635
@@ -1,2008 +0,0 @@
1
- <!-- Generated by scripts/docs/build.ts from @hyperscale0/udl 2.6.1. Edit the source, not llms-full.txt. -->
2
-
3
- # UDL complete reference
4
-
5
- <!-- source: README.md -->
6
-
7
- # UDL documentation
8
-
9
- UDL is the versioned JSON contract between a product definition and an engine that executes it. Start with the document guide, then read the guides in order. Validator authors should also read the canonical bytes law and run the conformance corpus.
10
-
11
- 1. [A document](guide/01-a-document.md)
12
- 2. [Money steps](guide/02-money-steps.md)
13
- 3. [The ten laws](guide/03-laws.md)
14
- 4. [Fees and remainder](guide/04-fees-and-remainder.md)
15
- 5. [Checks, updates, and dials](guide/05-checks-updates-dials.md)
16
- 6. [Effects](guide/06-effects.md)
17
- 7. [Evolution](guide/07-evolution.md)
18
- 8. [Implementing UDL](guide/08-implementing.md)
19
- 9. [Schedules, allocation and referenced state](guide/09-schedules-and-allocation.md)
20
-
21
- [Piece plans and private action composition](piece-plans.md) is a worked
22
- instrument fragment for `piecePlan`, `pieceStage`, `calls` and `actionLibrary`.
23
-
24
- The [clause reference](reference/clauses.md) and [diagnostic reference](reference/diagnostics.md) come from the package tables. The [command reference](reference/cli.md) comes from the CLI usage text. Run `bun run docs:build` in a source checkout. Package builds and prepack generate these ignored files automatically and validate local links.
25
-
26
- <!-- source: guide/01-a-document.md -->
27
-
28
- # A document
29
-
30
- A UDL document names one product and contains its subjects and instruments. Each instrument declares stored fields, required fields, a lifecycle, and the actions that create or change an instance.
31
-
32
- This is the smallest admitted document. `create` starts at `open`. `close` follows the matching lifecycle transition and ends at `closed`.
33
-
34
- ```json
35
- {
36
- "instruments": [
37
- {
38
- "actionOrder": ["close", "create"],
39
- "fields": { "reference": { "type": "string" } },
40
- "id": "note",
41
- "idPrefix": "note",
42
- "lifecycle": {
43
- "initial": "open",
44
- "states": ["open", "closed"],
45
- "transitions": { "close": { "from": ["open"], "to": "closed" } }
46
- },
47
- "required": ["reference"],
48
- "summary": "A note a tenant files and later closes.",
49
- "title": "Note",
50
- "actions": {
51
- "close": { "moves": [], "steps": [], "summary": "Close the note." },
52
- "create": { "moves": [], "steps": [], "summary": "File the note." }
53
- }
54
- }
55
- ],
56
- "product": "minimal",
57
- "subjects": [],
58
- "title": "Minimal",
59
- "udl": 1,
60
- "version": 1
61
- }
62
- ```
63
-
64
- The JSON Schema checks the written shape. `validateUdl` then checks names, references, lifecycle reachability, and the money graph. A document has no canonical form until both checks pass.
65
-
66
- <!-- source: guide/02-money-steps.md -->
67
-
68
- # Money steps
69
-
70
- UDL seals internal ledger work to seven kernel operations. Four instructions create, reserve, post, or void an internal transfer. Three account instructions provision an escrow account, freeze an account, or unfreeze it.
71
-
72
- A step names an operation and binds its inputs from action input, constants, or instance fields and refs. `capture` writes selected operation output into durable refs. A later step can read those refs.
73
-
74
- ```jsonc
75
- {
76
- "operation": "internal_transfer.reserve",
77
- "bind": {
78
- "sourceAccountId": { "from": "instance", "path": "fields.payerAccountId" },
79
- "destinationAccountId": {
80
- "from": "instance",
81
- "path": "refs.escrowAccountId",
82
- },
83
- "amount": { "from": "instance", "path": "fields.amount" },
84
- "currency": { "from": "const", "value": "SAR" },
85
- },
86
- "capture": { "transferId": "reservationId" },
87
- }
88
- ```
89
-
90
- `payout` is an execution intent, not an eighth kernel operation. It reads stored money and beneficiary data, then captures a durable payout reference. A later system action can reconcile that payout against settlement evidence.
91
-
92
- <!-- source: guide/03-laws.md -->
93
-
94
- # The ten laws
95
-
96
- The schema defines shape. These laws define meaning.
97
-
98
- 1. Every UDL concept fits in one sentence.
99
- 2. Provider formats and operating machinery stay below UDL. `reconcile` names settlement evidence against a declared provider-side row. It does not model the provider file or transport.
100
- 3. Every state change emits an event.
101
- 4. Internal ledger money uses the seven sealed operations.
102
- 5. Every instance has the same identity, status, timestamp, and metadata frame. Money uses integer minor-unit strings plus a currency.
103
- 6. Requirements such as due time, checks, references, quote commitment, and reconciliation are data.
104
- 7. A stored definition evolves by additive change only.
105
- 8. Instruments, actions, operations, and fields follow their declared naming patterns.
106
- 9. Real delays appear as statuses and timestamps.
107
- 10. Every state, reference, gate, and funded path closes inside the document.
108
-
109
- A reconcile exception names the child fields that receive the unmatched amount and its reason. `exception.amountField` must be a required money field on the child. `exception.reasonField` must be a required plain text field. A plain text field has `type: "string"` and no `pattern`, `format`, or `enum`. Admission rejects a missing or optional field, the wrong type, or a child that does not belong to the declaring instrument.
110
-
111
- The [diagnostic reference](reference/diagnostics.md) lists every stable refusal code. The [specification](../spec/README.md) carries the normative prose for each law.
112
-
113
- <!-- source: guide/04-fees-and-remainder.md -->
114
-
115
- # Fees and remainder
116
-
117
- Fee rules derive named amounts from a stored base amount. Partitions state how cancellation or reversal divides held money. A remainder clause computes one amount after named deductions and captures it under `amountRef`.
118
-
119
- ```jsonc
120
- {
121
- "remainder": {
122
- "amountRef": "sellerNet",
123
- "from": "fields.amount",
124
- "subtract": ["refs.platformFee"],
125
- },
126
- }
127
- ```
128
-
129
- Computed money has one author. A remainder, signed sum, distribution, quote, or derived amount must not compete with another clause for the same field or ref. A money move consumes the computed value once. The validator rejects missing sources, duplicate outputs, and terminal paths that strand funded value.
130
-
131
- ## Retained charges
132
-
133
- A quote may declare `chargeRetainedBy` with a role (`payer`, `beneficiary`, or `subjectHolder`). The named role keeps the quoted charge instead of moving it through an escrow payout action. The role must be declared under `parties`, its account field must be required and frozen by `fixes`, and the committing refund transfer must source funds directly from that account.
134
-
135
- ```jsonc
136
- {
137
- "quote": {
138
- "baseField": "premiumAmount",
139
- "chargeRef": "unwindPenalty",
140
- "chargeRetainedBy": "beneficiary",
141
- "charges": [{ "bps": 1000 }],
142
- "expires": { "offset": "PT15M" },
143
- "fixes": ["insurerAccountId", "policyholderAccountId", "premiumAmount"],
144
- "netDestinationField": "policyholderAccountId",
145
- "netRef": "policyRefund",
146
- },
147
- }
148
- ```
149
-
150
- The retained remainder stays in the source account and cannot be spent by subsequent instrument actions. Actions cannot consume the charge reference, and no self-transfer is permitted.
151
-
152
- <!-- source: guide/05-checks-updates-dials.md -->
153
-
154
- # Checks, updates, and dials
155
-
156
- `requiresChecks` asks for current evidence from a declared provider family. The row names the check kind, acceptable statuses, subject field, and optional maximum age. Callers cannot replace the evidence with a boolean.
157
-
158
- `update` declares which stored fields an update operation may change. Action-level `updates` assign admitted values. Required creation fields, derived amounts, immutable bindings, and quote-frozen fields remain protected.
159
-
160
- Dials are named policy values with bounds. Clauses refer to a dial by id instead of copying a threshold into several actions. The document therefore exposes one reviewable setting for limits such as reconciliation tolerance.
161
-
162
- <!-- source: guide/06-effects.md -->
163
-
164
- # Effects
165
-
166
- Effects are derived ABI rows. Authors declare clauses such as moves, decisions, schedules, reads, and notifications. The compiler derives the `effects` object from those clauses in vocabulary order.
167
-
168
- Each row records its source and a stable signature. Movement signatures include their cost class. Schedule signatures identify a deadline or due trigger. Read signatures identify the gate family. Notification rows retain channel and role.
169
-
170
- The validator derives the rows again and compares the complete object, including row order. A missing, extra, changed, or reordered row is a refusal. Derived effect subtrees do not count toward the authored node budget, but they still pass JSON, depth, and string limits.
171
-
172
- Cost tooling reads the same movement and hold signatures. Runtime hints may read the effect rows, but they cannot change the clauses that produced them.
173
-
174
- `quote` derives `holds.quote` and `schedules.expiry`. `reconcile` derives one `reads.reconcile` row per expectation. `commit` has no separate effect row. The committing action consumes the held quote through its `moves.*` row, so another consumption row would count the same work twice.
175
-
176
- <!-- source: guide/07-evolution.md -->
177
-
178
- # Evolution
179
-
180
- `diffValidatedUdlEvolution(live, next)` compares two admitted documents. The CLI exposes the same check as `udl diff live.udl next.udl`.
181
-
182
- Once instances exist, a new version may add optional fields, states, transitions, and actions. It may not remove or rename stored structure, tighten an admitted schema, change a money step, or reuse an existing version number for different executable meaning. The diff returns `UDL7xxx` issues with JSON paths.
183
-
184
- A migration is work outside the format. It reads stored instances under their original document, writes data required by a new document, and changes the pinned definition only after that work succeeds. Editing the document does not migrate data.
185
-
186
- Keep old canonical documents with stored instances. A format bump changes the literal `udl` value. A reader must keep explicit decoders for supported older formats rather than silently treating old bytes as the newest grammar.
187
-
188
- Evolution does not invent defaults for executable clause fields. In particular, it does not guess `reconcile.exception.amountField` or `reasonField` for an older snapshot. A candidate must name both fields and pass the current validator before the diff can judge it.
189
-
190
- <!-- source: guide/08-implementing.md -->
191
-
192
- # Implementing UDL
193
-
194
- A second implementation needs three independent checks.
195
-
196
- 1. Validate JSON shape against `spec/udl.schema.json`.
197
- 2. Enforce the whole-document laws and report the matching stable diagnostic code and JSON path.
198
- 3. Serialize admitted documents under the canonical bytes law.
199
-
200
- Run every conformance level. Valid cases must admit and match their canonical bytes and SHA-256 digest. Invalid cases must report every listed code and path. Evolution pairs must produce the listed `UDL7xxx` issues. An implementation may report more issues, but it may not omit a listed issue.
201
-
202
- Do not key behavior on diagnostic messages. Titles, details, and fixes can become clearer. Codes cannot change once published.
203
-
204
- Keep parsing, validation, canonicalization, and evolution comparison separate. That split prevents a diff from judging a candidate that the validator would refuse on its own.
205
-
206
- <!-- source: guide/09-schedules-and-allocation.md -->
207
-
208
- # Schedules, allocation and referenced state
209
-
210
- These clauses describe product laws. An engine must implement their admission semantics before accepting a document that uses them. The pure planners exported by this package calculate from trusted snapshots. They do not authenticate a caller, acquire locks, post money or claim an operation identity.
211
-
212
- ## Fields and dates
213
-
214
- `derivedAmounts` retains its ordered list of computations. `percentage_of.bps` accepts a literal rate or `{field}`. The field must be required, immutable and bounded to integer basis points between 1 and 9999. `minimum` reads `sourceField` and `capField` in one currency. Both operands must be immutable money available at creation, supplied as required fields, derived earlier or bound from a reference. Bind a referenced cap into a local field through `requiresRefs.bind`. Floor rounding still applies. A derived operand must appear before its consumer.
215
-
216
- For a SAR 200 premium, 1000 bps produces SAR 20 and 500 bps produces SAR 10. Costs of SAR 12, 25 and 40 with a stored SAR 25 cap produce SAR 12, 25 and 25.
217
-
218
- `due.offset`, `deadline.offset` and an aggregate's `dueBefore.offset` accept a literal duration or `{field}`. A stored duration must enumerate positive fixed ISO durations. It cannot contain months or a runtime expression. The enclosing record supplies the field: a due-clock aggregate reads each candidate child's date and duration. The engine compares date plus offset to one authoritative admission time, including when the scheduler has not updated the child's status.
219
-
220
- `dateOrder` compares two immutable date fields on one instrument with `<` or `<=`. Distinct `requiresRefs` gates may constrain the same reference. Engines apply all gates as a conjunction, including both interval bounds. Repeating an identical gate remains invalid.
221
-
222
- ## Aggregates and exact schedules
223
-
224
- `requiresAggregate.anchorField` selects the owner's parent reference. Candidate rows have their own `refField` pointing to that same parent. This lets a claim inspect premium slices of its cover without pretending those slices reference the claim. The engine locks the shared parent and the relevant row set. A `dueBefore` predicate applies before the aggregate check. A zero `count_exactly` over unpaid due slices refuses cover immediately at the clock boundary.
225
-
226
- `count_at_least.targetField` is an integer count. `ordered` checks strictly ascending dates in contiguous integer position order starting at 1. `schedule` additionally requires exact membership in the parent's immutable signed date list. No missing, extra or duplicate position is admitted. Every signed date must be strictly later than its predecessor. The engine reads the complete child set and checks statuses without discarding extra rows.
227
-
228
- For every declared schedule amount, each child receives integer division of the parent total by the signed date count. The first position receives the remainder. SAR 48,000 principal and SAR 2,400 profit over six dates therefore produce six SAR 8,000 principal and SAR 400 profit slices. Adding one minor unit to principal adds it to the first slice only. The date list is bounded to 366 entries.
229
-
230
- ## Held partitions and contributions
231
-
232
- A `partitions` declaration is an exact equality, not a spending allowance. Admission verifies numeric equality and immutability. The finance proof can replace one complete funded partition with another partition of the same total on the same held account. Partial funding and already spent pieces do not establish the total. The proof permits one substitution per funded batch, with no active holds or unrelated balance. Draining the account resets that limit.
233
-
234
- `contributions` declares a required immutable list, its positive amount and origin-account keys, and a total money field. The list contains at most 256 entries. `contributionStage` funds every entry into one held account atomically or refunds every entry from that account to its original origin. Origins cannot equal the held account. The sum must equal the declared total. The engine derives operation identity from the instrument, stage and entry index and records the same entries for recovery.
235
-
236
- The SAR 60,000 witness receives SAR 12,000 and SAR 48,000. Its outgoing partition is SAR 59,310 seller net, SAR 600 fee and SAR 90 tax. A refund returns SAR 12,000 and SAR 48,000 to the respective origins. Evidence attachment remains a separate action; do not update financial inputs during a cash action.
237
-
238
- ## Shared allocation and refunds
239
-
240
- An obligation's `allocation` declares its slice instrument, reference and eligible statuses, due date, position, earning-rule field and bucket sources. Principal and profit come from the slice. Cost and fine may come from separately assessed child records of that slice. Bucket array order is payment priority. Engines always walk slices by due date ascending, then declared position. There is no company-supplied sorting option. Multiple assessments of the same bucket use ascending stable assessment identity.
241
-
242
- A children bucket can select a concrete `instrumentId` or declare `template` and `parameters`. A template selector matches every instrument whose `templateBinding.id` equals that template and whose bound parameters include the requested scalar values. HSX retains string, integer and boolean arguments in `templateBinding.parameters` when it instantiates a template. Every matching alias must supply the declared slice reference, statuses, amount and destination fields. An uninstantiated selector contributes no assessments to a catalogue. The composed document validates the matching product instances.
243
-
244
- For `payoff` and `write_off`, omitting `allocate.refField` selects the executing instance. That instance must declare `allocation`. This does not introduce a caller-supplied self reference. Refund may also omit the reference and name its own earlier allocating action. Payment requires an explicit reference.
245
-
246
- An action's `allocate` references this declaration. Payment and payoff resolve amount, source account and payment identity from required immutable fields. Self payoff and assessment payment may instead use required action input keys. An operand must resolve to exactly one source. Self payoff may omit amountField so the planner computes the amount; a supplied amount must equal that figure. Assessment payment may omit amountField so the planner collects the assessment's whole remaining balance; a supplied amount above that balance refuses. The engine claims the identity under the obligation, reads remaining balances from prior allocation records and posts only positive allocations. It commits postings, consumption records, receipt and lifecycle state together. Recovery replays the recorded result. Direct collection and agency recovery must use the same declaration and assessment identities. A new channel or alias must not restore debt already consumed.
247
-
248
- A SAR 4,000 payment against an SAR 8,400 slice consumes principal only. A later SAR 4,400 consumes the remaining SAR 4,000 principal and SAR 400 profit. Cost and fine follow when the authored priority puts them after principal and profit. An overpayment refuses rather than disappearing into an unspecified balance.
249
-
250
- `allocate.mode: refund` names the original allocating action on self or through a typed instrument reference. An assessment record may omit `action` and reference its allocation owner instead: the engine reverses every consumption recorded against that assessment across the receipts that consumed it, its own collection, a repayment, a recovery or a payoff, each amount back to that receipt's payer, once. An optional immutable assessment identity selects one assessment's recorded allocation. The engine reverses those recorded postings to the original payer once. It does not accept new destinations or amounts and does not reopen consumed assessment debt. The refund identity is the original receipt plus assessment identity. A second refund refuses across aliases and lifecycle states.
251
-
252
- ## Earning and noncash cancellation
253
-
254
- The immutable earning-rule field chooses one of two language-defined rules:
255
-
256
- - `per_slice_on_due`: profit earns when its slice becomes due or is paid, whichever comes first.
257
- - `on_disbursement`: all profit earns when the obligation advances.
258
-
259
- The engine proves the advance and supplies trusted paid/consumed facts to the planner. `payoff` collects outstanding principal, earned profit and assessed charges. It cancels unearned future profit without a cash refund. After one SAR 8,400 slice is paid, the six-slice example has SAR 40,000 principal and SAR 2,000 future profit remaining. Under `per_slice_on_due`, payoff collects SAR 40,000 and cancels SAR 2,000. Under `on_disbursement`, payoff collects SAR 42,000.
260
-
261
- `write_off` posts no money. Cancellation rows distinguish principal loss and earned charges from unearned-profit cancellation. No daily accrual rule exists: UDL does not yet define an authoritative day-count convention.
262
-
263
- `remainder.subtractPaths` is a bounded list of immutable money operands subtracted alongside existing collected sums from `totalPath`. Negative results refuse; zero follows `onZero`. It is not unrestricted arithmetic over money.
264
-
265
- ## Referenced state and admission authority
266
-
267
- `transitionsRefs` invokes named noncash lifecycle actions on referenced instruments in the same transaction. The engine applies every target gate, authority check and lifecycle precondition. Cycles, repeated target actions and cash-bearing or input-dependent target actions refuse. A child can lapse its cover; a refund can cancel a referenced funding record and prevent future actions through that record's lifecycle gates. This does not replace durable approval consumption tied to a downstream operation.
268
-
269
- `cascade` executes a named lifecycle action on linked instances of another instrument inside the same transaction before evaluating the parent action's own admission gates. Target instances are identified either through caller input IDs via `inputField` or by matching a parent reference on target rows via `refField` filtered by lifecycle statuses. The cascading action cannot be create and cannot declare a decision. The target action must exist in lifecycle, cannot be create or engine-owned, cannot declare a decision, and cannot declare a cascade of its own. Because the cascade runs before the parent's admission gates, child status transitions take effect in time for parent aggregate requirements.
270
-
271
- `requiresRefs.unique` accepts `{namespace, byFields}`. The uniqueness key contains the Product, namespace, referenced instance identity and immutable key values. It excludes instrument aliases and current status. A waived or refunded fine still occupies its key; cost uses a different kind value. The engine enforces this key under a shared constraint or lock.
272
-
273
- Decision authentication, attestation verification and request hashing are admission concerns. The decision record must carry the requested instrument kind, instance, action, canonical input digest, deciding role and actor, expiry, verdict and evidence references. The engine computes the digest from the admitted request, authenticates the authority, checks expiry and revocation under locks, and binds consumption to the durable operation identity. Submitted actor and operation fields are not proof.
274
-
275
- ## Effects and classification budget
276
-
277
- Canonical JSON preserves every clause and array order. Allocation and referenced transitions add explicit effects. Hosts must price `decides.allocation`, `moves.allocation` and `decides.referenced_transition` before compiling products that use them. Write-off has no movement effect. Contribution transfers use the existing internal-transfer effect signature.
278
-
279
- Reference classification reads the sealed ID pattern text; it never executes an authored regular expression or compiles a JSON Schema validator per candidate prefix. HSX supplies the published prefix when a typed reference omits its pattern. The 131,072 distinct-pair budget is a safety limit, not a catalogue-size target. The memo counts a schema/prefix pair once and fails closed after the limit.
280
-
281
- ## Attested requests
282
-
283
- An action may declare one `requiresRefs` gate with `attests`. The gate must
284
- require a status and match `instrumentInstanceId` to a field on the referenced
285
- record. It cannot be optional. The block declares `action`, `digest`, `role`,
286
- `expiresAt` and `consume`. HSX accepts `expires_at` and emits `expiresAt`.
287
- Action and role paths name text fields, digest names a lowercase SHA-256 field
288
- with pattern `^[a-f0-9]{64}$`, and expiry names a date field.
289
-
290
- Admission compares the stored action to the admitted lifecycle action name.
291
- It computes the stored digest's expected value as
292
- `bindResolvedRequestHash(operationExecutionIdentity({ name, environment, body }))`
293
- for the downstream operation as admitted. The role must belong to the
294
- authenticated deciding principal. A caller-supplied actor or role is not proof.
295
- Admission refuses at or after expiry.
296
-
297
- Stored terms are absent from the request body. An attested action therefore
298
- puts its material terms in required input and declares `requiresInput`, a map
299
- from input key to stored `fields.*` path. Admission checks equality before
300
- updates or money movement. Changing a premium from 240000 to 180000 minor
301
- units changes the request digest and fails the stored-term equality law.
302
-
303
- The `consume` action must be reachable from every admitted status and declare
304
- `engineOwned: true`. It cannot be public, accept input or update caller fields.
305
- `captureEngine: { consumedByOperationId: "operationId" }` declares a ref written
306
- from the admitting operation identity. These keys cannot be fields, input,
307
- caller captures or move captures. The marker controls invocation authority;
308
- the capture map names engine facts and their destination keys.
309
-
310
- Consumption reuses referenced-transition effects and cycle checks. An ordinary
311
- `transitionsRefs` entry cannot invoke an engine-owned action. The engine must
312
- lock the decision and execute its transition inside the admitting transaction,
313
- so a refusal rolls back consumption and one approval cannot authorize two
314
- operations. This ABI declares those obligations; validation is not runtime
315
- proof of their enforcement.
316
-
317
- ## Subject uniqueness
318
-
319
- An action's `unique: { namespace, byFields }` claims one key at creation without a reference gate. Keys contain one to eight distinct required immutable string, account or integer fields. Every use of a namespace must carry the same ordered field names and types. Reference-keyed and subject-keyed claims cannot share a namespace. The engine must claim the key tenant-wide, across instrument aliases, and never release it on closure. Raising a limit updates the existing record. The effect is `decides.subject_unique`, priced at zero without a price-version change.
320
-
321
- ## Allocation exposure
322
-
323
- `requiresExposure.measure: { allocation: "principal" }` selects a bucket on the child instrument. Its gross operand is the parent money field named by an exact `requiresAggregate.check.kind: "schedule"` mapping to that bucket's slice amount field. The relation must use the allocation's slice instrument and reference. A bucket sourced from other children has no such mapping and cannot be measured by this clause.
324
-
325
- For qualifying children, the engine sums `amountField` and subtracts consumed amounts of the selected bucket over those same children. Payment, payoff and write-off share that consumption record. Refunds must be reflected by that record. The admitted instance contributes its full `amountField`. Omitting `measure` preserves the existing gross sum.
326
-
327
- ## Recorded decider
328
-
329
- `attests.instrument` is a required text-field path on the referenced decision. Admission compares that stored value with the admitted instrument's id. Required `attests.party` names a declared party on the referenced decision. Admission compares the recorded deciding account with that party's bound account.
330
-
331
- A decision action declares `port.capture` as the name of an optional account field on its own instrument. The engine writes the admitted actor account there after checking `allowedParties`. Callers cannot populate it through `captureInput`, action input, step captures or updates. It cannot be required at creation. This records the tenant backend's assertion of the actor account; it does not independently authenticate that account.
332
-
333
- ## Slice consumption and assessment collection
334
-
335
- `requiresAllocation: { refField, slice: "self", buckets, check }` reads the referenced obligation's shared consumption for the executing slice. `settled` requires every listed bucket to equal its gross amount. `outstanding` requires at least one bucket below gross. The reference is required and immutable, and the owner must allocate over this slice instrument or its template alias.
336
-
337
- Payment on an assessment may declare `assessment: "self"`. Admission matches the executing record to exactly one children bucket, then restricts payment to that record's remaining balance. An amount above that balance refuses. Refund without `action` reverses the assessment's consumption across every receipt that consumed it, once, and never reopens its consumed debt.
338
-
339
- An anchor exposure cap may be updatable only when its anchor update clause names the cap field and the exposure declares `measure`. Other exposure caps remain immutable.
340
-
341
- <!-- source: reference/canonical.md -->
342
-
343
- # Canonical bytes
344
-
345
- An admitted UDL document has one canonical byte sequence.
346
-
347
- - Encode JSON as UTF-8 without a byte-order mark.
348
- - Sort every object's keys by ascending UTF-16 code unit. Compare code units, not locale order or Unicode collation order.
349
- - Preserve array order exactly as authored. Never sort an array.
350
- - Indent nested values with two ASCII spaces. Write one ASCII space after each colon.
351
- - Write empty objects as `{}` and empty arrays as `[]`.
352
- - Serialize JSON numbers with JavaScript `JSON.stringify` semantics. An admitted integer uses base-10 digits with an optional leading minus and no leading zeros. Negative zero serializes as `0`. UDL money is not a JSON number. It is a base-10 integer minor-unit string paired with a currency code.
353
- - Apply ECMAScript well-formed `JSON.stringify` string escaping. Escape U+0000 through U+001F. Escape every lone surrogate as `\uXXXX`. Write every other code point literally, including U+007F and U+2028.
354
- - End the document with exactly one line feed byte, `0A`. Write no other trailing whitespace.
355
-
356
- `serializeUdl(document)` validates and writes these bytes. `canonicalizeUdl(input)` parses, validates, and writes them. Canonicalizing canonical bytes returns the same bytes.
357
-
358
- `canonicalDigest(document)` computes SHA-256 over the canonical UTF-8 bytes and returns a promise for the lowercase hexadecimal digest. `udl canon file.udl --digest` prints that digest. It does not hash the source bytes before canonicalization.
359
-
360
- <!-- source: reference/clauses.md -->
361
-
362
- # Clause reference
363
-
364
- This page lists every entry in `udlClauseVocabulary`. The examples are copied from admitted documents under `conformance/valid`.
365
-
366
- ## funding
367
-
368
- - Scope: action
369
- - UDL target: `funding`
370
- - Cardinality: one
371
- - Linear outputs: none
372
- - Effects: moves.transfer.internal per clause
373
- - Law: Requirements-as-data law and closure law
374
- - Conformance source: `vocabulary.udl`
375
-
376
- ```json
377
- {
378
- "capture": "snapshot",
379
- "collectAction": "collect",
380
- "destinationAccountField": "fundingAccount",
381
- "obligationField": "obligationId",
382
- "principalField": "principal",
383
- "sourceAccountPath": "refs.escrow",
384
- "terms": {
385
- "currency": "currency",
386
- "principal": "principal"
387
- },
388
- "ticketAccountField": "wallet",
389
- "ticketAmountField": "amount",
390
- "ticketInstrumentId": "ticket",
391
- "ticketInvestorField": "investor",
392
- "ticketRefField": "roundId",
393
- "ticketStatus": "open"
394
- }
395
- ```
396
-
397
- ## receipt distribution
398
-
399
- - Scope: action
400
- - UDL target: `receiptDistribution`
401
- - Cardinality: one
402
- - Linear outputs: none
403
- - Effects: decides.allocation per clause; moves.allocation per clause
404
- - Law: Requirements-as-data law and closure law
405
- - Conformance source: `vocabulary.udl`
406
-
407
- ```json
408
- {
409
- "capture": "receipt",
410
- "feeAccountField": "fee",
411
- "feeBps": 100,
412
- "mode": "cash",
413
- "receiptField": "receiptId",
414
- "receiptPath": "refs.allocationReceipt",
415
- "residualAccountField": "residual",
416
- "roundField": "roundId",
417
- "snapshotRef": "snapshot",
418
- "taxAccountField": "tax",
419
- "vatBps": 1500
420
- }
421
- ```
422
-
423
- ## requires allocation
424
-
425
- - Scope: action
426
- - UDL target: `requiresAllocation`
427
- - Cardinality: one
428
- - Linear outputs: none
429
- - Effects: decides.allocation per clause
430
- - Law: Requirements-as-data law and closure law
431
- - Conformance source: `vocabulary.udl`
432
-
433
- ```json
434
- {
435
- "buckets": [
436
- "principal",
437
- "profit"
438
- ],
439
- "check": "settled",
440
- "refField": "coverId",
441
- "slice": "self"
442
- }
443
- ```
444
-
445
- ## allocation
446
-
447
- - Scope: instrument
448
- - UDL target: `allocation`
449
- - Cardinality: one
450
- - Linear outputs: none
451
- - Effects: none
452
- - Law: Requirements-as-data law and closure law
453
- - Conformance source: `vocabulary.udl`
454
-
455
- ```json
456
- {
457
- "buckets": [
458
- {
459
- "key": "principal",
460
- "source": {
461
- "amountField": "principal",
462
- "destinationField": "receiver",
463
- "from": "slice"
464
- }
465
- },
466
- {
467
- "key": "profit",
468
- "source": {
469
- "amountField": "profit",
470
- "destinationField": "receiver",
471
- "from": "slice"
472
- }
473
- },
474
- {
475
- "key": "cost",
476
- "source": {
477
- "amountField": "amount",
478
- "destinationField": "receiver",
479
- "from": "children",
480
- "parameters": {
481
- "cost": true
482
- },
483
- "refField": "sliceId",
484
- "statuses": [
485
- "open"
486
- ],
487
- "template": "assessment"
488
- }
489
- }
490
- ],
491
- "dueField": "dueAt",
492
- "earningRuleField": "earningRule",
493
- "positionField": "position",
494
- "sliceInstrumentId": "slice",
495
- "sliceRefField": "coverId",
496
- "sliceStatuses": [
497
- "open"
498
- ]
499
- }
500
- ```
501
-
502
- ## contributions
503
-
504
- - Scope: instrument
505
- - UDL target: `contributions`
506
- - Cardinality: one
507
- - Linear outputs: none
508
- - Effects: none
509
- - Law: Requirements-as-data law and closure law
510
- - Conformance source: `vocabulary.udl`
511
-
512
- ```json
513
- {
514
- "accountKey": "origin",
515
- "amountKey": "amount",
516
- "field": "contributions",
517
- "totalField": "price"
518
- }
519
- ```
520
-
521
- ## allocate
522
-
523
- - Scope: action
524
- - UDL target: `allocate`
525
- - Cardinality: one
526
- - Linear outputs: none
527
- - Effects: decides.allocation per clause; moves.allocation per clause
528
- - Law: Requirements-as-data law and closure law
529
- - Conformance source: `vocabulary.udl`
530
-
531
- ```json
532
- {
533
- "capture": "payoffReceipt",
534
- "mode": "payoff",
535
- "paymentIdentityField": "paymentIdentity",
536
- "sourceAccountField": "payerAccount"
537
- }
538
- ```
539
-
540
- ## contribution stage
541
-
542
- - Scope: action
543
- - UDL target: `contributionStage`
544
- - Cardinality: one
545
- - Linear outputs: none
546
- - Effects: moves.transfer.internal per clause
547
- - Law: Requirements-as-data law and closure law
548
- - Conformance source: `vocabulary.udl`
549
-
550
- ```json
551
- {
552
- "accountPath": "refs.hold",
553
- "stage": "fund"
554
- }
555
- ```
556
-
557
- ## date order
558
-
559
- - Scope: instrument
560
- - UDL target: `dateOrder`
561
- - Cardinality: many
562
- - Linear outputs: none
563
- - Effects: none
564
- - Law: Requirements-as-data law and closure law
565
- - Conformance source: `vocabulary.udl`
566
-
567
- ```json
568
- [
569
- {
570
- "afterField": "end",
571
- "beforeField": "start",
572
- "operator": "<"
573
- }
574
- ]
575
- ```
576
-
577
- ## unique
578
-
579
- - Scope: action
580
- - UDL target: `unique`
581
- - Cardinality: one
582
- - Linear outputs: none
583
- - Effects: decides.subject_unique per clause
584
- - Law: Requirements-as-data law and closure law
585
- - Conformance source: `vocabulary.udl`
586
-
587
- ```json
588
- {
589
- "byFields": [
590
- "borrower",
591
- "currency"
592
- ],
593
- "namespace": "borrower_limit"
594
- }
595
- ```
596
-
597
- ## transitions refs
598
-
599
- - Scope: action
600
- - UDL target: `transitionsRefs`
601
- - Cardinality: many
602
- - Linear outputs: none
603
- - Effects: decides.referenced_transition per element
604
- - Law: Requirements-as-data law and closure law
605
- - Conformance source: `vocabulary.udl`
606
-
607
- ```json
608
- [
609
- {
610
- "action": "close",
611
- "field": "coverId"
612
- }
613
- ]
614
- ```
615
-
616
- ## cascade
617
-
618
- - Scope: action
619
- - UDL target: `cascade`
620
- - Cardinality: many
621
- - Linear outputs: none
622
- - Effects: decides.cascade_transition per element
623
- - Law: Requirements-as-data law and closure law
624
- - Conformance source: `vocabulary.udl`
625
-
626
- A cascade target action that declares a `port` is allowed only when the parent action declares a `port`: the engine forwards the port actor.
627
-
628
- ```json
629
- [
630
- {
631
- "action": "close",
632
- "inputField": "sliceIds",
633
- "instrumentId": "slice"
634
- }
635
- ]
636
- ```
637
-
638
- ## action library
639
-
640
- - Scope: instrument
641
- - UDL target: `actionLibrary`
642
- - Cardinality: one
643
- - Linear outputs: none
644
- - Effects: none
645
- - Law: Requirements-as-data law and closure law
646
- - Conformance source: `piece-plan-calls.udl`
647
-
648
- ```json
649
- {
650
- "transfers": {
651
- "actionOrder": [
652
- "execute_fund",
653
- "execute_release"
654
- ],
655
- "actions": {
656
- "execute_fund": {
657
- "approval": "inherit",
658
- "calls": [],
659
- "leaves": [
660
- {
661
- "bind": {
662
- "amount": "$p.amount",
663
- "destinationAccountId": "$p.release_to",
664
- "sourceAccountId": "$inst.fields.buyerAccount"
665
- },
666
- "effects": [
667
- {
668
- "kind": "moves",
669
- "signature": "moves.transfer.internal"
670
- }
671
- ],
672
- "evidence": "bank transfer confirmation receipt",
673
- "id": "leaf_fund",
674
- "operation": "internal_transfer.create"
675
- }
676
- ],
677
- "order": [
678
- "leaf_fund"
679
- ],
680
- "parameters": {
681
- "inst": {
682
- "kind": "instance"
683
- },
684
- "p": {
685
- "kind": "piece"
686
- }
687
- },
688
- "principal": "api_key",
689
- "recovery": "local"
690
- },
691
- "execute_release": {
692
- "approval": "inherit",
693
- "calls": [],
694
- "leaves": [
695
- {
696
- "bind": {
697
- "amount": "$p.amount",
698
- "destinationAccountId": "$p.release_to",
699
- "sourceAccountId": "$inst.fields.escrowAccount"
700
- },
701
- "effects": [
702
- {
703
- "kind": "moves",
704
- "signature": "moves.transfer.internal"
705
- }
706
- ],
707
- "evidence": "release to payee confirmation",
708
- "id": "leaf_rel",
709
- "operation": "internal_transfer.create"
710
- }
711
- ],
712
- "order": [
713
- "leaf_rel"
714
- ],
715
- "parameters": {
716
- "inst": {
717
- "kind": "instance"
718
- },
719
- "p": {
720
- "kind": "piece"
721
- }
722
- },
723
- "principal": "api_key",
724
- "recovery": "local"
725
- }
726
- }
727
- }
728
- }
729
- ```
730
-
731
- ## agent description
732
-
733
- - Scope: action
734
- - UDL target: `agentDescription`
735
- - Cardinality: one
736
- - Linear outputs: none
737
- - Effects: none
738
- - Law: Requirements-as-data law and closure law
739
- - Conformance source: `agent-description.udl`
740
-
741
- ```json
742
- "Close a note that has already been filed. Takes the note id and nothing else, and moves no money."
743
- ```
744
-
745
- ## calls
746
-
747
- - Scope: action
748
- - UDL target: `calls`
749
- - Cardinality: many
750
- - Linear outputs: none
751
- - Effects: none
752
- - Law: Requirements-as-data law and closure law
753
- - Conformance source: `piece-plan-calls.udl`
754
-
755
- ```json
756
- [
757
- {
758
- "action": "transfers.execute_fund",
759
- "bind": {
760
- "inst": "$instance",
761
- "p": "$piece"
762
- },
763
- "id": "call_fund"
764
- }
765
- ]
766
- ```
767
-
768
- ## requires input
769
-
770
- - Scope: action
771
- - UDL target: `requiresInput`
772
- - Cardinality: one
773
- - Linear outputs: none
774
- - Effects: none
775
- - Law: Requirements-as-data law and closure law
776
- - Conformance source: `attested.udl`
777
-
778
- ```json
779
- {
780
- "amount": "fields.amount"
781
- }
782
- ```
783
-
784
- ## engine owned
785
-
786
- - Scope: action
787
- - UDL target: `engineOwned`
788
- - Cardinality: one
789
- - Linear outputs: none
790
- - Effects: none
791
- - Law: Requirements-as-data law and closure law
792
- - Conformance source: `attested.udl`
793
-
794
- ```json
795
- true
796
- ```
797
-
798
- ## capture engine
799
-
800
- - Scope: action
801
- - UDL target: `captureEngine`
802
- - Cardinality: one
803
- - Linear outputs: none
804
- - Effects: none
805
- - Law: Requirements-as-data law and closure law
806
- - Conformance source: `attested.udl`
807
-
808
- ```json
809
- {
810
- "consumedByOperationId": "operationId"
811
- }
812
- ```
813
-
814
- ## capture input
815
-
816
- - Scope: action
817
- - UDL target: `captureInput`
818
- - Cardinality: one
819
- - Linear outputs: none
820
- - Effects: none
821
- - Law: Requirements-as-data law and closure law
822
- - Conformance source: `compiled-crowdfunding.udl`
823
-
824
- ```json
825
- {
826
- "snapshotEvidenceReference": "evidenceReference"
827
- }
828
- ```
829
-
830
- ## commit
831
-
832
- - Scope: action
833
- - UDL target: `commit`
834
- - Cardinality: one
835
- - Linear outputs: none
836
- - Effects: none
837
- - Law: Requirements-as-data law and closure law
838
- - Conformance source: `commerce-escrow.udl`
839
-
840
- A commit has no separate effect row. The committing action consumes the quote through its `moves.*` row.
841
-
842
- ```json
843
- "quote"
844
- ```
845
-
846
- ## quote
847
-
848
- - Scope: action
849
- - UDL target: `quote`
850
- - Cardinality: one
851
- - Linear outputs: `netRef`
852
- - Effects: holds.quote per clause; schedules.expiry per clause
853
- - Law: Requirements-as-data law and closure law
854
- - Conformance source: `commerce-escrow.udl`
855
-
856
- ```json
857
- {
858
- "baseField": "amount",
859
- "chargeRef": "unwindPenalty",
860
- "charges": [
861
- {
862
- "bps": 0
863
- }
864
- ],
865
- "expires": {
866
- "offset": "PT15M"
867
- },
868
- "fixes": [
869
- "amount",
870
- "buyerAccountId"
871
- ],
872
- "netDestinationField": "buyerAccountId",
873
- "netRef": "unwindRefund"
874
- }
875
- ```
876
-
877
- ## decided amount
878
-
879
- - Scope: action
880
- - UDL target: `decidedAmount`
881
- - Cardinality: one
882
- - Linear outputs: `field`
883
- - Effects: none
884
- - Law: Requirements-as-data law and closure law
885
- - Conformance source: `compiled-watch-club.udl`
886
-
887
- ```json
888
- {
889
- "boundField": "depositAmount",
890
- "field": "damageAmount",
891
- "remainderAction": "return_deposit"
892
- }
893
- ```
894
-
895
- ## deadline
896
-
897
- - Scope: action
898
- - UDL target: `deadline`
899
- - Cardinality: one
900
- - Linear outputs: none
901
- - Effects: schedules.deadline per clause
902
- - Law: Time law and closure law
903
- - Conformance source: `compiled-watch-club.udl`
904
-
905
- ```json
906
- {
907
- "field": "clawbackAt"
908
- }
909
- ```
910
-
911
- ## decision
912
-
913
- - Scope: action
914
- - UDL target: `decision`
915
- - Cardinality: one
916
- - Linear outputs: none
917
- - Effects: decides.value from capability per clause
918
- - Law: Requirements-as-data law and closure law
919
- - Conformance source: `cards.udl`
920
-
921
- ```json
922
- {
923
- "capability": "banking_or_card_issuing",
924
- "deadlineMs": 1500,
925
- "onTimeout": "decline"
926
- }
927
- ```
928
-
929
- ## computes distribute
930
-
931
- - Scope: action
932
- - UDL target: `distribute`
933
- - Cardinality: one
934
- - Linear outputs: `amountRef`
935
- - Effects: none
936
- - Law: Requirements-as-data law and closure law
937
- - Conformance source: `compiled-crowdfunding.udl`
938
-
939
- ```json
940
- {
941
- "amountRef": "payoutShare",
942
- "onZero": "skip_steps",
943
- "pool": {
944
- "from": "parent",
945
- "path": "fields.distributableAmount"
946
- },
947
- "refField": "repaymentDistributionId",
948
- "statuses": [
949
- "recorded",
950
- "paid"
951
- ],
952
- "weightField": "committedWeight"
953
- }
954
- ```
955
-
956
- ## description
957
-
958
- - Scope: action
959
- - UDL target: `description`
960
- - Cardinality: one
961
- - Linear outputs: none
962
- - Effects: none
963
- - Law: One-sentence law, uniform object law, and naming law
964
- - Conformance source: `cards.udl`
965
-
966
- ```json
967
- "Approves the customer to hold and use cards."
968
- ```
969
-
970
- ## due
971
-
972
- - Scope: action
973
- - UDL target: `due`
974
- - Cardinality: one
975
- - Linear outputs: none
976
- - Effects: schedules.due per clause
977
- - Law: Time law and closure law
978
- - Conformance source: `cards.udl`
979
-
980
- ```json
981
- {
982
- "field": "expiresAt"
983
- }
984
- ```
985
-
986
- ## earnable
987
-
988
- - Scope: action
989
- - UDL target: `earnable`
990
- - Cardinality: one
991
- - Linear outputs: none
992
- - Effects: none
993
- - Law: Requirements-as-data law and closure law
994
- - Conformance source: `cards.udl`
995
-
996
- ```json
997
- true
998
- ```
999
-
1000
- ## event name
1001
-
1002
- - Scope: action
1003
- - UDL target: `eventName`
1004
- - Cardinality: one
1005
- - Linear outputs: none
1006
- - Effects: none
1007
- - Law: Event law and naming law
1008
- - Conformance source: `cards.udl`
1009
-
1010
- ```json
1011
- "card.issued"
1012
- ```
1013
-
1014
- ## examples
1015
-
1016
- - Scope: action
1017
- - UDL target: `examples`
1018
- - Cardinality: many
1019
- - Linear outputs: none
1020
- - Effects: none
1021
- - Law: Requirements-as-data law and closure law
1022
- - Conformance source: `cards.udl`
1023
-
1024
- ```json
1025
- [
1026
- {
1027
- "input": {
1028
- "cardholderId": "chd_sandbox_customer0001",
1029
- "tenantId": "ten_sandbox_cards000001"
1030
- },
1031
- "name": "activate_approved_cardholder"
1032
- }
1033
- ]
1034
- ```
1035
-
1036
- ## input
1037
-
1038
- - Scope: action
1039
- - UDL target: `input`
1040
- - Cardinality: one
1041
- - Linear outputs: none
1042
- - Effects: none
1043
- - Law: Requirements-as-data law and closure law
1044
- - Conformance source: `attested.udl`
1045
-
1046
- ```json
1047
- {
1048
- "additionalProperties": false,
1049
- "properties": {
1050
- "amount": {
1051
- "pattern": "^[1-9][0-9]{0,17}$",
1052
- "type": "string",
1053
- "x-hyperscale-currency": "SAR"
1054
- }
1055
- },
1056
- "required": [
1057
- "amount"
1058
- ],
1059
- "type": "object"
1060
- }
1061
- ```
1062
-
1063
- ## moves
1064
-
1065
- - Scope: action
1066
- - UDL target: `moves`
1067
- - Cardinality: many
1068
- - Linear outputs: none
1069
- - Effects: moves.movement class per element; holds.reserve per element
1070
- - Law: One-spine law and closure law
1071
- - Conformance source: `agent-description.udl`
1072
-
1073
- ```json
1074
- []
1075
- ```
1076
-
1077
- ## payout
1078
-
1079
- - Scope: action
1080
- - UDL target: `payout`
1081
- - Cardinality: one
1082
- - Linear outputs: none
1083
- - Effects: moves.payout.external per clause
1084
- - Law: One-spine law and closure law
1085
- - Conformance source: `compiled-watch-club.udl`
1086
-
1087
- ```json
1088
- {
1089
- "amount": "refs.netPayable",
1090
- "beneficiaryField": "payoutBeneficiaryId",
1091
- "beneficiaryPartyField": "payoutDestinationAccountId",
1092
- "capture": "payoutId",
1093
- "currencyField": "currency",
1094
- "sourceAccountField": "clubAccountId",
1095
- "speed": "standard"
1096
- }
1097
- ```
1098
-
1099
- ## piece plan
1100
-
1101
- - Scope: instrument
1102
- - UDL target: `piecePlan`
1103
- - Cardinality: one
1104
- - Linear outputs: none
1105
- - Effects: none
1106
- - Law: Requirements-as-data law and closure law
1107
- - Conformance source: `piece-plan-calls.udl`
1108
-
1109
- ```json
1110
- {
1111
- "fund_order": [
1112
- "p1",
1113
- "p2"
1114
- ],
1115
- "id": "split_plan",
1116
- "pieces": [
1117
- {
1118
- "amount": "p1Amount",
1119
- "id": "p1",
1120
- "refund_to": "p1Refund",
1121
- "release_to": "p1Release"
1122
- },
1123
- {
1124
- "amount": "p2Amount",
1125
- "id": "p2",
1126
- "refund_to": "p2Refund",
1127
- "release_to": "p2Release"
1128
- }
1129
- ],
1130
- "refund_order": [
1131
- "p1"
1132
- ],
1133
- "release_order": [
1134
- "p1",
1135
- "p2"
1136
- ],
1137
- "total": "totalAmount",
1138
- "unfund_order": [
1139
- "p2",
1140
- "p1"
1141
- ]
1142
- }
1143
- ```
1144
-
1145
- ## piece stage
1146
-
1147
- - Scope: action
1148
- - UDL target: `pieceStage`
1149
- - Cardinality: one
1150
- - Linear outputs: none
1151
- - Effects: none
1152
- - Law: Requirements-as-data law and closure law
1153
- - Conformance source: `piece-plan-calls.udl`
1154
-
1155
- ```json
1156
- {
1157
- "plan": "split_plan",
1158
- "stage": "fund"
1159
- }
1160
- ```
1161
-
1162
- ## port
1163
-
1164
- - Scope: action
1165
- - UDL target: `port`
1166
- - Cardinality: one
1167
- - Linear outputs: none
1168
- - Effects: decides.tenant_port per clause
1169
- - Law: Requirements-as-data law and closure law
1170
- - Conformance source: `attested.udl`
1171
-
1172
- ```json
1173
- {
1174
- "allowedParties": [
1175
- "decider"
1176
- ],
1177
- "capture": "decidedBy"
1178
- }
1179
- ```
1180
-
1181
- ## principal
1182
-
1183
- - Scope: action
1184
- - UDL target: `principal`
1185
- - Cardinality: one
1186
- - Linear outputs: none
1187
- - Effects: none
1188
- - Law: Requirements-as-data law and closure law
1189
- - Conformance source: `complete-contract.udl`
1190
-
1191
- ```json
1192
- "user_session"
1193
- ```
1194
-
1195
- ## public action
1196
-
1197
- - Scope: action
1198
- - UDL target: `publicAction`
1199
- - Cardinality: one
1200
- - Linear outputs: none
1201
- - Effects: none
1202
- - Law: Event law and naming law
1203
- - Conformance source: `compiled-crowdfunding.udl`
1204
-
1205
- ```json
1206
- "abandonLenderCommitment"
1207
- ```
1208
-
1209
- ## reconcile
1210
-
1211
- - Scope: action
1212
- - UDL target: `reconcile`
1213
- - Cardinality: many
1214
- - Linear outputs: none
1215
- - Effects: reads.reconcile per element
1216
- - Law: Requirements-as-data law and closure law
1217
- - Conformance source: `compiled-watch-club.udl`
1218
-
1219
- `exception.amountField` must name a required money field on the exception child. `exception.reasonField` must name a required text field on that child. UDL evolution supplies no default for either name.
1220
-
1221
- ```json
1222
- [
1223
- {
1224
- "amount": "refs.netPayable",
1225
- "capture": "settlementEvidenceId",
1226
- "counterpartyRef": "payoutId",
1227
- "currencyField": "currency",
1228
- "direction": "debit",
1229
- "evidence": "statement_line",
1230
- "exception": {
1231
- "amountField": "amount",
1232
- "childInstrumentId": "seller_payout_debit_adjustment",
1233
- "maxOpen": 1,
1234
- "reasonField": "adjustmentReference",
1235
- "refField": "sellerPayoutId"
1236
- },
1237
- "match": {
1238
- "law": "exact"
1239
- },
1240
- "within": {
1241
- "offset": "P30D"
1242
- }
1243
- }
1244
- ]
1245
- ```
1246
-
1247
- ## computes remainder
1248
-
1249
- - Scope: action
1250
- - UDL target: `remainder`
1251
- - Cardinality: one
1252
- - Linear outputs: `amountRef`
1253
- - Effects: none
1254
- - Law: Requirements-as-data law and closure law
1255
- - Conformance source: `complete-contract.udl`
1256
-
1257
- ```json
1258
- {
1259
- "amountRef": "remainingAmount",
1260
- "onZero": "refuse",
1261
- "totalPath": "fields.amount"
1262
- }
1263
- ```
1264
-
1265
- ## requires aggregate
1266
-
1267
- - Scope: action
1268
- - UDL target: `requiresAggregate`
1269
- - Cardinality: many
1270
- - Linear outputs: none
1271
- - Effects: reads.requires_aggregate per clause
1272
- - Law: Requirements-as-data law and closure law
1273
- - Conformance source: `compiled-crowdfunding.udl`
1274
-
1275
- ```json
1276
- [
1277
- {
1278
- "check": {
1279
- "amountField": "amount",
1280
- "kind": "sum_exactly",
1281
- "targetField": "installment1Amount"
1282
- },
1283
- "instrumentId": "borrower_loan_installment_1_payment",
1284
- "over": "children",
1285
- "refField": "borrowerLoanId",
1286
- "statuses": [
1287
- "paid"
1288
- ]
1289
- }
1290
- ]
1291
- ```
1292
-
1293
- ## requires checks
1294
-
1295
- - Scope: action
1296
- - UDL target: `requiresChecks`
1297
- - Cardinality: many
1298
- - Linear outputs: none
1299
- - Effects: reads.requires_checks per clause
1300
- - Law: Requirements-as-data law and closure law
1301
- - Conformance source: `complete-contract.udl`
1302
-
1303
- ```json
1304
- [
1305
- {
1306
- "checkKind": "identity_verification",
1307
- "family": "national_identity",
1308
- "maxAge": "P30D",
1309
- "statuses": [
1310
- "completed"
1311
- ],
1312
- "subjectField": "subjectId"
1313
- }
1314
- ]
1315
- ```
1316
-
1317
- ## requires drained
1318
-
1319
- - Scope: action
1320
- - UDL target: `requiresDrainedAccount`
1321
- - Cardinality: one
1322
- - Linear outputs: none
1323
- - Effects: none
1324
- - Law: Requirements-as-data law and closure law
1325
- - Conformance source: `commerce-escrow.udl`
1326
-
1327
- ```json
1328
- {
1329
- "path": "refs.escrowAccountId"
1330
- }
1331
- ```
1332
-
1333
- ## requires exposure
1334
-
1335
- - Scope: action
1336
- - UDL target: `requiresExposure`
1337
- - Cardinality: many
1338
- - Linear outputs: none
1339
- - Effects: none
1340
- - Law: Requirements-as-data law and closure law
1341
- - Conformance source: `compiled-crowdfunding.udl`
1342
-
1343
- ```json
1344
- [
1345
- {
1346
- "amountField": "amount",
1347
- "anchorField": "borrowerLoanId",
1348
- "capField": "installment1Amount",
1349
- "capOnAnchor": true,
1350
- "childInstrumentId": "borrower_loan_installment_1_payment",
1351
- "statuses": [
1352
- "paid"
1353
- ]
1354
- }
1355
- ]
1356
- ```
1357
-
1358
- ## requires refs
1359
-
1360
- - Scope: action
1361
- - UDL target: `requiresRefs`
1362
- - Cardinality: many
1363
- - Linear outputs: none
1364
- - Effects: reads.requires_refs per clause
1365
- - Law: Requirements-as-data law and closure law
1366
- - Conformance source: `attested.udl`
1367
-
1368
- ```json
1369
- [
1370
- {
1371
- "attests": {
1372
- "action": "fields.actionName",
1373
- "consume": "consume",
1374
- "digest": "fields.digest",
1375
- "expiresAt": "fields.expiry",
1376
- "instrument": "fields.requestInstrument",
1377
- "party": "decider",
1378
- "role": "fields.role"
1379
- },
1380
- "field": "approvalId",
1381
- "match": {
1382
- "instrumentInstanceId": "fields.requestId"
1383
- },
1384
- "statuses": [
1385
- "approved"
1386
- ]
1387
- }
1388
- ]
1389
- ```
1390
-
1391
- ## sandbox failure point
1392
-
1393
- - Scope: action
1394
- - UDL target: `sandboxFailurePoint`
1395
- - Cardinality: one
1396
- - Linear outputs: none
1397
- - Effects: none
1398
- - Law: Requirements-as-data law and closure law
1399
- - Conformance source: `commerce-escrow.udl`
1400
-
1401
- ```json
1402
- "funding"
1403
- ```
1404
-
1405
- ## sets at
1406
-
1407
- - Scope: action
1408
- - UDL target: `setsAt`
1409
- - Cardinality: one
1410
- - Linear outputs: none
1411
- - Effects: none
1412
- - Law: Time law and closure law
1413
- - Conformance source: `compiled-crowdfunding.udl`
1414
-
1415
- ```json
1416
- {
1417
- "field": "installment1DelinquentAfter",
1418
- "marker": true,
1419
- "offset": "PT1S"
1420
- }
1421
- ```
1422
-
1423
- ## computes signed_sum
1424
-
1425
- - Scope: action
1426
- - UDL target: `signedSum`
1427
- - Cardinality: one
1428
- - Linear outputs: `amountRef`
1429
- - Effects: none
1430
- - Law: Requirements-as-data law and closure law
1431
- - Conformance source: `compiled-watch-club.udl`
1432
-
1433
- ```json
1434
- {
1435
- "amountRef": "netPayable",
1436
- "onNegative": "refuse",
1437
- "onZero": "refuse",
1438
- "sources": [
1439
- {
1440
- "amountField": "amount",
1441
- "instrumentId": "seller_payout_capture_entry",
1442
- "refField": "sellerPayoutId",
1443
- "sign": "add",
1444
- "statuses": [
1445
- "accrued"
1446
- ],
1447
- "subtotalRef": "grossCaptureAmount"
1448
- },
1449
- {
1450
- "amountField": "amount",
1451
- "instrumentId": "seller_payout_credit_adjustment",
1452
- "refField": "sellerPayoutId",
1453
- "sign": "add",
1454
- "statuses": [
1455
- "applied"
1456
- ],
1457
- "subtotalRef": "creditAdjustmentAmount"
1458
- },
1459
- {
1460
- "amountField": "amount",
1461
- "instrumentId": "seller_payout_debit_adjustment",
1462
- "refField": "sellerPayoutId",
1463
- "sign": "subtract",
1464
- "statuses": [
1465
- "applied"
1466
- ],
1467
- "subtotalRef": "debitAdjustmentAmount"
1468
- }
1469
- ]
1470
- }
1471
- ```
1472
-
1473
- ## steps
1474
-
1475
- - Scope: action
1476
- - UDL target: `steps`
1477
- - Cardinality: many
1478
- - Linear outputs: none
1479
- - Effects: none
1480
- - Law: One-spine law and closure law
1481
- - Conformance source: `agent-description.udl`
1482
-
1483
- ```json
1484
- []
1485
- ```
1486
-
1487
- ## summary
1488
-
1489
- - Scope: action
1490
- - UDL target: `summary`
1491
- - Cardinality: one
1492
- - Linear outputs: none
1493
- - Effects: none
1494
- - Law: One-sentence law, uniform object law, and naming law
1495
- - Conformance source: `agent-description.udl`
1496
-
1497
- ```json
1498
- "Close the note."
1499
- ```
1500
-
1501
- ## updates
1502
-
1503
- - Scope: action
1504
- - UDL target: `updates`
1505
- - Cardinality: many
1506
- - Linear outputs: none
1507
- - Effects: none
1508
- - Law: Requirements-as-data law and closure law
1509
- - Conformance source: `commerce-escrow.udl`
1510
-
1511
- ```json
1512
- [
1513
- "escrowOrderId"
1514
- ]
1515
- ```
1516
-
1517
- ## notify
1518
-
1519
- - Scope: action
1520
- - UDL target: `effects.notifies`
1521
- - Cardinality: many
1522
- - Linear outputs: none
1523
- - Effects: notifies.value from channel per element
1524
- - Law: Requirements-as-data law and closure law
1525
- - Conformance source: `effect-signatures.udl`
1526
-
1527
- ```json
1528
- [
1529
- {
1530
- "channel": "email",
1531
- "role": "beneficiary",
1532
- "signature": "notifies.email",
1533
- "source": "effects.notifies[0]"
1534
- }
1535
- ]
1536
- ```
1537
-
1538
- ## agent description
1539
-
1540
- - Scope: instrument
1541
- - UDL target: `agentDescription`
1542
- - Cardinality: one
1543
- - Linear outputs: none
1544
- - Effects: none
1545
- - Law: Requirements-as-data law and closure law
1546
- - Conformance source: `agent-description.udl`
1547
-
1548
- ```json
1549
- "Close a note that has already been filed. Takes the note id and nothing else, and moves no money."
1550
- ```
1551
-
1552
- ## aggregate invariants
1553
-
1554
- - Scope: instrument
1555
- - UDL target: `aggregateInvariants`
1556
- - Cardinality: many
1557
- - Linear outputs: none
1558
- - Effects: none
1559
- - Law: Closure law
1560
- - Conformance source: `compiled-crowdfunding.udl`
1561
-
1562
- ```json
1563
- [
1564
- {
1565
- "childField": "amount",
1566
- "childInstrumentId": "borrower_loan_installment_1_payment",
1567
- "childRefField": "borrowerLoanId",
1568
- "childStatuses": [
1569
- "paid"
1570
- ],
1571
- "parentField": "installment1Amount"
1572
- },
1573
- {
1574
- "childField": "amount",
1575
- "childInstrumentId": "borrower_loan_installment_2_payment",
1576
- "childRefField": "borrowerLoanId",
1577
- "childStatuses": [
1578
- "paid"
1579
- ],
1580
- "parentField": "installment2Amount"
1581
- }
1582
- ]
1583
- ```
1584
-
1585
- ## caller parked states
1586
-
1587
- - Scope: instrument
1588
- - UDL target: `callerParkedStates`
1589
- - Cardinality: one
1590
- - Linear outputs: none
1591
- - Effects: none
1592
- - Law: Time law and closure law
1593
- - Conformance source: `cards.udl`
1594
-
1595
- ```json
1596
- {
1597
- "active": "a cardholder in good standing stays active until the issuer or holder acts",
1598
- "pending": "activation follows the issuer's verification outcome",
1599
- "suspended": "reinstatement or closure is an issuer decision"
1600
- }
1601
- ```
1602
-
1603
- ## description
1604
-
1605
- - Scope: instrument
1606
- - UDL target: `description`
1607
- - Cardinality: one
1608
- - Linear outputs: none
1609
- - Effects: none
1610
- - Law: One-sentence law, uniform object law, and naming law
1611
- - Conformance source: `cards.udl`
1612
-
1613
- ```json
1614
- "Approves the customer to hold and use cards."
1615
- ```
1616
-
1617
- ## dials
1618
-
1619
- - Scope: instrument
1620
- - UDL target: `dials`
1621
- - Cardinality: many
1622
- - Linear outputs: none
1623
- - Effects: none
1624
- - Law: Requirements-as-data law and closure law
1625
- - Conformance source: `cards.udl`
1626
-
1627
- ```json
1628
- [
1629
- {
1630
- "field": "expiresAt",
1631
- "key": "authorization_window",
1632
- "kind": "window",
1633
- "maxOffset": "P30D",
1634
- "summary": "Grace beyond the authorization expiry timestamp before an uncaptured hold expires.",
1635
- "title": "Authorization window"
1636
- },
1637
- {
1638
- "action": "approve",
1639
- "key": "policy_decision_deadline_ms",
1640
- "kind": "decision_deadline_ms",
1641
- "maxMs": 5000,
1642
- "minMs": 500,
1643
- "summary": "How long approve waits for the card policy's just-in-time decision before the timeout default declines.",
1644
- "title": "Policy decision deadline"
1645
- }
1646
- ]
1647
- ```
1648
-
1649
- ## distinct parties
1650
-
1651
- - Scope: instrument
1652
- - UDL target: `distinctParties`
1653
- - Cardinality: one
1654
- - Linear outputs: none
1655
- - Effects: none
1656
- - Law: Closure law
1657
- - Conformance source: `compiled-watch-club.udl`
1658
-
1659
- ```json
1660
- true
1661
- ```
1662
-
1663
- ## computes derived
1664
-
1665
- - Scope: instrument
1666
- - UDL target: `derivedAmounts`
1667
- - Cardinality: many
1668
- - Linear outputs: none
1669
- - Effects: none
1670
- - Law: One-spine law and closure law
1671
- - Conformance source: `compiled-crowdfunding.udl`
1672
-
1673
- ```json
1674
- [
1675
- {
1676
- "field": "platformFee",
1677
- "rounding": "floor",
1678
- "rule": {
1679
- "bps": 200,
1680
- "kind": "percentage_of"
1681
- },
1682
- "sourceField": "principalAmount"
1683
- }
1684
- ]
1685
- ```
1686
-
1687
- ## computes fees
1688
-
1689
- - Scope: instrument
1690
- - UDL target: `feeRules`
1691
- - Cardinality: many
1692
- - Linear outputs: none
1693
- - Effects: none
1694
- - Law: One-spine law and closure law
1695
- - Conformance source: `compiled-watch-club.udl`
1696
-
1697
- ```json
1698
- [
1699
- {
1700
- "amountField": "checkoutFee",
1701
- "baseField": "purchasePrice",
1702
- "bearerField": "memberAccountId",
1703
- "position": "on_top",
1704
- "rule": {
1705
- "currencyField": "currency",
1706
- "field": "checkoutFee",
1707
- "kind": "exact"
1708
- }
1709
- },
1710
- {
1711
- "amountField": "carvedFeeAmount",
1712
- "baseField": "purchasePrice",
1713
- "bearerField": "sellerAccountId",
1714
- "position": "carved",
1715
- "rule": {
1716
- "kind": "tiered",
1717
- "tiers": [
1718
- {
1719
- "fromInclusive": "0",
1720
- "rule": {
1721
- "bps": 100,
1722
- "kind": "bps"
1723
- },
1724
- "toExclusive": "10000"
1725
- },
1726
- {
1727
- "fromInclusive": "10000",
1728
- "rule": {
1729
- "currencyField": "currency",
1730
- "field": "highValueFee",
1731
- "kind": "exact"
1732
- }
1733
- }
1734
- ]
1735
- }
1736
- }
1737
- ]
1738
- ```
1739
-
1740
- ## id prefix
1741
-
1742
- - Scope: instrument
1743
- - UDL target: `idPrefix`
1744
- - Cardinality: one
1745
- - Linear outputs: none
1746
- - Effects: none
1747
- - Law: One-sentence law, uniform object law, and naming law
1748
- - Conformance source: `agent-description.udl`
1749
-
1750
- ```json
1751
- "note"
1752
- ```
1753
-
1754
- ## nav
1755
-
1756
- - Scope: instrument
1757
- - UDL target: `nav`
1758
- - Cardinality: many
1759
- - Linear outputs: none
1760
- - Effects: none
1761
- - Law: One-sentence law, uniform object law, and naming law
1762
- - Conformance source: `cards.udl`
1763
-
1764
- ```json
1765
- [
1766
- "Blueprints",
1767
- "Cardholders"
1768
- ]
1769
- ```
1770
-
1771
- ## partitions
1772
-
1773
- - Scope: instrument
1774
- - UDL target: `partitions`
1775
- - Cardinality: many
1776
- - Linear outputs: none
1777
- - Effects: none
1778
- - Law: One-spine law and closure law
1779
- - Conformance source: `compiled-crowdfunding.udl`
1780
-
1781
- ```json
1782
- [
1783
- {
1784
- "pieceFields": [
1785
- "installment1Amount",
1786
- "installment2Amount"
1787
- ],
1788
- "totalField": "principalAmount"
1789
- }
1790
- ]
1791
- ```
1792
-
1793
- ## subject
1794
-
1795
- - Scope: instrument
1796
- - UDL target: `subject`
1797
- - Cardinality: one
1798
- - Linear outputs: none
1799
- - Effects: none
1800
- - Law: Closure law
1801
- - Conformance source: `commerce-escrow.udl`
1802
-
1803
- ```json
1804
- {
1805
- "kinds": [
1806
- "vehicle",
1807
- "merchandise"
1808
- ]
1809
- }
1810
- ```
1811
-
1812
- ## summary
1813
-
1814
- - Scope: instrument
1815
- - UDL target: `summary`
1816
- - Cardinality: one
1817
- - Linear outputs: none
1818
- - Effects: none
1819
- - Law: One-sentence law, uniform object law, and naming law
1820
- - Conformance source: `agent-description.udl`
1821
-
1822
- ```json
1823
- "Close the note."
1824
- ```
1825
-
1826
- ## surface visibility
1827
-
1828
- - Scope: instrument
1829
- - UDL target: `surfaceVisibility`
1830
- - Cardinality: one
1831
- - Linear outputs: none
1832
- - Effects: none
1833
- - Law: One-sentence law, uniform object law, and naming law
1834
- - Conformance source: `complete-contract.udl`
1835
-
1836
- ```json
1837
- "public"
1838
- ```
1839
-
1840
- ## template binding
1841
-
1842
- - Scope: instrument
1843
- - UDL target: `templateBinding`
1844
- - Cardinality: one
1845
- - Linear outputs: none
1846
- - Effects: none
1847
- - Law: Requirements-as-data law and closure law
1848
- - Conformance source: `vocabulary.udl`
1849
-
1850
- ```json
1851
- {
1852
- "id": "assessment",
1853
- "parameters": {
1854
- "cost": true
1855
- }
1856
- }
1857
- ```
1858
-
1859
- ## template id
1860
-
1861
- - Scope: instrument
1862
- - UDL target: `templateId`
1863
- - Cardinality: one
1864
- - Linear outputs: none
1865
- - Effects: none
1866
- - Law: One-sentence law, uniform object law, and naming law
1867
- - Conformance source: `cards.udl`
1868
-
1869
- ```json
1870
- "wallet_cards"
1871
- ```
1872
-
1873
- ## title
1874
-
1875
- - Scope: instrument
1876
- - UDL target: `title`
1877
- - Cardinality: one
1878
- - Linear outputs: none
1879
- - Effects: none
1880
- - Law: One-sentence law, uniform object law, and naming law
1881
- - Conformance source: `agent-description.udl`
1882
-
1883
- ```json
1884
- "Note"
1885
- ```
1886
-
1887
- ## update
1888
-
1889
- - Scope: instrument
1890
- - UDL target: `update`
1891
- - Cardinality: one
1892
- - Linear outputs: none
1893
- - Effects: none
1894
- - Law: Closure law
1895
- - Conformance source: `cards.udl`
1896
-
1897
- ```json
1898
- {
1899
- "examples": [
1900
- {
1901
- "input": {
1902
- "cardholderId": "chd_sandbox_customer0001",
1903
- "displayName": "Noura Al Saud",
1904
- "email": "noura@example.test",
1905
- "tenantId": "ten_sandbox_cards000001"
1906
- },
1907
- "name": "update_cardholder_contact"
1908
- }
1909
- ],
1910
- "fields": [
1911
- "displayName",
1912
- "email",
1913
- "phoneNumber"
1914
- ],
1915
- "states": [
1916
- "pending",
1917
- "active",
1918
- "suspended"
1919
- ]
1920
- }
1921
- ```
1922
-
1923
- ## request authority
1924
-
1925
- - Scope: action
1926
- - UDL target: `requestAuthority`
1927
- - Cardinality: one
1928
- - Linear outputs: none
1929
- - Effects: none
1930
- - Law: Requirements-as-data law and closure law
1931
- - Conformance source: `attested.udl`
1932
-
1933
- ```json
1934
- {
1935
- "actionField": "actionName",
1936
- "digestField": "digest",
1937
- "expiresField": "expiry",
1938
- "inputField": "requestInput",
1939
- "instanceField": "requestId",
1940
- "instrumentField": "requestInstrument",
1941
- "party": "decider",
1942
- "roleField": "role"
1943
- }
1944
- ```
1945
-
1946
- <!-- source: reference/diagnostics.md -->
1947
-
1948
- # Diagnostic reference
1949
-
1950
- Codes are stable. Titles and messages may become clearer without changing the code. Apply the listed fix, then validate the whole document again.
1951
-
1952
- | Code | Family | Category | Title | Fix |
1953
- | --------- | --------- | ----------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
1954
- | `UDL1001` | admission | invalid_utf8 | Invalid UTF-8 | Encode the document as valid UTF-8. |
1955
- | `UDL1002` | admission | invalid_json | Invalid JSON | Repair the JSON syntax before validation. |
1956
- | `UDL1003` | admission | invalid_shape | Invalid document shape | Match the published UDL JSON Schema. |
1957
- | `UDL1004` | admission | resource_limit | Resource limit exceeded | Reduce the source size, nesting, values, strings, references, or financial paths named by the message. |
1958
- | `UDL2001` | document | invalid_semantics | Duplicate declaration | Give each declaration a unique name. |
1959
- | `UDL2002` | document | invalid_semantics | Document law violation | Repair the declaration, subject contract, or derived effects named by the message. |
1960
- | `UDL2005` | document | invalid_semantics | Derived effects mismatch | Regenerate the action effects from its clauses. |
1961
- | `UDL2010` | document | invalid_semantics | Action graph violation | Order all actions and calls without cycles or collisions, within depth and count limits. |
1962
- | `UDL2011` | document | invalid_semantics | Action binding violation | Bind parameters to declared instance, piece, or caller variables without forward references or duplicate captures. |
1963
- | `UDL2012` | document | invalid_semantics | Action authority violation | Match principal, approval, and recovery policies and keep field paths within tenant boundary. |
1964
- | `UDL2013` | document | invalid_semantics | Action effect or evidence violation | Provide valid effect kind, matching effect signature, and non-empty evidence for every leaf. |
1965
- | `UDL3001` | lifecycle | invalid_semantics | Lifecycle is not closed | Declare every state and action transition, and make every state reachable. |
1966
- | `UDL4001` | finance | invalid_semantics | Money graph violation | Balance every funded amount and close every hold on each lifecycle path. |
1967
- | `UDL4002` | finance | invalid_semantics | Piece partition violation | Match piece plan total, amounts, and payees to required immutable fields and declared partition. |
1968
- | `UDL5001` | gates | invalid_semantics | Reference gate violation | Point the gate at a declared instrument, action, state, field, and reference. |
1969
- | `UDL5002` | gates | invalid_semantics | Check requirement violation | Use a declared check with compatible evidence and recurrence. |
1970
- | `UDL5003` | gates | invalid_semantics | Exposure gate violation | Use declared account and money fields for the exposure gate. |
1971
- | `UDL5004` | gates | invalid_semantics | Aggregate law violation | Point the aggregate at compatible parent and child fields. |
1972
- | `UDL5005` | gates | invalid_semantics | Settlement or payout violation | Use a declared settlement account and a compatible payout statement line. |
1973
- | `UDL5006` | gates | invalid_semantics | Quote and commit violation | Declare one complete quote freeze set and one matching commit action. |
1974
- | `UDL5007` | gates | invalid_semantics | Reconcile exception child violation | Name a declared child whose reference points back to this instrument. |
1975
- | `UDL5008` | gates | invalid_semantics | Action clause violation | Repair the clause fields and keep incompatible clauses separate. |
1976
- | `UDL5009` | gates | invalid_semantics | Reconcile exception amount field is missing or optional | Name the exception child's required money field in amountField. |
1977
- | `UDL5010` | gates | invalid_semantics | Reconcile exception amount field has the wrong type | Point amountField at a money field declared by the exception child. |
1978
- | `UDL5011` | gates | invalid_semantics | Reconcile exception reason field is missing or optional | Name the exception child's required text field in reasonField. |
1979
- | `UDL5012` | gates | invalid_semantics | Reconcile exception reason field has the wrong type | Point reasonField at a required plain text field declared by the exception child. |
1980
- | `UDL5013` | gates | invalid_semantics | Piece stage violation | Reference a declared piece plan and stage in the containing instrument. |
1981
- | `UDL6001` | schema | invalid_semantics | Unsupported JSON Schema | Use only the sealed UDL JSON Schema subset. |
1982
- | `UDL7001` | evolution | invalid_evolution | Stored contract changed | Keep stored identities and contracts unchanged, and add only allowed optional declarations. |
1983
- | `UDL7002` | evolution | invalid_evolution | Version was not increased | Increase the product version for every semantic change. |
1984
-
1985
- <!-- source: reference/cli.md -->
1986
-
1987
- # Command reference
1988
-
1989
- In the full repository checkout, run `bun open/udl/src/cli.ts validate <file.udl.json>` from the repository root. The entrypoint is `open/udl/src/cli.ts`; in a standalone package checkout it is `src/cli.ts`. Use this local validator for local HSX output.
1990
-
1991
- The installed `udl` binary exposes the following commands and exit codes.
1992
-
1993
- ```text
1994
- udl - the Universal Domain Language toolchain
1995
-
1996
- usage:
1997
- udl validate <file> parse <file> and report every issue found
1998
- udl fmt <file> [--write] print the canonical form, or rewrite the file
1999
- udl canon <file> [--digest] print canonical bytes, or their SHA-256 digest
2000
- udl diff <live> <next> check <next> against the append-only law
2001
- udl explain UDL#### explain one stable diagnostic code
2002
- udl help print this
2003
-
2004
- exit codes:
2005
- 0 the document is admissible, or the change is additive
2006
- 1 the document was refused, or the change breaks the append-only law
2007
- 2 the command line was wrong, or a file could not be read
2008
- ```