feat(skills): 智能体 CRUD 四技能改经 ManageAgent 内置工具(实例鉴权适配) (#52)

## 摘要 / Summary

### 中文

主仓库 desirecore#1225 新增 `ManageAgent` 内置工具后,智能体 CRUD 四技能从"调本机 HTTP
API/curl"改写为调用该工具(实例鉴权上线后 Agent 直接访问本机 API 会 401):

- **create-agent 2.5.0**:`POST /api/agents` →
`ManageAgent(action='create', ...)`;补充保留标识(core/desirecore)拒创、config 仅允许
llm 白名单的错误处理
- **delete-agent 2.5.0**:`DELETE /api/agents/:id` →
`action='delete'`(工具层强制用户确认);错误处理改为工具拒绝语义(核心智能体/自删/活跃状态);补团队级联说明
- **discover-agent 2.6.0**:`GET /api/agents(/:id)` →
`action='list'/'get'`
- **update-agent
3.1.0**:结构化字段(name/description/llm/persona/principles)改经
`action='update'`(白名单+schema 校验+字段级合并语义),自由格式文件仍 Read/Write

四技能声明 `market.required_client_version:
10.0.90`,老客户端在市场端被门控禁装。中英双语正文同步改写,i18n source_hash 已重算(validate-i18n.py
通过);manifest 1.2.10。

### English

After desirecore#1225 shipped the `ManageAgent` builtin tool, the four
agent-CRUD skills are rewritten from local-HTTP-API/curl instructions to
tool calls (direct local API access now returns 401 under instance
auth). Each skill declares `market.required_client_version: 10.0.90` so
older clients are gated from installing. Both locales are rewritten in
sync and i18n source hashes recomputed (validate-i18n.py passes);
manifest bumped to 1.2.10.

主仓库回填:合并后将在 desirecore 主仓库执行 `npm run sync-market` 生成新的
defaults/market.zip 并单独提 PR。
This commit is contained in:
2026-07-18 23:05:18 +08:00
committed by GitHub
parent ea07d05550
commit 1c00b8e6c8
13 changed files with 524 additions and 408 deletions

View File

@@ -1,5 +1,10 @@
# Changelog
## [2.6.0] - 2026-07-18
- HTTP API 调用改为 ManageAgent 内置工具(实例鉴权后 Agent 不再直接访问本机 API
- 声明 required_client_version 10.0.90
## [2.4.0] - 2026-02-28
- 补充"了解更多"的具体 API 实现GET /api/agents/:id + 结构化 persona 端点)

View File

@@ -1,7 +1,7 @@
---
name: discover-agent
description: 根据用户需求推荐最匹配的智能体展示候选列表并引导选择。Use when 用户描述需求但不确定该找哪个智能体帮忙,或想浏览可用的智能体。
version: 2.5.2
version: 2.6.0
type: procedural
risk_level: low
status: enabled
@@ -12,7 +12,7 @@ tags:
- recommendation
metadata:
author: desirecore
updated_at: '2026-02-28'
updated_at: '2026-07-18'
i18n:
default_locale: en-US
source_locale: zh-CN
@@ -24,7 +24,7 @@ metadata:
short_desc: 根据需求描述智能推荐最匹配的智能体,引导快速选择
description: 根据用户需求推荐最匹配的智能体展示候选列表并引导选择。Use when 用户描述需求但不确定该找哪个智能体帮忙,或想浏览可用的智能体。
body: ./SKILL.zh-CN.md
source_hash: sha256:28ecd07724adda9a
source_hash: sha256:99bddbbaea15b194
translated_by: human
en-US:
name: Discover Agent
@@ -32,9 +32,9 @@ metadata:
description: >-
Recommend the best-matching Agent based on the users needs, show a candidate list, and guide selection. Use when the user describes a need but is unsure which Agent to ask for help, or wants to browse available Agents.
body: ./SKILL.md
source_hash: sha256:4be238743dee6fc4
translated_by: ai:openai:gpt-5.4-mini
translated_at: '2026-07-07'
source_hash: sha256:99bddbbaea15b194
translated_by: ai:claude-fable-5
translated_at: '2026-07-18'
market:
icon: >-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0
@@ -53,6 +53,7 @@ market:
verified: true
compatible_agents: []
channel: latest
required_client_version: 10.0.90
---
# discover-agent Skill
@@ -118,25 +119,26 @@ Extract the following dimensions from the users description:
### Stage 2: Agent retrieval
**Data source**: Call `GET /api/agents` to get the list of all registered Agents.
**Data source**: Call `ManageAgent(action='list')` to get the list of all registered Agents.
**API call**:
**Tool call**:
```bash
GET /api/agents
```
ManageAgent(action='list')
```
**Key fields in the returned data**:
**Returned content**: a compact list where each line contains the following key fields:
- `id` — unique Agent identifier
- `name` — Agent name
- `id` — unique Agent identifier
- `status` — current status (online/busy/idle/offline)
- `description` — Agent description
- `skills` — Skill list
- `status` — current status (online/offline/busy)
> `list` is a read-only query; no user confirmation is required and it is approval-free.
**Filtering rules**:
- By default, only show Agents with `status: online` or `status: offline`
- By default, show Agents other than offline ones; offline Agents are shown only as a supplement when no better candidate is available
- Exclude internal system Agents (such as DesireCore itself, unless explicitly requested by the user)
### Stage 3: Matching evaluation
@@ -227,23 +229,26 @@ A total of 4 Agents. Do you need detailed information about any one Agent?
| User choice | Follow-up action |
| ----------- | ---------------- |
| Chose an Agent | Switch to that Agents conversation and pass the user need context |
| Asked for more details | Call `GET /api/agents/:id` to get details, then show structured information (see below) |
| Asked for more details | Call `ManageAgent(action='get', id='<agent-id>')` to get details, then show structured information (see below) |
| Unsatisfied with candidates | Guide the user to refine the need or suggest creating a new Agent |
| Chose "create a new one" | Call the create-agent Skill and pass the collected need information |
**Implementation of "learn more"**:
Call `GET /api/agents/:id` to get details, and optionally call the structured endpoint to get persona/rules:
Call `ManageAgent(action='get', id='<agent-id>')` to get details of the specified Agent:
```bash
# Get basic information
GET /api/agents/{agentId}
# Return: { id, name, description, skillsCount, toolsCount, status, config, persona, principles }
# Get structured persona (optional, used to show richer information)
GET /api/agents/{agentId}/persona
# Return: { L0, L1: { role, personality, communication_style }, L2 }
```
ManageAgent(action='get', id='legal-assistant')
```
**Key fields in the returned content**:
- name, description, status
- version
- skill count / tool count
- Git repository status
> `get` is a read-only query; no user confirmation is required and it is approval-free. If the target does not exist, it returns the error "智能体不存在: <id>".
When presenting to the user, show key information in natural language/table format:
@@ -252,10 +257,11 @@ When presenting to the user, show key information in natural language/table form
| 字段 | 内容 |
|------|------|
| Role positioning | 专注合同审查和法律风险评估 |
| Personality traits | 专业、严谨、审慎 |
| Skill count | 3 个 |
| Current status | 在线 |
| 描述 | 专注合同审查和法律风险评估 |
| 当前状态 | 在线 |
| 版本 | 1.2.0 |
| 技能 / 工具 | 3 个技能5 个工具 |
| Git 仓库 | 干净(无未提交变更) |
Need to talk with this Agent?
```
@@ -280,18 +286,17 @@ context_handoff:
| Error scenario | Handling method |
| -------------- | --------------- |
| API call failure | Prompt a network error and suggest trying again later |
| Tool call failure | Prompt the error message and suggest trying again later |
| Agent list is empty | Guide the user to create the first Agent |
| User description is too vague | Ask follow-up questions and provide domain options as guidance |
| Target Agent does not exist | When `get` returns "智能体不存在: <id>", fall back to `list` to re-confirm available Agents |
| Recommended Agent has an abnormal status | Mark the status and suggest choosing another online Agent |
### Permission requirements
- Prefer using the `Bash` Tool to call curl and access the Agent Service HTTP API to complete operations
- The API base address is injected into the system prompts "本机 API" section, so reference it directly
- Read-only operation, no risk
- Complete Agent retrieval and detail lookup via the built-in tool `ManageAgent`
- Both `list` and `get` are read-only queries; no user confirmation is required, they are approval-free, and carry no risk
### Dependencies
- Agent Service HTTP API (`GET /api/agents`)
- The local API address declaration in the system prompt
- Built-in tool `ManageAgent` (`action='list'` to retrieve the list, `action='get'` to query details)

View File

@@ -63,25 +63,26 @@ discover-agent 是一个**流程型技能Procedural Skill**,赋予 Desir
### 阶段 2Agent 检索
**数据源**:调用 `GET /api/agents` 获取所有已注册的智能体列表。
**数据源**:调用 `ManageAgent(action='list')` 获取所有已注册的智能体列表。
**API 调用**
**工具调用**
```bash
GET /api/agents
```
ManageAgent(action='list')
```
**返回数据中的关键字段**
**返回内容**:一份紧凑列表,每行包含以下关键字段
- `id` — 智能体唯一标识
- `name` — 智能体名称
- `id` — 智能体唯一标识
- `status` — 当前状态online/busy/idle/offline
- `description` — 智能体描述
- `skills` — 技能列表
- `status` — 当前状态online/offline/busy
> `list` 为只读查询,无需用户确认、免审批。
**过滤规则**
- 默认展示 `status: online``status: offline` 的智能体
- 默认展示除 offline 之外的智能体offline 智能体仅在无更优候选时作为补充展示
- 排除系统内部智能体(如 DesireCore 自身,除非用户显式要求)
### 阶段 3匹配评估
@@ -169,26 +170,29 @@ GET /api/agents
**用户选择后的操作**
| 用户选择 | 后续操作 |
| ---------------- | ------------------------------------------------------------- |
| 选择了某个智能体 | 切换到该智能体的对话,传递用户需求上下文 |
| 要求了解更多 | 调用 `GET /api/agents/:id` 获取详情,展示结构化信息(见下方) |
| 不满意候选 | 引导用户细化需求或建议创建新 Agent |
| 选择"创建新的" | 调用 create-agent 技能,传递已收集的需求信息 |
| 用户选择 | 后续操作 |
| ---------------- | ----------------------------------------------------------------- |
| 选择了某个智能体 | 切换到该智能体的对话,传递用户需求上下文 |
| 要求了解更多 | 调用 `ManageAgent(action='get', id='<agent-id>')` 获取详情,展示结构化信息(见下方) |
| 不满意候选 | 引导用户细化需求或建议创建新 Agent |
| 选择"创建新的" | 调用 create-agent 技能,传递已收集的需求信息 |
**"了解更多"的实现**
调用 `GET /api/agents/:id` 获取详情,并可选调用结构化端点获取人格/规则
调用 `ManageAgent(action='get', id='<agent-id>')` 获取指定智能体的详情
```bash
# 获取基本信息
GET /api/agents/{agentId}
# 返回: { id, name, description, skillsCount, toolsCount, status, config, persona, principles }
# 获取结构化 persona可选用于展示更丰富的信息
GET /api/agents/{agentId}/persona
# 返回: { L0, L1: { role, personality, communication_style }, L2 }
```
ManageAgent(action='get', id='legal-assistant')
```
**返回内容中的关键字段**
- 名称、描述、状态
- 版本
- 技能数 / 工具数
- Git 仓库状态
> `get` 为只读查询,无需用户确认、免审批。目标不存在时返回错误「智能体不存在: <id>」。
向用户展示时,以自然语言/表格形式呈现关键信息:
@@ -197,10 +201,11 @@ GET /api/agents/{agentId}/persona
| 字段 | 内容 |
|------|------|
| 角色定位 | 专注合同审查和法律风险评估 |
| 性格特征 | 专业、严谨、审慎 |
| 技能数量 | 3 个 |
| 描述 | 专注合同审查和法律风险评估 |
| 当前状态 | 在线 |
| 版本 | 1.2.0 |
| 技能 / 工具 | 3 个技能5 个工具 |
| Git 仓库 | 干净(无未提交变更) |
需要与这个智能体对话吗?
```
@@ -225,18 +230,17 @@ context_handoff:
| 错误场景 | 处理方式 |
| --------------------- | -------------------------------- |
| API 调用失败 | 提示网络错误,建议稍后重试 |
| 工具调用失败 | 提示错误信息,建议稍后重试 |
| Agent 列表为空 | 引导用户创建第一个智能体 |
| 用户描述过于模糊 | 追问具体需求,提供领域选项引导 |
| 目标智能体不存在 | `get` 返回「智能体不存在: <id>」时,回退到 `list` 重新确认可用智能体 |
| 推荐的 Agent 状态异常 | 标注状态,建议选择其他在线 Agent |
### 权限要求
- 建议优先通过 `Bash` 工具调用 curl 访问 Agent Service HTTP API 完成操作
- API 基础地址已注入到 system prompt 的「本机 API」小节直接引用即可
- 只读操作,无风险
- 通过内置工具 `ManageAgent` 完成智能体检索与详情查询
- `list` / `get` 均为只读查询,无需用户确认、免审批,无风险
### 依赖
- Agent Service HTTP API`GET /api/agents`
- System prompt 中的本机 API 地址声明
- 内置工具 `ManageAgent``action='list'` 检索列表、`action='get'` 查询详情)