Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: add finish sentinel action to active agent cards
[._.]/ Adam Eivy2a28fe24ada5
diff --git a/client/src/components/cos/tabs/AgentCard.jsx b/client/src/components/cos/tabs/AgentCard.jsxindex 92524fabd4..a0fcc196b8 100644--- a/client/src/components/cos/tabs/AgentCard.jsx+++ b/client/src/components/cos/tabs/AgentCard.jsx@@ -44,6 +44,7 @@ import { useConfirmDelete } from '../../../hooks/useConfirmDelete';const RE_NUMBERED_LIST = /([.!?:]) (\d+)\. /g;const RE_DASH_LIST = /([.!?:]) - /g;const RE_SECTION_LABELS = / (Expected output|Steps|Success criteria|Actionable focus|Focus|Suggestions?|Notes?|Context|Requirements?|Constraints?|Result|Output|Summary|Details)([: ])/gi;+const FINISH_SENTINEL_MESSAGE = 'Finish work and write sentinel.';// Normalize raw task description text into markdown for readable rendering.// Descriptions often arrive as a single long line with embedded numbered lists,@@ -190,12 +191,12 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,copyToClipboard(promptContent, 'Prompt copied to clipboard');}, [promptContent]);- // Send BTW message to running agent- const sendBtw = useCallback(async () => {- if (sendingBtw || !btwInput.trim()) return;+ // Send a message to the running agent+ const sendBtw = useCallback(async (message = btwInput.trim(), label = 'BTW message') => {+ if (sendingBtw || !message) return;setSendingBtw(true);- const result = await api.sendCosAgentBtw(agent.id, btwInput.trim(), { silent: true }).catch(err => {+ const result = await api.sendCosAgentBtw(agent.id, message, { silent: true }).catch(err => {toast.error(`Failed to send: ${err.message}`);return null;});@@ -203,9 +204,9 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,setSendingBtw(false);if (result?.success) {- setBtwMessages(prev => [...prev, { message: btwInput.trim(), timestamp: new Date().toISOString() }]);- setBtwInput('');- toast.success('BTW message sent to agent');+ setBtwMessages(prev => [...prev, { message, timestamp: new Date().toISOString() }]);+ if (message === btwInput.trim()) setBtwInput('');+ toast.success(`${label} sent to agent`);}}, [agent.id, btwInput, sendingBtw]);@@ -751,7 +752,7 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,disabled={sendingBtw}/><button- onClick={sendBtw}+ onClick={() => sendBtw()}disabled={sendingBtw || !btwInput.trim()}className="flex items-center gap-1.5 px-3 py-1 text-xs bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/30 rounded transition-colors disabled:opacity-50 min-h-[32px]"title="Send BTW message to agent (pastes into the live Claude Code TUI session)"@@ -759,6 +760,16 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,{sendingBtw ? <Loader2 size={12} className="animate-spin" aria-hidden="true" /> : <Send size={12} aria-hidden="true" />}BTW</button>+ <button+ onClick={() => sendBtw(FINISH_SENTINEL_MESSAGE, 'Finish message')}+ disabled={sendingBtw}+ className="flex items-center gap-1.5 px-3 py-1 text-xs bg-port-accent/20 text-port-accent hover:bg-port-accent/30 rounded transition-colors disabled:opacity-50 min-h-[32px]"+ title="Tell the agent to finish work and write the sentinel"+ aria-label="Finish work and write sentinel"+ >+ {sendingBtw ? <Loader2 size={12} className="animate-spin" aria-hidden="true" /> : <CheckCircle size={12} aria-hidden="true" />}+ Finish+ </button></div>)}diff --git a/client/src/components/cos/tabs/AgentCard.test.jsx b/client/src/components/cos/tabs/AgentCard.test.jsxindex 68df107d27..b7a0bb282d 100644--- a/client/src/components/cos/tabs/AgentCard.test.jsx+++ b/client/src/components/cos/tabs/AgentCard.test.jsx@@ -6,6 +6,7 @@ import { typeSettled } from '../../../test/settledInput';vi.mock('../../../services/api', () => ({submitCosAgentFeedback: vi.fn(),+ sendCosAgentBtw: vi.fn(),getCosAgent: vi.fn(),getCosAgentPrompt: vi.fn(),}));@@ -168,6 +169,43 @@ describe('AgentCard feedback', () => {});});+describe('AgentCard finish action', () => {+ it('sends the finish-and-sentinel message from an active Claude TUI card', async () => {+ const user = userEvent.setup();+ const runningAgent = {+ ...agent,+ status: 'running',+ completedAt: null,+ metadata: { ...agent.metadata, executionMode: 'tui', tuiKind: 'claude' },+ };+ api.sendCosAgentBtw.mockResolvedValue({ success: true });++ render(+ <MemoryRouter>+ <AgentCard agent={runningAgent} />+ </MemoryRouter>+ );++ await user.click(screen.getByRole('button', { name: 'Finish work and write sentinel' }));++ expect(api.sendCosAgentBtw).toHaveBeenCalledWith(+ runningAgent.id,+ 'Finish work and write sentinel.',+ { silent: true }+ );+ });++ it('does not show the finish action for inactive cards', () => {+ render(+ <MemoryRouter>+ <AgentCard agent={agent} completed />+ </MemoryRouter>+ );++ expect(screen.queryByRole('button', { name: 'Finish work and write sentinel' })).not.toBeInTheDocument();+ });+});+describe('AgentCard agent ID', () => {it.each([['active', { ...agent, status: 'running', completedAt: null }],