@lightcone-ai/daemon 0.9.33 → 0.9.35

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.
@@ -3,8 +3,9 @@
3
3
  * Manages one Chrome process per platform, reusing CDP connections
4
4
  * across tool calls rather than restarting Chrome each time.
5
5
  */
6
- import { spawn } from 'child_process';
7
- import { accessSync, constants as fsConstants } from 'fs';
6
+ import { spawn, execSync } from 'child_process';
7
+ import { accessSync, constants as fsConstants, rmSync, existsSync } from 'fs';
8
+ import path from 'path';
8
9
  import http from 'http';
9
10
  import { WebSocket } from 'ws';
10
11
 
@@ -107,15 +108,33 @@ async function _connectCdp(port) {
107
108
  }
108
109
 
109
110
  async function _spawnChrome(profileDir, port) {
111
+ // Clean up stale lock files
112
+ for (const lockFile of ['SingletonLock', 'SingletonCookie', 'SingletonSocket']) {
113
+ const p = path.join(profileDir, lockFile);
114
+ try { if (existsSync(p)) rmSync(p, { force: true }); } catch {}
115
+ }
116
+ // Kill any process holding the port
117
+ try {
118
+ if (process.platform !== 'win32') {
119
+ execSync(`lsof -ti:${port} | xargs kill -9`, { stdio: 'ignore' });
120
+ }
121
+ } catch {}
122
+
110
123
  const proc = spawn(CHROME_BIN, [
111
124
  `--remote-debugging-port=${port}`,
112
125
  '--no-sandbox',
113
126
  '--disable-dev-shm-usage',
114
- '--headless=false',
127
+ '--headless=new',
115
128
  `--user-data-dir=${profileDir}`,
116
129
  '--window-size=1280,900',
117
130
  '--disable-blink-features=AutomationControlled',
118
131
  '--disable-infobars',
132
+ '--no-first-run',
133
+ '--no-default-browser-check',
134
+ '--disable-hang-monitor',
135
+ '--use-mock-keychain',
136
+ '--password-store=basic',
137
+ '--disable-gpu',
119
138
  '--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
120
139
  'about:blank',
121
140
  ], { stdio: 'ignore', detached: false });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightcone-ai/daemon",
3
- "version": "0.9.33",
3
+ "version": "0.9.35",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -111,7 +111,7 @@ export class BrowserLoginSession {
111
111
  `--remote-debugging-port=${CDP_PORT}`,
112
112
  '--no-sandbox',
113
113
  '--disable-dev-shm-usage',
114
- '--headless=false',
114
+ '--headless=new',
115
115
  `--user-data-dir=${this._profileDir}`,
116
116
  '--window-size=800,900',
117
117
  '--disable-blink-features=AutomationControlled',
@@ -119,6 +119,9 @@ export class BrowserLoginSession {
119
119
  '--no-first-run',
120
120
  '--no-default-browser-check',
121
121
  '--disable-hang-monitor',
122
+ '--use-mock-keychain',
123
+ '--password-store=basic',
124
+ '--disable-gpu',
122
125
  '--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
123
126
  'about:blank',
124
127
  ], { stdio: ['ignore', 'ignore', 'pipe'], detached: false });