@blockrun/clawrouter 0.11.7 → 0.11.8
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 +15 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/reinstall.sh +47 -40
package/package.json
CHANGED
package/scripts/reinstall.sh
CHANGED
|
@@ -203,8 +203,8 @@ if [ ! -f "$DIST_PATH" ]; then
|
|
|
203
203
|
fi
|
|
204
204
|
echo " ✓ dist/index.js verified"
|
|
205
205
|
|
|
206
|
-
# 6.2.
|
|
207
|
-
echo "→
|
|
206
|
+
# 6.2. Populate model allowlist so all BlockRun models appear in /model picker
|
|
207
|
+
echo "→ Populating model allowlist..."
|
|
208
208
|
node -e "
|
|
209
209
|
const os = require('os');
|
|
210
210
|
const fs = require('fs');
|
|
@@ -220,59 +220,60 @@ try {
|
|
|
220
220
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
221
221
|
let changed = false;
|
|
222
222
|
|
|
223
|
-
// Ensure provider exists
|
|
223
|
+
// Ensure provider exists with apiKey
|
|
224
224
|
if (!config.models) config.models = {};
|
|
225
225
|
if (!config.models.providers) config.models.providers = {};
|
|
226
226
|
if (!config.models.providers.blockrun) {
|
|
227
227
|
config.models.providers.blockrun = { api: 'openai-completions', models: [] };
|
|
228
228
|
changed = true;
|
|
229
229
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (!blockrun.apiKey) {
|
|
233
|
-
blockrun.apiKey = 'x402-proxy-handles-auth';
|
|
234
|
-
changed = true;
|
|
235
|
-
}
|
|
236
|
-
if (!Array.isArray(blockrun.models)) {
|
|
237
|
-
blockrun.models = [];
|
|
230
|
+
if (!config.models.providers.blockrun.apiKey) {
|
|
231
|
+
config.models.providers.blockrun.apiKey = 'x402-proxy-handles-auth';
|
|
238
232
|
changed = true;
|
|
239
233
|
}
|
|
240
234
|
|
|
241
|
-
//
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
input: ['text'],
|
|
250
|
-
cost: { input: 0.3, output: 1.2, cacheRead: 0, cacheWrite: 0 },
|
|
251
|
-
contextWindow: 204800,
|
|
252
|
-
maxTokens: 16384
|
|
253
|
-
});
|
|
235
|
+
// Populate allowlist with all BlockRun models
|
|
236
|
+
// OpenClaw uses agents.defaults.models as a whitelist for the /model picker.
|
|
237
|
+
// index.ts will also do this on gateway start, but we pre-populate here so
|
|
238
|
+
// users see models immediately after install.
|
|
239
|
+
if (!config.agents) config.agents = {};
|
|
240
|
+
if (!config.agents.defaults) config.agents.defaults = {};
|
|
241
|
+
if (!config.agents.defaults.models || typeof config.agents.defaults.models !== 'object') {
|
|
242
|
+
config.agents.defaults.models = {};
|
|
254
243
|
changed = true;
|
|
255
|
-
console.log(' Added minimax model to blockrun provider catalog');
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// Clean up broken allowlist: if it only has blockrun/ entries, delete it entirely
|
|
259
|
-
// (previous versions accidentally created an allowlist that hid all non-blockrun models)
|
|
260
|
-
if (config.agents?.defaults?.models && typeof config.agents.defaults.models === 'object') {
|
|
261
|
-
const keys = Object.keys(config.agents.defaults.models);
|
|
262
|
-
if (keys.length > 0 && keys.every(k => k.startsWith('blockrun/'))) {
|
|
263
|
-
delete config.agents.defaults.models;
|
|
264
|
-
changed = true;
|
|
265
|
-
console.log(' Removed blockrun-only allowlist (was hiding other models)');
|
|
266
|
-
}
|
|
267
244
|
}
|
|
268
245
|
|
|
269
|
-
|
|
270
|
-
|
|
246
|
+
// Load model IDs from installed package
|
|
247
|
+
const distPath = path.join(os.homedir(), '.openclaw', 'extensions', 'clawrouter', 'dist', 'index.js');
|
|
248
|
+
if (fs.existsSync(distPath)) {
|
|
249
|
+
import('file://' + distPath).then(({ OPENCLAW_MODELS }) => {
|
|
250
|
+
const allowlist = config.agents.defaults.models;
|
|
251
|
+
let added = 0;
|
|
252
|
+
for (const m of OPENCLAW_MODELS) {
|
|
253
|
+
const key = 'blockrun/' + m.id;
|
|
254
|
+
if (!allowlist[key]) {
|
|
255
|
+
allowlist[key] = {};
|
|
256
|
+
added++;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (added > 0) {
|
|
260
|
+
changed = true;
|
|
261
|
+
console.log(' Added ' + added + ' models to allowlist (' + OPENCLAW_MODELS.length + ' total)');
|
|
262
|
+
} else {
|
|
263
|
+
console.log(' Allowlist already up to date');
|
|
264
|
+
}
|
|
265
|
+
if (changed) {
|
|
266
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
267
|
+
}
|
|
268
|
+
}).catch(err => {
|
|
269
|
+
console.log(' Could not load models from package:', err.message);
|
|
270
|
+
console.log(' Allowlist will be populated on gateway start');
|
|
271
|
+
});
|
|
271
272
|
} else {
|
|
272
|
-
console.log('
|
|
273
|
+
console.log(' dist/index.js not found, allowlist will be populated on gateway start');
|
|
273
274
|
}
|
|
274
275
|
} catch (err) {
|
|
275
|
-
console.log(' Could not update
|
|
276
|
+
console.log(' Could not update config:', err.message);
|
|
276
277
|
}
|
|
277
278
|
"
|
|
278
279
|
|
|
@@ -344,6 +345,12 @@ echo " /model codex → openai/gpt-5.2-codex"
|
|
|
344
345
|
echo " /model deepseek → deepseek/deepseek-chat"
|
|
345
346
|
echo " /model minimax → minimax/minimax-m2.5"
|
|
346
347
|
echo " /model free → gpt-oss-120b (FREE)"
|
|
348
|
+
echo ""
|
|
349
|
+
echo "Image generation:"
|
|
350
|
+
echo " /imagegen <prompt> # default: nano-banana"
|
|
351
|
+
echo " /imagegen --model dall-e-3 <prompt> # DALL-E 3"
|
|
352
|
+
echo " /imagegen --model gpt-image <prompt> # GPT Image 1"
|
|
353
|
+
echo ""
|
|
347
354
|
echo "CLI commands:"
|
|
348
355
|
echo " npx @blockrun/clawrouter report # daily usage report"
|
|
349
356
|
echo " npx @blockrun/clawrouter report weekly # weekly report"
|