Skip to content

Commit 74068e3

Browse files
committed
fix: export HookJSONOutput type from main module
Fixes #203 - Add HookJSONOutput to __init__.py exports for direct import - Update examples/hooks.py to import from main module
1 parent 2a9693e commit 74068e3

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

examples/hooks.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
import sys
1616
from typing import Any
1717

18-
from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient
19-
from claude_agent_sdk.types import (
18+
from claude_agent_sdk import (
2019
AssistantMessage,
20+
ClaudeAgentOptions,
21+
ClaudeSDKClient,
2122
HookContext,
2223
HookJSONOutput,
2324
HookMatcher,
@@ -84,7 +85,9 @@ async def add_custom_instructions(
8485
async def example_pretooluse() -> None:
8586
"""Basic example demonstrating hook protection."""
8687
print("=== PreToolUse Example ===")
87-
print("This example demonstrates how PreToolUse can block some bash commands but not others.\n")
88+
print(
89+
"This example demonstrates how PreToolUse can block some bash commands but not others.\n"
90+
)
8891

8992
# Configure hooks using ClaudeAgentOptions
9093
options = ClaudeAgentOptions(
@@ -93,7 +96,7 @@ async def example_pretooluse() -> None:
9396
"PreToolUse": [
9497
HookMatcher(matcher="Bash", hooks=[check_bash_command]),
9598
],
96-
}
99+
},
97100
)
98101

99102
async with ClaudeSDKClient(options=options) as client:

src/claude_agent_sdk/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ContentBlock,
2424
HookCallback,
2525
HookContext,
26+
HookJSONOutput,
2627
HookMatcher,
2728
McpSdkServerConfig,
2829
McpServerConfig,
@@ -308,6 +309,7 @@ async def call_tool(name: str, arguments: dict[str, Any]) -> Any:
308309
"PermissionUpdate",
309310
"HookCallback",
310311
"HookContext",
312+
"HookJSONOutput",
311313
"HookMatcher",
312314
# Agent support
313315
"AgentDefinition",

0 commit comments

Comments
 (0)