fix(omp): report tool approvals to Codeman so an omp pane alerts

An omp pane asking for tool approval raised no tab alert, no desktop
notification and no Approvals Inbox item. omp inherited hooks:'none' from
agentDefaults(), so hooksAvailableForMode() answered false and
hook-event-routes never opened an item; there was nothing to resolve either.

omp is one of the few non-claude CLIs with real approval events
(tool_approval_requested / tool_approval_resolved), so Codeman can install a
hook module into <workspace>/.claude/hooks/pre/ - the directory omp scans -
on session create. It forwards them as permission_prompt and
elicitation_complete, the names the server already routes on, so the existing
alert, notification and inbox pipeline works unchanged.

The file name comes from the new capabilities.approvalHookFile field rather
than a branch on the CLI id (cli-registry-no-id-branching). stop/idle_prompt
are deliberately NOT reported: omp's idle stays screen-read via workDetect,
which the agent skill's verbs.md now says explicitly.
This commit is contained in:
timkjr committed 2026-11-09 18:51:42 -06:00
1 parent f62c1f7e2f
commit 0bbf483a35
9 files changed
+325 -4

No files matched your search

+13
View File
@@ -156,6 +156,7 @@ import {
seedAgentSessionPreamble,
applyWorkspaceHooks,
refreshStaleCodemanHooks,
applyApprovalHookFile,
} from '../../hooks-config.js';
import { generateClaudeMd } from '../../templates/claude-md.js';
import { imageWatcher } from '../../image-watcher.js';
@@ -1331,6 +1332,18 @@ export function registerSessionRoutes(
await applyWorkspaceHooks(workingDir, await ctx.getWorkspaceHooksEnabled());
}
// A CLI whose hooks are MODULES rather than a settings.local.json block (omp) needs
// its hook file installed into the workspace, so its approval dialogs raise the same
// alert a claude pane does. Registry-driven: `approvalHookFile` names the file, so no
// call site branches on a CLI id. Same local-workspace and `workspaceHooksEnabled`
// gate as claude's block; best-effort, because a failure here must not block a create.
const approvalHookFile = getCli(body.mode ?? 'claude')?.capabilities.approvalHookFile;
if (!remote && body.workingDir && approvalHookFile) {
if (await ctx.getWorkspaceHooksEnabled()) {
await applyApprovalHookFile(workingDir, approvalHookFile).catch(() => {});
}
}
// Refuse up front if the requested CLI cannot start, rather than spawning a pane that
// dies on `command not found`. The message comes from the resolver, so it names where
// resolution actually looked (server PATH, login shell, the entry's search dirs); a