mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-15 18:59:33 +01:00
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:
1 parent
f62c1f7e2f
commit
0bbf483a35
9 files changed
+325
-4
No files matched your search
@@ -325,6 +325,14 @@ const capabilitiesSchema = z
|
||||
// A closed list on purpose: it decides where the server WRITES, and this file is
|
||||
// user-editable, so it can never be a free path (`..`, absolute).
|
||||
agentSkillDir: z.enum(AGENT_SKILL_DIRS).optional(),
|
||||
// The hook module Codeman installs for a CLI whose hooks are files, not a settings
|
||||
// block (omp). Same closed-list reasoning as `agentSkillDir`, stricter still: this
|
||||
// name is written into the user's workspace, so a value like `../../evil.ts` must be
|
||||
// refused by the schema rather than by whatever calls the writer.
|
||||
approvalHookFile: z
|
||||
.string()
|
||||
.regex(/^[A-Za-z0-9._-]+\.ts$/)
|
||||
.optional(),
|
||||
statusLineTelemetry: z.boolean(),
|
||||
// How many columns this CLI indents its transcript body by, so a copy can take
|
||||
// that much off the clipboard. Bounded, because it is the whole strip: a copy
|
||||
|
||||
@@ -1742,6 +1742,21 @@ const OMP: CliEntry = {
|
||||
capabilities: {
|
||||
...agentDefaults(),
|
||||
...AGENTS_DIR_SKILL,
|
||||
// omp emits REAL approval events (`tool_approval_requested` / `tool_approval_resolved`),
|
||||
// so an omp pane can report a pending dialog first-hand instead of by inference.
|
||||
// Codeman installs the hook module named by `approvalHookFile` into
|
||||
// `<workspace>/.claude/hooks/pre/` when a session is created; it forwards those two
|
||||
// events to /api/hook-event as `permission_prompt` / `elicitation_complete`, the same
|
||||
// names claude's settings block sends, so the tab alert, the desktop notification and
|
||||
// the Approvals Inbox work unchanged.
|
||||
// ⚠️ 'always' rather than 'supervised': the report comes from a hook Codeman owns and
|
||||
// installs (like claude's), not from a supervised-CLI status bridge.
|
||||
// ⚠️ Only approvals are reported. `stop`/`idle_prompt` still come from `workDetect`
|
||||
// below, which stays the source of truth for whether an omp pane is working or idle.
|
||||
hooks: 'always',
|
||||
// The hook module Codeman writes for this CLI. Declared as data so the session-create
|
||||
// path asks "does this CLI declare a hook file?" instead of branching on an id.
|
||||
approvalHookFile: 'codeman-approval.ts',
|
||||
// Fullscreen alt-screen TUI, same shape as antigravity/grok: only the
|
||||
// tmux-attach-time smcup strip, not Ink's full erase-scrollback+DECSET strip.
|
||||
altScreen: 'strip-mux-only',
|
||||
|
||||
@@ -509,7 +509,9 @@ export interface CliCapabilities {
|
||||
*
|
||||
* ⚠️ A TRI-STATE, not a boolean, because for one CLI this is a per-SESSION question:
|
||||
* 'none' — no hook signals, ever (every external CLI, and `shell`).
|
||||
* 'always' — the CLI installs Codeman's hooks (claude).
|
||||
* 'always' — the CLI's signals are installed by Codeman and are unconditional:
|
||||
* claude via a `.claude/settings.local.json` block, omp via the hook
|
||||
* MODULE named by `approvalHookFile` below.
|
||||
* 'supervised' — the CLI REPORTS its own idle/working/blocked state to a supervisor
|
||||
* over a generic env-gated contract, and Codeman is that supervisor
|
||||
* (deepseek, via deepseek-status-shim.ts). Definitive rather than
|
||||
@@ -523,6 +525,20 @@ export interface CliCapabilities {
|
||||
* timeout the predicate exists to prevent.
|
||||
*/
|
||||
hooks: 'none' | 'always' | 'supervised';
|
||||
/**
|
||||
* A CLI whose hooks are MODULES rather than a settings-file block names the file
|
||||
* Codeman installs into its project hook directory.
|
||||
*
|
||||
* omp is the case that exists today: it loads `<cwd>/.claude/hooks/pre/*.ts`, and the
|
||||
* installed module forwards `tool_approval_requested`/`tool_approval_resolved` to
|
||||
* `/api/hook-event` as `permission_prompt`/`elicitation_complete`, so an omp pane asking
|
||||
* for approval raises the same tab alert, notification and Approvals Inbox item a claude
|
||||
* pane does. Absent with `hooks: 'always'` means Claude's settings-file block.
|
||||
*
|
||||
* Declared as data, not a branch on the id, so the session-create path can ask
|
||||
* "does this CLI need a hook file installed?" (see cli-registry-no-id-branching).
|
||||
*/
|
||||
approvalHookFile?: string;
|
||||
/**
|
||||
* Which transcript reader, if any, understands this CLI's on-disk history.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user