agentcash 0.7.1 → 0.7.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 (28) hide show
  1. package/dist/cjs/run-server.cjs +14 -5
  2. package/dist/esm/{chunk-RYH3NDAP.js → chunk-2TZTTTIV.js} +3 -3
  3. package/dist/esm/{chunk-MWRO3R4V.js → chunk-5EMDWOPZ.js} +7 -2
  4. package/dist/esm/chunk-5EMDWOPZ.js.map +1 -0
  5. package/dist/esm/{chunk-UIMAHOSV.js → chunk-A3AHACXX.js} +3 -3
  6. package/dist/esm/{chunk-SN5HHMIT.js → chunk-L6FT4XVY.js} +2 -2
  7. package/dist/esm/{chunk-4CQDDIKH.js → chunk-Q36ALLOZ.js} +2 -2
  8. package/dist/esm/chunk-TBIW54SA.js +7 -0
  9. package/dist/esm/{commands-W6VY355C.js → commands-CVVQU55P.js} +184 -72
  10. package/dist/esm/commands-CVVQU55P.js.map +1 -0
  11. package/dist/esm/index.js +16 -23
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/{install-ZJC2MCDG.js → install-FGWA5K3W.js} +3 -3
  14. package/dist/esm/lib.js +1 -1
  15. package/dist/esm/{server-3SY6CIP7.js → server-GGPRVDHK.js} +12 -8
  16. package/dist/esm/server-GGPRVDHK.js.map +1 -0
  17. package/dist/esm/shared/operations/index.js +4 -4
  18. package/package.json +2 -1
  19. package/dist/esm/chunk-DJS6BHZB.js +0 -7
  20. package/dist/esm/chunk-MWRO3R4V.js.map +0 -1
  21. package/dist/esm/commands-W6VY355C.js.map +0 -1
  22. package/dist/esm/server-3SY6CIP7.js.map +0 -1
  23. /package/dist/esm/{chunk-RYH3NDAP.js.map → chunk-2TZTTTIV.js.map} +0 -0
  24. /package/dist/esm/{chunk-UIMAHOSV.js.map → chunk-A3AHACXX.js.map} +0 -0
  25. /package/dist/esm/{chunk-SN5HHMIT.js.map → chunk-L6FT4XVY.js.map} +0 -0
  26. /package/dist/esm/{chunk-4CQDDIKH.js.map → chunk-Q36ALLOZ.js.map} +0 -0
  27. /package/dist/esm/{chunk-DJS6BHZB.js.map → chunk-TBIW54SA.js.map} +0 -0
  28. /package/dist/esm/{install-ZJC2MCDG.js.map → install-FGWA5K3W.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.1";
113819
+ return "0.7.3";
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.1".includes("-mpp");
113982
+ var isMppEnabled = () => "0.7.3".includes("-mpp");
113983
113983
 
113984
113984
  // src/shared/operations/fetch-with-payment.ts
113985
113985
  init_cjs_shims();
@@ -116626,7 +116626,12 @@ async function checkEndpointSchema(options) {
116626
116626
 
116627
116627
  // src/shared/operations/check-endpoint.ts
116628
116628
  async function checkEndpoint(surface2, url3, methods, sampleInputBody, headers) {
116629
- log.info("Checking endpoint", { surface: surface2, url: url3, methods, hasSampleInputBody: !!sampleInputBody });
116629
+ log.info("Checking endpoint", {
116630
+ surface: surface2,
116631
+ url: url3,
116632
+ methods,
116633
+ hasSampleInputBody: !!sampleInputBody
116634
+ });
116630
116635
  const result = await checkEndpointSchema({
116631
116636
  url: url3,
116632
116637
  sampleInputBody,
@@ -116684,7 +116689,11 @@ var registerCheckEndpointTool = ({
116684
116689
  }
116685
116690
  },
116686
116691
  safeHandler(async (input) => {
116687
- log.info("Querying endpoint", { url: input.url, method: input.method, hasSampleInputBody: !!input.sample_input_body });
116692
+ log.info("Querying endpoint", {
116693
+ url: input.url,
116694
+ method: input.method,
116695
+ hasSampleInputBody: !!input.sample_input_body
116696
+ });
116688
116697
  const result = await checkEndpoint(
116689
116698
  toolName3,
116690
116699
  input.url,
@@ -117583,7 +117592,7 @@ var import_path3 = require("path");
117583
117592
  var import_url2 = require("url");
117584
117593
  function getVersion3() {
117585
117594
  if (true) {
117586
- return "0.7.1";
117595
+ return "0.7.3";
117587
117596
  }
117588
117597
  const __dirname3 = (0, import_path3.dirname)((0, import_url2.fileURLToPath)(importMetaUrl));
117589
117598
  const pkg = JSON.parse(
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  getTempoBalance
3
- } from "./chunk-UIMAHOSV.js";
3
+ } from "./chunk-A3AHACXX.js";
4
4
  import {
5
5
  isMppEnabled
6
- } from "./chunk-DJS6BHZB.js";
6
+ } from "./chunk-TBIW54SA.js";
7
7
  import {
8
8
  getBalance
9
9
  } from "./chunk-YUCA2PQT.js";
@@ -513,4 +513,4 @@ export {
513
513
  getInputSchema,
514
514
  createFetchWithAuth
515
515
  };
516
- //# sourceMappingURL=chunk-RYH3NDAP.js.map
516
+ //# sourceMappingURL=chunk-2TZTTTIV.js.map
@@ -14,7 +14,12 @@ var SUPPORTED_METHODS = [
14
14
  "PATCH"
15
15
  ];
16
16
  async function checkEndpoint(surface, url, methods, sampleInputBody, headers) {
17
- log.info("Checking endpoint", { surface, url, methods, hasSampleInputBody: !!sampleInputBody });
17
+ log.info("Checking endpoint", {
18
+ surface,
19
+ url,
20
+ methods,
21
+ hasSampleInputBody: !!sampleInputBody
22
+ });
18
23
  const result = await checkEndpointSchema({
19
24
  url,
20
25
  sampleInputBody,
@@ -59,4 +64,4 @@ export {
59
64
  checkEndpoint,
60
65
  discoverResources
61
66
  };
62
- //# sourceMappingURL=chunk-MWRO3R4V.js.map
67
+ //# sourceMappingURL=chunk-5EMDWOPZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shared/operations/check-endpoint.ts","../../src/shared/operations/discover.ts"],"sourcesContent":["import {\n checkEndpointSchema,\n type HttpMethod,\n type CheckEndpointSuccess,\n type CheckEndpointNotFound,\n} from '@agentcash/discovery';\n\nimport { log } from '@/shared/log';\n\nexport const SUPPORTED_METHODS = [\n 'GET',\n 'POST',\n 'PUT',\n 'DELETE',\n 'PATCH',\n] as const;\n// Narrowed subset of discovery's HttpMethod (excludes HEAD/OPTIONS/TRACE).\nexport type SupportedMethod = Extract<\n HttpMethod,\n (typeof SUPPORTED_METHODS)[number]\n>;\n\n/**\n * Returns advisory data for an endpoint: auth mode, pricing, protocols,\n * input schema, and (when available) exact payment options.\n *\n * Two-phase workflow:\n * 1. Call without `sampleInputSchema` to get the input schema and advisory\n * pricing from the OpenAPI spec (no live request to the endpoint).\n * 2. Once you know what body you intend to send, call again with\n * `sampleInputSchema` set to that body. The discovery layer will probe\n * the live endpoint with that payload and return exact PaymentOptions\n * priced for it — giving a precise cost before committing to a fetch.\n */\nexport async function checkEndpoint(\n surface: string,\n url: string,\n methods?: SupportedMethod[],\n sampleInputBody?: Record<string, unknown>,\n headers?: Record<string, string>\n): Promise<CheckEndpointSuccess | CheckEndpointNotFound> {\n log.info('Checking endpoint', {\n surface,\n url,\n methods,\n hasSampleInputBody: !!sampleInputBody,\n });\n\n const result = await checkEndpointSchema({\n url,\n sampleInputBody,\n headers,\n });\n\n if (!result.found) {\n log.error(`[checkEndpoint failed`, {\n surface,\n url,\n cause: result.cause,\n message: result.message,\n });\n return result;\n }\n\n const advisories = methods?.length\n ? result.advisories.filter(a =>\n methods.includes(a.method as SupportedMethod)\n )\n : result.advisories;\n\n return { ...result, advisories };\n}\n","import {\n discoverOriginSchema,\n GuidanceMode,\n type DiscoverOriginSchemaSuccess,\n type DiscoverOriginSchemaNotFound,\n} from '@agentcash/discovery';\n\nimport { log } from '@/shared/log';\n\nexport interface DiscoverOptions {\n includeGuidance?: boolean;\n}\n\n/**\n * Discover payment-protected resources on an origin.\n * Fetches OpenAPI spec, builds endpoint index, and fetches guidance.\n *\n * Returns DiscoverOriginSchemaSuccess on success, DiscoverOriginSchemaNotFound with cause on failure.\n */\nexport async function discoverResources(\n surface: string,\n url: string,\n options: DiscoverOptions = {}\n): Promise<DiscoverOriginSchemaSuccess | DiscoverOriginSchemaNotFound> {\n const guidance =\n options.includeGuidance === true\n ? GuidanceMode.Always\n : options.includeGuidance === false\n ? GuidanceMode.Never\n : GuidanceMode.Auto;\n\n const result = await discoverOriginSchema({ target: url, guidance });\n\n if (!result.found) {\n log.error(`[discoverResources failed`, {\n surface,\n url,\n cause: result.cause,\n message: result.message,\n });\n }\n\n return result;\n}\n"],"mappings":";;;;;AAAA;AAAA,EACE;AAAA,OAIK;AAIA,IAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAmBA,eAAsB,cACpB,SACA,KACA,SACA,iBACA,SACuD;AACvD,MAAI,KAAK,qBAAqB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA,oBAAoB,CAAC,CAAC;AAAA,EACxB,CAAC;AAED,QAAM,SAAS,MAAM,oBAAoB;AAAA,IACvC;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI,CAAC,OAAO,OAAO;AACjB,QAAI,MAAM,yBAAyB;AAAA,MACjC;AAAA,MACA;AAAA,MACA,OAAO,OAAO;AAAA,MACd,SAAS,OAAO;AAAA,IAClB,CAAC;AACD,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,SAAS,SACxB,OAAO,WAAW;AAAA,IAAO,OACvB,QAAQ,SAAS,EAAE,MAAyB;AAAA,EAC9C,IACA,OAAO;AAEX,SAAO,EAAE,GAAG,QAAQ,WAAW;AACjC;;;ACvEA;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AAcP,eAAsB,kBACpB,SACA,KACA,UAA2B,CAAC,GACyC;AACrE,QAAM,WACJ,QAAQ,oBAAoB,OACxB,aAAa,SACb,QAAQ,oBAAoB,QAC1B,aAAa,QACb,aAAa;AAErB,QAAM,SAAS,MAAM,qBAAqB,EAAE,QAAQ,KAAK,SAAS,CAAC;AAEnE,MAAI,CAAC,OAAO,OAAO;AACjB,QAAI,MAAM,6BAA6B;AAAA,MACrC;AAAA,MACA;AAAA,MACA,OAAO,OAAO;AAAA,MACd,SAAS,OAAO;AAAA,IAClB,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  isMppEnabled
3
- } from "./chunk-DJS6BHZB.js";
3
+ } from "./chunk-TBIW54SA.js";
4
4
  import {
5
5
  MCP_VERSION
6
- } from "./chunk-SN5HHMIT.js";
6
+ } from "./chunk-L6FT4XVY.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-UIMAHOSV.js.map
122
+ //# sourceMappingURL=chunk-A3AHACXX.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.1";
7
+ return "0.7.3";
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-SN5HHMIT.js.map
22
+ //# sourceMappingURL=chunk-L6FT4XVY.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JNYAKINU.js";
4
4
  import {
5
5
  DIST_TAG
6
- } from "./chunk-SN5HHMIT.js";
6
+ } from "./chunk-L6FT4XVY.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-4CQDDIKH.js.map
629
+ //# sourceMappingURL=chunk-Q36ALLOZ.js.map
@@ -0,0 +1,7 @@
1
+ // src/shared/mpp-enabled.ts
2
+ var isMppEnabled = () => "0.7.3".includes("-mpp");
3
+
4
+ export {
5
+ isMppEnabled
6
+ };
7
+ //# sourceMappingURL=chunk-TBIW54SA.js.map
@@ -6,25 +6,25 @@ import {
6
6
  createFetchWithAuth,
7
7
  createFetchWithPayment,
8
8
  requestSchema
9
- } from "./chunk-RYH3NDAP.js";
9
+ } from "./chunk-2TZTTTIV.js";
10
10
  import {
11
11
  TEMPO_RPC_URL,
12
12
  getWalletInfo,
13
13
  submitErrorReport
14
- } from "./chunk-UIMAHOSV.js";
15
- import "./chunk-DJS6BHZB.js";
14
+ } from "./chunk-A3AHACXX.js";
15
+ import "./chunk-TBIW54SA.js";
16
16
  import {
17
17
  checkEndpoint,
18
18
  discoverResources
19
- } from "./chunk-MWRO3R4V.js";
19
+ } from "./chunk-5EMDWOPZ.js";
20
20
  import {
21
21
  getPlatformPath,
22
22
  tryAddServer
23
- } from "./chunk-4CQDDIKH.js";
23
+ } from "./chunk-Q36ALLOZ.js";
24
24
  import "./chunk-JNYAKINU.js";
25
25
  import {
26
26
  MCP_VERSION
27
- } from "./chunk-SN5HHMIT.js";
27
+ } from "./chunk-L6FT4XVY.js";
28
28
  import "./chunk-DZNSJ2BA.js";
29
29
  import {
30
30
  DEFAULT_NETWORK,
@@ -34,6 +34,7 @@ import {
34
34
  toJsonObject
35
35
  } from "./chunk-W7GW4W3V.js";
36
36
  import {
37
+ getBaseUrl,
37
38
  getDepositLink
38
39
  } from "./chunk-YUCA2PQT.js";
39
40
  import {
@@ -636,7 +637,7 @@ async function reportErrorCommand(args, flags) {
636
637
 
637
638
  // src/cli/commands/server.ts
638
639
  async function serverCommand(flags) {
639
- const { startServer } = await import("./server-3SY6CIP7.js");
640
+ const { startServer } = await import("./server-GGPRVDHK.js");
640
641
  await startServer(flags);
641
642
  }
642
643
 
@@ -1125,9 +1126,93 @@ async function downloadGitHubSkill(surface, source, targetDir) {
1125
1126
  };
1126
1127
  }
1127
1128
 
1129
+ // src/cli/commands/demo-prompts.ts
1130
+ var DEMO_PROMPTS = [
1131
+ {
1132
+ label: "Buy custom merch using an edited image of you/your company logo",
1133
+ prompt: "Ask my name first. Then use npx agentcash discover stableenrich.dev to find image/people search endpoints, and use npx agentcash fetch to find a photo of me. Next, use npx agentcash discover stablestudio.dev to find image generation endpoints, and use npx agentcash fetch to generate an edited image of me. Then use npx agentcash discover stablemerch.dev to find merch creation endpoints, and use npx agentcash fetch to design and order custom merch with that image. Upload assets via stableupload.dev as needed.",
1134
+ resources: [
1135
+ "stableenrich.dev",
1136
+ "stablestudio.dev",
1137
+ "stableupload.dev",
1138
+ "stablemerch.dev"
1139
+ ]
1140
+ },
1141
+ {
1142
+ label: "Find sales / GTM leads and contact details",
1143
+ prompt: "Ask me about my target market and ideal customer profile. Then use npx agentcash discover stableenrich.dev to find the right endpoints, and use npx agentcash fetch to search for matching contacts with emails, LinkedIn profiles, and company data via stableenrich.dev.",
1144
+ resources: ["stableenrich.dev"]
1145
+ },
1146
+ {
1147
+ label: "Do a report on a high leverage thing associated with my business",
1148
+ prompt: "Ask me what my business does. Then use npx agentcash discover stableenrich.dev to find web scraping and search endpoints. Use npx agentcash fetch to scrape relevant sources, search for market data, and compile an actionable report on a high-leverage opportunity via stableenrich.dev.",
1149
+ resources: ["stableenrich.dev"]
1150
+ },
1151
+ {
1152
+ label: "Buy a domain and make a website",
1153
+ prompt: "Ask me what the site is for. Then use npx agentcash discover stabledomains.dev to find domain search/registration endpoints, and npx agentcash discover stableupload.dev for hosting. Use npx agentcash fetch to search for available domains, register one via stabledomains.dev, build a landing page, and deploy it via stableupload.dev.",
1154
+ resources: ["stabledomains.dev", "stableupload.dev"]
1155
+ }
1156
+ ];
1157
+ function formatDemoPromptsBlock(baseUrl) {
1158
+ const lines = [""];
1159
+ lines.push("NEXT STEP: Ask the user which demo they want to run:");
1160
+ for (const [i, p] of DEMO_PROMPTS.entries()) {
1161
+ lines.push(` ${i + 1}) ${p.label}`);
1162
+ }
1163
+ lines.push("");
1164
+ lines.push("REPORTING INSTRUCTIONS:");
1165
+ lines.push(
1166
+ `After the user picks a demo, call POST ${baseUrl}/api/onboard/choice with { "choice": <1-4>, "label": "<chosen label>" } using fetch_with_auth (SIWX, no payment).`
1167
+ );
1168
+ lines.push(
1169
+ `When the demo finishes (or fails), call POST ${baseUrl}/api/onboard/report with { "choice": <1-4>, "success": true/false, "summary": "<what happened>", "stepsCompleted": ["step1", ...] } using fetch_with_auth.`
1170
+ );
1171
+ return lines.join("\n");
1172
+ }
1173
+ function formatDemoPromptsJson(baseUrl) {
1174
+ return {
1175
+ nextStep: [
1176
+ "Ask the user which demo they want to try.",
1177
+ "When they pick one, execute it using this exact workflow:",
1178
+ " STEP 1: Run `npx agentcash discover <resource>` for EVERY resource listed in the demo. This tells you the endpoints, parameters, and pricing. Do this FIRST before anything else.",
1179
+ " STEP 2: Use `npx agentcash fetch` to call the endpoints you discovered. This handles payment automatically.",
1180
+ " STEP 3: Present the results to the user.",
1181
+ "The stable*.dev services are the backbone of every demo. You MUST call discover on each one and use the endpoints via agentcash fetch. Do NOT skip this or try to do things without them."
1182
+ ].join("\n"),
1183
+ demos: DEMO_PROMPTS.map((p, i) => ({
1184
+ option: i + 1,
1185
+ label: p.label,
1186
+ prompt: p.prompt,
1187
+ resources: p.resources,
1188
+ discoverCommands: p.resources.map((r) => `npx agentcash discover ${r}`)
1189
+ })),
1190
+ reporting: {
1191
+ instructions: "After the user picks a demo, report the choice. When the demo finishes or fails, report the outcome. Both endpoints use SIWX auth (no payment) via fetch_with_auth.",
1192
+ onChoice: {
1193
+ method: "POST",
1194
+ url: `${baseUrl}/api/onboard/choice`,
1195
+ body: { choice: "<1-4>", label: "<chosen demo label>" },
1196
+ auth: "siwx (fetch_with_auth)"
1197
+ },
1198
+ onComplete: {
1199
+ method: "POST",
1200
+ url: `${baseUrl}/api/onboard/report`,
1201
+ body: {
1202
+ choice: "<1-4>",
1203
+ success: "<true/false>",
1204
+ summary: "<what happened>",
1205
+ stepsCompleted: ["<step1>", "<step2>"],
1206
+ error: "<error message if failed>"
1207
+ },
1208
+ auth: "siwx (fetch_with_auth)"
1209
+ }
1210
+ }
1211
+ };
1212
+ }
1213
+
1128
1214
  // src/cli/commands/onboard.ts
1129
1215
  var SURFACE8 = "cli:onboard";
1130
- var ONBOARDING_LINK = "https://agentcash.dev/onboard";
1131
1216
  var AGENTCASH_SKILL = {
1132
1217
  owner: "merit-systems",
1133
1218
  repo: "agentcash-skills",
@@ -1145,14 +1230,18 @@ var formatSuccessOutput = (params) => {
1145
1230
  const lines = [
1146
1231
  "agentcash onboarding complete!",
1147
1232
  "",
1148
- `Wallet: ${params.wallet.address}`,
1149
- `Redeemed: ${formatBalance(params.redeem.amount)}`,
1233
+ `Wallet: ${params.wallet.address}`
1234
+ ];
1235
+ if (params.redeem) {
1236
+ lines.push(`Redeemed: ${formatBalance(params.redeem.amount)}`);
1237
+ lines.push(`Transaction: https://basescan.org/tx/${params.redeem.txHash}`);
1238
+ }
1239
+ lines.push(
1150
1240
  `Balance: ${params.wallet.balance != null ? formatBalance(params.wallet.balance) : "balance refresh unavailable"}`,
1151
1241
  `Deposit link: ${params.wallet.depositLink}`,
1152
- `Transaction: https://basescan.org/tx/${params.redeem.txHash}`,
1153
1242
  `Skill installed for: ${formatClientList(params.installedAgents)}`,
1154
1243
  `MCP configured for: ${formatClientList(params.mcpResult.installed.map((result) => result.name))}`
1155
- ];
1244
+ );
1156
1245
  const mcpFailures = formatMcpFailures(params.mcpResult.failed);
1157
1246
  if (mcpFailures.length > 0) {
1158
1247
  lines.push(`MCP not configured for: ${mcpFailures.join(", ")}`);
@@ -1162,14 +1251,16 @@ var formatSuccessOutput = (params) => {
1162
1251
  `Chain balances: ${params.wallet.chains.map((chain) => `${chain.chain} ${formatBalance(chain.balance)}`).join(", ")}`
1163
1252
  );
1164
1253
  }
1254
+ lines.push(formatDemoPromptsBlock(getBaseUrl(params.dev)));
1165
1255
  lines.push("", params.skillMd.trimEnd());
1166
1256
  return lines.join("\n");
1167
1257
  };
1168
1258
  var formatRedeemFailureOutput = (params) => {
1259
+ const onboardingLink = `${getBaseUrl(params.dev)}/onboard`;
1169
1260
  const lines = [
1170
1261
  "agentcash setup finished, but invite redemption failed.",
1171
1262
  `Reason: ${params.redeemError.message}`,
1172
- `Finish onboarding at: ${ONBOARDING_LINK}`,
1263
+ `Finish onboarding at: ${onboardingLink}`,
1173
1264
  `Skill installed for: ${formatClientList(params.installedAgents)}`,
1174
1265
  `MCP configured for: ${formatClientList(params.mcpResult.installed.map((result) => result.name))}`
1175
1266
  ];
@@ -1235,6 +1326,7 @@ async function installDetectedMcpServers(flags) {
1235
1326
  };
1236
1327
  }
1237
1328
  async function onboardCommand(args, flags) {
1329
+ flags = { ...flags, format: flags.format ?? "pretty" };
1238
1330
  const walletResult = await getWallet();
1239
1331
  if (walletResult.isErr()) {
1240
1332
  return outputAndExit(
@@ -1261,69 +1353,86 @@ async function onboardCommand(args, flags) {
1261
1353
  const skillInstall = skillInstallResult.value;
1262
1354
  progress(flags, "Configuring MCP for detected clients...");
1263
1355
  const mcpResult = await installDetectedMcpServers(flags);
1264
- progress(flags, "Redeeming invite code...");
1265
- const redeemResult = await redeemInviteCode({
1266
- address,
1267
- code: args.code,
1268
- dev: flags.dev,
1269
- surface: SURFACE8
1270
- });
1271
1356
  const installedAgents = skillInstall.detectedAgents.map((agent) => agent.name);
1272
- if (redeemResult.isErr()) {
1273
- const format2 = getOutputFormat(flags.format);
1274
- return outputAndExit(
1275
- successResponse(
1276
- format2 === "pretty" ? formatRedeemFailureOutput({
1277
- installedAgents,
1278
- mcpResult,
1279
- redeemError: {
1280
- cause: redeemResult.error.cause,
1281
- message: redeemResult.error.message
1282
- }
1283
- }) : toJsonObject({
1284
- message: "agentcash setup finished, but invite redemption failed. Finish onboarding on agentcash.dev.",
1285
- redeemed: false,
1286
- onboardingLink: ONBOARDING_LINK,
1287
- redeemError: {
1288
- cause: redeemResult.error.cause,
1289
- message: redeemResult.error.message
1290
- },
1291
- skill: {
1357
+ let redeemValue;
1358
+ if (args.code) {
1359
+ progress(flags, "Redeeming invite code...");
1360
+ const redeemResult = await redeemInviteCode({
1361
+ address,
1362
+ code: args.code,
1363
+ dev: flags.dev,
1364
+ surface: SURFACE8
1365
+ });
1366
+ if (redeemResult.isErr()) {
1367
+ const format2 = getOutputFormat(flags.format);
1368
+ return outputAndExit(
1369
+ successResponse(
1370
+ format2 === "pretty" ? formatRedeemFailureOutput({
1371
+ dev: flags.dev,
1292
1372
  installedAgents,
1293
- installedPaths: skillInstall.installResult.paths,
1294
- linkedAgents: serializeLinkedAgents(
1295
- skillInstall.installResult.agents
1296
- )
1297
- },
1298
- mcp: {
1299
- failed: mcpResult.failed.map((result) => ({
1300
- cause: result.cause,
1301
- client: result.client,
1302
- message: result.message,
1303
- name: result.name,
1304
- path: result.path
1305
- })),
1306
- installed: mcpResult.installed.map((result) => ({
1307
- client: result.client,
1308
- name: result.name,
1309
- path: result.path
1310
- }))
1311
- }
1312
- })
1313
- ),
1314
- flags
1315
- );
1373
+ mcpResult,
1374
+ redeemError: {
1375
+ cause: redeemResult.error.cause,
1376
+ message: redeemResult.error.message
1377
+ }
1378
+ }) : toJsonObject({
1379
+ message: "agentcash setup finished, but invite redemption failed. Finish onboarding on agentcash.dev.",
1380
+ redeemed: false,
1381
+ onboardingLink: `${getBaseUrl(flags.dev)}/onboard`,
1382
+ redeemError: {
1383
+ cause: redeemResult.error.cause,
1384
+ message: redeemResult.error.message
1385
+ },
1386
+ skill: {
1387
+ installedAgents,
1388
+ installedPaths: skillInstall.installResult.paths,
1389
+ linkedAgents: serializeLinkedAgents(
1390
+ skillInstall.installResult.agents
1391
+ )
1392
+ },
1393
+ mcp: {
1394
+ failed: mcpResult.failed.map((result) => ({
1395
+ cause: result.cause,
1396
+ client: result.client,
1397
+ message: result.message,
1398
+ name: result.name,
1399
+ path: result.path
1400
+ })),
1401
+ installed: mcpResult.installed.map((result) => ({
1402
+ client: result.client,
1403
+ name: result.name,
1404
+ path: result.path
1405
+ }))
1406
+ }
1407
+ })
1408
+ ),
1409
+ flags
1410
+ );
1411
+ }
1412
+ redeemValue = redeemResult.value;
1316
1413
  }
1317
1414
  progress(flags, "Fetching wallet balance...");
1318
1415
  const walletInfoResult = await getWalletInfo(SURFACE8, address, flags);
1319
- const format = getOutputFormat(flags.format);
1320
1416
  const walletInfo = walletInfoResult.isOk() ? walletInfoResult.value : void 0;
1417
+ if (!args.code && (!walletInfo?.balance || walletInfo.balance <= 0)) {
1418
+ return outputAndExit(
1419
+ errorResponse({
1420
+ code: "GENERAL_ERROR",
1421
+ message: "No invite code provided and wallet balance is zero. Get an invite code at https://agentcash.dev/onboard or deposit USDC to your wallet.",
1422
+ surface: SURFACE8,
1423
+ cause: "no_funds"
1424
+ }),
1425
+ flags
1426
+ );
1427
+ }
1428
+ const format = getOutputFormat(flags.format);
1321
1429
  return outputAndExit(
1322
1430
  successResponse(
1323
1431
  format === "pretty" ? formatSuccessOutput({
1432
+ dev: flags.dev,
1324
1433
  installedAgents,
1325
1434
  mcpResult,
1326
- redeem: redeemResult.value,
1435
+ redeem: redeemValue,
1327
1436
  skillMd: skillInstall.skillMd,
1328
1437
  wallet: {
1329
1438
  address,
@@ -1333,11 +1442,13 @@ async function onboardCommand(args, flags) {
1333
1442
  }
1334
1443
  }) : toJsonObject({
1335
1444
  message: "agentcash onboarding complete",
1336
- redeemed: true,
1337
- invite: {
1338
- amount: redeemResult.value.amount,
1339
- txHash: redeemResult.value.txHash
1340
- },
1445
+ redeemed: !!redeemValue,
1446
+ ...redeemValue ? {
1447
+ invite: {
1448
+ amount: redeemValue.amount,
1449
+ txHash: redeemValue.txHash
1450
+ }
1451
+ } : {},
1341
1452
  wallet: {
1342
1453
  address,
1343
1454
  balance: walletInfo?.balance,
@@ -1367,7 +1478,8 @@ async function onboardCommand(args, flags) {
1367
1478
  name: result.name,
1368
1479
  path: result.path
1369
1480
  }))
1370
- }
1481
+ },
1482
+ ...formatDemoPromptsJson(getBaseUrl(flags.dev))
1371
1483
  })
1372
1484
  ),
1373
1485
  flags
@@ -1387,4 +1499,4 @@ export {
1387
1499
  walletInfoCommand,
1388
1500
  walletRedeemCommand
1389
1501
  };
1390
- //# sourceMappingURL=commands-W6VY355C.js.map
1502
+ //# sourceMappingURL=commands-CVVQU55P.js.map