Skip to content

Agent Zero AI framework

polish skills import, bugfixes

frdelfd06f51ee018
diff --git a/agents/default/agent.json b/agents/default/agent.json
index 846d2a679..c5c905f70 100644
--- a/agents/default/agent.json
+++ b/agents/default/agent.json
@@ -1,5 +1,5 @@
{
- "title": "Default prompts",
+ "title": "Default",
"description": "Default prompt file templates. Should be inherited and overriden by specialized prompt profiles.",
"context": ""
}
diff --git a/python/api/agents.py b/python/api/agents.py
new file mode 100644
index 000000000..372ed178f
--- /dev/null
+++ b/python/api/agents.py
@@ -0,0 +1,23 @@
+from python.helpers.api import ApiHandler, Input, Output, Request
+from python.helpers import subagents
+
+
+class Agents(ApiHandler):
+ async def process(self, input: Input, request: Request) -> Output:
+ action = input.get("action", "")
+
+ try:
+ if action == "list":
+ data = subagents.get_all_agents_list()
+ else:
+ raise Exception("Invalid action")
+
+ return {
+ "ok": True,
+ "data": data,
+ }
+ except Exception as e:
+ return {
+ "ok": False,
+ "error": str(e),
+ }
diff --git a/python/api/projects.py b/python/api/projects.py
index 6995d9da7..7b62b4b48 100644
--- a/python/api/projects.py
+++ b/python/api/projects.py
@@ -14,6 +14,8 @@ class Projects(ApiHandler):
try:
if action == "list":
data = self.get_active_projects_list()
+ elif action == "list_options":
+ data = self.get_active_projects_options()
elif action == "load":
data = self.load_project(input.get("name", None))
elif action == "create":
@@ -46,6 +48,14 @@ class Projects(ApiHandler):
def get_active_projects_list(self):
return projects.get_active_projects_list()
+ def get_active_projects_options(self):
+ items = projects.get_active_projects_list() or []
+ return [
+ {"key": p.get("name", ""), "label": p.get("title", "") or p.get("name", "")}
+ for p in items
+ if p.get("name")
+ ]
+
def create_project(self, project: dict|None):
if project is None:
raise Exception("Project data is required")
diff --git a/python/api/skills.py b/python/api/skills.py
index 64fcddb3b..c0d9fd04d 100644
--- a/python/api/skills.py
+++ b/python/api/skills.py
@@ -1,5 +1,5 @@
from python.helpers.api import ApiHandler, Input, Output, Request, Response
-from python.helpers import skills, projects, files
+from python.helpers import runtime, skills, projects, files
class Skills(ApiHandler):
@@ -30,10 +30,29 @@ class Skills(ApiHandler):
# filter by project
if project_name := (input.get("project_name") or "").strip() or None:
project_folder = projects.get_project_folder(project_name)
+ if runtime.is_development():
+ project_folder = files.normalize_a0_path(project_folder)
skill_list = [
s for s in skill_list if files.is_in_dir(str(s.path), project_folder)
]
+ # filter by agent profile
+ if agent_profile := (input.get("agent_profile") or "").strip() or None:
+ roots: list[str] = [
+ files.get_abs_path("agents", agent_profile, "skills"),
+ files.get_abs_path("usr", "agents", agent_profile, "skills"),
+ ]
+ if project_name:
+ roots.append(
+ projects.get_project_meta_folder(project_name, "agents", agent_profile, "skills")
+ )
+
+ skill_list = [
+ s
+ for s in skill_list
+ if any(files.is_in_dir(str(s.path), r) for r in roots)
+ ]
+
result = []
for skill in skill_list:
result.append({
@@ -41,6 +60,7 @@ class Skills(ApiHandler):
"description": skill.description,
"path": str(skill.path),
})
+ result.sort(key=lambda x: (x["name"], x["path"]))
return result
def delete_skill(self, input: Input):
diff --git a/python/api/skills_import.py b/python/api/skills_import.py
index eb6a10703..d2e842ebf 100644
--- a/python/api/skills_import.py
+++ b/python/api/skills_import.py
@@ -31,20 +31,13 @@ class SkillsImport(ApiHandler):
return {"success": False, "error": "No context id provided"}
_context = self.use_context(ctxid)
- dest = (request.form.get("dest", "custom") or "custom").strip().lower()
- if dest not in ("custom", "project"):
- dest = "custom"
-
conflict = (request.form.get("conflict", "skip") or "skip").strip().lower()
if conflict not in ("skip", "overwrite", "rename"):
conflict = "skip"
namespace = (request.form.get("namespace", "") or "").strip() or None
project_name = (request.form.get("project_name", "") or "").strip() or None
-
- # If dest is "project", project_name is required
- if dest == "project" and not project_name:
- return {"success": False, "error": "project_name is required when dest is 'project'"}
+ agent_profile = (request.form.get("agent_profile", "") or "").strip() or None
# Save upload to a temp file so we can pass a filesystem path to the importer
tmp_dir = Path(files.get_abs_path("tmp", "uploads"))
@@ -60,11 +53,11 @@ class SkillsImport(ApiHandler):
try:
result = import_skills(
str(tmp_path),
- dest_subdir=dest, # type: ignore[arg-type]
namespace=namespace,
conflict=conflict, # type: ignore[arg-type]
dry_run=False, # Actual import, not preview
project_name=project_name,
+ agent_profile=agent_profile,
)
imported = [files.deabsolute_path(str(p)) for p in result.imported]
diff --git a/python/api/skills_import_preview.py b/python/api/skills_import_preview.py
index a9a65720e..b4f9e70c8 100644
--- a/python/api/skills_import_preview.py
+++ b/python/api/skills_import_preview.py
@@ -31,20 +31,13 @@ class SkillsImportPreview(ApiHandler):
return {"success": False, "error": "No context id provided"}
_context = self.use_context(ctxid)
- dest = (request.form.get("dest", "custom") or "custom").strip().lower()
- if dest not in ("custom", "project"):
- dest = "custom"
-
conflict = (request.form.get("conflict", "skip") or "skip").strip().lower()
if conflict not in ("skip", "overwrite", "rename"):
conflict = "skip"
namespace = (request.form.get("namespace", "") or "").strip() or None
project_name = (request.form.get("project_name", "") or "").strip() or None
-
- # If dest is "project", project_name is required
- if dest == "project" and not project_name:
- return {"success": False, "error": "project_name is required when dest is 'project'"}
+ agent_profile = (request.form.get("agent_profile", "") or "").strip() or None
# Save upload to a temp file so we can pass a filesystem path to the importer
tmp_dir = Path(files.get_abs_path("tmp", "uploads"))
@@ -60,11 +53,11 @@ class SkillsImportPreview(ApiHandler):
try:
result = import_skills(
str(tmp_path),
- dest_subdir=dest, # type: ignore[arg-type]
namespace=namespace,
conflict=conflict, # type: ignore[arg-type]
dry_run=True,
project_name=project_name,
+ agent_profile=agent_profile,
)
imported = [files.deabsolute_path(str(p)) for p in result.imported]
diff --git a/python/extensions/agent_init/_15_load_profile_settings.py b/python/extensions/agent_init/_15_load_profile_settings.py
index d4c9b5ab4..e3572a008 100644
--- a/python/extensions/agent_init/_15_load_profile_settings.py
+++ b/python/extensions/agent_init/_15_load_profile_settings.py
@@ -10,8 +10,7 @@ class LoadProfileSettings(Extension):
if not self.agent or not self.agent.config.profile:
return
- config_files = subagents.get_paths(self.agent, "settings.json", include_default=False)
-
+ config_files = subagents.get_paths(self.agent, "settings.json", include_default=False, include_user=False)
settings_override = {}
for settings_path in config_files:
if files.exists(settings_path):
@@ -34,14 +33,17 @@ class LoadProfileSettings(Extension):
)
if settings_override:
- # Preserve the original memory_subdir unless it's explicitly overridden
- current_memory_subdir = self.agent.config.memory_subdir
+ current_config = self.agent.config
new_config = initialize_agent(override_settings=settings_override)
- if (
- "agent_memory_subdir" not in settings_override
- and current_memory_subdir != "default"
+
+ for override_key, config_attr in (
+ ("agent_profile", "profile"),
+ ("agent_memory_subdir", "memory_subdir"),
+ ("mcp_servers", "mcp_servers"),
+ ("browser_http_headers", "browser_http_headers"),
):
- new_config.memory_subdir = current_memory_subdir
+ if override_key not in settings_override:
+ setattr(new_config, config_attr, getattr(current_config, config_attr))
self.agent.config = new_config
# self.agent.context.log.log(
# type="info",
diff --git a/python/extensions/banners/_30_system_resources.py b/python/extensions/banners/_30_system_resources.py
index 9e1c257ef..c85810176 100644
--- a/python/extensions/banners/_30_system_resources.py
+++ b/python/extensions/banners/_30_system_resources.py
@@ -20,7 +20,7 @@ class SystemResourcesCheck(Extension):
try:
vm = psutil.virtual_memory()
ram_percent = vm.percent
- ram_used_gb = vm.used / (1024 ** 3)
+ ram_used_gb = (vm.total - vm.available) / (1024 ** 3)
ram_total_gb = vm.total / (1024 ** 3)
except Exception:
ram_percent = None
@@ -70,23 +70,29 @@ class SystemResourcesCheck(Extension):
"title": "System Resources",
"html": (
"<div style=\"display:flex;flex-direction:column;gap:14px;padding-top:6px;\">"
- "<div style=\"display:grid;grid-template-columns:140px 1fr;row-gap:12px;column-gap:12px;align-items:center;\">"
- "<div style=\"display:flex;flex-direction:column;gap:6px;\">"
+ "<div style=\"display:flex;flex-direction:column;gap:12px;\">"
+ "<div style=\"display:flex;flex-wrap:wrap;column-gap:12px;row-gap:10px;align-items:center;\">"
+ "<div style=\"flex:0 1 140px;min-width:110px;display:flex;flex-direction:column;gap:6px;\">"
"<div style=\"font-size:12px;letter-spacing:.10em;text-transform:uppercase;opacity:.65;line-height:1.1\">CPU</div>"
f"<div style=\"font-weight:750;font-variant-numeric:tabular-nums;letter-spacing:.02em;line-height:1.1\">{cpu_value}</div>"
"</div>"
f"{cpu_bar}"
- "<div style=\"display:flex;flex-direction:column;gap:6px;\">"
+ "</div>"
+ "<div style=\"display:flex;flex-wrap:wrap;column-gap:12px;row-gap:10px;align-items:center;\">"
+ "<div style=\"flex:0 1 140px;min-width:110px;display:flex;flex-direction:column;gap:6px;\">"
"<div style=\"font-size:12px;letter-spacing:.10em;text-transform:uppercase;opacity:.65;line-height:1.1\">RAM</div>"
f"<div style=\"font-weight:750;font-variant-numeric:tabular-nums;letter-spacing:.02em;line-height:1.1\">{ram_value}</div>"
"</div>"
f"{ram_bar}"
- "<div style=\"display:flex;flex-direction:column;gap:6px;\">"
+ "</div>"
+ "<div style=\"display:flex;flex-wrap:wrap;column-gap:12px;row-gap:10px;align-items:center;\">"
+ "<div style=\"flex:0 1 140px;min-width:110px;display:flex;flex-direction:column;gap:6px;\">"
"<div style=\"font-size:12px;letter-spacing:.10em;text-transform:uppercase;opacity:.65;line-height:1.1\">Disk</div>"
f"<div style=\"font-weight:750;font-variant-numeric:tabular-nums;letter-spacing:.02em;line-height:1.1\">{disk_value}</div>"
"</div>"
f"{disk_bar}"
"</div>"
+ "</div>"
"<div style=\"height:1px;background:rgba(255,255,255,.08);\"></div>"
"<div style=\"display:grid;grid-template-columns:1fr 1fr;gap:10px 14px;\">"
f"<div><div style=\"font-size:12px;letter-spacing:.10em;text-transform:uppercase;opacity:.65;margin-bottom:6px;\">Load (1/5/15)</div><div style=\"font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;opacity:.85;font-variant-numeric:tabular-nums\">{load_value}</div></div>"
@@ -111,7 +117,7 @@ class SystemResourcesCheck(Extension):
color = "#22c55e"
return (
- "<div style=\"flex:1;min-width:140px;max-width:260px;height:10px;border-radius:999px;"
+ "<div style=\"flex:1 1 220px;width:100%;max-width:260px;height:10px;border-radius:999px;"
"background:rgba(255,255,255,.10);overflow:hidden;box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);\">"
f"<div style=\"height:100%;width:{p:.0f}%;background:{color};border-radius:999px;\"></div>"
"</div>"
diff --git a/python/helpers/skills.py b/python/helpers/skills.py
index f6b4fcd46..9f8f25458 100644
--- a/python/helpers/skills.py
+++ b/python/helpers/skills.py
@@ -236,7 +236,7 @@ def skill_from_markdown(
fm, body, fm_errors = split_frontmatter(text)
if fm_errors:
return None
- skill_dir = skill_md_path.parent
+ skill_dir = Path(files.normalize_a0_path(str(skill_md_path.parent)))
name = str(fm.get("name") or fm.get("skill") or "").strip()
description = str(
@@ -325,6 +325,8 @@ def delete_skill(
"""Delete a skill directory."""
skill_path = files.get_abs_path(skill_path)
+ if runtime.is_development():
+ skill_path = files.fix_dev_path(skill_path)
allowed_roots = get_skill_roots()
for root in allowed_roots:
diff --git a/python/helpers/skills_import.py b/python/helpers/skills_import.py
index 866a65512..7698fef50 100644
--- a/python/helpers/skills_import.py
+++ b/python/helpers/skills_import.py
@@ -14,7 +14,6 @@ from python.helpers.skills import discover_skill_md_files
ConflictPolicy = Literal["skip", "overwrite", "rename"]
-DestSubdir = Literal["custom", "project"]
# Project skills folder name (inside .a0proj)
PROJECT_SKILLS_DIR = "skills"
@@ -177,19 +176,39 @@ def get_project_skills_folder(project_name: str) -> Path:
return Path(get_project_meta_folder(project_name, PROJECT_SKILLS_DIR))
+def get_agent_profile_skills_folder(profile_name: str) -> Path:
+ return Path(files.get_abs_path("usr", "agents", profile_name, "skills"))
+
+
+def get_project_agent_profile_skills_folder(project_name: str, profile_name: str) -> Path:
+ from python.helpers.projects import get_project_meta_folder
+ return Path(get_project_meta_folder(project_name, "agents", profile_name, "skills"))
+
+
+def resolve_skills_destination_root(
+ project_name: Optional[str],
+ agent_profile: Optional[str],
+) -> Path:
+ if project_name and agent_profile:
+ return get_project_agent_profile_skills_folder(project_name, agent_profile)
+ if project_name:
+ return get_project_skills_folder(project_name)
+ if agent_profile:
+ return get_agent_profile_skills_folder(agent_profile)
+ return Path(files.get_abs_path("usr", "skills"))
+
+
def import_skills(
source_path: str,
*,
- dest_subdir: DestSubdir = "custom",
namespace: Optional[str] = None,
conflict: ConflictPolicy = "skip",
dry_run: bool = False,
project_name: Optional[str] = None,
+ agent_profile: Optional[str] = None,
) -> ImportResult:
"""
- Import external Skills into usr/skills/<dest_subdir>/<namespace>/...
-
- If dest_subdir is "project", imports into the project's .a0proj/skills/ folder.
+ Import external Skills into usr/skills/<namespace>/...
- source_path can be a directory or a .zip file
- Uses heuristics to detect the Skills root(s)
@@ -202,13 +221,7 @@ def import_skills(
if not src.exists():
raise FileNotFoundError(f"Source not found: {src}")
- # Determine destination root based on dest_subdir
- if dest_subdir == "project":
- if not project_name:
- raise ValueError("project_name is required when dest_subdir is 'project'")
- dest_root = get_project_skills_folder(project_name)
- else:
- dest_root = Path(files.get_abs_path("usr", "skills"))
+ dest_root = resolve_skills_destination_root(project_name, agent_profile)
dest_root.mkdir(parents=True, exist_ok=True)
extracted_root: Optional[Path] = None
diff --git a/python/helpers/subagents.py b/python/helpers/subagents.py
index 66f320f00..e7dbdbf12 100644
--- a/python/helpers/subagents.py
+++ b/python/helpers/subagents.py
@@ -3,6 +3,7 @@ from typing import TypedDict, TYPE_CHECKING
from pydantic import BaseModel, model_validator
import json
from typing import Literal
+import os
GLOBAL_DIR = "."
USER_DIR = "usr"
@@ -20,6 +21,7 @@ class SubAgentListItem(BaseModel):
title: str = ""
description: str = ""
context: str = ""
+ path: str = ""
origin: list[Origin] = []
enabled: bool = True
@@ -81,6 +83,7 @@ def _get_agents_list_from_dir(dir: str, origin: Origin) -> dict[str, SubAgentLis
agent_data = SubAgentListItem.model_validate_json(agent_json)
name = agent_data.name or subdir
agent_data.name = name
+ agent_data.path = files.get_abs_path(dir, subdir)
agent_data.origin = [origin]
result[name] = agent_data
except Exception:
@@ -213,10 +216,58 @@ def _merge_agent_list_items(
title=override.title or base.title,
description=override.description or base.description,
context=override.context or base.context,
+ path=override.path or base.path,
origin=_merge_origins(base.origin, override.origin),
)
+def get_agents_roots() -> list[str]:
+ project_agents = files.find_existing_paths_by_pattern("usr/projects/*/.a0proj/agents")
+ paths = [
+ files.get_abs_path(DEFAULT_AGENTS_DIR),
+ files.get_abs_path(USER_AGENTS_DIR),
+ *project_agents,
+ ]
+ unique: list[str] = []
+ seen = set()
+ for p in paths:
+ if not p:
+ continue
+ key = str(p)
+ if key in seen:
+ continue
+ seen.add(key)
+ if os.path.exists(p):
+ unique.append(p)
+ return unique
+
+
+def get_all_agents_list() -> list[dict[str, str]]:
+ def _origin_from_root(root: str) -> Origin:
+ rel = files.deabsolute_path(root).replace("\\", "/")
+ if rel.startswith("usr/projects/"):
+ return "project"
+ if rel.startswith("usr/agents"):
+ return "user"
+ return "default"
+
+ merged: dict[str, SubAgentListItem] = {}
+ for root in get_agents_roots():
+ origin = _origin_from_root(root)
+ items = _get_agents_list_from_dir(root, origin=origin)
+ for name, item in items.items():
+ if name in merged:
+ merged[name] = _merge_agent_list_items(merged[name], item)
+ else:
+ merged[name] = item
+
+ result: list[dict[str, str]] = []
+ for key in sorted(merged.keys()):
+ item = merged[key]
+ result.append({"key": key, "label": item.title or key})
+ return result
+
+
def _merge_origins(base: list[Origin], override: list[Origin]) -> list[Origin]:
return base + override
diff --git a/python/tools/call_subordinate.py b/python/tools/call_subordinate.py
index 92fb9e4b8..491249d4d 100644
--- a/python/tools/call_subordinate.py
+++ b/python/tools/call_subordinate.py
@@ -16,7 +16,7 @@ class Delegation(Tool):
config = initialize_agent()
# set subordinate prompt profile if provided, if not, keep original
- agent_profile = kwargs.get("profile")
+ agent_profile = kwargs.get("profile", kwargs.get("agent_profile", ""))
if agent_profile:
config.profile = agent_profile
diff --git a/webui/components/projects/project-edit-skills.html b/webui/components/projects/project-edit-skills.html
index cc3cbaf9c..7b2bcbef3 100644
--- a/webui/components/projects/project-edit-skills.html
+++ b/webui/components/projects/project-edit-skills.html
@@ -7,16 +7,7 @@
</script>
</head>
<body>
- <div x-data="{
- openSkillsImport() {
- // Pre-configure the skills import for this project
- if ($store.skillsImportStore) {
- $store.skillsImportStore.dest = 'project';
- $store.skillsImportStore.projectName = $store.projects.selectedProject.name;
- }
- openModal('settings/skills/import.html');
- }
- }">
+ <div x-data>
<template x-if="$store.projects && $store.projects.selectedProject">
<div class="project-skills-section">
<p class="skills-description">
@@ -25,15 +16,20 @@
</p>
<div class="skills-actions">
- <button type="button" class="button" @click="openSkillsImport()">
+ <button type="button" class="button" @click="$store.projects.openSelectedProjectSkillsImport()">
+ <span class="icon material-symbols-outlined">upload</span>
Import Skills
</button>
+ <button type="button" class="button" @click="$store.projects.openSelectedProjectSkillsFolder()">
+ <span class="icon material-symbols-outlined">folder_open</span>
+ Open Folder
+ </button>
</div>
<div class="skills-info">
<p>
<strong>Project Skills Location:</strong><br>
- <code x-text="'usr/projects/' + $store.projects.selectedProject.name + '/.a0proj/skills/'"></code>
+ <code x-text="$store.projects.getSelectedProjectSkillsPath()"></code>
</p>
<p class="skills-note">
Use the global Settings &gt; Skills tab for custom skills available to all projects.
diff --git a/webui/components/projects/projects-store.js b/webui/components/projects/projects-store.js
index e813dd187..88188da2d 100644
--- a/webui/components/projects/projects-store.js
+++ b/webui/components/projects/projects-store.js
@@ -4,6 +4,7 @@ import * as modals from "/js/modals.js";
import * as notifications from "/components/notifications/notification-store.js";
import { store as chatsStore } from "/components/sidebar/chats/chats-store.js";
import { store as browserStore } from "/components/modals/file-browser/file-browser-store.js";
+import { store as skillsImportStore } from "/components/settings/skills/skills-import-store.js";
import * as shortcuts from "/js/shortcuts.js";
import { showConfirmDialog } from "/js/confirmDialog.js";
@@ -65,6 +66,27 @@ const model = {
return s;
},
+ getSelectedProjectSkillsPath() {
+ const projectName = this.selectedProject?.name;
+ if (!projectName) return "";
+ return `usr/projects/${projectName}/.a0proj/skills/`;
+ },
+
+ async openSelectedProjectSkillsImport() {
+ const projectName = this.selectedProject?.name;
+ if (!projectName) return;
+
+ skillsImportStore.projectKey = projectName;
+ skillsImportStore.agentProfileKey = "";
+ await modals.openModal("settings/skills/import.html");
+ },
+
+ async openSelectedProjectSkillsFolder() {
+ const path = this.getSelectedProjectSkillsPath();
+ if (!path) return;
+ await browserStore.open(path);
+ },
+
async openProjectsModal() {
await this.loadProjectsList();
await modals.openModal(listModal);
diff --git a/webui/components/settings/skills/import.html b/webui/components/settings/skills/import.html
index d945d3b4c..04536a1a8 100644
--- a/webui/components/settings/skills/import.html
+++ b/webui/components/settings/skills/import.html
@@ -25,21 +25,23 @@
<div class="options" x-show="$store.skillsImportStore.skillsFile">
<label class="policy-label">
- <span class="policy-label-text">Destination:</span>
- <select x-model="$store.skillsImportStore.dest" class="policy-dropdown"
+ <span class="policy-label-text">Limit to project:</span>
+ <select x-model="$store.skillsImportStore.projectKey" class="policy-dropdown"
@change="$store.skillsImportStore.previewImport()">
- <option value="custom">Custom</option>
- <option value="project">Project</option>
+ <option value="">All</option>
+ <template x-for="project in $store.skillsImportStore.projects" :key="project.key">
+ <option :value="project.key" x-text="project.label"></option>
+ </template>
</select>
</label>
- <label class="policy-label" x-show="$store.skillsImportStore.dest === 'project'">
- <span class="policy-label-text">Project:</span>
- <select x-model="$store.skillsImportStore.projectName" class="policy-dropdown"
+ <label class="policy-label">
+ <span class="policy-label-text">Limit to agent profile:</span>
+ <select x-model="$store.skillsImportStore.agentProfileKey" class="policy-dropdown"
@change="$store.skillsImportStore.previewImport()">
- <option value="">Select a project...</option>
- <template x-for="project in $store.skillsImportStore.projects" :key="project.name">
- <option :value="project.name" x-text="project.title || project.name"></option>
+ <option value="">All</option>
+ <template x-for="agentProfile in $store.skillsImportStore.agentProfiles" :key="agentProfile.key">
+ <option :value="agentProfile.key" x-text="agentProfile.label"></option>
</template>
</select>
</label>
@@ -80,7 +82,6 @@
<div x-show="$store.skillsImportStore.preview" class="preview">
<h4>Preview</h4>
<div class="preview-meta">
- <div>Destination: <code x-text="$store.skillsImportStore.preview?.destination"></code></div>
<div>Namespace: <code x-text="$store.skillsImportStore.preview?.namespace"></code></div>
<div>Would import: <span x-text="$store.skillsImportStore.preview?.imported_count || 0"></span></div>
<div>Would skip: <span x-text="$store.skillsImportStore.preview?.skipped_count || 0"></span></div>
@@ -135,16 +136,18 @@
}
.policy-label {
- display: flex;
+ display: grid;
+ grid-template-columns: minmax(10rem, 14rem) 1fr;
align-items: center;
- gap: 0.5rem;
+ column-gap: 0.75rem;
+ row-gap: 0.25rem;
margin: 0.5rem 0;
}
.policy-label-text {
font-weight: 600;
- white-space: nowrap;
- width: 9rem;
+ white-space: normal;
+ width: auto;
}
.policy-dropdown, .text-input {
@@ -214,6 +217,17 @@
font-size: 0.9rem;
color: var(--color-text-secondary);
}
+
+ @media (max-width: 700px) {
+ .policy-label {
+ grid-template-columns: 1fr;
+ }
+
+ .policy-label-text {
+ width: auto;
+ white-space: normal;
+ }
+ }
</style>
</body>
</html>
diff --git a/webui/components/settings/skills/list.html b/webui/components/settings/skills/list.html
index 46cc94556..391453712 100644
--- a/webui/components/settings/skills/list.html
+++ b/webui/components/settings/skills/list.html
@@ -15,31 +15,38 @@
Browse skills across global and project scopes. Duplicates are shown individually.
</div>
- <div class="skills-list-controls">
- <div class="field">
- <div class="field-label">
- <div class="field-title">Filter by project</div>
- <!-- <div class="field-description">
- Includes global skills plus the selected project.
- </div> -->
- </div>
- <div class="field-control">
+ <div class="skills-toolbar">
+ <div class="skills-toolbar-row">
+ <label class="skills-toolbar-item">
+ <span class="skills-toolbar-label">Project</span>
<select x-model="$store.skillsListStore.projectName"
@change="$store.skillsListStore.loadSkills()">
- <option value="">No project</option>
- <template x-for="project in $store.skillsListStore.projects" :key="project.name">
- <option :value="project.name" x-text="project.title || project.name"></option>
+ <option value="">All</option>
+ <template x-for="project in $store.skillsListStore.projects" :key="project.key">
+ <option :value="project.key" x-text="project.label"></option>
+ </template>
+ </select>
+ </label>
+
+ <label class="skills-toolbar-item">
+ <span class="skills-toolbar-label">Agent profile</span>
+ <select x-model="$store.skillsListStore.agentProfileKey"
+ @change="$store.skillsListStore.loadSkills()">
+ <option value="">All</option>
+ <template x-for="agentProfile in $store.skillsListStore.agentProfiles" :key="agentProfile.key">
+ <option :value="agentProfile.key" x-text="agentProfile.label"></option>
</template>
</select>
+ </label>
+
+ <div class="skills-toolbar-actions">
+ <button type="button" class="button confirm" title="Refresh"
+ @click="$store.skillsListStore.loadSkills()"
+ :disabled="$store.skillsListStore.loading">
+ <span class="icon material-symbols-outlined">refresh</span> Refresh
+ </button>
</div>
</div>
- <div class="skills-list-actions">
- <button type="button" class="button confirm" title="Refresh"
- @click="$store.skillsListStore.loadSkills()"
- :disabled="$store.skillsListStore.loading">
- <span class="icon material-symbols-outlined">refresh</span> Refresh
- </button>
- </div>
</div>
<div x-show="$store.skillsListStore.loading" class="loading">
@@ -59,9 +66,12 @@
<template x-for="skill in $store.skillsListStore.skills" :key="skill.path">
<div class="skill-card">
<div class="skill-header">
- <div class="skill-title" x-text="skill.name || '(unnamed skill)'"></div>
+ <div class="skill-heading">
+ <div class="skill-title" x-text="skill.name || '(unnamed skill)'"></div>
+ <code class="skill-path" x-text="skill.path"></code>
+ </div>
<div class="skill-actions">
- <button type="button" class="button confirm" title="Open in browser"
+ <button type="button" class="button" title="Open in browser"
@click="$store.skillsListStore.openSkill(skill)">
<span class="icon material-symbols-outlined">folder_open</span> Open
</button>
@@ -72,10 +82,6 @@
</div>
</div>
<div class="skill-description" x-text="skill.description || 'No description provided.'"></div>
- <div class="skill-location">
- <span>Location:</span>
- <code x-text="skill.path"></code>
- </div>
</div>
</template>
</div>
@@ -85,16 +91,63 @@
</div>
<style>
- .skills-list-controls {
+ .skills-toolbar {
display: flex;
- align-items: flex-end;
- justify-content: space-between;
- gap: 1rem;
+ flex-direction: column;
+ gap: 0.35rem;
+ margin-top: 0.5rem;
+ }
+
+ .skills-toolbar-row {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
flex-wrap: wrap;
}
- .skills-list-actions {
+ .skills-toolbar-item {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ flex: 1 1 18rem;
+ min-width: 12rem;
+ margin: 0;
+ }
+
+ .skills-toolbar-label {
+ font-weight: 600;
+ color: var(--color-text-secondary);
+ white-space: nowrap;
+ }
+
+ .skills-toolbar-item select {
+ flex: 1 1 auto;
+ min-width: 0;
+ }
+
+ .skills-toolbar-actions {
margin-left: auto;
+ flex: 0 0 auto;
+ }
+
+ @media (max-width: 640px) {
+ .skills-toolbar-row {
+ gap: 0.5rem;
+ }
+
+ .skills-toolbar-item {
+ flex-basis: 100%;
+ min-width: 0;
+ }
+
+ .skills-toolbar-actions {
+ width: 100%;
+ margin-left: 0;
+ }
+
+ .skills-toolbar-actions .button {
+ width: 100%;
+ }
}
.skills-list {
@@ -114,12 +167,22 @@
align-items: flex-start;
justify-content: space-between;
gap: 1rem;
- flex-wrap: wrap;
+ flex-wrap: nowrap;
+ min-width: 0;
+ }
+
+ .skill-heading {
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ flex: 1 1 auto;
}
.skill-title {
font-weight: 600;
font-size: 1rem;
+ min-width: 0;
+ flex: 1 1 auto;
}
.skill-actions {
@@ -128,21 +191,27 @@
gap: 0.5rem;
padding-bottom: var(--spacing-sm);
flex-wrap: wrap;
+ min-width: 0;
+ flex: 0 1 11.5rem;
+ max-width: 100%;
+ justify-content: flex-end;
}
.skill-description {
margin-top: 0.35rem;
color: var(--color-text-secondary);
+ font-size: var(--font-size-small);
}
- .skill-location {
+ .skill-path {
margin-top: 0.35rem;
font-size: 0.85rem;
- color: var(--color-text-secondary);
- display: flex;
- gap: 0.5rem;
- align-items: center;
- flex-wrap: wrap;
+ color: var(--color-text-muted);
+ min-width: 0;
+ max-width: 100%;
+ white-space: pre-wrap;
+ word-break: break-word;
+ overflow-wrap: anywhere;
}
.skills-empty {
diff --git a/webui/components/settings/skills/skills-import-store.js b/webui/components/settings/skills/skills-import-store.js
index 4e660363d..a0b0d8b67 100644
--- a/webui/components/settings/skills/skills-import-store.js
+++ b/webui/components/settings/skills/skills-import-store.js
@@ -1,6 +1,5 @@
import { createStore } from "/js/AlpineStore.js";
-
-const fetchApi = globalThis.fetchApi;
+import * as api from "/js/api.js";
function sanitizeNamespace(text) {
if (!text) return "";
@@ -16,11 +15,12 @@ const model = {
error: "",
skillsFile: null,
- dest: "custom", // custom|project
namespace: "",
conflict: "skip", // skip|overwrite|rename
- projectName: "", // selected project name when dest is "project"
- projects: [], // available projects list
+ projectKey: "", // selected project key, empty means All
+ agentProfileKey: "", // selected agent profile key, empty means All
+ projects: [], // available projects options [{key,label}]
+ agentProfiles: [], // available agent profile options [{key,label}]
preview: null,
result: null,
@@ -28,6 +28,7 @@ const model = {
init() {
this.resetState();
this.loadProjects();
+ this.loadAgentProfiles();
},
resetState() {
@@ -42,19 +43,14 @@ const model = {
this.resetState();
this.skillsFile = null;
this.namespace = "";
- this.dest = "custom";
this.conflict = "skip";
- this.projectName = "";
+ this.projectKey = "";
+ this.agentProfileKey = "";
},
async loadProjects() {
try {
- const response = await fetchApi("/projects", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ action: "list" }),
- });
- const data = await response.json();
+ const data = await api.callJsonApi("/projects", { action: "list_options" });
this.projects = data.ok ? (data.data || []) : [];
} catch (e) {
console.error("Failed to load projects:", e);
@@ -62,6 +58,16 @@ const model = {
}
},
+ async loadAgentProfiles() {
+ try {
+ const data = await api.callJsonApi("/agents", { action: "list" });
+ this.agentProfiles = data.ok ? (data.data || []) : [];
+ } catch (e) {
+ console.error("Failed to load agent profiles:", e);
+ this.agentProfiles = [];
+ }
+ },
+
async handleFileUpload(event) {
const file = event.target.files[0];
if (!file) return;
@@ -86,11 +92,15 @@ const model = {
const formData = new FormData();
formData.append("skills_file", this.skillsFile);
formData.append("ctxid", globalThis.getContext ? globalThis.getContext() : "");
- formData.append("dest", this.dest);
formData.append("namespace", sanitizeNamespace(this.namespace));
formData.append("conflict", this.conflict);
- if (this.dest === "project" && this.projectName) {
- formData.append("project_name", this.projectName);
+
+ if (this.projectKey) {
+ formData.append("project_name", this.projectKey);
+ }
+
+ if (this.agentProfileKey) {
+ formData.append("agent_profile", this.agentProfileKey);
}
return formData;
},
@@ -101,18 +111,13 @@ const model = {
return;
}
- if (this.dest === "project" && !this.projectName) {
- this.error = "Please select a project";
- return;
- }
-
try {
this.loading = true;
this.loadingMessage = "Previewing skills import...";
this.error = "";
this.preview = null;
- const response = await fetchApi("/skills_import_preview", {
+ const response = await api.fetchApi("/skills_import_preview", {
method: "POST",
body: this.buildFormData(),
});
@@ -140,18 +145,13 @@ const model = {
return;
}
- if (this.dest === "project" && !this.projectName) {
- this.error = "Please select a project";
- return;
- }
-
try {
this.loading = true;
this.loadingMessage = "Importing skills...";
this.error = "";
this.result = null;
- const response = await fetchApi("/skills_import", {
+ const response = await api.fetchApi("/skills_import", {
method: "POST",
body: this.buildFormData(),
});
diff --git a/webui/components/settings/skills/skills-list-store.js b/webui/components/settings/skills/skills-list-store.js
index 40f3728ca..4ba4dfa1c 100644
--- a/webui/components/settings/skills/skills-list-store.js
+++ b/webui/components/settings/skills/skills-list-store.js
@@ -1,7 +1,5 @@
import { createStore } from "/js/AlpineStore.js";
import { store as fileBrowserStore } from "/components/modals/file-browser/file-browser-store.js";
-import { store as settingsStore } from "/components/settings/settings-store.js";
-import { store as chatsStore } from "/components/sidebar/chats/chats-store.js";
const fetchApi = globalThis.fetchApi;
@@ -11,12 +9,12 @@ const model = {
skills: [],
projects: [],
projectName: "",
- profileName: "",
+ agentProfiles: [],
+ agentProfileKey: "",
async init() {
this.resetState();
- await this.loadProjects();
- this.setDefaultProject();
+ await Promise.all([this.loadProjects(), this.loadAgentProfiles()]);
await this.loadSkills();
},
@@ -26,31 +24,35 @@ const model = {
this.skills = [];
this.projects = [];
this.projectName = "";
- this.profileName = "";
+ this.agentProfiles = [];
+ this.agentProfileKey = "";
},
onClose() {
this.resetState();
},
- setDefaultProject() {
- if (this.projectName) return;
- const active = chatsStore?.selectedContext?.project?.name;
- if (active) {
- this.projectName = active;
+ async loadAgentProfiles() {
+ try {
+ const response = await fetchApi("/agents", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ action: "list" }),
+ });
+ const data = await response.json().catch(() => ({}));
+ this.agentProfiles = data.ok ? (data.data || []) : [];
+ } catch (e) {
+ console.error("Failed to load agent profiles:", e);
+ this.agentProfiles = [];
}
},
- refreshProfileName() {
- this.profileName = settingsStore?.settings?.agent_profile || "";
- },
-
async loadProjects() {
try {
const response = await fetchApi("/projects", {
method: "POST",
headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ action: "list" }),
+ body: JSON.stringify({ action: "list_options" }),
});
const data = await response.json().catch(() => ({}));
this.projects = data.ok ? (data.data || []) : [];
@@ -61,7 +63,6 @@ const model = {
},
async loadSkills() {
- this.refreshProfileName();
try {
this.loading = true;
this.error = "";
@@ -71,7 +72,7 @@ const model = {
body: JSON.stringify({
action: "list",
project_name: this.projectName || null,
- profile_name: this.profileName || null,
+ agent_profile: this.agentProfileKey || null,
}),
});
const result = await response.json().catch(() => ({}));
@@ -117,8 +118,7 @@ const model = {
},
async openSkill(skill) {
- if (!skill?.location) return;
- await fileBrowserStore.open(skill.location);
+ await fileBrowserStore.open(skill.path);
},
};
diff --git a/webui/components/settings/skills/skills-settings.html b/webui/components/settings/skills/skills-settings.html
index f9564c304..a553b2780 100644
--- a/webui/components/settings/skills/skills-settings.html
+++ b/webui/components/settings/skills/skills-settings.html
@@ -17,7 +17,7 @@
</li>
<li>
<a href="#section-skills-import">
- <img src="/public/skills.svg" alt="Skills" />
+ <img src="/public/skills_add.svg" alt="Skills" />
<span>Import Skills</span>
</a>
</li>
diff --git a/webui/css/modals.css b/webui/css/modals.css
index 2705233a8..0747c8fee 100644
--- a/webui/css/modals.css
+++ b/webui/css/modals.css
@@ -200,7 +200,7 @@ some classes like modal-header are shared between the old and the new system */
.section {
margin-bottom: 2rem;
padding: 1rem;
- padding-bottom: 0;
+ /* padding-bottom: 0; */
border: 1px solid var(--color-border);
border-radius: 0.5rem;
}
@@ -444,7 +444,7 @@ input[type="range"]::-moz-range-thumb {
.section {
margin-bottom: 1.5rem;
padding: 1rem;
- padding-bottom: 0;
+ /* padding-bottom: 0; */
border: 1px solid var(--color-border);
border-radius: 0.5rem;
}
diff --git a/webui/public/skills.svg b/webui/public/skills.svg
index 8ca3877c2..68200ea88 100644
--- a/webui/public/skills.svg
+++ b/webui/public/skills.svg
@@ -1,4 +1,6 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
- <path d="M7 7h10M7 11h10M7 15h6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
- <path d="M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Z" stroke="currentColor" stroke-width="2"/>
-</svg>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100%" height="100%" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;">
+ <path d="M7,7L17,7M7,11L17,11M7,15L13,15" style="fill:none;fill-rule:nonzero;stroke:black;stroke-width:1px;"/>
+ <path d="M5,3L19,3C20.097,3 21,3.903 21,5L21,19C21,20.097 20.097,21 19,21L5,21C3.903,21 3,20.097 3,19L3,5C3,3.903 3.903,3 5,3Z" style="fill:none;fill-rule:nonzero;stroke:black;stroke-width:1px;stroke-linecap:butt;"/>
+</svg>
diff --git a/webui/public/skills_add.svg b/webui/public/skills_add.svg
new file mode 100644
index 000000000..f2fd2ff68
--- /dev/null
+++ b/webui/public/skills_add.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100%" height="100%" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;">
+ <g transform="matrix(1,0,0,1,0,5)">
+ <path d="M7,7L17,7" style="fill:none;fill-rule:nonzero;stroke:black;stroke-width:1px;"/>
+ </g>
+ <g transform="matrix(6.12323e-17,1,-1,6.12323e-17,19,8.88178e-16)">
+ <path d="M7,7L17,7" style="fill:none;fill-rule:nonzero;stroke:black;stroke-width:1px;"/>
+ </g>
+ <path d="M5,3L19,3C20.097,3 21,3.903 21,5L21,19C21,20.097 20.097,21 19,21L5,21C3.903,21 3,20.097 3,19L3,5C3,3.903 3.903,3 5,3Z" style="fill:none;fill-rule:nonzero;stroke:black;stroke-width:1px;stroke-linecap:butt;"/>
+</svg>