@zeroxyz/sdk 0.7.0 → 0.9.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/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/dist/{chunk-2HZJHVDN.cjs → chunk-O7QJMY3Y.cjs} +61 -4
- package/dist/chunk-O7QJMY3Y.cjs.map +1 -0
- package/dist/{chunk-26IHUYNK.js → chunk-T6JT5NV5.js} +61 -4
- package/dist/chunk-T6JT5NV5.js.map +1 -0
- package/dist/{client-7zp9ZyYd.d.cts → client-Du4zQHef.d.cts} +47 -0
- package/dist/{client-7zp9ZyYd.d.ts → client-Du4zQHef.d.ts} +47 -0
- package/dist/index.cjs +36 -36
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-26IHUYNK.js.map +0 -1
- package/dist/chunk-2HZJHVDN.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ All notable changes to `@zeroxyz/sdk` will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) — with the pre-1.0 caveat that minor versions may include breaking changes.
|
|
6
6
|
|
|
7
|
+
## 0.9.0
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`CapabilityResponse.pricing`** — the server-resolved price as a single structured object: `{ kind, summary, primary, accepted }`. `summary` is the canonical display string (render it verbatim instead of re-deriving from raw fields); `kind` classifies the price shape (`static | dynamic | session | metered | subscription | free | unknown`); `primary`/`accepted[]` carry the normalized payment options (`protocol`, `network`, `amountUsd`, `per`, `confidence`, optional `depositUsd`). Optional — absent on older API deploys. (#708, ZERO-199)
|
|
12
|
+
- **Price fields the server was already emitting but the SDK schemas silently stripped** (#687, ZERO-199): `CapabilityResponse.priceDynamic` / `priceHint` (usage-priced caps advertise a rate like `"$0.01/result"`, not a flat scalar), `sessionDeposit` (`{ amountUsd, asset }` — the upfront channel deposit for `mode='session'` caps, distinct from the per-call price), `priceStatus` (`priced | proven_free | free_handshake | unknown_unparsed | unprobed`) and `requiresHandshake`, per-rail `asset`/`unit`/`depositMicros`/`planRef` on `paymentMethods[]`, and `SearchResult.protocol`.
|
|
13
|
+
|
|
14
|
+
## 0.8.0
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **`CapabilityResponse.instructions`** — optional natural-language field describing how an agent should call this capability (authentication hints, required context, usage notes). Exposed on `capabilities.get()` responses and in the `CapabilityResponse` type. (#693, ZERO-134)
|
|
19
|
+
|
|
7
20
|
## 0.7.0
|
|
8
21
|
|
|
9
22
|
### Added
|
package/README.md
CHANGED
|
@@ -188,7 +188,7 @@ for (const warning of result.warnings ?? []) {
|
|
|
188
188
|
|
|
189
189
|
`maxPay` is your hard per-call ceiling, in USDC. The challenge amount is checked against it **before** anything is signed; an over-cap challenge aborts with `outcome: "payment_failed"` and no on-chain spend. Set it on every paid call — it's the guardrail that keeps a mispriced or hostile endpoint from draining the wallet.
|
|
190
190
|
|
|
191
|
-
To put a human in the loop before any spend, read the price up front (`
|
|
191
|
+
To put a human in the loop before any spend, read the price up front, show it to your user, and only call `fetch()` with `maxPay` once they approve. Prefer `capabilities.get()`'s **`pricing`** object when present: `pricing.summary` is the server-resolved display string (render it verbatim — don't re-derive from raw fields), `pricing.kind` classifies the shape (`static | dynamic | session | metered | subscription | free | unknown`), and `pricing.primary.amountUsd` / `depositUsd` give the structured numbers for sizing `maxPay`. `cost.amount` remains on every search result as the raw advertised scalar, but it flattens usage-priced caps — a `dynamic` cap's real cost scales with input.
|
|
192
192
|
|
|
193
193
|
## Wallet & funding
|
|
194
194
|
|
|
@@ -1838,7 +1838,7 @@ var clientFetch = async (client, url, opts = {}) => {
|
|
|
1838
1838
|
|
|
1839
1839
|
// package.json
|
|
1840
1840
|
var package_default = {
|
|
1841
|
-
version: "0.
|
|
1841
|
+
version: "0.9.0"};
|
|
1842
1842
|
|
|
1843
1843
|
// src/version.ts
|
|
1844
1844
|
var SDK_VERSION = package_default.version;
|
|
@@ -2442,6 +2442,15 @@ var ratingSchema = zod.z.object({
|
|
|
2442
2442
|
});
|
|
2443
2443
|
|
|
2444
2444
|
// src/schemas/capabilities.ts
|
|
2445
|
+
var pricingOptionSchema = zod.z.object({
|
|
2446
|
+
kind: zod.z.string(),
|
|
2447
|
+
protocol: zod.z.string(),
|
|
2448
|
+
network: zod.z.string().nullable(),
|
|
2449
|
+
amountUsd: zod.z.string().nullable(),
|
|
2450
|
+
per: zod.z.string(),
|
|
2451
|
+
confidence: zod.z.string(),
|
|
2452
|
+
depositUsd: zod.z.string().optional()
|
|
2453
|
+
});
|
|
2445
2454
|
var capabilityResponseSchema = zod.z.object({
|
|
2446
2455
|
uid: zod.z.string(),
|
|
2447
2456
|
slug: zod.z.string(),
|
|
@@ -2456,8 +2465,33 @@ var capabilityResponseSchema = zod.z.object({
|
|
|
2456
2465
|
example: zod.z.object({ request: zod.z.unknown(), response: zod.z.unknown() }).nullable(),
|
|
2457
2466
|
tags: zod.z.array(zod.z.string()).nullable(),
|
|
2458
2467
|
exampleAgentPrompt: zod.z.string().nullable().optional(),
|
|
2468
|
+
whatItDoes: zod.z.string().nullable().optional(),
|
|
2469
|
+
resultDescription: zod.z.string().nullable().optional(),
|
|
2470
|
+
failureModes: zod.z.array(zod.z.string()).nullable().optional(),
|
|
2471
|
+
whenToPreferThis: zod.z.string().nullable().optional(),
|
|
2472
|
+
// Agent-facing execution guide (markdown). Covers usage patterns, input
|
|
2473
|
+
// field guidance, cross-cap composition, and known failure modes.
|
|
2474
|
+
// Named after MCP tool convention: description = what it is, instructions = how to use it.
|
|
2475
|
+
instructions: zod.z.string().nullable().optional(),
|
|
2459
2476
|
displayCostAmount: zod.z.string(),
|
|
2460
2477
|
displayCostAsset: zod.z.string(),
|
|
2478
|
+
// Whether the upstream advertises variable/usage-based pricing, and the raw
|
|
2479
|
+
// hint string (e.g. "$0.01/result"). The server emits both; without them an
|
|
2480
|
+
// agent sees a single scalar with no signal that the price scales with input
|
|
2481
|
+
// (ZERO-199). Optional so an older API deploy still parses.
|
|
2482
|
+
priceDynamic: zod.z.boolean().optional(),
|
|
2483
|
+
priceHint: zod.z.string().nullable().optional(),
|
|
2484
|
+
// ZERO-199: the authoritative price classification. Only `proven_free` may be
|
|
2485
|
+
// rendered "Free"; `unknown_unparsed` is a parse miss (never free); a parse
|
|
2486
|
+
// miss must not become "0"→Free. Optional so older deploys still parse.
|
|
2487
|
+
priceStatus: zod.z.enum([
|
|
2488
|
+
"priced",
|
|
2489
|
+
"proven_free",
|
|
2490
|
+
"free_handshake",
|
|
2491
|
+
"unknown_unparsed",
|
|
2492
|
+
"unprobed"
|
|
2493
|
+
]).optional(),
|
|
2494
|
+
requiresHandshake: zod.z.boolean().optional(),
|
|
2461
2495
|
reviewCount: zod.z.number(),
|
|
2462
2496
|
rating: ratingSchema,
|
|
2463
2497
|
priceObserved: zod.z.object({
|
|
@@ -2480,9 +2514,27 @@ var capabilityResponseSchema = zod.z.object({
|
|
|
2480
2514
|
mode: zod.z.string(),
|
|
2481
2515
|
costAmount: zod.z.string(),
|
|
2482
2516
|
costPer: zod.z.string(),
|
|
2483
|
-
priority: zod.z.number()
|
|
2517
|
+
priority: zod.z.number(),
|
|
2518
|
+
// ZERO-199 rail-union fields (optional; older deploys omit them).
|
|
2519
|
+
asset: zod.z.string().nullable().optional(),
|
|
2520
|
+
unit: zod.z.string().optional(),
|
|
2521
|
+
depositMicros: zod.z.number().nullable().optional(),
|
|
2522
|
+
planRef: zod.z.string().nullable().optional()
|
|
2484
2523
|
})
|
|
2485
2524
|
).nullable(),
|
|
2525
|
+
// Recommended channel deposit for a `mode='session'` cap (the seller's
|
|
2526
|
+
// advertised `suggestedDeposit`). Without it an agent can't size an MPP
|
|
2527
|
+
// session channel. The server emits it; optional for older-deploy parsing
|
|
2528
|
+
// (ZERO-199).
|
|
2529
|
+
sessionDeposit: zod.z.object({ amountUsd: zod.z.string(), asset: zod.z.string() }).nullable().optional(),
|
|
2530
|
+
// ZERO-199 P-B — the single resolved price. Prefer `pricing.summary`/`kind`
|
|
2531
|
+
// over re-deriving from the legacy fields. Optional so older deploys parse.
|
|
2532
|
+
pricing: zod.z.object({
|
|
2533
|
+
kind: zod.z.string(),
|
|
2534
|
+
summary: zod.z.string(),
|
|
2535
|
+
primary: pricingOptionSchema.nullable(),
|
|
2536
|
+
accepted: zod.z.array(pricingOptionSchema)
|
|
2537
|
+
}).optional(),
|
|
2486
2538
|
availabilityStatus: zod.z.enum(["healthy", "unknown", "down"]).nullable().optional(),
|
|
2487
2539
|
/**
|
|
2488
2540
|
* @deprecated The API no longer emits `displayStatus`; it has been replaced
|
|
@@ -2913,6 +2965,11 @@ var searchResultSchema = zod.z.object({
|
|
|
2913
2965
|
url: zod.z.string(),
|
|
2914
2966
|
urlTemplate: zod.z.string().nullable().optional(),
|
|
2915
2967
|
cost: zod.z.object({ amount: zod.z.string(), asset: zod.z.string() }),
|
|
2968
|
+
// Payment protocol (x402 | mpp) for this result. The server emits it; the SDK
|
|
2969
|
+
// previously stripped it, leaving an agent unable to tell which handshake to
|
|
2970
|
+
// engage from a search row. Optional/nullable so older deploys still parse
|
|
2971
|
+
// (ZERO-199).
|
|
2972
|
+
protocol: zod.z.string().nullable().optional(),
|
|
2916
2973
|
reviewCount: zod.z.number().optional(),
|
|
2917
2974
|
rating: ratingSchema,
|
|
2918
2975
|
// All-time activation count (non-deleted runs), mirroring capabilities.ts.
|
|
@@ -3344,5 +3401,5 @@ exports.normalizeTransportEnvelopeRequest = normalizeTransportEnvelopeRequest;
|
|
|
3344
3401
|
exports.paymentHasAnchor = paymentHasAnchor;
|
|
3345
3402
|
exports.tempoChainLabelFromId = tempoChainLabelFromId;
|
|
3346
3403
|
exports.unwrapTransportEnvelope = unwrapTransportEnvelope;
|
|
3347
|
-
//# sourceMappingURL=chunk-
|
|
3348
|
-
//# sourceMappingURL=chunk-
|
|
3404
|
+
//# sourceMappingURL=chunk-O7QJMY3Y.cjs.map
|
|
3405
|
+
//# sourceMappingURL=chunk-O7QJMY3Y.cjs.map
|