feat: complete Phase 1-3 architecture optimization

Phase 1 - Security:
- Add AES-GCM encryption for localStorage fallback
- Enforce WSS protocol for non-localhost WebSocket connections
- Add URL sanitization to prevent XSS in markdown links

Phase 2 - Domain Reorganization:
- Create Intelligence Domain with Valtio store and caching
- Add unified intelligence-client for Rust backend integration
- Migrate from legacy agent-memory, heartbeat, reflection modules

Phase 3 - Core Optimization:
- Add virtual scrolling for ChatArea with react-window
- Implement LRU cache with TTL for intelligence operations
- Add message virtualization utilities

Additional:
- Add OpenFang compatibility test suite
- Update E2E test fixtures
- Add audit logging infrastructure
- Update project documentation and plans

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-03-21 22:11:50 +08:00
parent 815c56326b
commit ce562e8bfc
36 changed files with 5241 additions and 201 deletions

View File

@@ -23,7 +23,7 @@ ZCLAW 是面向中文用户的 AI Agent 桌面端,核心能力包括:
- ❌ 只为兼容其他系统的妥协 → 谨慎评估
- ❌ 增加复杂度但无实际价值 → 不做
---
***
## 2. 项目结构
@@ -50,16 +50,16 @@ ZCLAW/
### 2.2 技术栈
| 层级 | 技术 |
|------|------|
| 层级 | 技术 |
| ---- | --------------------- |
| 前端框架 | React 18 + TypeScript |
| 状态管理 | Zustand |
| 桌面框架 | Tauri 2.x |
| 样式方案 | Tailwind CSS |
| 配置格式 | TOML |
| 后端服务 | Rust (端口 50051) |
| 状态管理 | Zustand |
| 桌面框架 | Tauri 2.x |
| 样式方案 | Tailwind CSS |
| 配置格式 | TOML |
| 后端服务 | Rust (端口 50051) |
---
***
## 3. 工作风格
@@ -87,7 +87,7 @@ ZCLAW/
1. 定位问题 → 2. 建立心智模型 → 3. 最小修复 → 4. 自动验证 → 5. 记录沉淀
---
***
## 4. 实现规则
@@ -101,7 +101,8 @@ ZCLAW/
**禁止**在组件内直接创建 WebSocket 或拼装 HTTP 请求。
### 4.2 発能层客户端
```
````
UI 组件 → 只负责展示和交互
Store → 负责状态组织和流程编排
Client → 负责网络通信和```
@@ -257,7 +258,7 @@ pnpm vitest run
# 启动开发环境
pnpm start:dev
```
````
### 7.3 人工验证清单
@@ -267,7 +268,7 @@ pnpm start:dev
- [ ] Hand 触发是否正常执行
- [ ] 配置保存是否持久化
---
***
## 8. 文档管理
@@ -290,7 +291,7 @@ docs/
- **面向未来** - 文档要帮助未来的开发者快速理解
- **中文优先** - 所有面向用户的文档使用中文
---
***
## 9. 常见问题排查
@@ -312,7 +313,7 @@ docs/
2. 检查环境变量是否设置
3. 检查配置文件路径
---
***
## 10. 常用命令
@@ -339,7 +340,7 @@ pnpm vitest run
pnpm start:stop
```
---
***
## 11. 提交规范
@@ -348,6 +349,7 @@ pnpm start:stop
```
**类型:**
- `feat` - 新功能
- `fix` - 修复问题
- `refactor` - 重构
@@ -356,13 +358,14 @@ pnpm start:stop
- `chore` - 杂项
**示例:**
```
feat(hands): 添加参数预设保存功能
fix(chat): 修复流式响应中断问题
refactor(store): 统一 Store 数据获取方式
```
---
***
## 12. 安全注意事项
@@ -370,3 +373,4 @@ refactor(store): 统一 Store 数据获取方式
- 用户输入必须验证
- 敏感操作需要确认
- 保留操作审计日志