|
7 | 7 | NotificationHookSpecificOutput, |
8 | 8 | PermissionRequestHookInput, |
9 | 9 | PermissionRequestHookSpecificOutput, |
| 10 | + PostCompactHookInput, |
| 11 | + PostCompactHookSpecificOutput, |
10 | 12 | ResultMessage, |
11 | 13 | SubagentStartHookInput, |
12 | 14 | SubagentStartHookSpecificOutput, |
@@ -286,6 +288,34 @@ def test_permission_request_hook_input_with_suggestions(self): |
286 | 288 | } |
287 | 289 | assert len(hook_input["permission_suggestions"]) == 1 |
288 | 290 |
|
| 291 | + def test_post_compact_hook_input(self): |
| 292 | + """Test PostCompactHookInput construction.""" |
| 293 | + hook_input: PostCompactHookInput = { |
| 294 | + "session_id": "sess-1", |
| 295 | + "transcript_path": "/tmp/transcript.jsonl", |
| 296 | + "cwd": "/home/user/project", |
| 297 | + "hook_event_name": "PostCompact", |
| 298 | + "trigger": "auto", |
| 299 | + "compact_summary": "Summary of the compacted conversation...", |
| 300 | + } |
| 301 | + assert hook_input["hook_event_name"] == "PostCompact" |
| 302 | + assert hook_input["trigger"] == "auto" |
| 303 | + assert ( |
| 304 | + hook_input["compact_summary"] == "Summary of the compacted conversation..." |
| 305 | + ) |
| 306 | + |
| 307 | + def test_post_compact_hook_input_manual_trigger(self): |
| 308 | + """Test PostCompactHookInput with manual trigger.""" |
| 309 | + hook_input: PostCompactHookInput = { |
| 310 | + "session_id": "sess-2", |
| 311 | + "transcript_path": "/tmp/transcript.jsonl", |
| 312 | + "cwd": "/home/user/project", |
| 313 | + "hook_event_name": "PostCompact", |
| 314 | + "trigger": "manual", |
| 315 | + "compact_summary": "User-initiated compaction summary", |
| 316 | + } |
| 317 | + assert hook_input["trigger"] == "manual" |
| 318 | + |
289 | 319 |
|
290 | 320 | class TestHookSpecificOutputTypes: |
291 | 321 | """Test hook-specific output type definitions.""" |
@@ -332,6 +362,15 @@ def test_post_tool_use_output_has_updated_mcp_tool_output(self): |
332 | 362 | } |
333 | 363 | assert output["updatedMCPToolOutput"] == {"result": "modified"} |
334 | 364 |
|
| 365 | + def test_post_compact_hook_specific_output(self): |
| 366 | + """Test PostCompactHookSpecificOutput construction.""" |
| 367 | + output: PostCompactHookSpecificOutput = { |
| 368 | + "hookEventName": "PostCompact", |
| 369 | + "additionalContext": "Compaction complete, summary logged", |
| 370 | + } |
| 371 | + assert output["hookEventName"] == "PostCompact" |
| 372 | + assert output["additionalContext"] == "Compaction complete, summary logged" |
| 373 | + |
335 | 374 |
|
336 | 375 | class TestMcpServerStatusTypes: |
337 | 376 | """Test MCP server status type definitions.""" |
|
0 commit comments