Files
waggle-os/tests/e2e/launcher-rendered-states.spec.ts
shumeiko.it 2edfd01e6e 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.
2026-11-01 00:35:13 +01:00

119 lines
4.0 KiB
TypeScript

import { test, expect, type Page } from '@playwright/test';
const SKIP_PARAMS = 'skipOnboarding=true&skipBoot=true&skipBriefing=true&tier=power';
function routeWithSkip(route: string): string {
const sep = route.includes('?') ? '&' : '?';
return `${route}${sep}${SKIP_PARAMS}`;
}
async function waitForShell(page: Page): Promise<void> {
await page.waitForSelector('.waggle-sidebar, [role="navigation"], main', { timeout: 15_000 });
await page.waitForTimeout(300);
}
async function gotoLauncher(page: Page): Promise<void> {
await page.goto(routeWithSkip('/launcher?watch=1'), { waitUntil: 'domcontentloaded' });
await waitForShell(page);
await expect(page.getByText('Tool Launcher')).toBeVisible({ timeout: 10_000 });
}
async function mockProcesses(page: Page): Promise<void> {
await page.route('**/api/tools/processes', route => route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ processes: [], total: 0 }),
}));
}
test.describe('Launcher rendered states', () => {
test('sidecar-offline detection shows an inline retry action', async ({ page }) => {
let detectCalls = 0;
await mockProcesses(page);
await page.route('**/api/tools/detect', route => {
detectCalls += 1;
if (detectCalls === 1) {
return route.abort('failed');
}
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
platform: 'linux',
detectedAt: '2026-07-08T00:00:00.000Z',
tools: [
{
id: 'foo-cli',
displayName: 'Foo CLI',
launchable: true,
builtin: false,
acceptsInlinePrompt: true,
installed: true,
installedPath: '/usr/local/bin/foo',
version: '1.0.0',
},
],
}),
});
});
await gotoLauncher(page);
await expect(page.getByText(/sidecar may be offline/i)).toBeVisible();
await page.getByRole('button', { name: /retry tool detection/i }).click();
await expect(page.getByText('Foo CLI')).toBeVisible();
await expect(page.getByText(/sidecar may be offline/i)).not.toBeVisible();
});
test('third-party adapter renders launch state and sends its prompt', async ({ page }) => {
let launchPayload: unknown = null;
await mockProcesses(page);
await page.route('**/api/tools/detect', route => route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
platform: 'linux',
detectedAt: '2026-07-08T00:00:00.000Z',
tools: [
{
id: 'foo-cli',
displayName: 'Foo CLI',
launchable: true,
builtin: false,
acceptsInlinePrompt: true,
installed: true,
installedPath: '/usr/local/bin/foo',
version: '2.1.0',
},
],
}),
}));
await page.route('**/api/tools/launch', async route => {
launchPayload = route.request().postDataJSON();
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ ok: true, pid: 9876 }),
});
});
await gotoLauncher(page);
await expect(page.getByText('Foo CLI', { exact: true })).toBeVisible();
await expect(page.getByText(/v2\.1\.0/i)).toBeVisible();
await expect(page.getByText(/Sent to:/i)).not.toBeVisible();
await expect(page.getByRole('button', { name: /^Launch$/ })).toBeVisible();
await page.getByLabel(/optional launch prompt/i).fill('summarize adapter context');
await expect(page.getByText('Sent to: Foo CLI', { exact: true })).toBeVisible();
await page.getByRole('button', { name: /^Launch$/ }).click();
await expect(page.getByText(/Launched Foo CLI with prompt \(pid 9876\)/i)).toBeVisible();
expect(launchPayload).toMatchObject({
id: 'foo-cli',
installedPath: '/usr/local/bin/foo',
prompt: 'summarize adapter context',
observe: true,
});
});
});