@absol-labs/agent 0.10.0 → 0.12.0-rc.1

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 (331) hide show
  1. package/README.md +106 -30
  2. package/dist/capability/invocation-capability.d.ts +20 -8
  3. package/dist/capability/invocation-capability.d.ts.map +1 -1
  4. package/dist/capability/invocation-capability.js.map +1 -1
  5. package/dist/capability/probe-capability.d.ts +225 -0
  6. package/dist/capability/probe-capability.d.ts.map +1 -0
  7. package/dist/capability/probe-capability.js +248 -0
  8. package/dist/capability/probe-capability.js.map +1 -0
  9. package/dist/cli/args.d.ts +11 -0
  10. package/dist/cli/args.d.ts.map +1 -1
  11. package/dist/cli/args.js +23 -0
  12. package/dist/cli/args.js.map +1 -1
  13. package/dist/cli/commands/claim.d.ts.map +1 -1
  14. package/dist/cli/commands/claim.js +21 -5
  15. package/dist/cli/commands/claim.js.map +1 -1
  16. package/dist/cli/commands/close.d.ts.map +1 -1
  17. package/dist/cli/commands/close.js +51 -7
  18. package/dist/cli/commands/close.js.map +1 -1
  19. package/dist/cli/commands/invoke.d.ts +2 -0
  20. package/dist/cli/commands/invoke.d.ts.map +1 -1
  21. package/dist/cli/commands/invoke.js +3 -2
  22. package/dist/cli/commands/invoke.js.map +1 -1
  23. package/dist/cli/commands/mcp.d.ts.map +1 -1
  24. package/dist/cli/commands/mcp.js +15 -2
  25. package/dist/cli/commands/mcp.js.map +1 -1
  26. package/dist/cli/commands/open.d.ts.map +1 -1
  27. package/dist/cli/commands/open.js +121 -15
  28. package/dist/cli/commands/open.js.map +1 -1
  29. package/dist/cli/commands/pay.d.ts +19 -0
  30. package/dist/cli/commands/pay.d.ts.map +1 -0
  31. package/dist/cli/commands/pay.js +355 -0
  32. package/dist/cli/commands/pay.js.map +1 -0
  33. package/dist/cli/commands/reclaim-unverified.d.ts.map +1 -1
  34. package/dist/cli/commands/reclaim-unverified.js +15 -6
  35. package/dist/cli/commands/reclaim-unverified.js.map +1 -1
  36. package/dist/cli/commands/reclaim.d.ts +23 -2
  37. package/dist/cli/commands/reclaim.d.ts.map +1 -1
  38. package/dist/cli/commands/reclaim.js +200 -21
  39. package/dist/cli/commands/reclaim.js.map +1 -1
  40. package/dist/cli/commands/refund.d.ts +13 -0
  41. package/dist/cli/commands/refund.d.ts.map +1 -0
  42. package/dist/cli/commands/refund.js +224 -0
  43. package/dist/cli/commands/refund.js.map +1 -0
  44. package/dist/cli/commands/status.d.ts.map +1 -1
  45. package/dist/cli/commands/status.js +10 -1
  46. package/dist/cli/commands/status.js.map +1 -1
  47. package/dist/cli/commands/streams.js +9 -13
  48. package/dist/cli/commands/streams.js.map +1 -1
  49. package/dist/cli/commands/watch.d.ts.map +1 -1
  50. package/dist/cli/commands/watch.js +2 -1
  51. package/dist/cli/commands/watch.js.map +1 -1
  52. package/dist/cli/config.d.ts +44 -26
  53. package/dist/cli/config.d.ts.map +1 -1
  54. package/dist/cli/config.js +88 -38
  55. package/dist/cli/config.js.map +1 -1
  56. package/dist/cli/deps.d.ts +86 -7
  57. package/dist/cli/deps.d.ts.map +1 -1
  58. package/dist/cli/deps.js +102 -16
  59. package/dist/cli/deps.js.map +1 -1
  60. package/dist/cli/errors.d.ts.map +1 -1
  61. package/dist/cli/errors.js +21 -1
  62. package/dist/cli/errors.js.map +1 -1
  63. package/dist/cli/escape-hatch.d.ts +6 -4
  64. package/dist/cli/escape-hatch.d.ts.map +1 -1
  65. package/dist/cli/escape-hatch.js +6 -2
  66. package/dist/cli/escape-hatch.js.map +1 -1
  67. package/dist/cli/listings.d.ts +18 -0
  68. package/dist/cli/listings.d.ts.map +1 -1
  69. package/dist/cli/listings.js +22 -12
  70. package/dist/cli/listings.js.map +1 -1
  71. package/dist/cli/preflight.d.ts +20 -14
  72. package/dist/cli/preflight.d.ts.map +1 -1
  73. package/dist/cli/preflight.js +34 -20
  74. package/dist/cli/preflight.js.map +1 -1
  75. package/dist/cli/privy.d.ts +83 -0
  76. package/dist/cli/privy.d.ts.map +1 -0
  77. package/dist/cli/privy.js +232 -0
  78. package/dist/cli/privy.js.map +1 -0
  79. package/dist/cli/reclaimability.d.ts +82 -0
  80. package/dist/cli/reclaimability.d.ts.map +1 -0
  81. package/dist/cli/reclaimability.js +80 -0
  82. package/dist/cli/reclaimability.js.map +1 -0
  83. package/dist/cli/run.d.ts +2 -1
  84. package/dist/cli/run.d.ts.map +1 -1
  85. package/dist/cli/run.js +40 -11
  86. package/dist/cli/run.js.map +1 -1
  87. package/dist/cli/scan-range.d.ts +2 -2
  88. package/dist/cli/scan-range.js +2 -2
  89. package/dist/cli/spend-policy.d.ts +60 -0
  90. package/dist/cli/spend-policy.d.ts.map +1 -0
  91. package/dist/cli/spend-policy.js +65 -0
  92. package/dist/cli/spend-policy.js.map +1 -0
  93. package/dist/cli/status.d.ts +3 -1
  94. package/dist/cli/status.d.ts.map +1 -1
  95. package/dist/cli/status.js +15 -3
  96. package/dist/cli/status.js.map +1 -1
  97. package/dist/cli/wallet.d.ts +109 -40
  98. package/dist/cli/wallet.d.ts.map +1 -1
  99. package/dist/cli/wallet.js +109 -44
  100. package/dist/cli/wallet.js.map +1 -1
  101. package/dist/discovery/rate-band.d.ts +74 -0
  102. package/dist/discovery/rate-band.d.ts.map +1 -0
  103. package/dist/discovery/rate-band.js +114 -0
  104. package/dist/discovery/rate-band.js.map +1 -0
  105. package/dist/escrow-generation.d.ts +81 -0
  106. package/dist/escrow-generation.d.ts.map +1 -0
  107. package/dist/escrow-generation.js +76 -0
  108. package/dist/escrow-generation.js.map +1 -0
  109. package/dist/frameworks/agentkit.d.ts +8 -4
  110. package/dist/frameworks/agentkit.d.ts.map +1 -1
  111. package/dist/frameworks/agentkit.js +27 -10
  112. package/dist/frameworks/agentkit.js.map +1 -1
  113. package/dist/frameworks/eliza.d.ts +3 -3
  114. package/dist/frameworks/eliza.d.ts.map +1 -1
  115. package/dist/frameworks/eliza.js +15 -6
  116. package/dist/frameworks/eliza.js.map +1 -1
  117. package/dist/frameworks/langchain.d.ts.map +1 -1
  118. package/dist/frameworks/langchain.js +8 -0
  119. package/dist/frameworks/langchain.js.map +1 -1
  120. package/dist/gateway/caller-auth-gateway.d.ts +91 -4
  121. package/dist/gateway/caller-auth-gateway.d.ts.map +1 -1
  122. package/dist/gateway/caller-auth-gateway.js +184 -7
  123. package/dist/gateway/caller-auth-gateway.js.map +1 -1
  124. package/dist/gateway/http-server.d.ts +121 -1
  125. package/dist/gateway/http-server.d.ts.map +1 -1
  126. package/dist/gateway/http-server.js +474 -5
  127. package/dist/gateway/http-server.js.map +1 -1
  128. package/dist/gateway/probe-auth.d.ts +112 -0
  129. package/dist/gateway/probe-auth.d.ts.map +1 -0
  130. package/dist/gateway/probe-auth.js +127 -0
  131. package/dist/gateway/probe-auth.js.map +1 -0
  132. package/dist/gateway/signed-rate-bounds.d.ts +51 -0
  133. package/dist/gateway/signed-rate-bounds.d.ts.map +1 -0
  134. package/dist/gateway/signed-rate-bounds.js +94 -0
  135. package/dist/gateway/signed-rate-bounds.js.map +1 -0
  136. package/dist/gateway/x402-opener-mode.d.ts +215 -0
  137. package/dist/gateway/x402-opener-mode.d.ts.map +1 -0
  138. package/dist/gateway/x402-opener-mode.js +639 -0
  139. package/dist/gateway/x402-opener-mode.js.map +1 -0
  140. package/dist/index.d.ts +11 -5
  141. package/dist/index.d.ts.map +1 -1
  142. package/dist/index.js +15 -5
  143. package/dist/index.js.map +1 -1
  144. package/dist/mandates/env.d.ts +3 -2
  145. package/dist/mandates/env.d.ts.map +1 -1
  146. package/dist/mandates/env.js +3 -2
  147. package/dist/mandates/env.js.map +1 -1
  148. package/dist/mcp/server.d.ts +100 -0
  149. package/dist/mcp/server.d.ts.map +1 -1
  150. package/dist/mcp/server.js +719 -39
  151. package/dist/mcp/server.js.map +1 -1
  152. package/dist/mcp/service-invoker.d.ts +97 -0
  153. package/dist/mcp/service-invoker.d.ts.map +1 -0
  154. package/dist/mcp/service-invoker.js +167 -0
  155. package/dist/mcp/service-invoker.js.map +1 -0
  156. package/dist/mcp/x402-tools.d.ts +104 -0
  157. package/dist/mcp/x402-tools.d.ts.map +1 -0
  158. package/dist/mcp/x402-tools.js +434 -0
  159. package/dist/mcp/x402-tools.js.map +1 -0
  160. package/dist/network.d.ts +119 -0
  161. package/dist/network.d.ts.map +1 -0
  162. package/dist/network.js +199 -0
  163. package/dist/network.js.map +1 -0
  164. package/dist/sdk/invoke.d.ts +23 -4
  165. package/dist/sdk/invoke.d.ts.map +1 -1
  166. package/dist/sdk/invoke.js +71 -10
  167. package/dist/sdk/invoke.js.map +1 -1
  168. package/dist/wallet/autonomous-wallet-broker.d.ts +3 -0
  169. package/dist/wallet/autonomous-wallet-broker.d.ts.map +1 -1
  170. package/dist/wallet/autonomous-wallet-broker.js +27 -23
  171. package/dist/wallet/autonomous-wallet-broker.js.map +1 -1
  172. package/dist/wallet/autonomous-wallet-protocol.d.ts +8 -2
  173. package/dist/wallet/autonomous-wallet-protocol.d.ts.map +1 -1
  174. package/dist/wallet/autonomous-wallet-protocol.js +9 -2
  175. package/dist/wallet/autonomous-wallet-protocol.js.map +1 -1
  176. package/dist/wallet/autonomous-wallet.d.ts.map +1 -1
  177. package/dist/wallet/autonomous-wallet.js +3 -2
  178. package/dist/wallet/autonomous-wallet.js.map +1 -1
  179. package/dist/wallet/broker-escrows.d.ts +222 -0
  180. package/dist/wallet/broker-escrows.d.ts.map +1 -0
  181. package/dist/wallet/broker-escrows.js +36 -0
  182. package/dist/wallet/broker-escrows.js.map +1 -0
  183. package/dist/wallet/lifecycle.d.ts +21 -5
  184. package/dist/wallet/lifecycle.d.ts.map +1 -1
  185. package/dist/wallet/lifecycle.js +32 -12
  186. package/dist/wallet/lifecycle.js.map +1 -1
  187. package/dist/wallet/privy-broker-server.d.ts.map +1 -1
  188. package/dist/wallet/privy-broker-server.js +31 -26
  189. package/dist/wallet/privy-broker-server.js.map +1 -1
  190. package/dist/wallet/privy-session-broker.d.ts +14 -5
  191. package/dist/wallet/privy-session-broker.d.ts.map +1 -1
  192. package/dist/wallet/privy-session-broker.js +29 -17
  193. package/dist/wallet/privy-session-broker.js.map +1 -1
  194. package/dist/wallet/privy-session-provider.d.ts +3 -1
  195. package/dist/wallet/privy-session-provider.d.ts.map +1 -1
  196. package/dist/wallet/privy-session-provider.js +5 -3
  197. package/dist/wallet/privy-session-provider.js.map +1 -1
  198. package/dist/wallet/provider.d.ts.map +1 -1
  199. package/dist/wallet/provider.js +15 -8
  200. package/dist/wallet/provider.js.map +1 -1
  201. package/dist/x402/facilitator.d.ts +42 -17
  202. package/dist/x402/facilitator.d.ts.map +1 -1
  203. package/dist/x402/facilitator.js +49 -33
  204. package/dist/x402/facilitator.js.map +1 -1
  205. package/dist/x402-buyer/guarded-fetch.d.ts +51 -0
  206. package/dist/x402-buyer/guarded-fetch.d.ts.map +1 -0
  207. package/dist/x402-buyer/guarded-fetch.js +147 -0
  208. package/dist/x402-buyer/guarded-fetch.js.map +1 -0
  209. package/dist/x402-buyer/index.d.ts +10 -0
  210. package/dist/x402-buyer/index.d.ts.map +1 -0
  211. package/dist/x402-buyer/index.js +10 -0
  212. package/dist/x402-buyer/index.js.map +1 -0
  213. package/dist/x402-buyer/pay.d.ts +135 -0
  214. package/dist/x402-buyer/pay.d.ts.map +1 -0
  215. package/dist/x402-buyer/pay.js +336 -0
  216. package/dist/x402-buyer/pay.js.map +1 -0
  217. package/dist/x402-opener/abi.d.ts +684 -0
  218. package/dist/x402-opener/abi.d.ts.map +1 -0
  219. package/dist/x402-opener/abi.js +880 -0
  220. package/dist/x402-opener/abi.js.map +1 -0
  221. package/dist/x402-opener/facilitator-entry.d.ts +3 -0
  222. package/dist/x402-opener/facilitator-entry.d.ts.map +1 -0
  223. package/dist/x402-opener/facilitator-entry.js +37 -0
  224. package/dist/x402-opener/facilitator-entry.js.map +1 -0
  225. package/dist/x402-opener/facilitator-server.d.ts +180 -0
  226. package/dist/x402-opener/facilitator-server.d.ts.map +1 -0
  227. package/dist/x402-opener/facilitator-server.js +696 -0
  228. package/dist/x402-opener/facilitator-server.js.map +1 -0
  229. package/dist/x402-opener/index.d.ts +14 -0
  230. package/dist/x402-opener/index.d.ts.map +1 -0
  231. package/dist/x402-opener/index.js +14 -0
  232. package/dist/x402-opener/index.js.map +1 -0
  233. package/dist/x402-opener/listing-resolver.d.ts +55 -0
  234. package/dist/x402-opener/listing-resolver.d.ts.map +1 -0
  235. package/dist/x402-opener/listing-resolver.js +125 -0
  236. package/dist/x402-opener/listing-resolver.js.map +1 -0
  237. package/dist/x402-opener/refund-relay.d.ts +240 -0
  238. package/dist/x402-opener/refund-relay.d.ts.map +1 -0
  239. package/dist/x402-opener/refund-relay.js +1240 -0
  240. package/dist/x402-opener/refund-relay.js.map +1 -0
  241. package/dist/x402-opener/relayer-queue.d.ts +14 -0
  242. package/dist/x402-opener/relayer-queue.d.ts.map +1 -0
  243. package/dist/x402-opener/relayer-queue.js +18 -0
  244. package/dist/x402-opener/relayer-queue.js.map +1 -0
  245. package/dist/x402-opener/scheme.d.ts +217 -0
  246. package/dist/x402-opener/scheme.d.ts.map +1 -0
  247. package/dist/x402-opener/scheme.js +749 -0
  248. package/dist/x402-opener/scheme.js.map +1 -0
  249. package/dist/x402-opener/terms.d.ts +105 -0
  250. package/dist/x402-opener/terms.d.ts.map +1 -0
  251. package/dist/x402-opener/terms.js +212 -0
  252. package/dist/x402-opener/terms.js.map +1 -0
  253. package/dist/zktls/reclaim.d.ts +2 -2
  254. package/docs/agent-layer.md +13 -8
  255. package/docs/autonomous-privy-wallet.md +188 -0
  256. package/docs/cli.md +342 -53
  257. package/docs/langchain.md +5 -0
  258. package/docs/mcp-hosted.md +4 -3
  259. package/docs/mcp-reference.md +245 -0
  260. package/docs/probe-capability.md +191 -0
  261. package/docs/quickstart.md +54 -5
  262. package/docs/threat-model.md +24 -3
  263. package/docs/x402.md +681 -0
  264. package/package.json +19 -6
  265. package/src/capability/invocation-capability.ts +17 -1
  266. package/src/capability/probe-capability.ts +355 -0
  267. package/src/cli/args.ts +29 -0
  268. package/src/cli/commands/claim.ts +31 -5
  269. package/src/cli/commands/close.ts +56 -7
  270. package/src/cli/commands/invoke.ts +6 -2
  271. package/src/cli/commands/mcp.ts +18 -2
  272. package/src/cli/commands/open.ts +151 -14
  273. package/src/cli/commands/pay.ts +442 -0
  274. package/src/cli/commands/reclaim-unverified.ts +24 -6
  275. package/src/cli/commands/reclaim.ts +274 -19
  276. package/src/cli/commands/refund.ts +277 -0
  277. package/src/cli/commands/status.ts +17 -1
  278. package/src/cli/commands/streams.ts +11 -15
  279. package/src/cli/commands/watch.ts +7 -1
  280. package/src/cli/config.ts +139 -52
  281. package/src/cli/deps.ts +189 -25
  282. package/src/cli/errors.ts +24 -1
  283. package/src/cli/escape-hatch.ts +19 -5
  284. package/src/cli/listings.ts +43 -10
  285. package/src/cli/preflight.ts +36 -21
  286. package/src/cli/privy.ts +398 -0
  287. package/src/cli/reclaimability.ts +154 -0
  288. package/src/cli/run.ts +54 -11
  289. package/src/cli/scan-range.ts +2 -2
  290. package/src/cli/spend-policy.ts +139 -0
  291. package/src/cli/status.ts +14 -1
  292. package/src/cli/wallet.ts +189 -58
  293. package/src/discovery/rate-band.ts +172 -0
  294. package/src/escrow-generation.ts +135 -0
  295. package/src/frameworks/agentkit.ts +45 -11
  296. package/src/frameworks/eliza.ts +27 -5
  297. package/src/frameworks/langchain.ts +14 -0
  298. package/src/gateway/caller-auth-gateway.ts +336 -13
  299. package/src/gateway/http-server.ts +690 -7
  300. package/src/gateway/probe-auth.ts +191 -0
  301. package/src/gateway/signed-rate-bounds.ts +164 -0
  302. package/src/gateway/x402-opener-mode.ts +974 -0
  303. package/src/index.ts +112 -14
  304. package/src/mandates/env.ts +3 -2
  305. package/src/mcp/server.ts +973 -44
  306. package/src/mcp/service-invoker.ts +285 -0
  307. package/src/mcp/x402-tools.ts +621 -0
  308. package/src/network.ts +302 -0
  309. package/src/sdk/invoke.ts +96 -17
  310. package/src/wallet/autonomous-wallet-broker.ts +46 -20
  311. package/src/wallet/autonomous-wallet-protocol.ts +11 -2
  312. package/src/wallet/autonomous-wallet.ts +4 -2
  313. package/src/wallet/broker-escrows.ts +66 -0
  314. package/src/wallet/lifecycle.ts +53 -18
  315. package/src/wallet/privy-broker-server.ts +35 -25
  316. package/src/wallet/privy-session-broker.ts +58 -25
  317. package/src/wallet/privy-session-provider.ts +7 -3
  318. package/src/wallet/provider.ts +20 -15
  319. package/src/x402/facilitator.ts +85 -46
  320. package/src/x402-buyer/guarded-fetch.ts +213 -0
  321. package/src/x402-buyer/index.ts +9 -0
  322. package/src/x402-buyer/pay.ts +517 -0
  323. package/src/x402-opener/abi.ts +881 -0
  324. package/src/x402-opener/facilitator-entry.ts +45 -0
  325. package/src/x402-opener/facilitator-server.ts +1014 -0
  326. package/src/x402-opener/index.ts +13 -0
  327. package/src/x402-opener/listing-resolver.ts +202 -0
  328. package/src/x402-opener/refund-relay.ts +1743 -0
  329. package/src/x402-opener/relayer-queue.ts +18 -0
  330. package/src/x402-opener/scheme.ts +1133 -0
  331. package/src/x402-opener/terms.ts +300 -0
package/README.md CHANGED
@@ -11,8 +11,12 @@ honestly scoped, is what this package makes an agent able to enforce, never
11
11
  It builds on [`@absol-labs/sdk`](https://github.com/Absol-Labs/metrik-sdk), which speaks
12
12
  to the on-chain metered escrow. This layer wraps that client in the guardrails and
13
13
  integration surfaces an agent actually needs: owner-signed spend mandates that gate every
14
- fund move, an x402 facilitator that turns a `402` into a verified stream, an MCP server
15
- that exposes hire/monitor/reclaim as agent tools, adapters for the major agent frameworks,
14
+ fund move, a Metrik-native `402` challenge flow that turns a payment challenge into a verified
15
+ stream (not the x402 protocol), an opt-in x402 v2 facilitator and gateway mode that settle
16
+ standard x402 `exact` payments through the on-chain stream opener (off by default — see
17
+ [`docs/x402.md`](./docs/x402.md)), an MCP server that exposes
18
+ hire/monitor/reclaim as agent tools,
19
+ adapters for the major agent frameworks,
16
20
  Reclaim consumer zkTLS for buyer-side delivery proofs, and non-custodial Coinbase CDP/Privy
17
21
  wallets so Metrik never holds a key.
18
22
 
@@ -34,7 +38,9 @@ npx --package @absol-labs/agent metrik discover
34
38
  `metrik` is the CLI below; `metrik-mcp` starts the MCP server over stdio
35
39
  (`metrik mcp --print-config` prints the client config that runs it);
36
40
  `metrik-mcp-http` starts the hosted multi-tenant MCP transport; `metrik-gateway`
37
- starts the reference caller-auth gateway a seller puts in front of their service.
41
+ starts the reference caller-auth gateway a seller puts in front of their service;
42
+ `metrik-x402-opener-facilitator` starts the x402 v2 opener facilitator (off unless
43
+ enabled; see [`docs/x402.md`](./docs/x402.md)).
38
44
 
39
45
  The package is **ESM-only** (`"type": "module"`) and targets **Node `>=20.19 <25`** (verified on 20.19, 22 LTS and 24). It ships
40
46
  `@absol-labs/sdk`, `@absol-labs/shared`, `viem`, `zod`, the Reclaim zkTLS SDKs, the
@@ -53,15 +59,30 @@ and hard-stops on denial; `MandateDecision` returns a machine-readable reason. B
53
59
  actions (close, reclaim) verify only the signature — never expiry or caps — so a lapsed
54
60
  mandate can never strand the buyer's own funds in escrow.
55
61
 
56
- **The x402 facilitator** (`VerifiedStreamX402Facilitator`) turns an HTTP `402` challenge
57
- into a real on-chain stream open instead of a one-shot payment. The agent receives a
58
- verified-streaming requirement, signs a payload bound to its mandate, and the facilitator
59
- opens the escrowed stream through the SDK.
60
-
61
- **The MCP server** exposes `discover_services`, `hire_verified_service`,
62
+ **The Metrik `402` challenge flow** (`VerifiedStreamFacilitator`) turns an HTTP `402`
63
+ challenge into a real on-chain stream open instead of a one-shot payment. The agent
64
+ receives a verified-streaming requirement, signs a payload bound to its mandate, and the
65
+ stream is opened through the SDK.
66
+
67
+ > **This is Metrik's own `402` flow, not the x402 protocol.** It uses its own scheme
68
+ > string (`streamproof-verified-stream`), its own challenge and payload shapes, and its
69
+ > own `X-METRIK-PAYMENT` header. It does **not** speak the x402 wire format and will
70
+ > **not** interoperate with `x402-fetch`, `x402-axios`, `x402-express`, or any standard
71
+ > x402 client or facilitator.
72
+ >
73
+ > Standard x402 is supported separately, as **x402 v2 `exact` through the stream
74
+ > opener**: `metrik-x402-opener-facilitator` and the gateway's opt-in
75
+ > `METRIK_GATEWAY_X402V2_OPENER` mode, both off by default. The opener `payTo` must only
76
+ > ever be settled by that facilitator — a stock x402 facilitator would strand the payment.
77
+ > Read [`docs/x402.md`](./docs/x402.md) before enabling either. The older x402 v1
78
+ > integration, which paid the seller directly, was removed.
79
+
80
+ **The MCP server** exposes `discover_services`, `hire_verified_service`, `invoke_service`,
62
81
  `check_stream_status`, `reclaim_unspent`, `list_streams`, and — when Reclaim credentials are
63
- configured — `prove_https_response`, so any MCP-native agent transacts directly. It reads
64
- settlement config from the environment and never accepts a raw key as a tool argument.
82
+ configured — `prove_https_response`, so an MCP-native agent can discover a service, pay for
83
+ it, **call it**, and recover what it did not spend without leaving the tool surface. It reads
84
+ settlement config from the environment and never accepts a raw key as a tool argument. Full
85
+ reference: [`docs/mcp-reference.md`](./docs/mcp-reference.md).
65
86
 
66
87
  **Framework adapters** put the same mandate-gated client behind AgentKit, ElizaOS,
67
88
  LangChain, and CrewAI, each importable from its own subpath.
@@ -206,15 +227,15 @@ See [`scripts/e2e-hire.ts`](./scripts/e2e-hire.ts) for the full journey (create/
206
227
  hire → invoke → settle) run against real Base Sepolia infrastructure: `pnpm e2e:hire` (needs real CDP
207
228
  creds — see `.env.example`).
208
229
 
209
- ### Hire via x402: `402` challenge → signed payload → open stream
230
+ ### Hire via the Metrik `402` flow: challenge → signed payload → open stream
210
231
 
211
232
  ```ts
212
233
  import {
213
- VerifiedStreamX402Facilitator,
214
- encodeX402PayloadHeader,
234
+ VerifiedStreamFacilitator,
235
+ encodeStreamPayloadHeader,
215
236
  } from "@absol-labs/agent";
216
237
 
217
- const facilitator = new VerifiedStreamX402Facilitator({
238
+ const facilitator = new VerifiedStreamFacilitator({
218
239
  sdkConfig, // @absol-labs/sdk StreamProofClientConfig (chain, transport, account, escrow, usdc)
219
240
  });
220
241
 
@@ -228,12 +249,16 @@ const challenge = facilitator.challenge({
228
249
  maxBudgetUsdc: 2_000_000n,
229
250
  });
230
251
 
231
- const header = encodeX402PayloadHeader({ challenge, signedMandate });
252
+ const header = encodeStreamPayloadHeader({ challenge, signedMandate });
232
253
  const { streamId } = await facilitator.open(header); // mandate-gated, opens on-chain
233
254
  ```
234
255
 
235
- The scheme name is exported as `X402_SCHEME`; `parseX402ChallengeJson`,
236
- `parseX402PayloadHeader`, and `encodeX402PayloadHeader` handle the wire format on both sides.
256
+ The scheme name is exported as `METRIK_STREAM_SCHEME`; `parseStreamChallengeJson`,
257
+ `parseStreamPayloadHeader`, and `encodeStreamPayloadHeader` handle the wire format on both
258
+ sides, and the payload travels under `METRIK_PAYMENT_HEADER` (`x-metrik-payment`) — never
259
+ under x402's `X-PAYMENT`. This wire format is Metrik's own; see
260
+ [`docs/x402.md`](./docs/x402.md). The deprecated `X402*` / `x402*` aliases of these names
261
+ were removed; use the names above.
237
262
 
238
263
  ### The CLI
239
264
 
@@ -250,12 +275,50 @@ metrik watch <streamId> --interval 15
250
275
  metrik invoke <streamId> --method POST --path /transform --body '{"text":"hi"}'
251
276
  metrik close <streamId>
252
277
  metrik reclaim <streamId>
278
+ metrik claim <streamId> # operator: redeem what verified
279
+ metrik reclaim-unverified <streamId> --forfeit-unclaimed # buyer escape hatch
253
280
  metrik mcp --print-config
281
+
282
+ # the x402 opener path (docs/x402.md), under a spend mandate
283
+ metrik pay https://x402.137.23.50.249.sslip.io/transform --json '{"text":"# hi"}' --max-amount 0.1
284
+ metrik refund <streamId> --refund-url <url> --close --reclaim # gasless; NOT automatic
254
285
  ```
255
286
 
256
- - **Testnet only.** The CLI refuses any chain outside Base Sepolia (`84532`), and
257
- re-reads the chain id the RPC endpoint actually serves before it signs anything.
258
- There is no override flag.
287
+ - **Testnet only, registry-driven.** Every chain fact (chain id, escrow, USDC,
288
+ RPC, oracle, gas token) comes from the `@absol-labs/sdk` network registry;
289
+ `--network` / `METRIK_NETWORK` selects one. The CLI refuses any network the
290
+ registry does not mark as a testnet (today: Base Sepolia, `84532`), and re-reads
291
+ the chain id the RPC endpoint actually serves before it signs anything. There is
292
+ no override flag.
293
+ - **`metrik pay` is gated by a spend mandate** like `metrik open`: the payment's
294
+ opener terms (price vs per-stream/total caps, rate, window, operator) pass
295
+ `checkMandate()` before anything is signed, and the SDK's own x402 protections
296
+ stay on. It prints the response, the `streamId` and the refund URL. See
297
+ [`docs/cli.md`](./docs/cli.md#metrik-pay-x402).
298
+ - **The meter runs on verified availability, not on your calls.** A stream is a
299
+ per-second rental of an endpoint that keeps proving it is alive — not per-request
300
+ billing. You are charged for the seconds that verified whether or not you invoked
301
+ once or a thousand times, and a failed interval advances the clock and pays nothing.
302
+ - **`metrik claim` is the seller's side** of the `operator claimable` figure `status`
303
+ has always printed. It is operator-gated on-chain, so a wallet that is not the
304
+ stream's operator is refused before anything is broadcast rather than paying gas to
305
+ learn it.
306
+ - **`metrik reclaim-unverified` is the no-proof escape hatch.** Every other route to a
307
+ buyer's money needs a Merkle proof from the oracle, so it is only as available as the
308
+ oracle is; this one needs no proof, no quorum and no guardian. It costs the operator
309
+ everything they verifiably earned but had not yet claimed on-chain — permanently, and
310
+ paid to the buyer — so it is its own command behind a mandatory `--forfeit-unclaimed`,
311
+ never a flag on `reclaim`. It unlocks at `expiresAt + escapeGraceSeconds`, gated on
312
+ **`expiresAt` and never on `closedAt`**: closing a 24h stream after ten minutes does
313
+ not bring the hatch forward.
314
+ - **`status` may report `pending final checkpoint`** after a stream stops, instead of a
315
+ reclaimable figure. That is correct: until a checkpoint covers the stop time, any
316
+ number would be one you cannot actually obtain.
317
+ - **`discover` and `status` disclose verifier overlap.** When a listing's operator is
318
+ also one of the escrow's oracle signers, both say so — the party being paid is among
319
+ the parties attesting that delivery happened. On the current testnet deployment this
320
+ fires on every live listing, because the team seeds its own supply so the marketplace
321
+ is testable. SLA text in a listing is seller-authored and labelled unverified.
259
322
  - **`open --dry-run` needs no wallet at all.** It broadcasts nothing, so it prints the
260
323
  intended call (and says which parts it could not produce without a key) rather than
261
324
  demanding one. `invoke` does need the key even though it broadcasts nothing: it signs
@@ -294,8 +357,15 @@ is also importable (`@absol-labs/agent/cli`) if you want to embed it.
294
357
 
295
358
  ### Run the MCP server
296
359
 
297
- The server runs over stdio and reads its settlement config from the environment; it never
298
- asks for a raw key in a tool argument.
360
+ Two transports — stdio for local dev, Streamable HTTP for hosting — over the same tool set.
361
+ Either reads its settlement config from the environment; neither ever asks for a raw key in
362
+ a tool argument.
363
+
364
+ **What the agent is buying is TIME, not calls.** `hire_verified_service` starts a per-second
365
+ meter on verified availability; `invoke_service` costs nothing extra, and not calling costs
366
+ the same as calling. Only `reclaim_unspent` stops the clock, and nothing pushes money back on
367
+ its own. Every tool that opens, reads, or ends a stream says so in its own description, which
368
+ is what an agent actually reads.
299
369
 
300
370
  ```bash
301
371
  metrik-mcp # installed, or: npx --package @absol-labs/agent metrik-mcp
@@ -317,16 +387,19 @@ import {
317
387
  } from "@absol-labs/agent";
318
388
 
319
389
  console.log(METRIK_MCP_TOOLS.map((t) => t.name));
320
- // discover_services, hire_verified_service, check_stream_status,
321
- // reclaim_unspent, list_streams, prove_https_response
390
+ // discover_services, hire_verified_service, invoke_service, check_stream_status,
391
+ // reclaim_unspent, list_streams, prove_https_response,
392
+ // x402_pay,
393
+ // refund_status, refund
322
394
 
323
395
  await startVerifiedStreamMcpServerStdio(); // reads process.env, connects stdio
324
396
  // or, for custom transport wiring:
325
397
  // const runtime = await createVerifiedStreamMcpServerFromEnv();
326
398
  ```
327
399
 
328
- Core env surface: `METRIK_AGENT_RPC_URL`, `METRIK_AGENT_ESCROW`, `METRIK_AGENT_USDC`,
329
- `METRIK_AGENT_CHAIN_ID` (`84532`), and one wallet source — either
400
+ Core env surface: `METRIK_AGENT_RPC_URL`, `METRIK_AGENT_ESCROW` (must be the network's
401
+ registered escrow), `METRIK_AGENT_USDC`, `METRIK_NETWORK` / `METRIK_AGENT_CHAIN_ID`
402
+ (default: the registry's default network), and one wallet source — either
330
403
  `METRIK_AGENT_PRIVATE_KEY` (injected signer) or the CDP set (`CDP_API_KEY_ID`,
331
404
  `CDP_API_KEY_SECRET`, `CDP_WALLET_SECRET`, `METRIK_AGENT_CDP_OWNER_NAME`). Set
332
405
  `RECLAIM_APP_ID` / `RECLAIM_APP_SECRET` to enable the `prove_https_response` zkTLS tool.
@@ -480,7 +553,7 @@ services use output-probe verification until that protocol support exists.
480
553
  `ReclaimConsumerProofService` (and `createReclaimConsumerProofServiceFromEnv`) generate a
481
554
  Reclaim-backed proof of the exact HTTPS response the agent consumed, verified locally
482
555
  against the declared URL, method, body, match, and redaction policy before it is trusted.
483
- `VerifiedStreamX402Facilitator.proveConsumedHttpsResponse()` binds that proof to the same
556
+ `VerifiedStreamFacilitator.proveConsumedHttpsResponse()` binds that proof to the same
484
557
  buyer/mandate context that opened the stream. When credentials require private headers or
485
558
  cookies, use the programmatic service or the facilitator directly rather than the MCP tool,
486
559
  so secrets never pass through model-visible tool arguments. Treat the result as an L2
@@ -520,8 +593,9 @@ pnpm test
520
593
  pnpm build
521
594
  ```
522
595
 
523
- The x402 facilitator, zkTLS proof path, signed-mandate engine, MCP server, and framework
524
- adapters are all real and tested in-repo. The `*.int.test.ts` integration suites deploy the
596
+ The Metrik `402` challenge flow, zkTLS proof path, signed-mandate engine, MCP server,
597
+ caller-auth gateway, and framework adapters are all real and tested in-repo. The
598
+ `*.int.test.ts` integration suites deploy the
525
599
  hardened `StreamEscrow` on a throwaway `anvil` node and self-skip when `anvil` is not on
526
600
  `PATH`, so default CI stays green. A full hire → stream → settle walkthrough lives in
527
601
  [`examples/hire-stream-settle.ts`](examples/hire-stream-settle.ts).
@@ -532,3 +606,5 @@ hardened `StreamEscrow` on a throwaway `anvil` node and self-skip when `anvil` i
532
606
  - Docs: [metrik.live](https://metrik.live) · App: [app.metrik.live](https://app.metrik.live)
533
607
  - SDK: [`@absol-labs/sdk`](https://github.com/Absol-Labs/metrik-sdk)
534
608
  - Quickstart: [`docs/quickstart.md`](./docs/quickstart.md) · Design + narrative: [`docs/agent-layer.md`](./docs/agent-layer.md) · Security review: [`docs/threat-model.md`](./docs/threat-model.md)
609
+ - Metrik and x402 — the x402 v2 opener facilitator and gateway mode, the rule that only the opener facilitator may settle an opener `payTo`, and what was removed: [`docs/x402.md`](./docs/x402.md)
610
+ - Letting the verifier check a **gated** listing's paid route (opt-in, seller-side): [`docs/probe-capability.md`](./docs/probe-capability.md)
@@ -20,7 +20,7 @@ export declare const invocationCapabilitySchema: z.ZodObject<{
20
20
  expiry: z.ZodNumber;
21
21
  }, "strip", z.ZodTypeAny, {
22
22
  streamId: string;
23
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
23
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
24
24
  serviceRef: string;
25
25
  nonce: string;
26
26
  buyer: `0x${string}`;
@@ -28,7 +28,7 @@ export declare const invocationCapabilitySchema: z.ZodObject<{
28
28
  expiry: number;
29
29
  }, {
30
30
  streamId: string;
31
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
31
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
32
32
  serviceRef: string;
33
33
  nonce: string;
34
34
  buyer: string;
@@ -54,18 +54,18 @@ export declare const signedInvocationCapabilitySchema: z.ZodObject<{
54
54
  } & {
55
55
  signature: z.ZodEffects<z.ZodString, string, string>;
56
56
  }, "strip", z.ZodTypeAny, {
57
- signature: string;
58
57
  streamId: string;
59
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
58
+ signature: string;
59
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
60
60
  serviceRef: string;
61
61
  nonce: string;
62
62
  buyer: `0x${string}`;
63
63
  pathHash: string;
64
64
  expiry: number;
65
65
  }, {
66
- signature: string;
67
66
  streamId: string;
68
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
67
+ signature: string;
68
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
69
69
  serviceRef: string;
70
70
  nonce: string;
71
71
  buyer: string;
@@ -160,14 +160,26 @@ export declare function buildInvocationCapabilityTypedData(capability: Invocatio
160
160
  streamId: Hex;
161
161
  buyer: `0x${string}`;
162
162
  serviceRef: Hex;
163
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
163
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
164
164
  pathHash: Hex;
165
165
  nonce: Hex;
166
166
  expiry: bigint;
167
167
  };
168
168
  };
169
+ /**
170
+ * The minimum an account must expose to sign a capability: its address, and
171
+ * EIP-712 signing.
172
+ *
173
+ * Deliberately narrower than viem's `LocalAccount`. Every wallet this package
174
+ * resolves signs typed data — a raw key, a CDP server account via `toAccount()`,
175
+ * a Privy embedded EOA — but only the raw-key one is a `LocalAccount` by TYPE.
176
+ * Demanding the full interface would have meant the MCP server could only ever
177
+ * invoke with a raw key, which is the wallet an MCP host is least likely to be
178
+ * configured with. Widening a parameter type breaks no existing caller.
179
+ */
180
+ export type InvocationCapabilitySigner = Pick<LocalAccount, "address" | "signTypedData">;
169
181
  /** Signs an `InvocationCapability` with the buyer's own wallet. */
170
- export declare function signInvocationCapability(capability: InvocationCapability, domain: InvocationCapabilityDomainInput, account: LocalAccount): Promise<Hex>;
182
+ export declare function signInvocationCapability(capability: InvocationCapability, domain: InvocationCapabilityDomainInput, account: InvocationCapabilitySigner): Promise<Hex>;
171
183
  /** Recovers the EIP-712 signer of a capability. Throws on a malformed signature. */
172
184
  export declare function recoverInvocationCapabilitySigner(capability: InvocationCapability, domain: InvocationCapabilityDomainInput, signature: Hex): Promise<Address>;
173
185
  /** Cryptographically random 32-byte single-use nonce. */
@@ -1 +1 @@
1
- {"version":3,"file":"invocation-capability.d.ts","sourceRoot":"","sources":["../../src/capability/invocation-capability.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmCxB,+CAA+C;AAC/C,eAAO,MAAM,gBAAgB,yEAQ3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,0BAA0B;IACrC,iFAAiF;;IAEjF,wDAAwD;;IAExD,uEAAuE;;IAEvE,yDAAyD;;IAEzD,wEAAwE;;IAExE,oCAAoC;;IAEpC,kEAAkE;;;;;;;;;;;;;;;;;;EAElE,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,gCAAgC;IAjB3C,iFAAiF;;IAEjF,wDAAwD;;IAExD,uEAAuE;;IAEvE,yDAAyD;;IAEzD,wEAAwE;;IAExE,oCAAoC;;IAEpC,kEAAkE;;;;;;;;;;;;;;;;;;;;;;EAQhE,CAAC;AACL,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,gCAAgC,CACxC,CAAC;AAEF,mGAAmG;AACnG,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;CACrC;AAED,eAAO,MAAM,8BAA8B,EACzC,8BAAuC,CAAC;AAC1C,eAAO,MAAM,iCAAiC,EAAG,GAAY,CAAC;AAE9D,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;CAUhC,CAAC;AAEX,uFAAuF;AACvF,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAEjD,iEAAiE;AACjE,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAE5D,wBAAgB,sCAAsC,CACpD,MAAM,EAAE,+BAA+B;;;;;EAQxC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAEpD;AAED,kGAAkG;AAClG,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU5D;AAeD,wBAAgB,kCAAkC,CAChD,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAZR,GAAG;;oBAEC,GAAG;;kBAEP,GAAG;eACT,GAAG;;;EAe7B;AAED,mEAAmE;AACnE,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,+BAA+B,EACvC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,GAAG,CAAC,CAGd;AAED,oFAAoF;AACpF,wBAAsB,iCAAiC,CACrD,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,+BAA+B,EACvC,SAAS,EAAE,GAAG,GACb,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,yDAAyD;AACzD,wBAAgB,uBAAuB,IAAI,GAAG,CAE7C;AAED,qBAAa,4BAA6B,SAAQ,KAAK;gBACzC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAIpE;AAED,gFAAgF;AAChF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,0BAA0B,GACjC,MAAM,CAaR;AAED,gGAAgG;AAChG,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAClB,0BAA0B,CA2B5B"}
1
+ {"version":3,"file":"invocation-capability.d.ts","sourceRoot":"","sources":["../../src/capability/invocation-capability.ts"],"names":[],"mappings":"AAE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sC,CACpD,MAAM,EAAE,+BAA+B;;;;;EAQxC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAEpD;AAED,kGAAkG;AAClG,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU5D;AAeD,wBAAgB,kCAAkC,CAChD,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAZR,GAAG;;oBAEC,GAAG;;kBAEP,GAAG;eACT,GAAG;;;EAe7B;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,YAAY,EACZ,SAAS,GAAG,eAAe,CAC5B,CAAC;AAEF,mEAAmE;AACnE,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,+BAA+B,EACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,GAAG,CAAC,CAGd;AAED,oFAAoF;AACpF,wBAAsB,iCAAiC,CACrD,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,+BAA+B,EACvC,SAAS,EAAE,GAAG,GACb,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,yDAAyD;AACzD,wBAAgB,uBAAuB,IAAI,GAAG,CAE7C;AAED,qBAAa,4BAA6B,SAAQ,KAAK;gBACzC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAIpE;AAED,gFAAgF;AAChF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,0BAA0B,GACjC,MAAM,CAaR;AAED,gGAAgG;AAChG,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAClB,0BAA0B,CA2B5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"invocation-capability.js","sourceRoot":"","sources":["../../src/capability/invocation-capability.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AC7B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACzD,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,sBAAsB,CACpC,WAAmB;IAEnB,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,4BAA4B,CACpC,oCAAoC,EACpC,EAAE,KAAK,EAAE,CACV,CAAC;IACJ,CAAC;IAED,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,4BAA4B,CAAC,kCAAkC,EAAE;YACzE,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED,MAAM,MAAM,GAAG,gCAAgC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC/D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,4BAA4B,CACpC,6BAA6B,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
1
+ {"version":3,"file":"invocation-capability.js","sourceRoot":"","sources":["../../src/capability/invocation-capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAA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QACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACzD,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,sBAAsB,CACpC,WAAmB;IAEnB,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,4BAA4B,CACpC,oCAAoC,EACpC,EAAE,KAAK,EAAE,CACV,CAAC;IACJ,CAAC;IAED,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,4BAA4B,CAAC,kCAAkC,EAAE;YACzE,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED,MAAM,MAAM,GAAG,gCAAgC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC/D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,4BAA4B,CACpC,6BAA6B,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
@@ -0,0 +1,225 @@
1
+ import { type Address, type Hex, type LocalAccount } from "viem";
2
+ import { z } from "zod";
3
+ export declare const probeCapabilitySchema: z.ZodObject<{
4
+ /**
5
+ * The service being probed. Must match the target gateway's configured
6
+ * `serviceRef`. There is deliberately no `streamId` field — see the class
7
+ * docs.
8
+ */
9
+ serviceRef: z.ZodEffects<z.ZodString, string, string>;
10
+ /**
11
+ * The minting oracle signer. Must equal the EIP-712 signer AND be a member of
12
+ * the escrow's on-chain `getOracleSigners()` set at verification time.
13
+ */
14
+ oracle: z.ZodEffects<z.ZodString, `0x${string}`, string>;
15
+ /** The single HTTP method this capability authorizes. */
16
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
17
+ /** `keccak256` of the exact request path this capability authorizes. */
18
+ pathHash: z.ZodEffects<z.ZodString, string, string>;
19
+ /** Single-use anti-replay nonce. */
20
+ nonce: z.ZodEffects<z.ZodString, string, string>;
21
+ /** Unix seconds after which the capability is no longer valid. */
22
+ expiry: z.ZodNumber;
23
+ }, "strip", z.ZodTypeAny, {
24
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
25
+ serviceRef: string;
26
+ nonce: string;
27
+ pathHash: string;
28
+ expiry: number;
29
+ oracle: `0x${string}`;
30
+ }, {
31
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
32
+ serviceRef: string;
33
+ nonce: string;
34
+ pathHash: string;
35
+ expiry: number;
36
+ oracle: string;
37
+ }>;
38
+ export type ProbeCapability = z.infer<typeof probeCapabilitySchema>;
39
+ export declare const signedProbeCapabilitySchema: z.ZodObject<{
40
+ /**
41
+ * The service being probed. Must match the target gateway's configured
42
+ * `serviceRef`. There is deliberately no `streamId` field — see the class
43
+ * docs.
44
+ */
45
+ serviceRef: z.ZodEffects<z.ZodString, string, string>;
46
+ /**
47
+ * The minting oracle signer. Must equal the EIP-712 signer AND be a member of
48
+ * the escrow's on-chain `getOracleSigners()` set at verification time.
49
+ */
50
+ oracle: z.ZodEffects<z.ZodString, `0x${string}`, string>;
51
+ /** The single HTTP method this capability authorizes. */
52
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
53
+ /** `keccak256` of the exact request path this capability authorizes. */
54
+ pathHash: z.ZodEffects<z.ZodString, string, string>;
55
+ /** Single-use anti-replay nonce. */
56
+ nonce: z.ZodEffects<z.ZodString, string, string>;
57
+ /** Unix seconds after which the capability is no longer valid. */
58
+ expiry: z.ZodNumber;
59
+ } & {
60
+ signature: z.ZodEffects<z.ZodString, string, string>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ signature: string;
63
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
64
+ serviceRef: string;
65
+ nonce: string;
66
+ pathHash: string;
67
+ expiry: number;
68
+ oracle: `0x${string}`;
69
+ }, {
70
+ signature: string;
71
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
72
+ serviceRef: string;
73
+ nonce: string;
74
+ pathHash: string;
75
+ expiry: number;
76
+ oracle: string;
77
+ }>;
78
+ export type SignedProbeCapability = z.infer<typeof signedProbeCapabilitySchema>;
79
+ /**
80
+ * Chain-bound domain. `verifyingContract` is the `StreamEscrowV2` whose
81
+ * `getOracleSigners()` defines who may mint — so a capability minted for one
82
+ * escrow can never authorize a probe against a gateway fronting another.
83
+ */
84
+ export interface ProbeCapabilityDomainInput {
85
+ readonly chainId: number;
86
+ readonly verifyingContract: Address;
87
+ }
88
+ /**
89
+ * Distinct from `Metrik Invocation Capability`, so a buyer's invocation
90
+ * signature can never be replayed as a probe (or the reverse) even though both
91
+ * share a chainId and verifying contract.
92
+ */
93
+ export declare const probeCapabilityDomainName: "Metrik Probe Capability";
94
+ export declare const probeCapabilityDomainVersion: "1";
95
+ export declare const probeCapabilityTypedData: {
96
+ readonly ProbeCapability: readonly [{
97
+ readonly name: "serviceRef";
98
+ readonly type: "bytes32";
99
+ }, {
100
+ readonly name: "oracle";
101
+ readonly type: "address";
102
+ }, {
103
+ readonly name: "method";
104
+ readonly type: "string";
105
+ }, {
106
+ readonly name: "pathHash";
107
+ readonly type: "bytes32";
108
+ }, {
109
+ readonly name: "nonce";
110
+ readonly type: "bytes32";
111
+ }, {
112
+ readonly name: "expiry";
113
+ readonly type: "uint64";
114
+ }];
115
+ };
116
+ /**
117
+ * Default lifetime of a freshly-minted probe capability, in seconds.
118
+ *
119
+ * Shorter than the ~15-22s checkpoint cadence would race a slow upstream; much
120
+ * longer would widen the window in which a captured capability is replayable
121
+ * against a gateway with no nonce cache. 30s is one to two probe intervals.
122
+ */
123
+ export declare const DEFAULT_PROBE_CAPABILITY_TTL_SECONDS = 30;
124
+ /** Header a probe request carries the signed capability in. */
125
+ export declare const PROBE_CAPABILITY_HEADER_NAME = "x-metrik-probe-capability";
126
+ /**
127
+ * Header the gateway adds to the UPSTREAM request when it authorized a probe.
128
+ * Advisory: it exists so a seller's own metering/analytics can exclude
129
+ * verification traffic from billable usage.
130
+ */
131
+ export declare const PROBE_MARKER_HEADER_NAME = "x-metrik-probe";
132
+ export declare function createProbeCapabilityEip712Domain(domain: ProbeCapabilityDomainInput): {
133
+ readonly name: "Metrik Probe Capability";
134
+ readonly version: "1";
135
+ readonly chainId: number;
136
+ readonly verifyingContract: `0x${string}`;
137
+ };
138
+ /**
139
+ * `keccak256` of the exact request path this capability authorizes. Shares the
140
+ * canonical form with `InvocationCapability` so both sides of a gateway hash
141
+ * paths identically.
142
+ */
143
+ export declare function hashProbePath(path: string): Hex;
144
+ /** Re-exported for symmetry; identical canonicalization to the invocation path. */
145
+ export declare function normalizeProbePath(path: string): string;
146
+ export declare function buildProbeCapabilityTypedData(capability: ProbeCapability, domain: ProbeCapabilityDomainInput): {
147
+ domain: {
148
+ readonly name: "Metrik Probe Capability";
149
+ readonly version: "1";
150
+ readonly chainId: number;
151
+ readonly verifyingContract: `0x${string}`;
152
+ };
153
+ types: {
154
+ readonly ProbeCapability: readonly [{
155
+ readonly name: "serviceRef";
156
+ readonly type: "bytes32";
157
+ }, {
158
+ readonly name: "oracle";
159
+ readonly type: "address";
160
+ }, {
161
+ readonly name: "method";
162
+ readonly type: "string";
163
+ }, {
164
+ readonly name: "pathHash";
165
+ readonly type: "bytes32";
166
+ }, {
167
+ readonly name: "nonce";
168
+ readonly type: "bytes32";
169
+ }, {
170
+ readonly name: "expiry";
171
+ readonly type: "uint64";
172
+ }];
173
+ };
174
+ primaryType: "ProbeCapability";
175
+ message: {
176
+ serviceRef: Hex;
177
+ oracle: `0x${string}`;
178
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
179
+ pathHash: Hex;
180
+ nonce: Hex;
181
+ expiry: bigint;
182
+ };
183
+ };
184
+ /** The minimum an oracle signer must expose to mint a probe capability. */
185
+ export type ProbeCapabilitySigner = Pick<LocalAccount, "address" | "signTypedData">;
186
+ /** Signs a `ProbeCapability` with an oracle signer's own key. */
187
+ export declare function signProbeCapability(capability: ProbeCapability, domain: ProbeCapabilityDomainInput, account: ProbeCapabilitySigner): Promise<Hex>;
188
+ /** Recovers the EIP-712 signer of a probe capability. Throws on a malformed signature. */
189
+ export declare function recoverProbeCapabilitySigner(capability: ProbeCapability, domain: ProbeCapabilityDomainInput, signature: Hex): Promise<Address>;
190
+ /** Cryptographically random 32-byte single-use nonce. */
191
+ export declare function generateProbeNonce(): Hex;
192
+ export declare class InvalidProbeCapabilityHeaderError extends Error {
193
+ constructor(message: string, options?: {
194
+ readonly cause?: unknown;
195
+ });
196
+ }
197
+ /** Encodes a signed probe capability as an opaque, header-safe (base64url) string. */
198
+ export declare function encodeProbeCapabilityHeader(signed: SignedProbeCapability): string;
199
+ /** Decodes and schema-validates a probe capability header. Fails closed on any malformation. */
200
+ export declare function decodeProbeCapabilityHeader(headerValue: string): SignedProbeCapability;
201
+ export interface MintProbeCapabilityOptions {
202
+ readonly serviceRef: Hex;
203
+ readonly method: ProbeCapability["method"];
204
+ /** The exact request path to be probed (query/fragment are stripped). */
205
+ readonly path: string;
206
+ readonly domain: ProbeCapabilityDomainInput;
207
+ readonly account: ProbeCapabilitySigner;
208
+ readonly ttlSeconds?: number;
209
+ /** Injectable clock (unix seconds), for tests. */
210
+ readonly now?: () => number;
211
+ /** Injectable nonce source, for tests. */
212
+ readonly nonce?: () => Hex;
213
+ }
214
+ /**
215
+ * Mint one fresh, single-use, short-lived probe capability and return its
216
+ * encoded header value. Called once PER PROBE PER VANTAGE by the coordinator:
217
+ * the gateway's replay cache is single-use, so two vantages sharing one
218
+ * capability would see the second rejected as a replay.
219
+ */
220
+ export declare function mintProbeCapabilityHeader(options: MintProbeCapabilityOptions): Promise<{
221
+ readonly headerName: string;
222
+ readonly headerValue: string;
223
+ readonly capability: SignedProbeCapability;
224
+ }>;
225
+ //# sourceMappingURL=probe-capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probe-capability.d.ts","sourceRoot":"","sources":["../../src/capability/probe-capability.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+ExB,eAAO,MAAM,qBAAqB;IAChC;;;;OAIG;;IAEH;;;OAGG;;IAEH,yDAAyD;;IAEzD,wEAAwE;;IAExE,oCAAoC;;IAEpC,kEAAkE;;;;;;;;;;;;;;;;EAElE,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,2BAA2B;IAtBtC;;;;OAIG;;IAEH;;;OAGG;;IAEH,yDAAyD;;IAEzD,wEAAwE;;IAExE,oCAAoC;;IAEpC,kEAAkE;;;;;;;;;;;;;;;;;;;;EAOlE,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,Q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