Agent Zero AI framework
Add skill visibility controls
Alessandro5e2c2a86efe1
diff --git a/extensions/python/message_loop_prompts_after/_65_include_loaded_skills.py b/extensions/python/message_loop_prompts_after/_65_include_loaded_skills.pyindex 04c86fc8a..b3f88f988 100644--- a/extensions/python/message_loop_prompts_after/_65_include_loaded_skills.py+++ b/extensions/python/message_loop_prompts_after/_65_include_loaded_skills.py@@ -18,9 +18,14 @@ class IncludeLoadedSkills(Extension):# load skill text herecontent = ""+ visible_skill_names = []for skill_name in skill_names:+ if not skills.find_skill(skill_name, agent=self.agent):+ continue+ visible_skill_names.append(skill_name)skill_data = skills.load_skill_for_agent(skill_name=skill_name, agent=self.agent)content += "\n\n" + skill_data+ self.agent.data[DATA_NAME_LOADED_SKILLS] = visible_skill_namescontent = content.strip()if not content:returndiff --git a/helpers/skills.py b/helpers/skills.pyindex 1112d2973..082f1e0ab 100644--- a/helpers/skills.py+++ b/helpers/skills.py@@ -23,6 +23,7 @@ ACTIVE_SKILLS_PLUGIN_NAME = "_skills"AGENT_DATA_NAME_LOADED_SKILLS = "loaded_skills"CONTEXT_DATA_NAME_CHAT_ACTIVE_SKILLS = "skills_chat_active"CONTEXT_DATA_NAME_CHAT_DISABLED_SKILLS = "skills_chat_disabled"+CONTEXT_DATA_NAME_CHAT_VISIBLE_SKILLS = "skills_chat_visible"class ActiveSkillEntry(TypedDict, total=False):@@ -35,6 +36,7 @@ class CatalogSkill(TypedDict):description: strpath: strorigin: str+ hidden: bool@dataclass(slots=True)@@ -322,6 +324,7 @@ def skill_from_markdown(def list_skills(agent:Agent|None=None,include_content: bool = False,+ include_hidden: bool = False,) -> List[Skill]:"""List skills, optionally filtered by agent scope."""skills: List[Skill] = []@@ -345,7 +348,10 @@ def list_skills(if key and key not in by_name:by_name[key] = s- return list(by_name.values())+ result = list(by_name.values())+ if include_hidden:+ return result+ return _filter_hidden_skills(agent, result)def delete_skill(@@ -380,6 +386,7 @@ def find_skill(skill_name: str,agent:Agent|None=None,include_content: bool = False,+ include_hidden: bool = False,) -> Optional[Skill]:target = _normalize_name(skill_name)if not target:@@ -393,6 +400,8 @@ def find_skill(if not s:continueif _normalize_name(s.name) == target or _normalize_name(s.path.name) == target:+ if not include_hidden and _skill_is_hidden_for_agent(agent, s):+ continuereturn sreturn None@@ -470,6 +479,7 @@ def search_skills(query: str,limit: int = 25,agent: Agent|None=None,+ include_hidden: bool = False,) -> List[Skill]:q = (query or "").strip().lower()if not q:@@ -480,7 +490,7 @@ def search_skills(t for t in raw_termsif len(t) >= 3 or any(ch.isdigit() for ch in t)] or raw_terms- candidates = list_skills(agent)+ candidates = list_skills(agent, include_hidden=include_hidden)scored: List[Tuple[int, Skill]] = []for s in candidates:@@ -580,10 +590,25 @@ def normalize_skills_config(config: dict[str, Any] | None) -> dict[str, Any]:normalized["active_skills"] = normalize_active_skills(normalized.get("active_skills"))+ normalized["hidden_skills"] = normalize_hidden_skills(+ normalized.get("hidden_skills")+ )return normalizeddef normalize_active_skills(raw: Any) -> list[ActiveSkillEntry]:+ return normalize_skill_entries(raw, limit=get_max_active_skills())+++def normalize_hidden_skills(raw: Any) -> list[ActiveSkillEntry]:+ return normalize_skill_entries(raw, limit=None)+++def normalize_skill_entries(+ raw: Any,+ *,+ limit: int | None = None,+) -> list[ActiveSkillEntry]:if not isinstance(raw, list):return []@@ -601,7 +626,7 @@ def normalize_active_skills(raw: Any) -> list[ActiveSkillEntry]:seen.add(key)normalized.append(entry)- if len(normalized) >= get_max_active_skills():+ if limit is not None and len(normalized) >= limit:breakreturn normalized@@ -616,6 +641,7 @@ def list_skill_catalog(catalog: list[CatalogSkill] = []seen_paths: set[str] = set()+ hidden_entries = get_hidden_skills(agent) if agent else []for root in _get_catalog_roots(project_name=project_name, agent=agent):root_path = Path(root)@@ -638,6 +664,7 @@ def list_skill_catalog(runtime_path,project_name=project_name,),+ "hidden": _skill_matches_entries(skill, hidden_entries),})@@ -662,6 +689,23 @@ def get_scope_active_skills(agent: Agent | None) -> list[ActiveSkillEntry]:return normalize_active_skills(config.get("active_skills"))+def get_scope_hidden_skills(agent: Agent | None) -> list[ActiveSkillEntry]:+ if not agent:+ return []++ project_name = _get_agent_project_name(agent)+ config = (+ plugin_helpers.get_plugin_config(+ ACTIVE_SKILLS_PLUGIN_NAME,+ agent=agent,+ project_name=project_name,+ agent_profile="",+ )+ or {}+ )+ return normalize_hidden_skills(config.get("hidden_skills"))++def get_chat_active_skills(context: Any | None) -> list[ActiveSkillEntry]:if not context:return []@@ -671,16 +715,37 @@ def get_chat_active_skills(context: Any | None) -> list[ActiveSkillEntry]:def get_chat_disabled_skills(context: Any | None) -> list[ActiveSkillEntry]:if not context:return []- return normalize_active_skills(+ return normalize_hidden_skills(context.get_data(CONTEXT_DATA_NAME_CHAT_DISABLED_SKILLS))+def get_chat_visible_skills(context: Any | None) -> list[ActiveSkillEntry]:+ if not context:+ return []+ return normalize_hidden_skills(+ context.get_data(CONTEXT_DATA_NAME_CHAT_VISIBLE_SKILLS)+ )+++def get_hidden_skills(agent: Agent | None) -> list[ActiveSkillEntry]:+ if not agent:+ return []++ context = getattr(agent, "context", None)+ return _merge_hidden_skill_entries(+ get_scope_hidden_skills(agent),+ get_chat_disabled_skills(context),+ get_chat_visible_skills(context),+ )++def _build_active_skills(agent: Agent | None,*,chat_entries: list[ActiveSkillEntry] | None = None,- disabled_entries: list[ActiveSkillEntry] | None = None,+ hidden_entries: list[ActiveSkillEntry] | None = None,+ visible_entries: list[ActiveSkillEntry] | None = None,limit: int | None = None,) -> list[ActiveSkillEntry]:if not agent:@@ -692,15 +757,25 @@ def _build_active_skills(current_chat_entries = list(chat_entries if chat_entries is not None else get_chat_active_skills(context))- current_disabled_entries = list(- disabled_entries- if disabled_entries is not None+ current_hidden_entries = list(+ hidden_entries+ if hidden_entries is not Noneelse get_chat_disabled_skills(context))+ current_visible_entries = list(+ visible_entries+ if visible_entries is not None+ else get_chat_visible_skills(context)+ )+ effective_hidden_entries = _merge_hidden_skill_entries(+ get_scope_hidden_skills(agent),+ current_hidden_entries,+ current_visible_entries,+ )return _merge_active_skill_entries(scope_entries,current_chat_entries,- current_disabled_entries,+ effective_hidden_entries,limit=effective_limit,)@@ -766,19 +841,27 @@ def activate_chat_skill(agent: Agent, entry: Any) -> list[ActiveSkillEntry]:for item in get_chat_active_skills(context)if not _entries_match(item, normalized)]- disabled_entries = [+ hidden_entries = [itemfor item in get_chat_disabled_skills(context)if not _entries_match(item, normalized)]+ visible_entries = [+ item+ for item in get_chat_visible_skills(context)+ if not _entries_match(item, normalized)+ ]if not any(_entries_match(item, normalized) for item in scope_entries):chat_entries.append(normalized)+ if _entry_matches_any(normalized, get_scope_hidden_skills(agent)):+ visible_entries.append(normalized)merged_entries = _build_active_skills(agent,chat_entries=chat_entries,- disabled_entries=disabled_entries,+ hidden_entries=hidden_entries,+ visible_entries=visible_entries,limit=-1,)if len(merged_entries) > get_max_active_skills():@@ -791,10 +874,15 @@ def activate_chat_skill(agent: Agent, entry: Any) -> list[ActiveSkillEntry]:CONTEXT_DATA_NAME_CHAT_ACTIVE_SKILLS,chat_entries,)- _store_context_active_skill_entries(+ _store_context_hidden_skill_entries(context,CONTEXT_DATA_NAME_CHAT_DISABLED_SKILLS,- disabled_entries,+ hidden_entries,+ )+ _store_context_hidden_skill_entries(+ context,+ CONTEXT_DATA_NAME_CHAT_VISIBLE_SKILLS,+ visible_entries,)return get_active_skills(agent)@@ -813,38 +901,129 @@ def deactivate_chat_skill(agent: Agent, entry: Any) -> list[ActiveSkillEntry]:for item in get_chat_active_skills(context)if not _entries_match(item, normalized)]- disabled_entries = [+ hidden_entries = [itemfor item in get_chat_disabled_skills(context)if not _entries_match(item, normalized)]+ visible_entries = [+ item+ for item in get_chat_visible_skills(context)+ if not _entries_match(item, normalized)+ ]is_scope_default = any(_entries_match(item, normalized) for item in get_scope_active_skills(agent))if is_scope_default:- disabled_entries.append(normalized)+ hidden_entries.append(normalized)_store_context_active_skill_entries(context,CONTEXT_DATA_NAME_CHAT_ACTIVE_SKILLS,chat_entries,)- _store_context_active_skill_entries(+ _store_context_hidden_skill_entries(context,CONTEXT_DATA_NAME_CHAT_DISABLED_SKILLS,- disabled_entries,+ hidden_entries,+ )+ _store_context_hidden_skill_entries(+ context,+ CONTEXT_DATA_NAME_CHAT_VISIBLE_SKILLS,+ visible_entries,)return get_active_skills(agent)+def hide_chat_skill(agent: Agent, entry: Any) -> list[ActiveSkillEntry]:+ normalized = _normalize_active_skill_entry(entry)+ if not normalized:+ raise ValueError("A skill name or path is required.")++ context = getattr(agent, "context", None)+ if not context:+ raise ValueError("A chat context is required.")++ chat_entries = [+ item+ for item in get_chat_active_skills(context)+ if not _entries_match(item, normalized)+ ]+ hidden_entries = [+ item+ for item in get_chat_disabled_skills(context)+ if not _entries_match(item, normalized)+ ]+ hidden_entries.append(normalized)+ visible_entries = [+ item+ for item in get_chat_visible_skills(context)+ if not _entries_match(item, normalized)+ ]++ _store_context_active_skill_entries(+ context,+ CONTEXT_DATA_NAME_CHAT_ACTIVE_SKILLS,+ chat_entries,+ )+ _store_context_hidden_skill_entries(+ context,+ CONTEXT_DATA_NAME_CHAT_DISABLED_SKILLS,+ hidden_entries,+ )+ _store_context_hidden_skill_entries(+ context,+ CONTEXT_DATA_NAME_CHAT_VISIBLE_SKILLS,+ visible_entries,+ )+ unload_agent_skill(agent, normalized)+ return get_hidden_skills(agent)+++def show_chat_skill(agent: Agent, entry: Any) -> list[ActiveSkillEntry]:+ normalized = _normalize_active_skill_entry(entry)+ if not normalized:+ raise ValueError("A skill name or path is required.")++ context = getattr(agent, "context", None)+ if not context:+ raise ValueError("A chat context is required.")++ hidden_entries = [+ item+ for item in get_chat_disabled_skills(context)+ if not _entries_match(item, normalized)+ ]+ visible_entries = [+ item+ for item in get_chat_visible_skills(context)+ if not _entries_match(item, normalized)+ ]+ if _entry_matches_any(normalized, get_scope_hidden_skills(agent)):+ visible_entries.append(normalized)++ _store_context_hidden_skill_entries(+ context,+ CONTEXT_DATA_NAME_CHAT_DISABLED_SKILLS,+ hidden_entries,+ )+ _store_context_hidden_skill_entries(+ context,+ CONTEXT_DATA_NAME_CHAT_VISIBLE_SKILLS,+ visible_entries,+ )+ return get_hidden_skills(agent)++def clear_chat_skill_overrides(agent: Agent) -> list[ActiveSkillEntry]:context = getattr(agent, "context", None)if not context:raise ValueError("A chat context is required.")_store_context_active_skill_entries(context, CONTEXT_DATA_NAME_CHAT_ACTIVE_SKILLS, [])- _store_context_active_skill_entries(context, CONTEXT_DATA_NAME_CHAT_DISABLED_SKILLS, [])+ _store_context_hidden_skill_entries(context, CONTEXT_DATA_NAME_CHAT_DISABLED_SKILLS, [])+ _store_context_hidden_skill_entries(context, CONTEXT_DATA_NAME_CHAT_VISIBLE_SKILLS, [])return get_active_skills(agent)@@ -940,6 +1119,13 @@ def _entries_match(left: ActiveSkillEntry, right: ActiveSkillEntry) -> bool:return bool(_entry_keys(left) & _entry_keys(right))+def _entry_matches_any(+ entry: ActiveSkillEntry,+ entries: list[ActiveSkillEntry],+) -> bool:+ return any(_entries_match(item, entry) for item in entries)++def _get_agent_project_name(agent: Agent | None) -> str:context = getattr(agent, "context", None)if not context:@@ -1006,6 +1192,28 @@ def _merge_active_skill_entries(return merged+def _merge_hidden_skill_entries(+ scope_entries: list[ActiveSkillEntry],+ chat_hidden_entries: list[ActiveSkillEntry],+ chat_visible_entries: list[ActiveSkillEntry],+) -> list[ActiveSkillEntry]:+ merged: list[ActiveSkillEntry] = []+ seen: set[str] = set()+ visible_keys = {+ key for entry in chat_visible_entries for key in _entry_keys(entry)+ }++ for entry in [*scope_entries, *chat_hidden_entries]:+ keys = _entry_keys(entry)+ key = _entry_key(entry)+ if not key or keys & seen or keys & visible_keys:+ continue+ seen.update(keys)+ merged.append(entry)++ return merged++def _store_context_active_skill_entries(context: Any,key: str,@@ -1015,6 +1223,15 @@ def _store_context_active_skill_entries(context.set_data(key, normalized_entries or None)+def _store_context_hidden_skill_entries(+ context: Any,+ key: str,+ entries: list[ActiveSkillEntry],+) -> None:+ normalized_entries = normalize_hidden_skills(entries)+ context.set_data(key, normalized_entries or None)++def _resolve_active_skill_entries(agent: Agent | None,entries: list[ActiveSkillEntry],@@ -1090,3 +1307,39 @@ def _load_skill_from_runtime_path(return Nonereturn skill_from_markdown(skill_md, include_content=True)+++def _skill_entry(skill: Skill) -> ActiveSkillEntry:+ return {+ "name": skill.name or skill.path.name,+ "path": files.normalize_a0_path(str(skill.path)),+ }+++def _skill_matches_entries(+ skill: Skill,+ entries: list[ActiveSkillEntry],+) -> bool:+ skill_entry = _skill_entry(skill)+ return any(_entries_match(skill_entry, entry) for entry in entries)+++def _skill_is_hidden_for_agent(agent: Agent | None, skill: Skill) -> bool:+ if not agent:+ return False+ return _skill_matches_entries(skill, get_hidden_skills(agent))+++def _filter_hidden_skills(+ agent: Agent | None,+ skills: list[Skill],+) -> list[Skill]:+ if not agent:+ return skills++ hidden_entries = get_hidden_skills(agent)+ if not hidden_entries:+ return skills+ return [+ skill for skill in skills if not _skill_matches_entries(skill, hidden_entries)+ ]diff --git a/plugins/_skills/README.md b/plugins/_skills/README.mdindex 1aa304a24..4a244cd87 100644--- a/plugins/_skills/README.md+++ b/plugins/_skills/README.md@@ -5,6 +5,7 @@ Skills is a built-in Agent Zero plugin that manages active skills across scope d## What It Does- pins default skills for the current plugin scope+- hides noisy skills from the model-facing available catalog, skill search, and load access- injects the effective active skills into prompt extras on every turn- extends the same config screen with a current-chat mode so users can activate or hide skills live per conversation- supports global and project scoped configurations without agent-profile variants@@ -22,6 +23,7 @@ The shared active-skill state and prompt-resolution logic live in `helpers/skill- keep the active list short because every active skill is injected into prompt extras every turn- the framework-wide cap is 20 active skills+- hidden skills are not capped because they are stored as control data, not injected into the prompt- selected skills are stored in normalized `/a0/...` form so configs stay portable across development and Docker-style layouts- scope defaults can be hidden or supplemented per chat without creating a new conversation- if a configured skill is not visible in the current agent scope, it is skipped quietly instead of breaking the prompt builddiff --git a/plugins/_skills/api/skills_catalog.py b/plugins/_skills/api/skills_catalog.pyindex 04ceb9008..aadf3d9d6 100644--- a/plugins/_skills/api/skills_catalog.py+++ b/plugins/_skills/api/skills_catalog.py@@ -22,6 +22,10 @@ class SkillsCatalog(ApiHandler):return self._activate(input, context_id=context_id)if action == "deactivate":return self._deactivate(input, context_id=context_id)+ if action == "hide":+ return self._hide(input, context_id=context_id)+ if action == "show":+ return self._show(input, context_id=context_id)if action == "clear":return self._clear(context_id=context_id)if action == "get_doc":@@ -45,6 +49,20 @@ class SkillsCatalog(ApiHandler):save_tmp_chat(context)return self._build_state(context_id=context.id)+ def _hide(self, input: dict, *, context_id: str) -> dict[str, Any]:+ context = self._require_context(context_id)+ skill_entry = self._require_skill_entry(input)+ skills.hide_chat_skill(context.get_agent(), skill_entry)+ save_tmp_chat(context)+ return self._build_state(context_id=context.id)++ def _show(self, input: dict, *, context_id: str) -> dict[str, Any]:+ context = self._require_context(context_id)+ skill_entry = self._require_skill_entry(input)+ skills.show_chat_skill(context.get_agent(), skill_entry)+ save_tmp_chat(context)+ return self._build_state(context_id=context.id)+def _clear(self, *, context_id: str) -> dict[str, Any]:context = self._require_context(context_id)skills.clear_chat_skill_overrides(context.get_agent())@@ -70,11 +88,17 @@ class SkillsCatalog(ApiHandler):}scope_entries = skills.get_scope_active_skills(agent)+ scope_hidden_entries = skills.get_scope_hidden_skills(agent)chat_entries = skills.get_chat_active_skills(context)disabled_entries = skills.get_chat_disabled_skills(context)+ visible_entries = skills.get_chat_visible_skills(context)+ hidden_entries = skills.get_hidden_skills(agent)active_entries = self._merge_entries(skills.get_active_skills(agent),- self._get_loaded_skill_entries(agent),+ self._filter_hidden_entries(+ self._get_loaded_skill_entries(agent),+ hidden_entries,+ ),)scope_keys = {@@ -134,6 +158,37 @@ class SkillsCatalog(ApiHandler):)for entry in disabled_entries],+ "hidden_skills": [+ self._serialize_entry(+ entry,+ catalog_by_key,+ catalog_by_name,+ state_source=(+ "Hidden default"+ if self._entry_matches_any(entry, scope_hidden_entries)+ else "Hidden in chat"+ ),+ )+ for entry in hidden_entries+ ],+ "scope_hidden_skills": [+ self._serialize_entry(+ entry,+ catalog_by_key,+ catalog_by_name,+ state_source="Hidden default",+ )+ for entry in scope_hidden_entries+ ],+ "visible_skills": [+ self._serialize_entry(+ entry,+ catalog_by_key,+ catalog_by_name,+ state_source="Visible in chat",+ )+ for entry in visible_entries+ ],}def _get_doc(@@ -218,6 +273,40 @@ class SkillsCatalog(ApiHandler):return merged+ def _filter_hidden_entries(+ self,+ entries: list[dict[str, Any]],+ hidden_entries: list[dict[str, Any]],+ ) -> list[dict[str, Any]]:+ return [+ entry+ for entry in entries+ if not self._entry_matches_any(entry, hidden_entries)+ ]++ def _entry_matches_any(+ self,+ entry: dict[str, Any],+ entries: list[dict[str, Any]],+ ) -> bool:+ keys = {+ str(entry.get("path") or "").strip().lower(),+ str(entry.get("name") or "").strip().lower(),+ }+ keys.discard("")+ if not keys:+ return False++ for candidate in entries:+ candidate_keys = {+ str(candidate.get("path") or "").strip().lower(),+ str(candidate.get("name") or "").strip().lower(),+ }+ candidate_keys.discard("")+ if keys & candidate_keys:+ return True+ return False+def _serialize_entry(self,entry: dict[str, Any],diff --git a/plugins/_skills/default_config.yaml b/plugins/_skills/default_config.yamlindex 50633f69a..956598cff 100644--- a/plugins/_skills/default_config.yaml+++ b/plugins/_skills/default_config.yaml@@ -1 +1,2 @@active_skills: []+hidden_skills: []diff --git a/plugins/_skills/extensions/webui/initFw_end/skills-menu-injector.js b/plugins/_skills/extensions/webui/initFw_end/skills-menu-injector.jsindex fd4ddef13..fc28cbd65 100644--- a/plugins/_skills/extensions/webui/initFw_end/skills-menu-injector.js+++ b/plugins/_skills/extensions/webui/initFw_end/skills-menu-injector.js@@ -18,7 +18,11 @@ function buildButton() {button.addEventListener("click", async () => {chatInputStore.closeChatMoreMenu();const projectName = chatsStore.selectedContext?.project?.name || "";- await pluginSettingsStore.openConfig("_skills", projectName, "", { focus: "chat" });+ await pluginSettingsStore.openConfig("_skills", projectName, "", {+ focus: "chat",+ hideSettingsActions: true,+ title: "Skills",+ });});return button;diff --git a/plugins/_skills/webui/config-store.js b/plugins/_skills/webui/config-store.jsindex aff60e46e..d47beaba1 100644--- a/plugins/_skills/webui/config-store.js+++ b/plugins/_skills/webui/config-store.js@@ -34,31 +34,44 @@ function entryKey(entry) {return String(entry.path || entry.name || "").trim().toLowerCase();}+function entryKeys(entry) {+ return [entry?.path, entry?.name]+ .map((value) => String(value || "").trim().toLowerCase())+ .filter(Boolean);+}++function entriesMatch(left, right) {+ const rightKeys = new Set(entryKeys(right));+ if (rightKeys.size === 0) return false;+ return entryKeys(left).some((key) => rightKeys.has(key));+}+function ensureConfig(config) {if (!config || typeof config !== "object") return;const activeSkills = Array.isArray(config.active_skills) ? config.active_skills : [];+ const hiddenSkills = Array.isArray(config.hidden_skills) ? config.hidden_skills : [];++ config.active_skills = compactEntries(activeSkills, MAX_ACTIVE_SKILLS_FALLBACK);+ config.hidden_skills = compactEntries(hiddenSkills);+}++function compactEntries(entries, limit = null) {const normalized = [];const seen = new Set();- for (const item of activeSkills) {+ for (const item of entries || []) {const entry = normalizeEntry(item);const key = entryKey(entry);if (!entry || !key || seen.has(key)) continue;seen.add(key);- normalized.push(entry);- }-- config.active_skills = normalized;-}--function compactEntries(entries) {- return entries- .map((entry) => normalizeEntry(entry))- .filter(Boolean)- .map((entry) => ({+ normalized.push({...(entry.name ? { name: entry.name } : {}),...(entry.path ? { path: entry.path } : {}),- }));+ });+ if (limit !== null && normalized.length >= limit) break;+ }++ return normalized;}window.createSkillsConfigModel = (context, config) => ({@@ -66,13 +79,21 @@ window.createSkillsConfigModel = (context, config) => ({mutatingChat: false,catalog: [],search: "",+ mode: "pinned",maxActiveSkills: MAX_ACTIVE_SKILLS_FALLBACK,selectedSkills: [],+ hiddenSkills: [],chatContextAvailable: false,initDefaults() {ensureConfig(config);+ this.mode = this.isChatMode ? "visible" : "pinned";this.selectedSkills = [...this.activeEntries];+ this.hiddenSkills = [...this.hiddenEntries];+ },++ get isChatMode() {+ return context?.openOptions?.focus === "chat";},get activeEntries() {@@ -80,6 +101,11 @@ window.createSkillsConfigModel = (context, config) => ({return config.active_skills;},+ get hiddenEntries() {+ ensureConfig(config);+ return config.hidden_skills;+ },+get selectedCount() {return this.selectedSkills.length;},@@ -88,6 +114,22 @@ window.createSkillsConfigModel = (context, config) => ({return `${this.selectedCount} / ${this.maxActiveSkills}`;},+ get hiddenCount() {+ return this.catalog.filter((skill) => this.isHidden(skill)).length;+ },++ get visibleCount() {+ return Math.max(0, this.catalog.length - this.hiddenCount);+ },++ get visibilityCountLabel() {+ return `${this.visibleCount} visible / ${this.hiddenCount} hidden`;+ },++ get currentCountLabel() {+ return this.mode === "visible" ? this.visibilityCountLabel : this.selectedCountLabel;+ },+get catalogMap() {const byKey = new Map();for (const skill of this.catalog) {@@ -121,11 +163,39 @@ window.createSkillsConfigModel = (context, config) => ({return entryKey(entry);},+ setMode(mode) {+ if (!["visible", "pinned"].includes(mode)) return;+ this.mode = mode;+ },++ panelTitle() {+ return this.mode === "visible" ? "Available skills" : "Pinned skills";+ },++ panelSubtitle() {+ if (this.mode === "visible") {+ return this.isChatMode+ ? "Checked skills are visible to the model in this chat. Uncheck a skill to hide its title, description, search result, and load access."+ : "Checked skills are visible to the model by default. Uncheck a skill to hide it from the prompt catalog and skills_tool.";+ }+ return "Check a skill to pin its full instructions into prompt extras. Uncheck it to remove the pin.";+ },++ isHidden(skill) {+ return this.hiddenSkills.some((entry) => entriesMatch(entry, skill));+ },+isSelected(skill) {- return this.selectedSkills.some((entry) => entryKey(entry) === entryKey(skill));+ if (this.mode === "visible") {+ return !this.isHidden(skill);+ }+ return this.selectedSkills.some((entry) => entriesMatch(entry, skill));},isCheckboxDisabled(skill) {+ if (this.mode === "visible") {+ return this.mutatingChat || (this.isChatMode && !this.chatContextAvailable);+ }return this.mutatingChat || (!this.isSelected(skill) && this.selectedCount >= this.maxActiveSkills);},@@ -159,7 +229,7 @@ window.createSkillsConfigModel = (context, config) => ({return name ? this.catalogMap.get(name) || null : null;},- _setSelectedSkills(entries) {+ _setSelectedSkills(entries, { writeConfig = true } = {}) {const normalized = [];const seen = new Set();@@ -173,12 +243,50 @@ window.createSkillsConfigModel = (context, config) => ({}this.selectedSkills = normalized;- config.active_skills = compactEntries(normalized);+ if (writeConfig) {+ config.active_skills = compactEntries(normalized, this.maxActiveSkills);+ }+ },++ _setHiddenSkills(entries, { writeConfig = true } = {}) {+ const normalized = compactEntries(entries);+ this.hiddenSkills = normalized;+ if (writeConfig) {+ config.hidden_skills = normalized;+ }},async toggleSkill(skill, selected) {- const key = entryKey(skill);- const nextEntries = this.selectedSkills.filter((entry) => entryKey(entry) !== key);+ if (this.mode === "visible") {+ await this.toggleSkillVisibility(skill, selected);+ return;+ }+ await this.togglePinnedSkill(skill, selected);+ },++ async toggleSkillVisibility(skill, selected) {+ const previous = [...this.hiddenSkills];+ const nextEntries = this.hiddenSkills.filter((entry) => !entriesMatch(entry, skill));++ if (!selected) {+ nextEntries.push({+ name: String(skill.name || "").trim(),+ path: String(skill.path || "").trim(),+ });+ }++ this._setHiddenSkills(nextEntries, { writeConfig: !this.isChatMode });++ if (this.isChatMode && this.chatContextAvailable) {+ const ok = await this.submitChatAction(selected ? "show" : "hide", skill);+ if (!ok) {+ this._setHiddenSkills(previous, { writeConfig: false });+ }+ }+ },++ async togglePinnedSkill(skill, selected) {+ const nextEntries = this.selectedSkills.filter((entry) => !entriesMatch(entry, skill));if (selected) {if (this.selectedCount >= this.maxActiveSkills && !this.isSelected(skill)) {@@ -195,9 +303,9 @@ window.createSkillsConfigModel = (context, config) => ({});}- this._setSelectedSkills(nextEntries);+ this._setSelectedSkills(nextEntries, { writeConfig: !this.isChatMode });- if (this.chatContextAvailable) {+ if (this.isChatMode && this.chatContextAvailable) {await this.submitChatAction(selected ? "activate" : "deactivate", skill);}},@@ -207,9 +315,20 @@ window.createSkillsConfigModel = (context, config) => ({},async clearSelections() {+ if (this.mode === "visible") {+ const previous = [...this.hiddenSkills];+ this._setHiddenSkills([], { writeConfig: !this.isChatMode });+ if (this.isChatMode && this.chatContextAvailable) {+ for (const entry of previous) {+ await this.submitChatAction("show", entry);+ }+ }+ return;+ }+const previous = [...this.selectedSkills];- this._setSelectedSkills([]);- if (this.chatContextAvailable) {+ this._setSelectedSkills([], { writeConfig: !this.isChatMode });+ if (this.isChatMode && this.chatContextAvailable) {for (const entry of previous) {await this.submitChatAction("deactivate", entry);}@@ -220,7 +339,17 @@ window.createSkillsConfigModel = (context, config) => ({this.chatContextAvailable = !!response?.context_available;const activeFromChat = Array.isArray(response?.active_skills) ? response.active_skills : null;const activeFromConfig = this.activeEntries;- this._setSelectedSkills(activeFromChat || activeFromConfig);+ const hiddenFromChat = Array.isArray(response?.hidden_skills) ? response.hidden_skills : null;+ const hiddenFromConfig = this.hiddenEntries;++ this._setSelectedSkills(+ this.isChatMode ? activeFromChat || [] : activeFromConfig,+ { writeConfig: !this.isChatMode },+ );+ this._setHiddenSkills(+ this.isChatMode ? hiddenFromChat || [] : hiddenFromConfig,+ { writeConfig: !this.isChatMode },+ );},async loadCatalog() {@@ -229,7 +358,7 @@ window.createSkillsConfigModel = (context, config) => ({const response = await API.callJsonApi(CATALOG_API, {action: "list",project_name: context.projectName || "",- context_id: chatsStore.selectedContext?.id || "",+ context_id: this.isChatMode ? chatsStore.selectedContext?.id || "" : "",});if (!response?.ok) {@@ -244,6 +373,7 @@ window.createSkillsConfigModel = (context, config) => ({this.maxActiveSkills = MAX_ACTIVE_SKILLS_FALLBACK;this.chatContextAvailable = false;this._setSelectedSkills(this.activeEntries);+ this._setHiddenSkills(this.hiddenEntries);await toastFrontendError(error?.message || "Failed to load skills", "Skills");} finally {this.loadingCatalog = false;@@ -274,6 +404,7 @@ window.createSkillsConfigModel = (context, config) => ({this.catalog = Array.isArray(response.skills) ? response.skills : this.catalog;this.maxActiveSkills = Number(response.max_active_skills) || this.maxActiveSkills;this.chatContextAvailable = !!response.context_available;+ this.applyCatalogState(response);return true;} catch (error) {await toastFrontendError(error?.message || "Failed to update skills", "Skills");diff --git a/plugins/_skills/webui/config.html b/plugins/_skills/webui/config.htmlindex ea777e60e..469ddde3b 100644--- a/plugins/_skills/webui/config.html+++ b/plugins/_skills/webui/config.html@@ -25,7 +25,29 @@></label>+ <div class="skills-mode-toggle" role="tablist" aria-label="Skills mode">+ <button+ type="button"+ class="button"+ :class="{ 'is-active': mode === 'visible' }"+ @click="setMode('visible')"+ >+ <span class="icon material-symbols-outlined">visibility</span>+ Visible+ </button>+ <button+ type="button"+ class="button"+ :class="{ 'is-active': mode === 'pinned' }"+ @click="setMode('pinned')"+ >+ <span class="icon material-symbols-outlined">push_pin</span>+ Pinned+ </button>+ </div>+<div class="skills-actions">+ <span class="skills-count" x-text="currentCountLabel"></span><button type="button" class="button" @click="loadCatalog()" :disabled="loadingCatalog || mutatingChat"><span class="icon material-symbols-outlined">refresh</span>Refresh@@ -33,8 +55,8 @@</div></div>- <div class="skills-panel" x-show="selectedSkills.length > 0">- <div class="skills-panel-title">Active skills</div>+ <div class="skills-panel" x-show="mode === 'pinned' && selectedSkills.length > 0">+ <div class="skills-panel-title">Pinned skills</div><div class="skills-selected-list"><template x-for="entry in selectedSkills" :key="entryKey(entry)"><div class="skills-selected-card" :class="{ 'is-missing': isEntryMissing(entry) }">@@ -69,8 +91,8 @@</div><div class="skills-panel">- <div class="skills-panel-title">Available skills</div>- <div class="skills-panel-subtitle">Check a skill to add it. Uncheck it to remove it.</div>+ <div class="skills-panel-title" x-text="panelTitle()"></div>+ <div class="skills-panel-subtitle" x-text="panelSubtitle()"></div><div class="skills-loading" x-show="loadingCatalog"><span class="material-symbols-outlined spinning">progress_activity</span>@@ -83,7 +105,13 @@<div class="skills-list"><template x-for="skill in filteredCatalog" :key="skill.path">- <label class="skills-card" :class="{ 'is-selected': isSelected(skill) }">+ <label+ class="skills-card"+ :class="{+ 'is-selected': isSelected(skill),+ 'is-hidden': mode === 'visible' && isHidden(skill),+ }"+ ><inputtype="checkbox":checked="isSelected(skill)"@@ -93,6 +121,12 @@<div class="skills-card-copy"><div class="skills-card-title" x-text="skill.name || '(unnamed skill)'"></div><div class="skills-card-description" x-text="skill.description || 'No description provided.'"></div>+ <div+ class="skills-card-state"+ x-show="mode === 'visible' && isHidden(skill)"+ >+ Hidden from model+ </div></div><buttontype="button"@@ -151,6 +185,28 @@margin-left: auto;}+ .skills-mode-toggle {+ display: flex;+ align-items: center;+ gap: 0.35rem;+ flex: 0 0 auto;+ border: 1px solid var(--color-border);+ border-radius: 0.5rem;+ background: var(--color-bg-primary);+ padding: 0.2rem;+ }++ .skills-mode-toggle .button {+ border: none;+ background: transparent;+ min-height: 2rem;+ }++ .skills-mode-toggle .button.is-active {+ background: color-mix(in srgb, var(--color-primary) 14%, var(--color-bg-primary));+ color: var(--color-primary);+ }+.skills-count {color: var(--color-text-secondary);font-size: var(--font-size-small);@@ -228,6 +284,11 @@background: color-mix(in srgb, var(--color-primary) 8%, var(--color-bg-primary));}+ .skills-card.is-hidden {+ border-style: dashed;+ background: color-mix(in srgb, var(--color-bg-secondary) 55%, var(--color-bg-primary));+ }+.skills-card input {margin-top: 0.15rem;}@@ -250,6 +311,13 @@line-height: 1.45;}+ .skills-card-state {+ margin-top: 0.4rem;+ color: var(--color-text-secondary);+ font-size: var(--font-size-small);+ font-weight: 600;+ }+.skills-loading {display: flex;align-items: center;diff --git a/tests/test_skills_runtime.py b/tests/test_skills_runtime.pyindex d03fb7b68..519ba6001 100644--- a/tests/test_skills_runtime.py+++ b/tests/test_skills_runtime.py@@ -117,6 +117,15 @@ def test_active_skills_cap_is_twenty():assert runtime.get_max_active_skills() == 20+def test_hidden_skills_are_not_capped_like_active_skills():+ agent = DummyAgent()+ entries = [{"name": f"Hidden {index}"} for index in range(25)]+ agent.context.set_data(runtime.CONTEXT_DATA_NAME_CHAT_DISABLED_SKILLS, entries)++ assert len(runtime.get_chat_disabled_skills(agent.context)) == 25+ assert len(runtime.get_hidden_skills(agent)) == 25++def test_chat_activation_can_override_scope_defaults(monkeypatch):monkeypatch.setattr(runtime.plugin_helpers,@@ -336,6 +345,7 @@ def test_clearing_chat_overrides_restores_scope_defaults(monkeypatch):]assert runtime.get_chat_active_skills(agent.context) == []assert runtime.get_chat_disabled_skills(agent.context) == []+ assert runtime.get_chat_visible_skills(agent.context) == []def test_activating_new_skill_fails_once_limit_is_full(monkeypatch):@@ -352,3 +362,66 @@ def test_activating_new_skill_fails_once_limit_is_full(monkeypatch):runtime.activate_chat_skill(agent, {"name": "Overflow"})assert len(runtime.get_active_skills(agent)) == 20+++def test_hidden_skills_filter_agent_visible_skill_catalog(monkeypatch, tmp_path: Path):+ skills_root = tmp_path / "skills"+ for name in ("alpha-skill", "beta-skill"):+ skill_dir = skills_root / name+ skill_dir.mkdir(parents=True)+ (skill_dir / "SKILL.md").write_text(+ f"---\nname: {name}\ndescription: {name} description\n---\nBody\n",+ encoding="utf-8",+ )++ monkeypatch.setattr(+ runtime.subagents,+ "get_paths",+ lambda agent, *parts: [str(skills_root)],+ )+ monkeypatch.setattr(runtime.files, "exists", lambda path: str(path) == str(skills_root))+ monkeypatch.setattr(+ runtime.plugin_helpers,+ "get_plugin_config",+ lambda *args, **kwargs: {"hidden_skills": [{"name": "beta-skill"}]},+ )++ agent = DummyAgent()++ assert [skill.name for skill in runtime.list_skills(agent)] == ["alpha-skill"]+ assert [skill.name for skill in runtime.list_skills(agent, include_hidden=True)] == [+ "alpha-skill",+ "beta-skill",+ ]+ assert runtime.search_skills("beta", agent=agent) == []+ assert [skill.name for skill in runtime.search_skills("beta", agent=agent, include_hidden=True)] == [+ "beta-skill"+ ]+ assert runtime.find_skill("beta-skill", agent=agent) is None+ assert runtime.find_skill("beta-skill", agent=agent, include_hidden=True).name == "beta-skill"++ catalog = runtime.list_skill_catalog(agent=agent)+ hidden_by_name = {item["name"]: item["hidden"] for item in catalog}+ assert hidden_by_name == {+ "alpha-skill": False,+ "beta-skill": True,+ }+++def test_chat_visible_override_restores_scope_hidden_skill(monkeypatch):+ monkeypatch.setattr(+ runtime.plugin_helpers,+ "get_plugin_config",+ lambda *args, **kwargs: {"hidden_skills": [{"name": "beta-skill"}]},+ )+ agent = DummyAgent()++ assert runtime.get_hidden_skills(agent) == [{"name": "beta-skill"}]++ runtime.show_chat_skill(agent, {"name": "beta-skill"})+ assert runtime.get_hidden_skills(agent) == []+ assert runtime.get_chat_visible_skills(agent.context) == [{"name": "beta-skill"}]++ runtime.hide_chat_skill(agent, {"name": "beta-skill"})+ assert runtime.get_hidden_skills(agent) == [{"name": "beta-skill"}]+ assert runtime.get_chat_visible_skills(agent.context) == []diff --git a/webui/components/plugins/plugin-settings-store.js b/webui/components/plugins/plugin-settings-store.jsindex bfe76a102..c754ecae4 100644--- a/webui/components/plugins/plugin-settings-store.js+++ b/webui/components/plugins/plugin-settings-store.js@@ -24,6 +24,7 @@ const model = {settingsSnapshotJson: "",previousProjectName: "",previousAgentProfileKey: "",+ openOptions: {},_toComparableJson(value) {try {@@ -47,9 +48,17 @@ const model = {},get modalTitle() {+ if (this.openOptions?.title) return this.openOptions.title;+ if (this.openOptions?.focus === "chat" && this.pluginName === "_skills") {+ return "Skills";+ }return `${this.pluginTitle} Settings`;},+ get hideSettingsActions() {+ return !!this.openOptions?.hideSettingsActions || this.openOptions?.focus === "chat";+ },+confirmDiscardUnsavedChanges() {if (!this.hasUnsavedChanges) return true;return window.confirm("You have unsaved changes that will be lost. Continue?");@@ -89,12 +98,17 @@ const model = {};},- _applyPluginState(pluginMeta, { projectName = "", agentProfileKey = "" } = {}) {+ _applyPluginState(+ pluginMeta,+ { projectName = "", agentProfileKey = "" } = {},+ openOptions = {},+ ) {this.pluginName = pluginMeta?.name || null;this.pluginMeta = pluginMeta || null;this.settings = {};this.settingsSnapshotJson = "";this.wizardFooter = null;+ this.openOptions = openOptions && typeof openOptions === "object" ? openOptions : {};this.error = null;this.projectName = projectName;this.agentProfileKey = agentProfileKey;@@ -256,7 +270,7 @@ const model = {isSaving: false,error: null,- async openConfig(pluginName, projectName = "", agentProfile = "") {+ async openConfig(pluginName, projectName = "", agentProfile = "", openOptions = {}) {if (!pluginName) {throw new Error("Missing plugin name.");}@@ -272,7 +286,7 @@ const model = {await Promise.all([this.loadProjects(), this.loadAgentProfiles()]);const resolvedScope = this._resolveScope(pluginMeta, projectName || "", agentProfile || "");- this._applyPluginState(pluginMeta, resolvedScope);+ this._applyPluginState(pluginMeta, resolvedScope, openOptions);await this.loadSettings();if (!pluginToggleStore?.open) {@@ -401,6 +415,7 @@ const model = {this.agentProfileKey = "";this.settings = {};this.settingsSnapshotJson = "";+ this.openOptions = {};this.wizardFooter = null;this.previousProjectName = "";this.previousAgentProfileKey = "";diff --git a/webui/components/plugins/plugin-settings.html b/webui/components/plugins/plugin-settings.htmlindex eab2e4043..a37d8e7c1 100644--- a/webui/components/plugins/plugin-settings.html+++ b/webui/components/plugins/plugin-settings.html@@ -29,7 +29,7 @@<!-- Context toolbar: Project + Agent profile (only when at least one scope is configurable) --><div class="plugin-settings-scope-section"- x-show="context.perProjectConfig || context.perAgentConfig">+ x-show="(context.perProjectConfig || context.perAgentConfig) && !context.hideSettingsActions"><div class="plugin-settings-scope-header"><div class="plugin-settings-scope-header-copy"><div class="plugin-settings-scope-title">Settings scope</div>@@ -136,6 +136,7 @@<div class="plugin-settings-footer-actions"><button class="btn"+ x-show="!context.hideSettingsActions"@click="context.resetToDefault()":disabled="context?.isSaving || context?.isLoading">Default@@ -147,7 +148,7 @@<span x-text="context.wizardFooter?.nextLabel?.() || 'Next'"></span></button><button class="btn btn-ok"- x-show="!context.wizardFooter || context.wizardFooter?.showSave?.()"+ x-show="!context.hideSettingsActions && (!context.wizardFooter || context.wizardFooter?.showSave?.())"@click="context.save()":disabled="context?.isSaving || context?.isLoading">Save