@blockrun/clawrouter 0.12.98 → 0.12.100
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 +46 -0
- package/scripts/update.sh +21 -0
package/package.json
CHANGED
package/scripts/reinstall.sh
CHANGED
|
@@ -256,6 +256,52 @@ if (fs.existsSync(configPath)) {
|
|
|
256
256
|
}
|
|
257
257
|
"
|
|
258
258
|
|
|
259
|
+
# 5b. Ensure provider baseUrl is set (must happen BEFORE openclaw plugins install,
|
|
260
|
+
# which validates the config and fails if baseUrl is missing)
|
|
261
|
+
echo "→ Verifying provider config..."
|
|
262
|
+
node -e "
|
|
263
|
+
const os = require('os');
|
|
264
|
+
const fs = require('fs');
|
|
265
|
+
const path = require('path');
|
|
266
|
+
const configPath = path.join(os.homedir(), '.openclaw', 'openclaw.json');
|
|
267
|
+
|
|
268
|
+
if (!fs.existsSync(configPath)) {
|
|
269
|
+
console.log(' No config file found, skipping');
|
|
270
|
+
process.exit(0);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
try {
|
|
274
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
275
|
+
const provider = config?.models?.providers?.blockrun;
|
|
276
|
+
if (!provider) {
|
|
277
|
+
console.log(' No blockrun provider found, skipping');
|
|
278
|
+
process.exit(0);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
let changed = false;
|
|
282
|
+
if (!provider.baseUrl) {
|
|
283
|
+
provider.baseUrl = 'http://127.0.0.1:8402/v1';
|
|
284
|
+
changed = true;
|
|
285
|
+
console.log(' Fixed missing baseUrl');
|
|
286
|
+
}
|
|
287
|
+
if (!provider.apiKey) {
|
|
288
|
+
provider.apiKey = 'x402-proxy-handles-auth';
|
|
289
|
+
changed = true;
|
|
290
|
+
console.log(' Fixed missing apiKey');
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (changed) {
|
|
294
|
+
const tmpPath = configPath + '.tmp.' + process.pid;
|
|
295
|
+
fs.writeFileSync(tmpPath, JSON.stringify(config, null, 2));
|
|
296
|
+
fs.renameSync(tmpPath, configPath);
|
|
297
|
+
} else {
|
|
298
|
+
console.log(' Provider config OK');
|
|
299
|
+
}
|
|
300
|
+
} catch (err) {
|
|
301
|
+
console.log(' Skipped: ' + err.message);
|
|
302
|
+
}
|
|
303
|
+
"
|
|
304
|
+
|
|
259
305
|
# 6. Install plugin (config is ready, but no allow list yet to avoid validation error)
|
|
260
306
|
# Back up OpenClaw credentials (channels, WhatsApp/Telegram state) before plugin install
|
|
261
307
|
CREDS_DIR="$HOME/.openclaw/credentials"
|
package/scripts/update.sh
CHANGED
|
@@ -169,6 +169,27 @@ try {
|
|
|
169
169
|
}
|
|
170
170
|
"
|
|
171
171
|
|
|
172
|
+
# ── Step 3b: Ensure baseUrl is set (must happen BEFORE install, which validates config) ──
|
|
173
|
+
echo "→ Verifying provider config..."
|
|
174
|
+
node -e "
|
|
175
|
+
const fs = require('fs');
|
|
176
|
+
const configPath = '$CONFIG_PATH';
|
|
177
|
+
if (!fs.existsSync(configPath)) { console.log(' No config, skipping'); process.exit(0); }
|
|
178
|
+
try {
|
|
179
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
180
|
+
const provider = config?.models?.providers?.blockrun;
|
|
181
|
+
if (!provider) { console.log(' No blockrun provider, skipping'); process.exit(0); }
|
|
182
|
+
let changed = false;
|
|
183
|
+
if (!provider.baseUrl) { provider.baseUrl = 'http://127.0.0.1:8402/v1'; changed = true; console.log(' Fixed missing baseUrl'); }
|
|
184
|
+
if (!provider.apiKey) { provider.apiKey = 'x402-proxy-handles-auth'; changed = true; console.log(' Fixed missing apiKey'); }
|
|
185
|
+
if (changed) {
|
|
186
|
+
const tmp = configPath + '.tmp.' + process.pid;
|
|
187
|
+
fs.writeFileSync(tmp, JSON.stringify(config, null, 2));
|
|
188
|
+
fs.renameSync(tmp, configPath);
|
|
189
|
+
} else { console.log(' Provider config OK'); }
|
|
190
|
+
} catch (err) { console.log(' Skipped: ' + err.message); }
|
|
191
|
+
"
|
|
192
|
+
|
|
172
193
|
# ── Step 4: Install latest version ─────────────────────────────
|
|
173
194
|
# Back up OpenClaw credentials (channels, WhatsApp/Telegram state) before plugin install
|
|
174
195
|
CREDS_DIR="$HOME/.openclaw/credentials"
|