@devflow-core/dsh-devflow 0.1.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/NOTICE +13 -0
- package/README.md +82 -0
- package/assets/commands/devflow-adversarial.toml +11 -0
- package/assets/commands/devflow-audit.toml +32 -0
- package/assets/commands/devflow-debt.toml +42 -0
- package/assets/commands/devflow-find-fault.toml +11 -0
- package/assets/commands/devflow-learn.toml +21 -0
- package/assets/commands/devflow-plan.toml +58 -0
- package/assets/commands/devflow-prove.toml +20 -0
- package/assets/commands/devflow-pua.toml +40 -0
- package/assets/commands/devflow-review.toml +36 -0
- package/assets/commands/devflow-spec.toml +49 -0
- package/assets/commands/devflow.toml +35 -0
- package/assets/presets/devflow-2/NOTICE +4 -0
- package/assets/presets/devflow-2/README.md +71 -0
- package/assets/presets/devflow-2/agent.cordis.yml +337 -0
- package/assets/presets/devflow-2/custom-bash.mjs +213 -0
- package/assets/presets/devflow-2/preset.yml +3 -0
- package/assets/presets/devflow-2/tool-bootstrap.mjs +496 -0
- package/assets/scripts/devflow-audit.js +275 -0
- package/assets/scripts/devflow-debt.js +196 -0
- package/assets/scripts/devflow-doctor.js +90 -0
- package/assets/scripts/devflow-plan.js +638 -0
- package/assets/scripts/devflow-review.js +93 -0
- package/assets/scripts/devflow-spec.js +238 -0
- package/assets/skills/devflow-adversarial/SKILL.md +71 -0
- package/assets/skills/devflow-audit/SKILL.md +78 -0
- package/assets/skills/devflow-brainstorm/SKILL.md +176 -0
- package/assets/skills/devflow-brainstorm/references/interview-discipline.md +184 -0
- package/assets/skills/devflow-build/SKILL.md +238 -0
- package/assets/skills/devflow-build/references/build-methods.md +40 -0
- package/assets/skills/devflow-core/SKILL.md +93 -0
- package/assets/skills/devflow-core/references/core-methods.md +131 -0
- package/assets/skills/devflow-core/references/reference-projects.md +133 -0
- package/assets/skills/devflow-core/references/skill-guide.md +63 -0
- package/assets/skills/devflow-cut/SKILL.md +208 -0
- package/assets/skills/devflow-cut/references/cut-methods.md +65 -0
- package/assets/skills/devflow-cut/references/native-capability-checklist.md +112 -0
- package/assets/skills/devflow-docs-followup/SKILL.md +132 -0
- package/assets/skills/devflow-docs-followup/agents/openai.yaml +4 -0
- package/assets/skills/devflow-find-fault/SKILL.md +109 -0
- package/assets/skills/devflow-learn/SKILL.md +176 -0
- package/assets/skills/devflow-plan/SKILL.md +142 -0
- package/assets/skills/devflow-plan/references/plan-methods.md +74 -0
- package/assets/skills/devflow-project-knowledge/SKILL.md +354 -0
- package/assets/skills/devflow-prove/SKILL.md +216 -0
- package/assets/skills/devflow-prove/references/code-review-checklist.md +202 -0
- package/assets/skills/devflow-prove/references/flow-self-test.md +775 -0
- package/assets/skills/devflow-prove/references/proof-recovery-methods.md +26 -0
- package/assets/skills/devflow-pua/SKILL.md +197 -0
- package/assets/skills/devflow-pua/references/flavor-display.md +49 -0
- package/assets/skills/devflow-pua/references/methodology-library.md +193 -0
- package/assets/skills/devflow-pua/references/methodology-router.md +78 -0
- package/assets/skills/devflow-spec/SKILL.md +92 -0
- package/assets/skills/devflow-spec/references/spec-plan-methods.md +15 -0
- package/cordis.patch.yml +11 -0
- package/lib/dsh-home.js +33 -0
- package/lib/index.js +79 -0
- package/lib/mount-once.js +34 -0
- package/lib/sync.js +168 -0
- package/package.json +32 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# ============================================================
|
|
2
|
+
# devflow-2.0 anchored bootstrap (adapted from dsh-liangshen, MIT; source
|
|
3
|
+
# xiaobright/dsh-anchored-standard)
|
|
4
|
+
#
|
|
5
|
+
# TWO-PHASE PERSONA: the FIRST model request sees only the one-line Minimal
|
|
6
|
+
# persona ("You are a helpful software engineer assistant."), the minimal tool
|
|
7
|
+
# pair (persistent `bash` + `str_replace_editor`), NO runtime contexts and NO
|
|
8
|
+
# auto-injected pre-step messages. After the anchor gate passes (first
|
|
9
|
+
# minimal-like reasoning block, 4-step fallback, or first-response release) the
|
|
10
|
+
# session promotes: the wire switches to Code Mode (PTC — a single `run_code`
|
|
11
|
+
# tool), the FULL DevFlow persona below is restored (with {{model}}/{{cwd}}),
|
|
12
|
+
# and workspace instructions (AGENTS.md digest) + the skill catalog are
|
|
13
|
+
# deferred one step, then stay current.
|
|
14
|
+
#
|
|
15
|
+
# This row MUST stay the FIRST row: the pre-step strip relies on waterfall
|
|
16
|
+
# reverse-registration order so request #1 stays minimal-exact.
|
|
17
|
+
# ============================================================
|
|
18
|
+
- id: tool-bootstrap
|
|
19
|
+
name: ./tool-bootstrap.mjs
|
|
20
|
+
config:
|
|
21
|
+
shellTools: [bash]
|
|
22
|
+
commonTools: [str_replace_editor]
|
|
23
|
+
messageSources: [user]
|
|
24
|
+
anchorGate: true
|
|
25
|
+
maxBootstrapSteps: 4
|
|
26
|
+
promoteAfterFirstResponse: true
|
|
27
|
+
bootstrapMaxTokens: 1024
|
|
28
|
+
# Core work set after a compaction, before re-promotion.
|
|
29
|
+
compactionTools: [read, write, edit, glob, grep, todo_write, ask_user_question]
|
|
30
|
+
deferredSources: [agent-instructions, skill-catalog]
|
|
31
|
+
deferredGraceSteps: 1
|
|
32
|
+
promotedPresentation: code
|
|
33
|
+
phase1Persona: You are a helpful software engineer assistant.
|
|
34
|
+
|
|
35
|
+
# The `devflow` agent preset: the full coding agent plus DevFlow workflow
|
|
36
|
+
# activation, derived from the shipped `standard` preset (kept row-for-row).
|
|
37
|
+
#
|
|
38
|
+
# This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
|
|
39
|
+
# standing scope; every session naming it joins by scope parentage, so the
|
|
40
|
+
# tools and prompt sections registered here cover each joined agent while a
|
|
41
|
+
# session's own state stays keyed per Session/Agent inside the plugins. The
|
|
42
|
+
# host composition (`base.cordis.yml` + `web.cordis.yml`) keeps everything a
|
|
43
|
+
# preset must not own: the registries themselves, the sandbox and approval
|
|
44
|
+
# stack, persistence, and the model route.
|
|
45
|
+
#
|
|
46
|
+
# A service row here MUST sit inside a group carrying an `isolate` realm.
|
|
47
|
+
# Without one it publishes into the root realm, where it is process-global —
|
|
48
|
+
# another preset publishing the same name collides, and a host reader would
|
|
49
|
+
# resolve one preset's instance for every session; `dsh-agent-presets` rejects
|
|
50
|
+
# that at mount. `true` means an entry-local realm: this standing mount's own
|
|
51
|
+
# private instance, apart from every other preset's. (A shared label does NOT
|
|
52
|
+
# pool instances — `provide()` throws on the second registration under the
|
|
53
|
+
# same realm symbol; labels join REALMS, and are not what this file needs.)
|
|
54
|
+
|
|
55
|
+
# ── identity ────────────────────────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
# The preset's own persona, shadowing the deployment default for this agent.
|
|
58
|
+
# `tool-bootstrap` swaps it out during phase 1 (one-line Minimal anchor) and
|
|
59
|
+
# restores THIS text after promotion. The DevFlow paragraph guarantees
|
|
60
|
+
# activation even when the model would otherwise skip reading AGENTS.md; the
|
|
61
|
+
# route table and hard boundaries stay in the devflow-core skill and AGENTS.md
|
|
62
|
+
# (single source, no duplication).
|
|
63
|
+
- id: persona
|
|
64
|
+
name: '@deepseek-ai/dsh-persona'
|
|
65
|
+
config:
|
|
66
|
+
text: |-
|
|
67
|
+
You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
|
|
68
|
+
|
|
69
|
+
You run DevFlow. Before any development work — creating features, building components, adding functionality, modifying behavior, or defining an unapproved problem-directed change — load the `devflow-core` skill with the skill tool and read its `core-methods.md` reference, then load only the selected lifecycle owner skill. The route table and hard boundaries live in that skill and in AGENTS.md; do not invent lifecycle details. Pure Q&A, lookup, verification, and investigation-only reports need no lifecycle.
|
|
70
|
+
|
|
71
|
+
- id: agent-instructions
|
|
72
|
+
name: '@deepseek-ai/dsh-agent-instructions'
|
|
73
|
+
config:
|
|
74
|
+
maxBytes: 65536
|
|
75
|
+
|
|
76
|
+
# ── minimal phase-1 shell ───────────────────────────────────────────────────
|
|
77
|
+
|
|
78
|
+
# The PTY registry is an agent-owned service, so it lives in an entry-local
|
|
79
|
+
# realm. The backend still consumes the host sandbox policy and subprocess
|
|
80
|
+
# implementation, while the tool registers into this agent's scoped catalog.
|
|
81
|
+
# This persistent `bash` replaces the Standard ephemeral shell for the WHOLE
|
|
82
|
+
# session (both tools register the name `bash`), which is the exact-Minimal
|
|
83
|
+
# tradeoff this experimental preset evaluates.
|
|
84
|
+
- id: persistent-shell
|
|
85
|
+
name: cordis:group
|
|
86
|
+
group: true
|
|
87
|
+
isolate:
|
|
88
|
+
terminals: true
|
|
89
|
+
disabled: !!js process.platform === 'win32'
|
|
90
|
+
config:
|
|
91
|
+
- id: pty
|
|
92
|
+
name: '@deepseek-ai/dsh-terminal'
|
|
93
|
+
|
|
94
|
+
- id: terminal-bash
|
|
95
|
+
name: '@deepseek-ai/dsh-terminal-bash'
|
|
96
|
+
config:
|
|
97
|
+
timeoutMs: 300000
|
|
98
|
+
|
|
99
|
+
- id: persistent-bash
|
|
100
|
+
name: '@deepseek-ai/dsh-tool-bash-persistent'
|
|
101
|
+
config:
|
|
102
|
+
timeoutMs: 300000
|
|
103
|
+
description: |-
|
|
104
|
+
Run commands in a bash shell
|
|
105
|
+
* When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.
|
|
106
|
+
* You don't have access to the internet via this tool.
|
|
107
|
+
* You do have access to a mirror of common linux and python packages via apt and pip.
|
|
108
|
+
* State is persistent across command calls and discussions with the user.
|
|
109
|
+
* To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p /path/to/the/file'.
|
|
110
|
+
* Please avoid commands that may produce a very large amount of output.
|
|
111
|
+
* Please run long lived commands in the background, e.g. 'sleep 10 &' or start a server in the background.
|
|
112
|
+
|
|
113
|
+
# Windows-only `bash` tool (custom-bash.mjs): the PTY backend above is
|
|
114
|
+
# linux/darwin-only, so win32 disables the persistent-shell group and
|
|
115
|
+
# registers this `bash` through the ordinary cross-platform subprocess seam
|
|
116
|
+
# (Git Bash). Both platforms end up with exactly one tool named `bash`, so the
|
|
117
|
+
# phase-1 Minimal anchor (shellTools: [bash] + str_replace_editor) is
|
|
118
|
+
# unchanged. Non-zero exit is reported not thrown; state does NOT persist
|
|
119
|
+
# across calls on this path; no OS sandbox confinement on Windows. `bashPath`
|
|
120
|
+
# is optional (defaults to Git Bash inference); set it explicitly only when
|
|
121
|
+
# git is not on PATH.
|
|
122
|
+
- id: custom-bash
|
|
123
|
+
name: ./custom-bash.mjs
|
|
124
|
+
disabled: !!js process.platform !== 'win32'
|
|
125
|
+
|
|
126
|
+
# ── minimal phase-1 filesystem ──────────────────────────────────────────────
|
|
127
|
+
|
|
128
|
+
# Phase-1 editor as a direct top-level row: it reuses the host's sandboxed
|
|
129
|
+
# `ctx.fs`, not a bare local filesystem. No `dsh-fs-local` realm is mounted, so
|
|
130
|
+
# the phase-1 editor inherits the host file sandbox exactly like every
|
|
131
|
+
# Standard file tool, and the model-facing schema stays the builtin Minimal
|
|
132
|
+
# `str_replace_editor`.
|
|
133
|
+
- id: str-replace-editor
|
|
134
|
+
name: '@deepseek-ai/dsh-tool-str-replace-editor'
|
|
135
|
+
config:
|
|
136
|
+
maxOutputChars: 16000
|
|
137
|
+
|
|
138
|
+
# ── standard filesystem tools ───────────────────────────────────────────────
|
|
139
|
+
|
|
140
|
+
# Both register into the host `tools` registry and provide nothing, so
|
|
141
|
+
# they need no realm. The `fs` service and its policy stay in the host.
|
|
142
|
+
- id: tool-fs
|
|
143
|
+
name: '@deepseek-ai/dsh-tool-fs'
|
|
144
|
+
|
|
145
|
+
- id: tool-fs-search
|
|
146
|
+
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
147
|
+
config:
|
|
148
|
+
sampleOverCapGlobResults: false
|
|
149
|
+
|
|
150
|
+
# ── background jobs ────────────────────────────────────────────────────────
|
|
151
|
+
|
|
152
|
+
# Only the model-facing controls. The task REGISTRY stays on the host plane:
|
|
153
|
+
# its producers sit outside any realm this file could put it in, and the
|
|
154
|
+
# registry is keyed by owning agent anyway. With the persistent shell, long
|
|
155
|
+
# commands run through `&`; these controls still expose whatever the host
|
|
156
|
+
# registry tracks.
|
|
157
|
+
- id: tool-jobs
|
|
158
|
+
name: '@deepseek-ai/dsh-tool-jobs'
|
|
159
|
+
|
|
160
|
+
# ── skills ──────────────────────────────────────────────────────────────────
|
|
161
|
+
|
|
162
|
+
# The skill REGISTRY lives in the host composition and is layered per scope:
|
|
163
|
+
# these rows register into THIS preset's layer of it, so they need no realm.
|
|
164
|
+
# `skill-filesystem` contributes local-root discovery for agents on this preset, and
|
|
165
|
+
# `tool-skill` gives them the catalog and loader; the merged catalog also
|
|
166
|
+
# carries whatever the deployment registered globally (repository plugins).
|
|
167
|
+
# The `skill-catalog` pre-step message is quarantined by `tool-bootstrap`
|
|
168
|
+
# during phase 1 and deferred one step after promotion, then stays current.
|
|
169
|
+
- id: skill-filesystem
|
|
170
|
+
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
171
|
+
|
|
172
|
+
- id: tool-skill
|
|
173
|
+
name: '@deepseek-ai/dsh-tool-skill'
|
|
174
|
+
|
|
175
|
+
# ── goals ───────────────────────────────────────────────────────────────────
|
|
176
|
+
|
|
177
|
+
# Only the model-facing tool. The goal SERVICE, its session driver, and the
|
|
178
|
+
# `/goal` command stay on the host plane: the Gateway serves the goal domain as
|
|
179
|
+
# Remote endpoints whose receiver comes from a generated descriptor, so it
|
|
180
|
+
# resolves `goals` on the host and an entry-local realm here would hide it. The
|
|
181
|
+
# registry is keyed by session anyway, so one host instance serves every
|
|
182
|
+
# session. What a preset chooses is whether its agent can call the goal tool.
|
|
183
|
+
- id: tool-goal
|
|
184
|
+
name: '@deepseek-ai/dsh-tool-goal'
|
|
185
|
+
|
|
186
|
+
# ── plan mode ───────────────────────────────────────────────────────────────
|
|
187
|
+
|
|
188
|
+
# Plan state is per-agent by nature, so an entry-local realm is not a
|
|
189
|
+
# workaround here — it is the correct lifetime.
|
|
190
|
+
- id: planning
|
|
191
|
+
name: cordis:group
|
|
192
|
+
group: true
|
|
193
|
+
isolate:
|
|
194
|
+
planMode: true
|
|
195
|
+
config:
|
|
196
|
+
- id: plan-mode
|
|
197
|
+
name: '@deepseek-ai/dsh-plan-mode'
|
|
198
|
+
config:
|
|
199
|
+
section: |
|
|
200
|
+
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.
|
|
201
|
+
|
|
202
|
+
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.
|
|
203
|
+
|
|
204
|
+
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.
|
|
205
|
+
|
|
206
|
+
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.
|
|
207
|
+
|
|
208
|
+
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.
|
|
209
|
+
|
|
210
|
+
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.
|
|
211
|
+
|
|
212
|
+
# ── compaction ──────────────────────────────────────────────────────────────
|
|
213
|
+
|
|
214
|
+
# `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
|
|
215
|
+
# share this realm rather than sit outside it.
|
|
216
|
+
#
|
|
217
|
+
# `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
|
|
218
|
+
# plane, and the rows here resolve that one instance. It takes no configuration,
|
|
219
|
+
# keys every fold by Session, and owns the context-meter projection units the
|
|
220
|
+
# browser reads for every session — behind a realm those units would come and go
|
|
221
|
+
# with whichever presets happen to be mounted. What a preset chooses is whether
|
|
222
|
+
# its agent compacts at all, which is `compaction-basic` below.
|
|
223
|
+
- id: compaction
|
|
224
|
+
name: cordis:group
|
|
225
|
+
group: true
|
|
226
|
+
isolate:
|
|
227
|
+
compaction: true
|
|
228
|
+
toolResultPruner: true
|
|
229
|
+
config:
|
|
230
|
+
- id: compaction-basic
|
|
231
|
+
name: '@deepseek-ai/dsh-compaction-basic'
|
|
232
|
+
|
|
233
|
+
- id: command-compact
|
|
234
|
+
name: '@deepseek-ai/dsh-command-compact'
|
|
235
|
+
|
|
236
|
+
- id: tool-result-pruner
|
|
237
|
+
name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
|
238
|
+
config:
|
|
239
|
+
thresholdChars: 8192
|
|
240
|
+
headChars: 4096
|
|
241
|
+
tailChars: 1024
|
|
242
|
+
|
|
243
|
+
# ── delegation and workflows ────────────────────────────────────────────────
|
|
244
|
+
|
|
245
|
+
# The `subagents` registry and its spawn/fork backends live in the HOST
|
|
246
|
+
# composition: the registry is a process singleton whose cross-session queries
|
|
247
|
+
# the api-proxy serves to the browser, and a provider name may only be
|
|
248
|
+
# registered once. This preset contributes the delegation TOOLS, which resolve
|
|
249
|
+
# that host registry.
|
|
250
|
+
#
|
|
251
|
+
# `workflows` is different — nothing outside an agent reads it — so every row
|
|
252
|
+
# that reaches it shares one entry-local realm here, and a consumer left
|
|
253
|
+
# outside would resolve a host registry this preset does not populate.
|
|
254
|
+
#
|
|
255
|
+
# `tool-subagent-report` is host-plane for the same reason as the registry,
|
|
256
|
+
# not because a preset may not want it: it registers a CONTINUABLE SETUP on
|
|
257
|
+
# that singleton rather than a tool this agent calls, and the setup list is
|
|
258
|
+
# not scope-aware — one copy per mounted preset means every child gets
|
|
259
|
+
# `report` registered once per live session, which throws on the second.
|
|
260
|
+
- id: delegation
|
|
261
|
+
name: cordis:group
|
|
262
|
+
group: true
|
|
263
|
+
isolate:
|
|
264
|
+
workflowEngine: true
|
|
265
|
+
config:
|
|
266
|
+
- id: tool-subagent-control
|
|
267
|
+
name: '@deepseek-ai/dsh-tool-subagent-control'
|
|
268
|
+
|
|
269
|
+
- id: tool-subagent-list-agents
|
|
270
|
+
name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
|
|
271
|
+
|
|
272
|
+
- id: tool-subagent
|
|
273
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
274
|
+
config:
|
|
275
|
+
provider: spawn
|
|
276
|
+
toolName: subagent
|
|
277
|
+
backgroundMode: continuable
|
|
278
|
+
|
|
279
|
+
- id: tool-subagent-fork
|
|
280
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
281
|
+
config:
|
|
282
|
+
provider: fork
|
|
283
|
+
toolName: subagent_fork
|
|
284
|
+
backgroundMode: continuable
|
|
285
|
+
|
|
286
|
+
# Product providers are host-plane singletons. Copy this preset, then
|
|
287
|
+
# remove `disabled` from either ordinary tool row to expose that product
|
|
288
|
+
# only to agents composed from the copy.
|
|
289
|
+
- id: tool-subagent-codex
|
|
290
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
291
|
+
disabled: true
|
|
292
|
+
config:
|
|
293
|
+
provider: codex
|
|
294
|
+
toolName: subagent_codex
|
|
295
|
+
enableRunInBackground: false
|
|
296
|
+
maxDepth: provider-managed
|
|
297
|
+
|
|
298
|
+
- id: tool-subagent-claude-code
|
|
299
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
300
|
+
disabled: true
|
|
301
|
+
config:
|
|
302
|
+
provider: claude-code
|
|
303
|
+
toolName: subagent_claude_code
|
|
304
|
+
enableRunInBackground: false
|
|
305
|
+
maxDepth: provider-managed
|
|
306
|
+
|
|
307
|
+
- id: workflow-worker-thread
|
|
308
|
+
name: '@deepseek-ai/dsh-workflow-worker-thread'
|
|
309
|
+
config:
|
|
310
|
+
provider: spawn
|
|
311
|
+
|
|
312
|
+
- id: tool-workflow
|
|
313
|
+
name: '@deepseek-ai/dsh-tool-workflow'
|
|
314
|
+
|
|
315
|
+
- id: tool-ralph
|
|
316
|
+
name: '@deepseek-ai/dsh-tool-ralph'
|
|
317
|
+
config:
|
|
318
|
+
subagentProvider: spawn
|
|
319
|
+
maxRounds: 64
|
|
320
|
+
|
|
321
|
+
# ── remaining model-facing rows ─────────────────────────────────────────────
|
|
322
|
+
|
|
323
|
+
- id: tool-ask-user
|
|
324
|
+
name: '@deepseek-ai/dsh-tool-ask-user'
|
|
325
|
+
|
|
326
|
+
- id: tool-todo
|
|
327
|
+
name: '@deepseek-ai/dsh-tool-todo'
|
|
328
|
+
config:
|
|
329
|
+
allowParallelInProgress: true
|
|
330
|
+
|
|
331
|
+
# The `web` service and its search provider stay in the host composition; only
|
|
332
|
+
# the model-facing tool is per-session.
|
|
333
|
+
- id: tool-web
|
|
334
|
+
name: '@deepseek-ai/dsh-tool-web'
|
|
335
|
+
config:
|
|
336
|
+
fetch: false
|
|
337
|
+
searchTimeoutMs: 60000
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* custom-bash — a Windows-capable `bash` tool for the liangshen preset. It
|
|
3
|
+
* registers under the SAME name (`bash`) as the persistent shell so the
|
|
4
|
+
* phase-1 Minimal anchor (bash + str_replace_editor) holds on every platform,
|
|
5
|
+
* but executes through `ctx.subprocess.spawn` instead of a PTY.
|
|
6
|
+
*
|
|
7
|
+
* WHY: DSH's PTY backend is linux/darwin-only — subprocess-local throws
|
|
8
|
+
* "terminal inspection is unsupported on platform win32", so the
|
|
9
|
+
* persistent-shell group (dsh-terminal + dsh-terminal-bash +
|
|
10
|
+
* dsh-tool-bash-persistent) cannot spawn on Windows. agent.cordis.yml disables
|
|
11
|
+
* that group on win32 and enables this tool instead; both platforms end up
|
|
12
|
+
* with exactly one `bash` tool and the byte-exact schema anchor is kept.
|
|
13
|
+
*
|
|
14
|
+
* Executable resolution (config `bashPath`, no hardcoded install path):
|
|
15
|
+
* an explicit non-empty `bashPath` wins unconditionally. Unset, the Git Bash
|
|
16
|
+
* executable is INFERRED in probe order:
|
|
17
|
+
* 1. the `git` executable on PATH — its install root carries `bin\bash.exe`
|
|
18
|
+
* one level up from `cmd\`, beside `bin\`, or two levels up from
|
|
19
|
+
* `mingw64\bin\` (the standard installer, choco, and winget all resolve
|
|
20
|
+
* here);
|
|
21
|
+
* 2. the well-known Git-for-Windows roots derived from environment variables
|
|
22
|
+
* (ProgramFiles, ProgramFiles(x86), LOCALAPPDATA\Programs\Git, scoop's
|
|
23
|
+
* ~\scoop\apps\git\current junction);
|
|
24
|
+
* 3. plain `bash` through `ctx.subprocess.resolveExecutable` (PATH lookup —
|
|
25
|
+
* last resort; on Windows that may pick the WSL shim, which is still true
|
|
26
|
+
* bash even though paths shift to /mnt/…).
|
|
27
|
+
*
|
|
28
|
+
* If NOTHING resolves the tool fails with an actionable error — it never
|
|
29
|
+
* silently executes under pwsh/cmd, which are different command languages.
|
|
30
|
+
*
|
|
31
|
+
* Semantics mirror the official bash tool: `bash -c <command>` in a fresh
|
|
32
|
+
* process, bounded output, non-zero exit reported not thrown. No sandbox
|
|
33
|
+
* confinement on Windows (the sandbox backend is linux-only); the description
|
|
34
|
+
* says so.
|
|
35
|
+
*
|
|
36
|
+
* Ported from xiaobright/dsh-anchored-standard (MIT) — see NOTICE.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
import { access } from 'node:fs/promises'
|
|
40
|
+
import { dirname, join } from 'node:path'
|
|
41
|
+
|
|
42
|
+
/** Cordis plugin name used by loader diagnostics. */
|
|
43
|
+
export const name = 'custom-bash'
|
|
44
|
+
|
|
45
|
+
/** The subprocess and tools services must exist before this tool can register. */
|
|
46
|
+
export const inject = ['subprocess', 'tools']
|
|
47
|
+
|
|
48
|
+
const DEFAULT_TIMEOUT_MS = 120000
|
|
49
|
+
const DEFAULT_MAX_OUTPUT_BYTES = 64000
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Git Bash candidate paths, in probe order (see the header): the `git`
|
|
53
|
+
* executable's install root first, then the well-known env-derived roots.
|
|
54
|
+
* Exported for tests; pure — existence probing happens at the call site.
|
|
55
|
+
*/
|
|
56
|
+
export function bashCandidates(env, gitExe) {
|
|
57
|
+
const candidates = []
|
|
58
|
+
// git at <root>\cmd\git.exe (installer/scoop) or <root>\bin\git.exe →
|
|
59
|
+
// <root>\bin\bash.exe; <root>\mingw64\bin\git.exe (portable) → two up.
|
|
60
|
+
// A bare relative name means `git` did not actually resolve to a path.
|
|
61
|
+
if (typeof gitExe === 'string' && /[/\\]/.test(gitExe)) {
|
|
62
|
+
const dir = dirname(gitExe)
|
|
63
|
+
const root = dirname(dir)
|
|
64
|
+
candidates.push(
|
|
65
|
+
join(root, 'bin', 'bash.exe'),
|
|
66
|
+
join(dir, 'bash.exe'),
|
|
67
|
+
join(dirname(root), 'bin', 'bash.exe'),
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
if (env.ProgramFiles) candidates.push(join(env.ProgramFiles, 'Git', 'bin', 'bash.exe'))
|
|
71
|
+
if (env['ProgramFiles(x86)']) candidates.push(join(env['ProgramFiles(x86)'], 'Git', 'bin', 'bash.exe'))
|
|
72
|
+
if (env.LOCALAPPDATA) candidates.push(join(env.LOCALAPPDATA, 'Programs', 'Git', 'bin', 'bash.exe'))
|
|
73
|
+
if (env.USERPROFILE) candidates.push(join(env.USERPROFILE, 'scoop', 'apps', 'git', 'current', 'bin', 'bash.exe'))
|
|
74
|
+
// Layouts overlap (a `bin` git.exe derives the same bash twice) — probe
|
|
75
|
+
// order survives the dedupe, insertion order is preserved.
|
|
76
|
+
return [...new Set(candidates)]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Tool parameter schema for the model-facing command. */
|
|
80
|
+
const commandSchema = {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: {
|
|
83
|
+
command: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
description: 'The bash command to execute (`bash -c` string domain).',
|
|
86
|
+
},
|
|
87
|
+
workdir: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
description: 'Optional working directory; defaults to the session cwd.',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
required: ['command'],
|
|
93
|
+
additionalProperties: false,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Register the model-facing `bash` tool. */
|
|
97
|
+
export function apply(ctx, config) {
|
|
98
|
+
const explicitBashPath = typeof config?.bashPath === 'string' && config.bashPath.length > 0 ? config.bashPath : undefined
|
|
99
|
+
const timeoutMs = Number.isSafeInteger(config?.timeoutMs) && config.timeoutMs > 0 ? config.timeoutMs : DEFAULT_TIMEOUT_MS
|
|
100
|
+
const maxOutputBytes = Number.isSafeInteger(config?.maxOutputBytes) && config.maxOutputBytes > 0 ? config.maxOutputBytes : DEFAULT_MAX_OUTPUT_BYTES
|
|
101
|
+
|
|
102
|
+
// The inferred executable is memoized per plugin instance: candidate probing
|
|
103
|
+
// walks the filesystem, and the answer cannot change within a mount. A
|
|
104
|
+
// failed inference is NOT memoized — the plain `bash` fallback resolves
|
|
105
|
+
// fresh on every execute until some probe succeeds.
|
|
106
|
+
let inferredShell
|
|
107
|
+
const exists = (path) => access(path).then(() => true, () => false)
|
|
108
|
+
const resolveShell = async (signal) => {
|
|
109
|
+
if (explicitBashPath !== undefined) {
|
|
110
|
+
// A misconfigured explicit path must fail as itself, not as a
|
|
111
|
+
// discovery miss — the raw resolution error says which path failed.
|
|
112
|
+
return ctx.subprocess.resolveExecutable(explicitBashPath, undefined, signal)
|
|
113
|
+
}
|
|
114
|
+
if (inferredShell !== undefined) {
|
|
115
|
+
return ctx.subprocess.resolveExecutable(inferredShell, undefined, signal)
|
|
116
|
+
}
|
|
117
|
+
let gitExe
|
|
118
|
+
try {
|
|
119
|
+
gitExe = await ctx.subprocess.resolveExecutable('git', undefined, signal)
|
|
120
|
+
} catch {
|
|
121
|
+
// git unresolvable → the env-derived candidates below still apply
|
|
122
|
+
}
|
|
123
|
+
for (const candidate of bashCandidates(process.env, gitExe)) {
|
|
124
|
+
if (!(await exists(candidate))) continue
|
|
125
|
+
try {
|
|
126
|
+
inferredShell = await ctx.subprocess.resolveExecutable(candidate, undefined, signal)
|
|
127
|
+
return inferredShell
|
|
128
|
+
} catch {
|
|
129
|
+
// Exists but unresolvable (EPERM, a broken scoop junction): keep
|
|
130
|
+
// probing — one bad root must not block the rest of the chain, and
|
|
131
|
+
// nothing is memoized so later executes can still find a good one.
|
|
132
|
+
continue
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
return await ctx.subprocess.resolveExecutable('bash', undefined, signal)
|
|
137
|
+
} catch (error) {
|
|
138
|
+
// Total discovery failure (no Git Bash root, no env root, no bash on
|
|
139
|
+
// PATH): name the remedies instead of leaking a raw ENOENT. Never
|
|
140
|
+
// fall back to pwsh/cmd here — the schema promises `bash -c`
|
|
141
|
+
// semantics; a different shell would silently break every command.
|
|
142
|
+
throw new Error(`bash executable not found — install Git for Windows, expose a bash on PATH, or set the custom-bash \`bashPath\` config (${String((error && error.message) || error)})`)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
ctx.tools.register({
|
|
147
|
+
name: 'bash',
|
|
148
|
+
description: [
|
|
149
|
+
'Run commands in a bash shell (Git Bash on Windows)',
|
|
150
|
+
'* When invoking this tool, the contents of the "command" parameter does NOT need to be XML-escaped.',
|
|
151
|
+
"* You don't have access to the internet via this tool.",
|
|
152
|
+
'* You do have access to a mirror of common linux and python packages via apt and pip.',
|
|
153
|
+
'* State does NOT persist across command calls: each call runs in a fresh shell.',
|
|
154
|
+
"* To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p /path/to/the/file'.",
|
|
155
|
+
'* Please avoid commands that may produce a very large amount of output.',
|
|
156
|
+
'* NOTE: runs without OS sandbox confinement on Windows (no landlock); treat output as untrusted.',
|
|
157
|
+
].join('\n'),
|
|
158
|
+
parameters: commandSchema,
|
|
159
|
+
output: {
|
|
160
|
+
schema: {
|
|
161
|
+
type: 'object',
|
|
162
|
+
additionalProperties: false,
|
|
163
|
+
properties: {
|
|
164
|
+
text: { type: 'string' },
|
|
165
|
+
},
|
|
166
|
+
required: ['text'],
|
|
167
|
+
},
|
|
168
|
+
render: (_args, value) => [{ type: 'text', text: value.text }],
|
|
169
|
+
},
|
|
170
|
+
async execute(args, exec) {
|
|
171
|
+
const shell = await resolveShell(exec?.signal)
|
|
172
|
+
const workdir = typeof args.workdir === 'string' && args.workdir.length > 0
|
|
173
|
+
? args.workdir
|
|
174
|
+
: exec?.agent?.session?.header?.cwd
|
|
175
|
+
const signal = exec?.signal
|
|
176
|
+
const handle = ctx.subprocess.spawn({
|
|
177
|
+
argv: [shell, '-c', args.command],
|
|
178
|
+
...workdir !== undefined ? { cwd: workdir } : {},
|
|
179
|
+
stdio: {
|
|
180
|
+
stdin: 'ignore',
|
|
181
|
+
stdout: { maxBytes: maxOutputBytes },
|
|
182
|
+
stderr: { maxBytes: maxOutputBytes },
|
|
183
|
+
},
|
|
184
|
+
...signal !== undefined ? { signal } : {},
|
|
185
|
+
graceMs: 3000,
|
|
186
|
+
})
|
|
187
|
+
let outcome
|
|
188
|
+
try {
|
|
189
|
+
outcome = await handle.done
|
|
190
|
+
} catch (error) {
|
|
191
|
+
// A spawn-level failure (bad executable, EPERM) surfaces as a throw,
|
|
192
|
+
// which the runtime turns into an isError result.
|
|
193
|
+
throw new Error(`bash spawn failed: ${String(error)}`)
|
|
194
|
+
}
|
|
195
|
+
let stdout = ''
|
|
196
|
+
let stderr = ''
|
|
197
|
+
try {
|
|
198
|
+
stdout = handle.collected.stdout.readFrom(0).text
|
|
199
|
+
stderr = handle.collected.stderr.readFrom(0).text
|
|
200
|
+
} catch {
|
|
201
|
+
// Collected readers may be unavailable on some backends; tolerate.
|
|
202
|
+
}
|
|
203
|
+
const text = [stdout, stderr].filter((part) => part.length > 0).join('\n')
|
|
204
|
+
const tail = text.length > 0 ? text : `exit code: ${outcome.exitCode} (no output)`
|
|
205
|
+
if (outcome.exitCode !== 0) {
|
|
206
|
+
// Non-zero exit is a reported failure, not a throw: the model sees the
|
|
207
|
+
// command output plus the exit code.
|
|
208
|
+
throw new Error(tail)
|
|
209
|
+
}
|
|
210
|
+
return { text: tail }
|
|
211
|
+
},
|
|
212
|
+
})
|
|
213
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
name: DevFlow 2.0 (Anchored)
|
|
2
|
+
description: DevFlow 开发工作流 + 梁神式两阶段锚定:首个请求只暴露一行 persona(You are a helpful software engineer assistant.)+ 最小工具对(持久 bash + str_replace_editor),无运行时上下文与任何注入;anchorGate 门控(首个 minimal-like 推理块或 4 步兜底)+ 1024 输出预算稳定锚定后,晋升为 Code Mode(单一 run_code),恢复完整 DevFlow 人设并自动激活 devflow-core 生命周期(Brainstorm → Spec/Cut → Plan → Build → Prove)与验证完成闭环;workspace 指令与技能目录延迟一步注入。
|
|
3
|
+
order: 6
|