@zeroxyz/cli 1.30.0 → 1.31.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 +58 -11
  2. 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-JDRHYLN6.js
93046
+ // ../sdk/dist/chunk-QHTPKBCA.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.23.0"
166842
+ version: "0.24.0"
166843
166843
  };
166844
166844
  var SDK_VERSION2 = package_default.version;
166845
166845
  var ZeroError = class extends Error {
@@ -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) => {
@@ -169735,7 +169760,9 @@ var clientFetch = async (client, url4, opts = {}, diagnostics) => {
169735
169760
  );
169736
169761
  const resolvePromise = !capabilityIdRequested && canRecordForResolve ? diagnostics.measure(
169737
169762
  "resolve_target",
169738
- () => client.capabilities.resolveByUrl(redactUrl2(requestUrl), method)
169763
+ () => client.capabilities.resolveByUrl(redactUrl2(requestUrl), method, {
169764
+ candidates: true
169765
+ }).then((r) => pickResolvedCapability(r, requestUrl))
169739
169766
  ).catch(() => {
169740
169767
  diagnostics.issue(
169741
169768
  "resolve_target",
@@ -171312,11 +171339,23 @@ var capabilityResponseSchema = external_exports3.object({
171312
171339
  lastUsedAt: external_exports3.string().nullable().optional(),
171313
171340
  lastSuccessfullyRanAt: external_exports3.string().nullable().optional()
171314
171341
  });
171315
- var resolveCapabilityResponseSchema = external_exports3.object({
171316
- capabilityId: external_exports3.string(),
171317
- capabilitySlug: external_exports3.string(),
171318
- matchedVia: external_exports3.enum(["exact", "template"])
171319
- });
171342
+ var resolveCapabilityResponseSchema = external_exports3.union([
171343
+ external_exports3.object({
171344
+ capabilityId: external_exports3.string(),
171345
+ capabilitySlug: external_exports3.string(),
171346
+ matchedVia: external_exports3.enum(["exact", "template"])
171347
+ }),
171348
+ external_exports3.object({
171349
+ candidates: external_exports3.array(
171350
+ external_exports3.object({
171351
+ capabilityId: external_exports3.string(),
171352
+ capabilitySlug: external_exports3.string(),
171353
+ url: external_exports3.string()
171354
+ })
171355
+ )
171356
+ })
171357
+ ]);
171358
+ var isResolvedCapability = (response) => response !== null && "capabilityId" in response;
171320
171359
  var Capabilities = class {
171321
171360
  constructor(client) {
171322
171361
  this.client = client;
@@ -171339,6 +171378,14 @@ var Capabilities = class {
171339
171378
  // The URL travels in the POST body so it stays out of access logs and is
171340
171379
  // never stored; the caller uses the returned capabilityId to record an
171341
171380
  // attributed run without the URL ever touching the run row (ZERO-335).
171381
+ //
171382
+ // `candidates: true` additionally asks the server for the capabilities that
171383
+ // share this origin + path and differ only by query string. Callers redact
171384
+ // the query before sending (it can carry credentials), which is ambiguous
171385
+ // once a required query param is baked into a capability's url to make it
171386
+ // callable — ten Dappier publisher models share `/zeroclick/v2/search`
171387
+ // (ZERO-942). The server can't choose; the caller still holds the full URL,
171388
+ // so it picks locally. Leave the flag off and the behavior is unchanged.
171342
171389
  resolveByUrl = async (url4, method, opts = {}) => {
171343
171390
  try {
171344
171391
  return await request2(
@@ -171346,7 +171393,7 @@ var Capabilities = class {
171346
171393
  {
171347
171394
  method: "POST",
171348
171395
  path: "/v1/capabilities/resolve",
171349
- body: { url: url4, method },
171396
+ body: opts.candidates ? { url: url4, method, candidates: true } : { url: url4, method },
171350
171397
  signal: opts.signal
171351
171398
  },
171352
171399
  resolveCapabilityResponseSchema
@@ -176369,7 +176416,7 @@ var placeholderFor = (fieldName, propSchema) => String(sampleValueFor(fieldName,
176369
176416
 
176370
176417
  // package.json
176371
176418
  var package_default2 = {
176372
- version: "1.30.0"};
176419
+ version: "1.31.0"};
176373
176420
 
176374
176421
  // src/app.ts
176375
176422
  init_esm_shims();
@@ -179358,7 +179405,7 @@ var getCommand = (appContext) => new Command("get").description("Get details for
179358
179405
  identifier,
179359
179406
  method
179360
179407
  );
179361
- if (resolved) {
179408
+ if (isResolvedCapability(resolved)) {
179362
179409
  matches2.set(resolved.capabilityId, resolved.capabilitySlug);
179363
179410
  }
179364
179411
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeroxyz/cli",
3
- "version": "1.30.0",
3
+ "version": "1.31.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zero": "dist/index.js",