@blockrun/clawrouter 0.9.22 → 0.9.23

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/clawrouter",
3
- "version": "0.9.22",
3
+ "version": "0.9.23",
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",
@@ -1,6 +1,8 @@
1
1
  #!/bin/bash
2
2
  set -e
3
3
 
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+
4
6
  echo "🦞 ClawRouter Reinstall"
5
7
  echo ""
6
8
 
@@ -158,6 +160,69 @@ if [ ! -f "$DIST_PATH" ]; then
158
160
  fi
159
161
  echo " ✓ dist/index.js verified"
160
162
 
163
+ # 6.2. Refresh blockrun model catalog from installed package
164
+ echo "→ Refreshing BlockRun models catalog..."
165
+ node --input-type=module -e "
166
+ import os from 'node:os';
167
+ import fs from 'node:fs';
168
+ import path from 'node:path';
169
+ import { pathToFileURL } from 'node:url';
170
+
171
+ const configPath = path.join(os.homedir(), '.openclaw', 'openclaw.json');
172
+ // Use installed plugin path directly (works with curl | bash)
173
+ const indexPath = path.join(os.homedir(), '.openclaw', 'extensions', 'clawrouter', 'dist', 'index.js');
174
+
175
+ if (!fs.existsSync(configPath)) {
176
+ console.log(' No openclaw.json found, skipping');
177
+ process.exit(0);
178
+ }
179
+
180
+ if (!fs.existsSync(indexPath)) {
181
+ console.log(' Could not locate dist/index.js, skipping model refresh');
182
+ process.exit(0);
183
+ }
184
+
185
+ try {
186
+ const mod = await import(pathToFileURL(indexPath).href);
187
+ const openclawModels = Array.isArray(mod.OPENCLAW_MODELS) ? mod.OPENCLAW_MODELS : [];
188
+ if (openclawModels.length === 0) {
189
+ console.log(' OPENCLAW_MODELS missing or empty, skipping model refresh');
190
+ process.exit(0);
191
+ }
192
+
193
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
194
+ const blockrun = config.models?.providers?.blockrun;
195
+ if (!blockrun || typeof blockrun !== 'object') {
196
+ console.log(' BlockRun provider not found yet, skipping model refresh');
197
+ process.exit(0);
198
+ }
199
+
200
+ const currentModels = Array.isArray(blockrun.models) ? blockrun.models : [];
201
+ const currentIds = new Set(currentModels.map(m => m?.id).filter(Boolean));
202
+ const expectedIds = openclawModels.map(m => m?.id).filter(Boolean);
203
+ const needsRefresh = currentModels.length !== openclawModels.length || expectedIds.some(id => !currentIds.has(id));
204
+
205
+ let changed = false;
206
+ if (!blockrun.apiKey) {
207
+ blockrun.apiKey = 'x402-proxy-handles-auth';
208
+ changed = true;
209
+ }
210
+ if (needsRefresh) {
211
+ blockrun.models = openclawModels;
212
+ changed = true;
213
+ console.log(' Refreshed blockrun.models (' + openclawModels.length + ' models)');
214
+ } else {
215
+ console.log(' blockrun.models already up to date');
216
+ }
217
+
218
+ if (changed) {
219
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
220
+ }
221
+ } catch (err) {
222
+ console.log(' Could not refresh models catalog:', err.message);
223
+ }
224
+ "
225
+
161
226
  # 7. Add plugin to allow list (done AFTER install so plugin files exist for validation)
162
227
  echo "→ Adding to plugins allow list..."
163
228
  node -e "
@@ -200,6 +265,7 @@ echo "Model aliases available:"
200
265
  echo " /model sonnet → anthropic/claude-sonnet-4.6"
201
266
  echo " /model codex → openai/gpt-5.2-codex"
202
267
  echo " /model deepseek → deepseek/deepseek-chat"
268
+ echo " /model minimax → minimax/minimax-m2.5"
203
269
  echo " /model free → gpt-oss-120b (FREE)"
204
270
  echo ""
205
271
  echo "To uninstall: bash ~/.openclaw/extensions/clawrouter/scripts/uninstall.sh"