refactor: remove coding-agent hook management (P2.2)

The hooks for Claude Code, Codex and the other agents ran the
hive-mind-hooks-* packages, which left the repository; ADR-0002 hides
the feature in v1. Remove the hook installer surface from the tool
launcher, the POST /api/tools/hooks route, the hook status probe in
tool detection, and the hook fields of the tool manifest and detection
envelope (hookCapable, hookRoot, hookPointer, hooksInstalled,
hookPointerPath). Third-party adapter manifests no longer accept the
hook fields.

In the web UI, remove the hidden hook actions and the "How memory is
shared" explainer from the Launcher, adapter.manageHooks, the
hook-wired count in Mission Control and the agentHooks and memoryMcp
memory feature flags. Launch, watch and stop are unchanged; the
roadmap tool note no longer mentions hooks.
This commit is contained in:
shumeiko.it
2026-11-01 00:35:13 +01:00
parent 46687a823a
commit 2edfd01e6e
32 changed files with 168 additions and 2575 deletions

View File

@@ -1,16 +1,9 @@
/**
* Warm-Hive PR6b (B1) — LauncherApp A/B segmented toggle.
* LauncherApp — detect, launch, watch and stop external AI tools.
*
* Variation A · Launch = the existing live detect/launch UI (preserved).
* Variation B · How memory is shared = a pure-UI explainer (flow diagram +
* three cards + an explicitly-labelled provenance example, no live data).
*
* These tests assert the toggle wiring and that Variation B carries the
* static explainer content WITHOUT fabricating a live recall.
*
* Agent hooks, the explainer and Waggle Room tasks are hidden in v1 by the
* memory feature map (ADR-0002). Most suites switch them on to keep the hidden
* code covered; the "v1 memory features" suite checks the default.
* Waggle Room tasks are hidden in v1 by the memory feature map (ADR-0002).
* Most suites switch them on to keep the hidden code covered; the "v1 memory
* features" suite checks the default.
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { render, screen, waitFor, cleanup, fireEvent, within } from '@testing-library/react';
@@ -20,7 +13,6 @@ const mocks = vi.hoisted(() => ({
detectTools: vi.fn(),
getToolProcesses: vi.fn(),
launchTool: vi.fn(),
manageHooks: vi.fn(),
killTool: vi.fn(),
runExternalToolTask: vi.fn(),
streamToolOutput: vi.fn(() => () => {}),
@@ -43,8 +35,6 @@ const detectionResp = {
installed: true,
installedPath: '/opt/homebrew/bin/claude',
version: '2.4.0',
hooksInstalled: true,
hookPointerPath: '/home/.claude/hooks',
},
],
};
@@ -55,7 +45,6 @@ beforeEach(() => {
mocks.adapter.detectTools.mockResolvedValue(detectionResp);
mocks.adapter.getToolProcesses.mockResolvedValue({ processes: [] });
mocks.adapter.launchTool.mockResolvedValue({ ok: true, pid: 123 });
mocks.adapter.manageHooks.mockResolvedValue({ ok: true });
mocks.adapter.killTool.mockResolvedValue({ ok: true, pid: 123, reason: 'SIGTERM' });
mocks.adapter.runExternalToolTask.mockResolvedValue({
roomId: 'room-1',
@@ -67,7 +56,7 @@ afterEach(() => {
vi.clearAllMocks();
});
describe('LauncherApp · A/B toggle', () => {
describe('LauncherApp · detection', () => {
it('repaints detected tools on return and refreshes silently', async () => {
const first = render(<LauncherApp />);
expect(await screen.findByText('Claude Code')).toBeInTheDocument();
@@ -79,54 +68,11 @@ describe('LauncherApp · A/B toggle', () => {
await waitFor(() => expect(mocks.adapter.detectTools.mock.calls.length).toBeGreaterThan(baseline));
});
it('defaults to Variation A and renders the live launch UI', async () => {
it('renders the live launch UI', async () => {
render(<LauncherApp />);
// The detected tool from the live adapter appears (Variation A).
expect(await screen.findByText('Claude Code')).toBeInTheDocument();
expect(screen.getByText(/optional prompt/i)).toBeInTheDocument();
// Toggle exists with both tabs, A selected.
const launchTab = screen.getByRole('tab', { name: /^launch$/i });
const memTab = screen.getByRole('tab', { name: /how memory is shared/i });
expect(launchTab).toHaveAttribute('aria-selected', 'true');
expect(memTab).toHaveAttribute('aria-selected', 'false');
});
it('switches to Variation B and renders the explainer (flow + cards), hiding the live UI', async () => {
render(<LauncherApp />);
await screen.findByText('Claude Code');
fireEvent.click(screen.getByRole('tab', { name: /how memory is shared/i }));
expect(screen.getByRole('tab', { name: /how memory is shared/i })).toHaveAttribute('aria-selected', 'true');
// Explainer heading + flow nodes.
expect(screen.getByText(/how a launched agent shares the hive/i)).toBeInTheDocument();
expect(screen.getByText('The hive')).toBeInTheDocument();
expect(screen.getByText('hive-mind')).toBeInTheDocument();
// Three explainer cards.
expect(screen.getByText(/it recalls on start/i)).toBeInTheDocument();
expect(screen.getByText(/it commits as it works/i)).toBeInTheDocument();
expect(screen.getByText(/reversible & local/i)).toBeInTheDocument();
// The live launch UI (prompt box) is no longer mounted.
expect(screen.queryByText(/optional prompt/i)).not.toBeInTheDocument();
});
it('labels the provenance example as an example (no fabricated live recall)', async () => {
render(<LauncherApp />);
await screen.findByText('Claude Code');
fireEvent.click(screen.getByRole('tab', { name: /how memory is shared/i }));
const prov = screen.getByText(/remembered from Claude Code/i);
expect(prov).toHaveTextContent(/^example ·/i);
});
it('toggles back to Variation A and restores the live UI', async () => {
render(<LauncherApp />);
await screen.findByText('Claude Code');
fireEvent.click(screen.getByRole('tab', { name: /how memory is shared/i }));
expect(screen.queryByText(/optional prompt/i)).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('tab', { name: /^launch$/i }));
expect(screen.getByRole('tab', { name: /^launch$/i })).toHaveAttribute('aria-selected', 'true');
await waitFor(() => expect(screen.getByText(/optional prompt/i)).toBeInTheDocument());
expect(screen.getByText('Claude Code')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^launch$/i })).toBeInTheDocument();
});
});
@@ -158,8 +104,6 @@ describe('LauncherApp · captured tasks', () => {
installed: true,
installedPath: '/usr/local/bin/codex',
version: '0.144.1',
hooksInstalled: true,
hookPointerPath: '/home/.codex/hooks',
capabilities: {
interactiveLaunch: true,
headlessTask: true,
@@ -175,8 +119,6 @@ describe('LauncherApp · captured tasks', () => {
installed: true,
installedPath: '/usr/local/bin/hermes',
version: '1.0.0',
hooksInstalled: true,
hookPointerPath: '/home/.hermes/hooks',
capabilities: {
interactiveLaunch: true,
headlessTask: true,
@@ -192,8 +134,6 @@ describe('LauncherApp · captured tasks', () => {
installed: true,
installedPath: '/Applications/Cursor.app',
version: '1.0.0',
hooksInstalled: true,
hookPointerPath: '/home/.cursor/hooks',
capabilities: {
interactiveLaunch: true,
headlessTask: false,
@@ -209,8 +149,6 @@ describe('LauncherApp · captured tasks', () => {
installed: false,
installedPath: null,
version: null,
hooksInstalled: false,
hookPointerPath: null,
capabilities: {
interactiveLaunch: true,
headlessTask: true,
@@ -274,7 +212,7 @@ describe('LauncherApp · captured tasks', () => {
expect(onOpenRoom).toHaveBeenCalledWith('room-multi');
});
it('labels a roadmap tool and offers no launch, task, or hook actions', async () => {
it('labels a roadmap tool and offers no launch or task actions', async () => {
mocks.adapter.detectTools.mockResolvedValue({
platform: 'darwin',
detectedAt: '2026-07-11T00:00:00.000Z',
@@ -283,12 +221,9 @@ describe('LauncherApp · captured tasks', () => {
displayName: 'Cursor',
releaseStatus: 'roadmap',
launchable: false,
hookCapable: false,
installed: true,
installedPath: '/Applications/Cursor.app',
version: '1.0.0',
hooksInstalled: true,
hookPointerPath: '/home/.cursor/hooks',
capabilities: {
interactiveLaunch: true,
headlessTask: false,
@@ -306,10 +241,8 @@ describe('LauncherApp · captured tasks', () => {
expect(within(card).getByText('Roadmap')).toBeInTheDocument();
expect(within(card).getByText(/detection retained for compatibility/i)).toBeInTheDocument();
expect(within(card).queryByText('Detect only')).not.toBeInTheDocument();
expect(within(card).queryByText('Hooks active')).not.toBeInTheDocument();
expect(within(card).queryByRole('button', { name: /^launch$/i })).not.toBeInTheDocument();
expect(within(card).queryByRole('button', { name: /run task/i })).not.toBeInTheDocument();
expect(within(card).queryByRole('button', { name: /install hooks/i })).not.toBeInTheDocument();
});
it('launches Hermes Desktop but excludes it and a broken CLI from captured teams', async () => {
@@ -323,8 +256,6 @@ describe('LauncherApp · captured tasks', () => {
installed: true,
installedPath: 'C:\\tools\\codex.exe',
version: '0.144.1',
hooksInstalled: true,
hookPointerPath: 'C:\\Users\\test\\.codex\\hooks.json',
launchable: true,
capabilities: {
interactiveLaunch: true,
@@ -341,8 +272,6 @@ describe('LauncherApp · captured tasks', () => {
installed: true,
installedPath: 'C:\\Users\\test\\AppData\\Local\\hermes\\bin\\hermes.cmd',
version: null,
hooksInstalled: false,
hookPointerPath: null,
launchable: false,
diagnostic: 'Hermes failed its --version health check.',
capabilities: {
@@ -360,10 +289,7 @@ describe('LauncherApp · captured tasks', () => {
installed: true,
installedPath: 'C:\\Users\\test\\AppData\\Local\\hermes\\Hermes.exe',
version: null,
hooksInstalled: false,
hookPointerPath: null,
launchable: true,
hookCapable: false,
capabilities: {
interactiveLaunch: true,
headlessTask: false,
@@ -381,8 +307,6 @@ describe('LauncherApp · captured tasks', () => {
const desktopCard = await screen.findByTestId('launcher-tool-hermes-desktop');
expect(within(desktopCard).getByRole('button', { name: /^launch$/i })).toBeInTheDocument();
expect(within(desktopCard).queryByRole('button', { name: /run task/i })).not.toBeInTheDocument();
expect(within(desktopCard).queryByRole('button', { name: /install hooks/i })).not.toBeInTheDocument();
expect(within(desktopCard).getByText(/launch only/i)).toBeInTheDocument();
const cliCard = screen.getByTestId('launcher-tool-hermes');
expect(within(cliCard).queryByRole('button', { name: /^launch$/i })).not.toBeInTheDocument();
@@ -395,31 +319,7 @@ describe('LauncherApp · captured tasks', () => {
});
});
describe('LauncherApp · hook cohort (#3)', () => {
it('offers hook actions for every real-hook tool (e.g. codex), not just claude-code', async () => {
// The 7 real-hook tools (claude-code, claude-desktop, codex,
// codex-desktop, cursor, hermes, openclaw) all ship a bin — the dock
// must expose hook install for each, mirroring the backend HOOKS_COHORT.
mocks.adapter.detectTools.mockResolvedValue({
platform: 'darwin',
detectedAt: '2026-06-29T00:00:00.000Z',
tools: [
{
id: 'codex',
displayName: 'Codex',
installed: true,
installedPath: '/usr/local/bin/codex',
version: '1.0.0',
hooksInstalled: false,
hookPointerPath: null,
},
],
});
render(<LauncherApp />);
expect(await screen.findByText('Codex')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /install hooks/i })).toBeInTheDocument();
});
describe('LauncherApp · launch', () => {
it('offers launch for a detected third-party adapter and sends its raw prompt', async () => {
mocks.adapter.detectTools.mockResolvedValue({
platform: 'linux',
@@ -431,10 +331,7 @@ describe('LauncherApp · hook cohort (#3)', () => {
installed: true,
installedPath: '/usr/local/bin/foo',
version: '1.0.0',
hooksInstalled: false,
hookPointerPath: null,
launchable: true,
hookCapable: false,
builtin: false,
acceptsInlinePrompt: true,
},
@@ -460,7 +357,6 @@ describe('LauncherApp · hook cohort (#3)', () => {
}),
);
});
expect(screen.queryByRole('button', { name: /install hooks/i })).not.toBeInTheDocument();
expect(screen.queryByText(/launch and hook management arrive in Phase 4/i)).not.toBeInTheDocument();
});
@@ -476,10 +372,7 @@ describe('LauncherApp · hook cohort (#3)', () => {
installedPath:
'C:\\Program Files\\WindowsApps\\OpenAI.Codex_26.623.19656.0_x64__2p2nqsd0c76g0\\app\\resources\\codex.exe',
version: null,
hooksInstalled: false,
hookPointerPath: null,
launchable: false,
hookCapable: true,
diagnostic:
'Codex was found in WindowsApps, but Windows blocks command-line launch from that app alias. Install a PATH CLI build of Codex or launch Codex from Start, then refresh.',
},
@@ -495,163 +388,7 @@ describe('LauncherApp · hook cohort (#3)', () => {
expect(screen.queryByText(/adapter is not configured for launch/i)).not.toBeInTheDocument();
});
it('shows actionable hook install stdout details such as the backup path', async () => {
mocks.adapter.detectTools.mockResolvedValue({
...detectionResp,
tools: [
{
...detectionResp.tools[0],
hooksInstalled: false,
hookPointerPath: null,
},
],
});
mocks.adapter.manageHooks.mockResolvedValueOnce({
ok: true,
action: 'install',
stdout: 'settings backed up: /home/.claude/settings.json.hive-mind-backup.2026-07-08T19-00-00Z\ninstall complete',
stderr: '',
code: 0,
});
render(<LauncherApp />);
fireEvent.click(await screen.findByRole('button', { name: /install hooks/i }));
expect(await screen.findByText(/Claude Code: install OK/i)).toBeInTheDocument();
expect(screen.getByText('Backup')).toBeInTheDocument();
expect(screen.getByText(/settings\.json\.hive-mind-backup/i)).toBeInTheDocument();
expect(screen.getByText('Recovery')).toBeInTheDocument();
expect(screen.queryByText(/^stdout:/i)).not.toBeInTheDocument();
});
it('shows hook failure stderr even when the route returns a generic error', async () => {
mocks.adapter.manageHooks.mockResolvedValueOnce({
ok: false,
action: 'verify',
stdout: '',
stderr: 'missing hook pointer: /home/.claude/settings.json',
code: 1,
error: 'verify failed',
});
render(<LauncherApp />);
fireEvent.click(await screen.findByRole('button', { name: /^verify$/i }));
expect(await screen.findByText(/verify failed/i)).toBeInTheDocument();
expect(screen.getByText(/missing hook pointer/i)).toBeInTheDocument();
expect(screen.getByText(/settings\.json/i)).toBeInTheDocument();
});
it('summarizes long hook output instead of flooding the result panel', async () => {
mocks.adapter.manageHooks.mockResolvedValueOnce({
ok: false,
action: 'verify',
stdout: '',
stderr: [
'failure detail 1: missing hook pointer',
'failure detail 2: stale backup file',
'failure detail 3: cli not trusted',
'failure detail 4: config mismatch',
'failure detail 5: lifecycle skipped',
'failure detail 6: retry recommended',
'failure detail 7: noisy internal trace',
'failure detail 8: noisy internal trace',
].join('\n'),
code: 1,
error: 'verify failed',
});
render(<LauncherApp />);
fireEvent.click(await screen.findByRole('button', { name: /^verify$/i }));
expect(await screen.findByText(/verify failed/i)).toBeInTheDocument();
expect(screen.getByText(/failure detail 1/i)).toBeInTheDocument();
expect(screen.getByText('More output')).toBeInTheDocument();
expect(screen.getByText(/2 additional hook output lines hidden/i)).toBeInTheDocument();
expect(screen.queryByText(/failure detail 8/i)).not.toBeInTheDocument();
expect(screen.getByText('Recovery')).toBeInTheDocument();
});
it('shows recovery guidance when hook verify fails without stdout or stderr', async () => {
mocks.adapter.manageHooks.mockResolvedValueOnce({
ok: false,
action: 'verify',
stdout: '',
stderr: '',
code: 1,
});
render(<LauncherApp />);
fireEvent.click(await screen.findByRole('button', { name: /^verify$/i }));
expect(await screen.findByText(/verify failed \(exit 1\)/i)).toBeInTheDocument();
expect(screen.getByText(/no hook output was returned/i)).toBeInTheDocument();
expect(screen.getByText(/reinstall hooks/i)).toBeInTheDocument();
});
it('summarizes hook verify check failures instead of showing raw check output', async () => {
mocks.adapter.manageHooks.mockResolvedValueOnce({
ok: false,
action: 'verify',
stdout: [
'hive-mind/codex-hooks: verify',
' [PASS] hooks.json exists — /home/.codex/hooks.json',
' [FAIL] hook command trusted — manual approval required in Codex settings',
'One or more checks failed.',
].join('\n'),
stderr: '',
code: 1,
});
render(<LauncherApp />);
fireEvent.click(await screen.findByRole('button', { name: /^verify$/i }));
expect(await screen.findByText(/verify failed \(exit 1\)/i)).toBeInTheDocument();
expect(screen.getByText('Check failed')).toBeInTheDocument();
expect(screen.getByText(/manual approval required in Codex settings/i)).toBeInTheDocument();
expect(screen.getByText('Recovery')).toBeInTheDocument();
expect(screen.queryByText(/\[FAIL\]/)).not.toBeInTheDocument();
});
it('labels hook uninstall restore and cleanup details without implying install state', async () => {
mocks.adapter.detectTools.mockResolvedValue({
...detectionResp,
tools: [
{
...detectionResp.tools[0],
hooksInstalled: true,
hookPointerPath: '/home/.codex/hive-mind-install.json',
},
],
});
mocks.adapter.manageHooks.mockResolvedValueOnce({
ok: true,
action: 'uninstall',
stdout: [
'hive-mind/codex-hooks: uninstall',
' - hooks.json: /home/.codex/hooks.json',
' - restored from: /home/.codex/hooks.json.hive-mind-backup.2026-07-08T19-00-00Z',
' - created removed: no',
' - backup removed: yes',
' - pointer removed: yes',
'Done. hooks.json is byte-identical to pre-install state.',
].join('\n'),
stderr: '',
code: 0,
});
render(<LauncherApp />);
fireEvent.click(await screen.findByRole('button', { name: /uninstall hooks/i }));
expect(await screen.findByText(/Claude Code: uninstall OK/i)).toBeInTheDocument();
expect(screen.getByText('Changed file')).toBeInTheDocument();
expect(screen.getByText('Restored from')).toBeInTheDocument();
expect(screen.getByText('Backup removed')).toBeInTheDocument();
expect(screen.getByText('Pointer removed')).toBeInTheDocument();
expect(screen.queryByText('Install pointer')).not.toBeInTheDocument();
});
it('offers Claude Desktop launch and hook management from the shared manifest', async () => {
it('offers Claude Desktop launch from the shared manifest', async () => {
mocks.adapter.detectTools.mockResolvedValue({
platform: 'darwin',
detectedAt: '2026-07-08T00:00:00.000Z',
@@ -662,8 +399,6 @@ describe('LauncherApp · hook cohort (#3)', () => {
installed: true,
installedPath: '/Applications/Claude.app',
version: '1.2.3',
hooksInstalled: false,
hookPointerPath: null,
},
],
});
@@ -672,15 +407,11 @@ describe('LauncherApp · hook cohort (#3)', () => {
expect(await screen.findByText('Claude Desktop')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^launch$/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /install hooks/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^verify$/i })).toBeInTheDocument();
expect(screen.queryByText(/launch only/i)).not.toBeInTheDocument();
expect(screen.queryByText(/hooks are not supported for Claude Desktop yet/i)).not.toBeInTheDocument();
});
});
describe('LauncherApp · v1 memory features (ADR-0002)', () => {
it('hides hook controls, the memory-sharing explainer and Room tasks; launch stays', async () => {
it('hides Room tasks; launch stays', async () => {
features.enabled = false;
mocks.adapter.detectTools.mockResolvedValue({
platform: 'darwin',
@@ -692,8 +423,6 @@ describe('LauncherApp · v1 memory features (ADR-0002)', () => {
installed: true,
installedPath: '/usr/local/bin/codex',
version: '0.144.1',
hooksInstalled: true,
hookPointerPath: '/home/.codex/hooks',
capabilities: { interactiveLaunch: true, headlessTask: true, structuredProgress: true, resumable: true },
permissionModes: ['read-only', 'workspace-write', 'native'],
},
@@ -704,10 +433,6 @@ describe('LauncherApp · v1 memory features (ADR-0002)', () => {
expect(await screen.findByText('Codex CLI')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^launch$/i })).toBeInTheDocument();
expect(screen.queryByRole('tablist', { name: /launcher view/i })).not.toBeInTheDocument();
expect(screen.queryByText(/hooks active/i)).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: /install hooks|uninstall hooks|^verify$/i })).not.toBeInTheDocument();
expect(screen.queryByText(/launch only|hook management is not supported/i)).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: /run task/i })).not.toBeInTheDocument();
});
});

View File

@@ -3,28 +3,18 @@
*
* Dock surface for the AI-OS tool launcher. Lists registered AI execution
* surfaces while keeping roadmap integrations visibly inert. Each card
* includes detection status, hook-install status,
* and its supported actions:
*
* Launch in workspace X / Install hooks / Verify hooks / Uninstall hooks
* includes detection status and its supported actions (launch in the active
* workspace, watch, stop).
*
* Adapter contract:
* adapter.detectTools() → /api/tools/detect
* adapter.launchTool() → /api/tools/launch
* adapter.manageHooks() → /api/tools/hooks
*
* Warm-Hive PR6b (B1): two views behind a segmented toggle —
* Variation A · Launch — the live detect/launch/hooks/processes UI (below).
* Variation B · How memory is shared — a pure-UI explainer (flow diagram +
* three cards + a provenance example). Static, no backend, mirrors
* docs/design_handoff_waggle_app/design-files/screens/launcher.html.
*/
import { useState, useEffect, useCallback, useMemo } from 'react';
import {
Rocket, RefreshCw, CheckCircle2, XCircle, AlertTriangle,
Play, Download, ShieldCheck, Trash2, Loader2, MessageSquare, Square,
Workflow, ArrowDownToLine, ArrowRight, ShieldCheck as ShieldCheckIcon, Hexagon,
Play, Loader2, MessageSquare, Square, Workflow,
} from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
@@ -45,19 +35,15 @@ import {
} from '@waggle/shared';
// #5 — derived from the shared manifest registry (single source of truth),
// replacing the hand-maintained local copies. LAUNCH_COHORT = launchable tools;
// HOOKS_COHORT = tools whose hive-mind hook package ships a bin (hookCapable).
// Hermes Desktop is intentionally excluded. Mirrors the backend cohorts, which
// derive from the same BUILTIN_TOOL_MANIFESTS.
// replacing the hand-maintained local copy. LAUNCH_COHORT = launchable tools.
// Mirrors the backend cohort, which derives from the same BUILTIN_TOOL_MANIFESTS.
const LAUNCH_COHORT = BUILTIN_TOOL_MANIFESTS.filter((m) => m.launchable).map((m) => m.id);
const HOOKS_COHORT = BUILTIN_TOOL_MANIFESTS.filter((m) => m.hookCapable).map((m) => m.id);
interface DetectedTool {
id: string;
displayName: string;
releaseStatus?: ToolReleaseStatus;
launchable?: boolean;
hookCapable?: boolean;
builtin?: boolean;
acceptsInlinePrompt?: boolean;
capabilities?: ToolCapabilities;
@@ -65,8 +51,6 @@ interface DetectedTool {
installed: boolean;
installedPath: string | null;
version: string | null;
hooksInstalled: boolean;
hookPointerPath: string | null;
diagnostic?: string;
}
@@ -76,10 +60,7 @@ interface DetectionResult {
tools: DetectedTool[];
}
type ToolAction = 'launch' | 'run' | 'install' | 'verify' | 'uninstall';
/** Segmented-toggle view: A = the live launch UI; B = the memory-sharing explainer. */
type LauncherView = 'a' | 'b';
type ToolAction = 'launch' | 'run';
interface ActionState {
toolId: string;
@@ -91,13 +72,6 @@ interface ActionResult {
action: ToolAction;
ok: boolean;
message: string;
details?: ActionDetail[];
}
interface ActionDetail {
label: string;
value: string;
tone?: 'attention' | 'recovery';
}
interface LauncherAppProps {
@@ -115,16 +89,13 @@ export function resetLauncherRouteCache(): void {
launcherRouteCache.resetForTests();
}
const HOOK_PATH_RE = /([A-Za-z]:\\[^\s]+|\/[^\s]+)/;
const MAX_VISIBLE_HOOK_DETAILS = 6;
const toolCanLaunch = (tool: DetectedTool): boolean =>
tool.releaseStatus !== 'roadmap'
&& (tool.launchable ?? LAUNCH_COHORT.includes(tool.id));
const launchUnavailableMessage = (tool: DetectedTool): string =>
tool.releaseStatus === 'roadmap'
? 'Roadmap integration. Detection retained for compatibility; launch, tasks, and hooks are deferred.'
? 'Roadmap integration. Detection retained for compatibility; launch and tasks are deferred.'
: tool.installed && tool.diagnostic
? 'Launch is blocked for this install. Follow the note above, then refresh.'
: 'Detection ready. This adapter is not configured for launch.';
@@ -149,152 +120,9 @@ const toolCanRunCapturedTask = (tool: DetectedTool): boolean =>
tool.capabilities?.headlessTask === true &&
(tool.permissionModes?.length ?? 0) > 0;
const hookDetailLabel = (rawLabel: string): string => {
const label = rawLabel.trim().toLowerCase();
if (label.includes('backup removed')) return 'Backup removed';
if (label.includes('pointer removed')) return 'Pointer removed';
if (label.includes('created removed')) return 'Created file removed';
if (label.includes('backup')) return 'Backup';
if (label.includes('pointer')) return 'Install pointer';
if (label.includes('restored')) return 'Restored from';
if (label.includes('settings') || label.includes('hooks.json') || label.includes('config')) return 'Changed file';
if (label.includes('added hooks')) return 'Hooks added';
if (label.includes('cli path')) return 'CLI path';
return rawLabel.trim().replace(/^\w/, (c) => c.toUpperCase());
};
const hookRecoveryDetail = (result?: { ok: boolean; action: ToolAction }): ActionDetail | null => {
if (!result) return null;
if (!result.ok) {
return {
label: 'Recovery',
value: result.action === 'verify'
? 'Run Install hooks for this tool, then Verify again. If it still fails, use Uninstall hooks to restore the previous config, then reinstall hooks.'
: 'Retry the action. If it repeats, use Uninstall hooks to restore the previous config, then install again.',
tone: 'recovery',
};
}
if (result.action === 'install') {
return {
label: 'Recovery',
value: 'Use Verify to inspect the install, or Uninstall hooks to restore the previous config.',
tone: 'recovery',
};
}
if (result.action === 'uninstall') {
return {
label: 'Recovery',
value: 'Previous hook config was restored, or the Waggle-created config was removed.',
tone: 'recovery',
};
}
return null;
};
const parseHookOutputDetails = (text: string | undefined, stream: 'stdout' | 'stderr'): ActionDetail[] => {
const lines = text?.trim().split(/\r?\n/).map((line) => line.trim()).filter(Boolean) ?? [];
const tone = stream === 'stderr' ? 'attention' : undefined;
return lines
.map((line): ActionDetail | null => {
const check = line.match(/^\[(PASS|FAIL)\]\s+(.+?)(?:\s+(?:\u2014|-)\s+(.+))?$/);
if (check) {
const failed = check[1] === 'FAIL';
const name = check[2].trim();
const detail = check[3]?.trim();
return {
label: failed ? 'Check failed' : 'Check passed',
value: detail ? `${name}: ${detail}` : name,
tone: failed ? 'attention' : tone,
};
}
const labeled = line.match(/^\s*-\s*([^:]+):\s*(.*)$/);
if (labeled) {
return {
label: hookDetailLabel(labeled[1]),
value: labeled[2].trim() || line,
tone,
};
}
if (/backup|backed up/i.test(line)) {
return {
label: 'Backup',
value: line.match(HOOK_PATH_RE)?.[1] ?? line,
tone,
};
}
if (stream === 'stderr') {
return { label: 'Needs attention', value: line, tone: 'attention' };
}
if (
/^hive-mind\/.+:\s/.test(line) ||
/^done\./i.test(line) ||
/^run "/i.test(line) ||
/^all checks passed\.$/i.test(line) ||
/^one or more checks failed\.$/i.test(line)
) {
return null;
}
return { label: 'Output', value: line };
})
.filter((detail): detail is ActionDetail => Boolean(detail));
};
const summarizeHookActionDetails = (details: ActionDetail[]): ActionDetail[] => {
const recoveryDetails = details.filter((detail) => detail.label === 'Recovery');
const outputDetails = details.filter((detail) => detail.label !== 'Recovery');
if (outputDetails.length <= MAX_VISIBLE_HOOK_DETAILS) return details;
const visibleOutput = outputDetails.slice(0, MAX_VISIBLE_HOOK_DETAILS);
const hiddenCount = outputDetails.length - visibleOutput.length;
const hiddenHasAttention = outputDetails
.slice(MAX_VISIBLE_HOOK_DETAILS)
.some((detail) => detail.tone === 'attention');
return [
...visibleOutput,
{
label: 'More output',
value: `${hiddenCount} additional hook output ${hiddenCount === 1 ? 'line' : 'lines'} hidden. Run the hook action from a terminal for full output.`,
tone: hiddenHasAttention ? 'attention' : undefined,
},
...recoveryDetails,
];
};
const hookActionDetails = (
stdout?: string,
stderr?: string,
result?: { ok: boolean; action: ToolAction },
): ActionDetail[] => {
const details = [
...parseHookOutputDetails(stdout, 'stdout'),
...parseHookOutputDetails(stderr, 'stderr'),
];
const recovery = hookRecoveryDetail(result);
if (recovery) {
details.push(recovery);
}
if (!result?.ok && details.length === 1 && recovery) {
details.unshift({
label: 'Needs attention',
value: 'No hook output was returned.',
tone: 'attention',
});
}
return summarizeHookActionDetails(details);
};
const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: LauncherAppProps = {}) => {
const [view, setView] = useState<LauncherView>('a');
// ADR-0002: agent memory hooks and Waggle Room are hidden in v1 (memory
// feature map). Launch, watch and stop stay.
const hooksShown = hasMemoryFeature('agentHooks');
// ADR-0002: Waggle Room is hidden in v1 (memory feature map). Launch, watch
// and stop stay.
const roomShown = hasMemoryFeature('room');
const cachedDetection = launcherRouteCache.read('tools');
const [detection, setDetection] = useState<DetectionResult | null>(cachedDetection ?? null);
@@ -435,67 +263,50 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
[pidsByTool],
);
const doAction = useCallback(
async (tool: DetectedTool, action: Exclude<ToolAction, 'run'>) => {
const launchSelectedTool = useCallback(
async (tool: DetectedTool) => {
const action = 'launch';
setActiveAction({ toolId: tool.id, action });
setLastResult(null);
try {
if (action === 'launch') {
if (!tool.installedPath) {
setLastResult({
toolId: tool.id,
action,
ok: false,
message: 'Tool not installed. Cannot launch.',
});
return;
}
// If a prompt is set AND the tool has a known prompt-arg
// shape, pass it through as CLI args. Otherwise launch
// bare and the prompt textarea is silently ignored for
// that tool.
const args = promptArgsForTool(tool.id, prompt) ?? undefined;
const sendsRawPrompt = !args && tool.acceptsInlinePrompt === true && prompt.trim().length > 0;
const r = await adapter.launchTool({
id: tool.id,
installedPath: tool.installedPath,
workspaceId: activeWorkspaceId,
// Built-in tools send pre-computed args; a third-party adapter gets
// the raw prompt so the server can apply its promptArgTemplate (#5).
...(args ? { args } : (sendsRawPrompt ? { prompt } : {})),
...(watchMode ? { observe: true } : {}),
});
const promptNote = (args || sendsRawPrompt) ? ' with prompt' : '';
if (!tool.installedPath) {
setLastResult({
toolId: tool.id,
action,
ok: r.ok,
message: r.ok
? `Launched ${tool.displayName}${promptNote} (pid ${r.pid})`
: (r.error ?? 'Launch failed'),
ok: false,
message: 'Tool not installed. Cannot launch.',
});
// Clear the prompt after a successful launch — avoid sending
// the same text twice by accident.
if (r.ok && (args || sendsRawPrompt)) setPrompt('');
// Watch mode (⌘K deep-link): auto-open the live output pane.
if (r.ok && watchMode) setOpenPaneToolId(tool.id);
} else {
const r = await adapter.manageHooks({ id: tool.id, action });
setLastResult({
toolId: tool.id,
action,
ok: r.ok,
message: r.ok
? `${tool.displayName}: ${action} OK`
: (r.error || r.stderr || `${action} failed (exit ${r.code})`),
details: hookActionDetails(r.stdout, r.stderr, { ok: r.ok, action }),
});
// Refresh detection after install/uninstall so hook status
// updates on screen without waiting for user click.
if (action === 'install' || action === 'uninstall') {
await refresh();
}
return;
}
// If a prompt is set AND the tool has a known prompt-arg
// shape, pass it through as CLI args. Otherwise launch
// bare and the prompt textarea is silently ignored for
// that tool.
const args = promptArgsForTool(tool.id, prompt) ?? undefined;
const sendsRawPrompt = !args && tool.acceptsInlinePrompt === true && prompt.trim().length > 0;
const r = await adapter.launchTool({
id: tool.id,
installedPath: tool.installedPath,
workspaceId: activeWorkspaceId,
// Built-in tools send pre-computed args; a third-party adapter gets
// the raw prompt so the server can apply its promptArgTemplate (#5).
...(args ? { args } : (sendsRawPrompt ? { prompt } : {})),
...(watchMode ? { observe: true } : {}),
});
const promptNote = (args || sendsRawPrompt) ? ' with prompt' : '';
setLastResult({
toolId: tool.id,
action,
ok: r.ok,
message: r.ok
? `Launched ${tool.displayName}${promptNote} (pid ${r.pid})`
: (r.error ?? 'Launch failed'),
});
// Clear the prompt after a successful launch — avoid sending
// the same text twice by accident.
if (r.ok && (args || sendsRawPrompt)) setPrompt('');
// Watch mode (⌘K deep-link): auto-open the live output pane.
if (r.ok && watchMode) setOpenPaneToolId(tool.id);
} catch (err) {
setLastResult({
toolId: tool.id,
@@ -507,7 +318,7 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
setActiveAction(null);
}
},
[activeWorkspaceId, prompt, refresh, watchMode],
[activeWorkspaceId, prompt, watchMode],
);
const tools = useMemo<DetectedTool[]>(() => detection?.tools ?? [], [detection]);
@@ -590,51 +401,22 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
return (
<div className="flex flex-col h-full bg-background text-foreground">
{/* Header — title + A/B segmented toggle + (Variation A only) refresh */}
{/* Header — title + refresh */}
<div className="flex items-center gap-3 px-3 py-2 border-b border-border/50">
<div className="flex items-center gap-2">
<Rocket className="w-4 h-4" style={{ color: 'var(--honey)' }} />
<span className="text-sm font-display font-semibold">Tool Launcher</span>
{view === 'a' && detection && (
{detection && (
<Badge variant="secondary" className="text-[11px] px-1.5 py-0 h-4">
{detection.platform}
</Badge>
)}
</div>
{hooksShown && (
<div
role="tablist"
aria-label="Launcher view"
className="inline-flex gap-1 p-[3px] rounded-[10px]"
style={{ background: 'var(--secondary, hsl(var(--secondary)))', border: '1px solid var(--line-soft)' }}
>
{(['a', 'b'] as LauncherView[]).map((v) => (
<button
key={v}
role="tab"
aria-selected={view === v}
onClick={() => setView(v)}
className={`text-[11.5px] font-display font-semibold px-2.5 py-1 rounded-md transition-colors whitespace-nowrap ${
view === v ? '' : 'text-muted-foreground hover:text-foreground'
}`}
style={view === v ? { background: 'var(--honey)', color: '#1a1407' } : undefined}
>
{v === 'a' ? 'Launch' : 'How memory is shared'}
</button>
))}
</div>
)}
{view === 'a' && (
<Button type="button" variant="ghost" size="sm" onClick={refresh} aria-label="Refresh installed tools" className="h-7 w-7 p-0 ml-auto">
<RefreshCw className={`w-3.5 h-3.5 ${loading ? 'animate-spin' : ''}`} />
</Button>
)}
<Button type="button" variant="ghost" size="sm" onClick={refresh} aria-label="Refresh installed tools" className="h-7 w-7 p-0 ml-auto">
<RefreshCw className={`w-3.5 h-3.5 ${loading ? 'animate-spin' : ''}`} />
</Button>
</div>
{view === 'b' && hooksShown ? (
<MemorySharingView />
) : (
<>
{/* Status bar */}
{error && (
<div className="flex items-center gap-2 px-3 py-2 bg-destructive/10 border-b border-destructive/30 text-[12px] text-destructive">
@@ -670,25 +452,6 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
)}
<div className="min-w-0 flex-1">
<div>{lastResult.message}</div>
{lastResult.details?.length ? (
<div className="mt-1.5 space-y-1.5 text-[11px] leading-snug opacity-90">
{lastResult.details.map((detail, index) => (
<div key={`${detail.label}-${detail.value}-${index}`} className="min-w-0">
<div className="font-display text-[10px] font-semibold uppercase tracking-normal opacity-75">
{detail.label}
</div>
<div
className={[
detail.tone === 'recovery' ? 'font-sans' : 'font-mono',
'whitespace-pre-wrap break-all',
].join(' ')}
>
{detail.value}
</div>
</div>
))}
</div>
) : null}
</div>
</div>
)}
@@ -753,8 +516,6 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
)}
{tools.map((tool) => {
const launchable = toolCanLaunch(tool);
const hooksSupported = hooksShown && HOOKS_COHORT.includes(tool.id);
const launchOnly = hooksShown && launchable && !hooksSupported;
const isActive = activeAction?.toolId === tool.id;
return (
<div
@@ -776,16 +537,6 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
Not installed
</Badge>
)}
{hooksShown && tool.hooksInstalled && tool.releaseStatus !== 'roadmap' && (
<Badge variant="secondary" className="text-[10px] px-1.5 py-0 h-4" style={{ background: 'var(--honey-wash)', color: 'var(--honey)' }}>
Hooks active
</Badge>
)}
{launchOnly && (
<Badge variant="outline" className="text-[10px] px-1.5 py-0 h-4 text-muted-foreground">
Launch only
</Badge>
)}
{runningTools.has(tool.id) && (
<button
type="button"
@@ -831,7 +582,7 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
size="sm"
variant="secondary"
className="h-7 text-[11px]"
onClick={() => doAction(tool, 'launch')}
onClick={() => launchSelectedTool(tool)}
disabled={isActive}
>
{isActive && activeAction?.action === 'launch' ? (
@@ -871,63 +622,7 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
Stop
</Button>
)}
{hooksSupported && !tool.hooksInstalled && (
<Button
size="sm"
variant="secondary"
className="h-7 text-[11px]"
onClick={() => doAction(tool, 'install')}
disabled={isActive}
>
{isActive && activeAction?.action === 'install' ? (
<Loader2 className="w-3 h-3 animate-spin mr-1" />
) : (
<Download className="w-3 h-3 mr-1" />
)}
Install hooks
</Button>
)}
{hooksSupported && (
<Button
size="sm"
variant="ghost"
className="h-7 text-[11px]"
onClick={() => doAction(tool, 'verify')}
disabled={isActive}
>
{isActive && activeAction?.action === 'verify' ? (
<Loader2 className="w-3 h-3 animate-spin mr-1" />
) : (
<ShieldCheck className="w-3 h-3 mr-1" />
)}
Verify
</Button>
)}
{hooksSupported && tool.hooksInstalled && (
<Button
size="sm"
variant="ghost"
className="h-7 text-[11px]"
style={{ color: 'var(--risk)' }}
onClick={() => doAction(tool, 'uninstall')}
disabled={isActive}
>
{isActive && activeAction?.action === 'uninstall' ? (
<Loader2 className="w-3 h-3 animate-spin mr-1" />
) : (
<Trash2 className="w-3 h-3 mr-1" />
)}
Uninstall hooks
</Button>
)}
</div>
{launchOnly && (
<div className="text-[11px] text-muted-foreground">
{tool.id === 'hermes-desktop'
? 'Hook management is not supported for Hermes Desktop.'
: 'Hook management is not supported for this tool yet.'}
</div>
)}
{roomShown && taskToolId === tool.id && toolCanRunCapturedTask(tool) && (
<div
className="rounded-lg border border-primary/30 bg-primary/5 p-3 space-y-3"
@@ -1068,188 +763,8 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
})}
</div>
</ScrollArea>
</>
)}
</div>
);
};
/**
* Variation B · How memory is shared — a pure-UI explainer. No backend, no
* adapter calls, no live data: a fixed flow diagram + three cards + one
* provenance example, mirroring launcher.html lines 147-181. The provenance
* example string is illustrative (a documentation example, not a real recall),
* so it carries an explicit "example" label — no fabricated live data.
*/
interface FlowNode {
tag: string;
title: string;
detail: React.ReactNode;
hive?: boolean;
}
const FLOW_NODES: readonly FlowNode[] = [
{
tag: 'You launch',
title: 'Claude Code',
detail: (
<>
opened from Waggle with
<br />
<span className="font-mono text-[10.5px]" style={{ color: 'var(--honey)' }}>
WAGGLE_WORKSPACE_ID
</span>
</>
),
},
{
tag: '5 lifecycle hooks',
title: 'hive-mind',
detail: <>session · prompt · stop · compact · tool</>,
},
{
tag: 'Your workspace',
title: 'The hive',
detail: (
<>
local SQLite memory
<br />
shared with Waggle
</>
),
hive: true,
},
];
interface ExplainerCard {
icon: typeof ArrowDownToLine;
title: string;
body: string;
}
const EXPLAINER_CARDS: readonly ExplainerCard[] = [
{
icon: ArrowDownToLine,
title: 'It recalls on start',
body: 'The agent opens already knowing this workspace: decisions, constraints, and context, pulled from the hive.',
},
{
icon: ArrowRight,
title: 'It commits as it works',
body: 'Every meaningful step is captured back into the hive, so Waggle and your next session see it too.',
},
{
icon: ShieldCheckIcon,
title: 'Reversible & local',
body: 'Hooks install and uninstall cleanly. Nothing leaves your machine; you can verify or remove them anytime.',
},
];
const MemorySharingView = () => {
return (
<ScrollArea className="flex-1 min-h-0">
<div className="max-w-[940px] mx-auto px-8 py-8 pb-16">
{/* Heading */}
<header className="mb-6">
<div
className="font-mono text-[11px] uppercase tracking-[0.14em] mb-3 flex items-center gap-2.5"
style={{ color: 'var(--honey)' }}
>
<span className="inline-block w-5 h-px" style={{ background: 'var(--honey-line)' }} aria-hidden="true" />
How memory is shared
</div>
<h1 className="text-[26px] font-display font-semibold tracking-tight leading-tight m-0 mb-2.5 text-foreground">
How a launched agent shares the hive
</h1>
<p className="text-[15px] text-muted-foreground leading-relaxed m-0 max-w-[64ch]">
When you launch from Waggle, the workspace&apos;s memory is wired into the external tool. No copy-paste, no
re-explaining. Its work comes back <b className="text-foreground font-medium">attributed</b>.
</p>
</header>
{/* Flow diagram + cards + provenance example */}
<div
className="rounded-2xl px-8 py-9 text-center"
style={{
border: '1px solid var(--line)',
background: 'radial-gradient(70% 90% at 50% 0%, var(--secondary, hsl(var(--secondary))), var(--bg-2))',
}}
>
{/* Flow row */}
<div className="flex items-center justify-center flex-wrap gap-y-3">
{FLOW_NODES.map((node, i) => (
<div key={node.title} className="flex items-center">
<div
className="rounded-xl px-4 py-4 min-w-[140px] max-w-[184px] text-left"
style={
node.hive
? {
border: '1px solid var(--honey-line)',
boxShadow: 'var(--honey-glow)',
background: 'linear-gradient(150deg, var(--secondary, hsl(var(--secondary))), var(--card, hsl(var(--card))))',
}
: { border: '1px solid var(--line-strong)', background: 'var(--card, hsl(var(--card)))' }
}
>
<div className="font-mono text-[9.5px] uppercase tracking-[0.12em] mb-1.5 text-[var(--text-tertiary)]">
{node.tag}
</div>
<div className="text-sm font-display font-semibold text-foreground">{node.title}</div>
<div className="text-[11.5px] text-muted-foreground mt-1 leading-snug">{node.detail}</div>
</div>
{i < FLOW_NODES.length - 1 && (
<div className="px-3 text-center shrink-0" style={{ color: 'var(--honey)' }} aria-hidden="true">
<ArrowRight className="w-5 h-5 mx-auto" />
<span className="block font-mono text-[9px] uppercase tracking-[0.1em] text-[var(--text-tertiary)]">
{i === 0 ? 'hooks' : 'recall + commit'}
</span>
</div>
)}
</div>
))}
</div>
{/* Three explainer cards */}
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3.5 mt-7 text-left">
{EXPLAINER_CARDS.map((card) => {
const Icon = card.icon;
return (
<div
key={card.title}
className="rounded-xl p-4"
style={{ background: 'var(--card, hsl(var(--card)))', border: '1px solid var(--line-soft)' }}
>
<Icon className="w-[17px] h-[17px] mb-2.5" style={{ color: 'var(--honey)' }} aria-hidden="true" />
<b className="text-[13.5px] font-display font-semibold block mb-1.5 text-foreground">{card.title}</b>
<p className="m-0 text-[12.5px] text-muted-foreground leading-relaxed">{card.body}</p>
</div>
);
})}
</div>
{/* Provenance example — illustrative, explicitly labelled */}
<div
className="mt-5 inline-flex items-center gap-2 font-mono text-[11.5px] px-3 py-1.5 rounded-lg"
style={{
color: 'var(--intel)',
background: 'var(--intel-wash)',
border: '1px solid color-mix(in srgb, var(--intel) 28%, transparent)',
}}
title="Illustrative example of how a recall is attributed"
>
<Hexagon className="w-3.5 h-3.5" aria-hidden="true" />
<span>example · remembered from Claude Code · 14:22 · session a1f9</span>
</div>
</div>
<div className="mt-4 flex items-center gap-2 text-[12px] text-muted-foreground">
<Workflow className="w-3.5 h-3.5 shrink-0" aria-hidden="true" />
<span>This is how the wiring works. Switch to <b className="text-foreground/90 font-medium">Launch</b> to open an agent into this workspace.</span>
</div>
</div>
</ScrollArea>
);
};
export default LauncherApp;

View File

@@ -10,14 +10,12 @@ interface MissionControlAppProps {
/**
* AI-OS Phase 4 polish — compact inventory of installed AI tools at
* the top of Mission Control. One line: detected · installed ·
* hook-wired counts, with an "Open Launcher" button to jump to the
* dedicated dock app.
* the top of Mission Control. One line: detected · installed counts,
* with an "Open Launcher" button to jump to the dedicated dock app.
*/
interface ToolInventoryCounts {
detected: number;
installed: number;
hooked: number;
}
const MissionControlApp = ({ onSpawnOpen }: MissionControlAppProps) => {
@@ -43,7 +41,6 @@ const MissionControlApp = ({ onSpawnOpen }: MissionControlAppProps) => {
setToolCounts({
detected: ts.length,
installed: ts.filter((t) => t.installed).length,
hooked: ts.filter((t) => t.hooksInstalled).length,
});
}
if (fleet.status === 'rejected') {
@@ -104,8 +101,7 @@ const MissionControlApp = ({ onSpawnOpen }: MissionControlAppProps) => {
<Rocket className="w-3.5 h-3.5 text-amber-400 flex-shrink-0" />
<span className="text-muted-foreground">
<span className="text-foreground font-medium">{toolCounts.detected}</span> tools known ·{' '}
<span className="text-emerald-400 font-medium">{toolCounts.installed}</span> installed ·{' '}
<span className="text-amber-300 font-medium">{toolCounts.hooked}</span> hook-wired
<span className="text-emerald-400 font-medium">{toolCounts.installed}</span> installed
</span>
<div className="flex-1" />
<Button

View File

@@ -955,35 +955,6 @@ describe('P1b auth gate', () => {
await expect(call(a)).rejects.toThrow(AdapterHttpError);
});
it('manageHooks maps a non-2xx body into the { ok:false, stderr, code } envelope (not a throw)', async () => {
const a = new LocalAdapter(BASE);
routeMock(fetchSpy, [['/api/tools/hooks', () => jsonRes({ ok: false, action: 'install', stdout: '', stderr: 'permission denied', code: 1, error: 'install failed' }, 500)]]);
await expect(a.manageHooks({ id: 'claude-code', action: 'install' })).resolves.toMatchObject({
ok: false, stderr: 'permission denied', code: 1, error: 'install failed',
});
});
it('manageHooks preserves a structured hook failure without replacing it with HTTP status text', async () => {
const a = new LocalAdapter(BASE);
routeMock(fetchSpy, [['/api/tools/hooks', () => jsonRes({
ok: false,
action: 'verify',
packageName: '@waggle/hive-mind-hooks-claude-code',
stdout: '',
stderr: '',
code: 1,
}, 400)]]);
await expect(a.manageHooks({ id: 'claude-code', action: 'verify' })).resolves.toMatchObject({
ok: false,
action: 'verify',
stdout: '',
stderr: '',
code: 1,
error: undefined,
});
});
// ── Watchdog recovery + setServerUrl memo hygiene (review fixes) ─────────
it('after a hung-body timeout, the NEXT connect probes fresh (memo does not wedge re-arms)', async () => {

View File

@@ -3165,7 +3165,7 @@ class LocalAdapter {
};
// --- AI-OS launcher (Phase 2B) ---
// detectTools/launchTool/manageHooks each surface the matching
// detectTools/launchTool each surface the matching
// sidecar route. All are loopback-only and report only the user's
// own machine — no remote calls.
@@ -3286,38 +3286,6 @@ class LocalAdapter {
};
}
async manageHooks(payload: {
id: string;
action: 'install' | 'verify' | 'uninstall';
cliPath?: string;
}): Promise<{
ok: boolean;
action: string;
stdout: string;
stderr: string;
code: number;
error?: string;
}> {
// P1b D3: fetchRaw — hook-failure diagnostics (stderr/exit code) ride the error body.
const res = await this.fetchRaw('/api/tools/hooks', {
method: 'POST',
body: JSON.stringify(payload),
});
const body = await res.json().catch(() => ({}));
const hasHookEnvelope =
typeof body.ok === 'boolean' &&
typeof body.action === 'string' &&
typeof body.code === 'number';
return {
ok: res.ok && body.ok === true,
action: body.action ?? payload.action,
stdout: body.stdout ?? '',
stderr: body.stderr ?? '',
code: body.code ?? -1,
error: body.error ?? (res.ok || hasHookEnvelope ? undefined : `HTTP ${res.status}`),
};
}
/**
* P1b-SSE: shared EventSource lifecycle — token-attached, lazy-open,
* reconnecting. Fixes the three defects that made every stream dead in

View File

@@ -6,7 +6,6 @@ import {
Lock, Activity, History, BarChart3, Users, Radio,
Gauge, Monitor, LayoutGrid, Eye,
} from "lucide-react";
import { hasMemoryFeature } from "@/lib/memory-features";
/**
* Curated ⌘K catalog (design ref: design-files/screens/ia.html).
@@ -67,7 +66,7 @@ export function buildCommandCatalog(ctx: CatalogContext): CatalogGroup[] {
const doGroup: CatalogCommand[] = [
{ id: "start-task", group: "do", name: "Start a task", subtitle: "new agent run", icon: Plus, action: "spawn" },
{ id: "launch-agent", group: "do", name: "Launch a coding agent", subtitle: hasMemoryFeature("agentHooks") ? "Claude Code · Cursor · Codex, sharing this hive" : "Claude Code · Cursor · Codex", icon: Rocket, to: "/launcher" },
{ id: "launch-agent", group: "do", name: "Launch a coding agent", subtitle: "Claude Code · Cursor · Codex", icon: Rocket, to: "/launcher" },
{ id: "watch-agent", group: "do", name: "Watch a coding agent live", subtitle: "Claude Code · Cursor · Codex, live output", keywords: "observe pty terminal live output tail", icon: Eye, to: "/launcher?watch=1" },
{ id: "settings", group: "do", name: "Settings", subtitle: "models · failover · permissions", icon: Settings, to: "/settings" },
];

View File

@@ -3,10 +3,10 @@
*
* v1 memory is facts, search and the user profile. The knowledge graph follows
* the server's memory capability map (`GET /api/memory/capabilities`), which
* reports it unavailable in v1. History import, wiki, coding-agent hooks, Room
* and the memory MCP server are hidden in v1 by decision, whatever the store
* supports. Their screens stay in the code and every surface that offers one
* checks this module first.
* reports it unavailable in v1. History import, wiki and Room are hidden in v1
* by decision, whatever the store supports. Their screens stay in the code and
* every surface that offers one checks this module first. Coding-agent hooks
* and the memory MCP server left with their packages (P2.2).
*/
import { useEffect, useSyncExternalStore } from 'react';
import { adapter } from '@/lib/adapter';
@@ -19,12 +19,8 @@ export interface MemoryFeatures {
importHistory: boolean;
/** Compiled wiki pages. */
wiki: boolean;
/** Memory hooks installed into Claude Code, Codex and other coding agents. */
agentHooks: boolean;
/** Waggle Room: coding agents started as a team that shares one Room. */
room: boolean;
/** The Waggle memory MCP server for other clients. */
memoryMcp: boolean;
}
export type MemoryFeature = keyof MemoryFeatures;
@@ -33,9 +29,7 @@ export type MemoryFeature = keyof MemoryFeatures;
const HIDDEN_IN_V1: Readonly<Record<Exclude<MemoryFeature, 'knowledgeGraph'>, false>> = {
importHistory: false,
wiki: false,
agentHooks: false,
room: false,
memoryMcp: false,
};
let current: MemoryCapabilitiesResponse | null = null;

View File

@@ -6,7 +6,6 @@ const mocks = vi.hoisted(() => ({
detectTools: vi.fn(),
getToolProcesses: vi.fn(),
launchTool: vi.fn(),
manageHooks: vi.fn(),
killTool: vi.fn(),
},
}));

View File

@@ -40,7 +40,7 @@ afterEach(() => {
});
describe('memory feature map (v1 defaults)', () => {
it.each<MemoryFeature>(['knowledgeGraph', 'importHistory', 'wiki', 'agentHooks', 'room', 'memoryMcp'])(
it.each<MemoryFeature>(['knowledgeGraph', 'importHistory', 'wiki', 'room'])(
'%s is hidden',
(feature) => {
expect(hasMemoryFeature(feature)).toBe(false);
@@ -68,7 +68,7 @@ describe('memory feature map from the server capabilities', () => {
it('keeps import, wiki, hooks, Room and the memory MCP hidden whatever the store reports', () => {
setMemoryCapabilities(report(true));
for (const feature of ['importHistory', 'wiki', 'agentHooks', 'room', 'memoryMcp'] as const) {
for (const feature of ['importHistory', 'wiki', 'room'] as const) {
expect(hasMemoryFeature(feature), feature).toBe(false);
}
});