@t2000/cli 0.15.3 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-D4HDZEJT.js +0 -0
- package/dist/{dist-TXXQC3NH.js → dist-VP2F4RTR.js} +118 -13
- package/dist/{dist-TXXQC3NH.js.map → dist-VP2F4RTR.js.map} +1 -1
- package/dist/index.js +391 -17
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/LICENSE +0 -21
package/dist/chunk-D4HDZEJT.js
CHANGED
|
File without changes
|
|
@@ -21432,6 +21432,109 @@ function registerWriteTools(server, agent) {
|
|
|
21432
21432
|
}
|
|
21433
21433
|
}
|
|
21434
21434
|
);
|
|
21435
|
+
server.tool(
|
|
21436
|
+
"t2000_strategy",
|
|
21437
|
+
"Manage investment strategies \u2014 buy into predefined or custom allocations, sell entire strategies, check status, rebalance, or create/delete custom strategies.",
|
|
21438
|
+
{
|
|
21439
|
+
action: external_exports.enum(["list", "buy", "sell", "status", "rebalance", "create", "delete"]).describe("Strategy action to perform"),
|
|
21440
|
+
name: external_exports.string().optional().describe("Strategy name (required for all actions except 'list')"),
|
|
21441
|
+
amount: external_exports.number().optional().describe("USD amount (required for 'buy')"),
|
|
21442
|
+
allocations: external_exports.record(external_exports.number()).optional().describe("Allocation map e.g. {SUI: 60, BTC: 20, ETH: 20} (for 'create')"),
|
|
21443
|
+
description: external_exports.string().optional().describe("Strategy description (for 'create')"),
|
|
21444
|
+
dryRun: external_exports.boolean().optional().describe("Preview without signing (for 'buy')")
|
|
21445
|
+
},
|
|
21446
|
+
async ({ action, name, amount, allocations, description, dryRun }) => {
|
|
21447
|
+
try {
|
|
21448
|
+
if (action === "list") {
|
|
21449
|
+
const all = agent.strategies.getAll();
|
|
21450
|
+
return { content: [{ type: "text", text: JSON.stringify(all) }] };
|
|
21451
|
+
}
|
|
21452
|
+
if (!name) {
|
|
21453
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "Strategy name is required" }) }] };
|
|
21454
|
+
}
|
|
21455
|
+
switch (action) {
|
|
21456
|
+
case "buy": {
|
|
21457
|
+
if (typeof amount !== "number") {
|
|
21458
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "Amount is required for buy" }) }] };
|
|
21459
|
+
}
|
|
21460
|
+
const result = await mutex.run(() => agent.investStrategy({ strategy: name, usdAmount: amount, dryRun }));
|
|
21461
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
21462
|
+
}
|
|
21463
|
+
case "sell": {
|
|
21464
|
+
const result = await mutex.run(() => agent.sellStrategy({ strategy: name }));
|
|
21465
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
21466
|
+
}
|
|
21467
|
+
case "status": {
|
|
21468
|
+
const result = await agent.getStrategyStatus(name);
|
|
21469
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
21470
|
+
}
|
|
21471
|
+
case "rebalance": {
|
|
21472
|
+
const result = await mutex.run(() => agent.rebalanceStrategy({ strategy: name }));
|
|
21473
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
21474
|
+
}
|
|
21475
|
+
case "create": {
|
|
21476
|
+
if (!allocations) {
|
|
21477
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "Allocations required for create" }) }] };
|
|
21478
|
+
}
|
|
21479
|
+
const def = agent.strategies.create({ name, allocations, description });
|
|
21480
|
+
return { content: [{ type: "text", text: JSON.stringify(def) }] };
|
|
21481
|
+
}
|
|
21482
|
+
case "delete": {
|
|
21483
|
+
agent.strategies.delete(name);
|
|
21484
|
+
return { content: [{ type: "text", text: JSON.stringify({ deleted: name }) }] };
|
|
21485
|
+
}
|
|
21486
|
+
default:
|
|
21487
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: `Unknown action: ${action}` }) }] };
|
|
21488
|
+
}
|
|
21489
|
+
} catch (err) {
|
|
21490
|
+
return errorResult(err);
|
|
21491
|
+
}
|
|
21492
|
+
}
|
|
21493
|
+
);
|
|
21494
|
+
server.tool(
|
|
21495
|
+
"t2000_auto_invest",
|
|
21496
|
+
"Dollar-cost averaging (DCA) \u2014 set up recurring purchases into strategies or individual assets. Actions: setup, status, run, stop.",
|
|
21497
|
+
{
|
|
21498
|
+
action: external_exports.enum(["setup", "status", "run", "stop"]).describe("Auto-invest action"),
|
|
21499
|
+
amount: external_exports.number().optional().describe("USD amount per purchase (for 'setup')"),
|
|
21500
|
+
frequency: external_exports.enum(["daily", "weekly", "monthly"]).optional().describe("Purchase frequency (for 'setup')"),
|
|
21501
|
+
strategy: external_exports.string().optional().describe("Strategy name (for 'setup')"),
|
|
21502
|
+
asset: external_exports.string().optional().describe("Single asset (for 'setup', alternative to strategy)"),
|
|
21503
|
+
scheduleId: external_exports.string().optional().describe("Schedule ID (for 'stop')")
|
|
21504
|
+
},
|
|
21505
|
+
async ({ action, amount, frequency, strategy, asset, scheduleId }) => {
|
|
21506
|
+
try {
|
|
21507
|
+
switch (action) {
|
|
21508
|
+
case "setup": {
|
|
21509
|
+
if (!amount || !frequency) {
|
|
21510
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "Amount and frequency required for setup" }) }] };
|
|
21511
|
+
}
|
|
21512
|
+
const schedule = agent.setupAutoInvest({ amount, frequency, strategy, asset });
|
|
21513
|
+
return { content: [{ type: "text", text: JSON.stringify(schedule) }] };
|
|
21514
|
+
}
|
|
21515
|
+
case "status": {
|
|
21516
|
+
const status = agent.getAutoInvestStatus();
|
|
21517
|
+
return { content: [{ type: "text", text: JSON.stringify(status) }] };
|
|
21518
|
+
}
|
|
21519
|
+
case "run": {
|
|
21520
|
+
const result = await mutex.run(() => agent.runAutoInvest());
|
|
21521
|
+
return { content: [{ type: "text", text: JSON.stringify(result) }] };
|
|
21522
|
+
}
|
|
21523
|
+
case "stop": {
|
|
21524
|
+
if (!scheduleId) {
|
|
21525
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "Schedule ID required for stop" }) }] };
|
|
21526
|
+
}
|
|
21527
|
+
agent.stopAutoInvest(scheduleId);
|
|
21528
|
+
return { content: [{ type: "text", text: JSON.stringify({ stopped: scheduleId }) }] };
|
|
21529
|
+
}
|
|
21530
|
+
default:
|
|
21531
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: `Unknown action: ${action}` }) }] };
|
|
21532
|
+
}
|
|
21533
|
+
} catch (err) {
|
|
21534
|
+
return errorResult(err);
|
|
21535
|
+
}
|
|
21536
|
+
}
|
|
21537
|
+
);
|
|
21435
21538
|
server.tool(
|
|
21436
21539
|
"t2000_rebalance",
|
|
21437
21540
|
"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.",
|
|
@@ -21674,7 +21777,7 @@ ${context}
|
|
|
21674
21777
|
);
|
|
21675
21778
|
server.prompt(
|
|
21676
21779
|
"investment-strategy",
|
|
21677
|
-
"Analyze investment portfolio, suggest
|
|
21780
|
+
"Analyze investment portfolio, suggest strategies, review DCA schedules, and recommend next steps.",
|
|
21678
21781
|
async () => ({
|
|
21679
21782
|
messages: [{
|
|
21680
21783
|
role: "user",
|
|
@@ -21685,20 +21788,22 @@ ${context}
|
|
|
21685
21788
|
"",
|
|
21686
21789
|
"Analyze the user's investment position:",
|
|
21687
21790
|
"1. Check current balance (t2000_balance) \u2014 available checking, savings, investment value",
|
|
21688
|
-
"2. Check investment portfolio (t2000_portfolio) \u2014 positions, cost basis, P&L",
|
|
21689
|
-
|
|
21791
|
+
"2. Check investment portfolio (t2000_portfolio) \u2014 positions, cost basis, P&L, strategy grouping",
|
|
21792
|
+
'3. List available strategies (t2000_strategy action: "list") \u2014 predefined and custom',
|
|
21793
|
+
'4. Check DCA schedules (t2000_auto_invest action: "status") \u2014 any active recurring buys',
|
|
21794
|
+
"5. Compare current rates (t2000_rates) \u2014 yield alternatives",
|
|
21690
21795
|
"",
|
|
21691
21796
|
"Recommend:",
|
|
21692
|
-
"- Portfolio allocation assessment (
|
|
21693
|
-
"- Whether
|
|
21694
|
-
"- If
|
|
21695
|
-
|
|
21696
|
-
|
|
21697
|
-
"- Risk assessment \u2014 concentration, unrealized losses,
|
|
21797
|
+
"- Portfolio allocation assessment (checking vs savings vs investment)",
|
|
21798
|
+
"- Whether a predefined strategy (bluechip, layer1, sui-heavy) suits them better than picking individual assets",
|
|
21799
|
+
"- If strategy positions are drifting from target weights, suggest rebalancing",
|
|
21800
|
+
"- If they have no DCA schedule, recommend setting one up for dollar-cost averaging",
|
|
21801
|
+
'- Whether invested assets should earn yield (t2000_invest action: "earn")',
|
|
21802
|
+
"- Risk assessment \u2014 concentration, unrealized losses, strategy drift",
|
|
21698
21803
|
"",
|
|
21699
|
-
"
|
|
21700
|
-
'
|
|
21701
|
-
|
|
21804
|
+
"For strategies: use t2000_strategy with dryRun: true to preview before buying.",
|
|
21805
|
+
'For DCA: use t2000_auto_invest action: "setup" to create recurring buys.',
|
|
21806
|
+
"For direct investments: use t2000_invest with dryRun: true to preview."
|
|
21702
21807
|
].join("\n")
|
|
21703
21808
|
}
|
|
21704
21809
|
}]
|
|
@@ -21724,4 +21829,4 @@ async function startMcpServer(opts) {
|
|
|
21724
21829
|
export {
|
|
21725
21830
|
startMcpServer
|
|
21726
21831
|
};
|
|
21727
|
-
//# sourceMappingURL=dist-
|
|
21832
|
+
//# sourceMappingURL=dist-VP2F4RTR.js.map
|