@hyperscale0/hsx 2.2.1 → 2.3.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 (45) hide show
  1. package/CHANGELOG.md +16 -0
  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 +32 -13
  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 +56 -2
  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 +1 -1
  19. package/docs/reference/std/advance.md +1 -1
  20. package/docs/reference/std/cancellable_booking.md +1 -1
  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/package.json +3 -3
  40. package/src/diagnostics.ts +7 -0
  41. package/src/std-bundle.ts +2 -2
  42. package/src/typecheck.ts +31 -13
  43. package/src/version.ts +1 -1
  44. package/std/money_flows/advance.hsx +1 -1
  45. package/std/money_flows/cancellable_booking.hsx +4 -4
@@ -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.3.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.3.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.3.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.3.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`
@@ -3614,6 +3651,23 @@ with `column: role` and `values: [...]`. There is no shorter role annotation.
3614
3651
  A bare `customerAccountId: account<SAR>;` compiles as HSX but does not satisfy
3615
3652
  the host's account-role admission law.
3616
3653
 
3654
+ ## Money fields
3655
+
3656
+ 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})$`:
3657
+
3658
+ ```hsx
3659
+ fields {
3660
+ amount: money<SAR>;
3661
+ discount { type: money<SAR>; optional: true; allow_zero: true; }
3662
+ }
3663
+ ```
3664
+
3665
+ `allow_zero` on any other type is HSX1105. Decision port shapes set it on their money fields, because a decided amount may be zero.
3666
+
3667
+ ## Date fields
3668
+
3669
+ 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.
3670
+
3617
3671
  # UDL output
3618
3672
 
3619
3673
  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.3.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.3.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.3.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.3.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.3.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.3.0. Do not edit. -->
2
2
 
3
3
  # Grammar vocabulary
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.3.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.3.0. Do not edit. -->
2
2
 
3
3
  # cancellable_booking
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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.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.3.0. Do not edit. -->
2
2
 
3
3
  # UDL output
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperscale0/hsx",
3
- "version": "2.2.1",
3
+ "version": "2.3.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.5.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": "a537ff33ff29340cc2849ea049df4d65889c5d5c"
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",