@blockrun/clawrouter 0.9.24 → 0.9.26

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.24",
3
+ "version": "0.9.26",
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",
@@ -162,64 +162,77 @@ echo " ✓ dist/index.js verified"
162
162
 
163
163
  # 6.2. Refresh blockrun model catalog from installed package
164
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';
165
+ node -e "
166
+ const os = require('os');
167
+ const fs = require('fs');
168
+ const path = require('path');
170
169
 
171
170
  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
171
  if (!fs.existsSync(configPath)) {
176
172
  console.log(' No openclaw.json found, skipping');
177
173
  process.exit(0);
178
174
  }
179
175
 
180
- if (!fs.existsSync(indexPath)) {
181
- console.log(' Could not locate dist/index.js, skipping model refresh');
182
- process.exit(0);
183
- }
184
-
185
176
  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
177
  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
- }
178
+ let changed = false;
199
179
 
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));
180
+ // Ensure provider exists
181
+ if (!config.models) config.models = {};
182
+ if (!config.models.providers) config.models.providers = {};
183
+ if (!config.models.providers.blockrun) {
184
+ config.models.providers.blockrun = { api: 'openai-completions', models: [] };
185
+ changed = true;
186
+ }
204
187
 
205
- let changed = false;
188
+ const blockrun = config.models.providers.blockrun;
206
189
  if (!blockrun.apiKey) {
207
190
  blockrun.apiKey = 'x402-proxy-handles-auth';
208
191
  changed = true;
209
192
  }
210
- if (needsRefresh) {
211
- blockrun.models = openclawModels;
193
+ if (!Array.isArray(blockrun.models)) {
194
+ blockrun.models = [];
212
195
  changed = true;
213
- console.log(' Refreshed blockrun.models (' + openclawModels.length + ' models)');
214
- } else {
215
- console.log(' blockrun.models already up to date');
196
+ }
197
+
198
+ // Ensure minimax model exists in provider catalog
199
+ const hasMiniMaxModel = blockrun.models.some(m => m && m.id === 'minimax/minimax-m2.5');
200
+ if (!hasMiniMaxModel) {
201
+ blockrun.models.push({
202
+ id: 'minimax/minimax-m2.5',
203
+ name: 'MiniMax M2.5',
204
+ api: 'openai-completions',
205
+ reasoning: true,
206
+ input: ['text'],
207
+ cost: { input: 0.3, output: 1.2, cacheRead: 0, cacheWrite: 0 },
208
+ contextWindow: 204800,
209
+ maxTokens: 16384
210
+ });
211
+ changed = true;
212
+ console.log(' Added minimax model to blockrun provider catalog');
213
+ }
214
+
215
+ // Ensure minimax alias is present in model picker allowlist
216
+ if (!config.agents) config.agents = {};
217
+ if (!config.agents.defaults) config.agents.defaults = {};
218
+ if (!config.agents.defaults.models || typeof config.agents.defaults.models !== 'object') {
219
+ config.agents.defaults.models = {};
220
+ changed = true;
221
+ }
222
+ const allowlist = config.agents.defaults.models;
223
+ if (!allowlist['blockrun/minimax'] || allowlist['blockrun/minimax'].alias !== 'minimax') {
224
+ allowlist['blockrun/minimax'] = { alias: 'minimax' };
225
+ changed = true;
226
+ console.log(' Added minimax to model picker allowlist');
216
227
  }
217
228
 
218
229
  if (changed) {
219
230
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
231
+ } else {
232
+ console.log(' blockrun minimax config already up to date');
220
233
  }
221
234
  } catch (err) {
222
- console.log(' Could not refresh models catalog:', err.message);
235
+ console.log(' Could not update minimax config:', err.message);
223
236
  }
224
237
  "
225
238
 
@@ -262,7 +275,8 @@ echo ""
262
275
  echo "Run: openclaw gateway restart"
263
276
  echo ""
264
277
  echo "Model aliases available:"
265
- echo " /model sonnet → anthropic/claude-sonnet-4.6"
278
+ echo " /model sonnet4.6 → anthropic/claude-sonnet-4.6"
279
+ echo " /model opus4.6 → anthropic/claude-opus-4.6"
266
280
  echo " /model codex → openai/gpt-5.2-codex"
267
281
  echo " /model deepseek → deepseek/deepseek-chat"
268
282
  echo " /model minimax → minimax/minimax-m2.5"