dsh-site-bridge 0.5.0 → 0.5.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.5.0",
5
+ "version": "0.5.2",
6
6
  "description": "__MSG_appDesc__",
7
7
  "minimum_chrome_version": "116",
8
8
  "permissions": [
@@ -101,7 +101,8 @@ function render(status) {
101
101
  const targets = Array.isArray(status.targets) ? status.targets : []
102
102
  const tabsRow = $('tabs-row')
103
103
  const tabsSelect = $('tabs-select')
104
- $('claim-more').hidden = !hasTarget
104
+ const selfAttached = selfTabId != null && targets.some((item) => item.id === selfTabId)
105
+ $('claim-more').hidden = !hasTarget || selfAttached
105
106
  if (targets.length > 1) {
106
107
  tabsRow.hidden = false
107
108
  tabsSelect.textContent = ''
@@ -146,8 +147,16 @@ function render(status) {
146
147
  }
147
148
  }
148
149
 
150
+ // Which tab this popup is open on: attaching that tab again is a no-op, so the
151
+ // attach button is only offered when the current tab is not attached yet.
152
+ let selfTabId = null
153
+
149
154
  async function refresh() {
150
155
  try {
156
+ if (chrome.tabs?.query) {
157
+ const [tab] = await chrome.tabs.query({ active: true, currentWindow: true })
158
+ selfTabId = tab?.id ?? null
159
+ }
151
160
  render(await send({ type: 'status' }))
152
161
  } catch {
153
162
  render(null)
package/icon.svg ADDED
@@ -0,0 +1,27 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="128" height="128" role="img" aria-label="DSH Site Bridge">
2
+ <defs>
3
+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0" stop-color="#5b7cff"/>
5
+ <stop offset="1" stop-color="#2a45e0"/>
6
+ </linearGradient>
7
+ <linearGradient id="ink" x1="0" y1="0" x2="0" y2="1">
8
+ <stop offset="0" stop-color="#3f5cf0"/>
9
+ <stop offset="1" stop-color="#2a3fd6"/>
10
+ </linearGradient>
11
+ </defs>
12
+
13
+ <rect width="128" height="128" rx="26" fill="url(#bg)"/>
14
+
15
+ <!-- optical size: inverted tile keeps contrast at 16px -->
16
+ <rect x="13" y="15" width="102" height="98" rx="20" fill="#ffffff"/>
17
+
18
+ <!-- the browser bar, so the tile reads as a page and not a card -->
19
+ <line x1="13" y1="41" x2="115" y2="41" stroke="url(#ink)" stroke-width="7"/>
20
+ <circle cx="27" cy="28" r="3.4" fill="url(#ink)"/>
21
+ <circle cx="39" cy="28" r="3.4" fill="url(#ink)" opacity="0.65"/>
22
+
23
+ <!-- whale cut out of the page -->
24
+ <path d="M72 60 L 96 43 L 88 65 L 96 87 L 70 76 Z" fill="url(#ink)"/>
25
+ <path d="M24 86 C 24 67, 42 53, 63 55 C 82 57, 91 68, 90 80 C 89 94, 72 101, 53 97 C 37 94, 24 93, 24 86 Z"
26
+ fill="url(#ink)"/>
27
+ </svg>
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "dsh-site-bridge",
3
- "version": "0.5.0",
3
+ "version": "0.5.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
+ "icon": "./icon.svg",
5
6
  "type": "module",
6
7
  "main": "./lib/index.js",
7
8
  "exports": {
@@ -15,7 +16,8 @@
15
16
  "docs",
16
17
  "scripts",
17
18
  "tools",
18
- "cordis.patch.yml"
19
+ "cordis.patch.yml",
20
+ "icon.svg"
19
21
  ],
20
22
  "keywords": [
21
23
  "deepseek-harness",
@@ -40,7 +42,7 @@
40
42
  "version:check": "node tools/version.mjs check",
41
43
  "version:bump": "node tools/version.mjs bump",
42
44
  "stage": "powershell -NoProfile -ExecutionPolicy Bypass -File scripts/install.ps1 -StageOnly",
43
- "test:picker": "node test/picker.mjs",
45
+ "test:picker": "node test/picker.mjs",
44
46
  "test:ops": "node test/browser-ops.mjs"
45
47
  },
46
48
  "dsh": {
@@ -22,7 +22,7 @@ const sleep = (ms) => new Promise((done) => setTimeout(done, ms))
22
22
 
23
23
  const statuses = {
24
24
  'connected-one': {
25
- ok: true, configured: true, connected: true, port: 47321, recording: false, captured: 0,
25
+ ok: true, configured: true, connected: true, port: 47321, recording: false, captured: 0, selfTabId: 1,
26
26
  activeTabId: 1,
27
27
  target: { id: 1, title: 'Example Store — Products', url: 'https://shop.example/products' },
28
28
  targets: [
@@ -30,7 +30,7 @@ const statuses = {
30
30
  ]
31
31
  },
32
32
  connected: {
33
- ok: true, configured: true, connected: true, port: 47321, recording: true, captured: 12,
33
+ ok: true, configured: true, connected: true, port: 47321, recording: true, captured: 12, selfTabId: 3,
34
34
  activeTabId: 1,
35
35
  target: { id: 1, title: 'Ozon: Торговая площадка', url: 'https://seller.ozon.ru/app/products' },
36
36
  targets: [
@@ -59,6 +59,7 @@ const stub = `
59
59
  window.chrome = {
60
60
  runtime: { sendMessage: async (m) => (m.type === 'status' ? ${JSON.stringify(statuses[state] ?? statuses.connected)} : { ok: true }) },
61
61
  storage: { local: { get: async () => ({ port: 47321, token: 'GWCIveb--rxL_wKChN9Wl-OJmXFGTK4' }), set: async () => {} } },
62
+ tabs: { query: async () => [{ id: ${JSON.stringify(statuses[state]?.selfTabId ?? 1)} }] },
62
63
  i18n: {
63
64
  getUILanguage: () => ${JSON.stringify(locale.replace('_', '-'))},
64
65
  getMessage: (key, subs) => {