@hyperscale0/hsx 1.0.0-rc.1 → 2.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 (188) hide show
  1. package/CHANGELOG.md +32 -4
  2. package/README.md +58 -36
  3. package/bin/hsx.ts +2 -0
  4. package/dist/bin/hsx.js +2 -0
  5. package/dist/bin/hsx.js.map +1 -1
  6. package/dist/src/ast.d.ts +10 -2
  7. package/dist/src/ast.d.ts.map +1 -1
  8. package/dist/src/ast.js +24 -0
  9. package/dist/src/ast.js.map +1 -1
  10. package/dist/src/cli.d.ts +3 -1
  11. package/dist/src/cli.d.ts.map +1 -1
  12. package/dist/src/cli.js +25 -5
  13. package/dist/src/cli.js.map +1 -1
  14. package/dist/src/compile.d.ts +9 -5
  15. package/dist/src/compile.d.ts.map +1 -1
  16. package/dist/src/compile.js +9 -3
  17. package/dist/src/compile.js.map +1 -1
  18. package/dist/src/cost.d.ts +3 -1
  19. package/dist/src/cost.d.ts.map +1 -1
  20. package/dist/src/cost.js +124 -94
  21. package/dist/src/cost.js.map +1 -1
  22. package/dist/src/diagnostics.d.ts.map +1 -1
  23. package/dist/src/diagnostics.js +89 -5
  24. package/dist/src/diagnostics.js.map +1 -1
  25. package/dist/src/emit.d.ts +4 -3
  26. package/dist/src/emit.d.ts.map +1 -1
  27. package/dist/src/emit.js +28 -233
  28. package/dist/src/emit.js.map +1 -1
  29. package/dist/src/format.js.map +1 -1
  30. package/dist/src/index.d.ts +4 -3
  31. package/dist/src/index.d.ts.map +1 -1
  32. package/dist/src/index.js +3 -1
  33. package/dist/src/index.js.map +1 -1
  34. package/dist/src/ir.d.ts.map +1 -1
  35. package/dist/src/lex.d.ts.map +1 -1
  36. package/dist/src/lsp/server.d.ts +32 -0
  37. package/dist/src/lsp/server.d.ts.map +1 -0
  38. package/dist/src/lsp/server.js +391 -0
  39. package/dist/src/lsp/server.js.map +1 -0
  40. package/dist/src/modules.d.ts +2 -0
  41. package/dist/src/modules.d.ts.map +1 -1
  42. package/dist/src/modules.js +14 -14
  43. package/dist/src/modules.js.map +1 -1
  44. package/dist/src/parse.js +3 -3
  45. package/dist/src/parse.js.map +1 -1
  46. package/dist/src/std-bundle.d.ts +2 -0
  47. package/dist/src/std-bundle.d.ts.map +1 -0
  48. package/dist/src/std-bundle.js +88 -0
  49. package/dist/src/std-bundle.js.map +1 -0
  50. package/dist/src/std-library.d.ts +5 -0
  51. package/dist/src/std-library.d.ts.map +1 -0
  52. package/dist/src/std-library.js +9 -0
  53. package/dist/src/std-library.js.map +1 -0
  54. package/dist/src/typecheck.d.ts.map +1 -1
  55. package/dist/src/typecheck.js +859 -156
  56. package/dist/src/typecheck.js.map +1 -1
  57. package/dist/src/version.d.ts +1 -1
  58. package/dist/src/version.d.ts.map +1 -1
  59. package/dist/src/version.js +1 -1
  60. package/dist/src/version.js.map +1 -1
  61. package/docs/README.md +12 -0
  62. package/docs/assets/hsx.svg +18 -0
  63. package/docs/guide/01-first-program.md +2 -2
  64. package/docs/guide/02-money.md +1 -1
  65. package/docs/guide/03-instruments.md +44 -3
  66. package/docs/guide/04-lifecycles.md +18 -3
  67. package/docs/guide/05-fees-and-splits.md +2 -2
  68. package/docs/guide/06-schedules.md +1 -1
  69. package/docs/guide/07-composition.md +8 -2
  70. package/docs/guide/08-writing-a-module.md +13 -2
  71. package/docs/guide/09-cost.md +3 -3
  72. package/docs/guide/10-diagnostics.md +1 -1
  73. package/docs/llms-full.txt +458 -194
  74. package/docs/llms.txt +2 -2
  75. package/docs/playground.md +55 -0
  76. package/docs/reference/cli.md +5 -3
  77. package/docs/reference/diagnostics.md +223 -37
  78. package/docs/reference/grammar.md +2 -2
  79. package/docs/reference/std/advance.md +2 -2
  80. package/docs/reference/std/cancellable_booking.md +10 -10
  81. package/docs/reference/std/captured_payment.md +14 -14
  82. package/docs/reference/std/conditional_disbursement.md +3 -3
  83. package/docs/reference/std/credit_facility.md +2 -2
  84. package/docs/reference/std/held_payment.md +37 -33
  85. package/docs/reference/std/instant_transfer.md +8 -8
  86. package/docs/reference/std/metered.md +2 -2
  87. package/docs/reference/std/pooled_split.md +2 -2
  88. package/docs/reference/std/premium_forward.md +13 -13
  89. package/docs/reference/std/reconciled_payout.md +2 -2
  90. package/docs/reference/std/recurring_collection.md +2 -2
  91. package/docs/reference/std/rotating_pool.md +2 -2
  92. package/docs/reference/std/scheduled.md +18 -18
  93. package/docs/reference/std/security_deposit.md +14 -14
  94. package/docs/reference/std/settlement_batch.md +2 -2
  95. package/docs/reference/std/swap.md +18 -18
  96. package/docs/reference/std/threshold_pool.md +2 -2
  97. package/docs/reference/std/weighted_distribution.md +2 -2
  98. package/docs/reference/types.md +1 -1
  99. package/docs/reference/udl-output.md +2 -3
  100. package/examples/01-first-program/README.md +1 -1
  101. package/examples/01-first-program/tip-jar.hsx +1 -1
  102. package/examples/02-imports-and-archetypes/README.md +1 -4
  103. package/examples/02-imports-and-archetypes/photo-booth.hsx +1 -1
  104. package/examples/03-diagnostics/corner-shop-fixed.hsx +1 -1
  105. package/examples/03-diagnostics/corner-shop.hsx +1 -1
  106. package/examples/04-complete-product/README.md +0 -3
  107. package/examples/04-complete-product/study-hall.hsx +1 -1
  108. package/examples/05-watch-club/README.md +0 -3
  109. package/examples/05-watch-club/watch-club.hsx +1 -1
  110. package/examples/README.md +35 -4
  111. package/examples/advance/advance.hsx +1 -1
  112. package/examples/advance/advance.udl +10 -5
  113. package/examples/cancellable_booking/cancellable_booking.hsx +1 -1
  114. package/examples/cancellable_booking/cancellable_booking.udl +3 -1
  115. package/examples/captured_payment/captured_payment.hsx +1 -1
  116. package/examples/captured_payment/captured_payment.udl +4 -1
  117. package/examples/conditional_disbursement/conditional_disbursement.hsx +1 -1
  118. package/examples/conditional_disbursement/conditional_disbursement.udl +5 -3
  119. package/examples/cost-table.json +1602 -382
  120. package/examples/credit_facility/credit_facility.hsx +1 -1
  121. package/examples/credit_facility/credit_facility.udl +16 -9
  122. package/examples/held_payment/held_payment.hsx +1 -1
  123. package/examples/held_payment/held_payment.udl +38 -3
  124. package/examples/instant_transfer/instant_transfer.hsx +1 -1
  125. package/examples/instant_transfer/instant_transfer.udl +11 -5
  126. package/examples/metered/metered.hsx +1 -1
  127. package/examples/metered/metered.udl +4 -2
  128. package/examples/pooled_split/pooled_split.hsx +1 -1
  129. package/examples/pooled_split/pooled_split.udl +6 -3
  130. package/examples/premium_forward/premium_forward.hsx +1 -1
  131. package/examples/premium_forward/premium_forward.udl +10 -4
  132. package/examples/reconciled_payout/reconciled_payout.hsx +1 -1
  133. package/examples/reconciled_payout/reconciled_payout.udl +4 -2
  134. package/examples/recurring_collection/recurring_collection.hsx +1 -1
  135. package/examples/recurring_collection/recurring_collection.udl +12 -7
  136. package/examples/rotating_pool/rotating_pool.hsx +1 -1
  137. package/examples/rotating_pool/rotating_pool.udl +14 -4
  138. package/examples/scheduled/scheduled.hsx +1 -1
  139. package/examples/scheduled/scheduled.udl +9 -4
  140. package/examples/security_deposit/security_deposit.hsx +1 -1
  141. package/examples/security_deposit/security_deposit.udl +17 -3
  142. package/examples/settlement_batch/settlement_batch.hsx +1 -1
  143. package/examples/swap/swap.hsx +1 -1
  144. package/examples/swap/swap.udl +12 -6
  145. package/examples/threshold_pool/threshold_pool.hsx +1 -1
  146. package/examples/threshold_pool/threshold_pool.udl +4 -2
  147. package/examples/weighted_distribution/weighted_distribution.hsx +1 -1
  148. package/examples/weighted_distribution/weighted_distribution.udl +4 -2
  149. package/package.json +15 -6
  150. package/skills/hsx/SKILL.md +26 -26
  151. package/src/ast.ts +34 -2
  152. package/src/cli.ts +32 -13
  153. package/src/compile.ts +15 -7
  154. package/src/cost.ts +176 -104
  155. package/src/diagnostics.ts +89 -4
  156. package/src/emit.ts +34 -266
  157. package/src/index.ts +10 -7
  158. package/src/lsp/server.ts +460 -0
  159. package/src/modules.ts +21 -13
  160. package/src/parse.ts +3 -3
  161. package/src/std-bundle.ts +91 -0
  162. package/src/std-library.ts +12 -0
  163. package/src/typecheck.ts +1147 -235
  164. package/src/version.ts +1 -1
  165. package/std/SEMANTICS.md +12 -3
  166. package/std/{settlements → money_flows}/advance.hsx +1 -1
  167. package/std/{settlements → money_flows}/cancellable_booking.hsx +4 -3
  168. package/std/{settlements → money_flows}/captured_payment.hsx +35 -6
  169. package/std/{settlements → money_flows}/conditional_disbursement.hsx +17 -16
  170. package/std/{settlements → money_flows}/credit_facility.hsx +1 -2
  171. package/std/{settlements → money_flows}/held_payment.hsx +59 -25
  172. package/std/money_flows/index.hsx +3 -0
  173. package/std/{settlements → money_flows}/instant_transfer.hsx +2 -3
  174. package/std/{settlements → money_flows}/metered.hsx +1 -1
  175. package/std/{settlements → money_flows}/pooled_split.hsx +3 -3
  176. package/std/{settlements → money_flows}/premium_forward.hsx +22 -23
  177. package/std/{settlements → money_flows}/reconciled_payout.hsx +3 -3
  178. package/std/{settlements → money_flows}/recurring_collection.hsx +1 -1
  179. package/std/{settlements → money_flows}/rotating_pool.hsx +8 -6
  180. package/std/{settlements → money_flows}/scheduled.hsx +22 -27
  181. package/std/{settlements → money_flows}/security_deposit.hsx +38 -14
  182. package/std/{settlements → money_flows}/settlement_batch.hsx +3 -3
  183. package/std/{settlements → money_flows}/swap.hsx +41 -16
  184. package/std/{settlements → money_flows}/threshold_pool.hsx +5 -5
  185. package/std/{settlements → money_flows}/weighted_distribution.hsx +6 -6
  186. package/docs/sessions/2026-09-02-two-instruments.hsx +0 -21
  187. package/docs/sessions/2026-09-02-two-instruments.md +0 -41
  188. package/std/settlements/index.hsx +0 -3
@@ -1,5 +1,5 @@
1
1
  program credit_facility_example "Credit facility example"
2
- import { credit_facility, scheduled } from "std/settlements"
2
+ import { credit_facility, scheduled } from "std/money_flows"
3
3
  party lender: business
4
4
  party borrower: business
5
5
  party draw_destination: business
@@ -294,7 +294,8 @@
294
294
  "installment1Amount": {
295
295
  "description": "Stored amount for installment 1 of 2 (carries the integer-division remainder)",
296
296
  "pattern": "^[1-9][0-9]{0,17}$",
297
- "type": "string"
297
+ "type": "string",
298
+ "x-hyperscale-currency": "SAR"
298
299
  },
299
300
  "installment1DelinquentAfter": {
300
301
  "description": "Machine-set marker proving installment 1 reached its stored due date while unpaid",
@@ -304,7 +305,8 @@
304
305
  "installment2Amount": {
305
306
  "description": "Stored amount for installment 2 of 2",
306
307
  "pattern": "^[1-9][0-9]{0,17}$",
307
- "type": "string"
308
+ "type": "string",
309
+ "x-hyperscale-currency": "SAR"
308
310
  },
309
311
  "installment2DelinquentAfter": {
310
312
  "description": "Machine-set marker proving installment 2 reached its stored due date while unpaid",
@@ -325,7 +327,8 @@
325
327
  "principal": {
326
328
  "description": "The principal in SAR minor units; the stored installment anchors partition it exactly",
327
329
  "pattern": "^[1-9][0-9]{0,17}$",
328
- "type": "string"
330
+ "type": "string",
331
+ "x-hyperscale-currency": "SAR"
329
332
  },
330
333
  "repaymentSourceAccountId": {
331
334
  "description": "The repayment source account",
@@ -547,7 +550,7 @@
547
550
  "summary": "Refund this one stored installment 1 payment whole"
548
551
  },
549
552
  "repay": {
550
- "agentDescription": "Pay this record's amount toward installment 1. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, only the payer may call it and an evidence reference is required.",
553
+ "agentDescription": "Pay this record's amount toward installment 1. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, its declared parties may call it and an evidence reference is required.",
551
554
  "effects": {
552
555
  "moves": [
553
556
  {
@@ -643,7 +646,8 @@
643
646
  "amount": {
644
647
  "description": "Positive payment amount capped with its paid siblings at installment1Amount",
645
648
  "pattern": "^[1-9][0-9]{0,17}$",
646
- "type": "string"
649
+ "type": "string",
650
+ "x-hyperscale-currency": "SAR"
647
651
  },
648
652
  "currency": {
649
653
  "description": "ISO 4217 currency code",
@@ -834,7 +838,7 @@
834
838
  "summary": "Refund this one stored installment 2 payment whole"
835
839
  },
836
840
  "repay": {
837
- "agentDescription": "Pay this record's amount toward installment 2. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, only the payer may call it and an evidence reference is required.",
841
+ "agentDescription": "Pay this record's amount toward installment 2. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, its declared parties may call it and an evidence reference is required.",
838
842
  "effects": {
839
843
  "moves": [
840
844
  {
@@ -930,7 +934,8 @@
930
934
  "amount": {
931
935
  "description": "Positive payment amount capped with its paid siblings at installment2Amount",
932
936
  "pattern": "^[1-9][0-9]{0,17}$",
933
- "type": "string"
937
+ "type": "string",
938
+ "x-hyperscale-currency": "SAR"
934
939
  },
935
940
  "currency": {
936
941
  "description": "ISO 4217 currency code",
@@ -1104,7 +1109,8 @@
1104
1109
  "facilityLimit": {
1105
1110
  "description": "Facility limit in SAR minor units",
1106
1111
  "pattern": "^[1-9][0-9]{0,17}$",
1107
- "type": "string"
1112
+ "type": "string",
1113
+ "x-hyperscale-currency": "SAR"
1108
1114
  },
1109
1115
  "lenderAccountId": {
1110
1116
  "description": "The lender account",
@@ -1290,7 +1296,8 @@
1290
1296
  "amount": {
1291
1297
  "description": "One draw amount",
1292
1298
  "pattern": "^[1-9][0-9]{0,17}$",
1293
- "type": "string"
1299
+ "type": "string",
1300
+ "x-hyperscale-currency": "SAR"
1294
1301
  },
1295
1302
  "currency": {
1296
1303
  "description": "ISO 4217 currency code",
@@ -1,5 +1,5 @@
1
1
  program held_payment_example "Held payment example"
2
- import { held_payment } from "std/settlements"
2
+ import { held_payment } from "std/money_flows"
3
3
  party buyer: person
4
4
  party seller: business
5
5
  settlement sale = held_payment {
@@ -7,7 +7,9 @@
7
7
  "confirm_delivery",
8
8
  "release_on_deadline",
9
9
  "cancel",
10
- "abandon"
10
+ "abandon",
11
+ "dispute",
12
+ "resume"
11
13
  ],
12
14
  "actions": {
13
15
  "abandon": {
@@ -160,6 +162,7 @@
160
162
  ]
161
163
  },
162
164
  "publicAction": "confirmDeliverySale",
165
+ "sandboxFailurePoint": "release",
163
166
  "steps": [],
164
167
  "summary": "Confirm through confirm_delivery and start the release payout"
165
168
  },
@@ -199,6 +202,14 @@
199
202
  ],
200
203
  "summary": "Create a sale settlement"
201
204
  },
205
+ "dispute": {
206
+ "agentDescription": "Freeze a funded sale so neither release nor refund can run until the parties settle the disagreement. No money moves and the whole balance stays put. Only a funded sale disputes.",
207
+ "description": "Freezes funded sale, preserving the entire balance while the parties decide what happens next.",
208
+ "moves": [],
209
+ "publicAction": "disputeSale",
210
+ "steps": [],
211
+ "summary": "Dispute a sale settlement"
212
+ },
202
213
  "fund_piece_1": {
203
214
  "agentDescription": "Move the buyer's money into this settlement's escrow. Call it after create and before any release. It debits the buyer for real, and where the product charges a payer-side fee that fee is taken on top in the same call. Only a later release or unwind moves the money again.",
204
215
  "effects": {
@@ -298,6 +309,7 @@
298
309
  }
299
310
  ],
300
311
  "publicAction": "fundPiece1Sale",
312
+ "sandboxFailurePoint": "funding",
301
313
  "steps": [],
302
314
  "summary": "Fund piece 1 of the held amount into escrow"
303
315
  },
@@ -364,6 +376,14 @@
364
376
  ],
365
377
  "steps": [],
366
378
  "summary": "Release to the seller when releaseDueAt arrives undecided"
379
+ },
380
+ "resume": {
381
+ "agentDescription": "Lift the dispute hold and put the sale back where it was, funded and ready to release. No money moves and the balance was never touched. Only a disputed sale resumes. Use this when the parties settled without a refund.",
382
+ "description": "Ends the dispute hold without moving money and returns the fully funded sale to its first milestone.",
383
+ "moves": [],
384
+ "publicAction": "resumeSale",
385
+ "steps": [],
386
+ "summary": "Resume a sale settlement"
367
387
  }
368
388
  },
369
389
  "agentDescription": "Reach for sale when the buyer must commit money up front and nobody is paid until confirm_delivery fires. Funding moves price into this settlement's own escrow account, where it stays until a release or an unwind pays it out. A straight-through payment with no custody step is a different shape.",
@@ -415,7 +435,8 @@
415
435
  "price": {
416
436
  "description": "The held amount in SAR minor units, funded and paid out whole",
417
437
  "pattern": "^[1-9][0-9]{0,17}$",
418
- "type": "string"
438
+ "type": "string",
439
+ "x-hyperscale-currency": "SAR"
419
440
  },
420
441
  "releaseDueAt": {
421
442
  "description": "The date an undecided hold releases to the seller on; confirm_delivery and cancellation decide only before it",
@@ -436,7 +457,8 @@
436
457
  "serviceFeeAmount": {
437
458
  "description": "Machine-owned 1% service fee computed from price; charged on top at funding",
438
459
  "pattern": "^[1-9][0-9]{0,17}$",
439
- "type": "string"
460
+ "type": "string",
461
+ "x-hyperscale-currency": "SAR"
440
462
  }
441
463
  },
442
464
  "id": "sale",
@@ -446,6 +468,7 @@
446
468
  "states": [
447
469
  "created",
448
470
  "funded",
471
+ "disputed",
449
472
  "released",
450
473
  "cancelled",
451
474
  "abandoned"
@@ -469,6 +492,12 @@
469
492
  ],
470
493
  "to": "released"
471
494
  },
495
+ "dispute": {
496
+ "from": [
497
+ "funded"
498
+ ],
499
+ "to": "disputed"
500
+ },
472
501
  "fund_piece_1": {
473
502
  "from": [
474
503
  "created"
@@ -480,6 +509,12 @@
480
509
  "funded"
481
510
  ],
482
511
  "to": "released"
512
+ },
513
+ "resume": {
514
+ "from": [
515
+ "disputed"
516
+ ],
517
+ "to": "funded"
483
518
  }
484
519
  }
485
520
  },
@@ -1,5 +1,5 @@
1
1
  program instant_transfer_example "Instant transfer example"
2
- import { instant_transfer } from "std/settlements"
2
+ import { instant_transfer } from "std/money_flows"
3
3
  party customer: person
4
4
  party merchant: business
5
5
  settlement transfer = instant_transfer {
@@ -126,6 +126,7 @@
126
126
  }
127
127
  ],
128
128
  "publicAction": "payPiece1Transfer",
129
+ "sandboxFailurePoint": "funding",
129
130
  "steps": [],
130
131
  "summary": "Pay piece 1 of the amount through"
131
132
  },
@@ -233,12 +234,14 @@
233
234
  "carvedFeeAmount": {
234
235
  "description": "The carved platform fee selected from transferAmount",
235
236
  "pattern": "^[1-9][0-9]{0,17}$",
236
- "type": "string"
237
+ "type": "string",
238
+ "x-hyperscale-currency": "SAR"
237
239
  },
238
240
  "checkoutFee": {
239
241
  "description": "Immutable exact customer fee in SAR minor units",
240
242
  "pattern": "^[1-9][0-9]{0,17}$",
241
- "type": "string"
243
+ "type": "string",
244
+ "x-hyperscale-currency": "SAR"
242
245
  },
243
246
  "currency": {
244
247
  "description": "ISO 4217 currency code",
@@ -261,7 +264,8 @@
261
264
  "highValueFee": {
262
265
  "description": "Immutable exact merchant fee in SAR minor units",
263
266
  "pattern": "^[1-9][0-9]{0,17}$",
264
- "type": "string"
267
+ "type": "string",
268
+ "x-hyperscale-currency": "SAR"
265
269
  },
266
270
  "merchantAccountId": {
267
271
  "description": "The merchant account",
@@ -277,7 +281,8 @@
277
281
  "netOfCarvedFeeAmount": {
278
282
  "description": "The remainder of transferAmount after the carved platform fee",
279
283
  "pattern": "^[1-9][0-9]{0,17}$",
280
- "type": "string"
284
+ "type": "string",
285
+ "x-hyperscale-currency": "SAR"
281
286
  },
282
287
  "platformAccountId": {
283
288
  "description": "The product fee collection account",
@@ -295,7 +300,8 @@
295
300
  "transferAmount": {
296
301
  "description": "The gross amount in SAR minor units; the piece fields below partition it exactly",
297
302
  "pattern": "^[1-9][0-9]{0,17}$",
298
- "type": "string"
303
+ "type": "string",
304
+ "x-hyperscale-currency": "SAR"
299
305
  }
300
306
  },
301
307
  "id": "transfer",
@@ -1,5 +1,5 @@
1
1
  program metered_example "Metered example"
2
- import { metered } from "std/settlements"
2
+ import { metered } from "std/money_flows"
3
3
  party customer: business
4
4
  party provider: business
5
5
  settlement usage = metered {
@@ -152,7 +152,8 @@
152
152
  "callRate": {
153
153
  "description": "Per-unit price of api call in SAR minor units, committed at period open",
154
154
  "pattern": "^[1-9][0-9]{0,17}$",
155
- "type": "string"
155
+ "type": "string",
156
+ "x-hyperscale-currency": "SAR"
156
157
  },
157
158
  "currency": {
158
159
  "description": "ISO 4217 currency code",
@@ -191,7 +192,8 @@
191
192
  "storageRate": {
192
193
  "description": "Per-unit price of storage gib in SAR minor units, committed at period open",
193
194
  "pattern": "^[1-9][0-9]{0,17}$",
194
- "type": "string"
195
+ "type": "string",
196
+ "x-hyperscale-currency": "SAR"
195
197
  }
196
198
  },
197
199
  "id": "usage",
@@ -1,5 +1,5 @@
1
1
  program pooled_split_example "Pooled split example"
2
- import { pooled_split } from "std/settlements"
2
+ import { pooled_split } from "std/money_flows"
3
3
  party payer: business
4
4
  party first_recipient: business
5
5
  party second_recipient: business
@@ -312,7 +312,8 @@
312
312
  "firstRecipientShareAmount": {
313
313
  "description": "60% of poolAmount (carries the integer-division remainder): the first recipient's share. Computed as floor(poolAmount * 6000 / 10000) in SAR minor units",
314
314
  "pattern": "^[1-9][0-9]{0,17}$",
315
- "type": "string"
315
+ "type": "string",
316
+ "x-hyperscale-currency": "SAR"
316
317
  },
317
318
  "payerAccountId": {
318
319
  "description": "The payer account",
@@ -333,7 +334,8 @@
333
334
  "poolAmount": {
334
335
  "description": "The pooled period total in SAR minor units; the share fields below partition it exactly",
335
336
  "pattern": "^[1-9][0-9]{0,17}$",
336
- "type": "string"
337
+ "type": "string",
338
+ "x-hyperscale-currency": "SAR"
337
339
  },
338
340
  "secondRecipientAccountId": {
339
341
  "description": "The second recipient account",
@@ -349,7 +351,8 @@
349
351
  "secondRecipientShareAmount": {
350
352
  "description": "40% of poolAmount: the second recipient's share. Computed as floor(poolAmount * 4000 / 10000) in SAR minor units",
351
353
  "pattern": "^[1-9][0-9]{0,17}$",
352
- "type": "string"
354
+ "type": "string",
355
+ "x-hyperscale-currency": "SAR"
353
356
  }
354
357
  },
355
358
  "id": "pool",
@@ -1,5 +1,5 @@
1
1
  program premium_forward_example "Premium forward example"
2
- import { premium_forward } from "std/settlements"
2
+ import { premium_forward } from "std/money_flows"
3
3
  party policyholder: person
4
4
  party carrier: business
5
5
  settlement premium = premium_forward {
@@ -95,6 +95,7 @@
95
95
  ]
96
96
  },
97
97
  "publicAction": "bindPolicyPremium",
98
+ "sandboxFailurePoint": "release",
98
99
  "steps": [],
99
100
  "summary": "Confirm through bind_policy and start the forward payout"
100
101
  },
@@ -245,6 +246,7 @@
245
246
  }
246
247
  ],
247
248
  "publicAction": "fundPiece1Premium",
249
+ "sandboxFailurePoint": "funding",
248
250
  "steps": [],
249
251
  "summary": "Fund piece 1 of the held amount into escrow"
250
252
  },
@@ -302,6 +304,7 @@
302
304
  }
303
305
  ],
304
306
  "publicAction": "fundPiece2Premium",
307
+ "sandboxFailurePoint": "funding",
305
308
  "steps": [],
306
309
  "summary": "Fund piece 2 of the held amount into escrow"
307
310
  },
@@ -327,7 +330,7 @@
327
330
  "record_endorsement": {
328
331
  "agentDescription": "Record one endorsement against a policy that already forwarded, from evidence the caller supplies. The forward must be released first, and only the carrier may call it. It moves no money and it does not change the premium.",
329
332
  "captureInput": {
330
- "endorsementEvidenceReference": "evidenceReference"
333
+ "evidenceReference": "evidenceReference"
331
334
  },
332
335
  "effects": {
333
336
  "decides": [
@@ -444,12 +447,14 @@
444
447
  "piece1Amount": {
445
448
  "description": "98% of premiumAmount (carries the integer-division remainder): released to the carrier. Computed as floor(premiumAmount * 9800 / 10000) in SAR minor units",
446
449
  "pattern": "^[1-9][0-9]{0,17}$",
447
- "type": "string"
450
+ "type": "string",
451
+ "x-hyperscale-currency": "SAR"
448
452
  },
449
453
  "piece2Amount": {
450
454
  "description": "2% of premiumAmount: released to the platform. Computed as floor(premiumAmount * 200 / 10000) in SAR minor units",
451
455
  "pattern": "^[1-9][0-9]{0,17}$",
452
- "type": "string"
456
+ "type": "string",
457
+ "x-hyperscale-currency": "SAR"
453
458
  },
454
459
  "platformAccountId": {
455
460
  "description": "The product fee collection account",
@@ -484,7 +489,8 @@
484
489
  "premiumAmount": {
485
490
  "description": "The gross held amount in SAR minor units; the piece fields below partition it exactly",
486
491
  "pattern": "^[1-9][0-9]{0,17}$",
487
- "type": "string"
492
+ "type": "string",
493
+ "x-hyperscale-currency": "SAR"
488
494
  },
489
495
  "renewalDueAt": {
490
496
  "description": "Stored renewal due condition for the forwarded policy",
@@ -1,5 +1,5 @@
1
1
  program reconciled_payout_example "Reconciled payout example"
2
- import { reconciled_payout } from "std/settlements"
2
+ import { reconciled_payout } from "std/money_flows"
3
3
  party treasury: business
4
4
  party supplier: business
5
5
  settlement supplier_payout = reconciled_payout {
@@ -108,7 +108,8 @@
108
108
  "netPayable": {
109
109
  "description": "Amount instructed to the supplier in minor units",
110
110
  "pattern": "^[1-9][0-9]{0,17}$",
111
- "type": "string"
111
+ "type": "string",
112
+ "x-hyperscale-currency": "SAR"
112
113
  },
113
114
  "settleBy": {
114
115
  "description": "Instant the expectation stops waiting and the unmatched amount becomes a break",
@@ -265,7 +266,8 @@
265
266
  "unmatchedAmount": {
266
267
  "description": "Difference between the instructed amount and the evidence, in minor units",
267
268
  "pattern": "^[1-9][0-9]{0,17}$",
268
- "type": "string"
269
+ "type": "string",
270
+ "x-hyperscale-currency": "SAR"
269
271
  }
270
272
  },
271
273
  "id": "supplier_payout_break",
@@ -1,5 +1,5 @@
1
1
  program recurring_collection_example "Recurring collection example"
2
- import { recurring_collection, scheduled } from "std/settlements"
2
+ import { recurring_collection, scheduled } from "std/money_flows"
3
3
  party debtor: person
4
4
  party repayment_source: business
5
5
  party recipient: business
@@ -294,7 +294,8 @@
294
294
  "installment1Amount": {
295
295
  "description": "Stored amount for installment 1 of 2 (carries the integer-division remainder)",
296
296
  "pattern": "^[1-9][0-9]{0,17}$",
297
- "type": "string"
297
+ "type": "string",
298
+ "x-hyperscale-currency": "SAR"
298
299
  },
299
300
  "installment1DelinquentAfter": {
300
301
  "description": "Machine-set marker proving installment 1 reached its stored due date while unpaid",
@@ -304,7 +305,8 @@
304
305
  "installment2Amount": {
305
306
  "description": "Stored amount for installment 2 of 2",
306
307
  "pattern": "^[1-9][0-9]{0,17}$",
307
- "type": "string"
308
+ "type": "string",
309
+ "x-hyperscale-currency": "SAR"
308
310
  },
309
311
  "installment2DelinquentAfter": {
310
312
  "description": "Machine-set marker proving installment 2 reached its stored due date while unpaid",
@@ -314,7 +316,8 @@
314
316
  "principal": {
315
317
  "description": "The principal in SAR minor units; the stored installment anchors partition it exactly",
316
318
  "pattern": "^[1-9][0-9]{0,17}$",
317
- "type": "string"
319
+ "type": "string",
320
+ "x-hyperscale-currency": "SAR"
318
321
  },
319
322
  "recipientAccountId": {
320
323
  "description": "The recipient account",
@@ -547,7 +550,7 @@
547
550
  "summary": "Refund this one stored installment 1 payment whole"
548
551
  },
549
552
  "repay": {
550
- "agentDescription": "Pay this record's amount toward installment 1. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, only the payer may call it and an evidence reference is required.",
553
+ "agentDescription": "Pay this record's amount toward installment 1. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, its declared parties may call it and an evidence reference is required.",
551
554
  "captureInput": {
552
555
  "mandateEvidenceReference": "evidenceReference"
553
556
  },
@@ -672,7 +675,8 @@
672
675
  "amount": {
673
676
  "description": "Positive payment amount capped with its paid siblings at installment1Amount",
674
677
  "pattern": "^[1-9][0-9]{0,17}$",
675
- "type": "string"
678
+ "type": "string",
679
+ "x-hyperscale-currency": "SAR"
676
680
  },
677
681
  "currency": {
678
682
  "description": "ISO 4217 currency code",
@@ -863,7 +867,7 @@
863
867
  "summary": "Refund this one stored installment 2 payment whole"
864
868
  },
865
869
  "repay": {
866
- "agentDescription": "Pay this record's amount toward installment 2. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, only the payer may call it and an evidence reference is required.",
870
+ "agentDescription": "Pay this record's amount toward installment 2. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, its declared parties may call it and an evidence reference is required.",
867
871
  "captureInput": {
868
872
  "mandateEvidenceReference": "evidenceReference"
869
873
  },
@@ -988,7 +992,8 @@
988
992
  "amount": {
989
993
  "description": "Positive payment amount capped with its paid siblings at installment2Amount",
990
994
  "pattern": "^[1-9][0-9]{0,17}$",
991
- "type": "string"
995
+ "type": "string",
996
+ "x-hyperscale-currency": "SAR"
992
997
  },
993
998
  "currency": {
994
999
  "description": "ISO 4217 currency code",
@@ -1,5 +1,5 @@
1
1
  program rotating_pool_example "Rotating pool example"
2
- import { rotating_pool } from "std/settlements"
2
+ import { rotating_pool } from "std/money_flows"
3
3
  party member_a: person
4
4
  party member_b: person
5
5
  party member_c: person
@@ -396,7 +396,8 @@
396
396
  "contributionAmount": {
397
397
  "description": "Exact contribution in SAR minor units",
398
398
  "pattern": "^[1-9][0-9]{0,17}$",
399
- "type": "string"
399
+ "type": "string",
400
+ "x-hyperscale-currency": "SAR"
400
401
  },
401
402
  "currency": {
402
403
  "description": "ISO 4217 currency code",
@@ -648,6 +649,7 @@
648
649
  ]
649
650
  }
650
651
  ],
652
+ "sandboxFailurePoint": "funding",
651
653
  "steps": [],
652
654
  "summary": "Fund member a's cycle 1 contribution"
653
655
  },
@@ -1244,6 +1246,7 @@
1244
1246
  ]
1245
1247
  }
1246
1248
  ],
1249
+ "sandboxFailurePoint": "release",
1247
1250
  "steps": [],
1248
1251
  "summary": "Pay this member's stored contribution into cycle 1's shared pot recipient"
1249
1252
  },
@@ -1609,7 +1612,8 @@
1609
1612
  "contributionAmount": {
1610
1613
  "description": "Exact contribution amount shared by every cycle",
1611
1614
  "pattern": "^[1-9][0-9]{0,17}$",
1612
- "type": "string"
1615
+ "type": "string",
1616
+ "x-hyperscale-currency": "SAR"
1613
1617
  },
1614
1618
  "currency": {
1615
1619
  "description": "ISO 4217 currency code",
@@ -1915,6 +1919,7 @@
1915
1919
  ]
1916
1920
  }
1917
1921
  ],
1922
+ "sandboxFailurePoint": "funding",
1918
1923
  "steps": [],
1919
1924
  "summary": "Fund member b's cycle 1 contribution"
1920
1925
  },
@@ -2511,6 +2516,7 @@
2511
2516
  ]
2512
2517
  }
2513
2518
  ],
2519
+ "sandboxFailurePoint": "release",
2514
2520
  "steps": [],
2515
2521
  "summary": "Pay this member's stored contribution into cycle 1's shared pot recipient"
2516
2522
  },
@@ -2876,7 +2882,8 @@
2876
2882
  "contributionAmount": {
2877
2883
  "description": "Exact contribution amount shared by every cycle",
2878
2884
  "pattern": "^[1-9][0-9]{0,17}$",
2879
- "type": "string"
2885
+ "type": "string",
2886
+ "x-hyperscale-currency": "SAR"
2880
2887
  },
2881
2888
  "currency": {
2882
2889
  "description": "ISO 4217 currency code",
@@ -3182,6 +3189,7 @@
3182
3189
  ]
3183
3190
  }
3184
3191
  ],
3192
+ "sandboxFailurePoint": "funding",
3185
3193
  "steps": [],
3186
3194
  "summary": "Fund member c's cycle 1 contribution"
3187
3195
  },
@@ -3778,6 +3786,7 @@
3778
3786
  ]
3779
3787
  }
3780
3788
  ],
3789
+ "sandboxFailurePoint": "release",
3781
3790
  "steps": [],
3782
3791
  "summary": "Pay this member's stored contribution into cycle 1's shared pot recipient"
3783
3792
  },
@@ -4143,7 +4152,8 @@
4143
4152
  "contributionAmount": {
4144
4153
  "description": "Exact contribution amount shared by every cycle",
4145
4154
  "pattern": "^[1-9][0-9]{0,17}$",
4146
- "type": "string"
4155
+ "type": "string",
4156
+ "x-hyperscale-currency": "SAR"
4147
4157
  },
4148
4158
  "currency": {
4149
4159
  "description": "ISO 4217 currency code",
@@ -1,5 +1,5 @@
1
1
  program scheduled_example "Scheduled example"
2
- import { scheduled } from "std/settlements"
2
+ import { scheduled } from "std/money_flows"
3
3
  party payer: business
4
4
  party payee: business
5
5
  settlement installments = scheduled {
@@ -76,6 +76,7 @@
76
76
  "operation": "internal_transfer.create"
77
77
  }
78
78
  ],
79
+ "sandboxFailurePoint": "funding",
79
80
  "steps": [],
80
81
  "summary": "Collect installment 1 of 3"
81
82
  },
@@ -228,17 +229,20 @@
228
229
  "installment1Amount": {
229
230
  "description": "Installment 1 of 3 (carries the integer-division remainder): about 33.34% of totalAmount, collected on its own stored-date anchor",
230
231
  "pattern": "^[1-9][0-9]{0,17}$",
231
- "type": "string"
232
+ "type": "string",
233
+ "x-hyperscale-currency": "SAR"
232
234
  },
233
235
  "installment2Amount": {
234
236
  "description": "Installment 2 of 3: about 33.33% of totalAmount, collected on its own stored-date anchor",
235
237
  "pattern": "^[1-9][0-9]{0,17}$",
236
- "type": "string"
238
+ "type": "string",
239
+ "x-hyperscale-currency": "SAR"
237
240
  },
238
241
  "installment3Amount": {
239
242
  "description": "Installment 3 of 3: about 33.33% of totalAmount, collected on its own stored-date anchor",
240
243
  "pattern": "^[1-9][0-9]{0,17}$",
241
- "type": "string"
244
+ "type": "string",
245
+ "x-hyperscale-currency": "SAR"
242
246
  },
243
247
  "payeeAccountId": {
244
248
  "description": "The payee account",
@@ -265,7 +269,8 @@
265
269
  "totalAmount": {
266
270
  "description": "The total scheduled amount in SAR minor units; the installment fields below partition it exactly",
267
271
  "pattern": "^[1-9][0-9]{0,17}$",
268
- "type": "string"
272
+ "type": "string",
273
+ "x-hyperscale-currency": "SAR"
269
274
  }
270
275
  },
271
276
  "id": "installments",