diff --git a/docs/en/customization/hooks.md b/docs/en/customization/hooks.md index 548120550..29bbb002e 100644 --- a/docs/en/customization/hooks.md +++ b/docs/en/customization/hooks.md @@ -36,7 +36,7 @@ Kimi Code CLI supports 13 lifecycle events: | `SubagentStop` | When subagent ends | Agent name | `agent_name`, `response` | | `PreCompact` | Before context compaction | Trigger reason | `trigger`, `token_count` | | `PostCompact` | After context compaction | Trigger reason | `trigger`, `estimated_token_count` | -| `Notification` | When notification is delivered | Sink name | `sink`, `notification_type`, `title`, `body`, `severity` | +| `Notification` | When notification is delivered | Notification type | `sink`, `notification_type`, `title`, `body`, `severity` | ## Configuring Hooks @@ -56,11 +56,11 @@ matcher = "WriteFile|StrReplaceFile" command = ".kimi/hooks/protect-env.sh" timeout = 10 -# Desktop notification when approval needed +# Desktop notification when a background task finishes [[hooks]] event = "Notification" -matcher = "permission_prompt" -command = "osascript -e 'display notification \"Kimi needs attention\" with title \"Kimi CLI\"'" +matcher = "task[.]completed|task[.]failed" +command = "osascript -e 'display notification \"Kimi task finished\" with title \"Kimi CLI\"'" # Verify tasks complete before stopping [[hooks]] diff --git a/docs/zh/customization/hooks.md b/docs/zh/customization/hooks.md index e191614d0..5a892a3c6 100644 --- a/docs/zh/customization/hooks.md +++ b/docs/zh/customization/hooks.md @@ -36,7 +36,7 @@ Kimi Code CLI 支持 13 种生命周期事件: | `SubagentStop` | 子 Agent 结束时 | Agent 名称 | `agent_name`, `response` | | `PreCompact` | 上下文压缩前 | 触发原因 | `trigger`, `token_count` | | `PostCompact` | 上下文压缩后 | 触发原因 | `trigger`, `estimated_token_count` | -| `Notification` | 通知发送到 sink 时 | sink 名称 | `sink`, `notification_type`, `title`, `body`, `severity` | +| `Notification` | 通知发送到 sink 时 | 通知类型 | `sink`, `notification_type`, `title`, `body`, `severity` | ## 配置 Hooks @@ -56,11 +56,11 @@ matcher = "WriteFile|StrReplaceFile" command = ".kimi/hooks/protect-env.sh" timeout = 10 -# 需要审批时发送桌面通知 +# 后台任务结束时发送桌面通知 [[hooks]] event = "Notification" -matcher = "permission_prompt" -command = "osascript -e 'display notification \"Kimi needs attention\" with title \"Kimi CLI\"'" +matcher = "task[.]completed|task[.]failed" +command = "osascript -e 'display notification \"Kimi task finished\" with title \"Kimi CLI\"'" # 会话结束前检查任务完成情况 [[hooks]] diff --git a/tests/hooks/test_integration.py b/tests/hooks/test_integration.py index c91e7514d..643077abb 100644 --- a/tests/hooks/test_integration.py +++ b/tests/hooks/test_integration.py @@ -109,7 +109,7 @@ def test_config_roundtrip_toml(): [[hooks]] event = "Notification" -matcher = "permission_prompt" +matcher = "task[.]completed|task[.]failed" command = "notify-send Kimi" timeout = 5 """