diff --git a/Sources/Shellraiser/Infrastructure/Agents/AgentRuntimeBridge.swift b/Sources/Shellraiser/Infrastructure/Agents/AgentRuntimeBridge.swift index 39d0852..bb33171 100644 --- a/Sources/Shellraiser/Infrastructure/Agents/AgentRuntimeBridge.swift +++ b/Sources/Shellraiser/Infrastructure/Agents/AgentRuntimeBridge.swift @@ -198,7 +198,7 @@ final class AgentRuntimeBridge: AgentRuntimeSupporting { """# } - /// Claude wrapper that injects top-level start and stop hooks for the current surface. + /// Claude wrapper that injects managed activity hooks for the current surface. private var claudeWrapperContents: String { #""" #!/bin/sh @@ -252,6 +252,37 @@ final class AgentRuntimeBridge: AgentRuntimeSupporting { } ] } + ], + "PermissionRequest": [ + { + "matcher": "*", + "hooks": [ + { + "type": "command", + "command": "\"$SHELLRAISER_HELPER_PATH\" claudeCode \"$SHELLRAISER_SURFACE_ID\" completed" + } + ] + } + ], + "Notification": [ + { + "matcher": "permission_prompt", + "hooks": [ + { + "type": "command", + "command": "\"$SHELLRAISER_HELPER_PATH\" claudeCode \"$SHELLRAISER_SURFACE_ID\" completed" + } + ] + }, + { + "matcher": "elicitation_dialog", + "hooks": [ + { + "type": "command", + "command": "\"$SHELLRAISER_HELPER_PATH\" claudeCode \"$SHELLRAISER_SURFACE_ID\" completed" + } + ] + } ] } } diff --git a/Tests/ShellraiserTests/AgentRuntimeBridgeTests.swift b/Tests/ShellraiserTests/AgentRuntimeBridgeTests.swift index b412c91..95a5969 100644 --- a/Tests/ShellraiserTests/AgentRuntimeBridgeTests.swift +++ b/Tests/ShellraiserTests/AgentRuntimeBridgeTests.swift @@ -4,8 +4,8 @@ import XCTest /// Covers managed-agent wrapper generation for runtime integration. @MainActor final class AgentRuntimeBridgeTests: XCTestCase { - /// Verifies the Claude wrapper emits top-level start/stop hooks without subagent hooks. - func testPrepareRuntimeSupportWritesClaudeWrapperWithoutSubagentStopHook() throws { + /// Verifies the Claude wrapper emits start, stop, permission-request, and selected notification hooks. + func testPrepareRuntimeSupportWritesClaudeWrapperWithMappedNotificationHooks() throws { let bridge = AgentRuntimeBridge.shared let wrapperURL = bridge.binDirectory.appendingPathComponent("claude") @@ -17,6 +17,11 @@ final class AgentRuntimeBridgeTests: XCTestCase { XCTAssertTrue(wrapperContents.contains("\"UserPromptSubmit\"")) XCTAssertTrue(wrapperContents.contains("\"Stop\"")) + XCTAssertTrue(wrapperContents.contains("\"PermissionRequest\"")) + XCTAssertTrue(wrapperContents.contains("\"matcher\": \"*\"")) + XCTAssertTrue(wrapperContents.contains("\"Notification\"")) + XCTAssertTrue(wrapperContents.contains("\"matcher\": \"permission_prompt\"")) + XCTAssertTrue(wrapperContents.contains("\"matcher\": \"elicitation_dialog\"")) XCTAssertFalse(wrapperContents.contains("\"SubagentStop\"")) }