@hyperscale0/hsx 4.2.0 → 5.0.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ # HSX 5.0.0
2
+
3
+ Money moves refuse a zero amount unless the action declares `allowZero: true`,
4
+ so a program that moved zero before now fails at compile or at execution. The
5
+ standard library declares the permission on calculated pieces (repayment
6
+ slices, floored fees, rounding remainders) and keeps a positive requirement on
7
+ authored totals. Pools refuse a contribution above the remaining target and
8
+ fee collection posts the exact fee that was billed.
9
+
10
+ Headers carry binding contracts: `dependencies` name a binding that only
11
+ applies under one enum choice of another, and `parameterDiagnostics` explain
12
+ why a typed parameter refuses a policy shape. Ten diagnostics were rewritten
13
+ to name the failing construct and the repair; each carries a compiler witness.
14
+ Worked programs open with a one-line intent comment and `repair-approval.hsx`
15
+ joins the examples. Header docs, README and llms-full.txt correct sixteen
16
+ stale claims. Package, compiler and VS Code versions are aligned at 5.0.0.
17
+
1
18
  # HSX 4.2.0
2
19
 
3
20
  Adds the browser-safe `language` export with semantic highlights and hover
package/README.md CHANGED
@@ -42,11 +42,11 @@ modified without changing later results.
42
42
 
43
43
  ## Sample programs
44
44
 
45
- The [sample index](docs/examples.md) lists fourteen programs. Twelve introduce
45
+ The [sample index](docs/examples.md) lists fifteen programs. Twelve introduce
46
46
  the standard headers through small businesses: tutoring, freelance work, used
47
47
  devices, prepaid workshops, tuition lending, community lending, device cover,
48
48
  collections, travel, employee cards, a savings circle and equipment loan reports.
49
- The two longer-standing examples show a minimal financed car sale and servicing
49
+ The authored repair approval example builds its lifecycle and evidence requirements directly. The two longer-standing examples show a minimal financed car sale and servicing
50
50
  with late charges and reminders.
51
51
 
52
52
  ```ts
@@ -71,7 +71,8 @@ and exercises highlighting and hover at every sample offset. A stale bundle
71
71
  fails the check; regenerate after an example edit.
72
72
 
73
73
  The insurance and travel samples name ADL adapter bindings. Compilation preserves
74
- unbound declarations; a configured adapter must supply the requirements before
75
- cover activation. Dates, agreement inputs and declared business parties still
74
+ unbound declarations, but Product creation and recomposition reject unresolved
75
+ or changed adapter dependencies during Build admission. Execution checks the
76
+ frozen declaration too, including adapter unavailability after a Build was saved. Dates, agreement inputs and declared business parties still
76
77
  need values when the product runs. A compiled sample is not a connected provider
77
78
  or a funded agreement.
@@ -0,0 +1,22 @@
1
+ import type { Entry, InstrumentDecl } from "./ast.ts";
2
+ export declare class BindingContractError extends Error {
3
+ readonly entry: Entry;
4
+ constructor(entry: Entry, message: string);
5
+ }
6
+ /** Conditional requirements are header data, independent of module names. */
7
+ export declare function bindingDependencies(decl: InstrumentDecl): {
8
+ binding: string;
9
+ when: string;
10
+ is: string;
11
+ message: string;
12
+ fix: string;
13
+ span: import("./ast.ts").Span;
14
+ }[];
15
+ /** A header explains why a typed parameter cannot encode a proposed policy. */
16
+ export declare function parameterDiagnostics(decl: InstrumentDecl): {
17
+ parameter: string;
18
+ accepts: string;
19
+ percentage: string;
20
+ fix: string;
21
+ }[];
22
+ //# sourceMappingURL=binding-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding-contract.d.ts","sourceRoot":"","sources":["../../src/binding-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAC;AAE5D,qBAAa,oBAAqB,SAAQ,KAAK;IAE3C,QAAQ,CAAC,KAAK,EAAE,KAAK;IADvB,YACW,KAAK,EAAE,KAAK,EACrB,OAAO,EAAE,MAAM,EAGhB;CACF;AAkDD,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,cAAc;;;;;;;IA8BvD;AAED,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc;;;;;IAUxD"}
@@ -0,0 +1,74 @@
1
+ export class BindingContractError extends Error {
2
+ entry;
3
+ constructor(entry, message) {
4
+ super(message);
5
+ this.entry = entry;
6
+ }
7
+ }
8
+ function rows(value) {
9
+ if (value.kind === "block")
10
+ return value.entries;
11
+ throw new BindingContractError({ key: "contract", value, span: value.span }, "Binding contract needs a block.");
12
+ }
13
+ function properties(entry, allowed) {
14
+ const result = new Map();
15
+ for (const slot of rows(entry.value)) {
16
+ if (!allowed.includes(slot.key) ||
17
+ result.has(slot.key) ||
18
+ (slot.value.kind !== "text" && slot.value.kind !== "name"))
19
+ throw new BindingContractError(slot, "Invalid binding contract property.");
20
+ result.set(slot.key, slot.value.value);
21
+ }
22
+ if (allowed.some((key) => !result.get(key)))
23
+ throw new BindingContractError(entry, `Binding contract needs ${allowed.join(", ")}.`);
24
+ return result;
25
+ }
26
+ function contractEntries(decl, name) {
27
+ const blocks = decl.body.entries.filter((entry) => entry.key === name);
28
+ if (blocks.length > 1)
29
+ throw new BindingContractError(blocks[1], `Duplicate ${name}.`);
30
+ const entries = blocks[0] ? rows(blocks[0].value) : [];
31
+ const seen = new Set();
32
+ for (const entry of entries) {
33
+ if (seen.has(entry.key) ||
34
+ !decl.parameters.some((parameter) => parameter.key === entry.key))
35
+ throw new BindingContractError(entry, "Binding contract must name each declared tunable once.");
36
+ seen.add(entry.key);
37
+ }
38
+ return entries;
39
+ }
40
+ /** Conditional requirements are header data, independent of module names. */
41
+ export function bindingDependencies(decl) {
42
+ return contractEntries(decl, "dependencies").map((entry) => {
43
+ const values = properties(entry, ["selector", "is", "message", "fix"]);
44
+ const selector = decl.parameters.find((parameter) => parameter.key === values.get("selector"));
45
+ const type = selector?.value.kind === "default"
46
+ ? selector.value.type
47
+ : selector?.value;
48
+ if (type?.kind !== "call" ||
49
+ type.name !== "enum" ||
50
+ !type.args.some((arg) => arg.kind === "name" && arg.value === values.get("is")))
51
+ throw new BindingContractError(entry, "Dependency must select a declared enum choice.");
52
+ return {
53
+ binding: entry.key,
54
+ when: values.get("selector"),
55
+ is: values.get("is"),
56
+ message: values.get("message"),
57
+ fix: values.get("fix"),
58
+ span: entry.span,
59
+ };
60
+ });
61
+ }
62
+ /** A header explains why a typed parameter cannot encode a proposed policy. */
63
+ export function parameterDiagnostics(decl) {
64
+ return contractEntries(decl, "parameterDiagnostics").map((entry) => {
65
+ const values = properties(entry, ["accepts", "percentage", "fix"]);
66
+ return {
67
+ parameter: entry.key,
68
+ accepts: values.get("accepts"),
69
+ percentage: values.get("percentage"),
70
+ fix: values.get("fix"),
71
+ };
72
+ });
73
+ }
74
+ //# sourceMappingURL=binding-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binding-contract.js","sourceRoot":"","sources":["../../src/binding-contract.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAElC,KAAK;IADhB,YACW,KAAY,EACrB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;qBAHN,KAAK;IAIhB,CAAC;CACF;AAED,SAAS,IAAI,CAAC,KAAW;IACvB,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IACjD,MAAM,IAAI,oBAAoB,CAC5B,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAC5C,iCAAiC,CAClC,CAAC;AACJ,CAAC;AACD,SAAS,UAAU,CAAC,KAAY,EAAE,OAAiB;IACjD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,IACE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;YACpB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;YAE1D,MAAM,IAAI,oBAAoB,CAC5B,IAAI,EACJ,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