@t2000/cli 0.22.26 → 0.24.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/README.md +12 -98
- package/dist/{ccip-JEEJV65M.js → ccip-XP27NGI7.js} +3 -3
- package/dist/{chunk-A5X4KG7U.js → chunk-3I6VJOM6.js} +210 -970
- package/dist/chunk-3I6VJOM6.js.map +1 -0
- package/dist/chunk-EI3GHTKX.js +968 -0
- package/dist/chunk-EI3GHTKX.js.map +1 -0
- package/dist/{chunk-3WKGZRWT.js → chunk-JJCGJTSI.js} +44787 -55564
- package/dist/chunk-JJCGJTSI.js.map +1 -0
- package/dist/{chunk-XOAZJ42V.js → chunk-Q2LY5BHK.js} +589 -584
- package/dist/{chunk-XOAZJ42V.js.map → chunk-Q2LY5BHK.js.map} +1 -1
- package/dist/{chunk-EEPD7SHV.js → chunk-TYYJRUQI.js} +15755 -15918
- package/dist/chunk-TYYJRUQI.js.map +1 -0
- package/dist/{client-R3NRAXMD.js → client-IXUBQ3HM.js} +334 -638
- package/dist/client-IXUBQ3HM.js.map +1 -0
- package/dist/client-YNWQPUC5.js +84 -0
- package/dist/client-YNWQPUC5.js.map +1 -0
- package/dist/{dist-KJM2NT74.js → dist-22NK522A.js} +124 -511
- package/dist/{dist-KJM2NT74.js.map → dist-22NK522A.js.map} +1 -1
- package/dist/{dist-NBWIWHHS.js → dist-2P6AEWCE.js} +5 -29
- package/dist/index.js +179 -1034
- package/dist/index.js.map +1 -1
- package/package.json +5 -6
- package/dist/chunk-3WKGZRWT.js.map +0 -1
- package/dist/chunk-77SWBATH.js +0 -204
- package/dist/chunk-77SWBATH.js.map +0 -1
- package/dist/chunk-A5X4KG7U.js.map +0 -1
- package/dist/chunk-EEPD7SHV.js.map +0 -1
- package/dist/client-CK5OR2TP.js +0 -746
- package/dist/client-CK5OR2TP.js.map +0 -1
- package/dist/client-R3NRAXMD.js.map +0 -1
- /package/dist/{ccip-JEEJV65M.js.map → ccip-XP27NGI7.js.map} +0 -0
- /package/dist/{dist-NBWIWHHS.js.map → dist-2P6AEWCE.js.map} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'module'; import { fileURLToPath as __fileURLToPath } from 'url'; import { dirname as __pathDirname } from 'path'; const require = __createRequire(import.meta.url); const __filename = __fileURLToPath(import.meta.url); const __dirname = __pathDirname(__filename);
|
|
2
2
|
import {
|
|
3
|
-
INVESTMENT_ASSETS,
|
|
4
3
|
SafeguardError,
|
|
5
4
|
T2000,
|
|
6
5
|
T2000Error,
|
|
@@ -8,9 +7,9 @@ import {
|
|
|
8
7
|
ZodOptional,
|
|
9
8
|
external_exports,
|
|
10
9
|
objectType
|
|
11
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JJCGJTSI.js";
|
|
12
11
|
import "./chunk-V7PXDEKG.js";
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-Q2LY5BHK.js";
|
|
14
13
|
import "./chunk-3XUF7GM3.js";
|
|
15
14
|
import {
|
|
16
15
|
__commonJS,
|
|
@@ -16998,14 +16997,13 @@ function errorResult(err) {
|
|
|
16998
16997
|
function registerReadTools(server, agent) {
|
|
16999
16998
|
server.tool(
|
|
17000
16999
|
"t2000_overview",
|
|
17001
|
-
"Complete account snapshot in ONE call \u2014 balance, savings positions,
|
|
17000
|
+
"Complete account snapshot in ONE call \u2014 balance, savings positions, health factor, yield earnings, fund status, and pending rewards. Use this for morning briefings, general account questions, or any time you need the full picture. Prefer this over calling individual tools.",
|
|
17002
17001
|
{},
|
|
17003
17002
|
async () => {
|
|
17004
17003
|
try {
|
|
17005
|
-
const [balance, positions,
|
|
17004
|
+
const [balance, positions, health, earnings, fundStatus, pendingRewards] = await Promise.allSettled([
|
|
17006
17005
|
agent.balance(),
|
|
17007
17006
|
agent.positions(),
|
|
17008
|
-
agent.getPortfolio(),
|
|
17009
17007
|
agent.healthFactor(),
|
|
17010
17008
|
agent.earnings(),
|
|
17011
17009
|
agent.fundStatus(),
|
|
@@ -17014,13 +17012,6 @@ function registerReadTools(server, agent) {
|
|
|
17014
17012
|
const result = {
|
|
17015
17013
|
balance: balance.status === "fulfilled" ? balance.value : null,
|
|
17016
17014
|
positions: positions.status === "fulfilled" ? positions.value : null,
|
|
17017
|
-
portfolio: portfolio.status === "fulfilled" ? {
|
|
17018
|
-
...portfolio.value,
|
|
17019
|
-
positions: portfolio.value.positions.map((p) => ({
|
|
17020
|
-
...p,
|
|
17021
|
-
...p.currentPrice === 0 && p.totalAmount > 0 ? { note: "price unavailable" } : {}
|
|
17022
|
-
}))
|
|
17023
|
-
} : null,
|
|
17024
17015
|
health: health.status === "fulfilled" ? health.value : null,
|
|
17025
17016
|
earnings: earnings.status === "fulfilled" ? earnings.value : null,
|
|
17026
17017
|
fundStatus: fundStatus.status === "fulfilled" ? fundStatus.value : null,
|
|
@@ -17060,7 +17051,7 @@ function registerReadTools(server, agent) {
|
|
|
17060
17051
|
);
|
|
17061
17052
|
server.tool(
|
|
17062
17053
|
"t2000_positions",
|
|
17063
|
-
"View current lending positions
|
|
17054
|
+
"View current lending positions on NAVI \u2014 deposits, borrows, APYs. For a full account snapshot, prefer t2000_overview instead.",
|
|
17064
17055
|
{},
|
|
17065
17056
|
async () => {
|
|
17066
17057
|
try {
|
|
@@ -17073,7 +17064,7 @@ function registerReadTools(server, agent) {
|
|
|
17073
17064
|
);
|
|
17074
17065
|
server.tool(
|
|
17075
17066
|
"t2000_rates",
|
|
17076
|
-
"Get best available interest rates per asset across all lending protocols. Use alongside t2000_positions to compare current vs best rates.
|
|
17067
|
+
"Get best available interest rates per asset across all lending protocols. Use alongside t2000_positions to compare current vs best rates.",
|
|
17077
17068
|
{},
|
|
17078
17069
|
async () => {
|
|
17079
17070
|
try {
|
|
@@ -17099,7 +17090,7 @@ function registerReadTools(server, agent) {
|
|
|
17099
17090
|
);
|
|
17100
17091
|
server.tool(
|
|
17101
17092
|
"t2000_history",
|
|
17102
|
-
"View recent transactions \u2014 sends, saves, borrows,
|
|
17093
|
+
"View recent transactions \u2014 sends, saves, borrows, MPP (paid API) payments. Each entry includes a transaction digest that can be viewed on Suiscan (https://suiscan.xyz/mainnet/tx/{digest}). Use for activity summaries and weekly recaps.",
|
|
17103
17094
|
{ limit: external_exports.number().optional().describe("Number of transactions to return (default: 20)") },
|
|
17104
17095
|
async ({ limit }) => {
|
|
17105
17096
|
try {
|
|
@@ -17164,7 +17155,7 @@ function registerReadTools(server, agent) {
|
|
|
17164
17155
|
);
|
|
17165
17156
|
server.tool(
|
|
17166
17157
|
"t2000_all_rates",
|
|
17167
|
-
'Compare interest rates across
|
|
17158
|
+
'Compare USDC (and other) interest rates across all protocols side-by-side. Use when the user asks "am I getting the best rate?" or wants to compare protocols. NOTE: Deposits are USDC-only \u2014 t2000_save always saves USDC at the best USDC rate. This tool is for informational comparisons.',
|
|
17168
17159
|
{},
|
|
17169
17160
|
async () => {
|
|
17170
17161
|
try {
|
|
@@ -17216,26 +17207,6 @@ Call t2000_services first to discover the right endpoint, then t2000_pay to exec
|
|
|
17216
17207
|
}
|
|
17217
17208
|
}
|
|
17218
17209
|
);
|
|
17219
|
-
server.tool(
|
|
17220
|
-
"t2000_portfolio",
|
|
17221
|
-
"Show investment portfolio \u2014 positions, cost basis, current value, unrealized/realized P&L, strategy groupings. For a full account snapshot, prefer t2000_overview instead.",
|
|
17222
|
-
{},
|
|
17223
|
-
async () => {
|
|
17224
|
-
try {
|
|
17225
|
-
const result = await agent.getPortfolio();
|
|
17226
|
-
const enriched = {
|
|
17227
|
-
...result,
|
|
17228
|
-
positions: result.positions.map((p) => ({
|
|
17229
|
-
...p,
|
|
17230
|
-
...p.currentPrice === 0 && p.totalAmount > 0 ? { note: "price unavailable" } : {}
|
|
17231
|
-
}))
|
|
17232
|
-
};
|
|
17233
|
-
return { content: [{ type: "text", text: JSON.stringify(enriched) }] };
|
|
17234
|
-
} catch (err) {
|
|
17235
|
-
return errorResult(err);
|
|
17236
|
-
}
|
|
17237
|
-
}
|
|
17238
|
-
);
|
|
17239
17210
|
}
|
|
17240
17211
|
var TxMutex = class {
|
|
17241
17212
|
queue = Promise.resolve();
|
|
@@ -17273,7 +17244,7 @@ function registerWriteTools(server, agent) {
|
|
|
17273
17244
|
const mutex = new TxMutex();
|
|
17274
17245
|
server.tool(
|
|
17275
17246
|
"t2000_send",
|
|
17276
|
-
"Send USDC
|
|
17247
|
+
"Send USDC to a Sui address or contact name. Amount is in dollars. Subject to per-transaction and daily send limits. Set dryRun: true to preview without signing.",
|
|
17277
17248
|
{
|
|
17278
17249
|
to: external_exports.string().describe("Recipient Sui address (0x...) or contact name (e.g. 'Tom')"),
|
|
17279
17250
|
amount: external_exports.number().describe("Amount in dollars to send"),
|
|
@@ -17316,17 +17287,19 @@ function registerWriteTools(server, agent) {
|
|
|
17316
17287
|
);
|
|
17317
17288
|
server.tool(
|
|
17318
17289
|
"t2000_save",
|
|
17319
|
-
'Deposit
|
|
17290
|
+
'Deposit to NAVI lending to earn yield. Supports USDC (default), USDT, SUI, USDe, USDsui. Amount is in token units. Use "all" to save entire available balance. Set dryRun: true to preview.',
|
|
17320
17291
|
{
|
|
17321
|
-
amount: external_exports.union([external_exports.number(), external_exports.literal("all")]).describe('
|
|
17292
|
+
amount: external_exports.union([external_exports.number(), external_exports.literal("all")]).describe('Amount to save, or "all"'),
|
|
17293
|
+
asset: external_exports.enum(["USDC", "USDT", "SUI", "USDe", "USDsui"]).optional().describe("Asset to deposit (default: USDC)"),
|
|
17322
17294
|
dryRun: external_exports.boolean().optional().describe("Preview without signing (default: false)")
|
|
17323
17295
|
},
|
|
17324
|
-
async ({ amount, dryRun }) => {
|
|
17296
|
+
async ({ amount, asset, dryRun }) => {
|
|
17325
17297
|
try {
|
|
17326
17298
|
if (dryRun) {
|
|
17327
17299
|
agent.enforcer.assertNotLocked();
|
|
17328
17300
|
const balance = await agent.balance();
|
|
17329
17301
|
const rates = await agent.rates();
|
|
17302
|
+
const assetKey = asset ?? "USDC";
|
|
17330
17303
|
const saveAmount = amount === "all" ? balance.available - 1 : amount;
|
|
17331
17304
|
return {
|
|
17332
17305
|
content: [{
|
|
@@ -17334,13 +17307,14 @@ function registerWriteTools(server, agent) {
|
|
|
17334
17307
|
text: JSON.stringify({
|
|
17335
17308
|
preview: true,
|
|
17336
17309
|
amount: saveAmount,
|
|
17337
|
-
|
|
17310
|
+
asset: assetKey,
|
|
17311
|
+
currentApy: rates[assetKey]?.saveApy ?? rates.USDC?.saveApy ?? 0,
|
|
17338
17312
|
savingsBalanceAfter: balance.savings + saveAmount
|
|
17339
17313
|
})
|
|
17340
17314
|
}]
|
|
17341
17315
|
};
|
|
17342
17316
|
}
|
|
17343
|
-
const result = await mutex.run(() => agent.save({ amount }));
|
|
17317
|
+
const result = await mutex.run(() => agent.save({ amount, asset }));
|
|
17344
17318
|
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17345
17319
|
} catch (err) {
|
|
17346
17320
|
return errorResult(err);
|
|
@@ -17349,31 +17323,33 @@ function registerWriteTools(server, agent) {
|
|
|
17349
17323
|
);
|
|
17350
17324
|
server.tool(
|
|
17351
17325
|
"t2000_withdraw",
|
|
17352
|
-
'Withdraw from
|
|
17326
|
+
'Withdraw from NAVI lending back to wallet. Supports any deposited asset. Amount is in token units. Use "all" to withdraw everything. Set dryRun: true to preview.',
|
|
17353
17327
|
{
|
|
17354
|
-
amount: external_exports.union([external_exports.number(), external_exports.literal("all")]).describe('
|
|
17328
|
+
amount: external_exports.union([external_exports.number(), external_exports.literal("all")]).describe('Amount to withdraw, or "all"'),
|
|
17329
|
+
asset: external_exports.string().optional().describe("Asset to withdraw (default: auto-selects largest position)"),
|
|
17355
17330
|
dryRun: external_exports.boolean().optional().describe("Preview without signing (default: false)")
|
|
17356
17331
|
},
|
|
17357
|
-
async ({ amount, dryRun }) => {
|
|
17332
|
+
async ({ amount, asset, dryRun }) => {
|
|
17358
17333
|
try {
|
|
17359
17334
|
if (dryRun) {
|
|
17360
17335
|
agent.enforcer.assertNotLocked();
|
|
17361
17336
|
const positions = await agent.positions();
|
|
17362
17337
|
const health = await agent.healthFactor();
|
|
17363
|
-
const savings = positions.positions.filter((p) => p.type === "save").reduce((sum, p) => sum + p.amount, 0);
|
|
17338
|
+
const savings = positions.positions.filter((p) => p.type === "save" && (!asset || p.asset === asset)).reduce((sum, p) => sum + p.amount, 0);
|
|
17364
17339
|
return {
|
|
17365
17340
|
content: [{
|
|
17366
17341
|
type: "text",
|
|
17367
17342
|
text: JSON.stringify({
|
|
17368
17343
|
preview: true,
|
|
17369
17344
|
amount: amount === "all" ? savings : amount,
|
|
17345
|
+
asset: asset ?? "auto",
|
|
17370
17346
|
currentSavings: savings,
|
|
17371
17347
|
currentHealthFactor: health.healthFactor
|
|
17372
17348
|
})
|
|
17373
17349
|
}]
|
|
17374
17350
|
};
|
|
17375
17351
|
}
|
|
17376
|
-
const result = await mutex.run(() => agent.withdraw({ amount }));
|
|
17352
|
+
const result = await mutex.run(() => agent.withdraw({ amount, asset }));
|
|
17377
17353
|
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17378
17354
|
} catch (err) {
|
|
17379
17355
|
return errorResult(err);
|
|
@@ -17446,251 +17422,9 @@ function registerWriteTools(server, agent) {
|
|
|
17446
17422
|
}
|
|
17447
17423
|
}
|
|
17448
17424
|
);
|
|
17449
|
-
server.tool(
|
|
17450
|
-
"t2000_swap",
|
|
17451
|
-
"Swap assets via Cetus DEX (e.g. USDC to SUI, SUI to USDC). Amount is in source asset units. Set dryRun: true to get a quote without executing.",
|
|
17452
|
-
{
|
|
17453
|
-
amount: external_exports.number().describe("Amount to swap (in source asset units)"),
|
|
17454
|
-
from: external_exports.string().describe("Source asset (e.g. USDC, SUI)"),
|
|
17455
|
-
to: external_exports.string().describe("Target asset (e.g. SUI, USDC)"),
|
|
17456
|
-
maxSlippage: external_exports.number().optional().describe("Max slippage percentage (default: 3%)"),
|
|
17457
|
-
dryRun: external_exports.boolean().optional().describe("Preview without signing (default: false)")
|
|
17458
|
-
},
|
|
17459
|
-
async ({ amount, from, to, maxSlippage, dryRun }) => {
|
|
17460
|
-
try {
|
|
17461
|
-
if (dryRun) {
|
|
17462
|
-
agent.enforcer.assertNotLocked();
|
|
17463
|
-
const quote = await agent.swapQuote({ from, to, amount });
|
|
17464
|
-
return {
|
|
17465
|
-
content: [{
|
|
17466
|
-
type: "text",
|
|
17467
|
-
text: JSON.stringify({
|
|
17468
|
-
preview: true,
|
|
17469
|
-
from,
|
|
17470
|
-
to,
|
|
17471
|
-
amount,
|
|
17472
|
-
expectedOutput: quote.expectedOutput,
|
|
17473
|
-
priceImpact: quote.priceImpact,
|
|
17474
|
-
fee: quote.fee.amount
|
|
17475
|
-
})
|
|
17476
|
-
}]
|
|
17477
|
-
};
|
|
17478
|
-
}
|
|
17479
|
-
const result = await mutex.run(
|
|
17480
|
-
() => agent.swap({ from, to, amount, maxSlippage })
|
|
17481
|
-
);
|
|
17482
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17483
|
-
} catch (err) {
|
|
17484
|
-
return errorResult(err);
|
|
17485
|
-
}
|
|
17486
|
-
}
|
|
17487
|
-
);
|
|
17488
|
-
const investAssets = Object.keys(INVESTMENT_ASSETS);
|
|
17489
|
-
server.tool(
|
|
17490
|
-
"t2000_invest",
|
|
17491
|
-
"Buy, sell, earn yield, or stop earning on investment assets. Actions: buy (invest USD), sell (convert to USDC), earn (deposit into best-rate lending for yield), unearn (withdraw from lending, keep in portfolio). Amount required for buy/sell only. If checking balance is insufficient for a buy, the SDK will auto-withdraw from savings \u2014 no manual withdraw needed.",
|
|
17492
|
-
{
|
|
17493
|
-
action: external_exports.enum(["buy", "sell", "earn", "unearn"]).describe("'buy' to invest, 'sell' to liquidate, 'earn' to deposit into lending for yield, 'unearn' to withdraw from lending"),
|
|
17494
|
-
asset: external_exports.enum(investAssets).describe("Asset to invest in"),
|
|
17495
|
-
amount: external_exports.union([external_exports.number(), external_exports.literal("all")]).optional().describe("USD amount (required for buy/sell, ignored for earn/unearn)"),
|
|
17496
|
-
slippage: external_exports.number().optional().describe("Max slippage percent (default: 3, for buy/sell only)"),
|
|
17497
|
-
dryRun: external_exports.boolean().optional().describe("Preview without signing (default: false)")
|
|
17498
|
-
},
|
|
17499
|
-
async ({ action, asset, amount, slippage, dryRun }) => {
|
|
17500
|
-
try {
|
|
17501
|
-
if (dryRun) {
|
|
17502
|
-
agent.enforcer.assertNotLocked();
|
|
17503
|
-
const balance = await agent.balance();
|
|
17504
|
-
const portfolio = await agent.getPortfolio();
|
|
17505
|
-
const position = portfolio.positions.find((p) => p.asset === asset);
|
|
17506
|
-
if (action === "sell" && amount === "all" && !position) {
|
|
17507
|
-
return {
|
|
17508
|
-
content: [{ type: "text", text: JSON.stringify({ preview: true, error: `No ${asset} position to sell` }) }]
|
|
17509
|
-
};
|
|
17510
|
-
}
|
|
17511
|
-
return {
|
|
17512
|
-
content: [{
|
|
17513
|
-
type: "text",
|
|
17514
|
-
text: JSON.stringify({
|
|
17515
|
-
preview: true,
|
|
17516
|
-
action,
|
|
17517
|
-
asset,
|
|
17518
|
-
amount: amount === "all" ? position?.currentValue ?? 0 : amount ?? position?.totalAmount ?? 0,
|
|
17519
|
-
currentBalance: balance.available,
|
|
17520
|
-
currentPosition: position ?? null,
|
|
17521
|
-
earning: position?.earning ?? false,
|
|
17522
|
-
earningProtocol: position?.earningProtocol ?? null,
|
|
17523
|
-
earningApy: position?.earningApy ?? null
|
|
17524
|
-
})
|
|
17525
|
-
}]
|
|
17526
|
-
};
|
|
17527
|
-
}
|
|
17528
|
-
const maxSlippage = slippage ? slippage / 100 : void 0;
|
|
17529
|
-
if (action === "buy") {
|
|
17530
|
-
if (typeof amount !== "number") throw new Error("Buy amount must be a number");
|
|
17531
|
-
const result = await mutex.run(() => agent.investBuy({ asset, usdAmount: amount, maxSlippage }));
|
|
17532
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17533
|
-
} else if (action === "sell") {
|
|
17534
|
-
const usdAmount = amount === "all" ? "all" : amount;
|
|
17535
|
-
const result = await mutex.run(() => agent.investSell({ asset, usdAmount, maxSlippage }));
|
|
17536
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17537
|
-
} else if (action === "earn") {
|
|
17538
|
-
const result = await mutex.run(() => agent.investEarn({ asset }));
|
|
17539
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17540
|
-
} else {
|
|
17541
|
-
const result = await mutex.run(() => agent.investUnearn({ asset }));
|
|
17542
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17543
|
-
}
|
|
17544
|
-
} catch (err) {
|
|
17545
|
-
return errorResult(err);
|
|
17546
|
-
}
|
|
17547
|
-
}
|
|
17548
|
-
);
|
|
17549
|
-
server.tool(
|
|
17550
|
-
"t2000_invest_rebalance",
|
|
17551
|
-
"Move earning investment positions to better-rate protocols. Checks all earning assets and moves any where another protocol offers a higher APY.",
|
|
17552
|
-
{
|
|
17553
|
-
dryRun: external_exports.boolean().optional().describe("Preview moves without executing (default: false)"),
|
|
17554
|
-
minYieldDiff: external_exports.number().optional().describe("Minimum APY difference to trigger a move (default: 0.1)")
|
|
17555
|
-
},
|
|
17556
|
-
async ({ dryRun, minYieldDiff }) => {
|
|
17557
|
-
try {
|
|
17558
|
-
const result = await mutex.run(() => agent.investRebalance({ dryRun, minYieldDiff }));
|
|
17559
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17560
|
-
} catch (err) {
|
|
17561
|
-
return errorResult(err);
|
|
17562
|
-
}
|
|
17563
|
-
}
|
|
17564
|
-
);
|
|
17565
|
-
server.tool(
|
|
17566
|
-
"t2000_strategy",
|
|
17567
|
-
'Manage investment strategies \u2014 buy into predefined or custom allocations, sell entire strategies, check status, rebalance, or create/delete custom strategies. IMPORTANT: Before buying, ALWAYS call with action "list" first to show the user the strategy allocations (e.g. All-Weather = 30% BTC, 20% ETH, 20% SUI, 30% GOLD), then use dryRun: true to preview estimated amounts and prices. Only execute after the user confirms. If checking balance is insufficient, the SDK will auto-withdraw from savings \u2014 no manual withdraw needed.',
|
|
17568
|
-
{
|
|
17569
|
-
action: external_exports.enum(["list", "buy", "sell", "status", "rebalance", "create", "delete"]).describe("Strategy action to perform"),
|
|
17570
|
-
name: external_exports.string().optional().describe("Strategy name (required for all actions except 'list')"),
|
|
17571
|
-
amount: external_exports.number().optional().describe("USD amount (required for 'buy')"),
|
|
17572
|
-
allocations: external_exports.record(external_exports.number()).optional().describe("Allocation map e.g. {SUI: 40, BTC: 20, ETH: 20, GOLD: 20} (for 'create')"),
|
|
17573
|
-
description: external_exports.string().optional().describe("Strategy description (for 'create')"),
|
|
17574
|
-
dryRun: external_exports.boolean().optional().describe("Preview without signing (for 'buy')")
|
|
17575
|
-
},
|
|
17576
|
-
async ({ action, name, amount, allocations, description, dryRun }) => {
|
|
17577
|
-
try {
|
|
17578
|
-
if (action === "list") {
|
|
17579
|
-
const all = agent.strategies.getAll();
|
|
17580
|
-
return { content: [{ type: "text", text: JSON.stringify(all) }] };
|
|
17581
|
-
}
|
|
17582
|
-
if (!name) {
|
|
17583
|
-
return { content: [{ type: "text", text: JSON.stringify({ error: "Strategy name is required" }) }] };
|
|
17584
|
-
}
|
|
17585
|
-
switch (action) {
|
|
17586
|
-
case "buy": {
|
|
17587
|
-
if (typeof amount !== "number") {
|
|
17588
|
-
return { content: [{ type: "text", text: JSON.stringify({ error: "Amount is required for buy" }) }] };
|
|
17589
|
-
}
|
|
17590
|
-
const result = await mutex.run(() => agent.investStrategy({ strategy: name, usdAmount: amount, dryRun }));
|
|
17591
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17592
|
-
}
|
|
17593
|
-
case "sell": {
|
|
17594
|
-
const result = await mutex.run(() => agent.sellStrategy({ strategy: name }));
|
|
17595
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17596
|
-
}
|
|
17597
|
-
case "status": {
|
|
17598
|
-
const result = await agent.getStrategyStatus(name);
|
|
17599
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17600
|
-
}
|
|
17601
|
-
case "rebalance": {
|
|
17602
|
-
const result = await mutex.run(() => agent.rebalanceStrategy({ strategy: name }));
|
|
17603
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17604
|
-
}
|
|
17605
|
-
case "create": {
|
|
17606
|
-
if (!allocations) {
|
|
17607
|
-
return { content: [{ type: "text", text: JSON.stringify({ error: "Allocations required for create" }) }] };
|
|
17608
|
-
}
|
|
17609
|
-
const def = agent.strategies.create({ name, allocations, description });
|
|
17610
|
-
return { content: [{ type: "text", text: JSON.stringify(def) }] };
|
|
17611
|
-
}
|
|
17612
|
-
case "delete": {
|
|
17613
|
-
agent.strategies.delete(name);
|
|
17614
|
-
return { content: [{ type: "text", text: JSON.stringify({ deleted: name }) }] };
|
|
17615
|
-
}
|
|
17616
|
-
default:
|
|
17617
|
-
return { content: [{ type: "text", text: JSON.stringify({ error: `Unknown action: ${action}` }) }] };
|
|
17618
|
-
}
|
|
17619
|
-
} catch (err) {
|
|
17620
|
-
return errorResult(err);
|
|
17621
|
-
}
|
|
17622
|
-
}
|
|
17623
|
-
);
|
|
17624
|
-
server.tool(
|
|
17625
|
-
"t2000_auto_invest",
|
|
17626
|
-
"Dollar-cost averaging (DCA) \u2014 set up recurring purchases into strategies or individual assets. Actions: setup, status, run, stop.",
|
|
17627
|
-
{
|
|
17628
|
-
action: external_exports.enum(["setup", "status", "run", "stop"]).describe("Auto-invest action"),
|
|
17629
|
-
amount: external_exports.number().optional().describe("USD amount per purchase (for 'setup')"),
|
|
17630
|
-
frequency: external_exports.enum(["daily", "weekly", "monthly"]).optional().describe("Purchase frequency (for 'setup')"),
|
|
17631
|
-
strategy: external_exports.string().optional().describe("Strategy name (for 'setup')"),
|
|
17632
|
-
asset: external_exports.string().optional().describe("Single asset (for 'setup', alternative to strategy)"),
|
|
17633
|
-
scheduleId: external_exports.string().optional().describe("Schedule ID (for 'stop')")
|
|
17634
|
-
},
|
|
17635
|
-
async ({ action, amount, frequency, strategy, asset, scheduleId }) => {
|
|
17636
|
-
try {
|
|
17637
|
-
switch (action) {
|
|
17638
|
-
case "setup": {
|
|
17639
|
-
if (!amount || !frequency) {
|
|
17640
|
-
return { content: [{ type: "text", text: JSON.stringify({ error: "Amount and frequency required for setup" }) }] };
|
|
17641
|
-
}
|
|
17642
|
-
const schedule = agent.setupAutoInvest({ amount, frequency, strategy, asset });
|
|
17643
|
-
return { content: [{ type: "text", text: JSON.stringify(schedule) }] };
|
|
17644
|
-
}
|
|
17645
|
-
case "status": {
|
|
17646
|
-
const status = agent.getAutoInvestStatus();
|
|
17647
|
-
return { content: [{ type: "text", text: JSON.stringify(status) }] };
|
|
17648
|
-
}
|
|
17649
|
-
case "run": {
|
|
17650
|
-
const result = await mutex.run(() => agent.runAutoInvest());
|
|
17651
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17652
|
-
}
|
|
17653
|
-
case "stop": {
|
|
17654
|
-
if (!scheduleId) {
|
|
17655
|
-
return { content: [{ type: "text", text: JSON.stringify({ error: "Schedule ID required for stop" }) }] };
|
|
17656
|
-
}
|
|
17657
|
-
agent.stopAutoInvest(scheduleId);
|
|
17658
|
-
return { content: [{ type: "text", text: JSON.stringify({ stopped: scheduleId }) }] };
|
|
17659
|
-
}
|
|
17660
|
-
default:
|
|
17661
|
-
return { content: [{ type: "text", text: JSON.stringify({ error: `Unknown action: ${action}` }) }] };
|
|
17662
|
-
}
|
|
17663
|
-
} catch (err) {
|
|
17664
|
-
return errorResult(err);
|
|
17665
|
-
}
|
|
17666
|
-
}
|
|
17667
|
-
);
|
|
17668
|
-
server.tool(
|
|
17669
|
-
"t2000_rebalance",
|
|
17670
|
-
'Optimize savings yield \u2014 automatically finds the best rate across ALL assets and protocols, then handles everything: withdraw \u2192 swap \u2192 re-deposit. Works across different assets (e.g. USDC \u2192 USDe for higher APY). Always previews first \u2014 set dryRun: false to execute. Shows plan with APY gain, annual earnings increase, and break-even period. This is the ONE tool to use when the user asks "am I getting the best yield?" or "rebalance my savings".',
|
|
17671
|
-
{
|
|
17672
|
-
dryRun: external_exports.boolean().optional().describe("Preview without executing (default: true)"),
|
|
17673
|
-
minYieldDiff: external_exports.number().optional().describe("Min APY difference to rebalance (default: 0.5%)"),
|
|
17674
|
-
maxBreakEven: external_exports.number().optional().describe("Max break-even days (default: 30)")
|
|
17675
|
-
},
|
|
17676
|
-
async ({ dryRun, minYieldDiff, maxBreakEven }) => {
|
|
17677
|
-
try {
|
|
17678
|
-
const result = await mutex.run(
|
|
17679
|
-
() => agent.rebalance({
|
|
17680
|
-
dryRun: dryRun ?? true,
|
|
17681
|
-
minYieldDiff,
|
|
17682
|
-
maxBreakEven
|
|
17683
|
-
})
|
|
17684
|
-
);
|
|
17685
|
-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17686
|
-
} catch (err) {
|
|
17687
|
-
return errorResult(err);
|
|
17688
|
-
}
|
|
17689
|
-
}
|
|
17690
|
-
);
|
|
17691
17425
|
server.tool(
|
|
17692
17426
|
"t2000_claim_rewards",
|
|
17693
|
-
"Claim pending protocol rewards from lending positions
|
|
17427
|
+
"Claim pending protocol rewards from lending positions to your wallet.",
|
|
17694
17428
|
{},
|
|
17695
17429
|
async () => {
|
|
17696
17430
|
try {
|
|
@@ -17767,6 +17501,54 @@ ${text}`;
|
|
|
17767
17501
|
}
|
|
17768
17502
|
}
|
|
17769
17503
|
);
|
|
17504
|
+
server.tool(
|
|
17505
|
+
"t2000_swap",
|
|
17506
|
+
"Swap tokens on Sui via Cetus Aggregator (20+ DEXs). Supports any token pair with liquidity. Use user-friendly names (SUI, USDC, CETUS, DEEP, etc.) or full coin types.",
|
|
17507
|
+
{
|
|
17508
|
+
from: external_exports.string().describe('Source token (e.g. "SUI", "USDC", or full coin type)'),
|
|
17509
|
+
to: external_exports.string().describe('Target token (e.g. "USDC", "CETUS", or full coin type)'),
|
|
17510
|
+
amount: external_exports.number().positive().describe("Amount to swap"),
|
|
17511
|
+
slippage: external_exports.number().min(1e-3).max(0.05).optional().describe("Max slippage (default 0.01 = 1%, max 5%)")
|
|
17512
|
+
},
|
|
17513
|
+
async ({ from, to, amount, slippage }) => {
|
|
17514
|
+
try {
|
|
17515
|
+
const result = await mutex.run(() => agent.swap({ from, to, amount, slippage }));
|
|
17516
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17517
|
+
} catch (err) {
|
|
17518
|
+
return errorResult(err);
|
|
17519
|
+
}
|
|
17520
|
+
}
|
|
17521
|
+
);
|
|
17522
|
+
server.tool(
|
|
17523
|
+
"t2000_stake",
|
|
17524
|
+
"Stake SUI for vSUI via VOLO liquid staking. Earn ~3-5% APY. Rewards compound automatically via exchange rate. Minimum 1 SUI.",
|
|
17525
|
+
{
|
|
17526
|
+
amount: external_exports.number().min(1).describe("Amount of SUI to stake (minimum 1)")
|
|
17527
|
+
},
|
|
17528
|
+
async ({ amount }) => {
|
|
17529
|
+
try {
|
|
17530
|
+
const result = await mutex.run(() => agent.stakeVSui({ amount }));
|
|
17531
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17532
|
+
} catch (err) {
|
|
17533
|
+
return errorResult(err);
|
|
17534
|
+
}
|
|
17535
|
+
}
|
|
17536
|
+
);
|
|
17537
|
+
server.tool(
|
|
17538
|
+
"t2000_unstake",
|
|
17539
|
+
'Unstake vSUI back to SUI. Returns SUI including accumulated yield. Use amount in vSUI units or "all" to unstake entire position.',
|
|
17540
|
+
{
|
|
17541
|
+
amount: external_exports.union([external_exports.number().positive(), external_exports.literal("all")]).describe('Amount of vSUI to unstake, or "all"')
|
|
17542
|
+
},
|
|
17543
|
+
async ({ amount }) => {
|
|
17544
|
+
try {
|
|
17545
|
+
const result = await mutex.run(() => agent.unstakeVSui({ amount }));
|
|
17546
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
17547
|
+
} catch (err) {
|
|
17548
|
+
return errorResult(err);
|
|
17549
|
+
}
|
|
17550
|
+
}
|
|
17551
|
+
);
|
|
17770
17552
|
server.tool(
|
|
17771
17553
|
"t2000_contact_add",
|
|
17772
17554
|
'Save a contact name \u2192 Sui address mapping. After saving, use the name with t2000_send instead of pasting addresses. Example: save "Tom" as 0x1234... then send to "Tom".',
|
|
@@ -17882,7 +17664,7 @@ function registerPrompts(server) {
|
|
|
17882
17664
|
text: [
|
|
17883
17665
|
"You are a financial assistant for a t2000 AI agent bank account on Sui.",
|
|
17884
17666
|
"",
|
|
17885
|
-
"IMPORTANT: Call t2000_overview FIRST \u2014 it returns everything (balance, positions,
|
|
17667
|
+
"IMPORTANT: Call t2000_overview FIRST \u2014 it returns everything (balance, positions, health, earnings, fund status, pending rewards) in one call.",
|
|
17886
17668
|
"Then call t2000_rates for rate comparison across protocols.",
|
|
17887
17669
|
"",
|
|
17888
17670
|
"Present a comprehensive financial report:",
|
|
@@ -17891,12 +17673,11 @@ function registerPrompts(server) {
|
|
|
17891
17673
|
"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
|
|
17892
17674
|
"",
|
|
17893
17675
|
"\u{1F4B0} Accounts",
|
|
17894
|
-
" Checking / Savings / Credit
|
|
17676
|
+
" Checking / Savings / Credit with totals",
|
|
17895
17677
|
" Net worth",
|
|
17896
17678
|
"",
|
|
17897
17679
|
"\u{1F4C8} Positions",
|
|
17898
17680
|
" Each savings position: protocol, asset, amount, APY",
|
|
17899
|
-
" Each investment position: asset, amount, cost basis, current value, P&L",
|
|
17900
17681
|
"",
|
|
17901
17682
|
"\u{1F4B8} Yield",
|
|
17902
17683
|
" Current APY, daily/monthly/projected earnings",
|
|
@@ -17916,7 +17697,7 @@ function registerPrompts(server) {
|
|
|
17916
17697
|
);
|
|
17917
17698
|
server.prompt(
|
|
17918
17699
|
"optimize-yield",
|
|
17919
|
-
"Analyze savings
|
|
17700
|
+
"Analyze USDC savings \u2014 rate comparisons across protocols, idle funds, claimable rewards.",
|
|
17920
17701
|
async () => ({
|
|
17921
17702
|
messages: [{
|
|
17922
17703
|
role: "user",
|
|
@@ -17927,29 +17708,24 @@ function registerPrompts(server) {
|
|
|
17927
17708
|
"",
|
|
17928
17709
|
"IMPORTANT: Call these tools in parallel:",
|
|
17929
17710
|
" 1. t2000_overview \u2014 full account state including positions and pending rewards",
|
|
17930
|
-
" 2. t2000_rates \u2014
|
|
17931
|
-
" 3.
|
|
17711
|
+
" 2. t2000_rates \u2014 USDC save and borrow rates",
|
|
17712
|
+
" 3. t2000_all_rates \u2014 compare USDC lending APYs across protocols (informational)",
|
|
17932
17713
|
"",
|
|
17933
17714
|
"Present a structured yield analysis:",
|
|
17934
17715
|
"",
|
|
17935
17716
|
"\u{1F4CA} YIELD ANALYSIS",
|
|
17936
17717
|
"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
|
|
17937
17718
|
"",
|
|
17938
|
-
" Current
|
|
17939
|
-
" Best
|
|
17940
|
-
" APY
|
|
17941
|
-
" Break-even X days",
|
|
17719
|
+
" Current USDC on [protocol] \xB7 X.XX% APY",
|
|
17720
|
+
" Best USDC [protocol] \xB7 X.XX% APY",
|
|
17721
|
+
" APY gap +X.XX% (if any)",
|
|
17942
17722
|
"",
|
|
17943
|
-
|
|
17944
|
-
`If already
|
|
17723
|
+
"t2000_save always deposits USDC at the best available USDC rate. If the user is already deposited elsewhere at a lower APY, explain the gap; moving funds requires withdraw then save (preview with dryRun: true).",
|
|
17724
|
+
`If already at the best USDC rate: "You're at the best available USDC savings rate."`,
|
|
17945
17725
|
"",
|
|
17946
17726
|
"Also check:",
|
|
17947
|
-
" - Idle checking funds that could be earning yield",
|
|
17948
|
-
" -
|
|
17949
|
-
" - Claimable protocol rewards (suggest t2000_claim_rewards)",
|
|
17950
|
-
"",
|
|
17951
|
-
"On user confirmation, execute t2000_rebalance (dryRun: false).",
|
|
17952
|
-
"After execution, show: new APY, amount moved, transaction link."
|
|
17727
|
+
" - Idle checking funds that could be earning yield (t2000_save)",
|
|
17728
|
+
" - Claimable protocol rewards (suggest t2000_claim_rewards)"
|
|
17953
17729
|
].join("\n")
|
|
17954
17730
|
}
|
|
17955
17731
|
}]
|
|
@@ -18037,10 +17813,9 @@ ${context}
|
|
|
18037
17813
|
"",
|
|
18038
17814
|
"Analyze and recommend:",
|
|
18039
17815
|
" - How much idle checking can move to savings (keep ~$5 buffer for gas)",
|
|
18040
|
-
" - Which protocol
|
|
17816
|
+
" - Which protocol offers the best USDC savings APY (use t2000_all_rates)",
|
|
18041
17817
|
" - Expected monthly/annual yield on the recommended amount",
|
|
18042
|
-
" -
|
|
18043
|
-
" - Whether investment assets could earn yield via t2000_invest earn",
|
|
17818
|
+
" - Whether current USDC savings APY lags the best available (informational; new deposits use t2000_save at best USDC rate)",
|
|
18044
17819
|
"",
|
|
18045
17820
|
"If they want to proceed, use t2000_save to deposit."
|
|
18046
17821
|
].join("\n")
|
|
@@ -18048,44 +17823,9 @@ ${context}
|
|
|
18048
17823
|
}]
|
|
18049
17824
|
})
|
|
18050
17825
|
);
|
|
18051
|
-
server.prompt(
|
|
18052
|
-
"investment-strategy",
|
|
18053
|
-
"Analyze investment portfolio, suggest strategies, review DCA schedules, and recommend next steps.",
|
|
18054
|
-
async () => ({
|
|
18055
|
-
messages: [{
|
|
18056
|
-
role: "user",
|
|
18057
|
-
content: {
|
|
18058
|
-
type: "text",
|
|
18059
|
-
text: [
|
|
18060
|
-
"You are an investment advisor for a t2000 AI agent bank account on Sui.",
|
|
18061
|
-
"",
|
|
18062
|
-
'IMPORTANT: Call t2000_overview FIRST, then t2000_strategy (action: "list") and t2000_auto_invest (action: "status") in parallel.',
|
|
18063
|
-
"",
|
|
18064
|
-
"Analyze and recommend:",
|
|
18065
|
-
" - Portfolio allocation (checking vs savings vs investment)",
|
|
18066
|
-
" - Best strategy for their profile (bluechip, all-weather, layer1, sui-heavy, safe-haven)",
|
|
18067
|
-
" - If strategy positions are drifting from target weights, suggest rebalancing",
|
|
18068
|
-
" - If no DCA schedule exists, recommend setting one up",
|
|
18069
|
-
" - Whether invested assets should earn yield (t2000_invest earn)",
|
|
18070
|
-
" - Risk: concentration, unrealized losses, strategy drift",
|
|
18071
|
-
"",
|
|
18072
|
-
"STRATEGY PRESENTATION: Always show the strategy allocations before buying.",
|
|
18073
|
-
' e.g. "All-Weather: 30% BTC, 20% ETH, 20% SUI, 30% GOLD \u2014 diversified crypto + commodities"',
|
|
18074
|
-
" Then use dryRun: true to preview estimated prices and amounts.",
|
|
18075
|
-
"",
|
|
18076
|
-
"AUTO-FUNDING: If checking balance is insufficient but savings exist,",
|
|
18077
|
-
" the SDK auto-withdraws from savings to fund the investment.",
|
|
18078
|
-
' Do NOT manually withdraw first \u2014 just call t2000_strategy buy or t2000_invest with action: "buy" directly.',
|
|
18079
|
-
"",
|
|
18080
|
-
'For DCA: use t2000_auto_invest action: "setup" to create recurring buys.'
|
|
18081
|
-
].join("\n")
|
|
18082
|
-
}
|
|
18083
|
-
}]
|
|
18084
|
-
})
|
|
18085
|
-
);
|
|
18086
17826
|
server.prompt(
|
|
18087
17827
|
"morning-briefing",
|
|
18088
|
-
"Daily financial snapshot \u2014 balance changes, yield earned,
|
|
17828
|
+
"Daily financial snapshot \u2014 balance changes, yield earned, savings performance, health warnings.",
|
|
18089
17829
|
async () => ({
|
|
18090
17830
|
messages: [{
|
|
18091
17831
|
role: "user",
|
|
@@ -18094,9 +17834,8 @@ ${context}
|
|
|
18094
17834
|
text: [
|
|
18095
17835
|
"You are a personal financial briefing assistant for a t2000 AI agent bank account on Sui.",
|
|
18096
17836
|
"",
|
|
18097
|
-
"IMPORTANT: Call t2000_overview FIRST \u2014 it returns balance, positions,
|
|
18098
|
-
|
|
18099
|
-
"Optionally call t2000_rebalance (dryRun: true) to check yield optimization opportunities.",
|
|
17837
|
+
"IMPORTANT: Call t2000_overview FIRST \u2014 it returns balance, positions, health, earnings, fund status, and pending rewards in one call.",
|
|
17838
|
+
"Optionally call t2000_all_rates to compare USDC APYs across protocols.",
|
|
18100
17839
|
"",
|
|
18101
17840
|
"Present everything as a single structured briefing. NEVER ask follow-up questions before presenting the briefing.",
|
|
18102
17841
|
"",
|
|
@@ -18107,18 +17846,15 @@ ${context}
|
|
|
18107
17846
|
" Checking $XX.XX",
|
|
18108
17847
|
" Savings $XX.XX \xB7 X.XX% APY",
|
|
18109
17848
|
" Credit -$XX.XX (only if borrowed)",
|
|
18110
|
-
" Investment $XX.XX \xB7 +X.X% (only if positions exist)",
|
|
18111
17849
|
" Net Worth $XX.XX",
|
|
18112
17850
|
"",
|
|
18113
17851
|
"If there are savings positions, show daily yield earned.",
|
|
18114
|
-
"If there are investment positions, show each asset with P&L.",
|
|
18115
17852
|
"If pending rewards exist, mention them.",
|
|
18116
17853
|
"",
|
|
18117
17854
|
"\u{1F4CB} Action Items (max 4, only if applicable):",
|
|
18118
|
-
" - Idle funds in checking \u2192 suggest saving
|
|
17855
|
+
" - Idle funds in checking \u2192 suggest saving",
|
|
18119
17856
|
" - Outstanding debt \u2192 suggest repaying to stop interest",
|
|
18120
|
-
" -
|
|
18121
|
-
" - Better yield available \u2192 suggest rebalancing",
|
|
17857
|
+
" - Better USDC yield elsewhere \u2192 note APY gap; suggest reviewing savings placement",
|
|
18122
17858
|
" - Claimable rewards \u2192 suggest claiming",
|
|
18123
17859
|
" - Low health factor \u2192 warn about liquidation risk",
|
|
18124
17860
|
"",
|
|
@@ -18130,9 +17866,9 @@ ${context}
|
|
|
18130
17866
|
);
|
|
18131
17867
|
server.prompt(
|
|
18132
17868
|
"what-if",
|
|
18133
|
-
'Scenario planning \u2014 "What if I
|
|
17869
|
+
'Scenario planning \u2014 "What if I save $X?" or "What if I borrow $X?" Shows projected impact on yield and risk.',
|
|
18134
17870
|
{
|
|
18135
|
-
scenario: external_exports.string().optional().describe('Scenario to evaluate, e.g. "
|
|
17871
|
+
scenario: external_exports.string().optional().describe('Scenario to evaluate, e.g. "save $500" or "withdraw all savings" or "borrow $200"')
|
|
18136
17872
|
},
|
|
18137
17873
|
async ({ scenario }) => ({
|
|
18138
17874
|
messages: [{
|
|
@@ -18144,24 +17880,15 @@ ${context}
|
|
|
18144
17880
|
"",
|
|
18145
17881
|
scenario ? `The user wants to evaluate this scenario: "${scenario}"` : "The user wants to explore a hypothetical financial scenario. Ask them what they're considering.",
|
|
18146
17882
|
"",
|
|
18147
|
-
"IMPORTANT: Call t2000_overview FIRST to get the full current state (balance, positions,
|
|
17883
|
+
"IMPORTANT: Call t2000_overview FIRST to get the full current state (balance, positions, health).",
|
|
18148
17884
|
"Then preview the specific action with dryRun: true.",
|
|
18149
17885
|
"",
|
|
18150
|
-
'For INVESTMENT scenarios ("invest $X in Y" or "buy $X of strategy"):',
|
|
18151
|
-
` - Call t2000_strategy (action: "list") to get allocations if it's a strategy`,
|
|
18152
|
-
' - ALWAYS show strategy allocations (e.g. "30% BTC, 20% ETH, 20% SUI, 30% GOLD")',
|
|
18153
|
-
" - Call t2000_invest or t2000_strategy with dryRun: true to preview",
|
|
18154
|
-
" - If checking is insufficient but savings exist, note that the SDK auto-withdraws \u2014 no manual step needed",
|
|
18155
|
-
"",
|
|
18156
17886
|
'For SAVINGS scenarios ("save $X" or "withdraw $X"):',
|
|
18157
17887
|
" - Show impact on yield and health factor",
|
|
18158
17888
|
"",
|
|
18159
17889
|
'For BORROW scenarios ("borrow $X"):',
|
|
18160
17890
|
" - Show new health factor and interest cost",
|
|
18161
17891
|
"",
|
|
18162
|
-
'For SWAP scenarios ("swap $X A to B", "buy $X BTC", "sell 0.1 ETH"):',
|
|
18163
|
-
" - Call t2000_swap with dryRun: true",
|
|
18164
|
-
"",
|
|
18165
17892
|
"ALWAYS present results as a BEFORE \u2192 AFTER comparison table:",
|
|
18166
17893
|
"",
|
|
18167
17894
|
"\u{1F4CA} SCENARIO: [description]",
|
|
@@ -18170,12 +17897,9 @@ ${context}
|
|
|
18170
17897
|
" Before After",
|
|
18171
17898
|
" Checking $XX.XX $XX.XX",
|
|
18172
17899
|
" Savings $XX.XX $XX.XX",
|
|
18173
|
-
" Investment $XX.XX $XX.XX",
|
|
18174
17900
|
"",
|
|
18175
17901
|
"Then add a smart recommendation:",
|
|
18176
|
-
" - If amount exceeds checking, note that savings will be auto-withdrawn to fund it",
|
|
18177
17902
|
" - If it would drain total funds (checking + savings) below $5, warn about gas needs",
|
|
18178
|
-
" - If the asset can earn yield after buying, mention it",
|
|
18179
17903
|
"",
|
|
18180
17904
|
'End with: "Want me to go ahead?" \u2014 ready to execute on confirmation.'
|
|
18181
17905
|
].join("\n")
|
|
@@ -18185,7 +17909,7 @@ ${context}
|
|
|
18185
17909
|
);
|
|
18186
17910
|
server.prompt(
|
|
18187
17911
|
"sweep",
|
|
18188
|
-
"Find idle funds in checking and
|
|
17912
|
+
"Find idle funds in checking and move to savings for maximum yield.",
|
|
18189
17913
|
{
|
|
18190
17914
|
keepBuffer: external_exports.number().optional().describe("Dollar amount to keep in checking as spending buffer (default: $5)")
|
|
18191
17915
|
},
|
|
@@ -18211,10 +17935,9 @@ ${context}
|
|
|
18211
17935
|
`Available to sweep: $X (keeping $${buffer} buffer)`,
|
|
18212
17936
|
"",
|
|
18213
17937
|
"Actions (in order):",
|
|
18214
|
-
" 1. Save $X to best
|
|
18215
|
-
" 2.
|
|
18216
|
-
" 3.
|
|
18217
|
-
" 4. Claim pending rewards (if available)",
|
|
17938
|
+
" 1. Save $X to best USDC rate (t2000_save; show APY from t2000_rates / t2000_all_rates)",
|
|
17939
|
+
" 2. Claim pending rewards (if available)",
|
|
17940
|
+
" 3. Optionally compare USDC APYs across protocols (t2000_all_rates) \u2014 informational",
|
|
18218
17941
|
"",
|
|
18219
17942
|
"Projected monthly yield: $X.XX (before) \u2192 $X.XX (after)",
|
|
18220
17943
|
"",
|
|
@@ -18236,7 +17959,7 @@ ${context}
|
|
|
18236
17959
|
text: [
|
|
18237
17960
|
"You are a risk assessment specialist for a t2000 AI agent bank account on Sui.",
|
|
18238
17961
|
"",
|
|
18239
|
-
"IMPORTANT: Call t2000_overview FIRST \u2014 it has balance, positions,
|
|
17962
|
+
"IMPORTANT: Call t2000_overview FIRST \u2014 it has balance, positions, health, everything.",
|
|
18240
17963
|
"",
|
|
18241
17964
|
"Analyze and report:",
|
|
18242
17965
|
"",
|
|
@@ -18245,9 +17968,8 @@ ${context}
|
|
|
18245
17968
|
"",
|
|
18246
17969
|
"1. LIQUIDATION RISK \u2014 Health factor, distance to liquidation",
|
|
18247
17970
|
"2. CONCENTRATION RISK \u2014 % in each account type, % per asset",
|
|
18248
|
-
"3. PROTOCOL EXPOSURE \u2014
|
|
18249
|
-
"4.
|
|
18250
|
-
"5. YIELD EFFICIENCY \u2014 Idle assets, sub-optimal rates",
|
|
17971
|
+
"3. PROTOCOL EXPOSURE \u2014 Lending protocol distribution",
|
|
17972
|
+
"4. YIELD EFFICIENCY \u2014 Idle assets, sub-optimal rates",
|
|
18251
17973
|
"",
|
|
18252
17974
|
"OVERALL: Low / Medium / High / Critical",
|
|
18253
17975
|
"",
|
|
@@ -18259,7 +17981,7 @@ ${context}
|
|
|
18259
17981
|
);
|
|
18260
17982
|
server.prompt(
|
|
18261
17983
|
"weekly-recap",
|
|
18262
|
-
"Week in review \u2014 transactions, yield earned,
|
|
17984
|
+
"Week in review \u2014 transactions, yield earned, savings performance, highlights.",
|
|
18263
17985
|
async () => ({
|
|
18264
17986
|
messages: [{
|
|
18265
17987
|
role: "user",
|
|
@@ -18268,16 +17990,14 @@ ${context}
|
|
|
18268
17990
|
text: [
|
|
18269
17991
|
"You are a personal finance newsletter writer for a t2000 AI agent bank account on Sui.",
|
|
18270
17992
|
"",
|
|
18271
|
-
|
|
17993
|
+
"IMPORTANT: Call t2000_overview and t2000_history (limit: 50) in parallel.",
|
|
18272
17994
|
"",
|
|
18273
17995
|
"\u{1F4CA} WEEKLY RECAP",
|
|
18274
17996
|
"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
|
|
18275
17997
|
"",
|
|
18276
|
-
"\u{1F4B0} Net Worth: $X \u2014 Checking $X | Savings $X
|
|
18277
|
-
"\u{1F4C8} Activity: X sends, X saves, X
|
|
17998
|
+
"\u{1F4B0} Net Worth: $X \u2014 Checking $X | Savings $X",
|
|
17999
|
+
"\u{1F4C8} Activity: X sends, X saves, X withdrawals",
|
|
18278
18000
|
"\u{1F4B8} Yield: $X.XX this week, X% APY, $X/month projected",
|
|
18279
|
-
"\u{1F4CA} Portfolio: Per-asset P&L, best & worst performer",
|
|
18280
|
-
"\u{1F504} DCA: Runs this week, next run, total invested",
|
|
18281
18001
|
"\u{1F381} Rewards: Pending? Claim suggestion",
|
|
18282
18002
|
"\u{1F449} Next Week: 1-2 actionable suggestions",
|
|
18283
18003
|
"",
|
|
@@ -18287,48 +18007,6 @@ ${context}
|
|
|
18287
18007
|
}]
|
|
18288
18008
|
})
|
|
18289
18009
|
);
|
|
18290
|
-
server.prompt(
|
|
18291
|
-
"dca-advisor",
|
|
18292
|
-
'Personalized DCA setup \u2014 "I have $X/month" \u2192 recommends strategy, frequency, asset split, projected growth.',
|
|
18293
|
-
{
|
|
18294
|
-
budget: external_exports.number().optional().describe("Monthly budget in dollars to invest")
|
|
18295
|
-
},
|
|
18296
|
-
async ({ budget }) => ({
|
|
18297
|
-
messages: [{
|
|
18298
|
-
role: "user",
|
|
18299
|
-
content: {
|
|
18300
|
-
type: "text",
|
|
18301
|
-
text: [
|
|
18302
|
-
"You are a dollar-cost averaging advisor for a t2000 AI agent bank account on Sui.",
|
|
18303
|
-
"",
|
|
18304
|
-
budget ? `The user has $${budget}/month to invest via DCA.` : "The user wants to set up a DCA schedule. Ask their monthly budget first.",
|
|
18305
|
-
"",
|
|
18306
|
-
'IMPORTANT: Call t2000_overview, t2000_strategy (action: "list"), t2000_auto_invest (action: "status") in parallel.',
|
|
18307
|
-
"",
|
|
18308
|
-
"Recommend a DCA plan:",
|
|
18309
|
-
"",
|
|
18310
|
-
"\u{1F4C5} DCA PLAN",
|
|
18311
|
-
"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
|
|
18312
|
-
"",
|
|
18313
|
-
"STRATEGY: Pick one based on their existing portfolio:",
|
|
18314
|
-
" - bluechip (50% BTC, 30% ETH, 20% SUI)",
|
|
18315
|
-
" - all-weather (30% BTC, 20% ETH, 20% SUI, 30% GOLD)",
|
|
18316
|
-
" - safe-haven (50% BTC, 50% GOLD)",
|
|
18317
|
-
" - layer1 (50% ETH, 50% SUI)",
|
|
18318
|
-
" - sui-heavy (60% SUI, 20% BTC, 20% ETH)",
|
|
18319
|
-
" Explain WHY this fits them.",
|
|
18320
|
-
"",
|
|
18321
|
-
"FREQUENCY: Weekly for budgets > $50/month, monthly for smaller.",
|
|
18322
|
-
"",
|
|
18323
|
-
"AFFORDABILITY: Check remaining buffer after DCA commitment.",
|
|
18324
|
-
" Flag if DCA would eat into spending buffer.",
|
|
18325
|
-
"",
|
|
18326
|
-
'If they agree: t2000_auto_invest action: "setup", amount, frequency, strategy.'
|
|
18327
|
-
].join("\n")
|
|
18328
|
-
}
|
|
18329
|
-
}]
|
|
18330
|
-
})
|
|
18331
|
-
);
|
|
18332
18010
|
server.prompt(
|
|
18333
18011
|
"claim-rewards",
|
|
18334
18012
|
"Check for pending protocol rewards across all lending positions and claim them \u2014 auto-converts to USDC.",
|
|
@@ -18349,7 +18027,7 @@ ${context}
|
|
|
18349
18027
|
"",
|
|
18350
18028
|
"Step 2 \u2014 Present findings:",
|
|
18351
18029
|
" If rewards are available:",
|
|
18352
|
-
" Show which positions have rewards and from which protocols
|
|
18030
|
+
" Show which positions have rewards and from which protocols",
|
|
18353
18031
|
' Explain: "These are protocol incentive tokens that accrue on your lending positions"',
|
|
18354
18032
|
' Ask: "Want me to claim and convert them to USDC?"',
|
|
18355
18033
|
"",
|
|
@@ -18402,7 +18080,7 @@ ${context}
|
|
|
18402
18080
|
"",
|
|
18403
18081
|
" Emergency lock:",
|
|
18404
18082
|
" Status: Unlocked / Locked",
|
|
18405
|
-
" When locked: ALL operations are frozen \u2014 sends, saves,
|
|
18083
|
+
" When locked: ALL operations are frozen \u2014 sends, saves, borrows",
|
|
18406
18084
|
" Lock via: t2000_lock (any AI agent can lock)",
|
|
18407
18085
|
" Unlock via: CLI only with PIN \u2014 no AI can unlock, by design",
|
|
18408
18086
|
"",
|
|
@@ -18425,61 +18103,6 @@ ${context}
|
|
|
18425
18103
|
}]
|
|
18426
18104
|
})
|
|
18427
18105
|
);
|
|
18428
|
-
server.prompt(
|
|
18429
|
-
"quick-swap",
|
|
18430
|
-
"Guided token swap \u2014 preview rate, slippage, and price impact before executing.",
|
|
18431
|
-
{
|
|
18432
|
-
from: external_exports.string().optional().describe("Asset to sell (e.g. USDC, SUI)"),
|
|
18433
|
-
to: external_exports.string().optional().describe("Asset to buy (e.g. SUI, USDC)"),
|
|
18434
|
-
amount: external_exports.number().optional().describe("Amount in source asset units")
|
|
18435
|
-
},
|
|
18436
|
-
async ({ from, to, amount }) => {
|
|
18437
|
-
const context = [
|
|
18438
|
-
from ? `From: ${from}` : "",
|
|
18439
|
-
to ? `To: ${to}` : "",
|
|
18440
|
-
amount ? `Amount: ${amount}` : ""
|
|
18441
|
-
].filter(Boolean).join("\n");
|
|
18442
|
-
return {
|
|
18443
|
-
messages: [{
|
|
18444
|
-
role: "user",
|
|
18445
|
-
content: {
|
|
18446
|
-
type: "text",
|
|
18447
|
-
text: [
|
|
18448
|
-
"You are a swap assistant for a t2000 AI agent bank account.",
|
|
18449
|
-
"",
|
|
18450
|
-
context ? `Context:
|
|
18451
|
-
${context}
|
|
18452
|
-
` : "",
|
|
18453
|
-
"Help the user swap tokens. Follow this flow:",
|
|
18454
|
-
"",
|
|
18455
|
-
"Step 1 \u2014 Gather details:",
|
|
18456
|
-
" If from, to, or amount is missing, ask the user",
|
|
18457
|
-
" Check balance (t2000_balance) to confirm they have enough",
|
|
18458
|
-
" Available pairs: any combination of USDC, SUI, BTC, ETH, GOLD, USDT, USDe, USDsui",
|
|
18459
|
-
"",
|
|
18460
|
-
"Step 2 \u2014 Preview the swap:",
|
|
18461
|
-
" Run t2000_swap with dryRun: true",
|
|
18462
|
-
" Show:",
|
|
18463
|
-
" Input: X FROM \u2192 Expected output: Y TO",
|
|
18464
|
-
" Rate: 1 FROM = Z TO",
|
|
18465
|
-
" Price impact: X%",
|
|
18466
|
-
" Slippage: X%",
|
|
18467
|
-
" Fee: $X",
|
|
18468
|
-
"",
|
|
18469
|
-
"Step 3 \u2014 Ask for confirmation:",
|
|
18470
|
-
' "Ready to execute this swap?"',
|
|
18471
|
-
" If price impact > 1%, warn the user about the impact",
|
|
18472
|
-
"",
|
|
18473
|
-
"Step 4 \u2014 Execute:",
|
|
18474
|
-
" Run t2000_swap with dryRun: false",
|
|
18475
|
-
" Show: amount received, rate, transaction link",
|
|
18476
|
-
" Show updated balance"
|
|
18477
|
-
].join("\n")
|
|
18478
|
-
}
|
|
18479
|
-
}]
|
|
18480
|
-
};
|
|
18481
|
-
}
|
|
18482
|
-
);
|
|
18483
18106
|
server.prompt(
|
|
18484
18107
|
"onboarding",
|
|
18485
18108
|
"New user setup guide \u2014 deposit, first save, set safeguards, explore features.",
|
|
@@ -18503,27 +18126,24 @@ ${context}
|
|
|
18503
18126
|
' Explain: "Send USDC to your Sui address to get started"',
|
|
18504
18127
|
" Mention: they need a small amount of SUI for gas (~$1 worth)",
|
|
18505
18128
|
"",
|
|
18506
|
-
"IF they have funds but nothing saved
|
|
18129
|
+
"IF they have funds but nothing saved:",
|
|
18507
18130
|
` "Great, you have $X ready to go! Here's what you can do:"`,
|
|
18508
18131
|
" 1. SAVE \u2014 Earn yield on idle funds (show best current APY)",
|
|
18509
|
-
" 2.
|
|
18510
|
-
" 3.
|
|
18132
|
+
" 2. SEND \u2014 Transfer USDC to any Sui address or contact",
|
|
18133
|
+
" 3. PAY \u2014 Use USDC to pay for premium API services (MPP)",
|
|
18511
18134
|
" 4. SAFEGUARDS \u2014 Set spending limits (recommend for accounts > $100)",
|
|
18512
18135
|
"",
|
|
18513
|
-
"IF they already have savings
|
|
18136
|
+
"IF they already have savings:",
|
|
18514
18137
|
` "Looks like you're already set up! Here's your quick status:"`,
|
|
18515
18138
|
" Show a mini briefing, then offer to optimize",
|
|
18516
18139
|
"",
|
|
18517
18140
|
'End with: "What would you like to do first?"',
|
|
18518
18141
|
"",
|
|
18519
18142
|
"Available features to highlight:",
|
|
18520
|
-
" - Save/withdraw USDC
|
|
18521
|
-
" - Invest in BTC, ETH, SUI, GOLD with portfolio tracking",
|
|
18522
|
-
" - Strategy investing (bluechip, all-weather, etc.)",
|
|
18523
|
-
" - Auto-invest (DCA) \u2014 recurring weekly/monthly buys",
|
|
18524
|
-
" - Rebalance \u2014 auto-optimize yield across protocols",
|
|
18143
|
+
" - Save/withdraw USDC (earn yield; t2000_save uses the best USDC rate)",
|
|
18525
18144
|
" - Borrow against savings",
|
|
18526
18145
|
" - Send money to contacts",
|
|
18146
|
+
" - Pay for APIs with MPP (Machine Payments Protocol)",
|
|
18527
18147
|
" - Safeguards: per-tx limits, daily caps, emergency lock"
|
|
18528
18148
|
].join("\n")
|
|
18529
18149
|
}
|
|
@@ -18575,7 +18195,7 @@ ${context}
|
|
|
18575
18195
|
);
|
|
18576
18196
|
server.prompt(
|
|
18577
18197
|
"optimize-all",
|
|
18578
|
-
"One-shot full optimization \u2014 sweep idle
|
|
18198
|
+
"One-shot full optimization \u2014 sweep idle USDC to savings, compare USDC APYs, claim rewards.",
|
|
18579
18199
|
async () => ({
|
|
18580
18200
|
messages: [{
|
|
18581
18201
|
role: "user",
|
|
@@ -18589,34 +18209,27 @@ ${context}
|
|
|
18589
18209
|
"\u{1F527} FULL OPTIMIZATION",
|
|
18590
18210
|
"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
|
|
18591
18211
|
"",
|
|
18592
|
-
"Check
|
|
18212
|
+
"Check optimization levers and present a plan BEFORE executing:",
|
|
18593
18213
|
"",
|
|
18594
18214
|
"1. IDLE FUNDS \u2014 Any checking balance > $5?",
|
|
18595
|
-
" \u2192
|
|
18215
|
+
" \u2192 t2000_save to deploy at best USDC rate (preview with dryRun: true first)",
|
|
18596
18216
|
"",
|
|
18597
|
-
"2.
|
|
18598
|
-
" \u2192
|
|
18217
|
+
"2. USDC APY \u2014 Is current savings APY below the best available USDC rate?",
|
|
18218
|
+
" \u2192 Summarize from t2000_all_rates; if user wants to move, use withdraw + save with dryRun previews",
|
|
18599
18219
|
"",
|
|
18600
18220
|
"3. PENDING REWARDS \u2014 Any unclaimed?",
|
|
18601
|
-
" \u2192 Show rewards, offer
|
|
18602
|
-
"",
|
|
18603
|
-
"4. INVESTMENT YIELD \u2014 Any invested assets NOT earning?",
|
|
18604
|
-
" \u2192 t2000_invest earn to deposit into lending",
|
|
18605
|
-
"",
|
|
18606
|
-
"5. INVESTMENT REBALANCE \u2014 Earning assets on sub-optimal protocol?",
|
|
18607
|
-
" \u2192 t2000_invest_rebalance dryRun: true",
|
|
18221
|
+
" \u2192 Show rewards, offer t2000_claim_rewards",
|
|
18608
18222
|
"",
|
|
18609
18223
|
"Present all findings in a summary table:",
|
|
18610
18224
|
"",
|
|
18611
18225
|
" Action | Impact | Status",
|
|
18612
18226
|
" \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\u2500\u2500\u2500\u2500\u2500",
|
|
18613
18227
|
" Sweep $X idle | +$X.XX/month | Ready",
|
|
18614
|
-
"
|
|
18615
|
-
" Claim rewards | $X.XX
|
|
18616
|
-
" Earn on SUI | +X.XX% APY | Ready",
|
|
18228
|
+
" USDC APY gap | +X.XX% (info) | Note",
|
|
18229
|
+
" Claim rewards | $X.XX | Ready",
|
|
18617
18230
|
" Already optimal | \u2014 | Skipped",
|
|
18618
18231
|
"",
|
|
18619
|
-
'Ask: "Want me to execute all ready actions?" Then run sequentially.',
|
|
18232
|
+
'Ask: "Want me to execute all ready actions?" Then run saves/claims sequentially as confirmed.',
|
|
18620
18233
|
"If everything is already optimal, say so clearly."
|
|
18621
18234
|
].join("\n")
|
|
18622
18235
|
}
|
|
@@ -18701,4 +18314,4 @@ async function startMcpServer(opts) {
|
|
|
18701
18314
|
export {
|
|
18702
18315
|
startMcpServer
|
|
18703
18316
|
};
|
|
18704
|
-
//# sourceMappingURL=dist-
|
|
18317
|
+
//# sourceMappingURL=dist-22NK522A.js.map
|