@linxin666/dsh-liangshen 0.1.13 → 0.1.14
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 +9 -16
- package/README.zh.md +9 -16
- package/lib/index.js +26 -10
- package/lib/types/index.d.ts +4 -4
- package/lib/types/sync.d.ts +8 -2
- package/package.json +2 -2
- package/presets/liangshen/NOTICE +3 -2
- package/presets/liangshen/agent.cordis.yml +75 -44
- package/presets/liangshen/preset.yml +1 -1
- package/src/index.ts +8 -5
- package/src/sync.test.ts +14 -1
- package/src/sync.ts +28 -13
- package/presets/liangshen-exact/NOTICE +0 -4
- package/presets/liangshen-exact/agent.cordis.yml +0 -321
- package/presets/liangshen-exact/preset.yml +0 -3
- package/presets/liangshen-exact/tool-bootstrap.mjs +0 -10
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: 945c54f8194ef01133b7df6d4b75cb4885f659e1
|
|
6
|
+
README.zh.md: 11b0ac37ff48d18bfd88a760f2e7fb16a64c7ebb
|
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
Ships the "Anchored Standard" preset
|
|
5
|
+
Ships the "Anchored Standard" preset as a one-command plugin of the dsh-web-ui family: on host startup it syncs the bundled preset into `~/.dsh/.agent-presets`, so new sessions can pick "梁神模式" from the preset picker. The first model request sees only the builtin Minimal preset's exact two tools — persistent `bash` plus `str_replace_editor` — only the one-line persona prompt section, no runtime contexts, and no injected instructions; after the anchor is established the wire switches to Code Mode (PTC) and the ordinary injections open. Built entirely on the official NPM SDK — no dsh source changes.
|
|
6
6
|
|
|
7
7
|
## Why
|
|
8
8
|
|
|
9
9
|
DeepSeek V4 Pro conditions strongly on the API tool catalog visible in the FIRST request when choosing its execution trajectory. In the community eval ([xiaobright/modeltest](https://github.com/xiaobright/modeltest)), Standard / PTC scored 91/92 while Minimal reached 99/96 — but Minimal keeps only two tools. This two-phase approach separates the first-trajectory choice from full later capability:
|
|
10
10
|
|
|
11
|
-
1. The first model request exposes only the
|
|
11
|
+
1. The first model request exposes only the builtin Minimal preset's exact two tools (persistent `bash` plus `str_replace_editor`), keeps only the `persona` prompt section, empties runtime contexts, and passes only the user's own messages;
|
|
12
12
|
2. After the session's first durable `tool/call`, promotion waits until the first reasoning block is minimal-like (contains `we` and no `let me`), with a four-step fallback; the wire then switches to Code Mode (PTC) — a single `run_code` tool backed by the full tool registry SDK — and every assembled prompt section plus the ordinary workspace-instruction, skill-catalog, and runtime-context injections return;
|
|
13
13
|
3. The phase derives from persisted session events, so resume / reload never lose state.
|
|
14
14
|
|
|
@@ -30,10 +30,10 @@ Plan mode is supported: phase 1 filters the assembled prompt sections down to th
|
|
|
30
30
|
|
|
31
31
|
```sh
|
|
32
32
|
# Option 1: family bundle (recommended)
|
|
33
|
-
dsh plugin --profile web add @linxin666/dsh-web-ui-all
|
|
33
|
+
dsh plugin --profile web add @linxin666/dsh-web-ui-all
|
|
34
34
|
|
|
35
35
|
# Option 2: standalone
|
|
36
|
-
dsh plugin --profile web add @linxin666/dsh-liangshen
|
|
36
|
+
dsh plugin --profile web add @linxin666/dsh-liangshen
|
|
37
37
|
|
|
38
38
|
# Pick ONE of the two: the bundle and the standalone @linxin666/dsh-liangshen
|
|
39
39
|
# both mount this preset. If you switch between them, remove the other first:
|
|
@@ -42,22 +42,14 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
42
42
|
|
|
43
43
|
Fully restart `dsh web`, open a NEW empty session, and pick "梁神模式" as the preset. The plugin syncs the presets into `~/.dsh/.agent-presets` at startup (upgrades refresh them automatically on next restart).
|
|
44
44
|
|
|
45
|
-
## Experimental exact preset
|
|
46
|
-
|
|
47
|
-
"梁神模式-精确实验" (`liangshen-exact`) keeps the same stabilization controls and shares the main preset's `tool-bootstrap.mjs` implementation (only the `tool-bootstrap` config differs), but matches the builtin Minimal preset's exact phase-1 surface: persistent `bash` plus `str_replace_editor`, byte-identical tool description and one-line persona. After promotion it opens the full Standard catalog and all prompt sections.
|
|
48
|
-
|
|
49
|
-
Sandboxing: unlike the builtin Minimal preset, `liangshen-exact` does not mount a bare `dsh-fs-local` filesystem — its phase-1 file tools inherit the host file sandbox (the editor reuses the host sandboxed `ctx.fs`), exactly like every Standard file tool.
|
|
50
|
-
|
|
51
|
-
Tradeoff: the persistent shell replaces the Standard ephemeral `bash` for the whole session (both tools register the name `bash`), so it is the A/B variant for comparing anchor hit rate, not a drop-in replacement for the main preset.
|
|
52
|
-
|
|
53
45
|
## Verify
|
|
54
46
|
|
|
55
47
|
Export the session JSONL and inspect `request/header`:
|
|
56
48
|
|
|
57
|
-
- The first header should carry only `bash/
|
|
49
|
+
- The first header should carry only `bash/str_replace_editor` (the persistent shell plus the sandboxed editor);
|
|
58
50
|
- The first turn should contain only the user's own messages — no workspace-instruction baseline, no runtime snapshot, no skill-catalog message — and only the `persona` prompt section;
|
|
59
51
|
- After the first tool call, the next changed header should carry exactly `run_code` (PTC); the runtime snapshot and all prompt sections (including plan mode's `plan:policy`) arrive with that step and the workspace instructions and skill catalog arrive one step later;
|
|
60
|
-
-
|
|
52
|
+
- Phase-1 editor writes obey the host file sandbox policy — there is no bare local-filesystem bypass;
|
|
61
53
|
- Later requests keep `run_code`.
|
|
62
54
|
|
|
63
55
|
Trajectory drift can be measured without reading raw reasoning:
|
|
@@ -73,7 +65,8 @@ node tools/analyze-session.mjs ~/.dsh/sessions/<workspace>/<session>/session.jso
|
|
|
73
65
|
- A tool call that fails still counts toward promotion as long as `tool/call` was persisted;
|
|
74
66
|
- Phase 1 keeps only the `persona` prompt section; promotion restores every assembled section, so plan mode's `plan:policy` is enforced after phase 1;
|
|
75
67
|
- Workspace instructions, the skill catalog, and the runtime snapshot stay out of phase 1; the snapshot returns with the catalog and the other two arrive one step later;
|
|
76
|
-
-
|
|
68
|
+
- Phase-1 file tools inherit the host file sandbox (no bare `dsh-fs-local` filesystem);
|
|
69
|
+
- The phase-1 persistent `bash` replaces the Standard ephemeral shell for the whole session (both tools register the name `bash`);
|
|
77
70
|
- The catalog changes exactly once, so a prefix-cache change happens between the first and second request;
|
|
78
71
|
- The preset carries the same trust level as shell access — review `presets/liangshen/` before installing;
|
|
79
72
|
- The plugin makes no network requests and adds no telemetry;
|
|
@@ -82,4 +75,4 @@ node tools/analyze-session.mjs ~/.dsh/sessions/<workspace>/<session>/session.jso
|
|
|
82
75
|
|
|
83
76
|
## License
|
|
84
77
|
|
|
85
|
-
Plugin body Apache-2.0 (zhu1090093659). `presets/liangshen/agent.cordis.yml` derives from the DeepSeek Harness
|
|
78
|
+
Plugin body Apache-2.0 (zhu1090093659). `presets/liangshen/agent.cordis.yml` derives from the DeepSeek Harness builtin Minimal and Standard presets, and `tool-bootstrap.mjs` comes from xiaobright/dsh-anchored-standard — all MIT, with copyright and license notices kept in the preset's `NOTICE`.
|
package/README.zh.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
把「Anchored Standard」preset
|
|
5
|
+
把「Anchored Standard」preset 做成 DSH 全家桶里的一键安装插件:Host 启动时把内置 preset 同步到 `~/.dsh/.agent-presets`,新建会话即可在预设选择器中选择「梁神模式」。首轮模型请求只看到官方 Minimal 精确双工具——持久 `bash` 与 `str_replace_editor`——与一行 persona,没有运行时上下文和指令注入;锚定建立后 wire 切换为 Code Mode(PTC),并开放全部 prompt section 与常规注入。全部通过官方 NPM SDK 实现,不修改 DSH 源码。
|
|
6
6
|
|
|
7
7
|
## 原理
|
|
8
8
|
|
|
9
9
|
DeepSeek V4 Pro 会强烈依赖 API 中可见的**首轮工具目录**选择执行轨迹。社区评测([xiaobright/modeltest](https://github.com/xiaobright/modeltest))中,Standard / PTC 只有 91/92 分,Minimal 达到 99/96,但 Minimal 只有两个工具。两阶段方案把「首次轨迹选择」与「后续完整工具能力」拆开:
|
|
10
10
|
|
|
11
|
-
1.
|
|
11
|
+
1. 首轮模型请求只暴露官方 Minimal 精确双工具(持久 `bash` 与 `str_replace_editor`),只保留 `persona` 一个 prompt section,清空运行时上下文,并且只放行用户自己的消息;
|
|
12
12
|
2. 会话出现首次持久 `tool/call` 后,晋升会等到首个 reasoning 块呈 minimal-like(包含 `we` 且无 `let me`)才发生,四步兜底;随后 wire 切换为 Code Mode(PTC)——只暴露一个 `run_code`,完整工具注册表通过生成的 SDK 调用——并恢复全部 prompt section(含 plan mode 的 `plan:policy`)以及 workspace 指令、skill 目录与运行时快照等常规注入;
|
|
13
13
|
3. 阶段从持久化 session events 推导,resume / reload 不丢失状态。
|
|
14
14
|
|
|
@@ -30,10 +30,10 @@ preset 在参考机制之上内置了额外保护,全部在 `agent.cordis.yml`
|
|
|
30
30
|
|
|
31
31
|
```sh
|
|
32
32
|
# 方式一:全家桶(推荐)
|
|
33
|
-
dsh plugin --profile web add @linxin666/dsh-web-ui-all
|
|
33
|
+
dsh plugin --profile web add @linxin666/dsh-web-ui-all
|
|
34
34
|
|
|
35
35
|
# 方式二:单独安装
|
|
36
|
-
dsh plugin --profile web add @linxin666/dsh-liangshen
|
|
36
|
+
dsh plugin --profile web add @linxin666/dsh-liangshen
|
|
37
37
|
|
|
38
38
|
# 两种方式二选一:聚合包与独立 @linxin666/dsh-liangshen 都会挂载本 preset。
|
|
39
39
|
# 需要在两者之间切换时,先 dsh plugin remove 移除另一个再安装:
|
|
@@ -42,22 +42,14 @@ dsh plugin --profile web remove @linxin666/dsh-liangshen
|
|
|
42
42
|
|
|
43
43
|
装完**完整重启 `dsh web`**,新建空 session,预设选择「梁神模式」。插件会在启动时把 presets 同步进 `~/.dsh/.agent-presets`(升级插件后重启即自动更新)。
|
|
44
44
|
|
|
45
|
-
## 精确实验预设
|
|
46
|
-
|
|
47
|
-
「梁神模式-精确实验」(`liangshen-exact`)保留相同的稳定化控制,并与主 preset 共用同一份 `tool-bootstrap.mjs` 实现(只有 `tool-bootstrap` config 不同),但 phase 1 与内置 Minimal 预设逐字节对齐:持久 `bash` + `str_replace_editor`,工具描述与一行 persona 完全一致;晋升后开放完整 Standard 目录与全部 prompt section。
|
|
48
|
-
|
|
49
|
-
沙箱说明:与内置 Minimal 预设不同,`liangshen-exact` 不挂载裸的 `dsh-fs-local` 文件系统——phase 1 文件工具继承宿主文件沙箱(编辑器复用宿主的 sandboxed `ctx.fs`),与所有 Standard 文件工具一致。
|
|
50
|
-
|
|
51
|
-
代价:持久 shell 会替代 Standard 的一次性 `bash` 直到会话结束(两个工具都注册 `bash` 名字),所以它用于对比锚定命中率的 A/B 实验,不替代主 preset。
|
|
52
|
-
|
|
53
45
|
## 验证
|
|
54
46
|
|
|
55
47
|
导出 session JSONL,检查 `request/header`:
|
|
56
48
|
|
|
57
|
-
- 第一份 header 应只有 `bash/
|
|
49
|
+
- 第一份 header 应只有 `bash/str_replace_editor`(持久 shell + 沙箱化编辑器);
|
|
58
50
|
- 第一轮应只包含用户自己的消息:没有 workspace 指令 baseline、没有运行时快照、没有 skill 目录消息,并且只有 `persona` 一个 prompt section;
|
|
59
51
|
- 首次工具调用后,下一份变更 header 应恰好为 `run_code`(PTC);运行时快照与全部 prompt section(含 plan mode 的 `plan:policy`)随该步出现,workspace 指令与 skill 目录再晚一步出现;
|
|
60
|
-
-
|
|
52
|
+
- phase 1 编辑器写入受宿主文件沙箱策略约束,不存在裸本地文件系统绕过;
|
|
61
53
|
- 此后的请求保持 `run_code`。
|
|
62
54
|
|
|
63
55
|
不读原始 reasoning 也能测量轨迹漂移:
|
|
@@ -73,7 +65,8 @@ node tools/analyze-session.mjs <导出的 session.jsonl>
|
|
|
73
65
|
- 工具执行即使失败,只要 `tool/call` 已持久化,仍计入晋升条件;
|
|
74
66
|
- phase 1 只保留 `persona` prompt section;晋升后恢复全部 assembled sections,因此 plan mode 的 `plan:policy` 在晋升后生效;
|
|
75
67
|
- workspace 指令、skill 目录与运行时快照在首轮不注入;快照随 PTC 目录出现,前两者再晚一步出现;
|
|
76
|
-
-
|
|
68
|
+
- phase 1 文件工具继承宿主文件沙箱(不挂载裸 `dsh-fs-local`);
|
|
69
|
+
- phase 1 的持久 `bash` 会替代 Standard 的一次性 shell 直到会话结束(两个工具都注册 `bash` 名字);
|
|
77
70
|
- 工具目录只变化一次,因此第一、二次请求之间会发生一次前缀缓存变化;
|
|
78
71
|
- preset 与 shell 访问具有相同信任等级,安装前可自行审阅 `presets/`;
|
|
79
72
|
- 插件不发起网络请求,也不增加遥测;
|
|
@@ -82,4 +75,4 @@ node tools/analyze-session.mjs <导出的 session.jsonl>
|
|
|
82
75
|
|
|
83
76
|
## 许可
|
|
84
77
|
|
|
85
|
-
插件本体 Apache-2.0(zhu1090093659)。`presets/liangshen/agent.cordis.yml` 基于 DeepSeek Harness
|
|
78
|
+
插件本体 Apache-2.0(zhu1090093659)。`presets/liangshen/agent.cordis.yml` 基于 DeepSeek Harness 内置 Minimal 与 Standard preset 修改,`tool-bootstrap.mjs` 来自 xiaobright/dsh-anchored-standard,均为 MIT,版权与许可声明见 preset 的 `NOTICE`。
|
package/lib/index.js
CHANGED
|
@@ -93,19 +93,23 @@ function syncOnePreset(sourceDir, targetDir) {
|
|
|
93
93
|
return "synced";
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
* Sync every preset under `sourceRoot` into `targetRoot
|
|
96
|
+
* Sync every preset under `sourceRoot` into `targetRoot`, then remove
|
|
97
|
+
* target directories named in `retire` that the bundle no longer ships —
|
|
98
|
+
* preset ids the plugin once owned and later dropped. Only those exact ids
|
|
99
|
+
* are removed; every other target directory is left untouched.
|
|
97
100
|
* @param sourceRoot - plugin-owned preset tree (bundled in the package).
|
|
98
101
|
* @param targetRoot - dsh agent-presets discovery root (e.g. <home>/.dsh/.agent-presets).
|
|
102
|
+
* @param retire - previously bundled preset ids to remove when absent from the source.
|
|
99
103
|
*/
|
|
100
|
-
function syncPresetTrees(sourceRoot, targetRoot) {
|
|
104
|
+
function syncPresetTrees(sourceRoot, targetRoot, retire = []) {
|
|
101
105
|
const result = {
|
|
102
106
|
synced: [],
|
|
103
107
|
current: [],
|
|
104
|
-
failed: []
|
|
108
|
+
failed: [],
|
|
109
|
+
retired: []
|
|
105
110
|
};
|
|
106
|
-
if (!existsSync(sourceRoot)) return result;
|
|
107
111
|
mkdirSync(targetRoot, { recursive: true });
|
|
108
|
-
for (const entry of readdirSync(sourceRoot)) {
|
|
112
|
+
if (existsSync(sourceRoot)) for (const entry of readdirSync(sourceRoot)) {
|
|
109
113
|
const source = join(sourceRoot, entry);
|
|
110
114
|
if (!statSync(source).isDirectory()) continue;
|
|
111
115
|
const id = basename(source);
|
|
@@ -118,6 +122,17 @@ function syncPresetTrees(sourceRoot, targetRoot) {
|
|
|
118
122
|
});
|
|
119
123
|
}
|
|
120
124
|
}
|
|
125
|
+
for (const id of retire) {
|
|
126
|
+
if (existsSync(join(sourceRoot, id))) continue;
|
|
127
|
+
const stale = join(targetRoot, id);
|
|
128
|
+
if (existsSync(stale) && statSync(stale).isDirectory()) {
|
|
129
|
+
rmSync(stale, {
|
|
130
|
+
recursive: true,
|
|
131
|
+
force: true
|
|
132
|
+
});
|
|
133
|
+
result.retired.push(id);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
121
136
|
return result;
|
|
122
137
|
}
|
|
123
138
|
//#endregion
|
|
@@ -132,9 +147,9 @@ function syncPresetTrees(sourceRoot, targetRoot) {
|
|
|
132
147
|
* half, no routes, no agent tools — the preset itself provides the tools.
|
|
133
148
|
*
|
|
134
149
|
* The preset is the "anchored-standard" idea shipped as a named mode: the
|
|
135
|
-
* first model request sees only the
|
|
136
|
-
*
|
|
137
|
-
*
|
|
150
|
+
* first model request sees only the builtin Minimal preset's exact two tools
|
|
151
|
+
* (persistent `bash` plus `str_replace_editor`), and after the anchor the
|
|
152
|
+
* wire switches to Code Mode (PTC). Derived from
|
|
138
153
|
* https://github.com/xiaobright/dsh-anchored-standard (MIT).
|
|
139
154
|
*/
|
|
140
155
|
/** Stable cordis plugin name. */
|
|
@@ -150,7 +165,7 @@ const DEFAULT_ANNOUNCE = true;
|
|
|
150
165
|
/** Order of the announcement section within the tool-guidance band. */
|
|
151
166
|
const SECTION_ORDER = 150;
|
|
152
167
|
/** Model-facing announcement: plugin presence, principle, and limits. */
|
|
153
|
-
const LIANGSHEN_GUIDANCE = "本机已安装 dsh-liangshen 插件(梁神模式 agent preset
|
|
168
|
+
const LIANGSHEN_GUIDANCE = "本机已安装 dsh-liangshen 插件(梁神模式 agent preset):新建会话的预设选择器中可选「梁神模式」。原理:两阶段锚定——首轮模型请求仅暴露官方 Minimal 精确双工具(持久 bash 与 str_replace_editor,文件工具继承宿主沙箱),只保留一行 persona,清空运行时上下文并只放行用户的直接消息,锚定 Minimal 推理轨迹;晋升受首块锚定门控(首块包含 we 且无 let me,四步兜底),无工具首轮会在响应后自动晋升,晋升后 wire 切换为 Code Mode(PTC,单一 run_code),workspace 指令与 skill 目录在晋升后再延迟一步注入。preset 文件由插件维护于 ~/.dsh/.agent-presets,升级插件时自动更新;默认预设由用户自行选择。用户提到「梁神模式 / 锚定模式 / anchored standard」时即指本插件,请据此协作。";
|
|
154
169
|
/** Expand a leading `~`, `~/` or `~\` to the current user's home directory. */
|
|
155
170
|
function expandTilde(path) {
|
|
156
171
|
if (path === "~") return homedir();
|
|
@@ -183,9 +198,10 @@ function apply(ctx, config) {
|
|
|
183
198
|
const targetRoot = join(dshHome(), ".agent-presets");
|
|
184
199
|
try {
|
|
185
200
|
mkdirSync(targetRoot, { recursive: true });
|
|
186
|
-
const result = syncPresetTrees(bundledPresetsRoot(), targetRoot);
|
|
201
|
+
const result = syncPresetTrees(bundledPresetsRoot(), targetRoot, ["liangshen-exact"]);
|
|
187
202
|
for (const { id, error } of result.failed) ctx.logger?.warn?.(`dsh-liangshen: preset ${id} sync failed: ${error}`);
|
|
188
203
|
if (result.synced.length > 0) ctx.logger?.info?.(`dsh-liangshen: presets synced into ${targetRoot}: ${result.synced.join(", ")}`);
|
|
204
|
+
if (result.retired.length > 0) ctx.logger?.info?.(`dsh-liangshen: retired stale presets from ${targetRoot}: ${result.retired.join(", ")}`);
|
|
189
205
|
} catch (error) {
|
|
190
206
|
ctx.logger?.warn?.(`dsh-liangshen: preset sync failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
191
207
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* half, no routes, no agent tools — the preset itself provides the tools.
|
|
9
9
|
*
|
|
10
10
|
* The preset is the "anchored-standard" idea shipped as a named mode: the
|
|
11
|
-
* first model request sees only the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* first model request sees only the builtin Minimal preset's exact two tools
|
|
12
|
+
* (persistent `bash` plus `str_replace_editor`), and after the anchor the
|
|
13
|
+
* wire switches to Code Mode (PTC). Derived from
|
|
14
14
|
* https://github.com/xiaobright/dsh-anchored-standard (MIT).
|
|
15
15
|
*/
|
|
16
16
|
import type { Context } from '@deepseek-ai/cordis';
|
|
@@ -28,7 +28,7 @@ export interface Config {
|
|
|
28
28
|
}
|
|
29
29
|
export declare const Config: z<Config>;
|
|
30
30
|
/** Model-facing announcement: plugin presence, principle, and limits. */
|
|
31
|
-
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\
|
|
31
|
+
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\u4E24\u9636\u6BB5\u951A\u5B9A\u2014\u2014\u9996\u8F6E\u6A21\u578B\u8BF7\u6C42\u4EC5\u66B4\u9732\u5B98\u65B9 Minimal \u7CBE\u786E\u53CC\u5DE5\u5177\uFF08\u6301\u4E45 bash \u4E0E str_replace_editor\uFF0C\u6587\u4EF6\u5DE5\u5177\u7EE7\u627F\u5BBF\u4E3B\u6C99\u7BB1\uFF09\uFF0C\u53EA\u4FDD\u7559\u4E00\u884C persona\uFF0C\u6E05\u7A7A\u8FD0\u884C\u65F6\u4E0A\u4E0B\u6587\u5E76\u53EA\u653E\u884C\u7528\u6237\u7684\u76F4\u63A5\u6D88\u606F\uFF0C\u951A\u5B9A Minimal \u63A8\u7406\u8F68\u8FF9\uFF1B\u664B\u5347\u53D7\u9996\u5757\u951A\u5B9A\u95E8\u63A7\uFF08\u9996\u5757\u5305\u542B we \u4E14\u65E0 let me\uFF0C\u56DB\u6B65\u515C\u5E95\uFF09\uFF0C\u65E0\u5DE5\u5177\u9996\u8F6E\u4F1A\u5728\u54CD\u5E94\u540E\u81EA\u52A8\u664B\u5347\uFF0C\u664B\u5347\u540E wire \u5207\u6362\u4E3A Code Mode\uFF08PTC\uFF0C\u5355\u4E00 run_code\uFF09\uFF0Cworkspace \u6307\u4EE4\u4E0E skill \u76EE\u5F55\u5728\u664B\u5347\u540E\u518D\u5EF6\u8FDF\u4E00\u6B65\u6CE8\u5165\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";
|
|
32
32
|
/** Resolve the harness home (DSH_HOME overrides the conventional ~/.dsh). */
|
|
33
33
|
export declare function dshHome(): string;
|
|
34
34
|
/** Absolute path of the bundled preset tree inside this package. */
|
package/lib/types/sync.d.ts
CHANGED
|
@@ -20,12 +20,18 @@ export interface SyncResult {
|
|
|
20
20
|
id: string;
|
|
21
21
|
error: string;
|
|
22
22
|
}[];
|
|
23
|
+
/** Previously bundled preset ids removed from the target root this run. */
|
|
24
|
+
retired: string[];
|
|
23
25
|
}
|
|
24
26
|
/** Copy `sourceRoot/<id>` into `targetRoot/<id>`, idempotently. */
|
|
25
27
|
export declare function syncOnePreset(sourceDir: string, targetDir: string): 'synced' | 'current';
|
|
26
28
|
/**
|
|
27
|
-
* Sync every preset under `sourceRoot` into `targetRoot
|
|
29
|
+
* Sync every preset under `sourceRoot` into `targetRoot`, then remove
|
|
30
|
+
* target directories named in `retire` that the bundle no longer ships —
|
|
31
|
+
* preset ids the plugin once owned and later dropped. Only those exact ids
|
|
32
|
+
* are removed; every other target directory is left untouched.
|
|
28
33
|
* @param sourceRoot - plugin-owned preset tree (bundled in the package).
|
|
29
34
|
* @param targetRoot - dsh agent-presets discovery root (e.g. <home>/.dsh/.agent-presets).
|
|
35
|
+
* @param retire - previously bundled preset ids to remove when absent from the source.
|
|
30
36
|
*/
|
|
31
|
-
export declare function syncPresetTrees(sourceRoot: string, targetRoot: string): SyncResult;
|
|
37
|
+
export declare function syncPresetTrees(sourceRoot: string, targetRoot: string, retire?: string[]): SyncResult;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-liangshen",
|
|
3
|
-
"description": "LiangShen (梁神) agent preset
|
|
4
|
-
"version": "0.1.
|
|
3
|
+
"description": "LiangShen (梁神) agent preset for the dsh web GUI: a two-phase anchored-standard preset — the first model request exposes only the builtin Minimal exact two-tool surface (persistent bash plus str_replace_editor) with no runtime contexts or injected instructions (Minimal-aligned trajectory anchor), promotion is gated on the first minimal-like reasoning block with a fallback, and the wire then switches to Code Mode (PTC, a single run_code tool over the full registry) with the ordinary injections returning afterwards. The preset files are synced into ~/.dsh/.agent-presets on host startup. Hot-pluggable — mounted via cordis.patch.yml + a profile node_modules symlink, no dsh source changes.",
|
|
4
|
+
"version": "0.1.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^22.19.0 || >=24.0.0"
|
package/presets/liangshen/NOTICE
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
agent.cordis.yml 改编自 DeepSeek Harness Standard preset(MIT)。
|
|
2
|
-
tool-bootstrap.mjs 来自 https://github.com/xiaobright/dsh-anchored-standard(MIT
|
|
1
|
+
agent.cordis.yml 改编自 DeepSeek Harness 内置 Minimal 与 Standard preset(MIT)。
|
|
2
|
+
tool-bootstrap.mjs 来自 https://github.com/xiaobright/dsh-anchored-standard(MIT),
|
|
3
|
+
并包含 dsh-liangshen 的两阶段隔离扩展。
|
|
3
4
|
原始 DeepSeek 版权和 MIT 许可声明见开源仓库。
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
# The `liangshen` (梁神模式) agent preset:
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
1
|
+
# The `liangshen` (梁神模式) agent preset: phase 1 exposes the builtin Minimal
|
|
2
|
+
# preset's exact two tools (persistent `bash` plus `str_replace_editor`) and
|
|
3
|
+
# the same one-line persona, with no runtime contexts and no injected pre-step
|
|
4
|
+
# messages, anchoring the Minimal trajectory; after a stabilized anchor the
|
|
5
|
+
# wire switches to Code Mode (PTC) and the ordinary injections open. The
|
|
6
|
+
# phase-1 surface matches the official "exact RL prompt and schemas" snapshot
|
|
7
|
+
# byte-for-byte on the model-visible wire shape, at the cost of keeping the
|
|
8
|
+
# persistent shell for the whole session. Unlike the builtin Minimal preset,
|
|
9
|
+
# the phase-1 editor inherits the host file sandbox instead of mounting a bare
|
|
10
|
+
# local filesystem (see the filesystem section below).
|
|
11
|
+
#
|
|
12
|
+
# Adapted from the builtin `minimal` and `standard` presets.
|
|
8
13
|
#
|
|
9
14
|
# This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
|
|
10
15
|
# standing scope; every session naming it joins by scope parentage, so the
|
|
@@ -34,25 +39,22 @@
|
|
|
34
39
|
config:
|
|
35
40
|
text: You are a helpful software engineer assistant.
|
|
36
41
|
|
|
37
|
-
# Two-phase input bootstrap
|
|
38
|
-
#
|
|
39
|
-
# `persona` prompt section, no runtime
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
# is presented as Code Mode (PTC): a single `run_code` tool on the wire,
|
|
49
|
-
# switched at the step boundary. Workspace instructions and the skill catalog
|
|
50
|
-
# are additionally deferred for one step after promotion (`deferredSources`).
|
|
42
|
+
# Two-phase input bootstrap with the exact Minimal phase-1 tools. Before the
|
|
43
|
+
# first durable tool/call event the model sees only persistent `bash` plus
|
|
44
|
+
# `str_replace_editor`, only the `persona` prompt section, no runtime
|
|
45
|
+
# contexts, and only direct user messages. `anchorGate` holds the promotion
|
|
46
|
+
# open until the first reasoning block is minimal-like (four-step fallback);
|
|
47
|
+
# `promoteAfterFirstResponse` avoids a permanent two-tool session after a
|
|
48
|
+
# tool-less first response, and releases an anchor-gated session once its
|
|
49
|
+
# first turn ends (`turn/end`). After promotion the catalog is presented as
|
|
50
|
+
# Code Mode (PTC): a single `run_code` tool on the wire, switched at the step
|
|
51
|
+
# boundary; workspace instructions and the skill catalog are deferred one
|
|
52
|
+
# step after promotion.
|
|
51
53
|
- id: tool-bootstrap
|
|
52
54
|
name: ./tool-bootstrap.mjs
|
|
53
55
|
config:
|
|
54
|
-
shellTools: [bash
|
|
55
|
-
commonTools: [
|
|
56
|
+
shellTools: [bash]
|
|
57
|
+
commonTools: [str_replace_editor]
|
|
56
58
|
messageSources: [user]
|
|
57
59
|
anchorGate: true
|
|
58
60
|
maxBootstrapSteps: 4
|
|
@@ -68,24 +70,55 @@
|
|
|
68
70
|
config:
|
|
69
71
|
maxBytes: 65536
|
|
70
72
|
|
|
71
|
-
# ── shell
|
|
73
|
+
# ── minimal phase-1 shell ───────────────────────────────────────────────────
|
|
72
74
|
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
# The PTY registry is an agent-owned service, so it lives in an entry-local
|
|
76
|
+
# realm. The backend still consumes the host sandbox policy and subprocess
|
|
77
|
+
# implementation, while the tool registers into this agent's scoped catalog.
|
|
78
|
+
# This persistent `bash` replaces the Standard ephemeral shell for the WHOLE
|
|
79
|
+
# session (both tools register the name `bash`), which is the exact-Minimal
|
|
80
|
+
# tradeoff this experimental preset evaluates.
|
|
81
|
+
- id: persistent-shell
|
|
82
|
+
name: cordis:group
|
|
83
|
+
group: true
|
|
84
|
+
isolate:
|
|
85
|
+
terminals: true
|
|
86
|
+
config:
|
|
87
|
+
- id: pty
|
|
88
|
+
name: '@deepseek-ai/dsh-terminal'
|
|
83
89
|
|
|
84
|
-
- id:
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
- id: terminal-bash
|
|
91
|
+
name: '@deepseek-ai/dsh-terminal-bash'
|
|
92
|
+
config:
|
|
93
|
+
timeoutMs: 300000
|
|
94
|
+
|
|
95
|
+
- id: persistent-bash
|
|
96
|
+
name: '@deepseek-ai/dsh-tool-bash-persistent'
|
|
97
|
+
config:
|
|
98
|
+
timeoutMs: 300000
|
|
99
|
+
description: |-
|
|
100
|
+
Run commands in a bash shell
|
|
101
|
+
* When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.
|
|
102
|
+
* You don't have access to the internet via this tool.
|
|
103
|
+
* You do have access to a mirror of common linux and python packages via apt and pip.
|
|
104
|
+
* State is persistent across command calls and discussions with the user.
|
|
105
|
+
* To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p /path/to/the/file'.
|
|
106
|
+
* Please avoid commands that may produce a very large amount of output.
|
|
107
|
+
* Please run long lived commands in the background, e.g. 'sleep 10 &' or start a server in the background.
|
|
108
|
+
|
|
109
|
+
# ── minimal phase-1 filesystem ──────────────────────────────────────────────
|
|
110
|
+
|
|
111
|
+
# Phase-1 editor as a direct top-level row: it reuses the host's sandboxed
|
|
112
|
+
# `ctx.fs`, not a bare local filesystem. No `dsh-fs-local` realm is mounted, so
|
|
113
|
+
# the phase-1 editor inherits the host file sandbox exactly like every
|
|
114
|
+
# Standard file tool, and the model-facing schema stays the builtin Minimal
|
|
115
|
+
# `str_replace_editor`.
|
|
116
|
+
- id: str-replace-editor
|
|
117
|
+
name: '@deepseek-ai/dsh-tool-str-replace-editor'
|
|
118
|
+
config:
|
|
119
|
+
maxOutputChars: 16000
|
|
87
120
|
|
|
88
|
-
# ── filesystem
|
|
121
|
+
# ── standard filesystem tools ───────────────────────────────────────────────
|
|
89
122
|
|
|
90
123
|
# Both register into the host `tools` registry and provide nothing, so
|
|
91
124
|
# they need no realm. The `fs` service and its policy stay in the host.
|
|
@@ -100,12 +133,10 @@
|
|
|
100
133
|
# ── background jobs ────────────────────────────────────────────────────────
|
|
101
134
|
|
|
102
135
|
# Only the model-facing controls. The task REGISTRY stays on the host plane:
|
|
103
|
-
# its producers sit outside any realm this file could put it in
|
|
104
|
-
#
|
|
105
|
-
#
|
|
106
|
-
#
|
|
107
|
-
# owning agent anyway, so one host instance serves every session. What a preset
|
|
108
|
-
# chooses is whether its agent can collect and stop background work at all.
|
|
136
|
+
# its producers sit outside any realm this file could put it in, and the
|
|
137
|
+
# registry is keyed by owning agent anyway. With the persistent shell, long
|
|
138
|
+
# commands run through `&`; these controls still expose whatever the host
|
|
139
|
+
# registry tracks.
|
|
109
140
|
- id: tool-jobs
|
|
110
141
|
name: '@deepseek-ai/dsh-tool-jobs'
|
|
111
142
|
|
package/src/index.ts
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* half, no routes, no agent tools — the preset itself provides the tools.
|
|
9
9
|
*
|
|
10
10
|
* The preset is the "anchored-standard" idea shipped as a named mode: the
|
|
11
|
-
* first model request sees only the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* first model request sees only the builtin Minimal preset's exact two tools
|
|
12
|
+
* (persistent `bash` plus `str_replace_editor`), and after the anchor the
|
|
13
|
+
* wire switches to Code Mode (PTC). Derived from
|
|
14
14
|
* https://github.com/xiaobright/dsh-anchored-standard (MIT).
|
|
15
15
|
*/
|
|
16
16
|
|
|
@@ -49,7 +49,7 @@ const DEFAULT_ANNOUNCE = true
|
|
|
49
49
|
const SECTION_ORDER = 150
|
|
50
50
|
|
|
51
51
|
/** Model-facing announcement: plugin presence, principle, and limits. */
|
|
52
|
-
export const LIANGSHEN_GUIDANCE = '本机已安装 dsh-liangshen 插件(梁神模式 agent preset
|
|
52
|
+
export const LIANGSHEN_GUIDANCE = '本机已安装 dsh-liangshen 插件(梁神模式 agent preset):新建会话的预设选择器中可选「梁神模式」。原理:两阶段锚定——首轮模型请求仅暴露官方 Minimal 精确双工具(持久 bash 与 str_replace_editor,文件工具继承宿主沙箱),只保留一行 persona,清空运行时上下文并只放行用户的直接消息,锚定 Minimal 推理轨迹;晋升受首块锚定门控(首块包含 we 且无 let me,四步兜底),无工具首轮会在响应后自动晋升,晋升后 wire 切换为 Code Mode(PTC,单一 run_code),workspace 指令与 skill 目录在晋升后再延迟一步注入。preset 文件由插件维护于 ~/.dsh/.agent-presets,升级插件时自动更新;默认预设由用户自行选择。用户提到「梁神模式 / 锚定模式 / anchored standard」时即指本插件,请据此协作。'
|
|
53
53
|
|
|
54
54
|
/** Expand a leading `~`, `~/` or `~\` to the current user's home directory. */
|
|
55
55
|
function expandTilde(path: string): string {
|
|
@@ -87,13 +87,16 @@ export function apply(ctx: Context, config?: Config): void {
|
|
|
87
87
|
const targetRoot = join(dshHome(), '.agent-presets')
|
|
88
88
|
try {
|
|
89
89
|
mkdirSync(targetRoot, { recursive: true })
|
|
90
|
-
const result = syncPresetTrees(bundledPresetsRoot(), targetRoot)
|
|
90
|
+
const result = syncPresetTrees(bundledPresetsRoot(), targetRoot, ['liangshen-exact'])
|
|
91
91
|
for (const { id, error } of result.failed) {
|
|
92
92
|
ctx.logger?.warn?.(`dsh-liangshen: preset ${id} sync failed: ${error}`)
|
|
93
93
|
}
|
|
94
94
|
if (result.synced.length > 0) {
|
|
95
95
|
ctx.logger?.info?.(`dsh-liangshen: presets synced into ${targetRoot}: ${result.synced.join(', ')}`)
|
|
96
96
|
}
|
|
97
|
+
if (result.retired.length > 0) {
|
|
98
|
+
ctx.logger?.info?.(`dsh-liangshen: retired stale presets from ${targetRoot}: ${result.retired.join(', ')}`)
|
|
99
|
+
}
|
|
97
100
|
} catch (error) {
|
|
98
101
|
ctx.logger?.warn?.(`dsh-liangshen: preset sync failed: ${error instanceof Error ? error.message : String(error)}`)
|
|
99
102
|
}
|
package/src/sync.test.ts
CHANGED
|
@@ -49,6 +49,19 @@ describe('syncPresetTrees', () => {
|
|
|
49
49
|
} finally { f.dispose() }
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
+
it('retires a previously bundled preset directory removed from the source', () => {
|
|
53
|
+
const f = fixture()
|
|
54
|
+
try {
|
|
55
|
+
syncPresetTrees(f.source, f.target)
|
|
56
|
+
mkdirSync(join(f.target, 'liangshen-exact'), { recursive: true })
|
|
57
|
+
writeFileSync(join(f.target, 'liangshen-exact', 'agent.cordis.yml'), 'rows: []\n')
|
|
58
|
+
const result = syncPresetTrees(f.source, f.target, ['liangshen-exact'])
|
|
59
|
+
expect(result.retired).toEqual(['liangshen-exact'])
|
|
60
|
+
expect(existsSync(join(f.target, 'liangshen-exact'))).toBe(false)
|
|
61
|
+
expect(existsSync(join(f.target, 'liangshen'))).toBe(true)
|
|
62
|
+
} finally { f.dispose() }
|
|
63
|
+
})
|
|
64
|
+
|
|
52
65
|
it('never touches directories it does not own', () => {
|
|
53
66
|
const f = fixture()
|
|
54
67
|
try {
|
|
@@ -119,7 +132,7 @@ describe('syncPresetTrees', () => {
|
|
|
119
132
|
const f = fixture()
|
|
120
133
|
try {
|
|
121
134
|
const result = syncPresetTrees(join(f.source, 'nope'), f.target)
|
|
122
|
-
expect(result).toEqual({ synced: [], current: [], failed: [] })
|
|
135
|
+
expect(result).toEqual({ synced: [], current: [], failed: [], retired: [] })
|
|
123
136
|
} finally { f.dispose() }
|
|
124
137
|
})
|
|
125
138
|
})
|
package/src/sync.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface SyncResult {
|
|
|
21
21
|
current: string[]
|
|
22
22
|
/** Preset ids that failed, with the underlying error message. */
|
|
23
23
|
failed: { id: string; error: string }[]
|
|
24
|
+
/** Previously bundled preset ids removed from the target root this run. */
|
|
25
|
+
retired: string[]
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
function filesUnder(root: string): string[] {
|
|
@@ -108,23 +110,36 @@ export function syncOnePreset(sourceDir: string, targetDir: string): 'synced' |
|
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
/**
|
|
111
|
-
* Sync every preset under `sourceRoot` into `targetRoot
|
|
113
|
+
* Sync every preset under `sourceRoot` into `targetRoot`, then remove
|
|
114
|
+
* target directories named in `retire` that the bundle no longer ships —
|
|
115
|
+
* preset ids the plugin once owned and later dropped. Only those exact ids
|
|
116
|
+
* are removed; every other target directory is left untouched.
|
|
112
117
|
* @param sourceRoot - plugin-owned preset tree (bundled in the package).
|
|
113
118
|
* @param targetRoot - dsh agent-presets discovery root (e.g. <home>/.dsh/.agent-presets).
|
|
119
|
+
* @param retire - previously bundled preset ids to remove when absent from the source.
|
|
114
120
|
*/
|
|
115
|
-
export function syncPresetTrees(sourceRoot: string, targetRoot: string): SyncResult {
|
|
116
|
-
const result: SyncResult = { synced: [], current: [], failed: [] }
|
|
117
|
-
if (!existsSync(sourceRoot)) return result
|
|
121
|
+
export function syncPresetTrees(sourceRoot: string, targetRoot: string, retire: string[] = []): SyncResult {
|
|
122
|
+
const result: SyncResult = { synced: [], current: [], failed: [], retired: [] }
|
|
118
123
|
mkdirSync(targetRoot, { recursive: true })
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
if (existsSync(sourceRoot)) {
|
|
125
|
+
for (const entry of readdirSync(sourceRoot)) {
|
|
126
|
+
const source = join(sourceRoot, entry)
|
|
127
|
+
if (!statSync(source).isDirectory()) continue
|
|
128
|
+
const id = basename(source)
|
|
129
|
+
try {
|
|
130
|
+
const outcome = syncOnePreset(source, join(targetRoot, id))
|
|
131
|
+
;(outcome === 'synced' ? result.synced : result.current).push(id)
|
|
132
|
+
} catch (error) {
|
|
133
|
+
result.failed.push({ id, error: error instanceof Error ? error.message : String(error) })
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
for (const id of retire) {
|
|
138
|
+
if (existsSync(join(sourceRoot, id))) continue
|
|
139
|
+
const stale = join(targetRoot, id)
|
|
140
|
+
if (existsSync(stale) && statSync(stale).isDirectory()) {
|
|
141
|
+
rmSync(stale, { recursive: true, force: true })
|
|
142
|
+
result.retired.push(id)
|
|
128
143
|
}
|
|
129
144
|
}
|
|
130
145
|
return result
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
# The `liangshen-exact` (梁神模式-精确实验) agent preset: phase 1 exposes the
|
|
2
|
-
# builtin Minimal preset's exact two tools (persistent `bash` plus
|
|
3
|
-
# `str_replace_editor`) and the same one-line persona, with no runtime contexts
|
|
4
|
-
# and no injected pre-step messages; after a stabilized anchor the full
|
|
5
|
-
# Standard catalog and the ordinary injections open. This is the A/B variant of
|
|
6
|
-
# `liangshen`: the phase-1 surface matches the official "exact RL prompt and
|
|
7
|
-
# schemas" snapshot byte-for-byte on the model-visible wire shape, at the cost
|
|
8
|
-
# of keeping the persistent shell for the whole session. Unlike the builtin
|
|
9
|
-
# Minimal preset, the phase-1 editor inherits the host file sandbox instead of
|
|
10
|
-
# mounting a bare local filesystem (see the filesystem section below).
|
|
11
|
-
#
|
|
12
|
-
# Adapted from the builtin `minimal` and `standard` presets.
|
|
13
|
-
#
|
|
14
|
-
# This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
|
|
15
|
-
# standing scope; every session naming it joins by scope parentage, so the
|
|
16
|
-
# tools and prompt sections registered here cover each joined agent while a
|
|
17
|
-
# session's own state stays keyed per Session/Agent inside the plugins. The
|
|
18
|
-
# host composition (`base.cordis.yml` + `web.cordis.yml`) keeps everything a
|
|
19
|
-
# preset must not own: the registries themselves, the sandbox and approval
|
|
20
|
-
# stack, persistence, and the model route.
|
|
21
|
-
#
|
|
22
|
-
# A service row here MUST sit inside a group carrying an `isolate` realm.
|
|
23
|
-
# Without one it publishes into the root realm, where it is process-global —
|
|
24
|
-
# another preset publishing the same name collides, and a host reader would
|
|
25
|
-
# resolve one preset's instance for every session; `dsh-agent-presets` rejects
|
|
26
|
-
# that at mount. `true` means an entry-local realm: this standing mount's own
|
|
27
|
-
# private instance, apart from every other preset's. (A shared label does NOT
|
|
28
|
-
# pool instances — `provide()` throws on the second registration under the
|
|
29
|
-
# same realm symbol; labels join REALMS, and are not what this file needs.)
|
|
30
|
-
|
|
31
|
-
# ── identity ────────────────────────────────────────────────────────────────
|
|
32
|
-
|
|
33
|
-
# Phase 1 shows only this one-line persona: `tool-bootstrap` filters the
|
|
34
|
-
# assembled sections down to `persona` during phase 1 and restores every
|
|
35
|
-
# section after promotion, so plan-mode's `plan:policy` takes effect instead
|
|
36
|
-
# of being permanently shadowed by a `complete` persona.
|
|
37
|
-
- id: persona
|
|
38
|
-
name: '@deepseek-ai/dsh-persona'
|
|
39
|
-
config:
|
|
40
|
-
text: You are a helpful software engineer assistant.
|
|
41
|
-
|
|
42
|
-
# Two-phase input bootstrap with the exact Minimal phase-1 tools. Before the
|
|
43
|
-
# first durable tool/call event the model sees only persistent `bash` plus
|
|
44
|
-
# `str_replace_editor`, only the `persona` prompt section, no runtime
|
|
45
|
-
# contexts, and only direct user messages. `anchorGate` holds the promotion
|
|
46
|
-
# open until the first reasoning block is minimal-like (four-step fallback);
|
|
47
|
-
# `promoteAfterFirstResponse` avoids a permanent two-tool session after a
|
|
48
|
-
# tool-less first response, and releases an anchor-gated session once its
|
|
49
|
-
# first turn ends (`turn/end`). After promotion the catalog is presented as
|
|
50
|
-
# Code Mode (PTC): a single `run_code` tool on the wire, switched at the step
|
|
51
|
-
# boundary; workspace instructions and the skill catalog are deferred one
|
|
52
|
-
# step after promotion. This preset shares the main preset's
|
|
53
|
-
# `tool-bootstrap.mjs` implementation; only this config differs.
|
|
54
|
-
- id: tool-bootstrap
|
|
55
|
-
name: ./tool-bootstrap.mjs
|
|
56
|
-
config:
|
|
57
|
-
shellTools: [bash]
|
|
58
|
-
commonTools: [str_replace_editor]
|
|
59
|
-
messageSources: [user]
|
|
60
|
-
anchorGate: true
|
|
61
|
-
maxBootstrapSteps: 4
|
|
62
|
-
promoteAfterFirstResponse: true
|
|
63
|
-
deferredSources: [agent-instructions, skill-catalog]
|
|
64
|
-
deferredGraceSteps: 1
|
|
65
|
-
promotedPresentation: code
|
|
66
|
-
|
|
67
|
-
# Workspace instructions are quarantined by `tool-bootstrap` during phase 1
|
|
68
|
-
# and deferred one step after promotion, then stay current.
|
|
69
|
-
- id: agent-instructions
|
|
70
|
-
name: '@deepseek-ai/dsh-agent-instructions'
|
|
71
|
-
config:
|
|
72
|
-
maxBytes: 65536
|
|
73
|
-
|
|
74
|
-
# ── minimal phase-1 shell ───────────────────────────────────────────────────
|
|
75
|
-
|
|
76
|
-
# The PTY registry is an agent-owned service, so it lives in an entry-local
|
|
77
|
-
# realm. The backend still consumes the host sandbox policy and subprocess
|
|
78
|
-
# implementation, while the tool registers into this agent's scoped catalog.
|
|
79
|
-
# This persistent `bash` replaces the Standard ephemeral shell for the WHOLE
|
|
80
|
-
# session (both tools register the name `bash`), which is the exact-Minimal
|
|
81
|
-
# tradeoff this experimental preset evaluates.
|
|
82
|
-
- id: persistent-shell
|
|
83
|
-
name: cordis:group
|
|
84
|
-
group: true
|
|
85
|
-
isolate:
|
|
86
|
-
terminals: true
|
|
87
|
-
config:
|
|
88
|
-
- id: pty
|
|
89
|
-
name: '@deepseek-ai/dsh-terminal'
|
|
90
|
-
|
|
91
|
-
- id: terminal-bash
|
|
92
|
-
name: '@deepseek-ai/dsh-terminal-bash'
|
|
93
|
-
config:
|
|
94
|
-
timeoutMs: 300000
|
|
95
|
-
|
|
96
|
-
- id: persistent-bash
|
|
97
|
-
name: '@deepseek-ai/dsh-tool-bash-persistent'
|
|
98
|
-
config:
|
|
99
|
-
timeoutMs: 300000
|
|
100
|
-
description: |-
|
|
101
|
-
Run commands in a bash shell
|
|
102
|
-
* When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.
|
|
103
|
-
* You don't have access to the internet via this tool.
|
|
104
|
-
* You do have access to a mirror of common linux and python packages via apt and pip.
|
|
105
|
-
* State is persistent across command calls and discussions with the user.
|
|
106
|
-
* To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p /path/to/the/file'.
|
|
107
|
-
* Please avoid commands that may produce a very large amount of output.
|
|
108
|
-
* Please run long lived commands in the background, e.g. 'sleep 10 &' or start a server in the background.
|
|
109
|
-
|
|
110
|
-
# ── minimal phase-1 filesystem ──────────────────────────────────────────────
|
|
111
|
-
|
|
112
|
-
# Phase-1 editor as a direct top-level row: it reuses the host's sandboxed
|
|
113
|
-
# `ctx.fs`, not a bare local filesystem. No `dsh-fs-local` realm is mounted, so
|
|
114
|
-
# the phase-1 editor inherits the host file sandbox exactly like every
|
|
115
|
-
# Standard file tool, and the model-facing schema stays the builtin Minimal
|
|
116
|
-
# `str_replace_editor`.
|
|
117
|
-
- id: str-replace-editor
|
|
118
|
-
name: '@deepseek-ai/dsh-tool-str-replace-editor'
|
|
119
|
-
config:
|
|
120
|
-
maxOutputChars: 16000
|
|
121
|
-
|
|
122
|
-
# ── standard filesystem tools ───────────────────────────────────────────────
|
|
123
|
-
|
|
124
|
-
# Both register into the host `tools` registry and provide nothing, so
|
|
125
|
-
# they need no realm. The `fs` service and its policy stay in the host.
|
|
126
|
-
- id: tool-fs
|
|
127
|
-
name: '@deepseek-ai/dsh-tool-fs'
|
|
128
|
-
|
|
129
|
-
- id: tool-fs-search
|
|
130
|
-
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
131
|
-
config:
|
|
132
|
-
sampleOverCapGlobResults: false
|
|
133
|
-
|
|
134
|
-
# ── background jobs ────────────────────────────────────────────────────────
|
|
135
|
-
|
|
136
|
-
# Only the model-facing controls. The task REGISTRY stays on the host plane:
|
|
137
|
-
# its producers sit outside any realm this file could put it in, and the
|
|
138
|
-
# registry is keyed by owning agent anyway. With the persistent shell, long
|
|
139
|
-
# commands run through `&`; these controls still expose whatever the host
|
|
140
|
-
# registry tracks.
|
|
141
|
-
- id: tool-jobs
|
|
142
|
-
name: '@deepseek-ai/dsh-tool-jobs'
|
|
143
|
-
|
|
144
|
-
# ── skills ──────────────────────────────────────────────────────────────────
|
|
145
|
-
|
|
146
|
-
# The skill REGISTRY lives in the host composition and is layered per scope:
|
|
147
|
-
# these rows register into THIS preset's layer of it, so they need no realm.
|
|
148
|
-
# `skill-filesystem` contributes local-root discovery for agents on this preset, and
|
|
149
|
-
# `tool-skill` gives them the catalog and loader; the merged catalog also
|
|
150
|
-
# carries whatever the deployment registered globally (repository plugins).
|
|
151
|
-
# The `skill-catalog` pre-step message is quarantined by `tool-bootstrap`
|
|
152
|
-
# during phase 1 and deferred one step after promotion, then stays current.
|
|
153
|
-
- id: skill-filesystem
|
|
154
|
-
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
155
|
-
|
|
156
|
-
- id: tool-skill
|
|
157
|
-
name: '@deepseek-ai/dsh-tool-skill'
|
|
158
|
-
|
|
159
|
-
# ── goals ───────────────────────────────────────────────────────────────────
|
|
160
|
-
|
|
161
|
-
# Only the model-facing tool. The goal SERVICE, its session driver, and the
|
|
162
|
-
# `/goal` command stay on the host plane: the Gateway serves the goal domain as
|
|
163
|
-
# Remote endpoints whose receiver comes from a generated descriptor, so it
|
|
164
|
-
# resolves `goals` on the host and an entry-local realm here would hide it. The
|
|
165
|
-
# registry is keyed by session anyway, so one host instance serves every
|
|
166
|
-
# session. What a preset chooses is whether its agent can call the goal tool.
|
|
167
|
-
- id: tool-goal
|
|
168
|
-
name: '@deepseek-ai/dsh-tool-goal'
|
|
169
|
-
|
|
170
|
-
# ── plan mode ───────────────────────────────────────────────────────────────
|
|
171
|
-
|
|
172
|
-
# Plan state is per-agent by nature, so an entry-local realm is not a
|
|
173
|
-
# workaround here — it is the correct lifetime.
|
|
174
|
-
- id: planning
|
|
175
|
-
name: cordis:group
|
|
176
|
-
group: true
|
|
177
|
-
isolate:
|
|
178
|
-
planMode: true
|
|
179
|
-
config:
|
|
180
|
-
- id: plan-mode
|
|
181
|
-
name: '@deepseek-ai/dsh-plan-mode'
|
|
182
|
-
config:
|
|
183
|
-
section: |
|
|
184
|
-
You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
|
|
185
|
-
|
|
186
|
-
Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
|
|
187
|
-
|
|
188
|
-
The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
|
|
189
|
-
|
|
190
|
-
Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
|
|
191
|
-
|
|
192
|
-
Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
|
|
193
|
-
|
|
194
|
-
When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
|
|
195
|
-
|
|
196
|
-
# ── compaction ──────────────────────────────────────────────────────────────
|
|
197
|
-
|
|
198
|
-
# `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
|
|
199
|
-
# share this realm rather than sit outside it.
|
|
200
|
-
#
|
|
201
|
-
# `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
|
|
202
|
-
# plane, and the rows here resolve that one instance. It takes no configuration,
|
|
203
|
-
# keys every fold by Session, and owns the context-meter projection units the
|
|
204
|
-
# browser reads for every session — behind a realm those units would come and go
|
|
205
|
-
# with whichever presets happen to be mounted. What a preset chooses is whether
|
|
206
|
-
# its agent compacts at all, which is `compaction-basic` below.
|
|
207
|
-
- id: compaction
|
|
208
|
-
name: cordis:group
|
|
209
|
-
group: true
|
|
210
|
-
isolate:
|
|
211
|
-
compaction: true
|
|
212
|
-
toolResultPruner: true
|
|
213
|
-
config:
|
|
214
|
-
- id: compaction-basic
|
|
215
|
-
name: '@deepseek-ai/dsh-compaction-basic'
|
|
216
|
-
|
|
217
|
-
- id: command-compact
|
|
218
|
-
name: '@deepseek-ai/dsh-command-compact'
|
|
219
|
-
|
|
220
|
-
- id: tool-result-pruner
|
|
221
|
-
name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
|
222
|
-
config:
|
|
223
|
-
thresholdChars: 8192
|
|
224
|
-
headChars: 4096
|
|
225
|
-
tailChars: 1024
|
|
226
|
-
|
|
227
|
-
# ── delegation and workflows ────────────────────────────────────────────────
|
|
228
|
-
|
|
229
|
-
# The `subagents` registry and its spawn/fork backends live in the HOST
|
|
230
|
-
# composition: the registry is a process singleton whose cross-session queries
|
|
231
|
-
# the api-proxy serves to the browser, and a provider name may only be
|
|
232
|
-
# registered once. This preset contributes the delegation TOOLS, which resolve
|
|
233
|
-
# that host registry.
|
|
234
|
-
#
|
|
235
|
-
# `workflows` is different — nothing outside an agent reads it — so every row
|
|
236
|
-
# that reaches it shares one entry-local realm here, and a consumer left
|
|
237
|
-
# outside would resolve a host registry this preset does not populate.
|
|
238
|
-
#
|
|
239
|
-
# `tool-subagent-report` is host-plane for the same reason as the registry,
|
|
240
|
-
# not because a preset may not want it: it registers a CONTINUABLE SETUP on
|
|
241
|
-
# that singleton rather than a tool this agent calls, and the setup list is
|
|
242
|
-
# not scope-aware — one copy per mounted preset means every child gets
|
|
243
|
-
# `report` registered once per live session, which throws on the second.
|
|
244
|
-
- id: delegation
|
|
245
|
-
name: cordis:group
|
|
246
|
-
group: true
|
|
247
|
-
isolate:
|
|
248
|
-
workflowEngine: true
|
|
249
|
-
config:
|
|
250
|
-
- id: tool-subagent-control
|
|
251
|
-
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
252
|
-
|
|
253
|
-
- id: tool-subagent-list-agents
|
|
254
|
-
name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
|
|
255
|
-
|
|
256
|
-
- id: tool-subagent
|
|
257
|
-
name: '@deepseek-ai/dsh-tool-subagent'
|
|
258
|
-
config:
|
|
259
|
-
provider: spawn
|
|
260
|
-
toolName: subagent
|
|
261
|
-
backgroundMode: continuable
|
|
262
|
-
|
|
263
|
-
- id: tool-subagent-fork
|
|
264
|
-
name: '@deepseek-ai/dsh-tool-subagent'
|
|
265
|
-
config:
|
|
266
|
-
provider: fork
|
|
267
|
-
toolName: subagent_fork
|
|
268
|
-
backgroundMode: continuable
|
|
269
|
-
|
|
270
|
-
# Product providers are host-plane singletons. Copy this preset, then
|
|
271
|
-
# remove `disabled` from either ordinary tool row to expose that product
|
|
272
|
-
# only to agents composed from the copy.
|
|
273
|
-
- id: tool-subagent-codex
|
|
274
|
-
name: '@deepseek-ai/dsh-tool-subagent'
|
|
275
|
-
disabled: true
|
|
276
|
-
config:
|
|
277
|
-
provider: codex
|
|
278
|
-
toolName: subagent_codex
|
|
279
|
-
enableRunInBackground: false
|
|
280
|
-
maxDepth: provider-managed
|
|
281
|
-
|
|
282
|
-
- id: tool-subagent-claude-code
|
|
283
|
-
name: '@deepseek-ai/dsh-tool-subagent'
|
|
284
|
-
disabled: true
|
|
285
|
-
config:
|
|
286
|
-
provider: claude-code
|
|
287
|
-
toolName: subagent_claude_code
|
|
288
|
-
enableRunInBackground: false
|
|
289
|
-
maxDepth: provider-managed
|
|
290
|
-
|
|
291
|
-
- id: workflow-worker-thread
|
|
292
|
-
name: '@deepseek-ai/dsh-workflow-worker-thread'
|
|
293
|
-
config:
|
|
294
|
-
provider: spawn
|
|
295
|
-
|
|
296
|
-
- id: tool-workflow
|
|
297
|
-
name: '@deepseek-ai/dsh-tool-workflow'
|
|
298
|
-
|
|
299
|
-
- id: tool-ralph
|
|
300
|
-
name: '@deepseek-ai/dsh-tool-ralph'
|
|
301
|
-
config:
|
|
302
|
-
subagentProvider: spawn
|
|
303
|
-
maxRounds: 64
|
|
304
|
-
|
|
305
|
-
# ── remaining model-facing rows ─────────────────────────────────────────────
|
|
306
|
-
|
|
307
|
-
- id: tool-ask-user
|
|
308
|
-
name: '@deepseek-ai/dsh-tool-ask-user'
|
|
309
|
-
|
|
310
|
-
- id: tool-todo
|
|
311
|
-
name: '@deepseek-ai/dsh-tool-todo'
|
|
312
|
-
config:
|
|
313
|
-
allowParallelInProgress: true
|
|
314
|
-
|
|
315
|
-
# The `web` service and its search provider stay in the host composition; only
|
|
316
|
-
# the model-facing tool is per-session.
|
|
317
|
-
- id: tool-web
|
|
318
|
-
name: '@deepseek-ai/dsh-tool-web'
|
|
319
|
-
config:
|
|
320
|
-
fetch: false
|
|
321
|
-
searchTimeoutMs: 60000
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `liangshen-exact` shares its bootstrap implementation with the main
|
|
3
|
-
* `liangshen` preset (与主 preset 共用实现,仅 `tool-bootstrap` config 不同):
|
|
4
|
-
* the only difference between the two presets is this row's configuration in
|
|
5
|
-
* `agent.cordis.yml` (`shellTools`/`commonTools`), so the plugin logic below
|
|
6
|
-
* is re-exported rather than copied. Keep it that way to prevent the two
|
|
7
|
-
* copies from drifting.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export { name, apply, classifyReasoning, hasAnchoredReasoning } from '../liangshen/tool-bootstrap.mjs'
|