@chrysb/alphaclaw 0.1.8 → 0.1.10
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
CHANGED
|
@@ -67,6 +67,30 @@ const openclawDir = path.join(rootDir, ".openclaw");
|
|
|
67
67
|
fs.mkdirSync(openclawDir, { recursive: true });
|
|
68
68
|
console.log(`[alphaclaw] Root directory: ${rootDir}`);
|
|
69
69
|
|
|
70
|
+
// Check for pending update marker (written by the update endpoint before restart).
|
|
71
|
+
// In environments where the container filesystem is ephemeral (Railway, etc.),
|
|
72
|
+
// the npm install from the update endpoint is lost on restart. This re-runs it
|
|
73
|
+
// from the fresh container using the persistent volume marker.
|
|
74
|
+
const pendingUpdateMarker = path.join(rootDir, ".alphaclaw-update-pending");
|
|
75
|
+
if (fs.existsSync(pendingUpdateMarker)) {
|
|
76
|
+
console.log("[alphaclaw] Pending update detected, installing @chrysb/alphaclaw@latest...");
|
|
77
|
+
const alphaPkgRoot = path.resolve(__dirname, "..");
|
|
78
|
+
const nmIndex = alphaPkgRoot.lastIndexOf(`${path.sep}node_modules${path.sep}`);
|
|
79
|
+
const installDir = nmIndex >= 0 ? alphaPkgRoot.slice(0, nmIndex) : alphaPkgRoot;
|
|
80
|
+
try {
|
|
81
|
+
execSync("npm install @chrysb/alphaclaw@latest --omit=dev --prefer-online", {
|
|
82
|
+
cwd: installDir,
|
|
83
|
+
stdio: "inherit",
|
|
84
|
+
timeout: 180000,
|
|
85
|
+
});
|
|
86
|
+
fs.unlinkSync(pendingUpdateMarker);
|
|
87
|
+
console.log("[alphaclaw] Update applied successfully");
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.log(`[alphaclaw] Update install failed: ${e.message}`);
|
|
90
|
+
fs.unlinkSync(pendingUpdateMarker);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
70
94
|
// ---------------------------------------------------------------------------
|
|
71
95
|
// 3. Symlink ~/.openclaw -> <root>/.openclaw
|
|
72
96
|
// ---------------------------------------------------------------------------
|
|
@@ -15,78 +15,15 @@ const kGroupLabels = {
|
|
|
15
15
|
const kGroupOrder = ["github", "channels", "tools", "custom"];
|
|
16
16
|
|
|
17
17
|
const kHintByKey = {
|
|
18
|
-
ANTHROPIC_API_KEY: html`From
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
OPENAI_API_KEY: html`From{" "}
|
|
28
|
-
<a
|
|
29
|
-
href="https://platform.openai.com"
|
|
30
|
-
target="_blank"
|
|
31
|
-
class="text-blue-400 hover:underline"
|
|
32
|
-
>platform.openai.com</a
|
|
33
|
-
>`,
|
|
34
|
-
GEMINI_API_KEY: html`From{" "}
|
|
35
|
-
<a
|
|
36
|
-
href="https://aistudio.google.com"
|
|
37
|
-
target="_blank"
|
|
38
|
-
class="text-blue-400 hover:underline"
|
|
39
|
-
>aistudio.google.com</a
|
|
40
|
-
>`,
|
|
41
|
-
GITHUB_TOKEN: html`Use a <strong>classic PAT</strong> with{" "}
|
|
42
|
-
<code class="text-xs bg-black/30 px-1 rounded">repo</code> scope from
|
|
43
|
-
<a
|
|
44
|
-
href="https://github.com/settings/tokens"
|
|
45
|
-
target="_blank"
|
|
46
|
-
class="text-blue-400 hover:underline"
|
|
47
|
-
>github.com/settings/tokens</a
|
|
48
|
-
>.`,
|
|
49
|
-
GITHUB_WORKSPACE_REPO: html`Use{" "}
|
|
50
|
-
<code class="text-xs bg-black/30 px-1 rounded">owner/repo</code> or
|
|
51
|
-
<code class="text-xs bg-black/30 px-1 rounded"
|
|
52
|
-
>https://github.com/owner/repo</code
|
|
53
|
-
>`,
|
|
54
|
-
TELEGRAM_BOT_TOKEN: html`From{" "}
|
|
55
|
-
<a
|
|
56
|
-
href="https://t.me/BotFather"
|
|
57
|
-
target="_blank"
|
|
58
|
-
class="text-blue-400 hover:underline"
|
|
59
|
-
>@BotFather</a
|
|
60
|
-
>
|
|
61
|
-
·
|
|
62
|
-
<a
|
|
63
|
-
href="https://docs.openclaw.ai/channels/telegram"
|
|
64
|
-
target="_blank"
|
|
65
|
-
class="text-blue-400 hover:underline"
|
|
66
|
-
>full guide</a
|
|
67
|
-
>`,
|
|
68
|
-
DISCORD_BOT_TOKEN: html`From{" "}
|
|
69
|
-
<a
|
|
70
|
-
href="https://discord.com/developers/applications"
|
|
71
|
-
target="_blank"
|
|
72
|
-
class="text-blue-400 hover:underline"
|
|
73
|
-
>Developer Portal</a
|
|
74
|
-
>
|
|
75
|
-
·
|
|
76
|
-
<a
|
|
77
|
-
href="https://docs.openclaw.ai/channels/discord"
|
|
78
|
-
target="_blank"
|
|
79
|
-
class="text-blue-400 hover:underline"
|
|
80
|
-
>full guide</a
|
|
81
|
-
>`,
|
|
82
|
-
BRAVE_API_KEY: html`From{" "}
|
|
83
|
-
<a
|
|
84
|
-
href="https://brave.com/search/api/"
|
|
85
|
-
target="_blank"
|
|
86
|
-
class="text-blue-400 hover:underline"
|
|
87
|
-
>brave.com/search/api</a
|
|
88
|
-
>
|
|
89
|
-
— free tier available`,
|
|
18
|
+
ANTHROPIC_API_KEY: html`From <a href="https://console.anthropic.com" target="_blank" class="text-blue-400 hover:underline">console.anthropic.com</a>`,
|
|
19
|
+
ANTHROPIC_TOKEN: html`From <code class="text-xs bg-black/30 px-1 rounded">claude setup-token</code>`,
|
|
20
|
+
OPENAI_API_KEY: html`From <a href="https://platform.openai.com" target="_blank" class="text-blue-400 hover:underline">platform.openai.com</a>`,
|
|
21
|
+
GEMINI_API_KEY: html`From <a href="https://aistudio.google.com" target="_blank" class="text-blue-400 hover:underline">aistudio.google.com</a>`,
|
|
22
|
+
GITHUB_TOKEN: html`Use a <strong>classic PAT</strong> with <code class="text-xs bg-black/30 px-1 rounded">repo</code> scope from <a href="https://github.com/settings/tokens" target="_blank" class="text-blue-400 hover:underline">github.com/settings/tokens</a>.`,
|
|
23
|
+
GITHUB_WORKSPACE_REPO: html`Use <code class="text-xs bg-black/30 px-1 rounded">owner/repo</code> or <code class="text-xs bg-black/30 px-1 rounded">https://github.com/owner/repo</code>`,
|
|
24
|
+
TELEGRAM_BOT_TOKEN: html`From <a href="https://t.me/BotFather" target="_blank" class="text-blue-400 hover:underline">@BotFather</a> · <a href="https://docs.openclaw.ai/channels/telegram" target="_blank" class="text-blue-400 hover:underline">full guide</a>`,
|
|
25
|
+
DISCORD_BOT_TOKEN: html`From <a href="https://discord.com/developers/applications" target="_blank" class="text-blue-400 hover:underline">Developer Portal</a> · <a href="https://docs.openclaw.ai/channels/discord" target="_blank" class="text-blue-400 hover:underline">full guide</a>`,
|
|
26
|
+
BRAVE_API_KEY: html`From <a href="https://brave.com/search/api/" target="_blank" class="text-blue-400 hover:underline">brave.com/search/api</a> — free tier available`,
|
|
90
27
|
};
|
|
91
28
|
|
|
92
29
|
const getHintContent = (envVar) => kHintByKey[envVar.key] || envVar.hint || "";
|
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
kLatestVersionCacheTtlMs,
|
|
8
8
|
kAlphaclawRegistryUrl,
|
|
9
9
|
kPackageRoot,
|
|
10
|
+
kRootDir,
|
|
10
11
|
} = require("./constants");
|
|
11
12
|
|
|
12
13
|
// kPackageRoot is lib/ — the actual npm package root (with package.json) is one level up
|
|
@@ -184,6 +185,14 @@ const createAlphaclawVersionService = () => {
|
|
|
184
185
|
const previousVersion = readAlphaclawVersion();
|
|
185
186
|
try {
|
|
186
187
|
await installLatestAlphaclaw();
|
|
188
|
+
// Write marker to persistent volume so the update survives container recreation
|
|
189
|
+
const markerPath = path.join(kRootDir, ".alphaclaw-update-pending");
|
|
190
|
+
try {
|
|
191
|
+
fs.writeFileSync(markerPath, JSON.stringify({ from: previousVersion, ts: Date.now() }));
|
|
192
|
+
console.log(`[alphaclaw] Update marker written to ${markerPath}`);
|
|
193
|
+
} catch (e) {
|
|
194
|
+
console.log(`[alphaclaw] Could not write update marker: ${e.message}`);
|
|
195
|
+
}
|
|
187
196
|
kUpdateStatusCache = { latestVersion: null, hasUpdate: false, fetchedAt: 0 };
|
|
188
197
|
return {
|
|
189
198
|
status: 200,
|