@blockrun/clawrouter 0.10.3 → 0.10.4

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/README.md CHANGED
@@ -228,15 +228,14 @@ For basic usage, no configuration needed. For advanced options:
228
228
  npx @blockrun/clawrouter doctor
229
229
  ```
230
230
 
231
- This collects diagnostics and sends them to Claude Opus 4.6 for AI-powered analysis:
231
+ This collects diagnostics and sends them to Claude Sonnet for AI-powered analysis:
232
232
 
233
233
  ```
234
- đŸŠē BlockRun Doctor v0.10.1
234
+ đŸŠē BlockRun Doctor v0.10.4
235
235
 
236
236
  System
237
237
  ✓ OS: darwin arm64
238
238
  ✓ Node: v20.11.0
239
- ✓ Memory: 8.2GB free / 16.0GB
240
239
 
241
240
  Wallet
242
241
  ✓ Address: 0x1234...abcd
@@ -246,19 +245,26 @@ Network
246
245
  ✓ BlockRun API: reachable (142ms)
247
246
  ✗ Local proxy: not running on :8402
248
247
 
249
- 📤 Sending to Claude Opus 4.6...
248
+ 📤 Sending to Claude Sonnet 4.6 (~$0.003)...
250
249
 
251
250
  🤖 AI Analysis:
252
251
  The local proxy isn't running. Run `openclaw gateway restart` to fix.
253
252
  ```
254
253
 
254
+ **Use Opus for complex issues:**
255
+
256
+ ```bash
257
+ npx @blockrun/clawrouter doctor opus
258
+ ```
259
+
255
260
  **Ask a specific question:**
256
261
 
257
262
  ```bash
258
263
  npx @blockrun/clawrouter doctor "why is my request failing?"
264
+ npx @blockrun/clawrouter doctor opus "æˇąåēĻåˆ†æžæˆ‘įš„é…įŊŽ"
259
265
  ```
260
266
 
261
- **Cost:** ~$0.01 per analysis (paid via your wallet balance)
267
+ **Cost:** Sonnet ~$0.003 (default) | Opus ~$0.01
262
268
 
263
269
  ---
264
270
 
package/dist/cli.js CHANGED
@@ -5427,7 +5427,19 @@ function printDiagnostics(result) {
5427
5427
  }
5428
5428
  }
5429
5429
  }
5430
- async function analyzeWithAI(diagnostics, userQuestion) {
5430
+ var DOCTOR_MODELS = {
5431
+ sonnet: {
5432
+ id: "anthropic/claude-sonnet-4.6",
5433
+ name: "Claude Sonnet 4.6",
5434
+ cost: "~$0.003"
5435
+ },
5436
+ opus: {
5437
+ id: "anthropic/claude-opus-4.6",
5438
+ name: "Claude Opus 4.6",
5439
+ cost: "~$0.01"
5440
+ }
5441
+ };
5442
+ async function analyzeWithAI(diagnostics, userQuestion, model = "sonnet") {
5431
5443
  if (diagnostics.wallet.isEmpty) {
5432
5444
  console.log("\n\u{1F4B3} Wallet is empty - cannot call AI for analysis.");
5433
5445
  console.log(` Fund your wallet with USDC on Base: ${diagnostics.wallet.address}`);
@@ -5435,7 +5447,10 @@ async function analyzeWithAI(diagnostics, userQuestion) {
5435
5447
  console.log(" Bridge to Base: https://bridge.base.org\n");
5436
5448
  return;
5437
5449
  }
5438
- console.log("\n\u{1F4E4} Sending to Claude Opus 4.6...\n");
5450
+ const modelConfig = DOCTOR_MODELS[model];
5451
+ console.log(`
5452
+ \u{1F4E4} Sending to ${modelConfig.name} (${modelConfig.cost})...
5453
+ `);
5439
5454
  try {
5440
5455
  const { key } = await resolveOrGenerateWalletKey();
5441
5456
  const { fetch: paymentFetch } = createPaymentFetch(key);
@@ -5445,7 +5460,7 @@ async function analyzeWithAI(diagnostics, userQuestion) {
5445
5460
  method: "POST",
5446
5461
  headers: { "Content-Type": "application/json" },
5447
5462
  body: JSON.stringify({
5448
- model: "anthropic/claude-opus-4.6",
5463
+ model: modelConfig.id,
5449
5464
  stream: false,
5450
5465
  messages: [
5451
5466
  {
@@ -5496,7 +5511,7 @@ Error calling AI: ${err instanceof Error ? err.message : String(err)}`);
5496
5511
  console.log("Try again or check your wallet balance.\n");
5497
5512
  }
5498
5513
  }
5499
- async function runDoctor(userQuestion) {
5514
+ async function runDoctor(userQuestion, model = "sonnet") {
5500
5515
  console.log(`
5501
5516
  \u{1FA7A} BlockRun Doctor v${VERSION}
5502
5517
  `);
@@ -5517,7 +5532,7 @@ async function runDoctor(userQuestion) {
5517
5532
  };
5518
5533
  result.issues = identifyIssues(result);
5519
5534
  printDiagnostics(result);
5520
- await analyzeWithAI(result, userQuestion);
5535
+ await analyzeWithAI(result, userQuestion, model);
5521
5536
  }
5522
5537
 
5523
5538
  // src/cli.ts
@@ -5527,7 +5542,7 @@ ClawRouter v${VERSION} - Smart LLM Router
5527
5542
 
5528
5543
  Usage:
5529
5544
  clawrouter [options]
5530
- clawrouter doctor Run AI-powered diagnostics
5545
+ clawrouter doctor [opus] [question]
5531
5546
 
5532
5547
  Options:
5533
5548
  --version, -v Show version number
@@ -5535,24 +5550,24 @@ Options:
5535
5550
  --port <number> Port to listen on (default: ${getProxyPort()})
5536
5551
 
5537
5552
  Commands:
5538
- doctor [question] Diagnose issues and get AI-powered fix suggestions
5539
- Optional: Add your question for targeted help
5553
+ doctor AI-powered diagnostics (default: Sonnet ~$0.003)
5554
+ doctor opus Use Opus for deeper analysis (~$0.01)
5540
5555
 
5541
5556
  Examples:
5542
- # Start standalone proxy (survives gateway restarts)
5557
+ # Start standalone proxy
5543
5558
  npx @blockrun/clawrouter
5544
5559
 
5545
- # Start on custom port
5546
- npx @blockrun/clawrouter --port 9000
5547
-
5548
- # Run diagnostics when something isn't working
5560
+ # Run diagnostics (uses Sonnet by default)
5549
5561
  npx @blockrun/clawrouter doctor
5550
5562
 
5563
+ # Use Opus for complex issues
5564
+ npx @blockrun/clawrouter doctor opus
5565
+
5551
5566
  # Ask a specific question
5552
5567
  npx @blockrun/clawrouter doctor "why is my request failing?"
5553
5568
 
5554
- # Production deployment with PM2
5555
- pm2 start "npx @blockrun/clawrouter" --name clawrouter
5569
+ # Opus + question
5570
+ npx @blockrun/clawrouter doctor opus "\u6DF1\u5EA6\u5206\u6790\u6211\u7684\u914D\u7F6E\u95EE\u9898"
5556
5571
 
5557
5572
  Environment Variables:
5558
5573
  BLOCKRUN_WALLET_KEY Private key for x402 payments (auto-generated if not set)
@@ -5591,8 +5606,18 @@ async function main() {
5591
5606
  if (args.doctor) {
5592
5607
  const rawArgs = process.argv.slice(2);
5593
5608
  const doctorIndex = rawArgs.findIndex((a) => a === "doctor" || a === "--doctor");
5594
- const userQuestion = rawArgs.slice(doctorIndex + 1).join(" ").trim() || void 0;
5595
- await runDoctor(userQuestion);
5609
+ const afterDoctor = rawArgs.slice(doctorIndex + 1);
5610
+ let model = "sonnet";
5611
+ let questionArgs = afterDoctor;
5612
+ if (afterDoctor[0] === "opus") {
5613
+ model = "opus";
5614
+ questionArgs = afterDoctor.slice(1);
5615
+ } else if (afterDoctor[0] === "sonnet") {
5616
+ model = "sonnet";
5617
+ questionArgs = afterDoctor.slice(1);
5618
+ }
5619
+ const userQuestion = questionArgs.join(" ").trim() || void 0;
5620
+ await runDoctor(userQuestion, model);
5596
5621
  process.exit(0);
5597
5622
  }
5598
5623
  const { key: walletKey, address, source } = await resolveOrGenerateWalletKey();