UNPKG

smalltalk-ai

Version:

A complete TypeScript framework for building LLM applications with agent support and MCP integration

1,010 lines (840 loc) 17 kB
/* Based on the mini_lesson_web_style_guide.md */ /* Root Variables */ :root { --primary-blue: #3b82f6; --primary-green: #4CAF50; --primary-green-hover: #45a049; --gray-button: #6c757d; /* Backgrounds */ --app-bg: #f8f9fa; --sidebar-bg: #f9f9f9; --lesson-bg: white; --markdown-bg: #f9f9f9; --code-bg: #f6f8fa; /* Text Colors */ --heading-color: #2c3e50; --body-color: #34495e; --italic-color: #34495e; --blockquote-color: #666; /* Chat Message Colors */ --user-msg-bg: #e1f5fe; --assistant-msg-bg: #eee; --agent-msg-bg: #f0f4ff; --agent-border: #4CAF50; --system-msg-bg: #fff3cd; --system-msg-border: #ffe066; /* Borders */ --border-color: #ccc; --border-light: #eee; --divider-color: #dee2e6; --blockquote-border: #ddd; /* Shadows */ --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1); --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.1); } /* Reset and Base Styles */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; line-height: 1.6; color: var(--body-color); background-color: var(--app-bg); height: 100vh; overflow: hidden; } code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; } /* App Layout */ .app-container { display: flex; height: 100vh; width: 100vw; } .main-content { flex: 1; display: flex; flex-direction: column; background-color: var(--app-bg); padding: 2rem; } .chat-sidebar { width: 30%; background-color: var(--sidebar-bg); border-left: 1px solid var(--border-color); padding: 20px; display: flex; flex-direction: column; overflow-y: auto; } /* Chat Container */ .chat-container { background: var(--lesson-bg); border-radius: 8px; box-shadow: var(--shadow-light); display: flex; flex-direction: column; height: 100%; overflow: hidden; } /* Chat Header */ .chat-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 2rem; border-bottom: 1px solid var(--divider-color); background: white; } .header-left h1 { color: var(--heading-color); margin: 0; font-size: 1.5rem; } .subtitle { color: var(--blockquote-color); font-size: 0.9rem; } .header-right { display: flex; align-items: center; gap: 1rem; } .connection-status { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; } .status-dot { width: 8px; height: 8px; border-radius: 50%; background-color: #ffc107; transition: background-color 0.3s; } .status-dot.connected { background-color: var(--primary-green); } .status-dot.disconnected { background-color: #dc3545; } .clear-button { background: var(--gray-button); color: white; border: none; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; font-size: 0.9rem; transition: background-color 0.2s; } .clear-button:hover { background: #5a6268; } /* Messages Container */ .messages-container { flex: 1; overflow-y: auto; padding: 1rem 2rem; background: var(--markdown-bg); margin: 0 5%; } .welcome-message { text-align: center; padding: 2rem; color: var(--body-color); } .welcome-content h2 { color: var(--heading-color); margin-bottom: 1rem; } .quick-tips { margin-top: 2rem; text-align: left; background: white; padding: 1.5rem; border-radius: 8px; box-shadow: var(--shadow-light); } .quick-tips h3 { color: var(--heading-color); margin-bottom: 1rem; } .quick-tips ul { list-style-position: inside; } .quick-tips li { margin-bottom: 0.5rem; } .quick-tips code { background: var(--code-bg); padding: 0.2rem 0.4rem; border-radius: 3px; font-size: 0.9rem; } /* Chat Messages */ .chat-message { margin-bottom: 1rem; max-width: 85%; word-wrap: break-word; } .chat-message.user { margin-left: auto; margin-right: 0; } .chat-message.assistant { margin-left: 0; margin-right: auto; } .chat-message.system { margin: 0.5rem auto; max-width: 70%; text-align: center; } .message-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; font-size: 0.85rem; } .message-role { font-weight: bold; text-transform: capitalize; } .message-timestamp { color: var(--blockquote-color); font-size: 0.75rem; } .message-content { padding: 0.75rem 1rem; border-radius: 12px; line-height: 1.5; } .chat-message.user .message-content { background-color: var(--user-msg-bg); color: var(--body-color); } .chat-message.assistant .message-content { background-color: var(--assistant-msg-bg); color: var(--body-color); } .chat-message.system .message-content { background-color: var(--system-msg-bg); border: 1px solid var(--system-msg-border); color: var(--body-color); font-size: 0.9rem; } /* Chat Input */ .chat-input-container { padding: 1.5rem 2rem; border-top: 1px solid var(--divider-color); background: white; } .input-wrapper { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; } #messageInput { flex: 1; border: 1px solid var(--border-color); border-radius: 8px; padding: 0.75rem; font-family: inherit; font-size: 1rem; resize: none; min-height: 44px; max-height: 120px; outline: none; transition: border-color 0.2s; } #messageInput:focus { border-color: var(--primary-blue); } .send-button { background: var(--primary-green); color: white; border: none; border-radius: 8px; padding: 0.75rem; cursor: pointer; transition: background-color 0.2s; display: flex; align-items: center; justify-content: center; min-width: 44px; } .send-button:hover:not(:disabled) { background: var(--primary-green-hover); } .send-button:disabled { background: var(--border-color); cursor: not-allowed; } .input-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--blockquote-color); } .typing-indicator { font-style: italic; } /* Sidebar Sections */ .sidebar-section { margin-bottom: 2rem; } .sidebar-section h3 { color: var(--heading-color); margin-bottom: 1rem; font-size: 1rem; } /* Current Agent */ .current-agent { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: white; border-radius: 8px; box-shadow: var(--shadow-light); } .agent-avatar { font-size: 2rem; } .agent-name { font-weight: bold; color: var(--heading-color); } .agent-status { font-size: 0.85rem; color: var(--blockquote-color); } /* Agents List */ .agents-list { display: flex; flex-direction: column; gap: 0.5rem; } .agent-item { padding: 0.75rem; background: white; border-radius: 6px; border: 1px solid var(--border-light); cursor: pointer; transition: all 0.2s; } .agent-item:hover { background: var(--user-msg-bg); border-color: var(--primary-blue); } .agent-item.active { background: var(--agent-msg-bg); border-color: var(--agent-border); } .agent-item-name { font-weight: bold; color: var(--heading-color); margin-bottom: 0.25rem; } .agent-item-desc { font-size: 0.8rem; color: var(--blockquote-color); } .loading-agents { text-align: center; color: var(--blockquote-color); font-style: italic; padding: 1rem; } /* Controls */ .controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; } .control-button { padding: 0.5rem; background: white; border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; font-size: 0.8rem; text-align: center; transition: all 0.2s; } .control-button:hover { background: var(--user-msg-bg); border-color: var(--primary-blue); } /* Statistics */ .stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; } .stat-item { text-align: center; padding: 1rem; background: white; border-radius: 6px; box-shadow: var(--shadow-light); } .stat-value { font-size: 1.5rem; font-weight: bold; color: var(--primary-blue); } .stat-label { font-size: 0.8rem; color: var(--blockquote-color); margin-top: 0.25rem; } /* Modal */ .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: none; justify-content: center; align-items: center; z-index: 1000; } .modal-overlay.show { display: flex; } .modal { background: white; border-radius: 8px; max-width: 600px; max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-medium); } .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; border-bottom: 1px solid var(--divider-color); } .modal-header h2 { color: var(--heading-color); margin: 0; } .modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--blockquote-color); padding: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; } .modal-content { padding: 1.5rem; } .modal-content h3 { color: var(--heading-color); margin: 1.5rem 0 1rem 0; } .modal-content h3:first-child { margin-top: 0; } .modal-content ul { margin-left: 1.5rem; margin-bottom: 1rem; } .modal-content li { margin-bottom: 0.5rem; } .modal-content code { background: var(--code-bg); padding: 0.2rem 0.4rem; border-radius: 3px; font-size: 0.9rem; } .modal-content kbd { background: var(--code-bg); border: 1px solid var(--border-color); border-radius: 3px; padding: 0.1rem 0.3rem; font-size: 0.85rem; font-family: monospace; } /* Console Logs Panel */ .console-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; } .console-toggle { background: none; border: none; color: var(--body-color); cursor: pointer; padding: 4px; border-radius: 4px; transition: background-color 0.2s, transform 0.2s; display: flex; align-items: center; justify-content: center; } .console-toggle:hover { background-color: var(--border-light); } .console-toggle.collapsed { transform: rotate(-90deg); } .console-content { background: white; border-radius: 8px; box-shadow: var(--shadow-light); margin-top: 1rem; overflow: hidden; transition: max-height 0.3s ease, opacity 0.3s ease; max-height: 300px; opacity: 1; } .console-content.collapsed { max-height: 0; opacity: 0; margin-top: 0; } .console-controls { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem; background-color: var(--markdown-bg); border-bottom: 1px solid var(--border-light); } .console-control-btn { background: white; border: 1px solid var(--border-color); border-radius: 4px; padding: 0.25rem 0.5rem; font-size: 0.75rem; cursor: pointer; transition: background-color 0.2s; } .console-control-btn:hover { background-color: var(--border-light); } .console-control-btn.active { background-color: var(--primary-blue); color: white; border-color: var(--primary-blue); } .console-status { margin-left: auto; } .console-count { font-size: 0.75rem; color: var(--blockquote-color); } .console-logs { max-height: 200px; overflow-y: auto; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 0.75rem; line-height: 1.4; } .console-log-entry { padding: 0.25rem 0.75rem; border-bottom: 1px solid var(--border-light); word-wrap: break-word; white-space: pre-wrap; } .console-log-entry:last-child { border-bottom: none; } .console-log-entry:hover { background-color: var(--border-light); } .console-welcome { padding: 0.5rem 0.75rem; color: var(--blockquote-color); font-style: italic; border-bottom: 1px solid var(--border-light); } .console-timestamp { color: var(--blockquote-color); margin-right: 0.5rem; } .console-source { color: var(--primary-blue); margin-right: 0.5rem; font-weight: 500; } .console-message { color: var(--body-color); } .console-log-entry.level-error .console-message { color: #dc3545; } .console-log-entry.level-warn .console-message { color: #ffc107; } .console-log-entry.level-info .console-message { color: var(--primary-blue); } .console-log-entry.level-debug .console-message { color: var(--blockquote-color); } /* Responsive Design */ @media (max-width: 768px) { .app-container { flex-direction: column; } .chat-sidebar { width: 100%; max-height: 40vh; border-left: none; border-top: 1px solid var(--border-color); } .messages-container { margin: 0 5%; } .chat-message { max-width: 95%; } .controls-grid { grid-template-columns: 1fr; } .stats-grid { grid-template-columns: 1fr; } } /* Scrollbar Styling */ ::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { background: var(--border-light); } ::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; } ::-webkit-scrollbar-thumb:hover { background: var(--blockquote-color); } /* Orchestration Styles */ /* Orchestration Panel */ .orchestration-status { padding: 10px; background: #e8f5e8; border-radius: 6px; margin-bottom: 15px; border: 1px solid #4CAF50; } .status-indicator { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; } .status-dot.orchestration { background: #4CAF50; animation: pulse 2s infinite; } @keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } } /* Plans Container */ .plans-container { margin-top: 15px; } .plans-container h4 { font-size: 13px; color: var(--heading-color); margin-bottom: 8px; font-weight: 600; } .plans-list { max-height: 200px; overflow-y: auto; border: 1px solid var(--border-light); border-radius: 6px; background: white; } .no-plans { padding: 15px; text-align: center; color: var(--blockquote-color); font-size: 12px; font-style: italic; } .plan-item { padding: 10px; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background-color 0.2s ease; font-size: 12px; } .plan-item:last-child { border-bottom: none; } .plan-item:hover { background: #f8f9fa; } .plan-item.selected { background: #e3f2fd; border-left: 3px solid var(--primary-blue); } .plan-item.executing { background: #fff8e1; border-left: 3px solid #ff9800; } .plan-item.completed { background: #e8f5e8; border-left: 3px solid #4CAF50; } .plan-item.paused { background: #fff3e0; border-left: 3px solid #ff5722; } .plan-id { font-family: 'Monaco', 'Menlo', monospace; font-weight: 600; color: var(--primary-blue); margin-bottom: 4px; } .plan-intent { color: var(--body-color); margin-bottom: 4px; line-height: 1.3; } .plan-status { display: inline-block; padding: 2px 6px; border-radius: 10px; font-size: 10px; font-weight: 600; text-transform: uppercase; margin-right: 8px; } .plan-status { background: #e0e0e0; color: #666; } .plan-item.executing .plan-status { background: #fff8e1; color: #ff8f00; } .plan-item.completed .plan-status { background: #e8f5e8; color: #2e7d32; } .plan-item.paused .plan-status { background: #fff3e0; color: #e64a19; } .plan-progress { display: inline-block; font-size: 10px; color: var(--blockquote-color); font-weight: 500; } /* Plan Controls */ .plan-controls { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; } .plan-controls .control-button { flex: 1; min-width: 60px; font-size: 11px; padding: 6px 8px; } .pause-plan { background: #ff5722; color: white; } .pause-plan:hover { background: #e64a19; } .resume-plan { background: #4CAF50; color: white; } .resume-plan:hover { background: #45a049; } .interrupt-plan { background: #ff9800; color: white; } .interrupt-plan:hover { background: #f57c00; } /* Streaming Message Styles */ .chat-message.streaming { opacity: 0.9; } .streaming-cursor { color: var(--primary-blue); animation: blink 1s infinite; font-weight: bold; margin-left: 2px; } @keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } } /* System Message Enhancements */ .chat-message.system.warning { background: #fff3cd; border-left: 4px solid #ffeb3b; } .chat-message.system.error { background: #f8d7da; border-left: 4px solid #dc3545; } .chat-message.system.info { background: #d1ecf1; border-left: 4px solid #17a2b8; } .chat-message.system.success { background: #d4edda; border-left: 4px solid #28a745; } /* Responsive Orchestration Panel */ @media (max-width: 768px) { .orchestration-panel { order: -1; margin-bottom: 20px; } .plans-list { max-height: 150px; } .plan-controls { justify-content: center; } .plan-controls .control-button { flex: none; min-width: 80px; } }