diff options
Diffstat (limited to 'makima/frontend/src')
| -rw-r--r-- | makima/frontend/src/components/contracts/CommandModePanel.tsx (renamed from makima/frontend/src/components/contracts/AutopilotPanel.tsx) | 63 | ||||
| -rw-r--r-- | makima/frontend/src/components/contracts/ContractDetail.tsx | 6 |
2 files changed, 44 insertions, 25 deletions
diff --git a/makima/frontend/src/components/contracts/AutopilotPanel.tsx b/makima/frontend/src/components/contracts/CommandModePanel.tsx index 1a13773..832d5ec 100644 --- a/makima/frontend/src/components/contracts/AutopilotPanel.tsx +++ b/makima/frontend/src/components/contracts/CommandModePanel.tsx @@ -1,4 +1,5 @@ import { useState, useCallback } from "react"; +import { useNavigate } from "react-router"; import type { ContractWithRelations } from "../../lib/api"; import { getSupervisorStatus, @@ -9,7 +10,7 @@ import { type SupervisorStatus, } from "../../lib/api"; -interface AutopilotPanelProps { +interface CommandModePanelProps { contract: ContractWithRelations; onUpdate: () => void; } @@ -55,11 +56,18 @@ const statusConfig: Record< }, }; -export function AutopilotPanel({ contract, onUpdate }: AutopilotPanelProps) { +export function CommandModePanel({ contract, onUpdate }: CommandModePanelProps) { + const navigate = useNavigate(); const [loading, setLoading] = useState(false); const [error, setError] = useState<string | null>(null); const supervisorStatus = getSupervisorStatus(contract); + + const handleGoToSupervisor = useCallback(() => { + if (supervisorStatus.supervisorTaskId) { + navigate(`/mesh/${supervisorStatus.supervisorTaskId}`); + } + }, [supervisorStatus.supervisorTaskId, navigate]); const config = statusConfig[supervisorStatus.status]; const handleStart = useCallback(async () => { @@ -72,7 +80,7 @@ export function AutopilotPanel({ contract, onUpdate }: AutopilotPanelProps) { await startSupervisor(supervisorStatus.supervisorTaskId); onUpdate(); } catch (e) { - setError(e instanceof Error ? e.message : "Failed to start autopilot"); + setError(e instanceof Error ? e.message : "Failed to start command mode"); } finally { setLoading(false); } @@ -88,7 +96,7 @@ export function AutopilotPanel({ contract, onUpdate }: AutopilotPanelProps) { await stopSupervisor(supervisorStatus.supervisorTaskId); onUpdate(); } catch (e) { - setError(e instanceof Error ? e.message : "Failed to stop autopilot"); + setError(e instanceof Error ? e.message : "Failed to stop command mode"); } finally { setLoading(false); } @@ -106,7 +114,7 @@ export function AutopilotPanel({ contract, onUpdate }: AutopilotPanelProps) { } onUpdate(); } catch (e) { - setError(e instanceof Error ? e.message : "Failed to resume autopilot"); + setError(e instanceof Error ? e.message : "Failed to resume command mode"); } finally { setLoading(false); } @@ -133,30 +141,41 @@ export function AutopilotPanel({ contract, onUpdate }: AutopilotPanelProps) { <div className="space-y-3"> <div className="flex items-center justify-between"> <h3 className="font-mono text-xs text-[#75aafc] uppercase"> - Autopilot Mode + Command Mode </h3> - <div - className={`px-2 py-1 rounded font-mono text-xs ${config.color} ${config.bgColor}`} - > - {config.label} + <div className="flex items-center gap-2"> + {supervisorStatus.supervisorTaskId && ( + <button + onClick={handleGoToSupervisor} + className="px-2 py-1 font-mono text-xs text-[#9bc3ff] hover:text-[#dbe7ff] hover:bg-[rgba(117,170,252,0.1)] transition-colors flex items-center gap-1" + > + <span className="text-[#75aafc]">▶</span> + Supervisor + </button> + )} + <div + className={`px-2 py-1 rounded font-mono text-xs ${config.color} ${config.bgColor}`} + > + {config.label} + </div> </div> </div> <p className="font-mono text-xs text-[#555]"> {supervisorStatus.status === "not_configured" ? ( - "This contract does not have an autopilot supervisor configured." + "This contract does not have a Command Mode supervisor configured." ) : supervisorStatus.status === "running" ? ( - "Autopilot is actively working on this contract, spawning tasks and managing progress." + "Command Mode is actively working on this contract, spawning tasks and managing progress." ) : supervisorStatus.status === "pending" ? ( - "Autopilot is ready to start. Click 'Enable' to begin autonomous work." + "Command Mode is ready to start. Click 'Enable' to begin autonomous work." ) : supervisorStatus.status === "paused" ? ( - "Autopilot is paused. Click 'Resume' to continue work." + "Command Mode is paused. Click 'Resume' to continue work." ) : supervisorStatus.status === "failed" ? ( - "Autopilot encountered an error. You can resume to retry." + "Command Mode encountered an error. You can resume to retry." ) : supervisorStatus.status === "done" ? ( - "Autopilot has completed its work on this contract." + "Command Mode has completed its work on this contract." ) : ( - "Autopilot is initializing..." + "Command Mode is initializing..." )} </p> @@ -173,7 +192,7 @@ export function AutopilotPanel({ contract, onUpdate }: AutopilotPanelProps) { disabled={loading} className="px-4 py-2 font-mono text-xs text-[#dbe7ff] bg-green-600/20 border border-green-400/50 hover:bg-green-600/30 transition-colors disabled:opacity-50 disabled:cursor-not-allowed" > - {loading ? "Starting..." : "Enable Autopilot"} + {loading ? "Starting..." : "Enable Command Mode"} </button> )} @@ -183,7 +202,7 @@ export function AutopilotPanel({ contract, onUpdate }: AutopilotPanelProps) { disabled={loading} className="px-4 py-2 font-mono text-xs text-[#dbe7ff] bg-blue-600/20 border border-blue-400/50 hover:bg-blue-600/30 transition-colors disabled:opacity-50 disabled:cursor-not-allowed" > - {loading ? "Resuming..." : "Resume Autopilot"} + {loading ? "Resuming..." : "Resume Command Mode"} </button> )} @@ -193,7 +212,7 @@ export function AutopilotPanel({ contract, onUpdate }: AutopilotPanelProps) { disabled={loading} className="px-4 py-2 font-mono text-xs text-[#dbe7ff] bg-orange-600/20 border border-orange-400/50 hover:bg-orange-600/30 transition-colors disabled:opacity-50 disabled:cursor-not-allowed" > - {loading ? "Stopping..." : "Pause Autopilot"} + {loading ? "Stopping..." : "Pause Command Mode"} </button> )} </div> @@ -235,7 +254,7 @@ export function AutopilotPanel({ contract, onUpdate }: AutopilotPanelProps) { <div className="flex items-center gap-2 pt-2 border-t border-dashed border-[rgba(117,170,252,0.2)]"> <div className="w-2 h-2 rounded-full bg-green-400 animate-pulse" /> <span className="font-mono text-xs text-green-400"> - Autopilot is actively working + Command Mode is actively working </span> </div> )} @@ -244,7 +263,7 @@ export function AutopilotPanel({ contract, onUpdate }: AutopilotPanelProps) { <div className="flex items-center gap-2 pt-2 border-t border-dashed border-[rgba(117,170,252,0.2)]"> <div className="w-2 h-2 rounded-full bg-blue-400 animate-pulse" /> <span className="font-mono text-xs text-blue-400"> - Initializing autopilot... + Initializing command mode... </span> </div> )} diff --git a/makima/frontend/src/components/contracts/ContractDetail.tsx b/makima/frontend/src/components/contracts/ContractDetail.tsx index 6e31c84..e5e65f6 100644 --- a/makima/frontend/src/components/contracts/ContractDetail.tsx +++ b/makima/frontend/src/components/contracts/ContractDetail.tsx @@ -18,7 +18,7 @@ import { PhaseHint } from "./PhaseHint"; import { RepositoryPanel } from "./RepositoryPanel"; import { ContractCliInput } from "./ContractCliInput"; import { PhaseDeliverablesPanel } from "./PhaseDeliverablesPanel"; -import { AutopilotPanel } from "./AutopilotPanel"; +import { CommandModePanel } from "./CommandModePanel"; import { TaskTree } from "../mesh/TaskTree"; type Tab = "overview" | "repos" | "files" | "tasks"; @@ -294,8 +294,8 @@ function OverviewTab({ }) { return ( <div className="space-y-6"> - {/* Autopilot controls */} - <AutopilotPanel contract={contract} onUpdate={onRefresh} /> + {/* Command Mode controls */} + <CommandModePanel contract={contract} onUpdate={onRefresh} /> {/* Phase deliverables checklist */} <PhaseDeliverablesPanel |
