@linxin666/dsh-liangshen 0.3.21 → 0.3.23
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 +38 -24
- package/README.zh.md +38 -24
- package/lib/index.js +11 -10
- package/lib/types/index.d.ts +11 -10
- package/package.json +2 -2
- package/presets/liangshen/agent.cordis.yml +34 -27
- package/presets/liangshen/minimal-prompt.mjs +393 -92
- package/presets/liangshen/tool-catalog.mjs +302 -189
- package/src/index.ts +11 -10
- package/tools/benchmark-driver.mjs +124 -0
- package/tools/benchmark-live-run.mjs +771 -0
- package/tools/benchmark-report.mjs +354 -0
- package/tools/tasks/liangshen-v41-flash.json +127 -0
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: fce0b0bac57f894854372a0ad570092e6b74793d
|
|
6
|
+
README.zh.md: 82ed025985564508569bef37c08a07a9b5cdc452
|
package/README.md
CHANGED
|
@@ -2,23 +2,33 @@
|
|
|
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: on host startup it syncs the bundled preset into `~/.dsh/.agent-presets`, 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
|
|
5
|
+
Ships the LiangShen preset as a one-command plugin of the dsh-web family: on host startup it syncs the bundled preset into `~/.dsh/.agent-presets`, 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, session workspace directory, and AGENTS.md-style workspace instructions in the system prompt, and delivers its tool surface as a durable user message after the user's message from the first turn on — the way the harness injects the skill catalog, naming exactly the tools that request opens — while the wire is staged: the session's entire first user turn natively presents a foundational tool surface (default `[bash, str_replace_editor, exit_plan_mode, skill]`, with bash-only preserved as a configuration experiment), and from the second turn the session presents its tools in PTC mode upon successful activation, where the wire carries the single `run_code` transport and other tools are reached via the generated SDK. Deterministic turn boundary transition occurs when PTC is actually activated, preserving full input and output key parameter semantics with no reasoning gating and no output-token cap. Built entirely on the official NPM SDK — no dsh source changes.
|
|
6
6
|
|
|
7
7
|
## Why
|
|
8
8
|
|
|
9
|
-
DeepSeek V4
|
|
9
|
+
DeepSeek V4 models condition strongly on the initial prompt and the first-turn model-visible tool surface when choosing their execution trajectory. Exposing an unbounded tool surface prematurely can scatter execution trajectories, while completely omitting editing or planning tools restricts the completion of complex tasks.
|
|
10
10
|
|
|
11
|
-
LiangShen
|
|
11
|
+
LiangShen mode adopts a staged tool and compact prompt architecture: the anchoring portion (the system prompt) keeps a minimal persona with standing working discipline and workspace instructions; the capability portion (the tool surface) is announced from the first user message via a skill-catalog-style injection, while the entire first user turn natively presents a foundational anchor tool set (`[bash, str_replace_editor, exit_plan_mode, skill]`) covering discovery, editing, exiting plan mode, and skill lookups; from the second turn onward, upon meeting code runtime requirements and successful declaration, it smoothly transitions to PTC (program-as-tool) mode. Under PTC presentation, the injected message carries generated SDK bindings, complete input and output key parameter semantics, the program contract ("one program per intent"), and the rule that only `run_code` may be called directly. This mode makes no overcommitments regarding "exact identity with official Minimal", "community benchmark scores proving this version is universally superior", or "prompt cache prefix hits equating to behavioral identity", but rather ensures execution stability through a well-defined tiered contract.
|
|
12
12
|
|
|
13
13
|
## How it works
|
|
14
14
|
|
|
15
|
-
1. `minimal-prompt` narrows every assembled prompt to the persona section — the one-line persona, the mode's standing working discipline (exit thinking loops immediately, design-first reasoning over pre-rehearsed code, YAGNI and PDCA, no code comments), and one appended orientation line, `Your working directory is <cwd>.` read from the session header — so the harness identity, web-surface, tool-guidance, file-reference, and structured-output sections
|
|
16
|
-
2. the AGENTS.md-style workspace instructions join the system prompt itself: at assembly time `minimal-prompt` reads the harness's baseline chain (`$DSH_HOME/AGENTS.md`, then `AGENTS.md` / `CLAUDE.md` and their `.local` overlays from the project root down to the session cwd) and appends the content as one `workspace-instructions` section after the stable prefix, under a byte budget that omits broadest files first and truncates the most specific last; the read happens on every assembly, so file edits propagate without durable messages, and the harness's own agent-instructions injections are dropped instead of duplicating the prompt;
|
|
17
|
-
3. the anchor turn
|
|
18
|
-
4. `tool-catalog` appends the tool list
|
|
15
|
+
1. `minimal-prompt` narrows every assembled prompt to the persona section — the one-line persona, the mode's standing working discipline (exit thinking loops immediately, design-first reasoning over pre-rehearsed code, YAGNI and PDCA, no redundant code comments), and one appended orientation line, `Your working directory is <cwd>.` read from the session header — so the harness identity, web-surface, tool-guidance, file-reference, and structured-output sections do not reach the model by default; plan mode's `plan:policy` is kept, because that section is the only thing that enforces plan mode (its exit tool stays registered in every mode);
|
|
16
|
+
2. the AGENTS.md-style workspace instructions join the system prompt itself: at assembly time `minimal-prompt` reads the harness's baseline chain (`$DSH_HOME/AGENTS.md`, then `AGENTS.md` / `CLAUDE.md` and their `.local` overlays from the project root down to the session cwd) and appends the content as one `workspace-instructions` section after the stable prefix, under a byte budget that omits broadest files first and truncates the most specific last; the read happens on every assembly, so file edits propagate without durable messages, and the harness's own agent-instructions injections are dropped instead of duplicating the prompt. Subdirectory dynamic rules will subsequently support registered file tools (including `str_replace_editor`) and sub-calls inside PTC reaching target directories; arbitrary bash/program code is not parsed, and automatic discovery of file accesses performed directly within shell commands is not guaranteed;
|
|
17
|
+
3. the anchor turn (the session's entire first user turn, rather than merely a single first step) keeps the wire on the foundational anchor tool set: default `[bash, str_replace_editor, exit_plan_mode, skill]`, presented natively (`anchorTools`); the `[bash]` single-shell experimental configuration is also preserved and supported (without requiring extra preset registration or registry changes). From the second turn, when a code runtime exists and presentation declaration succeeds, `tool-catalog` activates PTC presentation for that session (`agent.ctx.tools.presentAs('ptc')`, declared on anchor turn end), collapsing the wire to `run_code` where other tools are invoked via the generated SDK; if code runtime is absent or activation fails, it gracefully degrades to the native tool surface with a one-time warning;
|
|
18
|
+
4. `tool-catalog` appends the tool list as a durable user message after the user's message from the first turn on, preserving complete input and output key parameter semantics rather than an oversimplified 200-character-only contract (`descriptionMaxLength: 200` only caps single-line summaries, without stripping key parameter structures). It names exactly the tools the current request opens: the anchor set during the native anchor turn, and, under PTC, the SDK-reachable roster plus the program contract — one program per intent instead of one call per step, `run_code`'s `code`/`description` shape, independent read-only calls overlapping under `Promise.all`, `ToolCallError` handling, curated program output, and the rule that `run_code` is the only directly callable tool once on the wire. It republishes only when that surface changed or the published copy left the visible surface (a compaction, a resume), so the promotion boundary carries one contract update without insisting on absolute context immutability;
|
|
19
19
|
5. runtime contexts (the sandbox and approval snapshots) and the skill catalog flow as in Standard mode.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## Security model
|
|
22
|
+
|
|
23
|
+
This mode operates strictly within the official host security architecture and complies with sandbox policies:
|
|
24
|
+
|
|
25
|
+
- **Host sandbox constraints**: All file tools (whether `str_replace_editor` and Standard file tools natively presented in the first turn, or file operations invoked via PTC `run_code` later) are subject to host file sandbox policies, inheriting the current session's sandbox level (e.g., `danger-full-access` or workspace-restricted/read-only). Bare local filesystem access does not exist (no `dsh-fs-local` mount); all reads and writes across workspaces are guarded by host policy.
|
|
26
|
+
- **Windows platform limitations and Git Bash**: DSH's PTY backend is Linux/Darwin-only. On Windows (win32), the persistent-shell group is disabled, and `bash` is provided by `presets/liangshen/custom-bash.mjs` through system Git Bash subprocess invocation:
|
|
27
|
+
- Windows Git Bash runs through an ordinary subprocess seam; subject to Windows platform constraints, it lacks namespace/cgroups-based OS sandbox isolation;
|
|
28
|
+
- The shell process does not persist across invocations, so command state (environment variables, current directory, etc.) does not carry over;
|
|
29
|
+
- Non-zero exits are returned as results rather than thrown;
|
|
30
|
+
- Users and developers must not modify `custom-bash.mjs` to bypass security policies; privileged actions must follow host prompts and environment security guidelines.
|
|
31
|
+
- **PTC code sandbox**: In PTC mode, `run_code` scripts execute within an isolated worker thread context, with access to system resources strictly bounded by the SDK's exposed tools.
|
|
22
32
|
|
|
23
33
|
## The lever
|
|
24
34
|
|
|
@@ -40,9 +50,9 @@ Both preset-local plugins are configured in `agent.cordis.yml`:
|
|
|
40
50
|
| `keepPlanPolicy` | `true` | Keep plan mode's `plan:policy` section in the otherwise one-line system prompt. Set `false` for the strict one-line surface, which leaves plan mode with no policy text behind it. |
|
|
41
51
|
| `instructionSource` | `system-prompt` | Where workspace instructions reach the model. `system-prompt` reads the AGENTS.md-style chain at assembly time and appends it to the system prompt (the harness's own injections are dropped); `hint` restores the pointer behavior: the first injection becomes a one-time non-imperative reference-file hint and later injections are dropped. |
|
|
42
52
|
| `instructionMaxBytes` | `65536` | Byte budget for the rendered workspace-instructions section (system-prompt mode): broadest files are omitted first, the most specific file is truncated last. |
|
|
43
|
-
| `descriptionMaxLength` | `200` | Cap for one tool's one-line summary in the injected catalog.
|
|
44
|
-
| `anchorTools` | `[]` | Tool
|
|
45
|
-
| `ptcPresentation` | `true` |
|
|
53
|
+
| `descriptionMaxLength` | `200` | Cap for one tool's one-line summary in the injected catalog. Complete key parameter semantics and contracts remain fully preserved by the SDK itself. |
|
|
54
|
+
| `anchorTools` | `[bash, str_replace_editor, exit_plan_mode, skill]` | Tool set natively presented on the wire throughout the entire first user turn; promoted surface engages from the second turn. Shipped default includes the core four tools; can also be configured as `[bash]` for single-shell experiments (without modifying registry). Empty disables staging. |
|
|
55
|
+
| `ptcPresentation` | `true` | Attempt to declare PTC presentation from the second turn onward; upon successful activation, wire collapses to `run_code` preserving complete input/output key parameter semantics. Requires a mounted code runtime and a readable tool projection; without either it keeps native presentation with a single warning. The injected catalog always describes the transport the request's own wire carries, and never announces PTC for an assembly the declaration could not reach. Set `false` to keep assembled native roster from second turn. |
|
|
46
56
|
|
|
47
57
|
## Install
|
|
48
58
|
|
|
@@ -64,18 +74,22 @@ Fully restart `dsh web`, open a NEW empty session, and pick "梁神模式" as th
|
|
|
64
74
|
|
|
65
75
|
Export the session JSONL and inspect `request/header`:
|
|
66
76
|
|
|
67
|
-
- the first header's `system` should be exactly the persona block (the
|
|
68
|
-
- the first
|
|
69
|
-
- the
|
|
70
|
-
- from the second turn on, headers carry exactly one tool, `run_code` (PTC presentation);
|
|
71
|
-
- after a compaction the catalog is republished once as a replacement list and the session stays in
|
|
77
|
+
- the first header's `system` should be exactly the persona block (the minimal persona, the working-discipline list, and the workspace line `Your working directory is <cwd>.`), plus plan mode's policy while plan mode is on, plus the `workspace-instructions` section carrying the AGENTS.md chain;
|
|
78
|
+
- the entire first user turn's header tools should be exactly the anchor surface — default `[bash, str_replace_editor, exit_plan_mode, skill]`, presented natively — never the promoted roster and never an unactivated `run_code`;
|
|
79
|
+
- the anchor turn's admitted messages should hold one `plugin`-sourced message from `liangshen-tool-catalog` after the user message, naming exactly the anchor tools by argument signature; from the promoted turn on, that message names the SDK-reachable roster and states the `run_code` program contract, including that `run_code` is the only directly callable tool;
|
|
80
|
+
- from the second turn on, provided PTC successfully activates, headers carry exactly one tool, `run_code` (PTC presentation); without code runtime it gracefully degrades to native roster with a single warning;
|
|
81
|
+
- after a compaction the catalog is republished once as a replacement list and the session stays in its current presentation mode;
|
|
72
82
|
- file writes obey the host file sandbox policy — there is no bare local-filesystem bypass.
|
|
73
83
|
|
|
74
|
-
|
|
84
|
+
### Real session validation conditions and benchmark evaluation
|
|
75
85
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
When validating mode behavior and evaluating performance, verification tiers must be strictly distinguished:
|
|
87
|
+
|
|
88
|
+
1. **Real inference probe ≠ Mode integration pass ≠ Statistical improvement**:
|
|
89
|
+
- **Real inference probe**: Verifies only transport connectivity and minimal model response capability to specific formats (e.g. using a headless probe to verify output parsing); a single successful probe demonstrates absence of blockers, but never that mode integration has succeeded.
|
|
90
|
+
- **Mode integration pass**: Requires full session verification of complete headers, tiered tool transitions, actual PTC activation, SDK parameter semantics parsing, and sandbox policy enforcement.
|
|
91
|
+
- **Statistical improvement**: Must be evaluated across multiple comparative benchmark rounds in an isolated environment with recorded fixed routes and source hashes, evaluating task completion rate, tool failure rate, rule violation rate, human intervention frequency, and time/token costs. Single or few smoke runs do not constitute evidence of performance improvement.
|
|
92
|
+
2. **Benchmark tooling**: the isolated runner is `packages/dsh-liangshen/tools/benchmark-live-run.mjs`. It writes the evaluated preset into a temporary root selected through the roster's own `roots` config, redirects session persistence into the run directory, and records a baseline (repository commit, shipped preset hash, DSH version, fixed route, task revision) with every run. The candidate matrix is `B` (shipped persona and two-stage strategy), `P` (candidate persona), `T` (candidate persona, PTC from the first turn), `N` (candidate persona, full native roster throughout), and `M` (the bundle's official Minimal preset, an external reference rather than a single-factor arm). Run one smoke case with `node tools/benchmark-live-run.mjs --variant B`, or the bounded matrix over the seed corpus with `node tools/benchmark-live-run.mjs --tasks tools/tasks/liangshen-v41-flash.json --groups B,P,T,N,M --repeat 3 --max-sessions 60 --budget-usd 5`; aggregate the run records in a results directory with `node tools/benchmark-report.mjs .benchmark-results`, which reports per-group success rates with Wilson intervals, paired per-task deltas with confidence intervals, token and cost totals, infrastructure failures separately, and the recorded baseline. Smoke runs validate the protocol and the cost estimate; they are not evidence of a general coding gain.
|
|
79
93
|
|
|
80
94
|
## Configuration
|
|
81
95
|
|
|
@@ -89,15 +103,15 @@ Both fields are editable in the web settings surface (plugin config, live) or th
|
|
|
89
103
|
## Behavior and limits
|
|
90
104
|
|
|
91
105
|
- The system prompt is stable for the whole session: the persona block (persona, working discipline, workspace directory), plus plan mode's policy while plan mode is on, plus the workspace-instructions section. Nothing is appended after a tool call, and no output-token cap is applied;
|
|
92
|
-
- The workspace-instructions section is re-read at every assembly, so instruction-file edits propagate on the next request without a durable message; the section renders last, after the stable prefix, so the anchor's cache prefix stays intact.
|
|
93
|
-
- The wire's schema set
|
|
106
|
+
- The workspace-instructions section is re-read at every assembly, so instruction-file edits propagate on the next request without a durable message; the section renders last, after the stable prefix, so the anchor's cache prefix stays intact. Subdirectory dynamic rules will subsequently support registered file tools (including `str_replace_editor`) and sub-calls inside PTC reaching target directories; arbitrary bash/program code is not parsed, and automatic discovery of file accesses performed directly within shell commands is not guaranteed;
|
|
107
|
+
- The wire's schema set stays on the foundational anchor tool set during the entire first user turn (default `[bash, str_replace_editor, exit_plan_mode, skill]`, supporting `[bash]` experiments); from the second turn onward, upon successful PTC activation, it collapses to `run_code`; the catalog message is written once per session plus one replacement when the exposed surface changes — the promotion boundary included — or a compaction shadows it;
|
|
94
108
|
- The injected catalog is durable: it is written once per session, plus one replacement when the tool surface changes or a compaction shadows the published copy, and it stays in the history for later requests;
|
|
95
109
|
- A step whose prompt assembly was not observed injects nothing — the catalog is never guessed from a stale view;
|
|
96
110
|
- 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;
|
|
97
111
|
- 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;
|
|
98
|
-
- PTC presentation is declared per session and needs a mounted code runtime (the shipped web and headless compositions mount `dsh-code-runtime-worker-thread`); without one
|
|
112
|
+
- PTC presentation is declared per session and needs a mounted code runtime (the shipped web and headless compositions mount `dsh-code-runtime-worker-thread`); without one or upon activation failure, the mode stays native with a one-time warning;
|
|
99
113
|
- The roster is the builtin PTC preset's model-authored surface: the `workflow` tool is not published beside `run_code`, while the workflow engine stays mounted for `ralph`;
|
|
100
|
-
- The persistent `bash` replaces the Standard ephemeral shell for the whole session (both tools register the name `bash`), so shell state survives across calls; on win32 `custom-bash` provides the same-named tool through Git Bash, with no OS sandbox confinement;
|
|
114
|
+
- The persistent `bash` replaces the Standard ephemeral shell for the whole session (both tools register the name `bash`), so shell state survives across calls; on win32 `custom-bash` provides the same-named tool through Git Bash, with no OS sandbox confinement and non-persistent state;
|
|
101
115
|
- The file tools inherit the host file sandbox (no bare `dsh-fs-local` filesystem);
|
|
102
116
|
- The preset carries the same trust level as shell access — review `presets/liangshen/` before installing;
|
|
103
117
|
- The plugin makes no network requests and adds no telemetry;
|
package/README.zh.md
CHANGED
|
@@ -2,23 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
把梁神模式做成 DSH 全家桶里的一键安装插件:Host 启动时把内置 preset 同步到 `~/.dsh/.agent-presets`,新建会话即可在预设选择器中选择「梁神模式」,浏览器半区还在新建会话页的模型选择器旁提供一台老虎机拨杆来开关该模式。该 preset
|
|
5
|
+
把梁神模式做成 DSH 全家桶里的一键安装插件:Host 启动时把内置 preset 同步到 `~/.dsh/.agent-presets`,新建会话即可在预设选择器中选择「梁神模式」,浏览器半区还在新建会话页的模型选择器旁提供一台老虎机拨杆来开关该模式。该 preset 让系统提示词保持极简 persona——外加本模式的固定工作纪律、会话工作区目录与 AGENTS.md 类工作区指令——并从第一条用户消息起就把工具面作为持久 user 消息注入在用户消息之后——形状与 harness 注入 skill 目录一致,且只宣告该次请求实际开放的工具——而 wire 按回合分层:首轮整个 user turn 原生呈现基础锚定工具集(默认 `[bash, str_replace_editor, exit_plan_mode, skill]`,并保留 bash-only 配置实验),从第二个回合起在 PTC 成功激活后以 PTC 模式呈现工具,wire 上只有 `run_code` 这一条传输工具,其余工具都在程序里经生成的 SDK 调用。PTC 实际激活时发生确定性的回合边界跃迁,保留完整输入输出关键参数语义,没有推理内容门控、没有输出预算上限。全部通过官方 NPM SDK 实现,不修改 DSH 源码。
|
|
6
6
|
|
|
7
7
|
## 原理
|
|
8
8
|
|
|
9
|
-
DeepSeek V4
|
|
9
|
+
DeepSeek V4 模型在选择执行轨迹时,会受到初始提示词与首轮可见工具面的显著影响。过多过早暴露未受约束的工具可能分散执行轨迹,而完全缺乏编辑或规划手段又限制了复杂任务的完成。
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
梁神模式采用分层工具与紧凑提示词架构:负责锚定的部分(系统提示词)保持极简 persona 与明确的工作纪律,并注入工作区指令;负责能力的部分(工具面)从第一条用户消息起以 skill-catalog 式的上下文注入宣告,并在首轮整个 user turn 原生呈现基础锚定工具集(`[bash, str_replace_editor, exit_plan_mode, skill]`),提供探索、编辑、退出规划与技能查询的基础能力;从第二个回合起在满足 code runtime 条件并成功声明后,平滑过渡至 PTC(程序即代码)模式。在 PTC 呈现下,注入消息承载生成 SDK 的绑定清单、完整输入输出关键参数语义、「一段程序编排多步调用」的程序契约、以及「只有 `run_code` 可直接调用」的规则。本模式不做出「与官方 Minimal 完全一致」、「社区评测分数证明本版必定更优」或「提示词缓存命中等同于行为一致」的过度承诺,而是以清晰的分层契约保障执行稳定性。
|
|
12
12
|
|
|
13
13
|
## 工作机制
|
|
14
14
|
|
|
15
|
-
1. `minimal-prompt` 把每次组装出的提示词收窄到 persona 一段——一行 persona
|
|
16
|
-
2. AGENTS.md 类工作区指令直接进入系统提示词本身:组装时 `minimal-prompt` 读取 harness 的基线链(`$DSH_HOME/AGENTS.md`,再从项目根到会话 cwd 沿途的 `AGENTS.md` / `CLAUDE.md` 及其 `.local` 覆盖层),把内容作为一段 `workspace-instructions` 追加在稳定前缀之后,受字节预算约束——放不下时先省略最宽的文件、最后才截断最具体的文件;读取在每次组装时都发生,文件改动无需持久消息即可在下次请求生效,harness 自己的 agent-instructions
|
|
17
|
-
3.
|
|
18
|
-
4. `tool-catalog`
|
|
15
|
+
1. `minimal-prompt` 把每次组装出的提示词收窄到 persona 一段——一行 persona、本模式的固定工作纪律(思维循环即断、先理解需求与方案再实现验证、YAGNI/PDCA、代码不加冗余注释)、以及一行从会话头读取的方位信息 `Your working directory is <cwd>.`——因此 harness identity、web surface、工具用法、文件引用与结构化输出等 section 默认不会到达模型;plan mode 的 `plan:policy` 保留,因为该 section 是 plan mode 唯一的执行依据(它的退出工具在任何模式下都保持注册);
|
|
16
|
+
2. AGENTS.md 类工作区指令直接进入系统提示词本身:组装时 `minimal-prompt` 读取 harness 的基线链(`$DSH_HOME/AGENTS.md`,再从项目根到会话 cwd 沿途的 `AGENTS.md` / `CLAUDE.md` 及其 `.local` 覆盖层),把内容作为一段 `workspace-instructions` 追加在稳定前缀之后,受字节预算约束——放不下时先省略最宽的文件、最后才截断最具体的文件;读取在每次组装时都发生,文件改动无需持久消息即可在下次请求生效,harness 自己的 agent-instructions 注入则被丢弃以免与提示词重复。工作区子目录动态规则后续将支持注册文件工具(含 `str_replace_editor`)及 PTC 内子调用触达的目录;不解析任意 bash/program 代码,不保证 shell 自行文件访问的自动发现;
|
|
17
|
+
3. 锚定回合(会话的首轮整个 user turn,而非仅第一步单次请求)把 wire 保持在基础锚定工具集上:默认 `[bash, str_replace_editor, exit_plan_mode, skill]`,原生呈现(`anchorTools`);同时保留 `[bash]` 的单 shell 实验配置(无需额外注册预设,无需更改注册表)。从第二个回合起,在 code runtime 存在且声明成功时,`tool-catalog` 为该会话激活 PTC 呈现(`agent.ctx.tools.presentAs('ptc')`,在锚定回合结束时声明),wire 收拢为 `run_code` 这一条传输工具,其余工具都在程序里经生成的 SDK 调用;若缺少 code runtime 或激活失败,则优雅回退至原生工具面并发出一次性告警;
|
|
18
|
+
4. `tool-catalog` 把工具清单从第一条用户消息起作为持久 user 消息追加在用户消息之后,保留完整输入输出关键参数语义而非 200 字唯一契约(`descriptionMaxLength: 200` 仅作为一行摘要长度上限,不裁剪关键参数结构)。目录只宣告该次请求实际开放的工具:原生锚定回合是锚定工具集,PTC 下则是经 SDK 可达的完整工具面,并附带程序契约:一段程序完成一个意图而不是一步一次调用、`run_code` 的 `code`/`description` 形状、独立只读调用用 `Promise.all` 并发、`ToolCallError` 的处理、程序输出需要自己挑选,以及 `run_code` 一旦在 wire 上就是唯一可直接调用的工具。只在工具面变化、或已发布副本离开可见面(压缩、恢复)时重发,因此晋升边界会进行一次契约更新,不再坚持上下文绝对不变;
|
|
19
19
|
5. 运行时上下文(sandbox 与 approval 快照)与 skill 目录按 Standard 模式正常注入。
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## 安全模型
|
|
22
|
+
|
|
23
|
+
本模式坚持在官方宿主安全架构内运行,严格遵守沙箱策略:
|
|
24
|
+
|
|
25
|
+
- **宿主沙箱约束**:所有文件工具(无论是首轮原生呈现的 `str_replace_editor`、Standard 文件工具,还是后续在 PTC `run_code` 中调用的文件操作)均受宿主文件沙箱策略约束,继承当前会话的沙箱级别(如 `danger-full-access` 或只读/工作区受限)。不存在裸本地文件系统访问(不挂载 `dsh-fs-local`),所有跨越工作区的读写均受宿主策略拦截。
|
|
26
|
+
- **Windows 平台现有限制与 Git Bash**:DSH 的 PTY 后端仅支持 Linux/Darwin。在 Windows (win32) 下,持久 shell 组被禁用,`bash` 由 `presets/liangshen/custom-bash.mjs` 调用系统 Git Bash 子进程提供:
|
|
27
|
+
- Windows Git Bash 运行于普通子进程通道,受 Windows 平台限制,不具备 Linux 下基于 namespace/cgroups 的 OS 沙箱隔离;
|
|
28
|
+
- shell 进程不跨调用常驻,命令状态(环境变量、当前目录等)不跨调用保留;
|
|
29
|
+
- 非零退出码以结果返回而非抛错;
|
|
30
|
+
- 用户与开发者切勿修改 `custom-bash.mjs` 去尝试规避安全策略;高权限操作需遵从宿主提示和环境安全规范。
|
|
31
|
+
- **PTC 代码沙箱**:PTC 模式下执行的 `run_code` 代码运行于独立的 worker thread 隔离上下文,其对系统资源的访问完全受限于 SDK 暴露的 tools 边界。
|
|
22
32
|
|
|
23
33
|
## 拨杆
|
|
24
34
|
|
|
@@ -40,9 +50,9 @@ Windows 说明:DSH 的 PTY 后端仅支持 linux/darwin,win32 上持久 shel
|
|
|
40
50
|
| `keepPlanPolicy` | `true` | 在只有一行 persona 的系统提示词中保留 plan mode 的 `plan:policy` 段。置 `false` 得到严格的一行表面,此时 plan mode 背后没有任何策略文本。 |
|
|
41
51
|
| `instructionSource` | `system-prompt` | 工作区指令送达模型的方式。`system-prompt` 在组装时读取 AGENTS.md 链并追加进系统提示词(harness 自己的注入被丢弃);`hint` 恢复指针行为:首次注入替换为一次性的、非命令式的参考文件提示,后续注入丢弃。 |
|
|
42
52
|
| `instructionMaxBytes` | `65536` | 渲染后的 workspace-instructions 段的字节预算(system-prompt 模式):最宽的文件先被省略,最具体的文件最后被截断。 |
|
|
43
|
-
| `descriptionMaxLength` | `200` |
|
|
44
|
-
| `anchorTools` | `[]` |
|
|
45
|
-
| `ptcPresentation` | `true` |
|
|
53
|
+
| `descriptionMaxLength` | `200` | 注入目录中单个工具一行摘要的长度上限。完整关键参数语义与契约仍由 SDK 自身完整保留。 |
|
|
54
|
+
| `anchorTools` | `[bash, str_replace_editor, exit_plan_mode, skill]` | 首轮整个 user turn wire 上原生呈现的工具集;晋升面从第二个回合起生效。出厂默认包含基础四工具,亦可按需配置为 `[bash]` 进行单 shell 实验(无需额外注册预设,无需修改注册表)。留空则关闭分层。 |
|
|
55
|
+
| `ptcPresentation` | `true` | 从第二个回合起尝试为该会话声明 PTC 呈现,成功激活后 wire 收拢为 `run_code`,保留完整输入输出关键参数语义。需要挂载 code runtime 与可读取的工具投影;缺失任一项时保持原生呈现并只告警一次。注入目录始终描述该次请求 wire 实际携带的传输方式,声明无法在本回合生效时不会宣告 PTC。置 `false` 则从第二个回合起 wire 上仍是组装出的原生清单。 |
|
|
46
56
|
|
|
47
57
|
## 安装
|
|
48
58
|
|
|
@@ -64,18 +74,22 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
64
74
|
|
|
65
75
|
导出 session JSONL,检查 `request/header`:
|
|
66
76
|
|
|
67
|
-
- 第一份 header 的 `system` 应恰好是 persona
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
77
|
+
- 第一份 header 的 `system` 应恰好是 persona 块(极简 persona、工作纪律清单、工作区目录行 `Your working directory is <cwd>.`),plan mode 开启时另加其策略段,再另加承载 AGENTS.md 链的 `workspace-instructions` 段;
|
|
78
|
+
- 首轮整个 user turn 的 header tools 应恰好是锚定面——默认 `[bash, str_replace_editor, exit_plan_mode, skill]`,原生呈现——既不是全量晋升清单,也不会是未激活的 `run_code`;
|
|
79
|
+
- 锚定回合放行的消息里应有一条来自 `liangshen-tool-catalog` 的 `plugin` 消息,位于用户消息之后,按参数签名恰好列出锚定工具;从晋升回合起,该消息改为列出经 SDK 可达的完整工具面并写明 `run_code` 程序契约,其中 `run_code` 是唯一可直接调用的工具;
|
|
80
|
+
- 从第二个回合起,在 PTC 成功激活的前提下,header 上恰好只有一条工具 `run_code`(PTC 呈现);若无 code runtime 则优雅回退到原生清单并伴随一次性告警;
|
|
81
|
+
- 压缩之后目录会重发一次,形式为替换清单,且会话保持当前呈现模式;
|
|
72
82
|
- 文件写入受宿主文件沙箱策略约束,不存在裸本地文件系统绕过。
|
|
73
83
|
|
|
74
|
-
|
|
84
|
+
### 真实会话验证条件与评测说明
|
|
75
85
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
在进行模式验证与性能评估时,必须严格区分验证层级:
|
|
87
|
+
|
|
88
|
+
1. **真实推理探针 ≠ 模式集成通过 ≠ 统计提升**:
|
|
89
|
+
- **真实推理探针**:仅验证链路连通性与模型对特定格式的最小响应能力(例如使用 headless 探针验证模型是否能正常解析输出);单次探针成功仅代表功能未阻断,绝不证明模式集成已达标。
|
|
90
|
+
- **模式集成通过**:要求在真实完整会话中,验证完整 header、工具分层流转、PTC 真实激活、SDK 参数语义解析与沙箱策略执行无误。
|
|
91
|
+
- **统计显著性提升**:必须在固定 route 与源码 hash 记录的隔离环境中进行多轮对比评测,综合评估任务完成率、工具失败率、规则违反率、人工介入次数与耗时/token 开销。单次或少数 smoke 运行不构成效果提升的证据。
|
|
92
|
+
2. **评测工具**:隔离 runner 位于 `packages/dsh-liangshen/tools/benchmark-live-run.mjs`:它把被评测 preset 写入临时目录并通过 roster 自己的 `roots` 配置选中,把会话持久化改写到本次运行目录,并为每次运行记录基线(仓库提交、出厂 preset hash、DSH 版本、固定 route、任务版本)。候选矩阵为 `B`(出厂 persona 与两阶段策略)、`P`(候选 persona)、`T`(候选 persona,首轮即用 PTC)、`N`(候选 persona,全程原生工具)与 `M`(内置包官方 Minimal preset,仅作外部参照而非单因素对照)。单次 smoke 用 `node tools/benchmark-live-run.mjs --variant B`,按种子任务集跑有界矩阵用 `node tools/benchmark-live-run.mjs --tasks tools/tasks/liangshen-v41-flash.json --groups B,P,T,N,M --repeat 3 --max-sessions 60 --budget-usd 5`,再用 `node tools/benchmark-report.mjs .benchmark-results` 汇总结果目录:按组给出成功率与 Wilson 区间、按任务配对差值与置信区间、token 与费用合计、单独列出的基础设施失败以及记录的基线。smoke 只验证协议与费用估算,不构成通用编码能力提升的证据。
|
|
79
93
|
|
|
80
94
|
## 配置
|
|
81
95
|
|
|
@@ -89,15 +103,15 @@ node tools/analyze-session.mjs ~/.dsh/sessions/<workspace>/<session>/session.jso
|
|
|
89
103
|
## 行为与限制
|
|
90
104
|
|
|
91
105
|
- 系统提示词在整个会话中保持稳定:persona 块(persona、工作纪律、工作区目录),plan mode 开启时另加其策略段,另加 workspace-instructions 段。工具调用后不会再追加内容,也不施加任何输出预算上限;
|
|
92
|
-
- workspace-instructions
|
|
93
|
-
- wire 的 schema
|
|
106
|
+
- workspace-instructions 段在每次组装时重新读取,指令文件的改动无需持久消息即可在下一次请求生效;该段渲染在稳定前缀之后的最后位置,锚定的缓存前缀不受影响。工作区子目录动态规则后续将扩展支持注册文件工具(含 `str_replace_editor`)及 PTC 内子调用触达的目录;不解析任意 bash/program 代码,不保证 shell 自行文件访问的自动发现;
|
|
107
|
+
- wire 的 schema 集在首轮整个 user turn 保持在基础锚定工具集(默认 `[bash, str_replace_editor, exit_plan_mode, skill]`,且支持 `[bash]` 实验);在第二个回合起且仅在 PTC 成功激活时收拢为 `run_code`;目录消息每会话写一次,另在工具面变化(含晋升边界)或压缩遮蔽时替换一次;
|
|
94
108
|
- 注入的目录是持久消息:每个会话写入一次,另在工具面变化或压缩遮蔽已发布副本时替换一次,并留在历史中供后续请求使用;
|
|
95
109
|
- 未观测到 prompt 组装的步不注入任何内容——目录绝不会由过期视图推测;
|
|
96
110
|
- 若组合中不存在任何被接受的 persona section 名(`deployment:persona-prefix`、`deployment:persona`、`persona`),过滤器会保留组装结果并只告警一次,而不是发出空系统提示词;
|
|
97
111
|
- plan mode 通过其 `plan:policy` 段支持;置 `keepPlanPolicy: false` 后该模式仍有工具,但失去约束它的策略文本;
|
|
98
|
-
- PTC 呈现按会话声明,需要挂载的 code runtime(随包发布的 web 与 headless 组合都挂载 `dsh-code-runtime-worker-thread`);没有 runtime
|
|
112
|
+
- PTC 呈现按会话声明,需要挂载的 code runtime(随包发布的 web 与 headless 组合都挂载 `dsh-code-runtime-worker-thread`);没有 runtime 或激活失败时该模式保持原生呈现并只告警一次;
|
|
99
113
|
- 清单就是官方 PTC preset 的模型自著面:不在 `run_code` 之外再发布 `workflow` 工具,而 workflow 引擎仍为 `ralph` 保留挂载;
|
|
100
|
-
- 持久 `bash` 会替代 Standard 的一次性 shell 直到会话结束(两个工具都注册 `bash` 名字),因此 shell 状态跨调用保留;win32 上由 `custom-bash` 经 Git Bash 提供同名工具,无 OS
|
|
114
|
+
- 持久 `bash` 会替代 Standard 的一次性 shell 直到会话结束(两个工具都注册 `bash` 名字),因此 shell 状态跨调用保留;win32 上由 `custom-bash` 经 Git Bash 提供同名工具,无 OS 沙箱约束且状态不跨调用保留;
|
|
101
115
|
- 文件工具继承宿主文件沙箱(不挂载裸 `dsh-fs-local`);
|
|
102
116
|
- preset 与 shell 访问具有相同信任等级,安装前可自行审阅 `presets/liangshen/`;
|
|
103
117
|
- 插件不发起网络请求,也不增加遥测;
|
package/lib/index.js
CHANGED
|
@@ -387,15 +387,16 @@ function mountOnce(packageName, fn) {
|
|
|
387
387
|
* surface (plugin config) or the profile patch. No browser half, no routes,
|
|
388
388
|
* no agent tools — the preset itself provides the tools.
|
|
389
389
|
*
|
|
390
|
-
* The preset
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
390
|
+
* The preset combines a minimal persona with a staged, promoted tool surface:
|
|
391
|
+
* the system prompt keeps a minimal persona with standing working discipline
|
|
392
|
+
* and workspace instructions, the session's entire first user turn runs a native
|
|
393
|
+
* foundational tool surface ([bash, str_replace_editor, exit_plan_mode, skill],
|
|
394
|
+
* with bash-only preserved as a configuration experiment), and from the second
|
|
395
|
+
* turn this session presents its tools in PTC mode upon successful activation,
|
|
396
|
+
* so the wire carries the single `run_code` transport while the generated SDK
|
|
397
|
+
* bindings and collapse rule travel in the tool list injected as a durable
|
|
398
|
+
* message after the user's message, preserving full input and output key
|
|
399
|
+
* parameter semantics.
|
|
399
400
|
*/
|
|
400
401
|
/** Stable cordis plugin name. */
|
|
401
402
|
const name = "liangshen";
|
|
@@ -412,7 +413,7 @@ const DEFAULT_ANNOUNCE = false;
|
|
|
412
413
|
/** Order of the announcement section within the tool-guidance band. */
|
|
413
414
|
const SECTION_ORDER = 150;
|
|
414
415
|
/** Model-facing announcement: plugin presence, principle, and limits. */
|
|
415
|
-
const LIANGSHEN_GUIDANCE = "本机已安装 dsh-liangshen 插件(梁神模式 agent preset
|
|
416
|
+
const LIANGSHEN_GUIDANCE = "本机已安装 dsh-liangshen 插件(梁神模式 agent preset):新建会话的预设选择器中可选「梁神模式」。原理:系统提示词保持极简 persona(minimal-prompt 放行该段与 plan 模式的 plan:policy),persona 内置本模式工作纪律(思维循环即断、先理解需求与方案再实现验证、YAGNI/PDCA、代码不加冗余注释),并在组装时追加工作区目录 Your working directory is <cwd>. 与 AGENTS.md 工作区指令(workspace-instructions 段,65536 字节预算,每次组装重读);工具清单由 tool-catalog 从第一条用户消息起以 user 消息注入在用户消息之后,形如 skill catalog,仅当工具集变化或该消息离开可见面(压缩、恢复)时重发;wire 上的 schema 按回合分层:首轮整个 user turn 原生呈现基础锚定工具集(默认 [bash, str_replace_editor, exit_plan_mode, skill],且保留 bash-only 配置实验),第二个回合起在 PTC 成功激活后切换为 PTC 呈现(wire 上只有 run_code,其余工具在程序里以 await tools.<name>({...}) 调用,保留完整输入输出关键参数语义而非 200 字唯一契约;缺失 code runtime 时优雅回退至原生呈现);注入消息承载 SDK 绑定、程序契约(一段程序编排多步:独立只读调用用 Promise.all 并发、ToolCallError 处理、输出自选)与「激活后只有 run_code 可直接调用」的规则。工作区子目录动态指令支持注册文件工具含 str_replace_editor 及 PTC 内子调用触达的目录(不解析任意 bash/program 代码)。文件操作受宿主沙箱约束,Windows 下 bash 为 Git Bash 子进程且状态不跨调用保留。真实推理探针通过不等于模式集成通过,更不等于统计效果提升。preset 文件由插件维护于 ~/.dsh/.agent-presets,升级插件时自动更新;默认预设由用户自行选择。用户提到「梁神模式 / 锚定模式 / anchored standard」时即指本插件,请据此协作。";
|
|
416
417
|
/** Absolute path of the bundled preset tree inside this package. */
|
|
417
418
|
function bundledPresetsRoot() {
|
|
418
419
|
return fileURLToPath(new URL("../presets/", import.meta.url));
|
package/lib/types/index.d.ts
CHANGED
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
* surface (plugin config) or the profile patch. No browser half, no routes,
|
|
10
10
|
* no agent tools — the preset itself provides the tools.
|
|
11
11
|
*
|
|
12
|
-
* The preset
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
12
|
+
* The preset combines a minimal persona with a staged, promoted tool surface:
|
|
13
|
+
* the system prompt keeps a minimal persona with standing working discipline
|
|
14
|
+
* and workspace instructions, the session's entire first user turn runs a native
|
|
15
|
+
* foundational tool surface ([bash, str_replace_editor, exit_plan_mode, skill],
|
|
16
|
+
* with bash-only preserved as a configuration experiment), and from the second
|
|
17
|
+
* turn this session presents its tools in PTC mode upon successful activation,
|
|
18
|
+
* so the wire carries the single `run_code` transport while the generated SDK
|
|
19
|
+
* bindings and collapse rule travel in the tool list injected as a durable
|
|
20
|
+
* message after the user's message, preserving full input and output key
|
|
21
|
+
* parameter semantics.
|
|
21
22
|
*/
|
|
22
23
|
import type { Context } from '@deepseek-ai/cordis';
|
|
23
24
|
import type { SettingsNamespace } from '@deepseek-ai/dsh-settings';
|
|
@@ -37,7 +38,7 @@ export interface Config {
|
|
|
37
38
|
}
|
|
38
39
|
export declare const Config: z<Config>;
|
|
39
40
|
/** Model-facing announcement: plugin presence, principle, and limits. */
|
|
40
|
-
export declare const LIANGSHEN_GUIDANCE = "\u672C\u673A\u5DF2\u5B89\u88C5 dsh-liangshen \u63D2\u4EF6\uFF08\u6881\u795E\u6A21\u5F0F agent preset\uFF09\uFF1A\u65B0\u5EFA\u4F1A\u8BDD\u7684\u9884\u8BBE\u9009\u62E9\u5668\u4E2D\u53EF\u9009\u300C\u6881\u795E\u6A21\u5F0F\u300D\u3002\u539F\u7406\uFF1A\u7CFB\u7EDF\u63D0\u793A\u8BCD\
|
|
41
|
+
export declare const LIANGSHEN_GUIDANCE = "\u672C\u673A\u5DF2\u5B89\u88C5 dsh-liangshen \u63D2\u4EF6\uFF08\u6881\u795E\u6A21\u5F0F agent preset\uFF09\uFF1A\u65B0\u5EFA\u4F1A\u8BDD\u7684\u9884\u8BBE\u9009\u62E9\u5668\u4E2D\u53EF\u9009\u300C\u6881\u795E\u6A21\u5F0F\u300D\u3002\u539F\u7406\uFF1A\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4FDD\u6301\u6781\u7B80 persona\uFF08minimal-prompt \u653E\u884C\u8BE5\u6BB5\u4E0E plan \u6A21\u5F0F\u7684 plan:policy\uFF09\uFF0Cpersona \u5185\u7F6E\u672C\u6A21\u5F0F\u5DE5\u4F5C\u7EAA\u5F8B\uFF08\u601D\u7EF4\u5FAA\u73AF\u5373\u65AD\u3001\u5148\u7406\u89E3\u9700\u6C42\u4E0E\u65B9\u6848\u518D\u5B9E\u73B0\u9A8C\u8BC1\u3001YAGNI/PDCA\u3001\u4EE3\u7801\u4E0D\u52A0\u5197\u4F59\u6CE8\u91CA\uFF09\uFF0C\u5E76\u5728\u7EC4\u88C5\u65F6\u8FFD\u52A0\u5DE5\u4F5C\u533A\u76EE\u5F55 Your working directory is <cwd>. \u4E0E AGENTS.md \u5DE5\u4F5C\u533A\u6307\u4EE4\uFF08workspace-instructions \u6BB5\uFF0C65536 \u5B57\u8282\u9884\u7B97\uFF0C\u6BCF\u6B21\u7EC4\u88C5\u91CD\u8BFB\uFF09\uFF1B\u5DE5\u5177\u6E05\u5355\u7531 tool-catalog \u4ECE\u7B2C\u4E00\u6761\u7528\u6237\u6D88\u606F\u8D77\u4EE5 user \u6D88\u606F\u6CE8\u5165\u5728\u7528\u6237\u6D88\u606F\u4E4B\u540E\uFF0C\u5F62\u5982 skill catalog\uFF0C\u4EC5\u5F53\u5DE5\u5177\u96C6\u53D8\u5316\u6216\u8BE5\u6D88\u606F\u79BB\u5F00\u53EF\u89C1\u9762\uFF08\u538B\u7F29\u3001\u6062\u590D\uFF09\u65F6\u91CD\u53D1\uFF1Bwire \u4E0A\u7684 schema \u6309\u56DE\u5408\u5206\u5C42\uFF1A\u9996\u8F6E\u6574\u4E2A user turn \u539F\u751F\u5448\u73B0\u57FA\u7840\u951A\u5B9A\u5DE5\u5177\u96C6\uFF08\u9ED8\u8BA4 [bash, str_replace_editor, exit_plan_mode, skill]\uFF0C\u4E14\u4FDD\u7559 bash-only \u914D\u7F6E\u5B9E\u9A8C\uFF09\uFF0C\u7B2C\u4E8C\u4E2A\u56DE\u5408\u8D77\u5728 PTC \u6210\u529F\u6FC0\u6D3B\u540E\u5207\u6362\u4E3A PTC \u5448\u73B0\uFF08wire \u4E0A\u53EA\u6709 run_code\uFF0C\u5176\u4F59\u5DE5\u5177\u5728\u7A0B\u5E8F\u91CC\u4EE5 await tools.<name>({...}) \u8C03\u7528\uFF0C\u4FDD\u7559\u5B8C\u6574\u8F93\u5165\u8F93\u51FA\u5173\u952E\u53C2\u6570\u8BED\u4E49\u800C\u975E 200 \u5B57\u552F\u4E00\u5951\u7EA6\uFF1B\u7F3A\u5931 code runtime \u65F6\u4F18\u96C5\u56DE\u9000\u81F3\u539F\u751F\u5448\u73B0\uFF09\uFF1B\u6CE8\u5165\u6D88\u606F\u627F\u8F7D SDK \u7ED1\u5B9A\u3001\u7A0B\u5E8F\u5951\u7EA6\uFF08\u4E00\u6BB5\u7A0B\u5E8F\u7F16\u6392\u591A\u6B65\uFF1A\u72EC\u7ACB\u53EA\u8BFB\u8C03\u7528\u7528 Promise.all \u5E76\u53D1\u3001ToolCallError \u5904\u7406\u3001\u8F93\u51FA\u81EA\u9009\uFF09\u4E0E\u300C\u6FC0\u6D3B\u540E\u53EA\u6709 run_code \u53EF\u76F4\u63A5\u8C03\u7528\u300D\u7684\u89C4\u5219\u3002\u5DE5\u4F5C\u533A\u5B50\u76EE\u5F55\u52A8\u6001\u6307\u4EE4\u652F\u6301\u6CE8\u518C\u6587\u4EF6\u5DE5\u5177\u542B str_replace_editor \u53CA PTC \u5185\u5B50\u8C03\u7528\u89E6\u8FBE\u7684\u76EE\u5F55\uFF08\u4E0D\u89E3\u6790\u4EFB\u610F bash/program \u4EE3\u7801\uFF09\u3002\u6587\u4EF6\u64CD\u4F5C\u53D7\u5BBF\u4E3B\u6C99\u7BB1\u7EA6\u675F\uFF0CWindows \u4E0B bash \u4E3A Git Bash \u5B50\u8FDB\u7A0B\u4E14\u72B6\u6001\u4E0D\u8DE8\u8C03\u7528\u4FDD\u7559\u3002\u771F\u5B9E\u63A8\u7406\u63A2\u9488\u901A\u8FC7\u4E0D\u7B49\u4E8E\u6A21\u5F0F\u96C6\u6210\u901A\u8FC7\uFF0C\u66F4\u4E0D\u7B49\u4E8E\u7EDF\u8BA1\u6548\u679C\u63D0\u5347\u3002preset \u6587\u4EF6\u7531\u63D2\u4EF6\u7EF4\u62A4\u4E8E ~/.dsh/.agent-presets\uFF0C\u5347\u7EA7\u63D2\u4EF6\u65F6\u81EA\u52A8\u66F4\u65B0\uFF1B\u9ED8\u8BA4\u9884\u8BBE\u7531\u7528\u6237\u81EA\u884C\u9009\u62E9\u3002\u7528\u6237\u63D0\u5230\u300C\u6881\u795E\u6A21\u5F0F / \u951A\u5B9A\u6A21\u5F0F / anchored standard\u300D\u65F6\u5373\u6307\u672C\u63D2\u4EF6\uFF0C\u8BF7\u636E\u6B64\u534F\u4F5C\u3002";
|
|
41
42
|
export { dshHome } from './dsh-home.ts';
|
|
42
43
|
/** Absolute path of the bundled preset tree inside this package. */
|
|
43
44
|
export declare function bundledPresetsRoot(): string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-liangshen",
|
|
3
|
-
"description": "LiangShen (梁神) agent preset plus its composer lever for the dsh web GUI. The preset keeps
|
|
4
|
-
"version": "0.3.
|
|
3
|
+
"description": "LiangShen (梁神) agent preset plus its composer lever for the dsh web GUI. The preset keeps a minimal persona with standing working discipline and workspace instructions in the system prompt, anchors the entire first user turn on a native foundational tool surface ([bash, str_replace_editor, exit_plan_mode, skill], with bash-only supported as a configuration experiment), and from the second turn presents tools in PTC mode upon successful activation: the wire carries the single `run_code` transport and other tools are reached via the generated SDK preserving full input/output key parameter semantics. The tool catalog, SDK bindings, program contract (one program per intent, overlapping independent reads under `Promise.all`, `ToolCallError` handling, curated output), and collapse rule are injected as a durable user message after the user's message the way the skill catalog is. The browser half adds a slot-machine lever left of the model selector on the new-session screen to toggle the mode. Preset files sync to ~/.dsh/.agent-presets on startup. Hot-pluggable via cordis.patch.yml + profile symlink, no dsh source changes.",
|
|
4
|
+
"version": "0.3.23",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^22.19.0 || >=24.0.0"
|
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
# one-line persona — extended with the mode's standing working discipline and
|
|
3
3
|
# the session's workspace directory — as the WHOLE system prompt, with the
|
|
4
4
|
# session's tool surface staged behind the anchor turn and PTC presentation
|
|
5
|
-
# taking over after it. The session's first
|
|
6
|
-
# surface
|
|
7
|
-
#
|
|
8
|
-
# presents its tools in PTC mode
|
|
5
|
+
# taking over after it. The session's entire first user turn runs the anchored native
|
|
6
|
+
# surface — the short persona block plus the default `anchorTools`
|
|
7
|
+
# schemas (`[bash, str_replace_editor, exit_plan_mode, skill]`), natively presented —
|
|
8
|
+
# and from the second turn this session presents its tools in PTC mode (when
|
|
9
|
+
# successfully activated): the wire carries the single `run_code`
|
|
9
10
|
# transport, and every other tool is reached from inside the program through
|
|
10
11
|
# the generated SDK. The capability facts the Standard system prompt would
|
|
11
12
|
# carry as tool-guidance prose — and, under PTC, the SDK bindings and the
|
|
12
13
|
# collapse rule that `minimal-prompt` filters out of the prompt along with
|
|
13
14
|
# every other section — arrive instead as a durable `tool-catalog` message
|
|
14
15
|
# appended after the user's own message from the FIRST turn on, the way the
|
|
15
|
-
# skill catalog is injected; it names the
|
|
16
|
-
# signature plus a one-line summary)
|
|
17
|
-
#
|
|
18
|
-
#
|
|
16
|
+
# skill catalog is injected; it names exactly the tools the current request
|
|
17
|
+
# opens (each tool's argument signature plus a one-line summary) — the anchor
|
|
18
|
+
# set natively during the anchor turn, the SDK-reachable roster under PTC —
|
|
19
|
+
# so the declared surface and the request's own wire never disagree. The one
|
|
20
|
+
# wire transition is the deterministic turn boundary: no reasoning-block
|
|
21
|
+
# gating, no output budget cap.
|
|
19
22
|
#
|
|
20
23
|
# The persistent shell replaces the Standard ephemeral shell for the whole
|
|
21
24
|
# session (both register the name `bash`), and the editor inherits the host
|
|
@@ -85,27 +88,31 @@
|
|
|
85
88
|
# user's own message from the first turn on, the way `dsh-tool-skill` injects
|
|
86
89
|
# the skill catalog. It republishes only when that catalog's content changes or
|
|
87
90
|
# the published copy left the visible surface (compaction, resume), so the
|
|
88
|
-
# catalog is not appended once per step.
|
|
89
|
-
#
|
|
91
|
+
# catalog is not appended once per step. The content follows the presentation
|
|
92
|
+
# the next request will carry: the anchor wire before the boundary, the SDK
|
|
93
|
+
# roster after it. `descriptionMaxLength` caps each one-line summary; the full
|
|
94
|
+
# description stays in the tool schema.
|
|
90
95
|
#
|
|
91
|
-
# `anchorTools` stages the tool SCHEMAS behind the anchor turn:
|
|
92
|
-
# session
|
|
93
|
-
# the session keeps native presentation,
|
|
94
|
-
#
|
|
95
|
-
#
|
|
96
|
-
#
|
|
97
|
-
#
|
|
98
|
-
# Set it to an empty list to disable the narrowing entirely.
|
|
96
|
+
# `anchorTools` stages the tool SCHEMAS behind the anchor turn: during the
|
|
97
|
+
# session's entire first user turn the assembled wire narrows to these schemas
|
|
98
|
+
# and the session keeps native presentation, and the catalog narrows with the
|
|
99
|
+
# wire, so the model is never told about a tool this request does not expose.
|
|
100
|
+
# The shipped default anchor tools are `[bash, str_replace_editor, exit_plan_mode, skill]`.
|
|
101
|
+
# The bash-only configuration experiment (`anchorTools: [bash]`) is preserved
|
|
102
|
+
# and supported via config without requiring extra preset registration or
|
|
103
|
+
# registry changes. Set it to an empty list to disable the narrowing entirely.
|
|
99
104
|
#
|
|
100
105
|
# `ptcPresentation` declares this session's tools in PTC mode from the second
|
|
101
|
-
# turn on: the wire collapses to the reserved
|
|
102
|
-
# other tool is reached inside the program through
|
|
103
|
-
# injected catalog names because `minimal-prompt`
|
|
104
|
-
# `tools:sdk` and `tools:ptc-only` sections out of the
|
|
105
|
-
#
|
|
106
|
-
#
|
|
107
|
-
#
|
|
108
|
-
#
|
|
106
|
+
# turn on (when successfully activated): the wire collapses to the reserved
|
|
107
|
+
# `run_code` transport and every other tool is reached inside the program through
|
|
108
|
+
# the generated SDK, which the injected catalog names because `minimal-prompt`
|
|
109
|
+
# filters the harness's own `tools:sdk` and `tools:ptc-only` sections out of the
|
|
110
|
+
# prompt. The SDK preserves full input and output key parameter semantics rather
|
|
111
|
+
# than a rigid short-summary contract. The declaration is per session
|
|
112
|
+
# (`agent.ctx.tools.presentAs`), needs a mounted code runtime, and degrades to
|
|
113
|
+
# the native surface with a one-time warning when either is missing or fails.
|
|
114
|
+
# Set `false` to restore the pre-PTC behavior: the full native roster on the
|
|
115
|
+
# wire from the second turn.
|
|
109
116
|
- id: minimal-prompt
|
|
110
117
|
name: ./minimal-prompt.mjs
|
|
111
118
|
config:
|
|
@@ -117,7 +124,7 @@
|
|
|
117
124
|
name: ./tool-catalog.mjs
|
|
118
125
|
config:
|
|
119
126
|
descriptionMaxLength: 200
|
|
120
|
-
anchorTools: [bash]
|
|
127
|
+
anchorTools: [bash, str_replace_editor, exit_plan_mode, skill]
|
|
121
128
|
ptcPresentation: true
|
|
122
129
|
|
|
123
130
|
# The harness's workspace-instruction loader. Under the default
|