@linxin666/dsh-liangshen 0.4.4 → 0.4.6

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: 071efd8a0688bb0d4268e3e6ac1db3188b31ff43
6
- README.zh.md: 830a61d9489e9ccc894aa6c65f5b86183a435560
5
+ README.md: 75f5ffa338130e19fc9b70463a5e34d8fdb4e20d
6
+ README.zh.md: a6817b19478158365369a3131d4fb237a6e63299
package/README.md CHANGED
@@ -1,8 +1,21 @@
1
- # dsh-liangshen — LiangShen Mode (minimal persona + programmatic tool transport)
1
+ # dsh-liangshen · Minimal LiangShen Persona & Programmatic Tool Transport for DeepSeek Harness (DSH)
2
2
 
3
3
  English | [中文](README.zh.md)
4
4
 
5
- Ships the LiangShen preset as a one-command plugin of the dsh-web family: at activation the host half declares the bundled preset to the harness's agent-preset registry (declare = enabled), so new sessions can pick "梁神模式" from the preset picker, and its browser half adds a slot-machine lever beside the model selector on the new-session screen for switching that mode on and off. The preset keeps a minimal persona with standing working discipline and the session workspace directory in the system prompt, lets the harness deliver AGENTS.md-style workspace instructions as its own user-role messages, and delivers its tool surface as a durable user message after the user's message — the way the harness injects the skill catalog, naming exactly the tools that request opens. The wire keeps one presentation for the whole session (`presentation: 'both'` by default): the native roster and the `run_code` transport sit co-resident — ordinary single-step work goes through direct native calls, while programmatic batch computation, wide fan-out, and multi-step data shaping go through `run_code`. A deployment without a mounted code runtime degrades to the native surface with a one-time warning instead of presenting a transport the request cannot carry. Tools held back by paging (default pattern `mcp__*`) are unreachable until activated: they appear in the catalog as namespace summaries, and under `ptc` they stay out of the generated SDK as well, because the page is a registry restriction rather than only a wire filter. `tool_activate` loads one namespace back onto the whole surface. Built entirely on the official NPM SDK — no dsh source changes.
5
+ <p align="center">
6
+ <img src="https://img.shields.io/npm/v/@linxin666/dsh-liangshen?style=flat-square" alt="Version">
7
+ &nbsp;
8
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.0--rc.2-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
9
+ &nbsp;
10
+ <img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
11
+ </p>
12
+
13
+ <p align="center">
14
+ <strong>Minimal LiangShen Persona & Programmatic Tool Transport for DeepSeek Harness (DSH)</strong><br>
15
+ <em>Minimal Persona · Native & run_code Dual Transport · Gentle MCP Paging · Runtime Degradation Fuse · Fact Register</em>
16
+ </p>
17
+
18
+ An all-in-one plugin for DeepSeek Harness (DSH) Web GUI and desktop client: declares the built-in "LiangShen Mode" preset to the official agent-preset registry upon activation and offers a slot-machine lever toggle alongside the model selector in the blank conversation page. Keeps system prompts concise to a minimal persona with strict operational disciplines while workspace instructions arrive via user turns. Tools operate under a unified presentation contract (defaulting to `both`: cohabiting native tools with `run_code` for batching and fan-outs). Features gentle MCP namespace paging, runtime degradation safety fuses, and a key fact register for long-horizon context retention.
6
19
 
7
20
  ## Why
8
21
 
@@ -20,7 +33,7 @@ LiangShen mode therefore keeps the whole session on one presentation, chosen by
20
33
  6. a minimal working-context line — plan-mode state, active paged namespaces, and in-progress todos — is injected at the tail of the latest message only when its sources are readable, keeping current state inside the model's local attention window; runtime contexts (the sandbox and approval snapshots) and the skill catalog flow as in Standard mode;
21
34
  7. the catalog groups the tools of an activated paged family under a `namespace `<name>` (activated):` heading instead of scattering one server's tools through the alphabetical list, while every non-paged tool keeps its flat entry;
22
35
  8. `maxResidentTokens` (default 8000) estimates the always-on-wire surface and warns once when it is crossed, naming the heaviest tools and `pagedToolPatterns` as the remedy. The threshold was re-estimated for V4.1 (its KV cache is a quarter of V4-Flash's, so the same schema load occupies a quarter of the sparse-index slots and the budget moved from 6000 to 8000), still calibrated above the shipped roster so only real growth trips it. The guard never truncates: silently dropping a tool the session needs would trade a measurable context cost for an unmeasurable capability loss.
23
- 9. a runtime degeneration circuit breaker (`guard`) folds the session event stream each step and fires once per episode on either signal — a stall (consecutive zero-output long-reasoning steps) or an echo (the same tool call failing repeatedly with identical arguments) — injecting a breaker message and stepping the reasoning effort one notch down for the next few requests (max → high → low); with no signal it never rewrites a request, so the route's explicit effort and the prefix cache stay untouched. This is the outside force the persona's reflection fuse cannot be (DSH discussion #5976);
36
+ 9. a runtime degeneration circuit breaker (`guard`) folds the session event stream each step and fires once per episode on either signal — a stall (consecutive zero-output long-reasoning steps) or an echo (the same tool call failing repeatedly with identical arguments) — injecting a breaker message and — for a stall only, where the cause is an over-large reasoning budget — stepping the reasoning effort one notch down for the next few requests (max → high, and high is left alone because it already sits in the model's measured effort sweet spot); an echo fires the message alone, since its cause is a broken call rather than an over-large budget; with no signal it never rewrites a request, so the route's explicit effort and the prefix cache stay untouched. This is the outside force the persona's reflection fuse cannot be (DSH discussion #5976);
24
37
  10. a key-fact register (`fact_register`) lets the model pin a hard user constraint, a confirmed decision, or a failed path as one short line; the register is folded from the durable event stream and rides the `[Working Context: ...]` line — the surface that lands inside the guaranteed local attention window every step — as the counter to V4.1's long-session forgetting.
25
38
 
26
39
  ## Security model
@@ -33,7 +46,9 @@ This mode operates strictly within the official host security architecture and c
33
46
 
34
47
  ## The lever
35
48
 
36
- The browser half adds a slot-machine lever to the composer tool row, immediately left of the model selector, on the new-session screen:
49
+ The browser half adds a slot-machine lever to the composer tool row, immediately left of the model selector, on the new-session screen, and the settings card marks this mode's own entry with a mark drawing that same lever — one knob, one arm, one pivot foot, painted in the current text color so it follows the active theme:
50
+
51
+ - pull the lever down — drag it, click it, or press it with the keyboard — and the session about to start composes LiangShen mode; a landed pull plays the jackpot burst (flash, shockwave, sparks, and a banner reading 梁神模式 over classical Chinese, binary, and Morse lines);
37
52
 
38
53
  - pull the lever down — drag it, click it, or press it with the keyboard — and the session about to start composes LiangShen mode; a landed pull plays the jackpot burst (flash, shockwave, sparks, and a banner reading 梁神模式 over classical Chinese, binary, and Morse lines);
39
54
  - push it up and the preset you were on before comes back — with nothing remembered yet, that is the deployment default;
@@ -103,11 +118,12 @@ When validating mode behavior and evaluating performance, verification tiers mus
103
118
  | `enabled` | `true` | Master switch: when false, the preset is not declared and the announcement does not run. |
104
119
  | `announceToAgent` | `false` | Opt-in: when true, a system-prompt section announces the plugin. Off by default so agent system prompts stay clean. |
105
120
  | `presentation` | `both` | Wire presentation written into the `tool-catalog` row of the preset this plugin declares: `both` (default) keeps the roster and transport co-resident; `native` keeps the assembled roster; `ptc` collapses the wire to `run_code`. 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. |
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), an interview before planning on an L2 task, and delegation with layer-by-layer review and acceptance. 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. |
106
122
  | `guardEnabled` | `true` | Master switch for the runtime degeneration circuit breaker: detects consecutive zero-output long reasoning and repeated identical-argument failures, injecting a breaker message and stepping the reasoning effort down when it fires; disabled means requests are never touched. |
107
123
  | `guardSensitivity` | `balanced` | Sensitivity preset scaling every breaker threshold: `conservative` (fewer interruptions, x1.5), `balanced` (the calibrated defaults), `aggressive` (fires earlier, x0.5). |
108
- | `guardStallReasoningChars` | `8000` | **Override** for the per-step runaway floor: the floor adapts to the reasoning effort by default (8000 at max / 12000 at high / 20000 at low, calibrated against V4.1's official 384K max output); setting this field wins over the adaptive table for every effort level. |
109
- | `guardGlobalStallCap` | `4` | **Override** for the slow-burn step count: the cap scales with the sensitivity preset by default (4 at balanced); setting this field wins. |
110
- | `guardEchoFailures` | `3` | **Override** for the echo ladder: identical-argument failures of the same tool in a row that fire the breaker. All guard fields reach a session through the declared preset, exactly like `presentation`. |
124
+ | `guardStallReasoningChars` | (unset) | **Override** for the per-step runaway floor. Left unset, the floor adapts to the reasoning effort (8000 at max / 12000 at high / 20000 at low, calibrated against V4.1's official 384K max output) and is then scaled by `guardSensitivity`; setting this field wins over the adaptive table for every effort level. |
125
+ | `guardGlobalStallCap` | (unset) | **Override** for the slow-burn step count. Left unset, the cap scales with the sensitivity preset (4 at balanced); setting this field wins. |
126
+ | `guardEchoFailures` | (unset) | **Override** for the echo ladder: identical-argument failures of the same tool in a row that fire the breaker. Left unset, the count scales with the sensitivity preset (3 at balanced). All guard fields reach a session through the declared preset, exactly like `presentation`. |
111
127
 
112
128
  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.
113
129
 
@@ -120,17 +136,19 @@ All fields are editable in the web settings surface (plugin config) or through t
120
136
  - A step whose prompt assembly was not observed injects nothing — the catalog is never guessed from a stale view;
121
137
  - A composition exposing none of the accepted persona section names (`deployment:persona-prefix`, `deployment:persona`, `persona`) keeps the assembled prompt and warns once instead of sending an empty system prompt;
122
138
  - Plan mode is supported through its `plan:policy` section; with `keepPlanPolicy: false` the mode keeps its tool but loses the policy text that enforces it;
123
- - 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;
139
+ - 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; under `both` no registry restriction is installed, so a paged namespace stays reachable from inside a program even before activation, because the native wire itself carries it;
124
140
  - The working-context line is injected only when its sources (plan-mode state, active paged namespaces, in-progress todos) are readable, and omitted otherwise;
125
141
  - 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;
126
142
  - `run_code` needs a mounted code runtime (the shipped web and headless compositions mount `dsh-code-runtime-worker-thread`); without one, `ptc` and `both` declare nothing and the session runs the native surface;
143
+ - 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;
144
+ - 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;
127
145
  - The roster does not publish the `workflow` tool, while the workflow engine stays mounted for `ralph`;
128
146
  - 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;
129
147
  - The file tools inherit the host file sandbox (no bare `dsh-fs-local` filesystem);
130
148
  - The preset carries the same trust level as shell access — review `presets/liangshen/` before installing;
131
149
  - The plugin makes no network requests and adds no telemetry;
132
150
  - Do not switch presets mid-conversation;
133
- - Requires DSH 0.2.0-rc.1+ (preset mechanism, the `system-prompt/assemble` waterfall, the persona `prefix` schema, and the PTC presentation API).
151
+ - Requires DSH 0.2.0-rc.2+ (preset mechanism, the `system-prompt/assemble` waterfall, the persona `prefix` schema, and the PTC presentation API).
134
152
 
135
153
  ## License
136
154
 
package/README.zh.md CHANGED
@@ -1,7 +1,20 @@
1
- # dsh-liangshen — 梁神模式(极简 persona + 程序化工具传输)
1
+ # dsh-liangshen · DeepSeek Harness (DSH) 极简梁神模式与低开销程序化工具传输插件
2
2
 
3
3
  [English](README.md) | 中文
4
4
 
5
+ <p align="center">
6
+ <img src="https://img.shields.io/npm/v/@linxin666/dsh-liangshen?style=flat-square" alt="Version">
7
+ &nbsp;
8
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.0--rc.2-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
9
+ &nbsp;
10
+ <img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
11
+ </p>
12
+
13
+ <p align="center">
14
+ <strong>DeepSeek Harness(DSH)官方 Web GUI 与桌面客户端极简 Agent 预设与高效代码工具传输引擎</strong><br>
15
+ <em>极简 Persona 系统提示词 · 原生直调与 run_code 混合传输 · MCP 工具温和分页 · 运行时退化熔断 · 关键事实登记簿</em>
16
+ </p>
17
+
5
18
  把梁神模式做成 DSH 全家桶里的一键安装插件:Host 半区在激活时把内置 preset 直接声明给 harness 的 agent-preset registry(声明即启用),新建会话即可在预设选择器中选择「梁神模式」,浏览器半区还在新建会话页的模型选择器旁提供一台老虎机拨杆来开关该模式。该 preset 让系统提示词保持极简 persona——外加本模式的固定工作纪律与会话工作区目录——AGENTS.md 类工作区指令交由 harness 以自己的 user 角色消息送达;工具面则从第一条用户消息起作为持久 user 消息注入在用户消息之后——形状与 harness 注入 skill 目录一致,且只宣告该次请求实际开放的工具。wire 在整个会话中保持由 `presentation` 选定的同一种呈现(出厂默认 `presentation: 'both'`):原生清单与 `run_code` 传输工具同驻——日常单步工作走原生直调,程序化批处理、并发扇出与多步数据塑形走 `run_code`;未挂载 code runtime 的部署回退为原生呈现并一次性告警,而不是宣告一个该请求无法承载的传输工具。被分页扣留的匹配工具(默认 `mcp__*`)在激活前不可达:它们以命名空间摘要出现在目录里,`ptc` 下同时不出现在生成的 SDK 中——分页是注册表级限制,不只是 wire 过滤。`tool_activate` 把一个命名空间挂回整个可达面。全部通过官方 NPM SDK 实现,不修改 DSH 源码。
6
19
 
7
20
  ## 原理
@@ -20,7 +33,7 @@ DeepSeek V4.1 Flash 的后训练直接对齐其原生 DSML 工具调用面,官
20
33
  6. 最小版 working-context 行——plan-mode 状态、已激活的分页命名空间、进行中的 todo——只在其来源可读时注入到最新消息尾部,让当前状态落在模型的局部注意力窗口内;运行时上下文(sandbox 与 approval 快照)与 skill 目录按 Standard 模式正常注入;
21
34
  7. 目录把已激活分页家族的工具归在 `namespace `<名称>` (activated):` 标题之下,而不是把一个服务端的工具散落在字母序清单里;未被分页的工具仍保持扁平条目;
22
35
  8. `maxResidentTokens`(默认 8000)估算常驻 wire 面并在超过时告警一次,列出最重的工具并把 `pagedToolPatterns` 指为处置手段。该阈值按 V4.1 的 KV 压缩重新校准(其 KV cache 为 V4-Flash 的 1/4,同样的 schema 负载只占 1/4 的稀疏索引槽位,阈值由 6000 上调至 8000),仍校准在出厂清单之上,用于发现真实增长而非出厂配置本身。该守卫从不截断:静默丢掉会话需要的工具,等于用可度量的上下文成本换取不可度量的能力损失。
23
- 9. 运行时退化熔断器(`guard`)每步从会话事件流折叠信号,在两类形态下每个 episode 触发一次——停摆(连续零产出的长思考回合)或空转(同一工具以相同参数连续失败)——注入熔断消息,并在接下来几个请求内把推理档位临时下调一档(max → high → low);无信号时它从不改写任何请求,路由的显式档位与前缀缓存都不受影响。这是 persona 反思熔断无法充当的外力(DSH discussion #5976);
36
+ 9. 运行时退化熔断器(`guard`)每步从会话事件流折叠信号,在两类形态下每个 episode 触发一次——停摆(连续零产出的长思考回合)或空转(同一工具以相同参数连续失败)——注入熔断消息;并且仅在停摆信号下——其成因是推理预算过大——在接下来几个请求内把推理档位临时下调一档(max → high,high 档保持不变,因为它已处于模型实测的推理甜区);空转信号只注入消息,因为它的成因是调用本身失效而非预算过大;无信号时它从不改写任何请求,路由的显式档位与前缀缓存都不受影响。这是 persona 反思熔断无法充当的外力(DSH discussion #5976);
24
37
  10. 关键事实登记簿(`fact_register`)让模型把用户硬性约束、已确认的架构决策、失败过的路径登记为一行短事实;登记簿从持久事件流折叠,随 `[Working Context: ...]` 行投射——每步都落在保证命中的局部注意力窗口内——以此对抗 V4.1 的长会话遗忘。
25
38
 
26
39
  ## 安全模型
@@ -33,7 +46,9 @@ DeepSeek V4.1 Flash 的后训练直接对齐其原生 DSML 工具调用面,官
33
46
 
34
47
  ## 拨杆
35
48
 
36
- 浏览器半区在新建会话页的输入框工具行里、模型选择器紧左侧装了一台老虎机拨杆:
49
+ 浏览器半区在新建会话页的输入框工具行里、模型选择器紧左侧装了一台老虎机拨杆,设置卡片则为梁神模式这一条目标出一枚图形标记,画的正是这台拨杆——一个球头、一根杆、一个底座,用当前文字颜色上色,跟随当前主题:
50
+
51
+ - 把拨杆拨下——拖动、点击或用键盘激活都算——即将开始的会话就组合为梁神模式;命中后播放中奖特效(闪光、冲击环、火花,以及「梁神模式」横幅叠文言文、二进制、摩斯三行);
37
52
 
38
53
  - 把拨杆拨下——拖动、点击或用键盘激活都算——即将开始的会话就组合为梁神模式;命中后播放中奖特效(闪光、冲击环、火花,以及「梁神模式」横幅叠文言文、二进制、摩斯三行);
39
54
  - 把拨杆上拨,就回到你此前的模式——还没有记住任何模式时,回到部署默认预设;
@@ -103,11 +118,12 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
103
118
  | `enabled` | `true` | 总开关:关闭后不声明预设、也不发公告。 |
104
119
  | `announceToAgent` | `false` | 按需开启:开启后向 agent 系统提示注入本插件公告。默认关闭,保持系统提示词干净。 |
105
120
  | `presentation` | `both` | 写入本插件所声明 preset 之 `tool-catalog` 行的 wire 呈现:`both`(默认)让原生清单与 `run_code` 同驻;`native` 保持组装出的原生清单;`ptc` 把 wire 收拢为 `run_code`。Host 提交改动后立即重新声明 preset,此后新建的会话即采用新值;已开始的会话保持其已声明的组合。 |
121
+ | `dispatcher` | `true` | 身份开关:开启时(出厂默认)所声明的 preset 在 persona 之后追加调度者规则段——复杂度分诊(L0/L1 直接执行,L2 走完整流程)、L2 任务先澄清访谈再规划、派发子代理并逐层审查与验收。关闭后回到仅含工作纪律的极简 persona。它与 `presentation` 正交:`presentation` 决定工具面,`dispatcher` 决定身份与流程纪律。 |
106
122
  | `guardEnabled` | `true` | 运行时退化熔断器总开关:检测连续零产出长思考与同参重复失败,触发时注入熔断提示并临时下调推理档位;关闭后不干预任何请求。 |
107
123
  | `guardSensitivity` | `balanced` | 熔断灵敏度预设:整体缩放阈值——`conservative`(更少打断,×1.5)、`balanced`(出厂校准值)、`aggressive`(更早触发,×0.5)。 |
108
- | `guardStallReasoningChars` | `8000` | 单步暴走梯字符阈值的**覆写值**:阈值默认随推理档位自适应(max 档 8000 / high 档 12000 / low 档 20000,按 V4.1 官方 384K 最大输出校准),设置本字段则以本值为准、覆盖所有档位的自适应表。 |
109
- | `guardGlobalStallCap` | `4` | 熔断器慢烧梯连续步数的**覆写值**:默认随灵敏度预设缩放(balanced 为 4),设置本字段则以本值为准。 |
110
- | `guardEchoFailures` | `3` | 熔断器空转梯的**覆写值**:同一工具以相同参数连续失败多少次触发。以上熔断字段与 `presentation` 一样写入所声明的 preset 生效。 |
124
+ | `guardStallReasoningChars` | (未设置) | 单步暴走梯字符阈值的**覆写值**:不设置时阈值随推理档位自适应(max 档 8000 / high 档 12000 / low 档 20000,按 V4.1 官方 384K 最大输出校准),并再按 `guardSensitivity` 缩放;设置本字段则以本值为准、覆盖所有档位的自适应表。 |
125
+ | `guardGlobalStallCap` | (未设置) | 熔断器慢烧梯连续步数的**覆写值**:不设置时随灵敏度预设缩放(balanced 为 4),设置本字段则以本值为准。 |
126
+ | `guardEchoFailures` | (未设置) | 熔断器空转梯的**覆写值**:同一工具以相同参数连续失败多少次触发;不设置时该次数随灵敏度预设缩放(balanced 为 3)。以上熔断字段与 `presentation` 一样写入所声明的 preset 生效。 |
111
127
 
112
128
  各字段都可在 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 拒绝重组已开始的会话。
113
129
 
@@ -120,17 +136,19 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
120
136
  - 未观测到 prompt 组装的步不注入任何内容——目录绝不会由过期视图推测;
121
137
  - 若组合中不存在任何被接受的 persona section 名(`deployment:persona-prefix`、`deployment:persona`、`persona`),过滤器会保留组装结果并只告警一次,而不是发出空系统提示词;
122
138
  - plan mode 通过其 `plan:policy` 段支持;置 `keepPlanPolicy: false` 后该模式仍有工具,但失去约束它的策略文本;
123
- - 被分页扣留的工具(出厂模式 `mcp__*`)在模型经 `tool_activate` 激活其命名空间之前不进 wire、也不进生成的 SDK;同时最多三个分页命名空间保持激活,激活第四个会把最近最少使用的逐回摘要状态,激活状态在压缩与恢复后从持久事件流重建;
139
+ - 被分页扣留的工具(出厂模式 `mcp__*`)在模型经 `tool_activate` 激活其命名空间之前不进 wire、也不进生成的 SDK;同时最多三个分页命名空间保持激活,激活第四个会把最近最少使用的逐回摘要状态,激活状态在压缩与恢复后从持久事件流重建。`ptc` 下分页同时作用于作用域的工具注册表,未激活的命名空间在 `run_code` 程序内同样不可达;`both` 下不安装注册表级限制,被分页的命名空间在程序内仍可达——可达性来自原生 wire 本身,而非分页豁免;
124
140
  - working-context 行只在其来源(plan-mode 状态、已激活的分页命名空间、进行中的 todo)可读时注入,否则省略;
125
141
  - 工具结果超过 4096 字符即被修剪,保留 2048 字符头部与 1024 字符尾部(守护稀疏索引槽位的同时保住错误尾部与退出码),避免超大输出挤占上下文;
126
142
  - `run_code` 需要挂载的 code runtime(随包发布的 web 与 headless 组合都挂载 `dsh-code-runtime-worker-thread`);没有时 `ptc` 与 `both` 不做声明,会话运行原生工具面;
143
+ - spawn 委派行已开启子 agent 模型选择(`modelSelectionSettings: true`),因此设置界面的子智能体模型选择开关在本预设下生效:模型在 `subagent` 上看到 `provider` / `model` / `reasoning_effort` 参数与 `list_subagent_models` 发现工具,显式路由会按会话的允许清单校验;
144
+ - 同一组合 scope 内只允许一行委派工具开启该开关:上游开启时以固定工具名在该行所合入的 scope 中注册 `list_subagent_models`,而注册表拒绝同一 scope 内同名工具的第二次注册,因此第二行开启会让整个会话创建失败而不是多出一份能力。fork 行因此不带该键(官方 Standard、PTC、Cordis 预设同样如此),组合测试按结构统计开启行数;
127
145
  - 清单不发布 `workflow` 工具,而 workflow 引擎仍为 `ralph` 保留挂载;
128
146
  - shell 挂载上游标准 Stdio 栈,POSIX 注册 `bash`,win32 注册 `pwsh`——每个宿主恰好挂一个 shell 工具,带简短功能描述标题卡片与确定性退出码;
129
147
  - 文件工具继承宿主文件沙箱(不挂载裸 `dsh-fs-local`);
130
148
  - preset 与 shell 访问具有相同信任等级,安装前可自行审阅 `presets/liangshen/`;
131
149
  - 插件不发起网络请求,也不增加遥测;
132
150
  - 不要在已经产生内容的会话中途切换 preset;
133
- - 需要 DSH 0.2.0-rc.1+(preset 机制、`system-prompt/assemble` 瀑布、persona 的 `prefix` schema,以及 PTC 呈现 API)。
151
+ - 需要 DSH 0.2.0-rc.2+(preset 机制、`system-prompt/assemble` 瀑布、persona 的 `prefix` schema,以及 PTC 呈现 API)。
134
152
 
135
153
  ## 许可
136
154
 
package/lib/client.js CHANGED
@@ -612,8 +612,46 @@ window.__ModuleLoader__.load({
612
612
  return error instanceof Error ? error.message : String(error);
613
613
  }
614
614
  //#endregion
615
+ //#region src/client/LiangShenMark.tsx
616
+ /**
617
+ * Render the LiangShen card mark.
618
+ * @returns the 18x18 lever mark, in the current text color.
619
+ */
620
+ function LiangShenMark() {
621
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
622
+ width: "18",
623
+ height: "18",
624
+ viewBox: "0 0 18 18",
625
+ fill: "none",
626
+ "aria-hidden": "true",
627
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
628
+ x: "3.6",
629
+ y: "13.2",
630
+ width: "8.8",
631
+ height: "2.8",
632
+ rx: "1.4",
633
+ fill: "currentColor"
634
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
635
+ transform: "rotate(20 8 14.4)",
636
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
637
+ x: "6.5",
638
+ y: "4.6",
639
+ width: "3",
640
+ height: "9.8",
641
+ rx: "1.5",
642
+ fill: "currentColor"
643
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
644
+ cx: "8",
645
+ cy: "4.4",
646
+ r: "2.9",
647
+ fill: "currentColor"
648
+ })]
649
+ })]
650
+ });
651
+ }
652
+ //#endregion
615
653
  //#region \0dsh-css:packages/dsh-liangshen/src/client/settings-card.module.css.mjs
616
- 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:12px;padding:14px 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:12px;width:100%;padding:14px 16px;display:flex}._9t79wq_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}._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_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}._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}@media (prefers-reduced-motion:reduce){._9t79wq_card,._9t79wq_header,._9t79wq_chevron,._9t79wq_chevronOpen,._9t79wq_discard,._9t79wq_save,._9t79wq_selectChevron,._9t79wq_selectChevronOpen,._9t79wq_selectPopup{transition:none}}";
654
+ 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_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}@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{transition:none}}";
617
655
  const tagId = "@linxin666/dsh-liangshen/packages/dsh-liangshen/src/client/settings-card.module.css";
618
656
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
619
657
  const tag = document.createElement("style");
@@ -644,6 +682,7 @@ window.__ModuleLoader__.load({
644
682
  "inputInvalid": "_9t79wq_inputInvalid",
645
683
  "invalid": "_9t79wq_invalid",
646
684
  "label": "_9t79wq_label",
685
+ "mark": "_9t79wq_mark",
647
686
  "name": "_9t79wq_name",
648
687
  "notExposed": "_9t79wq_notExposed",
649
688
  "pending": "_9t79wq_pending",
@@ -689,22 +728,30 @@ window.__ModuleLoader__.load({
689
728
  const cardClass = expanded ? `${settings_card_module_css_default.cardOpen} ${settings_card_module_css_default.card}` : settings_card_module_css_default.card;
690
729
  const header = alwaysOpen === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
691
730
  className: settings_card_module_css_default.headerStatic,
692
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
693
- className: settings_card_module_css_default.headText,
694
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
695
- className: settings_card_module_css_default.name,
696
- title,
697
- children: title
698
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
699
- className: settings_card_module_css_default.description,
700
- title: description,
701
- children: props.descriptionNode ?? description
702
- })]
703
- }), state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
704
- className: settings_card_module_css_default.pending,
705
- title: props.t("settings.unsaved"),
706
- children: props.t("settings.unsaved")
707
- }) : null]
731
+ children: [
732
+ props.icon !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
733
+ className: settings_card_module_css_default.mark,
734
+ "aria-hidden": "true",
735
+ children: props.icon
736
+ }) : null,
737
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
738
+ className: settings_card_module_css_default.headText,
739
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
740
+ className: settings_card_module_css_default.name,
741
+ title,
742
+ children: title
743
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
744
+ className: settings_card_module_css_default.description,
745
+ title: description,
746
+ children: props.descriptionNode ?? description
747
+ })]
748
+ }),
749
+ state.dirty ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
750
+ className: settings_card_module_css_default.pending,
751
+ title: props.t("settings.unsaved"),
752
+ children: props.t("settings.unsaved")
753
+ }) : null
754
+ ]
708
755
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
709
756
  type: "button",
710
757
  className: settings_card_module_css_default.header,
@@ -714,6 +761,11 @@ window.__ModuleLoader__.load({
714
761
  setOpen(!open);
715
762
  },
716
763
  children: [
764
+ props.icon !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
765
+ className: settings_card_module_css_default.mark,
766
+ "aria-hidden": "true",
767
+ children: props.icon
768
+ }) : null,
717
769
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
718
770
  className: settings_card_module_css_default.headText,
719
771
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -1180,6 +1232,8 @@ window.__ModuleLoader__.load({
1180
1232
  disposeForm;
1181
1233
  disposed = false;
1182
1234
  saving = false;
1235
+ /** A save asked for while one was in flight; it runs once the first settles (#1754). */
1236
+ saveQueued = false;
1183
1237
  failed = false;
1184
1238
  failedReason;
1185
1239
  /** @param scope - the bound configuration form for this card's namespace. */
@@ -1255,7 +1309,7 @@ window.__ModuleLoader__.load({
1255
1309
  });
1256
1310
  },
1257
1311
  save: () => {
1258
- this.save();
1312
+ this.requestSave();
1259
1313
  },
1260
1314
  discard: () => {
1261
1315
  if (this.staged.size === 0 && !this.failed) return;
@@ -1282,6 +1336,29 @@ window.__ModuleLoader__.load({
1282
1336
  * the user can correct them instead of retyping.
1283
1337
  * @returns settlement after the mutation and the read-back.
1284
1338
  */
1339
+ /**
1340
+ * Run one save, and re-run it once if another was asked for while this one
1341
+ * was still in flight.
1342
+ *
1343
+ * A save is a Host round trip that also drives the profile reconcile, and
1344
+ * the Host runs that write inside one exclusive transaction. Answering a
1345
+ * press that arrives mid-flight by returning immediately dropped the edit
1346
+ * with no explanation, which is the "the save button stops working after a
1347
+ * few rounds" report (#1754). Serializing instead means a save pressed while
1348
+ * another is still settling runs against the settled state - which is what
1349
+ * the operator meant by pressing it again.
1350
+ * @returns settlement after the mutation and the read-back.
1351
+ */
1352
+ async requestSave() {
1353
+ if (this.saving) {
1354
+ this.saveQueued = true;
1355
+ return;
1356
+ }
1357
+ await this.save();
1358
+ if (!this.saveQueued) return;
1359
+ this.saveQueued = false;
1360
+ await this.requestSave();
1361
+ }
1285
1362
  async save() {
1286
1363
  const plan = this.plan();
1287
1364
  const valid = plan.filter((item) => item.judge !== void 0);
@@ -1436,6 +1513,7 @@ window.__ModuleLoader__.load({
1436
1513
  booleanField("enabled"),
1437
1514
  booleanField("announceToAgent"),
1438
1515
  choiceField("presentation", PRESENTATION_CHOICES),
1516
+ booleanField("dispatcher"),
1439
1517
  booleanField("guardEnabled"),
1440
1518
  choiceField("guardSensitivity", SENSITIVITY_CHOICES),
1441
1519
  numberField("guardStallReasoningChars", {
@@ -1459,6 +1537,7 @@ window.__ModuleLoader__.load({
1459
1537
  enabled: this.form.field("enabled"),
1460
1538
  announceToAgent: this.form.field("announceToAgent"),
1461
1539
  presentation: this.form.field("presentation"),
1540
+ dispatcher: this.form.field("dispatcher"),
1462
1541
  guardEnabled: this.form.field("guardEnabled"),
1463
1542
  guardSensitivity: this.form.field("guardSensitivity"),
1464
1543
  guardStallReasoningChars: this.form.field("guardStallReasoningChars"),
@@ -1500,6 +1579,7 @@ window.__ModuleLoader__.load({
1500
1579
  t,
1501
1580
  titleKey: "settings.title",
1502
1581
  descriptionKey: "settings.description",
1582
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LiangShenMark, {}),
1503
1583
  defaultOpen: false,
1504
1584
  state,
1505
1585
  renderChildrenWhenNotExposed: true,
@@ -1554,6 +1634,21 @@ window.__ModuleLoader__.load({
1554
1634
  props.resetField("presentation");
1555
1635
  }
1556
1636
  }),
1637
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
1638
+ id: "settings-liangshen-dispatcher",
1639
+ label: t("settings.dispatcher"),
1640
+ hint: t("settings.dispatcherHint"),
1641
+ onLabel: t("settings.on"),
1642
+ offLabel: t("settings.off"),
1643
+ ...fieldProps,
1644
+ ...state.dispatcher,
1645
+ onEdit: (text) => {
1646
+ props.edit("dispatcher", text);
1647
+ },
1648
+ onReset: () => {
1649
+ props.resetField("dispatcher");
1650
+ }
1651
+ }),
1557
1652
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
1558
1653
  id: "settings-liangshen-guard-enabled",
1559
1654
  label: t("settings.guardEnabled"),
@@ -1591,7 +1686,7 @@ window.__ModuleLoader__.load({
1591
1686
  numeric: true,
1592
1687
  label: t("settings.guardStallChars"),
1593
1688
  hint: t("settings.guardStallCharsHint"),
1594
- placeholder: "8000",
1689
+ placeholder: t("settings.guardAdaptive"),
1595
1690
  ...fieldProps,
1596
1691
  ...state.guardStallReasoningChars,
1597
1692
  onEdit: (text) => {
@@ -1606,7 +1701,7 @@ window.__ModuleLoader__.load({
1606
1701
  numeric: true,
1607
1702
  label: t("settings.guardGlobalCap"),
1608
1703
  hint: t("settings.guardGlobalCapHint"),
1609
- placeholder: "4",
1704
+ placeholder: t("settings.guardAdaptive"),
1610
1705
  ...fieldProps,
1611
1706
  ...state.guardGlobalStallCap,
1612
1707
  onEdit: (text) => {
@@ -1621,7 +1716,7 @@ window.__ModuleLoader__.load({
1621
1716
  numeric: true,
1622
1717
  label: t("settings.guardEchoFailures"),
1623
1718
  hint: t("settings.guardEchoFailuresHint"),
1624
- placeholder: "3",
1719
+ placeholder: t("settings.guardAdaptive"),
1625
1720
  ...fieldProps,
1626
1721
  ...state.guardEchoFailures,
1627
1722
  onEdit: (text) => {
@@ -1666,6 +1761,8 @@ window.__ModuleLoader__.load({
1666
1761
  "settings.announceToAgentHint": "开启后向每一轮 agent 系统提示注入本插件公告;默认关闭以保持提示词干净。",
1667
1762
  "settings.presentation": "工具面呈现方式",
1668
1763
  "settings.presentationHint": "写入本插件声明的预设的 tool-catalog 行:both(出厂默认)让原生清单与 run_code 同驻(原生直调优先);native 保持原生工具清单;ptc 把 wire 收拢为 run_code。改动立即生效,但已开始的会话保持其已声明的组合。",
1764
+ "settings.dispatcher": "调度者身份",
1765
+ "settings.dispatcherHint": "开启后本模式按调度 Agent 工作:先分诊复杂度(L0/L1 直接执行,L2 走完整流程),L2 任务先澄清访谈再规划,由主代理派发子代理并逐层审查与验收。与工具面呈现方式无关,只决定身份与流程纪律。出厂默认开启;关闭后回到仅含工作纪律的极简 persona。",
1669
1766
  "settings.on": "开",
1670
1767
  "settings.off": "关",
1671
1768
  "settings.inherit": "继承(跟随部署默认)",
@@ -1685,18 +1782,19 @@ window.__ModuleLoader__.load({
1685
1782
  "presentation.native": "native(原生工具清单)",
1686
1783
  "presentation.both": "both(两者同驻)",
1687
1784
  "settings.guardEnabled": "启用退化熔断器",
1688
- "settings.guardEnabledHint": "运行时检测思考退化(连续零产出长思考 / 同参重复失败),触发时注入熔断提示并临时下调推理档位。关闭后不干预任何请求。",
1785
+ "settings.guardEnabledHint": "运行时检测思考退化(连续零产出长思考 / 同参重复失败),触发时注入熔断提示;仅停摆信号额外临时下调推理档位(max→high,不下探到甜区以下)。关闭后不干预任何请求。",
1689
1786
  "settings.guardStallChars": "单步暴走字符阈值",
1690
- "settings.guardStallCharsHint": "单条推理达到该字符数且零产出即触发熔断(按 V4.1 官方 384K 最大输出校准;默认 8000,约 2-4K 思考 token)。",
1787
+ "settings.guardStallCharsHint": "留空即按推理档位自适应:max 档 8000 / high 档 12000 / low 档 20000 字符(按 V4.1 官方 384K 最大输出校准,约 2-4K 思考 token),再按灵敏度预设缩放。填写本字段则以该固定值覆盖所有档位。",
1691
1788
  "settings.guardGlobalCap": "慢烧连续步数",
1692
- "settings.guardGlobalCapHint": "连续多少步有真实推理但零产出触发慢烧熔断(默认 4;步数越小越敏感,真实长调查建议调大)。",
1789
+ "settings.guardGlobalCapHint": "留空即按灵敏度预设缩放(均衡档为 4);provider 不持久化推理文本的会话也以此为兜底步骤计数。填写本字段则以该固定值覆盖。步数越小越敏感,真实长调查建议调大。",
1693
1790
  "settings.guardSensitivity": "熔断灵敏度",
1694
- "settings.guardSensitivityHint": "整体缩放熔断阈值:保守(更少打断,阈值×1.5)、均衡(出厂校准值)、激进(更早触发,阈值×0.5)。阈值随推理档位自适应:max 档 8000 / high 档 12000 / low 档 20000 字符。",
1791
+ "settings.guardSensitivityHint": "整体缩放熔断阈值:保守(更少打断,阈值×1.5)、均衡(出厂校准值)、激进(更早触发,阈值×0.5)。仅在对应细调字段留空时生效——阈值随推理档位自适应:max 档 8000 / high 档 12000 / low 档 20000 字符。",
1695
1792
  "sensitivity.conservative": "保守(少打断)",
1696
1793
  "sensitivity.balanced": "均衡(默认)",
1697
1794
  "sensitivity.aggressive": "激进(早触发)",
1698
1795
  "settings.guardEchoFailures": "同参连续失败次数",
1699
- "settings.guardEchoFailuresHint": "同一工具以相同参数连续失败多少次触发空转熔断(默认 3)。"
1796
+ "settings.guardEchoFailuresHint": "留空即按灵敏度预设缩放(均衡档为 3);填写本字段则以该固定值覆盖。空转信号只注入熔断消息,不下调推理档位。",
1797
+ "settings.guardAdaptive": "自适应"
1700
1798
  };
1701
1799
  /** English counterpart; the key set mirrors {@link zh} exactly. */
1702
1800
  const en = {
@@ -1723,6 +1821,8 @@ window.__ModuleLoader__.load({
1723
1821
  "settings.announceToAgentHint": "Adds this plugin announcement to every agent system prompt; off by default so prompts stay clean.",
1724
1822
  "settings.presentation": "Wire presentation",
1725
1823
  "settings.presentationHint": "Written into the tool-catalog row of the preset this plugin declares: both (the shipped default) keeps the roster and run_code co-resident (direct native calls first); native keeps the native roster; ptc collapses the wire to run_code. A change re-declares the preset immediately; sessions that already started keep the composition they declared.",
1824
+ "settings.dispatcher": "Dispatcher identity",
1825
+ "settings.dispatcherHint": "When on, the mode works as a dispatcher agent: it triages complexity first (L0/L1 work is done directly, an L2 task runs the full flow), clarifies an L2 task through an interview before planning, and the lead agent dispatches subagents and reviews and accepts them layer by layer. It is unrelated to the wire presentation and decides identity and process discipline only. On by default; switching it off returns the prompt to the bare persona with its working discipline.",
1726
1826
  "settings.on": "On",
1727
1827
  "settings.off": "Off",
1728
1828
  "settings.inherit": "Inherit (deployment default)",
@@ -1742,18 +1842,19 @@ window.__ModuleLoader__.load({
1742
1842
  "presentation.native": "native (native tool roster)",
1743
1843
  "presentation.both": "both (both co-resident)",
1744
1844
  "settings.guardEnabled": "Degeneration circuit breaker",
1745
- "settings.guardEnabledHint": "Detects reasoning degeneration at runtime (consecutive zero-output long reasoning / repeated identical-argument failures), injecting a breaker message and stepping the reasoning effort down when it fires. Disabled means requests are never touched.",
1845
+ "settings.guardEnabledHint": "Detects reasoning degeneration at runtime (consecutive zero-output long reasoning / repeated identical-argument failures) and injects a breaker message; only a stall also steps the reasoning effort down (max to high, never below the sweet spot). Disabled means requests are never touched.",
1746
1846
  "settings.guardStallChars": "Runaway reasoning character floor",
1747
- "settings.guardStallCharsHint": "One reasoning block reaching this many characters with no output fires the breaker (calibrated against V4.1's official 384K max output; default 8000, roughly 2-4K thinking tokens).",
1847
+ "settings.guardStallCharsHint": "Leave empty to adapt to the reasoning effort: 8000 at max / 12000 at high / 20000 at low characters (calibrated against V4.1's official 384K max output, roughly 2-4K thinking tokens), then scaled by the sensitivity preset. Setting a value pins it for every effort level.",
1748
1848
  "settings.guardGlobalCap": "Slow-burn step count",
1749
- "settings.guardGlobalCapHint": "Consecutive output-free steps of real reasoning that fire the slow-burn ladder (default 4; lower is more sensitive — raise it for genuinely long investigations).",
1849
+ "settings.guardGlobalCapHint": "Leave empty to scale with the sensitivity preset (4 at balanced); it is also the fallback step count for a session whose provider persists no reasoning text. Setting a value pins it. Lower is more sensitive — raise it for genuinely long investigations.",
1750
1850
  "settings.guardSensitivity": "Breaker sensitivity",
1751
- "settings.guardSensitivityHint": "Scales every breaker threshold: conservative (fewer interruptions, x1.5), balanced (the calibrated defaults), aggressive (fires earlier, x0.5). Thresholds adapt to the reasoning effort: 8000 at max / 12000 at high / 20000 at low.",
1851
+ "settings.guardSensitivityHint": "Scales every breaker threshold: conservative (fewer interruptions, x1.5), balanced (the calibrated defaults), aggressive (fires earlier, x0.5). It applies only where the matching fine-tuning field is left empty — thresholds adapt to the reasoning effort: 8000 at max / 12000 at high / 20000 at low.",
1752
1852
  "sensitivity.conservative": "Conservative (fewer interruptions)",
1753
1853
  "sensitivity.balanced": "Balanced (default)",
1754
1854
  "sensitivity.aggressive": "Aggressive (fires earlier)",
1755
1855
  "settings.guardEchoFailures": "Identical-argument failures",
1756
- "settings.guardEchoFailuresHint": "Identical-argument failures of the same tool in a row that fire the echo ladder (default 3)."
1856
+ "settings.guardEchoFailuresHint": "Leave empty to scale with the sensitivity preset (3 at balanced); setting a value pins it. An echo only injects the breaker message — it never steps the reasoning effort down.",
1857
+ "settings.guardAdaptive": "Adaptive"
1757
1858
  };
1758
1859
  //#endregion
1759
1860
  //#region src/client/plugin-card-seat.ts
@@ -1859,11 +1960,13 @@ window.__ModuleLoader__.load({
1859
1960
  ...seat.order === void 0 ? {} : { order: seat.order },
1860
1961
  ...seat.label === void 0 ? {} : { label: seat.label },
1861
1962
  locale: seat.locale,
1963
+ ...seat.children === void 0 ? {} : { children: seat.children },
1862
1964
  ...seat.inject === void 0 ? {} : { inject }
1863
1965
  } : {
1864
1966
  name: OFFICIAL_PLUGIN_CARD_SEAT,
1865
1967
  key: seat.bundle,
1866
1968
  locale: seat.locale,
1969
+ ...seat.children === void 0 ? {} : { children: seat.children },
1867
1970
  ...seat.inject === void 0 ? {} : { inject }
1868
1971
  }, component);
1869
1972
  current = target;