@t2000/cli 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@ t2000 init
30
30
  ✓ Gas sponsorship enabled
31
31
 
32
32
  Setting up accounts...
33
- ✓ Checking ✓ Savings ✓ Credit ✓ Exchange ✓ 402 Pay
33
+ ✓ Checking ✓ Savings ✓ Credit ✓ Investment ✓ Exchange ✓ 402 Pay
34
34
 
35
35
  🎉 Bank account created
36
36
  Address: 0x8b3e4f2a...
@@ -84,6 +84,20 @@ t2000 init
84
84
  Gas: 0.31 SUI (~$0.28)
85
85
  ──────────────────────────────────────
86
86
  Total: $85.28
87
+ ❯ t2000 invest buy 100 SUI
88
+ ✓ Bought 105.26 SUI at $0.95
89
+ Invested: $100.00
90
+ Portfolio: 105.26 SUI (avg $0.95)
91
+ Tx: https://suiscan.xyz/mainnet/tx/...
92
+
93
+ ❯ t2000 portfolio
94
+ Investment Portfolio
95
+ ─────────────────────────────────────────────────────
96
+ SUI 105.26 Avg: $0.95 Now: $0.97 +$2.10 (+2.1%)
97
+ ─────────────────────────────────────────────────────
98
+ Total invested: $100.00
99
+ Current value: $102.10
100
+ Unrealized P&L: +$2.10 (+2.1%)
87
101
  ```
88
102
 
89
103
  30 seconds. Send → save → borrow → pay → repay → withdraw.
@@ -192,7 +206,7 @@ t2000 mcp uninstall
192
206
  t2000 mcp
193
207
  ```
194
208
 
195
- 17 tools, 5 prompts, safeguard enforced. See [MCP setup guide](../../docs/mcp-setup.md) for details.
209
+ 19 tools, 6 prompts, safeguard enforced. See [MCP setup guide](../../docs/mcp-setup.md) for details.
196
210
 
197
211
  ### HTTP API Server
198
212
 
@@ -21117,6 +21117,19 @@ function registerReadTools(server, agent) {
21117
21117
  }
21118
21118
  }
21119
21119
  );
21120
+ server.tool(
21121
+ "t2000_portfolio",
21122
+ "Show investment portfolio \u2014 positions, cost basis, current value, unrealized/realized P&L.",
21123
+ {},
21124
+ async () => {
21125
+ try {
21126
+ const result = await agent.getPortfolio();
21127
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
21128
+ } catch (err) {
21129
+ return errorResult(err);
21130
+ }
21131
+ }
21132
+ );
21120
21133
  }
21121
21134
  var TxMutex = class {
21122
21135
  queue = Promise.resolve();
@@ -21351,6 +21364,50 @@ function registerWriteTools(server, agent) {
21351
21364
  }
21352
21365
  }
21353
21366
  );
21367
+ server.tool(
21368
+ "t2000_invest",
21369
+ "Buy or sell investment assets (spot). Amount is in USD. Asset is the crypto to buy/sell (e.g. SUI). Set dryRun: true to preview.",
21370
+ {
21371
+ action: external_exports.enum(["buy", "sell"]).describe("'buy' to invest USD into asset, 'sell' to convert asset back to USDC"),
21372
+ asset: external_exports.enum(["SUI"]).describe("Asset to invest in"),
21373
+ amount: external_exports.union([external_exports.number(), external_exports.literal("all")]).describe('USD amount, or "all" to sell entire position'),
21374
+ dryRun: external_exports.boolean().optional().describe("Preview without signing (default: false)")
21375
+ },
21376
+ async ({ action, asset, amount, dryRun }) => {
21377
+ try {
21378
+ if (dryRun) {
21379
+ agent.enforcer.assertNotLocked();
21380
+ const balance = await agent.balance();
21381
+ const portfolio = await agent.getPortfolio();
21382
+ const position = portfolio.positions.find((p) => p.asset === asset);
21383
+ return {
21384
+ content: [{
21385
+ type: "text",
21386
+ text: JSON.stringify({
21387
+ preview: true,
21388
+ action,
21389
+ asset,
21390
+ amount: amount === "all" ? position?.currentValue ?? 0 : amount,
21391
+ currentBalance: balance.available,
21392
+ currentPosition: position ?? null
21393
+ })
21394
+ }]
21395
+ };
21396
+ }
21397
+ if (action === "buy") {
21398
+ if (typeof amount !== "number") throw new Error("Buy amount must be a number");
21399
+ const result = await mutex.run(() => agent.investBuy({ asset, usdAmount: amount }));
21400
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
21401
+ } else {
21402
+ const usdAmount = amount === "all" ? "all" : amount;
21403
+ const result = await mutex.run(() => agent.investSell({ asset, usdAmount }));
21404
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
21405
+ }
21406
+ } catch (err) {
21407
+ return errorResult(err);
21408
+ }
21409
+ }
21410
+ );
21354
21411
  server.tool(
21355
21412
  "t2000_rebalance",
21356
21413
  "Optimize yield by moving funds to the highest-rate protocol. Always previews first \u2014 set dryRun: false to execute. Shows plan with expected APY gain and break-even period.",
@@ -21464,6 +21521,7 @@ function registerPrompts(server) {
21464
21521
  "3. Check the health factor (t2000_health)",
21465
21522
  "4. Show yield earnings (t2000_earnings)",
21466
21523
  "5. Review current interest rates (t2000_rates)",
21524
+ "6. Check investment portfolio (t2000_portfolio)",
21467
21525
  "",
21468
21526
  "Summarize the agent's financial health in a clear, concise format with actionable recommendations."
21469
21527
  ].join("\n")
@@ -21581,6 +21639,7 @@ ${context}
21581
21639
  "- Which protocol offers the best rate right now",
21582
21640
  "- Expected annual yield on the recommended amount",
21583
21641
  "- If they should rebalance existing savings (t2000_rebalance with dryRun: true)",
21642
+ "- Whether investing in SUI or other assets could complement their savings strategy",
21584
21643
  "",
21585
21644
  "If they want to proceed, use t2000_save to deposit. Always preview first."
21586
21645
  ].join("\n")
@@ -21588,6 +21647,34 @@ ${context}
21588
21647
  }]
21589
21648
  })
21590
21649
  );
21650
+ server.prompt(
21651
+ "investment-strategy",
21652
+ "Analyze investment portfolio, suggest allocation, review risk, and recommend next steps.",
21653
+ async () => ({
21654
+ messages: [{
21655
+ role: "user",
21656
+ content: {
21657
+ type: "text",
21658
+ text: [
21659
+ "You are an investment advisor for a t2000 AI agent bank account.",
21660
+ "",
21661
+ "Analyze the user's investment position:",
21662
+ "1. Check current balance (t2000_balance) \u2014 available checking, savings, investment value",
21663
+ "2. Check investment portfolio (t2000_portfolio) \u2014 positions, cost basis, P&L",
21664
+ "3. Compare current rates (t2000_rates) \u2014 yield alternatives",
21665
+ "",
21666
+ "Recommend:",
21667
+ "- Portfolio allocation assessment (what % is in checking vs savings vs investment)",
21668
+ "- Whether current positions are performing well or need adjustment",
21669
+ "- If idle checking funds should be invested or saved for yield",
21670
+ "- Risk assessment \u2014 concentration, unrealized losses, cost basis vs current price",
21671
+ "",
21672
+ "If they want to invest, use t2000_invest with dryRun: true to preview first."
21673
+ ].join("\n")
21674
+ }
21675
+ }]
21676
+ })
21677
+ );
21591
21678
  }
21592
21679
  async function startMcpServer(opts) {
21593
21680
  const agent = await createAgent(opts?.keyPath);
@@ -21608,4 +21695,4 @@ async function startMcpServer(opts) {
21608
21695
  export {
21609
21696
  startMcpServer
21610
21697
  };
21611
- //# sourceMappingURL=dist-QGTOSQO3.js.map
21698
+ //# sourceMappingURL=dist-4B5R5GWR.js.map