@dmsdc-ai/aigentry-deliberation 0.0.29 → 0.0.30

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.
Files changed (2) hide show
  1. package/index.js +25 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -719,7 +719,10 @@ function dedupeBrowserTabs(tabs = []) {
719
719
  const title = String(tab?.title || "").trim();
720
720
  const url = String(tab?.url || "").trim();
721
721
  if (!url || (!isLlmUrl(url) && !isExtensionLlmTab(url, title))) continue;
722
- const key = `${browser}\t${title}\t${url}`;
722
+ // Dedup by title+url (ignore browser name) so that the same tab detected
723
+ // via both AppleScript and CDP is not duplicated. The first occurrence wins,
724
+ // so callers should add preferred sources first (e.g., CDP before AppleScript).
725
+ const key = `${title}\t${url}`;
723
726
  if (seen.has(key)) continue;
724
727
  seen.add(key);
725
728
  out.push({
@@ -1145,6 +1148,16 @@ async function collectBrowserLlmTabs() {
1145
1148
  };
1146
1149
  }
1147
1150
 
1151
+ // CDP first: CDP-detected tabs are preferred over AppleScript-detected ones
1152
+ // because they carry CDP metadata (tab ID, WebSocket URL) for browser_auto transport.
1153
+ // Since dedupeBrowserTabs keeps the first occurrence, CDP entries win the dedup.
1154
+ const shouldUseCdp = mode === "auto" || mode === "cdp";
1155
+ if (shouldUseCdp) {
1156
+ const cdp = await collectBrowserLlmTabsViaCdp();
1157
+ tabs.push(...cdp.tabs);
1158
+ if (cdp.note) notes.push(cdp.note);
1159
+ }
1160
+
1148
1161
  const shouldUseAppleScript = mode === "auto" || mode === "applescript";
1149
1162
  if (shouldUseAppleScript && process.platform === "darwin") {
1150
1163
  const mac = collectBrowserLlmTabsViaAppleScript();
@@ -1154,13 +1167,6 @@ async function collectBrowserLlmTabs() {
1154
1167
  notes.push("AppleScript scanning is macOS only. Switch to CDP scanning.");
1155
1168
  }
1156
1169
 
1157
- const shouldUseCdp = mode === "auto" || mode === "cdp";
1158
- if (shouldUseCdp) {
1159
- const cdp = await collectBrowserLlmTabsViaCdp();
1160
- tabs.push(...cdp.tabs);
1161
- if (cdp.note) notes.push(cdp.note);
1162
- }
1163
-
1164
1170
  const uniqTabs = dedupeBrowserTabs(tabs);
1165
1171
  return {
1166
1172
  tabs: uniqTabs,
@@ -1345,6 +1351,17 @@ async function collectSpeakerCandidates({ include_cli = true, include_browser =
1345
1351
  }
1346
1352
  }
1347
1353
  }
1354
+
1355
+ // Third pass: upgrade browser-detected candidates that missed the first hostname match.
1356
+ // When CDP is reachable, AppleScript-detected speakers should also get browser_auto
1357
+ // transport. The OrchestratedBrowserPort will create/navigate tabs on demand if needed.
1358
+ if (cdpReachable) {
1359
+ for (const candidate of candidates) {
1360
+ if (candidate.type !== "browser" || candidate.auto_registered) continue;
1361
+ if (candidate.cdp_available) continue; // already matched
1362
+ candidate.cdp_available = true;
1363
+ }
1364
+ }
1348
1365
  }
1349
1366
 
1350
1367
  return { candidates, browserNote };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-deliberation",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "description": "MCP Deliberation Server — Multi-session AI deliberation with smart speaker ordering and persona roles",
5
5
  "type": "module",
6
6
  "license": "MIT",