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

@@ -5,13 +5,11 @@ import { z } from 'zod';
import {
detectInstalledTools,
launchTool,
runHookCommand,
ToolProcessTracker,
ToolOutputBuffer,
getToolRegistry,
type HookAction,
} from '@waggle/agent';
import { SUPPORTED_TOOLS, applyPromptArgTemplate, type ToolId, type ToolManifest } from '@waggle/shared';
import { applyPromptArgTemplate, type ToolManifest } from '@waggle/shared';
import { resolveWorkspaceExecutionRoot } from '../workspace-execution-root.js';
import { canonicalWorkspaceRoot } from '../workspace-turn-coordinator.js';
@@ -62,7 +60,7 @@ declare module 'fastify' {
}
/**
* AI-OS — tool-detection + launcher + hook-management routes.
* AI-OS — tool-detection + launcher routes.
*
* Endpoints:
*
@@ -75,17 +73,11 @@ declare module 'fastify' {
* Spawn the tool detached with workspace-context env injection.
* (Phase 2A)
*
* POST /api/tools/hooks
* Body: { id, action: 'install' | 'verify' | 'uninstall', cliPath? }
* Run `npx @waggle/hive-mind-hooks-<id> <action>`.
* (Phase 2A)
*
* All routes are read-only by intent (detect) or surface only the
* user's own machine (launch/hooks). The local sidecar is loopback-
* user's own machine (launch). The local sidecar is loopback-
* bound; tool detection is not sensitive.
*/
const TOOL_ID_VALUES = SUPPORTED_TOOLS as readonly string[];
const TOOL_ID_SAFE = /^[A-Za-z0-9._-]+$/;
const PROCESS_RECONCILE_INTERVAL_MS = 5_000;
@@ -103,13 +95,6 @@ const launchBodySchema = z.object({
prompt: z.string().max(8000).optional(),
});
const hooksBodySchema = z.object({
id: z.string().refine((s): s is ToolId => TOOL_ID_VALUES.includes(s), {
message: 'unknown tool id',
}),
action: z.enum(['install', 'verify', 'uninstall']),
}).strict();
const killBodySchema = z.object({
pid: z.number().int().positive(),
});
@@ -748,34 +733,6 @@ const toolsRoutesImpl: FastifyPluginAsync = async (server) => {
res.on('close', () => unsubscribe());
return reply;
});
// ── POST /api/tools/hooks (Phase 2A) ─────────────────────────────
server.post('/api/tools/hooks', async (request, reply) => {
const parsed = hooksBodySchema.safeParse(request.body);
if (!parsed.success) {
return reply
.code(400)
.send({ error: 'Validation failed', details: parsed.error.flatten() });
}
const body = parsed.data;
try {
const result = await runHookCommand({
id: body.id,
action: body.action as HookAction,
dataDir: server.localConfig.dataDir,
});
if (!result.ok) {
return reply.code(result.errorCode === 'hook_runtime_missing' ? 503 : 400).send(result);
}
return reply.code(200).send(result);
} catch (err) {
const message = err instanceof Error ? err.message : 'unknown error';
server.log.error({ err }, 'hook command failed');
return reply
.code(500)
.send({ error: 'hook command failed', message });
}
});
};
/**