@ran-sh/dsh-crew 0.3.5 → 0.3.7

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 (78) hide show
  1. package/.claude-plugin/plugin.json +8 -8
  2. package/.mcp.json +8 -8
  3. package/LICENSE +21 -21
  4. package/README.de.md +359 -359
  5. package/README.es.md +359 -359
  6. package/README.fr.md +359 -359
  7. package/README.hi.md +359 -359
  8. package/README.id.md +359 -359
  9. package/README.ja.md +359 -359
  10. package/README.ko.md +359 -359
  11. package/README.md +125 -180
  12. package/README.pt.md +359 -359
  13. package/README.ru.md +359 -359
  14. package/README.th.md +359 -359
  15. package/README.tr.md +359 -359
  16. package/README.vi.md +359 -359
  17. package/README.zh-TW.md +359 -359
  18. package/README.zh.md +125 -180
  19. package/agents/ds-flash.md +26 -26
  20. package/agents/ds-pro.md +32 -32
  21. package/agents/ds-reviewer.md +23 -23
  22. package/agents/ds-worker.md +22 -22
  23. package/codex/agents/ds-flash.toml +30 -30
  24. package/codex/agents/ds-pro.toml +31 -31
  25. package/codex/agents/ds-reviewer.toml +28 -28
  26. package/codex/agents/ds-worker.toml +28 -28
  27. package/codex/prompts/dsh-config.md +3 -3
  28. package/codex/prompts/dsh-status.md +1 -1
  29. package/commands/config.md +11 -11
  30. package/commands/off.md +5 -5
  31. package/commands/on.md +5 -5
  32. package/commands/status.md +5 -5
  33. package/cordis.patch.yml +4 -4
  34. package/lib/client.js +3446 -2765
  35. package/package.json +131 -131
  36. package/scripts/build-client.mjs +28 -28
  37. package/scripts/live-crew-smoke.mjs +39 -39
  38. package/scripts/live-policy-matrix.mjs +177 -177
  39. package/scripts/policy-probe.mjs +101 -101
  40. package/scripts/setup.mjs +284 -284
  41. package/scripts/smoke-real.mjs +110 -110
  42. package/scripts/smoke.mjs +78 -78
  43. package/scripts/verify-installer-fix.mjs +26 -26
  44. package/src/adaptive-routing.mjs +260 -260
  45. package/src/client/activation-summary.tsx +64 -64
  46. package/src/client/collapsible-sections.mjs +55 -0
  47. package/src/client/entry.tsx +236 -236
  48. package/src/client/index.tsx +1213 -1120
  49. package/src/config-readiness.mjs +59 -59
  50. package/src/delivery.mjs +205 -205
  51. package/src/dsh-cli-runtime.mjs +239 -239
  52. package/src/failure-classification.mjs +172 -172
  53. package/src/hub/entry.mjs +98 -98
  54. package/src/hub-client.mjs +132 -132
  55. package/src/hub-compatibility.mjs +49 -49
  56. package/src/i18n.mjs +19 -19
  57. package/src/install/cli.mjs +28 -28
  58. package/src/install/install-legacy.mjs +462 -462
  59. package/src/install/install.mjs +451 -451
  60. package/src/install/npx-lifecycle.mjs +1055 -1019
  61. package/src/mcp-runtime.mjs +257 -257
  62. package/src/model-catalog.mjs +173 -173
  63. package/src/model-routing.mjs +391 -391
  64. package/src/policy.mjs +197 -197
  65. package/src/readiness-matrix.mjs +169 -169
  66. package/src/runtime-controls.mjs +90 -90
  67. package/src/runtime-identity.mjs +108 -108
  68. package/src/server.mjs +477 -477
  69. package/src/status-shard.mjs +52 -52
  70. package/src/structured-error-code.mjs +38 -38
  71. package/src/vision-route.mjs +138 -138
  72. package/src/workflow-runtime.mjs +573 -573
  73. package/src/workflow.mjs +160 -160
  74. package/src/workspace-audit.mjs +231 -231
  75. package/src/workspace-isolation.mjs +365 -365
  76. package/statusline/statusline.sh +14 -14
  77. package/statusline/worker-segment.sh +35 -35
  78. package/worker.cordis.yml +77 -77
package/package.json CHANGED
@@ -1,131 +1,131 @@
1
- {
2
- "name": "@ran-sh/dsh-crew",
3
- "version": "0.3.5",
4
- "type": "module",
5
- "main": "./src/hub/entry.mjs",
6
- "bin": {
7
- "dsh-crew": "./bin/dsh-crew.mjs"
8
- },
9
- "description": "DeepSeek Harness plugin: dispatch work to DSH agents from Claude Code / Codex, as native subagents with live progress",
10
- "dsh": {
11
- "bundle": {
12
- "patch": "./cordis.patch.yml"
13
- },
14
- "client": {
15
- "inject": [
16
- "@deepseek-ai/dsh-client-runtime",
17
- "@deepseek-ai/dsh-client-locale",
18
- "@deepseek-ai/dsh-client-ui-slots",
19
- "@deepseek-ai/dsh-client-ui-settings"
20
- ],
21
- "platform": "web"
22
- }
23
- },
24
- "scripts": {
25
- "mcp": "node src/server.mjs",
26
- "build:client": "tsdown src/client/entry.tsx --format cjs --platform browser --target es2022 --tsconfig tsconfig.client.json --deps.never-bundle react --deps.never-bundle react/jsx-runtime --deps.never-bundle react-dom --deps.never-bundle react-dom/client --out-dir .client-build --clean --logLevel warn && node scripts/build-client.mjs",
27
- "verify:npm-install": "node scripts/verify-npm-install.mjs",
28
- "verify:npm-install:official": "node scripts/verify-npm-install.mjs --with-official-dsh"
29
- },
30
- "dependencies": {
31
- "@modelcontextprotocol/sdk": "^1.17.5",
32
- "zod": "^3.24.0"
33
- },
34
- "exports": {
35
- ".": "./src/hub/entry.mjs",
36
- "./client": "./lib/client.js",
37
- "./package.json": "./package.json"
38
- },
39
- "peerDependencies": {
40
- "react": "^18.0.0",
41
- "react-dom": "^18.0.0",
42
- "@deepseek-ai/dsh-agent": "0.1.1-rc.2",
43
- "@deepseek-ai/dsh-agent-presets": "0.1.1-rc.2",
44
- "@deepseek-ai/dsh-agent-spine-demo": "0.1.1-rc.2",
45
- "@deepseek-ai/dsh-bash-local": "0.1.1-rc.2",
46
- "@deepseek-ai/dsh-compaction-basic": "0.1.1-rc.2",
47
- "@deepseek-ai/dsh-fs-local": "0.1.1-rc.2",
48
- "@deepseek-ai/dsh-fs-observation-policy": "0.1.1-rc.2",
49
- "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
50
- "@deepseek-ai/dsh-llm-deepseek": "0.1.1-rc.2",
51
- "@deepseek-ai/dsh-sandbox-local": "0.1.1-rc.2",
52
- "@deepseek-ai/dsh-sandbox-policy": "0.1.1-rc.2",
53
- "@deepseek-ai/dsh-sdk-client": "0.1.1-rc.2",
54
- "@deepseek-ai/dsh-sdk-jsonrpc-demo": "0.1.1-rc.2",
55
- "@deepseek-ai/dsh-sdk-jsonrpc-server": "0.1.1-rc.2",
56
- "@deepseek-ai/dsh-session": "0.1.1-rc.2",
57
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.1.1-rc.2",
58
- "@deepseek-ai/dsh-subprocess-local": "0.1.1-rc.2",
59
- "@deepseek-ai/dsh-token-meter": "0.1.1-rc.2",
60
- "@deepseek-ai/dsh-tool-fs": "0.1.1-rc.2",
61
- "@deepseek-ai/dsh-tool-todo": "0.1.1-rc.2"
62
- },
63
- "devDependencies": {
64
- "react": "^18.3.1",
65
- "react-dom": "^18.3.1",
66
- "tsdown": "^0.12.0",
67
- "typescript": "^5.6.0",
68
- "@types/react": "^18.3.0",
69
- "@deepseek-ai/dsh-agent": "0.1.1-rc.2",
70
- "@deepseek-ai/dsh-agent-presets": "0.1.1-rc.2",
71
- "@deepseek-ai/dsh-agent-spine-demo": "0.1.1-rc.2",
72
- "@deepseek-ai/dsh-bash-local": "0.1.1-rc.2",
73
- "@deepseek-ai/dsh-compaction-basic": "0.1.1-rc.2",
74
- "@deepseek-ai/dsh-fs-local": "0.1.1-rc.2",
75
- "@deepseek-ai/dsh-fs-observation-policy": "0.1.1-rc.2",
76
- "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
77
- "@deepseek-ai/dsh-llm-deepseek": "0.1.1-rc.2",
78
- "@deepseek-ai/dsh-sandbox-local": "0.1.1-rc.2",
79
- "@deepseek-ai/dsh-sandbox-policy": "0.1.1-rc.2",
80
- "@deepseek-ai/dsh-sdk-client": "0.1.1-rc.2",
81
- "@deepseek-ai/dsh-sdk-jsonrpc-demo": "0.1.1-rc.2",
82
- "@deepseek-ai/dsh-sdk-jsonrpc-server": "0.1.1-rc.2",
83
- "@deepseek-ai/dsh-session": "0.1.1-rc.2",
84
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.1.1-rc.2",
85
- "@deepseek-ai/dsh-subprocess-local": "0.1.1-rc.2",
86
- "@deepseek-ai/dsh-token-meter": "0.1.1-rc.2",
87
- "@deepseek-ai/dsh-tool-fs": "0.1.1-rc.2",
88
- "@deepseek-ai/dsh-tool-todo": "0.1.1-rc.2"
89
- },
90
- "license": "MIT",
91
- "repository": {
92
- "type": "git",
93
- "url": "git+https://github.com/Ran-sh/dsh-crew.git"
94
- },
95
- "homepage": "https://github.com/Ran-sh/dsh-crew",
96
- "bugs": {
97
- "url": "https://github.com/Ran-sh/dsh-crew/issues"
98
- },
99
- "keywords": [
100
- "dsh",
101
- "deepseek",
102
- "claude-code",
103
- "codex",
104
- "subagent",
105
- "worker",
106
- "multimodal",
107
- "plugin",
108
- "agent"
109
- ],
110
- "files": [
111
- "bin",
112
- "lib",
113
- "src",
114
- "scripts",
115
- "agents",
116
- "commands",
117
- "codex",
118
- "statusline",
119
- "cordis.patch.yml",
120
- "worker.cordis.yml",
121
- ".claude-plugin",
122
- ".mcp.json",
123
- "README.md",
124
- "README.*.md",
125
- "docs/images/dsh-crew-logo.png",
126
- "docs/images/dsh-crew-overview.png",
127
- "docs/images/dsh-crew-host.png",
128
- "docs/images/dsh-crew-jobs.png",
129
- "LICENSE"
130
- ]
131
- }
1
+ {
2
+ "name": "@ran-sh/dsh-crew",
3
+ "version": "0.3.7",
4
+ "type": "module",
5
+ "main": "./src/hub/entry.mjs",
6
+ "bin": {
7
+ "dsh-crew": "bin/dsh-crew.mjs"
8
+ },
9
+ "description": "DeepSeek Harness plugin: dispatch work to DSH agents from Claude Code / Codex, as native subagents with live progress",
10
+ "dsh": {
11
+ "bundle": {
12
+ "patch": "./cordis.patch.yml"
13
+ },
14
+ "client": {
15
+ "inject": [
16
+ "@deepseek-ai/dsh-client-runtime",
17
+ "@deepseek-ai/dsh-client-locale",
18
+ "@deepseek-ai/dsh-client-ui-slots",
19
+ "@deepseek-ai/dsh-client-ui-settings"
20
+ ],
21
+ "platform": "web"
22
+ }
23
+ },
24
+ "scripts": {
25
+ "mcp": "node src/server.mjs",
26
+ "build:client": "tsdown src/client/entry.tsx --format cjs --platform browser --target es2022 --tsconfig tsconfig.client.json --deps.never-bundle react --deps.never-bundle react/jsx-runtime --deps.never-bundle react-dom --deps.never-bundle react-dom/client --out-dir .client-build --clean --logLevel warn && node scripts/build-client.mjs",
27
+ "verify:npm-install": "node scripts/verify-npm-install.mjs",
28
+ "verify:npm-install:official": "node scripts/verify-npm-install.mjs --with-official-dsh"
29
+ },
30
+ "dependencies": {
31
+ "@modelcontextprotocol/sdk": "^1.17.5",
32
+ "zod": "^3.24.0"
33
+ },
34
+ "exports": {
35
+ ".": "./src/hub/entry.mjs",
36
+ "./client": "./lib/client.js",
37
+ "./package.json": "./package.json"
38
+ },
39
+ "peerDependencies": {
40
+ "react": "^18.0.0",
41
+ "react-dom": "^18.0.0",
42
+ "@deepseek-ai/dsh-agent": "0.1.1-rc.2",
43
+ "@deepseek-ai/dsh-agent-presets": "0.1.1-rc.2",
44
+ "@deepseek-ai/dsh-agent-spine-demo": "0.1.1-rc.2",
45
+ "@deepseek-ai/dsh-bash-local": "0.1.1-rc.2",
46
+ "@deepseek-ai/dsh-compaction-basic": "0.1.1-rc.2",
47
+ "@deepseek-ai/dsh-fs-local": "0.1.1-rc.2",
48
+ "@deepseek-ai/dsh-fs-observation-policy": "0.1.1-rc.2",
49
+ "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
50
+ "@deepseek-ai/dsh-llm-deepseek": "0.1.1-rc.2",
51
+ "@deepseek-ai/dsh-sandbox-local": "0.1.1-rc.2",
52
+ "@deepseek-ai/dsh-sandbox-policy": "0.1.1-rc.2",
53
+ "@deepseek-ai/dsh-sdk-client": "0.1.1-rc.2",
54
+ "@deepseek-ai/dsh-sdk-jsonrpc-demo": "0.1.1-rc.2",
55
+ "@deepseek-ai/dsh-sdk-jsonrpc-server": "0.1.1-rc.2",
56
+ "@deepseek-ai/dsh-session": "0.1.1-rc.2",
57
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.1.1-rc.2",
58
+ "@deepseek-ai/dsh-subprocess-local": "0.1.1-rc.2",
59
+ "@deepseek-ai/dsh-token-meter": "0.1.1-rc.2",
60
+ "@deepseek-ai/dsh-tool-fs": "0.1.1-rc.2",
61
+ "@deepseek-ai/dsh-tool-todo": "0.1.1-rc.2"
62
+ },
63
+ "devDependencies": {
64
+ "react": "^18.3.1",
65
+ "react-dom": "^18.3.1",
66
+ "tsdown": "^0.12.0",
67
+ "typescript": "^5.6.0",
68
+ "@types/react": "^18.3.0",
69
+ "@deepseek-ai/dsh-agent": "0.1.1-rc.2",
70
+ "@deepseek-ai/dsh-agent-presets": "0.1.1-rc.2",
71
+ "@deepseek-ai/dsh-agent-spine-demo": "0.1.1-rc.2",
72
+ "@deepseek-ai/dsh-bash-local": "0.1.1-rc.2",
73
+ "@deepseek-ai/dsh-compaction-basic": "0.1.1-rc.2",
74
+ "@deepseek-ai/dsh-fs-local": "0.1.1-rc.2",
75
+ "@deepseek-ai/dsh-fs-observation-policy": "0.1.1-rc.2",
76
+ "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
77
+ "@deepseek-ai/dsh-llm-deepseek": "0.1.1-rc.2",
78
+ "@deepseek-ai/dsh-sandbox-local": "0.1.1-rc.2",
79
+ "@deepseek-ai/dsh-sandbox-policy": "0.1.1-rc.2",
80
+ "@deepseek-ai/dsh-sdk-client": "0.1.1-rc.2",
81
+ "@deepseek-ai/dsh-sdk-jsonrpc-demo": "0.1.1-rc.2",
82
+ "@deepseek-ai/dsh-sdk-jsonrpc-server": "0.1.1-rc.2",
83
+ "@deepseek-ai/dsh-session": "0.1.1-rc.2",
84
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.1.1-rc.2",
85
+ "@deepseek-ai/dsh-subprocess-local": "0.1.1-rc.2",
86
+ "@deepseek-ai/dsh-token-meter": "0.1.1-rc.2",
87
+ "@deepseek-ai/dsh-tool-fs": "0.1.1-rc.2",
88
+ "@deepseek-ai/dsh-tool-todo": "0.1.1-rc.2"
89
+ },
90
+ "license": "MIT",
91
+ "repository": {
92
+ "type": "git",
93
+ "url": "git+https://github.com/Ran-sh/dsh-crew.git"
94
+ },
95
+ "homepage": "https://github.com/Ran-sh/dsh-crew",
96
+ "bugs": {
97
+ "url": "https://github.com/Ran-sh/dsh-crew/issues"
98
+ },
99
+ "keywords": [
100
+ "dsh",
101
+ "deepseek",
102
+ "claude-code",
103
+ "codex",
104
+ "subagent",
105
+ "worker",
106
+ "multimodal",
107
+ "plugin",
108
+ "agent"
109
+ ],
110
+ "files": [
111
+ "bin",
112
+ "lib",
113
+ "src",
114
+ "scripts",
115
+ "agents",
116
+ "commands",
117
+ "codex",
118
+ "statusline",
119
+ "cordis.patch.yml",
120
+ "worker.cordis.yml",
121
+ ".claude-plugin",
122
+ ".mcp.json",
123
+ "README.md",
124
+ "README.*.md",
125
+ "docs/images/dsh-crew-logo.png",
126
+ "docs/images/dsh-crew-overview.png",
127
+ "docs/images/dsh-crew-host.png",
128
+ "docs/images/dsh-crew-jobs.png",
129
+ "LICENSE"
130
+ ]
131
+ }
@@ -1,28 +1,28 @@
1
- // Wrap the compiled client bundle into the dsh-web module-loader artifact:
2
- // `window.__ModuleLoader__.load({ id, factory })`. The id must equal the
3
- // package name (= the cordis entry name). Pattern from dsh-noema.
4
-
5
- import { readFile, writeFile, rm, mkdir, readdir } from 'node:fs/promises';
6
- import { dirname, join } from 'node:path';
7
- import { fileURLToPath } from 'node:url';
8
-
9
- const root = dirname(dirname(fileURLToPath(import.meta.url)));
10
- const manifest = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
11
- const pluginId = manifest.name;
12
- const buildDir = join(root, '.client-build');
13
- const compiledEntries = (await readdir(buildDir)).filter((name) => name.endsWith('.cjs'));
14
- if (compiledEntries.length !== 1) {
15
- throw new Error(`expected exactly one compiled client entry in .client-build, found ${compiledEntries.length}: ${compiledEntries.join(', ')}`);
16
- }
17
- const source = await readFile(join(buildDir, compiledEntries[0]), 'utf8');
18
- const wrapped = [
19
- `window.__ModuleLoader__.load({ id: ${JSON.stringify(pluginId)}, factory: (require) => {`,
20
- 'var module = { exports: {} }; var exports = module.exports;',
21
- source.replace(/\n?\/\/# sourceMappingURL=.*$/u, ''),
22
- 'return module.exports; } });',
23
- '',
24
- ].join('\n');
25
- await mkdir(join(root, 'lib'), { recursive: true });
26
- await writeFile(join(root, 'lib', 'client.js'), wrapped);
27
- await rm(buildDir, { recursive: true, force: true });
28
- console.log(`built lib/client.js (${wrapped.length} bytes) as module "${pluginId}" from ${compiledEntries[0]}`);
1
+ // Wrap the compiled client bundle into the dsh-web module-loader artifact:
2
+ // `window.__ModuleLoader__.load({ id, factory })`. The id must equal the
3
+ // package name (= the cordis entry name). Pattern from dsh-noema.
4
+
5
+ import { readFile, writeFile, rm, mkdir, readdir } from 'node:fs/promises';
6
+ import { dirname, join } from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const root = dirname(dirname(fileURLToPath(import.meta.url)));
10
+ const manifest = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
11
+ const pluginId = manifest.name;
12
+ const buildDir = join(root, '.client-build');
13
+ const compiledEntries = (await readdir(buildDir)).filter((name) => name.endsWith('.cjs'));
14
+ if (compiledEntries.length !== 1) {
15
+ throw new Error(`expected exactly one compiled client entry in .client-build, found ${compiledEntries.length}: ${compiledEntries.join(', ')}`);
16
+ }
17
+ const source = await readFile(join(buildDir, compiledEntries[0]), 'utf8');
18
+ const wrapped = [
19
+ `window.__ModuleLoader__.load({ id: ${JSON.stringify(pluginId)}, factory: (require) => {`,
20
+ 'var module = { exports: {} }; var exports = module.exports;',
21
+ source.replace(/\n?\/\/# sourceMappingURL=.*$/u, ''),
22
+ 'return module.exports; } });',
23
+ '',
24
+ ].join('\n');
25
+ await mkdir(join(root, 'lib'), { recursive: true });
26
+ await writeFile(join(root, 'lib', 'client.js'), wrapped);
27
+ await rm(buildDir, { recursive: true, force: true });
28
+ console.log(`built lib/client.js (${wrapped.length} bytes) as module "${pluginId}" from ${compiledEntries[0]}`);
@@ -1,39 +1,39 @@
1
- // Live Crew worker smoke against a Crew-owned dsh-crew Hub (Stage 4 provider
2
- // routing). Targets the dedicated Crew Hub (DSH_CREW_HUB env or default
3
- // http://127.0.0.1:3210); it never targets or mutates the official web profile.
4
- // Creates a temp fixture as cwd, spawns flash, polls, prints job metadata.
5
- import os from 'node:os';
6
- import fs from 'node:fs';
7
- import path from 'node:path';
8
- const BASE = (process.env.DSH_CREW_HUB ?? 'http://127.0.0.1:3210').replace(/\/$/, '') + '/_dsh/dsh-crew';
9
-
10
- (async () => {
11
- const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'dsh4-fixture-'));
12
- fs.writeFileSync(path.join(fixture, 'note.txt'), 'hello');
13
- const cwd = fixture.replace(/\\/g, '/');
14
- console.log('fixture:', cwd);
15
- console.log('provider route:', JSON.stringify(await (await fetch(`${BASE}/provider`)).json()));
16
-
17
- const tier = process.argv[2] ?? 'flash';
18
- const res = await fetch(`${BASE}/jobs`, {
19
- method: 'POST', headers: { 'content-type': 'application/json' },
20
- body: JSON.stringify({ task: 'Reply with exactly: CREW_OPENCODE_GO_OK', tier, effort: 'off', cwd }),
21
- });
22
- const spawned = await res.json();
23
- console.log('spawn:', JSON.stringify(spawned).slice(0, 260));
24
- if (!spawned.ok && !spawned.job) { process.exit(1); }
25
- const id = (spawned.job ?? spawned).id;
26
-
27
- // Poll for up to 120s.
28
- for (let i = 0; i < 40; i++) {
29
- await new Promise((r) => setTimeout(r, 3000));
30
- const r = await (await fetch(`${BASE}/jobs/${id}?wait=0`)).json();
31
- const j = r.job ?? r;
32
- if (!['running', 'pending'].includes(j.status)) {
33
- console.log('final:', JSON.stringify({ id: j.id, tier: j.tier, model: j.model, status: j.status, result: (j.result || '').slice(0, 120), error: (j.error || '').slice(0, 200), tokens: j.tokens }, null, 2));
34
- process.exit(j.status === 'done' ? 0 : 2);
35
- }
36
- }
37
- console.log('TIMEOUT waiting for job', id);
38
- process.exit(3);
39
- })();
1
+ // Live Crew worker smoke against a Crew-owned dsh-crew Hub (Stage 4 provider
2
+ // routing). Targets the dedicated Crew Hub (DSH_CREW_HUB env or default
3
+ // http://127.0.0.1:3210); it never targets or mutates the official web profile.
4
+ // Creates a temp fixture as cwd, spawns flash, polls, prints job metadata.
5
+ import os from 'node:os';
6
+ import fs from 'node:fs';
7
+ import path from 'node:path';
8
+ const BASE = (process.env.DSH_CREW_HUB ?? 'http://127.0.0.1:3210').replace(/\/$/, '') + '/_dsh/dsh-crew';
9
+
10
+ (async () => {
11
+ const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'dsh4-fixture-'));
12
+ fs.writeFileSync(path.join(fixture, 'note.txt'), 'hello');
13
+ const cwd = fixture.replace(/\\/g, '/');
14
+ console.log('fixture:', cwd);
15
+ console.log('provider route:', JSON.stringify(await (await fetch(`${BASE}/provider`)).json()));
16
+
17
+ const tier = process.argv[2] ?? 'flash';
18
+ const res = await fetch(`${BASE}/jobs`, {
19
+ method: 'POST', headers: { 'content-type': 'application/json' },
20
+ body: JSON.stringify({ task: 'Reply with exactly: CREW_OPENCODE_GO_OK', tier, effort: 'off', cwd }),
21
+ });
22
+ const spawned = await res.json();
23
+ console.log('spawn:', JSON.stringify(spawned).slice(0, 260));
24
+ if (!spawned.ok && !spawned.job) { process.exit(1); }
25
+ const id = (spawned.job ?? spawned).id;
26
+
27
+ // Poll for up to 120s.
28
+ for (let i = 0; i < 40; i++) {
29
+ await new Promise((r) => setTimeout(r, 3000));
30
+ const r = await (await fetch(`${BASE}/jobs/${id}?wait=0`)).json();
31
+ const j = r.job ?? r;
32
+ if (!['running', 'pending'].includes(j.status)) {
33
+ console.log('final:', JSON.stringify({ id: j.id, tier: j.tier, model: j.model, status: j.status, result: (j.result || '').slice(0, 120), error: (j.error || '').slice(0, 200), tokens: j.tokens }, null, 2));
34
+ process.exit(j.status === 'done' ? 0 : 2);
35
+ }
36
+ }
37
+ console.log('TIMEOUT waiting for job', id);
38
+ process.exit(3);
39
+ })();