@hyperscale0/hsx 2.1.1 → 2.2.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +38 -7
  2. package/dist/src/cli.d.ts +1 -1
  3. package/dist/src/cli.d.ts.map +1 -1
  4. package/dist/src/cli.js +39 -5
  5. package/dist/src/cli.js.map +1 -1
  6. package/dist/src/compile.d.ts +0 -1
  7. package/dist/src/compile.d.ts.map +1 -1
  8. package/dist/src/compile.js +15 -1
  9. package/dist/src/compile.js.map +1 -1
  10. package/dist/src/cost.d.ts +3 -3
  11. package/dist/src/cost.d.ts.map +1 -1
  12. package/dist/src/cost.js +22 -12
  13. package/dist/src/cost.js.map +1 -1
  14. package/dist/src/parse.d.ts.map +1 -1
  15. package/dist/src/parse.js +10 -14
  16. package/dist/src/parse.js.map +1 -1
  17. package/dist/src/std-bundle.d.ts.map +1 -1
  18. package/dist/src/std-bundle.js +20 -84
  19. package/dist/src/std-bundle.js.map +1 -1
  20. package/dist/src/typecheck.d.ts.map +1 -1
  21. package/dist/src/typecheck.js +171 -39
  22. package/dist/src/typecheck.js.map +1 -1
  23. package/dist/src/version.d.ts +1 -1
  24. package/dist/src/version.js +1 -1
  25. package/docs/README.md +4 -2
  26. package/docs/guide/01-first-program.md +1 -1
  27. package/docs/guide/03-instruments.md +14 -1
  28. package/docs/guide/06-schedules.md +5 -1
  29. package/docs/guide/08-writing-a-module.md +48 -0
  30. package/docs/llms-full.txt +1966 -422
  31. package/docs/llms.txt +3 -4
  32. package/docs/reference/cli.md +6 -5
  33. package/docs/reference/diagnostics.md +9 -9
  34. package/docs/reference/grammar.md +2 -3
  35. package/docs/reference/std/advance.md +94 -17
  36. package/docs/reference/std/cancellable_booking.md +138 -17
  37. package/docs/reference/std/captured_payment.md +96 -24
  38. package/docs/reference/std/conditional_disbursement.md +82 -14
  39. package/docs/reference/std/credit_facility.md +89 -16
  40. package/docs/reference/std/held_payment.md +155 -55
  41. package/docs/reference/std/instant_transfer.md +79 -12
  42. package/docs/reference/std/metered.md +71 -9
  43. package/docs/reference/std/pooled_split.md +76 -7
  44. package/docs/reference/std/premium_forward.md +100 -20
  45. package/docs/reference/std/reconciled_payout.md +84 -14
  46. package/docs/reference/std/rotating_pool.md +112 -24
  47. package/docs/reference/std/scheduled.md +117 -32
  48. package/docs/reference/std/security_deposit.md +119 -27
  49. package/docs/reference/std/settlement_batch.md +105 -24
  50. package/docs/reference/std/swap.md +113 -26
  51. package/docs/reference/std/threshold_pool.md +120 -29
  52. package/docs/reference/std/weighted_distribution.md +117 -21
  53. package/docs/reference/types.md +39 -15
  54. package/docs/reference/udl-output.md +6 -6
  55. package/examples/01-first-program/README.md +1 -1
  56. package/examples/{02-imports-and-archetypes → 02-imports-and-modules}/README.md +1 -1
  57. package/examples/{02-imports-and-archetypes → 02-imports-and-modules}/photo-booth.hsx +1 -1
  58. package/examples/04-complete-product/README.md +1 -1
  59. package/examples/05-authored-instrument/README.md +5 -0
  60. package/examples/05-authored-instrument/payment.hsx +37 -0
  61. package/examples/05-watch-club/watch-club.hsx +0 -1
  62. package/examples/README.md +1 -2
  63. package/examples/advance/advance.udl +29 -6
  64. package/examples/cancellable_booking/cancellable_booking.udl +19 -0
  65. package/examples/captured_payment/captured_payment.hsx +0 -4
  66. package/examples/captured_payment/captured_payment.udl +6 -0
  67. package/examples/conditional_disbursement/conditional_disbursement.hsx +0 -2
  68. package/examples/conditional_disbursement/conditional_disbursement.udl +4 -0
  69. package/examples/cost-table.json +136 -8
  70. package/examples/credit_facility/credit_facility.hsx +0 -3
  71. package/examples/credit_facility/credit_facility.udl +17 -1
  72. package/examples/held_payment/held_payment.udl +16 -0
  73. package/examples/instant_transfer/instant_transfer.udl +6 -0
  74. package/examples/metered/metered.udl +5 -1
  75. package/examples/pooled_split/pooled_split.udl +4 -0
  76. package/examples/premium_forward/premium_forward.udl +4 -0
  77. package/examples/reconciled_payout/reconciled_payout.udl +7 -0
  78. package/examples/rotating_pool/rotating_pool.udl +8 -0
  79. package/examples/scheduled/scheduled.udl +18 -3
  80. package/examples/security_deposit/security_deposit.udl +13 -0
  81. package/examples/settlement_batch/settlement_batch.udl +4 -0
  82. package/examples/swap/swap.udl +10 -0
  83. package/examples/threshold_pool/threshold_pool.udl +11 -0
  84. package/examples/weighted_distribution/weighted_distribution.udl +9 -0
  85. package/package.json +10 -10
  86. package/skills/hsx/SKILL.md +2 -36
  87. package/src/cli.ts +41 -5
  88. package/src/compile.ts +14 -6
  89. package/src/cost.ts +13 -16
  90. package/src/parse.ts +15 -10
  91. package/src/std-bundle.ts +21 -88
  92. package/src/typecheck.ts +207 -34
  93. package/src/version.ts +1 -1
  94. package/std/SEMANTICS.md +33 -128
  95. package/std/money_flows/advance.hsx +39 -26
  96. package/std/money_flows/cancellable_booking.hsx +275 -8
  97. package/std/money_flows/captured_payment.hsx +1 -9
  98. package/std/money_flows/conditional_disbursement.hsx +0 -6
  99. package/std/money_flows/credit_facility.hsx +0 -9
  100. package/std/money_flows/held_payment.hsx +39 -1
  101. package/std/money_flows/index.hsx +2 -1
  102. package/std/money_flows/metered.hsx +1 -5
  103. package/std/money_flows/scheduled.hsx +29 -119
  104. package/std/money_flows/threshold_pool.hsx +40 -5
  105. package/std/money_flows/weighted_distribution.hsx +47 -5
  106. package/docs/reference/std/recurring_collection.md +0 -25
  107. package/examples/recurring_collection/README.md +0 -3
  108. package/examples/recurring_collection/recurring_collection.hsx +0 -21
  109. package/examples/recurring_collection/recurring_collection.udl +0 -1135
  110. package/std/money_flows/recurring_collection.hsx +0 -72
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
2
2
 
3
3
  # conditional_disbursement
4
4
 
@@ -10,13 +10,81 @@ Source: [`std/money_flows/conditional_disbursement.hsx`](../../../std/money_flow
10
10
 
11
11
  ## Parameters
12
12
 
13
- - `source: party`
14
- - `destination: party`
15
- - `cap: money<C>`
16
- - `amount: money<C>`
17
- - `decision: condition`
18
- - `reopen_policy: text`
19
- - `recovery_policy: text`
13
+ | Parameter | Type | Required | Meaning |
14
+ | --- | --- | --- | --- |
15
+ | `source` | `party` | Yes | The funding party providing the money. |
16
+ | `destination` | `party` | Yes | The beneficiary party receiving approved disbursements. |
17
+ | `cap` | `money<C>` | Yes | Maximum total amount that can be disbursed across all child approvals in minor units of currency `C`. |
18
+ | `amount` | `money<C>` | Yes | Binding name for child approval amount values. |
19
+ | `decision` | `condition` | Yes | Port conditioning approval, requiring evidence reference. |
20
+
21
+ Required means required by the template signature. A selected mode may also need parameters marked optional; the guidance below describes those combinations.
22
+
23
+ ## Module guidance
24
+
25
+ Capped disbursement from a source party to a destination party gated on stored external decision evidence.
26
+
27
+ ### Purpose
28
+
29
+ `conditional_disbursement` manages evidence-contingent payouts subject to a cumulative cap.
30
+ It fits insurance claim settlements, grant tranches, subsidy distributions, and escrow milestones
31
+ where each approved payment requires explicit external evidence and the total paid must not exceed `cap`.
32
+
33
+ ### Selection guidance
34
+
35
+ - vs `advance`: `conditional_disbursement` disburses non-repayable funds against external evidence
36
+ up to a declared cap. `advance` pays money up front with the expectation of repayment through carved
37
+ hold releases or scheduled installments.
38
+ - vs `instant_transfer`: `instant_transfer` moves money immediately with no evidence gate or cap.
39
+ `conditional_disbursement` requires an external decision port and evidence reference before any child amount moves.
40
+
41
+ ### Parameters
42
+
43
+ - `source`: The funding party providing the money.
44
+ - `destination`: The beneficiary party receiving approved disbursements.
45
+ - `cap`: Maximum total amount that can be disbursed across all child approvals in minor units of currency `C`.
46
+ - `amount`: Binding name for child approval amount values.
47
+ - `decision`: Port conditioning approval, requiring evidence reference.
48
+
49
+ ### Decision ports
50
+
51
+ - `decision`: External port providing decision evidence required to approve child disbursement amounts.
52
+
53
+ ### Example
54
+
55
+ ```hsx
56
+ program conditional_disbursement_example "Conditional disbursement example"
57
+ import { conditional_disbursement } from "std/money_flows"
58
+ party source: business
59
+ party claimant: person
60
+ settlement claim_payment = conditional_disbursement {
61
+ source: source
62
+ destination: claimant
63
+ cap: policyLimit: money(SAR)
64
+ amount: approvedAmount: money(SAR)
65
+ decision: port approve_claim
66
+ }
67
+ port approve_claim {
68
+ allowed: [source]
69
+ shape: { evidenceReference: text }
70
+ }
71
+ ```
72
+
73
+ ## Declared clauses
74
+
75
+ - `agent description`
76
+ - `capture input`
77
+ - `description`
78
+ - `id prefix`
79
+ - `input`
80
+ - `moves`
81
+ - `port`
82
+ - `steps`
83
+ - `summary`
84
+ - `title`
85
+ - `unique`
86
+
87
+ This inventory covers all branches and nested instruments in the module. The selected parameters determine which clauses and actions the compiler emits. Indexed action names expand over the declared finite list.
20
88
 
21
89
  ## Decision ports
22
90
 
@@ -24,10 +92,10 @@ Source: [`std/money_flows/conditional_disbursement.hsx`](../../../std/money_flow
24
92
 
25
93
  ## Actions and clauses
26
94
 
27
- | Action | Clauses lowered |
28
- | --------- | ------------------------------------------------------------------------------------------------- |
29
- | `create` | `agent description`, `moves`, `steps`, `summary` |
30
- | `deny` | `agent description`, `capture input`, `input`, `moves`, `port`, `steps`, `summary` |
31
- | `create` | `agent description`, `moves`, `steps`, `summary` |
95
+ | Action | Clauses lowered |
96
+ | --- | --- |
97
+ | `create` | `agent description`, `moves`, `steps`, `summary` |
98
+ | `deny` | `agent description`, `capture input`, `input`, `moves`, `port`, `steps`, `summary` |
99
+ | `create` | `agent description`, `moves`, `steps`, `summary`, `unique` |
32
100
  | `approve` | `agent description`, `capture input`, `description`, `input`, `moves`, `port`, `steps`, `summary` |
33
- | `pay` | `agent description`, `moves`, `steps`, `summary` |
101
+ | `pay` | `agent description`, `moves`, `steps`, `summary` |
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
2
2
 
3
3
  # credit_facility
4
4
 
@@ -10,15 +10,88 @@ Source: [`std/money_flows/credit_facility.hsx`](../../../std/money_flows/credit_
10
10
 
11
11
  ## Parameters
12
12
 
13
- - `lender: party`
14
- - `borrower: party`
15
- - `draw_destination: party`
16
- - `limit: money<C>`
17
- - `expires_at: date`
18
- - `obligation: ref`
19
- - `availability_policy: text`
20
- - `expiry_policy: text`
21
- - `close_policy: text`
13
+ | Parameter | Type | Required | Meaning |
14
+ | --- | --- | --- | --- |
15
+ | `lender` | `party` | Yes | The financing institution or party providing the credit capacity. |
16
+ | `borrower` | `party` | Yes | The borrowing party authorized to draw against the facility limit. |
17
+ | `draw_destination` | `party` | Yes | Account or party receiving disbursed draw proceeds. |
18
+ | `limit` | `money<C>` | Yes | Total revolving borrowing limit in minor units of currency `C`. |
19
+ | `expires_at` | `date` | Yes | Expiration date after which new draws cannot be opened. |
20
+ | `obligation` | `ref` | Yes | Reference to a scheduled obligation instrument handling draw repayments. |
21
+
22
+ Required means required by the template signature. A selected mode may also need parameters marked optional; the guidance below describes those combinations.
23
+
24
+ ## Module guidance
25
+
26
+ Revolving credit line providing reusable borrowing capacity up to a limit backed by scheduled obligations.
27
+
28
+ ### Purpose
29
+
30
+ `credit_facility` manages revolving commercial credit, inventory financing, and overdraft facilities.
31
+ A borrower can draw funds multiple times up to `limit` into `draw_destination`. Each draw creates a child
32
+ record linked to a scheduled `obligation`. Repayments restore available borrowing capacity until `expires_at`.
33
+
34
+ ### Selection guidance
35
+
36
+ - vs `advance`: `credit_facility` provides revolving, reusable credit lines where multiple draws can occur
37
+ and repayments restore capacity. `advance` is a single upfront lump-sum disbursement with a fixed repayment plan.
38
+ - vs `scheduled`: `scheduled` defines repayment installments or recurring transfers. `credit_facility` delegates
39
+ draw repayments to a `scheduled` obligation while tracking total facility utilization and limit compliance.
40
+
41
+ ### Parameters
42
+
43
+ - `lender`: The financing institution or party providing the credit capacity.
44
+ - `borrower`: The borrowing party authorized to draw against the facility limit.
45
+ - `draw_destination`: Account or party receiving disbursed draw proceeds.
46
+ - `limit`: Total revolving borrowing limit in minor units of currency `C`.
47
+ - `expires_at`: Expiration date after which new draws cannot be opened.
48
+ - `obligation`: Reference to a scheduled obligation instrument handling draw repayments.
49
+
50
+ ### Decision ports
51
+
52
+ None on the facility itself. Mandates and decision ports are declared on the linked `obligation` instrument.
53
+
54
+ ### Example
55
+
56
+ ```hsx
57
+ program credit_facility_example "Credit facility example"
58
+ import { credit_facility, scheduled } from "std/money_flows"
59
+ party lender: business
60
+ party borrower: business
61
+ party draw_destination: business
62
+ party repayment_source: business
63
+ settlement repayment = scheduled {
64
+ mode: obligation
65
+ payer: repayment_source
66
+ payee: lender
67
+ debtor: borrower
68
+ amount: principal: money(SAR)
69
+ count: 2
70
+ every: P30D
71
+ first_due: firstDueAt
72
+ }
73
+ settlement facility = credit_facility {
74
+ lender: lender
75
+ borrower: borrower
76
+ draw_destination: draw_destination
77
+ limit: facilityLimit: money(SAR)
78
+ expires_at: expiresAt
79
+ obligation: repayment.obligation
80
+ }
81
+ ```
82
+
83
+ ## Declared clauses
84
+
85
+ - `agent description`
86
+ - `description`
87
+ - `due`
88
+ - `id prefix`
89
+ - `moves`
90
+ - `steps`
91
+ - `summary`
92
+ - `title`
93
+
94
+ This inventory covers all branches and nested instruments in the module. The selected parameters determine which clauses and actions the compiler emits. Indexed action names expand over the declared finite list.
22
95
 
23
96
  ## Decision ports
24
97
 
@@ -26,10 +99,10 @@ None.
26
99
 
27
100
  ## Actions and clauses
28
101
 
29
- | Action | Clauses lowered |
30
- | --------- | ------------------------------------------------ |
31
- | `create` | `agent description`, `moves`, `steps`, `summary` |
32
- | `freeze` | `due`, `moves`, `steps`, `summary` |
33
- | `close` | `agent description`, `moves`, `steps`, `summary` |
34
- | `create` | `agent description`, `moves`, `steps`, `summary` |
102
+ | Action | Clauses lowered |
103
+ | --- | --- |
104
+ | `create` | `agent description`, `moves`, `steps`, `summary` |
105
+ | `freeze` | `due`, `moves`, `steps`, `summary` |
106
+ | `close` | `agent description`, `moves`, `steps`, `summary` |
107
+ | `create` | `agent description`, `moves`, `steps`, `summary` |
35
108
  | `resolve` | `agent description`, `moves`, `steps`, `summary` |
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
2
2
 
3
3
  # held_payment
4
4
 
@@ -10,22 +10,122 @@ Source: [`std/money_flows/held_payment.hsx`](../../../std/money_flows/held_payme
10
10
 
11
11
  ## Parameters
12
12
 
13
- - `payer: party`
14
- - `payee: party`
15
- - `amount: money<C>`
16
- - `release: condition`
17
- - `fees: optional<block>`
18
- - `on_cancel: optional<block>`
19
- - `derived_amount: optional<block>`
20
- - `release_to: optional<party>`
21
- - `whole_amount: optional<block>`
22
- - `release_action: optional<text>`
23
- - `whole_fee: optional<money<C>>`
24
- - `reference: optional<text>`
25
- - `upstream: optional<ref>`
26
- - `id_prefix_override: optional<text>`
27
- - `cancel_charge_bps: optional<integer>`
28
- - `cancel_offer_life: optional<text>`
13
+ | Parameter | Type | Required | Meaning |
14
+ | --- | --- | --- | --- |
15
+ | `payer` | `party` | Yes | The funding party providing the money. |
16
+ | `payee` | `party` | Yes | The beneficiary party receiving the released funds. |
17
+ | `amount` | `money<C>` | Yes | Total amount in minor units of currency `C`. |
18
+ | `release` | `condition` | Yes | Condition required to release funds. Supports decision ports (`port <name>`), date deadlines (`at(<date>)`), or disjunctions (`port <name> &#124; at(<date>)`). |
19
+ | `fees` | `optional<block>` | No | Optional block declaring percentage or fixed fee cuts, e.g. `{ buyer: 1%, seller: 2% }`. |
20
+ | `on_cancel` | `optional<block>` | No | Optional block defining refund splits if cancelled while funded, e.g. `(funded) { buyer: 90%, seller: 10% }`. |
21
+ | `derived_amount` | `optional<block>` | No | Optional block declaring machine-derived fees calculated as a percentage of another field. |
22
+ | `release_to` | `optional<party>` | No | Optional third-party destination for release. |
23
+ | `whole_amount` | `optional<block>` | No | Optional block enabling single-action funding and release of principal plus on-top fee. |
24
+ | `release_action` | `optional<text>` | No | Optional custom name for the release action. |
25
+ | `whole_fee` | `optional<money<C>>` | No | Optional money amount for the whole-amount fee. |
26
+ | `reference` | `optional<text>` | No | Optional string reference stored on the instance. |
27
+ | `upstream` | `optional<ref>` | No | Optional reference to a parent instrument. |
28
+ | `id_prefix_override` | `optional<text>` | No | Optional custom prefix for generated instrument IDs. |
29
+ | `cancel_charge_bps` | `optional<integer>` | No | Optional cancellation charge in basis points. Declaring it gives the settlement a quoted cancellation: `quote_cancellation` prices the charge and the refund and freezes both, `cancel` pays the refund to the payer, and `retain_cancellation_charge` pays the charge to the payee. A zero charge keeps the flow with a zero fee. |
30
+ | `cancel_offer_life` | `optional<text>` | No | ISO 8601 duration a cancellation quote stays open, required with `cancel_charge_bps`. |
31
+ | `private_actions` | `optional<boolean>` | No | Suppress automatic aliases. Publish chosen actions with `expose`. |
32
+
33
+ Required means required by the template signature. A selected mode may also need parameters marked optional; the guidance below describes those combinations.
34
+
35
+ ## Module guidance
36
+
37
+ Escrow settlement holding funds from a payer before releasing to a payee upon a verified condition or deadline.
38
+
39
+ ### Purpose
40
+
41
+ `held_payment` holds customer funds in a dedicated product escrow account away from both payer and payee.
42
+ It fits milestone-gated commerce, vehicle escrow, contractor holdbacks, and goods purchases where funds
43
+ must remain reserved until delivery confirmation or inspection.
44
+
45
+ ### Selection guidance
46
+
47
+ - vs `cancellable_booking`: Both hold funds in custody and both can quote a cancellation before it is
48
+ spent. `held_payment` quotes one flat charge declared by `cancel_charge_bps`, because it has no scheduled
49
+ start to price against, and `on_cancel` remains the way to unwind it on static splits instead.
50
+ Choose `cancellable_booking` when the charge must follow the time left before a scheduled start date.
51
+ - vs `security_deposit`: `held_payment` releases or cancels the principal according to predefined splits.
52
+ Choose `security_deposit` when the holder must assess damages and claim an arbitrary partial amount
53
+ via a `decided amount` clause while returning the unspent remainder to the payer.
54
+ - vs `swap`: `held_payment` is a one-way transfer from payer to payee. Choose `swap` for bilateral or
55
+ multi-party atomic exchanges where all parties must fund their legs into escrow before simultaneous release.
56
+ - vs `premium_forward`: Choose `premium_forward` for insurance premium collection requiring carrier policy
57
+ binding conditions, broker commission retention, policy endorsements, and lapse schedules.
58
+
59
+ ### Parameters
60
+
61
+ - `payer`: The funding party providing the money.
62
+ - `payee`: The beneficiary party receiving the released funds.
63
+ - `amount`: Total amount in minor units of currency `C`.
64
+ - `release`: Condition required to release funds. Supports decision ports (`port <name>`), date deadlines
65
+ (`at(<date>)`), or disjunctions (`port <name> | at(<date>)`).
66
+ - `fees`: Optional block declaring percentage or fixed fee cuts, e.g. `{ buyer: 1%, seller: 2% }`.
67
+ - `on_cancel`: Optional block defining refund splits if cancelled while funded, e.g. `(funded) { buyer: 90%, seller: 10% }`.
68
+ - `derived_amount`: Optional block declaring machine-derived fees calculated as a percentage of another field.
69
+ - `release_to`: Optional third-party destination for release.
70
+ - `whole_amount`: Optional block enabling single-action funding and release of principal plus on-top fee.
71
+ - `release_action`: Optional custom name for the release action.
72
+ - `whole_fee`: Optional money amount for the whole-amount fee.
73
+ - `reference`: Optional string reference stored on the instance.
74
+ - `upstream`: Optional reference to a parent instrument.
75
+ - `id_prefix_override`: Optional custom prefix for generated instrument IDs.
76
+ - `cancel_charge_bps`: Optional cancellation charge in basis points. Declaring it gives the settlement a
77
+ quoted cancellation: `quote_cancellation` prices the charge and the refund and freezes both,
78
+ `cancel` pays the refund to the payer, and `retain_cancellation_charge` pays the charge to the payee.
79
+ A zero charge keeps the flow with a zero fee.
80
+ - `cancel_offer_life`: ISO 8601 duration a cancellation quote stays open, required with `cancel_charge_bps`.
81
+
82
+ - `private_actions`: Suppress automatic aliases. Publish chosen actions with `expose`.
83
+
84
+ ### Decision ports
85
+
86
+ - `release`: Port deciding release authorization, answered by allowed parties declared in the port.
87
+
88
+ ### Example
89
+
90
+ ```hsx
91
+ program held_payment_example "Held payment example"
92
+ import { held_payment } from "std/money_flows"
93
+ party buyer: person
94
+ party seller: business
95
+ settlement sale = held_payment {
96
+ payer: buyer
97
+ payee: seller
98
+ amount: price: money(SAR)
99
+ fees { buyer: 1% }
100
+ on_cancel(funded) { buyer: 100% }
101
+ release: port confirm_delivery | at(releaseDueAt)
102
+ }
103
+ port confirm_delivery { allowed: [buyer] }
104
+ ```
105
+
106
+ ## Declared clauses
107
+
108
+ - `agent description`
109
+ - `caller parked states`
110
+ - `commit`
111
+ - `deadline`
112
+ - `description`
113
+ - `distinct parties`
114
+ - `due`
115
+ - `event name`
116
+ - `id prefix`
117
+ - `input`
118
+ - `moves`
119
+ - `partitions`
120
+ - `port`
121
+ - `quote`
122
+ - `requires drained`
123
+ - `sandbox failure point`
124
+ - `steps`
125
+ - `summary`
126
+ - `title`
127
+
128
+ This inventory covers all branches and nested instruments in the module. The selected parameters determine which clauses and actions the compiler emits. Indexed action names expand over the declared finite list.
29
129
 
30
130
  ## Decision ports
31
131
 
@@ -33,41 +133,41 @@ Source: [`std/money_flows/held_payment.hsx`](../../../std/money_flows/held_payme
33
133
 
34
134
  ## Actions and clauses
35
135
 
36
- | Action | Clauses lowered |
37
- | ---------------------------- | ------------------------------------------------------------------------------------------------------ |
38
- | `fund_piece_2` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
39
- | `fund_piece_3` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
40
- | `collect_service_fee` | `agent description`, `moves`, `steps`, `summary` |
41
- | `release_piece_2` | `agent description`, `moves`, `steps`, `summary` |
42
- | `release_piece_3` | `agent description`, `moves`, `steps`, `summary` |
43
- | `refund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
44
- | `refund_piece_3` | `agent description`, `moves`, `steps`, `summary` |
45
- | `unfund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
46
- | `unfund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
47
- | `unfund_piece_3` | `agent description`, `moves`, `steps`, `summary` |
48
- | `create` | `agent description`, `moves`, `steps`, `summary` |
49
- | `fund_piece_1` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
50
- | `release_name` | `agent description`, `deadline`, `input`, `moves`, `port`, `sandbox failure point`, `steps`, `summary` |
51
- | `release_on_deadline` | `due`, `moves`, `steps`, `summary` |
52
- | `cancel` | `agent description`, `deadline`, `moves`, `steps`, `summary` |
53
- | `quote_cancellation` | `agent description`, `deadline`, `moves`, `quote`, `steps`, `summary` |
54
- | `cancel` | `agent description`, `commit`, `deadline`, `moves`, `steps`, `summary` |
55
- | `retain_cancellation_charge` | `agent description`, `moves`, `steps`, `summary` |
56
- | `fund_piece_2` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
57
- | `release_piece_2` | `agent description`, `moves`, `steps`, `summary` |
58
- | `unfund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
59
- | `fund_piece_2` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
60
- | `release_piece_2` | `agent description`, `moves`, `steps`, `summary` |
61
- | `refund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
62
- | `unfund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
63
- | `abandon` | `agent description`, `moves`, `steps`, `summary` |
64
- | `dispute` | `agent description`, `deadline`, `description`, `moves`, `steps`, `summary` |
65
- | `resume` | `agent description`, `description`, `moves`, `steps`, `summary` |
66
- | `create` | `agent description`, `moves`, `steps`, `summary` |
67
- | `fund` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
68
- | `release_action` | `agent description`, `deadline`, `moves`, `port`, `sandbox failure point`, `steps`, `summary` |
69
- | `release_on_deadline` | `due`, `event name`, `moves`, `steps`, `summary` |
70
- | `cancel` | `agent description`, `deadline`, `event name`, `moves`, `steps`, `summary` |
71
- | `abandon` | `agent description`, `moves`, `steps`, `summary` |
72
- | `dispute` | `agent description`, `deadline`, `description`, `moves`, `steps`, `summary` |
73
- | `resume` | `agent description`, `description`, `moves`, `steps`, `summary` |
136
+ | Action | Clauses lowered |
137
+ | --- | --- |
138
+ | `fund_piece_2` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
139
+ | `fund_piece_3` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
140
+ | `collect_service_fee` | `agent description`, `moves`, `steps`, `summary` |
141
+ | `release_piece_2` | `agent description`, `moves`, `steps`, `summary` |
142
+ | `release_piece_3` | `agent description`, `moves`, `steps`, `summary` |
143
+ | `refund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
144
+ | `refund_piece_3` | `agent description`, `moves`, `steps`, `summary` |
145
+ | `unfund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
146
+ | `unfund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
147
+ | `unfund_piece_3` | `agent description`, `moves`, `steps`, `summary` |
148
+ | `create` | `agent description`, `moves`, `steps`, `summary` |
149
+ | `fund_piece_1` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
150
+ | `[release_name]` | `agent description`, `deadline`, `input`, `moves`, `port`, `sandbox failure point`, `steps`, `summary` |
151
+ | `release_on_deadline` | `due`, `moves`, `steps`, `summary` |
152
+ | `cancel` | `agent description`, `deadline`, `moves`, `steps`, `summary` |
153
+ | `quote_cancellation` | `agent description`, `deadline`, `moves`, `quote`, `steps`, `summary` |
154
+ | `cancel` | `agent description`, `commit`, `deadline`, `moves`, `steps`, `summary` |
155
+ | `retain_cancellation_charge` | `agent description`, `moves`, `steps`, `summary` |
156
+ | `fund_piece_2` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
157
+ | `release_piece_2` | `agent description`, `moves`, `steps`, `summary` |
158
+ | `unfund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
159
+ | `fund_piece_2` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
160
+ | `release_piece_2` | `agent description`, `moves`, `steps`, `summary` |
161
+ | `refund_piece_2` | `agent description`, `moves`, `steps`, `summary` |
162
+ | `unfund_piece_1` | `agent description`, `moves`, `steps`, `summary` |
163
+ | `abandon` | `agent description`, `moves`, `steps`, `summary` |
164
+ | `dispute` | `agent description`, `deadline`, `description`, `moves`, `steps`, `summary` |
165
+ | `resume` | `agent description`, `description`, `moves`, `steps`, `summary` |
166
+ | `create` | `agent description`, `moves`, `steps`, `summary` |
167
+ | `fund` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
168
+ | `[release_action]` | `agent description`, `deadline`, `moves`, `port`, `sandbox failure point`, `steps`, `summary` |
169
+ | `release_on_deadline` | `due`, `event name`, `moves`, `steps`, `summary` |
170
+ | `cancel` | `agent description`, `deadline`, `event name`, `moves`, `steps`, `summary` |
171
+ | `abandon` | `agent description`, `moves`, `requires drained`, `steps`, `summary` |
172
+ | `dispute` | `agent description`, `deadline`, `description`, `moves`, `steps`, `summary` |
173
+ | `resume` | `agent description`, `description`, `moves`, `steps`, `summary` |
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
2
2
 
3
3
  # instant_transfer
4
4
 
@@ -10,11 +10,78 @@ Source: [`std/money_flows/instant_transfer.hsx`](../../../std/money_flows/instan
10
10
 
11
11
  ## Parameters
12
12
 
13
- - `payer: party`
14
- - `payee: party`
15
- - `amount: money<C>`
16
- - `fees: optional<block>`
17
- - `derived_amount: optional<block>`
13
+ | Parameter | Type | Required | Meaning |
14
+ | --- | --- | --- | --- |
15
+ | `payer` | `party` | Yes | Funding party whose account is debited. |
16
+ | `payee` | `party` | Yes | Recipient party whose account is credited. |
17
+ | `amount` | `money<C>` | Yes | Transfer amount in minor units of currency `C`. |
18
+ | `fees` | `optional<block>` | No | Optional fee configuration block specifying flat fees, percentage fees, or bracketed fee tiers for payer and/or payee. |
19
+ | `derived_amount` | `optional<block>` | No | Optional block declaring derived platform fees calculated from the transfer amount. |
20
+
21
+ Required means required by the template signature. A selected mode may also need parameters marked optional; the guidance below describes those combinations.
22
+
23
+ ## Module guidance
24
+
25
+ Direct, single-step push transfer from payer to payee with optional tiered or percentage fees.
26
+
27
+ ### Purpose
28
+
29
+ `instant_transfer` debits a payer and credits a payee immediately in a single execution step.
30
+ It fits peer-to-peer transfers, direct disbursements, instant payouts, wallet reloads, and simple point-of-sale payments.
31
+
32
+ ### Selection guidance
33
+
34
+ - vs `captured_payment`: `instant_transfer` moves money in one atomic step without prior authorization holds,
35
+ incremental captures, voids, or post-settlement correction ports. Use `captured_payment` when authorization must precede capture.
36
+ - vs `conditional_disbursement`: `instant_transfer` executes immediately without external decision evidence
37
+ or cumulative cap tracking. Use `conditional_disbursement` when payments require evidence submission or aggregate milestone caps.
38
+ - vs `held_payment`: `instant_transfer` never holds funds in an intermediary escrow account.
39
+
40
+ ### Parameters
41
+
42
+ - `payer`: Funding party whose account is debited.
43
+ - `payee`: Recipient party whose account is credited.
44
+ - `amount`: Transfer amount in minor units of currency `C`.
45
+ - `fees`: Optional fee configuration block specifying flat fees, percentage fees, or bracketed fee tiers for payer and/or payee.
46
+ - `derived_amount`: Optional block declaring derived platform fees calculated from the transfer amount.
47
+
48
+ ### Decision ports
49
+
50
+ None. Transfers execute immediately upon invocation.
51
+
52
+ ### Example
53
+
54
+ ```hsx
55
+ program instant_transfer_example "Instant transfer example"
56
+ import { instant_transfer } from "std/money_flows"
57
+ party customer: person
58
+ party merchant: business
59
+ settlement transfer = instant_transfer {
60
+ payer: customer
61
+ payee: merchant
62
+ amount: transferAmount: money(SAR)
63
+ fees {
64
+ customer: checkoutFee: money(SAR)
65
+ merchant {
66
+ tier { from: 0, to: 10000, fee: 1% }
67
+ tier { from: 10000, fee: highValueFee: money(SAR) }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Declared clauses
74
+
75
+ - `agent description`
76
+ - `description`
77
+ - `moves`
78
+ - `partitions`
79
+ - `sandbox failure point`
80
+ - `steps`
81
+ - `summary`
82
+ - `title`
83
+
84
+ This inventory covers all branches and nested instruments in the module. The selected parameters determine which clauses and actions the compiler emits. Indexed action names expand over the declared finite list.
18
85
 
19
86
  ## Decision ports
20
87
 
@@ -22,9 +89,9 @@ None.
22
89
 
23
90
  ## Actions and clauses
24
91
 
25
- | Action | Clauses lowered |
26
- | --------------------- | ------------------------------------------------------------------------- |
27
- | `create` | `agent description`, `moves`, `steps`, `summary` |
28
- | `pay_piece_1` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
29
- | `pay_piece_2` | `agent description`, `moves`, `steps`, `summary` |
30
- | `collect_service_fee` | `agent description`, `moves`, `steps`, `summary` |
92
+ | Action | Clauses lowered |
93
+ | --- | --- |
94
+ | `create` | `agent description`, `moves`, `steps`, `summary` |
95
+ | `pay_piece_1` | `agent description`, `moves`, `sandbox failure point`, `steps`, `summary` |
96
+ | `pay_piece_2` | `agent description`, `moves`, `steps`, `summary` |
97
+ | `collect_service_fee` | `agent description`, `moves`, `steps`, `summary` |