@crediolabs/policy-synth 0.2.0 → 0.3.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 (249) hide show
  1. package/README.md +4 -4
  2. package/dist/adapters/interpreter/adapter.d.ts +19 -25
  3. package/dist/adapters/interpreter/adapter.js +54 -487
  4. package/dist/errors.d.ts +1 -1
  5. package/dist/index.d.ts +1 -4
  6. package/dist/index.js +1 -4
  7. package/dist/install/build-add-context-rule.d.ts +3 -19
  8. package/dist/install/build-add-context-rule.js +3 -98
  9. package/dist/install/build-install-policy.d.ts +4 -53
  10. package/dist/install/build-install-policy.js +44 -123
  11. package/dist/install/index.d.ts +0 -2
  12. package/dist/install/index.js +0 -7
  13. package/dist/predicate/decode.d.ts +1 -1
  14. package/dist/predicate/decode.js +2 -70
  15. package/dist/predicate/encode.js +45 -229
  16. package/dist/predicate/from-json.js +1 -42
  17. package/dist/record/decode.js +3 -8
  18. package/dist/record/freshness.d.ts +17 -11
  19. package/dist/record/freshness.js +28 -18
  20. package/dist/review-card/builder.d.ts +4 -3
  21. package/dist/review-card/builder.js +18 -162
  22. package/dist/review-card/cross-check.js +2 -105
  23. package/dist/review-card/render-leaf.d.ts +4 -0
  24. package/dist/review-card/render-leaf.js +47 -0
  25. package/dist/run/index.d.ts +36 -139
  26. package/dist/run/index.js +125 -437
  27. package/dist/run/schemas.d.ts +168 -1929
  28. package/dist/run/schemas.js +40 -269
  29. package/dist/{synth → simulate}/deny-cases.d.ts +4 -8
  30. package/dist/simulate/deny-cases.js +282 -0
  31. package/dist/simulate/evaluate.d.ts +18 -0
  32. package/dist/simulate/evaluate.js +271 -0
  33. package/dist/simulate/index.d.ts +4 -0
  34. package/dist/simulate/index.js +8 -0
  35. package/dist/synth/compose-from-recording.d.ts +24 -51
  36. package/dist/synth/compose-from-recording.js +120 -282
  37. package/dist/synth/index.d.ts +0 -5
  38. package/dist/synth/index.js +0 -5
  39. package/dist/synth/synthesize-from-recording.d.ts +1 -29
  40. package/dist/synth/synthesize-from-recording.js +41 -356
  41. package/dist/types.d.ts +8 -60
  42. package/dist/types.js +5 -2
  43. package/dist-cjs/adapters/interpreter/adapter.d.ts +19 -25
  44. package/dist-cjs/adapters/interpreter/adapter.js +56 -489
  45. package/dist-cjs/errors.d.ts +1 -1
  46. package/dist-cjs/index.d.ts +1 -4
  47. package/dist-cjs/index.js +1 -4
  48. package/dist-cjs/install/build-add-context-rule.d.ts +3 -19
  49. package/dist-cjs/install/build-add-context-rule.js +1 -97
  50. package/dist-cjs/install/build-install-policy.d.ts +4 -53
  51. package/dist-cjs/install/build-install-policy.js +44 -122
  52. package/dist-cjs/install/index.d.ts +0 -2
  53. package/dist-cjs/install/index.js +2 -23
  54. package/dist-cjs/predicate/decode.d.ts +1 -1
  55. package/dist-cjs/predicate/decode.js +2 -70
  56. package/dist-cjs/predicate/encode.js +45 -229
  57. package/dist-cjs/predicate/from-json.js +1 -42
  58. package/dist-cjs/record/decode.js +3 -8
  59. package/dist-cjs/record/freshness.d.ts +17 -11
  60. package/dist-cjs/record/freshness.js +28 -18
  61. package/dist-cjs/review-card/builder.d.ts +4 -3
  62. package/dist-cjs/review-card/builder.js +23 -167
  63. package/dist-cjs/review-card/cross-check.js +7 -110
  64. package/dist-cjs/review-card/render-leaf.d.ts +4 -0
  65. package/dist-cjs/review-card/render-leaf.js +52 -0
  66. package/dist-cjs/run/index.d.ts +36 -139
  67. package/dist-cjs/run/index.js +125 -444
  68. package/dist-cjs/run/schemas.d.ts +168 -1929
  69. package/dist-cjs/run/schemas.js +41 -270
  70. package/dist-cjs/{synth → simulate}/deny-cases.d.ts +4 -8
  71. package/dist-cjs/simulate/deny-cases.js +286 -0
  72. package/dist-cjs/simulate/evaluate.d.ts +18 -0
  73. package/dist-cjs/simulate/evaluate.js +274 -0
  74. package/dist-cjs/simulate/index.d.ts +4 -0
  75. package/dist-cjs/simulate/index.js +13 -0
  76. package/dist-cjs/synth/compose-from-recording.d.ts +24 -51
  77. package/dist-cjs/synth/compose-from-recording.js +120 -282
  78. package/dist-cjs/synth/index.d.ts +0 -5
  79. package/dist-cjs/synth/index.js +1 -11
  80. package/dist-cjs/synth/synthesize-from-recording.d.ts +1 -29
  81. package/dist-cjs/synth/synthesize-from-recording.js +39 -354
  82. package/dist-cjs/types.d.ts +8 -60
  83. package/dist-cjs/types.js +6 -3
  84. package/package.json +5 -5
  85. package/src/adapters/interpreter/adapter.ts +76 -572
  86. package/src/errors.ts +0 -19
  87. package/src/index.ts +1 -4
  88. package/src/install/build-add-context-rule.ts +5 -139
  89. package/src/install/build-install-policy.ts +93 -214
  90. package/src/install/index.ts +0 -34
  91. package/src/predicate/decode.ts +2 -70
  92. package/src/predicate/encode.ts +49 -261
  93. package/src/predicate/from-json.ts +1 -43
  94. package/src/record/decode.ts +3 -8
  95. package/src/record/freshness.ts +29 -18
  96. package/src/review-card/builder.ts +19 -168
  97. package/src/review-card/cross-check.ts +3 -105
  98. package/src/review-card/render-leaf.ts +48 -0
  99. package/src/run/index.ts +144 -572
  100. package/src/run/schemas.ts +42 -291
  101. package/src/simulate/deny-cases.ts +334 -0
  102. package/src/simulate/evaluate.ts +284 -0
  103. package/src/simulate/index.ts +11 -0
  104. package/src/synth/compose-from-recording.ts +148 -347
  105. package/src/synth/index.ts +0 -13
  106. package/src/synth/synthesize-from-recording.ts +43 -456
  107. package/src/types.ts +13 -49
  108. package/dist/adapters/interpreter/index.d.ts +0 -1
  109. package/dist/adapters/interpreter/index.js +0 -2
  110. package/dist/adapters/oz/adapter.d.ts +0 -20
  111. package/dist/adapters/oz/adapter.js +0 -295
  112. package/dist/adapters/oz/index.d.ts +0 -1
  113. package/dist/adapters/oz/index.js +0 -2
  114. package/dist/codegen/compile-gate.d.ts +0 -33
  115. package/dist/codegen/compile-gate.js +0 -124
  116. package/dist/codegen/index.d.ts +0 -2
  117. package/dist/codegen/index.js +0 -8
  118. package/dist/codegen/template.d.ts +0 -18
  119. package/dist/codegen/template.js +0 -148
  120. package/dist/install/authority-overlap.d.ts +0 -134
  121. package/dist/install/authority-overlap.js +0 -0
  122. package/dist/install/build-install-predicate.d.ts +0 -96
  123. package/dist/install/build-install-predicate.js +0 -444
  124. package/dist/install/build-merge-policy.d.ts +0 -70
  125. package/dist/install/build-merge-policy.js +0 -130
  126. package/dist/install/plan-merge-policy.d.ts +0 -49
  127. package/dist/install/plan-merge-policy.js +0 -86
  128. package/dist/install/read-account-rules.d.ts +0 -100
  129. package/dist/install/read-account-rules.js +0 -283
  130. package/dist/ir/index.d.ts +0 -1
  131. package/dist/ir/index.js +0 -2
  132. package/dist/ir/types.d.ts +0 -140
  133. package/dist/ir/types.js +0 -11
  134. package/dist/mandate/index.d.ts +0 -2
  135. package/dist/mandate/index.js +0 -2
  136. package/dist/mandate/to-ir.d.ts +0 -3
  137. package/dist/mandate/to-ir.js +0 -60
  138. package/dist/mandate/types.d.ts +0 -20
  139. package/dist/mandate/types.js +0 -8
  140. package/dist/seams/index.d.ts +0 -1
  141. package/dist/seams/index.js +0 -2
  142. package/dist/seams/types.d.ts +0 -66
  143. package/dist/seams/types.js +0 -11
  144. package/dist/synth/deny-cases.js +0 -562
  145. package/dist/synth/evaluate.d.ts +0 -39
  146. package/dist/synth/evaluate.js +0 -551
  147. package/dist/synth/harness.d.ts +0 -28
  148. package/dist/synth/harness.js +0 -47
  149. package/dist/synth/minimize.d.ts +0 -4
  150. package/dist/synth/minimize.js +0 -38
  151. package/dist/synth/permit-context.d.ts +0 -15
  152. package/dist/synth/permit-context.js +0 -116
  153. package/dist/synth/predicate-literals.d.ts +0 -5
  154. package/dist/synth/predicate-literals.js +0 -25
  155. package/dist/synth/synthesize-from-mandate.d.ts +0 -20
  156. package/dist/synth/synthesize-from-mandate.js +0 -59
  157. package/dist/verify/envelope.d.ts +0 -15
  158. package/dist/verify/envelope.js +0 -22
  159. package/dist/verify/index.d.ts +0 -3
  160. package/dist/verify/index.js +0 -3
  161. package/dist/verify/simulate.d.ts +0 -31
  162. package/dist/verify/simulate.js +0 -258
  163. package/dist/verify/verify.d.ts +0 -21
  164. package/dist/verify/verify.js +0 -189
  165. package/dist-cjs/adapters/interpreter/index.d.ts +0 -1
  166. package/dist-cjs/adapters/interpreter/index.js +0 -8
  167. package/dist-cjs/adapters/oz/adapter.d.ts +0 -20
  168. package/dist-cjs/adapters/oz/adapter.js +0 -300
  169. package/dist-cjs/adapters/oz/index.d.ts +0 -1
  170. package/dist-cjs/adapters/oz/index.js +0 -8
  171. package/dist-cjs/codegen/compile-gate.d.ts +0 -33
  172. package/dist-cjs/codegen/compile-gate.js +0 -128
  173. package/dist-cjs/codegen/index.d.ts +0 -2
  174. package/dist-cjs/codegen/index.js +0 -14
  175. package/dist-cjs/codegen/template.d.ts +0 -18
  176. package/dist-cjs/codegen/template.js +0 -151
  177. package/dist-cjs/install/authority-overlap.d.ts +0 -134
  178. package/dist-cjs/install/authority-overlap.js +0 -0
  179. package/dist-cjs/install/build-install-predicate.d.ts +0 -96
  180. package/dist-cjs/install/build-install-predicate.js +0 -479
  181. package/dist-cjs/install/build-merge-policy.d.ts +0 -70
  182. package/dist-cjs/install/build-merge-policy.js +0 -134
  183. package/dist-cjs/install/plan-merge-policy.d.ts +0 -49
  184. package/dist-cjs/install/plan-merge-policy.js +0 -90
  185. package/dist-cjs/install/read-account-rules.d.ts +0 -100
  186. package/dist-cjs/install/read-account-rules.js +0 -296
  187. package/dist-cjs/ir/index.d.ts +0 -1
  188. package/dist-cjs/ir/index.js +0 -3
  189. package/dist-cjs/ir/types.d.ts +0 -140
  190. package/dist-cjs/ir/types.js +0 -12
  191. package/dist-cjs/mandate/index.d.ts +0 -2
  192. package/dist-cjs/mandate/index.js +0 -6
  193. package/dist-cjs/mandate/to-ir.d.ts +0 -3
  194. package/dist-cjs/mandate/to-ir.js +0 -63
  195. package/dist-cjs/mandate/types.d.ts +0 -20
  196. package/dist-cjs/mandate/types.js +0 -9
  197. package/dist-cjs/seams/index.d.ts +0 -1
  198. package/dist-cjs/seams/index.js +0 -3
  199. package/dist-cjs/seams/types.d.ts +0 -66
  200. package/dist-cjs/seams/types.js +0 -12
  201. package/dist-cjs/synth/deny-cases.js +0 -568
  202. package/dist-cjs/synth/evaluate.d.ts +0 -39
  203. package/dist-cjs/synth/evaluate.js +0 -554
  204. package/dist-cjs/synth/harness.d.ts +0 -28
  205. package/dist-cjs/synth/harness.js +0 -50
  206. package/dist-cjs/synth/minimize.d.ts +0 -4
  207. package/dist-cjs/synth/minimize.js +0 -41
  208. package/dist-cjs/synth/permit-context.d.ts +0 -15
  209. package/dist-cjs/synth/permit-context.js +0 -119
  210. package/dist-cjs/synth/predicate-literals.d.ts +0 -5
  211. package/dist-cjs/synth/predicate-literals.js +0 -28
  212. package/dist-cjs/synth/synthesize-from-mandate.d.ts +0 -20
  213. package/dist-cjs/synth/synthesize-from-mandate.js +0 -62
  214. package/dist-cjs/verify/envelope.d.ts +0 -15
  215. package/dist-cjs/verify/envelope.js +0 -23
  216. package/dist-cjs/verify/index.d.ts +0 -3
  217. package/dist-cjs/verify/index.js +0 -8
  218. package/dist-cjs/verify/simulate.d.ts +0 -31
  219. package/dist-cjs/verify/simulate.js +0 -261
  220. package/dist-cjs/verify/verify.d.ts +0 -21
  221. package/dist-cjs/verify/verify.js +0 -192
  222. package/src/adapters/interpreter/index.ts +0 -8
  223. package/src/adapters/oz/adapter.ts +0 -376
  224. package/src/adapters/oz/index.ts +0 -9
  225. package/src/codegen/compile-gate.ts +0 -167
  226. package/src/codegen/index.ts +0 -17
  227. package/src/codegen/template.ts +0 -165
  228. package/src/install/authority-overlap.ts +0 -0
  229. package/src/install/build-merge-policy.ts +0 -219
  230. package/src/install/plan-merge-policy.ts +0 -133
  231. package/src/install/read-account-rules.ts +0 -376
  232. package/src/ir/index.ts +0 -13
  233. package/src/ir/types.ts +0 -132
  234. package/src/mandate/index.ts +0 -4
  235. package/src/mandate/to-ir.ts +0 -71
  236. package/src/mandate/types.ts +0 -21
  237. package/src/seams/index.ts +0 -11
  238. package/src/seams/types.ts +0 -81
  239. package/src/synth/deny-cases.ts +0 -663
  240. package/src/synth/evaluate.ts +0 -613
  241. package/src/synth/harness.ts +0 -68
  242. package/src/synth/minimize.ts +0 -48
  243. package/src/synth/permit-context.ts +0 -136
  244. package/src/synth/predicate-literals.ts +0 -27
  245. package/src/synth/synthesize-from-mandate.ts +0 -82
  246. package/src/verify/envelope.ts +0 -28
  247. package/src/verify/index.ts +0 -5
  248. package/src/verify/simulate.ts +0 -311
  249. package/src/verify/verify.ts +0 -243
@@ -1,16 +1,10 @@
1
1
  // src/adapters/interpreter/adapter.ts - the interpreter-policy CustodyAdapter.
2
2
  //
3
3
  // Compiles a PolicyIR to a single interpreter `PolicyDocument` + `PolicyRef`
4
- // carrying the canonical predicate encoding from `predicate/encode.ts`. Second
5
- // backend (the OZ built-in adapter is the first); the compose step (P3) routes
6
- // IR constructs between them.
4
+ // carrying the canonical predicate encoding from `predicate/encode.ts`. This is
5
+ // the only backend; the compose step lowers every constraint to it.
7
6
  //
8
7
  // Three fail-closed enforcement gates (per spec):
9
- // - oracle_price leaves MUST sit directly under the top-level `and`; nesting
10
- // under `not` / `or` / inside `in` throws ORACLE_LEAF_INVALID_POSITION.
11
- // - oracleParams overrides may only TIGHTEN vs wasm defaults
12
- // (maxStalenessSeconds <= 600, maxDeviationBps <= 200); a widening value
13
- // throws ORACLE_PARAMS_OUT_OF_RANGE at compile time.
14
8
  // - an `in` allowlist (or a `compare eq` vs an address, or any value in an
15
9
  // `eq_seq`) that targets the smart account's own address throws
16
10
  // SCOPE_SELF_CALL.
@@ -18,27 +12,12 @@
18
12
  // Anything the adapter genuinely cannot express (EVM calldata / value, unix
19
13
  // expiry, etc.) is named in `uncovered` rather than silently dropped.
20
14
  import { encodePredicate } from "../../predicate/encode.js";
15
+ import { GRAMMAR_VERSION, } from "../../types.js";
21
16
  /** [VERIFY] NOT a real deployed address. The interpreter is a per-network
22
17
  * deploy artifact we do not have yet; install is a later phase. */
23
18
  export const PLACEHOLDER_INTERPRETER_ADDRESS = 'VERIFY-interpreter-address';
24
- /** Wasm-level oracle defaults (mirrors the interpreter's `OracleParams`).
25
- * Per-policy overrides may TIGHTEN only - they may never exceed these. */
26
- export const ORACLE_DEFAULTS = {
27
- maxStalenessSeconds: 600,
28
- maxDeviationBps: 200,
29
- };
30
- const CAPABILITIES = {
31
- supportsSpendWindow: true,
32
- supportsThreshold: false, // thresholds are the OZ adapter's job
33
- // Expiry is via the context rule's validUntilLedger, not a predicate - the
34
- // interpreter refuses a `valid_until` leaf at install.
35
- supportsTimeExpiry: false,
36
- supportsOraclePrice: true,
37
- supportsInvocationCount: true,
38
- supportsGeneralPredicate: true,
39
- };
40
- /** Parse confidence for a deterministic (non-decoded) input: full (1.0). A
41
- * mandate needs no decoding, so the gate is not applicable. */
19
+ /** Parse confidence for a deterministic (non-decoded) input: full (1.0). An
20
+ * input that needs no decoding has nothing for the gate to judge. */
42
21
  const FULL_PARSE_CONFIDENCE = {
43
22
  overall: 1,
44
23
  knownContracts: [],
@@ -46,53 +25,26 @@ const FULL_PARSE_CONFIDENCE = {
46
25
  opaqueScVals: [],
47
26
  thresholdUsed: 1,
48
27
  };
49
- export function createInterpreterAdapter(config) {
50
- return {
51
- name: 'interpreter',
52
- mode: 'enforce',
53
- capabilities: () => ({ ...CAPABILITIES }),
54
- compile: (ir) => compile(ir, config),
55
- simulate: () => simulateStub(),
56
- export: (ir) => canonicalStringify(ir),
57
- };
58
- }
59
- /** Lower a single IR rule to the canonical pre-encoding `PredicateNode`. The
60
- * orchestrator uses this to wire the self-verify + minimise pipeline: after
61
- * `compile(ir)` succeeds it re-derives the PredicateNode via this helper to
62
- * drive `minimize` and `runHarness` on the SAME shape the encoder saw. Pure
63
- * and deterministic: same `rule + config` -> byte-identical PredicateNode.
64
- * The `uncovered` list is NOT re-derived - callers needing it must use
65
- * `compile(ir)`. */
28
+ /** Lower a single rule to the canonical pre-encoding `PredicateNode`. The
29
+ * orchestrator re-derives the PredicateNode through this helper so it holds the
30
+ * SAME shape the encoder saw. Pure and deterministic: same `rule + config` ->
31
+ * byte-identical PredicateNode. The `uncovered` list is NOT re-derived -
32
+ * callers needing it must use `compileInterpreterPolicy(rule, config)`. */
66
33
  export function lowerRuleToPredicate(rule, config) {
67
34
  return lowerRule(rule, config).predicate;
68
35
  }
69
- function compile(ir, config) {
70
- // Tighten-only oracle-params gate (config-time). Widening -> throw at compile
71
- // time before any lowering happens, so a misuse fails closed loudly.
72
- assertOracleParamsTighten(config.oracleParams);
73
- const firstRule = ir.rules[0];
74
- if (!firstRule) {
75
- return { covered: false, uncovered: ['empty PolicyIR (no rules to compile)'] };
76
- }
77
- if (ir.rules.length > 1) {
78
- return {
79
- covered: false,
80
- uncovered: [
81
- `multi-rule PolicyIR: ${ir.rules.length - 1} rule(s) beyond the first are not compiled (the interpreter adapter handles one rule per document in this slice)`,
82
- ],
83
- };
84
- }
85
- const lowered = lowerRule(firstRule, config);
36
+ /** Compile a composed rule to an installable interpreter policy. */
37
+ export function compileInterpreterPolicy(rule, config) {
38
+ const lowered = lowerRule(rule, config);
86
39
  if (lowered.uncovered.length > 0) {
87
40
  return { covered: false, uncovered: lowered.uncovered };
88
41
  }
89
42
  const { encodedPredicate, predicateHash } = encodePredicate(lowered.predicate);
90
43
  const policyDocument = {
91
- grammarVersion: 1,
44
+ grammarVersion: GRAMMAR_VERSION,
92
45
  installNonce: config.installNonce,
93
46
  encodedPredicate,
94
47
  predicateHash,
95
- ...(config.oracleParams ? { oracleParams: config.oracleParams } : {}),
96
48
  };
97
49
  const policyRef = {
98
50
  kind: 'interpreter',
@@ -113,56 +65,18 @@ function lowerRule(rule, config) {
113
65
  const uncovered = [];
114
66
  // scope -> context rule + sibling predicates. contract/method each become
115
67
  // their own `eq` leaf and are merged into the top-level `and` alongside the
116
- // constraints. The top-level MUST be `and` so oracle leaves sit directly
117
- // under it (mandatory per the oracle position rule + canonical hash stability).
68
+ // constraints. The top-level MUST be `and` for canonical hash stability.
118
69
  const scopeContract = rule.scope.contract;
119
70
  const scopeMethod = rule.scope.method;
120
- if (rule.scope.chainId !== undefined) {
121
- uncovered.push(`chainId \`${rule.scope.chainId}\` not bindable by the interpreter adapter (network is per-context, not per-rule)`);
122
- }
123
- if (rule.roles.length > 0) {
124
- uncovered.push(`roles [${rule.roles.join(', ')}] dropped (role-to-signer mapping is a later phase; interpreter policies reference addresses, not role names)`);
125
- }
126
- if (rule.guard) {
127
- uncovered.push(`guard: ${describeCondition(rule.guard)} (interpreter adapter currently treats guards as uncovered)`);
128
- }
129
- // expiry -> context rule validUntilLedger only. Unix-timestamp expiry is
130
- // honoured by the interpreter (the `valid_until` selector), but we surface
131
- // it here as Path-B because the IR contract already says "OZ context rules
132
- // expire by ledger sequence" and we keep one expiry model for both adapters.
133
- let validUntilLedger = null;
134
- if (rule.expiry) {
135
- if (rule.expiry.validUntilLedger !== undefined) {
136
- validUntilLedger = rule.expiry.validUntilLedger;
137
- }
138
- else if (rule.expiry.validUntilUnixSeconds !== undefined) {
139
- uncovered.push('time expiry given as a unix timestamp (interpreter adapter currently lowers expiry only via the OZ context-rule validUntilLedger; supply expiry.validUntilLedger)');
140
- }
141
- }
142
- // approval is the OZ adapter's job (it lowers to simple_threshold /
143
- // weighted_threshold primitives). Surface it here so a caller that drops it
144
- // through to the interpreter adapter sees an explicit uncovered entry
145
- // instead of a silently-dropped M-of-N gate.
146
- if (rule.approval) {
147
- uncovered.push(`approval threshold ${rule.approval.threshold} not emitted by the interpreter adapter (thresholds lower to OZ built-in primitives in the OZ adapter)`);
148
- }
71
+ // expiry -> the context rule's own validUntilLedger. The interpreter has no
72
+ // expiry selector; a policy's lifetime is the OZ context rule's lifetime.
73
+ const validUntilLedger = rule.expiry?.validUntilLedger ?? null;
149
74
  // Pre-scan constraints: anything the interpreter adapter cannot express is
150
75
  // named in `uncovered` and skipped from the predicate lowering. We surface
151
76
  // these BEFORE lowering so the predicate is built from only the
152
77
  // expressible subset.
153
- const expressibleConstraints = [];
154
- for (const c of rule.constraints) {
155
- const unsupp = unsupportedConstruct(c);
156
- if (unsupp !== null) {
157
- uncovered.push(unsupp);
158
- }
159
- else {
160
- expressibleConstraints.push(c);
161
- }
162
- }
163
78
  // Build the top-level `and` of scope + expressible constraints. The
164
- // top-level MUST be `and` so oracle leaves sit directly under it - the
165
- // position rule is enforced inside `lowerCondition`.
79
+ // top-level MUST be `and` for canonical hash stability.
166
80
  const topChildren = [];
167
81
  if (scopeContract !== undefined) {
168
82
  topChildren.push({
@@ -178,14 +92,23 @@ function lowerRule(rule, config) {
178
92
  right: { kind: 'literal_symbol', value: scopeMethod },
179
93
  });
180
94
  }
181
- for (const c of expressibleConstraints) {
182
- topChildren.push(lowerCondition(c, config));
95
+ topChildren.push(...rule.constraints);
96
+ // One walk over the whole tree rejects any literal naming the smart account
97
+ // itself. Previously three separate call sites did this per construct, which
98
+ // meant a new construct could be added without one.
99
+ for (const node of topChildren) {
100
+ assertNoSelfCall(node, config);
183
101
  }
184
102
  const predicate = topChildren.length === 1 && topChildren[0] !== undefined
185
103
  ? topChildren[0]
186
104
  : { op: 'and', children: topChildren };
105
+ // Scope the context rule to the contract when the rule names one, matching
106
+ // what OZ's CallContract scoping did. A `default` rule would route EVERY
107
+ // call through this policy instead of only calls to the scoped contract.
187
108
  const contextRule = {
188
- contextRuleType: { kind: 'default' },
109
+ contextRuleType: scopeContract !== undefined
110
+ ? { kind: 'call_contract', contract: scopeContract }
111
+ : { kind: 'default' },
189
112
  name: 'interpreter',
190
113
  validUntilLedger,
191
114
  signers: [],
@@ -193,392 +116,36 @@ function lowerRule(rule, config) {
193
116
  };
194
117
  return { predicate, contextRule, uncovered };
195
118
  }
196
- /** Detect IR constructs the interpreter adapter cannot express; return a
197
- * human-readable descriptor (or null if the construct IS expressible). Used
198
- * by `lowerRule` to populate `uncovered` before lowering. */
199
- function unsupportedConstruct(cond) {
200
- switch (cond.op) {
201
- // Expressible: `call_arg_scaled` is exactly this construct.
202
- case 'slippage_floor':
203
- return null;
204
- case 'in':
205
- // The oracle position rule is a hard error and must be raised before a
206
- // construct can be written off as uncovered - otherwise a subtree that
207
- // is BOTH misplaced-oracle and unsourceable would be silently dropped
208
- // instead of rejected.
209
- assertNoOracleDescendants(cond);
210
- return (unsourceableSelector(cond.selector) ??
211
- (cond.selector.kind === 'calldata' || cond.selector.kind === 'value'
212
- ? `EVM \`${cond.selector.kind}\` selector on allowlist (predicate DSL)`
213
- : null));
214
- case 'eq_seq':
215
- return (unsourceableSelector(cond.selector) ??
216
- (cond.selector.kind === 'calldata' || cond.selector.kind === 'value'
217
- ? `EVM \`${cond.selector.kind}\` selector on ordered-sequence equality (predicate DSL)`
218
- : null));
219
- case 'compare': {
220
- const s = cond.compare.selector;
221
- if (s.kind === 'calldata')
222
- return 'EVM calldata comparison (predicate DSL)';
223
- if (s.kind === 'value')
224
- return 'tx.value comparison (predicate DSL)';
225
- // The on-chain interpreter sees ONE authorized call - no
226
- // `Context.sub_invocations` in v1 - so it cannot observe token
227
- // movements. `amount` has no value to read, and `window_spent`
228
- // accumulates BY that amount, so its counter would never move.
229
- // Deriving either from the call payload would quietly swap "value
230
- // actually moved" for "value the caller declared" - a weaker guarantee
231
- // than the review card would be claiming.
232
- //
233
- // Rolling spend caps belong to the OZ `spending_limit` primitive (already
234
- // audited, emitted by the OZ adapter). A per-call cap is expressible here
235
- // as `arg_field`; bounding it with `invocation_count` gives an enforceable
236
- // ceiling per window.
237
- return unsourceableSelector(s);
238
- }
239
- // Recurse: a nested `and`/`or`/`not` must not smuggle a selector past the
240
- // pre-scan, which only sees top-level constraints.
241
- case 'and':
242
- return cond.children.map(unsupportedConstruct).find((u) => u !== null) ?? null;
243
- case 'or':
244
- assertNoOracleDescendants(cond);
245
- return cond.children.map(unsupportedConstruct).find((u) => u !== null) ?? null;
246
- case 'not':
247
- assertNoOracleDescendants(cond);
248
- return unsupportedConstruct(cond.child);
249
- }
250
- }
251
- /** Selectors whose value the on-chain interpreter has no way to obtain. */
252
- function unsourceableSelector(s) {
253
- if (s.kind === 'amount') {
254
- return `per-call amount comparison on ${s.token} - the interpreter cannot observe token movements; express a per-call cap with arg_field, or a rolling cap with the OZ spending_limit primitive`;
255
- }
256
- if (s.kind === 'window_spent') {
257
- return `rolling spend cap on ${s.token} over ${s.windowSeconds}s - not enforceable by the interpreter; use the OZ spending_limit primitive, or bound per-call value with arg_field plus invocation_count`;
258
- }
259
- return null;
260
- }
261
- /** Lower one IR condition to a PredicateNode. Enforces the oracle position
262
- * rule (oracle_price leaves must sit directly under the top-level `and`) and
263
- * the self-call rule (`in` allowlist / `compare eq` vs the smart account
264
- * address -> SCOPE_SELF_CALL). */
265
- function lowerCondition(cond, config) {
266
- switch (cond.op) {
267
- // `out >= in * num/den`. The contract refuses den == 0 or a non-positive
268
- // ratio at install, so a malformed floor fails loudly rather than
269
- // silently inverting the comparison.
270
- case 'slippage_floor':
271
- return {
272
- op: 'gte',
273
- left: { kind: 'call_arg', index: cond.outArgIndex },
274
- right: {
275
- kind: 'call_arg_scaled',
276
- index: cond.inArgIndex,
277
- num: cond.num,
278
- den: cond.den,
279
- },
280
- };
281
- case 'and':
282
- return { op: 'and', children: cond.children.map((c) => lowerCondition(c, config)) };
283
- case 'or':
284
- // `or` at this depth: oracle_price anywhere inside is invalid (would
285
- // not be a direct child of the top-level `and`).
286
- assertNoOracleDescendants(cond);
287
- return { op: 'or', children: cond.children.map((c) => lowerCondition(c, config)) };
288
- case 'not':
289
- // `not` at this depth: oracle_price anywhere inside is invalid.
290
- assertNoOracleDescendants(cond);
291
- return { op: 'not', child: lowerCondition(cond.child, config) };
292
- case 'in': {
293
- assertNoOracleDescendants(cond);
294
- for (const v of cond.values) {
295
- assertNotSelfCallAddress(v, config);
296
- }
297
- // `in` is PURE set membership; the encoder sorts the haystack. An exact
298
- // ordered sequence (e.g. swap hop path) is expressed as `eq_seq` and
299
- // lowers to `eq(selector, literal_vec)` instead - never to `in` with an
300
- // `ordered` flag.
301
- return {
302
- op: 'in',
303
- needle: lowerSelector(cond.selector),
304
- haystack: cond.values.map((v) => literalFromScalar(v, selectorScalarType(cond.selector))),
305
- };
306
- }
307
- case 'eq_seq': {
308
- assertNoOracleDescendants(cond);
309
- for (const v of cond.values) {
310
- assertNotSelfCallAddress(v, config);
311
- }
312
- // Exact ordered sequence equality: the right-hand side is a literal_vec
313
- // whose element order is preserved verbatim by the encoder. `eq` does
314
- // deep equality at evaluate time - this is the ONLY way to express an
315
- // exact ordered sequence in the predicate grammar (the path of a swap).
316
- return {
317
- op: 'eq',
318
- left: lowerSelector(cond.selector),
319
- right: {
320
- kind: 'literal_vec',
321
- elements: cond.values.map((v) => literalFromScalar(v, selectorScalarType(cond.selector))),
322
- },
323
- };
324
- }
325
- case 'compare': {
326
- // Self-call on an address eq.
327
- if (cond.compare.operator === 'eq' &&
328
- cond.compare.selector.kind === 'arg' &&
329
- cond.compare.selector.scalarType === 'address') {
330
- assertNotSelfCallAddress(cond.compare.value, config);
331
- }
332
- return {
333
- op: cond.compare.operator,
334
- left: lowerSelector(cond.compare.selector),
335
- right: literalFromIRCompare(cond.compare),
336
- };
119
+ /** Reject a value that targets the smart account's own address (a self-call
120
+ * is a structural privilege-escalation hole the interpreter forbids). */
121
+ /** Reject any address literal anywhere in the predicate that names the smart
122
+ * account itself: a policy permitting the account to call itself would let an
123
+ * agent re-enter the guarded account and escape the scope the rule pins. */
124
+ function assertNoSelfCall(node, config) {
125
+ const checkLeaf = (leaf) => {
126
+ if (leaf.kind === 'literal_vec') {
127
+ for (const e of leaf.elements)
128
+ checkLeaf(e);
129
+ return;
337
130
  }
338
- }
339
- }
340
- /** Lower an IR selector to the matching PredicateLeaf. */
341
- function lowerSelector(s) {
342
- switch (s.kind) {
343
- case 'arg':
344
- return { kind: 'call_arg', index: s.argIndex };
345
- case 'arg_len':
346
- return { kind: 'call_arg_len', index: s.argIndex };
347
- case 'arg_field':
348
- return { kind: 'call_arg_field', index: s.argIndex, element: s.element, field: s.field };
349
- // `amount` / `window_spent` are filtered out by `unsupportedConstruct`
350
- // before lowering - the interpreter cannot source either on chain.
351
- // Reaching here means the pre-scan was bypassed; fail loudly rather than
352
- // emit a leaf the contract will refuse.
353
- case 'amount':
354
- case 'window_spent':
355
- throw new Error(`interpreter adapter cannot lower \`${s.kind}\`: it should have been reported as uncovered`);
356
- case 'invocation_count':
357
- return { kind: 'invocation_count_in_window', windowSecs: s.windowSeconds };
358
- case 'now':
359
- return { kind: 'now' };
360
- case 'valid_until':
361
- return { kind: 'valid_until' };
362
- case 'oracle_price':
363
- return { kind: 'oracle_price', asset: s.asset };
364
- case 'calldata':
365
- case 'value':
366
- // Unreachable: the caller flagged these as Path-B before reaching here.
367
- throw toolError('SYNTHESIS_ERROR', `selector kind \`${s.kind}\` is not lowerable to a predicate leaf`);
368
- }
369
- }
370
- /** Build a literal leaf from the right-hand side of an IRCompare, mapping the
371
- * selector kind to the matching `literal_*` kind. The IR compare value is a
372
- * raw string (i128-safe); the selector kind fixes the canonical wire type:
373
- * - arg -> IR scalarType (set by the recorder/parser)
374
- * - arg_len -> u32 (vec length is a small non-negative integer)
375
- * - arg_field -> IR scalarType (the field's recorded type)
376
- * - amount -> i128 (canonical Stellar token amount encoding)
377
- * - window_spent -> i128 (canonical amount encoding)
378
- * - oracle_price -> i128 (canonical price encoding)
379
- * - invocation_count -> u32 (counts are small non-negative integers)
380
- * - now / valid_until -> u64 (unix timestamps in seconds) */
381
- function literalFromIRCompare(c) {
382
- // An oracle comparand is not a bare literal: the interpreter refuses one,
383
- // because assuming it shares the normalised 9-dp basis is what made a raw
384
- // 14-dp threshold permit everything it was written to deny.
385
- if (c.selector.kind === 'oracle_price') {
386
- if (c.valueDecimals === undefined) {
387
- throw toolError('ORACLE_THRESHOLD_BASIS_REQUIRED', 'An oracle price bound must declare the decimal basis of its threshold ' +
388
- '(oracle prices normalise to 9 decimals).');
131
+ if (leaf.kind === 'literal_address' && leaf.value === config.smartAccountAddress) {
132
+ throw toolError('SCOPE_SELF_CALL', `value \`${leaf.value}\` is the smart account's own address (self-call in an allowlist / compare is rejected)`);
389
133
  }
390
- return { kind: 'oracle_threshold', value: c.value, decimals: c.valueDecimals };
391
- }
392
- const scalarType = selectorScalarType(c.selector);
393
- return literalFromScalar(c.value, scalarType);
394
- }
395
- function literalScalarForSelector(kind) {
396
- switch (kind) {
397
- case 'amount':
398
- case 'window_spent':
399
- case 'oracle_price':
400
- return 'i128';
401
- case 'invocation_count':
402
- case 'arg_len':
403
- return 'u32';
404
- case 'now':
405
- case 'valid_until':
406
- return 'u64';
407
- case 'arg':
408
- case 'arg_field':
409
- case 'calldata':
410
- case 'value':
411
- // arg / arg_field -> caller handles scalarType; calldata/value -> unreachable (Path-B).
412
- return 'i128';
413
- }
414
- }
415
- /** Build a literal leaf from a raw string value + an IRScalarType hint. */
416
- function literalFromScalar(value, scalarType) {
417
- switch (scalarType) {
418
- case 'address':
419
- return { kind: 'literal_address', value };
420
- case 'i128':
421
- case 'u128':
422
- return { kind: 'literal_i128', value };
423
- case 'u32':
424
- return { kind: 'literal_u32', value: Number.parseInt(value, 10) };
425
- case 'u64':
426
- case 'i64':
427
- return { kind: 'literal_u64', value };
428
- case 'symbol':
429
- return { kind: 'literal_symbol', value };
430
- case 'bytes':
431
- return { kind: 'literal_bytes', value };
432
- case 'bool':
433
- throw toolError('MALFORMED_PREDICATE', `boolean literal not supported in v1 predicate grammar`);
434
- }
435
- }
436
- /** Scalar type of an IRSelector for the purpose of building literal leaves
437
- * (the right-hand side of `eq` / elements of an `in` haystack / elements of
438
- * a `literal_vec`). Mirrors `literalScalarForSelector` for OZ extensions and
439
- * uses the selector's own `scalarType` for `arg` and `arg_field` selectors. */
440
- function selectorScalarType(selector) {
441
- if (selector.kind === 'arg')
442
- return selector.scalarType;
443
- if (selector.kind === 'arg_field')
444
- return selector.scalarType;
445
- return literalScalarForSelector(selector.kind);
446
- }
447
- /** Walk a condition tree and throw if any oracle_price leaf is found anywhere
448
- * inside. Used by `lowerCondition` for `not`, `or`, and `in` - the three
449
- * positions where oracle leaves would not be direct children of the
450
- * top-level `and`. */
451
- function assertNoOracleDescendants(node) {
452
- if (containsOracle(node)) {
453
- throw toolError('ORACLE_LEAF_INVALID_POSITION', 'oracle_price leaves must sit directly under the top-level `and`');
454
- }
455
- }
456
- function containsOracle(node) {
134
+ };
457
135
  switch (node.op) {
458
- case 'slippage_floor':
459
- return false;
460
- case 'compare':
461
- return node.compare.selector.kind === 'oracle_price';
462
- case 'in':
463
- return node.selector.kind === 'oracle_price';
464
- case 'eq_seq':
465
- return node.selector.kind === 'oracle_price';
466
- case 'not':
467
- return containsOracle(node.child);
468
136
  case 'and':
469
- case 'or':
470
- return node.children.some(containsOracle);
471
- }
472
- }
473
- /** Reject a value that targets the smart account's own address (a self-call
474
- * is a structural privilege-escalation hole the interpreter forbids). */
475
- function assertNotSelfCallAddress(value, config) {
476
- if (value === config.smartAccountAddress) {
477
- throw toolError('SCOPE_SELF_CALL', `value \`${value}\` is the smart account's own address (self-call in an allowlist / compare is rejected)`);
478
- }
479
- }
480
- /** Tighten-only oracle-params gate. Any widening value (above the wasm-level
481
- * defaults) throws ORACLE_PARAMS_OUT_OF_RANGE at compile time. */
482
- function assertOracleParamsTighten(params) {
483
- if (!params)
484
- return;
485
- if (params.maxStalenessSeconds !== undefined &&
486
- params.maxStalenessSeconds > ORACLE_DEFAULTS.maxStalenessSeconds) {
487
- throw toolError('ORACLE_PARAMS_OUT_OF_RANGE', `maxStalenessSeconds ${params.maxStalenessSeconds} exceeds default ${ORACLE_DEFAULTS.maxStalenessSeconds}`);
488
- }
489
- if (params.maxDeviationBps !== undefined &&
490
- params.maxDeviationBps > ORACLE_DEFAULTS.maxDeviationBps) {
491
- throw toolError('ORACLE_PARAMS_OUT_OF_RANGE', `maxDeviationBps ${params.maxDeviationBps} exceeds default ${ORACLE_DEFAULTS.maxDeviationBps}`);
492
- }
493
- }
494
- /** Human-readable descriptor for a construct the interpreter adapter cannot
495
- * express. Mirrors the OZ adapter's `describeCondition` for parity. */
496
- function describeCondition(cond) {
497
- switch (cond.op) {
498
- case 'slippage_floor':
499
- return `slippage floor: arg[${cond.outArgIndex}] >= arg[${cond.inArgIndex}] * ${cond.num}/${cond.den}`;
137
+ for (const c of node.children)
138
+ assertNoSelfCall(c, config);
139
+ return;
500
140
  case 'in':
501
- return `value allowlist on ${describeSelector(cond.selector)} (predicate DSL)`;
502
- case 'eq_seq':
503
- return `exact ordered sequence on ${describeSelector(cond.selector)} (predicate DSL)`;
504
- case 'not':
505
- return 'negated condition (predicate DSL)';
506
- case 'and':
507
- case 'or':
508
- return `nested ${cond.op} condition (predicate DSL)`;
509
- case 'compare': {
510
- const s = cond.compare.selector;
511
- switch (s.kind) {
512
- case 'oracle_price':
513
- return `oracle price condition on ${s.asset}`;
514
- case 'invocation_count':
515
- return `invocation-count window (${s.windowSeconds}s) condition`;
516
- case 'window_spent':
517
- return `spend-window comparison with operator '${cond.compare.operator}'`;
518
- case 'amount':
519
- return `per-call amount comparison on ${s.token}`;
520
- case 'arg':
521
- return `argument comparison on arg ${s.argIndex}`;
522
- case 'arg_len':
523
- return `vec length comparison on arg ${s.argIndex}`;
524
- case 'arg_field':
525
- return `map field comparison on arg ${s.argIndex}.${s.field}`;
526
- case 'calldata':
527
- return 'EVM calldata comparison';
528
- case 'value':
529
- return 'tx.value comparison';
530
- case 'now':
531
- case 'valid_until':
532
- return 'time comparison';
533
- }
534
- }
535
- }
536
- }
537
- function describeSelector(s) {
538
- switch (s.kind) {
539
- case 'arg':
540
- return `arg ${s.argIndex}`;
541
- case 'arg_len':
542
- return `arg_len(${s.argIndex})`;
543
- case 'arg_field':
544
- return `arg_field(${s.argIndex}, ${s.element}, ${s.field})`;
545
- case 'amount':
546
- return `amount(${s.token})`;
547
- case 'window_spent':
548
- return `window_spent(${s.token})`;
549
- case 'oracle_price':
550
- return `oracle_price(${s.asset})`;
551
- case 'invocation_count':
552
- return `invocation_count(${s.windowSeconds}s)`;
553
- case 'calldata':
554
- return `calldata[${s.offset}:${s.offset + s.length}]`;
141
+ // The needle is a selector; only the haystack carries literals.
142
+ for (const h of node.haystack)
143
+ checkLeaf(h);
144
+ return;
555
145
  default:
556
- return s.kind;
557
- }
558
- }
559
- function simulateStub() {
560
- return {
561
- backend: 'ts-model',
562
- permitted: null,
563
- evaluations: [],
564
- notes: ['stub: real permit/deny semantics wiring is a later phase'],
565
- };
566
- }
567
- /** Canonical JSON with recursively sorted object keys (stable across runs). */
568
- function canonicalStringify(value) {
569
- return JSON.stringify(sortKeys(value));
570
- }
571
- function sortKeys(value) {
572
- if (Array.isArray(value))
573
- return value.map(sortKeys);
574
- if (value && typeof value === 'object') {
575
- const out = {};
576
- for (const key of Object.keys(value).sort()) {
577
- out[key] = sortKeys(value[key]);
578
- }
579
- return out;
146
+ checkLeaf(node.left);
147
+ checkLeaf(node.right);
580
148
  }
581
- return value;
582
149
  }
583
150
  /** Build a synthetic Error carrying the ToolError code/severity/retryable
584
151
  * fields the existing ToolError shape uses (the encoder pattern). Callers
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type ErrorCode = 'RECORDING_FAILED' | 'RECORDING_VALIDATION_FAILED' | 'SCOPE_UNRESOLVED' | 'SYNTHESIS_ERROR' | 'MALFORMED_PREDICATE' | 'SIMULATION_ERROR' | 'VERIFICATION_FAILED' | 'DENY_CASE_FAILURE' | 'PERMIT_CASE_FAILED' | 'SUMMARY_DRIFT' | 'INSTALL_BUILD_FAILED' | 'INSTALL_CONFIRM_MISSING' | 'INSTALL_CONFIRM_EXPIRED' | 'REVOKE_BUILD_FAILED' | 'REVOKE_CONFIRM_MISSING' | 'USER_REJECTED_SIGN' | 'WALLET_TIMEOUT' | 'WALLET_UNAVAILABLE' | 'PREDICATE_TOO_LARGE' | 'PREDICATE_TOO_DEEP' | 'TOO_MANY_LEAVES' | 'IN_OPERAND_LIMIT' | 'PREDICATE_ORACLE_OVER_LIMIT' | 'POLICY_CAP_EXCEEDED' | 'WASM_TOO_LARGE' | 'MASTER_AUTH_REQUIRED' | 'NONCE_REPLAY' | 'VERSION_MISMATCH' | 'ARITHMETIC_OVERFLOW' | 'AMOUNT_OVERFLOW' | 'RULE_SIGNERS_CHANGED' | 'SCOPE_SELF_CALL' | 'ARG_MISMATCH' | 'CONTRACT_SCOPE' | 'UNSUPPORTED_NODE' | 'STATEFUL_BOUND' | 'NOT_IN_ALLOWLIST' | 'FREQUENCY' | 'SLIPPAGE_FLOOR' | 'ORACLE_STALE' | 'ORACLE_MISSING' | 'ORACLE_NO_CONFIRMATION' | 'ORACLE_DEVIATION_EXCEEDED' | 'ORACLE_MALFORMED_HISTORY' | 'ORACLE_FINGERPRINT_DRIFT' | 'ORACLE_PAUSED' | 'ORACLE_LEAF_INVALID_POSITION' | 'ORACLE_PARAMS_OUT_OF_RANGE' | 'ORACLE_DECIMALS_MISMATCH' | 'ORACLE_THRESHOLD_DECIMALS_OUT_OF_RANGE' | 'ORACLE_THRESHOLD_BASIS_REQUIRED' | 'COMPILE_OK' | 'COMPILE_GATE_FAILED';
1
+ export type ErrorCode = 'RECORDING_FAILED' | 'RECORDING_VALIDATION_FAILED' | 'SCOPE_UNRESOLVED' | 'SYNTHESIS_ERROR' | 'MALFORMED_PREDICATE' | 'SIMULATION_ERROR' | 'VERIFICATION_FAILED' | 'DENY_CASE_FAILURE' | 'PERMIT_CASE_FAILED' | 'SUMMARY_DRIFT' | 'INSTALL_BUILD_FAILED' | 'INSTALL_CONFIRM_MISSING' | 'INSTALL_CONFIRM_EXPIRED' | 'REVOKE_BUILD_FAILED' | 'REVOKE_CONFIRM_MISSING' | 'USER_REJECTED_SIGN' | 'WALLET_TIMEOUT' | 'WALLET_UNAVAILABLE' | 'PREDICATE_TOO_LARGE' | 'PREDICATE_TOO_DEEP' | 'TOO_MANY_LEAVES' | 'IN_OPERAND_LIMIT' | 'POLICY_CAP_EXCEEDED' | 'WASM_TOO_LARGE' | 'MASTER_AUTH_REQUIRED' | 'NONCE_REPLAY' | 'VERSION_MISMATCH' | 'ARITHMETIC_OVERFLOW' | 'AMOUNT_OVERFLOW' | 'RULE_SIGNERS_CHANGED' | 'SCOPE_SELF_CALL' | 'ARG_MISMATCH' | 'CONTRACT_SCOPE' | 'UNSUPPORTED_NODE' | 'STATEFUL_BOUND' | 'NOT_IN_ALLOWLIST' | 'COMPILE_OK' | 'COMPILE_GATE_FAILED';
2
2
  export interface ToolError {
3
3
  code: ErrorCode;
4
4
  message: string;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,8 @@
1
- export * from './adapters/oz/index.ts';
2
1
  export * from './errors.ts';
3
- export * from './ir/index.ts';
4
- export * from './mandate/index.ts';
5
2
  export * from './predicate/index.ts';
6
3
  export * from './record/index.ts';
7
4
  export * from './registry/index.ts';
8
5
  export * from './review-card/index.ts';
9
- export * from './seams/index.ts';
6
+ export * from './simulate/index.ts';
10
7
  export * from './synth/index.ts';
11
8
  export * from './types.ts';
package/dist/index.js CHANGED
@@ -1,11 +1,8 @@
1
- export * from "./adapters/oz/index.js";
2
1
  export * from "./errors.js";
3
- export * from "./ir/index.js";
4
- export * from "./mandate/index.js";
5
2
  export * from "./predicate/index.js";
6
3
  export * from "./record/index.js";
7
4
  export * from "./registry/index.js";
8
5
  export * from "./review-card/index.js";
9
- export * from "./seams/index.js";
6
+ export * from "./simulate/index.js";
10
7
  export * from "./synth/index.js";
11
8
  export * from "./types.js";