This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Repository navigation
v0.9.0-rc.2 — messages 端面不再被一条畸形历史打死 + 图片边界说法纠错 (preview)
Pre-release
Pre-release
v0.9.0-rc.2 — messages 端面不再被一条畸形历史打死 + 图片边界说法纠错
Pre-release(预览版)。修掉 v0.9.0-rc.1 之后发现的一处「一条持久历史打死整会话」
(#3 同一类),并订正上一版对图片
体积的描述。
修复
- messages 端面:历史里的畸形 tool-call 不再让之后每一轮都失败。
持久化的 assistanttool-call只要arguments不是合法 JSON,toAnthropicMessages
就抛PROVIDER_PROTOCOL_ERROR,于是该会话在 messages 系模型上之后每一轮都失败,
且错误里不说是哪一条历史。触发者甚至不一定是本插件:chat / responses 两个端面把
arguments原样透传(线上本来就是字符串),所以一条畸形调用在 chat 端面落盘后,
要等会话切到 messages 系模型才引爆。 - 降级而不是拒绝:这个调用**早就执行过、也有
tool_result**了,模型只需要看见
「它当时调过这个工具」,所以拒发它毫无收益、代价却是整段会话。新增toolInput(),
历史input一律退成{}:- 非法 JSON(
not-json{、空串); - 能解析但不是对象——
"5"/"[1]"/"null"/'"text"'。Messages API 要求
input是对象,所以这类与非法 JSON 一样会被对端拒绝,而上一版是原样发出去的,
表现为一条看不出问题来源的上游 400。
- 非法 JSON(
- 创作侧保持严格:
pumpMessages对刚刚流出来的调用仍然抛错。参数不是 JSON 是
上游违反协议,一个无法执行的调用不该被保留或派发——宿主的 max-tokens 与中断规则也是
这个取向(宁可丢掉被截断的 tool-call)。新增断言锁住这个方向,防止以后「统一成宽容」
把两边都改掉。 - 宿主自己也容忍这种畸形(
dsh-agent-loop的工具参数解析器保留原文、dsh-llm-pi-ai
的回放解析器退成{}),只有dsh-llm-deepseek的 messages 实现选择抛错——而它没有
跨端面回放这一层要照顾。
文档
上一版 notes 与 README 把图片体积说大了,本版改准(只改说法,没有改行为):
- 单图大小的真实边界是 attachment 的准入归一化,不是本插件:本部署在准入时就把每张图
压到 ≤ 4 MiB / ≤ 2048×2048 像素(单边 ≤ 8192;上传侧单图 ≤ 20 MiB、单消息 ≤ 200 MiB),
而imageHostPath给的就是那份归一化副本——所以本插件从不内联原始上传。 - 插件自己那条 20 MiB 单图检查只对不做归一化的 attachment provider 生效,是兜底;
真正管用的请求级保护是maxRequestImageBytes,而且它按张数才会撞线:归一化后单图
base64 约 5.4 MiB,64 MiB 预算约合十余张同请求。 lib/models.js的常量注释、README.md/README.en.md的多模态与
maxRequestImageBytes条目、AGENTS.md(约定 13 补边界事实、新增约定 14 记下
「回放降级、创作严格」)同步更新。
验证
node test/smoke.mjs:56 项,55 pass + 1 skip(无 key 的活探针)。本版新增:
6 种畸形历史载荷(非法 JSON、空串、数组、null、数字、字符串)都退成{}且
id/name照旧回放;以及pumpMessages对刚流出的非 JSON 调用仍然抛
PROVIDER_PROTOCOL_ERROR。node test/host-compat.mjs:8 项 8 pass,0 skip(真dsh-llm+ 真流语法不变量)。npm run build:client:客户端半本版没有改动,lib/client.js与src/client/*仍同步
(测试里有断言守卫),所以浏览器侧无需刷新也不必重启。- 无联网断言:本版改动是纯转译层,不涉及上游行为,故未消耗额度做真机探针。
已知 / 未覆盖
- 消息端面的 tool-call 参数只做「可发送」保证,不保证语义保真:
input降级成{}后,
模型看到的是「调过这个工具」但参数为空。这是刻意的取舍(pi-ai 同款):保住会话
可用性优先于历史参数保真,而真正的结果在紧随其后的tool_result文本里。 imageRequestPricing仍未实现:图片 token 计入走 token meter 的启发式估值(不报错,
只是不够准)。上游没有公布视觉计费口径,编一个公式会比不实现更差——token meter
一旦拿到定价就整体替换掉自己的启发式。- 仍不参与
attachments.readImageRequest的请求版降采样(那需要另一组只能靠猜的像素/字节
目标,且有重编码的画质取舍);因此请求体侧唯一的保护仍是maxRequestImageBytes。 - 上游网关的请求体上限未公布,
maxRequestImageBytes的默认值是部署取值而非实测值。 - 目录里没有
.github/,没有 CI;门禁就是这两个测试入口 + 构建脚本的语法检查。
升级
dsh plugin --profile web add github xia-sc/dsh-opencode-go
# 重启 dsh web(宿主侧改动必须重启才生效;客户端半本版没变)- 运行环境下限仍是 DeepSeek Harness
0.1.6-alpha.1(peer 依赖^0.1.6-alpha.1)。 - 无需改任何配置:本版没有新增或改动配置字段,
maxRequestImageBytes的默认值不变。 - 如果你的会话里有 messages 系模型(minimax / qwen)一直报
stored tool-call arguments are not valid JSON,本版之后它就会正常继续——不需要清历史。
v0.9.0-rc.2 — the messages surface is no longer killed by one malformed history entry + image-bound corrections
Pre-release. Fixes another instance of "one durable history entry kills the session" (the same
class as #3) found after
v0.9.0-rc.1, and corrects the previous release's description of image sizes.
Fixes
- messages surface: a malformed tool call in history no longer fails every later turn.
Whenever a persisted assistanttool-callhadargumentsthat were not valid JSON,
toAnthropicMessagesthrewPROVIDER_PROTOCOL_ERROR, so the conversation failed on every
later turn with a messages-surface model, in an error that named no history entry. The
culprit need not be this plugin: the chat and responses translations passarguments
through untouched (the wire takes a string), so a malformed call persisted on one of those
surfaces only detonates once the session is switched to a messages-surface model. - Degrade instead of refusing. The call already ran and already has its
tool_result; the
model only needs to see that it made the call, so refusing to re-send it bought nothing and
cost the whole conversation. A newtoolInput()maps a historicalinputto{}for:- unparseable JSON (
not-json{, the empty string); - anything that parses to a non-object —
"5","[1]","null",'"text"'. The
Messages API requiresinputto be an object, so these failed exactly as hard, while the
previous release sent them verbatim: an upstream 400 naming no source.
- unparseable JSON (
- Creation stays strict.
pumpMessagesstill throws for a freshly streamed call whose
arguments are not JSON. That is an upstream protocol violation, and an unexecutable call
must not be retained or dispatched — the harness's own max-tokens and interruption rules take
the same line (dropping truncated tool calls rather than keeping them). A new assertion locks
that direction against a future "let us be tolerant everywhere" edit. - The harness itself already tolerates this malformation (
dsh-agent-loop's tool-argument
parser keeps the raw text,dsh-llm-pi-ai's replay parser returns{}); only the
dsh-llm-deepseekmessages implementation throws, and it has no cross-surface replay to
worry about.
Documentation
The previous release's notes and the README overstated image sizes. This release corrects the
wording (no behavior change):
- The real bound on one image is the attachment store's admission-time normalization, not
this plugin: this deployment reduces every image to <= 4 MiB and <= 2048x2048 px (<= 8192
per side; uploads are capped at 20 MiB each and 200 MiB per message), andimageHostPath
returns that normalized copy — so nothing here ever inlines the original upload. - The plugin's own 20 MiB per-image check therefore only fires for an attachment provider that
does no normalization: it is a fallback. The guard that matters ismaxRequestImageBytes,
and it triggers by image count — a normalized image is ~5.4 MiB once base64-encoded, so
the 64 MiB default is roughly a dozen in one request. - Updated together: the constant's comment in
lib/models.js, the multimodal and
maxRequestImageBytesentries inREADME.md/README.en.md, andAGENTS.md(rule 13
gains the bounds; new rule 14 records the replay-degrades / creation-strict asymmetry).
Verification
node test/smoke.mjs: 56 tests, 55 pass + 1 skip (the key-gated live probe). New: six
malformed history payloads (invalid JSON, empty, array,null, number, string) all degrade
to{}whileid/namestill replay; andpumpMessagesstill rejects a freshly
streamed non-JSON call withPROVIDER_PROTOCOL_ERROR.node test/host-compat.mjs: 8 tests, 8 pass, 0 skip (realdsh-llm+ real stream
invariant).npm run build:client: the browser half is unchanged in this release and
lib/client.jsstays in sync withsrc/client/*(asserted by the suite), so no page
refresh and no client-side restart is needed.- No live probe: the change is pure translation and involves no upstream behavior, so no quota
was spent.
Known / not covered
- Tool-call arguments are only guaranteed sendable, not semantically faithful: degrading
inputto{}tells the model that the call happened with no arguments. That is a
deliberate tradeoff (same as pi-ai) — keeping the conversation usable outranks history
fidelity, and the real outcome lives in thetool_resulttext that follows. imageRequestPricingis still unimplemented: image tokens are priced by the token meter's
heuristic (no failure, just less exact). The operator publishes no vision pricing, and
inventing a formula would be worse than not implementing it — the meter replaces its own
heuristic wholesale once pricing exists.- Still no
attachments.readImageRequestrequest-version downscaling (it needs another set of
pixel/byte targets that could only be guessed, plus a re-encode fidelity tradeoff), so
maxRequestImageBytesremains the only request-body guard. - The upstream gateway's request-body limit is not published, so
maxRequestImageBytes's
default is a deployment choice, not a measured value. - There is no
.github/and no CI: the gate is these two test entries plus the build script's
syntax check.
Upgrade
dsh plugin --profile web add github xia-sc/dsh-opencode-go
# restart dsh web (host-side changes need a restart; the browser half is unchanged)- The runtime floor is still DeepSeek Harness
0.1.6-alpha.1(peer^0.1.6-alpha.1). - No configuration change: no new or altered config field, and
maxRequestImageByteskeeps its
default. - If a session with a messages-surface model (minimax / qwen) kept failing with
stored tool-call arguments are not valid JSON, it simply continues after this release — no
history cleanup needed.