@linxin666/dsh-liangshen 0.4.8 → 0.4.9

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.
Files changed (35) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +10 -8
  3. package/README.zh.md +10 -8
  4. package/lib/client.js +87 -54
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +9 -1
  7. package/lib/types/client/PluginSettingsCard.d.ts +21 -0
  8. package/package.json +15 -15
  9. package/presets/liangshen/agent.cordis.yml +76 -18
  10. package/presets/liangshen/dispatcher-rules.mjs +128 -47
  11. package/presets/liangshen/fact-ledger.mjs +14 -0
  12. package/presets/liangshen/subagent-routes.mjs +396 -0
  13. package/presets/liangshen/tool-catalog.mjs +7 -4
  14. package/src/client/PluginSettingsCard.tsx +78 -18
  15. package/src/client/settings-card.module.css +71 -10
  16. package/src/composition.test.ts +20 -0
  17. package/src/composition.ts +10 -2
  18. package/tools/benchmark-live-run.mjs +116 -14
  19. package/tools/benchmark-report.mjs +44 -0
  20. package/tools/check-dispatcher-rules.mjs +130 -0
  21. package/tools/probe-selftest.mjs +130 -0
  22. package/tools/probes/budget-ledger/env.mjs +103 -0
  23. package/tools/probes/budget-ledger/grade.mjs +31 -0
  24. package/tools/probes/budget-ledger/strategies.mjs +25 -0
  25. package/tools/probes/oncall-backlog/env.mjs +141 -0
  26. package/tools/probes/oncall-backlog/grade.mjs +28 -0
  27. package/tools/probes/oncall-backlog/strategies.mjs +37 -0
  28. package/tools/probes/prior-override/env.mjs +153 -0
  29. package/tools/probes/prior-override/grade.mjs +31 -0
  30. package/tools/probes/prior-override/strategies.mjs +30 -0
  31. package/tools/probes/refresh-quota/env.mjs +140 -0
  32. package/tools/probes/refresh-quota/grade.mjs +30 -0
  33. package/tools/probes/refresh-quota/strategies.mjs +29 -0
  34. package/tools/probes/shared.mjs +75 -0
  35. package/tools/tasks/liangshen-v41-probes.json +59 -0
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: fcadb5c2ab0a74c4b61435a869e97b9c1df87e49
6
- README.zh.md: 2708a979569921f4c3df9bd3507d9bf97b69cdf1
5
+ README.md: fe4fa4d464932bf32c03d103d1a499d5f8702f01
6
+ README.zh.md: 3ac7fc04be794992448a186ce9e70e6055120f4d
package/README.md CHANGED
@@ -66,7 +66,7 @@ The preset-local plugins are configured in `agent.cordis.yml`:
66
66
  | `instructionSource` | `host` | Where workspace instructions reach the model. `host` (the default) appends no section of its own and leaves the harness's agent-instructions injection untouched, so the instructions arrive as the harness's own user-role messages: one persistent baseline plus incremental additions, replacements, and removals as directories are touched; `system-prompt` reads the AGENTS.md-style chain at assembly time and appends it to the system prompt (the harness's own injections are dropped); `hint` replaces the first injection with a one-time non-imperative reference-file hint and drops later ones. |
67
67
  | `instructionMaxBytes` | `65536` | Byte budget for the rendered workspace-instructions section, used only in `system-prompt` mode: broadest files are omitted first, the most specific file is truncated last. |
68
68
  | `descriptionMaxLength` | `200` | Cap for one tool's one-line summary in the injected catalog, applied to every tool the curated table does not name. A curated host builtin renders its hand-written line whole. Complete key parameter semantics remain fully preserved. |
69
- | `presentation` | `ptc` | Wire presentation for the whole session. `ptc` (the shipped default) collapses the wire to `run_code` with every other tool reached through the generated SDK; `native` keeps the assembled native roster. `ptc` needs a mounted code runtime and degrades to `native` with a one-time warning when missing. The removed `both` mode is not accepted: an old profile naming it fails registration, so migrate the key to `ptc` or `native`. |
69
+ | `presentation` | `ptc` | Wire presentation for the whole session. `ptc` (the shipped default) collapses the wire to `run_code` with every other tool reached through the generated SDK; `native` keeps the assembled native roster. The plugin declares the value on each agent scope through `agent.ctx.tools.presentAs` — the SDK's tool-presentation API — as soon as the scope exists, then re-assembles so the declaration reaches the request the model receives. The composition carries no executor row: 0.2.1-rc.3 selects the presentation through that API and publishes no `@deepseek-ai/dsh-tool-executor-ptc`. A deployment with no PTC runtime, a declined declaration, or a scope that cannot reach the API keeps the native surface and warns once. The removed `both` mode is not accepted: an old profile naming it fails registration, so migrate the key to `ptc` or `native`. |
70
70
  | `pagedToolPatterns` | `['mcp__*']` | Gentle paging ships on: matching MCP tools are held back from the wire and the generated SDK until activated through `tool_activate({ namespace })`. Held-back namespaces appear in the catalog as one-line summaries. At most three paged namespaces stay active at once, rebuilt from the event stream. |
71
71
  | `maxResidentTokens` | `8000` | Estimated-token ceiling for the always-on-wire surface (the serialized schemas at roughly four characters per token), re-estimated for V4.1's compressed KV cache and still calibrated above the shipped roster so it flags real growth rather than the factory configuration. Crossing it warns once, names the heaviest tools, and points at `pagedToolPatterns`; it never truncates the roster. |
72
72
  | `ptcPresentation` | (retired) | Legacy alias: `true` maps to `presentation: 'ptc'` and `false` to `'native'`, both with a deprecation warning. |
@@ -108,7 +108,8 @@ When validating mode behavior and evaluating performance, verification tiers mus
108
108
  - **Real inference probe**: Verifies only transport connectivity and minimal model response capability to specific formats (e.g. using a headless probe to verify output parsing); a single successful probe demonstrates absence of blockers, but never that mode integration has succeeded.
109
109
  - **Mode integration pass**: Requires full session verification of complete headers, the configured presentation behavior, paged activation and eviction, SDK parameter semantics under `run_code`, and sandbox policy enforcement.
110
110
  - **Statistical improvement**: Must be evaluated across multiple comparative benchmark rounds in an isolated environment with recorded fixed routes and source hashes, evaluating task completion rate, tool failure rate, rule violation rate, human intervention frequency, and time/token costs. Single or few smoke runs do not constitute evidence of performance improvement.
111
- 2. **Benchmark tooling**: the isolated runner is `packages/dsh-liangshen/tools/benchmark-live-run.mjs`. It materializes the evaluated preset into a temporary directory and declares it from the run's own agent-preset registry through a variant patch, redirects session persistence into the run directory, and records a baseline (repository commit, shipped preset hash, DSH version, fixed route, task revision) with every run. The candidate matrix isolates the persona and the presentation strategy: `B` (shipped defaults), `P` (candidate persona), `N` (candidate persona, full native roster throughout), and `M` (the bundle's official Minimal preset, an external reference rather than a single-factor arm); the retired `both` presentation arm left with the SDK mode it measured. Run one smoke case with `node tools/benchmark-live-run.mjs --variant B`, or the bounded matrix over the seed corpus with `node tools/benchmark-live-run.mjs --tasks tools/tasks/liangshen-v41-flash.json --groups B,P,N,M --repeat 3 --max-sessions 60 --budget-cny 10 --prices tools/prices/deepseek-flash.json`; aggregate the run records in a results directory with `node tools/benchmark-report.mjs .benchmark-results`, which reports per-group success rates with Wilson intervals, paired per-task deltas with confidence intervals, token totals, cost in the price book's currency, model tool errors and transport failures separately, research calls and the inspections preceding the first write, infrastructure failures separately, and the recorded baseline. Cost is CNY because the route bills in CNY, and `tools/prices/deepseek-flash.json` carries the published off-peak row: a peak-hour run costs double what the book records. A budget the run cannot price is refused rather than silently disarmed. A tool result whose error carries a `WEB_*` code counts as a transport failure, so a workspace that could not reach a host never reads as a model that guessed. Smoke runs validate the protocol and the cost estimate; they are not evidence of a general coding gain.
111
+ 2. **Behaviour probes**: four small deterministic environments live in `tools/probes/`, one per behaviour this mode is meant to have — taking the strictest reading of an under-specified rule, spending a per-cycle quota on checks that cannot fail, letting a low-priority backlog run to escalation, and planning a call budget until nothing is left to submit. Each ships an oracle (`grade.mjs`) and two scripted policies (`strategies.mjs`); `node tools/probe-selftest.mjs` drives both through the same environment and fails unless the good policy passes, the bad one fails, and the named metric moves, so a probe that cannot discriminate is caught for free before any model is charged. The corpus is `tools/tasks/liangshen-v41-probes.json`, whose tasks carry `from` (a directory plus support files, materialised into the task workspace) and `metrics` (the same program shape as `check`, printing one JSON object of behavioural numbers that the report aggregates into its own per-group table beside the pass rate). Pass a route to a probe run with `--route provider/model[/effort]`; the default stays the fixed route so an aggregated comparison still reads one route per report.
112
+ 3. **Benchmark tooling**: the isolated runner is `packages/dsh-liangshen/tools/benchmark-live-run.mjs`. It materializes the evaluated preset into a temporary directory and declares it from the run's own agent-preset registry through a variant patch, redirects session persistence into the run directory, and records a baseline (repository commit, shipped preset hash, DSH version, fixed route, task revision) with every run. The candidate matrix isolates the persona and the presentation strategy: `B` (shipped defaults), `P` (candidate persona), `N` (candidate persona, full native roster throughout), and `M` (the bundle's official Minimal preset, an external reference rather than a single-factor arm); the retired `both` presentation arm left with the SDK mode it measured. Run one smoke case with `node tools/benchmark-live-run.mjs --variant B`, or the bounded matrix over the seed corpus with `node tools/benchmark-live-run.mjs --tasks tools/tasks/liangshen-v41-flash.json --groups B,P,N,M --repeat 3 --max-sessions 60 --budget-cny 10 --prices tools/prices/deepseek-flash.json`; aggregate the run records in a results directory with `node tools/benchmark-report.mjs .benchmark-results`, which reports per-group success rates with Wilson intervals, paired per-task deltas with confidence intervals, token totals, cost in the price book's currency, model tool errors and transport failures separately, research calls and the inspections preceding the first write, infrastructure failures separately, and the recorded baseline. Cost is CNY because the route bills in CNY, and `tools/prices/deepseek-flash.json` carries the published off-peak row: a peak-hour run costs double what the book records. A budget the run cannot price is refused rather than silently disarmed. A tool result whose error carries a `WEB_*` code counts as a transport failure, so a workspace that could not reach a host never reads as a model that guessed. Smoke runs validate the protocol and the cost estimate; they are not evidence of a general coding gain.
112
113
 
113
114
  ## Configuration
114
115
 
@@ -116,8 +117,8 @@ When validating mode behavior and evaluating performance, verification tiers mus
116
117
  | --- | --- | --- |
117
118
  | `enabled` | `true` | Master switch: when false, the preset is not declared and the announcement does not run. |
118
119
  | `announceToAgent` | `false` | Opt-in: when true, a system-prompt section announces the plugin. Off by default so agent system prompts stay clean. |
119
- | `presentation` | `ptc` | Wire presentation written into the `tool-catalog` row of the preset this plugin declares: `ptc` (default) collapses the wire to `run_code` with every other tool reached through the generated SDK; `native` keeps the assembled roster. 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`. |
120
- | `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 refuses Agent Teams, an interview before planning on an L2 task, delegation with layer-by-layer review and acceptance, and task tracking in `todo_write` — then a local English supplement with the interview additions and the one rule the reference text does not carry: a task-board card is not a substitute for a dispatch. 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. |
120
+ | `presentation` | `ptc` | Wire presentation of the preset this plugin declares. The value is written into the `tool-catalog` row, whose declaration through `agent.ctx.tools.presentAs` IS the wire: `ptc` collapses it to `run_code`, `native` keeps the assembled roster, and the catalog text describes the surface that declaration 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 refuses Agent Teams, an interview before planning on an L2 task, 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 from the lineage its origin package publishes (twenty anti-patterns, R2's three allowlist states, R8's withdrawn empty-allowlist fallback, R6's record-backed re-dispatch count, R7's per-turn sweep over items that escalate or expire, and R5's [Limits] rule that every cap states what it bounds, in what unit, the cap, and whether it accumulates); corrections are applied in place rather than appended as a contradicting second copy, `DISPATCHER_RULES_PROVENANCE` records every one of them, 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
122
 
122
123
  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 presentation field then reaches 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.
123
124
 
@@ -133,16 +134,17 @@ All fields are editable in the web settings surface (plugin config) or through t
133
134
  - Paged tools (default pattern `mcp__*`) stay off the wire until the model activates their namespace through `tool_activate`; at most three paged namespaces are active at once, activating a fourth evicts the least recently used one back to its summary, and activation state is rebuilt from the durable event stream after compactions and resumes. Under `ptc` the page also restricts the scope's tool registry, so an unactivated namespace is unreachable from inside a `run_code` program too;
134
135
  - The working-context line is injected only when its sources (plan-mode state, active paged namespaces, in-progress todos) are readable, and omitted otherwise;
135
136
  - Tool results are pruned once they exceed 4096 characters, keeping a 2048-character head and a 1024-character tail (guarding the sparse-index slots while preserving the error tail and exit code), so oversized outputs do not crowd the context;
136
- - `run_code` needs a mounted code runtime (the shipped web and headless compositions mount `dsh-code-runtime-worker-thread`); without one, `ptc` declares nothing and the session runs the native surface;
137
- - The spawn delegation row opts into child-model selection (`modelSelectionSettings: 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;
138
- - Exactly one delegation row in a composition scope may opt in. The upstream opt-in 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 opt-in row fails the whole session instead of adding a second opt-in. The fork row therefore ships without the flag (as the builtin Standard, PTC, and Cordis presets ship it), and the composition test counts the opt-ins structurally;
137
+ - `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, `ptc` declares nothing and the session runs the native surface;
138
+ - 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;
139
+ - 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;
140
+ - 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;
139
141
  - The roster does not publish the `workflow` tool, while the workflow engine stays mounted for `ralph`;
140
142
  - 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;
141
143
  - The file tools inherit the host file sandbox (no bare `dsh-fs-local` filesystem);
142
144
  - The preset carries the same trust level as shell access — review `presets/liangshen/` before installing;
143
145
  - The plugin makes no network requests and adds no telemetry;
144
146
  - Do not switch presets mid-conversation;
145
- - Requires DSH 0.2.1-rc.2+ (preset mechanism, the `system-prompt/assemble` waterfall, the persona `prefix` schema, and the PTC presentation API).
147
+ - Requires DSH 0.2.1-rc.3+ (preset mechanism, the `system-prompt/assemble` waterfall, the persona `prefix` schema, and the PTC presentation API).
146
148
 
147
149
  ## License
148
150
 
package/README.zh.md CHANGED
@@ -66,7 +66,7 @@ DeepSeek V4.1 Flash 的后训练直接对齐其原生 DSML 工具调用面,官
66
66
  | `instructionSource` | `host` | 工作区指令送达模型的方式。`host`(默认)不追加任何自有段,也不改动宿主的 agent-instructions 注入,工作区指令以宿主自己的 user 角色消息送达:一条持久基线,加上触碰目录后的增量、替换与移除;`system-prompt` 在组装时读取 AGENTS.md 链并追加进系统提示词(harness 自己的注入被丢弃);`hint` 把首次注入替换为一次性的、非命令式的参考文件提示,后续注入丢弃。 |
67
67
  | `instructionMaxBytes` | `65536` | 渲染后的 workspace-instructions 段的字节预算,仅在 `system-prompt` 模式下生效:最宽的文件先被省略,最具体的文件最后被截断。 |
68
68
  | `descriptionMaxLength` | `200` | 注入目录中单个工具一行摘要的长度上限,作用于所有未被策展表覆盖的工具;被策展的宿主内置工具直接使用整行手写短描述。完整关键参数语义保持完整。 |
69
- | `presentation` | `ptc` | 整个会话的 wire 呈现方式。`ptc`(出厂默认)把 wire 收拢为 `run_code`,其余工具经生成的 SDK 调用;`native` 保持组装出的原生清单。`ptc` 需要挂载的 code runtime;没有时插件根本不做声明,会话直接运行原生工具面。已删除的 `both` 取值不被接受:旧 profile 写明它会在注册时被拒绝,请迁移为 `ptc` 或 `native`。 |
69
+ | `presentation` | `ptc` | 整个会话的 wire 呈现方式。`ptc`(出厂默认)把 wire 收拢为 `run_code`,其余工具经生成的 SDK 调用;`native` 保持组装出的原生清单。插件在 agent scope 一出现时就通过 `agent.ctx.tools.presentAs`(SDK 的工具呈现 API)声明该取值,并重新组装一次,使声明落到模型真正收到的请求上。组合里没有执行器行:0.2.1-rc.3 通过该 API 选择呈现,也不发布 `@deepseek-ai/dsh-tool-executor-ptc`。部署没有 PTC runtime、宿主拒绝声明、或 scope 拿不到该 API 时保持原生面并告警一次。已删除的 `both` 取值不被接受:旧 profile 写明它会在注册时被拒绝,请迁移为 `ptc` 或 `native`。 |
70
70
  | `pagedToolPatterns` | `['mcp__*']` | 出厂开启温和分页:命中的 MCP 工具被扣留在 wire 与生成的 SDK 之外,直到模型通过 `tool_activate({ namespace })` 激活其命名空间。被扣留的命名空间在目录中以一行摘要出现。最多同时保持三个已激活的分页命名空间,激活状态从持久事件流重建。 |
71
71
  | `maxResidentTokens` | `8000` | 常驻 wire 面的估算 token 上限(按序列化 schema 约四字符一 token),按 V4.1 的 KV 压缩重新校准后仍高于出厂清单,用于发现真实增长而非出厂配置本身。超过时告警一次、列出最重的工具并指向 `pagedToolPatterns`;不会截断工具清单。 |
72
72
  | `ptcPresentation` | (已退役) | 旧别名:`true` 映射为 `presentation: 'ptc'`,`false` 映射为 `'native'`,两者都伴随弃用告警。 |
@@ -108,7 +108,8 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
108
108
  - **真实推理探针**:仅验证链路连通性与模型对特定格式的最小响应能力(例如使用 headless 探针验证模型是否能正常解析输出);单次探针成功仅代表功能未阻断,绝不证明模式集成已达标。
109
109
  - **模式集成通过**:要求在真实完整会话中,验证完整 header、所配置呈现行为、分页激活与驱逐、`run_code` 下的 SDK 参数语义解析与沙箱策略执行无误。
110
110
  - **统计显著性提升**:必须在固定 route 与源码 hash 记录的隔离环境中进行多轮对比评测,综合评估任务完成率、工具失败率、规则违反率、人工介入次数与耗时/token 开销。单次或少数 smoke 运行不构成效果提升的证据。
111
- 2. **评测工具**:隔离 runner 位于 `packages/dsh-liangshen/tools/benchmark-live-run.mjs`:它把被评测 preset 物化到临时目录,并通过 variant patch 在本轮自己的 agent-preset registry 中声明它,把会话持久化改写到本次运行目录,并为每次运行记录基线(仓库提交、出厂 preset hash、DSH 版本、固定 route、任务版本)。候选矩阵隔离 persona 与呈现策略两个因素:`B`(出厂默认)、`P`(候选 persona)、`N`(候选 persona,全程原生清单)、以及 `M`(内置包官方 Minimal preset,仅作外部参照而非单因素对照);随着 SDK 删除 `both` 呈现,测量该呈现的对照臂 `T` 一并退役。单次 smoke 用 `node tools/benchmark-live-run.mjs --variant B`,按种子任务集跑有界矩阵用 `node tools/benchmark-live-run.mjs --tasks tools/tasks/liangshen-v41-flash.json --groups B,P,N,M --repeat 3 --max-sessions 60 --budget-cny 10 --prices tools/prices/deepseek-flash.json`,再用 `node tools/benchmark-report.mjs .benchmark-results` 汇总结果目录:按组给出成功率与 Wilson 区间、按任务配对差值与置信区间、token 合计、按价格书币种计的费用、分列的模型工具错误与传输失败、研究调用次数与首次写入前的检查次数、单独列出的基础设施失败以及记录的基线。费用以 CNY 计,因为该路由以 CNY 计费,`tools/prices/deepseek-flash.json` 承载已发布的非高峰价:高峰时段运行的实际成本是该记录的两倍。无法计价的预算会被拒绝而不是被静默解除。错误码以 `WEB_*` 开头的工具结果计为传输失败,因此无法访问主机的环境绝不会被读成模型靠猜。smoke 只验证协议与费用估算,不构成通用编码能力提升的证据。
111
+ 2. **行为探测**:`tools/probes/` 下四个小型的确定性环境,一个对应本模式本该有的一种行为——对欠明确的规则取最严解读、把每周期额度花在不可能失败的检查上、让低优先级积压一路升级、心算调用预算直到没有东西可提交。每个都带 oracle(`grade.mjs`)与两条脚本策略(`strategies.mjs`);`node tools/probe-selftest.mjs` 把两条策略跑过同一个环境,只有「好策略通过、坏策略失败、点名的指标朝既定方向移动」才通过,因此无法区分的探测在任何模型被收费之前就被免费抓住。语料是 `tools/tasks/liangshen-v41-probes.json`:任务用 `from`(一个目录加支撑文件,物化进任务工作区)与 `metrics`(与 `check` 同样的程序形态,打印一个 JSON 行为数字对象,由报告聚合成与通过率并列的分组表)。探测跑用 `--route provider/model[/effort]` 指定 route;默认仍是固定 route,好让聚合对比仍按每份报告一条 route 来读。
112
+ 3. **评测工具**:隔离 runner 位于 `packages/dsh-liangshen/tools/benchmark-live-run.mjs`:它把被评测 preset 物化到临时目录,并通过 variant patch 在本轮自己的 agent-preset registry 中声明它,把会话持久化改写到本次运行目录,并为每次运行记录基线(仓库提交、出厂 preset hash、DSH 版本、固定 route、任务版本)。候选矩阵隔离 persona 与呈现策略两个因素:`B`(出厂默认)、`P`(候选 persona)、`N`(候选 persona,全程原生清单)、以及 `M`(内置包官方 Minimal preset,仅作外部参照而非单因素对照);随着 SDK 删除 `both` 呈现,测量该呈现的对照臂 `T` 一并退役。单次 smoke 用 `node tools/benchmark-live-run.mjs --variant B`,按种子任务集跑有界矩阵用 `node tools/benchmark-live-run.mjs --tasks tools/tasks/liangshen-v41-flash.json --groups B,P,N,M --repeat 3 --max-sessions 60 --budget-cny 10 --prices tools/prices/deepseek-flash.json`,再用 `node tools/benchmark-report.mjs .benchmark-results` 汇总结果目录:按组给出成功率与 Wilson 区间、按任务配对差值与置信区间、token 合计、按价格书币种计的费用、分列的模型工具错误与传输失败、研究调用次数与首次写入前的检查次数、单独列出的基础设施失败以及记录的基线。费用以 CNY 计,因为该路由以 CNY 计费,`tools/prices/deepseek-flash.json` 承载已发布的非高峰价:高峰时段运行的实际成本是该记录的两倍。无法计价的预算会被拒绝而不是被静默解除。错误码以 `WEB_*` 开头的工具结果计为传输失败,因此无法访问主机的环境绝不会被读成模型靠猜。smoke 只验证协议与费用估算,不构成通用编码能力提升的证据。
112
113
 
113
114
  ## 配置
114
115
 
@@ -116,8 +117,8 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
116
117
  | --- | --- | --- |
117
118
  | `enabled` | `true` | 总开关:关闭后不声明预设、也不发公告。 |
118
119
  | `announceToAgent` | `false` | 按需开启:开启后向 agent 系统提示注入本插件公告。默认关闭,保持系统提示词干净。 |
119
- | `presentation` | `ptc` | 写入本插件所声明 preset 之 `tool-catalog` 行的 wire 呈现:`ptc`(默认)把 wire 收拢为 `run_code`,其余工具经生成的 SDK 调用;`native` 保持组装出的原生清单。Host 提交改动后立即重新声明 preset,此后新建的会话即采用新值;已开始的会话保持其已声明的组合。已删除的 `both` 取值在注册时被拒绝——旧 profile 请迁移为 `ptc` 或 `native`。 |
120
- | `dispatcher` | `true` | 身份开关:开启时(出厂默认)所声明的 preset 在 persona 之后追加调度者规则段——复杂度分诊(L0/L1 直接执行,L2 走完整流程)、拒绝 Agent Teams 的 R0.5 兼容性闸门、L2 任务先澄清访谈再规划、派发子代理并逐层审查与验收,以及落在 `todo_write` 的任务跟踪——其后是本地英文补充:访谈类新增内容,加上参考文本没有的那一条规则——看板卡片不替代派发。关闭后回到仅含工作纪律的极简 persona。它与 `presentation` 正交:`presentation` 决定工具面,`dispatcher` 决定身份与流程纪律。 |
120
+ | `presentation` | `ptc` | 本插件所声明 preset 的 wire 呈现。取值写进 `tool-catalog` 行,而该行通过 `agent.ctx.tools.presentAs` 的声明**就是** wire:`ptc` 收拢为 `run_code`,`native` 保持组装出的原生清单,目录文本描述的就是该声明产生的面。Host 提交改动后立即重新声明 preset,此后新建的会话即采用新值;已开始的会话保持其已声明的组合。已删除的 `both` 取值在注册时被拒绝——旧 profile 请迁移为 `ptc` 或 `native`。 |
121
+ | `dispatcher` | `true` | 身份开关:开启时(出厂默认)所声明的 preset 在 persona 之后追加调度者规则段——复杂度分诊(L0/L1 直接执行,L2 走完整流程)、拒绝 Agent Teams 的 R0.5 兼容性闸门、L2 任务先澄清访谈再规划、派发子代理并逐层审查与验收,以及落在 `todo_write` 的任务跟踪——其后是本地英文补充:访谈类新增内容,加上让任务看板停在做跟踪的表面、而不是派发路径的那一条,以及让登记的事实保持为锚点、而不是当前状态的那一条。这个块在本仓维护:2026-10-18 从它来源包发布的谱系重新抽取(二十条反模式、R2 的 allowlist 三态、R8 被撤回的空 allowlist 兜底、R6 记录化的重派次数、R7 每轮扫描即将升级或过期的项、R5 的 [Limits] 规则——每个上限都写明它约束什么、单位、上限值、以及是否累计);更正就地应用,而不是作为一条自相矛盾的第二份副本追加;`DISPATCHER_RULES_PROVENANCE` 逐条记录它们,`node tools/check-dispatcher-rules.mjs` 对已安装的来源包报告漂移。关闭后回到仅含工作纪律的极简 persona。它与 `presentation` 正交:`presentation` 决定工具面,`dispatcher` 决定身份与流程纪律。 |
121
122
 
122
123
  各字段都可在 Web 设置界面(插件配置)或 profile patch(`dsh plugin` / `cordis.patch.yml`)中编辑。0.1.7 的设置契约下,插件自身的 Config 就是它的设置页:Host 为每个 profile entry 生成一张表单(entry id 为 `liangshen`,聚合安装下为生成的 `web-ui-liangshen` 行),每个字段都声明为 `volatile()`,因此写入被提交进运行中的插件实例,而不是重挂该行。塑造 preset 的 presentation 字段再经声明抵达会话:插件把已提交的取值应用到 `presets/liangshen/agent.cordis.yml` 的对应行并重新声明 preset,因此真正被会话运行的是设置界面的取值,而不是包内文件。组合里没有的行或键绝不会被凭空写入——覆写只会收窄出厂配置。改动对之后新建的会话生效;已开始的会话保持其已声明的组合,因为 registry 拒绝重组已开始的会话。
123
124
 
@@ -133,16 +134,17 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
133
134
  - 被分页扣留的工具(出厂模式 `mcp__*`)在模型经 `tool_activate` 激活其命名空间之前不进 wire、也不进生成的 SDK;同时最多三个分页命名空间保持激活,激活第四个会把最近最少使用的逐回摘要状态,激活状态在压缩与恢复后从持久事件流重建。`ptc` 下分页同时作用于作用域的工具注册表,未激活的命名空间在 `run_code` 程序内同样不可达;
134
135
  - working-context 行只在其来源(plan-mode 状态、已激活的分页命名空间、进行中的 todo)可读时注入,否则省略;
135
136
  - 工具结果超过 4096 字符即被修剪,保留 2048 字符头部与 1024 字符尾部(守护稀疏索引槽位的同时保住错误尾部与退出码),避免超大输出挤占上下文;
136
- - `run_code` 需要挂载的 code runtime(随包发布的 web 与 headless 组合都挂载 `dsh-code-runtime-worker-thread`);没有时 `ptc` 不做声明,会话运行原生工具面;
137
- - spawn 委派行已开启子 agent 模型选择(`modelSelectionSettings: true`),因此设置界面的子智能体模型选择开关在本预设下生效:模型在 `subagent` 上看到 `provider` / `model` / `reasoning_effort` 参数与 `list_subagent_models` 发现工具,显式路由会按会话的允许清单校验;
138
- - 同一组合 scope 内只允许一行委派工具开启该开关:上游开启时以固定工具名在该行所合入的 scope 中注册 `list_subagent_models`,而注册表拒绝同一 scope 内同名工具的第二次注册,因此第二行开启会让整个会话创建失败而不是多出一份能力。fork 行因此不带该键(官方 Standard、PTC、Cordis 预设同样如此),组合测试按结构统计开启行数;
137
+ - `run_code` 需要挂载的 PTC runtime(随包发布的 web 与 headless 组合以 `ptc-runtime` 行挂载 `@deepseek-ai/dsh-ptc-runtime-node`);没有时 `ptc` 不做声明,会话运行原生工具面;
138
+ - spawn 委派行已开启子 agent 模型选择(`modelSelection: true` 与 `modelDiscovery: true`),因此设置界面的子智能体模型选择开关在本预设下生效:模型在 `subagent` 上看到 `provider` / `model` / `reasoning_effort` 参数与 `list_subagent_models` 发现工具,显式路由会按会话的允许清单校验(没有已记录的策略时退回父会话当前路由);该行同时保留拆分前的写法 `modelSelectionSettings: true`:`devDependencies` 里钉的 SDK 只认这一个键,而本仓库运行所对的 harness checkout 已不再声明它,两代各读自己认识的键,另一个保持惰性;
139
+ - 同一组合 scope 内只允许一行委派工具开启发现:上游 `modelDiscovery` 以固定工具名在该行所合入的 scope 中注册 `list_subagent_models`,而注册表拒绝同一 scope 内同名工具的第二次注册,因此第二个开启行会让整个会话创建失败而不是多出一份能力。fork 行因此不带它(官方 Standard、PTC、Cordis 预设同样如此,且它们连路由字段也不开),组合测试按结构统计发现工具的所有者;
140
+ - `subagent-routes` 行是子路由守卫。一旦会话记录了允许路由清单,本行所管辖的每次委派都必须落到已授权路由上:`subagent` 上显式的 `provider`/`model` 对,或 `subagent_fork`(以及任何创建 teammate 的工具)上调用方自己的路由——后者的继承路由正是因为工具无法自选才需要校验。拒绝时会列出可用路由;在只继承的工具上点名路由会作为越权重路由被拒;没挂路由字段的工具不索要它给不出的参数,而是按子代理将要继承的路由校验。守卫对任何读不到的事实一律放行(未记录策略、无会话注册表、无注册表探针),因此答不出来的宿主保持 harness 原本的委派行为;行上的 `enabled: false` 可整体关闭;
139
141
  - 清单不发布 `workflow` 工具,而 workflow 引擎仍为 `ralph` 保留挂载;
140
142
  - shell 挂载上游标准 Stdio 栈,POSIX 注册 `bash`,win32 注册 `pwsh`——每个宿主恰好挂一个 shell 工具,带简短功能描述标题卡片与确定性退出码;
141
143
  - 文件工具继承宿主文件沙箱(不挂载裸 `dsh-fs-local`);
142
144
  - preset 与 shell 访问具有相同信任等级,安装前可自行审阅 `presets/liangshen/`;
143
145
  - 插件不发起网络请求,也不增加遥测;
144
146
  - 不要在已经产生内容的会话中途切换 preset;
145
- - 需要 DSH 0.2.1-rc.2+(preset 机制、`system-prompt/assemble` 瀑布、persona 的 `prefix` schema,以及 PTC 呈现 API)。
147
+ - 需要 DSH 0.2.1-rc.3+(preset 机制、`system-prompt/assemble` 瀑布、persona 的 `prefix` schema,以及 PTC 呈现 API)。
146
148
 
147
149
  ## 许可
148
150
 
package/lib/client.js CHANGED
@@ -639,7 +639,7 @@ window.__ModuleLoader__.load({
639
639
  }
640
640
  //#endregion
641
641
  //#region \0dsh-css:packages/dsh-liangshen/src/client/settings-card.module.css.mjs
642
- const css = "._9t79wq_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}._9t79wq_card:hover{border-color:var(--dsw-alias-label-dimmed)}._9t79wq_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}._9t79wq_header{appearance:none;box-sizing:border-box;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:13px;padding:16px;display:flex}._9t79wq_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}._9t79wq_headerStatic{box-sizing:border-box;border-radius:12px;align-items:center;gap:13px;width:100%;padding:16px;display:flex}._9t79wq_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}._9t79wq_mark{background:var(--dsw-alias-bg-module-platform);width:34px;height:34px;color:var(--dsw-alias-label-secondary);border-radius:10px;flex:none;place-items:center;transition:color .16s;display:grid}._9t79wq_header:hover ._9t79wq_mark,._9t79wq_cardOpen ._9t79wq_mark{color:var(--dsw-alias-label-primary)}._9t79wq_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}._9t79wq_description{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:1.5}._9t79wq_pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}._9t79wq_headerAction{flex:none;align-items:center;display:inline-flex}._9t79wq_chevron{color:var(--dsw-alias-label-tertiary);flex:none;width:16px;height:16px;transition:transform .16s,color .16s}._9t79wq_header:hover ._9t79wq_chevron{color:var(--dsw-alias-label-secondary)}._9t79wq_chevronOpen{transform:rotate(180deg)}._9t79wq_body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}._9t79wq_readOnly{color:var(--dsw-alias-label-secondary);margin:12px 0 0;font-size:12px;line-height:1.5}._9t79wq_notExposed{color:var(--dsw-alias-state-warn-primary);margin:12px 0 0;font-size:12px;line-height:1.5}._9t79wq_footer{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}._9t79wq_failed{min-width:0;color:var(--dsw-alias-state-error-primary,#b42318);text-overflow:ellipsis;white-space:nowrap;flex:1;margin:0;font-size:12px;line-height:1.5;overflow:hidden}._9t79wq_discard,._9t79wq_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}._9t79wq_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}._9t79wq_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}._9t79wq_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}._9t79wq_discard:disabled,._9t79wq_save:disabled{opacity:.4;cursor:default}._9t79wq_discard:focus-visible,._9t79wq_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._9t79wq_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}._9t79wq_field+._9t79wq_field{border-top:1px solid var(--dsw-alias-border-l2)}._9t79wq_head{align-items:center;gap:8px;display:flex}._9t79wq_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}._9t79wq_badges{align-items:center;gap:8px;display:inline-flex}._9t79wq_badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}._9t79wq_reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}._9t79wq_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}._9t79wq_reset:disabled{cursor:default}._9t79wq_reset:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px;outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}._9t79wq_input,._9t79wq_select{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}._9t79wq_input:focus-visible,._9t79wq_select:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}._9t79wq_input:disabled,._9t79wq_select:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}._9t79wq_inputInvalid{border:1px solid var(--dsw-alias-state-error-primary,#b42318);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}._9t79wq_inputInvalid:focus-visible{outline:2px solid var(--dsw-alias-state-error-primary,#b42318);outline-offset:1px;border-color:var(--dsw-alias-state-error-primary,#b42318)}._9t79wq_selectWrap{position:relative}._9t79wq_selectButton{appearance:none;text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;width:100%;display:flex}._9t79wq_selectLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._9t79wq_selectChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}._9t79wq_selectChevronOpen{transform:rotate(180deg)}._9t79wq_selectPopup{z-index:40;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);max-height:240px;box-shadow:0 8px 24px var(--dsw-alias-bg-mask-2);opacity:0;border-radius:8px;flex-direction:column;padding:4px;transition:opacity .1s,transform .1s;display:flex;position:absolute;top:calc(100% + 4px);left:0;right:0;overflow-y:auto;transform:translateY(-4px)}._9t79wq_selectPopupOpen{opacity:1;transform:none}._9t79wq_selectPopupClose{opacity:0;pointer-events:none;transform:translateY(-4px)}._9t79wq_selectOption{color:var(--dsw-alias-label-primary);cursor:pointer;white-space:nowrap;text-overflow:ellipsis;border-radius:6px;flex-shrink:0;padding:6px 10px;font-size:13px;line-height:1.5;overflow:hidden}._9t79wq_selectOption:hover,._9t79wq_selectOptionActive{background:var(--dsw-alias-interactive-bg-hover)}._9t79wq_selectOptionSelected{color:var(--dsw-alias-brand-primary);background:color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color) 10%, transparent);font-weight:500}._9t79wq_invalid{color:var(--dsw-alias-state-error-primary,#b42318);margin:0;font-size:12px;line-height:1.5}._9t79wq_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:1.5}._9t79wq_toggle{appearance:none;cursor:pointer;font:inherit;background:0 0;border:0;border-radius:999px;align-items:center;margin:0;padding:0;display:inline-flex}._9t79wq_toggleTrack{background:var(--dsw-alias-label-dimmed);border-radius:999px;flex:none;width:30px;height:16px;transition:background .18s;position:relative}._9t79wq_toggleThumb{background:var(--dsw-alias-bg-layer-3);border-radius:50%;width:12px;height:12px;transition:left .18s;position:absolute;top:2px;left:2px}._9t79wq_toggle[aria-checked=true] ._9t79wq_toggleTrack{background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-label-primary))}._9t79wq_toggle[aria-checked=true] ._9t79wq_toggleThumb{background:var(--dsw-alias-label-primary-foreground,var(--dsw-alias-bg-layer-3));left:16px}._9t79wq_toggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}._9t79wq_toggle:disabled{opacity:.45;cursor:default}@media (prefers-reduced-motion:reduce){._9t79wq_card,._9t79wq_header,._9t79wq_mark,._9t79wq_chevron,._9t79wq_chevronOpen,._9t79wq_discard,._9t79wq_save,._9t79wq_selectChevron,._9t79wq_selectChevronOpen,._9t79wq_selectPopup,._9t79wq_toggleTrack,._9t79wq_toggleThumb{transition:none}}";
642
+ const css = "._9t79wq_card{--settings-card-radius:12px;--settings-card-header-pad:16px;--settings-card-header-gap:13px;--settings-card-title-size:15px;--settings-card-description-size:13px;--settings-card-body-inset:16px;--settings-card-motion:.18s;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:var(--settings-card-radius);list-style:none;transition:border-color .16s,background .16s}._9t79wq_card:hover{border-color:var(--dsw-alias-label-dimmed)}._9t79wq_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}._9t79wq_cardNested{--settings-card-radius:10px;--settings-card-header-pad:10px 12px;--settings-card-header-gap:10px;--settings-card-title-size:13px;--settings-card-description-size:12px;--settings-card-body-inset:12px}._9t79wq_cardNested ._9t79wq_description{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}._9t79wq_header{appearance:none;box-sizing:border-box;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;border-radius:var(--settings-card-radius);align-items:center;gap:var(--settings-card-header-gap);padding:var(--settings-card-header-pad);background:0 0;border:0;display:flex}._9t79wq_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}._9t79wq_headerStatic{box-sizing:border-box;border-radius:var(--settings-card-radius);align-items:center;gap:var(--settings-card-header-gap);width:100%;padding:var(--settings-card-header-pad);display:flex}._9t79wq_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}._9t79wq_mark{background:var(--dsw-alias-bg-module-platform);width:34px;height:34px;color:var(--dsw-alias-label-secondary);border-radius:10px;flex:none;place-items:center;transition:color .16s;display:grid}._9t79wq_header:hover ._9t79wq_mark,._9t79wq_cardOpen ._9t79wq_mark{color:var(--dsw-alias-label-primary)}._9t79wq_name{color:var(--dsw-alias-label-primary);font-size:var(--settings-card-title-size);font-weight:600;line-height:1.4}._9t79wq_description{color:var(--dsw-alias-label-secondary);font-size:var(--settings-card-description-size);line-height:1.5}._9t79wq_pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}._9t79wq_headerAction{flex:none;align-items:center;display:inline-flex}._9t79wq_chevron{color:var(--dsw-alias-label-tertiary);flex:none;width:16px;height:16px;transition:transform .16s,color .16s}._9t79wq_header:hover ._9t79wq_chevron{color:var(--dsw-alias-label-secondary)}._9t79wq_chevronOpen{transform:rotate(180deg)}._9t79wq_disclosure{opacity:0;transition:grid-template-rows var(--settings-card-motion) ease, opacity var(--settings-card-motion) ease;grid-template-rows:0fr;display:grid}._9t79wq_disclosure[data-state=collapsed],._9t79wq_disclosure[data-state=entering],._9t79wq_disclosure[data-state=closing]{overflow:hidden}._9t79wq_disclosure[data-state=entering],._9t79wq_disclosure[data-state=shown]{opacity:1;grid-template-rows:1fr}._9t79wq_disclosure>._9t79wq_body{min-height:0}._9t79wq_body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 var(--settings-card-body-inset);padding-bottom:8px}._9t79wq_readOnly{color:var(--dsw-alias-label-secondary);margin:12px 0 0;font-size:12px;line-height:1.5}._9t79wq_notExposed{color:var(--dsw-alias-state-warn-primary);margin:12px 0 0;font-size:12px;line-height:1.5}._9t79wq_footer{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}._9t79wq_failed{min-width:0;color:var(--dsw-alias-state-error-primary,#b42318);text-overflow:ellipsis;white-space:nowrap;flex:1;margin:0;font-size:12px;line-height:1.5;overflow:hidden}._9t79wq_discard,._9t79wq_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}._9t79wq_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}._9t79wq_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}._9t79wq_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}._9t79wq_discard:disabled,._9t79wq_save:disabled{opacity:.4;cursor:default}._9t79wq_discard:focus-visible,._9t79wq_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._9t79wq_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}._9t79wq_field+._9t79wq_field{border-top:1px solid var(--dsw-alias-border-l2)}._9t79wq_head{align-items:center;gap:8px;display:flex}._9t79wq_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}._9t79wq_badges{align-items:center;gap:8px;display:inline-flex}._9t79wq_badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}._9t79wq_reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}._9t79wq_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}._9t79wq_reset:disabled{cursor:default}._9t79wq_reset:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px;outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}._9t79wq_input,._9t79wq_select{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}._9t79wq_input:focus-visible,._9t79wq_select:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}._9t79wq_input:disabled,._9t79wq_select:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}._9t79wq_inputInvalid{border:1px solid var(--dsw-alias-state-error-primary,#b42318);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}._9t79wq_inputInvalid:focus-visible{outline:2px solid var(--dsw-alias-state-error-primary,#b42318);outline-offset:1px;border-color:var(--dsw-alias-state-error-primary,#b42318)}._9t79wq_selectWrap{position:relative}._9t79wq_selectButton{appearance:none;text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;width:100%;display:flex}._9t79wq_selectLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._9t79wq_selectChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}._9t79wq_selectChevronOpen{transform:rotate(180deg)}._9t79wq_selectPopup{z-index:40;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);max-height:240px;box-shadow:0 8px 24px var(--dsw-alias-bg-mask-2);opacity:0;border-radius:8px;flex-direction:column;padding:4px;transition:opacity .1s,transform .1s;display:flex;position:absolute;top:calc(100% + 4px);left:0;right:0;overflow-y:auto;transform:translateY(-4px)}._9t79wq_selectPopupOpen{opacity:1;transform:none}._9t79wq_selectPopupClose{opacity:0;pointer-events:none;transform:translateY(-4px)}._9t79wq_selectOption{color:var(--dsw-alias-label-primary);cursor:pointer;white-space:nowrap;text-overflow:ellipsis;border-radius:6px;flex-shrink:0;padding:6px 10px;font-size:13px;line-height:1.5;overflow:hidden}._9t79wq_selectOption:hover,._9t79wq_selectOptionActive{background:var(--dsw-alias-interactive-bg-hover)}._9t79wq_selectOptionSelected{color:var(--dsw-alias-brand-primary);background:color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color) 10%, transparent);font-weight:500}._9t79wq_invalid{color:var(--dsw-alias-state-error-primary,#b42318);margin:0;font-size:12px;line-height:1.5}._9t79wq_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:1.5}._9t79wq_toggle{appearance:none;cursor:pointer;font:inherit;background:0 0;border:0;border-radius:999px;align-items:center;margin:0;padding:0;display:inline-flex}._9t79wq_toggleTrack{background:var(--dsw-alias-label-dimmed);border-radius:999px;flex:none;width:30px;height:16px;transition:background .18s;position:relative}._9t79wq_toggleThumb{background:var(--dsw-alias-bg-layer-3);border-radius:50%;width:12px;height:12px;transition:left .18s;position:absolute;top:2px;left:2px}._9t79wq_toggle[aria-checked=true] ._9t79wq_toggleTrack{background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-label-primary))}._9t79wq_toggle[aria-checked=true] ._9t79wq_toggleThumb{background:var(--dsw-alias-label-primary-foreground,var(--dsw-alias-bg-layer-3));left:16px}._9t79wq_toggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}._9t79wq_toggle:disabled{opacity:.45;cursor:default}@media (prefers-reduced-motion:reduce){._9t79wq_card,._9t79wq_header,._9t79wq_mark,._9t79wq_chevron,._9t79wq_chevronOpen,._9t79wq_discard,._9t79wq_save,._9t79wq_selectChevron,._9t79wq_selectChevronOpen,._9t79wq_selectPopup,._9t79wq_toggleTrack,._9t79wq_toggleThumb{transition:none}._9t79wq_disclosure{transition-property:opacity}}";
643
643
  const tagId = "@linxin666/dsh-liangshen/packages/dsh-liangshen/src/client/settings-card.module.css";
644
644
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
645
645
  const tag = document.createElement("style");
@@ -653,11 +653,13 @@ window.__ModuleLoader__.load({
653
653
  "badges": "_9t79wq_badges",
654
654
  "body": "_9t79wq_body",
655
655
  "card": "_9t79wq_card",
656
+ "cardNested": "_9t79wq_cardNested",
656
657
  "cardOpen": "_9t79wq_cardOpen",
657
658
  "chevron": "_9t79wq_chevron",
658
659
  "chevronOpen": "_9t79wq_chevronOpen",
659
660
  "description": "_9t79wq_description",
660
661
  "discard": "_9t79wq_discard",
662
+ "disclosure": "_9t79wq_disclosure",
661
663
  "failed": "_9t79wq_failed",
662
664
  "field": "_9t79wq_field",
663
665
  "footer": "_9t79wq_footer",
@@ -704,6 +706,8 @@ window.__ModuleLoader__.load({
704
706
  * it. Inlined into each consumer's client bundle; mirrors the official
705
707
  * ui-plugin-config PluginCard in a self-contained slice.
706
708
  */
709
+ /** Length of the body's disclosure motion; it matches `--settings-card-motion` on the card root. */
710
+ const BODY_MOTION_MS = 180;
707
711
  /**
708
712
  * Render one plugin settings card.
709
713
  * @param props - the plugin's copy keys, its form state, and its controls.
@@ -712,12 +716,48 @@ window.__ModuleLoader__.load({
712
716
  function PluginSettingsCard(props) {
713
717
  const [open, setOpen] = (0, react.useState)(props.defaultOpen ?? true);
714
718
  const { state, alwaysOpen } = props;
719
+ const expanded = alwaysOpen === true || open;
720
+ const [bodyPhase, setBodyPhase] = (0, react.useState)(expanded ? "shown" : "hidden");
721
+ const bodyRef = (0, react.useRef)(null);
722
+ (0, react.useLayoutEffect)(() => {
723
+ if (expanded) {
724
+ if (bodyPhase === "hidden") setBodyPhase("collapsed");
725
+ else if (bodyPhase === "collapsed") {
726
+ const node = bodyRef.current;
727
+ if (node !== null) node.offsetHeight;
728
+ setBodyPhase("entering");
729
+ } else if (bodyPhase === "closing") setBodyPhase("entering");
730
+ return;
731
+ }
732
+ if (bodyPhase === "collapsed") setBodyPhase("hidden");
733
+ else if (bodyPhase === "entering" || bodyPhase === "shown") setBodyPhase("closing");
734
+ }, [expanded, bodyPhase]);
735
+ (0, react.useEffect)(() => {
736
+ if (bodyPhase !== "entering" && bodyPhase !== "closing") return;
737
+ const timer = setTimeout(() => {
738
+ setBodyPhase(bodyPhase === "entering" ? "shown" : "hidden");
739
+ }, BODY_MOTION_MS);
740
+ return () => {
741
+ clearTimeout(timer);
742
+ };
743
+ }, [bodyPhase]);
715
744
  if (!state.available) return null;
716
745
  const title = props.t(props.titleKey);
717
746
  const description = props.t(props.descriptionKey);
747
+ const descriptionTitle = props.descriptionTitleKey === void 0 ? description : props.t(props.descriptionTitleKey);
718
748
  const blocked = !state.dirty || state.invalid || state.saving;
719
- const expanded = alwaysOpen === true || open;
720
- const cardClass = expanded ? `${settings_card_module_css_default.cardOpen} ${settings_card_module_css_default.card}` : settings_card_module_css_default.card;
749
+ const baseClass = expanded ? `${settings_card_module_css_default.cardOpen} ${settings_card_module_css_default.card}` : settings_card_module_css_default.card;
750
+ const cardClass = props.density === "nested" ? `${baseClass} ${settings_card_module_css_default.cardNested}` : baseClass;
751
+ /** The body region both legs share; a hidden phase renders nothing at all. */
752
+ const bodyRegion = (content) => bodyPhase === "hidden" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
753
+ className: settings_card_module_css_default.disclosure,
754
+ "data-state": bodyPhase,
755
+ ref: bodyRef,
756
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
757
+ className: settings_card_module_css_default.body,
758
+ children: content
759
+ })
760
+ });
721
761
  const header = alwaysOpen === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
722
762
  className: settings_card_module_css_default.headerStatic,
723
763
  children: [
@@ -735,7 +775,7 @@ window.__ModuleLoader__.load({
735
775
  children: title
736
776
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
737
777
  className: settings_card_module_css_default.description,
738
- title: description,
778
+ title: descriptionTitle,
739
779
  children: props.descriptionNode ?? description
740
780
  })]
741
781
  }),
@@ -772,7 +812,7 @@ window.__ModuleLoader__.load({
772
812
  children: title
773
813
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
774
814
  className: settings_card_module_css_default.description,
775
- title: description,
815
+ title: descriptionTitle,
776
816
  children: props.descriptionNode ?? description
777
817
  })]
778
818
  }),
@@ -799,57 +839,48 @@ window.__ModuleLoader__.load({
799
839
  })
800
840
  ]
801
841
  });
802
- if (!state.exposed && props.renderChildrenWhenNotExposed !== true) {
803
- const showNotice = props.hideNotExposedNotice !== true;
804
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
805
- className: cardClass,
806
- children: [header, expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
807
- className: settings_card_module_css_default.body,
808
- children: showNotice ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
809
- className: settings_card_module_css_default.notExposed,
810
- role: "status",
811
- children: props.t("settings.notExposed")
812
- }) : null
813
- }) : null]
814
- });
815
- }
842
+ if (!state.exposed && props.renderChildrenWhenNotExposed !== true) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
843
+ className: cardClass,
844
+ children: [header, bodyRegion(props.hideNotExposedNotice !== true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
845
+ className: settings_card_module_css_default.notExposed,
846
+ role: "status",
847
+ children: props.t("settings.notExposed")
848
+ }) : null)]
849
+ });
816
850
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
817
851
  className: cardClass,
818
- children: [header, expanded && props.headerOnly !== true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
819
- className: settings_card_module_css_default.body,
820
- children: [
821
- !state.writable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
822
- className: settings_card_module_css_default.readOnly,
823
- role: "status",
824
- children: props.t("settings.readOnly")
825
- }) : null,
826
- props.children,
827
- props.hideFooter === true ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
828
- className: settings_card_module_css_default.footer,
829
- children: [
830
- state.failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
831
- className: settings_card_module_css_default.failed,
832
- role: "status",
833
- children: [props.t("settings.saveFailed"), state.failedReason ? " - " + state.failedReason : ""]
834
- }) : null,
835
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
836
- type: "button",
837
- className: settings_card_module_css_default.discard,
838
- disabled: !state.dirty || state.saving,
839
- onClick: props.onDiscard,
840
- children: props.t("settings.discard")
841
- }),
842
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
843
- type: "button",
844
- className: settings_card_module_css_default.save,
845
- disabled: blocked,
846
- onClick: props.onSave,
847
- children: props.t(!state.saving ? "settings.save" : "settings.saving")
848
- })
849
- ]
850
- })
851
- ]
852
- }) : null]
852
+ children: [header, props.headerOnly !== true ? bodyRegion(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
853
+ !state.writable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
854
+ className: settings_card_module_css_default.readOnly,
855
+ role: "status",
856
+ children: props.t("settings.readOnly")
857
+ }) : null,
858
+ props.children,
859
+ props.hideFooter === true ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
860
+ className: settings_card_module_css_default.footer,
861
+ children: [
862
+ state.failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
863
+ className: settings_card_module_css_default.failed,
864
+ role: "status",
865
+ children: [props.t("settings.saveFailed"), state.failedReason ? " - " + state.failedReason : ""]
866
+ }) : null,
867
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
868
+ type: "button",
869
+ className: settings_card_module_css_default.discard,
870
+ disabled: !state.dirty || state.saving,
871
+ onClick: props.onDiscard,
872
+ children: props.t("settings.discard")
873
+ }),
874
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
875
+ type: "button",
876
+ className: settings_card_module_css_default.save,
877
+ disabled: blocked,
878
+ onClick: props.onSave,
879
+ children: props.t(!state.saving ? "settings.save" : "settings.saving")
880
+ })
881
+ ]
882
+ })
883
+ ] })) : null]
853
884
  });
854
885
  }
855
886
  const NON_SKIN_BODY_MARKERS = /* @__PURE__ */ new Set(["dshSkinCenter", "dshSidebarCollapsed"]);
@@ -1069,6 +1100,7 @@ window.__ModuleLoader__.load({
1069
1100
  }),
1070
1101
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1071
1102
  className: settings_card_module_css_default.hint,
1103
+ title: props.hintTitle,
1072
1104
  children: props.hint
1073
1105
  })
1074
1106
  ]
@@ -1112,6 +1144,7 @@ window.__ModuleLoader__.load({
1112
1144
  }),
1113
1145
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1114
1146
  className: props.invalid ? settings_card_module_css_default.invalid : settings_card_module_css_default.hint,
1147
+ title: props.hintTitle,
1115
1148
  children: props.invalid ? props.invalidLabel : props.hint
1116
1149
  })
1117
1150
  ]