@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
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"path": "fields.piece1Amount"
|
|
54
54
|
},
|
|
55
55
|
"currency": {
|
|
56
|
-
"from": "
|
|
57
|
-
"
|
|
56
|
+
"from": "const",
|
|
57
|
+
"value": "SAR"
|
|
58
58
|
},
|
|
59
59
|
"destinationAccountId": {
|
|
60
60
|
"from": "instance",
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
]
|
|
96
96
|
},
|
|
97
97
|
"publicAction": "bindPolicyPremium",
|
|
98
|
+
"sandboxFailurePoint": "release",
|
|
98
99
|
"steps": [],
|
|
99
100
|
"summary": "Confirm through bind_policy and start the forward payout"
|
|
100
101
|
},
|
|
@@ -106,8 +107,8 @@
|
|
|
106
107
|
{
|
|
107
108
|
"bind": {
|
|
108
109
|
"currency": {
|
|
109
|
-
"from": "
|
|
110
|
-
"
|
|
110
|
+
"from": "const",
|
|
111
|
+
"value": "SAR"
|
|
111
112
|
},
|
|
112
113
|
"owner.id": {
|
|
113
114
|
"from": "instance",
|
|
@@ -152,8 +153,8 @@
|
|
|
152
153
|
"path": "fields.piece2Amount"
|
|
153
154
|
},
|
|
154
155
|
"currency": {
|
|
155
|
-
"from": "
|
|
156
|
-
"
|
|
156
|
+
"from": "const",
|
|
157
|
+
"value": "SAR"
|
|
157
158
|
},
|
|
158
159
|
"destinationAccountId": {
|
|
159
160
|
"from": "instance",
|
|
@@ -209,8 +210,8 @@
|
|
|
209
210
|
"path": "fields.piece1Amount"
|
|
210
211
|
},
|
|
211
212
|
"currency": {
|
|
212
|
-
"from": "
|
|
213
|
-
"
|
|
213
|
+
"from": "const",
|
|
214
|
+
"value": "SAR"
|
|
214
215
|
},
|
|
215
216
|
"destinationAccountId": {
|
|
216
217
|
"from": "instance",
|
|
@@ -245,6 +246,7 @@
|
|
|
245
246
|
}
|
|
246
247
|
],
|
|
247
248
|
"publicAction": "fundPiece1Premium",
|
|
249
|
+
"sandboxFailurePoint": "funding",
|
|
248
250
|
"steps": [],
|
|
249
251
|
"summary": "Fund piece 1 of the held amount into escrow"
|
|
250
252
|
},
|
|
@@ -266,8 +268,8 @@
|
|
|
266
268
|
"path": "fields.piece2Amount"
|
|
267
269
|
},
|
|
268
270
|
"currency": {
|
|
269
|
-
"from": "
|
|
270
|
-
"
|
|
271
|
+
"from": "const",
|
|
272
|
+
"value": "SAR"
|
|
271
273
|
},
|
|
272
274
|
"destinationAccountId": {
|
|
273
275
|
"from": "instance",
|
|
@@ -302,6 +304,7 @@
|
|
|
302
304
|
}
|
|
303
305
|
],
|
|
304
306
|
"publicAction": "fundPiece2Premium",
|
|
307
|
+
"sandboxFailurePoint": "funding",
|
|
305
308
|
"steps": [],
|
|
306
309
|
"summary": "Fund piece 2 of the held amount into escrow"
|
|
307
310
|
},
|
|
@@ -327,7 +330,7 @@
|
|
|
327
330
|
"record_endorsement": {
|
|
328
331
|
"agentDescription": "Record one endorsement against a policy that already forwarded, from evidence the caller supplies. The forward must be released first, and only the carrier may call it. It moves no money and it does not change the premium.",
|
|
329
332
|
"captureInput": {
|
|
330
|
-
"
|
|
333
|
+
"evidenceReference": "evidenceReference"
|
|
331
334
|
},
|
|
332
335
|
"effects": {
|
|
333
336
|
"decides": [
|
|
@@ -380,8 +383,8 @@
|
|
|
380
383
|
"path": "fields.piece1Amount"
|
|
381
384
|
},
|
|
382
385
|
"currency": {
|
|
383
|
-
"from": "
|
|
384
|
-
"
|
|
386
|
+
"from": "const",
|
|
387
|
+
"value": "SAR"
|
|
385
388
|
},
|
|
386
389
|
"destinationAccountId": {
|
|
387
390
|
"from": "instance",
|
|
@@ -444,12 +447,14 @@
|
|
|
444
447
|
"piece1Amount": {
|
|
445
448
|
"description": "98% of premiumAmount (carries the integer-division remainder): released to the carrier. Computed as floor(premiumAmount * 9800 / 10000) in SAR minor units",
|
|
446
449
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
447
|
-
"type": "string"
|
|
450
|
+
"type": "string",
|
|
451
|
+
"x-hyperscale-currency": "SAR"
|
|
448
452
|
},
|
|
449
453
|
"piece2Amount": {
|
|
450
454
|
"description": "2% of premiumAmount: released to the platform. Computed as floor(premiumAmount * 200 / 10000) in SAR minor units",
|
|
451
455
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
452
|
-
"type": "string"
|
|
456
|
+
"type": "string",
|
|
457
|
+
"x-hyperscale-currency": "SAR"
|
|
453
458
|
},
|
|
454
459
|
"platformAccountId": {
|
|
455
460
|
"description": "The product fee collection account",
|
|
@@ -484,7 +489,8 @@
|
|
|
484
489
|
"premiumAmount": {
|
|
485
490
|
"description": "The gross held amount in SAR minor units; the piece fields below partition it exactly",
|
|
486
491
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
487
|
-
"type": "string"
|
|
492
|
+
"type": "string",
|
|
493
|
+
"x-hyperscale-currency": "SAR"
|
|
488
494
|
},
|
|
489
495
|
"renewalDueAt": {
|
|
490
496
|
"description": "Stored renewal due condition for the forwarded policy",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
program reconciled_payout_example "Reconciled payout example"
|
|
2
|
-
import { reconciled_payout } from "std/
|
|
2
|
+
import { reconciled_payout } from "std/money_flows"
|
|
3
3
|
party treasury: business
|
|
4
4
|
party supplier: business
|
|
5
5
|
settlement supplier_payout = reconciled_payout {
|
|
@@ -108,7 +108,8 @@
|
|
|
108
108
|
"netPayable": {
|
|
109
109
|
"description": "Amount instructed to the supplier in minor units",
|
|
110
110
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
111
|
-
"type": "string"
|
|
111
|
+
"type": "string",
|
|
112
|
+
"x-hyperscale-currency": "SAR"
|
|
112
113
|
},
|
|
113
114
|
"settleBy": {
|
|
114
115
|
"description": "Instant the expectation stops waiting and the unmatched amount becomes a break",
|
|
@@ -265,7 +266,8 @@
|
|
|
265
266
|
"unmatchedAmount": {
|
|
266
267
|
"description": "Difference between the instructed amount and the evidence, in minor units",
|
|
267
268
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
268
|
-
"type": "string"
|
|
269
|
+
"type": "string",
|
|
270
|
+
"x-hyperscale-currency": "SAR"
|
|
269
271
|
}
|
|
270
272
|
},
|
|
271
273
|
"id": "supplier_payout_break",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
program recurring_collection_example "Recurring collection example"
|
|
2
|
-
import { recurring_collection, scheduled } from "std/
|
|
2
|
+
import { recurring_collection, scheduled } from "std/money_flows"
|
|
3
3
|
party debtor: person
|
|
4
4
|
party repayment_source: business
|
|
5
5
|
party recipient: business
|
|
@@ -294,7 +294,8 @@
|
|
|
294
294
|
"installment1Amount": {
|
|
295
295
|
"description": "Stored amount for installment 1 of 2 (carries the integer-division remainder)",
|
|
296
296
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
297
|
-
"type": "string"
|
|
297
|
+
"type": "string",
|
|
298
|
+
"x-hyperscale-currency": "SAR"
|
|
298
299
|
},
|
|
299
300
|
"installment1DelinquentAfter": {
|
|
300
301
|
"description": "Machine-set marker proving installment 1 reached its stored due date while unpaid",
|
|
@@ -304,7 +305,8 @@
|
|
|
304
305
|
"installment2Amount": {
|
|
305
306
|
"description": "Stored amount for installment 2 of 2",
|
|
306
307
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
307
|
-
"type": "string"
|
|
308
|
+
"type": "string",
|
|
309
|
+
"x-hyperscale-currency": "SAR"
|
|
308
310
|
},
|
|
309
311
|
"installment2DelinquentAfter": {
|
|
310
312
|
"description": "Machine-set marker proving installment 2 reached its stored due date while unpaid",
|
|
@@ -314,7 +316,8 @@
|
|
|
314
316
|
"principal": {
|
|
315
317
|
"description": "The principal in SAR minor units; the stored installment anchors partition it exactly",
|
|
316
318
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
317
|
-
"type": "string"
|
|
319
|
+
"type": "string",
|
|
320
|
+
"x-hyperscale-currency": "SAR"
|
|
318
321
|
},
|
|
319
322
|
"recipientAccountId": {
|
|
320
323
|
"description": "The recipient account",
|
|
@@ -492,8 +495,8 @@
|
|
|
492
495
|
"path": "fields.amount"
|
|
493
496
|
},
|
|
494
497
|
"currency": {
|
|
495
|
-
"from": "
|
|
496
|
-
"
|
|
498
|
+
"from": "const",
|
|
499
|
+
"value": "SAR"
|
|
497
500
|
},
|
|
498
501
|
"destinationAccountId": {
|
|
499
502
|
"from": "instance",
|
|
@@ -547,7 +550,7 @@
|
|
|
547
550
|
"summary": "Refund this one stored installment 1 payment whole"
|
|
548
551
|
},
|
|
549
552
|
"repay": {
|
|
550
|
-
"agentDescription": "Pay this record's amount toward installment 1. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies,
|
|
553
|
+
"agentDescription": "Pay this record's amount toward installment 1. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, its declared parties may call it and an evidence reference is required.",
|
|
551
554
|
"captureInput": {
|
|
552
555
|
"mandateEvidenceReference": "evidenceReference"
|
|
553
556
|
},
|
|
@@ -594,8 +597,8 @@
|
|
|
594
597
|
"path": "fields.amount"
|
|
595
598
|
},
|
|
596
599
|
"currency": {
|
|
597
|
-
"from": "
|
|
598
|
-
"
|
|
600
|
+
"from": "const",
|
|
601
|
+
"value": "SAR"
|
|
599
602
|
},
|
|
600
603
|
"destinationAccountId": {
|
|
601
604
|
"from": "instance",
|
|
@@ -672,7 +675,8 @@
|
|
|
672
675
|
"amount": {
|
|
673
676
|
"description": "Positive payment amount capped with its paid siblings at installment1Amount",
|
|
674
677
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
675
|
-
"type": "string"
|
|
678
|
+
"type": "string",
|
|
679
|
+
"x-hyperscale-currency": "SAR"
|
|
676
680
|
},
|
|
677
681
|
"currency": {
|
|
678
682
|
"description": "ISO 4217 currency code",
|
|
@@ -808,8 +812,8 @@
|
|
|
808
812
|
"path": "fields.amount"
|
|
809
813
|
},
|
|
810
814
|
"currency": {
|
|
811
|
-
"from": "
|
|
812
|
-
"
|
|
815
|
+
"from": "const",
|
|
816
|
+
"value": "SAR"
|
|
813
817
|
},
|
|
814
818
|
"destinationAccountId": {
|
|
815
819
|
"from": "instance",
|
|
@@ -863,7 +867,7 @@
|
|
|
863
867
|
"summary": "Refund this one stored installment 2 payment whole"
|
|
864
868
|
},
|
|
865
869
|
"repay": {
|
|
866
|
-
"agentDescription": "Pay this record's amount toward installment 2. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies,
|
|
870
|
+
"agentDescription": "Pay this record's amount toward installment 2. The record must be created and its obligation live. Refused when this amount plus the records already paid against that installment would pass the stored amount. This moves the payer's money. Where a mandate applies, its declared parties may call it and an evidence reference is required.",
|
|
867
871
|
"captureInput": {
|
|
868
872
|
"mandateEvidenceReference": "evidenceReference"
|
|
869
873
|
},
|
|
@@ -910,8 +914,8 @@
|
|
|
910
914
|
"path": "fields.amount"
|
|
911
915
|
},
|
|
912
916
|
"currency": {
|
|
913
|
-
"from": "
|
|
914
|
-
"
|
|
917
|
+
"from": "const",
|
|
918
|
+
"value": "SAR"
|
|
915
919
|
},
|
|
916
920
|
"destinationAccountId": {
|
|
917
921
|
"from": "instance",
|
|
@@ -988,7 +992,8 @@
|
|
|
988
992
|
"amount": {
|
|
989
993
|
"description": "Positive payment amount capped with its paid siblings at installment2Amount",
|
|
990
994
|
"pattern": "^[1-9][0-9]{0,17}$",
|
|
991
|
-
"type": "string"
|
|
995
|
+
"type": "string",
|
|
996
|
+
"x-hyperscale-currency": "SAR"
|
|
992
997
|
},
|
|
993
998
|
"currency": {
|
|
994
999
|
"description": "ISO 4217 currency code",
|