channel-worker 1.1.6 → 1.1.8

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 CHANGED
@@ -54,10 +54,6 @@ class ApiClient {
54
54
  return this.request('GET', `/channels/${channelId}`);
55
55
  }
56
56
 
57
- async getMasterChannel(masterId) {
58
- return this.request('GET', `/masters/${masterId}`);
59
- }
60
-
61
57
  // Settings
62
58
  async getSetting(key) {
63
59
  const data = await this.request('GET', `/settings/${key}`);
@@ -125,15 +125,13 @@ class CommandPoller {
125
125
  extensionPath = uniqueExtPath;
126
126
  console.log(`[commands] Extension dir: ${uniqueExtPath}`);
127
127
 
128
- // Cleanup old dirs (keep last 3)
128
+ // Cleanup ALL old dirs (only keep current)
129
129
  const parent = path.dirname(baseExtPath);
130
130
  const baseName = path.basename(baseExtPath);
131
131
  const oldDirs = fs.readdirSync(parent)
132
132
  .filter(d => d.startsWith(baseName + '-') && d !== path.basename(uniqueExtPath))
133
133
  .map(d => path.join(parent, d))
134
- .filter(d => fs.statSync(d).isDirectory())
135
- .sort()
136
- .slice(0, -3);
134
+ .filter(d => { try { return fs.statSync(d).isDirectory(); } catch { return false; } });
137
135
  for (const d of oldDirs) {
138
136
  try { fs.rmSync(d, { recursive: true }); } catch {}
139
137
  }
@@ -695,7 +693,7 @@ class CommandPoller {
695
693
  }
696
694
 
697
695
  async handleTypeText(command) {
698
- const { text, profile_id, url_match, focus_selector, press_enter } = command.payload || {};
696
+ const { text, profile_id, url_match, focus_selector, press_enter, select_all } = command.payload || {};
699
697
  console.log(`[commands] Typing text (${text?.length} chars) for profile: ${profile_id}`);
700
698
  try {
701
699
  const WebSocket = require('ws');
@@ -783,6 +781,17 @@ class CommandPoller {
783
781
  }
784
782
  // Small delay for focus to take effect
785
783
  await new Promise(r => setTimeout(r, 300));
784
+ // Select all existing text if requested (to clear/replace)
785
+ if (select_all) {
786
+ await send('Input.dispatchKeyEvent', { type: 'rawKeyDown', key: 'a', code: 'KeyA', windowsVirtualKeyCode: 65, nativeVirtualKeyCode: 65, modifiers: 2 }); // Ctrl+A
787
+ await send('Input.dispatchKeyEvent', { type: 'keyUp', key: 'a', code: 'KeyA', windowsVirtualKeyCode: 65, nativeVirtualKeyCode: 65, modifiers: 2 });
788
+ await new Promise(r => setTimeout(r, 200));
789
+ // Delete selected
790
+ await send('Input.dispatchKeyEvent', { type: 'rawKeyDown', key: 'Backspace', code: 'Backspace', windowsVirtualKeyCode: 8, nativeVirtualKeyCode: 8 });
791
+ await send('Input.dispatchKeyEvent', { type: 'keyUp', key: 'Backspace', code: 'Backspace', windowsVirtualKeyCode: 8, nativeVirtualKeyCode: 8 });
792
+ await new Promise(r => setTimeout(r, 200));
793
+ }
794
+
786
795
  // Type text — use char-by-char for inputs that need keystroke events (press_enter mode)
787
796
  if (press_enter) {
788
797
  // Type each character with delay so React processes keystrokes
@@ -9,13 +9,12 @@ class JobExecutor {
9
9
  console.log(`[executor] Starting job ${jobId} — ${job.flow_type} for channel ${job.channel_id}`);
10
10
 
11
11
  try {
12
- // 1. Get channel + master info
12
+ // 1. Get channel info
13
13
  await this.updateStatus(jobId, 'sourcing');
14
14
  const channel = await this.api.getChannel(job.channel_id);
15
- const master = await this.api.getMasterChannel(channel.master_id);
16
- const brandKit = master.brand_kit || {};
15
+ const brandKit = channel.brand_kit || {};
17
16
 
18
- console.log(`[executor] Channel: ${channel.name} | Master: ${master.name} | Profile: ${channel.nst_profile_id}`);
17
+ console.log(`[executor] Channel: ${channel.name} | Profile: ${channel.nst_profile_id}`);
19
18
 
20
19
  // 2. Launch Nstbrowser profile
21
20
  if (channel.nst_profile_id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Channel Manager worker daemon — runs on remote machines to execute video pipeline jobs",
5
5
  "main": "lib/daemon.js",
6
6
  "bin": {