@jungjaehoon/clawdbot-mama 0.1.2 → 0.1.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/package.json +3 -1
- package/scripts/postinstall.js +54 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jungjaehoon/clawdbot-mama",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "MAMA Memory Plugin for Clawdbot - Semantic decision memory with reasoning graph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
]
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
+
"postinstall": "node scripts/postinstall.js",
|
|
13
14
|
"test": "echo 'No tests yet'",
|
|
14
15
|
"clean": "rm -rf node_modules"
|
|
15
16
|
},
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
"files": [
|
|
43
44
|
"index.ts",
|
|
44
45
|
"clawdbot.plugin.json",
|
|
46
|
+
"scripts/",
|
|
45
47
|
"README.md"
|
|
46
48
|
]
|
|
47
49
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* MAMA Clawdbot Plugin - Postinstall Script
|
|
4
|
+
* Downloads embedding model during installation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
console.log('[MAMA] Running postinstall checks...');
|
|
9
|
+
|
|
10
|
+
// Check Node.js version
|
|
11
|
+
const nodeVersion = process.versions.node.split('.')[0];
|
|
12
|
+
if (parseInt(nodeVersion) < 18) {
|
|
13
|
+
console.warn('[MAMA] Warning: Node.js 18+ recommended, current:', process.versions.node);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Try to download embedding model
|
|
17
|
+
console.log('[MAMA] Pre-downloading embedding model...');
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
// Dynamic import for ESM module
|
|
21
|
+
const { pipeline } = await import('@huggingface/transformers');
|
|
22
|
+
|
|
23
|
+
// This will download and cache the model
|
|
24
|
+
console.log('[MAMA] Downloading Xenova/all-MiniLM-L6-v2 (~30MB)...');
|
|
25
|
+
const extractor = await pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2', {
|
|
26
|
+
quantized: true,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Quick test to verify it works
|
|
30
|
+
const testResult = await extractor('test', { pooling: 'mean', normalize: true });
|
|
31
|
+
console.log('[MAMA] Embedding model ready (dimension:', testResult.data.length, ')');
|
|
32
|
+
} catch (err) {
|
|
33
|
+
// Non-fatal - model will be downloaded on first use
|
|
34
|
+
console.warn('[MAMA] Could not pre-download model:', err.message);
|
|
35
|
+
console.warn('[MAMA] Model will be downloaded on first use.');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Check better-sqlite3
|
|
39
|
+
try {
|
|
40
|
+
require('better-sqlite3');
|
|
41
|
+
console.log('[MAMA] SQLite native module: OK');
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.error('[MAMA] SQLite native module failed:', err.message);
|
|
44
|
+
console.error('[MAMA] You may need build tools: python, make, g++');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
console.log('[MAMA] Postinstall complete.');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
main().catch((err) => {
|
|
51
|
+
console.error('[MAMA] Postinstall error:', err.message);
|
|
52
|
+
// Don't fail installation
|
|
53
|
+
process.exit(0);
|
|
54
|
+
});
|