@zoraxylia/dsh-codex-adapter 0.1.0 → 0.1.2
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/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/.mcp.json +1 -1
- package/README.de.md +32 -32
- package/README.es.md +32 -32
- package/README.fr.md +32 -32
- package/README.hi.md +32 -32
- package/README.id.md +32 -32
- package/README.ja.md +32 -32
- package/README.ko.md +32 -32
- package/README.md +33 -33
- package/README.pt.md +32 -32
- package/README.ru.md +32 -32
- package/README.th.md +32 -32
- package/README.tr.md +32 -32
- package/README.vi.md +32 -32
- package/README.zh-TW.md +32 -32
- package/README.zh.md +33 -33
- package/agy/agents/ds-flash.md +1 -1
- package/agy/agents/ds-pro.md +1 -1
- package/agy/skills/dsh-playbook/SKILL.md +1 -1
- package/codex/agents/ds-flash.toml +2 -2
- package/codex/agents/ds-pro.toml +2 -2
- package/codex/prompts/dsh-playbook.md +1 -1
- package/commands/off.md +1 -1
- package/commands/playbook.md +1 -1
- package/cordis.patch.yml +2 -2
- package/grok/agents/ds-flash.md +1 -1
- package/grok/agents/ds-pro.md +1 -1
- package/grok/commands/dsh-config.md +1 -1
- package/grok/commands/dsh-playbook.md +2 -2
- package/grok/commands/dsh-status.md +1 -1
- package/lib/client.js +37 -27
- package/lib/server.mjs +22 -22
- package/package.json +6 -5
- package/scripts/bump-version.mjs +79 -0
- package/scripts/fake-agy.sh +3 -3
- package/scripts/release-local.mjs +2 -2
- package/scripts/smoke-bundle.mjs +2 -2
- package/scripts/smoke-pack.mjs +4 -4
- package/scripts/smoke.mjs +3 -3
- package/scripts/verify-wpc10-client.mjs +2 -2
- package/scripts/verify-wpc14-proc-endpoints.mjs +6 -6
- package/scripts/verify-wpc9-guardrails.mjs +10 -10
- package/src/cli-workers.mjs +1 -1
- package/src/client/index.tsx +34 -32
- package/src/cwd-lock.mjs +1 -1
- package/src/hub/index.mjs +31 -10
- package/src/hub-client.mjs +4 -4
- package/src/install/install.mjs +35 -32
- package/src/jobs.mjs +2 -2
- package/src/multimodal.mjs +18 -18
- package/src/origin-guard.mjs +8 -8
- package/src/plugin-env.mjs +2 -2
- package/src/proc-kill.mjs +5 -5
- package/src/provider-probe.mjs +3 -3
- package/src/server.mjs +4 -4
- package/src/status-shard.mjs +2 -2
- package/src/vision-route.mjs +3 -3
- package/statusline/statusline.sh +1 -1
- package/statusline/worker-segment.sh +3 -3
- package/worker.cordis.yml +1 -1
- /package/docs/images/{dsh-crew-host.png → dsh-adapter-host.png} +0 -0
- /package/docs/images/{dsh-crew-jobs.png → dsh-adapter-jobs.png} +0 -0
- /package/docs/images/{dsh-crew-logo.png → dsh-adapter-logo.png} +0 -0
- /package/docs/images/{dsh-crew-overview.png → dsh-adapter-overview.png} +0 -0
package/lib/server.mjs
CHANGED
|
@@ -13888,7 +13888,7 @@ import { readFileSync as readFileSync2, mkdirSync as mkdirSync2, existsSync } fr
|
|
|
13888
13888
|
import { writeFileSync, mkdirSync, rmSync, readdirSync, readFileSync } from "node:fs";
|
|
13889
13889
|
import { join } from "node:path";
|
|
13890
13890
|
import { homedir } from "node:os";
|
|
13891
|
-
var CONFIG_DIR = join(homedir(), ".config", "dsh-
|
|
13891
|
+
var CONFIG_DIR = join(homedir(), ".config", "dsh-adapter");
|
|
13892
13892
|
var SHARD_DIR = join(CONFIG_DIR, "status.d");
|
|
13893
13893
|
var SHARD_FRESH_MS = 30 * 60 * 1e3;
|
|
13894
13894
|
function createShardWriter(kind) {
|
|
@@ -13978,8 +13978,8 @@ function getCwdLocks() {
|
|
|
13978
13978
|
}
|
|
13979
13979
|
|
|
13980
13980
|
// src/origin-guard.mjs
|
|
13981
|
-
var ORIGIN_CHAIN_ENV = "
|
|
13982
|
-
var ORIGIN_DEPTH_ENV = "
|
|
13981
|
+
var ORIGIN_CHAIN_ENV = "DSH_ADAPTER_ORIGIN_CHAIN";
|
|
13982
|
+
var ORIGIN_DEPTH_ENV = "DSH_ADAPTER_DEPTH";
|
|
13983
13983
|
var DEFAULT_ORIGIN_DEPTH_LIMIT = 3;
|
|
13984
13984
|
function readInheritedOrigin(env = process.env) {
|
|
13985
13985
|
const empty = { chain: [], depth: 0 };
|
|
@@ -14059,7 +14059,7 @@ import { fileURLToPath } from "node:url";
|
|
|
14059
14059
|
import { dirname, join as join2, resolve as resolve2 } from "node:path";
|
|
14060
14060
|
import { homedir as homedir2 } from "node:os";
|
|
14061
14061
|
var ROOT = resolve2(dirname(fileURLToPath(import.meta.url)), "..");
|
|
14062
|
-
var CONFIG_DIR2 = join2(homedir2(), ".config", "dsh-
|
|
14062
|
+
var CONFIG_DIR2 = join2(homedir2(), ".config", "dsh-adapter");
|
|
14063
14063
|
var STATUS_FILE = join2(CONFIG_DIR2, "status.json");
|
|
14064
14064
|
var RUNTIME_BIN = join2(ROOT, "node_modules", ".bin", "dsh-jsonrpc-agent");
|
|
14065
14065
|
var CORDIS = join2(ROOT, "worker.cordis.yml");
|
|
@@ -14250,7 +14250,7 @@ async function startJob({ task, tier = "flash", effort = "max", cwd, maxTokens =
|
|
|
14250
14250
|
DSH_SESSION_ROOT: join2(CONFIG_DIR2, "sessions"),
|
|
14251
14251
|
DSH_REASONING_EFFORT: effort,
|
|
14252
14252
|
// Origin guard: the worker runtime inherits the dispatch chain, so a
|
|
14253
|
-
//
|
|
14253
|
+
// adapter instance it starts itself continues the chain (WPC9).
|
|
14254
14254
|
...origin ? { [ORIGIN_CHAIN_ENV]: JSON.stringify(origin.chain), [ORIGIN_DEPTH_ENV]: String(origin.depth) } : {}
|
|
14255
14255
|
},
|
|
14256
14256
|
requestTimeoutMs: timeoutMs
|
|
@@ -14371,8 +14371,8 @@ import { dirname as dirname2, join as join3, resolve as resolve3, relative } fro
|
|
|
14371
14371
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
14372
14372
|
import { homedir as homedir3 } from "node:os";
|
|
14373
14373
|
var ROOT2 = resolve3(dirname2(fileURLToPath2(import.meta.url)), "..", "..");
|
|
14374
|
-
var MARKETPLACE_NAME = "dsh-
|
|
14375
|
-
var PLUGIN_KEY = `dsh-
|
|
14374
|
+
var MARKETPLACE_NAME = "dsh-adapter";
|
|
14375
|
+
var PLUGIN_KEY = `dsh-adapter@${MARKETPLACE_NAME}`;
|
|
14376
14376
|
function readJson(file, fallback) {
|
|
14377
14377
|
try {
|
|
14378
14378
|
return JSON.parse(readFileSync3(file, "utf8"));
|
|
@@ -14381,17 +14381,17 @@ function readJson(file, fallback) {
|
|
|
14381
14381
|
}
|
|
14382
14382
|
}
|
|
14383
14383
|
try {
|
|
14384
|
-
const
|
|
14385
|
-
const newDir = join3(homedir3(), ".config", "dsh-
|
|
14386
|
-
|
|
14387
|
-
const
|
|
14388
|
-
renameSync(oldDir, newDir);
|
|
14384
|
+
const { renameSync } = await import("node:fs");
|
|
14385
|
+
const newDir = join3(homedir3(), ".config", "dsh-adapter");
|
|
14386
|
+
for (const legacy of ["dsh-workers", "dsh-crew"]) {
|
|
14387
|
+
const oldDir = join3(homedir3(), ".config", legacy);
|
|
14388
|
+
if (existsSync2(oldDir) && !existsSync2(newDir)) renameSync(oldDir, newDir);
|
|
14389
14389
|
}
|
|
14390
14390
|
} catch {
|
|
14391
14391
|
}
|
|
14392
14392
|
var GLOBAL_CONFIG_FILE = join3(CONFIG_DIR_HOME(), "config.json");
|
|
14393
14393
|
function CONFIG_DIR_HOME() {
|
|
14394
|
-
return join3(homedir3(), ".config", "dsh-
|
|
14394
|
+
return join3(homedir3(), ".config", "dsh-adapter");
|
|
14395
14395
|
}
|
|
14396
14396
|
var GLOBAL_CONFIG_DEFAULTS = {
|
|
14397
14397
|
default_tier: "flash",
|
|
@@ -14406,9 +14406,9 @@ var GLOBAL_CONFIG_DEFAULTS = {
|
|
|
14406
14406
|
escalate_on_failure: false,
|
|
14407
14407
|
// Multimodal bridge: which subscription CLI lends the text-only DS model
|
|
14408
14408
|
// eyes (describe_image) and a brush (generate_image).
|
|
14409
|
-
vision_provider: "
|
|
14410
|
-
// claude-code |
|
|
14411
|
-
vision_model: "
|
|
14409
|
+
vision_provider: "codex",
|
|
14410
|
+
// codex | claude-code | grok | agy | <custom id> | off
|
|
14411
|
+
vision_model: "default",
|
|
14412
14412
|
// model passed to the vision CLI; free-form
|
|
14413
14413
|
imagegen_provider: "codex",
|
|
14414
14414
|
// codex | agy | grok | <custom id> | off
|
|
@@ -14443,7 +14443,7 @@ function readGlobalConfig() {
|
|
|
14443
14443
|
// src/plugin-env.mjs
|
|
14444
14444
|
var PLUGIN_ENV_PREFIX = "DSHPLUGIN_";
|
|
14445
14445
|
var LEGACY_ENV_PREFIX = "DSH_";
|
|
14446
|
-
var PLUGIN_LABEL = "dsh-
|
|
14446
|
+
var PLUGIN_LABEL = "dsh-adapter";
|
|
14447
14447
|
var warned = /* @__PURE__ */ new Set();
|
|
14448
14448
|
function pluginEnvName(suffix) {
|
|
14449
14449
|
return PLUGIN_ENV_PREFIX + suffix;
|
|
@@ -14470,15 +14470,15 @@ function pluginEnv(suffix, options = {}) {
|
|
|
14470
14470
|
}
|
|
14471
14471
|
|
|
14472
14472
|
// src/hub-client.mjs
|
|
14473
|
-
var BASE = (pluginEnv("
|
|
14474
|
-
var API = `${BASE}/_dsh/dsh-
|
|
14473
|
+
var BASE = (pluginEnv("ADAPTER_HUB") ?? readGlobalConfig().hub_url).replace(/\/$/, "");
|
|
14474
|
+
var API = `${BASE}/_dsh/dsh-adapter`;
|
|
14475
14475
|
var lastProbe = { at: 0, ok: false };
|
|
14476
14476
|
async function hubAvailable() {
|
|
14477
14477
|
if (Date.now() - lastProbe.at < 1e4) return lastProbe.ok;
|
|
14478
14478
|
try {
|
|
14479
14479
|
const res = await fetch(`${API}/ping`, { signal: AbortSignal.timeout(800) });
|
|
14480
14480
|
const body = await res.json();
|
|
14481
|
-
lastProbe = { at: Date.now(), ok: res.ok && body?.service === "dsh-
|
|
14481
|
+
lastProbe = { at: Date.now(), ok: res.ok && body?.service === "dsh-adapter-hub" };
|
|
14482
14482
|
} catch {
|
|
14483
14483
|
lastProbe = { at: Date.now(), ok: false };
|
|
14484
14484
|
}
|
|
@@ -14861,7 +14861,7 @@ async function startCliJob({ worker, task, cwd, timeoutMs = DEFAULT_TIMEOUT_MS,
|
|
|
14861
14861
|
try {
|
|
14862
14862
|
child = spawn(profile.cli, args, {
|
|
14863
14863
|
cwd: workspace,
|
|
14864
|
-
// Origin guard: the CLI worker inherits the dispatch chain, so a
|
|
14864
|
+
// Origin guard: the CLI worker inherits the dispatch chain, so a adapter
|
|
14865
14865
|
// instance it starts itself continues the chain (WPC9).
|
|
14866
14866
|
env: {
|
|
14867
14867
|
...process.env,
|
|
@@ -15059,7 +15059,7 @@ function describeBindings(config = {}) {
|
|
|
15059
15059
|
}
|
|
15060
15060
|
|
|
15061
15061
|
// src/server.mjs
|
|
15062
|
-
var server = new McpServer({ name: "dsh-
|
|
15062
|
+
var server = new McpServer({ name: "dsh-adapter", version: "0.1.2" });
|
|
15063
15063
|
var tierSchema = external_exports.enum(["flash", "pro"]).optional().describe("Worker model tier. flash = mechanical, well-scoped work (single-file edits, lookups, formatting); pro = multi-file changes, debugging, design judgment. Omit to use the session default. Ignored when worker= is set.");
|
|
15064
15064
|
var effortSchema = external_exports.enum(["off", "high", "max"]).optional().describe("Reasoning effort for the worker. Omit to use the session default. With worker= it only applies when passed explicitly and the profile supports it (agy maps to low/medium/high).");
|
|
15065
15065
|
var workerSchema = external_exports.string().optional().describe('Named CLI worker profile (e.g. "agy" or "grok"). Explicit opt-in only: set it when the user explicitly asks for that external coding CLI, never as a default. When set, dispatch bypasses tier/mode and runs the task through that CLI; the profile pins backend\xD7model\xD7effort. See dsh_worker_config output, worker_profiles field, for the available profiles.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoraxylia/dsh-codex-adapter",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/hub/index.mjs",
|
|
6
6
|
"description": "DeepSeek Harness plugin: dispatch work to DSH agents from Claude Code / Codex, as native subagents with live progress",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"smoke:mcp": "node scripts/smoke-bundle.mjs",
|
|
26
26
|
"smoke:pack": "node scripts/smoke-pack.mjs",
|
|
27
27
|
"release:local": "node scripts/release-local.mjs",
|
|
28
|
+
"version:bump": "node scripts/bump-version.mjs",
|
|
28
29
|
"prepack": "npm run smoke:cwd && npm run smoke:mcp",
|
|
29
30
|
"prepublishOnly": "npm run smoke:mcp && npm run smoke:pack",
|
|
30
31
|
"test": "node --test tests/*.test.mjs"
|
|
@@ -127,10 +128,10 @@
|
|
|
127
128
|
".mcp.json",
|
|
128
129
|
"README.md",
|
|
129
130
|
"README.*.md",
|
|
130
|
-
"docs/images/dsh-
|
|
131
|
-
"docs/images/dsh-
|
|
132
|
-
"docs/images/dsh-
|
|
133
|
-
"docs/images/dsh-
|
|
131
|
+
"docs/images/dsh-adapter-logo.png",
|
|
132
|
+
"docs/images/dsh-adapter-overview.png",
|
|
133
|
+
"docs/images/dsh-adapter-host.png",
|
|
134
|
+
"docs/images/dsh-adapter-jobs.png",
|
|
134
135
|
"LICENSE"
|
|
135
136
|
],
|
|
136
137
|
"publishConfig": {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Bump the version in every place the release gates compare.
|
|
3
|
+
//
|
|
4
|
+
// node scripts/bump-version.mjs 0.1.1
|
|
5
|
+
// node scripts/bump-version.mjs minor # 0.1.1 -> 0.2.0
|
|
6
|
+
// node scripts/bump-version.mjs patch # 0.1.1 -> 0.1.2
|
|
7
|
+
//
|
|
8
|
+
// smoke-pack asserts that package.json, .claude-plugin/plugin.json,
|
|
9
|
+
// src/server.mjs and the built lib/server.mjs all report the same version, so
|
|
10
|
+
// a release that edits only package.json fails the gate. This script keeps the
|
|
11
|
+
// four in sync and rebuilds the bundle; commit the result before publishing.
|
|
12
|
+
|
|
13
|
+
import { execFileSync } from 'node:child_process';
|
|
14
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
15
|
+
import { dirname, join } from 'node:path';
|
|
16
|
+
import { fileURLToPath } from 'node:url';
|
|
17
|
+
|
|
18
|
+
const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
19
|
+
const arg = process.argv[2];
|
|
20
|
+
|
|
21
|
+
if (!arg) {
|
|
22
|
+
console.error('usage: node scripts/bump-version.mjs <version|patch|minor|major>');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const pkgPath = join(ROOT, 'package.json');
|
|
27
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
28
|
+
const current = pkg.version;
|
|
29
|
+
|
|
30
|
+
function nextVersion(input) {
|
|
31
|
+
const m = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(current);
|
|
32
|
+
if (!m) throw new Error('unparseable current version: ' + current);
|
|
33
|
+
const [major, minor, patch] = [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
34
|
+
if (/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/.test(input)) return input;
|
|
35
|
+
if (input === 'major') return `${major + 1}.0.0`;
|
|
36
|
+
if (input === 'minor') return `${major}.${minor + 1}.0`;
|
|
37
|
+
if (input === 'patch') return `${major}.${minor}.${patch + 1}`;
|
|
38
|
+
throw new Error('expected an exact version or patch|minor|major, got: ' + input);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const next = (() => {
|
|
42
|
+
try {
|
|
43
|
+
return nextVersion(arg);
|
|
44
|
+
} catch (err) {
|
|
45
|
+
console.error(err.message);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
49
|
+
if (next === current) {
|
|
50
|
+
console.error(`version is already ${current}`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const edits = [
|
|
55
|
+
['package.json', (s) => s.replace(`"version": "${current}"`, `"version": "${next}"`)],
|
|
56
|
+
['.claude-plugin/plugin.json', (s) => s.replace(`"version": "${current}"`, `"version": "${next}"`)],
|
|
57
|
+
['src/server.mjs', (s) => s.replace(`version: '${current}'`, `version: '${next}'`)],
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
for (const [file, edit] of edits) {
|
|
61
|
+
const path = join(ROOT, file);
|
|
62
|
+
const before = readFileSync(path, 'utf8');
|
|
63
|
+
const after = edit(before);
|
|
64
|
+
if (after === before) {
|
|
65
|
+
console.error(`could not find version ${current} in ${file}`);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
writeFileSync(path, after);
|
|
69
|
+
console.log(`updated ${file}`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Rebuild makes lib/server.mjs carry the new version; the pnpm lockfile keeps
|
|
73
|
+
// the bundle byte-identical apart from that string. Run npm's CLI through node
|
|
74
|
+
// rather than the pnpm shim, which execFile cannot start on Windows.
|
|
75
|
+
const npmCli = join(dirname(process.execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js');
|
|
76
|
+
execFileSync(process.execPath, [npmCli, 'run', 'build'], { cwd: ROOT, stdio: 'inherit' });
|
|
77
|
+
|
|
78
|
+
console.log(`\n${current} -> ${next}`);
|
|
79
|
+
console.log('Next: run pnpm run smoke:pack, commit, then npm publish --access public');
|
package/scripts/fake-agy.sh
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
# cli-workers adapter parses (init / step_update / result). Behavior is
|
|
4
4
|
# controlled through env: FAKE_AGY_MODE / FAKE_AGY_MODE_FILE (NORMAL|HANG),
|
|
5
5
|
# FAKE_AGY_DELAY_MS / FAKE_AGY_DELAY_FILE (ms before the result event),
|
|
6
|
-
# FAKE_AGY_CAPTURE (if set, the inherited
|
|
6
|
+
# FAKE_AGY_CAPTURE (if set, the inherited DSH_ADAPTER_ORIGIN_CHAIN / _DEPTH are
|
|
7
7
|
# written next to it so tests can assert env propagation).
|
|
8
8
|
mode="${FAKE_AGY_MODE:-NORMAL}"
|
|
9
9
|
[ -n "${FAKE_AGY_MODE_FILE:-}" ] && mode="$(cat "$FAKE_AGY_MODE_FILE")"
|
|
10
10
|
delay_ms="${FAKE_AGY_DELAY_MS:-150}"
|
|
11
11
|
[ -n "${FAKE_AGY_DELAY_FILE:-}" ] && delay_ms="$(cat "$FAKE_AGY_DELAY_FILE")"
|
|
12
12
|
if [ -n "${FAKE_AGY_CAPTURE:-}" ]; then
|
|
13
|
-
printf '%s' "${
|
|
14
|
-
printf '%s' "${
|
|
13
|
+
printf '%s' "${DSH_ADAPTER_ORIGIN_CHAIN:-}" > "$FAKE_AGY_CAPTURE"
|
|
14
|
+
printf '%s' "${DSH_ADAPTER_DEPTH:-}" > "$FAKE_AGY_CAPTURE.depth"
|
|
15
15
|
fi
|
|
16
16
|
printf '%s\n' '{"event":"init","init":{"permission_mode":"acceptEdits","tools":[]}}'
|
|
17
17
|
sleep 0.05
|
|
@@ -42,8 +42,8 @@ function capture(cmd, argv) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// pnpm keeps the lockfile authoritative, but a machine without pnpm can use
|
|
45
|
-
// npm for the same scripts; force one with
|
|
46
|
-
const pm = process.env.
|
|
45
|
+
// npm for the same scripts; force one with ADAPTER_PM=pnpm|npm.
|
|
46
|
+
const pm = process.env.ADAPTER_PM || (capture('pnpm', ['--version']) ? 'pnpm' : 'npm');
|
|
47
47
|
console.log(`package manager: ${pm} | ${pkg.name}@${version}`);
|
|
48
48
|
|
|
49
49
|
if (!force) {
|
package/scripts/smoke-bundle.mjs
CHANGED
|
@@ -55,7 +55,7 @@ if (!bundleText.includes('MAX_POLL_SLICE_SECONDS')) fail('bundle lost the MAX_PO
|
|
|
55
55
|
console.log('[smoke:mcp] bundle assertions OK: no inlined @deepseek-ai/* code; lazy dsh-sdk-client specifier and MAX_POLL_SLICE_SECONDS present');
|
|
56
56
|
|
|
57
57
|
// 2. Fresh temp dir - the 'installed plugin copy'. Nothing but the payload.
|
|
58
|
-
const tmp = mkdtempSync(join(tmpdir(), 'dsh-
|
|
58
|
+
const tmp = mkdtempSync(join(tmpdir(), 'dsh-adapter-smoke-'));
|
|
59
59
|
let child = null;
|
|
60
60
|
let finished = false;
|
|
61
61
|
|
|
@@ -134,7 +134,7 @@ try {
|
|
|
134
134
|
console.log('--- initialize response (raw) ---');
|
|
135
135
|
console.log(responses[responses.length - 1]);
|
|
136
136
|
if (!init.result || !init.result.protocolVersion) fail('initialize result missing protocolVersion');
|
|
137
|
-
if (!init.result.serverInfo || init.result.serverInfo.name !== 'dsh-
|
|
137
|
+
if (!init.result.serverInfo || init.result.serverInfo.name !== 'dsh-adapter') fail('initialize serverInfo.name is ' + JSON.stringify(init.result && init.result.serverInfo && init.result.serverInfo.name) + ', expected dsh-adapter');
|
|
138
138
|
console.log('[smoke:mcp] initialize OK: protocolVersion=' + init.result.protocolVersion + ', serverInfo=' + JSON.stringify(init.result.serverInfo));
|
|
139
139
|
|
|
140
140
|
// Per the MCP spec the client must announce readiness before other calls.
|
package/scripts/smoke-pack.mjs
CHANGED
|
@@ -177,7 +177,7 @@ async function handshake(serverRel, label) {
|
|
|
177
177
|
console.log('--- initialize response (raw) ---');
|
|
178
178
|
console.log(responses[responses.length - 1]);
|
|
179
179
|
const info = init.result && init.result.serverInfo;
|
|
180
|
-
if (!info || info.name !== 'dsh-
|
|
180
|
+
if (!info || info.name !== 'dsh-adapter') fail(label + ': serverInfo.name is ' + JSON.stringify(info && info.name) + ', expected dsh-adapter');
|
|
181
181
|
|
|
182
182
|
send({ jsonrpc: '2.0', method: 'notifications/initialized' });
|
|
183
183
|
|
|
@@ -200,12 +200,12 @@ async function handshake(serverRel, label) {
|
|
|
200
200
|
// 1. Pack the current tree. prepack runs smoke:mcp (rebuild + bundle
|
|
201
201
|
// assertions), so a stale or broken lib/server.mjs cannot get packed.
|
|
202
202
|
console.log('[smoke:pack] 1/5 npm pack (prepack runs smoke:mcp first) ...');
|
|
203
|
-
const packDir = mkdtempSync(join(tmpdir(), 'dsh-
|
|
203
|
+
const packDir = mkdtempSync(join(tmpdir(), 'dsh-adapter-pack-'));
|
|
204
204
|
tempDirs.push(packDir);
|
|
205
205
|
// Hermetic npm cache: a shared ~/.npm cache can be stale, or (as seen on
|
|
206
206
|
// the author's machine) hold root-owned leftovers from older npm versions,
|
|
207
207
|
// which would fail this test with EPERM instead of testing the tarball.
|
|
208
|
-
const cacheDir = mkdtempSync(join(tmpdir(), 'dsh-
|
|
208
|
+
const cacheDir = mkdtempSync(join(tmpdir(), 'dsh-adapter-npm-cache-'));
|
|
209
209
|
tempDirs.push(cacheDir);
|
|
210
210
|
const packOut = run('npm', ['pack', '--cache', cacheDir, '--pack-destination', packDir], { cwd: ROOT, env: { npm_config_cache: cacheDir } });
|
|
211
211
|
console.log(packOut.split('\n').slice(-6).join('\n'));
|
|
@@ -218,7 +218,7 @@ console.log('[smoke:pack] tarball: ' + tarballPath + ' (' + statSync(tarballPath
|
|
|
218
218
|
// 2. Install into a brand-new empty directory - the external-user scenario
|
|
219
219
|
// from issue #3 that never worked before.
|
|
220
220
|
console.log('\n[smoke:pack] 2/5 npm init -y && npm i ' + tarballPath);
|
|
221
|
-
const installDir = mkdtempSync(join(tmpdir(), 'dsh-
|
|
221
|
+
const installDir = mkdtempSync(join(tmpdir(), 'dsh-adapter-install-'));
|
|
222
222
|
tempDirs.push(installDir);
|
|
223
223
|
console.log(run('npm', ['init', '-y', '--cache', cacheDir], { cwd: installDir, env: { npm_config_cache: cacheDir } }).split('\n').slice(0, 3).join('\n'));
|
|
224
224
|
const installOut = run('npm', ['i', tarballPath, '--cache', cacheDir], { cwd: installDir, timeoutMs: 600_000, env: { npm_config_cache: cacheDir } });
|
package/scripts/smoke.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { hubAvailable, hub } from '../src/hub-client.mjs';
|
|
|
6
6
|
import { readGlobalConfig } from '../src/install/install.mjs';
|
|
7
7
|
|
|
8
8
|
try {
|
|
9
|
-
const hubUrl = process.env.
|
|
9
|
+
const hubUrl = process.env.DSHPLUGIN_ADAPTER_HUB ?? process.env.DSH_ADAPTER_HUB ?? readGlobalConfig().hub_url;
|
|
10
10
|
const isHubUp = await hubAvailable();
|
|
11
11
|
|
|
12
12
|
if (isHubUp) {
|
|
@@ -54,7 +54,7 @@ try {
|
|
|
54
54
|
console.log('smoke test passed — configuration OK');
|
|
55
55
|
} else {
|
|
56
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-
|
|
57
|
+
console.error('Hint: DEEPSEEK_API_KEY missing or invalid in env or ~/.config/dsh-adapter/.env, or runtime not installed');
|
|
58
58
|
process.exit(1);
|
|
59
59
|
}
|
|
60
60
|
} catch (err) {
|
|
@@ -68,7 +68,7 @@ try {
|
|
|
68
68
|
console.error('Hint: run "pnpm install" from a source checkout, or start a DSH instance to use hub mode');
|
|
69
69
|
} else {
|
|
70
70
|
console.error(`smoke test failed: ${err.message}`);
|
|
71
|
-
console.error('Hint: DEEPSEEK_API_KEY missing or invalid in env or ~/.config/dsh-
|
|
71
|
+
console.error('Hint: DEEPSEEK_API_KEY missing or invalid in env or ~/.config/dsh-adapter/.env');
|
|
72
72
|
}
|
|
73
73
|
process.exit(1);
|
|
74
74
|
}
|
|
@@ -17,7 +17,7 @@ import { join, dirname } from 'node:path';
|
|
|
17
17
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
18
18
|
|
|
19
19
|
const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
20
|
-
const tmp = mkdtempSync(join(tmpdir(), 'dsh-
|
|
20
|
+
const tmp = mkdtempSync(join(tmpdir(), 'dsh-adapter-wpc10-'));
|
|
21
21
|
let failures = 0;
|
|
22
22
|
function check(name, cond) {
|
|
23
23
|
if (cond) console.log(' ok - ' + name);
|
|
@@ -177,7 +177,7 @@ try {
|
|
|
177
177
|
basenameOf('/w/a/repo') === 'repo' && basenameOf('/w/a/repo/') === 'repo'
|
|
178
178
|
&& basenameOf(null) === '' && basenameOf('/') === '/');
|
|
179
179
|
check('abbrevPath swaps $HOME for ~',
|
|
180
|
-
abbrevPath('/home/fini/workspace/dsh-plugins/dsh-
|
|
180
|
+
abbrevPath('/home/fini/workspace/dsh-plugins/dsh-adapter', '/home/fini') === '~/workspace/dsh-plugins/dsh-adapter');
|
|
181
181
|
const longAp = abbrevPath('/a/very/long/path/that/keeps/going/way/past/the/limit/repo');
|
|
182
182
|
check('abbrevPath middle-ellipsizes while keeping head and tail',
|
|
183
183
|
longAp.startsWith('/a/very') && longAp.endsWith('repo') && longAp.includes('…') && longAp.length <= 44);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// WPC14 endpoint verification: ghost-process liveness probing and the
|
|
2
|
-
// verified kill path (src/proc-kill.mjs + hub routes /_dsh/dsh-
|
|
3
|
-
// and /_dsh/dsh-
|
|
2
|
+
// verified kill path (src/proc-kill.mjs + hub routes /_dsh/dsh-adapter/proc-alive
|
|
3
|
+
// and /_dsh/dsh-adapter/proc-kill).
|
|
4
4
|
//
|
|
5
5
|
// node scripts/verify-wpc14-proc-endpoints.mjs
|
|
6
6
|
//
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from '../src/proc-kill.mjs';
|
|
31
31
|
import { createShardWriter, readMergedStatus } from '../src/status-shard.mjs';
|
|
32
32
|
|
|
33
|
-
const HUB = 'http://127.0.0.1:3080/_dsh/dsh-
|
|
33
|
+
const HUB = 'http://127.0.0.1:3080/_dsh/dsh-adapter';
|
|
34
34
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
35
35
|
const spawned = []; // every child we ever spawn, cleaned up in finally
|
|
36
36
|
let failures = 0;
|
|
@@ -61,10 +61,10 @@ check('parsePid rejects garbage',
|
|
|
61
61
|
&& parsePid(99999999999) === null && parsePid('') === null);
|
|
62
62
|
|
|
63
63
|
const REAL_SHAPES = {
|
|
64
|
-
dsh: 'node /Users/fini/workspace/dsh-plugins/dsh-
|
|
64
|
+
dsh: 'node /Users/fini/workspace/dsh-plugins/dsh-adapter/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-demo/lib/bin.js /Users/fini/workspace/dsh-plugins/dsh-adapter/worker.cordis.yml',
|
|
65
65
|
agy: '/Users/fini/.local/bin/agy --print do the thing --output-format stream-json --dangerously-skip-permissions --mode accept-edits --print-timeout 1800s',
|
|
66
66
|
grok: '/Users/fini/.local/bin/grok -p do the thing --output-format streaming-messages-json --include-partial-messages --permission-mode bypassPermissions',
|
|
67
|
-
shim: '/bin/sh /Users/fini/workspace/dsh-plugins/dsh-
|
|
67
|
+
shim: '/bin/sh /Users/fini/workspace/dsh-plugins/dsh-adapter/node_modules/.bin/dsh-jsonrpc-agent /Users/fini/workspace/dsh-plugins/dsh-adapter/worker.cordis.yml',
|
|
68
68
|
};
|
|
69
69
|
check('isWorkerCommand accepts the real dsh runtime shape (shim exec line)', isWorkerCommand(REAL_SHAPES.dsh));
|
|
70
70
|
check('isWorkerCommand accepts the real agy shape', isWorkerCommand(REAL_SHAPES.agy));
|
|
@@ -245,7 +245,7 @@ console.log('== 4. hub route handlers driven through apply(ctx) with a mock webS
|
|
|
245
245
|
logger: { info: () => {}, warn: () => {} },
|
|
246
246
|
};
|
|
247
247
|
const dispose = await apply(ctx);
|
|
248
|
-
const BASE = '/_dsh/dsh-
|
|
248
|
+
const BASE = '/_dsh/dsh-adapter';
|
|
249
249
|
const route = (name) => handlers.get(BASE + name);
|
|
250
250
|
check('proc-alive + proc-kill routes registered on the mock webServer',
|
|
251
251
|
typeof route('/proc-alive') === 'function' && typeof route('/proc-kill') === 'function');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// check here drives the REAL bundled MCP server (lib/server.mjs) over stdio,
|
|
4
4
|
// with the only stub being the external agy binary itself (a PATH shim that
|
|
5
5
|
// speaks agy's stream-json protocol). No real CLI tokens are spent and no
|
|
6
|
-
// live hub is contacted (
|
|
6
|
+
// live hub is contacted (DSH_ADAPTER_HUB points at a dead port, or at an
|
|
7
7
|
// in-process mock hub for the hub-path tests). scripts/smoke.mjs is
|
|
8
8
|
// deliberately NOT run.
|
|
9
9
|
//
|
|
@@ -83,7 +83,7 @@ function makeClient(child) {
|
|
|
83
83
|
async function startServer(envExtra = {}) {
|
|
84
84
|
const child = spawn(process.execPath, [join(REPO, 'lib', 'server.mjs')], {
|
|
85
85
|
cwd: REPO,
|
|
86
|
-
env: { ...process.env, HOME: FAKE_HOME,
|
|
86
|
+
env: { ...process.env, HOME: FAKE_HOME, DSH_ADAPTER_HUB: DEAD_HUB, PATH: BIN + ':' + process.env.PATH, ...envExtra },
|
|
87
87
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
88
88
|
});
|
|
89
89
|
const client = makeClient(child);
|
|
@@ -141,10 +141,10 @@ check(DEFAULT_ORIGIN_DEPTH_LIMIT === 3, 'A0 depth limit default is 3', 'DEFAULT_
|
|
|
141
141
|
// A4: env round-trip + garbage
|
|
142
142
|
{
|
|
143
143
|
const chain = [{ backend: 'standalone', cwd: dirA, source: 'claude-code' }, { backend: 'agy', cwd: dirB, source: 'codex' }];
|
|
144
|
-
const parsed = readInheritedOrigin({
|
|
144
|
+
const parsed = readInheritedOrigin({ DSH_ADAPTER_ORIGIN_CHAIN: JSON.stringify(chain) });
|
|
145
145
|
check(parsed.depth === 2 && parsed.chain.length === 2 && parsed.chain[1].backend === 'agy',
|
|
146
146
|
'A4 inherited chain parsed from env');
|
|
147
|
-
check(readInheritedOrigin({
|
|
147
|
+
check(readInheritedOrigin({ DSH_ADAPTER_ORIGIN_CHAIN: '{not json' }).depth === 0, 'A4b garbage env ignored');
|
|
148
148
|
check(readInheritedOrigin({}).depth === 0, 'A4c no env = empty chain');
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -202,7 +202,7 @@ sec('Phase B — bundled MCP server end-to-end with fake agy');
|
|
|
202
202
|
{
|
|
203
203
|
const chain = [1, 2, 3].map((i) => ({ backend: i === 3 ? 'agy' : 'standalone', cwd: join(WORK, 'b1hop' + i), source: 'claude-code' }));
|
|
204
204
|
const capture = join(WORK, 'b1-capture');
|
|
205
|
-
const srv = await startServer({
|
|
205
|
+
const srv = await startServer({ DSH_ADAPTER_ORIGIN_CHAIN: JSON.stringify(chain), DSH_ADAPTER_DEPTH: '3', FAKE_AGY_CAPTURE: capture });
|
|
206
206
|
const r = await srv.call('dsh_run_worker', { task: 'say ok', worker: 'agy', cwd: dirB, timeout_seconds: 30 });
|
|
207
207
|
console.log(' B1 tool response: ' + r.text.slice(0, 900));
|
|
208
208
|
check(r.json?.error?.includes('origin guard') === true && r.json?.code === 'origin-depth-exceeded' && r.json?.depth === 4,
|
|
@@ -217,7 +217,7 @@ sec('Phase B — bundled MCP server end-to-end with fake agy');
|
|
|
217
217
|
{
|
|
218
218
|
const capture = join(WORK, 'b2-capture');
|
|
219
219
|
const srv = await startServer({
|
|
220
|
-
|
|
220
|
+
DSH_ADAPTER_ORIGIN_CHAIN: JSON.stringify([{ backend: 'agy', cwd: canonA, source: 'claude-code' }]), DSH_ADAPTER_DEPTH: '1',
|
|
221
221
|
FAKE_AGY_CAPTURE: capture,
|
|
222
222
|
});
|
|
223
223
|
const r = await srv.call('dsh_run_worker', { task: 'say ok', worker: 'agy', cwd: dirA, timeout_seconds: 30 });
|
|
@@ -242,7 +242,7 @@ sec('Phase B — bundled MCP server end-to-end with fake agy');
|
|
|
242
242
|
const capturedChain = existsSync(capture) ? readFileSync(capture, 'utf8') : '(no capture file)';
|
|
243
243
|
const capturedDepth = existsSync(capture + '.depth') ? readFileSync(capture + '.depth', 'utf8') : '(no depth file)';
|
|
244
244
|
check(capturedChain.includes('"agy"') && capturedChain.includes(normalizeCwd(dirB)) && capturedDepth === '1',
|
|
245
|
-
'B3 CLI child inherited the chain via
|
|
245
|
+
'B3 CLI child inherited the chain via DSH_ADAPTER_ORIGIN_CHAIN/DSH_ADAPTER_DEPTH env', 'chain=' + capturedChain + ' depth=' + capturedDepth);
|
|
246
246
|
const cfg = await srv.call('dsh_worker_config', {});
|
|
247
247
|
check(cfg.json?.origin?.depth === 0 && cfg.json?.origin?.depth_limit === 3 && cfg.json?.origin_depth_limit === 3,
|
|
248
248
|
'B3 dsh_worker_config shows inherited origin + default limit');
|
|
@@ -340,9 +340,9 @@ async function startMockHub() {
|
|
|
340
340
|
res.end(s);
|
|
341
341
|
};
|
|
342
342
|
const url = new URL(req.url, 'http://localhost');
|
|
343
|
-
const route = url.pathname.slice('/_dsh/dsh-
|
|
343
|
+
const route = url.pathname.slice('/_dsh/dsh-adapter'.length);
|
|
344
344
|
try {
|
|
345
|
-
if (route === '/ping') return send(200, { ok: true, service: 'dsh-
|
|
345
|
+
if (route === '/ping') return send(200, { ok: true, service: 'dsh-adapter-hub' });
|
|
346
346
|
if (route === '/jobs' && req.method === 'GET') return send(200, { ok: true, jobs: [...state.jobs.values()] });
|
|
347
347
|
if (route === '/jobs' && req.method === 'POST') {
|
|
348
348
|
let body = '';
|
|
@@ -386,7 +386,7 @@ async function startMockHub() {
|
|
|
386
386
|
|
|
387
387
|
{
|
|
388
388
|
const mock = await startMockHub();
|
|
389
|
-
const srv = await startServer({
|
|
389
|
+
const srv = await startServer({ DSH_ADAPTER_HUB: mock.url });
|
|
390
390
|
|
|
391
391
|
const first = await srv.call('dsh_spawn_worker', { task: 'hub task', cwd: dirF });
|
|
392
392
|
const hubId = first.json?.id;
|
package/src/cli-workers.mjs
CHANGED
|
@@ -279,7 +279,7 @@ export async function startCliJob({ worker, task, cwd, timeoutMs = DEFAULT_TIMEO
|
|
|
279
279
|
try {
|
|
280
280
|
child = spawn(profile.cli, args, {
|
|
281
281
|
cwd: workspace,
|
|
282
|
-
// Origin guard: the CLI worker inherits the dispatch chain, so a
|
|
282
|
+
// Origin guard: the CLI worker inherits the dispatch chain, so a adapter
|
|
283
283
|
// instance it starts itself continues the chain (WPC9).
|
|
284
284
|
env: {
|
|
285
285
|
...process.env,
|