claude-memory-layer 1.0.30 → 1.0.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-memory-layer",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Claude Code plugin that learns from conversations to provide personalized assistance",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -40,18 +40,16 @@
40
40
  "node": ">=18.0.0"
41
41
  },
42
42
  "dependencies": {
43
- "@hono/node-server": "^1.13.0",
43
+ "@hono/node-server": "^1.19.14",
44
+ "@huggingface/transformers": "^3.8.1",
44
45
  "@lancedb/lancedb": "^0.5.0",
45
46
  "@modelcontextprotocol/sdk": "^1.29.0",
46
47
  "better-sqlite3": "^12.6.2",
47
48
  "commander": "^12.0.0",
48
- "hono": "^4.0.0",
49
+ "hono": "^4.12.18",
49
50
  "mongodb": "^6.14.0",
50
51
  "zod": "^3.22.0"
51
52
  },
52
- "optionalDependencies": {
53
- "@huggingface/transformers": "^3.8.1"
54
- },
55
53
  "devDependencies": {
56
54
  "@types/better-sqlite3": "^7.6.13",
57
55
  "@types/node": "^20.11.0",
@@ -45,8 +45,6 @@ function detectCudaMajor({ env = process.env, execFileSyncImpl = execFileSync }
45
45
 
46
46
  function isSkipRequested(env = process.env) {
47
47
  if (env[SKIP_ENV] === '1' || env[REPAIR_GUARD_ENV] === '1') return true;
48
- if (env.npm_config_optional === 'false') return true;
49
- if (String(env.npm_config_omit || '').split(',').map((item) => item.trim()).includes('optional')) return true;
50
48
  return false;
51
49
  }
52
50
 
@@ -103,7 +101,7 @@ function runPostinstall({
103
101
  return { attempted: false, cudaMajor, transformersAvailable, skipRequested };
104
102
  }
105
103
 
106
- log('[claude-memory-layer] Optional embedding backend is missing on Linux x64. Installing CPU-only embedding backend...');
104
+ log('[claude-memory-layer] Required embedding backend is missing on Linux x64. Repairing with CPU-only ONNX Runtime...');
107
105
 
108
106
  const npmCommand = platform === 'win32' ? 'npm.cmd' : 'npm';
109
107
  const result = spawnSyncImpl(npmCommand, createNpmInstallArgs(), {
@@ -113,13 +111,13 @@ function runPostinstall({
113
111
  });
114
112
 
115
113
  if (result.error || result.status !== 0) {
116
- warn('[claude-memory-layer] Optional embedding backend repair failed. Claude Memory Layer is installed, but semantic/vector embeddings may be unavailable until you run:');
114
+ warn('[claude-memory-layer] Required embedding backend repair failed. Semantic/vector embeddings may be unavailable until you run:');
117
115
  warn(` ONNXRUNTIME_NODE_INSTALL_CUDA=skip npm install -g claude-memory-layer@latest`);
118
116
  if (result.error) warn(` ${result.error.message}`);
119
117
  return { attempted: true, success: false, cudaMajor, transformersAvailable, skipRequested };
120
118
  }
121
119
 
122
- log('[claude-memory-layer] Optional embedding backend installed with CPU-only ONNX Runtime.');
120
+ log('[claude-memory-layer] Required embedding backend repaired with CPU-only ONNX Runtime.');
123
121
  return { attempted: true, success: true, cudaMajor, transformersAvailable, skipRequested };
124
122
  }
125
123
 
@@ -208,9 +208,10 @@ export function isMissingTransformersDependencyError(error: unknown): boolean {
208
208
  export function createEmbeddingBackendUnavailableError(cause: unknown): Error & { cause?: unknown } {
209
209
  const error = new Error(
210
210
  [
211
- 'Optional embedding backend is not installed.',
211
+ 'Required embedding backend is not installed.',
212
212
  '',
213
- 'Claude Memory Layer can run embeddings on CPU-only ONNX Runtime; CUDA is not required.',
213
+ 'Claude Memory Layer requires @huggingface/transformers for local semantic/vector embeddings.',
214
+ 'The backend runs on CPU-only ONNX Runtime; CUDA is not required.',
214
215
  'Reinstall globally with:',
215
216
  ' ONNXRUNTIME_NODE_INSTALL_CUDA=skip npm install -g claude-memory-layer@latest',
216
217
  '',
@@ -16,6 +16,7 @@ type SpawnCall = {
16
16
  type PostinstallEmbeddingBackend = {
17
17
  EMBEDDING_BACKEND_PACKAGE: string;
18
18
  parseCudaMajor(output: string): number | null;
19
+ isSkipRequested(env: NodeJS.ProcessEnv): boolean;
19
20
  shouldAttemptAutoInstall(input: {
20
21
  platform: NodeJS.Platform;
21
22
  arch: string;
@@ -42,20 +43,29 @@ function loadPostinstallModule(): PostinstallEmbeddingBackend {
42
43
  }
43
44
 
44
45
  describe('embedding backend postinstall repair', () => {
45
- it('keeps the install-time embedding backend optional and registers postinstall repair', () => {
46
+ it('requires the embedding backend at install time and registers a broken-install repair hook', () => {
46
47
  const pkg = JSON.parse(readFileSync('package.json', 'utf-8')) as {
47
48
  scripts: Record<string, string>;
48
49
  dependencies?: Record<string, string>;
49
50
  optionalDependencies?: Record<string, string>;
50
51
  };
51
52
 
52
- expect(pkg.dependencies).not.toHaveProperty('@huggingface/transformers');
53
- expect(pkg.optionalDependencies).toMatchObject({
53
+ expect(pkg.dependencies).toMatchObject({
54
54
  '@huggingface/transformers': '^3.8.1'
55
55
  });
56
+ expect(pkg.optionalDependencies ?? {}).not.toHaveProperty('@huggingface/transformers');
56
57
  expect(pkg.scripts.postinstall).toBe('node scripts/postinstall-embedding-backend.cjs');
57
58
  });
58
59
 
60
+ it('only skips required-backend repair when the explicit repair guards are set', () => {
61
+ const postinstall = loadPostinstallModule();
62
+
63
+ expect(postinstall.isSkipRequested({ CLAUDE_MEMORY_LAYER_SKIP_EMBEDDING_POSTINSTALL: '1' })).toBe(true);
64
+ expect(postinstall.isSkipRequested({ CLAUDE_MEMORY_LAYER_EMBEDDING_POSTINSTALL_REPAIR: '1' })).toBe(true);
65
+ expect(postinstall.isSkipRequested({ npm_config_optional: 'false' })).toBe(false);
66
+ expect(postinstall.isSkipRequested({ npm_config_omit: 'optional' })).toBe(false);
67
+ });
68
+
59
69
  it('detects CUDA major version from nvcc output', () => {
60
70
  const postinstall = loadPostinstallModule();
61
71
 
@@ -140,7 +150,7 @@ describe('embedding backend postinstall repair', () => {
140
150
  ]);
141
151
  });
142
152
 
143
- it('runs the automatic repair command when Linux x64 skipped the optional backend without detectable CUDA', () => {
153
+ it('runs the repair command when Linux x64 is missing the required backend without detectable CUDA', () => {
144
154
  const postinstall = loadPostinstallModule();
145
155
  const rootDir = mkdtempSync(join(tmpdir(), 'cml-postinstall-test-'));
146
156
  const calls: SpawnCall[] = [];
@@ -20,7 +20,7 @@ describe('Embedder warning suppression', () => {
20
20
  expect(parsedConfig.embedding.openaiModel).toBe(DEFAULT_EMBEDDING_MODEL);
21
21
  });
22
22
 
23
- it('turns missing optional @huggingface/transformers errors into actionable install guidance', () => {
23
+ it('turns missing required @huggingface/transformers errors into actionable install guidance', () => {
24
24
  const missingBackendError = Object.assign(
25
25
  new Error("Cannot find package '@huggingface/transformers' imported from /tmp/dist/cli/index.js"),
26
26
  { code: 'ERR_MODULE_NOT_FOUND' }
@@ -30,7 +30,8 @@ describe('Embedder warning suppression', () => {
30
30
  expect(isMissingTransformersDependencyError(new Error('network failure'))).toBe(false);
31
31
 
32
32
  const friendly = createEmbeddingBackendUnavailableError(missingBackendError);
33
- expect(friendly.message).toContain('Optional embedding backend is not installed');
33
+ expect(friendly.message).toContain('Required embedding backend is not installed');
34
+ expect(friendly.message).toContain('Claude Memory Layer requires @huggingface/transformers');
34
35
  expect(friendly.message).toContain('ONNXRUNTIME_NODE_INSTALL_CUDA=skip npm install -g claude-memory-layer@latest');
35
36
  expect(friendly.message).toContain('ONNXRUNTIME_NODE_INSTALL_CUDA=skip npm install --no-save --no-package-lock --omit=dev @huggingface/transformers@3.8.1');
36
37
  expect(friendly.cause).toBe(missingBackendError);