Skip to content

Commit 991ab16

Browse files
committed
fix: add auth profile injection to reinstall script
Ensures blockrun provider auth is created during reinstall, fixing 'No API key found for provider blockrun' errors.
1 parent d81f849 commit 991ab16

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@blockrun/clawrouter",
3-
"version": "0.3.15",
3+
"version": "0.3.16",
44
"description": "Smart LLM router — save 78% on inference costs. 30+ models, one wallet, x402 micropayments.",
55
"type": "module",
66
"main": "dist/index.js",

scripts/reinstall.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,36 @@ lsof -ti :8402 | xargs kill -9 2>/dev/null || true
2929
echo "→ Installing ClawRouter..."
3030
openclaw plugins install @blockrun/clawrouter
3131

32+
# 5. Inject auth profile (ensures blockrun provider is recognized)
33+
echo "→ Injecting auth profile..."
34+
node -e "
35+
const os = require('os');
36+
const fs = require('fs');
37+
const path = require('path');
38+
const authDir = path.join(os.homedir(), '.openclaw', 'agents', 'main', 'agent');
39+
const authPath = path.join(authDir, 'auth-profiles.json');
40+
41+
// Create directory if needed
42+
fs.mkdirSync(authDir, { recursive: true });
43+
44+
// Load or create auth-profiles.json
45+
let authProfiles = {};
46+
if (fs.existsSync(authPath)) {
47+
try { authProfiles = JSON.parse(fs.readFileSync(authPath, 'utf8')); } catch {}
48+
}
49+
50+
// Inject blockrun auth if missing
51+
if (!authProfiles.blockrun) {
52+
authProfiles.blockrun = {
53+
profileId: 'default',
54+
credential: { apiKey: 'x402-proxy-handles-auth' }
55+
};
56+
fs.writeFileSync(authPath, JSON.stringify(authProfiles, null, 2));
57+
console.log(' Auth profile created');
58+
} else {
59+
console.log(' Auth profile already exists');
60+
}
61+
"
62+
3263
echo ""
3364
echo "✓ Done! Run: openclaw gateway restart"

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ const plugin: OpenClawPluginDefinition = {
232232
id: "clawrouter",
233233
name: "ClawRouter",
234234
description: "Smart LLM router — 30+ models, x402 micropayments, 78% cost savings",
235-
version: "0.3.15",
235+
version: "0.3.16",
236236

237237
register(api: OpenClawPluginApi) {
238238
// Skip heavy initialization in completion mode — only completion script is needed

0 commit comments

Comments
 (0)