@absol-labs/agent 0.3.2 → 0.4.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.
package/README.md CHANGED
@@ -1,183 +1,222 @@
1
1
  # @absol-labs/agent
2
2
 
3
- The **Metrik agent layer** how AI agents hire and pay for verified services through
4
- Metrik, safely. This is the **go-to-market wedge** and the investor headline:
5
- _verified, per-second, conditional payments for autonomous agents, built on x402._
6
- The layer is operator/infra-agnostic by design: _"x402 proves the payment, Metrik
7
- proves the delivery."_
3
+ The Metrik agent layer: everything an autonomous agent needs to **hire and pay for
4
+ third-party services safely**, where money is released only for delivery that is
5
+ independently verified. Metrik is an infra-agnostic verified-service marketplace and
6
+ payment rail for AI agents, settling in USDC on Base. The tagline is the design
7
+ contract: **x402 proves the payment, Metrik proves the delivery** — and delivery,
8
+ honestly scoped, is what this package makes an agent able to enforce, never
9
+ "proven-correct output."
10
+
11
+ It builds on [`@absol-labs/sdk`](https://github.com/Absol-Labs/metrik-sdk), which speaks
12
+ to the on-chain metered escrow. This layer wraps that client in the guardrails and
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,
16
+ Reclaim consumer zkTLS for buyer-side delivery proofs, and non-custodial Coinbase CDP
17
+ wallets so Metrik never holds a key.
18
+
19
+ Live on Base Sepolia (chainId `84532`), testnet only. App: [app.metrik.live](https://app.metrik.live).
20
+ Docs: [metrik.live](https://metrik.live). Frontdoor: [github.com/Absol-Labs](https://github.com/Absol-Labs).
21
+
22
+ ## Install
8
23
 
9
- Built on [`@absol-labs/sdk`](https://github.com/Absol-Labs/streamproof-sdk); it turns
10
- the protocol into something an agent can actually use.
24
+ ```bash
25
+ pnpm add @absol-labs/agent
26
+ ```
11
27
 
12
- > **New here?** [`docs/quickstart.md`](./docs/quickstart.md) hire a verified,
13
- > auto-refunding service in under 10 minutes (install → wallet → mandate → hire →
14
- > monitor → settle), with copy-pasteable examples for all four integration surfaces.
28
+ The package is **ESM-only** (`"type": "module"`) and targets **Node `>=20 <21`**. It ships
29
+ `@absol-labs/sdk`, `@absol-labs/shared`, `viem`, `zod`, the Reclaim zkTLS SDKs, the
30
+ Coinbase CDP SDK, and the MCP SDK as dependencies. The agent-framework packages
31
+ (`@coinbase/agentkit`, `@elizaos/core`, `@langchain/core`) are **optional peer
32
+ dependencies** — install only the one you use.
33
+
34
+ ## What it does
35
+
36
+ **Spend mandates** are the "an agent can't run away with the wallet" guarantee. The wallet
37
+ owner signs an EIP-712 `SpendMandate` carrying per-stream, total, rate, and duration caps
38
+ plus an operator allowlist and expiry. Every buyer-side fund move checks the mandate first
39
+ and hard-stops on denial; `MandateDecision` returns a machine-readable reason. Buyer-recovery
40
+ actions (close, reclaim) verify only the signature — never expiry or caps — so a lapsed
41
+ mandate can never strand the buyer's own funds in escrow.
42
+
43
+ **The x402 facilitator** (`VerifiedStreamX402Facilitator`) turns an HTTP `402` challenge
44
+ into a real on-chain stream open instead of a one-shot payment. The agent receives a
45
+ verified-streaming requirement, signs a payload bound to its mandate, and the facilitator
46
+ opens the escrowed stream through the SDK.
47
+
48
+ **The MCP server** exposes `discover_services`, `hire_verified_service`,
49
+ `check_stream_status`, `reclaim_unspent`, `list_streams`, and — when Reclaim credentials are
50
+ configured — `prove_https_response`, so any MCP-native agent transacts directly. It reads
51
+ settlement config from the environment and never accepts a raw key as a tool argument.
52
+
53
+ **Framework adapters** put the same mandate-gated client behind AgentKit, ElizaOS,
54
+ LangChain, and CrewAI, each importable from its own subpath.
55
+
56
+ **Consumer zkTLS** (`ReclaimConsumerProofService`) lets the buyer prove the exact HTTPS
57
+ response it received, bound to its stream context. This is the L2 delivery signal in
58
+ Metrik's verification stack — dispute evidence that complements, and never replaces, the
59
+ oracle's L1 observations.
60
+
61
+ **Non-custodial wallets**: `resolveAgentWallet()` accepts either an injected viem signer or
62
+ a provisioned Coinbase CDP Server Wallet v2 account. CDP mode uses Coinbase-managed remote
63
+ signing, so no private key is ever read or exported.
64
+
65
+ ## Usage
66
+
67
+ ### Sign and check a spend mandate
68
+
69
+ ```ts
70
+ import { privateKeyToAccount } from "viem/accounts";
71
+ import {
72
+ spendMandateSchema,
73
+ signedSpendMandateSchema,
74
+ createSpendMandateTypedData,
75
+ checkMandate,
76
+ } from "@absol-labs/agent";
77
+
78
+ const owner = privateKeyToAccount(
79
+ process.env.METRIK_AGENT_PRIVATE_KEY as `0x${string}`,
80
+ );
81
+
82
+ const mandate = spendMandateSchema.parse({
83
+ maxPerStreamUsdc: 5_000_000n, // 5 USDC (6 decimals)
84
+ maxTotalUsdc: 50_000_000n,
85
+ maxRatePerSecondUsdc: 1_000n,
86
+ maxDurationSeconds: 86_400,
87
+ allowedOperators: ["0x28ea4eF61ac4cca3ed6a64dBb5b2D4be1aDC9814"],
88
+ expiresAt: 2_000_000_000,
89
+ });
90
+
91
+ const unsigned = {
92
+ mandateId: `0x${"77".repeat(32)}` as const,
93
+ owner: owner.address,
94
+ chainId: 84532,
95
+ issuedAt: Math.floor(Date.now() / 1000),
96
+ mandate,
97
+ };
98
+
99
+ const signature = await owner.signTypedData(
100
+ createSpendMandateTypedData(unsigned),
101
+ );
102
+ const signedMandate = signedSpendMandateSchema.parse({
103
+ ...unsigned,
104
+ signature,
105
+ });
106
+
107
+ // Every fund-moving action gates on this. Fail-closed on any denial.
108
+ const decision = await checkMandate(
109
+ signedMandate,
110
+ {
111
+ operator: "0x28ea4eF61ac4cca3ed6a64dBb5b2D4be1aDC9814",
112
+ budgetUsdc: 2_000_000n,
113
+ ratePerSecondUsdc: 500n,
114
+ maxDurationSeconds: 3_600,
115
+ },
116
+ 0n, // spentSoFarUsdc under this mandate
117
+ { nowSeconds: Math.floor(Date.now() / 1000) },
118
+ );
119
+
120
+ if (!decision.allowed) throw new Error(`mandate denied: ${decision.reason}`);
121
+ ```
15
122
 
16
- > **Why agents are the wedge** + the full agent journey:
17
- > [`product-strategy.md`](https://github.com/Absol-Labs/streamproof-protocol/blob/main/docs/product-strategy.md)
18
- > and [`production-flow.md`](https://github.com/Absol-Labs/streamproof-protocol/blob/main/docs/production-flow.md)
19
- > (Journey 2 — Atlas). The agent's own zkTLS delivery proof is **L2** (consumer zkTLS) in
20
- > [`verification-model.md`](https://github.com/Absol-Labs/streamproof-protocol/blob/main/docs/verification-model.md).
21
- > The explicit agent-layer security review lives in
22
- > [docs/threat-model.md](./docs/threat-model.md).
123
+ ### Hire via x402: `402` challenge signed payload open stream
124
+
125
+ ```ts
126
+ import {
127
+ VerifiedStreamX402Facilitator,
128
+ encodeX402PayloadHeader,
129
+ } from "@absol-labs/agent";
130
+
131
+ const facilitator = new VerifiedStreamX402Facilitator({
132
+ sdkConfig, // @absol-labs/sdk StreamProofClientConfig (chain, transport, account, escrow, usdc)
133
+ });
134
+
135
+ const challenge = facilitator.challenge({
136
+ operator: "0x28ea4eF61ac4cca3ed6a64dBb5b2D4be1aDC9814",
137
+ serviceRef: `0x${"ab".repeat(32)}`,
138
+ chainId: 84532,
139
+ escrow: sdkConfig.escrow,
140
+ ratePerSecondUsdc: 500n,
141
+ maxDurationSeconds: 3_600,
142
+ maxBudgetUsdc: 2_000_000n,
143
+ });
144
+
145
+ const header = encodeX402PayloadHeader({ challenge, signedMandate });
146
+ const { streamId } = await facilitator.open(header); // mandate-gated, opens on-chain
147
+ ```
23
148
 
24
- ## What's here
149
+ The scheme name is exported as `X402_SCHEME`; `parseX402ChallengeJson`,
150
+ `parseX402PayloadHeader`, and `encodeX402PayloadHeader` handle the wire format on both sides.
25
151
 
26
- ```
27
- src/
28
- mandates/ spend mandates — per-stream/total/rate/duration caps + operator
29
- allowlists. The "agents can't run away with the wallet" guarantee.
30
- sdk/ mandate-gated wrapper over @absol-labs/sdk for open/status/claim/reclaim.
31
- x402/ Metrik as an x402 verified-streaming payment scheme / facilitator.
32
- mcp/ an MCP server exposing hire/monitor/reclaim as agent tools.
33
- docs/
34
- quickstart.md zero → hired verified service in <10 min (start here).
35
- agent-layer.md the product design + investor narrative.
36
- crewai.md CrewAI's official MCP integration path for Metrik tools.
37
- eliza.md ElizaOS plugin/actions for hire/status/reclaim.
38
- threat-model.md the explicit autonomous-spend / key-custody review.
39
- langchain.md the LangChain tool adapter and example loop.
40
- ```
152
+ ### Run the MCP server
41
153
 
42
- ## The four pieces
43
-
44
- 1. **x402 integration** — an agent hits a `402`, gets back a _verified-streaming_
45
- payment requirement, and opens a stream instead of a one-shot payment. Reuses
46
- the `402` negotiation surface and opens the on-chain stream through the SDK.
47
- 2. **MCP server** — exposes "hire verified compute / get status / reclaim" as MCP
48
- tools so any MCP agent (Claude, etc.) transacts natively. When Reclaim creds are
49
- configured, it also exposes `prove_https_response` for public-response zkTLS proofs
50
- tied to a tracked stream.
51
- 3. **Framework tools** — LangChain, ElizaOS, and CrewAI now sit on top of the same
52
- mandate-gated client. CrewAI consumes the existing MCP lane via its official MCP
53
- integration; ElizaOS gets a direct plugin/action surface.
54
- 4. **Spend mandates** — owner-signed EIP-712 budget/intent guardrails (AP2-style):
55
- caps and allowlists enforced before any fund-moving action, with expiry and
56
- local revocation checks.
57
- 5. **zkTLS delivery proofs (L2, consumer zkTLS)** — the agent can now produce a Reclaim-backed proof
58
- of the exact HTTPS response it consumed, bound to buyer/stream context and intended
59
- to complement, not replace, oracle L1 evidence.
60
-
61
- Current real chain surface:
62
-
63
- - `VerifiedStreamAgentClient` wraps `@absol-labs/sdk` for `open`, `status`, `claim`,
64
- `close`, and `reclaim`.
65
- - All autonomous fund-moving helpers (`openVerifiedStream()`, `claimStream()`,
66
- `closeStream()`, `reclaimStream()`) enforce signed-mandate verification first and
67
- hard-stop on denial.
68
- - `VerifiedStreamX402Facilitator` turns an HTTP `402` challenge into a real verified
69
- stream open on Base Sepolia.
70
- - `createVerifiedStreamMcpServer()` exposes real MCP tools for `hire_verified_service`,
71
- `check_stream_status`, `reclaim_unspent`, and `list_streams`.
72
- - `ReclaimConsumerProofService` generates a verifiable zkTLS proof of a consumed HTTPS
73
- response, hashing the exact request/match/redaction policy before local verification.
74
- - `VerifiedStreamX402Facilitator.proveConsumedHttpsResponse()` binds that proof to the
75
- same buyer/mandate context that opened the stream.
76
- - If Reclaim env vars are configured, `createVerifiedStreamMcpServer()` also exposes
77
- `prove_https_response` for tracked streams. The MCP tool intentionally excludes secret
78
- headers/cookies so credentials do not pass through model-visible tool arguments.
79
- - `createLangChainVerifiedStreamTools()` exposes the same hire/status/reclaim flow as
80
- LangChain tools, including a `shouldStop` status signal for paused streams.
81
- - `createMetrikElizaPlugin()` (alias `metrikElizaPlugin`) exposes the hire/status/reclaim/close
82
- flow as an ElizaOS plugin — canonical `HIRE_VERIFIED_SERVICE`, `CHECK_STREAM_STATUS`,
83
- `RECLAIM_UNSPENT`, and `CLOSE_STREAM` actions with structured results and fail-closed
84
- payload parsing. See [`examples/metrik-character.ts`](examples/metrik-character.ts).
85
- - `createCrewAiVerifiedStreamMcpConfig()` emits a CrewAI `MCPServerStdio` config for
86
- the existing mandate-gated MCP server, with a tool filter limited to verified-stream
87
- operations.
88
- - `resolveAgentWallet()` accepts either an injected viem signer or a provisioned
89
- Coinbase CDP Server Wallet v2 account, then feeds that signer into the existing
90
- agent/SDK path without ever exporting a private key.
91
- - Model A is infra-agnostic: a stream targets a seller payout wallet + `serviceRef`
92
- only (no service-network field). Settlement is single-chain on Base Sepolia.
93
-
94
- ## Wallet modes
95
-
96
- The agent layer now supports two wallet sources:
97
-
98
- - injected viem account via `METRIK_AGENT_PRIVATE_KEY`
99
- - Coinbase CDP Server Wallet v2 via `CDP_API_KEY_ID`, `CDP_API_KEY_SECRET`,
100
- `CDP_WALLET_SECRET`, and `METRIK_AGENT_CDP_OWNER_NAME`
101
-
102
- CDP mode uses Coinbase-managed remote signing. Metrik never reads or exports the
103
- wallet private key. If `METRIK_AGENT_CDP_CREATE_SMART_ACCOUNT=true`, the agent also
104
- provisions a per-agent ERC-4337 smart account owned by that CDP wallet for the later
105
- gas-abstraction path.
106
-
107
- ## MCP server
108
-
109
- The MCP server runs over stdio and reads its settlement config from env. It never
154
+ The server runs over stdio and reads its settlement config from the environment; it never
110
155
  asks for a raw key in a tool argument.
111
156
 
112
157
  ```bash
113
- cp .env.example .env
114
- pnpm mcp:stdio
158
+ pnpm mcp:stdio # or: pnpm mcp:http
115
159
  ```
116
160
 
117
- Env surface:
118
-
119
- - `METRIK_AGENT_RPC_URL`
120
- - `METRIK_AGENT_ESCROW`
121
- - `METRIK_AGENT_USDC`
122
- - `METRIK_AGENT_PRIVATE_KEY` (optional injected signer mode)
123
- - `CDP_API_KEY_ID`
124
- - `CDP_API_KEY_SECRET`
125
- - `CDP_WALLET_SECRET`
126
- - `METRIK_AGENT_CDP_OWNER_NAME`
127
- - `METRIK_AGENT_CDP_SMART_ACCOUNT_NAME`
128
- - `METRIK_AGENT_CDP_CREATE_SMART_ACCOUNT`
129
- - `METRIK_AGENT_CHAIN_ID` (`84532` in Phase 2)
130
- - `METRIK_AGENT_CHAIN_NAME`
131
- - `METRIK_AGENT_MCP_STATE_FILE` (optional JSON registry for `list_streams`)
132
- - `RECLAIM_APP_ID` (optional, enables zkTLS proof generation)
133
- - `RECLAIM_APP_SECRET` (optional, enables zkTLS proof generation)
134
- - `METRIK_AGENT_RECLAIM_LOGS` (optional, defaults to `false`)
135
-
136
- ## zkTLS / Reclaim (L2, consumer zkTLS)
137
-
138
- Use the programmatic proof service or the x402 facilitator when the consumed request
139
- needs private headers/cookies. Use the MCP tool only for public request inputs; it
140
- looks up stream context locally and avoids sending secrets through the model/tool layer.
141
-
142
- Every proof is verified locally against the exact URL/method/body/match/redaction
143
- policy the agent declared. This is an **L2 delivery signal** (consumer zkTLS) only: the verifier should
144
- cross-check it with L1/oracle observations before any settlement decision.
145
-
146
- ## End-to-end journey (hire -> stream -> settle)
147
-
148
- The whole loop is proven end to end against a local node in
149
- [`test/e2e.int.test.ts`](test/e2e.int.test.ts) and scripted for integrators in
150
- [`examples/hire-stream-settle.ts`](examples/hire-stream-settle.ts):
151
-
152
- 1. **Wallet** — a non-custodial injected-key viem account (credential-free; swap
153
- in a Coinbase CDP wallet via `createWalletBackedAgentClient({ cdp: ... })`).
154
- 2. **Mandate** — the owner signs an EIP-712 spend mandate (caps + operator
155
- allowlist); every buyer-side fund move is mandate-gated and fail-closed.
156
- 3. **Hire** — the x402 facilitator turns a `402` challenge into an escrowed
157
- `openStream` on the hardened `StreamEscrow`.
158
- 4. **Verify** — an M-of-N oracle quorum submits real EIP-712 `Delivered`
159
- attestations; USDC accrues only for verified seconds (`checkedAt <=
160
- block.timestamp` is enforced on-chain).
161
- 5. **Settle** — the operator claims its earned USDC net of the protocol fee, the
162
- buyer closes and reclaims the unspent balance, a terminal `SlaReceiptIssued`
163
- event is emitted, and every cent conserves exactly.
164
-
165
- The test also covers the **failure branch**: two failed checks auto-pause the
166
- stream, the buyer reclaims, and the operator can still claim only what it earned
167
- before the outage — buyer-favouring by construction.
168
-
169
- Run the example (needs Foundry `anvil`):
161
+ Programmatically:
170
162
 
171
- ```bash
172
- anvil --silent &
173
- pnpm tsx examples/hire-stream-settle.ts
163
+ ```ts
164
+ import {
165
+ METRIK_MCP_TOOLS,
166
+ startVerifiedStreamMcpServerStdio,
167
+ createVerifiedStreamMcpServerFromEnv,
168
+ } from "@absol-labs/agent";
169
+
170
+ console.log(METRIK_MCP_TOOLS.map((t) => t.name));
171
+ // discover_services, hire_verified_service, check_stream_status,
172
+ // reclaim_unspent, list_streams, prove_https_response
173
+
174
+ await startVerifiedStreamMcpServerStdio(); // reads process.env, connects stdio
175
+ // or, for custom transport wiring:
176
+ // const runtime = await createVerifiedStreamMcpServerFromEnv();
177
+ ```
178
+
179
+ Core env surface: `METRIK_AGENT_RPC_URL`, `METRIK_AGENT_ESCROW`, `METRIK_AGENT_USDC`,
180
+ `METRIK_AGENT_CHAIN_ID` (`84532`), and one wallet source — either
181
+ `METRIK_AGENT_PRIVATE_KEY` (injected signer) or the CDP set (`CDP_API_KEY_ID`,
182
+ `CDP_API_KEY_SECRET`, `CDP_WALLET_SECRET`, `METRIK_AGENT_CDP_OWNER_NAME`). Set
183
+ `RECLAIM_APP_ID` / `RECLAIM_APP_SECRET` to enable the `prove_https_response` zkTLS tool.
184
+ See [`docs/quickstart.md`](./docs/quickstart.md) for the full list.
185
+
186
+ ## Consumer zkTLS (delivery proofs)
187
+
188
+ `ReclaimConsumerProofService` (and `createReclaimConsumerProofServiceFromEnv`) generate a
189
+ Reclaim-backed proof of the exact HTTPS response the agent consumed, verified locally
190
+ against the declared URL, method, body, match, and redaction policy before it is trusted.
191
+ `VerifiedStreamX402Facilitator.proveConsumedHttpsResponse()` binds that proof to the same
192
+ buyer/mandate context that opened the stream. When credentials require private headers or
193
+ cookies, use the programmatic service or the facilitator directly rather than the MCP tool,
194
+ so secrets never pass through model-visible tool arguments. Treat the result as an L2
195
+ signal: the verifier cross-checks it with L1/oracle evidence before any settlement decision.
196
+
197
+ ## Framework adapters
198
+
199
+ Framework adapters are intentionally not re-exported from the top-level barrel — some pull
200
+ heavy optional dependency graphs — so import each from its own subpath:
201
+
202
+ ```ts
203
+ import { metrikActionProvider } from "@absol-labs/agent/agentkit";
204
+ import { metrikElizaPlugin } from "@absol-labs/agent/eliza";
205
+ import { createLangChainVerifiedStreamTools } from "@absol-labs/agent/langchain";
206
+ import { createCrewAiVerifiedStreamMcpConfig } from "@absol-labs/agent/crewai";
174
207
  ```
175
208
 
176
- > The SLA receipt carries the raw material for on-chain reputation
177
- > (`verifiedSeconds`, `accrued`, `finalStatus`, `consecutiveFailures`). Feeding it
178
- > into `@absol-labs/shared`'s `slaReceiptRecordFromEvent` + `aggregateReputation`
179
- > (protocol#38) is a one-liner once the installed `@absol-labs/shared` is bumped to
180
- > the version that exports them (the pinned `0.3.0` does not yet).
209
+ Per-framework guides: [`docs/langchain.md`](./docs/langchain.md),
210
+ [`docs/eliza.md`](./docs/eliza.md), [`docs/crewai.md`](./docs/crewai.md).
211
+
212
+ ## Requirements
213
+
214
+ - Node **`>=20 <21`**, package manager `pnpm@9.15.x`.
215
+ - **ESM only** — this package has no CommonJS build; consume it from an ESM context.
216
+ - Framework adapters need their matching optional peer dependency installed. Known caveat:
217
+ the AgentKit adapter pulls a heavy graph (`@coinbase/agentkit` / ZeroDev) that can break a
218
+ flat `npm install`; prefer `pnpm` and import the adapter only from its `@absol-labs/agent/agentkit`
219
+ subpath.
181
220
 
182
221
  ## Develop
183
222
 
@@ -189,8 +228,15 @@ pnpm test
189
228
  pnpm build
190
229
  ```
191
230
 
192
- > The x402 facilitator, zkTLS proof path, signed-mandate engine, MCP server, and
193
- > framework adapters are all real and tested in-repo. The `*.int.test.ts`
194
- > integration suites deploy the hardened `StreamEscrow` on a throwaway `anvil`
195
- > node and self-skip cleanly when `anvil` is not on `PATH`, so default CI stays
196
- > green.
231
+ The x402 facilitator, zkTLS proof path, signed-mandate engine, MCP server, and framework
232
+ adapters are all real and tested in-repo. The `*.int.test.ts` integration suites deploy the
233
+ hardened `StreamEscrow` on a throwaway `anvil` node and self-skip when `anvil` is not on
234
+ `PATH`, so default CI stays green. A full hire stream settle walkthrough lives in
235
+ [`examples/hire-stream-settle.ts`](examples/hire-stream-settle.ts).
236
+
237
+ ## Links
238
+
239
+ - Frontdoor: [github.com/Absol-Labs](https://github.com/Absol-Labs)
240
+ - Docs: [metrik.live](https://metrik.live) · App: [app.metrik.live](https://app.metrik.live)
241
+ - SDK: [`@absol-labs/sdk`](https://github.com/Absol-Labs/metrik-sdk)
242
+ - 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)
package/dist/index.d.ts CHANGED
@@ -6,5 +6,6 @@ export { METRIK_MCP_TOOLS, STREAMPROOF_MCP_TOOLS, FileStreamRegistry, InMemorySt
6
6
  export { StaticTenantResolver, createHostedMcpHttpServer, createHostedMcpTenants, parseHostedMcpServerConfig, startHostedMcpHttpServerFromEnv, type HostedMcpHttpServer, type HostedMcpHttpServerOptions, type HostedMcpServerConfig, type HostedMcpTenant, type HostedMcpTenantConfig, type TenantResolver, } from "./mcp/http.js";
7
7
  export { MandateDeniedError, VerifiedStreamAgentClient, type AgentSdkClient, type AgentSdkClientFactory, type MandateAuthorizedStreamActionInput, type OpenVerifiedStreamInput, type ReclaimAuthorizedStreamInput, type ReclaimVerifiedStreamOptions, type ReclaimVerifiedStreamResult, type StreamStatusView, type VerifiedStreamAgentOpener, } from "./sdk/client.js";
8
8
  export { AgentWalletConfigError, createWalletBackedAgentClient, parseAgentWalletEnv, resolveAgentWallet, type AgentWalletInput, type CdpClientLike, type CdpWalletConfig, type ResolvedAgentWallet, type WalletBackedAgentClient, } from "./wallet/provider.js";
9
- export { ReclaimConsumerProofService, ResponseProofUnavailableError, ResponseProofVerificationError, createReclaimConsumerProofServiceFromEnv, parseReclaimProofEnv, type ConsumerDeliveryProofService, type DeliveryProofBinding, type HttpsResponseMatch, type HttpsResponseRedaction, type ParsedReclaimProofEnv, type ProveConsumedHttpsResponseInput, type ReclaimClientLike, type ReclaimProof, type ReclaimProofServiceConfig, type VerifiedConsumedHttpsResponseProof, type VerifyProofFn, } from "./zktls/reclaim.js";
9
+ export { ReclaimConsumerProofService, ResponseProofUnavailableError, ResponseProofVerificationError, buildDeliveryContextEnvelopeV2, createReclaimConsumerProofServiceFromEnv, deliveryContextEnvelopeV2Schema, parseReclaimProofEnv, type ConsumerDeliveryProofService, type DeliveryContextEnvelopeV2, type DeliveryContextEnvelopeV2Input, type DeliveryProofBinding, type HttpsResponseMatch, type HttpsResponseRedaction, type ParsedReclaimProofEnv, type ProveConsumedHttpsResponseInput, type ReclaimClientLike, type ReclaimProof, type ReclaimProofServiceConfig, type VerifiedConsumedHttpsResponseProof, type VerifyProofFn, } from "./zktls/reclaim.js";
10
+ export { NoDeliveryAttestorConfiguredError, PaidRouteNonceInjectionError, ReclaimDeliveryProofAttestor, buildT2DeliveryProofSubmission, createReclaimT2AttestorFromEnv, deliveryProofRequestBodySchema, toWireDeliveryReceipt, type BuildT2DeliveryProofInput, type BuildT2DeliveryProofResult, type DeliveryProofAttestor, type DeliveryProofRequestBody, type PaidRouteRequestSpec, type ProveDeliveryResponseInput, type T2NonceInjection, type WireDeliveryReceipt, } from "./zktls/t2-delivery-proof.js";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,0BAA0B,GAChC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,GAC9B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,gBAAgB,EAChB,gCAAgC,EAChC,6BAA6B,EAC7B,WAAW,EACX,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,gCAAgC,EAChC,yBAAyB,EACzB,qBAAqB,EACrB,KAAK,mCAAmC,EACxC,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,GAChC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,gBAAgB,EA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B,EAC9B,KAAK,kCAAkC,EACvC,KAAK,aAAa,GACnB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,wBAAwB,EACxB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,0BAA0B,GAChC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,GAC9B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,gBAAgB,EAChB,gCAAgC,EAChC,6BAA6B,EAC7B,WAAW,EACX,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,gCAAgC,EAChC,yBAAyB,EACzB,qBAAqB,EACrB,KAAK,mCAAmC,EACxC,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,GAChC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,6BAA6B,EAC7B,oCAAoC,EACpC,2CAA2C,EAC3C,mBAAmB,EACnB,iCAAiC,EACjC,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,K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AC5B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,qBAAqB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,8BAA8B,CAAC"}
package/dist/index.js CHANGED
@@ -6,7 +6,8 @@ export { METRIK_MCP_TOOLS, STREAMPROOF_MCP_TOOLS, FileStreamRegistry, InMemorySt
6
6
  export { StaticTenantResolver, createHostedMcpHttpServer, createHostedMcpTenants, parseHostedMcpServerConfig, startHostedMcpHttpServerFromEnv, } from "./mcp/http.js";
7
7
  export { MandateDeniedError, VerifiedStreamAgentClient, } from "./sdk/client.js";
8
8
  export { AgentWalletConfigError, createWalletBackedAgentClient, parseAgentWalletEnv, resolveAgentWallet, } from "./wallet/provider.js";
9
- export { ReclaimConsumerProofService, ResponseProofUnavailableError, ResponseProofVerificationError, createReclaimConsumerProofServiceFromEnv, parseReclaimProofEnv, } from "./zktls/reclaim.js";
9
+ export { ReclaimConsumerProofService, ResponseProofUnavailableError, ResponseProofVerificationError, buildDeliveryContextEnvelopeV2, createReclaimConsumerProofServiceFromEnv, deliveryContextEnvelopeV2Schema, parseReclaimProofEnv, } from "./zktls/reclaim.js";
10
+ export { NoDeliveryAttestorConfiguredError, PaidRouteNonceInjectionError, ReclaimDeliveryProofAttestor, buildT2DeliveryProofSubmission, createReclaimT2AttestorFromEnv, deliveryProofRequestBodySchema, toWireDeliveryReceipt, } from "./zktls/t2-delivery-proof.js";
10
11
  // Framework adapters are NOT re-exported from this top-level barrel on purpose.
11
12
  // Some of them (notably the Coinbase AgentKit adapter) pull heavy optional
12
13
  // dependency graphs, so importing "@absol-labs/agent" must stay light and load
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"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B,EAC9B,wCAAwC,EACxC,+BAA+B,EAC/B,oBAAoB,GAcrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,iCAAiC,EACjC,4BAA4B,EAC5B,4BAA4B,EAC5B,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,qBAAqB,GAStB,MAAM,8BAA8B,CAAC;AAEtC,gFAAgF;AAChF,2EAA2E;AAC3E,+EAA+E;AAC/E,0EAA0E;AAC1E,2EAA2E;AAC3E,EAAE;AACF,uEAAuE;AACvE,iEAAiE;AACjE,sFAAsF;AACtF,oFAAoF"}
@@ -1,4 +1,4 @@
1
- import { verifyProof, type Proof as ReclaimProtocolProof, type VerifyProofResult } from "@reclaimprotocol/js-sdk";
1
+ import { verifyProof, type Proof as ReclaimProtocolProof, type RequestSpec, type VerifyProofResult } from "@reclaimprotocol/js-sdk";
2
2
  import { z } from "zod";
3
3
  declare const responseMatchSchema: z.ZodObject<{
4
4
  type: z.ZodEnum<["regex", "contains"]>;
@@ -97,10 +97,19 @@ export interface ReclaimClientLike {
97
97
  body?: string;
98
98
  headers?: Record<string, string>;
99
99
  geoLocation?: string;
100
- context?: {
101
- contextAddress: string;
102
- contextMessage: string;
103
- };
100
+ /**
101
+ * Whatever is passed here is canonicalized and stored VERBATIM as the
102
+ * proof's `claimData.context` (see `@reclaimprotocol/attestor-core`'s
103
+ * `_createClaimOnAttestor`, which does `context: canonicalStringify(context)`
104
+ * with no further transformation). The upstream zk-fetch SDK types this
105
+ * narrower (`{contextAddress, contextMessage}`, the L2 v1 convention used
106
+ * by `buildRequestContext` below) but nothing downstream requires that
107
+ * wrapper shape - it is opaque JSON. The T2 delivery-proof path
108
+ * (`t2-delivery-proof.ts`) passes the FLAT `DeliveryContextEnvelopeV2`
109
+ * object directly so the oracle's `deliveryContextEnvelopeSchema` can
110
+ * parse `claimData.context` without an extra unwrap step.
111
+ */
112
+ context?: Record<string, unknown>;
104
113
  useTee?: boolean;
105
114
  zkEngine?: "snarkjs" | "stwo";
106
115
  }, secretOptions?: {
@@ -133,5 +142,75 @@ export declare class ReclaimConsumerProofService implements ConsumerDeliveryProo
133
142
  }
134
143
  export declare function parseReclaimProofEnv(env?: NodeJS.ProcessEnv): ParsedReclaimProofEnv | null;
135
144
  export declare function createReclaimConsumerProofServiceFromEnv(env?: NodeJS.ProcessEnv): ReclaimConsumerProofService | null;
145
+ export declare function defaultReclaimClientFactory(applicationId: string, applicationSecret: string, logs: boolean): ReclaimClientLike;
146
+ /**
147
+ * The T2 (issue #24 / #85) `metrik-l2-http-response/v2` Metrik delivery-binding
148
+ * envelope, folded VERBATIM (not wrapped in `{contextAddress, contextMessage}`)
149
+ * into a Reclaim proof's `claimData.context`. This mirrors the ORACLE's OWN
150
+ * `deliveryContextEnvelopeSchema` (`streamproof-oracle/src/delivery/context-envelope.ts`)
151
+ * field-for-field and MUST stay byte-compatible with it - the oracle re-parses
152
+ * `claimData.context` through its own copy of this schema and fails closed on
153
+ * any mismatch.
154
+ *
155
+ * Unlike the v1 `buildRequestContext` binding above (used by the x402/MCP
156
+ * consumer-proof-as-signal path, agent#12), every identity field here is
157
+ * REQUIRED: a T2 accrual receipt cannot bind to a partially-specified stream.
158
+ */
159
+ export declare const deliveryContextEnvelopeV2Schema: z.ZodObject<{
160
+ kind: z.ZodLiteral<"metrik-l2-http-response/v2">;
161
+ streamId: z.ZodString;
162
+ operator: z.ZodString;
163
+ serviceRef: z.ZodString;
164
+ mandateId: z.ZodOptional<z.ZodString>;
165
+ nonce: z.ZodString;
166
+ intervalIndex: z.ZodNumber;
167
+ issuedAt: z.ZodNumber;
168
+ }, "strict", z.ZodTypeAny, {
169
+ issuedAt: number;
170
+ streamId: string;
171
+ operator: string;
172
+ serviceRef: string;
173
+ kind: "metrik-l2-http-response/v2";
174
+ nonce: string;
175
+ intervalIndex: number;
176
+ mandateId?: string | undefined;
177
+ }, {
178
+ issuedAt: number;
179
+ streamId: string;
180
+ operator: string;
181
+ serviceRef: string;
182
+ kind: "metrik-l2-http-response/v2";
183
+ nonce: string;
184
+ intervalIndex: number;
185
+ mandateId?: string | undefined;
186
+ }>;
187
+ export type DeliveryContextEnvelopeV2 = z.infer<typeof deliveryContextEnvelopeV2Schema>;
188
+ export interface DeliveryContextEnvelopeV2Input {
189
+ readonly streamId: `0x${string}`;
190
+ readonly operator: `0x${string}`;
191
+ readonly serviceRef: `0x${string}`;
192
+ readonly mandateId?: string;
193
+ readonly nonce: `0x${string}`;
194
+ readonly intervalIndex: number;
195
+ /** Unix seconds. Defaults to `Math.floor(Date.now() / 1000)`. */
196
+ readonly issuedAt?: number;
197
+ }
198
+ /**
199
+ * Build the flat T2 envelope object to pass as `zkFetch`'s `context` option
200
+ * (see the widened `ReclaimClientLike.zkFetch` doc above - it is stored
201
+ * verbatim, no `{contextAddress, contextMessage}` wrapper). Validated against
202
+ * `deliveryContextEnvelopeV2Schema` before return so a malformed binding fails
203
+ * loudly here rather than silently producing an envelope the oracle rejects.
204
+ */
205
+ export declare function buildDeliveryContextEnvelopeV2(input: DeliveryContextEnvelopeV2Input): DeliveryContextEnvelopeV2;
206
+ /** Structural input `toRequestSpec` needs - satisfied by both the v1 and T2 request shapes. */
207
+ export interface RequestSpecInput {
208
+ readonly url: string;
209
+ readonly body?: string | undefined;
210
+ readonly responseMatches: readonly HttpsResponseMatch[];
211
+ readonly responseRedactions?: readonly HttpsResponseRedaction[] | undefined;
212
+ }
213
+ export declare function toRequestSpec(input: RequestSpecInput, method: "GET" | "POST" | "PUT"): RequestSpec;
214
+ export declare function asErrorMessage(error: unknown): string;
136
215
  export {};
137
216
  //# sourceMappingURL=reclaim.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reclaim.d.ts","sourceRoot":"","sources":["../../src/zktls/reclaim.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,KAAK,KAAK,IAAI,oBAAoB,EAElC,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,CAAC,E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