@hyperscale0/hsx 1.0.0 → 2.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.
- package/CHANGELOG.md +28 -4
- package/README.md +58 -38
- package/dist/src/ast.d.ts +4 -2
- package/dist/src/ast.d.ts.map +1 -1
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/compile.d.ts +8 -2
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +8 -1
- package/dist/src/compile.js.map +1 -1
- package/dist/src/cost.d.ts +3 -1
- package/dist/src/cost.d.ts.map +1 -1
- package/dist/src/cost.js +124 -94
- package/dist/src/cost.js.map +1 -1
- package/dist/src/diagnostics.d.ts.map +1 -1
- package/dist/src/diagnostics.js +96 -5
- package/dist/src/diagnostics.js.map +1 -1
- package/dist/src/emit.d.ts +3 -1
- package/dist/src/emit.d.ts.map +1 -1
- package/dist/src/emit.js +27 -10
- package/dist/src/emit.js.map +1 -1
- package/dist/src/format.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/ir.d.ts.map +1 -1
- package/dist/src/lex.d.ts.map +1 -1
- package/dist/src/lsp/server.js.map +1 -1
- package/dist/src/modules.js +7 -3
- package/dist/src/modules.js.map +1 -1
- package/dist/src/parse.js +3 -3
- package/dist/src/parse.js.map +1 -1
- package/dist/src/std-bundle.js +41 -41
- package/dist/src/std-bundle.js.map +1 -1
- package/dist/src/std-library.js +2 -2
- package/dist/src/typecheck.d.ts.map +1 -1
- package/dist/src/typecheck.js +948 -157
- package/dist/src/typecheck.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/docs/README.md +10 -1
- package/docs/assets/hsx.svg +18 -0
- package/docs/guide/01-first-program.md +1 -1
- package/docs/guide/02-money.md +1 -1
- package/docs/guide/03-instruments.md +44 -3
- package/docs/guide/04-lifecycles.md +18 -3
- package/docs/guide/05-fees-and-splits.md +2 -2
- package/docs/guide/06-schedules.md +1 -1
- package/docs/guide/07-composition.md +8 -2
- package/docs/guide/08-writing-a-module.md +13 -2
- package/docs/guide/09-cost.md +3 -3
- package/docs/guide/10-diagnostics.md +1 -1
- package/docs/llms-full.txt +473 -190
- package/docs/llms.txt +2 -2
- package/docs/playground.md +4 -3
- package/docs/reference/cli.md +2 -2
- package/docs/reference/diagnostics.md +243 -37
- package/docs/reference/grammar.md +2 -2
- package/docs/reference/std/advance.md +2 -2
- package/docs/reference/std/cancellable_booking.md +10 -10
- package/docs/reference/std/captured_payment.md +14 -14
- package/docs/reference/std/conditional_disbursement.md +3 -3
- package/docs/reference/std/credit_facility.md +2 -2
- package/docs/reference/std/held_payment.md +37 -33
- package/docs/reference/std/instant_transfer.md +8 -8
- package/docs/reference/std/metered.md +2 -2
- package/docs/reference/std/pooled_split.md +2 -2
- package/docs/reference/std/premium_forward.md +13 -13
- package/docs/reference/std/reconciled_payout.md +2 -2
- package/docs/reference/std/recurring_collection.md +2 -2
- package/docs/reference/std/rotating_pool.md +2 -2
- package/docs/reference/std/scheduled.md +18 -18
- package/docs/reference/std/security_deposit.md +14 -14
- package/docs/reference/std/settlement_batch.md +2 -2
- package/docs/reference/std/swap.md +18 -18
- package/docs/reference/std/threshold_pool.md +2 -2
- package/docs/reference/std/weighted_distribution.md +2 -2
- package/docs/reference/types.md +1 -1
- package/docs/reference/udl-output.md +1 -1
- package/examples/01-first-program/README.md +1 -1
- package/examples/01-first-program/tip-jar.hsx +1 -1
- package/examples/02-imports-and-archetypes/photo-booth.hsx +1 -1
- package/examples/03-diagnostics/corner-shop-fixed.hsx +1 -1
- package/examples/03-diagnostics/corner-shop.hsx +1 -1
- package/examples/04-complete-product/study-hall.hsx +1 -1
- package/examples/05-watch-club/README.md +0 -3
- package/examples/05-watch-club/watch-club.hsx +1 -1
- package/examples/README.md +35 -4
- package/examples/advance/advance.hsx +1 -1
- package/examples/advance/advance.udl +16 -11
- package/examples/cancellable_booking/cancellable_booking.hsx +1 -1
- package/examples/cancellable_booking/cancellable_booking.udl +13 -11
- package/examples/captured_payment/captured_payment.hsx +1 -1
- package/examples/captured_payment/captured_payment.udl +10 -7
- package/examples/conditional_disbursement/conditional_disbursement.hsx +1 -1
- package/examples/conditional_disbursement/conditional_disbursement.udl +7 -5
- package/examples/cost-table.json +1542 -382
- package/examples/credit_facility/credit_facility.hsx +1 -1
- package/examples/credit_facility/credit_facility.udl +26 -19
- package/examples/held_payment/held_payment.hsx +1 -1
- package/examples/held_payment/held_payment.udl +61 -15
- package/examples/instant_transfer/instant_transfer.hsx +1 -1
- package/examples/instant_transfer/instant_transfer.udl +17 -11
- package/examples/metered/metered.hsx +1 -1
- package/examples/metered/metered.udl +8 -6
- package/examples/pooled_split/pooled_split.hsx +1 -1
- package/examples/pooled_split/pooled_split.udl +16 -13
- package/examples/premium_forward/premium_forward.hsx +1 -1
- package/examples/premium_forward/premium_forward.udl +22 -16
- package/examples/reconciled_payout/reconciled_payout.hsx +1 -1
- package/examples/reconciled_payout/reconciled_payout.udl +4 -2
- package/examples/recurring_collection/recurring_collection.hsx +1 -1
- package/examples/recurring_collection/recurring_collection.udl +20 -15
- package/examples/rotating_pool/rotating_pool.hsx +1 -1
- package/examples/rotating_pool/rotating_pool.udl +92 -82
- package/examples/scheduled/scheduled.hsx +1 -1
- package/examples/scheduled/scheduled.udl +15 -10
- package/examples/security_deposit/security_deposit.hsx +1 -1
- package/examples/security_deposit/security_deposit.udl +19 -5
- package/examples/settlement_batch/settlement_batch.hsx +1 -1
- package/examples/swap/swap.hsx +1 -1
- package/examples/swap/swap.udl +34 -28
- package/examples/threshold_pool/threshold_pool.hsx +1 -1
- package/examples/threshold_pool/threshold_pool.udl +14 -12
- package/examples/weighted_distribution/weighted_distribution.hsx +1 -1
- package/examples/weighted_distribution/weighted_distribution.udl +6 -4
- package/package.json +6 -5
- package/skills/hsx/SKILL.md +26 -26
- package/src/ast.ts +4 -2
- package/src/cli.ts +4 -4
- package/src/compile.ts +14 -3
- package/src/cost.ts +176 -104
- package/src/diagnostics.ts +99 -4
- package/src/emit.ts +32 -18
- package/src/index.ts +2 -1
- package/src/modules.ts +9 -3
- package/src/parse.ts +3 -3
- package/src/std-bundle.ts +41 -41
- package/src/std-library.ts +2 -2
- package/src/typecheck.ts +1251 -235
- package/src/version.ts +1 -1
- package/std/SEMANTICS.md +12 -3
- package/std/{settlements → money_flows}/advance.hsx +1 -1
- package/std/{settlements → money_flows}/cancellable_booking.hsx +4 -3
- package/std/{settlements → money_flows}/captured_payment.hsx +35 -6
- package/std/{settlements → money_flows}/conditional_disbursement.hsx +17 -16
- package/std/{settlements → money_flows}/credit_facility.hsx +1 -2
- package/std/{settlements → money_flows}/held_payment.hsx +61 -25
- package/std/money_flows/index.hsx +3 -0
- package/std/{settlements → money_flows}/instant_transfer.hsx +2 -3
- package/std/{settlements → money_flows}/metered.hsx +1 -1
- package/std/{settlements → money_flows}/pooled_split.hsx +3 -3
- package/std/{settlements → money_flows}/premium_forward.hsx +22 -23
- package/std/{settlements → money_flows}/reconciled_payout.hsx +3 -3
- package/std/{settlements → money_flows}/recurring_collection.hsx +1 -1
- package/std/{settlements → money_flows}/rotating_pool.hsx +8 -6
- package/std/{settlements → money_flows}/scheduled.hsx +22 -27
- package/std/{settlements → money_flows}/security_deposit.hsx +38 -14
- package/std/{settlements → money_flows}/settlement_batch.hsx +3 -3
- package/std/{settlements → money_flows}/swap.hsx +41 -16
- package/std/{settlements → money_flows}/threshold_pool.hsx +5 -5
- package/std/{settlements → money_flows}/weighted_distribution.hsx +6 -6
- package/docs/sessions/2026-09-02-two-instruments.hsx +0 -21
- package/docs/sessions/2026-09-02-two-instruments.md +0 -41
- package/std/settlements/index.hsx +0 -3
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"path": "fields.repayment1Amount"
|
|
35
35
|
},
|
|
36
36
|
"currency": {
|
|
37
|
-
"from": "
|
|
38
|
-
"
|
|
37
|
+
"from": "const",
|
|
38
|
+
"value": "SAR"
|
|
39
39
|
},
|
|
40
40
|
"destinationAccountId": {
|
|
41
41
|
"from": "instance",
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
"path": "fields.repayment2Amount"
|
|
100
100
|
},
|
|
101
101
|
"currency": {
|
|
102
|
-
"from": "
|
|
103
|
-
"
|
|
102
|
+
"from": "const",
|
|
103
|
+
"value": "SAR"
|
|
104
104
|
},
|
|
105
105
|
"destinationAccountId": {
|
|
106
106
|
"from": "instance",
|
|
@@ -162,8 +162,8 @@
|
|
|
162
162
|
"path": "fields.principal"
|
|
163
163
|
},
|
|
164
164
|
"currency": {
|
|
165
|
-
"from": "
|
|
166
|
-
"
|
|
165
|
+
"from": "const",
|
|
166
|
+
"value": "SAR"
|
|
167
167
|
},
|
|
168
168
|
"destinationAccountId": {
|
|
169
169
|
"from": "instance",
|
|
@@ -215,7 +215,8 @@
|
|
|
215
215
|
"feeAmount": {
|
|
216
216
|
"description": "2.5% of principal, the funder's discount repaid on top of the advance",
|
|
217
217
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
218
|
-
"type": "string"
|
|
218
|
+
"type": "string",
|
|
219
|
+
"x-hyperscale-currency": "SAR"
|
|
219
220
|
},
|
|
220
221
|
"firstDueAt": {
|
|
221
222
|
"description": "Due date of the first repayment; repayment k falls P30D after its predecessor",
|
|
@@ -236,7 +237,8 @@
|
|
|
236
237
|
"principal": {
|
|
237
238
|
"description": "The advanced amount in SAR minor units, disbursed to the recipient up front",
|
|
238
239
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
239
|
-
"type": "string"
|
|
240
|
+
"type": "string",
|
|
241
|
+
"x-hyperscale-currency": "SAR"
|
|
240
242
|
},
|
|
241
243
|
"recipientAccountId": {
|
|
242
244
|
"description": "The recipient account",
|
|
@@ -252,17 +254,20 @@
|
|
|
252
254
|
"repayableAmount": {
|
|
253
255
|
"description": "principal + feeAmount: the total the repayment fields below partition exactly",
|
|
254
256
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
255
|
-
"type": "string"
|
|
257
|
+
"type": "string",
|
|
258
|
+
"x-hyperscale-currency": "SAR"
|
|
256
259
|
},
|
|
257
260
|
"repayment1Amount": {
|
|
258
261
|
"description": "Repayment 1 of 2 (carries the integer-division remainder): about 33.34% of repayableAmount, collected on its own stored-date anchor",
|
|
259
262
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
260
|
-
"type": "string"
|
|
263
|
+
"type": "string",
|
|
264
|
+
"x-hyperscale-currency": "SAR"
|
|
261
265
|
},
|
|
262
266
|
"repayment2Amount": {
|
|
263
267
|
"description": "Repayment 2 of 2: about 33.33% of repayableAmount, collected on its own stored-date anchor",
|
|
264
268
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
265
|
-
"type": "string"
|
|
269
|
+
"type": "string",
|
|
270
|
+
"x-hyperscale-currency": "SAR"
|
|
266
271
|
}
|
|
267
272
|
},
|
|
268
273
|
"id": "advance_payment",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
program cancellable_booking_example "Cancellable booking example"
|
|
2
|
-
import { cancellable_booking } from "std/
|
|
2
|
+
import { cancellable_booking } from "std/money_flows"
|
|
3
3
|
party guest: person
|
|
4
4
|
party studio: business
|
|
5
5
|
settlement studio_session = cancellable_booking {
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"path": "fields.sessionPrice"
|
|
81
81
|
},
|
|
82
82
|
"currency": {
|
|
83
|
-
"from": "
|
|
84
|
-
"
|
|
83
|
+
"from": "const",
|
|
84
|
+
"value": "SAR"
|
|
85
85
|
},
|
|
86
86
|
"destinationAccountId": {
|
|
87
87
|
"from": "instance",
|
|
@@ -125,8 +125,8 @@
|
|
|
125
125
|
"path": "refs.cancellationRefundAmount"
|
|
126
126
|
},
|
|
127
127
|
"currency": {
|
|
128
|
-
"from": "
|
|
129
|
-
"
|
|
128
|
+
"from": "const",
|
|
129
|
+
"value": "SAR"
|
|
130
130
|
},
|
|
131
131
|
"destinationAccountId": {
|
|
132
132
|
"from": "instance",
|
|
@@ -160,8 +160,8 @@
|
|
|
160
160
|
{
|
|
161
161
|
"bind": {
|
|
162
162
|
"currency": {
|
|
163
|
-
"from": "
|
|
164
|
-
"
|
|
163
|
+
"from": "const",
|
|
164
|
+
"value": "SAR"
|
|
165
165
|
},
|
|
166
166
|
"owner.id": {
|
|
167
167
|
"from": "instance",
|
|
@@ -206,8 +206,8 @@
|
|
|
206
206
|
"path": "refs.cancellationPenaltyAmount"
|
|
207
207
|
},
|
|
208
208
|
"currency": {
|
|
209
|
-
"from": "
|
|
210
|
-
"
|
|
209
|
+
"from": "const",
|
|
210
|
+
"value": "SAR"
|
|
211
211
|
},
|
|
212
212
|
"destinationAccountId": {
|
|
213
213
|
"from": "instance",
|
|
@@ -251,8 +251,8 @@
|
|
|
251
251
|
"path": "fields.sessionPrice"
|
|
252
252
|
},
|
|
253
253
|
"currency": {
|
|
254
|
-
"from": "
|
|
255
|
-
"
|
|
254
|
+
"from": "const",
|
|
255
|
+
"value": "SAR"
|
|
256
256
|
},
|
|
257
257
|
"destinationAccountId": {
|
|
258
258
|
"from": "instance",
|
|
@@ -275,6 +275,7 @@
|
|
|
275
275
|
}
|
|
276
276
|
],
|
|
277
277
|
"publicAction": "takeStudioSession",
|
|
278
|
+
"sandboxFailurePoint": "funding",
|
|
278
279
|
"steps": [],
|
|
279
280
|
"summary": "Take the booking price from the guest into the holding account"
|
|
280
281
|
}
|
|
@@ -303,7 +304,8 @@
|
|
|
303
304
|
"sessionPrice": {
|
|
304
305
|
"description": "Booking price in minor units, held away from both the guest and the studio until the booking ends",
|
|
305
306
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
306
|
-
"type": "string"
|
|
307
|
+
"type": "string",
|
|
308
|
+
"x-hyperscale-currency": "SAR"
|
|
307
309
|
},
|
|
308
310
|
"startsAt": {
|
|
309
311
|
"description": "When the booking starts; the cancellation penalty is priced against the time left before it",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"path": "fields.authorizedAmount"
|
|
39
39
|
},
|
|
40
40
|
"currency": {
|
|
41
|
-
"from": "
|
|
42
|
-
"
|
|
41
|
+
"from": "const",
|
|
42
|
+
"value": "SAR"
|
|
43
43
|
},
|
|
44
44
|
"destinationAccountId": {
|
|
45
45
|
"from": "instance",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
}
|
|
75
75
|
],
|
|
76
76
|
"publicAction": "authorizeCardPayment",
|
|
77
|
+
"sandboxFailurePoint": "funding",
|
|
77
78
|
"steps": [],
|
|
78
79
|
"summary": "Reserve the authorizedAmount until reserveUntil"
|
|
79
80
|
},
|
|
@@ -138,6 +139,7 @@
|
|
|
138
139
|
}
|
|
139
140
|
],
|
|
140
141
|
"publicAction": "captureCardPayment",
|
|
142
|
+
"sandboxFailurePoint": "release",
|
|
141
143
|
"steps": [],
|
|
142
144
|
"summary": "Post one strict partial capture slice"
|
|
143
145
|
},
|
|
@@ -229,8 +231,8 @@
|
|
|
229
231
|
"path": "refs.capturedAmount"
|
|
230
232
|
},
|
|
231
233
|
"currency": {
|
|
232
|
-
"from": "
|
|
233
|
-
"
|
|
234
|
+
"from": "const",
|
|
235
|
+
"value": "SAR"
|
|
234
236
|
},
|
|
235
237
|
"destinationAccountId": {
|
|
236
238
|
"from": "instance",
|
|
@@ -372,8 +374,8 @@
|
|
|
372
374
|
"path": "refs.capturedAmount"
|
|
373
375
|
},
|
|
374
376
|
"currency": {
|
|
375
|
-
"from": "
|
|
376
|
-
"
|
|
377
|
+
"from": "const",
|
|
378
|
+
"value": "SAR"
|
|
377
379
|
},
|
|
378
380
|
"destinationAccountId": {
|
|
379
381
|
"from": "instance",
|
|
@@ -540,7 +542,8 @@
|
|
|
540
542
|
"authorizedAmount": {
|
|
541
543
|
"description": "Maximum captured amount in SAR minor units",
|
|
542
544
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
543
|
-
"type": "string"
|
|
545
|
+
"type": "string",
|
|
546
|
+
"x-hyperscale-currency": "SAR"
|
|
544
547
|
},
|
|
545
548
|
"currency": {
|
|
546
549
|
"description": "ISO 4217 currency code",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
program conditional_disbursement_example "Conditional disbursement example"
|
|
2
|
-
import { conditional_disbursement } from "std/
|
|
2
|
+
import { conditional_disbursement } from "std/money_flows"
|
|
3
3
|
party source: business
|
|
4
4
|
party claimant: person
|
|
5
5
|
settlement claim_payment = conditional_disbursement {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"deny": {
|
|
17
17
|
"agentDescription": "Refuse the whole disbursement without moving money. Every child amount under it must still be unapproved, so call this before any approval lands. The caller passes evidenceReference, which stays in the receipt. Denial is final.",
|
|
18
18
|
"captureInput": {
|
|
19
|
-
"
|
|
19
|
+
"evidenceReference": "evidenceReference"
|
|
20
20
|
},
|
|
21
21
|
"effects": {
|
|
22
22
|
"decides": [
|
|
@@ -95,7 +95,8 @@
|
|
|
95
95
|
"policyLimit": {
|
|
96
96
|
"description": "Disbursement cap in SAR minor units",
|
|
97
97
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
98
|
-
"type": "string"
|
|
98
|
+
"type": "string",
|
|
99
|
+
"x-hyperscale-currency": "SAR"
|
|
99
100
|
},
|
|
100
101
|
"sourceAccountId": {
|
|
101
102
|
"description": "The source account",
|
|
@@ -269,8 +270,8 @@
|
|
|
269
270
|
"path": "fields.amount"
|
|
270
271
|
},
|
|
271
272
|
"currency": {
|
|
272
|
-
"from": "
|
|
273
|
-
"
|
|
273
|
+
"from": "const",
|
|
274
|
+
"value": "SAR"
|
|
274
275
|
},
|
|
275
276
|
"destinationAccountId": {
|
|
276
277
|
"from": "instance",
|
|
@@ -328,7 +329,8 @@
|
|
|
328
329
|
"amount": {
|
|
329
330
|
"description": "Approved amount under the parent cap",
|
|
330
331
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
331
|
-
"type": "string"
|
|
332
|
+
"type": "string",
|
|
333
|
+
"x-hyperscale-currency": "SAR"
|
|
332
334
|
},
|
|
333
335
|
"claimPaymentId": {
|
|
334
336
|
"description": "The exact claim_payment",
|