@hyperscale0/hsx 2.2.1 → 2.4.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 (47) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/dist/src/cli.d.ts +1 -1
  3. package/dist/src/diagnostics.d.ts.map +1 -1
  4. package/dist/src/diagnostics.js +7 -0
  5. package/dist/src/diagnostics.js.map +1 -1
  6. package/dist/src/std-bundle.js +2 -2
  7. package/dist/src/std-bundle.js.map +1 -1
  8. package/dist/src/typecheck.d.ts.map +1 -1
  9. package/dist/src/typecheck.js +36 -15
  10. package/dist/src/typecheck.js.map +1 -1
  11. package/dist/src/version.d.ts +1 -1
  12. package/dist/src/version.js +1 -1
  13. package/docs/guide/03-instruments.md +17 -0
  14. package/docs/llms-full.txt +61 -4
  15. package/docs/llms.txt +2 -2
  16. package/docs/reference/cli.md +2 -2
  17. package/docs/reference/diagnostics.md +21 -1
  18. package/docs/reference/grammar.md +2 -2
  19. package/docs/reference/std/advance.md +1 -1
  20. package/docs/reference/std/cancellable_booking.md +5 -2
  21. package/docs/reference/std/captured_payment.md +1 -1
  22. package/docs/reference/std/conditional_disbursement.md +1 -1
  23. package/docs/reference/std/credit_facility.md +1 -1
  24. package/docs/reference/std/held_payment.md +1 -1
  25. package/docs/reference/std/instant_transfer.md +1 -1
  26. package/docs/reference/std/metered.md +1 -1
  27. package/docs/reference/std/pooled_split.md +1 -1
  28. package/docs/reference/std/premium_forward.md +1 -1
  29. package/docs/reference/std/reconciled_payout.md +1 -1
  30. package/docs/reference/std/rotating_pool.md +1 -1
  31. package/docs/reference/std/scheduled.md +1 -1
  32. package/docs/reference/std/security_deposit.md +1 -1
  33. package/docs/reference/std/settlement_batch.md +1 -1
  34. package/docs/reference/std/swap.md +1 -1
  35. package/docs/reference/std/threshold_pool.md +1 -1
  36. package/docs/reference/std/weighted_distribution.md +1 -1
  37. package/docs/reference/types.md +18 -1
  38. package/docs/reference/udl-output.md +1 -1
  39. package/examples/cancellable_booking/cancellable_booking.udl +1 -0
  40. package/examples/cost-table.json +36 -4
  41. package/package.json +3 -3
  42. package/src/diagnostics.ts +7 -0
  43. package/src/std-bundle.ts +2 -2
  44. package/src/typecheck.ts +35 -15
  45. package/src/version.ts +1 -1
  46. package/std/money_flows/advance.hsx +1 -1
  47. package/std/money_flows/cancellable_booking.hsx +7 -5
@@ -1,5 +1,5 @@
1
1
  /** Package version reported by the command line. */
2
- export declare const HSX_VERSION = "2.2.1";
2
+ export declare const HSX_VERSION = "2.4.0";
3
3
  /** Canonical UDL contract version emitted by this compiler. */
4
4
  export declare const HSX_TARGET_UDL_VERSION = 1;
5
5
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /** Package version reported by the command line. */
2
- export const HSX_VERSION = "2.2.1";
2
+ export const HSX_VERSION = "2.4.0";
3
3
  /** Canonical UDL contract version emitted by this compiler. */
4
4
  export const HSX_TARGET_UDL_VERSION = 1;
5
5
  //# sourceMappingURL=version.js.map
@@ -45,6 +45,23 @@ with `column: role` and `values: [...]`. There is no shorter role annotation.
45
45
  A bare `customerAccountId: account<SAR>;` compiles as HSX but does not satisfy
46
46
  the host's account-role admission law.
47
47
 
48
+ ## Money fields
49
+
50
+ A `money<C>` field admits a minor-unit integer string and refuses zero: it lowers to the pattern `^[1-9][0-9]{0,17}$`. Marking the field `optional: true` lets a caller omit it; it does not let a caller send `"0"`. When zero is a real value for the field, opt in with `allow_zero: true`, which lowers to `^(0|[1-9][0-9]{0,17})$`:
51
+
52
+ ```hsx
53
+ fields {
54
+ amount: money<SAR>;
55
+ discount { type: money<SAR>; optional: true; allow_zero: true; }
56
+ }
57
+ ```
58
+
59
+ `allow_zero` on any other type is HSX1105. Decision port shapes set it on their money fields, because a decided amount may be zero.
60
+
61
+ ## Date fields
62
+
63
+ A `date` field lowers to the UDL `hyperscale-date-time` format. Callers may send any RFC 3339 offset, such as `2026-10-03T09:00:00+03:00`; the host admits it and stores the UTC instant, `2026-10-03T06:00:00.000Z`. A value already in `Z` is stored byte for byte. A local date-time without an offset is refused.
64
+
48
65
  ## Port declarations and action clauses
49
66
 
50
67
  HSX supports two distinct port syntaxes depending on scope:
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # HSX full documentation
4
4
 
@@ -100,6 +100,23 @@ with `column: role` and `values: [...]`. There is no shorter role annotation.
100
100
  A bare `customerAccountId: account<SAR>;` compiles as HSX but does not satisfy
101
101
  the host's account-role admission law.
102
102
 
103
+ ## Money fields
104
+
105
+ A `money<C>` field admits a minor-unit integer string and refuses zero: it lowers to the pattern `^[1-9][0-9]{0,17}$`. Marking the field `optional: true` lets a caller omit it; it does not let a caller send `"0"`. When zero is a real value for the field, opt in with `allow_zero: true`, which lowers to `^(0|[1-9][0-9]{0,17})$`:
106
+
107
+ ```hsx
108
+ fields {
109
+ amount: money<SAR>;
110
+ discount { type: money<SAR>; optional: true; allow_zero: true; }
111
+ }
112
+ ```
113
+
114
+ `allow_zero` on any other type is HSX1105. Decision port shapes set it on their money fields, because a decided amount may be zero.
115
+
116
+ ## Date fields
117
+
118
+ A `date` field lowers to the UDL `hyperscale-date-time` format. Callers may send any RFC 3339 offset, such as `2026-10-03T09:00:00+03:00`; the host admits it and stores the UTC instant, `2026-10-03T06:00:00.000Z`. A value already in `Z` is stored byte for byte. A local date-time without an offset is refused.
119
+
103
120
  ## Port declarations and action clauses
104
121
 
105
122
  HSX supports two distinct port syntaxes depending on scope:
@@ -439,7 +456,7 @@ Exit code `0` means the command accepted the program. Exit code `1` means compil
439
456
  # CLI
440
457
 
441
458
  ```text
442
- hsx 2.2.1, the HSX compiler
459
+ hsx 2.4.0, the HSX compiler
443
460
 
444
461
  Usage:
445
462
  hsx check <file.hsx> [--catalog <catalog.udl>] [--strict]
@@ -877,6 +894,26 @@ instrument probe {
877
894
  }
878
895
  ```
879
896
 
897
+ ## HSX1105: allow_zero needs a money field
898
+
899
+ Stage: `typecheck`
900
+
901
+ Fix: Put allow_zero: true on a money field, or remove it; amounts are strictly positive unless a money field opts in.
902
+
903
+ ```hsx expect=HSX1105
904
+ program catalog_probe "Catalog probe"
905
+ instrument probe {
906
+ agent_description: "Probe instrument for catalog diagnostics.";
907
+ fields { memo { type: text; allow_zero: true; } }
908
+ lifecycle { states created; initial created; }
909
+ action create {
910
+ agent_description: "Create a probe instance.";
911
+ steps: [];
912
+ }
913
+
914
+ }
915
+ ```
916
+
880
917
  ## HSX1110: Unsupported parameter combination
881
918
 
882
919
  Stage: `typecheck`
@@ -1365,7 +1402,7 @@ The parser is hand-written. This page records the exported lexer vocabulary, the
1365
1402
 
1366
1403
  ## Typed clause spellings
1367
1404
 
1368
- `funding`, `receipt distribution`, `requires allocation`, `allocation`, `contributions`, `allocate`, `contribution stage`, `date order`, `unique`, `transitions refs`, `action library`, `agent description`, `calls`, `requires input`, `engine owned`, `capture engine`, `capture input`, `commit`, `quote`, `decided amount`, `deadline`, `decision`, `computes distribute`, `description`, `due`, `earnable`, `event name`, `examples`, `input`, `moves`, `payout`, `piece plan`, `piece stage`, `port`, `principal`, `public action`, `reconcile`, `computes remainder`, `requires aggregate`, `requires checks`, `requires drained`, `requires exposure`, `requires refs`, `sandbox failure point`, `sets at`, `computes signed_sum`, `steps`, `summary`, `updates`, `notify`, `agent description`, `aggregate invariants`, `caller parked states`, `description`, `dials`, `distinct parties`, `computes derived`, `computes fees`, `id prefix`, `nav`, `partitions`, `subject`, `summary`, `surface visibility`, `template binding`, `template id`, `title`, `update`, `request authority`
1405
+ `funding`, `receipt distribution`, `requires allocation`, `allocation`, `contributions`, `allocate`, `contribution stage`, `date order`, `unique`, `transitions refs`, `cascade`, `action library`, `agent description`, `calls`, `requires input`, `engine owned`, `capture engine`, `capture input`, `commit`, `quote`, `decided amount`, `deadline`, `decision`, `computes distribute`, `description`, `due`, `earnable`, `event name`, `examples`, `input`, `moves`, `payout`, `piece plan`, `piece stage`, `port`, `principal`, `public action`, `reconcile`, `computes remainder`, `requires aggregate`, `requires checks`, `requires drained`, `requires exposure`, `requires refs`, `sandbox failure point`, `sets at`, `computes signed_sum`, `steps`, `summary`, `updates`, `notify`, `agent description`, `aggregate invariants`, `caller parked states`, `description`, `dials`, `distinct parties`, `computes derived`, `computes fees`, `id prefix`, `nav`, `partitions`, `subject`, `summary`, `surface visibility`, `template binding`, `template id`, `title`, `update`, `request authority`
1369
1406
 
1370
1407
  ## Standard-library modules
1371
1408
 
@@ -1531,6 +1568,7 @@ Source: [`std/money_flows/cancellable_booking.hsx`](../../../std/money_flows/can
1531
1568
  | `tax_bps` | `optional<integer>` | No | tax_bps applies to margin after the supplier share. |
1532
1569
  | `authority_type` | `optional<text>` | No | authority_type and supplier_role bind release to a consumed confirmation decision. |
1533
1570
  | `supplier_role` | `optional<text>` | No | authority_type and supplier_role bind release to a consumed confirmation decision. |
1571
+ | `collects` | `optional<json>` | No | collects optionally cascades named actions to linked instruments on deposit. |
1534
1572
 
1535
1573
  Required means required by the template signature. A selected mode may also need parameters marked optional; the guidance below describes those combinations.
1536
1574
 
@@ -1596,6 +1634,7 @@ deposit policy. Omit it to return the deposit; a full-refund band also returns i
1596
1634
  the deposit. balance_before and confirmation_window are positive fixed durations
1597
1635
  relative to departure. tax_bps applies to margin after the supplier share.
1598
1636
  authority_type and supplier_role bind release to a consumed confirmation decision.
1637
+ collects optionally cascades named actions to linked instruments on deposit.
1599
1638
  acceptance optionally supplies an aggregate gate. All actions are private until
1600
1639
  expose selects them. Ordered band starts and deadlines prevent a late sweep from
1601
1640
  extending an earlier band's cancellation rights. Full timeout refund returns price.
@@ -1607,6 +1646,7 @@ fixed duration; omitting the direction adds it. Invalid dates or durations refus
1607
1646
 
1608
1647
  - `agent description`
1609
1648
  - `caller parked states`
1649
+ - `cascade`
1610
1650
  - `commit`
1611
1651
  - `deadline`
1612
1652
  - `description`
@@ -1643,7 +1683,7 @@ None.
1643
1683
  | `confirm` | `agent description`, `commit`, `moves`, `steps`, `summary` |
1644
1684
  | `retain` | `agent description`, `moves`, `steps`, `summary` |
1645
1685
  | `create` | `agent description`, `deadline`, `steps`, `unique` |
1646
- | `deposit` | `agent description`, `deadline`, `moves`, `port`, `steps` |
1686
+ | `deposit` | `agent description`, `cascade`, `deadline`, `moves`, `port`, `steps` |
1647
1687
  | `expire` | `agent description`, `due`, `requires drained`, `steps` |
1648
1688
  | `[balance_action]` | `agent description`, `deadline`, `moves`, `port`, `steps` |
1649
1689
  | `[open_action]` | `agent description`, `due`, `steps` |
@@ -3614,6 +3654,23 @@ with `column: role` and `values: [...]`. There is no shorter role annotation.
3614
3654
  A bare `customerAccountId: account<SAR>;` compiles as HSX but does not satisfy
3615
3655
  the host's account-role admission law.
3616
3656
 
3657
+ ## Money fields
3658
+
3659
+ A `money<C>` field admits a minor-unit integer string and refuses zero: it lowers to the pattern `^[1-9][0-9]{0,17}$`. Marking the field `optional: true` lets a caller omit it; it does not let a caller send `"0"`. When zero is a real value for the field, opt in with `allow_zero: true`, which lowers to `^(0|[1-9][0-9]{0,17})$`:
3660
+
3661
+ ```hsx
3662
+ fields {
3663
+ amount: money<SAR>;
3664
+ discount { type: money<SAR>; optional: true; allow_zero: true; }
3665
+ }
3666
+ ```
3667
+
3668
+ `allow_zero` on any other type is HSX1105. Decision port shapes set it on their money fields, because a decided amount may be zero.
3669
+
3670
+ ## Date fields
3671
+
3672
+ A `date` field lowers to the UDL `hyperscale-date-time` format. Callers may send any RFC 3339 offset, such as `2026-10-03T09:00:00+03:00`; the host admits it and stores the UTC instant, `2026-10-03T06:00:00.000Z`. A value already in `Z` is stored byte for byte. A local date-time without an offset is refused.
3673
+
3617
3674
  # UDL output
3618
3675
 
3619
3676
  An accepted compile returns three artifacts.
package/docs/llms.txt CHANGED
@@ -1,8 +1,8 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # HSX documentation
4
4
 
5
- > Repository guide and generated compiler reference for HSX 2.2.1.
5
+ > Repository guide and generated compiler reference for HSX 2.4.0.
6
6
 
7
7
  ## Guide
8
8
 
@@ -1,9 +1,9 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # CLI
4
4
 
5
5
  ```text
6
- hsx 2.2.1, the HSX compiler
6
+ hsx 2.4.0, the HSX compiler
7
7
 
8
8
  Usage:
9
9
  hsx check <file.hsx> [--catalog <catalog.udl>] [--strict]
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # Diagnostics
4
4
 
@@ -406,6 +406,26 @@ instrument probe {
406
406
  }
407
407
  ```
408
408
 
409
+ ## HSX1105: allow_zero needs a money field
410
+
411
+ Stage: `typecheck`
412
+
413
+ Fix: Put allow_zero: true on a money field, or remove it; amounts are strictly positive unless a money field opts in.
414
+
415
+ ```hsx expect=HSX1105
416
+ program catalog_probe "Catalog probe"
417
+ instrument probe {
418
+ agent_description: "Probe instrument for catalog diagnostics.";
419
+ fields { memo { type: text; allow_zero: true; } }
420
+ lifecycle { states created; initial created; }
421
+ action create {
422
+ agent_description: "Create a probe instance.";
423
+ steps: [];
424
+ }
425
+
426
+ }
427
+ ```
428
+
409
429
  ## HSX1110: Unsupported parameter combination
410
430
 
411
431
  Stage: `typecheck`
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # Grammar vocabulary
4
4
 
@@ -14,7 +14,7 @@ The parser is hand-written. This page records the exported lexer vocabulary, the
14
14
 
15
15
  ## Typed clause spellings
16
16
 
17
- `funding`, `receipt distribution`, `requires allocation`, `allocation`, `contributions`, `allocate`, `contribution stage`, `date order`, `unique`, `transitions refs`, `action library`, `agent description`, `calls`, `requires input`, `engine owned`, `capture engine`, `capture input`, `commit`, `quote`, `decided amount`, `deadline`, `decision`, `computes distribute`, `description`, `due`, `earnable`, `event name`, `examples`, `input`, `moves`, `payout`, `piece plan`, `piece stage`, `port`, `principal`, `public action`, `reconcile`, `computes remainder`, `requires aggregate`, `requires checks`, `requires drained`, `requires exposure`, `requires refs`, `sandbox failure point`, `sets at`, `computes signed_sum`, `steps`, `summary`, `updates`, `notify`, `agent description`, `aggregate invariants`, `caller parked states`, `description`, `dials`, `distinct parties`, `computes derived`, `computes fees`, `id prefix`, `nav`, `partitions`, `subject`, `summary`, `surface visibility`, `template binding`, `template id`, `title`, `update`, `request authority`
17
+ `funding`, `receipt distribution`, `requires allocation`, `allocation`, `contributions`, `allocate`, `contribution stage`, `date order`, `unique`, `transitions refs`, `cascade`, `action library`, `agent description`, `calls`, `requires input`, `engine owned`, `capture engine`, `capture input`, `commit`, `quote`, `decided amount`, `deadline`, `decision`, `computes distribute`, `description`, `due`, `earnable`, `event name`, `examples`, `input`, `moves`, `payout`, `piece plan`, `piece stage`, `port`, `principal`, `public action`, `reconcile`, `computes remainder`, `requires aggregate`, `requires checks`, `requires drained`, `requires exposure`, `requires refs`, `sandbox failure point`, `sets at`, `computes signed_sum`, `steps`, `summary`, `updates`, `notify`, `agent description`, `aggregate invariants`, `caller parked states`, `description`, `dials`, `distinct parties`, `computes derived`, `computes fees`, `id prefix`, `nav`, `partitions`, `subject`, `summary`, `surface visibility`, `template binding`, `template id`, `title`, `update`, `request authority`
18
18
 
19
19
  ## Standard-library modules
20
20
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # advance
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # cancellable_booking
4
4
 
@@ -32,6 +32,7 @@ Source: [`std/money_flows/cancellable_booking.hsx`](../../../std/money_flows/can
32
32
  | `tax_bps` | `optional<integer>` | No | tax_bps applies to margin after the supplier share. |
33
33
  | `authority_type` | `optional<text>` | No | authority_type and supplier_role bind release to a consumed confirmation decision. |
34
34
  | `supplier_role` | `optional<text>` | No | authority_type and supplier_role bind release to a consumed confirmation decision. |
35
+ | `collects` | `optional<json>` | No | collects optionally cascades named actions to linked instruments on deposit. |
35
36
 
36
37
  Required means required by the template signature. A selected mode may also need parameters marked optional; the guidance below describes those combinations.
37
38
 
@@ -97,6 +98,7 @@ deposit policy. Omit it to return the deposit; a full-refund band also returns i
97
98
  the deposit. balance_before and confirmation_window are positive fixed durations
98
99
  relative to departure. tax_bps applies to margin after the supplier share.
99
100
  authority_type and supplier_role bind release to a consumed confirmation decision.
101
+ collects optionally cascades named actions to linked instruments on deposit.
100
102
  acceptance optionally supplies an aggregate gate. All actions are private until
101
103
  expose selects them. Ordered band starts and deadlines prevent a late sweep from
102
104
  extending an earlier band's cancellation rights. Full timeout refund returns price.
@@ -108,6 +110,7 @@ fixed duration; omitting the direction adds it. Invalid dates or durations refus
108
110
 
109
111
  - `agent description`
110
112
  - `caller parked states`
113
+ - `cascade`
111
114
  - `commit`
112
115
  - `deadline`
113
116
  - `description`
@@ -144,7 +147,7 @@ None.
144
147
  | `confirm` | `agent description`, `commit`, `moves`, `steps`, `summary` |
145
148
  | `retain` | `agent description`, `moves`, `steps`, `summary` |
146
149
  | `create` | `agent description`, `deadline`, `steps`, `unique` |
147
- | `deposit` | `agent description`, `deadline`, `moves`, `port`, `steps` |
150
+ | `deposit` | `agent description`, `cascade`, `deadline`, `moves`, `port`, `steps` |
148
151
  | `expire` | `agent description`, `due`, `requires drained`, `steps` |
149
152
  | `[balance_action]` | `agent description`, `deadline`, `moves`, `port`, `steps` |
150
153
  | `[open_action]` | `agent description`, `due`, `steps` |
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # captured_payment
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # conditional_disbursement
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # credit_facility
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # held_payment
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # instant_transfer
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # metered
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # pooled_split
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # premium_forward
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # reconciled_payout
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # rotating_pool
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # scheduled
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # security_deposit
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # settlement_batch
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # swap
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # threshold_pool
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # weighted_distribution
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # Types
4
4
 
@@ -42,3 +42,20 @@ Use the quoted `"x-hyperscale-reference-filter"` key inside the field block,
42
42
  with `column: role` and `values: [...]`. There is no shorter role annotation.
43
43
  A bare `customerAccountId: account<SAR>;` compiles as HSX but does not satisfy
44
44
  the host's account-role admission law.
45
+
46
+ ## Money fields
47
+
48
+ A `money<C>` field admits a minor-unit integer string and refuses zero: it lowers to the pattern `^[1-9][0-9]{0,17}$`. Marking the field `optional: true` lets a caller omit it; it does not let a caller send `"0"`. When zero is a real value for the field, opt in with `allow_zero: true`, which lowers to `^(0|[1-9][0-9]{0,17})$`:
49
+
50
+ ```hsx
51
+ fields {
52
+ amount: money<SAR>;
53
+ discount { type: money<SAR>; optional: true; allow_zero: true; }
54
+ }
55
+ ```
56
+
57
+ `allow_zero` on any other type is HSX1105. Decision port shapes set it on their money fields, because a decided amount may be zero.
58
+
59
+ ## Date fields
60
+
61
+ A `date` field lowers to the UDL `hyperscale-date-time` format. Callers may send any RFC 3339 offset, such as `2026-10-03T09:00:00+03:00`; the host admits it and stores the UTC instant, `2026-10-03T06:00:00.000Z`. A value already in `Z` is stored byte for byte. A local date-time without an offset is refused.
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.2.1. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.4.0. Do not edit. -->
2
2
 
3
3
  # UDL output
4
4
 
@@ -389,6 +389,7 @@
389
389
  "authorityType": false,
390
390
  "balanceBefore": false,
391
391
  "cancelBands": false,
392
+ "collects": false,
392
393
  "confirmationWindow": false,
393
394
  "departure": false,
394
395
  "depositBps": false,
@@ -21,7 +21,7 @@
21
21
  "verification.kyc.investment.count",
22
22
  "verification.kyc.standard.count"
23
23
  ],
24
- "effectiveTableDigest": "4273afec16c56ae97282eda8a0a349b006b0e7f41a49d4dbebda3172e449cb58",
24
+ "effectiveTableDigest": "9b5320cba0645fdc2e736873e47aeff7740211869698ab3d12fcd3c51e153b17",
25
25
  "fixed": {
26
26
  "activationBaseMinor": "500000",
27
27
  "activationPerPointMinor": "100000",
@@ -72,6 +72,14 @@
72
72
  "settlement": "invoice",
73
73
  "signature": "decides.banking_or_card_issuing"
74
74
  },
75
+ {
76
+ "bps": 0,
77
+ "meter": "instrument.event.count",
78
+ "payer": "product",
79
+ "perEventMinor": "0",
80
+ "settlement": "invoice",
81
+ "signature": "decides.cascade_transition"
82
+ },
75
83
  {
76
84
  "bps": 0,
77
85
  "meter": "instrument.event.count",
@@ -439,7 +447,7 @@
439
447
  "verification.kyc.investment.count",
440
448
  "verification.kyc.standard.count"
441
449
  ],
442
- "effectiveTableDigest": "88c0a5ae2f12de977d156a04a32cdecbad107076bc74a1b8398239c590f3eb0a",
450
+ "effectiveTableDigest": "e75a41ea689c621d41fa563963b2a8822ea54aff9ce756eb2f60aa0dc420dca2",
443
451
  "fixed": {
444
452
  "activationBaseMinor": "133300",
445
453
  "activationPerPointMinor": "26700",
@@ -490,6 +498,14 @@
490
498
  "settlement": "invoice",
491
499
  "signature": "decides.banking_or_card_issuing"
492
500
  },
501
+ {
502
+ "bps": 0,
503
+ "meter": "instrument.event.count",
504
+ "payer": "product",
505
+ "perEventMinor": "0",
506
+ "settlement": "invoice",
507
+ "signature": "decides.cascade_transition"
508
+ },
493
509
  {
494
510
  "bps": 0,
495
511
  "meter": "instrument.event.count",
@@ -857,7 +873,7 @@
857
873
  "verification.kyc.investment.count",
858
874
  "verification.kyc.standard.count"
859
875
  ],
860
- "effectiveTableDigest": "004d1a8156aac9cd7cb789f36f6abef508ea304327703ba12844b65b66f03ab2",
876
+ "effectiveTableDigest": "905ffe63c1d5e9af686e0be18cd156af159f79c4cc16ad74db8880b6126cb1cf",
861
877
  "fixed": {
862
878
  "activationBaseMinor": "125000",
863
879
  "activationPerPointMinor": "25000",
@@ -908,6 +924,14 @@
908
924
  "settlement": "invoice",
909
925
  "signature": "decides.banking_or_card_issuing"
910
926
  },
927
+ {
928
+ "bps": 0,
929
+ "meter": "instrument.event.count",
930
+ "payer": "product",
931
+ "perEventMinor": "0",
932
+ "settlement": "invoice",
933
+ "signature": "decides.cascade_transition"
934
+ },
911
935
  {
912
936
  "bps": 0,
913
937
  "meter": "instrument.event.count",
@@ -1275,7 +1299,7 @@
1275
1299
  "verification.kyc.investment.count",
1276
1300
  "verification.kyc.standard.count"
1277
1301
  ],
1278
- "effectiveTableDigest": "72155c0ce9eb3157f87b7f613bb3f05b3ab50a91248c9260e1b2ceae6b199286",
1302
+ "effectiveTableDigest": "8b549d4054638116b4a42156cdcf8bf01f3fa50b6891ef0f4718d7922ae0ccf0",
1279
1303
  "fixed": {
1280
1304
  "activationBaseMinor": "104200",
1281
1305
  "activationPerPointMinor": "20800",
@@ -1326,6 +1350,14 @@
1326
1350
  "settlement": "invoice",
1327
1351
  "signature": "decides.banking_or_card_issuing"
1328
1352
  },
1353
+ {
1354
+ "bps": 0,
1355
+ "meter": "instrument.event.count",
1356
+ "payer": "product",
1357
+ "perEventMinor": "0",
1358
+ "settlement": "invoice",
1359
+ "signature": "decides.cascade_transition"
1360
+ },
1329
1361
  {
1330
1362
  "bps": 0,
1331
1363
  "meter": "instrument.event.count",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperscale0/hsx",
3
- "version": "2.2.1",
3
+ "version": "2.4.0",
4
4
  "description": "The strictly typed HSX language: compile total financial programs into canonical UDL.",
5
5
  "keywords": [
6
6
  "hsx",
@@ -85,7 +85,7 @@
85
85
  "generate": "bun run std:bundle && bun run docs:build && bun run playground:build"
86
86
  },
87
87
  "dependencies": {
88
- "@hyperscale0/udl": "2.4.0"
88
+ "@hyperscale0/udl": "2.6.0"
89
89
  },
90
90
  "devDependencies": {
91
91
  "bun-types": "1.4.2",
@@ -96,5 +96,5 @@
96
96
  "Amir Ayub",
97
97
  "Sara AlBakaawi"
98
98
  ],
99
- "gitHead": "ea452e2225cddaaf17be584d4f3cbef6932de3e9"
99
+ "gitHead": "cd1e1ff5c188de94ff8bb0761cb3258746196bf2"
100
100
  }
@@ -294,6 +294,13 @@ port pass_inspection { allowed: [seller] shape { invalidField: mystery_type } }`
294
294
  fix: "Pass the type declared by the parameter or UDL slot.",
295
295
  example: instrument("summary: money(SAR, 2500);"),
296
296
  },
297
+ {
298
+ code: "HSX1105",
299
+ stage: "typecheck",
300
+ title: "allow_zero needs a money field",
301
+ fix: "Put allow_zero: true on a money field, or remove it; amounts are strictly positive unless a money field opts in.",
302
+ example: instrument("", "memo { type: text; allow_zero: true; }"),
303
+ },
297
304
  {
298
305
  code: "HSX1110",
299
306
  stage: "typecheck",