@linxin666/dsh-liangshen 0.3.19 → 0.3.21
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 +51 -35
- package/README.zh.md +53 -37
- package/lib/client.js +640 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +10 -6
- package/lib/types/announce.test.d.ts +1 -0
- package/lib/types/client/LiangShenLever.d.ts +17 -0
- package/lib/types/client/index.d.ts +45 -0
- package/lib/types/client/lever-controller.d.ts +133 -0
- package/lib/types/client/locales.d.ts +27 -0
- package/lib/types/core/lever.d.ts +50 -0
- package/lib/types/index.d.ts +10 -6
- package/lib/types/index.test.d.ts +1 -0
- package/lib/types/schema.test.d.ts +1 -0
- package/lib/types/sync.test.d.ts +1 -0
- package/package.json +32 -5
- package/presets/liangshen/NOTICE +4 -3
- package/presets/liangshen/agent.cordis.yml +122 -86
- package/presets/liangshen/custom-bash.mjs +4 -4
- package/presets/liangshen/minimal-prompt.mjs +534 -0
- package/presets/liangshen/tool-catalog.mjs +518 -0
- package/src/client/LiangShenLever.module.css +314 -0
- package/src/client/LiangShenLever.tsx +176 -0
- package/src/client/css-modules.d.ts +5 -0
- package/src/client/index.ts +89 -0
- package/src/client/lever-controller.ts +331 -0
- package/src/client/locales.ts +46 -0
- package/src/core/lever.ts +68 -0
- package/src/index.ts +10 -6
- package/src/schema.test.ts +1 -1
- package/src/sync.test.ts +4 -4
- package/tools/analyze-session.mjs +25 -5
- package/presets/liangshen/tool-bootstrap.mjs +0 -601
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
# The `liangshen` (梁神模式) agent preset:
|
|
2
|
-
#
|
|
3
|
-
# the
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
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 first request runs the builtin Minimal
|
|
6
|
+
# surface exactly — the short persona block plus the single `anchorTools`
|
|
7
|
+
# schema (`bash`), natively presented — and from the second turn this session
|
|
8
|
+
# presents its tools in PTC mode: the wire carries the single `run_code`
|
|
9
|
+
# transport, and every other tool is reached from inside the program through
|
|
10
|
+
# the generated SDK. The capability facts the Standard system prompt would
|
|
11
|
+
# carry as tool-guidance prose — and, under PTC, the SDK bindings and the
|
|
12
|
+
# collapse rule that `minimal-prompt` filters out of the prompt along with
|
|
13
|
+
# every other section — arrive instead as a durable `tool-catalog` message
|
|
14
|
+
# appended after the user's own message from the FIRST turn on, the way the
|
|
15
|
+
# skill catalog is injected; it names the PTC surface (each tool's argument
|
|
16
|
+
# signature plus a one-line summary) from the start, so the model knows the
|
|
17
|
+
# promoted surface before the schemas arrive. The one wire transition is the
|
|
18
|
+
# deterministic turn boundary: no reasoning-block gating, no output budget cap.
|
|
19
|
+
#
|
|
20
|
+
# The persistent shell replaces the Standard ephemeral shell for the whole
|
|
21
|
+
# session (both register the name `bash`), and the editor inherits the host
|
|
22
|
+
# file sandbox instead of mounting a bare local filesystem — see the shell and
|
|
23
|
+
# filesystem sections below.
|
|
11
24
|
#
|
|
12
25
|
# Adapted from the builtin `minimal` and `standard` presets.
|
|
13
26
|
#
|
|
@@ -30,82 +43,101 @@
|
|
|
30
43
|
|
|
31
44
|
# ── identity ────────────────────────────────────────────────────────────────
|
|
32
45
|
|
|
33
|
-
#
|
|
34
|
-
# assembled sections down to
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
#
|
|
46
|
+
# The persona prefix below is the preset's entire system prompt base:
|
|
47
|
+
# `minimal-prompt` narrows the assembled sections down to it (plus plan mode's
|
|
48
|
+
# `plan:policy`, which no tool restriction backs — see that plugin) and
|
|
49
|
+
# appends the session's workspace directory at assembly time, so identity,
|
|
50
|
+
# harness, web-surface, and tool-guidance sections never reach the model.
|
|
51
|
+
# Besides the one-line persona it carries the standing working discipline the
|
|
52
|
+
# mode ships with (thinking loops, design-first reasoning, YAGNI/PDCA, no
|
|
53
|
+
# code comments). Runtime context snapshots stay enabled: they are durable
|
|
54
|
+
# user-role messages, not system-prompt text.
|
|
40
55
|
- id: persona
|
|
41
56
|
name: '@deepseek-ai/dsh-persona'
|
|
42
57
|
config:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
# `
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
prefix: |-
|
|
59
|
+
You are a helpful software engineer assistant.
|
|
60
|
+
|
|
61
|
+
- Avoid falling into repetitive loops during thinking; exit immediately once a loop is detected.
|
|
62
|
+
- 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.
|
|
63
|
+
- When writing code, follow the YAGNI programming philosophy and the PDCA behavioral standard.
|
|
64
|
+
- No need to write comments for the code.
|
|
65
|
+
|
|
66
|
+
# The two halves of the mode, both preset-local plugins:
|
|
67
|
+
#
|
|
68
|
+
# `minimal-prompt` keeps the system prompt on the persona above, plus the
|
|
69
|
+
# session's workspace directory appended at assembly time (`Your working
|
|
70
|
+
# directory is <cwd>.` — the one orientation fact the persona block carries).
|
|
71
|
+
# It also lifts the AGENTS.md-style instruction files into the system prompt
|
|
72
|
+
# itself: at assembly time it reads the harness's baseline chain
|
|
73
|
+
# ($DSH_HOME/AGENTS.md, then the project root's ancestors down to the cwd) and
|
|
74
|
+
# appends the content as one `workspace-instructions` section after the stable
|
|
75
|
+
# prefix, re-read on every request so file edits propagate, and drops the
|
|
76
|
+
# harness's own agent-instructions injections (they would duplicate the
|
|
77
|
+
# prompt). Set `instructionSource: hint` to restore the one-time non-imperative
|
|
78
|
+
# pointer to the reference files instead (issue #388, upstream
|
|
79
|
+
# dsh-anchored-standard #49: a full-text dump as context measurably flips the
|
|
80
|
+
# anchored trajectory), or `keepPlanPolicy: false` to drop plan mode's policy
|
|
81
|
+
# section as well.
|
|
82
|
+
#
|
|
83
|
+
# `tool-catalog` appends the model-visible tool catalog — each tool's argument
|
|
84
|
+
# signature plus a one-line summary — as a durable user message after the
|
|
85
|
+
# user's own message from the first turn on, the way `dsh-tool-skill` injects
|
|
86
|
+
# the skill catalog. It republishes only when that catalog's content changes or
|
|
87
|
+
# the published copy left the visible surface (compaction, resume), so the
|
|
88
|
+
# catalog is not appended once per step. `descriptionMaxLength` caps each
|
|
89
|
+
# one-line summary; the full description stays in the tool schema.
|
|
90
|
+
#
|
|
91
|
+
# `anchorTools` stages the tool SCHEMAS behind the anchor turn: while the
|
|
92
|
+
# session is in its first turn the assembled wire narrows to these schemas and
|
|
93
|
+
# the session keeps native presentation, while the catalog already names the
|
|
94
|
+
# promoted surface (entries come from the registry, not from the narrowed
|
|
95
|
+
# wire). The shipped anchor is `bash` alone — the builtin Minimal surface — so
|
|
96
|
+
# the first request carries one schema and nothing else; execution resolves by
|
|
97
|
+
# name against the session registry, independent of what the request declares.
|
|
98
|
+
# Set it to an empty list to disable the narrowing entirely.
|
|
99
|
+
#
|
|
100
|
+
# `ptcPresentation` declares this session's tools in PTC mode from the second
|
|
101
|
+
# turn on: the wire collapses to the reserved `run_code` transport and every
|
|
102
|
+
# other tool is reached inside the program through the generated SDK, which the
|
|
103
|
+
# injected catalog names because `minimal-prompt` filters the harness's own
|
|
104
|
+
# `tools:sdk` and `tools:ptc-only` sections out of the prompt. The declaration
|
|
105
|
+
# is per session (`agent.ctx.tools.presentAs`), needs a mounted code runtime,
|
|
106
|
+
# and degrades to the native surface with a one-time warning when either is
|
|
107
|
+
# missing. Set `false` to restore the pre-PTC behavior: the full native roster
|
|
108
|
+
# on the wire from the second turn.
|
|
109
|
+
- id: minimal-prompt
|
|
110
|
+
name: ./minimal-prompt.mjs
|
|
111
|
+
config:
|
|
112
|
+
keepPlanPolicy: true
|
|
113
|
+
instructionSource: system-prompt
|
|
114
|
+
instructionMaxBytes: 65536
|
|
115
|
+
|
|
116
|
+
- id: tool-catalog
|
|
117
|
+
name: ./tool-catalog.mjs
|
|
73
118
|
config:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
deferredGraceSteps: 1
|
|
84
|
-
promotedPresentation: code
|
|
85
|
-
# Issue #388: after promotion, inject one non-imperative hint (reference
|
|
86
|
-
# files exist at these paths; read them on demand) instead of the full
|
|
87
|
-
# AGENTS.md dump — the full-text injection measurably flips the anchored
|
|
88
|
-
# trajectory (upstream dsh-anchored-standard #49, E1/E1.5/E2). Knowledge
|
|
89
|
-
# stays reachable through read / skill_load. Set false to restore the
|
|
90
|
-
# legacy full-text injection.
|
|
91
|
-
instructionHint: true
|
|
92
|
-
# phase1FirstCallInstruction: After your first reasoning block, before answering, make one tool call (for example run `pwd` through the shell or view a workspace file) and base your answer on its result.
|
|
93
|
-
|
|
94
|
-
# Workspace instructions are quarantined by `tool-bootstrap` during phase 1
|
|
95
|
-
# and deferred one step after promotion, then stay current.
|
|
119
|
+
descriptionMaxLength: 200
|
|
120
|
+
anchorTools: [bash]
|
|
121
|
+
ptcPresentation: true
|
|
122
|
+
|
|
123
|
+
# The harness's workspace-instruction loader. Under the default
|
|
124
|
+
# `instructionSource: system-prompt` the content reaches the model through the
|
|
125
|
+
# system prompt instead, and this row's injections are dropped by
|
|
126
|
+
# `minimal-prompt`; the row stays mounted so `instructionSource: hint` keeps
|
|
127
|
+
# its pointer behavior working, and its `maxBytes` remains that mode's budget.
|
|
96
128
|
- id: agent-instructions
|
|
97
129
|
name: '@deepseek-ai/dsh-agent-instructions'
|
|
98
130
|
config:
|
|
99
131
|
maxBytes: 65536
|
|
100
132
|
|
|
101
|
-
# ──
|
|
133
|
+
# ── shell ───────────────────────────────────────────────────────────────────
|
|
102
134
|
|
|
103
135
|
# The PTY registry is an agent-owned service, so it lives in an entry-local
|
|
104
136
|
# realm. The backend still consumes the host sandbox policy and subprocess
|
|
105
137
|
# implementation, while the tool registers into this agent's scoped catalog.
|
|
106
138
|
# This persistent `bash` replaces the Standard ephemeral shell for the WHOLE
|
|
107
|
-
# session (both tools register the name `bash`),
|
|
108
|
-
#
|
|
139
|
+
# session (both tools register the name `bash`), so shell state survives across
|
|
140
|
+
# calls.
|
|
109
141
|
- id: persistent-shell
|
|
110
142
|
name: cordis:group
|
|
111
143
|
group: true
|
|
@@ -138,23 +170,20 @@
|
|
|
138
170
|
# Windows-only `bash` tool (custom-bash.mjs): the PTY backend above is
|
|
139
171
|
# linux/darwin-only, so win32 disables the persistent-shell group and
|
|
140
172
|
# registers this `bash` through the ordinary cross-platform subprocess seam
|
|
141
|
-
# (Git Bash). Both platforms end up with exactly one tool named `bash
|
|
142
|
-
#
|
|
143
|
-
#
|
|
144
|
-
#
|
|
145
|
-
# is optional (defaults to Git Bash inference); set it explicitly when git is
|
|
146
|
-
# not on PATH.
|
|
173
|
+
# (Git Bash). Both platforms end up with exactly one tool named `bash`.
|
|
174
|
+
# Non-zero exit is reported not thrown; state does NOT persist across calls on
|
|
175
|
+
# this path; no OS sandbox confinement on Windows. `bashPath` is optional
|
|
176
|
+
# (defaults to Git Bash inference); set it explicitly when git is not on PATH.
|
|
147
177
|
- id: custom-bash
|
|
148
178
|
name: ./custom-bash.mjs
|
|
149
179
|
disabled: !!js process.platform !== 'win32'
|
|
150
180
|
|
|
151
|
-
# ──
|
|
181
|
+
# ── filesystem ──────────────────────────────────────────────────────────────
|
|
152
182
|
|
|
153
|
-
#
|
|
183
|
+
# The editor is a direct top-level row: it reuses the host's sandboxed
|
|
154
184
|
# `ctx.fs`, not a bare local filesystem. No `dsh-fs-local` realm is mounted, so
|
|
155
|
-
#
|
|
156
|
-
#
|
|
157
|
-
# `str_replace_editor`.
|
|
185
|
+
# it inherits the host file sandbox exactly like every Standard file tool, and
|
|
186
|
+
# the model-facing schema stays the builtin Minimal `str_replace_editor`.
|
|
158
187
|
- id: str-replace-editor
|
|
159
188
|
name: '@deepseek-ai/dsh-tool-str-replace-editor'
|
|
160
189
|
config:
|
|
@@ -189,8 +218,7 @@
|
|
|
189
218
|
# `skill-filesystem` contributes local-root discovery for agents on this preset, and
|
|
190
219
|
# `tool-skill` gives them the catalog and loader; the merged catalog also
|
|
191
220
|
# carries whatever the deployment registered globally (repository plugins).
|
|
192
|
-
# The `skill-catalog` pre-step message
|
|
193
|
-
# during phase 1 and deferred one step after promotion, then stays current.
|
|
221
|
+
# The `skill-catalog` pre-step message stays current like any other injection.
|
|
194
222
|
- id: skill-filesystem
|
|
195
223
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
196
224
|
|
|
@@ -211,7 +239,10 @@
|
|
|
211
239
|
# ── plan mode ───────────────────────────────────────────────────────────────
|
|
212
240
|
|
|
213
241
|
# Plan state is per-agent by nature, so an entry-local realm is not a
|
|
214
|
-
# workaround here — it is the correct lifetime.
|
|
242
|
+
# workaround here — it is the correct lifetime. `minimal-prompt` keeps this
|
|
243
|
+
# row's `plan:policy` section in the otherwise one-line system prompt, because
|
|
244
|
+
# the section is the only thing that enforces plan mode: the exit tool stays
|
|
245
|
+
# registered in every mode and no tool restriction backs the policy.
|
|
215
246
|
- id: planning
|
|
216
247
|
name: cordis:group
|
|
217
248
|
group: true
|
|
@@ -334,8 +365,13 @@
|
|
|
334
365
|
config:
|
|
335
366
|
provider: spawn
|
|
336
367
|
|
|
368
|
+
# Keep the engine above for `ralph`, but do not publish a second
|
|
369
|
+
# model-authored orchestration surface beside `run_code`: this is the one
|
|
370
|
+
# roster difference the builtin `ptc` preset ships with, and the mode's
|
|
371
|
+
# whole promoted surface is run_code.
|
|
337
372
|
- id: tool-workflow
|
|
338
373
|
name: '@deepseek-ai/dsh-tool-workflow'
|
|
374
|
+
disabled: true
|
|
339
375
|
|
|
340
376
|
- id: tool-ralph
|
|
341
377
|
name: '@deepseek-ai/dsh-tool-ralph'
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* custom-bash — a Windows-capable `bash` tool for the liangshen preset. It
|
|
3
|
-
* registers under the SAME name (`bash`) as the persistent shell so
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* registers under the SAME name (`bash`) as the persistent shell so every
|
|
4
|
+
* platform exposes one shell tool of that name, but executes through
|
|
5
|
+
* `ctx.subprocess.spawn` instead of a PTY.
|
|
6
6
|
*
|
|
7
7
|
* WHY: DSH's PTY backend is linux/darwin-only — subprocess-local throws
|
|
8
8
|
* "terminal inspection is unsupported on platform win32", so the
|
|
9
9
|
* persistent-shell group (dsh-terminal + dsh-terminal-bash +
|
|
10
10
|
* dsh-tool-bash-persistent) cannot spawn on Windows. agent.cordis.yml disables
|
|
11
11
|
* that group on win32 and enables this tool instead; both platforms end up
|
|
12
|
-
* with exactly one `bash` tool
|
|
12
|
+
* with exactly one `bash` tool.
|
|
13
13
|
*
|
|
14
14
|
* Executable resolution (config `bashPath`, no hardcoded install path):
|
|
15
15
|
* an explicit non-empty `bashPath` wins unconditionally. Unset, the Git Bash
|