cdp-tunnel 2.5.4 → 2.5.6

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.
@@ -167,13 +167,17 @@ var SpecialHandler = (function() {
167
167
  tryGroup();
168
168
  }
169
169
 
170
- function doGroup(tabId, clientId, baseName) {
170
+ function doGroup(tabId, clientId, baseName, retries) {
171
+ retries = retries || 0;
171
172
  chrome.tabGroups.query({}, function(allGroups) {
172
173
  var existing = CDPUtils.findGroupByName(allGroups, baseName);
173
174
  if (existing) {
174
175
  chrome.tabs.group({ tabIds: tabId, groupId: existing.id }, function(result) {
175
176
  if (chrome.runtime.lastError) {
176
- Logger.error('[TabGroup] Failed to add tab to group:', chrome.runtime.lastError.message);
177
+ Logger.error('[TabGroup] Failed to add tab to group:', chrome.runtime.lastError.message, 'retries:', retries);
178
+ if (retries < 3) {
179
+ setTimeout(function() { doGroup(tabId, clientId, baseName, retries + 1); }, 500);
180
+ }
177
181
  } else {
178
182
  State.setGroupIdForClient(clientId, existing.id);
179
183
  updateTabGroupName(clientId);
@@ -183,7 +187,10 @@ var SpecialHandler = (function() {
183
187
  } else {
184
188
  chrome.tabs.group({ tabIds: tabId }, function(groupId) {
185
189
  if (chrome.runtime.lastError) {
186
- Logger.error('[TabGroup] Failed to create group:', chrome.runtime.lastError.message);
190
+ Logger.error('[TabGroup] Failed to create group:', chrome.runtime.lastError.message, 'retries:', retries);
191
+ if (retries < 3) {
192
+ setTimeout(function() { doGroup(tabId, clientId, baseName, retries + 1); }, 500);
193
+ }
187
194
  return;
188
195
  }
189
196
  if (groupId) {
@@ -392,33 +392,54 @@ var WebSocketManager = (function() {
392
392
  if (_groupMonitorTimer) clearInterval(_groupMonitorTimer);
393
393
  _groupMonitorTimer = setInterval(function() {
394
394
  var attached = State.getAttachedTabIds();
395
+ Logger.info('[Monitor] Checking ' + attached.length + ' attached tabs for grouping...');
395
396
  attached.forEach(function(tabId) {
396
397
  var clientId = State.getClientIdByTabId(tabId);
397
- if (!clientId) return;
398
- if (State.isPreExistingTab(tabId)) return;
398
+ if (!clientId) {
399
+ Logger.warn('[Monitor] Tab', tabId, 'has no clientId mapping, cannot group');
400
+ return;
401
+ }
402
+ if (State.isPreExistingTab(tabId)) {
403
+ Logger.info('[Monitor] Tab', tabId, 'is pre-existing, skipping');
404
+ return;
405
+ }
399
406
  chrome.tabs.get(tabId, function(tab) {
400
- if (chrome.runtime.lastError || !tab) return;
401
- if (tab.groupId) return;
402
- Logger.info('[Monitor] Tab', tabId, 'has no group, regrouping for client:', clientId);
403
- var baseName = CDPUtils.getGroupBaseName(clientId);
407
+ if (chrome.runtime.lastError || !tab) {
408
+ Logger.error('[Monitor] Tab', tabId, 'not found:', chrome.runtime.lastError?.message);
409
+ return;
410
+ }
404
411
  var groupId = State.getGroupIdForClient(clientId);
412
+ Logger.info('[Monitor] Tab', tabId, 'groupId=' + (tab.groupId || 'none'), 'expectedGroup=' + (groupId || 'none'), 'clientId=' + (clientId || 'none'));
413
+ if (tab.groupId) return;
414
+ Logger.info('[Monitor] Tab', tabId, 'escaped! Forcing regroup for client:', clientId);
405
415
  if (groupId) {
406
- chrome.tabs.group({ tabIds: tabId, groupId: groupId }, function() {});
416
+ chrome.tabs.group({ tabIds: tabId, groupId: groupId }, function() {
417
+ Logger.info('[Monitor] Re-added tab', tabId, 'to existing group:', groupId);
418
+ });
407
419
  } else {
420
+ var baseName = CDPUtils.getGroupBaseName(clientId);
408
421
  chrome.tabs.group({ tabIds: tabId }, function(newGroupId) {
409
- if (chrome.runtime.lastError || !newGroupId) return;
422
+ if (chrome.runtime.lastError || !newGroupId) {
423
+ Logger.error('[Monitor] Failed to create group for tab', tabId, ':', chrome.runtime.lastError?.message);
424
+ return;
425
+ }
410
426
  chrome.tabGroups.update(newGroupId, {
411
427
  title: baseName,
412
428
  color: CDPUtils.getGroupColorForClient(clientId),
413
429
  collapsed: true
414
430
  }, function() {
415
431
  State.setGroupIdForClient(clientId, newGroupId);
432
+ Logger.info('[Monitor] Created new group', newGroupId, 'for escaped tab', tabId);
416
433
  });
417
434
  });
418
435
  }
419
436
  });
420
437
  });
421
- }, 10000);
438
+ }, 5000);
439
+ }
440
+ });
441
+ });
442
+ }, 5000);
422
443
  }
423
444
 
424
445
  function stopGroupMonitor() {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "CDP Bridge",
4
- "version": "2.5.4",
4
+ "version": "2.5.6",
5
5
  "description": "Chrome DevTools Protocol Bridge for Playwright/Puppeteer automation",
6
6
  "permissions": [
7
7
  "debugger",
@@ -1,5 +1,5 @@
1
1
  var Config = {
2
- WS_URL: 'ws://localhost:37171/plugin',
2
+ WS_URL: 'ws://localhost:25429/plugin',
3
3
  RECONNECT_DELAY: 3000,
4
4
  DEBUGGER_VERSION: '1.3',
5
5
  HEARTBEAT_INTERVAL: 25000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdp-tunnel",
3
- "version": "2.5.4",
3
+ "version": "2.5.6",
4
4
  "description": "Bridge Chrome's debugger API to WebSocket — control your existing browser with Playwright/Puppeteer via CDP",
5
5
  "main": "server/proxy-server.js",
6
6
  "bin": "./cli/index.js",