diff --git a/src/components/skills/SkillManagementPanel.tsx b/src/components/skills/SkillManagementPanel.tsx index 664ce0017..70dedadf2 100644 --- a/src/components/skills/SkillManagementPanel.tsx +++ b/src/components/skills/SkillManagementPanel.tsx @@ -145,50 +145,59 @@ export default function SkillManagementPanel({ )} - {/* Action buttons — single row */} -
- {!confirmDisconnect ? ( -
- - {onReconfigure && ( + {/* Action buttons — only show if skill is actually running */} + {connectionStatus !== "offline" && connectionStatus !== "setup_required" ? ( +
+ {!confirmDisconnect ? ( +
- )} - + {onReconfigure && ( + + )} + +
+ ) : ( +
+ + +
+ )} +
+ ) : ( + // Show message for offline skills +
+
+ Skill is offline. Use "Re-run Setup" to reconnect.
- ) : ( -
- - -
- )} -
+
+ )}
); } diff --git a/src/components/skills/SkillSetupModal.tsx b/src/components/skills/SkillSetupModal.tsx index 4233773c5..bf3e7ced2 100644 --- a/src/components/skills/SkillSetupModal.tsx +++ b/src/components/skills/SkillSetupModal.tsx @@ -7,6 +7,7 @@ import { useState, useEffect, useRef } from "react"; import { createPortal } from "react-dom"; import { useAppSelector } from "../../store/hooks"; +import { useSkillConnectionStatus } from "../../lib/skills/hooks"; import SkillSetupWizard from "./SkillSetupWizard"; import SkillManagementPanel from "./SkillManagementPanel"; @@ -27,13 +28,20 @@ export default function SkillSetupModal({ onClose, }: SkillSetupModalProps) { const modalRef = useRef(null); - const setupComplete = useAppSelector( - (state) => state.skills.skills[skillId]?.setupComplete, - ); - // Skills without setup hooks always go straight to manage mode. - const [mode, setMode] = useState<"manage" | "setup">( - !hasSetup || setupComplete ? "manage" : "setup", - ); + const skill = useAppSelector((state) => state.skills.skills[skillId]); + const connectionStatus = useSkillConnectionStatus(skillId); + + // Simplified mode logic: Only show manage mode when skill is actually working + // Everything else (offline, errors, never connected, etc.) goes to setup mode + const [mode, setMode] = useState<"manage" | "setup">(() => { + // Only show manage mode when the skill is actually working + const isWorking = connectionStatus === "connected" || connectionStatus === "connecting"; + + // For skills without setup hooks, still need to check if they're working + // Show manage mode only if skill is currently working + // Everything else goes to setup mode (first-time setup, errors, offline, disconnected) + return isWorking ? "manage" : "setup"; + }); // Handle escape key useEffect(() => { @@ -137,7 +145,7 @@ export default function SkillSetupModal({ setMode("manage") : onClose} + onCancel={skill?.setupComplete ? () => setMode("manage") : onClose} /> )}