dsh-plugin-prompt-tool 0.4.2 → 0.5.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.
Files changed (188) hide show
  1. package/README.md +125 -222
  2. package/engine/compaction-epoch.mjs +139 -0
  3. package/engine/compositions/library/bootstrap-filesystem.yml +19 -0
  4. package/engine/compositions/library/compaction.yml +52 -0
  5. package/engine/compositions/library/context-gate.yml +40 -0
  6. package/engine/compositions/library/custom-bash.yml +14 -0
  7. package/engine/compositions/library/delegation.yml +85 -0
  8. package/engine/compositions/library/official-agent-instructions.yml +17 -0
  9. package/engine/compositions/library/official-persistent-shell.yml +56 -0
  10. package/engine/compositions/library/official-skill-filesystem-cordis.yml +10 -0
  11. package/engine/compositions/library/official-tool-bash.yml +6 -0
  12. package/engine/compositions/library/official-tool-cordis.yml +13 -0
  13. package/engine/compositions/library/official-tool-presentation.yml +7 -0
  14. package/engine/compositions/library/official-tool-skill.yml +14 -0
  15. package/engine/compositions/library/persistent-shell.yml +36 -0
  16. package/engine/compositions/library/persona.yml +9 -0
  17. package/engine/compositions/library/planning.yml +41 -0
  18. package/engine/compositions/library/prompt-config-engine.yml +16 -0
  19. package/engine/compositions/library/router-first-turn.yml +9 -0
  20. package/engine/compositions/library/run-code-env.yml +15 -0
  21. package/engine/compositions/library/skill-filesystem.yml +13 -0
  22. package/engine/compositions/library/skill-search.yml +14 -0
  23. package/engine/compositions/library/str-replace-editor.yml +10 -0
  24. package/engine/compositions/library/tool-ask-user.yml +8 -0
  25. package/engine/compositions/library/tool-bash.yml +16 -0
  26. package/engine/compositions/library/tool-bootstrap.yml +16 -0
  27. package/engine/compositions/library/tool-filter.yml +12 -0
  28. package/engine/compositions/library/tool-fs-search.yml +18 -0
  29. package/engine/compositions/library/tool-fs.yml +10 -0
  30. package/engine/compositions/library/tool-goal.yml +19 -0
  31. package/engine/compositions/library/tool-jobs.yml +23 -0
  32. package/engine/compositions/library/tool-pwsh.yml +12 -0
  33. package/engine/compositions/library/tool-todo.yml +11 -0
  34. package/engine/compositions/library/tool-web.yml +9 -0
  35. package/engine/compositions/source/local/context-gate.yml +37 -0
  36. package/engine/compositions/source/local/custom-bash.yml +11 -0
  37. package/engine/compositions/source/local/prompt-config-engine.yml +13 -0
  38. package/engine/compositions/source/local/router-first-turn.yml +5 -0
  39. package/engine/compositions/source/local/run-code-env.yml +12 -0
  40. package/engine/compositions/source/local/skill-search.yml +11 -0
  41. package/engine/compositions/source/local/tool-bootstrap.yml +13 -0
  42. package/engine/context-gate.mjs +305 -0
  43. package/{preset → engine}/custom-bash.mjs +243 -243
  44. package/engine/executor.mjs +271 -0
  45. package/engine/fillers.mjs +273 -0
  46. package/engine/layers.mjs +220 -0
  47. package/engine/prompt-config-engine.mjs +49 -0
  48. package/{preset → engine}/router-first-turn.mjs +85 -73
  49. package/engine/run-code-env.mjs +208 -0
  50. package/engine/schema.mjs +294 -0
  51. package/{preset → engine}/shared.mjs +54 -0
  52. package/engine/strategies.mjs +223 -0
  53. package/{preset → engine}/tool-bootstrap.mjs +350 -282
  54. package/engine/tool-filter.mjs +80 -0
  55. package/engine/vendor/yaml/LICENSE +13 -0
  56. package/engine/vendor/yaml/dist/compose/compose-collection.js +88 -0
  57. package/engine/vendor/yaml/dist/compose/compose-doc.js +43 -0
  58. package/engine/vendor/yaml/dist/compose/compose-node.js +109 -0
  59. package/engine/vendor/yaml/dist/compose/compose-scalar.js +86 -0
  60. package/engine/vendor/yaml/dist/compose/composer.js +219 -0
  61. package/engine/vendor/yaml/dist/compose/resolve-block-map.js +115 -0
  62. package/engine/vendor/yaml/dist/compose/resolve-block-scalar.js +198 -0
  63. package/engine/vendor/yaml/dist/compose/resolve-block-seq.js +49 -0
  64. package/engine/vendor/yaml/dist/compose/resolve-end.js +37 -0
  65. package/engine/vendor/yaml/dist/compose/resolve-flow-collection.js +207 -0
  66. package/engine/vendor/yaml/dist/compose/resolve-flow-scalar.js +225 -0
  67. package/engine/vendor/yaml/dist/compose/resolve-props.js +146 -0
  68. package/engine/vendor/yaml/dist/compose/util-contains-newline.js +34 -0
  69. package/engine/vendor/yaml/dist/compose/util-empty-scalar-position.js +26 -0
  70. package/engine/vendor/yaml/dist/compose/util-flow-indent-check.js +15 -0
  71. package/engine/vendor/yaml/dist/compose/util-map-includes.js +13 -0
  72. package/engine/vendor/yaml/dist/doc/Document.js +335 -0
  73. package/engine/vendor/yaml/dist/doc/anchors.js +71 -0
  74. package/engine/vendor/yaml/dist/doc/applyReviver.js +55 -0
  75. package/engine/vendor/yaml/dist/doc/createNode.js +88 -0
  76. package/engine/vendor/yaml/dist/doc/directives.js +176 -0
  77. package/engine/vendor/yaml/dist/errors.js +57 -0
  78. package/engine/vendor/yaml/dist/index.js +17 -0
  79. package/engine/vendor/yaml/dist/log.js +11 -0
  80. package/engine/vendor/yaml/dist/nodes/Alias.js +116 -0
  81. package/engine/vendor/yaml/dist/nodes/Collection.js +147 -0
  82. package/engine/vendor/yaml/dist/nodes/Node.js +38 -0
  83. package/engine/vendor/yaml/dist/nodes/Pair.js +36 -0
  84. package/engine/vendor/yaml/dist/nodes/Scalar.js +24 -0
  85. package/engine/vendor/yaml/dist/nodes/YAMLMap.js +144 -0
  86. package/engine/vendor/yaml/dist/nodes/YAMLSeq.js +113 -0
  87. package/engine/vendor/yaml/dist/nodes/addPairToJSMap.js +63 -0
  88. package/engine/vendor/yaml/dist/nodes/identity.js +36 -0
  89. package/engine/vendor/yaml/dist/nodes/toJS.js +37 -0
  90. package/engine/vendor/yaml/dist/parse/cst-scalar.js +214 -0
  91. package/engine/vendor/yaml/dist/parse/cst-stringify.js +61 -0
  92. package/engine/vendor/yaml/dist/parse/cst-visit.js +97 -0
  93. package/engine/vendor/yaml/dist/parse/cst.js +98 -0
  94. package/engine/vendor/yaml/dist/parse/lexer.js +721 -0
  95. package/engine/vendor/yaml/dist/parse/line-counter.js +39 -0
  96. package/engine/vendor/yaml/dist/parse/parser.js +975 -0
  97. package/engine/vendor/yaml/dist/public-api.js +102 -0
  98. package/engine/vendor/yaml/dist/schema/Schema.js +37 -0
  99. package/engine/vendor/yaml/dist/schema/common/map.js +17 -0
  100. package/engine/vendor/yaml/dist/schema/common/null.js +15 -0
  101. package/engine/vendor/yaml/dist/schema/common/seq.js +17 -0
  102. package/engine/vendor/yaml/dist/schema/common/string.js +14 -0
  103. package/engine/vendor/yaml/dist/schema/core/bool.js +19 -0
  104. package/engine/vendor/yaml/dist/schema/core/float.js +43 -0
  105. package/engine/vendor/yaml/dist/schema/core/int.js +38 -0
  106. package/engine/vendor/yaml/dist/schema/core/schema.js +23 -0
  107. package/engine/vendor/yaml/dist/schema/json/schema.js +62 -0
  108. package/engine/vendor/yaml/dist/schema/tags.js +96 -0
  109. package/engine/vendor/yaml/dist/schema/yaml-1.1/binary.js +58 -0
  110. package/engine/vendor/yaml/dist/schema/yaml-1.1/bool.js +26 -0
  111. package/engine/vendor/yaml/dist/schema/yaml-1.1/float.js +46 -0
  112. package/engine/vendor/yaml/dist/schema/yaml-1.1/int.js +71 -0
  113. package/engine/vendor/yaml/dist/schema/yaml-1.1/merge.js +67 -0
  114. package/engine/vendor/yaml/dist/schema/yaml-1.1/omap.js +74 -0
  115. package/engine/vendor/yaml/dist/schema/yaml-1.1/pairs.js +78 -0
  116. package/engine/vendor/yaml/dist/schema/yaml-1.1/schema.js +39 -0
  117. package/engine/vendor/yaml/dist/schema/yaml-1.1/set.js +93 -0
  118. package/engine/vendor/yaml/dist/schema/yaml-1.1/timestamp.js +101 -0
  119. package/engine/vendor/yaml/dist/stringify/foldFlowLines.js +146 -0
  120. package/engine/vendor/yaml/dist/stringify/stringify.js +129 -0
  121. package/engine/vendor/yaml/dist/stringify/stringifyCollection.js +153 -0
  122. package/engine/vendor/yaml/dist/stringify/stringifyComment.js +20 -0
  123. package/engine/vendor/yaml/dist/stringify/stringifyDocument.js +85 -0
  124. package/engine/vendor/yaml/dist/stringify/stringifyNumber.js +25 -0
  125. package/engine/vendor/yaml/dist/stringify/stringifyPair.js +150 -0
  126. package/engine/vendor/yaml/dist/stringify/stringifyString.js +336 -0
  127. package/engine/vendor/yaml/dist/util.js +11 -0
  128. package/engine/vendor/yaml/dist/visit.js +233 -0
  129. package/engine/vendor/yaml/index.js +5 -0
  130. package/engine/vendor/yaml/package.json +11 -0
  131. package/lib/client.js +4421 -781
  132. package/lib/client.js.map +1 -1
  133. package/lib/index.d.mts +504 -51
  134. package/lib/index.mjs +3871 -731
  135. package/lib/preset-core.d.mts +7 -37
  136. package/lib/preset-core.mjs +44 -283
  137. package/lib/prompt-configs-BcP6miu9.d.mts +102 -0
  138. package/lib/prompt-configs-k7wuZs0C.mjs +719 -0
  139. package/package.json +104 -98
  140. package/preset/anchored/preset.yml +344 -0
  141. package/preset/creative/preset.yml +62 -0
  142. package/preset/custom/preset.yml +13 -0
  143. package/preset/liangshen/preset.yml +66 -0
  144. package/preset/minimal/preset.yml +41 -0
  145. package/preset/ptc/preset.yml +50 -0
  146. package/preset/standard/preset.yml +49 -0
  147. package/skills/manifest.json +7 -0
  148. package/skills/sandboxmod/SKILL.md +49 -49
  149. package/skills/web ui/SKILL.md +42 -0
  150. package/templates/10-pre-step.yml +28 -0
  151. package/templates/11-merged-a.yml +11 -0
  152. package/templates/13-anchor.yml +19 -0
  153. package/templates/14-first-turn-anchor.yml +27 -0
  154. package/templates/15-guide-auto.yml +25 -0
  155. package/templates/16-custom-fallback.yml +21 -0
  156. package/templates/17-instruction-hint.yml +23 -0
  157. package/templates/18-placeholder-env-facts.yml +11 -0
  158. package/templates/19-placeholder-skill-catalog.yml +19 -0
  159. package/templates/20-system-section.yml +14 -0
  160. package/templates/30-runtime-context.yml +10 -0
  161. package/templates/31-runtime-context-placeholder.yml +18 -0
  162. package/templates/40-agent-request.yml +11 -0
  163. package/templates/50-llm-stream.yml +9 -0
  164. package/templates/60-tool-pipeline.yml +12 -0
  165. package/AGENTS.md +0 -4
  166. package/plan.md +0 -312
  167. package/preset/agent.cordis.yml +0 -443
  168. package/preset/compaction-epoch.mjs +0 -81
  169. package/preset/context-gate.mjs +0 -165
  170. package/preset/instruction-hint.mjs +0 -217
  171. package/preset/near-anchor.mjs +0 -101
  172. package/preset/preset.yml +0 -3
  173. package/preset/prompt-injector.mjs +0 -112
  174. package/preset/router-guide.mjs +0 -79
  175. package/preset.md +0 -115
  176. package/upstream/dsh-anchored-standard/LICENSE +0 -22
  177. package/upstream/dsh-anchored-standard/NOTICE +0 -19
  178. package/upstream/dsh-anchored-standard/REVISION +0 -1
  179. package/upstream/dsh-anchored-standard/preset/agent.cordis.yml +0 -440
  180. package/upstream/dsh-anchored-standard/preset/compaction-epoch.mjs +0 -81
  181. package/upstream/dsh-anchored-standard/preset/context-gate.mjs +0 -202
  182. package/upstream/dsh-anchored-standard/preset/custom-bash.mjs +0 -219
  183. package/upstream/dsh-anchored-standard/preset/dev-tool-search.mjs +0 -131
  184. package/upstream/dsh-anchored-standard/preset/instruction-hint.mjs +0 -231
  185. package/upstream/dsh-anchored-standard/preset/preset.yml +0 -3
  186. package/upstream/dsh-anchored-standard/preset/skill-search.mjs +0 -142
  187. package/upstream/dsh-anchored-standard/preset/tool-bootstrap.mjs +0 -301
  188. /package/{preset → engine}/skill-search.mjs +0 -0
@@ -1,440 +0,0 @@
1
- # The `anchored-standard` experimental preset: Standard capabilities with the
2
- # Minimal mode system-prompt condition used by the V4 trajectory evaluation.
3
- #
4
- # This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
5
- # standing scope; every session naming it joins by scope parentage, so the
6
- # tools and prompt sections registered here cover each joined agent while a
7
- # session's own state stays keyed per Session/Agent inside the plugins. The
8
- # host composition (`base.cordis.yml` + `web.cordis.yml`) keeps everything a
9
- # preset must not own: the registries themselves, the sandbox and approval
10
- # stack, persistence, and the model route.
11
- #
12
- # A service row here MUST sit inside a group carrying an `isolate` realm.
13
- # Without one it publishes into the root realm, where it is process-global —
14
- # another preset publishing the same name collides, and a host reader would
15
- # resolve one preset's instance for every session; `dsh-agent-presets` rejects
16
- # that at mount. `true` means an entry-local realm: this standing mount's own
17
- # private instance, apart from every other preset's. (A shared label does NOT
18
- # pool instances — `provide()` throws on the second registration under the
19
- # same realm symbol; labels join REALMS, and are not what this file needs.)
20
-
21
- # ── context gate (must stay FIRST) ──────────────────────────────────────────
22
-
23
- # Unified injection control (shared/context-gate.mjs, reusable by any preset):
24
- # while the session is unpromoted, BOTH unified injection paths are closed.
25
- # The assembly's dynamic runtime-context contributions are blanked — the whole
26
- # `SystemPrompt.context()` family (sandbox/approval policy snapshots and any
27
- # third-party context provider) without enumerating them — and the pre-step
28
- # waterfall keeps ONLY the claimed message batch plus the `allowKinds` entries
29
- # (a user skill gesture survives; every automatic injection — skill catalog,
30
- # AGENTS.md digest, time/tmux context, hooks, unknown third-party plugins — is
31
- # stripped by default). After the first durable promotion signal (a tool call
32
- # OR the first assistant message, `promoteOn: either`) the gate opens, and the
33
- # loop's own snapshot projection diffs exactly ONE fresh runtime-context
34
- # message into the next request: minimal first round, injections on the second
35
- # round. A `compaction/end` boundary re-closes the gate the same way.
36
- #
37
- # This row deliberately sits before every other row: waterfall after-next
38
- # transforms apply in reverse registration order, so registering first (plus
39
- # the empty inject list and the pre-step listener's `prepend` flag) makes the
40
- # gate the outermost transform — nothing registered later re-injects past it
41
- # (see issue #6).
42
- #
43
- # `includeSubagents: true` gates subagents the same way — their first request
44
- # is clean too, and their own first reply or tool call opens the gate — so a
45
- # delegation cannot reintroduce an uncontrolled first request (issues #38 and
46
- # #52). Keep this flag in sync with the tool-bootstrap row below.
47
- - id: context-gate
48
- name: ./context-gate.mjs
49
- config:
50
- promoteOn: either
51
- includeSubagents: true
52
- allowKinds: [skill-invocation]
53
-
54
- # ── bootstrap ───────────────────────────────────────────────────────────────
55
-
56
- # Tool catalog control (mode-owned tool-bootstrap.mjs). V4 Pro conditions
57
- # strongly on the API tool catalog AND the first request output budget:
58
- # request #1 exposes the OFFICIAL Minimal preset's real tool pair —
59
- # persistent `bash` + `str_replace_editor` — which anchors at the
60
- # adapter-default maxTokens (256000) with no output cap needed (issue #11:
61
- # 5/5 anchored vs 11/11 standard-like for every standard-family schema);
62
- # after the session records its first durable promotion signal (a tool call OR
63
- # the first assistant message, default `promoteOn: either`), later steps
64
- # narrow to the minimal RESIDENT set (see below). `bootstrapMaxTokens` is
65
- # opt-in for standard-schema bootstraps; unset, the adapter default flows. See
66
- # tool-bootstrap.mjs for the other triggers. Context stripping is NOT here —
67
- # the context-gate row above owns it.
68
- #
69
- # POST-PROMOTION (local addition): the promoted catalog is NOT the full
70
- # Standard dump — it stays on the bootstrap pair + the three discovery tools
71
- # (dev_tool_search / skill_search / skill_load) + whatever the model unlocked
72
- # via dev_tool_search. Heavier tools are one dev_tool_search away; the
73
- # trajectory is not pulled back to standard-like behavior by a 25-tool dump.
74
- #
75
- # COMPACTION (local addition): after `compaction/end` the session falls back
76
- # to the controlled phase — bootstrap pair + `compactionTools` — until a NEW
77
- # durable promotion signal exists past the boundary (epoch-aware, see
78
- # compaction-epoch.mjs).
79
- #
80
- # `includeSubagents: true` keeps the subagent phase in sync with the
81
- # context-gate row: a subagent's first request sees the bootstrap pair, then
82
- # its own first reply or tool call promotes it to the resident set.
83
- - id: tool-bootstrap
84
- name: ./tool-bootstrap.mjs
85
- config:
86
- bootstrapTools: [bash, str_replace_editor]
87
- promoteOn: either
88
- includeSubagents: true
89
- # Post-compaction core work set: the model is mid-task and needs to keep
90
- # working, but faces a small catalog instead of the full Standard set.
91
- compactionTools: [read, write, edit, glob, grep, todo_write, ask_user_question]
92
-
93
- # ── identity ────────────────────────────────────────────────────────────────
94
-
95
- # Keep this text byte-identical to the Minimal preset. `complete` prevents the
96
- # Harness identity and per-tool guidance from changing the system prompt, while
97
- # runtime-context suppression leaves task and repository rules to user messages
98
- # and explicit file reads. Tool schemas and their runtime enforcement remain.
99
- - id: persona
100
- name: '@deepseek-ai/dsh-persona'
101
- config:
102
- text: You are a helpful software engineer assistant.
103
- complete: true
104
- includeRuntimeContext: false
105
-
106
- # Instruction FILES are NOT injected (replaces dsh-agent-instructions, local
107
- # addition): the full AGENTS.md/CLAUDE.md digest is a large injected block
108
- # that perturbs the trajectory even after promotion. Instead, after promotion
109
- # ONE short hint is injected once per session — "these instruction files
110
- # exist; read them before acting" — and the model reads the files itself via
111
- # the filesystem tools when relevant. The once-per-session guard is DERIVED
112
- # FROM DURABLE EVENTS (restart-safe): a process restart must never inject a
113
- # second hint with the same deterministic message id — the duplicate id
114
- # breaks history replay. `includeSubagents: true` makes a subagent's own
115
- # first reply or tool call open its hint, keeping it out of the context
116
- # gate's stripped first request.
117
- - id: instruction-hint
118
- name: ./instruction-hint.mjs
119
- config:
120
- promoteOn: either
121
- includeSubagents: true
122
-
123
- # On-demand tool discovery (the tool-search pattern, local addition): the
124
- # promoted catalog keeps a minimal resident set; heavier Standard tools
125
- # (web_search, subagent, workflow, …) are unlocked on demand via
126
- # dev_tool_search.
127
- - id: dev-tool-search
128
- name: ./dev-tool-search.mjs
129
-
130
- # ── shell ───────────────────────────────────────────────────────────────────
131
-
132
- # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
133
- # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
134
- # the criterion for host-plane ownership — injection resolves before any session
135
- # exists, so there is no agent to key by. Behind a preset realm those variables
136
- # never reached the model's shell at all. Both shell tools consume the host
137
- # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
138
- # host-plane too.
139
- - id: tool-bash
140
- name: '@deepseek-ai/dsh-tool-bash'
141
- # Disabled on EVERY platform, not just Windows: `dsh-tool-bash-persistent`
142
- # below registers the same `bash` tool name into this same preset layer, and
143
- # the tools registry rejects duplicates within one layer. The persistent
144
- # shell (the Minimal preset's own shell) is the preset's bash; it consumes
145
- # the host sandbox policy through the terminals realm.
146
- disabled: true
147
-
148
- - id: tool-pwsh
149
- name: '@deepseek-ai/dsh-tool-pwsh'
150
- disabled: !!js process.platform !== 'win32'
151
-
152
- # The Minimal preset's shell: a PTY-backed persistent bash, schema-identical
153
- # to the official `minimal` preset's `persistent-shell` group so the first
154
- # request exposes exactly Minimal's real `bash` schema. ONE deliberate config
155
- # difference: an adaptive `shellPath` — the terminal-bash plugin default
156
- # `/bin/bash` where that absolute path exists (every host that ships it keeps
157
- # the previous behavior), otherwise a bare `bash` resolved through the same
158
- # scrubbed PATH the other harness tools use. The fallback exists because
159
- # `/bin/bash` does not exist on NixOS and other hosts that keep bash
160
- # elsewhere; there `execvp("/bin/bash")` exits during PTY startup ("PTY shell
161
- # exited during startup") and every bash call fails. The PTY registry is an
162
- # agent-owned service, so it lives in an entry-local realm; the backend still
163
- # consumes the host sandbox policy and subprocess implementation, while the
164
- # tool registers into this agent's scoped catalog.
165
- #
166
- # DISABLED ON WINDOWS: DSH's PTY backend is linux/darwin-only, so the
167
- # persistent shell cannot serve win32. The `custom-bash` row below registers
168
- # the same `bash` tool name there instead (platform-exclusive).
169
- - id: persistent-shell
170
- name: cordis:group
171
- group: true
172
- disabled: !!js process.platform === 'win32'
173
- isolate:
174
- terminals: true
175
- config:
176
- - id: pty
177
- name: '@deepseek-ai/dsh-terminal'
178
-
179
- - id: terminal-bash
180
- name: '@deepseek-ai/dsh-terminal-bash'
181
- config:
182
- shellPath: !!js "process.getBuiltinModule?.('node:fs')?.existsSync('/bin/bash') ? '/bin/bash' : 'bash'"
183
- timeoutMs: 300000
184
-
185
- - id: persistent-bash
186
- name: '@deepseek-ai/dsh-tool-bash-persistent'
187
- config:
188
- timeoutMs: 300000
189
- description: |-
190
- Run commands in a bash shell
191
- * When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.
192
- * You don't have access to the internet via this tool.
193
- * You do have access to a mirror of common linux and python packages via apt and pip.
194
- * State is persistent across command calls and discussions with the user.
195
- * To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p /path/to/the/file'.
196
- * Please avoid commands that may produce a very large amount of output.
197
- * Please run long lived commands in the background, e.g. 'sleep 10 &' or start a server in the background.
198
-
199
- # Windows-only `bash` tool (see custom-bash.mjs): registers the SAME
200
- # tool name as the persistent shell with a Minimal-compatible description, but
201
- # executes through the ordinary cross-platform subprocess seam (`bash -c`)
202
- # instead of a PTY. The shell is resolved WITHOUT a hardcoded install path
203
- # (issue #24): `bashPath` unset probes the `git` executable's install root,
204
- # then the well-known Git-for-Windows roots (Program Files(/x86), per-user
205
- # LOCALAPPDATA, scoop's `current` junction), then plain `bash` on PATH — set
206
- # `bashPath` explicitly only to pin a shell that probing cannot find. No OS
207
- # sandbox confinement on Windows (landlock is linux-only); the tool
208
- # description says so. When no bash exists at all the tool errors with
209
- # guidance instead of switching shells — pwsh stays its own tool in the
210
- # promoted catalog.
211
- - id: custom-bash
212
- name: ./custom-bash.mjs
213
- disabled: !!js process.platform !== 'win32'
214
-
215
- # ── filesystem ──────────────────────────────────────────────────────────────
216
-
217
- # Both register into the host `tools` registry and provide nothing, so
218
- # they need no realm. The `fs` service and its policy stay in the host.
219
- - id: tool-fs
220
- name: '@deepseek-ai/dsh-tool-fs'
221
-
222
- - id: tool-fs-search
223
- name: '@deepseek-ai/dsh-tool-fs-search'
224
- config:
225
- sampleOverCapGlobResults: false
226
-
227
- # The Minimal preset's second tool: `str_replace_editor` over a bare local
228
- # filesystem, byte-identical in configuration to the official `minimal`
229
- # preset's `filesystem` group. The editor's own realm shadows the host's
230
- # sandboxed `fs` provider only inside this group, so the standard `read`/
231
- # `write`/`edit` tools keep the sandboxed fs while the bootstrap editor uses
232
- # the local one.
233
- - id: bootstrap-filesystem
234
- name: cordis:group
235
- group: true
236
- isolate:
237
- fs: true
238
- config:
239
- - id: fs-local
240
- name: '@deepseek-ai/dsh-fs-local'
241
- config:
242
- cwd: !!js process.env.DSH_CWD ?? process.cwd()
243
-
244
- - id: str-replace-editor
245
- name: '@deepseek-ai/dsh-tool-str-replace-editor'
246
- config:
247
- maxOutputChars: 16000
248
-
249
- # ── background jobs ────────────────────────────────────────────────────────
250
-
251
- # Only the model-facing controls. The task REGISTRY stays on the host plane:
252
- # its producers sit outside any realm this file could put it in — `tool-bash`
253
- # above resolves it with `ctx.get`, and an entry-local realm here is invisible
254
- # to every sibling row, so `run_in_background` would answer "background jobs
255
- # unavailable" while these controls sat in the catalog. The registry is keyed by
256
- # owning agent anyway, so one host instance serves every session. What a preset
257
- # chooses is whether its agent can collect and stop background work at all.
258
- - id: tool-jobs
259
- name: '@deepseek-ai/dsh-tool-jobs'
260
-
261
- # ── skills ──────────────────────────────────────────────────────────────────
262
-
263
- # The skill REGISTRY lives in the host composition and is layered per scope:
264
- # these rows register into THIS preset's layer of it, so they need no realm.
265
- # `skill-filesystem` contributes local-root discovery for agents on this
266
- # preset. The full skill CATALOG injection (`dsh-tool-skill`, the ~9KB
267
- # `<available_skills>` reminder) is REMOVED (local addition): it perturbs the
268
- # trajectory (issue #6: 0/9 anchored with the catalog present vs ~81%
269
- # without). Instead `skill-search` exposes two small on-demand tools —
270
- # skill_search (list matching summaries) and skill_load (inject one skill's
271
- # full instructions) — the tool-search pattern.
272
- - id: skill-filesystem
273
- name: '@deepseek-ai/dsh-skill-filesystem'
274
-
275
- - id: skill-search
276
- name: ./skill-search.mjs
277
-
278
- # ── goals ───────────────────────────────────────────────────────────────────
279
-
280
- # Only the model-facing tool. The goal SERVICE, its session driver, and the
281
- # `/goal` command stay on the host plane: the Gateway serves the goal domain as
282
- # Remote endpoints whose receiver comes from a generated descriptor, so it
283
- # resolves `goals` on the host and an entry-local realm here would hide it. The
284
- # registry is keyed by session anyway, so one host instance serves every
285
- # session. What a preset chooses is whether its agent can call the goal tool.
286
- - id: tool-goal
287
- name: '@deepseek-ai/dsh-tool-goal'
288
-
289
- # ── plan mode ───────────────────────────────────────────────────────────────
290
-
291
- # Plan state is per-agent by nature, so an entry-local realm is not a
292
- # workaround here — it is the correct lifetime.
293
- - id: planning
294
- name: cordis:group
295
- group: true
296
- isolate:
297
- planMode: true
298
- config:
299
- - id: plan-mode
300
- name: '@deepseek-ai/dsh-plan-mode'
301
- config:
302
- section: |
303
- 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.
304
-
305
- 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.
306
-
307
- 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.
308
-
309
- 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.
310
-
311
- 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.
312
-
313
- 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.
314
-
315
- # ── compaction ──────────────────────────────────────────────────────────────
316
-
317
- # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
318
- # share this realm rather than sit outside it.
319
- #
320
- # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
321
- # plane, and the rows here resolve that one instance. It takes no configuration,
322
- # keys every fold by Session, and owns the context-meter projection units the
323
- # browser reads for every session — behind a realm those units would come and go
324
- # with whichever presets happen to be mounted. What a preset chooses is whether
325
- # its agent compacts at all, which is `compaction-basic` below.
326
- - id: compaction
327
- name: cordis:group
328
- group: true
329
- isolate:
330
- compaction: true
331
- toolResultPruner: true
332
- config:
333
- - id: compaction-basic
334
- name: '@deepseek-ai/dsh-compaction-basic'
335
-
336
- - id: command-compact
337
- name: '@deepseek-ai/dsh-command-compact'
338
-
339
- - id: tool-result-pruner
340
- name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
341
- config:
342
- thresholdChars: 8192
343
- headChars: 4096
344
- tailChars: 1024
345
-
346
- # ── delegation and workflows ────────────────────────────────────────────────
347
-
348
- # The `subagents` registry and its spawn/fork backends live in the HOST
349
- # composition: the registry is a process singleton whose cross-session queries
350
- # the api-proxy serves to the browser, and a provider name may only be
351
- # registered once. This preset contributes the delegation TOOLS, which resolve
352
- # that host registry.
353
- #
354
- # `workflows` is different — nothing outside an agent reads it — so every row
355
- # that reaches it shares one entry-local realm here, and a consumer left
356
- # outside would resolve a host registry this preset does not populate.
357
- #
358
- # `tool-subagent-report` is host-plane for the same reason as the registry,
359
- # not because a preset may not want it: it registers a CONTINUABLE SETUP on
360
- # that singleton rather than a tool this agent calls, and the setup list is
361
- # not scope-aware — one copy per mounted preset means every child gets
362
- # `report` registered once per live session, which throws on the second.
363
- - id: delegation
364
- name: cordis:group
365
- group: true
366
- isolate:
367
- workflowEngine: true
368
- config:
369
- - id: tool-subagent-control
370
- name: '@deepseek-ai/dsh-tool-subagent-control'
371
-
372
- - id: tool-subagent-list-agents
373
- name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
374
-
375
- - id: tool-subagent
376
- name: '@deepseek-ai/dsh-tool-subagent'
377
- config:
378
- provider: spawn
379
- toolName: subagent
380
- backgroundMode: continuable
381
-
382
- - id: tool-subagent-fork
383
- name: '@deepseek-ai/dsh-tool-subagent'
384
- config:
385
- provider: fork
386
- toolName: subagent_fork
387
- backgroundMode: continuable
388
-
389
- # Product providers are host-plane singletons. Copy this preset, then
390
- # remove `disabled` from either ordinary tool row to expose that product
391
- # only to agents composed from the copy.
392
- - id: tool-subagent-codex
393
- name: '@deepseek-ai/dsh-tool-subagent'
394
- disabled: true
395
- config:
396
- provider: codex
397
- toolName: subagent_codex
398
- enableRunInBackground: false
399
- maxDepth: provider-managed
400
-
401
- - id: tool-subagent-claude-code
402
- name: '@deepseek-ai/dsh-tool-subagent'
403
- disabled: true
404
- config:
405
- provider: claude-code
406
- toolName: subagent_claude_code
407
- enableRunInBackground: false
408
- maxDepth: provider-managed
409
-
410
- - id: workflow-worker-thread
411
- name: '@deepseek-ai/dsh-workflow-worker-thread'
412
- config:
413
- provider: spawn
414
-
415
- - id: tool-workflow
416
- name: '@deepseek-ai/dsh-tool-workflow'
417
-
418
- - id: tool-ralph
419
- name: '@deepseek-ai/dsh-tool-ralph'
420
- config:
421
- subagentProvider: spawn
422
- maxRounds: 64
423
-
424
- # ── remaining model-facing rows ─────────────────────────────────────────────
425
-
426
- - id: tool-ask-user
427
- name: '@deepseek-ai/dsh-tool-ask-user'
428
-
429
- - id: tool-todo
430
- name: '@deepseek-ai/dsh-tool-todo'
431
- config:
432
- allowParallelInProgress: true
433
-
434
- # The `web` service and its search provider stay in the host composition; only
435
- # the model-facing tool is per-session.
436
- - id: tool-web
437
- name: '@deepseek-ai/dsh-tool-web'
438
- config:
439
- fetch: false
440
- searchTimeoutMs: 60000
@@ -1,81 +0,0 @@
1
- /**
2
- * Epoch-aware promotion tracker shared by the bootstrap and baseline-gate
3
- * plugins of the anchored presets.
4
- *
5
- * A compaction rewrites the model-visible surface: the pre-compaction
6
- * conversation collapses into one synthetic summary message, and the
7
- * workspace-instruction baseline is re-injected from scratch. The first
8
- * post-compaction request is therefore a "second first request" — the same
9
- * first-token conditions the anchored presets exist to control. Promotion is
10
- * epoch-aware: only a durable promotion signal (`tool/call` and/or
11
- * `assistant/message`, per the caller's `promoteEvents`) recorded AFTER the
12
- * last `compaction/end` boundary counts as promoted. Before any compaction
13
- * the boundary is -1, which preserves the original one-shot semantics.
14
- *
15
- * State is memoized per session id and maintained incrementally through
16
- * `observe()`; a cold session scans its durable log once (so resume and
17
- * reload reconstruct the same phase), then O(1).
18
- *
19
- * By default subagents (`delegationDepth > 0`) are treated as already
20
- * promoted so their first request can use tools. Set `includeSubagents: true`
21
- * to make subagents follow the same bootstrap/anchor phase as top-level
22
- * sessions.
23
- */
24
-
25
- /** Build one epoch-aware promotion tracker. */
26
- export function createEpochPromotion(promoteEvents, options = {}) {
27
- const includeSubagents = options.includeSubagents === true
28
- const promote = new Set(promoteEvents)
29
- /** sessionId -> { boundary, promoted } */
30
- const state = new Map()
31
-
32
- /** Scan a session's durable log from scratch (cold start / resume). */
33
- const scan = (session) => {
34
- let boundary = -1
35
- let promoted = false
36
- for (const event of session.events) {
37
- const seq = event.seq ?? 0 // events without a seq are treated as post-boundary
38
- if (event.type === 'compaction/end') {
39
- boundary = seq
40
- promoted = false
41
- continue
42
- }
43
- if (promote.has(event.type) && seq > boundary) promoted = true
44
- }
45
- const entry = { boundary, promoted }
46
- state.set(session.id, entry)
47
- return entry
48
- }
49
-
50
- return {
51
- /**
52
- * Current phase of the agent's session.
53
- * @param agent - the assembly/pre-step agent, or undefined outside an agent.
54
- * @returns { boundary, promoted } — `boundary` is the last compaction/end
55
- * seq (-1 before any compaction); `promoted` is true when a durable
56
- * promotion signal exists after that boundary.
57
- */
58
- status(agent) {
59
- if (agent === undefined) return { boundary: -1, promoted: true }
60
- const session = agent.session
61
- if (session === undefined) return { boundary: -1, promoted: true }
62
- // By default subagents keep the full catalog from their very first
63
- // request; includeSubagents makes them follow the normal bootstrap phase.
64
- if (!includeSubagents && (session.header?.delegationDepth ?? 0) > 0) return { boundary: -1, promoted: true }
65
- return state.get(session.id) ?? scan(session)
66
- },
67
- /** Incremental feed: call on every `session/event`. */
68
- observe(session, event) {
69
- const entry = state.get(session.id)
70
- if (entry === undefined) return
71
- const seq = event.seq ?? 0
72
- if (event.type === 'compaction/end') {
73
- state.set(session.id, { boundary: seq, promoted: false })
74
- return
75
- }
76
- if (promote.has(event.type) && seq > entry.boundary && !entry.promoted) {
77
- state.set(session.id, { ...entry, promoted: true })
78
- }
79
- },
80
- }
81
- }