agentpay-mcp 4.1.10 → 4.1.16

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 (59) hide show
  1. package/README.md +13 -1
  2. package/dist/index.js +2 -2
  3. package/dist/utils/authorized-cybersecurity-scan-profile.d.ts +216 -0
  4. package/dist/utils/authorized-cybersecurity-scan-profile.d.ts.map +1 -0
  5. package/dist/utils/authorized-cybersecurity-scan-profile.js +130 -0
  6. package/dist/utils/authorized-cybersecurity-scan-profile.js.map +1 -0
  7. package/dist/utils/paid-provider-health-proof.d.ts +4 -4
  8. package/dist/utils/paid-tool-quality-threshold.d.ts +261 -0
  9. package/dist/utils/paid-tool-quality-threshold.d.ts.map +1 -0
  10. package/dist/utils/paid-tool-quality-threshold.js +155 -0
  11. package/dist/utils/paid-tool-quality-threshold.js.map +1 -0
  12. package/dist/utils/post-quantum-spend-envelope-compatibility.d.ts +22 -0
  13. package/dist/utils/post-quantum-spend-envelope-compatibility.d.ts.map +1 -0
  14. package/dist/utils/post-quantum-spend-envelope-compatibility.js +61 -0
  15. package/dist/utils/post-quantum-spend-envelope-compatibility.js.map +1 -0
  16. package/dist/utils/wallet-action-preflight-profile.d.ts +70 -0
  17. package/dist/utils/wallet-action-preflight-profile.d.ts.map +1 -0
  18. package/dist/utils/wallet-action-preflight-profile.js +151 -0
  19. package/dist/utils/wallet-action-preflight-profile.js.map +1 -0
  20. package/dist/utils/x402-chain-neutral-gateway-profile.d.ts +66 -0
  21. package/dist/utils/x402-chain-neutral-gateway-profile.d.ts.map +1 -0
  22. package/dist/utils/x402-chain-neutral-gateway-profile.js +145 -0
  23. package/dist/utils/x402-chain-neutral-gateway-profile.js.map +1 -0
  24. package/dist/utils/x402-dynamic-paid-mcp-manifest-drift.d.ts +82 -0
  25. package/dist/utils/x402-dynamic-paid-mcp-manifest-drift.d.ts.map +1 -0
  26. package/dist/utils/x402-dynamic-paid-mcp-manifest-drift.js +158 -0
  27. package/dist/utils/x402-dynamic-paid-mcp-manifest-drift.js.map +1 -0
  28. package/dist/utils/x402-multi-ledger-receipt.d.ts +64 -0
  29. package/dist/utils/x402-multi-ledger-receipt.d.ts.map +1 -0
  30. package/dist/utils/x402-multi-ledger-receipt.js +150 -0
  31. package/dist/utils/x402-multi-ledger-receipt.js.map +1 -0
  32. package/docs/agentpay-escrow-reputation-boundary.md +64 -0
  33. package/docs/agentpay-five-tool-parity-proof.json +56 -0
  34. package/docs/agentpay-five-tool-parity-proof.md +64 -0
  35. package/docs/agentpay-machine-payment-directory-listing-pack.md +101 -0
  36. package/docs/agentpay-machine-payment-directory-listing.json +41 -0
  37. package/docs/agentpay-paid-proxy-discovery-listing.json +42 -0
  38. package/docs/authorized-cybersecurity-scan-profile.md +56 -0
  39. package/docs/fixtures/authorized-cybersecurity-scan-profile-agentaegis-2026-05-04.json +43 -0
  40. package/docs/fixtures/chain-neutral-gateway-profile-rugmunch-2026-05-03.json +43 -0
  41. package/docs/fixtures/dynamic-paid-mcp-manifest-rugmunch-2026-05-04-baseline.json +67 -0
  42. package/docs/fixtures/dynamic-paid-mcp-manifest-rugmunch-2026-05-04.json +67 -0
  43. package/docs/fixtures/multi-ledger-receipt-xrpl-utilities-2026-05-04.json +35 -0
  44. package/docs/fixtures/paid-tool-quality-threshold-strale-2026-05-04.json +53 -0
  45. package/docs/fixtures/wallet-action-preflight-merx-2026-05-04.json +54 -0
  46. package/docs/paid-mcp-proxy-discovery-readiness.md +70 -0
  47. package/docs/paid-tool-quality-thresholds.md +47 -0
  48. package/docs/post-quantum-spend-envelope-compatibility.md +37 -0
  49. package/docs/smithery-paid-mcp-installation.md +180 -0
  50. package/docs/wallet-action-preflight-profile.md +57 -0
  51. package/docs/x402-chain-neutral-gateway-profile.md +65 -0
  52. package/docs/x402-chain-neutral-gateway-profile.schema.json +75 -0
  53. package/docs/x402-dynamic-paid-mcp-manifest-drift.md +41 -0
  54. package/docs/x402-dynamic-paid-mcp-manifest-drift.schema.json +193 -0
  55. package/docs/x402-multi-ledger-receipt-normalization.md +57 -0
  56. package/docs/x402-multi-ledger-receipt-normalization.schema.json +67 -0
  57. package/examples/smithery-paid-mcp-installation/README.md +63 -0
  58. package/llms.txt +4 -0
  59. package/package.json +2 -1
@@ -0,0 +1,261 @@
1
+ /**
2
+ * Paid-tool quality threshold helpers.
3
+ *
4
+ * Buyer agents should not sign x402 payments from a catalog score alone. They
5
+ * need a fresh score, a provider-health snapshot, a minimum-quality policy, and
6
+ * an approval gate that fails closed when the score is stale or below threshold.
7
+ */
8
+ import { z } from 'zod';
9
+ export declare const PaidToolQualityProofSchema: z.ZodObject<{
10
+ schema: z.ZodLiteral<"agentpay-paid-tool-quality-proof/v1">;
11
+ generated_at: z.ZodEffects<z.ZodString, string, string>;
12
+ source: z.ZodObject<{
13
+ name: z.ZodString;
14
+ url: z.ZodOptional<z.ZodString>;
15
+ commit: z.ZodOptional<z.ZodString>;
16
+ raw_score_field: z.ZodOptional<z.ZodString>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ name: string;
19
+ url?: string | undefined;
20
+ commit?: string | undefined;
21
+ raw_score_field?: string | undefined;
22
+ }, {
23
+ name: string;
24
+ url?: string | undefined;
25
+ commit?: string | undefined;
26
+ raw_score_field?: string | undefined;
27
+ }>;
28
+ tool: z.ZodObject<{
29
+ id: z.ZodString;
30
+ name: z.ZodString;
31
+ provider_id: z.ZodString;
32
+ capability: z.ZodString;
33
+ }, "strip", z.ZodTypeAny, {
34
+ id: string;
35
+ name: string;
36
+ provider_id: string;
37
+ capability: string;
38
+ }, {
39
+ id: string;
40
+ name: string;
41
+ provider_id: string;
42
+ capability: string;
43
+ }>;
44
+ score: z.ZodObject<{
45
+ current: z.ZodNumber;
46
+ maximum: z.ZodDefault<z.ZodLiteral<100>>;
47
+ min_required: z.ZodNumber;
48
+ measured_at: z.ZodEffects<z.ZodString, string, string>;
49
+ stale_after_seconds: z.ZodNumber;
50
+ dimensions: z.ZodObject<{
51
+ reliability: z.ZodNumber;
52
+ availability: z.ZodNumber;
53
+ receipt_integrity: z.ZodNumber;
54
+ policy_fit: z.ZodNumber;
55
+ }, "strip", z.ZodTypeAny, {
56
+ reliability: number;
57
+ availability: number;
58
+ receipt_integrity: number;
59
+ policy_fit: number;
60
+ }, {
61
+ reliability: number;
62
+ availability: number;
63
+ receipt_integrity: number;
64
+ policy_fit: number;
65
+ }>;
66
+ }, "strip", z.ZodTypeAny, {
67
+ maximum: 100;
68
+ current: number;
69
+ min_required: number;
70
+ measured_at: string;
71
+ stale_after_seconds: number;
72
+ dimensions: {
73
+ reliability: number;
74
+ availability: number;
75
+ receipt_integrity: number;
76
+ policy_fit: number;
77
+ };
78
+ }, {
79
+ current: number;
80
+ min_required: number;
81
+ measured_at: string;
82
+ stale_after_seconds: number;
83
+ dimensions: {
84
+ reliability: number;
85
+ availability: number;
86
+ receipt_integrity: number;
87
+ policy_fit: number;
88
+ };
89
+ maximum?: 100 | undefined;
90
+ }>;
91
+ provider_health: z.ZodObject<{
92
+ status: z.ZodEnum<["ok", "degraded", "failed", "unknown"]>;
93
+ success_rate_24h: z.ZodNumber;
94
+ last_success_at: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
95
+ stale_streak: z.ZodNumber;
96
+ receipt_state: z.ZodEnum<["verified", "pending_acceptance_verified", "missing", "invalid", "unverified"]>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ status: "unknown" | "ok" | "failed" | "degraded";
99
+ stale_streak: number;
100
+ receipt_state: "verified" | "pending_acceptance_verified" | "missing" | "invalid" | "unverified";
101
+ success_rate_24h: number;
102
+ last_success_at?: string | undefined;
103
+ }, {
104
+ status: "unknown" | "ok" | "failed" | "degraded";
105
+ stale_streak: number;
106
+ receipt_state: "verified" | "pending_acceptance_verified" | "missing" | "invalid" | "unverified";
107
+ success_rate_24h: number;
108
+ last_success_at?: string | undefined;
109
+ }>;
110
+ x402_payment: z.ZodObject<{
111
+ scheme: z.ZodDefault<z.ZodLiteral<"exact">>;
112
+ network: z.ZodString;
113
+ asset: z.ZodString;
114
+ payTo: z.ZodEffects<z.ZodString, string, string>;
115
+ maxAmountRequired: z.ZodEffects<z.ZodString, string, string>;
116
+ }, "strip", z.ZodTypeAny, {
117
+ scheme: "exact";
118
+ network: string;
119
+ asset: string;
120
+ maxAmountRequired: string;
121
+ payTo: string;
122
+ }, {
123
+ network: string;
124
+ asset: string;
125
+ maxAmountRequired: string;
126
+ payTo: string;
127
+ scheme?: "exact" | undefined;
128
+ }>;
129
+ approval_gate: z.ZodObject<{
130
+ fail_closed: z.ZodLiteral<true>;
131
+ requires_human_approval: z.ZodBoolean;
132
+ decision: z.ZodEnum<["allow", "deny"]>;
133
+ reason: z.ZodArray<z.ZodString, "many">;
134
+ }, "strip", z.ZodTypeAny, {
135
+ reason: string[];
136
+ fail_closed: true;
137
+ requires_human_approval: boolean;
138
+ decision: "allow" | "deny";
139
+ }, {
140
+ reason: string[];
141
+ fail_closed: true;
142
+ requires_human_approval: boolean;
143
+ decision: "allow" | "deny";
144
+ }>;
145
+ }, "strip", z.ZodTypeAny, {
146
+ source: {
147
+ name: string;
148
+ url?: string | undefined;
149
+ commit?: string | undefined;
150
+ raw_score_field?: string | undefined;
151
+ };
152
+ schema: "agentpay-paid-tool-quality-proof/v1";
153
+ generated_at: string;
154
+ approval_gate: {
155
+ reason: string[];
156
+ fail_closed: true;
157
+ requires_human_approval: boolean;
158
+ decision: "allow" | "deny";
159
+ };
160
+ x402_payment: {
161
+ scheme: "exact";
162
+ network: string;
163
+ asset: string;
164
+ maxAmountRequired: string;
165
+ payTo: string;
166
+ };
167
+ tool: {
168
+ id: string;
169
+ name: string;
170
+ provider_id: string;
171
+ capability: string;
172
+ };
173
+ score: {
174
+ maximum: 100;
175
+ current: number;
176
+ min_required: number;
177
+ measured_at: string;
178
+ stale_after_seconds: number;
179
+ dimensions: {
180
+ reliability: number;
181
+ availability: number;
182
+ receipt_integrity: number;
183
+ policy_fit: number;
184
+ };
185
+ };
186
+ provider_health: {
187
+ status: "unknown" | "ok" | "failed" | "degraded";
188
+ stale_streak: number;
189
+ receipt_state: "verified" | "pending_acceptance_verified" | "missing" | "invalid" | "unverified";
190
+ success_rate_24h: number;
191
+ last_success_at?: string | undefined;
192
+ };
193
+ }, {
194
+ source: {
195
+ name: string;
196
+ url?: string | undefined;
197
+ commit?: string | undefined;
198
+ raw_score_field?: string | undefined;
199
+ };
200
+ schema: "agentpay-paid-tool-quality-proof/v1";
201
+ generated_at: string;
202
+ approval_gate: {
203
+ reason: string[];
204
+ fail_closed: true;
205
+ requires_human_approval: boolean;
206
+ decision: "allow" | "deny";
207
+ };
208
+ x402_payment: {
209
+ network: string;
210
+ asset: string;
211
+ maxAmountRequired: string;
212
+ payTo: string;
213
+ scheme?: "exact" | undefined;
214
+ };
215
+ tool: {
216
+ id: string;
217
+ name: string;
218
+ provider_id: string;
219
+ capability: string;
220
+ };
221
+ score: {
222
+ current: number;
223
+ min_required: number;
224
+ measured_at: string;
225
+ stale_after_seconds: number;
226
+ dimensions: {
227
+ reliability: number;
228
+ availability: number;
229
+ receipt_integrity: number;
230
+ policy_fit: number;
231
+ };
232
+ maximum?: 100 | undefined;
233
+ };
234
+ provider_health: {
235
+ status: "unknown" | "ok" | "failed" | "degraded";
236
+ stale_streak: number;
237
+ receipt_state: "verified" | "pending_acceptance_verified" | "missing" | "invalid" | "unverified";
238
+ success_rate_24h: number;
239
+ last_success_at?: string | undefined;
240
+ };
241
+ }>;
242
+ export type PaidToolQualityProof = z.infer<typeof PaidToolQualityProofSchema>;
243
+ export type PaidToolQualityPolicy = {
244
+ minimumScore: number;
245
+ maxScoreAgeMs: number;
246
+ maxProviderStaleStreak: number;
247
+ minimumSuccessRate24h: number;
248
+ allowedNetworks: string[];
249
+ allowedAssets: string[];
250
+ allowedPayTo: string[];
251
+ requireHumanApproval: boolean;
252
+ requireVerifiedReceipt: boolean;
253
+ };
254
+ export type PaidToolQualityDecision = {
255
+ ok: boolean;
256
+ decision: 'allow' | 'deny';
257
+ failures: string[];
258
+ warnings: string[];
259
+ };
260
+ export declare function evaluatePaidToolQualityThreshold(proofInput: unknown, policy: PaidToolQualityPolicy, now?: Date): PaidToolQualityDecision;
261
+ //# sourceMappingURL=paid-tool-quality-threshold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paid-tool-quality-threshold.d.ts","sourceRoot":"","sources":["../../src/utils/paid-tool-quality-threshold.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,sBAAsB,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAUF,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE,qBAAqB,EAC7B,GAAG,OAAa,GACf,uBAAuB,CA6FzB"}
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ /**
3
+ * Paid-tool quality threshold helpers.
4
+ *
5
+ * Buyer agents should not sign x402 payments from a catalog score alone. They
6
+ * need a fresh score, a provider-health snapshot, a minimum-quality policy, and
7
+ * an approval gate that fails closed when the score is stale or below threshold.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.PaidToolQualityProofSchema = void 0;
11
+ exports.evaluatePaidToolQualityThreshold = evaluatePaidToolQualityThreshold;
12
+ const zod_1 = require("zod");
13
+ const isoDateString = zod_1.z.string().refine((value) => !Number.isNaN(Date.parse(value)), {
14
+ message: 'must be an ISO-8601 timestamp',
15
+ });
16
+ const nonZeroEvmAddress = zod_1.z
17
+ .string()
18
+ .regex(/^0x[a-fA-F0-9]{40}$/)
19
+ .refine((value) => value.toLowerCase() !== '0x0000000000000000000000000000000000000000', {
20
+ message: 'payTo must not be the zero address',
21
+ });
22
+ const positiveIntegerString = zod_1.z
23
+ .string()
24
+ .regex(/^\d+$/)
25
+ .refine((value) => BigInt(value) > 0n, { message: 'amount must be greater than zero' });
26
+ exports.PaidToolQualityProofSchema = zod_1.z.object({
27
+ schema: zod_1.z.literal('agentpay-paid-tool-quality-proof/v1'),
28
+ generated_at: isoDateString,
29
+ source: zod_1.z.object({
30
+ name: zod_1.z.string().min(1),
31
+ url: zod_1.z.string().url().optional(),
32
+ commit: zod_1.z.string().min(7).optional(),
33
+ raw_score_field: zod_1.z.string().min(1).optional(),
34
+ }),
35
+ tool: zod_1.z.object({
36
+ id: zod_1.z.string().min(1),
37
+ name: zod_1.z.string().min(1),
38
+ provider_id: zod_1.z.string().min(1),
39
+ capability: zod_1.z.string().min(1),
40
+ }),
41
+ score: zod_1.z.object({
42
+ current: zod_1.z.number().min(0).max(100),
43
+ maximum: zod_1.z.literal(100).default(100),
44
+ min_required: zod_1.z.number().min(0).max(100),
45
+ measured_at: isoDateString,
46
+ stale_after_seconds: zod_1.z.number().int().positive(),
47
+ dimensions: zod_1.z.object({
48
+ reliability: zod_1.z.number().min(0).max(100),
49
+ availability: zod_1.z.number().min(0).max(100),
50
+ receipt_integrity: zod_1.z.number().min(0).max(100),
51
+ policy_fit: zod_1.z.number().min(0).max(100),
52
+ }),
53
+ }),
54
+ provider_health: zod_1.z.object({
55
+ status: zod_1.z.enum(['ok', 'degraded', 'failed', 'unknown']),
56
+ success_rate_24h: zod_1.z.number().min(0).max(1),
57
+ last_success_at: isoDateString.optional(),
58
+ stale_streak: zod_1.z.number().int().nonnegative(),
59
+ receipt_state: zod_1.z.enum(['verified', 'pending_acceptance_verified', 'missing', 'invalid', 'unverified']),
60
+ }),
61
+ x402_payment: zod_1.z.object({
62
+ scheme: zod_1.z.literal('exact').default('exact'),
63
+ network: zod_1.z.string().min(1),
64
+ asset: zod_1.z.string().min(1),
65
+ payTo: nonZeroEvmAddress,
66
+ maxAmountRequired: positiveIntegerString,
67
+ }),
68
+ approval_gate: zod_1.z.object({
69
+ fail_closed: zod_1.z.literal(true),
70
+ requires_human_approval: zod_1.z.boolean(),
71
+ decision: zod_1.z.enum(['allow', 'deny']),
72
+ reason: zod_1.z.array(zod_1.z.string().min(1)),
73
+ }),
74
+ });
75
+ function includesCaseInsensitive(values, value) {
76
+ return values.map((entry) => entry.toLowerCase()).includes(value.toLowerCase());
77
+ }
78
+ function scoreAgeMs(proof, now) {
79
+ return now.getTime() - Date.parse(proof.score.measured_at);
80
+ }
81
+ function evaluatePaidToolQualityThreshold(proofInput, policy, now = new Date()) {
82
+ const parsed = exports.PaidToolQualityProofSchema.safeParse(proofInput);
83
+ const failures = [];
84
+ const warnings = [];
85
+ if (!parsed.success) {
86
+ return {
87
+ ok: false,
88
+ decision: 'deny',
89
+ failures: parsed.error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`),
90
+ warnings,
91
+ };
92
+ }
93
+ const proof = parsed.data;
94
+ const measuredAgeMs = scoreAgeMs(proof, now);
95
+ const generatedAgeMs = now.getTime() - Date.parse(proof.generated_at);
96
+ const declaredStaleAfterMs = proof.score.stale_after_seconds * 1000;
97
+ if (generatedAgeMs < 0 || measuredAgeMs < 0) {
98
+ failures.push('Quality proof timestamp is in the future.');
99
+ }
100
+ if (generatedAgeMs > policy.maxScoreAgeMs || measuredAgeMs > policy.maxScoreAgeMs) {
101
+ failures.push(`Quality proof is stale for buyer policy: age ${Math.max(generatedAgeMs, measuredAgeMs)}ms exceeds ${policy.maxScoreAgeMs}ms.`);
102
+ }
103
+ if (measuredAgeMs > declaredStaleAfterMs) {
104
+ failures.push(`Quality score is stale by proof contract: age ${measuredAgeMs}ms exceeds ${declaredStaleAfterMs}ms.`);
105
+ }
106
+ if (proof.score.min_required !== policy.minimumScore) {
107
+ warnings.push(`Proof min_required ${proof.score.min_required} differs from buyer policy ${policy.minimumScore}; buyer policy wins.`);
108
+ }
109
+ if (proof.score.current < policy.minimumScore) {
110
+ failures.push(`Quality score ${proof.score.current} is below required ${policy.minimumScore}.`);
111
+ }
112
+ for (const [dimension, value] of Object.entries(proof.score.dimensions)) {
113
+ if (value < policy.minimumScore) {
114
+ warnings.push(`Quality dimension ${dimension}=${value} is below buyer threshold ${policy.minimumScore}.`);
115
+ }
116
+ }
117
+ if (proof.provider_health.status !== 'ok') {
118
+ failures.push(`Provider health status is ${proof.provider_health.status}.`);
119
+ }
120
+ if (proof.provider_health.success_rate_24h < policy.minimumSuccessRate24h) {
121
+ failures.push(`Provider success_rate_24h ${proof.provider_health.success_rate_24h} is below required ${policy.minimumSuccessRate24h}.`);
122
+ }
123
+ if (proof.provider_health.stale_streak > policy.maxProviderStaleStreak) {
124
+ failures.push(`Provider stale_streak ${proof.provider_health.stale_streak} exceeds ${policy.maxProviderStaleStreak}.`);
125
+ }
126
+ if (policy.requireVerifiedReceipt && proof.provider_health.receipt_state !== 'verified') {
127
+ failures.push(`Provider receipt_state is ${proof.provider_health.receipt_state}.`);
128
+ }
129
+ if (!policy.allowedNetworks.includes(proof.x402_payment.network)) {
130
+ failures.push(`x402 network ${proof.x402_payment.network} is not allowed.`);
131
+ }
132
+ if (!includesCaseInsensitive(policy.allowedAssets, proof.x402_payment.asset)) {
133
+ failures.push(`x402 asset ${proof.x402_payment.asset} is not allowed.`);
134
+ }
135
+ if (!includesCaseInsensitive(policy.allowedPayTo, proof.x402_payment.payTo)) {
136
+ failures.push(`x402 payTo ${proof.x402_payment.payTo} is not allowed.`);
137
+ }
138
+ if (!proof.approval_gate.fail_closed) {
139
+ failures.push('approval_gate.fail_closed must be true.');
140
+ }
141
+ if (policy.requireHumanApproval && !proof.approval_gate.requires_human_approval) {
142
+ failures.push('Human approval is required before signing this paid tool call.');
143
+ }
144
+ if (proof.approval_gate.decision === 'allow' && failures.length > 0) {
145
+ failures.push('Approval gate cannot allow paid work while quality threshold checks fail.');
146
+ }
147
+ const ok = failures.length === 0 && proof.approval_gate.decision === 'allow';
148
+ return {
149
+ ok,
150
+ decision: ok ? 'allow' : 'deny',
151
+ failures,
152
+ warnings,
153
+ };
154
+ }
155
+ //# sourceMappingURL=paid-tool-quality-threshold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paid-tool-quality-threshold.js","sourceRoot":"","sources":["../../src/utils/paid-tool-quality-threshold.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAmGH,4EAiGC;AAlMD,6BAAwB;AAExB,MAAM,aAAa,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE;IACnF,OAAO,EAAE,+BAA+B;CACzC,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,OAAC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,KAAK,CAAC,aAAa,CAAC,uBAAuB,EAAE,CAAC;QAChF,QAAQ,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;IAClF,CAAC;IAED,IAAI,KAAK,CAAC,aAAa,CAAC,QAAQ,KAAK,OAAO,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpE,QAAQ,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;IAC7F,CAAC;IAED,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,QAAQ,KAAK,OAAO,CAAC;IAE7E,OAAO;QACL,EAAE;QACF,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;QAC/B,QAAQ;QACR,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Post-quantum spend-envelope compatibility mapping.
3
+ *
4
+ * This file documents compatibility at the receipt and policy layer only. It
5
+ * does not claim ML-DSA signing, post-quantum key generation, or audit-ledger
6
+ * publication. Those claims must come from cryptographic tests and package
7
+ * inspection before they appear in AgentPay product docs.
8
+ */
9
+ export type AgentPaySpendControl = {
10
+ name: 'spend_limit' | 'allowlist' | 'x402_receipt' | 'approval_gate' | 'audit_metadata';
11
+ agentpayField: string;
12
+ envelopeConcept: string;
13
+ compatibility: 'compatible' | 'requires_adapter' | 'not_implemented';
14
+ nonClaim: string;
15
+ };
16
+ export type SpendEnvelopeCompatibilityReport = {
17
+ status: 'assessment_only';
18
+ controls: AgentPaySpendControl[];
19
+ unsupportedClaims: string[];
20
+ };
21
+ export declare function buildPostQuantumSpendEnvelopeCompatibilityReport(): SpendEnvelopeCompatibilityReport;
22
+ //# sourceMappingURL=post-quantum-spend-envelope-compatibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-quantum-spend-envelope-compatibility.d.ts","sourceRoot":"","sources":["../../src/utils/post-quantum-spend-envelope-compatibility.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,aAAa,GAAG,WAAW,GAAG,cAAc,GAAG,eAAe,GAAG,gBAAgB,CAAC;IACxF,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,YAAY,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;IACrE,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,oBAAoB,EAAE,CAAC;IACjC,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,wBAAgB,gDAAgD,IAAI,gCAAgC,CAgDnG"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /**
3
+ * Post-quantum spend-envelope compatibility mapping.
4
+ *
5
+ * This file documents compatibility at the receipt and policy layer only. It
6
+ * does not claim ML-DSA signing, post-quantum key generation, or audit-ledger
7
+ * publication. Those claims must come from cryptographic tests and package
8
+ * inspection before they appear in AgentPay product docs.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.buildPostQuantumSpendEnvelopeCompatibilityReport = buildPostQuantumSpendEnvelopeCompatibilityReport;
12
+ function buildPostQuantumSpendEnvelopeCompatibilityReport() {
13
+ return {
14
+ status: 'assessment_only',
15
+ controls: [
16
+ {
17
+ name: 'spend_limit',
18
+ agentpayField: 'SpendingPolicy.maxPerTx / dailyCap',
19
+ envelopeConcept: 'maximum authorized spend inside a signed envelope',
20
+ compatibility: 'compatible',
21
+ nonClaim: 'AgentPay does not claim post-quantum signature enforcement for this field.',
22
+ },
23
+ {
24
+ name: 'allowlist',
25
+ agentpayField: 'allowedNetworks / allowedAssets / allowedPayTo',
26
+ envelopeConcept: 'recipient, asset, and route constraints attached to spend intent',
27
+ compatibility: 'compatible',
28
+ nonClaim: 'AgentPay does not claim third-party AP2 or ACP envelope validation without an adapter.',
29
+ },
30
+ {
31
+ name: 'x402_receipt',
32
+ agentpayField: 'x402 receipt id, payment metadata, and settlement reference',
33
+ envelopeConcept: 'receipt pointer for audit and reconciliation',
34
+ compatibility: 'requires_adapter',
35
+ nonClaim: 'AgentPay receipts are not ML-DSA envelopes unless a tested signer creates that envelope.',
36
+ },
37
+ {
38
+ name: 'approval_gate',
39
+ agentpayField: 'approval accepted / declined / cancelled before signing',
40
+ envelopeConcept: 'human or policy approval prior to spend execution',
41
+ compatibility: 'compatible',
42
+ nonClaim: 'AgentPay approval gates do not prove post-quantum identity by themselves.',
43
+ },
44
+ {
45
+ name: 'audit_metadata',
46
+ agentpayField: 'agent_id, task_id, policy_version, receipt_id',
47
+ envelopeConcept: 'audit ledger payload',
48
+ compatibility: 'requires_adapter',
49
+ nonClaim: 'AgentPay does not claim Arbitrum audit-ledger publication from this assessment.',
50
+ },
51
+ ],
52
+ unsupportedClaims: [
53
+ 'ML-DSA-65 signing',
54
+ 'post-quantum key lifecycle',
55
+ 'AP2 envelope conformance',
56
+ 'ACP envelope conformance',
57
+ 'Arbitrum audit-ledger publication',
58
+ ],
59
+ };
60
+ }
61
+ //# sourceMappingURL=post-quantum-spend-envelope-compatibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-quantum-spend-envelope-compatibility.js","sourceRoot":"","sources":["../../src/utils/post-quantum-spend-envelope-compatibility.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAgBH,4GAgDC;AAhDD,SAAgB,gDAAgD;IAC9D,OAAO;QACL,MAAM,EAAE,iBAAiB;QACzB,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,aAAa;gBACnB,aAAa,EAAE,oCAAoC;gBACnD,eAAe,EAAE,mDAAmD;gBACpE,aAAa,EAAE,YAAY;gBAC3B,QAAQ,EAAE,4EAA4E;aACvF;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,aAAa,EAAE,gDAAgD;gBAC/D,eAAe,EAAE,kEAAkE;gBACnF,aAAa,EAAE,YAAY;gBAC3B,QAAQ,EAAE,wFAAwF;aACnG;YACD;gBACE,IAAI,EAAE,cAAc;gBACpB,aAAa,EAAE,6DAA6D;gBAC5E,eAAe,EAAE,8CAA8C;gBAC/D,aAAa,EAAE,kBAAkB;gBACjC,QAAQ,EAAE,0FAA0F;aACrG;YACD;gBACE,IAAI,EAAE,eAAe;gBACrB,aAAa,EAAE,yDAAyD;gBACxE,eAAe,EAAE,mDAAmD;gBACpE,aAAa,EAAE,YAAY;gBAC3B,QAAQ,EAAE,2EAA2E;aACtF;YACD;gBACE,IAAI,EAAE,gBAAgB;gBACtB,aAAa,EAAE,+CAA+C;gBAC9D,eAAe,EAAE,sBAAsB;gBACvC,aAAa,EAAE,kBAAkB;gBACjC,QAAQ,EAAE,iFAAiF;aAC5F;SACF;QACD,iBAAiB,EAAE;YACjB,mBAAmB;YACnB,4BAA4B;YAC5B,0BAA0B;YAC1B,0BAA0B;YAC1B,mCAAmC;SACpC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Wallet-action MCP preflight helpers.
3
+ *
4
+ * Wallet-action MCP servers can expose transfers, swaps, energy buys, and other
5
+ * irreversible actions. Buyer agents should require simulation, spend caps,
6
+ * resource caps, allowlists, and approval copy before any signature is made.
7
+ */
8
+ export type WalletActionKind = 'transfer' | 'swap' | 'resource_purchase' | 'approval' | 'other';
9
+ export type WalletPreflightStatus = 'passed' | 'failed' | 'missing';
10
+ export type WalletActionPreflightProfile = {
11
+ schema: 'agentpay-wallet-action-preflight/v1';
12
+ source: {
13
+ name: string;
14
+ repo?: string;
15
+ evidenceUrl?: string;
16
+ observedAt: string;
17
+ };
18
+ action: {
19
+ kind: WalletActionKind;
20
+ chainNamespace: 'eip155' | 'tvm' | 'xrpl' | 'solana' | 'other';
21
+ chainId?: string | number;
22
+ asset: string;
23
+ amount: string;
24
+ recipient: string;
25
+ nonce?: string;
26
+ irreversible: true;
27
+ };
28
+ simulation: {
29
+ required: true;
30
+ status: WalletPreflightStatus;
31
+ simulationId?: string;
32
+ expectedOutcome: string;
33
+ resourceEstimate: {
34
+ feeAsset: string;
35
+ maxNetworkFee: string;
36
+ energy?: number;
37
+ bandwidth?: number;
38
+ computeUnits?: number;
39
+ };
40
+ };
41
+ policy: {
42
+ perActionSpendCap: string;
43
+ dailyChainSpendCap: string;
44
+ allowedRecipients: string[];
45
+ allowedAssets: string[];
46
+ resourceCaps: {
47
+ maxNetworkFee: string;
48
+ maxEnergy?: number;
49
+ maxBandwidth?: number;
50
+ maxComputeUnits?: number;
51
+ };
52
+ requireHumanApproval: boolean;
53
+ };
54
+ approvalCopy: {
55
+ title: string;
56
+ summary: string;
57
+ lineItems: string[];
58
+ irreversibleWarning: string;
59
+ };
60
+ };
61
+ export type WalletActionPreflightDecision = {
62
+ ok: boolean;
63
+ decision: 'allow' | 'deny';
64
+ failures: string[];
65
+ warnings: string[];
66
+ approvalPrompt: string;
67
+ };
68
+ export declare function evaluateWalletActionPreflight(profile: WalletActionPreflightProfile): WalletActionPreflightDecision;
69
+ export declare function buildTronWalletActionPreflightExample(): WalletActionPreflightProfile;
70
+ //# sourceMappingURL=wallet-action-preflight-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-action-preflight-profile.d.ts","sourceRoot":"","sources":["../../src/utils/wallet-action-preflight-profile.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,MAAM,GAAG,mBAAmB,GAAG,UAAU,GAAG,OAAO,CAAC;AAChG,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEpE,MAAM,MAAM,4BAA4B,GAAG;IACzC,MAAM,EAAE,qCAAqC,CAAC;IAC9C,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI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