通知是即发即弃的 — 不发送响应
(self, event_type: str, payload: Dict[str, Any], depth: int)
| 158 | return {"action": action, "reason": reason} |
| 159 | |
| 160 | def _handle_notification(self, event_type: str, payload: Dict[str, Any], depth: int): |
| 161 | """通知是即发即弃的 — 不发送响应""" |
| 162 | if event_type == "post_action": |
| 163 | tool = payload.get("tool", "?") |
| 164 | output_len = len(str((payload.get("result") or {}).get("output", ""))) |
| 165 | log(f"post_action (通知): tool={tool} output={output_len}B depth={depth}") |
| 166 | elif event_type == "session_start": |
| 167 | log(f"会话开始: {payload.get('session_id', '?')} depth={depth}") |
| 168 | elif event_type == "session_end": |
| 169 | log(f"会话结束。最终统计: {self.stats}") |
| 170 | |
| 171 | def _handle_handshake(self, params: Dict[str, Any]) -> Dict[str, Any]: |
| 172 | """处理 AHP 握手请求""" |