claude-memory-layer 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +204 -8
- package/dist/cli/index.js +37 -5
- package/dist/cli/index.js.map +2 -2
- package/dist/core/index.js +41 -5
- package/dist/core/index.js.map +2 -2
- package/dist/hooks/post-tool-use.js +35 -3
- package/dist/hooks/post-tool-use.js.map +2 -2
- package/dist/hooks/semantic-daemon.js +35 -3
- package/dist/hooks/semantic-daemon.js.map +2 -2
- package/dist/hooks/session-end.js +35 -3
- package/dist/hooks/session-end.js.map +2 -2
- package/dist/hooks/session-start.js +35 -3
- package/dist/hooks/session-start.js.map +2 -2
- package/dist/hooks/stop.js +35 -3
- package/dist/hooks/stop.js.map +2 -2
- package/dist/hooks/user-prompt-submit.js +35 -3
- package/dist/hooks/user-prompt-submit.js.map +2 -2
- package/dist/index.js +41 -5
- package/dist/index.js.map +2 -2
- package/dist/mcp/index.js +35 -3
- package/dist/mcp/index.js.map +2 -2
- package/dist/server/api/index.js +35 -3
- package/dist/server/api/index.js.map +2 -2
- package/dist/server/index.js +35 -3
- package/dist/server/index.js.map +2 -2
- package/dist/services/memory-service.js +35 -3
- package/dist/services/memory-service.js.map +2 -2
- package/package.json +6 -3
- package/scripts/postinstall-embedding-backend.cjs +141 -0
- package/src/apps/cli/index.ts +5 -1
- package/src/core/types.ts +2 -2
- package/src/extensions/vector/embedder.ts +39 -3
- package/tests/apps/postinstall-embedding-backend.test.ts +175 -0
- package/tests/extensions/embedder-warning-suppression.test.ts +30 -0
package/dist/mcp/index.js
CHANGED
|
@@ -11952,12 +11952,14 @@ import * as fs5 from "fs";
|
|
|
11952
11952
|
import * as path4 from "path";
|
|
11953
11953
|
|
|
11954
11954
|
// src/extensions/vector/embedder.ts
|
|
11955
|
+
var DEFAULT_EMBEDDING_MODEL = "Xenova/multilingual-e5-small";
|
|
11956
|
+
var DEFAULT_EMBEDDING_FALLBACK_MODEL = "intfloat/multilingual-e5-small";
|
|
11955
11957
|
var Embedder = class _Embedder {
|
|
11956
11958
|
pipeline = null;
|
|
11957
11959
|
modelName;
|
|
11958
11960
|
activeModelName;
|
|
11959
11961
|
initialized = false;
|
|
11960
|
-
constructor(modelName =
|
|
11962
|
+
constructor(modelName = DEFAULT_EMBEDDING_MODEL) {
|
|
11961
11963
|
this.modelName = modelName;
|
|
11962
11964
|
this.activeModelName = modelName;
|
|
11963
11965
|
}
|
|
@@ -11967,14 +11969,23 @@ var Embedder = class _Embedder {
|
|
|
11967
11969
|
async initialize() {
|
|
11968
11970
|
if (this.initialized)
|
|
11969
11971
|
return;
|
|
11970
|
-
const pipeline = await withSuppressedKnownTransformersWarnings(() =>
|
|
11972
|
+
const pipeline = await withSuppressedKnownTransformersWarnings(async () => {
|
|
11973
|
+
try {
|
|
11974
|
+
return await loadTransformersPipeline();
|
|
11975
|
+
} catch (error) {
|
|
11976
|
+
if (isMissingTransformersDependencyError(error)) {
|
|
11977
|
+
throw createEmbeddingBackendUnavailableError(error);
|
|
11978
|
+
}
|
|
11979
|
+
throw error;
|
|
11980
|
+
}
|
|
11981
|
+
});
|
|
11971
11982
|
try {
|
|
11972
11983
|
this.pipeline = await withSuppressedKnownTransformersWarnings(() => pipeline("feature-extraction", this.modelName));
|
|
11973
11984
|
this.activeModelName = this.modelName;
|
|
11974
11985
|
this.initialized = true;
|
|
11975
11986
|
return;
|
|
11976
11987
|
} catch (primaryError) {
|
|
11977
|
-
const fallbackModel = process.env.CLAUDE_MEMORY_EMBEDDING_FALLBACK_MODEL ||
|
|
11988
|
+
const fallbackModel = process.env.CLAUDE_MEMORY_EMBEDDING_FALLBACK_MODEL || DEFAULT_EMBEDDING_FALLBACK_MODEL;
|
|
11978
11989
|
if (fallbackModel === this.modelName) {
|
|
11979
11990
|
throw primaryError;
|
|
11980
11991
|
}
|
|
@@ -12093,6 +12104,27 @@ async function withSuppressedKnownTransformersWarnings(fn) {
|
|
|
12093
12104
|
function isKnownBenignTransformersWarning(message) {
|
|
12094
12105
|
return message.includes('Unknown model class "eurobert"') || message.includes('dtype not specified for "model"');
|
|
12095
12106
|
}
|
|
12107
|
+
function isMissingTransformersDependencyError(error) {
|
|
12108
|
+
const maybeError = error;
|
|
12109
|
+
const message = typeof maybeError?.message === "string" ? maybeError.message : "";
|
|
12110
|
+
return maybeError?.code === "ERR_MODULE_NOT_FOUND" && message.includes("@huggingface/transformers");
|
|
12111
|
+
}
|
|
12112
|
+
function createEmbeddingBackendUnavailableError(cause) {
|
|
12113
|
+
const error = new Error(
|
|
12114
|
+
[
|
|
12115
|
+
"Optional embedding backend is not installed.",
|
|
12116
|
+
"",
|
|
12117
|
+
"Claude Memory Layer can run embeddings on CPU-only ONNX Runtime; CUDA is not required.",
|
|
12118
|
+
"Reinstall globally with:",
|
|
12119
|
+
" ONNXRUNTIME_NODE_INSTALL_CUDA=skip npm install -g claude-memory-layer@latest",
|
|
12120
|
+
"",
|
|
12121
|
+
"If you are inside a local checkout or package directory, repair only the backend with:",
|
|
12122
|
+
" ONNXRUNTIME_NODE_INSTALL_CUDA=skip npm install --no-save --no-package-lock --omit=dev @huggingface/transformers@3.8.1"
|
|
12123
|
+
].join("\n")
|
|
12124
|
+
);
|
|
12125
|
+
error.cause = cause;
|
|
12126
|
+
return error;
|
|
12127
|
+
}
|
|
12096
12128
|
async function loadTransformersPipeline() {
|
|
12097
12129
|
const dynamicImport = new Function("specifier", "return import(specifier)");
|
|
12098
12130
|
const transformers = await dynamicImport("@huggingface/transformers");
|