@linxin666/dsh-liangshen 0.4.18 → 0.4.19

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.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # node scripts/verify-docs.mjs --write <dir>
5
- README.md: debd18453ed073d0c0bc0368f6dde92ec60c0393
6
- README.zh.md: 7036c7bf31c4384683c56a553d3ea0196b6b592d
5
+ README.md: fd34d341863e84861be33ffb998cbcf67f0e1a6e
6
+ README.zh.md: 6a8bea4fa5cb6f68c4aee34b3457e30c5ffc96f5
package/README.md CHANGED
@@ -5,7 +5,7 @@ English | [中文](README.zh.md)
5
5
  <p align="center">
6
6
  <img src="https://img.shields.io/npm/v/@linxin666/dsh-liangshen?style=flat-square" alt="Version">
7
7
  &nbsp;
8
- <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.2-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
8
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.3-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
9
9
  &nbsp;
10
10
  <img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
11
11
  </p>
@@ -118,7 +118,7 @@ When validating mode behavior and evaluating performance, verification tiers mus
118
118
  | `enabled` | `true` | Master switch: when false, the preset is not declared and the announcement does not run. |
119
119
  | `announceToAgent` | `false` | Opt-in: when true, a system-prompt section announces the plugin. Off by default so agent system prompts stay clean. |
120
120
  | `presentation` | `ptc` | Wire presentation of the preset this plugin declares. The value is written into the `tool-catalog` row and drives the composition: the `@deepseek-ai/dsh-tool-executor-ptc` row it enables IS the wire, so `ptc` collapses it to `run_code` and `native` keeps the roster, and the catalog text describes the surface that composition produces. A change re-declares the preset as soon as the Host commits it, so the next session picks it up; a session that already started keeps the composition it declared. The removed `both` mode is rejected at registration — migrate an old profile to `ptc` or `native`. |
121
- | `dispatcher` | `true` | Identity switch: when true (the shipped default), the declared preset appends the dispatcher rules section after the persona — complexity triage (L0/L1 direct, L2 through the full flow), the R0.5 compatibility gate that separates the legacy Agent Teams runtime (spawn_teammate plus team-scoped coordination tools) from the current one (a shared task board over ordinary subagents), an interview before planning on an L2 task, the Lead & Dispatch identity with its three execution topologies (Lead-Core, Hybrid, Fan-out) chosen by coupling against parallel ROI, the R9 plan pipeline (plan mode is the user's switch: inside it the plan is explored, written, and submitted through `exit_plan_mode`; outside it the dispatcher plans and then executes), delegation with layer-by-layer review and acceptance, and task tracking in `todo_write` — then a local English supplement with the interview additions, one rule that keeps the task board a tracking surface rather than a dispatch path, and one that keeps a pinned fact an anchor rather than current state. The block is maintained in this repository: it was re-extracted on 2026-10-18 and re-synced on 2026-11-02 against 0.55.0 and again on 2026-11-03 against 0.56.0 plus that package's unreleased Agent Teams pass (twenty-five anti-patterns; the R1 execution topologies; the Lead & Dispatch identity; R2's Harness 0.2.2 note that an explicit route may still be limited to the parent route; R8 restated against the planned direct execution R1 authorizes; R6's fix-and-reverify duty on a Lead-Core or Hybrid core; R0.5 rewritten for the current built-in team, whose only addition over plain subagents is a shared task board that stays bookkeeping under the R5 brief; R2's three allowlist states; R8's withdrawn empty-allowlist fallback; R6's record-backed re-dispatch count, non-penalized hand_back and UI Before/After evidence gate; R7's per-turn sweep and clause deletion test; R5's [Limits] rule that every cap states what it bounds, in what unit, the cap, and whether it accumulates, plus the [Compact Delta Brief] default; R0's impact-not-effort stop; the standing subagent contract, report protocol and coordinator-only tool list; and R9, adapted so plan mode stays the user's switch—this deployment mounts no enter_plan_mode row, and the dispatcher never asks the user for it); the text is written one decision sentence per rule (upstream's compact register, which took the block from about 35,000 to 24,600 characters while every correction and addition stayed), corrections are applied in place rather than appended as a contradicting second copy, `DISPATCHER_RULES_PROVENANCE` records every correction and every addition along with the upstream commit it came from, `DISPATCHER_RULES_PROVENANCE.omissions` records the two upstream entries this preset deliberately does not carry, because each names a tool it does not mount (the `dispatch_ledger` tool and the `enter_plan_mode`/`leave_plan_mode` rows), and `node tools/check-dispatcher-rules.mjs` reports drift against an installed copy of the origin package. Switching it off returns the session to the bare persona with its working discipline. It is orthogonal to `presentation`: `presentation` decides the tool surface, `dispatcher` decides the identity and the process discipline. |
121
+ | `dispatcher` | `true` | Identity switch: when true (the shipped default), the declared preset appends the dispatcher rules section after the persona — complexity triage (L0/L1 direct; L2 split into L2-Clear, which plans briefly then executes, and L2-Governed, which runs the clarification interview and a plan approval), a shared task board that is bookkeeping rather than a second dispatcher (the R0.5 compatibility gate was deleted upstream at 0.72.0 once a new harness removed the legacy Agent Teams runtime entirely, so its criterion can only ever answer absent; the generation-independent board contract survives as a standing paragraph), an interview before planning on an L2-Governed task, the Lead & Dispatch identity with its three execution topologies (Lead-Core, Hybrid, Fan-out) chosen by coupling against parallel ROI, the R9 plan pipeline (plan mode is the user's switch: inside it the plan is explored, written, and submitted through `exit_plan_mode`; outside it the dispatcher plans and then executes), delegation with layer-by-layer review and acceptance, and task tracking in `todo_write` — then a local English supplement with the interview additions, one rule that keeps the task board a tracking surface rather than a dispatch path, and one that keeps a pinned fact an anchor rather than current state. The block is maintained in this repository: it was re-extracted on 2026-10-18 and re-synced on 2026-11-02 against 0.55.0, again on 2026-11-03 against 0.56.0 plus that package's unreleased Agent Teams pass, and again on 2026-11-13 against 0.72.0 (twenty-three anti-patterns; the R0.5 gate deleted and its board contract kept as a standing paragraph; the L2-Clear / L2-Governed split plus [Execution Economy]'s stop-after-two-steps-without-progress brake in R0; G4 now searches external prior art (GitHub docs/repos, official docs, research papers, specs) instead of asking the user; the R1 execution topologies; the Lead & Dispatch identity; R2's Harness 0.2.2 note that an explicit route may still be limited to the parent route; R8 restated against the planned direct execution R1 authorizes; R6's fix-and-reverify duty on a Lead-Core or Hybrid core; R2's three allowlist states; R8's withdrawn empty-allowlist fallback; R6's record-backed re-dispatch count, non-penalized hand_back and a UI evidence gate narrowed to regression-risk changes (pure copy, logic-only and additive work need none; with no reliable Before, an After plus a note suffices); R7's per-turn sweep and clause deletion test; R5's [Limits] rule that every cap states what it bounds, in what unit, the cap, and whether it accumulates, plus the [Compact Delta Brief] default; R0's impact-not-effort stop; the standing subagent contract, report protocol and coordinator-only tool list; and R9, adapted so plan mode stays the user's switch—this deployment mounts no enter_plan_mode row, and the dispatcher never asks the user for it); the text is written one decision sentence per rule (upstream's compact register, which took the block from about 35,000 to about 22,200 characters while every correction and addition stayed), corrections are applied in place rather than appended as a contradicting second copy, `DISPATCHER_RULES_PROVENANCE` records every correction and every addition along with the upstream commit it came from, `DISPATCHER_RULES_PROVENANCE.omissions` records the two upstream entries this preset deliberately does not carry, because each names a tool it does not mount (the `dispatch_ledger` tool and the `enter_plan_mode`/`leave_plan_mode` rows), `DISPATCHER_RULES_PROVENANCE.removals` records the R0.5 gate upstream deleted and this block dropped with it, and `node tools/check-dispatcher-rules.mjs` reports drift against an installed copy of the origin package. Switching it off returns the session to the bare persona with its working discipline. It is orthogonal to `presentation`: `presentation` decides the tool surface, `dispatcher` decides the identity and the process discipline. |
122
122
  | `pagedToolPatterns` | `''` | On-demand tool families ("On-demand tool families" text field in the plugin settings card): comma-separated prefix patterns, each a non-empty literal head without `*` ending in one trailing `*` (for example `mcp__*, browser_*, task_board_*`). `parsePagedToolPatterns` trims entries, skips empty segments, and writes the parsed array into the declared preset's `tool-catalog`, `tool-activate`, and `working-context` rows together (all three replay the session event log against `pagedToolPatterns`, so keeping one shared list prevents catalog eviction, `tool_activate` admission, and the rendered working-context line from diverging and stranding a withheld namespace). Leaving the field empty or resetting it writes no override and inherits the preset's shipped seven-pattern list (`['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`); in the settings card, any malformed entry holds the draft unwritten, and on the Host any malformed string is ignored in favor of the shipped list. |
123
123
 
124
124
  All fields are editable in the web settings surface (plugin config) or through the profile patch (`dsh plugin` / `cordis.patch.yml`). Under the 0.1.7 settings contract a plugin's own Config IS its settings page: the Host serves one form per profile entry (the entry id `liangshen`, or the aggregate's generated `web-ui-liangshen` row) and every field is declared `volatile()`, so a write is committed into the running plugin instead of remounting its row. The preset-shaping fields (`presentation`, `dispatcher`, and `pagedToolPatterns`) then reach a session through the declaration: the plugin applies the committed values to the composition rows of `presets/liangshen/agent.cordis.yml` and re-declares the preset, so the settings surface — not the bundled file — is what the operator's sessions actually run. A row or key the composition does not carry is never invented: the overlay only narrows the shipped configuration. A change applies to sessions created after it; a session that already started keeps the composition it declared, because the registry refuses to recompose a started conversation.
@@ -138,7 +138,7 @@ All fields are editable in the web settings surface (plugin config) or through t
138
138
  - `run_code` needs a mounted PTC runtime (the shipped web and headless compositions mount `@deepseek-ai/dsh-ptc-runtime-node` as the `ptc-runtime` row); without one no PTC executor can be mounted, so the session runs the native surface;
139
139
  - The spawn delegation row enables child-model selection (`modelSelection: true` with `modelDiscovery: true`), so the settings page's subagent model-selection toggle is honored under this preset: the model sees `provider` / `model` / `reasoning_effort` on `subagent` and the `list_subagent_models` discovery tool, and an explicit route is checked against the Session's allowed list (without a recorded policy the effective route falls back to the parent's); the row also keeps the pre-split spelling `modelSelectionSettings: true`, because the SDK pinned in `devDependencies` reads only that key while the harness checkout this repository runs against no longer declares it, and each generation reads the key it knows while the other stays inert;
140
140
  - Exactly one delegation row in a composition scope may enable discovery. The upstream `modelDiscovery` flag registers `list_subagent_models` under a fixed tool name in the scope the row composes into, and the registry refuses a second registration of that name in one scope, so a second discovery owner fails the whole session instead of adding a second opt-in. The fork row therefore ships without it (as the builtin Standard, PTC, and Cordis presets ship it, which leave the route fields off there too), and the composition test counts the discovery owners structurally;
141
- - The `subagent-routes` row is the child-route guard. Once a Session recorded an allowed-route list, every delegation the row polices must resolve to an authorized route: an explicit `provider`/`model` pair on `subagent`, or the caller's own route on `subagent_fork` (and any teammate creator), whose inherited route is checked precisely because the tool cannot choose one. A refusal names the routes that would work; a route named on an inherit-only tool is refused as an override attempt; and a tool mounted without route fields is policed through the route its child would inherit instead of being asked for a pair no call could satisfy. The guard fails open on every fact it cannot read (no recorded policy, no session registry, no registry probe), so a Host that cannot answer keeps the harness's own delegation behavior, and `enabled: false` on the row turns it off entirely;
141
+ - The `subagent-routes` row is the child-route guard. Once a Session recorded an allowed-route list, every delegation the row polices must resolve to an authorized route: an explicit `provider`/`model` pair on `subagent`, or the caller's own route on `subagent_fork`, whose inherited route is checked precisely because the tool cannot choose one. A refusal names the routes that would work; a route named on an inherit-only tool is refused as an override attempt; and a tool mounted without route fields is policed through the route its child would inherit instead of being asked for a pair no call could satisfy. The guard fails open on every fact it cannot read (no recorded policy, no session registry, no registry probe), so a Host that cannot answer keeps the harness's own delegation behavior, and `enabled: false` on the row turns it off entirely;
142
142
  - The `dispatch-guard` row is the execution-time counterpart of the coordinator rules. A delegated caller is refused `ask_user_question`, `create_goal`, `update_goal` and `exit_plan_mode` with `DELEGATED_CALLER` (the other three names on its frozen list are not mounted in this deployment, and stay listed so the rule survives a roster change), and it is refused a pure-sleep `bash` / `pwsh` / `win_bash` wait while it still has a running child — `ACTIVE_CHILD_SLEEP_FORBIDDEN` — because the completion notification, not a timer, is what ends that turn. A compound command that does real work and any `run_in_background` call are left alone. The row registers through `ctx.tools.guard()` alone, so the tool declaration surface does not move and a cache-prefix provider never rebuilds because of it; it fails open on every fact it cannot read (no guard seam, no session lineage, no live root set, no child listing), so a Host that cannot answer keeps the harness's own behavior, and `enabled: false` on the row turns it off entirely;
143
143
  - The roster does not publish the `workflow` tool, while the workflow engine stays mounted for `ralph`;
144
144
  - The shell mounts the upstream standard Stdio stack, registering `bash` on POSIX and `pwsh` on win32 — each host mounts exactly one shell tool, featuring concise description title cards and deterministic exit codes;
@@ -146,7 +146,7 @@ All fields are editable in the web settings surface (plugin config) or through t
146
146
  - The preset carries the same trust level as shell access — review `presets/liangshen/` before installing;
147
147
  - The plugin makes no network requests and adds no telemetry;
148
148
  - Do not switch presets mid-conversation;
149
- - Requires DSH 0.2.2-rc.2+ (preset mechanism, the `system-prompt/assemble` waterfall, the persona `prefix` schema, and the PTC presentation API).
149
+ - Requires DSH 0.2.2-rc.3+ (preset mechanism, the `system-prompt/assemble` waterfall, the persona `prefix` schema, and the PTC presentation API).
150
150
 
151
151
  ## License
152
152
 
package/README.zh.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <p align="center">
6
6
  <img src="https://img.shields.io/npm/v/@linxin666/dsh-liangshen?style=flat-square" alt="Version">
7
7
  &nbsp;
8
- <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.2-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
8
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.3-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
9
9
  &nbsp;
10
10
  <img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
11
11
  </p>
@@ -118,7 +118,7 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
118
118
  | `enabled` | `true` | 总开关:关闭后不声明预设、也不发公告。 |
119
119
  | `announceToAgent` | `false` | 按需开启:开启后向 agent 系统提示注入本插件公告。默认关闭,保持系统提示词干净。 |
120
120
  | `presentation` | `ptc` | 本插件所声明 preset 的 wire 呈现。取值写进 `tool-catalog` 行并驱动组合:它启用的 `@deepseek-ai/dsh-tool-executor-ptc` 行**就是** wire,`ptc` 因此收拢为 `run_code`、`native` 保持原生清单,目录文本描述的就是该组合产生的面。Host 提交改动后立即重新声明 preset,此后新建的会话即采用新值;已开始的会话保持其已声明的组合。已删除的 `both` 取值在注册时被拒绝——旧 profile 请迁移为 `ptc` 或 `native`。 |
121
- | `dispatcher` | `true` | 身份开关:开启时(出厂默认)所声明的 preset 在 persona 之后追加调度者规则段——复杂度分诊(L0/L1 直接执行,L2 走完整流程)、区分两代 Agent Teams 的 R0.5 兼容性闸门(legacy 运行期带 spawn_teammate 并顶替协调工具,现行运行期只是在原生子代理之上加一块共享任务板)、L2 任务先澄清访谈再规划、Lead & Dispatch 身份与按「耦合度 × 并行收益」三选一的执行拓扑(Lead-Core / Hybrid / Fan-out)、R9 计划模式管线(计划模式是用户的开关:已经在该模式里就只读探索、写计划、经 `exit_plan_mode` 提交;不在就照常规划后执行,不向用户索要这个模式)、派发子代理并逐层审查与验收,以及落在 `todo_write` 的任务跟踪——其后是本地英文补充:访谈类新增内容,加上让任务看板停在做跟踪的表面、而不是派发路径的那一条,以及让登记的事实保持为锚点、而不是当前状态的那一条。这个块在本仓维护:2026-10-18 重新抽取,2026-11-02 按 0.55.0 同步,2026-11-03 再按 0.56.0 及该包尚未发布的 Agent Teams 改动同步一次(二十五条反模式;R1 的三套执行拓扑;Lead & Dispatch 身份;R2 补上 Harness 0.2.2 起显式路由可能仍受父路由限制;R8 改为相对 R1 授权的计划内直执来定义;R6 补上 Lead-Core / Hybrid 主干上「先修后交付」;R0.5 按现行内置 team 重写——它对原生子代理只多加一块共享任务板,且该任务板始终是 R5 任务书之下的记账面;R2 的 allowlist 三态;R8 被撤回的空 allowlist 兜底;R6 记录化的重派次数、不罚 hand_back、以及界面的 Before/After 证据门;R7 每轮扫描即将升级或过期的项,以及删除测试;R5 的 [Limits] 规则——每个上限都写明它约束什么、单位、上限值、以及是否累计,外加 [Compact Delta Brief] 的精简任务书默认形态;R0 的「按影响而非按工作量停手」;常设子代理契约、报告协议与主控专用工具清单;以及 R9——按「计划模式是用户的开关」做了适配:本部署没有 enter_plan_mode 行,调度者也不主动向用户索要它);行文按上游那套精简写法处理——每条规则一句判定,正文从约 35,000 字符压到 24,600 字符,而每一条更正与新增都保留;更正就地应用,而不是作为一条自相矛盾的第二份副本追加;`DISPATCHER_RULES_PROVENANCE` 逐条记录每一次更正与每一处新增,并带上它来自的上游提交;`DISPATCHER_RULES_PROVENANCE.omissions` 记录本预设有意不带的两条上游内容,它们各自指向本预设没挂的工具(`dispatch_ledger` 工具,以及 `enter_plan_mode` / `leave_plan_mode` 两行);`node tools/check-dispatcher-rules.mjs` 对已安装的来源包报告漂移。关闭后回到仅含工作纪律的极简 persona。它与 `presentation` 正交:`presentation` 决定工具面,`dispatcher` 决定身份与流程纪律。 |
121
+ | `dispatcher` | `true` | 身份开关:开启时(出厂默认)所声明的 preset 在 persona 之后追加调度者规则段——复杂度分诊(L0/L1 直接执行;L2 分 L2-Clear 直接写计划后执行与 L2-Governed 走澄清访谈与计划审批)、共享任务板只是记账、不是第二个调度者(R0.5 兼容性闸门已随上游在 0.72.0 删除——新 harness 已整体移除旧代 Agent Teams 运行期,判据恒为缺席,与代次无关的任务板契约抽为常驻段保留)、L2 任务先澄清访谈再规划、Lead & Dispatch 身份与按「耦合度 × 并行收益」三选一的执行拓扑(Lead-Core / Hybrid / Fan-out)、R9 计划模式管线(计划模式是用户的开关:已经在该模式里就只读探索、写计划、经 `exit_plan_mode` 提交;不在就照常规划后执行,不向用户索要这个模式)、派发子代理并逐层审查与验收,以及落在 `todo_write` 的任务跟踪——其后是本地英文补充:访谈类新增内容,加上让任务看板停在做跟踪的表面、而不是派发路径的那一条,以及让登记的事实保持为锚点、而不是当前状态的那一条。这个块在本仓维护:2026-10-18 重新抽取,2026-11-02 按 0.55.0 同步,2026-11-03 再按 0.56.0 及该包尚未发布的 Agent Teams 改动同步一次,2026-11-13 又按 0.72.0 同步一次(二十三条反模式;删除 R0.5 闸门并把任务板契约留为常驻段;R0 补 L2-Clear / L2-Governed 分档与 [Execution Economy] 的「每步最多两次无进展就换招」闸门;G4 要求先检索外部先例(GitHub 文档与仓库、官方文档、论文、规范)再问用户;R1 的三套执行拓扑;Lead & Dispatch 身份;R2 补上 Harness 0.2.2 起显式路由可能仍受父路由限制;R8 改为相对 R1 授权的计划内直执来定义;R6 补上 Lead-Core / Hybrid 主干上「先修后交付」;R2 的 allowlist 三态;R8 被撤回的空 allowlist 兜底;R6 记录化的重派次数、不罚 hand_back、以及只对回归风险的界面改动要求 Before/After(纯文案、纯逻辑或新增改动不需要,无可靠 Before 时 After 加说明即可);R7 每轮扫描即将升级或过期的项,以及删除测试;R5 的 [Limits] 规则——每个上限都写明它约束什么、单位、上限值、以及是否累计,外加 [Compact Delta Brief] 的精简任务书默认形态;R0 的「按影响而非按工作量停手」;常设子代理契约、报告协议与主控专用工具清单;以及 R9——按「计划模式是用户的开关」做了适配:本部署没有 enter_plan_mode 行,调度者也不主动向用户索要它);行文按上游那套精简写法处理——每条规则一句判定,正文从约 35,000 字符压到约 22,200 字符,而每一条更正与新增都保留;更正就地应用,而不是作为一条自相矛盾的第二份副本追加;`DISPATCHER_RULES_PROVENANCE` 逐条记录每一次更正与每一处新增,并带上它来自的上游提交;`DISPATCHER_RULES_PROVENANCE.omissions` 记录本预设有意不带的两条上游内容,它们各自指向本预设没挂的工具(`dispatch_ledger` 工具,以及 `enter_plan_mode` / `leave_plan_mode` 两行),`DISPATCHER_RULES_PROVENANCE.removals` 记录上游已删除、本地随之移除的 R0.5 闸门;`node tools/check-dispatcher-rules.mjs` 对已安装的来源包报告漂移。关闭后回到仅含工作纪律的极简 persona。它与 `presentation` 正交:`presentation` 决定工具面,`dispatcher` 决定身份与流程纪律。 |
122
122
  | `pagedToolPatterns` | `''` | 按需工具族(插件设置卡片中的「按需工具族」文本字段):逗号分隔的前缀模式,每项为不含 `*` 的非空字面头部加单个结尾 `*`(例如 `mcp__*, browser_*, task_board_*`)。`parsePagedToolPatterns` 去空白、跳过空项后把解析出的数组同时写入所声明 preset 的 `tool-catalog`、`tool-activate` 与 `working-context` 三行(三行都按各自的 `pagedToolPatterns` 重放同一份会话日志,必须保持同源,否则目录的驱逐限制、`tool_activate` 的激活判定与 working-context 的状态投影会发生分叉,导致被扣留的命名空间无法再被重新激活)。留空或重置时不写覆盖项,继承 preset 出厂的 7 项清单(`['mcp__*', 'browser_*', 'task_board_*', 'team_*', 'squad*', 'ui_*', 'ssh_*']`);在设置卡片中,任一条目格式非法时草稿保持未写入状态,Host 侧收到含非法条目的文本时同样忽略并沿用出厂清单。 |
123
123
 
124
124
  各字段都可在 Web 设置界面(插件配置)或 profile patch(`dsh plugin` / `cordis.patch.yml`)中编辑。0.1.7 的设置契约下,插件自身的 Config 就是它的设置页:Host 为每个 profile entry 生成一张表单(entry id 为 `liangshen`,聚合安装下为生成的 `web-ui-liangshen` 行),每个字段都声明为 `volatile()`,因此写入被提交进运行中的插件实例,而不是重挂该行。塑造 preset 的字段(`presentation`、`dispatcher` 与 `pagedToolPatterns`)再经声明抵达会话:插件把已提交的取值应用到 `presets/liangshen/agent.cordis.yml` 的对应行并重新声明 preset,因此真正被会话运行的是设置界面的取值,而不是包内文件。组合里没有的行或键绝不会被凭空写入——覆写只会收窄出厂配置。改动对之后新建的会话生效;已开始的会话保持其已声明的组合,因为 registry 拒绝重组已开始的会话。
@@ -138,7 +138,7 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
138
138
  - `run_code` 需要挂载的 PTC runtime(随包发布的 web 与 headless 组合以 `ptc-runtime` 行挂载 `@deepseek-ai/dsh-ptc-runtime-node`);没有时无法挂载 PTC 执行器,会话运行原生工具面;
139
139
  - spawn 委派行已开启子 agent 模型选择(`modelSelection: true` 与 `modelDiscovery: true`),因此设置界面的子智能体模型选择开关在本预设下生效:模型在 `subagent` 上看到 `provider` / `model` / `reasoning_effort` 参数与 `list_subagent_models` 发现工具,显式路由会按会话的允许清单校验(没有已记录的策略时退回父会话当前路由);该行同时保留拆分前的写法 `modelSelectionSettings: true`:`devDependencies` 里钉的 SDK 只认这一个键,而本仓库运行所对的 harness checkout 已不再声明它,两代各读自己认识的键,另一个保持惰性;
140
140
  - 同一组合 scope 内只允许一行委派工具开启发现:上游 `modelDiscovery` 以固定工具名在该行所合入的 scope 中注册 `list_subagent_models`,而注册表拒绝同一 scope 内同名工具的第二次注册,因此第二个开启行会让整个会话创建失败而不是多出一份能力。fork 行因此不带它(官方 Standard、PTC、Cordis 预设同样如此,且它们连路由字段也不开),组合测试按结构统计发现工具的所有者;
141
- - `subagent-routes` 行是子路由守卫。一旦会话记录了允许路由清单,本行所管辖的每次委派都必须落到已授权路由上:`subagent` 上显式的 `provider`/`model` 对,或 `subagent_fork`(以及任何创建 teammate 的工具)上调用方自己的路由——后者的继承路由正是因为工具无法自选才需要校验。拒绝时会列出可用路由;在只继承的工具上点名路由会作为越权重路由被拒;没挂路由字段的工具不索要它给不出的参数,而是按子代理将要继承的路由校验。守卫对任何读不到的事实一律放行(未记录策略、无会话注册表、无注册表探针),因此答不出来的宿主保持 harness 原本的委派行为;行上的 `enabled: false` 可整体关闭;
141
+ - `subagent-routes` 行是子路由守卫。一旦会话记录了允许路由清单,本行所管辖的每次委派都必须落到已授权路由上:`subagent` 上显式的 `provider`/`model` 对,或 `subagent_fork` 上调用方自己的路由——后者的继承路由正是因为工具无法自选才需要校验。拒绝时会列出可用路由;在只继承的工具上点名路由会作为越权重路由被拒;没挂路由字段的工具不索要它给不出的参数,而是按子代理将要继承的路由校验。守卫对任何读不到的事实一律放行(未记录策略、无会话注册表、无注册表探针),因此答不出来的宿主保持 harness 原本的委派行为;行上的 `enabled: false` 可整体关闭;
142
142
  - `dispatch-guard` 行是调度者规则的执行期对应物。被委派的调用方调用 `ask_user_question`、`create_goal`、`update_goal`、`exit_plan_mode` 会被 `DELEGATED_CALLER` 拒绝(冻结清单上另外三个工具本部署没有挂载,保留在名单里是为了让规则在工具面变动后依然成立);它还有在跑的子代理时,纯等待的 `bash` / `pwsh` / `win_bash` 会被 `ACTIVE_CHILD_SLEEP_FORBIDDEN` 拒绝——结束那一轮的是完成通知,不是计时器。带真实工作的复合命令与任何 `run_in_background` 调用都不拦。本行只走 `ctx.tools.guard()` 一条接缝,工具声明面不动,按前缀计费的线路不会因为它重建缓存;任何读不到的事实一律放行(无守卫接缝、无会话血缘、无存活根集合、无子代清单),因此答不出来的宿主保持 harness 原本的行为;行上的 `enabled: false` 可整体关闭;
143
143
  - 清单不发布 `workflow` 工具,而 workflow 引擎仍为 `ralph` 保留挂载;
144
144
  - shell 挂载上游标准 Stdio 栈,POSIX 注册 `bash`,win32 注册 `pwsh`——每个宿主恰好挂一个 shell 工具,带简短功能描述标题卡片与确定性退出码;
@@ -146,7 +146,7 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
146
146
  - preset 与 shell 访问具有相同信任等级,安装前可自行审阅 `presets/liangshen/`;
147
147
  - 插件不发起网络请求,也不增加遥测;
148
148
  - 不要在已经产生内容的会话中途切换 preset;
149
- - 需要 DSH 0.2.2-rc.2+(preset 机制、`system-prompt/assemble` 瀑布、persona 的 `prefix` schema,以及 PTC 呈现 API)。
149
+ - 需要 DSH 0.2.2-rc.3+(preset 机制、`system-prompt/assemble` 瀑布、persona 的 `prefix` schema,以及 PTC 呈现 API)。
150
150
 
151
151
  ## 许可
152
152
 
package/lib/client.js CHANGED
@@ -352,6 +352,14 @@ window.__ModuleLoader__.load({
352
352
  /** Ceiling on one in-flight switch, so a lost Remote answer cannot hang the row. */
353
353
  selectTimeoutMs;
354
354
  disposers = [];
355
+ /** The one face this controller hands out: the view reads it on every render. */
356
+ cachedFace;
357
+ /**
358
+ * The translator bound to this plugin's locale namespace, resolved on first
359
+ * use. A lookup that resolved nothing is never cached, so a locale service
360
+ * registered after activation still reaches the same face.
361
+ */
362
+ cachedTranslate;
355
363
  constructor(ctx, options = {}) {
356
364
  this.ctx = ctx;
357
365
  this.selectTimeoutMs = options.selectTimeoutMs ?? 1e4;
@@ -385,9 +393,11 @@ window.__ModuleLoader__.load({
385
393
  dispose() {
386
394
  for (const dispose of this.disposers.splice(0)) dispose();
387
395
  }
388
- /** The inject face handed to the slot entry. */
396
+ /** The inject face handed to the slot entry; the same instance on every read. */
389
397
  face() {
390
- return {
398
+ const cached = this.cachedFace;
399
+ if (cached !== void 0) return cached;
400
+ const face = {
391
401
  store: this.store,
392
402
  pull: () => {
393
403
  this.toggle("down");
@@ -396,10 +406,25 @@ window.__ModuleLoader__.load({
396
406
  this.toggle("up");
397
407
  },
398
408
  t: (key, vars) => {
399
- const translate = readService(() => this.ctx.locale.bind("liangshen"));
409
+ const translate = this.translate();
400
410
  return translate === void 0 ? key : translate(key, vars);
401
411
  }
402
412
  };
413
+ this.cachedFace = face;
414
+ return face;
415
+ }
416
+ /**
417
+ * The translator bound to this plugin's locale namespace, or undefined while
418
+ * none answers. The binding is resolved once and only on success: a locale
419
+ * service that arrives later than this controller still gets its chance.
420
+ */
421
+ translate() {
422
+ const cached = this.cachedTranslate;
423
+ if (cached !== void 0) return cached;
424
+ const bound = readService(() => this.ctx.locale.bind("liangshen"));
425
+ if (typeof bound !== "function") return void 0;
426
+ this.cachedTranslate = bound;
427
+ return bound;
403
428
  }
404
429
  /** Read the roster; a refusal leaves the lever as it was. */
405
430
  async load() {
@@ -424,8 +449,7 @@ window.__ModuleLoader__.load({
424
449
  const facts = this.facts();
425
450
  const snapshot = this.store.getSnapshot();
426
451
  const state = leverState(facts);
427
- const target = restoreTarget(facts);
428
- const restoreLabel = target === void 0 ? "" : this.labelOf(target);
452
+ const restoreLabel = facts.blank ? this.restoreLabelOf(facts) : "";
429
453
  if (snapshot.state === state && snapshot.restoreLabel === restoreLabel) return;
430
454
  this.store.set({
431
455
  ...snapshot,
@@ -433,6 +457,11 @@ window.__ModuleLoader__.load({
433
457
  restoreLabel
434
458
  });
435
459
  }
460
+ /** Display name of the preset a push-up would restore; empty when there is none. */
461
+ restoreLabelOf(facts) {
462
+ const target = restoreTarget(facts);
463
+ return target === void 0 ? "" : this.labelOf(target);
464
+ }
436
465
  /** The verb behind one gesture direction. */
437
466
  async toggle(direction) {
438
467
  const snapshot = this.store.getSnapshot();
@@ -519,20 +548,34 @@ window.__ModuleLoader__.load({
519
548
  if (typeof sessionStorage !== "undefined") sessionStorage.setItem("dsh-liangshen:previous-preset", presetId);
520
549
  } catch {}
521
550
  }
522
- /** The facts one decision reads, from the live session and the roster. */
551
+ /**
552
+ * The facts one decision reads, from the live session and the roster.
553
+ *
554
+ * `previous` is resolved only for a blank session: it exists to name the
555
+ * preset a push-up restores, and only a blank session may switch preset at
556
+ * all. Resolving it costs a DOM chip lookup and a session-storage read
557
+ * ({@link detectPreset}), which a started session -- reported as 'locked' or
558
+ * 'missing' -- would pay for on every roster and session update and never use.
559
+ */
523
560
  facts() {
524
561
  const summary = this.currentSession();
525
562
  const available = this.rows.filter((row) => row.broken === void 0).map((row) => row.id);
526
563
  const fallback = this.rows.find((row) => row.isDefault)?.id;
527
564
  const currentPreset = presetOf(summary);
565
+ const blank = summary?.blank === true;
566
+ if (!blank) return {
567
+ blank,
568
+ agentPreset: currentPreset,
569
+ available,
570
+ fallback
571
+ };
528
572
  if (currentPreset !== void 0 && currentPreset !== "liangshen") this.rememberPrevious(currentPreset);
529
- const previous = this.previous ?? this.detectPreset();
530
573
  return {
531
- blank: summary?.blank === true,
574
+ blank,
532
575
  agentPreset: currentPreset,
533
576
  available,
534
577
  fallback,
535
- previous
578
+ previous: this.previous ?? this.detectPreset()
536
579
  };
537
580
  }
538
581
  currentSessionId() {