dsh-site-bridge 0.6.2 → 0.6.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.
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 3,
3
3
  "default_locale": "en",
4
4
  "name": "__MSG_appName__",
5
- "version": "0.6.2",
5
+ "version": "0.6.3",
6
6
  "description": "__MSG_appDesc__",
7
7
  "minimum_chrome_version": "116",
8
8
  "permissions": [
package/extension/sw.js CHANGED
@@ -294,6 +294,25 @@ async function claimTab(tabId) {
294
294
  return attach(id)
295
295
  }
296
296
 
297
+ chrome.tabs.onUpdated.addListener((tabId, info, tab) => {
298
+ const session = state.sessions.get(tabId)
299
+ if (!session) return
300
+ const next = { id: tab.id, url: tab.url, title: tab.title }
301
+ if (next.title === session.target.title && next.url === session.target.url) return
302
+ session.target = next
303
+ void evt('target', { tab: next, tabId })
304
+ })
305
+
306
+ chrome.tabs.onRemoved.addListener((tabId) => {
307
+ if (!state.sessions.has(tabId)) return
308
+ state.sessions.delete(tabId)
309
+ if (state.activeTabId === tabId) {
310
+ state.activeTabId = state.sessions.size > 0 ? [...state.sessions.keys()][0] : null
311
+ }
312
+ void evt('target', { tab: null, tabId })
313
+ void evt('active', { tabId: state.activeTabId })
314
+ })
315
+
297
316
  chrome.debugger.onDetach.addListener((source, reason) => {
298
317
  const session = state.sessions.get(source.tabId)
299
318
  if (!session) return
@@ -1512,7 +1531,21 @@ async function dispatch(op, args) {
1512
1531
  case 'tab.open': {
1513
1532
  const tab = await chrome.tabs.create({ url: String(args.url ?? 'about:blank'), active: args.active !== false })
1514
1533
  await attach(tab.id)
1515
- return { target: state.sessions.get(tab.id)?.target ?? { id: tab.id, url: tab.url, title: tab.title } }
1534
+ // A fresh tab has no title yet: wait for the load so the caller gets a
1535
+ // target it can show, instead of an empty string.
1536
+ const deadline = Date.now() + Math.min(Number(args.waitMs ?? 10000), 30000)
1537
+ let info = tab
1538
+ while (Date.now() < deadline) {
1539
+ info = await chrome.tabs.get(tab.id).catch(() => info)
1540
+ if (info.status === 'complete' && info.title) break
1541
+ await sleep(150)
1542
+ }
1543
+ const session = state.sessions.get(tab.id)
1544
+ if (session) {
1545
+ session.target = { id: info.id, url: info.url, title: info.title }
1546
+ await evt('target', { tab: session.target, tabId: tab.id })
1547
+ }
1548
+ return { target: session?.target ?? { id: tab.id, url: tab.url, title: tab.title } }
1516
1549
  }
1517
1550
  case 'tab.focus': {
1518
1551
  const session = requireSession(args.tabId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-site-bridge",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Chrome/Edge MV3 bridge for DeepSeek Harness: capture page markup (DOM, styles, selectors) and BFF traffic (xhr/fetch with headers and bodies) into a workspace snapshot bundle, drive the page with trusted CDP input, and verify injected scripts. Authorization never leaves the browser and is never written to disk.",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",