@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
@@ -215,7 +215,8 @@
215
215
  "feeAmount": {
216
216
  "description": "2.5% of principal, the funder's discount repaid on top of the advance",
217
217
  "pattern": "^[1-9][0-9]{0,17}$",
218
- "type": "string"
218
+ "type": "string",
219
+ "x-hyperscale-currency": "SAR"
219
220
  },
220
221
  "firstDueAt": {
221
222
  "description": "Due date of the first repayment; repayment k falls P30D after its predecessor",
@@ -236,7 +237,8 @@
236
237
  "principal": {
237
238
  "description": "The advanced amount in SAR minor units, disbursed to the recipient up front",
238
239
  "pattern": "^[1-9][0-9]{0,17}$",
239
- "type": "string"
240
+ "type": "string",
241
+ "x-hyperscale-currency": "SAR"
240
242
  },
241
243
  "recipientAccountId": {
242
244
  "description": "The recipient account",
@@ -252,17 +254,20 @@
252
254
  "repayableAmount": {
253
255
  "description": "principal + feeAmount: the total the repayment fields below partition exactly",
254
256
  "pattern": "^[1-9][0-9]{0,17}$",
255
- "type": "string"
257
+ "type": "string",
258
+ "x-hyperscale-currency": "SAR"
256
259
  },
257
260
  "repayment1Amount": {
258
261
  "description": "Repayment 1 of 2 (carries the integer-division remainder): about 33.34% of repayableAmount, collected on its own stored-date anchor",
259
262
  "pattern": "^[1-9][0-9]{0,17}$",
260
- "type": "string"
263
+ "type": "string",
264
+ "x-hyperscale-currency": "SAR"
261
265
  },
262
266
  "repayment2Amount": {
263
267
  "description": "Repayment 2 of 2: about 33.33% of repayableAmount, collected on its own stored-date anchor",
264
268
  "pattern": "^[1-9][0-9]{0,17}$",
265
- "type": "string"
269
+ "type": "string",
270
+ "x-hyperscale-currency": "SAR"
266
271
  }
267
272
  },
268
273
  "id": "advance_payment",
@@ -1,5 +1,5 @@
1
1
  program cancellable_booking_example "Cancellable booking example"
2
- import { cancellable_booking } from "std/settlements"
2
+ import { cancellable_booking } from "std/money_flows"
3
3
  party guest: person
4
4
  party studio: business
5
5
  settlement studio_session = cancellable_booking {
@@ -275,6 +275,7 @@
275
275
  }
276
276
  ],
277
277
  "publicAction": "takeStudioSession",
278
+ "sandboxFailurePoint": "funding",
278
279
  "steps": [],
279
280
  "summary": "Take the booking price from the guest into the holding account"
280
281
  }
@@ -303,7 +304,8 @@
303
304
  "sessionPrice": {
304
305
  "description": "Booking price in minor units, held away from both the guest and the studio until the booking ends",
305
306
  "pattern": "^[1-9][0-9]{0,17}$",
306
- "type": "string"
307
+ "type": "string",
308
+ "x-hyperscale-currency": "SAR"
307
309
  },
308
310
  "startsAt": {
309
311
  "description": "When the booking starts; the cancellation penalty is priced against the time left before it",
@@ -1,5 +1,5 @@
1
1
  program captured_payment_example "Captured payment example"
2
- import { captured_payment } from "std/settlements"
2
+ import { captured_payment } from "std/money_flows"
3
3
  party payer: person
4
4
  party payee: business
5
5
  settlement card_payment = captured_payment {
@@ -74,6 +74,7 @@
74
74
  }
75
75
  ],
76
76
  "publicAction": "authorizeCardPayment",
77
+ "sandboxFailurePoint": "funding",
77
78
  "steps": [],
78
79
  "summary": "Reserve the authorizedAmount until reserveUntil"
79
80
  },
@@ -138,6 +139,7 @@
138
139
  }
139
140
  ],
140
141
  "publicAction": "captureCardPayment",
142
+ "sandboxFailurePoint": "release",
141
143
  "steps": [],
142
144
  "summary": "Post one strict partial capture slice"
143
145
  },
@@ -540,7 +542,8 @@
540
542
  "authorizedAmount": {
541
543
  "description": "Maximum captured amount in SAR minor units",
542
544
  "pattern": "^[1-9][0-9]{0,17}$",
543
- "type": "string"
545
+ "type": "string",
546
+ "x-hyperscale-currency": "SAR"
544
547
  },
545
548
  "currency": {
546
549
  "description": "ISO 4217 currency code",
@@ -1,5 +1,5 @@
1
1
  program conditional_disbursement_example "Conditional disbursement example"
2
- import { conditional_disbursement } from "std/settlements"
2
+ import { conditional_disbursement } from "std/money_flows"
3
3
  party source: business
4
4
  party claimant: person
5
5
  settlement claim_payment = conditional_disbursement {
@@ -16,7 +16,7 @@
16
16
  "deny": {
17
17
  "agentDescription": "Refuse the whole disbursement without moving money. Every child amount under it must still be unapproved, so call this before any approval lands. The caller passes evidenceReference, which stays in the receipt. Denial is final.",
18
18
  "captureInput": {
19
- "decisionEvidenceReference": "evidenceReference"
19
+ "evidenceReference": "evidenceReference"
20
20
  },
21
21
  "effects": {
22
22
  "decides": [
@@ -95,7 +95,8 @@
95
95
  "policyLimit": {
96
96
  "description": "Disbursement cap in SAR minor units",
97
97
  "pattern": "^[1-9][0-9]{0,17}$",
98
- "type": "string"
98
+ "type": "string",
99
+ "x-hyperscale-currency": "SAR"
99
100
  },
100
101
  "sourceAccountId": {
101
102
  "description": "The source account",
@@ -328,7 +329,8 @@
328
329
  "amount": {
329
330
  "description": "Approved amount under the parent cap",
330
331
  "pattern": "^[1-9][0-9]{0,17}$",
331
- "type": "string"
332
+ "type": "string",
333
+ "x-hyperscale-currency": "SAR"
332
334
  },
333
335
  "claimPaymentId": {
334
336
  "description": "The exact claim_payment",