mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-07-23 07:03:51 +08:00
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:
@@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## [2.5.0] - 2026-07-18
|
||||
|
||||
- 创建方式从 HTTP API(`POST /api/agents`)改为 `ManageAgent` 内置工具(实例鉴权上线后 Agent 不再直接访问本机 API)
|
||||
- 补充保留标识(core/desirecore)拒创、config 仅允许 llm 白名单的错误处理说明
|
||||
- 声明 `required_client_version: 10.0.90`
|
||||
|
||||
## [2.4.0] - 2026-02-28
|
||||
|
||||
- 修复响应格式文档,与实际 API 返回对齐(`{ success, agentId, agent }`)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
---
|
||||
name: create-agent
|
||||
description: >-
|
||||
通过多轮对话收集需求,调用 HTTP API 创建新的 AgentFS v2 智能体,支持自定义 persona 和 principles。Use when
|
||||
用户要求创建新智能体、培养某领域助手、或快速基于模板生成可治理 Agent。
|
||||
version: 2.4.2
|
||||
通过多轮对话收集需求,调用 ManageAgent 内置工具创建新的 AgentFS v2 智能体,支持自定义 persona 和 principles。Use when 用户要求创建新智能体、培养某领域助手、或快速基于模板生成可治理 Agent。
|
||||
version: 2.5.0
|
||||
type: meta
|
||||
risk_level: low
|
||||
status: enabled
|
||||
@@ -14,7 +13,7 @@ tags:
|
||||
- meta
|
||||
metadata:
|
||||
author: desirecore
|
||||
updated_at: '2026-02-28'
|
||||
updated_at: '2026-07-18'
|
||||
i18n:
|
||||
default_locale: en-US
|
||||
source_locale: zh-CN
|
||||
@@ -25,19 +24,19 @@ metadata:
|
||||
name: 创建智能体
|
||||
short_desc: 通过自然语言对话收集需求,一键创建专业化数字智能体
|
||||
description: >-
|
||||
通过多轮对话收集需求,调用 HTTP API 创建新的 AgentFS v2 智能体,支持自定义 persona 和 principles。Use when 用户要求创建新智能体、培养某领域助手、或快速基于模板生成可治理 Agent。
|
||||
通过多轮对话收集需求,调用 ManageAgent 内置工具创建新的 AgentFS v2 智能体,支持自定义 persona 和 principles。Use when 用户要求创建新智能体、培养某领域助手、或快速基于模板生成可治理 Agent。
|
||||
body: ./SKILL.zh-CN.md
|
||||
source_hash: sha256:cf21692224334fce
|
||||
source_hash: sha256:43425a25973ca933
|
||||
translated_by: human
|
||||
en-US:
|
||||
name: Create Agent
|
||||
short_desc: Collect requirements through natural-language conversation and create a specialized digital Agent in one step
|
||||
description: >-
|
||||
Collect requirements through multi-turn conversation and call the HTTP API to create a new AgentFS v2 Agent, with customizable persona and principles. Use when the user asks to create a new Agent, raise a domain assistant, or quickly produce a governable Agent from a template.
|
||||
Collect requirements through multi-turn conversation and call the ManageAgent builtin tool to create a new AgentFS v2 Agent, with customizable persona and principles. Use when the user asks to create a new Agent, raise a domain assistant, or quickly produce a governable Agent from a template.
|
||||
body: ./SKILL.md
|
||||
source_hash: sha256:cf21692224334fce
|
||||
translated_by: ai:claude-opus-4-7
|
||||
translated_at: '2026-05-03'
|
||||
source_hash: sha256:43425a25973ca933
|
||||
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
|
||||
@@ -58,19 +57,20 @@ market:
|
||||
verified: true
|
||||
compatible_agents: []
|
||||
channel: latest
|
||||
required_client_version: 10.0.90
|
||||
---
|
||||
|
||||
# create-agent skill
|
||||
|
||||
## L0: One-Sentence Summary
|
||||
|
||||
Collect requirements through natural-language conversation and call the HTTP API to create a specialized digital Agent.
|
||||
Collect requirements through natural-language conversation and call the ManageAgent builtin tool to create a specialized digital Agent.
|
||||
|
||||
## L1: Overview and Use Cases
|
||||
|
||||
### Capability Description
|
||||
|
||||
create-agent is a **Meta-Skill** that gives DesireCore the ability to create other Agents. It collects user requirements through multi-turn conversation, generates persona and principles content, and calls `POST /api/agents` to complete the creation.
|
||||
create-agent is a **Meta-Skill** that gives DesireCore the ability to create other Agents. It collects user requirements through multi-turn conversation, generates persona and principles content, and calls the `ManageAgent` builtin tool to complete the creation.
|
||||
|
||||
### Use Cases
|
||||
|
||||
@@ -95,7 +95,7 @@ create-agent is a **Meta-Skill** that gives DesireCore the ability to create oth
|
||||
│
|
||||
↓
|
||||
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
||||
│ 回执生成 │ ←── │ API 创建 │ ←── │ 用户确认 │
|
||||
│ 回执生成 │ ←── │ 工具创建 │ ←── │ 用户确认 │
|
||||
└──────────────┘ └──────────────┘ └──────────────┘
|
||||
```
|
||||
|
||||
@@ -210,69 +210,58 @@ When the user chooses "Modify":
|
||||
4. Update the corresponding field in the preview
|
||||
5. Show the full preview again → re-enter the confirmation flow
|
||||
|
||||
### Stage 5: Call API to Create
|
||||
### Stage 5: Create via ManageAgent
|
||||
|
||||
**API endpoint**: `POST /api/agents`
|
||||
**Tool call** (structured format):
|
||||
|
||||
**Request body** (structured format):
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "法律顾问小助手",
|
||||
"description": "专注于合同审查和法律风险评估的数字智能体",
|
||||
```
|
||||
ManageAgent({
|
||||
"action": "create",
|
||||
"name": "Legal Advisor Assistant",
|
||||
"description": "A digital Agent focused on contract review and legal risk assessment",
|
||||
"persona": {
|
||||
"L0": "你是法律顾问小助手,专注于合同审查和法律风险评估的数字智能体。",
|
||||
"L0": "You are Legal Advisor Assistant, a digital Agent focused on contract review and legal risk assessment.",
|
||||
"L1": {
|
||||
"role": "专注于合同审查和法律风险评估的数字法律顾问",
|
||||
"personality": ["专业", "严谨", "审慎"],
|
||||
"communication_style": "准确使用法律术语,同时提供通俗解释"
|
||||
"role": "A digital legal advisor focused on contract review and legal risk assessment",
|
||||
"personality": ["Professional", "Rigorous", "Prudent"],
|
||||
"communication_style": "Use legal terminology accurately while also providing plain-language explanations"
|
||||
}
|
||||
},
|
||||
"principles": {
|
||||
"L0": "以用户利益为最高优先级,不替代正式法律意见。",
|
||||
"L0": "User interest is the highest priority; not a substitute for formal legal advice.",
|
||||
"L1": {
|
||||
"must_do": ["准确引用法律条文", "标注不确定性", "建议咨询专业律师"],
|
||||
"must_not": ["提供诉讼代理", "替代正式法律意见", "泄露用户法律咨询内容"],
|
||||
"priority": "用户安全 > 准确性 > 效率"
|
||||
"must_do": ["Cite statutes accurately", "Mark uncertainty", "Recommend consulting a professional lawyer"],
|
||||
"must_not": ["Provide litigation representation", "Substitute for formal legal advice", "Leak user consultations"],
|
||||
"priority": "User safety > Accuracy > Efficiency"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
**Minimal create** (only `name`; the rest is auto-generated):
|
||||
|
||||
```json
|
||||
{ "name": "我的助手" }
|
||||
```
|
||||
ManageAgent({ "action": "create", "name": "My Assistant" })
|
||||
```
|
||||
|
||||
**Basic create** (`name` + `description`; `description` auto-fills persona L0):
|
||||
|
||||
```json
|
||||
{ "name": "法律顾问", "description": "专注合同审查" }
|
||||
```
|
||||
ManageAgent({ "action": "create", "name": "Legal Advisor", "description": "Focused on contract review" })
|
||||
```
|
||||
|
||||
Any unprovided fields are auto-filled with sensible defaults by the system. `persona` and `principles` also accept raw markdown strings (backward compatible).
|
||||
|
||||
**Optional**: To specify a slug ID, generate a sensible kebab-case slug from `name` (e.g. "Legal Advisor" → "legal-advisor") and include `"id": "<slug>"` in the request body. If not specified, the system auto-generates one from `name`.
|
||||
**Optional parameters**:
|
||||
|
||||
**Successful response** (`201 Created`):
|
||||
- `id`: specify a kebab-case slug ID (e.g. "Legal Advisor" → "legal-advisor"). If not specified, the system auto-generates one from `name`. Note that `core` / `desirecore` are reserved core-agent identifiers and cannot be used (including when the slug auto-generated from `name` collides with them).
|
||||
- `config`: an agent.json config delta. Only the `llm` field is allowed (model, temperature, etc.); sensitive fields such as `mcp_servers` / `tool_permissions` are rejected and must be adjusted via the settings UI after creation.
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"agentId": "fa-lv-gu-wen-xiao-zhu-shou",
|
||||
"agent": {
|
||||
"id": "fa-lv-gu-wen-xiao-zhu-shou",
|
||||
"name": "法律顾问小助手",
|
||||
"description": "专注于合同审查和法律风险评估的数字智能体",
|
||||
"skillsCount": 0,
|
||||
"toolsCount": 0,
|
||||
"status": "offline"
|
||||
}
|
||||
}
|
||||
```
|
||||
**Successful result**:
|
||||
|
||||
The `agent` field in the response contains the full info of the newly created Agent and can be used directly in the receipt.
|
||||
> Agent "Legal Advisor Assistant" created (ID: legal-advisor-assistant), registered and ready. It can be used directly with ManageTeam or Delegate.
|
||||
|
||||
The new Agent is registered online immediately after creation—no waiting or refresh needed; the returned ID can be used directly in subsequent ManageTeam / Delegate calls.
|
||||
|
||||
### Stage 6: Receipt Generation
|
||||
|
||||
@@ -294,19 +283,18 @@ After successful creation, present the receipt in a user-friendly way (do not ex
|
||||
|
||||
### Error Handling
|
||||
|
||||
| Error Code | Scenario | Handling |
|
||||
| ---------- | ------------------------------------- | --------------------------------- |
|
||||
| 400 | Missing `name` or invalid ID format | Ask user to check input |
|
||||
| 409 | Agent ID already exists | Suggest using another name |
|
||||
| 500 | Internal server error | Ask user to try again later |
|
||||
| Error Scenario | Handling |
|
||||
| ------------------------------------------- | ------------------------------------------- |
|
||||
| Missing `name` or invalid ID format | Ask user to check input |
|
||||
| Agent ID already exists | Suggest another name or an explicit `id` |
|
||||
| ID hits a reserved core-agent identifier | Change the name or provide another `id` |
|
||||
| `config` contains non-whitelisted fields | Retry with only the `llm` field |
|
||||
|
||||
### Permission Requirements
|
||||
|
||||
- Prefer accessing the Agent Service HTTP API via the `Bash` tool with curl
|
||||
- The API base URL is already injected into the "Local API" section of the system prompt; reference it directly
|
||||
- Creation requires user confirmation
|
||||
- Always create via the `ManageAgent` builtin tool. **Never** call the local HTTP API, curl, or write AgentFS directories directly
|
||||
- The `create` action is exempt from system approval, but this skill's conversation flow still requires showing the preview and getting user confirmation first (Stage 4)
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Agent Service HTTP API (`POST /api/agents`)
|
||||
- The local API URL declaration in the system prompt
|
||||
- `ManageAgent` builtin tool (client ≥ 10.0.90)
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
## L0:一句话摘要
|
||||
|
||||
通过自然语言对话收集需求,调用 HTTP API 创建专业化的数字智能体。
|
||||
通过自然语言对话收集需求,调用 ManageAgent 内置工具创建专业化的数字智能体。
|
||||
|
||||
## L1:概述与使用场景
|
||||
|
||||
### 能力描述
|
||||
|
||||
create-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 创建其他 Agent 的能力。它通过多轮对话收集用户需求,生成 persona 和 principles 内容,调用 `POST /api/agents` 完成创建。
|
||||
create-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 创建其他 Agent 的能力。它通过多轮对话收集用户需求,生成 persona 和 principles 内容,调用 `ManageAgent` 内置工具完成创建。
|
||||
|
||||
### 使用场景
|
||||
|
||||
@@ -35,7 +35,7 @@ create-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 创建
|
||||
│
|
||||
↓
|
||||
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
||||
│ 回执生成 │ ←── │ API 创建 │ ←── │ 用户确认 │
|
||||
│ 回执生成 │ ←── │ 工具创建 │ ←── │ 用户确认 │
|
||||
└──────────────┘ └──────────────┘ └──────────────┘
|
||||
```
|
||||
|
||||
@@ -150,14 +150,13 @@ create-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 创建
|
||||
4. 更新预览中的对应字段
|
||||
5. 再次展示完整预览 → 重新进入确认流程
|
||||
|
||||
### 阶段 5:调用 API 创建
|
||||
### 阶段 5:调用 ManageAgent 创建
|
||||
|
||||
**API 端点**:`POST /api/agents`
|
||||
**工具调用**(结构化格式):
|
||||
|
||||
**请求体**(结构化格式):
|
||||
|
||||
```json
|
||||
{
|
||||
```
|
||||
ManageAgent({
|
||||
"action": "create",
|
||||
"name": "法律顾问小助手",
|
||||
"description": "专注于合同审查和法律风险评估的数字智能体",
|
||||
"persona": {
|
||||
@@ -176,43 +175,33 @@ create-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 创建
|
||||
"priority": "用户安全 > 准确性 > 效率"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
**最简创建**(只需 name,其余全部自动生成):
|
||||
|
||||
```json
|
||||
{ "name": "我的助手" }
|
||||
```
|
||||
ManageAgent({ "action": "create", "name": "我的助手" })
|
||||
```
|
||||
|
||||
**基础创建**(name + description,description 自动填充 persona L0):
|
||||
|
||||
```json
|
||||
{ "name": "法律顾问", "description": "专注合同审查" }
|
||||
```
|
||||
ManageAgent({ "action": "create", "name": "法律顾问", "description": "专注合同审查" })
|
||||
```
|
||||
|
||||
所有未提供的字段由系统自动补全为合理默认值。`persona` 和 `principles` 也支持传入原始 markdown 字符串(向后兼容)。
|
||||
|
||||
**可选**:如需指定 slug ID,可根据 name 生成合理的 kebab-case slug(如 "法律顾问" → "legal-advisor"),在请求体中附带 `"id": "<slug>"`。不指定时系统会自动从 name 生成。
|
||||
**可选参数**:
|
||||
|
||||
**成功响应** (`201 Created`):
|
||||
- `id`:指定 kebab-case slug ID(如 "法律顾问" → "legal-advisor")。不指定时系统会自动从 name 生成。注意 `core` / `desirecore` 是核心智能体保留标识,不可使用(包括 name 自动生成命中的情况)。
|
||||
- `config`:agent.json 配置增量,仅允许 `llm` 字段(模型、温度等);mcp_servers/tool_permissions 等敏感配置会被拒绝,需在创建后经配置界面调整。
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"agentId": "fa-lv-gu-wen-xiao-zhu-shou",
|
||||
"agent": {
|
||||
"id": "fa-lv-gu-wen-xiao-zhu-shou",
|
||||
"name": "法律顾问小助手",
|
||||
"description": "专注于合同审查和法律风险评估的数字智能体",
|
||||
"skillsCount": 0,
|
||||
"toolsCount": 0,
|
||||
"status": "offline"
|
||||
}
|
||||
}
|
||||
```
|
||||
**成功返回**:
|
||||
|
||||
响应中的 `agent` 字段包含创建后的智能体完整信息,可直接用于回执展示。
|
||||
> 智能体「法律顾问小助手」已创建 (ID: fa-lv-gu-wen-xiao-zhu-shou),已注册可用。可直接用于 ManageTeam 组队或 Delegate 委派。
|
||||
|
||||
创建完成后智能体立即注册在线,无需等待或刷新;返回的 ID 可直接用于后续 ManageTeam / Delegate 调用。
|
||||
|
||||
### 阶段 6:回执生成
|
||||
|
||||
@@ -234,19 +223,18 @@ create-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 创建
|
||||
|
||||
### 错误处理
|
||||
|
||||
| 错误码 | 场景 | 处理方式 |
|
||||
| ------ | ------------------------ | ---------------- |
|
||||
| 400 | 缺少 name 或 ID 格式无效 | 提示用户检查输入 |
|
||||
| 409 | Agent ID 已存在 | 建议使用其他名称 |
|
||||
| 500 | 服务器内部错误 | 提示用户稍后再试 |
|
||||
| 错误场景 | 处理方式 |
|
||||
| -------------------------------- | ------------------------------ |
|
||||
| 缺少 name 或 ID 格式无效 | 提示用户检查输入 |
|
||||
| Agent ID 已存在(already exists)| 建议使用其他名称或指定其他 id |
|
||||
| ID 命中核心智能体保留标识 | 更换名称或显式提供其他 id |
|
||||
| config 含白名单外字段 | 仅保留 llm 字段后重试 |
|
||||
|
||||
### 权限要求
|
||||
|
||||
- 建议优先通过 `Bash` 工具调用 curl 访问 Agent Service HTTP API 完成操作
|
||||
- API 基础地址已注入到 system prompt 的「本机 API」小节,直接引用即可
|
||||
- 创建操作需要用户确认
|
||||
- 一律通过 `ManageAgent` 内置工具完成创建,**禁止**调用本机 HTTP API、curl 或直接写 AgentFS 目录
|
||||
- create 操作免系统审批,但本技能的对话流程仍要求先向用户展示预览并获得确认(阶段 4)
|
||||
|
||||
### 依赖
|
||||
|
||||
- Agent Service HTTP API(`POST /api/agents`)
|
||||
- System prompt 中的本机 API 地址声明
|
||||
- `ManageAgent` 内置工具(客户端 ≥ 10.0.90)
|
||||
|
||||
Reference in New Issue
Block a user