agentcash 0.14.1 → 0.14.3

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 (55) hide show
  1. package/dist/cjs/run-server.cjs +69 -42
  2. package/dist/esm/{add-skill-JHBOH5SG.js → add-skill-CDIK57A3.js} +4 -4
  3. package/dist/esm/{bridge-YU2PE54M.js → bridge-6WMUV3ML.js} +3 -3
  4. package/dist/esm/{check-ITXJS2Z6.js → check-D5DZ6Y3T.js} +4 -4
  5. package/dist/esm/{chunk-Y2J274RB.js → chunk-CFSSHSBN.js} +2 -2
  6. package/dist/esm/{chunk-Y4BYJBYU.js → chunk-FV6DADHO.js} +2 -2
  7. package/dist/esm/{chunk-GZ5DKXKY.js → chunk-IL2CNAJY.js} +2 -2
  8. package/dist/esm/{chunk-6I5J7IHC.js → chunk-K627XZI4.js} +2 -2
  9. package/dist/esm/{chunk-JWU363NX.js → chunk-KMS4TVJY.js} +2 -2
  10. package/dist/esm/{chunk-V3HBA7NZ.js → chunk-KSW2MGQR.js} +12 -4
  11. package/dist/esm/chunk-KSW2MGQR.js.map +1 -0
  12. package/dist/esm/{chunk-PAVGIVNI.js → chunk-LGFUHPDL.js} +2 -2
  13. package/dist/esm/{chunk-ICTY7IIE.js → chunk-NP7CKLI4.js} +2 -2
  14. package/dist/esm/{chunk-XU3KTFR5.js → chunk-SCBLFGL2.js} +3 -3
  15. package/dist/esm/{chunk-CR2YGI3I.js → chunk-SFESERJN.js} +9 -4
  16. package/dist/esm/chunk-SFESERJN.js.map +1 -0
  17. package/dist/esm/{discover-654M2PZ3.js → discover-X557BWGS.js} +6 -4
  18. package/dist/esm/discover-X557BWGS.js.map +1 -0
  19. package/dist/esm/{fetch-GPYZNSPB.js → fetch-45YPD37H.js} +4 -4
  20. package/dist/esm/index.js +28 -18
  21. package/dist/esm/index.js.map +1 -1
  22. package/dist/esm/{install-6W2Z2CWU.js → install-KJOAEIZF.js} +3 -3
  23. package/dist/esm/{onboard-HONVULXC.js → onboard-M5C6TFWE.js} +3 -3
  24. package/dist/esm/{origins-JAC2K5A4.js → origins-XG6O5K27.js} +4 -4
  25. package/dist/esm/{report-error-D44QKQHM.js → report-error-FDDNOZAD.js} +3 -3
  26. package/dist/esm/{search-WV2FO7OG.js → search-VYYPNNIU.js} +9 -4
  27. package/dist/esm/search-VYYPNNIU.js.map +1 -0
  28. package/dist/esm/{server-GZG3KSPG.js → server-6FQ4UZMS.js} +10 -13
  29. package/dist/esm/{server-GZG3KSPG.js.map → server-6FQ4UZMS.js.map} +1 -1
  30. package/dist/esm/{server-G7SXDQJD.js → server-Q4W2J7OE.js} +2 -2
  31. package/dist/esm/{try-36SR5JEG.js → try-UYLQPTBJ.js} +6 -4
  32. package/dist/esm/try-UYLQPTBJ.js.map +1 -0
  33. package/package.json +3 -3
  34. package/dist/esm/chunk-CR2YGI3I.js.map +0 -1
  35. package/dist/esm/chunk-V3HBA7NZ.js.map +0 -1
  36. package/dist/esm/discover-654M2PZ3.js.map +0 -1
  37. package/dist/esm/search-WV2FO7OG.js.map +0 -1
  38. package/dist/esm/try-36SR5JEG.js.map +0 -1
  39. /package/dist/esm/{add-skill-JHBOH5SG.js.map → add-skill-CDIK57A3.js.map} +0 -0
  40. /package/dist/esm/{bridge-YU2PE54M.js.map → bridge-6WMUV3ML.js.map} +0 -0
  41. /package/dist/esm/{check-ITXJS2Z6.js.map → check-D5DZ6Y3T.js.map} +0 -0
  42. /package/dist/esm/{chunk-Y2J274RB.js.map → chunk-CFSSHSBN.js.map} +0 -0
  43. /package/dist/esm/{chunk-Y4BYJBYU.js.map → chunk-FV6DADHO.js.map} +0 -0
  44. /package/dist/esm/{chunk-GZ5DKXKY.js.map → chunk-IL2CNAJY.js.map} +0 -0
  45. /package/dist/esm/{chunk-6I5J7IHC.js.map → chunk-K627XZI4.js.map} +0 -0
  46. /package/dist/esm/{chunk-JWU363NX.js.map → chunk-KMS4TVJY.js.map} +0 -0
  47. /package/dist/esm/{chunk-PAVGIVNI.js.map → chunk-LGFUHPDL.js.map} +0 -0
  48. /package/dist/esm/{chunk-ICTY7IIE.js.map → chunk-NP7CKLI4.js.map} +0 -0
  49. /package/dist/esm/{chunk-XU3KTFR5.js.map → chunk-SCBLFGL2.js.map} +0 -0
  50. /package/dist/esm/{fetch-GPYZNSPB.js.map → fetch-45YPD37H.js.map} +0 -0
  51. /package/dist/esm/{install-6W2Z2CWU.js.map → install-KJOAEIZF.js.map} +0 -0
  52. /package/dist/esm/{onboard-HONVULXC.js.map → onboard-M5C6TFWE.js.map} +0 -0
  53. /package/dist/esm/{origins-JAC2K5A4.js.map → origins-XG6O5K27.js.map} +0 -0
  54. /package/dist/esm/{report-error-D44QKQHM.js.map → report-error-FDDNOZAD.js.map} +0 -0
  55. /package/dist/esm/{server-G7SXDQJD.js.map → server-Q4W2J7OE.js.map} +0 -0
@@ -146828,8 +146828,10 @@ ${PRIMARY_ORIGINS.flatMap((o3) => ORIGIN_METADATA[o3] ? [` ${o3} \u2014 ${ORIGI
146828
146828
  search: {
146829
146829
  mcp: `Search for relevant paid API services by describing what you need in natural language. Returns the best matching origins with endpoint details and pricing. The top result includes the full input/output schema so you can call it immediately via fetch.
146830
146830
 
146831
- Only use this when you DON'T already know which registered origin to use. If the task clearly maps to a registered origin (e.g. people search \u2192 StableEnrich, image generation \u2192 StableStudio), skip search and go straight to discover_api_endpoints on that origin. Search is for discovering NEW or UNKNOWN capabilities outside the registered origins.`,
146832
- cli: `Search for paid API services by natural language query. Returns matching origins with endpoints and pricing. Use this to find APIs before calling discover or fetch.`
146831
+ Only use this when you DON'T already know which registered origin to use. If the task clearly maps to a registered origin (e.g. people search \u2192 StableEnrich, image generation \u2192 StableStudio), skip search and go straight to discover_api_endpoints on that origin. Search is for discovering NEW or UNKNOWN capabilities outside the registered origins.
146832
+
146833
+ Set broad=true to widen the search to include newer, unvetted tools that may not have established trust. Use this if the default results don't cover what you need.`,
146834
+ cli: `Search for paid API services by natural language query. Returns matching origins with endpoints and pricing. Use --broad to include newer, unvetted tools that may not have established trust.`
146833
146835
  },
146834
146836
  reportError: {
146835
146837
  mcp: `EMERGENCY ONLY. Report critical MCP tool bugs. Do NOT use for normal errors (balance, network, 4xx) \u2014 those are recoverable.`,
@@ -146925,7 +146927,10 @@ var TOOL_PARAMS = {
146925
146927
  }
146926
146928
  },
146927
146929
  search: {
146928
- query: 'Natural language description of what you need (e.g. "send physical mail", "generate music", "flight prices")'
146930
+ query: 'Natural language description of what you need (e.g. "send physical mail", "generate music", "flight prices")',
146931
+ broad: "Include broader results that may contain newer, unvetted tools. Default is false.",
146932
+ limit: "Maximum number of results to return (1-50). Default is 10.",
146933
+ page: "Page number for pagination. Default is 1."
146929
146934
  },
146930
146935
  discoverApiEndpoints: {
146931
146936
  url: "The origin URL to discover endpoints on (e.g. https://stableenrich.dev)",
@@ -147202,7 +147207,7 @@ init_cjs_shims();
147202
147207
  // src/operations/check-endpoint.ts
147203
147208
  init_cjs_shims();
147204
147209
 
147205
- // ../../../node_modules/.pnpm/@agentcash+discovery@1.6.2/node_modules/@agentcash/discovery/dist/index.js
147210
+ // ../../../node_modules/.pnpm/@agentcash+discovery@1.6.3/node_modules/@agentcash/discovery/dist/index.js
147206
147211
  init_cjs_shims();
147207
147212
  var import_dereference_json_schema = __toESM(require_dereference_json_schema(), 1);
147208
147213
  var __defProp2 = Object.defineProperty;
@@ -160833,8 +160838,8 @@ var FixedPriceSchema = external_exports5.object({
160833
160838
  var DynamicPriceSchema = external_exports5.object({
160834
160839
  currency: Iso4217Schema,
160835
160840
  mode: external_exports5.literal("dynamic"),
160836
- min: external_exports5.string(),
160837
- max: external_exports5.string()
160841
+ min: external_exports5.string().optional(),
160842
+ max: external_exports5.string().optional()
160838
160843
  });
160839
160844
  var PriceSchema = external_exports5.union([FixedPriceSchema, DynamicPriceSchema]);
160840
160845
  var X402ProtocolSchema = external_exports5.object({
@@ -160933,7 +160938,12 @@ function normalizeLegacy(raw) {
160933
160938
  function formatPrice(price) {
160934
160939
  const sym = price.currency ?? "USD";
160935
160940
  if (price.mode === "fixed") return `${price.amount} ${sym}`;
160936
- return `${price.min}-${price.max} ${sym}`;
160941
+ if (price.min !== void 0 && price.max !== void 0) {
160942
+ return `${price.min}-${price.max} ${sym}`;
160943
+ }
160944
+ if (price.min !== void 0) return `>=${price.min} ${sym}`;
160945
+ if (price.max !== void 0) return `<=${price.max} ${sym}`;
160946
+ return `dynamic ${sym}`;
160937
160947
  }
160938
160948
  function extractProtocolNames(protocols) {
160939
160949
  return protocols.map((p) => {
@@ -160983,10 +160993,13 @@ var OpenApiOperationSchema = external_exports5.object({
160983
160993
  description: external_exports5.string().optional(),
160984
160994
  tags: external_exports5.array(external_exports5.string()).optional(),
160985
160995
  security: external_exports5.array(external_exports5.record(external_exports5.string(), external_exports5.array(external_exports5.string()))).optional(),
160996
+ // `in` / `name` are spec-required, but a single malformed parameter must not
160997
+ // abort the whole spec — keep them optional so discovery is resilient to
160998
+ // non-conformant OpenAPI documents in the wild.
160986
160999
  parameters: external_exports5.array(
160987
161000
  external_exports5.object({
160988
- in: external_exports5.string(),
160989
- name: external_exports5.string(),
161001
+ in: external_exports5.string().optional(),
161002
+ name: external_exports5.string().optional(),
160990
161003
  schema: external_exports5.unknown().optional(),
160991
161004
  required: external_exports5.boolean().optional()
160992
161005
  })
@@ -160996,7 +161009,8 @@ var OpenApiOperationSchema = external_exports5.object({
160996
161009
  content: external_exports5.record(external_exports5.string(), external_exports5.object({ schema: external_exports5.unknown().optional() }))
160997
161010
  }).optional(),
160998
161011
  responses: external_exports5.record(external_exports5.string(), external_exports5.unknown()).optional(),
160999
- "x-payment-info": OpenApiPaymentInfoSchema.optional()
161012
+ // Permissive: vendor extension shape is validated at runtime, never at parse time.
161013
+ "x-payment-info": external_exports5.unknown().optional()
161000
161014
  });
161001
161015
  var OpenApiPathItemSchema = external_exports5.object({
161002
161016
  get: OpenApiOperationSchema.optional(),
@@ -161129,20 +161143,27 @@ function toFetchError(err3) {
161129
161143
  function fetchSafe(url22, init) {
161130
161144
  return ResultAsync.fromPromise(fetch(url22, init), toFetchError);
161131
161145
  }
161132
- function resolvePricingHint(p) {
161133
- const raw = p;
161134
- const info = resolvePaymentInfo(raw);
161146
+ function toRecord(raw) {
161147
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return void 0;
161148
+ return raw;
161149
+ }
161150
+ function resolvePricingHint(raw) {
161151
+ const record22 = toRecord(raw);
161152
+ if (!record22) return void 0;
161153
+ const info = resolvePaymentInfo(record22);
161135
161154
  if (!info) return void 0;
161136
161155
  return {
161137
161156
  pricingMode: info.price.mode,
161138
161157
  ...info.price.mode === "fixed" ? { price: info.price.amount } : {},
161139
- ...info.price.mode === "dynamic" ? { minPrice: info.price.min, maxPrice: info.price.max } : {},
161158
+ ...info.price.mode === "dynamic" && info.price.min !== void 0 ? { minPrice: info.price.min } : {},
161159
+ ...info.price.mode === "dynamic" && info.price.max !== void 0 ? { maxPrice: info.price.max } : {},
161140
161160
  ...info.price.currency ? { currency: info.price.currency } : {}
161141
161161
  };
161142
161162
  }
161143
- function resolveProtocols(p) {
161144
- const raw = p;
161145
- const info = resolvePaymentInfo(raw);
161163
+ function resolveProtocols(raw) {
161164
+ const record22 = toRecord(raw);
161165
+ if (!record22) return [];
161166
+ const info = resolvePaymentInfo(record22);
161146
161167
  if (!info) return [];
161147
161168
  return extractProtocolNames(info.protocols);
161148
161169
  }
@@ -161155,8 +161176,8 @@ var OpenApiParsedSchema = OpenApiDocSchema.transform((doc) => {
161155
161176
  if (!operation) continue;
161156
161177
  const authMode = inferAuthMode(operation, doc.security, doc.components?.securitySchemes) ?? void 0;
161157
161178
  const p = operation["x-payment-info"];
161158
- const protocols = resolveProtocols(p ?? {});
161159
- const pricing = (authMode === "paid" || authMode === "apiKey+paid") && p ? resolvePricingHint(p) : void 0;
161179
+ const protocols = resolveProtocols(p);
161180
+ const pricing = (authMode === "paid" || authMode === "apiKey+paid") && p !== void 0 ? resolvePricingHint(p) : void 0;
161160
161181
  const summary = operation.summary ?? operation.description;
161161
161182
  routes.push({
161162
161183
  path: normalizePath(serverBasePath + rawPath),
@@ -161384,28 +161405,29 @@ function getWellKnown(origin2, headers, signal) {
161384
161405
  }
161385
161406
  function formatPrice2(pricing) {
161386
161407
  const sym = pricing.currency ?? "USD";
161387
- if (pricing.pricingMode === "fixed") return `${pricing.price} ${sym}`;
161408
+ if (pricing.pricingMode === "fixed" && pricing.price) return `${pricing.price} ${sym}`;
161388
161409
  if (pricing.pricingMode === "dynamic") {
161389
161410
  if (pricing.minPrice && pricing.maxPrice)
161390
161411
  return `${pricing.minPrice}-${pricing.maxPrice} ${sym}`;
161391
161412
  if (pricing.maxPrice) return `up to ${pricing.maxPrice} ${sym}`;
161392
- return "dynamic";
161413
+ if (pricing.minPrice) return `from ${pricing.minPrice} ${sym}`;
161393
161414
  }
161394
- return `unknown pricing mode: ${pricing.pricingMode}`;
161415
+ return void 0;
161395
161416
  }
161396
161417
  function checkL2ForOpenAPI(openApi) {
161397
- const routes = openApi.routes.map((route) => ({
161398
- path: route.path,
161399
- method: route.method,
161400
- summary: route.summary ?? `${route.method} ${route.path}`,
161401
- ...route.authMode ? { authMode: route.authMode } : {},
161402
- ...route.pricing ? {
161403
- price: formatPrice2(route.pricing),
161404
- pricingMode: route.pricing.pricingMode,
161405
- ...route.pricing.currency ? { currency: route.pricing.currency } : {}
161406
- } : {},
161407
- ...route.protocols?.length ? { protocols: route.protocols } : {}
161408
- }));
161418
+ const routes = openApi.routes.map((route) => {
161419
+ const priceHint = route.pricing ? formatPrice2(route.pricing) : void 0;
161420
+ return {
161421
+ path: route.path,
161422
+ method: route.method,
161423
+ summary: route.summary ?? `${route.method} ${route.path}`,
161424
+ ...route.authMode ? { authMode: route.authMode } : {},
161425
+ ...priceHint ? { price: priceHint } : {},
161426
+ ...route.pricing?.pricingMode ? { pricingMode: route.pricing.pricingMode } : {},
161427
+ ...route.pricing?.currency ? { currency: route.pricing.currency } : {},
161428
+ ...route.protocols?.length ? { protocols: route.protocols } : {}
161429
+ };
161430
+ });
161409
161431
  return {
161410
161432
  ...openApi.info.title ? { title: openApi.info.title } : {},
161411
161433
  ...openApi.info.description ? { description: openApi.info.description } : {},
@@ -162336,7 +162358,7 @@ var import_path2 = require("path");
162336
162358
  var import_url2 = require("url");
162337
162359
  function getVersion3() {
162338
162360
  if (true) {
162339
- return "0.14.1";
162361
+ return "0.14.3";
162340
162362
  }
162341
162363
  const __dirname2 = (0, import_path2.dirname)((0, import_url2.fileURLToPath)(importMetaUrl));
162342
162364
  const pkg2 = JSON.parse(
@@ -162543,10 +162565,7 @@ async function fetchScanEndpoints(origin2, dev) {
162543
162565
  // src/server/tools/discover-resources.ts
162544
162566
  var toolName3 = "discover_api_endpoints";
162545
162567
  var OPENAPI_TRIED_PATHS = "/openapi.json, /.well-known/x402";
162546
- var registerDiscoveryTools = ({
162547
- server,
162548
- flags
162549
- }) => {
162568
+ var registerDiscoveryTools = ({ server, flags }) => {
162550
162569
  server.registerTool(
162551
162570
  toolName3,
162552
162571
  {
@@ -169741,7 +169760,10 @@ init_cjs_shims();
169741
169760
  init_cjs_shims();
169742
169761
  var AGENTCASH_SEARCH_URL = process.env.AGENTCASH_SEARCH_URL ?? "https://agentcash.dev/api/search";
169743
169762
  var searchSchema = zod_default.object({
169744
- query: zod_default.string().min(1).describe(TOOL_PARAMS.search.query)
169763
+ query: zod_default.string().min(1).describe(TOOL_PARAMS.search.query),
169764
+ broad: zod_default.boolean().optional().describe(TOOL_PARAMS.search.broad),
169765
+ limit: zod_default.number().int().min(1).max(50).optional().describe(TOOL_PARAMS.search.limit),
169766
+ page: zod_default.number().int().min(1).optional().describe(TOOL_PARAMS.search.page)
169745
169767
  });
169746
169768
  async function search(args, options) {
169747
169769
  const parsed = searchSchema.safeParse(args);
@@ -169759,7 +169781,12 @@ async function search(args, options) {
169759
169781
  url: AGENTCASH_SEARCH_URL,
169760
169782
  method: "POST" /* POST */,
169761
169783
  headers: { "Content-Type": "application/json" },
169762
- body: JSON.stringify({ query: parsed.data.query })
169784
+ body: JSON.stringify({
169785
+ query: parsed.data.query,
169786
+ ...parsed.data.broad ? { broad: true } : {},
169787
+ ...parsed.data.limit ? { limit: parsed.data.limit } : {},
169788
+ ...parsed.data.page ? { page: parsed.data.page } : {}
169789
+ })
169763
169790
  },
169764
169791
  {
169765
169792
  surface,
@@ -169860,7 +169887,7 @@ var import_path3 = require("path");
169860
169887
  var import_url5 = require("url");
169861
169888
  function getVersion4() {
169862
169889
  if (true) {
169863
- return "0.14.1";
169890
+ return "0.14.3";
169864
169891
  }
169865
169892
  const __dirname2 = (0, import_path3.dirname)((0, import_url5.fileURLToPath)(importMetaUrl));
169866
169893
  const pkg2 = JSON.parse(
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  resolveOrigin
3
- } from "./chunk-6I5J7IHC.js";
3
+ } from "./chunk-K627XZI4.js";
4
4
  import {
5
5
  installSkills
6
6
  } from "./chunk-FVVSNDQR.js";
7
7
  import {
8
8
  addUserOrigin
9
9
  } from "./chunk-YIU364NZ.js";
10
- import "./chunk-Y2J274RB.js";
11
- import "./chunk-CR2YGI3I.js";
10
+ import "./chunk-CFSSHSBN.js";
11
+ import "./chunk-SFESERJN.js";
12
12
  import "./chunk-KVSTJRSJ.js";
13
13
  import "./chunk-FB5CMO3J.js";
14
14
  import "./chunk-U6FRXL3X.js";
@@ -97,4 +97,4 @@ var addSkillCommand = async (input) => {
97
97
  export {
98
98
  addSkillCommand
99
99
  };
100
- //# sourceMappingURL=add-skill-JHBOH5SG.js.map
100
+ //# sourceMappingURL=add-skill-CDIK57A3.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  bridge,
3
3
  bridgeSchema
4
- } from "./chunk-Y4BYJBYU.js";
4
+ } from "./chunk-FV6DADHO.js";
5
5
  import {
6
6
  DESCRIPTIONS
7
- } from "./chunk-CR2YGI3I.js";
7
+ } from "./chunk-SFESERJN.js";
8
8
  import "./chunk-BFOYXXLG.js";
9
9
  import {
10
10
  getWalletOrExit
@@ -54,4 +54,4 @@ var bridgeCommand = async (args) => {
54
54
  export {
55
55
  bridgeCommand
56
56
  };
57
- //# sourceMappingURL=bridge-YU2PE54M.js.map
57
+ //# sourceMappingURL=bridge-6WMUV3ML.js.map
@@ -3,9 +3,9 @@ import {
3
3
  } from "./chunk-5CMVFNXO.js";
4
4
  import {
5
5
  cliRequestSchema
6
- } from "./chunk-XU3KTFR5.js";
7
- import "./chunk-JWU363NX.js";
8
- import "./chunk-CR2YGI3I.js";
6
+ } from "./chunk-SCBLFGL2.js";
7
+ import "./chunk-KMS4TVJY.js";
8
+ import "./chunk-SFESERJN.js";
9
9
  import "./chunk-IKPLMFAK.js";
10
10
  import {
11
11
  RequestMethod
@@ -69,4 +69,4 @@ var checkCommand = async (args) => {
69
69
  export {
70
70
  checkCommand
71
71
  };
72
- //# sourceMappingURL=check-ITXJS2Z6.js.map
72
+ //# sourceMappingURL=check-D5DZ6Y3T.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TOOL_PARAMS
3
- } from "./chunk-CR2YGI3I.js";
3
+ } from "./chunk-SFESERJN.js";
4
4
  import {
5
5
  zodUrl
6
6
  } from "./chunk-FB5CMO3J.js";
@@ -106,4 +106,4 @@ export {
106
106
  discoverResourcesSchema,
107
107
  discoverResources
108
108
  };
109
- //# sourceMappingURL=chunk-Y2J274RB.js.map
109
+ //# sourceMappingURL=chunk-CFSSHSBN.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TOOL_PARAMS
3
- } from "./chunk-CR2YGI3I.js";
3
+ } from "./chunk-SFESERJN.js";
4
4
  import {
5
5
  safeFetchJson
6
6
  } from "./chunk-BFOYXXLG.js";
@@ -541,4 +541,4 @@ export {
541
541
  bridgeSchema,
542
542
  bridge
543
543
  };
544
- //# sourceMappingURL=chunk-Y4BYJBYU.js.map
544
+ //# sourceMappingURL=chunk-FV6DADHO.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-27DZCYDB.js";
7
7
  import {
8
8
  INSTALL_PACKAGE_SPECIFIER
9
- } from "./chunk-ICTY7IIE.js";
9
+ } from "./chunk-NP7CKLI4.js";
10
10
  import {
11
11
  log,
12
12
  safeReadFile,
@@ -628,4 +628,4 @@ export {
628
628
  tryAddServer,
629
629
  addServer
630
630
  };
631
- //# sourceMappingURL=chunk-GZ5DKXKY.js.map
631
+ //# sourceMappingURL=chunk-IL2CNAJY.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  discoverResources
3
- } from "./chunk-Y2J274RB.js";
3
+ } from "./chunk-CFSSHSBN.js";
4
4
  import {
5
5
  errorResponse
6
6
  } from "./chunk-7EBJ4BCH.js";
@@ -52,4 +52,4 @@ function resolveDescription(result) {
52
52
  export {
53
53
  resolveOrigin
54
54
  };
55
- //# sourceMappingURL=chunk-6I5J7IHC.js.map
55
+ //# sourceMappingURL=chunk-K627XZI4.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  REQUEST_FETCH_PARAMS,
3
3
  REQUEST_PARAMS
4
- } from "./chunk-CR2YGI3I.js";
4
+ } from "./chunk-SFESERJN.js";
5
5
  import {
6
6
  RequestMethod
7
7
  } from "./chunk-LNJIXYCU.js";
@@ -40,4 +40,4 @@ export {
40
40
  paymentProtocols,
41
41
  fetchShape
42
42
  };
43
- //# sourceMappingURL=chunk-JWU363NX.js.map
43
+ //# sourceMappingURL=chunk-KMS4TVJY.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TOOL_PARAMS
3
- } from "./chunk-CR2YGI3I.js";
3
+ } from "./chunk-SFESERJN.js";
4
4
  import {
5
5
  executeFetch
6
6
  } from "./chunk-G5FHPXQL.js";
@@ -15,7 +15,10 @@ import {
15
15
  import z from "zod";
16
16
  var AGENTCASH_SEARCH_URL = process.env.AGENTCASH_SEARCH_URL ?? "https://agentcash.dev/api/search";
17
17
  var searchSchema = z.object({
18
- query: z.string().min(1).describe(TOOL_PARAMS.search.query)
18
+ query: z.string().min(1).describe(TOOL_PARAMS.search.query),
19
+ broad: z.boolean().optional().describe(TOOL_PARAMS.search.broad),
20
+ limit: z.number().int().min(1).max(50).optional().describe(TOOL_PARAMS.search.limit),
21
+ page: z.number().int().min(1).optional().describe(TOOL_PARAMS.search.page)
19
22
  });
20
23
  async function search(args, options) {
21
24
  const parsed = searchSchema.safeParse(args);
@@ -33,7 +36,12 @@ async function search(args, options) {
33
36
  url: AGENTCASH_SEARCH_URL,
34
37
  method: "POST" /* POST */,
35
38
  headers: { "Content-Type": "application/json" },
36
- body: JSON.stringify({ query: parsed.data.query })
39
+ body: JSON.stringify({
40
+ query: parsed.data.query,
41
+ ...parsed.data.broad ? { broad: true } : {},
42
+ ...parsed.data.limit ? { limit: parsed.data.limit } : {},
43
+ ...parsed.data.page ? { page: parsed.data.page } : {}
44
+ })
37
45
  },
38
46
  {
39
47
  surface,
@@ -81,4 +89,4 @@ export {
81
89
  searchSchema,
82
90
  search
83
91
  };
84
- //# sourceMappingURL=chunk-V3HBA7NZ.js.map
92
+ //# sourceMappingURL=chunk-KSW2MGQR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/operations/search.ts"],"sourcesContent":["import z from 'zod';\n\nimport { log } from '@/shared/log';\nimport { executeFetch } from './fetch';\nimport { safeParseResponse } from '@/shared/neverthrow/fetch';\nimport { TOOL_PARAMS } from '@/shared/descriptions';\nimport { RequestMethod } from '@/shared/request/types';\n\nimport type { JsonStringifyValue } from '@/shared/neverthrow/json/types';\nimport type { Wallets } from '@/wallet';\nimport type { GlobalFlags } from '@/types';\n\nconst AGENTCASH_SEARCH_URL =\n process.env.AGENTCASH_SEARCH_URL ?? 'https://agentcash.dev/api/search';\n\nexport const searchSchema = z.object({\n query: z.string().min(1).describe(TOOL_PARAMS.search.query),\n broad: z.boolean().optional().describe(TOOL_PARAMS.search.broad),\n limit: z\n .number()\n .int()\n .min(1)\n .max(50)\n .optional()\n .describe(TOOL_PARAMS.search.limit),\n page: z.number().int().min(1).optional().describe(TOOL_PARAMS.search.page),\n});\n\nexport type SearchInput = z.input<typeof searchSchema>;\n\nexport interface SearchOptions {\n surface: string;\n wallets: Wallets;\n flags: GlobalFlags;\n}\n\nexport type SearchResult =\n | { success: true; results: JsonStringifyValue }\n | {\n success: false;\n cause: string;\n message: string;\n details?: JsonStringifyValue;\n };\n\n/**\n * Search for relevant paid API services by natural language query.\n * Calls the agentcash search API with SIWX auth via executeFetch.\n */\nexport async function search(\n args: SearchInput,\n options: SearchOptions\n): Promise<SearchResult> {\n const parsed = searchSchema.safeParse(args);\n if (!parsed.success) {\n return {\n success: false,\n cause: 'invalid_input',\n message: parsed.error.message,\n };\n }\n\n const { surface, wallets, flags } = options;\n\n log.info(`[search] Searching for: ${parsed.data.query}`);\n\n const fetchResult = await executeFetch(\n {\n url: AGENTCASH_SEARCH_URL,\n method: RequestMethod.POST,\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n query: parsed.data.query,\n ...(parsed.data.broad ? { broad: true } : {}),\n ...(parsed.data.limit ? { limit: parsed.data.limit } : {}),\n ...(parsed.data.page ? { page: parsed.data.page } : {}),\n }),\n },\n {\n surface,\n wallets,\n flags,\n params: {},\n }\n );\n\n if (fetchResult.isErr()) {\n return {\n success: false,\n cause: fetchResult.error.cause,\n message: fetchResult.error.message,\n };\n }\n\n const { response } = fetchResult.value;\n\n if (!response.ok) {\n const parseResult = await safeParseResponse(surface, response);\n return {\n success: false,\n cause: 'http',\n message: `Search API returned ${response.status}: ${response.statusText}`,\n details: parseResult.match(\n data =>\n data.type === 'json' || data.type === 'text'\n ? (data.data as JsonStringifyValue)\n : undefined,\n () => undefined\n ),\n };\n }\n\n const parseResult = await safeParseResponse(surface, response);\n\n if (parseResult.isErr()) {\n return {\n success: false,\n cause: parseResult.error.cause,\n message: parseResult.error.message,\n };\n }\n\n const parsedResponse = parseResult.value;\n\n return {\n success: true,\n results:\n parsedResponse.type === 'json' || parsedResponse.type === 'text'\n ? (parsedResponse.data as JsonStringif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;AAAA,IACH;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,CAAC;AAAA,IACX;AAAA,EACF;AAEA,MAAI,YAAY,MAAM,GAAG;AACvB,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO,YAAY,MAAM;AAAA,MACzB,SAAS,YAAY,MAAM;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,IAAI,YAAY;AAEjC,MAAI,CAAC,SAAS,IAAI;AAChB,UAAMA,eAAc,MAAM,kBAAkB,SAAS,QAAQ;AAC7D,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,MACP,SAAS,uBAAuB,SAAS,MAAM,KAAK,SAAS,UAAU;AAAA,MACvE,SAASA,aAAY;AAAA,QACnB,UACE,KAAK,SAAS,UAAU,KAAK,SAAS,SACjC,KAAK,OACN;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,MAAM,kBAAkB,SAAS,QAAQ;AAE7D,MAAI,YAAY,MAAM,GAAG;AACvB,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO,YAAY,MAAM;AAAA,MACzB,SAAS,YAAY,MAAM;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,iBAAiB,YAAY;AAEnC,SAAO;AAAA,IACL,SAAS;AAAA,IACT,SACE,eAAe,SAAS,UAAU,eAAe,SAAS,SACrD,eAAe,OAChB,EAAE,MAAM,eAAe,KAAK;AAAA,EACpC;AACF;","names":["parseResult"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MCP_VERSION
3
- } from "./chunk-ICTY7IIE.js";
3
+ } from "./chunk-NP7CKLI4.js";
4
4
  import {
5
5
  safeFetchJson
6
6
  } from "./chunk-BFOYXXLG.js";
@@ -51,4 +51,4 @@ async function submitErrorReport(surface, input, address, dev) {
51
51
  export {
52
52
  submitErrorReport
53
53
  };
54
- //# sourceMappingURL=chunk-PAVGIVNI.js.map
54
+ //# sourceMappingURL=chunk-LGFUHPDL.js.map
@@ -4,7 +4,7 @@ import { dirname, join } from "path";
4
4
  import { fileURLToPath } from "url";
5
5
  function getVersion() {
6
6
  if (true) {
7
- return "0.14.1";
7
+ return "0.14.3";
8
8
  }
9
9
  const __dirname2 = dirname(fileURLToPath(import.meta.url));
10
10
  const pkg = JSON.parse(
@@ -23,4 +23,4 @@ export {
23
23
  MCP_VERSION,
24
24
  INSTALL_PACKAGE_SPECIFIER
25
25
  };
26
- //# sourceMappingURL=chunk-ICTY7IIE.js.map
26
+ //# sourceMappingURL=chunk-NP7CKLI4.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  coreRequestSchema,
3
3
  fetchShape
4
- } from "./chunk-JWU363NX.js";
4
+ } from "./chunk-KMS4TVJY.js";
5
5
  import {
6
6
  REQUEST_PARAMS
7
- } from "./chunk-CR2YGI3I.js";
7
+ } from "./chunk-SFESERJN.js";
8
8
 
9
9
  // src/shared/request/schemas/cli.ts
10
10
  import z from "zod";
@@ -46,4 +46,4 @@ export {
46
46
  cliRequestSchema,
47
47
  cliFetchRequestSchema
48
48
  };
49
- //# sourceMappingURL=chunk-XU3KTFR5.js.map
49
+ //# sourceMappingURL=chunk-SCBLFGL2.js.map
@@ -117,8 +117,10 @@ ${PRIMARY_ORIGINS.flatMap((o) => ORIGIN_METADATA[o] ? [` ${o} \u2014 ${ORIGIN_M
117
117
  search: {
118
118
  mcp: `Search for relevant paid API services by describing what you need in natural language. Returns the best matching origins with endpoint details and pricing. The top result includes the full input/output schema so you can call it immediately via fetch.
119
119
 
120
- Only use this when you DON'T already know which registered origin to use. If the task clearly maps to a registered origin (e.g. people search \u2192 StableEnrich, image generation \u2192 StableStudio), skip search and go straight to discover_api_endpoints on that origin. Search is for discovering NEW or UNKNOWN capabilities outside the registered origins.`,
121
- cli: `Search for paid API services by natural language query. Returns matching origins with endpoints and pricing. Use this to find APIs before calling discover or fetch.`
120
+ Only use this when you DON'T already know which registered origin to use. If the task clearly maps to a registered origin (e.g. people search \u2192 StableEnrich, image generation \u2192 StableStudio), skip search and go straight to discover_api_endpoints on that origin. Search is for discovering NEW or UNKNOWN capabilities outside the registered origins.
121
+
122
+ Set broad=true to widen the search to include newer, unvetted tools that may not have established trust. Use this if the default results don't cover what you need.`,
123
+ cli: `Search for paid API services by natural language query. Returns matching origins with endpoints and pricing. Use --broad to include newer, unvetted tools that may not have established trust.`
122
124
  },
123
125
  reportError: {
124
126
  mcp: `EMERGENCY ONLY. Report critical MCP tool bugs. Do NOT use for normal errors (balance, network, 4xx) \u2014 those are recoverable.`,
@@ -214,7 +216,10 @@ var TOOL_PARAMS = {
214
216
  }
215
217
  },
216
218
  search: {
217
- query: 'Natural language description of what you need (e.g. "send physical mail", "generate music", "flight prices")'
219
+ query: 'Natural language description of what you need (e.g. "send physical mail", "generate music", "flight prices")',
220
+ broad: "Include broader results that may contain newer, unvetted tools. Default is false.",
221
+ limit: "Maximum number of results to return (1-50). Default is 10.",
222
+ page: "Page number for pagination. Default is 1."
218
223
  },
219
224
  discoverApiEndpoints: {
220
225
  url: "The origin URL to discover endpoints on (e.g. https://stableenrich.dev)",
@@ -243,4 +248,4 @@ export {
243
248
  REQUEST_FETCH_PARAMS,
244
249
  TOOL_PARAMS
245
250
  };
246
- //# sourceMappingURL=chunk-CR2YGI3I.js.map
251
+ //# sourceMappingURL=chunk-SFESERJN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shared/descriptions.ts"],"sourcesContent":["/**\n * Single source of truth for all LLM-facing text in the MCP package.\n *\n * `DESCRIPTIONS` covers every tool with both an `mcp` variant (detailed,\n * AI-audience) and a `cli` variant (concise, human-readable for --help).\n * `serverInstructions` is shared across both surfaces.\n *\n * Additional exports cover parameter/output schema descriptions, origin\n * metadata, and prompt content — all LLM-facing text in one place.\n */\n\nimport type { UserOrigin } from './user-origins';\nimport { Origin } from './origins';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Origin metadata (used for MCP resource registration descriptions)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const ORIGIN_METADATA: Record<\n string,\n { title: string; description: string }\n> = {\n [Origin.StableEnrich]: {\n title: 'StableEnrich',\n description:\n 'People/org search, Google Maps, Exa web search, LinkedIn data, Firecrawl scrape, WhitePages, email enrichment',\n },\n [Origin.StableSocial]: {\n title: 'StableSocial',\n description:\n 'Social media data for Twitter, Instagram, TikTok, YouTube, Facebook, Reddit',\n },\n [Origin.StableStudio]: {\n title: 'StableStudio',\n description: 'Generate and edit images and videos',\n },\n [Origin.StableUpload]: {\n title: 'StableUpload',\n description: 'Pay to upload files, get a permanent download URL.',\n },\n [Origin.StableEmail]: {\n title: 'StableEmail',\n description: 'Send emails',\n },\n [Origin.X402Scan]: {\n title: 'X402 Scan',\n description: 'x402 protocol explorer',\n },\n [Origin.Shirt]: {\n title: 'Shirt',\n description: 'Shirt.sh',\n },\n [Origin.X402Puppet]: {\n title: 'X402 Puppet',\n description: 'Browser automation',\n },\n [Origin.X402Facilitator]: {\n title: 'X402 Facilitator',\n description: 'Payment facilitation',\n },\n [Origin.StableMerch]: {\n title: 'StableMerch',\n description:\n 'Create shirts and mugs with custom images and have them shipped to your address.',\n },\n};\n\nexport const PRIMARY_ORIGINS = [\n Origin.StableEnrich,\n Origin.StableSocial,\n Origin.StableStudio,\n Origin.StableUpload,\n Origin.StableEmail,\n Origin.StableMerch,\n] as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Tool descriptions — { mcp, cli } per tool + shared serverInstructions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const DESCRIPTIONS = {\n bridge: {\n toolNames: {\n cli: 'bridge',\n mcp: 'bridge',\n },\n title: 'Bridge Between Networks',\n mcp: `Bridge USDC between supported networks using the current wallet. Requires a source network, destination network, and amount. Use this when funds are on one supported network and the user needs them moved to another. Bridging is subject to fees.`,\n cli: `Bridge USDC between supported networks using the current wallet. Requires --from, --to, and --amount. Bridging is subject to fees.`,\n },\n\n getBalance: {\n mcp: `Get your total USDC balance across all supported networks. Auto-creates the wallet on first use (~/.agentcash/wallet.json). Use this before paid API calls to confirm you have funds available.`,\n cli: `Get your total USDC balance across all supported networks. Creates the wallet on first use (~/.agentcash/wallet.json). Use this before paid API calls to confirm you have funds available.`,\n },\n\n fetch: {\n mcp: `HTTP fetch with automatic authentication and payment handling. Makes the request, retries with SIGN-IN-WITH-X when the route exposes a SIWX challenge, and only pays if the route still returns 402. Returns response data along with payment details (price, tx hash) if a payment was made.\\n\\nFor endpoints you haven't called before in this session, you MUST call check_endpoint_schema first to confirm the request body schema. Skipping this causes 400 errors from wrong field names.`,\n cli: `HTTP fetch with automatic authentication and payment handling. If the endpoint returns 402, agentcash attempts authentication first and only falls back to payment if the route still requires it. Run 'check <url>' first to confirm the request body schema; skipping this causes 400 errors from wrong field names.`,\n epilogue: `Workflow: check <url> → fetch <url> -m POST -b '{\"field\":\"value\"}'\\nAuth mode is advisory only; fetch handles both SIWX and paid routes.`,\n },\n\n fetchWithAuth: {\n mcp: `Deprecated alias for fetch. Uses the same unified flow: probe the route, attempt SIWX when available, and only pay if the route still returns 402.\\n\\nFor new integrations, prefer fetch.`,\n cli: `Deprecated alias for fetch. Uses the same unified auth-and-payment flow, but new integrations should call 'fetch' directly.`,\n epilogue: `Deprecated: use agentcash fetch <url>. This alias is kept for compatibility.`,\n },\n\n listAccounts: {\n mcp: `List wallet accounts for each supported network. Returns the network, address, balance, and deposit link for every supported network so you can see where to fund the wallet. Auto-creates the wallet on first use (~/.agentcash/wallet.json). If onboardingCta is present, show its message to the user — it means they haven't onboarded yet and need to either visit the onboard link or deposit directly.`,\n cli: `List wallet accounts for each supported network, including network, address, balance, and deposit link. Creates the wallet on first use (~/.agentcash/wallet.json). Use this when you need the per-network funding addresses and deposit links.`,\n },\n\n getWalletInfo: {\n mcp: `Legacy combined wallet view. Returns both the total balance and the per-network account list. Prefer calling get_balance for available funds and list_accounts when you need network-specific addresses or deposit links.`,\n cli: `Legacy combined wallet view. Returns both the total balance and the per-network account list. Prefer 'balance' for available funds and 'accounts' for network-specific addresses or deposit links.`,\n },\n\n checkEndpointSchema: {\n mcp: [\n `Get the input/output schema and auth mode (paid or SIWX) for a single endpoint.`,\n `Call this to see exactly what fields the request body expects and what the response contains.`,\n `Returns the schema from the origin's OpenAPI spec. Optionally pass sample_input_body to probe the endpoint live (without payment) for an exact price quote — do this when pricing is dynamic (range-based or variable), or when you're unsure about the input schema. Treat auth mode as advisory: fetch handles both SIWX and paid routes.`,\n ].join('\\n\\n'),\n cli: `Get the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec — call this before 'fetch' to avoid 400 errors. Pass --body to probe the endpoint live for an exact price quote when pricing is dynamic or unclear.`,\n epilogue: `Auth mode is advisory:\\n paid → agentcash fetch <url>\\n SIWX → agentcash fetch <url>`,\n },\n\n discoverApiEndpoints: {\n mcp: [\n `List available endpoints at an API origin. Returns endpoint URLs with descriptions of what each does and the auth mode for each (paid or SIWX). Works with any origin, not just the registered ones.`,\n `Call this when you need to see what routes are available at an origin — whether it's one of the registered origins or any other origin you've identified as useful. Treat the auth mode as guidance for what the route may require; fetch handles both SIWX and payment.`,\n `The response always indicates whether guidance is available. Guidance is documentation published by the API provider explaining how endpoints work together, edge cases, and usage tips. compact guidance is included automatically; set include_guidance=true to force-include full usage documentation when you need to compose two or more endpoints or need clarification on how the origin works.`,\n ].join('\\n\\n'),\n cli: `List available endpoints at an API origin with descriptions and auth modes (paid or SIWX). Works with any origin, not just registered ones. Add --include-guidance for full provider docs when composing multiple endpoints or when usage is unclear. Fetch handles both auth modes.`,\n epilogue: `Registered origins:\\n${PRIMARY_ORIGINS.flatMap(o => (ORIGIN_METADATA[o] ? [` ${o} — ${ORIGIN_METADATA[o].description}`] : [])).join('\\n')}`,\n },\n\n redeemInvite: {\n mcp: `Redeem an invite code for free USDC on Base. One-time use per code. Returns amount received and transaction hash. Use get_balance after to verify funds, or list_accounts if you need the per-network deposit links as well.`,\n cli: `Redeem an invite code for free USDC on Base. One-time use per code. Run 'balance' after to verify the balance landed.`,\n },\n\n try: {\n cli: `Fetch a new origin for its resources and return a prompt guiding the user through the process of calling the first endpoint.`,\n },\n\n search: {\n mcp: `Search for relevant paid API services by describing what you need in natural language. Returns the best matching origins with endpoint details and pricing. The top result includes the full input/output schema so you can call it immediately via fetch.\n\nOnly use this when you DON'T already know which registered origin to use. If the task clearly maps to a registered origin (e.g. people search → StableEnrich, image generation → StableStudio), skip search and go straight to discover_api_endpoints on that origin. Search is for discovering NEW or UNKNOWN capabilities outside the registered origins.\n\nSet broad=true to widen the search to include newer, unvetted tools that may not have established trust. Use this if the default results don't cover what you need.`,\n cli: `Search for paid API services by natural language query. Returns matching origins with endpoints and pricing. Use --broad to include newer, unvetted tools that may not have established trust.`,\n },\n\n reportError: {\n mcp: `EMERGENCY ONLY. Report critical MCP tool bugs. Do NOT use for normal errors (balance, network, 4xx) — those are recoverable.`,\n cli: `Report a critical bug to the agentcash team (emergency only). Do NOT use for normal errors like low balance, network timeouts, or 4xx responses — those are recoverable without filing a report.`,\n },\n\n updateSettings: {\n mcp: `Update user settings (persisted to ~/.agentcash/settings.json). Currently supports maxAmount — the maximum USD amount allowed per fetch request. If a fetch response requests more than this, the payment is rejected. Returns the current settings after applying changes.`,\n cli: `Update user settings (persisted to ~/.agentcash/settings.json). Currently supports maxAmount, which caps how much a single fetch request can spend.`,\n },\n\n getSettings: {\n mcp: `Get current user settings. Returns persisted values from ~/.agentcash/settings.json with defaults applied.`,\n cli: `Get current user settings from ~/.agentcash/settings.json, with defaults applied.`,\n },\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Dynamic server instructions (includes user-added origins at runtime)\n// ─────────────────────────────────────────────────────────────────────────────\n\nconst WORKFLOW = [\n `Workflow:`,\n `1. If you don't already know your balance, call get_balance. You need a balance for paid endpoints. SIWX endpoints don't require one. You don't need to call this every turn, just before your first paid call or whenever you're unsure.`,\n `2. If the balance is zero, or if the user needs a funding link or wallet addresses, call list_accounts and share the relevant deposit link. If onboardingCta is present, show it to the user.`,\n `3. If the task doesn't clearly map to any registered origin above, call search() to find relevant APIs. Skip this step when you already know the right origin — go straight to step 4.`,\n `4. Call discover_api_endpoints() to get the endpoint index — a list of available routes with descriptions and auth modes. The auth mode is advisory and tells you what the route may require.`,\n `5. Call check_endpoint_schema() to get the exact input/output schema and auth mode for the endpoint you want to call, so you know what fields to pass and what the response contains. Both discover_api_endpoints and check_endpoint_schema return the auth mode.`,\n `6. Call fetch with the correct input schema. It will attempt SIWX first when available and only pay if the route still returns 402.`,\n].join('\\n');\n\nexport function buildServerInstructions(\n userOrigins: UserOrigin[] = []\n): string {\n const allOrigins = [\n ...userOrigins.map(o => ` - ${o.url} — ${o.description}`),\n ...PRIMARY_ORIGINS.flatMap(o =>\n ORIGIN_METADATA[o] ? [` - ${o} — ${ORIGIN_METADATA[o].description}`] : []\n ),\n ].join('\\n');\n\n return [\n `AgentCash lets you call protected APIs — handling both x402 micropayments and SIWX authentication seamlessly. It manages a USDC wallet for paid endpoints and signs wallet proofs for identity-gated endpoints through fetch.`,\n `The user has installed agentcash because they want to use paid and SIWX-protected APIs as their preferred way to accomplish related tasks.`,\n `Paid endpoints require a wallet balance. SIWX endpoints are free — they only require a wallet identity.`,\n `If a task could be accomplished by one of these registered origins, run the workflow below. If you're unsure which origin to use, or the task doesn't match a registered origin, call search() to find relevant APIs.\\n${allOrigins}`,\n `discover_api_endpoints also works with any origin beyond this list. If you identify another origin that would be useful for a task, you can use it.`,\n WORKFLOW,\n `If you need to compose multiple endpoints in sequence, or anything about the origin's capabilities is unclear, call discover_api_endpoints with include_guidance=true to retrieve the origin's full usage documentation.`,\n ].join('\\n\\n');\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Shared request schema parameter descriptions\n// (used by fetch, fetch_with_auth tools)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const REQUEST_PARAMS = {\n url: 'The endpoint URL',\n method: 'HTTP method. Defaults to GET for fetch operations.',\n body: 'Raw request body string. Passed through to the underlying fetch call as-is.',\n headers:\n 'Additional headers to include. Each entry must be a string in \"Name: value\" format.',\n timeout: 'Request timeout in milliseconds',\n} as const;\n\nexport const REQUEST_FETCH_PARAMS = {\n ...REQUEST_PARAMS,\n paymentProtocol:\n 'Payment protocol to use when payment is required. If not specified, the payment protocol will be auto-detected.',\n paymentNetwork:\n 'Chain to use for SIWX and payment when applicable. If not specified, the network will be auto-detected.',\n maxAmount:\n 'Maximum amount (in USD) to pay per request. Aborts if the endpoint requests more. Defaults to $5. Pass a higher value for known-expensive endpoints.',\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Per-tool parameter and output schema descriptions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const TOOL_PARAMS = {\n bridge: {\n from: 'The network to bridge from',\n to: 'The network to bridge to',\n amount: 'The amount of USDC to bridge',\n },\n fetch: REQUEST_FETCH_PARAMS,\n fetchWithAuth: REQUEST_FETCH_PARAMS,\n checkEndpointSchema: {\n ...REQUEST_PARAMS,\n method:\n 'HTTP method to check. If omitted, all methods declared in the spec are returned.',\n body: 'Optional. A sample request body to probe the endpoint live (without payment) for exact pricing. Use when pricing is range-based or quote-based, or when you need to verify the input schema. Omit to get the static schema and advisory pricing from the spec.',\n },\n try: {\n url: 'The origin URL to explore',\n },\n add: {\n url: 'The origin URL to add',\n },\n\n listAccounts: {\n output: {\n accounts: 'Wallet accounts for each supported network',\n address: 'Wallet address for this network',\n balance: 'USDC balance on this network',\n network: 'Supported payment network name',\n isNewWallet: 'Whether the wallet is new and needs to be funded',\n depositLink:\n 'Link to deposit USDC directly into the wallet for this network',\n onboardingCta:\n 'Present when the user has not yet redeemed an invite code. Show the message to the user — it directs them to onboard or deposit.',\n onboardingCtaOnboardLink: 'Link to the onboarding page',\n onboardingCtaDepositLink: 'Link to deposit USDC directly',\n onboardingCtaMessage: 'Human-readable CTA to show the user',\n },\n },\n\n redeemInvite: {\n code: 'The invite code',\n output: {\n amount: 'Amount with unit (e.g., \"5 USDC\")',\n txHash: 'Transaction hash on Base',\n },\n },\n\n search: {\n query:\n 'Natural language description of what you need (e.g. \"send physical mail\", \"generate music\", \"flight prices\")',\n broad:\n 'Include broader results that may contain newer, unvetted tools. Default is false.',\n limit: 'Maximum number of results to return (1-50). Default is 10.',\n page: 'Page number for pagination. Default is 1.',\n },\n\n discoverApiEndpoints: {\n url: 'The origin URL to discover endpoints on (e.g. https://stableenrich.dev)',\n includeGuidance:\n \"Request the origin's usage guidance. true=always include, false=never include, omit=auto (included when compact). Guidance explains how to compose multiple endpoints and covers edge cases.\",\n },\n\n reportError: {\n tool: 'MCP tool name',\n resource: 'Resource URL',\n summary: '1-2 sentence summary',\n errorMessage: 'Error message',\n stack: 'Stack trace',\n fullReport: 'Detailed report with context, logs, repro steps',\n output: {\n reportId: 'Unique report ID for tracking',\n message: 'Confirmation message',\n },\n },\n} as const;\n"],"mappings":";AAkBO,IAAM,kBAGT;AAAA,EACF,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,4CAAmB,GAAG;AAAA,IACpB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,sCAAgB,GAAG;AAAA,IACjB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,+BAAa,GAAG;AAAA,IACd,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,0CAAkB,GAAG;AAAA,IACnB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,oDAAuB,GAAG;AAAA,IACxB,OAAO;AAAA,IACP,aAAa;AAAA,E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;AAAA,IACnB,GAAG;AAAA,IACH,QACE;AAAA,IACF,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,EACP;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,EACP;AAAA,EAEA,cAAc;AAAA,IACZ,QAAQ;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aACE;AAAA,MACF,eACE;AAAA,MACF,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,sBAAsB;AAAA,IACxB;AAAA,EACF;AAAA,EAEA,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,QAAQ;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EAEA,QAAQ;AAAA,IACN,OACE;AAAA,IACF,OACE;AAAA,IACF,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EAEA,sBAAsB;AAAA,IACpB,KAAK;AAAA,IACL,iBACE;AAAA,EACJ;AAAA,EAEA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,IACT,cAAc;AAAA,IACd,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACX;AAAA,EACF;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  discoverResources
3
- } from "./chunk-Y2J274RB.js";
4
- import "./chunk-CR2YGI3I.js";
3
+ } from "./chunk-CFSSHSBN.js";
4
+ import "./chunk-SFESERJN.js";
5
5
  import "./chunk-FB5CMO3J.js";
6
6
  import "./chunk-U6FRXL3X.js";
7
7
  import {
@@ -16,7 +16,9 @@ import "./chunk-ITCDZXBZ.js";
16
16
 
17
17
  // src/cli/commands/discover.ts
18
18
  var discoverCommand = async (input) => {
19
- const result = await discoverResources("cli:discover", input, { flags: input });
19
+ const result = await discoverResources("cli:discover", input, {
20
+ flags: input
21
+ });
20
22
  if (result.found) {
21
23
  return outputAndExit(successResponse(result), input);
22
24
  }
@@ -35,4 +37,4 @@ var discoverCommand = async (input) => {
35
37
  export {
36
38
  discoverCommand
37
39
  };
38
- //# sourceMappingURL=discover-654M2PZ3.js.map
40
+ //# sourceMappingURL=discover-X557BWGS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/commands/discover.ts"],"sourcesContent":["import { successResponse, errorResponse, outputAndExit } from '@/cli/output';\n\nimport { discoverResources } from '@/operations/discover';\n\nimport type { Command } from '@/types';\nimport type { DiscoverResourcesInput } from '@/operations/discover';\n\nexport const discoverCommand: Command<DiscoverResourcesInput> = async input => {\n const result = await discoverResources('cli:discover', input, {\n flags: input,\n });\n\n if (result.found) {\n return outputAndExit(successResponse(result), input);\n }\n\n const origin = 'origin' in result ? result.origin : input.url;\n return outputAndExit(\n errorResponse({\n code: 'GENERAL_ERROR',\n message:\n result.message ??\n `No OpenAPI spec found for ${origin}. Tried: /openapi.json, /.well-known/x402`,\n surface: 'cli:discover',\n cause: result.cause,\n details: { origin },\n }),\n input\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAOO,IAAM,kBAAmD,OAAM,UAAS;AAC7E,QAAM,SAAS,MAAM,kBAAkB,gBAAgB,OAAO;AAAA,IAC5D,OAAO;AAAA,EACT,CAAC;AAED,MAAI,OAAO,OAAO;AAChB,WAAO,cAAc,gBAAgB,MAAM,GAAG,KAAK;AAAA,EACrD;AAEA,QAAM,SAAS,YAAY,SAAS,OAAO,SAAS,MAAM;AAC1D,SAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SACE,OAAO,WACP,6BAA6B,MAAM;AAAA,MACrC,SAAS;AAAA,MACT,OAAO,OAAO;AAAA,MACd,SAAS,EAAE,OAAO;AAAA,IACpB,CAAC;AAAA,IACD;AAAA,EACF;AACF;","names":[]}
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  cliFetchRequestSchema
3
- } from "./chunk-XU3KTFR5.js";
4
- import "./chunk-JWU363NX.js";
5
- import "./chunk-CR2YGI3I.js";
3
+ } from "./chunk-SCBLFGL2.js";
4
+ import "./chunk-KMS4TVJY.js";
5
+ import "./chunk-SFESERJN.js";
6
6
  import {
7
7
  executeFetch
8
8
  } from "./chunk-G5FHPXQL.js";
@@ -89,4 +89,4 @@ var fetchCommand = async (input) => {
89
89
  export {
90
90
  fetchCommand
91
91
  };
92
- //# sourceMappingURL=fetch-GPYZNSPB.js.map
92
+ //# sourceMappingURL=fetch-45YPD37H.js.map