@hyperscale0/hsx 2.1.0 → 2.1.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 (34) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/src/cli.d.ts +1 -1
  3. package/dist/src/version.d.ts +1 -1
  4. package/dist/src/version.js +1 -1
  5. package/docs/README.md +4 -0
  6. package/docs/llms-full.txt +2 -2
  7. package/docs/llms.txt +2 -2
  8. package/docs/piece-plans.md +120 -0
  9. package/docs/reference/cli.md +2 -2
  10. package/docs/reference/diagnostics.md +1 -1
  11. package/docs/reference/grammar.md +1 -1
  12. package/docs/reference/std/advance.md +1 -1
  13. package/docs/reference/std/cancellable_booking.md +1 -1
  14. package/docs/reference/std/captured_payment.md +1 -1
  15. package/docs/reference/std/conditional_disbursement.md +1 -1
  16. package/docs/reference/std/credit_facility.md +1 -1
  17. package/docs/reference/std/held_payment.md +1 -1
  18. package/docs/reference/std/instant_transfer.md +1 -1
  19. package/docs/reference/std/metered.md +1 -1
  20. package/docs/reference/std/pooled_split.md +1 -1
  21. package/docs/reference/std/premium_forward.md +1 -1
  22. package/docs/reference/std/reconciled_payout.md +1 -1
  23. package/docs/reference/std/recurring_collection.md +1 -1
  24. package/docs/reference/std/rotating_pool.md +1 -1
  25. package/docs/reference/std/scheduled.md +1 -1
  26. package/docs/reference/std/security_deposit.md +1 -1
  27. package/docs/reference/std/settlement_batch.md +1 -1
  28. package/docs/reference/std/swap.md +1 -1
  29. package/docs/reference/std/threshold_pool.md +1 -1
  30. package/docs/reference/std/weighted_distribution.md +1 -1
  31. package/docs/reference/types.md +1 -1
  32. package/docs/reference/udl-output.md +1 -1
  33. package/package.json +3 -3
  34. package/src/version.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -9,6 +9,14 @@ independently of the package version.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [2.1.1] - 2026-09-15
13
+
14
+ Published in lockstep with UDL 2.3.0.
15
+
16
+ ### Added
17
+
18
+ - `docs/piece-plans.md`, a guide to partitioned totals: declaring pieces, orders and payees, staging one piece per action, and reading the compiled plan.
19
+
12
20
  ## [2.1.0] - 2026-09-14
13
21
 
14
22
  Published in lockstep with UDL 2.1.0.
package/dist/src/cli.d.ts CHANGED
@@ -18,6 +18,6 @@ export interface Io {
18
18
  readonly stdin?: NodeJS.ReadableStream;
19
19
  readonly stdout?: NodeJS.WritableStream;
20
20
  }
21
- export declare const USAGE_TEXT = "hsx 2.1.0, the HSX compiler\n\nUsage:\n hsx check <file.hsx> [--strict]\n hsx build <file.hsx> [--out <file.json>] [--strict]\n hsx cost <file.hsx> [--json] [--out <file.json>] [--strict]\n hsx explain <HSX####>\n hsx format <file.hsx>\n hsx lsp\n hsx --version\n hsx --help\n\nCommands:\n check Compile and report diagnostics. Prints nothing when the program is clean.\n build Compile and write canonical UDL as JSON.\n cost Compile and print the version-pinned cost manifest as a table or JSON.\n explain Print one diagnostic title, fix, and source example.\n format Print the source in the one canonical HSX style.\n lsp Run the language server over stdin and stdout.\n\nOptions:\n --json Print the cost manifest as JSON instead of a table.\n --out <file> Write build or cost JSON to this path instead of stdout.\n --strict Treat warning-severity diagnostics as failures.\n\nExit codes:\n 0 the program compiled (verdict valid, or warning without --strict)\n 1 the program was refused (verdict invalid, or warning with --strict)\n 2 the command line or the input file could not be used";
21
+ export declare const USAGE_TEXT = "hsx 2.1.1, the HSX compiler\n\nUsage:\n hsx check <file.hsx> [--strict]\n hsx build <file.hsx> [--out <file.json>] [--strict]\n hsx cost <file.hsx> [--json] [--out <file.json>] [--strict]\n hsx explain <HSX####>\n hsx format <file.hsx>\n hsx lsp\n hsx --version\n hsx --help\n\nCommands:\n check Compile and report diagnostics. Prints nothing when the program is clean.\n build Compile and write canonical UDL as JSON.\n cost Compile and print the version-pinned cost manifest as a table or JSON.\n explain Print one diagnostic title, fix, and source example.\n format Print the source in the one canonical HSX style.\n lsp Run the language server over stdin and stdout.\n\nOptions:\n --json Print the cost manifest as JSON instead of a table.\n --out <file> Write build or cost JSON to this path instead of stdout.\n --strict Treat warning-severity diagnostics as failures.\n\nExit codes:\n 0 the program compiled (verdict valid, or warning without --strict)\n 1 the program was refused (verdict invalid, or warning with --strict)\n 2 the command line or the input file could not be used";
22
22
  export declare function runCli(argv: readonly string[], io: Io): Promise<number>;
23
23
  //# sourceMappingURL=cli.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /** Package version reported by the command line. */
2
- export declare const HSX_VERSION = "2.1.0";
2
+ export declare const HSX_VERSION = "2.1.1";
3
3
  /** Canonical UDL contract version emitted by this compiler. */
4
4
  export declare const HSX_TARGET_UDL_VERSION = 1;
5
5
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /** Package version reported by the command line. */
2
- export const HSX_VERSION = "2.1.0";
2
+ export const HSX_VERSION = "2.1.1";
3
3
  /** Canonical UDL contract version emitted by this compiler. */
4
4
  export const HSX_TARGET_UDL_VERSION = 1;
5
5
  //# sourceMappingURL=version.js.map
package/docs/README.md CHANGED
@@ -22,6 +22,10 @@ The [browser playground](./playground.md) provides a static editing surface with
22
22
  live compilation, diagnostics inspection, and example programs. The hosted
23
23
  playground is served at https://hyperscale0.ai/playground.
24
24
 
25
+ [Compose actions over a piece plan](./piece-plans.md) is a worked excerpt, not
26
+ a standalone program: it shows the `piece_plan`, `piece_stage`, `calls` and
27
+ `action_library` clauses inside an instrument.
28
+
25
29
  ## Examples and tooling
26
30
 
27
31
  - [Standard library examples](../examples/README.md)
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # HSX full documentation
4
4
 
@@ -374,7 +374,7 @@ Exit code `0` means the command accepted the program. Exit code `1` means compil
374
374
  # CLI
375
375
 
376
376
  ```text
377
- hsx 2.1.0, the HSX compiler
377
+ hsx 2.1.1, the HSX compiler
378
378
 
379
379
  Usage:
380
380
  hsx check <file.hsx> [--strict]
package/docs/llms.txt CHANGED
@@ -1,8 +1,8 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # HSX documentation
4
4
 
5
- > Repository guide and generated compiler reference for HSX 2.1.0.
5
+ > Repository guide and generated compiler reference for HSX 2.1.1.
6
6
 
7
7
  ## Guide
8
8
 
@@ -0,0 +1,120 @@
1
+ # Compose actions over a piece plan
2
+
3
+ Use `piece_plan` to declare a finite partition and `piece_stage` to select a
4
+ stage of that plan. Use `calls` and `action_library` to share the transfer
5
+ body. These are ordinary clauses; they do not add another HSX grammar or a
6
+ public operation for each private leaf.
7
+
8
+ The clause shapes are defined by the selected UDL vocabulary. HSX checks them
9
+ in [`typecheck.ts`](../src/typecheck.ts) and preserves them in
10
+ [`emit.ts`](../src/emit.ts). The round-trip and private-module examples in
11
+ [`general-language.spec.ts`](../test/general-language.spec.ts) exercise this
12
+ path. The [UDL output reference](reference/udl-output.md) describes the emitted ABI.
13
+
14
+ ## Worked sale example
15
+
16
+ This excerpt uses the sale settlement's `price` plan and funding call. It
17
+ belongs inside an instrument that declares the referenced immutable fields,
18
+ its lifecycle, its partition and its escrow-account capture. It is not a
19
+ standalone program. The three money fields partition `price` exactly. For
20
+ example, SAR minor-unit amounts `245000`, `3750` and `1250` sum to `250000`.
21
+ The separate service fee is outside that partition.
22
+
23
+ ```hsx
24
+ piece_plan: {
25
+ id: "price";
26
+ total: "price";
27
+ pieces: [
28
+ { id: "seller"; amount: "piece1Amount";
29
+ release_to: "sellerAccountId"; refund_to: "buyerAccountId"; },
30
+ { id: "platform_fee"; amount: "piece2Amount";
31
+ release_to: "platformAccountId"; refund_to: "buyerAccountId"; },
32
+ { id: "seller_cancel_fee"; amount: "piece3Amount";
33
+ release_to: "platformAccountId"; refund_to: "sellerAccountId"; }
34
+ ];
35
+ fund_order: ["seller", "platform_fee", "seller_cancel_fee"];
36
+ release_order: ["platform_fee", "seller_cancel_fee"];
37
+ refund_order: ["platform_fee", "seller_cancel_fee"];
38
+ unfund_order: ["seller_cancel_fee", "platform_fee", "seller"];
39
+ };
40
+ action_library: {
41
+ settlement_piece: {
42
+ actionOrder: ["move"];
43
+ actions: {
44
+ move: {
45
+ parameters: {
46
+ piece: { kind: "piece"; };
47
+ source: { kind: "account"; };
48
+ destination: { kind: "account"; };
49
+ };
50
+ principal: "api_key";
51
+ approval: "inherit";
52
+ recovery: "local";
53
+ order: ["transfer"];
54
+ calls: [];
55
+ leaves: [{
56
+ id: "transfer";
57
+ operation: "internal_transfer.create";
58
+ bind: {
59
+ amount: "$piece.amount";
60
+ currency: "$piece.currency";
61
+ sourceAccountId: "$source";
62
+ destinationAccountId: "$destination";
63
+ };
64
+ effects: [{ kind: "moves"; signature: "moves.transfer.internal"; }];
65
+ evidence: "transferId";
66
+ }];
67
+ };
68
+ };
69
+ };
70
+ };
71
+ action fund_piece {
72
+ public: none;
73
+ piece_stage: { plan: "price"; stage: "fund"; };
74
+ calls: [{
75
+ id: "move_piece";
76
+ action: "settlement_piece.move";
77
+ bind: {
78
+ piece: "$piece";
79
+ source: "$fields.buyerAccountId";
80
+ destination: "$instance.refs.escrowAccountId";
81
+ };
82
+ }];
83
+ steps: [];
84
+ summary: "Fund a piece of a sale settlement";
85
+ }
86
+ ```
87
+
88
+ The compiler derives `pieceId` from `fund_order`; callers cannot override the
89
+ piece amount or destination. The call binds the buyer and captured escrow
90
+ account into the one transfer leaf. The stage itself adds no movement.
91
+ `public: none` leaves program exposure explicit. Canonical UDL keeps the plan,
92
+ library, calls and action order, while resolved plans carry the expanded leaves
93
+ and their origin paths. An ordinary exported module value can supply the same
94
+ library without publishing another instrument.
95
+
96
+ For the cancellation path, the same private action binds its destination to
97
+ `$piece.refund_to`. `platform_fee` returns to the buyer; `seller_cancel_fee`
98
+ pays the seller. Unfund instead binds the buyer for every funded piece, in
99
+ reverse order. Handover, cancellation and service-fee collection remain
100
+ separate declared actions; a piece plan does not combine their decisions.
101
+
102
+ ## Refusals to understand
103
+
104
+ UDL diagnostics retain their codes through HSX diagnostic provenance.
105
+ [`diagnostics.ts`](../src/diagnostics.ts) owns the HSX mapping, and
106
+ [`general-language.spec.ts`](../test/general-language.spec.ts) checks that fatal
107
+ UDL codes survive it.
108
+
109
+ | UDL code | Meaning for this example | Repair |
110
+ | --------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
111
+ | `UDL4001` | The money graph loses or creates value on a lifecycle path, including partial funding | Balance the funded amount on every exit and drain held value |
112
+ | `UDL5013` | A stage names an invalid plan/order or lacks the required call form | Name `price`, use declared unique piece IDs and declare the stage's calls |
113
+ | `UDL2010` | Private calls cycle, name an unresolved action, violate order or exceed bounds | Keep the graph finite and its order lists exact |
114
+
115
+ The partition itself has `UDL4002` diagnostics for incompatible immutable
116
+ fields, amount partition or currency. A stage does not exempt its transfer
117
+ from the independent money proof. Calls across different principals,
118
+ independent approval or external recovery boundaries are refused; model those
119
+ as separate actions. The [diagnostic reference](reference/diagnostics.md) lists the HSX refusal
120
+ codes and their repairs.
@@ -1,9 +1,9 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # CLI
4
4
 
5
5
  ```text
6
- hsx 2.1.0, the HSX compiler
6
+ hsx 2.1.1, the HSX compiler
7
7
 
8
8
  Usage:
9
9
  hsx check <file.hsx> [--strict]
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # Diagnostics
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # Grammar vocabulary
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # advance
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # cancellable_booking
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # captured_payment
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # conditional_disbursement
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # credit_facility
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # held_payment
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # instant_transfer
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # metered
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # pooled_split
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # premium_forward
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # reconciled_payout
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # recurring_collection
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # rotating_pool
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # scheduled
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # security_deposit
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # settlement_batch
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # swap
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # threshold_pool
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # weighted_distribution
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # Types
4
4
 
@@ -1,4 +1,4 @@
1
- <!-- Generated by scripts/docs/build.ts for HSX 2.1.0. Do not edit. -->
1
+ <!-- Generated by scripts/docs/build.ts for HSX 2.1.1. Do not edit. -->
2
2
 
3
3
  # UDL output
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperscale0/hsx",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "The strictly typed HSX language: compile total financial programs into canonical UDL.",
5
5
  "keywords": [
6
6
  "hsx",
@@ -85,7 +85,7 @@
85
85
  "typecheck": "tsc -p tsconfig.json"
86
86
  },
87
87
  "dependencies": {
88
- "@hyperscale0/udl": "2.1.0"
88
+ "@hyperscale0/udl": "2.3.0"
89
89
  },
90
90
  "devDependencies": {
91
91
  "bun-types": "1.4.2",
@@ -96,5 +96,5 @@
96
96
  "Amir Ayub",
97
97
  "Sara AlBakaawi"
98
98
  ],
99
- "gitHead": "a62e6700e728f3ab56aa9de12ff83e669540511b"
99
+ "gitHead": "ed8866f5e5201aad938ad0219da06e430a513467"
100
100
  }
package/src/version.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Package version reported by the command line. */
2
- export const HSX_VERSION = "2.1.0";
2
+ export const HSX_VERSION = "2.1.1";
3
3
 
4
4
  /** Canonical UDL contract version emitted by this compiler. */
5
5
  export const HSX_TARGET_UDL_VERSION = 1;