把 Hook 的反馈信息合并到工具输出中。 对应源码: conversation.rs:408-424
(hook_messages: list[str], output: str, denied: bool)
| 290 | # 返回工具结果 |
| 291 | |
| 292 | def merge_hook_feedback(hook_messages: list[str], output: str, denied: bool) -> str: |
| 293 | """ |
| 294 | 把 Hook 的反馈信息合并到工具输出中。 |
| 295 | |
| 296 | 对应源码: conversation.rs:408-424 |
| 297 | """ |
| 298 | if not hook_messages: |
| 299 | return output |
| 300 | |
| 301 | sections = [] |
| 302 | if output.strip(): |
| 303 | sections.append(output) |
| 304 | |
| 305 | label = "Hook feedback (denied)" if denied else "Hook feedback" |
| 306 | sections.append(f"{label}:\n" + "\n".join(hook_messages)) |
| 307 | |
| 308 | return "\n\n".join(sections) |
| 309 | |
| 310 | |
| 311 | # ============================================================ |