@t2000/cli 0.22.24 → 0.22.25
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/{chunk-BPTNEFB5.js → chunk-FM4762OE.js} +40 -4
- package/dist/{chunk-BPTNEFB5.js.map → chunk-FM4762OE.js.map} +1 -1
- package/dist/{dist-TWST5EWE.js → dist-LKHCKFGY.js} +2 -2
- package/dist/{dist-MJOXMRDV.js → dist-ZTFOTMJO.js} +5 -13
- package/dist/{dist-MJOXMRDV.js.map → dist-ZTFOTMJO.js.map} +1 -1
- package/dist/index.js +40 -23
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- /package/dist/{dist-TWST5EWE.js.map → dist-LKHCKFGY.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
saveKey,
|
|
19
19
|
truncateAddress,
|
|
20
20
|
walletExists
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FM4762OE.js";
|
|
22
22
|
import "./chunk-V7PXDEKG.js";
|
|
23
23
|
import "./chunk-XOAZJ42V.js";
|
|
24
24
|
import "./chunk-3XUF7GM3.js";
|
|
@@ -3637,12 +3637,15 @@ function registerInit(program3) {
|
|
|
3637
3637
|
if (pin !== pinConfirm) throw new Error("PINs do not match");
|
|
3638
3638
|
printBlank();
|
|
3639
3639
|
printInfo("Creating agent wallet...");
|
|
3640
|
-
const { address: addr, sponsored } = await T2000.init({ pin, keyPath: opts.key, sponsored: opts.sponsor });
|
|
3640
|
+
const { address: addr, sponsored, usdcSponsored } = await T2000.init({ pin, keyPath: opts.key, sponsored: opts.sponsor });
|
|
3641
3641
|
address = addr;
|
|
3642
3642
|
await saveSession(pin);
|
|
3643
3643
|
printSuccess("Keypair generated");
|
|
3644
3644
|
printSuccess(`Network ${import_picocolors2.default.dim("Sui mainnet")}`);
|
|
3645
3645
|
printSuccess(`Gas sponsorship ${import_picocolors2.default.dim(sponsored ? "enabled" : "disabled")}`);
|
|
3646
|
+
if (usdcSponsored) {
|
|
3647
|
+
printSuccess(`USDC onboarding ${import_picocolors2.default.dim("$1 USDC funded")}`);
|
|
3648
|
+
}
|
|
3646
3649
|
printBlank();
|
|
3647
3650
|
printInfo("Setting up accounts...");
|
|
3648
3651
|
printLine(
|
|
@@ -3707,7 +3710,7 @@ function registerInit(program3) {
|
|
|
3707
3710
|
console.log(` \u2502 ${import_picocolors2.default.cyan("t2000 buy 100 BTC")} \u2502`);
|
|
3708
3711
|
console.log(` \u2502 \u2502`);
|
|
3709
3712
|
}
|
|
3710
|
-
console.log(` \u2502
|
|
3713
|
+
console.log(` \u2502 Your address: \u2502`);
|
|
3711
3714
|
console.log(` \u2502 ${import_picocolors2.default.yellow(address)} \u2502`);
|
|
3712
3715
|
console.log(` \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518`);
|
|
3713
3716
|
console.log("");
|
|
@@ -4004,7 +4007,7 @@ function registerHistory(program3) {
|
|
|
4004
4007
|
|
|
4005
4008
|
// src/commands/exportKey.ts
|
|
4006
4009
|
import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3 } from "fs/promises";
|
|
4007
|
-
import { resolve as resolve2 } from "path";
|
|
4010
|
+
import { resolve as resolve2, join as join2 } from "path";
|
|
4008
4011
|
import { homedir as homedir3 } from "os";
|
|
4009
4012
|
var LOCKFILE = resolve2(homedir3(), ".t2000", ".pin-lock");
|
|
4010
4013
|
var MAX_ATTEMPTS = 5;
|
|
@@ -4024,6 +4027,12 @@ async function setLockState(state) {
|
|
|
4024
4027
|
function registerExport(program3) {
|
|
4025
4028
|
program3.command("export").description("Export private key (raw Ed25519 hex)").option("--key <path>", "Key file path").option("--yes", "Skip confirmation").action(async (opts) => {
|
|
4026
4029
|
try {
|
|
4030
|
+
const enforcer = new SafeguardEnforcer(join2(homedir3(), ".t2000"));
|
|
4031
|
+
enforcer.load();
|
|
4032
|
+
if (enforcer.getConfig().locked) {
|
|
4033
|
+
printError("Agent is locked. Unlock first: t2000 unlock");
|
|
4034
|
+
return;
|
|
4035
|
+
}
|
|
4027
4036
|
const lock = await getLockState();
|
|
4028
4037
|
if (lock.lockedUntil > Date.now()) {
|
|
4029
4038
|
const remainSec = Math.ceil((lock.lockedUntil - Date.now()) / 1e3);
|
|
@@ -4074,9 +4083,17 @@ function registerExport(program3) {
|
|
|
4074
4083
|
}
|
|
4075
4084
|
|
|
4076
4085
|
// src/commands/importKey.ts
|
|
4086
|
+
import { join as join3 } from "path";
|
|
4087
|
+
import { homedir as homedir4 } from "os";
|
|
4077
4088
|
function registerImport(program3) {
|
|
4078
4089
|
program3.command("import").description("Import a wallet from private key").option("--key <path>", "Key file path").action(async (opts) => {
|
|
4079
4090
|
try {
|
|
4091
|
+
const enforcer = new SafeguardEnforcer(join3(homedir4(), ".t2000"));
|
|
4092
|
+
enforcer.load();
|
|
4093
|
+
if (enforcer.getConfig().locked) {
|
|
4094
|
+
printError("Agent is locked. Unlock first: t2000 unlock");
|
|
4095
|
+
return;
|
|
4096
|
+
}
|
|
4080
4097
|
let privateKey;
|
|
4081
4098
|
if (process.env.T2000_PRIVATE_KEY) {
|
|
4082
4099
|
privateKey = process.env.T2000_PRIVATE_KEY;
|
|
@@ -4455,10 +4472,10 @@ function registerFundStatus(program3) {
|
|
|
4455
4472
|
|
|
4456
4473
|
// src/commands/config.ts
|
|
4457
4474
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, existsSync as existsSync2 } from "fs";
|
|
4458
|
-
import { join as
|
|
4459
|
-
import { homedir as
|
|
4460
|
-
var CONFIG_DIR2 =
|
|
4461
|
-
var CONFIG_PATH2 =
|
|
4475
|
+
import { join as join4 } from "path";
|
|
4476
|
+
import { homedir as homedir5 } from "os";
|
|
4477
|
+
var CONFIG_DIR2 = join4(homedir5(), ".t2000");
|
|
4478
|
+
var CONFIG_PATH2 = join4(CONFIG_DIR2, "config.json");
|
|
4462
4479
|
var SAFEGUARD_KEYS = /* @__PURE__ */ new Set(["locked", "maxPerTx", "maxDailySend", "dailyUsed", "dailyResetDate", "alertThreshold", "maxLeverage", "maxPositionSize"]);
|
|
4463
4480
|
function getNestedValue(obj, path) {
|
|
4464
4481
|
const parts = path.split(".");
|
|
@@ -7326,8 +7343,8 @@ var cors = (options) => {
|
|
|
7326
7343
|
// src/commands/serve.ts
|
|
7327
7344
|
import { randomBytes } from "crypto";
|
|
7328
7345
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3, existsSync as existsSync3 } from "fs";
|
|
7329
|
-
import { join as
|
|
7330
|
-
import { homedir as
|
|
7346
|
+
import { join as join5 } from "path";
|
|
7347
|
+
import { homedir as homedir6 } from "os";
|
|
7331
7348
|
|
|
7332
7349
|
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/utils/stream.js
|
|
7333
7350
|
var StreamingApi = class {
|
|
@@ -7479,8 +7496,8 @@ var streamSSE = (c, cb, onError) => {
|
|
|
7479
7496
|
};
|
|
7480
7497
|
|
|
7481
7498
|
// src/commands/serve.ts
|
|
7482
|
-
var CONFIG_DIR3 =
|
|
7483
|
-
var TOKEN_PATH =
|
|
7499
|
+
var CONFIG_DIR3 = join5(homedir6(), ".t2000");
|
|
7500
|
+
var TOKEN_PATH = join5(CONFIG_DIR3, "config.json");
|
|
7484
7501
|
function generateToken() {
|
|
7485
7502
|
return `t2k_${randomBytes(24).toString("hex")}`;
|
|
7486
7503
|
}
|
|
@@ -7846,9 +7863,9 @@ function collectHeaders(value, previous) {
|
|
|
7846
7863
|
}
|
|
7847
7864
|
|
|
7848
7865
|
// src/commands/lock.ts
|
|
7849
|
-
import { join as
|
|
7850
|
-
import { homedir as
|
|
7851
|
-
var CONFIG_DIR4 =
|
|
7866
|
+
import { join as join6 } from "path";
|
|
7867
|
+
import { homedir as homedir7 } from "os";
|
|
7868
|
+
var CONFIG_DIR4 = join6(homedir7(), ".t2000");
|
|
7852
7869
|
function registerLock(program3) {
|
|
7853
7870
|
program3.command("lock").description("Lock agent \u2014 freeze all operations").action(async () => {
|
|
7854
7871
|
try {
|
|
@@ -7870,7 +7887,7 @@ function registerLock(program3) {
|
|
|
7870
7887
|
});
|
|
7871
7888
|
program3.command("unlock").description("Unlock agent \u2014 resume operations").action(async () => {
|
|
7872
7889
|
try {
|
|
7873
|
-
const { T2000: T20003 } = await import("./dist-
|
|
7890
|
+
const { T2000: T20003 } = await import("./dist-LKHCKFGY.js");
|
|
7874
7891
|
const MAX_ATTEMPTS2 = 3;
|
|
7875
7892
|
let pin;
|
|
7876
7893
|
for (let attempt = 1; attempt <= MAX_ATTEMPTS2; attempt++) {
|
|
@@ -8292,27 +8309,27 @@ function registerSwap(program3) {
|
|
|
8292
8309
|
|
|
8293
8310
|
// src/commands/mcp.ts
|
|
8294
8311
|
import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir4 } from "fs/promises";
|
|
8295
|
-
import { join as
|
|
8296
|
-
import { homedir as
|
|
8312
|
+
import { join as join7, dirname as dirname2 } from "path";
|
|
8313
|
+
import { homedir as homedir8 } from "os";
|
|
8297
8314
|
import { existsSync as existsSync4 } from "fs";
|
|
8298
8315
|
var MCP_CONFIG = {
|
|
8299
8316
|
command: "t2000",
|
|
8300
8317
|
args: ["mcp"]
|
|
8301
8318
|
};
|
|
8302
8319
|
function getPlatformConfigs() {
|
|
8303
|
-
const home =
|
|
8320
|
+
const home = homedir8();
|
|
8304
8321
|
return [
|
|
8305
8322
|
{
|
|
8306
8323
|
name: "Claude Desktop",
|
|
8307
|
-
path:
|
|
8324
|
+
path: join7(home, "Library", "Application Support", "Claude", "claude_desktop_config.json")
|
|
8308
8325
|
},
|
|
8309
8326
|
{
|
|
8310
8327
|
name: "Cursor",
|
|
8311
|
-
path:
|
|
8328
|
+
path: join7(home, ".cursor", "mcp.json")
|
|
8312
8329
|
},
|
|
8313
8330
|
{
|
|
8314
8331
|
name: "Windsurf",
|
|
8315
|
-
path:
|
|
8332
|
+
path: join7(home, ".codeium", "windsurf", "mcp_config.json")
|
|
8316
8333
|
}
|
|
8317
8334
|
];
|
|
8318
8335
|
}
|
|
@@ -8336,7 +8353,7 @@ function registerMcp(program3) {
|
|
|
8336
8353
|
mcp.command("start", { isDefault: true }).description("Start MCP server (stdio transport)").option("--key <path>", "Key file path").action(async (opts) => {
|
|
8337
8354
|
let mod;
|
|
8338
8355
|
try {
|
|
8339
|
-
mod = await import("./dist-
|
|
8356
|
+
mod = await import("./dist-ZTFOTMJO.js");
|
|
8340
8357
|
} catch {
|
|
8341
8358
|
console.error(
|
|
8342
8359
|
"MCP server not installed. Run:\n npm install -g @t2000/mcp"
|