@ran-sh/dsh-crew 0.3.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 (85) hide show
  1. package/.claude-plugin/marketplace.json +17 -0
  2. package/.claude-plugin/plugin.json +8 -0
  3. package/.mcp.json +8 -0
  4. package/LICENSE +21 -0
  5. package/README.de.md +359 -0
  6. package/README.es.md +359 -0
  7. package/README.fr.md +359 -0
  8. package/README.hi.md +359 -0
  9. package/README.id.md +359 -0
  10. package/README.ja.md +359 -0
  11. package/README.ko.md +359 -0
  12. package/README.md +360 -0
  13. package/README.pt.md +359 -0
  14. package/README.ru.md +359 -0
  15. package/README.th.md +359 -0
  16. package/README.tr.md +359 -0
  17. package/README.vi.md +359 -0
  18. package/README.zh-TW.md +359 -0
  19. package/README.zh.md +305 -0
  20. package/agents/ds-flash.md +26 -0
  21. package/agents/ds-pro.md +32 -0
  22. package/agents/ds-reviewer.md +23 -0
  23. package/agents/ds-worker.md +22 -0
  24. package/codex/agents/ds-flash.toml +30 -0
  25. package/codex/agents/ds-pro.toml +31 -0
  26. package/codex/agents/ds-reviewer.toml +28 -0
  27. package/codex/agents/ds-worker.toml +28 -0
  28. package/codex/prompts/dsh-config.md +3 -0
  29. package/codex/prompts/dsh-status.md +1 -0
  30. package/commands/config.md +11 -0
  31. package/commands/off.md +5 -0
  32. package/commands/on.md +5 -0
  33. package/commands/status.md +5 -0
  34. package/cordis.patch.yml +4 -0
  35. package/docs/images/dsh-crew-host.png +0 -0
  36. package/docs/images/dsh-crew-jobs.png +0 -0
  37. package/docs/images/dsh-crew-logo.png +0 -0
  38. package/docs/images/dsh-crew-overview.png +0 -0
  39. package/lib/client.js +2765 -0
  40. package/package.json +125 -0
  41. package/scripts/build-client.mjs +28 -0
  42. package/scripts/live-crew-smoke.mjs +39 -0
  43. package/scripts/live-policy-matrix.mjs +177 -0
  44. package/scripts/policy-probe.mjs +101 -0
  45. package/scripts/setup.mjs +294 -0
  46. package/scripts/smoke-real.mjs +110 -0
  47. package/scripts/smoke.mjs +78 -0
  48. package/scripts/verify-installer-fix.mjs +26 -0
  49. package/src/adaptive-routing.mjs +260 -0
  50. package/src/client/activation-summary.tsx +64 -0
  51. package/src/client/entry.tsx +236 -0
  52. package/src/client/index.tsx +1120 -0
  53. package/src/config-readiness.mjs +59 -0
  54. package/src/delivery.mjs +205 -0
  55. package/src/dsh-cli-runtime.mjs +251 -0
  56. package/src/failure-classification.mjs +172 -0
  57. package/src/hub/entry.mjs +98 -0
  58. package/src/hub/index.mjs +757 -0
  59. package/src/hub-client.mjs +132 -0
  60. package/src/hub-compatibility.mjs +49 -0
  61. package/src/i18n.mjs +19 -0
  62. package/src/install/cli.mjs +28 -0
  63. package/src/install/install-legacy.mjs +460 -0
  64. package/src/install/install.mjs +451 -0
  65. package/src/jobs.mjs +275 -0
  66. package/src/mcp-runtime.mjs +257 -0
  67. package/src/model-catalog.mjs +173 -0
  68. package/src/model-routing.mjs +391 -0
  69. package/src/multimodal.mjs +0 -0
  70. package/src/policy-legacy.mjs +830 -0
  71. package/src/policy.mjs +197 -0
  72. package/src/readiness-matrix.mjs +169 -0
  73. package/src/runtime-controls.mjs +90 -0
  74. package/src/runtime-identity.mjs +108 -0
  75. package/src/server.mjs +477 -0
  76. package/src/status-shard.mjs +52 -0
  77. package/src/structured-error-code.mjs +39 -0
  78. package/src/vision-route.mjs +138 -0
  79. package/src/workflow-runtime.mjs +567 -0
  80. package/src/workflow.mjs +160 -0
  81. package/src/workspace-audit.mjs +231 -0
  82. package/src/workspace-isolation.mjs +306 -0
  83. package/statusline/statusline.sh +14 -0
  84. package/statusline/worker-segment.sh +35 -0
  85. package/worker.cordis.yml +77 -0
package/README.md ADDED
@@ -0,0 +1,360 @@
1
+ <p align="center">
2
+ <img src="./docs/images/dsh-crew-logo.png" alt="DSH Crew" width="120" />
3
+ </p>
4
+
5
+ <h1 align="center">DSH Crew</h1>
6
+
7
+ <p align="center">
8
+ <strong>Use Codex Desktop or Claude Code as the orchestrator, and dispatch coding work to DeepSeek Harness workers (with an independent reviewer role) over configurable Worker Model Policies.</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="./README.md"><b>English</b></a> · <a href="./README.zh.md">简体中文</a>
13
+ </p>
14
+
15
+ ## Features
16
+
17
+ - Codex Desktop / Claude Code as the main orchestrator
18
+ - **Roles**: worker (implementation / fixes / tests / search) and reviewer (independent review + verdict)
19
+ - **Model Policy**: each role resolves its own ordered provider/model candidates (preferred → priority → escalation → Harness Default)
20
+ - Legacy Flash Only · Pro Only · Balanced · Review Pipeline modes migrate onto the role model automatically
21
+ - Follow DSH Provider
22
+ - First-class DSH Hub sessions (visible in the Web UI, async jobs with progress)
23
+ - Optional Vision / Image Generation (independently switchable)
24
+
25
+ ## How it works
26
+
27
+ ```
28
+ Codex Desktop / Claude Code
29
+
30
+
31
+ dsh-crew
32
+
33
+ Workflow (run + spawn share one state machine)
34
+
35
+ ┌────┴────┐
36
+ │ │
37
+ worker reviewer
38
+ │ │
39
+ Model Policy │ (each role resolves its own provider/model candidates;
40
+ cheap→strong │ escalation steps on evidence: FAIL tests, missing
41
+ │ │ delivery, blocked tasks)
42
+ └────┬────┘
43
+
44
+
45
+ DeepSeek Harness
46
+
47
+
48
+ DSH selected provider/model
49
+ ```
50
+
51
+ The orchestrator picks **what** to do and decides accept / reject / revise.
52
+ The workflow decides **when / state**. **Roles** decide **who** (worker executes,
53
+ reviewer reviews). **Model Policy** decides **which model** (never fixed to a
54
+ role). Workspace isolation decides **where** (each coding worker runs in its
55
+ own temporary git worktree, so parallel workers never write the same working
56
+ tree). Verification / reviewer decide **whether to accept**.
57
+
58
+ ## Install
59
+
60
+ Prerequisites: Node.js with npm/npx, Git, and pnpm. The source setup installer is
61
+ the safe cross-platform path because it controls the Crew DSH home and profile.
62
+
63
+ > **Official Harness isolation** — dsh-crew installs into its own dedicated DSH
64
+ > home (`~/.config/dsh-crew/harness`) and profile (`dsh-crew`), never into the
65
+ > official DSH home (`~/.dsh`) or the official `web` profile. Your normal
66
+ > DeepSeek Harness installation is never modified.
67
+
68
+ From a clone of this repository, cross-platform:
69
+
70
+ ```bash
71
+ node scripts/setup.mjs install
72
+ ```
73
+
74
+ or on Windows:
75
+
76
+ ```bat
77
+ install.cmd
78
+ ```
79
+
80
+ Then open **Settings → DSH Crew** and click **Install** for Codex. Claude Code
81
+ integration is optional and has its own Install button.
82
+
83
+ The installer links this local checkout as `@ran-sh/dsh-crew` in the dedicated
84
+ `dsh-crew` profile, points the Crew Hub at its own port, and does not touch the
85
+ official DSH web profile or any official credential store. Crew is not published
86
+ to the npm registry.
87
+
88
+ ### Update
89
+
90
+ Re-run the source installer after pulling:
91
+
92
+ ```bash
93
+ git pull
94
+ node scripts/setup.mjs install
95
+ ```
96
+
97
+ Restart DSH after updating.
98
+
99
+ ### Migrating an older fork install
100
+
101
+ Legacy releases installed Crew into the official DSH `web` profile. Those
102
+ installs are outside the supported path. Uninstall any legacy Crew (see
103
+ Uninstall), then run the source installer above, which installs into the
104
+ dedicated Crew home/profile.
105
+
106
+ ### Legacy web-profile commands (unsupported — reference only)
107
+
108
+ Older releases and tooling used direct `--profile web` commands that put Crew
109
+ inside the official DSH `web` profile. Those commands are **not supported** and
110
+ must not be used for new installs, updates, or uninstalls — the official web
111
+ profile is never modified by supported Crew tooling:
112
+
113
+ ```bash
114
+ npx -y @deepseek-ai/dsh plugin --profile web add github:Ran-sh/dsh-crew
115
+ npx -y @deepseek-ai/dsh plugin --profile web remove @ran-sh/dsh-crew
116
+ npx -y @deepseek-ai/dsh plugin --profile web remove @zseven-w/dsh-crew
117
+ ```
118
+
119
+ `ZSeven-W/dsh-crew` is the upstream project identity; this fork is
120
+ `Ran-sh/dsh-crew`. Use the source installer/uninstaller
121
+ (`node scripts/setup.mjs install|uninstall`) instead.
122
+
123
+ ### Migrating from Flash / Pro (v0.1 → v0.2 roles)
124
+
125
+ v0.2 keeps every old configuration field working. `collaboration_mode`,
126
+ `tier_policy`, `flash_state` / `pro_state`, `flash_model_priority` /
127
+ `pro_model_priority`, `escalate_on_failure` and `pro_reviews_flash` are all
128
+ still read, and a centralized migration rebuilds the role model from them:
129
+
130
+ - `flash-only` → worker auto, reviewer disabled, `economy` strategy.
131
+ - `pro-only` → worker auto (strong model class), reviewer disabled.
132
+ - `balanced` → worker auto, reviewer manual (available on request).
133
+ - `review-pipeline` → worker auto + reviewer auto (`auto_review` on);
134
+ reviewer uses the old Pro priority.
135
+ - `escalate_on_failure` → worker escalation policy `enabled`.
136
+ - `pro_reviews_flash` → automatic review after a successful worker run.
137
+
138
+ The old `ds-flash` / `ds-pro` subagents remain as **deprecated aliases**: they
139
+ map to the worker role with a legacy model-class hint, so existing prompts
140
+ keep working, but new prompts should use `ds-worker` / `ds-reviewer`. A
141
+ request that names both a role and a contradicting legacy tier is rejected
142
+ with a clear `ROLE_TIER_CONFLICT` error — never silently guessed.
143
+
144
+ ### Troubleshooting: `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`
145
+
146
+ pnpm 11 enforces a default supply-chain policy (`minimum-release-age`, 24h):
147
+ a lockfile entry published within the last day is rejected unless listed under
148
+ `minimumReleaseAgeExclude`. Installing Crew into a fresh dedicated `dsh-crew`
149
+ profile is unaffected, but if the Crew profile already contains a just-published
150
+ DSH-plugin (for example the optional `dsh-plugin-image-mind`), the install fails
151
+ with this error.
152
+
153
+ Unblock it by adding the package (bare name, no version) under
154
+ `minimumReleaseAgeExclude` in the **Crew profile's** `pnpm-workspace.yaml`, then
155
+ re-run the installer:
156
+
157
+ ```yaml
158
+ # ~/.config/dsh-crew/harness/profiles/dsh-crew/pnpm-workspace.yaml
159
+ minimumReleaseAgeExclude:
160
+ - dsh-plugin-image-mind
161
+ - '@ran-sh/dsh-vision@0.1.0'
162
+ ```
163
+
164
+ Notes: the official DSH home (`~/.dsh`) and its `web` profile are never edited
165
+ by Crew tooling. Use a bare package name — listing multiple `pkg@version`
166
+ entries for the same name only honors the first (first-match-wins), which can
167
+ leave newer versions blocked. Keep the entries in `pnpm-workspace.yaml`; the
168
+ verifier does not read `.npmrc`. The policy only applies to registry packages
169
+ younger than one day (git-hosted installs like Crew itself are never
170
+ age-checked), so the failure is transient and self-heals within 24 hours.
171
+
172
+ ## Uninstall
173
+
174
+ DSH Crew and its Codex / Claude Code integrations are separate layers:
175
+
176
+ 1. In **Settings → DSH Crew**, click **Restore** for Codex and Claude Code integrations that you installed.
177
+ 2. Uninstall the Crew plugin from the dedicated Crew profile:
178
+
179
+ ```bash
180
+ node scripts/setup.mjs uninstall
181
+ ```
182
+
183
+ Legacy Crew installs that were previously placed into the official DSH `web`
184
+ profile must be removed for that profile using the DSH CLI against the official
185
+ home, without changing anything else there. Removing the Crew plugin does not
186
+ implicitly edit `~/.codex` or `~/.claude`. Crew configuration, backups,
187
+ credentials, and other DSH bundles are preserved.
188
+
189
+ ## Development / Source install
190
+
191
+ The source installer remains available for contributors and local checkout development.
192
+
193
+ Windows:
194
+
195
+ ```bat
196
+ git clone https://github.com/Ran-sh/dsh-crew.git
197
+ cd dsh-crew
198
+ install.cmd
199
+ ```
200
+
201
+ To update later:
202
+
203
+ ```bat
204
+ git pull
205
+ install.cmd
206
+ ```
207
+
208
+ Cross-platform:
209
+
210
+ ```bash
211
+ node scripts/setup.mjs install
212
+ ```
213
+
214
+ The source installer:
215
+
216
+ - links this local checkout into the dedicated Crew profile (`dsh-crew`) under
217
+ the Crew-owned DSH home (`~/.config/dsh-crew/harness`), never the official
218
+ `web` profile (`link:<repo>`)
219
+ - installs the Codex Desktop integration (no `codex` CLI required)
220
+ - installs the Claude Code integration automatically when the `claude` CLI is detected (optional)
221
+ - is idempotent — safe to re-run
222
+
223
+ Source uninstall on Windows:
224
+
225
+ ```bat
226
+ uninstall.cmd
227
+ ```
228
+
229
+ Source uninstall cross-platform:
230
+
231
+ ```bash
232
+ node scripts/setup.mjs uninstall
233
+ ```
234
+
235
+ It removes:
236
+
237
+ - DSH Crew from the dedicated Crew profile (official web profile is never touched)
238
+ - Codex Desktop integration
239
+ - Claude Code integration
240
+
241
+ It keeps:
242
+
243
+ - the repository
244
+ - Crew config (`~/.config/dsh-crew`)
245
+ - backups and credentials
246
+
247
+ ## Quick Start
248
+
249
+ 1. Start the official DeepSeek Harness as usual (its home and `web` profile are
250
+ never modified by Crew).
251
+ 2. Open **Settings → DSH Crew** (the Crew Settings surface is served by the
252
+ Crew-owned Hub).
253
+ 3. Keep the fresh default workflow: Codex → **worker** role → Codex (reviewer off).
254
+ 4. Use **Refresh Harness Models** to choose ordered per-role model priorities when needed.
255
+ 5. Restart Codex Desktop / Claude Code.
256
+
257
+ Then just say:
258
+
259
+ - “Use ds-worker to implement this change.”
260
+ - “Use ds-reviewer to review this implementation.”
261
+
262
+ ## Roles
263
+
264
+ - **worker** — the executing role: implementation, fixes, tests, search, analysis. The default role for any coding request. It is a thin dispatcher; which model backs it is the Worker Model Policy's job.
265
+ - **reviewer** — the independent review role: inspects the implementation outcome, the workspace diff, tests and risks, and returns a verdict. Review-only by default; it does not re-implement.
266
+ - **ds-flash / ds-pro** remain as deprecated aliases for compatibility (see migration above).
267
+
268
+ A role's state is `disabled | manual | auto`: a disabled role refuses every
269
+ request, a manual role runs only when explicitly named, an auto role may be
270
+ chosen by the orchestrator. The effective state comes from the legacy
271
+ collaboration mode until you adopt the canonical config.
272
+
273
+ ## Model Policy
274
+
275
+ Each role resolves its own ordered provider/model candidates through the live
276
+ Harness catalog:
277
+
278
+ - attempt 0 → the role's primary (cheap/fast) priority;
279
+ - attempt ≥ 1 → the escalation (strong) priority — escalation happens on
280
+ *evidence* (FAIL tests, incomplete delivery, blocked/incomplete task,
281
+ workspace diff that disagrees with the worker's report), not on failure
282
+ alone, and never beyond `max_attempts` (0..max-1, total attempts);
283
+ - otherwise → Harness Default.
284
+
285
+ Infrastructure failures (missing API key, unreachable hub, non-git workspace
286
+ under worktree isolation) are **never** "fixed" by a stronger model — they
287
+ fail with a stable error code instead. Flash / Pro survive only as legacy
288
+ model-class hints (`deepseek-v4-flash` / `deepseek-v4-pro`); they are not
289
+ roles.
290
+
291
+ ## Workflow
292
+
293
+ Every dispatch — `dsh_run_worker` (blocking) and `dsh_spawn_worker` (async),
294
+ Hub or Standalone — runs the **same** workflow runtime:
295
+
296
+ ```
297
+ CREATED -> (QUEUED when busy) -> RUNNING -> VERIFYING
298
+ -> ESCALATING (evidence) -> RUNNING -> VERIFYING
299
+ -> REVIEWING (automatic reviewer) -> READY -> COMPLETED
300
+ (or FAILED / CANCELLED)
301
+ ```
302
+
303
+ The only difference between blocking and async is whether the caller awaits.
304
+ A coding worker runs in its own temporary git worktree (isolated execution);
305
+ a `change candidate` (base revision, committed + uncommitted + new-file
306
+ changes, bounded redacted patch, fingerprint) is returned for the orchestrator
307
+ to accept / reject / revise — the runtime never auto-merges into your working
308
+ tree.
309
+
310
+ ### Isolation
311
+
312
+ `execution.isolation` is `worktree` by default: a worker role converges on a
313
+ fresh detached worktree at HEAD and the primary workspace is never modified
314
+ (even while it is dirty; uncommitted primary changes are not folded in). If
315
+ the requested workspace is **not** a git repository, worktree-isolated jobs
316
+ fail closed (`NOT_GIT_REPOSITORY`) instead of silently sharing — set
317
+ `execution.isolation: "shared"` to allow the legacy in-place behavior.
318
+
319
+ ## Modes
320
+
321
+ | Mode | Mapped role behavior |
322
+ |---|---|
323
+ | Flash Only | worker auto, reviewer disabled, economy model strategy |
324
+ | Pro Only | worker auto on the strong model class, reviewer disabled |
325
+ | Balanced | worker auto, reviewer manual (available on request) |
326
+ | Review Pipeline | worker auto + reviewer auto (`auto_review` on) |
327
+
328
+ Custom mode configures worker / reviewer states directly.
329
+
330
+ ## Provider
331
+
332
+ Crew reads every provider and model currently registered in DeepSeek Harness. Each role resolves its own candidates: the **worker** uses a primary (cheap) priority with an escalation (strong) pool, and the **reviewer** has an independent review priority — the legacy fresh preferences are `deepseek-v4-flash` / `deepseek-v4-pro`, with Harness Default as fallback.
333
+
334
+ - **Follow DSH Provider** — resolve the role's provider/model priority from the Harness catalog (fresh default).
335
+ - **DeepSeek Official** — use the legacy built-in fixed route for compatibility.
336
+
337
+ Credentials stay in the DSH provider configuration only. Tested with an OpenAI-compatible OpenCode Go gateway. Standalone mode (no DSH running) always uses DeepSeek Official + `DEEPSEEK_API_KEY`.
338
+
339
+ ## Hosts
340
+
341
+ - **Codex Desktop** is directly supported through the shared `~/.codex` configuration. The Codex CLI is **not required**; it is an optional extra host / management interface.
342
+ - **Claude Code** is optional; the one-click setup installs its integration automatically when the Claude CLI is detected.
343
+
344
+ ## Notes
345
+
346
+ - Main Agent Mode is routing guidance, not a hard sandbox for the host's tools.
347
+ - Standalone uses DeepSeek Official only.
348
+ - Crew Vision registration changes may require a DSH restart.
349
+ - Restart Codex Desktop after integration changes.
350
+ - Every worker returns an auditable Delivery Report (`## Diff` / `## Tests` / `## Risks`) and the isolated candidate captures a bounded, redacted patch so you can verify what changed before accepting.
351
+ - Blocking and async jobs execute the same workflow (evidence-driven escalation + automatic reviewer pass); async just returns a workflow id immediately and continues in the background.
352
+ - `dsh_worker_status` / `dsh_worker_result` / `dsh_worker_cancel` operate on workflow ids (`wf-…`); legacy `hub-…` / `job-…` ids are still accepted.
353
+ - Standalone launches the worker as `node <dsh-sdk-jsonrpc-demo/lib/bin.js>` (Windows-safe; the pnpm `.bin` sh shim is not spawnable). Standalone defaults to the DeepSeek Official provider + `DEEPSEEK_API_KEY`, but honors `DEEPSEEK_BASE_URL` so an OpenAI-compatible gateway (e.g. an `opencode-*` gateway already configured in `~/.dsh`) can back standalone workers by setting both env vars.
354
+ - The Settings UI still presents the legacy Flash/Pro compatibility controls in this transition build; the new worker/reviewer role policy and `execution.isolation` write-through is a follow-up.
355
+
356
+ ## Credits & License
357
+
358
+ This fork is based on the original DSH Crew by [ZSeven-W](https://github.com/ZSeven-W/dsh-crew) and retains the original MIT license and attribution. It adds configurable Harness-backed model priorities, worker/reviewer roles, unified job workflows, git-worktree isolation, auditable delivery, and related workflow changes.
359
+
360
+ MIT License — see [LICENSE](LICENSE).