@general-liquidity/gordon-cli 0.75.10 → 0.75.11
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/gordon.js +165 -144
- package/package.json +1 -1
package/dist/gordon.js
CHANGED
|
@@ -1211325,6 +1211325,9 @@ class PluginInstaller {
|
|
|
1211325
1211325
|
const pluginDir = path7.join(this.pluginsDir, listing.id);
|
|
1211326
1211326
|
await fs9.mkdir(pluginDir, { recursive: true });
|
|
1211327
1211327
|
await fs9.writeFile(path7.join(pluginDir, "manifest.json"), JSON.stringify(listing.manifest, null, 2));
|
|
1211328
|
+
if (listing.routingManifest) {
|
|
1211329
|
+
await fs9.writeFile(path7.join(pluginDir, "routing.json"), JSON.stringify(listing.routingManifest, null, 2));
|
|
1211330
|
+
}
|
|
1211328
1211331
|
this.installedPlugins.set(listing.id, installed);
|
|
1211329
1211332
|
await this.saveInstalled();
|
|
1211330
1211333
|
this.emitProgress({
|
|
@@ -1211574,11 +1211577,17 @@ var init_installer = __esm(() => {
|
|
|
1211574
1211577
|
pluginInstaller = new PluginInstaller;
|
|
1211575
1211578
|
});
|
|
1211576
1211579
|
|
|
1211577
|
-
// src/infra/
|
|
1211580
|
+
// src/infra/routing/manager.ts
|
|
1211578
1211581
|
import * as fs10 from "fs/promises";
|
|
1211579
1211582
|
import * as path8 from "path";
|
|
1211580
|
-
async function
|
|
1211581
|
-
const
|
|
1211583
|
+
async function loadRoutingManifest(pluginId) {
|
|
1211584
|
+
const pluginDir = pluginInstaller.getPluginsDir();
|
|
1211585
|
+
const routingPath = path8.join(pluginDir, pluginId, "routing.json");
|
|
1211586
|
+
try {
|
|
1211587
|
+
const content = await fs10.readFile(routingPath, "utf-8");
|
|
1211588
|
+
return JSON.parse(content);
|
|
1211589
|
+
} catch {}
|
|
1211590
|
+
const skillPath = path8.join(pluginDir, pluginId, "skill.json");
|
|
1211582
1211591
|
try {
|
|
1211583
1211592
|
const content = await fs10.readFile(skillPath, "utf-8");
|
|
1211584
1211593
|
return JSON.parse(content);
|
|
@@ -1211586,7 +1211595,7 @@ async function loadSkillManifest(pluginId) {
|
|
|
1211586
1211595
|
return null;
|
|
1211587
1211596
|
}
|
|
1211588
1211597
|
}
|
|
1211589
|
-
function
|
|
1211598
|
+
function buildDefaultRoutingManifest(pluginId) {
|
|
1211590
1211599
|
return {
|
|
1211591
1211600
|
pluginId,
|
|
1211592
1211601
|
defaultAgent: "Gordon",
|
|
@@ -1211598,13 +1211607,13 @@ function rebuildRoutingTables() {
|
|
|
1211598
1211607
|
const mcpToolsByServer = getMCPToolsByServer();
|
|
1211599
1211608
|
_dynamicToolAgentMap = {};
|
|
1211600
1211609
|
_toolsByAgent = {};
|
|
1211601
|
-
for (const
|
|
1211602
|
-
if (!
|
|
1211610
|
+
for (const routing of _resolvedRoutings) {
|
|
1211611
|
+
if (!routing.enabled)
|
|
1211603
1211612
|
continue;
|
|
1211604
|
-
const serverToolNames = mcpToolsByServer[
|
|
1211613
|
+
const serverToolNames = mcpToolsByServer[routing.pluginId] ?? [];
|
|
1211605
1211614
|
const perToolMap = new Map;
|
|
1211606
|
-
if (
|
|
1211607
|
-
for (const mapping of
|
|
1211615
|
+
if (routing.routingManifest.toolAgentMap) {
|
|
1211616
|
+
for (const mapping of routing.routingManifest.toolAgentMap) {
|
|
1211608
1211617
|
perToolMap.set(mapping.toolName, mapping.agent);
|
|
1211609
1211618
|
}
|
|
1211610
1211619
|
}
|
|
@@ -1211612,7 +1211621,7 @@ function rebuildRoutingTables() {
|
|
|
1211612
1211621
|
for (const namespacedToolName of serverToolNames) {
|
|
1211613
1211622
|
const underscoreIdx = namespacedToolName.indexOf("_");
|
|
1211614
1211623
|
const bareToolName = underscoreIdx > 0 ? namespacedToolName.substring(underscoreIdx + 1) : namespacedToolName;
|
|
1211615
|
-
const agent = perToolMap.get(bareToolName) ??
|
|
1211624
|
+
const agent = perToolMap.get(bareToolName) ?? routing.routingManifest.defaultAgent;
|
|
1211616
1211625
|
if (agent !== "Gordon") {
|
|
1211617
1211626
|
_dynamicToolAgentMap[namespacedToolName] = agent;
|
|
1211618
1211627
|
}
|
|
@@ -1211622,70 +1211631,70 @@ function rebuildRoutingTables() {
|
|
|
1211622
1211631
|
if (!_toolsByAgent[agent])
|
|
1211623
1211632
|
_toolsByAgent[agent] = {};
|
|
1211624
1211633
|
_toolsByAgent[agent][namespacedToolName] = tool6;
|
|
1211625
|
-
if (
|
|
1211634
|
+
if (routing.routingManifest.alsoOnGordon && agent !== "Gordon") {
|
|
1211626
1211635
|
if (!_toolsByAgent["Gordon"])
|
|
1211627
1211636
|
_toolsByAgent["Gordon"] = {};
|
|
1211628
1211637
|
_toolsByAgent["Gordon"][namespacedToolName] = tool6;
|
|
1211629
1211638
|
}
|
|
1211630
1211639
|
}
|
|
1211631
1211640
|
}
|
|
1211632
|
-
|
|
1211641
|
+
routing.toolCount = toolCount;
|
|
1211633
1211642
|
}
|
|
1211634
1211643
|
}
|
|
1211635
|
-
async function
|
|
1211644
|
+
async function initRouting() {
|
|
1211636
1211645
|
if (_initialized2)
|
|
1211637
1211646
|
return;
|
|
1211638
1211647
|
await pluginInstaller.initialize();
|
|
1211639
1211648
|
const installed = pluginInstaller.getInstalled().filter((p) => p.enabled);
|
|
1211640
|
-
|
|
1211649
|
+
_resolvedRoutings = [];
|
|
1211641
1211650
|
for (const plugin of installed) {
|
|
1211642
|
-
const
|
|
1211643
|
-
|
|
1211651
|
+
const routingManifest = await loadRoutingManifest(plugin.id) ?? buildDefaultRoutingManifest(plugin.id);
|
|
1211652
|
+
_resolvedRoutings.push({
|
|
1211644
1211653
|
pluginId: plugin.id,
|
|
1211645
|
-
|
|
1211654
|
+
routingManifest,
|
|
1211646
1211655
|
enabled: plugin.enabled,
|
|
1211647
1211656
|
toolCount: 0
|
|
1211648
1211657
|
});
|
|
1211649
1211658
|
}
|
|
1211650
1211659
|
rebuildRoutingTables();
|
|
1211651
1211660
|
_initialized2 = true;
|
|
1211652
|
-
const
|
|
1211661
|
+
const routingCount = _resolvedRoutings.length;
|
|
1211653
1211662
|
const routedCount = Object.keys(_dynamicToolAgentMap).length;
|
|
1211654
|
-
if (
|
|
1211655
|
-
console.log(`[
|
|
1211663
|
+
if (routingCount > 0) {
|
|
1211664
|
+
console.log(`[Routing] Loaded ${routingCount} config(s), ${routedCount} tool(s) routed to sub-agents`);
|
|
1211656
1211665
|
}
|
|
1211657
1211666
|
}
|
|
1211658
1211667
|
function getDynamicToolAgentMap() {
|
|
1211659
1211668
|
return _dynamicToolAgentMap;
|
|
1211660
1211669
|
}
|
|
1211661
|
-
function
|
|
1211670
|
+
function getRoutingToolsForAgent(agentName) {
|
|
1211662
1211671
|
return { ..._toolsByAgent[agentName] ?? {} };
|
|
1211663
1211672
|
}
|
|
1211664
|
-
async function
|
|
1211673
|
+
async function reloadRouting() {
|
|
1211665
1211674
|
await reloadMCPTools();
|
|
1211666
1211675
|
_initialized2 = false;
|
|
1211667
|
-
await
|
|
1211676
|
+
await initRouting();
|
|
1211668
1211677
|
resetAgents();
|
|
1211669
|
-
console.log("[
|
|
1211678
|
+
console.log("[Routing] Reloaded \u2014 agents will reconstruct on next access");
|
|
1211670
1211679
|
}
|
|
1211671
|
-
function
|
|
1211672
|
-
return [...
|
|
1211680
|
+
function getResolvedRoutings() {
|
|
1211681
|
+
return [..._resolvedRoutings];
|
|
1211673
1211682
|
}
|
|
1211674
|
-
function
|
|
1211683
|
+
function isRoutingInitialized() {
|
|
1211675
1211684
|
return _initialized2;
|
|
1211676
1211685
|
}
|
|
1211677
|
-
async function
|
|
1211678
|
-
const
|
|
1211679
|
-
await fs10.writeFile(
|
|
1211686
|
+
async function writeRoutingManifest(manifest) {
|
|
1211687
|
+
const routingPath = path8.join(pluginInstaller.getPluginsDir(), manifest.pluginId, "routing.json");
|
|
1211688
|
+
await fs10.writeFile(routingPath, JSON.stringify(manifest, null, 2));
|
|
1211680
1211689
|
}
|
|
1211681
|
-
var
|
|
1211690
|
+
var _resolvedRoutings, _dynamicToolAgentMap, _toolsByAgent, _initialized2 = false;
|
|
1211682
1211691
|
var init_manager4 = __esm(async () => {
|
|
1211683
1211692
|
init_installer();
|
|
1211684
1211693
|
await __promiseAll([
|
|
1211685
1211694
|
init_client14(),
|
|
1211686
1211695
|
init_agents()
|
|
1211687
1211696
|
]);
|
|
1211688
|
-
|
|
1211697
|
+
_resolvedRoutings = [];
|
|
1211689
1211698
|
_dynamicToolAgentMap = {};
|
|
1211690
1211699
|
_toolsByAgent = {};
|
|
1211691
1211700
|
});
|
|
@@ -1211909,8 +1211918,8 @@ function enableMCPHotReload(intervalMs = 5000) {
|
|
|
1211909
1211918
|
const fingerprint = installed.map((p) => `${p.id}:${p.enabled ? "1" : "0"}:${p.version ?? "0"}`).sort().join("|");
|
|
1211910
1211919
|
if (_lastPluginFingerprint !== null && fingerprint !== _lastPluginFingerprint) {
|
|
1211911
1211920
|
console.log("[MCP] Plugin change detected, hot-reloading...");
|
|
1211912
|
-
if (
|
|
1211913
|
-
await
|
|
1211921
|
+
if (isRoutingInitialized()) {
|
|
1211922
|
+
await reloadRouting();
|
|
1211914
1211923
|
} else {
|
|
1211915
1211924
|
await reloadMCPTools();
|
|
1211916
1211925
|
}
|
|
@@ -1212054,7 +1212063,7 @@ function getScannerAgent() {
|
|
|
1212054
1212063
|
...instrumentedMemoryTools,
|
|
1212055
1212064
|
...instrumentedPlaybookTools,
|
|
1212056
1212065
|
...instrumentedRegimeTools,
|
|
1212057
|
-
...
|
|
1212066
|
+
...getRoutingToolsForAgent("Scanner")
|
|
1212058
1212067
|
},
|
|
1212059
1212068
|
memory: createSubAgentMemory(),
|
|
1212060
1212069
|
inputProcessors: [gordonInputGuard, new TokenLimiterProcessor({ limit: 32000 })],
|
|
@@ -1212117,7 +1212126,7 @@ function getAnalystAgent() {
|
|
|
1212117
1212126
|
detect_market_regime: instrumentedRegimeTools.detect_market_regime,
|
|
1212118
1212127
|
get_regime_history: instrumentedRegimeTools.get_regime_history,
|
|
1212119
1212128
|
...instrumentedProtocolTools,
|
|
1212120
|
-
...
|
|
1212129
|
+
...getRoutingToolsForAgent("Analyst")
|
|
1212121
1212130
|
},
|
|
1212122
1212131
|
memory: createSubAgentMemory(),
|
|
1212123
1212132
|
inputProcessors: [gordonInputGuard, new TokenLimiterProcessor({ limit: 32000 })],
|
|
@@ -1212166,7 +1212175,7 @@ function getPlannerAgent() {
|
|
|
1212166
1212175
|
rebalance_portfolio: instrumentedRuntimeTools.rebalance_portfolio,
|
|
1212167
1212176
|
simulate_order_bundle: instrumentedAdvancedTools.simulate_order_bundle,
|
|
1212168
1212177
|
generate_circuit_breaker_proof: instrumentedAdvancedTools.generate_circuit_breaker_proof,
|
|
1212169
|
-
...
|
|
1212178
|
+
...getRoutingToolsForAgent("Planner")
|
|
1212170
1212179
|
},
|
|
1212171
1212180
|
memory: createSubAgentMemory(),
|
|
1212172
1212181
|
inputProcessors: [gordonInputGuard, new TokenLimiterProcessor({ limit: 32000 })],
|
|
@@ -1212220,7 +1212229,7 @@ function getExecutorAgent() {
|
|
|
1212220
1212229
|
approve_strategy_trade: instrumentedRuntimeTools.approve_strategy_trade,
|
|
1212221
1212230
|
simulate_order_bundle: instrumentedAdvancedTools.simulate_order_bundle,
|
|
1212222
1212231
|
verify_circuit_breaker_proof: instrumentedAdvancedTools.verify_circuit_breaker_proof,
|
|
1212223
|
-
...
|
|
1212232
|
+
...getRoutingToolsForAgent("Executor")
|
|
1212224
1212233
|
},
|
|
1212225
1212234
|
memory: createSubAgentMemory(),
|
|
1212226
1212235
|
inputProcessors: [gordonInputGuard, new TokenLimiterProcessor({ limit: 32000 })],
|
|
@@ -1212271,7 +1212280,7 @@ function getMonitorAgent() {
|
|
|
1212271
1212280
|
check_portfolio_health: instrumentedRuntimeTools.check_portfolio_health,
|
|
1212272
1212281
|
generate_circuit_breaker_proof: instrumentedAdvancedTools.generate_circuit_breaker_proof,
|
|
1212273
1212282
|
query_regime_scoped_memory: instrumentedAdvancedTools.query_regime_scoped_memory,
|
|
1212274
|
-
...
|
|
1212283
|
+
...getRoutingToolsForAgent("Monitor")
|
|
1212275
1212284
|
},
|
|
1212276
1212285
|
memory: createSubAgentMemory(),
|
|
1212277
1212286
|
inputProcessors: [gordonInputGuard, new TokenLimiterProcessor({ limit: 32000 })],
|
|
@@ -1212300,7 +1212309,7 @@ function getTeacherAgent() {
|
|
|
1212300
1212309
|
...instrumentedPlaybookTools,
|
|
1212301
1212310
|
query_audit_trail: instrumentedAuditTools.query_audit_trail,
|
|
1212302
1212311
|
get_decision_path: instrumentedAuditTools.get_decision_path,
|
|
1212303
|
-
...
|
|
1212312
|
+
...getRoutingToolsForAgent("Teacher")
|
|
1212304
1212313
|
},
|
|
1212305
1212314
|
memory: createSubAgentMemory(),
|
|
1212306
1212315
|
inputProcessors: [gordonInputGuard, new TokenLimiterProcessor({ limit: 32000 })],
|
|
@@ -1212333,7 +1212342,7 @@ function getBacktesterAgent() {
|
|
|
1212333
1212342
|
get_lessons: instrumentedMemoryTools.get_lessons,
|
|
1212334
1212343
|
...instrumentedPlaybookTools,
|
|
1212335
1212344
|
...instrumentedPlaybookBacktestTools,
|
|
1212336
|
-
...
|
|
1212345
|
+
...getRoutingToolsForAgent("Backtester")
|
|
1212337
1212346
|
},
|
|
1212338
1212347
|
memory: createSubAgentMemory(),
|
|
1212339
1212348
|
inputProcessors: [gordonInputGuard, new TokenLimiterProcessor({ limit: 32000 })],
|
|
@@ -1212367,7 +1212376,7 @@ function getGordonAgent() {
|
|
|
1212367
1212376
|
...instrumentedSchedulerTools,
|
|
1212368
1212377
|
...instrumentedAutonomousTools,
|
|
1212369
1212378
|
...getMCPTools(),
|
|
1212370
|
-
...
|
|
1212379
|
+
...getRoutingToolsForAgent("Gordon")
|
|
1212371
1212380
|
},
|
|
1212372
1212381
|
memory: createMemory(),
|
|
1212373
1212382
|
inputProcessors: [gordonInputGuard, new TokenLimiterProcessor({ limit: 64000 })],
|
|
@@ -1212955,11 +1212964,14 @@ When the user asks for analysis, scanning, planning, backtesting, or execution \
|
|
|
1212955
1212964
|
- Raw market data (candles, prices, tickers, orderbook) -> Scanner or Analyst
|
|
1212956
1212965
|
- Charts and visualization -> Analyst
|
|
1212957
1212966
|
- Whale detection and orderbook analysis -> Analyst
|
|
1212967
|
+
- Solana: token prices, asset metadata -> Analyst (when solana-agent-kit plugin is installed)
|
|
1212958
1212968
|
- Cross-pair correlation, spread analysis, relative strength -> Scanner or Analyst
|
|
1212959
1212969
|
- Trade plans with risk sizing -> Planner
|
|
1212960
1212970
|
- Strategy generation and backtesting -> Planner and Backtester
|
|
1212961
1212971
|
- Order execution, simple swaps/conversions, market orders, limit orders, cancel orders, open orders -> Executor (requires ARMED mode)
|
|
1212972
|
+
- Solana: Jupiter swaps, SOL/SPL transfers, token deploy, NFT minting -> Executor (when solana-agent-kit plugin is installed)
|
|
1212962
1212973
|
- Portfolio, positions, earn, wallet, fund transfers, withdrawals -> Monitor
|
|
1212974
|
+
- Solana: wallet balances, network TPS -> Monitor (when solana-agent-kit plugin is installed)
|
|
1212963
1212975
|
- Educational explanations -> Teacher
|
|
1212964
1212976
|
- Position lifecycle tracking (setup \u2192 analysis \u2192 plan \u2192 execute \u2192 monitor \u2192 review) -> tracked automatically across agents
|
|
1212965
1212977
|
- Risk pre-checks on all orders -> Planner and Executor (automatic)
|
|
@@ -1215517,6 +1215529,8 @@ function getIntegrationCommands(category) {
|
|
|
1215517
1215529
|
"data-provider": ["/scan", "/analyze", "/compare", "/history"],
|
|
1215518
1215530
|
analytics: ["/scan", "/analyze", "/signals"],
|
|
1215519
1215531
|
execution: ["/trade", "/order", "/position"],
|
|
1215532
|
+
exchange: ["/trade", "/order", "/balance"],
|
|
1215533
|
+
infrastructure: ["/scan", "/analyze"],
|
|
1215520
1215534
|
portfolio: ["/portfolio", "/pnl", "/balance"],
|
|
1215521
1215535
|
research: ["/analyze", "/research", "/sentiment"],
|
|
1215522
1215536
|
utility: ["/alert", "/notify"]
|
|
@@ -1215908,6 +1215922,13 @@ var init_mcp = __esm(() => {
|
|
|
1215908
1215922
|
{ id: "dexscreener", summary: "DEX trading data" }
|
|
1215909
1215923
|
]
|
|
1215910
1215924
|
},
|
|
1215925
|
+
{
|
|
1215926
|
+
title: "For Solana",
|
|
1215927
|
+
description: "Trade, swap, and manage assets on Solana",
|
|
1215928
|
+
plugins: [
|
|
1215929
|
+
{ id: "solana-agent-kit", summary: "Jupiter swaps, transfers, NFTs, token deploy" }
|
|
1215930
|
+
]
|
|
1215931
|
+
},
|
|
1215911
1215932
|
{
|
|
1215912
1215933
|
title: "For Sentiment",
|
|
1215913
1215934
|
description: "Social metrics and market sentiment",
|
|
@@ -1215931,7 +1215952,8 @@ var init_mcp = __esm(() => {
|
|
|
1215931
1215952
|
{ keywords: ["alert", "notification", "telegram", "notify"], pluginId: "telegram-alerts", reason: "sends alerts to Telegram" },
|
|
1215932
1215953
|
{ keywords: ["tradingview", "signal", "webhook"], pluginId: "tradingview-signals", reason: "integrates TradingView alerts" },
|
|
1215933
1215954
|
{ keywords: ["historical", "history", "ohlc", "altcoin", "market cap"], pluginId: "coingecko", reason: "provides historical price data for thousands of coins" },
|
|
1215934
|
-
{ keywords: ["portfolio", "pnl", "profit", "loss", "tax"], pluginId: "portfolio-tracker", reason: "tracks portfolio and generates tax reports" }
|
|
1215955
|
+
{ keywords: ["portfolio", "pnl", "profit", "loss", "tax"], pluginId: "portfolio-tracker", reason: "tracks portfolio and generates tax reports" },
|
|
1215956
|
+
{ keywords: ["solana", "sol", "jupiter", "raydium", "spl", "phantom"], pluginId: "solana-agent-kit", reason: "provides Solana trading, swaps, transfers, and NFT minting via Jupiter" }
|
|
1215935
1215957
|
];
|
|
1215936
1215958
|
});
|
|
1215937
1215959
|
|
|
@@ -1222762,14 +1222784,14 @@ var SLASH_COMMANDS = [
|
|
|
1222762
1222784
|
target: "handle_mcp_command"
|
|
1222763
1222785
|
},
|
|
1222764
1222786
|
{
|
|
1222765
|
-
name: "
|
|
1222766
|
-
aliases: ["
|
|
1222767
|
-
description: "Manage
|
|
1222768
|
-
usage: "/
|
|
1222787
|
+
name: "routing",
|
|
1222788
|
+
aliases: ["route", "routes"],
|
|
1222789
|
+
description: "Manage MCP tool-to-agent routing",
|
|
1222790
|
+
usage: "/routing <list|search|install|uninstall|route|configure|enable|disable|info|help>",
|
|
1222769
1222791
|
category: "system",
|
|
1222770
1222792
|
level: 2,
|
|
1222771
1222793
|
action: "tool",
|
|
1222772
|
-
target: "
|
|
1222794
|
+
target: "handle_routing_command"
|
|
1222773
1222795
|
},
|
|
1222774
1222796
|
{
|
|
1222775
1222797
|
name: "workflow",
|
|
@@ -1223425,43 +1223447,42 @@ function commandToPrompt(command, args) {
|
|
|
1223425
1223447
|
default:
|
|
1223426
1223448
|
return "Show my installed MCP plugins";
|
|
1223427
1223449
|
}
|
|
1223428
|
-
case "
|
|
1223429
|
-
case "skills": {
|
|
1223450
|
+
case "routing": {
|
|
1223430
1223451
|
if (!args)
|
|
1223431
|
-
return "List my installed
|
|
1223432
|
-
const
|
|
1223433
|
-
const
|
|
1223434
|
-
const
|
|
1223435
|
-
switch (
|
|
1223452
|
+
return "List my installed plugins with routing info";
|
|
1223453
|
+
const routingParts = args.split(/\s+/);
|
|
1223454
|
+
const routingSub = routingParts[0]?.toLowerCase();
|
|
1223455
|
+
const routingRest = routingParts.slice(1).join(" ");
|
|
1223456
|
+
switch (routingSub) {
|
|
1223436
1223457
|
case "list":
|
|
1223437
1223458
|
case "ls":
|
|
1223438
|
-
return "List my installed
|
|
1223459
|
+
return "List my installed plugins with routing info";
|
|
1223439
1223460
|
case "search":
|
|
1223440
1223461
|
case "find":
|
|
1223441
|
-
return
|
|
1223462
|
+
return routingRest ? `Search for plugins matching "${routingRest}"` : "Show the plugin marketplace";
|
|
1223442
1223463
|
case "install":
|
|
1223443
1223464
|
case "add":
|
|
1223444
|
-
return
|
|
1223465
|
+
return routingRest ? `Install the plugin "${routingRest}"` : "Show available plugins";
|
|
1223445
1223466
|
case "uninstall":
|
|
1223446
1223467
|
case "remove":
|
|
1223447
1223468
|
case "rm":
|
|
1223448
|
-
return
|
|
1223469
|
+
return routingRest ? `Uninstall the plugin "${routingRest}"` : "Which plugin to uninstall?";
|
|
1223449
1223470
|
case "route":
|
|
1223450
1223471
|
case "assign":
|
|
1223451
|
-
return `Route
|
|
1223472
|
+
return `Route plugin tools: ${routingRest}`;
|
|
1223452
1223473
|
case "configure":
|
|
1223453
1223474
|
case "config":
|
|
1223454
|
-
return
|
|
1223475
|
+
return routingRest ? `Configure credentials for plugin "${routingRest}"` : "Which plugin to configure?";
|
|
1223455
1223476
|
case "enable":
|
|
1223456
|
-
return
|
|
1223477
|
+
return routingRest ? `Enable the plugin "${routingRest}"` : "Which plugin to enable?";
|
|
1223457
1223478
|
case "disable":
|
|
1223458
|
-
return
|
|
1223479
|
+
return routingRest ? `Disable the plugin "${routingRest}"` : "Which plugin to disable?";
|
|
1223459
1223480
|
case "info":
|
|
1223460
|
-
return
|
|
1223481
|
+
return routingRest ? `Show info for plugin "${routingRest}"` : "Which plugin?";
|
|
1223461
1223482
|
case "help":
|
|
1223462
|
-
return "Show help for
|
|
1223483
|
+
return "Show help for routing management commands";
|
|
1223463
1223484
|
default:
|
|
1223464
|
-
return "List my installed
|
|
1223485
|
+
return "List my installed plugins with routing info";
|
|
1223465
1223486
|
}
|
|
1223466
1223487
|
}
|
|
1223467
1223488
|
case "workflow":
|
|
@@ -1224813,7 +1224834,7 @@ var import_react64 = __toESM(require_react(), 1);
|
|
|
1224813
1224834
|
// package.json
|
|
1224814
1224835
|
var package_default2 = {
|
|
1224815
1224836
|
name: "@general-liquidity/gordon-cli",
|
|
1224816
|
-
version: "0.75.
|
|
1224837
|
+
version: "0.75.11",
|
|
1224817
1224838
|
description: "The Frontier Trading Agent",
|
|
1224818
1224839
|
author: "General Liquidity, Inc.",
|
|
1224819
1224840
|
license: "MIT",
|
|
@@ -1229588,7 +1229609,7 @@ init_theme();
|
|
|
1229588
1229609
|
// src/app/commands/index.ts
|
|
1229589
1229610
|
init_mcp();
|
|
1229590
1229611
|
|
|
1229591
|
-
// src/app/commands/
|
|
1229612
|
+
// src/app/commands/routing.ts
|
|
1229592
1229613
|
init_installer();
|
|
1229593
1229614
|
init_registry5();
|
|
1229594
1229615
|
init_credentials();
|
|
@@ -1229606,62 +1229627,62 @@ var VALID_AGENTS = [
|
|
|
1229606
1229627
|
function isValidAgent(name16) {
|
|
1229607
1229628
|
return VALID_AGENTS.includes(name16);
|
|
1229608
1229629
|
}
|
|
1229609
|
-
async function
|
|
1229610
|
-
const
|
|
1229611
|
-
if (
|
|
1229630
|
+
async function routingList() {
|
|
1229631
|
+
const routings = getResolvedRoutings();
|
|
1229632
|
+
if (routings.length === 0) {
|
|
1229612
1229633
|
return {
|
|
1229613
1229634
|
success: true,
|
|
1229614
|
-
message: `No
|
|
1229615
|
-
Use "/
|
|
1229635
|
+
message: `No routing configs installed.
|
|
1229636
|
+
Use "/routing search <query>" to find plugins or "/routing help" for usage.`
|
|
1229616
1229637
|
};
|
|
1229617
1229638
|
}
|
|
1229618
|
-
const lines = [`${
|
|
1229639
|
+
const lines = [`${routings.length} routing config(s) installed:
|
|
1229619
1229640
|
`];
|
|
1229620
|
-
for (const
|
|
1229621
|
-
const
|
|
1229622
|
-
const status =
|
|
1229623
|
-
const
|
|
1229624
|
-
const gordonFlag =
|
|
1229625
|
-
lines.push(` ${
|
|
1229641
|
+
for (const routing of routings) {
|
|
1229642
|
+
const rm3 = routing.routingManifest;
|
|
1229643
|
+
const status = routing.enabled ? "enabled" : "disabled";
|
|
1229644
|
+
const routes = rm3.toolAgentMap && rm3.toolAgentMap.length > 0 ? `${rm3.toolAgentMap.length} custom route(s), default -> ${rm3.defaultAgent}` : `all -> ${rm3.defaultAgent}`;
|
|
1229645
|
+
const gordonFlag = rm3.alsoOnGordon ? " (+Gordon)" : "";
|
|
1229646
|
+
lines.push(` ${routing.pluginId} [${status}] \u2014 ${routing.toolCount} tool(s) [${routes}${gordonFlag}]`);
|
|
1229626
1229647
|
}
|
|
1229627
1229648
|
return { success: true, message: lines.join(`
|
|
1229628
|
-
`), data: {
|
|
1229649
|
+
`), data: { routings } };
|
|
1229629
1229650
|
}
|
|
1229630
|
-
async function
|
|
1229651
|
+
async function routingInstall(pluginId, defaultAgent = "Scanner") {
|
|
1229631
1229652
|
const listing = await marketplaceClient.getPlugin(pluginId);
|
|
1229632
1229653
|
if (!listing) {
|
|
1229633
1229654
|
return {
|
|
1229634
1229655
|
success: false,
|
|
1229635
|
-
message: `
|
|
1229656
|
+
message: `Plugin "${pluginId}" not found in marketplace.`
|
|
1229636
1229657
|
};
|
|
1229637
1229658
|
}
|
|
1229638
1229659
|
if (pluginInstaller.isInstalled(pluginId)) {
|
|
1229639
1229660
|
return {
|
|
1229640
1229661
|
success: false,
|
|
1229641
|
-
message: `
|
|
1229662
|
+
message: `Plugin "${pluginId}" is already installed. Use "/routing route ${pluginId} <agent>" to change routing.`
|
|
1229642
1229663
|
};
|
|
1229643
1229664
|
}
|
|
1229644
1229665
|
await pluginInstaller.install(listing);
|
|
1229645
|
-
const
|
|
1229666
|
+
const routingManifest = {
|
|
1229646
1229667
|
pluginId,
|
|
1229647
1229668
|
defaultAgent,
|
|
1229648
1229669
|
alsoOnGordon: false
|
|
1229649
1229670
|
};
|
|
1229650
|
-
await
|
|
1229651
|
-
await
|
|
1229671
|
+
await writeRoutingManifest(routingManifest);
|
|
1229672
|
+
await reloadRouting();
|
|
1229652
1229673
|
const needsCredentials = listing.manifest.authentication.type !== "none" && !credentialManager.hasRequiredCredentials(listing.manifest);
|
|
1229653
|
-
let message4 = `Installed
|
|
1229674
|
+
let message4 = `Installed plugin "${listing.manifest.name}" -> ${defaultAgent} (${listing.manifest.tools.length} tools)`;
|
|
1229654
1229675
|
if (needsCredentials) {
|
|
1229655
1229676
|
message4 += `
|
|
1229656
|
-
Configure credentials: /
|
|
1229677
|
+
Configure credentials: /routing configure ${pluginId}`;
|
|
1229657
1229678
|
}
|
|
1229658
1229679
|
return { success: true, message: message4, data: { pluginId, defaultAgent } };
|
|
1229659
1229680
|
}
|
|
1229660
|
-
async function
|
|
1229681
|
+
async function routingRoute(pluginId, agentName) {
|
|
1229661
1229682
|
if (!pluginInstaller.isInstalled(pluginId)) {
|
|
1229662
1229683
|
return {
|
|
1229663
1229684
|
success: false,
|
|
1229664
|
-
message: `
|
|
1229685
|
+
message: `Plugin "${pluginId}" is not installed.`
|
|
1229665
1229686
|
};
|
|
1229666
1229687
|
}
|
|
1229667
1229688
|
if (!isValidAgent(agentName)) {
|
|
@@ -1229670,67 +1229691,67 @@ async function skillRoute(pluginId, agentName) {
|
|
|
1229670
1229691
|
message: `Invalid agent "${agentName}". Valid: ${VALID_AGENTS.join(", ")}`
|
|
1229671
1229692
|
};
|
|
1229672
1229693
|
}
|
|
1229673
|
-
const
|
|
1229694
|
+
const routingManifest = {
|
|
1229674
1229695
|
pluginId,
|
|
1229675
1229696
|
defaultAgent: agentName,
|
|
1229676
1229697
|
alsoOnGordon: false
|
|
1229677
1229698
|
};
|
|
1229678
|
-
await
|
|
1229679
|
-
await
|
|
1229699
|
+
await writeRoutingManifest(routingManifest);
|
|
1229700
|
+
await reloadRouting();
|
|
1229680
1229701
|
return {
|
|
1229681
1229702
|
success: true,
|
|
1229682
|
-
message: `
|
|
1229703
|
+
message: `Plugin "${pluginId}" tools now route to ${agentName}.`
|
|
1229683
1229704
|
};
|
|
1229684
1229705
|
}
|
|
1229685
|
-
async function
|
|
1229706
|
+
async function routingUninstall(pluginId) {
|
|
1229686
1229707
|
const plugin = pluginInstaller.getPlugin(pluginId);
|
|
1229687
1229708
|
if (!plugin) {
|
|
1229688
1229709
|
return {
|
|
1229689
1229710
|
success: false,
|
|
1229690
|
-
message: `
|
|
1229711
|
+
message: `Plugin "${pluginId}" is not installed.`
|
|
1229691
1229712
|
};
|
|
1229692
1229713
|
}
|
|
1229693
1229714
|
const name16 = plugin.manifest.name;
|
|
1229694
1229715
|
await pluginInstaller.uninstall(pluginId);
|
|
1229695
1229716
|
credentialManager.delete(pluginId);
|
|
1229696
|
-
await
|
|
1229697
|
-
return { success: true, message: `Uninstalled
|
|
1229717
|
+
await reloadRouting();
|
|
1229718
|
+
return { success: true, message: `Uninstalled plugin "${name16}".` };
|
|
1229698
1229719
|
}
|
|
1229699
|
-
async function
|
|
1229720
|
+
async function routingEnable(pluginId) {
|
|
1229700
1229721
|
if (!pluginInstaller.isInstalled(pluginId)) {
|
|
1229701
1229722
|
return {
|
|
1229702
1229723
|
success: false,
|
|
1229703
|
-
message: `
|
|
1229724
|
+
message: `Plugin "${pluginId}" is not installed.`
|
|
1229704
1229725
|
};
|
|
1229705
1229726
|
}
|
|
1229706
1229727
|
await pluginInstaller.enable(pluginId);
|
|
1229707
|
-
await
|
|
1229708
|
-
return { success: true, message: `Enabled
|
|
1229728
|
+
await reloadRouting();
|
|
1229729
|
+
return { success: true, message: `Enabled plugin "${pluginId}".` };
|
|
1229709
1229730
|
}
|
|
1229710
|
-
async function
|
|
1229731
|
+
async function routingDisable(pluginId) {
|
|
1229711
1229732
|
if (!pluginInstaller.isInstalled(pluginId)) {
|
|
1229712
1229733
|
return {
|
|
1229713
1229734
|
success: false,
|
|
1229714
|
-
message: `
|
|
1229735
|
+
message: `Plugin "${pluginId}" is not installed.`
|
|
1229715
1229736
|
};
|
|
1229716
1229737
|
}
|
|
1229717
1229738
|
await pluginInstaller.disable(pluginId);
|
|
1229718
|
-
await
|
|
1229719
|
-
return { success: true, message: `Disabled
|
|
1229739
|
+
await reloadRouting();
|
|
1229740
|
+
return { success: true, message: `Disabled plugin "${pluginId}".` };
|
|
1229720
1229741
|
}
|
|
1229721
|
-
async function
|
|
1229742
|
+
async function handleRoutingCommand(args) {
|
|
1229722
1229743
|
const subcommand = args[0]?.toLowerCase() ?? "list";
|
|
1229723
1229744
|
const subArgs = args.slice(1);
|
|
1229724
1229745
|
switch (subcommand) {
|
|
1229725
1229746
|
case "list":
|
|
1229726
1229747
|
case "ls":
|
|
1229727
|
-
return
|
|
1229748
|
+
return routingList();
|
|
1229728
1229749
|
case "install":
|
|
1229729
1229750
|
case "add": {
|
|
1229730
1229751
|
if (!subArgs[0]) {
|
|
1229731
1229752
|
return {
|
|
1229732
1229753
|
success: false,
|
|
1229733
|
-
message: "Usage: /
|
|
1229754
|
+
message: "Usage: /routing install <id> [--agent <name>]"
|
|
1229734
1229755
|
};
|
|
1229735
1229756
|
}
|
|
1229736
1229757
|
const agentIdx = subArgs.indexOf("--agent");
|
|
@@ -1229745,18 +1229766,18 @@ async function handleSkillCommand(args) {
|
|
|
1229745
1229766
|
}
|
|
1229746
1229767
|
agent = candidate;
|
|
1229747
1229768
|
}
|
|
1229748
|
-
return
|
|
1229769
|
+
return routingInstall(subArgs[0], agent);
|
|
1229749
1229770
|
}
|
|
1229750
1229771
|
case "route":
|
|
1229751
1229772
|
case "assign": {
|
|
1229752
1229773
|
if (!subArgs[0] || !subArgs[1]) {
|
|
1229753
1229774
|
return {
|
|
1229754
1229775
|
success: false,
|
|
1229755
|
-
message: `Usage: /
|
|
1229776
|
+
message: `Usage: /routing route <id> <agent>
|
|
1229756
1229777
|
Agents: ${VALID_AGENTS.join(", ")}`
|
|
1229757
1229778
|
};
|
|
1229758
1229779
|
}
|
|
1229759
|
-
return
|
|
1229780
|
+
return routingRoute(subArgs[0], subArgs[1]);
|
|
1229760
1229781
|
}
|
|
1229761
1229782
|
case "uninstall":
|
|
1229762
1229783
|
case "remove":
|
|
@@ -1229764,20 +1229785,20 @@ Agents: ${VALID_AGENTS.join(", ")}`
|
|
|
1229764
1229785
|
if (!subArgs[0]) {
|
|
1229765
1229786
|
return {
|
|
1229766
1229787
|
success: false,
|
|
1229767
|
-
message: "Usage: /
|
|
1229788
|
+
message: "Usage: /routing uninstall <id>"
|
|
1229768
1229789
|
};
|
|
1229769
1229790
|
}
|
|
1229770
|
-
return
|
|
1229791
|
+
return routingUninstall(subArgs[0]);
|
|
1229771
1229792
|
case "enable":
|
|
1229772
1229793
|
if (!subArgs[0]) {
|
|
1229773
|
-
return { success: false, message: "Usage: /
|
|
1229794
|
+
return { success: false, message: "Usage: /routing enable <id>" };
|
|
1229774
1229795
|
}
|
|
1229775
|
-
return
|
|
1229796
|
+
return routingEnable(subArgs[0]);
|
|
1229776
1229797
|
case "disable":
|
|
1229777
1229798
|
if (!subArgs[0]) {
|
|
1229778
|
-
return { success: false, message: "Usage: /
|
|
1229799
|
+
return { success: false, message: "Usage: /routing disable <id>" };
|
|
1229779
1229800
|
}
|
|
1229780
|
-
return
|
|
1229801
|
+
return routingDisable(subArgs[0]);
|
|
1229781
1229802
|
case "search":
|
|
1229782
1229803
|
case "find": {
|
|
1229783
1229804
|
const { mcpSearch: mcpSearch2 } = await Promise.resolve().then(() => (init_mcp(), exports_mcp));
|
|
@@ -1229788,7 +1229809,7 @@ Agents: ${VALID_AGENTS.join(", ")}`
|
|
|
1229788
1229809
|
if (!subArgs[0]) {
|
|
1229789
1229810
|
return {
|
|
1229790
1229811
|
success: false,
|
|
1229791
|
-
message: "Usage: /
|
|
1229812
|
+
message: "Usage: /routing configure <id>"
|
|
1229792
1229813
|
};
|
|
1229793
1229814
|
}
|
|
1229794
1229815
|
const { mcpConfigure: mcpConfigure2 } = await Promise.resolve().then(() => (init_mcp(), exports_mcp));
|
|
@@ -1229796,21 +1229817,21 @@ Agents: ${VALID_AGENTS.join(", ")}`
|
|
|
1229796
1229817
|
}
|
|
1229797
1229818
|
case "info": {
|
|
1229798
1229819
|
if (!subArgs[0]) {
|
|
1229799
|
-
return { success: false, message: "Usage: /
|
|
1229820
|
+
return { success: false, message: "Usage: /routing info <id>" };
|
|
1229800
1229821
|
}
|
|
1229801
1229822
|
const { mcpInfo: mcpInfo2 } = await Promise.resolve().then(() => (init_mcp(), exports_mcp));
|
|
1229802
1229823
|
const infoResult = await mcpInfo2(subArgs[0]);
|
|
1229803
|
-
const
|
|
1229804
|
-
const
|
|
1229805
|
-
if (
|
|
1229806
|
-
const
|
|
1229807
|
-
const
|
|
1229808
|
-
`) : ` all -> ${
|
|
1229824
|
+
const routings = getResolvedRoutings();
|
|
1229825
|
+
const routing = routings.find((r) => r.pluginId === subArgs[0]);
|
|
1229826
|
+
if (routing) {
|
|
1229827
|
+
const rm3 = routing.routingManifest;
|
|
1229828
|
+
const routes = rm3.toolAgentMap && rm3.toolAgentMap.length > 0 ? rm3.toolAgentMap.map((m) => ` ${m.toolName} -> ${m.agent}`).join(`
|
|
1229829
|
+
`) : ` all -> ${rm3.defaultAgent}`;
|
|
1229809
1229830
|
infoResult.message += `
|
|
1229810
1229831
|
|
|
1229811
1229832
|
Routing:
|
|
1229812
|
-
${
|
|
1229813
|
-
if (
|
|
1229833
|
+
${routes}`;
|
|
1229834
|
+
if (rm3.alsoOnGordon) {
|
|
1229814
1229835
|
infoResult.message += `
|
|
1229815
1229836
|
(also available on Gordon)`;
|
|
1229816
1229837
|
}
|
|
@@ -1229820,23 +1229841,23 @@ ${routing}`;
|
|
|
1229820
1229841
|
case "help":
|
|
1229821
1229842
|
return {
|
|
1229822
1229843
|
success: true,
|
|
1229823
|
-
message: `
|
|
1229824
|
-
/
|
|
1229825
|
-
/
|
|
1229826
|
-
/
|
|
1229827
|
-
/
|
|
1229828
|
-
/
|
|
1229829
|
-
/
|
|
1229830
|
-
/
|
|
1229831
|
-
/
|
|
1229832
|
-
/
|
|
1229844
|
+
message: `Routing Commands:
|
|
1229845
|
+
/routing list \u2014 List installed plugins with routing
|
|
1229846
|
+
/routing search <query> \u2014 Search marketplace
|
|
1229847
|
+
/routing install <id> [--agent <name>] \u2014 Install and route to agent
|
|
1229848
|
+
/routing uninstall <id> \u2014 Remove a plugin
|
|
1229849
|
+
/routing route <id> <agent> \u2014 Change agent routing
|
|
1229850
|
+
/routing configure <id> \u2014 Set up credentials
|
|
1229851
|
+
/routing enable <id> \u2014 Enable a plugin
|
|
1229852
|
+
/routing disable <id> \u2014 Disable a plugin
|
|
1229853
|
+
/routing info <id> \u2014 Show plugin details
|
|
1229833
1229854
|
|
|
1229834
1229855
|
Agents: ${VALID_AGENTS.join(", ")}`
|
|
1229835
1229856
|
};
|
|
1229836
1229857
|
default:
|
|
1229837
1229858
|
return {
|
|
1229838
1229859
|
success: false,
|
|
1229839
|
-
message: `Unknown subcommand "${subcommand}". Use "/
|
|
1229860
|
+
message: `Unknown subcommand "${subcommand}". Use "/routing help" for usage.`
|
|
1229840
1229861
|
};
|
|
1229841
1229862
|
}
|
|
1229842
1229863
|
}
|
|
@@ -1232645,7 +1232666,7 @@ function AppContent({ onThemeChange }) {
|
|
|
1232645
1232666
|
if (envStatus.keys.OPENAI_API_KEY) {
|
|
1232646
1232667
|
initializeTracing2().catch((err) => console.error("[Tracing] Init failed:", err.message));
|
|
1232647
1232668
|
}
|
|
1232648
|
-
initMCPTools().then(() =>
|
|
1232669
|
+
initMCPTools().then(() => initRouting()).catch((err) => console.error("[Routing] Init failed:", err.message));
|
|
1232649
1232670
|
enableMCPHotReload(5000);
|
|
1232650
1232671
|
} catch (error48) {
|
|
1232651
1232672
|
console.error("Failed to initialize LLM client:", error48);
|
|
@@ -1233584,10 +1233605,10 @@ Error: ${result.error || "Unknown error"}`,
|
|
|
1233584
1233605
|
}));
|
|
1233585
1233606
|
return;
|
|
1233586
1233607
|
}
|
|
1233587
|
-
case "
|
|
1233608
|
+
case "handle_routing_command": {
|
|
1233588
1233609
|
setState((prev) => ({ ...prev, messages: [...prev.messages, userMessage2], isLoading: true }));
|
|
1233589
|
-
const
|
|
1233590
|
-
const result = await
|
|
1233610
|
+
const routingArgs = args.trim().length > 0 ? args.trim().split(/\s+/) : [];
|
|
1233611
|
+
const result = await handleRoutingCommand(routingArgs);
|
|
1233591
1233612
|
setState((prev) => ({
|
|
1233592
1233613
|
...prev,
|
|
1233593
1233614
|
messages: [
|