x402-trust-layer 5.1.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 (293) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/DEPLOY.md +53 -0
  3. package/Dockerfile +30 -0
  4. package/LICENSE +21 -0
  5. package/README.md +294 -0
  6. package/dist/agents/a2a-payment.d.ts +37 -0
  7. package/dist/agents/a2a-payment.js +105 -0
  8. package/dist/agents/agent-escrow.d.ts +30 -0
  9. package/dist/agents/agent-escrow.js +23 -0
  10. package/dist/agents/agent-verify.d.ts +15 -0
  11. package/dist/agents/agent-verify.js +112 -0
  12. package/dist/agents/api-router.d.ts +32 -0
  13. package/dist/agents/api-router.js +228 -0
  14. package/dist/agents/attestation-registry.d.ts +35 -0
  15. package/dist/agents/attestation-registry.js +76 -0
  16. package/dist/agents/audition-coach.d.ts +45 -0
  17. package/dist/agents/audition-coach.js +257 -0
  18. package/dist/agents/bedrock-bridge.d.ts +3 -0
  19. package/dist/agents/bedrock-bridge.js +60 -0
  20. package/dist/agents/budget-allocator.d.ts +24 -0
  21. package/dist/agents/budget-allocator.js +31 -0
  22. package/dist/agents/compliance-ledger.d.ts +66 -0
  23. package/dist/agents/compliance-ledger.js +80 -0
  24. package/dist/agents/dispute-resolver.d.ts +62 -0
  25. package/dist/agents/dispute-resolver.js +124 -0
  26. package/dist/agents/evidence-locker.d.ts +30 -0
  27. package/dist/agents/evidence-locker.js +47 -0
  28. package/dist/agents/facilitator-failover.d.ts +15 -0
  29. package/dist/agents/facilitator-failover.js +18 -0
  30. package/dist/agents/identity-gate.d.ts +20 -0
  31. package/dist/agents/identity-gate.js +79 -0
  32. package/dist/agents/mandate-compiler.d.ts +51 -0
  33. package/dist/agents/mandate-compiler.js +73 -0
  34. package/dist/agents/mandate-diff.d.ts +41 -0
  35. package/dist/agents/mandate-diff.js +170 -0
  36. package/dist/agents/market-buy-advisor.d.ts +65 -0
  37. package/dist/agents/market-buy-advisor.js +234 -0
  38. package/dist/agents/merchant-trust.d.ts +38 -0
  39. package/dist/agents/merchant-trust.js +171 -0
  40. package/dist/agents/mpp-session-broker.d.ts +27 -0
  41. package/dist/agents/mpp-session-broker.js +29 -0
  42. package/dist/agents/mpp-session-v2.d.ts +76 -0
  43. package/dist/agents/mpp-session-v2.js +269 -0
  44. package/dist/agents/payment-intent-compiler.d.ts +21 -0
  45. package/dist/agents/payment-intent-compiler.js +45 -0
  46. package/dist/agents/pipeline-execute.d.ts +40 -0
  47. package/dist/agents/pipeline-execute.js +100 -0
  48. package/dist/agents/pipeline-trust-v2.d.ts +31 -0
  49. package/dist/agents/pipeline-trust-v2.js +111 -0
  50. package/dist/agents/pre-x402-guard.d.ts +35 -0
  51. package/dist/agents/pre-x402-guard.js +84 -0
  52. package/dist/agents/quality-escrow-semantic.d.ts +88 -0
  53. package/dist/agents/quality-escrow-semantic.js +137 -0
  54. package/dist/agents/quality-escrow.d.ts +65 -0
  55. package/dist/agents/quality-escrow.js +104 -0
  56. package/dist/agents/quality-monitor.d.ts +32 -0
  57. package/dist/agents/quality-monitor.js +77 -0
  58. package/dist/agents/rail-optimizer.d.ts +33 -0
  59. package/dist/agents/rail-optimizer.js +133 -0
  60. package/dist/agents/receipt-auditor.d.ts +14 -0
  61. package/dist/agents/receipt-auditor.js +145 -0
  62. package/dist/agents/refund-arbiter.d.ts +24 -0
  63. package/dist/agents/refund-arbiter.js +70 -0
  64. package/dist/agents/research-brief.d.ts +14 -0
  65. package/dist/agents/research-brief.js +66 -0
  66. package/dist/agents/risk-gate.d.ts +11 -0
  67. package/dist/agents/risk-gate.js +78 -0
  68. package/dist/agents/settlement-graph.d.ts +16 -0
  69. package/dist/agents/settlement-graph.js +38 -0
  70. package/dist/agents/spend-governor.d.ts +2 -0
  71. package/dist/agents/spend-governor.js +70 -0
  72. package/dist/agents/trust-network.d.ts +138 -0
  73. package/dist/agents/trust-network.js +244 -0
  74. package/dist/agents/x402-proxy.d.ts +32 -0
  75. package/dist/agents/x402-proxy.js +90 -0
  76. package/dist/client/demo-alchemy-live.d.ts +1 -0
  77. package/dist/client/demo-alchemy-live.js +226 -0
  78. package/dist/client/demo-tail.d.ts +1 -0
  79. package/dist/client/demo-tail.js +100 -0
  80. package/dist/client/demo.d.ts +1 -0
  81. package/dist/client/demo.js +293 -0
  82. package/dist/config.d.ts +94 -0
  83. package/dist/config.js +223 -0
  84. package/dist/index.d.ts +1 -0
  85. package/dist/index.js +389 -0
  86. package/dist/lib/agent-response.d.ts +14 -0
  87. package/dist/lib/agent-response.js +13 -0
  88. package/dist/lib/agentic-gateways.d.ts +5 -0
  89. package/dist/lib/agentic-gateways.js +15 -0
  90. package/dist/lib/agentic-probes.d.ts +10 -0
  91. package/dist/lib/agentic-probes.js +49 -0
  92. package/dist/lib/alchemy-x402-fetch.d.ts +16 -0
  93. package/dist/lib/alchemy-x402-fetch.js +95 -0
  94. package/dist/lib/apply-verifier-body.d.ts +7 -0
  95. package/dist/lib/apply-verifier-body.js +179 -0
  96. package/dist/lib/attestation.d.ts +30 -0
  97. package/dist/lib/attestation.js +107 -0
  98. package/dist/lib/bazaar-extension.d.ts +15 -0
  99. package/dist/lib/bazaar-extension.js +265 -0
  100. package/dist/lib/bazaar.d.ts +100 -0
  101. package/dist/lib/bazaar.js +341 -0
  102. package/dist/lib/certified-sellers.d.ts +41 -0
  103. package/dist/lib/certified-sellers.js +129 -0
  104. package/dist/lib/chains.d.ts +20 -0
  105. package/dist/lib/chains.js +78 -0
  106. package/dist/lib/db-persistence.d.ts +7 -0
  107. package/dist/lib/db-persistence.js +65 -0
  108. package/dist/lib/db.d.ts +5 -0
  109. package/dist/lib/db.js +113 -0
  110. package/dist/lib/discovery-page.d.ts +2 -0
  111. package/dist/lib/discovery-page.js +71 -0
  112. package/dist/lib/ecosystem-telemetry.d.ts +20 -0
  113. package/dist/lib/ecosystem-telemetry.js +80 -0
  114. package/dist/lib/erc8004/agent-card.d.ts +34 -0
  115. package/dist/lib/erc8004/agent-card.js +151 -0
  116. package/dist/lib/erc8004/cache.d.ts +3 -0
  117. package/dist/lib/erc8004/cache.js +17 -0
  118. package/dist/lib/erc8004/constants.d.ts +22 -0
  119. package/dist/lib/erc8004/constants.js +35 -0
  120. package/dist/lib/erc8004/registry.d.ts +19 -0
  121. package/dist/lib/erc8004/registry.js +171 -0
  122. package/dist/lib/erc8004/resolve-agent.d.ts +7 -0
  123. package/dist/lib/erc8004/resolve-agent.js +70 -0
  124. package/dist/lib/erc8004/trust-score.d.ts +33 -0
  125. package/dist/lib/erc8004/trust-score.js +136 -0
  126. package/dist/lib/escrow-ledger.d.ts +14 -0
  127. package/dist/lib/escrow-ledger.js +54 -0
  128. package/dist/lib/escrow-unified.d.ts +15 -0
  129. package/dist/lib/escrow-unified.js +28 -0
  130. package/dist/lib/facilitator-extra.d.ts +13 -0
  131. package/dist/lib/facilitator-extra.js +52 -0
  132. package/dist/lib/facilitators.d.ts +20 -0
  133. package/dist/lib/facilitators.js +89 -0
  134. package/dist/lib/host-policy.d.ts +4 -0
  135. package/dist/lib/host-policy.js +20 -0
  136. package/dist/lib/idempotency.d.ts +4 -0
  137. package/dist/lib/idempotency.js +120 -0
  138. package/dist/lib/ledger.d.ts +2 -0
  139. package/dist/lib/ledger.js +17 -0
  140. package/dist/lib/logger.d.ts +6 -0
  141. package/dist/lib/logger.js +24 -0
  142. package/dist/lib/mandate-vc.d.ts +20 -0
  143. package/dist/lib/mandate-vc.js +25 -0
  144. package/dist/lib/mandate.d.ts +44 -0
  145. package/dist/lib/mandate.js +190 -0
  146. package/dist/lib/marketplace.d.ts +7 -0
  147. package/dist/lib/marketplace.js +127 -0
  148. package/dist/lib/migrations.d.ts +2 -0
  149. package/dist/lib/migrations.js +130 -0
  150. package/dist/lib/nonce-store.d.ts +6 -0
  151. package/dist/lib/nonce-store.js +109 -0
  152. package/dist/lib/openapi-agentcash.d.ts +5 -0
  153. package/dist/lib/openapi-agentcash.js +288 -0
  154. package/dist/lib/openapi-meta.d.ts +5 -0
  155. package/dist/lib/openapi-meta.js +235 -0
  156. package/dist/lib/otel.d.ts +2 -0
  157. package/dist/lib/otel.js +25 -0
  158. package/dist/lib/paid-resource-url.d.ts +6 -0
  159. package/dist/lib/paid-resource-url.js +47 -0
  160. package/dist/lib/parse-with-verifier-fallback.d.ts +3 -0
  161. package/dist/lib/parse-with-verifier-fallback.js +13 -0
  162. package/dist/lib/payment-request-context.d.ts +10 -0
  163. package/dist/lib/payment-request-context.js +5 -0
  164. package/dist/lib/payment-response.d.ts +13 -0
  165. package/dist/lib/payment-response.js +39 -0
  166. package/dist/lib/payto-guard.d.ts +10 -0
  167. package/dist/lib/payto-guard.js +20 -0
  168. package/dist/lib/probe.d.ts +29 -0
  169. package/dist/lib/probe.js +157 -0
  170. package/dist/lib/problem-detail.d.ts +10 -0
  171. package/dist/lib/problem-detail.js +14 -0
  172. package/dist/lib/rate-limit.d.ts +12 -0
  173. package/dist/lib/rate-limit.js +126 -0
  174. package/dist/lib/replay-middleware.d.ts +3 -0
  175. package/dist/lib/replay-middleware.js +27 -0
  176. package/dist/lib/response-guard.d.ts +5 -0
  177. package/dist/lib/response-guard.js +40 -0
  178. package/dist/lib/safe-fetch.d.ts +5 -0
  179. package/dist/lib/safe-fetch.js +19 -0
  180. package/dist/lib/security.d.ts +13 -0
  181. package/dist/lib/security.js +61 -0
  182. package/dist/lib/semantic-judge.d.ts +14 -0
  183. package/dist/lib/semantic-judge.js +107 -0
  184. package/dist/lib/semantic-judge.test.d.ts +1 -0
  185. package/dist/lib/semantic-judge.test.js +11 -0
  186. package/dist/lib/ssrf.d.ts +10 -0
  187. package/dist/lib/ssrf.js +130 -0
  188. package/dist/lib/ssrf.test.d.ts +1 -0
  189. package/dist/lib/ssrf.test.js +16 -0
  190. package/dist/lib/suite-catalog.d.ts +83 -0
  191. package/dist/lib/suite-catalog.js +131 -0
  192. package/dist/lib/telemetry.d.ts +5 -0
  193. package/dist/lib/telemetry.js +37 -0
  194. package/dist/lib/verifier-fast-path.d.ts +10 -0
  195. package/dist/lib/verifier-fast-path.js +44 -0
  196. package/dist/lib/verifier-probe-protocol.d.ts +7 -0
  197. package/dist/lib/verifier-probe-protocol.js +115 -0
  198. package/dist/lib/verify-examples.d.ts +2 -0
  199. package/dist/lib/verify-examples.js +438 -0
  200. package/dist/lib/version.d.ts +2 -0
  201. package/dist/lib/version.js +2 -0
  202. package/dist/lib/webhook-auth.d.ts +3 -0
  203. package/dist/lib/webhook-auth.js +34 -0
  204. package/dist/lib/webhook-routes.d.ts +2 -0
  205. package/dist/lib/webhook-routes.js +112 -0
  206. package/dist/lib/webhooks.d.ts +23 -0
  207. package/dist/lib/webhooks.js +123 -0
  208. package/dist/lib/webhooks.test.d.ts +1 -0
  209. package/dist/lib/webhooks.test.js +16 -0
  210. package/dist/lib/x402-client-options.d.ts +28 -0
  211. package/dist/lib/x402-client-options.js +138 -0
  212. package/dist/lib/x402-headers.d.ts +10 -0
  213. package/dist/lib/x402-headers.js +27 -0
  214. package/dist/lib/x402-paid.d.ts +5 -0
  215. package/dist/lib/x402-paid.js +252 -0
  216. package/dist/lib/x402-payment-replay.d.ts +22 -0
  217. package/dist/lib/x402-payment-replay.js +57 -0
  218. package/dist/lib/x402gle-host-verify.d.ts +3 -0
  219. package/dist/lib/x402gle-host-verify.js +27 -0
  220. package/dist/protocol/agent-passport.d.ts +34 -0
  221. package/dist/protocol/agent-passport.js +44 -0
  222. package/dist/protocol/compliance-v2.d.ts +21 -0
  223. package/dist/protocol/compliance-v2.js +19 -0
  224. package/dist/protocol/credit-bureau.d.ts +18 -0
  225. package/dist/protocol/credit-bureau.js +44 -0
  226. package/dist/protocol/crypto.d.ts +6 -0
  227. package/dist/protocol/crypto.js +41 -0
  228. package/dist/protocol/escrow-fsm.d.ts +33 -0
  229. package/dist/protocol/escrow-fsm.js +99 -0
  230. package/dist/protocol/fraud-engine.d.ts +28 -0
  231. package/dist/protocol/fraud-engine.js +77 -0
  232. package/dist/protocol/observability.d.ts +14 -0
  233. package/dist/protocol/observability.js +21 -0
  234. package/dist/protocol/pipeline-full-trust.d.ts +40 -0
  235. package/dist/protocol/pipeline-full-trust.js +96 -0
  236. package/dist/protocol/proof-of-execution.d.ts +36 -0
  237. package/dist/protocol/proof-of-execution.js +48 -0
  238. package/dist/protocol/reasoning-audit.d.ts +27 -0
  239. package/dist/protocol/reasoning-audit.js +51 -0
  240. package/dist/protocol/replay-guard.d.ts +28 -0
  241. package/dist/protocol/replay-guard.js +76 -0
  242. package/dist/protocol/replay-guard.test.d.ts +1 -0
  243. package/dist/protocol/replay-guard.test.js +10 -0
  244. package/dist/protocol/security-audit.d.ts +18 -0
  245. package/dist/protocol/security-audit.js +45 -0
  246. package/dist/protocol/store.d.ts +5 -0
  247. package/dist/protocol/store.js +59 -0
  248. package/dist/protocol/threat-catalog.d.ts +13 -0
  249. package/dist/protocol/threat-catalog.js +75 -0
  250. package/dist/protocol/trust-oracle.d.ts +23 -0
  251. package/dist/protocol/trust-oracle.js +30 -0
  252. package/dist/protocol/trust-score-v2.d.ts +33 -0
  253. package/dist/protocol/trust-score-v2.js +78 -0
  254. package/dist/protocol/zk-proofs.d.ts +24 -0
  255. package/dist/protocol/zk-proofs.js +32 -0
  256. package/dist/routes/a2a-agent-card.d.ts +3 -0
  257. package/dist/routes/a2a-agent-card.js +28 -0
  258. package/dist/routes/catalog.d.ts +5 -0
  259. package/dist/routes/catalog.js +47 -0
  260. package/dist/routes/register-all.d.ts +3 -0
  261. package/dist/routes/register-all.js +1240 -0
  262. package/dist/routes/schemas.d.ts +83 -0
  263. package/dist/routes/schemas.js +38 -0
  264. package/dist/routes/shared.d.ts +16 -0
  265. package/dist/routes/shared.js +27 -0
  266. package/dist/routes-protocol.d.ts +10 -0
  267. package/dist/routes-protocol.js +322 -0
  268. package/dist/routes.d.ts +2 -0
  269. package/dist/routes.js +2 -0
  270. package/dist/types.d.ts +66 -0
  271. package/dist/types.js +1 -0
  272. package/openapi.json +7940 -0
  273. package/package.json +124 -0
  274. package/public/.well-known/ai-plugin.json +12 -0
  275. package/public/assets/aegis-logo-blue.png +0 -0
  276. package/public/assets/aegis-logo-gold.png +0 -0
  277. package/public/assets/aegis-logo-green.png +0 -0
  278. package/public/assets/aegis-logo-purple.png +0 -0
  279. package/public/assets/aegis-logo-red.png +0 -0
  280. package/public/assets/aegis-logo-white.png +0 -0
  281. package/public/assets/aegis-logo.png +0 -0
  282. package/public/assets/x402-trustlayer-logo.png +0 -0
  283. package/public/assets/x402-trustlayer-logo.svg +5 -0
  284. package/public/data/agents.json +1528 -0
  285. package/public/index.html +198 -0
  286. package/public/landing.css +342 -0
  287. package/public/landing.js +405 -0
  288. package/public/llms-full.txt +582 -0
  289. package/public/llms.txt +132 -0
  290. package/public/skill.md +135 -0
  291. package/railway.toml +9 -0
  292. package/scripts/docker-entrypoint.sh +7 -0
  293. package/scripts/patch-facilitator-timeout.mjs +61 -0
@@ -0,0 +1,438 @@
1
+ /** Canonical probe bodies used when Dexter AI verifier sends an empty POST body */
2
+ export const VERIFY_EXAMPLES = {
3
+ "/api/x402/proxy": {
4
+ agentId: "dexter-verifier-probe",
5
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
6
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
7
+ estimatedCostUsdc: 0.05,
8
+ policy: { dailyCapUsdc: 10, perCallCapUsdc: 0.5 },
9
+ issueAttestation: true,
10
+ },
11
+ "/api/mpp/session": {
12
+ action: "open",
13
+ expectedCalls: 25,
14
+ avgPricePerCallUsdc: 0.03,
15
+ chain: "solana",
16
+ agentId: "dexter-verifier-probe",
17
+ },
18
+ "/api/attestation/issue": {
19
+ agentId: "dexter-verifier-probe",
20
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
21
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
22
+ estimatedCostUsdc: 0.03,
23
+ policy: { dailyCapUsdc: 10, perCallCapUsdc: 0.5 },
24
+ },
25
+ "/api/attestation/verify": {
26
+ attestationId: "att_verifier_probe_example",
27
+ },
28
+ "/api/guard/pre-x402": {
29
+ agentId: "dexter-verifier-probe",
30
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
31
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
32
+ estimatedCostUsdc: 0.05,
33
+ network: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
34
+ policy: { dailyCapUsdc: 10, perCallCapUsdc: 0.5, allowedHosts: ["myceliasignal.com"] },
35
+ },
36
+ "/api/agent/verify": {
37
+ walletAddress: "0x0000000000000000000000000000000000000001",
38
+ agentId: "1",
39
+ },
40
+ "/api/guard/pre-x402-alchemy": {
41
+ agentId: "alchemy-live-demo-1",
42
+ walletAddress: "0x0000000000000000000000000000000000000001",
43
+ targetUrl: "https://x402.alchemy.com/base-mainnet/v2",
44
+ estimatedCostUsdc: 1,
45
+ network: "eip155:8453",
46
+ policy: { dailyCapUsdc: 20, perCallCapUsdc: 2, allowedHosts: ["x402.alchemy.com"] },
47
+ },
48
+ "/api/pipeline/execute": {
49
+ agentId: "dexter-verifier-probe",
50
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
51
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
52
+ estimatedCostUsdc: 0.05,
53
+ network: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
54
+ policy: { dailyCapUsdc: 10, perCallCapUsdc: 0.5, allowedHosts: ["myceliasignal.com"] },
55
+ task: "ETH oracle with guard and marketplace routing under one dollar",
56
+ maxBudgetUsdc: 1,
57
+ marketplaceQuery: "ETH USD spot price oracle",
58
+ preferNetwork: "solana",
59
+ },
60
+ "/api/payment-intent/compile": {
61
+ task: "Verify spend policy for ETH oracle call under one dollar budget",
62
+ maxBudgetUsdc: 1,
63
+ agentId: "dexter-verifier-probe",
64
+ externalCallEstimateUsdc: 0.05,
65
+ },
66
+ "/api/facilitator/failover": {
67
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
68
+ preferNetwork: "solana",
69
+ fastProbe: true,
70
+ },
71
+ "/api/mpp/session-plan": {
72
+ action: "estimate",
73
+ expectedCalls: 25,
74
+ avgPricePerCallUsdc: 0.03,
75
+ },
76
+ "/api/spend-governor/check": {
77
+ agentId: "dexter-verifier-probe",
78
+ estimatedCostUsdc: 0.03,
79
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
80
+ network: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
81
+ policy: { dailyCapUsdc: 10, perCallCapUsdc: 0.5, allowedHosts: ["myceliasignal.com"] },
82
+ },
83
+ "/api/identity-gate/check": {
84
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
85
+ maxTierSpendUsdc: 10,
86
+ },
87
+ "/api/risk-gate/scan": {
88
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
89
+ estimatedCostUsdc: 0.05,
90
+ policy: { dailyCapUsdc: 10, perCallCapUsdc: 0.5 },
91
+ },
92
+ "/api/router/route": {
93
+ query: "Dexter USDC route from Arbitrum to Ethereum",
94
+ preferNetwork: "arbitrum",
95
+ maxPriceUsdc: 0.9985,
96
+ skipProbes: true,
97
+ },
98
+ "/api/research/brief": {
99
+ topic: "Ethereum network fees today",
100
+ includePrice: true,
101
+ fastProbe: true,
102
+ },
103
+ "/api/receipt-auditor/verify": {
104
+ network: "eip155:8453",
105
+ expectedAmountUsdc: 0.05,
106
+ transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000001",
107
+ settlement: {
108
+ transaction: "0x0000000000000000000000000000000000000000000000000000000000000001",
109
+ amountUsdc: 0.05,
110
+ network: "eip155:8453",
111
+ payer: "0x0000000000000000000000000000000000000001",
112
+ },
113
+ },
114
+ "/api/refund-arbiter/evaluate": {
115
+ verificationScore: 85,
116
+ responseEmpty: false,
117
+ responseGeneric: false,
118
+ endpointReachable: true,
119
+ },
120
+ "/api/budget-allocator/run": {
121
+ fleetId: "verifier-fleet",
122
+ poolRemainingUsdc: 1,
123
+ agents: [
124
+ { agentId: "a1", priority: 10, requestedUsdc: 0.2, dailyRemainingUsdc: 5 },
125
+ ],
126
+ },
127
+ "/api/settlement-graph/next": {
128
+ lastEndpointPath: "/api/spend-governor/check",
129
+ lastTopic: "agent spend policy",
130
+ },
131
+ "/api/quality-monitor/probe": {
132
+ urls: ["https://x402trustlayer.xyz/health"],
133
+ },
134
+ "/api/evidence-locker/export": {
135
+ organizationId: "verifier-org",
136
+ records: [
137
+ {
138
+ endpoint: "/api/spend-governor/check",
139
+ amountUsdc: 0.03,
140
+ network: "solana",
141
+ timestamp: new Date().toISOString(),
142
+ },
143
+ ],
144
+ },
145
+ "/api/agent-escrow": {
146
+ action: "create",
147
+ payerAgentId: "verifier-payer",
148
+ payeeAgentId: "verifier-payee",
149
+ amountUsdc: 0.05,
150
+ releaseCondition: "receipt-auditor valid:true",
151
+ },
152
+ "/api/market/buy-advisor": {
153
+ intent: "ETH USD spot price oracle for trading bot",
154
+ agentId: "dexter-verifier-probe",
155
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
156
+ preferNetwork: "eip155:8453",
157
+ maxPriceUsdc: 0.15,
158
+ expectedCalls: 12,
159
+ policy: { dailyCapUsdc: 10, perCallCapUsdc: 0.5, allowedHosts: ["myceliasignal.com", "dexter.cash"] },
160
+ dryRunTarget: true,
161
+ },
162
+ "/api/seller/audition-coach": {
163
+ origin: "https://x402trustlayer.xyz",
164
+ maxRoutes: 3,
165
+ },
166
+ "/api/merchant-trust/score": {
167
+ host: "api.myceliasignal.com",
168
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
169
+ observedTxns: 54,
170
+ observedVolumeUsdc: 1.76,
171
+ washTradePct: 17,
172
+ verifiedResources: 44,
173
+ totalResources: 91,
174
+ p50LatencyMs: 1200,
175
+ probe: false,
176
+ },
177
+ "/api/mandate/compile": {
178
+ principal: "cardholder:dexter-verifier",
179
+ agentId: "dexter-verifier-probe",
180
+ intent: "Buy ETH/USD oracle data for a trading bot, under $1 per call, daily $10 cap",
181
+ maxPerTxUsdc: 0.5,
182
+ dailyCapUsdc: 10,
183
+ allowedMerchants: ["myceliasignal.com", "dexter.cash"],
184
+ allowedCategories: ["market-data", "oracle"],
185
+ allowedRails: ["base-x402", "solana-x402", "visa-cli"],
186
+ ttlMinutes: 1440,
187
+ },
188
+ "/api/mandate/verify": {
189
+ mandateId: "mdt_verifier_probe_example",
190
+ proposed: {
191
+ amountUsdc: 0.05,
192
+ merchant: "api.myceliasignal.com",
193
+ category: "oracle",
194
+ rail: "base-x402",
195
+ },
196
+ },
197
+ "/api/rail-optimizer/route": {
198
+ amountUsdc: 1.5,
199
+ disputable: true,
200
+ latencySensitive: false,
201
+ expectedCalls: 1,
202
+ },
203
+ "/api/compliance/ledger": {
204
+ organizationId: "verifier-org",
205
+ period: "2026-05",
206
+ records: [
207
+ {
208
+ merchant: "api.myceliasignal.com",
209
+ amountUsdc: 0.05,
210
+ rail: "base-x402",
211
+ network: "eip155:8453",
212
+ category: "oracle",
213
+ agentId: "dexter-verifier-probe",
214
+ transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000001",
215
+ timestamp: new Date().toISOString(),
216
+ },
217
+ ],
218
+ policy: { monthlyCapUsdc: 1000, perMerchantCapUsdc: 500, requireTxHash: true },
219
+ },
220
+ "/api/dispute/resolve": {
221
+ rail: "visa-cli",
222
+ merchant: "api.myceliasignal.com",
223
+ amountUsdc: 1.0,
224
+ reason: "non_delivery",
225
+ evidence: { actualResponseEmpty: true, receiptValid: false },
226
+ },
227
+ "/api/quality-escrow/settle": {
228
+ action: "settle",
229
+ payerAgentId: "dexter-verifier-probe",
230
+ payeeMerchant: "api.myceliasignal.com",
231
+ amountUsdc: 0.05,
232
+ releaseThreshold: 70,
233
+ expectedProfile: { requiredKeys: ["price", "symbol"], minLengthBytes: 16, forbidEmpty: true },
234
+ actualResponse: { bodyKeys: ["price", "symbol", "ts"], byteLength: 64, empty: false },
235
+ },
236
+ "/api/quality-escrow/semantic-settle": {
237
+ action: "settle",
238
+ deliveryIntent: "ETH/USD spot oracle price with symbol",
239
+ payerAgentId: "dexter-verifier-probe",
240
+ payeeMerchant: "api.myceliasignal.com",
241
+ amountUsdc: 0.05,
242
+ releaseThreshold: 72,
243
+ expectedProfile: { requiredKeys: ["price", "symbol"], forbidEmpty: true },
244
+ actualResponse: {
245
+ bodyKeys: ["price", "symbol"],
246
+ byteLength: 48,
247
+ empty: false,
248
+ fields: { price: 3450.12, symbol: "ETH" },
249
+ sample: '{"price":3450.12,"symbol":"ETH"}',
250
+ },
251
+ },
252
+ "/api/mandate/diff": {
253
+ mandateId: "mdt_verifier_probe_example",
254
+ task: "Buy ETH/USD oracle data for trading bot",
255
+ toolCalls: [
256
+ {
257
+ name: "x402_fetch",
258
+ url: "https://api.myceliasignal.com/oracle/price/eth/usd",
259
+ amountUsdc: 0.05,
260
+ merchant: "api.myceliasignal.com",
261
+ category: "oracle",
262
+ rail: "base-x402",
263
+ },
264
+ ],
265
+ proposed: {
266
+ amountUsdc: 0.05,
267
+ merchant: "api.myceliasignal.com",
268
+ category: "oracle",
269
+ rail: "base-x402",
270
+ },
271
+ },
272
+ "/api/merchant-trust/certify": {
273
+ host: "api.myceliasignal.com",
274
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
275
+ washTradePct: 12,
276
+ verifiedResources: 44,
277
+ totalResources: 91,
278
+ probe: false,
279
+ ttlDays: 30,
280
+ policy: { requireAttestation: true, minAgentTier: "SILVER", minTrustScore: 50, minSecurityGrade: "C" },
281
+ goodResponseProfile: { requiredKeys: ["price", "symbol"], forbidEmpty: true },
282
+ },
283
+ "/api/trust-network/buyer-gate": {
284
+ sellerHost: "api.myceliasignal.com",
285
+ walletAddress: "0x0000000000000000000000000000000000000001",
286
+ attestationId: "att_verifier_probe_example",
287
+ agentTier: "GOLD",
288
+ trustScore: 75,
289
+ },
290
+ "/api/pipeline/trust-v2": {
291
+ agentId: "dexter-verifier-probe",
292
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
293
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
294
+ estimatedCostUsdc: 0.05,
295
+ policy: { dailyCapUsdc: 10, perCallCapUsdc: 0.5, allowedHosts: ["myceliasignal.com"] },
296
+ mandateId: "mdt_verifier_probe_example",
297
+ toolCalls: [
298
+ {
299
+ name: "x402_fetch",
300
+ url: "https://api.myceliasignal.com/oracle/price/eth/usd",
301
+ amountUsdc: 0.05,
302
+ merchant: "api.myceliasignal.com",
303
+ rail: "base-x402",
304
+ },
305
+ ],
306
+ sellerHost: "api.myceliasignal.com",
307
+ kymBeforePay: true,
308
+ },
309
+ "/api/trust-network/bond/slash": {
310
+ sellerHost: "api.myceliasignal.com",
311
+ amountUsdc: 0.02,
312
+ reason: "semantic_delivery_fail",
313
+ qualityScore: 42,
314
+ },
315
+ "/api/protocol/pipeline/full-trust": {
316
+ agentId: "dexter-verifier-probe",
317
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
318
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
319
+ estimatedCostUsdc: 0.05,
320
+ organizationId: "verifier-org",
321
+ policy: { dailyCapUsdc: 10, perCallCapUsdc: 0.5, allowedHosts: ["myceliasignal.com"] },
322
+ },
323
+ "/api/protocol/passport/issue": {
324
+ agentId: "dexter-verifier-probe",
325
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
326
+ capabilities: ["x402.pay", "tool.invoke"],
327
+ },
328
+ "/api/protocol/trust-score/v2": {
329
+ agentId: "dexter-verifier-probe",
330
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
331
+ uptimePct: 99,
332
+ deliveryQualityScore: 85,
333
+ },
334
+ "/api/protocol/fraud/scan": {
335
+ agentId: "dexter-verifier-probe",
336
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
337
+ merchantHost: "api.myceliasignal.com",
338
+ amountUsdc: 0.05,
339
+ },
340
+ "/api/protocol/execution/issue": {
341
+ agentId: "dexter-verifier-probe",
342
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
343
+ toolTrace: [{ name: "x402_fetch", url: "https://api.myceliasignal.com/oracle/price/eth/usd", amountUsdc: 0.05 }],
344
+ decisionTrace: ["guard_pass", "payment_settled"],
345
+ responseSummary: '{"price":3450,"symbol":"ETH"}',
346
+ },
347
+ "/api/protocol/replay/bind": {
348
+ agentId: "dexter-verifier-probe",
349
+ resourceUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
350
+ requestBody: { estimatedCostUsdc: 0.05 },
351
+ },
352
+ "/api/protocol/credit/score": {
353
+ agentId: "dexter-verifier-probe",
354
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
355
+ settlementCount: 12,
356
+ disputeCount: 0,
357
+ },
358
+ "/api/a2a/execute": {
359
+ buyerAgentId: "dexter-verifier-probe",
360
+ sellerAgentId: "seller-oracle-1",
361
+ sellerEndpoint: "https://x402trustlayer.xyz/api/guard/pre-x402",
362
+ taskDescription: "Preflight guard check for ETH oracle call under $0.10",
363
+ maxBudgetUsdc: 0.1,
364
+ },
365
+ "/api/bedrock/preflight": {
366
+ actionGroup: "TrustLayerGuard",
367
+ apiPath: "/guard/pre-x402",
368
+ requestBody: {
369
+ content: {
370
+ "application/json": {
371
+ properties: {
372
+ agentId: "bedrock-agent",
373
+ walletAddress: "9c7tE587KpGYBjiNQrjw3nGvxQHhSYKU4Ba6WRgQsHkt",
374
+ targetUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
375
+ estimatedCostUsdc: 0.05,
376
+ },
377
+ },
378
+ },
379
+ },
380
+ },
381
+ "/api/protocol/passport/verify": {
382
+ did: "did:agent:dexter_verifier_probe:0000000000000001",
383
+ },
384
+ "/api/protocol/oracle/consensus": {
385
+ subjectType: "agent",
386
+ subjectId: "dexter-verifier-probe",
387
+ claims: { trustScore: 82, deliveryQuality: 85 },
388
+ minQuorum: 3,
389
+ },
390
+ "/api/protocol/execution/verify": {
391
+ receiptId: "poe_verifier_probe_example",
392
+ },
393
+ "/api/protocol/reasoning/commit": {
394
+ agentId: "dexter-verifier-probe",
395
+ sessionId: "sess_verifier_probe",
396
+ toolCalls: [{ name: "x402_fetch", argsHash: "abc123" }],
397
+ policyChecks: ["spend_cap_ok", "host_allowed"],
398
+ promptHashes: ["prompt_hash_verifier_probe"],
399
+ riskAnalysis: "low",
400
+ },
401
+ "/api/protocol/reasoning/disclose": {
402
+ auditId: "aud_verifier_probe_example",
403
+ leafIndices: [0, 1],
404
+ },
405
+ "/api/protocol/escrow/create": {
406
+ payerAgentId: "dexter-verifier-probe",
407
+ payeeMerchant: "api.myceliasignal.com",
408
+ amountUsdc: 0.05,
409
+ resourceHash: "res_verifier_probe",
410
+ },
411
+ "/api/protocol/escrow/transition": {
412
+ escrowId: "00000000-0000-4000-8000-000000000001",
413
+ nextState: "FUNDED",
414
+ note: "verifier probe transition",
415
+ },
416
+ "/api/protocol/escrow/status": {
417
+ escrowId: "00000000-0000-4000-8000-000000000001",
418
+ },
419
+ "/api/protocol/replay/verify": {
420
+ bindingId: "rb_verifier_probe_example",
421
+ resourceUrl: "https://api.myceliasignal.com/oracle/price/eth/usd",
422
+ requestBody: { estimatedCostUsdc: 0.05 },
423
+ },
424
+ "/api/protocol/zk/prove": {
425
+ proofType: "authorization",
426
+ agentId: "dexter-verifier-probe",
427
+ witness: { dailyCapUsdc: 10, spentTodayUsdc: 0 },
428
+ publicInputs: { agentId: "dexter-verifier-probe" },
429
+ },
430
+ "/api/protocol/compliance/assess": {
431
+ organizationId: "verifier-org",
432
+ agentId: "dexter-verifier-probe",
433
+ jurisdiction: "US",
434
+ monthlyVolumeUsdc: 500,
435
+ rails: ["base-x402", "solana-x402"],
436
+ requiresKyc: false,
437
+ },
438
+ };
@@ -0,0 +1,2 @@
1
+ /** Single source of truth for API / OpenAPI / discovery version strings */
2
+ export declare const SUITE_VERSION: "5.1.0";
@@ -0,0 +1,2 @@
1
+ /** Single source of truth for API / OpenAPI / discovery version strings */
2
+ export const SUITE_VERSION = "5.1.0";
@@ -0,0 +1,3 @@
1
+ import type { Request, Response } from "express";
2
+ /** Require WEBHOOK_ADMIN_SECRET in production for webhook management routes. */
3
+ export declare function requireWebhookAdmin(req: Request, res: Response): boolean;
@@ -0,0 +1,34 @@
1
+ import { timingSafeEqual } from "node:crypto";
2
+ import { config } from "../config.js";
3
+ function isProduction() {
4
+ return process.env.NODE_ENV === "production" || !!process.env.RAILWAY_ENVIRONMENT;
5
+ }
6
+ function secretsMatch(expected, provided) {
7
+ if (expected.length !== provided.length)
8
+ return false;
9
+ try {
10
+ return timingSafeEqual(Buffer.from(expected, "utf8"), Buffer.from(provided, "utf8"));
11
+ }
12
+ catch {
13
+ return false;
14
+ }
15
+ }
16
+ /** Require WEBHOOK_ADMIN_SECRET in production for webhook management routes. */
17
+ export function requireWebhookAdmin(req, res) {
18
+ if (!isProduction())
19
+ return true;
20
+ const secret = config.webhookAdminSecret;
21
+ if (!secret) {
22
+ res.status(503).json({
23
+ error: "Webhook management disabled — set WEBHOOK_ADMIN_SECRET in production",
24
+ });
25
+ return false;
26
+ }
27
+ const raw = req.headers["x-webhook-admin-secret"];
28
+ const provided = Array.isArray(raw) ? raw[0] : raw;
29
+ if (typeof provided !== "string" || !secretsMatch(secret, provided)) {
30
+ res.status(403).json({ error: "Forbidden — invalid X-Webhook-Admin-Secret" });
31
+ return false;
32
+ }
33
+ return true;
34
+ }
@@ -0,0 +1,2 @@
1
+ import type { Express } from "express";
2
+ export declare function registerWebhookRoutes(app: Express): void;
@@ -0,0 +1,112 @@
1
+ import { timingSafeEqual } from "node:crypto";
2
+ import { z } from "zod";
3
+ import { UnsafeUrlError } from "./ssrf.js";
4
+ import { deactivateWebhook, dispatchWebhooks, listWebhooks, registerWebhook, } from "./webhooks.js";
5
+ import { requireWebhookAdmin } from "./webhook-auth.js";
6
+ function isProduction() {
7
+ return process.env.NODE_ENV === "production" || !!process.env.RAILWAY_ENVIRONMENT;
8
+ }
9
+ const eventSchema = z.enum([
10
+ "guard.denied",
11
+ "guard.allowed",
12
+ "receipt.invalid",
13
+ "spend.cap_exceeded",
14
+ "merchant.trust_low",
15
+ ]);
16
+ export function registerWebhookRoutes(app) {
17
+ app.post("/api/webhooks/register", async (req, res) => {
18
+ if (!requireWebhookAdmin(req, res))
19
+ return;
20
+ const parsed = z
21
+ .object({
22
+ fleetId: z.string().min(1),
23
+ url: z.string().url(),
24
+ events: z.array(eventSchema).min(1),
25
+ })
26
+ .safeParse(req.body);
27
+ if (!parsed.success) {
28
+ res.status(400).json({ error: parsed.error.flatten() });
29
+ return;
30
+ }
31
+ try {
32
+ const sub = await registerWebhook(parsed.data);
33
+ res.status(201).json({
34
+ ok: true,
35
+ subscription: {
36
+ id: sub.id,
37
+ fleetId: sub.fleetId,
38
+ url: sub.url,
39
+ events: sub.events,
40
+ secret: sub.secret,
41
+ createdAt: sub.createdAt,
42
+ },
43
+ note: "Deliveries signed with x-hub-signature-256 (HMAC-SHA256).",
44
+ });
45
+ }
46
+ catch (err) {
47
+ const msg = err instanceof UnsafeUrlError ? err.message : "Invalid webhook URL";
48
+ res.status(400).json({ error: msg });
49
+ }
50
+ });
51
+ app.get("/api/webhooks/list", async (req, res) => {
52
+ if (!requireWebhookAdmin(req, res))
53
+ return;
54
+ const fleetId = typeof req.query.fleetId === "string" ? req.query.fleetId : undefined;
55
+ const subs = await listWebhooks(fleetId);
56
+ res.json({
57
+ ok: true,
58
+ count: subs.length,
59
+ subscriptions: subs.map((s) => ({
60
+ id: s.id,
61
+ fleetId: s.fleetId,
62
+ url: s.url,
63
+ events: s.events,
64
+ createdAt: s.createdAt,
65
+ active: s.active,
66
+ })),
67
+ });
68
+ });
69
+ app.delete("/api/webhooks/:id", async (req, res) => {
70
+ if (!requireWebhookAdmin(req, res))
71
+ return;
72
+ const fleetId = typeof req.query.fleetId === "string" ? req.query.fleetId : "";
73
+ if (!fleetId) {
74
+ res.status(400).json({ error: "fleetId query param required" });
75
+ return;
76
+ }
77
+ const ok = await deactivateWebhook(req.params.id, fleetId);
78
+ if (!ok) {
79
+ res.status(404).json({ error: "Webhook not found" });
80
+ return;
81
+ }
82
+ res.json({ ok: true, deactivated: req.params.id });
83
+ });
84
+ app.post("/api/webhooks/test-dispatch", async (req, res) => {
85
+ if (isProduction()) {
86
+ const secret = process.env.WEBHOOK_TEST_SECRET?.trim();
87
+ const raw = req.headers["x-webhook-test-secret"];
88
+ const provided = Array.isArray(raw) ? raw[0] : raw;
89
+ const ok = secret &&
90
+ typeof provided === "string" &&
91
+ secret.length === provided.length &&
92
+ timingSafeEqual(Buffer.from(secret, "utf8"), Buffer.from(provided, "utf8"));
93
+ if (!ok) {
94
+ res.status(403).json({ error: "Forbidden — set WEBHOOK_TEST_SECRET and X-Webhook-Test-Secret header" });
95
+ return;
96
+ }
97
+ }
98
+ const parsed = z
99
+ .object({
100
+ fleetId: z.string().optional(),
101
+ event: eventSchema,
102
+ payload: z.record(z.unknown()).optional(),
103
+ })
104
+ .safeParse(req.body);
105
+ if (!parsed.success) {
106
+ res.status(400).json({ error: parsed.error.flatten() });
107
+ return;
108
+ }
109
+ const result = await dispatchWebhooks(parsed.data.event, parsed.data.payload ?? { test: true }, parsed.data.fleetId);
110
+ res.json({ ok: true, ...result });
111
+ });
112
+ }
@@ -0,0 +1,23 @@
1
+ export type WebhookEvent = "guard.denied" | "guard.allowed" | "receipt.invalid" | "spend.cap_exceeded" | "merchant.trust_low";
2
+ export type WebhookSubscription = {
3
+ id: string;
4
+ fleetId: string;
5
+ url: string;
6
+ events: WebhookEvent[];
7
+ secret: string;
8
+ createdAt: string;
9
+ active: boolean;
10
+ };
11
+ /** Reject SSRF targets (localhost, metadata, private IPs) for outbound webhook delivery. */
12
+ export declare function assertValidWebhookUrl(url: string): void;
13
+ export declare function registerWebhook(input: {
14
+ fleetId: string;
15
+ url: string;
16
+ events: WebhookEvent[];
17
+ }): Promise<WebhookSubscription>;
18
+ export declare function listWebhooks(fleetId?: string): Promise<WebhookSubscription[]>;
19
+ export declare function deactivateWebhook(id: string, fleetId: string): Promise<boolean>;
20
+ export declare function dispatchWebhooks(event: WebhookEvent, payload: Record<string, unknown>, fleetId?: string): Promise<{
21
+ delivered: number;
22
+ failed: number;
23
+ }>;