@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
@@ -0,0 +1,306 @@
1
+ // Git worktree isolation for parallel coding jobs. Every isolated coding job
2
+ // runs in its own detached worktree at a captured base revision, so concurrent
3
+ // workers never write the same mutable working tree. The Main Agent receives
4
+ // an auditable change candidate (bounded, redacted patch + name status) and
5
+ // decides accept / reject / revise from there.
6
+ //
7
+ // Discipline: NEVER touches the primary working tree with reset / stash /
8
+ // clean / checkout — the primary tree may stay dirty. All worktree mutation
9
+ // targets the allocated worktree dir only. Windows-safe: node:path only, no
10
+ // shell string building, execFile(args array), and clear errors when a file
11
+ // lock blocks cleanup.
12
+
13
+ import { execFile } from 'node:child_process';
14
+ import { existsSync, rmSync } from 'node:fs';
15
+ import { readFile } from 'node:fs/promises';
16
+ import { tmpdir } from 'node:os';
17
+ import { join, resolve, basename } from 'node:path';
18
+ import { randomBytes, createHash } from 'node:crypto';
19
+ import { promisify } from 'node:util';
20
+ import { isSensitivePath, parseChanges, DIFF_LIMIT, GIT_TIMEOUT_MS } from './workspace-audit.mjs';
21
+
22
+ const execFileAsync = promisify(execFile);
23
+
24
+ export const NOT_GIT_REPOSITORY = 'NOT_GIT_REPOSITORY';
25
+ export const GIT_NOT_FOUND = 'GIT_NOT_FOUND';
26
+ export const GIT_TIMEOUT = 'GIT_TIMEOUT';
27
+ export const GIT_ERROR = 'GIT_ERROR';
28
+ export const WORKTREE_LOCKED = 'WORKTREE_LOCKED';
29
+ export const CANDIDATE_CAPTURE_FAILED = 'CANDIDATE_CAPTURE_FAILED';
30
+ export const MAX_PARALLEL_CAP = 16;
31
+ export const DEFAULT_MAX_PARALLEL = 3;
32
+ const WORKTREE_PREFIX = 'dsh-crew-';
33
+
34
+ async function defaultRunner(args, { cwd }) {
35
+ try {
36
+ const out = await execFileAsync('git', args, { cwd, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024, timeout: GIT_TIMEOUT_MS });
37
+ return { code: 0, stdout: out.stdout ?? '', stderr: out.stderr ?? '' };
38
+ } catch (error) {
39
+ const missing = error?.code === 'ENOENT' || /spawn git ENOENT/i.test(error?.message ?? '');
40
+ if (!missing) return { code: error?.code ?? error?.status ?? 1, stdout: '', stderr: error?.stderr ?? error?.message ?? String(error) };
41
+ return { code: -1, stdout: '', stderr: 'spawn git ENOENT' };
42
+ }
43
+ }
44
+
45
+ async function runGit(runner, args, opts) {
46
+ try {
47
+ const r = await runner(args, opts);
48
+ const stderr = r.stderr ?? '';
49
+ if (/not a git repository/i.test(stderr)) return { ok: false, reason: NOT_GIT_REPOSITORY, error: stderr.trim() };
50
+ if (r.code != null && r.code !== 0) return { ok: false, reason: r.code === -1 ? GIT_NOT_FOUND : GIT_ERROR, code: r.code, error: stderr.trim() || 'git exited non-zero' };
51
+ return { ok: true, code: r.code, stdout: r.stdout ?? '', stderr };
52
+ } catch (err) {
53
+ const msg = err?.message ?? String(err);
54
+ if (err?.code === 'ETIMEDOUT' || /timed out|timeout/i.test(msg)) return { ok: false, reason: GIT_TIMEOUT, error: msg };
55
+ if (/ENOENT|spawn git/i.test(msg)) return { ok: false, reason: GIT_NOT_FOUND, error: msg };
56
+ return { ok: false, reason: NOT_GIT_REPOSITORY, error: msg };
57
+ }
58
+ }
59
+
60
+ function worktreeName(jobId) {
61
+ const safe = String(jobId ?? '').replace(/[^A-Za-z0-9._-]/g, '-') || 'job';
62
+ return `${WORKTREE_PREFIX}${safe}-${randomBytes(4).toString('hex')}`;
63
+ }
64
+
65
+ export function defaultWorktreeRoot() {
66
+ return join(tmpdir(), 'dsh-crew-worktrees');
67
+ }
68
+
69
+ /**
70
+ * Resolve repository root + HEAD. Dirty detection is advisory: inability to
71
+ * read `git status` must not turn an otherwise valid repository into a hard
72
+ * isolation failure. `dirty=null` means unknown.
73
+ */
74
+ export async function inspectRepository({ cwd, git, runner } = {}) {
75
+ const run = git ?? runner ?? defaultRunner;
76
+ if (!cwd) return { ok: false, reason: NOT_GIT_REPOSITORY, error: 'cwd required' };
77
+ const [root, head, status] = await Promise.all([
78
+ runGit(run, ['rev-parse', '--show-toplevel'], { cwd }),
79
+ runGit(run, ['rev-parse', 'HEAD'], { cwd }),
80
+ runGit(run, ['status', '--porcelain', '-uall'], { cwd }),
81
+ ]);
82
+ if (!root.ok) return { ok: false, reason: root.reason, error: root.error };
83
+ if (!head.ok) return { ok: false, reason: head.reason, error: head.error };
84
+ return {
85
+ ok: true,
86
+ repoRoot: resolve(root.stdout.trim()),
87
+ baseRevision: head.stdout.trim(),
88
+ headRevision: head.stdout.trim(),
89
+ dirty: status.ok ? status.stdout.trim() !== '' : null,
90
+ };
91
+ }
92
+
93
+ export async function createIsolatedWorkspace({ cwd, jobId, baseRevision, root = defaultWorktreeRoot(), git } = {}) {
94
+ const run = git ?? defaultRunner;
95
+ const repo = await inspectRepository({ cwd, git: run });
96
+ if (!repo.ok) return { ok: false, reason: repo.reason, error: repo.error };
97
+ const rev = baseRevision ?? repo.baseRevision;
98
+ const dir = join(root, worktreeName(jobId ?? repo.baseRevision));
99
+ const res = await runGit(run, ['worktree', 'add', '--detach', dir, rev], { cwd: repo.repoRoot });
100
+ if (!res.ok) return { ok: false, reason: res.reason, error: res.error };
101
+ return { ok: true, worktreePath: dir, baseRevision: rev, repoRoot: repo.repoRoot, name: basename(dir) };
102
+ }
103
+
104
+ function splitFirstTab(line) {
105
+ const i = line.indexOf('\t');
106
+ return i === -1 ? [line, ''] : [line.slice(0, i), line.slice(i + 1)];
107
+ }
108
+
109
+ async function buildCandidatePatch(run, { cwd, base, nameStatus, untracked, limit }) {
110
+ const tracked = [];
111
+ const sensitive = new Set();
112
+ for (const line of String(nameStatus ?? '').split('\n')) {
113
+ const trimmed = line.trim();
114
+ if (!trimmed) continue;
115
+ const [, rest] = splitFirstTab(trimmed);
116
+ const involved = rest.split('\t').filter(Boolean).map((p) => p.replace(/\\/g, '/'));
117
+ if (involved.length === 0) continue;
118
+ if (involved.some(isSensitivePath)) {
119
+ for (const p of involved) sensitive.add(p);
120
+ } else {
121
+ for (const p of involved) if (!tracked.includes(p)) tracked.push(p);
122
+ }
123
+ }
124
+
125
+ let out = '';
126
+ const redacted = [];
127
+ const incompleteReasons = [];
128
+ if (tracked.length > 0) {
129
+ const r = await runGit(run, ['diff', '--binary', base, '--', ...tracked], { cwd });
130
+ if (!r.ok) return { failed: true, reason: r.reason, error: r.error };
131
+ out += r.stdout;
132
+ }
133
+ for (const p of sensitive) {
134
+ redacted.push(p);
135
+ out += `[REDACTED SENSITIVE FILE: ${p}]\n`;
136
+ }
137
+ if (redacted.length > 0) incompleteReasons.push('sensitive_content_redacted');
138
+
139
+ for (const p of untracked) {
140
+ if (isSensitivePath(p)) {
141
+ redacted.push(p);
142
+ out += `[REDACTED SENSITIVE FILE: ${p} (untracked)]\n`;
143
+ if (!incompleteReasons.includes('sensitive_content_redacted')) incompleteReasons.push('sensitive_content_redacted');
144
+ continue;
145
+ }
146
+ const abs = join(cwd, ...p.split('/'));
147
+ if (!existsSync(abs)) {
148
+ out += `[UNTRACKED FILE: ${p}]\n`;
149
+ incompleteReasons.push(`untracked_missing:${p}`);
150
+ continue;
151
+ }
152
+ const next = await safeNewFilePatch(p, abs);
153
+ out += next.patch;
154
+ if (!next.complete) incompleteReasons.push(next.reason ?? `untracked_unreplayable:${p}`);
155
+ }
156
+
157
+ const truncated = Buffer.byteLength(out, 'utf8') > limit;
158
+ if (truncated) {
159
+ out = Buffer.from(out, 'utf8').subarray(0, limit).toString('utf8');
160
+ incompleteReasons.push('patch_truncated');
161
+ }
162
+ const complete = incompleteReasons.length === 0;
163
+ return { failed: false, patch: out, truncated, redacted, complete, incompleteReasons };
164
+ }
165
+
166
+ async function safeNewFilePatch(relPath, absPath) {
167
+ try {
168
+ const buf = await readFile(absPath);
169
+ if (buf.includes(0)) return { patch: `[NEW BINARY FILE: ${relPath} (${buf.length} bytes)]\n`, complete: false, reason: `binary_untracked:${relPath}` };
170
+ const lines = buf.toString('utf8').split(/\r?\n/);
171
+ if (lines.length > 0 && lines[lines.length - 1] === '') lines.pop();
172
+ if (lines.length === 0) return { patch: `[NEW EMPTY FILE: ${relPath}]\n`, complete: true };
173
+ const body = lines.map((l) => `+${l}`).join('\n');
174
+ return {
175
+ patch: `diff --git a/${relPath} b/${relPath}\nnew file mode 100644\n--- /dev/null\n+++ b/${relPath}\n@@ -0,0 +1,${lines.length} @@\n${body}\n`,
176
+ complete: true,
177
+ };
178
+ } catch {
179
+ return { patch: `[UNTRACKED FILE: ${relPath}]\n`, complete: false, reason: `untracked_read_failed:${relPath}` };
180
+ }
181
+ }
182
+
183
+ function candidateFingerprint({ base, nameStatus, patch }) {
184
+ return createHash('sha256').update(`${base}\n${nameStatus ?? ''}\n${patch ?? ''}`).digest('hex');
185
+ }
186
+
187
+ export async function captureCandidate({ worktreePath, baseRevision, git, limit = DIFF_LIMIT } = {}) {
188
+ const run = git ?? defaultRunner;
189
+ if (!worktreePath || !existsSync(worktreePath)) return { ok: false, reason: NOT_GIT_REPOSITORY, error: 'worktree path missing' };
190
+ const baseCheck = baseRevision ? await runGit(run, ['rev-parse', '--verify', `${baseRevision}^{commit}`], { cwd: worktreePath }) : { ok: true };
191
+ if (baseRevision && !baseCheck.ok) return { ok: false, reason: CANDIDATE_CAPTURE_FAILED, error: `invalid base revision ${baseRevision}: ${(baseCheck.error ?? '').trim()}` };
192
+ const base = baseRevision ?? (await runGit(run, ['rev-parse', 'HEAD'], { cwd: worktreePath })).stdout.trim();
193
+
194
+ const [nameStatus, statRel, status, head] = await Promise.all([
195
+ runGit(run, ['diff', '--name-status', base], { cwd: worktreePath }),
196
+ runGit(run, ['diff', '--stat', base], { cwd: worktreePath }),
197
+ runGit(run, ['status', '--porcelain', '-uall'], { cwd: worktreePath }),
198
+ runGit(run, ['rev-parse', 'HEAD'], { cwd: worktreePath }),
199
+ ]);
200
+ for (const r of [nameStatus, statRel, status]) if (!r.ok) return { ok: false, reason: r.reason, error: r.error };
201
+
202
+ const changes = parseChanges(nameStatus.stdout, status.stdout);
203
+ const untracked = changes.untracked;
204
+ const built = await buildCandidatePatch(run, { cwd: worktreePath, base, nameStatus: nameStatus.stdout, untracked, limit });
205
+ if (built.failed) return { ok: false, reason: built.reason ?? CANDIDATE_CAPTURE_FAILED, error: built.error };
206
+
207
+ const nameStatusOut = nameStatus.stdout;
208
+ return {
209
+ ok: true,
210
+ kind: 'git-worktree',
211
+ base_revision: base,
212
+ committed_head: head.ok ? head.stdout.trim() : null,
213
+ worktree_path: worktreePath,
214
+ changed_files: [...new Set([...trackedIn(nameStatusOut, untracked), ...built.redacted, ...untracked])],
215
+ name_status: nameStatusOut,
216
+ diff_stat: statRel.stdout,
217
+ patch: built.patch,
218
+ patch_truncated: built.truncated,
219
+ sensitive_paths_redacted: built.redacted,
220
+ untracked_files: untracked,
221
+ complete: built.complete,
222
+ replayable: built.complete,
223
+ incomplete_reasons: built.incompleteReasons,
224
+ fingerprint: candidateFingerprint({ base, nameStatus: nameStatusOut, patch: built.patch }),
225
+ candidate_commit: null,
226
+ };
227
+ }
228
+
229
+ function trackedIn(nameStatus, untracked) {
230
+ const out = [];
231
+ for (const line of String(nameStatus ?? '').split('\n')) {
232
+ const trimmed = line.trim();
233
+ if (!trimmed) continue;
234
+ const [, rest] = splitFirstTab(trimmed);
235
+ const involved = rest.split('\t').filter(Boolean).map((p) => p.replace(/\\/g, '/'));
236
+ for (const p of involved) if (!out.includes(p) && !untracked.includes(p)) out.push(p);
237
+ }
238
+ return out;
239
+ }
240
+
241
+ async function mainRepoRoot(run, worktreePath) {
242
+ const common = await runGit(run, ['rev-parse', '--git-common-dir'], { cwd: worktreePath });
243
+ if (!common.ok) return null;
244
+ const dir = String(common.stdout ?? '').trim();
245
+ if (!dir) return null;
246
+ return resolve(dir, '..');
247
+ }
248
+
249
+ export async function cleanupIsolatedWorkspace({ worktreePath, repoRoot, git } = {}) {
250
+ const run = git ?? defaultRunner;
251
+ if (!worktreePath) return { ok: false, reason: NOT_GIT_REPOSITORY, error: 'worktree path required' };
252
+ const root = repoRoot ?? (await mainRepoRoot(run, worktreePath));
253
+ if (root) {
254
+ const res = await runGit(run, ['worktree', 'remove', '--force', worktreePath], { cwd: root });
255
+ if (res.ok) return { ok: true, removed: true, actions: [`removed worktree ${worktreePath}`] };
256
+ if (/modified or untracked files|Unable to delete|permission denied|locked|not allow/i.test(res.error)) return { ok: false, reason: WORKTREE_LOCKED, error: res.error, cleanupBlocked: true };
257
+ if (/not a git repository|not (?:in )?a worktree/i.test(res.error)) return { ok: false, reason: NOT_GIT_REPOSITORY, error: res.error };
258
+ }
259
+ try { rmSync(worktreePath, { recursive: true, force: true }); return { ok: true, removed: true, actions: [`rm -rf ${worktreePath}`] }; }
260
+ catch (err) { return { ok: false, reason: WORKTREE_LOCKED, error: String(err?.message ?? err), cleanupBlocked: true }; }
261
+ }
262
+
263
+ export async function staleWorktrees({ git, allowed = [] } = {}) {
264
+ const run = git ?? defaultRunner;
265
+ const set = new Set(allowed.map((p) => resolve(p)));
266
+ const stale = [];
267
+ try {
268
+ const root = await inspectRepository({ cwd: allowed[0] ?? process.cwd(), git: run });
269
+ if (root.ok) {
270
+ const res = await runGit(run, ['worktree', 'list', '--porcelain'], { cwd: root.repoRoot });
271
+ if (res.ok) {
272
+ for (const block of String(res.stdout).split('\n\n')) {
273
+ const path = block.split('\n').find((l) => l.startsWith('worktree '))?.slice('worktree '.length)?.trim();
274
+ if (!path) continue;
275
+ const abs = resolve(path);
276
+ if (basename(abs).startsWith(WORKTREE_PREFIX) && !set.has(abs)) stale.push(abs);
277
+ }
278
+ }
279
+ }
280
+ } catch {}
281
+ return stale;
282
+ }
283
+
284
+ export async function pruneWorktrees({ git, allowed = [] } = {}) {
285
+ const run = git ?? defaultRunner;
286
+ const stale = await staleWorktrees({ git: run, allowed });
287
+ const actions = [];
288
+ for (const w of stale) {
289
+ const r = await cleanupIsolatedWorkspace({ worktreePath: w, git: run });
290
+ actions.push(...(r.actions ?? [r.error ?? `stale worktree ${w}`]));
291
+ }
292
+ return { ok: true, removed: stale.length, actions };
293
+ }
294
+
295
+ export function clampMaxParallel(raw) {
296
+ const n = Number.isInteger(raw) ? raw : DEFAULT_MAX_PARALLEL;
297
+ if (n < 1) return 1;
298
+ if (n > MAX_PARALLEL_CAP) return MAX_PARALLEL_CAP;
299
+ return n;
300
+ }
301
+
302
+ export function concurrencyGate({ maxParallel = DEFAULT_MAX_PARALLEL, active = 0 } = {}) {
303
+ const cap = clampMaxParallel(maxParallel);
304
+ const ok = active < cap;
305
+ return { ok, active, maxParallel: cap, blocked: !ok };
306
+ }
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+ # dsh-crew statusline: prepends the live worker-pool segment (merged from
3
+ # all status shards) to a basic statusline. For claude-hud users prefer
4
+ # wiring worker-segment.sh via --extra-cmd instead (cli.mjs hud does this).
5
+
6
+ input=$(cat)
7
+ model=$(echo "$input" | jq -r '.model.display_name // .model.id // "?"')
8
+ dir=$(basename "$(echo "$input" | jq -r '.workspace.current_dir // "."')")
9
+
10
+ segment=$("$(dirname "$0")/worker-segment.sh")
11
+
12
+ line="[$model] $dir"
13
+ [ -n "$segment" ] && line="$segment | $line"
14
+ echo "$line"
@@ -0,0 +1,35 @@
1
+ #!/bin/bash
2
+ # Compact DSH worker segment for claude-hud --extra-cmd (or any statusline).
3
+ # Merges all fresh status shards (~/.config/dsh-crew/status.d/*.json plus
4
+ # the legacy status.json during transition) so workers dispatched by ANY
5
+ # orchestrator on this machine are visible. Running jobs show tier, elapsed,
6
+ # and tokens; idle with history shows "⚙dsh ✓N"; no jobs prints nothing.
7
+ # Override the shard dir with $DSH_CREW_STATUS_DIR (mainly for tests).
8
+
9
+ dir="${DSH_CREW_STATUS_DIR:-$HOME/.config/dsh-crew}"
10
+ files=()
11
+ for f in "$dir"/status.d/*.json "$dir"/status.json; do
12
+ [ -f "$f" ] && files+=("$f")
13
+ done
14
+ [ ${#files[@]} -eq 0 ] && exit 0
15
+
16
+ jq -rs --argjson now "$(date +%s)" '
17
+ def ktok: if . >= 1000 then ((. / 100 | floor) / 10 | tostring) + "k" else tostring end;
18
+ def ts: sub("\\.[0-9]+Z$"; "Z") | fromdateiso8601;
19
+ def elapsed: ($now - (.startedAt | ts)) as $s
20
+ | if $s >= 60 then (($s / 60) | floor | tostring) + "m" + (($s % 60) | tostring) + "s"
21
+ else ($s | tostring) + "s" end;
22
+ [.[] | select((.updatedAt | ts) > ($now - 1800)) | .jobs[]] as $all
23
+ | ($all | unique_by(.id)) as $jobs
24
+ | [$jobs[] | select(.status == "running")] as $r
25
+ | ([$jobs[] | select(.status == "done")] | length) as $d
26
+ | ([$jobs[] | select(.status == "failed" or .status == "cancelled")] | length) as $f
27
+ | if (($r | length) + $d + $f) == 0 then "" else
28
+ "⚙dsh"
29
+ + (if ($r | length) > 0 then
30
+ " " + (($r | length) | tostring) + "▶"
31
+ + ($r | map(.tier + " " + elapsed + " " + (.tokens.input | ktok) + "/" + (.tokens.output | ktok)) | join(" · "))
32
+ else "" end)
33
+ + (if $d > 0 then " ✓" + ($d | tostring) else "" end)
34
+ + (if $f > 0 then " ✗" + ($f | tostring) else "" end)
35
+ end' "${files[@]}" 2>/dev/null
@@ -0,0 +1,77 @@
1
+ # dsh-crew: unattended coding-worker composition for dsh-jsonrpc-agent.
2
+ # stdout is reserved for JSON-RPC frames; never add a console logger here.
3
+ # Model/provider arrive per process via the SDK initialize handshake.
4
+
5
+ - id: sdk-jsonrpc-server
6
+ name: '@deepseek-ai/dsh-sdk-jsonrpc-server'
7
+ config:
8
+ maxTokensAsSuccess: true
9
+
10
+ - id: llm-deepseek
11
+ name: '@deepseek-ai/dsh-llm-deepseek'
12
+ config:
13
+ apiKeyEnv: DEEPSEEK_API_KEY
14
+ thinking: enabled
15
+ reasoningEffort: !!js process.env.DSH_REASONING_EFFORT ?? 'high'
16
+
17
+ - id: sandbox
18
+ name: '@deepseek-ai/dsh-sandbox-local'
19
+
20
+ - id: sandbox-policy
21
+ name: '@deepseek-ai/dsh-sandbox-policy'
22
+ config:
23
+ mode: !!js process.env.DSH_SANDBOX_MODE ?? 'workspace-write'
24
+ workspaceRoot: !!js process.env.DSH_CWD ?? process.cwd()
25
+
26
+ - id: subprocess
27
+ name: '@deepseek-ai/dsh-subprocess-local'
28
+
29
+ - id: bash
30
+ name: '@deepseek-ai/dsh-bash-local'
31
+ config:
32
+ cwd: !!js process.env.DSH_CWD ?? process.cwd()
33
+ timeoutMs: 300000
34
+
35
+ - id: agent-spine
36
+ name: '@deepseek-ai/dsh-agent-spine-demo'
37
+ config:
38
+ persona: !!js process.env.DSH_SYSTEM_PROMPT ?? 'You are a focused coding worker. Complete the assigned task, then summarize what you did in your final message.'
39
+ workspaceContext: false
40
+ skills:
41
+ enabled: false
42
+ toolBash:
43
+ enableRunInBackground: false
44
+ toolJobs: false
45
+
46
+ - id: fs-local
47
+ name: '@deepseek-ai/dsh-fs-local'
48
+ config:
49
+ cwd: !!js process.env.DSH_CWD ?? process.cwd()
50
+
51
+ - id: fs-observation-policy
52
+ name: '@deepseek-ai/dsh-fs-observation-policy'
53
+
54
+ - id: tool-fs
55
+ name: '@deepseek-ai/dsh-tool-fs'
56
+
57
+ - id: tool-todo
58
+ name: '@deepseek-ai/dsh-tool-todo'
59
+ config:
60
+ allowParallelInProgress: true
61
+
62
+ - id: sessions
63
+ name: '@deepseek-ai/dsh-session-persistence-jsonl'
64
+ config:
65
+ root: !!js process.env.DSH_SESSION_ROOT ?? './.sessions'
66
+ compression: zstd
67
+
68
+ - id: token-meter
69
+ name: '@deepseek-ai/dsh-token-meter'
70
+
71
+ - id: compaction-basic
72
+ name: '@deepseek-ai/dsh-compaction-basic'
73
+ config:
74
+ thresholdRatio: 0.8
75
+ retainRatio: 0.16
76
+ maxTokens: 8192
77
+ compactionRetries: 1