diff --git a/agentskills/test/SKILL.md b/agentskills/test/SKILL.md deleted file mode 100644 index 7a7b311..0000000 --- a/agentskills/test/SKILL.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: Test Skill -description: Validate skills loading and read_file flow. -example_prompts: - - "Use the test skill to explain how to proceed." -tools: - - read_file -tags: - - test ---- - -# Test Skill - -This skill exists to verify that the skills system can discover, list, sync, -and read SKILL.md content via read_file. Replace this content later. diff --git a/config/paths.py b/config/paths.py index 3999db9..b7b8ab9 100644 --- a/config/paths.py +++ b/config/paths.py @@ -105,6 +105,9 @@ USER_SPACE_DIR = _runtime_dir("USER_SPACE_DIR", "users") # API 专用用户与工作区(与网页用户隔离) API_USER_SPACE_DIR = _runtime_dir("API_USER_SPACE_DIR", "api/users") +# ── 用户自定义 skill 归档目录(host 模式全局;docker/web 模式可与 per-user 并存)── +CUSTOM_SKILLS_DIR = str(Path(RUNTIME_ROOT) / _MODE / "agentskills") + # ── 是否宿主机模式 ── IS_HOST_MODE = _MODE == "host" @@ -190,6 +193,7 @@ __all__ = [ "INVITE_CODES_FILE", "ADMIN_POLICY_FILE", "API_USER_SPACE_DIR", + "CUSTOM_SKILLS_DIR", "API_USERS_DB_FILE", "API_TOKENS_FILE", "API_USAGE_FILE", diff --git a/core/main_terminal_parts/tools_execution.py b/core/main_terminal_parts/tools_execution.py index d749574..7e3cb10 100644 --- a/core/main_terminal_parts/tools_execution.py +++ b/core/main_terminal_parts/tools_execution.py @@ -26,7 +26,6 @@ try: READONLY_RUN_COMMAND_ALLOWED, READONLY_RUN_COMMAND_ALLOWED_GIT_SUBCOMMANDS, READONLY_RUN_COMMAND_BLOCKED_TOKENS, - AGENT_SKILLS_DIR, ) except ImportError: import sys @@ -50,7 +49,6 @@ except ImportError: READONLY_RUN_COMMAND_ALLOWED, READONLY_RUN_COMMAND_ALLOWED_GIT_SUBCOMMANDS, READONLY_RUN_COMMAND_BLOCKED_TOKENS, - AGENT_SKILLS_DIR, ) from modules.file_manager import FileManager @@ -496,9 +494,6 @@ class MainTerminalToolsExecutionMixin: return (project_root / candidate).resolve() def _get_create_skill_target_root(self) -> Path: - if self._is_host_mode(): - return Path(AGENT_SKILLS_DIR).expanduser().resolve() - inferred = infer_private_skills_dir(self.data_dir) if inferred: return inferred diff --git a/modules/skills_manager.py b/modules/skills_manager.py index 9c0dae5..1fd85e3 100644 --- a/modules/skills_manager.py +++ b/modules/skills_manager.py @@ -11,7 +11,7 @@ import threading from pathlib import Path from typing import Dict, List, Optional, Sequence -from config import AGENT_SKILLS_DIR, WORKSPACE_SKILLS_DIRNAME +from config import AGENT_SKILLS_DIR, CUSTOM_SKILLS_DIR, IS_HOST_MODE, WORKSPACE_SKILLS_DIRNAME from utils.logger import setup_logger logger = setup_logger(__name__) @@ -48,10 +48,15 @@ def ensure_workspace_skills_dir(project_path: str | Path) -> Path: def infer_private_skills_dir(data_dir: str | Path | None) -> Optional[Path]: - """Infer per-user private skills dir from workspace data_dir.""" + """Infer per-user private skills dir from workspace data_dir. + + host 模式下统一使用运行态根下的 ``agentskills``,不再按用户拆分。 + """ if not data_dir: return None try: + if IS_HOST_MODE: + return Path(CUSTOM_SKILLS_DIR).expanduser().resolve() data_path = Path(data_dir).expanduser().resolve() if data_path.name == "data" and data_path.parent.parent.name == "workspaces": return (data_path.parent.parent.parent / "agentskills").resolve()