@t2000/cli 8.0.2 → 8.2.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
|
@@ -34177,7 +34177,7 @@ function registerMcpStart(parent) {
|
|
|
34177
34177
|
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) => {
|
|
34178
34178
|
let mod3;
|
|
34179
34179
|
try {
|
|
34180
|
-
mod3 = await import("./dist-
|
|
34180
|
+
mod3 = await import("./dist-7ZQFQB45.js");
|
|
34181
34181
|
} catch {
|
|
34182
34182
|
console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
|
|
34183
34183
|
process.exit(1);
|
|
@@ -34829,6 +34829,7 @@ Subcommands:
|
|
|
34829
34829
|
$ t2 agent create --name "Atlas Research" Wallet + Agent ID + profile in one pass
|
|
34830
34830
|
$ t2 agent register Existing wallet \u2192 on-chain Agent ID (gasless)
|
|
34831
34831
|
$ t2 agent handle alice Claim @alice
|
|
34832
|
+
$ t2 agent sell https://api.me.com/v1/x List your x402 endpoint (live-probed, gasless)
|
|
34832
34833
|
`
|
|
34833
34834
|
);
|
|
34834
34835
|
registerAgentCreate(group);
|
|
@@ -35003,6 +35004,74 @@ Subcommands:
|
|
|
35003
35004
|
}
|
|
35004
35005
|
}
|
|
35005
35006
|
);
|
|
35007
|
+
group.command("sell").argument(
|
|
35008
|
+
"[endpoint]",
|
|
35009
|
+
"Your x402 endpoint URL (https). Omit with --remove to clear the listing."
|
|
35010
|
+
).description(
|
|
35011
|
+
'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".'
|
|
35012
|
+
).option("--remove", "Remove the listing instead").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(
|
|
35013
|
+
async (endpoint, opts) => {
|
|
35014
|
+
try {
|
|
35015
|
+
if (!(opts.remove || endpoint)) {
|
|
35016
|
+
throw new Error(
|
|
35017
|
+
"Provide your x402 endpoint URL (or --remove to clear the listing)."
|
|
35018
|
+
);
|
|
35019
|
+
}
|
|
35020
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
35021
|
+
const agent = await withAgent({ keyPath: opts.key });
|
|
35022
|
+
const address = agent.address();
|
|
35023
|
+
const target = opts.remove ? "" : endpoint;
|
|
35024
|
+
const prepRes = await fetch(`${base}/agent/service/prepare`, {
|
|
35025
|
+
method: "POST",
|
|
35026
|
+
headers: { "Content-Type": "application/json" },
|
|
35027
|
+
body: JSON.stringify({ address, endpoint: target })
|
|
35028
|
+
});
|
|
35029
|
+
const prep = await prepRes.json().catch(() => ({}));
|
|
35030
|
+
if (!prepRes.ok) {
|
|
35031
|
+
const issues = prep.probe?.issues ?? [];
|
|
35032
|
+
const msg = typeof prep.error === "string" ? prep.error : prep.error?.message ?? `HTTP ${prepRes.status}`;
|
|
35033
|
+
const detail = issues.map((i) => ` \u2717 ${i.message ?? i.code}`).join("\n");
|
|
35034
|
+
throw new Error(detail ? `${msg}
|
|
35035
|
+
${detail}` : msg);
|
|
35036
|
+
}
|
|
35037
|
+
if (!(prep.nonce && prep.txBytes)) {
|
|
35038
|
+
throw new Error("Failed to prepare the listing.");
|
|
35039
|
+
}
|
|
35040
|
+
const bytes = new Uint8Array(Buffer.from(prep.txBytes, "base64"));
|
|
35041
|
+
const { signature } = await agent.keypair.signTransaction(bytes);
|
|
35042
|
+
const sub = await fetchJson2(`${base}/agent/service/submit`, {
|
|
35043
|
+
method: "POST",
|
|
35044
|
+
body: { nonce: prep.nonce, address, signature }
|
|
35045
|
+
});
|
|
35046
|
+
if (isJsonMode()) {
|
|
35047
|
+
printJson({
|
|
35048
|
+
address,
|
|
35049
|
+
endpoint: opts.remove ? null : target,
|
|
35050
|
+
listed: !opts.remove,
|
|
35051
|
+
probe: prep.probe ?? null,
|
|
35052
|
+
digest: sub.digest
|
|
35053
|
+
});
|
|
35054
|
+
return;
|
|
35055
|
+
}
|
|
35056
|
+
printBlank();
|
|
35057
|
+
if (opts.remove) {
|
|
35058
|
+
printSuccess("Listing removed.");
|
|
35059
|
+
} else {
|
|
35060
|
+
printSuccess("Listed \u2014 your endpoint is live on your public profile.");
|
|
35061
|
+
if (prep.probe?.amount) {
|
|
35062
|
+
printKeyValue("Price", `${prep.probe.amount} USDC per call`);
|
|
35063
|
+
}
|
|
35064
|
+
printKeyValue("Endpoint", target);
|
|
35065
|
+
printInfo(`Buyers pay it with: t2 pay ${target}`);
|
|
35066
|
+
printKeyValue("Profile", `https://agents.t2000.ai/${address}`);
|
|
35067
|
+
}
|
|
35068
|
+
printKeyValue("Tx", String(sub.digest));
|
|
35069
|
+
printBlank();
|
|
35070
|
+
} catch (error) {
|
|
35071
|
+
handleError(error);
|
|
35072
|
+
}
|
|
35073
|
+
}
|
|
35074
|
+
);
|
|
35006
35075
|
group.command("handle").argument("<label>", "Handle label (3\u201320 chars: lowercase a\u2013z, 0\u20139, hyphens)").description(
|
|
35007
35076
|
"Claim <label>.agent-id.sui \u2192 this wallet (custody-minted, gasless). Use --release to give it up."
|
|
35008
35077
|
).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_BASE4})`).action(
|