@hyperscale0/hsx 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +28 -7
  2. package/dist/src/cli.d.ts +1 -1
  3. package/dist/src/cli.d.ts.map +1 -1
  4. package/dist/src/cli.js +39 -5
  5. package/dist/src/cli.js.map +1 -1
  6. package/dist/src/compile.d.ts +0 -1
  7. package/dist/src/compile.d.ts.map +1 -1
  8. package/dist/src/compile.js +15 -1
  9. package/dist/src/compile.js.map +1 -1
  10. package/dist/src/cost.d.ts +3 -3
  11. package/dist/src/cost.d.ts.map +1 -1
  12. package/dist/src/cost.js +22 -12
  13. package/dist/src/cost.js.map +1 -1
  14. package/dist/src/parse.d.ts.map +1 -1
  15. package/dist/src/parse.js +10 -14
  16. package/dist/src/parse.js.map +1 -1
  17. package/dist/src/std-bundle.d.ts.map +1 -1
  18. package/dist/src/std-bundle.js +20 -84
  19. package/dist/src/std-bundle.js.map +1 -1
  20. package/dist/src/typecheck.d.ts.map +1 -1
  21. package/dist/src/typecheck.js +171 -39
  22. package/dist/src/typecheck.js.map +1 -1
  23. package/dist/src/version.d.ts +1 -1
  24. package/dist/src/version.js +1 -1
  25. package/docs/README.md +4 -2
  26. package/docs/guide/01-first-program.md +1 -1
  27. package/docs/guide/06-schedules.md +5 -1
  28. package/docs/guide/08-writing-a-module.md +48 -0
  29. package/docs/llms-full.txt +1928 -421
  30. package/docs/llms.txt +2 -3
  31. package/docs/reference/cli.md +6 -5
  32. package/docs/reference/diagnostics.md +9 -9
  33. package/docs/reference/grammar.md +2 -3
  34. package/docs/reference/std/advance.md +94 -17
  35. package/docs/reference/std/cancellable_booking.md +138 -17
  36. package/docs/reference/std/captured_payment.md +96 -24
  37. package/docs/reference/std/conditional_disbursement.md +82 -14
  38. package/docs/reference/std/credit_facility.md +89 -16
  39. package/docs/reference/std/held_payment.md +155 -55
  40. package/docs/reference/std/instant_transfer.md +79 -12
  41. package/docs/reference/std/metered.md +71 -9
  42. package/docs/reference/std/pooled_split.md +76 -7
  43. package/docs/reference/std/premium_forward.md +100 -20
  44. package/docs/reference/std/reconciled_payout.md +84 -14
  45. package/docs/reference/std/rotating_pool.md +112 -24
  46. package/docs/reference/std/scheduled.md +117 -32
  47. package/docs/reference/std/security_deposit.md +119 -27
  48. package/docs/reference/std/settlement_batch.md +105 -24
  49. package/docs/reference/std/swap.md +113 -26
  50. package/docs/reference/std/threshold_pool.md +120 -29
  51. package/docs/reference/std/weighted_distribution.md +117 -21
  52. package/docs/reference/types.md +15 -15
  53. package/docs/reference/udl-output.md +6 -6
  54. package/examples/01-first-program/README.md +1 -1
  55. package/examples/{02-imports-and-archetypes → 02-imports-and-modules}/README.md +1 -1
  56. package/examples/{02-imports-and-archetypes → 02-imports-and-modules}/photo-booth.hsx +1 -1
  57. package/examples/04-complete-product/README.md +1 -1
  58. package/examples/05-authored-instrument/README.md +5 -0
  59. package/examples/05-authored-instrument/payment.hsx +37 -0
  60. package/examples/05-watch-club/watch-club.hsx +0 -1
  61. package/examples/README.md +1 -2
  62. package/examples/advance/advance.udl +29 -6
  63. package/examples/cancellable_booking/cancellable_booking.udl +19 -0
  64. package/examples/captured_payment/captured_payment.hsx +0 -4
  65. package/examples/captured_payment/captured_payment.udl +6 -0
  66. package/examples/conditional_disbursement/conditional_disbursement.hsx +0 -2
  67. package/examples/conditional_disbursement/conditional_disbursement.udl +4 -0
  68. package/examples/cost-table.json +136 -8
  69. package/examples/credit_facility/credit_facility.hsx +0 -3
  70. package/examples/credit_facility/credit_facility.udl +17 -1
  71. package/examples/held_payment/held_payment.udl +16 -0
  72. package/examples/instant_transfer/instant_transfer.udl +6 -0
  73. package/examples/metered/metered.udl +5 -1
  74. package/examples/pooled_split/pooled_split.udl +4 -0
  75. package/examples/premium_forward/premium_forward.udl +4 -0
  76. package/examples/reconciled_payout/reconciled_payout.udl +7 -0
  77. package/examples/rotating_pool/rotating_pool.udl +8 -0
  78. package/examples/scheduled/scheduled.udl +18 -3
  79. package/examples/security_deposit/security_deposit.udl +13 -0
  80. package/examples/settlement_batch/settlement_batch.udl +4 -0
  81. package/examples/swap/swap.udl +10 -0
  82. package/examples/threshold_pool/threshold_pool.udl +11 -0
  83. package/examples/weighted_distribution/weighted_distribution.udl +9 -0
  84. package/package.json +10 -10
  85. package/skills/hsx/SKILL.md +2 -36
  86. package/src/cli.ts +41 -5
  87. package/src/compile.ts +14 -6
  88. package/src/cost.ts +13 -16
  89. package/src/parse.ts +15 -10
  90. package/src/std-bundle.ts +21 -88
  91. package/src/typecheck.ts +207 -34
  92. package/src/version.ts +1 -1
  93. package/std/SEMANTICS.md +33 -128
  94. package/std/money_flows/advance.hsx +39 -26
  95. package/std/money_flows/cancellable_booking.hsx +275 -8
  96. package/std/money_flows/captured_payment.hsx +1 -9
  97. package/std/money_flows/conditional_disbursement.hsx +0 -6
  98. package/std/money_flows/credit_facility.hsx +0 -9
  99. package/std/money_flows/held_payment.hsx +39 -1
  100. package/std/money_flows/index.hsx +2 -1
  101. package/std/money_flows/metered.hsx +1 -5
  102. package/std/money_flows/scheduled.hsx +29 -119
  103. package/std/money_flows/threshold_pool.hsx +40 -5
  104. package/std/money_flows/weighted_distribution.hsx +47 -5
  105. package/docs/reference/std/recurring_collection.md +0 -25
  106. package/examples/recurring_collection/README.md +0 -3
  107. package/examples/recurring_collection/recurring_collection.hsx +0 -21
  108. package/examples/recurring_collection/recurring_collection.udl +0 -1135
  109. package/std/money_flows/recurring_collection.hsx +0 -72
@@ -1,72 +0,0 @@
1
- module std.money_flows.recurring_collection
2
-
3
- // Bounded lifecycle state tracker for recurring collections without direct balance movement.
4
- //
5
- // ### Purpose
6
- // `recurring_collection` tracks the ongoing execution state of a series of recurring collections.
7
- // It carries no money amount and no account bindings; each `collect` call records that an installment
8
- // occurred, and `end` closes the series permanently. It is typically paired with an external billing
9
- // engine or a separate debt obligation instrument.
10
- //
11
- // ### Selection guidance
12
- // - vs `scheduled`: `recurring_collection` moves no money and has no ledger accounts or amount partitioning.
13
- // It is a pure lifecycle tracker. Choose `scheduled` when the platform itself must calculate installment amounts,
14
- // enforce calendar intervals, or debit customer accounts.
15
- // - vs `metered`: `metered` bills variable usage against a rate card with real balance movements.
16
- // `recurring_collection` only records collection lifecycle steps.
17
- //
18
- // ### Parameters
19
- // - `marker`: Optional descriptive text marker stored on the recurring collection record.
20
- //
21
- // ### Decision ports
22
- // None. State transitions are controlled directly by API actions (`collect`, `end`).
23
- //
24
- // ### Example
25
- // ```hsx
26
- // program recurring_collection_example "Recurring collection example"
27
- // import { recurring_collection, scheduled } from "std/money_flows"
28
- // party debtor: person
29
- // party repayment_source: business
30
- // party recipient: business
31
- // settlement obligation = scheduled {
32
- // mode: obligation
33
- // payer: repayment_source
34
- // payee: recipient
35
- // debtor: debtor
36
- // amount: principal: money(SAR)
37
- // count: 2
38
- // every: P30D
39
- // first_due: firstDueAt
40
- // mandate: port mandate_evidence
41
- // }
42
- // settlement collection = recurring_collection {}
43
- // port mandate_evidence {
44
- // allowed: [repayment_source]
45
- // shape: { evidenceReference: text }
46
- // }
47
- // ```
48
- export instrument recurring_collection(marker: optional<text>) {
49
- agent_description: concat("Reach for ", words(instrument), " to track a bounded run of scheduled collections, one call per recorded installment. It carries no amount and no account, and every action only advances its own state. A settlement that debits an account on a schedule is a different shape.");
50
- fields {}
51
- lifecycle {
52
- states active ended;
53
- initial active;
54
- on collect: active -> active;
55
- on end: active -> ended;
56
- }
57
- action create {
58
- agent_description: "Open the collection so installments can be recorded against it. This is the first call and the collection starts active. It moves no money.";
59
- summary: "Create a bounded recurring collection";
60
- steps: [];
61
- }
62
- action collect {
63
- agent_description: "Record one due installment as collected. The collection must still be active, and it stays active afterwards so the next installment can follow. It moves no money.";
64
- summary: "Collect one due installment";
65
- steps: [];
66
- }
67
- action end {
68
- agent_description: "Close the collection so no further installment can be recorded. Only an active collection can end, and ended is final. It moves no money.";
69
- summary: "End future collections";
70
- steps: [];
71
- }
72
- }