dsh-douyin-agent 1.4.6 → 1.4.7
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/autonomous-watch.mjs +7 -1
- package/package.json +1 -1
- package/runtime-paths.mjs +14 -1
package/autonomous-watch.mjs
CHANGED
|
@@ -192,7 +192,13 @@ export class AutonomousWatch {
|
|
|
192
192
|
}, 500); this.heartbeat.unref?.();
|
|
193
193
|
const remaining = this.videoLimits.state().session.expiresAt - this.now();
|
|
194
194
|
this.deadline = setTimeout(() => this.abort.abort(failure('本轮刷视频时间已用完。', 'limited')), Math.max(1, Math.min(remaining, 2_147_483_647))); this.deadline.unref?.();
|
|
195
|
-
this.completion = Promise.resolve().then(() => this.run()).catch(error => {
|
|
195
|
+
this.completion = Promise.resolve().then(() => this.run()).catch(error => {
|
|
196
|
+
this.onEvent({ type: 'watch.failed', message: redact(error.message || String(error), [this.config.apiKey]) });
|
|
197
|
+
// 2026-10-31:启动阶段就失败(最常见是没找到 Node.js,专用浏览器根本没起来)时,
|
|
198
|
+
// 界面上的轮次秒数还在走、却什么都不会发生。这里把这一轮直接结束掉,别让它空转。
|
|
199
|
+
if (!this.track) { try { this.videoLimits.endSession({ explicit: true, reason: '本轮启动失败,已自动结束。' }); } catch { /* 结束不掉也不影响报错 */ } }
|
|
200
|
+
return { running: false, status: 'failed', reason: redact(error.message || String(error), [this.config.apiKey]) };
|
|
201
|
+
}).then(result => { this.notifyRoundEnd(result); return result; }).finally(() => { this.completion = null; });
|
|
196
202
|
return this.state();
|
|
197
203
|
} catch (error) {
|
|
198
204
|
clearInterval(this.heartbeat); clearTimeout(this.deadline); this.running = false;
|
package/package.json
CHANGED
package/runtime-paths.mjs
CHANGED
|
@@ -99,8 +99,21 @@ export function resolveNodeExecutable({ env = process.env, executable = process.
|
|
|
99
99
|
const fixedLocations = process.platform === 'win32'
|
|
100
100
|
? ['ProgramFiles', 'ProgramFiles(x86)', 'LOCALAPPDATA'].filter(key => typeof env[key] === 'string' && path.isAbsolute(env[key])).map(key => path.join(env[key], 'Programs', 'nodejs', nodeName)).concat(['ProgramFiles', 'ProgramFiles(x86)'].filter(key => typeof env[key] === 'string' && path.isAbsolute(env[key])).map(key => path.join(env[key], 'nodejs', nodeName)))
|
|
101
101
|
: ['/usr/local/bin', '/usr/bin', '/opt/homebrew/bin'].map(directory => path.join(directory, nodeName));
|
|
102
|
+
// 2026-10-31:DSH 0.2.1-rc.5 把 Node 放在 resources\runtime\primary-runtime\dependencies\node\bin\node.exe,
|
|
103
|
+
// 和插件原来找的 resources\runtime\node\node.exe 不是同一个目录——使用者就是这样五处全落空、浏览器起不来。
|
|
104
|
+
const runtimeCandidates = (() => {
|
|
105
|
+
if (!resourcesPath || !path.isAbsolute(resourcesPath)) return [];
|
|
106
|
+
const root = path.join(resourcesPath, 'runtime');
|
|
107
|
+
const found = [path.join(root, 'node', nodeName)];
|
|
108
|
+
try {
|
|
109
|
+
for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
|
|
110
|
+
if (entry.isDirectory()) found.push(path.join(root, entry.name, 'dependencies', 'node', 'bin', nodeName));
|
|
111
|
+
}
|
|
112
|
+
} catch { /* 没有 runtime 目录就只留默认那条 */ }
|
|
113
|
+
return found;
|
|
114
|
+
})();
|
|
102
115
|
const candidates = [
|
|
103
|
-
...
|
|
116
|
+
...runtimeCandidates,
|
|
104
117
|
path.join(sourceRoot, 'desktop', '.cache', 'generated', 'node', nodeName),
|
|
105
118
|
...runtimeNodes,
|
|
106
119
|
...fixedLocations,
|