feat(core): give Waggle its own database, apart from memory (P1.5)
Waggle kept its own tables in the memory database. Before the memory
engine can be replaced by mem0 they need a home of their own.
- add WaggleDB (<dataDir>/waggle.db). Automations, notifications, held
actions, skill hashes, thumbs feedback, cost tracking, the profile card
and awareness items live there. Their stores take a WaggleDB, so passing
a memory database is a type error.
- the profile card and awareness items are now per scope ('personal' or
'workspace:<id>') in one table each, instead of one table per .mind file
- on the first start, copy these tables from personal.mind and every
workspace.mind (importLegacyMindData). The legacy files are only read,
each scope is copied once and a table only while its target is empty.
- copy the logger, injection scanner, external-memory ingress guard,
WorkspaceManager and the embedders from @waggle/hive-mind-core into
@waggle/core, which now re-exports its own copies
- point the server, agent orchestrator and CLI at waggle.db; update the
tests that seeded these tables in a memory database
ADR-0007 records the layout and the licensing question about the copied
files.
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
SessionStore,
|
||||
HybridSearch,
|
||||
KnowledgeGraph,
|
||||
WaggleDB,
|
||||
createCoreLogger,
|
||||
evaluateExternalMemoryIngress,
|
||||
type Embedder,
|
||||
@@ -71,6 +72,12 @@ import {
|
||||
|
||||
export interface OrchestratorConfig {
|
||||
db: MindDB;
|
||||
/**
|
||||
* Waggle's own database, which holds the profile card and awareness items.
|
||||
* Omitting it keeps them in memory for the lifetime of the orchestrator;
|
||||
* only tests should do that.
|
||||
*/
|
||||
waggleDb?: WaggleDB;
|
||||
embedder: Embedder;
|
||||
apiKey?: string;
|
||||
model?: string;
|
||||
@@ -161,8 +168,9 @@ export class Orchestrator {
|
||||
this.skills = config.skills ?? [];
|
||||
this.rerankerCacheDir = config.rerankerCacheDir;
|
||||
this.goalAncestry = config.goalAncestry ?? null;
|
||||
this.identity = new IdentityLayer(config.db);
|
||||
this.awareness = new AwarenessLayer(config.db);
|
||||
const waggleDb = config.waggleDb ?? new WaggleDB(':memory:');
|
||||
this.identity = new IdentityLayer(waggleDb);
|
||||
this.awareness = new AwarenessLayer(waggleDb);
|
||||
this.frames = new FrameStore(config.db);
|
||||
this.sessions = new SessionStore(config.db);
|
||||
this.search = new HybridSearch(config.db, config.embedder);
|
||||
|
||||
Reference in New Issue
Block a user