@hyperscale0/udl 2.6.1 → 3.0.1
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 +4 -328
- 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 +148 -14
- package/package.json +7 -11
- package/spec/README.md +152 -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/docs/llms.txt
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!-- Generated by scripts/docs/build.ts from @hyperscale0/udl 2.6.1. Edit the source, not llms.txt. -->
|
|
2
|
-
|
|
3
|
-
# UDL documentation
|
|
4
|
-
|
|
5
|
-
- [Start here](README.md)
|
|
6
|
-
- [Write a document](guide/01-a-document.md)
|
|
7
|
-
- [Understand the laws](guide/03-laws.md)
|
|
8
|
-
- [Evolve a stored document](guide/07-evolution.md)
|
|
9
|
-
- [Implement UDL](guide/08-implementing.md)
|
|
10
|
-
- [Clause reference](reference/clauses.md)
|
|
11
|
-
- [Diagnostic reference](reference/diagnostics.md)
|
|
12
|
-
- [Canonical bytes](reference/canonical.md)
|
|
13
|
-
- [Command reference](reference/cli.md)
|
|
14
|
-
- [Conformance contract](../conformance/README.md)
|
package/docs/piece-plans.md
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
# Piece plans and private action composition
|
|
2
|
-
|
|
3
|
-
UDL preserves the authored graph and the order needed to interpret it.
|
|
4
|
-
`piecePlan` declares a finite partition, `pieceStage` names a stage, `calls`
|
|
5
|
-
binds private actions, and `actionLibrary` supplies their definitions. HSX
|
|
6
|
-
spells these clauses `piece_plan`, `piece_stage`, `calls` and `action_library`.
|
|
7
|
-
The shapes live in [`schema.ts`](../src/schema.ts); resolution and finance
|
|
8
|
-
validation live in [`validation.ts`](../src/validation.ts). The
|
|
9
|
-
[clause reference](reference/clauses.md) describes the complete vocabulary.
|
|
10
|
-
|
|
11
|
-
## Worked sale example
|
|
12
|
-
|
|
13
|
-
The following decoded instrument fragment uses the sale settlement's price
|
|
14
|
-
partition and refund action. Add it to an instrument with its required
|
|
15
|
-
immutable fields, matching partition, lifecycle and captured escrow account.
|
|
16
|
-
It omits the surrounding document and other actions. It is formatted for
|
|
17
|
-
reading; canonical serialization sorts object keys and retains array order.
|
|
18
|
-
|
|
19
|
-
```json
|
|
20
|
-
{
|
|
21
|
-
"piecePlan": {
|
|
22
|
-
"id": "price",
|
|
23
|
-
"total": "price",
|
|
24
|
-
"pieces": [
|
|
25
|
-
{
|
|
26
|
-
"id": "seller",
|
|
27
|
-
"amount": "piece1Amount",
|
|
28
|
-
"release_to": "sellerAccountId",
|
|
29
|
-
"refund_to": "buyerAccountId"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"id": "platform_fee",
|
|
33
|
-
"amount": "piece2Amount",
|
|
34
|
-
"release_to": "platformAccountId",
|
|
35
|
-
"refund_to": "buyerAccountId"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"id": "seller_cancel_fee",
|
|
39
|
-
"amount": "piece3Amount",
|
|
40
|
-
"release_to": "platformAccountId",
|
|
41
|
-
"refund_to": "sellerAccountId"
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
"fund_order": ["seller", "platform_fee", "seller_cancel_fee"],
|
|
45
|
-
"release_order": ["platform_fee", "seller_cancel_fee"],
|
|
46
|
-
"refund_order": ["platform_fee", "seller_cancel_fee"],
|
|
47
|
-
"unfund_order": ["seller_cancel_fee", "platform_fee", "seller"]
|
|
48
|
-
},
|
|
49
|
-
"actionLibrary": {
|
|
50
|
-
"settlement_piece": {
|
|
51
|
-
"actionOrder": ["move"],
|
|
52
|
-
"actions": {
|
|
53
|
-
"move": {
|
|
54
|
-
"parameters": {
|
|
55
|
-
"piece": { "kind": "piece" },
|
|
56
|
-
"source": { "kind": "account" },
|
|
57
|
-
"destination": { "kind": "account" }
|
|
58
|
-
},
|
|
59
|
-
"principal": "api_key",
|
|
60
|
-
"approval": "inherit",
|
|
61
|
-
"recovery": "local",
|
|
62
|
-
"order": ["transfer"],
|
|
63
|
-
"calls": [],
|
|
64
|
-
"leaves": [
|
|
65
|
-
{
|
|
66
|
-
"id": "transfer",
|
|
67
|
-
"operation": "internal_transfer.create",
|
|
68
|
-
"bind": {
|
|
69
|
-
"amount": "$piece.amount",
|
|
70
|
-
"currency": "$piece.currency",
|
|
71
|
-
"sourceAccountId": "$source",
|
|
72
|
-
"destinationAccountId": "$destination"
|
|
73
|
-
},
|
|
74
|
-
"effects": [
|
|
75
|
-
{ "kind": "moves", "signature": "moves.transfer.internal" }
|
|
76
|
-
],
|
|
77
|
-
"evidence": "transferId"
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
"actions": {
|
|
85
|
-
"refund_piece": {
|
|
86
|
-
"pieceStage": { "plan": "price", "stage": "refund" },
|
|
87
|
-
"calls": [
|
|
88
|
-
{
|
|
89
|
-
"id": "move_piece",
|
|
90
|
-
"action": "settlement_piece.move",
|
|
91
|
-
"bind": {
|
|
92
|
-
"piece": "$piece",
|
|
93
|
-
"source": "$instance.refs.escrowAccountId",
|
|
94
|
-
"destination": "$piece.refund_to"
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
],
|
|
98
|
-
"steps": [],
|
|
99
|
-
"summary": "Refund a piece of a sale settlement"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
The containing instrument's `actionOrder` includes `refund_piece` at its
|
|
106
|
-
authored position. Both library `actionOrder` and private action `order` must
|
|
107
|
-
be exact permutations of their members. The stage derives a required
|
|
108
|
-
`pieceId` enum, here `platform_fee` or `seller_cancel_fee`. The selector does
|
|
109
|
-
not add another transfer; the private leaf moves its amount once.
|
|
110
|
-
|
|
111
|
-
For the sale's example amounts, `piece1Amount` is `245000`, `piece2Amount` is
|
|
112
|
-
`3750`, and `piece3Amount` is `1250`, all SAR minor units. They partition
|
|
113
|
-
`price` of `250000`. Cancellation's separate decision action returns the seller
|
|
114
|
-
piece to the buyer. The refund stage then returns `3750` to the buyer and pays
|
|
115
|
-
`1250` to the seller. Unfund follows its reverse order and returns every funded
|
|
116
|
-
piece to the buyer instead. The service fee stays outside the price partition.
|
|
117
|
-
|
|
118
|
-
`resolveUdlActionPlans` returns plans and issues. A plan identifies its action
|
|
119
|
-
and optional piece ID, with resolved effects and leaves. Each leaf retains
|
|
120
|
-
`originPath`, step, effects and evidence. Resolution expands static calls; it
|
|
121
|
-
does not replace the source graph in canonical UDL. A private library entry is
|
|
122
|
-
not a public action. [`refactor-clauses.spec.ts`](../test/refactor-clauses.spec.ts)
|
|
123
|
-
checks piece constraints, graph order, cycles, bindings, authority and evidence.
|
|
124
|
-
|
|
125
|
-
## Conservation and diagnostics
|
|
126
|
-
|
|
127
|
-
UDL 2.3.0 checks funded amounts over piece progress. A partially funded path
|
|
128
|
-
must return only the pieces actually funded; selecting one piece is not proof
|
|
129
|
-
that a whole stage completed. For a piece plan, `expandPieceProgress` bounds the reachable lifecycle/progress
|
|
130
|
-
states at 256. Instruments without a piece plan use the separate action-plan
|
|
131
|
-
combination bound. These bounds belong to the proof, not to a runtime retry
|
|
132
|
-
loop. [`udl.spec.ts`](../test/udl.spec.ts) includes the stranded-funded-piece
|
|
133
|
-
refusal; [`validation.ts`](../src/validation.ts) owns the progress expansion.
|
|
134
|
-
|
|
135
|
-
[`diagnostics.ts`](../src/diagnostics.ts) defines the refusal codes:
|
|
136
|
-
|
|
137
|
-
| Code | Refusal | Repair |
|
|
138
|
-
| --------- | ---------------------- | ---------------------------------------------------------------------------------------- |
|
|
139
|
-
| `UDL4001` | Money graph violation | Balance each funded amount and close every hold on each lifecycle path |
|
|
140
|
-
| `UDL5013` | Piece stage violation | Select a declared plan/stage, valid ordered piece IDs and a call-based stage action |
|
|
141
|
-
| `UDL2010` | Action graph violation | Resolve targets and remove cycles, collisions or invalid order within depth/count limits |
|
|
142
|
-
|
|
143
|
-
A partition mismatch or incompatible immutable field is `UDL4002`. A typed
|
|
144
|
-
binding failure is `UDL2011`; an authority boundary is `UDL2012`; incomplete
|
|
145
|
-
effects or evidence are `UDL2013`. These failures are not permission to skip
|
|
146
|
-
the independent conservation oracle. Keep actions that need another principal,
|
|
147
|
-
independent approval or external recovery as separate calls at the public
|
|
148
|
-
boundary, not flattened private work.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Canonical bytes
|
|
2
|
-
|
|
3
|
-
An admitted UDL document has one canonical byte sequence.
|
|
4
|
-
|
|
5
|
-
- Encode JSON as UTF-8 without a byte-order mark.
|
|
6
|
-
- Sort every object's keys by ascending UTF-16 code unit. Compare code units, not locale order or Unicode collation order.
|
|
7
|
-
- Preserve array order exactly as authored. Never sort an array.
|
|
8
|
-
- Indent nested values with two ASCII spaces. Write one ASCII space after each colon.
|
|
9
|
-
- Write empty objects as `{}` and empty arrays as `[]`.
|
|
10
|
-
- 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.
|
|
11
|
-
- 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.
|
|
12
|
-
- End the document with exactly one line feed byte, `0A`. Write no other trailing whitespace.
|
|
13
|
-
|
|
14
|
-
`serializeUdl(document)` validates and writes these bytes. `canonicalizeUdl(input)` parses, validates, and writes them. Canonicalizing canonical bytes returns the same bytes.
|
|
15
|
-
|
|
16
|
-
`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.
|