diff --git a/apps/epiphany-gui/src/App.tsx b/apps/epiphany-gui/src/App.tsx index 23e27cb7..0a1e5c5d 100644 --- a/apps/epiphany-gui/src/App.tsx +++ b/apps/epiphany-gui/src/App.tsx @@ -157,6 +157,12 @@ type ProjectedAgent = ConstellationSpec & { jobs: number; review: string; }; +type AquariumOption = { + label: string; + deck?: DeckId; + subdeck?: string; + action?: OperatorAction; +}; const deckSubmenus = { command: ["run", "connection", "signals"], state: ["environment", "planning", "graph"], @@ -170,6 +176,46 @@ const deckLabels: Record = { artifacts: "Artifacts", }; type DeckId = keyof typeof deckSubmenus; +const aquariumOptionsByAgent: Record = { + coordinator: [ + { label: "Signals", deck: "command", subdeck: "signals" }, + { label: "Run", deck: "command", subdeck: "run" }, + { label: "Checkpoint", action: "prepareCheckpoint" }, + ], + imagination: [ + { label: "Planning", deck: "state", subdeck: "planning" }, + { label: "Launch", action: "launchImagination" }, + { label: "Read", action: "readImaginationResult" }, + { label: "Accept", action: "acceptImagination" }, + ], + research: [ + { label: "State", deck: "state", subdeck: "graph" }, + { label: "Artifacts", deck: "artifacts", subdeck: "bundles" }, + ], + modeling: [ + { label: "Graph", deck: "state", subdeck: "graph" }, + { label: "Launch", action: "launchModeling" }, + { label: "Read", action: "readModelingResult" }, + { label: "Accept", action: "acceptModeling" }, + ], + implementation: [ + { label: "Run", deck: "command", subdeck: "run" }, + { label: "Continue", action: "continueImplementation" }, + { label: "Artifacts", deck: "artifacts", subdeck: "bundles" }, + ], + verification: [ + { label: "Findings", deck: "agents", subdeck: "findings" }, + { label: "Launch", action: "launchVerification" }, + { label: "Read", action: "readVerificationResult" }, + { label: "Accept", action: "acceptVerification" }, + ], + reorientation: [ + { label: "Continuity", deck: "command", subdeck: "signals" }, + { label: "Launch", action: "launchReorient" }, + { label: "Read", action: "readReorientResult" }, + { label: "Accept", action: "acceptReorient" }, + ], +}; const actionButtons: Array<{ action: OperatorAction; label: string; @@ -615,6 +661,35 @@ export function App() { setSubdeckByDeck((current) => ({ ...current, [deck]: subdeck })); } + function actionBlocked(action: OperatorAction) { + const button = actionButtons.find((item) => item.action === action); + if (!button) return true; + return Boolean( + runningAction !== null || + (button.requiresThread && !currentThreadId) || + (button.requiresReadyState && !readyState) || + (button.requiresImaginationPatch && !canAcceptImagination) || + (button.requiresModelingPatch && !canAcceptModeling) || + (button.requiresVerificationResult && !canAcceptVerification) || + (button.requiresReorientResult && !canAcceptReorient) || + (button.requiresPlanningDraft && !canAdoptDraft) || + (button.requiresContinueImplementation && !canContinueImplementation) || + (button.requiresContinueImplementation && implementationNoDiffPending), + ); + } + + function handleAquariumOption(option: AquariumOption) { + if (option.deck) { + selectDeck(option.deck); + if (option.subdeck) { + selectSubdeck(option.deck, option.subdeck); + } + } + if (option.action && !actionBlocked(option.action)) { + void runAction(option.action); + } + } + const actionControls = actionButtons.map((button) => { const needsThread = button.requiresThread && !currentThreadId; const needsState = button.requiresReadyState && !readyState; @@ -695,6 +770,10 @@ export function App() { reorient={reorient} jobs={jobs} variant="fullscreen" + activeDeck={activeDeck} + activeSubdeck={activeSubdeck} + onAgentOption={handleAquariumOption} + isActionBlocked={actionBlocked} /> )} -
-