channel-worker 2.3.1 → 2.3.3
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/lib/api-client.js +2 -1
- package/lib/command-poller.js +1 -0
- package/lib/heartbeat.js +15 -1
- package/package.json +1 -1
package/lib/api-client.js
CHANGED
|
@@ -29,10 +29,11 @@ class ApiClient {
|
|
|
29
29
|
return this.request('POST', '/workers/register', workerData);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
async heartbeat(workerId, version, extensionVersion) {
|
|
32
|
+
async heartbeat(workerId, version, extensionVersion, ccExtensionVersion) {
|
|
33
33
|
const body = { worker_id: workerId };
|
|
34
34
|
if (version) body.version = version;
|
|
35
35
|
if (extensionVersion) body.extension_version = extensionVersion;
|
|
36
|
+
if (ccExtensionVersion) body.cc_extension_version = ccExtensionVersion;
|
|
36
37
|
return this.request('POST', '/workers/heartbeat', body);
|
|
37
38
|
}
|
|
38
39
|
|
package/lib/command-poller.js
CHANGED
|
@@ -1293,6 +1293,7 @@ class CommandPoller {
|
|
|
1293
1293
|
profileId: renderer.nst_profile_id,
|
|
1294
1294
|
workerToken: this.config.worker_token || '',
|
|
1295
1295
|
workerType: 'veo3',
|
|
1296
|
+
daemonUrl: this.config.daemon_url || '',
|
|
1296
1297
|
}));
|
|
1297
1298
|
extensionPath = uniqueExtPath;
|
|
1298
1299
|
} catch (e) {
|
package/lib/heartbeat.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const os = require('os');
|
|
1
4
|
const { getLocalVersion } = require('./updater');
|
|
2
5
|
const { getLocalExtensionVersion } = require('./extension-updater');
|
|
3
6
|
|
|
7
|
+
function readCcExtensionVersion(config) {
|
|
8
|
+
try {
|
|
9
|
+
const dir = config.content_creator_ext_path || path.join(os.homedir(), 'content-creator-ext');
|
|
10
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(dir, 'manifest.json'), 'utf8'));
|
|
11
|
+
return manifest.version || null;
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
4
17
|
class Heartbeat {
|
|
5
18
|
constructor(api, workerId, intervalMs = 30000, config = {}) {
|
|
6
19
|
this.api = api;
|
|
@@ -26,7 +39,8 @@ class Heartbeat {
|
|
|
26
39
|
try {
|
|
27
40
|
const version = getLocalVersion();
|
|
28
41
|
const extVersion = getLocalExtensionVersion(this.config.extension_path);
|
|
29
|
-
|
|
42
|
+
const ccExtVersion = readCcExtensionVersion(this.config);
|
|
43
|
+
await this.api.heartbeat(this.workerId, version, extVersion, ccExtVersion);
|
|
30
44
|
} catch (err) {
|
|
31
45
|
console.error(`[heartbeat] Failed: ${err.message}`);
|
|
32
46
|
}
|