@linxin666/dsh-liangshen 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # node scripts/verify-docs.mjs --write <dir>
5
- README.md: faa89c7ebfcda993030419a64a1a0ea306bf2ef0
6
- README.zh.md: b28751b649dff1d0a72c77f21e927671350e5661
5
+ README.md: ca2af81f8226b37d66dc3398fa5945d5383fbaba
6
+ README.zh.md: 1f3aba838fe2af1296e400fe6aa6bfa66141738a
package/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  English | [中文](README.zh.md)
4
4
 
5
- Ships the "Anchored Standard" preset family as a one-command plugin of the dsh-web-ui family: on host startup it syncs the bundled presets into `~/.dsh/.agent-presets`, so new sessions can pick "梁神模式" or the experimental "梁神模式-精确实验" from the preset picker. The first model request sees only a two-tool surface, only the one-line persona prompt section, no runtime contexts, and no injected instructions; the full catalog, all prompt sections, and the ordinary injections open after the anchor is established. Built entirely on the official NPM SDK — no dsh source changes.
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 platform shell plus `read`, keeps only the `persona` prompt section, empties runtime contexts, and passes only the user's own messages;
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 `deployment: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
 
@@ -24,16 +24,16 @@ The preset ships with extra safeguards on top of the reference mechanism, all co
24
24
  - `promotedPresentation: code` — after promotion the wire is Code Mode (PTC): one `run_code` tool with the full registry available through the generated SDK, switched at the step boundary so the current step's native calls are never interrupted;
25
25
  - `deferredSources` + `deferredGraceSteps` — workspace instructions and the skill catalog wait one extra step after promotion, so the tool-catalog switch and the injection shock do not land in the same step.
26
26
 
27
- Plan mode is supported: phase 1 filters the assembled prompt sections down to the one-line `persona`, and promotion restores all sections, so the plan-mode `plan:policy` section takes effect for every step after promotion.
27
+ Plan mode is supported: phase 1 filters the assembled prompt sections down to the one-line `deployment:persona`, and promotion restores all sections and appends the session's working directory to the persona, so the agent knows its workspace and the plan-mode `plan:policy` section takes effect for every step after promotion.
28
28
 
29
29
  ## Install
30
30
 
31
31
  ```sh
32
32
  # Option 1: family bundle (recommended)
33
- dsh plugin --profile web add @linxin666/dsh-web-ui-all@0.1.12
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@0.1.12
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/read` (macOS/Linux) or `pwsh/read` (Windows); `liangshen-exact` should carry `bash/str_replace_editor`;
58
- - 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
- - 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
- - In `liangshen-exact`, phase-1 editor writes still obey the host file sandbox policy — there is no bare local-filesystem bypass;
49
+ - The first header should carry only `bash/str_replace_editor` (the persistent shell plus the sandboxed editor);
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 `deployment:persona` prompt section;
51
+ - After the first tool call, the next changed header should carry exactly `run_code` (PTC); the runtime snapshot and all prompt sections arrive with that step (including plan mode's `plan:policy`, and the persona now ends with the selected workspace path), and the workspace instructions and skill catalog arrive one step later;
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:
@@ -71,9 +63,10 @@ node tools/analyze-session.mjs ~/.dsh/sessions/<workspace>/<session>/session.jso
71
63
  - A first model response that calls no tool promotes once it has responded; an anchor-gated session also releases when its first turn ends (`turn/end`). The release is decided during prompt assembly, so the new user turn already gets the promoted PTC catalog and its messages are not stripped;
72
64
  - After the first tool call, promotion waits for the first minimal-like reasoning block or the `maxBootstrapSteps` fallback, whichever comes first;
73
65
  - A tool call that fails still counts toward promotion as long as `tool/call` was persisted;
74
- - Phase 1 keeps only the `persona` prompt section; promotion restores every assembled section, so plan mode's `plan:policy` is enforced after phase 1;
66
+ - Phase 1 keeps only the `deployment:persona` prompt section; promotion restores every assembled section and appends the session's working directory (`Your working directory is <cwd>.`) to the persona, so the agent works in the selected workspace and 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
- - `liangshen-exact` file tools inherit the host file sandbox (no bare `dsh-fs-local` filesystem);
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 Standard preset, `presets/liangshen-exact/agent.cordis.yml` derives from the builtin Minimal and Standard presets, and `tool-bootstrap.mjs` comes from xiaobright/dsh-anchored-standard — all MIT, with copyright and license notices kept in each preset's `NOTICE`. `presets/liangshen-exact/tool-bootstrap.mjs` is a thin re-export of `presets/liangshen/tool-bootstrap.mjs`, so the two presets share one implementation.
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 家族做成 DSH 全家桶里的一键安装插件:Host 启动时把内置 presets 同步到 `~/.dsh/.agent-presets`,新建会话即可在预设选择器中选择「梁神模式」或实验性的「梁神模式-精确实验」。首轮模型请求只看到双工具表面与一行 persona,没有运行时上下文和指令注入;锚定建立后开放完整工具目录、全部 prompt section 与常规注入。全部通过官方 NPM SDK 实现,不修改 DSH 源码。
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. 首轮模型请求只暴露平台 shell 与 `read`,只保留 `persona` 一个 prompt section,清空运行时上下文,并且只放行用户自己的消息;
11
+ 1. 首轮模型请求只暴露官方 Minimal 精确双工具(持久 `bash` 与 `str_replace_editor`),只保留 `deployment: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
 
@@ -24,16 +24,16 @@ preset 在参考机制之上内置了额外保护,全部在 `agent.cordis.yml`
24
24
  - `promotedPresentation: code`:晋升后 wire 为 Code Mode(PTC)——一个 `run_code` 工具、完整注册表通过生成 SDK 调用;切换发生在 step 边界,不会打断当前步的原生工具调用;
25
25
  - `deferredSources` + `deferredGraceSteps`:workspace 指令与 skill 目录在晋升后再等一步注入,工具目录切换和注入冲击不同时落地。
26
26
 
27
- 已支持 plan mode:phase 1 会把 prompt sections 过滤为仅剩一行 `persona`,晋升后恢复全部 sections,因此 plan-mode 的 `plan:policy` 在晋升后的每一步都生效。
27
+ 已支持 plan mode:phase 1 会把 prompt sections 过滤为仅剩一行 `deployment:persona`,晋升后恢复全部 sections 并在 persona 末尾追加所选工作区路径,因此 Agent 明确自己的工作目录,plan-mode 的 `plan:policy` 也在晋升后的每一步都生效。
28
28
 
29
29
  ## 安装
30
30
 
31
31
  ```sh
32
32
  # 方式一:全家桶(推荐)
33
- dsh plugin --profile web add @linxin666/dsh-web-ui-all@0.1.12
33
+ dsh plugin --profile web add @linxin666/dsh-web-ui-all
34
34
 
35
35
  # 方式二:单独安装
36
- dsh plugin --profile web add @linxin666/dsh-liangshen@0.1.12
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/read`(macOS/Linux)或 `pwsh/read`(Windows);`liangshen-exact` 应为 `bash/str_replace_editor`;
58
- - 第一轮应只包含用户自己的消息:没有 workspace 指令 baseline、没有运行时快照、没有 skill 目录消息,并且只有 `persona` 一个 prompt section;
59
- - 首次工具调用后,下一份变更 header 应恰好为 `run_code`(PTC);运行时快照与全部 prompt section(含 plan mode 的 `plan:policy`)随该步出现,workspace 指令与 skill 目录再晚一步出现;
60
- - `liangshen-exact` 的 phase 1 编辑器写入仍受宿主文件沙箱策略约束,不存在裸本地文件系统绕过;
49
+ - 第一份 header 应只有 `bash/str_replace_editor`(持久 shell + 沙箱化编辑器);
50
+ - 第一轮应只包含用户自己的消息:没有 workspace 指令 baseline、没有运行时快照、没有 skill 目录消息,并且只有 `deployment:persona` 一个 prompt section;
51
+ - 首次工具调用后,下一份变更 header 应恰好为 `run_code`(PTC);运行时快照与全部 prompt section 随该步出现(含 plan mode 的 `plan:policy`,且 persona 末尾带有所选工作区路径),workspace 指令与 skill 目录再晚一步出现;
52
+ - phase 1 编辑器写入受宿主文件沙箱策略约束,不存在裸本地文件系统绕过;
61
53
  - 此后的请求保持 `run_code`。
62
54
 
63
55
  不读原始 reasoning 也能测量轨迹漂移:
@@ -71,9 +63,10 @@ node tools/analyze-session.mjs <导出的 session.jsonl>
71
63
  - 第一次模型响应如果没有调用工具,在响应后即自动晋升;锚定门控中的会话也会在首轮结束(`turn/end`)时释放。释放判定发生在 prompt assemble 阶段,所以新用户轮次一开始就拿到晋升后的 PTC 目录,其消息也不会再被剥离;
72
64
  - 首次工具调用后,晋升等待首个 minimal-like reasoning 块或 `maxBootstrapSteps` 兜底,先到者生效;
73
65
  - 工具执行即使失败,只要 `tool/call` 已持久化,仍计入晋升条件;
74
- - phase 1 只保留 `persona` prompt section;晋升后恢复全部 assembled sections,因此 plan mode 的 `plan:policy` 在晋升后生效;
66
+ - phase 1 只保留 `deployment:persona` prompt section;晋升后恢复全部 assembled sections 并在 persona 末尾追加所选工作区路径(`Your working directory is <cwd>.`),因此 Agent 会在选中的工作区工作,plan mode 的 `plan:policy` 也在晋升后生效;
75
67
  - workspace 指令、skill 目录与运行时快照在首轮不注入;快照随 PTC 目录出现,前两者再晚一步出现;
76
- - `liangshen-exact` 的文件工具继承宿主文件沙箱(不挂载裸 `dsh-fs-local`);
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 Standard preset 修改,`presets/liangshen-exact/agent.cordis.yml` 基于内置 Minimal 与 Standard preset 修改,`tool-bootstrap.mjs` 来自 xiaobright/dsh-anchored-standard,均为 MIT,版权与许可声明见各 preset 的 `NOTICE`。`presets/liangshen-exact/tool-bootstrap.mjs` 是对 `presets/liangshen/tool-bootstrap.mjs` 的薄 re-export,两个 preset 共用同一份实现。
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
@@ -1,8 +1,133 @@
1
1
  import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync } from "node:fs";
2
- import { homedir } from "node:os";
3
- import { basename, dirname, join, relative } from "node:path";
2
+ import { basename, dirname, isAbsolute, join, relative } from "node:path";
4
3
  import { fileURLToPath } from "node:url";
5
4
  import z from "schemastery";
5
+ import { homedir } from "node:os";
6
+ //#region src/dsh-home.ts
7
+ /**
8
+ * DSH_HOME resolution shared by the plugin family's Host halves: the
9
+ * environment override wins, the platform home fallback follows. Mirrors
10
+ * what dsh-pet and dsh-liangshen each used to implement locally.
11
+ */
12
+ /** Expand a leading ~ (or ~user) in a path, platform-style. */
13
+ function expandHome(path, home = homedir()) {
14
+ if (path === "~") return home;
15
+ if (path.startsWith("~/") || path.startsWith("~\\")) return join(home, path.slice(2));
16
+ return path;
17
+ }
18
+ /**
19
+ * Resolve the DSH home directory.
20
+ * @param env - process environment to read DSH_HOME from.
21
+ * @param home - platform home directory fallback (test seam).
22
+ * @returns the absolute DSH home path.
23
+ */
24
+ function resolveDshHome(env = process.env, home = homedir()) {
25
+ const raw = env.DSH_HOME;
26
+ if (raw !== void 0 && raw.trim() !== "") {
27
+ const expanded = expandHome(raw.trim(), home);
28
+ return isAbsolute(expanded) ? expanded : join(process.cwd(), expanded);
29
+ }
30
+ return join(home, ".dsh");
31
+ }
32
+ /** Resolve the DSH home directory from the live environment. */
33
+ function dshHome() {
34
+ return resolveDshHome();
35
+ }
36
+ //#endregion
37
+ //#region src/schema.ts
38
+ /**
39
+ * Structural validation for a bundled `agent.cordis.yml`.
40
+ *
41
+ * Deliberately dependency-free: it parses only the flat row metadata the sync
42
+ * and the dsh agent-presets loader rely on. Every top-level row is written as
43
+ * `- id: <id>` at column zero, with the `name`/`group`/`disabled` keys at two
44
+ * spaces of indentation. Nested `config:` and `isolate:` bodies are opaque to
45
+ * this validator — the dsh loader checks their semantics.
46
+ *
47
+ * Returns the list of problems found; an empty array means the document is
48
+ * structurally valid.
49
+ */
50
+ /** A top-level row opener: `- id: <id>` (id may be blank for diagnostics). */
51
+ const ROW_RE = /^-\s+id:\s*(.*)$/;
52
+ /** Any top-level list item, for ids missing from a row opener. */
53
+ const ITEM_RE = /^-\s/;
54
+ /** A two-space-indented flat metadata key: ` name: <value>`. */
55
+ const META_RE = /^ {2}([A-Za-z][A-Za-z0-9_-]*):\s*(.*)$/;
56
+ /** The only `name` forms the dsh agent-presets loader mounts from a row. */
57
+ const NAME_PREFIX_RE = /^(\.\/|@|cordis:)/;
58
+ /** Strip one pair of surrounding single or double quotes from a scalar. */
59
+ function unquote(value) {
60
+ if (value.length >= 2) {
61
+ const first = value[0];
62
+ if ((first === "'" || first === "\"") && value.endsWith(first)) return value.slice(1, -1);
63
+ }
64
+ return value;
65
+ }
66
+ /**
67
+ * Validate the structural contract of an `agent.cordis.yml` document.
68
+ * @param text - the raw YAML document text.
69
+ * @returns a list of human-readable problems; empty means valid.
70
+ */
71
+ function validateAgentCordis(text) {
72
+ const errors = [];
73
+ const normalized = text.replace(/\r\n/g, "\n");
74
+ if (normalized.trim() === "") return ["document is empty"];
75
+ const seenIds = /* @__PURE__ */ new Set();
76
+ const current = {
77
+ id: null,
78
+ name: null,
79
+ group: null
80
+ };
81
+ const closeRow = () => {
82
+ if (current.id === null) return;
83
+ if (current.name === null) errors.push(`row "${current.id}": missing "name" key`);
84
+ else if (!NAME_PREFIX_RE.test(current.name)) errors.push(`row "${current.id}": name "${current.name}" must start with "./", "@" or "cordis:"`);
85
+ if (current.group === "true" && current.name !== "cordis:group") errors.push(`row "${current.id}": "group: true" requires name "cordis:group"`);
86
+ current.name = null;
87
+ current.group = null;
88
+ current.id = null;
89
+ };
90
+ const lines = normalized.split("\n");
91
+ for (let index = 0; index < lines.length; index += 1) {
92
+ const lineNo = index + 1;
93
+ const line = lines[index];
94
+ const trimmed = line.trim();
95
+ if (trimmed === "" || trimmed.startsWith("#")) continue;
96
+ const row = ROW_RE.exec(line);
97
+ if (row !== null) {
98
+ closeRow();
99
+ const id = row[1].trim();
100
+ if (id === "") {
101
+ errors.push(`line ${lineNo}: empty row id`);
102
+ current.id = null;
103
+ } else {
104
+ if (seenIds.has(id)) errors.push(`line ${lineNo}: duplicate row id "${id}"`);
105
+ seenIds.add(id);
106
+ current.id = id;
107
+ }
108
+ current.name = null;
109
+ current.group = null;
110
+ continue;
111
+ }
112
+ if (current.id === null) {
113
+ if (ITEM_RE.test(line)) errors.push(`line ${lineNo}: list item does not declare an "id:"`);
114
+ else if (/^\S/.test(line)) errors.push(`line ${lineNo}: content outside a "- id:" row`);
115
+ continue;
116
+ }
117
+ const meta = META_RE.exec(line);
118
+ if (meta !== null) {
119
+ const value = unquote(meta[2].trim());
120
+ if (meta[1] === "name") current.name = value;
121
+ else if (meta[1] === "group") current.group = value;
122
+ continue;
123
+ }
124
+ if (/^ {2}/.test(line)) continue;
125
+ errors.push(`line ${lineNo}: unexpected content in row "${current.id}"`);
126
+ }
127
+ closeRow();
128
+ return errors;
129
+ }
130
+ //#endregion
6
131
  //#region src/sync.ts
7
132
  /**
8
133
  * Sync every preset directory under `sourceRoot` into `targetRoot` — the
@@ -14,7 +139,19 @@ import z from "schemastery";
14
139
  * tree is copied and any target files the source does not contain are removed.
15
140
  * Directories the plugin does not own (other presets the user authored) are
16
141
  * never touched.
142
+ *
143
+ * After a preset is synced its `agent.cordis.yml` is validated against the
144
+ * structural preset schema; a validation failure is reported through the
145
+ * run's `failed` entries instead of being a warn-only side effect, so callers
146
+ * can observe (and surface) a broken preset rather than silently shipping it.
17
147
  */
148
+ /**
149
+ * Clock/coarse-grain tolerance for the mtime fast path. When a source and a
150
+ * target file share a size and a near-identical mtime we still fall through to
151
+ * a byte comparison; a mtime gap beyond this simply proves the pair cannot be
152
+ * byte-identical, so we skip the read.
153
+ */
154
+ const MTIME_TOLERANCE_MS = 1e3;
18
155
  function filesUnder(root) {
19
156
  const out = [];
20
157
  const walk = (dir) => {
@@ -27,8 +164,17 @@ function filesUnder(root) {
27
164
  walk(root);
28
165
  return out;
29
166
  }
30
- /** Preset files are small; identity means identical bytes, not just size/mtime. */
167
+ /**
168
+ * File identity is bytes. Size and mtime are only a fast negative check: a
169
+ * size mismatch or a mtime gap beyond the tolerance proves the pair cannot be
170
+ * byte-identical without reading both, but an equal size and close mtime still
171
+ * fall through to a byte comparison so content differences are never missed.
172
+ */
31
173
  function sameFile(a, b) {
174
+ const sourceStat = statSync(a);
175
+ const targetStat = statSync(b);
176
+ if (sourceStat.size !== targetStat.size) return false;
177
+ if (Math.abs(sourceStat.mtimeMs - targetStat.mtimeMs) > MTIME_TOLERANCE_MS) return false;
32
178
  return readFileSync(a).equals(readFileSync(b));
33
179
  }
34
180
  /**
@@ -53,6 +199,12 @@ function pruneExtras(root, keep) {
53
199
  } else dir = void 0;
54
200
  }
55
201
  }
202
+ /** Validate the synced preset's `agent.cordis.yml` artifact on disk. */
203
+ function validatePresetAgentFile(presetDir) {
204
+ const agent = join(presetDir, "agent.cordis.yml");
205
+ if (!existsSync(agent)) return ["agent.cordis.yml is missing from the preset tree"];
206
+ return validateAgentCordis(readFileSync(agent, "utf8"));
207
+ }
56
208
  /** Copy `sourceRoot/<id>` into `targetRoot/<id>`, idempotently. */
57
209
  function syncOnePreset(sourceDir, targetDir) {
58
210
  const sourceFiles = filesUnder(sourceDir);
@@ -93,24 +245,50 @@ function syncOnePreset(sourceDir, targetDir) {
93
245
  return "synced";
94
246
  }
95
247
  /**
96
- * Sync every preset under `sourceRoot` into `targetRoot`.
248
+ * Sync every preset under `sourceRoot` into `targetRoot`, then remove
249
+ * target directories named in `retire` that the bundle no longer ships —
250
+ * preset ids the plugin once owned and later dropped. Only those exact ids
251
+ * are removed; every other target directory is left untouched.
252
+ *
253
+ * Each synced (or already-current) preset is validated against the structural
254
+ * `agent.cordis.yml` schema; a validation failure lands in `failed` so the
255
+ * caller can surface a broken preset as a first-class result instead of a
256
+ * warn-only log line.
97
257
  * @param sourceRoot - plugin-owned preset tree (bundled in the package).
98
258
  * @param targetRoot - dsh agent-presets discovery root (e.g. <home>/.dsh/.agent-presets).
259
+ * @param retire - previously bundled preset ids to remove when absent from the source.
99
260
  */
100
- function syncPresetTrees(sourceRoot, targetRoot) {
261
+ function syncPresetTrees(sourceRoot, targetRoot, retire = []) {
101
262
  const result = {
102
263
  synced: [],
103
264
  current: [],
104
- failed: []
265
+ failed: [],
266
+ retired: []
105
267
  };
106
- if (!existsSync(sourceRoot)) return result;
107
268
  mkdirSync(targetRoot, { recursive: true });
108
- for (const entry of readdirSync(sourceRoot)) {
269
+ if (existsSync(sourceRoot)) for (const entry of readdirSync(sourceRoot)) {
109
270
  const source = join(sourceRoot, entry);
110
271
  if (!statSync(source).isDirectory()) continue;
111
272
  const id = basename(source);
273
+ const targetDir = join(targetRoot, id);
274
+ let outcome;
112
275
  try {
113
- (syncOnePreset(source, join(targetRoot, id)) === "synced" ? result.synced : result.current).push(id);
276
+ outcome = syncOnePreset(source, targetDir);
277
+ } catch (error) {
278
+ result.failed.push({
279
+ id,
280
+ error: error instanceof Error ? error.message : String(error)
281
+ });
282
+ continue;
283
+ }
284
+ try {
285
+ const problems = validatePresetAgentFile(targetDir);
286
+ if (problems.length > 0) result.failed.push({
287
+ id,
288
+ error: `agent.cordis.yml failed validation: ${problems.join("; ")}`
289
+ });
290
+ else if (outcome === "synced") result.synced.push(id);
291
+ else result.current.push(id);
114
292
  } catch (error) {
115
293
  result.failed.push({
116
294
  id,
@@ -118,6 +296,17 @@ function syncPresetTrees(sourceRoot, targetRoot) {
118
296
  });
119
297
  }
120
298
  }
299
+ for (const id of retire) {
300
+ if (existsSync(join(sourceRoot, id))) continue;
301
+ const stale = join(targetRoot, id);
302
+ if (existsSync(stale) && statSync(stale).isDirectory()) {
303
+ rmSync(stale, {
304
+ recursive: true,
305
+ force: true
306
+ });
307
+ result.retired.push(id);
308
+ }
309
+ }
121
310
  return result;
122
311
  }
123
312
  //#endregion
@@ -132,9 +321,9 @@ function syncPresetTrees(sourceRoot, targetRoot) {
132
321
  * half, no routes, no agent tools — the preset itself provides the tools.
133
322
  *
134
323
  * The preset is the "anchored-standard" idea shipped as a named mode: the
135
- * first model request sees only the platform shell plus `read` (Minimal
136
- * prompt condition), and the full Standard tool catalog opens after the
137
- * session's first durable tool call. Derived from
324
+ * first model request sees only the builtin Minimal preset's exact two tools
325
+ * (persistent `bash` plus `str_replace_editor`), and after the anchor the
326
+ * wire switches to Code Mode (PTC). Derived from
138
327
  * https://github.com/xiaobright/dsh-anchored-standard (MIT).
139
328
  */
140
329
  /** Stable cordis plugin name. */
@@ -150,20 +339,7 @@ const DEFAULT_ANNOUNCE = true;
150
339
  /** Order of the announcement section within the tool-guidance band. */
151
340
  const SECTION_ORDER = 150;
152
341
  /** Model-facing announcement: plugin presence, principle, and limits. */
153
- const LIANGSHEN_GUIDANCE = "本机已安装 dsh-liangshen 插件(梁神模式 agent preset):新建会话的预设选择器中可选「梁神模式」与「梁神模式-精确实验」。原理:两阶段锚定——首轮模型请求仅暴露平台 shell 与 read(精确实验版为持久 bash 与 str_replace_editor),只保留一行 persona,清空运行时上下文并只放行用户的直接消息,锚定 Minimal 推理轨迹;晋升受首块锚定门控(首块包含 we 且无 let me,四步兜底),无工具首轮会在响应后自动晋升,晋升后 wire 切换为 Code Mode(PTC,单一 run_code),workspace 指令与 skill 目录在晋升后再延迟一步注入。preset 文件由插件维护于 ~/.dsh/.agent-presets,升级插件时自动更新;默认预设由用户自行选择。用户提到「梁神模式 / 锚定模式 / anchored standard」时即指本插件,请据此协作。";
154
- /** Expand a leading `~`, `~/` or `~\` to the current user's home directory. */
155
- function expandTilde(path) {
156
- if (path === "~") return homedir();
157
- if (path.startsWith("~/") || path.startsWith("~\\")) return join(homedir(), path.slice(2));
158
- return path;
159
- }
160
- /** Resolve the harness home (DSH_HOME overrides the conventional ~/.dsh). */
161
- function dshHome() {
162
- const override = process.env.DSH_HOME;
163
- if (override === void 0) return join(homedir(), ".dsh");
164
- const trimmed = override.trim();
165
- return trimmed === "" ? join(homedir(), ".dsh") : expandTilde(trimmed);
166
- }
342
+ const LIANGSHEN_GUIDANCE = "本机已安装 dsh-liangshen 插件(梁神模式 agent preset):新建会话的预设选择器中可选「梁神模式」。原理:两阶段锚定——首轮模型请求仅暴露官方 Minimal 精确双工具(持久 bash 与 str_replace_editor,文件工具继承宿主沙箱),只保留一行 persona,清空运行时上下文并只放行用户的直接消息,锚定 Minimal 推理轨迹;晋升受首块锚定门控(首块包含 we 且无 let me,四步兜底),无工具首轮会在响应后自动晋升,晋升后 wire 切换为 Code Mode(PTC,单一 run_code)并在 persona 追加所选工作区路径,workspace 指令与 skill 目录在晋升后再延迟一步注入。preset 文件由插件维护于 ~/.dsh/.agent-presets,升级插件时自动更新;默认预设由用户自行选择。用户提到「梁神模式 / 锚定模式 / anchored standard」时即指本插件,请据此协作。";
167
343
  /** Absolute path of the bundled preset tree inside this package. */
168
344
  function bundledPresetsRoot() {
169
345
  return fileURLToPath(new URL("../presets/", import.meta.url));
@@ -183,9 +359,10 @@ function apply(ctx, config) {
183
359
  const targetRoot = join(dshHome(), ".agent-presets");
184
360
  try {
185
361
  mkdirSync(targetRoot, { recursive: true });
186
- const result = syncPresetTrees(bundledPresetsRoot(), targetRoot);
362
+ const result = syncPresetTrees(bundledPresetsRoot(), targetRoot, ["liangshen-exact"]);
187
363
  for (const { id, error } of result.failed) ctx.logger?.warn?.(`dsh-liangshen: preset ${id} sync failed: ${error}`);
188
364
  if (result.synced.length > 0) ctx.logger?.info?.(`dsh-liangshen: presets synced into ${targetRoot}: ${result.synced.join(", ")}`);
365
+ if (result.retired.length > 0) ctx.logger?.info?.(`dsh-liangshen: retired stale presets from ${targetRoot}: ${result.retired.join(", ")}`);
189
366
  } catch (error) {
190
367
  ctx.logger?.warn?.(`dsh-liangshen: preset sync failed: ${error instanceof Error ? error.message : String(error)}`);
191
368
  }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * DSH_HOME resolution shared by the plugin family's Host halves: the
3
+ * environment override wins, the platform home fallback follows. Mirrors
4
+ * what dsh-pet and dsh-liangshen each used to implement locally.
5
+ */
6
+ /** Expand a leading ~ (or ~user) in a path, platform-style. */
7
+ export declare function expandHome(path: string, home?: string): string;
8
+ /**
9
+ * Resolve the DSH home directory.
10
+ * @param env - process environment to read DSH_HOME from.
11
+ * @param home - platform home directory fallback (test seam).
12
+ * @returns the absolute DSH home path.
13
+ */
14
+ export declare function resolveDshHome(env?: NodeJS.ProcessEnv, home?: string): string;
15
+ /** Resolve the DSH home directory from the live environment. */
16
+ export declare function dshHome(): string;
@@ -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 platform shell plus `read` (Minimal
12
- * prompt condition), and the full Standard tool catalog opens after the
13
- * session's first durable tool call. Derived from
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,9 +28,8 @@ 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\u4E0E\u300C\u6881\u795E\u6A21\u5F0F-\u7CBE\u786E\u5B9E\u9A8C\u300D\u3002\u539F\u7406\uFF1A\u4E24\u9636\u6BB5\u951A\u5B9A\u2014\u2014\u9996\u8F6E\u6A21\u578B\u8BF7\u6C42\u4EC5\u66B4\u9732\u5E73\u53F0 shell \u4E0E read\uFF08\u7CBE\u786E\u5B9E\u9A8C\u7248\u4E3A\u6301\u4E45 bash \u4E0E str_replace_editor\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
- /** Resolve the harness home (DSH_HOME overrides the conventional ~/.dsh). */
33
- export declare function dshHome(): string;
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\u5E76\u5728 persona \u8FFD\u52A0\u6240\u9009\u5DE5\u4F5C\u533A\u8DEF\u5F84\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
+ export { dshHome } from './dsh-home.ts';
34
33
  /** Absolute path of the bundled preset tree inside this package. */
35
34
  export declare function bundledPresetsRoot(): string;
36
35
  /**
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Structural validation for a bundled `agent.cordis.yml`.
3
+ *
4
+ * Deliberately dependency-free: it parses only the flat row metadata the sync
5
+ * and the dsh agent-presets loader rely on. Every top-level row is written as
6
+ * `- id: <id>` at column zero, with the `name`/`group`/`disabled` keys at two
7
+ * spaces of indentation. Nested `config:` and `isolate:` bodies are opaque to
8
+ * this validator — the dsh loader checks their semantics.
9
+ *
10
+ * Returns the list of problems found; an empty array means the document is
11
+ * structurally valid.
12
+ */
13
+ /**
14
+ * Validate the structural contract of an `agent.cordis.yml` document.
15
+ * @param text - the raw YAML document text.
16
+ * @returns a list of human-readable problems; empty means valid.
17
+ */
18
+ export declare function validateAgentCordis(text: string): string[];
@@ -8,6 +8,11 @@
8
8
  * tree is copied and any target files the source does not contain are removed.
9
9
  * Directories the plugin does not own (other presets the user authored) are
10
10
  * never touched.
11
+ *
12
+ * After a preset is synced its `agent.cordis.yml` is validated against the
13
+ * structural preset schema; a validation failure is reported through the
14
+ * run's `failed` entries instead of being a warn-only side effect, so callers
15
+ * can observe (and surface) a broken preset rather than silently shipping it.
11
16
  */
12
17
  /** One sync run's outcome, grouped for diagnostics. */
13
18
  export interface SyncResult {
@@ -20,12 +25,23 @@ export interface SyncResult {
20
25
  id: string;
21
26
  error: string;
22
27
  }[];
28
+ /** Previously bundled preset ids removed from the target root this run. */
29
+ retired: string[];
23
30
  }
24
31
  /** Copy `sourceRoot/<id>` into `targetRoot/<id>`, idempotently. */
25
32
  export declare function syncOnePreset(sourceDir: string, targetDir: string): 'synced' | 'current';
26
33
  /**
27
- * Sync every preset under `sourceRoot` into `targetRoot`.
34
+ * Sync every preset under `sourceRoot` into `targetRoot`, then remove
35
+ * target directories named in `retire` that the bundle no longer ships —
36
+ * preset ids the plugin once owned and later dropped. Only those exact ids
37
+ * are removed; every other target directory is left untouched.
38
+ *
39
+ * Each synced (or already-current) preset is validated against the structural
40
+ * `agent.cordis.yml` schema; a validation failure lands in `failed` so the
41
+ * caller can surface a broken preset as a first-class result instead of a
42
+ * warn-only log line.
28
43
  * @param sourceRoot - plugin-owned preset tree (bundled in the package).
29
44
  * @param targetRoot - dsh agent-presets discovery root (e.g. <home>/.dsh/.agent-presets).
45
+ * @param retire - previously bundled preset ids to remove when absent from the source.
30
46
  */
31
- export declare function syncPresetTrees(sourceRoot: string, targetRoot: string): SyncResult;
47
+ 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 family for the dsh web GUI: two-phase anchored-standard presets — the first model request exposes only a two-tool surface 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. Ships the main liangshen preset and the experimental liangshen-exact preset whose phase 1 matches the builtin Minimal exact RL prompt and schemas. 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.13",
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.15",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": "^22.19.0 || >=24.0.0"
@@ -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 许可声明见开源仓库。