squad-openclaw 2026.2.2008 → 2026.2.2009
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 +20 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1230,6 +1230,7 @@ import path6 from "path";
|
|
|
1230
1230
|
import { fileURLToPath } from "url";
|
|
1231
1231
|
var PACKAGE_NAME = "squad-openclaw";
|
|
1232
1232
|
var CONFIG_PATH = path6.join(getOpenclawStateDir(), "openclaw.json");
|
|
1233
|
+
var updateInProgress = false;
|
|
1233
1234
|
function getCurrentVersion() {
|
|
1234
1235
|
const thisFile = fileURLToPath(import.meta.url);
|
|
1235
1236
|
const pkgPath = path6.resolve(path6.dirname(thisFile), "..", "package.json");
|
|
@@ -1286,6 +1287,11 @@ function registerVersionMethods(api) {
|
|
|
1286
1287
|
api.registerGatewayMethod(
|
|
1287
1288
|
"squad.version.update",
|
|
1288
1289
|
async ({ respond }) => {
|
|
1290
|
+
if (updateInProgress) {
|
|
1291
|
+
respond(false, { error: "Update already in progress" });
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
updateInProgress = true;
|
|
1289
1295
|
try {
|
|
1290
1296
|
const before = getCurrentVersion();
|
|
1291
1297
|
let updateOutput = "";
|
|
@@ -1303,29 +1309,22 @@ function registerVersionMethods(api) {
|
|
|
1303
1309
|
}
|
|
1304
1310
|
try {
|
|
1305
1311
|
updateOutput = execSync2(
|
|
1306
|
-
`openclaw plugins
|
|
1312
|
+
`openclaw plugins install ${PACKAGE_NAME} 2>&1`,
|
|
1307
1313
|
{ timeout: 12e4, encoding: "utf-8" }
|
|
1308
1314
|
);
|
|
1309
|
-
} catch {
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
);
|
|
1315
|
-
} catch (npmErr) {
|
|
1316
|
-
if (configBackup) {
|
|
1317
|
-
try {
|
|
1318
|
-
fs5.writeFileSync(CONFIG_PATH, configBackup, "utf-8");
|
|
1319
|
-
} catch {
|
|
1320
|
-
}
|
|
1315
|
+
} catch (installErr) {
|
|
1316
|
+
if (configBackup) {
|
|
1317
|
+
try {
|
|
1318
|
+
fs5.writeFileSync(CONFIG_PATH, configBackup, "utf-8");
|
|
1319
|
+
} catch {
|
|
1321
1320
|
}
|
|
1322
|
-
const msg = npmErr instanceof Error ? npmErr.message : String(npmErr);
|
|
1323
|
-
respond(false, {
|
|
1324
|
-
error: `Update failed: ${msg}`,
|
|
1325
|
-
output: updateOutput
|
|
1326
|
-
});
|
|
1327
|
-
return;
|
|
1328
1321
|
}
|
|
1322
|
+
const msg = installErr instanceof Error ? installErr.message : String(installErr);
|
|
1323
|
+
respond(false, {
|
|
1324
|
+
error: `Update failed: ${msg}`,
|
|
1325
|
+
output: updateOutput
|
|
1326
|
+
});
|
|
1327
|
+
return;
|
|
1329
1328
|
}
|
|
1330
1329
|
const after = getCurrentVersion();
|
|
1331
1330
|
respond(true, {
|
|
@@ -1350,6 +1349,8 @@ function registerVersionMethods(api) {
|
|
|
1350
1349
|
} catch (e) {
|
|
1351
1350
|
const msg = e instanceof Error ? e.message : String(e);
|
|
1352
1351
|
respond(false, { error: msg });
|
|
1352
|
+
} finally {
|
|
1353
|
+
updateInProgress = false;
|
|
1353
1354
|
}
|
|
1354
1355
|
}
|
|
1355
1356
|
);
|
package/package.json
CHANGED