@t2000/cli 5.7.1 → 5.7.3
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.7.
|
|
80335
|
+
var PKG_VERSION = "5.7.3";
|
|
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-HFB2G5PO.js.map
|
package/dist/index.js
CHANGED
|
@@ -31328,6 +31328,22 @@ async function postJson(url, body) {
|
|
|
31328
31328
|
}
|
|
31329
31329
|
return json;
|
|
31330
31330
|
}
|
|
31331
|
+
async function runSponsoredTx(opts) {
|
|
31332
|
+
const prep = await postJson(opts.prepareUrl, opts.prepareBody);
|
|
31333
|
+
const nonce = prep.nonce;
|
|
31334
|
+
const txBytes = prep.txBytes;
|
|
31335
|
+
if (!(nonce && txBytes)) {
|
|
31336
|
+
throw new Error("Failed to prepare the transaction.");
|
|
31337
|
+
}
|
|
31338
|
+
const bytes = new Uint8Array(Buffer.from(txBytes, "base64"));
|
|
31339
|
+
const { signature } = await opts.keypair.signTransaction(bytes);
|
|
31340
|
+
const res = await postJson(opts.submitUrl, {
|
|
31341
|
+
nonce,
|
|
31342
|
+
address: opts.actor,
|
|
31343
|
+
signature
|
|
31344
|
+
});
|
|
31345
|
+
return { digest: res.digest };
|
|
31346
|
+
}
|
|
31331
31347
|
async function registerWallet(opts) {
|
|
31332
31348
|
const prep = await postJson(`${opts.base}/agent/register/prepare`, {
|
|
31333
31349
|
address: opts.address
|
|
@@ -32564,7 +32580,7 @@ function registerMcpStart(parent) {
|
|
|
32564
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) => {
|
|
32565
32581
|
let mod2;
|
|
32566
32582
|
try {
|
|
32567
|
-
mod2 = await import("./dist-
|
|
32583
|
+
mod2 = await import("./dist-HFB2G5PO.js");
|
|
32568
32584
|
} catch {
|
|
32569
32585
|
console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
|
|
32570
32586
|
process.exit(1);
|
|
@@ -33066,6 +33082,107 @@ Subcommands:
|
|
|
33066
33082
|
handleError(error);
|
|
33067
33083
|
}
|
|
33068
33084
|
});
|
|
33085
|
+
group.command("link").argument("<owner>", "The owner's Sui address (Passport) to propose").description(
|
|
33086
|
+
"Propose an owner for this agent (two-sided \u2014 the owner must then confirm). Sponsored, gasless."
|
|
33087
|
+
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE2})`).action(async (owner, opts) => {
|
|
33088
|
+
try {
|
|
33089
|
+
const base = opts.api ?? DEFAULT_API_BASE2;
|
|
33090
|
+
const agent = await withAgent({ keyPath: opts.key });
|
|
33091
|
+
const address = agent.address();
|
|
33092
|
+
const { digest } = await runSponsoredTx({
|
|
33093
|
+
keypair: agent.keypair,
|
|
33094
|
+
actor: address,
|
|
33095
|
+
prepareUrl: `${base}/agent/owner/propose`,
|
|
33096
|
+
prepareBody: { address, owner },
|
|
33097
|
+
submitUrl: `${base}/agent/owner/submit`
|
|
33098
|
+
});
|
|
33099
|
+
if (isJsonMode()) {
|
|
33100
|
+
printJson({ agent: address, pendingOwner: owner, digest });
|
|
33101
|
+
return;
|
|
33102
|
+
}
|
|
33103
|
+
printBlank();
|
|
33104
|
+
printSuccess(`Proposed owner: ${truncateAddress(owner)}`);
|
|
33105
|
+
printInfo(
|
|
33106
|
+
`They must confirm: \`t2 agent confirm ${address}\` (or via the console).`
|
|
33107
|
+
);
|
|
33108
|
+
printKeyValue("Tx", String(digest));
|
|
33109
|
+
printBlank();
|
|
33110
|
+
} catch (error) {
|
|
33111
|
+
handleError(error);
|
|
33112
|
+
}
|
|
33113
|
+
});
|
|
33114
|
+
group.command("confirm").argument("<agent>", "The agent Sui address to confirm ownership of").description(
|
|
33115
|
+
"Confirm ownership of an agent that proposed you as its owner. Sponsored, gasless."
|
|
33116
|
+
).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE2})`).action(async (agentAddress, opts) => {
|
|
33117
|
+
try {
|
|
33118
|
+
const base = opts.api ?? DEFAULT_API_BASE2;
|
|
33119
|
+
const owner = await withAgent({ keyPath: opts.key });
|
|
33120
|
+
const address = owner.address();
|
|
33121
|
+
const { digest } = await runSponsoredTx({
|
|
33122
|
+
keypair: owner.keypair,
|
|
33123
|
+
actor: address,
|
|
33124
|
+
prepareUrl: `${base}/agent/owner/confirm`,
|
|
33125
|
+
prepareBody: { owner: address, agent: agentAddress },
|
|
33126
|
+
submitUrl: `${base}/agent/owner/submit`
|
|
33127
|
+
});
|
|
33128
|
+
if (isJsonMode()) {
|
|
33129
|
+
printJson({ owner: address, agent: agentAddress, digest });
|
|
33130
|
+
return;
|
|
33131
|
+
}
|
|
33132
|
+
printBlank();
|
|
33133
|
+
printSuccess(`Confirmed ownership of ${truncateAddress(agentAddress)}`);
|
|
33134
|
+
printKeyValue("Tx", String(digest));
|
|
33135
|
+
printBlank();
|
|
33136
|
+
} catch (error) {
|
|
33137
|
+
handleError(error);
|
|
33138
|
+
}
|
|
33139
|
+
});
|
|
33140
|
+
group.command("profile").description(
|
|
33141
|
+
"Set this agent's public profile (name \xB7 image \xB7 description). Signed, no gas \u2014 shows in the directory."
|
|
33142
|
+
).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(
|
|
33143
|
+
async (opts) => {
|
|
33144
|
+
try {
|
|
33145
|
+
if (!(opts.name || opts.image || opts.description)) {
|
|
33146
|
+
throw new Error(
|
|
33147
|
+
"Provide at least one of --name, --image, --description."
|
|
33148
|
+
);
|
|
33149
|
+
}
|
|
33150
|
+
const base = opts.api ?? DEFAULT_API_BASE2;
|
|
33151
|
+
const agent = await withAgent({ keyPath: opts.key });
|
|
33152
|
+
const address = agent.address();
|
|
33153
|
+
const challenge = await fetchJson(`${base}/agent/challenge`, {
|
|
33154
|
+
method: "POST",
|
|
33155
|
+
body: { address }
|
|
33156
|
+
});
|
|
33157
|
+
const nonce = challenge.nonce;
|
|
33158
|
+
if (!nonce) {
|
|
33159
|
+
throw new Error("Failed to get a challenge nonce.");
|
|
33160
|
+
}
|
|
33161
|
+
const message = new TextEncoder().encode(`t2000-agent-profile:${nonce}`);
|
|
33162
|
+
const { signature } = await agent.keypair.signPersonalMessage(message);
|
|
33163
|
+
await fetchJson(`${base}/agent/profile`, {
|
|
33164
|
+
method: "POST",
|
|
33165
|
+
body: {
|
|
33166
|
+
address,
|
|
33167
|
+
nonce,
|
|
33168
|
+
signature,
|
|
33169
|
+
displayName: opts.name,
|
|
33170
|
+
imageUrl: opts.image,
|
|
33171
|
+
description: opts.description
|
|
33172
|
+
}
|
|
33173
|
+
});
|
|
33174
|
+
if (isJsonMode()) {
|
|
33175
|
+
printJson({ address, updated: true });
|
|
33176
|
+
return;
|
|
33177
|
+
}
|
|
33178
|
+
printBlank();
|
|
33179
|
+
printSuccess("Profile updated.");
|
|
33180
|
+
printBlank();
|
|
33181
|
+
} catch (error) {
|
|
33182
|
+
handleError(error);
|
|
33183
|
+
}
|
|
33184
|
+
}
|
|
33185
|
+
);
|
|
33069
33186
|
group.command("handle").argument("<label>", "Handle label (3\u201320 chars: lowercase a\u2013z, 0\u20139, hyphens)").description(
|
|
33070
33187
|
"Claim <label>.agent-id.sui \u2192 this wallet (custody-minted, gasless). Use --release to give it up."
|
|
33071
33188
|
).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_BASE2})`).action(
|