@chrysb/alphaclaw 0.8.7-beta.6 → 0.8.7-beta.7
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.
|
@@ -20,6 +20,7 @@ import { showToast } from "../components/toast.js";
|
|
|
20
20
|
|
|
21
21
|
export const useAppShellController = ({ location = "" } = {}) => {
|
|
22
22
|
const kInitialStatusPollDelayMs = 5000;
|
|
23
|
+
const kOpenclawUpdateRestartTimeoutMs = 5 * 60 * 1000;
|
|
23
24
|
const [onboarded, setOnboarded] = useState(null);
|
|
24
25
|
const [authEnabled, setAuthEnabled] = useState(false);
|
|
25
26
|
const [acVersion, setAcVersion] = useState(null);
|
|
@@ -249,7 +250,10 @@ export const useAppShellController = ({ location = "" } = {}) => {
|
|
|
249
250
|
const data = await updateOpenclaw();
|
|
250
251
|
if (data?.ok && data?.restarting) {
|
|
251
252
|
setOpenclawRestarting(true);
|
|
252
|
-
await waitForAlphaclawRestart(
|
|
253
|
+
await waitForAlphaclawRestart({
|
|
254
|
+
timeoutMs: kOpenclawUpdateRestartTimeoutMs,
|
|
255
|
+
timeoutErrorMessage: "OpenClaw update is taking longer than expected",
|
|
256
|
+
});
|
|
253
257
|
window.location.reload();
|
|
254
258
|
return { ...data, restartHandled: true };
|
|
255
259
|
}
|
package/lib/public/js/lib/api.js
CHANGED
|
@@ -536,6 +536,7 @@ export async function waitForAlphaclawRestart({
|
|
|
536
536
|
initialDelayMs = 1500,
|
|
537
537
|
intervalMs = 1000,
|
|
538
538
|
timeoutMs = 60000,
|
|
539
|
+
timeoutErrorMessage = "AlphaClaw restart is taking longer than expected",
|
|
539
540
|
} = {}) {
|
|
540
541
|
const deadline = Date.now() + Math.max(0, Number(timeoutMs) || 0);
|
|
541
542
|
await delay(initialDelayMs);
|
|
@@ -559,7 +560,7 @@ export async function waitForAlphaclawRestart({
|
|
|
559
560
|
await delay(intervalMs);
|
|
560
561
|
}
|
|
561
562
|
|
|
562
|
-
throw new Error("AlphaClaw restart is taking longer than expected");
|
|
563
|
+
throw new Error(String(timeoutErrorMessage || "AlphaClaw restart is taking longer than expected"));
|
|
563
564
|
}
|
|
564
565
|
|
|
565
566
|
export async function fetchSyncCron() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
|
+
const os = require("os");
|
|
2
3
|
const path = require("path");
|
|
3
4
|
|
|
4
5
|
const { kRootDir } = require("./constants");
|
|
@@ -178,24 +179,59 @@ const runManagedOpenclawBundledPluginPostinstall = ({
|
|
|
178
179
|
}
|
|
179
180
|
const env = { ...process.env };
|
|
180
181
|
delete env[kDisableBundledPluginPostinstallEnv];
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
182
|
+
const logDir = fsModule.mkdtempSync(
|
|
183
|
+
path.join(os.tmpdir(), "openclaw-bundled-postinstall-"),
|
|
184
|
+
);
|
|
185
|
+
const logPath = path.join(logDir, "postinstall.log");
|
|
186
|
+
let commandError = null;
|
|
187
|
+
let output = "";
|
|
188
|
+
let stdoutFd;
|
|
189
|
+
let stderrFd;
|
|
190
|
+
try {
|
|
191
|
+
stdoutFd = fsModule.openSync(logPath, "a");
|
|
192
|
+
stderrFd = fsModule.openSync(logPath, "a");
|
|
193
|
+
try {
|
|
194
|
+
execSyncImpl(
|
|
195
|
+
`${shellQuote(process.execPath)} ${shellQuote(postinstallScriptPath)}`,
|
|
196
|
+
{
|
|
197
|
+
cwd: packageRoot,
|
|
198
|
+
env,
|
|
199
|
+
stdio: ["ignore", stdoutFd, stderrFd],
|
|
200
|
+
timeout: 180000,
|
|
201
|
+
},
|
|
202
|
+
);
|
|
203
|
+
} catch (error) {
|
|
204
|
+
commandError = error;
|
|
205
|
+
}
|
|
206
|
+
} finally {
|
|
207
|
+
if (typeof stdoutFd === "number") {
|
|
208
|
+
try {
|
|
209
|
+
fsModule.closeSync(stdoutFd);
|
|
210
|
+
} catch {}
|
|
211
|
+
}
|
|
212
|
+
if (typeof stderrFd === "number") {
|
|
213
|
+
try {
|
|
214
|
+
fsModule.closeSync(stderrFd);
|
|
215
|
+
} catch {}
|
|
216
|
+
}
|
|
217
|
+
try {
|
|
218
|
+
output = String(fsModule.readFileSync(logPath, "utf8") || "").trim();
|
|
219
|
+
} catch {
|
|
220
|
+
output = "";
|
|
221
|
+
}
|
|
222
|
+
try {
|
|
223
|
+
fsModule.rmSync(logDir, { recursive: true, force: true });
|
|
224
|
+
} catch {}
|
|
225
|
+
}
|
|
193
226
|
if (output) {
|
|
194
227
|
logger.log(output);
|
|
195
228
|
}
|
|
196
229
|
if (output.includes(kBundledPluginPostinstallFailureMarker)) {
|
|
197
230
|
throw new Error(output);
|
|
198
231
|
}
|
|
232
|
+
if (commandError) {
|
|
233
|
+
throw commandError;
|
|
234
|
+
}
|
|
199
235
|
return true;
|
|
200
236
|
};
|
|
201
237
|
|