feat(intelligence): complete migration to Rust backend
- Unify all intelligence modules to use intelligenceClient - Delete legacy TS implementations (agent-memory, reflection-engine, heartbeat-engine, context-compactor, agent-identity, memory-index) - Update all consumers to use snake_case backend types - Remove deprecated llm-integration.test.ts This eliminates code duplication between frontend and backend, resolves localStorage limitations, and enables persistent intelligence features. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,8 +15,10 @@
|
||||
* Reference: ZCLAW_AGENT_INTELLIGENCE_EVOLUTION.md §6.2.2
|
||||
*/
|
||||
|
||||
import { getMemoryManager, type MemoryType } from './agent-memory';
|
||||
import { getAgentIdentityManager } from './agent-identity';
|
||||
import {
|
||||
intelligenceClient,
|
||||
type MemoryType,
|
||||
} from './intelligence-client';
|
||||
import {
|
||||
getLLMAdapter,
|
||||
llmExtract,
|
||||
@@ -159,20 +161,19 @@ export class MemoryExtractor {
|
||||
console.log(`[MemoryExtractor] After importance filtering (>= ${this.config.minImportanceThreshold}): ${extracted.length} items`);
|
||||
|
||||
// Save to memory
|
||||
const memoryManager = getMemoryManager();
|
||||
let saved = 0;
|
||||
let skipped = 0;
|
||||
|
||||
for (const item of extracted) {
|
||||
try {
|
||||
await memoryManager.save({
|
||||
agentId,
|
||||
await intelligenceClient.memory.store({
|
||||
agent_id: agentId,
|
||||
memory_type: item.type,
|
||||
content: item.content,
|
||||
type: item.type,
|
||||
importance: item.importance,
|
||||
source: 'auto',
|
||||
tags: item.tags,
|
||||
conversationId,
|
||||
conversation_id: conversationId,
|
||||
});
|
||||
saved++;
|
||||
} catch {
|
||||
@@ -185,9 +186,8 @@ export class MemoryExtractor {
|
||||
const preferences = extracted.filter(e => e.type === 'preference' && e.importance >= 5);
|
||||
if (preferences.length > 0) {
|
||||
try {
|
||||
const identityManager = getAgentIdentityManager();
|
||||
const prefSummary = preferences.map(p => `- ${p.content}`).join('\n');
|
||||
identityManager.appendToUserProfile(agentId, `### 自动发现的偏好 (${new Date().toLocaleDateString('zh-CN')})\n${prefSummary}`);
|
||||
await intelligenceClient.identity.appendUserProfile(agentId, `### 自动发现的偏好 (${new Date().toLocaleDateString('zh-CN')})\n${prefSummary}`);
|
||||
userProfileUpdated = true;
|
||||
} catch (err) {
|
||||
console.warn('[MemoryExtractor] Failed to update USER.md:', err);
|
||||
|
||||
Reference in New Issue
Block a user