Repository navigation
feat(hooks): support Bob Shell 2.1.0 hook events as an opt-in under bob.hooks - #3961
Merged
Merged
Conversation
…tification events Bob Shell 2.1.0 (@ibm/bob on npm) adds SessionEnd, PermissionRequest, PermissionResolved and Notification to its hook runner and settings schema. Map canonical sessionEnd, permissionRequest and notification to them and keep their matcher (reason, tool name, notification_type). PermissionResolved has no canonical event and stays authorable through the bob.hooks override block. Also align the processor's Bob matcherEvents with the converter, which already kept matchers on SessionStart, PreCompact and PostCompact. Refs #3074 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…ooks Bob Shell before 2.1.0 validates the hooks object strictly against the seven documented keys and ignores the whole hooks block of a settings file with an unknown key, PreToolUse guards included. Writing SessionEnd, PermissionRequest or Notification from the shared hooks block would make those versions drop every hook, so keep skipping the canonical events for bob and warn with the native names to author under bob.hooks. Those are written verbatim with their matcher and imported back there. Document the 2.1.0 requirement, the whole-block drop, and that a PermissionRequest decides through decision.behavior (exit 2 does not deny, and allow with updatedInput is ignored). Refs #3074 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
Bob Shell 2.1.0 also validates the hooks object strictly, so a single unknown key under bob.hooks (a typo, or a canonical opt-in name such as sessionEnd) made Bob ignore the file's whole hooks block. Keep only the canonical supported events and Bob's eleven native event names from the override, and report the rest as skipped. Also stop pointing to the override for a shared opt-in event that bob.hooks already authors under its native name. Refs #3074 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…b-shell-hook-events # Conflicts: # src/generated/docs-content.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bob Shell 2.1.0, published to npm as
@ibm/bobon 2026-11-09, adds four hook events:SessionEnd,PermissionRequest,PermissionResolvedandNotification. This PR lets users write them through thebob.hooksoverride block. They are opt-in rather than mapped from the sharedhooksblock for one reason: Bob Shell before 2.1.0 validateshooksagainst a strict seven-key zod object. On any unknown key it logs "Ignoring invalid … hook settings" and replaces that file's whole hooks block with{}. Writing these events by default would make older Bob Shells drop every hook,PreToolUseguards included, without the user ever choosing that. Bob IDE shares the file and documents only the seven events.I checked the published bundles myself:
.object({ ...seven keys }).strict(), and a failed parse falls back to{}.reasononSessionEnd(clear,resume,prompt_input_exit,other), the tool name onPermissionRequestandPermissionResolved, andnotification_typeonNotification(permission_prompt,elicitation_dialog,elicitation_url_dialog,idle_prompt).PermissionRequest: it runs only when Bob would show an approval prompt.hookSpecificOutput.decision.behavior"deny"/"allow"is honoured, and an allow auto-approves the call. AnallowwithupdatedInputis ignored. Exit code 2 does not deny; Bob falls back to its normal approval prompt.What changed
CANONICAL_TO_BOB_EVENT_NAMESstill holds the seven documented events.BOB_OPT_IN_HOOK_EVENTSmapssessionEnd→SessionEnd,permissionRequest→PermissionRequestandnotification→Notification.overrideOptIn, swaps the generic "not supported" warning for one that names Bob Shell 2.1.0+, the whole-block-drop risk, and the native names to write underbob.hooks. The warning is left out whenbob.hooksalready sets that native name.bob.hookskeys are now filtered through a new optional spec field onSettingsJsonHooksSpec,knownOverrideEvents. Only the canonical supported events and Bob's 11 native names (BOB_NATIVE_HOOK_EVENTS) are written. Any other key is skipped with a warning and the remaining hooks are kept. That covers typos and canonical opt-in names such assessionEnd. The processor reports these keys throughdropsUnknownOverrideEvents/overrideOnlyEvents.bob.hooks, the native names (includingPermissionResolved) are written verbatim with theirmatcher. Import puts them back underbob.hooks, so a generate → import → generate cycle keeps them opt-in. Tests cover both directions.BOB_MATCHER_HOOK_EVENTSdrives the converter's no-matcher set and the processor'smatcherEvents. The processor value used to be["preToolUse", "postToolUse"], which no longer matched what the converter keeps since fix(bob): emit http webhook hooks and keep matchers on session/compaction events #3706.docs/reference/file-formats.mdnow covers the opt-in, the 2.1.0 requirement, the whole-block drop, and howPermissionRequestdecides. I regenerateddocs-content.ts. The hook-event matrix is unchanged from main.Skipped
PermissionResolveda canonical name. No other target has an equivalent, and it can be written underbob.hooks.Refs #3074
🤖 Generated with Claude Code
https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4