@hyperscale0/hsx 2.4.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.
Files changed (249) hide show
  1. package/CHANGELOG.md +4 -406
  2. package/README.md +3 -92
  3. package/dist/src/ast.d.ts +99 -310
  4. package/dist/src/ast.d.ts.map +1 -1
  5. package/dist/src/ast.js +16 -69
  6. package/dist/src/ast.js.map +1 -1
  7. package/dist/src/cli.d.ts +6 -19
  8. package/dist/src/cli.d.ts.map +1 -1
  9. package/dist/src/cli.js +77 -315
  10. package/dist/src/cli.js.map +1 -1
  11. package/dist/src/compile.d.ts +23 -73
  12. package/dist/src/compile.d.ts.map +1 -1
  13. package/dist/src/compile.js +1113 -148
  14. package/dist/src/compile.js.map +1 -1
  15. package/dist/src/cost.d.ts +8 -77
  16. package/dist/src/cost.d.ts.map +1 -1
  17. package/dist/src/cost.js +13 -422
  18. package/dist/src/cost.js.map +1 -1
  19. package/dist/src/format.d.ts +8 -7
  20. package/dist/src/format.d.ts.map +1 -1
  21. package/dist/src/format.js +9 -175
  22. package/dist/src/format.js.map +1 -1
  23. package/dist/src/headers.d.ts +35 -0
  24. package/dist/src/headers.d.ts.map +1 -0
  25. package/dist/src/headers.js +108 -0
  26. package/dist/src/headers.js.map +1 -0
  27. package/dist/src/index.d.ts +6 -12
  28. package/dist/src/index.d.ts.map +1 -1
  29. package/dist/src/index.js +4 -9
  30. package/dist/src/index.js.map +1 -1
  31. package/dist/src/lex.d.ts +8 -28
  32. package/dist/src/lex.d.ts.map +1 -1
  33. package/dist/src/lex.js +88 -146
  34. package/dist/src/lex.js.map +1 -1
  35. package/dist/src/parse.d.ts +4 -17
  36. package/dist/src/parse.d.ts.map +1 -1
  37. package/dist/src/parse.js +402 -1040
  38. package/dist/src/parse.js.map +1 -1
  39. package/dist/src/std-bundle.d.ts.map +1 -1
  40. package/dist/src/std-bundle.js +12 -20
  41. package/dist/src/std-bundle.js.map +1 -1
  42. package/dist/src/std-library.d.ts +1 -1
  43. package/dist/src/std-library.d.ts.map +1 -1
  44. package/dist/src/std-library.js +1 -5
  45. package/dist/src/std-library.js.map +1 -1
  46. package/dist/src/tunables.d.ts +7 -0
  47. package/dist/src/tunables.d.ts.map +1 -0
  48. package/dist/src/tunables.js +26 -0
  49. package/dist/src/tunables.js.map +1 -0
  50. package/dist/src/version.d.ts +2 -4
  51. package/dist/src/version.d.ts.map +1 -1
  52. package/dist/src/version.js +2 -4
  53. package/dist/src/version.js.map +1 -1
  54. package/docs/README.md +179 -41
  55. package/docs/headers.md +44 -0
  56. package/examples/cost-table.json +99 -751
  57. package/examples/library.hsx +59 -0
  58. package/package.json +9 -17
  59. package/src/ast.ts +82 -441
  60. package/src/cli.ts +78 -362
  61. package/src/compile.ts +1535 -247
  62. package/src/cost.ts +28 -671
  63. package/src/format.ts +12 -256
  64. package/src/headers.ts +126 -0
  65. package/src/index.ts +7 -39
  66. package/src/lex.ts +99 -195
  67. package/src/parse.ts +403 -1209
  68. package/src/std-bundle.ts +12 -20
  69. package/src/std-library.ts +2 -7
  70. package/src/tunables.ts +31 -0
  71. package/src/version.ts +2 -5
  72. package/std/approvals.hsx +17 -0
  73. package/std/cards.hsx +63 -0
  74. package/std/collections.hsx +31 -0
  75. package/std/escrow.hsx +43 -0
  76. package/std/financing.hsx +372 -0
  77. package/std/insurance.hsx +59 -0
  78. package/std/lending.hsx +115 -0
  79. package/std/marketplace.hsx +24 -0
  80. package/std/money.hsx +195 -0
  81. package/std/savings.hsx +44 -0
  82. package/std/travel.hsx +98 -0
  83. package/std/wallet.hsx +41 -0
  84. package/dist/src/diagnostics.d.ts +0 -13
  85. package/dist/src/diagnostics.d.ts.map +0 -1
  86. package/dist/src/diagnostics.js +0 -587
  87. package/dist/src/diagnostics.js.map +0 -1
  88. package/dist/src/emit.d.ts +0 -51
  89. package/dist/src/emit.d.ts.map +0 -1
  90. package/dist/src/emit.js +0 -192
  91. package/dist/src/emit.js.map +0 -1
  92. package/dist/src/entry-overrides.d.ts +0 -58
  93. package/dist/src/entry-overrides.d.ts.map +0 -1
  94. package/dist/src/entry-overrides.js +0 -284
  95. package/dist/src/entry-overrides.js.map +0 -1
  96. package/dist/src/ir.d.ts +0 -73
  97. package/dist/src/ir.d.ts.map +0 -1
  98. package/dist/src/ir.js +0 -15
  99. package/dist/src/ir.js.map +0 -1
  100. package/dist/src/limits.d.ts +0 -23
  101. package/dist/src/limits.d.ts.map +0 -1
  102. package/dist/src/limits.js +0 -23
  103. package/dist/src/limits.js.map +0 -1
  104. package/dist/src/lsp/server.d.ts +0 -32
  105. package/dist/src/lsp/server.d.ts.map +0 -1
  106. package/dist/src/lsp/server.js +0 -391
  107. package/dist/src/lsp/server.js.map +0 -1
  108. package/dist/src/modules.d.ts +0 -38
  109. package/dist/src/modules.d.ts.map +0 -1
  110. package/dist/src/modules.js +0 -372
  111. package/dist/src/modules.js.map +0 -1
  112. package/dist/src/typecheck.d.ts +0 -8
  113. package/dist/src/typecheck.d.ts.map +0 -1
  114. package/dist/src/typecheck.js +0 -4160
  115. package/dist/src/typecheck.js.map +0 -1
  116. package/docs/guide/01-first-program.md +0 -24
  117. package/docs/guide/02-money.md +0 -25
  118. package/docs/guide/03-instruments.md +0 -93
  119. package/docs/guide/04-lifecycles.md +0 -40
  120. package/docs/guide/05-fees-and-splits.md +0 -45
  121. package/docs/guide/06-schedules.md +0 -26
  122. package/docs/guide/07-composition.md +0 -52
  123. package/docs/guide/08-writing-a-module.md +0 -85
  124. package/docs/guide/09-cost.md +0 -24
  125. package/docs/guide/10-diagnostics.md +0 -27
  126. package/docs/llms-full.txt +0 -3684
  127. package/docs/llms.txt +0 -44
  128. package/docs/piece-plans.md +0 -120
  129. package/docs/playground.md +0 -55
  130. package/docs/reference/cli.md +0 -36
  131. package/docs/reference/diagnostics.md +0 -901
  132. package/docs/reference/grammar.md +0 -38
  133. package/docs/reference/std/advance.md +0 -112
  134. package/docs/reference/std/cancellable_booking.md +0 -159
  135. package/docs/reference/std/captured_payment.md +0 -115
  136. package/docs/reference/std/conditional_disbursement.md +0 -101
  137. package/docs/reference/std/credit_facility.md +0 -108
  138. package/docs/reference/std/held_payment.md +0 -173
  139. package/docs/reference/std/instant_transfer.md +0 -97
  140. package/docs/reference/std/metered.md +0 -89
  141. package/docs/reference/std/pooled_split.md +0 -95
  142. package/docs/reference/std/premium_forward.md +0 -119
  143. package/docs/reference/std/reconciled_payout.md +0 -103
  144. package/docs/reference/std/rotating_pool.md +0 -130
  145. package/docs/reference/std/scheduled.md +0 -136
  146. package/docs/reference/std/security_deposit.md +0 -138
  147. package/docs/reference/std/settlement_batch.md +0 -123
  148. package/docs/reference/std/swap.md +0 -133
  149. package/docs/reference/std/threshold_pool.md +0 -138
  150. package/docs/reference/std/weighted_distribution.md +0 -135
  151. package/docs/reference/types.md +0 -61
  152. package/docs/reference/udl-output.md +0 -13
  153. package/examples/01-first-program/README.md +0 -45
  154. package/examples/01-first-program/tip-jar.hsx +0 -17
  155. package/examples/02-imports-and-modules/README.md +0 -96
  156. package/examples/02-imports-and-modules/photo-booth.hsx +0 -37
  157. package/examples/03-diagnostics/README.md +0 -68
  158. package/examples/03-diagnostics/corner-shop-fixed.hsx +0 -22
  159. package/examples/03-diagnostics/corner-shop.hsx +0 -19
  160. package/examples/04-complete-product/README.md +0 -84
  161. package/examples/04-complete-product/study-hall.hsx +0 -67
  162. package/examples/05-authored-instrument/README.md +0 -5
  163. package/examples/05-authored-instrument/payment.hsx +0 -37
  164. package/examples/05-watch-club/README.md +0 -6
  165. package/examples/05-watch-club/watch-club.hsx +0 -123
  166. package/examples/README.md +0 -48
  167. package/examples/advance/README.md +0 -3
  168. package/examples/advance/advance.hsx +0 -13
  169. package/examples/advance/advance.udl +0 -367
  170. package/examples/cancellable_booking/README.md +0 -3
  171. package/examples/cancellable_booking/cancellable_booking.hsx +0 -14
  172. package/examples/cancellable_booking/cancellable_booking.udl +0 -413
  173. package/examples/captured_payment/README.md +0 -3
  174. package/examples/captured_payment/captured_payment.hsx +0 -17
  175. package/examples/captured_payment/captured_payment.udl +0 -686
  176. package/examples/conditional_disbursement/README.md +0 -3
  177. package/examples/conditional_disbursement/conditional_disbursement.hsx +0 -15
  178. package/examples/conditional_disbursement/conditional_disbursement.udl +0 -418
  179. package/examples/credit_facility/README.md +0 -3
  180. package/examples/credit_facility/credit_facility.hsx +0 -24
  181. package/examples/credit_facility/credit_facility.udl +0 -1396
  182. package/examples/held_payment/README.md +0 -3
  183. package/examples/held_payment/held_payment.hsx +0 -13
  184. package/examples/held_payment/held_payment.udl +0 -569
  185. package/examples/instant_transfer/README.md +0 -3
  186. package/examples/instant_transfer/instant_transfer.hsx +0 -16
  187. package/examples/instant_transfer/instant_transfer.udl +0 -376
  188. package/examples/metered/README.md +0 -3
  189. package/examples/metered/metered.hsx +0 -13
  190. package/examples/metered/metered.udl +0 -253
  191. package/examples/pooled_split/README.md +0 -3
  192. package/examples/pooled_split/pooled_split.hsx +0 -15
  193. package/examples/pooled_split/pooled_split.udl +0 -432
  194. package/examples/premium_forward/README.md +0 -3
  195. package/examples/premium_forward/premium_forward.hsx +0 -19
  196. package/examples/premium_forward/premium_forward.udl +0 -604
  197. package/examples/reconciled_payout/README.md +0 -3
  198. package/examples/reconciled_payout/reconciled_payout.hsx +0 -13
  199. package/examples/reconciled_payout/reconciled_payout.udl +0 -312
  200. package/examples/rotating_pool/README.md +0 -3
  201. package/examples/rotating_pool/rotating_pool.hsx +0 -18
  202. package/examples/rotating_pool/rotating_pool.udl +0 -4370
  203. package/examples/scheduled/README.md +0 -3
  204. package/examples/scheduled/scheduled.hsx +0 -12
  205. package/examples/scheduled/scheduled.udl +0 -355
  206. package/examples/security_deposit/README.md +0 -3
  207. package/examples/security_deposit/security_deposit.hsx +0 -21
  208. package/examples/security_deposit/security_deposit.udl +0 -320
  209. package/examples/settlement_batch/README.md +0 -3
  210. package/examples/settlement_batch/settlement_batch.hsx +0 -19
  211. package/examples/settlement_batch/settlement_batch.udl +0 -757
  212. package/examples/swap/README.md +0 -3
  213. package/examples/swap/swap.hsx +0 -19
  214. package/examples/swap/swap.udl +0 -892
  215. package/examples/threshold_pool/README.md +0 -3
  216. package/examples/threshold_pool/threshold_pool.hsx +0 -16
  217. package/examples/threshold_pool/threshold_pool.udl +0 -680
  218. package/examples/weighted_distribution/README.md +0 -3
  219. package/examples/weighted_distribution/weighted_distribution.hsx +0 -20
  220. package/examples/weighted_distribution/weighted_distribution.udl +0 -348
  221. package/skills/hsx/SKILL.md +0 -449
  222. package/src/diagnostics.ts +0 -620
  223. package/src/emit.ts +0 -282
  224. package/src/entry-overrides.ts +0 -428
  225. package/src/ir.ts +0 -113
  226. package/src/limits.ts +0 -22
  227. package/src/lsp/server.ts +0 -460
  228. package/src/modules.ts +0 -452
  229. package/src/typecheck.ts +0 -5515
  230. package/std/SEMANTICS.md +0 -44
  231. package/std/money_flows/advance.hsx +0 -235
  232. package/std/money_flows/cancellable_booking.hsx +0 -402
  233. package/std/money_flows/captured_payment.hsx +0 -220
  234. package/std/money_flows/conditional_disbursement.hsx +0 -226
  235. package/std/money_flows/credit_facility.hsx +0 -214
  236. package/std/money_flows/held_payment.hsx +0 -812
  237. package/std/money_flows/index.hsx +0 -4
  238. package/std/money_flows/instant_transfer.hsx +0 -231
  239. package/std/money_flows/metered.hsx +0 -104
  240. package/std/money_flows/pooled_split.hsx +0 -109
  241. package/std/money_flows/premium_forward.hsx +0 -307
  242. package/std/money_flows/reconciled_payout.hsx +0 -119
  243. package/std/money_flows/rotating_pool.hsx +0 -305
  244. package/std/money_flows/scheduled.hsx +0 -599
  245. package/std/money_flows/security_deposit.hsx +0 -248
  246. package/std/money_flows/settlement_batch.hsx +0 -173
  247. package/std/money_flows/swap.hsx +0 -1192
  248. package/std/money_flows/threshold_pool.hsx +0 -307
  249. package/std/money_flows/weighted_distribution.hsx +0 -237
package/CHANGELOG.md CHANGED
@@ -1,409 +1,7 @@
1
- # Changelog
1
+ # HSX 3.0.1
2
2
 
3
- All notable changes to this package are documented here. The format follows
4
- [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this package
5
- follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
3
+ std financing: `payment.pay` collects slice by slice in position order (profit before principal under `fines_profit_principal`, principal first under `principal_profit`) and selects pending and due slices only, so paid slices stay paid. The CLI reports the package version from `version.ts`.
6
4
 
7
- The IR format version (`"hsx": 1`, stamped into every compiled document) moves
8
- independently of the package version.
5
+ # HSX 3.0.0
9
6
 
10
- ## [2.4.1] - 2026-09-17
11
-
12
- Pairs with UDL 2.6.0.
13
-
14
- ### Fixed
15
-
16
- - `prefix()` resolves declared instrument `id_prefix` from the catalogue or authored program when known to compilation, falling back to derived initials only when undeclared.
17
-
18
- ## [2.4.0] - 2026-09-17
19
-
20
- Pairs with UDL 2.6.0.
21
-
22
- ### Added
23
-
24
- - `collects` parameter on `cancellable_booking` to cascade named actions to linked instruments on deposit.
25
-
26
- ## [2.3.0] - 2026-09-17
27
-
28
- Pairs with UDL 2.5.0.
29
-
30
- ### Added
31
-
32
- - `allow_zero: true` on a `money<C>` field admits a zero amount; the default still refuses zero. `allow_zero` on any other type is HSX1105. Decision port shapes set it on their money fields.
33
-
34
- ### Changed
35
-
36
- - `date` fields admit any RFC 3339 offset, such as `+03:00`; the host stores the UTC instant. Values already in `Z` pass through unchanged.
37
-
38
- ### Docs
39
-
40
- - The instruments guide gains "Money fields" and "Date fields" sections covering both rules.
41
-
42
- ## [2.2.1] - 2026-09-16
43
-
44
- Pairs with UDL 2.4.0.
45
-
46
- ### Fixed
47
-
48
- - `cancellable_booking` pins its four priced-booking account fields to the `customer_balance` role, so programs that import it pass the host's account-role admission law.
49
- - Pin receipt distribution fee, tax and residual accounts to customer balances.
50
- - Lower omitted and full-refund unpaid cancellation bands as deposit refunds. Refuse constant cancellation partitions that exceed the deposit.
51
-
52
- ### Docs
53
-
54
- - The instruments guide teaches the `"x-hyperscale-reference-filter"` role pin on account fields, and the generated type reference repeats it.
55
-
56
- ## [2.2.0] - 2026-09-15
57
-
58
- Pairs with UDL 2.4.0.
59
-
60
- ### Added
61
-
62
- - General lowering for allocation, `requiresAllocation`, `templateBinding`, children buckets, unique account fields and allocation-backed exposure measures. Signed schedules, stored rates, referenced transitions, equal partitions, contributions and attested decisions retain their UDL contracts.
63
- - Custody vocabulary: `shift_date`, `requiresExposure.groupField` and `minimumField`, `funding` and `receiptDistribution`.
64
- - `cancellable_booking` accepts finite `cancel_bands`, deposit/balance custody, supplier shares, confirmation release and timeout refunds. `held_payment.private_actions` lets a program select its public aliases.
65
- - `threshold_pool.funding_join` binds frozen wallet tickets to priced funding. `weighted_distribution` receipt mode derives ticket ratios, carves fee and VAT, pays a named residual and allocates noncash losses.
66
- - A complete authored cash-movement example and checkout CLI instructions. Generated std references include parameter tables and clause coverage across branches.
67
-
68
- ### Changed
69
-
70
- - `advance` derives profit from principal, separates repayment and profit parties, and accepts signed dates. `scheduled` expands finite slice lists and preserves other delinquent slices.
71
- - Remove the empty `recurring_collection` module, unused std parameters, the journeys clause and the Blueprint cost dimension.
72
-
73
- ## [2.1.1] - 2026-09-15
74
-
75
- Published in lockstep with UDL 2.3.0.
76
-
77
- ### Added
78
-
79
- - `docs/piece-plans.md`, a guide to partitioned totals: declaring pieces, orders and payees, staging one piece per action, and reading the compiled plan.
80
-
81
- ## [2.1.0] - 2026-09-14
82
-
83
- Published in lockstep with UDL 2.1.0.
84
-
85
- ### Added
86
-
87
- - `piece_plan` declares a partitioned total with named pieces, immutable release and refund payees, and fund, release, refund and unfund orders. `piece_stage` on an action moves one piece and derives the `pieceId` input from the selected order.
88
- - `calls` on an action invoke typed private actions from an `action_library`, binding parameters and capturing results. Public and authored calls lower to the same leaf origins, and the compiled document round-trips calls and piece plans losslessly.
89
- - Diagnostics `HSX1610` (piece partition), `HSX1611` (piece stage), `HSX1612` (action graph), `HSX1613` (static call binding), `HSX1614` (action boundary) and `HSX1615` (leaf evidence and effects), each mapped from its UDL counterpart. `HSX1601` and `HSX1602` now take their fix text from the diagnostic table.
90
- - The cost kernel prices every expanded leaf of a call and refuses a leaf without a price (`HSX1301`).
91
-
92
- ### Changed
93
-
94
- - The VS Code extension is titled "Hyperscale HSX". The README and playground carry the design-language brand assets.
95
- - `HSX_LIMITS.maxExpansions` (256) bounds action-graph expansion; the typechecker's own limit is gone.
96
-
97
- ## [2.0.5] - 2026-09-11
98
-
99
- ### Fixed
100
-
101
- - Print diagnostic codes next to severity, stage, and location on compiler and formatter error paths so `hsx explain <code>` works.
102
- - Reconcile `version.ts` with `package.json`.
103
-
104
- ## [2.0.4] - 2026-09-11
105
-
106
- Published in lockstep with UDL 2.0.4.
107
-
108
- ### Added
109
-
110
- - Diagnostic `HSX1026` reports a decision port field whose declared type differs from the type its instrument captures for that field. It runs only when the compiler is given a published catalog, so plain CLI compiles are unchanged.
111
-
112
- ### Fixed
113
-
114
- - The standard `held_payment` flow accepts `quote_cancellation` again from `cancellation_quoted`, so an expired offer can be re-quoted instead of trapping the deal.
115
- - `held_payment` admits a dispute from `cancellation_quoted`.
116
- - A `held_payment` cancellation with `cancel_charge_bps` of zero settles without emitting a zero-amount retain transfer.
117
-
118
- ## [2.0.3] - 2026-09-10
119
-
120
- Published in lockstep with UDL 2.0.3.
121
-
122
- ### Added
123
-
124
- - The quote clause key `charge_retained_by` lowers to the UDL `chargeRetainedBy` declaration, so an instrument can say which party keeps a cancellation charge. The lowering rides the generic key mapping that 2.0.2 already shipped; this release pins it with a test.
125
-
126
- ## [2.0.2] - 2026-09-10
127
-
128
- ### Added
129
-
130
- - `held_payment` takes an opt-in quoted cancellation with an authored flat charge, so a cancellation quote can name the amount the refund source keeps.
131
- - `std/money_flows/weighted_distribution` flow.
132
- - Every std flow describes itself: the reference pages carry parameters and an example for each flow, and the guide documents the sandbox.
133
-
134
- ### Removed
135
-
136
- - The GitHub Actions workflows. Publishing runs from the platform release lane.
137
-
138
- ## [2.0.1] - 2026-09-10
139
-
140
- Published in lockstep with UDL 2.0.1.
141
-
142
- ### Added
143
-
144
- - Pinned the currency of every move of a `money<CUR>` field, and of every account step in a fixed-currency instrument, to the constant `CUR` in the lowered document; a binding that reads the instrument's currency field is rewritten, and one the compiler cannot pin (an input, a ref, or a constant naming another currency) reports `HSX1306`.
145
-
146
- ### Changed
147
-
148
- - Anchored `dispute` on `held_payment` to `release_deadline` like `cancel`, so a dispute after the release deadline refuses instead of freezing money the clock already released.
149
- - Declared the safe-integer maximum on `share_offering.totalShares` and `share_allocation.shares` so the lowered schema round-trips byte for byte.
150
-
151
- ## [2.0.0] - 2026-09-10
152
-
153
- ### Added
154
-
155
- - Added `hsx lsp` over stdio with diagnostics and formatting, and a VS Code language client.
156
- - Added a static browser playground under `playground/` with debounced compilation, diagnostics inspection, span navigation, canonical UDL and cost manifest inspection, and inlined examples.
157
- - Bundled standard library sources as data in `src/std-bundle.ts` and decoupled compiler module resolution from Node filesystem imports.
158
- - Lowered money fields with an `x-hyperscale-currency` schema marker so consumers read the ledger currency without parsing descriptions.
159
- - Accepted an array of cost tables (`examples/cost-table.json` now ships one card per priced currency); the compiler prices the card matching the program's ledger currency, reporting `HSX1304` for an unpriced currency and `HSX1305` for a program that moves money in two currencies.
160
- - Reported `HSX1509` when an instrument, or an action a caller can reach, lacks an `agent_description`.
161
- - Declared `sandbox_failure_point` on the std money-flow fund and release actions so sandbox failures land on a named step.
162
- - Added `share_offering` and `share_allocation` std instruments with an integer-sum supply invariant, `dispute` and `resume` on `held_payment`, and `quote_refund` and `confirm_refund` on policy programs.
163
- - Bound decision port parties through declared account fields; a decision-only party binds to an account and decides without holding money, and every action a port reaches carries its allowed parties.
164
-
165
- ### Changed
166
-
167
- - Lowered `account<CUR>` fields with the `acct_(sandbox|live)_...` pattern.
168
- - Diagnosed `allowed:` written on an action instead of its port, and refused ports whose allowed parties are not declared (`HSX1024`).
169
- - Field descriptions are prose in the lowered document and no longer part of the frozen schema.
170
- - Moved LSP server exports (`startLspServer`, `createHostForUri`, and LSP types) from the package root to `@hyperscale0/hsx/lsp`.
171
-
172
- ### Removed
173
-
174
- - Deleted the Business Frame artifact (`frame`) from the compiler output and CLI build command.
175
-
176
- ## [1.0.0] - 2026-09-04
177
-
178
- This release is byte-identical to 1.0.0-rc.1.
179
-
180
- ## [1.0.0-rc.1] - 2026-09-02
181
-
182
- ### Added
183
-
184
- - Added the repository guide, generated compiler reference, `llms.txt`, and
185
- `llms-full.txt`. Tests compile every guide program and compare generated
186
- files byte for byte.
187
- - Added one compiled example and pinned canonical UDL file for every standard
188
- library module.
189
- - Added the public HSX agent skill and moved language examples into it.
190
- - Added `hsx explain` for the stable diagnostics catalog.
191
- - Added a generated VS Code grammar, standard-library snippets, and a CI-built
192
- `hsx.vsix` artifact.
193
-
194
- ### Changed
195
-
196
- - `hsx cost` now prints a versioned effect table by default. `--json` prints the
197
- complete manifest, and `--out <file.json>` writes that JSON. Basis-point rows
198
- label their total as amount-dependent because the compiler has no priced
199
- runtime amount. No cost flags were removed.
200
- - The npm package now includes `docs/` and `skills/`. It no longer lists the
201
- deleted `spec/` directory.
202
- - The package exports its shipped standard-library files through `./std/*`.
203
-
204
- ### Fixed
205
-
206
- - Diagnostics raised from an imported module now name that module and its own
207
- source coordinates.
208
- - `premium_forward` now reports `HSX1011` when endorsement selects a path that
209
- needs `renewal_due`. It no longer reaches an internal lowering refusal.
210
-
211
- ## [1.0.0-beta.1] - 2026-08-29
212
-
213
- - This is the first beta and has no package behavior changes from
214
- 1.0.0-alpha.6.
215
-
216
- ## [1.0.0-alpha.6] - 2026-08-29
217
-
218
- ### Fixed
219
-
220
- - Alpha.6 carries a `held_payment` or `premium_forward` release port's actor
221
- allowlist and declared input fields into the generated release action. Alpha.5
222
- kept those constraints in the checked program and Business Frame but dropped
223
- them from HSX-JSON IR, so a runtime consuming the IR could admit the release
224
- without the declared actor or evidence. Recompile affected programs with
225
- alpha.6.
226
-
227
- ## [1.0.0-alpha.5] - 2026-08-29
228
-
229
- ### Added
230
-
231
- - Six settlement modules now compile and lower. `threshold_pool` caps locked
232
- commitments and contributor count, then collects or refunds each commitment
233
- whole. `weighted_distribution` freezes evidence-backed weights and pays by
234
- deterministic largest remainder. `credit_facility` owns draw capacity while
235
- a referenced `scheduled` obligation owns repayment. the retired collection tracker
236
- adds mandate evidence and explicit attempts to that obligation.
237
- `conditional_disbursement` stores one evidence-approved amount under a cap.
238
- `rotating_pool` fixes its roster, contribution, due anchors, and payout order
239
- before activation. Import the required module from `"settlement"` and
240
- supply every policy entry that its reference table marks as required.
241
- - Any settlement may declare one `derived_amount` block. The runtime computes
242
- `floor(source * bps / 10000)` from a stored money field and callers omit the
243
- target field. Version 1 accepts percentage rules from 1 through 9,999 basis
244
- points. The checker refuses fixed rules, tiered rules, missing source fields,
245
- non-money source fields, and target fields that already exist.
246
- - `captured_payment` reserves a payer amount for strict partial captures before
247
- a stored deadline. The payee may settle the remainder, void before capture,
248
- or use separate full-only correction and externally decided reversal ports.
249
- Declare the required capture, correction, negative-position, and timeout
250
- policies explicitly. Compose another settlement when capture fees are
251
- needed, because this module refuses `fees`.
252
- - `settlement_batch` freezes capture lineage and signed adjustments at a stored
253
- close date, persists gross, credit, debit, and net subtotals, and instructs
254
- one payout from the frozen net. Supply lineage field names, the payout
255
- destination and beneficiary reference, and an acknowledgement port. Apply a
256
- correction to a later open batch instead of changing a closed batch.
257
- - `overrideProgramEntries()`, `Program`, and the typed override and issue shapes
258
- are public package exports. The function replaces existing integer or
259
- basis-point literals in a parsed `Program`, then callers run the checker and
260
- lowerer again. Every
261
- override declares inclusive integer bounds. Negative, fractional, `NaN`,
262
- infinite, out-of-range, missing, ambiguous, and non-literal targets return
263
- coded issues, and one bad override prevents every replacement from being
264
- returned.
265
- - `premium_forward` accepts an optional stored policy reference, one non-money
266
- endorsement port, a renewal due condition, and explicit-new-forward renewal.
267
- Supply `policy_ref`, `renewal_due`, `renewal_policy`, `endorsement`,
268
- `endorsement_policy`, and `lapse_policy` together when the forward needs
269
- endorsement, lapse, or renewal behavior. The original forwarding shape
270
- remains valid.
271
-
272
- ### Changed
273
-
274
- - `scheduled` accepts `mode: obligation` for installment obligations. It emits
275
- one payment instrument per anchor, binds each payment to its obligation and anchor,
276
- allows partial and early payments, and refunds one stored paid row whole.
277
- Obligation mode accepts 2 through 7 anchors and refuses rescheduling. Use the
278
- original transfer schedule without `mode`, or declare the debtor and every
279
- obligation policy explicitly.
280
- - The program money-event budget is 20 instead of 14, and every settlement has
281
- its own event cap. Advance carves now validate their amount field, currency,
282
- recourse, and fee rules. Settlement references resolve through
283
- module-declared exits, and lowering binds referenced instrument identity,
284
- statuses, amounts, and currency before movement. Recompile programs that
285
- previously sat near the budget or used an advance carve. The stricter checker
286
- may refuse a carve or reference that alpha.4 accepted.
287
- - HSX-JSON IR version 1 grew new instrument fields for generated-child prefixes,
288
- aggregate invariants, derived amounts, typed references, beneficiary IDs,
289
- currency, text, counts, and constants. Actions gained public actions, reference
290
- bindings, captured input, payout instructions, signed sums, deterministic
291
- distribution, aggregate and exposure checks, and durable-settlement gates.
292
- Money events gained fixed, remaining-balance, and runtime-bounded amount
293
- modes with dependency lists. Consumers that validate or interpret IR version
294
- 1 must adopt alpha.5's schema before accepting alpha.5 output.
295
- - `settlement_batch` now requires `payout_beneficiary_ref`. Instruct emits a
296
- payout intent and captures `payoutId` instead of emitting an internal
297
- transfer. A system-only reconcile transition records `settlementEvidenceId`
298
- after durable evidence matches that payout. The tenant acknowledgement port
299
- remains a separate claim.
300
-
301
- ## [1.0.0-alpha.4] - 2026-08-26
302
-
303
- ### Removed
304
-
305
- - Eleven names left the package entry point: the AST types `BlockExpr`,
306
- `CallExpr`, `ListExpr`, `PercentExpr`, `PortDecl`, `PortRefExpr`, and
307
- `SettlementDecl`, plus `lineColAt`, `CompileResult`, `HSX_IR_VERSION`, and
308
- `HSX_VERSION`. Nothing outside this package imported any of them, and the
309
- seven AST types were seven of the twenty-two the tree defines, chosen by no
310
- rule anyone could restate. What the entry point exports now is what callers
311
- use: `compile`, `checkProgram`, `lowerProgram`, `parseProgram`, and
312
- `MONEY_EVENT_BUDGET`. Every removed name still exists in its own module for
313
- the compiler's own use. Read the IR format version off the compiled
314
- document's `hsx` field, which is what `spec/hsx-ir.schema.json` pins and what
315
- a consumer of the JSON artifact already holds.
316
-
317
- ## [1.0.0-alpha.3] - 2026-08-25
318
-
319
- ### Fixed
320
-
321
- - `compile()` no longer throws on a deeply nested source. Lists, blocks, calls,
322
- and bindings are parsed by recursion and nothing bounded it, so a file
323
- nesting past roughly 9,000 levels exhausted the call stack and a `RangeError`
324
- escaped `compile()`, which SECURITY.md says never happens. Parsing stops at
325
- the depth budget now and reports an ordinary parse diagnostic. The deepest
326
- program in the corpus nests 5 levels.
327
- - Diagnostic coordinates cost O(n + d log n) instead of O(n·d). `compile()`
328
- resolved every diagnostic by rescanning the source from offset zero. On the
329
- largest file this release will read, 262,144 bytes carrying one diagnostic
330
- per two bytes, that was 10,304 ms of line and column arithmetic for 131,072
331
- diagnostics while the parse itself took 18 ms. It scans once and
332
- binary-searches now: same coordinates, 2.6 ms.
333
-
334
- ### Added
335
-
336
- - Two source limits, both checked before the program is read. A file over
337
- 262,144 UTF-8 bytes, the same ceiling UDL uses, is refused before the lexer
338
- runs. Nesting is refused past a parser depth budget of 64.
339
-
340
- The depth budget counts nested expressions and blocks, which is not the same
341
- number as source levels: `key { … }` spends one per level and `key: { … }`
342
- spends two, so the budget buys 63 levels of the first and 31 of the second.
343
- The release reference carried the conversion for every shape. Both refusals are
344
- ordinary parse diagnostics, not exceptions.
345
-
346
- ## [1.0.0-alpha.2] - 2026-08-23
347
-
348
- ### Fixed
349
-
350
- - `bin` points at the built JavaScript; alpha.1's registry metadata pointed at
351
- TypeScript source. npm builds the packument from package.json as it sits on
352
- disk after `postpack`, so the pack-time rewrite never reached `bin`, and
353
- every install linked `.bin/hsx` to `bin/hsx.ts`, which Node refuses to
354
- execute.
355
-
356
- ### Changed
357
-
358
- - Licensed AGPL-3.0-only with a commercial license from Hyperscale LLC;
359
- copyright holder Hyperscale LLC; repository renamed to
360
- `hyperscale0/hyperscale-hsx`.
361
-
362
- ## [1.0.0-alpha.1] - 2026-08-22
363
-
364
- First public release.
365
- This is the first version published as a package anyone can install.
366
-
367
- ### Added
368
-
369
- - `compile(source)`, the three-verdict driver: `valid`, `warning`, and
370
- `invalid`, with diagnostics carrying 1-indexed line and column, a severity,
371
- and the stage that raised them.
372
- - The stage entry points `parseProgram`, `checkProgram`, and `lowerProgram`,
373
- for tools that need one stage rather than the whole compile.
374
- - `HSX_IR_VERSION`, exported and stamped into every compiled document as its
375
- `hsx` field, so a consumer can decide from one integer whether it
376
- understands the document. `HSX_VERSION` carries the package version.
377
- - The `hsx` command: `hsx check <file> [--strict]` and
378
- `hsx build <file> [--out <file>] [--strict]`. Exit codes are `0` compiled,
379
- `1` refused, `2` unusable command line or input.
380
- - `spec/hsx-ir.schema.json`, JSON Schema 2020-12 for the HSX-JSON IR document
381
- and the Business Frame. Every `.hsx` file in the repository is validated
382
- against it in CI.
383
- - The release reference: the lexical grammar, the EBNF the parser accepts, what
384
- each stage does, the diagnostic model, and all nine `settlement` modules
385
- with their parameters and constraints.
386
- - `examples/`, four teaching programs compiled by the test suite.
387
- - `editors/vscode/`, a TextMate grammar for syntax highlighting.
388
-
389
- ### Known limitations
390
-
391
- - **Diagnostics have no stable codes.** Match on `severity` and `stage`, which
392
- are stable; do not pattern-match on message text. Codes would be additive
393
- and are the obvious next step.
394
- - **There is no formatter.** `hsx fmt` does not exist rather than existing
395
- badly.
396
- - **One program carries at most 14 money events** (`MONEY_EVENT_BUDGET`). A
397
- program that needs more is refused with a diagnostic saying so.
398
- - **`party` takes no attribute block yet**, though the grammar parses one.
399
-
400
- [Unreleased]: https://github.com/hyperscale0/hyperscale-hsx/compare/v1.0.0...HEAD
401
- [1.0.0]: https://github.com/hyperscale0/hyperscale-hsx/compare/v1.0.0-rc.1...v1.0.0
402
- [1.0.0-rc.1]: https://github.com/hyperscale0/hyperscale-hsx/compare/v1.0.0-beta.1...v1.0.0-rc.1
403
- [1.0.0-beta.1]: https://github.com/hyperscale0/hyperscale-hsx/compare/v1.0.0-alpha.6...v1.0.0-beta.1
404
- [1.0.0-alpha.6]: https://github.com/hyperscale0/hyperscale-hsx/compare/v1.0.0-alpha.5...v1.0.0-alpha.6
405
- [1.0.0-alpha.5]: https://github.com/hyperscale0/hyperscale-hsx/compare/v1.0.0-alpha.4...v1.0.0-alpha.5
406
- [1.0.0-alpha.4]: https://github.com/hyperscale0/hyperscale-hsx/compare/v1.0.0-alpha.3...v1.0.0-alpha.4
407
- [1.0.0-alpha.3]: https://github.com/hyperscale0/hyperscale-hsx/compare/v1.0.0-alpha.2...v1.0.0-alpha.3
408
- [1.0.0-alpha.2]: https://github.com/hyperscale0/hyperscale-hsx/compare/v1.0.0-alpha.1...v1.0.0-alpha.2
409
- [1.0.0-alpha.1]: https://github.com/hyperscale0/hyperscale-hsx/releases/tag/v1.0.0-alpha.1
7
+ Version 3 replaces the previous grammar. Recreate development estates. There is no migration reader.
package/README.md CHANGED
@@ -1,94 +1,5 @@
1
- <p align="left">
2
- <picture>
3
- <source media="(max-width: 600px) and (prefers-color-scheme: dark)" srcset="docs/assets/brand/hsx-stacked-white.svg">
4
- <source media="(max-width: 600px)" srcset="docs/assets/brand/hsx-stacked.svg">
5
- <source media="(prefers-color-scheme: dark)" srcset="docs/assets/brand/hsx-horizontal-white.svg">
6
- <source media="(prefers-color-scheme: light)" srcset="docs/assets/brand/hsx-horizontal.svg">
7
- <img src="docs/assets/brand/hsx-horizontal.svg" alt="Hyperscale™ HSX" width="335">
8
- </picture>
9
- </p>
1
+ # HSX 3
10
2
 
11
- # HSX
3
+ Read the [language reference](docs/README.md).
12
4
 
13
- Hyperscale™ HSX. Compile financial programs to canonical UDL.
14
-
15
- HSX is the strictly typed programming language for money on the Hyperscale operating system. It defines general instruments, composes money flows from the [money flows library](std/), checks currency-indexed linear money, and calculates deterministic execution costs at compile time. HSX compiles each accepted program to canonical UDL. It does not execute settlements, open network sockets, or manage provider accounts.
16
-
17
- ## Install
18
-
19
- ```sh
20
- npm install @hyperscale0/hsx @hyperscale0/udl
21
- ```
22
-
23
- Install the compiler globally or run it with `npx`:
24
-
25
- ```sh
26
- npm install -g @hyperscale0/hsx
27
- ```
28
-
29
- The VS Code extension package is available at https://hyperscale0.ai/downloads/hsx-vscode.vsix. Your editor extension runs `hsx lsp` to report diagnostics and format your document. It communicates through standard input and output.
30
-
31
- ## First program
32
-
33
- `tip-jar.hsx` is an example HSX program that moves money:
34
-
35
- ```hsx
36
- program tip_jar "Tip jar"
37
-
38
- import { instant_transfer } from "std/money_flows"
39
-
40
- party listener: person
41
- party host: business
42
-
43
- settlement tip = instant_transfer {
44
- payer: listener
45
- payee: host
46
- amount: tipAmount: money(SAR)
47
- }
48
- ```
49
-
50
- Check the program with the CLI:
51
-
52
- ```sh
53
- hsx check tip-jar.hsx
54
- ```
55
-
56
- Compile it to canonical UDL:
57
-
58
- ```sh
59
- hsx build tip-jar.hsx --out tip-jar.udl.json
60
- ```
61
-
62
- The CLI exits 0 for an accepted program, 1 for a refused program, and 2 when the command line or input file cannot be used.
63
-
64
- In TypeScript, compile a source string directly:
65
-
66
- ```ts
67
- import { compile } from "@hyperscale0/hsx";
68
-
69
- const result = compile(source, { costTable });
70
- if (result.verdict !== "invalid" && result.artifacts) {
71
- const { document, originMap, costManifest } = result.artifacts;
72
- }
73
- ```
74
-
75
- Programmatic compilation requires a `costTable` parameter. See the [cost documentation](docs/guide/09-cost.md#cost) for table structure and pricing semantics. The compiler returns three artifacts: `document` (the canonical UDL value), `originMap` (UDL paths mapped to source spans), and `costManifest` (deterministic compile-time costs).
76
-
77
- ## Documentation
78
-
79
- - [Guide and reading order](docs/README.md)
80
- - [Your first program](docs/guide/01-first-program.md)
81
- - [Standard library examples](examples/README.md)
82
- - [Browser playground](docs/playground.md)
83
- - [Compiler and language reference](docs/reference/)
84
- - [Contributing](CONTRIBUTING.md)
85
-
86
- ## License and security
87
-
88
- HSX is licensed under AGPL-3.0-only, with a commercial license available from Hyperscale LLC. See [LICENSE](LICENSE), [LICENSING.md](LICENSING.md), and [TRADEMARKS.md](TRADEMARKS.md).
89
-
90
- Vulnerability reports go through private disclosure as described in [SECURITY.md](SECURITY.md).
91
-
92
- ---
93
-
94
- Hyperscale™ is a trademark of Hyperscale LLC. Code licenses do not grant rights to the name or marks.
5
+ Run `bun run check` to build and check this package.