@chrysb/alphaclaw 0.8.6 → 0.8.7-beta.1
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/bin/alphaclaw.js +74 -20
- package/lib/public/css/tailwind.generated.css +1 -1
- package/lib/public/dist/app.bundle.js +2041 -2021
- package/lib/public/js/app.js +3 -0
- package/lib/public/js/components/gateway.js +6 -3
- package/lib/public/js/components/general/index.js +2 -0
- package/lib/public/js/components/onboarding/welcome-form-step.js +29 -4
- package/lib/public/js/components/routes/general-route.js +2 -0
- package/lib/public/js/components/routes/watchdog-route.js +2 -0
- package/lib/public/js/components/sidebar.js +20 -7
- package/lib/public/js/components/update-modal-helpers.js +12 -0
- package/lib/public/js/components/update-modal.js +2 -1
- package/lib/public/js/components/watchdog-tab/index.js +2 -0
- package/lib/public/js/components/welcome/index.js +1 -0
- package/lib/public/js/components/welcome/use-welcome.js +52 -2
- package/lib/public/js/hooks/use-app-shell-controller.js +33 -9
- package/lib/public/js/lib/api.js +35 -0
- package/lib/server/alphaclaw-version.js +30 -127
- package/lib/server/openclaw-runtime.js +260 -0
- package/lib/server/openclaw-version.js +59 -130
- package/lib/server/pending-alphaclaw-update.js +71 -0
- package/lib/server/pending-openclaw-update.js +71 -0
- package/lib/server/routes/system.js +6 -1
- package/package.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const buildPendingAlphaclawInstallSpec = (marker = {}) => {
|
|
2
|
+
const explicitSpec = String(marker?.spec || "").trim();
|
|
3
|
+
if (explicitSpec) {
|
|
4
|
+
return explicitSpec;
|
|
5
|
+
}
|
|
6
|
+
const targetVersion = String(marker?.to || "").trim() || "latest";
|
|
7
|
+
return `@chrysb/alphaclaw@${targetVersion}`;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const shellQuote = (value) =>
|
|
11
|
+
`'${String(value || "").replace(/'/g, `'\"'\"'`)}'`;
|
|
12
|
+
|
|
13
|
+
const applyPendingAlphaclawUpdate = ({
|
|
14
|
+
execSyncImpl,
|
|
15
|
+
fsModule,
|
|
16
|
+
installDir,
|
|
17
|
+
logger = console,
|
|
18
|
+
markerPath,
|
|
19
|
+
}) => {
|
|
20
|
+
if (!fsModule.existsSync(markerPath)) {
|
|
21
|
+
return {
|
|
22
|
+
attempted: false,
|
|
23
|
+
installed: false,
|
|
24
|
+
spec: "",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let marker = {};
|
|
29
|
+
try {
|
|
30
|
+
marker = JSON.parse(fsModule.readFileSync(markerPath, "utf8"));
|
|
31
|
+
} catch {
|
|
32
|
+
marker = {};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const spec = buildPendingAlphaclawInstallSpec(marker);
|
|
36
|
+
logger.log(`[alphaclaw] Pending update detected, installing ${spec}...`);
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
execSyncImpl(
|
|
40
|
+
`npm install ${shellQuote(spec)} --omit=dev --no-save --save=false --package-lock=false --prefer-online`,
|
|
41
|
+
{
|
|
42
|
+
cwd: installDir,
|
|
43
|
+
stdio: "inherit",
|
|
44
|
+
timeout: 180000,
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
fsModule.unlinkSync(markerPath);
|
|
48
|
+
logger.log("[alphaclaw] Update applied successfully");
|
|
49
|
+
return {
|
|
50
|
+
attempted: true,
|
|
51
|
+
installed: true,
|
|
52
|
+
spec,
|
|
53
|
+
};
|
|
54
|
+
} catch (error) {
|
|
55
|
+
logger.log(`[alphaclaw] Update install failed: ${error.message}`);
|
|
56
|
+
try {
|
|
57
|
+
fsModule.unlinkSync(markerPath);
|
|
58
|
+
} catch {}
|
|
59
|
+
return {
|
|
60
|
+
attempted: true,
|
|
61
|
+
installed: false,
|
|
62
|
+
spec,
|
|
63
|
+
error,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
module.exports = {
|
|
69
|
+
applyPendingAlphaclawUpdate,
|
|
70
|
+
buildPendingAlphaclawInstallSpec,
|
|
71
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const {
|
|
2
|
+
installManagedOpenclawRuntime,
|
|
3
|
+
} = require("./openclaw-runtime");
|
|
4
|
+
|
|
5
|
+
const buildPendingOpenclawInstallSpec = (marker = {}) => {
|
|
6
|
+
const explicitSpec = String(marker?.spec || "").trim();
|
|
7
|
+
if (explicitSpec) {
|
|
8
|
+
return explicitSpec;
|
|
9
|
+
}
|
|
10
|
+
const targetVersion = String(marker?.to || "").trim() || "latest";
|
|
11
|
+
return `openclaw@${targetVersion}`;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const applyPendingOpenclawUpdate = ({
|
|
15
|
+
execSyncImpl,
|
|
16
|
+
fsModule,
|
|
17
|
+
installDir,
|
|
18
|
+
logger = console,
|
|
19
|
+
markerPath,
|
|
20
|
+
}) => {
|
|
21
|
+
if (!fsModule.existsSync(markerPath)) {
|
|
22
|
+
return {
|
|
23
|
+
attempted: false,
|
|
24
|
+
installed: false,
|
|
25
|
+
spec: "",
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let marker = {};
|
|
30
|
+
try {
|
|
31
|
+
marker = JSON.parse(fsModule.readFileSync(markerPath, "utf8"));
|
|
32
|
+
} catch {
|
|
33
|
+
marker = {};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const spec = buildPendingOpenclawInstallSpec(marker);
|
|
37
|
+
logger.log(`[alphaclaw] Pending OpenClaw update detected, installing ${spec}...`);
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
installManagedOpenclawRuntime({
|
|
41
|
+
execSyncImpl,
|
|
42
|
+
fsModule,
|
|
43
|
+
logger,
|
|
44
|
+
runtimeDir: installDir,
|
|
45
|
+
spec,
|
|
46
|
+
});
|
|
47
|
+
fsModule.unlinkSync(markerPath);
|
|
48
|
+
logger.log("[alphaclaw] OpenClaw update applied successfully");
|
|
49
|
+
return {
|
|
50
|
+
attempted: true,
|
|
51
|
+
installed: true,
|
|
52
|
+
spec,
|
|
53
|
+
};
|
|
54
|
+
} catch (error) {
|
|
55
|
+
logger.log(`[alphaclaw] OpenClaw update install failed: ${error.message}`);
|
|
56
|
+
try {
|
|
57
|
+
fsModule.unlinkSync(markerPath);
|
|
58
|
+
} catch {}
|
|
59
|
+
return {
|
|
60
|
+
attempted: true,
|
|
61
|
+
installed: false,
|
|
62
|
+
spec,
|
|
63
|
+
error,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
module.exports = {
|
|
69
|
+
applyPendingOpenclawUpdate,
|
|
70
|
+
buildPendingOpenclawInstallSpec,
|
|
71
|
+
};
|
|
@@ -588,7 +588,12 @@ const registerSystemRoutes = ({
|
|
|
588
588
|
console.log(
|
|
589
589
|
`[alphaclaw] /api/openclaw/update result: status=${result.status} ok=${result.body?.ok === true}`,
|
|
590
590
|
);
|
|
591
|
-
|
|
591
|
+
if (result.status === 200 && result.body?.ok && result.body?.restarting) {
|
|
592
|
+
res.json(result.body);
|
|
593
|
+
setTimeout(() => alphaclawVersionService.restartProcess(), 1000);
|
|
594
|
+
} else {
|
|
595
|
+
res.status(result.status).json(result.body);
|
|
596
|
+
}
|
|
592
597
|
});
|
|
593
598
|
|
|
594
599
|
app.get("/api/alphaclaw/version", async (req, res) => {
|