arisa 2.3.22 → 2.3.24
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/package.json +1 -1
- package/src/daemon/index.ts +23 -9
- package/src/daemon/lifecycle.ts +1 -1
package/package.json
CHANGED
package/src/daemon/index.ts
CHANGED
|
@@ -32,7 +32,7 @@ const { createLogger } = await import("../shared/logger");
|
|
|
32
32
|
const { serveWithRetry, claimProcess, releaseProcess, cleanupSocket } = await import("../shared/ports");
|
|
33
33
|
const { TelegramChannel } = await import("./channels/telegram");
|
|
34
34
|
const { sendToCore } = await import("./bridge");
|
|
35
|
-
const { startCore, stopCore, setLifecycleNotify } = await import("./lifecycle");
|
|
35
|
+
const { startCore, stopCore, setLifecycleNotify, waitForCoreReady } = await import("./lifecycle");
|
|
36
36
|
const { setAutoFixNotify } = await import("./autofix");
|
|
37
37
|
const { maybeStartCodexDeviceAuth, setCodexLoginNotify } = await import("./codex-login");
|
|
38
38
|
const { maybeStartClaudeSetupToken, maybeFeedClaudeCode, setClaudeLoginNotify, isClaudeLoginPending } = await import("./claude-login");
|
|
@@ -256,17 +256,31 @@ const pushServer = await serveWithRetry({
|
|
|
256
256
|
|
|
257
257
|
log.info(`Daemon push server listening on ${config.daemonSocket}`);
|
|
258
258
|
|
|
259
|
-
// --- Auto-install missing CLIs (non-blocking) ---
|
|
260
|
-
void autoInstallMissingClis();
|
|
261
|
-
|
|
262
259
|
// --- Start Core process ---
|
|
263
260
|
startCore();
|
|
264
261
|
|
|
265
|
-
// ---
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
262
|
+
// --- Auto-install missing CLIs (after Core is up to avoid OOM on low-RAM VPS) ---
|
|
263
|
+
waitForCoreReady(30_000).then(() => void autoInstallMissingClis());
|
|
264
|
+
|
|
265
|
+
// --- Connect Telegram (with retry for 409 conflict from stale polling sessions) ---
|
|
266
|
+
(async function connectTelegram(maxRetries = 5) {
|
|
267
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
268
|
+
try {
|
|
269
|
+
await telegram.connect();
|
|
270
|
+
return; // connected — polling continues in background
|
|
271
|
+
} catch (error) {
|
|
272
|
+
const is409 = String(error).includes("409");
|
|
273
|
+
if (is409 && attempt < maxRetries) {
|
|
274
|
+
const wait = attempt * 5;
|
|
275
|
+
log.warn(`Telegram 409 conflict (attempt ${attempt}/${maxRetries}), retrying in ${wait}s...`);
|
|
276
|
+
await new Promise((r) => setTimeout(r, wait * 1000));
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
log.error(`Telegram connection failed: ${error}`);
|
|
280
|
+
process.exit(1);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
})();
|
|
270
284
|
|
|
271
285
|
// --- Graceful shutdown ---
|
|
272
286
|
function shutdown() {
|
package/src/daemon/lifecycle.ts
CHANGED
|
@@ -134,7 +134,7 @@ export function startCore() {
|
|
|
134
134
|
const bunEnv = "export HOME=/home/arisa && export BUN_INSTALL=/home/arisa/.bun && export PATH=/home/arisa/.bun/bin:$PATH";
|
|
135
135
|
const inner = `${bunEnv} && cd ${config.projectDir} && exec bun --watch ${coreEntry}`;
|
|
136
136
|
cmd = ["su", "arisa", "-s", "/bin/bash", "-c", inner];
|
|
137
|
-
log.info(`Starting Core as arisa
|
|
137
|
+
log.info(`Starting Core as arisa: bun --watch ${coreEntry}`);
|
|
138
138
|
} else {
|
|
139
139
|
cmd = ["bun", "--watch", coreEntry];
|
|
140
140
|
log.info(`Starting Core: bun --watch ${coreEntry}`);
|