feat(memory): refuse to open a memory store with a different embedder

Vectors of different models are not comparable even at the same size; the
store records its embedder in waggle-memory.json and names the mismatch.
Also drop the weaver references from the cli and server tsconfigs.
This commit is contained in:
shumeiko.it
2026-10-24 12:06:10 +02:00
parent 8b5624520c
commit 8555d84b75
6 changed files with 55 additions and 9 deletions

View File

@@ -32,11 +32,12 @@ export async function openMemoryStore(options: OpenMemoryOptions): Promise<Memor
* model download; tests use it. Otherwise memory uses the in-process model,
* loaded on first use so startup never waits for a download.
*/
function memoryEmbedder(options: OpenMemoryOptions): Embedder {
function memoryEmbedder(options: OpenMemoryOptions): Embedder & { id?: string } {
if (process.env.WAGGLE_MEMORY_EMBEDDER === 'words') {
const words = createWordEmbedder();
return {
dimensions: words.dimensions,
id: words.id,
embed: async (text) => Float32Array.from(await words.embed(text)),
embedBatch: async (texts) => (await words.embedBatch(texts)).map((v) => Float32Array.from(v)),
};

View File

@@ -12,7 +12,6 @@
"@waggle/hive-mind-core": ["../hive-mind-core/src/index.ts"],
"@waggle/marketplace": ["../marketplace/src/index.ts"],
"@waggle/waggle-dance": ["../waggle-dance/src/index.ts"],
"@waggle/weaver": ["../weaver/src/index.ts"],
"@waggle/sdk": ["../sdk/src/index.ts"]
}
},