dsh-moli
Drives a locally installed Moli headless browser from DeepSeek Harness: rendered fetch, JavaScript evaluation, Markdown, semantic trees, screenshots and PDFs. A CSS selector returns one container rather than the whole page (measured 40-80x fewer tokens on listing pages) and scroll triggers lazy load
Install
dsh plugin --profile web add dsh-moli
Sandbox test results
| Stage | Result |
|---|---|
| 1 install | ✓ |
| 2 list | ✓ |
| 3 mount | ✓ |
| 4 boot | — |
Four stages run in an isolated sandbox: install (network on) → list → mount → boot (last three with no network).
README
dsh-moli



两个工具,让 DeepSeek Harness 的 agent 能驱动真正的无头浏览器。 它们封装
Moli——一个专为 AI agent 打造的 Rust 无头浏览器——所以 agent 能看到
那些"必须跑完 JavaScript 才存在"的页面内容,也能把它们拍成图。
[English](README.md) | 中文
它做什么,什么时候需要它
普通的 HTTP 抓取拿回的是服务器发来的 HTML。对文章、文档、API 来说这足够了,DSH 的 web_fetch 已经覆盖
这种场景。但它拿不到任何需要浏览器构建出来的内容:
- 单页应用(SPA)——客户端渲染的新闻站、仪表盘、文档站。响应只是一个空壳,内容要等脚本跑完才出现。
- 登录与同意墙——必须先有会话或 cookie 才肯显示内容的页面。
- 图——想看一眼页面长什么样(截图),或想存档(PDF)。
- 页面深处的一个值——价格、计数、标题,用选择器直接取,而不是把整篇文档拉回来。
- 只用 7% 的篇幅读完一个列表——
selector只返回匹配到的容器,实测在一个真实信息流上是 **1,779 字符,
而同一页面走 markdown 是 139,338**。如果你正准备抓一个列表页再自己筛,先看 Usage 里的 selector 一节。
针对这些场景,本插件给 agent 两个工具:
工具 · 作用
moli_fetch · 渲染 URL 并返回 Markdown / HTML / 语义树 / 带 HTTP 状态的 JSON;用 selector 只取一个容器;执行 JS 表达式取值;写出 PNG 截图或 PDF
moli_probe · 报告引擎是否安装、什么版本、HTTPS 是否可用;没装时还能替你装上
判断标准很简单:agent 需要的是"浏览器眼里的页面"吗? 如果普通抓取已经能拿到你要的文字,web_fetch
更轻更快。
agent ──moli_fetch──▶ dsh-moli 插件 ──启动──▶ moli.exe
▲ │
│ 渲染页面、
│ 执行其中 JavaScript
│ │
└──markdown / json / png / pdf◀┘
安装
两条路,装的是同一个插件,按你的网络情况选。
路线 1 —— 从 npm 装(推荐)。 经 npm registry 解析,所以在 GitHub 慢或不通的网络里照样能装,DSH 的
安装对话框还能回退到国内镜像:
dsh plugin --profile web add dsh-moli
路线 2 —— 直接从仓库装。 直接跟踪源码,需要 GitHub 可达:
dsh plugin --profile web add github:27painter/dsh-moli
[!IMPORTANT]
npm 包只有插件,不含 Moli 引擎。
npm tarball 是 26 kB:八个 JavaScript 与文本文件。moli.exe 是另外的东西——约 101 MB 的 Rust 编译
产物,由 Moli 项目按自己的节奏构建和发布。
为什么不能打包进来:
- 体积。 引擎约为插件的 4,000 倍。每次安装、每次插件更新都要顺带搬运一个浏览器。
- 归属。 Moli 是 lexmount/moli,版权属于它自己的 MIT 署名。把它家的二进制经由本包再分发,等于
把别人的产物当自己的发布。
- 平台。 引擎按操作系统与架构分别发布——Windows/Linux/macOS × x64/arm64。打包进来等于把某一个
构建方式钉死给所有用户。
- 版本。 插件要能配合用户手上任意 Moli 版本工作,包括插件发布之后才出现的 Moli 新版本。
打包会把两者的版本绑死。
引擎同样没有 npm 包。 registry 上的moli和moli-cli属于无关项目,@lexmount/moli并不
存在。Moli 以预编译二进制形式发布在
GitHub Releases——不要靠猜包名去装引擎。
装好之后的两种情形
上面两条下载路线装的是同一个东西。区别在于你的机器上有没有 Moli——这决定你是就此完事,还是还差一步。
情形 A —— 已经装了 Moli:不用再做别的
插件自己会找到 moli.exe,两个工具立即可用。重启 DSH 然后确认:
moli_probe
如果报出来的版本正常,就结束了。
情形 B —— 还没装 Moli:把引擎也拉下来
在你装上引擎之前,moli_fetch 会一直报"引擎缺失"。用下面任一种装上:
moli_probe action=install # 让插件替你拉
# 或者自己跑 Moli 官方的安装器 powershell -ExecutionPolicy ByPass -c "irm https://github.com/lexmount/moli/releases/latest/download/moli-installer.ps1 | iex"
然后用 moli_probe 确认并抓一个页面:
moli_probe moli_fetch url=https://example.com dump=markdown
获取 Moli 引擎
moli_probe 会报告引擎是否在场。如果不在,三种方式任选:
1. 让插件替你装——多路径下载,并报告实际执行字节的 SHA256。整个过程异步(主机照常服务),配置的
proxy 会同时传给下载路由与安装器内部的引擎下载:
moli_probe action=install
2. 官方一行安装(Moli 自己的文档命令):
# Windows powershell -ExecutionPolicy ByPass -c "irm https://github.com/lexmount/moli/releases/latest/download/moli-installer.ps1 | iex"
# Linux / macOS curl --proto '=https' --tlsv1.2 -fsSL https://github.com/lexmount/moli/releases/latest/download/moli-installer.sh | sh
3. 直接下二进制(不想跑安装器的话):
# 从 releases 页挑与你架构匹配的资产 curl.exe -L -o moli.zip https://github.com/lexmount/moli/releases/latest/download/moli-x86_64-pc-windows-msvc.zip Expand-Archive moli.zip -DestinationPath "$env:LOCALAPPDATA\Moli" -Force
这些 releases/latest/download/... 链接始终指向最新发布,所以不用钉版本号也不会失效。
装完若位置不常规,把插件指过去:
config: exePath: 'C:\path\to\moli.exe'
校验下载
Moli 的 README 没有记录任何校验和或签名,安装器也不发布校验和文件。**存在的是 GitHub 自己给每个资产的
sha256 摘要**,可以从 release API 读到:
(irm https://api.github.com/repos/lexmount/moli/releases/latest).assets | Select-Object name, digest
v1.1.17 下这个命令会给出(节选):
moli-installer.ps1 2,020 sha256:e002f7a6c174d78ae6ed7289aca9f5d3a62ab0b1f6e588606a80c0cb5d37964d moli-x86_64-pc-windows-msvc.zip 43.8 MB sha256:5247309837b6eaf6e73bfa18f2a8d8d90473b9e2fe5cfcaaef57d7eee9b074c4
与你下载的文件比对:
(Get-FileHash .\moli-installer.ps1 -Algorithm SHA256).Hash.ToLower()
插件遵循同样的纪律:moli_probe action=install 会报告它实际执行的那份字节的 SHA256,而
expectedSha256 能把这份报告变成强制校验门。它不会编造一个可信默认值——因为摘要只有在与发布页自己
的值比对时才有意义。
这是验证过的性质,不是声明:用插件自己的 downloadInstaller 下载 v1.1.17 的安装器,复现出的正是
GitHub 公布的那个摘要 e002f7a6…964d,从磁盘重新哈希也对得上。
装进 desktop profile
dsh plugin --profile desktop … 会被拒绝——desktop profile 归 Electron 应用所有。直接改它的
package.json,或用应用内插件页(侧边栏 →插件→添加插件),那条路径同样走 pnpm。
profile 插件需要两半都齐:依赖边(dependencies)+ dsh.profile.bundles 条目。缺一个 loader 就看不到
它。从本地目录安装的完整四步是:
1. 把本目录放到任意位置,例如 D:\dsh_plugins\dsh-moli。
2. 在该 profile 的 package.json 中加入两项:
dependencies:"dsh-moli": "link:D:/dsh_plugins/dsh-moli"dsh.profile.bundles:"dsh-moli"
3. 在 profile 目录执行 pnpm install(生成 node_modules/dsh-moli)。
4. 重启 DSH。
无法解析的 bundle 会被静默跳过,只在 stderr 留一行 skipping profile bundle …。工具迟迟不出现时先找
这行。
用法
moli_fetch 参数:url(必填)、dump、writeTo、selector、eval、scroll、wait、
waitSelector、waitScript、waitResponseUrl、waitResponseJson、delayMs、timeoutMs、
maxChars、headers、userAgent、layout、scrollbars、noJs、noCss、resources、
withFrames、insecureTls、failOnHttpError、profileDir、cookieFile、proxy。
moli_fetch url=https://example.com dump=markdown # 省 token 的正文 moli_fetch url=https://example.com dump=semantic_tree_text # 带节点 id 的结构 moli_fetc …(truncated)
Rendered from the README published on npm. Formatted only, not edited.
Versions
Published on npm::22,最后更新 2026-10-27