@zeroxyz/cli 1.17.0 → 1.19.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.
Files changed (2) hide show
  1. package/dist/index.js +304 -67
  2. 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-T77VVLOM.js
78452
+ // ../sdk/dist/chunk-CYB4Y3ID.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,37 +143831,41 @@ 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-T77VVLOM.js
143835
- var createManagedAccount = (client, address2) => toAccount({
143836
- address: address2,
143837
- async signMessage({ message: message2 }) {
143838
- return await client.auth.signMessage(
143839
- { message: message2 },
143840
- { expectedAddress: address2 }
143841
- );
143842
- },
143843
- async signTypedData(typedData) {
143844
- const td = typedData;
143845
- return await client.auth.signTypedData(
143846
- {
143847
- domain: td.domain,
143848
- types: td.types,
143849
- primaryType: td.primaryType,
143850
- message: td.message
143851
- },
143852
- { expectedAddress: address2 }
143853
- );
143854
- },
143855
- async signTransaction(transaction, options) {
143856
- const serialize13 = options?.serializer ?? serializeTransaction;
143857
- const unsigned = await serialize13(transaction);
143858
- const signature2 = await client.auth.signTransaction(
143859
- { unsignedTransaction: unsigned },
143860
- { expectedAddress: address2 }
143861
- );
143862
- return await serialize13(transaction, parseSignature2(signature2));
143863
- }
143864
- });
143834
+ // ../sdk/dist/chunk-CYB4Y3ID.js
143835
+ var createManagedAccount = (client, address2, opts = {}) => {
143836
+ const signOptions = {
143837
+ // expectedAddress pins verification to this adapter's frozen address.
143838
+ expectedAddress: address2,
143839
+ ...opts.explicitWallet ? { walletAddress: address2 } : {}
143840
+ };
143841
+ return toAccount({
143842
+ address: address2,
143843
+ async signMessage({ message: message2 }) {
143844
+ return await client.auth.signMessage({ message: message2 }, signOptions);
143845
+ },
143846
+ async signTypedData(typedData) {
143847
+ const td = typedData;
143848
+ return await client.auth.signTypedData(
143849
+ {
143850
+ domain: td.domain,
143851
+ types: td.types,
143852
+ primaryType: td.primaryType,
143853
+ message: td.message
143854
+ },
143855
+ signOptions
143856
+ );
143857
+ },
143858
+ async signTransaction(transaction, options) {
143859
+ const serialize13 = options?.serializer ?? serializeTransaction;
143860
+ const unsigned = await serialize13(transaction);
143861
+ const signature2 = await client.auth.signTransaction(
143862
+ { unsignedTransaction: unsigned },
143863
+ signOptions
143864
+ );
143865
+ return await serialize13(transaction, parseSignature2(signature2));
143866
+ }
143867
+ });
143868
+ };
143865
143869
  var USDC_BASE = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
143866
143870
  var USDC_TEMPO = "0x20c000000000000000000000b9537d11c60e8b50";
143867
143871
  var TEMPO_CHAIN_ID = 4217;
@@ -144000,16 +144004,6 @@ var extractInputEnvelope = (bodySchema, method) => {
144000
144004
  const isGetLike = upperMethod === "GET" || upperMethod === "DELETE";
144001
144005
  return isGetLike ? { queryParams: root } : { body: root };
144002
144006
  };
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
144007
  var GET_LIKE = /* @__PURE__ */ new Set(["GET", "HEAD", "DELETE"]);
144014
144008
  var appendQueryParams = (url4, params) => {
144015
144009
  const entries = Object.entries(params).filter(([, v]) => v != null);
@@ -144398,6 +144392,7 @@ var pickSessionCloseAmount = (receipt, openTimeCumulative) => {
144398
144392
  if (receipt.metered === true) return fromReceipt;
144399
144393
  return fromReceipt > openTimeCumulative ? fromReceipt : openTimeCumulative;
144400
144394
  };
144395
+ var isMeteredZeroReceipt = (receipt) => receipt?.metered === true && BigInt(receipt.acceptedCumulative) === 0n && BigInt(receipt.spent) === 0n;
144401
144396
  var raceWithSignal = (p, signal, client) => {
144402
144397
  if (!signal) return p;
144403
144398
  if (signal.aborted) {
@@ -144447,12 +144442,12 @@ var cancelBody = (response) => {
144447
144442
  } catch {
144448
144443
  }
144449
144444
  };
144450
- var resolveAccount = async (client, overrideAccount, signal) => {
144445
+ var resolveAccount = async (client, overrideAccount, signal, walletAddress) => {
144451
144446
  if (overrideAccount) return overrideAccount;
144452
144447
  const credentials = client.getCredentials();
144453
144448
  if (credentials.kind === "account") return credentials.account;
144454
144449
  if (credentials.kind === "session") {
144455
- return await client.resolveManagedAccount(signal);
144450
+ return await client.resolveManagedAccount(signal, walletAddress);
144456
144451
  }
144457
144452
  throw new ZeroAuthError(
144458
144453
  "auth_no_credentials",
@@ -144498,7 +144493,8 @@ var Payments = class {
144498
144493
  const account = await resolveAccount(
144499
144494
  this.client,
144500
144495
  input.account,
144501
- input.signal
144496
+ input.signal,
144497
+ input.walletAddress
144502
144498
  );
144503
144499
  let capturedAmount = null;
144504
144500
  let capturedNetwork;
@@ -144633,7 +144629,8 @@ var Payments = class {
144633
144629
  const account = await resolveAccount(
144634
144630
  this.client,
144635
144631
  input.account,
144636
- input.signal
144632
+ input.signal,
144633
+ input.walletAddress
144637
144634
  );
144638
144635
  const configuredFetch = buildConfiguredFetch(this.client, {
144639
144636
  timeoutMs: input.timeoutMs
@@ -144971,7 +144968,7 @@ var Payments = class {
144971
144968
  }
144972
144969
  const receipt = readSessionReceipt(response);
144973
144970
  let closeAmount = pickSessionCloseAmount(receipt, openTimeCumulative);
144974
- if (closeAmount === 0n && channelEntry.cumulativeAmount > 0n) {
144971
+ if (closeAmount === 0n && channelEntry.cumulativeAmount > 0n && !isMeteredZeroReceipt(receipt)) {
144975
144972
  closeAmount = channelEntry.cumulativeAmount;
144976
144973
  }
144977
144974
  const reconcileAmount = receipt && isUintString(receipt.acceptedCumulative) ? receipt.acceptedCumulative : closeAmount.toString();
@@ -144988,7 +144985,7 @@ var Payments = class {
144988
144985
  capturedAmount,
144989
144986
  cause
144990
144987
  });
144991
- if (closeAmount === 0n) {
144988
+ if (closeAmount === 0n && !isMeteredZeroReceipt(receipt)) {
144992
144989
  throw closeFailed(
144993
144990
  `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
144991
  );
@@ -145413,7 +145410,8 @@ var recordErrorFetchRun = async (client, opts, result, capabilityIdOverride) =>
145413
145410
  ...fetchOriginForRecord && { fetchOrigin: fetchOriginForRecord },
145414
145411
  ...result.status !== null && { status: result.status },
145415
145412
  latencyMs: result.latencyMs,
145416
- ...opts.requestSchema && { requestSchema: opts.requestSchema }
145413
+ ...opts.requestSchema && { requestSchema: opts.requestSchema },
145414
+ ...opts.walletAddress && !opts.account && { walletAddress: opts.walletAddress }
145417
145415
  });
145418
145416
  result.runId = created.runId;
145419
145417
  delete result.runTrackingSkipped;
@@ -145522,6 +145520,7 @@ var clientFetch = async (client, url4, opts = {}) => {
145522
145520
  body: requestBody,
145523
145521
  maxPay: opts.maxPay,
145524
145522
  account: opts.account,
145523
+ ...opts.walletAddress && { walletAddress: opts.walletAddress },
145525
145524
  signal: opts.signal,
145526
145525
  timeoutMs: opts.timeoutMs,
145527
145526
  ...opts.displayCostAmount && {
@@ -145694,6 +145693,10 @@ var clientFetch = async (client, url4, opts = {}) => {
145694
145693
  ...opts.capabilityId === void 0 ? { fetchOrigin: "direct_url" } : opts.fetchOrigin && { fetchOrigin: opts.fetchOrigin },
145695
145694
  status: response.status,
145696
145695
  latencyMs,
145696
+ // Attribute to the selected wallet in session mode. Skipped when a
145697
+ // per-call `account` override records the run — that account's own
145698
+ // EIP-191 identity is the attribution.
145699
+ ...opts.walletAddress && !opts.account && { walletAddress: opts.walletAddress },
145697
145700
  ...opts.requestSchema && { requestSchema: opts.requestSchema },
145698
145701
  ...derived?.responseSchema && {
145699
145702
  responseSchema: derived.responseSchema
@@ -145757,7 +145760,7 @@ var clientFetch = async (client, url4, opts = {}) => {
145757
145760
  return result;
145758
145761
  };
145759
145762
  var package_default = {
145760
- version: "0.11.0"
145763
+ version: "0.13.0"
145761
145764
  };
145762
145765
  var SDK_VERSION2 = package_default.version;
145763
145766
  var agentAuthMetadataSchema = external_exports3.object({
@@ -146242,6 +146245,9 @@ var userWalletDtoSchema = external_exports3.object({
146242
146245
  walletAddress: external_exports3.string(),
146243
146246
  source: external_exports3.enum(["self_custody", "privy_embedded"]),
146244
146247
  isPrimary: external_exports3.boolean(),
146248
+ // Owner-chosen display name; null/absent = unnamed (show the address).
146249
+ // Optional so the SDK tolerates servers that predate nicknames.
146250
+ nickname: external_exports3.string().nullable().optional(),
146245
146251
  linkedAt: external_exports3.union([external_exports3.string(), external_exports3.date()]).nullable().optional(),
146246
146252
  importedAt: external_exports3.union([external_exports3.string(), external_exports3.date()]).nullable().optional(),
146247
146253
  delegationGranted: external_exports3.boolean(),
@@ -146455,7 +146461,10 @@ var Auth = class {
146455
146461
  {
146456
146462
  method: "POST",
146457
146463
  path: "/v1/users/me/sign-message",
146458
- body: { message: normalizeMessage(input.message) }
146464
+ body: {
146465
+ message: normalizeMessage(input.message),
146466
+ ...opts.walletAddress ? { walletAddress: opts.walletAddress } : {}
146467
+ }
146459
146468
  },
146460
146469
  signResponseSchema
146461
146470
  );
@@ -146480,7 +146489,10 @@ var Auth = class {
146480
146489
  {
146481
146490
  method: "POST",
146482
146491
  path: "/v1/users/me/sign-transaction",
146483
- body: { unsignedTransaction: input.unsignedTransaction }
146492
+ body: {
146493
+ unsignedTransaction: input.unsignedTransaction,
146494
+ ...opts.walletAddress ? { walletAddress: opts.walletAddress } : {}
146495
+ }
146484
146496
  },
146485
146497
  signResponseSchema
146486
146498
  );
@@ -146519,7 +146531,10 @@ var Auth = class {
146519
146531
  {
146520
146532
  method: "POST",
146521
146533
  path: "/v1/users/me/sign-typed-data",
146522
- body: { typedData: input }
146534
+ body: {
146535
+ typedData: input,
146536
+ ...opts.walletAddress ? { walletAddress: opts.walletAddress } : {}
146537
+ }
146523
146538
  },
146524
146539
  signResponseSchema
146525
146540
  );
@@ -146636,6 +146651,12 @@ var capabilityResponseSchema = external_exports3.object({
146636
146651
  bodySchema: external_exports3.record(external_exports3.string(), external_exports3.unknown()).nullable(),
146637
146652
  responseSchema: external_exports3.record(external_exports3.string(), external_exports3.unknown()).nullable(),
146638
146653
  example: external_exports3.object({ request: external_exports3.unknown(), response: external_exports3.unknown() }).nullable(),
146654
+ // The bare, schema-validated request body to send — `.request` unwrapped
146655
+ // from the transcript envelope and checked against the current bodySchema.
146656
+ // Null when there's no usable example or it's stale vs the schema; `example`
146657
+ // is retained for the response sample. Optional for back-compat with older
146658
+ // servers that don't emit it.
146659
+ exampleRequest: external_exports3.record(external_exports3.string(), external_exports3.unknown()).nullable().optional(),
146639
146660
  tags: external_exports3.array(external_exports3.string()).nullable(),
146640
146661
  exampleAgentPrompt: external_exports3.string().nullable().optional(),
146641
146662
  whatItDoes: external_exports3.string().nullable().optional(),
@@ -146884,6 +146905,9 @@ var Runs = class {
146884
146905
  if (params.unreviewed !== void 0) query.unreviewed = params.unreviewed;
146885
146906
  if (params.limit !== void 0) query.limit = params.limit;
146886
146907
  if (params.cursor !== void 0) query.cursor = params.cursor;
146908
+ if (params.walletAddress !== void 0) {
146909
+ query.walletAddress = Array.isArray(params.walletAddress) ? params.walletAddress.join(",") : params.walletAddress;
146910
+ }
146887
146911
  return request2(
146888
146912
  this.client,
146889
146913
  {
@@ -147019,6 +147043,50 @@ var Wallet = class {
147019
147043
  },
147020
147044
  userWalletDtoSchema
147021
147045
  );
147046
+ // Re-stamp Zero's signing delegation on a profile wallet (default: the
147047
+ // primary). Session-only. Naming a wallet re-authorizes THAT wallet and
147048
+ // never provisions; the server 404s an address not on the profile.
147049
+ reauthorizeDelegation = (opts = {}) => request2(
147050
+ this.client,
147051
+ {
147052
+ method: "POST",
147053
+ path: "/v1/users/me/wallets/provision",
147054
+ ...opts.walletAddress ? { body: { walletAddress: opts.walletAddress } } : {},
147055
+ signal: opts.signal
147056
+ },
147057
+ userWalletDtoSchema
147058
+ );
147059
+ // Revoke Zero's signing delegation on a profile wallet (default: the
147060
+ // primary). Session-only. Managed signing on that wallet 403s until it is
147061
+ // re-authorized. Note: this stamps the server-side gate — removing Zero's
147062
+ // signer cryptographically is owner-authorized and happens in the user's
147063
+ // Privy session (the web profile page does both).
147064
+ revokeDelegation = (opts = {}) => request2(
147065
+ this.client,
147066
+ {
147067
+ method: "DELETE",
147068
+ path: "/v1/users/me/wallets/delegation",
147069
+ ...opts.walletAddress ? { query: { walletAddress: opts.walletAddress } } : {},
147070
+ signal: opts.signal
147071
+ },
147072
+ userWalletDtoSchema
147073
+ );
147074
+ // Set, change, or clear (null / empty string) the owner-chosen nickname on
147075
+ // a profile wallet. Session-only. Nicknames are private to the
147076
+ // authenticated user — they never appear on reviews or public surfaces.
147077
+ setNickname = (opts) => request2(
147078
+ this.client,
147079
+ {
147080
+ method: "PATCH",
147081
+ path: "/v1/users/me/wallets/nickname",
147082
+ body: {
147083
+ walletAddress: opts.walletAddress,
147084
+ nickname: opts.nickname
147085
+ },
147086
+ signal: opts.signal
147087
+ },
147088
+ userWalletDtoSchema
147089
+ );
147022
147090
  // Link an existing self-custody wallet to the session user by private key.
147023
147091
  // Session-only. 409s when the wallet is already linked (to this or another
147024
147092
  // profile — the error message says which).
@@ -147029,7 +147097,8 @@ var Wallet = class {
147029
147097
  path: "/v1/users/me/wallets/import",
147030
147098
  body: {
147031
147099
  privateKey: opts.privateKey,
147032
- ...opts.makePrimary !== void 0 ? { makePrimary: opts.makePrimary } : {}
147100
+ ...opts.makePrimary !== void 0 ? { makePrimary: opts.makePrimary } : {},
147101
+ ...opts.nickname !== void 0 ? { nickname: opts.nickname } : {}
147033
147102
  },
147034
147103
  signal: opts.signal
147035
147104
  },
@@ -147226,6 +147295,9 @@ var ZeroClient = class _ZeroClient {
147226
147295
  managedAccountInFlight = null;
147227
147296
  managedAccountAC = null;
147228
147297
  managedAccountGen = 0;
147298
+ // Explicitly-selected (non-default) managed wallets, keyed by lowercased
147299
+ // address. Same lifecycle as managedAccount: cleared on clearManagedAccount.
147300
+ managedAccountByAddress = /* @__PURE__ */ new Map();
147229
147301
  // Multi-tenant servers calling `client.fetch(url, { account: tenantAccount })`
147230
147302
  // on every request would otherwise construct a new ZeroClient (with
147231
147303
  // five namespace instances) per call. Keyed by lowercased account
@@ -147447,8 +147519,16 @@ var ZeroClient = class _ZeroClient {
147447
147519
  }
147448
147520
  this.withAccountCache.clear();
147449
147521
  };
147450
- /** @internal — used by payments.pay() in session mode. Cached, dedupes concurrent lookups. */
147451
- resolveManagedAccount = (signal) => {
147522
+ /**
147523
+ * @internal — used by payments.pay() in session mode. Cached, dedupes
147524
+ * concurrent lookups. Pass `walletAddress` to sign as a specific profile
147525
+ * wallet instead of the primary; explicit wallets are cached per address
147526
+ * and their sign requests carry the address so intent and signer agree.
147527
+ */
147528
+ resolveManagedAccount = (signal, walletAddress) => {
147529
+ if (walletAddress) {
147530
+ return this.resolveManagedAccountByAddress(walletAddress, signal);
147531
+ }
147452
147532
  if (this.managedAccount) return Promise.resolve(this.managedAccount);
147453
147533
  if (this.managedAccountInFlight) {
147454
147534
  return this.raceWithSignal(this.managedAccountInFlight, signal);
@@ -147490,6 +147570,42 @@ var ZeroClient = class _ZeroClient {
147490
147570
  });
147491
147571
  return this.raceWithSignal(this.managedAccountInFlight, signal);
147492
147572
  };
147573
+ // Explicit-wallet variant of resolveManagedAccount. No in-flight dedupe:
147574
+ // this is the rare path (per-wallet pay), the resolution is idempotent, and
147575
+ // the per-address cache absorbs repeat calls.
147576
+ resolveManagedAccountByAddress = async (walletAddress, signal) => {
147577
+ if (this.credentials.kind !== "session") {
147578
+ throw new ZeroAuthError(
147579
+ "auth_no_credentials",
147580
+ "resolveManagedAccount() requires session credentials."
147581
+ );
147582
+ }
147583
+ const canonical = getAddress(walletAddress);
147584
+ const cached2 = this.managedAccountByAddress.get(canonical.toLowerCase());
147585
+ if (cached2) return cached2;
147586
+ const startedAtGen = this.managedAccountGen;
147587
+ const wallets = await this.auth.wallets({ signal });
147588
+ const match = wallets.find(
147589
+ (w) => w.walletAddress.toLowerCase() === canonical.toLowerCase()
147590
+ );
147591
+ if (!match || match.source !== "privy_embedded") {
147592
+ throw new ZeroAuthError(
147593
+ "auth_error",
147594
+ `Wallet ${canonical} is not a Privy-embedded wallet on this profile. Managed signing can only use profile wallets (see client.wallet.list()).`
147595
+ );
147596
+ }
147597
+ if (this.managedAccountGen !== startedAtGen) {
147598
+ throw new ZeroAuthError(
147599
+ "auth_session_expired",
147600
+ "Session cleared during managed-account resolution. Retry to rebuild against the current session."
147601
+ );
147602
+ }
147603
+ const acc = createManagedAccount(this, canonical, {
147604
+ explicitWallet: true
147605
+ });
147606
+ this.managedAccountByAddress.set(canonical.toLowerCase(), acc);
147607
+ return acc;
147608
+ };
147493
147609
  // Per-caller signal gate: each caller can reject on their own abort
147494
147610
  // without cancelling the shared underlying promise.
147495
147611
  raceWithSignal = (p, signal) => {
@@ -147520,6 +147636,7 @@ var ZeroClient = class _ZeroClient {
147520
147636
  this.managedAccountAC?.abort();
147521
147637
  this.managedAccountInFlight = null;
147522
147638
  this.managedAccountAC = null;
147639
+ this.managedAccountByAddress.clear();
147523
147640
  this.managedAccountGen++;
147524
147641
  };
147525
147642
  /** @internal — Read cached managed account without triggering resolution. */
@@ -147785,7 +147902,7 @@ var placeholderFor = (fieldName, propSchema) => String(sampleValueFor(fieldName,
147785
147902
 
147786
147903
  // package.json
147787
147904
  var package_default2 = {
147788
- version: "1.17.0"};
147905
+ version: "1.19.0"};
147789
147906
 
147790
147907
  // src/app.ts
147791
147908
  init_esm_shims();
@@ -149411,6 +149528,9 @@ var fetchCommand = (appContext) => new Command("fetch").description(
149411
149528
  "--data-stdin",
149412
149529
  "Read the request body from stdin (equivalent to `-d @-`)."
149413
149530
  ).option("-H, --header <header...>", "Headers in Key:Value format").option("--max-pay <amount>", "Maximum per-call spend limit (USDC)").option(
149531
+ "--wallet-address <address>",
149532
+ "Pay/sign from this profile wallet instead of the primary (managed signing; must be a delegated wallet on your profile)"
149533
+ ).option(
149414
149534
  "--timeout <seconds>",
149415
149535
  "Per-request timeout in seconds, overriding the default (180). Applies to each HTTP leg of the call (probe and paid retry), not as a wall-clock deadline."
149416
149536
  ).option(
@@ -149548,6 +149668,9 @@ var fetchCommand = (appContext) => new Command("fetch").description(
149548
149668
  headers,
149549
149669
  ...resolvedBody !== void 0 && { body: resolvedBody },
149550
149670
  ...options.maxPay && { maxPay: options.maxPay },
149671
+ ...options.walletAddress && {
149672
+ walletAddress: options.walletAddress
149673
+ },
149551
149674
  ...timeoutMs !== void 0 && { timeoutMs },
149552
149675
  // Raise the SDK's default 10 MB response cap — the CLI
149553
149676
  // is a streaming sink for paid binary media (audio, video,
@@ -150049,13 +150172,20 @@ var buildResponseSection = (capability) => {
150049
150172
  return [];
150050
150173
  };
150051
150174
  var buildVerifiedExampleSection = (capability) => {
150052
- const req = capability.example?.request;
150053
- if (req === void 0 || req === null) return [];
150054
- const shown = unwrapTransportEnvelope(req);
150055
- if (shown === void 0 || shown === null) return [];
150056
- const json3 = typeof shown === "string" ? shown : JSON.stringify(shown);
150057
- const truncated = json3.length > 600 ? `${json3.slice(0, 600)}\u2026` : json3;
150058
- return ["", "Verified example (request):", ` ${truncated}`];
150175
+ const req = capability.exampleRequest;
150176
+ if (req) {
150177
+ const json3 = JSON.stringify(req);
150178
+ const truncated = json3.length > 600 ? `${json3.slice(0, 600)}\u2026` : json3;
150179
+ return ["", "Verified example (request):", ` ${truncated}`];
150180
+ }
150181
+ if (req === null && capability.example?.request !== void 0 && capability.example?.request !== null) {
150182
+ return [
150183
+ "",
150184
+ "Verified example: no usable request example for the current schema \u2014",
150185
+ " build the request from Parameters above."
150186
+ ];
150187
+ }
150188
+ return [];
150059
150189
  };
150060
150190
  var buildTryItExample = (capability) => {
150061
150191
  const method = capability.method.toUpperCase();
@@ -150145,6 +150275,21 @@ var formatCapability = (capability) => {
150145
150275
  lines.push(...buildTryItExample(capability));
150146
150276
  return lines.join("\n");
150147
150277
  };
150278
+ var URL_RESOLUTION_METHODS = [
150279
+ "POST",
150280
+ "GET",
150281
+ "PUT",
150282
+ "PATCH",
150283
+ "DELETE"
150284
+ ];
150285
+ var isHttpUrl = (value) => {
150286
+ try {
150287
+ const url4 = new URL(value);
150288
+ return url4.protocol === "http:" || url4.protocol === "https:";
150289
+ } catch {
150290
+ return false;
150291
+ }
150292
+ };
150148
150293
  var getCommand = (appContext) => new Command("get").description("Get details for a capability by token, slug, or uid").argument(
150149
150294
  "<identifier>",
150150
150295
  "Attribution token (z_xxx.N from search results), capability slug, or uid"
@@ -150154,7 +150299,30 @@ var getCommand = (appContext) => new Command("get").description("Get details for
150154
150299
  ).action(async (identifier, options) => {
150155
150300
  try {
150156
150301
  const { analyticsService, client } = appContext.services;
150157
- const capability = await client.capabilities.get(identifier);
150302
+ let capabilityRef = identifier;
150303
+ if (isHttpUrl(identifier)) {
150304
+ const matches2 = /* @__PURE__ */ new Map();
150305
+ for (const method of URL_RESOLUTION_METHODS) {
150306
+ const resolved = await client.capabilities.resolveByUrl(
150307
+ identifier,
150308
+ method
150309
+ );
150310
+ if (resolved) {
150311
+ matches2.set(resolved.capabilityId, resolved.capabilitySlug);
150312
+ }
150313
+ }
150314
+ if (matches2.size !== 1) {
150315
+ throw new Error(
150316
+ matches2.size === 0 ? "No indexed capability found for that URL." : "Multiple capabilities match that URL; use a capability slug or uid instead."
150317
+ );
150318
+ }
150319
+ const [resolvedCapabilityId] = matches2.keys();
150320
+ if (!resolvedCapabilityId) {
150321
+ throw new Error("No indexed capability found for that URL.");
150322
+ }
150323
+ capabilityRef = resolvedCapabilityId;
150324
+ }
150325
+ const capability = await client.capabilities.get(capabilityRef);
150158
150326
  if (options.formatted && !options.json) {
150159
150327
  console.log(formatCapability(capability));
150160
150328
  } else {
@@ -151378,9 +151546,13 @@ Examples:
151378
151546
  zero runs # most recent runs
151379
151547
  zero runs --unreviewed # filter to runs without a review
151380
151548
  zero runs --capability translate-en # filter to one capability (uid or slug)
151549
+ zero runs --wallet-address 0xabc\u2026 # filter to one of your profile wallets
151381
151550
  zero runs --json # full structured output for scripts
151382
151551
  zero runs detail <runId> # full server-side metadata for a run`
151383
151552
  ).option("--capability <id>", "Filter by capability uid or slug").option("--unreviewed", "Only show runs without a review").option(
151553
+ "--wallet-address <addresses>",
151554
+ "Filter to specific profile wallets (comma-separated). Default: all profile wallets"
151555
+ ).option(
151384
151556
  "--limit <n>",
151385
151557
  "Max rows (1-100, default 25)",
151386
151558
  (v) => Number.parseInt(v, 10)
@@ -151394,6 +151566,7 @@ Examples:
151394
151566
  const result = await client.runs.list({
151395
151567
  capabilityId: options.capability,
151396
151568
  unreviewed: options.unreviewed,
151569
+ ...options.walletAddress ? { walletAddress: options.walletAddress } : {},
151397
151570
  limit: options.limit
151398
151571
  });
151399
151572
  if (options.json) {
@@ -152091,7 +152264,10 @@ var walletImportCommand = (appContext) => new Command("import").description(
152091
152264
  ).argument("[privateKey]", "Hex-encoded private key (0x prefix optional)").option(
152092
152265
  "--key-stdin",
152093
152266
  "Read the private key from stdin instead of an argument"
152094
- ).option("--primary", "Make the imported wallet your primary payer wallet").action(
152267
+ ).option("--primary", "Make the imported wallet your primary payer wallet").option(
152268
+ "--nickname <name>",
152269
+ "Nickname for the imported wallet (private to you; max 64 chars)"
152270
+ ).action(
152095
152271
  async (privateKeyArg, options) => {
152096
152272
  const { analyticsService, client } = appContext.services;
152097
152273
  if (privateKeyArg && options.keyStdin) {
@@ -152138,7 +152314,8 @@ var walletImportCommand = (appContext) => new Command("import").description(
152138
152314
  try {
152139
152315
  wallet = await client.wallet.import({
152140
152316
  privateKey,
152141
- ...options.primary ? { makePrimary: true } : {}
152317
+ ...options.primary ? { makePrimary: true } : {},
152318
+ ...options.nickname ? { nickname: options.nickname } : {}
152142
152319
  });
152143
152320
  } catch (err) {
152144
152321
  if (err instanceof ZeroApiError) {
@@ -152217,6 +152394,7 @@ var walletListCommand = (appContext) => new Command("list").description("List th
152217
152394
  (wallet.isPrimary ? "PRIMARY" : "").padEnd(7),
152218
152395
  wallet.delegationGranted ? "delegated" : "not delegated"
152219
152396
  ];
152397
+ if (wallet.nickname) columns.push(`"${wallet.nickname}"`);
152220
152398
  console.log(columns.join(" ").trimEnd());
152221
152399
  }
152222
152400
  }
@@ -152302,6 +152480,64 @@ var walletGenerateCommand = (appContext) => new Command("generate").description(
152302
152480
  });
152303
152481
  }
152304
152482
  );
152483
+ var walletNicknameCommand = (appContext) => new Command("nickname").description(
152484
+ "Set or clear a nickname on one of your profile wallets (private to you)"
152485
+ ).argument("<address>", "Wallet address (0x\u2026) on your profile").argument(
152486
+ "[name]",
152487
+ "Nickname to set (max 64 chars). Omit with --clear to remove it."
152488
+ ).option("--clear", "Clear the wallet's nickname").action(
152489
+ async (address2, name, options) => {
152490
+ const { analyticsService, client } = appContext.services;
152491
+ if (options.clear && name !== void 0) {
152492
+ console.error("Pass a nickname OR --clear, not both.");
152493
+ process.exitCode = 1;
152494
+ return;
152495
+ }
152496
+ if (!options.clear && (name === void 0 || name.trim() === "")) {
152497
+ console.error(
152498
+ "Missing nickname. Pass one as an argument, or use --clear to remove it."
152499
+ );
152500
+ process.exitCode = 1;
152501
+ return;
152502
+ }
152503
+ if (client.getCredentials().kind !== "session") {
152504
+ console.error(SIGN_IN_FIRST_MESSAGE);
152505
+ process.exitCode = 1;
152506
+ return;
152507
+ }
152508
+ let wallet;
152509
+ try {
152510
+ wallet = await client.wallet.setNickname({
152511
+ walletAddress: address2,
152512
+ nickname: options.clear ? null : name
152513
+ });
152514
+ } catch (err) {
152515
+ if (err instanceof ZeroApiError) {
152516
+ if (err.status === 401) {
152517
+ console.error(
152518
+ "Session expired. Run `zero auth login` and try again."
152519
+ );
152520
+ } else if (err.status === 404) {
152521
+ console.error(
152522
+ "Wallet not found on your profile. Run `zero wallet list` to see your wallets."
152523
+ );
152524
+ } else {
152525
+ console.error(`Could not update nickname: ${err.message}`);
152526
+ }
152527
+ } else {
152528
+ console.error("Could not update nickname: network error.");
152529
+ }
152530
+ process.exitCode = 1;
152531
+ return;
152532
+ }
152533
+ console.log(
152534
+ wallet.nickname ? `Nickname set: ${wallet.walletAddress} \u2192 "${wallet.nickname}"` : `Nickname cleared for ${wallet.walletAddress}`
152535
+ );
152536
+ analyticsService.capture("wallet_nickname_set", {
152537
+ cleared: Boolean(options.clear)
152538
+ });
152539
+ }
152540
+ );
152305
152541
  var walletCommand = (appContext) => {
152306
152542
  const cmd = new Command("wallet").description("Manage your wallet");
152307
152543
  cmd.addCommand(walletBalanceCommand(appContext));
@@ -152311,6 +152547,7 @@ var walletCommand = (appContext) => {
152311
152547
  cmd.addCommand(walletGenerateCommand(appContext));
152312
152548
  cmd.addCommand(walletImportCommand(appContext));
152313
152549
  cmd.addCommand(walletListCommand(appContext));
152550
+ cmd.addCommand(walletNicknameCommand(appContext));
152314
152551
  return cmd;
152315
152552
  };
152316
152553
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeroxyz/cli",
3
- "version": "1.17.0",
3
+ "version": "1.19.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zero": "dist/index.js",