@blockrun/clawrouter 0.6.4 → 0.6.7
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/dist/index.js +85 -14
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
- package/scripts/reinstall.sh +29 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/clawrouter",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "Smart LLM router — save 78% on inference costs. 30+ models, one wallet, x402 micropayments.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,7 +27,13 @@
|
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
28
|
"lint": "eslint src/",
|
|
29
29
|
"format": "prettier --write .",
|
|
30
|
-
"format:check": "prettier --check ."
|
|
30
|
+
"format:check": "prettier --check .",
|
|
31
|
+
"test:resilience:errors": "npx tsx test/resilience-errors.ts",
|
|
32
|
+
"test:resilience:stability": "DURATION_MINUTES=5 npx tsx test/resilience-stability.ts",
|
|
33
|
+
"test:resilience:stability:full": "DURATION_MINUTES=240 npx tsx test/resilience-stability.ts",
|
|
34
|
+
"test:resilience:lifecycle": "npx tsx test/resilience-lifecycle.ts",
|
|
35
|
+
"test:resilience:quick": "npm run test:resilience:errors && npm run test:resilience:lifecycle",
|
|
36
|
+
"test:resilience:full": "npm run test:resilience:errors && npm run test:resilience:lifecycle && npm run test:resilience:stability:full"
|
|
31
37
|
},
|
|
32
38
|
"keywords": [
|
|
33
39
|
"llm",
|
package/scripts/reinstall.sh
CHANGED
|
@@ -52,11 +52,7 @@ lsof -ti :8402 | xargs kill -9 2>/dev/null || true
|
|
|
52
52
|
echo "→ Cleaning models cache..."
|
|
53
53
|
rm -f ~/.openclaw/agents/main/agent/models.json 2>/dev/null || true
|
|
54
54
|
|
|
55
|
-
# 4.
|
|
56
|
-
echo "→ Installing ClawRouter..."
|
|
57
|
-
openclaw plugins install @blockrun/clawrouter
|
|
58
|
-
|
|
59
|
-
# 5. Inject auth profile (ensures blockrun provider is recognized)
|
|
55
|
+
# 4. Inject auth profile (ensures blockrun provider is recognized)
|
|
60
56
|
echo "→ Injecting auth profile..."
|
|
61
57
|
node -e "
|
|
62
58
|
const os = require('os');
|
|
@@ -100,8 +96,8 @@ if (!store.profiles[profileKey]) {
|
|
|
100
96
|
}
|
|
101
97
|
"
|
|
102
98
|
|
|
103
|
-
#
|
|
104
|
-
echo "→
|
|
99
|
+
# 5. Ensure apiKey is present for /model picker (but DON'T override default model)
|
|
100
|
+
echo "→ Finalizing setup..."
|
|
105
101
|
node -e "
|
|
106
102
|
const os = require('os');
|
|
107
103
|
const fs = require('fs');
|
|
@@ -111,20 +107,18 @@ const configPath = path.join(os.homedir(), '.openclaw', 'openclaw.json');
|
|
|
111
107
|
if (fs.existsSync(configPath)) {
|
|
112
108
|
try {
|
|
113
109
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
110
|
+
let changed = false;
|
|
114
111
|
|
|
115
|
-
// Ensure
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (!config.plugins.allow.includes('clawrouter') && !config.plugins.allow.includes('@blockrun/clawrouter')) {
|
|
121
|
-
config.plugins.allow.push('clawrouter');
|
|
122
|
-
console.log(' Added clawrouter to plugins.allow');
|
|
123
|
-
} else {
|
|
124
|
-
console.log(' Plugin already in allow list');
|
|
112
|
+
// Ensure blockrun provider has apiKey (required by ModelRegistry for /model picker)
|
|
113
|
+
if (config.models?.providers?.blockrun && !config.models.providers.blockrun.apiKey) {
|
|
114
|
+
config.models.providers.blockrun.apiKey = 'x402-proxy-handles-auth';
|
|
115
|
+
console.log(' Added apiKey to blockrun provider config');
|
|
116
|
+
changed = true;
|
|
125
117
|
}
|
|
126
118
|
|
|
127
|
-
|
|
119
|
+
if (changed) {
|
|
120
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
121
|
+
}
|
|
128
122
|
} catch (e) {
|
|
129
123
|
console.log(' Could not update config:', e.message);
|
|
130
124
|
}
|
|
@@ -133,8 +127,12 @@ if (fs.existsSync(configPath)) {
|
|
|
133
127
|
}
|
|
134
128
|
"
|
|
135
129
|
|
|
136
|
-
#
|
|
137
|
-
echo "→
|
|
130
|
+
# 6. Install plugin (config is ready, but no allow list yet to avoid validation error)
|
|
131
|
+
echo "→ Installing ClawRouter..."
|
|
132
|
+
openclaw plugins install @blockrun/clawrouter
|
|
133
|
+
|
|
134
|
+
# 7. Add plugin to allow list (done AFTER install so plugin files exist for validation)
|
|
135
|
+
echo "→ Adding to plugins allow list..."
|
|
138
136
|
node -e "
|
|
139
137
|
const os = require('os');
|
|
140
138
|
const fs = require('fs');
|
|
@@ -144,18 +142,20 @@ const configPath = path.join(os.homedir(), '.openclaw', 'openclaw.json');
|
|
|
144
142
|
if (fs.existsSync(configPath)) {
|
|
145
143
|
try {
|
|
146
144
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
147
|
-
let changed = false;
|
|
148
145
|
|
|
149
|
-
// Ensure
|
|
150
|
-
if (config.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
changed = true;
|
|
146
|
+
// Ensure plugins.allow exists and includes clawrouter
|
|
147
|
+
if (!config.plugins) config.plugins = {};
|
|
148
|
+
if (!Array.isArray(config.plugins.allow)) {
|
|
149
|
+
config.plugins.allow = [];
|
|
154
150
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
if (!config.plugins.allow.includes('clawrouter') && !config.plugins.allow.includes('@blockrun/clawrouter')) {
|
|
152
|
+
config.plugins.allow.push('clawrouter');
|
|
153
|
+
console.log(' Added clawrouter to plugins.allow');
|
|
154
|
+
} else {
|
|
155
|
+
console.log(' Plugin already in allow list');
|
|
158
156
|
}
|
|
157
|
+
|
|
158
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
159
159
|
} catch (e) {
|
|
160
160
|
console.log(' Could not update config:', e.message);
|
|
161
161
|
}
|