fluxy-bot 0.5.41 → 0.5.42

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluxy-bot",
3
- "version": "0.5.41",
3
+ "version": "0.5.42",
4
4
  "description": "Self-hosted, self-evolving AI agent with its own dashboard.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,7 +25,18 @@ export function spawnBackend(port: number): ChildProcess {
25
25
  // Clear log file on each restart — only keeps current run
26
26
  try { fs.writeFileSync(LOG_FILE, ''); } catch {}
27
27
 
28
- child = spawn(process.execPath, ['--import', 'tsx/esm', backendPath], {
28
+ // Wrap the backend in an inline loader that:
29
+ // 1. Dynamically imports the user's backend (tsx handles .ts compilation)
30
+ // 2. Adds a keepalive timer so the event loop never drains (fixes exit code 0 under systemd)
31
+ // 3. Catches and logs import errors instead of silently exiting
32
+ const backendUrl = 'file://' + backendPath.replace(/\\/g, '/');
33
+ const wrapper = [
34
+ `import('${backendUrl}')`,
35
+ ` .catch(e => { console.error('[backend] Fatal:', e); process.exit(1); });`,
36
+ `setInterval(() => {}, 60000);`,
37
+ ].join('\n');
38
+
39
+ child = spawn(process.execPath, ['--import', 'tsx/esm', '--input-type=module', '-e', wrapper], {
29
40
  cwd: path.join(PKG_DIR, 'workspace'),
30
41
  stdio: ['ignore', 'pipe', 'pipe'],
31
42
  env: { ...process.env, BACKEND_PORT: String(port) },