feat(automation): complete unified automation system redesign

Phase 4 completion:
- Add ApprovalQueue component for managing pending approvals
- Add ExecutionResult component for displaying hand/workflow results
- Update Sidebar navigation to use unified AutomationPanel
- Replace separate 'hands' and 'workflow' tabs with single 'automation' tab
- Fix TypeScript type safety issues with unknown types in JSX expressions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-03-18 17:12:05 +08:00
parent 3a7631e035
commit 3518fc8ece
74 changed files with 4984 additions and 687 deletions

View File

@@ -3,18 +3,28 @@
> **分类**: 智能层
> **优先级**: P1 - 重要
> **成熟度**: L4 - 生产
> **最后更新**: 2026-03-17
> **最后更新**: 2026-03-18
---
## ✅ UI 集成状态
## ✅ 集成状态
> **当前状态**: ✅ 集成
> **当前状态**: ✅ 完全集成
>
> `AutonomyConfig.tsx` 组件已集成到 `RightPanel.tsx` 的 'autonomy' tab。
>
> **集成位置**: RightPanel 'autonomy' tab (点击 Shield 图标)
### 已集成的系统
| 系统 | 文件 | 集成状态 | 说明 |
|------|------|---------|------|
| 反思引擎 | `reflection-engine.ts` | ✅ 已集成 | 反思运行前检查授权 |
| 上下文压缩 | `context-compactor.ts` | ✅ 已集成 | 压缩执行前检查授权 |
| 身份更新 | `agent-identity.ts` | ✅ 已集成 | 身份变更前检查授权 |
| 技能安装 | `skill-discovery.ts` | ✅ 已集成 | 技能安装/卸载前检查授权 |
| 记忆提取 | `session-persistence.ts` | ✅ 已集成 | 记忆保存前检查授权 |
---
## 一、功能概述
@@ -27,7 +37,7 @@
|------|-----|
| 分类 | 智能层 |
| 优先级 | P1 |
| 成熟度 | L2 (降级UI 未集成) |
| 成熟度 | L4 |
| 依赖 | AuditLog, ApprovalWorkflow |
### 1.2 相关文件
@@ -35,8 +45,8 @@
| 文件 | 路径 | 用途 | 集成状态 |
|------|------|------|---------|
| 核心实现 | `desktop/src/lib/autonomy-manager.ts` | 授权逻辑 | ✅ 存在 |
| 配置 UI | `desktop/src/components/AutonomyConfig.tsx` | 配置界面 | **未集成** |
| 审批 UI | `desktop/src/components/ApprovalsPanel.tsx` | 审批界面 | **未集成** |
| 配置 UI | `desktop/src/components/AutonomyConfig.tsx` | 配置界面 | ✅ 已集成 |
| 审批 UI | `desktop/src/components/ApprovalsPanel.tsx` | 审批界面 | ✅ 已集成 |
---
@@ -76,8 +86,8 @@
| 等级 | 操作类型 | Supervised | Assisted | Autonomous |
|------|---------|------------|----------|------------|
| Low | memory_save, reflection_run | 需确认 | 自动 | 自动 |
| Medium | hand_trigger, config_change | 需确认 | 需确认 | 自动 |
| Low | memory_save, reflection_run, compaction_run | 需确认 | 自动 | 自动 |
| Medium | hand_trigger, config_change, skill_install | 需确认 | 需确认 | 自动 |
| High | memory_delete, identity_update | 需确认 | 需确认 | 需确认 |
### 2.5 设计约束
@@ -112,6 +122,29 @@ interface AutonomyManager {
创建审批请求 → 用户批准/拒绝
```
### 3.3 集成模式
各系统集成自主检查的统一模式:
```typescript
import { canAutoExecute } from './autonomy-manager';
async function someOperation(options?: { skipAutonomyCheck?: boolean }) {
// 自主检查
if (!options?.skipAutonomyCheck) {
const { canProceed, decision } = canAutoExecute('action_type', importance);
if (!canProceed) {
console.log(`[Module] Autonomy check failed: ${decision.reason}`);
return; // 或返回默认结果
}
console.log(`[Module] Autonomy check passed: ${decision.reason}`);
}
// 执行实际操作
// ...
}
```
---
## 四、实际效果
@@ -125,6 +158,10 @@ interface AutonomyManager {
- [x] 操作回滚 (lib)
- [x] 审批过期 (lib)
- [x] **UI 审批面板** - ✅ 已集成到 RightPanel 'autonomy' tab
- [x] **反思引擎集成** - ✅ 2026-03-18
- [x] **上下文压缩集成** - ✅ 2026-03-18
- [x] **身份更新集成** - ✅ 2026-03-18
- [x] **技能安装集成** - ✅ 2026-03-18
### 4.2 已知问题
@@ -138,6 +175,10 @@ interface AutonomyManager {
## 五、演化路线
### 5.1 短期计划1-2 周)
- [x] 集成反思引擎
- [x] 集成上下文压缩
- [x] 集成身份更新
- [x] 集成技能安装
- [ ] 优化审批 UI
- [ ] 添加批量审批