@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
@@ -1,901 +0,0 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.4.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
- agent_description: "Probe instrument for catalog diagnostics.";
36
- fields { }
37
- lifecycle { states created; initial created; }
38
- action create {
39
- agent_description: "Create a probe instance.";
40
- steps: [];
41
- }
42
-
43
- }
44
- program second "Second"
45
- ```
46
-
47
- ## HSX1003: Invalid declaration name
48
-
49
- Stage: `typecheck`
50
-
51
- Fix: Use lowercase snake_case for program and instrument names.
52
-
53
- ```hsx expect=HSX1003
54
- program NotSnake "Catalog probe"
55
- ```
56
-
57
- ## HSX1004: Duplicate declaration
58
-
59
- Stage: `typecheck`
60
-
61
- Fix: Keep one declaration or give each declaration a distinct name.
62
-
63
- ```hsx expect=HSX1004
64
- program catalog_probe "Catalog probe"
65
- instrument probe {
66
- agent_description: "Probe instrument for catalog diagnostics.";
67
- fields { }
68
- lifecycle { states created; initial created; }
69
- action create {
70
- agent_description: "Create a probe instance.";
71
- steps: [];
72
- }
73
-
74
- }
75
- instrument probe { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
76
- ```
77
-
78
- ## HSX1005: Invalid field name
79
-
80
- Stage: `typecheck`
81
-
82
- Fix: Rename the field in lower camelCase.
83
-
84
- No source-only witness exists. The parser normalizes every accepted field spelling before typechecking.
85
-
86
- ## HSX1006: Invalid module import
87
-
88
- Stage: `bind`
89
-
90
- Fix: Resolve one module that exports each imported name exactly once.
91
-
92
- No source-only witness exists. This refusal requires a compiler-host module resolver result.
93
-
94
- ## HSX1007: Invalid cross-instrument reference
95
-
96
- Stage: `typecheck`
97
-
98
- Fix: Name an existing target instrument in the ref type.
99
-
100
- ```hsx expect=HSX1007
101
- program catalog_probe "Catalog probe"
102
- instrument probe {
103
- fields { parentId { type: ref; description: "Parent"; } }
104
- lifecycle { states created; initial created; }
105
- action create { steps: []; }
106
- }
107
- ```
108
-
109
- ## HSX1008: Invalid subject or decision port
110
-
111
- Stage: `typecheck`
112
-
113
- Fix: Complete the declaration and bind every referenced decision port.
114
-
115
- ```hsx expect=HSX1008
116
- program catalog_probe "Catalog probe"
117
- instrument probe {
118
- agent_description: "Probe instrument for catalog diagnostics.";
119
- fields { }
120
- lifecycle { states created; initial created; }
121
- action create {
122
- agent_description: "Create a probe instance.";
123
- steps: [];
124
- }
125
-
126
- }
127
- subject vehicle { title: "Vehicle"; }
128
- ```
129
-
130
- ## HSX1009: Imported declaration collision
131
-
132
- Stage: `bind`
133
-
134
- Fix: Rename the importer-owned declaration or the module-local declaration.
135
-
136
- No source-only witness exists. This refusal requires declarations returned by a compiler-host module resolver.
137
-
138
- ## HSX1010: Wrong type-argument count
139
-
140
- Stage: `typecheck`
141
-
142
- Fix: Supply exactly the type arguments declared by the instrument function.
143
-
144
- ```hsx expect=HSX1010
145
- program catalog_probe "Catalog probe"
146
- export instrument template<C>() { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
147
- instrument probe = template<SAR, USD>()
148
- ```
149
-
150
- ## HSX1011: Missing required argument
151
-
152
- Stage: `typecheck`
153
-
154
- Fix: Pass every required instrument-function argument.
155
-
156
- ```hsx expect=HSX1011
157
- program catalog_probe "Catalog probe"
158
- export instrument template(value: text) { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
159
- instrument probe = template()
160
- ```
161
-
162
- ## HSX1012: Unknown named argument
163
-
164
- Stage: `typecheck`
165
-
166
- Fix: Remove the argument or use a parameter declared by the instrument function.
167
-
168
- ```hsx expect=HSX1012
169
- program catalog_probe "Catalog probe"
170
- export instrument template() { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
171
- instrument probe = template(typo: true)
172
- ```
173
-
174
- ## HSX1013: Duplicate named argument
175
-
176
- Stage: `typecheck`
177
-
178
- Fix: Pass each named argument once.
179
-
180
- ```hsx expect=HSX1013
181
- program catalog_probe "Catalog probe"
182
- export instrument template(value: text) { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
183
- instrument probe = template(value: "one", value: "two")
184
- ```
185
-
186
- ## HSX1014: JSON supplied as HSX
187
-
188
- Stage: `parse`
189
-
190
- Fix: Replace the JSON object with HSX declarations.
191
-
192
- ```hsx expect=HSX1014
193
- { "hsx": 1 }
194
- ```
195
-
196
- ## HSX1015: Invalid composed program identity
197
-
198
- Stage: `typecheck`
199
-
200
- Fix: Give the composed program a bounded product id and title.
201
-
202
- No source-only witness exists. This refusal requires a compiler-host published catalog.
203
-
204
- ## HSX1016: Empty published composition
205
-
206
- Stage: `typecheck`
207
-
208
- Fix: Select at least one published instrument with use.
209
-
210
- No source-only witness exists. This refusal requires a compiler-host published catalog.
211
-
212
- ## HSX1017: Duplicate published instrument
213
-
214
- Stage: `typecheck`
215
-
216
- Fix: Keep one use declaration for each published instrument.
217
-
218
- No source-only witness exists. This refusal requires a compiler-host published catalog.
219
-
220
- ## HSX1018: Unavailable published instrument
221
-
222
- Stage: `typecheck`
223
-
224
- Fix: Use an instrument id from the supplied published catalog.
225
-
226
- ```hsx expect=HSX1018
227
- program catalog_probe "Catalog probe"
228
- use missing
229
- ```
230
-
231
- ## HSX1020: Invalid public action name
232
-
233
- Stage: `typecheck`
234
-
235
- Fix: Expose each action once under a distinct lower camelCase name.
236
-
237
- No source-only witness exists. This refusal requires a compiler-host published catalog.
238
-
239
- ## HSX1021: Invalid exposed action
240
-
241
- Stage: `typecheck`
242
-
243
- Fix: Expose an action on an explicitly used published instrument.
244
-
245
- No source-only witness exists. This refusal requires a compiler-host published catalog.
246
-
247
- ## HSX1022: Authored instrument collides with published catalog
248
-
249
- Stage: `typecheck`
250
-
251
- Fix: Rename the authored instrument to avoid colliding with published catalog instruments.
252
-
253
- No source-only witness exists. This refusal requires a compiler-host published catalog.
254
-
255
- ## HSX1023: Invalid required-field list
256
-
257
- Stage: `typecheck`
258
-
259
- Fix: List declared, non-optional field names once each.
260
-
261
- ```hsx expect=HSX1023
262
- program catalog_probe "Catalog probe"
263
- instrument probe {
264
- agent_description: "Probe instrument for catalog diagnostics.";
265
- fields { }
266
- lifecycle { states created; initial created; }
267
- action create {
268
- agent_description: "Create a probe instance.";
269
- steps: [];
270
- }
271
- required: missing;
272
- }
273
- ```
274
-
275
- ## HSX1024: Decision party has no matching account binding
276
-
277
- Stage: `typecheck`
278
-
279
- Fix: Bind the allowed party to an account field and use that binding in the decision action.
280
-
281
- ```hsx expect=HSX1024
282
- program decision_binding "Decision binding"
283
- party buyer: person
284
- party seller: business
285
- port approve { allowed: [buyer] }
286
- instrument gated(decision: condition) {
287
- fields {}
288
- parties { payer: seller }
289
- lifecycle { states created done; initial created; on approve: created -> done; }
290
- action create { steps: []; }
291
- action [decision] { steps: []; port { allowed_parties: [payer]; } }
292
- }
293
- instrument gate = gated(decision: port approve)
294
- ```
295
-
296
- ## HSX1025: Unknown decision port shape type
297
-
298
- Stage: `typecheck`
299
-
300
- Fix: Declare the shape field as text, money(CUR), date, integer, boolean, account(CUR), ref<instrument_id>, id(instrument_id), bps, or percent.
301
-
302
- ```hsx expect=HSX1025
303
- program catalog_probe "Catalog probe"
304
- import { security_deposit } from "std/money_flows"
305
- party buyer: person
306
- party seller: business
307
- settlement hold = security_deposit {
308
- payer: buyer
309
- holder: seller
310
- amount: depositAmount: money(SAR)
311
- claim: port report_damage
312
- claim_amount: { field: damageAmount, bound: depositAmount, remainder: return }
313
- return: port pass_inspection
314
- }
315
- port report_damage { allowed: [seller] shape { damageAmount: money(SAR) } }
316
- port pass_inspection { allowed: [seller] shape { invalidField: mystery_type } }
317
- ```
318
-
319
- ## HSX1026: Decision port input type mismatch with instrument capture field
320
-
321
- Stage: `typecheck`
322
-
323
- Fix: Declare the decision port input field with the type expected by the instrument capture field.
324
-
325
- No source-only witness exists. This refusal requires a compiler-host published catalog.
326
-
327
- ## HSX1101: Currency mismatch
328
-
329
- Stage: `typecheck`
330
-
331
- Fix: Use the declared currency because money values never coerce.
332
-
333
- ```hsx expect=HSX1101
334
- program catalog_probe "Catalog probe"
335
- instrument probe {
336
- agent_description: "Probe instrument for catalog diagnostics.";
337
- fields { }
338
- lifecycle { states created; initial created; }
339
- action create {
340
- agent_description: "Create a probe instance.";
341
- steps: [];
342
- }
343
-
344
- }
345
- const fee: money<SAR> = USD 1.00
346
- ```
347
-
348
- ## HSX1102: Money precision exceeds minor units
349
-
350
- Stage: `typecheck`
351
-
352
- Fix: Round the literal to the currency's minor-unit precision.
353
-
354
- ```hsx expect=HSX1102
355
- program catalog_probe "Catalog probe"
356
- instrument probe {
357
- agent_description: "Probe instrument for catalog diagnostics.";
358
- fields { }
359
- lifecycle { states created; initial created; }
360
- action create {
361
- agent_description: "Create a probe instance.";
362
- steps: [];
363
- }
364
-
365
- }
366
- const fee: money<SAR> = SAR 1.001
367
- ```
368
-
369
- ## HSX1103: Invalid numeric value
370
-
371
- Stage: `typecheck`
372
-
373
- Fix: Use an integer, percent, bps, or valid fixed-money binding.
374
-
375
- ```hsx expect=HSX1103
376
- program catalog_probe "Catalog probe"
377
- instrument probe {
378
- agent_description: "Probe instrument for catalog diagnostics.";
379
- fields { }
380
- lifecycle { states created; initial created; }
381
- action create {
382
- agent_description: "Create a probe instance.";
383
- steps: [];
384
- }
385
- summary: 1.5;
386
- }
387
- ```
388
-
389
- ## HSX1104: Value has the wrong type
390
-
391
- Stage: `typecheck`
392
-
393
- Fix: Pass the type declared by the parameter or UDL slot.
394
-
395
- ```hsx expect=HSX1104
396
- program catalog_probe "Catalog probe"
397
- instrument probe {
398
- agent_description: "Probe instrument for catalog diagnostics.";
399
- fields { }
400
- lifecycle { states created; initial created; }
401
- action create {
402
- agent_description: "Create a probe instance.";
403
- steps: [];
404
- }
405
- summary: money(SAR, 2500);
406
- }
407
- ```
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
-
429
- ## HSX1110: Unsupported parameter combination
430
-
431
- Stage: `typecheck`
432
-
433
- Fix: Choose a supported compile-time parameter combination.
434
-
435
- ```hsx expect=HSX1110
436
- program catalog_probe "Catalog probe"
437
- export instrument template() {
438
- unsupported { message: "Not supported"; fix: "Choose another form"; }
439
- fields {}
440
- lifecycle { states created; initial created; }
441
- action create { steps: []; }
442
- }
443
- instrument probe = template()
444
- ```
445
-
446
- ## HSX1201: Linear money consumed more than once
447
-
448
- Stage: `typecheck`
449
-
450
- Fix: Leave exactly one sink for each produced money value.
451
-
452
- ```hsx expect=HSX1201
453
- program catalog_probe "Catalog probe"
454
- instrument probe {
455
- agent_description: "Probe instrument for catalog diagnostics.";
456
- fields { }
457
- lifecycle { states created; initial created; }
458
- action create {
459
- agent_description: "Create a probe instance.";
460
- steps: [];
461
- }
462
- fields { amount: money<SAR>; }
463
- action pay { computes remainder rest { amount_ref: total; on_zero: refuse; total_path: fields.amount; }; moves: [{ amount: rest; }, { amount: rest; }]; }
464
- }
465
- ```
466
-
467
- ## HSX1202: Linear money is unconsumed
468
-
469
- Stage: `typecheck`
470
-
471
- Fix: Route each produced money value to one explicit sink.
472
-
473
- ```hsx expect=HSX1202
474
- program catalog_probe "Catalog probe"
475
- instrument probe {
476
- agent_description: "Probe instrument for catalog diagnostics.";
477
- fields { }
478
- lifecycle { states created; initial created; }
479
- action create {
480
- agent_description: "Create a probe instance.";
481
- steps: [];
482
- }
483
- fields { amount: money<SAR>; }
484
- action pay { computes remainder rest { amount_ref: total; on_zero: refuse; total_path: fields.amount; }; }
485
- }
486
- ```
487
-
488
- ## HSX1301: Missing cost-table price
489
-
490
- Stage: `typecheck`
491
-
492
- Fix: Supply a versioned cost table with a row for every emitted effect.
493
-
494
- ```hsx expect=HSX1301
495
- program catalog_probe "Catalog probe"
496
- instrument probe {
497
- agent_description: "Probe instrument for catalog diagnostics.";
498
- fields { }
499
- lifecycle { states created; initial created; }
500
- action create {
501
- agent_description: "Create a probe instance.";
502
- steps: [];
503
- }
504
-
505
- }
506
- ```
507
-
508
- ## HSX1302: Invalid cost-table row
509
-
510
- Stage: `typecheck`
511
-
512
- Fix: Use non-negative integer prices and a supported settlement timing.
513
-
514
- No source-only witness exists. This refusal requires a malformed compiler-host cost table.
515
-
516
- ## HSX1303: Invalid cost-table currency
517
-
518
- Stage: `typecheck`
519
-
520
- Fix: Use the supported uppercase cost-table currency.
521
-
522
- No source-only witness exists. This refusal requires an invalid compiler-host cost-table currency.
523
-
524
- ## HSX1304: Unpriced ledger currency
525
-
526
- Stage: `typecheck`
527
-
528
- Fix: Move money in a currency the shipped cost tables price.
529
-
530
- ```hsx expect=HSX1304
531
- program catalog_probe "Catalog probe"
532
- instrument probe {
533
- agent_description: "Probe instrument for catalog diagnostics.";
534
- fields { amount: money<JPY>; }
535
- lifecycle { states created; initial created; }
536
- action create {
537
- agent_description: "Create a probe instance.";
538
- steps: [];
539
- }
540
-
541
- }
542
- ```
543
-
544
- ## HSX1305: More than one ledger currency
545
-
546
- Stage: `typecheck`
547
-
548
- Fix: Move all money in one currency; a program bills in one ledger currency.
549
-
550
- ```hsx expect=HSX1305
551
- program catalog_probe "Catalog probe"
552
- instrument probe {
553
- agent_description: "Probe instrument for catalog diagnostics.";
554
- fields { amount: money<SAR>; fee: money<USD>; }
555
- lifecycle { states created; initial created; }
556
- action create {
557
- agent_description: "Create a probe instance.";
558
- steps: [];
559
- }
560
-
561
- }
562
- ```
563
-
564
- ## HSX1306: Fixed-currency amount moved in another currency
565
-
566
- Stage: `typecheck`
567
-
568
- Fix: Bind the currency of a money<CUR> move or account step as the constant CUR; the compiler pins a binding that reads the instrument's currency field.
569
-
570
- ```hsx expect=HSX1306
571
- program catalog_probe "Catalog probe"
572
- instrument probe {
573
- agent_description: "Probe instrument for catalog diagnostics.";
574
- fields { amount: money<SAR>; payeeAccountId: account<SAR>; payerAccountId: account<SAR>; }
575
- lifecycle { states created; initial created; }
576
- action create {
577
- agent_description: "Create a probe instance.";
578
- steps: [];
579
- }
580
- action pay { agent_description: "Pay the amount."; moves: [{ "bind": { "amount": { "from": "instance"; "path": "fields.amount"; }; "currency": { "from": "const"; "value": "USD"; }; "destinationAccountId": { "from": "instance"; "path": "fields.payeeAccountId"; }; "sourceAccountId": { "from": "instance"; "path": "fields.payerAccountId"; }; }; "key": "transfer"; "operation": "internal_transfer.create"; }]; steps: []; }
581
- }
582
- ```
583
-
584
- ## HSX1401: Unbounded action
585
-
586
- Stage: `typecheck`
587
-
588
- Fix: Replace runtime iteration with a bounded compile-time comprehension.
589
-
590
- ```hsx expect=HSX1401
591
- program catalog_probe "Catalog probe"
592
- instrument probe {
593
- agent_description: "Probe instrument for catalog diagnostics.";
594
- fields { }
595
- lifecycle { states created; initial created; }
596
- action create {
597
- agent_description: "Create a probe instance.";
598
- steps: [];
599
- }
600
- action run { while { condition: true; }; }
601
- }
602
- ```
603
-
604
- ## HSX1402: Missing lifecycle
605
-
606
- Stage: `typecheck`
607
-
608
- Fix: Declare lifecycle states and an initial state.
609
-
610
- ```hsx expect=HSX1402
611
- program catalog_probe "Catalog probe"
612
- instrument probe { fields {}; action create { steps: []; }; }
613
- ```
614
-
615
- ## HSX1403: Runtime comprehension bound
616
-
617
- Stage: `typecheck`
618
-
619
- Fix: Use an integer literal or literal finite list as the bound.
620
-
621
- ```hsx expect=HSX1403
622
- program catalog_probe "Catalog probe"
623
- export instrument template(count: integer) {
624
- fields {}
625
- lifecycle { states created; initial created; }
626
- action create { steps: []; }
627
- for item in count { action run_[item] { steps: []; } }
628
- }
629
- instrument probe = template(count: runtimeCount: integer)
630
- ```
631
-
632
- ## HSX1404: Comprehension expansion limit
633
-
634
- Stage: `typecheck`
635
-
636
- Fix: Reduce the fixed expansion to the compiler limit.
637
-
638
- ```hsx expect=HSX1404
639
- program catalog_probe "Catalog probe"
640
- instrument probe {
641
- agent_description: "Probe instrument for catalog diagnostics.";
642
- fields { }
643
- lifecycle { states created; initial created; }
644
- action create {
645
- agent_description: "Create a probe instance.";
646
- steps: [];
647
- }
648
- for item in 257 { action run_[item] { steps: []; } }
649
- }
650
- ```
651
-
652
- ## HSX1405: Invalid compile-time selection
653
-
654
- Stage: `typecheck`
655
-
656
- Fix: Give compile-time conditions and unsupported branches fixed blocks.
657
-
658
- ```hsx expect=HSX1405
659
- program catalog_probe "Catalog probe"
660
- export instrument template() { unsupported: true; fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
661
- instrument probe = template()
662
- ```
663
-
664
- ## HSX1406: Invalid companion instrument
665
-
666
- Stage: `typecheck`
667
-
668
- Fix: Construct each companion with a compile-time id.
669
-
670
- ```hsx expect=HSX1406
671
- program catalog_probe "Catalog probe"
672
- export instrument template() {
673
- fields {}
674
- lifecycle { states created; initial created; }
675
- action create { steps: []; }
676
- instruments { invalid: true; }
677
- }
678
- instrument probe = template()
679
- ```
680
-
681
- ## HSX1501: Unknown UDL clause
682
-
683
- Stage: `typecheck`
684
-
685
- Fix: Use a clause exported by the targeted UDL vocabulary.
686
-
687
- ```hsx expect=HSX1501
688
- program catalog_probe "Catalog probe"
689
- instrument probe {
690
- agent_description: "Probe instrument for catalog diagnostics.";
691
- fields { }
692
- lifecycle { states created; initial created; }
693
- action create {
694
- agent_description: "Create a probe instance.";
695
- steps: [];
696
- }
697
- unknown_clause: true;
698
- }
699
- ```
700
-
701
- ## HSX1502: Program emits no instruments
702
-
703
- Stage: `typecheck`
704
-
705
- Fix: Declare or instantiate at least one instrument.
706
-
707
- ```hsx expect=HSX1502
708
- program catalog_probe "Catalog probe"
709
- ```
710
-
711
- ## HSX1503: Missing fields block
712
-
713
- Stage: `typecheck`
714
-
715
- Fix: Add a fields block, even when it is empty.
716
-
717
- ```hsx expect=HSX1503
718
- program catalog_probe "Catalog probe"
719
- instrument probe { lifecycle { states created; initial created; }; action create { steps: []; }; }
720
- ```
721
-
722
- ## HSX1504: Missing create action
723
-
724
- Stage: `typecheck`
725
-
726
- Fix: Add an action create block.
727
-
728
- ```hsx expect=HSX1504
729
- program catalog_probe "Catalog probe"
730
- instrument probe { fields {}; lifecycle { states created; initial created; }; }
731
- ```
732
-
733
- ## HSX1505: Repeated single-valued clause
734
-
735
- Stage: `typecheck`
736
-
737
- Fix: Keep one occurrence of the clause.
738
-
739
- ```hsx expect=HSX1505
740
- program catalog_probe "Catalog probe"
741
- instrument probe {
742
- agent_description: "Probe instrument for catalog diagnostics.";
743
- fields { }
744
- lifecycle { states created; initial created; }
745
- action create {
746
- agent_description: "Create a probe instance.";
747
- steps: [];
748
- }
749
- title: "First"; title: "Second";
750
- }
751
- ```
752
-
753
- ## HSX1506: Conflicting public action settings
754
-
755
- Stage: `typecheck`
756
-
757
- Fix: Keep either public: none or a public action name.
758
-
759
- ```hsx expect=HSX1506
760
- program catalog_probe "Catalog probe"
761
- instrument probe {
762
- agent_description: "Probe instrument for catalog diagnostics.";
763
- fields { }
764
- lifecycle { states created; initial created; }
765
- action create {
766
- agent_description: "Create a probe instance.";
767
- steps: [];
768
- }
769
- action finish { public: none; public_action: finishProbe; steps: []; }
770
- }
771
- ```
772
-
773
- ## HSX1507: Invalid application metadata
774
-
775
- Stage: `typecheck`
776
-
777
- Fix: Keep contract mechanics in the parameterized instrument.
778
-
779
- ```hsx expect=HSX1507
780
- program catalog_probe "Catalog probe"
781
- export instrument template() { fields {}; lifecycle { states created; initial created; }; action create { steps: []; }; }
782
- instrument probe = template() { fields: {}; }
783
- ```
784
-
785
- ## HSX1508: Invalid action-level port syntax
786
-
787
- Stage: `typecheck`
788
-
789
- Fix: Use allowed_parties: [...] inside an action-level port clause; allowed: is for top-level port declarations.
790
-
791
- ```hsx expect=HSX1508
792
- program catalog_probe "Catalog probe"
793
- party approver: person
794
- instrument probe {
795
- fields {}
796
- lifecycle { states created; initial created; }
797
- action create {
798
- steps: [];
799
- port { allowed: [approver]; }
800
- }
801
- }
802
- ```
803
-
804
- ## HSX1509: Callable action without an agent description
805
-
806
- Stage: `typecheck`
807
-
808
- Fix: Add agent_description: "..." to the instrument and to every action a caller can reach; composer.check refuses the program without them.
809
-
810
- ```hsx expect=HSX1509
811
- program catalog_probe "Catalog probe"
812
- instrument probe {
813
- fields {}
814
- lifecycle { states created; initial created; }
815
- action create { steps: []; }
816
- }
817
- ```
818
-
819
- ## HSX1601: Invalid UDL shape
820
-
821
- Stage: `lower`
822
-
823
- Fix: Correct the named clause so it matches the targeted UDL definition.
824
-
825
- No source-only witness exists. Typed source cannot bypass the checker to emit an invalid UDL shape.
826
-
827
- ## HSX1602: Invalid UDL semantics
828
-
829
- Stage: `lower`
830
-
831
- Fix: Correct the named clause so it satisfies the targeted UDL law.
832
-
833
- No source-only witness exists. Typed source cannot bypass the checker to emit invalid UDL semantics.
834
-
835
- ## HSX1603: Unresolved compiler marker
836
-
837
- Stage: `lower`
838
-
839
- Fix: Correct compile-time block keys or parameter bindings.
840
-
841
- ```hsx expect=HSX1603
842
- program catalog_probe "Catalog probe"
843
- instrument probe {
844
- agent_description: "Probe instrument for catalog diagnostics.";
845
- fields { }
846
- lifecycle { states created; initial created; }
847
- action create {
848
- agent_description: "Create a probe instance.";
849
- steps: [];
850
- }
851
- title: "__hsx_none__";
852
- }
853
- ```
854
-
855
- ## HSX1610: Invalid piece partition
856
-
857
- Stage: `typecheck`
858
-
859
- Fix: Bind immutable money and account fields to one declared partition.
860
-
861
- No source-only witness exists. The shared UDL action-plan validator supplies the code and source path.
862
-
863
- ## HSX1611: Invalid piece stage
864
-
865
- Stage: `typecheck`
866
-
867
- Fix: Use a declared piece stage and let the compiler derive pieceId.
868
-
869
- No source-only witness exists. The shared UDL action-plan validator supplies the code and source path.
870
-
871
- ## HSX1612: Invalid action graph
872
-
873
- Stage: `typecheck`
874
-
875
- Fix: Declare an acyclic action graph within the expansion bound.
876
-
877
- No source-only witness exists. The shared UDL action-plan validator supplies the code and source path.
878
-
879
- ## HSX1613: Invalid static call binding
880
-
881
- Stage: `typecheck`
882
-
883
- Fix: Bind declared typed targets with unique captures and money consumption.
884
-
885
- No source-only witness exists. The shared UDL action-plan validator supplies the code and source path.
886
-
887
- ## HSX1614: Incompatible action boundary
888
-
889
- Stage: `typecheck`
890
-
891
- Fix: Keep the parent principal, approval and recovery boundary.
892
-
893
- No source-only witness exists. The shared UDL action-plan validator supplies the code and source path.
894
-
895
- ## HSX1615: Invalid leaf evidence or effects
896
-
897
- Stage: `typecheck`
898
-
899
- Fix: Declare evidence and the exact effects of each expanded leaf.
900
-
901
- No source-only witness exists. The shared UDL action-plan validator supplies the code and source path.