@lightcone-ai/daemon 0.9.38 → 0.9.39

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": "@lightcone-ai/daemon",
3
- "version": "0.9.38",
3
+ "version": "0.9.39",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { spawn, execSync } from 'child_process';
8
8
  import { homedir } from 'os';
9
- import { accessSync, constants as fsConstants, rmSync, existsSync } from 'fs';
9
+ import { accessSync, constants as fsConstants, rmSync, existsSync, mkdirSync } from 'fs';
10
10
  import path from 'path';
11
11
  import http from 'http';
12
12
  import { WebSocket } from 'ws';
@@ -94,6 +94,23 @@ export class BrowserLoginSession {
94
94
  async start(connection, userId) {
95
95
  this._profileDir = profileDir(this._platform, userId);
96
96
 
97
+ // Ensure profile dir exists
98
+ try { mkdirSync(this._profileDir, { recursive: true }); } catch {}
99
+
100
+ // Kill any process holding the CDP port
101
+ try {
102
+ if (process.platform !== 'win32') {
103
+ execSync(`lsof -ti:${CDP_PORT} | xargs kill -9`, { stdio: 'ignore' });
104
+ }
105
+ } catch {}
106
+ await sleep(300);
107
+
108
+ // Clean up stale Chrome lock files
109
+ for (const lockFile of ['SingletonLock', 'SingletonCookie', 'SingletonSocket']) {
110
+ const p = path.join(this._profileDir, lockFile);
111
+ try { if (existsSync(p)) rmSync(p, { force: true }); } catch {}
112
+ }
113
+
97
114
  this._proc = spawn(CHROME_BIN, [
98
115
  `--remote-debugging-port=${CDP_PORT}`,
99
116
  '--no-sandbox',