an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
fix(queue): 'send now' escape hatch while floor auto-delivery is paused
Chaitanya Giridca22679a9bd
diff --git a/src/renderer/src/components/MessageQueueComposer.tsx b/src/renderer/src/components/MessageQueueComposer.tsxindex 0a8398dd..826d9ab6 100644--- a/src/renderer/src/components/MessageQueueComposer.tsx+++ b/src/renderer/src/components/MessageQueueComposer.tsx@@ -30,6 +30,7 @@ export function MessageQueueComposer({ agent }: MessageQueueComposerProps) {const queue = useStore((s) => s.messageQueues[agent.id]) ?? EMPTY_QUEUE;const enqueueMessage = useStore((s) => s.enqueueMessage);const removeQueuedMessage = useStore((s) => s.removeQueuedMessage);+ const releaseQueuedMessage = useStore((s) => s.releaseQueuedMessage);const clearQueue = useStore((s) => s.clearQueue);// Draft lives in the store, keyed by agent — switching agents remounts this@@ -151,10 +152,17 @@ export function MessageQueueComposer({ agent }: MessageQueueComposerProps) {// the hint claimed it was sending while nothing moved — so poll it and say so.const block = useTerminalBlock(agent.ptyId, queue.length > 0 && idle);+ // Floor-wide auto-delivery pause (Command Center switch) also holds the queue.+ // Without saying so — and without the per-row "send now" override — messages+ // look permanently stuck with no explanation and no escape hatch.+ const deliveryPaused = useDeliveryPaused(agent.id, queue.length > 0);+const statusHint = queue.length === 0? null: !idle? `${agent.name} is busy — ${queue.length} queued`+ : deliveryPaused && !queue[0]?.manual+ ? 'held — auto-delivery is paused floor-wide (resume it in the Command Center, or "send now" a message below)': block === 'draft'? `held — ${agent.name}'s terminal has unsent text on its prompt`: block === 'picker'@@ -259,6 +267,8 @@ export function MessageQueueComposer({ agent }: MessageQueueComposerProps) {key={m.id}index={i}message={m}+ paused={deliveryPaused}+ onSendNow={() => releaseQueuedMessage(agent.id, m.id)}onRemove={() => removeQueuedMessage(agent.id, m.id)}/>))}@@ -379,13 +389,40 @@ function useTerminalBlock(ptyId: string | undefined, active: boolean): TerminalAreturn block === 'settling' ? null : block;}+/** Poll the floor-wide auto-delivery pause (main-process control state) while+ * this agent has messages waiting. 2s is plenty — the pause flips on human+ * timescales, and the drain re-reads the live snapshot before every send. */+function useDeliveryPaused(agentId: string, active: boolean): boolean {+ const [paused, setPaused] = useState(false);+ useEffect(() => {+ if (!active) { setPaused(false); return; }+ let alive = true;+ const read = () => {+ window.cth.controlSnapshot(agentId)+ .then((s) => { if (alive) setPaused(!!s?.autoDeliveryPaused); })+ .catch(() => { /* main not ready — assume not paused */ });+ };+ read();+ const iv = setInterval(read, 2000);+ return () => { alive = false; clearInterval(iv); };+ }, [agentId, active]);+ return paused;+}+/*** One pending queue row. Collapsed it clamps to 2 lines; "see more" expands it* in place so a long message can be read without hovering for the tooltip. The* toggle only renders when the text actually clips, so short messages stay tidy.*/function QueuedMessageRow(- { index, message, onRemove }: { index: number; message: QueuedMessage; onRemove: () => void }+ { index, message, paused, onSendNow, onRemove }: {+ index: number;+ message: QueuedMessage;+ /** Floor-wide auto-delivery is paused — offer the per-message override. */+ paused: boolean;+ onSendNow: () => void;+ onRemove: () => void;+ }) {const [expanded, setExpanded] = useState(false);const [clipped, setClipped] = useState(false);@@ -436,17 +473,36 @@ function QueuedMessageRow(})}}>{message.text}</div>- {(clipped || expanded) && (- <button- onClick={() => setExpanded((e) => !e)}- title={expanded ? 'Collapse this message' : 'Show the full message'}- style={{- alignSelf: 'flex-start',- border: 'none', background: 'transparent', cursor: 'pointer', padding: 0,- fontFamily: 'var(--cth-font-ui)', fontSize: 12, lineHeight: '16px',- color: 'var(--cth-ink-500)', textDecoration: 'underline'- }}- >{expanded ? 'see less' : 'see more'}</button>+ {(clipped || expanded || paused) && (+ <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>+ {(clipped || expanded) && (+ <button+ onClick={() => setExpanded((e) => !e)}+ title={expanded ? 'Collapse this message' : 'Show the full message'}+ style={{+ border: 'none', background: 'transparent', cursor: 'pointer', padding: 0,+ fontFamily: 'var(--cth-font-ui)', fontSize: 12, lineHeight: '16px',+ color: 'var(--cth-ink-500)', textDecoration: 'underline'+ }}+ >{expanded ? 'see less' : 'see more'}</button>+ )}+ {paused && !message.manual && (+ <button+ onClick={onSendNow}+ title="Deliver this message even though auto-delivery is paused. It moves to the front of the queue and types in as soon as the terminal is free."+ style={{+ border: 'none', background: 'transparent', cursor: 'pointer', padding: 0,+ fontFamily: 'var(--cth-font-ui)', fontSize: 12, lineHeight: '16px',+ color: 'var(--cth-ink-900)', textDecoration: 'underline'+ }}+ >send now</button>+ )}+ {paused && message.manual && (+ <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>+ sending when free…+ </span>+ )}+ </div>)}</div><buttondiff --git a/src/renderer/src/hooks/useHive.ts b/src/renderer/src/hooks/useHive.tsindex 8a66af35..40bb9b00 100644--- a/src/renderer/src/hooks/useHive.ts+++ b/src/renderer/src/hooks/useHive.ts@@ -648,7 +648,11 @@ export function useHive(config: HarnessConfig | null): void {if (!next || !target?.ptyId || target.status !== 'idle') return { sent: false };const now = Date.now();const control = await window.cth.controlSnapshot(target.id);- if (control?.autoDeliveryPaused) return { sent: false };+ // The pause gate holds everything EXCEPT messages the user explicitly+ // released with "send now" (m.manual) — otherwise a paused floor leaves+ // the queue with no escape hatch at all. Idle/draft/picker safety below+ // still applies to manual messages; only the pause is bypassed.+ if (control?.autoDeliveryPaused && !next.manual) return { sent: false };// Hold queued messages until the target finishes its boot sequence.if ((bootGraceUntil.current[target.id] ?? 0) >= now) return { sent: false };// The user owns the prompt: a draft they are writing, or a menu theydiff --git a/src/renderer/src/store/store.ts b/src/renderer/src/store/store.tsindex 4c2694f1..88002744 100644--- a/src/renderer/src/store/store.ts+++ b/src/renderer/src/store/store.ts@@ -113,6 +113,10 @@ export interface QueuedMessage {* `text`. Used by Slack-origin work to carry the autonomy preamble to god's* prompt without polluting the human-readable kanban card title (= raw `text`). */instruction?: string;+ /** User clicked "send now" while floor-wide auto-delivery was paused. Bypasses+ * ONLY the pause gate in the drain loop — idle/draft/picker safety still hold,+ * so it delivers the moment the terminal is actually free. */+ manual?: boolean;}// 'files' retired in v0.3.4 (the per-agent IDE button superseded it) — a@@ -227,6 +231,9 @@ interface State {enqueueMessage: (agentId: string, text: string, meta?: { slack?: { channel: string; thread_ts: string }; instruction?: string }) => void;/** Drop a single queued message (user removed it, or it was just delivered). */removeQueuedMessage: (agentId: string, messageId: string) => void;+ /** "Send now" while floor auto-delivery is paused: marks the message manual+ * (drain bypasses the pause gate for it) and moves it to the queue front. */+ releaseQueuedMessage: (agentId: string, messageId: string) => void;/** Clear an agent's entire pending queue. */clearQueue: (agentId: string) => void;setAddAgentOpen: (open: boolean) => void;@@ -706,6 +713,19 @@ export const useStore = create<State>((set) => ({persistQueues(messageQueues);return { messageQueues };}),+ releaseQueuedMessage: (agentId, messageId) =>+ set((s) => {+ const current = s.messageQueues[agentId];+ const target = current?.find((m) => m.id === messageId);+ if (!current || !target) return s;+ const next = [+ { ...target, manual: true },+ ...current.filter((m) => m.id !== messageId)+ ];+ const messageQueues = { ...s.messageQueues, [agentId]: next };+ persistQueues(messageQueues);+ return { messageQueues };+ }),clearQueue: (agentId) =>set((s) => {if (!s.messageQueues[agentId]?.length) return s;