@blockrun/clawrouter 0.12.259 → 0.12.260

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/dist/cli.js CHANGED
@@ -226792,7 +226792,8 @@ import {
226792
226792
  readdirSync,
226793
226793
  mkdirSync as mkdirSync3,
226794
226794
  copyFileSync,
226795
- renameSync as renameSync2
226795
+ renameSync as renameSync2,
226796
+ unlinkSync
226796
226797
  } from "fs";
226797
226798
  import { readFile as readFileAsync } from "fs/promises";
226798
226799
  import { homedir as homedir13 } from "os";
@@ -227137,6 +227138,15 @@ function injectAuthProfile(logger48) {
227137
227138
  for (const agentId of agents) {
227138
227139
  const authDir = join16(agentsDir, agentId, "agent");
227139
227140
  const authPath = join16(authDir, "auth-profiles.json");
227141
+ const sqlitePath = join16(authDir, "openclaw-agent.sqlite");
227142
+ if (existsSync4(sqlitePath)) {
227143
+ removeInjectedAuthPlaceholder(authPath, logger48, agentId);
227144
+ continue;
227145
+ }
227146
+ if (agentId === "main") {
227147
+ removeInjectedAuthPlaceholder(authPath, logger48, agentId);
227148
+ continue;
227149
+ }
227140
227150
  if (!existsSync4(authDir)) {
227141
227151
  try {
227142
227152
  mkdirSync3(authDir, { recursive: true });
@@ -227179,6 +227189,25 @@ function injectAuthProfile(logger48) {
227179
227189
  logger48.info(`Auth injection failed: ${err instanceof Error ? err.message : String(err)}`);
227180
227190
  }
227181
227191
  }
227192
+ function removeInjectedAuthPlaceholder(authPath, logger48, agentId) {
227193
+ try {
227194
+ if (!existsSync4(authPath)) return;
227195
+ const parsed = JSON.parse(readTextFileSync(authPath));
227196
+ const profiles = parsed?.profiles;
227197
+ if (!profiles || typeof profiles !== "object" || Array.isArray(profiles)) return;
227198
+ const keys = Object.keys(profiles);
227199
+ if (keys.length !== 1 || keys[0] !== "blockrun:default") return;
227200
+ const entry = profiles["blockrun:default"];
227201
+ if (!entry || typeof entry !== "object") return;
227202
+ const profile = entry;
227203
+ if (profile.type !== "api_key" || profile.provider !== "blockrun" || profile.key !== "x402-proxy-handles-auth") {
227204
+ return;
227205
+ }
227206
+ unlinkSync(authPath);
227207
+ logger48.info(`Removed legacy BlockRun auth placeholder for agent: ${agentId}`);
227208
+ } catch {
227209
+ }
227210
+ }
227182
227211
  function clearDeferredProxyStartTimer(proc = process) {
227183
227212
  if (!proc.__clawrouterDeferredStartTimer) return false;
227184
227213
  clearTimeout(proc.__clawrouterDeferredStartTimer);
package/dist/index.d.ts CHANGED
@@ -1692,8 +1692,21 @@ declare function syncAgentModelCache(logger: {
1692
1692
  }): void;
1693
1693
  /**
1694
1694
  * Inject dummy auth profile for BlockRun into agent auth stores.
1695
- * OpenClaw's agent system looks for auth credentials even if provider has auth: [].
1696
- * We inject a placeholder so the lookup succeeds (proxy handles real auth internally).
1695
+ *
1696
+ * The legacy ``auth-profiles.json`` write is now deliberately narrow:
1697
+ *
1698
+ * - Wherever ``openclaw-agent.sqlite`` exists, the SQLite auth store is
1699
+ * authoritative. Writing the legacy JSON beside it is at best ignored, at
1700
+ * worst a failed-closed migration trigger: since OpenClaw 2026.8.1 a
1701
+ * leftover legacy file beside a store that holds no profiles fails auth
1702
+ * migration for the whole agent fleet. So we never write there, and we
1703
+ * clean up the placeholder we previously injected.
1704
+ * - The shared auth-owner directory (``main``) is managed by OpenClaw
1705
+ * itself; a placeholder written there can shadow that state. The
1706
+ * provider's real auth comes from the x402 proxy (and the apiKey
1707
+ * injectModelsConfig writes into openclaw.json), so nothing is lost.
1708
+ * - Only on very old installs with no SQLite store at all do we keep the
1709
+ * original JSON bootstrap, which those releases import.
1697
1710
  */
1698
1711
  declare function injectAuthProfile(logger: {
1699
1712
  info: (msg: string) => void;
package/dist/index.js CHANGED
@@ -226539,7 +226539,8 @@ import {
226539
226539
  readdirSync,
226540
226540
  mkdirSync as mkdirSync3,
226541
226541
  copyFileSync,
226542
- renameSync as renameSync2
226542
+ renameSync as renameSync2,
226543
+ unlinkSync
226543
226544
  } from "fs";
226544
226545
  import { readFile as readFileAsync } from "fs/promises";
226545
226546
  import { homedir as homedir13 } from "os";
@@ -226884,6 +226885,15 @@ function injectAuthProfile(logger48) {
226884
226885
  for (const agentId of agents) {
226885
226886
  const authDir = join16(agentsDir, agentId, "agent");
226886
226887
  const authPath = join16(authDir, "auth-profiles.json");
226888
+ const sqlitePath = join16(authDir, "openclaw-agent.sqlite");
226889
+ if (existsSync3(sqlitePath)) {
226890
+ removeInjectedAuthPlaceholder(authPath, logger48, agentId);
226891
+ continue;
226892
+ }
226893
+ if (agentId === "main") {
226894
+ removeInjectedAuthPlaceholder(authPath, logger48, agentId);
226895
+ continue;
226896
+ }
226887
226897
  if (!existsSync3(authDir)) {
226888
226898
  try {
226889
226899
  mkdirSync3(authDir, { recursive: true });
@@ -226926,6 +226936,25 @@ function injectAuthProfile(logger48) {
226926
226936
  logger48.info(`Auth injection failed: ${err instanceof Error ? err.message : String(err)}`);
226927
226937
  }
226928
226938
  }
226939
+ function removeInjectedAuthPlaceholder(authPath, logger48, agentId) {
226940
+ try {
226941
+ if (!existsSync3(authPath)) return;
226942
+ const parsed = JSON.parse(readTextFileSync(authPath));
226943
+ const profiles = parsed?.profiles;
226944
+ if (!profiles || typeof profiles !== "object" || Array.isArray(profiles)) return;
226945
+ const keys = Object.keys(profiles);
226946
+ if (keys.length !== 1 || keys[0] !== "blockrun:default") return;
226947
+ const entry = profiles["blockrun:default"];
226948
+ if (!entry || typeof entry !== "object") return;
226949
+ const profile = entry;
226950
+ if (profile.type !== "api_key" || profile.provider !== "blockrun" || profile.key !== "x402-proxy-handles-auth") {
226951
+ return;
226952
+ }
226953
+ unlinkSync(authPath);
226954
+ logger48.info(`Removed legacy BlockRun auth placeholder for agent: ${agentId}`);
226955
+ } catch {
226956
+ }
226957
+ }
226929
226958
  function clearDeferredProxyStartTimer(proc = process) {
226930
226959
  if (!proc.__clawrouterDeferredStartTimer) return false;
226931
226960
  clearTimeout(proc.__clawrouterDeferredStartTimer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/clawrouter",
3
- "version": "0.12.259",
3
+ "version": "0.12.260",
4
4
  "description": "Smart LLM router — save 84% on inference costs. 76 models (7 free), one wallet, x402 micropayments.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",