@lightcone-ai/daemon 0.9.52 → 0.9.53

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.
@@ -4,7 +4,7 @@
4
4
  * across tool calls rather than restarting Chrome each time.
5
5
  */
6
6
  import { spawn, execSync } from 'child_process';
7
- import { accessSync, constants as fsConstants, rmSync, existsSync } from 'fs';
7
+ import { accessSync, constants as fsConstants, rmSync, existsSync, readFileSync } from 'fs';
8
8
  import path from 'path';
9
9
  import http from 'http';
10
10
  import { WebSocket } from 'ws';
@@ -188,6 +188,20 @@ export async function getSession(platform, profileDir) {
188
188
  source: `Object.defineProperty(navigator, 'webdriver', { get: () => undefined });`,
189
189
  });
190
190
 
191
+ // Inject saved cookies from browser-login (bypasses macOS keychain cross-process encryption issue)
192
+ const cookiesFile = path.join(profileDir, 'cookies.json');
193
+ if (existsSync(cookiesFile)) {
194
+ try {
195
+ const cookies = JSON.parse(readFileSync(cookiesFile, 'utf8'));
196
+ await cdp.send('Network.setCookies', { cookies });
197
+ console.log(`[ChromePool] Injected ${cookies.length} cookies from cookies.json for ${platform}`);
198
+ } catch (err) {
199
+ console.error(`[ChromePool] Failed to inject cookies: ${err.message}`);
200
+ }
201
+ } else {
202
+ console.log(`[ChromePool] No cookies.json found for ${platform} at ${cookiesFile}`);
203
+ }
204
+
191
205
  proc.on('exit', () => {
192
206
  console.log(`[ChromePool] Chrome for ${platform} exited`);
193
207
  _sessions.delete(platform);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightcone-ai/daemon",
3
- "version": "0.9.52",
3
+ "version": "0.9.53",
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, mkdirSync } from 'fs';
9
+ import { accessSync, constants as fsConstants, rmSync, existsSync, mkdirSync, writeFileSync } from 'fs';
10
10
  import path from 'path';
11
11
  import http from 'http';
12
12
  import { WebSocket } from 'ws';
@@ -253,6 +253,18 @@ export class BrowserLoginSession {
253
253
  const loggedIn = await this.isLoggedIn(baselineSession);
254
254
  if (loggedIn) {
255
255
  this._stopTimers();
256
+ // Export decrypted cookies to cookies.json so chrome-pool can inject them
257
+ // without relying on platform-specific keychain encryption (fixes macOS cross-process issue)
258
+ try {
259
+ const cookieResult = await this.send('Network.getAllCookies', {});
260
+ const cookies = (cookieResult.cookies ?? []).filter(c =>
261
+ c.domain.includes(new URL(this._config.loginUrl).hostname.split('.').slice(-2).join('.'))
262
+ );
263
+ writeFileSync(path.join(this._profileDir, 'cookies.json'), JSON.stringify(cookies));
264
+ console.log(`[BrowserLogin][${this._platform}] Saved ${cookies.length} cookies to cookies.json`);
265
+ } catch (err) {
266
+ console.error(`[BrowserLogin][${this._platform}] Failed to save cookies: ${err.message}`);
267
+ }
256
268
  connection.send({ type: 'browser:login_complete', platform: this._platform, profileDir: this._profileDir });
257
269
  this.close();
258
270
  }