refactor: remove Waggle Room captured tasks for external coding agents
Waggle Room is not part of the community edition (decision Q2, ADR-0002). Its headless runs of Claude Code, Codex, Hermes and OpenClaw needed the packaged collaboration CLI from the removed @waggle/hive-mind-cli, so POST /api/tools/run answered 503 collaboration_runtime_missing. - Remove POST /api/tools/run (routes/external-tool-runs.ts) with its Room fan-out, WaggleDance publishing, OpenClaw provisioning and the memory write-back of run results. - Remove runExternalTool (agent/external-tool-runner.ts) and resolveWaggleRuntime; the taskkill path helper moves into the process tracker, its only remaining user. - Launcher: drop the hidden "Run task" composer, the Room hand-off and adapter.runExternalToolTask. Detect, launch, watch and stop stay. - Drop the `room` flag from the memory feature map: it only gated the Launcher task button. - The viewer policy no longer reads participants[].workspaceIds, a body shape only /api/tools/run accepted.
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
/**
|
||||
* LauncherApp — detect, launch, watch and stop external AI tools.
|
||||
*
|
||||
* 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';
|
||||
@@ -14,15 +10,11 @@ const mocks = vi.hoisted(() => ({
|
||||
getToolProcesses: vi.fn(),
|
||||
launchTool: vi.fn(),
|
||||
killTool: vi.fn(),
|
||||
runExternalToolTask: vi.fn(),
|
||||
streamToolOutput: vi.fn(() => () => {}),
|
||||
},
|
||||
}));
|
||||
vi.mock('@/lib/adapter', () => ({ adapter: mocks.adapter, default: vi.fn() }));
|
||||
|
||||
const features = vi.hoisted(() => ({ enabled: true }));
|
||||
vi.mock('@/lib/memory-features', () => ({ hasMemoryFeature: () => features.enabled }));
|
||||
|
||||
import LauncherApp, { resetLauncherRouteCache } from './LauncherApp';
|
||||
|
||||
const detectionResp = {
|
||||
@@ -40,16 +32,11 @@ const detectionResp = {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
features.enabled = true;
|
||||
resetLauncherRouteCache();
|
||||
mocks.adapter.detectTools.mockResolvedValue(detectionResp);
|
||||
mocks.adapter.getToolProcesses.mockResolvedValue({ processes: [] });
|
||||
mocks.adapter.launchTool.mockResolvedValue({ ok: true, pid: 123 });
|
||||
mocks.adapter.killTool.mockResolvedValue({ ok: true, pid: 123, reason: 'SIGTERM' });
|
||||
mocks.adapter.runExternalToolTask.mockResolvedValue({
|
||||
roomId: 'room-1',
|
||||
runs: [{ runId: 'run-1', workspaceId: 'ws-1', status: 'queued', statusUrl: '/api/agent-runs/run-1' }],
|
||||
});
|
||||
});
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
@@ -91,181 +78,36 @@ describe('LauncherApp · live output (#4)', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('LauncherApp · captured tasks', () => {
|
||||
it('fans Codex and Hermes into two workspaces and opens their shared Room', async () => {
|
||||
const onOpenRoom = vi.fn();
|
||||
mocks.adapter.detectTools.mockResolvedValue({
|
||||
platform: 'darwin',
|
||||
detectedAt: '2026-07-11T00:00:00.000Z',
|
||||
tools: [
|
||||
{
|
||||
id: 'codex',
|
||||
displayName: 'Codex CLI',
|
||||
installed: true,
|
||||
installedPath: '/usr/local/bin/codex',
|
||||
version: '0.144.1',
|
||||
capabilities: {
|
||||
interactiveLaunch: true,
|
||||
headlessTask: true,
|
||||
structuredProgress: true,
|
||||
resumable: true,
|
||||
liveWaggleDance: false,
|
||||
},
|
||||
permissionModes: ['read-only', 'workspace-write', 'native'],
|
||||
},
|
||||
{
|
||||
id: 'hermes',
|
||||
displayName: 'Hermes',
|
||||
installed: true,
|
||||
installedPath: '/usr/local/bin/hermes',
|
||||
version: '1.0.0',
|
||||
capabilities: {
|
||||
interactiveLaunch: true,
|
||||
headlessTask: true,
|
||||
structuredProgress: true,
|
||||
resumable: true,
|
||||
liveWaggleDance: true,
|
||||
},
|
||||
permissionModes: ['native'],
|
||||
},
|
||||
{
|
||||
id: 'cursor',
|
||||
displayName: 'Cursor',
|
||||
installed: true,
|
||||
installedPath: '/Applications/Cursor.app',
|
||||
version: '1.0.0',
|
||||
capabilities: {
|
||||
interactiveLaunch: true,
|
||||
headlessTask: false,
|
||||
structuredProgress: false,
|
||||
resumable: false,
|
||||
liveWaggleDance: false,
|
||||
},
|
||||
permissionModes: [],
|
||||
},
|
||||
{
|
||||
id: 'openclaw',
|
||||
displayName: 'OpenClaw',
|
||||
installed: false,
|
||||
installedPath: null,
|
||||
version: null,
|
||||
capabilities: {
|
||||
interactiveLaunch: true,
|
||||
headlessTask: true,
|
||||
structuredProgress: true,
|
||||
resumable: true,
|
||||
liveWaggleDance: true,
|
||||
},
|
||||
permissionModes: ['native'],
|
||||
},
|
||||
],
|
||||
});
|
||||
mocks.adapter.runExternalToolTask.mockResolvedValue({
|
||||
roomId: 'room-multi',
|
||||
runs: [
|
||||
{ runId: 'codex-a', toolId: 'codex', workspaceId: 'ws-a', status: 'queued', statusUrl: '/api/agent-runs/codex-a' },
|
||||
{ runId: 'codex-b', toolId: 'codex', workspaceId: 'ws-b', status: 'queued', statusUrl: '/api/agent-runs/codex-b' },
|
||||
{ runId: 'hermes-a', toolId: 'hermes', workspaceId: 'ws-a', status: 'queued', statusUrl: '/api/agent-runs/hermes-a' },
|
||||
{ runId: 'hermes-b', toolId: 'hermes', workspaceId: 'ws-b', status: 'queued', statusUrl: '/api/agent-runs/hermes-b' },
|
||||
{ runId: 'synthesis', toolId: 'hermes', workspaceId: 'ws-b', status: 'queued', statusUrl: '/api/agent-runs/synthesis' },
|
||||
],
|
||||
});
|
||||
|
||||
render(
|
||||
<LauncherApp
|
||||
activeWorkspaceId="ws-a"
|
||||
workspaces={[
|
||||
{ id: 'ws-a', name: 'Alpha' },
|
||||
{ id: 'ws-b', name: 'Beta' },
|
||||
]}
|
||||
onOpenRoom={onOpenRoom}
|
||||
/>,
|
||||
);
|
||||
|
||||
const codexCard = await screen.findByTestId('launcher-tool-codex');
|
||||
fireEvent.click(within(codexCard).getByRole('button', { name: /run task/i }));
|
||||
expect(screen.getByRole('checkbox', { name: 'Codex CLI' })).toBeChecked();
|
||||
expect(screen.getByRole('checkbox', { name: 'Hermes' })).not.toBeChecked();
|
||||
expect(screen.queryByRole('checkbox', { name: 'Cursor' })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('checkbox', { name: 'OpenClaw' })).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('checkbox', { name: 'Hermes' }));
|
||||
fireEvent.change(screen.getByRole('combobox', { name: 'Access for Codex CLI' }), {
|
||||
target: { value: 'workspace-write' },
|
||||
});
|
||||
expect(screen.getByRole('combobox', { name: 'Access for Hermes' })).toHaveValue('native');
|
||||
expect(screen.getByRole('checkbox', { name: 'Alpha' })).toBeChecked();
|
||||
fireEvent.click(screen.getByRole('checkbox', { name: 'Beta' }));
|
||||
fireEvent.change(screen.getByLabelText('Task for Codex CLI'), {
|
||||
target: { value: ' Compare both implementations ' },
|
||||
});
|
||||
fireEvent.click(screen.getByRole('button', { name: /start in room/i }));
|
||||
|
||||
await waitFor(() => expect(mocks.adapter.runExternalToolTask).toHaveBeenCalledWith({
|
||||
participants: [
|
||||
{ toolId: 'codex', access: 'workspace-write' },
|
||||
{ toolId: 'hermes', access: 'native' },
|
||||
],
|
||||
workspaceIds: ['ws-a', 'ws-b'],
|
||||
prompt: 'Compare both implementations',
|
||||
}));
|
||||
expect(screen.getByText('Started 2 agents across 2 workspaces (5 worker runs). Opening Room.')).toBeInTheDocument();
|
||||
expect(onOpenRoom).toHaveBeenCalledWith('room-multi');
|
||||
});
|
||||
|
||||
it('labels a roadmap tool and offers no launch or task actions', async () => {
|
||||
describe('LauncherApp · availability', () => {
|
||||
it('labels a roadmap tool and offers no launch action', async () => {
|
||||
mocks.adapter.detectTools.mockResolvedValue({
|
||||
platform: 'darwin',
|
||||
detectedAt: '2026-07-11T00:00:00.000Z',
|
||||
tools: [{
|
||||
id: 'cursor',
|
||||
displayName: 'Cursor',
|
||||
releaseStatus: 'roadmap',
|
||||
launchable: false,
|
||||
id: 'cursor',
|
||||
displayName: 'Cursor',
|
||||
releaseStatus: 'roadmap',
|
||||
launchable: false,
|
||||
installed: true,
|
||||
installedPath: '/Applications/Cursor.app',
|
||||
version: '1.0.0',
|
||||
capabilities: {
|
||||
interactiveLaunch: true,
|
||||
headlessTask: false,
|
||||
structuredProgress: false,
|
||||
resumable: false,
|
||||
liveWaggleDance: false,
|
||||
},
|
||||
permissionModes: [],
|
||||
}],
|
||||
});
|
||||
|
||||
render(<LauncherApp workspaces={[{ id: 'ws-a', name: 'Alpha' }]} />);
|
||||
render(<LauncherApp />);
|
||||
|
||||
const card = await screen.findByTestId('launcher-tool-cursor');
|
||||
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).queryByRole('button', { name: /^launch$/i })).not.toBeInTheDocument();
|
||||
expect(within(card).queryByRole('button', { name: /run task/i })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('launches Hermes Desktop but excludes it and a broken CLI from captured teams', async () => {
|
||||
it('launches Hermes Desktop and explains why a broken Hermes CLI cannot launch', async () => {
|
||||
mocks.adapter.detectTools.mockResolvedValue({
|
||||
platform: 'win32',
|
||||
detectedAt: '2026-07-17T00:00:00.000Z',
|
||||
tools: [
|
||||
{
|
||||
id: 'codex',
|
||||
displayName: 'Codex CLI',
|
||||
installed: true,
|
||||
installedPath: 'C:\\tools\\codex.exe',
|
||||
version: '0.144.1',
|
||||
launchable: true,
|
||||
capabilities: {
|
||||
interactiveLaunch: true,
|
||||
headlessTask: true,
|
||||
structuredProgress: true,
|
||||
resumable: true,
|
||||
liveWaggleDance: false,
|
||||
},
|
||||
permissionModes: ['read-only', 'workspace-write', 'native'],
|
||||
},
|
||||
{
|
||||
id: 'hermes',
|
||||
displayName: 'Hermes Agent CLI',
|
||||
@@ -274,14 +116,6 @@ describe('LauncherApp · captured tasks', () => {
|
||||
version: null,
|
||||
launchable: false,
|
||||
diagnostic: 'Hermes failed its --version health check.',
|
||||
capabilities: {
|
||||
interactiveLaunch: true,
|
||||
headlessTask: true,
|
||||
structuredProgress: false,
|
||||
resumable: true,
|
||||
liveWaggleDance: false,
|
||||
},
|
||||
permissionModes: ['native'],
|
||||
},
|
||||
{
|
||||
id: 'hermes-desktop',
|
||||
@@ -290,32 +124,39 @@ describe('LauncherApp · captured tasks', () => {
|
||||
installedPath: 'C:\\Users\\test\\AppData\\Local\\hermes\\Hermes.exe',
|
||||
version: null,
|
||||
launchable: true,
|
||||
capabilities: {
|
||||
interactiveLaunch: true,
|
||||
headlessTask: false,
|
||||
structuredProgress: false,
|
||||
resumable: false,
|
||||
liveWaggleDance: false,
|
||||
},
|
||||
permissionModes: [],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
render(<LauncherApp workspaces={[{ id: 'ws-a', name: 'Alpha' }]} />);
|
||||
render(<LauncherApp />);
|
||||
|
||||
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();
|
||||
|
||||
const cliCard = screen.getByTestId('launcher-tool-hermes');
|
||||
expect(within(cliCard).queryByRole('button', { name: /^launch$/i })).not.toBeInTheDocument();
|
||||
expect(within(cliCard).queryByRole('button', { name: /run task/i })).not.toBeInTheDocument();
|
||||
expect(within(cliCard).getByText(/failed its --version health check/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
fireEvent.click(within(screen.getByTestId('launcher-tool-codex')).getByRole('button', { name: /run task/i }));
|
||||
expect(screen.queryByRole('checkbox', { name: 'Hermes Agent CLI' })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('checkbox', { name: 'Hermes Desktop' })).not.toBeInTheDocument();
|
||||
it('offers no captured-task controls: Waggle Room is not part of this edition', async () => {
|
||||
mocks.adapter.detectTools.mockResolvedValue({
|
||||
platform: 'darwin',
|
||||
detectedAt: '2026-07-11T00:00:00.000Z',
|
||||
tools: [{
|
||||
id: 'codex',
|
||||
displayName: 'Codex CLI',
|
||||
installed: true,
|
||||
installedPath: '/usr/local/bin/codex',
|
||||
version: '0.144.1',
|
||||
}],
|
||||
});
|
||||
|
||||
render(<LauncherApp />);
|
||||
|
||||
const card = await screen.findByTestId('launcher-tool-codex');
|
||||
expect(within(card).getByRole('button', { name: /^launch$/i })).toBeInTheDocument();
|
||||
expect(within(card).queryByRole('button', { name: /run task/i })).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(/room/i)).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -409,30 +250,3 @@ describe('LauncherApp · launch', () => {
|
||||
expect(screen.getByRole('button', { name: /^launch$/i })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('LauncherApp · v1 memory features (ADR-0002)', () => {
|
||||
it('hides Room tasks; launch stays', async () => {
|
||||
features.enabled = false;
|
||||
mocks.adapter.detectTools.mockResolvedValue({
|
||||
platform: 'darwin',
|
||||
detectedAt: '2026-07-11T00:00:00.000Z',
|
||||
tools: [
|
||||
{
|
||||
id: 'codex',
|
||||
displayName: 'Codex CLI',
|
||||
installed: true,
|
||||
installedPath: '/usr/local/bin/codex',
|
||||
version: '0.144.1',
|
||||
capabilities: { interactiveLaunch: true, headlessTask: true, structuredProgress: true, resumable: true },
|
||||
permissionModes: ['read-only', 'workspace-write', 'native'],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
render(<LauncherApp />);
|
||||
|
||||
expect(await screen.findByText('Codex CLI')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /^launch$/i })).toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: /run task/i })).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,13 +14,12 @@
|
||||
import { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
import {
|
||||
Rocket, RefreshCw, CheckCircle2, XCircle, AlertTriangle,
|
||||
Play, Loader2, MessageSquare, Square, Workflow,
|
||||
Play, Loader2, MessageSquare, Square,
|
||||
} from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { ScrollArea } from '@/components/ui/scroll-area';
|
||||
import { adapter } from '@/lib/adapter';
|
||||
import { hasMemoryFeature } from '@/lib/memory-features';
|
||||
import { createSurfaceCache } from '@/lib/surface-cache';
|
||||
import {
|
||||
promptArgsForTool,
|
||||
@@ -29,8 +28,6 @@ import {
|
||||
import { ToolOutputPane } from './launcher/ToolOutputPane';
|
||||
import {
|
||||
BUILTIN_TOOL_MANIFESTS,
|
||||
type ExternalToolAccess,
|
||||
type ToolCapabilities,
|
||||
type ToolReleaseStatus,
|
||||
} from '@waggle/shared';
|
||||
|
||||
@@ -46,8 +43,6 @@ interface DetectedTool {
|
||||
launchable?: boolean;
|
||||
builtin?: boolean;
|
||||
acceptsInlinePrompt?: boolean;
|
||||
capabilities?: ToolCapabilities;
|
||||
permissionModes?: readonly ExternalToolAccess[];
|
||||
installed: boolean;
|
||||
installedPath: string | null;
|
||||
version: string | null;
|
||||
@@ -60,25 +55,15 @@ interface DetectionResult {
|
||||
tools: DetectedTool[];
|
||||
}
|
||||
|
||||
type ToolAction = 'launch' | 'run';
|
||||
|
||||
interface ActionState {
|
||||
toolId: string;
|
||||
action: ToolAction;
|
||||
}
|
||||
|
||||
interface ActionResult {
|
||||
toolId: string;
|
||||
action: ToolAction;
|
||||
ok: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface LauncherAppProps {
|
||||
/** Active workspace id — injected into spawned tools as WAGGLE_WORKSPACE_ID. */
|
||||
/** Active workspace: the launched tool starts in its folder. */
|
||||
activeWorkspaceId?: string;
|
||||
workspaces?: Array<{ id: string; name: string; status?: string }>;
|
||||
onOpenRoom?: (roomId: string) => void;
|
||||
}
|
||||
|
||||
/** Keep tool detection visible while the Launcher revalidates on return. */
|
||||
@@ -95,7 +80,7 @@ const toolCanLaunch = (tool: DetectedTool): boolean =>
|
||||
|
||||
const launchUnavailableMessage = (tool: DetectedTool): string =>
|
||||
tool.releaseStatus === 'roadmap'
|
||||
? 'Roadmap integration. Detection retained for compatibility; launch and tasks are deferred.'
|
||||
? 'Roadmap integration. Detection retained for compatibility; launch is 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.';
|
||||
@@ -103,38 +88,15 @@ const launchUnavailableMessage = (tool: DetectedTool): string =>
|
||||
const toolUsesInlinePrompt = (tool: DetectedTool): boolean =>
|
||||
toolAcceptsInlinePrompt(tool.id) || tool.acceptsInlinePrompt === true;
|
||||
|
||||
const ACCESS_LABELS: Record<ExternalToolAccess, string> = {
|
||||
'read-only': 'Read only',
|
||||
'workspace-write': 'Workspace write',
|
||||
native: 'Native permissions',
|
||||
};
|
||||
|
||||
const defaultAccessForTool = (tool: DetectedTool): ExternalToolAccess | null => {
|
||||
const modes = tool.permissionModes ?? [];
|
||||
return modes.includes('read-only') ? 'read-only' : (modes[0] ?? null);
|
||||
};
|
||||
|
||||
const toolCanRunCapturedTask = (tool: DetectedTool): boolean =>
|
||||
tool.installed &&
|
||||
toolCanLaunch(tool) &&
|
||||
tool.capabilities?.headlessTask === true &&
|
||||
(tool.permissionModes?.length ?? 0) > 0;
|
||||
|
||||
const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: LauncherAppProps = {}) => {
|
||||
// ADR-0002: Waggle Room is hidden in v1 (memory feature map). Launch, watch
|
||||
// and stop stay.
|
||||
const roomShown = hasMemoryFeature('room');
|
||||
const LauncherApp = ({ activeWorkspaceId }: LauncherAppProps = {}) => {
|
||||
const cachedDetection = launcherRouteCache.read('tools');
|
||||
const [detection, setDetection] = useState<DetectionResult | null>(cachedDetection ?? null);
|
||||
const [loading, setLoading] = useState(() => !launcherRouteCache.hasResolved('tools'));
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [activeAction, setActiveAction] = useState<ActionState | null>(null);
|
||||
/** Tool whose launch or stop request is in flight. */
|
||||
const [activeToolId, setActiveToolId] = useState<string | null>(null);
|
||||
const [lastResult, setLastResult] = useState<ActionResult | null>(null);
|
||||
const [prompt, setPrompt] = useState('');
|
||||
const [taskToolId, setTaskToolId] = useState<string | null>(null);
|
||||
const [taskPrompt, setTaskPrompt] = useState('');
|
||||
const [taskWorkspaceIds, setTaskWorkspaceIds] = useState<string[]>([]);
|
||||
const [taskParticipants, setTaskParticipants] = useState<Record<string, ExternalToolAccess>>({});
|
||||
/**
|
||||
* AI-OS Phase 4 polish — set of tool ids currently running (at
|
||||
* least one tracked + alive pid). Used to render the 'Running'
|
||||
@@ -225,13 +187,12 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
|
||||
const pids = pidsByTool.get(tool.id) ?? [];
|
||||
const pid = pids[0];
|
||||
if (!pid) return;
|
||||
setActiveAction({ toolId: tool.id, action: 'launch' }); // reuse launch spinner slot
|
||||
setActiveToolId(tool.id);
|
||||
setLastResult(null);
|
||||
try {
|
||||
const r = await adapter.killTool(pid);
|
||||
setLastResult({
|
||||
toolId: tool.id,
|
||||
action: 'launch',
|
||||
ok: r.ok,
|
||||
message: r.ok
|
||||
? `Stopped ${tool.displayName} (pid ${r.pid}, ${r.reason})`
|
||||
@@ -252,12 +213,11 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
|
||||
} catch (err) {
|
||||
setLastResult({
|
||||
toolId: tool.id,
|
||||
action: 'launch',
|
||||
ok: false,
|
||||
message: err instanceof Error ? err.message : 'Stop failed',
|
||||
});
|
||||
} finally {
|
||||
setActiveAction(null);
|
||||
setActiveToolId(null);
|
||||
}
|
||||
},
|
||||
[pidsByTool],
|
||||
@@ -265,14 +225,12 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
|
||||
|
||||
const launchSelectedTool = useCallback(
|
||||
async (tool: DetectedTool) => {
|
||||
const action = 'launch';
|
||||
setActiveAction({ toolId: tool.id, action });
|
||||
setActiveToolId(tool.id);
|
||||
setLastResult(null);
|
||||
try {
|
||||
if (!tool.installedPath) {
|
||||
setLastResult({
|
||||
toolId: tool.id,
|
||||
action,
|
||||
ok: false,
|
||||
message: 'Tool not installed. Cannot launch.',
|
||||
});
|
||||
@@ -296,7 +254,6 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
|
||||
const promptNote = (args || sendsRawPrompt) ? ' with prompt' : '';
|
||||
setLastResult({
|
||||
toolId: tool.id,
|
||||
action,
|
||||
ok: r.ok,
|
||||
message: r.ok
|
||||
? `Launched ${tool.displayName}${promptNote} (pid ${r.pid})`
|
||||
@@ -310,95 +267,17 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
|
||||
} catch (err) {
|
||||
setLastResult({
|
||||
toolId: tool.id,
|
||||
action,
|
||||
ok: false,
|
||||
message: err instanceof Error ? err.message : 'Action failed',
|
||||
});
|
||||
} finally {
|
||||
setActiveAction(null);
|
||||
setActiveToolId(null);
|
||||
}
|
||||
},
|
||||
[activeWorkspaceId, prompt, watchMode],
|
||||
);
|
||||
|
||||
const tools = useMemo<DetectedTool[]>(() => detection?.tools ?? [], [detection]);
|
||||
const availableWorkspaces = useMemo(
|
||||
() => workspaces.filter((workspace) => workspace.status !== 'archived'),
|
||||
[workspaces],
|
||||
);
|
||||
const taskCapableTools = useMemo(
|
||||
() => tools.filter(toolCanRunCapturedTask),
|
||||
[tools],
|
||||
);
|
||||
|
||||
const openTaskComposer = useCallback((tool: DetectedTool) => {
|
||||
const defaultAccess = defaultAccessForTool(tool);
|
||||
if (!defaultAccess) return;
|
||||
const defaultWorkspace = availableWorkspaces.find((workspace) => workspace.id === activeWorkspaceId)
|
||||
?? availableWorkspaces[0];
|
||||
setTaskToolId(tool.id);
|
||||
setTaskPrompt('');
|
||||
setTaskWorkspaceIds(defaultWorkspace ? [defaultWorkspace.id] : []);
|
||||
setTaskParticipants({ [tool.id]: defaultAccess });
|
||||
setLastResult(null);
|
||||
}, [activeWorkspaceId, availableWorkspaces]);
|
||||
|
||||
const toggleTaskParticipant = useCallback((tool: DetectedTool) => {
|
||||
const defaultAccess = defaultAccessForTool(tool);
|
||||
if (!defaultAccess) return;
|
||||
setTaskParticipants((current) => {
|
||||
if (current[tool.id]) {
|
||||
const next = { ...current };
|
||||
delete next[tool.id];
|
||||
return next;
|
||||
}
|
||||
return { ...current, [tool.id]: defaultAccess };
|
||||
});
|
||||
}, []);
|
||||
|
||||
const toggleTaskWorkspace = useCallback((workspaceId: string) => {
|
||||
setTaskWorkspaceIds((current) => current.includes(workspaceId)
|
||||
? current.filter((id) => id !== workspaceId)
|
||||
: [...current, workspaceId]);
|
||||
}, []);
|
||||
|
||||
const runCapturedTask = useCallback(async (tool: DetectedTool) => {
|
||||
const task = taskPrompt.trim();
|
||||
const participants = taskCapableTools.flatMap((candidate) => {
|
||||
const access = taskParticipants[candidate.id];
|
||||
return access ? [{ toolId: candidate.id, access }] : [];
|
||||
});
|
||||
if (!task || participants.length === 0 || taskWorkspaceIds.length === 0) return;
|
||||
setActiveAction({ toolId: tool.id, action: 'run' });
|
||||
setLastResult(null);
|
||||
try {
|
||||
const result = await adapter.runExternalToolTask({
|
||||
participants,
|
||||
workspaceIds: taskWorkspaceIds,
|
||||
prompt: task,
|
||||
});
|
||||
setLastResult({
|
||||
toolId: tool.id,
|
||||
action: 'run',
|
||||
ok: true,
|
||||
message: `Started ${participants.length} agent${participants.length === 1 ? '' : 's'} across ${taskWorkspaceIds.length} workspace${taskWorkspaceIds.length === 1 ? '' : 's'} (${result.runs.length} worker run${result.runs.length === 1 ? '' : 's'}). Opening Room.`,
|
||||
});
|
||||
setTaskPrompt('');
|
||||
setTaskToolId(null);
|
||||
setTaskParticipants({});
|
||||
onOpenRoom?.(result.roomId);
|
||||
} catch (err) {
|
||||
setLastResult({
|
||||
toolId: tool.id,
|
||||
action: 'run',
|
||||
ok: false,
|
||||
message: err instanceof Error ? err.message : 'Captured task failed to start',
|
||||
});
|
||||
} finally {
|
||||
setActiveAction(null);
|
||||
}
|
||||
}, [onOpenRoom, taskCapableTools, taskParticipants, taskPrompt, taskWorkspaceIds]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-full bg-background text-foreground">
|
||||
{/* Header — title + refresh */}
|
||||
@@ -516,7 +395,7 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
|
||||
)}
|
||||
{tools.map((tool) => {
|
||||
const launchable = toolCanLaunch(tool);
|
||||
const isActive = activeAction?.toolId === tool.id;
|
||||
const isActive = activeToolId === tool.id;
|
||||
return (
|
||||
<div
|
||||
key={tool.id}
|
||||
@@ -576,168 +455,36 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche
|
||||
|
||||
{/* Actions row */}
|
||||
{launchable && tool.installed && (
|
||||
<>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
className="h-7 text-[11px]"
|
||||
onClick={() => launchSelectedTool(tool)}
|
||||
disabled={isActive}
|
||||
>
|
||||
{isActive ? (
|
||||
<Loader2 className="w-3 h-3 animate-spin mr-1" />
|
||||
) : (
|
||||
<Play className="w-3 h-3 mr-1" />
|
||||
)}
|
||||
Launch
|
||||
</Button>
|
||||
{runningTools.has(tool.id) && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
variant="ghost"
|
||||
className="h-7 text-[11px]"
|
||||
onClick={() => launchSelectedTool(tool)}
|
||||
style={{ color: 'var(--risk)' }}
|
||||
onClick={() => stopTool(tool)}
|
||||
disabled={isActive}
|
||||
title="Send SIGTERM (escalates to SIGKILL after 3s if needed)"
|
||||
>
|
||||
{isActive && activeAction?.action === 'launch' ? (
|
||||
<Loader2 className="w-3 h-3 animate-spin mr-1" />
|
||||
) : (
|
||||
<Play className="w-3 h-3 mr-1" />
|
||||
)}
|
||||
Launch
|
||||
<Square className="w-3 h-3 mr-1" />
|
||||
Stop
|
||||
</Button>
|
||||
{roomShown && toolCanRunCapturedTask(tool) && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="default"
|
||||
className="h-7 text-[11px]"
|
||||
onClick={() => openTaskComposer(tool)}
|
||||
disabled={isActive}
|
||||
>
|
||||
{isActive && activeAction?.action === 'run' ? (
|
||||
<Loader2 className="w-3 h-3 animate-spin mr-1" />
|
||||
) : (
|
||||
<Workflow className="w-3 h-3 mr-1" />
|
||||
)}
|
||||
Run task
|
||||
</Button>
|
||||
)}
|
||||
{runningTools.has(tool.id) && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
className="h-7 text-[11px]"
|
||||
style={{ color: 'var(--risk)' }}
|
||||
onClick={() => stopTool(tool)}
|
||||
disabled={isActive}
|
||||
title="Send SIGTERM (escalates to SIGKILL after 3s if needed)"
|
||||
>
|
||||
<Square className="w-3 h-3 mr-1" />
|
||||
Stop
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
{roomShown && taskToolId === tool.id && toolCanRunCapturedTask(tool) && (
|
||||
<div
|
||||
className="rounded-lg border border-primary/30 bg-primary/5 p-3 space-y-3"
|
||||
data-testid={`captured-task-${tool.id}`}
|
||||
>
|
||||
<div>
|
||||
<p className="text-xs font-display font-semibold text-foreground">
|
||||
Captured agent team · started from {tool.displayName}
|
||||
</p>
|
||||
<p className="text-[11px] text-muted-foreground mt-0.5">
|
||||
Each selected agent runs once per workspace. Progress, results, and memory return to one Room.
|
||||
</p>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<label htmlFor={`captured-task-prompt-${tool.id}`} className="text-[11px] font-medium text-foreground">
|
||||
Task
|
||||
</label>
|
||||
<textarea
|
||||
id={`captured-task-prompt-${tool.id}`}
|
||||
aria-label={`Task for ${tool.displayName}`}
|
||||
value={taskPrompt}
|
||||
onChange={(event) => setTaskPrompt(event.target.value)}
|
||||
rows={3}
|
||||
placeholder="Describe the result this agent should deliver…"
|
||||
className="w-full text-xs bg-background border border-border/50 rounded p-2 resize-y min-h-[64px] max-h-[220px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
/>
|
||||
</div>
|
||||
<fieldset className="space-y-1.5">
|
||||
<legend className="text-[11px] font-medium text-foreground">Agents</legend>
|
||||
<div className="space-y-1.5">
|
||||
{taskCapableTools.map((candidate) => {
|
||||
const access = taskParticipants[candidate.id];
|
||||
return (
|
||||
<div
|
||||
key={candidate.id}
|
||||
className="flex flex-wrap items-center justify-between gap-2 rounded border border-border/40 bg-background/60 px-2 py-1.5"
|
||||
>
|
||||
<label className="flex items-center gap-2 text-[11px] text-foreground cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
aria-label={candidate.displayName}
|
||||
checked={access !== undefined}
|
||||
onChange={() => toggleTaskParticipant(candidate)}
|
||||
/>
|
||||
<span>{candidate.displayName}</span>
|
||||
</label>
|
||||
{access && (
|
||||
<select
|
||||
aria-label={`Access for ${candidate.displayName}`}
|
||||
value={access}
|
||||
onChange={(event) => setTaskParticipants((current) => ({
|
||||
...current,
|
||||
[candidate.id]: event.target.value as ExternalToolAccess,
|
||||
}))}
|
||||
className="h-7 rounded border border-border/50 bg-background px-2 text-[11px] text-foreground"
|
||||
>
|
||||
{(candidate.permissionModes ?? []).map((mode) => (
|
||||
<option key={mode} value={mode}>{ACCESS_LABELS[mode]}</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset className="space-y-1.5">
|
||||
<legend className="text-[11px] font-medium text-foreground">Workspaces</legend>
|
||||
{availableWorkspaces.length > 0 ? (
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-1.5">
|
||||
{availableWorkspaces.map((workspace) => (
|
||||
<label
|
||||
key={workspace.id}
|
||||
className="flex items-center gap-2 rounded border border-border/40 bg-background/60 px-2 py-1.5 text-[11px] text-foreground cursor-pointer"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={taskWorkspaceIds.includes(workspace.id)}
|
||||
onChange={() => toggleTaskWorkspace(workspace.id)}
|
||||
/>
|
||||
<span className="truncate">{workspace.name}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-[11px] text-muted-foreground">Create a workspace before running a captured task.</p>
|
||||
)}
|
||||
</fieldset>
|
||||
<div className="flex items-center justify-end gap-1.5">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
className="h-7 text-[11px]"
|
||||
onClick={() => setTaskToolId(null)}
|
||||
disabled={isActive}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
className="h-7 text-[11px]"
|
||||
onClick={() => void runCapturedTask(tool)}
|
||||
disabled={isActive || !taskPrompt.trim() || Object.keys(taskParticipants).length === 0 || taskWorkspaceIds.length === 0}
|
||||
>
|
||||
{isActive && activeAction?.action === 'run' ? (
|
||||
<Loader2 className="w-3 h-3 animate-spin mr-1" />
|
||||
) : (
|
||||
<Workflow className="w-3 h-3 mr-1" />
|
||||
)}
|
||||
Start in Room
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
{launchable && !tool.installed && (
|
||||
<div className="text-[11px] text-muted-foreground">
|
||||
|
||||
@@ -34,7 +34,7 @@ import type {
|
||||
ConnectorDefinition, ConnectorHealth, McpInstance, ExtensionType,
|
||||
InterpretResult, ResolvedAction,
|
||||
CollaborationRun, CollaborationRunEvent, CollaborationRunSnapshot,
|
||||
CollaborationRunControl, ExternalToolAccess, ToolDetectionResult,
|
||||
CollaborationRunControl, ToolDetectionResult,
|
||||
} from '@waggle/shared';
|
||||
|
||||
export interface SpawnAgentResult {
|
||||
@@ -1927,26 +1927,6 @@ class LocalAdapter {
|
||||
return body.run;
|
||||
}
|
||||
|
||||
async runExternalToolTask(data: {
|
||||
workspaceIds: string[];
|
||||
prompt: string;
|
||||
timeoutMs?: number;
|
||||
sessionIds?: Record<string, string>;
|
||||
} & (
|
||||
| { toolId: string; access?: ExternalToolAccess; participants?: never }
|
||||
| {
|
||||
participants: Array<{ toolId: string; access: ExternalToolAccess }>;
|
||||
toolId?: never;
|
||||
access?: never;
|
||||
}
|
||||
)): Promise<{
|
||||
roomId: string;
|
||||
runs: Array<{ runId: string; workspaceId: string; toolId?: string; status: string; statusUrl: string }>;
|
||||
}> {
|
||||
const res = await this.fetch('/api/tools/run', { method: 'POST', body: JSON.stringify(data) });
|
||||
return res.json();
|
||||
}
|
||||
|
||||
async listAgents(): Promise<Agent[]> {
|
||||
const res = await this.fetch('/api/agents');
|
||||
if (!res.ok) throw new Error(`listAgents failed: ${res.status}`);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* claude-code → ['--print', prompt]
|
||||
* openclaw → ['--print', prompt] (Claude Code fork)
|
||||
* codex → [prompt] (positional arg)
|
||||
* hermes → null (captured-task API only)
|
||||
* hermes → null (no verified inline prompt)
|
||||
* hermes-desktop → null (GUI only)
|
||||
* cursor → null (folder-based; no CLI prompt)
|
||||
* claude-desktop → null (GUI only)
|
||||
@@ -65,8 +65,7 @@ export function promptArgsForTool(toolId: string, prompt: string): string[] | nu
|
||||
return [p];
|
||||
|
||||
// GUI-only tools and Hermes interactive launch: no verified inline-prompt
|
||||
// surface. Hermes captured tasks use the shared headless task contract,
|
||||
// not this dock-launch helper.
|
||||
// surface.
|
||||
// cursor: opens a folder (`cursor /path`), no --prompt flag.
|
||||
// claude-desktop / codex-desktop: GUI binaries with no
|
||||
// prompt-from-CLI handoff documented.
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
*
|
||||
* 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 and Room are hidden in v1
|
||||
* by decision, whatever the store supports. Their screens stay in the code and
|
||||
* reports it unavailable in v1. History import and wiki 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).
|
||||
* and the memory MCP server left with their packages (P2.2); Waggle Room's
|
||||
* coding-agent tasks left with their runtime.
|
||||
*/
|
||||
import { useEffect, useSyncExternalStore } from 'react';
|
||||
import { adapter } from '@/lib/adapter';
|
||||
@@ -19,8 +20,6 @@ export interface MemoryFeatures {
|
||||
importHistory: boolean;
|
||||
/** Compiled wiki pages. */
|
||||
wiki: boolean;
|
||||
/** Waggle Room: coding agents started as a team that shares one Room. */
|
||||
room: boolean;
|
||||
}
|
||||
|
||||
export type MemoryFeature = keyof MemoryFeatures;
|
||||
@@ -29,7 +28,6 @@ export type MemoryFeature = keyof MemoryFeatures;
|
||||
const HIDDEN_IN_V1: Readonly<Record<Exclude<MemoryFeature, 'knowledgeGraph'>, false>> = {
|
||||
importHistory: false,
|
||||
wiki: false,
|
||||
room: false,
|
||||
};
|
||||
|
||||
let current: MemoryCapabilitiesResponse | null = null;
|
||||
|
||||
@@ -2,18 +2,12 @@
|
||||
import LauncherApp from '@/components/os/apps/LauncherApp';
|
||||
import SurfaceBoundary from './SurfaceBoundary';
|
||||
import { useShell } from '@/providers/ShellContext';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
const LauncherRoute = () => {
|
||||
const { activeWorkspaceId, workspaces } = useShell();
|
||||
const navigate = useNavigate();
|
||||
const { activeWorkspaceId } = useShell();
|
||||
return (
|
||||
<SurfaceBoundary appName="Tool Launcher">
|
||||
<LauncherApp
|
||||
activeWorkspaceId={activeWorkspaceId ?? undefined}
|
||||
workspaces={workspaces}
|
||||
onOpenRoom={(roomId) => navigate(`/room?room=${encodeURIComponent(roomId)}`)}
|
||||
/>
|
||||
<LauncherApp activeWorkspaceId={activeWorkspaceId ?? undefined} />
|
||||
</SurfaceBoundary>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe('memory feature map (v1 defaults)', () => {
|
||||
it.each<MemoryFeature>(['knowledgeGraph', 'importHistory', 'wiki', 'room'])(
|
||||
it.each<MemoryFeature>(['knowledgeGraph', 'importHistory', 'wiki'])(
|
||||
'%s is hidden',
|
||||
(feature) => {
|
||||
expect(hasMemoryFeature(feature)).toBe(false);
|
||||
@@ -66,9 +66,9 @@ describe('memory feature map from the server capabilities', () => {
|
||||
expect(isMemoryViewAvailable('graph')).toBe(true);
|
||||
});
|
||||
|
||||
it('keeps import, wiki, hooks, Room and the memory MCP hidden whatever the store reports', () => {
|
||||
it('keeps import and wiki hidden whatever the store reports', () => {
|
||||
setMemoryCapabilities(report(true));
|
||||
for (const feature of ['importHistory', 'wiki', 'room'] as const) {
|
||||
for (const feature of ['importHistory', 'wiki'] as const) {
|
||||
expect(hasMemoryFeature(feature), feature).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user