dsh-gitbash-shell 0.5.4 → 0.6.0

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.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # dsh-gitbash-shell
2
2
 
3
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
4
+
3
5
  > 让 DeepSeek Harness (dsh) 在 Windows 上**全部使用 Git Bash** 的官方风格插件
4
6
  > —— 以 Git for Windows 的 `bash.exe` 替换 PowerShell 执行器,并为所有模式
5
7
  > 物化对应的 Git Bash 版 agent preset。
@@ -24,6 +26,17 @@
24
26
  Git Bash host 下会拿到"暗示 PowerShell 语法的工具",请改用上面的变体;
25
27
  已装 dsh-ptc-cordis-preset 的话,`PTC 创造模式` 用户 preset 不受影响。
26
28
 
29
+ ### dsh 版本双适配(0.1.1 与 0.1.2+)
30
+
31
+ dsh 0.1.2 把内置 `code` preset 改名为 `ptc`(`mode: code` → `mode: ptc`,官方不做
32
+ 兼容别名),并给各内置 preset 新增 `command-goal` 等行。本插件为受影响的变体
33
+ (standard/code/cordis)**同时携带两个 era 的已提交组合文本**,启动时探测内置
34
+ roster 自动选择,并记进 `.plugin-managed.json` 的 `base` 字段;探测翻转(dsh
35
+ 升级前后)自动重物化。`minimal-gitbash` 的内置底稿跨版本未变,单文本服务两个
36
+ era。**preset id 保持 `code-gitbash` 不变**(会话钉在 id 上,改名会让已固定的
37
+ 会话报 preset not found)。无论先升级插件还是先升级 dsh,都会自动收敛;用户改
38
+ 过的目录照旧不碰。
39
+
27
40
  ## 安装(公开 npm 插件,推荐)
28
41
 
29
42
  npm: [dsh-gitbash-shell](https://www.npmjs.com/package/dsh-gitbash-shell),
package/README_EN.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # dsh-gitbash-shell
2
2
 
3
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
4
+
3
5
  > Run **every agent shell command through Git Bash** on Windows with DeepSeek
4
6
  > Harness (dsh) — replaces the PowerShell executor and materializes Git Bash
5
7
  > variants of all four agent presets.
@@ -14,6 +16,19 @@ dsh plugin --profile web add dsh-gitbash-shell
14
16
  `dsh.bundle` declaration, appends the package to `dsh.profile.bundles`.
15
17
  **Restart the profile's host to activate.**
16
18
 
19
+ ## Works with both dsh 0.1.1 and 0.1.2+
20
+
21
+ dsh 0.1.2 renamed the built-in `code` preset to `ptc` (`mode: code` → `mode: ptc`,
22
+ no compatibility aliases) and added new built-in rows (`command-goal`, …). For
23
+ the affected variants (standard/code/cordis) this plugin **ships both committed
24
+ era texts**, probes the built-in roster at every boot, records the choice in
25
+ `.plugin-managed.json` (`base`), and re-materializes automatically when the
26
+ detection flips. `minimal-gitbash`'s built-in base did not change across the
27
+ rename, so one text serves both eras. **Preset ids never change**
28
+ (`code-gitbash` keeps its historical id — sessions are pinned to ids, and a
29
+ rename would orphan them). Either upgrade order converges automatically; directories
30
+ you modified are still never touched.
31
+
17
32
  ## What it does
18
33
 
19
34
  The bundle patch (`cordis.patch.yml`):
@@ -0,0 +1,273 @@
1
+ # ERA: dsh >= 0.1.2 text (built-in preset id `ptc`, presented with mode: ptc).
2
+ # The dsh <= 0.1.1 era text (built-in id `code`) lives in agent.cordis.yml; the
3
+ # plugin probes the roster at materialization and writes the picked text as the
4
+ # preset's own agent.cordis.yml.
5
+ # The `ptc` agent preset: the standard coding agent, presented as PTC mode.
6
+ #
7
+ # Everything in `standard` is here unchanged. What is added is the `tool-presentation`
8
+ # row: instead of one tool call per action, the model writes a TypeScript
9
+ # program against a generated SDK and `run_code` executes it, so a sequence
10
+ # that would be five round trips becomes one.
11
+ #
12
+ # The registry itself stays on the host plane — the agent loop's scheduler and
13
+ # the API proxy's presenters are its consumers — so what this preset owns is
14
+ # the PRESENTATION of that registry for this agent alone. Native sessions run
15
+ # beside this one in the same process, each seeing its own catalog.
16
+ #
17
+ # This file is an AGENT-PLANE composition. It is mounted under one agent's
18
+ # scope context, so every tool and prompt section it registers belongs to that
19
+ # session alone. The host composition (`base.cordis.yml` + `web.cordis.yml`)
20
+ # keeps everything a preset must not own: the registries themselves, the
21
+ # sandbox and approval stack, persistence, and the model route.
22
+ #
23
+ # A service row here MUST sit inside a group carrying an `isolate` realm.
24
+ # Without one it publishes into the root realm, where it is process-global
25
+ # rather than per-session and the second session mounting this preset collides
26
+ # with the first; `dsh-agent-presets` rejects that at mount. `true` means an
27
+ # entry-local realm — one private instance per mounted session, which is the
28
+ # default this deployment wants. A shared label would instead pool one instance
29
+ # across every session naming it.
30
+
31
+ # ── identity ────────────────────────────────────────────────────────────────
32
+
33
+ # The preset's own persona, shadowing the deployment default for this agent.
34
+ # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
35
+ - id: persona
36
+ name: '@deepseek-ai/dsh-persona'
37
+ config:
38
+ text: >-
39
+ You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
40
+
41
+ - id: agent-instructions
42
+ name: '@deepseek-ai/dsh-agent-instructions'
43
+ config:
44
+ maxBytes: 65536
45
+
46
+ # ── shell ───────────────────────────────────────────────────────────────────
47
+
48
+ # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
49
+ # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
50
+ # the criterion for host-plane ownership — injection resolves before any session
51
+ # exists, so there is no agent to key by. Behind a preset realm those variables
52
+ # never reached the model's shell at all. Both shell tools consume the host
53
+ # registry from here; the host executor is the Git Bash provider (`dsh-gitbash-shell`)
54
+ # host-plane too.
55
+ - id: tool-bash
56
+ name: '@deepseek-ai/dsh-tool-bash'
57
+ # Git Bash on Windows: the host executor is dsh-gitbash-shell (see $DSH_HOME/cordis.patch.yml).
58
+ disabled: false
59
+
60
+ - id: tool-pwsh
61
+ name: '@deepseek-ai/dsh-tool-pwsh'
62
+ disabled: true
63
+
64
+ # ── filesystem ──────────────────────────────────────────────────────────────
65
+
66
+ # Both register into the host `tools` registry and provide nothing, so
67
+ # they need no realm. The `fs` service and its policy stay in the host.
68
+ - id: tool-fs
69
+ name: '@deepseek-ai/dsh-tool-fs'
70
+
71
+ - id: tool-fs-search
72
+ name: '@deepseek-ai/dsh-tool-fs-search'
73
+ config:
74
+ sampleOverCapGlobResults: false
75
+
76
+ # ── background jobs ────────────────────────────────────────────────────────
77
+
78
+ # Only the model-facing controls. The task REGISTRY stays on the host plane:
79
+ # its producers sit outside any realm this file could put it in — `tool-bash`
80
+ # above resolves it with `ctx.get`, and an entry-local realm here is invisible
81
+ # to every sibling row, so `run_in_background` would answer "background jobs
82
+ # unavailable" while these controls sat in the catalog. The registry is keyed by
83
+ # owning agent anyway, so one host instance serves every session. What a preset
84
+ # chooses is whether its agent can collect and stop background work at all.
85
+ - id: tool-jobs
86
+ name: '@deepseek-ai/dsh-tool-jobs'
87
+
88
+ # ── skills ──────────────────────────────────────────────────────────────────
89
+
90
+ # The skill REGISTRY lives in the host composition and is layered per scope:
91
+ # these rows register into THIS preset's layer of it, so they need no realm.
92
+ # `skill-filesystem` contributes local-root discovery for agents on this preset, and
93
+ # `tool-skill` gives them the catalog and loader; the merged catalog also
94
+ # carries whatever the deployment registered globally (repository plugins).
95
+ - id: skill-filesystem
96
+ name: '@deepseek-ai/dsh-skill-filesystem'
97
+
98
+ - id: tool-skill
99
+ name: '@deepseek-ai/dsh-tool-skill'
100
+
101
+ # ── goals ───────────────────────────────────────────────────────────────────
102
+
103
+ # The goal service and session driver stay on the host plane, where the Gateway
104
+ # can resolve them. The human command and model-facing tool register into this
105
+ # preset's scoped layers.
106
+ - id: command-goal
107
+ name: '@deepseek-ai/dsh-command-goal'
108
+
109
+ - id: tool-goal
110
+ name: '@deepseek-ai/dsh-tool-goal'
111
+
112
+ # ── plan mode ───────────────────────────────────────────────────────────────
113
+
114
+ # Plan state is per-agent by nature, so an entry-local realm is not a
115
+ # workaround here — it is the correct lifetime.
116
+ - id: planning
117
+ name: cordis:group
118
+ group: true
119
+ isolate:
120
+ planMode: true
121
+ config:
122
+ - id: plan-mode
123
+ name: '@deepseek-ai/dsh-plan-mode'
124
+ config:
125
+ section: |
126
+ 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.
127
+
128
+ 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.
129
+
130
+ 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.
131
+
132
+ 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.
133
+
134
+ 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.
135
+
136
+ 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.
137
+
138
+ # ── compaction ──────────────────────────────────────────────────────────────
139
+
140
+ # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
141
+ # share this realm rather than sit outside it.
142
+ #
143
+ # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
144
+ # plane, and the rows here resolve that one instance. It takes no configuration,
145
+ # keys every fold by Session, and owns the context-meter projection units the
146
+ # browser reads for every session — behind a realm those units would come and go
147
+ # with whichever presets happen to be mounted. What a preset chooses is whether
148
+ # its agent compacts at all, which is `compaction-basic` below.
149
+ - id: compaction
150
+ name: cordis:group
151
+ group: true
152
+ isolate:
153
+ compaction: true
154
+ toolResultPruner: true
155
+ config:
156
+ - id: compaction-basic
157
+ name: '@deepseek-ai/dsh-compaction-basic'
158
+
159
+ - id: command-compact
160
+ name: '@deepseek-ai/dsh-command-compact'
161
+
162
+ - id: tool-result-pruner
163
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
164
+ config:
165
+ thresholdChars: 8192
166
+ headChars: 4096
167
+ tailChars: 1024
168
+
169
+ # ── delegation and workflows ────────────────────────────────────────────────
170
+
171
+ # The `subagents` registry and its spawn/fork backends live in the HOST
172
+ # composition: the registry is a process singleton whose cross-session queries
173
+ # the api-proxy serves to the browser, and a provider name may only be
174
+ # registered once. This preset contributes the delegation TOOLS, which resolve
175
+ # that host registry.
176
+ #
177
+ # `workflows` is different — nothing outside an agent reads it — so every row
178
+ # that reaches it shares one entry-local realm here, and a consumer left
179
+ # outside would resolve a host registry this preset does not populate.
180
+ - id: delegation
181
+ name: cordis:group
182
+ group: true
183
+ isolate:
184
+ workflowEngine: true
185
+ config:
186
+ - id: tool-subagent-control
187
+ name: '@deepseek-ai/dsh-tool-subagent-control'
188
+
189
+ - id: tool-subagent-list-agents
190
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
191
+
192
+ - id: tool-subagent
193
+ name: '@deepseek-ai/dsh-tool-subagent'
194
+ config:
195
+ provider: spawn
196
+ toolName: subagent
197
+ modelSelectionSettings: true
198
+ backgroundMode: continuable
199
+
200
+ # Fork omits model selection so provider/model stay equal to the parent and
201
+ # the inherited history remains eligible for KV Cache reuse. This preset
202
+ # keeps fork continuable and accepts its child-scoped `report` additions invalidating
203
+ # that prefix; issue #2124 tracks cache-preserving continuable fork.
204
+ - id: tool-subagent-fork
205
+ name: '@deepseek-ai/dsh-tool-subagent'
206
+ config:
207
+ provider: fork
208
+ toolName: subagent_fork
209
+ backgroundMode: continuable
210
+
211
+ # Production dsh does not install these optional providers. Install the
212
+ # matching Bundle in this Profile and restart the Host, then copy this
213
+ # preset and remove `disabled` from the matching tool row. Host availability
214
+ # alone grants no tool.
215
+ - id: tool-subagent-codex
216
+ name: '@deepseek-ai/dsh-tool-subagent'
217
+ disabled: true
218
+ config:
219
+ provider: codex
220
+ toolName: subagent_codex
221
+ backgroundMode: one-shot
222
+ maxDepth: provider-managed
223
+
224
+ - id: tool-subagent-claude-code
225
+ name: '@deepseek-ai/dsh-tool-subagent'
226
+ disabled: true
227
+ config:
228
+ provider: claude-code
229
+ toolName: subagent_claude_code
230
+ backgroundMode: one-shot
231
+ maxDepth: provider-managed
232
+
233
+ - id: workflow-worker-thread
234
+ name: '@deepseek-ai/dsh-workflow-worker-thread'
235
+ config:
236
+ provider: spawn
237
+
238
+ - id: tool-workflow
239
+ name: '@deepseek-ai/dsh-tool-workflow'
240
+
241
+ - id: tool-ralph
242
+ name: '@deepseek-ai/dsh-tool-ralph'
243
+ config:
244
+ subagentProvider: spawn
245
+ maxRounds: 64
246
+
247
+ # ── remaining model-facing rows ─────────────────────────────────────────────
248
+
249
+ - id: tool-ask-user
250
+ name: '@deepseek-ai/dsh-tool-ask-user'
251
+
252
+ - id: tool-todo
253
+ name: '@deepseek-ai/dsh-tool-todo'
254
+ config:
255
+ allowParallelInProgress: true
256
+
257
+ # The `web` service and its search provider stay in the host composition; only
258
+ # the model-facing tool is per-session.
259
+ - id: tool-web
260
+ name: '@deepseek-ai/dsh-tool-web'
261
+ config:
262
+ fetch: true
263
+ searchTimeoutMs: 60000
264
+
265
+ # ── presentation ────────────────────────────────────────────────────────────
266
+
267
+ # PTC mode for this agent alone. The row waits for the host's `codeRuntime`
268
+ # rather than assuming it: a deployment that composes no TypeScript runtime
269
+ # fails this preset at mount, naming this id, instead of at the first request.
270
+ - id: tool-presentation
271
+ name: '@deepseek-ai/dsh-agent-tool-presentation'
272
+ config:
273
+ mode: ptc
@@ -1,3 +1,7 @@
1
+ # ERA: dsh <= 0.1.1 text (built-in preset id `code`, presented with mode: code).
2
+ # The dsh >= 0.1.2 era text (built-in id `ptc`) lives in agent.cordis.ptc.yml; the
3
+ # plugin probes the roster at materialization and writes the picked text as the
4
+ # preset's own agent.cordis.yml.
1
5
  # The `code` agent preset: the standard coding agent, presented as Code Mode.
2
6
  #
3
7
  # Everything in `standard` is here unchanged. What is added is the `tool-presentation`
@@ -1,3 +1,3 @@
1
1
  name: PTC 模式 · Git Bash
2
- description: 具备标准模式的全部能力,并通过 Code Mode SDK 呈现工具,让模型用一个 TypeScript 程序组合多步操作。(Shell 使用 Git Bash)
2
+ description: 具备标准模式的全部能力,并通过 PTC 模式 SDK 呈现工具,让模型用一个 TypeScript 程序组合多步操作。(Shell 使用 Git Bash)
3
3
  order: 2
@@ -0,0 +1,273 @@
1
+ # ERA: dsh >= 0.1.2 text (renamed built-in rows, incl. the new `command-goal`).
2
+ # The dsh <= 0.1.1 era text lives in agent.cordis.yml; the plugin probes the
3
+ # roster at materialization and writes the picked text as the preset's own
4
+ # agent.cordis.yml.
5
+ # The `cordis` agent preset: the standard coding agent, plus the ability to
6
+ # read and write the runtime it is running in.
7
+ #
8
+ # It exists so a person can ask an agent to author another agent. Everything in
9
+ # `standard` is here unchanged; what is added is the self-referential Cordis
10
+ # toolset, a skill that teaches composition authoring, and a persona that says
11
+ # which of the two planes an edit belongs to.
12
+ #
13
+ # TRUST: `cordis_mount` evaluates model-written JavaScript against the live
14
+ # runtime, and a composition this agent writes becomes a preset other sessions
15
+ # mount. Treat a session on this preset as shell access — the toolset's own
16
+ # documentation makes the same statement.
17
+
18
+
19
+ # The preset's own persona, shadowing the deployment default for this agent.
20
+ # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
21
+ - id: persona
22
+ name: '@deepseek-ai/dsh-persona'
23
+ config:
24
+ text: |-
25
+ You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness. Your working directory is {{cwd}}.
26
+
27
+ You can read and modify the harness you run on. Its composition is Cordis: every capability is a plugin row in a `cordis.yml`, and an agent preset is one such file mounted for a single session.
28
+
29
+ Two planes decide where an edit belongs. The HOST composition holds the registries and anything shared across sessions — persistence, the sandbox and approval stack, the model route, the subagent registry and its backends. An AGENT PRESET holds what one session contributes to those registries: its tools, its persona, its prompt sections. A row that publishes a service belongs in the host composition, or inside an `isolate` realm if the preset genuinely owns that service and nothing outside one agent reads it.
30
+
31
+ Presets you author live one directory per preset under `${DSH_HOME:-$HOME/.dsh}/.agent-presets/<id>/`; the roster reports each preset's real path, so take the one you edit from there. NEVER edit or delete the shipped preset install (the `agent-presets` directory beside the deployment's own config): it belongs to the deployment, an upgrade overwrites it, and corrupting the `cordis` preset would disable this very mode. To change what a shipped preset does, copy its composition into a new preset directory and edit the copy.
32
+
33
+ Load the `editing-cordis-compositions` skill before writing or changing a composition.
34
+
35
+ - id: agent-instructions
36
+ name: '@deepseek-ai/dsh-agent-instructions'
37
+ config:
38
+ maxBytes: 65536
39
+
40
+ # ── shell ───────────────────────────────────────────────────────────────────
41
+
42
+ # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
43
+ # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
44
+ # the criterion for host-plane ownership — injection resolves before any session
45
+ # exists, so there is no agent to key by. Behind a preset realm those variables
46
+ # never reached the model's shell at all. Both shell tools consume the host
47
+ # registry from here; the host executor is the Git Bash provider (`dsh-gitbash-shell`)
48
+ # host-plane too.
49
+ - id: tool-bash
50
+ name: '@deepseek-ai/dsh-tool-bash'
51
+ # Git Bash on Windows: the host executor is dsh-gitbash-shell (see $DSH_HOME/cordis.patch.yml).
52
+ disabled: false
53
+
54
+ - id: tool-pwsh
55
+ name: '@deepseek-ai/dsh-tool-pwsh'
56
+ disabled: true
57
+
58
+ # ── filesystem ──────────────────────────────────────────────────────────────
59
+
60
+ # Both register into the host `tools` registry and provide nothing, so
61
+ # they need no realm. The `fs` service and its policy stay in the host.
62
+ - id: tool-fs
63
+ name: '@deepseek-ai/dsh-tool-fs'
64
+
65
+ - id: tool-fs-search
66
+ name: '@deepseek-ai/dsh-tool-fs-search'
67
+ config:
68
+ sampleOverCapGlobResults: false
69
+
70
+ # ── background jobs ────────────────────────────────────────────────────────
71
+
72
+ # Only the model-facing controls. The task REGISTRY stays on the host plane:
73
+ # its producers sit outside any realm this file could put it in — `tool-bash`
74
+ # above resolves it with `ctx.get`, and an entry-local realm here is invisible
75
+ # to every sibling row, so `run_in_background` would answer "background jobs
76
+ # unavailable" while these controls sat in the catalog. The registry is keyed by
77
+ # owning agent anyway, so one host instance serves every session. What a preset
78
+ # chooses is whether its agent can collect and stop background work at all.
79
+ - id: tool-jobs
80
+ name: '@deepseek-ai/dsh-tool-jobs'
81
+
82
+ # ── goals ───────────────────────────────────────────────────────────────────
83
+
84
+ # The goal service and session driver stay on the host plane, where the Gateway
85
+ # can resolve them. The human command and model-facing tool register into this
86
+ # preset's scoped layers.
87
+ - id: command-goal
88
+ name: '@deepseek-ai/dsh-command-goal'
89
+
90
+ - id: tool-goal
91
+ name: '@deepseek-ai/dsh-tool-goal'
92
+
93
+ # ── plan mode ───────────────────────────────────────────────────────────────
94
+
95
+ # Plan state is per-agent by nature, so an entry-local realm is not a
96
+ # workaround here — it is the correct lifetime.
97
+ - id: planning
98
+ name: cordis:group
99
+ group: true
100
+ isolate:
101
+ planMode: true
102
+ config:
103
+ - id: plan-mode
104
+ name: '@deepseek-ai/dsh-plan-mode'
105
+ config:
106
+ section: |
107
+ 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.
108
+
109
+ 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.
110
+
111
+ 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.
112
+
113
+ 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.
114
+
115
+ 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.
116
+
117
+ 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.
118
+
119
+ # ── compaction ──────────────────────────────────────────────────────────────
120
+
121
+ # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
122
+ # share this realm rather than sit outside it.
123
+ #
124
+ # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
125
+ # plane, and the rows here resolve that one instance. It takes no configuration,
126
+ # keys every fold by Session, and owns the context-meter projection units the
127
+ # browser reads for every session — behind a realm those units would come and go
128
+ # with whichever presets happen to be mounted. What a preset chooses is whether
129
+ # its agent compacts at all, which is `compaction-basic` below.
130
+ - id: compaction
131
+ name: cordis:group
132
+ group: true
133
+ isolate:
134
+ compaction: true
135
+ toolResultPruner: true
136
+ config:
137
+ - id: compaction-basic
138
+ name: '@deepseek-ai/dsh-compaction-basic'
139
+
140
+ - id: command-compact
141
+ name: '@deepseek-ai/dsh-command-compact'
142
+
143
+ - id: tool-result-pruner
144
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
145
+ config:
146
+ thresholdChars: 8192
147
+ headChars: 4096
148
+ tailChars: 1024
149
+
150
+ # ── delegation and workflows ────────────────────────────────────────────────
151
+
152
+ # The `subagents` registry and its spawn/fork backends live in the HOST
153
+ # composition: the registry is a process singleton whose cross-session queries
154
+ # the api-proxy serves to the browser, and a provider name may only be
155
+ # registered once. This preset contributes the delegation TOOLS, which resolve
156
+ # that host registry.
157
+ #
158
+ # `workflows` is different — nothing outside an agent reads it — so every row
159
+ # that reaches it shares one entry-local realm here, and a consumer left
160
+ # outside would resolve a host registry this preset does not populate.
161
+ #
162
+ # `tool-subagent-report` is host-plane for the same reason as the registry,
163
+ # not because a preset may not want it: it registers a CONTINUABLE SETUP on
164
+ # that singleton rather than a tool this agent calls, and the setup list is
165
+ # not scope-aware — one copy per mounted preset means every child gets
166
+ # `report` registered once per live session, which throws on the second.
167
+ - id: delegation
168
+ name: cordis:group
169
+ group: true
170
+ isolate:
171
+ workflowEngine: true
172
+ config:
173
+ - id: tool-subagent-control
174
+ name: '@deepseek-ai/dsh-tool-subagent-control'
175
+
176
+ - id: tool-subagent-list-agents
177
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
178
+
179
+ - id: tool-subagent
180
+ name: '@deepseek-ai/dsh-tool-subagent'
181
+ config:
182
+ provider: spawn
183
+ toolName: subagent
184
+ modelSelectionSettings: true
185
+ backgroundMode: continuable
186
+
187
+ # Fork omits model selection so provider/model stay equal to the parent and
188
+ # the inherited history remains eligible for KV Cache reuse. This preset
189
+ # keeps fork continuable and accepts its child-scoped `report` additions invalidating
190
+ # that prefix; issue #2124 tracks cache-preserving continuable fork.
191
+ - id: tool-subagent-fork
192
+ name: '@deepseek-ai/dsh-tool-subagent'
193
+ config:
194
+ provider: fork
195
+ toolName: subagent_fork
196
+ backgroundMode: continuable
197
+
198
+ # Production dsh does not install these optional providers. Install the
199
+ # matching Bundle in this Profile and restart the Host, then copy this
200
+ # preset and remove `disabled` from the matching tool row. Host availability
201
+ # alone grants no tool.
202
+ - id: tool-subagent-codex
203
+ name: '@deepseek-ai/dsh-tool-subagent'
204
+ disabled: true
205
+ config:
206
+ provider: codex
207
+ toolName: subagent_codex
208
+ backgroundMode: one-shot
209
+ maxDepth: provider-managed
210
+
211
+ - id: tool-subagent-claude-code
212
+ name: '@deepseek-ai/dsh-tool-subagent'
213
+ disabled: true
214
+ config:
215
+ provider: claude-code
216
+ toolName: subagent_claude_code
217
+ backgroundMode: one-shot
218
+ maxDepth: provider-managed
219
+
220
+ - id: workflow-worker-thread
221
+ name: '@deepseek-ai/dsh-workflow-worker-thread'
222
+ config:
223
+ provider: spawn
224
+
225
+ - id: tool-workflow
226
+ name: '@deepseek-ai/dsh-tool-workflow'
227
+
228
+ - id: tool-ralph
229
+ name: '@deepseek-ai/dsh-tool-ralph'
230
+ config:
231
+ subagentProvider: spawn
232
+ maxRounds: 64
233
+
234
+ # ── remaining model-facing rows ─────────────────────────────────────────────
235
+
236
+ - id: tool-ask-user
237
+ name: '@deepseek-ai/dsh-tool-ask-user'
238
+
239
+ - id: tool-todo
240
+ name: '@deepseek-ai/dsh-tool-todo'
241
+ config:
242
+ allowParallelInProgress: true
243
+
244
+ # The `web` service and its search provider stay in the host composition; only
245
+ # the model-facing tool is per-session.
246
+ - id: tool-web
247
+ name: '@deepseek-ai/dsh-tool-web'
248
+ config:
249
+ fetch: true
250
+ searchTimeoutMs: 60000
251
+
252
+ # ── self-modification ───────────────────────────────────────────────────────
253
+
254
+ # Read the live runtime, mount a temporary plugin, unmount it. The toolset is a
255
+ # trust boundary, not a sandbox — see this file's header.
256
+ - id: tool-cordis
257
+ name: '@deepseek-ai/dsh-tool-cordis'
258
+
259
+ # The composition-authoring skill travels with this preset rather than living
260
+ # in the user's skill root: it documents THIS deployment's two planes, and a
261
+ # preset is the unit that gets copied and edited. `baseUrl` is the preset's
262
+ # own directory, so the root resolves wherever the preset is installed.
263
+ # Both rows register into THIS preset's layer of the host skill registry, so
264
+ # they need no realm; the agent's merged catalog also carries whatever the
265
+ # deployment registered globally (repository plugins).
266
+ - id: skill-filesystem
267
+ name: '@deepseek-ai/dsh-skill-filesystem'
268
+ config:
269
+ customSkillDirs:
270
+ - !!js "process.getBuiltinModule('node:url').fileURLToPath(new URL('skills/', baseUrl))"
271
+
272
+ - id: tool-skill
273
+ name: '@deepseek-ai/dsh-tool-skill'
@@ -1,3 +1,6 @@
1
+ # ERA: dsh <= 0.1.1 text (pre-rename built-in rows). The dsh >= 0.1.2 era text
2
+ # lives in agent.cordis.ptc.yml; the plugin probes the roster at materialization
3
+ # and writes the picked text as the preset's own agent.cordis.yml.
1
4
  # The `cordis` agent preset: the standard coding agent, plus the ability to
2
5
  # read and write the runtime it is running in.
3
6
  #
@@ -1,3 +1,7 @@
1
+ # ERA: one text serves both dsh eras — the built-in `minimal` preset did not
2
+ # change across the 0.1.1 → 0.1.2 code→ptc rename, so no agent.cordis.ptc.yml
3
+ # twin exists here. The plugin probes the roster and writes this file as the
4
+ # preset's own agent.cordis.yml either way.
1
5
  # The `minimal` agent preset: a fixed-prompt, two-tool coding-agent composition.
2
6
  #
3
7
  # The persona is the complete system prompt, so global identity, Web orientation,
@@ -0,0 +1,262 @@
1
+ # ERA: dsh >= 0.1.2 text (renamed built-in rows, incl. the new `command-goal`).
2
+ # The dsh <= 0.1.1 era text lives in agent.cordis.yml; the plugin probes the
3
+ # roster at materialization and writes the picked text as the preset's own
4
+ # agent.cordis.yml.
5
+ # The `standard` agent preset: the full coding agent, mounted once per process.
6
+ #
7
+ # This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
8
+ # standing scope; every session naming it joins by scope parentage, so the
9
+ # tools and prompt sections registered here cover each joined agent while a
10
+ # session's own state stays keyed per Session/Agent inside the plugins. The
11
+ # host composition (`base.cordis.yml` + `web.cordis.yml`) keeps everything a
12
+ # preset must not own: the registries themselves, the sandbox and approval
13
+ # stack, persistence, and the model route.
14
+ #
15
+ # A service row here MUST sit inside a group carrying an `isolate` realm.
16
+ # Without one it publishes into the root realm, where it is process-global —
17
+ # another preset publishing the same name collides, and a host reader would
18
+ # resolve one preset's instance for every session; `dsh-agent-presets` rejects
19
+ # that at mount. `true` means an entry-local realm: this standing mount's own
20
+ # private instance, apart from every other preset's. (A shared label does NOT
21
+ # pool instances — `provide()` throws on the second registration under the
22
+ # same realm symbol; labels join REALMS, and are not what this file needs.)
23
+
24
+ # ── identity ────────────────────────────────────────────────────────────────
25
+
26
+ # The preset's own persona, shadowing the deployment default for this agent.
27
+ # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
28
+ - id: persona
29
+ name: '@deepseek-ai/dsh-persona'
30
+ config:
31
+ text: >-
32
+ You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
33
+
34
+ - id: agent-instructions
35
+ name: '@deepseek-ai/dsh-agent-instructions'
36
+ config:
37
+ maxBytes: 65536
38
+
39
+ # ── shell ───────────────────────────────────────────────────────────────────
40
+
41
+ # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
42
+ # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
43
+ # the criterion for host-plane ownership — injection resolves before any session
44
+ # exists, so there is no agent to key by. Behind a preset realm those variables
45
+ # never reached the model's shell at all. Both shell tools consume the host
46
+ # registry from here; the host executor is the Git Bash provider (`dsh-gitbash-shell`)
47
+ # host-plane too.
48
+ - id: tool-bash
49
+ name: '@deepseek-ai/dsh-tool-bash'
50
+ # Git Bash on Windows: the host executor is dsh-gitbash-shell (see $DSH_HOME/cordis.patch.yml).
51
+ disabled: false
52
+
53
+ - id: tool-pwsh
54
+ name: '@deepseek-ai/dsh-tool-pwsh'
55
+ disabled: true
56
+
57
+ # ── filesystem ──────────────────────────────────────────────────────────────
58
+
59
+ # Both register into the host `tools` registry and provide nothing, so
60
+ # they need no realm. The `fs` service and its policy stay in the host.
61
+ - id: tool-fs
62
+ name: '@deepseek-ai/dsh-tool-fs'
63
+
64
+ - id: tool-fs-search
65
+ name: '@deepseek-ai/dsh-tool-fs-search'
66
+ config:
67
+ sampleOverCapGlobResults: false
68
+
69
+ # ── background jobs ────────────────────────────────────────────────────────
70
+
71
+ # Only the model-facing controls. The task REGISTRY stays on the host plane:
72
+ # its producers sit outside any realm this file could put it in — `tool-bash`
73
+ # above resolves it with `ctx.get`, and an entry-local realm here is invisible
74
+ # to every sibling row, so `run_in_background` would answer "background jobs
75
+ # unavailable" while these controls sat in the catalog. The registry is keyed by
76
+ # owning agent anyway, so one host instance serves every session. What a preset
77
+ # chooses is whether its agent can collect and stop background work at all.
78
+ - id: tool-jobs
79
+ name: '@deepseek-ai/dsh-tool-jobs'
80
+
81
+ # ── skills ──────────────────────────────────────────────────────────────────
82
+
83
+ # The skill REGISTRY lives in the host composition and is layered per scope:
84
+ # these rows register into THIS preset's layer of it, so they need no realm.
85
+ # `skill-filesystem` contributes local-root discovery for agents on this preset, and
86
+ # `tool-skill` gives them the catalog and loader; the merged catalog also
87
+ # carries whatever the deployment registered globally (repository plugins).
88
+ - id: skill-filesystem
89
+ name: '@deepseek-ai/dsh-skill-filesystem'
90
+
91
+ - id: tool-skill
92
+ name: '@deepseek-ai/dsh-tool-skill'
93
+
94
+ # ── goals ───────────────────────────────────────────────────────────────────
95
+
96
+ # The goal service and session driver stay on the host plane, where the Gateway
97
+ # can resolve them. The human command and model-facing tool register into this
98
+ # preset's scoped layers.
99
+ - id: command-goal
100
+ name: '@deepseek-ai/dsh-command-goal'
101
+
102
+ - id: tool-goal
103
+ name: '@deepseek-ai/dsh-tool-goal'
104
+
105
+ # ── plan mode ───────────────────────────────────────────────────────────────
106
+
107
+ # Plan state is per-agent by nature, so an entry-local realm is not a
108
+ # workaround here — it is the correct lifetime.
109
+ - id: planning
110
+ name: cordis:group
111
+ group: true
112
+ isolate:
113
+ planMode: true
114
+ config:
115
+ - id: plan-mode
116
+ name: '@deepseek-ai/dsh-plan-mode'
117
+ config:
118
+ section: |
119
+ 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.
120
+
121
+ 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.
122
+
123
+ 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.
124
+
125
+ 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.
126
+
127
+ 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.
128
+
129
+ 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.
130
+
131
+ # ── compaction ──────────────────────────────────────────────────────────────
132
+
133
+ # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
134
+ # share this realm rather than sit outside it.
135
+ #
136
+ # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
137
+ # plane, and the rows here resolve that one instance. It takes no configuration,
138
+ # keys every fold by Session, and owns the context-meter projection units the
139
+ # browser reads for every session — behind a realm those units would come and go
140
+ # with whichever presets happen to be mounted. What a preset chooses is whether
141
+ # its agent compacts at all, which is `compaction-basic` below.
142
+ - id: compaction
143
+ name: cordis:group
144
+ group: true
145
+ isolate:
146
+ compaction: true
147
+ toolResultPruner: true
148
+ config:
149
+ - id: compaction-basic
150
+ name: '@deepseek-ai/dsh-compaction-basic'
151
+
152
+ - id: command-compact
153
+ name: '@deepseek-ai/dsh-command-compact'
154
+
155
+ - id: tool-result-pruner
156
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
157
+ config:
158
+ thresholdChars: 8192
159
+ headChars: 4096
160
+ tailChars: 1024
161
+
162
+ # ── delegation and workflows ────────────────────────────────────────────────
163
+
164
+ # The `subagents` registry and its spawn/fork backends live in the HOST
165
+ # composition: the registry is a process singleton whose cross-session queries
166
+ # the api-proxy serves to the browser, and a provider name may only be
167
+ # registered once. This preset contributes the delegation TOOLS, which resolve
168
+ # that host registry.
169
+ #
170
+ # `workflows` is different — nothing outside an agent reads it — so every row
171
+ # that reaches it shares one entry-local realm here, and a consumer left
172
+ # outside would resolve a host registry this preset does not populate.
173
+ #
174
+ # `tool-subagent-report` is host-plane for the same reason as the registry,
175
+ # not because a preset may not want it: it registers a CONTINUABLE SETUP on
176
+ # that singleton rather than a tool this agent calls, and the setup list is
177
+ # not scope-aware — one copy per mounted preset means every child gets
178
+ # `report` registered once per live session, which throws on the second.
179
+ - id: delegation
180
+ name: cordis:group
181
+ group: true
182
+ isolate:
183
+ workflowEngine: true
184
+ config:
185
+ - id: tool-subagent-control
186
+ name: '@deepseek-ai/dsh-tool-subagent-control'
187
+
188
+ - id: tool-subagent-list-agents
189
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
190
+
191
+ - id: tool-subagent
192
+ name: '@deepseek-ai/dsh-tool-subagent'
193
+ config:
194
+ provider: spawn
195
+ toolName: subagent
196
+ modelSelectionSettings: true
197
+ backgroundMode: continuable
198
+
199
+ # Fork omits model selection so provider/model stay equal to the parent and
200
+ # the inherited history remains eligible for KV Cache reuse. This preset
201
+ # keeps fork continuable and accepts its child-scoped `report` additions invalidating
202
+ # that prefix; issue #2124 tracks cache-preserving continuable fork.
203
+ - id: tool-subagent-fork
204
+ name: '@deepseek-ai/dsh-tool-subagent'
205
+ config:
206
+ provider: fork
207
+ toolName: subagent_fork
208
+ backgroundMode: continuable
209
+
210
+ # Production dsh does not install these optional providers. Install the
211
+ # matching Bundle in this Profile and restart the Host, then copy this
212
+ # preset and remove `disabled` from the matching tool row. Host availability
213
+ # alone grants no tool.
214
+ - id: tool-subagent-codex
215
+ name: '@deepseek-ai/dsh-tool-subagent'
216
+ disabled: true
217
+ config:
218
+ provider: codex
219
+ toolName: subagent_codex
220
+ backgroundMode: one-shot
221
+ maxDepth: provider-managed
222
+
223
+ - id: tool-subagent-claude-code
224
+ name: '@deepseek-ai/dsh-tool-subagent'
225
+ disabled: true
226
+ config:
227
+ provider: claude-code
228
+ toolName: subagent_claude_code
229
+ backgroundMode: one-shot
230
+ maxDepth: provider-managed
231
+
232
+ - id: workflow-worker-thread
233
+ name: '@deepseek-ai/dsh-workflow-worker-thread'
234
+ config:
235
+ provider: spawn
236
+
237
+ - id: tool-workflow
238
+ name: '@deepseek-ai/dsh-tool-workflow'
239
+
240
+ - id: tool-ralph
241
+ name: '@deepseek-ai/dsh-tool-ralph'
242
+ config:
243
+ subagentProvider: spawn
244
+ maxRounds: 64
245
+
246
+ # ── remaining model-facing rows ─────────────────────────────────────────────
247
+
248
+ - id: tool-ask-user
249
+ name: '@deepseek-ai/dsh-tool-ask-user'
250
+
251
+ - id: tool-todo
252
+ name: '@deepseek-ai/dsh-tool-todo'
253
+ config:
254
+ allowParallelInProgress: true
255
+
256
+ # The `web` service and its search provider stay in the host composition; only
257
+ # the model-facing tool is per-session.
258
+ - id: tool-web
259
+ name: '@deepseek-ai/dsh-tool-web'
260
+ config:
261
+ fetch: true
262
+ searchTimeoutMs: 60000
@@ -1,3 +1,6 @@
1
+ # ERA: dsh <= 0.1.1 text (pre-rename built-in rows). The dsh >= 0.1.2 era text
2
+ # lives in agent.cordis.ptc.yml; the plugin probes the roster at materialization
3
+ # and writes the picked text as the preset's own agent.cordis.yml.
1
4
  # The `standard` agent preset: the full coding agent, mounted once per process.
2
5
  #
3
6
  # This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
package/dsh.plugin.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-gitbash-shell",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "main": "./src/index.js",
5
- "description": "Windows 全模式 Git Bash:用 Git for Windows bash 替换 PowerShell 执行器,并物化 standard/minimal/code/cordis 的 Git Bash 变体 preset。联动 dsh-ptc-cordis-preset:两者同装时 PTC 创造模式自动物化为 Git Bash 版。",
5
+ "description": "Windows 全模式 Git Bash:用 Git for Windows bash 替换 PowerShell 执行器,并物化 standard/minimal/code/cordis 的 Git Bash 变体 preset。双 era 适配 dsh <= 0.1.1(内置 id 'code')与 >= 0.1.2(改名 'ptc'),启动探测自动选择,preset id 永不变。联动:dsh-ptc-cordis-preset(两者同装时 PTC 创造模式自动物化为 Git Bash 版)+ dsh-better-sidebar(终端 UI 标签与模型 terminal_* 工具自动切到 Git Bash)。",
6
6
  "engines": {
7
7
  "dsh": ">=0.0.1"
8
8
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-gitbash-shell",
3
- "version": "0.5.4",
4
- "description": "DSH plugin: run every agent shell command through Git for Windows bash on Windows instead of PowerShell. Replaces the pwsh executor with a Git Bash ctx.shell provider and materializes Git Bash variants of the standard/minimal/code/cordis agent presets into your user preset root at startup.",
3
+ "version": "0.6.0",
4
+ "description": "DSH plugin: run every agent shell command through Git for Windows bash on Windows instead of PowerShell. Replaces the pwsh executor with a Git Bash ctx.shell provider and materializes Git Bash variants of the standard/minimal/code/cordis agent presets into your user preset root at startup. On Windows it also adopts dsh-better-sidebar's terminal shell (UI tabs and the model-facing terminal_* tools) through the sidebar's official settings seam, and pairs with dsh-ptc-cordis-preset so the PTC Creation-mode preset materializes as its Git Bash variant. Ships both composition eras for dsh <= 0.1.1 (built-in preset id 'code') and dsh >= 0.1.2 (renamed id 'ptc') — the era is probed per boot and re-materialized automatically after a dsh upgrade, in either upgrade order; preset ids never change so pinned sessions stay valid.",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
package/src/index.js CHANGED
@@ -28,6 +28,16 @@
28
28
  * directory that still exists means reload/update/restart — keep the
29
29
  * presets; a vanished package.json means uninstall — remove each preset the
30
30
  * user never modified.
31
+ *
32
+ * ERA SPLIT (v0.6.0): dsh renamed the built-in `code` preset to `ptc` in
33
+ * 0.1.2 with no compatibility alias (tool-presentation `mode` value, plus new
34
+ * built-in rows), so each variant ships BOTH committed era texts where the
35
+ * built-in changed (minimal did not — one text serves both). The era is
36
+ * probed per boot from the roster (`ptc` → dsh >= 0.1.2, else `code`),
37
+ * recorded in the marker (`base`), and a flipped detection re-materializes
38
+ * on the next startup — either upgrade order converges, and preset IDS never
39
+ * change (sessions are pinned to them; `code-gitbash` keeps its historical
40
+ * id even though its dsh >= 0.1.2 text presents through the `ptc` built-in).
31
41
  */
32
42
 
33
43
  import { createHash } from 'node:crypto'
@@ -128,10 +138,56 @@ function skillsHashes(source) {
128
138
  return out
129
139
  }
130
140
 
141
+ // ── built-in era detection (dsh 0.1.2 renamed the `code` preset to `ptc`) ──
142
+
143
+ /**
144
+ * Which built-in PTC preset does the installed dsh ship? dsh 0.1.2 renamed
145
+ * the preset id `code` to `ptc` with no compatibility alias, so the variant
146
+ * compositions are era-specific where the built-in changed. The roster probe
147
+ * is the version-agnostic signal. Pure companion of `detectBase`; 'ptc' wins
148
+ * if both ids somehow exist, and an unknown roster conservatively maps to
149
+ * 'code' — the era text the stable release accepted.
150
+ */
151
+ function baseForRoster(ids) {
152
+ const set = new Set(ids)
153
+ if (set.has('ptc')) return 'ptc'
154
+ return 'code'
155
+ }
156
+
157
+ /** Async probe against the live roster; never throws. */
158
+ async function detectBase(agentPresets) {
159
+ try {
160
+ const list = await agentPresets.list()
161
+ return baseForRoster((Array.isArray(list) ? list : []).map((p) => p && p.id))
162
+ } catch (error) {
163
+ console.log(`${TAG} built-in preset probe failed (${error?.message ?? error}) — assuming the 'code' era`)
164
+ return 'code'
165
+ }
166
+ }
167
+
168
+ /** Era suffix for committed composition assets: ptc-era files carry `.ptc`. */
169
+ function eraSuffix(base) {
170
+ return base === 'ptc' ? '.ptc' : ''
171
+ }
172
+
173
+ /**
174
+ * Pick the committed composition asset inside one variant directory (pure).
175
+ * The ptc-era twin is preferred when the roster says `ptc`; variants without
176
+ * a twin (minimal — its built-in did not change) fall back to the plain base
177
+ * file. Every candidate is a committed file — no runtime text synthesis.
178
+ */
179
+ function pickComposition(base, available) {
180
+ const era = eraSuffix(base)
181
+ const candidates = [`agent.cordis${era}.yml`, 'agent.cordis.yml']
182
+ for (const file of candidates) if (available.includes(file)) return file
183
+ return 'agent.cordis.yml'
184
+ }
185
+
131
186
  /** Startup decision for an existing unmodified tree: 'refresh' or 'idle'. */
132
- function syncDecision({ state, marker, version, sourceHashes }) {
187
+ function syncDecision({ state, marker, version, sourceHashes, base = 'code' }) {
133
188
  if (state !== 'unmodified' || !marker) return 'refresh'
134
189
  if (marker.version !== version) return 'refresh'
190
+ if (marker.base !== base) return 'refresh'
135
191
  const recorded = {}
136
192
  for (const k of Object.keys(marker.files)) if (k.startsWith('skills/')) recorded[k] = marker.files[k]
137
193
  if (sourceHashes === null) return Object.keys(recorded).length === 0 ? 'idle' : 'refresh'
@@ -145,11 +201,13 @@ function syncDecision({ state, marker, version, sourceHashes }) {
145
201
  // ── materialization ─────────────────────────────────────────────────────────
146
202
 
147
203
  /** Write one preset directory from scratch. Returns 'ok' or 'no-skills-source'. */
148
- function materialize({ target, presetId, skillsSource, version }) {
204
+ function materialize({ target, presetId, skillsSource, version, base = 'code' }) {
149
205
  rmSync(target, { recursive: true, force: true })
150
206
  mkdirSync(target, { recursive: true })
151
207
 
152
- writeFileSync(join(target, 'agent.cordis.yml'), readFileSync(join(pkgDir, 'assets', presetId, 'agent.cordis.yml')))
208
+ const available = readdirSync(join(pkgDir, 'assets', presetId)).filter((f) => f.endsWith('.yml'))
209
+ const compositionFile = pickComposition(base, available)
210
+ writeFileSync(join(target, 'agent.cordis.yml'), readFileSync(join(pkgDir, 'assets', presetId, compositionFile)))
153
211
  writeFileSync(join(target, 'preset.yml'), readFileSync(join(pkgDir, 'assets', presetId, 'preset.yml')))
154
212
 
155
213
  let skills = 'none'
@@ -163,7 +221,7 @@ function materialize({ target, presetId, skillsSource, version }) {
163
221
  }
164
222
  }
165
223
 
166
- const marker = { managedBy: MANAGED_BY, version, presetId, files: hashTree(target) }
224
+ const marker = { managedBy: MANAGED_BY, version, presetId, base, files: hashTree(target) }
167
225
  writeFileSync(join(target, MARKER_FILE), JSON.stringify(marker, null, 2) + '\n')
168
226
  return skills
169
227
  }
@@ -413,6 +471,7 @@ export async function apply(ctx, config = {}) {
413
471
  }
414
472
 
415
473
  const skillsSource = await findSkillsSource(ctx.agentPresets)
474
+ const base = await detectBase(ctx.agentPresets)
416
475
  const userRootPath = userRoot.path
417
476
  purgeOrphans(userRootPath, presetIds)
418
477
 
@@ -442,19 +501,19 @@ export async function apply(ctx, config = {}) {
442
501
 
443
502
  const sourceHashes = presetId === 'cordis-gitbash' ? skillsHashes(skillsSource) : null
444
503
  const marker = readMarker(target)
445
- if (state === 'unmodified' && syncDecision({ state, marker, version, sourceHashes }) === 'idle') {
446
- ctx.logger?.('gitbash-shell')?.debug?.( `preset '${presetId}' up to date (v${version}) — idle`)
504
+ if (state === 'unmodified' && syncDecision({ state, marker, version, sourceHashes, base }) === 'idle') {
505
+ ctx.logger?.('gitbash-shell')?.debug?.( `preset '${presetId}' up to date (v${version}, ${base}-era) — idle`)
447
506
  continue
448
507
  }
449
508
 
450
- const skills = materialize({ target, presetId, skillsSource, version })
509
+ const skills = materialize({ target, presetId, skillsSource, version, base })
451
510
  const verb = state === 'absent' ? 'materialized' : 'refreshed'
452
511
  console.log(
453
- `${TAG} ${verb} preset '${presetId}' into ${userRootPath} (v${version})` +
512
+ `${TAG} ${verb} preset '${presetId}' into ${userRootPath} (v${version}, ${base}-era composition)` +
454
513
  (skills === 'copied' ? " (skills copied from the installed 'cordis' preset)" : '')
455
514
  )
456
515
  }
457
516
  }
458
517
 
459
518
  // Test surface: pure helpers, no Cordis context required.
460
- export const _internal = { PRESET_IDS, MARKER_FILE, classify, materialize, cleanupOnDispose, firstUserRoot, hashTree, skillsHashes, syncDecision, installRegisterShim }
519
+ export const _internal = { PRESET_IDS, MARKER_FILE, classify, materialize, cleanupOnDispose, firstUserRoot, hashTree, skillsHashes, syncDecision, installRegisterShim, baseForRoster, detectBase, pickComposition }