@blockrun/clawrouter 0.12.69 → 0.12.71
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 +6 -0
- package/dist/cli.js +25 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.js +74 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44822,7 +44822,12 @@ var DEFAULT_ROUTING_CONFIG = {
|
|
|
44822
44822
|
COMPLEX: {
|
|
44823
44823
|
primary: "google/gemini-3.1-flash-lite",
|
|
44824
44824
|
// $0.25/$1.50 — 1M context handles complexity
|
|
44825
|
-
fallback: [
|
|
44825
|
+
fallback: [
|
|
44826
|
+
"google/gemini-2.5-flash-lite",
|
|
44827
|
+
"xai/grok-4-0709",
|
|
44828
|
+
"google/gemini-2.5-flash",
|
|
44829
|
+
"deepseek/deepseek-chat"
|
|
44830
|
+
]
|
|
44826
44831
|
},
|
|
44827
44832
|
REASONING: {
|
|
44828
44833
|
primary: "xai/grok-4-1-fast-reasoning",
|
|
@@ -47774,11 +47779,20 @@ function estimateAmount(modelId, bodyLength, maxTokens) {
|
|
|
47774
47779
|
return amountMicros.toString();
|
|
47775
47780
|
}
|
|
47776
47781
|
var IMAGE_PRICING = {
|
|
47777
|
-
"openai/dall-e-3": {
|
|
47778
|
-
|
|
47782
|
+
"openai/dall-e-3": {
|
|
47783
|
+
default: 0.04,
|
|
47784
|
+
sizes: { "1024x1024": 0.04, "1792x1024": 0.08, "1024x1792": 0.08 }
|
|
47785
|
+
},
|
|
47786
|
+
"openai/gpt-image-1": {
|
|
47787
|
+
default: 0.02,
|
|
47788
|
+
sizes: { "1024x1024": 0.02, "1536x1024": 0.04, "1024x1536": 0.04 }
|
|
47789
|
+
},
|
|
47779
47790
|
"black-forest/flux-1.1-pro": { default: 0.04 },
|
|
47780
47791
|
"google/nano-banana": { default: 0.05 },
|
|
47781
|
-
"google/nano-banana-pro": {
|
|
47792
|
+
"google/nano-banana-pro": {
|
|
47793
|
+
default: 0.1,
|
|
47794
|
+
sizes: { "1024x1024": 0.1, "2048x2048": 0.1, "4096x4096": 0.15 }
|
|
47795
|
+
}
|
|
47782
47796
|
};
|
|
47783
47797
|
function estimateImageCost(model, size5, n = 1) {
|
|
47784
47798
|
const pricing = IMAGE_PRICING[model];
|
|
@@ -48334,7 +48348,13 @@ async function startProxy(options) {
|
|
|
48334
48348
|
}
|
|
48335
48349
|
if (req.url?.match(/^\/v1\/(?:x|partner)\//)) {
|
|
48336
48350
|
try {
|
|
48337
|
-
await proxyPartnerRequest(
|
|
48351
|
+
await proxyPartnerRequest(
|
|
48352
|
+
req,
|
|
48353
|
+
res,
|
|
48354
|
+
apiBase,
|
|
48355
|
+
payFetch,
|
|
48356
|
+
() => paymentStore.getStore()?.amountUsd ?? 0
|
|
48357
|
+
);
|
|
48338
48358
|
} catch (err) {
|
|
48339
48359
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
48340
48360
|
options.onError?.(error);
|
|
@@ -50288,7 +50308,8 @@ import {
|
|
|
50288
50308
|
renameSync
|
|
50289
50309
|
} from "fs";
|
|
50290
50310
|
import { homedir as homedir7 } from "os";
|
|
50291
|
-
import { join as join10 } from "path";
|
|
50311
|
+
import { join as join10, dirname as dirname3 } from "path";
|
|
50312
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
50292
50313
|
init_accounts();
|
|
50293
50314
|
|
|
50294
50315
|
// src/partners/registry.ts
|
|
@@ -50709,6 +50730,48 @@ async function waitForProxyHealth(port, timeoutMs = 3e3) {
|
|
|
50709
50730
|
}
|
|
50710
50731
|
return false;
|
|
50711
50732
|
}
|
|
50733
|
+
function installSkillsToWorkspace(logger) {
|
|
50734
|
+
try {
|
|
50735
|
+
const packageRoot = join10(dirname3(fileURLToPath2(import.meta.url)), "..");
|
|
50736
|
+
const bundledSkillsDir = join10(packageRoot, "skills");
|
|
50737
|
+
if (!existsSync3(bundledSkillsDir)) {
|
|
50738
|
+
return;
|
|
50739
|
+
}
|
|
50740
|
+
const workspaceSkillsDir = join10(homedir7(), ".openclaw", "skills");
|
|
50741
|
+
mkdirSync3(workspaceSkillsDir, { recursive: true });
|
|
50742
|
+
const entries = readdirSync(bundledSkillsDir, { withFileTypes: true });
|
|
50743
|
+
let installed = 0;
|
|
50744
|
+
for (const entry of entries) {
|
|
50745
|
+
if (!entry.isDirectory()) continue;
|
|
50746
|
+
const skillName = entry.name;
|
|
50747
|
+
const srcSkillFile = join10(bundledSkillsDir, skillName, "SKILL.md");
|
|
50748
|
+
if (!existsSync3(srcSkillFile)) continue;
|
|
50749
|
+
const destDir = join10(workspaceSkillsDir, `blockrun-${skillName}`);
|
|
50750
|
+
const destSkillFile = join10(destDir, "SKILL.md");
|
|
50751
|
+
let needsUpdate = true;
|
|
50752
|
+
if (existsSync3(destSkillFile)) {
|
|
50753
|
+
try {
|
|
50754
|
+
const srcContent = readTextFileSync(srcSkillFile);
|
|
50755
|
+
const destContent = readTextFileSync(destSkillFile);
|
|
50756
|
+
if (srcContent === destContent) needsUpdate = false;
|
|
50757
|
+
} catch {
|
|
50758
|
+
}
|
|
50759
|
+
}
|
|
50760
|
+
if (needsUpdate) {
|
|
50761
|
+
mkdirSync3(destDir, { recursive: true });
|
|
50762
|
+
copyFileSync(srcSkillFile, destSkillFile);
|
|
50763
|
+
installed++;
|
|
50764
|
+
}
|
|
50765
|
+
}
|
|
50766
|
+
if (installed > 0) {
|
|
50767
|
+
logger.info(`Installed ${installed} skill(s) to ${workspaceSkillsDir}`);
|
|
50768
|
+
}
|
|
50769
|
+
} catch (err) {
|
|
50770
|
+
logger.warn(
|
|
50771
|
+
`Failed to install skills: ${err instanceof Error ? err.message : String(err)}`
|
|
50772
|
+
);
|
|
50773
|
+
}
|
|
50774
|
+
}
|
|
50712
50775
|
function isCompletionMode() {
|
|
50713
50776
|
const args = process.argv;
|
|
50714
50777
|
return args.some((arg, i) => arg === "completion" && i >= 1 && i <= 3);
|
|
@@ -50823,8 +50886,9 @@ function injectModelsConfig(logger) {
|
|
|
50823
50886
|
needsWrite = true;
|
|
50824
50887
|
}
|
|
50825
50888
|
const defaults = agents.defaults;
|
|
50826
|
-
if (!defaults.model) {
|
|
50827
|
-
defaults.model
|
|
50889
|
+
if (!defaults.model || typeof defaults.model !== "object" || Array.isArray(defaults.model)) {
|
|
50890
|
+
const prev = typeof defaults.model === "string" ? defaults.model : void 0;
|
|
50891
|
+
defaults.model = prev ? { primary: prev } : {};
|
|
50828
50892
|
needsWrite = true;
|
|
50829
50893
|
}
|
|
50830
50894
|
const model = defaults.model;
|
|
@@ -51033,9 +51097,7 @@ async function startProxyInBackground(api) {
|
|
|
51033
51097
|
}
|
|
51034
51098
|
if (currentChain === "solana" && (balance.isEmpty || balance.isLow)) {
|
|
51035
51099
|
try {
|
|
51036
|
-
const
|
|
51037
|
-
const monitor = proxy.balanceMonitor;
|
|
51038
|
-
const solLamports = await monitor.checkSolBalance();
|
|
51100
|
+
const solLamports = await proxy.balanceMonitor.checkSolBalance();
|
|
51039
51101
|
if (solLamports > 10000000n) {
|
|
51040
51102
|
const sol = Number(solLamports) / 1e9;
|
|
51041
51103
|
api.logger.info(
|
|
@@ -51396,6 +51458,7 @@ var plugin = {
|
|
|
51396
51458
|
api.logger.info("ClawRouter disabled (CLAWROUTER_DISABLED=true). Using default routing.");
|
|
51397
51459
|
return;
|
|
51398
51460
|
}
|
|
51461
|
+
installSkillsToWorkspace(api.logger);
|
|
51399
51462
|
if (isCompletionMode()) {
|
|
51400
51463
|
api.registerProvider(blockrunProvider);
|
|
51401
51464
|
return;
|