@t2000/cli 5.28.0 → 5.30.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.
|
@@ -99462,7 +99462,7 @@ The wallet can also HIRE OTHER AGENTS: the agent store (agents.t2000.ai) lists a
|
|
|
99462
99462
|
The wallet can EARN too: t2000_tasks lists live reward tasks + the community task board, t2000_task_claim collects auto-verified rewards, t2000_task_submit submits proof on board jobs, and t2000_agent_earnings reports the wallet's seller sales. None of these spend \u2014 claims RECEIVE USDC through the rail (see the skill-earn prompt or the t2000-earn skill).
|
|
99463
99463
|
|
|
99464
99464
|
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.`;
|
|
99465
|
-
var PKG_VERSION = "5.
|
|
99465
|
+
var PKG_VERSION = "5.30.0";
|
|
99466
99466
|
console.log = (...args) => console.error("[log]", ...args);
|
|
99467
99467
|
console.warn = (...args) => console.error("[warn]", ...args);
|
|
99468
99468
|
async function startMcpServer(opts) {
|
|
@@ -99537,4 +99537,4 @@ mime-types/index.js:
|
|
|
99537
99537
|
@scure/bip39/index.js:
|
|
99538
99538
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
99539
99539
|
*/
|
|
99540
|
-
//# sourceMappingURL=dist-
|
|
99540
|
+
//# sourceMappingURL=dist-SHQDD6S3.js.map
|
package/dist/index.js
CHANGED
|
@@ -31873,13 +31873,19 @@ function registerExport(program3) {
|
|
|
31873
31873
|
var import_qrcode = __toESM(require_lib4(), 1);
|
|
31874
31874
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
31875
31875
|
var VALUE_PROMISE = "$5 USDC \u2248 ~250 paid API calls (at the $0.02 floor).";
|
|
31876
|
+
var CARD_HINT = "No USDC yet? Buy some with a card: https://agents.t2000.ai/manage/topup (then My agents \u2192 Fund, or send to the address above).";
|
|
31876
31877
|
function registerFund(program3) {
|
|
31877
31878
|
program3.command("fund").description("Show your wallet address + QR to fund it (USDC / USDsui / SUI on Sui)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--qr-only", "Print only the QR code (no address text)").action(async (opts) => {
|
|
31878
31879
|
try {
|
|
31879
31880
|
const agent = await withAgent({ keyPath: opts.key });
|
|
31880
31881
|
const address = agent.address();
|
|
31881
31882
|
if (isJsonMode()) {
|
|
31882
|
-
printJson({
|
|
31883
|
+
printJson({
|
|
31884
|
+
address,
|
|
31885
|
+
qrEncodedFor: address,
|
|
31886
|
+
valuePromise: VALUE_PROMISE,
|
|
31887
|
+
cardTopupUrl: "https://agents.t2000.ai/manage/topup"
|
|
31888
|
+
});
|
|
31883
31889
|
return;
|
|
31884
31890
|
}
|
|
31885
31891
|
printBlank();
|
|
@@ -31900,6 +31906,7 @@ function registerFund(program3) {
|
|
|
31900
31906
|
`);
|
|
31901
31907
|
if (!opts.qrOnly) {
|
|
31902
31908
|
printLine(import_picocolors2.default.dim("Or share `" + address + "` directly."));
|
|
31909
|
+
printLine(import_picocolors2.default.dim(CARD_HINT));
|
|
31903
31910
|
printBlank();
|
|
31904
31911
|
}
|
|
31905
31912
|
} catch (error) {
|
|
@@ -33115,7 +33122,7 @@ function registerMcpStart(parent) {
|
|
|
33115
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) => {
|
|
33116
33123
|
let mod3;
|
|
33117
33124
|
try {
|
|
33118
|
-
mod3 = await import("./dist-
|
|
33125
|
+
mod3 = await import("./dist-SHQDD6S3.js");
|
|
33119
33126
|
} catch {
|
|
33120
33127
|
console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
|
|
33121
33128
|
process.exit(1);
|
|
@@ -33590,10 +33597,167 @@ For MCP-aware clients (Claude Desktop, Cursor, Windsurf), prefer
|
|
|
33590
33597
|
// src/commands/agent/index.ts
|
|
33591
33598
|
import { createHash as createHash3 } from "crypto";
|
|
33592
33599
|
|
|
33600
|
+
// src/commands/agent/create.ts
|
|
33601
|
+
var DEFAULT_API_BASE3 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
|
|
33602
|
+
var STORE_BASE = "https://agents.t2000.ai";
|
|
33603
|
+
var AGENT_CATEGORIES = [
|
|
33604
|
+
"ai-models",
|
|
33605
|
+
"data-feeds",
|
|
33606
|
+
"finance",
|
|
33607
|
+
"research",
|
|
33608
|
+
"dev-tools",
|
|
33609
|
+
"creative",
|
|
33610
|
+
"other"
|
|
33611
|
+
];
|
|
33612
|
+
var DEFAULT_PER_TX_USD2 = 25;
|
|
33613
|
+
var DEFAULT_DAILY_USD2 = 100;
|
|
33614
|
+
async function fetchJson(url, init) {
|
|
33615
|
+
const res = await fetch(url, {
|
|
33616
|
+
method: init?.method ?? "GET",
|
|
33617
|
+
headers: init?.body ? { "Content-Type": "application/json" } : void 0,
|
|
33618
|
+
body: init?.body ? JSON.stringify(init.body) : void 0
|
|
33619
|
+
});
|
|
33620
|
+
const json = await res.json().catch(() => ({}));
|
|
33621
|
+
if (!res.ok) {
|
|
33622
|
+
const err = json.error;
|
|
33623
|
+
const msg = typeof err === "string" ? err : err?.message ?? `HTTP ${res.status}`;
|
|
33624
|
+
throw new Error(msg);
|
|
33625
|
+
}
|
|
33626
|
+
return json;
|
|
33627
|
+
}
|
|
33628
|
+
function registerAgentCreate(group) {
|
|
33629
|
+
group.command("create").description(
|
|
33630
|
+
"Create an agent in one pass \u2014 wallet + on-chain Agent ID + profile (+ optional owner link). Sponsored, gasless."
|
|
33631
|
+
).requiredOption("--name <name>", "Display name (shown in the store)").option("--description <text>", "Short description (what it does, for whom)").option(
|
|
33632
|
+
"--category <category>",
|
|
33633
|
+
`Storefront category: ${AGENT_CATEGORIES.join(" | ")}`
|
|
33634
|
+
).option(
|
|
33635
|
+
"--owner <address>",
|
|
33636
|
+
"Propose a Passport owner (confirm at agents.t2000.ai \u2192 My agents)"
|
|
33637
|
+
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE3})`).action(async (opts) => {
|
|
33638
|
+
try {
|
|
33639
|
+
const base = opts.api ?? DEFAULT_API_BASE3;
|
|
33640
|
+
const name = opts.name.trim();
|
|
33641
|
+
if (!name) {
|
|
33642
|
+
throw new Error("--name must not be empty.");
|
|
33643
|
+
}
|
|
33644
|
+
if (name.length > 60) {
|
|
33645
|
+
throw new Error("--name must be 60 characters or fewer.");
|
|
33646
|
+
}
|
|
33647
|
+
let category;
|
|
33648
|
+
if (opts.category !== void 0) {
|
|
33649
|
+
const c = opts.category.trim().toLowerCase();
|
|
33650
|
+
if (!AGENT_CATEGORIES.includes(c)) {
|
|
33651
|
+
throw new Error(
|
|
33652
|
+
`--category must be one of: ${AGENT_CATEGORIES.join(", ")} (got "${opts.category}").`
|
|
33653
|
+
);
|
|
33654
|
+
}
|
|
33655
|
+
category = c;
|
|
33656
|
+
}
|
|
33657
|
+
let owner;
|
|
33658
|
+
if (opts.owner !== void 0) {
|
|
33659
|
+
owner = normalizeSuiAddress(opts.owner.trim());
|
|
33660
|
+
if (!isValidSuiAddress(owner)) {
|
|
33661
|
+
throw new Error("--owner must be a valid Sui address.");
|
|
33662
|
+
}
|
|
33663
|
+
}
|
|
33664
|
+
const created = !await walletExists(opts.key);
|
|
33665
|
+
if (created) {
|
|
33666
|
+
const keypair = generateKeypair();
|
|
33667
|
+
await saveKey(keypair, void 0, opts.key);
|
|
33668
|
+
if (!hasLimits()) {
|
|
33669
|
+
setLimits({
|
|
33670
|
+
perTxUsd: DEFAULT_PER_TX_USD2,
|
|
33671
|
+
dailyUsd: DEFAULT_DAILY_USD2
|
|
33672
|
+
});
|
|
33673
|
+
}
|
|
33674
|
+
}
|
|
33675
|
+
const agent = await withAgent({ keyPath: opts.key });
|
|
33676
|
+
const address = agent.address();
|
|
33677
|
+
const reg = await registerWallet({
|
|
33678
|
+
keypair: agent.keypair,
|
|
33679
|
+
address,
|
|
33680
|
+
base
|
|
33681
|
+
});
|
|
33682
|
+
const challenge = await fetchJson(`${base}/agent/challenge`, {
|
|
33683
|
+
method: "POST",
|
|
33684
|
+
body: { address }
|
|
33685
|
+
});
|
|
33686
|
+
const nonce = challenge.nonce;
|
|
33687
|
+
if (!nonce) {
|
|
33688
|
+
throw new Error("Failed to get a challenge nonce.");
|
|
33689
|
+
}
|
|
33690
|
+
const message = new TextEncoder().encode(
|
|
33691
|
+
`t2000-agent-profile:${nonce}`
|
|
33692
|
+
);
|
|
33693
|
+
const { signature } = await agent.keypair.signPersonalMessage(message);
|
|
33694
|
+
await fetchJson(`${base}/agent/profile`, {
|
|
33695
|
+
method: "POST",
|
|
33696
|
+
body: {
|
|
33697
|
+
address,
|
|
33698
|
+
nonce,
|
|
33699
|
+
signature,
|
|
33700
|
+
displayName: name,
|
|
33701
|
+
description: opts.description,
|
|
33702
|
+
category
|
|
33703
|
+
}
|
|
33704
|
+
});
|
|
33705
|
+
let ownerProposed = false;
|
|
33706
|
+
if (owner) {
|
|
33707
|
+
await runSponsoredTx({
|
|
33708
|
+
keypair: agent.keypair,
|
|
33709
|
+
actor: address,
|
|
33710
|
+
prepareUrl: `${base}/agent/owner/propose`,
|
|
33711
|
+
prepareBody: { address, owner },
|
|
33712
|
+
submitUrl: `${base}/agent/owner/submit`
|
|
33713
|
+
});
|
|
33714
|
+
ownerProposed = true;
|
|
33715
|
+
}
|
|
33716
|
+
const storeUrl = `${STORE_BASE}/${address}`;
|
|
33717
|
+
if (isJsonMode()) {
|
|
33718
|
+
printJson({
|
|
33719
|
+
address,
|
|
33720
|
+
walletCreated: created,
|
|
33721
|
+
registered: true,
|
|
33722
|
+
alreadyRegistered: reg.alreadyRegistered,
|
|
33723
|
+
name,
|
|
33724
|
+
...category ? { category } : {},
|
|
33725
|
+
...ownerProposed ? { ownerProposed: owner } : {},
|
|
33726
|
+
storeUrl,
|
|
33727
|
+
keyPath: opts.key ?? "~/.t2000/wallet.key"
|
|
33728
|
+
});
|
|
33729
|
+
return;
|
|
33730
|
+
}
|
|
33731
|
+
printBlank();
|
|
33732
|
+
printSuccess(`${name} is live`);
|
|
33733
|
+
printKeyValue("Address", address);
|
|
33734
|
+
printKeyValue("Store", storeUrl);
|
|
33735
|
+
printKeyValue(
|
|
33736
|
+
"Wallet",
|
|
33737
|
+
created ? `created at ${opts.key ?? "~/.t2000/wallet.key"}` : `reused ${opts.key ?? "~/.t2000/wallet.key"}`
|
|
33738
|
+
);
|
|
33739
|
+
if (ownerProposed) {
|
|
33740
|
+
printKeyValue(
|
|
33741
|
+
"Owner",
|
|
33742
|
+
`proposed ${owner} \u2014 confirm at ${STORE_BASE}/manage/agents`
|
|
33743
|
+
);
|
|
33744
|
+
}
|
|
33745
|
+
printBlank();
|
|
33746
|
+
printLine("Next:");
|
|
33747
|
+
printLine(" t2 fund # add USDC (QR / card link)");
|
|
33748
|
+
printLine(" t2 agent services add ... # list something to sell");
|
|
33749
|
+
printLine(" t2 agent deploy ... # wrap an API behind x402");
|
|
33750
|
+
printBlank();
|
|
33751
|
+
} catch (error) {
|
|
33752
|
+
handleError(error);
|
|
33753
|
+
}
|
|
33754
|
+
});
|
|
33755
|
+
}
|
|
33756
|
+
|
|
33593
33757
|
// src/commands/agent/review.ts
|
|
33594
33758
|
import { createHash } from "crypto";
|
|
33595
33759
|
var DEFAULT_GATEWAY = "https://x402.t2000.ai";
|
|
33596
|
-
async function
|
|
33760
|
+
async function fetchJson2(url, init) {
|
|
33597
33761
|
const res = await fetch(url, {
|
|
33598
33762
|
method: init?.method ?? "GET",
|
|
33599
33763
|
headers: init?.body ? { "Content-Type": "application/json" } : void 0,
|
|
@@ -33629,7 +33793,7 @@ function registerAgentReview(agent) {
|
|
|
33629
33793
|
const buyer = agentW.address();
|
|
33630
33794
|
let digest = (opts.digest ?? "").trim();
|
|
33631
33795
|
if (!digest) {
|
|
33632
|
-
const res = await
|
|
33796
|
+
const res = await fetchJson2(
|
|
33633
33797
|
`${gateway}/commerce/review?buyer=${buyer}&seller=${encodeURIComponent(seller)}`
|
|
33634
33798
|
);
|
|
33635
33799
|
const reviewable = res.reviewable ?? [];
|
|
@@ -33645,7 +33809,7 @@ function registerAgentReview(agent) {
|
|
|
33645
33809
|
reviewMessage(digest, stars, text, timestamp)
|
|
33646
33810
|
);
|
|
33647
33811
|
const { signature } = await agentW.keypair.signPersonalMessage(message);
|
|
33648
|
-
await
|
|
33812
|
+
await fetchJson2(`${gateway}/commerce/review`, {
|
|
33649
33813
|
method: "POST",
|
|
33650
33814
|
body: { digest, stars, text, timestamp, signature }
|
|
33651
33815
|
});
|
|
@@ -33674,7 +33838,7 @@ function registerAgentReview(agent) {
|
|
|
33674
33838
|
import { createHash as createHash2 } from "crypto";
|
|
33675
33839
|
import { readFileSync as readFileSync3 } from "fs";
|
|
33676
33840
|
var SLUG_RE = /^[a-z0-9][a-z0-9-]{1,39}$/;
|
|
33677
|
-
async function
|
|
33841
|
+
async function fetchJson3(url, init) {
|
|
33678
33842
|
const res = await fetch(url, {
|
|
33679
33843
|
method: init?.method ?? "GET",
|
|
33680
33844
|
headers: init?.body ? { "Content-Type": "application/json" } : void 0,
|
|
@@ -33698,7 +33862,7 @@ function canonicalServicesJson(services) {
|
|
|
33698
33862
|
);
|
|
33699
33863
|
}
|
|
33700
33864
|
async function getCatalog(base, address) {
|
|
33701
|
-
const res = await
|
|
33865
|
+
const res = await fetchJson3(
|
|
33702
33866
|
`${base}/agent/services?address=${encodeURIComponent(address)}`
|
|
33703
33867
|
);
|
|
33704
33868
|
return Array.isArray(res.services) ? res.services : [];
|
|
@@ -33706,7 +33870,7 @@ async function getCatalog(base, address) {
|
|
|
33706
33870
|
async function putCatalog(opts) {
|
|
33707
33871
|
const agent = await withAgent({ keyPath: opts.keyPath });
|
|
33708
33872
|
const address = agent.address();
|
|
33709
|
-
const challenge = await
|
|
33873
|
+
const challenge = await fetchJson3(`${opts.base}/agent/challenge`, {
|
|
33710
33874
|
method: "POST",
|
|
33711
33875
|
body: { address }
|
|
33712
33876
|
});
|
|
@@ -33719,7 +33883,7 @@ async function putCatalog(opts) {
|
|
|
33719
33883
|
`t2000-agent-services:${nonce}:${digest}`
|
|
33720
33884
|
);
|
|
33721
33885
|
const { signature } = await agent.keypair.signPersonalMessage(message);
|
|
33722
|
-
const res = await
|
|
33886
|
+
const res = await fetchJson3(`${opts.base}/agent/services`, {
|
|
33723
33887
|
method: "POST",
|
|
33724
33888
|
body: { address, nonce, signature, services: opts.services }
|
|
33725
33889
|
});
|
|
@@ -33899,10 +34063,10 @@ function registerAgentServices(agentGroup, defaults) {
|
|
|
33899
34063
|
}
|
|
33900
34064
|
|
|
33901
34065
|
// src/commands/agent/index.ts
|
|
33902
|
-
var
|
|
34066
|
+
var DEFAULT_API_BASE4 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
|
|
33903
34067
|
var DEFAULT_GATEWAY2 = process.env.T2000_GATEWAY_URL ?? "https://mpp.t2000.ai";
|
|
33904
34068
|
var DEFAULT_RAIL = process.env.T2000_RAIL_URL ?? "https://x402.t2000.ai";
|
|
33905
|
-
var
|
|
34069
|
+
var AGENT_CATEGORIES2 = [
|
|
33906
34070
|
"ai-models",
|
|
33907
34071
|
"data-feeds",
|
|
33908
34072
|
"finance",
|
|
@@ -33916,9 +34080,9 @@ function normalizeCategory(input) {
|
|
|
33916
34080
|
return;
|
|
33917
34081
|
}
|
|
33918
34082
|
const c = input.trim().toLowerCase();
|
|
33919
|
-
if (!
|
|
34083
|
+
if (!AGENT_CATEGORIES2.includes(c)) {
|
|
33920
34084
|
throw new Error(
|
|
33921
|
-
`--category must be one of: ${
|
|
34085
|
+
`--category must be one of: ${AGENT_CATEGORIES2.join(", ")} (got "${input}").`
|
|
33922
34086
|
);
|
|
33923
34087
|
}
|
|
33924
34088
|
return c;
|
|
@@ -33939,19 +34103,19 @@ async function fundCredit(agent, base, amountStr, assetOpt) {
|
|
|
33939
34103
|
throw new Error(`amount must be a positive number (got "${amountStr}").`);
|
|
33940
34104
|
}
|
|
33941
34105
|
const asset = normalizeTopupAsset(assetOpt);
|
|
33942
|
-
const cfg = await
|
|
34106
|
+
const cfg = await fetchJson4(`${base}/agent/topup`, { method: "GET" });
|
|
33943
34107
|
const treasury = cfg.treasury;
|
|
33944
34108
|
if (!treasury) {
|
|
33945
34109
|
throw new Error("Could not resolve the t2000 treasury address.");
|
|
33946
34110
|
}
|
|
33947
34111
|
const sent = await agent.send({ to: treasury, amount, asset });
|
|
33948
|
-
const topup = await
|
|
34112
|
+
const topup = await fetchJson4(`${base}/agent/topup`, {
|
|
33949
34113
|
method: "POST",
|
|
33950
34114
|
body: { address: agent.address(), digest: sent.tx }
|
|
33951
34115
|
});
|
|
33952
34116
|
return { amount, asset, balanceUsd: topup.balanceUsd };
|
|
33953
34117
|
}
|
|
33954
|
-
async function
|
|
34118
|
+
async function fetchJson4(url, init) {
|
|
33955
34119
|
const res = await fetch(url, {
|
|
33956
34120
|
method: init.method,
|
|
33957
34121
|
headers: init.body ? { "Content-Type": "application/json" } : void 0,
|
|
@@ -33970,6 +34134,7 @@ function registerAgent(program3) {
|
|
|
33970
34134
|
"after",
|
|
33971
34135
|
`
|
|
33972
34136
|
Subcommands:
|
|
34137
|
+
$ t2 agent create --name "Atlas Research" Wallet + Agent ID + profile in one pass
|
|
33973
34138
|
$ t2 agent onboard --fund 5 Fund 5 USDC \u2192 mint an API key (ready to call)
|
|
33974
34139
|
$ t2 agent onboard --fund 5 --asset USDsui
|
|
33975
34140
|
$ t2 agent onboard Already funded \u2192 just mint a key
|
|
@@ -33977,14 +34142,15 @@ Subcommands:
|
|
|
33977
34142
|
$ t2 agent services sync ./services.json Manifest IS the catalog (catalog-scale sellers)
|
|
33978
34143
|
`
|
|
33979
34144
|
);
|
|
33980
|
-
|
|
34145
|
+
registerAgentCreate(group);
|
|
34146
|
+
registerAgentServices(group, { apiBase: DEFAULT_API_BASE4 });
|
|
33981
34147
|
registerAgentReview(group);
|
|
33982
34148
|
group.command("onboard").description(
|
|
33983
34149
|
"Buy-side setup: fund credit (gasless USDC/USDsui) + mint a Private API key. Registering an Agent ID is free and separate \u2014 `t2 init` / `t2 agent register`."
|
|
33984
|
-
).option("--fund <amount>", "Stablecoin amount to deposit as credit (omit if already funded)").option("--asset <asset>", "USDC (default) or USDsui", "USDC").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${
|
|
34150
|
+
).option("--fund <amount>", "Stablecoin amount to deposit as credit (omit if already funded)").option("--asset <asset>", "USDC (default) or USDsui", "USDC").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(
|
|
33985
34151
|
async (opts) => {
|
|
33986
34152
|
try {
|
|
33987
|
-
const base = opts.api ??
|
|
34153
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
33988
34154
|
const agent = await withAgent({ keyPath: opts.key });
|
|
33989
34155
|
const address = agent.address();
|
|
33990
34156
|
if (opts.fund !== void 0) {
|
|
@@ -33995,7 +34161,7 @@ Subcommands:
|
|
|
33995
34161
|
);
|
|
33996
34162
|
}
|
|
33997
34163
|
}
|
|
33998
|
-
const challenge = await
|
|
34164
|
+
const challenge = await fetchJson4(`${base}/agent/challenge`, {
|
|
33999
34165
|
method: "POST",
|
|
34000
34166
|
body: { address }
|
|
34001
34167
|
});
|
|
@@ -34005,7 +34171,7 @@ Subcommands:
|
|
|
34005
34171
|
}
|
|
34006
34172
|
const message = new TextEncoder().encode(`t2000-agent-keys:${nonce}`);
|
|
34007
34173
|
const { signature } = await agent.keypair.signPersonalMessage(message);
|
|
34008
|
-
const minted = await
|
|
34174
|
+
const minted = await fetchJson4(`${base}/agent/keys`, {
|
|
34009
34175
|
method: "POST",
|
|
34010
34176
|
body: { address, nonce, signature }
|
|
34011
34177
|
});
|
|
@@ -34042,10 +34208,10 @@ Subcommands:
|
|
|
34042
34208
|
);
|
|
34043
34209
|
group.command("topup").argument("<amount>", "Stablecoin amount to deposit as credit").description(
|
|
34044
34210
|
"Top up this wallet's t2000 credit with gasless USDC/USDsui (no new key). The 'never runs dry' primitive \u2014 call it on a 402 or a schedule."
|
|
34045
|
-
).option("--asset <asset>", "USDC (default) or USDsui", "USDC").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${
|
|
34211
|
+
).option("--asset <asset>", "USDC (default) or USDsui", "USDC").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(
|
|
34046
34212
|
async (amount, opts) => {
|
|
34047
34213
|
try {
|
|
34048
|
-
const base = opts.api ??
|
|
34214
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34049
34215
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34050
34216
|
const funded = await fundCredit(agent, base, amount, opts.asset);
|
|
34051
34217
|
if (isJsonMode()) {
|
|
@@ -34069,9 +34235,9 @@ Subcommands:
|
|
|
34069
34235
|
);
|
|
34070
34236
|
group.command("register").description(
|
|
34071
34237
|
"Register this wallet on-chain as an Agent ID (sponsored, gasless). Idempotent \u2014 safe to re-run."
|
|
34072
|
-
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${
|
|
34238
|
+
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(async (opts) => {
|
|
34073
34239
|
try {
|
|
34074
|
-
const base = opts.api ??
|
|
34240
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34075
34241
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34076
34242
|
const address = agent.address();
|
|
34077
34243
|
const reg = await registerWallet({ keypair: agent.keypair, address, base });
|
|
@@ -34099,9 +34265,9 @@ Subcommands:
|
|
|
34099
34265
|
});
|
|
34100
34266
|
group.command("link").argument("<owner>", "The owner's Sui address (Passport) to propose").description(
|
|
34101
34267
|
"Propose an owner for this agent (two-sided \u2014 the owner must then confirm). Sponsored, gasless."
|
|
34102
|
-
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${
|
|
34268
|
+
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(async (owner, opts) => {
|
|
34103
34269
|
try {
|
|
34104
|
-
const base = opts.api ??
|
|
34270
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34105
34271
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34106
34272
|
const address = agent.address();
|
|
34107
34273
|
if (!isValidSuiAddress(owner)) {
|
|
@@ -34138,9 +34304,9 @@ Subcommands:
|
|
|
34138
34304
|
});
|
|
34139
34305
|
group.command("confirm").argument("<agent>", "The agent Sui address to confirm ownership of").description(
|
|
34140
34306
|
"Confirm ownership of an agent that proposed you as its owner. Sponsored, gasless."
|
|
34141
|
-
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${
|
|
34307
|
+
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(async (agentAddress, opts) => {
|
|
34142
34308
|
try {
|
|
34143
|
-
const base = opts.api ??
|
|
34309
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34144
34310
|
const owner = await withAgent({ keyPath: opts.key });
|
|
34145
34311
|
const address = owner.address();
|
|
34146
34312
|
const { digest } = await runSponsoredTx({
|
|
@@ -34162,9 +34328,36 @@ Subcommands:
|
|
|
34162
34328
|
handleError(error);
|
|
34163
34329
|
}
|
|
34164
34330
|
});
|
|
34331
|
+
group.command("unlink").argument("<agent>", "The agent Sui address to renounce ownership of").description(
|
|
34332
|
+
"Renounce ownership of an agent you own \u2014 the record returns to autonomous (public, on-chain). Sponsored, gasless. Re-link = the agent proposes again."
|
|
34333
|
+
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(async (agentAddress, opts) => {
|
|
34334
|
+
try {
|
|
34335
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34336
|
+
const owner = await withAgent({ keyPath: opts.key });
|
|
34337
|
+
const address = owner.address();
|
|
34338
|
+
const { digest } = await runSponsoredTx({
|
|
34339
|
+
keypair: owner.keypair,
|
|
34340
|
+
actor: address,
|
|
34341
|
+
prepareUrl: `${base}/agent/owner/renounce`,
|
|
34342
|
+
prepareBody: { owner: address, agent: agentAddress },
|
|
34343
|
+
submitUrl: `${base}/agent/owner/submit`
|
|
34344
|
+
});
|
|
34345
|
+
if (isJsonMode()) {
|
|
34346
|
+
printJson({ owner: address, agent: agentAddress, unlinked: true, digest });
|
|
34347
|
+
return;
|
|
34348
|
+
}
|
|
34349
|
+
printBlank();
|
|
34350
|
+
printSuccess(`Renounced ownership of ${truncateAddress(agentAddress)}`);
|
|
34351
|
+
printInfo("The agent is autonomous again \u2014 it can re-propose you anytime.");
|
|
34352
|
+
printKeyValue("Tx", String(digest));
|
|
34353
|
+
printBlank();
|
|
34354
|
+
} catch (error) {
|
|
34355
|
+
handleError(error);
|
|
34356
|
+
}
|
|
34357
|
+
});
|
|
34165
34358
|
group.command("profile").description(
|
|
34166
34359
|
"Set this agent's public profile (name \xB7 image \xB7 description \xB7 links). Signed, no gas \u2014 shows in the directory."
|
|
34167
|
-
).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 ${
|
|
34360
|
+
).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_BASE4})`).action(
|
|
34168
34361
|
async (opts) => {
|
|
34169
34362
|
try {
|
|
34170
34363
|
if (!(opts.name || opts.image || opts.description || opts.website || opts.twitter || opts.github)) {
|
|
@@ -34172,10 +34365,10 @@ Subcommands:
|
|
|
34172
34365
|
"Provide at least one of --name, --image, --description, --website, --twitter, --github."
|
|
34173
34366
|
);
|
|
34174
34367
|
}
|
|
34175
|
-
const base = opts.api ??
|
|
34368
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34176
34369
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34177
34370
|
const address = agent.address();
|
|
34178
|
-
const challenge = await
|
|
34371
|
+
const challenge = await fetchJson4(`${base}/agent/challenge`, {
|
|
34179
34372
|
method: "POST",
|
|
34180
34373
|
body: { address }
|
|
34181
34374
|
});
|
|
@@ -34185,7 +34378,7 @@ Subcommands:
|
|
|
34185
34378
|
}
|
|
34186
34379
|
const message = new TextEncoder().encode(`t2000-agent-profile:${nonce}`);
|
|
34187
34380
|
const { signature } = await agent.keypair.signPersonalMessage(message);
|
|
34188
|
-
await
|
|
34381
|
+
await fetchJson4(`${base}/agent/profile`, {
|
|
34189
34382
|
method: "POST",
|
|
34190
34383
|
body: {
|
|
34191
34384
|
address,
|
|
@@ -34218,8 +34411,8 @@ Subcommands:
|
|
|
34218
34411
|
'Comma-separated methods you accept, e.g. "x402"'
|
|
34219
34412
|
).option("--price <usdc>", "Price per call in USDC (e.g. 0.02) \u2014 buyers pay this").option(
|
|
34220
34413
|
"--category <category>",
|
|
34221
|
-
`Storefront category: ${
|
|
34222
|
-
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${
|
|
34414
|
+
`Storefront category: ${AGENT_CATEGORIES2.join(" | ")}`
|
|
34415
|
+
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(
|
|
34223
34416
|
async (opts) => {
|
|
34224
34417
|
try {
|
|
34225
34418
|
if (opts.mcpEndpoint === void 0 && opts.paymentMethods === void 0 && opts.price === void 0 && opts.category === void 0) {
|
|
@@ -34234,7 +34427,7 @@ Subcommands:
|
|
|
34234
34427
|
}
|
|
34235
34428
|
}
|
|
34236
34429
|
const category = normalizeCategory(opts.category);
|
|
34237
|
-
const base = opts.api ??
|
|
34430
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34238
34431
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34239
34432
|
const address = agent.address();
|
|
34240
34433
|
const prepareBody = { address };
|
|
@@ -34291,14 +34484,14 @@ Subcommands:
|
|
|
34291
34484
|
{}
|
|
34292
34485
|
).option("--method <method>", "Upstream method: GET or POST (default POST)").option("--price <usdc>", "Price per call in USDC (e.g. 0.02)").option(
|
|
34293
34486
|
"--category <category>",
|
|
34294
|
-
`Storefront category: ${
|
|
34487
|
+
`Storefront category: ${AGENT_CATEGORIES2.join(" | ")}`
|
|
34295
34488
|
).option("--remove", "Take down the deployed service").option(
|
|
34296
34489
|
"--service <slug>",
|
|
34297
34490
|
"Catalog service slug \u2014 wrap config for ONE SKU (Store v2; omit = the default service)"
|
|
34298
|
-
).option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${
|
|
34491
|
+
).option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(
|
|
34299
34492
|
async (opts) => {
|
|
34300
34493
|
try {
|
|
34301
|
-
const base = opts.api ??
|
|
34494
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34302
34495
|
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34303
34496
|
const category = normalizeCategory(opts.category);
|
|
34304
34497
|
const slug = opts.service?.trim().toLowerCase() || void 0;
|
|
@@ -34310,7 +34503,7 @@ Subcommands:
|
|
|
34310
34503
|
const { signature: signature2 } = await agent.keypair.signPersonalMessage(
|
|
34311
34504
|
new TextEncoder().encode(msg2)
|
|
34312
34505
|
);
|
|
34313
|
-
await
|
|
34506
|
+
await fetchJson4(`${gateway}/deploy/config`, {
|
|
34314
34507
|
method: "DELETE",
|
|
34315
34508
|
body: { address, timestamp: ts2, signature: signature2, ...slug ? { slug } : {} }
|
|
34316
34509
|
});
|
|
@@ -34349,7 +34542,7 @@ Subcommands:
|
|
|
34349
34542
|
const { signature } = await agent.keypair.signPersonalMessage(
|
|
34350
34543
|
new TextEncoder().encode(msg)
|
|
34351
34544
|
);
|
|
34352
|
-
await
|
|
34545
|
+
await fetchJson4(`${gateway}/deploy/config`, {
|
|
34353
34546
|
method: "POST",
|
|
34354
34547
|
body: {
|
|
34355
34548
|
address,
|
|
@@ -34502,7 +34695,7 @@ Subcommands:
|
|
|
34502
34695
|
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34503
34696
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34504
34697
|
const address = agent.address();
|
|
34505
|
-
const stats = await
|
|
34698
|
+
const stats = await fetchJson4(
|
|
34506
34699
|
`${gateway}/commerce/stats/${address}`,
|
|
34507
34700
|
{ method: "GET" }
|
|
34508
34701
|
);
|
|
@@ -34525,13 +34718,13 @@ Subcommands:
|
|
|
34525
34718
|
});
|
|
34526
34719
|
group.command("handle").argument("<label>", "Handle label (3\u201320 chars: lowercase a\u2013z, 0\u20139, hyphens)").description(
|
|
34527
34720
|
"Claim <label>.agent-id.sui \u2192 this wallet (custody-minted, gasless). Use --release to give it up."
|
|
34528
|
-
).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 ${
|
|
34721
|
+
).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(
|
|
34529
34722
|
async (label, opts) => {
|
|
34530
34723
|
try {
|
|
34531
|
-
const base = opts.api ??
|
|
34724
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34532
34725
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34533
34726
|
const address = agent.address();
|
|
34534
|
-
const challenge = await
|
|
34727
|
+
const challenge = await fetchJson4(`${base}/agent/challenge`, {
|
|
34535
34728
|
method: "POST",
|
|
34536
34729
|
body: { address }
|
|
34537
34730
|
});
|
|
@@ -34543,7 +34736,7 @@ Subcommands:
|
|
|
34543
34736
|
const message = new TextEncoder().encode(`${action}:${nonce}:${label}`);
|
|
34544
34737
|
const { signature } = await agent.keypair.signPersonalMessage(message);
|
|
34545
34738
|
const path2 = opts.release ? "/agent/handle/release" : "/agent/handle";
|
|
34546
|
-
const res = await
|
|
34739
|
+
const res = await fetchJson4(`${base}${path2}`, {
|
|
34547
34740
|
method: "POST",
|
|
34548
34741
|
body: { address, label, nonce, signature }
|
|
34549
34742
|
});
|
|
@@ -34569,7 +34762,7 @@ Subcommands:
|
|
|
34569
34762
|
}
|
|
34570
34763
|
|
|
34571
34764
|
// src/commands/agents.ts
|
|
34572
|
-
var
|
|
34765
|
+
var DEFAULT_API_BASE5 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
|
|
34573
34766
|
async function getJson(url) {
|
|
34574
34767
|
const res = await fetch(url, { headers: { accept: "application/json" } });
|
|
34575
34768
|
if (!res.ok) {
|
|
@@ -34584,10 +34777,10 @@ function firstLine(text, max = 76) {
|
|
|
34584
34777
|
function registerAgents(program3) {
|
|
34585
34778
|
program3.command("agents").argument("[address]", "Show one agent\u2019s full listing (profile + reputation)").description(
|
|
34586
34779
|
"Browse the agent store (agents.t2000.ai): priced services from the live directory, or one agent\u2019s full listing. Buy with `t2 agent pay <address>`. [Agent Commerce]"
|
|
34587
|
-
).option("--category <category>", "Filter the list by store category").option("--all", "Include agents without a priced service").option("--limit <n>", "Max rows (default: all)").option("--api <url>", `API base URL (default ${
|
|
34780
|
+
).option("--category <category>", "Filter the list by store category").option("--all", "Include agents without a priced service").option("--limit <n>", "Max rows (default: all)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE5})`).action(
|
|
34588
34781
|
async (address, opts) => {
|
|
34589
34782
|
try {
|
|
34590
|
-
const base = opts.api ??
|
|
34783
|
+
const base = opts.api ?? DEFAULT_API_BASE5;
|
|
34591
34784
|
if (address) {
|
|
34592
34785
|
const profile = await getJson(`${base}/agents/${address}`);
|
|
34593
34786
|
if (isJsonMode()) {
|