@agentcash/discovery 1.6.4 → 1.6.5

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 (3) hide show
  1. package/dist/cli.cjs +54 -52
  2. package/dist/cli.js +54 -52
  3. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -16137,17 +16137,14 @@ async function runDiscover(target, flags) {
16137
16137
  if (!flags.json) console.log(`
16138
16138
  Discovering ${origin}...
16139
16139
  `);
16140
- const [openApiResult, wellKnownResult, faviconWarnings] = await Promise.all([
16140
+ const [openApiResult, faviconWarnings] = await Promise.all([
16141
16141
  getOpenAPI(origin),
16142
- getWellKnown(origin),
16143
16142
  getWarningsForFavicon(origin)
16144
16143
  ]);
16145
16144
  const openApiRaw = openApiResult.isOk() ? openApiResult.value : null;
16146
- const wellKnown = wellKnownResult.isOk() ? wellKnownResult.value : null;
16147
16145
  const openApi = isOpenApiSource(openApiRaw) ? openApiRaw : null;
16148
16146
  const warnings = [
16149
16147
  ...getWarningsForOpenAPI(openApiRaw),
16150
- ...getWarningsForWellKnown(wellKnown),
16151
16148
  ...faviconWarnings.isOk() ? faviconWarnings.value : []
16152
16149
  ];
16153
16150
  if (openApi) {
@@ -16203,57 +16200,62 @@ Guidance: ${tokens} tokens`);
16203
16200
  if (flags.verbose) console.log(`
16204
16201
  ${l4.guidance}`);
16205
16202
  }
16206
- } else if (wellKnown) {
16207
- const l2 = checkL2ForWellknown(wellKnown);
16208
- const l4 = checkL4ForWellknown(wellKnown);
16209
- warnings.push(...getWarningsForL2(l2), ...getWarningsForL4(l4));
16210
- const l3WarningArrays = await Promise.all(
16211
- l2.routes.map((r) => getL3Warnings(`${origin}${r.path}`))
16212
- );
16213
- warnings.push(...l3WarningArrays.flat());
16214
- if (flags.json) {
16215
- const meta3 = { origin, specUrl: wellKnown.fetchedUrl };
16216
- if (l2.title) meta3.title = l2.title;
16217
- if (l2.description) meta3.description = l2.description;
16218
- if (l4 && flags.verbose) meta3.guidance = l4.guidance;
16219
- console.log(
16220
- JSON.stringify(
16221
- {
16222
- ok: true,
16223
- selectedStage: l2.source,
16224
- resources: l2.routes.map(routeToResource),
16225
- warnings,
16226
- trace: [],
16227
- meta: meta3
16228
- },
16229
- null,
16230
- 2
16231
- )
16232
- );
16233
- return 0;
16234
- }
16235
- console.log(`Source: ${l2.source}`);
16236
- console.log(`Spec: ${wellKnown.fetchedUrl}`);
16237
- if (l2.title) console.log(`API: ${l2.title}`);
16238
- console.log(`Routes: ${l2.routes.length}
16239
- `);
16240
- for (const route of l2.routes) {
16241
- const price = route.price ? ` ${route.price}` : "";
16242
- const protocols = route.protocols?.length ? ` [${route.protocols.join(", ")}]` : "";
16243
- console.log(` ${route.method.padEnd(7)} ${route.path} paid${price}${protocols}`);
16244
- }
16245
16203
  } else {
16246
- if (flags.json) {
16247
- console.log(
16248
- JSON.stringify(
16249
- { ok: false, selectedStage: null, resources: [], warnings, trace: [], meta: { origin } },
16250
- null,
16251
- 2
16252
- )
16204
+ const wellKnownResult = await getWellKnown(origin);
16205
+ const wellKnown = wellKnownResult.isOk() ? wellKnownResult.value : null;
16206
+ warnings.push(...getWarningsForWellKnown(wellKnown));
16207
+ if (wellKnown) {
16208
+ const l2 = checkL2ForWellknown(wellKnown);
16209
+ const l4 = checkL4ForWellknown(wellKnown);
16210
+ warnings.push(...getWarningsForL2(l2), ...getWarningsForL4(l4));
16211
+ const l3WarningArrays = await Promise.all(
16212
+ l2.routes.map((r) => getL3Warnings(`${origin}${r.path}`))
16253
16213
  );
16254
- return 0;
16214
+ warnings.push(...l3WarningArrays.flat());
16215
+ if (flags.json) {
16216
+ const meta3 = { origin, specUrl: wellKnown.fetchedUrl };
16217
+ if (l2.title) meta3.title = l2.title;
16218
+ if (l2.description) meta3.description = l2.description;
16219
+ if (l4 && flags.verbose) meta3.guidance = l4.guidance;
16220
+ console.log(
16221
+ JSON.stringify(
16222
+ {
16223
+ ok: true,
16224
+ selectedStage: l2.source,
16225
+ resources: l2.routes.map(routeToResource),
16226
+ warnings,
16227
+ trace: [],
16228
+ meta: meta3
16229
+ },
16230
+ null,
16231
+ 2
16232
+ )
16233
+ );
16234
+ return 0;
16235
+ }
16236
+ console.log(`Source: ${l2.source}`);
16237
+ console.log(`Spec: ${wellKnown.fetchedUrl}`);
16238
+ if (l2.title) console.log(`API: ${l2.title}`);
16239
+ console.log(`Routes: ${l2.routes.length}
16240
+ `);
16241
+ for (const route of l2.routes) {
16242
+ const price = route.price ? ` ${route.price}` : "";
16243
+ const protocols = route.protocols?.length ? ` [${route.protocols.join(", ")}]` : "";
16244
+ console.log(` ${route.method.padEnd(7)} ${route.path} paid${price}${protocols}`);
16245
+ }
16246
+ } else {
16247
+ if (flags.json) {
16248
+ console.log(
16249
+ JSON.stringify(
16250
+ { ok: false, selectedStage: null, resources: [], warnings, trace: [], meta: { origin } },
16251
+ null,
16252
+ 2
16253
+ )
16254
+ );
16255
+ return 0;
16256
+ }
16257
+ console.log("Not found \u2014 no OpenAPI spec or /.well-known/x402 at this origin.");
16255
16258
  }
16256
- console.log("Not found \u2014 no OpenAPI spec or /.well-known/x402 at this origin.");
16257
16259
  }
16258
16260
  printWarnings(warnings, flags.verbose);
16259
16261
  return 0;
package/dist/cli.js CHANGED
@@ -16107,17 +16107,14 @@ async function runDiscover(target, flags) {
16107
16107
  if (!flags.json) console.log(`
16108
16108
  Discovering ${origin}...
16109
16109
  `);
16110
- const [openApiResult, wellKnownResult, faviconWarnings] = await Promise.all([
16110
+ const [openApiResult, faviconWarnings] = await Promise.all([
16111
16111
  getOpenAPI(origin),
16112
- getWellKnown(origin),
16113
16112
  getWarningsForFavicon(origin)
16114
16113
  ]);
16115
16114
  const openApiRaw = openApiResult.isOk() ? openApiResult.value : null;
16116
- const wellKnown = wellKnownResult.isOk() ? wellKnownResult.value : null;
16117
16115
  const openApi = isOpenApiSource(openApiRaw) ? openApiRaw : null;
16118
16116
  const warnings = [
16119
16117
  ...getWarningsForOpenAPI(openApiRaw),
16120
- ...getWarningsForWellKnown(wellKnown),
16121
16118
  ...faviconWarnings.isOk() ? faviconWarnings.value : []
16122
16119
  ];
16123
16120
  if (openApi) {
@@ -16173,57 +16170,62 @@ Guidance: ${tokens} tokens`);
16173
16170
  if (flags.verbose) console.log(`
16174
16171
  ${l4.guidance}`);
16175
16172
  }
16176
- } else if (wellKnown) {
16177
- const l2 = checkL2ForWellknown(wellKnown);
16178
- const l4 = checkL4ForWellknown(wellKnown);
16179
- warnings.push(...getWarningsForL2(l2), ...getWarningsForL4(l4));
16180
- const l3WarningArrays = await Promise.all(
16181
- l2.routes.map((r) => getL3Warnings(`${origin}${r.path}`))
16182
- );
16183
- warnings.push(...l3WarningArrays.flat());
16184
- if (flags.json) {
16185
- const meta3 = { origin, specUrl: wellKnown.fetchedUrl };
16186
- if (l2.title) meta3.title = l2.title;
16187
- if (l2.description) meta3.description = l2.description;
16188
- if (l4 && flags.verbose) meta3.guidance = l4.guidance;
16189
- console.log(
16190
- JSON.stringify(
16191
- {
16192
- ok: true,
16193
- selectedStage: l2.source,
16194
- resources: l2.routes.map(routeToResource),
16195
- warnings,
16196
- trace: [],
16197
- meta: meta3
16198
- },
16199
- null,
16200
- 2
16201
- )
16202
- );
16203
- return 0;
16204
- }
16205
- console.log(`Source: ${l2.source}`);
16206
- console.log(`Spec: ${wellKnown.fetchedUrl}`);
16207
- if (l2.title) console.log(`API: ${l2.title}`);
16208
- console.log(`Routes: ${l2.routes.length}
16209
- `);
16210
- for (const route of l2.routes) {
16211
- const price = route.price ? ` ${route.price}` : "";
16212
- const protocols = route.protocols?.length ? ` [${route.protocols.join(", ")}]` : "";
16213
- console.log(` ${route.method.padEnd(7)} ${route.path} paid${price}${protocols}`);
16214
- }
16215
16173
  } else {
16216
- if (flags.json) {
16217
- console.log(
16218
- JSON.stringify(
16219
- { ok: false, selectedStage: null, resources: [], warnings, trace: [], meta: { origin } },
16220
- null,
16221
- 2
16222
- )
16174
+ const wellKnownResult = await getWellKnown(origin);
16175
+ const wellKnown = wellKnownResult.isOk() ? wellKnownResult.value : null;
16176
+ warnings.push(...getWarningsForWellKnown(wellKnown));
16177
+ if (wellKnown) {
16178
+ const l2 = checkL2ForWellknown(wellKnown);
16179
+ const l4 = checkL4ForWellknown(wellKnown);
16180
+ warnings.push(...getWarningsForL2(l2), ...getWarningsForL4(l4));
16181
+ const l3WarningArrays = await Promise.all(
16182
+ l2.routes.map((r) => getL3Warnings(`${origin}${r.path}`))
16223
16183
  );
16224
- return 0;
16184
+ warnings.push(...l3WarningArrays.flat());
16185
+ if (flags.json) {
16186
+ const meta3 = { origin, specUrl: wellKnown.fetchedUrl };
16187
+ if (l2.title) meta3.title = l2.title;
16188
+ if (l2.description) meta3.description = l2.description;
16189
+ if (l4 && flags.verbose) meta3.guidance = l4.guidance;
16190
+ console.log(
16191
+ JSON.stringify(
16192
+ {
16193
+ ok: true,
16194
+ selectedStage: l2.source,
16195
+ resources: l2.routes.map(routeToResource),
16196
+ warnings,
16197
+ trace: [],
16198
+ meta: meta3
16199
+ },
16200
+ null,
16201
+ 2
16202
+ )
16203
+ );
16204
+ return 0;
16205
+ }
16206
+ console.log(`Source: ${l2.source}`);
16207
+ console.log(`Spec: ${wellKnown.fetchedUrl}`);
16208
+ if (l2.title) console.log(`API: ${l2.title}`);
16209
+ console.log(`Routes: ${l2.routes.length}
16210
+ `);
16211
+ for (const route of l2.routes) {
16212
+ const price = route.price ? ` ${route.price}` : "";
16213
+ const protocols = route.protocols?.length ? ` [${route.protocols.join(", ")}]` : "";
16214
+ console.log(` ${route.method.padEnd(7)} ${route.path} paid${price}${protocols}`);
16215
+ }
16216
+ } else {
16217
+ if (flags.json) {
16218
+ console.log(
16219
+ JSON.stringify(
16220
+ { ok: false, selectedStage: null, resources: [], warnings, trace: [], meta: { origin } },
16221
+ null,
16222
+ 2
16223
+ )
16224
+ );
16225
+ return 0;
16226
+ }
16227
+ console.log("Not found \u2014 no OpenAPI spec or /.well-known/x402 at this origin.");
16225
16228
  }
16226
- console.log("Not found \u2014 no OpenAPI spec or /.well-known/x402 at this origin.");
16227
16229
  }
16228
16230
  printWarnings(warnings, flags.verbose);
16229
16231
  return 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentcash/discovery",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Canonical OpenAPI-first discovery runtime for the agentcash ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",