@blockrun/clawrouter 0.6.6 → 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/package.json +1 -1
- package/scripts/reinstall.sh +28 -28
package/package.json
CHANGED
package/scripts/reinstall.sh
CHANGED
|
@@ -96,8 +96,8 @@ if (!store.profiles[profileKey]) {
|
|
|
96
96
|
}
|
|
97
97
|
"
|
|
98
98
|
|
|
99
|
-
# 5.
|
|
100
|
-
echo "→
|
|
99
|
+
# 5. Ensure apiKey is present for /model picker (but DON'T override default model)
|
|
100
|
+
echo "→ Finalizing setup..."
|
|
101
101
|
node -e "
|
|
102
102
|
const os = require('os');
|
|
103
103
|
const fs = require('fs');
|
|
@@ -107,20 +107,18 @@ const configPath = path.join(os.homedir(), '.openclaw', 'openclaw.json');
|
|
|
107
107
|
if (fs.existsSync(configPath)) {
|
|
108
108
|
try {
|
|
109
109
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
110
|
+
let changed = false;
|
|
110
111
|
|
|
111
|
-
// Ensure
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (!config.plugins.allow.includes('clawrouter') && !config.plugins.allow.includes('@blockrun/clawrouter')) {
|
|
117
|
-
config.plugins.allow.push('clawrouter');
|
|
118
|
-
console.log(' Added clawrouter to plugins.allow');
|
|
119
|
-
} else {
|
|
120
|
-
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;
|
|
121
117
|
}
|
|
122
118
|
|
|
123
|
-
|
|
119
|
+
if (changed) {
|
|
120
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
121
|
+
}
|
|
124
122
|
} catch (e) {
|
|
125
123
|
console.log(' Could not update config:', e.message);
|
|
126
124
|
}
|
|
@@ -129,8 +127,12 @@ if (fs.existsSync(configPath)) {
|
|
|
129
127
|
}
|
|
130
128
|
"
|
|
131
129
|
|
|
132
|
-
# 6.
|
|
133
|
-
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..."
|
|
134
136
|
node -e "
|
|
135
137
|
const os = require('os');
|
|
136
138
|
const fs = require('fs');
|
|
@@ -140,18 +142,20 @@ const configPath = path.join(os.homedir(), '.openclaw', 'openclaw.json');
|
|
|
140
142
|
if (fs.existsSync(configPath)) {
|
|
141
143
|
try {
|
|
142
144
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
143
|
-
let changed = false;
|
|
144
145
|
|
|
145
|
-
// Ensure
|
|
146
|
-
if (config.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
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 = [];
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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');
|
|
154
156
|
}
|
|
157
|
+
|
|
158
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
155
159
|
} catch (e) {
|
|
156
160
|
console.log(' Could not update config:', e.message);
|
|
157
161
|
}
|
|
@@ -160,10 +164,6 @@ if (fs.existsSync(configPath)) {
|
|
|
160
164
|
}
|
|
161
165
|
"
|
|
162
166
|
|
|
163
|
-
# 7. Install plugin (done last so it starts with correct config)
|
|
164
|
-
echo "→ Installing ClawRouter..."
|
|
165
|
-
openclaw plugins install @blockrun/clawrouter
|
|
166
|
-
|
|
167
167
|
echo ""
|
|
168
168
|
echo "✓ Done! Smart routing enabled by default."
|
|
169
169
|
echo ""
|