@blockrun/clawrouter 0.12.130 → 0.12.132
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/index.js +142 -120
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -80053,6 +80053,83 @@ function createStatsCommand() {
|
|
|
80053
80053
|
};
|
|
80054
80054
|
}
|
|
80055
80055
|
|
|
80056
|
+
// src/commands/exclude.ts
|
|
80057
|
+
function createExcludeCommand() {
|
|
80058
|
+
return {
|
|
80059
|
+
name: "exclude",
|
|
80060
|
+
description: "Manage excluded models \u2014 /exclude add|remove|clear <model>",
|
|
80061
|
+
acceptsArgs: true,
|
|
80062
|
+
requireAuth: true,
|
|
80063
|
+
handler: async (ctx) => {
|
|
80064
|
+
const args = ctx.args?.trim() || "";
|
|
80065
|
+
const parts = args.split(/\s+/);
|
|
80066
|
+
const subcommand = parts[0]?.toLowerCase() || "";
|
|
80067
|
+
const modelArg = parts.slice(1).join(" ").trim();
|
|
80068
|
+
if (!subcommand) {
|
|
80069
|
+
const list = loadExcludeList();
|
|
80070
|
+
if (list.size === 0) {
|
|
80071
|
+
return {
|
|
80072
|
+
text: "No models excluded.\n\nUsage:\n /exclude add <model> \u2014 block a model\n /exclude remove <model> \u2014 unblock\n /exclude clear \u2014 remove all"
|
|
80073
|
+
};
|
|
80074
|
+
}
|
|
80075
|
+
const models = [...list].sort().map((m) => ` \u2022 ${m}`).join("\n");
|
|
80076
|
+
return {
|
|
80077
|
+
text: `Excluded models (${list.size}):
|
|
80078
|
+
${models}
|
|
80079
|
+
|
|
80080
|
+
Use /exclude remove <model> to unblock.`
|
|
80081
|
+
};
|
|
80082
|
+
}
|
|
80083
|
+
if (subcommand === "add") {
|
|
80084
|
+
if (!modelArg) {
|
|
80085
|
+
return {
|
|
80086
|
+
text: "Usage: /exclude add <model>\nExample: /exclude add nvidia/gpt-oss-120b",
|
|
80087
|
+
isError: true
|
|
80088
|
+
};
|
|
80089
|
+
}
|
|
80090
|
+
const resolved = addExclusion(modelArg);
|
|
80091
|
+
const list = loadExcludeList();
|
|
80092
|
+
return {
|
|
80093
|
+
text: `Excluded: ${resolved}
|
|
80094
|
+
|
|
80095
|
+
Active exclusions (${list.size}):
|
|
80096
|
+
${[...list].sort().map((m) => ` \u2022 ${m}`).join("\n")}`
|
|
80097
|
+
};
|
|
80098
|
+
}
|
|
80099
|
+
if (subcommand === "remove") {
|
|
80100
|
+
if (!modelArg) {
|
|
80101
|
+
return { text: "Usage: /exclude remove <model>", isError: true };
|
|
80102
|
+
}
|
|
80103
|
+
const removed = removeExclusion(modelArg);
|
|
80104
|
+
if (!removed) {
|
|
80105
|
+
return { text: `Model "${modelArg}" was not in the exclude list.` };
|
|
80106
|
+
}
|
|
80107
|
+
const list = loadExcludeList();
|
|
80108
|
+
return {
|
|
80109
|
+
text: `Unblocked: ${modelArg}
|
|
80110
|
+
|
|
80111
|
+
Active exclusions (${list.size}):
|
|
80112
|
+
${list.size > 0 ? [...list].sort().map((m) => ` \u2022 ${m}`).join("\n") : " (none)"}`
|
|
80113
|
+
};
|
|
80114
|
+
}
|
|
80115
|
+
if (subcommand === "clear") {
|
|
80116
|
+
clearExclusions();
|
|
80117
|
+
return { text: "All model exclusions cleared." };
|
|
80118
|
+
}
|
|
80119
|
+
return {
|
|
80120
|
+
text: `Unknown subcommand: ${subcommand}
|
|
80121
|
+
|
|
80122
|
+
Usage:
|
|
80123
|
+
/exclude \u2014 show list
|
|
80124
|
+
/exclude add <model>
|
|
80125
|
+
/exclude remove <model>
|
|
80126
|
+
/exclude clear`,
|
|
80127
|
+
isError: true
|
|
80128
|
+
};
|
|
80129
|
+
}
|
|
80130
|
+
};
|
|
80131
|
+
}
|
|
80132
|
+
|
|
80056
80133
|
// src/index.ts
|
|
80057
80134
|
init_solana_balance();
|
|
80058
80135
|
|
|
@@ -80785,81 +80862,6 @@ async function startProxyInBackground(api) {
|
|
|
80785
80862
|
api.logger.info(`Wallet (${network}): ${displayAddress} | Balance: (checking...)`);
|
|
80786
80863
|
});
|
|
80787
80864
|
}
|
|
80788
|
-
function createExcludeCommand() {
|
|
80789
|
-
return {
|
|
80790
|
-
name: "exclude",
|
|
80791
|
-
description: "Manage excluded models \u2014 /exclude add|remove|clear <model>",
|
|
80792
|
-
acceptsArgs: true,
|
|
80793
|
-
requireAuth: true,
|
|
80794
|
-
handler: async (ctx) => {
|
|
80795
|
-
const args = ctx.args?.trim() || "";
|
|
80796
|
-
const parts = args.split(/\s+/);
|
|
80797
|
-
const subcommand = parts[0]?.toLowerCase() || "";
|
|
80798
|
-
const modelArg = parts.slice(1).join(" ").trim();
|
|
80799
|
-
if (!subcommand) {
|
|
80800
|
-
const list = loadExcludeList();
|
|
80801
|
-
if (list.size === 0) {
|
|
80802
|
-
return {
|
|
80803
|
-
text: "No models excluded.\n\nUsage:\n /exclude add <model> \u2014 block a model\n /exclude remove <model> \u2014 unblock\n /exclude clear \u2014 remove all"
|
|
80804
|
-
};
|
|
80805
|
-
}
|
|
80806
|
-
const models = [...list].sort().map((m) => ` \u2022 ${m}`).join("\n");
|
|
80807
|
-
return {
|
|
80808
|
-
text: `Excluded models (${list.size}):
|
|
80809
|
-
${models}
|
|
80810
|
-
|
|
80811
|
-
Use /exclude remove <model> to unblock.`
|
|
80812
|
-
};
|
|
80813
|
-
}
|
|
80814
|
-
if (subcommand === "add") {
|
|
80815
|
-
if (!modelArg) {
|
|
80816
|
-
return {
|
|
80817
|
-
text: "Usage: /exclude add <model>\nExample: /exclude add nvidia/gpt-oss-120b",
|
|
80818
|
-
isError: true
|
|
80819
|
-
};
|
|
80820
|
-
}
|
|
80821
|
-
const resolved = addExclusion(modelArg);
|
|
80822
|
-
const list = loadExcludeList();
|
|
80823
|
-
return {
|
|
80824
|
-
text: `Excluded: ${resolved}
|
|
80825
|
-
|
|
80826
|
-
Active exclusions (${list.size}):
|
|
80827
|
-
${[...list].sort().map((m) => ` \u2022 ${m}`).join("\n")}`
|
|
80828
|
-
};
|
|
80829
|
-
}
|
|
80830
|
-
if (subcommand === "remove") {
|
|
80831
|
-
if (!modelArg) {
|
|
80832
|
-
return { text: "Usage: /exclude remove <model>", isError: true };
|
|
80833
|
-
}
|
|
80834
|
-
const removed = removeExclusion(modelArg);
|
|
80835
|
-
if (!removed) {
|
|
80836
|
-
return { text: `Model "${modelArg}" was not in the exclude list.` };
|
|
80837
|
-
}
|
|
80838
|
-
const list = loadExcludeList();
|
|
80839
|
-
return {
|
|
80840
|
-
text: `Unblocked: ${modelArg}
|
|
80841
|
-
|
|
80842
|
-
Active exclusions (${list.size}):
|
|
80843
|
-
${list.size > 0 ? [...list].sort().map((m) => ` \u2022 ${m}`).join("\n") : " (none)"}`
|
|
80844
|
-
};
|
|
80845
|
-
}
|
|
80846
|
-
if (subcommand === "clear") {
|
|
80847
|
-
clearExclusions();
|
|
80848
|
-
return { text: "All model exclusions cleared." };
|
|
80849
|
-
}
|
|
80850
|
-
return {
|
|
80851
|
-
text: `Unknown subcommand: ${subcommand}
|
|
80852
|
-
|
|
80853
|
-
Usage:
|
|
80854
|
-
/exclude \u2014 show list
|
|
80855
|
-
/exclude add <model>
|
|
80856
|
-
/exclude remove <model>
|
|
80857
|
-
/exclude clear`,
|
|
80858
|
-
isError: true
|
|
80859
|
-
};
|
|
80860
|
-
}
|
|
80861
|
-
};
|
|
80862
|
-
}
|
|
80863
80865
|
var IMAGE_DIR2 = join10(homedir7(), ".openclaw", "blockrun", "images");
|
|
80864
80866
|
var AUDIO_DIR2 = join10(homedir7(), ".openclaw", "blockrun", "audio");
|
|
80865
80867
|
function buildImageGenerationProvider() {
|
|
@@ -81252,50 +81254,49 @@ var plugin = {
|
|
|
81252
81254
|
return;
|
|
81253
81255
|
}
|
|
81254
81256
|
installSkillsToWorkspace(api.logger);
|
|
81255
|
-
if (isCompletionMode()) {
|
|
81256
|
-
api.registerProvider(blockrunProvider);
|
|
81257
|
-
return;
|
|
81258
|
-
}
|
|
81259
81257
|
const proc = process;
|
|
81260
81258
|
const alreadyRegistered = !!proc.__clawrouterRegistered;
|
|
81261
81259
|
proc.__clawrouterRegistered = true;
|
|
81262
|
-
if (
|
|
81263
|
-
api.registerProvider(blockrunProvider);
|
|
81264
|
-
|
|
81265
|
-
|
|
81266
|
-
|
|
81267
|
-
|
|
81268
|
-
|
|
81269
|
-
|
|
81270
|
-
|
|
81271
|
-
|
|
81272
|
-
|
|
81273
|
-
|
|
81274
|
-
}
|
|
81275
|
-
|
|
81276
|
-
|
|
81277
|
-
|
|
81278
|
-
|
|
81279
|
-
|
|
81280
|
-
|
|
81281
|
-
|
|
81282
|
-
|
|
81283
|
-
|
|
81284
|
-
|
|
81285
|
-
|
|
81286
|
-
|
|
81287
|
-
|
|
81288
|
-
|
|
81289
|
-
|
|
81290
|
-
|
|
81291
|
-
|
|
81292
|
-
|
|
81293
|
-
|
|
81294
|
-
|
|
81295
|
-
|
|
81296
|
-
`Failed to register partner tools: ${err instanceof Error ? err.message : String(err)}`
|
|
81260
|
+
if (isCompletionMode()) {
|
|
81261
|
+
if (!alreadyRegistered) api.registerProvider(blockrunProvider);
|
|
81262
|
+
return;
|
|
81263
|
+
}
|
|
81264
|
+
if (alreadyRegistered) return;
|
|
81265
|
+
api.registerProvider(blockrunProvider);
|
|
81266
|
+
api.registerImageGenerationProvider(buildImageGenerationProvider());
|
|
81267
|
+
api.registerMusicGenerationProvider(buildMusicGenerationProvider());
|
|
81268
|
+
injectModelsConfig(api.logger);
|
|
81269
|
+
injectAuthProfile(api.logger);
|
|
81270
|
+
const runtimePort = getProxyPort();
|
|
81271
|
+
if (!api.config.models) {
|
|
81272
|
+
api.config.models = { providers: {} };
|
|
81273
|
+
}
|
|
81274
|
+
if (!api.config.models.providers) {
|
|
81275
|
+
api.config.models.providers = {};
|
|
81276
|
+
}
|
|
81277
|
+
api.config.models.providers.blockrun = {
|
|
81278
|
+
baseUrl: `http://127.0.0.1:${runtimePort}/v1`,
|
|
81279
|
+
api: "openai-completions",
|
|
81280
|
+
// apiKey is required by pi-coding-agent's ModelRegistry for providers with models.
|
|
81281
|
+
apiKey: "x402-proxy-handles-auth",
|
|
81282
|
+
models: OPENCLAW_MODELS
|
|
81283
|
+
};
|
|
81284
|
+
api.logger.info("BlockRun provider registered (55+ models via x402)");
|
|
81285
|
+
try {
|
|
81286
|
+
const proxyBaseUrl = `http://127.0.0.1:${runtimePort}`;
|
|
81287
|
+
const partnerTools = buildPartnerTools(proxyBaseUrl);
|
|
81288
|
+
for (const tool of partnerTools) {
|
|
81289
|
+
api.registerTool(tool);
|
|
81290
|
+
}
|
|
81291
|
+
if (partnerTools.length > 0) {
|
|
81292
|
+
api.logger.info(
|
|
81293
|
+
`Registered ${partnerTools.length} partner tool(s): ${partnerTools.map((t) => t.name).join(", ")}`
|
|
81297
81294
|
);
|
|
81298
81295
|
}
|
|
81296
|
+
} catch (err) {
|
|
81297
|
+
api.logger.warn(
|
|
81298
|
+
`Failed to register partner tools: ${err instanceof Error ? err.message : String(err)}`
|
|
81299
|
+
);
|
|
81299
81300
|
}
|
|
81300
81301
|
api.registerCommand({
|
|
81301
81302
|
name: "partners",
|
|
@@ -81332,7 +81333,6 @@ var plugin = {
|
|
|
81332
81333
|
api.registerCommand(createStatsCommand());
|
|
81333
81334
|
api.registerCommand(createExcludeCommand());
|
|
81334
81335
|
api.logger.info("Commands registered: /wallet, /blockrun, /stats, /exclude");
|
|
81335
|
-
if (alreadyRegistered) return;
|
|
81336
81336
|
api.registerService({
|
|
81337
81337
|
id: "clawrouter-proxy",
|
|
81338
81338
|
start: () => {
|
|
@@ -81375,12 +81375,34 @@ var plugin = {
|
|
|
81375
81375
|
api.logger.info("Not in gateway mode \u2014 proxy will start when gateway runs");
|
|
81376
81376
|
return;
|
|
81377
81377
|
}
|
|
81378
|
-
|
|
81379
|
-
|
|
81380
|
-
|
|
81381
|
-
|
|
81382
|
-
|
|
81378
|
+
const proxyPort = getProxyPort();
|
|
81379
|
+
const portProbe = import("net").then(
|
|
81380
|
+
(net) => new Promise((resolve) => {
|
|
81381
|
+
const sock = net.connect({ host: "127.0.0.1", port: proxyPort }, () => {
|
|
81382
|
+
sock.destroy();
|
|
81383
|
+
resolve(true);
|
|
81384
|
+
});
|
|
81385
|
+
sock.on("error", () => resolve(false));
|
|
81386
|
+
sock.setTimeout(500, () => {
|
|
81387
|
+
sock.destroy();
|
|
81388
|
+
resolve(false);
|
|
81389
|
+
});
|
|
81390
|
+
})
|
|
81391
|
+
);
|
|
81392
|
+
portProbe.then((portInUse) => {
|
|
81393
|
+
if (portInUse) {
|
|
81394
|
+
api.logger.info(
|
|
81395
|
+
`Port ${proxyPort} already in use \u2014 skipping proxy startup (another instance running)`
|
|
81396
|
+
);
|
|
81397
|
+
return;
|
|
81383
81398
|
}
|
|
81399
|
+
return startProxyInBackground(api).then(async () => {
|
|
81400
|
+
const port = getProxyPort();
|
|
81401
|
+
const healthy = await waitForProxyHealth(port, 15e3);
|
|
81402
|
+
if (!healthy) {
|
|
81403
|
+
api.logger.warn(`Proxy health check timed out, commands may not work immediately`);
|
|
81404
|
+
}
|
|
81405
|
+
});
|
|
81384
81406
|
}).catch((err) => {
|
|
81385
81407
|
api.logger.error(
|
|
81386
81408
|
`Failed to start BlockRun proxy: ${err instanceof Error ? err.message : String(err)}`
|