dsh-vision-fallback 0.9.0 → 0.9.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/CHANGELOG.md +16 -0
- package/README.md +17 -2
- package/README.zh.md +17 -2
- package/package.json +3 -1
- package/test/vision-fallback.test.mjs +11 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.9.1 - 2026-08-18
|
|
4
|
+
|
|
5
|
+
- Added the `dsh-plugin` npm keyword and a regression test for the installable DSH bundle manifest.
|
|
6
|
+
- Expanded the documentation for compaction reuse, tool-result images, persistent observations, and restart recovery.
|
|
7
|
+
|
|
8
|
+
## 0.9.0 - 2026-08-16
|
|
9
|
+
|
|
10
|
+
- Persisted successful observations to `observations.json` and reused them across restart, replay, and compaction.
|
|
11
|
+
- Scoped observations by session and message position so a newly posted copy of the same image can be analyzed again with fresh context.
|
|
12
|
+
- Recorded vision-call latency, status, image metadata, and token usage in `usage.jsonl`.
|
|
13
|
+
|
|
14
|
+
## 0.7.0 - 2026-08-14
|
|
15
|
+
|
|
16
|
+
- Kept the selected main model in control while silently routing image understanding to the configured vision model.
|
package/README.md
CHANGED
|
@@ -31,6 +31,14 @@ agent/pre-step ──► image + current question + recent context
|
|
|
31
31
|
4. A **model-only surface replacement** swaps the image for the vision observation before the request reaches the main model.
|
|
32
32
|
5. Switching the main model (DeepSeek, Kimi, MiniMax, ...) never changes the fixed vision model.
|
|
33
33
|
|
|
34
|
+
### Complete call paths
|
|
35
|
+
|
|
36
|
+
- **Normal conversations**: `agent/pre-step` processes images before the main-model request and projects observations into the model view.
|
|
37
|
+
- **Context compaction**: the `llm/stream` path with `purpose: "compaction"` reuses existing observations first and only describes genuinely unseen images.
|
|
38
|
+
- **Tool-result images**: images inside `tool/result` events are projected for the model while the original tool result remains visible and traceable in the UI.
|
|
39
|
+
- **Reloads and restarts**: observations are persisted to `observations.json`, so the same session/message position does not trigger another vision call after restart.
|
|
40
|
+
- **Model capability detection**: in `auto` mode the plugin reads the main model's real `inputModalities`; it stays out of the way for image-capable models and bridges only text-only routes.
|
|
41
|
+
|
|
34
42
|
## Install
|
|
35
43
|
|
|
36
44
|
### From npm / local checkout
|
|
@@ -47,7 +55,7 @@ dsh plugin --profile web add dsh-vision-fallback
|
|
|
47
55
|
git clone https://github.com/1HelloMan1/dsh-vision-fallback.git
|
|
48
56
|
cd dsh-vision-fallback
|
|
49
57
|
pnpm install --config.minimumReleaseAge=0 # rc.6 peers need the release-age flag bypassed
|
|
50
|
-
pnpm test #
|
|
58
|
+
pnpm test # 22 unit tests
|
|
51
59
|
dsh plugin --profile web add "$PWD"
|
|
52
60
|
```
|
|
53
61
|
|
|
@@ -137,6 +145,13 @@ Observations are keyed by **the image's occurrence in a session** (session id +
|
|
|
137
145
|
|
|
138
146
|
The cache is capped at 256 entries (LRU eviction); failed results are never cached.
|
|
139
147
|
|
|
148
|
+
Cache location: when `usageLogPath` is set, `observations.json` is written beside that log; otherwise it is stored at
|
|
149
|
+
`<dshHome>/vision-fallback/observations.json`. This lets compaction, event replay, and service restarts reuse successful observations.
|
|
150
|
+
|
|
151
|
+
### Compaction, tool results, and restarts
|
|
152
|
+
|
|
153
|
+
When the main model can already see images, the bridge does not call the vision model. If a later text-only compaction model encounters the original image event, the plugin first reuses the main model's projected observation and the persistent cache, then handles only images that truly have no observation. This prevents every compaction from re-describing the entire image history while still allowing the same image at a new message position to be re-read with fresh context.
|
|
154
|
+
|
|
140
155
|
## Default vision route
|
|
141
156
|
|
|
142
157
|
- Model: `mimo-v2.5` · Endpoint: `https://opencode.ai/zen/go/v1/chat/completions` · Credential: `OPENCODE_GO_API_KEY`
|
|
@@ -150,7 +165,7 @@ The OpenCode community `opencode-see-image` hands a `filePath` + task `question`
|
|
|
150
165
|
## Development
|
|
151
166
|
|
|
152
167
|
```sh
|
|
153
|
-
pnpm test # node --test test/*.test.mjs —
|
|
168
|
+
pnpm test # node --test test/*.test.mjs — 22 tests
|
|
154
169
|
```
|
|
155
170
|
|
|
156
171
|
Structure:
|
package/README.zh.md
CHANGED
|
@@ -31,6 +31,14 @@ agent/pre-step ──► 图片 + 当前问题 + 最近上下文
|
|
|
31
31
|
4. **仅模型可见的 surface replacement** 把图片换成视觉观察后再交给主模型。
|
|
32
32
|
5. 切换主模型(DeepSeek、Kimi、MiniMax……)不会改变固定视觉模型。
|
|
33
33
|
|
|
34
|
+
### 完整调用线路
|
|
35
|
+
|
|
36
|
+
- **普通对话**:`agent/pre-step` 在主模型请求前处理图片,并把视觉观察投影到模型视图。
|
|
37
|
+
- **上下文压缩**:`llm/stream` 的 `purpose: "compaction"` 线路会先复用已有观察;只有确实没有观察的图片才补一次识别。
|
|
38
|
+
- **工具结果图片**:`tool/result` 中的图片也会进入模型投影,界面仍保留原始图片,不把工具结果改成用户不可追溯的纯文本。
|
|
39
|
+
- **会话重载 / 重启**:观察结果持久化到 `observations.json`,重启后同一会话、同一消息位置不会再次调用视觉模型。
|
|
40
|
+
- **模型能力判断**:`auto` 模式会读取主模型的真实 `inputModalities`;主模型原生支持图片时不重复接管,纯文本主模型才走视觉桥。
|
|
41
|
+
|
|
34
42
|
## 安装
|
|
35
43
|
|
|
36
44
|
### npm / 本地检出
|
|
@@ -47,7 +55,7 @@ dsh plugin --profile web add dsh-vision-fallback
|
|
|
47
55
|
git clone https://github.com/1HelloMan1/dsh-vision-fallback.git
|
|
48
56
|
cd dsh-vision-fallback
|
|
49
57
|
pnpm install --config.minimumReleaseAge=0 # rc.6 peer 依赖需绕过发布年龄策略
|
|
50
|
-
pnpm test #
|
|
58
|
+
pnpm test # 22 个单元测试
|
|
51
59
|
dsh plugin --profile web add "$PWD"
|
|
52
60
|
```
|
|
53
61
|
|
|
@@ -137,6 +145,13 @@ API key 通过 DSH **凭证系统**(`~/.dsh/.credentials.yaml`)解析,`pro
|
|
|
137
145
|
|
|
138
146
|
缓存上限 256 条(LRU 淘汰),失败结果不入缓存。
|
|
139
147
|
|
|
148
|
+
缓存文件位置:如果设置了 `usageLogPath`,缓存写在同一目录的 `observations.json`;否则使用
|
|
149
|
+
`<dshHome>/vision-fallback/observations.json`。因此压缩、事件回放和服务重启都可以复用已经成功得到的观察。
|
|
150
|
+
|
|
151
|
+
### 压缩、工具结果与重启
|
|
152
|
+
|
|
153
|
+
主模型能看图时,视觉桥不会重复调用视觉模型;但如果后续使用纯文本压缩模型,压缩线路可能再次遇到原始图片。插件会优先复用主模型已有的视觉投影和持久化观察,再处理真正没有结果的图片。这样可以避免“每次压缩重新识别整段历史图片”,同时保留新消息位置重新识别的能力。
|
|
154
|
+
|
|
140
155
|
## 默认视觉路由
|
|
141
156
|
|
|
142
157
|
- 模型:`mimo-v2.5` · 端点:`https://opencode.ai/zen/go/v1/chat/completions` · 凭据:`OPENCODE_GO_API_KEY`
|
|
@@ -150,7 +165,7 @@ OpenCode 社区的 `opencode-see-image` 把 `filePath` 和针对当前任务的
|
|
|
150
165
|
## 开发
|
|
151
166
|
|
|
152
167
|
```sh
|
|
153
|
-
pnpm test # node --test test/*.test.mjs —
|
|
168
|
+
pnpm test # node --test test/*.test.mjs — 22 个测试
|
|
154
169
|
```
|
|
155
170
|
|
|
156
171
|
目录结构:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-vision-fallback",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "DSH 静默视觉增强:主模型照常选择,图片自动交给固定视觉模型后以隐藏上下文返回主模型。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"lib",
|
|
14
14
|
"test",
|
|
15
15
|
"cordis.patch.yml",
|
|
16
|
+
"CHANGELOG.md",
|
|
16
17
|
"README.md",
|
|
17
18
|
"README.zh.md"
|
|
18
19
|
],
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
},
|
|
34
35
|
"keywords": [
|
|
35
36
|
"dsh",
|
|
37
|
+
"dsh-plugin",
|
|
36
38
|
"deepseek-harness",
|
|
37
39
|
"vision",
|
|
38
40
|
"image",
|
|
@@ -958,3 +958,14 @@ test("usage 记录失败调用并带错误信息", async () => {
|
|
|
958
958
|
await rm(dir, { recursive: true, force: true });
|
|
959
959
|
}
|
|
960
960
|
});
|
|
961
|
+
|
|
962
|
+
test("npm 包声明可安装的 DSH bundle 和市场关键词", async () => {
|
|
963
|
+
const manifest = JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8"));
|
|
964
|
+
const patch = await readFile(new URL("../cordis.patch.yml", import.meta.url), "utf8");
|
|
965
|
+
|
|
966
|
+
assert.equal(manifest.dsh?.bundle?.patch, "./cordis.patch.yml");
|
|
967
|
+
assert.ok(manifest.files.includes("cordis.patch.yml"));
|
|
968
|
+
assert.ok(manifest.keywords.includes("dsh-plugin"));
|
|
969
|
+
assert.match(patch, /id:\s*vision-fallback/);
|
|
970
|
+
assert.match(patch, /name:\s*['"]dsh-vision-fallback['"]/);
|
|
971
|
+
});
|