@hyperscale0/hsx 1.0.0-beta.1 → 1.0.0-rc.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 (234) hide show
  1. package/CHANGELOG.md +41 -9
  2. package/LICENSING.md +3 -3
  3. package/README.md +37 -149
  4. package/TRADEMARKS.md +4 -4
  5. package/dist/src/ast.d.ts +129 -10
  6. package/dist/src/ast.d.ts.map +1 -1
  7. package/dist/src/cli.d.ts +2 -1
  8. package/dist/src/cli.d.ts.map +1 -1
  9. package/dist/src/cli.js +148 -12
  10. package/dist/src/cli.js.map +1 -1
  11. package/dist/src/compile.d.ts +41 -4
  12. package/dist/src/compile.d.ts.map +1 -1
  13. package/dist/src/compile.js +82 -15
  14. package/dist/src/compile.js.map +1 -1
  15. package/dist/src/cost.d.ts +78 -0
  16. package/dist/src/cost.d.ts.map +1 -0
  17. package/dist/src/cost.js +369 -0
  18. package/dist/src/cost.js.map +1 -0
  19. package/dist/src/diagnostics.d.ts +11 -0
  20. package/dist/src/diagnostics.d.ts.map +1 -0
  21. package/dist/src/diagnostics.js +420 -0
  22. package/dist/src/diagnostics.js.map +1 -0
  23. package/dist/src/emit.d.ts +35 -0
  24. package/dist/src/emit.d.ts.map +1 -0
  25. package/dist/src/emit.js +359 -0
  26. package/dist/src/emit.js.map +1 -0
  27. package/dist/src/entry-overrides.d.ts +17 -3
  28. package/dist/src/entry-overrides.d.ts.map +1 -1
  29. package/dist/src/entry-overrides.js +180 -35
  30. package/dist/src/entry-overrides.js.map +1 -1
  31. package/dist/src/format.d.ts +10 -0
  32. package/dist/src/format.d.ts.map +1 -0
  33. package/dist/src/format.js +183 -0
  34. package/dist/src/format.js.map +1 -0
  35. package/dist/src/index.d.ts +10 -4
  36. package/dist/src/index.d.ts.map +1 -1
  37. package/dist/src/index.js +8 -3
  38. package/dist/src/index.js.map +1 -1
  39. package/dist/src/ir.d.ts +66 -0
  40. package/dist/src/ir.d.ts.map +1 -0
  41. package/dist/src/ir.js +15 -0
  42. package/dist/src/ir.js.map +1 -0
  43. package/dist/src/lex.d.ts +9 -1
  44. package/dist/src/lex.d.ts.map +1 -1
  45. package/dist/src/lex.js +50 -4
  46. package/dist/src/lex.js.map +1 -1
  47. package/dist/src/limits.d.ts +2 -3
  48. package/dist/src/limits.d.ts.map +1 -1
  49. package/dist/src/limits.js +2 -3
  50. package/dist/src/limits.js.map +1 -1
  51. package/dist/src/modules.d.ts +36 -0
  52. package/dist/src/modules.d.ts.map +1 -0
  53. package/dist/src/modules.js +372 -0
  54. package/dist/src/modules.js.map +1 -0
  55. package/dist/src/parse.d.ts.map +1 -1
  56. package/dist/src/parse.js +590 -17
  57. package/dist/src/parse.js.map +1 -1
  58. package/dist/src/typecheck.d.ts +8 -0
  59. package/dist/src/typecheck.d.ts.map +1 -0
  60. package/dist/src/typecheck.js +2958 -0
  61. package/dist/src/typecheck.js.map +1 -0
  62. package/dist/src/version.d.ts +4 -15
  63. package/dist/src/version.d.ts.map +1 -1
  64. package/dist/src/version.js +4 -15
  65. package/dist/src/version.js.map +1 -1
  66. package/docs/README.md +23 -0
  67. package/docs/guide/01-first-program.md +24 -0
  68. package/docs/guide/02-money.md +25 -0
  69. package/docs/guide/03-instruments.md +22 -0
  70. package/docs/guide/04-lifecycles.md +25 -0
  71. package/docs/guide/05-fees-and-splits.md +45 -0
  72. package/docs/guide/06-schedules.md +22 -0
  73. package/docs/guide/07-composition.md +46 -0
  74. package/docs/guide/08-writing-a-module.md +26 -0
  75. package/docs/guide/09-cost.md +24 -0
  76. package/docs/guide/10-diagnostics.md +27 -0
  77. package/docs/llms-full.txt +1738 -0
  78. package/docs/llms.txt +45 -0
  79. package/docs/reference/cli.md +33 -0
  80. package/docs/reference/diagnostics.md +619 -0
  81. package/docs/reference/grammar.md +39 -0
  82. package/docs/reference/std/advance.md +35 -0
  83. package/docs/reference/std/cancellable_booking.md +35 -0
  84. package/docs/reference/std/captured_payment.md +43 -0
  85. package/docs/reference/std/conditional_disbursement.md +33 -0
  86. package/docs/reference/std/credit_facility.md +35 -0
  87. package/docs/reference/std/held_payment.md +64 -0
  88. package/docs/reference/std/instant_transfer.md +30 -0
  89. package/docs/reference/std/metered.md +27 -0
  90. package/docs/reference/std/pooled_split.md +26 -0
  91. package/docs/reference/std/premium_forward.md +39 -0
  92. package/docs/reference/std/reconciled_payout.md +33 -0
  93. package/docs/reference/std/recurring_collection.md +25 -0
  94. package/docs/reference/std/rotating_pool.md +42 -0
  95. package/docs/reference/std/scheduled.md +51 -0
  96. package/docs/reference/std/security_deposit.md +46 -0
  97. package/docs/reference/std/settlement_batch.md +42 -0
  98. package/docs/reference/std/swap.md +46 -0
  99. package/docs/reference/std/threshold_pool.md +47 -0
  100. package/docs/reference/std/weighted_distribution.md +39 -0
  101. package/docs/reference/types.md +20 -0
  102. package/docs/reference/udl-output.md +14 -0
  103. package/docs/sessions/2026-09-02-two-instruments.hsx +21 -0
  104. package/docs/sessions/2026-09-02-two-instruments.md +41 -0
  105. package/examples/01-first-program/README.md +45 -0
  106. package/examples/01-first-program/tip-jar.hsx +17 -0
  107. package/examples/02-imports-and-archetypes/README.md +99 -0
  108. package/examples/02-imports-and-archetypes/photo-booth.hsx +37 -0
  109. package/examples/03-diagnostics/README.md +68 -0
  110. package/examples/03-diagnostics/corner-shop-fixed.hsx +22 -0
  111. package/examples/03-diagnostics/corner-shop.hsx +19 -0
  112. package/examples/04-complete-product/README.md +87 -0
  113. package/examples/04-complete-product/study-hall.hsx +67 -0
  114. package/examples/05-watch-club/README.md +9 -0
  115. package/examples/05-watch-club/watch-club.hsx +124 -0
  116. package/examples/README.md +18 -0
  117. package/examples/advance/README.md +3 -0
  118. package/examples/advance/advance.hsx +13 -0
  119. package/examples/advance/advance.udl +339 -0
  120. package/examples/cancellable_booking/README.md +3 -0
  121. package/examples/cancellable_booking/cancellable_booking.hsx +14 -0
  122. package/examples/cancellable_booking/cancellable_booking.udl +391 -0
  123. package/examples/captured_payment/README.md +3 -0
  124. package/examples/captured_payment/captured_payment.hsx +21 -0
  125. package/examples/captured_payment/captured_payment.udl +677 -0
  126. package/examples/conditional_disbursement/README.md +3 -0
  127. package/examples/conditional_disbursement/conditional_disbursement.hsx +17 -0
  128. package/examples/conditional_disbursement/conditional_disbursement.udl +412 -0
  129. package/examples/cost-table.json +386 -0
  130. package/examples/credit_facility/README.md +3 -0
  131. package/examples/credit_facility/credit_facility.hsx +27 -0
  132. package/examples/credit_facility/credit_facility.udl +1373 -0
  133. package/examples/held_payment/README.md +3 -0
  134. package/examples/held_payment/held_payment.hsx +13 -0
  135. package/examples/held_payment/held_payment.udl +507 -0
  136. package/examples/instant_transfer/README.md +3 -0
  137. package/examples/instant_transfer/instant_transfer.hsx +16 -0
  138. package/examples/instant_transfer/instant_transfer.udl +364 -0
  139. package/examples/metered/README.md +3 -0
  140. package/examples/metered/metered.hsx +13 -0
  141. package/examples/metered/metered.udl +247 -0
  142. package/examples/pooled_split/README.md +3 -0
  143. package/examples/pooled_split/pooled_split.hsx +15 -0
  144. package/examples/pooled_split/pooled_split.udl +425 -0
  145. package/examples/premium_forward/README.md +3 -0
  146. package/examples/premium_forward/premium_forward.hsx +19 -0
  147. package/examples/premium_forward/premium_forward.udl +594 -0
  148. package/examples/reconciled_payout/README.md +3 -0
  149. package/examples/reconciled_payout/reconciled_payout.hsx +13 -0
  150. package/examples/reconciled_payout/reconciled_payout.udl +303 -0
  151. package/examples/recurring_collection/README.md +3 -0
  152. package/examples/recurring_collection/recurring_collection.hsx +21 -0
  153. package/examples/recurring_collection/recurring_collection.udl +1130 -0
  154. package/examples/rotating_pool/README.md +3 -0
  155. package/examples/rotating_pool/rotating_pool.hsx +18 -0
  156. package/examples/rotating_pool/rotating_pool.udl +4352 -0
  157. package/examples/scheduled/README.md +3 -0
  158. package/examples/scheduled/scheduled.hsx +12 -0
  159. package/examples/scheduled/scheduled.udl +335 -0
  160. package/examples/security_deposit/README.md +3 -0
  161. package/examples/security_deposit/security_deposit.hsx +21 -0
  162. package/examples/security_deposit/security_deposit.udl +293 -0
  163. package/examples/settlement_batch/README.md +3 -0
  164. package/examples/settlement_batch/settlement_batch.hsx +19 -0
  165. package/examples/settlement_batch/settlement_batch.udl +753 -0
  166. package/examples/swap/README.md +3 -0
  167. package/examples/swap/swap.hsx +19 -0
  168. package/examples/swap/swap.udl +876 -0
  169. package/examples/threshold_pool/README.md +3 -0
  170. package/examples/threshold_pool/threshold_pool.hsx +16 -0
  171. package/examples/threshold_pool/threshold_pool.udl +667 -0
  172. package/examples/weighted_distribution/README.md +3 -0
  173. package/examples/weighted_distribution/weighted_distribution.hsx +20 -0
  174. package/examples/weighted_distribution/weighted_distribution.udl +337 -0
  175. package/package.json +19 -6
  176. package/skills/hsx/SKILL.md +483 -0
  177. package/src/ast.ts +163 -9
  178. package/src/cli.ts +164 -12
  179. package/src/compile.ts +160 -20
  180. package/src/cost.ts +579 -0
  181. package/src/diagnostics.ts +442 -0
  182. package/src/emit.ts +447 -0
  183. package/src/entry-overrides.ts +263 -48
  184. package/src/format.ts +261 -0
  185. package/src/index.ts +32 -4
  186. package/src/ir.ts +99 -0
  187. package/src/lex.ts +59 -4
  188. package/src/limits.ts +2 -3
  189. package/src/modules.ts +444 -0
  190. package/src/parse.ts +655 -21
  191. package/src/typecheck.ts +3876 -0
  192. package/src/version.ts +4 -16
  193. package/std/SEMANTICS.md +130 -0
  194. package/std/settlements/advance.hsx +177 -0
  195. package/std/settlements/cancellable_booking.hsx +87 -0
  196. package/std/settlements/captured_payment.hsx +144 -0
  197. package/std/settlements/conditional_disbursement.hsx +185 -0
  198. package/std/settlements/credit_facility.hsx +167 -0
  199. package/std/settlements/held_payment.hsx +578 -0
  200. package/std/settlements/index.hsx +3 -0
  201. package/std/settlements/instant_transfer.hsx +190 -0
  202. package/std/settlements/metered.hsx +67 -0
  203. package/std/settlements/pooled_split.hsx +68 -0
  204. package/std/settlements/premium_forward.hsx +257 -0
  205. package/std/settlements/reconciled_payout.hsx +77 -0
  206. package/std/settlements/recurring_collection.hsx +27 -0
  207. package/std/settlements/rotating_pool.hsx +252 -0
  208. package/std/settlements/scheduled.hsx +641 -0
  209. package/std/settlements/security_deposit.hsx +166 -0
  210. package/std/settlements/settlement_batch.hsx +122 -0
  211. package/std/settlements/swap.hsx +1114 -0
  212. package/std/settlements/threshold_pool.hsx +221 -0
  213. package/std/settlements/weighted_distribution.hsx +141 -0
  214. package/dist/src/archetypes.d.ts +0 -17
  215. package/dist/src/archetypes.d.ts.map +0 -1
  216. package/dist/src/archetypes.js +0 -327
  217. package/dist/src/archetypes.js.map +0 -1
  218. package/dist/src/check.d.ts +0 -12
  219. package/dist/src/check.d.ts.map +0 -1
  220. package/dist/src/check.js +0 -1910
  221. package/dist/src/check.js.map +0 -1
  222. package/dist/src/lower.d.ts +0 -146
  223. package/dist/src/lower.d.ts.map +0 -1
  224. package/dist/src/lower.js +0 -4570
  225. package/dist/src/lower.js.map +0 -1
  226. package/dist/src/model.d.ts +0 -467
  227. package/dist/src/model.d.ts.map +0 -1
  228. package/dist/src/model.js +0 -15
  229. package/dist/src/model.js.map +0 -1
  230. package/spec/hsx-ir.schema.json +0 -920
  231. package/src/archetypes.ts +0 -340
  232. package/src/check.ts +0 -2938
  233. package/src/lower.ts +0 -5416
  234. package/src/model.ts +0 -519
package/docs/llms.txt ADDED
@@ -0,0 +1,45 @@
1
+ <!-- Generated by scripts/docs/build.ts for HSX 1.0.0-rc.1. Do not edit. -->
2
+
3
+ # HSX documentation
4
+
5
+ > Repository guide and generated compiler reference for HSX 1.0.0-rc.1.
6
+
7
+ ## Guide
8
+
9
+ [Your first program](guide/01-first-program.md): Hand-written chapter with compiler-checked programs.
10
+ [Money](guide/02-money.md): Hand-written chapter with compiler-checked programs.
11
+ [Instruments](guide/03-instruments.md): Hand-written chapter with compiler-checked programs.
12
+ [Lifecycles](guide/04-lifecycles.md): Hand-written chapter with compiler-checked programs.
13
+ [Fees and splits](guide/05-fees-and-splits.md): Hand-written chapter with compiler-checked programs.
14
+ [Schedules](guide/06-schedules.md): Hand-written chapter with compiler-checked programs.
15
+ [Composition](guide/07-composition.md): Hand-written chapter with compiler-checked programs.
16
+ [Writing a module](guide/08-writing-a-module.md): Hand-written chapter with compiler-checked programs.
17
+ [Cost](guide/09-cost.md): Hand-written chapter with compiler-checked programs.
18
+ [Diagnostics](guide/10-diagnostics.md): Hand-written chapter with compiler-checked programs.
19
+
20
+ ## Reference
21
+
22
+ [Grammar](reference/grammar.md): Lexer, clause, and module vocabulary.
23
+ [Types](reference/types.md): HSX type kinds.
24
+ [Diagnostics](reference/diagnostics.md): Stable HSX diagnostic codes and fixes.
25
+ [CLI](reference/cli.md): Generated command usage.
26
+ [UDL output](reference/udl-output.md): Compile artifacts and canonical output.
27
+ [advance](reference/std/advance.md): Standard-library module.
28
+ [cancellable_booking](reference/std/cancellable_booking.md): Standard-library module.
29
+ [captured_payment](reference/std/captured_payment.md): Standard-library module.
30
+ [conditional_disbursement](reference/std/conditional_disbursement.md): Standard-library module.
31
+ [credit_facility](reference/std/credit_facility.md): Standard-library module.
32
+ [held_payment](reference/std/held_payment.md): Standard-library module.
33
+ [instant_transfer](reference/std/instant_transfer.md): Standard-library module.
34
+ [metered](reference/std/metered.md): Standard-library module.
35
+ [pooled_split](reference/std/pooled_split.md): Standard-library module.
36
+ [premium_forward](reference/std/premium_forward.md): Standard-library module.
37
+ [reconciled_payout](reference/std/reconciled_payout.md): Standard-library module.
38
+ [recurring_collection](reference/std/recurring_collection.md): Standard-library module.
39
+ [rotating_pool](reference/std/rotating_pool.md): Standard-library module.
40
+ [scheduled](reference/std/scheduled.md): Standard-library module.
41
+ [security_deposit](reference/std/security_deposit.md): Standard-library module.
42
+ [settlement_batch](reference/std/settlement_batch.md): Standard-library module.
43
+ [swap](reference/std/swap.md): Standard-library module.
44
+ [threshold_pool](reference/std/threshold_pool.md): Standard-library module.
45
+ [weighted_distribution](reference/std/weighted_distribution.md): Standard-library module.
@@ -0,0 +1,33 @@
1
+ <!-- Generated by scripts/docs/build.ts for HSX 1.0.0-rc.1. Do not edit. -->
2
+
3
+ # CLI
4
+
5
+ ```text
6
+ hsx 1.0.0-rc.1, the HSX compiler
7
+
8
+ Usage:
9
+ hsx check <file.hsx> [--strict]
10
+ hsx build <file.hsx> [--out <file.json>] [--strict]
11
+ hsx cost <file.hsx> [--json] [--out <file.json>] [--strict]
12
+ hsx explain <HSX####>
13
+ hsx format <file.hsx>
14
+ hsx --version
15
+ hsx --help
16
+
17
+ Commands:
18
+ check Compile and report diagnostics. Prints nothing when the program is clean.
19
+ build Compile and write canonical UDL and its Business Frame as JSON.
20
+ cost Compile and print the version-pinned cost manifest as a table or JSON.
21
+ explain Print one diagnostic title, fix, and source example.
22
+ format Print the source in the one canonical HSX style.
23
+
24
+ Options:
25
+ --json Print the cost manifest as JSON instead of a table.
26
+ --out <file> Write build or cost JSON to this path instead of stdout.
27
+ --strict Treat warning-severity diagnostics as failures.
28
+
29
+ Exit codes:
30
+ 0 the program compiled (verdict valid, or warning without --strict)
31
+ 1 the program was refused (verdict invalid, or warning with --strict)
32
+ 2 the command line or the input file could not be used
33
+ ```
@@ -0,0 +1,619 @@
1
+ <!-- Generated by scripts/docs/build.ts for HSX 1.0.0-rc.1. Do not edit. -->
2
+
3
+ # Diagnostics
4
+
5
+ Use `hsx explain HSX####` for the same catalog entry.
6
+
7
+ ## HSX1000: Missing file declaration
8
+
9
+ Stage: `typecheck`
10
+
11
+ Fix: Add one program header or module declaration.
12
+
13
+ No source-only witness exists. The compiler host or lowering input must supply the invalid value.
14
+
15
+ ## HSX1001: Unbound name
16
+
17
+ Stage: `bind`
18
+
19
+ Fix: Declare or import the name before using it.
20
+
21
+ ```hsx expect=HSX1001
22
+ program catalog_probe "Catalog probe"
23
+ instrument probe = missing()
24
+ ```
25
+
26
+ ## HSX1002: Duplicate program declaration
27
+
28
+ Stage: `typecheck`
29
+
30
+ Fix: Keep exactly one program declaration.
31
+
32
+ ```hsx expect=HSX1002
33
+ program catalog_probe "Catalog probe"
34
+ instrument probe {
35
+ fields {}
36
+ lifecycle { states created; initial created; }
37
+ action create { steps: []; }
38
+
39
+ }
40
+ program second "Second"
41
+ ```
42
+
43
+ ## HSX1003: Invalid declaration name
44
+
45
+ Stage: `typecheck`
46
+
47
+ Fix: Use lowercase snake_case for program and instrument names.
48
+
49
+ ```hsx expect=HSX1003
50
+ program NotSnake "Catalog probe"
51
+ ```
52
+
53
+ ## HSX1004: Duplicate declaration
54
+
55
+ Stage: `typecheck`
56
+
57
+ Fix: Keep one declaration or give each declaration a distinct name.
58
+
59
+ ```hsx expect=HSX1004
60
+ program catalog_probe "Catalog probe"
61
+ instrument probe {
62
+ fields {}
63
+ lifecycle { states created; initial created; }
64
+ action create { steps: []; }
65
+
66
+ }
67
+ instrument probe { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
68
+ ```
69
+
70
+ ## HSX1005: Invalid field name
71
+
72
+ Stage: `typecheck`
73
+
74
+ Fix: Rename the field in lower camelCase.
75
+
76
+ No source-only witness exists. The parser normalizes every accepted field spelling before typechecking.
77
+
78
+ ## HSX1006: Invalid module import
79
+
80
+ Stage: `bind`
81
+
82
+ Fix: Resolve one module that exports each imported name exactly once.
83
+
84
+ No source-only witness exists. This refusal requires a compiler-host module resolver result.
85
+
86
+ ## HSX1007: Invalid cross-instrument reference
87
+
88
+ Stage: `typecheck`
89
+
90
+ Fix: Name an existing target instrument in the ref type.
91
+
92
+ ```hsx expect=HSX1007
93
+ program catalog_probe "Catalog probe"
94
+ instrument probe {
95
+ fields { parentId { type: ref; description: "Parent"; } }
96
+ lifecycle { states created; initial created; }
97
+ action create { steps: []; }
98
+ }
99
+ ```
100
+
101
+ ## HSX1008: Invalid subject or decision port
102
+
103
+ Stage: `typecheck`
104
+
105
+ Fix: Complete the declaration and bind every referenced decision port.
106
+
107
+ ```hsx expect=HSX1008
108
+ program catalog_probe "Catalog probe"
109
+ instrument probe {
110
+ fields {}
111
+ lifecycle { states created; initial created; }
112
+ action create { steps: []; }
113
+
114
+ }
115
+ subject vehicle { title: "Vehicle"; }
116
+ ```
117
+
118
+ ## HSX1009: Imported declaration collision
119
+
120
+ Stage: `bind`
121
+
122
+ Fix: Rename the importer-owned declaration or the module-local declaration.
123
+
124
+ No source-only witness exists. This refusal requires declarations returned by a compiler-host module resolver.
125
+
126
+ ## HSX1010: Wrong type-argument count
127
+
128
+ Stage: `typecheck`
129
+
130
+ Fix: Supply exactly the type arguments declared by the instrument function.
131
+
132
+ ```hsx expect=HSX1010
133
+ program catalog_probe "Catalog probe"
134
+ export instrument template<C>() { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
135
+ instrument probe = template<SAR, USD>()
136
+ ```
137
+
138
+ ## HSX1011: Missing required argument
139
+
140
+ Stage: `typecheck`
141
+
142
+ Fix: Pass every required instrument-function argument.
143
+
144
+ ```hsx expect=HSX1011
145
+ program catalog_probe "Catalog probe"
146
+ export instrument template(value: text) { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
147
+ instrument probe = template()
148
+ ```
149
+
150
+ ## HSX1012: Unknown named argument
151
+
152
+ Stage: `typecheck`
153
+
154
+ Fix: Remove the argument or use a parameter declared by the instrument function.
155
+
156
+ ```hsx expect=HSX1012
157
+ program catalog_probe "Catalog probe"
158
+ export instrument template() { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
159
+ instrument probe = template(typo: true)
160
+ ```
161
+
162
+ ## HSX1013: Duplicate named argument
163
+
164
+ Stage: `typecheck`
165
+
166
+ Fix: Pass each named argument once.
167
+
168
+ ```hsx expect=HSX1013
169
+ program catalog_probe "Catalog probe"
170
+ export instrument template(value: text) { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
171
+ instrument probe = template(value: "one", value: "two")
172
+ ```
173
+
174
+ ## HSX1014: JSON supplied as HSX
175
+
176
+ Stage: `parse`
177
+
178
+ Fix: Replace the JSON object with HSX declarations.
179
+
180
+ ```hsx expect=HSX1014
181
+ { "hsx": 1 }
182
+ ```
183
+
184
+ ## HSX1015: Invalid composed program identity
185
+
186
+ Stage: `typecheck`
187
+
188
+ Fix: Give the composed program a bounded product id and title.
189
+
190
+ No source-only witness exists. This refusal requires a compiler-host published catalog.
191
+
192
+ ## HSX1016: Empty published composition
193
+
194
+ Stage: `typecheck`
195
+
196
+ Fix: Select at least one published instrument with use.
197
+
198
+ No source-only witness exists. This refusal requires a compiler-host published catalog.
199
+
200
+ ## HSX1017: Duplicate published instrument
201
+
202
+ Stage: `typecheck`
203
+
204
+ Fix: Keep one use declaration for each published instrument.
205
+
206
+ No source-only witness exists. This refusal requires a compiler-host published catalog.
207
+
208
+ ## HSX1018: Unavailable published instrument
209
+
210
+ Stage: `typecheck`
211
+
212
+ Fix: Use an instrument id from the supplied published catalog.
213
+
214
+ ```hsx expect=HSX1018
215
+ program catalog_probe "Catalog probe"
216
+ use missing
217
+ ```
218
+
219
+ ## HSX1020: Invalid public action name
220
+
221
+ Stage: `typecheck`
222
+
223
+ Fix: Expose each action once under a distinct lower camelCase name.
224
+
225
+ No source-only witness exists. This refusal requires a compiler-host published catalog.
226
+
227
+ ## HSX1021: Invalid exposed action
228
+
229
+ Stage: `typecheck`
230
+
231
+ Fix: Expose an action on an explicitly used published instrument.
232
+
233
+ No source-only witness exists. This refusal requires a compiler-host published catalog.
234
+
235
+ ## HSX1022: Authored instrument in a composition
236
+
237
+ Stage: `typecheck`
238
+
239
+ Fix: Publish the instrument separately, then select it with use.
240
+
241
+ No source-only witness exists. This refusal requires a compiler-host published catalog.
242
+
243
+ ## HSX1023: Invalid required-field list
244
+
245
+ Stage: `typecheck`
246
+
247
+ Fix: List declared, non-optional field names once each.
248
+
249
+ ```hsx expect=HSX1023
250
+ program catalog_probe "Catalog probe"
251
+ instrument probe {
252
+ fields {}
253
+ lifecycle { states created; initial created; }
254
+ action create { steps: []; }
255
+ required: missing;
256
+ }
257
+ ```
258
+
259
+ ## HSX1101: Currency mismatch
260
+
261
+ Stage: `typecheck`
262
+
263
+ Fix: Use the declared currency because money values never coerce.
264
+
265
+ ```hsx expect=HSX1101
266
+ program catalog_probe "Catalog probe"
267
+ instrument probe {
268
+ fields {}
269
+ lifecycle { states created; initial created; }
270
+ action create { steps: []; }
271
+
272
+ }
273
+ const fee: money<SAR> = USD 1.00
274
+ ```
275
+
276
+ ## HSX1102: Money precision exceeds minor units
277
+
278
+ Stage: `typecheck`
279
+
280
+ Fix: Round the literal to the currency's minor-unit precision.
281
+
282
+ ```hsx expect=HSX1102
283
+ program catalog_probe "Catalog probe"
284
+ instrument probe {
285
+ fields {}
286
+ lifecycle { states created; initial created; }
287
+ action create { steps: []; }
288
+
289
+ }
290
+ const fee: money<SAR> = SAR 1.001
291
+ ```
292
+
293
+ ## HSX1103: Invalid numeric value
294
+
295
+ Stage: `typecheck`
296
+
297
+ Fix: Use an integer, percent, bps, or valid fixed-money binding.
298
+
299
+ ```hsx expect=HSX1103
300
+ program catalog_probe "Catalog probe"
301
+ instrument probe {
302
+ fields {}
303
+ lifecycle { states created; initial created; }
304
+ action create { steps: []; }
305
+ summary: 1.5;
306
+ }
307
+ ```
308
+
309
+ ## HSX1104: Value has the wrong type
310
+
311
+ Stage: `typecheck`
312
+
313
+ Fix: Pass the type declared by the parameter or UDL slot.
314
+
315
+ ```hsx expect=HSX1104
316
+ program catalog_probe "Catalog probe"
317
+ instrument probe {
318
+ fields {}
319
+ lifecycle { states created; initial created; }
320
+ action create { steps: []; }
321
+ summary: money(SAR, 2500);
322
+ }
323
+ ```
324
+
325
+ ## HSX1110: Unsupported parameter combination
326
+
327
+ Stage: `typecheck`
328
+
329
+ Fix: Choose a supported compile-time parameter combination.
330
+
331
+ ```hsx expect=HSX1110
332
+ program catalog_probe "Catalog probe"
333
+ export instrument template() {
334
+ unsupported { message: "Not supported"; fix: "Choose another form"; }
335
+ fields {}
336
+ lifecycle { states created; initial created; }
337
+ action create { steps: []; }
338
+ }
339
+ instrument probe = template()
340
+ ```
341
+
342
+ ## HSX1201: Linear money consumed more than once
343
+
344
+ Stage: `typecheck`
345
+
346
+ Fix: Leave exactly one sink for each produced money value.
347
+
348
+ ```hsx expect=HSX1201
349
+ program catalog_probe "Catalog probe"
350
+ instrument probe {
351
+ fields {}
352
+ lifecycle { states created; initial created; }
353
+ action create { steps: []; }
354
+ fields { amount: money<SAR>; }
355
+ action pay { computes remainder rest { amount_ref: total; on_zero: refuse; total_path: fields.amount; }; moves: [{ amount: rest; }, { amount: rest; }]; }
356
+ }
357
+ ```
358
+
359
+ ## HSX1202: Linear money is unconsumed
360
+
361
+ Stage: `typecheck`
362
+
363
+ Fix: Route each produced money value to one explicit sink.
364
+
365
+ ```hsx expect=HSX1202
366
+ program catalog_probe "Catalog probe"
367
+ instrument probe {
368
+ fields {}
369
+ lifecycle { states created; initial created; }
370
+ action create { steps: []; }
371
+ fields { amount: money<SAR>; }
372
+ action pay { computes remainder rest { amount_ref: total; on_zero: refuse; total_path: fields.amount; }; }
373
+ }
374
+ ```
375
+
376
+ ## HSX1301: Missing cost-table price
377
+
378
+ Stage: `typecheck`
379
+
380
+ Fix: Supply a versioned cost table with a row for every emitted effect.
381
+
382
+ ```hsx expect=HSX1301
383
+ program catalog_probe "Catalog probe"
384
+ instrument probe {
385
+ fields {}
386
+ lifecycle { states created; initial created; }
387
+ action create { steps: []; }
388
+
389
+ }
390
+ ```
391
+
392
+ ## HSX1302: Invalid cost-table row
393
+
394
+ Stage: `typecheck`
395
+
396
+ Fix: Use non-negative integer prices and a supported settlement timing.
397
+
398
+ No source-only witness exists. This refusal requires a malformed compiler-host cost table.
399
+
400
+ ## HSX1303: Invalid cost-table currency
401
+
402
+ Stage: `typecheck`
403
+
404
+ Fix: Use the supported uppercase cost-table currency.
405
+
406
+ No source-only witness exists. This refusal requires an invalid compiler-host cost-table currency.
407
+
408
+ ## HSX1401: Unbounded action
409
+
410
+ Stage: `typecheck`
411
+
412
+ Fix: Replace runtime iteration with a bounded compile-time comprehension.
413
+
414
+ ```hsx expect=HSX1401
415
+ program catalog_probe "Catalog probe"
416
+ instrument probe {
417
+ fields {}
418
+ lifecycle { states created; initial created; }
419
+ action create { steps: []; }
420
+ action run { while { condition: true; }; }
421
+ }
422
+ ```
423
+
424
+ ## HSX1402: Missing lifecycle
425
+
426
+ Stage: `typecheck`
427
+
428
+ Fix: Declare lifecycle states and an initial state.
429
+
430
+ ```hsx expect=HSX1402
431
+ program catalog_probe "Catalog probe"
432
+ instrument probe { fields {}; action create { steps: []; }; }
433
+ ```
434
+
435
+ ## HSX1403: Runtime comprehension bound
436
+
437
+ Stage: `typecheck`
438
+
439
+ Fix: Use an integer literal or literal finite list as the bound.
440
+
441
+ ```hsx expect=HSX1403
442
+ program catalog_probe "Catalog probe"
443
+ export instrument template(count: integer) {
444
+ fields {}
445
+ lifecycle { states created; initial created; }
446
+ action create { steps: []; }
447
+ for item in count { action run_[item] { steps: []; } }
448
+ }
449
+ instrument probe = template(count: runtimeCount: integer)
450
+ ```
451
+
452
+ ## HSX1404: Comprehension expansion limit
453
+
454
+ Stage: `typecheck`
455
+
456
+ Fix: Reduce the fixed expansion to the compiler limit.
457
+
458
+ ```hsx expect=HSX1404
459
+ program catalog_probe "Catalog probe"
460
+ instrument probe {
461
+ fields {}
462
+ lifecycle { states created; initial created; }
463
+ action create { steps: []; }
464
+ for item in 257 { action run_[item] { steps: []; } }
465
+ }
466
+ ```
467
+
468
+ ## HSX1405: Invalid compile-time selection
469
+
470
+ Stage: `typecheck`
471
+
472
+ Fix: Give compile-time conditions and unsupported branches fixed blocks.
473
+
474
+ ```hsx expect=HSX1405
475
+ program catalog_probe "Catalog probe"
476
+ export instrument template() { unsupported: true; fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
477
+ instrument probe = template()
478
+ ```
479
+
480
+ ## HSX1406: Invalid companion instrument
481
+
482
+ Stage: `typecheck`
483
+
484
+ Fix: Construct each companion with a compile-time id.
485
+
486
+ ```hsx expect=HSX1406
487
+ program catalog_probe "Catalog probe"
488
+ export instrument template() {
489
+ fields {}
490
+ lifecycle { states created; initial created; }
491
+ action create { steps: []; }
492
+ instruments { invalid: true; }
493
+ }
494
+ instrument probe = template()
495
+ ```
496
+
497
+ ## HSX1501: Unknown UDL clause
498
+
499
+ Stage: `typecheck`
500
+
501
+ Fix: Use a clause exported by the targeted UDL vocabulary.
502
+
503
+ ```hsx expect=HSX1501
504
+ program catalog_probe "Catalog probe"
505
+ instrument probe {
506
+ fields {}
507
+ lifecycle { states created; initial created; }
508
+ action create { steps: []; }
509
+ unknown_clause: true;
510
+ }
511
+ ```
512
+
513
+ ## HSX1502: Program emits no instruments
514
+
515
+ Stage: `typecheck`
516
+
517
+ Fix: Declare or instantiate at least one instrument.
518
+
519
+ ```hsx expect=HSX1502
520
+ program catalog_probe "Catalog probe"
521
+ ```
522
+
523
+ ## HSX1503: Missing fields block
524
+
525
+ Stage: `typecheck`
526
+
527
+ Fix: Add a fields block, even when it is empty.
528
+
529
+ ```hsx expect=HSX1503
530
+ program catalog_probe "Catalog probe"
531
+ instrument probe { lifecycle { states created; initial created; }; action create { steps: []; }; }
532
+ ```
533
+
534
+ ## HSX1504: Missing create action
535
+
536
+ Stage: `typecheck`
537
+
538
+ Fix: Add an action create block.
539
+
540
+ ```hsx expect=HSX1504
541
+ program catalog_probe "Catalog probe"
542
+ instrument probe { fields {}; lifecycle { states created; initial created; }; }
543
+ ```
544
+
545
+ ## HSX1505: Repeated single-valued clause
546
+
547
+ Stage: `typecheck`
548
+
549
+ Fix: Keep one occurrence of the clause.
550
+
551
+ ```hsx expect=HSX1505
552
+ program catalog_probe "Catalog probe"
553
+ instrument probe {
554
+ fields {}
555
+ lifecycle { states created; initial created; }
556
+ action create { steps: []; }
557
+ title: "First"; title: "Second";
558
+ }
559
+ ```
560
+
561
+ ## HSX1506: Conflicting public action settings
562
+
563
+ Stage: `typecheck`
564
+
565
+ Fix: Keep either public: none or a public action name.
566
+
567
+ ```hsx expect=HSX1506
568
+ program catalog_probe "Catalog probe"
569
+ instrument probe {
570
+ fields {}
571
+ lifecycle { states created; initial created; }
572
+ action create { steps: []; }
573
+ action finish { public: none; public_action: finishProbe; steps: []; }
574
+ }
575
+ ```
576
+
577
+ ## HSX1507: Invalid application metadata
578
+
579
+ Stage: `typecheck`
580
+
581
+ Fix: Keep contract mechanics in the parameterized instrument.
582
+
583
+ ```hsx expect=HSX1507
584
+ program catalog_probe "Catalog probe"
585
+ export instrument template() { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
586
+ instrument probe = template() { fields: {}; }
587
+ ```
588
+
589
+ ## HSX1601: Invalid UDL shape
590
+
591
+ Stage: `lower`
592
+
593
+ Fix: Correct the named clause so it matches the targeted UDL definition.
594
+
595
+ No source-only witness exists. Typed source cannot bypass the checker to emit an invalid UDL shape.
596
+
597
+ ## HSX1602: Invalid UDL semantics
598
+
599
+ Stage: `lower`
600
+
601
+ Fix: Correct the named clause so it satisfies the targeted UDL law.
602
+
603
+ No source-only witness exists. Typed source cannot bypass the checker to emit invalid UDL semantics.
604
+
605
+ ## HSX1603: Unresolved compiler marker
606
+
607
+ Stage: `lower`
608
+
609
+ Fix: Correct compile-time block keys or parameter bindings.
610
+
611
+ ```hsx expect=HSX1603
612
+ program catalog_probe "Catalog probe"
613
+ instrument probe {
614
+ fields {}
615
+ lifecycle { states created; initial created; }
616
+ action create { steps: []; }
617
+ title: "__hsx_none__";
618
+ }
619
+ ```