Drives an already signed-in Gemini web page over the Chrome DevTools Protocol: writes into the composer, clicks send, reads the reply back, and can post screenshots through the same page, so a DSH agent can use the web session without an API key. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:donk3major/dsh-plugins#path:/dsh-hakimi-bridge
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
把桌面浏览器里的 Gemini 网页会话接成一个本地工具:ask_hakimi。
DSH(DeepSeek Harness)里的 agent 可以直接给它发消息、把回答取回来 —— 零 API 成本,走的是你本来已经登录的那个网页。
名字里的
hakimi是原作者的私用代号,功能上等价于「对一个网页里的 AI 说话」。
它解决什么问题
浏览器网页里的 AI(Gemini / ChatGPT / Claude)没有公开 API 可用,或者你不想再付一份 API 钱。 常见做法是「复制到剪贴板 → 模拟 Ctrl+V」,但这条路很脆:
- 焦点不在输入框 → 文本粘进地址栏,Enter 直接把你正在聊的会话导航成一次搜索(实测会把标签页顶掉)
- 回答要有人手抄进剪贴板,否则程序永远读不到
- 锁屏 / 窗口最小化 / 换窗口时全部失效
本插件改成走 Chrome DevTools Protocol(--remote-debugging-port=9222):
直接定位输入框、写文本、点发送、从回答容器取文本。不碰剪贴板、不抢焦点、不需要窗口在前台。
剪贴板 + 模拟按键那条老路保留成 fallback(调试口没开时才会走到)。
特性
| 能力 | 说明 |
|---|---|
ask_hakimi 工具 |
ask 发+等 · send 只发 · poll 只收 · status 看状态 · listen 后台监听开关 |
| 后台监听(v1.3.0) | detached 进程,换窗口/换会话/DSH 重启都不影响。默认 CDP 只读尾部 6 条,空闲 10s / 最近 30s 写过 outbox 时 3s;不抢焦点。 |
/hakimi 命令 |
人在 DSH 输入框里直接发一条 |
| CDP 直连 | 定位 div.ql-editor 写文本 → 点 button[aria-label="发送"] → 从 message-content 取回答 |
| 会话头部按钮 | 「监听」开关后台监听;「Gemini」一键把网页切前台 / 带调试口重启浏览器 |
| 发图 / 截图 | 模拟人工通道:抓屏 → 激活窗口 → 点输入框 → 逐张粘贴 → 回车 → 截图自检(一次最多 8 张) |
| 施工单提取 | 回答里出现 ===TO_DSH=== … ===END_DSH=== 会当成结构化任务自动提取出来 |
快速开始
# 1) 把包放进 DSH 的插件目录
C:\Users\<user>\.dsh\plugins\dsh-hakimi-bridge\
# 2) 三处注册(profile dependencies 的 link: / dsh.profile.bundles / cordis entry),重启 DSH
# 细节见 INSTALL.md
# 3) 让 Chrome 带上调试口(一次性;之后点界面上的「Gemini」按钮即可)
powershell -ExecutionPolicy Bypass -File bin\start-gemini-cdp.ps1
# 4) 自检
node bin\hakimi.mjs status
node bin\hakimi.mjs selftest
命令行直接收发:
node bin\cdp.mjs ask "帮我看一下这段代码" 90 # 发 + 等回答
node bin\cdp.mjs read # 只读最后一条回答
node bin\cdp.mjs tabs # 列出可用的页面标签
三个前置条件
- Chrome < 136。136 起 Google 禁止
--remote-debugging-port配默认 user data dir, 届时要克隆 profile 或另开一个登录。 - 启动参数必须有
--remote-allow-origins=*,否则 WebSocket 握手被拒。 - 9222 是明文、无认证的本机端口 —— 不要对公网放行,也不要在共享机器上常开。
已知限制
- UI 选择器会变。
div.ql-editor/aria-label="发送"/message-content都是照 Gemini 某一版 Web UI 实测出来的。Gemini 改版后需要更新选择器(集中在lib/gemini-cdp.mjs,改一处即可)。 - 回答完成判定是「连续 3 次采样文本不变 + 没有 stop 按钮 + 不含『正在深入思考』」。 推理类回答会长时间只出几个字,窗口调短会截断。
- 只针对 Gemini 的 web UI 调过。ChatGPT / Claude 的页面结构不同,需要各自改选择器。
- Windows only(窗口操作、路径、PowerShell 辅助脚本)。
目录
lib/gemini-cdp.mjs CDP 客户端(零第三方依赖,Node 内置 WebSocket)
lib/cdp-bridge.mjs 探活 + 调用封装
lib/ask.mjs 编排层(CDP → 媒体 → fallback 的优先级就在这里)
lib/media.mjs 发图 / 截图(模拟人工)
bin/start-gemini-cdp.ps1 带调试口的 Chrome 启动/复用
bin/hakimi.mjs 命令行入口
client.js 会话头部两个按钮(浏览器端 React,无构建步骤)
版本与双包发布
当前版本:v1.4.0(详见 CHANGELOG.md)。
每个版本同时产出两个包,同版本号、同代码,只差配置:
| 包 | 配置 | 去向 |
|---|---|---|
| 公开包(本仓库) | config.json 通用模板(D:\gemini-bridge、https://gemini.google.com/app) |
GitHub |
| 私人包 | 本机真实通道目录 / 会话 URL / 启动器路径 | 本机存档,不发布 |
发布脚本会先做私密词扫描(本机用户名、盘符路径、QQ 号、内网 IP、token、内部代号),
命中直接拒绝出包;两边各跑一遍 node --test(22 个用例)→ 打 zip → 记 sha256 账本。
node scripts\release-plugin.mjs # 同步 + 扫描 + 测试 + 双包 + 账本
node scripts\release-plugin.mjs --push # 再加 commit + push
手工同步的老办法(
robocopy /MIR)仍然可用,但不要绕过扫描: 私人包里的config.json一旦被/MIR覆盖到公开目录,就会把本机路径推上去。
License
MIT —— 见 LICENSE。
Links
More in this category
Tencent/BrowserSkill#dsh-plugin-browserskill★ 10867
BrowserSkill bridge for controlling visible Chrome and Edge Agent Windows from DeepSeek Harness, with native browser tools, accessibility and VOM observations, screenshots, owned multi-session control, and a live Web UI overlay.
DDDMUC/dsh-free-search★ 1856
Free web search for DSH with 42 engines: 6 keyless (DuckDuckGo, Bing, SearXNG, Degoog, AnySearch), 6 key-or-keyless tiers (Exa, Tavily, Keenable, Firecrawl, Parallel, You.com), 5 HTML search pages, and keyed providers from Brave and Baidu to Zhihu, OpenAI and Claude. Failure-classified failover with cooldown and key rotation, allowlist switching, an editable fallback chain, zh/en language pools, Multi concurrent merge, 12 MCP tools and a standalone stdio server, with per-engine keys in settings.
omdsh-dev/dsh-browser#packages/browser/bridge-browser★ 1166
Chrome sidebar extension that lets DSH operate your browser directly, no vision capabilities required.
liustack/modsearch★ 1062
Web search bridge for text-only agents: ask the web or X, get structured JSON evidence (search, fetch, citations).
Fisfzy/dsh-ego-browser★ 598
Drive a real Chrome/Chromium browser from DeepSeek Harness with 35 structured tools for navigation, snapshots, clicks, forms, JavaScript/CDP, screenshots, downloads and tabs; a live sidebar mirrors the page and accepts mouse and keyboard input. It ships a managed CDP runtime, keeps login state across calls, and can import cookies from your everyday Chrome through a companion extension.
regrevia/Envoy#dsh-envoy★ 315
Distill any link into Markdown, a wiki or a knowledge base. Installs per host: DSH -> envoy-dsh; Claude Code/Codex -> envoy@envoy. Douyin/Bilibili video, image posts, WeChat, Xiaohongshu, PDFs, podcasts. Video is read on its own timeline with keyframes and ASR transcripts locatable to \[mm:ss], so the context carries what was said and shown instead of the title and the recommendation rail. On 60 turns with vs without: ends normally with the gaps named 22% -> 92%, times out 68% -> 0% (the A/B is exploratory: different time caps, no human correctness review). On 123 live links 80% came back usable (93% of the pages that answered).
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.