FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
major updates
tilakpatel22acc6d0042f5c
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/agents.rs b/fincept-terminal-desktop/src-tauri/src/commands/agents.rsindex ee18dc75c..175b10b7f 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/agents.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/agents.rs@@ -157,6 +157,34 @@ pub async fn get_agent_metadata(agent_type: String) -> Result<AgentMetadata, StrErr(format!("Legacy command - use get_agent_config instead for: {}", agent_type))}+/// Read agent configuration file from resources+#[tauri::command]+pub async fn read_agent_config(+ app: tauri::AppHandle,+ category: String,+ config_file: String,+) -> Result<String, String> {+ let config_path = format!("resources/scripts/agents/{}/configs/{}", category, config_file);++ let full_path = if cfg!(debug_assertions) {+ let current_dir = std::env::current_dir()+ .map_err(|e| format!("Failed to get current directory: {}", e))?;+ let base_dir = if current_dir.ends_with("src-tauri") {+ current_dir+ } else {+ current_dir.join("src-tauri")+ };+ base_dir.join(&config_path)+ } else {+ let resource_dir = app.path().resource_dir()+ .map_err(|e| format!("Failed to get resource directory: {}", e))?;+ resource_dir.join(&config_path)+ };++ std::fs::read_to_string(&full_path)+ .map_err(|e| format!("Failed to read config file {}: {}", full_path.display(), e))+}+#[tauri::command]pub async fn execute_python_agent_command(_app: tauri::AppHandle,diff --git a/fincept-terminal-desktop/src-tauri/src/commands/ai_quant_lab.rs b/fincept-terminal-desktop/src-tauri/src/commands/ai_quant_lab.rsindex 4258fb246..e73dc03f1 100644--- a/fincept-terminal-desktop/src-tauri/src/commands/ai_quant_lab.rs+++ b/fincept-terminal-desktop/src-tauri/src/commands/ai_quant_lab.rs@@ -1,7 +1,7 @@// AI Quant Lab Commands - Qlib and RD-Agent integration+// Uses direct subprocess execution to avoid worker pool socket issues on Windows#![allow(dead_code)]-use crate::utils::python::get_script_path;-use crate::python_runtime;+use crate::utils::python::execute_python_subprocess;// ============================================================================// QLIB COMMANDS@@ -19,7 +19,7 @@ pub async fn qlib_initialize(let args = vec!["initialize".to_string(), uri, reg];let script_path = get_script_path(&app, "ai_quant_lab/qlib_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Check Qlib status and availability@@ -27,7 +27,7 @@ pub async fn qlib_initialize(pub async fn qlib_check_status(app: tauri::AppHandle) -> Result<String, String> {let args = vec!["check_status".to_string()];let script_path = get_script_path(&app, "ai_quant_lab/qlib_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// List available pre-trained models@@ -35,7 +35,7 @@ pub async fn qlib_check_status(app: tauri::AppHandle) -> Result<String, String>pub async fn qlib_list_models(app: tauri::AppHandle) -> Result<String, String> {let args = vec!["list_models".to_string()];let script_path = get_script_path(&app, "ai_quant_lab/qlib_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Get factor library information@@ -43,7 +43,7 @@ pub async fn qlib_list_models(app: tauri::AppHandle) -> Result<String, String> {pub async fn qlib_get_factor_library(app: tauri::AppHandle) -> Result<String, String> {let args = vec!["get_factor_library".to_string()];let script_path = get_script_path(&app, "ai_quant_lab/qlib_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Fetch market data using Qlib@@ -64,7 +64,7 @@ pub async fn qlib_get_data(let args = vec!["get_data".to_string(), params.to_string()];let script_path = get_script_path(&app, "ai_quant_lab/qlib_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Train a Qlib model@@ -83,7 +83,7 @@ pub async fn qlib_train_model(let args = vec!["train_model".to_string(), params.to_string()];let script_path = get_script_path(&app, "ai_quant_lab/qlib_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Run backtest with Qlib@@ -100,7 +100,7 @@ pub async fn qlib_run_backtest(let args = vec!["run_backtest".to_string(), params.to_string()];let script_path = get_script_path(&app, "ai_quant_lab/qlib_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Optimize portfolio weights@@ -117,7 +117,7 @@ pub async fn qlib_optimize_portfolio(let args = vec!["optimize_portfolio".to_string(), params.to_string()];let script_path = get_script_path(&app, "ai_quant_lab/qlib_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}// ============================================================================@@ -137,7 +137,7 @@ pub async fn rdagent_initialize(};let script_path = get_script_path(&app, "ai_quant_lab/rd_agent_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Check RD-Agent status and availability@@ -145,7 +145,7 @@ pub async fn rdagent_initialize(pub async fn rdagent_check_status(app: tauri::AppHandle) -> Result<String, String> {let args = vec!["check_status".to_string()];let script_path = get_script_path(&app, "ai_quant_lab/rd_agent_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Get RD-Agent capabilities@@ -153,7 +153,7 @@ pub async fn rdagent_check_status(app: tauri::AppHandle) -> Result<String, Strinpub async fn rdagent_get_capabilities(app: tauri::AppHandle) -> Result<String, String> {let args = vec!["get_capabilities".to_string()];let script_path = get_script_path(&app, "ai_quant_lab/rd_agent_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Start autonomous factor mining@@ -174,7 +174,7 @@ pub async fn rdagent_start_factor_mining(let args = vec!["start_factor_mining".to_string(), params.to_string()];let script_path = get_script_path(&app, "ai_quant_lab/rd_agent_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Get factor mining task status@@ -185,7 +185,7 @@ pub async fn rdagent_get_factor_mining_status() -> Result<String, String> {let args = vec!["get_factor_mining_status".to_string(), task_id];let script_path = get_script_path(&app, "ai_quant_lab/rd_agent_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Get discovered factors@@ -196,7 +196,7 @@ pub async fn rdagent_get_discovered_factors() -> Result<String, String> {let args = vec!["get_discovered_factors".to_string(), task_id];let script_path = get_script_path(&app, "ai_quant_lab/rd_agent_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Optimize model using RD-Agent@@ -215,7 +215,7 @@ pub async fn rdagent_optimize_model(let args = vec!["optimize_model".to_string(), params.to_string()];let script_path = get_script_path(&app, "ai_quant_lab/rd_agent_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Analyze financial document@@ -232,7 +232,7 @@ pub async fn rdagent_analyze_document(let args = vec!["analyze_document".to_string(), params.to_string()];let script_path = get_script_path(&app, "ai_quant_lab/rd_agent_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}/// Run autonomous research@@ -251,5 +251,5 @@ pub async fn rdagent_run_autonomous_research(let args = vec!["run_autonomous_research".to_string(), params.to_string()];let script_path = get_script_path(&app, "ai_quant_lab/rd_agent_service.py")?;- python_runtime::execute_python_script(&script_path, args)+ execute_python_direct(&app, &script_path, &args)}diff --git a/fincept-terminal-desktop/src-tauri/src/lib.rs b/fincept-terminal-desktop/src-tauri/src/lib.rsindex 8ae246264..d780fcff5 100644--- a/fincept-terminal-desktop/src-tauri/src/lib.rs+++ b/fincept-terminal-desktop/src-tauri/src/lib.rs@@ -1365,6 +1365,7 @@ pub fn run() {commands::agents::get_agent_metadata,commands::agents::execute_python_agent_command,commands::agents::execute_core_agent,+ commands::agents::read_agent_config,// Portfolio Analytics Commands// Portfolio Management (CRUD operations)commands::portfolio_management::portfolio_create,diff --git a/fincept-terminal-desktop/src-tauri/src/utils/python.rs b/fincept-terminal-desktop/src-tauri/src/utils/python.rsindex 743c4e61f..2ba38efd9 100644--- a/fincept-terminal-desktop/src-tauri/src/utils/python.rs+++ b/fincept-terminal-desktop/src-tauri/src/utils/python.rs@@ -256,3 +256,44 @@ pub fn execute_python_script_simple(// Execute with worker pool (sync wrapper)crate::python_runtime::execute_python_script(&script_path, args_vec)}++/// Execute Python script directly using subprocess (bypasses worker pool)+/// Use this for commands that need specific venv or when worker pool has issues+/// This is slower but more reliable on Windows+#[cfg(target_os = "windows")]+const CREATE_NO_WINDOW: u32 = 0x08000000;++pub fn execute_python_subprocess(+ app: &tauri::AppHandle,+ script_relative_path: &str,+ args: &[String],+ library_hint: Option<&str>,+) -> Result<String, String> {+ use std::process::Command;+ #[cfg(target_os = "windows")]+ use std::os::windows::process::CommandExt;++ let script_path = get_script_path(app, script_relative_path)?;+ let python_path = get_python_path_for_library(app, library_hint)?;++ let mut cmd = Command::new(&python_path);+ cmd.arg(&script_path)+ .args(args)+ .stdout(std::process::Stdio::piped())+ .stderr(std::process::Stdio::piped());++ #[cfg(target_os = "windows")]+ cmd.creation_flags(CREATE_NO_WINDOW);++ let output = cmd.output()+ .map_err(|e| format!("Failed to execute Python: {}", e))?;++ if output.status.success() {+ String::from_utf8(output.stdout)+ .map_err(|e| format!("Failed to parse output: {}", e))+ } else {+ let stderr = String::from_utf8_lossy(&output.stderr);+ let stdout = String::from_utf8_lossy(&output.stdout);+ Err(format!("Python script failed:\nstderr: {}\nstdout: {}", stderr, stdout))+ }+}diff --git a/fincept-terminal-desktop/src/components/tabs/AgentConfigTab.tsx b/fincept-terminal-desktop/src/components/tabs/AgentConfigTab.tsxindex 8ac25c650..d3e020b39 100644--- a/fincept-terminal-desktop/src/components/tabs/AgentConfigTab.tsx+++ b/fincept-terminal-desktop/src/components/tabs/AgentConfigTab.tsx@@ -3,22 +3,24 @@import React, { useState, useEffect } from 'react';import { invoke } from '@tauri-apps/api/core';+import { resolveResource } from '@tauri-apps/api/path';+import { readTextFile } from '@tauri-apps/plugin-fs';import {Bot,- Brain,RefreshCw,- Save,Play,- Settings as SettingsIcon,Code,- ChevronDown,AlertCircle,CheckCircle,- Zap,- Database,Eye,EyeOff,+ Users,+ TrendingUp,+ Globe,+ Building2,} from 'lucide-react';+import { getLLMConfigs } from '@/services/sqliteService';+import { TabFooter } from '@/components/common/TabFooter';// Bloomberg Professional Color Paletteconst BLOOMBERG = {@@ -57,35 +59,28 @@ interface AgentConfig {instructions: string;}-interface ProviderInfo {- name: string;- models: string[];- api_key_required: boolean;-}-const AgentConfigTab: React.FC = () => {const [selectedCategory, setSelectedCategory] = useState('TraderInvestorsAgent');const [agents, setAgents] = useState<AgentConfig[]>([]);const [selectedAgent, setSelectedAgent] = useState<AgentConfig | null>(null);const [jsonText, setJsonText] = useState('');- const [providers, setProviders] = useState<Record<string, ProviderInfo>>({});const [loading, setLoading] = useState(false);const [testResult, setTestResult] = useState<any>(null);const [showJsonEditor, setShowJsonEditor] = useState(false);const [error, setError] = useState<string | null>(null);const [success, setSuccess] = useState<string | null>(null);+ const [testQuery, setTestQuery] = useState('Analyze AAPL stock and provide your investment thesis.');const categories = [- { id: 'TraderInvestorsAgent', name: 'TRADERS' },- { id: 'GeopoliticsAgents', name: 'GEOPOLITICS' },- { id: 'EconomicAgents', name: 'ECONOMICS' },- { id: 'hedgeFundAgents', name: 'HEDGE FUNDS' },+ { id: 'TraderInvestorsAgent', name: 'TRADERS', icon: TrendingUp, configFile: 'agent_definitions.json' },+ { id: 'GeopoliticsAgents', name: 'GEOPOLITICS', icon: Globe, configFile: 'agent_definitions.json' },+ { id: 'EconomicAgents', name: 'ECONOMICS', icon: Building2, configFile: 'agent_definitions.json' },+ { id: 'hedgeFundAgents', name: 'HEDGE FUNDS', icon: Users, configFile: 'team_config.json' },];// Load agents on mount and category changeuseEffect(() => {loadAgents();- loadProviders();}, [selectedCategory]);// Update JSON when selected agent changes@@ -98,21 +93,47 @@ const AgentConfigTab: React.FC = () => {const loadAgents = async () => {setLoading(true);setError(null);+ setAgents([]);+ setSelectedAgent(null);+try {- const result = await invoke('execute_python_agent_command', {- action: 'list_agents',- parameters: { category: selectedCategory },- inputs: null,- });+ const category = categories.find(c => c.id === selectedCategory);+ if (!category) {+ setError('Invalid category');+ setLoading(false);+ return;+ }++ // Try to load from resource path+ const configPath = `resources/scripts/agents/${selectedCategory}/configs/${category.configFile}`;- const data = result as any;- if (data.success) {- setAgents(data.agents || []);- if (data.agents && data.agents.length > 0) {- setSelectedAgent(data.agents[0]);+ try {+ const resourcePath = await resolveResource(configPath);+ const content = await readTextFile(resourcePath);+ const data = JSON.parse(content);++ const agentList = data.agents || [];+ setAgents(agentList);+ if (agentList.length > 0) {+ setSelectedAgent(agentList[0]);+ }+ } catch (fileError) {+ // Fallback: try invoke command to read file+ try {+ const result = await invoke<string>('read_agent_config', {+ category: selectedCategory,+ configFile: category.configFile,+ });+ const data = JSON.parse(result);+ const agentList = data.agents || [];+ setAgents(agentList);+ if (agentList.length > 0) {+ setSelectedAgent(agentList[0]);+ }+ } catch (invokeError) {+ console.error('Failed to load agents via invoke:', invokeError);+ setError(`Failed to load agents: ${fileError}`);}- } else {- setError(data.error || 'Failed to load agents');}} catch (err: any) {console.error('Failed to load agents:', err);@@ -122,80 +143,72 @@ const AgentConfigTab: React.FC = () => {}};- const loadProviders = async () => {+ // Fetch API keys from Settings LLM configurations+ const fetchApiKeysFromSettings = async (): Promise<Record<string, string>> => {try {- const result = await invoke('execute_python_agent_command', {- action: 'get_providers',- parameters: {},- inputs: null,- });-- const data = result as any;- if (data.success && data.providers) {- setProviders(data.providers);+ const llmConfigs = await getLLMConfigs();+ const apiKeys: Record<string, string> = {};++ for (const config of llmConfigs) {+ if (config.api_key) {+ const providerUpper = config.provider.toUpperCase();+ apiKeys[`${providerUpper}_API_KEY`] = config.api_key;+ apiKeys[config.provider] = config.api_key;+ apiKeys[providerUpper] = config.api_key;+ }}++ return apiKeys;} catch (err) {- console.error('Failed to load providers:', err);+ console.error('Failed to fetch API keys from settings:', err);+ return {};}};- const saveConfig = async () => {- if (!selectedAgent) return;+ const testAgent = async () => {+ if (!selectedAgent || !testQuery.trim()) return;setLoading(true);setError(null);+ setTestResult(null);setSuccess(null);+try {- // Parse the JSON text to validate and get updated config- const updatedConfig = JSON.parse(jsonText);-- const result = await invoke('execute_python_agent_command', {- action: 'update_config',- parameters: {- agent_id: selectedAgent.id,- category: selectedCategory,- updates: updatedConfig,- },- inputs: null,- });+ const apiKeys = await fetchApiKeysFromSettings();+ const provider = selectedAgent.llm_config.provider;- const data = result as any;- if (data.success) {- setSuccess('Configuration saved successfully!');- setSelectedAgent(updatedConfig);- setTimeout(() => setSuccess(null), 3000);- } else {- setError(data.error || 'Failed to save configuration');+ if (!apiKeys[provider] && !apiKeys[`${provider.toUpperCase()}_API_KEY`] && provider !== 'ollama' && provider !== 'fincept') {+ setError(`No API key found for ${provider}. Configure it in Settings > LLM Config.`);+ setLoading(false);+ return;}- } catch (err: any) {- console.error('Failed to save config:', err);- setError(err.toString());- } finally {- setLoading(false);- }- };- const testAgent = async () => {- if (!selectedAgent) return;-- setLoading(true);- setError(null);- setTestResult(null);- try {- const result = await invoke('execute_python_agent_command', {- action: 'execute_agent',- parameters: {- agent_id: selectedAgent.id,- category: selectedCategory,- query: 'Test query: Provide a brief summary of your role and capabilities.',- },- inputs: {- api_keys: {}, // User would need to provide API keys+ // Build config from selected agent+ const config = {+ model: {+ provider: selectedAgent.llm_config.provider,+ model_id: selectedAgent.llm_config.model_id,+ temperature: selectedAgent.llm_config.temperature,+ max_tokens: selectedAgent.llm_config.max_tokens,},+ instructions: selectedAgent.instructions,+ tools: selectedAgent.tools,+ memory: { enabled: selectedAgent.enable_memory },+ debug: false,+ };++ const result = await invoke<string>('execute_core_agent', {+ queryJson: testQuery,+ configJson: JSON.stringify(config),+ apiKeysJson: JSON.stringify(apiKeys),});- const data = result as any;- setTestResult(data);+ const parsed = JSON.parse(result);+ setTestResult(parsed);+ if (parsed.success) {+ setSuccess('Agent executed successfully');+ setTimeout(() => setSuccess(null), 3000);+ }} catch (err: any) {console.error('Failed to test agent:', err);setError(err.toString());@@ -204,6 +217,8 @@ const AgentConfigTab: React.FC = () => {}};+ const CategoryIcon = categories.find(c => c.id === selectedCategory)?.icon || Bot;+return (<div style={{height: '100%',@@ -215,19 +230,15 @@ const AgentConfigTab: React.FC = () => {flexDirection: 'column'}}><style>{`- @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');-*::-webkit-scrollbar { width: 6px; height: 6px; }*::-webkit-scrollbar-track { background: ${BLOOMBERG.DARK_BG}; }*::-webkit-scrollbar-thumb { background: ${BLOOMBERG.BORDER}; border-radius: 3px; }*::-webkit-scrollbar-thumb:hover { background: ${BLOOMBERG.MUTED}; }-- .terminal-glow {- text-shadow: 0 0 10px ${BLOOMBERG.ORANGE}40;- }+ @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }+ .animate-spin { animation: spin 1s linear infinite; }`}</style>- {/* ========== TOP NAVIGATION BAR ========== */}+ {/* TOP NAVIGATION BAR */}<div style={{backgroundColor: BLOOMBERG.HEADER_BG,borderBottom: `2px solid ${BLOOMBERG.ORANGE}`,@@ -236,18 +247,11 @@ const AgentConfigTab: React.FC = () => {alignItems: 'center',justifyContent: 'space-between',flexShrink: 0,- boxShadow: `0 2px 8px ${BLOOMBERG.ORANGE}20`}}><div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}><div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>- <Bot size={18} color={BLOOMBERG.ORANGE} style={{ filter: 'drop-shadow(0 0 4px ' + BLOOMBERG.ORANGE + ')' }} />- <span style={{- color: BLOOMBERG.ORANGE,- fontWeight: 700,- fontSize: '14px',- letterSpacing: '0.5px',- textShadow: `0 0 10px ${BLOOMBERG.ORANGE}40`- }}>+ <Bot size={18} color={BLOOMBERG.ORANGE} />+ <span style={{ color: BLOOMBERG.ORANGE, fontWeight: 700, fontSize: '14px', letterSpacing: '0.5px' }}>AGENT CONFIGURATION</span></div>@@ -255,26 +259,32 @@ const AgentConfigTab: React.FC = () => {<div style={{ height: '16px', width: '1px', backgroundColor: BLOOMBERG.BORDER }} />{/* Category Selector */}- <div style={{ display: 'flex', gap: '8px' }}>- {categories.map((cat) => (- <button- key={cat.id}- onClick={() => setSelectedCategory(cat.id)}- style={{- padding: '4px 12px',- backgroundColor: selectedCategory === cat.id ? BLOOMBERG.ORANGE : BLOOMBERG.PANEL_BG,- border: `1px solid ${selectedCategory === cat.id ? BLOOMBERG.ORANGE : BLOOMBERG.BORDER}`,- color: selectedCategory === cat.id ? BLOOMBERG.DARK_BG : BLOOMBERG.CYAN,- cursor: 'pointer',- fontSize: '10px',- fontWeight: 600,- transition: 'all 0.2s',- letterSpacing: '0.5px'- }}- >- {cat.name}- </button>- ))}+ <div style={{ display: 'flex', gap: '4px' }}>+ {categories.map((cat) => {+ const Icon = cat.icon;+ return (+ <button+ key={cat.id}+ onClick={() => setSelectedCategory(cat.id)}+ style={{+ padding: '4px 10px',+ backgroundColor: selectedCategory === cat.id ? BLOOMBERG.ORANGE : BLOOMBERG.PANEL_BG,+ border: `1px solid ${selectedCategory === cat.id ? BLOOMBERG.ORANGE : BLOOMBERG.BORDER}`,+ color: selectedCategory === cat.id ? BLOOMBERG.DARK_BG : BLOOMBERG.CYAN,+ cursor: 'pointer',+ fontSize: '9px',+ fontWeight: 600,+ letterSpacing: '0.5px',+ display: 'flex',+ alignItems: 'center',+ gap: '4px',+ }}+ >+ <Icon size={10} />+ {cat.name}+ </button>+ );+ })}</div></div>@@ -295,7 +305,7 @@ const AgentConfigTab: React.FC = () => {}}>{showJsonEditor ? <EyeOff size={12} /> : <Eye size={12} />}- {showJsonEditor ? 'Hide JSON' : 'Show JSON'}+ JSON</button><button@@ -320,7 +330,7 @@ const AgentConfigTab: React.FC = () => {</div></div>- {/* ========== MAIN CONTENT ========== */}+ {/* MAIN CONTENT */}<div style={{ flex: 1, display: 'flex', overflow: 'hidden' }}>{/* Left Panel - Agent List */}<div style={{@@ -367,47 +377,33 @@ const AgentConfigTab: React.FC = () => {cursor: 'pointer',textAlign: 'left',fontSize: '10px',- transition: 'all 0.2s'- }}- onMouseEnter={(e) => {- if (selectedAgent?.id !== agent.id) {- e.currentTarget.style.backgroundColor = BLOOMBERG.HOVER;- e.currentTarget.style.borderColor = BLOOMBERG.MUTED;- }- }}- onMouseLeave={(e) => {- if (selectedAgent?.id !== agent.id) {- e.currentTarget.style.backgroundColor = 'transparent';- e.currentTarget.style.borderColor = BLOOMBERG.BORDER;- }+ transition: 'all 0.15s'}}><div style={{ fontWeight: 600, color: BLOOMBERG.CYAN, marginBottom: '4px' }}>{agent.name}</div>- <div style={{ color: BLOOMBERG.GRAY, fontSize: '9px', marginBottom: '4px' }}>- {agent.role}+ <div style={{ color: BLOOMBERG.GRAY, fontSize: '9px', marginBottom: '4px', lineHeight: 1.3 }}>+ {agent.role?.substring(0, 60)}{agent.role?.length > 60 ? '...' : ''}</div><div style={{ display: 'flex', gap: '4px', flexWrap: 'wrap' }}><span style={{padding: '2px 6px',backgroundColor: BLOOMBERG.DARK_BG,border: `1px solid ${BLOOMBERG.BORDER}`,- borderRadius: '2px',fontSize: '8px',color: BLOOMBERG.YELLOW}}>- {agent.llm_config.provider}+ {agent.llm_config?.provider || 'N/A'}</span><span style={{padding: '2px 6px',backgroundColor: BLOOMBERG.DARK_BG,border: `1px solid ${BLOOMBERG.BORDER}`,- borderRadius: '2px',fontSize: '8px',color: BLOOMBERG.PURPLE}}>- {agent.llm_config.model_id}+ {agent.llm_config?.model_id?.substring(0, 20) || 'N/A'}</span></div></button>@@ -430,9 +426,15 @@ const AgentConfigTab: React.FC = () => {fontSize: '10px'}}>{error ? <AlertCircle size={14} color={BLOOMBERG.RED} /> : <CheckCircle size={14} color={BLOOMBERG.GREEN} />}- <span style={{ color: error ? BLOOMBERG.RED : BLOOMBERG.GREEN }}>+ <span style={{ color: error ? BLOOMBERG.RED : BLOOMBERG.GREEN, flex: 1 }}>{error || success}</span>+ <button+ onClick={() => { setError(null); setSuccess(null); }}+ style={{ background: 'none', border: 'none', color: 'inherit', cursor: 'pointer', fontSize: '14px' }}+ >+ x+ </button></div>)}@@ -447,33 +449,33 @@ const AgentConfigTab: React.FC = () => {<div style={{ fontSize: '16px', fontWeight: 700, color: BLOOMBERG.CYAN, marginBottom: '6px' }}>{selectedAgent.name}</div>- <div style={{ fontSize: '10px', color: BLOOMBERG.GRAY, marginBottom: '8px' }}>+ <div style={{ fontSize: '10px', color: BLOOMBERG.GRAY, marginBottom: '8px', lineHeight: 1.4 }}>{selectedAgent.description}</div>- <div style={{ display: 'flex', gap: '8px' }}>- <button- onClick={saveConfig}- disabled={loading}++ {/* Test Query Input */}+ <div style={{ marginBottom: '8px' }}>+ <input+ type="text"+ value={testQuery}+ onChange={(e) => setTestQuery(e.target.value)}+ placeholder="Enter test query..."style={{- padding: '6px 12px',- backgroundColor: BLOOMBERG.GREEN,- border: 'none',- color: BLOOMBERG.DARK_BG,- cursor: loading ? 'not-allowed' : 'pointer',+ width: '100%',+ padding: '6px 10px',+ backgroundColor: BLOOMBERG.DARK_BG,+ border: `1px solid ${BLOOMBERG.BORDER}`,+ color: BLOOMBERG.WHITE,fontSize: '10px',- fontWeight: 600,- display: 'flex',- alignItems: 'center',- gap: '4px'+ outline: 'none',}}- >- <Save size={12} />- Save Configuration- </button>+ />+ </div>+ <div style={{ display: 'flex', gap: '8px' }}><buttononClick={testAgent}- disabled={loading}+ disabled={loading || !testQuery.trim()}style={{padding: '6px 12px',backgroundColor: BLOOMBERG.BLUE,@@ -484,16 +486,17 @@ const AgentConfigTab: React.FC = () => {fontWeight: 600,display: 'flex',alignItems: 'center',- gap: '4px'+ gap: '4px',+ opacity: loading || !testQuery.trim() ? 0.5 : 1,}}><Play size={12} />- Test Agent+ {loading ? 'Running...' : 'Run Agent'}</button></div></div>- {/* JSON Editor */}+ {/* Content Area */}<div style={{ flex: 1, overflow: 'auto', padding: '12px' }}>{showJsonEditor ? (<div style={{ height: '100%' }}>@@ -529,73 +532,45 @@ const AgentConfigTab: React.FC = () => {</div>) : (<div style={{ display: 'grid', gap: '12px' }}>- {/* Basic Info */}- <div>- <div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>- ROLE- </div>- <div style={{- padding: '8px',- backgroundColor: BLOOMBERG.PANEL_BG,- border: `1px solid ${BLOOMBERG.BORDER}`,- fontSize: '11px',- color: BLOOMBERG.YELLOW- }}>- {selectedAgent.role}- </div>- </div>-- <div>- <div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>- GOAL+ {/* Role & Goal */}+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '12px' }}>+ <div>+ <div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>ROLE</div>+ <div style={{ padding: '8px', backgroundColor: BLOOMBERG.PANEL_BG, border: `1px solid ${BLOOMBERG.BORDER}`, fontSize: '10px', color: BLOOMBERG.YELLOW }}>+ {selectedAgent.role}+ </div></div>- <div style={{- padding: '8px',- backgroundColor: BLOOMBERG.PANEL_BG,- border: `1px solid ${BLOOMBERG.BORDER}`,- fontSize: '11px'- }}>- {selectedAgent.goal}+ <div>+ <div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>GOAL</div>+ <div style={{ padding: '8px', backgroundColor: BLOOMBERG.PANEL_BG, border: `1px solid ${BLOOMBERG.BORDER}`, fontSize: '10px' }}>+ {selectedAgent.goal}+ </div></div></div>{/* LLM Config */}<div>- <div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>- LLM CONFIGURATION- </div>+ <div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>LLM CONFIGURATION</div><div style={{padding: '8px',backgroundColor: BLOOMBERG.PANEL_BG,border: `1px solid ${BLOOMBERG.BORDER}`,display: 'grid',- gridTemplateColumns: '1fr 1fr',+ gridTemplateColumns: 'repeat(4, 1fr)',gap: '8px',fontSize: '10px'}}>- <div>- <span style={{ color: BLOOMBERG.GRAY }}>Provider:</span>{' '}- <span style={{ color: BLOOMBERG.CYAN }}>{selectedAgent.llm_config.provider}</span>- </div>- <div>- <span style={{ color: BLOOMBERG.GRAY }}>Model:</span>{' '}- <span style={{ color: BLOOMBERG.PURPLE }}>{selectedAgent.llm_config.model_id}</span>- </div>- <div>- <span style={{ color: BLOOMBERG.GRAY }}>Temperature:</span>{' '}- <span style={{ color: BLOOMBERG.YELLOW }}>{selectedAgent.llm_config.temperature}</span>- </div>- <div>- <span style={{ color: BLOOMBERG.GRAY }}>Max Tokens:</span>{' '}- <span style={{ color: BLOOMBERG.YELLOW }}>{selectedAgent.llm_config.max_tokens}</span>- </div>+ <div><span style={{ color: BLOOMBERG.GRAY }}>Provider:</span> <span style={{ color: BLOOMBERG.CYAN }}>{selectedAgent.llm_config?.provider}</span></div>+ <div><span style={{ color: BLOOMBERG.GRAY }}>Model:</span> <span style={{ color: BLOOMBERG.PURPLE }}>{selectedAgent.llm_config?.model_id}</span></div>+ <div><span style={{ color: BLOOMBERG.GRAY }}>Temp:</span> <span style={{ color: BLOOMBERG.YELLOW }}>{selectedAgent.llm_config?.temperature}</span></div>+ <div><span style={{ color: BLOOMBERG.GRAY }}>Max Tokens:</span> <span style={{ color: BLOOMBERG.YELLOW }}>{selectedAgent.llm_config?.max_tokens}</span></div></div></div>{/* Tools */}<div><div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>- TOOLS ({selectedAgent.tools.length})+ TOOLS ({selectedAgent.tools?.length || 0})</div><div style={{padding: '8px',@@ -605,17 +580,14 @@ const AgentConfigTab: React.FC = () => {gap: '6px',flexWrap: 'wrap'}}>- {selectedAgent.tools.map((tool, idx) => (- <span- key={idx}- style={{- padding: '4px 8px',- backgroundColor: BLOOMBERG.DARK_BG,- border: `1px solid ${BLOOMBERG.BORDER}`,- color: BLOOMBERG.GREEN,- fontSize: '9px'- }}- >+ {(selectedAgent.tools || []).map((tool, idx) => (+ <span key={idx} style={{+ padding: '4px 8px',+ backgroundColor: BLOOMBERG.DARK_BG,+ border: `1px solid ${BLOOMBERG.BORDER}`,+ color: BLOOMBERG.GREEN,+ fontSize: '9px'+ }}>{tool}</span>))}@@ -624,17 +596,16 @@ const AgentConfigTab: React.FC = () => {{/* Instructions */}<div>- <div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>- INSTRUCTIONS- </div>+ <div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>INSTRUCTIONS</div><div style={{padding: '8px',backgroundColor: BLOOMBERG.PANEL_BG,border: `1px solid ${BLOOMBERG.BORDER}`,fontSize: '10px',- maxHeight: '200px',+ maxHeight: '150px',overflow: 'auto',- lineHeight: '1.5'+ lineHeight: '1.5',+ whiteSpace: 'pre-wrap',}}>{selectedAgent.instructions}</div>@@ -643,9 +614,7 @@ const AgentConfigTab: React.FC = () => {{/* Test Result */}{testResult && (<div>- <div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>- TEST RESULT- </div>+ <div style={{ fontSize: '10px', fontWeight: 600, color: BLOOMBERG.GRAY, marginBottom: '6px' }}>TEST RESULT</div><div style={{padding: '8px',backgroundColor: BLOOMBERG.DARK_BG,@@ -655,8 +624,8 @@ const AgentConfigTab: React.FC = () => {overflow: 'auto',fontFamily: 'monospace'}}>- <pre style={{ margin: 0, color: testResult.success ? BLOOMBERG.GREEN : BLOOMBERG.RED }}>- {JSON.stringify(testResult, null, 2)}+ <pre style={{ margin: 0, color: testResult.success ? BLOOMBERG.GREEN : BLOOMBERG.RED, whiteSpace: 'pre-wrap' }}>+ {testResult.response || testResult.content || JSON.stringify(testResult, null, 2)}</pre></div></div>@@ -675,13 +644,23 @@ const AgentConfigTab: React.FC = () => {fontSize: '11px'}}><div style={{ textAlign: 'center' }}>- <Bot size={48} style={{ margin: '0 auto 12px', opacity: 0.3 }} />+ <CategoryIcon size={48} style={{ margin: '0 auto 12px', opacity: 0.3 }} /><div>Select an agent to view configuration</div></div></div>)}</div></div>++ {/* Footer */}+ <TabFooter+ tabName="AGENT CONFIG"+ leftInfo={[+ { label: `${agents.length} agents`, color: BLOOMBERG.CYAN },+ { label: selectedCategory, color: BLOOMBERG.YELLOW },+ ]}+ statusInfo="API keys configured in Settings > LLM Config"+ /></div>);};