@linxin666/dsh-liangshen 0.4.5 → 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 +2 -2
- package/README.md +11 -6
- package/README.zh.md +11 -6
- package/lib/client.js +77 -13
- package/lib/client.js.map +1 -1
- package/lib/index.js +33 -19
- package/lib/types/client/LiangShenMark.d.ts +13 -0
- package/lib/types/client/LiangShenSettingsCard.d.ts +11 -7
- package/lib/types/client/locales.d.ts +3 -0
- package/lib/types/client/plugin-card-seat.d.ts +5 -0
- package/lib/types/composition.d.ts +15 -11
- package/lib/types/index.d.ts +44 -22
- package/package.json +2 -2
- package/presets/liangshen/agent.cordis.yml +41 -6
- package/presets/liangshen/dispatcher-rules.mjs +121 -0
- package/presets/liangshen/guard.mjs +134 -34
- package/presets/liangshen/minimal-prompt.mjs +65 -9
- package/presets/liangshen/tool-catalog.mjs +45 -12
- package/src/announce.test.ts +3 -2
- package/src/client/LiangShenMark.tsx +25 -0
- package/src/client/LiangShenSettingsCard.tsx +29 -10
- package/src/client/locales.ts +16 -10
- package/src/client/plugin-card-seat.ts +7 -0
- package/src/composition.test.ts +56 -0
- package/src/composition.ts +16 -11
- package/src/index.test.ts +56 -0
- package/src/index.ts +51 -23
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:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 75f5ffa338130e19fc9b70463a5e34d8fdb4e20d
|
|
6
|
+
README.zh.md: a6817b19478158365369a3131d4fb237a6e63299
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ LiangShen mode therefore keeps the whole session on one presentation, chosen by
|
|
|
33
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;
|
|
34
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;
|
|
35
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.
|
|
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 stepping the reasoning effort one notch down for the next few requests (max → high
|
|
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);
|
|
37
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.
|
|
38
38
|
|
|
39
39
|
## Security model
|
|
@@ -46,7 +46,9 @@ This mode operates strictly within the official host security architecture and c
|
|
|
46
46
|
|
|
47
47
|
## The lever
|
|
48
48
|
|
|
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:
|
|
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);
|
|
50
52
|
|
|
51
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);
|
|
52
54
|
- push it up and the preset you were on before comes back — with nothing remembered yet, that is the deployment default;
|
|
@@ -116,11 +118,12 @@ When validating mode behavior and evaluating performance, verification tiers mus
|
|
|
116
118
|
| `enabled` | `true` | Master switch: when false, the preset is not declared and the announcement does not run. |
|
|
117
119
|
| `announceToAgent` | `false` | Opt-in: when true, a system-prompt section announces the plugin. Off by default so agent system prompts stay clean. |
|
|
118
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. |
|
|
119
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. |
|
|
120
123
|
| `guardSensitivity` | `balanced` | Sensitivity preset scaling every breaker threshold: `conservative` (fewer interruptions, x1.5), `balanced` (the calibrated defaults), `aggressive` (fires earlier, x0.5). |
|
|
121
|
-
| `guardStallReasoningChars` |
|
|
122
|
-
| `guardGlobalStallCap` |
|
|
123
|
-
| `guardEchoFailures` |
|
|
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`. |
|
|
124
127
|
|
|
125
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.
|
|
126
129
|
|
|
@@ -133,10 +136,12 @@ All fields are editable in the web settings surface (plugin config) or through t
|
|
|
133
136
|
- A step whose prompt assembly was not observed injects nothing — the catalog is never guessed from a stale view;
|
|
134
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;
|
|
135
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;
|
|
136
|
-
- 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;
|
|
137
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;
|
|
138
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;
|
|
139
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;
|
|
140
145
|
- The roster does not publish the `workflow` tool, while the workflow engine stays mounted for `ralph`;
|
|
141
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;
|
|
142
147
|
- The file tools inherit the host file sandbox (no bare `dsh-fs-local` filesystem);
|
package/README.zh.md
CHANGED
|
@@ -33,7 +33,7 @@ DeepSeek V4.1 Flash 的后训练直接对齐其原生 DSML 工具调用面,官
|
|
|
33
33
|
6. 最小版 working-context 行——plan-mode 状态、已激活的分页命名空间、进行中的 todo——只在其来源可读时注入到最新消息尾部,让当前状态落在模型的局部注意力窗口内;运行时上下文(sandbox 与 approval 快照)与 skill 目录按 Standard 模式正常注入;
|
|
34
34
|
7. 目录把已激活分页家族的工具归在 `namespace `<名称>` (activated):` 标题之下,而不是把一个服务端的工具散落在字母序清单里;未被分页的工具仍保持扁平条目;
|
|
35
35
|
8. `maxResidentTokens`(默认 8000)估算常驻 wire 面并在超过时告警一次,列出最重的工具并把 `pagedToolPatterns` 指为处置手段。该阈值按 V4.1 的 KV 压缩重新校准(其 KV cache 为 V4-Flash 的 1/4,同样的 schema 负载只占 1/4 的稀疏索引槽位,阈值由 6000 上调至 8000),仍校准在出厂清单之上,用于发现真实增长而非出厂配置本身。该守卫从不截断:静默丢掉会话需要的工具,等于用可度量的上下文成本换取不可度量的能力损失。
|
|
36
|
-
9. 运行时退化熔断器(`guard`)每步从会话事件流折叠信号,在两类形态下每个 episode
|
|
36
|
+
9. 运行时退化熔断器(`guard`)每步从会话事件流折叠信号,在两类形态下每个 episode 触发一次——停摆(连续零产出的长思考回合)或空转(同一工具以相同参数连续失败)——注入熔断消息;并且仅在停摆信号下——其成因是推理预算过大——在接下来几个请求内把推理档位临时下调一档(max → high,high 档保持不变,因为它已处于模型实测的推理甜区);空转信号只注入消息,因为它的成因是调用本身失效而非预算过大;无信号时它从不改写任何请求,路由的显式档位与前缀缓存都不受影响。这是 persona 反思熔断无法充当的外力(DSH discussion #5976);
|
|
37
37
|
10. 关键事实登记簿(`fact_register`)让模型把用户硬性约束、已确认的架构决策、失败过的路径登记为一行短事实;登记簿从持久事件流折叠,随 `[Working Context: ...]` 行投射——每步都落在保证命中的局部注意力窗口内——以此对抗 V4.1 的长会话遗忘。
|
|
38
38
|
|
|
39
39
|
## 安全模型
|
|
@@ -46,7 +46,9 @@ DeepSeek V4.1 Flash 的后训练直接对齐其原生 DSML 工具调用面,官
|
|
|
46
46
|
|
|
47
47
|
## 拨杆
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
浏览器半区在新建会话页的输入框工具行里、模型选择器紧左侧装了一台老虎机拨杆,设置卡片则为梁神模式这一条目标出一枚图形标记,画的正是这台拨杆——一个球头、一根杆、一个底座,用当前文字颜色上色,跟随当前主题:
|
|
50
|
+
|
|
51
|
+
- 把拨杆拨下——拖动、点击或用键盘激活都算——即将开始的会话就组合为梁神模式;命中后播放中奖特效(闪光、冲击环、火花,以及「梁神模式」横幅叠文言文、二进制、摩斯三行);
|
|
50
52
|
|
|
51
53
|
- 把拨杆拨下——拖动、点击或用键盘激活都算——即将开始的会话就组合为梁神模式;命中后播放中奖特效(闪光、冲击环、火花,以及「梁神模式」横幅叠文言文、二进制、摩斯三行);
|
|
52
54
|
- 把拨杆上拨,就回到你此前的模式——还没有记住任何模式时,回到部署默认预设;
|
|
@@ -116,11 +118,12 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
116
118
|
| `enabled` | `true` | 总开关:关闭后不声明预设、也不发公告。 |
|
|
117
119
|
| `announceToAgent` | `false` | 按需开启:开启后向 agent 系统提示注入本插件公告。默认关闭,保持系统提示词干净。 |
|
|
118
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` 决定身份与流程纪律。 |
|
|
119
122
|
| `guardEnabled` | `true` | 运行时退化熔断器总开关:检测连续零产出长思考与同参重复失败,触发时注入熔断提示并临时下调推理档位;关闭后不干预任何请求。 |
|
|
120
123
|
| `guardSensitivity` | `balanced` | 熔断灵敏度预设:整体缩放阈值——`conservative`(更少打断,×1.5)、`balanced`(出厂校准值)、`aggressive`(更早触发,×0.5)。 |
|
|
121
|
-
| `guardStallReasoningChars` |
|
|
122
|
-
| `guardGlobalStallCap` |
|
|
123
|
-
| `guardEchoFailures` |
|
|
124
|
+
| `guardStallReasoningChars` | (未设置) | 单步暴走梯字符阈值的**覆写值**:不设置时阈值随推理档位自适应(max 档 8000 / high 档 12000 / low 档 20000,按 V4.1 官方 384K 最大输出校准),并再按 `guardSensitivity` 缩放;设置本字段则以本值为准、覆盖所有档位的自适应表。 |
|
|
125
|
+
| `guardGlobalStallCap` | (未设置) | 熔断器慢烧梯连续步数的**覆写值**:不设置时随灵敏度预设缩放(balanced 为 4),设置本字段则以本值为准。 |
|
|
126
|
+
| `guardEchoFailures` | (未设置) | 熔断器空转梯的**覆写值**:同一工具以相同参数连续失败多少次触发;不设置时该次数随灵敏度预设缩放(balanced 为 3)。以上熔断字段与 `presentation` 一样写入所声明的 preset 生效。 |
|
|
124
127
|
|
|
125
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 拒绝重组已开始的会话。
|
|
126
129
|
|
|
@@ -133,10 +136,12 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
133
136
|
- 未观测到 prompt 组装的步不注入任何内容——目录绝不会由过期视图推测;
|
|
134
137
|
- 若组合中不存在任何被接受的 persona section 名(`deployment:persona-prefix`、`deployment:persona`、`persona`),过滤器会保留组装结果并只告警一次,而不是发出空系统提示词;
|
|
135
138
|
- plan mode 通过其 `plan:policy` 段支持;置 `keepPlanPolicy: false` 后该模式仍有工具,但失去约束它的策略文本;
|
|
136
|
-
- 被分页扣留的工具(出厂模式 `mcp__*`)在模型经 `tool_activate` 激活其命名空间之前不进 wire、也不进生成的 SDK
|
|
139
|
+
- 被分页扣留的工具(出厂模式 `mcp__*`)在模型经 `tool_activate` 激活其命名空间之前不进 wire、也不进生成的 SDK;同时最多三个分页命名空间保持激活,激活第四个会把最近最少使用的逐回摘要状态,激活状态在压缩与恢复后从持久事件流重建。`ptc` 下分页同时作用于作用域的工具注册表,未激活的命名空间在 `run_code` 程序内同样不可达;`both` 下不安装注册表级限制,被分页的命名空间在程序内仍可达——可达性来自原生 wire 本身,而非分页豁免;
|
|
137
140
|
- working-context 行只在其来源(plan-mode 状态、已激活的分页命名空间、进行中的 todo)可读时注入,否则省略;
|
|
138
141
|
- 工具结果超过 4096 字符即被修剪,保留 2048 字符头部与 1024 字符尾部(守护稀疏索引槽位的同时保住错误尾部与退出码),避免超大输出挤占上下文;
|
|
139
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 预设同样如此),组合测试按结构统计开启行数;
|
|
140
145
|
- 清单不发布 `workflow` 工具,而 workflow 引擎仍为 `ralph` 保留挂载;
|
|
141
146
|
- shell 挂载上游标准 Stdio 栈,POSIX 注册 `bash`,win32 注册 `pwsh`——每个宿主恰好挂一个 shell 工具,带简短功能描述标题卡片与确定性退出码;
|
|
142
147
|
- 文件工具继承宿主文件沙箱(不挂载裸 `dsh-fs-local`);
|
package/lib/client.js
CHANGED
|
@@ -612,6 +612,44 @@ 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
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";
|
|
@@ -1475,6 +1513,7 @@ window.__ModuleLoader__.load({
|
|
|
1475
1513
|
booleanField("enabled"),
|
|
1476
1514
|
booleanField("announceToAgent"),
|
|
1477
1515
|
choiceField("presentation", PRESENTATION_CHOICES),
|
|
1516
|
+
booleanField("dispatcher"),
|
|
1478
1517
|
booleanField("guardEnabled"),
|
|
1479
1518
|
choiceField("guardSensitivity", SENSITIVITY_CHOICES),
|
|
1480
1519
|
numberField("guardStallReasoningChars", {
|
|
@@ -1498,6 +1537,7 @@ window.__ModuleLoader__.load({
|
|
|
1498
1537
|
enabled: this.form.field("enabled"),
|
|
1499
1538
|
announceToAgent: this.form.field("announceToAgent"),
|
|
1500
1539
|
presentation: this.form.field("presentation"),
|
|
1540
|
+
dispatcher: this.form.field("dispatcher"),
|
|
1501
1541
|
guardEnabled: this.form.field("guardEnabled"),
|
|
1502
1542
|
guardSensitivity: this.form.field("guardSensitivity"),
|
|
1503
1543
|
guardStallReasoningChars: this.form.field("guardStallReasoningChars"),
|
|
@@ -1539,6 +1579,7 @@ window.__ModuleLoader__.load({
|
|
|
1539
1579
|
t,
|
|
1540
1580
|
titleKey: "settings.title",
|
|
1541
1581
|
descriptionKey: "settings.description",
|
|
1582
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LiangShenMark, {}),
|
|
1542
1583
|
defaultOpen: false,
|
|
1543
1584
|
state,
|
|
1544
1585
|
renderChildrenWhenNotExposed: true,
|
|
@@ -1593,6 +1634,21 @@ window.__ModuleLoader__.load({
|
|
|
1593
1634
|
props.resetField("presentation");
|
|
1594
1635
|
}
|
|
1595
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
|
+
}),
|
|
1596
1652
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BooleanField, {
|
|
1597
1653
|
id: "settings-liangshen-guard-enabled",
|
|
1598
1654
|
label: t("settings.guardEnabled"),
|
|
@@ -1630,7 +1686,7 @@ window.__ModuleLoader__.load({
|
|
|
1630
1686
|
numeric: true,
|
|
1631
1687
|
label: t("settings.guardStallChars"),
|
|
1632
1688
|
hint: t("settings.guardStallCharsHint"),
|
|
1633
|
-
placeholder: "
|
|
1689
|
+
placeholder: t("settings.guardAdaptive"),
|
|
1634
1690
|
...fieldProps,
|
|
1635
1691
|
...state.guardStallReasoningChars,
|
|
1636
1692
|
onEdit: (text) => {
|
|
@@ -1645,7 +1701,7 @@ window.__ModuleLoader__.load({
|
|
|
1645
1701
|
numeric: true,
|
|
1646
1702
|
label: t("settings.guardGlobalCap"),
|
|
1647
1703
|
hint: t("settings.guardGlobalCapHint"),
|
|
1648
|
-
placeholder: "
|
|
1704
|
+
placeholder: t("settings.guardAdaptive"),
|
|
1649
1705
|
...fieldProps,
|
|
1650
1706
|
...state.guardGlobalStallCap,
|
|
1651
1707
|
onEdit: (text) => {
|
|
@@ -1660,7 +1716,7 @@ window.__ModuleLoader__.load({
|
|
|
1660
1716
|
numeric: true,
|
|
1661
1717
|
label: t("settings.guardEchoFailures"),
|
|
1662
1718
|
hint: t("settings.guardEchoFailuresHint"),
|
|
1663
|
-
placeholder: "
|
|
1719
|
+
placeholder: t("settings.guardAdaptive"),
|
|
1664
1720
|
...fieldProps,
|
|
1665
1721
|
...state.guardEchoFailures,
|
|
1666
1722
|
onEdit: (text) => {
|
|
@@ -1705,6 +1761,8 @@ window.__ModuleLoader__.load({
|
|
|
1705
1761
|
"settings.announceToAgentHint": "开启后向每一轮 agent 系统提示注入本插件公告;默认关闭以保持提示词干净。",
|
|
1706
1762
|
"settings.presentation": "工具面呈现方式",
|
|
1707
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。",
|
|
1708
1766
|
"settings.on": "开",
|
|
1709
1767
|
"settings.off": "关",
|
|
1710
1768
|
"settings.inherit": "继承(跟随部署默认)",
|
|
@@ -1724,18 +1782,19 @@ window.__ModuleLoader__.load({
|
|
|
1724
1782
|
"presentation.native": "native(原生工具清单)",
|
|
1725
1783
|
"presentation.both": "both(两者同驻)",
|
|
1726
1784
|
"settings.guardEnabled": "启用退化熔断器",
|
|
1727
|
-
"settings.guardEnabledHint": "运行时检测思考退化(连续零产出长思考 /
|
|
1785
|
+
"settings.guardEnabledHint": "运行时检测思考退化(连续零产出长思考 / 同参重复失败),触发时注入熔断提示;仅停摆信号额外临时下调推理档位(max→high,不下探到甜区以下)。关闭后不干预任何请求。",
|
|
1728
1786
|
"settings.guardStallChars": "单步暴走字符阈值",
|
|
1729
|
-
"settings.guardStallCharsHint": "
|
|
1787
|
+
"settings.guardStallCharsHint": "留空即按推理档位自适应:max 档 8000 / high 档 12000 / low 档 20000 字符(按 V4.1 官方 384K 最大输出校准,约 2-4K 思考 token),再按灵敏度预设缩放。填写本字段则以该固定值覆盖所有档位。",
|
|
1730
1788
|
"settings.guardGlobalCap": "慢烧连续步数",
|
|
1731
|
-
"settings.guardGlobalCapHint": "
|
|
1789
|
+
"settings.guardGlobalCapHint": "留空即按灵敏度预设缩放(均衡档为 4);provider 不持久化推理文本的会话也以此为兜底步骤计数。填写本字段则以该固定值覆盖。步数越小越敏感,真实长调查建议调大。",
|
|
1732
1790
|
"settings.guardSensitivity": "熔断灵敏度",
|
|
1733
|
-
"settings.guardSensitivityHint": "整体缩放熔断阈值:保守(更少打断,阈值×1.5)、均衡(出厂校准值)、激进(更早触发,阈值×0.5
|
|
1791
|
+
"settings.guardSensitivityHint": "整体缩放熔断阈值:保守(更少打断,阈值×1.5)、均衡(出厂校准值)、激进(更早触发,阈值×0.5)。仅在对应细调字段留空时生效——阈值随推理档位自适应:max 档 8000 / high 档 12000 / low 档 20000 字符。",
|
|
1734
1792
|
"sensitivity.conservative": "保守(少打断)",
|
|
1735
1793
|
"sensitivity.balanced": "均衡(默认)",
|
|
1736
1794
|
"sensitivity.aggressive": "激进(早触发)",
|
|
1737
1795
|
"settings.guardEchoFailures": "同参连续失败次数",
|
|
1738
|
-
"settings.guardEchoFailuresHint": "
|
|
1796
|
+
"settings.guardEchoFailuresHint": "留空即按灵敏度预设缩放(均衡档为 3);填写本字段则以该固定值覆盖。空转信号只注入熔断消息,不下调推理档位。",
|
|
1797
|
+
"settings.guardAdaptive": "自适应"
|
|
1739
1798
|
};
|
|
1740
1799
|
/** English counterpart; the key set mirrors {@link zh} exactly. */
|
|
1741
1800
|
const en = {
|
|
@@ -1762,6 +1821,8 @@ window.__ModuleLoader__.load({
|
|
|
1762
1821
|
"settings.announceToAgentHint": "Adds this plugin announcement to every agent system prompt; off by default so prompts stay clean.",
|
|
1763
1822
|
"settings.presentation": "Wire presentation",
|
|
1764
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.",
|
|
1765
1826
|
"settings.on": "On",
|
|
1766
1827
|
"settings.off": "Off",
|
|
1767
1828
|
"settings.inherit": "Inherit (deployment default)",
|
|
@@ -1781,18 +1842,19 @@ window.__ModuleLoader__.load({
|
|
|
1781
1842
|
"presentation.native": "native (native tool roster)",
|
|
1782
1843
|
"presentation.both": "both (both co-resident)",
|
|
1783
1844
|
"settings.guardEnabled": "Degeneration circuit breaker",
|
|
1784
|
-
"settings.guardEnabledHint": "Detects reasoning degeneration at runtime (consecutive zero-output long reasoning / repeated identical-argument failures)
|
|
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.",
|
|
1785
1846
|
"settings.guardStallChars": "Runaway reasoning character floor",
|
|
1786
|
-
"settings.guardStallCharsHint": "
|
|
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.",
|
|
1787
1848
|
"settings.guardGlobalCap": "Slow-burn step count",
|
|
1788
|
-
"settings.guardGlobalCapHint": "
|
|
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.",
|
|
1789
1850
|
"settings.guardSensitivity": "Breaker sensitivity",
|
|
1790
|
-
"settings.guardSensitivityHint": "Scales every breaker threshold: conservative (fewer interruptions, x1.5), balanced (the calibrated defaults), aggressive (fires earlier, x0.5).
|
|
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.",
|
|
1791
1852
|
"sensitivity.conservative": "Conservative (fewer interruptions)",
|
|
1792
1853
|
"sensitivity.balanced": "Balanced (default)",
|
|
1793
1854
|
"sensitivity.aggressive": "Aggressive (fires earlier)",
|
|
1794
1855
|
"settings.guardEchoFailures": "Identical-argument failures",
|
|
1795
|
-
"settings.guardEchoFailuresHint": "
|
|
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"
|
|
1796
1858
|
};
|
|
1797
1859
|
//#endregion
|
|
1798
1860
|
//#region src/client/plugin-card-seat.ts
|
|
@@ -1898,11 +1960,13 @@ window.__ModuleLoader__.load({
|
|
|
1898
1960
|
...seat.order === void 0 ? {} : { order: seat.order },
|
|
1899
1961
|
...seat.label === void 0 ? {} : { label: seat.label },
|
|
1900
1962
|
locale: seat.locale,
|
|
1963
|
+
...seat.children === void 0 ? {} : { children: seat.children },
|
|
1901
1964
|
...seat.inject === void 0 ? {} : { inject }
|
|
1902
1965
|
} : {
|
|
1903
1966
|
name: OFFICIAL_PLUGIN_CARD_SEAT,
|
|
1904
1967
|
key: seat.bundle,
|
|
1905
1968
|
locale: seat.locale,
|
|
1969
|
+
...seat.children === void 0 ? {} : { children: seat.children },
|
|
1906
1970
|
...seat.inject === void 0 ? {} : { inject }
|
|
1907
1971
|
}, component);
|
|
1908
1972
|
current = target;
|