@hyperscale0/hsx 2.0.5 → 2.1.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 +16 -0
- package/README.md +17 -3
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/compile.d.ts +2 -0
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +15 -2
- package/dist/src/compile.js.map +1 -1
- package/dist/src/cost.d.ts.map +1 -1
- package/dist/src/cost.js +22 -6
- package/dist/src/cost.js.map +1 -1
- package/dist/src/diagnostics.d.ts +2 -0
- package/dist/src/diagnostics.d.ts.map +1 -1
- package/dist/src/diagnostics.js +60 -0
- package/dist/src/diagnostics.js.map +1 -1
- package/dist/src/emit.d.ts +16 -1
- package/dist/src/emit.d.ts.map +1 -1
- package/dist/src/emit.js +49 -11
- package/dist/src/emit.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- 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 +8 -1
- package/dist/src/ir.d.ts.map +1 -1
- package/dist/src/ir.js.map +1 -1
- package/dist/src/limits.d.ts +2 -0
- package/dist/src/limits.d.ts.map +1 -1
- package/dist/src/limits.js +2 -0
- package/dist/src/limits.js.map +1 -1
- package/dist/src/typecheck.d.ts.map +1 -1
- package/dist/src/typecheck.js +123 -15
- 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/assets/brand/hsx-horizontal-white.svg +1 -0
- package/docs/assets/brand/hsx-horizontal.svg +1 -0
- package/docs/assets/brand/hsx-stacked-white.svg +1 -0
- package/docs/assets/brand/hsx-stacked.svg +1 -0
- package/docs/assets/brand/manifest.json +30 -0
- package/docs/assets/hsx.svg +8 -15
- package/docs/llms-full.txt +51 -3
- package/docs/llms.txt +2 -2
- package/docs/reference/cli.md +2 -2
- package/docs/reference/diagnostics.md +49 -1
- package/docs/reference/grammar.md +2 -2
- package/docs/reference/std/advance.md +1 -1
- package/docs/reference/std/cancellable_booking.md +1 -1
- package/docs/reference/std/captured_payment.md +1 -1
- package/docs/reference/std/conditional_disbursement.md +1 -1
- package/docs/reference/std/credit_facility.md +1 -1
- package/docs/reference/std/held_payment.md +1 -1
- package/docs/reference/std/instant_transfer.md +1 -1
- package/docs/reference/std/metered.md +1 -1
- package/docs/reference/std/pooled_split.md +1 -1
- package/docs/reference/std/premium_forward.md +1 -1
- package/docs/reference/std/reconciled_payout.md +1 -1
- package/docs/reference/std/recurring_collection.md +1 -1
- package/docs/reference/std/rotating_pool.md +1 -1
- package/docs/reference/std/scheduled.md +1 -1
- package/docs/reference/std/security_deposit.md +1 -1
- package/docs/reference/std/settlement_batch.md +1 -1
- package/docs/reference/std/swap.md +1 -1
- package/docs/reference/std/threshold_pool.md +1 -1
- package/docs/reference/std/weighted_distribution.md +1 -1
- package/docs/reference/types.md +1 -1
- package/docs/reference/udl-output.md +1 -1
- package/package.json +3 -3
- package/src/compile.ts +17 -2
- package/src/cost.ts +32 -5
- package/src/diagnostics.ts +67 -0
- package/src/emit.ts +82 -15
- package/src/index.ts +6 -1
- package/src/ir.ts +15 -1
- package/src/limits.ts +2 -0
- package/src/typecheck.ts +147 -16
- package/src/version.ts +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -6,9 +6,10 @@ export { format, type FormatResult } from "./format.ts";
|
|
|
6
6
|
export { KEYWORDS } from "./lex.ts";
|
|
7
7
|
export { overrideProgramEntries, type ProgramEntryOverride, type ProgramEntryOverrideIssue, type ProgramEntryOverrideValue, } from "./entry-overrides.ts";
|
|
8
8
|
export { type OriginMapEntry } from "./emit.ts";
|
|
9
|
-
export { lowerGeneralProgram, originForUdlPath } from "./emit.ts";
|
|
9
|
+
export { lowerGeneralProgram, originForUdlPath, emitUdlClause, } from "./emit.ts";
|
|
10
10
|
export { parseProgram } from "./parse.ts";
|
|
11
11
|
export { checkGeneralProgram, type GeneralCheckOptions } from "./typecheck.ts";
|
|
12
12
|
export { byteOffsetToCodeUnit, type BlockExpr, type ExposeDecl, type Program, type ProgramDecl, type UseDecl, } from "./ast.ts";
|
|
13
13
|
export { bundledStandardLibrary, type StandardLibrary } from "./std-library.ts";
|
|
14
|
+
export type { ResolvedActionPlan, ResolvedProgramActionPlan } from "./ir.ts";
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,cAAc,EACd,KAAK,yBAAyB,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,cAAc,EACd,KAAK,yBAAyB,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,OAAO,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,sBAAsB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAChF,YAAY,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { format } from "./format.js";
|
|
|
5
5
|
export { KEYWORDS } from "./lex.js";
|
|
6
6
|
export { overrideProgramEntries, } from "./entry-overrides.js";
|
|
7
7
|
export {} from "./emit.js";
|
|
8
|
-
export { lowerGeneralProgram, originForUdlPath } from "./emit.js";
|
|
8
|
+
export { lowerGeneralProgram, originForUdlPath, emitUdlClause, } from "./emit.js";
|
|
9
9
|
export { parseProgram } from "./parse.js";
|
|
10
10
|
export { checkGeneralProgram } from "./typecheck.js";
|
|
11
11
|
export { byteOffsetToCodeUnit, } from "./ast.js";
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,GAKR,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,cAAc,GAEf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EACL,sBAAsB,GAIvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAuB,MAAM,WAAW,CAAC;AAChD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,GAKR,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,GAKxB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,cAAc,GAEf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EACL,sBAAsB,GAIvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAuB,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAA4B,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EACL,oBAAoB,GAMrB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,sBAAsB,EAAwB,MAAM,kBAAkB,CAAC"}
|
package/dist/src/ir.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Span } from "./ast.ts";
|
|
2
|
-
import type { UdlEffectKind } from "@hyperscale0/udl";
|
|
2
|
+
import type { resolveUdlActionPlans, UdlEffectKind, UdlIssueCode } from "@hyperscale0/udl";
|
|
3
3
|
export type JsonValue = boolean | number | string | null | readonly JsonValue[] | {
|
|
4
4
|
readonly [key: string]: JsonValue;
|
|
5
5
|
};
|
|
@@ -29,7 +29,12 @@ export interface TypedAction {
|
|
|
29
29
|
readonly origin: Span;
|
|
30
30
|
readonly slots: Readonly<Record<string, JsonValue>>;
|
|
31
31
|
}
|
|
32
|
+
export type ResolvedActionPlan = ReturnType<typeof resolveUdlActionPlans>["plans"][number];
|
|
33
|
+
export type ResolvedProgramActionPlan = ResolvedActionPlan & {
|
|
34
|
+
readonly instrument: string;
|
|
35
|
+
};
|
|
32
36
|
export interface TypedInstrument {
|
|
37
|
+
readonly actionPlans?: readonly ResolvedActionPlan[];
|
|
33
38
|
readonly actions: readonly TypedAction[];
|
|
34
39
|
readonly fields: readonly TypedField[];
|
|
35
40
|
readonly id: string;
|
|
@@ -53,6 +58,8 @@ export interface TypedProgram {
|
|
|
53
58
|
readonly title: string;
|
|
54
59
|
}
|
|
55
60
|
export interface GeneralDiagnostic {
|
|
61
|
+
readonly path?: string;
|
|
62
|
+
readonly udlCode?: UdlIssueCode;
|
|
56
63
|
readonly code: string;
|
|
57
64
|
readonly fix: string;
|
|
58
65
|
readonly message: string;
|
package/dist/src/ir.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../../src/ir.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../../src/ir.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACb,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,MAAM,GACN,MAAM,GACN,IAAI,GACJ,SAAS,SAAS,EAAE,GACpB;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE1C,eAAO,MAAM,cAAc,YACzB,SAAS,EACT,SAAS,EACT,KAAK,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,EACL,MAAM,EACN,SAAS,CACD,CAAC;AAEX,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACrD,QAAQ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version":3,"file":"ir.js","sourceRoot":"","sources":["../../src/ir.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS;IACT,SAAS;IACT,KAAK;IACL,WAAW;IACX,MAAM;IACN,SAAS;IACT,OAAO;IACP,OAAO;IACP,SAAS;IACT,KAAK;IACL,MAAM;IACN,SAAS;CACD,CAAC"}
|
package/dist/src/limits.d.ts
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* on. The deepest nests 5 levels; the largest is 13,934 bytes.
|
|
7
7
|
*/
|
|
8
8
|
export declare const HSX_LIMITS: Readonly<{
|
|
9
|
+
/** Shared ceiling for finite comprehensions and action-call expansion. */
|
|
10
|
+
maxExpansions: 256;
|
|
9
11
|
/**
|
|
10
12
|
* How deep the recursive-descent productions may nest. Measured on this
|
|
11
13
|
* machine, the parser exhausted the call stack at 9,217 nested blocks and
|
package/dist/src/limits.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;IACrB;;;;;;;OAOG;;IAEH,wCAAwC;;EAExC,CAAC"}
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;IACrB,0EAA0E;;IAE1E;;;;;;;OAOG;;IAEH,wCAAwC;;EAExC,CAAC"}
|
package/dist/src/limits.js
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* on. The deepest nests 5 levels; the largest is 13,934 bytes.
|
|
7
7
|
*/
|
|
8
8
|
export const HSX_LIMITS = Object.freeze({
|
|
9
|
+
/** Shared ceiling for finite comprehensions and action-call expansion. */
|
|
10
|
+
maxExpansions: 256,
|
|
9
11
|
/**
|
|
10
12
|
* How deep the recursive-descent productions may nest. Measured on this
|
|
11
13
|
* machine, the parser exhausted the call stack at 9,217 nested blocks and
|
package/dist/src/limits.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC;;;;;;;OAOG;IACH,eAAe,EAAE,EAAE;IACnB,wCAAwC;IACxC,cAAc,EAAE,GAAG,GAAG,KAAK;CAC5B,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,0EAA0E;IAC1E,aAAa,EAAE,GAAG;IAClB;;;;;;;OAOG;IACH,eAAe,EAAE,EAAE;IACnB,wCAAwC;IACxC,cAAc,EAAE,GAAG,GAAG,KAAK;CAC5B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../../src/typecheck.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../../src/typecheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,WAAW,EAEjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAaV,OAAO,EAKR,MAAM,UAAU,CAAC;AASlB,OAAO,KAAK,EACV,kBAAkB,EASnB,MAAM,SAAS,CAAC;AAWjB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC;CACzC;AAkCD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,mBAAwB,GAChC,kBAAkB,CAibpB"}
|
package/dist/src/typecheck.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { deriveUdlActionEffects, udlClauseVocabulary, } from "@hyperscale0/udl";
|
|
2
|
-
import { requiredFields } from "./emit.js";
|
|
1
|
+
import { deriveUdlActionEffects, resolveUdlActionPlans, udlDocumentSchema, udlClauseVocabulary, } from "@hyperscale0/udl";
|
|
2
|
+
import { requiredFields, generalInstrumentValue, hasActionPlanClauses, lowerGeneralProgram, } from "./emit.js";
|
|
3
|
+
import { hsxClauseDiagnosticCode } from "./diagnostics.js";
|
|
4
|
+
import { HSX_LIMITS } from "./limits.js";
|
|
3
5
|
const SNAKE_CASE = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/;
|
|
4
6
|
const CAMEL_CASE = /^[a-z][A-Za-z0-9]*$/;
|
|
5
7
|
const CURRENCY = /^[A-Z]{3}$/;
|
|
6
8
|
const MONEY_PATTERN = "^[1-9][0-9]{0,17}$";
|
|
7
9
|
const OPTIONAL_MONEY_PATTERN = "^(0|[1-9][0-9]{0,17})$";
|
|
8
10
|
const ACCOUNT_PATTERN = "^acct_(sandbox|live)_[a-z0-9]{8,64}$";
|
|
9
|
-
const MAX_COMPREHENSION_EXPANSIONS = 256;
|
|
10
11
|
const NONE_SENTINEL = "__hsx_none__";
|
|
11
12
|
const actionClauseBySpelling = new Map(udlClauseVocabulary
|
|
12
13
|
.filter((definition) => definition.scope === "action")
|
|
@@ -287,7 +288,7 @@ export function checkGeneralProgram(program, options = {}) {
|
|
|
287
288
|
subjects,
|
|
288
289
|
title: header?.title?.value ?? sentenceCase(name),
|
|
289
290
|
};
|
|
290
|
-
return
|
|
291
|
+
return prepareActionPlanProgram(typed, diagnostics);
|
|
291
292
|
}
|
|
292
293
|
function checkPublishedProgram(program, catalog, header, authoredSubjects, authoredInstruments, diagnostics, report) {
|
|
293
294
|
const compositionDeclarations = program.decls.filter((decl) => decl.kind === "use" || decl.kind === "expose");
|
|
@@ -417,7 +418,7 @@ function checkPublishedProgram(program, catalog, header, authoredSubjects, autho
|
|
|
417
418
|
],
|
|
418
419
|
title: header?.title?.value ?? sentenceCase(name),
|
|
419
420
|
};
|
|
420
|
-
return
|
|
421
|
+
return prepareActionPlanProgram(typed, diagnostics);
|
|
421
422
|
}
|
|
422
423
|
function projectedPublishedInstrument(source, exposures) {
|
|
423
424
|
const publicNameByAction = new Map(exposures
|
|
@@ -2284,11 +2285,11 @@ function expandComprehensions(block, diagnostics, values = new Map(), dependenci
|
|
|
2284
2285
|
});
|
|
2285
2286
|
continue;
|
|
2286
2287
|
}
|
|
2287
|
-
if (budget.used + values.length >
|
|
2288
|
+
if (budget.used + values.length > HSX_LIMITS.maxExpansions) {
|
|
2288
2289
|
diagnostics.push({
|
|
2289
2290
|
code: "HSX1404",
|
|
2290
|
-
fix: `reduce the fixed expansion to at most ${
|
|
2291
|
-
message: `bounded comprehensions expand past the ${
|
|
2291
|
+
fix: `reduce the fixed expansion to at most ${HSX_LIMITS.maxExpansions} rows`,
|
|
2292
|
+
message: `bounded comprehensions expand past the ${HSX_LIMITS.maxExpansions}-row compiler limit`,
|
|
2292
2293
|
severity: "error",
|
|
2293
2294
|
span: bound.span,
|
|
2294
2295
|
});
|
|
@@ -2675,7 +2676,7 @@ function checkInstrument(name, body, parties, ports, aliases, diagnostics) {
|
|
|
2675
2676
|
...new Set([...slots.required, ...inferredDecisionFields]),
|
|
2676
2677
|
];
|
|
2677
2678
|
}
|
|
2678
|
-
return { actions, fields, id: name.name, origin: name.span, slots };
|
|
2679
|
+
return derivePieceInputs({ actions, fields, id: name.name, origin: name.span, slots }, diagnostics);
|
|
2679
2680
|
}
|
|
2680
2681
|
// Mirrors the catalog law agent_description_required: every action a caller
|
|
2681
2682
|
// can reach becomes an agent tool whose description is authored, never
|
|
@@ -3634,7 +3635,7 @@ function stringSlot(block, ...names) {
|
|
|
3634
3635
|
return found.name;
|
|
3635
3636
|
return undefined;
|
|
3636
3637
|
}
|
|
3637
|
-
function blockToObject(block, substitutions, diagnostics) {
|
|
3638
|
+
function blockToObject(block, substitutions, diagnostics, literalKeys = false) {
|
|
3638
3639
|
if (!block)
|
|
3639
3640
|
return {};
|
|
3640
3641
|
const result = {};
|
|
@@ -3650,7 +3651,8 @@ function blockToObject(block, substitutions, diagnostics) {
|
|
|
3650
3651
|
});
|
|
3651
3652
|
continue;
|
|
3652
3653
|
}
|
|
3653
|
-
result[row.key.quoted ? row.key.name : camel(row.key.name)] =
|
|
3654
|
+
result[literalKeys || row.key.quoted ? row.key.name : camel(row.key.name)] =
|
|
3655
|
+
exprToJson(value, diagnostics, literalKeys);
|
|
3654
3656
|
}
|
|
3655
3657
|
return result;
|
|
3656
3658
|
}
|
|
@@ -3670,9 +3672,13 @@ function exprToJsonForUdlSlot(expr, slot, diagnostics) {
|
|
|
3670
3672
|
exprToJson(row.value, diagnostics),
|
|
3671
3673
|
]));
|
|
3672
3674
|
}
|
|
3673
|
-
|
|
3675
|
+
// Declaration maps retain their authored keys; field-spelling aliases still normalize.
|
|
3676
|
+
const literalKeys = udlClauseVocabulary.some((clause) => clause.target === slot &&
|
|
3677
|
+
"literalKeys" in clause &&
|
|
3678
|
+
clause.literalKeys === true);
|
|
3679
|
+
return exprToJson(expr, diagnostics, literalKeys);
|
|
3674
3680
|
}
|
|
3675
|
-
function exprToJson(expr, diagnostics) {
|
|
3681
|
+
function exprToJson(expr, diagnostics, literalKeys = false) {
|
|
3676
3682
|
switch (expr.kind) {
|
|
3677
3683
|
case "boolean":
|
|
3678
3684
|
return expr.value;
|
|
@@ -3714,9 +3720,9 @@ function exprToJson(expr, diagnostics) {
|
|
|
3714
3720
|
case "settlement_ref":
|
|
3715
3721
|
return `${expr.owner.name}.${expr.member.name}`;
|
|
3716
3722
|
case "list":
|
|
3717
|
-
return expr.items.map((item) => exprToJson(item, diagnostics));
|
|
3723
|
+
return expr.items.map((item) => exprToJson(item, diagnostics, literalKeys));
|
|
3718
3724
|
case "block":
|
|
3719
|
-
return blockToObject(expr, new Map(), diagnostics);
|
|
3725
|
+
return blockToObject(expr, new Map(), diagnostics, literalKeys);
|
|
3720
3726
|
case "call":
|
|
3721
3727
|
return `${expr.callee.name}(${expr.args.map((arg) => String(exprToJson(arg, diagnostics))).join(",")})`;
|
|
3722
3728
|
case "type_apply":
|
|
@@ -3867,4 +3873,106 @@ function sentenceCase(value) {
|
|
|
3867
3873
|
const words = value.replaceAll("_", " ");
|
|
3868
3874
|
return `${words[0]?.toUpperCase() ?? ""}${words.slice(1)}`;
|
|
3869
3875
|
}
|
|
3876
|
+
function prepareActionPlanProgram(program, diagnostics) {
|
|
3877
|
+
if (!program.instruments.some(hasActionPlanClauses))
|
|
3878
|
+
return { diagnostics, program };
|
|
3879
|
+
const instruments = program.instruments.map((instrument) => {
|
|
3880
|
+
if (!hasActionPlanClauses(instrument))
|
|
3881
|
+
return instrument;
|
|
3882
|
+
const parsed = udlDocumentSchema.shape.instruments.element.safeParse(generalInstrumentValue(instrument));
|
|
3883
|
+
if (!parsed.success) {
|
|
3884
|
+
for (const issue of parsed.error.issues)
|
|
3885
|
+
diagnostics.push({
|
|
3886
|
+
code: "HSX1601",
|
|
3887
|
+
severity: "error",
|
|
3888
|
+
span: instrument.origin,
|
|
3889
|
+
message: `${instrument.id}.${issue.path.join(".")}: ${issue.message}`,
|
|
3890
|
+
fix: "match the typed UDL clause declaration",
|
|
3891
|
+
});
|
|
3892
|
+
return instrument;
|
|
3893
|
+
}
|
|
3894
|
+
const resolved = resolveUdlActionPlans(parsed.data);
|
|
3895
|
+
for (const issue of resolved.issues)
|
|
3896
|
+
diagnostics.push({
|
|
3897
|
+
code: hsxClauseDiagnosticCode(issue.code),
|
|
3898
|
+
severity: "error",
|
|
3899
|
+
span: instrument.origin,
|
|
3900
|
+
message: `${instrument.id}${issue.path}: ${issue.message}`,
|
|
3901
|
+
udlCode: issue.code,
|
|
3902
|
+
path: issue.path,
|
|
3903
|
+
fix: issue.fix,
|
|
3904
|
+
});
|
|
3905
|
+
return {
|
|
3906
|
+
...instrument,
|
|
3907
|
+
actionPlans: resolved.plans,
|
|
3908
|
+
actions: instrument.actions.map((action) => {
|
|
3909
|
+
if (!action.slots.calls)
|
|
3910
|
+
return action;
|
|
3911
|
+
const plan = resolved.plans.find((plan) => plan.action === action.name);
|
|
3912
|
+
if (!plan)
|
|
3913
|
+
return action;
|
|
3914
|
+
const effects = plan.effects;
|
|
3915
|
+
return {
|
|
3916
|
+
...action,
|
|
3917
|
+
effects,
|
|
3918
|
+
slots: { ...action.slots, effects: effects },
|
|
3919
|
+
};
|
|
3920
|
+
}),
|
|
3921
|
+
};
|
|
3922
|
+
});
|
|
3923
|
+
if (diagnostics.some((issue) => issue.severity === "error"))
|
|
3924
|
+
return { diagnostics };
|
|
3925
|
+
const prepared = { ...program, instruments };
|
|
3926
|
+
const lowered = lowerGeneralProgram(prepared);
|
|
3927
|
+
if (!lowered.ok) {
|
|
3928
|
+
for (const issue of lowered.issues)
|
|
3929
|
+
diagnostics.push({
|
|
3930
|
+
code: issue.code,
|
|
3931
|
+
fix: issue.fix,
|
|
3932
|
+
message: issue.message,
|
|
3933
|
+
udlCode: issue.udlCode,
|
|
3934
|
+
path: issue.path,
|
|
3935
|
+
severity: "error",
|
|
3936
|
+
span: issue.span,
|
|
3937
|
+
});
|
|
3938
|
+
return { diagnostics };
|
|
3939
|
+
}
|
|
3940
|
+
return { diagnostics, program: prepared };
|
|
3941
|
+
}
|
|
3942
|
+
function derivePieceInputs(instrument, diagnostics) {
|
|
3943
|
+
return {
|
|
3944
|
+
...instrument,
|
|
3945
|
+
actions: instrument.actions.map((action) => {
|
|
3946
|
+
const stage = jsonObject(action.slots.pieceStage);
|
|
3947
|
+
if (!stage)
|
|
3948
|
+
return action;
|
|
3949
|
+
if (action.slots.input !== undefined) {
|
|
3950
|
+
diagnostics.push({
|
|
3951
|
+
code: "HSX1611",
|
|
3952
|
+
severity: "error",
|
|
3953
|
+
span: action.origin,
|
|
3954
|
+
message: `action ${action.name} overrides its compiler-derived pieceId input`,
|
|
3955
|
+
fix: "remove input; piece_stage derives the strict pieceId enum",
|
|
3956
|
+
});
|
|
3957
|
+
return action;
|
|
3958
|
+
}
|
|
3959
|
+
const plan = jsonObject(instrument.slots.piecePlan);
|
|
3960
|
+
const order = plan?.[`${stage.stage}_order`];
|
|
3961
|
+
if (!Array.isArray(order) || order.length === 0)
|
|
3962
|
+
return action;
|
|
3963
|
+
return {
|
|
3964
|
+
...action,
|
|
3965
|
+
slots: {
|
|
3966
|
+
...action.slots,
|
|
3967
|
+
input: {
|
|
3968
|
+
type: "object",
|
|
3969
|
+
additionalProperties: false,
|
|
3970
|
+
required: ["pieceId"],
|
|
3971
|
+
properties: { pieceId: { type: "string", enum: order } },
|
|
3972
|
+
},
|
|
3973
|
+
},
|
|
3974
|
+
};
|
|
3975
|
+
}),
|
|
3976
|
+
};
|
|
3977
|
+
}
|
|
3870
3978
|
//# sourceMappingURL=typecheck.js.map
|