@t2000/cli 5.10.0 → 5.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80332,7 +80332,7 @@ Through this wallet you can reach essentially any major external API, billed to
80332
80332
  CRITICAL: When the user asks to use any external or paid API, names a provider (e.g. "via fal.ai", "with ElevenLabs"), or requests a capability one of the services above provides, DO NOT say you cannot reach that service, that it isn't on an allowlist, or that there's no connector \u2014 and do NOT fall back to writing a script for the user to run. You CAN do it directly through this wallet. Use t2000_services to discover the endpoint and request shape, then t2000_pay to execute, then show the user the result (display image/audio URLs returned in the response).
80333
80333
 
80334
80334
  Spending is the user's own USDC and every t2000_pay call is bounded by maxPrice. For larger or multi-step spends, state the estimated cost first and proceed once the user is happy. Use t2000_balance to check funds. The v4 wallet is payments-only; savings / lending live on audric.ai.`;
80335
- var PKG_VERSION = "5.10.0";
80335
+ var PKG_VERSION = "5.12.0";
80336
80336
  console.log = (...args) => console.error("[log]", ...args);
80337
80337
  console.warn = (...args) => console.error("[warn]", ...args);
80338
80338
  async function startMcpServer(opts) {
@@ -80398,4 +80398,4 @@ mime-types/index.js:
80398
80398
  @scure/bip39/index.js:
80399
80399
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
80400
80400
  */
80401
- //# sourceMappingURL=dist-5EASN5MD.js.map
80401
+ //# sourceMappingURL=dist-EC5V2CMY.js.map
package/dist/index.js CHANGED
@@ -32580,7 +32580,7 @@ function registerMcpStart(parent) {
32580
32580
  parent.command("start", { isDefault: true }).description("Start MCP server (stdio transport \u2014 for AI client integration)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
32581
32581
  let mod2;
32582
32582
  try {
32583
- mod2 = await import("./dist-5EASN5MD.js");
32583
+ mod2 = await import("./dist-EC5V2CMY.js");
32584
32584
  } catch {
32585
32585
  console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
32586
32586
  process.exit(1);
@@ -33192,9 +33192,9 @@ Subcommands:
33192
33192
  ).option("--price <usdc>", "Price per call in USDC (e.g. 0.02) \u2014 buyers pay this").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE2})`).action(
33193
33193
  async (opts) => {
33194
33194
  try {
33195
- if (!(opts.mcpEndpoint || opts.paymentMethods || opts.price)) {
33195
+ if (opts.mcpEndpoint === void 0 && opts.paymentMethods === void 0 && opts.price === void 0) {
33196
33196
  throw new Error(
33197
- "Provide at least one of --mcp-endpoint, --payment-methods, --price."
33197
+ 'Provide at least one of --mcp-endpoint, --payment-methods, --price. (Pass --mcp-endpoint "" to clear your endpoint.)'
33198
33198
  );
33199
33199
  }
33200
33200
  if (opts.price !== void 0) {
@@ -33272,7 +33272,8 @@ Subcommands:
33272
33272
  });
33273
33273
  const body = result.body;
33274
33274
  const receipt = body?.receipt;
33275
- const paidUsd = typeof receipt?.grossMicros === "number" ? receipt.grossMicros / 1e6 : opts.amount ? Number.parseFloat(opts.amount) : result.cost ?? 0;
33275
+ const chargedMicros = receipt?.chargedMicros ?? receipt?.grossMicros;
33276
+ const paidUsd = typeof chargedMicros === "number" ? chargedMicros / 1e6 : opts.amount ? Number.parseFloat(opts.amount) : result.cost ?? 0;
33276
33277
  if (isJsonMode()) {
33277
33278
  printJson({
33278
33279
  seller,
@@ -33287,6 +33288,14 @@ Subcommands:
33287
33288
  printBlank();
33288
33289
  printSuccess(`Paid ${formatUsd(paidUsd)} to ${truncateAddress(seller)}`);
33289
33290
  if (receipt) {
33291
+ if (typeof receipt.refundMicros === "number" && receipt.refundMicros > 0 && typeof receipt.authorizedMicros === "number") {
33292
+ printKeyValue(
33293
+ "Authorized",
33294
+ `$${(receipt.authorizedMicros / 1e6).toFixed(6)}`
33295
+ );
33296
+ printKeyValue("Charged", `$${paidUsd.toFixed(6)}`);
33297
+ printKeyValue("Refunded", `$${(receipt.refundMicros / 1e6).toFixed(6)}`);
33298
+ }
33290
33299
  if (typeof receipt.netMicros === "number") {
33291
33300
  printKeyValue("Seller received", `$${(receipt.netMicros / 1e6).toFixed(6)}`);
33292
33301
  }
@@ -33308,6 +33317,34 @@ Subcommands:
33308
33317
  }
33309
33318
  }
33310
33319
  );
33320
+ group.command("earnings").description(
33321
+ "Your sales as a seller \u2014 count, USDC earned (net), and unique buyers, from the on-chain settlement ledger. [Agent Commerce]"
33322
+ ).option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
33323
+ try {
33324
+ const gateway = opts.gateway ?? DEFAULT_GATEWAY;
33325
+ const agent = await withAgent({ keyPath: opts.key });
33326
+ const address = agent.address();
33327
+ const stats = await fetchJson(
33328
+ `${gateway}/commerce/stats/${address}`,
33329
+ { method: "GET" }
33330
+ );
33331
+ if (isJsonMode()) {
33332
+ printJson({ address, ...stats });
33333
+ return;
33334
+ }
33335
+ printBlank();
33336
+ printSuccess(`Earnings for ${truncateAddress(address)}`);
33337
+ printKeyValue("Sales", String(stats.sales ?? 0));
33338
+ printKeyValue("Earned (net)", `$${(stats.volumeUsd ?? 0).toFixed(6)} USDC`);
33339
+ printKeyValue("Unique buyers", String(stats.buyers ?? 0));
33340
+ if (stats.lastSaleAt) {
33341
+ printKeyValue("Last sale", new Date(stats.lastSaleAt).toISOString());
33342
+ }
33343
+ printBlank();
33344
+ } catch (error) {
33345
+ handleError(error);
33346
+ }
33347
+ });
33311
33348
  group.command("handle").argument("<label>", "Handle label (3\u201320 chars: lowercase a\u2013z, 0\u20139, hyphens)").description(
33312
33349
  "Claim <label>.agent-id.sui \u2192 this wallet (custody-minted, gasless). Use --release to give it up."
33313
33350
  ).option("--release", "Release (revoke) this handle instead of claiming it").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE2})`).action(