From 696f03e86703427126265f955a8e23321e43253d Mon Sep 17 00:00:00 2001 From: Gabriel Brown Date: Sat, 11 Jul 2026 13:36:54 -0400 Subject: [PATCH] fix(web): /machine terminal visible prop, stop/restart confirmation, accurate waiting label --- .../components/machine/box-status-card.tsx | 110 +++++++++++++----- .../src/components/machine/machine-shell.tsx | 10 +- .../tests/component/machine-shell.test.tsx | 81 +++++++++++++ 3 files changed, 172 insertions(+), 29 deletions(-) diff --git a/apps/next/src/components/machine/box-status-card.tsx b/apps/next/src/components/machine/box-status-card.tsx index ba393a2..e659fcd 100644 --- a/apps/next/src/components/machine/box-status-card.tsx +++ b/apps/next/src/components/machine/box-status-card.tsx @@ -1,8 +1,18 @@ 'use client'; +import type { ReactNode } from 'react'; import { Loader2, Play, RotateCw, Server, Square } from 'lucide-react'; import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, Badge, Button, Card, @@ -50,6 +60,48 @@ const Detail = ({ label, value }: { label: string; value: string }) => ( ); +// Stopping or restarting the box tears down the SAME per-user container that a +// running agent thread job executes in, so both actions are destructive and get +// a confirmation step. Start is safe and stays a plain button. +const ConfirmLifecycleButton = ({ + icon, + label, + busy, + title, + description, + confirmLabel, + onConfirm, +}: { + icon: ReactNode; + label: string; + busy: boolean; + title: string; + description: string; + confirmLabel: string; + onConfirm: () => void; +}) => ( + + + + + + + {title} + {description} + + + Cancel + + {confirmLabel} + + + + +); + export const BoxStatusCard = ({ status, pendingAction, @@ -96,34 +148,36 @@ export const BoxStatusCard = ({
{running ? ( <> - - + + ) : ( + + ) + } + title='Stop this machine?' + description='Stopping the machine shuts down the container it runs in. Any agent thread job currently running in this machine will be interrupted and lose its in-progress work.' + confirmLabel='Stop machine' + onConfirm={() => onAction('stop')} + /> + + ) : ( + + ) + } + title='Restart this machine?' + description='Restarting the machine recreates the container it runs in. Any agent thread job currently running in this machine will be interrupted and lose its in-progress work.' + confirmLabel='Restart machine' + onConfirm={() => onAction('restart')} + /> ) : (