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

@@ -110,8 +110,8 @@ key = value
it('should handle multiple env vars', () => {
const content = `
key1 = "${VAR1}"
key2 = "${VAR2}"
key1 = "\${VAR1}"
key2 = "\${VAR2}"
`;
const envVars = { VAR1: 'value1', VAR2: 'value2' };
const result = tomlUtils.resolveEnvVars(content, envVars);
@@ -124,7 +124,7 @@ key2 = "${VAR2}"
it('should parse TOML with env var resolution', () => {
const content = `
[config]
api_key = "${API_KEY}"
api_key = "\${API_KEY}"
model = "gpt-4"
`;
const envVars = { API_KEY: 'test-key-456' };
@@ -153,9 +153,9 @@ model = "gpt-4"
describe('extractEnvVarNames', () => {
it('should extract all env var names', () => {
const content = `
key1 = "${VAR1}"
key2 = "${VAR2}"
key1 = "${VAR1}"
key1 = "\${VAR1}"
key2 = "\${VAR2}"
key1 = "\${VAR1}"
`;
const result = tomlUtils.extractEnvVarNames(content);
expect(result).toEqual(['VAR1', 'VAR2']);