@linxin666/dsh-liangshen 0.1.13

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.
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Sync every preset directory under `sourceRoot` into `targetRoot` — the
3
+ * dsh agent-presets discovery root (harness-home `.agent-presets`).
4
+ *
5
+ * A preset is a directory holding `agent.cordis.yml`; the directory name is
6
+ * the preset id. Copy is per-directory and idempotent: a preset whose target
7
+ * tree is byte-identical to the source tree is skipped, otherwise the source
8
+ * tree is copied and any target files the source does not contain are removed.
9
+ * Directories the plugin does not own (other presets the user authored) are
10
+ * never touched.
11
+ */
12
+ /** One sync run's outcome, grouped for diagnostics. */
13
+ export interface SyncResult {
14
+ /** Preset ids whose tree was (re)written this run. */
15
+ synced: string[];
16
+ /** Preset ids already current — nothing copied. */
17
+ current: string[];
18
+ /** Preset ids that failed, with the underlying error message. */
19
+ failed: {
20
+ id: string;
21
+ error: string;
22
+ }[];
23
+ }
24
+ /** Copy `sourceRoot/<id>` into `targetRoot/<id>`, idempotently. */
25
+ export declare function syncOnePreset(sourceDir: string, targetDir: string): 'synced' | 'current';
26
+ /**
27
+ * Sync every preset under `sourceRoot` into `targetRoot`.
28
+ * @param sourceRoot - plugin-owned preset tree (bundled in the package).
29
+ * @param targetRoot - dsh agent-presets discovery root (e.g. <home>/.dsh/.agent-presets).
30
+ */
31
+ export declare function syncPresetTrees(sourceRoot: string, targetRoot: string): SyncResult;
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
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",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": "^22.19.0 || >=24.0.0"
8
+ },
9
+ "main": "lib/index.js",
10
+ "types": "lib/types/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./lib/types/index.d.ts",
14
+ "default": "./lib/index.js"
15
+ },
16
+ "./package.json": "./package.json",
17
+ "./presets/*": "./presets/*"
18
+ },
19
+ "dsh": {
20
+ "bundle": {
21
+ "patch": "./cordis.patch.yml"
22
+ }
23
+ },
24
+ "dependencies": {
25
+ "schemastery": "^3.18.0"
26
+ },
27
+ "devDependencies": {
28
+ "@deepseek-ai/cordis": "^4.0.1",
29
+ "@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.6",
30
+ "@types/node": "^22.20.0",
31
+ "tsdown": "0.22.2",
32
+ "typescript": "~5.7.2",
33
+ "vitest": "^3.0.0"
34
+ },
35
+ "files": [
36
+ "lib/**/*.js",
37
+ "lib/**/*.js.map",
38
+ "lib/**/*.d.ts",
39
+ "lib/**/*.d.ts.map",
40
+ "src",
41
+ "presets",
42
+ "tools",
43
+ "cordis.patch.yml",
44
+ "README.md",
45
+ "README.zh.md",
46
+ "LICENSE"
47
+ ],
48
+ "license": "Apache-2.0",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "https://github.com/zhu1090093659/dsh-web-ui.git"
52
+ },
53
+ "scripts": {
54
+ "build": "tsc -p tsconfig.build.json && tsdown",
55
+ "bundle": "tsdown",
56
+ "watch": "tsdown --watch",
57
+ "typecheck": "tsc --noEmit",
58
+ "test": "vitest run",
59
+ "test:watch": "vitest"
60
+ }
61
+ }
@@ -0,0 +1,3 @@
1
+ agent.cordis.yml 改编自 DeepSeek Harness Standard preset(MIT)。
2
+ tool-bootstrap.mjs 来自 https://github.com/xiaobright/dsh-anchored-standard(MIT)。
3
+ 原始 DeepSeek 版权和 MIT 许可声明见开源仓库。
@@ -0,0 +1,289 @@
1
+ # The `liangshen` (梁神模式) agent preset: full Standard capabilities with a
2
+ # two-phase input bootstrap — the first model request sees only the platform
3
+ # shell plus `read`, only the one-line persona prompt section, no runtime
4
+ # contexts, and no injected pre-step messages (Minimal-aligned trajectory
5
+ # anchor); the full catalog, every prompt section, and the ordinary
6
+ # runtime/workspace/skill injections return after the first durable tool call.
7
+ # Adapted from the builtin `standard` preset.
8
+ #
9
+ # This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
10
+ # standing scope; every session naming it joins by scope parentage, so the
11
+ # tools and prompt sections registered here cover each joined agent while a
12
+ # session's own state stays keyed per Session/Agent inside the plugins. The
13
+ # host composition (`base.cordis.yml` + `web.cordis.yml`) keeps everything a
14
+ # preset must not own: the registries themselves, the sandbox and approval
15
+ # stack, persistence, and the model route.
16
+ #
17
+ # A service row here MUST sit inside a group carrying an `isolate` realm.
18
+ # Without one it publishes into the root realm, where it is process-global —
19
+ # another preset publishing the same name collides, and a host reader would
20
+ # resolve one preset's instance for every session; `dsh-agent-presets` rejects
21
+ # that at mount. `true` means an entry-local realm: this standing mount's own
22
+ # private instance, apart from every other preset's. (A shared label does NOT
23
+ # pool instances — `provide()` throws on the second registration under the
24
+ # same realm symbol; labels join REALMS, and are not what this file needs.)
25
+
26
+ # ── identity ────────────────────────────────────────────────────────────────
27
+
28
+ # Phase 1 shows only this one-line persona: `tool-bootstrap` filters the
29
+ # assembled sections down to `persona` during phase 1 and restores every
30
+ # section after promotion, so plan-mode's `plan:policy` takes effect instead
31
+ # of being permanently shadowed by a `complete` persona.
32
+ - id: persona
33
+ name: '@deepseek-ai/dsh-persona'
34
+ config:
35
+ text: You are a helpful software engineer assistant.
36
+
37
+ # Two-phase input bootstrap. Before the session's first durable tool/call event
38
+ # the first model request sees exactly one platform shell plus `read`, only the
39
+ # `persona` prompt section, no runtime contexts, and only direct user messages;
40
+ # after that event every Standard tool below, all assembled prompt sections
41
+ # (including plan-mode's `plan:policy`), and the ordinary
42
+ # runtime/workspace/skill injections become visible. `anchorGate` holds the
43
+ # promotion open until the first reasoning block is minimal-like (with a
44
+ # four-step fallback), so a `Let me` first block does not immediately earn the
45
+ # full catalog. `promoteAfterFirstResponse` avoids a permanent two-tool
46
+ # session when the first response calls no tool, and releases an anchor-gated
47
+ # session once its first turn ends (`turn/end`). After promotion the catalog
48
+ # is presented as Code Mode (PTC): a single `run_code` tool on the wire,
49
+ # switched at the step boundary. Workspace instructions and the skill catalog
50
+ # are additionally deferred for one step after promotion (`deferredSources`).
51
+ - id: tool-bootstrap
52
+ name: ./tool-bootstrap.mjs
53
+ config:
54
+ shellTools: [bash, pwsh]
55
+ commonTools: [read]
56
+ messageSources: [user]
57
+ anchorGate: true
58
+ maxBootstrapSteps: 4
59
+ promoteAfterFirstResponse: true
60
+ deferredSources: [agent-instructions, skill-catalog]
61
+ deferredGraceSteps: 1
62
+ promotedPresentation: code
63
+
64
+ # Workspace instructions are quarantined by `tool-bootstrap` during phase 1
65
+ # and deferred one step after promotion, then stay current.
66
+ - id: agent-instructions
67
+ name: '@deepseek-ai/dsh-agent-instructions'
68
+ config:
69
+ maxBytes: 65536
70
+
71
+ # ── shell ───────────────────────────────────────────────────────────────────
72
+
73
+ # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
74
+ # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
75
+ # the criterion for host-plane ownership — injection resolves before any session
76
+ # exists, so there is no agent to key by. Behind a preset realm those variables
77
+ # never reached the model's shell at all. Both shell tools consume the host
78
+ # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
79
+ # host-plane too.
80
+ - id: tool-bash
81
+ name: '@deepseek-ai/dsh-tool-bash'
82
+ disabled: !!js process.platform === 'win32'
83
+
84
+ - id: tool-pwsh
85
+ name: '@deepseek-ai/dsh-tool-pwsh'
86
+ disabled: !!js process.platform !== 'win32'
87
+
88
+ # ── filesystem ──────────────────────────────────────────────────────────────
89
+
90
+ # Both register into the host `tools` registry and provide nothing, so
91
+ # they need no realm. The `fs` service and its policy stay in the host.
92
+ - id: tool-fs
93
+ name: '@deepseek-ai/dsh-tool-fs'
94
+
95
+ - id: tool-fs-search
96
+ name: '@deepseek-ai/dsh-tool-fs-search'
97
+ config:
98
+ sampleOverCapGlobResults: false
99
+
100
+ # ── background jobs ────────────────────────────────────────────────────────
101
+
102
+ # Only the model-facing controls. The task REGISTRY stays on the host plane:
103
+ # its producers sit outside any realm this file could put it in — `tool-bash`
104
+ # above resolves it with `ctx.get`, and an entry-local realm here is invisible
105
+ # to every sibling row, so `run_in_background` would answer "background jobs
106
+ # unavailable" while these controls sat in the catalog. The registry is keyed by
107
+ # owning agent anyway, so one host instance serves every session. What a preset
108
+ # chooses is whether its agent can collect and stop background work at all.
109
+ - id: tool-jobs
110
+ name: '@deepseek-ai/dsh-tool-jobs'
111
+
112
+ # ── skills ──────────────────────────────────────────────────────────────────
113
+
114
+ # The skill REGISTRY lives in the host composition and is layered per scope:
115
+ # these rows register into THIS preset's layer of it, so they need no realm.
116
+ # `skill-filesystem` contributes local-root discovery for agents on this preset, and
117
+ # `tool-skill` gives them the catalog and loader; the merged catalog also
118
+ # carries whatever the deployment registered globally (repository plugins).
119
+ # The `skill-catalog` pre-step message is quarantined by `tool-bootstrap`
120
+ # during phase 1 and deferred one step after promotion, then stays current.
121
+ - id: skill-filesystem
122
+ name: '@deepseek-ai/dsh-skill-filesystem'
123
+
124
+ - id: tool-skill
125
+ name: '@deepseek-ai/dsh-tool-skill'
126
+
127
+ # ── goals ───────────────────────────────────────────────────────────────────
128
+
129
+ # Only the model-facing tool. The goal SERVICE, its session driver, and the
130
+ # `/goal` command stay on the host plane: the Gateway serves the goal domain as
131
+ # Remote endpoints whose receiver comes from a generated descriptor, so it
132
+ # resolves `goals` on the host and an entry-local realm here would hide it. The
133
+ # registry is keyed by session anyway, so one host instance serves every
134
+ # session. What a preset chooses is whether its agent can call the goal tool.
135
+ - id: tool-goal
136
+ name: '@deepseek-ai/dsh-tool-goal'
137
+
138
+ # ── plan mode ───────────────────────────────────────────────────────────────
139
+
140
+ # Plan state is per-agent by nature, so an entry-local realm is not a
141
+ # workaround here — it is the correct lifetime.
142
+ - id: planning
143
+ name: cordis:group
144
+ group: true
145
+ isolate:
146
+ planMode: true
147
+ config:
148
+ - id: plan-mode
149
+ name: '@deepseek-ai/dsh-plan-mode'
150
+ config:
151
+ section: |
152
+ You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
153
+
154
+ Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
155
+
156
+ The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
157
+
158
+ Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
159
+
160
+ Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
161
+
162
+ When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
163
+
164
+ # ── compaction ──────────────────────────────────────────────────────────────
165
+
166
+ # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
167
+ # share this realm rather than sit outside it.
168
+ #
169
+ # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
170
+ # plane, and the rows here resolve that one instance. It takes no configuration,
171
+ # keys every fold by Session, and owns the context-meter projection units the
172
+ # browser reads for every session — behind a realm those units would come and go
173
+ # with whichever presets happen to be mounted. What a preset chooses is whether
174
+ # its agent compacts at all, which is `compaction-basic` below.
175
+ - id: compaction
176
+ name: cordis:group
177
+ group: true
178
+ isolate:
179
+ compaction: true
180
+ toolResultPruner: true
181
+ config:
182
+ - id: compaction-basic
183
+ name: '@deepseek-ai/dsh-compaction-basic'
184
+
185
+ - id: command-compact
186
+ name: '@deepseek-ai/dsh-command-compact'
187
+
188
+ - id: tool-result-pruner
189
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
190
+ config:
191
+ thresholdChars: 8192
192
+ headChars: 4096
193
+ tailChars: 1024
194
+
195
+ # ── delegation and workflows ────────────────────────────────────────────────
196
+
197
+ # The `subagents` registry and its spawn/fork backends live in the HOST
198
+ # composition: the registry is a process singleton whose cross-session queries
199
+ # the api-proxy serves to the browser, and a provider name may only be
200
+ # registered once. This preset contributes the delegation TOOLS, which resolve
201
+ # that host registry.
202
+ #
203
+ # `workflows` is different — nothing outside an agent reads it — so every row
204
+ # that reaches it shares one entry-local realm here, and a consumer left
205
+ # outside would resolve a host registry this preset does not populate.
206
+ #
207
+ # `tool-subagent-report` is host-plane for the same reason as the registry,
208
+ # not because a preset may not want it: it registers a CONTINUABLE SETUP on
209
+ # that singleton rather than a tool this agent calls, and the setup list is
210
+ # not scope-aware — one copy per mounted preset means every child gets
211
+ # `report` registered once per live session, which throws on the second.
212
+ - id: delegation
213
+ name: cordis:group
214
+ group: true
215
+ isolate:
216
+ workflowEngine: true
217
+ config:
218
+ - id: tool-subagent-control
219
+ name: '@deepseek-ai/dsh-tool-subagent-control'
220
+
221
+ - id: tool-subagent-list-agents
222
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
223
+
224
+ - id: tool-subagent
225
+ name: '@deepseek-ai/dsh-tool-subagent'
226
+ config:
227
+ provider: spawn
228
+ toolName: subagent
229
+ backgroundMode: continuable
230
+
231
+ - id: tool-subagent-fork
232
+ name: '@deepseek-ai/dsh-tool-subagent'
233
+ config:
234
+ provider: fork
235
+ toolName: subagent_fork
236
+ backgroundMode: continuable
237
+
238
+ # Product providers are host-plane singletons. Copy this preset, then
239
+ # remove `disabled` from either ordinary tool row to expose that product
240
+ # only to agents composed from the copy.
241
+ - id: tool-subagent-codex
242
+ name: '@deepseek-ai/dsh-tool-subagent'
243
+ disabled: true
244
+ config:
245
+ provider: codex
246
+ toolName: subagent_codex
247
+ enableRunInBackground: false
248
+ maxDepth: provider-managed
249
+
250
+ - id: tool-subagent-claude-code
251
+ name: '@deepseek-ai/dsh-tool-subagent'
252
+ disabled: true
253
+ config:
254
+ provider: claude-code
255
+ toolName: subagent_claude_code
256
+ enableRunInBackground: false
257
+ maxDepth: provider-managed
258
+
259
+ - id: workflow-worker-thread
260
+ name: '@deepseek-ai/dsh-workflow-worker-thread'
261
+ config:
262
+ provider: spawn
263
+
264
+ - id: tool-workflow
265
+ name: '@deepseek-ai/dsh-tool-workflow'
266
+
267
+ - id: tool-ralph
268
+ name: '@deepseek-ai/dsh-tool-ralph'
269
+ config:
270
+ subagentProvider: spawn
271
+ maxRounds: 64
272
+
273
+ # ── remaining model-facing rows ─────────────────────────────────────────────
274
+
275
+ - id: tool-ask-user
276
+ name: '@deepseek-ai/dsh-tool-ask-user'
277
+
278
+ - id: tool-todo
279
+ name: '@deepseek-ai/dsh-tool-todo'
280
+ config:
281
+ allowParallelInProgress: true
282
+
283
+ # The `web` service and its search provider stay in the host composition; only
284
+ # the model-facing tool is per-session.
285
+ - id: tool-web
286
+ name: '@deepseek-ai/dsh-tool-web'
287
+ config:
288
+ fetch: false
289
+ searchTimeoutMs: 60000
@@ -0,0 +1,3 @@
1
+ name: 梁神模式
2
+ description: 首轮极简锚定:仅平台 shell 与 read,无运行时上下文与指令注入;首次工具调用后恢复完整 Standard 能力。
3
+ order: 4