Skip to content

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:修复tui安装卸载内置skills,新增/skills import安装本地skills

openJiuwen-bot00f2e19e2096
diff --git a/docs/en/SlashCommands.md b/docs/en/SlashCommands.md
index 512b99c9e4..2e3da9334a 100644
--- a/docs/en/SlashCommands.md
+++ b/docs/en/SlashCommands.md
@@ -36,7 +36,7 @@ Identified by Gateway and forwarded to AgentServer and other backend capabilitie
| `/new_session` | Create new session (IM only) |
| `/mode` | Mode switching (supports first-level entry and direct syntax) |
| `/switch` | Switch second-level mode within current mode family |
-| `/skills` | Skills management (list, install, uninstall, marketplace) (see below) |
+| `/skills` | Skills management (list, install, import, uninstall, marketplace) (see below) |
| `/model` | Model view, add, switch (see below) |
| `/mcp` | MCP server management (see below) |
| `/diff` | View session changes by turn (see below) |
@@ -176,14 +176,15 @@ Manages directories AI can access for file read, edit, and execute operations.
### `/skills` (Skills Management)
-Manage skills lifecycle: listing, installing, uninstalling, and marketplace source management.
+Manage skills lifecycle: listing, installing, importing, uninstalling, and marketplace source management.
#### Subcommands
| Command | Description |
|---|---|
-| `/skills` or `/skills list` | List currently installed skills |
-| `/skills install <spec>` | Install a skill from marketplace (e.g., `my-skill@marketplace`) |
+| `/skills` or `/skills list` | List skills (grouped: Installed / Available to install) |
+| `/skills install <skill>` or `/skills install <skill@marketplace>` | Install a skill: builtin skills accept bare name, marketplace skills use `<name>@<marketplace>` format |
+| `/skills import <path>` | Import a custom skill from a local path or remote URL |
| `/skills uninstall <name>` | Uninstall a skill by name |
| `/skills marketplace` or `/skills marketplace list` | List marketplace sources (name, URL, enabled status, last updated) |
| `/skills marketplace add <name> <url>` | Add a new marketplace source |
@@ -193,10 +194,20 @@ Manage skills lifecycle: listing, installing, uninstalling, and marketplace sour
#### Concepts
-- **Skill**: An extension capability that can be installed from marketplace sources, providing additional functionality to the agent.
+- **Skill**: An extension capability that can be installed from marketplace sources, builtin directory, or local paths, providing additional functionality to the agent.
+- **Builtin skill**: A preset skill shipped with the software. Install using bare skill name (e.g., `/skills install advanced-daily-report`); no marketplace source needed.
- **Marketplace source**: A remote repository (typically a Git URL) that hosts available skills. Each source has a name, URL, and enabled/disabled state.
-- **Spec**: The install identifier format `<skill>@<marketplace>` used when installing a skill from a specific marketplace.
-- **Install location**: The directory where a skill is stored after installation.
+- **Spec**: The install identifier format `<skill>@<marketplace>` used when installing from a marketplace; for builtin skills, omit `@` and the system auto-detects as `@builtin`.
+- **Import**: Copy a local directory (must contain `SKILL.md`) or remote archive URL into the workspace as a custom skill.
+- **Install location**: The directory where a skill is stored after installation (`~/.jiuwenclaw/agent/jiuwenclaw_workspace/skills/`).
+- **Source tag**: Each skill in the list is tagged with its source: `[builtin]` = builtin, `[local]` = imported, `[project]` or marketplace name = other.
+
+#### Grouped List Display
+
+`/skills list` returns skills in two groups:
+
+1. **Installed**: Skills already in the user's skills directory, ready to use.
+2. **Available to install**: Builtin skills not yet installed, plus marketplace skills available for installation. Use `/skills install` or `/skills import` first.
#### IM vs TUI Differences
@@ -205,22 +216,27 @@ Both ultimately request `skills.list`, but trigger methods and display differ.
| Side | Trigger Method | Behavior |
|---|---|---|
| IM (Feishu etc. controlled channel) | Exact match `/skills list` (whitespace normalized first) | Gateway intercepts control message and requests `skills.list`, results shown as IM notification/card; standalone `/skills` doesn't go through this control path. |
-| TUI (CLI built-in) | Input `/skills` | Locally executes built-in command and calls `skills.list`, displays as list view in session (title `Skills`); shows `No skills returned` when empty. |
+| TUI (CLI built-in) | Input `/skills` | Locally executes built-in command and calls `skills.list`, displays as grouped list view in session (titles `Installed Skills` and `Available Skills`); shows `No installed skills` when empty. |
-For other subcommands (`/skills install`, `/skills uninstall`, `/skills marketplace add/remove/toggle`, `/skills use`), Gateway does **not** intercept them — on the IM side they are treated as regular chat messages. These subcommands are only functional on the TUI (CLI built-in) and Web UI paths, where they send RPC requests directly to AgentServer.
+For other subcommands (`/skills install`, `/skills import`, `/skills uninstall`, `/skills marketplace add/remove/toggle`, `/skills use`), Gateway does **not** intercept them — on the IM side they are treated as regular chat messages. These subcommands are only functional on the TUI (CLI built-in) and Web UI paths, where they send RPC requests directly to AgentServer.
#### Notes
-- **Timeout**: `install`, `uninstall`, and `marketplace toggle` requests have a 120-second timeout on the TUI side; other subcommands have no explicit timeout.
+- **Timeout**: `install`, `import`, `uninstall`, and `marketplace toggle` requests have a 120-second timeout on the TUI side; other subcommands have no explicit timeout.
+- **Builtin auto-detection**: When installing with `/skills install <skill>` (no `@`), the system checks if it matches a builtin skill and redirects to the builtin install flow; if not, a format hint is returned.
- **Cache cleanup**: `marketplace remove` sends `{ name, remove_cache: true }` to also clear the local cache for that source.
- **Auto-refresh**: `marketplace add`, `marketplace remove`, and `marketplace toggle` automatically re-list marketplace sources after a successful operation.
- **Offline handling**: `/skills use` checks connection status; if offline, shows `offline: waiting for reconnect before sending /skills use request`.
#### Examples
-- `/skills` — List installed skills
-- `/skills list` — List installed skills (explicit subcommand)
+- `/skills` — List skills (grouped: Installed / Available)
+- `/skills list` — List skills (explicit subcommand)
+- `/skills install advanced-daily-report` — Install a builtin skill (bare name auto-detect)
+- `/skills install advanced-daily-report@builtin` — Install a builtin skill (explicit format)
- `/skills install my-skill@marketplace` — Install a skill from marketplace
+- `/skills import /path/to/my-skill` — Import a skill from local directory
+- `/skills import https://example.com/skill.zip` — Import a skill from remote URL
- `/skills uninstall my-skill` — Uninstall a skill
- `/skills marketplace list` — List marketplace sources
- `/skills marketplace add community https://github.com/user/skills-repo` — Add a marketplace source named "community"
diff --git "a/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md" "b/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"
index 9673db07eb..c2f0fc1cd3 100644
--- "a/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"
+++ "b/docs/zh/Slash\345\221\275\344\273\244\350\241\250.md"
@@ -36,7 +36,7 @@
| `/new_session` | 新建会话(仅 IM 生效) |
| `/mode` | 模式切换(支持一级入口与直达写法) |
| `/switch` | 在当前模式族内切换二级模式 |
-| `/skills` | 技能管理(列表、安装、卸载、市场源) |
+| `/skills` | 技能管理(列表、安装、导入、卸载、市场源) |
| `/model` | 模型查看、新增、切换(见下文) |
| `/mcp` | MCP 服务管理(见下文) |
| `/diff` | 查看当前会话按轮次改动(见下文) |
@@ -198,14 +198,15 @@
### `/skills`(技能管理)
-管理技能的完整生命周期:列表查看、安装、卸载以及市场源管理。
+管理技能的完整生命周期:列表查看、安装、导入、卸载以及市场源管理。
#### 子命令
| 命令 | 说明 |
|---|---|
-| `/skills` 或 `/skills list` | 列出当前已安装的技能 |
-| `/skills install <spec>` | 从市场源安装技能(如 `my-skill@marketplace`) |
+| `/skills` 或 `/skills list` | 列出技能(分两组:已安装 / 可安装) |
+| `/skills install <skill>` 或 `/skills install <skill@marketplace>` | 安装技能:内置技能可直接用名称,市场技能需用 `<名称>@<市场源>` 格式 |
+| `/skills import <path>` | 从本地路径或远程 URL 导入自定义技能 |
| `/skills uninstall <name>` | 按名称卸载技能 |
| `/skills marketplace` 或 `/skills marketplace list` | 列出市场源(名称、URL、启用状态、最后更新时间) |
| `/skills marketplace add <name> <url>` | 添加新的市场源 |
@@ -215,10 +216,20 @@
#### 概念说明
-- **技能(Skill)**:可从市场源安装的扩展能力,为 Agent 提供额外功能。
+- **技能(Skill)**:可从市场源、内置目录或本地路径安装的扩展能力,为 Agent 提供额外功能。
+- **内置技能(Builtin skill)**:随软件打包发布的预置技能,安装时可直接使用技能名称(如 `/skills install advanced-daily-report`),无需指定市场源。
- **市场源(Marketplace source)**:托管可用技能的远程仓库(通常为 Git URL),每个源包含名称、URL 和启用/禁用状态。
-- **规格标识(Spec)**:安装时使用的标识格式 `<技能名>@<市场源名>`。
-- **安装位置(Install location)**:技能安装后的存储目录。
+- **规格标识(Spec)**:从市场源安装时使用的标识格式 `<技能名>@<市场源名>`;内置技能安装时可不带 `@`,自动识别为 `@builtin`。
+- **本地导入(Import)**:将本地目录(需包含 `SKILL.md`)或远程归档 URL 导入为自定义技能。
+- **安装位置(Install location)**:技能安装后的存储目录(`~/.jiuwenclaw/agent/jiuwenclaw_workspace/skills/`)。
+- **来源标签(Source tag)**:列表中每项技能标注来源,`[builtin]` 表示内置、`[local]` 表示本地导入、`[project]` 或市场源名表示其他来源。
+
+#### 列表分组展示
+
+`/skills list` 返回的技能列表分为两组:
+
+1. **已安装(Installed)**:已存在于用户 skills 目录的技能,可直接使用。
+2. **可安装(Available to install)**:内置但尚未安装的技能,以及市场源中可安装的技能,需先执行 `/skills install` 或 `/skills import` 才能使用。
#### IM 与 TUI 的差异
@@ -227,22 +238,27 @@
| 端 | 触发方式 | 行为 |
|---|---|---|
| IM(飞书等受控通道) | 整行精确匹配 `/skills list`(会先做空白规范化) | Gateway 拦截控制消息并请求 `skills.list`,结果以 IM 通知/卡片等形式展示;单独输入 `/skills` 不走该控制路径。 |
-| TUI(CLI 内置) | 输入 `/skills` | 本地执行内置命令并调用 `skills.list`,在会话内以列表视图展示(标题 `Skills`);无数据时提示 `No skills returned`。 |
+| TUI(CLI 内置) | 输入 `/skills` | 本地执行内置命令并调用 `skills.list`,在会话内以分组列表视图展示(标题 `Installed Skills` 与 `Available Skills`);无数据时提示 `No installed skills`。 |
-对于其他子命令(`/skills install`、`/skills uninstall`、`/skills marketplace add/remove/toggle`、`/skills use`),Gateway **不会拦截**——在 IM 侧输入时会被当作普通聊天消息发送给 Agent。这些子命令仅在 TUI(CLI 内置)和 Web UI 路径下可用,通过 RPC 直连 AgentServer。
+对于其他子命令(`/skills install`、`/skills import`、`/skills uninstall`、`/skills marketplace add/remove/toggle`、`/skills use`),Gateway **不会拦截**——在 IM 侧输入时会被当作普通聊天消息发送给 Agent。这些子命令仅在 TUI(CLI 内置)和 Web UI 路径下可用,通过 RPC 直连 AgentServer。
#### 备注
-- **超时**:`install`、`uninstall`、`marketplace toggle` 请求在 TUI 侧有 120 秒超时;其余子命令无显式超时设置。
+- **超时**:`install`、`import`、`uninstall`、`marketplace toggle` 请求在 TUI 侧有 120 秒超时;其余子命令无显式超时设置。
+- **内置技能自动识别**:使用 `/skills install <skill>` 安装时,若技能名称不带 `@`,系统会自动检查是否为内置技能并重定向到内置安装流程;若不是内置技能则返回格式提示。
- **缓存清理**:`marketplace remove` 发送 `{ name, remove_cache: true }` 以同时清理该源的本地缓存。
- **自动刷新**:`marketplace add`、`marketplace remove`、`marketplace toggle` 在操作成功后会自动重新列出市场源。
- **离线处理**:`/skills use` 会检查连接状态;离线时显示 `offline: waiting for reconnect before sending /skills use request`。
#### 示例
-- `/skills` — 列出已安装技能
-- `/skills list` — 列出已安装技能(显式子命令)
+- `/skills` — 列出技能(分组:已安装 / 可安装)
+- `/skills list` — 列出技能(显式子命令)
+- `/skills install advanced-daily-report` — 安装内置技能(裸名自动识别)
+- `/skills install advanced-daily-report@builtin` — 安装内置技能(显式指定)
- `/skills install my-skill@marketplace` — 从市场源安装技能
+- `/skills import /path/to/my-skill` — 从本地目录导入技能
+- `/skills import https://example.com/skill.zip` — 从远程 URL 导入技能
- `/skills uninstall my-skill` — 卸载技能
- `/skills marketplace list` — 列出市场源
- `/skills marketplace add community https://github.com/user/skills-repo` — 添加名为"community"的市场源
diff --git a/jiuwenclaw/channels/tui/frontend/src/core/commands/builtins/skills.ts b/jiuwenclaw/channels/tui/frontend/src/core/commands/builtins/skills.ts
index d827cf0254..d872950099 100644
--- a/jiuwenclaw/channels/tui/frontend/src/core/commands/builtins/skills.ts
+++ b/jiuwenclaw/channels/tui/frontend/src/core/commands/builtins/skills.ts
@@ -32,33 +32,60 @@ async function listMarketplaces(ctx: import("../types.js").CommandContext): Prom
async function listSkills(ctx: import("../types.js").CommandContext): Promise<void> {
const payload = await ctx.request("skills.list", {});
- const items = flattenArrayPayload(payload).map((item, index) => {
+ const allSkills = flattenArrayPayload(payload);
+
+ const installed: { label: string; value?: string; description: string }[] = [];
+ const available: { label: string; value?: string; description: string }[] = [];
+
+ for (const item of allSkills) {
if (item && typeof item === "object") {
const obj = item as Record<string, unknown>;
- return {
- label: typeof obj.name === "string" ? obj.name : String(index + 1),
+ const name = typeof obj.name === "string" ? obj.name : "?";
+ const sourceTag = obj.is_builtin_source ? "[builtin]" : (obj.source === "local" ? "[local]" : `[${obj.source || "project"}]`);
+ const desc = typeof obj.description === "string" ? obj.description : "";
+ const entry = {
+ label: name,
value: typeof obj.path === "string" ? obj.path : undefined,
- description: typeof obj.description === "string" ? obj.description : undefined,
+ description: `${sourceTag} ${desc}`,
};
+ if (obj.installed === true) {
+ installed.push(entry);
+ } else {
+ available.push(entry);
+ }
}
- return { label: String(index + 1), value: formatValue(item) };
- });
+ }
+
+ // Group 1: Installed skills
ctx.addItem(
makeItem(
ctx.sessionId,
"info",
- items.length > 0 ? "Installed skills" : "No skills returned",
+ installed.length > 0 ? `Installed (${installed.length})` : "No installed skills",
"*",
- { view: "list", title: "Skills", items },
+ { view: "list", title: "Installed Skills", items: installed },
),
);
+
+ // Group 2: Available skills (not yet installed)
+ if (available.length > 0) {
+ ctx.addItem(
+ makeItem(
+ ctx.sessionId,
+ "info",
+ `Available to install (${available.length})`,
+ "*",
+ { view: "list", title: "Available Skills", items: available },
+ ),
+ );
+ }
}
export function createSkillsCommand(): SlashCommand {
return {
name: "skills",
- description: "Manage skills (list, install, uninstall, marketplace, use)",
- usage: "/skills [list|install|uninstall|marketplace|use]",
+ description: "Manage skills (list, install, import, uninstall, marketplace, use)",
+ usage: "/skills [list|install|import|uninstall|marketplace|use]",
example: "/skills list",
kind: CommandKind.BUILT_IN,
action: async (ctx) => {
@@ -78,27 +105,48 @@ export function createSkillsCommand(): SlashCommand {
},
{
name: "install",
- description: "Install a skill from marketplace",
- usage: "/skills install <spec>",
- example: "/skills install my-skill@marketplace",
+ description: "Install a skill (builtin name or plugin@marketplace)",
+ usage: "/skills install <skill> or <skill@marketplace>",
+ example: "/skills install my-skill",
kind: CommandKind.BUILT_IN,
takesArgs: true,
action: async (ctx, args) => {
const spec = args.trim();
if (!spec) {
- ctx.addItem(makeItem(ctx.sessionId, "error", "Usage: /skills install <plugin@marketplace>"));
+ ctx.addItem(makeItem(ctx.sessionId, "error", "Usage: /skills install <skill> or <skill@marketplace>"));
return;
}
+ let finalSpec = spec;
+ // Bare skill name without @ — auto-detect if it's a builtin
+ if (!spec.includes("@")) {
+ try {
+ const payload = await ctx.request("skills.list", {});
+ const skills = flattenArrayPayload(payload);
+ const builtinMatch = skills.find((item) => {
+ if (item && typeof item === "object") {
+ const obj = item as Record<string, unknown>;
+ return obj.name === spec
+ && (obj.is_builtin_source === true || obj.is_builtin === true);
+ }
+ return false;
+ });
+ if (builtinMatch) {
+ finalSpec = `${spec}@builtin`;
+ }
+ } catch {
+ // If list fails, let backend handle the bare name
+ }
+ }
const payload = await ctx.request<{ success?: boolean; detail?: string }>(
"skills.install",
- { spec, force: false },
+ { spec: finalSpec, force: false },
120_000,
);
if (payload.success) {
- ctx.addItem(makeItem(ctx.sessionId, "info", `Skill installed: ${spec}`));
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill installed: ${finalSpec}`));
} else {
ctx.addItem(
- makeItem(ctx.sessionId, "error", payload.detail || `Install failed: ${spec}`),
+ makeItem(ctx.sessionId, "error", payload.detail || `Install failed: ${finalSpec}`),
);
}
},
@@ -130,6 +178,35 @@ export function createSkillsCommand(): SlashCommand {
}
},
},
+ {
+ name: "import",
+ description: "Import a skill from local path or remote URL",
+ usage: "/skills import <path>",
+ example: "/skills import /path/to/my-skill",
+ kind: CommandKind.BUILT_IN,
+ takesArgs: true,
+ action: async (ctx, args) => {
+ const path = args.trim();
+ if (!path) {
+ ctx.addItem(makeItem(ctx.sessionId, "error", "Usage: /skills import <path_or_url>"));
+ return;
+ }
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Importing skill from: ${path}`));
+ const payload = await ctx.request<{ success?: boolean; detail?: string; skill?: { name?: string } }>(
+ "skills.import_local",
+ { path, force: false },
+ 120_000,
+ );
+ if (payload.success) {
+ const skillName = payload.skill?.name || path;
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill imported: ${skillName}`));
+ } else {
+ ctx.addItem(
+ makeItem(ctx.sessionId, "error", payload.detail || `Import failed: ${path}`),
+ );
+ }
+ },
+ },
{
name: "marketplace",
description: "Manage marketplace sources",
diff --git a/jiuwenclaw/server/runtime/skill/skill_manager.py b/jiuwenclaw/server/runtime/skill/skill_manager.py
index 075ac01f77..3ac1e262a0 100644
--- a/jiuwenclaw/server/runtime/skill/skill_manager.py
+++ b/jiuwenclaw/server/runtime/skill/skill_manager.py
@@ -578,7 +578,17 @@ class SkillManager:
force = params.get("force", False)
if "@" not in spec:
- return {"success": False, "detail": "spec 格式应为 plugin@marketplace"}
+ # Bare skill name — check if it matches a builtin skill
+ try:
+ safe_name = _safe_path_name(spec, "skill")
+ except ValueError as exc:
+ _log_rejected_name("skills.install", "skill", spec, exc)
+ return {"success": False, "detail": str(exc)}
+ builtin_dir = get_builtin_skills_dir()
+ builtin_path = _safe_child_path(builtin_dir, safe_name, "skill")
+ if builtin_path.exists() and builtin_path.is_dir():
+ return await self.handle_skills_install_builtin({"name": safe_name})
+ return {"success": False, "detail": "spec 格式应为 skill@marketplace,内置技能可直接使用名称安装"}
plugin_name, marketplace_name = spec.rsplit("@", 1)
if not plugin_name or not marketplace_name:
@@ -2312,6 +2322,7 @@ class SkillManager:
break
meta["source"] = source
+ meta["installed"] = True
# 判断是否为内置技能(传入 child 路径,通过实际路径判断)
meta["is_builtin"] = self._is_builtin_skill(meta.get("name", ""), self._get_installed_plugins(), child)
builtin_dir = get_builtin_skills_dir()
@@ -2358,7 +2369,8 @@ class SkillManager:
# 设置内置技能的标记
meta["source"] = "builtin"
meta["is_builtin"] = True
- meta["is_builtin_source"] = True # 这是内置技能来源
+ meta["is_builtin_source"] = True
+ meta["installed"] = False
meta["has_evolutions"] = False
# 不在列表中返回 body
meta.pop("body", None)
@@ -2472,6 +2484,7 @@ class SkillManager:
meta["source"] = marketplace_name
meta["marketplace"] = marketplace_name
meta["is_builtin"] = False
+ meta["installed"] = False
meta["has_evolutions"] = False
meta.pop("body", None)
results.append(meta)