delete the claude-done hook and its unauthenticated endpoint

The chain was: a Stop hook in Claude's settings curls POST /api/hooks/claude-done,
the platform POSTs /_officer/panel-refresh to the pty sidecar, the sidecar sends a
`panel-refresh` frame to every attached terminal, and the Claude Code panel bumps
`preview:refresh` and `files:refresh-signal`.

It has never fired. generateClaudeSettings writes settings.json into the MANAGED
home under DATA_PATH, but HOME_DIR points terminals at the owner's real login home
— which is where Claude reads its settings from. Verified on this machine: no
claude-done hook exists in ~/.claude/settings.json, and DATA_PATH/*/home/.claude
does not exist at all.

Deleting rather than repairing it, because the Chat panel already does exactly this
job from onTurnComplete — in-process, conditioned on the turn having made tool
calls, with no hook, no HTTP round trip, and no endpoint. The chat UI is where agent
work happens; the terminal TUI is not the destination.

Also removes /api/hooks/claude-done, which was mounted above protectedRouter and so
was the one unauthenticated write-ish endpoint on the API surface.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-04 01:36:35 +00:00
co-authored by Claude Opus 5
parent 4eeaa3c93d
commit 96ceb3aca6
10 changed files with 31 additions and 83 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
import { createSidecarProxy } from '../../sidecar/create-proxy';
// `/api/terminal/*` is a plain auth-and-forward proxy onto the pty sidecar's own listener, like every
// other HTTP sidecar. The sidecar owns `/_officer/sessions` (list), `DELETE /_officer/sessions/:id` (kill)
// and `POST /_officer/panel-refresh`; the platform knows none of those contracts, only where to send them.
// other HTTP sidecar. The sidecar owns `/_officer/sessions` (list) and `DELETE /_officer/sessions/:id`
// (kill); the platform knows neither contract, only where to send them.
//
// `/api/terminal/ws` does NOT come through here — Bun's route table takes it first and hands it to the
// byte relay in `websocket.ts`.
+1 -10
View File
@@ -1,5 +1,5 @@
import type { ServerWebSocket } from 'bun';
import { getTerminalWsUrl, getTerminalHttpUrl } from './sidecar-server';
import { getTerminalWsUrl } from './sidecar-server';
// Byte relay between the browser and the pty sidecar's own socket.
//
@@ -93,12 +93,3 @@ export const terminalWebsocket = {
drain() {},
};
// The claude-done hook asks attached terminals to refresh their panel. The sidecar holds those sockets
// now, so this is a POST to it rather than a loop over sockets officer used to own. Fire-and-forget: a
// missed refresh is a stale panel, not a failure worth surfacing.
export const broadcastPanelRefresh = (_email: string): void => {
const base = getTerminalHttpUrl();
if (!base) return;
fetch(`${base}/_officer/panel-refresh`, { method: 'POST' }).catch(() => {});
};