Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions CLIENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,26 @@ Two lanes, same plugin (#941):
for conversation …` warning, and the dsh plugin logs each distinct endpoint
the attribution gate lets through unproxied (once per process). Reliable
workaround meanwhile: launch through `bili dsh` instead — the launcher's
settings overlay rewrites those providers' `baseURL`s to `/bili/` URLs, so
the traffic reaches the proxy regardless of which fetch the transport uses
or what the attribution state is.
settings overlay rewrites those providers' `baseURL`s to `/bili/` URLs, so
the traffic reaches the proxy regardless of which fetch the transport uses
or what the attribution state is.
- **Interop note — retry on malformed tool args (#1518):** in plugin mode the
model generates `compress` arguments and dsh parses them strictly. On long
free-text summaries the model occasionally emits JSON with escape errors —
unescaped `"` inside prose, illegal escapes (e.g. `` \` ``), raw newlines
or tabs inside string literals. That class is *semantic* (telling which
quotes are structural vs content requires understanding the text), so no
syntactic salvage ladder can repair it, and bili passes plugin-mode
responses through verbatim — it has no seat at the parsing table. When dsh
rejects such a call (`MALFORMED_RESPONSE`) the whole turn dies unless it is
retried. Host-side mitigation: add `MALFORMED_RESPONSE` to
`retryPolicy.retryableCodes` — escape errors are sampling noise, so one
extra full call usually succeeds (one field report: ~7% of compress calls
failed this way over 285 attempts, while all other tool calls had zero
failures). The root fix — provider-side constrained decoding (e.g.
DeepSeek's Beta `tools[].function.strict`, Chat Completions wire only) — is
a host/provider work item; bili cannot enable it in plugin mode because it
does not construct the provider request.

Under a `bili dsh` launch the plugin ATTACHES to the launcher's proxy (no
second spawn). Raw upstream URLs rewrite to `<proxy>/bili/<url>` like
Expand Down
1 change: 1 addition & 0 deletions CLIENTS.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- **Profile 安装(免启动器)——统一泳道(#966):** `bili plugin install dsh` 对每个已存在的 profile 执行 `dsh plugin --profile <name> add billion-context` —— pnpm 把包装进各 profile 自己的 `node_modules`,dsh 自动挂载包内 patch 层(`dsh.bundle.patch.yml`)。装哪个源取决于 bili 自身的安装形态(#925):npm 安装传注册表名,checkout/dev 构建传绝对路径(`link:` 依赖,本地改动实时生效)。旧版受管块(`# bili begin` / `# bili end`,#966 之前的安装所写)在安装与卸载时都会被剥离 —— 用户条目与注释保留,清空的文件还原占位 `[]`。先在每个 profile 里跑过一次 dsh 让目录存在。插件加载时自拉起代理(已有健康实例则附看,不重复拉;父进程 pid 看门狗),经全局 fetch 补丁把模型流量改写为 `<proxy>/bili/<上游URL>`,原样注册清单工具,并按工具就绪门控 plugin 模式头(第一轮走 wire 模式)。退出开关:`BILI_NATIVE_DSH=0`。卸载:`bili plugin remove dsh` 或 `dsh plugin --profile <name> remove billion-context` —— 两者走同一通道。经注册表安装要求 npm 上已发布含 `dsh.bundle.patch.yml` 的版本。若 add 后 dsh 启动即报 `billion-context/dsh` 的 `ERR_MODULE_NOT_FOUND`,说明 profile 从陈旧的包元数据缓存里解析到了不含 bundle 子路径导出的旧版本(#953)——固定版本重装:`dsh plugin --profile <name> add billion-context@latest`。
- **自动更新保持各 profile 同步:** 刷新有两个触发器 —— 全局自更新完成后,以及**profile 自己的代理**在周期检查里发现注册表有新版本时(全局 bili 从不运行也一样刷新,#1196 —— 插件市场安装的用户往往根本没有全局安装)。两种触发器都扫描 `~/.dsh/profiles/*/package.json`,把注册表钉住的 `billion-context` 依赖刷新到目标版本(全局触发器刷到新全局版本,自触发刷到注册表最新),统一经 dsh 自己的 `plugin add` 通道,绝不在位覆盖 —— 加载的插件与代理从此不再漂移(#953);钉在本地源的 profile 不动。刷新是尽力而为,失败下个周期重试,绝不会让代理或更新本身失败。
- **已报告:Profile 安装下部分传输零代理流量(#1158,调查中):** dsh `llm-pi-ai` 层的部分传输服务会话**从未有任何模型请求到达代理**(日志无 `processTurn`,调用 bili 工具返回 404 "no model request has arrived"),而同宿主的其他 provider 正常。根因仍在用运行时证据定性 —— 候选:传输层 fetch 形态(SDK 注入 fetch / 非全局 dispatcher)或宿主侧归属缺口导致流量未被 takeover gate 认领。检测:此类情况会打一次性 `[plugin] NO MODEL REQUESTS seen for conversation …` 告警,dsh 插件还会把归属 gate 放行的每个端点各记一条日志(每进程一次)。期间可靠规避:改用 `bili dsh` 启动 —— 启动器的 settings overlay 会把那些 provider 的 `baseURL` 重写为 `/bili/` URL,无论传输层使用哪种 fetch、归属状态如何,流量都必然过代理。
- **互操作注记 —— 畸形工具参数应可重试(#1518):** plugin 模式下 `compress` 参数由模型生成、dsh 严格解析。长自由文本摘要中,模型偶发写出带转义错误的 JSON —— 行文里未转义的 `"`、非法转义(如 `` \` ``)、字符串字面量内的裸换行/TAB。这一类是*语义性*的(判断哪个引号是结构、哪个是内容需要理解文本),任何语法层 salvage 阶梯都救不回;而 bili 对 plugin 模式响应逐字节透传,不在解析桌上。dsh 拒绝此类调用(`MALFORMED_RESPONSE`)时,除非重试,整个 turn 终结。宿主侧缓解:把 `MALFORMED_RESPONSE` 加入 `retryPolicy.retryableCodes` —— 转义错误是采样噪声,一次额外完整调用通常即过(单例现场报告:285 次 compress 尝试中约 7% 以此方式失败,其余工具调用零失败)。根治手段 —— provider 侧约束解码(如 DeepSeek Beta 的 `tools[].function.strict`,仅 Chat Completions wire)—— 属宿主/provider 工作项;bili 在 plugin 模式下不构造 provider 请求,无法代开。

`bili dsh` 启动下插件**附看**(attach)启动器的代理(不二次拉起)。裸上游 URL 与 spawn 模式一样重写为 `<proxy>/bili/<url>`(回环代理目标永不被代理 env 拦截,等于直接绕开 MITM);已经路由的 `/bili/` 前缀请求原样放行、只盖章。已知局限:手动 `/compact` 没有 dsh 侧事件钩子,其边界交给内核的自然 ingest diff(自动压缩已关,影响罕见)。

Expand Down
Loading
Loading