mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-07-23 05:23:40 +08:00
perf(skills): 智能体 CRUD 四技能提示词改写压缩(功能不变,~65%) (#56)
## 摘要 / Summary ### 中文 四个智能体管理技能(create/update/delete/discover-agent)改用 `ManageAgent` 内置工具后,正文与工具契约大量重叠——ManageAgent 的 description + params 已**常驻每次 query 的上下文**,声明了五个 action 语义、参数约束、权限硬边界、错误语义、字段级合并、确认行为、list/get 返回格式;技能正文里再复述即冗余。本次对四技能做**强改写·语境融合**压缩: - 与工具契约重复的说明(参数/权限/错误码/确认行为/成功返回话术)**改写融入对应流程步骤**(如错误处理表 → 阶段一句、确认行为 → 阶段一句),不再照抄、不再表格化。 - 装饰性 ASCII 流程框图 → 一行文字流程;update 内部两张重复更新表 → 合并;YAML 元数据块(diff_metadata/context_handoff)融入流程;冗长示例(create 三份 JSON、update 附录 4 示例、discover ASCII 卡片)就地精简为代表示意。 - **不外置 references、不净删除任何内容**:所有决策/领域/交互意图完整保留——领域匹配表、persona/principles 的 L0/L1/L2 生成规范、update 两路径分流与字段级合并 vs 整体替换、防幻觉改名、回滚流程、discover 需求维度与无匹配衔接 create 等核心一字未丢。 zh 正文合计 **26542 → 9196 字符(降 ~65%)**;中英双份同步改写、逐段对齐,重算 i18n source_hash(validate-i18n 通过)。版本 create 2.5.1 / update 3.1.2 / delete 2.5.1 / discover 2.6.1,manifest 1.2.12。 ### English After the four agent-management skills adopted the `ManageAgent` builtin tool, their bodies heavily duplicated the tool contract — ManageAgent's description + params are **resident in every query's context** (action semantics, param constraints, permission hard-boundaries, error semantics, field-level merge, confirmation behavior, list/get return formats). This PR compresses all four via **aggressive rewrite + contextual fusion**: contract-duplicating text is rewritten into the relevant flow steps (not copied, not tabularized), decorative ASCII flow boxes become one-line text, update's two duplicate tables are merged, YAML metadata blocks are folded in, and long examples are trimmed in place to representative sketches. **No references externalization, no net deletion** — every decision/domain/interaction intent is preserved (domain matching table, persona/principles L0/L1/L2 generation spec, update's two-path split and field-level-merge-vs-full-replace, anti-hallucination rename, rollback flow, discover's need dimensions and create hand-off). zh bodies total **26542 → 9196 chars (~65% down)**; both locales rewritten and aligned, i18n source hashes recomputed (validate-i18n passes). Versions bumped, manifest 1.2.12.
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## [2.5.1] - 2026-07-19
|
||||
|
||||
- 提示词改写压缩,功能不变——与 ManageAgent 工具契约重复的说明、装饰框图、重复表改写融入流程,示例就地精简;不外置、不净删,意图全保留。
|
||||
|
||||
## [2.5.0] - 2026-07-18
|
||||
|
||||
- HTTP API 调用改为 ManageAgent 内置工具(实例鉴权后 Agent 不再直接访问本机 API,会 401)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: delete-agent
|
||||
description: 安全删除指定的智能体及其关联数据。删除前会验证智能体状态,支持可选地删除所有会话历史。Use when 用户需要删除不再使用的智能体。
|
||||
version: 2.5.0
|
||||
version: 2.5.1
|
||||
type: meta
|
||||
risk_level: high
|
||||
status: enabled
|
||||
@@ -12,7 +12,7 @@ tags:
|
||||
- meta
|
||||
metadata:
|
||||
author: desirecore
|
||||
updated_at: '2026-07-18'
|
||||
updated_at: '2026-07-19'
|
||||
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:6b971559e1d4ccc0
|
||||
source_hash: sha256:7037971bb67e0953
|
||||
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:6b971559e1d4ccc0
|
||||
source_hash: sha256:7037971bb67e0953
|
||||
translated_by: ai:claude-fable-5
|
||||
translated_at: '2026-07-18'
|
||||
translated_at: '2026-07-19'
|
||||
market:
|
||||
icon: >-
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0
|
||||
@@ -55,186 +55,53 @@ market:
|
||||
required_client_version: 10.0.90
|
||||
---
|
||||
|
||||
# delete-agent Skill
|
||||
# delete-agent skill
|
||||
|
||||
## L0: One-line Summary
|
||||
## L0: One-Sentence Summary
|
||||
|
||||
Safely delete a specified Agent and its associated data, including filesystem, in-memory state, and optionally session history.
|
||||
Safely delete a specified Agent and its associated data (filesystem, in-memory state, optional conversation history).
|
||||
|
||||
## L1: Overview and Use Cases
|
||||
## L1: Overview
|
||||
|
||||
### Capability Description
|
||||
Meta-skill: list candidates → confirm intent (irreversible) → ask whether to delete history → execute via `ManageAgent(action='delete')`. Its value is what the tool can't give: candidate filtering with status guidance, and intent confirmation before deletion. The tool guarantees the multi-way refusals (core agent / self / active state) and team cascading.
|
||||
|
||||
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.
|
||||
## L2: Detailed Spec
|
||||
|
||||
### Use Cases
|
||||
Flow: list deletable Agents → confirm intent and target → ask whether to delete history → execute → receipt.
|
||||
|
||||
- The user wants to clean up Agents that are no longer in use
|
||||
- Delete temporary Agents created for testing or experimentation
|
||||
- Free up storage space by deleting old Agents and their history
|
||||
- The user explicitly asks to "delete" or "remove" a particular Agent
|
||||
### Stage 1: List Candidates
|
||||
|
||||
### Core Value
|
||||
|
||||
- **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
|
||||
|
||||
### Execution Flow
|
||||
When the user hasn't named a specific Agent, fetch the list with `ManageAgent(action='list')` and group by status: `offline` / `error` are safe to delete; `online` / `busy` / `recovery` are marked "stop first" (the tool will refuse them) and excluded from the rest of the flow. For details, use `ManageAgent(action='get', id)`. E.g.:
|
||||
|
||||
```
|
||||
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
||||
│ List target │ ──→ │ Confirm │ ──→ │ Ask about │
|
||||
│ Agents │ │ intent/target│ │ options │
|
||||
└──────────────┘ └──────────────┘ │ (delete runs?)│
|
||||
└──────────────┘
|
||||
│
|
||||
↓
|
||||
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
||||
│ Return result│ ←── │ Execute │ ←── │ Inform that │
|
||||
│ and receipt │ │ ManageAgent │ │ a popup will│
|
||||
│ │ │ │ │ appear │
|
||||
└──────────────┘ └──────────────┘ └──────────────┘
|
||||
Deletable: Legal Advisor (legal-assistant, offline), Test Bot (test-bot, offline)
|
||||
Stop first: Data Analyst (data-analyst, online)
|
||||
```
|
||||
|
||||
### Phase 1: List Deletable Agents
|
||||
### Stage 2: Confirm Intent
|
||||
|
||||
**Trigger condition**: the user expresses intent to delete but does not specify a particular Agent
|
||||
Confirm the target Agent (name/ID) with the user, **explicitly state it is irreversible** (config, skills, tools will be permanently deleted), show basic info, and wait for confirmation.
|
||||
|
||||
**Operation**:
|
||||
### Stage 3: Ask About Deletion Options
|
||||
|
||||
- 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, otherwise the tool will reject them)
|
||||
- To view detailed information about a specific Agent, call `ManageAgent(action='get', id='<agent-id>')`
|
||||
Ask whether to also delete all of the Agent's conversation history: yes → `deleteRuns=true`; no → `deleteRuns=false` (default, omittable, keeps history).
|
||||
|
||||
**Output example**:
|
||||
### Stage 4: Execute Deletion
|
||||
|
||||
```
|
||||
Deletable Agents:
|
||||
1. Legal Advisor Assistant (legal-assistant) - status: offline
|
||||
2. Test Bot (test-bot) - status: offline
|
||||
|
||||
Currently active Agents (must be stopped before deletion):
|
||||
- Data Analyst (data-analyst) - status: online
|
||||
```
|
||||
|
||||
### Phase 2: Confirm User Intent and Target
|
||||
|
||||
**Confirmation points**:
|
||||
|
||||
- The Agent name/ID specified by the user
|
||||
- Explicitly inform that deletion is irreversible
|
||||
- Display the Agent's basic info for the user to confirm
|
||||
|
||||
**Dialog example**:
|
||||
|
||||
```
|
||||
You are about to delete the Agent "Legal Advisor Assistant" (legal-assistant).
|
||||
⚠️ Warning: this operation is irreversible. All configuration, skills, and tools of this Agent will be permanently deleted.
|
||||
|
||||
Confirm deletion? (yes/no)
|
||||
```
|
||||
|
||||
### Phase 3: Ask About Deletion Options
|
||||
|
||||
**Question content**:
|
||||
|
||||
```
|
||||
Do you also want to delete all session history of this Agent?
|
||||
- Yes: delete the Agent and all of its conversation records
|
||||
- No: keep session history; delete only the Agent itself
|
||||
|
||||
Default option: No (keep history)
|
||||
```
|
||||
|
||||
**Parameter mapping**:
|
||||
|
||||
- User chooses "Yes" → `deleteRuns=true`
|
||||
- User chooses "No" → `deleteRuns=false` (default, can be omitted)
|
||||
|
||||
### Phase 4: Inform About the Tool-level Confirmation
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
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 Deletion (ManageAgent tool)
|
||||
|
||||
**Tool call**:
|
||||
Before the call, tell the user "the system will pop up a confirmation window; please confirm there" (delete is force-confirmed at the tool layer). Execute:
|
||||
|
||||
```
|
||||
ManageAgent(action='delete', id='legal-assistant', deleteRuns=true)
|
||||
```
|
||||
|
||||
**Parameters**:
|
||||
After confirmation the deletion completes, including team cascading: a team whose supervisor is the target is disbanded; membership is removed where the target is a member.
|
||||
|
||||
- `id`: the target Agent ID (required)
|
||||
- `deleteRuns`: `true` to also delete all session history; `false` (default) to keep history, can be omitted
|
||||
### Stage 5: Receipt
|
||||
|
||||
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.
|
||||
From the tool's return (cleaned paths, deleted run count, memory-cleanup details), produce a user-friendly report (no internal paths), e.g. "✅ Deleted XXX; cleaned filesystem / scheduler / subscriptions / MCP / N conversation records / team cascade".
|
||||
|
||||
### Phase 6: Return the Operation Result
|
||||
### Deletion Scope and Boundaries
|
||||
|
||||
**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**:
|
||||
|
||||
```
|
||||
✅ Agent "Legal Advisor Assistant" successfully deleted
|
||||
|
||||
Cleanup details:
|
||||
- Filesystem: 2 directories deleted
|
||||
- Scheduler: all scheduled tasks stopped
|
||||
- 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 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 |
|
||||
|
||||
> 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.
|
||||
|
||||
### Error Semantics Returned by the Tool
|
||||
|
||||
`ManageAgent(action='delete', ...)` returns a clear error in the following cases; use them to explain the situation to the user and suggest next steps:
|
||||
|
||||
| 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
|
||||
|
||||
| Category | Content Deleted | Condition |
|
||||
| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------- |
|
||||
| **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
|
||||
|
||||
- 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
|
||||
|
||||
- The in-process builtin tool `ManageAgent` (`action='list' | 'get' | 'delete'`)
|
||||
- **Always deleted**: AgentFS directory (config/persona/rules/skills/tools/memory), user preference data, in-memory state (scheduler/queue/message subscriptions/MCP connections), registry entry. **Optionally deleted** (`deleteRuns=true`): conversation history and topic index. **Team cascade** (automatic): supervisor → disband team, member → remove. **Kept**: other Agents, user config, global settings, market cache.
|
||||
- Explain tool refusals to the user with a next step: the core agent (desirecore / core / bound UUID) cannot be deleted; the caller can't delete itself; active state (online/busy/recovery) needs stopping in the UI first or waiting until idle; a non-existent ID means the Agent is already gone or the ID is wrong.
|
||||
- Always done via `ManageAgent` (`action='list' | 'get' | 'delete'`); delete is a high-risk operation and is force-confirmed at the tool layer.
|
||||
|
||||
@@ -4,180 +4,49 @@
|
||||
|
||||
## L0:一句话摘要
|
||||
|
||||
安全删除指定的智能体及其关联数据,包括文件系统、内存状态和可选的会话历史。
|
||||
安全删除指定的智能体及其关联数据(文件系统、内存状态、可选会话历史)。
|
||||
|
||||
## L1:概述与使用场景
|
||||
## L1:概述
|
||||
|
||||
### 能力描述
|
||||
|
||||
delete-agent 是一个**元技能(Meta-Skill)**,赋予 DesireCore 安全删除其他智能体的能力。它通过进程内内置工具 **ManageAgent** 执行完整的前置检查、状态验证,并清理所有关联数据。
|
||||
|
||||
### 使用场景
|
||||
|
||||
- 用户想要清理不再使用的智能体
|
||||
- 删除测试或实验性质的临时智能体
|
||||
- 释放存储空间,删除旧智能体及其历史记录
|
||||
- 用户明确要求"删除"、"移除"某个智能体
|
||||
|
||||
### 核心价值
|
||||
|
||||
- **安全性**:工具层多重拒绝规则确保不会误删核心智能体、调用方自身或活跃智能体
|
||||
- **完整性**:清理文件系统、内存状态、消息订阅等所有关联数据,并处理团队级联
|
||||
- **可恢复性**:默认保留会话历史,可选择是否删除
|
||||
元技能:列出候选 → 确认意图(不可恢复)→ 询问是否删历史 → `ManageAgent(action='delete')` 执行。价值在工具给不了的部分:候选筛选与状态引导、删除前的意图确认。工具层多重拒绝(核心体 / 自身 / 活跃态)与团队级联由工具保证。
|
||||
|
||||
## L2:详细规范
|
||||
|
||||
### 执行流程
|
||||
流程:列出可选智能体 → 确认意图与目标 → 询问是否删历史 → 执行删除 → 回执。
|
||||
|
||||
### 阶段 1:列出候选
|
||||
|
||||
用户未指定具体智能体时,`ManageAgent(action='list')` 取列表,按状态分组展示:`offline` / `error` 可安全删除;`online` / `busy` / `recovery` 标注"需先停止"(会被工具拒绝),不进入后续流程。需详情用 `ManageAgent(action='get', id)`。例如:
|
||||
|
||||
```
|
||||
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
||||
│ 列出可选 │ ──→ │ 确认意图 │ ──→ │ 询问选项 │
|
||||
│ 智能体 │ │ 与目标 │ │ (删除历史?) │
|
||||
└──────────────┘ └──────────────┘ └──────────────┘
|
||||
│
|
||||
↓
|
||||
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
||||
│ 返回结果 │ ←── │ 执行删除 │ ←── │ 告知会弹确认 │
|
||||
│ 与回执 │ │ ManageAgent │ │ │
|
||||
└──────────────┘ └──────────────┘ └──────────────┘
|
||||
可删除:法律顾问助手 (legal-assistant, offline)、测试机器人 (test-bot, offline)
|
||||
需先停止:数据分析师 (data-analyst, online)
|
||||
```
|
||||
|
||||
### 阶段 1:列出可删除的智能体
|
||||
### 阶段 2:确认意图
|
||||
|
||||
**触发条件**:用户表达删除意图但未指定具体智能体
|
||||
|
||||
**操作**:
|
||||
|
||||
- 调用 `ManageAgent(action='list')` 获取所有智能体列表
|
||||
- 筛选出状态为 `offline` 或 `error` 的智能体(可安全删除)
|
||||
- 标注出 `online`/`busy`/`recovery` 状态的智能体(需先停止,否则会被工具拒绝)
|
||||
- 如需查看某个智能体的详细信息,调用 `ManageAgent(action='get', id='<agent-id>')`
|
||||
|
||||
**输出示例**:
|
||||
|
||||
```
|
||||
可删除的智能体:
|
||||
1. 法律顾问助手 (legal-assistant) - 状态: offline
|
||||
2. 测试机器人 (test-bot) - 状态: offline
|
||||
|
||||
当前活跃的智能体(需先停止才能删除):
|
||||
- 数据分析师 (data-analyst) - 状态: online
|
||||
```
|
||||
|
||||
### 阶段 2:确认用户意图与目标
|
||||
|
||||
**确认要点**:
|
||||
|
||||
- 用户指定的智能体名称/ID
|
||||
- 明确告知删除操作不可恢复
|
||||
- 展示智能体基本信息供用户确认
|
||||
|
||||
**对话示例**:
|
||||
|
||||
```
|
||||
您要删除智能体 "法律顾问助手" (legal-assistant)。
|
||||
⚠️ 警告:此操作不可恢复,该智能体的所有配置、技能、工具将被永久删除。
|
||||
|
||||
确认删除?(是/否)
|
||||
```
|
||||
向用户确认目标智能体(名称/ID),**明确告知不可恢复**(配置、技能、工具将永久删除),展示基本信息,等用户确认。
|
||||
|
||||
### 阶段 3:询问删除选项
|
||||
|
||||
**询问内容**:
|
||||
问是否同时删除该智能体的全部会话历史:是 → `deleteRuns=true`;否 → `deleteRuns=false`(默认、可省略,保留历史)。
|
||||
|
||||
```
|
||||
是否同时删除该智能体的所有会话历史?
|
||||
- 是:删除智能体及其所有对话记录
|
||||
- 否:保留会话历史,仅删除智能体本身
|
||||
### 阶段 4:执行删除
|
||||
|
||||
默认选项:否(保留历史)
|
||||
```
|
||||
|
||||
**参数映射**:
|
||||
|
||||
- 用户选择"是" → `deleteRuns=true`
|
||||
- 用户选择"否" → `deleteRuns=false`(默认,可省略)
|
||||
|
||||
### 阶段 4:告知工具级确认
|
||||
|
||||
`ManageAgent` 的 delete 动作在工具层**始终触发用户确认弹窗**,无需在技能层再重复一遍二次确认话术。但在调用前应先告知用户:
|
||||
|
||||
```
|
||||
即将删除智能体 "法律顾问助手" (legal-assistant),删除范围为智能体 + 会话历史(如用户选择)。
|
||||
系统会弹出确认窗口,请在弹窗中确认执行。
|
||||
```
|
||||
|
||||
### 阶段 5:执行删除(ManageAgent 工具)
|
||||
|
||||
**工具调用**:
|
||||
调用前告知用户"系统会弹确认窗,请在弹窗中确认"(delete 由工具层强制弹确认)。执行:
|
||||
|
||||
```
|
||||
ManageAgent(action='delete', id='legal-assistant', deleteRuns=true)
|
||||
```
|
||||
|
||||
**参数**:
|
||||
确认后完成删除,含团队级联:目标是组长的团队自动解散,是成员的自动移除。
|
||||
|
||||
- `id`:目标智能体 ID(必填)
|
||||
- `deleteRuns`:`true` 一并删除全部会话历史;`false`(默认)保留历史,可省略
|
||||
### 阶段 5:回执
|
||||
|
||||
工具会在执行前弹出用户确认;确认后完成删除,包含团队级联处理:目标是组长的团队自动解散,是成员的自动移除。
|
||||
据工具返回(已清理路径、删除会话数、内存清理详情)生成用户友好报告(不暴露内部路径),例如「✅ 已删除 XXX;清理了文件系统 / 调度 / 订阅 / MCP / N 条会话历史 / 团队级联」。
|
||||
|
||||
### 阶段 6:返回操作结果
|
||||
### 删除范围与边界
|
||||
|
||||
**成功回执处理**:工具返回删除结果,包含已清理路径、删除的会话数量、内存状态清理详情等字段。据此生成报告。
|
||||
|
||||
**结果报告模板**:
|
||||
|
||||
```
|
||||
✅ 智能体 "法律顾问助手" 已成功删除
|
||||
|
||||
清理详情:
|
||||
- 文件系统:已删除 2 个目录
|
||||
- 调度器:已停止所有定时任务
|
||||
- 消息订阅:已取消 3 个订阅
|
||||
- MCP 连接:已关闭
|
||||
- 会话历史:已删除 5 条记录
|
||||
- 团队级联:目标所在团队已解散/已从团队移除(如涉及)
|
||||
```
|
||||
|
||||
## 状态验证与错误处理
|
||||
|
||||
### 删除前状态检查
|
||||
|
||||
在阶段 1 列出智能体时,通过 `ManageAgent(action='list')` 返回的状态筛选:
|
||||
|
||||
| 状态 | 可否删除 | 阶段 1 展示方式 |
|
||||
| ------------------------------ | ----------- | ------------------------------ |
|
||||
| `offline` / `error` | ✅ 可删除 | 列入"可删除"列表 |
|
||||
| `online` / `busy` / `recovery` | ❌ 需先停止 | 标注"需先停止",不进入后续流程 |
|
||||
|
||||
> 活跃状态(online/busy/recovery)的智能体会被 `ManageAgent` 的 delete 动作直接拒绝。应提示用户在 UI 中手动停止该智能体,或等待其完成当前任务后再删除。
|
||||
|
||||
### 工具返回的错误语义
|
||||
|
||||
`ManageAgent(action='delete', ...)` 在以下情形会返回明确错误,应据此向用户解释并给出下一步建议:
|
||||
|
||||
| 拒绝场景 | 触发条件 | 处理方式 |
|
||||
| ---------------- | -------------------------------------------------------------- | -------------------------------------- |
|
||||
| 核心智能体拒绝 | 目标为核心智能体(desirecore/core/绑定 UUID) | 告知用户核心智能体不可删除 |
|
||||
| 自删拒绝 | 目标为调用方自身 | 告知用户智能体不能删除自己 |
|
||||
| 活跃状态拒绝 | 目标处于 `online`/`busy`/`recovery` 状态 | 提示用户先在 UI 中停止该智能体 |
|
||||
| 不存在 | 目标 ID 对应的智能体不存在 | 告知用户智能体已被删除或 ID 有误 |
|
||||
|
||||
## 删除范围说明
|
||||
|
||||
| 类别 | 删除内容 | 条件 |
|
||||
| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------- |
|
||||
| **始终删除** | AgentFS 目录(配置、人格、规则、技能、工具、记忆)、用户偏好数据、内存状态(调度器、队列、消息订阅、MCP 连接)、注册表条目 | 无条件 |
|
||||
| **可选删除** | 会话历史、话题索引 | `deleteRuns=true` |
|
||||
| **团队级联** | 目标是组长 → 解散其团队;目标是成员 → 从团队移除 | 自动 |
|
||||
| **保留不删** | 其他智能体数据、用户配置、全局设置、市场缓存 | — |
|
||||
|
||||
## 权限要求
|
||||
|
||||
- 通过进程内内置工具 `ManageAgent` 完成智能体的列出、查询与删除
|
||||
- delete 动作为高风险操作,工具层会强制弹出用户确认
|
||||
|
||||
## 依赖
|
||||
|
||||
- 进程内内置工具 `ManageAgent`(`action='list' | 'get' | 'delete'`)
|
||||
- **始终删**:AgentFS 目录(配置/人格/规则/技能/工具/记忆)、用户偏好数据、内存状态(调度器/队列/消息订阅/MCP 连接)、注册表条目。**可选删**(`deleteRuns=true`):会话历史与话题索引。**团队级联**(自动):组长 → 解散团队、成员 → 移除。**保留不删**:其他智能体、用户配置、全局设置、市场缓存。
|
||||
- 工具拒绝场景据此向用户解释并给下一步:核心智能体(desirecore / core / 绑定 UUID)不可删;不能删调用方自身;活跃态(online/busy/recovery)需先在 UI 停止或等其空闲;ID 不存在则智能体已删或 ID 有误。
|
||||
- 一律经 `ManageAgent`(`action='list' | 'get' | 'delete'`)完成;delete 为高风险操作,工具层强制弹确认。
|
||||
|
||||
Reference in New Issue
Block a user