dsh-chrome-use 0.1.11 → 0.1.12

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.
package/README.md CHANGED
@@ -2,13 +2,41 @@
2
2
 
3
3
  让 DeepSeek Harness 读取、操作和调试本机 Google Chrome。
4
4
 
5
- **安装**:[在 Chrome 应用商店安装扩展](https://chromewebstore.google.com/detail/anobmlnjdeahldefeikjdmmnckphpdhc),再在 Harness 添加本插件,最后在扩展弹窗输入配对码。
6
-
7
5
  ## 安装
8
6
 
9
- 1. **Chrome 扩展**:打开 [Chrome 应用商店](https://chromewebstore.google.com/detail/anobmlnjdeahldefeikjdmmnckphpdhc),点击“添加至 Chrome”。以后扩展由 Chrome 自动更新,不用下载文件,也不用手动加载文件夹。
10
- 2. **Harness 插件**:下载或克隆本仓库,在 Harness 的插件管理里添加仓库的本地绝对路径。命令行版在仓库根目录运行 `dsh plugin --profile headless add "$PWD"`;平时用哪个 profile,就装到哪个 profile。
11
- 3. **连接**:在 Harness 设置 → dsh-chrome-use 点击“生成配对码”,再到 Chrome 工具栏打开 dsh-chrome-use 扩展,输入 8 位配对码并点击“连接”。也可以在对话里说:“请用 chrome_pair 连接浏览器。”
7
+ > **先装 Harness 插件,再装 Chrome 扩展,最后配对。** 插件有三种装法,选一种,命令直接复制。
8
+
9
+ ### 1. 安装 Harness 插件
10
+
11
+ **npm(推荐)**
12
+
13
+ ```sh
14
+ dsh plugin --profile desktop add dsh-chrome-use
15
+ ```
16
+
17
+ **GitHub 仓库**
18
+
19
+ ```sh
20
+ dsh plugin --profile desktop add github:tao1020/dsh-chrome-use
21
+ ```
22
+
23
+ **让 Agent 安装**:把下面这句话发给你正在用的 Agent:
24
+
25
+ ```text
26
+ 请安装 DSH 插件 dsh-chrome-use,仓库是 https://github.com/tao1020/dsh-chrome-use
27
+ ```
28
+
29
+ > 命令里的 `desktop` 是桌面版的默认 profile;如果你用别的 profile,把它换成你的名字(例如 `web`)。桌面版也可以直接在「设置 → 插件」里安装,不用命令行。
30
+
31
+ ### 2. 安装 Chrome 扩展
32
+
33
+ 扩展在 Chrome 应用商店。点下面的链接,再点“添加至 Chrome”:
34
+
35
+ **https://chromewebstore.google.com/detail/anobmlnjdeahldefeikjdmmnckphpdhc**
36
+
37
+ ### 3. 配对连接
38
+
39
+ 在 Harness 设置 → dsh-chrome-use 点“生成配对码”;在 Chrome 工具栏打开 dsh-chrome-use 扩展,输入 8 位配对码,点“连接”。也可以在对话里说:“请用 chrome_pair 连接浏览器。”
12
40
 
13
41
  需要 Google Chrome 120 或更新版本、DeepSeek Harness 0.2.1-rc.2 或更新版本。开发和测试使用 Node.js 22 或 24。
14
42
 
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 3,
3
3
  "name": "dsh-chrome-use",
4
4
  "description": "Let DeepSeek Harness read, control and debug your Google Chrome tabs after pairing.",
5
- "version": "0.1.11",
5
+ "version": "0.1.12",
6
6
  "minimum_chrome_version": "120",
7
7
  "permissions": [
8
8
  "debugger",
@@ -0,0 +1,13 @@
1
+ // Visibility of the popup's pairing controls for each connection state.
2
+ // Kept separate from the DOM code so the three states are testable.
3
+ export function popupState({ connected, paired }) {
4
+ const pairedOnly = Boolean(paired) && !connected;
5
+ return {
6
+ formHidden: Boolean(connected),
7
+ labelHidden: pairedOnly,
8
+ codeHidden: pairedOnly,
9
+ permissionHidden: pairedOnly,
10
+ helpHidden: pairedOnly,
11
+ pairedHintHidden: !pairedOnly,
12
+ };
13
+ }
@@ -11,9 +11,10 @@
11
11
  <p id="status" role="status">正在检查连接…</p>
12
12
  <form id="pair-form">
13
13
  <label for="code" id="pair-label">首次连接:输入 Harness 给出的配对码</label>
14
- <p class="help permission">连接后,Harness 可以读取和操作此 Chrome 中的所有普通网页,包括已经登录的网站。网页内容、截图和调试信息可能发送给你配置的模型服务。</p>
14
+ <p class="help" id="paired-hint" hidden>已保存配对,点下面的“连接”即可。</p>
15
+ <p class="help permission" id="permission-help">连接后,Harness 可以读取和操作此 Chrome 中的所有普通网页,包括已经登录的网站。网页内容、截图和调试信息可能发送给你配置的模型服务。</p>
15
16
  <div class="pair-row"><input id="code" inputmode="numeric" autocomplete="off" maxlength="8" placeholder="8 位配对码"><button type="submit">连接</button></div>
16
- <p class="help">只需首次配对,成功后自动重连。临时码 2 分钟内有效,已保存的配对不会定时过期。</p>
17
+ <p class="help" id="pair-help">只需首次配对,成功后自动重连。临时码 2 分钟内有效,已保存的配对不会定时过期。</p>
17
18
  </form>
18
19
  <section>
19
20
  <p class="help">连接后,AI 自动选择网页,无需逐页授权。点击“断开连接”可以停止全部操作。</p>
@@ -1,3 +1,5 @@
1
+ import { popupState } from './popup-state.js';
2
+
1
3
  const $ = id => document.getElementById(id);
2
4
  async function act(action, extra = {}) {
3
5
  $('error').textContent = '';
@@ -5,10 +7,14 @@ async function act(action, extra = {}) {
5
7
  const result = await chrome.runtime.sendMessage({ action, ...extra });
6
8
  if (!result?.ok) throw new Error(result?.error ?? '扩展没有响应,请重新打开。');
7
9
  $('status').textContent = result.connected ? '已连接到本机 Harness' : result.reconnecting ? '已配对,正在等待本机 Harness' : result.paired ? '已配对,点击连接即可' : '尚未配对';
8
- $('pair-label').textContent = result.paired ? '已保存配对:留空即可连接' : '首次连接:输入 Harness 给出的配对码';
9
- $('code').placeholder = result.paired ? '无需再次输入配对码' : '8 位配对码';
10
10
  $('status').classList.toggle('connected', result.connected);
11
- $('pair-form').hidden = result.connected;
11
+ const show = popupState(result);
12
+ $('pair-form').hidden = show.formHidden;
13
+ $('pair-label').hidden = show.labelHidden;
14
+ $('code').hidden = show.codeHidden;
15
+ $('permission-help').hidden = show.permissionHidden;
16
+ $('pair-help').hidden = show.helpHidden;
17
+ $('paired-hint').hidden = show.pairedHintHidden;
12
18
  $('tabs').replaceChildren();
13
19
  for (const tab of result.tabs.length ? result.tabs : [{ title: '当前没有调试中的标签页' }]) {
14
20
  const li = document.createElement('li');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-chrome-use",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Control Google Chrome tabs from DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/client.js CHANGED
@@ -58,7 +58,7 @@ async function checkRelease(current, fetcher = fetch) {
58
58
  } finally { clearTimeout(timer); }
59
59
  }
60
60
 
61
- const packageVersion = "0.1.11";
61
+ const packageVersion = "0.1.12";
62
62
  // Wrapped by scripts/build-client.mjs for the Harness browser module loader.
63
63
  const React = require('react');
64
64
  const { createElement: h, useState, useEffect, useRef } = React;