qwen_agent/agent
朱潮 c7e9f305b7 feat: 实现 Claude Plugins 模式的 Hook 机制
- 新增 agent/plugin_hook_loader.py:支持通过 .claude-plugin/plugin.json 配置 hooks 和 mcpServers
- 修改 agent/prompt_loader.py:集成 PrePrompt hooks,优先读取 skill MCP 配置
- 修改 routes/chat.py:添加 PostAgent 和 PreSave hooks
- 修改 routes/skill_manager.py:优先从 plugin.json 读取 name/description,fallback 到 SKILL.md
- 删除旧的 agent/skill_hook_loader.py
- 新增示例 skill user-context-loader,演示完整的 hooks 用法

Hook 类型:
- PrePrompt: 在 system_prompt 加载时注入内容
- PostAgent: 在 agent 执行后处理
- PreSave: 在消息保存前处理

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 20:15:54 +08:00
..
__init__.py 新增agent文件夹,修改import引用,增加custom_mcp_manager 2025-11-26 17:23:02 +08:00
agent_config.py rename general agent 2026-02-06 17:05:17 +08:00
agent_memory_cache.py 修改balance资源配置 2025-12-23 23:11:24 +08:00
chat_history_manager.py db_pool 2026-01-19 23:39:04 +08:00
checkpoint_manager.py db_pool 2026-01-19 23:39:04 +08:00
checkpoint_utils.py refactor: migrate from Memori to Mem0 for long-term memory 2026-01-20 21:15:30 +08:00
config_cache.py 修改general_agent提示词 2025-12-03 17:53:18 +08:00
db_pool_manager.py refactor(mem0): optimize connection pool and async memory handling 2026-01-22 19:39:12 +08:00
deep_assistant.py rename general agent 2026-02-06 17:05:17 +08:00
guideline_middleware.py rename general agent 2026-02-06 17:05:17 +08:00
logging_handler.py add agent/tool_use_cleanup_middleware.py 2025-12-23 12:04:26 +08:00
mem0_config.py patch 2026-01-21 13:23:11 +08:00
mem0_manager.py refactor(mem0): optimize connection pool and async memory handling 2026-01-22 19:39:12 +08:00
mem0_middleware.py refactor(mem0): optimize connection pool and async memory handling 2026-01-22 19:39:12 +08:00
plugin_hook_loader.py feat: 实现 Claude Plugins 模式的 Hook 机制 2026-02-06 20:15:54 +08:00
prompt_loader.py feat: 实现 Claude Plugins 模式的 Hook 机制 2026-02-06 20:15:54 +08:00
summarization_middleware.py update summary 2026-02-04 15:31:41 +08:00
tool_output_length_middleware.py add MCP_HTTP_TIMEOUT and try catch 2025-12-23 20:13:46 +08:00
tool_use_cleanup_middleware.py 修复完成。主要改动: 1. 新增 _clean_content_blocks 方法:专门处理 content 字段的清理 - 当 content 是列表格式时,过滤掉 type: 'tool_use' 的块(如果 id 不在 valid_tool_call_ids 中) - 返回清理后的 content 和是否有文本内容的标志 2. 更新 _cleanup_tool_use_messages 方法: - 调用 _clean_content_blocks 来清理 content - 使用清理后的 cleaned_content 创建新的 AIMessage 问题根源:之前的代码只清空了 tool_calls=[],但没有从 content 列表中移除 type: 'tool_use' 的块。Anthropic API 会检查这两个地方,导致报错。 2025-12-23 19:11:27 +08:00