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
feat(5A/5B): close hook→station coverage + cage the synthetic demo loop
Chaitanya Giri660cf89c91b0
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex ea09e7a2..008a1c04 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -58,11 +58,22 @@ export function App() {for (const a of agents) if (a.ptyId) acquireTerminal(a.ptyId);}, [agents]);- // Mock loop only after onboarding (skip during wizard)+ // Synthetic demo loop — CAGED (#5B). It must never animate alongside a live+ // hive (it would fire fake envelope handoffs and step seeded agents). Run it+ // only as an explicit showcase (VITE_CTH_DEMO=1 in dev) or on a genuinely+ // empty floor, and stop it the instant the first real PTY agent appears+ // (Michael always spawns, so in normal operation it effectively never runs).useEffect(() => {if (!config?.onboardingComplete) return;- startMockLoop();- return () => stopMockLoop();+ const DEMO = import.meta.env.DEV && import.meta.env.VITE_CTH_DEMO === '1';+ const evaluate = () => {+ const hasLive = useStore.getState().agents.some((a) => a.ptyId);+ if (DEMO || !hasLive) startMockLoop();+ else stopMockLoop();+ };+ evaluate();+ const unsub = useStore.subscribe(evaluate);+ return () => { unsub(); stopMockLoop(); };}, [config?.onboardingComplete]);// Reconcile restored agents against the PTYs still alive in the main process.diff --git a/src/renderer/src/hooks/useHive.ts b/src/renderer/src/hooks/useHive.tsindex 56ac33b7..9f7c7a10 100644--- a/src/renderer/src/hooks/useHive.ts+++ b/src/renderer/src/hooks/useHive.ts@@ -59,9 +59,19 @@ const TOOL_STATION: Record<string, { station: StationKind; carry?: ToolKind }> =Glob: { station: 'shelf', carry: 'Glob' },WebFetch: { station: 'web', carry: 'WebFetch' },WebSearch: { station: 'web', carry: 'WebSearch' },- TodoWrite: { station: 'board', carry: 'TodoWrite' }+ TodoWrite: { station: 'board', carry: 'TodoWrite' },+ // #5A — delegating to a sub-agent reads as "handing off at the outbox".+ Task: { station: 'mailbox', carry: 'TodoWrite' }};+/** Resolve a tool name to its station/glyph. Falls back: any `mcp__*` tool →+ * the MCP station (previously these silently sat at the desk, #5A gap); anything+ * else → the desk. */+function stationForTool(tool: string): { station: StationKind; carry?: ToolKind } {+ return TOOL_STATION[tool]+ ?? (tool.startsWith('mcp__') ? { station: 'mcp', carry: 'MCP' } : { station: 'desk' });+}+/*** The renderer-side glue for the hive:* 1. spawns the god agent into Michael's room when none is running,@@ -221,7 +231,7 @@ export function useHive(config: HarnessConfig | null): void {// Hook events are the authoritative status source for real agents (the// pty-stream parser only refines the on-floor action/station).if (e.event === 'PreToolUse' && e.tool) {- const m = TOOL_STATION[e.tool] ?? { station: 'desk' as StationKind };+ const m = stationForTool(e.tool);updateAgent(e.agentId, { status: 'working', currentStation: m.station, carrying: m.carry, action: `using ${e.tool}` });useStore.getState().bumpToolCount(e.agentId); // usage proxy for the command center} else if (e.event === 'PostToolUse' || e.event === 'UserPromptSubmit') {