@zeroxyz/cli 1.6.0 → 1.7.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 +166 -40
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -76582,7 +76582,7 @@ init_esm_shims();
|
|
|
76582
76582
|
|
|
76583
76583
|
// package.json
|
|
76584
76584
|
var package_default = {
|
|
76585
|
-
version: "1.
|
|
76585
|
+
version: "1.7.0"};
|
|
76586
76586
|
|
|
76587
76587
|
// src/app.ts
|
|
76588
76588
|
init_esm_shims();
|
|
@@ -77590,7 +77590,7 @@ init_esm_shims();
|
|
|
77590
77590
|
// ../sdk/dist/index.js
|
|
77591
77591
|
init_esm_shims();
|
|
77592
77592
|
|
|
77593
|
-
// ../sdk/dist/chunk-
|
|
77593
|
+
// ../sdk/dist/chunk-3YKWO4B2.js
|
|
77594
77594
|
init_esm_shims();
|
|
77595
77595
|
|
|
77596
77596
|
// ../../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
|
|
@@ -143081,6 +143081,76 @@ var ZeroConfigurationError = class extends ZeroError {
|
|
|
143081
143081
|
this.name = "ZeroConfigurationError";
|
|
143082
143082
|
}
|
|
143083
143083
|
};
|
|
143084
|
+
var asSchemaNode = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
143085
|
+
var extractInputEnvelope = (bodySchema, method) => {
|
|
143086
|
+
const root = asSchemaNode(bodySchema);
|
|
143087
|
+
if (!root) return {};
|
|
143088
|
+
const props = asSchemaNode(root.properties);
|
|
143089
|
+
if (!props) return {};
|
|
143090
|
+
const inputProps = asSchemaNode(asSchemaNode(props.input)?.properties);
|
|
143091
|
+
if (inputProps) {
|
|
143092
|
+
return {
|
|
143093
|
+
queryParams: asSchemaNode(inputProps.queryParams) ?? void 0,
|
|
143094
|
+
body: asSchemaNode(inputProps.body) ?? void 0
|
|
143095
|
+
};
|
|
143096
|
+
}
|
|
143097
|
+
const upperMethod = method.toUpperCase();
|
|
143098
|
+
const isGetLike = upperMethod === "GET" || upperMethod === "DELETE";
|
|
143099
|
+
return isGetLike ? { queryParams: root } : { body: root };
|
|
143100
|
+
};
|
|
143101
|
+
var unwrapTransportEnvelope = (request22) => {
|
|
143102
|
+
const input = asSchemaNode(asSchemaNode(request22)?.input);
|
|
143103
|
+
if (!input || input.type !== "http") return request22;
|
|
143104
|
+
const body = input.body;
|
|
143105
|
+
const hasBody = body !== void 0 && body !== null && !(typeof body === "object" && Object.keys(body).length === 0);
|
|
143106
|
+
if (hasBody) return body;
|
|
143107
|
+
const qp = asSchemaNode(input.queryParams);
|
|
143108
|
+
if (qp && Object.keys(qp).length > 0) return qp;
|
|
143109
|
+
return null;
|
|
143110
|
+
};
|
|
143111
|
+
var GET_LIKE = /* @__PURE__ */ new Set(["GET", "HEAD", "DELETE"]);
|
|
143112
|
+
var appendQueryParams = (url4, params) => {
|
|
143113
|
+
const entries = Object.entries(params).filter(([, v]) => v != null);
|
|
143114
|
+
if (entries.length === 0) return url4;
|
|
143115
|
+
try {
|
|
143116
|
+
const u2 = new URL(url4);
|
|
143117
|
+
for (const [k3, v] of entries) u2.searchParams.set(k3, String(v));
|
|
143118
|
+
return u2.toString();
|
|
143119
|
+
} catch {
|
|
143120
|
+
const qs = entries.map(
|
|
143121
|
+
([k3, v]) => `${encodeURIComponent(k3)}=${encodeURIComponent(String(v))}`
|
|
143122
|
+
).join("&");
|
|
143123
|
+
return url4.includes("?") ? `${url4}&${qs}` : `${url4}?${qs}`;
|
|
143124
|
+
}
|
|
143125
|
+
};
|
|
143126
|
+
var normalizeTransportEnvelopeRequest = (url4, opts) => {
|
|
143127
|
+
const { method, body } = opts;
|
|
143128
|
+
if (typeof body !== "string") return { url: url4, method, body };
|
|
143129
|
+
let parsed;
|
|
143130
|
+
try {
|
|
143131
|
+
parsed = JSON.parse(body);
|
|
143132
|
+
} catch {
|
|
143133
|
+
return { url: url4, method, body };
|
|
143134
|
+
}
|
|
143135
|
+
const input = asSchemaNode(asSchemaNode(parsed)?.input);
|
|
143136
|
+
if (!input || input.type !== "http") return { url: url4, method, body };
|
|
143137
|
+
const innerBody = input.body;
|
|
143138
|
+
const hasInnerBody = innerBody !== void 0 && innerBody !== null && !(typeof innerBody === "object" && Object.keys(innerBody).length === 0);
|
|
143139
|
+
const verb = (method ?? (typeof input.method === "string" ? input.method : void 0) ?? (hasInnerBody ? "POST" : "GET")).toUpperCase();
|
|
143140
|
+
if (GET_LIKE.has(verb)) {
|
|
143141
|
+
const qp = asSchemaNode(input.queryParams);
|
|
143142
|
+
return {
|
|
143143
|
+
url: qp ? appendQueryParams(url4, qp) : url4,
|
|
143144
|
+
method: verb,
|
|
143145
|
+
body: void 0
|
|
143146
|
+
};
|
|
143147
|
+
}
|
|
143148
|
+
return {
|
|
143149
|
+
url: url4,
|
|
143150
|
+
method: verb,
|
|
143151
|
+
body: hasInnerBody ? JSON.stringify(innerBody) : void 0
|
|
143152
|
+
};
|
|
143153
|
+
};
|
|
143084
143154
|
var KNOWN_EIP712_DOMAINS = {
|
|
143085
143155
|
// Base mainnet USDC. On-chain `name()` is "USD Coin" (NOT "USDC")
|
|
143086
143156
|
// — verified via the contract's name() / version().
|
|
@@ -144092,7 +144162,7 @@ var Payments = class {
|
|
|
144092
144162
|
};
|
|
144093
144163
|
};
|
|
144094
144164
|
var package_default2 = {
|
|
144095
|
-
version: "0.
|
|
144165
|
+
version: "0.6.0"
|
|
144096
144166
|
};
|
|
144097
144167
|
var SDK_VERSION2 = package_default2.version;
|
|
144098
144168
|
var userWalletDtoSchema = external_exports3.object({
|
|
@@ -144807,6 +144877,30 @@ var listRunsResponseSchema = external_exports3.object({
|
|
|
144807
144877
|
runs: external_exports3.array(runListItemSchema),
|
|
144808
144878
|
nextCursor: external_exports3.string().nullable()
|
|
144809
144879
|
});
|
|
144880
|
+
var runDetailSchema = external_exports3.object({
|
|
144881
|
+
runId: external_exports3.string(),
|
|
144882
|
+
status: external_exports3.number().nullable(),
|
|
144883
|
+
latencyMs: external_exports3.number().nullable(),
|
|
144884
|
+
errorClass: external_exports3.string().nullable(),
|
|
144885
|
+
createdAt: external_exports3.coerce.date(),
|
|
144886
|
+
cost: external_exports3.object({ amount: external_exports3.string(), asset: external_exports3.string().nullable() }).nullable(),
|
|
144887
|
+
payment: external_exports3.object({
|
|
144888
|
+
protocol: external_exports3.string(),
|
|
144889
|
+
chain: external_exports3.string().nullable(),
|
|
144890
|
+
txHash: external_exports3.string().nullable(),
|
|
144891
|
+
mode: external_exports3.string().nullable()
|
|
144892
|
+
}).nullable(),
|
|
144893
|
+
capability: external_exports3.object({
|
|
144894
|
+
uid: external_exports3.string(),
|
|
144895
|
+
slug: external_exports3.string(),
|
|
144896
|
+
name: external_exports3.string(),
|
|
144897
|
+
url: external_exports3.string(),
|
|
144898
|
+
method: external_exports3.string(),
|
|
144899
|
+
whatItDoes: external_exports3.string().nullable(),
|
|
144900
|
+
tags: external_exports3.array(external_exports3.string())
|
|
144901
|
+
}),
|
|
144902
|
+
reviewed: external_exports3.boolean()
|
|
144903
|
+
});
|
|
144810
144904
|
var createReviewResponseSchema = external_exports3.object({
|
|
144811
144905
|
reviewId: external_exports3.string(),
|
|
144812
144906
|
recorded: external_exports3.boolean(),
|
|
@@ -144886,6 +144980,15 @@ var Runs = class {
|
|
|
144886
144980
|
listRunsResponseSchema
|
|
144887
144981
|
);
|
|
144888
144982
|
};
|
|
144983
|
+
get = (runId, opts = {}) => request2(
|
|
144984
|
+
this.client,
|
|
144985
|
+
{
|
|
144986
|
+
method: "GET",
|
|
144987
|
+
path: `/v1/runs/${runId}`,
|
|
144988
|
+
signal: opts.signal
|
|
144989
|
+
},
|
|
144990
|
+
runDetailSchema
|
|
144991
|
+
);
|
|
144889
144992
|
review = (input, opts = {}) => request2(
|
|
144890
144993
|
this.client,
|
|
144891
144994
|
{
|
|
@@ -145410,17 +145513,23 @@ var withDefaultContentType = (headers, body) => {
|
|
|
145410
145513
|
var clientFetch = async (client, url4, opts = {}) => {
|
|
145411
145514
|
const startedAt = Date.now();
|
|
145412
145515
|
const capabilityIdRequested = opts.capabilityId !== void 0;
|
|
145413
|
-
const
|
|
145516
|
+
const normalized = normalizeTransportEnvelopeRequest(url4, {
|
|
145517
|
+
method: opts.method,
|
|
145518
|
+
body: opts.body
|
|
145519
|
+
});
|
|
145520
|
+
const requestUrl = normalized.url;
|
|
145521
|
+
const requestBody = normalized.body;
|
|
145522
|
+
const method = normalized.method ?? (requestBody !== void 0 ? "POST" : "GET");
|
|
145414
145523
|
const { canRecord: canRecordForResolve } = resolveRecordingClient(
|
|
145415
145524
|
client,
|
|
145416
145525
|
opts
|
|
145417
145526
|
);
|
|
145418
|
-
const resolvePromise = !capabilityIdRequested && canRecordForResolve ? client.capabilities.resolveByUrl(redactUrl2(
|
|
145419
|
-
const probeHeaders = withDefaultContentType(opts.headers,
|
|
145527
|
+
const resolvePromise = !capabilityIdRequested && canRecordForResolve ? client.capabilities.resolveByUrl(redactUrl2(requestUrl), method).catch(() => null) : Promise.resolve(null);
|
|
145528
|
+
const probeHeaders = withDefaultContentType(opts.headers, requestBody);
|
|
145420
145529
|
const requestInit = {
|
|
145421
145530
|
method,
|
|
145422
145531
|
headers: probeHeaders,
|
|
145423
|
-
body:
|
|
145532
|
+
body: requestBody,
|
|
145424
145533
|
signal: opts.signal
|
|
145425
145534
|
};
|
|
145426
145535
|
const configuredFetch = buildConfiguredFetch(client, {
|
|
@@ -145431,7 +145540,7 @@ var clientFetch = async (client, url4, opts = {}) => {
|
|
|
145431
145540
|
const skipReasons = [];
|
|
145432
145541
|
const warnings = [];
|
|
145433
145542
|
try {
|
|
145434
|
-
response = await configuredFetch(
|
|
145543
|
+
response = await configuredFetch(requestUrl, requestInit);
|
|
145435
145544
|
} catch (err) {
|
|
145436
145545
|
if (err instanceof ZeroTimeoutError) {
|
|
145437
145546
|
await recordTimeoutRun(
|
|
@@ -145461,13 +145570,13 @@ var clientFetch = async (client, url4, opts = {}) => {
|
|
|
145461
145570
|
const payCall = requirement.protocol === "x402" ? client.payments.pay : client.payments.payMpp;
|
|
145462
145571
|
try {
|
|
145463
145572
|
const paid = await payCall({
|
|
145464
|
-
url:
|
|
145573
|
+
url: requestUrl,
|
|
145465
145574
|
method,
|
|
145466
145575
|
// Fresh clone for the paid retry — same rationale as
|
|
145467
145576
|
// the probe-side clone above. Re-derives the default
|
|
145468
145577
|
// Content-Type so the paid leg matches the probe.
|
|
145469
|
-
headers: withDefaultContentType(opts.headers,
|
|
145470
|
-
body:
|
|
145578
|
+
headers: withDefaultContentType(opts.headers, requestBody),
|
|
145579
|
+
body: requestBody,
|
|
145471
145580
|
maxPay: opts.maxPay,
|
|
145472
145581
|
account: opts.account,
|
|
145473
145582
|
signal: opts.signal,
|
|
@@ -146645,7 +146754,7 @@ var fetchCommand = (appContext) => new Command("fetch").description(
|
|
|
146645
146754
|
headers["content-type"] = Buffer.isBuffer(resolvedBody) ? sniffJsonShape(resolvedBody) ? "application/json" : "application/octet-stream" : "application/json";
|
|
146646
146755
|
}
|
|
146647
146756
|
const log2 = (msg) => console.error(` ${msg}`);
|
|
146648
|
-
const method = options.method ? options.method.toUpperCase() : resolvedMethodFromCapability
|
|
146757
|
+
const method = options.method ? options.method.toUpperCase() : resolvedMethodFromCapability ? resolvedMethodFromCapability.toUpperCase() : resolvedBody ? "POST" : "GET";
|
|
146649
146758
|
const explicitCapabilityCtx = options.capability ? stateService.findSearchContextByCapability(options.capability) : null;
|
|
146650
146759
|
const urlCtx = stateService.findSearchContextByUrl(resolvedUrl, {
|
|
146651
146760
|
matchTemplate: (template) => {
|
|
@@ -147137,22 +147246,6 @@ var sampleValueFor = (fieldName, propSchema, depth = 0) => {
|
|
|
147137
147246
|
}
|
|
147138
147247
|
};
|
|
147139
147248
|
var placeholderFor = (fieldName, propSchema) => String(sampleValueFor(fieldName, propSchema));
|
|
147140
|
-
var extractInputEnvelope = (bodySchema, method) => {
|
|
147141
|
-
const root = asNode(bodySchema);
|
|
147142
|
-
if (!root) return {};
|
|
147143
|
-
const props = asNode(root.properties);
|
|
147144
|
-
if (!props) return {};
|
|
147145
|
-
const inputProps = asNode(asNode(props.input)?.properties);
|
|
147146
|
-
if (inputProps) {
|
|
147147
|
-
return {
|
|
147148
|
-
queryParams: asNode(inputProps.queryParams) ?? void 0,
|
|
147149
|
-
body: asNode(inputProps.body) ?? void 0
|
|
147150
|
-
};
|
|
147151
|
-
}
|
|
147152
|
-
const upperMethod = method.toUpperCase();
|
|
147153
|
-
const isGetLike = upperMethod === "GET" || upperMethod === "DELETE";
|
|
147154
|
-
return isGetLike ? { queryParams: root } : { body: root };
|
|
147155
|
-
};
|
|
147156
147249
|
var schemaTypeLabel = (node) => {
|
|
147157
147250
|
const t = node.type;
|
|
147158
147251
|
if (typeof t === "string") return t;
|
|
@@ -147291,16 +147384,6 @@ var buildResponseSection = (capability) => {
|
|
|
147291
147384
|
}
|
|
147292
147385
|
return [];
|
|
147293
147386
|
};
|
|
147294
|
-
var unwrapTransportEnvelope = (req) => {
|
|
147295
|
-
const input = asNode(asNode(req)?.input);
|
|
147296
|
-
if (!input || input.type !== "http") return req;
|
|
147297
|
-
const body = input.body;
|
|
147298
|
-
const hasBody = body !== void 0 && body !== null && !(typeof body === "object" && Object.keys(body).length === 0);
|
|
147299
|
-
if (hasBody) return body;
|
|
147300
|
-
const qp = asNode(input.queryParams);
|
|
147301
|
-
if (qp && Object.keys(qp).length > 0) return qp;
|
|
147302
|
-
return null;
|
|
147303
|
-
};
|
|
147304
147387
|
var buildVerifiedExampleSection = (capability) => {
|
|
147305
147388
|
const req = capability.example?.request;
|
|
147306
147389
|
if (req === void 0 || req === null) return [];
|
|
@@ -148055,6 +148138,48 @@ var formatPayment = (payment) => {
|
|
|
148055
148138
|
const mode = payment.mode ? ` (${payment.mode})` : "";
|
|
148056
148139
|
return `${payment.protocol}${chain2}${mode}`;
|
|
148057
148140
|
};
|
|
148141
|
+
var formatDetail = (r2) => {
|
|
148142
|
+
const lines = [];
|
|
148143
|
+
const when = r2.createdAt.toISOString().replace("T", " ").slice(0, 19);
|
|
148144
|
+
lines.push(`Run: ${r2.runId}`);
|
|
148145
|
+
lines.push(`When: ${when}`);
|
|
148146
|
+
lines.push(`Status: ${r2.status ?? "\u2014"}`);
|
|
148147
|
+
lines.push(`Latency: ${r2.latencyMs != null ? `${r2.latencyMs}ms` : "\u2014"}`);
|
|
148148
|
+
lines.push(`Result: ${r2.errorClass ?? "\u2014"}`);
|
|
148149
|
+
lines.push(`Reviewed: ${r2.reviewed ? "yes" : "no"}`);
|
|
148150
|
+
lines.push("");
|
|
148151
|
+
lines.push(`Capability: ${r2.capability.name} (${r2.capability.slug})`);
|
|
148152
|
+
lines.push(`URL: ${r2.capability.method} ${r2.capability.url}`);
|
|
148153
|
+
if (r2.capability.whatItDoes)
|
|
148154
|
+
lines.push(`What: ${r2.capability.whatItDoes}`);
|
|
148155
|
+
if (r2.capability.tags.length > 0)
|
|
148156
|
+
lines.push(`Tags: ${r2.capability.tags.join(", ")}`);
|
|
148157
|
+
if (r2.cost) {
|
|
148158
|
+
const { amount: amount2, asset } = r2.cost;
|
|
148159
|
+
lines.push(`Cost: ${asset ? `${amount2} ${asset}` : amount2}`);
|
|
148160
|
+
}
|
|
148161
|
+
if (r2.payment) {
|
|
148162
|
+
const chain2 = r2.payment.chain ? `:${r2.payment.chain}` : "";
|
|
148163
|
+
const mode = r2.payment.mode ? ` (${r2.payment.mode})` : "";
|
|
148164
|
+
const tx = r2.payment.txHash ? ` tx=${r2.payment.txHash}` : "";
|
|
148165
|
+
lines.push(`Payment: ${r2.payment.protocol}${chain2}${mode}${tx}`);
|
|
148166
|
+
}
|
|
148167
|
+
return lines.join("\n");
|
|
148168
|
+
};
|
|
148169
|
+
var runsDetailCommand = (appContext) => new Command("detail").description("Show full metadata for a single run").argument("<runId>", "Run ID (run_\u2026)").option("--json", "Output raw JSON to stdout").action(async (runId, options) => {
|
|
148170
|
+
try {
|
|
148171
|
+
const { client } = appContext.services;
|
|
148172
|
+
const run = await client.runs.get(runId);
|
|
148173
|
+
if (options.json) {
|
|
148174
|
+
console.log(JSON.stringify(run, null, 2));
|
|
148175
|
+
return;
|
|
148176
|
+
}
|
|
148177
|
+
console.log(formatDetail(run));
|
|
148178
|
+
} catch (err) {
|
|
148179
|
+
console.error(err instanceof Error ? err.message : "Failed");
|
|
148180
|
+
process.exitCode = 1;
|
|
148181
|
+
}
|
|
148182
|
+
});
|
|
148058
148183
|
var runsCommand = (appContext) => new Command("runs").description("List your recent capability runs").addHelpText(
|
|
148059
148184
|
"after",
|
|
148060
148185
|
`
|
|
@@ -148065,8 +148190,9 @@ Examples:
|
|
|
148065
148190
|
zero runs # most recent runs
|
|
148066
148191
|
zero runs --unreviewed # filter to runs without a review
|
|
148067
148192
|
zero runs --capability translate-en # filter to one capability (uid or slug)
|
|
148068
|
-
zero runs --json # full structured output for scripts
|
|
148069
|
-
|
|
148193
|
+
zero runs --json # full structured output for scripts
|
|
148194
|
+
zero runs detail <runId> # full metadata for a single run`
|
|
148195
|
+
).addCommand(runsDetailCommand(appContext)).option("--capability <id>", "Filter by capability uid or slug").option("--unreviewed", "Only show runs without a review").option(
|
|
148070
148196
|
"--limit <n>",
|
|
148071
148197
|
"Max rows (1-100, default 25)",
|
|
148072
148198
|
(v) => Number.parseInt(v, 10)
|