@lightcone-ai/daemon 0.9.70 → 0.9.71

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.
@@ -7,6 +7,7 @@ function sleep(ms) { return new Promise(r => setTimeout(r, ms)); }
7
7
  function randomInt(min, max) { return Math.floor(min + Math.random() * (max - min + 1)); }
8
8
 
9
9
  const PACE_SCALE = Math.max(0.2, Number(process.env.PUBLISHER_PACE_SCALE ?? '1') || 1);
10
+ const DRY_RUN = process.env.XHS_PUBLISH_DRY_RUN !== '0';
10
11
  async function humanPause(minMs, maxMs, label = '') {
11
12
  const ms = Math.round(randomInt(minMs, maxMs) * PACE_SCALE);
12
13
  if (label) console.error(`[XhsAdapter] pause ${label}: ${ms}ms`);
@@ -104,7 +105,11 @@ export class XhsAdapter {
104
105
  await this._assertNoBlockingErrors();
105
106
  await this._assertPublishButtonReady();
106
107
 
107
- // Click publish button
108
+ if (DRY_RUN) {
109
+ console.error('[XhsAdapter] XHS_PUBLISH_DRY_RUN enabled; skipping final publish click.');
110
+ return { success: true, dry_run: true, post_url: null };
111
+ }
112
+
108
113
  await humanPause(1200, 3000, 'before-publish-click');
109
114
  const clicked = await this._clickByText('发布');
110
115
  if (!clicked) throw new Error('PUBLISH_FAILED: 找不到发布按钮,页面结构可能已变化');
@@ -144,6 +149,11 @@ export class XhsAdapter {
144
149
  await this._assertNoBlockingErrors();
145
150
  await this._assertPublishButtonReady();
146
151
 
152
+ if (DRY_RUN) {
153
+ console.error('[XhsAdapter] XHS_PUBLISH_DRY_RUN enabled; skipping final publish click.');
154
+ return { success: true, dry_run: true, post_url: null };
155
+ }
156
+
147
157
  await humanPause(1200, 3000, 'before-publish-click');
148
158
  const clicked = await this._clickByText('发布');
149
159
  if (!clicked) throw new Error('PUBLISH_FAILED: 找不到发布按钮,页面结构可能已变化');
@@ -205,6 +205,11 @@ images/video 字段填写本地绝对路径(在 agent workspace 目录下)
205
205
  });
206
206
 
207
207
  await completeApproval(approval_action_id, true, result, null);
208
+ if (result?.dry_run) {
209
+ return {
210
+ content: [{ type: 'text', text: `✓ ${label}发布流程已完成到发布前一步,已跳过最终“发布”点击。` }],
211
+ };
212
+ }
208
213
  const postUrl = result.post_url ? `\n发布链接: ${result.post_url}` : '';
209
214
  return {
210
215
  content: [{ type: 'text', text: `✓ 已成功发布到${label}。${postUrl}` }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightcone-ai/daemon",
3
- "version": "0.9.70",
3
+ "version": "0.9.71",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {