@t2000/cli 5.7.3 → 5.9.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.7.3";
80335
+ var PKG_VERSION = "5.9.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-HFB2G5PO.js.map
80401
+ //# sourceMappingURL=dist-KMGEM6TT.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-HFB2G5PO.js");
32583
+ mod2 = await import("./dist-KMGEM6TT.js");
32584
32584
  } catch {
32585
32585
  console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
32586
32586
  process.exit(1);
@@ -32921,6 +32921,7 @@ For MCP-aware clients (Claude Desktop, Cursor, Windsurf), prefer
32921
32921
 
32922
32922
  // src/commands/agent/index.ts
32923
32923
  var DEFAULT_API_BASE2 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
32924
+ var DEFAULT_GATEWAY = process.env.T2000_GATEWAY_URL ?? "https://mpp.t2000.ai";
32924
32925
  function normalizeTopupAsset(input) {
32925
32926
  return input?.toLowerCase() === "usdsui" ? "USDsui" : "USDC";
32926
32927
  }
@@ -33183,6 +33184,118 @@ Subcommands:
33183
33184
  }
33184
33185
  }
33185
33186
  );
33187
+ group.command("service").description(
33188
+ "Declare this agent's paid service \u2014 an MCP endpoint + accepted payment methods (e.g. x402). Sponsored, gasless. Lights up Service / x402 in the directory."
33189
+ ).option("--mcp-endpoint <url>", "Your agent service endpoint (https)").option(
33190
+ "--payment-methods <list>",
33191
+ 'Comma-separated methods you accept, e.g. "x402"'
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
+ async (opts) => {
33194
+ try {
33195
+ if (!(opts.mcpEndpoint || opts.paymentMethods || opts.price)) {
33196
+ throw new Error(
33197
+ "Provide at least one of --mcp-endpoint, --payment-methods, --price."
33198
+ );
33199
+ }
33200
+ if (opts.price !== void 0) {
33201
+ const p = Number.parseFloat(opts.price);
33202
+ if (Number.isNaN(p) || p <= 0) {
33203
+ throw new Error(`--price must be a positive number (got "${opts.price}").`);
33204
+ }
33205
+ }
33206
+ const base = opts.api ?? DEFAULT_API_BASE2;
33207
+ const agent = await withAgent({ keyPath: opts.key });
33208
+ const address = agent.address();
33209
+ const prepareBody = { address };
33210
+ if (opts.mcpEndpoint !== void 0) {
33211
+ prepareBody.mcpEndpoint = opts.mcpEndpoint;
33212
+ }
33213
+ if (opts.paymentMethods !== void 0) {
33214
+ prepareBody.paymentMethods = opts.paymentMethods.split(",").map((s) => s.trim()).filter(Boolean);
33215
+ }
33216
+ if (opts.price !== void 0) {
33217
+ prepareBody.priceUsdc = opts.price;
33218
+ }
33219
+ const { digest } = await runSponsoredTx({
33220
+ keypair: agent.keypair,
33221
+ actor: address,
33222
+ prepareUrl: `${base}/agent/service/prepare`,
33223
+ prepareBody,
33224
+ submitUrl: `${base}/agent/service/submit`
33225
+ });
33226
+ if (isJsonMode()) {
33227
+ printJson({ address, updated: true, digest });
33228
+ return;
33229
+ }
33230
+ printBlank();
33231
+ printSuccess("Service declared \u2014 showing in the directory.");
33232
+ if (opts.mcpEndpoint) {
33233
+ printKeyValue("MCP endpoint", opts.mcpEndpoint);
33234
+ }
33235
+ if (opts.paymentMethods) {
33236
+ printKeyValue("Payment methods", opts.paymentMethods);
33237
+ }
33238
+ if (opts.price) {
33239
+ printKeyValue("Price", `$${opts.price} USDC`);
33240
+ }
33241
+ printKeyValue("Tx", String(digest));
33242
+ printBlank();
33243
+ } catch (error) {
33244
+ handleError(error);
33245
+ }
33246
+ }
33247
+ );
33248
+ group.command("pay").argument("<seller>", "The seller agent's Sui address").description(
33249
+ "Pay a seller agent for a service (gateway-mediated, USDC). t2000 collects, keeps a small fee, and forwards the rest to the seller \u2014 with a receipt. [Agent Commerce]"
33250
+ ).option("--amount <usdc>", "Override the price (default: the seller's declared price)").option("--max-price <usdc>", "Max USDC to auto-approve (default 1.00, or --amount)").option(
33251
+ "--gateway <url>",
33252
+ `Gateway base URL (default ${DEFAULT_GATEWAY})`
33253
+ ).option("--force", "Override spending limits for this call (see `t2 limit`)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(
33254
+ async (seller, opts) => {
33255
+ try {
33256
+ if (opts.amount !== void 0) {
33257
+ const a = Number.parseFloat(opts.amount);
33258
+ if (Number.isNaN(a) || a <= 0) {
33259
+ throw new Error(`--amount must be a positive number (got "${opts.amount}").`);
33260
+ }
33261
+ }
33262
+ const maxPrice = opts.maxPrice ? Number.parseFloat(opts.maxPrice) : opts.amount ? Number.parseFloat(opts.amount) : 1;
33263
+ const gateway = opts.gateway ?? DEFAULT_GATEWAY;
33264
+ const agent = await withAgent({ keyPath: opts.key });
33265
+ const url = opts.amount ? `${gateway}/commerce/pay/${seller}?amount=${encodeURIComponent(opts.amount)}` : `${gateway}/commerce/pay/${seller}`;
33266
+ const result = await agent.pay({ url, method: "POST", maxPrice, force: opts.force });
33267
+ const body = result.body;
33268
+ const receipt = body?.receipt;
33269
+ const paidUsd = typeof receipt?.grossMicros === "number" ? receipt.grossMicros / 1e6 : opts.amount ? Number.parseFloat(opts.amount) : result.cost ?? 0;
33270
+ if (isJsonMode()) {
33271
+ printJson({
33272
+ seller,
33273
+ amount: paidUsd,
33274
+ paid: result.paid,
33275
+ cost: result.cost,
33276
+ receipt
33277
+ });
33278
+ return;
33279
+ }
33280
+ printBlank();
33281
+ printSuccess(`Paid ${formatUsd(paidUsd)} to ${truncateAddress(seller)}`);
33282
+ if (receipt) {
33283
+ if (typeof receipt.netMicros === "number") {
33284
+ printKeyValue("Seller received", `$${(receipt.netMicros / 1e6).toFixed(6)}`);
33285
+ }
33286
+ if (typeof receipt.feeMicros === "number") {
33287
+ printKeyValue("Facilitator fee", `$${(receipt.feeMicros / 1e6).toFixed(6)}`);
33288
+ }
33289
+ if (receipt.forwardDigest) {
33290
+ printKeyValue("Settlement tx", receipt.forwardDigest);
33291
+ }
33292
+ }
33293
+ printBlank();
33294
+ } catch (error) {
33295
+ handleError(error);
33296
+ }
33297
+ }
33298
+ );
33186
33299
  group.command("handle").argument("<label>", "Handle label (3\u201320 chars: lowercase a\u2013z, 0\u20139, hyphens)").description(
33187
33300
  "Claim <label>.agent-id.sui \u2192 this wallet (custody-minted, gasless). Use --release to give it up."
33188
33301
  ).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(