1. Emergency Kill Button (🛑 KILL)
- Location: Terminal header controls
- Function: Immediately terminates ALL running processes in the terminal session
- Safety: Requires confirmation modal before execution
- Implementation: Sends multiple SIGKILL signals and clears process tracking
2. Interrupt Button (⚡ INT)
- Location: Terminal header controls
- Function: Sends Ctrl+C (SIGINT) to interrupt current process
- Usage: Quick way to stop the currently running process
- Implementation: Sends
\u0003character to terminal
3. Command Risk Assessment
- Automatic Analysis: Every command is analyzed for potential danger
- Risk Levels:
- Low: Safe commands (ls, cd, cat, etc.)
- Moderate: System operations requiring privileges (sudo apt install)
- High: Dangerous operations (rm -rf, chmod 777 on root)
- Critical: System-destroying commands (rm -rf /, dd to disk, mkfs)
4. Command Confirmation Modal
- Triggers: High and critical risk commands
- Features:
- Shows exact command to be executed
- Displays risk level with color coding
- Lists specific risks and reasons
- Requires explicit user confirmation
- Cancel option clears the command
5. Process Tracking
- Active Process Monitoring: Tracks running processes
- Background Process Detection: Identifies long-running tasks
- State Management: Updates UI based on process status
New Reactive State:
const showCommandConfirmation = ref(false);
const showKillConfirmation = ref(false);
const pendingCommand = ref('');
const pendingCommandRisk = ref('low');
const pendingCommandReasons = ref([]);
const runningProcesses = ref([]);
const hasActiveProcess = ref(false);Enhanced Command Flow:
- User types command →
sendCommand() - Command analyzed →
assessCommandRisk() - If high/critical risk → Show confirmation modal
- If confirmed →
executeConfirmedCommand() - Track process →
addRunningProcess()
Risk Assessment Patterns:
// Critical (System Destruction)
/rm\s+-rf\s+\/($|\s)/ // rm -rf /
/dd\s+if=.*of=\/dev\/[sh]d/ // dd to disk
/mkfs\./ // format filesystem
// High Risk (Data Loss)
/rm\s+-rf/ // recursive force delete
/sudo\s+rm/ // sudo rm
/killall\s+-9/ // kill all processes
// Moderate Risk (System Changes)
/sudo\s+(apt|yum|dnf).*install/ // package installation
/sudo\s+systemctl/ // system service controlEmergency Kill:
const confirmEmergencyKill = async () => {
// Send multiple Ctrl+C
await sendInput(sessionId.value, '\u0003\u0003\u0003');
// Force kill tracked processes
for (const process of runningProcesses.value) {
await sendSignal(sessionId.value, 'SIGKILL', process.pid);
}
// Clear tracking and notify user
runningProcesses.value = [];
hasActiveProcess.value = false;
};Process Interrupt:
const interruptProcess = () => {
sendInput(sessionId.value, '\u0003'); // Ctrl+C
addOutputLine({
content: '^C (Process interrupted by user)',
type: 'system_message'
});
};Emergency Kill Button:
- Color: Red (#dc3545) with warning styling
- Animation: Hover effects and shadow on interaction
- Disabled State: When no processes are running
- Tooltip: Clear explanation of function
Command Risk Display:
- Color Coding:
- Low: Green border and background
- Moderate: Yellow/orange styling
- High: Red styling with warning icons
- Critical: Pulsing red animation
- Typography: Monospace font for command display
- Layout: Clear command preview with risk breakdown
Confirmation Modals:
- Backdrop: Blurred overlay for focus
- Design: Dark theme with gradient headers
- Emergency Styling: Red accents for critical operations
- Responsive: Mobile-friendly layout
Modal Actions:
<div class="modal-actions">
<button class="btn btn-danger" @click="executeConfirmedCommand">
⚡ Execute Command
</button>
<button class="btn btn-secondary" @click="cancelCommand">
❌ Cancel
</button>
</div>Process List Display:
<ul>
<li v-for="process in runningProcesses" :key="process.pid">
PID {{ process.pid }}: {{ process.command }}
</li>
</ul>- Tab Structure: Terminal safety features work within chat session tabs
- Session Isolation: Each chat session has its own terminal with independent safety controls
- Context Preservation: Safety settings and process tracking per session
- WebSocket Integration: All safety features work through existing terminal WebSocket
- Security Layer: Compatible with existing secure command execution
- RBAC Support: Works with role-based access control system
- User types safe command (e.g.,
ls -la) - Command executes immediately
- Output displayed in terminal
- Process tracking updated if needed
- User types dangerous command (e.g.,
sudo rm -rf /home/important) - Risk assessment triggers → HIGH RISK
- Confirmation modal appears with:
- Command preview
- Risk level (HIGH)
- Specific warnings
- Confirmation buttons
- User must explicitly confirm or cancel
- If confirmed, command executes with logging
- If cancelled, command is discarded
- User notices runaway process or dangerous operation
- Click 🛑 KILL button for emergency stop
- Confirmation modal shows all running processes
- User confirms emergency kill
- All processes terminated immediately
- Terminal shows emergency kill notification
Human-in-the-Loop Control:
- Prevents accidental destructive commands
- Provides clear information before dangerous operations
- Allows informed decision-making
Process Management:
- Emergency stop capability for runaway processes
- Clear visibility into what's running
- Graceful and forceful termination options
Risk Awareness:
- Educational component showing why commands are dangerous
- Builds user security awareness
- Prevents common security mistakes
Files Modified:
/autobot-frontend/src/components/TerminalWindow.vue- Complete safety implementation/autobot-frontend/src/components/ChatInterface.vue- Terminal tab integration
Features Delivered:
- ✅ Emergency kill button with confirmation
- ✅ Process interrupt (Ctrl+C) button
- ✅ Comprehensive command risk assessment
- ✅ Modal confirmations for dangerous commands
- ✅ Visual risk indicators and styling
- ✅ Process tracking and management
- ✅ Integration with chat session tabs
TypeScript Compatibility: ✅ All code passes type checking Code Quality: Implementation follows Vue 3 composition API best practices User Experience: Intuitive, safe, and informative interface
This implementation transforms AutoBot's terminal from a basic command interface into a safety-conscious, user-friendly terminal environment that protects users from dangerous operations while maintaining full functionality for legitimate use cases.