feat: Add DefaultEmbeddingFunction for local vector embeddings

- Added @chroma-core/default-embed dependency for local embeddings
- Updated ChromaSync to use DefaultEmbeddingFunction with collections
- Added isServerReachable() async method for reliable server detection
- Fixed start() to detect and reuse existing Chroma servers
- Updated build script to externalize native ONNX binaries
- Added runtime dependency to plugin/package.json

The embedding function uses all-MiniLM-L6-v2 model locally via ONNX,
eliminating need for external embedding API calls.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
bigphoot
2026-01-23 23:28:38 -08:00
committed by bigphoot
parent 70d6ac9daf
commit 2c304eafad
5 changed files with 62 additions and 9 deletions

View File

@@ -58,7 +58,10 @@ async function buildHooks() {
private: true,
description: 'Runtime dependencies for claude-mem bundled hooks',
type: 'module',
dependencies: {},
dependencies: {
// Chroma embedding function with native ONNX binaries (can't be bundled)
'@chroma-core/default-embed': '^0.1.9'
},
engines: {
node: '>=18.0.0',
bun: '>=1.0.0'
@@ -94,9 +97,12 @@ async function buildHooks() {
logLevel: 'error', // Suppress warnings (import.meta warning is benign)
external: [
'bun:sqlite',
// Optional chromadb embedding providers (not needed for HTTP client mode)
// Optional chromadb embedding providers
'cohere-ai',
'ollama'
'ollama',
// Default embedding function with native binaries
'@chroma-core/default-embed',
'onnxruntime-node'
],
define: {
'__DEFAULT_PACKAGE_VERSION__': `"${version}"`