@zeroxyz/cli 1.21.1 → 1.23.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 +70 -27
  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-FWHVWIO2.js
78452
+ // ../sdk/dist/chunk-I3HO6Z42.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
@@ -143768,7 +143768,7 @@ config(en_default2());
143768
143768
  // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
143769
143769
  var zod_default = external_exports3;
143770
143770
 
143771
- // ../sdk/dist/chunk-FWHVWIO2.js
143771
+ // ../sdk/dist/chunk-I3HO6Z42.js
143772
143772
  var createManagedAccount = (client, address2, opts = {}) => {
143773
143773
  const signOptions = {
143774
143774
  // expectedAddress pins verification to this adapter's frozen address.
@@ -144424,9 +144424,6 @@ var Payments = class {
144424
144424
  */
144425
144425
  pay = async (input) => {
144426
144426
  const maxPayUnits = validateMaxPay(input.maxPay);
144427
- if (maxPayUnits === 0n) {
144428
- throw new ZeroPaymentError("maxPay='0' disallows any payment.");
144429
- }
144430
144427
  const account = await resolveAccount(
144431
144428
  this.client,
144432
144429
  input.account,
@@ -144624,9 +144621,6 @@ var Payments = class {
144624
144621
  */
144625
144622
  payMpp = async (input) => {
144626
144623
  const maxPayUnits = validateMaxPay(input.maxPay);
144627
- if (maxPayUnits === 0n) {
144628
- throw new ZeroPaymentError("maxPay='0' disallows any payment.");
144629
- }
144630
144624
  const account = await resolveAccount(
144631
144625
  this.client,
144632
144626
  input.account,
@@ -144801,6 +144795,11 @@ var Payments = class {
144801
144795
  }
144802
144796
  requiredRaw = BigInt(rawAmount);
144803
144797
  }
144798
+ if (challenge2.intent === "session" && requiredRaw === 0n) {
144799
+ throw new ZeroPaymentError(
144800
+ "This capability opens an MPP payment channel that needs a positive deposit; maxPay='0' cannot fund it. Pass a small cap (e.g. '0.05') to size the channel."
144801
+ );
144802
+ }
144804
144803
  if (maxPayUnits !== null && requiredRaw > maxPayUnits) {
144805
144804
  throw new ZeroPaymentError(
144806
144805
  `Payment of ${formatUnits(requiredRaw, 6)} USDC exceeds maxPay ${formatUnits(maxPayUnits, 6)}`
@@ -145405,15 +145404,19 @@ var resolveRecordingClient = (client, opts) => {
145405
145404
  const canRecord = opts.account !== void 0 || credentials.kind === "account" || credentials.kind === "session";
145406
145405
  return { recordingClient, canRecord };
145407
145406
  };
145408
- var recordErrorFetchRun = async (client, opts, result, capabilityIdOverride) => {
145407
+ var recordErrorFetchRun = async (client, opts, result, capabilityIdOverride, requestUrl, requestMethod) => {
145409
145408
  const effectiveCapId = opts.capabilityId;
145410
- if (effectiveCapId === void 0) return;
145409
+ const runTarget = effectiveCapId !== void 0 ? { capabilityId: effectiveCapId } : requestUrl ? {
145410
+ requestUrl: redactUrl(requestUrl),
145411
+ ...requestMethod && { requestMethod }
145412
+ } : null;
145413
+ if (runTarget === null) return;
145411
145414
  const { recordingClient, canRecord } = resolveRecordingClient(client, opts);
145412
145415
  if (!canRecord) return;
145413
- const fetchOriginForRecord = opts.capabilityId === void 0 ? "direct_url" : isShortToken(effectiveCapId) ? "from_search" : opts.fetchOrigin;
145416
+ const fetchOriginForRecord = opts.capabilityId === void 0 ? "direct_url" : effectiveCapId !== void 0 && isShortToken(effectiveCapId) ? "from_search" : opts.fetchOrigin;
145414
145417
  try {
145415
145418
  const created = await recordingClient.runs.create({
145416
- capabilityId: effectiveCapId,
145419
+ ...runTarget,
145417
145420
  ...opts.searchId && { searchId: opts.searchId },
145418
145421
  ...fetchOriginForRecord && { fetchOrigin: fetchOriginForRecord },
145419
145422
  ...result.status !== null && { status: result.status },
@@ -145426,7 +145429,7 @@ var recordErrorFetchRun = async (client, opts, result, capabilityIdOverride) =>
145426
145429
  } catch {
145427
145430
  }
145428
145431
  };
145429
- var recordTimeoutRun = async (client, opts, err, startedAt, capabilityIdRequested, capabilityIdOverride) => {
145432
+ var recordTimeoutRun = async (client, opts, err, startedAt, capabilityIdRequested, capabilityIdOverride, requestUrl, requestMethod) => {
145430
145433
  const result = errorFetchResult(
145431
145434
  startedAt,
145432
145435
  err.message,
@@ -145434,7 +145437,14 @@ var recordTimeoutRun = async (client, opts, err, startedAt, capabilityIdRequeste
145434
145437
  capabilityIdRequested,
145435
145438
  "network_error"
145436
145439
  );
145437
- await recordErrorFetchRun(client, opts, result);
145440
+ await recordErrorFetchRun(
145441
+ client,
145442
+ opts,
145443
+ result,
145444
+ capabilityIdOverride,
145445
+ requestUrl,
145446
+ requestMethod
145447
+ );
145438
145448
  };
145439
145449
  var sniffJsonShapeBytes = (buf) => {
145440
145450
  let i = 0;
@@ -145497,7 +145507,10 @@ var clientFetch = async (client, url4, opts = {}) => {
145497
145507
  opts,
145498
145508
  err,
145499
145509
  startedAt,
145500
- capabilityIdRequested
145510
+ capabilityIdRequested,
145511
+ void 0,
145512
+ requestUrl,
145513
+ method
145501
145514
  );
145502
145515
  throw err;
145503
145516
  }
@@ -145510,7 +145523,14 @@ var clientFetch = async (client, url4, opts = {}) => {
145510
145523
  capabilityIdRequested,
145511
145524
  "network_error"
145512
145525
  );
145513
- await recordErrorFetchRun(client, opts, result2);
145526
+ await recordErrorFetchRun(
145527
+ client,
145528
+ opts,
145529
+ result2,
145530
+ void 0,
145531
+ requestUrl,
145532
+ method
145533
+ );
145514
145534
  return result2;
145515
145535
  }
145516
145536
  if (response.status === 402) {
@@ -145571,7 +145591,14 @@ var clientFetch = async (client, url4, opts = {}) => {
145571
145591
  "payment_failed",
145572
145592
  402
145573
145593
  );
145574
- await recordErrorFetchRun(client, opts, result2);
145594
+ await recordErrorFetchRun(
145595
+ client,
145596
+ opts,
145597
+ result2,
145598
+ void 0,
145599
+ requestUrl,
145600
+ method
145601
+ );
145575
145602
  return result2;
145576
145603
  } else if (err instanceof ZeroTimeoutError) {
145577
145604
  await recordTimeoutRun(
@@ -145579,7 +145606,10 @@ var clientFetch = async (client, url4, opts = {}) => {
145579
145606
  opts,
145580
145607
  err,
145581
145608
  startedAt,
145582
- capabilityIdRequested
145609
+ capabilityIdRequested,
145610
+ void 0,
145611
+ requestUrl,
145612
+ method
145583
145613
  );
145584
145614
  throw err;
145585
145615
  } else {
@@ -145595,7 +145625,14 @@ var clientFetch = async (client, url4, opts = {}) => {
145595
145625
  "payment_failed",
145596
145626
  402
145597
145627
  );
145598
- await recordErrorFetchRun(client, opts, result2);
145628
+ await recordErrorFetchRun(
145629
+ client,
145630
+ opts,
145631
+ result2,
145632
+ void 0,
145633
+ requestUrl,
145634
+ method
145635
+ );
145599
145636
  return result2;
145600
145637
  }
145601
145638
  }
@@ -145677,7 +145714,8 @@ var clientFetch = async (client, url4, opts = {}) => {
145677
145714
  capabilitySlug: resolvedCap.capabilitySlug,
145678
145715
  matchedVia: resolvedCap.matchedVia
145679
145716
  } : { resolved: false } : void 0;
145680
- if (effectiveCapabilityId !== void 0 && !paidButStill402 && !closeFailed) {
145717
+ const runTarget = effectiveCapabilityId !== void 0 ? { capabilityId: effectiveCapabilityId } : { requestUrl: redactUrl(requestUrl), requestMethod: method };
145718
+ if (!paidButStill402 && !closeFailed) {
145681
145719
  const { recordingClient, canRecord } = resolveRecordingClient(client, opts);
145682
145720
  if (!canRecord) {
145683
145721
  skipReasons.push("no_credentials");
@@ -145697,7 +145735,7 @@ var clientFetch = async (client, url4, opts = {}) => {
145697
145735
  }
145698
145736
  }
145699
145737
  const result2 = await recordingClient.runs.create({
145700
- capabilityId: effectiveCapabilityId,
145738
+ ...runTarget,
145701
145739
  searchId: opts.searchId,
145702
145740
  // Auto-resolved runs are always direct_url — they only fire when
145703
145741
  // no capabilityId was supplied (the direct_url path by definition).
@@ -145771,7 +145809,7 @@ var clientFetch = async (client, url4, opts = {}) => {
145771
145809
  return result;
145772
145810
  };
145773
145811
  var package_default = {
145774
- version: "0.14.0"
145812
+ version: "0.16.0"
145775
145813
  };
145776
145814
  var SDK_VERSION2 = package_default.version;
145777
145815
  var agentAuthMetadataSchema = external_exports3.object({
@@ -147913,7 +147951,7 @@ var placeholderFor = (fieldName, propSchema) => String(sampleValueFor(fieldName,
147913
147951
 
147914
147952
  // package.json
147915
147953
  var package_default2 = {
147916
- version: "1.21.1"};
147954
+ version: "1.23.0"};
147917
147955
 
147918
147956
  // src/app.ts
147919
147957
  init_esm_shims();
@@ -149649,6 +149687,7 @@ var fetchCommand = (appContext) => new Command("fetch").description(
149649
149687
  let searchId;
149650
149688
  let displayCostAmount;
149651
149689
  let fetchOrigin;
149690
+ let runIsAttributed = true;
149652
149691
  if (fromToken) {
149653
149692
  capabilityUid = capFromNoUrl?.uid ?? null;
149654
149693
  capabilityId = options.capability ?? "";
@@ -149662,9 +149701,6 @@ var fetchCommand = (appContext) => new Command("fetch").description(
149662
149701
  displayCostAmount = capFromNoUrl?.displayCostAmount;
149663
149702
  fetchOrigin = "direct_slug";
149664
149703
  } else {
149665
- const resolved = await client.capabilities.resolveByUrl(resolvedUrl, options.method ?? "GET").catch(() => null);
149666
- capabilityUid = resolved?.capabilityId ?? null;
149667
- capabilityId = capabilityUid;
149668
149704
  fetchOrigin = "direct_url";
149669
149705
  }
149670
149706
  const resultRank = void 0;
@@ -149845,6 +149881,7 @@ var fetchCommand = (appContext) => new Command("fetch").description(
149845
149881
  matchedVia: capabilityResolution.matchedVia
149846
149882
  });
149847
149883
  } else {
149884
+ runIsAttributed = false;
149848
149885
  if (walletAddress && !runId) {
149849
149886
  cliSkipReasons.push(
149850
149887
  "no capability resolved \u2014 pass --capability <uid|slug|token> or run `zero search` first so the URL can be matched"
@@ -149979,7 +150016,7 @@ var fetchCommand = (appContext) => new Command("fetch").description(
149979
150016
  ...sdkWarnings?.length && { warnings: sdkWarnings }
149980
150017
  })
149981
150018
  );
149982
- } else if (runId && outcomeInfo.reviewable) {
150019
+ } else if (runId && outcomeInfo.reviewable && runIsAttributed) {
149983
150020
  const isTTY = process.stderr.isTTY;
149984
150021
  const responded2xx = status !== null && status >= 200 && status < 300;
149985
150022
  console.error(`
@@ -150019,6 +150056,12 @@ var fetchCommand = (appContext) => new Command("fetch").description(
150019
150056
  } else {
150020
150057
  console.error(` zero review ${runId} --no-success`);
150021
150058
  }
150059
+ } else if (runId && !runIsAttributed) {
150060
+ console.error(`
150061
+ Run ID: ${runId}`);
150062
+ console.error(
150063
+ ` This URL isn't an indexed capability, so the run can't be reviewed. Pass --capability <uid|slug> or run \`zero search\` first to bind it to one.`
150064
+ );
150022
150065
  } else if (!runId && cliSkipReasons.length > 0) {
150023
150066
  console.error(
150024
150067
  `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeroxyz/cli",
3
- "version": "1.21.1",
3
+ "version": "1.23.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zero": "dist/index.js",