@twinsearth/dsh-fang 3.1.32 → 3.1.33
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/package.json +1 -1
- package/src/kernel/types.mjs +1 -1
- package/src/plugins/orchestrator.mjs +52 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twinsearth/dsh-fang",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.33",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "dsh-Fang (瓮城) — mother/fork plugin development environment for DeepSeek Harness: one readonly mother, a disposable child dsh-Web per task.",
|
package/src/kernel/types.mjs
CHANGED
|
@@ -181,31 +181,57 @@ export function stripUrlToken(url) {
|
|
|
181
181
|
|
|
182
182
|
/** Find a runnable dsh launcher. `.cmd` wrappers are spawned through a shell by the forker. */
|
|
183
183
|
export function resolveCliPath(explicit = '', env = process.env, execPath = process.execPath) {
|
|
184
|
+
// v3.1.33:平台感知。v3.1.32 及以前只探测 Windows 的 dsh.cmd + 硬编码盘符,
|
|
185
|
+
// 在 macOS 上必然找不到 launcher → 回落裸 'dsh' → spawn ENOENT → spawn-error。
|
|
186
|
+
// (MacMini 实测:runtime-spawn-failed: spawn-error, profile=essence-runtime)
|
|
187
|
+
const isWindows = process.platform === 'win32'
|
|
188
|
+
// win 用 resources,mac 的 .app 是 Contents/Resources(大写)——按平台给真实大小写优先。
|
|
189
|
+
const binDirNames = isWindows ? ['resources', 'Resources'] : ['Resources', 'resources']
|
|
190
|
+
const binNames = isWindows ? ['dsh.cmd', 'dsh.exe', 'dsh'] : ['dsh', 'dsh.sh']
|
|
184
191
|
const candidates = []
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
if (
|
|
192
|
+
const push = (value) => { if (value) candidates.push(value) }
|
|
193
|
+
|
|
194
|
+
if (explicit) push(explicit)
|
|
195
|
+
if (env.DSH_CLI) push(env.DSH_CLI)
|
|
196
|
+
if (env.DSH_INSTALL_DIR) {
|
|
197
|
+
for (const dir of binDirNames) {
|
|
198
|
+
for (const name of binNames) push(path.join(env.DSH_INSTALL_DIR, dir, 'runtime', 'cli', 'bin', name))
|
|
199
|
+
}
|
|
200
|
+
}
|
|
188
201
|
for (const dir of String(env.PATH ?? env.Path ?? '').split(path.delimiter)) {
|
|
189
202
|
if (!dir) continue
|
|
190
|
-
|
|
203
|
+
for (const name of binNames) push(path.join(dir, name))
|
|
191
204
|
}
|
|
192
|
-
//
|
|
193
|
-
// <install>\DeepSeek Harness.exe
|
|
194
|
-
//
|
|
205
|
+
// 从当前宿主可执行文件反推安装根:
|
|
206
|
+
// win : <install>\DeepSeek Harness.exe → <install>\resources\runtime\cli\bin\dsh.cmd
|
|
207
|
+
// mac : <app>/Contents/MacOS/DeepSeek Harness → <app>/Contents/Resources/runtime/cli/bin/dsh
|
|
195
208
|
try {
|
|
196
209
|
let dir = path.dirname(String(execPath ?? ''))
|
|
197
|
-
for (let i = 0; i <
|
|
198
|
-
|
|
199
|
-
|
|
210
|
+
for (let i = 0; i < 6 && dir; i += 1) {
|
|
211
|
+
for (const sub of binDirNames) {
|
|
212
|
+
for (const name of binNames) {
|
|
213
|
+
push(path.join(dir, sub, 'runtime', 'cli', 'bin', name))
|
|
214
|
+
push(path.join(dir, 'runtime', 'cli', 'bin', name))
|
|
215
|
+
}
|
|
216
|
+
}
|
|
200
217
|
const parent = path.dirname(dir)
|
|
201
218
|
if (parent === dir) break
|
|
202
219
|
dir = parent
|
|
203
220
|
}
|
|
204
221
|
} catch { /* keep legacy candidates */ }
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
'
|
|
208
|
-
|
|
222
|
+
|
|
223
|
+
if (isWindows) {
|
|
224
|
+
push('E:\\DS\\resources\\runtime\\cli\\bin\\dsh.cmd')
|
|
225
|
+
push('C:\\Program Files\\DeepSeek Harness\\resources\\runtime\\cli\\bin\\dsh.cmd')
|
|
226
|
+
} else {
|
|
227
|
+
// macOS / Linux 常见安装位置(含 .app 包内 CLI)
|
|
228
|
+
push('/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh')
|
|
229
|
+
push(path.join(String(env.HOME ?? ''), 'Applications', 'DeepSeek Harness.app', 'Contents', 'Resources', 'runtime', 'cli', 'bin', 'dsh'))
|
|
230
|
+
push('/opt/homebrew/bin/dsh')
|
|
231
|
+
push('/usr/local/bin/dsh')
|
|
232
|
+
push('/usr/bin/dsh')
|
|
233
|
+
}
|
|
234
|
+
|
|
209
235
|
for (const c of candidates) {
|
|
210
236
|
try { if (c && fs.existsSync(c)) return c } catch { /* next */ }
|
|
211
237
|
}
|
|
@@ -2336,7 +2362,18 @@ export function apply(ctx, config) {
|
|
|
2336
2362
|
// 契约 file 桥(contract-outbox);普通分身在 846/1461/1534 行已有同名注入。
|
|
2337
2363
|
env: { DSH_FANG_ROLE: 'fork', DSH_FANG_TASK_ID: forkId, DSH_FANG_ESSENCE: '1', DSH_FANG_MOTHER: layout.dataDir },
|
|
2338
2364
|
})
|
|
2339
|
-
if (!started.ok)
|
|
2365
|
+
if (!started.ok) {
|
|
2366
|
+
// v3.1.33:把真实 errno 与启动规格带进错误信息,避免只剩一个笼统的 spawn-error。
|
|
2367
|
+
const detail = started.message ? ` message=${started.message}` : ''
|
|
2368
|
+
const spec = started.spec ? ` spec=${started.spec.command} ${(started.spec.args ?? []).join(' ')}` : ''
|
|
2369
|
+
const logTail = Array.isArray(started.log) && started.log.length > 0
|
|
2370
|
+
? ` log=${String(started.log.slice(-3).join(' | ')).slice(0, 400)}`
|
|
2371
|
+
: ''
|
|
2372
|
+
throw new Error(
|
|
2373
|
+
`runtime-spawn-failed: ${started.error ?? 'unknown'} (forkId=${forkId}, homeDir=${homeDir}, profile=essence-runtime)`
|
|
2374
|
+
+ detail + spec + logTail,
|
|
2375
|
+
)
|
|
2376
|
+
}
|
|
2340
2377
|
return {
|
|
2341
2378
|
ok: true, essenceId: id, forkId,
|
|
2342
2379
|
url: started.url, port: started.port, pid: started.pid,
|