squad-openclaw 2026.2.2015 → 2026.2.2017

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.js +55 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1244,6 +1244,36 @@ function readInstalledVersionFromConfig() {
1244
1244
  return null;
1245
1245
  }
1246
1246
  }
1247
+ function reconcileInstallMetadata(verification) {
1248
+ if (!verification.installPath || !verification.packageVersion) return;
1249
+ try {
1250
+ const raw = fs5.readFileSync(CONFIG_PATH, "utf-8");
1251
+ const config = JSON.parse(raw);
1252
+ if (!config.plugins || typeof config.plugins !== "object") config.plugins = {};
1253
+ if (!config.plugins.installs || typeof config.plugins.installs !== "object") {
1254
+ config.plugins.installs = {};
1255
+ }
1256
+ if (!config.plugins.entries || typeof config.plugins.entries !== "object") {
1257
+ config.plugins.entries = {};
1258
+ }
1259
+ const current = config.plugins.installs[PACKAGE_NAME] ?? {};
1260
+ config.plugins.installs[PACKAGE_NAME] = {
1261
+ ...current,
1262
+ source: "npm",
1263
+ spec: PACKAGE_NAME,
1264
+ installPath: verification.installPath,
1265
+ version: verification.packageVersion,
1266
+ installedAt: (/* @__PURE__ */ new Date()).toISOString()
1267
+ };
1268
+ const entry = config.plugins.entries[PACKAGE_NAME] ?? {};
1269
+ config.plugins.entries[PACKAGE_NAME] = {
1270
+ ...entry,
1271
+ enabled: true
1272
+ };
1273
+ fs5.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2), "utf-8");
1274
+ } catch {
1275
+ }
1276
+ }
1247
1277
  function getCurrentVersion() {
1248
1278
  const thisFile = fileURLToPath(import.meta.url);
1249
1279
  const pkgPath = path6.resolve(path6.dirname(thisFile), "..", "package.json");
@@ -1280,6 +1310,16 @@ function runDoctorFixSilently() {
1280
1310
  function sleep(ms) {
1281
1311
  return new Promise((resolve) => setTimeout(resolve, ms));
1282
1312
  }
1313
+ function compareVersions(a, b) {
1314
+ const pa = a.split(".").map((x) => Number(x) || 0);
1315
+ const pb = b.split(".").map((x) => Number(x) || 0);
1316
+ const len = Math.max(pa.length, pb.length);
1317
+ for (let i = 0; i < len; i++) {
1318
+ const d = (pa[i] ?? 0) - (pb[i] ?? 0);
1319
+ if (d !== 0) return d;
1320
+ }
1321
+ return 0;
1322
+ }
1283
1323
  function verifyInstalledPluginState() {
1284
1324
  let configRaw;
1285
1325
  try {
@@ -1380,16 +1420,6 @@ function verifyInstalledPluginState() {
1380
1420
  requiredFilesMissing: []
1381
1421
  };
1382
1422
  }
1383
- if (configVersion && configVersion !== packageVersion) {
1384
- return {
1385
- ok: false,
1386
- reason: `Version mismatch: config=${configVersion}, package=${packageVersion}`,
1387
- installPath,
1388
- configVersion,
1389
- packageVersion,
1390
- requiredFilesMissing: []
1391
- };
1392
- }
1393
1423
  return {
1394
1424
  ok: true,
1395
1425
  installPath,
@@ -1447,6 +1477,12 @@ function registerVersionMethods(api) {
1447
1477
  try {
1448
1478
  const before = getCurrentVersion();
1449
1479
  const beforeInstalledVersion = readInstalledVersionFromConfig();
1480
+ let latestVersion = null;
1481
+ try {
1482
+ latestVersion = await fetchLatestVersion();
1483
+ } catch {
1484
+ latestVersion = null;
1485
+ }
1450
1486
  let updateOutput = "";
1451
1487
  let configBackup = null;
1452
1488
  try {
@@ -1498,11 +1534,15 @@ function registerVersionMethods(api) {
1498
1534
  });
1499
1535
  return;
1500
1536
  }
1501
- if (beforeInstalledVersion && verification.packageVersion && beforeInstalledVersion === verification.packageVersion) {
1537
+ reconcileInstallMetadata(verification);
1538
+ const verificationAfterReconcile = verifyInstalledPluginState();
1539
+ if (beforeInstalledVersion && verificationAfterReconcile.packageVersion && beforeInstalledVersion === verificationAfterReconcile.packageVersion) {
1540
+ const alreadyLatest = !!latestVersion && compareVersions(verificationAfterReconcile.packageVersion, latestVersion) >= 0;
1502
1541
  respond(false, {
1503
- error: `Update command completed but installed version did not change (${verification.packageVersion}).`,
1542
+ error: alreadyLatest ? `Already at latest version (${verificationAfterReconcile.packageVersion}).` : `Update command completed but installed version did not change (${verificationAfterReconcile.packageVersion}).`,
1504
1543
  output: updateOutput.slice(0, 500),
1505
- verification
1544
+ verification: verificationAfterReconcile,
1545
+ latestVersion
1506
1546
  });
1507
1547
  return;
1508
1548
  }
@@ -1513,7 +1553,8 @@ function registerVersionMethods(api) {
1513
1553
  updated: true,
1514
1554
  restartRequired: true,
1515
1555
  restartInMs: RESTART_BUFFER_MS,
1516
- verification,
1556
+ verification: verificationAfterReconcile,
1557
+ latestVersion,
1517
1558
  output: updateOutput.slice(0, 500)
1518
1559
  });
1519
1560
  await sleep(RESTART_BUFFER_MS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squad-openclaw",
3
- "version": "2026.2.2015",
3
+ "version": "2026.2.2017",
4
4
  "description": "Entity registry, filesystem tools, and version management plugin for OpenClaw gateway",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",