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 (harmony): 修复鸿蒙pc上,集群模式下Agentic技能检索技能可见性问题
xutuo5baad226d36f
diff --git a/jiuwenswarm/agents/swarm/providers/tools.py b/jiuwenswarm/agents/swarm/providers/tools.pyindex 27f392fe59..78f6767aa1 100644--- a/jiuwenswarm/agents/swarm/providers/tools.py+++ b/jiuwenswarm/agents/swarm/providers/tools.py@@ -197,21 +197,23 @@ def _collect_disabled_skills_from_state(skill_dirs: list[str]) -> set[str]:def _list_skill_dirs_for_context(ctx: SwarmBuildContext) -> list[str]:workspace = getattr(ctx, "workspace", None)- if workspace is None:- return []-skill_dirs: list[str] = []- get_node_path = getattr(workspace, "get_node_path", None)- if callable(get_node_path):- skills_base = get_node_path("skills")- if skills_base:- skill_dirs.append(str(skills_base))-- list_team_links = getattr(workspace, "list_team_links", None)- if callable(list_team_links):- for _team_id, target_path in list_team_links():- skill_dirs.append(str(Path(target_path) / "skills"))- return skill_dirs+ if workspace is not None:+ get_node_path = getattr(workspace, "get_node_path", None)+ if callable(get_node_path):+ skills_base = get_node_path("skills")+ if skills_base:+ skill_dirs.append(str(skills_base))++ list_team_links = getattr(workspace, "list_team_links", None)+ if callable(list_team_links):+ for _team_id, target_path in list_team_links():+ skill_dirs.append(str(Path(target_path) / "skills"))++ team_skills_dir = getattr(ctx, "team_skills_dir", None)+ if team_skills_dir:+ skill_dirs.append(str(team_skills_dir))+ return list(dict.fromkeys(skill_dirs))def visible_skill_names_for_list_skill(ctx: SwarmBuildContext) -> set[str]:diff --git a/tests/agents/swarm/test_swarm_assembly.py b/tests/agents/swarm/test_swarm_assembly.pyindex e22b8a8adb..4776ff98a5 100644--- a/tests/agents/swarm/test_swarm_assembly.py+++ b/tests/agents/swarm/test_swarm_assembly.py@@ -491,6 +491,30 @@ def test_swarm_skill_retrieval_tools_use_global_skill_manager(assert calls == [None]+def test_swarm_skill_retrieval_uses_context_team_skills_when_team_links_are_unavailable(+ tmp_path: Path,+) -> None:+ """HarmonyOS copied team mounts remain visible without symlink metadata."""+ member_skills = tmp_path / "member-workspace" / "skills"+ team_skills = tmp_path / "team-workspace" / "skills"+ skill_dir = team_skills / "demo-skill"+ member_skills.mkdir(parents=True)+ skill_dir.mkdir(parents=True)+ (skill_dir / "SKILL.md").write_text("# Demo", encoding="utf-8")++ workspace = SimpleNamespace(+ get_node_path=lambda _node: member_skills,+ list_team_links=lambda: [],+ )+ ctx = SwarmBuildContext(+ mode="team",+ workspace=workspace,+ team_skills_dir=str(team_skills),+ )++ assert tools.visible_skill_names_for_list_skill(ctx) == {"demo-skill"}++def test_swarm_skill_retrieval_prompt_uses_global_skill_manager(monkeypatch: pytest.MonkeyPatch,tmp_path: Path,