@zeroxyz/cli 1.17.0 → 1.18.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/dist/index.js +66 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -78449,7 +78449,7 @@ init_esm_shims();
|
|
|
78449
78449
|
// ../sdk/dist/index.js
|
|
78450
78450
|
init_esm_shims();
|
|
78451
78451
|
|
|
78452
|
-
// ../sdk/dist/chunk-
|
|
78452
|
+
// ../sdk/dist/chunk-KDWESC42.js
|
|
78453
78453
|
init_esm_shims();
|
|
78454
78454
|
|
|
78455
78455
|
// ../../node_modules/.pnpm/viem@2.52.2_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@6.0.6_zod@4.3.6/node_modules/viem/_esm/index.js
|
|
@@ -143831,7 +143831,7 @@ config(en_default2());
|
|
|
143831
143831
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
|
|
143832
143832
|
var zod_default = external_exports3;
|
|
143833
143833
|
|
|
143834
|
-
// ../sdk/dist/chunk-
|
|
143834
|
+
// ../sdk/dist/chunk-KDWESC42.js
|
|
143835
143835
|
var createManagedAccount = (client, address2) => toAccount({
|
|
143836
143836
|
address: address2,
|
|
143837
143837
|
async signMessage({ message: message2 }) {
|
|
@@ -144000,16 +144000,6 @@ var extractInputEnvelope = (bodySchema, method) => {
|
|
|
144000
144000
|
const isGetLike = upperMethod === "GET" || upperMethod === "DELETE";
|
|
144001
144001
|
return isGetLike ? { queryParams: root } : { body: root };
|
|
144002
144002
|
};
|
|
144003
|
-
var unwrapTransportEnvelope = (request22) => {
|
|
144004
|
-
const input = asSchemaNode(asSchemaNode(request22)?.input);
|
|
144005
|
-
if (!input || input.type !== "http") return request22;
|
|
144006
|
-
const body = input.body;
|
|
144007
|
-
const hasBody = body !== void 0 && body !== null && !(typeof body === "object" && Object.keys(body).length === 0);
|
|
144008
|
-
if (hasBody) return body;
|
|
144009
|
-
const qp = asSchemaNode(input.queryParams);
|
|
144010
|
-
if (qp && Object.keys(qp).length > 0) return qp;
|
|
144011
|
-
return null;
|
|
144012
|
-
};
|
|
144013
144003
|
var GET_LIKE = /* @__PURE__ */ new Set(["GET", "HEAD", "DELETE"]);
|
|
144014
144004
|
var appendQueryParams = (url4, params) => {
|
|
144015
144005
|
const entries = Object.entries(params).filter(([, v]) => v != null);
|
|
@@ -144398,6 +144388,7 @@ var pickSessionCloseAmount = (receipt, openTimeCumulative) => {
|
|
|
144398
144388
|
if (receipt.metered === true) return fromReceipt;
|
|
144399
144389
|
return fromReceipt > openTimeCumulative ? fromReceipt : openTimeCumulative;
|
|
144400
144390
|
};
|
|
144391
|
+
var isMeteredZeroReceipt = (receipt) => receipt?.metered === true && BigInt(receipt.acceptedCumulative) === 0n && BigInt(receipt.spent) === 0n;
|
|
144401
144392
|
var raceWithSignal = (p, signal, client) => {
|
|
144402
144393
|
if (!signal) return p;
|
|
144403
144394
|
if (signal.aborted) {
|
|
@@ -144971,7 +144962,7 @@ var Payments = class {
|
|
|
144971
144962
|
}
|
|
144972
144963
|
const receipt = readSessionReceipt(response);
|
|
144973
144964
|
let closeAmount = pickSessionCloseAmount(receipt, openTimeCumulative);
|
|
144974
|
-
if (closeAmount === 0n && channelEntry.cumulativeAmount > 0n) {
|
|
144965
|
+
if (closeAmount === 0n && channelEntry.cumulativeAmount > 0n && !isMeteredZeroReceipt(receipt)) {
|
|
144975
144966
|
closeAmount = channelEntry.cumulativeAmount;
|
|
144976
144967
|
}
|
|
144977
144968
|
const reconcileAmount = receipt && isUintString(receipt.acceptedCumulative) ? receipt.acceptedCumulative : closeAmount.toString();
|
|
@@ -144988,7 +144979,7 @@ var Payments = class {
|
|
|
144988
144979
|
capturedAmount,
|
|
144989
144980
|
cause
|
|
144990
144981
|
});
|
|
144991
|
-
if (closeAmount === 0n) {
|
|
144982
|
+
if (closeAmount === 0n && !isMeteredZeroReceipt(receipt)) {
|
|
144992
144983
|
throw closeFailed(
|
|
144993
144984
|
`Refusing to sign zero close credential for channel ${channelId} \u2014 neither receipt nor channelEntry produced a nonzero cumulativeAmount. Query escrow directly to recover; check logger for an earlier 'non-bigint cumulativeAmount' warning.`
|
|
144994
144985
|
);
|
|
@@ -145757,7 +145748,7 @@ var clientFetch = async (client, url4, opts = {}) => {
|
|
|
145757
145748
|
return result;
|
|
145758
145749
|
};
|
|
145759
145750
|
var package_default = {
|
|
145760
|
-
version: "0.
|
|
145751
|
+
version: "0.12.0"
|
|
145761
145752
|
};
|
|
145762
145753
|
var SDK_VERSION2 = package_default.version;
|
|
145763
145754
|
var agentAuthMetadataSchema = external_exports3.object({
|
|
@@ -146636,6 +146627,12 @@ var capabilityResponseSchema = external_exports3.object({
|
|
|
146636
146627
|
bodySchema: external_exports3.record(external_exports3.string(), external_exports3.unknown()).nullable(),
|
|
146637
146628
|
responseSchema: external_exports3.record(external_exports3.string(), external_exports3.unknown()).nullable(),
|
|
146638
146629
|
example: external_exports3.object({ request: external_exports3.unknown(), response: external_exports3.unknown() }).nullable(),
|
|
146630
|
+
// The bare, schema-validated request body to send — `.request` unwrapped
|
|
146631
|
+
// from the transcript envelope and checked against the current bodySchema.
|
|
146632
|
+
// Null when there's no usable example or it's stale vs the schema; `example`
|
|
146633
|
+
// is retained for the response sample. Optional for back-compat with older
|
|
146634
|
+
// servers that don't emit it.
|
|
146635
|
+
exampleRequest: external_exports3.record(external_exports3.string(), external_exports3.unknown()).nullable().optional(),
|
|
146639
146636
|
tags: external_exports3.array(external_exports3.string()).nullable(),
|
|
146640
146637
|
exampleAgentPrompt: external_exports3.string().nullable().optional(),
|
|
146641
146638
|
whatItDoes: external_exports3.string().nullable().optional(),
|
|
@@ -147785,7 +147782,7 @@ var placeholderFor = (fieldName, propSchema) => String(sampleValueFor(fieldName,
|
|
|
147785
147782
|
|
|
147786
147783
|
// package.json
|
|
147787
147784
|
var package_default2 = {
|
|
147788
|
-
version: "1.
|
|
147785
|
+
version: "1.18.0"};
|
|
147789
147786
|
|
|
147790
147787
|
// src/app.ts
|
|
147791
147788
|
init_esm_shims();
|
|
@@ -150049,13 +150046,20 @@ var buildResponseSection = (capability) => {
|
|
|
150049
150046
|
return [];
|
|
150050
150047
|
};
|
|
150051
150048
|
var buildVerifiedExampleSection = (capability) => {
|
|
150052
|
-
const req = capability.
|
|
150053
|
-
if (req
|
|
150054
|
-
|
|
150055
|
-
|
|
150056
|
-
|
|
150057
|
-
|
|
150058
|
-
|
|
150049
|
+
const req = capability.exampleRequest;
|
|
150050
|
+
if (req) {
|
|
150051
|
+
const json3 = JSON.stringify(req);
|
|
150052
|
+
const truncated = json3.length > 600 ? `${json3.slice(0, 600)}\u2026` : json3;
|
|
150053
|
+
return ["", "Verified example (request):", ` ${truncated}`];
|
|
150054
|
+
}
|
|
150055
|
+
if (req === null && capability.example?.request !== void 0 && capability.example?.request !== null) {
|
|
150056
|
+
return [
|
|
150057
|
+
"",
|
|
150058
|
+
"Verified example: no usable request example for the current schema \u2014",
|
|
150059
|
+
" build the request from Parameters above."
|
|
150060
|
+
];
|
|
150061
|
+
}
|
|
150062
|
+
return [];
|
|
150059
150063
|
};
|
|
150060
150064
|
var buildTryItExample = (capability) => {
|
|
150061
150065
|
const method = capability.method.toUpperCase();
|
|
@@ -150145,6 +150149,21 @@ var formatCapability = (capability) => {
|
|
|
150145
150149
|
lines.push(...buildTryItExample(capability));
|
|
150146
150150
|
return lines.join("\n");
|
|
150147
150151
|
};
|
|
150152
|
+
var URL_RESOLUTION_METHODS = [
|
|
150153
|
+
"POST",
|
|
150154
|
+
"GET",
|
|
150155
|
+
"PUT",
|
|
150156
|
+
"PATCH",
|
|
150157
|
+
"DELETE"
|
|
150158
|
+
];
|
|
150159
|
+
var isHttpUrl = (value) => {
|
|
150160
|
+
try {
|
|
150161
|
+
const url4 = new URL(value);
|
|
150162
|
+
return url4.protocol === "http:" || url4.protocol === "https:";
|
|
150163
|
+
} catch {
|
|
150164
|
+
return false;
|
|
150165
|
+
}
|
|
150166
|
+
};
|
|
150148
150167
|
var getCommand = (appContext) => new Command("get").description("Get details for a capability by token, slug, or uid").argument(
|
|
150149
150168
|
"<identifier>",
|
|
150150
150169
|
"Attribution token (z_xxx.N from search results), capability slug, or uid"
|
|
@@ -150154,7 +150173,30 @@ var getCommand = (appContext) => new Command("get").description("Get details for
|
|
|
150154
150173
|
).action(async (identifier, options) => {
|
|
150155
150174
|
try {
|
|
150156
150175
|
const { analyticsService, client } = appContext.services;
|
|
150157
|
-
|
|
150176
|
+
let capabilityRef = identifier;
|
|
150177
|
+
if (isHttpUrl(identifier)) {
|
|
150178
|
+
const matches2 = /* @__PURE__ */ new Map();
|
|
150179
|
+
for (const method of URL_RESOLUTION_METHODS) {
|
|
150180
|
+
const resolved = await client.capabilities.resolveByUrl(
|
|
150181
|
+
identifier,
|
|
150182
|
+
method
|
|
150183
|
+
);
|
|
150184
|
+
if (resolved) {
|
|
150185
|
+
matches2.set(resolved.capabilityId, resolved.capabilitySlug);
|
|
150186
|
+
}
|
|
150187
|
+
}
|
|
150188
|
+
if (matches2.size !== 1) {
|
|
150189
|
+
throw new Error(
|
|
150190
|
+
matches2.size === 0 ? "No indexed capability found for that URL." : "Multiple capabilities match that URL; use a capability slug or uid instead."
|
|
150191
|
+
);
|
|
150192
|
+
}
|
|
150193
|
+
const [resolvedCapabilityId] = matches2.keys();
|
|
150194
|
+
if (!resolvedCapabilityId) {
|
|
150195
|
+
throw new Error("No indexed capability found for that URL.");
|
|
150196
|
+
}
|
|
150197
|
+
capabilityRef = resolvedCapabilityId;
|
|
150198
|
+
}
|
|
150199
|
+
const capability = await client.capabilities.get(capabilityRef);
|
|
150158
150200
|
if (options.formatted && !options.json) {
|
|
150159
150201
|
console.log(formatCapability(capability));
|
|
150160
150202
|
} else {
|