@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.
- package/.claude-plugin/plugin.json +8 -8
- package/.mcp.json +8 -8
- package/LICENSE +21 -21
- package/README.de.md +359 -359
- package/README.es.md +359 -359
- package/README.fr.md +359 -359
- package/README.hi.md +359 -359
- package/README.id.md +359 -359
- package/README.ja.md +359 -359
- package/README.ko.md +359 -359
- package/README.md +125 -180
- package/README.pt.md +359 -359
- package/README.ru.md +359 -359
- package/README.th.md +359 -359
- package/README.tr.md +359 -359
- package/README.vi.md +359 -359
- package/README.zh-TW.md +359 -359
- package/README.zh.md +125 -180
- package/agents/ds-flash.md +26 -26
- package/agents/ds-pro.md +32 -32
- package/agents/ds-reviewer.md +23 -23
- package/agents/ds-worker.md +22 -22
- package/codex/agents/ds-flash.toml +30 -30
- package/codex/agents/ds-pro.toml +31 -31
- package/codex/agents/ds-reviewer.toml +28 -28
- package/codex/agents/ds-worker.toml +28 -28
- package/codex/prompts/dsh-config.md +3 -3
- package/codex/prompts/dsh-status.md +1 -1
- package/commands/config.md +11 -11
- package/commands/off.md +5 -5
- package/commands/on.md +5 -5
- package/commands/status.md +5 -5
- package/cordis.patch.yml +4 -4
- package/lib/client.js +3446 -2765
- package/package.json +131 -131
- package/scripts/build-client.mjs +28 -28
- package/scripts/live-crew-smoke.mjs +39 -39
- package/scripts/live-policy-matrix.mjs +177 -177
- package/scripts/policy-probe.mjs +101 -101
- package/scripts/setup.mjs +284 -284
- package/scripts/smoke-real.mjs +110 -110
- package/scripts/smoke.mjs +78 -78
- package/scripts/verify-installer-fix.mjs +26 -26
- package/src/adaptive-routing.mjs +260 -260
- package/src/client/activation-summary.tsx +64 -64
- package/src/client/collapsible-sections.mjs +55 -0
- package/src/client/entry.tsx +236 -236
- package/src/client/index.tsx +1213 -1120
- package/src/config-readiness.mjs +59 -59
- package/src/delivery.mjs +205 -205
- package/src/dsh-cli-runtime.mjs +239 -239
- package/src/failure-classification.mjs +172 -172
- package/src/hub/entry.mjs +98 -98
- package/src/hub-client.mjs +132 -132
- package/src/hub-compatibility.mjs +49 -49
- package/src/i18n.mjs +19 -19
- package/src/install/cli.mjs +28 -28
- package/src/install/install-legacy.mjs +462 -462
- package/src/install/install.mjs +451 -451
- package/src/install/npx-lifecycle.mjs +1055 -1019
- package/src/mcp-runtime.mjs +257 -257
- package/src/model-catalog.mjs +173 -173
- package/src/model-routing.mjs +391 -391
- package/src/policy.mjs +197 -197
- package/src/readiness-matrix.mjs +169 -169
- package/src/runtime-controls.mjs +90 -90
- package/src/runtime-identity.mjs +108 -108
- package/src/server.mjs +477 -477
- package/src/status-shard.mjs +52 -52
- package/src/structured-error-code.mjs +38 -38
- package/src/vision-route.mjs +138 -138
- package/src/workflow-runtime.mjs +573 -573
- package/src/workflow.mjs +160 -160
- package/src/workspace-audit.mjs +231 -231
- package/src/workspace-isolation.mjs +365 -365
- package/statusline/statusline.sh +14 -14
- package/statusline/worker-segment.sh +35 -35
- package/worker.cordis.yml +77 -77
package/scripts/smoke-real.mjs
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
// Real DSH smoke for the v0.3 runtime path. Spawns this branch's MCP server
|
|
2
|
-
// (src/server.mjs) over stdio and drives it with the MCP SDK.
|
|
3
|
-
// run|spawn : against a LIVE, Crew-owned DSH hub. The hub URL comes from the
|
|
4
|
-
// DSH_CREW_HUB environment variable and defaults to the dedicated
|
|
5
|
-
// Crew port 3210; the official ~/.dsh home / web profile is never
|
|
6
|
-
// read or touched.
|
|
7
|
-
// standalone: standalone worker path (jobs.mjs) using ONLY explicitly
|
|
8
|
-
// supplied process-environment credentials
|
|
9
|
-
// (DEEPSEEK_API_KEY / DEEPSEEK_BASE_URL). This script never reads
|
|
10
|
-
// ~/.dsh, any official credential/settings store, or key files.
|
|
11
|
-
// If the credential environment is absent it exits BLOCKED-style.
|
|
12
|
-
// Uses a throwaway temp git repo; never touches the web profile or user repos.
|
|
13
|
-
// Usage: node scripts/smoke-real.mjs <tempGitRepo> [run|spawn|standalone]
|
|
14
|
-
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
15
|
-
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
16
|
-
|
|
17
|
-
/** Session descriptor for the MCP child. NEVER logs the key. */
|
|
18
|
-
function serverTransport(extraEnv = {}) {
|
|
19
|
-
return new StdioClientTransport({
|
|
20
|
-
command: 'node',
|
|
21
|
-
args: ['src/server.mjs'],
|
|
22
|
-
cwd: process.cwd(),
|
|
23
|
-
env: {
|
|
24
|
-
...process.env,
|
|
25
|
-
// Crew-owned hub default; an explicit DSH_CREW_HUB overrides it.
|
|
26
|
-
DSH_CREW_HUB: process.env.DSH_CREW_HUB ?? 'http://127.0.0.1:3210',
|
|
27
|
-
...extraEnv,
|
|
28
|
-
},
|
|
29
|
-
stderr: process.stderr,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const repo = process.argv[2];
|
|
34
|
-
const mode = process.argv[3] ?? 'run';
|
|
35
|
-
const effort = process.argv[4] ?? 'max';
|
|
36
|
-
if (!repo) { console.error('usage: node scripts/smoke-real.mjs <tempGitRepo> [run|spawn|standalone] [effort]'); process.exit(2); }
|
|
37
|
-
|
|
38
|
-
const TASK = [
|
|
39
|
-
'In this git repository, create the file src/answer.mjs with exactly the content: `export const answer = 40 + 2;`',
|
|
40
|
-
'Then run the single-line check: node -e \'const a = require("./src/answer.mjs"); if (a.answer !== 42) process.exit(1); console.log("answer ok");\' (ESM note: use import("./src/answer.mjs") or write .cjs — pick whatever works and run it).',
|
|
41
|
-
'End your final message with the required Delivery Report:',
|
|
42
|
-
'## Diff',
|
|
43
|
-
'- src/answer.mjs — added answer',
|
|
44
|
-
'## Tests',
|
|
45
|
-
'PASS — node check — answer is 42',
|
|
46
|
-
'## Risks',
|
|
47
|
-
'none',
|
|
48
|
-
].join('\n');
|
|
49
|
-
|
|
50
|
-
// For standalone mode, use ONLY explicitly supplied process-environment
|
|
51
|
-
// credentials (DEEPSEEK_API_KEY / DEEPSEEK_BASE_URL). This script never reads
|
|
52
|
-
// ~/.dsh or any official credential/settings store. Absent credentials are a
|
|
53
|
-
// BLOCKED outcome, not an excuse to invent or read credentials.
|
|
54
|
-
const standaloneEnv = {};
|
|
55
|
-
if (mode === 'standalone') {
|
|
56
|
-
const apiKey = process.env.DEEPSEEK_API_KEY;
|
|
57
|
-
if (!apiKey) {
|
|
58
|
-
console.error('[smoke] BLOCKED: standalone requires DEEPSEEK_API_KEY in the process environment; credential: ABSENT (no official store will be read)');
|
|
59
|
-
process.exit(2);
|
|
60
|
-
}
|
|
61
|
-
standaloneEnv.DEEPSEEK_API_KEY = apiKey;
|
|
62
|
-
if (process.env.DEEPSEEK_BASE_URL) standaloneEnv.DEEPSEEK_BASE_URL = process.env.DEEPSEEK_BASE_URL;
|
|
63
|
-
standaloneEnv.DSH_SANDBOX_MODE = 'workspace-write';
|
|
64
|
-
console.log('[smoke] standalone: using process-environment credentials (not shown)');
|
|
65
|
-
}
|
|
66
|
-
const transport = serverTransport(standaloneEnv);
|
|
67
|
-
const client = new Client({ name: 'dsh-crew-smoke', version: '1.0.0', requestTimeout: 600 * 1000 });
|
|
68
|
-
|
|
69
|
-
async function call(name, args, timeoutMs) {
|
|
70
|
-
const res = await client.callTool({ name, arguments: args }, undefined, timeoutMs ? { timeout: timeoutMs } : undefined);
|
|
71
|
-
return JSON.parse(res.content.find((c) => c.type === 'text').text);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
await client.connect(transport);
|
|
76
|
-
console.log(`[smoke] connected; mode=${mode} cwd=${repo}`);
|
|
77
|
-
if (mode === 'standalone') {
|
|
78
|
-
// Force the standalone execution path (session mode) so jobs.mjs handles it.
|
|
79
|
-
await call('dsh_worker_config', { mode: 'standalone' });
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (mode === 'spawn') {
|
|
83
|
-
const spawnView = await call('dsh_spawn_worker', { task: TASK, role: 'worker', cwd: repo });
|
|
84
|
-
console.log('[smoke] spawn view:', JSON.stringify(spawnView, null, 2));
|
|
85
|
-
const wfId = spawnView.workflow_id ?? spawnView.id;
|
|
86
|
-
// poll a few times for the final result (workflow continues in background)
|
|
87
|
-
for (let i = 0; i < 24; i++) {
|
|
88
|
-
await new Promise((r) => setTimeout(r, 5000));
|
|
89
|
-
const v = await call('dsh_worker_result', { job_id: wfId, wait_seconds: 0 });
|
|
90
|
-
if (v.status !== 'running') {
|
|
91
|
-
console.log('[smoke] final (spawn):', JSON.stringify({ id: v.id, role: v.role, phase: v.phase, status: v.status, isolation: v.isolation, attempt: v.attempt, review: v.review?.verdict ?? null, candidate: v.candidate?.changed_files ?? null, error: v.error }, null, 2));
|
|
92
|
-
await client.close();
|
|
93
|
-
process.exit(v.status === 'done' ? 0 : 1);
|
|
94
|
-
}
|
|
95
|
-
if (i === 23) console.log('[smoke] still running after poll window: ', JSON.stringify(v));
|
|
96
|
-
}
|
|
97
|
-
await client.close();
|
|
98
|
-
process.exit(2);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const view = await call('dsh_run_worker', { task: TASK, role: 'worker', cwd: repo, effort, timeout_seconds: 540 }, 560 * 1000);
|
|
102
|
-
const k = (o) => ({ id: o.id, role: o.role, phase: o.phase, status: o.status, isolation: o.isolation, execution_cwd: o.execution_cwd, base_revision: o.base_revision, attempt: o.attempt, decision: o.decision, review: o.review?.verdict ?? null, candidate_available: o.candidate_available, candidate_changed: o.candidate?.changed_files ?? null, outcome_task: o.outcome?.task_status ?? null, tests: o.outcome?.tests_status ?? null, error: o.error, error_code: o.error_code, cleanup_warning: o.cleanup_warning, primary_dirty_hint: o.primary_workspace_dirty });
|
|
103
|
-
console.log('[smoke] final (run):', JSON.stringify(k(view), null, 2));
|
|
104
|
-
await client.close();
|
|
105
|
-
process.exit(view.status === 'done' ? 0 : 1);
|
|
106
|
-
} catch (err) {
|
|
107
|
-
console.error('[smoke] ERROR:', err?.message ?? err);
|
|
108
|
-
try { await client.close(); } catch {}
|
|
109
|
-
process.exit(3);
|
|
110
|
-
}
|
|
1
|
+
// Real DSH smoke for the v0.3 runtime path. Spawns this branch's MCP server
|
|
2
|
+
// (src/server.mjs) over stdio and drives it with the MCP SDK.
|
|
3
|
+
// run|spawn : against a LIVE, Crew-owned DSH hub. The hub URL comes from the
|
|
4
|
+
// DSH_CREW_HUB environment variable and defaults to the dedicated
|
|
5
|
+
// Crew port 3210; the official ~/.dsh home / web profile is never
|
|
6
|
+
// read or touched.
|
|
7
|
+
// standalone: standalone worker path (jobs.mjs) using ONLY explicitly
|
|
8
|
+
// supplied process-environment credentials
|
|
9
|
+
// (DEEPSEEK_API_KEY / DEEPSEEK_BASE_URL). This script never reads
|
|
10
|
+
// ~/.dsh, any official credential/settings store, or key files.
|
|
11
|
+
// If the credential environment is absent it exits BLOCKED-style.
|
|
12
|
+
// Uses a throwaway temp git repo; never touches the web profile or user repos.
|
|
13
|
+
// Usage: node scripts/smoke-real.mjs <tempGitRepo> [run|spawn|standalone]
|
|
14
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
15
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
16
|
+
|
|
17
|
+
/** Session descriptor for the MCP child. NEVER logs the key. */
|
|
18
|
+
function serverTransport(extraEnv = {}) {
|
|
19
|
+
return new StdioClientTransport({
|
|
20
|
+
command: 'node',
|
|
21
|
+
args: ['src/server.mjs'],
|
|
22
|
+
cwd: process.cwd(),
|
|
23
|
+
env: {
|
|
24
|
+
...process.env,
|
|
25
|
+
// Crew-owned hub default; an explicit DSH_CREW_HUB overrides it.
|
|
26
|
+
DSH_CREW_HUB: process.env.DSH_CREW_HUB ?? 'http://127.0.0.1:3210',
|
|
27
|
+
...extraEnv,
|
|
28
|
+
},
|
|
29
|
+
stderr: process.stderr,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const repo = process.argv[2];
|
|
34
|
+
const mode = process.argv[3] ?? 'run';
|
|
35
|
+
const effort = process.argv[4] ?? 'max';
|
|
36
|
+
if (!repo) { console.error('usage: node scripts/smoke-real.mjs <tempGitRepo> [run|spawn|standalone] [effort]'); process.exit(2); }
|
|
37
|
+
|
|
38
|
+
const TASK = [
|
|
39
|
+
'In this git repository, create the file src/answer.mjs with exactly the content: `export const answer = 40 + 2;`',
|
|
40
|
+
'Then run the single-line check: node -e \'const a = require("./src/answer.mjs"); if (a.answer !== 42) process.exit(1); console.log("answer ok");\' (ESM note: use import("./src/answer.mjs") or write .cjs — pick whatever works and run it).',
|
|
41
|
+
'End your final message with the required Delivery Report:',
|
|
42
|
+
'## Diff',
|
|
43
|
+
'- src/answer.mjs — added answer',
|
|
44
|
+
'## Tests',
|
|
45
|
+
'PASS — node check — answer is 42',
|
|
46
|
+
'## Risks',
|
|
47
|
+
'none',
|
|
48
|
+
].join('\n');
|
|
49
|
+
|
|
50
|
+
// For standalone mode, use ONLY explicitly supplied process-environment
|
|
51
|
+
// credentials (DEEPSEEK_API_KEY / DEEPSEEK_BASE_URL). This script never reads
|
|
52
|
+
// ~/.dsh or any official credential/settings store. Absent credentials are a
|
|
53
|
+
// BLOCKED outcome, not an excuse to invent or read credentials.
|
|
54
|
+
const standaloneEnv = {};
|
|
55
|
+
if (mode === 'standalone') {
|
|
56
|
+
const apiKey = process.env.DEEPSEEK_API_KEY;
|
|
57
|
+
if (!apiKey) {
|
|
58
|
+
console.error('[smoke] BLOCKED: standalone requires DEEPSEEK_API_KEY in the process environment; credential: ABSENT (no official store will be read)');
|
|
59
|
+
process.exit(2);
|
|
60
|
+
}
|
|
61
|
+
standaloneEnv.DEEPSEEK_API_KEY = apiKey;
|
|
62
|
+
if (process.env.DEEPSEEK_BASE_URL) standaloneEnv.DEEPSEEK_BASE_URL = process.env.DEEPSEEK_BASE_URL;
|
|
63
|
+
standaloneEnv.DSH_SANDBOX_MODE = 'workspace-write';
|
|
64
|
+
console.log('[smoke] standalone: using process-environment credentials (not shown)');
|
|
65
|
+
}
|
|
66
|
+
const transport = serverTransport(standaloneEnv);
|
|
67
|
+
const client = new Client({ name: 'dsh-crew-smoke', version: '1.0.0', requestTimeout: 600 * 1000 });
|
|
68
|
+
|
|
69
|
+
async function call(name, args, timeoutMs) {
|
|
70
|
+
const res = await client.callTool({ name, arguments: args }, undefined, timeoutMs ? { timeout: timeoutMs } : undefined);
|
|
71
|
+
return JSON.parse(res.content.find((c) => c.type === 'text').text);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
await client.connect(transport);
|
|
76
|
+
console.log(`[smoke] connected; mode=${mode} cwd=${repo}`);
|
|
77
|
+
if (mode === 'standalone') {
|
|
78
|
+
// Force the standalone execution path (session mode) so jobs.mjs handles it.
|
|
79
|
+
await call('dsh_worker_config', { mode: 'standalone' });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (mode === 'spawn') {
|
|
83
|
+
const spawnView = await call('dsh_spawn_worker', { task: TASK, role: 'worker', cwd: repo });
|
|
84
|
+
console.log('[smoke] spawn view:', JSON.stringify(spawnView, null, 2));
|
|
85
|
+
const wfId = spawnView.workflow_id ?? spawnView.id;
|
|
86
|
+
// poll a few times for the final result (workflow continues in background)
|
|
87
|
+
for (let i = 0; i < 24; i++) {
|
|
88
|
+
await new Promise((r) => setTimeout(r, 5000));
|
|
89
|
+
const v = await call('dsh_worker_result', { job_id: wfId, wait_seconds: 0 });
|
|
90
|
+
if (v.status !== 'running') {
|
|
91
|
+
console.log('[smoke] final (spawn):', JSON.stringify({ id: v.id, role: v.role, phase: v.phase, status: v.status, isolation: v.isolation, attempt: v.attempt, review: v.review?.verdict ?? null, candidate: v.candidate?.changed_files ?? null, error: v.error }, null, 2));
|
|
92
|
+
await client.close();
|
|
93
|
+
process.exit(v.status === 'done' ? 0 : 1);
|
|
94
|
+
}
|
|
95
|
+
if (i === 23) console.log('[smoke] still running after poll window: ', JSON.stringify(v));
|
|
96
|
+
}
|
|
97
|
+
await client.close();
|
|
98
|
+
process.exit(2);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const view = await call('dsh_run_worker', { task: TASK, role: 'worker', cwd: repo, effort, timeout_seconds: 540 }, 560 * 1000);
|
|
102
|
+
const k = (o) => ({ id: o.id, role: o.role, phase: o.phase, status: o.status, isolation: o.isolation, execution_cwd: o.execution_cwd, base_revision: o.base_revision, attempt: o.attempt, decision: o.decision, review: o.review?.verdict ?? null, candidate_available: o.candidate_available, candidate_changed: o.candidate?.changed_files ?? null, outcome_task: o.outcome?.task_status ?? null, tests: o.outcome?.tests_status ?? null, error: o.error, error_code: o.error_code, cleanup_warning: o.cleanup_warning, primary_dirty_hint: o.primary_workspace_dirty });
|
|
103
|
+
console.log('[smoke] final (run):', JSON.stringify(k(view), null, 2));
|
|
104
|
+
await client.close();
|
|
105
|
+
process.exit(view.status === 'done' ? 0 : 1);
|
|
106
|
+
} catch (err) {
|
|
107
|
+
console.error('[smoke] ERROR:', err?.message ?? err);
|
|
108
|
+
try { await client.close(); } catch {}
|
|
109
|
+
process.exit(3);
|
|
110
|
+
}
|
package/scripts/smoke.mjs
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
// Smoke test: dispatch one cheap flash job to verify the installation.
|
|
2
|
-
// Probes the hub first (if DSH web instance is running); falls back to
|
|
3
|
-
// standalone mode. Always exercises the path the user actually installed.
|
|
4
|
-
|
|
5
|
-
import { hubAvailable, hub } from '../src/hub-client.mjs';
|
|
6
|
-
import { readGlobalConfig } from '../src/install/install.mjs';
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
const hubUrl = process.env.DSH_CREW_HUB ?? readGlobalConfig().hub_url;
|
|
10
|
-
const isHubUp = await hubAvailable();
|
|
11
|
-
|
|
12
|
-
if (isHubUp) {
|
|
13
|
-
// Dispatch through the hub
|
|
14
|
-
console.log(`hub at ${hubUrl} is reachable, using hub mode`);
|
|
15
|
-
const job = await hub.spawn({
|
|
16
|
-
task: 'Reply with exactly the word: ok',
|
|
17
|
-
tier: 'flash',
|
|
18
|
-
effort: 'off',
|
|
19
|
-
cwd: process.cwd(),
|
|
20
|
-
source: 'smoke',
|
|
21
|
-
});
|
|
22
|
-
console.log(`spawned ${job.id} ...`);
|
|
23
|
-
const result = await hub.get(job.id, 120);
|
|
24
|
-
if (result.status === 'done') {
|
|
25
|
-
console.log(`worker replied: ${result.result}`);
|
|
26
|
-
console.log('smoke test passed — configuration OK');
|
|
27
|
-
} else if (result.status === 'running') {
|
|
28
|
-
// The wait returns early once the job settles, so this is a real timeout.
|
|
29
|
-
console.error(`smoke test failed: job ${job.id} still running after 120s`);
|
|
30
|
-
console.error('Hint: it is still live in the DSH instance — check its session for what is stuck');
|
|
31
|
-
process.exit(1);
|
|
32
|
-
} else {
|
|
33
|
-
console.error(`smoke test failed: status=${result.status} error=${result.error}`);
|
|
34
|
-
console.error('Hint: check the DSH instance logs and verify DeepSeek provider credentials');
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
// Fall back to standalone mode
|
|
39
|
-
console.log(`no hub at ${hubUrl}, falling back to standalone mode`);
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
const { startJob, waitJob, jobView } = await import('../src/jobs.mjs');
|
|
43
|
-
const job = startJob({
|
|
44
|
-
task: 'Reply with exactly the word: ok',
|
|
45
|
-
tier: 'flash',
|
|
46
|
-
effort: 'off',
|
|
47
|
-
cwd: process.cwd(),
|
|
48
|
-
});
|
|
49
|
-
console.log(`spawned ${job.id} (deepseek-v4-flash) ...`);
|
|
50
|
-
await waitJob(job.id, 120_000);
|
|
51
|
-
const v = jobView(job, { withResult: true });
|
|
52
|
-
if (v.status === 'done') {
|
|
53
|
-
console.log(`worker replied: ${v.result}`);
|
|
54
|
-
console.log('smoke test passed — configuration OK');
|
|
55
|
-
} else {
|
|
56
|
-
console.error(`smoke test failed: status=${v.status} error=${v.error}`);
|
|
57
|
-
console.error('Hint: DEEPSEEK_API_KEY missing or invalid in env or ~/.config/dsh-crew/.env, or runtime not installed');
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
} catch (err) {
|
|
61
|
-
// The standalone runtime lives in this package's own node_modules; the
|
|
62
|
-
// @deepseek-ai/* packages are peerDependencies, so an installed copy of
|
|
63
|
-
// the plugin has none of them and the dynamic import above is what tells
|
|
64
|
-
// us so. Anything else here is a dispatch failure, not a missing runtime.
|
|
65
|
-
if (err.code === 'ERR_MODULE_NOT_FOUND' || err.code === 'MODULE_NOT_FOUND') {
|
|
66
|
-
console.error('smoke test failed: the standalone runtime is not installed in this copy');
|
|
67
|
-
console.error('Hint: run "pnpm install" from a source checkout, or start a DSH instance to use hub mode');
|
|
68
|
-
} else {
|
|
69
|
-
console.error(`smoke test failed: ${err.message}`);
|
|
70
|
-
console.error('Hint: DEEPSEEK_API_KEY missing or invalid in env or ~/.config/dsh-crew/.env');
|
|
71
|
-
}
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
} catch (err) {
|
|
76
|
-
console.error(`smoke test failed: ${err.message}`);
|
|
77
|
-
process.exit(1);
|
|
78
|
-
}
|
|
1
|
+
// Smoke test: dispatch one cheap flash job to verify the installation.
|
|
2
|
+
// Probes the hub first (if DSH web instance is running); falls back to
|
|
3
|
+
// standalone mode. Always exercises the path the user actually installed.
|
|
4
|
+
|
|
5
|
+
import { hubAvailable, hub } from '../src/hub-client.mjs';
|
|
6
|
+
import { readGlobalConfig } from '../src/install/install.mjs';
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
const hubUrl = process.env.DSH_CREW_HUB ?? readGlobalConfig().hub_url;
|
|
10
|
+
const isHubUp = await hubAvailable();
|
|
11
|
+
|
|
12
|
+
if (isHubUp) {
|
|
13
|
+
// Dispatch through the hub
|
|
14
|
+
console.log(`hub at ${hubUrl} is reachable, using hub mode`);
|
|
15
|
+
const job = await hub.spawn({
|
|
16
|
+
task: 'Reply with exactly the word: ok',
|
|
17
|
+
tier: 'flash',
|
|
18
|
+
effort: 'off',
|
|
19
|
+
cwd: process.cwd(),
|
|
20
|
+
source: 'smoke',
|
|
21
|
+
});
|
|
22
|
+
console.log(`spawned ${job.id} ...`);
|
|
23
|
+
const result = await hub.get(job.id, 120);
|
|
24
|
+
if (result.status === 'done') {
|
|
25
|
+
console.log(`worker replied: ${result.result}`);
|
|
26
|
+
console.log('smoke test passed — configuration OK');
|
|
27
|
+
} else if (result.status === 'running') {
|
|
28
|
+
// The wait returns early once the job settles, so this is a real timeout.
|
|
29
|
+
console.error(`smoke test failed: job ${job.id} still running after 120s`);
|
|
30
|
+
console.error('Hint: it is still live in the DSH instance — check its session for what is stuck');
|
|
31
|
+
process.exit(1);
|
|
32
|
+
} else {
|
|
33
|
+
console.error(`smoke test failed: status=${result.status} error=${result.error}`);
|
|
34
|
+
console.error('Hint: check the DSH instance logs and verify DeepSeek provider credentials');
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
// Fall back to standalone mode
|
|
39
|
+
console.log(`no hub at ${hubUrl}, falling back to standalone mode`);
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const { startJob, waitJob, jobView } = await import('../src/jobs.mjs');
|
|
43
|
+
const job = startJob({
|
|
44
|
+
task: 'Reply with exactly the word: ok',
|
|
45
|
+
tier: 'flash',
|
|
46
|
+
effort: 'off',
|
|
47
|
+
cwd: process.cwd(),
|
|
48
|
+
});
|
|
49
|
+
console.log(`spawned ${job.id} (deepseek-v4-flash) ...`);
|
|
50
|
+
await waitJob(job.id, 120_000);
|
|
51
|
+
const v = jobView(job, { withResult: true });
|
|
52
|
+
if (v.status === 'done') {
|
|
53
|
+
console.log(`worker replied: ${v.result}`);
|
|
54
|
+
console.log('smoke test passed — configuration OK');
|
|
55
|
+
} else {
|
|
56
|
+
console.error(`smoke test failed: status=${v.status} error=${v.error}`);
|
|
57
|
+
console.error('Hint: DEEPSEEK_API_KEY missing or invalid in env or ~/.config/dsh-crew/.env, or runtime not installed');
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
} catch (err) {
|
|
61
|
+
// The standalone runtime lives in this package's own node_modules; the
|
|
62
|
+
// @deepseek-ai/* packages are peerDependencies, so an installed copy of
|
|
63
|
+
// the plugin has none of them and the dynamic import above is what tells
|
|
64
|
+
// us so. Anything else here is a dispatch failure, not a missing runtime.
|
|
65
|
+
if (err.code === 'ERR_MODULE_NOT_FOUND' || err.code === 'MODULE_NOT_FOUND') {
|
|
66
|
+
console.error('smoke test failed: the standalone runtime is not installed in this copy');
|
|
67
|
+
console.error('Hint: run "pnpm install" from a source checkout, or start a DSH instance to use hub mode');
|
|
68
|
+
} else {
|
|
69
|
+
console.error(`smoke test failed: ${err.message}`);
|
|
70
|
+
console.error('Hint: DEEPSEEK_API_KEY missing or invalid in env or ~/.config/dsh-crew/.env');
|
|
71
|
+
}
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch (err) {
|
|
76
|
+
console.error(`smoke test failed: ${err.message}`);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
// Live-verify the fixed installer against a fake home: the settings must
|
|
2
|
-
// point at the repository itself as the marketplace root (no parent-dir
|
|
3
|
-
// assumption), permission rules intact, CLI step skipped in test mode.
|
|
4
|
-
import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { tmpdir } from 'node:os';
|
|
7
|
-
import { installClaudeCode, uninstallClaudeCode } from '../src/install/install.mjs';
|
|
8
|
-
|
|
9
|
-
const home = mkdtempSync(join(tmpdir(), 'dsh-crew-fix-test-'));
|
|
10
|
-
try {
|
|
11
|
-
const r = await installClaudeCode({ home });
|
|
12
|
-
console.log('actions:', r.actions.slice(0, 3).join(' | '));
|
|
13
|
-
const s = JSON.parse(readFileSync(join(home, '.claude', 'settings.json'), 'utf8'));
|
|
14
|
-
const mp = s.extraKnownMarketplaces['dsh-crew'];
|
|
15
|
-
const cwd = process.cwd().replaceAll('\\', '/');
|
|
16
|
-
const mpPath = String(mp?.source?.path ?? '').replaceAll('\\', '/');
|
|
17
|
-
console.log('marketplace path is repo root:', mpPath === cwd, '->', mpPath);
|
|
18
|
-
console.log('permission rules:', (s.permissions?.allow ?? []).filter((x) => String(x).includes('dsh-crew')).length);
|
|
19
|
-
console.log('cli step skipped in test mode:', r.actions.some((a) => a.includes('test mode')));
|
|
20
|
-
if (mpPath !== cwd) throw new Error('marketplace not pointing at repo root');
|
|
21
|
-
const u = await uninstallClaudeCode({ home });
|
|
22
|
-
console.log('uninstall ok:', u.ok);
|
|
23
|
-
} finally {
|
|
24
|
-
rmSync(home, { recursive: true, force: true });
|
|
25
|
-
}
|
|
26
|
-
console.log('INSTALLER FIX VERIFIED');
|
|
1
|
+
// Live-verify the fixed installer against a fake home: the settings must
|
|
2
|
+
// point at the repository itself as the marketplace root (no parent-dir
|
|
3
|
+
// assumption), permission rules intact, CLI step skipped in test mode.
|
|
4
|
+
import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { tmpdir } from 'node:os';
|
|
7
|
+
import { installClaudeCode, uninstallClaudeCode } from '../src/install/install.mjs';
|
|
8
|
+
|
|
9
|
+
const home = mkdtempSync(join(tmpdir(), 'dsh-crew-fix-test-'));
|
|
10
|
+
try {
|
|
11
|
+
const r = await installClaudeCode({ home });
|
|
12
|
+
console.log('actions:', r.actions.slice(0, 3).join(' | '));
|
|
13
|
+
const s = JSON.parse(readFileSync(join(home, '.claude', 'settings.json'), 'utf8'));
|
|
14
|
+
const mp = s.extraKnownMarketplaces['dsh-crew'];
|
|
15
|
+
const cwd = process.cwd().replaceAll('\\', '/');
|
|
16
|
+
const mpPath = String(mp?.source?.path ?? '').replaceAll('\\', '/');
|
|
17
|
+
console.log('marketplace path is repo root:', mpPath === cwd, '->', mpPath);
|
|
18
|
+
console.log('permission rules:', (s.permissions?.allow ?? []).filter((x) => String(x).includes('dsh-crew')).length);
|
|
19
|
+
console.log('cli step skipped in test mode:', r.actions.some((a) => a.includes('test mode')));
|
|
20
|
+
if (mpPath !== cwd) throw new Error('marketplace not pointing at repo root');
|
|
21
|
+
const u = await uninstallClaudeCode({ home });
|
|
22
|
+
console.log('uninstall ok:', u.ok);
|
|
23
|
+
} finally {
|
|
24
|
+
rmSync(home, { recursive: true, force: true });
|
|
25
|
+
}
|
|
26
|
+
console.log('INSTALLER FIX VERIFIED');
|