openclaw-langcache 1.0.1 ā 1.2.0
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 +5 -3
- package/package.json +6 -8
- package/scripts/postinstall.js +22 -42
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# openclaw-langcache
|
|
2
2
|
|
|
3
3
|
Semantic caching skill for [OpenClaw](https://openclaw.ai) using [Redis LangCache](https://redis.io/langcache/).
|
|
4
4
|
|
|
5
|
+
> **For Claude Code users:** See [claude-code-langcache](https://www.npmjs.com/package/claude-code-langcache)
|
|
6
|
+
|
|
5
7
|
Reduce LLM costs and latency by caching responses for semantically similar queries, with built-in privacy and security guardrails.
|
|
6
8
|
|
|
7
9
|
## Features
|
|
@@ -20,10 +22,10 @@ Reduce LLM costs and latency by caching responses for semantically similar queri
|
|
|
20
22
|
### Via npm (Recommended)
|
|
21
23
|
|
|
22
24
|
```bash
|
|
23
|
-
npm install openclaw-langcache
|
|
25
|
+
npm install -g openclaw-langcache
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
The skill will be automatically installed to
|
|
28
|
+
The skill will be automatically installed to `~/.openclaw/workspace/skills/langcache/`
|
|
27
29
|
|
|
28
30
|
### Via Git
|
|
29
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-langcache",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Semantic caching skill for OpenClaw using Redis LangCache",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openclaw",
|
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
"ai",
|
|
13
13
|
"cache"
|
|
14
14
|
],
|
|
15
|
-
"homepage": "https://github.com/openclaw
|
|
15
|
+
"homepage": "https://github.com/manvinder01/openclaw-langcache#readme",
|
|
16
16
|
"bugs": {
|
|
17
|
-
"url": "https://github.com/openclaw
|
|
17
|
+
"url": "https://github.com/manvinder01/openclaw-langcache/issues"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/openclaw
|
|
21
|
+
"url": "git+https://github.com/manvinder01/openclaw-langcache.git"
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"author": {
|
|
25
|
-
"name": "
|
|
25
|
+
"name": "Manvinder Singh"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"skills/",
|
|
@@ -38,9 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"openclaw": {
|
|
40
40
|
"type": "skill",
|
|
41
|
-
"skills": [
|
|
42
|
-
"langcache"
|
|
43
|
-
],
|
|
41
|
+
"skills": ["langcache"],
|
|
44
42
|
"installPath": "skills/"
|
|
45
43
|
}
|
|
46
44
|
}
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Postinstall script for
|
|
4
|
-
*
|
|
3
|
+
* Postinstall script for openclaw-langcache
|
|
4
|
+
* Installs the skill to OpenClaw workspace
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const fs = require('fs');
|
|
@@ -10,28 +10,16 @@ const os = require('os');
|
|
|
10
10
|
|
|
11
11
|
const SKILL_NAME = 'langcache';
|
|
12
12
|
|
|
13
|
-
// Determine OpenClaw workspace path
|
|
14
13
|
function getOpenClawPath() {
|
|
15
|
-
// Check OPENCLAW_HOME environment variable first
|
|
16
|
-
if (process.env.OPENCLAW_HOME) {
|
|
17
|
-
return path.join(process.env.OPENCLAW_HOME, 'workspace', 'skills');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Default paths by platform
|
|
21
14
|
const home = os.homedir();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// macOS and Linux
|
|
28
|
-
return path.join(home, '.openclaw', 'workspace', 'skills');
|
|
15
|
+
return path.join(
|
|
16
|
+
process.env.OPENCLAW_HOME || path.join(home, '.openclaw'),
|
|
17
|
+
'workspace', 'skills'
|
|
18
|
+
);
|
|
29
19
|
}
|
|
30
20
|
|
|
31
|
-
// Recursively copy directory
|
|
32
21
|
function copyDir(src, dest) {
|
|
33
22
|
fs.mkdirSync(dest, { recursive: true });
|
|
34
|
-
|
|
35
23
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
36
24
|
|
|
37
25
|
for (const entry of entries) {
|
|
@@ -42,9 +30,7 @@ function copyDir(src, dest) {
|
|
|
42
30
|
copyDir(srcPath, destPath);
|
|
43
31
|
} else {
|
|
44
32
|
fs.copyFileSync(srcPath, destPath);
|
|
45
|
-
|
|
46
|
-
// Make shell scripts executable
|
|
47
|
-
if (entry.name.endsWith('.sh')) {
|
|
33
|
+
if (entry.name.endsWith('.sh') || entry.name.endsWith('.py')) {
|
|
48
34
|
fs.chmodSync(destPath, 0o755);
|
|
49
35
|
}
|
|
50
36
|
}
|
|
@@ -52,50 +38,44 @@ function copyDir(src, dest) {
|
|
|
52
38
|
}
|
|
53
39
|
|
|
54
40
|
function main() {
|
|
41
|
+
console.log('\nš¦ Installing langcache skill for OpenClaw...\n');
|
|
42
|
+
|
|
55
43
|
try {
|
|
56
44
|
const skillsPath = getOpenClawPath();
|
|
57
45
|
const destPath = path.join(skillsPath, SKILL_NAME);
|
|
58
|
-
|
|
59
|
-
// Find the source skill directory
|
|
60
|
-
// When installed via npm, we're in node_modules/@openclaw/langcache
|
|
61
46
|
const packageRoot = path.dirname(__dirname);
|
|
62
47
|
const srcPath = path.join(packageRoot, 'skills', SKILL_NAME);
|
|
63
48
|
|
|
64
49
|
if (!fs.existsSync(srcPath)) {
|
|
65
|
-
console.log(
|
|
50
|
+
console.log('Source skill not found, skipping');
|
|
66
51
|
return;
|
|
67
52
|
}
|
|
68
53
|
|
|
69
|
-
// Create skills directory if it doesn't exist
|
|
70
54
|
fs.mkdirSync(skillsPath, { recursive: true });
|
|
71
55
|
|
|
72
|
-
// Check if skill already exists
|
|
73
56
|
if (fs.existsSync(destPath)) {
|
|
74
|
-
console.log(
|
|
75
|
-
console.log('To update
|
|
76
|
-
console.log(` rm -rf ${destPath}`);
|
|
77
|
-
console.log(' npm install @openclaw/langcache');
|
|
57
|
+
console.log(`ā Skill already exists at ${destPath}`);
|
|
58
|
+
console.log(' To update: rm -rf ~/.openclaw/workspace/skills/langcache && npm install -g openclaw-langcache');
|
|
78
59
|
return;
|
|
79
60
|
}
|
|
80
61
|
|
|
81
|
-
// Copy skill to workspace
|
|
82
62
|
copyDir(srcPath, destPath);
|
|
83
63
|
|
|
84
|
-
console.log(
|
|
64
|
+
console.log(`ā Installed to ${destPath}\n`);
|
|
85
65
|
console.log('Next steps:');
|
|
86
|
-
console.log('1.
|
|
87
|
-
console.log(' LANGCACHE_HOST=your-instance.redis.cloud');
|
|
88
|
-
console.log(' LANGCACHE_CACHE_ID=your-cache-id');
|
|
89
|
-
console.log(' LANGCACHE_API_KEY=your-api-key');
|
|
66
|
+
console.log('1. Set your Redis LangCache credentials:');
|
|
67
|
+
console.log(' export LANGCACHE_HOST=your-instance.redis.cloud');
|
|
68
|
+
console.log(' export LANGCACHE_CACHE_ID=your-cache-id');
|
|
69
|
+
console.log(' export LANGCACHE_API_KEY=your-api-key');
|
|
90
70
|
console.log('');
|
|
91
|
-
console.log('2. The skill
|
|
92
|
-
console.log(' or
|
|
71
|
+
console.log('2. The skill auto-activates when you mention "semantic caching"');
|
|
72
|
+
console.log(' or invoke manually with /langcache');
|
|
93
73
|
console.log('');
|
|
74
|
+
console.log('For Claude Code users: npm install -g claude-code-langcache\n');
|
|
94
75
|
|
|
95
76
|
} catch (err) {
|
|
96
|
-
|
|
97
|
-
console.warn(
|
|
98
|
-
console.warn('You can manually copy the skill from node_modules/@openclaw/langcache/skills/');
|
|
77
|
+
console.warn(`ā Warning: ${err.message}`);
|
|
78
|
+
console.warn('Manually copy from node_modules/openclaw-langcache/skills/');
|
|
99
79
|
}
|
|
100
80
|
}
|
|
101
81
|
|