mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-20 04:59:34 +01:00
fix(omp): report approvals without claiming Claude's hook set
Review follow-up. omp declared `hooks: 'always'`, which every consumer reads
as Claude's full hook set, so an omp session picked up behaviour it cannot
back. omp goes back to `hooks: 'none'`; `capabilities.approvalHookFile` is now
a separate, narrower capability with its own predicate,
`approvalHookAvailableForMode()` (local, non-adopted sessions only).
- An explicit `stop` wait on omp is a 400 again; `blocked` still works.
- omp inbox items are alert-only (`answerInTerminal`, no `approvalId` on the
push), and only `permission_prompt` / `elicitation_complete` are accepted for
an approval-only session.
- The module is installed from POST /api/quick-start too (new and existing
cases, not Docker or remote) and on reboot-restore, after the launch
pre-flight on both create paths. Claude's settings.local.json block and the
Docker CLAUDE.md no longer land in omp workspaces.
- The generated module passes Bun's `tls: { rejectUnauthorized: false }` for an
https CODEMAN_API_URL (checked against a `--https` server), clears the alert
only when the last pending toolCallId resolves, sends reports in order,
carries omp's policy `reason` as `message`, and imports HookAPI from
`@oh-my-pi/pi-coding-agent/extensibility/hooks`.
- Every path component and the target file are lstat-checked.
- docs/omp-integration.md, verbs.md and the stock.ts comments updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0bbf483a35
commit
27d6e2e30a
14 files changed
+701
-125
No files matched your search
@@ -295,15 +295,38 @@ export function sessionHookOptions(session: {
|
||||
|
||||
/**
|
||||
* Whether `blocked` can ever fire for this session: its CLI reports it through hooks
|
||||
* (`hooksAvailableForMode()`), or Codeman reads the dialogs it blocks on off its screen
|
||||
* (`capabilities.workDetect.blockedLine`, codex). The screen half needs no per-session
|
||||
* facts: a remote or Docker pane is still a local tmux pane showing the CLI's screen
|
||||
* (their nested tmux runs with `status off`, so nothing is drawn below the CLI).
|
||||
* (`hooksAvailableForMode()`), through an approval-only hook module
|
||||
* (`approvalHookAvailableForMode()`, omp), or Codeman reads the dialogs it blocks on off
|
||||
* its screen (`capabilities.workDetect.blockedLine`, codex). The screen half needs no
|
||||
* per-session facts: a remote or Docker pane is still a local tmux pane showing the CLI's
|
||||
* screen (their nested tmux runs with `status off`, so nothing is drawn below the CLI).
|
||||
*
|
||||
* ⚠️ Says nothing about `stop`. A screen shows a dialog; it never says a turn ended.
|
||||
*/
|
||||
export function blockedSignalAvailable(mode: SessionMode, options: HookCapabilityOptions = {}): boolean {
|
||||
return hooksAvailableForMode(mode, options) || !!getCli(mode)?.capabilities.workDetect?.blockedLine;
|
||||
return (
|
||||
hooksAvailableForMode(mode, options) ||
|
||||
approvalHookAvailableForMode(mode, options) ||
|
||||
!!getCli(mode)?.capabilities.workDetect?.blockedLine
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this session reports its approval dialogs, and ONLY those, through a hook
|
||||
* module Codeman installed into its workspace (`capabilities.approvalHookFile`, omp).
|
||||
*
|
||||
* Deliberately separate from `hooksAvailableForMode()`: its consumers read a yes as
|
||||
* "this CLI has Claude's full hook set", so `stop` would be accepted and never fire, and
|
||||
* the inbox would offer Approve/Deny keystrokes it cannot verify. A yes HERE means
|
||||
* `blocked` can fire and a dialog opens an alert-only inbox item, nothing more.
|
||||
*
|
||||
* Per-session like the supervised bridge: the module is installed only into a LOCAL
|
||||
* workspace Codeman created the session in, so an adopted pane, a remote attach and a
|
||||
* Docker case (`deepSeekBridgeUnreachable`, set for both) never have one.
|
||||
*/
|
||||
export function approvalHookAvailableForMode(mode: SessionMode, options: HookCapabilityOptions = {}): boolean {
|
||||
if (options.adopted || options.deepSeekBridgeUnreachable) return false;
|
||||
return !!getCli(mode)?.capabilities.approvalHookFile;
|
||||
}
|
||||
|
||||
/** Outcome of resolving a caller-supplied wait target against a session's mode. */
|
||||
|
||||
Reference in new issue
Block a user