@pcircle/memesh 4.2.1 → 4.2.3
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/dist/mcp/launcher.d.ts +3 -0
- package/dist/mcp/launcher.d.ts.map +1 -0
- package/dist/mcp/launcher.js +37 -0
- package/dist/mcp/launcher.js.map +1 -0
- package/dist/skills-manifest.json +4 -4
- package/dist/transports/schemas.d.ts +4 -4
- package/dist/transports/schemas.d.ts.map +1 -1
- package/dist/transports/schemas.js +7 -3
- package/dist/transports/schemas.js.map +1 -1
- package/package.json +5 -3
- package/scripts/hooks/_shared.js +45 -8
- package/scripts/postinstall-rebuild.mjs +41 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../src/mcp/launcher.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { execFileSync, spawnSync } from 'child_process';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname, join } from 'path';
|
|
6
|
+
const _require = createRequire(import.meta.url);
|
|
7
|
+
const _dir = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
function hasBinary() {
|
|
9
|
+
try {
|
|
10
|
+
const Db = _require('better-sqlite3');
|
|
11
|
+
new Db(':memory:').close();
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (!hasBinary() && !process.env.MEMESH_REBUILD_ATTEMPTED) {
|
|
19
|
+
const cwd = join(_dir, '../..');
|
|
20
|
+
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
21
|
+
try {
|
|
22
|
+
process.stderr.write('[memesh-mcp] better-sqlite3 binding missing — rebuilding native addon...\n');
|
|
23
|
+
execFileSync(npm, ['rebuild', 'better-sqlite3'], { cwd, stdio: 'pipe' });
|
|
24
|
+
process.stderr.write('[memesh-mcp] Rebuild complete — restarting server.\n');
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
28
|
+
process.stderr.write(`[memesh-mcp] Rebuild failed (${msg}). Server will likely fail to start.\n`);
|
|
29
|
+
}
|
|
30
|
+
const result = spawnSync(process.execPath, [fileURLToPath(import.meta.url)], {
|
|
31
|
+
stdio: 'inherit',
|
|
32
|
+
env: { ...process.env, MEMESH_REBUILD_ATTEMPTED: '1' },
|
|
33
|
+
});
|
|
34
|
+
process.exit(result.status ?? 1);
|
|
35
|
+
}
|
|
36
|
+
await import('./server.js');
|
|
37
|
+
//# sourceMappingURL=launcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../src/mcp/launcher.ts"],"names":[],"mappings":";AAiBA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAErC,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAErD,SAAS,SAAS;IAKhB,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtC,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;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@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "memesh.skills-manifest/v1",
|
|
3
|
-
"generated_at": "2026-05-
|
|
3
|
+
"generated_at": "2026-05-12T10:49:49.582Z",
|
|
4
4
|
"entries": [
|
|
5
5
|
{
|
|
6
6
|
"path": ".claude-plugin/plugin.json",
|
|
7
|
-
"sha256": "
|
|
7
|
+
"sha256": "ef28cf1f30a545f5d1fbb3d6459b97814f5187c601db5f62ff5be346a6d3ea58",
|
|
8
8
|
"bytes": 441
|
|
9
9
|
},
|
|
10
10
|
{
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"path": "scripts/hooks/_shared.js",
|
|
22
|
-
"sha256": "
|
|
23
|
-
"bytes":
|
|
22
|
+
"sha256": "230c2e5005eaefcb6b7689124265fc71da1417382a95f19e2435a42ec195c058",
|
|
23
|
+
"bytes": 28624
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"path": "scripts/hooks/post-commit.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const RememberSchema: z.ZodObject<{
|
|
3
|
-
name: z.ZodString
|
|
3
|
+
name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
4
4
|
type: z.ZodString;
|
|
5
5
|
observations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6
6
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -27,7 +27,7 @@ export declare const RecallSchema: z.ZodObject<{
|
|
|
27
27
|
cross_project: z.ZodOptional<z.ZodBoolean>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
export declare const ForgetSchema: z.ZodObject<{
|
|
30
|
-
name: z.ZodString
|
|
30
|
+
name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
31
31
|
observation: z.ZodOptional<z.ZodString>;
|
|
32
32
|
}, z.core.$strip>;
|
|
33
33
|
export declare const ConsolidateSchema: z.ZodObject<{
|
|
@@ -45,7 +45,7 @@ export declare const ExportResultSchema: z.ZodObject<{
|
|
|
45
45
|
exported_at: z.ZodString;
|
|
46
46
|
entity_count: z.ZodNumber;
|
|
47
47
|
entities: z.ZodArray<z.ZodObject<{
|
|
48
|
-
name: z.ZodString
|
|
48
|
+
name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
49
49
|
type: z.ZodString;
|
|
50
50
|
namespace: z.ZodString;
|
|
51
51
|
observations: z.ZodArray<z.ZodString>;
|
|
@@ -62,7 +62,7 @@ export declare const ImportSchema: z.ZodObject<{
|
|
|
62
62
|
exported_at: z.ZodString;
|
|
63
63
|
entity_count: z.ZodNumber;
|
|
64
64
|
entities: z.ZodArray<z.ZodObject<{
|
|
65
|
-
name: z.ZodString
|
|
65
|
+
name: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
66
66
|
type: z.ZodString;
|
|
67
67
|
namespace: z.ZodString;
|
|
68
68
|
observations: z.ZodArray<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/transports/schemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/transports/schemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;iBAUzB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;iBAOvB,CAAC;AAEH,eAAO,MAAM,YAAY;;;iBAGvB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;iBAI5B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;iBAIvB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;iBAY7B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;iBAIvB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;iBAMtB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;iBAG7B,CAAC;AAOH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoBhC,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
const sanitizeName = (s) => s.replace(/[\r\n\t]+/g, ' ').trim();
|
|
3
|
+
const nameField = z.string().min(1).max(255).transform(sanitizeName).refine(s => s.length > 0, {
|
|
4
|
+
message: 'Name must not be blank after sanitization',
|
|
5
|
+
});
|
|
2
6
|
export const RememberSchema = z.object({
|
|
3
|
-
name:
|
|
7
|
+
name: nameField,
|
|
4
8
|
type: z.string().min(1).max(100),
|
|
5
9
|
observations: z.array(z.string().max(10000)).max(100).optional(),
|
|
6
10
|
tags: z.array(z.string().max(255)).max(50).optional(),
|
|
@@ -19,7 +23,7 @@ export const RecallSchema = z.object({
|
|
|
19
23
|
cross_project: z.boolean().optional(),
|
|
20
24
|
});
|
|
21
25
|
export const ForgetSchema = z.object({
|
|
22
|
-
name:
|
|
26
|
+
name: nameField,
|
|
23
27
|
observation: z.string().max(10000).optional(),
|
|
24
28
|
});
|
|
25
29
|
export const ConsolidateSchema = z.object({
|
|
@@ -37,7 +41,7 @@ export const ExportResultSchema = z.object({
|
|
|
37
41
|
exported_at: z.string(),
|
|
38
42
|
entity_count: z.number(),
|
|
39
43
|
entities: z.array(z.object({
|
|
40
|
-
name:
|
|
44
|
+
name: nameField,
|
|
41
45
|
type: z.string().min(1).max(100),
|
|
42
46
|
namespace: z.string(),
|
|
43
47
|
observations: z.array(z.string().max(10000)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/transports/schemas.ts"],"names":[],"mappings":"AAKA,OAAO,E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MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;QACjB,SAAS,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QACzC,KAAK,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QACrC,IAAI,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QACpC,KAAK,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;KACzC,CAAC,CAAC,QAAQ,EAAE;SACV,QAAQ,CAAC,yFAAyF,CAAC;CACvG,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pcircle/memesh",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.3",
|
|
4
4
|
"description": "MeMesh — Local memory for Claude Code and MCP coding agents. One SQLite file, zero cloud required.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
8
|
"memesh": "dist/transports/cli/cli.js",
|
|
9
|
-
"memesh-mcp": "dist/mcp/
|
|
9
|
+
"memesh-mcp": "dist/mcp/launcher.js",
|
|
10
10
|
"memesh-http": "dist/transports/http/server.js",
|
|
11
11
|
"memesh-view": "dist/cli/view.js"
|
|
12
12
|
},
|
|
@@ -16,12 +16,14 @@
|
|
|
16
16
|
".mcp.json",
|
|
17
17
|
"hooks/hooks.json",
|
|
18
18
|
"scripts/hooks/",
|
|
19
|
+
"scripts/postinstall-rebuild.mjs",
|
|
19
20
|
"skills/",
|
|
20
21
|
".claude-plugin/",
|
|
21
22
|
"README.md",
|
|
22
23
|
"LICENSE"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
26
|
+
"postinstall": "node scripts/postinstall-rebuild.mjs",
|
|
25
27
|
"build": "node scripts/check-schema-drift.mjs && tsc && node scripts/copy-cli-assets.mjs && node scripts/set-executable-bits.mjs && node scripts/generate-skills-manifest.mjs && npm run build:dashboard && node scripts/smoke-test.mjs",
|
|
26
28
|
"build:dashboard": "node scripts/build-dashboard.mjs",
|
|
27
29
|
"test": "vitest",
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
"lint": "eslint src/ scripts/",
|
|
32
34
|
"lint:strict": "eslint src/ scripts/ --max-warnings 0",
|
|
33
35
|
"lint:fix": "eslint src/ scripts/ --fix",
|
|
34
|
-
"start": "node dist/mcp/
|
|
36
|
+
"start": "node dist/mcp/launcher.js",
|
|
35
37
|
"bench:longmemeval": "node benchmarks/longmemeval/run.mjs --mode A --dataset /tmp/longmemeval_s.json"
|
|
36
38
|
},
|
|
37
39
|
"author": "PCIRCLE-AI",
|
package/scripts/hooks/_shared.js
CHANGED
|
@@ -311,20 +311,57 @@ CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
|
|
|
311
311
|
* @returns {{ db: any, dbPath: string }}
|
|
312
312
|
*/
|
|
313
313
|
// Cached lookup for the better-sqlite3 native module. Plugin-marketplace
|
|
314
|
-
// installs ship the tarball without node_modules
|
|
315
|
-
//
|
|
316
|
-
// null in
|
|
317
|
-
// with a working dev/npm-global registration still produce
|
|
314
|
+
// installs ship the tarball without node_modules OR with a node_modules
|
|
315
|
+
// tree that lacks the compiled .node binding. tryRequireBetterSqlite()
|
|
316
|
+
// returns null in either scenario and lets each caller silent-skip —
|
|
317
|
+
// callers paired with a working dev/npm-global registration still produce
|
|
318
|
+
// output. The require() call alone is NOT sufficient: better-sqlite3's
|
|
319
|
+
// `lib/index.js` defers the bindings() call until the first
|
|
320
|
+
// `new Database()`, so a successful require() can still hand back a
|
|
321
|
+
// constructor that throws "Could not locate the bindings file" on use.
|
|
322
|
+
// We probe with an in-memory DB to force the binding load up-front.
|
|
323
|
+
function _inTestEnv() {
|
|
324
|
+
return process.env.VITEST === 'true' || process.env.NODE_ENV === 'test';
|
|
325
|
+
}
|
|
326
|
+
|
|
318
327
|
let _cachedDatabaseCtor;
|
|
319
328
|
export function tryRequireBetterSqlite() {
|
|
320
329
|
// Test-only seam: force the "native module unavailable" branch so
|
|
321
330
|
// tests can exercise the silent-skip path that plugin-marketplace
|
|
322
|
-
// cache installs hit.
|
|
323
|
-
|
|
331
|
+
// cache installs hit. Gated to test environments so an accidental
|
|
332
|
+
// shell export cannot disable memesh on a real user's machine.
|
|
333
|
+
if (_inTestEnv() && process.env.MEMESH_TEST_FORCE_MISSING_NATIVE === '1') return null;
|
|
324
334
|
if (_cachedDatabaseCtor !== undefined) return _cachedDatabaseCtor;
|
|
325
335
|
try {
|
|
326
|
-
|
|
327
|
-
|
|
336
|
+
const Database = require('better-sqlite3');
|
|
337
|
+
// Second test-only seam: simulate the exact plugin-marketplace cache
|
|
338
|
+
// failure mode where require() succeeds (JS wrapper present) but the
|
|
339
|
+
// native .node is missing, so the first construction throws. Same
|
|
340
|
+
// test-env gate as the seam above.
|
|
341
|
+
if (_inTestEnv() && process.env.MEMESH_TEST_FORCE_BINDING_LOAD_FAIL === '1') {
|
|
342
|
+
throw new Error('Could not locate the bindings file. (test forced)');
|
|
343
|
+
}
|
|
344
|
+
const probe = new Database(':memory:');
|
|
345
|
+
probe.close();
|
|
346
|
+
_cachedDatabaseCtor = Database;
|
|
347
|
+
} catch (err) {
|
|
348
|
+
// Stderr-trace-then-silent: an empty catch would collapse plugin-
|
|
349
|
+
// marketplace's "no .node binding" case together with ABI mismatches,
|
|
350
|
+
// disk full, fd exhaustion, OOM, and tampered native modules — all
|
|
351
|
+
// distinct causes with distinct fixes. Following the project's hook
|
|
352
|
+
// pattern (e.g. session-summary.js, post-commit.js), we surface a
|
|
353
|
+
// single line on stderr (NOT stdout — Claude Code's hook contract
|
|
354
|
+
// requires stdout stays a single JSON document or empty) and let
|
|
355
|
+
// each caller continue its silent-skip behavior. The stderr trace
|
|
356
|
+
// is visible to anyone running `memesh doctor` or inspecting hook
|
|
357
|
+
// exit logs; it does NOT reach the Claude Code conversation.
|
|
358
|
+
try {
|
|
359
|
+
const code = err && typeof err === 'object' && 'code' in err ? err.code : '';
|
|
360
|
+
const msg = (err && typeof err === 'object' && 'message' in err ? err.message : String(err)) || 'unknown';
|
|
361
|
+
process.stderr.write(`[memesh hook] better-sqlite3 probe failed: ${code} ${msg}\n`);
|
|
362
|
+
} catch {
|
|
363
|
+
// stderr write itself failed (closed pipe, etc.) — give up silently.
|
|
364
|
+
}
|
|
328
365
|
_cachedDatabaseCtor = null;
|
|
329
366
|
}
|
|
330
367
|
return _cachedDatabaseCtor;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Runs after `npm install` to ensure better-sqlite3's native binding is compiled.
|
|
3
|
+
// The plugin marketplace sometimes runs `npm install --ignore-scripts`, which
|
|
4
|
+
// skips better-sqlite3's own build step. This script is a safety net that
|
|
5
|
+
// detects a missing binary and attempts a rebuild. Errors are non-fatal —
|
|
6
|
+
// the hook and MCP server will report the missing binding at runtime.
|
|
7
|
+
import { execFileSync } from 'child_process';
|
|
8
|
+
import { createRequire } from 'module';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
import { dirname } from 'path';
|
|
11
|
+
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
|
|
14
|
+
function isBinaryPresent() {
|
|
15
|
+
// better-sqlite3 loads its native binding lazily inside Database() —
|
|
16
|
+
// a plain require() always succeeds. Must instantiate to trigger the probe.
|
|
17
|
+
try {
|
|
18
|
+
const Db = require('better-sqlite3');
|
|
19
|
+
new Db(':memory:').close();
|
|
20
|
+
return true;
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (isBinaryPresent()) {
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// dirname(fileURLToPath(...)) → scripts/ ; one more dirname → package root
|
|
31
|
+
const cwd = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
32
|
+
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
process.stdout.write('[memesh] Compiling better-sqlite3 native addon...\n');
|
|
36
|
+
execFileSync(npm, ['rebuild', 'better-sqlite3'], { cwd, stdio: 'inherit' });
|
|
37
|
+
process.stdout.write('[memesh] better-sqlite3 compiled successfully.\n');
|
|
38
|
+
} catch (err) {
|
|
39
|
+
// Non-fatal: user can still use the CLI without the native module if no DB ops.
|
|
40
|
+
process.stderr.write(`[memesh] Warning: Could not compile better-sqlite3 (${err?.message}). Run "npm rebuild better-sqlite3" manually inside the install directory.\n`);
|
|
41
|
+
}
|