@blockrun/clawrouter 0.12.141 → 0.12.142
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 +61 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -81374,6 +81374,41 @@ async function startProxyInBackground(api) {
|
|
|
81374
81374
|
api.logger.info(`Wallet (${network}): ${displayAddress} | Balance: (checking...)`);
|
|
81375
81375
|
});
|
|
81376
81376
|
}
|
|
81377
|
+
function startProxyAfterPortProbe(api) {
|
|
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;
|
|
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
|
+
});
|
|
81406
|
+
}).catch((err) => {
|
|
81407
|
+
api.logger.error(
|
|
81408
|
+
`Failed to start BlockRun proxy: ${err instanceof Error ? err.message : String(err)}`
|
|
81409
|
+
);
|
|
81410
|
+
});
|
|
81411
|
+
}
|
|
81377
81412
|
var IMAGE_DIR2 = join10(homedir7(), ".openclaw", "blockrun", "images");
|
|
81378
81413
|
var AUDIO_DIR2 = join10(homedir7(), ".openclaw", "blockrun", "audio");
|
|
81379
81414
|
function buildImageGenerationProvider() {
|
|
@@ -81817,7 +81852,10 @@ var plugin = {
|
|
|
81817
81852
|
}
|
|
81818
81853
|
api.config.tools.web.search.provider = BLOCKRUN_EXA_PROVIDER_ID;
|
|
81819
81854
|
api.config.tools.web.search.enabled = true;
|
|
81820
|
-
const runtimeMcpResult = ensureBlockrunMcpServerConfig(
|
|
81855
|
+
const runtimeMcpResult = ensureBlockrunMcpServerConfig(
|
|
81856
|
+
api.config,
|
|
81857
|
+
blockrunMcpServer.definition
|
|
81858
|
+
);
|
|
81821
81859
|
api.logger.info("BlockRun provider registered (55+ models via x402)");
|
|
81822
81860
|
if (typeof api.registerWebSearchProvider === "function") {
|
|
81823
81861
|
api.logger.info(`Registered BlockRun web_search provider (${BLOCKRUN_EXA_PROVIDER_ID})`);
|
|
@@ -81827,9 +81865,7 @@ var plugin = {
|
|
|
81827
81865
|
blockrunMcpServer.source === "local" ? `Configured BlockRun MCP server (${BLOCKRUN_MCP_SERVER_NAME}) from local blockrun-mcp build` : `Configured BlockRun MCP server (${BLOCKRUN_MCP_SERVER_NAME}) via npx @blockrun/mcp@latest`
|
|
81828
81866
|
);
|
|
81829
81867
|
} else if (runtimeMcpResult.status === "preserved") {
|
|
81830
|
-
api.logger.info(
|
|
81831
|
-
`Preserved custom BlockRun MCP server config (${BLOCKRUN_MCP_SERVER_NAME})`
|
|
81832
|
-
);
|
|
81868
|
+
api.logger.info(`Preserved custom BlockRun MCP server config (${BLOCKRUN_MCP_SERVER_NAME})`);
|
|
81833
81869
|
}
|
|
81834
81870
|
try {
|
|
81835
81871
|
const proxyBaseUrl = `http://127.0.0.1:${runtimePort}`;
|
|
@@ -81924,44 +81960,32 @@ var plugin = {
|
|
|
81924
81960
|
api.logger.info("Not in gateway mode \u2014 proxy will start when gateway runs");
|
|
81925
81961
|
return;
|
|
81926
81962
|
}
|
|
81963
|
+
const pluginConfigEmpty = !api.pluginConfig || typeof api.pluginConfig !== "object" || Object.keys(api.pluginConfig).length === 0;
|
|
81927
81964
|
if (proxyAlreadyStarted) {
|
|
81928
81965
|
api.logger.info("Proxy already started by earlier register() call \u2014 skipping");
|
|
81929
81966
|
return;
|
|
81930
81967
|
}
|
|
81931
|
-
|
|
81932
|
-
|
|
81933
|
-
|
|
81934
|
-
|
|
81935
|
-
|
|
81936
|
-
|
|
81937
|
-
|
|
81938
|
-
|
|
81939
|
-
|
|
81940
|
-
sock.setTimeout(500, () => {
|
|
81941
|
-
sock.destroy();
|
|
81942
|
-
resolve(false);
|
|
81943
|
-
});
|
|
81944
|
-
})
|
|
81945
|
-
);
|
|
81946
|
-
portProbe.then((portInUse) => {
|
|
81947
|
-
if (portInUse) {
|
|
81948
|
-
api.logger.info(
|
|
81949
|
-
`Port ${proxyPort} already in use \u2014 skipping proxy startup (another instance running)`
|
|
81950
|
-
);
|
|
81951
|
-
return;
|
|
81952
|
-
}
|
|
81953
|
-
return startProxyInBackground(api).then(async () => {
|
|
81954
|
-
const port = getProxyPort();
|
|
81955
|
-
const healthy = await waitForProxyHealth(port, 15e3);
|
|
81956
|
-
if (!healthy) {
|
|
81957
|
-
api.logger.warn(`Proxy health check timed out, commands may not work immediately`);
|
|
81958
|
-
}
|
|
81959
|
-
});
|
|
81960
|
-
}).catch((err) => {
|
|
81961
|
-
api.logger.error(
|
|
81962
|
-
`Failed to start BlockRun proxy: ${err instanceof Error ? err.message : String(err)}`
|
|
81968
|
+
const procDeferred = proc;
|
|
81969
|
+
if (procDeferred.__clawrouterDeferredStartTimer) {
|
|
81970
|
+
clearTimeout(procDeferred.__clawrouterDeferredStartTimer);
|
|
81971
|
+
procDeferred.__clawrouterDeferredStartTimer = void 0;
|
|
81972
|
+
api.logger.info("Superseding earlier deferred proxy start \u2014 using current pluginConfig");
|
|
81973
|
+
}
|
|
81974
|
+
if (pluginConfigEmpty) {
|
|
81975
|
+
api.logger.info(
|
|
81976
|
+
"pluginConfig empty \u2014 deferring proxy startup 250ms in case a populated config arrives"
|
|
81963
81977
|
);
|
|
81964
|
-
|
|
81978
|
+
procDeferred.__clawrouterDeferredStartTimer = setTimeout(() => {
|
|
81979
|
+
procDeferred.__clawrouterDeferredStartTimer = void 0;
|
|
81980
|
+
if (proc.__clawrouterProxyStarted) return;
|
|
81981
|
+
proc.__clawrouterProxyStarted = true;
|
|
81982
|
+
api.logger.info("Deferred timer fired \u2014 starting proxy with default config");
|
|
81983
|
+
startProxyAfterPortProbe(api);
|
|
81984
|
+
}, 250);
|
|
81985
|
+
return;
|
|
81986
|
+
}
|
|
81987
|
+
proc.__clawrouterProxyStarted = true;
|
|
81988
|
+
startProxyAfterPortProbe(api);
|
|
81965
81989
|
},
|
|
81966
81990
|
/**
|
|
81967
81991
|
* Cleanup hook called when plugin is uninstalled via `openclaw plugins uninstall`.
|