mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-07-23 08:43:45 +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,13 @@
|
||||
# Changelog
|
||||
|
||||
## [2.5.0] - 2026-07-18
|
||||
|
||||
- HTTP API 调用改为 ManageAgent 内置工具(实例鉴权后 Agent 不再直接访问本机 API,会 401)
|
||||
- 删除路径改为 `ManageAgent(action='delete', id, deleteRuns)`;列出/查详情改为 `action='list' | 'get'`
|
||||
- 错误处理由 HTTP 状态码改为工具返回的拒绝语义(核心智能体/自删/活跃状态/不存在)
|
||||
- 补充团队级联说明(组长删除→解散、成员删除→移除)
|
||||
- 声明 required_client_version 10.0.90
|
||||
|
||||
## [2.4.0] - 2026-02-28
|
||||
|
||||
- 统一 frontmatter 字段顺序,与其他三个技能一致
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: delete-agent
|
||||
description: 安全删除指定的智能体及其关联数据。删除前会验证智能体状态,支持可选地删除所有会话历史。Use when 用户需要删除不再使用的智能体。
|
||||
version: 2.4.2
|
||||
version: 2.5.0
|
||||
type: meta
|
||||
risk_level: high
|
||||
status: enabled
|
||||
@@ -12,7 +12,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
|
||||
@@ -24,16 +24,16 @@ metadata:
|
||||
short_desc: 安全删除智能体及其关联数据,支持多重确认与可选历史清理
|
||||
description: 安全删除指定的智能体及其关联数据。删除前会验证智能体状态,支持可选地删除所有会话历史。Use when 用户需要删除不再使用的智能体。
|
||||
body: ./SKILL.zh-CN.md
|
||||
source_hash: sha256:148cd72a6808741e
|
||||
source_hash: sha256:6b971559e1d4ccc0
|
||||
translated_by: human
|
||||
en-US:
|
||||
name: Delete Agent
|
||||
short_desc: Safely delete an Agent and its associated data, with multi-step confirmation and optional history cleanup
|
||||
description: Safely delete a specified Agent and its associated data. Verifies the Agent's state before deletion and optionally removes all session history. Use when the user needs to delete an Agent that is no longer in use.
|
||||
body: ./SKILL.md
|
||||
source_hash: sha256:148cd72a6808741e
|
||||
translated_by: ai:claude-opus-4-7
|
||||
translated_at: '2026-05-03'
|
||||
source_hash: sha256:6b971559e1d4ccc0
|
||||
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
|
||||
@@ -52,6 +52,7 @@ market:
|
||||
verified: true
|
||||
compatible_agents: []
|
||||
channel: latest
|
||||
required_client_version: 10.0.90
|
||||
---
|
||||
|
||||
# delete-agent Skill
|
||||
@@ -64,7 +65,7 @@ Safely delete a specified Agent and its associated data, including filesystem, i
|
||||
|
||||
### Capability Description
|
||||
|
||||
delete-agent is a **Meta-Skill** that empowers DesireCore to safely delete other Agents. It performs full pre-flight checks and state validation, and cleans up all associated data.
|
||||
delete-agent is a **Meta-Skill** that empowers DesireCore to safely delete other Agents. It runs full pre-flight checks and state validation through the in-process builtin tool **ManageAgent**, and cleans up all associated data.
|
||||
|
||||
### Use Cases
|
||||
|
||||
@@ -75,8 +76,8 @@ delete-agent is a **Meta-Skill** that empowers DesireCore to safely delete other
|
||||
|
||||
### Core Value
|
||||
|
||||
- **Safety**: multiple checks ensure that active Agents are not accidentally deleted
|
||||
- **Completeness**: cleans up filesystem, in-memory state, message subscriptions, and all associated data
|
||||
- **Safety**: multiple rejection rules at the tool layer ensure that core Agents, the caller itself, or active Agents are never deleted by mistake
|
||||
- **Completeness**: cleans up filesystem, in-memory state, message subscriptions, and all associated data, and handles team cascading
|
||||
- **Recoverability**: session history is preserved by default, with the option to delete it
|
||||
|
||||
## L2: Detailed Specification
|
||||
@@ -92,8 +93,9 @@ delete-agent is a **Meta-Skill** that empowers DesireCore to safely delete other
|
||||
│
|
||||
↓
|
||||
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
||||
│ Return result│ ←── │ Execute the │ ←── │ Final │
|
||||
│ and receipt │ │ delete API │ │ confirmation │
|
||||
│ Return result│ ←── │ Execute │ ←── │ Inform that │
|
||||
│ and receipt │ │ ManageAgent │ │ a popup will│
|
||||
│ │ │ │ │ appear │
|
||||
└──────────────┘ └──────────────┘ └──────────────┘
|
||||
```
|
||||
|
||||
@@ -103,9 +105,10 @@ delete-agent is a **Meta-Skill** that empowers DesireCore to safely delete other
|
||||
|
||||
**Operation**:
|
||||
|
||||
- Call `GET /api/agents` to fetch the list of all Agents
|
||||
- Call `ManageAgent(action='list')` to fetch the list of all Agents
|
||||
- Filter Agents whose status is `offline` or `error` (safe to delete)
|
||||
- Annotate Agents whose status is `online`/`busy`/`recovery` (must be stopped first)
|
||||
- Annotate Agents whose status is `online`/`busy`/`recovery` (must be stopped first, otherwise the tool will reject them)
|
||||
- To view detailed information about a specific Agent, call `ManageAgent(action='get', id='<agent-id>')`
|
||||
|
||||
**Output example**:
|
||||
|
||||
@@ -150,57 +153,35 @@ Default option: No (keep history)
|
||||
**Parameter mapping**:
|
||||
|
||||
- User chooses "Yes" → `deleteRuns=true`
|
||||
- User chooses "No" → `deleteRuns=false` (default)
|
||||
- User chooses "No" → `deleteRuns=false` (default, can be omitted)
|
||||
|
||||
### Phase 4: Final Confirmation
|
||||
### Phase 4: Inform About the Tool-level Confirmation
|
||||
|
||||
**Confirmation summary**:
|
||||
The delete action of `ManageAgent` **always triggers a user confirmation popup at the tool layer**, so there is no need to repeat a second confirmation prompt at the skill layer. However, before the call you should inform the user:
|
||||
|
||||
```
|
||||
Please confirm the deletion:
|
||||
- Target Agent: Legal Advisor Assistant (legal-assistant)
|
||||
- Scope: Agent + session history (if chosen by the user)
|
||||
- Risk level: High (irreversible)
|
||||
|
||||
Confirm and execute deletion? (yes/no)
|
||||
About to delete the Agent "Legal Advisor Assistant" (legal-assistant), with a scope of the Agent + session history (if chosen by the user).
|
||||
The system will show a confirmation window; please confirm the execution in the popup.
|
||||
```
|
||||
|
||||
### Phase 5: Execute the Delete API Call
|
||||
### Phase 5: Execute the Deletion (ManageAgent tool)
|
||||
|
||||
**API endpoint**: `DELETE /api/agents/{agentId}`
|
||||
**Tool call**:
|
||||
|
||||
**Query parameters**:
|
||||
|
||||
- `deleteRuns`: `'true'` or `'false'`
|
||||
|
||||
**Request example**:
|
||||
|
||||
```bash
|
||||
curl -X DELETE "{agentServiceUrl}/api/agents/legal-assistant?deleteRuns=true"
|
||||
```
|
||||
ManageAgent(action='delete', id='legal-assistant', deleteRuns=true)
|
||||
```
|
||||
|
||||
> `{agentServiceUrl}` is taken from the Agent Service address in the "Local API" section of the system prompt.
|
||||
**Parameters**:
|
||||
|
||||
- `id`: the target Agent ID (required)
|
||||
- `deleteRuns`: `true` to also delete all session history; `false` (default) to keep history, can be omitted
|
||||
|
||||
The tool shows a user confirmation popup before executing; once confirmed, it completes the deletion, including team cascading: a team where the target is the leader is automatically disbanded, and a target that is a member is automatically removed.
|
||||
|
||||
### Phase 6: Return the Operation Result
|
||||
|
||||
**Successful response handling**:
|
||||
|
||||
```json
|
||||
{
|
||||
"deleted": true,
|
||||
"cleanedPaths": [
|
||||
"/Users/xxx/.desirecore/agents/legal-assistant",
|
||||
"/Users/xxx/.desirecore/users/xxx/agents/legal-assistant"
|
||||
],
|
||||
"deletedRunsCount": 5,
|
||||
"memoryCleaned": {
|
||||
"scheduler": true,
|
||||
"queue": 0,
|
||||
"messaging": 3,
|
||||
"mcp": true
|
||||
}
|
||||
}
|
||||
```
|
||||
**Successful receipt handling**: the tool returns the deletion result, including fields such as the cleaned paths, the number of deleted sessions, and in-memory state cleanup details. Generate the report from these.
|
||||
|
||||
**Result report template**:
|
||||
|
||||
@@ -213,37 +194,32 @@ Cleanup details:
|
||||
- Message subscriptions: 3 subscriptions canceled
|
||||
- MCP connection: closed
|
||||
- Session history: 5 records deleted
|
||||
- Team cascading: the target's team has been disbanded / the target has been removed from its team (if applicable)
|
||||
```
|
||||
|
||||
## State Validation and Error Handling
|
||||
|
||||
### Pre-deletion State Check
|
||||
|
||||
When listing Agents in Phase 1, filter status via `GET /api/agents`:
|
||||
When listing Agents in Phase 1, filter by the status returned from `ManageAgent(action='list')`:
|
||||
|
||||
| Status | Deletable? | Phase 1 Display |
|
||||
| ------------------------------ | ----------- | ------------------------------ |
|
||||
| `offline` / `error` | ✅ Yes | Listed under "Deletable" |
|
||||
| `online` / `busy` / `recovery` | ❌ Stop first | Annotated "must be stopped"; not entered into the subsequent flow |
|
||||
|
||||
**How to stop an active Agent**: send the `agent:shutdown` event via Socket.IO:
|
||||
> Agents in an active state (online/busy/recovery) are directly rejected by the delete action of `ManageAgent`. Prompt the user to stop the Agent manually in the UI, or wait until it finishes its current task before deleting.
|
||||
|
||||
```yaml
|
||||
event: agent:shutdown
|
||||
data: { 'agentId': '<agent_id>' }
|
||||
effect: abort all active sessions → stop scheduled tasks → status becomes offline
|
||||
```
|
||||
### Error Semantics Returned by the Tool
|
||||
|
||||
> The Agent cannot directly send Socket.IO events. If the target Agent is active, prompt the user to stop it manually in the UI, or wait until it finishes its current task before deleting.
|
||||
`ManageAgent(action='delete', ...)` returns a clear error in the following cases; use them to explain the situation to the user and suggest next steps:
|
||||
|
||||
### API Error Codes
|
||||
|
||||
| Code | Scenario | Handling |
|
||||
| ------ | ---------------------------------------------------------------------------- | --------------------------------- |
|
||||
| 400 | Invalid Agent ID format | Ask the user to check the Agent name |
|
||||
| 404 | Agent does not exist | Inform the user the Agent has already been deleted or the ID is wrong |
|
||||
| 409 | Agent is currently active (API returns `Cannot delete agent "xxx": currently online`) | Ask the user to stop the Agent in the UI first |
|
||||
| 500 | Internal server error | Ask the user to try again later |
|
||||
| Rejection Scenario | Trigger Condition | Handling |
|
||||
| ------------------ | ------------------------------------------------------------- | ------------------------------------- |
|
||||
| Core Agent rejected | The target is a core Agent (desirecore/core/bound UUID) | Inform the user that core Agents cannot be deleted |
|
||||
| Self-deletion rejected | The target is the caller itself | Inform the user that an Agent cannot delete itself |
|
||||
| Active state rejected | The target is in `online`/`busy`/`recovery` state | Prompt the user to stop the Agent in the UI first |
|
||||
| Not found | No Agent exists for the target ID | Inform the user the Agent has already been deleted or the ID is wrong |
|
||||
|
||||
## Deletion Scope
|
||||
|
||||
@@ -251,15 +227,14 @@ effect: abort all active sessions → stop scheduled tasks → status becomes of
|
||||
| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------- |
|
||||
| **Always deleted** | AgentFS directory (config, persona, rules, skills, tools, memory), user preference data, in-memory state (scheduler, queue, message subscriptions, MCP connection), registry entries | Unconditional |
|
||||
| **Optionally deleted** | Session history, topic index | `deleteRuns=true` |
|
||||
| **Team cascading** | Target is the leader → its team is disbanded; target is a member → removed from the team | Automatic |
|
||||
| **Preserved** | Data of other Agents, user configuration, global settings, market cache | — |
|
||||
|
||||
## Permission Requirements
|
||||
|
||||
- Prefer using the `Bash` tool to call curl against the Agent Service HTTP API to perform the operation
|
||||
- The API base address is injected into the "Local API" section of the system prompt; reference it directly
|
||||
- The delete operation requires explicit user confirmation (high-risk operation)
|
||||
- Uses the in-process builtin tool `ManageAgent` to list, query, and delete Agents
|
||||
- The delete action is a high-risk operation; the tool layer will force a user confirmation popup
|
||||
|
||||
## Dependencies
|
||||
|
||||
- Agent Service HTTP API (`DELETE /api/agents/{agentId}`)
|
||||
- The Local API address declaration in the system prompt
|
||||
- The in-process builtin tool `ManageAgent` (`action='list' | 'get' | 'delete'`)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
### 能力描述
|
||||
|
||||
delete-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 安全删除其他智能体的能力。它会执行完整的前置检查、状态验证,并清理所有关联数据。
|
||||
delete-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 安全删除其他智能体的能力。它通过进程内内置工具 **ManageAgent** 执行完整的前置检查、状态验证,并清理所有关联数据。
|
||||
|
||||
### 使用场景
|
||||
|
||||
@@ -21,8 +21,8 @@ delete-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 安全
|
||||
|
||||
### 核心价值
|
||||
|
||||
- **安全性**:多重检查确保不会误删活跃智能体
|
||||
- **完整性**:清理文件系统、内存状态、消息订阅等所有关联数据
|
||||
- **安全性**:工具层多重拒绝规则确保不会误删核心智能体、调用方自身或活跃智能体
|
||||
- **完整性**:清理文件系统、内存状态、消息订阅等所有关联数据,并处理团队级联
|
||||
- **可恢复性**:默认保留会话历史,可选择是否删除
|
||||
|
||||
## L2:详细规范
|
||||
@@ -37,8 +37,8 @@ delete-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 安全
|
||||
│
|
||||
↓
|
||||
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
||||
│ 返回结果 │ ←── │ 执行删除 │ ←── │ 最终确认 │
|
||||
│ 与回执 │ │ API 调用 │ │ │
|
||||
│ 返回结果 │ ←── │ 执行删除 │ ←── │ 告知会弹确认 │
|
||||
│ 与回执 │ │ ManageAgent │ │ │
|
||||
└──────────────┘ └──────────────┘ └──────────────┘
|
||||
```
|
||||
|
||||
@@ -48,9 +48,10 @@ delete-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 安全
|
||||
|
||||
**操作**:
|
||||
|
||||
- 调用 `GET /api/agents` 获取所有智能体列表
|
||||
- 调用 `ManageAgent(action='list')` 获取所有智能体列表
|
||||
- 筛选出状态为 `offline` 或 `error` 的智能体(可安全删除)
|
||||
- 标注出 `online`/`busy`/`recovery` 状态的智能体(需先停止)
|
||||
- 标注出 `online`/`busy`/`recovery` 状态的智能体(需先停止,否则会被工具拒绝)
|
||||
- 如需查看某个智能体的详细信息,调用 `ManageAgent(action='get', id='<agent-id>')`
|
||||
|
||||
**输出示例**:
|
||||
|
||||
@@ -95,57 +96,35 @@ delete-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 安全
|
||||
**参数映射**:
|
||||
|
||||
- 用户选择"是" → `deleteRuns=true`
|
||||
- 用户选择"否" → `deleteRuns=false`(默认)
|
||||
- 用户选择"否" → `deleteRuns=false`(默认,可省略)
|
||||
|
||||
### 阶段 4:最终确认
|
||||
### 阶段 4:告知工具级确认
|
||||
|
||||
**确认摘要**:
|
||||
`ManageAgent` 的 delete 动作在工具层**始终触发用户确认弹窗**,无需在技能层再重复一遍二次确认话术。但在调用前应先告知用户:
|
||||
|
||||
```
|
||||
请确认删除操作:
|
||||
- 目标智能体:法律顾问助手 (legal-assistant)
|
||||
- 删除范围:智能体 + 会话历史(如用户选择)
|
||||
- 风险等级:高(不可恢复)
|
||||
|
||||
确认执行删除?(是/否)
|
||||
即将删除智能体 "法律顾问助手" (legal-assistant),删除范围为智能体 + 会话历史(如用户选择)。
|
||||
系统会弹出确认窗口,请在弹窗中确认执行。
|
||||
```
|
||||
|
||||
### 阶段 5:执行删除 API 调用
|
||||
### 阶段 5:执行删除(ManageAgent 工具)
|
||||
|
||||
**API 端点**:`DELETE /api/agents/{agentId}`
|
||||
**工具调用**:
|
||||
|
||||
**查询参数**:
|
||||
|
||||
- `deleteRuns`: `'true'` 或 `'false'`
|
||||
|
||||
**请求示例**:
|
||||
|
||||
```bash
|
||||
curl -X DELETE "{agentServiceUrl}/api/agents/legal-assistant?deleteRuns=true"
|
||||
```
|
||||
ManageAgent(action='delete', id='legal-assistant', deleteRuns=true)
|
||||
```
|
||||
|
||||
> `{agentServiceUrl}` 取自 system prompt「本机 API」小节中的 Agent Service 地址。
|
||||
**参数**:
|
||||
|
||||
- `id`:目标智能体 ID(必填)
|
||||
- `deleteRuns`:`true` 一并删除全部会话历史;`false`(默认)保留历史,可省略
|
||||
|
||||
工具会在执行前弹出用户确认;确认后完成删除,包含团队级联处理:目标是组长的团队自动解散,是成员的自动移除。
|
||||
|
||||
### 阶段 6:返回操作结果
|
||||
|
||||
**成功响应处理**:
|
||||
|
||||
```json
|
||||
{
|
||||
"deleted": true,
|
||||
"cleanedPaths": [
|
||||
"/Users/xxx/.desirecore/agents/legal-assistant",
|
||||
"/Users/xxx/.desirecore/users/xxx/agents/legal-assistant"
|
||||
],
|
||||
"deletedRunsCount": 5,
|
||||
"memoryCleaned": {
|
||||
"scheduler": true,
|
||||
"queue": 0,
|
||||
"messaging": 3,
|
||||
"mcp": true
|
||||
}
|
||||
}
|
||||
```
|
||||
**成功回执处理**:工具返回删除结果,包含已清理路径、删除的会话数量、内存状态清理详情等字段。据此生成报告。
|
||||
|
||||
**结果报告模板**:
|
||||
|
||||
@@ -158,37 +137,32 @@ curl -X DELETE "{agentServiceUrl}/api/agents/legal-assistant?deleteRuns=true"
|
||||
- 消息订阅:已取消 3 个订阅
|
||||
- MCP 连接:已关闭
|
||||
- 会话历史:已删除 5 条记录
|
||||
- 团队级联:目标所在团队已解散/已从团队移除(如涉及)
|
||||
```
|
||||
|
||||
## 状态验证与错误处理
|
||||
|
||||
### 删除前状态检查
|
||||
|
||||
在阶段 1 列出智能体时,通过 `GET /api/agents` 筛选状态:
|
||||
在阶段 1 列出智能体时,通过 `ManageAgent(action='list')` 返回的状态筛选:
|
||||
|
||||
| 状态 | 可否删除 | 阶段 1 展示方式 |
|
||||
| ------------------------------ | ----------- | ------------------------------ |
|
||||
| `offline` / `error` | ✅ 可删除 | 列入"可删除"列表 |
|
||||
| `online` / `busy` / `recovery` | ❌ 需先停止 | 标注"需先停止",不进入后续流程 |
|
||||
|
||||
**停止活跃智能体的方式**:通过 Socket.IO 发送 `agent:shutdown` 事件:
|
||||
> 活跃状态(online/busy/recovery)的智能体会被 `ManageAgent` 的 delete 动作直接拒绝。应提示用户在 UI 中手动停止该智能体,或等待其完成当前任务后再删除。
|
||||
|
||||
```yaml
|
||||
事件: agent:shutdown
|
||||
数据: { 'agentId': '<agent_id>' }
|
||||
效果: 中止所有活跃会话 → 停止调度任务 → 状态转为 offline
|
||||
```
|
||||
### 工具返回的错误语义
|
||||
|
||||
> Agent 无法直接发送 Socket.IO 事件。如果目标智能体处于活跃状态,应提示用户在 UI 中手动停止,或等待其完成当前任务后再删除。
|
||||
`ManageAgent(action='delete', ...)` 在以下情形会返回明确错误,应据此向用户解释并给出下一步建议:
|
||||
|
||||
### API 错误码
|
||||
|
||||
| 错误码 | 场景 | 处理方式 |
|
||||
| ------ | ---------------------------------------------------------------------------- | -------------------------------- |
|
||||
| 400 | Agent ID 格式无效 | 提示用户检查智能体名称 |
|
||||
| 404 | 智能体不存在 | 告知用户智能体已被删除或 ID 错误 |
|
||||
| 409 | 智能体处于活跃状态(API 返回 `Cannot delete agent "xxx": currently online`) | 提示用户先在 UI 中停止智能体 |
|
||||
| 500 | 服务器内部错误 | 提示用户稍后再试 |
|
||||
| 拒绝场景 | 触发条件 | 处理方式 |
|
||||
| ---------------- | -------------------------------------------------------------- | -------------------------------------- |
|
||||
| 核心智能体拒绝 | 目标为核心智能体(desirecore/core/绑定 UUID) | 告知用户核心智能体不可删除 |
|
||||
| 自删拒绝 | 目标为调用方自身 | 告知用户智能体不能删除自己 |
|
||||
| 活跃状态拒绝 | 目标处于 `online`/`busy`/`recovery` 状态 | 提示用户先在 UI 中停止该智能体 |
|
||||
| 不存在 | 目标 ID 对应的智能体不存在 | 告知用户智能体已被删除或 ID 有误 |
|
||||
|
||||
## 删除范围说明
|
||||
|
||||
@@ -196,15 +170,14 @@ curl -X DELETE "{agentServiceUrl}/api/agents/legal-assistant?deleteRuns=true"
|
||||
| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------- |
|
||||
| **始终删除** | AgentFS 目录(配置、人格、规则、技能、工具、记忆)、用户偏好数据、内存状态(调度器、队列、消息订阅、MCP 连接)、注册表条目 | 无条件 |
|
||||
| **可选删除** | 会话历史、话题索引 | `deleteRuns=true` |
|
||||
| **团队级联** | 目标是组长 → 解散其团队;目标是成员 → 从团队移除 | 自动 |
|
||||
| **保留不删** | 其他智能体数据、用户配置、全局设置、市场缓存 | — |
|
||||
|
||||
## 权限要求
|
||||
|
||||
- 建议优先通过 `Bash` 工具调用 curl 访问 Agent Service HTTP API 完成操作
|
||||
- API 基础地址已注入到 system prompt 的「本机 API」小节,直接引用即可
|
||||
- 删除操作需要用户显式确认(高风险操作)
|
||||
- 通过进程内内置工具 `ManageAgent` 完成智能体的列出、查询与删除
|
||||
- delete 动作为高风险操作,工具层会强制弹出用户确认
|
||||
|
||||
## 依赖
|
||||
|
||||
- Agent Service HTTP API(`DELETE /api/agents/{agentId}`)
|
||||
- System prompt 中的本机 API 地址声明
|
||||
- 进程内内置工具 `ManageAgent`(`action='list' | 'get' | 'delete'`)
|
||||
|
||||
Reference in New Issue
Block a user