@t2000/cli 7.0.0 → 8.0.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
|
@@ -33122,7 +33122,7 @@ function registerMcpStart(parent) {
|
|
|
33122
33122
|
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) => {
|
|
33123
33123
|
let mod3;
|
|
33124
33124
|
try {
|
|
33125
|
-
mod3 = await import("./dist-
|
|
33125
|
+
mod3 = await import("./dist-BOOS6EPV.js");
|
|
33126
33126
|
} catch {
|
|
33127
33127
|
console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
|
|
33128
33128
|
process.exit(1);
|
|
@@ -33627,7 +33627,7 @@ function registerAgentCreate(group) {
|
|
|
33627
33627
|
"Create an agent in one pass \u2014 wallet + on-chain Agent ID + profile (+ optional owner link). Sponsored, gasless."
|
|
33628
33628
|
).requiredOption("--name <name>", "Display name (shown in the store)").option("--description <text>", "Short description (what it does, for whom)").option(
|
|
33629
33629
|
"--category <category>",
|
|
33630
|
-
`
|
|
33630
|
+
`Directory category: ${AGENT_CATEGORIES.join(" | ")}`
|
|
33631
33631
|
).option(
|
|
33632
33632
|
"--owner <address>",
|
|
33633
33633
|
"Propose a Passport owner (confirm at agents.t2000.ai \u2192 My agents)"
|
|
@@ -33742,7 +33742,7 @@ function registerAgentCreate(group) {
|
|
|
33742
33742
|
printBlank();
|
|
33743
33743
|
printLine("Next:");
|
|
33744
33744
|
printLine(" t2 fund # add USDC (QR / card link)");
|
|
33745
|
-
printLine("
|
|
33745
|
+
printLine(" agents.t2000.ai/skills # give it skills to act on Sui");
|
|
33746
33746
|
printBlank();
|
|
33747
33747
|
} catch (error) {
|
|
33748
33748
|
handleError(error);
|
|
@@ -33752,28 +33752,6 @@ function registerAgentCreate(group) {
|
|
|
33752
33752
|
|
|
33753
33753
|
// src/commands/agent/index.ts
|
|
33754
33754
|
var DEFAULT_API_BASE4 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
|
|
33755
|
-
var DEFAULT_GATEWAY = process.env.T2000_GATEWAY_URL ?? "https://mpp.t2000.ai";
|
|
33756
|
-
var AGENT_CATEGORIES2 = [
|
|
33757
|
-
"ai-models",
|
|
33758
|
-
"data-feeds",
|
|
33759
|
-
"finance",
|
|
33760
|
-
"research",
|
|
33761
|
-
"dev-tools",
|
|
33762
|
-
"creative",
|
|
33763
|
-
"other"
|
|
33764
|
-
];
|
|
33765
|
-
function normalizeCategory(input) {
|
|
33766
|
-
if (input === void 0) {
|
|
33767
|
-
return;
|
|
33768
|
-
}
|
|
33769
|
-
const c = input.trim().toLowerCase();
|
|
33770
|
-
if (!AGENT_CATEGORIES2.includes(c)) {
|
|
33771
|
-
throw new Error(
|
|
33772
|
-
`--category must be one of: ${AGENT_CATEGORIES2.join(", ")} (got "${input}").`
|
|
33773
|
-
);
|
|
33774
|
-
}
|
|
33775
|
-
return c;
|
|
33776
|
-
}
|
|
33777
33755
|
function normalizeTopupAsset(input) {
|
|
33778
33756
|
return input?.toLowerCase() === "usdsui" ? "USDsui" : "USDC";
|
|
33779
33757
|
}
|
|
@@ -33818,7 +33796,6 @@ Subcommands:
|
|
|
33818
33796
|
$ t2 agent onboard --fund 5 Fund 5 USDC \u2192 mint an API key (ready to call)
|
|
33819
33797
|
$ t2 agent onboard --fund 5 --asset USDsui
|
|
33820
33798
|
$ t2 agent onboard Already funded \u2192 just mint a key
|
|
33821
|
-
$ t2 agent pay <address> Pay another agent's declared service
|
|
33822
33799
|
`
|
|
33823
33800
|
);
|
|
33824
33801
|
registerAgentCreate(group);
|
|
@@ -34081,185 +34058,6 @@ Subcommands:
|
|
|
34081
34058
|
}
|
|
34082
34059
|
}
|
|
34083
34060
|
);
|
|
34084
|
-
group.command("service").description(
|
|
34085
|
-
"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."
|
|
34086
|
-
).option("--mcp-endpoint <url>", "Your agent service endpoint (https)").option(
|
|
34087
|
-
"--payment-methods <list>",
|
|
34088
|
-
'Comma-separated methods you accept, e.g. "x402"'
|
|
34089
|
-
).option("--price <usdc>", "Price per call in USDC (e.g. 0.02) \u2014 buyers pay this").option(
|
|
34090
|
-
"--category <category>",
|
|
34091
|
-
`Storefront category: ${AGENT_CATEGORIES2.join(" | ")}`
|
|
34092
|
-
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(
|
|
34093
|
-
async (opts) => {
|
|
34094
|
-
try {
|
|
34095
|
-
if (opts.mcpEndpoint === void 0 && opts.paymentMethods === void 0 && opts.price === void 0 && opts.category === void 0) {
|
|
34096
|
-
throw new Error(
|
|
34097
|
-
'Provide at least one of --mcp-endpoint, --payment-methods, --price, --category. (Pass --mcp-endpoint "" to clear your endpoint.)'
|
|
34098
|
-
);
|
|
34099
|
-
}
|
|
34100
|
-
if (opts.price !== void 0) {
|
|
34101
|
-
const p = Number.parseFloat(opts.price);
|
|
34102
|
-
if (Number.isNaN(p) || p <= 0) {
|
|
34103
|
-
throw new Error(`--price must be a positive number (got "${opts.price}").`);
|
|
34104
|
-
}
|
|
34105
|
-
}
|
|
34106
|
-
const category = normalizeCategory(opts.category);
|
|
34107
|
-
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34108
|
-
const agent = await withAgent({ keyPath: opts.key });
|
|
34109
|
-
const address = agent.address();
|
|
34110
|
-
const prepareBody = { address };
|
|
34111
|
-
if (opts.mcpEndpoint !== void 0) {
|
|
34112
|
-
prepareBody.mcpEndpoint = opts.mcpEndpoint;
|
|
34113
|
-
}
|
|
34114
|
-
if (opts.paymentMethods !== void 0) {
|
|
34115
|
-
prepareBody.paymentMethods = opts.paymentMethods.split(",").map((s) => s.trim()).filter(Boolean);
|
|
34116
|
-
}
|
|
34117
|
-
if (opts.price !== void 0) {
|
|
34118
|
-
prepareBody.priceUsdc = opts.price;
|
|
34119
|
-
}
|
|
34120
|
-
if (category !== void 0) {
|
|
34121
|
-
prepareBody.category = category;
|
|
34122
|
-
}
|
|
34123
|
-
const { digest } = await runSponsoredTx({
|
|
34124
|
-
keypair: agent.keypair,
|
|
34125
|
-
actor: address,
|
|
34126
|
-
prepareUrl: `${base}/agent/service/prepare`,
|
|
34127
|
-
prepareBody,
|
|
34128
|
-
submitUrl: `${base}/agent/service/submit`
|
|
34129
|
-
});
|
|
34130
|
-
if (isJsonMode()) {
|
|
34131
|
-
printJson({ address, updated: true, digest });
|
|
34132
|
-
return;
|
|
34133
|
-
}
|
|
34134
|
-
printBlank();
|
|
34135
|
-
printSuccess("Service declared \u2014 showing in the directory.");
|
|
34136
|
-
if (opts.mcpEndpoint) {
|
|
34137
|
-
printKeyValue("MCP endpoint", opts.mcpEndpoint);
|
|
34138
|
-
}
|
|
34139
|
-
if (opts.paymentMethods) {
|
|
34140
|
-
printKeyValue("Payment methods", opts.paymentMethods);
|
|
34141
|
-
}
|
|
34142
|
-
if (opts.price) {
|
|
34143
|
-
printKeyValue("Price", `$${opts.price} USDC`);
|
|
34144
|
-
}
|
|
34145
|
-
if (category) {
|
|
34146
|
-
printKeyValue("Category", category);
|
|
34147
|
-
}
|
|
34148
|
-
printKeyValue("Tx", String(digest));
|
|
34149
|
-
printBlank();
|
|
34150
|
-
} catch (error) {
|
|
34151
|
-
handleError(error);
|
|
34152
|
-
}
|
|
34153
|
-
}
|
|
34154
|
-
);
|
|
34155
|
-
group.command("pay").argument("<seller>", "The seller agent's Sui address").description(
|
|
34156
|
-
"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]"
|
|
34157
|
-
).option("--amount <usdc>", "Override the price (default: the seller's declared price)").option("--data <json>", "Service input forwarded to the seller's endpoint").option("--max-price <usdc>", "Max USDC to auto-approve (default 1.00, or --amount)").option(
|
|
34158
|
-
"--gateway <url>",
|
|
34159
|
-
`Gateway base URL (default ${DEFAULT_GATEWAY})`
|
|
34160
|
-
).option("--force", "Override spending limits for this call (see `t2 limit`)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(
|
|
34161
|
-
async (seller, opts) => {
|
|
34162
|
-
try {
|
|
34163
|
-
if (opts.amount !== void 0) {
|
|
34164
|
-
const a = Number.parseFloat(opts.amount);
|
|
34165
|
-
if (Number.isNaN(a) || a <= 0) {
|
|
34166
|
-
throw new Error(`--amount must be a positive number (got "${opts.amount}").`);
|
|
34167
|
-
}
|
|
34168
|
-
}
|
|
34169
|
-
const maxPrice = opts.maxPrice ? Number.parseFloat(opts.maxPrice) : opts.amount ? Number.parseFloat(opts.amount) : 1;
|
|
34170
|
-
const gateway = opts.gateway ?? DEFAULT_GATEWAY;
|
|
34171
|
-
const agent = await withAgent({ keyPath: opts.key });
|
|
34172
|
-
const resolvedSeller = seller.startsWith("0x") ? seller : (await agent.resolveRecipient(seller)).address;
|
|
34173
|
-
const url = opts.amount ? `${gateway}/commerce/pay/${resolvedSeller}?amount=${encodeURIComponent(opts.amount)}` : `${gateway}/commerce/pay/${resolvedSeller}`;
|
|
34174
|
-
const result = await agent.pay({
|
|
34175
|
-
url,
|
|
34176
|
-
method: "POST",
|
|
34177
|
-
body: opts.data,
|
|
34178
|
-
maxPrice,
|
|
34179
|
-
force: opts.force
|
|
34180
|
-
});
|
|
34181
|
-
const body2 = result.body;
|
|
34182
|
-
if (result.status >= 400) {
|
|
34183
|
-
throw new Error(
|
|
34184
|
-
`${body2?.error ?? `Request failed (HTTP ${result.status})`}${result.paid ? "" : " \u2014 nothing was paid."}`
|
|
34185
|
-
);
|
|
34186
|
-
}
|
|
34187
|
-
const receipt = body2?.receipt;
|
|
34188
|
-
const chargedMicros = receipt?.chargedMicros ?? receipt?.grossMicros;
|
|
34189
|
-
const paidUsd = typeof chargedMicros === "number" ? chargedMicros / 1e6 : opts.amount ? Number.parseFloat(opts.amount) : result.cost ?? 0;
|
|
34190
|
-
if (isJsonMode()) {
|
|
34191
|
-
printJson({
|
|
34192
|
-
seller: resolvedSeller,
|
|
34193
|
-
amount: paidUsd,
|
|
34194
|
-
paid: result.paid,
|
|
34195
|
-
cost: result.cost,
|
|
34196
|
-
receipt,
|
|
34197
|
-
response: body2?.response
|
|
34198
|
-
});
|
|
34199
|
-
return;
|
|
34200
|
-
}
|
|
34201
|
-
printBlank();
|
|
34202
|
-
printSuccess(
|
|
34203
|
-
`Paid ${formatUsd(paidUsd)} to ${seller.startsWith("0x") ? truncateAddress(seller) : `${seller} (${truncateAddress(resolvedSeller)})`}`
|
|
34204
|
-
);
|
|
34205
|
-
if (receipt) {
|
|
34206
|
-
if (typeof receipt.refundMicros === "number" && receipt.refundMicros > 0 && typeof receipt.authorizedMicros === "number") {
|
|
34207
|
-
printKeyValue(
|
|
34208
|
-
"Authorized",
|
|
34209
|
-
`$${(receipt.authorizedMicros / 1e6).toFixed(6)}`
|
|
34210
|
-
);
|
|
34211
|
-
printKeyValue("Charged", `$${paidUsd.toFixed(6)}`);
|
|
34212
|
-
printKeyValue("Refunded", `$${(receipt.refundMicros / 1e6).toFixed(6)}`);
|
|
34213
|
-
}
|
|
34214
|
-
if (typeof receipt.netMicros === "number") {
|
|
34215
|
-
printKeyValue("Seller received", `$${(receipt.netMicros / 1e6).toFixed(6)}`);
|
|
34216
|
-
}
|
|
34217
|
-
if (typeof receipt.feeMicros === "number") {
|
|
34218
|
-
printKeyValue("Facilitator fee", `$${(receipt.feeMicros / 1e6).toFixed(6)}`);
|
|
34219
|
-
}
|
|
34220
|
-
if (receipt.forwardDigest) {
|
|
34221
|
-
printKeyValue("Settlement tx", receipt.forwardDigest);
|
|
34222
|
-
}
|
|
34223
|
-
}
|
|
34224
|
-
if (body2?.response !== void 0) {
|
|
34225
|
-
printBlank();
|
|
34226
|
-
printInfo("Service response:");
|
|
34227
|
-
printLine(JSON.stringify(body2.response, null, 2));
|
|
34228
|
-
}
|
|
34229
|
-
printBlank();
|
|
34230
|
-
} catch (error) {
|
|
34231
|
-
handleError(error);
|
|
34232
|
-
}
|
|
34233
|
-
}
|
|
34234
|
-
);
|
|
34235
|
-
group.command("earnings").description(
|
|
34236
|
-
"Your sales as a seller \u2014 count, USDC earned (net), and unique buyers, from the on-chain settlement ledger. [Agent Commerce]"
|
|
34237
|
-
).option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
|
|
34238
|
-
try {
|
|
34239
|
-
const gateway = opts.gateway ?? DEFAULT_GATEWAY;
|
|
34240
|
-
const agent = await withAgent({ keyPath: opts.key });
|
|
34241
|
-
const address = agent.address();
|
|
34242
|
-
const stats = await fetchJson2(
|
|
34243
|
-
`${gateway}/commerce/stats/${address}`,
|
|
34244
|
-
{ method: "GET" }
|
|
34245
|
-
);
|
|
34246
|
-
if (isJsonMode()) {
|
|
34247
|
-
printJson({ address, ...stats });
|
|
34248
|
-
return;
|
|
34249
|
-
}
|
|
34250
|
-
printBlank();
|
|
34251
|
-
printSuccess(`Earnings for ${truncateAddress(address)}`);
|
|
34252
|
-
printKeyValue("Sales", String(stats.sales ?? 0));
|
|
34253
|
-
printKeyValue("Earned (net)", `$${(stats.volumeUsd ?? 0).toFixed(6)} USDC`);
|
|
34254
|
-
printKeyValue("Unique buyers", String(stats.buyers ?? 0));
|
|
34255
|
-
if (stats.lastSaleAt) {
|
|
34256
|
-
printKeyValue("Last sale", new Date(stats.lastSaleAt).toISOString());
|
|
34257
|
-
}
|
|
34258
|
-
printBlank();
|
|
34259
|
-
} catch (error) {
|
|
34260
|
-
handleError(error);
|
|
34261
|
-
}
|
|
34262
|
-
});
|
|
34263
34061
|
group.command("handle").argument("<label>", "Handle label (3\u201320 chars: lowercase a\u2013z, 0\u20139, hyphens)").description(
|
|
34264
34062
|
"Claim <label>.agent-id.sui \u2192 this wallet (custody-minted, gasless). Use --release to give it up."
|
|
34265
34063
|
).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(
|
|
@@ -34319,9 +34117,9 @@ function firstLine(text, max = 76) {
|
|
|
34319
34117
|
return line.length > max ? `${line.slice(0, max - 1)}\u2026` : line;
|
|
34320
34118
|
}
|
|
34321
34119
|
function registerAgents(program3) {
|
|
34322
|
-
program3.command("agents").argument("[address]", "Show one agent\u2019s
|
|
34323
|
-
"Look up the agent directory (agents.t2000.ai):
|
|
34324
|
-
).option("--category <category>", "Filter the list by category").option("--
|
|
34120
|
+
program3.command("agents").argument("[address]", "Show one agent\u2019s identity profile").description(
|
|
34121
|
+
"Look up the agent directory (agents.t2000.ai): registered on-chain Agent IDs. Read-only. [Agent ID]"
|
|
34122
|
+
).option("--category <category>", "Filter the list by category").option("--limit <n>", "Max rows (default: all)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE5})`).action(
|
|
34325
34123
|
async (address, opts) => {
|
|
34326
34124
|
try {
|
|
34327
34125
|
const base = opts.api ?? DEFAULT_API_BASE5;
|
|
@@ -34331,30 +34129,20 @@ function registerAgents(program3) {
|
|
|
34331
34129
|
printJson(profile);
|
|
34332
34130
|
return;
|
|
34333
34131
|
}
|
|
34334
|
-
const rep = profile.reputation;
|
|
34335
34132
|
printBlank();
|
|
34336
34133
|
printHeader(profile.name ?? truncateAddress(profile.address));
|
|
34337
34134
|
printKeyValue("Address", profile.address);
|
|
34338
|
-
if (profile.
|
|
34339
|
-
printKeyValue(
|
|
34340
|
-
"Price",
|
|
34341
|
-
`${formatUsd(Number.parseFloat(profile.priceUsdc))} / call${profile.category ? ` \xB7 ${profile.category}` : ""}`
|
|
34342
|
-
);
|
|
34135
|
+
if (profile.numericId != null) {
|
|
34136
|
+
printKeyValue("Agent ID", `#${profile.numericId}`);
|
|
34343
34137
|
}
|
|
34344
34138
|
if (profile.description) {
|
|
34345
34139
|
printKeyValue("About", firstLine(profile.description, 90));
|
|
34346
34140
|
}
|
|
34347
|
-
if (
|
|
34348
|
-
printKeyValue(
|
|
34349
|
-
"Verified on the rail",
|
|
34350
|
-
`${rep.sales ?? 0} sold \xB7 ${rep.buyers ?? 0} buyer${(rep.buyers ?? 0) === 1 ? "" : "s"} \xB7 ${formatUsd(rep.volumeUsd ?? 0)} settled${typeof rep.deliveredRate === "number" ? ` \xB7 ${Math.round(rep.deliveredRate * 100)}% delivered` : ""}`
|
|
34351
|
-
);
|
|
34141
|
+
if (profile.owner) {
|
|
34142
|
+
printKeyValue("Owner", truncateAddress(profile.owner));
|
|
34352
34143
|
}
|
|
34353
34144
|
printBlank();
|
|
34354
|
-
|
|
34355
|
-
printInfo(`Buy it: t2 agent pay ${profile.address}`);
|
|
34356
|
-
}
|
|
34357
|
-
printInfo(`Listing: https://agents.t2000.ai/${profile.address}`);
|
|
34145
|
+
printInfo(`Profile: https://agents.t2000.ai/${profile.numericId ?? profile.address}`);
|
|
34358
34146
|
printBlank();
|
|
34359
34147
|
return;
|
|
34360
34148
|
}
|
|
@@ -34363,9 +34151,6 @@ function registerAgents(program3) {
|
|
|
34363
34151
|
`${base}/agents?limit=100`
|
|
34364
34152
|
);
|
|
34365
34153
|
let agents = (data.agents ?? []).filter((a) => a.active !== false);
|
|
34366
|
-
if (!opts.all) {
|
|
34367
|
-
agents = agents.filter((a) => a.service && a.priceUsdc);
|
|
34368
|
-
}
|
|
34369
34154
|
if (opts.category) {
|
|
34370
34155
|
const cat = opts.category.trim().toLowerCase();
|
|
34371
34156
|
agents = agents.filter((a) => a.category?.toLowerCase() === cat);
|
|
@@ -34377,17 +34162,16 @@ function registerAgents(program3) {
|
|
|
34377
34162
|
}
|
|
34378
34163
|
printBlank();
|
|
34379
34164
|
printHeader(
|
|
34380
|
-
`Agent directory \u2014 ${agents.length}
|
|
34165
|
+
`Agent directory \u2014 ${agents.length} agents${opts.category ? ` in ${opts.category}` : ""}`
|
|
34381
34166
|
);
|
|
34382
34167
|
for (const a of agents) {
|
|
34383
|
-
const price = a.priceUsdc ? formatUsd(Number.parseFloat(a.priceUsdc)).padStart(6) : " \u2014";
|
|
34384
34168
|
printLine(
|
|
34385
|
-
`
|
|
34169
|
+
` #${String(a.numericId ?? "\u2014").padEnd(4)} ${(a.name ?? truncateAddress(a.address)).padEnd(24).slice(0, 24)} ${firstLine(a.description, 40)}`
|
|
34386
34170
|
);
|
|
34387
|
-
printLine(`
|
|
34171
|
+
printLine(` ${a.address}`);
|
|
34388
34172
|
}
|
|
34389
34173
|
printBlank();
|
|
34390
|
-
printInfo("Detail: t2 agents <address>
|
|
34174
|
+
printInfo("Detail: t2 agents <address>");
|
|
34391
34175
|
printBlank();
|
|
34392
34176
|
} catch (error) {
|
|
34393
34177
|
handleError(error);
|
|
@@ -34418,7 +34202,6 @@ Examples:
|
|
|
34418
34202
|
$ t2 pay <url> --estimate Preview an x402 service's price + input schema (no payment)
|
|
34419
34203
|
$ t2 services search "image" Discover x402 services in the gateway catalog
|
|
34420
34204
|
$ t2 agents Look up the agent directory (agents.t2000.ai)
|
|
34421
|
-
$ t2 agent pay <address> Buy an agent's service (escrowed, auto-refund on failure)
|
|
34422
34205
|
$ t2 limit set --daily 100 Change the daily spend cap (default $100/day)
|
|
34423
34206
|
$ t2 mcp install Connect Claude / Cursor / Windsurf
|
|
34424
34207
|
$ t2 skills install Install skills as local SKILL.md files`);
|