@hyperscale0/udl 1.0.0-beta.1 → 1.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.
Files changed (179) hide show
  1. package/CHANGELOG.md +78 -25
  2. package/README.md +37 -99
  3. package/conformance/README.md +44 -41
  4. package/conformance/evolution/action-contract.expected.json +10 -0
  5. package/conformance/evolution/action-contract.live.udl +44 -0
  6. package/conformance/evolution/action-contract.next.udl +45 -0
  7. package/conformance/evolution/product-identity.expected.json +10 -0
  8. package/conformance/evolution/product-identity.live.udl +55 -0
  9. package/conformance/evolution/product-identity.next.udl +55 -0
  10. package/conformance/evolution/version-required.expected.json +10 -0
  11. package/conformance/evolution/version-required.live.udl +55 -0
  12. package/conformance/evolution/version-required.next.udl +58 -0
  13. package/conformance/invalid/action-without-transition.expected.json +10 -0
  14. package/conformance/invalid/{verb-without-transition.udl → action-without-transition.udl} +7 -2
  15. package/conformance/invalid/agent-description-too-long.expected.json +10 -0
  16. package/conformance/invalid/agent-description-too-long.udl +57 -0
  17. package/conformance/invalid/blank-title.expected.json +1 -1
  18. package/conformance/invalid/blank-title.udl +6 -2
  19. package/conformance/invalid/composition-dial-duplicate-key.expected.json +10 -0
  20. package/conformance/invalid/composition-dial-duplicate-key.udl +73 -0
  21. package/conformance/invalid/depth-budget.expected.json +1 -1
  22. package/conformance/invalid/duplicate-subject.expected.json +10 -0
  23. package/conformance/invalid/duplicate-subject.udl +230 -0
  24. package/conformance/invalid/forged-effects.expected.json +10 -0
  25. package/conformance/invalid/forged-effects.udl +76 -0
  26. package/conformance/invalid/format-version.expected.json +1 -1
  27. package/conformance/invalid/format-version.udl +6 -2
  28. package/conformance/invalid/instrument-id-not-snake-case.expected.json +10 -0
  29. package/conformance/invalid/{noun-id-not-snake-case.udl → instrument-id-not-snake-case.udl} +6 -2
  30. package/conformance/invalid/invalid-aggregate-gate-shape.expected.json +10 -0
  31. package/conformance/invalid/invalid-aggregate-gate-shape.udl +1819 -0
  32. package/conformance/invalid/invalid-check-duration.expected.json +10 -0
  33. package/conformance/invalid/invalid-check-duration.udl +219 -0
  34. package/conformance/invalid/invalid-dial-anchor.expected.json +10 -0
  35. package/conformance/invalid/invalid-dial-anchor.udl +219 -0
  36. package/conformance/invalid/invalid-exception-parent-ref.expected.json +10 -0
  37. package/conformance/invalid/invalid-exception-parent-ref.udl +2487 -0
  38. package/conformance/invalid/invalid-exposure-shape.expected.json +10 -0
  39. package/conformance/invalid/invalid-exposure-shape.udl +1819 -0
  40. package/conformance/invalid/invalid-remainder.expected.json +10 -0
  41. package/conformance/invalid/invalid-remainder.udl +220 -0
  42. package/conformance/invalid/invalid-schema-keyword.expected.json +10 -0
  43. package/conformance/invalid/invalid-schema-keyword.udl +220 -0
  44. package/conformance/invalid/invalid-utf8.expected.json +1 -1
  45. package/conformance/invalid/malformed-json.expected.json +1 -1
  46. package/conformance/invalid/missing-create-action.expected.json +10 -0
  47. package/conformance/invalid/{missing-create-verb.udl → missing-create-action.udl} +5 -2
  48. package/conformance/invalid/missing-exception-amount-field.expected.json +10 -0
  49. package/conformance/invalid/missing-exception-amount-field.udl +2487 -0
  50. package/conformance/invalid/missing-exception-contract.expected.json +14 -0
  51. package/conformance/invalid/missing-exception-contract.udl +2523 -0
  52. package/conformance/invalid/missing-exception-reason-field.expected.json +10 -0
  53. package/conformance/invalid/missing-exception-reason-field.udl +2487 -0
  54. package/conformance/invalid/not-an-object.expected.json +1 -1
  55. package/conformance/invalid/payout-reconcile-not-a-bank-debit.expected.json +10 -0
  56. package/conformance/invalid/payout-reconcile-not-a-bank-debit.udl +259 -0
  57. package/conformance/invalid/quote-freeze-set-incomplete.expected.json +10 -0
  58. package/conformance/invalid/quote-freeze-set-incomplete.udl +261 -0
  59. package/conformance/invalid/quote-named-reference-gate.expected.json +10 -0
  60. package/conformance/invalid/quote-named-reference-gate.udl +50 -0
  61. package/conformance/invalid/reconcile-named-reference-gate.expected.json +10 -0
  62. package/conformance/invalid/reconcile-named-reference-gate.udl +50 -0
  63. package/conformance/invalid/unknown-key.expected.json +1 -1
  64. package/conformance/invalid/unknown-key.udl +6 -2
  65. package/conformance/invalid/unknown-reference-gate-field.expected.json +10 -0
  66. package/conformance/invalid/unknown-reference-gate-field.udl +1819 -0
  67. package/conformance/invalid/unknown-required-field.expected.json +10 -0
  68. package/conformance/invalid/unknown-required-field.udl +220 -0
  69. package/conformance/invalid/unreachable-state.expected.json +2 -2
  70. package/conformance/invalid/unreachable-state.udl +6 -2
  71. package/conformance/invalid/wrong-exception-amount-field.expected.json +10 -0
  72. package/conformance/invalid/wrong-exception-amount-field.udl +2487 -0
  73. package/conformance/invalid/wrong-exception-reason-field.expected.json +10 -0
  74. package/conformance/invalid/wrong-exception-reason-field.udl +2487 -0
  75. package/conformance/valid/agent-description.expected.json +6 -0
  76. package/conformance/valid/agent-description.udl +66 -0
  77. package/conformance/valid/cards.expected.json +1 -0
  78. package/conformance/valid/cards.udl +843 -356
  79. package/conformance/valid/commerce-escrow.expected.json +1 -0
  80. package/conformance/valid/commerce-escrow.udl +792 -291
  81. package/conformance/valid/compiled-crowdfunding.expected.json +6 -0
  82. package/conformance/valid/compiled-crowdfunding.udl +1843 -0
  83. package/conformance/valid/compiled-watch-club.expected.json +6 -0
  84. package/conformance/valid/compiled-watch-club.udl +2486 -0
  85. package/conformance/valid/complete-contract.expected.json +6 -0
  86. package/conformance/valid/complete-contract.udl +218 -0
  87. package/conformance/valid/effect-signatures.expected.json +6 -0
  88. package/conformance/valid/effect-signatures.udl +75 -0
  89. package/conformance/valid/hand-edited.expected.json +1 -0
  90. package/conformance/valid/hand-edited.udl +1 -1
  91. package/conformance/valid/insured-car-marketplace.expected.json +1 -0
  92. package/conformance/valid/insured-car-marketplace.udl +534 -315
  93. package/conformance/valid/insured-travel.expected.json +2 -1
  94. package/conformance/valid/insured-travel.udl +1489 -641
  95. package/conformance/valid/minimal.expected.json +1 -0
  96. package/conformance/valid/minimal.udl +18 -14
  97. package/conformance/valid/protection.expected.json +1 -0
  98. package/conformance/valid/protection.udl +719 -304
  99. package/conformance/valid/string-escaping.expected.json +6 -0
  100. package/conformance/valid/string-escaping.udl +54 -0
  101. package/dist/canonical.d.ts +2 -0
  102. package/dist/canonical.d.ts.map +1 -1
  103. package/dist/canonical.js +7 -0
  104. package/dist/canonical.js.map +1 -1
  105. package/dist/check-profiles.d.ts +57 -0
  106. package/dist/check-profiles.d.ts.map +1 -0
  107. package/dist/check-profiles.js +62 -0
  108. package/dist/check-profiles.js.map +1 -0
  109. package/dist/cli.js +48 -4
  110. package/dist/cli.js.map +1 -1
  111. package/dist/diagnostics.d.ts +168 -0
  112. package/dist/diagnostics.d.ts.map +1 -0
  113. package/dist/diagnostics.js +164 -0
  114. package/dist/diagnostics.js.map +1 -0
  115. package/dist/effects.d.ts +41 -0
  116. package/dist/effects.d.ts.map +1 -0
  117. package/dist/effects.js +110 -0
  118. package/dist/effects.js.map +1 -0
  119. package/dist/evolution.d.ts +51 -18
  120. package/dist/evolution.d.ts.map +1 -1
  121. package/dist/evolution.js +244 -102
  122. package/dist/evolution.js.map +1 -1
  123. package/dist/finance.d.ts +17 -13
  124. package/dist/finance.d.ts.map +1 -1
  125. package/dist/finance.js +165 -109
  126. package/dist/finance.js.map +1 -1
  127. package/dist/index.d.ts +12 -8
  128. package/dist/index.d.ts.map +1 -1
  129. package/dist/index.js +8 -5
  130. package/dist/index.js.map +1 -1
  131. package/dist/limits.d.ts +2 -2
  132. package/dist/limits.d.ts.map +1 -1
  133. package/dist/limits.js +4 -3
  134. package/dist/limits.js.map +1 -1
  135. package/dist/parser.d.ts.map +1 -1
  136. package/dist/parser.js +6 -16
  137. package/dist/parser.js.map +1 -1
  138. package/dist/schema.d.ts +2059 -135
  139. package/dist/schema.d.ts.map +1 -1
  140. package/dist/schema.js +759 -73
  141. package/dist/schema.js.map +1 -1
  142. package/dist/validation.d.ts +22 -9
  143. package/dist/validation.d.ts.map +1 -1
  144. package/dist/validation.js +1463 -457
  145. package/dist/validation.js.map +1 -1
  146. package/docs/README.md +14 -0
  147. package/docs/guide/01-a-document.md +37 -0
  148. package/docs/guide/02-money-steps.md +23 -0
  149. package/docs/guide/03-laws.md +18 -0
  150. package/docs/guide/04-fees-and-remainder.md +15 -0
  151. package/docs/guide/05-checks-updates-dials.md +7 -0
  152. package/docs/guide/06-effects.md +11 -0
  153. package/docs/guide/07-evolution.md +11 -0
  154. package/docs/guide/08-implementing.md +13 -0
  155. package/docs/llms-full.txt +1241 -0
  156. package/docs/llms.txt +14 -0
  157. package/docs/reference/canonical.md +16 -0
  158. package/docs/reference/clauses.md +986 -0
  159. package/docs/reference/cli.md +22 -0
  160. package/docs/reference/diagnostics.md +32 -0
  161. package/package.json +6 -2
  162. package/skills/udl/SKILL.md +28 -0
  163. package/spec/README.md +82 -51
  164. package/spec/udl.schema.json +1191 -119
  165. package/src/canonical.ts +11 -0
  166. package/src/check-profiles.ts +80 -0
  167. package/src/cli.ts +49 -3
  168. package/src/diagnostics.ts +221 -0
  169. package/src/effects.ts +163 -0
  170. package/src/evolution.ts +375 -125
  171. package/src/finance.ts +255 -160
  172. package/src/index.ts +50 -14
  173. package/src/limits.ts +4 -3
  174. package/src/parser.ts +15 -18
  175. package/src/schema.ts +855 -81
  176. package/src/validation.ts +2666 -560
  177. package/conformance/invalid/missing-create-verb.expected.json +0 -10
  178. package/conformance/invalid/noun-id-not-snake-case.expected.json +0 -10
  179. package/conformance/invalid/verb-without-transition.expected.json +0 -10
package/src/index.ts CHANGED
@@ -1,54 +1,92 @@
1
1
  export { canonicalizeUdl, parseUdl } from "./parser.js";
2
- export { serializeUdl } from "./canonical.js";
2
+ export { canonicalDigest, serializeUdl } from "./canonical.js";
3
+ export { issue, udlDiagnostic, udlDiagnostics } from "./diagnostics.js";
4
+ export type {
5
+ UdlDiagnostic,
6
+ UdlDiagnosticFamily,
7
+ UdlIssue,
8
+ UdlIssueCategory,
9
+ UdlIssueCode,
10
+ } from "./diagnostics.js";
11
+ export {
12
+ udlCheckEvidenceProfile,
13
+ udlCheckEvidenceProfiles,
14
+ type UdlCheckEvidenceProfile,
15
+ } from "./check-profiles.js";
3
16
  export { fixedIsoDurationMs } from "./duration.js";
4
17
  export {
5
- analyzeNounFinance,
18
+ deriveUdlActionEffects,
19
+ movementClass,
20
+ udlEffectKinds,
21
+ type DerivedUdlEffects,
22
+ type UdlEffectKind,
23
+ type UdlMovementClass,
24
+ } from "./effects.js";
25
+ export {
26
+ analyzeInstrumentFinance,
6
27
  type FinanceIssue,
7
28
  type FinanceOptions,
8
29
  } from "./finance.js";
9
30
  export {
10
- diffNounEvolution,
31
+ diffInstrumentEvolution,
11
32
  diffValidatedUdlEvolution,
12
- snapshotUdlNoun,
33
+ snapshotUdlInstrument,
13
34
  } from "./evolution.js";
14
35
  export type {
15
36
  EvolutionFieldSnapshot,
16
37
  EvolutionMoveSnapshot,
17
38
  EvolutionStepSnapshot,
18
39
  EvolutionTransitionSnapshot,
19
- EvolutionVerbSnapshot,
20
- NounEvolutionSnapshot,
40
+ EvolutionActionSnapshot,
41
+ InstrumentEvolutionSnapshot,
21
42
  } from "./evolution.js";
22
43
  export {
44
+ quoteExpiresAtRefKey,
45
+ quoteFrozenRefKey,
46
+ quoteSeededRefKeys,
23
47
  UDL_FORMAT_VERSION,
48
+ udlClauseVocabulary,
24
49
  udlDocumentSchema,
50
+ udlInstrumentActionIdSchema,
25
51
  udlKernelOperationSchema,
26
- udlPublicIntentSchema,
52
+ udlProviderFamilyIdSchema,
53
+ udlPublicActionSchema,
27
54
  } from "./schema.js";
28
55
  export type {
29
56
  UdlAggregate,
30
57
  UdlAggregateCondition,
31
58
  UdlBinding,
59
+ UdlCompositionDial,
32
60
  UdlDeclaredValuePolicy,
33
61
  UdlDecision,
62
+ UdlDial,
34
63
  UdlDocument,
35
64
  UdlDue,
65
+ UdlEffects,
36
66
  UdlExample,
37
67
  UdlGate,
38
68
  UdlKernelOperation,
39
69
  UdlLifecycle,
40
70
  UdlLifecycleTransition,
41
- UdlNoun,
42
- UdlNounSubject,
71
+ UdlInstrument,
72
+ UdlInstrumentSubject,
43
73
  UdlPayout,
44
- UdlRequiresSettlement,
74
+ UdlQuote,
75
+ UdlProviderFamilyId,
76
+ UdlCheckRequirement,
77
+ UdlClauseCardinality,
78
+ UdlClauseEffect,
79
+ UdlReconcile,
80
+ UdlRemainder,
45
81
  UdlStep,
46
82
  UdlSubject,
47
- UdlUnwind,
48
- UdlVerb,
83
+ UdlAction,
84
+ UdlClauseVocabularyEntry,
49
85
  } from "./schema.js";
50
86
  export {
51
87
  assertValidUdl,
88
+ isReconcileExceptionChild,
89
+ reconcileExceptionChildProblems,
52
90
  openReferenceShapeBudget,
53
91
  UdlError,
54
92
  validateUdl,
@@ -57,7 +95,5 @@ export {
57
95
  } from "./validation.js";
58
96
  export type {
59
97
  ReferenceShapeBudget,
60
- UdlIssue,
61
- UdlIssueCode,
62
98
  UdlValidationResult,
63
99
  } from "./validation.js";
package/src/limits.ts CHANGED
@@ -5,7 +5,7 @@ export const UDL_LIMITS = Object.freeze({
5
5
  financeStates: 32,
6
6
  financeTransitionEdges: 128,
7
7
  financeTransitions: 64,
8
- financeVerbs: 64,
8
+ financeActions: 64,
9
9
  financeWork: 4_096,
10
10
  maxDepth: 24,
11
11
  maxKeyLength: 128,
@@ -23,10 +23,11 @@ export const UDL_LIMITS = Object.freeze({
23
23
  /**
24
24
  * Reference-shape classifications one `ReferenceShapeBudget` may buy. Each
25
25
  * one compiles a JSON Schema validator, and a document controls both factors
26
- * of the nouns x gate-fields product that asks for them.
26
+ * of the instruments x gate-fields product that asks for them.
27
27
  */
28
28
  maxSchemaProbes: 2_048,
29
- maxSourceBytes: 256 * 1_024,
29
+ // The complete 2026-09-01 platform catalog serializes to 402,126 bytes.
30
+ maxSourceBytes: 512 * 1_024,
30
31
  maxStringLength: 2_048,
31
32
  maxTotalStringLength: 256 * 1_024,
32
33
  });
package/src/parser.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { serializeUdl } from "./canonical.js";
2
+ import { issue } from "./diagnostics.js";
2
3
  import { UDL_LIMITS } from "./limits.js";
3
4
  import type { UdlDocument } from "./schema.js";
4
- import { assertValidUdl, UdlError, type UdlIssue } from "./validation.js";
5
+ import { assertValidUdl, UdlError } from "./validation.js";
5
6
 
6
7
  const utf8Decoder = new TextDecoder("utf-8", { fatal: true });
7
8
 
@@ -14,11 +15,11 @@ export function parseUdl(source: string | Uint8Array): UdlDocument {
14
15
  : source.byteLength;
15
16
  if (sourceBytes > UDL_LIMITS.maxSourceBytes) {
16
17
  throw new UdlError([
17
- {
18
- code: "resource_limit",
19
- message: `UDL source exceeds ${UDL_LIMITS.maxSourceBytes} bytes`,
20
- path: "$",
21
- },
18
+ issue(
19
+ "UDL1004",
20
+ "$",
21
+ `UDL source exceeds ${UDL_LIMITS.maxSourceBytes} bytes`,
22
+ ),
22
23
  ]);
23
24
  }
24
25
  return parseUdlText(
@@ -32,12 +33,11 @@ function parseUdlText(source: string): UdlDocument {
32
33
  value = JSON.parse(source) as unknown;
33
34
  } catch (error) {
34
35
  throw new UdlError([
35
- {
36
- code: "invalid_json",
37
- message:
38
- error instanceof Error ? error.message : "could not parse JSON",
39
- path: "$",
40
- },
36
+ issue(
37
+ "UDL1002",
38
+ "$",
39
+ error instanceof Error ? error.message : "could not parse JSON",
40
+ ),
41
41
  ]);
42
42
  }
43
43
  return assertValidUdl(value);
@@ -51,11 +51,8 @@ function decodeUdlBytes(source: Uint8Array): string {
51
51
  try {
52
52
  return utf8Decoder.decode(source);
53
53
  } catch {
54
- const issue: UdlIssue = {
55
- code: "invalid_utf8",
56
- message: "UDL bytes must be valid UTF-8",
57
- path: "$",
58
- };
59
- throw new UdlError([issue]);
54
+ throw new UdlError([
55
+ issue("UDL1001", "$", "UDL bytes must be valid UTF-8"),
56
+ ]);
60
57
  }
61
58
  }