@crediolabs/policy-builder-mcp 0.1.3 → 0.1.6
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/dist/src/schemas.d.ts +150 -0
- package/dist/src/schemas.js +18 -0
- package/dist/src/tools/run.js +1 -0
- package/package.json +2 -2
- package/src/schemas.ts +19 -0
- package/src/tools/run.ts +1 -0
package/dist/src/schemas.d.ts
CHANGED
|
@@ -711,6 +711,40 @@ export declare const SynthesizePolicyMandateInputSchema: z.ZodObject<{
|
|
|
711
711
|
};
|
|
712
712
|
} | undefined;
|
|
713
713
|
}>;
|
|
714
|
+
/** Interpreter opt-in for the recording path. Present -> constraints OZ cannot
|
|
715
|
+
* express (per-method scoping, invocation-count windows, oracle bounds, exact
|
|
716
|
+
* hop paths) lower to a real interpreter predicate document instead of being
|
|
717
|
+
* surfaced as warnings. The core deep-validates `smartAccountAddress` (a C...
|
|
718
|
+
* contract, not the recording's G... source) and the tighten-only oracle
|
|
719
|
+
* bounds; the schema stays light so the core owns the friendly ToolErrors. */
|
|
720
|
+
export declare const InterpreterOptionsSchema: z.ZodObject<{
|
|
721
|
+
smartAccountAddress: z.ZodString;
|
|
722
|
+
installNonce: z.ZodOptional<z.ZodNumber>;
|
|
723
|
+
oracleParams: z.ZodOptional<z.ZodObject<{
|
|
724
|
+
maxStalenessSeconds: z.ZodOptional<z.ZodNumber>;
|
|
725
|
+
maxDeviationBps: z.ZodOptional<z.ZodNumber>;
|
|
726
|
+
}, "strip", z.ZodTypeAny, {
|
|
727
|
+
maxStalenessSeconds?: number | undefined;
|
|
728
|
+
maxDeviationBps?: number | undefined;
|
|
729
|
+
}, {
|
|
730
|
+
maxStalenessSeconds?: number | undefined;
|
|
731
|
+
maxDeviationBps?: number | undefined;
|
|
732
|
+
}>>;
|
|
733
|
+
}, "strip", z.ZodTypeAny, {
|
|
734
|
+
smartAccountAddress: string;
|
|
735
|
+
installNonce?: number | undefined;
|
|
736
|
+
oracleParams?: {
|
|
737
|
+
maxStalenessSeconds?: number | undefined;
|
|
738
|
+
maxDeviationBps?: number | undefined;
|
|
739
|
+
} | undefined;
|
|
740
|
+
}, {
|
|
741
|
+
smartAccountAddress: string;
|
|
742
|
+
installNonce?: number | undefined;
|
|
743
|
+
oracleParams?: {
|
|
744
|
+
maxStalenessSeconds?: number | undefined;
|
|
745
|
+
maxDeviationBps?: number | undefined;
|
|
746
|
+
} | undefined;
|
|
747
|
+
}>;
|
|
714
748
|
export declare const SynthesizePolicyRecordingInputSchema: z.ZodObject<{
|
|
715
749
|
source: z.ZodLiteral<"recording">;
|
|
716
750
|
recordedTx: z.ZodObject<{
|
|
@@ -996,6 +1030,34 @@ export declare const SynthesizePolicyRecordingInputSchema: z.ZodObject<{
|
|
|
996
1030
|
}, {
|
|
997
1031
|
threshold: number;
|
|
998
1032
|
}>>;
|
|
1033
|
+
interpreter: z.ZodOptional<z.ZodObject<{
|
|
1034
|
+
smartAccountAddress: z.ZodString;
|
|
1035
|
+
installNonce: z.ZodOptional<z.ZodNumber>;
|
|
1036
|
+
oracleParams: z.ZodOptional<z.ZodObject<{
|
|
1037
|
+
maxStalenessSeconds: z.ZodOptional<z.ZodNumber>;
|
|
1038
|
+
maxDeviationBps: z.ZodOptional<z.ZodNumber>;
|
|
1039
|
+
}, "strip", z.ZodTypeAny, {
|
|
1040
|
+
maxStalenessSeconds?: number | undefined;
|
|
1041
|
+
maxDeviationBps?: number | undefined;
|
|
1042
|
+
}, {
|
|
1043
|
+
maxStalenessSeconds?: number | undefined;
|
|
1044
|
+
maxDeviationBps?: number | undefined;
|
|
1045
|
+
}>>;
|
|
1046
|
+
}, "strip", z.ZodTypeAny, {
|
|
1047
|
+
smartAccountAddress: string;
|
|
1048
|
+
installNonce?: number | undefined;
|
|
1049
|
+
oracleParams?: {
|
|
1050
|
+
maxStalenessSeconds?: number | undefined;
|
|
1051
|
+
maxDeviationBps?: number | undefined;
|
|
1052
|
+
} | undefined;
|
|
1053
|
+
}, {
|
|
1054
|
+
smartAccountAddress: string;
|
|
1055
|
+
installNonce?: number | undefined;
|
|
1056
|
+
oracleParams?: {
|
|
1057
|
+
maxStalenessSeconds?: number | undefined;
|
|
1058
|
+
maxDeviationBps?: number | undefined;
|
|
1059
|
+
} | undefined;
|
|
1060
|
+
}>>;
|
|
999
1061
|
ozConfig: z.ZodOptional<z.ZodObject<{
|
|
1000
1062
|
network: z.ZodEnum<["mainnet", "testnet"]>;
|
|
1001
1063
|
instances: z.ZodObject<{
|
|
@@ -1081,6 +1143,14 @@ export declare const SynthesizePolicyRecordingInputSchema: z.ZodObject<{
|
|
|
1081
1143
|
limitAmount: z.ZodOptional<z.ZodString>;
|
|
1082
1144
|
invocationLimit: z.ZodOptional<z.ZodNumber>;
|
|
1083
1145
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1146
|
+
interpreter?: {
|
|
1147
|
+
smartAccountAddress: string;
|
|
1148
|
+
installNonce?: number | undefined;
|
|
1149
|
+
oracleParams?: {
|
|
1150
|
+
maxStalenessSeconds?: number | undefined;
|
|
1151
|
+
maxDeviationBps?: number | undefined;
|
|
1152
|
+
} | undefined;
|
|
1153
|
+
} | undefined;
|
|
1084
1154
|
}, {
|
|
1085
1155
|
network: "mainnet" | "testnet";
|
|
1086
1156
|
source: "recording";
|
|
@@ -1136,6 +1206,14 @@ export declare const SynthesizePolicyRecordingInputSchema: z.ZodObject<{
|
|
|
1136
1206
|
limitAmount: z.ZodOptional<z.ZodString>;
|
|
1137
1207
|
invocationLimit: z.ZodOptional<z.ZodNumber>;
|
|
1138
1208
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1209
|
+
interpreter?: {
|
|
1210
|
+
smartAccountAddress: string;
|
|
1211
|
+
installNonce?: number | undefined;
|
|
1212
|
+
oracleParams?: {
|
|
1213
|
+
maxStalenessSeconds?: number | undefined;
|
|
1214
|
+
maxDeviationBps?: number | undefined;
|
|
1215
|
+
} | undefined;
|
|
1216
|
+
} | undefined;
|
|
1139
1217
|
}>;
|
|
1140
1218
|
export declare const SynthesizePolicyInputSchema: z.ZodDiscriminatedUnion<"source", [z.ZodObject<{
|
|
1141
1219
|
source: z.ZodLiteral<"mandate">;
|
|
@@ -1598,6 +1676,34 @@ export declare const SynthesizePolicyInputSchema: z.ZodDiscriminatedUnion<"sourc
|
|
|
1598
1676
|
}, {
|
|
1599
1677
|
threshold: number;
|
|
1600
1678
|
}>>;
|
|
1679
|
+
interpreter: z.ZodOptional<z.ZodObject<{
|
|
1680
|
+
smartAccountAddress: z.ZodString;
|
|
1681
|
+
installNonce: z.ZodOptional<z.ZodNumber>;
|
|
1682
|
+
oracleParams: z.ZodOptional<z.ZodObject<{
|
|
1683
|
+
maxStalenessSeconds: z.ZodOptional<z.ZodNumber>;
|
|
1684
|
+
maxDeviationBps: z.ZodOptional<z.ZodNumber>;
|
|
1685
|
+
}, "strip", z.ZodTypeAny, {
|
|
1686
|
+
maxStalenessSeconds?: number | undefined;
|
|
1687
|
+
maxDeviationBps?: number | undefined;
|
|
1688
|
+
}, {
|
|
1689
|
+
maxStalenessSeconds?: number | undefined;
|
|
1690
|
+
maxDeviationBps?: number | undefined;
|
|
1691
|
+
}>>;
|
|
1692
|
+
}, "strip", z.ZodTypeAny, {
|
|
1693
|
+
smartAccountAddress: string;
|
|
1694
|
+
installNonce?: number | undefined;
|
|
1695
|
+
oracleParams?: {
|
|
1696
|
+
maxStalenessSeconds?: number | undefined;
|
|
1697
|
+
maxDeviationBps?: number | undefined;
|
|
1698
|
+
} | undefined;
|
|
1699
|
+
}, {
|
|
1700
|
+
smartAccountAddress: string;
|
|
1701
|
+
installNonce?: number | undefined;
|
|
1702
|
+
oracleParams?: {
|
|
1703
|
+
maxStalenessSeconds?: number | undefined;
|
|
1704
|
+
maxDeviationBps?: number | undefined;
|
|
1705
|
+
} | undefined;
|
|
1706
|
+
}>>;
|
|
1601
1707
|
ozConfig: z.ZodOptional<z.ZodObject<{
|
|
1602
1708
|
network: z.ZodEnum<["mainnet", "testnet"]>;
|
|
1603
1709
|
instances: z.ZodObject<{
|
|
@@ -1683,6 +1789,14 @@ export declare const SynthesizePolicyInputSchema: z.ZodDiscriminatedUnion<"sourc
|
|
|
1683
1789
|
limitAmount: z.ZodOptional<z.ZodString>;
|
|
1684
1790
|
invocationLimit: z.ZodOptional<z.ZodNumber>;
|
|
1685
1791
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1792
|
+
interpreter?: {
|
|
1793
|
+
smartAccountAddress: string;
|
|
1794
|
+
installNonce?: number | undefined;
|
|
1795
|
+
oracleParams?: {
|
|
1796
|
+
maxStalenessSeconds?: number | undefined;
|
|
1797
|
+
maxDeviationBps?: number | undefined;
|
|
1798
|
+
} | undefined;
|
|
1799
|
+
} | undefined;
|
|
1686
1800
|
}, {
|
|
1687
1801
|
network: "mainnet" | "testnet";
|
|
1688
1802
|
source: "recording";
|
|
@@ -1738,6 +1852,14 @@ export declare const SynthesizePolicyInputSchema: z.ZodDiscriminatedUnion<"sourc
|
|
|
1738
1852
|
limitAmount: z.ZodOptional<z.ZodString>;
|
|
1739
1853
|
invocationLimit: z.ZodOptional<z.ZodNumber>;
|
|
1740
1854
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1855
|
+
interpreter?: {
|
|
1856
|
+
smartAccountAddress: string;
|
|
1857
|
+
installNonce?: number | undefined;
|
|
1858
|
+
oracleParams?: {
|
|
1859
|
+
maxStalenessSeconds?: number | undefined;
|
|
1860
|
+
maxDeviationBps?: number | undefined;
|
|
1861
|
+
} | undefined;
|
|
1862
|
+
} | undefined;
|
|
1741
1863
|
}>]>;
|
|
1742
1864
|
export type SynthesizePolicyInput = z.infer<typeof SynthesizePolicyInputSchema>;
|
|
1743
1865
|
/** Flat ZodRawShape used for MCP tool registration. Every field is optional
|
|
@@ -2116,6 +2238,34 @@ export declare const SynthesizePolicyToolShape: {
|
|
|
2116
2238
|
}, {
|
|
2117
2239
|
threshold: number;
|
|
2118
2240
|
}>>;
|
|
2241
|
+
readonly interpreter: z.ZodOptional<z.ZodObject<{
|
|
2242
|
+
smartAccountAddress: z.ZodString;
|
|
2243
|
+
installNonce: z.ZodOptional<z.ZodNumber>;
|
|
2244
|
+
oracleParams: z.ZodOptional<z.ZodObject<{
|
|
2245
|
+
maxStalenessSeconds: z.ZodOptional<z.ZodNumber>;
|
|
2246
|
+
maxDeviationBps: z.ZodOptional<z.ZodNumber>;
|
|
2247
|
+
}, "strip", z.ZodTypeAny, {
|
|
2248
|
+
maxStalenessSeconds?: number | undefined;
|
|
2249
|
+
maxDeviationBps?: number | undefined;
|
|
2250
|
+
}, {
|
|
2251
|
+
maxStalenessSeconds?: number | undefined;
|
|
2252
|
+
maxDeviationBps?: number | undefined;
|
|
2253
|
+
}>>;
|
|
2254
|
+
}, "strip", z.ZodTypeAny, {
|
|
2255
|
+
smartAccountAddress: string;
|
|
2256
|
+
installNonce?: number | undefined;
|
|
2257
|
+
oracleParams?: {
|
|
2258
|
+
maxStalenessSeconds?: number | undefined;
|
|
2259
|
+
maxDeviationBps?: number | undefined;
|
|
2260
|
+
} | undefined;
|
|
2261
|
+
}, {
|
|
2262
|
+
smartAccountAddress: string;
|
|
2263
|
+
installNonce?: number | undefined;
|
|
2264
|
+
oracleParams?: {
|
|
2265
|
+
maxStalenessSeconds?: number | undefined;
|
|
2266
|
+
maxDeviationBps?: number | undefined;
|
|
2267
|
+
} | undefined;
|
|
2268
|
+
}>>;
|
|
2119
2269
|
readonly ozConfig: z.ZodOptional<z.ZodObject<{
|
|
2120
2270
|
network: z.ZodEnum<["mainnet", "testnet"]>;
|
|
2121
2271
|
instances: z.ZodObject<{
|
package/dist/src/schemas.js
CHANGED
|
@@ -172,12 +172,29 @@ export const SynthesizePolicyMandateInputSchema = z.object({
|
|
|
172
172
|
mandate: MandateSpecSchema,
|
|
173
173
|
ozConfig: OzAdapterConfigSchema.optional(),
|
|
174
174
|
});
|
|
175
|
+
/** Interpreter opt-in for the recording path. Present -> constraints OZ cannot
|
|
176
|
+
* express (per-method scoping, invocation-count windows, oracle bounds, exact
|
|
177
|
+
* hop paths) lower to a real interpreter predicate document instead of being
|
|
178
|
+
* surfaced as warnings. The core deep-validates `smartAccountAddress` (a C...
|
|
179
|
+
* contract, not the recording's G... source) and the tighten-only oracle
|
|
180
|
+
* bounds; the schema stays light so the core owns the friendly ToolErrors. */
|
|
181
|
+
export const InterpreterOptionsSchema = z.object({
|
|
182
|
+
smartAccountAddress: z.string(),
|
|
183
|
+
installNonce: z.number().int().positive().optional(),
|
|
184
|
+
oracleParams: z
|
|
185
|
+
.object({
|
|
186
|
+
maxStalenessSeconds: z.number().int().positive().optional(),
|
|
187
|
+
maxDeviationBps: z.number().int().positive().optional(),
|
|
188
|
+
})
|
|
189
|
+
.optional(),
|
|
190
|
+
});
|
|
175
191
|
export const SynthesizePolicyRecordingInputSchema = z.object({
|
|
176
192
|
source: z.literal('recording'),
|
|
177
193
|
recordedTx: RecordedTransactionSchema,
|
|
178
194
|
network: NetworkSchema,
|
|
179
195
|
userResponses: ComposeUserResponsesSchema.optional(),
|
|
180
196
|
confidenceOverride: z.object({ threshold: z.number().min(0).max(1) }).optional(),
|
|
197
|
+
interpreter: InterpreterOptionsSchema.optional(),
|
|
181
198
|
ozConfig: OzAdapterConfigSchema.optional(),
|
|
182
199
|
});
|
|
183
200
|
export const SynthesizePolicyInputSchema = z.discriminatedUnion('source', [
|
|
@@ -194,6 +211,7 @@ export const SynthesizePolicyToolShape = {
|
|
|
194
211
|
network: NetworkSchema.optional(),
|
|
195
212
|
userResponses: ComposeUserResponsesSchema.optional(),
|
|
196
213
|
confidenceOverride: z.object({ threshold: z.number().min(0).max(1) }).optional(),
|
|
214
|
+
interpreter: InterpreterOptionsSchema.optional(),
|
|
197
215
|
ozConfig: OzAdapterConfigSchema.optional(),
|
|
198
216
|
};
|
|
199
217
|
// ===== Error envelope (canonical) =====
|
package/dist/src/tools/run.js
CHANGED
|
@@ -69,6 +69,7 @@ export async function runSynthesizePolicy(raw) {
|
|
|
69
69
|
...(input.confidenceOverride !== undefined
|
|
70
70
|
? { confidenceOverride: input.confidenceOverride }
|
|
71
71
|
: {}),
|
|
72
|
+
...(input.interpreter !== undefined ? { interpreter: input.interpreter } : {}),
|
|
72
73
|
}, ozConfig);
|
|
73
74
|
}
|
|
74
75
|
function resolveOzConfig(input) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crediolabs/policy-builder-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "MCP server exposing the OZ policy-synth core (record_transaction + synthesize_policy) over stdio and Streamable HTTP transports.",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"build": "tsc -p tsconfig.build.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@crediolabs/policy-synth": "^0.1.
|
|
34
|
+
"@crediolabs/policy-synth": "^0.1.4",
|
|
35
35
|
"@modelcontextprotocol/sdk": "1.18.1",
|
|
36
36
|
"zod": "3.25.76"
|
|
37
37
|
},
|
package/src/schemas.ts
CHANGED
|
@@ -196,12 +196,30 @@ export const SynthesizePolicyMandateInputSchema = z.object({
|
|
|
196
196
|
ozConfig: OzAdapterConfigSchema.optional(),
|
|
197
197
|
})
|
|
198
198
|
|
|
199
|
+
/** Interpreter opt-in for the recording path. Present -> constraints OZ cannot
|
|
200
|
+
* express (per-method scoping, invocation-count windows, oracle bounds, exact
|
|
201
|
+
* hop paths) lower to a real interpreter predicate document instead of being
|
|
202
|
+
* surfaced as warnings. The core deep-validates `smartAccountAddress` (a C...
|
|
203
|
+
* contract, not the recording's G... source) and the tighten-only oracle
|
|
204
|
+
* bounds; the schema stays light so the core owns the friendly ToolErrors. */
|
|
205
|
+
export const InterpreterOptionsSchema = z.object({
|
|
206
|
+
smartAccountAddress: z.string(),
|
|
207
|
+
installNonce: z.number().int().positive().optional(),
|
|
208
|
+
oracleParams: z
|
|
209
|
+
.object({
|
|
210
|
+
maxStalenessSeconds: z.number().int().positive().optional(),
|
|
211
|
+
maxDeviationBps: z.number().int().positive().optional(),
|
|
212
|
+
})
|
|
213
|
+
.optional(),
|
|
214
|
+
})
|
|
215
|
+
|
|
199
216
|
export const SynthesizePolicyRecordingInputSchema = z.object({
|
|
200
217
|
source: z.literal('recording'),
|
|
201
218
|
recordedTx: RecordedTransactionSchema,
|
|
202
219
|
network: NetworkSchema,
|
|
203
220
|
userResponses: ComposeUserResponsesSchema.optional(),
|
|
204
221
|
confidenceOverride: z.object({ threshold: z.number().min(0).max(1) }).optional(),
|
|
222
|
+
interpreter: InterpreterOptionsSchema.optional(),
|
|
205
223
|
ozConfig: OzAdapterConfigSchema.optional(),
|
|
206
224
|
})
|
|
207
225
|
|
|
@@ -221,6 +239,7 @@ export const SynthesizePolicyToolShape = {
|
|
|
221
239
|
network: NetworkSchema.optional(),
|
|
222
240
|
userResponses: ComposeUserResponsesSchema.optional(),
|
|
223
241
|
confidenceOverride: z.object({ threshold: z.number().min(0).max(1) }).optional(),
|
|
242
|
+
interpreter: InterpreterOptionsSchema.optional(),
|
|
224
243
|
ozConfig: OzAdapterConfigSchema.optional(),
|
|
225
244
|
} as const
|
|
226
245
|
|
package/src/tools/run.ts
CHANGED
|
@@ -99,6 +99,7 @@ export async function runSynthesizePolicy(raw: unknown): Promise<ToolResponse<Pr
|
|
|
99
99
|
...(input.confidenceOverride !== undefined
|
|
100
100
|
? { confidenceOverride: input.confidenceOverride }
|
|
101
101
|
: {}),
|
|
102
|
+
...(input.interpreter !== undefined ? { interpreter: input.interpreter } : {}),
|
|
102
103
|
} as SynthesizeFromRecordingOptions,
|
|
103
104
|
ozConfig
|
|
104
105
|
)
|