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: 修复agent-data.json查看与更新问题
ray_le27bc682cdfa3
diff --git a/jiuwenclaw/agentserver/skill_manager.py b/jiuwenclaw/agentserver/skill_manager.pyindex 1bd883dbaa..9adb72fe8f 100644--- a/jiuwenclaw/agentserver/skill_manager.py+++ b/jiuwenclaw/agentserver/skill_manager.py@@ -1701,7 +1701,7 @@ class SkillManager:def _generate_agent_data_for_workspace(workspace_root: Path) -> None:"""Generate agent/jiuwenclaw_workspace/agent-data.json from agent tree."""agent_root = workspace_root.resolve()- output_path = (agent_root / "jiuwenclaw_workspace" / "agent-data.json").resolve()+ output_path = (agent_root / "agent-data.json").resolve()root_folder_key = "__root__"if not agent_root.exists() or not agent_root.is_dir():@@ -1709,11 +1709,10 @@ class SkillManager:folder_data: dict[str, list[dict[str, str | bool]]] = {}seen_paths: dict[str, set[str]] = {}- for entry in sorted((agent_root / "jiuwenclaw_workspace").rglob("*")):+ for entry in sorted(agent_root.rglob("*")):if not entry.is_file():continue- relative_file_path = entry.relative_to(agent_root).as_posix()- relative_folder_path = entry.parent.relative_to(agent_root).as_posix()+ relative_folder_path = entry.parent.relative_to(agent_root.parent).as_posix()folder_key = root_folder_key if relative_folder_path == "." else relative_folder_pathdisplay_name = SkillManager._normalize_lang_suffix(entry.name)diff --git a/jiuwenclaw/app_web.py b/jiuwenclaw/app_web.pyindex 5b7dfc89da..e6990d26d0 100644--- a/jiuwenclaw/app_web.py+++ b/jiuwenclaw/app_web.py@@ -19,7 +19,8 @@ from pathlib import Pathfrom typing import Anyfrom urllib.parse import unquote, urlparse-from jiuwenclaw.utils import get_logs_dir, get_root_dir, is_package_installation+from jiuwenclaw.utils import get_agent_root_dir, get_logs_dir, \+ get_root_dir, get_user_workspace_dir, is_package_installationdef _get_package_dir() -> Path:@@ -64,7 +65,8 @@ def _normalize_lang_suffix(name: str) -> str:def _generate_agent_data(project_root: Path) -> None:"""Generate agent/jiuwenclaw_workspace/agent-data.json from agent tree."""agent_root = (project_root / "agent").resolve()- output_path = (agent_root / "jiuwenclaw_workspace" / "agent-data.json").resolve()+ workspace_root = (agent_root / "jiuwenclaw_workspace").resolve()+ output_path = (workspace_root / "agent-data.json").resolve()root_folder_key = "__root__"if not agent_root.exists():@@ -74,7 +76,7 @@ def _generate_agent_data(project_root: Path) -> None:folder_data: dict[str, list[dict[str, str | bool]]] = {}seen_paths: dict[str, set[str]] = {} # folder_key -> normalized paths,用于去重- for entry in sorted((agent_root / "jiuwenclaw_workspace").rglob("*")):+ for entry in sorted(workspace_root.rglob("*")):if not entry.is_file() or entry.name.startswith("."):continuerelative_folder_path = entry.parent.relative_to(agent_root).as_posix()@@ -127,9 +129,9 @@ class _SpaStaticHandler(SimpleHTTPRequestHandler):api_target = ""ws_target = ""ws_disable_compress = False- project_root = Path(".").resolve()- workspace_root = Path(".").resolve()- logs_root = Path(".").resolve()+ project_root = get_user_workspace_dir()+ workspace_root = get_agent_root_dir()+ logs_root = get_logs_dir()logger = logging.getLogger(__name__)_HOP_BY_HOP_HEADERS = {@@ -833,7 +835,7 @@ def main() -> None:# default_project_root should be the user workspace root (~/.jiuwenclaw in package mode)# get_root_dir() already handles this correctly- default_project_root = get_root_dir()+ default_project_root = get_user_workspace_dir()project_root = default_project_rootworkspace_root = (project_root / "agent").resolve()diff --git a/jiuwenclaw/utils.py b/jiuwenclaw/utils.pyindex 15026d015f..f6eb1a667b 100644--- a/jiuwenclaw/utils.py+++ b/jiuwenclaw/utils.py@@ -451,7 +451,7 @@ def prepare_workspace(overwrite: bool = True, preferred_language: Optional[str]_copy_dir(template_agent_workspace,deepagent_workspace,- ignore_patterns=("*_ZH.md", "*_EN.md"),+ ignore_patterns=("*_ZH.md", "*_EN.md", "skills"),)else:deepagent_workspace.mkdir(parents=True, exist_ok=True)