@t2000/cli 10.17.4 → 10.18.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.
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  validateAddress,
33
33
  verifyJobForSeller,
34
34
  walletExists
35
- } from "./chunk-F2KFMF7W.js";
35
+ } from "./chunk-PXQ3GPIL.js";
36
36
  import "./chunk-634W6JCI.js";
37
37
  import "./chunk-3ZUWXUSN.js";
38
38
  import "./chunk-QSITA6GU.js";
@@ -22271,7 +22271,7 @@ async function runEstimate(url, opts) {
22271
22271
  let req = accepts.find((a) => a.scheme === "exact" && a.network?.startsWith("sui:")) ?? accepts[0];
22272
22272
  let dialect = "x402";
22273
22273
  if (!req) {
22274
- const { parseMppSuiChallenge } = await import("./dist-7RYTY436.js");
22274
+ const { parseMppSuiChallenge } = await import("./dist-6ARPIZ47.js");
22275
22275
  const challenge = await parseMppSuiChallenge(response);
22276
22276
  if (!challenge) {
22277
22277
  throw new Error(
@@ -23089,7 +23089,7 @@ function registerMcpStart(parent) {
23089
23089
  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) => {
23090
23090
  let mod;
23091
23091
  try {
23092
- mod = await import("./dist-26EILMT5.js");
23092
+ mod = await import("./dist-7E74C4U2.js");
23093
23093
  } catch {
23094
23094
  console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
23095
23095
  process.exit(1);
@@ -23978,10 +23978,13 @@ Subcommands:
23978
23978
  );
23979
23979
  group.command("sell").argument(
23980
23980
  "[endpoint]",
23981
- "Your x402 endpoint URL (https). Omit with --remove to clear the listing."
23981
+ "Your API origin (https://api.example.com \u2014 every paid route in its openapi.json gets listed) or one x402 route URL. Omit with --remove to clear the listing."
23982
23982
  ).description(
23983
- 'List your x402 endpoint on your public Agent ID profile. The endpoint is live-probed (must answer 402 with a Sui payment challenge), then set on-chain \u2014 sponsored, gasless. Same flow as the console\u2019s "Sell your API".'
23983
+ 'List your x402 API on your public Agent ID profile. An origin expands via {origin}/openapi.json \u2014 every paid route is live-probed (must answer 402 with a Sui payment challenge) and becomes a store card; a single 402 URL lists just that route. Then set on-chain \u2014 sponsored, gasless. Same flow as the console\u2019s "Sell your API".'
23984
23984
  ).option("--remove", "Remove the listing instead").option(
23985
+ "--primary <path>",
23986
+ "Route to record as the on-chain primary endpoint (default: the cheapest paid route)"
23987
+ ).option(
23985
23988
  "--category <category>",
23986
23989
  `Directory category for your listing: ${AGENT_CATEGORIES.join(" | ")} (required unless already set on your profile)`
23987
23990
  ).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE3})`).action(
@@ -24003,13 +24006,27 @@ Subcommands:
24003
24006
  const prepRes = await fetch(`${base}/agent/endpoint/prepare`, {
24004
24007
  method: "POST",
24005
24008
  headers: { "Content-Type": "application/json" },
24006
- body: JSON.stringify({ address, endpoint: target })
24009
+ body: JSON.stringify({
24010
+ address,
24011
+ endpoint: target,
24012
+ ...opts.primary ? { primary: opts.primary } : {}
24013
+ })
24007
24014
  });
24008
24015
  const prep = await prepRes.json().catch(() => ({}));
24009
24016
  if (!prepRes.ok) {
24010
- const issues = prep.probe?.issues ?? [];
24011
24017
  const msg = typeof prep.error === "string" ? prep.error : prep.error?.message ?? `HTTP ${prepRes.status}`;
24012
- const detail = issues.map((i) => ` \u2717 ${i.message ?? i.code}`).join("\n");
24018
+ const lines = (prep.probe?.issues ?? []).map(
24019
+ (i) => ` \u2717 ${i.message ?? i.code}`
24020
+ );
24021
+ for (const r of prep.routes ?? []) {
24022
+ if (r.probeOk === false) {
24023
+ lines.push(` \u2717 ${r.method ?? "POST"} ${r.path}`);
24024
+ for (const i of r.issues ?? []) {
24025
+ lines.push(` ${i.message ?? i.code}`);
24026
+ }
24027
+ }
24028
+ }
24029
+ const detail = lines.join("\n");
24013
24030
  throw new Error(detail ? `${msg}
24014
24031
  ${detail}` : msg);
24015
24032
  }
@@ -24022,12 +24039,16 @@ ${detail}` : msg);
24022
24039
  method: "POST",
24023
24040
  body: { nonce: prep.nonce, address, signature }
24024
24041
  });
24042
+ const primaryUrl = prep.primary?.url ?? target;
24025
24043
  if (isJsonMode()) {
24026
24044
  printJson({
24027
24045
  address,
24028
- endpoint: opts.remove ? null : target,
24046
+ endpoint: opts.remove ? null : primaryUrl,
24029
24047
  listed: !opts.remove,
24030
24048
  probe: prep.probe ?? null,
24049
+ origin: prep.origin ?? null,
24050
+ primary: prep.primary ?? null,
24051
+ routes: prep.routes ?? [],
24031
24052
  digest: sub.digest
24032
24053
  });
24033
24054
  return;
@@ -24036,12 +24057,29 @@ ${detail}` : msg);
24036
24057
  if (opts.remove) {
24037
24058
  printSuccess("Listing removed.");
24038
24059
  } else {
24039
- printSuccess("Listed \u2014 your endpoint is live on your public profile.");
24040
- if (prep.probe?.amount) {
24041
- printKeyValue("Price", `${prep.probe.amount} USDC per call`);
24060
+ const routes = prep.routes ?? [];
24061
+ if (routes.length > 1) {
24062
+ printSuccess(
24063
+ `Listed \u2014 ${routes.length} paid routes are live on your public profile.`
24064
+ );
24065
+ for (const r of routes) {
24066
+ const mark = r.path === prep.primary?.path ? " (primary)" : "";
24067
+ const price = r.priceUsdc ? `${r.priceUsdc} USDC` : "?";
24068
+ printKeyValue(
24069
+ ` ${r.method ?? "POST"} ${r.path}`,
24070
+ `${price}${mark}`
24071
+ );
24072
+ }
24073
+ } else {
24074
+ printSuccess(
24075
+ "Listed \u2014 your endpoint is live on your public profile."
24076
+ );
24077
+ if (prep.probe?.amount) {
24078
+ printKeyValue("Price", `${prep.probe.amount} USDC per call`);
24079
+ }
24042
24080
  }
24043
- printKeyValue("Endpoint", target);
24044
- printInfo(`Buyers pay it with: t2 pay ${target}`);
24081
+ printKeyValue("Endpoint", primaryUrl);
24082
+ printInfo(`Buyers pay it with: t2 pay ${primaryUrl}`);
24045
24083
  printKeyValue("Profile", `https://t2000.ai/${address}`);
24046
24084
  }
24047
24085
  printKeyValue("Tx", String(sub.digest));