UNPKG

automagik-cli

Version:

Automagik CLI - A powerful command-line interface for interacting with Automagik Hive multi-agent AI systems

50 lines (49 loc) 2.73 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Box, Text } from 'ink'; import Spinner from 'ink-spinner'; import { Colors } from '../colors.js'; export const ConnectionStatus = ({ status, url, error, retryCount = 0, }) => { const getStatusIcon = () => { switch (status) { case 'connecting': return _jsx(Spinner, { type: "dots" }); case 'connected': return '✅'; case 'failed': return '❌'; case 'configured': return '🔧'; default: return '⚡'; } }; const getStatusColor = () => { switch (status) { case 'connecting': return Colors.AccentCyan; case 'connected': return Colors.AccentGreen; case 'failed': return Colors.AccentRed; case 'configured': return Colors.AccentBlue; default: return Colors.Comment; } }; const getStatusMessage = () => { switch (status) { case 'connecting': return retryCount > 0 ? `Retrying connection (${retryCount}/3)...` : 'Connecting to server...'; case 'connected': return 'Connected successfully!'; case 'failed': return 'Connection failed'; case 'configured': return 'Server configured, attempting connection...'; default: return 'Checking connection...'; } }; return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Box, { marginBottom: status === 'failed' ? 1 : 0, children: _jsxs(Text, { color: getStatusColor(), children: [getStatusIcon(), " ", getStatusMessage()] }) }), _jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: Colors.Comment, children: ["\uD83D\uDD17 Server: ", url] }) }), status === 'failed' && error && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: Colors.AccentRed, children: ["\uD83D\uDCA5 Error: ", error] }) })), status === 'failed' && (_jsx(Box, { children: _jsx(Text, { color: Colors.Comment, children: "\uD83D\uDCDD This usually means:" }) })), status === 'failed' && (_jsxs(Box, { marginLeft: 2, flexDirection: "column", children: [_jsx(Text, { color: Colors.Comment, children: "\u2022 The API server is not running" }), _jsx(Text, { color: Colors.Comment, children: "\u2022 The server URL is incorrect" }), _jsx(Text, { color: Colors.Comment, children: "\u2022 Network connectivity issues" }), _jsx(Text, { color: Colors.Comment, children: "\u2022 Firewall blocking the connection" })] }))] })); };