feat: skills i18n 改造(schemaVersion 1.1,零向后兼容) (#1)

* feat: skills i18n 改造 — schemaVersion 1.1,零向后兼容

把 21 个 skills + 1 个 agent + manifest/categories 全量迁移到 schemaVersion 1.1
的 i18n 结构,配套 CI AI 翻译流水线(GitHub Models)与本地工具链。

## 关键变更

### 数据结构(破坏性,schemaVersion 1.0 → 1.1)
- SKILL.md: 顶层 name 改为 ASCII slug(== 目录名,符合 agentskills.io 规范);
  中文显示名/short_desc/description 全部迁入 metadata.i18n.<locale>
- agents/<id>/agent.json: shortDesc/fullDesc/tags/persona.{role,traits} 迁入
  i18n.<locale>;changelog[].changes 改为 { <locale>: string[] } 对象
- categories.json: 每个分类的 label/description 迁入 i18n.<locale>,顶层只剩
  color/icon
- manifest.json: 加 supportedLocales / defaultLocale;顶层 description 迁入
  i18n.<locale>

### Body 文件结构
- 根 SKILL.md = frontmatter + default_locale (en-US) body
- SKILL.<locale>.md = 各 locale 的 markdown body(首行 <!-- locale: xx --> 自校验)

### 工具链(scripts/i18n/)
- glossary.json: zh→en 术语表 + do_not_translate 白名单
- schema/skill-frontmatter.schema.json: i18n frontmatter JSON Schema
- validate-i18n.py: 8 条校验规则(name 合规 / locale 完整性 / hash 一致性等)
- translate.py: GitHub Models / Anthropic 双 backend,sha256 增量翻译
- migrate.py: 一次性迁移脚本(旧格式 → i18n 结构)

### CI(.github/workflows/)
- i18n-validate.yml: PR 触发跑 validate + translate --check
- i18n-translate.yml: PR 触发用 GitHub Models(默认 openai/gpt-5-mini)翻译缺失
  locale,自动追加 commit;可切到 ANTHROPIC_API_KEY 走 Claude

### 文档
- docs/I18N.md: 作者贡献指南(schema 说明 / 提交流程 / 常见问题)
- README.md: 加多语言段落

## 验证

- uv run scripts/i18n/validate-i18n.py: OK,49 文件 0 错误
- uv run scripts/i18n/translate.py --check: 0 stale locale
- 21 skills 标题数 zh-CN == en-US 严格对齐(最大 66=66)
- skills-ref 规范校验:全部通过(顶层 name ASCII slug + description 单字段)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(i18n): 修复 PR #1 review 反馈的 6 项问题

- schema: translated_by 正则放宽为 ^(human|ai:[A-Za-z0-9._:/-]+)$,接受
  'ai:github:openai/gpt-5-mini' 这类 backend:model 形式(CI 翻译输出格式)
- README + docs/I18N.md: 修正"CI 用 Claude API"误导描述,正确说明默认是
  GitHub Models(openai/gpt-5-mini)+ GITHUB_TOKEN,可选切到 Anthropic
- skills/minimax-tts/SKILL.md & SKILL.zh-CN.md: 删除多余的 ``` 闭合,避免
  Markdown 后续渲染错乱
- skills/docx/SKILL.md: 翻译时丢失的 • Unicode escape 示例已恢复,
  与 zh-CN 版本对齐

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-05 00:26:33 +08:00
committed by GitHub
parent 1c107a9344
commit 1f7c8b9673
59 changed files with 10533 additions and 2014 deletions

View File

@@ -1,5 +1,5 @@
---
name: 删除智能体
name: delete-agent
description: 安全删除指定的智能体及其关联数据。删除前会验证智能体状态支持可选地删除所有会话历史。Use when 用户需要删除不再使用的智能体。
version: 2.4.2
type: meta
@@ -13,6 +13,27 @@ tags:
metadata:
author: desirecore
updated_at: '2026-02-28'
i18n:
default_locale: en-US
source_locale: zh-CN
locales:
- zh-CN
- en-US
zh-CN:
name: 删除智能体
short_desc: 安全删除智能体及其关联数据,支持多重确认与可选历史清理
description: 安全删除指定的智能体及其关联数据。删除前会验证智能体状态支持可选地删除所有会话历史。Use when 用户需要删除不再使用的智能体。
body: ./SKILL.zh-CN.md
source_hash: sha256:148cd72a6808741e
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'
market:
icon: >-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0
@@ -25,7 +46,6 @@ market:
stroke-width="1.5"/><circle cx="19" cy="11" r="4" fill="#FF3B30"
fill-opacity="0.12"/><line x1="16.5" y1="11" x2="21.5" y2="11"
stroke="#FF3B30" stroke-width="2" stroke-linecap="round"/></svg>
short_desc: 安全删除智能体及其关联数据,支持多重确认与可选历史清理
category: productivity
maintainer:
name: DesireCore Official
@@ -34,135 +54,136 @@ market:
channel: latest
---
# delete-agent 技能
# delete-agent Skill
## L0:一句话摘要
## L0: One-line Summary
安全删除指定的智能体及其关联数据,包括文件系统、内存状态和可选的会话历史。
Safely delete a specified Agent and its associated data, including filesystem, in-memory state, and optionally session history.
## L1:概述与使用场景
## L1: Overview and Use Cases
### 能力描述
### Capability Description
delete-agent 是一个**元技能(Meta-Skill**,赋予 DesireCore 安全删除其他智能体的能力。它会执行完整的前置检查、状态验证,并清理所有关联数据。
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.
### 使用场景
### Use Cases
- 用户想要清理不再使用的智能体
- 删除测试或实验性质的临时智能体
- 释放存储空间,删除旧智能体及其历史记录
- 用户明确要求"删除"、"移除"某个智能体
- 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
### 核心价值
### 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
- **Recoverability**: session history is preserved by default, with the option to delete it
## L2:详细规范
## L2: Detailed Specification
### 执行流程
### Execution Flow
```
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
列出可选 │ ──→ │ 确认意图 │ ──→ │ 询问选项
智能体 │ │ 与目标 │ │ (删除历史?)
└──────────────┘ └──────────────┘ └──────────────┘
List target │ ──→ │ Confirm │ ──→ │ Ask about
Agents │ │ intent/target│ │ options
└──────────────┘ └──────────────┘ │ (delete runs?)│
└──────────────┘
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
返回结果 │ ←── │ 执行删除 │ ←── │ 最终确认
与回执 │ │ API 调用 │ │
Return result│ ←── │ Execute the │ ←── │ Final
and receipt │ │ delete API │ │ confirmation
└──────────────┘ └──────────────┘ └──────────────┘
```
### 阶段 1列出可删除的智能体
### Phase 1: List Deletable Agents
**触发条件**:用户表达删除意图但未指定具体智能体
**Trigger condition**: the user expresses intent to delete but does not specify a particular Agent
**操作**
**Operation**:
- 调用 `GET /api/agents` 获取所有智能体列表
- 筛选出状态为 `offline` `error` 的智能体(可安全删除)
- 标注出 `online`/`busy`/`recovery` 状态的智能体(需先停止)
- Call `GET /api/agents` 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)
**输出示例**
**Output example**:
```
可删除的智能体:
1. 法律顾问助手 (legal-assistant) - 状态: offline
2. 测试机器人 (test-bot) - 状态: offline
Deletable Agents:
1. Legal Advisor Assistant (legal-assistant) - status: offline
2. Test Bot (test-bot) - status: offline
当前活跃的智能体(需先停止才能删除):
- 数据分析师 (data-analyst) - 状态: online
Currently active Agents (must be stopped before deletion):
- Data Analyst (data-analyst) - status: online
```
### 阶段 2确认用户意图与目标
### Phase 2: Confirm User Intent and Target
**确认要点**
**Confirmation points**:
- 用户指定的智能体名称/ID
- 明确告知删除操作不可恢复
- 展示智能体基本信息供用户确认
- 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**:
```
您要删除智能体 "法律顾问助手" (legal-assistant)
⚠️ 警告:此操作不可恢复,该智能体的所有配置、技能、工具将被永久删除。
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)
```
### 阶段 3询问删除选项
### 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**:
- 用户选择"是" → `deleteRuns=true`
- 用户选择"否" → `deleteRuns=false`(默认)
- User chooses "Yes" → `deleteRuns=true`
- User chooses "No" → `deleteRuns=false` (default)
### 阶段 4最终确认
### Phase 4: Final Confirmation
**确认摘要**
**Confirmation summary**:
```
请确认删除操作:
- 目标智能体:法律顾问助手 (legal-assistant)
- 删除范围:智能体 + 会话历史(如用户选择)
- 风险等级:高(不可恢复)
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)
```
### 阶段 5执行删除 API 调用
### Phase 5: Execute the Delete API Call
**API 端点**`DELETE /api/agents/{agentId}`
**API endpoint**: `DELETE /api/agents/{agentId}`
**查询参数**
**Query parameters**:
- `deleteRuns`: `'true'` `'false'`
- `deleteRuns`: `'true'` or `'false'`
**请求示例**
**Request example**:
```bash
curl -X DELETE "{agentServiceUrl}/api/agents/legal-assistant?deleteRuns=true"
```
> `{agentServiceUrl}` 取自 system prompt「本机 API」小节中的 Agent Service 地址。
> `{agentServiceUrl}` is taken from the Agent Service address in the "Local API" section of the system prompt.
### 阶段 6返回操作结果
### Phase 6: Return the Operation Result
**成功响应处理**
**Successful response handling**:
```json
{
@@ -181,64 +202,64 @@ curl -X DELETE "{agentServiceUrl}/api/agents/legal-assistant?deleteRuns=true"
}
```
**结果报告模板**
**Result report template**:
```
智能体 "法律顾问助手" 已成功删除
Agent "Legal Advisor Assistant" successfully deleted
清理详情:
- 文件系统:已删除 2 个目录
- 调度器:已停止所有定时任务
- 消息订阅:已取消 3 个订阅
- MCP 连接:已关闭
- 会话历史:已删除 5 条记录
Cleanup details:
- Filesystem: 2 directories deleted
- Scheduler: all scheduled tasks stopped
- Message subscriptions: 3 subscriptions canceled
- MCP connection: closed
- Session history: 5 records deleted
```
## 状态验证与错误处理
## State Validation and Error Handling
### 删除前状态检查
### Pre-deletion State Check
在阶段 1 列出智能体时,通过 `GET /api/agents` 筛选状态:
When listing Agents in Phase 1, filter status via `GET /api/agents`:
| 状态 | 可否删除 | 阶段 1 展示方式 |
| Status | Deletable? | Phase 1 Display |
| ------------------------------ | ----------- | ------------------------------ |
| `offline` / `error` | ✅ 可删除 | 列入"可删除"列表 |
| `online` / `busy` / `recovery` | ❌ 需先停止 | 标注"需先停止",不进入后续流程 |
| `offline` / `error` | ✅ Yes | Listed under "Deletable" |
| `online` / `busy` / `recovery` | ❌ Stop first | Annotated "must be stopped"; not entered into the subsequent flow |
**停止活跃智能体的方式**:通过 Socket.IO 发送 `agent:shutdown` 事件:
**How to stop an active Agent**: send the `agent:shutdown` event via Socket.IO:
```yaml
事件: agent:shutdown
数据: { 'agentId': '<agent_id>' }
效果: 中止所有活跃会话 → 停止调度任务 → 状态转为 offline
event: agent:shutdown
data: { 'agentId': '<agent_id>' }
effect: abort all active sessions → stop scheduled tasks → status becomes offline
```
> Agent 无法直接发送 Socket.IO 事件。如果目标智能体处于活跃状态,应提示用户在 UI 中手动停止,或等待其完成当前任务后再删除。
> 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.
### API 错误码
### API Error Codes
| 错误码 | 场景 | 处理方式 |
| ------ | ---------------------------------------------------------------------------- | -------------------------------- |
| 400 | Agent ID 格式无效 | 提示用户检查智能体名称 |
| 404 | 智能体不存在 | 告知用户智能体已被删除或 ID 错误 |
| 409 | 智能体处于活跃状态API 返回 `Cannot delete agent "xxx": currently online` | 提示用户先在 UI 中停止智能体 |
| 500 | 服务器内部错误 | 提示用户稍后再试 |
| 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 |
## 删除范围说明
## Deletion Scope
| 类别 | 删除内容 | 条件 |
| Category | Content Deleted | Condition |
| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| **始终删除** | AgentFS 目录配置、人格、规则、技能、工具、记忆、用户偏好数据、内存状态调度器、队列、消息订阅、MCP 连接)、注册表条目 | 无条件 |
| **可选删除** | 会话历史、话题索引 | `deleteRuns=true` |
| **保留不删** | 其他智能体数据、用户配置、全局设置、市场缓存 | — |
| **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` |
| **Preserved** | Data of other Agents, user configuration, global settings, market cache | — |
## 权限要求
## Permission Requirements
- 建议优先通过 `Bash` 工具调用 curl 访问 Agent Service HTTP API 完成操作
- API 基础地址已注入到 system prompt 的「本机 API」小节直接引用即可
- 删除操作需要用户显式确认(高风险操作)
- 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)
## 依赖
## Dependencies
- Agent Service HTTP API`DELETE /api/agents/{agentId}`
- System prompt 中的本机 API 地址声明
- Agent Service HTTP API (`DELETE /api/agents/{agentId}`)
- The Local API address declaration in the system prompt

View File

@@ -0,0 +1,210 @@
<!-- locale: zh-CN -->
# delete-agent 技能
## L0一句话摘要
安全删除指定的智能体及其关联数据,包括文件系统、内存状态和可选的会话历史。
## L1概述与使用场景
### 能力描述
delete-agent 是一个**元技能Meta-Skill**,赋予 DesireCore 安全删除其他智能体的能力。它会执行完整的前置检查、状态验证,并清理所有关联数据。
### 使用场景
- 用户想要清理不再使用的智能体
- 删除测试或实验性质的临时智能体
- 释放存储空间,删除旧智能体及其历史记录
- 用户明确要求"删除"、"移除"某个智能体
### 核心价值
- **安全性**:多重检查确保不会误删活跃智能体
- **完整性**:清理文件系统、内存状态、消息订阅等所有关联数据
- **可恢复性**:默认保留会话历史,可选择是否删除
## L2详细规范
### 执行流程
```
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ 列出可选 │ ──→ │ 确认意图 │ ──→ │ 询问选项 │
│ 智能体 │ │ 与目标 │ │ (删除历史?) │
└──────────────┘ └──────────────┘ └──────────────┘
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ 返回结果 │ ←── │ 执行删除 │ ←── │ 最终确认 │
│ 与回执 │ │ API 调用 │ │ │
└──────────────┘ └──────────────┘ └──────────────┘
```
### 阶段 1列出可删除的智能体
**触发条件**:用户表达删除意图但未指定具体智能体
**操作**
- 调用 `GET /api/agents` 获取所有智能体列表
- 筛选出状态为 `offline``error` 的智能体(可安全删除)
- 标注出 `online`/`busy`/`recovery` 状态的智能体(需先停止)
**输出示例**
```
可删除的智能体:
1. 法律顾问助手 (legal-assistant) - 状态: offline
2. 测试机器人 (test-bot) - 状态: offline
当前活跃的智能体(需先停止才能删除):
- 数据分析师 (data-analyst) - 状态: online
```
### 阶段 2确认用户意图与目标
**确认要点**
- 用户指定的智能体名称/ID
- 明确告知删除操作不可恢复
- 展示智能体基本信息供用户确认
**对话示例**
```
您要删除智能体 "法律顾问助手" (legal-assistant)。
⚠️ 警告:此操作不可恢复,该智能体的所有配置、技能、工具将被永久删除。
确认删除?(是/否)
```
### 阶段 3询问删除选项
**询问内容**
```
是否同时删除该智能体的所有会话历史?
- 是:删除智能体及其所有对话记录
- 否:保留会话历史,仅删除智能体本身
默认选项:否(保留历史)
```
**参数映射**
- 用户选择"是" → `deleteRuns=true`
- 用户选择"否" → `deleteRuns=false`(默认)
### 阶段 4最终确认
**确认摘要**
```
请确认删除操作:
- 目标智能体:法律顾问助手 (legal-assistant)
- 删除范围:智能体 + 会话历史(如用户选择)
- 风险等级:高(不可恢复)
确认执行删除?(是/否)
```
### 阶段 5执行删除 API 调用
**API 端点**`DELETE /api/agents/{agentId}`
**查询参数**
- `deleteRuns`: `'true'``'false'`
**请求示例**
```bash
curl -X DELETE "{agentServiceUrl}/api/agents/legal-assistant?deleteRuns=true"
```
> `{agentServiceUrl}` 取自 system prompt「本机 API」小节中的 Agent Service 地址。
### 阶段 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
}
}
```
**结果报告模板**
```
✅ 智能体 "法律顾问助手" 已成功删除
清理详情:
- 文件系统:已删除 2 个目录
- 调度器:已停止所有定时任务
- 消息订阅:已取消 3 个订阅
- MCP 连接:已关闭
- 会话历史:已删除 5 条记录
```
## 状态验证与错误处理
### 删除前状态检查
在阶段 1 列出智能体时,通过 `GET /api/agents` 筛选状态:
| 状态 | 可否删除 | 阶段 1 展示方式 |
| ------------------------------ | ----------- | ------------------------------ |
| `offline` / `error` | ✅ 可删除 | 列入"可删除"列表 |
| `online` / `busy` / `recovery` | ❌ 需先停止 | 标注"需先停止",不进入后续流程 |
**停止活跃智能体的方式**:通过 Socket.IO 发送 `agent:shutdown` 事件:
```yaml
事件: agent:shutdown
数据: { 'agentId': '<agent_id>' }
效果: 中止所有活跃会话 → 停止调度任务 → 状态转为 offline
```
> Agent 无法直接发送 Socket.IO 事件。如果目标智能体处于活跃状态,应提示用户在 UI 中手动停止,或等待其完成当前任务后再删除。
### API 错误码
| 错误码 | 场景 | 处理方式 |
| ------ | ---------------------------------------------------------------------------- | -------------------------------- |
| 400 | Agent ID 格式无效 | 提示用户检查智能体名称 |
| 404 | 智能体不存在 | 告知用户智能体已被删除或 ID 错误 |
| 409 | 智能体处于活跃状态API 返回 `Cannot delete agent "xxx": currently online` | 提示用户先在 UI 中停止智能体 |
| 500 | 服务器内部错误 | 提示用户稍后再试 |
## 删除范围说明
| 类别 | 删除内容 | 条件 |
| ------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| **始终删除** | AgentFS 目录配置、人格、规则、技能、工具、记忆、用户偏好数据、内存状态调度器、队列、消息订阅、MCP 连接)、注册表条目 | 无条件 |
| **可选删除** | 会话历史、话题索引 | `deleteRuns=true` |
| **保留不删** | 其他智能体数据、用户配置、全局设置、市场缓存 | — |
## 权限要求
- 建议优先通过 `Bash` 工具调用 curl 访问 Agent Service HTTP API 完成操作
- API 基础地址已注入到 system prompt 的「本机 API」小节直接引用即可
- 删除操作需要用户显式确认(高风险操作)
## 依赖
- Agent Service HTTP API`DELETE /api/agents/{agentId}`
- System prompt 中的本机 API 地址声明