@zeroxyz/cli 1.30.0 → 1.32.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 +337 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -93043,7 +93043,7 @@ init_esm_shims();
|
|
|
93043
93043
|
// ../sdk/dist/index.js
|
|
93044
93044
|
init_esm_shims();
|
|
93045
93045
|
|
|
93046
|
-
// ../sdk/dist/chunk-
|
|
93046
|
+
// ../sdk/dist/chunk-4H5K6DCA.js
|
|
93047
93047
|
init_esm_shims();
|
|
93048
93048
|
|
|
93049
93049
|
// ../../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
|
|
@@ -166839,7 +166839,7 @@ var redactUrl = (raw) => {
|
|
|
166839
166839
|
};
|
|
166840
166840
|
var truncateError = (raw) => raw.length > ERROR_MAX ? `${raw.slice(0, ERROR_MAX)}\u2026` : raw;
|
|
166841
166841
|
var package_default = {
|
|
166842
|
-
version: "0.
|
|
166842
|
+
version: "0.25.0"
|
|
166843
166843
|
};
|
|
166844
166844
|
var SDK_VERSION2 = package_default.version;
|
|
166845
166845
|
var ZeroError = class extends Error {
|
|
@@ -167352,12 +167352,12 @@ var request2 = async (client, opts, schema) => {
|
|
|
167352
167352
|
}
|
|
167353
167353
|
continue;
|
|
167354
167354
|
}
|
|
167355
|
-
const
|
|
167355
|
+
const errorBody2 = await parseErrorBody(response);
|
|
167356
167356
|
const requestId = response.headers.get("x-request-id") ?? void 0;
|
|
167357
|
-
throw new ZeroApiError(errorMessageFromBody(
|
|
167357
|
+
throw new ZeroApiError(errorMessageFromBody(errorBody2, response.status), {
|
|
167358
167358
|
status: response.status,
|
|
167359
167359
|
requestId,
|
|
167360
|
-
body:
|
|
167360
|
+
body: errorBody2
|
|
167361
167361
|
});
|
|
167362
167362
|
}
|
|
167363
167363
|
throw new ZeroApiError("Exhausted retries", {
|
|
@@ -169257,6 +169257,31 @@ var redactUrl2 = (url4) => {
|
|
|
169257
169257
|
return "<invalid url>";
|
|
169258
169258
|
}
|
|
169259
169259
|
};
|
|
169260
|
+
var sameEndpointUrl = (a, b) => {
|
|
169261
|
+
try {
|
|
169262
|
+
const ua = new URL(a);
|
|
169263
|
+
const ub = new URL(b);
|
|
169264
|
+
if (ua.origin !== ub.origin || ua.pathname !== ub.pathname) return false;
|
|
169265
|
+
ua.searchParams.sort();
|
|
169266
|
+
ub.searchParams.sort();
|
|
169267
|
+
return ua.searchParams.toString() === ub.searchParams.toString();
|
|
169268
|
+
} catch {
|
|
169269
|
+
return false;
|
|
169270
|
+
}
|
|
169271
|
+
};
|
|
169272
|
+
var pickResolvedCapability = (response, requestUrl) => {
|
|
169273
|
+
if (!response) return null;
|
|
169274
|
+
if ("capabilityId" in response) return response;
|
|
169275
|
+
const hits = response.candidates.filter(
|
|
169276
|
+
(c) => sameEndpointUrl(c.url, requestUrl)
|
|
169277
|
+
);
|
|
169278
|
+
const only = hits.length === 1 ? hits[0] : void 0;
|
|
169279
|
+
return only ? {
|
|
169280
|
+
capabilityId: only.capabilityId,
|
|
169281
|
+
capabilitySlug: only.capabilitySlug,
|
|
169282
|
+
matchedVia: "exact"
|
|
169283
|
+
} : null;
|
|
169284
|
+
};
|
|
169260
169285
|
var ECHO_DETECT_MIN_LEN = 16;
|
|
169261
169286
|
var ECHO_DETECT_MAX_SCAN = 64 * 1024;
|
|
169262
169287
|
var requestBodyEchoed = (candidate, requestBody) => {
|
|
@@ -169718,6 +169743,12 @@ var withDefaultContentType = (headers, body) => {
|
|
|
169718
169743
|
}
|
|
169719
169744
|
return next;
|
|
169720
169745
|
};
|
|
169746
|
+
var withDefaultUserAgent = (headers) => {
|
|
169747
|
+
const next = headers ? { ...headers } : {};
|
|
169748
|
+
const hasUa = Object.keys(next).some((k) => k.toLowerCase() === "user-agent");
|
|
169749
|
+
if (!hasUa) next["user-agent"] = `zero-sdk/${SDK_VERSION2}`;
|
|
169750
|
+
return next;
|
|
169751
|
+
};
|
|
169721
169752
|
var clientFetch = async (client, url4, opts = {}, diagnostics) => {
|
|
169722
169753
|
const startedAt = Date.now();
|
|
169723
169754
|
const fetchId = diagnostics.fetchId;
|
|
@@ -169735,7 +169766,9 @@ var clientFetch = async (client, url4, opts = {}, diagnostics) => {
|
|
|
169735
169766
|
);
|
|
169736
169767
|
const resolvePromise = !capabilityIdRequested && canRecordForResolve ? diagnostics.measure(
|
|
169737
169768
|
"resolve_target",
|
|
169738
|
-
() => client.capabilities.resolveByUrl(redactUrl2(requestUrl), method
|
|
169769
|
+
() => client.capabilities.resolveByUrl(redactUrl2(requestUrl), method, {
|
|
169770
|
+
candidates: true
|
|
169771
|
+
}).then((r) => pickResolvedCapability(r, requestUrl))
|
|
169739
169772
|
).catch(() => {
|
|
169740
169773
|
diagnostics.issue(
|
|
169741
169774
|
"resolve_target",
|
|
@@ -169743,7 +169776,9 @@ var clientFetch = async (client, url4, opts = {}, diagnostics) => {
|
|
|
169743
169776
|
);
|
|
169744
169777
|
return null;
|
|
169745
169778
|
}) : Promise.resolve(null);
|
|
169746
|
-
const probeHeaders =
|
|
169779
|
+
const probeHeaders = withDefaultUserAgent(
|
|
169780
|
+
withDefaultContentType(opts.headers, requestBody)
|
|
169781
|
+
);
|
|
169747
169782
|
const requestInit = {
|
|
169748
169783
|
method,
|
|
169749
169784
|
headers: probeHeaders,
|
|
@@ -169823,7 +169858,9 @@ var clientFetch = async (client, url4, opts = {}, diagnostics) => {
|
|
|
169823
169858
|
// Fresh clone for the paid retry — same rationale as
|
|
169824
169859
|
// the probe-side clone above. Re-derives the default
|
|
169825
169860
|
// Content-Type so the paid leg matches the probe.
|
|
169826
|
-
headers:
|
|
169861
|
+
headers: withDefaultUserAgent(
|
|
169862
|
+
withDefaultContentType(opts.headers, requestBody)
|
|
169863
|
+
),
|
|
169827
169864
|
body: requestBody,
|
|
169828
169865
|
maxPay: opts.maxPay,
|
|
169829
169866
|
account: opts.account,
|
|
@@ -170253,6 +170290,214 @@ var clientFetch = async (client, url4, opts = {}, diagnostics) => {
|
|
|
170253
170290
|
result.capabilityResolution = capabilityResolution;
|
|
170254
170291
|
return result;
|
|
170255
170292
|
};
|
|
170293
|
+
var usdAmountSchema = external_exports3.string().regex(/^\d+(?:\.\d{1,6})?$/, "Expected a decimal USD amount");
|
|
170294
|
+
var creditPurchaseSchema = external_exports3.object({
|
|
170295
|
+
url: external_exports3.string().url(),
|
|
170296
|
+
amountRequired: external_exports3.literal(true),
|
|
170297
|
+
minimumUsd: usdAmountSchema
|
|
170298
|
+
});
|
|
170299
|
+
var storefrontPlanSchema = external_exports3.object({
|
|
170300
|
+
id: external_exports3.string().min(1),
|
|
170301
|
+
name: external_exports3.string().min(1),
|
|
170302
|
+
slug: external_exports3.string().min(1),
|
|
170303
|
+
billingMode: external_exports3.string().min(1),
|
|
170304
|
+
purchase: creditPurchaseSchema.nullable()
|
|
170305
|
+
});
|
|
170306
|
+
var storefrontManifestSchema = external_exports3.object({
|
|
170307
|
+
seller: external_exports3.object({
|
|
170308
|
+
id: external_exports3.string().min(1),
|
|
170309
|
+
name: external_exports3.string().min(1),
|
|
170310
|
+
slug: external_exports3.string().min(1)
|
|
170311
|
+
}),
|
|
170312
|
+
plans: external_exports3.array(storefrontPlanSchema)
|
|
170313
|
+
});
|
|
170314
|
+
var USD_MICROS = 1000000n;
|
|
170315
|
+
var CENT_MICROS = 10000n;
|
|
170316
|
+
var parseUsdMicros = (amount2) => {
|
|
170317
|
+
if (!/^\d+(?:\.\d{1,6})?$/.test(amount2)) {
|
|
170318
|
+
throw new ZeroValidationError(
|
|
170319
|
+
"Credit purchase amount must be a positive decimal with at most 6 fractional digits."
|
|
170320
|
+
);
|
|
170321
|
+
}
|
|
170322
|
+
const [whole = "0", fraction = ""] = amount2.split(".");
|
|
170323
|
+
return BigInt(whole) * USD_MICROS + BigInt(fraction.padEnd(6, "0"));
|
|
170324
|
+
};
|
|
170325
|
+
var formatUsdMicros = (amount2) => {
|
|
170326
|
+
const whole = amount2 / USD_MICROS;
|
|
170327
|
+
const fraction = (amount2 % USD_MICROS).toString().padStart(6, "0");
|
|
170328
|
+
return `${whole}.${fraction}`;
|
|
170329
|
+
};
|
|
170330
|
+
var resourceOrigin = (resourceUrl) => {
|
|
170331
|
+
let parsed;
|
|
170332
|
+
try {
|
|
170333
|
+
parsed = new URL(resourceUrl);
|
|
170334
|
+
} catch (cause) {
|
|
170335
|
+
throw new ZeroValidationError(
|
|
170336
|
+
"Credit access requires a valid resource URL.",
|
|
170337
|
+
{
|
|
170338
|
+
cause
|
|
170339
|
+
}
|
|
170340
|
+
);
|
|
170341
|
+
}
|
|
170342
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
170343
|
+
throw new ZeroValidationError(
|
|
170344
|
+
"Credit access only supports HTTP or HTTPS resources."
|
|
170345
|
+
);
|
|
170346
|
+
}
|
|
170347
|
+
return parsed.origin;
|
|
170348
|
+
};
|
|
170349
|
+
var errorBody = async (response) => {
|
|
170350
|
+
const text = await response.text().catch(() => "");
|
|
170351
|
+
try {
|
|
170352
|
+
return JSON.parse(text);
|
|
170353
|
+
} catch {
|
|
170354
|
+
return text || null;
|
|
170355
|
+
}
|
|
170356
|
+
};
|
|
170357
|
+
var Access = class {
|
|
170358
|
+
constructor(client) {
|
|
170359
|
+
this.client = client;
|
|
170360
|
+
}
|
|
170361
|
+
discoverCreditPlans = async (resourceUrl, opts = {}) => {
|
|
170362
|
+
const origin2 = resourceOrigin(resourceUrl);
|
|
170363
|
+
const manifestUrl = new URL("/manifest.json", origin2).href;
|
|
170364
|
+
let response;
|
|
170365
|
+
try {
|
|
170366
|
+
response = await this.client.fetchImpl(manifestUrl, {
|
|
170367
|
+
headers: { accept: "application/json" },
|
|
170368
|
+
signal: opts.signal
|
|
170369
|
+
});
|
|
170370
|
+
} catch (cause) {
|
|
170371
|
+
throw new ZeroApiError("Seller manifest request failed", {
|
|
170372
|
+
status: 0,
|
|
170373
|
+
cause
|
|
170374
|
+
});
|
|
170375
|
+
}
|
|
170376
|
+
if (!response.ok) {
|
|
170377
|
+
throw new ZeroApiError("Seller manifest request failed", {
|
|
170378
|
+
status: response.status,
|
|
170379
|
+
body: await errorBody(response)
|
|
170380
|
+
});
|
|
170381
|
+
}
|
|
170382
|
+
const text = await response.text();
|
|
170383
|
+
let json3;
|
|
170384
|
+
try {
|
|
170385
|
+
json3 = JSON.parse(text);
|
|
170386
|
+
} catch (cause) {
|
|
170387
|
+
throw new ZeroValidationError(
|
|
170388
|
+
"Seller manifest did not contain valid JSON.",
|
|
170389
|
+
{ cause, body: text }
|
|
170390
|
+
);
|
|
170391
|
+
}
|
|
170392
|
+
const parsed = storefrontManifestSchema.safeParse(json3);
|
|
170393
|
+
if (!parsed.success) {
|
|
170394
|
+
throw new ZeroValidationError(
|
|
170395
|
+
"Seller manifest did not match the expected access schema.",
|
|
170396
|
+
{ cause: parsed.error, body: text }
|
|
170397
|
+
);
|
|
170398
|
+
}
|
|
170399
|
+
const creditPlans = [];
|
|
170400
|
+
for (const plan of parsed.data.plans) {
|
|
170401
|
+
if (plan.billingMode !== "credit" || !plan.purchase) continue;
|
|
170402
|
+
const purchaseUrl = new URL(plan.purchase.url);
|
|
170403
|
+
if (purchaseUrl.origin !== origin2) {
|
|
170404
|
+
throw new ZeroValidationError(
|
|
170405
|
+
"Seller manifest advertised a cross-origin credit purchase URL."
|
|
170406
|
+
);
|
|
170407
|
+
}
|
|
170408
|
+
creditPlans.push({
|
|
170409
|
+
id: plan.id,
|
|
170410
|
+
name: plan.name,
|
|
170411
|
+
slug: plan.slug,
|
|
170412
|
+
minimumUsd: formatUsdMicros(parseUsdMicros(plan.purchase.minimumUsd))
|
|
170413
|
+
});
|
|
170414
|
+
}
|
|
170415
|
+
return {
|
|
170416
|
+
resourceOrigin: origin2,
|
|
170417
|
+
seller: parsed.data.seller,
|
|
170418
|
+
onlyCreditPlans: parsed.data.plans.length > 0 && parsed.data.plans.every((plan) => plan.billingMode === "credit"),
|
|
170419
|
+
plans: creditPlans
|
|
170420
|
+
};
|
|
170421
|
+
};
|
|
170422
|
+
prepareCreditPurchase = async (input) => {
|
|
170423
|
+
const discovery = await this.discoverCreditPlans(input.resourceUrl, {
|
|
170424
|
+
signal: input.signal
|
|
170425
|
+
});
|
|
170426
|
+
const plan = discovery.plans.find(
|
|
170427
|
+
(candidate) => candidate.id === input.planId
|
|
170428
|
+
);
|
|
170429
|
+
if (!plan) {
|
|
170430
|
+
throw new ZeroValidationError(
|
|
170431
|
+
"The requested credit plan is not purchasable in the seller's current manifest."
|
|
170432
|
+
);
|
|
170433
|
+
}
|
|
170434
|
+
const amount2 = parseUsdMicros(input.amountUsd);
|
|
170435
|
+
const minimum = parseUsdMicros(plan.minimumUsd);
|
|
170436
|
+
if (amount2 <= 0n || amount2 < minimum) {
|
|
170437
|
+
throw new ZeroValidationError(
|
|
170438
|
+
`Credit purchase amount must be at least $${plan.minimumUsd}.`
|
|
170439
|
+
);
|
|
170440
|
+
}
|
|
170441
|
+
if (amount2 % CENT_MICROS !== 0n) {
|
|
170442
|
+
throw new ZeroValidationError(
|
|
170443
|
+
"Credit purchase amount must be in whole-cent increments."
|
|
170444
|
+
);
|
|
170445
|
+
}
|
|
170446
|
+
const manifest = storefrontManifestSchema.parse(
|
|
170447
|
+
await this.fetchManifest(discovery.resourceOrigin, input.signal)
|
|
170448
|
+
);
|
|
170449
|
+
const current = manifest.plans.find(
|
|
170450
|
+
(candidate) => candidate.id === input.planId && candidate.billingMode === "credit"
|
|
170451
|
+
);
|
|
170452
|
+
if (!current?.purchase) {
|
|
170453
|
+
throw new ZeroValidationError(
|
|
170454
|
+
"The requested credit plan is no longer purchasable."
|
|
170455
|
+
);
|
|
170456
|
+
}
|
|
170457
|
+
const currentMinimum = parseUsdMicros(current.purchase.minimumUsd);
|
|
170458
|
+
if (amount2 < currentMinimum) {
|
|
170459
|
+
throw new ZeroValidationError(
|
|
170460
|
+
`Credit purchase amount must be at least $${formatUsdMicros(currentMinimum)}.`
|
|
170461
|
+
);
|
|
170462
|
+
}
|
|
170463
|
+
const purchaseUrl = new URL(current.purchase.url);
|
|
170464
|
+
if (purchaseUrl.origin !== discovery.resourceOrigin) {
|
|
170465
|
+
throw new ZeroValidationError(
|
|
170466
|
+
"Seller manifest advertised a cross-origin credit purchase URL."
|
|
170467
|
+
);
|
|
170468
|
+
}
|
|
170469
|
+
const amountUsd = formatUsdMicros(amount2);
|
|
170470
|
+
return {
|
|
170471
|
+
resourceOrigin: discovery.resourceOrigin,
|
|
170472
|
+
plan: {
|
|
170473
|
+
id: current.id,
|
|
170474
|
+
name: current.name,
|
|
170475
|
+
slug: current.slug,
|
|
170476
|
+
minimumUsd: formatUsdMicros(currentMinimum)
|
|
170477
|
+
},
|
|
170478
|
+
url: purchaseUrl.href,
|
|
170479
|
+
method: "POST",
|
|
170480
|
+
body: JSON.stringify({ amountUsd }),
|
|
170481
|
+
amountUsd
|
|
170482
|
+
};
|
|
170483
|
+
};
|
|
170484
|
+
fetchManifest = async (origin2, signal) => {
|
|
170485
|
+
const response = await this.client.fetchImpl(
|
|
170486
|
+
new URL("/manifest.json", origin2),
|
|
170487
|
+
{
|
|
170488
|
+
headers: { accept: "application/json" },
|
|
170489
|
+
signal
|
|
170490
|
+
}
|
|
170491
|
+
);
|
|
170492
|
+
if (!response.ok) {
|
|
170493
|
+
throw new ZeroApiError("Seller manifest request failed", {
|
|
170494
|
+
status: response.status,
|
|
170495
|
+
body: await errorBody(response)
|
|
170496
|
+
});
|
|
170497
|
+
}
|
|
170498
|
+
return response.json();
|
|
170499
|
+
};
|
|
170500
|
+
};
|
|
170256
170501
|
var agentAuthMetadataSchema = external_exports3.object({
|
|
170257
170502
|
token_endpoint: external_exports3.string().optional(),
|
|
170258
170503
|
agent_auth: external_exports3.object({
|
|
@@ -171312,11 +171557,23 @@ var capabilityResponseSchema = external_exports3.object({
|
|
|
171312
171557
|
lastUsedAt: external_exports3.string().nullable().optional(),
|
|
171313
171558
|
lastSuccessfullyRanAt: external_exports3.string().nullable().optional()
|
|
171314
171559
|
});
|
|
171315
|
-
var resolveCapabilityResponseSchema = external_exports3.
|
|
171316
|
-
|
|
171317
|
-
|
|
171318
|
-
|
|
171319
|
-
|
|
171560
|
+
var resolveCapabilityResponseSchema = external_exports3.union([
|
|
171561
|
+
external_exports3.object({
|
|
171562
|
+
capabilityId: external_exports3.string(),
|
|
171563
|
+
capabilitySlug: external_exports3.string(),
|
|
171564
|
+
matchedVia: external_exports3.enum(["exact", "template"])
|
|
171565
|
+
}),
|
|
171566
|
+
external_exports3.object({
|
|
171567
|
+
candidates: external_exports3.array(
|
|
171568
|
+
external_exports3.object({
|
|
171569
|
+
capabilityId: external_exports3.string(),
|
|
171570
|
+
capabilitySlug: external_exports3.string(),
|
|
171571
|
+
url: external_exports3.string()
|
|
171572
|
+
})
|
|
171573
|
+
)
|
|
171574
|
+
})
|
|
171575
|
+
]);
|
|
171576
|
+
var isResolvedCapability = (response) => response !== null && "capabilityId" in response;
|
|
171320
171577
|
var Capabilities = class {
|
|
171321
171578
|
constructor(client) {
|
|
171322
171579
|
this.client = client;
|
|
@@ -171339,6 +171596,14 @@ var Capabilities = class {
|
|
|
171339
171596
|
// The URL travels in the POST body so it stays out of access logs and is
|
|
171340
171597
|
// never stored; the caller uses the returned capabilityId to record an
|
|
171341
171598
|
// attributed run without the URL ever touching the run row (ZERO-335).
|
|
171599
|
+
//
|
|
171600
|
+
// `candidates: true` additionally asks the server for the capabilities that
|
|
171601
|
+
// share this origin + path and differ only by query string. Callers redact
|
|
171602
|
+
// the query before sending (it can carry credentials), which is ambiguous
|
|
171603
|
+
// once a required query param is baked into a capability's url to make it
|
|
171604
|
+
// callable — ten Dappier publisher models share `/zeroclick/v2/search`
|
|
171605
|
+
// (ZERO-942). The server can't choose; the caller still holds the full URL,
|
|
171606
|
+
// so it picks locally. Leave the flag off and the behavior is unchanged.
|
|
171342
171607
|
resolveByUrl = async (url4, method, opts = {}) => {
|
|
171343
171608
|
try {
|
|
171344
171609
|
return await request2(
|
|
@@ -171346,7 +171611,7 @@ var Capabilities = class {
|
|
|
171346
171611
|
{
|
|
171347
171612
|
method: "POST",
|
|
171348
171613
|
path: "/v1/capabilities/resolve",
|
|
171349
|
-
body: { url: url4, method },
|
|
171614
|
+
body: opts.candidates ? { url: url4, method, candidates: true } : { url: url4, method },
|
|
171350
171615
|
signal: opts.signal
|
|
171351
171616
|
},
|
|
171352
171617
|
resolveCapabilityResponseSchema
|
|
@@ -172275,6 +172540,7 @@ var ZeroClient = class _ZeroClient {
|
|
|
172275
172540
|
// is called. Lazy getters would tree-shake better but break the discoverable
|
|
172276
172541
|
// `client.<tab>` ergonomics that make resource-namespaced SDKs pleasant.
|
|
172277
172542
|
auth;
|
|
172543
|
+
access;
|
|
172278
172544
|
bugReports;
|
|
172279
172545
|
capabilities;
|
|
172280
172546
|
payments;
|
|
@@ -172297,6 +172563,7 @@ var ZeroClient = class _ZeroClient {
|
|
|
172297
172563
|
this.analyticsOptions = options.analytics;
|
|
172298
172564
|
this.refreshOverride = options.refresh;
|
|
172299
172565
|
this.withAccountCache = options._sharedAccountCache ?? /* @__PURE__ */ new Map();
|
|
172566
|
+
this.access = new Access(this);
|
|
172300
172567
|
this.auth = new Auth(this);
|
|
172301
172568
|
this.bugReports = new BugReports(this);
|
|
172302
172569
|
this.capabilities = new Capabilities(this);
|
|
@@ -176369,7 +176636,51 @@ var placeholderFor = (fieldName, propSchema) => String(sampleValueFor(fieldName,
|
|
|
176369
176636
|
|
|
176370
176637
|
// package.json
|
|
176371
176638
|
var package_default2 = {
|
|
176372
|
-
|
|
176639
|
+
name: "@zeroxyz/cli",
|
|
176640
|
+
version: "1.32.0",
|
|
176641
|
+
type: "module",
|
|
176642
|
+
bin: {
|
|
176643
|
+
zero: "dist/index.js",
|
|
176644
|
+
zerocli: "dist/index.js"
|
|
176645
|
+
},
|
|
176646
|
+
files: [
|
|
176647
|
+
"dist"
|
|
176648
|
+
],
|
|
176649
|
+
publishConfig: {
|
|
176650
|
+
access: "public"
|
|
176651
|
+
},
|
|
176652
|
+
scripts: {
|
|
176653
|
+
build: "tsup",
|
|
176654
|
+
"build:binary": "tsup --config tsup.binary.ts && pnpm exec pkg dist/pkg/index.cjs --config pkg.json --targets node24-macos-arm64,node24-macos-x64,node24-linux-x64,node24-linux-arm64,node24-win-x64 --output dist/bin/zero",
|
|
176655
|
+
prepublishOnly: "pnpm run build",
|
|
176656
|
+
dev: "ZERO_ENV=development tsx src/index.ts",
|
|
176657
|
+
cli: "ZERO_ENV=development ZERO_API_URL=http://localhost:1111 tsx src/index.ts",
|
|
176658
|
+
"test:integration": "vitest run --project integration",
|
|
176659
|
+
"test:e2e": "tsup && vitest run --project e2e",
|
|
176660
|
+
"test:online": "vitest run --project online",
|
|
176661
|
+
"test:unit": "vitest run --project unit",
|
|
176662
|
+
test: "pnpm run test:unit && pnpm run test:integration",
|
|
176663
|
+
typecheck: "tsc"
|
|
176664
|
+
},
|
|
176665
|
+
devDependencies: {
|
|
176666
|
+
"@clack/prompts": "^0.11.0",
|
|
176667
|
+
"@types/node": "^25.0.7",
|
|
176668
|
+
"@types/semver": "^7.7.1",
|
|
176669
|
+
"@yao-pkg/pkg": "^6.15.0",
|
|
176670
|
+
"@zero/test-fixtures": "workspace:*",
|
|
176671
|
+
"@zeroxyz/sdk": "workspace:^",
|
|
176672
|
+
commander: "^13.0.0",
|
|
176673
|
+
open: "^11.0.0",
|
|
176674
|
+
"posthog-node": "^5.29.2",
|
|
176675
|
+
semver: "^7.8.5",
|
|
176676
|
+
tsup: "^8.5.1",
|
|
176677
|
+
tsx: "^4.21.0",
|
|
176678
|
+
typescript: "^5.9.3",
|
|
176679
|
+
viem: "^2.47.10",
|
|
176680
|
+
vitest: "^4.0.17",
|
|
176681
|
+
zod: "^4.3.5"
|
|
176682
|
+
}
|
|
176683
|
+
};
|
|
176373
176684
|
|
|
176374
176685
|
// src/app.ts
|
|
176375
176686
|
init_esm_shims();
|
|
@@ -178626,12 +178937,20 @@ var fetchCommand = (appContext) => new Command("fetch").description(
|
|
|
178626
178937
|
process.exitCode = 1;
|
|
178627
178938
|
return;
|
|
178628
178939
|
}
|
|
178629
|
-
const headers = {
|
|
178940
|
+
const headers = {
|
|
178941
|
+
"user-agent": `zero-cli/${package_default2.version}`
|
|
178942
|
+
};
|
|
178630
178943
|
if (options.header) {
|
|
178631
178944
|
for (const h of options.header) {
|
|
178632
178945
|
const colonIdx = h.indexOf(":");
|
|
178633
178946
|
if (colonIdx > 0) {
|
|
178634
|
-
|
|
178947
|
+
const name = h.slice(0, colonIdx).trim();
|
|
178948
|
+
for (const existing of Object.keys(headers)) {
|
|
178949
|
+
if (existing !== name && existing.toLowerCase() === name.toLowerCase()) {
|
|
178950
|
+
delete headers[existing];
|
|
178951
|
+
}
|
|
178952
|
+
}
|
|
178953
|
+
headers[name] = h.slice(colonIdx + 1).trim();
|
|
178635
178954
|
}
|
|
178636
178955
|
}
|
|
178637
178956
|
}
|
|
@@ -179358,7 +179677,7 @@ var getCommand = (appContext) => new Command("get").description("Get details for
|
|
|
179358
179677
|
identifier,
|
|
179359
179678
|
method
|
|
179360
179679
|
);
|
|
179361
|
-
if (resolved) {
|
|
179680
|
+
if (isResolvedCapability(resolved)) {
|
|
179362
179681
|
matches2.set(resolved.capabilityId, resolved.capabilitySlug);
|
|
179363
179682
|
}
|
|
179364
179683
|
}
|