UNPKG

tlnt

Version:

TLNT - HMS-Powered Multi-Agent Platform with Government Agency Analysis, Deep Research, and Enterprise-Ready Deployment. Self-optimizing multi-domain AI agent with continuous learning and enterprise-grade performance monitoring.

116 lines • 4.41 kB
import { Command } from 'commander'; import { render } from 'ink'; import React from 'react'; import { MessageBus } from '../core/messageBus.js'; import { WatchdogMonitor } from '../watch/watchdogMonitor.js'; import { HMSAgentHub } from '../core/hmsAgentHub.js'; import { TmuxPanel } from '../ui/tmuxPanel.js'; import chalk from 'chalk'; export function createTmuxCommand() { const command = new Command('tmux'); command .description('Launch tmux-style panel interface with main content and info panel') .option('-p, --port <port>', 'Port for message bus', '6379') .option('--hub-url <url>', 'Hub URL for agent coordination', 'http://localhost:8080') .option('--offline', 'Run in offline mode without hub connection', false) .action(async (options) => { try { await launchTmuxInterface(options); } catch (error) { console.error(chalk.red('Failed to launch tmux interface:'), error); process.exit(1); } }); return command; } async function launchTmuxInterface(options) { console.log(chalk.cyan('🦾 Initializing Blax/Tlnt Tmux Interface...')); // Initialize core components const messageBus = new MessageBus({ redisUrl: `redis://localhost:${options.port || 6379}`, maxRetries: 3, retryDelay: 100 }); const agentHub = new HMSAgentHub({ hms: { hmsNet: { baseURL: options.hubUrl || process.env.HMS_NET_URL || 'https://hms-net.herokuapp.com', apiKey: process.env.HMS_NET_API_KEY, timeout: 30000, }, hmsNfo: { baseURL: process.env.HMS_NFO_URL || 'https://hms-nfo-2b4dbb6f7d60.herokuapp.com', apiKey: process.env.HMS_NFO_API_KEY, timeout: 30000, }, }, fallbackToMock: !options.offline, enableTelemetry: true, }); const watchdog = new WatchdogMonitor({ alertThresholds: { errorRate: 0.1, eventRate: 1000, memoryUsage: 0.8 } }, messageBus); try { // Connect message bus console.log(chalk.gray('Connecting to message bus...')); await messageBus.connect(); // Initialize HMS-powered agent hub console.log(chalk.gray('Initializing HMS-powered agent hub...')); await agentHub.initialize(); // Start watchdog console.log(chalk.gray('Starting watchdog monitor...')); await watchdog.start(); // Clear console and launch interface console.clear(); console.log(chalk.green('āœ… HMS-powered Tmux interface ready!')); console.log(chalk.gray('Controls: Tab (switch pane) | Ctrl+M (mode) | Ctrl+C (exit)')); console.log(chalk.gray('Commands: /help, /agents, /deals, /status, /clear')); console.log(chalk.gray('Features: HMS-NET agents, HMS-NFO research, automatic fallback\n')); // Render the tmux interface const { unmount } = render(React.createElement(TmuxPanel, { messageBus, watchdog, agentHub })); // Handle cleanup on exit const cleanup = async () => { console.log(chalk.yellow('\nšŸ”„ Shutting down...')); unmount(); try { await watchdog.stop(); await messageBus.disconnect(); console.log(chalk.green('āœ… Clean shutdown complete')); } catch (error) { console.error(chalk.red('Error during shutdown:'), error); } process.exit(0); }; // Register cleanup handlers process.on('SIGINT', cleanup); process.on('SIGTERM', cleanup); process.on('uncaughtException', (error) => { console.error(chalk.red('Uncaught exception:'), error); cleanup(); }); } catch (error) { console.error(chalk.red('Failed to initialize components:'), error); // Cleanup on error try { await watchdog.stop(); await messageBus.disconnect(); } catch (cleanupError) { console.error(chalk.red('Error during cleanup:'), cleanupError); } process.exit(1); } } export default createTmuxCommand; //# sourceMappingURL=tmuxCommand.js.map