JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix: issue 261
Haowei_Du15bad8a231fc
diff --git a/jiuwenclaw/agentserver/skill_manager.py b/jiuwenclaw/agentserver/skill_manager.pyindex 6e6a38e40e..dbd8f817e4 100644--- a/jiuwenclaw/agentserver/skill_manager.py+++ b/jiuwenclaw/agentserver/skill_manager.py@@ -16,7 +16,7 @@ from datetime import datetime, timezonefrom pathlib import Pathfrom typing import Any, Awaitable, Callablefrom urllib.parse import urlparse-+import yamlfrom jiuwenclaw.utils import (get_agent_root_dir,get_agent_skills_dir,@@ -1289,23 +1289,31 @@ class SkillManager:if fm_match:fm_text = fm_match.group(1)body = fm_match.group(2).strip()- # 简单 YAML 解析(key: value 格式),避免引入额外依赖- for line in fm_text.splitlines():- line = line.strip()- if not line or line.startswith("#"):- continue- m = re.match(r"^(\w[\w_-]*)\s*:\s*(.*)", line)- if m:- key = m.group(1)- val = m.group(2).strip()- # 处理 YAML 列表 [a, b, c]- if val.startswith("[") and val.endswith("]"):- inner = val[1:-1]- val = [v.strip().strip("'\"") for v in inner.split(",") if v.strip()]- # 去掉引号- elif val.startswith(("'", '"')) and val.endswith(("'", '"')):- val = val[1:-1]- meta[key] = val+ # 优先完整 YAML(支持 description: >- 多行、嵌套等),与 openjiuwen register_skill 一致+ try:+ loaded = yaml.safe_load(fm_text)+ if isinstance(loaded, dict):+ meta = {str(k): v for k, v in loaded.items()}+ else:+ meta = {}+ except Exception:+ meta = {}+ if not meta:+ # 回退:逐行 key: value(旧逻辑,无 PyYAML 语义)+ for line in fm_text.splitlines():+ line = line.strip()+ if not line or line.startswith("#"):+ continue+ m = re.match(r"^(\w[\w_-]*)\s*:\s*(.*)", line)+ if m:+ key = m.group(1)+ val = m.group(2).strip()+ if val.startswith("[") and val.endswith("]"):+ inner = val[1:-1]+ val = [v.strip().strip("'\"") for v in inner.split(",") if v.strip()]+ elif val.startswith(("'", '"')) and val.endswith(("'", '"')):+ val = val[1:-1]+ meta[key] = val# 如果没有 name,从文件名推断if "name" not in meta:diff --git a/jiuwenclaw/gateway/message_handler.py b/jiuwenclaw/gateway/message_handler.pyindex 60c1114ab8..10ddec599f 100644--- a/jiuwenclaw/gateway/message_handler.py+++ b/jiuwenclaw/gateway/message_handler.py@@ -240,7 +240,7 @@ class MessageHandler(ABC):params={},timestamp=time.time(),ok=True,- payload={"content": text},+ payload={"content": text, "is_complete": True},event_type=EventType.CHAT_FINAL,metadata=user_infos['meta_data'])diff --git a/jiuwenclaw/resources/agent/jiuwenclaw_workspace/skills/cross-channel-history-retrieval/SKILL.md b/jiuwenclaw/resources/agent/jiuwenclaw_workspace/skills/cross-channel-history-retrieval/SKILL.mdindex 7da900e8df..d955e69eea 100644--- a/jiuwenclaw/resources/agent/jiuwenclaw_workspace/skills/cross-channel-history-retrieval/SKILL.md+++ b/jiuwenclaw/resources/agent/jiuwenclaw_workspace/skills/cross-channel-history-retrieval/SKILL.md@@ -1,7 +1,7 @@---name: cross-channel-history-retrieval-description: 跨会话检索聊天原文(记忆不足时再用)-在回答任何关于历史事件、日期、人物、过去对话的问题时,如果记忆中没有相关信息或不足以回答,则需要使用跨会话检索聊天原文。用 mcp_exec_command 执行 scripts/search_history.py,读 ~/.jiuwenclaw/agent/sessions/*/history.json。支持 channel、session_id、关键词、时间窗。如果搜索结果不足,尝试用不同的关键词再次搜索。+description: >-+ 跨会话检索聊天原文(记忆不足时再用)。在回答任何关于历史事件、日期、人物、过去对话的问题时,如果记忆中没有相关信息或不足以回答,则需要使用跨会话检索聊天原文。用 mcp_exec_command 执行 scripts/search_history.py,读 ~/.jiuwenclaw/agent/sessions/*/history.json。支持 channel、session_id、关键词、时间窗。如果搜索结果不足,尝试用不同的关键词再次搜索。allowed_tools: [mcp_exec_command]---