dsh-model-switch 0.4.72 → 0.4.73
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 +12 -0
- package/PRODUCT.md +1 -1
- package/README.md +2 -0
- package/lib/auto-review-0mh6NLlr.js +1817 -0
- package/lib/auto-review.js +2 -2
- package/lib/client.js +53 -0
- package/lib/index.js +10 -2
- package/lib/types/auto-review-gate.d.ts +186 -0
- package/lib/types/auto-review.d.ts +31 -2
- package/lib/types/capabilities-rpc.d.ts +6 -0
- package/lib/types/client/ModelSwitchSettings.d.ts +2 -0
- package/lib/types/client/locales.d.ts +7 -0
- package/lib/types/client-contract.d.ts +8 -0
- package/lib/types/host-settings.d.ts +11 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## v0.4.73
|
|
2
|
+
|
|
3
|
+
自动审查破甲接管:可选自有审查门(own gate,默认开启、未装破甲则置灰),修复破甲补丁把官方审查门短路后 auto 会话逐调用审查静默失效的问题(2026-11-23 实机取证)。
|
|
4
|
+
|
|
5
|
+
- **根因(实测)**:本行通过 import 官方包并挂载其 apply(auto-review.ts),仅在 reviewScope 替换审查路由与预设读取;破甲(dsh-purge-community 1.7.20)对该包 tools/pre-execute 监听器第一行插入 return next()——被挂的门对所有调用直接放行,与预设无关。会话仍在 auto(投影 permissions.preset=auto;held=true、allowedCalls=0、skippedReadOnly=0、白名单 read 不计数互证),但审查从未发生。
|
|
6
|
+
- **自有门(src/auto-review-gate.ts,按官方 0.2.2-rc.5 逐行校准分叉)**:REVIEW_POLICY 逐字、快照组装全套 helper、reviewMessages、parseDecision/readDecision(BlockAssembler 公开导入)、classifyRisk(reviewScope 内走 llm 代理路由)、denied/askUser/failed 与 9 语言文案;deepFreeze 本地实现避免新依赖。
|
|
7
|
+
- **双门去重(顺序无关)**:AutoCallContext 加 handled/officialEngaged;shadow current() 对已处理调用答 custom、对放行的非豁免调用置 officialEngaged;自有监听器见任一标志即让位;两 listener 顺序翻转由标志双向去重;skippedReadOnly 只在豁免决定点计数。
|
|
8
|
+
- **生效条件**:dsh-purge-community 在 startedBundles 且 autoReviewOwnGate 非 false(按调用热读);未装破甲不接管(行为与 0.4.72 一致),设置卡置灰。
|
|
9
|
+
- **设置/状态面**:新键 autoReviewOwnGate(默认 true)+「审查豁免」卡开关行(置灰+官方门补丁状态诊断)+ zh/en 文案;capabilities RPC status 新增 ownGate/purgeInstalled/officialGateNeutered(诊断 best-effort 读官方包源码查 [dsh-purge] 标记)。
|
|
10
|
+
- **测试**:新 tests/auto-review-gate.spec.ts 24 条 + 既有断言补字段,**761/761 全绿**(72 文件)+ pack 闸门。
|
|
11
|
+
- **验证(分级如实)**:单元+集成覆盖协议/快照/去重/生效矩阵;快照逻辑为官方已验证实现的逐字分叉。桌面实机验证(真实破甲 + auto 会话 + RPC 计数器)随安装执行并回填;开关可热关作即时回退。
|
|
12
|
+
- **边界**:破甲的审批恒放行补丁在宿主层不可由本插件修复——auto 会话里自有门为仅存关卡,非 auto 会话仍无守门;compat-watch 将 dsh-experimental-auto-review 加入每线 diff 清单;漂移 fail-closed 可见。
|
|
1
13
|
## v0.4.72
|
|
2
14
|
|
|
3
15
|
纯读免审查默认白名单第三次校准(126 → 147 条,按 2026-11-22 桌面 live 工具带 + 用户当日确认放行)。
|
package/PRODUCT.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- **Image Router:** owns a new, uniquely named stable `generate_image` tool. It selects the configured Codex or Grok adapter/model at execution time, rejects backend-incompatible fields, and returns normalized image metadata. Existing provider-specific image tools remain available as rollback paths.
|
|
12
12
|
- **Composer Picker:** replaces the composer model seat with a suffix-grouped Model / Effort / Context / Fast / Thinking picker and submits through the official Model Directory. Variant changes preserve an effort only when the target catalog row supports it, otherwise they use the target default or omit effort. Picker changes are session-local. A submitted prompt reserves the selected runtime immediately (composer submitting, pending first turn, or running). Native Antigravity keeps its models and effort; DSH keeps LLM-provider choices and disables Agent providers. After a successful native binding, other groups stay disabled. Cancel without a binding releases the reservation; existing DSH history still cannot convert onto an External Agent. The deployment default write a Host performs alongside a Session switch is left to DSH (since 0.4.23 the plugin no longer restores a pre-switch default).
|
|
13
13
|
- **Plan Review:** intercepts the official `plan-review` composer takeover with a header execution-model picker and right-aligned Discuss in chat / Reject / Set as goal and run / Confirm actions. Confirm commits the selected model before answering; a refused commit leaves the review pending and retryable. Reject carries optional human feedback as the answer's own `custom` text, which plan mode reports to the model. **Set as goal and run** arms this Plan as the session's goal through the released `remote.goals.create` — replacing an unfinished goal with `get` + `clear` first so the new Plan receives a fresh round cap — and only then answers, so `dsh-goal-round-driver` carries the Plan after plan mode exits. The goal is set before the answer, a refusal keeps the review pending and retryable, and a deployment that mounts no goal service disables the action with an explicit reason; the plugin stores no goal state, schedules no rounds, and owns no part of the goal domain. The card body carries only the official two-part summary (first line, first paragraph); the full plan opens in the right sidebar through ui-plan's registered preview opener, which this card drives because a composer-takeover entry cannot declare the official actions slot. Discuss in chat withdraws the takeover through the Host's own verb — `dismiss()` where the Host publishes it, `cancel()` on the older generation — and names the Host when neither seam exists, so a settled review is never a dead end. The same runtime reservation applies.
|
|
14
|
-
- **Auto review:** the reviewer model for the official `@deepseek-ai/dsh-experimental-auto-review` per-call gate, off by default — both fields empty means reviews follow the session's own model. On pins a deployment-wide provider/model, and each review resolves its route per session: the session's provider group's reviewer pair → the flat card pair → the session's own model. Session correlation rides an outer `{ prepend: true }` `tools/pre-execute` listener on the review scope (`exec.agent.session`), so parallel sessions on different providers never interfere and mid-session provider switches take effect on the very next review.
|
|
14
|
+
- **Auto review:** the reviewer model for the official `@deepseek-ai/dsh-experimental-auto-review` per-call gate, off by default — both fields empty means reviews follow the session's own model. On pins a deployment-wide provider/model, and each review resolves its route per session: the session's provider group's reviewer pair → the flat card pair → the session's own model. Session correlation rides an outer `{ prepend: true }` `tools/pre-execute` listener on the review scope (`exec.agent.session`), so parallel sessions on different providers never interfere and mid-session provider switches take effect on the very next review. 0.4.73 adds an optional **own gate** (default on, only armed when the dsh-purge-community bundle started, grayed out otherwise): when that third-party patch short-circuits the official gate's host code, this plugin's forked review pipeline — calibrated line-for-line against the official 0.2.2-rc.5 implementation and routed through the same scope — takes over per-call review; the toggle is hot (read per call) and falls back to the official gate instantly. The fork tracks the official package through compat-watch.
|
|
15
15
|
- **Compaction:** the summarization model behind `/compact` and DSH's automatic compaction, off by default — both fields empty means compaction follows the conversation target model. On pins a deployment-wide provider/model, and each summarization call resolves its route per session: the session's provider group's compaction pair → the flat card pair → the official row's `modelPolicies` / conversation-target default. When a per-session route applies, the child context's `llm` wrapper updates `options.provider`/`options.model` in place on `purpose === 'compaction'` calls so `summarizeWithLlm` returns and durably records the exact route that wrote the summary in `compaction/summary`.
|
|
16
16
|
- **Session naming:** the model behind DSH's automatic session titles, off by default — both fields empty means naming follows the session's own model, which is the official behavior. On pins a deployment-wide provider/model that each session re-resolves per request: provider group → flat pair → the session's own model. The route is read through on every naming request, so a save applies to the very next request with no restart and never interrupts an in-flight request; the exact pair used is recorded in the session's own `session/title-llm-request` event by the official naming implementation, so the record and the request always agree. The first candidate is used unless its call fails: a max-token failure gets one widened output-budget retry on the same route, any other failure falls through to the next candidate (provider group → flat pair → the row's own pair → the session's own model), and only when every candidate fails does naming keep DSH's deterministic fallback title, after one warning that names the routes tried. A fallback neither writes settings nor changes the stored route. The plugin replaces the official `session-title-llm` row (one registered naming provider per context), mirrors the cadence that row declared, and follows whichever official auxiliary title call the installed DSH line publishes; naming cadence and title policy remain DSH's.
|
|
17
17
|
|
package/README.md
CHANGED
|
@@ -92,6 +92,8 @@ Plan Review 拥有独立于会话当前路由的执行模型草稿。**确认执
|
|
|
92
92
|
|
|
93
93
|
官方 `@deepseek-ai/dsh-experimental-auto-review`(Auto 权限预设的逐调用审查)把审查请求固定在会话自身的路由上。本插件通过 `cordis.patch.yml` 的行替换接管这一行:官方行被禁用,改挂 `dsh-model-switch/auto-review`,它在作用域子上下文里运行**同一份官方 `apply`**,把 `llm.stream` 的 `provider/model` 改写为该会话解析出的审查模型(供应商配置组 → 全局审查卡片 → 会话自身模型)。在 `official.apply(scope)` 之后,本行立即在同一作用域注册 `{ prepend: true }` 的 `tools/pre-execute` 监听器(在 Cordis 瀑布流中排在官方监听器之前),用 `AsyncLocalStorage` 将 `exec.agent.session` 绑定到审查调用链上,因此不同供应商的多个会话并行时互不干扰,会话中途切换供应商也会在下一次审查立即生效。设置页「自动审查模型」默认关闭 = 审查跟随当前会话模型;打开时以目录首位模型作为可再改的固定起点,保存后对下一次审查立即生效。审查未配置官方能力包(`@deepseek-ai/dsh-experimental-auto-review` 未随 profile 启动)时本行不挂载,Auto 预设保持官方的关闭状态。
|
|
94
94
|
|
|
95
|
+
0.4.73 起本行提供可选的**自有审查门**(默认开启;仅在安装破甲插件 dsh-purge 的部署上生效,设置卡会置灰):破甲对宿主 `@deepseek-ai/dsh-experimental-auto-review` 的补丁会把官方门短路为直接放行,自有门以同一套审查管线(按官方 0.2.2-rc.5 逐行校准、同一审查路由)接管逐调用审查;开关按调用热读,关闭即回落官方门。门状态(自有门是否值守 / 破甲是否在装 / 官方门是否被补丁短路)在设置卡「审查豁免」区可见。
|
|
96
|
+
|
|
95
97
|
0.4.31 起本行还在运行时接管这条缝,而不仅靠补丁文件:插件管理器会把组件开关写进"在所有 bundle 层之后生效"的层,手动把官方「自动审查」组件重新打开曾会让无防护的官方 gate 回来——而 `permissionPresets.registerAuto` 是单注册的,同一条缝上的两行最终杀掉每个工具调用。现在本行按接管会话命名槽位的同一手法接管:官方行将要 apply 时**先同步交出** Auto 注册(让官方行干净应用而不是撞车),再通过公开的 `Entry.update` 停用官方行,并以有界重试收回注册——整个位移过程保留会话的 Auto 选择。因此在插件管理器里把官方组件再打开只是一次会记日志、自愈的空操作;设置页「自动审查」卡片里也写明了这一点。
|
|
96
98
|
|
|
97
99
|
## 压缩模型(Compaction model)
|