agentcash 0.7.4 → 0.7.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 (25) hide show
  1. package/dist/cjs/run-server.cjs +19 -10
  2. package/dist/esm/chunk-FMIYI3CP.js +7 -0
  3. package/dist/esm/{chunk-HXRJ5ES4.js → chunk-HTBRLSCW.js} +2 -2
  4. package/dist/esm/{chunk-DBDSS3CQ.js → chunk-JKTGKBTC.js} +4 -4
  5. package/dist/esm/{chunk-NFKU5GQE.js → chunk-NWBBICB3.js} +3 -3
  6. package/dist/esm/{chunk-MQLBI77V.js → chunk-OZ2ZEZNY.js} +2 -2
  7. package/dist/esm/{chunk-RY34EBJ4.js → chunk-VO7D4FSH.js} +17 -8
  8. package/dist/esm/chunk-VO7D4FSH.js.map +1 -0
  9. package/dist/esm/{commands-M66YQJM7.js → commands-HERW4VHS.js} +8 -8
  10. package/dist/esm/index.js +20 -20
  11. package/dist/esm/index.js.map +1 -1
  12. package/dist/esm/{install-4YDF4G6T.js → install-LGAM7SWQ.js} +3 -3
  13. package/dist/esm/{server-GJVD7VNR.js → server-7YK4VUAT.js} +7 -7
  14. package/dist/esm/shared/operations/index.js +3 -3
  15. package/package.json +1 -1
  16. package/dist/esm/chunk-OW3UV227.js +0 -7
  17. package/dist/esm/chunk-RY34EBJ4.js.map +0 -1
  18. /package/dist/esm/{chunk-OW3UV227.js.map → chunk-FMIYI3CP.js.map} +0 -0
  19. /package/dist/esm/{chunk-HXRJ5ES4.js.map → chunk-HTBRLSCW.js.map} +0 -0
  20. /package/dist/esm/{chunk-DBDSS3CQ.js.map → chunk-JKTGKBTC.js.map} +0 -0
  21. /package/dist/esm/{chunk-NFKU5GQE.js.map → chunk-NWBBICB3.js.map} +0 -0
  22. /package/dist/esm/{chunk-MQLBI77V.js.map → chunk-OZ2ZEZNY.js.map} +0 -0
  23. /package/dist/esm/{commands-M66YQJM7.js.map → commands-HERW4VHS.js.map} +0 -0
  24. /package/dist/esm/{install-4YDF4G6T.js.map → install-LGAM7SWQ.js.map} +0 -0
  25. /package/dist/esm/{server-GJVD7VNR.js.map → server-7YK4VUAT.js.map} +0 -0
@@ -113816,7 +113816,7 @@ var import_path2 = require("path");
113816
113816
  var import_url = require("url");
113817
113817
  function getVersion2() {
113818
113818
  if (true) {
113819
- return "0.7.4";
113819
+ return "0.7.5";
113820
113820
  }
113821
113821
  const __dirname3 = (0, import_path2.dirname)((0, import_url.fileURLToPath)(importMetaUrl));
113822
113822
  const pkg = JSON.parse(
@@ -113979,7 +113979,7 @@ var TEMPO_TOKEN_ADDRESS = "0x20c0000000000000000000000000000000000000";
113979
113979
 
113980
113980
  // src/shared/mpp-enabled.ts
113981
113981
  init_cjs_shims();
113982
- var isMppEnabled = () => "0.7.4".includes("-mpp");
113982
+ var isMppEnabled = () => "0.7.5".includes("-mpp");
113983
113983
 
113984
113984
  // src/shared/operations/fetch-with-payment.ts
113985
113985
  init_cjs_shims();
@@ -115346,17 +115346,21 @@ var DESCRIPTIONS = {
115346
115346
  mcp: `HTTP fetch with automatic x402 payment handling. Makes the request and, if the endpoint returns 402, signs payment and retries with payment headers. Returns response data along with payment details (price, tx hash) if a payment was made.
115347
115347
 
115348
115348
  For 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.`,
115349
- cli: `HTTP fetch with automatic x402 payment handling.`
115349
+ cli: `HTTP fetch with automatic x402 payment handling. If the endpoint returns 402, signs payment and retries \u2014 no manual payment steps needed. Run 'check <url>' first to confirm the request body schema; skipping this causes 400 errors from wrong field names.`,
115350
+ epilogue: `Workflow: check <url> \u2192 fetch <url> -m POST -b '{"field":"value"}'
115351
+ Use 'fetch-auth' instead if the endpoint requires identity (SIWX) rather than payment.`
115350
115352
  },
115351
115353
  fetchWithAuth: {
115352
115354
  mcp: `HTTP fetch with automatic SIWX (Sign-In With X) authentication. Sends an authenticated request to a SIWX-protected endpoint. Returns response data gated by the endpoint's authentication requirements.
115353
115355
 
115354
115356
  For 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.`,
115355
- cli: `HTTP fetch with automatic SIWX (Sign-In With X) authentication`
115357
+ cli: `HTTP fetch with automatic SIWX (Sign-In With X) authentication for identity-gated endpoints. No payment required \u2014 the wallet is used as an identity proof only. Run 'check <url>' first to confirm the request body schema; skipping this causes 400 errors from wrong field names.`,
115358
+ epilogue: `Workflow: check <url> \u2192 fetch-auth <url> -m POST -b '{"field":"value"}'
115359
+ Use 'fetch' instead if the endpoint requires payment (x402) rather than identity.`
115356
115360
  },
115357
115361
  getWalletInfo: {
115358
115362
  mcp: `Get wallet address and USDC balance. Auto-creates wallet on first use (~/.agentcash/wallet.json). Returns a deposit link if funding is needed.`,
115359
- cli: `Get wallet address, balance, and deposit link`
115363
+ cli: `Get wallet address, USDC balance, and deposit link. Creates the wallet on first use (~/.agentcash/wallet.json). Check this before making paid API calls \u2014 if balance is zero, deposit USDC using the returned link.`
115360
115364
  },
115361
115365
  checkEndpointSchema: {
115362
115366
  mcp: [
@@ -115364,7 +115368,10 @@ For endpoints you haven't called before in this session, you MUST call check_end
115364
115368
  `Call this to see exactly what fields the request body expects and what the response contains.`,
115365
115369
  `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 \u2014 do this when pricing is range-based or quote-based, or when you're unsure about the input schema.`
115366
115370
  ].join("\n\n"),
115367
- cli: `Check endpoint for schema and pricing without making payment`
115371
+ cli: `Get the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec \u2014 call this before 'fetch' or 'fetch-auth' to avoid 400 errors. Pass --body to probe the endpoint live for an exact price quote when pricing is range-based or unclear.`,
115372
+ epilogue: `Auth mode tells you which command to use:
115373
+ paid \u2192 agentcash fetch <url>
115374
+ SIWX \u2192 agentcash fetch-auth <url>`
115368
115375
  },
115369
115376
  discoverApiEndpoints: {
115370
115377
  mcp: [
@@ -115372,15 +115379,17 @@ For endpoints you haven't called before in this session, you MUST call check_end
115372
115379
  `Call this when you need to see what routes are available at an origin \u2014 whether it's one of the registered origins or any other origin you've identified as useful.`,
115373
115380
  `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.`
115374
115381
  ].join("\n\n"),
115375
- cli: `Discover x402-protected or SIWX-protected endpoints on an origin`
115382
+ 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.`,
115383
+ epilogue: `Registered origins:
115384
+ ${PRIMARY_ORIGINS.flatMap((o) => ORIGIN_METADATA[o] ? [` ${o} \u2014 ${ORIGIN_METADATA[o].description}`] : []).join("\n")}`
115376
115385
  },
115377
115386
  redeemInvite: {
115378
115387
  mcp: `Redeem an invite code for free USDC on Base. One-time use per code. Returns amount received and transaction hash. Use get_wallet_info after to verify balance.`,
115379
- cli: `Redeem an invite code for free USDC`
115388
+ cli: `Redeem an invite code for free USDC on Base. One-time use per code. Run 'wallet info' after to verify the balance landed.`
115380
115389
  },
115381
115390
  reportError: {
115382
115391
  mcp: `EMERGENCY ONLY. Report critical MCP tool bugs. Do NOT use for normal errors (balance, network, 4xx) \u2014 those are recoverable.`,
115383
- cli: `Report a critical bug to the agentcash team (emergency only)`
115392
+ 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 \u2014 those are recoverable without filing a report.`
115384
115393
  },
115385
115394
  serverInstructions: [
115386
115395
  `AgentCash lets you call protected APIs \u2014 handling both x402 micropayments and SIWX authentication seamlessly. It manages a USDC wallet for paid endpoints (fetch) and signs wallet proofs for identity-gated endpoints (fetch_with_auth).`,
@@ -117702,7 +117711,7 @@ var import_path3 = require("path");
117702
117711
  var import_url2 = require("url");
117703
117712
  function getVersion3() {
117704
117713
  if (true) {
117705
- return "0.7.4";
117714
+ return "0.7.5";
117706
117715
  }
117707
117716
  const __dirname3 = (0, import_path3.dirname)((0, import_url2.fileURLToPath)(importMetaUrl));
117708
117717
  const pkg = JSON.parse(
@@ -0,0 +1,7 @@
1
+ // src/shared/mpp-enabled.ts
2
+ var isMppEnabled = () => "0.7.5".includes("-mpp");
3
+
4
+ export {
5
+ isMppEnabled
6
+ };
7
+ //# sourceMappingURL=chunk-FMIYI3CP.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.7.4";
7
+ return "0.7.5";
8
8
  }
9
9
  const __dirname2 = dirname(fileURLToPath(import.meta.url));
10
10
  const pkg = JSON.parse(
@@ -19,4 +19,4 @@ export {
19
19
  MCP_VERSION,
20
20
  DIST_TAG
21
21
  };
22
- //# sourceMappingURL=chunk-HXRJ5ES4.js.map
22
+ //# sourceMappingURL=chunk-HTBRLSCW.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  REQUEST_PARAMS
3
- } from "./chunk-RY34EBJ4.js";
3
+ } from "./chunk-VO7D4FSH.js";
4
4
  import {
5
5
  getTempoBalance
6
- } from "./chunk-NFKU5GQE.js";
6
+ } from "./chunk-NWBBICB3.js";
7
7
  import {
8
8
  isMppEnabled
9
- } from "./chunk-OW3UV227.js";
9
+ } from "./chunk-FMIYI3CP.js";
10
10
  import {
11
11
  getBalance
12
12
  } from "./chunk-YUCA2PQT.js";
@@ -516,4 +516,4 @@ export {
516
516
  getInputSchema,
517
517
  createFetchWithAuth
518
518
  };
519
- //# sourceMappingURL=chunk-DBDSS3CQ.js.map
519
+ //# sourceMappingURL=chunk-JKTGKBTC.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  isMppEnabled
3
- } from "./chunk-OW3UV227.js";
3
+ } from "./chunk-FMIYI3CP.js";
4
4
  import {
5
5
  MCP_VERSION
6
- } from "./chunk-HXRJ5ES4.js";
6
+ } from "./chunk-HTBRLSCW.js";
7
7
  import {
8
8
  getBalance,
9
9
  getBaseUrl,
@@ -119,4 +119,4 @@ export {
119
119
  getWalletInfo,
120
120
  submitErrorReport
121
121
  };
122
- //# sourceMappingURL=chunk-NFKU5GQE.js.map
122
+ //# sourceMappingURL=chunk-NWBBICB3.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JNYAKINU.js";
4
4
  import {
5
5
  DIST_TAG
6
- } from "./chunk-HXRJ5ES4.js";
6
+ } from "./chunk-HTBRLSCW.js";
7
7
  import {
8
8
  wait
9
9
  } from "./chunk-DZNSJ2BA.js";
@@ -626,4 +626,4 @@ export {
626
626
  tryAddServer,
627
627
  addServer
628
628
  };
629
- //# sourceMappingURL=chunk-MQLBI77V.js.map
629
+ //# sourceMappingURL=chunk-OZ2ZEZNY.js.map
@@ -61,17 +61,21 @@ var DESCRIPTIONS = {
61
61
  mcp: `HTTP fetch with automatic x402 payment handling. Makes the request and, if the endpoint returns 402, signs payment and retries with payment headers. Returns response data along with payment details (price, tx hash) if a payment was made.
62
62
 
63
63
  For 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.`,
64
- cli: `HTTP fetch with automatic x402 payment handling.`
64
+ cli: `HTTP fetch with automatic x402 payment handling. If the endpoint returns 402, signs payment and retries \u2014 no manual payment steps needed. Run 'check <url>' first to confirm the request body schema; skipping this causes 400 errors from wrong field names.`,
65
+ epilogue: `Workflow: check <url> \u2192 fetch <url> -m POST -b '{"field":"value"}'
66
+ Use 'fetch-auth' instead if the endpoint requires identity (SIWX) rather than payment.`
65
67
  },
66
68
  fetchWithAuth: {
67
69
  mcp: `HTTP fetch with automatic SIWX (Sign-In With X) authentication. Sends an authenticated request to a SIWX-protected endpoint. Returns response data gated by the endpoint's authentication requirements.
68
70
 
69
71
  For 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.`,
70
- cli: `HTTP fetch with automatic SIWX (Sign-In With X) authentication`
72
+ cli: `HTTP fetch with automatic SIWX (Sign-In With X) authentication for identity-gated endpoints. No payment required \u2014 the wallet is used as an identity proof only. Run 'check <url>' first to confirm the request body schema; skipping this causes 400 errors from wrong field names.`,
73
+ epilogue: `Workflow: check <url> \u2192 fetch-auth <url> -m POST -b '{"field":"value"}'
74
+ Use 'fetch' instead if the endpoint requires payment (x402) rather than identity.`
71
75
  },
72
76
  getWalletInfo: {
73
77
  mcp: `Get wallet address and USDC balance. Auto-creates wallet on first use (~/.agentcash/wallet.json). Returns a deposit link if funding is needed.`,
74
- cli: `Get wallet address, balance, and deposit link`
78
+ cli: `Get wallet address, USDC balance, and deposit link. Creates the wallet on first use (~/.agentcash/wallet.json). Check this before making paid API calls \u2014 if balance is zero, deposit USDC using the returned link.`
75
79
  },
76
80
  checkEndpointSchema: {
77
81
  mcp: [
@@ -79,7 +83,10 @@ For endpoints you haven't called before in this session, you MUST call check_end
79
83
  `Call this to see exactly what fields the request body expects and what the response contains.`,
80
84
  `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 \u2014 do this when pricing is range-based or quote-based, or when you're unsure about the input schema.`
81
85
  ].join("\n\n"),
82
- cli: `Check endpoint for schema and pricing without making payment`
86
+ cli: `Get the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec \u2014 call this before 'fetch' or 'fetch-auth' to avoid 400 errors. Pass --body to probe the endpoint live for an exact price quote when pricing is range-based or unclear.`,
87
+ epilogue: `Auth mode tells you which command to use:
88
+ paid \u2192 agentcash fetch <url>
89
+ SIWX \u2192 agentcash fetch-auth <url>`
83
90
  },
84
91
  discoverApiEndpoints: {
85
92
  mcp: [
@@ -87,15 +94,17 @@ For endpoints you haven't called before in this session, you MUST call check_end
87
94
  `Call this when you need to see what routes are available at an origin \u2014 whether it's one of the registered origins or any other origin you've identified as useful.`,
88
95
  `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.`
89
96
  ].join("\n\n"),
90
- cli: `Discover x402-protected or SIWX-protected endpoints on an origin`
97
+ 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.`,
98
+ epilogue: `Registered origins:
99
+ ${PRIMARY_ORIGINS.flatMap((o) => ORIGIN_METADATA[o] ? [` ${o} \u2014 ${ORIGIN_METADATA[o].description}`] : []).join("\n")}`
91
100
  },
92
101
  redeemInvite: {
93
102
  mcp: `Redeem an invite code for free USDC on Base. One-time use per code. Returns amount received and transaction hash. Use get_wallet_info after to verify balance.`,
94
- cli: `Redeem an invite code for free USDC`
103
+ cli: `Redeem an invite code for free USDC on Base. One-time use per code. Run 'wallet info' after to verify the balance landed.`
95
104
  },
96
105
  reportError: {
97
106
  mcp: `EMERGENCY ONLY. Report critical MCP tool bugs. Do NOT use for normal errors (balance, network, 4xx) \u2014 those are recoverable.`,
98
- cli: `Report a critical bug to the agentcash team (emergency only)`
107
+ 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 \u2014 those are recoverable without filing a report.`
99
108
  },
100
109
  serverInstructions: [
101
110
  `AgentCash lets you call protected APIs \u2014 handling both x402 micropayments and SIWX authentication seamlessly. It manages a USDC wallet for paid endpoints (fetch) and signs wallet proofs for identity-gated endpoints (fetch_with_auth).`,
@@ -179,4 +188,4 @@ export {
179
188
  REQUEST_PARAMS,
180
189
  TOOL_PARAMS
181
190
  };
182
- //# sourceMappingURL=chunk-RY34EBJ4.js.map
191
+ //# sourceMappingURL=chunk-VO7D4FSH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shared/origins.ts","../../src/shared/descriptions.ts"],"sourcesContent":["/**\n * Known x402-protected API origins.\n * Using const enum so values are inlined at build time.\n */\nexport const enum Origin {\n StableEnrich = 'https://stableenrich.dev',\n StableSocial = 'https://stablesocial.dev',\n StableStudio = 'https://stablestudio.dev',\n StableUpload = 'https://stableupload.dev',\n StableEmail = 'https://stableemail.dev',\n X402Scan = 'https://x402scan.com',\n Shirt = 'https://shirt.sh',\n X402Puppet = 'https://x402puppet.com',\n X402Facilitator = 'https://x402facilitator.com',\n}\n\n/**\n * Array of all known origins for iteration.\n * Const enums are erased at compile time, so we need a regular array for runtime iteration.\n */\nexport const ORIGINS = [\n Origin.StableEnrich,\n Origin.StableSocial,\n Origin.StableStudio,\n Origin.StableUpload,\n Origin.StableEmail,\n Origin.X402Scan,\n Origin.Shirt,\n Origin.X402Puppet,\n] as const;\n","/**\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 { 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, Grok twitter search, 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};\n\nconst PRIMARY_ORIGINS = [\n Origin.StableEnrich,\n Origin.StableSocial,\n Origin.StableStudio,\n Origin.StableUpload,\n Origin.StableEmail,\n] as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Tool descriptions — { mcp, cli } per tool + shared serverInstructions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const DESCRIPTIONS = {\n fetch: {\n mcp: `HTTP fetch with automatic x402 payment handling. Makes the request and, if the endpoint returns 402, signs payment and retries with payment headers. 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 x402 payment handling. If the endpoint returns 402, signs payment and retries — no manual payment steps needed. 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\"}'\\nUse 'fetch-auth' instead if the endpoint requires identity (SIWX) rather than payment.`,\n },\n\n fetchWithAuth: {\n mcp: `HTTP fetch with automatic SIWX (Sign-In With X) authentication. Sends an authenticated request to a SIWX-protected endpoint. Returns response data gated by the endpoint's authentication requirements.\\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 SIWX (Sign-In With X) authentication for identity-gated endpoints. No payment required — the wallet is used as an identity proof only. 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-auth <url> -m POST -b '{\"field\":\"value\"}'\\nUse 'fetch' instead if the endpoint requires payment (x402) rather than identity.`,\n },\n\n getWalletInfo: {\n mcp: `Get wallet address and USDC balance. Auto-creates wallet on first use (~/.agentcash/wallet.json). Returns a deposit link if funding is needed.`,\n cli: `Get wallet address, USDC balance, and deposit link. Creates the wallet on first use (~/.agentcash/wallet.json). Check this before making paid API calls — if balance is zero, deposit USDC using the returned link.`,\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 range-based or quote-based, or when you're unsure about the input schema.`,\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' or 'fetch-auth' to avoid 400 errors. Pass --body to probe the endpoint live for an exact price quote when pricing is range-based or unclear.`,\n epilogue: `Auth mode tells you which command to use:\\n paid → agentcash fetch <url>\\n SIWX → agentcash fetch-auth <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.`,\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.`,\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_wallet_info after to verify balance.`,\n cli: `Redeem an invite code for free USDC on Base. One-time use per code. Run 'wallet info' after to verify the balance landed.`,\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 serverInstructions: [\n `AgentCash lets you call protected APIs — handling both x402 micropayments and SIWX authentication seamlessly. It manages a USDC wallet for paid endpoints (fetch) and signs wallet proofs for identity-gated endpoints (fetch_with_auth).`,\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 [\n `If a task could be accomplished by one of these registered origins, run the workflow below:`,\n ...PRIMARY_ORIGINS.flatMap(o =>\n ORIGIN_METADATA[o]\n ? [` - ${o} — ${ORIGIN_METADATA[o].description}`]\n : []\n ),\n ].join('\\n'),\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 [\n `Workflow:`,\n `1. If you don't already know your balance, call get_wallet_info. You need a balance for paid endpoints — if it's zero, share the deposit link with the user. SIWX endpoints don't require a balance. You don't need to call this every turn, just before your first paid call or whenever you're unsure.`,\n `2. Call discover_api_endpoints() to get the endpoint index — a list of available routes with descriptions and auth modes. The auth mode for each endpoint tells you whether to use fetch (paid) or fetch_with_auth (SIWX).`,\n `3. 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 `4. Call fetch (paid) or fetch_with_auth (SIWX) based on the auth mode, and with the correct input schema.`,\n ].join('\\n'),\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} as const;\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: 'Request body for POST/PUT/PATCH methods',\n headers: 'Additional headers to include',\n timeout: 'Request timeout in milliseconds',\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Per-tool parameter and output schema descriptions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const TOOL_PARAMS = {\n fetch: {\n paymentMethod: 'Payment protocol to use. Defaults to auto-detect.',\n },\n\n checkEndpointSchema: {\n url: 'Full URL of the endpoint to inspect',\n method:\n 'HTTP method to check. If omitted, all methods declared in the spec are returned.',\n sampleInputBody:\n '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 headers: 'Additional headers to include in the probe request',\n },\n\n getWalletInfo: {\n output: {\n address: 'Wallet address (0x...)',\n balance: 'Total USDC balance across all chains',\n chains: 'Balance breakdown by chain',\n isNewWallet: 'Whether the wallet is new and needs to be funded',\n depositLink: 'Link to fund the wallet',\n message: 'Warning if balance is low',\n chain: 'Chain name',\n chainBalance: 'USDC balance on this chain',\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 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":";AAoBO,IAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ACZO,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,EACf;AACF;AAEA,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAMxB;AAMO,IAAM,eAAe;AAAA,EAC1B,OAAO;AAAA,IACL,KAAK;AAAA;AAAA;AAAA,IACL,KAAK;AAAA,IACL,UAAU;AAAA;AAAA,EACZ;AAAA,EAEA,eAAe;AAAA,IACb,KAAK;AAAA;AAAA;AAAA,IACL,KAAK;AAAA,IACL,UAAU;AAAA;AAAA,EACZ;AAAA,EAEA,eAAe;AAAA,IACb,KAAK;AAAA,IACL,KAAK;AAAA,EACP;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AAAA,IACF,SAAS;AAAA,EACX;AAAA,EAEA,eAAe;AAAA,IACb,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,aAAa;AAAA,MACb,SAAS;AAAA,MACT,OAAO;AAAA,MACP,cAAc;AAAA,IAChB;AAAA,EACF;AAAA,EAEA,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,QAAQ;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;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":[]}
@@ -6,14 +6,14 @@ import {
6
6
  createFetchWithAuth,
7
7
  createFetchWithPayment,
8
8
  requestSchema
9
- } from "./chunk-DBDSS3CQ.js";
10
- import "./chunk-RY34EBJ4.js";
9
+ } from "./chunk-JKTGKBTC.js";
10
+ import "./chunk-VO7D4FSH.js";
11
11
  import {
12
12
  TEMPO_RPC_URL,
13
13
  getWalletInfo,
14
14
  submitErrorReport
15
- } from "./chunk-NFKU5GQE.js";
16
- import "./chunk-OW3UV227.js";
15
+ } from "./chunk-NWBBICB3.js";
16
+ import "./chunk-FMIYI3CP.js";
17
17
  import {
18
18
  checkEndpoint,
19
19
  discoverResources
@@ -21,11 +21,11 @@ import {
21
21
  import {
22
22
  getPlatformPath,
23
23
  tryAddServer
24
- } from "./chunk-MQLBI77V.js";
24
+ } from "./chunk-OZ2ZEZNY.js";
25
25
  import "./chunk-JNYAKINU.js";
26
26
  import {
27
27
  MCP_VERSION
28
- } from "./chunk-HXRJ5ES4.js";
28
+ } from "./chunk-HTBRLSCW.js";
29
29
  import "./chunk-DZNSJ2BA.js";
30
30
  import {
31
31
  DEFAULT_NETWORK,
@@ -638,7 +638,7 @@ async function reportErrorCommand(args, flags) {
638
638
 
639
639
  // src/cli/commands/server.ts
640
640
  async function serverCommand(flags) {
641
- const { startServer } = await import("./server-GJVD7VNR.js");
641
+ const { startServer } = await import("./server-7YK4VUAT.js");
642
642
  await startServer(flags);
643
643
  }
644
644
 
@@ -1500,4 +1500,4 @@ export {
1500
1500
  walletInfoCommand,
1501
1501
  walletRedeemCommand
1502
1502
  };
1503
- //# sourceMappingURL=commands-M66YQJM7.js.map
1503
+ //# sourceMappingURL=commands-HERW4VHS.js.map
package/dist/esm/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  DESCRIPTIONS
4
- } from "./chunk-RY34EBJ4.js";
4
+ } from "./chunk-VO7D4FSH.js";
5
5
  import {
6
6
  isMppEnabled
7
- } from "./chunk-OW3UV227.js";
7
+ } from "./chunk-FMIYI3CP.js";
8
8
  import "./chunk-JNYAKINU.js";
9
9
  import {
10
10
  MCP_VERSION
11
- } from "./chunk-HXRJ5ES4.js";
11
+ } from "./chunk-HTBRLSCW.js";
12
12
 
13
13
  // src/index.ts
14
14
  import yargs from "yargs";
@@ -82,9 +82,9 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
82
82
  description: "Payment protocol to use",
83
83
  choices: isMppEnabled() ? ["x402", "mpp", "auto"] : ["x402", "auto"],
84
84
  default: "auto"
85
- }),
85
+ }).epilogue(DESCRIPTIONS.fetch.epilogue),
86
86
  async (args) => {
87
- const { fetchCommand } = await import("./commands-M66YQJM7.js");
87
+ const { fetchCommand } = await import("./commands-HERW4VHS.js");
88
88
  await fetchCommand(
89
89
  {
90
90
  url: args.url,
@@ -117,9 +117,9 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
117
117
  alias: "H",
118
118
  type: "string",
119
119
  description: "Additional headers as JSON object"
120
- }),
120
+ }).epilogue(DESCRIPTIONS.fetchWithAuth.epilogue),
121
121
  async (args) => {
122
- const { fetchAuthCommand } = await import("./commands-M66YQJM7.js");
122
+ const { fetchAuthCommand } = await import("./commands-HERW4VHS.js");
123
123
  await fetchAuthCommand(
124
124
  {
125
125
  url: args.url,
@@ -150,9 +150,9 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
150
150
  alias: "H",
151
151
  type: "string",
152
152
  description: "Additional headers as JSON object"
153
- }),
153
+ }).epilogue(DESCRIPTIONS.checkEndpointSchema.epilogue),
154
154
  async (args) => {
155
- const { checkCommand } = await import("./commands-M66YQJM7.js");
155
+ const { checkCommand } = await import("./commands-HERW4VHS.js");
156
156
  await checkCommand(
157
157
  {
158
158
  url: args.url,
@@ -173,9 +173,9 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
173
173
  }).option("include-guidance", {
174
174
  type: "boolean",
175
175
  description: "Guidance override: true=always include, false=never include, omitted=auto by threshold"
176
- }),
176
+ }).epilogue(DESCRIPTIONS.discoverApiEndpoints.epilogue),
177
177
  async (args) => {
178
- const { discoverCommand } = await import("./commands-M66YQJM7.js");
178
+ const { discoverCommand } = await import("./commands-HERW4VHS.js");
179
179
  await discoverCommand(
180
180
  { url: args.url, includeGuidance: args.includeGuidance },
181
181
  args
@@ -190,7 +190,7 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
190
190
  demandOption: true
191
191
  }),
192
192
  async (args) => {
193
- const { registerCommand } = await import("./commands-M66YQJM7.js");
193
+ const { registerCommand } = await import("./commands-HERW4VHS.js");
194
194
  await registerCommand({ url: args.url }, args);
195
195
  }
196
196
  ).command(
@@ -202,7 +202,7 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
202
202
  demandOption: true
203
203
  }),
204
204
  async (args) => {
205
- const { addSkillCommand } = await import("./commands-M66YQJM7.js");
205
+ const { addSkillCommand } = await import("./commands-HERW4VHS.js");
206
206
  await addSkillCommand({ url: args.url }, args);
207
207
  }
208
208
  ).command(
@@ -213,7 +213,7 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
213
213
  description: "The invite code to redeem (optional)"
214
214
  }),
215
215
  async (args) => {
216
- const { onboardCommand } = await import("./commands-M66YQJM7.js");
216
+ const { onboardCommand } = await import("./commands-HERW4VHS.js");
217
217
  await onboardCommand({ code: args.code ?? args.invite }, args);
218
218
  }
219
219
  ).command(
@@ -224,7 +224,7 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
224
224
  DESCRIPTIONS.getWalletInfo.cli,
225
225
  (yargs3) => yargs3,
226
226
  async (args) => {
227
- const { walletInfoCommand } = await import("./commands-M66YQJM7.js");
227
+ const { walletInfoCommand } = await import("./commands-HERW4VHS.js");
228
228
  await walletInfoCommand({}, args);
229
229
  }
230
230
  ).command(
@@ -236,7 +236,7 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
236
236
  demandOption: true
237
237
  }),
238
238
  async (args) => {
239
- const { walletRedeemCommand } = await import("./commands-M66YQJM7.js");
239
+ const { walletRedeemCommand } = await import("./commands-HERW4VHS.js");
240
240
  await walletRedeemCommand({ code: args.code }, args);
241
241
  }
242
242
  ).command(
@@ -244,7 +244,7 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
244
244
  "Get wallet address",
245
245
  (yargs3) => yargs3,
246
246
  async (args) => {
247
- const { walletAddressCommand } = await import("./commands-M66YQJM7.js");
247
+ const { walletAddressCommand } = await import("./commands-HERW4VHS.js");
248
248
  await walletAddressCommand({}, args);
249
249
  }
250
250
  ).demandCommand(1, "You must specify a wallet subcommand").strict(),
@@ -276,7 +276,7 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
276
276
  description: "Detailed report with context and repro steps"
277
277
  }),
278
278
  async (args) => {
279
- const { reportErrorCommand } = await import("./commands-M66YQJM7.js");
279
+ const { reportErrorCommand } = await import("./commands-HERW4VHS.js");
280
280
  await reportErrorCommand(
281
281
  {
282
282
  tool: args.tool,
@@ -294,7 +294,7 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
294
294
  "Start the MCP server (default when no command specified)",
295
295
  (yargs2) => yargs2,
296
296
  async (args) => {
297
- const { serverCommand } = await import("./commands-M66YQJM7.js");
297
+ const { serverCommand } = await import("./commands-HERW4VHS.js");
298
298
  await serverCommand(args);
299
299
  }
300
300
  ).command(
@@ -307,7 +307,7 @@ void yargs(hideBin(process.argv)).scriptName("agentcash").usage("$0 [command] [o
307
307
  default: isClaudeCode ? "claude-code" /* ClaudeCode */ : void 0
308
308
  }),
309
309
  async (args) => {
310
- const { installMcpServer } = await import("./install-4YDF4G6T.js");
310
+ const { installMcpServer } = await import("./install-LGAM7SWQ.js");
311
311
  await installMcpServer(args);
312
312
  }
313
313
  ).command(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { Clients } from './cli/install/clients';\nimport { isMppEnabled } from '@/shared/mpp-enabled';\nimport { MCP_VERSION } from '@/shared/version';\nimport { DESCRIPTIONS } from '@/shared/descriptions';\n\nconst isClaudeCode = Boolean(process.env.CLAUDECODE);\nconst defaultYes = isClaudeCode || Boolean(process.env.CI);\n\nvoid yargs(hideBin(process.argv))\n .scriptName('agentcash')\n .usage('$0 [command] [options]')\n .option('dev', {\n type: 'boolean',\n description: 'Enable dev mode (use localhost endpoints)',\n default: false,\n })\n .option('invite', {\n type: 'string',\n description: 'Invite code to redeem for starter money',\n required: false,\n })\n .option('yes', {\n alias: 'y',\n type: 'boolean',\n description: 'Yes to all prompts',\n default: defaultYes ? true : undefined,\n })\n .option('sessionId', {\n type: 'string',\n description:\n 'Session ID for matching requests (auto-generated if not provided)',\n required: false,\n })\n .option('provider', {\n type: 'string',\n description: 'Provider to use for the MCP server',\n required: false,\n })\n .option('format', {\n type: 'string',\n description:\n 'Output format: json (default for pipes) or pretty (default for TTY)',\n choices: ['json', 'pretty'],\n })\n .option('quiet', {\n alias: 'q',\n type: 'boolean',\n description: 'Suppress stderr output',\n default: false,\n })\n .option('verbose', {\n alias: 'v',\n type: 'boolean',\n description: 'Enable verbose logging (debug output to stderr)',\n default: false,\n })\n .middleware(async argv => {\n // Configure CLI context for shared modules (like logging)\n if (argv.verbose) {\n const { configureCliContext } = await import('@/shared/cli-context');\n configureCliContext({ verbose: true });\n }\n })\n // ============================================================\n // Core CLI Commands (for agent/programmatic use)\n // ============================================================\n .command(\n 'fetch <url>',\n DESCRIPTIONS.fetch.cli,\n yargs =>\n yargs\n .positional('url', {\n type: 'string',\n description: 'The endpoint URL to fetch',\n demandOption: true,\n })\n .option('method', {\n alias: 'm',\n type: 'string',\n description: 'HTTP method',\n choices: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],\n default: 'GET',\n })\n .option('body', {\n alias: 'b',\n type: 'string',\n description: 'Request body as JSON string',\n })\n .option('headers', {\n alias: 'H',\n type: 'string',\n description: 'Additional headers as JSON object',\n })\n .option('payment-method', {\n alias: 'p',\n type: 'string',\n description: 'Payment protocol to use',\n choices: isMppEnabled() ? ['x402', 'mpp', 'auto'] : ['x402', 'auto'],\n default: 'auto',\n }),\n async args => {\n const { fetchCommand } = await import('@/cli/commands');\n await fetchCommand(\n {\n url: args.url,\n method: args.method,\n body: args.body,\n headers: args.headers,\n paymentMethod: args.paymentMethod,\n },\n args\n );\n }\n )\n .command(\n 'fetch-auth <url>',\n DESCRIPTIONS.fetchWithAuth.cli,\n yargs =>\n yargs\n .positional('url', {\n type: 'string',\n description: 'The endpoint URL to fetch',\n demandOption: true,\n })\n .option('method', {\n alias: 'm',\n type: 'string',\n description: 'HTTP method',\n choices: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],\n default: 'GET',\n })\n .option('body', {\n alias: 'b',\n type: 'string',\n description: 'Request body as JSON string',\n })\n .option('headers', {\n alias: 'H',\n type: 'string',\n description: 'Additional headers as JSON object',\n }),\n async args => {\n const { fetchAuthCommand } = await import('@/cli/commands');\n await fetchAuthCommand(\n {\n url: args.url,\n method: args.method,\n body: args.body,\n headers: args.headers,\n },\n args\n );\n }\n )\n .command(\n 'check <url>',\n DESCRIPTIONS.checkEndpointSchema.cli,\n yargs =>\n yargs\n .positional('url', {\n type: 'string',\n description: 'The endpoint URL to check',\n demandOption: true,\n })\n .option('method', {\n alias: 'm',\n type: 'string',\n description:\n 'HTTP method to check. If omitted, all methods declared in the spec are returned.',\n choices: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],\n })\n .option('body', {\n alias: 'b',\n type: 'string',\n description: 'Request body as JSON string',\n })\n .option('headers', {\n alias: 'H',\n type: 'string',\n description: 'Additional headers as JSON object',\n }),\n async args => {\n const { checkCommand } = await import('@/cli/commands');\n await checkCommand(\n {\n url: args.url,\n method: args.method,\n body: args.body,\n headers: args.headers,\n },\n args\n );\n }\n )\n .command(\n 'discover <url>',\n DESCRIPTIONS.discoverApiEndpoints.cli,\n yargs =>\n yargs\n .positional('url', {\n type: 'string',\n description: 'The origin URL to discover endpoints from',\n demandOption: true,\n })\n .option('include-guidance', {\n type: 'boolean',\n description:\n 'Guidance override: true=always include, false=never include, omitted=auto by threshold',\n }),\n async args => {\n const { discoverCommand } = await import('@/cli/commands');\n await discoverCommand(\n { url: args.url, includeGuidance: args.includeGuidance },\n args\n );\n }\n )\n .command(\n 'register <url>',\n 'Register an origin with agentcash (discover + index endpoints)',\n yargs =>\n yargs.positional('url', {\n type: 'string',\n description: 'The origin URL to register',\n demandOption: true,\n }),\n async args => {\n const { registerCommand } = await import('@/cli/commands');\n await registerCommand({ url: args.url }, args);\n }\n )\n .command(\n 'add <url>',\n 'Add a skill to the agentcash MCP server',\n yargs =>\n yargs.positional('url', {\n type: 'string',\n description: 'The URL of the skill to add',\n demandOption: true,\n }),\n async args => {\n const { addSkillCommand } = await import('@/cli/commands');\n await addSkillCommand({ url: args.url }, args);\n }\n )\n .command(\n 'onboard [code]',\n 'Non-interactive onboarding flow for agentcash wallet + MCP setup',\n yargs =>\n yargs\n .positional('code', {\n type: 'string',\n description: 'The invite code to redeem (optional)',\n }),\n async args => {\n const { onboardCommand } = await import('@/cli/commands');\n await onboardCommand({ code: args.code ?? args.invite }, args);\n }\n )\n .command(\n 'wallet',\n 'Wallet management commands',\n yargs =>\n yargs\n .command(\n 'info',\n DESCRIPTIONS.getWalletInfo.cli,\n yargs => yargs,\n async args => {\n const { walletInfoCommand } = await import('@/cli/commands');\n await walletInfoCommand({}, args);\n }\n )\n .command(\n 'redeem <code>',\n DESCRIPTIONS.redeemInvite.cli,\n yargs =>\n yargs.positional('code', {\n type: 'string',\n description: 'The invite code to redeem',\n demandOption: true,\n }),\n async args => {\n const { walletRedeemCommand } = await import('@/cli/commands');\n await walletRedeemCommand({ code: args.code }, args);\n }\n )\n .command(\n 'address',\n 'Get wallet address',\n yargs => yargs,\n async args => {\n const { walletAddressCommand } = await import('@/cli/commands');\n await walletAddressCommand({}, args);\n }\n )\n .demandCommand(1, 'You must specify a wallet subcommand')\n .strict(),\n () => {\n // Show help for wallet command\n }\n )\n .command(\n 'report-error',\n DESCRIPTIONS.reportError.cli,\n yargs =>\n yargs\n .option('tool', {\n type: 'string',\n description: 'The tool/command that failed',\n demandOption: true,\n })\n .option('summary', {\n type: 'string',\n description: '1-2 sentence summary of the issue',\n demandOption: true,\n })\n .option('error-message', {\n type: 'string',\n description: 'The error message',\n demandOption: true,\n })\n .option('resource', {\n type: 'string',\n description: 'The x402 resource URL (if applicable)',\n })\n .option('stack', {\n type: 'string',\n description: 'Stack trace (if available)',\n })\n .option('full-report', {\n type: 'string',\n description: 'Detailed report with context and repro steps',\n }),\n async args => {\n const { reportErrorCommand } = await import('@/cli/commands');\n await reportErrorCommand(\n {\n tool: args.tool,\n summary: args.summary,\n errorMessage: args.errorMessage,\n resource: args.resource,\n stack: args.stack,\n fullReport: args.fullReport,\n },\n args\n );\n }\n )\n // ============================================================\n // Server & Installation Commands\n // ============================================================\n .command(\n ['$0', 'server'],\n 'Start the MCP server (default when no command specified)',\n yargs => yargs,\n async args => {\n const { serverCommand } = await import('@/cli/commands');\n await serverCommand(args);\n }\n )\n .command(\n 'install',\n 'Install the MCP server configuration for a client',\n yargs =>\n yargs.option('client', {\n type: 'string',\n description: 'The client name',\n required: false,\n default: isClaudeCode ? Clients.ClaudeCode : undefined,\n }),\n async args => {\n const { installMcpServer } = await import('@/cli/install');\n await installMcpServer(args);\n }\n )\n .command(\n 'fund',\n 'Open the funding page to add USDC to your wallet',\n yargs => yargs,\n async args => {\n const { fundMcpServer } = await import('@/cli/fund');\n await fundMcpServer(args);\n }\n )\n .example(\n '$0 fetch \"https://stableenrich.dev/api/apollo/people-enrich\" -m POST -b \\'{\"email\":\"user@example.com\"}\\'',\n 'Fetch with x402 payment'\n )\n .example(\n '$0 check \"https://stableenrich.dev/api/apollo/people-enrich\"',\n 'Check endpoint pricing'\n )\n .example(\n '$0 discover \"https://stableenrich.dev\"',\n 'Discover endpoints on origin'\n )\n .example(\n '$0 register \"https://stableenrich.dev\"',\n 'Register origin with agentcash'\n )\n .example(\n '$0 onboard ABC123',\n 'Install onboarding skill, configure MCP, and redeem an invite'\n )\n .example('$0 wallet info', 'Get wallet balance')\n .example('$0 wallet redeem ABC123', 'Redeem invite code')\n .example('$0', 'Start MCP server (default)')\n .example('$0 install --client cursor', 'Install MCP for Cursor')\n .strict()\n .epilogue(DESCRIPTIONS.serverInstructions)\n .help()\n .version(MCP_VERSION)\n .parseAsync()\n .catch(err => {\n // Output error in JSON format for agent consumption\n const response = {\n success: false,\n error: {\n code: 'GENERAL_ERROR',\n message: err instanceof Error ? err.message : String(err),\n surface: 'cli',\n cause: 'unknown',\n },\n };\n console.log(JSON.stringify(response, null, 2));\n process.exit(1);\n });\n"],"mappings":";;;;;;;;;;;;;AAEA,OA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Z,QAAM,WAAW;AAAA,IACf,SAAS;AAAA,IACT,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA,MACxD,SAAS;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACA,UAAQ,IAAI,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAC7C,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["yargs"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { Clients } from './cli/install/clients';\nimport { isMppEnabled } from '@/shared/mpp-enabled';\nimport { MCP_VERSION } from '@/shared/version';\nimport { DESCRIPTIONS } from '@/shared/descriptions';\n\nconst isClaudeCode = Boolean(process.env.CLAUDECODE);\nconst defaultYes = isClaudeCode || Boolean(process.env.CI);\n\nvoid yargs(hideBin(process.argv))\n .scriptName('agentcash')\n .usage('$0 [command] [options]')\n .option('dev', {\n type: 'boolean',\n description: 'Enable dev mode (use localhost endpoints)',\n default: false,\n })\n .option('invite', {\n type: 'string',\n description: 'Invite code to redeem for starter money',\n required: false,\n })\n .option('yes', {\n alias: 'y',\n type: 'boolean',\n description: 'Yes to all prompts',\n default: defaultYes ? true : undefined,\n })\n .option('sessionId', {\n type: 'string',\n description:\n 'Session ID for matching requests (auto-generated if not provided)',\n required: false,\n })\n .option('provider', {\n type: 'string',\n description: 'Provider to use for the MCP server',\n required: false,\n })\n .option('format', {\n type: 'string',\n description:\n 'Output format: json (default for pipes) or pretty (default for TTY)',\n choices: ['json', 'pretty'],\n })\n .option('quiet', {\n alias: 'q',\n type: 'boolean',\n description: 'Suppress stderr output',\n default: false,\n })\n .option('verbose', {\n alias: 'v',\n type: 'boolean',\n description: 'Enable verbose logging (debug output to stderr)',\n default: false,\n })\n .middleware(async argv => {\n // Configure CLI context for shared modules (like logging)\n if (argv.verbose) {\n const { configureCliContext } = await import('@/shared/cli-context');\n configureCliContext({ verbose: true });\n }\n })\n // ============================================================\n // Core CLI Commands (for agent/programmatic use)\n // ============================================================\n .command(\n 'fetch <url>',\n DESCRIPTIONS.fetch.cli,\n yargs =>\n yargs\n .positional('url', {\n type: 'string',\n description: 'The endpoint URL to fetch',\n demandOption: true,\n })\n .option('method', {\n alias: 'm',\n type: 'string',\n description: 'HTTP method',\n choices: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],\n default: 'GET',\n })\n .option('body', {\n alias: 'b',\n type: 'string',\n description: 'Request body as JSON string',\n })\n .option('headers', {\n alias: 'H',\n type: 'string',\n description: 'Additional headers as JSON object',\n })\n .option('payment-method', {\n alias: 'p',\n type: 'string',\n description: 'Payment protocol to use',\n choices: isMppEnabled() ? ['x402', 'mpp', 'auto'] : ['x402', 'auto'],\n default: 'auto',\n })\n .epilogue(DESCRIPTIONS.fetch.epilogue),\n async args => {\n const { fetchCommand } = await import('@/cli/commands');\n await fetchCommand(\n {\n url: args.url,\n method: args.method,\n body: args.body,\n headers: args.headers,\n paymentMethod: args.paymentMethod,\n },\n args\n );\n }\n )\n .command(\n 'fetch-auth <url>',\n DESCRIPTIONS.fetchWithAuth.cli,\n yargs =>\n yargs\n .positional('url', {\n type: 'string',\n description: 'The endpoint URL to fetch',\n demandOption: true,\n })\n .option('method', {\n alias: 'm',\n type: 'string',\n description: 'HTTP method',\n choices: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],\n default: 'GET',\n })\n .option('body', {\n alias: 'b',\n type: 'string',\n description: 'Request body as JSON string',\n })\n .option('headers', {\n alias: 'H',\n type: 'string',\n description: 'Additional headers as JSON object',\n })\n .epilogue(DESCRIPTIONS.fetchWithAuth.epilogue),\n async args => {\n const { fetchAuthCommand } = await import('@/cli/commands');\n await fetchAuthCommand(\n {\n url: args.url,\n method: args.method,\n body: args.body,\n headers: args.headers,\n },\n args\n );\n }\n )\n .command(\n 'check <url>',\n DESCRIPTIONS.checkEndpointSchema.cli,\n yargs =>\n yargs\n .positional('url', {\n type: 'string',\n description: 'The endpoint URL to check',\n demandOption: true,\n })\n .option('method', {\n alias: 'm',\n type: 'string',\n description:\n 'HTTP method to check. If omitted, all methods declared in the spec are returned.',\n choices: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],\n })\n .option('body', {\n alias: 'b',\n type: 'string',\n description: 'Request body as JSON string',\n })\n .option('headers', {\n alias: 'H',\n type: 'string',\n description: 'Additional headers as JSON object',\n })\n .epilogue(DESCRIPTIONS.checkEndpointSchema.epilogue),\n async args => {\n const { checkCommand } = await import('@/cli/commands');\n await checkCommand(\n {\n url: args.url,\n method: args.method,\n body: args.body,\n headers: args.headers,\n },\n args\n );\n }\n )\n .command(\n 'discover <url>',\n DESCRIPTIONS.discoverApiEndpoints.cli,\n yargs =>\n yargs\n .positional('url', {\n type: 'string',\n description: 'The origin URL to discover endpoints from',\n demandOption: true,\n })\n .option('include-guidance', {\n type: 'boolean',\n description:\n 'Guidance override: true=always include, false=never include, omitted=auto by threshold',\n })\n .epilogue(DESCRIPTIONS.discoverApiEndpoints.epilogue),\n async args => {\n const { discoverCommand } = await import('@/cli/commands');\n await discoverCommand(\n { url: args.url, includeGuidance: args.includeGuidance },\n args\n );\n }\n )\n .command(\n 'register <url>',\n 'Register an origin with agentcash (discover + index endpoints)',\n yargs =>\n yargs.positional('url', {\n type: 'string',\n description: 'The origin URL to register',\n demandOption: true,\n }),\n async args => {\n const { registerCommand } = await import('@/cli/commands');\n await registerCommand({ url: args.url }, args);\n }\n )\n .command(\n 'add <url>',\n 'Add a skill to the agentcash MCP server',\n yargs =>\n yargs.positional('url', {\n type: 'string',\n description: 'The URL of the skill to add',\n demandOption: true,\n }),\n async args => {\n const { addSkillCommand } = await import('@/cli/commands');\n await addSkillCommand({ url: args.url }, args);\n }\n )\n .command(\n 'onboard [code]',\n 'Non-interactive onboarding flow for agentcash wallet + MCP setup',\n yargs =>\n yargs\n .positional('code', {\n type: 'string',\n description: 'The invite code to redeem (optional)',\n }),\n async args => {\n const { onboardCommand } = await import('@/cli/commands');\n await onboardCommand({ code: args.code ?? args.invite }, args);\n }\n )\n .command(\n 'wallet',\n 'Wallet management commands',\n yargs =>\n yargs\n .command(\n 'info',\n DESCRIPTIONS.getWalletInfo.cli,\n yargs => yargs,\n async args => {\n const { walletInfoCommand } = await import('@/cli/commands');\n await walletInfoCommand({}, args);\n }\n )\n .command(\n 'redeem <code>',\n DESCRIPTIONS.redeemInvite.cli,\n yargs =>\n yargs.positional('code', {\n type: 'string',\n description: 'The invite code to redeem',\n demandOption: true,\n }),\n async args => {\n const { walletRedeemCommand } = await import('@/cli/commands');\n await walletRedeemCommand({ code: args.code }, args);\n }\n )\n .command(\n 'address',\n 'Get wallet address',\n yargs => yargs,\n async args => {\n const { walletAddressCommand } = await import('@/cli/commands');\n await walletAddressCommand({}, args);\n }\n )\n .demandCommand(1, 'You must specify a wallet subcommand')\n .strict(),\n () => {\n // Show help for wallet command\n }\n )\n .command(\n 'report-error',\n DESCRIPTIONS.reportError.cli,\n yargs =>\n yargs\n .option('tool', {\n type: 'string',\n description: 'The tool/command that failed',\n demandOption: true,\n })\n .option('summary', {\n type: 'string',\n description: '1-2 sentence summary of the issue',\n demandOption: true,\n })\n .option('error-message', {\n type: 'string',\n description: 'The error message',\n demandOption: true,\n })\n .option('resource', {\n type: 'string',\n description: 'The x402 resource URL (if applicable)',\n })\n .option('stack', {\n type: 'string',\n description: 'Stack trace (if available)',\n })\n .option('full-report', {\n type: 'string',\n description: 'Detailed report with context and repro steps',\n }),\n async args => {\n const { reportErrorCommand } = await import('@/cli/commands');\n await reportErrorCommand(\n {\n tool: args.tool,\n summary: args.summary,\n errorMessage: args.errorMessage,\n resource: args.resource,\n stack: args.stack,\n fullReport: args.fullReport,\n },\n args\n );\n }\n )\n // ============================================================\n // Server & Installation Commands\n // ============================================================\n .command(\n ['$0', 'server'],\n 'Start the MCP server (default when no command specified)',\n yargs => yargs,\n async args => {\n const { serverCommand } = await import('@/cli/commands');\n await serverCommand(args);\n }\n )\n .command(\n 'install',\n 'Install the MCP server configuration for a client',\n yargs =>\n yargs.option('client', {\n type: 'string',\n description: 'The client name',\n required: false,\n default: isClaudeCode ? Clients.ClaudeCode : undefined,\n }),\n async args => {\n const { installMcpServer } = await import('@/cli/install');\n await installMcpServer(args);\n }\n )\n .command(\n 'fund',\n 'Open the funding page to add USDC to your wallet',\n yargs => yargs,\n async args => {\n const { fundMcpServer } = await import('@/cli/fund');\n await fundMcpServer(args);\n }\n )\n .example(\n '$0 fetch \"https://stableenrich.dev/api/apollo/people-enrich\" -m POST -b \\'{\"email\":\"user@example.com\"}\\'',\n 'Fetch with x402 payment'\n )\n .example(\n '$0 check \"https://stableenrich.dev/api/apollo/people-enrich\"',\n 'Check endpoint pricing'\n )\n .example(\n '$0 discover \"https://stableenrich.dev\"',\n 'Discover endpoints on origin'\n )\n .example(\n '$0 register \"https://stableenrich.dev\"',\n 'Register origin with agentcash'\n )\n .example(\n '$0 onboard ABC123',\n 'Install onboarding skill, configure MCP, and redeem an invite'\n )\n .example('$0 wallet info', 'Get wallet balance')\n .example('$0 wallet redeem ABC123', 'Redeem invite code')\n .example('$0', 'Start MCP server (default)')\n .example('$0 install --client cursor', 'Install MCP for Cursor')\n .strict()\n .epilogue(DESCRIPTIONS.serverInstructions)\n .help()\n .version(MCP_VERSION)\n .parseAsync()\n .catch(err => {\n // Output error in JSON format for agent consumption\n const response = {\n success: false,\n error: {\n code: 'GENERAL_ERROR',\n message: err instanceof Error ? err.message : String(err),\n surface: 'cli',\n cause: 'unknown',\n },\n };\n console.log(JSON.stringify(response, null, 2));\n process.exit(1);\n });\n"],"mappings":";;;;;;;;;;;;;AAEA,OAAO,WAAW;AAClB,SAAS,eAAe;AAMxB,IAAM,eAAe,QAAQ,QAAQ,IAAI,UAAU;AACnD,IAAM,aAAa,gBAAgB,QAAQ,QAAQ,IAAI,EAAE;AAEzD,KAAK,MAAM,QAAQ,QAAQ,IAAI,CAAC,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,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAAA,MACxD,SAAS;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACA,UAAQ,IAAI,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAC7C,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["yargs"]}
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  addServer
3
- } from "./chunk-MQLBI77V.js";
3
+ } from "./chunk-OZ2ZEZNY.js";
4
4
  import {
5
5
  Clients,
6
6
  clientMetadata
7
7
  } from "./chunk-JNYAKINU.js";
8
- import "./chunk-HXRJ5ES4.js";
8
+ import "./chunk-HTBRLSCW.js";
9
9
  import {
10
10
  promptDeposit
11
11
  } from "./chunk-KOMAKKV3.js";
@@ -176,4 +176,4 @@ var installMcpServer = async (flags) => {
176
176
  export {
177
177
  installMcpServer
178
178
  };
179
- //# sourceMappingURL=install-4YDF4G6T.js.map
179
+ //# sourceMappingURL=install-LGAM7SWQ.js.map
@@ -7,29 +7,29 @@ import {
7
7
  requestSchema,
8
8
  safeGetMppChallenge,
9
9
  safeGetPaymentRequired
10
- } from "./chunk-DBDSS3CQ.js";
10
+ } from "./chunk-JKTGKBTC.js";
11
11
  import {
12
12
  DESCRIPTIONS,
13
13
  ORIGINS,
14
14
  ORIGIN_METADATA,
15
15
  TOOL_PARAMS
16
- } from "./chunk-RY34EBJ4.js";
16
+ } from "./chunk-VO7D4FSH.js";
17
17
  import {
18
18
  TEMPO_RPC_URL,
19
19
  getTempoBalance,
20
20
  getWalletInfo,
21
21
  submitErrorReport
22
- } from "./chunk-NFKU5GQE.js";
22
+ } from "./chunk-NWBBICB3.js";
23
23
  import {
24
24
  isMppEnabled
25
- } from "./chunk-OW3UV227.js";
25
+ } from "./chunk-FMIYI3CP.js";
26
26
  import {
27
27
  checkEndpoint,
28
28
  discoverResources
29
29
  } from "./chunk-5EMDWOPZ.js";
30
30
  import {
31
31
  MCP_VERSION
32
- } from "./chunk-HXRJ5ES4.js";
32
+ } from "./chunk-HTBRLSCW.js";
33
33
  import {
34
34
  DEFAULT_NETWORK,
35
35
  getWallet,
@@ -1199,7 +1199,7 @@ import { dirname, join } from "path";
1199
1199
  import { fileURLToPath } from "url";
1200
1200
  function getVersion() {
1201
1201
  if (true) {
1202
- return "0.7.4";
1202
+ return "0.7.5";
1203
1203
  }
1204
1204
  const __dirname2 = dirname(fileURLToPath(import.meta.url));
1205
1205
  const pkg = JSON.parse(
@@ -1281,4 +1281,4 @@ var startServer = async (flags) => {
1281
1281
  export {
1282
1282
  startServer
1283
1283
  };
1284
- //# sourceMappingURL=server-GJVD7VNR.js.map
1284
+ //# sourceMappingURL=server-7YK4VUAT.js.map
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  getWalletInfo,
3
3
  submitErrorReport
4
- } from "../../chunk-NFKU5GQE.js";
5
- import "../../chunk-OW3UV227.js";
4
+ } from "../../chunk-NWBBICB3.js";
5
+ import "../../chunk-FMIYI3CP.js";
6
6
  import {
7
7
  SUPPORTED_METHODS,
8
8
  checkEndpoint,
9
9
  discoverResources
10
10
  } from "../../chunk-5EMDWOPZ.js";
11
- import "../../chunk-HXRJ5ES4.js";
11
+ import "../../chunk-HTBRLSCW.js";
12
12
  import "../../chunk-YUCA2PQT.js";
13
13
  import "../../chunk-TRPO7BKD.js";
14
14
  import "../../chunk-ISR6DJ53.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentcash",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Generic MCP server for calling x402-protected APIs with automatic payment handling",
5
5
  "type": "module",
6
6
  "main": "dist/esm/lib.js",
@@ -1,7 +0,0 @@
1
- // src/shared/mpp-enabled.ts
2
- var isMppEnabled = () => "0.7.4".includes("-mpp");
3
-
4
- export {
5
- isMppEnabled
6
- };
7
- //# sourceMappingURL=chunk-OW3UV227.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/shared/origins.ts","../../src/shared/descriptions.ts"],"sourcesContent":["/**\n * Known x402-protected API origins.\n * Using const enum so values are inlined at build time.\n */\nexport const enum Origin {\n StableEnrich = 'https://stableenrich.dev',\n StableSocial = 'https://stablesocial.dev',\n StableStudio = 'https://stablestudio.dev',\n StableUpload = 'https://stableupload.dev',\n StableEmail = 'https://stableemail.dev',\n X402Scan = 'https://x402scan.com',\n Shirt = 'https://shirt.sh',\n X402Puppet = 'https://x402puppet.com',\n X402Facilitator = 'https://x402facilitator.com',\n}\n\n/**\n * Array of all known origins for iteration.\n * Const enums are erased at compile time, so we need a regular array for runtime iteration.\n */\nexport const ORIGINS = [\n Origin.StableEnrich,\n Origin.StableSocial,\n Origin.StableStudio,\n Origin.StableUpload,\n Origin.StableEmail,\n Origin.X402Scan,\n Origin.Shirt,\n Origin.X402Puppet,\n] as const;\n","/**\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 { 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, Grok twitter search, 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};\n\nconst PRIMARY_ORIGINS = [\n Origin.StableEnrich,\n Origin.StableSocial,\n Origin.StableStudio,\n Origin.StableUpload,\n Origin.StableEmail,\n] as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Tool descriptions — { mcp, cli } per tool + shared serverInstructions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const DESCRIPTIONS = {\n fetch: {\n mcp: `HTTP fetch with automatic x402 payment handling. Makes the request and, if the endpoint returns 402, signs payment and retries with payment headers. 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 x402 payment handling.`,\n },\n\n fetchWithAuth: {\n mcp: `HTTP fetch with automatic SIWX (Sign-In With X) authentication. Sends an authenticated request to a SIWX-protected endpoint. Returns response data gated by the endpoint's authentication requirements.\\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 SIWX (Sign-In With X) authentication`,\n },\n\n getWalletInfo: {\n mcp: `Get wallet address and USDC balance. Auto-creates wallet on first use (~/.agentcash/wallet.json). Returns a deposit link if funding is needed.`,\n cli: `Get wallet address, balance, and deposit link`,\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 range-based or quote-based, or when you're unsure about the input schema.`,\n ].join('\\n\\n'),\n cli: `Check endpoint for schema and pricing without making payment`,\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.`,\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: `Discover x402-protected or SIWX-protected endpoints on an origin`,\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_wallet_info after to verify balance.`,\n cli: `Redeem an invite code for free USDC`,\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)`,\n },\n\n serverInstructions: [\n `AgentCash lets you call protected APIs — handling both x402 micropayments and SIWX authentication seamlessly. It manages a USDC wallet for paid endpoints (fetch) and signs wallet proofs for identity-gated endpoints (fetch_with_auth).`,\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 [\n `If a task could be accomplished by one of these registered origins, run the workflow below:`,\n ...PRIMARY_ORIGINS.flatMap(o =>\n ORIGIN_METADATA[o]\n ? [` - ${o} — ${ORIGIN_METADATA[o].description}`]\n : []\n ),\n ].join('\\n'),\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 [\n `Workflow:`,\n `1. If you don't already know your balance, call get_wallet_info. You need a balance for paid endpoints — if it's zero, share the deposit link with the user. SIWX endpoints don't require a balance. You don't need to call this every turn, just before your first paid call or whenever you're unsure.`,\n `2. Call discover_api_endpoints() to get the endpoint index — a list of available routes with descriptions and auth modes. The auth mode for each endpoint tells you whether to use fetch (paid) or fetch_with_auth (SIWX).`,\n `3. 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 `4. Call fetch (paid) or fetch_with_auth (SIWX) based on the auth mode, and with the correct input schema.`,\n ].join('\\n'),\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} as const;\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: 'Request body for POST/PUT/PATCH methods',\n headers: 'Additional headers to include',\n timeout: 'Request timeout in milliseconds',\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Per-tool parameter and output schema descriptions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const TOOL_PARAMS = {\n fetch: {\n paymentMethod: 'Payment protocol to use. Defaults to auto-detect.',\n },\n\n checkEndpointSchema: {\n url: 'Full URL of the endpoint to inspect',\n method:\n 'HTTP method to check. If omitted, all methods declared in the spec are returned.',\n sampleInputBody:\n '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 headers: 'Additional headers to include in the probe request',\n },\n\n getWalletInfo: {\n output: {\n address: 'Wallet address (0x...)',\n balance: 'Total USDC balance across all chains',\n chains: 'Balance breakdown by chain',\n isNewWallet: 'Whether the wallet is new and needs to be funded',\n depositLink: 'Link to fund the wallet',\n message: 'Warning if balance is low',\n chain: 'Chain name',\n chainBalance: 'USDC balance on this chain',\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 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":";AAoBO,IAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ACZO,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,o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