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

/skills支持skillnet和clawhub源

openJiuwen-botb592e6e82bb5
diff --git a/docs/en/SlashCommands.md b/docs/en/SlashCommands.md
index 4ab1ee09e0..d476e94503 100644
--- a/docs/en/SlashCommands.md
+++ b/docs/en/SlashCommands.md
@@ -49,7 +49,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, uninstall, marketplace, ClawHub, SkillNet) (see below) |
| `/model` | Model view, add, switch (see below) |
| `/mcp` | MCP server management (see below) |
| `/diff` | View session changes by turn (see below) |
@@ -355,30 +355,37 @@ Manage cron jobs via RPC calls to the backend `CronController`, sharing the same
### `/skills` (Skills Management)
-Manage skills lifecycle: listing, installing, uninstalling, and marketplace source management.
+Manage skills lifecycle: listing, installing, uninstalling, marketplace source management, ClawHub and SkillNet online skill registries.
#### Subcommands
| Command | Description |
|---|---|
| `/skills` or `/skills list` | List skills (grouped: Installed / Available to install) |
-| `/skills install <skill>` or `/skills install <skill@marketplace>` or `/skills install <path_or_url>` | Install a skill: builtin skills accept bare name, marketplace skills use `<name>@<marketplace>` format, local paths and remote URLs are auto-detected |
+| `/skills install <skill>` or `/skills install <slug@clawhub>` or `/skills install <name@skillnet>` or `/skills install <skill@marketplace>` or `/skills install <path_or_url>` | Install a skill: builtin accepts bare name, ClawHub uses `<slug>@clawhub`, SkillNet uses `<name>@skillnet` (auto-searches for URL), marketplace uses `<name>@<marketplace>`, local paths and URLs auto-detected |
| `/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 |
| `/skills marketplace remove <name>` | Remove a marketplace source (also clears its cache) |
| `/skills marketplace toggle <name> <on or off>` | Enable or disable a marketplace source (`on`/`true`/`1` = enable, otherwise disable) |
+| `/skills marketplace clawhub` | View ClawHub token status (configured/not configured) |
+| `/skills marketplace clawhub token <value>` | Set ClawHub CLI token |
+| `/skills marketplace clawhub token` | View ClawHub token status |
+| `/skills skillnet` or `/skills skillnet search <query>` | Search SkillNet skill registry (shows name, description, author, stars, category, URL) |
+| `/skills skillnet install <skill_url>` | Install a skill from SkillNet by URL (async download, auto-polls progress) |
| `/skills use <skill_name>, <query>` | Execute a query using a specific skill |
#### Concepts
-- **Skill**: An extension capability that can be installed from marketplace sources, builtin directory, or local paths, providing additional functionality to the agent.
+- **Skill**: An extension capability that can be installed from marketplace sources, ClawHub, SkillNet, 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 from a marketplace; for builtin skills, omit `@` and the system auto-detects as `@builtin`.
+- **ClawHub**: An online skill registry ([clawhub.ai](https://clawhub.ai)) hosting community-published skills. Install using `<slug>@clawhub` format, where slug is the skill's unique identifier (not its display name). Requires a ClawHub CLI token to be configured first.
+- **SkillNet**: An academic skill registry. Two install methods: `<name>@skillnet` (auto-searches to find URL then installs) and `/skills skillnet install <url>` (direct URL install).
+- **Marketplace source**: A remote Git repository that hosts available skills. Each source has a name, URL, and enabled/disabled state.
+- **Spec**: The install identifier format supporting: `<skill>@builtin` (builtin), `<slug>@clawhub` (ClawHub), `<skill>@<marketplace>` (Git marketplace); bare names without `@` are auto-detected as builtin if applicable.
- **Local install**: Use `/skills install <path>` to install from a local directory (must contain `SKILL.md`) or remote archive URL; paths/URLs are auto-detected and routed to the local import flow.
- **Install location**: The directory where a skill is stored after installation (`~/.jiuwenswarm/agent/jiuwenswarm_workspace/skills/`).
-- **Source tag**: Each skill in the list is tagged with its source: `[builtin]` = builtin, `[local]` = imported, `[project]` or marketplace name = other.
+- **Source tag**: Each skill in the list is tagged with its source: `[builtin]` = builtin, `[local]` = imported, `[clawhub]` = ClawHub, `[skillnet]` = SkillNet, `[project]` or marketplace name = other.
#### Grouped List Display
@@ -402,7 +409,16 @@ For other subcommands (`/skills install`, `/skills uninstall`, `/skills marketpl
- **Timeout**: `install`, `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.
-- **Path/URL auto-detection**: When installing with `/skills install <path>` (local path like `/path/to/skill` or `C:\skill`, or remote URL `https://...`), the system automatically routes to the local import flow.
+- **Path/URL auto-detection**: When installing with `/skills install <path_or_url>` (local path like `/path/to/skill` or `C:\skill`, or remote URL `https://...`), the system automatically routes to the local import flow (`skills.import_local`). All URLs go through import_local; SkillNet is not auto-routed from URLs.
+- **`@skillnet` search-install**: When using `/skills install <name>@skillnet`, the frontend first calls `skills.skillnet.search`. **Only auto-installs if an exact match by skill_name is found**; with no exact match, it only displays search results (with URLs and names) without auto-installing the first result — the user must choose one and install via `/skills skillnet install <url>` or `/skills install <exact_name>@skillnet`. This is because SkillNet search is semantic: searching "code" may return "taskflow", "coding-agent" etc. whose names don't contain "code".
+- **ClawHub token required**: A ClawHub CLI token must be configured before installing from ClawHub (via `/skills marketplace clawhub token <value>`). Without a token, `@clawhub` installs will fail with a message explaining how to set the token. Obtain your token at [clawhub.ai](https://clawhub.ai).
+- **ClawHub slug vs. display name**: ClawHub skills are identified by their unique **slug** (e.g., `code-review-security`), not their display name (e.g., "Code Review Assistant"). When a direct slug install fails, the system automatically searches ClawHub and displays matching results (with real slugs and summaries) to help you find the correct skill.
+- **ClawHub overwrite confirmation**: When the target slug already exists (same name from any source counts as installed), TUI presents an interactive prompt: "Skill xxx is already installed. Do you want to force overwrite?". Choosing "Yes" re-installs with `force: true`, replacing the old skill; choosing "No" or exiting keeps the existing skill unchanged. The Web UI bypasses confirmation and uses `force: true` directly.
+- **SkillNet async install**: SkillNet installation is asynchronous — it initiates a download task and returns an `install_id`, then TUI automatically polls `install_status` every 800ms until completion or failure (max wait: 15 minutes). Progress is shown as `Downloading... (install_id: xxx)`.
+- **SkillNet overwrite confirmation**: Same as ClawHub — TUI prompts the user interactively when a skill already exists. Web UI uses `force: true` directly.
+- **SkillNet accessible in China**: SkillNet search API is hosted at `http://api-skillnet.openkg.cn` (OpenKG platform) and is directly accessible in China without VPN. However, the skill content itself is hosted on GitHub, which may require VPN.
+- **Same-name skills cannot coexist**: Skills are stored as directories at `skills/{name}/`, and the filesystem does not allow two directories with the same name. Installing a skill with the same name from a different source will overwrite the previous one (with user confirmation). `/skills use` only uses the skill name and cannot distinguish between sources.
+- **ClawHub network access**: ClawHub API is hosted at `https://clawhub.ai`. VPN may be required in regions with restricted access to this domain.
- **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`.
@@ -413,15 +429,21 @@ For other subcommands (`/skills install`, `/skills uninstall`, `/skills marketpl
- `/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 install code-review@clawhub` — Install a skill from ClawHub (using slug)
+- `/skills install code-review@skillnet` — Install from SkillNet (auto-searches for URL)
+- `/skills skillnet search code-review` — Search SkillNet skill registry
+- `/skills skillnet install https://github.com/user/skill-repo` — Install via SkillNet subcommand (direct URL)
+- `/skills install my-skill@marketplace` — Install a skill from Git marketplace
- `/skills install /path/to/my-skill` — Install a skill from local directory
-- `/skills install https://example.com/skill.zip` — Install a skill from remote URL
+- `/skills install https://example.com/skill.zip` — Install from remote URL (local import)
- `/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"
- `/skills marketplace remove community` — Remove the "community" marketplace source
- `/skills marketplace toggle community on` — Enable the "community" marketplace source
- `/skills marketplace toggle community off` — Disable the "community" marketplace source
+- `/skills marketplace clawhub` — View ClawHub token status
+- `/skills marketplace clawhub token abc123xyz` — Set ClawHub CLI token
- `/skills use my-skill, Code and execute a Hello World program.` — Use a skill to execute a query
### `/export` (Export Conversation)
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 6e7505fd27..c7cf7b2c63 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"
@@ -49,7 +49,7 @@
| `/new_session` | 新建会话(仅 IM 生效) |
| `/mode` | 模式切换(支持一级入口与直达写法) |
| `/switch` | 在当前模式族内切换二级模式 |
-| `/skills` | 技能管理(列表、安装、卸载、市场源) |
+| `/skills` | 技能管理(列表、安装、卸载、市场源、ClawHub、SkillNet) |
| `/model` | 模型查看、新增、切换(见下文) |
| `/mcp` | MCP 服务管理(见下文) |
| `/diff` | 查看当前会话按轮次改动(见下文) |
@@ -377,30 +377,37 @@
### `/skills`(技能管理)
-管理技能的完整生命周期:列表查看、安装、卸载以及市场源管理。
+管理技能的完整生命周期:列表查看、安装、卸载、市场源管理、ClawHub 和 SkillNet 在线技能库。
#### 子命令
| 命令 | 说明 |
|---|---|
| `/skills` 或 `/skills list` | 列出技能(分两组:已安装 / 可安装) |
-| `/skills install <skill>` 或 `/skills install <skill@marketplace>` 或 `/skills install <path_or_url>` | 安装技能:内置技能可直接用名称,市场技能需用 `<名称>@<市场源>` 格式,本地路径或远程 URL 可直接传入路径 |
+| `/skills install <skill>` 或 `/skills install <slug@clawhub>` 或 `/skills install <name@skillnet>` 或 `/skills install <skill@marketplace>` 或 `/skills install <path_or_url>` | 安装技能:内置技能可直接用名称,ClawHub 用 `<slug>@clawhub`,SkillNet 用 `<名称>@skillnet`(自动搜索获取 URL),市场源用 `<名称>@<市场源>`,本地路径或远程 URL 直接传入 |
| `/skills uninstall <name>` | 按名称卸载技能 |
| `/skills marketplace` 或 `/skills marketplace list` | 列出市场源(名称、URL、启用状态、最后更新时间) |
| `/skills marketplace add <name> <url>` | 添加新的市场源 |
| `/skills marketplace remove <name>` | 移除市场源(同时清理缓存) |
| `/skills marketplace toggle <name> <on或off>` | 启用或禁用市场源(`on`/`true`/`1` 为启用,其余为禁用) |
+| `/skills marketplace clawhub` | 查看 ClawHub token 状态(已配置/未配置) |
+| `/skills marketplace clawhub token <value>` | 设置 ClawHub CLI token |
+| `/skills marketplace clawhub token` | 查看 ClawHub token 状态 |
+| `/skills skillnet` 或 `/skills skillnet search <query>` | 搜索 SkillNet 技能库(显示名称、简介、作者、星标、分类、URL) |
+| `/skills skillnet install <skill_url>` | 通过 SkillNet URL 安装技能(异步下载,自动轮询进度) |
| `/skills use <skill_name>, <query>` | 使用指定技能执行查询 |
#### 概念说明
-- **技能(Skill)**:可从市场源、内置目录或本地路径安装的扩展能力,为 Agent 提供额外功能。
+- **技能(Skill)**:可从市场源、ClawHub、SkillNet、内置目录或本地路径安装的扩展能力,为 Agent 提供额外功能。
- **内置技能(Builtin skill)**:随软件打包发布的预置技能,安装时可直接使用技能名称(如 `/skills install advanced-daily-report`),无需指定市场源。
-- **市场源(Marketplace source)**:托管可用技能的远程仓库(通常为 Git URL),每个源包含名称、URL 和启用/禁用状态。
-- **规格标识(Spec)**:从市场源安装时使用的标识格式 `<技能名>@<市场源名>`;内置技能安装时可不带 `@`,自动识别为 `@builtin`。
+- **ClawHub**:在线技能库([clawhub.ai](https://clawhub.ai)),托管社区发布的技能。安装时使用 `<slug>@clawhub` 格式,其中 slug 是技能的唯一标识符(而非展示名)。使用前需先配置 ClawHub CLI token。
+- **SkillNet**:学术技能库(支持两种安装方式:`<名称>@skillnet`(自动搜索获取 URL 后安装)和 `/skills skillnet install <url>`(直接用 URL 安装)。
+- **市场源(Marketplace source)**:托管可用技能的远程 Git 仓库,每个源包含名称、URL 和启用/禁用状态。
+- **规格标识(Spec)**:安装时使用的标识格式,支持以下几种:`<技能名>@builtin`(内置)、`<slug>@clawhub`(ClawHub)、`<技能名>@<市场源名>`(Git 市场源);裸名不带 `@` 时系统会自动检测是否为内置技能。
- **本地安装(Local install)**:通过 `/skills install <path>` 将本地目录(需包含 `SKILL.md`)或远程归档 URL 安装为自定义技能;路径/URL 会自动识别并走本地导入流程。
- **安装位置(Install location)**:技能安装后的存储目录(`~/.jiuwenswarm/agent/jiuwenswarm_workspace/skills/`)。
-- **来源标签(Source tag)**:列表中每项技能标注来源,`[builtin]` 表示内置、`[local]` 表示本地导入、`[project]` 或市场源名表示其他来源。
+- **来源标签(Source tag)**:列表中每项技能标注来源,`[builtin]` 表示内置、`[local]` 表示本地导入、`[clawhub]` 表示从 ClawHub 安装、`[project]` 或市场源名表示其他来源。
#### 列表分组展示
@@ -424,7 +431,16 @@
- **超时**:`install`、`uninstall`、`marketplace toggle` 请求在 TUI 侧有 120 秒超时;其余子命令无显式超时设置。
- **内置技能自动识别**:使用 `/skills install <skill>` 安装时,若技能名称不带 `@`,系统会自动检查是否为内置技能并重定向到内置安装流程;若不是内置技能则返回格式提示。
-- **路径/URL 自动识别**:使用 `/skills install <path>` 安装时,若参数为本地路径(如 `/path/to/skill`、`C:\skill`)或远程 URL(`https://...`),系统自动走本地导入流程。
+- **路径/URL 自动识别**:使用 `/skills install <path_or_url>` 安装时,若参数为本地路径(如 `/path/to/skill`、`C:\skill`)或远程 URL(如 `https://...`),系统自动走本地导入流程(`skills.import_local`)。所有 URL 统一走 import_local,不自动路由 SkillNet。
+- **`@skillnet` 搜索安装**:使用 `/skills install <name>@skillnet` 时,前端先调用 `skills.skillnet.search` 搜索。**只有精确匹配 skill_name 时才自动安装**;无精确匹配时只展示搜索结果列表(含 URL 和名称),不自动安装第一个结果,用户需从中选择后用 `/skills skillnet install <url>` 或 `/skills install <精确名称>@skillnet` 安装。这是因为 SkillNet 搜索是语义匹配,搜索 "code" 可能返回 "taskflow"、"coding-agent" 等名称不含 "code" 的技能。
+- **ClawHub token 必需**:从 ClawHub 安装技能前必须先配置 CLI token(通过 `/skills marketplace clawhub token <value>`)。未配置 token 时,`@clawhub` 安装会失败并提示配置方法。Token 可在 [clawhub.ai](https://clawhub.ai) 注册获取。
+- **ClawHub slug 与展示名**:ClawHub 技能的唯一标识是 **slug**(如 `code-review-security`),而非展示名(如 "Code Review Assistant")。当直接使用 slug 安装失败时,系统会自动搜索 ClawHub 并列出匹配结果(含真实 slug 和简介),帮助用户找到正确的技能。
+- **ClawHub 重名覆盖确认**:当目标 slug 的技能已存在时(同名不同源也算已安装),TUI 会弹出交互式确认:"Skill xxx 已安装,是否强制覆盖?"。用户选择"是"则用 `force: true` 重新安装并覆盖旧技能;选择"否"或退出则保持原技能不变。Web 端则直接以 `force: true` 覆盖,不弹确认。
+- **SkillNet 异步安装**:SkillNet 安装是异步的——先发起下载任务获取 `install_id`,然后自动轮询 `install_status` 直到完成或失败。TUI 每 800ms 轮询一次,最长等待 15 分钟。安装过程中会显示 `Downloading... (install_id: xxx)`。
+- **SkillNet 重名覆盖确认**:与 ClawHub 一致,TUI 在技能已存在时弹出交互确认。Web 端直接以 `force: true` 覆盖。
+- **SkillNet 国内可访问**:SkillNet API 在 `http://api-skillnet.openkg.cn`(OpenKG 平台),国内可直接访问,无需 VPN。技能本体托管在 GitHub,GitHub 访问可能受限。
+- **同名技能不可共存**:技能以目录名存储在 `skills/{name}/`,文件系统不允许同名目录共存。因此从不同源安装同名技能时,后安装的会覆盖前一个(需用户确认)。`/skills use` 只使用技能名,无法区分来源。
+- **ClawHub 网络访问**:ClawHub API 地址为 `https://clawhub.ai`,在国内可能需要 VPN 才能正常访问。
- **缓存清理**:`marketplace remove` 发送 `{ name, remove_cache: true }` 以同时清理该源的本地缓存。
- **自动刷新**:`marketplace add`、`marketplace remove`、`marketplace toggle` 在操作成功后会自动重新列出市场源。
- **离线处理**:`/skills use` 会检查连接状态;离线时显示 `offline: waiting for reconnect before sending /skills use request`。
@@ -435,15 +451,21 @@
- `/skills list` — 列出技能(显式子命令)
- `/skills install advanced-daily-report` — 安装内置技能(裸名自动识别)
- `/skills install advanced-daily-report@builtin` — 安装内置技能(显式指定)
-- `/skills install my-skill@marketplace` — 从市场源安装技能
+- `/skills install code-review@clawhub` — 从 ClawHub 安装技能(使用 slug)
+- `/skills install code-review@skillnet` — 从 SkillNet 安装技能(自动搜索获取 URL)
+- `/skills skillnet search code-review` — 搜索 SkillNet 技能库
+- `/skills skillnet install https://github.com/user/skill-repo` — 通过 SkillNet 子命令安装技能(直接用 URL)
+- `/skills install my-skill@marketplace` — 从 Git 市场源安装技能
- `/skills install /path/to/my-skill` — 从本地目录安装技能
-- `/skills install https://example.com/skill.zip` — 从远程 URL 安装技能
+- `/skills install https://example.com/skill.zip` — 从远程 URL 安装技能(走本地导入)
- `/skills uninstall my-skill` — 卸载技能
- `/skills marketplace list` — 列出市场源
- `/skills marketplace add community https://github.com/user/skills-repo` — 添加名为"community"的市场源
- `/skills marketplace remove community` — 移除"community"市场源
- `/skills marketplace toggle community on` — 启用"community"市场源
- `/skills marketplace toggle community off` — 禁用"community"市场源
+- `/skills marketplace clawhub` — 查看 ClawHub token 状态
+- `/skills marketplace clawhub token abc123xyz` — 设置 ClawHub CLI token
- `/skills use my-skill, Code and execute a Hello World program.` — 使用技能执行查询
### `/export`(导出会话)
diff --git a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/skills.ts b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/skills.ts
index 5932327647..bfa66da41d 100644
--- a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/skills.ts
+++ b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/skills.ts
@@ -1,6 +1,15 @@
import { flattenArrayPayload, formatValue, makeItem } from "../helpers.js";
import { CommandKind, type SlashCommand } from "../types.js";
+type SkillNetItem = {
+ skill_name: string;
+ skill_description: string;
+ author: string;
+ stars: number;
+ skill_url: string;
+ category: string;
+};
+
type MarketPlaceItem = {
name: string;
url: string;
@@ -30,6 +39,30 @@ async function listMarketplaces(ctx: import("../types.js").CommandContext): Prom
);
}
+/** Poll SkillNet install_status until done, failed, or timeout.
+ * Returns the final status payload. */
+async function pollSkillNetInstall(
+ ctx: import("../types.js").CommandContext,
+ installId: string,
+ maxWaitMs: number = 15 * 60 * 1000,
+ pollMs: number = 800,
+): Promise<{ success?: boolean; status?: string; detail?: string; skill?: { name?: string; source?: string } }> {
+ const deadline = Date.now() + maxWaitMs;
+ while (Date.now() < deadline) {
+ await new Promise((r) => setTimeout(r, pollMs));
+ const st = await ctx.request<{ success?: boolean; status?: string; detail?: string; detail_key?: string; skill?: { name?: string; source?: string } }>(
+ "skills.skillnet.install_status",
+ { install_id: installId },
+ 10_000,
+ );
+ if (st.status === "done") return st;
+ if (st.status === "failed") return st;
+ if (!st.success && st.status !== "pending") return st;
+ // still pending — keep polling
+ }
+ return { success: false, detail: `SkillNet install timed out after ${Math.round(maxWaitMs / 1000)}s` };
+}
+
async function listSkills(ctx: import("../types.js").CommandContext): Promise<void> {
const payload = await ctx.request("skills.list", {});
const allSkills = flattenArrayPayload(payload);
@@ -84,9 +117,9 @@ async function listSkills(ctx: import("../types.js").CommandContext): Promise<vo
export function createSkillsCommand(): SlashCommand {
return {
name: "skills",
- description: "Manage skills (list, install, uninstall, marketplace, use)",
- usage: "/skills [list|install|uninstall|marketplace|use]",
- example: "/skills install my-skill | /skills install /path/to/skill",
+ description: "Manage skills (list, install, uninstall, marketplace, skillnet, use)",
+ usage: "/skills [list|install|uninstall|marketplace|skillnet|use]",
+ example: "/skills install my-skill | /skills install code-review@clawhub | /skills skillnet search code",
kind: CommandKind.BUILT_IN,
action: async (ctx) => {
await listSkills(ctx);
@@ -105,15 +138,15 @@ export function createSkillsCommand(): SlashCommand {
},
{
name: "install",
- description: "Install a skill (builtin name, plugin@marketplace, or local path/URL)",
- usage: "/skills install <skill> | <skill@marketplace> | <path_or_url>",
- example: "/skills install my-skill | /skills install /path/to/skill",
+ description: "Install a skill (builtin name, slug@clawhub, name@skillnet, plugin@marketplace, or local path/URL)",
+ usage: "/skills install <skill> | <slug@clawhub> | <name@skillnet> | <skill@marketplace> | <path_or_url>",
+ example: "/skills install my-skill | /skills install code-review@clawhub | /skills install code-review@skillnet",
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 <skill> | <skill@marketplace> | <path_or_url>"));
+ ctx.addItem(makeItem(ctx.sessionId, "error", "Usage: /skills install <skill> | <slug@clawhub> | <name@skillnet> | <skill@marketplace> | <path_or_url>"));
return;
}
@@ -138,6 +171,189 @@ export function createSkillsCommand(): SlashCommand {
return;
}
+ // ClawHub install flow: "slug@clawhub" or bare slug that looks like a ClawHub identifier
+ // ClawHub identifiers are alphanumeric slugs like "code-review", "daily-report" etc.
+ if (spec.includes("@clawhub") || (spec.includes("@") && spec.endsWith("@clawhub"))) {
+ const slug = spec.replace(/@clawhub$/i, "");
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Installing from ClawHub: ${slug}`));
+ const downloadPayload = await ctx.request<{ success?: boolean; detail?: string; detail_key?: string; skill?: { name?: string; source?: string } }>(
+ "skills.clawhub.download",
+ { slug, force: false },
+ 120_000,
+ );
+ if (downloadPayload.success) {
+ const skillName = downloadPayload.skill?.name || slug;
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill installed from ClawHub: ${skillName}`));
+ } else {
+ // Token not configured — give actionable guidance
+ if (downloadPayload.detail_key === "skills.clawhub.errors.tokenNotConfigured") {
+ ctx.addItem(makeItem(ctx.sessionId, "error",
+ `ClawHub token not configured. Please set your token first:\n` +
+ ` /skills marketplace clawhub token <your-token>\n` +
+ `Get your token at: https://clawhub.ai`));
+ return;
+ }
+ // Skill already installed — ask user if they want to force overwrite
+ if (downloadPayload.detail_key === "skills.clawhub.errors.skillAlreadyInstalled"
+ || downloadPayload.detail?.includes("已安装") || downloadPayload.detail?.includes("已存在")) {
+ const answers = await ctx.askQuestions([
+ {
+ header: "ClawHub",
+ question: `Skill "${slug}" is already installed. Do you want to force overwrite it?`,
+ options: [
+ { label: "Yes, overwrite", description: `Re-install "${slug}" from ClawHub, replacing the existing version` },
+ { label: "No, cancel", description: "Keep the existing skill unchanged" },
+ ],
+ },
+ ]);
+ const selected = answers[0]?.selected_options?.[0];
+ if (selected === "Yes, overwrite") {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Force re-installing from ClawHub: ${slug}`));
+ const forcePayload = await ctx.request<{ success?: boolean; detail?: string; detail_key?: string; skill?: { name?: string; source?: string } }>(
+ "skills.clawhub.download",
+ { slug, force: true },
+ 120_000,
+ );
+ if (forcePayload.success) {
+ const skillName = forcePayload.skill?.name || slug;
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill re-installed from ClawHub: ${skillName}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", forcePayload.detail || `ClawHub force install failed: ${slug}`));
+ }
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Installation cancelled. Skill "${slug}" remains unchanged.`));
+ }
+ return;
+ }
+ // Other download error — try searching ClawHub so user can find the correct slug
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Direct install failed for "${slug}", searching ClawHub for matching skills...`));
+ try {
+ const searchPayload = await ctx.request<{ success?: boolean; detail?: string; detail_key?: string; skills?: Array<{ slug: string; display_name: string; summary: string; version: string; updated_at: number }> }>(
+ "skills.clawhub.search",
+ { q: slug, limit: 10 },
+ 60_000,
+ );
+ if (searchPayload.success && searchPayload.skills?.length) {
+ const items = searchPayload.skills.map((s) => ({
+ label: `${s.display_name || s.slug}`,
+ value: s.slug,
+ description: `${s.summary || "(no description)"} | slug: ${s.slug} | v${s.version || "?"}`,
+ }));
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Found ${searchPayload.skills.length} matching skills on ClawHub. Use the slug shown below:`, "*", { view: "list", title: "ClawHub Search Results (use slug@clawhub to install)", items }));
+ } else {
+ // Search also requires token — if token error, give guidance
+ if (searchPayload.detail_key === "skills.clawhub.errors.tokenNotConfigured") {
+ ctx.addItem(makeItem(ctx.sessionId, "error",
+ `ClawHub token not configured. Please set your token first:\n` +
+ ` /skills marketplace clawhub token <your-token>\n` +
+ `Get your token at: https://clawhub.ai`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", downloadPayload.detail || `ClawHub install failed: ${slug}`));
+ }
+ }
+ } catch {
+ ctx.addItem(makeItem(ctx.sessionId, "error", downloadPayload.detail || `ClawHub install failed: ${slug}`));
+ }
+ }
+ return;
+ }
+
+ // SkillNet install flow: "skill_name@skillnet"
+ // SkillNet skills are identified by URL, not slug. The @skillnet format triggers
+ // a search first. Only auto-installs if an exact match by skill_name is found;
+ // otherwise shows search results and lets the user pick the right one.
+ if (spec.endsWith("@skillnet")) {
+ const skillName = spec.replace(/@skillnet$/i, "");
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Searching SkillNet for: ${skillName}`));
+ const searchPayload = await ctx.request<{ success?: boolean; detail?: string; detail_key?: string; count?: number; skills?: SkillNetItem[] }>(
+ "skills.skillnet.search",
+ { q: skillName, limit: 10 },
+ 60_000,
+ );
+ if (!searchPayload.success || !searchPayload.skills?.length) {
+ ctx.addItem(makeItem(ctx.sessionId, "error",
+ searchPayload.detail || `No matching skills found on SkillNet for: ${skillName}`));
+ return;
+ }
+ // Find exact match by skill_name
+ const exactMatch = searchPayload.skills.find((s) => s.skill_name === skillName);
+ if (!exactMatch) {
+ // No exact match — only show search results, do NOT auto-install
+ const items = searchPayload.skills.map((s) => ({
+ label: s.skill_name || "?",
+ value: s.skill_url,
+ description: `${s.skill_description || "(no description)"} | by ${s.author || "?"} | ⭐${s.stars || 0}`,
+ }));
+ ctx.addItem(makeItem(ctx.sessionId, "info",
+ `No exact match for "${skillName}" on SkillNet. Found ${searchPayload.skills.length} related skills.\n` +
+ `To install, use one of:\n` +
+ ` /skills skillnet install <url>\n` +
+ ` /skills install <exact_skill_name>@skillnet`, "*", { view: "list", title: "SkillNet Search Results", items }));
+ return;
+ }
+ // Exact match found — proceed with install
+ const skillUrl = exactMatch.skill_url;
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Installing from SkillNet: ${exactMatch.skill_name}`));
+ const installPayload = await ctx.request<{ success?: boolean; detail?: string; pending?: boolean; install_id?: string }>(
+ "skills.skillnet.install",
+ { url: skillUrl, force: false },
+ 120_000,
+ );
+ if (!installPayload.success) {
+ if (installPayload.detail?.includes("已存在") || installPayload.detail?.includes("已安装")) {
+ const answers = await ctx.askQuestions([
+ {
+ header: "SkillNet",
+ question: `Skill "${exactMatch.skill_name}" is already installed. Do you want to force overwrite it?`,
+ options: [
+ { label: "Yes, overwrite", description: `Re-install from SkillNet, replacing the existing version` },
+ { label: "No, cancel", description: "Keep the existing skill unchanged" },
+ ],
+ },
+ ]);
+ const selected = answers[0]?.selected_options?.[0];
+ if (selected === "Yes, overwrite") {
+ const forcePayload = await ctx.request<{ success?: boolean; detail?: string; pending?: boolean; install_id?: string }>(
+ "skills.skillnet.install",
+ { url: skillUrl, force: true },
+ 120_000,
+ );
+ if (forcePayload.success && forcePayload.pending && forcePayload.install_id) {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Downloading... (install_id: ${forcePayload.install_id.slice(0, 8)})`));
+ const finalSt = await pollSkillNetInstall(ctx, forcePayload.install_id);
+ if (finalSt.success && finalSt.status === "done") {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill re-installed from SkillNet: ${finalSt.skill?.name || exactMatch.skill_name}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", finalSt.detail || `SkillNet force install failed`));
+ }
+ } else if (forcePayload.success && !forcePayload.pending) {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill re-installed from SkillNet: ${exactMatch.skill_name}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", forcePayload.detail || `SkillNet force install failed`));
+ }
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Installation cancelled. Skill remains unchanged.`));
+ }
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", installPayload.detail || `SkillNet install failed: ${skillUrl}`));
+ }
+ return;
+ }
+ // Async install — poll for completion
+ if (installPayload.pending && installPayload.install_id) {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Downloading... (install_id: ${installPayload.install_id.slice(0, 8)})`));
+ const finalSt = await pollSkillNetInstall(ctx, installPayload.install_id);
+ if (finalSt.success && finalSt.status === "done") {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill installed from SkillNet: ${finalSt.skill?.name || exactMatch.skill_name}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", finalSt.detail || `SkillNet install failed: ${skillUrl}`));
+ }
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill installed from SkillNet: ${exactMatch.skill_name}`));
+ }
+ return;
+ }
+
// Marketplace / builtin install flow
let finalSpec = spec;
// Bare skill name without @ — auto-detect if it's a builtin
@@ -203,9 +419,9 @@ export function createSkillsCommand(): SlashCommand {
},
{
name: "marketplace",
- description: "Manage marketplace sources",
- usage: "/skills marketplace [list|add|remove|toggle]",
- example: "/skills marketplace list",
+ description: "Manage marketplace sources (Git repos) and ClawHub token",
+ usage: "/skills marketplace [list|add|remove|toggle|clawhub]",
+ example: "/skills marketplace list | /skills marketplace clawhub token abc123",
kind: CommandKind.BUILT_IN,
action: async (ctx) => {
await listMarketplaces(ctx);
@@ -303,6 +519,234 @@ export function createSkillsCommand(): SlashCommand {
}
},
},
+ {
+ name: "clawhub",
+ description: "Manage ClawHub token (view or set)",
+ usage: "/skills marketplace clawhub token [value]",
+ example: "/skills marketplace clawhub token abc123 | /skills marketplace clawhub",
+ kind: CommandKind.BUILT_IN,
+ takesArgs: true,
+ action: async (ctx, args) => {
+ const token = args.trim();
+ if (!token) {
+ // View current token status
+ const payload = await ctx.request<{ success?: boolean; token?: string; has_token?: boolean }>(
+ "skills.clawhub.get_token",
+ {},
+ );
+ if (payload.success) {
+ if (payload.has_token) {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `ClawHub token configured: ${payload.token}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "info",
+ `ClawHub token not configured.\n` +
+ `To set your token:\n` +
+ ` /skills marketplace clawhub token <your-token>\n` +
+ `Get your token at: https://clawhub.ai`));
+ }
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", "Failed to check ClawHub token status"));
+ }
+ return;
+ }
+ // Set token
+ const payload = await ctx.request<{ success?: boolean; detail?: string; token?: string }>(
+ "skills.clawhub.set_token",
+ { token },
+ );
+ if (payload.success) {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `ClawHub token saved: ${payload.token || "(masked)"}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", payload.detail || "Failed to save ClawHub token"));
+ }
+ },
+ subCommands: [
+ {
+ name: "token",
+ description: "Set or view ClawHub CLI token",
+ usage: "/skills marketplace clawhub token [value]",
+ example: "/skills marketplace clawhub token abc123 | /skills marketplace clawhub token",
+ kind: CommandKind.BUILT_IN,
+ takesArgs: true,
+ action: async (ctx, args) => {
+ const token = args.trim();
+ if (!token) {
+ const payload = await ctx.request<{ success?: boolean; token?: string; has_token?: boolean }>(
+ "skills.clawhub.get_token",
+ {},
+ );
+ if (payload.success) {
+ if (payload.has_token) {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `ClawHub token configured: ${payload.token}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "info",
+ `ClawHub token not configured.\n` +
+ `To set your token:\n` +
+ ` /skills marketplace clawhub token <your-token>\n` +
+ `Get your token at: https://clawhub.ai`));
+ }
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", "Failed to check ClawHub token status"));
+ }
+ return;
+ }
+ const payload = await ctx.request<{ success?: boolean; detail?: string; token?: string }>(
+ "skills.clawhub.set_token",
+ { token },
+ );
+ if (payload.success) {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `ClawHub token saved: ${payload.token || "(masked)"}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", payload.detail || "Failed to save ClawHub token"));
+ }
+ },
+ },
+ ],
+ },
+ ],
+ },
+ {
+ name: "skillnet",
+ description: "SkillNet online skill registry (search, install)",
+ usage: "/skills skillnet [search|install]",
+ example: "/skills skillnet search code | /skills skillnet install <url>",
+ kind: CommandKind.BUILT_IN,
+ takesArgs: true,
+ action: async (ctx, args) => {
+ const q = args.trim();
+ if (!q) {
+ ctx.addItem(makeItem(ctx.sessionId, "info",
+ `SkillNet — online skill registry (OpenKG/ZJU).\n` +
+ `Search: /skills skillnet search <query>\n` +
+ `Install: /skills skillnet install <skill_url>\n` +
+ `Or use: /skills install <skill_name>@skillnet`));
+ return;
+ }
+ // Default: search
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Searching SkillNet for: ${q}`));
+ const payload = await ctx.request<{ success?: boolean; detail?: string; detail_key?: string; count?: number; skills?: SkillNetItem[] }>(
+ "skills.skillnet.search",
+ { q, limit: 20 },
+ 60_000,
+ );
+ if (payload.success && payload.skills?.length) {
+ const items = payload.skills.map((s) => ({
+ label: s.skill_name || "?",
+ value: s.skill_url,
+ description: `${s.skill_description || "(no description)"} | by ${s.author || "?"} | ⭐${s.stars || 0} | ${s.category || "-"}`,
+ }));
+ ctx.addItem(makeItem(ctx.sessionId, "info", `SkillNet results (${payload.skills.length})`, "*", { view: "list", title: "SkillNet Search Results (use /skills skillnet install <url> to install)", items }));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", payload.detail || `SkillNet search failed: ${q}`));
+ }
+ },
+ subCommands: [
+ {
+ name: "search",
+ description: "Search skills on SkillNet",
+ usage: "/skills skillnet search <query>",
+ example: "/skills skillnet search code-review",
+ kind: CommandKind.BUILT_IN,
+ takesArgs: true,
+ action: async (ctx, args) => {
+ const q = args.trim();
+ if (!q) {
+ ctx.addItem(makeItem(ctx.sessionId, "error", "Usage: /skills skillnet search <query>"));
+ return;
+ }
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Searching SkillNet for: ${q}`));
+ const payload = await ctx.request<{ success?: boolean; detail?: string; detail_key?: string; count?: number; skills?: SkillNetItem[] }>(
+ "skills.skillnet.search",
+ { q, limit: 20 },
+ 60_000,
+ );
+ if (payload.success && payload.skills?.length) {
+ const items = payload.skills.map((s) => ({
+ label: s.skill_name || "?",
+ value: s.skill_url,
+ description: `${s.skill_description || "(no description)"} | by ${s.author || "?"} | ⭐${s.stars || 0} | ${s.category || "-"}`,
+ }));
+ ctx.addItem(makeItem(ctx.sessionId, "info", `SkillNet results (${payload.skills.length})`, "*", { view: "list", title: "SkillNet Search Results (use /skills skillnet install <url> to install)", items }));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", payload.detail || `SkillNet search failed: ${q}`));
+ }
+ },
+ },
+ {
+ name: "install",
+ description: "Install a skill from SkillNet by URL",
+ usage: "/skills skillnet install <skill_url>",
+ example: "/skills skillnet install https://github.com/user/skill-repo",
+ kind: CommandKind.BUILT_IN,
+ takesArgs: true,
+ action: async (ctx, args) => {
+ const url = args.trim();
+ if (!url) {
+ ctx.addItem(makeItem(ctx.sessionId, "error", "Usage: /skills skillnet install <skill_url>"));
+ return;
+ }
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Installing from SkillNet: ${url}`));
+ const installPayload = await ctx.request<{ success?: boolean; detail?: string; pending?: boolean; install_id?: string }>(
+ "skills.skillnet.install",
+ { url, force: false },
+ 120_000,
+ );
+ if (!installPayload.success) {
+ // Skill already installed — ask user if they want to force overwrite
+ if (installPayload.detail?.includes("已存在") || installPayload.detail?.includes("已安装")) {
+ const answers = await ctx.askQuestions([
+ {
+ header: "SkillNet",
+ question: `Skill already exists. Do you want to force overwrite it from SkillNet?`,
+ options: [
+ { label: "Yes, overwrite", description: `Re-install from SkillNet, replacing the existing version` },
+ { label: "No, cancel", description: "Keep the existing skill unchanged" },
+ ],
+ },
+ ]);
+ const selected = answers[0]?.selected_options?.[0];
+ if (selected === "Yes, overwrite") {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Force re-installing from SkillNet: ${url}`));
+ const forcePayload = await ctx.request<{ success?: boolean; detail?: string; pending?: boolean; install_id?: string }>(
+ "skills.skillnet.install",
+ { url, force: true },
+ 120_000,
+ );
+ if (forcePayload.success && forcePayload.pending && forcePayload.install_id) {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Downloading... (install_id: ${forcePayload.install_id.slice(0, 8)})`));
+ const finalSt = await pollSkillNetInstall(ctx, forcePayload.install_id);
+ if (finalSt.success && finalSt.status === "done") {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill re-installed from SkillNet: ${finalSt.skill?.name || url}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", finalSt.detail || `SkillNet force install failed: ${url}`));
+ }
+ } else if (forcePayload.success && !forcePayload.pending) {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill re-installed from SkillNet: ${url}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", forcePayload.detail || `SkillNet force install failed: ${url}`));
+ }
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Installation cancelled. Skill remains unchanged.`));
+ }
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", installPayload.detail || `SkillNet install failed: ${url}`));
+ }
+ return;
+ }
+ // Async install — poll for completion
+ if (installPayload.pending && installPayload.install_id) {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Downloading... (install_id: ${installPayload.install_id.slice(0, 8)})`));
+ const finalSt = await pollSkillNetInstall(ctx, installPayload.install_id);
+ if (finalSt.success && finalSt.status === "done") {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill installed from SkillNet: ${finalSt.skill?.name || url}`));
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "error", finalSt.detail || `SkillNet install failed: ${url}`));
+ }
+ } else {
+ ctx.addItem(makeItem(ctx.sessionId, "info", `Skill installed from SkillNet: ${url}`));
+ }
+ },
+ },
],
},
{