@absol-labs/agent 0.8.0 → 0.9.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.
- package/dist/discovery/registry.d.ts +110 -305
- package/dist/discovery/registry.d.ts.map +1 -1
- package/dist/discovery/registry.js +141 -318
- package/dist/discovery/registry.js.map +1 -1
- package/dist/frameworks/agentkit.d.ts.map +1 -1
- package/dist/frameworks/agentkit.js +31 -10
- package/dist/frameworks/agentkit.js.map +1 -1
- package/dist/frameworks/eliza.d.ts.map +1 -1
- package/dist/frameworks/eliza.js +14 -3
- package/dist/frameworks/eliza.js.map +1 -1
- package/dist/frameworks/langchain.d.ts.map +1 -1
- package/dist/frameworks/langchain.js +14 -3
- package/dist/frameworks/langchain.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +26 -5
- package/dist/mcp/server.js.map +1 -1
- package/dist/sdk/client.d.ts +19 -2
- package/dist/sdk/client.d.ts.map +1 -1
- package/dist/sdk/client.js +18 -2
- package/dist/sdk/client.js.map +1 -1
- package/dist/wallet/cdp-sdk.d.ts +23 -0
- package/dist/wallet/cdp-sdk.d.ts.map +1 -0
- package/dist/wallet/cdp-sdk.js +27 -0
- package/dist/wallet/cdp-sdk.js.map +1 -0
- package/dist/wallet/provider.d.ts +1 -1
- package/dist/wallet/provider.d.ts.map +1 -1
- package/dist/wallet/provider.js +8 -3
- package/dist/wallet/provider.js.map +1 -1
- package/dist/zktls/reclaim-js-sdk.d.ts +24 -0
- package/dist/zktls/reclaim-js-sdk.d.ts.map +1 -0
- package/dist/zktls/reclaim-js-sdk.js +29 -0
- package/dist/zktls/reclaim-js-sdk.js.map +1 -0
- package/dist/zktls/reclaim.d.ts +14 -2
- package/dist/zktls/reclaim.d.ts.map +1 -1
- package/dist/zktls/reclaim.js +29 -6
- package/dist/zktls/reclaim.js.map +1 -1
- package/dist/zktls/t2-delivery-proof.d.ts +8 -1
- package/dist/zktls/t2-delivery-proof.d.ts.map +1 -1
- package/dist/zktls/t2-delivery-proof.js +22 -6
- package/dist/zktls/t2-delivery-proof.js.map +1 -1
- package/docs/agent-layer.md +150 -0
- package/docs/autonomous-privy-wallet.md +133 -0
- package/docs/crewai.md +70 -0
- package/docs/eliza.md +109 -0
- package/docs/langchain.md +63 -0
- package/docs/mcp-hosted.md +137 -0
- package/docs/privy-embedded-wallet.md +102 -0
- package/docs/quickstart.md +370 -0
- package/docs/threat-model.md +160 -0
- package/package.json +19 -6
- package/src/discovery/registry.ts +242 -414
- package/src/frameworks/agentkit.ts +32 -8
- package/src/frameworks/eliza.ts +14 -3
- package/src/frameworks/langchain.ts +14 -3
- package/src/index.ts +7 -0
- package/src/mcp/server.ts +26 -5
- package/src/sdk/client.ts +38 -3
- package/src/wallet/cdp-sdk.ts +33 -0
- package/src/wallet/provider.ts +16 -9
- package/src/zktls/reclaim-js-sdk.ts +50 -0
- package/src/zktls/reclaim.ts +57 -23
- package/src/zktls/t2-delivery-proof.ts +28 -10
|
@@ -1,354 +1,177 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isHex } from "viem";
|
|
3
|
-
import { z } from "zod";
|
|
1
|
+
import { RegistryUnavailableError, discoverServices as sdkDiscoverServices, } from "@absol-labs/sdk";
|
|
4
2
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* The oracle's public, credential-free, CORS-enabled discovery endpoint. Serves
|
|
4
|
+
* operator-signed envelopes verbatim so they can be verified client-side, and
|
|
5
|
+
* answers an unreachable upstream with `503` and NO `listings` key — precisely so
|
|
6
|
+
* it cannot be misread as "zero services".
|
|
7
7
|
*/
|
|
8
|
-
export const
|
|
9
|
-
const DEFAULT_TIMEOUT_MS = 5_000;
|
|
8
|
+
export const DEFAULT_METRIK_PUBLIC_REGISTRY_URL = "https://oracle.metrik.live/listings";
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* @deprecated Renamed to {@link DEFAULT_METRIK_PUBLIC_REGISTRY_URL}. The value
|
|
11
|
+
* changed in 0.9.0: it used to be a raw Supabase PostgREST URL that `401`s
|
|
12
|
+
* without Metrik's anon key.
|
|
13
13
|
*/
|
|
14
|
-
export const
|
|
15
|
-
/** @deprecated Use {@link LIVE_DATA_SEED_SERVICE_REF}. */
|
|
16
|
-
export const DEMO_SEED_SERVICE_REF = LIVE_DATA_SEED_SERVICE_REF;
|
|
14
|
+
export const DEFAULT_METRIK_REGISTRY_URL = DEFAULT_METRIK_PUBLIC_REGISTRY_URL;
|
|
17
15
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* ServiceBinding — safe to ship in source. It is **NOT** a trust bypass: when seeded
|
|
23
|
-
* it is fed through the exact same fail-closed {@link verifyRow} path as any registry
|
|
24
|
-
* row, so it only ever surfaces if BOTH its EIP-712 signature recovers to
|
|
25
|
-
* `binding.operator` AND `deriveServiceRef(binding)` equals its `serviceRef`. Tamper
|
|
26
|
-
* with any field here and the seed silently drops itself, identically to a bad
|
|
27
|
-
* registry row. The `category` column is unsigned informational metadata only.
|
|
16
|
+
* @deprecated Removed in 0.9.0. The embedded seed listing is gone: it was
|
|
17
|
+
* unrevocable without a release, and masking an unreachable registry with stale
|
|
18
|
+
* local data is exactly the bug this package now refuses to ship. Kept as an
|
|
19
|
+
* empty object so existing imports still compile.
|
|
28
20
|
*/
|
|
29
|
-
export const LIVE_DATA_SEED_LISTING = {
|
|
30
|
-
|
|
31
|
-
operator: "0xB3e162711920dFD8933609019Dc35C73cC1a09F0",
|
|
32
|
-
public_url: "https://livedata.137.23.50.249.sslip.io",
|
|
33
|
-
category: "live-data",
|
|
34
|
-
signed_binding: {
|
|
35
|
-
serviceRef: LIVE_DATA_SEED_SERVICE_REF,
|
|
36
|
-
descriptor: {
|
|
37
|
-
version: 3,
|
|
38
|
-
operator: "0xB3e162711920dFD8933609019Dc35C73cC1a09F0",
|
|
39
|
-
publicUrl: "https://livedata.137.23.50.249.sslip.io",
|
|
40
|
-
issuedAt: 1_787_772_057,
|
|
41
|
-
interface: {
|
|
42
|
-
baseUrl: "https://livedata.137.23.50.249.sslip.io",
|
|
43
|
-
healthPath: "/health",
|
|
44
|
-
endpoints: [
|
|
45
|
-
{
|
|
46
|
-
name: "health",
|
|
47
|
-
path: "/health",
|
|
48
|
-
method: "GET",
|
|
49
|
-
description: "Liveness probe.",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "readiness",
|
|
53
|
-
path: "/readiness",
|
|
54
|
-
method: "GET",
|
|
55
|
-
description: "Non-value dependency readiness backed by the same real BTC cache policy.",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: "price",
|
|
59
|
-
path: "/price",
|
|
60
|
-
method: "GET",
|
|
61
|
-
description: "Real live crypto spot price (?symbol=BTC|ETH|SOL) from CoinGecko's public API.",
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
authModel: "caller-auth",
|
|
65
|
-
example: {
|
|
66
|
-
endpoint: "price",
|
|
67
|
-
request: { symbol: "BTC" },
|
|
68
|
-
response: { symbol: "BTC", source: "coingecko-public-api" },
|
|
69
|
-
description: "Real, nondeterministic live price — no re-execution guarantee.",
|
|
70
|
-
},
|
|
71
|
-
expectedStatuses: [200],
|
|
72
|
-
},
|
|
73
|
-
verification: {
|
|
74
|
-
canaries: [
|
|
75
|
-
{
|
|
76
|
-
path: "/readiness",
|
|
77
|
-
method: "GET",
|
|
78
|
-
matcher: {
|
|
79
|
-
type: "json-field-equals",
|
|
80
|
-
field: "source",
|
|
81
|
-
expected: "coingecko-public-api",
|
|
82
|
-
},
|
|
83
|
-
nonce: {
|
|
84
|
-
inject: { in: "query", name: "nonce" },
|
|
85
|
-
echo: { from: "json-path", path: "nonce" },
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
path: "/canary",
|
|
90
|
-
method: "GET",
|
|
91
|
-
matcher: {
|
|
92
|
-
type: "includes",
|
|
93
|
-
expected: "metrik-canary:live-data:",
|
|
94
|
-
},
|
|
95
|
-
nonce: {
|
|
96
|
-
inject: { in: "query", name: "nonce" },
|
|
97
|
-
echo: { from: "json-path", path: "nonce" },
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
schema: {
|
|
102
|
-
path: "/readiness?nonce=metrik-schema",
|
|
103
|
-
required: [
|
|
104
|
-
{ pointer: "ready", type: "boolean" },
|
|
105
|
-
{ pointer: "source", type: "string", nonEmpty: true },
|
|
106
|
-
{ pointer: "fetchedAt", type: "string", nonEmpty: true },
|
|
107
|
-
{ pointer: "priceAgeMs", type: "number" },
|
|
108
|
-
{ pointer: "freshness", type: "string", nonEmpty: true },
|
|
109
|
-
],
|
|
110
|
-
},
|
|
111
|
-
sla: { maxLatencyMs: 5000, freshnessSeconds: 60 },
|
|
112
|
-
},
|
|
113
|
-
commercial: {
|
|
114
|
-
minRatePerSecond: "100",
|
|
115
|
-
maxRatePerSecond: "10000",
|
|
116
|
-
currency: "USDC",
|
|
117
|
-
slaDescription: "Failed or unproven intervals do not advance verified cumulative entitlement; the stream remains active until buyer close or expiry.",
|
|
118
|
-
refundPolicy: "The buyer reclaims unspent escrow using the latest checkpoint after close/expiry, or the unverified escape path after its grace window.",
|
|
119
|
-
},
|
|
120
|
-
access: "gated",
|
|
121
|
-
callerAuth: {
|
|
122
|
-
mechanism: "on-chain",
|
|
123
|
-
role: "buyer",
|
|
124
|
-
accessUrl: "https://gateway.137.23.50.249.sslip.io",
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
signature: "0x2f4d2784eb40b1542517bc19f12534fb2e97da4ade5a3ff56193fcfb97fbef921309f77af3445e336cb07a4379011b080bba700033a098f672b0b2f096197f161b",
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
/** @deprecated Use {@link LIVE_DATA_SEED_LISTING}. */
|
|
21
|
+
export const LIVE_DATA_SEED_LISTING = Object.freeze({});
|
|
22
|
+
/** @deprecated Removed in 0.9.0. See {@link LIVE_DATA_SEED_LISTING}. */
|
|
131
23
|
export const DEMO_SEED_LISTING = LIVE_DATA_SEED_LISTING;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
*
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
})
|
|
165
|
-
.passthrough();
|
|
24
|
+
/** @deprecated Removed in 0.9.0. There is no seeded listing to identify. */
|
|
25
|
+
export const LIVE_DATA_SEED_SERVICE_REF = null;
|
|
26
|
+
/** @deprecated Removed in 0.9.0. See {@link LIVE_DATA_SEED_SERVICE_REF}. */
|
|
27
|
+
export const DEMO_SEED_SERVICE_REF = null;
|
|
28
|
+
const DEFAULT_TIMEOUT_MS = 5_000;
|
|
29
|
+
export { RegistryUnavailableError };
|
|
30
|
+
/**
|
|
31
|
+
* Discover verified services and return the SDK's full {@link DiscoverResult}
|
|
32
|
+
* (typed listings plus `registryAvailable`, `source`, `matched`, `filteredOut`
|
|
33
|
+
* and an explanatory `note` when a non-empty source was filtered to nothing).
|
|
34
|
+
*
|
|
35
|
+
* Throws {@link RegistryUnavailableError} when the configured read source cannot
|
|
36
|
+
* be read at all.
|
|
37
|
+
*/
|
|
38
|
+
export async function discoverServicesDetailed(opts = {}) {
|
|
39
|
+
const logger = opts.logger ?? console;
|
|
40
|
+
const { config, rowCounter } = buildRegistryConfig(opts, logger);
|
|
41
|
+
const result = await sdkDiscoverServices(config, {
|
|
42
|
+
...(opts.category === undefined ? {} : { category: opts.category }),
|
|
43
|
+
});
|
|
44
|
+
// The SDK drops any row that fails schema / serviceRef / signature
|
|
45
|
+
// verification. Surface that as a warning: a silently shrinking result set is
|
|
46
|
+
// how a tampering registry stays invisible.
|
|
47
|
+
const dropped = rowCounter.rows - result.services.length - result.filteredOut;
|
|
48
|
+
if (dropped > 0) {
|
|
49
|
+
logger.warn(`metrik discovery: ${dropped} of ${rowCounter.rows} registry row(s) dropped by fail-closed verification (bad schema, serviceRef mismatch, or signature that does not recover to the operator)`);
|
|
50
|
+
}
|
|
51
|
+
if (result.note !== undefined) {
|
|
52
|
+
logger.warn(`metrik discovery: ${result.note}`);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
166
56
|
/**
|
|
167
57
|
* Discover verified services from the Metrik listings registry.
|
|
168
58
|
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
59
|
+
* Zero configuration: reads {@link DEFAULT_METRIK_PUBLIC_REGISTRY_URL}, the
|
|
60
|
+
* oracle's credential-free public endpoint.
|
|
61
|
+
*
|
|
62
|
+
* Fail-closed: every row is schema-validated, its `serviceRef` re-derived and
|
|
63
|
+
* its operator signature recovered; anything that fails is dropped and logged,
|
|
64
|
+
* so an unverifiable listing is never returned.
|
|
65
|
+
*
|
|
66
|
+
* LOUD, not silent: an unreachable / erroring / non-200 registry throws
|
|
67
|
+
* {@link RegistryUnavailableError} rather than returning `[]` or embedded seed
|
|
68
|
+
* data. Catch it if your caller can genuinely handle "the marketplace was never
|
|
69
|
+
* reached" — but do not confuse it with an empty marketplace.
|
|
173
70
|
*/
|
|
174
71
|
export async function discoverServices(opts = {}) {
|
|
175
72
|
const logger = opts.logger ?? console;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
DEFAULT_METRIK_REGISTRY_URL;
|
|
179
|
-
const apiKey = opts.apiKey ?? process.env.METRIK_AGENT_REGISTRY_APIKEY;
|
|
180
|
-
const fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
181
|
-
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
182
|
-
const includeDemoSeed = opts.includeDemoSeed ?? true;
|
|
183
|
-
// `registryUnavailable` = the registry could not be queried at all (no fetch /
|
|
184
|
-
// network error / non-200). It never throws into the hire flow; instead it
|
|
185
|
-
// degrades to the built-in verified live-data seed (when enabled) so a cold user
|
|
186
|
-
// still discovers a hireable service.
|
|
187
|
-
let rows = [];
|
|
188
|
-
let registryUnavailable = false;
|
|
189
|
-
if (typeof fetchImpl !== "function") {
|
|
190
|
-
logger.warn("metrik discovery: no fetch implementation available; falling back to live-data seed only");
|
|
191
|
-
registryUnavailable = true;
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
try {
|
|
195
|
-
rows = await fetchListingRows(fetchImpl, registryUrl, apiKey, timeoutMs);
|
|
196
|
-
}
|
|
197
|
-
catch (error) {
|
|
198
|
-
// Fail-safe / buyer-favouring: a down, unreachable, or 401 registry (the
|
|
199
|
-
// Supabase default rejects credential-free reads) must never throw into the
|
|
200
|
-
// agent's hire flow — it degrades to the live-data seed.
|
|
201
|
-
logger.warn(`metrik discovery: listings registry unavailable (${errorMessage(error)}); falling back to live-data seed only`);
|
|
202
|
-
registryUnavailable = true;
|
|
203
|
-
}
|
|
73
|
+
if (opts.includeDemoSeed !== undefined) {
|
|
74
|
+
logger.warn("metrik discovery: `includeDemoSeed` is a deprecated no-op — the embedded seed listing was removed in 0.9.0; an unreachable registry now throws RegistryUnavailableError");
|
|
204
75
|
}
|
|
76
|
+
const result = await discoverServicesDetailed(opts);
|
|
205
77
|
const listings = [];
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const listing = await verifyRow(row, index, logger);
|
|
78
|
+
for (const service of result.services) {
|
|
79
|
+
const listing = toServiceListing(service, logger);
|
|
209
80
|
if (listing === null) {
|
|
210
81
|
continue;
|
|
211
82
|
}
|
|
212
|
-
if (eqHex(listing.serviceRef, DEMO_SEED_SERVICE_REF)) {
|
|
213
|
-
seedAlreadyPresent = true;
|
|
214
|
-
}
|
|
215
|
-
if (opts.category !== undefined && listing.category !== opts.category) {
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
83
|
listings.push(listing);
|
|
219
84
|
if (opts.limit !== undefined && listings.length >= opts.limit) {
|
|
220
|
-
|
|
221
|
-
return listings;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
// Append the built-in verified live-data listing when the registry did not already
|
|
225
|
-
// surface it. Runs through the SAME fail-closed verifyRow path, so it is
|
|
226
|
-
// verified exactly like a registry row and can never be a trust bypass.
|
|
227
|
-
if (includeDemoSeed && !seedAlreadyPresent) {
|
|
228
|
-
const seed = await verifyRow(DEMO_SEED_LISTING, "live-data-seed", logger);
|
|
229
|
-
if (seed === null) {
|
|
230
|
-
// Defensive: only reachable if the embedded constant were corrupted.
|
|
231
|
-
logger.warn("metrik discovery: built-in live-data seed failed fail-closed verification; not seeding");
|
|
232
|
-
}
|
|
233
|
-
else if (opts.category === undefined || seed.category === opts.category) {
|
|
234
|
-
logger.warn(registryUnavailable
|
|
235
|
-
? "metrik discovery: registry unavailable — serving the built-in verified live-data listing"
|
|
236
|
-
: "metrik discovery: registry did not include live data — appending the built-in verified listing");
|
|
237
|
-
listings.push(seed);
|
|
85
|
+
break;
|
|
238
86
|
}
|
|
239
87
|
}
|
|
240
88
|
return listings;
|
|
241
89
|
}
|
|
242
|
-
async function fetchListingRows(fetchImpl, url, apiKey, timeoutMs) {
|
|
243
|
-
const controller = new AbortController();
|
|
244
|
-
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
245
|
-
try {
|
|
246
|
-
const headers = {};
|
|
247
|
-
if (apiKey !== undefined && apiKey.length > 0) {
|
|
248
|
-
headers.apikey = apiKey;
|
|
249
|
-
headers.Authorization = `Bearer ${apiKey}`;
|
|
250
|
-
}
|
|
251
|
-
const response = await fetchImpl(url, {
|
|
252
|
-
signal: controller.signal,
|
|
253
|
-
...(Object.keys(headers).length === 0 ? {} : { headers }),
|
|
254
|
-
});
|
|
255
|
-
if (!response.ok) {
|
|
256
|
-
throw new Error(`listings registry responded with status ${response.status}`);
|
|
257
|
-
}
|
|
258
|
-
const body = await response.json();
|
|
259
|
-
if (!Array.isArray(body)) {
|
|
260
|
-
throw new Error("listings registry response was not a JSON array");
|
|
261
|
-
}
|
|
262
|
-
return body;
|
|
263
|
-
}
|
|
264
|
-
finally {
|
|
265
|
-
clearTimeout(timeout);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
90
|
/**
|
|
269
|
-
*
|
|
270
|
-
*
|
|
91
|
+
* Project one verified {@link DiscoveredService} onto a {@link ServiceListing},
|
|
92
|
+
* or `null` when it carries no signed invocation origin (a legacy record that a
|
|
93
|
+
* caller could otherwise invoke against an unsigned URL).
|
|
271
94
|
*/
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
logger.warn(`metrik discovery: row ${index} dropped — invalid listing envelope (${parsed.error.issues[0]?.message ?? "schema error"})`);
|
|
276
|
-
return null;
|
|
277
|
-
}
|
|
278
|
-
const { signed_binding: record, category } = parsed.data;
|
|
279
|
-
const signedIdentity = "descriptor" in record
|
|
280
|
-
? {
|
|
281
|
-
operator: record.descriptor.operator,
|
|
282
|
-
publicUrl: record.descriptor.publicUrl,
|
|
283
|
-
}
|
|
284
|
-
: {
|
|
285
|
-
operator: record.binding.operator,
|
|
286
|
-
publicUrl: record.binding.publicUrl,
|
|
287
|
-
};
|
|
288
|
-
if ((parsed.data.service_ref !== undefined &&
|
|
289
|
-
!eqHex(parsed.data.service_ref, record.serviceRef)) ||
|
|
290
|
-
(parsed.data.operator !== undefined &&
|
|
291
|
-
!eqHex(parsed.data.operator, signedIdentity.operator)) ||
|
|
292
|
-
(parsed.data.public_url !== undefined &&
|
|
293
|
-
parsed.data.public_url !== signedIdentity.publicUrl)) {
|
|
294
|
-
logger.warn(`metrik discovery: row ${index} dropped — flat identity columns disagree with signed record`);
|
|
295
|
-
return null;
|
|
296
|
-
}
|
|
297
|
-
let signer;
|
|
298
|
-
try {
|
|
299
|
-
signer = ("descriptor" in record
|
|
300
|
-
? await recoverServiceDescriptorSigner(record.descriptor, record.signature)
|
|
301
|
-
: await recoverServiceBindingSigner(record.binding, record.signature));
|
|
302
|
-
}
|
|
303
|
-
catch (error) {
|
|
304
|
-
logger.warn(`metrik discovery: row ${index} dropped — signature recovery threw (${errorMessage(error)})`);
|
|
305
|
-
return null;
|
|
306
|
-
}
|
|
307
|
-
if (signer === null || !eqHex(signer, signedIdentity.operator)) {
|
|
308
|
-
logger.warn(`metrik discovery: row ${index} dropped — signature does not recover to operator (recovered ${signer ?? "null"})`);
|
|
309
|
-
return null;
|
|
310
|
-
}
|
|
311
|
-
const derivedRef = deriveServiceRef("descriptor" in record ? record.descriptor : record.binding);
|
|
312
|
-
if (!eqHex(derivedRef, record.serviceRef)) {
|
|
313
|
-
logger.warn(`metrik discovery: row ${index} dropped — serviceRef ${record.serviceRef} does not match derived ${derivedRef}`);
|
|
314
|
-
return null;
|
|
315
|
-
}
|
|
316
|
-
const access = "descriptor" in record ? (record.descriptor.access ?? "public") : "public";
|
|
317
|
-
const accessUrl = "descriptor" in record
|
|
318
|
-
? access === "gated"
|
|
319
|
-
? record.descriptor.callerAuth?.accessUrl
|
|
320
|
-
: (record.descriptor.interface?.baseUrl ?? record.descriptor.publicUrl)
|
|
321
|
-
: record.binding.publicUrl;
|
|
322
|
-
if (accessUrl === undefined ||
|
|
323
|
-
(access === "gated" && !isHttpsUrl(accessUrl))) {
|
|
324
|
-
logger.warn(`metrik discovery: row ${index} dropped — gated descriptor has no signed HTTPS callerAuth.accessUrl`);
|
|
95
|
+
function toServiceListing(service, logger) {
|
|
96
|
+
if (service.accessUrl === null) {
|
|
97
|
+
logger.warn(`metrik discovery: listing ${service.serviceRef} dropped — no signed invocation URL`);
|
|
325
98
|
return null;
|
|
326
99
|
}
|
|
327
100
|
return {
|
|
328
|
-
serviceRef:
|
|
329
|
-
operator:
|
|
330
|
-
publicUrl:
|
|
331
|
-
access,
|
|
332
|
-
accessUrl,
|
|
333
|
-
signed:
|
|
334
|
-
category: category
|
|
335
|
-
...(record.targetMetadata === undefined
|
|
336
|
-
? {}
|
|
337
|
-
: { targetMetadata: record.targetMetadata }),
|
|
101
|
+
serviceRef: service.serviceRef,
|
|
102
|
+
operator: service.operator,
|
|
103
|
+
publicUrl: service.publicUrl,
|
|
104
|
+
access: service.access,
|
|
105
|
+
accessUrl: service.accessUrl,
|
|
106
|
+
signed: service.signed,
|
|
107
|
+
category: service.category,
|
|
338
108
|
};
|
|
339
109
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Translate the agent-layer options into an SDK {@link RegistryConfig}.
|
|
112
|
+
*
|
|
113
|
+
* With an api key the read is authenticated PostgREST (the SDK appends its own
|
|
114
|
+
* `select`/`order`, so a query string on the supplied URL is stripped);
|
|
115
|
+
* otherwise it is the credential-free public `GET`.
|
|
116
|
+
*/
|
|
117
|
+
function buildRegistryConfig(opts, logger) {
|
|
118
|
+
const configuredUrl = opts.registryUrl ?? process.env.METRIK_AGENT_REGISTRY_URL;
|
|
119
|
+
const registryUrl = configuredUrl ?? DEFAULT_METRIK_PUBLIC_REGISTRY_URL;
|
|
120
|
+
const apiKey = opts.apiKey ?? process.env.METRIK_AGENT_REGISTRY_APIKEY;
|
|
121
|
+
// An apiKey switches the read to PostgREST, where the SDK appends
|
|
122
|
+
// `/rest/v1/<table>` to the configured base. The public default is NOT a
|
|
123
|
+
// PostgREST base, so appending to it yields `.../listings/rest/v1/listings`
|
|
124
|
+
// and 404s on every read. Fail loudly at the call site instead of shipping a
|
|
125
|
+
// discovery path that can never succeed.
|
|
126
|
+
if (apiKey !== undefined &&
|
|
127
|
+
apiKey.length > 0 &&
|
|
128
|
+
(configuredUrl === undefined || configuredUrl.length === 0)) {
|
|
129
|
+
throw new Error("metrik discovery: an apiKey was supplied without a registryUrl. An authenticated read needs a Supabase project URL (https://<ref>.supabase.co) or a URL ending in /rest/v1[/listings] — set `registryUrl` or METRIK_AGENT_REGISTRY_URL. Omit the apiKey to use the credential-free public endpoint instead.");
|
|
346
130
|
}
|
|
131
|
+
const rowCounter = { rows: 0 };
|
|
132
|
+
const fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
133
|
+
const config = {
|
|
134
|
+
...(apiKey !== undefined && apiKey.length > 0
|
|
135
|
+
? { url: stripQuery(registryUrl), key: apiKey }
|
|
136
|
+
: { publicUrl: registryUrl }),
|
|
137
|
+
...(typeof fetchImpl === "function"
|
|
138
|
+
? { fetch: countingFetch(fetchImpl, rowCounter, logger) }
|
|
139
|
+
: {}),
|
|
140
|
+
timeoutMs: opts.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
141
|
+
};
|
|
142
|
+
return { config, rowCounter };
|
|
347
143
|
}
|
|
348
|
-
function
|
|
349
|
-
|
|
144
|
+
function stripQuery(url) {
|
|
145
|
+
const queryStart = url.indexOf("?");
|
|
146
|
+
return queryStart === -1 ? url : url.slice(0, queryStart);
|
|
350
147
|
}
|
|
351
|
-
|
|
352
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Wrap `fetch` to count the rows the registry actually served, so the number
|
|
150
|
+
* dropped by fail-closed verification can be reported. Purely observational: the
|
|
151
|
+
* response is passed through untouched (the body is read from a clone), and any
|
|
152
|
+
* failure to inspect it leaves the count at 0 rather than failing discovery.
|
|
153
|
+
*/
|
|
154
|
+
function countingFetch(fetchImpl, rowCounter, logger) {
|
|
155
|
+
return async (input, init) => {
|
|
156
|
+
const response = await fetchImpl(input, init);
|
|
157
|
+
if (!response.ok) {
|
|
158
|
+
return response;
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
const payload = await response.clone().json();
|
|
162
|
+
if (Array.isArray(payload)) {
|
|
163
|
+
rowCounter.rows += payload.length;
|
|
164
|
+
}
|
|
165
|
+
else if (typeof payload === "object" &&
|
|
166
|
+
payload !== null &&
|
|
167
|
+
Array.isArray(payload.listings)) {
|
|
168
|
+
rowCounter.rows += payload.listings.length;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
logger.warn("metrik discovery: could not inspect the registry payload for a dropped-row count");
|
|
173
|
+
}
|
|
174
|
+
return response;
|
|
175
|
+
};
|
|
353
176
|
}
|
|
354
177
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/discovery/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,8BAA8B,EAC9B,oBAAoB,EACpB,uBAAuB,GAGxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmExB;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACtC,gJAAgJ,CAAC;AAEnJ,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACrC,oEAA6E,CAAC;AAChF,0DAA0D;AAC1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,WAAW,EAAE,0BAA0B;IACvC,QAAQ,EAAE,4CAA4C;IACtD,UAAU,EAAE,yCAAyC;IACrD,QAAQ,EAAE,WAAW;IACrB,cAAc,EAAE;QACd,UAAU,EAAE,0BAA0B;QACtC,UAAU,EAAE;YACV,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,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CAAC;YACvD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3B,UAAU,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;YACpC,CAAC;iBAAM,IACL,OAAO,OAAO,KAAK,QAAQ;gBAC3B,OAAO,KAAK,IAAI;gBAChB,KAAK,CAAC,OAAO,CAAE,OAAkC,CAAC,QAAQ,CAAC,EAC3D,CAAC;gBACD,UAAU,CAAC,IAAI,IAAK,OAAmC,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC1E,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,CAAC,IAAI,CACT,kFAAkF,CACnF,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentkit.d.ts","sourceRoot":"","sources":["../../src/frameworks/agentkit.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EAEd,cAAc,EACd,KAAK,OAAO,EACb,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,
|
|
1
|
+
{"version":3,"file":"agentkit.d.ts","sourceRoot":"","sources":["../../src/frameworks/agentkit.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EAEd,cAAc,EACd,KAAK,OAAO,EACb,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACpB,MAAM,0BAA0B,CA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,CAAC,MAAM,CAAC;IA0BZ,cAAc,CAClB,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,GACzC,OAAO,CAAC,MAAM,CAAC;IAwBZ,WAAW,CACf,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC;IASlB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;CA6F3C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,0BAA0B,GACjC,oBAAoB,CAEtB;AAED,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAC;IAC5C,wEAAwE;IACxE,QAAQ,CAAC,yBAAyB,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CAChE;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,kDAUrC"}
|
|
@@ -11,9 +11,9 @@ import "reflect-metadata";
|
|
|
11
11
|
import { ActionProvider, CreateAction, WalletProvider, } from "@coinbase/agentkit";
|
|
12
12
|
import { isAddress, isHex } from "viem";
|
|
13
13
|
import { z } from "zod";
|
|
14
|
-
import { discoverServices as defaultDiscoverServices, } from "../discovery/registry.js";
|
|
14
|
+
import { RegistryUnavailableError, discoverServices as defaultDiscoverServices, } from "../discovery/registry.js";
|
|
15
15
|
import { checkMandate } from "../mandates/mandate.js";
|
|
16
|
-
import { MandateDeniedError, VerifiedStreamAgentClient, } from "../sdk/client.js";
|
|
16
|
+
import { isCheckpointStream, MandateDeniedError, VerifiedStreamAgentClient, } from "../sdk/client.js";
|
|
17
17
|
/**
|
|
18
18
|
* Base Sepolia is the only settlement network Metrik supports today (Model A,
|
|
19
19
|
* single-chain USDC on Base). Every action fails closed on any other network.
|
|
@@ -145,12 +145,29 @@ export class MetrikActionProvider extends ActionProvider {
|
|
|
145
145
|
this.#discover = config.discoverServices ?? defaultDiscoverServices;
|
|
146
146
|
}
|
|
147
147
|
async discoverServices(_walletProvider, args) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
let listings;
|
|
149
|
+
try {
|
|
150
|
+
listings = await this.#discover({
|
|
151
|
+
...(args.category === undefined ? {} : { category: args.category }),
|
|
152
|
+
...(args.limit === undefined ? {} : { limit: args.limit }),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
// Discovery throws when the registry could not be READ at all. Every other
|
|
157
|
+
// action here returns a string, and more importantly an agent must be able to
|
|
158
|
+
// tell "the marketplace was never reached" from "the marketplace is empty" —
|
|
159
|
+
// collapsing them is how an agent concludes there is nothing to hire and gives
|
|
160
|
+
// up on a live marketplace. So report the failure as a failure, explicitly.
|
|
161
|
+
if (error instanceof RegistryUnavailableError) {
|
|
162
|
+
return ("Could not reach the Metrik marketplace registry, so the set of available " +
|
|
163
|
+
"services is UNKNOWN — this is not the same as there being no services. " +
|
|
164
|
+
`Do not conclude nothing is hireable. Reason: ${error.message}`);
|
|
165
|
+
}
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
152
168
|
if (listings.length === 0) {
|
|
153
|
-
|
|
169
|
+
// Reachable and genuinely empty, or everything filtered out — a real answer.
|
|
170
|
+
return "No verified Metrik services discovered (the registry was reachable and returned no listing that passed verification).";
|
|
154
171
|
}
|
|
155
172
|
const lines = listings.map((listing) => `- ${listing.serviceRef} operator=${listing.operator} verificationUrl=${listing.publicUrl} access=${listing.access} accessUrl=${listing.accessUrl}${listing.category ? ` category=${listing.category}` : ""}`);
|
|
156
173
|
return (`Discovered ${listings.length} verified Metrik service${listings.length === 1 ? "" : "s"} ` +
|
|
@@ -202,9 +219,13 @@ export class MetrikActionProvider extends ActionProvider {
|
|
|
202
219
|
const { stream, claimable, reclaimable } = await this.#client.getStreamStatus(streamId);
|
|
203
220
|
const paused = stream.status !== "active";
|
|
204
221
|
return (`Stream ${streamId} is ${stream.status}${paused ? " (payment halted)" : ""}. ` +
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
222
|
+
(isCheckpointStream(stream)
|
|
223
|
+
? `Verified entitlement: ${formatUsdc(stream.settledCumulative)} USDC of ` +
|
|
224
|
+
`${formatUsdc(stream.deposit)} deposited, of which ` +
|
|
225
|
+
`${formatUsdc(stream.claimedCumulative)} USDC has been claimed. `
|
|
226
|
+
: `Verified accrued: ${formatUsdc(stream.accrued)} USDC of ` +
|
|
227
|
+
`${formatUsdc(stream.deposit)} deposited. `) +
|
|
228
|
+
`Claimable by seller: ${formatUsdc(claimable)} USDC. Reclaimable by buyer: ${formatUsdc(reclaimable)} USDC.`);
|
|
208
229
|
}
|
|
209
230
|
async reclaimUnspent(walletProvider, args) {
|
|
210
231
|
this.#assertWalletNetwork(walletProvider);
|