@t2000/cli 5.12.0 → 5.14.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.
|
|
80335
|
+
var PKG_VERSION = "5.14.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-
|
|
80401
|
+
//# sourceMappingURL=dist-EOFFFPZT.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-
|
|
32583
|
+
mod2 = await import("./dist-EOFFFPZT.js");
|
|
32584
32584
|
} catch {
|
|
32585
32585
|
console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
|
|
32586
32586
|
process.exit(1);
|
|
@@ -32920,8 +32920,16 @@ For MCP-aware clients (Claude Desktop, Cursor, Windsurf), prefer
|
|
|
32920
32920
|
}
|
|
32921
32921
|
|
|
32922
32922
|
// src/commands/agent/index.ts
|
|
32923
|
+
import { createHash } from "crypto";
|
|
32923
32924
|
var DEFAULT_API_BASE2 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
|
|
32924
32925
|
var DEFAULT_GATEWAY = process.env.T2000_GATEWAY_URL ?? "https://mpp.t2000.ai";
|
|
32926
|
+
function collectHeader(value, previous) {
|
|
32927
|
+
const [key, ...rest] = value.split("=");
|
|
32928
|
+
if (key && rest.length > 0) {
|
|
32929
|
+
previous[key.trim()] = rest.join("=").trim();
|
|
32930
|
+
}
|
|
32931
|
+
return previous;
|
|
32932
|
+
}
|
|
32925
32933
|
function normalizeTopupAsset(input) {
|
|
32926
32934
|
return input?.toLowerCase() === "usdsui" ? "USDsui" : "USDC";
|
|
32927
32935
|
}
|
|
@@ -33139,13 +33147,13 @@ Subcommands:
|
|
|
33139
33147
|
}
|
|
33140
33148
|
});
|
|
33141
33149
|
group.command("profile").description(
|
|
33142
|
-
"Set this agent's public profile (name \xB7 image \xB7 description). Signed, no gas \u2014 shows in the directory."
|
|
33143
|
-
).option("--name <name>", "Display name").option("--image <url>", "Image URL (https)").option("--description <text>", "Short description").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE2})`).action(
|
|
33150
|
+
"Set this agent's public profile (name \xB7 image \xB7 description \xB7 links). Signed, no gas \u2014 shows in the directory."
|
|
33151
|
+
).option("--name <name>", "Display name").option("--image <url>", "Image URL (https)").option("--description <text>", "Short description").option("--website <url>", "Website link (https)").option("--twitter <url>", "X / Twitter link (https)").option("--github <url>", "GitHub link (https)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE2})`).action(
|
|
33144
33152
|
async (opts) => {
|
|
33145
33153
|
try {
|
|
33146
|
-
if (!(opts.name || opts.image || opts.description)) {
|
|
33154
|
+
if (!(opts.name || opts.image || opts.description || opts.website || opts.twitter || opts.github)) {
|
|
33147
33155
|
throw new Error(
|
|
33148
|
-
"Provide at least one of --name, --image, --description."
|
|
33156
|
+
"Provide at least one of --name, --image, --description, --website, --twitter, --github."
|
|
33149
33157
|
);
|
|
33150
33158
|
}
|
|
33151
33159
|
const base = opts.api ?? DEFAULT_API_BASE2;
|
|
@@ -33169,7 +33177,10 @@ Subcommands:
|
|
|
33169
33177
|
signature,
|
|
33170
33178
|
displayName: opts.name,
|
|
33171
33179
|
imageUrl: opts.image,
|
|
33172
|
-
description: opts.description
|
|
33180
|
+
description: opts.description,
|
|
33181
|
+
website: opts.website,
|
|
33182
|
+
twitter: opts.twitter,
|
|
33183
|
+
github: opts.github
|
|
33173
33184
|
}
|
|
33174
33185
|
});
|
|
33175
33186
|
if (isJsonMode()) {
|
|
@@ -33245,6 +33256,100 @@ Subcommands:
|
|
|
33245
33256
|
}
|
|
33246
33257
|
}
|
|
33247
33258
|
);
|
|
33259
|
+
group.command("deploy").description(
|
|
33260
|
+
"Deploy a paid service by wrapping any HTTP API \u2014 t2000 hosts the proxy (your key stays server-side, encrypted), lists it, and settles payments. No server needed. Use --remove to take it down. [Agent Commerce]"
|
|
33261
|
+
).option("--upstream <url>", "The upstream API URL to wrap (https)").option(
|
|
33262
|
+
"--header <k=v>",
|
|
33263
|
+
"Header to inject into upstream calls (repeatable; e.g. your API key)",
|
|
33264
|
+
collectHeader,
|
|
33265
|
+
{}
|
|
33266
|
+
).option("--method <method>", "Upstream method: GET or POST (default POST)").option("--price <usdc>", "Price per call in USDC (e.g. 0.02)").option("--remove", "Take down the deployed service").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE2})`).action(
|
|
33267
|
+
async (opts) => {
|
|
33268
|
+
try {
|
|
33269
|
+
const base = opts.api ?? DEFAULT_API_BASE2;
|
|
33270
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY;
|
|
33271
|
+
const agent = await withAgent({ keyPath: opts.key });
|
|
33272
|
+
const address = agent.address();
|
|
33273
|
+
if (opts.remove) {
|
|
33274
|
+
const ts2 = Date.now();
|
|
33275
|
+
const msg2 = `t2000-deploy-remove:${ts2}`;
|
|
33276
|
+
const { signature: signature2 } = await agent.keypair.signPersonalMessage(
|
|
33277
|
+
new TextEncoder().encode(msg2)
|
|
33278
|
+
);
|
|
33279
|
+
await fetchJson(`${gateway}/deploy/config`, {
|
|
33280
|
+
method: "DELETE",
|
|
33281
|
+
body: { address, timestamp: ts2, signature: signature2 }
|
|
33282
|
+
});
|
|
33283
|
+
await runSponsoredTx({
|
|
33284
|
+
keypair: agent.keypair,
|
|
33285
|
+
actor: address,
|
|
33286
|
+
prepareUrl: `${base}/agent/service/prepare`,
|
|
33287
|
+
prepareBody: { address, mcpEndpoint: "" },
|
|
33288
|
+
submitUrl: `${base}/agent/service/submit`
|
|
33289
|
+
}).catch(() => void 0);
|
|
33290
|
+
if (isJsonMode()) {
|
|
33291
|
+
printJson({ address, removed: true });
|
|
33292
|
+
return;
|
|
33293
|
+
}
|
|
33294
|
+
printBlank();
|
|
33295
|
+
printSuccess("Service taken down.");
|
|
33296
|
+
printBlank();
|
|
33297
|
+
return;
|
|
33298
|
+
}
|
|
33299
|
+
if (!(opts.upstream && opts.price)) {
|
|
33300
|
+
throw new Error("Both --upstream and --price are required (or use --remove).");
|
|
33301
|
+
}
|
|
33302
|
+
const price = Number.parseFloat(opts.price);
|
|
33303
|
+
if (Number.isNaN(price) || price <= 0) {
|
|
33304
|
+
throw new Error(`--price must be a positive number (got "${opts.price}").`);
|
|
33305
|
+
}
|
|
33306
|
+
const method = (opts.method ?? "POST").toUpperCase() === "GET" ? "GET" : "POST";
|
|
33307
|
+
const headers = opts.header ?? {};
|
|
33308
|
+
const ts = Date.now();
|
|
33309
|
+
const bodyHash = createHash("sha256").update(`${opts.upstream}|${method}|${JSON.stringify(headers)}`).digest("hex");
|
|
33310
|
+
const msg = `t2000-deploy:${ts}:${bodyHash}`;
|
|
33311
|
+
const { signature } = await agent.keypair.signPersonalMessage(
|
|
33312
|
+
new TextEncoder().encode(msg)
|
|
33313
|
+
);
|
|
33314
|
+
await fetchJson(`${gateway}/deploy/config`, {
|
|
33315
|
+
method: "POST",
|
|
33316
|
+
body: {
|
|
33317
|
+
address,
|
|
33318
|
+
timestamp: ts,
|
|
33319
|
+
signature,
|
|
33320
|
+
upstreamUrl: opts.upstream,
|
|
33321
|
+
method,
|
|
33322
|
+
headers
|
|
33323
|
+
}
|
|
33324
|
+
});
|
|
33325
|
+
const { digest } = await runSponsoredTx({
|
|
33326
|
+
keypair: agent.keypair,
|
|
33327
|
+
actor: address,
|
|
33328
|
+
prepareUrl: `${base}/agent/service/prepare`,
|
|
33329
|
+
prepareBody: {
|
|
33330
|
+
address,
|
|
33331
|
+
mcpEndpoint: `${gateway}/deploy/${address}`,
|
|
33332
|
+
paymentMethods: ["x402"],
|
|
33333
|
+
priceUsdc: opts.price
|
|
33334
|
+
},
|
|
33335
|
+
submitUrl: `${base}/agent/service/submit`
|
|
33336
|
+
});
|
|
33337
|
+
if (isJsonMode()) {
|
|
33338
|
+
printJson({ address, upstream: opts.upstream, price, digest });
|
|
33339
|
+
return;
|
|
33340
|
+
}
|
|
33341
|
+
printBlank();
|
|
33342
|
+
printSuccess("Service deployed \u2014 live + listed in the directory.");
|
|
33343
|
+
printKeyValue("Wraps", opts.upstream);
|
|
33344
|
+
printKeyValue("Price", `$${opts.price} USDC`);
|
|
33345
|
+
printKeyValue("Tx", String(digest));
|
|
33346
|
+
printInfo(`Buyers: t2 agent pay ${truncateAddress(address)}`);
|
|
33347
|
+
printBlank();
|
|
33348
|
+
} catch (error) {
|
|
33349
|
+
handleError(error);
|
|
33350
|
+
}
|
|
33351
|
+
}
|
|
33352
|
+
);
|
|
33248
33353
|
group.command("pay").argument("<seller>", "The seller agent's Sui address").description(
|
|
33249
33354
|
"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
33355
|
).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(
|