dsh-vision-router 1.4.0 → 1.4.1
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 +11 -9
- package/README.zh.md +11 -9
- package/docs/update-check.md +8 -6
- package/docs/update-check.zh-CN.md +8 -6
- package/entry.js +6 -4
- package/index.js +567 -129
- package/lib/client.js +217 -74
- package/lib/replay-delegation.js +90 -0
- package/lib/self-update.js +135 -12
- package/lib/vision-resilience.js +395 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
17
|
<p align="center">
|
|
18
|
-
<a href="https://github.com/ysr666/dsh-vision-router/releases/tag/v1.4.
|
|
18
|
+
<a href="https://github.com/ysr666/dsh-vision-router/releases/tag/v1.4.1"><img src="https://img.shields.io/badge/release-v1.4.1-5B4CF0?style=flat-square" alt="Release v1.4.1" /></a>
|
|
19
19
|
<a href="tests"><img src="https://img.shields.io/badge/verified-149%20tests-2EA44F?style=flat-square" alt="Verified: 149 tests" /></a>
|
|
20
20
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-2EA44F?style=flat-square" alt="License: MIT" /></a>
|
|
21
21
|
<a href="package.json"><img src="https://img.shields.io/badge/Node.js-%3E%3D22-339933?style=flat-square&logo=nodedotjs&logoColor=white" alt="Node.js >=22" /></a>
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
<p align="center">💬 <strong>QQ community group: 1105463028</strong></p>
|
|
29
29
|
|
|
30
30
|
> [!WARNING]
|
|
31
|
-
> 📌 **Announcement (v1.4.
|
|
31
|
+
> 📌 **Announcement (v1.4.1)**
|
|
32
32
|
>
|
|
33
|
-
> **v1.4.
|
|
33
|
+
> **v1.4.1 now supports** hardened vision failure handling — a single broken vision backend (401 / 429 / outage) can no longer stall a text turn: circuit breaking, shared task budgets and structured failure results keep DeepSeek conversations moving.
|
|
34
34
|
|
|
35
35
|
<p align="center">
|
|
36
36
|
<img src="assets/vision-demo.gif" width="640" alt="Demo: paste an image, the agent locates the send button with vision_ground / vision_crop / vision_pixel_diff and answers with coordinates" />
|
|
@@ -176,7 +176,7 @@ Default `progressiveTools: false`: all eleven deep tools stay registered from pl
|
|
|
176
176
|
| `vision_ocr` | Text transcription: local tesseract (chi_sim+eng) first, vision model fallback | — |
|
|
177
177
|
| `vision_trace` | SVG vectorization (potrace posterization; icons/logos) | SVG |
|
|
178
178
|
| `vision_extract_foreground` | Cutout via border flood fill (uniform backgrounds) | transparent PNG |
|
|
179
|
-
| `vision_html_screenshot` | Screenshot a local HTML file (headless system Chrome) | PNG |
|
|
179
|
+
| `vision_html_screenshot` | Screenshot a local HTML file (headless system Chrome); `fullPage: true` captures the whole page and reports `pageHeight` | PNG |
|
|
180
180
|
| `vision_long_screenshot_ocr` | Long-screenshot transcription: overlapping chunks, tesseract first / vision model fallback, stitched Markdown | chunk PNGs + Markdown + manifest |
|
|
181
181
|
|
|
182
182
|
Formats are sniffed from magic bytes, so extensionless content-addressed attachment files work everywhere (no `.png` renaming needed).
|
|
@@ -194,6 +194,7 @@ vision_colors image="ref.png" top=8
|
|
|
194
194
|
vision_trace image="icon.png" steps=4
|
|
195
195
|
vision_extract_foreground image="logo.png"
|
|
196
196
|
vision_html_screenshot source="page.html" width=1200 height=720
|
|
197
|
+
vision_html_screenshot source="page.html" width=1200 height=720 fullPage=true
|
|
197
198
|
vision_long_screenshot_ocr image="chat-log.png" chunkHeight=1200 overlap=120
|
|
198
199
|
```
|
|
199
200
|
|
|
@@ -328,16 +329,17 @@ Set it back to `false` to re-enable. Unloading removes the wrapper routes, tools
|
|
|
328
329
|
### Upgrade
|
|
329
330
|
|
|
330
331
|
```sh
|
|
331
|
-
# normal npm/npx install
|
|
332
|
-
|
|
332
|
+
# normal npm/npx install — install the version you want explicitly; a bare
|
|
333
|
+
# `update` is silently held back for releases younger than 24h (pnpm v11)
|
|
334
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-vision-router@<version>
|
|
333
335
|
|
|
334
336
|
# DeepSeek Harness source checkout
|
|
335
|
-
pnpm dsh plugin --profile web
|
|
337
|
+
pnpm dsh plugin --profile web add dsh-vision-router@<version>
|
|
336
338
|
```
|
|
337
339
|
|
|
338
|
-
Settings live in the profile's settings provider and survive upgrades.
|
|
340
|
+
Settings live in the profile's settings provider and survive upgrades. The settings card's one-click update installs the registry-confirmed version explicitly and verifies the installed manifest afterwards — it never reports success on a package-manager exit code alone.
|
|
339
341
|
|
|
340
|
-
> **A fresh release does not take effect (`downloaded 0` / `added 0`):** pnpm v11 holds versions younger than 24h back; `npx dsh-vision-router repair` fixes the stale version-pinned profile exemption so updates take effect immediately.
|
|
342
|
+
> **A fresh release does not take effect (`downloaded 0` / `added 0`):** pnpm v11 holds versions younger than 24h back; install the target version explicitly as above (pnpm auto-exempts it), or `npx dsh-vision-router repair` fixes the stale version-pinned profile exemption so updates take effect immediately.
|
|
341
343
|
|
|
342
344
|
> **Upgrading from a pre-bundle-patch install (v0.x):** the package now mounts
|
|
343
345
|
> itself through its own bundle patch, so a leftover manual row in
|
package/README.zh.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
17
|
<p align="center">
|
|
18
|
-
<a href="https://github.com/ysr666/dsh-vision-router/releases/tag/v1.4.
|
|
18
|
+
<a href="https://github.com/ysr666/dsh-vision-router/releases/tag/v1.4.1"><img src="https://img.shields.io/badge/release-v1.4.1-5B4CF0?style=flat-square" alt="Release v1.4.1" /></a>
|
|
19
19
|
<a href="tests"><img src="https://img.shields.io/badge/verified-149%20tests-2EA44F?style=flat-square" alt="Verified: 149 tests" /></a>
|
|
20
20
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-2EA44F?style=flat-square" alt="License: MIT" /></a>
|
|
21
21
|
<a href="package.json"><img src="https://img.shields.io/badge/Node.js-%3E%3D22-339933?style=flat-square&logo=nodedotjs&logoColor=white" alt="Node.js >=22" /></a>
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
<p align="center">💬 <strong>QQ 用户交流群:1105463028</strong></p>
|
|
29
29
|
|
|
30
30
|
> [!WARNING]
|
|
31
|
-
> 📌 **公告(v1.4.
|
|
31
|
+
> 📌 **公告(v1.4.1)**
|
|
32
32
|
>
|
|
33
|
-
> **v1.4.
|
|
33
|
+
> **v1.4.1 现已支持**:视觉失败链加固——单个视觉后端(401 / 429 / 故障)不再拖垮文本对话;熔断、共享任务预算与结构化失败结果让对话始终顺畅继续。
|
|
34
34
|
|
|
35
35
|
<p align="center">
|
|
36
36
|
<img src="assets/vision-demo.gif" width="640" alt="演示:粘贴图片,Agent 用 vision_ground / vision_crop / vision_pixel_diff 定位发送按钮并给出坐标" />
|
|
@@ -176,7 +176,7 @@ Agent 仅根据参考图复刻 UI,再用 `vision_pixel_diff` 验证最终结
|
|
|
176
176
|
| `vision_ocr` | 文字转写:本地 tesseract(中英)优先,视觉模型兜底 | — |
|
|
177
177
|
| `vision_trace` | SVG 矢量化(potrace 分色;图标/logo) | SVG |
|
|
178
178
|
| `vision_extract_foreground` | 边界洪泛抠图(纯色背景) | 透明 PNG |
|
|
179
|
-
| `vision_html_screenshot` | 给本地 HTML 文件截图(无头系统 Chrome
|
|
179
|
+
| `vision_html_screenshot` | 给本地 HTML 文件截图(无头系统 Chrome);`fullPage: true` 截整页并返回 `pageHeight` | PNG |
|
|
180
180
|
| `vision_long_screenshot_ocr` | 长截图转写:重叠分片,tesseract 优先 / 视觉模型回退,按序拼接 Markdown | 分片 PNG + Markdown + manifest |
|
|
181
181
|
|
|
182
182
|
图片格式按**魔数识别**,无扩展名的内容寻址附件文件也能直接用(不用再复制成 `.png`)。
|
|
@@ -194,6 +194,7 @@ vision_colors image="ref.png" top=8
|
|
|
194
194
|
vision_trace image="icon.png" steps=4
|
|
195
195
|
vision_extract_foreground image="logo.png"
|
|
196
196
|
vision_html_screenshot source="page.html" width=1200 height=720
|
|
197
|
+
vision_html_screenshot source="page.html" width=1200 height=720 fullPage=true
|
|
197
198
|
vision_long_screenshot_ocr image="chat-log.png" chunkHeight=1200 overlap=120
|
|
198
199
|
```
|
|
199
200
|
|
|
@@ -328,16 +329,17 @@ npx @deepseek-ai/dsh --profile web --dump-config | grep vision-router
|
|
|
328
329
|
### 升级
|
|
329
330
|
|
|
330
331
|
```sh
|
|
331
|
-
# 普通 npm / npx 安装
|
|
332
|
-
|
|
332
|
+
# 普通 npm / npx 安装 —— 显式安装目标版本;裸 `update` 会被 pnpm v11
|
|
333
|
+
# 静默拦下发布不足 24 小时的新版本
|
|
334
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-vision-router@<版本号>
|
|
333
335
|
|
|
334
336
|
# DeepSeek Harness 源码仓库
|
|
335
|
-
pnpm dsh plugin --profile web
|
|
337
|
+
pnpm dsh plugin --profile web add dsh-vision-router@<版本号>
|
|
336
338
|
```
|
|
337
339
|
|
|
338
|
-
设置存放在 profile
|
|
340
|
+
设置存放在 profile 的设置提供方里,升级不丢失。设置卡里的一键更新会自动显式安装 registry 已确认的版本,并在命令结束后核对实际安装版本——绝不只凭包管理器退出码就报成功。
|
|
339
341
|
|
|
340
|
-
> **新版本一直不生效(`downloaded 0` / `added 0`):** pnpm v11 会拦下发布不足 24
|
|
342
|
+
> **新版本一直不生效(`downloaded 0` / `added 0`):** pnpm v11 会拦下发布不足 24 小时的版本;按上面方式显式安装目标版本(pnpm 会自动写入豁免),或运行 `npx dsh-vision-router repair` 修复过期的带版本号豁免条目后,更新立即生效。
|
|
341
343
|
|
|
342
344
|
> **从 bundle 补丁之前(v0.x)升级:** 现在插件由自带的 bundle 补丁自动挂载,
|
|
343
345
|
> 若 `~/.dsh/profiles/<profile>/cordis.patch.yml` 里还残留旧版手动行,会与之
|
package/docs/update-check.md
CHANGED
|
@@ -18,25 +18,27 @@ DSH and the plugin may have been launched through different paths, including `np
|
|
|
18
18
|
When an update is available, the plugin inspects the CLI entry of the current process. One-click update is enabled only when that entry can be traced to a real `@deepseek-ai/dsh` package and can be executed safely by the current Node runtime. In that case Vision Router runs the documented DSH updater through the **same DSH CLI that is already hosting the plugin**:
|
|
19
19
|
|
|
20
20
|
```sh
|
|
21
|
-
dsh plugin --profile <current-profile>
|
|
21
|
+
dsh plugin --profile <current-profile> add dsh-vision-router@<latest>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
The
|
|
24
|
+
The registry-confirmed target version is installed explicitly rather than through a bare `update`. This matters because pnpm 11 applies `minimumReleaseAge` (default 1440 minutes): a plain `pnpm update` silently keeps the current version while every candidate release is younger than 24h and still exits 0 ("Already up to date") — a false-success update that leaves the old version running after restart. `add <name>@<version>` installs the confirmed release (pnpm auto-exempts the requested version from the policy when needed). For non-registry installs (git/file/link/workspace specs) the updater keeps `update` semantics and only verifies the result.
|
|
25
|
+
|
|
26
|
+
The subprocess uses `execFile` with `shell: false`; no shell command is constructed from browser input. The update endpoint also requires a process-local token returned by the same-origin update-check endpoint. After the updater exits, the plugin reads the `dsh-vision-router` manifest under the profile's `node_modules` and verifies that the installed version actually reached the target — **a zero exit code alone is never reported as success**. Only a verified update asks the user to restart DSH so the new plugin bundle is loaded.
|
|
25
27
|
|
|
26
28
|
If the CLI cannot be verified — for example a raw TypeScript source entry that needs a workspace-specific loader — the one-click button is not offered. This commonly applies to a DSH source checkout launched with `pnpm dsh`: version checking still works, but updating remains under the source workspace's own pnpm workflow. The card keeps the version information and release-notes link and tells the user to update through their original DSH installation path instead.
|
|
27
29
|
|
|
28
30
|
## Manual recovery
|
|
29
31
|
|
|
30
|
-
If automatic update is unavailable, the version check fails, or a one-click update fails, the settings card still shows direct Project/Releases links and a manual command. For a DeepSeek Harness source checkout run:
|
|
32
|
+
If automatic update is unavailable, the version check fails, or a one-click update fails, the settings card still shows direct Project/Releases links and a manual command. When a newer version is known, the shown commands install that version explicitly, which bypasses the release-age withholding described above. For a DeepSeek Harness source checkout run:
|
|
31
33
|
|
|
32
34
|
```sh
|
|
33
|
-
pnpm dsh plugin --profile web
|
|
35
|
+
pnpm dsh plugin --profile web add dsh-vision-router@<latest>
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
For normal npm/npx DSH usage run:
|
|
37
39
|
|
|
38
40
|
```sh
|
|
39
|
-
npx @deepseek-ai/dsh plugin --profile web
|
|
41
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-vision-router@<latest>
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
The settings card substitutes the active profile when it can determine one.
|
|
44
|
+
The settings card substitutes the active profile when it can determine one. If the version still does not change after an update command, check the profile's `pnpm-workspace.yaml` for a version-pinned `minimumReleaseAgeExclude` entry — `npx dsh-vision-router repair` rewrites stale pins to bare names so future releases resolve again (see `docs/doctor.md`).
|
|
@@ -18,25 +18,27 @@ Vision Router 会检查是否有新的已发布版本;当当前运行中的 DS
|
|
|
18
18
|
发现新版本后,插件会检查当前进程真正使用的 DSH CLI 入口。只有该入口能够向上验证到真实的 `@deepseek-ai/dsh` 包,并且可以由当前 Node 运行时安全执行时,设置卡才显示“一键更新”。此时调用的不是某个猜出来的包管理器,而是**当前正在托管插件的同一套 DSH CLI**:
|
|
19
19
|
|
|
20
20
|
```sh
|
|
21
|
-
dsh plugin --profile <当前 profile>
|
|
21
|
+
dsh plugin --profile <当前 profile> add dsh-vision-router@<最新版>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
这里会**显式安装 registry 已确认的目标版本**,而不是裸 `update`。原因是 pnpm 11 默认启用 `minimumReleaseAge`(1440 分钟):当候选新版本发布不足 24 小时时,裸 `pnpm update` 会静默保留当前版本并仍然以退出码 0 结束(输出 “Already up to date”)——这就是“点了更新、提示成功、重启后版本没变”的假成功。`add <包名>@<版本>` 会安装确认过的发布版(pnpm 需要时会自动为新版本写入策略豁免)。对于非 registry 安装(git / file / link / workspace 规格),更新器保持 `update` 语义、只校验结果。
|
|
25
|
+
|
|
26
|
+
子进程通过 `execFile` 且 `shell: false` 启动,不会把浏览器输入拼成 shell 命令。更新接口还要求由同源更新检查接口返回的本进程临时 token,避免网页跨站请求直接触发更新。更新命令退出后,插件会读取 profile `node_modules` 下 `dsh-vision-router` 的清单并核对安装版本确实达到目标——**仅凭退出码 0 永远不会被当作成功**。只有校验通过的更新才会提示用户重启 DSH,让新插件 bundle 真正加载。
|
|
25
27
|
|
|
26
28
|
若无法可靠验证当前 CLI——例如直接运行需要 workspace 专用 loader 的 TypeScript 源码入口——就不会显示一键更新按钮。**源码仓库里通过 `pnpm dsh` 启动通常属于这种情况:版本检查仍然可以正常工作,只是一键更新继续交给源码工作区自己的 pnpm 流程。** 此时仍会显示当前/最新版本和 Release Notes,并提示用户沿用原来的 DSH 安装方式手动更新。
|
|
27
29
|
|
|
28
30
|
## 手动兜底
|
|
29
31
|
|
|
30
|
-
如果自动更新不可用、版本检查失败,或一键更新失败,设置卡仍会直接显示项目主页 / Releases
|
|
32
|
+
如果自动更新不可用、版本检查失败,或一键更新失败,设置卡仍会直接显示项目主页 / Releases 入口和可执行的手动命令。发现新版本时,显示的命令会带版本号显式安装,从而绕过上面描述的发布龄拦截。DeepSeek Harness 源码仓库通过 pnpm 启动时使用:
|
|
31
33
|
|
|
32
34
|
```sh
|
|
33
|
-
pnpm dsh plugin --profile web
|
|
35
|
+
pnpm dsh plugin --profile web add dsh-vision-router@<最新版>
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
普通 npm / npx DSH 使用:
|
|
37
39
|
|
|
38
40
|
```sh
|
|
39
|
-
npx @deepseek-ai/dsh plugin --profile web
|
|
41
|
+
npx @deepseek-ai/dsh plugin --profile web add dsh-vision-router@<最新版>
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
如果插件能识别当前 profile,设置页会把命令里的 `web` 自动替换成实际 profile
|
|
44
|
+
如果插件能识别当前 profile,设置页会把命令里的 `web` 自动替换成实际 profile。若执行后版本仍未变化,请检查 profile 的 `pnpm-workspace.yaml` 里是否有版本钉住的 `minimumReleaseAgeExclude` 条目——`npx dsh-vision-router repair` 会把过期的钉住条目改写为裸名,让后续新版本恢复正常解析(见 `docs/doctor.md`)。
|
package/entry.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import z from '@deepseek-ai/schemastery'
|
|
10
10
|
import * as core from './index.js'
|
|
11
11
|
import { installVisionRouterFileLogging } from './lib/file-logger.js'
|
|
12
|
+
import { contextWithDelegatedReplay } from './lib/replay-delegation.js'
|
|
12
13
|
|
|
13
14
|
// Schemastery object schemas expose set() as the supported way to replace a
|
|
14
15
|
// field schema. This mutates the Config object that index.js itself later uses
|
|
@@ -21,13 +22,14 @@ export const Config = core.Config
|
|
|
21
22
|
|
|
22
23
|
// Defense in depth for direct/programmatic callers that invoke apply() without
|
|
23
24
|
// first running the Cordis Config resolver: only an explicit true enables the
|
|
24
|
-
// schema-changing progressive mode. The wrapped context changes
|
|
25
|
-
//
|
|
26
|
-
//
|
|
25
|
+
// schema-changing progressive mode. The wrapped context changes logger plus a
|
|
26
|
+
// private llm view used only by Vision Router: wrapper -> delegate calls can
|
|
27
|
+
// restore adapter-owned replay identity without mutating the host LLM service.
|
|
27
28
|
export function apply(ctx, config = {}) {
|
|
28
29
|
const logging = installVisionRouterFileLogging(ctx)
|
|
30
|
+
const runtimeCtx = contextWithDelegatedReplay(logging.ctx)
|
|
29
31
|
try {
|
|
30
|
-
const result = core.apply(
|
|
32
|
+
const result = core.apply(runtimeCtx, {
|
|
31
33
|
...config,
|
|
32
34
|
progressiveTools: config.progressiveTools === true,
|
|
33
35
|
})
|