dsh-site-bridge 0.6.1 → 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.1",
5
+ "version": "0.6.2",
6
6
  "description": "__MSG_appDesc__",
7
7
  "minimum_chrome_version": "116",
8
8
  "permissions": [
package/extension/sw.js CHANGED
@@ -1502,6 +1502,13 @@ async function dispatch(op, args) {
1502
1502
  const active = activeSession()
1503
1503
  return { target: active?.target ?? null, attached: state.activeTabId, tabs: [...state.sessions.keys()] }
1504
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
+ }
1505
1512
  case 'tab.open': {
1506
1513
  const tab = await chrome.tabs.create({ url: String(args.url ?? 'about:blank'), active: args.active !== false })
1507
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.1",
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",