@lark-apaas/openclaw-scripts-diagnose-cli 0.1.1-alpha.14 → 0.1.1-alpha.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.
Files changed (2) hide show
  1. package/dist/index.cjs +16 -10
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1345,34 +1345,40 @@ function waitForInitNpm(maxWaitMs, log) {
1345
1345
  log(`deadline (${maxWaitMs}ms) hit after ${polls} poll(s), proceeding anyway`);
1346
1346
  }
1347
1347
  /**
1348
- * Step 5: Reinstall openclaw to the version specified in template.
1348
+ * Step 5: Ensure openclaw binary is at the template's recommended version.
1349
1349
  *
1350
- * Simple: if already at target version, skip. Otherwise uninstall+install
1351
- * with a generous wall-clock timeout and trust npm's exit code (0 = success,
1352
- * anything else = real failure, bubble up and fail the reset). No retries,
1353
- * no idle-detection heuristics — waitForInitNpm above removes the main
1354
- * source of contention so this step should run cleanly.
1350
+ * Fast path (common): if `openclaw --version` already matches the version
1351
+ * declared in the bundled template's openclaw.json, skip uninstall+install
1352
+ * entirely and just run `openclaw doctor --fix` to realign config state.
1353
+ *
1354
+ * Slow path (rare only triggers if version mismatched or binary missing):
1355
+ * uninstall + reinstall + doctor --fix. This is intentionally kept as a
1356
+ * last resort because a transitive dep (matrix-sdk-crypto-nodejs) runs a
1357
+ * postinstall hook that downloads a 22MB native binary from GitHub
1358
+ * Releases, and the BOE sandbox's egress to objects.githubusercontent.com
1359
+ * is throttled to ~10KB/s — a full reinstall can legitimately take 30+
1360
+ * minutes. Hence we only pay that cost when version actually needs to change.
1355
1361
  */
1356
1362
  function reinstallOpenclaw(srcDir, log) {
1357
1363
  const targetVersion = loadJSON5().parse(node_fs.default.readFileSync(node_path.default.join(srcDir, "openclaw.json"), "utf-8")).meta?.lastTouchedVersion;
1358
1364
  log(`target openclaw version: ${targetVersion ?? "<unset>"}`);
1359
1365
  if (targetVersion && isOpenclawAtVersion(targetVersion)) {
1360
- log("fast path: already at target version, running doctor --fix only");
1366
+ log("fast path: openclaw already at target version, skipping uninstall+install");
1361
1367
  const t = Date.now();
1362
1368
  shell("openclaw doctor --fix", 10 * 6e4);
1363
1369
  log(`doctor --fix done in ${Date.now() - t}ms`);
1364
1370
  return;
1365
1371
  }
1366
- log("target version missing or mismatched, running full reinstall");
1372
+ log("version mismatched or binary missing, running full reinstall (may take 30+ min under slow network)");
1367
1373
  try {
1368
1374
  const t = Date.now();
1369
1375
  shell("npm uninstall -g openclaw 2>/dev/null || true", 6e4);
1370
1376
  log(`npm uninstall done in ${Date.now() - t}ms`);
1371
1377
  } catch {}
1372
- const installCmd = `npm i -g openclaw@${targetVersion || "latest"} --prefer-offline --fetch-timeout=60000 --fetch-retries=2`;
1378
+ const installCmd = `npm i -g openclaw@${targetVersion || "latest"} --prefer-offline`;
1373
1379
  log(`running: ${installCmd}`);
1374
1380
  const installStart = Date.now();
1375
- shell(installCmd, 15 * 6e4);
1381
+ shell(installCmd, 30 * 6e4);
1376
1382
  log(`npm install done in ${Date.now() - installStart}ms`);
1377
1383
  const docStart = Date.now();
1378
1384
  shell("openclaw doctor --fix", 10 * 6e4);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/openclaw-scripts-diagnose-cli",
3
- "version": "0.1.1-alpha.14",
3
+ "version": "0.1.1-alpha.15",
4
4
  "description": "CLI for OpenClaw config diagnose and repair with JSON5 support",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {