import React, { useState, useCallback } 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} 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) * @param {boolean} minimal - Use minimal mode: no header, no overlays, auto-connect (default: false) */ function StandaloneShell({ project, session = null, command = null, isPlainShell = null, autoConnect = true, onComplete = null, onClose = null, title = null, className = "", showHeader = true, compact = false, minimal = false }) { const [isCompleted, setIsCompleted] = useState(false); const shouldUsePlainShell = isPlainShell !== null ? isPlainShell : (command !== null); const handleProcessComplete = useCallback((exitCode) => { setIsCompleted(true); if (onComplete) { onComplete(exitCode); } }, [onComplete]); if (!project) { return (
A project is required to open a shell