@crediolabs/policy-builder-mcp 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @crediolabs/policy-builder-mcp
2
2
 
3
- MCP server exposing the OctoGate policy toolchain to agents. It wraps
3
+ MCP server exposing the OZ Policy Builder toolchain to agents. It wraps
4
4
  [`@crediolabs/policy-synth`](https://www.npmjs.com/package/@crediolabs/policy-synth):
5
5
  an agent records a Soroban transaction, synthesises the minimal policy that
6
6
  permits exactly that flow, verifies and simulates it, and receives an
@@ -55,9 +55,9 @@ branch on them.
55
55
  embedding caller explicitly opts out (`allowExternalHost: true` via the
56
56
  programmatic API), because the surface is unauthenticated by design.
57
57
  - See the
58
- [architecture document](https://github.com/untangledfinance/octogate/blob/main/docs/architecture.md)
58
+ [architecture document](https://github.com/untangledfinance/oz-policy-builder/blob/main/docs/architecture.md)
59
59
  for what the on-chain interpreter does and does not enforce, and the
60
- [repository README](https://github.com/untangledfinance/octogate#readme)
60
+ [repository README](https://github.com/untangledfinance/oz-policy-builder#readme)
61
61
  for the contracts' audit status.
62
62
 
63
63
  ## License
@@ -1,6 +1,6 @@
1
- import { ComposeUserResponsesSchema, GetInterpreterInfoInputSchema, InstallPolicyInputSchema, InterpreterOptionsSchema, MandateSpecSchema, NetworkSchema, OraclePriceFixtureSchema, OzAdapterConfigSchema, PredicateNodeSchema, RecordedTransactionSchema, RecordTransactionInputSchema, RevokePolicyInputSchema, SimulatePolicyInputSchema, SynthesizePolicyInputSchema, ToolErrorSchema, VerifyPolicyInputSchema } from '@crediolabs/policy-synth/run';
1
+ import { ComposeUserResponsesSchema, GetInterpreterInfoInputSchema, InstallPolicyInputSchema, InterpreterOptionsSchema, NetworkSchema, PredicateNodeSchema, RecordedTransactionSchema, RecordTransactionInputSchema, RevokePolicyInputSchema, SynthesizePolicyInputSchema, ToolErrorSchema } from '@crediolabs/policy-synth/run';
2
2
  import { z } from 'zod';
3
- export { ComposeUserResponsesSchema, GetInterpreterInfoInputSchema, InstallPolicyInputSchema, InterpreterOptionsSchema, MandateSpecSchema, NetworkSchema, OraclePriceFixtureSchema, OzAdapterConfigSchema, PredicateNodeSchema, RecordedTransactionSchema, RecordTransactionInputSchema, RevokePolicyInputSchema, SimulatePolicyInputSchema, SynthesizePolicyInputSchema, ToolErrorSchema, VerifyPolicyInputSchema, };
3
+ export { ComposeUserResponsesSchema, GetInterpreterInfoInputSchema, InstallPolicyInputSchema, InterpreterOptionsSchema, NetworkSchema, PredicateNodeSchema, RecordedTransactionSchema, RecordTransactionInputSchema, RevokePolicyInputSchema, SynthesizePolicyInputSchema, ToolErrorSchema, };
4
4
  /** Flat ZodRawShape used for the MCP SDK tool registration. The body
5
5
  * re-validates against `RecordTransactionInputSchema` so the mutual-exclusion
6
6
  * rule still fires (the SDK does not invoke `.refine()` at registration time). */
@@ -11,156 +11,10 @@ export declare const RecordTransactionToolShape: {
11
11
  readonly confidenceOverride: z.ZodOptional<z.ZodNumber>;
12
12
  };
13
13
  /** Flat ZodRawShape used for MCP tool registration. Every field is optional
14
- * so the JSON-Schema the SDK exposes to clients does not forbid either
15
- * front-end; the body re-validates against the discriminated union. */
14
+ * so the JSON-Schema the SDK exposes to clients stays permissive; the body
15
+ * re-validates against the strict schema. */
16
16
  export declare const SynthesizePolicyToolShape: {
17
- readonly source: z.ZodOptional<z.ZodEnum<["mandate", "recording"]>>;
18
- readonly mandate: z.ZodOptional<z.ZodEffects<z.ZodObject<{
19
- chain: z.ZodLiteral<"stellar">;
20
- contract: z.ZodString;
21
- method: z.ZodOptional<z.ZodString>;
22
- spendingLimit: z.ZodOptional<z.ZodObject<{
23
- token: z.ZodString;
24
- limit: z.ZodString;
25
- windowSeconds: z.ZodNumber;
26
- }, "strip", z.ZodTypeAny, {
27
- token: string;
28
- limit: string;
29
- windowSeconds: number;
30
- }, {
31
- token: string;
32
- limit: string;
33
- windowSeconds: number;
34
- }>>;
35
- approvalThreshold: z.ZodOptional<z.ZodNumber>;
36
- recipients: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
37
- expiry: z.ZodOptional<z.ZodObject<{
38
- validUntilLedger: z.ZodOptional<z.ZodNumber>;
39
- validUntilUnixSeconds: z.ZodOptional<z.ZodNumber>;
40
- }, "strip", z.ZodTypeAny, {
41
- validUntilLedger?: number | undefined;
42
- validUntilUnixSeconds?: number | undefined;
43
- }, {
44
- validUntilLedger?: number | undefined;
45
- validUntilUnixSeconds?: number | undefined;
46
- }>>;
47
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
48
- chain: z.ZodLiteral<"stellar">;
49
- contract: z.ZodString;
50
- method: z.ZodOptional<z.ZodString>;
51
- spendingLimit: z.ZodOptional<z.ZodObject<{
52
- token: z.ZodString;
53
- limit: z.ZodString;
54
- windowSeconds: z.ZodNumber;
55
- }, "strip", z.ZodTypeAny, {
56
- token: string;
57
- limit: string;
58
- windowSeconds: number;
59
- }, {
60
- token: string;
61
- limit: string;
62
- windowSeconds: number;
63
- }>>;
64
- approvalThreshold: z.ZodOptional<z.ZodNumber>;
65
- recipients: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
66
- expiry: z.ZodOptional<z.ZodObject<{
67
- validUntilLedger: z.ZodOptional<z.ZodNumber>;
68
- validUntilUnixSeconds: z.ZodOptional<z.ZodNumber>;
69
- }, "strip", z.ZodTypeAny, {
70
- validUntilLedger?: number | undefined;
71
- validUntilUnixSeconds?: number | undefined;
72
- }, {
73
- validUntilLedger?: number | undefined;
74
- validUntilUnixSeconds?: number | undefined;
75
- }>>;
76
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
77
- chain: z.ZodLiteral<"stellar">;
78
- contract: z.ZodString;
79
- method: z.ZodOptional<z.ZodString>;
80
- spendingLimit: z.ZodOptional<z.ZodObject<{
81
- token: z.ZodString;
82
- limit: z.ZodString;
83
- windowSeconds: z.ZodNumber;
84
- }, "strip", z.ZodTypeAny, {
85
- token: string;
86
- limit: string;
87
- windowSeconds: number;
88
- }, {
89
- token: string;
90
- limit: string;
91
- windowSeconds: number;
92
- }>>;
93
- approvalThreshold: z.ZodOptional<z.ZodNumber>;
94
- recipients: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
95
- expiry: z.ZodOptional<z.ZodObject<{
96
- validUntilLedger: z.ZodOptional<z.ZodNumber>;
97
- validUntilUnixSeconds: z.ZodOptional<z.ZodNumber>;
98
- }, "strip", z.ZodTypeAny, {
99
- validUntilLedger?: number | undefined;
100
- validUntilUnixSeconds?: number | undefined;
101
- }, {
102
- validUntilLedger?: number | undefined;
103
- validUntilUnixSeconds?: number | undefined;
104
- }>>;
105
- }, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
106
- chain: z.ZodLiteral<"stellar">;
107
- contract: z.ZodString;
108
- method: z.ZodOptional<z.ZodString>;
109
- spendingLimit: z.ZodOptional<z.ZodObject<{
110
- token: z.ZodString;
111
- limit: z.ZodString;
112
- windowSeconds: z.ZodNumber;
113
- }, "strip", z.ZodTypeAny, {
114
- token: string;
115
- limit: string;
116
- windowSeconds: number;
117
- }, {
118
- token: string;
119
- limit: string;
120
- windowSeconds: number;
121
- }>>;
122
- approvalThreshold: z.ZodOptional<z.ZodNumber>;
123
- recipients: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
124
- expiry: z.ZodOptional<z.ZodObject<{
125
- validUntilLedger: z.ZodOptional<z.ZodNumber>;
126
- validUntilUnixSeconds: z.ZodOptional<z.ZodNumber>;
127
- }, "strip", z.ZodTypeAny, {
128
- validUntilLedger?: number | undefined;
129
- validUntilUnixSeconds?: number | undefined;
130
- }, {
131
- validUntilLedger?: number | undefined;
132
- validUntilUnixSeconds?: number | undefined;
133
- }>>;
134
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
135
- chain: z.ZodLiteral<"stellar">;
136
- contract: z.ZodString;
137
- method: z.ZodOptional<z.ZodString>;
138
- spendingLimit: z.ZodOptional<z.ZodObject<{
139
- token: z.ZodString;
140
- limit: z.ZodString;
141
- windowSeconds: z.ZodNumber;
142
- }, "strip", z.ZodTypeAny, {
143
- token: string;
144
- limit: string;
145
- windowSeconds: number;
146
- }, {
147
- token: string;
148
- limit: string;
149
- windowSeconds: number;
150
- }>>;
151
- approvalThreshold: z.ZodOptional<z.ZodNumber>;
152
- recipients: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
153
- expiry: z.ZodOptional<z.ZodObject<{
154
- validUntilLedger: z.ZodOptional<z.ZodNumber>;
155
- validUntilUnixSeconds: z.ZodOptional<z.ZodNumber>;
156
- }, "strip", z.ZodTypeAny, {
157
- validUntilLedger?: number | undefined;
158
- validUntilUnixSeconds?: number | undefined;
159
- }, {
160
- validUntilLedger?: number | undefined;
161
- validUntilUnixSeconds?: number | undefined;
162
- }>>;
163
- }, z.ZodTypeAny, "passthrough">>>;
17
+ readonly source: z.ZodOptional<z.ZodLiteral<"recording">>;
164
18
  readonly recordedTx: z.ZodOptional<z.ZodObject<{
165
19
  network: z.ZodEnum<["mainnet", "testnet"]>;
166
20
  signers: z.ZodArray<z.ZodString, "many">;
@@ -171,15 +25,15 @@ export declare const SynthesizePolicyToolShape: {
171
25
  to: z.ZodString;
172
26
  amount: z.ZodString;
173
27
  }, "strip", z.ZodTypeAny, {
174
- amount: string;
175
- token: string;
176
28
  from: string;
177
29
  to: string;
178
- }, {
179
30
  amount: string;
180
31
  token: string;
32
+ }, {
181
33
  from: string;
182
34
  to: string;
35
+ amount: string;
36
+ token: string;
183
37
  }>, "many">;
184
38
  events: z.ZodArray<z.ZodObject<{
185
39
  contract: z.ZodString;
@@ -257,15 +111,15 @@ export declare const SynthesizePolicyToolShape: {
257
111
  to: z.ZodString;
258
112
  amount: z.ZodString;
259
113
  }, "strip", z.ZodTypeAny, {
260
- amount: string;
261
- token: string;
262
114
  from: string;
263
115
  to: string;
264
- }, {
265
116
  amount: string;
266
117
  token: string;
118
+ }, {
267
119
  from: string;
268
120
  to: string;
121
+ amount: string;
122
+ token: string;
269
123
  }>, "many">;
270
124
  events: z.ZodArray<z.ZodObject<{
271
125
  contract: z.ZodString;
@@ -343,15 +197,15 @@ export declare const SynthesizePolicyToolShape: {
343
197
  to: z.ZodString;
344
198
  amount: z.ZodString;
345
199
  }, "strip", z.ZodTypeAny, {
346
- amount: string;
347
- token: string;
348
200
  from: string;
349
201
  to: string;
350
- }, {
351
202
  amount: string;
352
203
  token: string;
204
+ }, {
353
205
  from: string;
354
206
  to: string;
207
+ amount: string;
208
+ token: string;
355
209
  }>, "many">;
356
210
  events: z.ZodArray<z.ZodObject<{
357
211
  contract: z.ZodString;
@@ -422,72 +276,18 @@ export declare const SynthesizePolicyToolShape: {
422
276
  }, z.ZodTypeAny, "passthrough">>>;
423
277
  readonly network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
424
278
  readonly userResponses: z.ZodOptional<z.ZodObject<{
425
- windowSeconds: z.ZodOptional<z.ZodNumber>;
426
- validUntilLedger: z.ZodOptional<z.ZodNumber>;
427
- limitAmount: z.ZodOptional<z.ZodString>;
428
- invocationLimit: z.ZodOptional<z.ZodNumber>;
429
- swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
430
- oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
431
- asset: z.ZodEffects<z.ZodString, string, string>;
432
- operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
433
- value: z.ZodString;
434
- decimals: z.ZodNumber;
435
- }, "strip", z.ZodTypeAny, {
436
- value: string;
437
- operator: "eq" | "lt" | "lte" | "gt" | "gte";
438
- asset: string;
439
- decimals: number;
440
- }, {
441
- value: string;
442
- operator: "eq" | "lt" | "lte" | "gt" | "gte";
443
- asset: string;
444
- decimals: number;
445
- }>, "many">>;
446
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
447
- windowSeconds: z.ZodOptional<z.ZodNumber>;
448
- validUntilLedger: z.ZodOptional<z.ZodNumber>;
449
- limitAmount: z.ZodOptional<z.ZodString>;
450
- invocationLimit: z.ZodOptional<z.ZodNumber>;
451
- swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
452
- oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
453
- asset: z.ZodEffects<z.ZodString, string, string>;
454
- operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
455
- value: z.ZodString;
456
- decimals: z.ZodNumber;
457
- }, "strip", z.ZodTypeAny, {
458
- value: string;
459
- operator: "eq" | "lt" | "lte" | "gt" | "gte";
460
- asset: string;
461
- decimals: number;
462
- }, {
463
- value: string;
464
- operator: "eq" | "lt" | "lte" | "gt" | "gte";
465
- asset: string;
466
- decimals: number;
467
- }>, "many">>;
468
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
469
- windowSeconds: z.ZodOptional<z.ZodNumber>;
470
279
  validUntilLedger: z.ZodOptional<z.ZodNumber>;
471
280
  limitAmount: z.ZodOptional<z.ZodString>;
472
- invocationLimit: z.ZodOptional<z.ZodNumber>;
473
281
  swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
474
- oraclePriceBound: z.ZodOptional<z.ZodArray<z.ZodObject<{
475
- asset: z.ZodEffects<z.ZodString, string, string>;
476
- operator: z.ZodEnum<["eq", "lt", "lte", "gt", "gte"]>;
477
- value: z.ZodString;
478
- decimals: z.ZodNumber;
479
- }, "strip", z.ZodTypeAny, {
480
- value: string;
481
- operator: "eq" | "lt" | "lte" | "gt" | "gte";
482
- asset: string;
483
- decimals: number;
484
- }, {
485
- value: string;
486
- operator: "eq" | "lt" | "lte" | "gt" | "gte";
487
- asset: string;
488
- decimals: number;
489
- }>, "many">>;
490
- }, z.ZodTypeAny, "passthrough">>>;
282
+ }, "strict", z.ZodTypeAny, {
283
+ limitAmount?: string | undefined;
284
+ validUntilLedger?: number | undefined;
285
+ swapRecipientAllowlist?: string[] | undefined;
286
+ }, {
287
+ limitAmount?: string | undefined;
288
+ validUntilLedger?: number | undefined;
289
+ swapRecipientAllowlist?: string[] | undefined;
290
+ }>>;
491
291
  readonly confidenceOverride: z.ZodOptional<z.ZodObject<{
492
292
  threshold: z.ZodNumber;
493
293
  }, "strip", z.ZodTypeAny, {
@@ -498,73 +298,17 @@ export declare const SynthesizePolicyToolShape: {
498
298
  readonly interpreter: z.ZodOptional<z.ZodObject<{
499
299
  smartAccountAddress: z.ZodString;
500
300
  installNonce: z.ZodOptional<z.ZodNumber>;
501
- oracleParams: z.ZodOptional<z.ZodObject<{
502
- maxStalenessSeconds: z.ZodOptional<z.ZodNumber>;
503
- maxDeviationBps: z.ZodOptional<z.ZodNumber>;
504
- }, "strip", z.ZodTypeAny, {
505
- maxStalenessSeconds?: number | undefined;
506
- maxDeviationBps?: number | undefined;
507
- }, {
508
- maxStalenessSeconds?: number | undefined;
509
- maxDeviationBps?: number | undefined;
510
- }>>;
511
301
  }, "strip", z.ZodTypeAny, {
512
302
  smartAccountAddress: string;
513
- oracleParams?: {
514
- maxStalenessSeconds?: number | undefined;
515
- maxDeviationBps?: number | undefined;
516
- } | undefined;
517
303
  installNonce?: number | undefined;
518
304
  }, {
519
305
  smartAccountAddress: string;
520
- oracleParams?: {
521
- maxStalenessSeconds?: number | undefined;
522
- maxDeviationBps?: number | undefined;
523
- } | undefined;
524
306
  installNonce?: number | undefined;
525
307
  }>>;
526
- readonly ozConfig: z.ZodOptional<z.ZodObject<{
527
- network: z.ZodEnum<["mainnet", "testnet"]>;
528
- instances: z.ZodObject<{
529
- spending_limit: z.ZodString;
530
- simple_threshold: z.ZodString;
531
- weighted_threshold: z.ZodString;
532
- }, "strip", z.ZodTypeAny, {
533
- spending_limit: string;
534
- simple_threshold: string;
535
- weighted_threshold: string;
536
- }, {
537
- spending_limit: string;
538
- simple_threshold: string;
539
- weighted_threshold: string;
540
- }>;
541
- }, "strip", z.ZodTypeAny, {
542
- network: "mainnet" | "testnet";
543
- instances: {
544
- spending_limit: string;
545
- simple_threshold: string;
546
- weighted_threshold: string;
547
- };
548
- }, {
549
- network: "mainnet" | "testnet";
550
- instances: {
551
- spending_limit: string;
552
- simple_threshold: string;
553
- weighted_threshold: string;
554
- };
555
- }>>;
556
308
  readonly explain: z.ZodOptional<z.ZodBoolean>;
557
309
  };
558
- /** Flat ZodRawShape for `simulate_policy`. The `predicate` is typed as
559
- * `z.unknown()` at the tool boundary because the recursive
560
- * `PredicateNodeSchema` is a `z.lazy()` union (the SDK does not accept
561
- * unions at the tool-registration boundary); the body re-validates
562
- * against `SimulatePolicyInputSchema`, which fails closed on a
563
- * malformed predicate. `predicate` is nullable here (vs required for
564
- * verify_policy) so the SDK-emitted JSON Schema mirrors the engine's
565
- * "OZ-only / no interpreter predicate" contract. */
566
310
  export declare const SimulatePolicyToolShape: {
567
- readonly predicate: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
311
+ readonly predicate: z.ZodType<unknown, z.ZodTypeDef, unknown>;
568
312
  readonly permitTx: z.ZodObject<{
569
313
  network: z.ZodEnum<["mainnet", "testnet"]>;
570
314
  signers: z.ZodArray<z.ZodString, "many">;
@@ -575,15 +319,15 @@ export declare const SimulatePolicyToolShape: {
575
319
  to: z.ZodString;
576
320
  amount: z.ZodString;
577
321
  }, "strip", z.ZodTypeAny, {
578
- amount: string;
579
- token: string;
580
322
  from: string;
581
323
  to: string;
582
- }, {
583
324
  amount: string;
584
325
  token: string;
326
+ }, {
585
327
  from: string;
586
328
  to: string;
329
+ amount: string;
330
+ token: string;
587
331
  }>, "many">;
588
332
  events: z.ZodArray<z.ZodObject<{
589
333
  contract: z.ZodString;
@@ -661,15 +405,15 @@ export declare const SimulatePolicyToolShape: {
661
405
  to: z.ZodString;
662
406
  amount: z.ZodString;
663
407
  }, "strip", z.ZodTypeAny, {
664
- amount: string;
665
- token: string;
666
408
  from: string;
667
409
  to: string;
668
- }, {
669
410
  amount: string;
670
411
  token: string;
412
+ }, {
671
413
  from: string;
672
414
  to: string;
415
+ amount: string;
416
+ token: string;
673
417
  }>, "many">;
674
418
  events: z.ZodArray<z.ZodObject<{
675
419
  contract: z.ZodString;
@@ -747,15 +491,15 @@ export declare const SimulatePolicyToolShape: {
747
491
  to: z.ZodString;
748
492
  amount: z.ZodString;
749
493
  }, "strip", z.ZodTypeAny, {
750
- amount: string;
751
- token: string;
752
494
  from: string;
753
495
  to: string;
754
- }, {
755
496
  amount: string;
756
497
  token: string;
498
+ }, {
757
499
  from: string;
758
500
  to: string;
501
+ amount: string;
502
+ token: string;
759
503
  }>, "many">;
760
504
  events: z.ZodArray<z.ZodObject<{
761
505
  contract: z.ZodString;
@@ -825,29 +569,9 @@ export declare const SimulatePolicyToolShape: {
825
569
  sourceAccount: z.ZodString;
826
570
  }, z.ZodTypeAny, "passthrough">>;
827
571
  readonly validUntilLedger: z.ZodOptional<z.ZodNumber>;
828
- readonly oraclePricesByAsset: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
829
- price: z.ZodString;
830
- timestampSeconds: z.ZodNumber;
831
- }, "strip", z.ZodTypeAny, {
832
- price: string;
833
- timestampSeconds: number;
834
- }, {
835
- price: string;
836
- timestampSeconds: number;
837
- }>, z.ZodObject<{
838
- error: z.ZodEnum<["stale", "missing", "deviation", "paused", "decimals", "fingerprint"]>;
839
- }, "strip", z.ZodTypeAny, {
840
- error: "stale" | "missing" | "deviation" | "paused" | "decimals" | "fingerprint";
841
- }, {
842
- error: "stale" | "missing" | "deviation" | "paused" | "decimals" | "fingerprint";
843
- }>]>>>;
844
572
  };
845
- /** Flat ZodRawShape for `verify_policy`. Same `z.unknown()` boundary
846
- * trick for `predicate` as `SimulatePolicyToolShape`; `predicate` is
847
- * required at the strict-schema level (`VerifyPolicyInputSchema`) so
848
- * the body fails closed on a missing predicate. */
849
573
  export declare const VerifyPolicyToolShape: {
850
- readonly predicate: z.ZodUnknown;
574
+ readonly predicate: z.ZodType<unknown, z.ZodTypeDef, unknown>;
851
575
  readonly permitTx: z.ZodObject<{
852
576
  network: z.ZodEnum<["mainnet", "testnet"]>;
853
577
  signers: z.ZodArray<z.ZodString, "many">;
@@ -858,15 +582,15 @@ export declare const VerifyPolicyToolShape: {
858
582
  to: z.ZodString;
859
583
  amount: z.ZodString;
860
584
  }, "strip", z.ZodTypeAny, {
861
- amount: string;
862
- token: string;
863
585
  from: string;
864
586
  to: string;
865
- }, {
866
587
  amount: string;
867
588
  token: string;
589
+ }, {
868
590
  from: string;
869
591
  to: string;
592
+ amount: string;
593
+ token: string;
870
594
  }>, "many">;
871
595
  events: z.ZodArray<z.ZodObject<{
872
596
  contract: z.ZodString;
@@ -944,15 +668,15 @@ export declare const VerifyPolicyToolShape: {
944
668
  to: z.ZodString;
945
669
  amount: z.ZodString;
946
670
  }, "strip", z.ZodTypeAny, {
947
- amount: string;
948
- token: string;
949
671
  from: string;
950
672
  to: string;
951
- }, {
952
673
  amount: string;
953
674
  token: string;
675
+ }, {
954
676
  from: string;
955
677
  to: string;
678
+ amount: string;
679
+ token: string;
956
680
  }>, "many">;
957
681
  events: z.ZodArray<z.ZodObject<{
958
682
  contract: z.ZodString;
@@ -1030,15 +754,15 @@ export declare const VerifyPolicyToolShape: {
1030
754
  to: z.ZodString;
1031
755
  amount: z.ZodString;
1032
756
  }, "strip", z.ZodTypeAny, {
1033
- amount: string;
1034
- token: string;
1035
757
  from: string;
1036
758
  to: string;
1037
- }, {
1038
759
  amount: string;
1039
760
  token: string;
761
+ }, {
1040
762
  from: string;
1041
763
  to: string;
764
+ amount: string;
765
+ token: string;
1042
766
  }>, "many">;
1043
767
  events: z.ZodArray<z.ZodObject<{
1044
768
  contract: z.ZodString;
@@ -1108,22 +832,6 @@ export declare const VerifyPolicyToolShape: {
1108
832
  sourceAccount: z.ZodString;
1109
833
  }, z.ZodTypeAny, "passthrough">>;
1110
834
  readonly validUntilLedger: z.ZodOptional<z.ZodNumber>;
1111
- readonly oraclePricesByAsset: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
1112
- price: z.ZodString;
1113
- timestampSeconds: z.ZodNumber;
1114
- }, "strip", z.ZodTypeAny, {
1115
- price: string;
1116
- timestampSeconds: number;
1117
- }, {
1118
- price: string;
1119
- timestampSeconds: number;
1120
- }>, z.ZodObject<{
1121
- error: z.ZodEnum<["stale", "missing", "deviation", "paused", "decimals", "fingerprint"]>;
1122
- }, "strip", z.ZodTypeAny, {
1123
- error: "stale" | "missing" | "deviation" | "paused" | "decimals" | "fingerprint";
1124
- }, {
1125
- error: "stale" | "missing" | "deviation" | "paused" | "decimals" | "fingerprint";
1126
- }>]>>>;
1127
835
  };
1128
836
  export type { GetInterpreterInfoInput, InstallPolicyInput, RevokePolicyInput, SimulatePolicyInput, VerifyPolicyInput, } from '@crediolabs/policy-synth/run';
1129
837
  /** Flat ZodRawShape for `install_policy`. `rule` is typed as `z.unknown()`
@@ -1151,17 +859,6 @@ export declare const RevokePolicyToolShape: {
1151
859
  readonly rpcUrl: z.ZodOptional<z.ZodString>;
1152
860
  readonly baseFee: z.ZodOptional<z.ZodNumber>;
1153
861
  };
1154
- /** Flat ZodRawShape for `merge_policy`: the tightening remedy when two rules
1155
- * our interpreter polices can serve the same calls. Two steps, in order. */
1156
- export declare const MergePolicyToolShape: {
1157
- readonly ruleId: z.ZodNumber;
1158
- readonly incomingPredicateBlobBase64: z.ZodString;
1159
- readonly step: z.ZodEnum<["detach", "reinstall"]>;
1160
- readonly smartAccount: z.ZodOptional<z.ZodString>;
1161
- readonly sourceAccount: z.ZodOptional<z.ZodString>;
1162
- readonly rpcUrl: z.ZodOptional<z.ZodString>;
1163
- readonly baseFee: z.ZodOptional<z.ZodNumber>;
1164
- };
1165
862
  /** Flat ZodRawShape for `get_interpreter_info`. `verifyLive` triggers an
1166
863
  * optional RPC `grammar_version()` call so the caller can verify the
1167
864
  * deployed contract matches the pin. */
@@ -20,14 +20,14 @@
20
20
  // `ZodEffects`, which has no `.shape`). They MUST stay in lockstep with
21
21
  // the strict schemas - a drift in field type or optionality breaks the
22
22
  // SDK's emitted JSON Schema.
23
- import { ComposeUserResponsesSchema, GetInterpreterInfoInputSchema, InstallPolicyInputSchema, InterpreterOptionsSchema, MandateSpecSchema, NetworkSchema, OraclePriceFixtureSchema, OzAdapterConfigSchema, PredicateNodeSchema, RecordedTransactionSchema, RecordTransactionInputSchema, RevokePolicyInputSchema, SimulatePolicyInputSchema, SynthesizePolicyInputSchema, ToolErrorSchema, VerifyPolicyInputSchema, } from '@crediolabs/policy-synth/run';
23
+ import { ComposeUserResponsesSchema, GetInterpreterInfoInputSchema, InstallPolicyInputSchema, InterpreterOptionsSchema, NetworkSchema, PredicateNodeSchema, RecordedTransactionSchema, RecordTransactionInputSchema, RevokePolicyInputSchema, SynthesizePolicyInputSchema, ToolErrorSchema, } from '@crediolabs/policy-synth/run';
24
24
  import { z } from 'zod';
25
25
  // Re-export the strict schemas so MCP package consumers (and existing tests)
26
26
  // still get them from this module. The canonical home is
27
27
  // `@crediolabs/policy-synth/run`; the re-exports here are a shim kept for
28
28
  // backward compatibility with downstream callers that imported from the MCP
29
29
  // package directly.
30
- export { ComposeUserResponsesSchema, GetInterpreterInfoInputSchema, InstallPolicyInputSchema, InterpreterOptionsSchema, MandateSpecSchema, NetworkSchema, OraclePriceFixtureSchema, OzAdapterConfigSchema, PredicateNodeSchema, RecordedTransactionSchema, RecordTransactionInputSchema, RevokePolicyInputSchema, SimulatePolicyInputSchema, SynthesizePolicyInputSchema, ToolErrorSchema, VerifyPolicyInputSchema, };
30
+ export { ComposeUserResponsesSchema, GetInterpreterInfoInputSchema, InstallPolicyInputSchema, InterpreterOptionsSchema, NetworkSchema, PredicateNodeSchema, RecordedTransactionSchema, RecordTransactionInputSchema, RevokePolicyInputSchema, SynthesizePolicyInputSchema, ToolErrorSchema, };
31
31
  /** Flat ZodRawShape used for the MCP SDK tool registration. The body
32
32
  * re-validates against `RecordTransactionInputSchema` so the mutual-exclusion
33
33
  * rule still fires (the SDK does not invoke `.refine()` at registration time). */
@@ -38,17 +38,15 @@ export const RecordTransactionToolShape = {
38
38
  confidenceOverride: z.number().min(0).max(1).optional(),
39
39
  };
40
40
  /** Flat ZodRawShape used for MCP tool registration. Every field is optional
41
- * so the JSON-Schema the SDK exposes to clients does not forbid either
42
- * front-end; the body re-validates against the discriminated union. */
41
+ * so the JSON-Schema the SDK exposes to clients stays permissive; the body
42
+ * re-validates against the strict schema. */
43
43
  export const SynthesizePolicyToolShape = {
44
- source: z.enum(['mandate', 'recording']).optional(),
45
- mandate: MandateSpecSchema.optional(),
44
+ source: z.literal('recording').optional(),
46
45
  recordedTx: RecordedTransactionSchema.optional(),
47
46
  network: NetworkSchema.optional(),
48
47
  userResponses: ComposeUserResponsesSchema.optional(),
49
48
  confidenceOverride: z.object({ threshold: z.number().min(0).max(1) }).optional(),
50
49
  interpreter: InterpreterOptionsSchema.optional(),
51
- ozConfig: OzAdapterConfigSchema.optional(),
52
50
  // Without this the tool chain has no join. A ProposedPolicy carries
53
51
  // `policyDocuments[].encodedPredicate` (canonical ScVal bytes), while
54
52
  // `simulate_policy` and `verify_policy` both want the PredicateNode TREE,
@@ -58,30 +56,16 @@ export const SynthesizePolicyToolShape = {
58
56
  // which skips the interpreter predicate entirely.
59
57
  explain: z.boolean().optional(),
60
58
  };
61
- /** Flat ZodRawShape for `simulate_policy`. The `predicate` is typed as
62
- * `z.unknown()` at the tool boundary because the recursive
63
- * `PredicateNodeSchema` is a `z.lazy()` union (the SDK does not accept
64
- * unions at the tool-registration boundary); the body re-validates
65
- * against `SimulatePolicyInputSchema`, which fails closed on a
66
- * malformed predicate. `predicate` is nullable here (vs required for
67
- * verify_policy) so the SDK-emitted JSON Schema mirrors the engine's
68
- * "OZ-only / no interpreter predicate" contract. */
69
- export const SimulatePolicyToolShape = {
70
- predicate: z.unknown().nullable().optional(),
59
+ /** `simulate_policy` and `verify_policy` share their input: the predicate tree
60
+ * (from `synthesize_policy` under `explain`) plus the recording it was
61
+ * synthesised from. */
62
+ const PolicyCheckToolShape = {
63
+ predicate: PredicateNodeSchema,
71
64
  permitTx: RecordedTransactionSchema,
72
65
  validUntilLedger: z.number().int().positive().optional(),
73
- oraclePricesByAsset: z.record(z.string(), OraclePriceFixtureSchema).optional(),
74
- };
75
- /** Flat ZodRawShape for `verify_policy`. Same `z.unknown()` boundary
76
- * trick for `predicate` as `SimulatePolicyToolShape`; `predicate` is
77
- * required at the strict-schema level (`VerifyPolicyInputSchema`) so
78
- * the body fails closed on a missing predicate. */
79
- export const VerifyPolicyToolShape = {
80
- predicate: z.unknown(),
81
- permitTx: RecordedTransactionSchema,
82
- validUntilLedger: z.number().int().positive().optional(),
83
- oraclePricesByAsset: z.record(z.string(), OraclePriceFixtureSchema).optional(),
84
66
  };
67
+ export const SimulatePolicyToolShape = { ...PolicyCheckToolShape };
68
+ export const VerifyPolicyToolShape = { ...PolicyCheckToolShape };
85
69
  /** Common base for `install_policy` and `revoke_policy`: smartAccount,
86
70
  * sourceAccount, optional RPC URL, optional base fee. Both share the
87
71
  * same smart-account context, so the SDK-emitted JSON Schema stays
@@ -112,14 +96,6 @@ export const RevokePolicyToolShape = {
112
96
  ruleId: z.number().int().nonnegative().optional(),
113
97
  interpreterAddress: z.string().optional(),
114
98
  };
115
- /** Flat ZodRawShape for `merge_policy`: the tightening remedy when two rules
116
- * our interpreter polices can serve the same calls. Two steps, in order. */
117
- export const MergePolicyToolShape = {
118
- ...SmartAccountToolShape,
119
- ruleId: z.number().int().nonnegative(),
120
- incomingPredicateBlobBase64: z.string().min(1),
121
- step: z.enum(['detach', 'reinstall']),
122
- };
123
99
  /** Flat ZodRawShape for `get_interpreter_info`. `verifyLive` triggers an
124
100
  * optional RPC `grammar_version()` call so the caller can verify the
125
101
  * deployed contract matches the pin. */