P0-P2: heartbeat→mind wiring, structured JSON output, bge-m3 embeddings

This commit is contained in:
n1kt4r committed 2026-09-14 16:20:45 +05:00
1 parent 702700dcb9
commit a6fde100ca
9 files changed
+184 -35

No files matched your search

+8 -2
View File
@@ -15,11 +15,14 @@ import { Heartbeat, DEFAULT_CONFIG } from './src/heartbeat.js';
import { MemorySystem } from './src/memory.js';
import { DEFAULT_PERSONA } from './src/persona.js';
import { Mind, SparkLLMClient } from './src/mind.js';
import { OllamaEmbeddingClient } from './src/embedding.js';
const HEARTBEAT_MS = 5 * 60 * 1000; // 5 мин — idle-мысли
const heartbeat = new Heartbeat({ intervalMs: HEARTBEAT_MS });
const memory = new MemorySystem(10); // last 10 thoughts
// Embeddings: bge-m3 (dim=1024) — та же модель, что в content-atom
const embedding = new OllamaEmbeddingClient('http://localhost:11434');
const memory = new MemorySystem(10, embedding); // last 10 thoughts
const mind = new Mind(
heartbeat,
memory,
@@ -27,11 +30,14 @@ const mind = new Mind(
new SparkLLMClient('http://localhost:11434'), // Ollama: Spark X2.5-4B
);
// Подключаем heartbeat к оркестратору — теперь тики реально обрабатываются
heartbeat.setOnTick((trigger) => mind.handleTick(trigger));
// Старт heartbeat
heartbeat.start();
console.log('[spark-mind] started — heartbeat every', HEARTBEAT_MS / 1000, 's');
// Демо: симулируем тик через 10 сек (в прода — реальные триггеры)
setTimeout(() => {
void mind.handleTick({ type: 'interval' });
void mind.handleTick({ type: 'message', contactId: 'demo', text: 'Привет' });
}, 10_000);