@blockrun/clawrouter 0.9.24 → 0.9.25
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 +49 -36
package/package.json
CHANGED
package/scripts/reinstall.sh
CHANGED
|
@@ -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
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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
|
-
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
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 (
|
|
211
|
-
blockrun.models =
|
|
193
|
+
if (!Array.isArray(blockrun.models)) {
|
|
194
|
+
blockrun.models = [];
|
|
212
195
|
changed = true;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
|
235
|
+
console.log(' Could not update minimax config:', err.message);
|
|
223
236
|
}
|
|
224
237
|
"
|
|
225
238
|
|