@crediolabs/policy-synth 0.1.18 → 0.2.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 (42) hide show
  1. package/README.md +3 -2
  2. package/dist/install/authority-overlap.d.ts +134 -0
  3. package/dist/install/authority-overlap.js +0 -0
  4. package/dist/install/build-add-context-rule.d.ts +8 -0
  5. package/dist/install/build-add-context-rule.js +1 -1
  6. package/dist/install/build-merge-policy.d.ts +70 -0
  7. package/dist/install/build-merge-policy.js +130 -0
  8. package/dist/install/index.d.ts +2 -0
  9. package/dist/install/index.js +7 -0
  10. package/dist/install/plan-merge-policy.d.ts +49 -0
  11. package/dist/install/plan-merge-policy.js +86 -0
  12. package/dist/install/read-account-rules.d.ts +100 -0
  13. package/dist/install/read-account-rules.js +283 -0
  14. package/dist/run/index.d.ts +93 -8
  15. package/dist/run/index.js +282 -11
  16. package/dist/run/schemas.d.ts +290 -11
  17. package/dist/run/schemas.js +77 -11
  18. package/dist-cjs/install/authority-overlap.d.ts +134 -0
  19. package/dist-cjs/install/authority-overlap.js +0 -0
  20. package/dist-cjs/install/build-add-context-rule.d.ts +8 -0
  21. package/dist-cjs/install/build-add-context-rule.js +1 -0
  22. package/dist-cjs/install/build-merge-policy.d.ts +70 -0
  23. package/dist-cjs/install/build-merge-policy.js +134 -0
  24. package/dist-cjs/install/index.d.ts +2 -0
  25. package/dist-cjs/install/index.js +23 -2
  26. package/dist-cjs/install/plan-merge-policy.d.ts +49 -0
  27. package/dist-cjs/install/plan-merge-policy.js +90 -0
  28. package/dist-cjs/install/read-account-rules.d.ts +100 -0
  29. package/dist-cjs/install/read-account-rules.js +296 -0
  30. package/dist-cjs/run/index.d.ts +93 -8
  31. package/dist-cjs/run/index.js +283 -10
  32. package/dist-cjs/run/schemas.d.ts +290 -11
  33. package/dist-cjs/run/schemas.js +78 -12
  34. package/package.json +1 -1
  35. package/src/install/authority-overlap.ts +0 -0
  36. package/src/install/build-add-context-rule.ts +12 -1
  37. package/src/install/build-merge-policy.ts +219 -0
  38. package/src/install/index.ts +34 -0
  39. package/src/install/plan-merge-policy.ts +133 -0
  40. package/src/install/read-account-rules.ts +376 -0
  41. package/src/run/index.ts +386 -14
  42. package/src/run/schemas.ts +84 -11
@@ -505,18 +505,66 @@ export declare const ComposeUserResponsesSchema: z.ZodObject<{
505
505
  limitAmount: z.ZodOptional<z.ZodString>;
506
506
  invocationLimit: z.ZodOptional<z.ZodNumber>;
507
507
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
508
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
509
+ asset: z.ZodEffects<z.ZodString, string, string>;
510
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
511
+ value: z.ZodString;
512
+ decimals: z.ZodNumber;
513
+ }, "strip", z.ZodTypeAny, {
514
+ value: string;
515
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
516
+ asset: string;
517
+ decimals: number;
518
+ }, {
519
+ value: string;
520
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
521
+ asset: string;
522
+ decimals: number;
523
+ }>, "many">>;
508
524
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
509
525
  windowSeconds: z.ZodOptional<z.ZodNumber>;
510
526
  validUntilLedger: z.ZodOptional<z.ZodNumber>;
511
527
  limitAmount: z.ZodOptional<z.ZodString>;
512
528
  invocationLimit: z.ZodOptional<z.ZodNumber>;
513
529
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
530
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
531
+ asset: z.ZodEffects<z.ZodString, string, string>;
532
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
533
+ value: z.ZodString;
534
+ decimals: z.ZodNumber;
535
+ }, "strip", z.ZodTypeAny, {
536
+ value: string;
537
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
538
+ asset: string;
539
+ decimals: number;
540
+ }, {
541
+ value: string;
542
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
543
+ asset: string;
544
+ decimals: number;
545
+ }>, "many">>;
514
546
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
515
547
  windowSeconds: z.ZodOptional<z.ZodNumber>;
516
548
  validUntilLedger: z.ZodOptional<z.ZodNumber>;
517
549
  limitAmount: z.ZodOptional<z.ZodString>;
518
550
  invocationLimit: z.ZodOptional<z.ZodNumber>;
519
551
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
552
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
553
+ asset: z.ZodEffects<z.ZodString, string, string>;
554
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
555
+ value: z.ZodString;
556
+ decimals: z.ZodNumber;
557
+ }, "strip", z.ZodTypeAny, {
558
+ value: string;
559
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
560
+ asset: string;
561
+ decimals: number;
562
+ }, {
563
+ value: string;
564
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
565
+ asset: string;
566
+ decimals: number;
567
+ }>, "many">>;
520
568
  }, z.ZodTypeAny, "passthrough">>;
521
569
  /** OzAdapterConfig - the per-network OZ built-in instance addresses. */
522
570
  export declare const OzAdapterConfigSchema: z.ZodObject<{
@@ -1126,18 +1174,66 @@ export declare const SynthesizePolicyRecordingInputSchema: z.ZodObject<{
1126
1174
  limitAmount: z.ZodOptional<z.ZodString>;
1127
1175
  invocationLimit: z.ZodOptional<z.ZodNumber>;
1128
1176
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
1177
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
1178
+ asset: z.ZodEffects<z.ZodString, string, string>;
1179
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
1180
+ value: z.ZodString;
1181
+ decimals: z.ZodNumber;
1182
+ }, "strip", z.ZodTypeAny, {
1183
+ value: string;
1184
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1185
+ asset: string;
1186
+ decimals: number;
1187
+ }, {
1188
+ value: string;
1189
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1190
+ asset: string;
1191
+ decimals: number;
1192
+ }>, "many">>;
1129
1193
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1130
1194
  windowSeconds: z.ZodOptional<z.ZodNumber>;
1131
1195
  validUntilLedger: z.ZodOptional<z.ZodNumber>;
1132
1196
  limitAmount: z.ZodOptional<z.ZodString>;
1133
1197
  invocationLimit: z.ZodOptional<z.ZodNumber>;
1134
1198
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
1199
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
1200
+ asset: z.ZodEffects<z.ZodString, string, string>;
1201
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
1202
+ value: z.ZodString;
1203
+ decimals: z.ZodNumber;
1204
+ }, "strip", z.ZodTypeAny, {
1205
+ value: string;
1206
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1207
+ asset: string;
1208
+ decimals: number;
1209
+ }, {
1210
+ value: string;
1211
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1212
+ asset: string;
1213
+ decimals: number;
1214
+ }>, "many">>;
1135
1215
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1136
1216
  windowSeconds: z.ZodOptional<z.ZodNumber>;
1137
1217
  validUntilLedger: z.ZodOptional<z.ZodNumber>;
1138
1218
  limitAmount: z.ZodOptional<z.ZodString>;
1139
1219
  invocationLimit: z.ZodOptional<z.ZodNumber>;
1140
1220
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
1221
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
1222
+ asset: z.ZodEffects<z.ZodString, string, string>;
1223
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
1224
+ value: z.ZodString;
1225
+ decimals: z.ZodNumber;
1226
+ }, "strip", z.ZodTypeAny, {
1227
+ value: string;
1228
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1229
+ asset: string;
1230
+ decimals: number;
1231
+ }, {
1232
+ value: string;
1233
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1234
+ asset: string;
1235
+ decimals: number;
1236
+ }>, "many">>;
1141
1237
  }, z.ZodTypeAny, "passthrough">>>;
1142
1238
  confidenceOverride: z.ZodOptional<z.ZodObject<{
1143
1239
  threshold: z.ZodNumber;
@@ -1257,6 +1353,22 @@ export declare const SynthesizePolicyRecordingInputSchema: z.ZodObject<{
1257
1353
  limitAmount: z.ZodOptional<z.ZodString>;
1258
1354
  invocationLimit: z.ZodOptional<z.ZodNumber>;
1259
1355
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
1356
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
1357
+ asset: z.ZodEffects<z.ZodString, string, string>;
1358
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
1359
+ value: z.ZodString;
1360
+ decimals: z.ZodNumber;
1361
+ }, "strip", z.ZodTypeAny, {
1362
+ value: string;
1363
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1364
+ asset: string;
1365
+ decimals: number;
1366
+ }, {
1367
+ value: string;
1368
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1369
+ asset: string;
1370
+ decimals: number;
1371
+ }>, "many">>;
1260
1372
  }, z.ZodTypeAny, "passthrough"> | undefined;
1261
1373
  confidenceOverride?: {
1262
1374
  threshold: number;
@@ -1322,6 +1434,22 @@ export declare const SynthesizePolicyRecordingInputSchema: z.ZodObject<{
1322
1434
  limitAmount: z.ZodOptional<z.ZodString>;
1323
1435
  invocationLimit: z.ZodOptional<z.ZodNumber>;
1324
1436
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
1437
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
1438
+ asset: z.ZodEffects<z.ZodString, string, string>;
1439
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
1440
+ value: z.ZodString;
1441
+ decimals: z.ZodNumber;
1442
+ }, "strip", z.ZodTypeAny, {
1443
+ value: string;
1444
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1445
+ asset: string;
1446
+ decimals: number;
1447
+ }, {
1448
+ value: string;
1449
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1450
+ asset: string;
1451
+ decimals: number;
1452
+ }>, "many">>;
1325
1453
  }, z.ZodTypeAny, "passthrough"> | undefined;
1326
1454
  confidenceOverride?: {
1327
1455
  threshold: number;
@@ -1841,18 +1969,66 @@ export declare const SynthesizePolicyInputSchema: z.ZodDiscriminatedUnion<"sourc
1841
1969
  limitAmount: z.ZodOptional<z.ZodString>;
1842
1970
  invocationLimit: z.ZodOptional<z.ZodNumber>;
1843
1971
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
1972
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
1973
+ asset: z.ZodEffects<z.ZodString, string, string>;
1974
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
1975
+ value: z.ZodString;
1976
+ decimals: z.ZodNumber;
1977
+ }, "strip", z.ZodTypeAny, {
1978
+ value: string;
1979
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1980
+ asset: string;
1981
+ decimals: number;
1982
+ }, {
1983
+ value: string;
1984
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
1985
+ asset: string;
1986
+ decimals: number;
1987
+ }>, "many">>;
1844
1988
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1845
1989
  windowSeconds: z.ZodOptional<z.ZodNumber>;
1846
1990
  validUntilLedger: z.ZodOptional<z.ZodNumber>;
1847
1991
  limitAmount: z.ZodOptional<z.ZodString>;
1848
1992
  invocationLimit: z.ZodOptional<z.ZodNumber>;
1849
1993
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
1994
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
1995
+ asset: z.ZodEffects<z.ZodString, string, string>;
1996
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
1997
+ value: z.ZodString;
1998
+ decimals: z.ZodNumber;
1999
+ }, "strip", z.ZodTypeAny, {
2000
+ value: string;
2001
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
2002
+ asset: string;
2003
+ decimals: number;
2004
+ }, {
2005
+ value: string;
2006
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
2007
+ asset: string;
2008
+ decimals: number;
2009
+ }>, "many">>;
1850
2010
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1851
2011
  windowSeconds: z.ZodOptional<z.ZodNumber>;
1852
2012
  validUntilLedger: z.ZodOptional<z.ZodNumber>;
1853
2013
  limitAmount: z.ZodOptional<z.ZodString>;
1854
2014
  invocationLimit: z.ZodOptional<z.ZodNumber>;
1855
2015
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
2016
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
2017
+ asset: z.ZodEffects<z.ZodString, string, string>;
2018
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
2019
+ value: z.ZodString;
2020
+ decimals: z.ZodNumber;
2021
+ }, "strip", z.ZodTypeAny, {
2022
+ value: string;
2023
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
2024
+ asset: string;
2025
+ decimals: number;
2026
+ }, {
2027
+ value: string;
2028
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
2029
+ asset: string;
2030
+ decimals: number;
2031
+ }>, "many">>;
1856
2032
  }, z.ZodTypeAny, "passthrough">>>;
1857
2033
  confidenceOverride: z.ZodOptional<z.ZodObject<{
1858
2034
  threshold: z.ZodNumber;
@@ -1972,6 +2148,22 @@ export declare const SynthesizePolicyInputSchema: z.ZodDiscriminatedUnion<"sourc
1972
2148
  limitAmount: z.ZodOptional<z.ZodString>;
1973
2149
  invocationLimit: z.ZodOptional<z.ZodNumber>;
1974
2150
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
2151
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
2152
+ asset: z.ZodEffects<z.ZodString, string, string>;
2153
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
2154
+ value: z.ZodString;
2155
+ decimals: z.ZodNumber;
2156
+ }, "strip", z.ZodTypeAny, {
2157
+ value: string;
2158
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
2159
+ asset: string;
2160
+ decimals: number;
2161
+ }, {
2162
+ value: string;
2163
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
2164
+ asset: string;
2165
+ decimals: number;
2166
+ }>, "many">>;
1975
2167
  }, z.ZodTypeAny, "passthrough"> | undefined;
1976
2168
  confidenceOverride?: {
1977
2169
  threshold: number;
@@ -2037,6 +2229,22 @@ export declare const SynthesizePolicyInputSchema: z.ZodDiscriminatedUnion<"sourc
2037
2229
  limitAmount: z.ZodOptional<z.ZodString>;
2038
2230
  invocationLimit: z.ZodOptional<z.ZodNumber>;
2039
2231
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
2232
+ oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
2233
+ asset: z.ZodEffects<z.ZodString, string, string>;
2234
+ operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
2235
+ value: z.ZodString;
2236
+ decimals: z.ZodNumber;
2237
+ }, "strip", z.ZodTypeAny, {
2238
+ value: string;
2239
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
2240
+ asset: string;
2241
+ decimals: number;
2242
+ }, {
2243
+ value: string;
2244
+ operator: "eq" | "lt" | "lte" | "gt" | "gte";
2245
+ asset: string;
2246
+ decimals: number;
2247
+ }>, "many">>;
2040
2248
  }, z.ZodTypeAny, "passthrough"> | undefined;
2041
2249
  confidenceOverride?: {
2042
2250
  threshold: number;
@@ -2817,15 +3025,24 @@ export declare const VerifyPolicyInputSchema: z.ZodObject<{
2817
3025
  export type VerifyPolicyInput = z.infer<typeof VerifyPolicyInputSchema>;
2818
3026
  /** Pinned interpreter address (testnet).
2819
3027
  * Single source for the MCP layer; do not embed elsewhere. */
2820
- export declare const PINNED_INTERPRETER_TESTNET_ADDRESS = "CDR4NLV22STCXFGZPNKDQTEANWLF7LZ6AJLY6B7CLJXKHDZGYJWIOKGP";
2821
- /** Pinned interpreter address (mainnet). Mainnet
2822
- * has now been deployed (2026-08-04); the mainnet interpreter IS the binary
2823
- * that was exercised on testnet (same wasm sha256, see
2824
- * PINNED_INTERPRETER_WASM_SHA256). The address differs because instance
2825
- * ids are network-scoped. UNAUDITED at the time of writing. */
3028
+ export declare const PINNED_INTERPRETER_TESTNET_ADDRESS = "CALHNU4LXZRKFAXYRBODTGDANTNXHJPBTJNYGLUWLIFIP24NWSGWIE4K";
3029
+ /** Pinned interpreter address (mainnet), deployed 2026-08-04.
3030
+ * UNAUDITED at the time of writing. */
2826
3031
  export declare const PINNED_INTERPRETER_MAINNET_ADDRESS = "CALZAMUPREIRY4TULBEXIK77AUTOEJG63XLCPUWEHHQDOVK6ZVVS7VQ2";
2827
- /** Pinned interpreter wasm sha256 (hex). */
3032
+ /** Pinned interpreter wasm sha256 (hex), mainnet.
3033
+ *
3034
+ * The two networks no longer run the same binary. Testnet carries the
3035
+ * selector-leaf minimum and the signer-set cap; mainnet predates both. Read
3036
+ * the hash through `PINNED_INTERPRETER_WASM_SHA256_BY_NETWORK` rather than
3037
+ * this constant unless mainnet is specifically what is meant, or
3038
+ * `get_interpreter_info` will report a hash the queried network does not
3039
+ * run. */
2828
3040
  export declare const PINNED_INTERPRETER_WASM_SHA256 = "6e6c13d93e197aa380303a42cd120f5ddb080dd36ef2a343ee1dbd04ca52a443";
3041
+ /** Pinned interpreter wasm sha256 (hex), testnet. Byte-identical to the
3042
+ * artifact built from `contracts/policy-interpreter` at the commit that
3043
+ * introduced errors 216 and 217, verified by fetching the deployed wasm back
3044
+ * off chain. */
3045
+ export declare const PINNED_INTERPRETER_WASM_SHA256_TESTNET = "a4d58bc88fd82bbb8e223941ba5889db919717fae92ced13f6f55bfe583b8e22";
2829
3046
  /** The grammar version the interpreter enforces (matches SELF_VERSION in
2830
3047
  * contracts/policy-interpreter/src/version.rs). */
2831
3048
  export declare const PINNED_INTERPRETER_GRAMMAR_VERSION = 1;
@@ -2839,11 +3056,12 @@ export declare const TESTNET_RPC_URL = "https://soroban-testnet.stellar.org";
2839
3056
  * RPC rather than always testnet. Public mainnet endpoint, the same one
2840
3057
  * the deploy script hit during the 2026-08-04 mainnet rollout. */
2841
3058
  export declare const MAINNET_RPC_URL = "https://mainnet.sorobanrpc.com";
2842
- /** Pin + RPC lookup for the gate enforcement. The interpreters' wasm sha256
2843
- * is identical across both networks (the same binary was uploaded both
2844
- * places), so `PINNED_INTERPRETER_WASM_SHA256` stays
2845
- * a single constant - only the addresses and RPCs are network-scoped. */
3059
+ /** Pin + RPC lookup for the gate enforcement. Addresses, RPCs and wasm
3060
+ * hashes are all network-scoped: the networks diverged when the
3061
+ * selector-leaf and signer-cap controls were deployed to testnet ahead of
3062
+ * mainnet. */
2846
3063
  export declare const PINNED_INTERPRETER_ADDRESS_BY_NETWORK: Record<Network, string>;
3064
+ export declare const PINNED_INTERPRETER_WASM_SHA256_BY_NETWORK: Record<Network, string>;
2847
3065
  export declare const RPC_URL_BY_NETWORK: Record<Network, string>;
2848
3066
  /** Soroban `valid_until` window (ledgers) added to the latest ledger when
2849
3067
  * building the auth entry. ~25 minutes at 5s/ledger. */
@@ -3337,6 +3555,17 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
3337
3555
  * everything. Selecting `network: 'mainnet'` is NOT an opt-in -
3338
3556
  * the mainnet pin is its own deny-by-default anchor. */
3339
3557
  allowUnpinnedInterpreter: z.ZodOptional<z.ZodBoolean>;
3558
+ /** Opt-in to installing when a signer of this rule can already reach the
3559
+ * same calls through a context rule that has NO policy attached. OZ lets
3560
+ * the signer choose which rule authorises a call and enforces only that
3561
+ * rule's policies, so an unpoliced rule covering the same calls makes
3562
+ * this policy decorative. Default-deny, because the caller almost
3563
+ * certainly believes they are restricting something. */
3564
+ allowAuthorityOverlap: z.ZodOptional<z.ZodBoolean>;
3565
+ /** Skip the cross-rule authority scan entirely. The scan costs one RPC
3566
+ * read per rule on the account; skipping it means the response carries
3567
+ * no statement about what the signers can already do. */
3568
+ skipAuthorityScan: z.ZodOptional<z.ZodBoolean>;
3340
3569
  /** Base fee in stroops; defaults to BASE_FEE (100). */
3341
3570
  baseFee: z.ZodOptional<z.ZodNumber>;
3342
3571
  }, "strip", z.ZodTypeAny, {
@@ -3382,6 +3611,8 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
3382
3611
  rpcUrl?: string | undefined;
3383
3612
  allowUnpinnedRpcUrl?: boolean | undefined;
3384
3613
  allowUnpinnedInterpreter?: boolean | undefined;
3614
+ allowAuthorityOverlap?: boolean | undefined;
3615
+ skipAuthorityScan?: boolean | undefined;
3385
3616
  baseFee?: number | undefined;
3386
3617
  }, {
3387
3618
  installNonce: number;
@@ -3426,6 +3657,8 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
3426
3657
  rpcUrl?: string | undefined;
3427
3658
  allowUnpinnedRpcUrl?: boolean | undefined;
3428
3659
  allowUnpinnedInterpreter?: boolean | undefined;
3660
+ allowAuthorityOverlap?: boolean | undefined;
3661
+ skipAuthorityScan?: boolean | undefined;
3429
3662
  baseFee?: number | undefined;
3430
3663
  }>, {
3431
3664
  installNonce: number;
@@ -3470,6 +3703,8 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
3470
3703
  rpcUrl?: string | undefined;
3471
3704
  allowUnpinnedRpcUrl?: boolean | undefined;
3472
3705
  allowUnpinnedInterpreter?: boolean | undefined;
3706
+ allowAuthorityOverlap?: boolean | undefined;
3707
+ skipAuthorityScan?: boolean | undefined;
3473
3708
  baseFee?: number | undefined;
3474
3709
  }, {
3475
3710
  installNonce: number;
@@ -3514,9 +3749,53 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
3514
3749
  rpcUrl?: string | undefined;
3515
3750
  allowUnpinnedRpcUrl?: boolean | undefined;
3516
3751
  allowUnpinnedInterpreter?: boolean | undefined;
3752
+ allowAuthorityOverlap?: boolean | undefined;
3753
+ skipAuthorityScan?: boolean | undefined;
3517
3754
  baseFee?: number | undefined;
3518
3755
  }>;
3519
3756
  export type InstallPolicyInput = z.infer<typeof InstallPolicyInputSchema>;
3757
+ /** `merge_policy` input.
3758
+ *
3759
+ * The tightening remedy for a cross-rule overlap: replace a rule's predicate
3760
+ * with the conjunction of it and a new one. Two transactions, in order,
3761
+ * because OZ refuses to re-attach a policy already on the rule - so the
3762
+ * caller runs `detach`, waits for it to confirm, then runs `reinstall`. */
3763
+ export declare const MergePolicyInputSchema: z.ZodObject<{
3764
+ smartAccount: z.ZodString;
3765
+ sourceAccount: z.ZodString;
3766
+ /** The rule whose predicate is being tightened. */
3767
+ ruleId: z.ZodNumber;
3768
+ /** The predicate to conjoin, base64 canonical ScVal, as emitted by
3769
+ * `synthesize_policy`. */
3770
+ incomingPredicateBlobBase64: z.ZodString;
3771
+ /** Which half of the remedy to build. */
3772
+ step: z.ZodEnum<["detach", "reinstall"]>;
3773
+ network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
3774
+ rpcUrl: z.ZodOptional<z.ZodString>;
3775
+ allowUnpinnedRpcUrl: z.ZodOptional<z.ZodBoolean>;
3776
+ baseFee: z.ZodOptional<z.ZodNumber>;
3777
+ }, "strict", z.ZodTypeAny, {
3778
+ smartAccount: string;
3779
+ sourceAccount: string;
3780
+ step: "detach" | "reinstall";
3781
+ ruleId: number;
3782
+ incomingPredicateBlobBase64: string;
3783
+ network?: "mainnet" | "testnet" | undefined;
3784
+ rpcUrl?: string | undefined;
3785
+ allowUnpinnedRpcUrl?: boolean | undefined;
3786
+ baseFee?: number | undefined;
3787
+ }, {
3788
+ smartAccount: string;
3789
+ sourceAccount: string;
3790
+ step: "detach" | "reinstall";
3791
+ ruleId: number;
3792
+ incomingPredicateBlobBase64: string;
3793
+ network?: "mainnet" | "testnet" | undefined;
3794
+ rpcUrl?: string | undefined;
3795
+ allowUnpinnedRpcUrl?: boolean | undefined;
3796
+ baseFee?: number | undefined;
3797
+ }>;
3798
+ export type MergePolicyInput = z.infer<typeof MergePolicyInputSchema>;
3520
3799
  export declare const RevokePolicyInputSchema: z.ZodEffects<z.ZodObject<{
3521
3800
  /** The smart account contract address (C...). */
3522
3801
  smartAccount: z.ZodString;
@@ -155,6 +155,21 @@ export const ComposeUserResponsesSchema = z
155
155
  swapRecipientAllowlist: z
156
156
  .array(z.string().refine(isStellarAddress, 'must be a Stellar address (G... or C...)'))
157
157
  .optional(),
158
+ // Per-asset oracle-price bound, one entry per asset. Reaches
159
+ // `compose-from-recording` and emits an `oracle_price` compare. Declared
160
+ // here because the object is `.passthrough()`: the field already worked
161
+ // undeclared, which left the accepted surface wider than the documented
162
+ // one. `decimals` is REQUIRED - oracle prices normalise to 9 dp and a
163
+ // threshold silently assumed to share that basis is what let a raw 14-dp
164
+ // bound permit everything.
165
+ oraclePriceBound: z
166
+ .array(z.object({
167
+ asset: z.string().refine(isStellarAddress, 'must be a Stellar address (G... or C...)'),
168
+ operator: z.enum(['eq', 'lt', 'lte', 'gt', 'gte']),
169
+ value: z.string().regex(/^[0-9]+$/),
170
+ decimals: z.number().int().min(0).max(U32_MAX),
171
+ }))
172
+ .optional(),
158
173
  })
159
174
  .passthrough();
160
175
  /** OzAdapterConfig - the per-network OZ built-in instance addresses. */
@@ -445,15 +460,24 @@ const MandateSpecSchemaForRule = z
445
460
  // existing four.
446
461
  /** Pinned interpreter address (testnet).
447
462
  * Single source for the MCP layer; do not embed elsewhere. */
448
- export const PINNED_INTERPRETER_TESTNET_ADDRESS = 'CDR4NLV22STCXFGZPNKDQTEANWLF7LZ6AJLY6B7CLJXKHDZGYJWIOKGP';
449
- /** Pinned interpreter address (mainnet). Mainnet
450
- * has now been deployed (2026-08-04); the mainnet interpreter IS the binary
451
- * that was exercised on testnet (same wasm sha256, see
452
- * PINNED_INTERPRETER_WASM_SHA256). The address differs because instance
453
- * ids are network-scoped. UNAUDITED at the time of writing. */
463
+ export const PINNED_INTERPRETER_TESTNET_ADDRESS = 'CALHNU4LXZRKFAXYRBODTGDANTNXHJPBTJNYGLUWLIFIP24NWSGWIE4K';
464
+ /** Pinned interpreter address (mainnet), deployed 2026-08-04.
465
+ * UNAUDITED at the time of writing. */
454
466
  export const PINNED_INTERPRETER_MAINNET_ADDRESS = 'CALZAMUPREIRY4TULBEXIK77AUTOEJG63XLCPUWEHHQDOVK6ZVVS7VQ2';
455
- /** Pinned interpreter wasm sha256 (hex). */
467
+ /** Pinned interpreter wasm sha256 (hex), mainnet.
468
+ *
469
+ * The two networks no longer run the same binary. Testnet carries the
470
+ * selector-leaf minimum and the signer-set cap; mainnet predates both. Read
471
+ * the hash through `PINNED_INTERPRETER_WASM_SHA256_BY_NETWORK` rather than
472
+ * this constant unless mainnet is specifically what is meant, or
473
+ * `get_interpreter_info` will report a hash the queried network does not
474
+ * run. */
456
475
  export const PINNED_INTERPRETER_WASM_SHA256 = '6e6c13d93e197aa380303a42cd120f5ddb080dd36ef2a343ee1dbd04ca52a443';
476
+ /** Pinned interpreter wasm sha256 (hex), testnet. Byte-identical to the
477
+ * artifact built from `contracts/policy-interpreter` at the commit that
478
+ * introduced errors 216 and 217, verified by fetching the deployed wasm back
479
+ * off chain. */
480
+ export const PINNED_INTERPRETER_WASM_SHA256_TESTNET = 'a4d58bc88fd82bbb8e223941ba5889db919717fae92ced13f6f55bfe583b8e22';
457
481
  /** The grammar version the interpreter enforces (matches SELF_VERSION in
458
482
  * contracts/policy-interpreter/src/version.rs). */
459
483
  export const PINNED_INTERPRETER_GRAMMAR_VERSION = 1;
@@ -467,14 +491,18 @@ export const TESTNET_RPC_URL = 'https://soroban-testnet.stellar.org';
467
491
  * RPC rather than always testnet. Public mainnet endpoint, the same one
468
492
  * the deploy script hit during the 2026-08-04 mainnet rollout. */
469
493
  export const MAINNET_RPC_URL = 'https://mainnet.sorobanrpc.com';
470
- /** Pin + RPC lookup for the gate enforcement. The interpreters' wasm sha256
471
- * is identical across both networks (the same binary was uploaded both
472
- * places), so `PINNED_INTERPRETER_WASM_SHA256` stays
473
- * a single constant - only the addresses and RPCs are network-scoped. */
494
+ /** Pin + RPC lookup for the gate enforcement. Addresses, RPCs and wasm
495
+ * hashes are all network-scoped: the networks diverged when the
496
+ * selector-leaf and signer-cap controls were deployed to testnet ahead of
497
+ * mainnet. */
474
498
  export const PINNED_INTERPRETER_ADDRESS_BY_NETWORK = {
475
499
  testnet: PINNED_INTERPRETER_TESTNET_ADDRESS,
476
500
  mainnet: PINNED_INTERPRETER_MAINNET_ADDRESS,
477
501
  };
502
+ export const PINNED_INTERPRETER_WASM_SHA256_BY_NETWORK = {
503
+ testnet: PINNED_INTERPRETER_WASM_SHA256_TESTNET,
504
+ mainnet: PINNED_INTERPRETER_WASM_SHA256,
505
+ };
478
506
  export const RPC_URL_BY_NETWORK = {
479
507
  testnet: TESTNET_RPC_URL,
480
508
  mainnet: MAINNET_RPC_URL,
@@ -538,12 +566,50 @@ export const InstallPolicyInputSchema = z
538
566
  * everything. Selecting `network: 'mainnet'` is NOT an opt-in -
539
567
  * the mainnet pin is its own deny-by-default anchor. */
540
568
  allowUnpinnedInterpreter: z.boolean().optional(),
569
+ /** Opt-in to installing when a signer of this rule can already reach the
570
+ * same calls through a context rule that has NO policy attached. OZ lets
571
+ * the signer choose which rule authorises a call and enforces only that
572
+ * rule's policies, so an unpoliced rule covering the same calls makes
573
+ * this policy decorative. Default-deny, because the caller almost
574
+ * certainly believes they are restricting something. */
575
+ allowAuthorityOverlap: z.boolean().optional(),
576
+ /** Skip the cross-rule authority scan entirely. The scan costs one RPC
577
+ * read per rule on the account; skipping it means the response carries
578
+ * no statement about what the signers can already do. */
579
+ skipAuthorityScan: z.boolean().optional(),
541
580
  /** Base fee in stroops; defaults to BASE_FEE (100). */
542
581
  baseFee: z.number().int().positive().optional(),
543
582
  })
544
583
  .refine((v) => Boolean(v.smartAccount) && Boolean(v.sourceAccount), {
545
584
  message: 'smartAccount and sourceAccount are required',
546
585
  });
586
+ /** `merge_policy` input.
587
+ *
588
+ * The tightening remedy for a cross-rule overlap: replace a rule's predicate
589
+ * with the conjunction of it and a new one. Two transactions, in order,
590
+ * because OZ refuses to re-attach a policy already on the rule - so the
591
+ * caller runs `detach`, waits for it to confirm, then runs `reinstall`. */
592
+ export const MergePolicyInputSchema = z
593
+ .object({
594
+ smartAccount: z
595
+ .string()
596
+ .regex(STELLAR_CONTRACT_ADDRESS, 'smartAccount must be a Stellar contract address (C...)'),
597
+ sourceAccount: z
598
+ .string()
599
+ .regex(STELLAR_ACCOUNT_ADDRESS, 'sourceAccount must be a Stellar account address (G...)'),
600
+ /** The rule whose predicate is being tightened. */
601
+ ruleId: z.number().int().nonnegative(),
602
+ /** The predicate to conjoin, base64 canonical ScVal, as emitted by
603
+ * `synthesize_policy`. */
604
+ incomingPredicateBlobBase64: z.string().min(1),
605
+ /** Which half of the remedy to build. */
606
+ step: z.enum(['detach', 'reinstall']),
607
+ network: NetworkSchema.optional(),
608
+ rpcUrl: z.string().url().optional(),
609
+ allowUnpinnedRpcUrl: z.boolean().optional(),
610
+ baseFee: z.number().int().positive().optional(),
611
+ })
612
+ .strict();
547
613
  export const RevokePolicyInputSchema = z
548
614
  .object({
549
615
  /** The smart account contract address (C...). */