@clawlabz/clawnetwork 0.1.14 → 0.1.15

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/index.ts CHANGED
@@ -2394,11 +2394,32 @@ export default function register(api: OpenClawApi) {
2394
2394
  // Check if already running (e.g. from a previous detached start)
2395
2395
  const state = isNodeRunning()
2396
2396
  if (state.running) {
2397
- api.logger?.info?.(`[clawnetwork] node already running (pid=${state.pid}), skipping node start`)
2397
+ api.logger?.info?.(`[clawnetwork] node already running (pid=${state.pid})`)
2398
+
2399
+ // Check if running binary is outdated — if so, stop + upgrade + restart
2400
+ if (cfg.autoDownload) {
2401
+ const binary = findBinary()
2402
+ if (binary) {
2403
+ const cv = getBinaryVersion(binary)
2404
+ if (cv && isVersionOlder(cv, MIN_NODE_VERSION)) {
2405
+ api.logger?.info?.(`[clawnetwork] running node ${cv} outdated (need >=${MIN_NODE_VERSION}), upgrading...`)
2406
+ stopNodeProcess(api)
2407
+ await sleep(3_000)
2408
+ try {
2409
+ const newBinary = await downloadBinary(api)
2410
+ initNode(newBinary, cfg.network, api)
2411
+ startNodeProcess(newBinary, cfg, api)
2412
+ api.logger?.info?.(`[clawnetwork] node upgraded and restarted`)
2413
+ } catch (e: unknown) {
2414
+ api.logger?.warn?.(`[clawnetwork] auto-upgrade failed: ${(e as Error).message}, restarting old binary`)
2415
+ startNodeProcess(binary, cfg, api)
2416
+ }
2417
+ }
2418
+ }
2419
+ }
2420
+
2398
2421
  startHealthCheck(cfg, api)
2399
- // Start UI dashboard (may have been lost on gateway restart)
2400
2422
  startUiServer(cfg, api)
2401
- // Still need to ensure heartbeat loop is running (may have been lost on gateway restart)
2402
2423
  const wallet = ensureWallet(cfg.network, api)
2403
2424
  await sleep(5_000)
2404
2425
  await autoRegisterMiner(cfg, wallet, api)
@@ -2,7 +2,7 @@
2
2
  "id": "clawnetwork",
3
3
  "name": "ClawNetwork Node",
4
4
  "description": "Run a ClawNetwork blockchain node inside OpenClaw. Every agent is a node.",
5
- "version": "0.1.14",
5
+ "version": "0.1.15",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawlabz/clawnetwork",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Run a ClawNetwork blockchain node inside OpenClaw. Every agent is a blockchain node.",
5
5
  "type": "module",
6
6
  "license": "MIT",