@linxin666/dsh-liangshen 0.3.22 → 0.3.24

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.
Files changed (37) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +45 -38
  3. package/README.zh.md +44 -37
  4. package/lib/client.js +1058 -11
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +105 -22
  7. package/lib/types/client/LiangShenSettingsCard.d.ts +61 -0
  8. package/lib/types/client/PluginSettingsCard.d.ts +133 -0
  9. package/lib/types/client/index.d.ts +34 -0
  10. package/lib/types/client/locales.d.ts +27 -1
  11. package/lib/types/client/plugin-card-seat.d.ts +96 -0
  12. package/lib/types/client/settings-form.d.ts +197 -0
  13. package/lib/types/core/lever.d.ts +6 -3
  14. package/lib/types/index.d.ts +23 -11
  15. package/lib/types/sync.d.ts +29 -2
  16. package/package.json +6 -2
  17. package/presets/liangshen/NOTICE +4 -4
  18. package/presets/liangshen/agent.cordis.yml +130 -119
  19. package/presets/liangshen/minimal-prompt.mjs +71 -36
  20. package/presets/liangshen/paging.mjs +232 -0
  21. package/presets/liangshen/tool-activate.mjs +176 -0
  22. package/presets/liangshen/tool-catalog.mjs +610 -218
  23. package/presets/liangshen/working-context.mjs +214 -0
  24. package/src/client/LiangShenLever.tsx +4 -1
  25. package/src/client/LiangShenSettingsCard.tsx +149 -0
  26. package/src/client/PluginSettingsCard.tsx +550 -0
  27. package/src/client/index.ts +60 -1
  28. package/src/client/locales.ts +53 -1
  29. package/src/client/plugin-card-seat.ts +185 -0
  30. package/src/client/settings-card.module.css +418 -0
  31. package/src/client/settings-form.ts +439 -0
  32. package/src/core/lever.ts +7 -4
  33. package/src/index.ts +35 -14
  34. package/src/sync.test.ts +86 -7
  35. package/src/sync.ts +108 -6
  36. package/tools/benchmark-live-run.mjs +24 -33
  37. package/presets/liangshen/custom-bash.mjs +0 -213
@@ -9,16 +9,20 @@
9
9
  * surface (plugin config) or the profile patch. No browser half, no routes,
10
10
  * no agent tools — the preset itself provides the tools.
11
11
  *
12
- * The preset combines a minimal persona with a staged, promoted tool surface:
13
- * the system prompt keeps a minimal persona with standing working discipline
14
- * and workspace instructions, the session's entire first user turn runs a native
15
- * foundational tool surface ([bash, str_replace_editor, exit_plan_mode, skill],
16
- * with bash-only preserved as a configuration experiment), and from the second
17
- * turn this session presents its tools in PTC mode upon successful activation,
18
- * so the wire carries the single `run_code` transport while the generated SDK
19
- * bindings and collapse rule travel in the tool list injected as a durable
20
- * message after the user's message, preserving full input and output key
21
- * parameter semantics.
12
+ * The preset combines a minimal persona with a lifetime-declared tool
13
+ * presentation: the system prompt keeps a minimal persona with standing
14
+ * working discipline and workspace instructions, and the wire runs the SDK's
15
+ * 'ptc' presentation by default — the wire collapses to the `run_code`
16
+ * transport and every other tool is reached through the generated SDK,
17
+ * declared once per session instead of staged across a turn boundary
18
+ * ('native' and 'both' are one-line opt-outs). High-fan-out tool families
19
+ * (default `mcp__*`) stay paged out of the executed surface through the
20
+ * host's scoped tool restriction until the preset's own `tool_activate` tool
21
+ * loads their namespace (LRU cap three), with the activation state replayed
22
+ * from the durable session event stream. The tool catalog — listing exactly
23
+ * the tools the request carries plus the paged-out namespace summaries — and a
24
+ * one-line working-context projection travel as durable user messages,
25
+ * republished only on change.
22
26
  */
23
27
  import type { Context } from '@deepseek-ai/cordis';
24
28
  import type { SettingsNamespace } from '@deepseek-ai/dsh-settings';
@@ -29,16 +33,24 @@ export declare const name = "liangshen";
29
33
  export declare const LIANGSHEN_SETTINGS_NAMESPACE: SettingsNamespace;
30
34
  /** Prompt assembly must exist before the announcement section can register. */
31
35
  export declare const inject: string[];
36
+ /** The wire presentations the preset's tool catalog accepts. */
37
+ export declare const PRESENTATION_OPTIONS: readonly ["ptc", "native", "both"];
32
38
  /** Plugin config, validated by the same-named schemastery schema. */
33
39
  export interface Config {
34
40
  /** Master switch: when false, neither sync nor announcement runs. */
35
41
  enabled?: boolean;
36
42
  /** When true, a system-prompt section announces the plugin (default false — keep prompts clean unless the user opts in). */
37
43
  announceToAgent?: boolean;
44
+ /**
45
+ * Wire presentation written into the synced preset's tool-catalog row.
46
+ * `ptc` (default) collapses the wire to the `run_code` transport; `native`
47
+ * keeps the assembled roster; `both` keeps the roster and the transport.
48
+ */
49
+ presentation?: (typeof PRESENTATION_OPTIONS)[number];
38
50
  }
39
51
  export declare const Config: z<Config>;
40
52
  /** Model-facing announcement: plugin presence, principle, and limits. */
41
- export declare const LIANGSHEN_GUIDANCE = "\u672C\u673A\u5DF2\u5B89\u88C5 dsh-liangshen \u63D2\u4EF6\uFF08\u6881\u795E\u6A21\u5F0F agent preset\uFF09\uFF1A\u65B0\u5EFA\u4F1A\u8BDD\u7684\u9884\u8BBE\u9009\u62E9\u5668\u4E2D\u53EF\u9009\u300C\u6881\u795E\u6A21\u5F0F\u300D\u3002\u539F\u7406\uFF1A\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4FDD\u6301\u6781\u7B80 persona\uFF08minimal-prompt \u653E\u884C\u8BE5\u6BB5\u4E0E plan \u6A21\u5F0F\u7684 plan:policy\uFF09\uFF0Cpersona \u5185\u7F6E\u672C\u6A21\u5F0F\u5DE5\u4F5C\u7EAA\u5F8B\uFF08\u601D\u7EF4\u5FAA\u73AF\u5373\u65AD\u3001\u5148\u7406\u89E3\u9700\u6C42\u4E0E\u65B9\u6848\u518D\u5B9E\u73B0\u9A8C\u8BC1\u3001YAGNI/PDCA\u3001\u4EE3\u7801\u4E0D\u52A0\u5197\u4F59\u6CE8\u91CA\uFF09\uFF0C\u5E76\u5728\u7EC4\u88C5\u65F6\u8FFD\u52A0\u5DE5\u4F5C\u533A\u76EE\u5F55 Your working directory is <cwd>. \u4E0E AGENTS.md \u5DE5\u4F5C\u533A\u6307\u4EE4\uFF08workspace-instructions \u6BB5\uFF0C65536 \u5B57\u8282\u9884\u7B97\uFF0C\u6BCF\u6B21\u7EC4\u88C5\u91CD\u8BFB\uFF09\uFF1B\u5DE5\u5177\u6E05\u5355\u7531 tool-catalog \u4ECE\u7B2C\u4E00\u6761\u7528\u6237\u6D88\u606F\u8D77\u4EE5 user \u6D88\u606F\u6CE8\u5165\u5728\u7528\u6237\u6D88\u606F\u4E4B\u540E\uFF0C\u5F62\u5982 skill catalog\uFF0C\u4EC5\u5F53\u5DE5\u5177\u96C6\u53D8\u5316\u6216\u8BE5\u6D88\u606F\u79BB\u5F00\u53EF\u89C1\u9762\uFF08\u538B\u7F29\u3001\u6062\u590D\uFF09\u65F6\u91CD\u53D1\uFF1Bwire \u4E0A\u7684 schema \u6309\u56DE\u5408\u5206\u5C42\uFF1A\u9996\u8F6E\u6574\u4E2A user turn \u539F\u751F\u5448\u73B0\u57FA\u7840\u951A\u5B9A\u5DE5\u5177\u96C6\uFF08\u9ED8\u8BA4 [bash, str_replace_editor, exit_plan_mode, skill]\uFF0C\u4E14\u4FDD\u7559 bash-only \u914D\u7F6E\u5B9E\u9A8C\uFF09\uFF0C\u7B2C\u4E8C\u4E2A\u56DE\u5408\u8D77\u5728 PTC \u6210\u529F\u6FC0\u6D3B\u540E\u5207\u6362\u4E3A PTC \u5448\u73B0\uFF08wire \u4E0A\u53EA\u6709 run_code\uFF0C\u5176\u4F59\u5DE5\u5177\u5728\u7A0B\u5E8F\u91CC\u4EE5 await tools.<name>({...}) \u8C03\u7528\uFF0C\u4FDD\u7559\u5B8C\u6574\u8F93\u5165\u8F93\u51FA\u5173\u952E\u53C2\u6570\u8BED\u4E49\u800C\u975E 200 \u5B57\u552F\u4E00\u5951\u7EA6\uFF1B\u7F3A\u5931 code runtime \u65F6\u4F18\u96C5\u56DE\u9000\u81F3\u539F\u751F\u5448\u73B0\uFF09\uFF1B\u6CE8\u5165\u6D88\u606F\u627F\u8F7D SDK \u7ED1\u5B9A\u3001\u7A0B\u5E8F\u5951\u7EA6\uFF08\u4E00\u6BB5\u7A0B\u5E8F\u7F16\u6392\u591A\u6B65\uFF1A\u72EC\u7ACB\u53EA\u8BFB\u8C03\u7528\u7528 Promise.all \u5E76\u53D1\u3001ToolCallError \u5904\u7406\u3001\u8F93\u51FA\u81EA\u9009\uFF09\u4E0E\u300C\u6FC0\u6D3B\u540E\u53EA\u6709 run_code \u53EF\u76F4\u63A5\u8C03\u7528\u300D\u7684\u89C4\u5219\u3002\u5DE5\u4F5C\u533A\u5B50\u76EE\u5F55\u52A8\u6001\u6307\u4EE4\u652F\u6301\u6CE8\u518C\u6587\u4EF6\u5DE5\u5177\u542B str_replace_editor \u53CA PTC \u5185\u5B50\u8C03\u7528\u89E6\u8FBE\u7684\u76EE\u5F55\uFF08\u4E0D\u89E3\u6790\u4EFB\u610F bash/program \u4EE3\u7801\uFF09\u3002\u6587\u4EF6\u64CD\u4F5C\u53D7\u5BBF\u4E3B\u6C99\u7BB1\u7EA6\u675F\uFF0CWindows \u4E0B bash \u4E3A Git Bash \u5B50\u8FDB\u7A0B\u4E14\u72B6\u6001\u4E0D\u8DE8\u8C03\u7528\u4FDD\u7559\u3002\u771F\u5B9E\u63A8\u7406\u63A2\u9488\u901A\u8FC7\u4E0D\u7B49\u4E8E\u6A21\u5F0F\u96C6\u6210\u901A\u8FC7\uFF0C\u66F4\u4E0D\u7B49\u4E8E\u7EDF\u8BA1\u6548\u679C\u63D0\u5347\u3002preset \u6587\u4EF6\u7531\u63D2\u4EF6\u7EF4\u62A4\u4E8E ~/.dsh/.agent-presets\uFF0C\u5347\u7EA7\u63D2\u4EF6\u65F6\u81EA\u52A8\u66F4\u65B0\uFF1B\u9ED8\u8BA4\u9884\u8BBE\u7531\u7528\u6237\u81EA\u884C\u9009\u62E9\u3002\u7528\u6237\u63D0\u5230\u300C\u6881\u795E\u6A21\u5F0F / \u951A\u5B9A\u6A21\u5F0F / anchored standard\u300D\u65F6\u5373\u6307\u672C\u63D2\u4EF6\uFF0C\u8BF7\u636E\u6B64\u534F\u4F5C\u3002";
53
+ export declare const LIANGSHEN_GUIDANCE = "\u672C\u673A\u5DF2\u5B89\u88C5 dsh-liangshen \u63D2\u4EF6\uFF08\u6881\u795E\u6A21\u5F0F agent preset\uFF09\uFF1A\u65B0\u5EFA\u4F1A\u8BDD\u7684\u9884\u8BBE\u9009\u62E9\u5668\u4E2D\u53EF\u9009\u300C\u6881\u795E\u6A21\u5F0F\u300D\u3002\u539F\u7406\uFF1A\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4FDD\u6301\u6781\u7B80 persona\uFF08minimal-prompt \u653E\u884C\u8BE5\u6BB5\u4E0E plan \u6A21\u5F0F\u7684 plan:policy\uFF09\uFF0Cpersona \u5185\u7F6E\u672C\u6A21\u5F0F\u5DE5\u4F5C\u7EAA\u5F8B\uFF08\u53CD\u601D\u7194\u65AD\u2014\u2014\u540C\u4E00\u5047\u8BBE\u63A8\u6F14\u4E0D\u8D85\u8FC7\u4E24\u8F6E\u3001\u7F3A\u4E8B\u5B9E\u7ACB\u5373\u95ED\u5408\u601D\u8003\u5E76\u8C03\u7528\u539F\u751F\u68C0\u6D4B\u5DE5\u5177\uFF1B\u884C\u52A8\u5BFC\u5411\u2014\u2014\u601D\u8003\u53EA\u51B3\u5B9A\u4E0B\u4E00\u6B65\u5177\u4F53\u64CD\u4F5C\u3001\u4E0D\u5728\u601D\u8003\u4E2D\u9884\u6F14\u4EE3\u7801\u5B9E\u73B0\uFF1B\u5E76\u53D1\u63A2\u7D22\u2014\u2014\u591A\u5904\u72EC\u7ACB\u68C0\u67E5\u6216\u641C\u7D22\u5728\u5355\u8F6E\u5185\u5E76\u53D1\u53D1\u5C04\u591A\u4E2A\u5DE5\u5177\u8C03\u7528\uFF1BYAGNI/PDCA\u2014\u2014\u5355\u6B65\u9A8C\u8BC1\u5355\u4E00\u5047\u8BBE\u3001\u4E0D\u5199\u5197\u4F59\u6CE8\u91CA\uFF09\uFF0C\u5E76\u5728\u7EC4\u88C5\u65F6\u8FFD\u52A0\u5DE5\u4F5C\u533A\u76EE\u5F55\u884C Your working directory is <cwd>.\u3002AGENTS.md \u5DE5\u4F5C\u533A\u6307\u4EE4\u9ED8\u8BA4\u4EA4\u8FD8\u5BBF\u4E3B\u81EA\u8EAB\u7684 agent-instructions \u884C\uFF0C\u4EE5 user \u89D2\u8272\u6CE8\u5165\uFF0C\u672C\u63D2\u4EF6\u4E0D\u8FFD\u52A0\u4EFB\u4F55\u7CFB\u7EDF\u63D0\u793A\u8BCD\u6BB5\u3001\u4E5F\u4E0D\u6539\u52A8 pre-step \u7684\u6D88\u606F\u6279\u6B21\uFF1B\u53EF\u9009 instructionSource: system-prompt \u624D\u7531\u672C\u63D2\u4EF6\u5728\u7EC4\u88C5\u65F6\u8BFB\u53D6 AGENTS.md \u94FE\u5E76\u8FFD\u52A0 workspace-instructions \u6BB5\uFF0865536 \u5B57\u8282\u9884\u7B97\uFF0C\u6BCF\u6B21\u7EC4\u88C5\u91CD\u8BFB\uFF09\u3002wire \u5448\u73B0\u7531 tool-catalog \u6309\u4F1A\u8BDD\u4E00\u6B21\u58F0\u660E\uFF0C\u53D6\u503C 'ptc'\uFF08\u9ED8\u8BA4\uFF1Awire \u6536\u62E2\u4E3A\u552F\u4E00\u7684 run_code\uFF0C\u5176\u4F59\u5DE5\u5177\u7ECF\u751F\u6210\u7684 SDK \u89E6\u8FBE\uFF09\u3001'native'\uFF08\u7EC4\u88C5\u51FA\u7684\u539F\u751F\u6E05\u5355\uFF09\u6216 'both'\uFF08\u4E24\u8005\u540C\u9A7B\uFF09\uFF0C\u5E76\u53EF\u5728\u63D2\u4EF6\u8BBE\u7F6E\u754C\u9762\u5207\u6362\uFF08\u540C\u6B65 preset \u65F6\u5199\u5165 tool-catalog \u884C\uFF09\uFF1B\u672A\u6302\u8F7D code runtime \u65F6\u4E0D\u505A\u58F0\u660E\uFF0C\u4F1A\u8BDD\u8FD0\u884C\u539F\u751F\u5DE5\u5177\u9762\u3002\u6E29\u548C\u5DE5\u5177\u5206\u9875\uFF1A\u5339\u914D pagedToolPatterns\uFF08\u9ED8\u8BA4 mcp__*\uFF09\u7684\u5DE5\u5177\u5728\u6FC0\u6D3B\u524D\u88AB\u4F5C\u7528\u57DF\u7EA7\u5DE5\u5177\u9650\u5236\u79FB\u51FA\u53EF\u89C1\u9762\uFF08\u65E2\u4E0D\u5728 wire\uFF0C\u4E5F\u4E0D\u5728\u751F\u6210\u7684 SDK \u58F0\u660E\u4E2D\uFF09\uFF0C\u76EE\u5F55\u6D88\u606F\u5217\u51FA\u5E38\u9A7B\u5DE5\u5177\u7B7E\u540D\u4E0E\u672A\u6FC0\u6D3B\u547D\u540D\u7A7A\u95F4\u6458\u8981\uFF0C\u8C03\u7528 tool_activate({ namespace }) \u6309\u9700\u6FC0\u6D3B\uFF08LRU \u4E0A\u9650 3 \u4E2A\u6D3B\u8DC3\u547D\u540D\u7A7A\u95F4\uFF0C\u9A71\u9010\u6700\u4E45\u672A\u7528\uFF09\uFF1B\u6FC0\u6D3B\u72B6\u6001\u4ECE\u6301\u4E45\u4F1A\u8BDD\u4E8B\u4EF6\u6D41\u91CD\u5EFA\uFF0Cresume/\u538B\u7F29\u540E\u81EA\u7136\u6062\u590D\u3002working-context \u63D2\u4EF6\u5728 pre-step \u6CE8\u5165\u5355\u884C [Working Context: ...] \u5C31\u8FD1\u72B6\u6001\u6295\u5C04\uFF08plan \u6A21\u5F0F\u3001\u6D3B\u8DC3\u547D\u540D\u7A7A\u95F4\u3001\u8FDB\u884C\u4E2D todo \u6807\u9898\uFF0C\u5168\u90E8\u4ECE\u4E8B\u4EF6\u6D41\u6298\u53E0\uFF0C\u8BFB\u4E0D\u5230\u5219\u7701\u7565\uFF0C\u5168\u90E8\u4E3A\u7A7A\u5219\u4E0D\u6CE8\u5165\uFF09\u3002\u5386\u53F2\u5DE5\u5177\u7ED3\u679C\u4FEE\u526A\u4E3A 4096 \u5B57\u7B26\u9608\u503C\uFF08head 1500 / tail 500\uFF09\u3002\u6587\u4EF6\u64CD\u4F5C\u53D7\u5BBF\u4E3B\u6C99\u7BB1\u7EA6\u675F\uFF1Bshell \u5728\u6BCF\u4E2A\u5E73\u53F0\u90FD\u6302\u4E0A\u6E38\u6807\u51C6 Stdio \u6808\uFF08POSIX \u4E3A bash\uFF0CWindows \u4E3A pwsh\uFF09\uFF0C\u5E26\u7B80\u77ED\u63CF\u8FF0\u6807\u9898\u5361\u7247\u4E0E\u786E\u5B9A\u6027\u9000\u51FA\u7801\u3002\u771F\u5B9E\u63A8\u7406\u63A2\u9488\u901A\u8FC7\u4E0D\u7B49\u4E8E\u6A21\u5F0F\u96C6\u6210\u901A\u8FC7\uFF0C\u66F4\u4E0D\u7B49\u4E8E\u7EDF\u8BA1\u6548\u679C\u63D0\u5347\u3002preset \u6587\u4EF6\u7531\u63D2\u4EF6\u7EF4\u62A4\u4E8E ~/.dsh/.agent-presets\uFF0C\u5347\u7EA7\u63D2\u4EF6\u65F6\u81EA\u52A8\u66F4\u65B0\uFF1B\u9ED8\u8BA4\u9884\u8BBE\u7531\u7528\u6237\u81EA\u884C\u9009\u62E9\u3002\u7528\u6237\u63D0\u5230\u300C\u6881\u795E\u6A21\u5F0F / \u951A\u5B9A\u6A21\u5F0F / anchored standard\u300D\u65F6\u5373\u6307\u672C\u63D2\u4EF6\uFF0C\u8BF7\u636E\u6B64\u534F\u4F5C\u3002";
42
54
  export { dshHome } from './dsh-home.ts';
43
55
  /** Absolute path of the bundled preset tree inside this package. */
44
56
  export declare function bundledPresetsRoot(): string;
@@ -28,8 +28,35 @@ export interface SyncResult {
28
28
  /** Previously bundled preset ids removed from the target root this run. */
29
29
  retired: string[];
30
30
  }
31
+ /**
32
+ * The preset-row settings the plugin exposes in the web settings surface, as the
33
+ * overrides to write into the synced `agent.cordis.yml`.
34
+ *
35
+ * The settings surface edits the PLUGIN's namespace, while the values that shape
36
+ * a session live in the preset's rows. Writing the chosen values into the synced
37
+ * tree is what connects the two: the bundled source stays the shipped default,
38
+ * and the operator's choice rides on top of it. Every field is optional — an
39
+ * absent value leaves the shipped row exactly as it is.
40
+ */
41
+ export interface PresetOverrides {
42
+ /** The `tool-catalog` row's `presentation` value. */
43
+ presentation?: string;
44
+ }
45
+ /**
46
+ * Render `agent.cordis.yml` with the settings overrides applied.
47
+ *
48
+ * Rows are matched by their `- id:` marker, so the transform does not depend on
49
+ * line numbers or on the values the shipped file happens to carry. A row or key
50
+ * the source does not contain is left alone rather than invented: the overlay
51
+ * narrows the shipped configuration, it never adds a mount the preset did not
52
+ * have.
53
+ * @param text - the bundled preset composition.
54
+ * @param overrides - the operator's settings-surface choices.
55
+ * @returns the composition to write into the synced tree.
56
+ */
57
+ export declare function renderPresetOverrides(text: string, overrides: PresetOverrides): string;
31
58
  /** Copy `sourceRoot/<id>` into `targetRoot/<id>`, idempotently. */
32
- export declare function syncOnePreset(sourceDir: string, targetDir: string): 'synced' | 'current';
59
+ export declare function syncOnePreset(sourceDir: string, targetDir: string, overrides?: PresetOverrides): 'synced' | 'current';
33
60
  /**
34
61
  * Sync every preset under `sourceRoot` into `targetRoot`, then remove
35
62
  * target directories named in `retire` that the bundle no longer ships —
@@ -44,4 +71,4 @@ export declare function syncOnePreset(sourceDir: string, targetDir: string): 'sy
44
71
  * @param targetRoot - dsh agent-presets discovery root (e.g. <home>/.dsh/.agent-presets).
45
72
  * @param retire - previously bundled preset ids to remove when absent from the source.
46
73
  */
47
- export declare function syncPresetTrees(sourceRoot: string, targetRoot: string, retire?: string[]): SyncResult;
74
+ export declare function syncPresetTrees(sourceRoot: string, targetRoot: string, retire?: string[], overrides?: PresetOverrides): SyncResult;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-liangshen",
3
- "description": "LiangShen (梁神) agent preset plus its composer lever for the dsh web GUI. The preset keeps a minimal persona with standing working discipline and workspace instructions in the system prompt, anchors the entire first user turn on a native foundational tool surface ([bash, str_replace_editor, exit_plan_mode, skill], with bash-only supported as a configuration experiment), and from the second turn presents tools in PTC mode upon successful activation: the wire carries the single `run_code` transport and other tools are reached via the generated SDK preserving full input/output key parameter semantics. The tool catalog, SDK bindings, program contract (one program per intent, overlapping independent reads under `Promise.all`, `ToolCallError` handling, curated output), and collapse rule are injected as a durable user message after the user's message the way the skill catalog is. The browser half adds a slot-machine lever left of the model selector on the new-session screen to toggle the mode. Preset files sync to ~/.dsh/.agent-presets on startup. Hot-pluggable via cordis.patch.yml + profile symlink, no dsh source changes.",
4
- "version": "0.3.22",
3
+ "description": "LiangShen (梁神) agent preset plus its composer lever for the dsh web GUI. The preset keeps a minimal persona with standing working discipline while the harness's own user-role agent-instructions injection delivers the workspace instructions (the optional `instructionSource: system-prompt` mode lifts them into the prompt instead), and declares one tool presentation for the session's whole lifetime (default `presentation: 'ptc'`, where the wire collapses to the `run_code` transport and every other tool is reached through the generated SDK; `native` keeps the assembled roster, `both` keeps them co-resident). High-fan-out tool families (default `mcp__*`) stay paged out of the wire until the preset's own `tool_activate` tool loads their namespace (LRU cap three, state replayed from the durable session event stream), and the tool catalog — exactly the on-wire tools plus paged-out namespace summaries — and a one-line working-context projection travel as durable user messages republished only on change. The browser half adds a slot-machine lever left of the model selector on the new-session screen to toggle the mode. Preset files sync to ~/.dsh/.agent-presets on startup. Hot-pluggable via cordis.patch.yml + profile symlink, no dsh source changes.",
4
+ "version": "0.3.24",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": "^22.19.0 || >=24.0.0"
@@ -31,6 +31,7 @@
31
31
  "inject": [
32
32
  "@deepseek-ai/dsh-client-connection",
33
33
  "@deepseek-ai/dsh-client-ui-renderer",
34
+ "@deepseek-ai/dsh-client-ui-settings",
34
35
  "@deepseek-ai/dsh-api-remotes",
35
36
  "@deepseek-ai/dsh-api-session-controller"
36
37
  ],
@@ -50,12 +51,15 @@
50
51
  "@deepseek-ai/dsh-client-store": "^0.1.5-rc.1",
51
52
  "@deepseek-ai/dsh-client-ui-conversation": "^0.1.5-rc.1",
52
53
  "@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-rc.1",
54
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.5-rc.1",
53
55
  "@deepseek-ai/dsh-client-ui-slots": "^0.1.5-rc.1",
54
56
  "@deepseek-ai/dsh-settings": "^0.1.5-rc.1",
55
57
  "@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.1",
58
+ "@testing-library/react": "^16.1.0",
56
59
  "@types/node": "^22.20.0",
57
60
  "@types/react": "~18.3.1",
58
61
  "@types/react-dom": "~18.3.1",
62
+ "@vitest/coverage-v8": "^3.2.7",
59
63
  "jsdom": "^25.0.0",
60
64
  "react": "^18.3.1",
61
65
  "react-dom": "^18.3.1",
@@ -1,8 +1,8 @@
1
- agent.cordis.yml 改编自 DeepSeek Harness 内置 Minimal、Standard 与 PTC preset(MIT)。
1
+ agent.cordis.yml 改编自 DeepSeek Harness 内置 Minimal、Standard 与 PTC preset(MIT),
2
+ 其 shell 段与内置 Minimal 一致:POSIX 挂上游持久 bash,win32 挂上游持久 pwsh
3
+ (dsh-terminal-bash 的 shellDialect: pwsh + dsh-tool-pwsh-persistent),本 preset
4
+ 不提供自研 shell 实现。
2
5
  minimal-prompt.mjs 与 tool-catalog.mjs 为 dsh-liangshen 自有实现;其中的
3
6
  agent-instructions 引用提示沿用 https://github.com/xiaobright/dsh-anchored-standard
4
7
  (MIT)的实验结论,消息注入形状参照 DeepSeek Harness 的 skill catalog。
5
- custom-bash.mjs 移植自同一上游(xiaobright/dsh-anchored-standard,MIT)的
6
- combo-anchored/custom-bash.mjs,用于 win32 上以跨平台子进程通道提供同名
7
- `bash` 工具(Git Bash)。
8
8
  原始 DeepSeek 版权和 MIT 许可声明见开源仓库。
@@ -1,29 +1,52 @@
1
1
  # The `liangshen` (梁神模式) agent preset: the builtin Minimal preset's
2
- # one-line persona — extended with the mode's standing working discipline and
3
- # the session's workspace directory — as the WHOLE system prompt, with the
4
- # session's tool surface staged behind the anchor turn and PTC presentation
5
- # taking over after it. The session's entire first user turn runs the anchored native
6
- # surface — the short persona block plus the default `anchorTools`
7
- # schemas (`[bash, str_replace_editor, exit_plan_mode, skill]`), natively presented —
8
- # and from the second turn this session presents its tools in PTC mode (when
9
- # successfully activated): the wire carries the single `run_code`
10
- # transport, and every other tool is reached from inside the program through
11
- # the generated SDK. The capability facts the Standard system prompt would
12
- # carry as tool-guidance prose — and, under PTC, the SDK bindings and the
13
- # collapse rule that `minimal-prompt` filters out of the prompt along with
14
- # every other section — arrive instead as a durable `tool-catalog` message
15
- # appended after the user's own message from the FIRST turn on, the way the
16
- # skill catalog is injected; it names exactly the tools the current request
17
- # opens (each tool's argument signature plus a one-line summary) — the anchor
18
- # set natively during the anchor turn, the SDK-reachable roster under PTC —
19
- # so the declared surface and the request's own wire never disagree. The one
20
- # wire transition is the deterministic turn boundary: no reasoning-block
21
- # gating, no output budget cap.
2
+ # one-line persona — extended with the mode's standing working discipline
3
+ # (thinking-disruption fuses, action-oriented steps, YAGNI/PDCA) and the
4
+ # session's workspace directory — as the WHOLE system prompt, with one tool
5
+ # presentation declared for the session's whole lifetime instead of a staged
6
+ # turn boundary.
7
+ #
8
+ # The presentation is the SDK's ToolPresentationMode, picked by the
9
+ # tool-catalog row's `presentation` key (default `'both'`): `'native'` keeps
10
+ # the assembled roster on the wire, `'ptc'` collapses the wire to the single
11
+ # `run_code` transport, and `'both'` keeps the full native roster AND the
12
+ # `run_code` transport co-resident — native calls carry ordinary work while
13
+ # `run_code` covers programmatic batch computation and wide fan-out. The
14
+ # declaration lands once per agent scope through agent.ctx.tools.presentAs as
15
+ # early as the scope exists, and degrades to the native surface with a
16
+ # one-time warning when the deployment has no code runtime or the host
17
+ # declines. The retired anchor-turn staging is gone: the legacy `anchorTools`
18
+ # and boolean `ptcPresentation` keys are still accepted (the latter mapping
19
+ # true -> 'ptc' and false -> 'native') but only warn once.
20
+ #
21
+ # Gentle tool paging keeps high-fan-out families out of reach until needed:
22
+ # tools matching `pagedToolPatterns` (default `mcp__*`) stay paged out, the
23
+ # durable tool-catalog message summarizes their namespaces with an activation
24
+ # pointer, and the preset's own `tool_activate` tool (the tool-activate row)
25
+ # loads one namespace back — at most three stay active, LRU eviction pages the
26
+ # oldest back out. The activation state replays from the durable session event
27
+ # stream on every assembly, so resume and compaction rebuild it without process
28
+ # memory. Paging is enforced twice, because the wire is not the only surface a
29
+ # tool can be reached through: the assembled tool list loses the paged families,
30
+ # and the agent scope is restricted (agent.ctx.tools.restrict) so the same names
31
+ # vanish from the generated SDK and from every program dispatch. The second half
32
+ # is what makes paging real under the default `ptc` presentation, where the wire
33
+ # has already collapsed to `run_code` and a wire-only filter would withhold
34
+ # nothing the model can observe.
35
+ #
36
+ # The capability facts the Standard system prompt would carry as tool-guidance
37
+ # prose arrive instead as a durable `tool-catalog` message appended after the
38
+ # user's own message, the way the skill catalog is injected: it names exactly
39
+ # the tools the current request's wire carries (each tool's argument signature
40
+ # plus a one-line summary) plus the paged-out namespace summaries, so the
41
+ # declared surface and the request's own wire never disagree. A second durable
42
+ # message, working-context, projects one minimal line of objective session
43
+ # state (plan mode, active namespaces, in-progress todos) folded from the
44
+ # session event stream, republished only when it changes.
22
45
  #
23
46
  # The persistent shell replaces the Standard ephemeral shell for the whole
24
- # session (both register the name `bash`), and the editor inherits the host
25
- # file sandbox instead of mounting a bare local filesystem — see the shell and
26
- # filesystem sections below.
47
+ # session — `bash` on POSIX, `pwsh` on win32, exactly one per host — and the
48
+ # editor inherits the host file sandbox instead of mounting a bare local
49
+ # filesystem — see the shell and filesystem sections below.
27
50
  #
28
51
  # Adapted from the builtin `minimal` and `standard` presets.
29
52
  #
@@ -52,86 +75,110 @@
52
75
  # appends the session's workspace directory at assembly time, so identity,
53
76
  # harness, web-surface, and tool-guidance sections never reach the model.
54
77
  # Besides the one-line persona it carries the standing working discipline the
55
- # mode ships with (thinking loops, design-first reasoning, YAGNI/PDCA, no
56
- # code comments). Runtime context snapshots stay enabled: they are durable
57
- # user-role messages, not system-prompt text.
78
+ # mode ships with: thinking-disruption fuses (a hypothesis gets at most two
79
+ # reasoning passes before a tool must settle it), action-oriented thinking
80
+ # (decide the next operation, never pre-rehearse implementations in thought),
81
+ # and YAGNI/PDCA with no redundant comments. Runtime context snapshots stay
82
+ # enabled: they are durable user-role messages, not system-prompt text.
58
83
  - id: persona
59
84
  name: '@deepseek-ai/dsh-persona'
60
85
  config:
61
86
  prefix: |-
62
87
  You are a helpful software engineer assistant.
63
88
 
64
- - Avoid falling into repetitive loops during thinking; exit immediately once a loop is detected.
65
- - Focus thinking on requirement understanding and solution design (key points, workflow, verification strategy), without pre-rehearsing specific code implementation. Code should be output during the "Do" phase based on the actual state of files, with correctness verified by the "Check" phase.
66
- - When writing code, follow the YAGNI programming philosophy and the PDCA behavioral standard.
67
- - No need to write comments for the code.
89
+ - Thinking Disruption: Do not repeat reasoning on the same hypothesis more than twice. If necessary facts are missing, immediately close </think> and call native inspection tools (read, grep, bash/pwsh) instead of speculating in thought.
90
+ - Action-Oriented: Thinking must focus solely on determining the next concrete operation. Do not mentally pre-rehearse full code implementations. All correctness verification must be conducted against actual tool outputs during the execution phase.
91
+ - Parallel Inspection: When multiple independent inspections, searches, or checks are needed, emit multiple tool calls concurrently in a single turn instead of sequential rounds. The harness executes independent read-only tools in parallel.
92
+ - Shell Discipline: Shell processes are ephemeral; directory changes do not persist across tool calls. Use compound commands (e.g. cd <path> && <cmd>) or pass workdir explicitly for operations in subdirectories.
93
+ - Development Standard: Follow YAGNI and the PDCA loop. Each step verifies a single assumption. Do not write redundant comments.
94
+ - Bounded Output: never dump a large or unbounded command output into the conversation. Filter at the source with grep/head/tail/wc and read the narrow range you actually need; the model's long-range attention is a bounded budget and raw logs evict the session's own constraints from it.
68
95
 
69
- # The two halves of the mode, both preset-local plugins:
96
+ # The mode's preset-local plugins:
70
97
  #
71
98
  # `minimal-prompt` keeps the system prompt on the persona above, plus the
72
99
  # session's workspace directory appended at assembly time (`Your working
73
- # directory is <cwd>.` — the one orientation fact the persona block carries).
74
- # It also lifts the AGENTS.md-style instruction files into the system prompt
75
- # itself: at assembly time it reads the harness's baseline chain
76
- # ($DSH_HOME/AGENTS.md, then the project root's ancestors down to the cwd) and
77
- # appends the content as one `workspace-instructions` section after the stable
78
- # prefix, re-read on every request so file edits propagate, and drops the
79
- # harness's own agent-instructions injections (they would duplicate the
80
- # prompt). Set `instructionSource: hint` to restore the one-time non-imperative
81
- # pointer to the reference files instead (issue #388, upstream
82
- # dsh-anchored-standard #49: a full-text dump as context measurably flips the
83
- # anchored trajectory), or `keepPlanPolicy: false` to drop plan mode's policy
84
- # section as well.
100
+ # directory is <cwd>.` — the one orientation fact the persona block carries),
101
+ # with no platform-conditional text: both platform shells are persistent, so
102
+ # the persona block is byte-identical on every host. The official `tools:sdk`
103
+ # and `tools:ptc-only` sections are kept exactly when the assembly's wire
104
+ # carries the `run_code` transport.
85
105
  #
86
- # `tool-catalog` appends the model-visible tool catalog — each tool's argument
87
- # signature plus a one-line summary — as a durable user message after the
88
- # user's own message from the first turn on, the way `dsh-tool-skill` injects
89
- # the skill catalog. It republishes only when that catalog's content changes or
90
- # the published copy left the visible surface (compaction, resume), so the
91
- # catalog is not appended once per step. The content follows the presentation
92
- # the next request will carry: the anchor wire before the boundary, the SDK
93
- # roster after it. `descriptionMaxLength` caps each one-line summary; the full
94
- # description stays in the tool schema.
106
+ # `instructionSource` chooses where the AGENTS.md-style instruction files reach
107
+ # the model. The default, `host`, appends nothing and leaves the pre-step
108
+ # message batch untouched, so the `agent-instructions` row below delivers the
109
+ # baseline and the dynamic subdirectory instructions as the user-role messages
110
+ # the harness itself produces — the prompt stays the bare persona and the
111
+ # preset adds no instruction prose of its own. `system-prompt` instead reads
112
+ # the harness's baseline chain ($DSH_HOME/AGENTS.md, then the project root's
113
+ # ancestors down to the cwd) at assembly time and appends the content as one
114
+ # `workspace-instructions` section after the stable prefix, re-read on every
115
+ # request so file edits propagate, dropping the harness's own injections (they
116
+ # would duplicate the prompt). `hint` restores the one-time non-imperative
117
+ # pointer to the reference files (issue #388, upstream dsh-anchored-standard
118
+ # #49: a full-text dump as context measurably flips the trajectory). Both
119
+ # non-default modes trade the harness's own channel for a preset-owned one; the
120
+ # default keeps the upstream contract. Set `keepPlanPolicy: false` to drop
121
+ # plan mode's policy section as well.
95
122
  #
96
- # `anchorTools` stages the tool SCHEMAS behind the anchor turn: during the
97
- # session's entire first user turn the assembled wire narrows to these schemas
98
- # and the session keeps native presentation, and the catalog narrows with the
99
- # wire, so the model is never told about a tool this request does not expose.
100
- # The shipped default anchor tools are `[bash, str_replace_editor, exit_plan_mode, skill]`.
101
- # The bash-only configuration experiment (`anchorTools: [bash]`) is preserved
102
- # and supported via config without requiring extra preset registration or
103
- # registry changes. Set it to an empty list to disable the narrowing entirely.
123
+ # `tool-catalog` owns the wire presentation and the model-visible catalog.
124
+ # `presentation` selects the SDK ToolPresentationMode for the session's whole
125
+ # lifetime: `'ptc'` (default) collapses the wire to the `run_code` transport
126
+ # and reaches every other tool through the generated SDK, `'native'` keeps the
127
+ # assembled roster alone, and `'both'` keeps the roster and the transport
128
+ # co-resident. The shipped default is a static-context choice, not a measured
129
+ # win: the official scaffold comparison ranks this presentation below the native
130
+ # surface on both code-agent benchmarks, and the bundled benchmark matrix is how
131
+ # that trade would be settled locally. `pagedToolPatterns` (default `['mcp__*']`) names the
132
+ # high-fan-out families that stay paged out of the wire until activated; the
133
+ # active set replays from the session event stream, so resume and compaction
134
+ # rebuild it. `maxResidentTokens` (default 6000, calibrated above the shipped
135
+ # roster so the guard flags real growth rather than the factory configuration)
136
+ # guards the always-on-wire
137
+ # surface: crossing the estimate warns once and points at the patterns, rather
138
+ # than silently dropping a tool the session needs. The catalog itself is a
139
+ # durable user message appended after the
140
+ # user's own message, the way `dsh-tool-skill` injects the skill catalog: it
141
+ # names exactly the tools the current request's wire carries (each tool's
142
+ # argument signature plus a one-line summary capped by
143
+ # `descriptionMaxLength`; the full description stays in the tool schema) and
144
+ # summarizes the paged-out namespaces with their `tool_activate` pointer —
145
+ # including under `ptc`, where those namespaces really are unreachable until
146
+ # activated and the program contract says so. It republishes only when the
147
+ # content changes or the published copy left the visible surface (compaction,
148
+ # resume).
104
149
  #
105
- # `ptcPresentation` declares this session's tools in PTC mode from the second
106
- # turn on (when successfully activated): the wire collapses to the reserved
107
- # `run_code` transport and every other tool is reached inside the program through
108
- # the generated SDK, which the injected catalog names because `minimal-prompt`
109
- # filters the harness's own `tools:sdk` and `tools:ptc-only` sections out of the
110
- # prompt. The SDK preserves full input and output key parameter semantics rather
111
- # than a rigid short-summary contract. The declaration is per session
112
- # (`agent.ctx.tools.presentAs`), needs a mounted code runtime, and degrades to
113
- # the native surface with a one-time warning when either is missing or fails.
114
- # Set `false` to restore the pre-PTC behavior: the full native roster on the
115
- # wire from the second turn.
150
+ # `tool-activate` registers the `tool_activate` tool the catalog points at:
151
+ # it validates the target against the session's paged, inactive namespaces and
152
+ # activates one onto the wire, evicting the least recently used namespace past
153
+ # the cap of three. `working-context` appends the one-line recency projection
154
+ # (`[Working Context: ...]`) folded from the session events, republished only
155
+ # when it changes.
116
156
  - id: minimal-prompt
117
157
  name: ./minimal-prompt.mjs
118
158
  config:
119
159
  keepPlanPolicy: true
120
- instructionSource: system-prompt
160
+ instructionSource: host
121
161
  instructionMaxBytes: 65536
122
162
 
123
163
  - id: tool-catalog
124
164
  name: ./tool-catalog.mjs
125
165
  config:
126
166
  descriptionMaxLength: 200
127
- anchorTools: [bash, str_replace_editor, exit_plan_mode, skill]
128
- ptcPresentation: true
167
+ presentation: 'both'
168
+ pagedToolPatterns: []
169
+ maxResidentTokens: 6000
170
+
171
+ - id: working-context
172
+ name: ./working-context.mjs
129
173
 
130
174
  # The harness's workspace-instruction loader. Under the default
175
+ # `instructionSource: host` this row owns the channel: its baseline and dynamic
176
+ # user-role messages reach the model untouched. Under
131
177
  # `instructionSource: system-prompt` the content reaches the model through the
132
- # system prompt instead, and this row's injections are dropped by
133
- # `minimal-prompt`; the row stays mounted so `instructionSource: hint` keeps
134
- # its pointer behavior working, and its `maxBytes` remains that mode's budget.
178
+ # system prompt instead and these injections are condensed or dropped by
179
+ # `minimal-prompt`; under `hint` the first is replaced by a pointer and the
180
+ # rest dropped. The row stays mounted in every mode: it is the default's whole
181
+ # delivery path, and its `maxBytes` remains the budget the other two consult.
135
182
  - id: agent-instructions
136
183
  name: '@deepseek-ai/dsh-agent-instructions'
137
184
  config:
@@ -139,50 +186,14 @@
139
186
 
140
187
  # ── shell ───────────────────────────────────────────────────────────────────
141
188
 
142
- # The PTY registry is an agent-owned service, so it lives in an entry-local
143
- # realm. The backend still consumes the host sandbox policy and subprocess
144
- # implementation, while the tool registers into this agent's scoped catalog.
145
- # This persistent `bash` replaces the Standard ephemeral shell for the WHOLE
146
- # session (both tools register the name `bash`), so shell state survives across
147
- # calls.
148
- - id: persistent-shell
149
- name: cordis:group
150
- group: true
189
+ # Standard Stdio shell tools: fresh subprocess per command with active-voice description
190
+ # cards, structured exit codes, and background job support. Exactly one mounts per host.
191
+ - id: tool-bash
192
+ name: '@deepseek-ai/dsh-tool-bash'
151
193
  disabled: !!js process.platform === 'win32'
152
- isolate:
153
- terminals: true
154
- config:
155
- - id: pty
156
- name: '@deepseek-ai/dsh-terminal'
157
194
 
158
- - id: terminal-bash
159
- name: '@deepseek-ai/dsh-terminal-bash'
160
- config:
161
- timeoutMs: 300000
162
-
163
- - id: persistent-bash
164
- name: '@deepseek-ai/dsh-tool-bash-persistent'
165
- config:
166
- timeoutMs: 300000
167
- description: |-
168
- Run commands in a bash shell
169
- * When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.
170
- * You don't have access to the internet via this tool.
171
- * You do have access to a mirror of common linux and python packages via apt and pip.
172
- * State is persistent across command calls and discussions with the user.
173
- * To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p /path/to/the/file'.
174
- * Please avoid commands that may produce a very large amount of output.
175
- * Please run long lived commands in the background, e.g. 'sleep 10 &' or start a server in the background.
176
-
177
- # Windows-only `bash` tool (custom-bash.mjs): the PTY backend above is
178
- # linux/darwin-only, so win32 disables the persistent-shell group and
179
- # registers this `bash` through the ordinary cross-platform subprocess seam
180
- # (Git Bash). Both platforms end up with exactly one tool named `bash`.
181
- # Non-zero exit is reported not thrown; state does NOT persist across calls on
182
- # this path; no OS sandbox confinement on Windows. `bashPath` is optional
183
- # (defaults to Git Bash inference); set it explicitly when git is not on PATH.
184
- - id: custom-bash
185
- name: ./custom-bash.mjs
195
+ - id: tool-pwsh
196
+ name: '@deepseek-ai/dsh-tool-pwsh'
186
197
  disabled: !!js process.platform !== 'win32'
187
198
 
188
199
  # ── filesystem ──────────────────────────────────────────────────────────────