@twinsearth/dsh-fang 3.1.5 → 3.1.6
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/lib/fork-config-lock.mjs +11 -5
- package/src/plugins/forker.mjs +3 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twinsearth/dsh-fang",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.6",
|
|
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
|
@@ -9,9 +9,8 @@ export const FORK_LOCKED_ENTRY_IDS = Object.freeze([
|
|
|
9
9
|
// 禁用 config-editor / ui-settings 会移除 configForms 服务,导致 locale 及之后
|
|
10
10
|
// 50 个客户端插件永久 pending(实测:web boot 50 entries did not activate)。
|
|
11
11
|
'tool-plugin-manager',
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
'ui-plugin-manager',
|
|
12
|
+
// 只隐藏设置页的插件清单;不能禁用 ui-plugin-manager:它提供 pluginNavigation,
|
|
13
|
+
// 禁掉会让 dsh-client-ui-plugin-recommendations 永久 pending(v3.1.5 实测)。
|
|
15
14
|
'ui-settings-plugin-inventory',
|
|
16
15
|
])
|
|
17
16
|
|
|
@@ -25,7 +24,11 @@ const WELCOME_NOTICE_ENTRY = Object.freeze({
|
|
|
25
24
|
// cordis.yml 不加只读:DSH 启动时会打开它做规范化写入,只读会导致 EPERM 启动失败。
|
|
26
25
|
export const PROFILE_CONFIG_FILES = Object.freeze(['package.json', 'cordis.patch.yml'])
|
|
27
26
|
|
|
28
|
-
/**
|
|
27
|
+
/** v3.1.5 曾错误禁用 ui-plugin-manager(它提供 pluginNavigation);升级时自动移除该历史锁。 */
|
|
28
|
+
export const LEGACY_LOCKED_ENTRY_IDS = Object.freeze(['ui-plugin-manager'])
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 把分身 profile 的配置文件设为只读(防止误写;不防有意绕过)。 */
|
|
29
32
|
export function setProfileConfigReadonly(profileDir, readonly = true) {
|
|
30
33
|
if (String(process.env.DSH_FANG_FORK_PROFILE_RO ?? '1') === '0') return { ok: true, skipped: true, changed: [] }
|
|
31
34
|
// essence-runtime 是元主的配置态实例:DSH 设置/内置插件开关需要原子写 package.json。
|
|
@@ -78,7 +81,10 @@ function withLockRows(entries, ids) {
|
|
|
78
81
|
return { entries: out, added }
|
|
79
82
|
}
|
|
80
83
|
|
|
81
|
-
export function applyForkConfigLock(profileDir, options = {}) {
|
|
84
|
+
export function applyForkConfigLock(profileDir, options = {}) {
|
|
85
|
+
if (String(process.env.DSH_FANG_FORK_CONFIG_LOCK ?? '1') === '0') return { ok: true, skipped: true }
|
|
86
|
+
// 自动修复 v3.1.5 遗留的 ui-plugin-manager disabled:true(会断 pluginNavigation)。
|
|
87
|
+
try { clearForkConfigLock(profileDir, { ids: LEGACY_LOCKED_ENTRY_IDS }) } catch { /* best effort */ }
|
|
82
88
|
const file = path.join(String(profileDir), 'cordis.patch.yml')
|
|
83
89
|
let text = ''
|
|
84
90
|
try { text = fs.readFileSync(file, 'utf8') } catch { text = '' }
|
package/src/plugins/forker.mjs
CHANGED
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
z,
|
|
58
58
|
} from '../kernel/index.mjs'
|
|
59
59
|
import { computeBackoff, planRestart, reconcileOrphans, writeForkMeta, probeHttpAlive, SUPERVISION_DEFAULTS } from '../lib/fork-supervisor.mjs'
|
|
60
|
-
import { applyForkConfigLock,
|
|
60
|
+
import { applyForkConfigLock, setProfileConfigReadonly } from '../lib/fork-config-lock.mjs'
|
|
61
61
|
|
|
62
62
|
export const name = 'fang-forker'
|
|
63
63
|
export const inject = []
|
|
@@ -926,17 +926,8 @@ export function apply(ctx, config) {
|
|
|
926
926
|
rec.configSync = { at: nowMs(), ok: false, error: msgOf(e) }
|
|
927
927
|
}
|
|
928
928
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
// 配置态实例(元宝运行态)必须可写、可管理插件;spawn 不能再次套生产盘锁。
|
|
932
|
-
try { clearForkConfigLock(rec.profileDir) } catch { /* best effort */ }
|
|
933
|
-
try { setProfileConfigReadonly(rec.profileDir, false) } catch { /* ignore */ }
|
|
934
|
-
rec.configLock = { ok: true, skipped: true, runtime: true }
|
|
935
|
-
rec.profileReadonly = { ok: true, skipped: true, runtime: true }
|
|
936
|
-
} else {
|
|
937
|
-
try { rec.configLock = applyForkConfigLock(rec.profileDir) } catch { rec.configLock = { ok: false } }
|
|
938
|
-
try { rec.profileReadonly = setProfileConfigReadonly(rec.profileDir, true) } catch { rec.profileReadonly = { ok: false } }
|
|
939
|
-
}
|
|
929
|
+
try { rec.configLock = applyForkConfigLock(rec.profileDir) } catch { rec.configLock = { ok: false } }
|
|
930
|
+
try { rec.profileReadonly = setProfileConfigReadonly(rec.profileDir, true) } catch { rec.profileReadonly = { ok: false } }
|
|
940
931
|
writeForkMetaOf(rec)
|
|
941
932
|
// 广播新 token:首次派生 = 生成,重启 = 刷新;订阅者拿到的是「当前 token」,
|
|
942
933
|
// 不是「进程就绪」信号(进程就绪以 fang/fork-started 为准)。
|