dsh-site-bridge 0.6.0 → 0.6.2

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.0",
5
+ "version": "0.6.2",
6
6
  "description": "__MSG_appDesc__",
7
7
  "minimum_chrome_version": "116",
8
8
  "permissions": [
@@ -104,10 +104,10 @@
104
104
  .tab-item {
105
105
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
106
106
  padding: 6px 8px; background: #15181e; border: 1px solid var(--line);
107
- border-radius: 7px; cursor: pointer; min-height: 44px;
107
+ border-radius: 7px; min-height: 44px;
108
108
  }
109
- .tab-item:hover { border-color: #3a4150; }
110
- .tab-item.active { border-color: var(--accent); background: #1a1f2c; }
109
+ .tab-meta { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10.5px; flex: none; }
110
+ .tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
111
111
  .tab-item-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
112
112
  .tab-item-title { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
113
113
  .tab-item-url { color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -95,7 +95,6 @@ function render(status) {
95
95
  // One block per attached tab: title, address and its own detach cross. The
96
96
  // list scrolls after three blocks so the popup keeps its height.
97
97
  const targets = Array.isArray(status.targets) ? status.targets : []
98
- const activeId = status.activeTabId ?? status.target?.id ?? null
99
98
  target.classList.toggle('empty', targets.length === 0)
100
99
  target.hidden = targets.length > 0
101
100
 
@@ -104,7 +103,7 @@ function render(status) {
104
103
  list.textContent = ''
105
104
  for (const item of targets) {
106
105
  const row = document.createElement('div')
107
- row.className = item.id === activeId ? 'tab-item active' : 'tab-item'
106
+ row.className = 'tab-item'
108
107
  row.dataset.id = String(item.id)
109
108
  row.title = item.url || ''
110
109
 
@@ -124,7 +123,16 @@ function render(status) {
124
123
  remove.title = t('disconnectTab')
125
124
  remove.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 2 L10 10 M10 2 L2 10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
126
125
 
127
- row.append(body, remove)
126
+ // Every tab carries its own numbers: nothing here is "the" tab.
127
+ const meta = document.createElement('span')
128
+ meta.className = 'tab-meta'
129
+ if (item.recording) {
130
+ const dot = document.createElement('i')
131
+ dot.className = 'tab-dot'
132
+ meta.append(dot)
133
+ }
134
+ meta.append(document.createTextNode(String(item.captured ?? 0)))
135
+ row.append(body, meta, remove)
128
136
  list.append(row)
129
137
  }
130
138
 
@@ -293,10 +301,6 @@ $('tabs-list').addEventListener('click', async (event) => {
293
301
  await refresh()
294
302
  return
295
303
  }
296
- const row = event.target.closest('.tab-item')
297
- if (!row || row.classList.contains('active')) return
298
- await send({ type: 'use', tabId: Number(row.dataset.id) })
299
- await refresh()
300
304
  })
301
305
 
302
306
  $('pick').addEventListener('click', async () => {
package/extension/sw.js CHANGED
@@ -193,8 +193,10 @@ async function handleMessageInner(message) {
193
193
  recording: session.recording,
194
194
  captured: session.entries.length
195
195
  })),
196
- recording: active?.recording ?? false,
197
- captured: active?.entries.length ?? 0,
196
+ // Aggregates: the popup shows every attached tab, so "capture on" means
197
+ // "at least one is recording" and the counter is the sum.
198
+ recording: [...state.sessions.values()].some((session) => session.recording),
199
+ captured: [...state.sessions.values()].reduce((sum, session) => sum + session.entries.length, 0),
198
200
  picking: active?.picking === true,
199
201
  picks: active?.picks?.length ?? 0
200
202
  }
@@ -216,8 +218,13 @@ async function handleMessageInner(message) {
216
218
  return { ok: true }
217
219
  }
218
220
  if (message?.type === 'toggle-capture') {
221
+ const on = message.on === true
222
+ if (message.tabId == null || message.tabId === '') {
223
+ for (const session of state.sessions.values()) await setRecording(session, on)
224
+ return { ok: true, recording: on, tabs: state.sessions.size }
225
+ }
219
226
  const session = requireSession(message.tabId)
220
- return { ok: true, recording: await setRecording(session, message.on === true) }
227
+ return { ok: true, recording: await setRecording(session, on) }
221
228
  }
222
229
  return { ok: false, error: `unknown message ${message?.type}` }
223
230
  }
@@ -1495,6 +1502,13 @@ async function dispatch(op, args) {
1495
1502
  const active = activeSession()
1496
1503
  return { target: active?.target ?? null, attached: state.activeTabId, tabs: [...state.sessions.keys()] }
1497
1504
  }
1505
+ case 'tab.close': {
1506
+ const id = Number(args.tabId ?? state.activeTabId)
1507
+ if (!Number.isFinite(id)) throw new Error('нечего закрывать: передайте tabId')
1508
+ await detach(id).catch(() => {})
1509
+ await chrome.tabs.remove(id)
1510
+ return { closed: id }
1511
+ }
1498
1512
  case 'tab.open': {
1499
1513
  const tab = await chrome.tabs.create({ url: String(args.url ?? 'about:blank'), active: args.active !== false })
1500
1514
  await attach(tab.id)
package/lib/index.js CHANGED
@@ -261,7 +261,7 @@ export function apply(ctx, config) {
261
261
  'claim добавляет ещё одну, use переключает активную, release отключает, open открывает новую и сразу ' +
262
262
  'подключает её, focus выводит вкладку на передний план. Вкладка должна быть http(s) или file://.',
263
263
  {
264
- action: { type: 'string', description: 'list | claim | use | release | open | focus' },
264
+ action: { type: 'string', description: 'list | claim | use | release | open | close | focus' },
265
265
  tabId: { type: 'number', description: 'id вкладки для claim / use / release / focus (из action=list)' },
266
266
  url: { type: 'string', description: 'адрес для action=open (по умолчанию about:blank)' }
267
267
  },
@@ -277,6 +277,12 @@ export function apply(ctx, config) {
277
277
  const target = result?.target ?? null
278
278
  return ok(`Открыта и подключена вкладка: ${target?.title || ''} — ${target?.url || ''}`, { target })
279
279
  }
280
+ if (action === 'close') {
281
+ const tabId = Number(args.tabId ?? instance.state().activeTabId)
282
+ if (!Number.isFinite(tabId)) throw new Error('нечего закрывать: передайте tabId')
283
+ await instance.enqueue('tab.close', { tabId }, { timeout: 20000 })
284
+ return ok(`Вкладка ${tabId} закрыта.`, { tabId })
285
+ }
280
286
  if (action === 'focus') {
281
287
  const tabId = Number(args.tabId ?? instance.state().activeTabId)
282
288
  if (!Number.isFinite(tabId)) throw new Error('нечего выводить на передний план: нет подключённой вкладки')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-site-bridge",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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",