@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/src/multimodal.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// subscription CLIs (claude -p, codex exec, agy).
|
|
4
4
|
//
|
|
5
5
|
// Vision ladder (WPC11): native DeepSeek VL model deepseek-v4-flash-vision-exp
|
|
6
|
-
// (direct API call, key from DEEPSEEK_API_KEY or ~/.config/dsh-
|
|
6
|
+
// (direct API call, key from DEEPSEEK_API_KEY or ~/.config/dsh-adapter/.env — the
|
|
7
7
|
// same source the standalone dispatch uses) is preferred whenever a key is
|
|
8
8
|
// available; every failure degrades to the pre-existing CLI provider chain,
|
|
9
9
|
// which is kept byte-for-byte as the fallback. Image generation is untouched:
|
|
@@ -20,7 +20,7 @@ import { join, isAbsolute, dirname } from 'node:path';
|
|
|
20
20
|
import { homedir } from 'node:os';
|
|
21
21
|
import { tr, setLang } from './i18n.mjs';
|
|
22
22
|
|
|
23
|
-
const CONFIG_DIR = join(homedir(), '.config', 'dsh-
|
|
23
|
+
const CONFIG_DIR = join(homedir(), '.config', 'dsh-adapter');
|
|
24
24
|
const CACHE_FILE = join(CONFIG_DIR, 'vision-cache.json');
|
|
25
25
|
const CACHE_CAP = 200;
|
|
26
26
|
|
|
@@ -52,7 +52,7 @@ function loadDotEnv() {
|
|
|
52
52
|
return dotEnv;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
/** Key for the native call: env wins, then ~/.config/dsh-
|
|
55
|
+
/** Key for the native call: env wins, then ~/.config/dsh-adapter/.env (same
|
|
56
56
|
* precedence the standalone dispatch applies). */
|
|
57
57
|
function deepseekApiKey() {
|
|
58
58
|
return String(process.env.DEEPSEEK_API_KEY ?? '').trim() || String(loadDotEnv().DEEPSEEK_API_KEY ?? '').trim();
|
|
@@ -250,8 +250,8 @@ async function generateViaApi(entry, prompt, outputPath, size) {
|
|
|
250
250
|
// fail late (or bill for nothing). Image generation is opt-in per provider.
|
|
251
251
|
const m = String(entry.imagegen_model ?? '').trim();
|
|
252
252
|
if (!m) throw new Error(tr(
|
|
253
|
-
`自定义 provider "${entry.name ?? entry.id}" 未配置生图模型(在设置 → DSH
|
|
254
|
-
`Custom provider "${entry.name ?? entry.id}" has no image-gen model (fill in "Image-gen model" under Settings → DSH
|
|
253
|
+
`自定义 provider "${entry.name ?? entry.id}" 未配置生图模型(在设置 → DSH Adapter → 自定义 Provider 的"生图模型"里填写)`,
|
|
254
|
+
`Custom provider "${entry.name ?? entry.id}" has no image-gen model (fill in "Image-gen model" under Settings → DSH Adapter → Custom providers)`));
|
|
255
255
|
const body = { model: m, prompt, n: 1 };
|
|
256
256
|
if (size && /^\d+x\d+$/.test(size)) body.size = size;
|
|
257
257
|
const data = await fetchJson(`${base}/images/generations`, { apiKey: entry.api_key, timeoutMs: 480_000, body });
|
|
@@ -547,8 +547,8 @@ export async function listVisionModels(provider, force = false, getConfig = null
|
|
|
547
547
|
function envelope(tool, text) { return { ok: true, tool, text }; }
|
|
548
548
|
|
|
549
549
|
const VISION_PROVIDER_HINT = tr(
|
|
550
|
-
`未知视觉 provider: PROVIDER(内置: ${BUILTIN_VISION.join(' / ')} / native,或在设置 → DSH
|
|
551
|
-
`Unknown vision provider: PROVIDER (built-in: ${BUILTIN_VISION.join(' / ')} / native, or add one under Settings → DSH
|
|
550
|
+
`未知视觉 provider: PROVIDER(内置: ${BUILTIN_VISION.join(' / ')} / native,或在设置 → DSH Adapter → 自定义 Provider 里添加)`,
|
|
551
|
+
`Unknown vision provider: PROVIDER (built-in: ${BUILTIN_VISION.join(' / ')} / native, or add one under Settings → DSH Adapter → Custom providers)`);
|
|
552
552
|
|
|
553
553
|
/**
|
|
554
554
|
* Cache key for one vision answer. The leading 'v3' version tag plus the
|
|
@@ -592,7 +592,7 @@ async function describeViaCli(provider, model, custom, imagePath, question) {
|
|
|
592
592
|
*/
|
|
593
593
|
export async function describeFileWithProvenance(getConfig, imagePath, question) {
|
|
594
594
|
const config = getConfig();
|
|
595
|
-
const configured = config.vision_provider ?? '
|
|
595
|
+
const configured = config.vision_provider ?? 'codex';
|
|
596
596
|
if (configured === 'off') throw new Error('vision bridge is disabled');
|
|
597
597
|
const model = config.vision_model ?? 'haiku';
|
|
598
598
|
const stat = statSync(imagePath);
|
|
@@ -604,7 +604,7 @@ export async function describeFileWithProvenance(getConfig, imagePath, question)
|
|
|
604
604
|
}
|
|
605
605
|
// For an explicit 'native' id the CLI degradation target is the default
|
|
606
606
|
// chain entry; for built-in CLI providers it is that provider itself.
|
|
607
|
-
const cliProvider = isNativeId ? '
|
|
607
|
+
const cliProvider = isNativeId ? 'codex' : configured;
|
|
608
608
|
const useNativeLadder = BUILTIN_VISION.includes(configured) || isNativeId;
|
|
609
609
|
const cache = readCache();
|
|
610
610
|
|
|
@@ -613,8 +613,8 @@ export async function describeFileWithProvenance(getConfig, imagePath, question)
|
|
|
613
613
|
const apiKey = deepseekApiKey();
|
|
614
614
|
if (!apiKey) {
|
|
615
615
|
nativeIssue = { skipped: true, reason: tr(
|
|
616
|
-
'缺少 DEEPSEEK_API_KEY(环境变量或 ~/.config/dsh-
|
|
617
|
-
'no DEEPSEEK_API_KEY (env or ~/.config/dsh-
|
|
616
|
+
'缺少 DEEPSEEK_API_KEY(环境变量或 ~/.config/dsh-adapter/.env)',
|
|
617
|
+
'no DEEPSEEK_API_KEY (env or ~/.config/dsh-adapter/.env)') };
|
|
618
618
|
} else {
|
|
619
619
|
const key = visionCacheKey({ backend: 'native', provider: 'deepseek', model: NATIVE_VISION_MODEL, imagePath, stat, question, baseUrl: deepseekBaseUrl() });
|
|
620
620
|
if (cache[key]) {
|
|
@@ -626,11 +626,11 @@ export async function describeFileWithProvenance(getConfig, imagePath, question)
|
|
|
626
626
|
if (text === '') throw new Error('native returned an empty answer');
|
|
627
627
|
cache[key] = text;
|
|
628
628
|
writeCache(cache);
|
|
629
|
-
console.warn(`dsh-
|
|
629
|
+
console.warn(`dsh-adapter: vision answered by native ${NATIVE_VISION_MODEL} in ${Date.now() - started}ms`);
|
|
630
630
|
return { text, provider: `native · ${NATIVE_VISION_MODEL}`, model: NATIVE_VISION_MODEL, cached: false };
|
|
631
631
|
} catch (err) {
|
|
632
632
|
nativeIssue = { skipped: false, reason: String(err?.message ?? err) };
|
|
633
|
-
console.warn(`dsh-
|
|
633
|
+
console.warn(`dsh-adapter: native vision failed, falling back to "${cliProvider}": ${nativeIssue.reason}`);
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
}
|
|
@@ -679,8 +679,8 @@ export function createMultimodalTools(getConfig) {
|
|
|
679
679
|
},
|
|
680
680
|
async execute(args) {
|
|
681
681
|
const config = getConfig();
|
|
682
|
-
const provider = config.vision_provider ?? '
|
|
683
|
-
if (provider === 'off') throw new Error(tr('视觉桥已关闭(设置 → DSH
|
|
682
|
+
const provider = config.vision_provider ?? 'codex';
|
|
683
|
+
if (provider === 'off') throw new Error(tr('视觉桥已关闭(设置 → DSH Adapter → 视觉 provider)', 'the vision bridge is disabled (Settings → DSH Adapter → Vision provider)'));
|
|
684
684
|
const imagePath = String(args.image_path ?? '');
|
|
685
685
|
if (!isAbsolute(imagePath) || !existsSync(imagePath)) throw new Error(`image_path must be an existing absolute path, got: ${imagePath}`);
|
|
686
686
|
const question = typeof args.question === 'string' && args.question !== ''
|
|
@@ -715,7 +715,7 @@ export function createMultimodalTools(getConfig) {
|
|
|
715
715
|
async execute(args) {
|
|
716
716
|
const config = getConfig();
|
|
717
717
|
const provider = args.provider ?? config.imagegen_provider ?? 'codex';
|
|
718
|
-
if (provider === 'off') throw new Error(tr('生图已关闭(设置 → DSH
|
|
718
|
+
if (provider === 'off') throw new Error(tr('生图已关闭(设置 → DSH Adapter → 生图 provider)', 'image generation is disabled (Settings → DSH Adapter → Image-gen provider)'));
|
|
719
719
|
const outputPath = String(args.output_path ?? '');
|
|
720
720
|
if (!isAbsolute(outputPath)) throw new Error(`output_path must be absolute, got: ${outputPath}`);
|
|
721
721
|
const prompt = String(args.prompt ?? '').trim();
|
|
@@ -723,8 +723,8 @@ export function createMultimodalTools(getConfig) {
|
|
|
723
723
|
const custom = BUILTIN_IMAGEGEN.includes(provider) ? null : findCustomProvider(config, provider);
|
|
724
724
|
if (!BUILTIN_IMAGEGEN.includes(provider) && !custom) {
|
|
725
725
|
throw new Error(tr(
|
|
726
|
-
`未知生图 provider: ${provider}(内置: ${BUILTIN_IMAGEGEN.join(' / ')},或在设置 → DSH
|
|
727
|
-
`Unknown image-gen provider: ${provider} (built-in: ${BUILTIN_IMAGEGEN.join(' / ')}, or add one under Settings → DSH
|
|
726
|
+
`未知生图 provider: ${provider}(内置: ${BUILTIN_IMAGEGEN.join(' / ')},或在设置 → DSH Adapter → 自定义 Provider 里添加)`,
|
|
727
|
+
`Unknown image-gen provider: ${provider} (built-in: ${BUILTIN_IMAGEGEN.join(' / ')}, or add one under Settings → DSH Adapter → Custom providers)`));
|
|
728
728
|
}
|
|
729
729
|
const saved = custom
|
|
730
730
|
? (entryType(custom) === 'cli'
|
package/src/origin-guard.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Origin-chain guard against recursive worker self-amplification (WPC9 guardrail 1).
|
|
2
2
|
//
|
|
3
3
|
// Every dispatch carries an origin chain: the ordered list of (backend, cwd)
|
|
4
|
-
// hops the task has already travelled. A
|
|
5
|
-
// someone else's worker — CC dispatches to codex, codex (
|
|
4
|
+
// hops the task has already travelled. A adapter-enabled host can itself be
|
|
5
|
+
// someone else's worker — CC dispatches to codex, codex (adapter installed)
|
|
6
6
|
// dispatches back — and without a guard the host×backend matrix lets one
|
|
7
7
|
// worker spawn another forever: quota burns through in minutes while every
|
|
8
8
|
// single vantage point along the chain looks innocent.
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
// source: orchestrator id of the dispatching host ('claude-code', 'codex', ...) }
|
|
14
14
|
//
|
|
15
15
|
// Cross-process transport:
|
|
16
|
-
// - This MCP server reads
|
|
17
|
-
// startup and inherits it as INHERITED_ORIGIN;
|
|
16
|
+
// - This MCP server reads DSH_ADAPTER_ORIGIN_CHAIN (JSON array of hops) at
|
|
17
|
+
// startup and inherits it as INHERITED_ORIGIN; adapter instances spawned
|
|
18
18
|
// down-chain do the same, so the chain survives process boundaries.
|
|
19
19
|
// - Every dispatch appends its own hop and passes the extended chain to the
|
|
20
|
-
// worker: env vars
|
|
20
|
+
// worker: env vars DSH_ADAPTER_ORIGIN_CHAIN / DSH_ADAPTER_DEPTH for CLI and
|
|
21
21
|
// standalone children (jobs.mjs / cli-workers.mjs spawn env), and
|
|
22
22
|
// origin_chain / origin_depth spec fields for hub spawns (hub-client is
|
|
23
23
|
// unchanged; the current hub ignores unknown spec fields and this
|
|
24
24
|
// client-side session re-attaches them to every hub view it returns).
|
|
25
|
-
// -
|
|
25
|
+
// - DSH_ADAPTER_DEPTH is written alongside as an integer for observability but
|
|
26
26
|
// is never trusted on read: the chain is authoritative and depth is
|
|
27
27
|
// derived from its length (env can be hostile).
|
|
28
28
|
//
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
|
|
34
34
|
import { normalizeCwd } from './cwd-lock.mjs';
|
|
35
35
|
|
|
36
|
-
export const ORIGIN_CHAIN_ENV = '
|
|
37
|
-
export const ORIGIN_DEPTH_ENV = '
|
|
36
|
+
export const ORIGIN_CHAIN_ENV = 'DSH_ADAPTER_ORIGIN_CHAIN';
|
|
37
|
+
export const ORIGIN_DEPTH_ENV = 'DSH_ADAPTER_DEPTH';
|
|
38
38
|
|
|
39
39
|
// Why 3: depth = number of dispatch hops. 1 is a direct worker, 2 a worker
|
|
40
40
|
// delegating once, 3 one more legitimate re-delegation — real fan-out graphs
|
package/src/plugin-env.mjs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
export const PLUGIN_ENV_PREFIX = 'DSHPLUGIN_';
|
|
18
18
|
export const LEGACY_ENV_PREFIX = 'DSH_';
|
|
19
19
|
|
|
20
|
-
const PLUGIN_LABEL = 'dsh-
|
|
20
|
+
const PLUGIN_LABEL = 'dsh-adapter';
|
|
21
21
|
|
|
22
22
|
/** One warning per legacy variable per process, not one per lookup. */
|
|
23
23
|
const warned = new Set();
|
|
@@ -38,7 +38,7 @@ export function legacyEnvName(suffix) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* Read one plugin variable by its suffix (e.g. '
|
|
41
|
+
* Read one plugin variable by its suffix (e.g. 'ADAPTER_HUB').
|
|
42
42
|
*
|
|
43
43
|
* Resolution is by PRESENCE, not truthiness: a new variable set to the empty
|
|
44
44
|
* string is a deliberate "no override" and must not silently resurrect a stale
|
package/src/proc-kill.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// OS process a job ran in. Standalone runtimes and agy/grok CLI workers are
|
|
5
5
|
// independent processes: when their dispatching host dies, the process can
|
|
6
6
|
// survive as a true orphan. This module backs the hub endpoints
|
|
7
|
-
// (/_dsh/dsh-
|
|
7
|
+
// (/_dsh/dsh-adapter/proc-alive and /_dsh/dsh-adapter/proc-kill):
|
|
8
8
|
//
|
|
9
9
|
// 1. Is pid alive? process.kill(pid, 0) - the same probe the status shard
|
|
10
10
|
// uses for writer liveness (status-shard.mjs writerProcessAlive).
|
|
@@ -114,13 +114,13 @@ export function isWorkerCommand(command) {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
const NOT_A_WORKER_ZH = (pid, command) =>
|
|
117
|
-
'拒绝杀死 pid ' + pid + ':其命令行不匹配任何 dsh-
|
|
117
|
+
'拒绝杀死 pid ' + pid + ':其命令行不匹配任何 dsh-adapter 工作进程特征(该 pid 可能已被系统回收复用)。\n' +
|
|
118
118
|
'命令行:' + command + '\n' +
|
|
119
119
|
'可杀特征:standalone DSH 运行时(…dsh-sdk-jsonrpc-demo… worker.cordis.yml)、' +
|
|
120
120
|
'agy(…--output-format stream-json…)、grok(…streaming-messages-json…)。';
|
|
121
121
|
|
|
122
122
|
const NOT_A_WORKER_EN = (pid, command) =>
|
|
123
|
-
'Refusing to kill pid ' + pid + ': its command line matches no process shape dsh-
|
|
123
|
+
'Refusing to kill pid ' + pid + ': its command line matches no process shape dsh-adapter spawns (the pid may have been recycled).\n' +
|
|
124
124
|
'command: ' + command + '\n' +
|
|
125
125
|
'Accepted shapes: standalone DSH runtime (…dsh-sdk-jsonrpc-demo… worker.cordis.yml), ' +
|
|
126
126
|
'agy (…--output-format stream-json…), grok (…streaming-messages-json…).';
|
|
@@ -143,8 +143,8 @@ export async function killWorkerProcess({ pid, pgid, graceMs = PROC_KILL_GRACE_M
|
|
|
143
143
|
if (groupKill && (parsePid(pgid) === null || pgid !== pid)) {
|
|
144
144
|
throw new ProcKillRefused(
|
|
145
145
|
'pgid-mismatch',
|
|
146
|
-
'pgid ' + pgid + ' 与 pid ' + pid + ' 不一致 — 拒绝整组杀死(dsh-
|
|
147
|
-
'pgid ' + pgid + ' does not match pid ' + pid + ' — refusing the group kill (dsh-
|
|
146
|
+
'pgid ' + pgid + ' 与 pid ' + pid + ' 不一致 — 拒绝整组杀死(dsh-adapter 只会记录 pgid === pid 的进程组)',
|
|
147
|
+
'pgid ' + pgid + ' does not match pid ' + pid + ' — refusing the group kill (dsh-adapter only ever records pgid === pid)',
|
|
148
148
|
{ pid, pgid },
|
|
149
149
|
);
|
|
150
150
|
}
|
package/src/provider-probe.mjs
CHANGED
|
@@ -9,12 +9,12 @@ export async function probeProvider(llm, binding, { timeoutMs = 20000 } = {}) {
|
|
|
9
9
|
const collect = async () => {
|
|
10
10
|
let finish, matched = false;
|
|
11
11
|
for await (const chunk of llm.stream({ ...binding, maxTokens: 256, signal: controller.signal,
|
|
12
|
-
messages: [{ role: 'user', content: [{ type: 'text', text: `Call
|
|
13
|
-
tools: [{ name: '
|
|
12
|
+
messages: [{ role: 'user', content: [{ type: 'text', text: `Call dsh_adapter_probe_noop exactly once with nonce ${nonce}. This tool has no side effects. Do not answer with prose.` }] }],
|
|
13
|
+
tools: [{ name: 'dsh_adapter_probe_noop', description: 'A capability check with no filesystem or network effects.', parameters: {
|
|
14
14
|
type: 'object', properties: { nonce: { type: 'string' } }, required: ['nonce'], additionalProperties: false,
|
|
15
15
|
} }],
|
|
16
16
|
})) {
|
|
17
|
-
if (chunk.type === 'block-end' && chunk.block?.type === 'tool-call' && chunk.block.name === '
|
|
17
|
+
if (chunk.type === 'block-end' && chunk.block?.type === 'tool-call' && chunk.block.name === 'dsh_adapter_probe_noop') {
|
|
18
18
|
try { const args = JSON.parse(chunk.block.arguments); if (args?.nonce === nonce && Object.keys(args).length === 1) matched = true; } catch {}
|
|
19
19
|
}
|
|
20
20
|
if (chunk.type === 'finish') finish = chunk.reason?.kind;
|
package/src/server.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { acquireCwdLock, releaseCwdLockByJobId, updateCwdLockHolder, getCwdLocks
|
|
|
12
12
|
import { resolveWorkerCwd } from './paths.mjs';
|
|
13
13
|
import { detectOrchestrator } from './process-info.mjs';
|
|
14
14
|
|
|
15
|
-
const server = new McpServer({ name: 'dsh-
|
|
15
|
+
const server = new McpServer({ name: 'dsh-adapter', version: '0.1.2' });
|
|
16
16
|
|
|
17
17
|
const tierSchema = z.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.');
|
|
18
18
|
const effortSchema = z.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).');
|
|
@@ -21,7 +21,7 @@ const allowConcurrentCwdSchema = z.boolean().optional().describe('Allow this dis
|
|
|
21
21
|
|
|
22
22
|
// Session-level configuration. This MCP server process lives exactly as long
|
|
23
23
|
// as one Claude Code / Codex session, so plain memory IS session scope.
|
|
24
|
-
// Initial values come from the global config (~/.config/dsh-
|
|
24
|
+
// Initial values come from the global config (~/.config/dsh-adapter/config.json,
|
|
25
25
|
// edited on the DSH settings page); dsh_worker_config overrides per session.
|
|
26
26
|
import { readGlobalConfig } from './install/install.mjs';
|
|
27
27
|
import { describeBindings, resolveTierBinding } from './tier-binding.mjs';
|
|
@@ -73,8 +73,8 @@ const ORCHESTRATOR = detectOrchestrator();
|
|
|
73
73
|
|
|
74
74
|
// ---------- WPC9 guardrails ----------
|
|
75
75
|
|
|
76
|
-
// Origin chain this
|
|
77
|
-
// startup from the env written by the dispatching
|
|
76
|
+
// Origin chain this adapter instance inherited from whoever spawned it (read at
|
|
77
|
+
// startup from the env written by the dispatching adapter — origin-guard.mjs).
|
|
78
78
|
// Every dispatch appends its own hop and refuses loops / over-deep chains
|
|
79
79
|
// BEFORE anything is spawned, so recursion can never start burning quota.
|
|
80
80
|
const INHERITED_ORIGIN = readInheritedOrigin(process.env);
|
package/src/status-shard.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Sharded worker-status publishing: every writer (hub process, per-session
|
|
2
|
-
// standalone MCP server) owns one file under ~/.config/dsh-
|
|
2
|
+
// standalone MCP server) owns one file under ~/.config/dsh-adapter/status.d/
|
|
3
3
|
// and readers merge all fresh shards. Kills the last-writer-wins race that a
|
|
4
4
|
// single shared status.json had with multiple concurrent writers.
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ import { writeFileSync, mkdirSync, rmSync, readdirSync, readFileSync } from 'nod
|
|
|
7
7
|
import { join } from 'node:path';
|
|
8
8
|
import { homedir } from 'node:os';
|
|
9
9
|
|
|
10
|
-
const CONFIG_DIR = join(homedir(), '.config', 'dsh-
|
|
10
|
+
const CONFIG_DIR = join(homedir(), '.config', 'dsh-adapter');
|
|
11
11
|
const SHARD_DIR = join(CONFIG_DIR, 'status.d');
|
|
12
12
|
export const SHARD_FRESH_MS = 30 * 60 * 1000;
|
|
13
13
|
|
package/src/vision-route.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { tr } from './i18n.mjs';
|
|
|
22
22
|
|
|
23
23
|
const VISION_PROVIDER = 'deepseek-vision';
|
|
24
24
|
const DELEGATE = 'deepseek-official';
|
|
25
|
-
const ATTACH_DIR = join(homedir(), '.config', 'dsh-
|
|
25
|
+
const ATTACH_DIR = join(homedir(), '.config', 'dsh-adapter', 'attachments');
|
|
26
26
|
|
|
27
27
|
const EXT = { 'image/png': 'png', 'image/jpeg': 'jpg', 'image/webp': 'webp', 'image/gif': 'gif' };
|
|
28
28
|
|
|
@@ -112,7 +112,7 @@ export function installVisionRoute(ctx, getConfig) {
|
|
|
112
112
|
const { text: desc, provider } = await describeFileWithProvenance(getConfig, path, tr(
|
|
113
113
|
'详细描述这张图片:整体内容、布局结构、可见文字(逐字)、颜色与显著元素。',
|
|
114
114
|
'Describe this image in detail: overall content, layout, any visible text (verbatim), colours and notable elements.'));
|
|
115
|
-
ctx.logger?.info?.(`dsh-
|
|
115
|
+
ctx.logger?.info?.(`dsh-adapter: vision transcript for ${path} via ${provider}`);
|
|
116
116
|
content.push({
|
|
117
117
|
type: 'text',
|
|
118
118
|
text: `${TRANSCRIPT_PREFIX(name)}\n${desc}\n${tr(
|
|
@@ -134,6 +134,6 @@ export function installVisionRoute(ctx, getConfig) {
|
|
|
134
134
|
return changed ? { kind: 'enter', messages: rewritten } : decision;
|
|
135
135
|
}));
|
|
136
136
|
|
|
137
|
-
ctx.logger?.info?.('dsh-
|
|
137
|
+
ctx.logger?.info?.('dsh-adapter: vision route registered (provider "deepseek-vision" + pre-step transcription)');
|
|
138
138
|
return () => { for (const d of disposers.reverse()) { try { d(); } catch {} } };
|
|
139
139
|
}
|
package/statusline/statusline.sh
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# dsh-
|
|
2
|
+
# dsh-adapter statusline: prepends the live worker-pool segment (merged from
|
|
3
3
|
# all status shards) to a basic statusline. For claude-hud users prefer
|
|
4
4
|
# wiring worker-segment.sh via --extra-cmd instead (cli.mjs hud does this).
|
|
5
5
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# Compact DSH worker segment for claude-hud --extra-cmd (or any statusline).
|
|
3
|
-
# Merges all fresh status shards (~/.config/dsh-
|
|
3
|
+
# Merges all fresh status shards (~/.config/dsh-adapter/status.d/*.json plus
|
|
4
4
|
# the legacy status.json during transition) so workers dispatched by ANY
|
|
5
5
|
# orchestrator on this machine are visible. Running jobs show tier, elapsed,
|
|
6
6
|
# and tokens; idle with history shows "⚙dsh ✓N"; no jobs prints nothing.
|
|
7
|
-
# Override the shard dir with $
|
|
7
|
+
# Override the shard dir with $DSH_ADAPTER_STATUS_DIR (mainly for tests).
|
|
8
8
|
|
|
9
|
-
dir="${
|
|
9
|
+
dir="${DSH_ADAPTER_STATUS_DIR:-$HOME/.config/dsh-adapter}"
|
|
10
10
|
files=()
|
|
11
11
|
for f in "$dir"/status.d/*.json "$dir"/status.json; do
|
|
12
12
|
[ -f "$f" ] && files+=("$f")
|
package/worker.cordis.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# dsh-
|
|
1
|
+
# dsh-adapter: unattended coding-worker composition for dsh-jsonrpc-agent.
|
|
2
2
|
# stdout is reserved for JSON-RPC frames; never add a console logger here.
|
|
3
3
|
# Model/provider arrive per process via the SDK initialize handshake.
|
|
4
4
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|