import React, { useState, useEffect } from 'react'; import Shell from './Shell.jsx'; /** * Generic Shell wrapper that can be used in tabs, modals, and other contexts. * Provides a flexible API for both standalone and session-based usage. * * @param {Object} project - Project object with name, fullPath/path, displayName * @param {Object} session - Session object (optional, for tab usage) * @param {string} command - Initial command to run (optional) * @param {boolean} isActive - Whether the shell is active (for tab usage, default: true) * @param {boolean} isPlainShell - Use plain shell mode vs Claude CLI (default: auto-detect) * @param {boolean} autoConnect - Whether to auto-connect when mounted (default: true) * @param {function} onComplete - Callback when process completes (receives exitCode) * @param {function} onClose - Callback for close button (optional) * @param {string} title - Custom header title (optional) * @param {string} className - Additional CSS classes * @param {boolean} showHeader - Whether to show custom header (default: true) * @param {boolean} compact - Use compact layout (default: false) */ function StandaloneShell({ project, session = null, command = null, isActive = true, isPlainShell = null, // Auto-detect: true if command provided, false if session provided autoConnect = true, onComplete = null, onClose = null, title = null, className = "", showHeader = true, compact = false }) { const [isCompleted, setIsCompleted] = useState(false); // Auto-detect isPlainShell based on props const shouldUsePlainShell = isPlainShell !== null ? isPlainShell : (command !== null); // Handle process completion const handleProcessComplete = (exitCode) => { setIsCompleted(true); if (onComplete) { onComplete(exitCode); } }; if (!project) { return (

No Project Selected

A project is required to open a shell

); } return (
{/* Optional custom header */} {showHeader && title && (

{title}

{isCompleted && ( (Completed) )}
{onClose && ( )}
)} {/* Shell component wrapper */}
); } export default StandaloneShell;