@lightcone-ai/daemon 0.15.14 → 0.15.15

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.
@@ -53,7 +53,8 @@ export class KuaishouAdapter {
53
53
  if (!redirectUrl.includes('cp.kuaishou.com/article/publish')) {
54
54
  throw new Error(`LOGIN_EXPIRED: 快手登录已过期,请重新扫码连接 (redirected to: ${redirectUrl})`);
55
55
  }
56
- await this._waitForSelector('input[type="file"], [class*="upload"]', 20000);
56
+ try { await this._cdp.send('Runtime.evaluate', { expression: 'window.scrollTo(0, 300)', returnByValue: false }); } catch {}
57
+ await this._waitForSelector('input[type="file"], [class*="upload"], [class*="Upload"]', 45000);
57
58
 
58
59
  const { loggedIn } = await this.checkLoginStatus();
59
60
  if (!loggedIn) throw new Error('LOGIN_EXPIRED: 快手登录已过期,请重新扫码连接');
@@ -88,7 +89,9 @@ export class KuaishouAdapter {
88
89
  if (!redirectUrl.includes('cp.kuaishou.com/article/publish')) {
89
90
  throw new Error(`LOGIN_EXPIRED: 快手登录已过期,请重新扫码连接 (redirected to: ${redirectUrl})`);
90
91
  }
91
- await this._waitForSelector('input[type="file"], [class*="upload"]', 20000);
92
+ // Scroll once to trigger any lazy-rendered upload widgets, then wait
93
+ try { await this._cdp.send('Runtime.evaluate', { expression: 'window.scrollTo(0, 300)', returnByValue: false }); } catch {}
94
+ await this._waitForSelector('input[type="file"], [class*="upload"], [class*="Upload"]', 45000);
92
95
 
93
96
  const { loggedIn } = await this.checkLoginStatus();
94
97
  if (!loggedIn) throw new Error('LOGIN_EXPIRED: 快手登录已过期,请重新扫码连接');
@@ -124,6 +127,24 @@ export class KuaishouAdapter {
124
127
  if (result.result?.value) return;
125
128
  await sleep(500);
126
129
  }
130
+ // Dump diagnostic info to help debug page state on timeout
131
+ try {
132
+ const [urlR, titleR, bodyR, inputR, uploadR] = await Promise.all([
133
+ this._cdp.send('Runtime.evaluate', { expression: 'location.href', returnByValue: true }),
134
+ this._cdp.send('Runtime.evaluate', { expression: 'document.title', returnByValue: true }),
135
+ this._cdp.send('Runtime.evaluate', { expression: 'document.body?.innerText?.slice(0,400)', returnByValue: true }),
136
+ this._cdp.send('Runtime.evaluate', { expression: `!!document.querySelector('input[type="file"]')`, returnByValue: true }),
137
+ this._cdp.send('Runtime.evaluate', { expression: `document.querySelectorAll('[class*="upload"],[class*="Upload"]').length`, returnByValue: true }),
138
+ ]);
139
+ console.error(`[KuaishouAdapter] selector timeout diagnostics:`);
140
+ console.error(` url=${urlR.result?.value}`);
141
+ console.error(` title=${titleR.result?.value}`);
142
+ console.error(` input[type=file] present=${inputR.result?.value}`);
143
+ console.error(` upload-class elements=${uploadR.result?.value}`);
144
+ console.error(` body text: ${bodyR.result?.value}`);
145
+ } catch (diagErr) {
146
+ console.error(`[KuaishouAdapter] diagnostic failed: ${diagErr.message}`);
147
+ }
127
148
  throw new Error(`Timeout waiting for selector: ${selector}`);
128
149
  }
129
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightcone-ai/daemon",
3
- "version": "0.15.14",
3
+ "version": "0.15.15",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -11,6 +11,7 @@ import path from 'path';
11
11
  import http from 'http';
12
12
  import { WebSocket } from 'ws';
13
13
  import { acquireProfileLock } from './profile-lock.js';
14
+ import { closeSession as closePublisherSession } from '../mcp-servers/publisher/chrome-pool.js';
14
15
 
15
16
  // ── Platform configs ──────────────────────────────────────────────────────────
16
17
 
@@ -419,6 +420,11 @@ export class BrowserLoginSession {
419
420
  } catch (err) {
420
421
  console.error(`[BrowserLogin][${this._platform}] Failed to save cookies: ${err.message}`);
421
422
  }
423
+ // Kill any stale chrome-pool session so the next publish job starts fresh with new cookies
424
+ try {
425
+ closePublisherSession(this._platform);
426
+ console.log(`[BrowserLogin][${this._platform}] Closed stale publisher Chrome session after re-login`);
427
+ } catch {}
422
428
  connection.send({ type: 'browser:login_complete', platform: this._platform, profileDir: this._profileDir });
423
429
  await this.close();
424
430
  }