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

@@ -311,7 +311,7 @@ test.describe('Hands 系统数据流验证', () => {
// 2. 刷新 Hands 数据
await page.reload();
await waitForAppReady(page);
await navigateToTab(page, 'Hands');
await navigateToTab(page, '自动化');
await page.waitForTimeout(2000);
// 3. 验证 API 请求
@@ -320,19 +320,20 @@ test.describe('Hands 系统数据流验证', () => {
// 4. Hand Store 不持久化,检查运行时状态
// 通过检查 UI 来验证
// 5. 验证 UI 渲染
const handCards = page.locator('.bg-white.dark\\:bg-gray-800, .rounded-lg.border').filter({
hasText: /Browser|Collector|Researcher|Predictor|能力包/i,
// 5. 验证 UI 渲染 - 使用更健壮的选择器
const handCards = page.locator('[class*="bg-white"][class*="rounded-lg"]').filter({
hasText: /Browser|Collector|Researcher|Predictor|Clip|Lead|Twitter|自主能力|能力包/i,
});
const count = await handCards.count();
console.log(`Hand cards found: ${count}`);
expect(count).toBeGreaterThanOrEqual(0);
});
test('HAND-DF-02: 触发 Hand 执行数据流', async ({ page }) => {
// 1. 查找可用的 Hand 卡片
const handCards = page.locator('.bg-white.dark\\:bg-gray-800, .rounded-lg.border').filter({
hasText: /Browser|Collector|Researcher|Predictor/i,
// 1. 查找可用的 Hand 卡片 - 使用更健壮的选择器
const handCards = page.locator('[class*="bg-white"][class*="rounded-lg"]').filter({
hasText: /Browser|Collector|Researcher|Predictor|Clip|Lead|Twitter|自主能力/i,
});
const count = await handCards.count();
@@ -345,11 +346,11 @@ test.describe('Hands 系统数据流验证', () => {
await handCards.first().click();
await page.waitForTimeout(500);
// 3. 查找激活按钮
const activateBtn = page.getByRole('button', { name: /激活|activate|run/i });
// 3. 查找执行按钮UI 已改为"执行"而非"激活"
const activateBtn = page.getByRole('button', { name: /执行|激活|activate|run|execute/i });
if (await activateBtn.isVisible()) {
// 4. 点击激活并验证请求
// 4. 点击执行并验证请求
const [request] = await Promise.all([
page.waitForRequest('**/api/hands/**/activate**', { timeout: 10000 }).catch(
() => page.waitForRequest('**/api/hands/**/trigger**', { timeout: 10000 }).catch(() => null)
@@ -366,9 +367,9 @@ test.describe('Hands 系统数据流验证', () => {
});
test('HAND-DF-03: Hand 参数表单数据流', async ({ page }) => {
// 1. 找到 Hand 卡片
const handCards = page.locator('.bg-white.dark\\:bg-gray-800, .rounded-lg.border').filter({
hasText: /Browser|Collector|Researcher|Predictor/i,
// 1. 找到 Hand 卡片 - 使用更健壮的选择器
const handCards = page.locator('[class*="bg-white"][class*="rounded-lg"]').filter({
hasText: /Browser|Collector|Researcher|Predictor|Clip|Lead|Twitter|自主能力/i,
});
if (await handCards.first().isVisible()) {