diff --git a/.github/workflows/release-dsh-plugin.yml b/.github/workflows/release-dsh-plugin.yml new file mode 100644 index 0000000..69ae0bd --- /dev/null +++ b/.github/workflows/release-dsh-plugin.yml @@ -0,0 +1,105 @@ +name: Release dsh plugin + +on: + push: + tags: + - dsh-plugin-v* + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: release-dsh-plugin-${{ github.ref }} + cancel-in-progress: false + +env: + PACKAGE_NAME: "@wxg-prc-cpg/browser-skill-dsh-plugin" + PACKAGE_DIR: packages/dsh-plugin-browserskill + +jobs: + resolve: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + tag: ${{ steps.version.outputs.tag }} + steps: + - uses: actions/checkout@v6 + + - name: Resolve plugin version + id: version + shell: bash + run: | + set -euo pipefail + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + VERSION="$(node -p "require('./${{ env.PACKAGE_DIR }}/package.json').version")" + else + VERSION="${GITHUB_REF_NAME#dsh-plugin-v}" + fi + VERSION="${VERSION#v}" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "tag=dsh-plugin-v${VERSION}" >> "$GITHUB_OUTPUT" + + guard: + needs: resolve + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Verify tag matches package.json name and version + shell: bash + run: | + set -euo pipefail + PKG_NAME="$(node -p "require('./${{ env.PACKAGE_DIR }}/package.json').name")" + PKG_VERSION="$(node -p "require('./${{ env.PACKAGE_DIR }}/package.json').version")" + RELEASE_VERSION="${{ needs.resolve.outputs.version }}" + if [ "$PKG_NAME" != "$PACKAGE_NAME" ]; then + echo "package.json name (${PKG_NAME}) does not match expected ${PACKAGE_NAME}" + exit 1 + fi + if [ "$PKG_VERSION" != "$RELEASE_VERSION" ]; then + echo "${PACKAGE_DIR}/package.json version (${PKG_VERSION}) does not match release version (${RELEASE_VERSION})" + exit 1 + fi + echo "Version guard passed: ${PKG_NAME}@${RELEASE_VERSION}" + + publish: + needs: [resolve, guard] + runs-on: ubuntu-latest + # Secret NPM_TOKEN is stored on the GitHub Environment also named NPM_TOKEN. + environment: NPM_TOKEN + permissions: + contents: read + steps: + - uses: actions/checkout@v6 + + - uses: pnpm/action-setup@v6 + + - uses: actions/setup-node@v6 + with: + node-version: 22 + cache: pnpm + registry-url: https://registry.npmjs.org + scope: "@wxg-prc-cpg" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck plugin + run: pnpm --filter "${{ env.PACKAGE_NAME }}" typecheck + + - name: Test plugin + run: pnpm --filter "${{ env.PACKAGE_NAME }}" test + + - name: Publish to npm + working-directory: ${{ env.PACKAGE_DIR }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + set -euo pipefail + if [ -z "${NODE_AUTH_TOKEN:-}" ]; then + echo "::error::Environment secret NPM_TOKEN is not configured" + exit 1 + fi + pnpm publish --access public --no-git-checks + echo "Published ${PACKAGE_NAME}@${{ needs.resolve.outputs.version }}" diff --git a/.stylelintignore b/.stylelintignore index adfcf64..b96eb12 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -3,3 +3,6 @@ **/.output/** **/target/** **/node_modules/** +# Generated client CSS (tailwind compile output); built by +# packages/dsh-plugin-browserskill/scripts/build-client-css.mjs. +**/dsh-plugin-browserskill/src/client/bsk-ui.nomodule.css diff --git a/README.md b/README.md index 6b91ae6..16d755b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@
**BrowserSkill** connects Cursor, Claude Code, Codex, OpenClaw, CodeBuddy, -WorkBuddy, Pi, Hermes Agent, and other shell-capable AI agents to your already logged-in +WorkBuddy, Pi, Hermes Agent, DeepSeek Harness, and other AI agents to your already logged-in browser. Need the agent to touch a tab you already have open? It must borrow that tab @@ -123,7 +123,8 @@ internal variants and install paths. Other shell-capable agent harnesses are supported too. Copy [`skill/SKILL.md`](skill/SKILL.md) into your harness's skills directory as -`browser-skill/SKILL.md` to install the skill manually. +`browser-skill/SKILL.md` to install the skill manually. DeepSeek Harness uses a +dedicated plugin instead — see [DeepSeek Harness plugin](#deepseek-harness-plugin). @@ -133,6 +134,16 @@ Start a new Agent session and write a prompt that needs the browser, for example /browser-skill open example.com and summarize what is on the page. ``` +## DeepSeek Harness plugin + +A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) plugin that +injects native `browser_*` tools (no shelling out to `bsk`) and a live Web UI +overlay of each Agent Window. + +```sh +dsh plugin --profile web add @wxg-prc-cpg/browser-skill-dsh-plugin +``` + ## How It Works BrowserSkill is a local bridge between your agent harness and your browser. @@ -166,7 +177,9 @@ flowchart TB The agent never talks to the browser directly. It asks the `bsk` CLI to perform a browser task; the local daemon routes that request to the extension; the -extension runs it in an Agent Window. +extension runs it in an Agent Window. DeepSeek Harness takes the same path +through the [plugin](#deepseek-harness-plugin): the agent calls injected +`browser_*` tools, and the plugin invokes `bsk` on its behalf. ## For Developers @@ -176,6 +189,7 @@ The repository is a Cargo + pnpm workspace: - `crates/bsk-protocol` — shared wire types and JSON schemas - `apps/extension` — browser extension - `packages/ui` and `packages/i18n` — shared extension UI support +- `packages/dsh-plugin-browserskill` — DeepSeek Harness plugin (`@wxg-prc-cpg/browser-skill-dsh-plugin`) ## License diff --git a/README.zh-CN.md b/README.zh-CN.md index 7c0c5d4..0ca6f81 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -12,7 +12,7 @@ English · 中文 -**BrowserSkill** 把 Cursor、Claude Code、Codex、OpenClaw、CodeBuddy、WorkBuddy、Pi、Hermes Agent 等支持 Shell 的 AI Agent 连接到你已登录的浏览器。 +**BrowserSkill** 把 Cursor、Claude Code、Codex、OpenClaw、CodeBuddy、WorkBuddy、Pi、Hermes Agent、DeepSeek Harness 等 AI Agent 连接到你已登录的浏览器。 需要 Agent 操作你已打开的标签页?必须显式借用该标签,任务结束后归还,其余浏览器窗口不受影响。 @@ -102,7 +102,7 @@ bsk install-skill 用 Space 选择需要安装的 Agent harness,然后按 Enter 安装 skill。运行 `bsk install-skill --list` 可查看 internal 变体及安装路径。 -其他支持 Shell 的 Agent harness 也可使用 BrowserSkill,但需手动将 [`skill/SKILL.md`](skill/SKILL.md) 复制到对应 skills 目录下的 `browser-skill/SKILL.md`。 +其他支持 Shell 的 Agent harness 也可使用 BrowserSkill,但需手动将 [`skill/SKILL.md`](skill/SKILL.md) 复制到对应 skills 目录下的 `browser-skill/SKILL.md`。DeepSeek Harness 走独立插件,见 [DeepSeek Harness 插件](#deepseek-harness-插件)。 @@ -112,6 +112,14 @@ bsk install-skill /browser-skill open example.com and summarize what is on the page. ``` +## DeepSeek Harness 插件 + +[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 插件:注入原生 `browser_*` 工具(无需再通过 Shell 调用 `bsk`),并在 Web UI 中实时观察每个 Agent Window。 + +```sh +dsh plugin --profile web add @wxg-prc-cpg/browser-skill-dsh-plugin +``` + ## 工作原理 BrowserSkill 是 Agent 运行时与浏览器之间的本地桥接层。 @@ -143,7 +151,7 @@ flowchart TB style UserWindows fill:#f8fafc,stroke:#cbd5e1,color:#334155 ``` -Agent 不直接与浏览器通信。它通过 `bsk` CLI 下发浏览器任务;本地 daemon 把请求路由到扩展;扩展在 Agent Window 中执行。 +Agent 不直接与浏览器通信。它通过 `bsk` CLI 下发浏览器任务;本地 daemon 把请求路由到扩展;扩展在 Agent Window 中执行。DeepSeek Harness 走同一条链路,只是经由 [插件](#deepseek-harness-插件):Agent 调用注入的 `browser_*` 工具,由插件代为执行 `bsk`。 ## 面向开发者 @@ -153,6 +161,7 @@ Agent 不直接与浏览器通信。它通过 `bsk` CLI 下发浏览器任务; - `crates/bsk-protocol` — 共享协议类型与 JSON Schema - `apps/extension` — 浏览器扩展 - `packages/ui` 和 `packages/i18n` — 扩展 UI 共享支持 +- `packages/dsh-plugin-browserskill` — DeepSeek Harness 插件(`@wxg-prc-cpg/browser-skill-dsh-plugin`) ## 许可证 diff --git a/biome.json b/biome.json index f8e3994..50401a9 100644 --- a/biome.json +++ b/biome.json @@ -39,6 +39,11 @@ "**", "!**/node_modules/**", "!**/dist/**", + "!packages/dsh-plugin-browserskill/lib/**", + "!packages/dsh-plugin-browserskill/src/skill-content.generated.ts", + "!packages/dsh-plugin-browserskill/src/client/bsk-ui.nomodule.css", + "!packages/dsh-plugin-browserskill/.bsk-ui.raw.css", + "!packages/dsh-plugin-browserskill/.bsk-ui.input.css", "!**/target/**", "!**/.wxt/**", "!**/.output/**", diff --git a/package.json b/package.json index 9c72f35..214c278 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "ext:dev": "pnpm --filter @browser-skill/extension dev", "ext:test": "pnpm --filter @browser-skill/extension test", "vom:test": "pnpm --filter @browser-skill/vom test", - "lint": "biome check . && stylelint \"**/*.css\"", + "lint": "biome check . && stylelint \"**/*.css\" && pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin typecheck && pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin test", "format": "biome format --write ." }, "devDependencies": { diff --git a/packages/dsh-plugin-browserskill/.gitignore b/packages/dsh-plugin-browserskill/.gitignore new file mode 100644 index 0000000..e1e2da4 --- /dev/null +++ b/packages/dsh-plugin-browserskill/.gitignore @@ -0,0 +1,5 @@ +lib/ +src/client/bsk-ui.nomodule.css +.bsk-ui.input.css +.bsk-ui.raw.css +src/skill-content.generated.ts diff --git a/packages/dsh-plugin-browserskill/LICENSE b/packages/dsh-plugin-browserskill/LICENSE new file mode 100644 index 0000000..0d72eb2 --- /dev/null +++ b/packages/dsh-plugin-browserskill/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Tencent + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/dsh-plugin-browserskill/README.md b/packages/dsh-plugin-browserskill/README.md new file mode 100644 index 0000000..592bdad --- /dev/null +++ b/packages/dsh-plugin-browserskill/README.md @@ -0,0 +1,194 @@ +# dsh-plugin-browserskill + +npm: [`@wxg-prc-cpg/browser-skill-dsh-plugin`](https://www.npmjs.com/package/@wxg-prc-cpg/browser-skill-dsh-plugin) + +A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) tool plugin that exposes +[BrowserSkill](https://github.com/Tencent/BrowserSkill) (`bsk`) browser automation to the model. + +Each tool maps to one `bsk