@chrysb/alphaclaw 0.1.0 → 0.1.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/lib/server/commands.js +4 -4
- package/lib/server/env.js +4 -4
- package/lib/server/gateway.js +24 -24
- package/lib/server/openclaw-version.js +8 -8
- package/lib/server/routes/google.js +20 -20
- package/lib/server/routes/pairings.js +2 -2
- package/lib/server/routes/system.js +3 -3
- package/lib/server.js +2 -2
- package/package.json +1 -1
package/lib/server/commands.js
CHANGED
|
@@ -29,7 +29,7 @@ const createCommands = ({ gatewayEnv }) => {
|
|
|
29
29
|
|
|
30
30
|
const clawCmd = (cmd, { quiet = false } = {}) =>
|
|
31
31
|
new Promise((resolve) => {
|
|
32
|
-
if (!quiet) console.log(`[
|
|
32
|
+
if (!quiet) console.log(`[alphaclaw] Running: openclaw ${cmd}`);
|
|
33
33
|
exec(
|
|
34
34
|
`openclaw ${cmd}`,
|
|
35
35
|
{
|
|
@@ -44,7 +44,7 @@ const createCommands = ({ gatewayEnv }) => {
|
|
|
44
44
|
code: err?.code,
|
|
45
45
|
};
|
|
46
46
|
if (!quiet && !result.ok) {
|
|
47
|
-
console.log(`[
|
|
47
|
+
console.log(`[alphaclaw] Error: ${result.stderr.slice(0, 200)}`);
|
|
48
48
|
}
|
|
49
49
|
resolve(result);
|
|
50
50
|
},
|
|
@@ -53,7 +53,7 @@ const createCommands = ({ gatewayEnv }) => {
|
|
|
53
53
|
|
|
54
54
|
const gogCmd = (cmd, { quiet = false } = {}) =>
|
|
55
55
|
new Promise((resolve) => {
|
|
56
|
-
if (!quiet) console.log(`[
|
|
56
|
+
if (!quiet) console.log(`[alphaclaw] Running: gog ${cmd}`);
|
|
57
57
|
exec(
|
|
58
58
|
`gog ${cmd}`,
|
|
59
59
|
{
|
|
@@ -71,7 +71,7 @@ const createCommands = ({ gatewayEnv }) => {
|
|
|
71
71
|
stderr: stderr.trim(),
|
|
72
72
|
};
|
|
73
73
|
if (!quiet && !result.ok) {
|
|
74
|
-
console.log(`[
|
|
74
|
+
console.log(`[alphaclaw] gog error: ${result.stderr.slice(0, 200)}`);
|
|
75
75
|
}
|
|
76
76
|
resolve(result);
|
|
77
77
|
},
|
package/lib/server/env.js
CHANGED
|
@@ -38,12 +38,12 @@ const reloadEnv = () => {
|
|
|
38
38
|
for (const { key, value } of vars) {
|
|
39
39
|
if (value && value !== process.env[key]) {
|
|
40
40
|
console.log(
|
|
41
|
-
`[
|
|
41
|
+
`[alphaclaw] Env updated: ${key}=${key.toLowerCase().includes("token") || key.toLowerCase().includes("key") || key.toLowerCase().includes("password") ? "***" : value}`,
|
|
42
42
|
);
|
|
43
43
|
process.env[key] = value;
|
|
44
44
|
changed = true;
|
|
45
45
|
} else if (!value && process.env[key]) {
|
|
46
|
-
console.log(`[
|
|
46
|
+
console.log(`[alphaclaw] Env cleared: ${key}`);
|
|
47
47
|
delete process.env[key];
|
|
48
48
|
changed = true;
|
|
49
49
|
}
|
|
@@ -52,7 +52,7 @@ const reloadEnv = () => {
|
|
|
52
52
|
const allKnownKeys = kKnownVars.map((v) => v.key);
|
|
53
53
|
for (const key of allKnownKeys) {
|
|
54
54
|
if (!fileKeys.has(key) && process.env[key]) {
|
|
55
|
-
console.log(`[
|
|
55
|
+
console.log(`[alphaclaw] Env removed: ${key}`);
|
|
56
56
|
delete process.env[key];
|
|
57
57
|
changed = true;
|
|
58
58
|
}
|
|
@@ -64,7 +64,7 @@ const reloadEnv = () => {
|
|
|
64
64
|
const startEnvWatcher = () => {
|
|
65
65
|
try {
|
|
66
66
|
fs.watchFile(ENV_FILE_PATH, { interval: 2000 }, () => {
|
|
67
|
-
console.log(`[
|
|
67
|
+
console.log(`[alphaclaw] ${ENV_FILE_PATH} changed externally, reloading...`);
|
|
68
68
|
reloadEnv();
|
|
69
69
|
});
|
|
70
70
|
} catch {}
|
package/lib/server/gateway.js
CHANGED
|
@@ -30,28 +30,28 @@ const isGatewayRunning = () =>
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
const runGatewayCmd = (cmd) => {
|
|
33
|
-
console.log(`[
|
|
33
|
+
console.log(`[alphaclaw] Running: openclaw gateway ${cmd}`);
|
|
34
34
|
try {
|
|
35
35
|
const out = execSync(`openclaw gateway ${cmd}`, {
|
|
36
36
|
env: gatewayEnv(),
|
|
37
37
|
timeout: 15000,
|
|
38
38
|
encoding: "utf8",
|
|
39
39
|
});
|
|
40
|
-
if (out.trim()) console.log(`[
|
|
40
|
+
if (out.trim()) console.log(`[alphaclaw] ${out.trim()}`);
|
|
41
41
|
} catch (e) {
|
|
42
42
|
if (e.stdout?.trim())
|
|
43
|
-
console.log(`[
|
|
43
|
+
console.log(`[alphaclaw] gateway ${cmd} stdout: ${e.stdout.trim()}`);
|
|
44
44
|
if (e.stderr?.trim())
|
|
45
|
-
console.log(`[
|
|
45
|
+
console.log(`[alphaclaw] gateway ${cmd} stderr: ${e.stderr.trim()}`);
|
|
46
46
|
if (!e.stdout?.trim() && !e.stderr?.trim())
|
|
47
|
-
console.log(`[
|
|
48
|
-
console.log(`[
|
|
47
|
+
console.log(`[alphaclaw] gateway ${cmd} error: ${e.message}`);
|
|
48
|
+
console.log(`[alphaclaw] gateway ${cmd} exit code: ${e.status}`);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const launchGatewayProcess = () => {
|
|
53
53
|
if (gatewayChild && gatewayChild.exitCode === null && !gatewayChild.killed) {
|
|
54
|
-
console.log("[
|
|
54
|
+
console.log("[alphaclaw] Managed gateway process already running — skipping launch");
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
const child = spawn("openclaw", ["gateway", "run"], {
|
|
@@ -62,33 +62,33 @@ const launchGatewayProcess = () => {
|
|
|
62
62
|
child.stdout.on("data", (d) => process.stdout.write(`[gateway] ${d}`));
|
|
63
63
|
child.stderr.on("data", (d) => process.stderr.write(`[gateway] ${d}`));
|
|
64
64
|
child.on("exit", (code) => {
|
|
65
|
-
console.log(`[
|
|
65
|
+
console.log(`[alphaclaw] Gateway launcher exited with code ${code}`);
|
|
66
66
|
if (gatewayChild === child) gatewayChild = null;
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
const startGateway = async () => {
|
|
71
71
|
if (!isOnboarded()) {
|
|
72
|
-
console.log("[
|
|
72
|
+
console.log("[alphaclaw] Not onboarded yet — skipping gateway start");
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
if (await isGatewayRunning()) {
|
|
76
|
-
console.log("[
|
|
76
|
+
console.log("[alphaclaw] Gateway already running — skipping start");
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
console.log("[
|
|
79
|
+
console.log("[alphaclaw] Starting openclaw gateway...");
|
|
80
80
|
launchGatewayProcess();
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
const restartGateway = (reloadEnv) => {
|
|
84
84
|
reloadEnv();
|
|
85
85
|
if (gatewayChild && gatewayChild.exitCode === null && !gatewayChild.killed) {
|
|
86
|
-
console.log("[
|
|
86
|
+
console.log("[alphaclaw] Stopping managed gateway process...");
|
|
87
87
|
try {
|
|
88
88
|
gatewayChild.kill("SIGTERM");
|
|
89
89
|
gatewayChild = null;
|
|
90
90
|
} catch (e) {
|
|
91
|
-
console.log(`[
|
|
91
|
+
console.log(`[alphaclaw] Failed to stop managed gateway process: ${e.message}`);
|
|
92
92
|
runGatewayCmd("stop");
|
|
93
93
|
}
|
|
94
94
|
} else {
|
|
@@ -101,7 +101,7 @@ const restartGateway = (reloadEnv) => {
|
|
|
101
101
|
if (!(await isGatewayRunning())) break;
|
|
102
102
|
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
103
103
|
}
|
|
104
|
-
console.log("[
|
|
104
|
+
console.log("[alphaclaw] Starting openclaw gateway with refreshed environment...");
|
|
105
105
|
launchGatewayProcess();
|
|
106
106
|
};
|
|
107
107
|
void launchWhenReady();
|
|
@@ -131,7 +131,7 @@ const ensureGatewayProxyConfig = (origin) => {
|
|
|
131
131
|
}
|
|
132
132
|
if (!cfg.gateway.trustedProxies.includes("127.0.0.1")) {
|
|
133
133
|
cfg.gateway.trustedProxies.push("127.0.0.1");
|
|
134
|
-
console.log("[
|
|
134
|
+
console.log("[alphaclaw] Added 127.0.0.1 to gateway.trustedProxies");
|
|
135
135
|
changed = true;
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -142,7 +142,7 @@ const ensureGatewayProxyConfig = (origin) => {
|
|
|
142
142
|
}
|
|
143
143
|
if (!cfg.gateway.controlUi.allowedOrigins.includes(origin)) {
|
|
144
144
|
cfg.gateway.controlUi.allowedOrigins.push(origin);
|
|
145
|
-
console.log(`[
|
|
145
|
+
console.log(`[alphaclaw] Added dashboard origin: ${origin}`);
|
|
146
146
|
changed = true;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -152,7 +152,7 @@ const ensureGatewayProxyConfig = (origin) => {
|
|
|
152
152
|
}
|
|
153
153
|
return changed;
|
|
154
154
|
} catch (e) {
|
|
155
|
-
console.error(`[
|
|
155
|
+
console.error(`[alphaclaw] ensureGatewayProxyConfig error: ${e.message}`);
|
|
156
156
|
return false;
|
|
157
157
|
}
|
|
158
158
|
};
|
|
@@ -171,7 +171,7 @@ const syncChannelConfig = (savedVars, mode = "all") => {
|
|
|
171
171
|
const isConfigured = cfg.channels?.[ch]?.enabled;
|
|
172
172
|
|
|
173
173
|
if (token && !isConfigured && (mode === "add" || mode === "all")) {
|
|
174
|
-
console.log(`[
|
|
174
|
+
console.log(`[alphaclaw] Adding channel: ${ch}`);
|
|
175
175
|
try {
|
|
176
176
|
execSync(`openclaw channels add --channel ${ch} --token "${token}"`, {
|
|
177
177
|
env,
|
|
@@ -185,10 +185,10 @@ const syncChannelConfig = (savedVars, mode = "all") => {
|
|
|
185
185
|
raw.split(token).join("${" + def.envKey + "}"),
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
|
-
console.log(`[
|
|
188
|
+
console.log(`[alphaclaw] Channel ${ch} added`);
|
|
189
189
|
} catch (e) {
|
|
190
190
|
console.error(
|
|
191
|
-
`[
|
|
191
|
+
`[alphaclaw] channels add ${ch}: ${(e.stderr || e.message || "").toString().trim().slice(0, 200)}`,
|
|
192
192
|
);
|
|
193
193
|
}
|
|
194
194
|
} else if (
|
|
@@ -196,23 +196,23 @@ const syncChannelConfig = (savedVars, mode = "all") => {
|
|
|
196
196
|
isConfigured &&
|
|
197
197
|
(mode === "remove" || mode === "all")
|
|
198
198
|
) {
|
|
199
|
-
console.log(`[
|
|
199
|
+
console.log(`[alphaclaw] Removing channel: ${ch}`);
|
|
200
200
|
try {
|
|
201
201
|
execSync(`openclaw channels remove --channel ${ch} --delete`, {
|
|
202
202
|
env,
|
|
203
203
|
timeout: 15000,
|
|
204
204
|
encoding: "utf8",
|
|
205
205
|
});
|
|
206
|
-
console.log(`[
|
|
206
|
+
console.log(`[alphaclaw] Channel ${ch} removed`);
|
|
207
207
|
} catch (e) {
|
|
208
208
|
console.error(
|
|
209
|
-
`[
|
|
209
|
+
`[alphaclaw] channels remove ${ch}: ${(e.stderr || e.message || "").toString().trim().slice(0, 200)}`,
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
} catch (e) {
|
|
215
|
-
console.error("[
|
|
215
|
+
console.error("[alphaclaw] syncChannelConfig error:", e.message);
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
218
|
|
|
@@ -50,7 +50,7 @@ const createOpenclawVersionService = ({ gatewayEnv, restartGateway, isOnboarded
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
try {
|
|
53
|
-
console.log("[
|
|
53
|
+
console.log("[alphaclaw] Running: openclaw update status --json");
|
|
54
54
|
const raw = execSync("openclaw update status --json", {
|
|
55
55
|
env: gatewayEnv(),
|
|
56
56
|
timeout: 8000,
|
|
@@ -67,12 +67,12 @@ const createOpenclawVersionService = ({ gatewayEnv, restartGateway, isOnboarded
|
|
|
67
67
|
fetchedAt: now,
|
|
68
68
|
};
|
|
69
69
|
console.log(
|
|
70
|
-
`[
|
|
70
|
+
`[alphaclaw] openclaw update status: hasUpdate=${hasUpdate} latest=${latestVersion || "unknown"}`,
|
|
71
71
|
);
|
|
72
72
|
return { latestVersion, hasUpdate };
|
|
73
73
|
} catch (err) {
|
|
74
74
|
console.log(
|
|
75
|
-
`[
|
|
75
|
+
`[alphaclaw] openclaw update status error: ${(err.message || "unknown").slice(0, 200)}`,
|
|
76
76
|
);
|
|
77
77
|
throw new Error(err.message || "Failed to read OpenClaw update status");
|
|
78
78
|
}
|
|
@@ -80,7 +80,7 @@ const createOpenclawVersionService = ({ gatewayEnv, restartGateway, isOnboarded
|
|
|
80
80
|
|
|
81
81
|
const installLatestOpenclaw = () =>
|
|
82
82
|
new Promise((resolve, reject) => {
|
|
83
|
-
console.log("[
|
|
83
|
+
console.log("[alphaclaw] Running: npm install --omit=dev --no-save --package-lock=false openclaw@latest");
|
|
84
84
|
exec(
|
|
85
85
|
"npm install --omit=dev --no-save --package-lock=false openclaw@latest",
|
|
86
86
|
{
|
|
@@ -96,16 +96,16 @@ const createOpenclawVersionService = ({ gatewayEnv, restartGateway, isOnboarded
|
|
|
96
96
|
(err, stdout, stderr) => {
|
|
97
97
|
if (err) {
|
|
98
98
|
const message = String(stderr || err.message || "").trim();
|
|
99
|
-
console.log(`[
|
|
99
|
+
console.log(`[alphaclaw] openclaw install error: ${message.slice(0, 200)}`);
|
|
100
100
|
return reject(new Error(message || "Failed to install openclaw@latest"));
|
|
101
101
|
}
|
|
102
102
|
if (stdout && stdout.trim()) {
|
|
103
|
-
console.log(`[
|
|
103
|
+
console.log(`[alphaclaw] openclaw install stdout: ${stdout.trim().slice(0, 300)}`);
|
|
104
104
|
}
|
|
105
105
|
if (stderr && stderr.trim()) {
|
|
106
|
-
console.log(`[
|
|
106
|
+
console.log(`[alphaclaw] openclaw install stderr: ${stderr.trim().slice(0, 300)}`);
|
|
107
107
|
}
|
|
108
|
-
console.log("[
|
|
108
|
+
console.log("[alphaclaw] openclaw install completed");
|
|
109
109
|
resolve({ stdout: stdout.trim(), stderr: stderr.trim() });
|
|
110
110
|
},
|
|
111
111
|
);
|
|
@@ -63,7 +63,7 @@ const registerGoogleRoutes = ({
|
|
|
63
63
|
services,
|
|
64
64
|
activeScopes,
|
|
65
65
|
};
|
|
66
|
-
console.log(`[
|
|
66
|
+
console.log(`[alphaclaw] Google status: ${JSON.stringify(status)}`);
|
|
67
67
|
res.json(status);
|
|
68
68
|
});
|
|
69
69
|
|
|
@@ -87,7 +87,7 @@ const registerGoogleRoutes = ({
|
|
|
87
87
|
|
|
88
88
|
fs.writeFileSync(GOG_CREDENTIALS_PATH, JSON.stringify(credentials, null, 2));
|
|
89
89
|
const result = await gogCmd(`auth credentials set ${GOG_CREDENTIALS_PATH}`);
|
|
90
|
-
console.log(`[
|
|
90
|
+
console.log(`[alphaclaw] gog credentials set: ${JSON.stringify(result)}`);
|
|
91
91
|
|
|
92
92
|
const services = req.body.services || [
|
|
93
93
|
"gmail:read",
|
|
@@ -102,7 +102,7 @@ const registerGoogleRoutes = ({
|
|
|
102
102
|
|
|
103
103
|
res.json({ ok: true });
|
|
104
104
|
} catch (err) {
|
|
105
|
-
console.error("[
|
|
105
|
+
console.error("[alphaclaw] Failed to save Google credentials:", err);
|
|
106
106
|
res.json({ ok: false, error: err.message });
|
|
107
107
|
}
|
|
108
108
|
});
|
|
@@ -137,7 +137,7 @@ const registerGoogleRoutes = ({
|
|
|
137
137
|
} else if (result.ok || stderr.includes("not found") || stderr.includes("Not Found")) {
|
|
138
138
|
results[svc] = { status: "ok", enableUrl: getApiEnableUrl(svc) };
|
|
139
139
|
} else {
|
|
140
|
-
console.log(`[
|
|
140
|
+
console.log(`[alphaclaw] API check ${svc} error: ${result.stderr?.slice(0, 300)}`);
|
|
141
141
|
results[svc] = {
|
|
142
142
|
status: "error",
|
|
143
143
|
message: result.stderr?.slice(0, 200),
|
|
@@ -169,7 +169,7 @@ const registerGoogleRoutes = ({
|
|
|
169
169
|
await fetch(`https://oauth2.googleapis.com/revoke?token=${tokenData.refresh_token}`, {
|
|
170
170
|
method: "POST",
|
|
171
171
|
});
|
|
172
|
-
console.log(`[
|
|
172
|
+
console.log(`[alphaclaw] Revoked Google token for ${email}`);
|
|
173
173
|
}
|
|
174
174
|
fs.unlinkSync("/tmp/gog-revoke.json");
|
|
175
175
|
} catch {}
|
|
@@ -180,10 +180,10 @@ const registerGoogleRoutes = ({
|
|
|
180
180
|
for (const f of [GOG_STATE_PATH, GOG_CREDENTIALS_PATH]) {
|
|
181
181
|
try {
|
|
182
182
|
fs.unlinkSync(f);
|
|
183
|
-
console.log(`[
|
|
183
|
+
console.log(`[alphaclaw] Deleted ${f}`);
|
|
184
184
|
} catch (e) {
|
|
185
185
|
if (e.code !== "ENOENT") {
|
|
186
|
-
console.error(`[
|
|
186
|
+
console.error(`[alphaclaw] Failed to delete ${f}: ${e.message}`);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -192,14 +192,14 @@ const registerGoogleRoutes = ({
|
|
|
192
192
|
const credsStillExists = fs.existsSync(GOG_CREDENTIALS_PATH);
|
|
193
193
|
if (stateStillExists || credsStillExists) {
|
|
194
194
|
console.error(
|
|
195
|
-
`[
|
|
195
|
+
`[alphaclaw] Files survived deletion! state=${stateStillExists} creds=${credsStillExists}`,
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
console.log(`[
|
|
199
|
+
console.log(`[alphaclaw] Google disconnected: ${email}`);
|
|
200
200
|
res.json({ ok: true });
|
|
201
201
|
} catch (err) {
|
|
202
|
-
console.error("[
|
|
202
|
+
console.error("[alphaclaw] Google disconnect error:", err);
|
|
203
203
|
res.json({ ok: false, error: err.message });
|
|
204
204
|
}
|
|
205
205
|
});
|
|
@@ -222,7 +222,7 @@ const registerGoogleRoutes = ({
|
|
|
222
222
|
...services.map((s) => SCOPE_MAP[s]).filter(Boolean),
|
|
223
223
|
].join(" ");
|
|
224
224
|
console.log(
|
|
225
|
-
`[
|
|
225
|
+
`[alphaclaw] Google OAuth scopes: services=${services.join(",")} resolved=${scopes}`,
|
|
226
226
|
);
|
|
227
227
|
|
|
228
228
|
const redirectUri = `${getBaseUrl(req)}/auth/google/callback`;
|
|
@@ -242,7 +242,7 @@ const registerGoogleRoutes = ({
|
|
|
242
242
|
|
|
243
243
|
res.redirect(authUrl.toString());
|
|
244
244
|
} catch (err) {
|
|
245
|
-
console.error("[
|
|
245
|
+
console.error("[alphaclaw] Failed to start Google auth:", err);
|
|
246
246
|
res.redirect("/setup?google=error&message=" + encodeURIComponent(err.message));
|
|
247
247
|
}
|
|
248
248
|
});
|
|
@@ -277,7 +277,7 @@ const registerGoogleRoutes = ({
|
|
|
277
277
|
const tokens = await tokenRes.json();
|
|
278
278
|
if (!tokenRes.ok || tokens.error) {
|
|
279
279
|
console.log(
|
|
280
|
-
`[
|
|
280
|
+
`[alphaclaw] Google token exchange failed: status=${tokenRes.status} error=${tokens.error} desc=${tokens.error_description}`,
|
|
281
281
|
);
|
|
282
282
|
}
|
|
283
283
|
if (tokens.error) {
|
|
@@ -293,7 +293,7 @@ const registerGoogleRoutes = ({
|
|
|
293
293
|
|
|
294
294
|
if (hasExisting) {
|
|
295
295
|
console.log(
|
|
296
|
-
"[
|
|
296
|
+
"[alphaclaw] No new refresh token (already authorized), keeping existing",
|
|
297
297
|
);
|
|
298
298
|
} else {
|
|
299
299
|
throw new Error(
|
|
@@ -323,13 +323,13 @@ const registerGoogleRoutes = ({
|
|
|
323
323
|
fs.writeFileSync(tokenFile, JSON.stringify(tokenData, null, 2));
|
|
324
324
|
const result = await gogCmd(`auth tokens import ${tokenFile}`);
|
|
325
325
|
if (result.ok) {
|
|
326
|
-
console.log(`[
|
|
326
|
+
console.log(`[alphaclaw] Google token imported for ${email}`);
|
|
327
327
|
} else {
|
|
328
|
-
console.error(`[
|
|
328
|
+
console.error(`[alphaclaw] Token import failed: ${result.stderr}`);
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
if (!result.ok) {
|
|
332
|
-
console.error("[
|
|
332
|
+
console.error("[alphaclaw] Token import failed, trying gog auth add --manual");
|
|
333
333
|
const keyringDir = `${GOG_CONFIG_DIR}/keyring`;
|
|
334
334
|
fs.mkdirSync(keyringDir, { recursive: true });
|
|
335
335
|
fs.writeFileSync(
|
|
@@ -337,7 +337,7 @@ const registerGoogleRoutes = ({
|
|
|
337
337
|
JSON.stringify(tokenData, null, 2),
|
|
338
338
|
);
|
|
339
339
|
console.log(
|
|
340
|
-
`[
|
|
340
|
+
`[alphaclaw] Token written directly to keyring: ${keyringDir}/token-${email}.json`,
|
|
341
341
|
);
|
|
342
342
|
}
|
|
343
343
|
|
|
@@ -359,7 +359,7 @@ const registerGoogleRoutes = ({
|
|
|
359
359
|
.filter(Boolean)
|
|
360
360
|
: services;
|
|
361
361
|
console.log(
|
|
362
|
-
`[
|
|
362
|
+
`[alphaclaw] Requested: ${services.join(",")} → Granted: ${grantedServices.join(",")}`,
|
|
363
363
|
);
|
|
364
364
|
|
|
365
365
|
fs.writeFileSync(
|
|
@@ -378,7 +378,7 @@ const registerGoogleRoutes = ({
|
|
|
378
378
|
window.close();
|
|
379
379
|
</script><p>Google connected! You can close this window.</p></body></html>`);
|
|
380
380
|
} catch (err) {
|
|
381
|
-
console.error("[
|
|
381
|
+
console.error("[alphaclaw] Google OAuth callback error:", err);
|
|
382
382
|
res.send(`<!DOCTYPE html><html><body><script>
|
|
383
383
|
window.opener?.postMessage({ google: 'error', message: '${err.message.replace(/'/g, "\\'")}' }, '*');
|
|
384
384
|
window.close();
|
|
@@ -86,7 +86,7 @@ const registerPairingRoutes = ({ app, clawCmd, isOnboarded, fsModule = fs, openc
|
|
|
86
86
|
});
|
|
87
87
|
const firstCliPendingId = firstCliPending?.requestId || firstCliPending?.id;
|
|
88
88
|
if (firstCliPendingId) {
|
|
89
|
-
console.log(`[
|
|
89
|
+
console.log(`[alphaclaw] Auto-approving first CLI device request: ${firstCliPendingId}`);
|
|
90
90
|
const approveResult = await clawCmd(`devices approve ${firstCliPendingId}`, {
|
|
91
91
|
quiet: true,
|
|
92
92
|
});
|
|
@@ -95,7 +95,7 @@ const registerPairingRoutes = ({ app, clawCmd, isOnboarded, fsModule = fs, openc
|
|
|
95
95
|
autoApprovedRequestId = String(firstCliPendingId);
|
|
96
96
|
} else {
|
|
97
97
|
console.log(
|
|
98
|
-
`[
|
|
98
|
+
`[alphaclaw] CLI auto-approve failed: ${(approveResult.stderr || "").slice(0, 200)}`,
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -123,7 +123,7 @@ const registerSystemRoutes = ({
|
|
|
123
123
|
envRestartPending = true;
|
|
124
124
|
}
|
|
125
125
|
const restartRequired = envRestartPending && isOnboarded();
|
|
126
|
-
console.log(`[
|
|
126
|
+
console.log(`[alphaclaw] Env vars saved (${nextEnvVars.length} vars, changed=${changed})`);
|
|
127
127
|
syncChannelConfig(nextEnvVars, "add");
|
|
128
128
|
|
|
129
129
|
res.json({ ok: true, changed, restartRequired });
|
|
@@ -175,10 +175,10 @@ const registerSystemRoutes = ({
|
|
|
175
175
|
});
|
|
176
176
|
|
|
177
177
|
app.post("/api/openclaw/update", async (req, res) => {
|
|
178
|
-
console.log("[
|
|
178
|
+
console.log("[alphaclaw] /api/openclaw/update requested");
|
|
179
179
|
const result = await openclawVersionService.updateOpenclaw();
|
|
180
180
|
console.log(
|
|
181
|
-
`[
|
|
181
|
+
`[alphaclaw] /api/openclaw/update result: status=${result.status} ok=${result.body?.ok === true}`,
|
|
182
182
|
);
|
|
183
183
|
res.status(result.status).json(result.body);
|
|
184
184
|
});
|
package/lib/server.js
CHANGED
|
@@ -148,7 +148,7 @@ server.on("upgrade", (req, socket, head) => {
|
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
server.listen(PORT, "0.0.0.0", () => {
|
|
151
|
-
console.log(`[
|
|
151
|
+
console.log(`[alphaclaw] Express listening on :${PORT}`);
|
|
152
152
|
syncBootstrapPromptFiles({ fs, workspaceDir: constants.WORKSPACE_DIR });
|
|
153
153
|
if (isOnboarded()) {
|
|
154
154
|
reloadEnv();
|
|
@@ -156,6 +156,6 @@ server.listen(PORT, "0.0.0.0", () => {
|
|
|
156
156
|
ensureGatewayProxyConfig(null);
|
|
157
157
|
startGateway();
|
|
158
158
|
} else {
|
|
159
|
-
console.log("[
|
|
159
|
+
console.log("[alphaclaw] Awaiting onboarding via Setup UI");
|
|
160
160
|
}
|
|
161
161
|
});
|