@absol-labs/agent 0.9.1 → 0.11.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/README.md +184 -26
  2. package/dist/capability/invocation-capability.d.ts +18 -6
  3. package/dist/capability/invocation-capability.d.ts.map +1 -1
  4. package/dist/capability/invocation-capability.js.map +1 -1
  5. package/dist/cli/amounts.d.ts +26 -0
  6. package/dist/cli/amounts.d.ts.map +1 -0
  7. package/dist/cli/amounts.js +71 -0
  8. package/dist/cli/amounts.js.map +1 -0
  9. package/dist/cli/args.d.ts +32 -0
  10. package/dist/cli/args.d.ts.map +1 -0
  11. package/dist/cli/args.js +119 -0
  12. package/dist/cli/args.js.map +1 -0
  13. package/dist/cli/attesters.d.ts +51 -0
  14. package/dist/cli/attesters.d.ts.map +1 -0
  15. package/dist/cli/attesters.js +58 -0
  16. package/dist/cli/attesters.js.map +1 -0
  17. package/dist/cli/bin.d.ts +3 -0
  18. package/dist/cli/bin.d.ts.map +1 -0
  19. package/dist/cli/bin.js +5 -0
  20. package/dist/cli/bin.js.map +1 -0
  21. package/dist/cli/commands/claim.d.ts +13 -0
  22. package/dist/cli/commands/claim.d.ts.map +1 -0
  23. package/dist/cli/commands/claim.js +102 -0
  24. package/dist/cli/commands/claim.js.map +1 -0
  25. package/dist/cli/commands/close.d.ts +3 -0
  26. package/dist/cli/commands/close.d.ts.map +1 -0
  27. package/dist/cli/commands/close.js +55 -0
  28. package/dist/cli/commands/close.js.map +1 -0
  29. package/dist/cli/commands/discover.d.ts +3 -0
  30. package/dist/cli/commands/discover.d.ts.map +1 -0
  31. package/dist/cli/commands/discover.js +183 -0
  32. package/dist/cli/commands/discover.js.map +1 -0
  33. package/dist/cli/commands/invoke.d.ts +3 -0
  34. package/dist/cli/commands/invoke.d.ts.map +1 -0
  35. package/dist/cli/commands/invoke.js +142 -0
  36. package/dist/cli/commands/invoke.js.map +1 -0
  37. package/dist/cli/commands/mcp.d.ts +3 -0
  38. package/dist/cli/commands/mcp.d.ts.map +1 -0
  39. package/dist/cli/commands/mcp.js +113 -0
  40. package/dist/cli/commands/mcp.js.map +1 -0
  41. package/dist/cli/commands/open.d.ts +3 -0
  42. package/dist/cli/commands/open.d.ts.map +1 -0
  43. package/dist/cli/commands/open.js +331 -0
  44. package/dist/cli/commands/open.js.map +1 -0
  45. package/dist/cli/commands/reclaim-unverified.d.ts +3 -0
  46. package/dist/cli/commands/reclaim-unverified.d.ts.map +1 -0
  47. package/dist/cli/commands/reclaim-unverified.js +172 -0
  48. package/dist/cli/commands/reclaim-unverified.js.map +1 -0
  49. package/dist/cli/commands/reclaim.d.ts +33 -0
  50. package/dist/cli/commands/reclaim.d.ts.map +1 -0
  51. package/dist/cli/commands/reclaim.js +308 -0
  52. package/dist/cli/commands/reclaim.js.map +1 -0
  53. package/dist/cli/commands/status.d.ts +3 -0
  54. package/dist/cli/commands/status.d.ts.map +1 -0
  55. package/dist/cli/commands/status.js +43 -0
  56. package/dist/cli/commands/status.js.map +1 -0
  57. package/dist/cli/commands/streams.d.ts +3 -0
  58. package/dist/cli/commands/streams.d.ts.map +1 -0
  59. package/dist/cli/commands/streams.js +257 -0
  60. package/dist/cli/commands/streams.js.map +1 -0
  61. package/dist/cli/commands/watch.d.ts +3 -0
  62. package/dist/cli/commands/watch.d.ts.map +1 -0
  63. package/dist/cli/commands/watch.js +55 -0
  64. package/dist/cli/commands/watch.js.map +1 -0
  65. package/dist/cli/config.d.ts +61 -0
  66. package/dist/cli/config.d.ts.map +1 -0
  67. package/dist/cli/config.js +140 -0
  68. package/dist/cli/config.js.map +1 -0
  69. package/dist/cli/context.d.ts +29 -0
  70. package/dist/cli/context.d.ts.map +1 -0
  71. package/dist/cli/context.js +2 -0
  72. package/dist/cli/context.js.map +1 -0
  73. package/dist/cli/deps.d.ts +191 -0
  74. package/dist/cli/deps.d.ts.map +1 -0
  75. package/dist/cli/deps.js +277 -0
  76. package/dist/cli/deps.js.map +1 -0
  77. package/dist/cli/descriptor.d.ts +61 -0
  78. package/dist/cli/descriptor.d.ts.map +1 -0
  79. package/dist/cli/descriptor.js +78 -0
  80. package/dist/cli/descriptor.js.map +1 -0
  81. package/dist/cli/errors.d.ts +48 -0
  82. package/dist/cli/errors.d.ts.map +1 -0
  83. package/dist/cli/errors.js +129 -0
  84. package/dist/cli/errors.js.map +1 -0
  85. package/dist/cli/escape-hatch.d.ts +50 -0
  86. package/dist/cli/escape-hatch.d.ts.map +1 -0
  87. package/dist/cli/escape-hatch.js +45 -0
  88. package/dist/cli/escape-hatch.js.map +1 -0
  89. package/dist/cli/index.d.ts +8 -0
  90. package/dist/cli/index.d.ts.map +1 -0
  91. package/dist/cli/index.js +7 -0
  92. package/dist/cli/index.js.map +1 -0
  93. package/dist/cli/listings.d.ts +15 -0
  94. package/dist/cli/listings.d.ts.map +1 -0
  95. package/dist/cli/listings.js +56 -0
  96. package/dist/cli/listings.js.map +1 -0
  97. package/dist/cli/mandate.d.ts +66 -0
  98. package/dist/cli/mandate.d.ts.map +1 -0
  99. package/dist/cli/mandate.js +61 -0
  100. package/dist/cli/mandate.js.map +1 -0
  101. package/dist/cli/output.d.ts +33 -0
  102. package/dist/cli/output.d.ts.map +1 -0
  103. package/dist/cli/output.js +34 -0
  104. package/dist/cli/output.js.map +1 -0
  105. package/dist/cli/preflight.d.ts +38 -0
  106. package/dist/cli/preflight.d.ts.map +1 -0
  107. package/dist/cli/preflight.js +72 -0
  108. package/dist/cli/preflight.js.map +1 -0
  109. package/dist/cli/privy.d.ts +83 -0
  110. package/dist/cli/privy.d.ts.map +1 -0
  111. package/dist/cli/privy.js +230 -0
  112. package/dist/cli/privy.js.map +1 -0
  113. package/dist/cli/progress.d.ts +36 -0
  114. package/dist/cli/progress.d.ts.map +1 -0
  115. package/dist/cli/progress.js +40 -0
  116. package/dist/cli/progress.js.map +1 -0
  117. package/dist/cli/run.d.ts +25 -0
  118. package/dist/cli/run.d.ts.map +1 -0
  119. package/dist/cli/run.js +173 -0
  120. package/dist/cli/run.js.map +1 -0
  121. package/dist/cli/scan-range.d.ts +55 -0
  122. package/dist/cli/scan-range.d.ts.map +1 -0
  123. package/dist/cli/scan-range.js +57 -0
  124. package/dist/cli/scan-range.js.map +1 -0
  125. package/dist/cli/spend-policy.d.ts +60 -0
  126. package/dist/cli/spend-policy.d.ts.map +1 -0
  127. package/dist/cli/spend-policy.js +65 -0
  128. package/dist/cli/spend-policy.js.map +1 -0
  129. package/dist/cli/status.d.ts +90 -0
  130. package/dist/cli/status.d.ts.map +1 -0
  131. package/dist/cli/status.js +252 -0
  132. package/dist/cli/status.js.map +1 -0
  133. package/dist/cli/timeout.d.ts +30 -0
  134. package/dist/cli/timeout.d.ts.map +1 -0
  135. package/dist/cli/timeout.js +55 -0
  136. package/dist/cli/timeout.js.map +1 -0
  137. package/dist/cli/version.d.ts +12 -0
  138. package/dist/cli/version.d.ts.map +1 -0
  139. package/dist/cli/version.js +22 -0
  140. package/dist/cli/version.js.map +1 -0
  141. package/dist/cli/wallet.d.ts +164 -0
  142. package/dist/cli/wallet.d.ts.map +1 -0
  143. package/dist/cli/wallet.js +234 -0
  144. package/dist/cli/wallet.js.map +1 -0
  145. package/dist/frameworks/crewai.d.ts +10 -0
  146. package/dist/frameworks/crewai.d.ts.map +1 -1
  147. package/dist/frameworks/crewai.js +12 -2
  148. package/dist/frameworks/crewai.js.map +1 -1
  149. package/dist/gateway/caller-auth-gateway.d.ts +38 -3
  150. package/dist/gateway/caller-auth-gateway.d.ts.map +1 -1
  151. package/dist/gateway/caller-auth-gateway.js +25 -1
  152. package/dist/gateway/caller-auth-gateway.js.map +1 -1
  153. package/dist/gateway/http-server.d.ts +53 -0
  154. package/dist/gateway/http-server.d.ts.map +1 -1
  155. package/dist/gateway/http-server.js +189 -4
  156. package/dist/gateway/http-server.js.map +1 -1
  157. package/dist/gateway/server-entry.d.ts +1 -0
  158. package/dist/gateway/server-entry.js +1 -0
  159. package/dist/gateway/server-entry.js.map +1 -1
  160. package/dist/gateway/x402-mode.d.ts +123 -0
  161. package/dist/gateway/x402-mode.d.ts.map +1 -0
  162. package/dist/gateway/x402-mode.js +212 -0
  163. package/dist/gateway/x402-mode.js.map +1 -0
  164. package/dist/index.d.ts +6 -4
  165. package/dist/index.d.ts.map +1 -1
  166. package/dist/index.js +8 -3
  167. package/dist/index.js.map +1 -1
  168. package/dist/mandates/env.d.ts +3 -2
  169. package/dist/mandates/env.d.ts.map +1 -1
  170. package/dist/mandates/env.js +3 -2
  171. package/dist/mandates/env.js.map +1 -1
  172. package/dist/mcp/http-server.d.ts +1 -0
  173. package/dist/mcp/http-server.js +1 -0
  174. package/dist/mcp/http-server.js.map +1 -1
  175. package/dist/mcp/server.d.ts +49 -0
  176. package/dist/mcp/server.d.ts.map +1 -1
  177. package/dist/mcp/server.js +533 -25
  178. package/dist/mcp/server.js.map +1 -1
  179. package/dist/mcp/service-invoker.d.ts +97 -0
  180. package/dist/mcp/service-invoker.d.ts.map +1 -0
  181. package/dist/mcp/service-invoker.js +167 -0
  182. package/dist/mcp/service-invoker.js.map +1 -0
  183. package/dist/mcp/stdio.d.ts +1 -0
  184. package/dist/mcp/stdio.js +1 -0
  185. package/dist/mcp/stdio.js.map +1 -1
  186. package/dist/sdk/client.d.ts +25 -1
  187. package/dist/sdk/client.d.ts.map +1 -1
  188. package/dist/sdk/client.js +20 -1
  189. package/dist/sdk/client.js.map +1 -1
  190. package/dist/sdk/invoke.d.ts +19 -4
  191. package/dist/sdk/invoke.d.ts.map +1 -1
  192. package/dist/sdk/invoke.js +69 -5
  193. package/dist/sdk/invoke.js.map +1 -1
  194. package/dist/x402/delivery-oracle.d.ts +108 -0
  195. package/dist/x402/delivery-oracle.d.ts.map +1 -0
  196. package/dist/x402/delivery-oracle.js +174 -0
  197. package/dist/x402/delivery-oracle.js.map +1 -0
  198. package/dist/x402/facilitator-server-entry.d.ts +3 -0
  199. package/dist/x402/facilitator-server-entry.d.ts.map +1 -0
  200. package/dist/x402/facilitator-server-entry.js +27 -0
  201. package/dist/x402/facilitator-server-entry.js.map +1 -0
  202. package/dist/x402/facilitator-server.d.ts +73 -0
  203. package/dist/x402/facilitator-server.d.ts.map +1 -0
  204. package/dist/x402/facilitator-server.js +305 -0
  205. package/dist/x402/facilitator-server.js.map +1 -0
  206. package/dist/x402/facilitator.d.ts +69 -17
  207. package/dist/x402/facilitator.d.ts.map +1 -1
  208. package/dist/x402/facilitator.js +76 -33
  209. package/dist/x402/facilitator.js.map +1 -1
  210. package/dist/x402/payment-requirements.d.ts +106 -0
  211. package/dist/x402/payment-requirements.d.ts.map +1 -0
  212. package/dist/x402/payment-requirements.js +138 -0
  213. package/dist/x402/payment-requirements.js.map +1 -0
  214. package/dist/x402/relayer.d.ts +41 -0
  215. package/dist/x402/relayer.d.ts.map +1 -0
  216. package/dist/x402/relayer.js +64 -0
  217. package/dist/x402/relayer.js.map +1 -0
  218. package/dist/x402/resource-index.d.ts +75 -0
  219. package/dist/x402/resource-index.d.ts.map +1 -0
  220. package/dist/x402/resource-index.js +126 -0
  221. package/dist/x402/resource-index.js.map +1 -0
  222. package/dist/x402/verified-delivery-facilitator.d.ts +285 -0
  223. package/dist/x402/verified-delivery-facilitator.d.ts.map +1 -0
  224. package/dist/x402/verified-delivery-facilitator.js +423 -0
  225. package/dist/x402/verified-delivery-facilitator.js.map +1 -0
  226. package/dist/zktls/t2-delivery-proof.d.ts +6 -6
  227. package/docs/agent-layer.md +14 -9
  228. package/docs/cli.md +705 -0
  229. package/docs/crewai.md +6 -2
  230. package/docs/eliza.md +6 -1
  231. package/docs/mcp-hosted.md +7 -5
  232. package/docs/mcp-reference.md +175 -0
  233. package/docs/quickstart.md +36 -9
  234. package/docs/threat-model.md +4 -3
  235. package/docs/x402.md +648 -0
  236. package/package.json +33 -10
  237. package/src/capability/invocation-capability.ts +17 -1
  238. package/src/cli/amounts.ts +102 -0
  239. package/src/cli/args.ts +150 -0
  240. package/src/cli/attesters.ts +86 -0
  241. package/src/cli/bin.ts +5 -0
  242. package/src/cli/commands/claim.ts +126 -0
  243. package/src/cli/commands/close.ts +69 -0
  244. package/src/cli/commands/discover.ts +228 -0
  245. package/src/cli/commands/invoke.ts +178 -0
  246. package/src/cli/commands/mcp.ts +135 -0
  247. package/src/cli/commands/open.ts +397 -0
  248. package/src/cli/commands/reclaim-unverified.ts +218 -0
  249. package/src/cli/commands/reclaim.ts +377 -0
  250. package/src/cli/commands/status.ts +56 -0
  251. package/src/cli/commands/streams.ts +344 -0
  252. package/src/cli/commands/watch.ts +70 -0
  253. package/src/cli/config.ts +208 -0
  254. package/src/cli/context.ts +30 -0
  255. package/src/cli/deps.ts +528 -0
  256. package/src/cli/descriptor.ts +133 -0
  257. package/src/cli/errors.ts +162 -0
  258. package/src/cli/escape-hatch.ts +92 -0
  259. package/src/cli/index.ts +27 -0
  260. package/src/cli/listings.ts +77 -0
  261. package/src/cli/mandate.ts +126 -0
  262. package/src/cli/output.ts +63 -0
  263. package/src/cli/preflight.ts +88 -0
  264. package/src/cli/privy.ts +396 -0
  265. package/src/cli/progress.ts +75 -0
  266. package/src/cli/run.ts +209 -0
  267. package/src/cli/scan-range.ts +76 -0
  268. package/src/cli/spend-policy.ts +139 -0
  269. package/src/cli/status.ts +381 -0
  270. package/src/cli/timeout.ts +64 -0
  271. package/src/cli/version.ts +21 -0
  272. package/src/cli/wallet.ts +372 -0
  273. package/src/frameworks/crewai.ts +13 -2
  274. package/src/gateway/caller-auth-gateway.ts +77 -6
  275. package/src/gateway/http-server.ts +280 -6
  276. package/src/gateway/server-entry.ts +1 -0
  277. package/src/gateway/x402-mode.ts +350 -0
  278. package/src/index.ts +40 -5
  279. package/src/mandates/env.ts +3 -2
  280. package/src/mcp/http-server.ts +1 -0
  281. package/src/mcp/server.ts +706 -30
  282. package/src/mcp/service-invoker.ts +285 -0
  283. package/src/mcp/stdio.ts +1 -0
  284. package/src/sdk/client.ts +33 -1
  285. package/src/sdk/invoke.ts +90 -12
  286. package/src/x402/delivery-oracle.ts +285 -0
  287. package/src/x402/facilitator-server-entry.ts +35 -0
  288. package/src/x402/facilitator-server.ts +445 -0
  289. package/src/x402/facilitator.ts +125 -46
  290. package/src/x402/payment-requirements.ts +231 -0
  291. package/src/x402/relayer.ts +122 -0
  292. package/src/x402/resource-index.ts +228 -0
  293. package/src/x402/verified-delivery-facilitator.ts +744 -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, **a spec-compliant x402 facilitator that refuses to settle payment for a service its
16
+ own oracle says is not delivering** (read [`docs/x402.md`](./docs/x402.md) — the two `402`
17
+ flows are different and only one of them is x402), 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
 
@@ -25,7 +29,18 @@ Docs: [metrik.live](https://metrik.live). Frontdoor: [github.com/Absol-Labs](htt
25
29
  pnpm add @absol-labs/agent
26
30
  ```
27
31
 
28
- The package is **ESM-only** (`"type": "module"`) and targets **Node `>=20 <21`**. It ships
32
+ The package ships four executables. Run the CLI with no install at all:
33
+
34
+ ```bash
35
+ npx --package @absol-labs/agent metrik discover
36
+ ```
37
+
38
+ `metrik` is the CLI below; `metrik-mcp` starts the MCP server over stdio
39
+ (`metrik mcp --print-config` prints the client config that runs it);
40
+ `metrik-mcp-http` starts the hosted multi-tenant MCP transport; `metrik-gateway`
41
+ starts the reference caller-auth gateway a seller puts in front of their service.
42
+
43
+ The package is **ESM-only** (`"type": "module"`) and targets **Node `>=20.19 <25`** (verified on 20.19, 22 LTS and 24). It ships
29
44
  `@absol-labs/sdk`, `@absol-labs/shared`, `viem`, `zod`, the Reclaim zkTLS SDKs, the
30
45
  Coinbase CDP SDK, and the MCP SDK as dependencies. The autonomous wallet path also
31
46
  installs a prebuilt native OS-keyring binding; it is
@@ -42,15 +57,52 @@ and hard-stops on denial; `MandateDecision` returns a machine-readable reason. B
42
57
  actions (close, reclaim) verify only the signature — never expiry or caps — so a lapsed
43
58
  mandate can never strand the buyer's own funds in escrow.
44
59
 
45
- **The x402 facilitator** (`VerifiedStreamX402Facilitator`) turns an HTTP `402` challenge
46
- into a real on-chain stream open instead of a one-shot payment. The agent receives a
47
- verified-streaming requirement, signs a payload bound to its mandate, and the facilitator
48
- opens the escrowed stream through the SDK.
49
-
50
- **The MCP server** exposes `discover_services`, `hire_verified_service`,
60
+ **The Metrik `402` challenge flow** (`VerifiedStreamFacilitator`) turns an HTTP `402`
61
+ challenge into a real on-chain stream open instead of a one-shot payment. The agent
62
+ receives a verified-streaming requirement, signs a payload bound to its mandate, and the
63
+ stream is opened through the SDK.
64
+
65
+ > **This is Metrik's own `402` flow, not the x402 protocol.** It uses its own scheme
66
+ > string (`streamproof-verified-stream`), its own challenge and payload shapes, and its
67
+ > own `X-METRIK-PAYMENT` header. It does **not** speak the x402 wire format and will
68
+ > **not** interoperate with `x402-fetch`, `x402-axios`, `x402-express`, or any standard
69
+ > x402 client or facilitator. For that, see the separate facilitator below.
70
+
71
+ **The x402 verified-delivery facilitator** (`metrik-x402-facilitator`) is the other,
72
+ genuinely-x402 half. It implements the standard facilitator interface — `POST /verify`,
73
+ `POST /settle`, `GET /supported` — for the standard `exact` scheme, and then asks one
74
+ question no other facilitator can: **is this service currently passing Metrik's delivery
75
+ checks?** If the oracle says it is failing, `/verify` answers `isValid: false` and `/settle`
76
+ broadcasts nothing. Standard headers, standard schemes, `x402-fetch` works untouched, no
77
+ contract change.
78
+
79
+ The seller-side gateway has a matching opt-in mode: a request with no Metrik capability gets
80
+ a real x402 `402` carrying `PaymentRequirements` whose `payTo` is derived from the
81
+ operator-signed listing, so an agent holding only `x402-fetch` can pay per call.
82
+
83
+ `POST /settle` makes the operator's relayer sign and pay gas, so it is fenced: an **asset
84
+ allowlist** (default the chain's USDC) so the relayer can never be induced to call a
85
+ caller-chosen contract, a **bearer token** (`METRIK_X402_FACILITATOR_TOKEN`, required at
86
+ startup), a **settlement scope** limiting gas spend to resources Metrik tracks, and
87
+ network/non-zero-amount checks. `/verify` and `/supported` stay public.
88
+
89
+ > This is **weaker buyer protection than a stream, and deliberately so.** An `exact`
90
+ > payment holds nothing in escrow: the gate can PREVENT a payment to a failing service, it
91
+ > can **never** recover one that already went through. Only the stream path makes unearned
92
+ > money recoverable. [`docs/x402.md`](./docs/x402.md) has the full account, the
93
+ > 90-second freshness window and the reasoning behind it, and what is still unproven.
94
+ >
95
+ > **Settlement has never broadcast a transaction from this repo.** `/settle` is implemented
96
+ > end to end and delegates to the real `x402` `settle()`, but running it needs a relayer
97
+ > wallet funded with gas that does not exist yet. The server refuses to start without a
98
+ > relayer key unless `METRIK_X402_ALLOW_VERIFY_ONLY=true` is set explicitly.
99
+
100
+ **The MCP server** exposes `discover_services`, `hire_verified_service`, `invoke_service`,
51
101
  `check_stream_status`, `reclaim_unspent`, `list_streams`, and — when Reclaim credentials are
52
- configured — `prove_https_response`, so any MCP-native agent transacts directly. It reads
53
- settlement config from the environment and never accepts a raw key as a tool argument.
102
+ configured — `prove_https_response`, so an MCP-native agent can discover a service, pay for
103
+ it, **call it**, and recover what it did not spend without leaving the tool surface. It reads
104
+ settlement config from the environment and never accepts a raw key as a tool argument. Full
105
+ reference: [`docs/mcp-reference.md`](./docs/mcp-reference.md).
54
106
 
55
107
  **Framework adapters** put the same mandate-gated client behind AgentKit, ElizaOS,
56
108
  LangChain, and CrewAI, each importable from its own subpath.
@@ -195,15 +247,15 @@ See [`scripts/e2e-hire.ts`](./scripts/e2e-hire.ts) for the full journey (create/
195
247
  hire → invoke → settle) run against real Base Sepolia infrastructure: `pnpm e2e:hire` (needs real CDP
196
248
  creds — see `.env.example`).
197
249
 
198
- ### Hire via x402: `402` challenge → signed payload → open stream
250
+ ### Hire via the Metrik `402` flow: challenge → signed payload → open stream
199
251
 
200
252
  ```ts
201
253
  import {
202
- VerifiedStreamX402Facilitator,
203
- encodeX402PayloadHeader,
254
+ VerifiedStreamFacilitator,
255
+ encodeStreamPayloadHeader,
204
256
  } from "@absol-labs/agent";
205
257
 
206
- const facilitator = new VerifiedStreamX402Facilitator({
258
+ const facilitator = new VerifiedStreamFacilitator({
207
259
  sdkConfig, // @absol-labs/sdk StreamProofClientConfig (chain, transport, account, escrow, usdc)
208
260
  });
209
261
 
@@ -217,22 +269,123 @@ const challenge = facilitator.challenge({
217
269
  maxBudgetUsdc: 2_000_000n,
218
270
  });
219
271
 
220
- const header = encodeX402PayloadHeader({ challenge, signedMandate });
272
+ const header = encodeStreamPayloadHeader({ challenge, signedMandate });
221
273
  const { streamId } = await facilitator.open(header); // mandate-gated, opens on-chain
222
274
  ```
223
275
 
224
- The scheme name is exported as `X402_SCHEME`; `parseX402ChallengeJson`,
225
- `parseX402PayloadHeader`, and `encodeX402PayloadHeader` handle the wire format on both sides.
276
+ The scheme name is exported as `METRIK_STREAM_SCHEME`; `parseStreamChallengeJson`,
277
+ `parseStreamPayloadHeader`, and `encodeStreamPayloadHeader` handle the wire format on both
278
+ sides, and the payload travels under `METRIK_PAYMENT_HEADER` (`x-metrik-payment`) — never
279
+ under x402's `X-PAYMENT` (the gateway's separate x402 mode uses that header, because there
280
+ it really is x402; a request carrying both is refused with `400 ambiguous-payment-mode`).
281
+ This wire format is Metrik's own; see [`docs/x402.md`](./docs/x402.md). The older `X402*`
282
+ identifiers still work as deprecated aliases, but the names above are canonical.
283
+
284
+ ### The CLI
285
+
286
+ `metrik` runs the whole product loop from a terminal — the first surface that does.
287
+ Every command is the same mandate-gated SDK path the library exposes; nothing is
288
+ reimplemented.
289
+
290
+ ```bash
291
+ metrik discover --min-tier 2
292
+ metrik open --service <serviceRef> --rate 0.000001 --budget 0.27 --duration 1h [--dry-run]
293
+ metrik status <streamId>
294
+ metrik streams --role buyer --limit 5
295
+ metrik watch <streamId> --interval 15
296
+ metrik invoke <streamId> --method POST --path /transform --body '{"text":"hi"}'
297
+ metrik close <streamId>
298
+ metrik reclaim <streamId>
299
+ metrik claim <streamId> # operator: redeem what verified
300
+ metrik reclaim-unverified <streamId> --forfeit-unclaimed # buyer escape hatch
301
+ metrik mcp --print-config
302
+ ```
303
+
304
+ - **Testnet only.** The CLI refuses any chain outside Base Sepolia (`84532`), and
305
+ re-reads the chain id the RPC endpoint actually serves before it signs anything.
306
+ There is no override flag.
307
+ - **The meter runs on verified availability, not on your calls.** A stream is a
308
+ per-second rental of an endpoint that keeps proving it is alive — not per-request
309
+ billing. You are charged for the seconds that verified whether or not you invoked
310
+ once or a thousand times, and a failed interval advances the clock and pays nothing.
311
+ - **`metrik claim` is the seller's side** of the `operator claimable` figure `status`
312
+ has always printed. It is operator-gated on-chain, so a wallet that is not the
313
+ stream's operator is refused before anything is broadcast rather than paying gas to
314
+ learn it.
315
+ - **`metrik reclaim-unverified` is the no-proof escape hatch.** Every other route to a
316
+ buyer's money needs a Merkle proof from the oracle, so it is only as available as the
317
+ oracle is; this one needs no proof, no quorum and no guardian. It costs the operator
318
+ everything they verifiably earned but had not yet claimed on-chain — permanently, and
319
+ paid to the buyer — so it is its own command behind a mandatory `--forfeit-unclaimed`,
320
+ never a flag on `reclaim`. It unlocks at `expiresAt + escapeGraceSeconds`, gated on
321
+ **`expiresAt` and never on `closedAt`**: closing a 24h stream after ten minutes does
322
+ not bring the hatch forward.
323
+ - **`status` may report `pending final checkpoint`** after a stream stops, instead of a
324
+ reclaimable figure. That is correct: until a checkpoint covers the stop time, any
325
+ number would be one you cannot actually obtain.
326
+ - **`discover` and `status` disclose verifier overlap.** When a listing's operator is
327
+ also one of the escrow's oracle signers, both say so — the party being paid is among
328
+ the parties attesting that delivery happened. On the current testnet deployment this
329
+ fires on every live listing, because the team seeds its own supply so the marketplace
330
+ is testable. SLA text in a listing is seller-authored and labelled unverified.
331
+ - **`open --dry-run` needs no wallet at all.** It broadcasts nothing, so it prints the
332
+ intended call (and says which parts it could not produce without a key) rather than
333
+ demanding one. `invoke` does need the key even though it broadcasts nothing: it signs
334
+ an off-chain EIP-712 invocation capability as the stream's buyer.
335
+ - **A wallet with no gas is caught before anything is signed**, with the faucet named,
336
+ instead of surfacing the node's `gas required exceeds allowance (0)`. So is a wallet
337
+ that cannot cover `--budget` in USDC — a separate balance, and otherwise a revert you
338
+ pay for the approval to discover.
339
+ - **Two wallet sources**, resolved in a fixed order: `METRIK_AGENT_PRIVATE_KEY`, then a
340
+ Coinbase CDP Server Wallet v2 account. Both are read from the environment only.
341
+ - **`metrik streams` lists a wallet's streams** from the escrow's indexed `StreamOpened`
342
+ logs, anchored at the deploy block — and reports a partial or untrustworthy scan as
343
+ partial rather than as "you have no streams".
344
+ - **The key is read from `METRIK_AGENT_PRIVATE_KEY` only** — never from a flag, which
345
+ would land it in shell history and process listings. Commands print the derived
346
+ address, never the key.
347
+ - **Settlement config defaults to the live Base Sepolia deployment** and is overridable
348
+ per command with `--rpc-url`, `--escrow`, `--usdc`, `--oracle-url`, `--registry-url`,
349
+ `--chain-id`.
350
+ - **Amounts are decimal USDC by default**; pass `--units atomic` for raw 6-decimal base
351
+ units (what `METRIK_E2E_*` and the escrow use).
352
+ - **`--json`** puts a machine-readable document on stdout; warnings and progress always
353
+ go to stderr, so the stream stays parseable. `metrik watch --json` emits **JSON Lines**
354
+ — one compact object per poll, each parseable on its own line.
355
+ - **`reclaim` waits for you.** `reclaimWithProof` reverts with `SettlementWindowOpen`
356
+ until a checkpoint covering the stream's stop time has posted — in practice that means
357
+ the first attempt fails and one ~30s later succeeds. The CLI retries that one
358
+ condition on a bounded schedule (`--attempts`, `--interval`) and narrates the wait;
359
+ every other failure is surfaced immediately.
360
+ - **Accrual comes from the oracle**, not from the stream tuple: `getStream` reports
361
+ `claimedCumulative`/`settledCumulative` as `0` for a stream's entire active life, so
362
+ `status` and `watch` read `GET /checkpoint/proof` instead.
363
+
364
+ `metrik --help`, or `metrik <command> --help`, prints the full flag surface. The runner
365
+ is also importable (`@absol-labs/agent/cli`) if you want to embed it.
226
366
 
227
367
  ### Run the MCP server
228
368
 
229
- The server runs over stdio and reads its settlement config from the environment; it never
230
- asks for a raw key in a tool argument.
369
+ Two transports stdio for local dev, Streamable HTTP for hosting — over the same tool set.
370
+ Either reads its settlement config from the environment; neither ever asks for a raw key in
371
+ a tool argument.
372
+
373
+ **What the agent is buying is TIME, not calls.** `hire_verified_service` starts a per-second
374
+ meter on verified availability; `invoke_service` costs nothing extra, and not calling costs
375
+ the same as calling. Only `reclaim_unspent` stops the clock, and nothing pushes money back on
376
+ its own. Every tool that opens, reads, or ends a stream says so in its own description, which
377
+ is what an agent actually reads.
231
378
 
232
379
  ```bash
233
- pnpm mcp:stdio # or: pnpm mcp:http
380
+ metrik-mcp # installed, or: npx --package @absol-labs/agent metrik-mcp
381
+ metrik-mcp-http # the hosted, multi-tenant Streamable-HTTP transport
382
+ pnpm mcp:stdio # inside this repo; `pnpm mcp:http` for the hosted transport
234
383
  ```
235
384
 
385
+ `metrik mcp --print-config` prints the `mcpServers` block to paste into Claude Desktop
386
+ (or any MCP client), already carrying every variable the server fails closed without.
387
+ Credentials in it are placeholders: the CLI never prints a key back.
388
+
236
389
  Programmatically:
237
390
 
238
391
  ```ts
@@ -243,7 +396,7 @@ import {
243
396
  } from "@absol-labs/agent";
244
397
 
245
398
  console.log(METRIK_MCP_TOOLS.map((t) => t.name));
246
- // discover_services, hire_verified_service, check_stream_status,
399
+ // discover_services, hire_verified_service, invoke_service, check_stream_status,
247
400
  // reclaim_unspent, list_streams, prove_https_response
248
401
 
249
402
  await startVerifiedStreamMcpServerStdio(); // reads process.env, connects stdio
@@ -406,7 +559,7 @@ services use output-probe verification until that protocol support exists.
406
559
  `ReclaimConsumerProofService` (and `createReclaimConsumerProofServiceFromEnv`) generate a
407
560
  Reclaim-backed proof of the exact HTTPS response the agent consumed, verified locally
408
561
  against the declared URL, method, body, match, and redaction policy before it is trusted.
409
- `VerifiedStreamX402Facilitator.proveConsumedHttpsResponse()` binds that proof to the same
562
+ `VerifiedStreamFacilitator.proveConsumedHttpsResponse()` binds that proof to the same
410
563
  buyer/mandate context that opened the stream. When credentials require private headers or
411
564
  cookies, use the programmatic service or the facilitator directly rather than the MCP tool,
412
565
  so secrets never pass through model-visible tool arguments. Treat the result as an L2
@@ -429,7 +582,7 @@ Per-framework guides: [`docs/langchain.md`](./docs/langchain.md),
429
582
 
430
583
  ## Requirements
431
584
 
432
- - Node **`>=20 <21`**, package manager `pnpm@9.15.x`.
585
+ - Node **`>=20.19 <25`** (20.19+, 22 LTS and 24 all supported), package manager `pnpm@9.15.x`.
433
586
  - **ESM only** — this package has no CommonJS build; consume it from an ESM context.
434
587
  - Framework adapters need their matching optional peer dependency installed. Known caveat:
435
588
  the AgentKit adapter pulls a heavy graph (`@coinbase/agentkit` / ZeroDev) that can break a
@@ -446,8 +599,12 @@ pnpm test
446
599
  pnpm build
447
600
  ```
448
601
 
449
- The x402 facilitator, zkTLS proof path, signed-mandate engine, MCP server, and framework
450
- adapters are all real and tested in-repo. The `*.int.test.ts` integration suites deploy the
602
+ The Metrik `402` challenge flow, the x402 verified-delivery facilitator, zkTLS proof path,
603
+ signed-mandate engine, MCP server, and framework adapters are all real and tested in-repo.
604
+ The x402 suite drives the published `x402-fetch` client through a full 402 -> pay -> retry
605
+ cycle against the gateway and asserts the same valid payment is refused when the oracle
606
+ reports the service as failing; only the payer's on-chain balance and the broadcast are
607
+ fixtures, and nothing is ever broadcast. The `*.int.test.ts` integration suites deploy the
451
608
  hardened `StreamEscrow` on a throwaway `anvil` node and self-skip when `anvil` is not on
452
609
  `PATH`, so default CI stays green. A full hire → stream → settle walkthrough lives in
453
610
  [`examples/hire-stream-settle.ts`](examples/hire-stream-settle.ts).
@@ -458,3 +615,4 @@ hardened `StreamEscrow` on a throwaway `anvil` node and self-skip when `anvil` i
458
615
  - Docs: [metrik.live](https://metrik.live) · App: [app.metrik.live](https://app.metrik.live)
459
616
  - SDK: [`@absol-labs/sdk`](https://github.com/Absol-Labs/metrik-sdk)
460
617
  - 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)
618
+ - Metrik and x402 — the facilitator, the delivery gate, and what is still unproven: [`docs/x402.md`](./docs/x402.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;
@@ -56,7 +56,7 @@ export declare const signedInvocationCapabilitySchema: z.ZodObject<{
56
56
  }, "strip", z.ZodTypeAny, {
57
57
  signature: string;
58
58
  streamId: string;
59
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
59
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
60
60
  serviceRef: string;
61
61
  nonce: string;
62
62
  buyer: `0x${string}`;
@@ -65,7 +65,7 @@ export declare const signedInvocationCapabilitySchema: z.ZodObject<{
65
65
  }, {
66
66
  signature: string;
67
67
  streamId: string;
68
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
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,GA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,MAAM,GAClB,0BAA0B,CA2B5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"invocation-capability.js","sourceRoot":"","sources":["../../src/capability/invocation-capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,UAAU,EACV,SAAS,EACT,KAAK,EACL,SAAS,EACT,uBAAuB,EACvB,aAAa,GAId,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,aAAa,GAAG,CAAC;KACpB,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,wBAAwB,CAAC,CAAC;AACjE,MAAM,aAAa,GAAG,CAAC;KACpB,MAAM,EAAE;KACR,MAAM,CACL,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAChE,qBAAqB,CACtB,CAAC;AACJ,MAAM,eAAe,GAAG,CAAC;KACtB,MAAM,EAAE;KACR,MAAM,CACL,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EACjE,6BAA6B,CAC9B,CAAC;AAEJ,+CAA+C;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC;IACrC,KAAK;IACL,MAAM;IACN,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,SAAS;CACV,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,iFAAiF;IACjF,QAAQ,EAAE,aAAa;IACvB,wDAAwD;IACxD,KA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AC"}
1
+ {"version":3,"file":"invocation-capability.js","sourceRoot":"","sources":["../../src/capability/invocation-capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,UAAU,EACV,SAAS,EACT,KAAK,EACL,SAAS,EACT,uBAAuB,EACvB,aAAa,GAId,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,aAAa,GAAG,CAAC;KACpB,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,wBAAwB,CAAC,CAAC;AACjE,MAAM,aAAa,GAAG,CAAC;KACpB,MAAM,EAAE;KACR,MAAM,CACL,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAChE,qBAAqB,CACtB,CAAC;AACJ,MAAM,eAAe,GAAG,CAAC;KACtB,MAAM,EAAE;KACR,MAAM,CACL,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EACjE,6BAA6B,CAC9B,CAAC;AAEJ,+CAA+C;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC;IACrC,KAAK;IACL,MAAM;IACN,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,SAAS;CACV,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,iFAAiF;IACjF,QAAQ,EAAE,aAAa;IACvB,wDAAwD;IACxD,KAAK,EAAE,aAAa;IACpB,uEAAuE;IACvE,UAA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USDC — 6 decimals on every deployment Metrik settles against. */
2
+ export declare const USDC_DECIMALS = 6;
3
+ /**
4
+ * How `--budget` / `--rate` are interpreted.
5
+ *
6
+ * - `"usdc"` (default): decimal USDC, e.g. `--budget 0.27`.
7
+ * - `"atomic"`: raw 6-decimal base units, e.g. `--budget 270000`.
8
+ *
9
+ * Both are offered because the two audiences count differently: a human reads
10
+ * USDC, while the escrow, the oracle and every `METRIK_E2E_*` fixture are in
11
+ * atomic units. Guessing from the magnitude of the number would be a silent
12
+ * 1,000,000x mistake on a fund-moving command, so the unit is explicit.
13
+ */
14
+ export type AmountUnits = "usdc" | "atomic";
15
+ export declare function parseAmountUnits(raw: string | undefined): AmountUnits;
16
+ /** Parses a `--budget`/`--rate` value into atomic USDC units. */
17
+ export declare function parseUsdcAmount(raw: string, units: AmountUnits, flagName: string): bigint;
18
+ /** `270000n` -> `"0.27 USDC (270000 atomic)"`. */
19
+ export declare function formatUsdc(atomic: bigint): string;
20
+ /**
21
+ * Parses `--duration`: bare seconds, or a `s`/`m`/`h`/`d` suffix.
22
+ */
23
+ export declare function parseDurationSeconds(raw: string): number;
24
+ /** Seconds -> a compact human duration (`3600` -> `1h`). */
25
+ export declare function formatDuration(seconds: number): string;
26
+ //# sourceMappingURL=amounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amounts.d.ts","sourceRoot":"","sources":["../../src/cli/amounts.ts"],"names":[],"mappings":"AAIA,2EAA2E;AAC3E,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5C,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CAIrE;AAED,iEAAiE;AACjE,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CAuBR;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAmBxD;AAED,4DAA4D;AAC5D,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAetD"}
@@ -0,0 +1,71 @@
1
+ import { formatUnits, parseUnits } from "viem";
2
+ import { usageError } from "./errors.js";
3
+ /** Circle USDC — 6 decimals on every deployment Metrik settles against. */
4
+ export const USDC_DECIMALS = 6;
5
+ export function parseAmountUnits(raw) {
6
+ if (raw === undefined || raw === "usdc")
7
+ return "usdc";
8
+ if (raw === "atomic")
9
+ return "atomic";
10
+ throw usageError(`--units must be "usdc" or "atomic" (got "${raw}")`);
11
+ }
12
+ /** Parses a `--budget`/`--rate` value into atomic USDC units. */
13
+ export function parseUsdcAmount(raw, units, flagName) {
14
+ if (units === "atomic") {
15
+ if (!/^\d+$/.test(raw)) {
16
+ throw usageError(`--${flagName} must be a non-negative integer of atomic USDC units (got "${raw}")`);
17
+ }
18
+ return BigInt(raw);
19
+ }
20
+ if (!/^\d+(\.\d+)?$/.test(raw)) {
21
+ throw usageError(`--${flagName} must be a decimal USDC amount (got "${raw}")`, "pass --units atomic to supply raw 6-decimal base units instead.");
22
+ }
23
+ const fraction = raw.split(".")[1];
24
+ if (fraction !== undefined && fraction.length > USDC_DECIMALS) {
25
+ throw usageError(`--${flagName} has more precision than USDC supports (${USDC_DECIMALS} decimals): ${raw}`);
26
+ }
27
+ return parseUnits(raw, USDC_DECIMALS);
28
+ }
29
+ /** `270000n` -> `"0.27 USDC (270000 atomic)"`. */
30
+ export function formatUsdc(atomic) {
31
+ return `${formatUnits(atomic, USDC_DECIMALS)} USDC (${atomic.toString()} atomic)`;
32
+ }
33
+ /**
34
+ * Parses `--duration`: bare seconds, or a `s`/`m`/`h`/`d` suffix.
35
+ */
36
+ export function parseDurationSeconds(raw) {
37
+ const match = /^(\d+)([smhd]?)$/.exec(raw);
38
+ if (match === null) {
39
+ throw usageError(`--duration must be seconds, optionally suffixed s/m/h/d (got "${raw}")`);
40
+ }
41
+ const value = Number(match[1]);
42
+ const multiplier = { "": 1, s: 1, m: 60, h: 3_600, d: 86_400 }[match[2] ?? ""];
43
+ if (multiplier === undefined) {
44
+ throw usageError(`--duration has an unsupported unit: ${raw}`);
45
+ }
46
+ const seconds = value * multiplier;
47
+ if (!Number.isSafeInteger(seconds) || seconds <= 0) {
48
+ throw usageError(`--duration must be a positive number of seconds: ${raw}`);
49
+ }
50
+ return seconds;
51
+ }
52
+ /** Seconds -> a compact human duration (`3600` -> `1h`). */
53
+ export function formatDuration(seconds) {
54
+ if (seconds <= 0)
55
+ return "0s";
56
+ const parts = [];
57
+ let remaining = seconds;
58
+ for (const [unit, size] of [
59
+ ["d", 86_400],
60
+ ["h", 3_600],
61
+ ["m", 60],
62
+ ["s", 1],
63
+ ]) {
64
+ const count = Math.floor(remaining / size);
65
+ if (count > 0)
66
+ parts.push(`${count}${unit}`);
67
+ remaining -= count * size;
68
+ }
69
+ return parts.join(" ");
70
+ }
71
+ //# sourceMappingURL=amounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amounts.js","sourceRoot":"","sources":["../../src/cli/amounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAe/B,MAAM,UAAU,gBAAgB,CAAC,GAAuB;IACtD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACvD,IAAI,GAAG,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IACtC,MAAM,UAAU,CAAC,4CAA4C,GAAG,IAAI,CAAC,CAAC;AACxE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ACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A deliberately small GNU-style argument parser. The CLI ships no argument
3
+ * parsing dependency: the surface is seven commands with a handful of flags, and
4
+ * the packed tarball should stay as light as the library it wraps.
5
+ *
6
+ * Supported forms: `--flag`, `--flag value`, `--flag=value`, `--no-flag`, and
7
+ * positional arguments. `--` ends flag parsing.
8
+ */
9
+ export interface ParsedArgs {
10
+ readonly command: string | null;
11
+ readonly positionals: readonly string[];
12
+ /**
13
+ * Every occurrence of each flag, in order. Repeats are kept rather than
14
+ * overwritten so `--header` can be given more than once; scalar readers take
15
+ * the last occurrence.
16
+ */
17
+ readonly flags: ReadonlyMap<string, readonly (string | boolean)[]>;
18
+ }
19
+ export declare function parseArgs(argv: readonly string[]): ParsedArgs;
20
+ /** Reads a flag that must carry a string value. */
21
+ export declare function stringFlag(args: ParsedArgs, name: string): string | undefined;
22
+ /** Every occurrence of a repeatable string flag (e.g. `--header`). */
23
+ export declare function stringFlags(args: ParsedArgs, name: string): string[];
24
+ export declare function requiredStringFlag(args: ParsedArgs, name: string): string;
25
+ export declare function booleanFlag(args: ParsedArgs, name: string): boolean;
26
+ export declare function integerFlag(args: ParsedArgs, name: string): number | undefined;
27
+ /**
28
+ * Rejects flags the command does not understand. A silently ignored `--budgt`
29
+ * on a fund-moving command is how someone spends more than they meant to.
30
+ */
31
+ export declare function assertKnownFlags(args: ParsedArgs, known: readonly string[]): void;
32
+ //# sourceMappingURL=args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;CACpE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAiD7D;AAQD,mDAAmD;AACnD,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ7E;AAED,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAQpE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMzE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CASnE;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAOpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,IAAI,CAWN"}