@twinsearth/dsh-fang 3.3.1 → 3.7.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/README.md +3 -3
- package/client.js +709 -61
- package/cordis.patch.yml +26 -20
- package/docs/APPROVAL-DRILL.md +42 -0
- package/docs/AUTO-WATCHDOG.md +46 -0
- package/docs/DECISION-LOSSLESS.md +36 -0
- package/docs/ESSENCE-AUTO-SYNC.md +32 -0
- package/docs/INBOX-SCROLL.md +33 -0
- package/docs/OVERLAY-MASTER-SWITCH.md +35 -0
- package/docs/PACKAGE-RENAME-v3.3.3.md +40 -0
- package/docs/RESTART-CONFIRMATION.md +29 -0
- package/docs/TEST-STABILITY-v3.4.0.md +30 -0
- package/package.json +9 -5
- package/src/compose.mjs +4 -1
- package/src/contract/VENDOR.json +6 -5
- package/src/contract/constants.js +16 -1
- package/src/contract/relay.js +12 -6
- package/src/kernel/types.mjs +3 -1
- package/src/lib/accelerated-fork.mjs +813 -0
- package/src/lib/accelerated-install.mjs +295 -0
- package/src/lib/accelerated-web.mjs +103 -0
- package/src/lib/approval-drill.mjs +111 -0
- package/src/lib/boot-guard.mjs +6 -2
- package/src/lib/chat-import-delegation.mjs +47 -0
- package/src/lib/compat.mjs +5 -1
- package/src/lib/contract-delegation.mjs +161 -0
- package/src/lib/default-essence.mjs +7 -4
- package/src/lib/essence.mjs +113 -7
- package/src/lib/fork-config-lock.mjs +2 -2
- package/src/lib/fork-core-settings.mjs +95 -0
- package/src/lib/fork-export.mjs +85 -0
- package/src/lib/global-redline.mjs +164 -0
- package/src/lib/http-auth.mjs +36 -0
- package/src/lib/install-snapshot.mjs +77 -0
- package/src/lib/lsp-delegation.mjs +70 -0
- package/src/lib/lsp-provider.mjs +250 -0
- package/src/lib/main-gate.mjs +34 -28
- package/src/lib/mirror.mjs +115 -4
- package/src/lib/node-compat.mjs +24 -0
- package/src/lib/pro-delegation.mjs +185 -0
- package/src/lib/runtime-capture.mjs +11 -3
- package/src/lib/watch-guard.mjs +51 -0
- package/src/plugins/approver.mjs +5 -2
- package/src/plugins/auditor.mjs +125 -18
- package/src/plugins/decision-center.mjs +77 -34
- package/src/plugins/forker.mjs +258 -33
- package/src/plugins/orchestrator.mjs +1508 -65
- package/src/plugins/restart-guard.mjs +79 -2
- package/src/plugins/session-catalog.mjs +127 -40
- package/tools/approval-drill.mjs +21 -0
- package/tools/fangctl.mjs +21 -4
- package/tools/gate/main-city.mjs +1 -1
- package/tools/restart-supervisor.mjs +425 -0
- package/tools/restart-watchdog.mjs +568 -0
- package/vault/client.js +49 -0
- package/vault/cordis.patch.yml +3 -0
- package/vault/lib/vault.mjs +219 -0
- package/vault/package.json +29 -0
package/cordis.patch.yml
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
# order: auditor/forker/buffer feed the middle tier, orchestrator comes last.
|
|
6
6
|
- insert:
|
|
7
7
|
- id: fang-auditor
|
|
8
|
-
name: '@twinsearth/dsh-
|
|
8
|
+
name: '@twinsearth/fang-dsh-plugin/auditor'
|
|
9
9
|
config:
|
|
10
10
|
dataRoot: ''
|
|
11
11
|
bootSelfCheck: true
|
|
12
12
|
|
|
13
13
|
- id: fang-forker
|
|
14
|
-
name: '@twinsearth/dsh-
|
|
14
|
+
name: '@twinsearth/fang-dsh-plugin/forker'
|
|
15
15
|
config:
|
|
16
16
|
cliPath: ''
|
|
17
17
|
profileTemplate: ''
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
healthPath: /
|
|
26
26
|
|
|
27
27
|
- id: fang-buffer-keeper
|
|
28
|
-
name: '@twinsearth/dsh-
|
|
28
|
+
name: '@twinsearth/fang-dsh-plugin/buffer-keeper'
|
|
29
29
|
config:
|
|
30
30
|
root: ''
|
|
31
31
|
settleMs: 750
|
|
32
32
|
pollMs: 250
|
|
33
33
|
|
|
34
34
|
- id: fang-scorer
|
|
35
|
-
name: '@twinsearth/dsh-
|
|
35
|
+
name: '@twinsearth/fang-dsh-plugin/scorer'
|
|
36
36
|
config:
|
|
37
37
|
allowlist: []
|
|
38
38
|
|
|
39
39
|
- id: fang-umbrella
|
|
40
|
-
name: '@twinsearth/dsh-
|
|
40
|
+
name: '@twinsearth/fang-dsh-plugin/umbrella'
|
|
41
41
|
config:
|
|
42
42
|
bufferRoot: ''
|
|
43
43
|
productionRoot: ''
|
|
@@ -52,19 +52,19 @@
|
|
|
52
52
|
auditDecisions: true
|
|
53
53
|
|
|
54
54
|
- id: fang-healer
|
|
55
|
-
name: '@twinsearth/dsh-
|
|
55
|
+
name: '@twinsearth/fang-dsh-plugin/healer'
|
|
56
56
|
config:
|
|
57
57
|
blockingOnUnknown: true
|
|
58
58
|
reservedIds: []
|
|
59
59
|
|
|
60
60
|
- id: fang-router
|
|
61
|
-
name: '@twinsearth/dsh-
|
|
61
|
+
name: '@twinsearth/fang-dsh-plugin/router'
|
|
62
62
|
config:
|
|
63
63
|
containerAvailable: false
|
|
64
64
|
trustedPlugins: []
|
|
65
65
|
|
|
66
66
|
- id: fang-approver
|
|
67
|
-
name: '@twinsearth/dsh-
|
|
67
|
+
name: '@twinsearth/fang-dsh-plugin/approver'
|
|
68
68
|
config:
|
|
69
69
|
defaultTtlMs: 300000
|
|
70
70
|
remindAt: 0.5
|
|
@@ -73,23 +73,24 @@
|
|
|
73
73
|
backupRoot: ''
|
|
74
74
|
|
|
75
75
|
- id: fang-hot-reloader
|
|
76
|
-
name: '@twinsearth/dsh-
|
|
76
|
+
name: '@twinsearth/fang-dsh-plugin/hot-reloader'
|
|
77
77
|
config:
|
|
78
78
|
healthWindowMs: 300
|
|
79
79
|
healthMaxNewHandles: 2
|
|
80
80
|
requireApprovalForSwap: true
|
|
81
81
|
|
|
82
82
|
- id: fang-restart-guard
|
|
83
|
-
name: '@twinsearth/dsh-
|
|
83
|
+
name: '@twinsearth/fang-dsh-plugin/restart-guard'
|
|
84
84
|
config:
|
|
85
|
-
mode:
|
|
85
|
+
mode: enforce
|
|
86
86
|
authMode: manual
|
|
87
87
|
strictRedLine: true
|
|
88
|
-
allowProcessRestart:
|
|
88
|
+
allowProcessRestart: true
|
|
89
|
+
autoWatchdog: true
|
|
89
90
|
autoPromoteAfterHours: 24
|
|
90
91
|
|
|
91
92
|
- id: fang-adapter
|
|
92
|
-
name: '@twinsearth/dsh-
|
|
93
|
+
name: '@twinsearth/fang-dsh-plugin/adapter'
|
|
93
94
|
config:
|
|
94
95
|
prefix: /fang
|
|
95
96
|
taskId: ''
|
|
@@ -97,35 +98,35 @@
|
|
|
97
98
|
commandTimeoutMs: 10000
|
|
98
99
|
|
|
99
100
|
- id: fang-session-catalog
|
|
100
|
-
name: '@twinsearth/dsh-
|
|
101
|
+
name: '@twinsearth/fang-dsh-plugin/session-catalog'
|
|
101
102
|
config:
|
|
102
103
|
limit: 50
|
|
103
|
-
allowArchived:
|
|
104
|
+
allowArchived: true
|
|
104
105
|
previewMaxChars: 2000
|
|
105
106
|
|
|
106
107
|
- id: fang-session-bridge
|
|
107
|
-
name: '@twinsearth/dsh-
|
|
108
|
+
name: '@twinsearth/fang-dsh-plugin/session-bridge'
|
|
108
109
|
config:
|
|
109
110
|
dshHome: ""
|
|
110
111
|
prefix: /fang
|
|
111
112
|
timeoutMs: 15000
|
|
112
113
|
|
|
113
114
|
- id: fang-session-sync
|
|
114
|
-
name: '@twinsearth/dsh-
|
|
115
|
+
name: '@twinsearth/fang-dsh-plugin/session-sync'
|
|
115
116
|
config:
|
|
116
117
|
sessionsRoot: ""
|
|
117
118
|
bundleRoot: ""
|
|
118
119
|
maxBundleBytes: 536870912
|
|
119
120
|
|
|
120
121
|
- id: fang-session-router
|
|
121
|
-
name: '@twinsearth/dsh-
|
|
122
|
+
name: '@twinsearth/fang-dsh-plugin/session-router'
|
|
122
123
|
config:
|
|
123
124
|
sameMachine: true
|
|
124
125
|
bridgeEnabled: true
|
|
125
126
|
needsRealtime: false
|
|
126
127
|
|
|
127
128
|
- id: fang-decision-center
|
|
128
|
-
name: '@twinsearth/dsh-
|
|
129
|
+
name: '@twinsearth/fang-dsh-plugin/decision-center'
|
|
129
130
|
config:
|
|
130
131
|
maxTickets: 500
|
|
131
132
|
maxPendingRed: 30
|
|
@@ -134,7 +135,7 @@
|
|
|
134
135
|
registerTool: true
|
|
135
136
|
|
|
136
137
|
- id: fang-orchestrator
|
|
137
|
-
name: '@twinsearth/dsh-
|
|
138
|
+
name: '@twinsearth/fang-dsh-plugin'
|
|
138
139
|
config:
|
|
139
140
|
role: mother
|
|
140
141
|
maxForks: 8
|
|
@@ -154,5 +155,10 @@
|
|
|
154
155
|
- id: fang-web-entry
|
|
155
156
|
name: '@twinsearth/dsh-fang-web-entry'
|
|
156
157
|
|
|
158
|
+
# v3.3.3: default OFF. Draft/queue recovery is optional; the host half
|
|
159
|
+
# provides fangQueueJournal only when this row is enabled, and without it
|
|
160
|
+
# the orchestrator returns 503 queue-journal-disabled for journal/queue
|
|
161
|
+
# routes. The client half is not loaded, so its composer UI stays hidden.
|
|
157
162
|
- id: fang-queue-journal
|
|
158
163
|
name: '@twinsearth/dsh-fang-queue-journal'
|
|
164
|
+
disabled: true
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# 审批 / 提升 / 回滚 drill
|
|
2
|
+
|
|
3
|
+
生效版本:`v3.3.5`
|
|
4
|
+
|
|
5
|
+
## 目的
|
|
6
|
+
|
|
7
|
+
证明 Approver 不只是“已加载”,而是能真实执行:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
requestPromotion(red) → pending → decide(approved) → snapshot → 修改文件 → rollback
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 两种执行方式
|
|
14
|
+
|
|
15
|
+
### 1. 本机隔离 drill(不碰生产)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
node tools/approval-drill.mjs
|
|
19
|
+
node tools/approval-drill.mjs --json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- 使用临时 `dataRoot`;不写生产 fang 数据目录;
|
|
23
|
+
- 真实创建红票、真实 `decide`、真实 A 代快照与 digest 校验回滚;
|
|
24
|
+
- 结束清理临时目录,`residue=clean`。
|
|
25
|
+
|
|
26
|
+
### 2. 运行宿主上的隔离 drill(需 v3.3.5)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
node tools/fangctl.mjs approvals drill --url http://127.0.0.1:<port>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
调用 `POST /fang/api/approvals/drill`;同样在临时 `dataRoot` 执行,不影响生产审批队列。
|
|
33
|
+
|
|
34
|
+
## /approvals 修复
|
|
35
|
+
|
|
36
|
+
- 只聚合 `status=ready|running` 的分身;
|
|
37
|
+
- 失败/停止/回收的分身归入 `skipped`,不再把整个收件箱标成 degraded;
|
|
38
|
+
- 真正活跃分身 adapter 失败才记 `failed`。
|
|
39
|
+
|
|
40
|
+
## 边界
|
|
41
|
+
|
|
42
|
+
drill 证明的是 Approver 的审批/快照/回滚链路;生产“提升插件”仍需真实合法分身插件并走 Scorer/Router。drill 不会写入 `promoted/`,也不会改 profile。
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 自动看护(auto-watchdog)
|
|
2
|
+
|
|
3
|
+
生效版本:`v3.3.7`
|
|
4
|
+
|
|
5
|
+
## 目标
|
|
6
|
+
|
|
7
|
+
用户两次确认重启后,若没有外部 supervisor,RestartGuard 自动启动一个独立 watchdog,
|
|
8
|
+
由 watchdog 在宿主退出后按原命令拉起新宿主。**不是**无确认直接 exit。
|
|
9
|
+
|
|
10
|
+
## 链路
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
二次确认请求
|
|
14
|
+
→ Approver 红色审批
|
|
15
|
+
→ restart-guard 发现 supervisorPresent=false
|
|
16
|
+
→ 启动 tools/restart-watchdog.mjs --execute
|
|
17
|
+
→ watchdog 写 <dataDir>/restart/supervisor.present
|
|
18
|
+
→ guard 重新计算 executionArmed
|
|
19
|
+
→ 写授权清单 → exit(75)
|
|
20
|
+
→ watchdog 校验清单/pid/回执 → 用原命令 relaunch
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 必要条件
|
|
24
|
+
|
|
25
|
+
- bundle:`mode: enforce`、`allowProcessRestart: true`、`autoWatchdog: true`;
|
|
26
|
+
- 用户确认:`forkChecked=true` + `finalConfirm=true`;
|
|
27
|
+
- 当前母体进程有 `<dataDir>/fang.pid`,watchdog 可读;
|
|
28
|
+
- relaunch 命令:`process.execPath + process.argv.slice(1)`(由宿主自己给出,不猜 shell 字符串)。
|
|
29
|
+
|
|
30
|
+
## 失败行为
|
|
31
|
+
|
|
32
|
+
- watchdog 工具缺失 / 起不来 / 4 秒内未写 marker:`auto-watchdog-failed`,**不写授权清单、不退出**;
|
|
33
|
+
- 崩溃循环 / 安全模式:即使 watchdog 在位也 `executionArmed=false`;
|
|
34
|
+
- 无回执:`execution.executed=false`,不把“已批准”说成“已重启”。
|
|
35
|
+
|
|
36
|
+
## 角色边界
|
|
37
|
+
|
|
38
|
+
本版本自动看护只接在 **mother** 的 restart-guard 上。
|
|
39
|
+
fork/元主运行态的重启属于 Forker / EssenceRuntime 监督面,不能直接复用母体 exit(75)。
|
|
40
|
+
|
|
41
|
+
## 验证
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
node --test test/restart-guard.test.mjs
|
|
45
|
+
node tools/gate/main-city.mjs --target source --root .
|
|
46
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# 决策中心工具结果 lossless JSON
|
|
2
|
+
|
|
3
|
+
生效版本:`v3.3.9`
|
|
4
|
+
|
|
5
|
+
## P0 现象
|
|
6
|
+
|
|
7
|
+
调用 `request_human_decision` / `ask_user_choice` 时,DSH 报:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
value is not lossless JSON
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 根因
|
|
14
|
+
|
|
15
|
+
DSH `@deepseek-ai/dsh-tools` 在 tool pipeline 里对 **execute 的原始返回值**做
|
|
16
|
+
`snapshotJsonValue`(`dsh-tools/lib/pipeline.js`)。Fang 的结果对象含:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
{ selectedValue: undefined, selectedActionId: undefined, payload: undefined }
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`undefined` 不是 lossless JSON;即使 `JSON.stringify` 会丢弃它,DSH 在字符串化之前
|
|
23
|
+
就已经拒绝。所以 ticket 已创建,但工具调用最终失败。
|
|
24
|
+
|
|
25
|
+
## 修复
|
|
26
|
+
|
|
27
|
+
- 新增 `toLosslessJson(value)`:丢弃 `undefined`,`NaN/Infinity → null`,`BigInt → string`;
|
|
28
|
+
- `request_human_decision` 母体 / fork 两条注册的全部 execute 返回都经过它;
|
|
29
|
+
- `ask_user_choice` 的三个返回路径同样经过它;
|
|
30
|
+
- 回归测试:resolved 结果必须无 `undefined` 字段且可 JSON round-trip。
|
|
31
|
+
|
|
32
|
+
## 验证
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
node --test test/decision-center.test.mjs
|
|
36
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# 默认元主自动同步
|
|
2
|
+
|
|
3
|
+
生效版本:`v3.3.8`
|
|
4
|
+
|
|
5
|
+
## 解决的问题
|
|
6
|
+
|
|
7
|
+
升级后默认元主仍固定在上一个版本(例如 3.3.7 的 merged profile),
|
|
8
|
+
继续派生就会得到旧 bundle 的 fork:Adapter 404,Healer/HotReloader/Buffer 不挂载。
|
|
9
|
+
|
|
10
|
+
## 启动行为
|
|
11
|
+
|
|
12
|
+
1. 读取 `default-essence.json`;
|
|
13
|
+
2. 读默认元主的 merged/profile/package.json;
|
|
14
|
+
3. 若 bundle 是旧包,或同名但版本 != 当前 `FANG_VERSION`:
|
|
15
|
+
- `captureFromProfile` 当前母体 profile;
|
|
16
|
+
- `setDefault` 到新元主;
|
|
17
|
+
- 写审计 `essence-auto-refreshed`;
|
|
18
|
+
4. 失败只记 `essence-auto-refresh-failed`,不阻塞启动。
|
|
19
|
+
|
|
20
|
+
## 兜底
|
|
21
|
+
|
|
22
|
+
- 旧 legacy bundle 仍走 `fork-template-stale` → clean template 回退;
|
|
23
|
+
- 单个派生请求仍会在 `createTask` 检查模板,避免自动同步完成前的竞态。
|
|
24
|
+
|
|
25
|
+
## 手动触发
|
|
26
|
+
|
|
27
|
+
`service.refreshDefaultEssence()`,或重启宿主后等待约 1.5s。
|
|
28
|
+
|
|
29
|
+
## 验证
|
|
30
|
+
|
|
31
|
+
- `profileUsesCurrentFangBundle`:旧包 / 同名旧版本均 false;当前版本 true;
|
|
32
|
+
- `status.essenceAutoRefresh` 暴露最近一次结果。
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# 收件箱滚动修复
|
|
2
|
+
|
|
3
|
+
生效版本:`v3.3.10`
|
|
4
|
+
|
|
5
|
+
## 现象
|
|
6
|
+
|
|
7
|
+
- 鼠标滚轮无法滚动收件箱;
|
|
8
|
+
- 没有可拖动的滚动条。
|
|
9
|
+
|
|
10
|
+
## 原因
|
|
11
|
+
|
|
12
|
+
`.fang-inbox` 是 flex column,但 `.fang-inbox-body` 只写了 `flex:1 1 auto; overflow:auto`。
|
|
13
|
+
在 Electron/宿主 body 被 `overflow:hidden` 锁定时,body 的高度约束和滚轮落点都不稳定;
|
|
14
|
+
同时旧 CSS 没有显式滚动条样式。
|
|
15
|
+
|
|
16
|
+
## 修复
|
|
17
|
+
|
|
18
|
+
```css
|
|
19
|
+
.fang-inbox-drawer { height:100vh; height:100dvh; overflow:hidden }
|
|
20
|
+
.fang-inbox-body { flex:1 1 0; height:0; min-height:0;
|
|
21
|
+
overflow-y:scroll; overflow-x:hidden; overscroll-behavior:contain;
|
|
22
|
+
scrollbar-gutter:stable; scrollbar-width:thin }
|
|
23
|
+
.fang-inbox-body::-webkit-scrollbar { width:12px }
|
|
24
|
+
.fang-inbox-body::-webkit-scrollbar-thumb { ... }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
另加 wheel 兜底:滚轮事件显式转给 `.fang-inbox-body`,避免宿主 body 抢走;
|
|
28
|
+
AI 区限制 `max-height:32vh; overflow:auto`,不再把列表挤成 0 高。
|
|
29
|
+
|
|
30
|
+
## 验证
|
|
31
|
+
|
|
32
|
+
- `client-inbox-dom` 20 pass;
|
|
33
|
+
- 源码测试断言 body 滚动容器/滚动条/ wheel 兜底存在。
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# 宿主浮窗总开关(v3.3.2)
|
|
2
|
+
|
|
3
|
+
## 目标
|
|
4
|
+
|
|
5
|
+
母体(宿主)页面里,瓮城的决策浮标、红色告警、收件箱抽屉、Mother 浮窗、通知/弹层都是浮层。
|
|
6
|
+
需要一键隐藏/显示,而不是逐个关闭;隐藏后还要能随时恢复。
|
|
7
|
+
|
|
8
|
+
## 入口
|
|
9
|
+
|
|
10
|
+
| 位置 | 形态 | 说明 |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| 宿主侧栏底部 | `浮窗` / `浮窗已隐藏` 按钮 | 常驻;其他浮窗全隐藏时仍然可见,作为恢复入口 |
|
|
13
|
+
| 瓮城控制台面板头 | `隐藏浮窗` / `显示浮窗` 按钮 | 在控制台内直接切换 |
|
|
14
|
+
| 偏好 | `localStorage['fang.overlays.hidden']` | `1` 隐藏 / `0` 显示;刷新、重启后保持 |
|
|
15
|
+
| 跨窗口 | `storage` 事件 | 一个窗口切换,其他窗口同步 |
|
|
16
|
+
|
|
17
|
+
## 行为
|
|
18
|
+
|
|
19
|
+
1. 切换 `document.documentElement[data-fang-overlays]` 为 `hidden|visible`;
|
|
20
|
+
2. CSS 统一隐藏以下瓮城浮层(`display:none!important`):
|
|
21
|
+
- `.fang-relay-fab` / `.fang-relay-panel`(会话决策中继)
|
|
22
|
+
- `.fang-red-alert-stack` / `[data-fang-red-alerts]`(红色告警)
|
|
23
|
+
- `.fang-inbox-drawer` / `.fang-inbox-backdrop`(收件箱抽屉)
|
|
24
|
+
- `.mother-palette`(Mother 浮窗)
|
|
25
|
+
- `[data-fang-essence-notice]`(元主落地提示)
|
|
26
|
+
- `.fang-console .overlay`(确认/截图等弹层)
|
|
27
|
+
- `.fang-console .toast`(面板 toast)
|
|
28
|
+
3. **不销毁 DOM、不关闭状态**:隐藏只是视觉开关;再显示时原样恢复(例如收件箱仍停在原分组/滚动位置)。
|
|
29
|
+
4. 不隐藏宿主自己的 UI 与瓮城面板本身;开关按钮自身也不在隐藏列表里。
|
|
30
|
+
|
|
31
|
+
## 明确不做
|
|
32
|
+
|
|
33
|
+
- 不修改宿主的浮窗系统,不注入全局 CSS 变量;
|
|
34
|
+
- 不把「隐藏」当成分身/元主 UI 锁(那是角色收敛,不是浮窗偏好);
|
|
35
|
+
- 不在隐藏时丢弃红色告警:告警仍在 DOM 中,恢复后可见;若需要真正处理,必须点开关显示后再处置。
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# npm 包改名:@twinsearth/fang-dsh-plugin
|
|
2
|
+
|
|
3
|
+
生效版本:`v3.3.4`(v3.3.3 因 npm 402 未发布)
|
|
4
|
+
|
|
5
|
+
## 新身份
|
|
6
|
+
|
|
7
|
+
| 项 | 值 |
|
|
8
|
+
|---|---|
|
|
9
|
+
| npm 包名 | `@twinsearth/fang-dsh-plugin` |
|
|
10
|
+
| 安装 | `dsh plugin --profile desktop add @twinsearth/fang-dsh-plugin@3.3.3` |
|
|
11
|
+
| 本地开发 bundle 名 | `@twinsearth/fang-dsh-plugin`(构建时统一改写为新包名) |
|
|
12
|
+
| 旧 npm 包名 | `@twinsearth/dsh-fang`(继续兼容,不再作为新发布身份) |
|
|
13
|
+
|
|
14
|
+
## 为什么保留旧名兼容
|
|
15
|
+
|
|
16
|
+
- 已安装旧包的 profile 仍能启动、升级;`FANG_PACKAGE_NAMES` / `FORK_BUNDLE_NAMES` 同时接受新旧名和本地 link。
|
|
17
|
+
- 新 profile、安装 drill、发布门禁、npm registry 查询全部使用新名。
|
|
18
|
+
- 旧包暂不自动 deprecate;如需公告迁移,单独执行 `npm deprecate` 并记录。
|
|
19
|
+
|
|
20
|
+
## 市场状态(2026-11-14)
|
|
21
|
+
|
|
22
|
+
当前 DSH `0.2.2-rc.1` 没有「官方插件市场」,文档明确「DSH 不内置任何索引源」。
|
|
23
|
+
因此本版**只发布 npm,不提交任何市场收录**;官方市场上线后再按官方流程提交。
|
|
24
|
+
社区 Open Plugin Market(dshopen.org)是第三方索引,本版未提交。
|
|
25
|
+
|
|
26
|
+
## 验证
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
source / workflows / package / publish gate GREEN
|
|
30
|
+
全量测试见构建输出
|
|
31
|
+
install drill 使用新包名安装并列出新 client.js
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## 队列子插件默认关闭(同一版本)
|
|
36
|
+
|
|
37
|
+
- `dsh-fang-queue-journal` 的 bundle 行默认 `disabled: true`;
|
|
38
|
+
- 未启用时 host half 不提供 `fangQueueJournal`,journal/queue 路由返回 503;
|
|
39
|
+
- client half 不加载;即使旧缓存残留,也会因能力探测失败而隐藏 UI;
|
|
40
|
+
- 启用方式:在 profile 的 `cordis.patch.yml` 覆盖该行 `disabled: false`(或由后续设置界面提供开关)。
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# 母体重启:红色风险 + 分身预确认 + 二次点击
|
|
2
|
+
|
|
3
|
+
生效版本:`v3.3.6`
|
|
4
|
+
|
|
5
|
+
## 入口
|
|
6
|
+
|
|
7
|
+
- 瓮城控制台面板头:`重启母体`(仅 restart-guard 可用时显示);
|
|
8
|
+
- `GET /fang/api/restart/impact`:只读影响面(活跃分身、待批提升、脏缓冲、武装状态);
|
|
9
|
+
- `POST /fang/api/restart/request`:必须带 `confirmation.forkChecked=true` 与 `confirmation.finalConfirm=true`。
|
|
10
|
+
|
|
11
|
+
## 两次确认
|
|
12
|
+
|
|
13
|
+
1. 打开弹窗,阅读红色风险与影响面;
|
|
14
|
+
2. 点击「我已在分身确认」(建议先点「打开分身检查」),按钮才启用;
|
|
15
|
+
3. 点击「二次确认:放行重启」→ 才提交 guard 请求。
|
|
16
|
+
|
|
17
|
+
缺失任一确认:HTTP 428 `restart-confirmation-required`,不创建重启请求。
|
|
18
|
+
|
|
19
|
+
## 执行边界(重要)
|
|
20
|
+
|
|
21
|
+
- `executionArmed=true`(enforce + allowProcessRestart + supervisor 在位):守卫写授权清单并 exit 75,由外部 supervisor 拉起新宿主;
|
|
22
|
+
- `executionArmed=false`:只记录红色审批与拒绝原因,**不会自动退出/重启**;UI 明确显示“未武装”。
|
|
23
|
+
- 这是为了防止无 supervisor 时把宿主杀死后无法自动恢复;不把“审批”伪装成“已执行”。
|
|
24
|
+
|
|
25
|
+
## 测试
|
|
26
|
+
|
|
27
|
+
- restart-guard 确认字段进入请求与审计;
|
|
28
|
+
- orchestrator:缺确认 428;带确认但 guard 不可用 409;
|
|
29
|
+
- `requestMotherRestart` 未确认拒绝,确认后才转交 guard。
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# 测试稳定性修复(v3.4.0)
|
|
2
|
+
|
|
3
|
+
## 问题
|
|
4
|
+
|
|
5
|
+
release 的 `test (node 22)` 在 `decision-level-policy.test.mjs` 偶发失败/挂起:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
expected: deferred
|
|
9
|
+
actual: undefined
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
并在重跑时卡住 20+ 分钟。Node24 全量测试正常。
|
|
13
|
+
|
|
14
|
+
## 根因
|
|
15
|
+
|
|
16
|
+
测试直接 `await service.wait(yellowId)` / `await service.wait(blueId)`,
|
|
17
|
+
依赖 60ms 策略定时器在重载 runner 上准时唤醒;等待没有上限,漏唤醒就会挂死整条测试。
|
|
18
|
+
另一个 history 用例只等蓝票 resolved,没等黄票 deferred,存在竞态。
|
|
19
|
+
|
|
20
|
+
## 修复
|
|
21
|
+
|
|
22
|
+
- 改为有界 `waitFor(..., 5000)` 轮询持久化状态;
|
|
23
|
+
- history 用例同时等待 yellow=deferred 且 blue=resolved;
|
|
24
|
+
- 不改变产品逻辑,只消除测试对定时器唤醒顺序的依赖。
|
|
25
|
+
|
|
26
|
+
## 验证
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
node --test test/decision-level-policy.test.mjs
|
|
30
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twinsearth/dsh-fang",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.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.",
|
|
@@ -50,12 +50,19 @@
|
|
|
50
50
|
"node": ">=22"
|
|
51
51
|
},
|
|
52
52
|
"optionalDependencies": {
|
|
53
|
-
"@twinsearth/dsh-fang-queue-journal": "^0.1.
|
|
53
|
+
"@twinsearth/dsh-fang-queue-journal": "^0.1.8",
|
|
54
54
|
"@twinsearth/dsh-fang-web-entry": "0.1.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"jsdom": "^31.0.0"
|
|
58
58
|
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@twinsearth/dsh-fang-node-compat": "^0.1.0",
|
|
61
|
+
"@twinsearth/fang-dsh-plugin": "3.7.6"
|
|
62
|
+
},
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public"
|
|
65
|
+
},
|
|
59
66
|
"repository": {
|
|
60
67
|
"type": "git",
|
|
61
68
|
"url": "git+https://github.com/TwinsEarth/dsh-fang.git"
|
|
@@ -63,8 +70,5 @@
|
|
|
63
70
|
"homepage": "https://github.com/TwinsEarth/dsh-fang#readme",
|
|
64
71
|
"bugs": {
|
|
65
72
|
"url": "https://github.com/TwinsEarth/dsh-fang/issues"
|
|
66
|
-
},
|
|
67
|
-
"bin": {
|
|
68
|
-
"fangctl": "./tools/fangctl.mjs"
|
|
69
73
|
}
|
|
70
74
|
}
|
package/src/compose.mjs
CHANGED
|
@@ -20,6 +20,7 @@ import * as orchestrator from './plugins/orchestrator.mjs'
|
|
|
20
20
|
import * as sessionBridge from './plugins/session-bridge.mjs'
|
|
21
21
|
import * as sessionSync from './plugins/session-sync.mjs'
|
|
22
22
|
import * as sessionRouter from './plugins/session-router.mjs'
|
|
23
|
+
import * as sessionCatalog from './plugins/session-catalog.mjs'
|
|
23
24
|
import * as decisionCenter from './plugins/decision-center.mjs'
|
|
24
25
|
|
|
25
26
|
export const name = 'fang-compose'
|
|
@@ -41,6 +42,7 @@ export const Config = z.object({
|
|
|
41
42
|
sessionBridge: z.object({}).default({}).description('桥接(实时驱动 PC 会话)配置'),
|
|
42
43
|
sessionSync: z.object({}).default({}).description('同步(勾选会话搬运)配置'),
|
|
43
44
|
sessionRouter: z.object({}).default({}).description('混合路由配置'),
|
|
45
|
+
sessionCatalog: z.object({}).default({}).description('母体会话目录(只读)配置'),
|
|
44
46
|
decisionCenter: z.object({}).default({}).description('决策中心配置'),
|
|
45
47
|
}).description('dsh-Fang 单行装载模式配置')
|
|
46
48
|
|
|
@@ -58,10 +60,11 @@ export function apply(ctx, config) {
|
|
|
58
60
|
ctx.plugin(restartGuard, cfg.restartGuard ?? {})
|
|
59
61
|
ctx.plugin(adapter, cfg.adapter ?? {})
|
|
60
62
|
ctx.plugin(orchestrator, cfg.orchestrator ?? {})
|
|
63
|
+
ctx.plugin(sessionCatalog, cfg.sessionCatalog ?? {})
|
|
61
64
|
ctx.plugin(sessionBridge, cfg.sessionBridge ?? {})
|
|
62
65
|
ctx.plugin(sessionSync, cfg.sessionSync ?? {})
|
|
63
66
|
ctx.plugin(sessionRouter, cfg.sessionRouter ?? {})
|
|
64
67
|
ctx.plugin(decisionCenter, cfg.decisionCenter ?? {})
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
export const _modules = { auditor, forker, bufferKeeper, scorer, umbrella, healer, router, approver, hotReloader, restartGuard, adapter, orchestrator, sessionBridge, sessionSync, sessionRouter, decisionCenter }
|
|
70
|
+
export const _modules = { auditor, forker, bufferKeeper, scorer, umbrella, healer, router, approver, hotReloader, restartGuard, adapter, orchestrator, sessionCatalog, sessionBridge, sessionSync, sessionRouter, decisionCenter }
|
package/src/contract/VENDOR.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "@twinsearth/dsh-fang-contract",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"syncedAt": "2026-11-
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"syncedAt": "2026-11-17T08:10:38.959Z",
|
|
5
5
|
"fileCount": 8,
|
|
6
6
|
"sha256": {
|
|
7
7
|
"client.js": "b1c48a56c64e7058f40a6f1e3239f9e81619381c121fc3d2e1f5418b6e8c6b26",
|
|
8
|
-
"constants.js": "
|
|
8
|
+
"constants.js": "9bf0833c7cf57848f78dcf79d932b97bddb54f6c6e98efcc011fe7b81d5a30b1",
|
|
9
9
|
"envelope.js": "68e8725a4b7d5c01e49b1364a201121278d3d45dac6e99dc0ee53f98232d380a",
|
|
10
10
|
"index.js": "67b5d687d4f8c47fd4d573fe5540362014ed0617e7df3533936e613a439b655c",
|
|
11
11
|
"negotiate.js": "8a699b287b740a7d478c40981c0ae7915a6522ff856f3bc0b19f0cc077587c43",
|
|
12
|
-
"relay.js": "
|
|
12
|
+
"relay.js": "9f7150aaa026ea4ca629b749a2bc691579b72836af053e05228070a009f5b5b2",
|
|
13
13
|
"server.js": "5e7c884639fc365833f6fdca91f276c34db2b1d1a6938790c7e9b71c127e6c17",
|
|
14
14
|
"transports.js": "6712aabbe702ae559ff50027a3469c0ce031092e6b0a61fec51cfe80b69d0a6c"
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
"sourceCommit": "f5b7b05"
|
|
16
17
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
export const CONTRACT_PACKAGE = '@twinsearth/dsh-fang-contract'
|
|
14
|
-
export const CONTRACT_VERSION = '1.
|
|
14
|
+
export const CONTRACT_VERSION = '1.2.0'
|
|
15
15
|
export const PROTOCOL = 'fang-master'
|
|
16
16
|
export const PROTOCOL_VERSION = 1
|
|
17
17
|
export const MIN_COMPATIBLE_MAJOR = 1
|
|
@@ -29,6 +29,10 @@ export const METHODS = Object.freeze({
|
|
|
29
29
|
ORCHESTRATOR_STATUS: 'fang.orchestrator.status',
|
|
30
30
|
RELAY_PUBLISH: 'fang.relay.publish',
|
|
31
31
|
RELAY_STATUS: 'fang.relay.status',
|
|
32
|
+
// contract 1.2:B 契约委托(只读能力 + 受控工具/导入;白名单由宿主层校验)
|
|
33
|
+
CAPABILITY_LIST: 'fang.capability.list',
|
|
34
|
+
DECISION_LIST: 'fang.decision.list',
|
|
35
|
+
APPROVALS_LIST: 'fang.approvals.list',
|
|
32
36
|
})
|
|
33
37
|
|
|
34
38
|
/** 方法 → 契约版本(用于协商后的方法裁剪)。 */
|
|
@@ -44,6 +48,9 @@ export const METHOD_VERSION = Object.freeze({
|
|
|
44
48
|
[METHODS.ORCHESTRATOR_STATUS]: '1.0',
|
|
45
49
|
[METHODS.RELAY_PUBLISH]: '1.1',
|
|
46
50
|
[METHODS.RELAY_STATUS]: '1.1',
|
|
51
|
+
[METHODS.CAPABILITY_LIST]: '1.2',
|
|
52
|
+
[METHODS.DECISION_LIST]: '1.2',
|
|
53
|
+
[METHODS.APPROVALS_LIST]: '1.2',
|
|
47
54
|
})
|
|
48
55
|
|
|
49
56
|
export const CAPABILITIES = Object.freeze([
|
|
@@ -63,6 +70,14 @@ export const ERROR_CODES = Object.freeze({
|
|
|
63
70
|
REMOTE_ERROR: 'remote-error',
|
|
64
71
|
ALL_TRANSPORTS_FAILED: 'all-transports-failed',
|
|
65
72
|
HANDLER_THREW: 'handler-threw',
|
|
73
|
+
// contract 1.2:B 委托错误码(append-only)
|
|
74
|
+
CONTRACT_UNAVAILABLE: 'contract-unavailable',
|
|
75
|
+
CONTRACT_UNAUTHORIZED: 'contract-unauthorized',
|
|
76
|
+
CONTRACT_UNSUPPORTED: 'contract-unsupported',
|
|
77
|
+
CONTRACT_TIMEOUT: 'contract-timeout',
|
|
78
|
+
CONTRACT_INVALID_REQUEST: 'contract-invalid-request',
|
|
79
|
+
CONTRACT_APPROVAL_REQUIRED: 'contract-approval-required',
|
|
80
|
+
CONTRACT_RATE_LIMITED: 'contract-rate-limited',
|
|
66
81
|
})
|
|
67
82
|
|
|
68
83
|
/**
|
package/src/contract/relay.js
CHANGED
|
@@ -123,9 +123,11 @@ export function createRelayStore(options = {}) {
|
|
|
123
123
|
}
|
|
124
124
|
counters.batches += 1
|
|
125
125
|
const acceptedIds = []
|
|
126
|
-
let
|
|
126
|
+
let alreadySeen = 0
|
|
127
|
+
let inBatchDuplicates = 0
|
|
128
|
+
let rejectedCount = 0
|
|
127
129
|
for (const event of validated.accepted) {
|
|
128
|
-
if (seen.has(event.id)) {
|
|
130
|
+
if (seen.has(event.id)) { alreadySeen += 1; continue }
|
|
129
131
|
seen.set(event.id, { at: nowMs(now), cursor: cursor + 1 })
|
|
130
132
|
cursor += 1
|
|
131
133
|
counters.accepted += 1
|
|
@@ -133,13 +135,17 @@ export function createRelayStore(options = {}) {
|
|
|
133
135
|
remember({ id: event.id, type: event.type, at: event.at, cursor })
|
|
134
136
|
lastAt = nowMs(now)
|
|
135
137
|
}
|
|
136
|
-
counters.duplicates += duplicates
|
|
137
138
|
for (const item of validated.rejected) {
|
|
138
139
|
// 批内重复计入 duplicates;其余非法条目计入 rejected 并留原因(有界)。
|
|
139
|
-
if (item.reason === 'duplicate-in-batch') {
|
|
140
|
-
|
|
140
|
+
if (item.reason === 'duplicate-in-batch') { inBatchDuplicates += 1; continue }
|
|
141
|
+
rejectedCount += 1
|
|
141
142
|
if (lastErrors.length < 50) lastErrors.push({ id: item.id, reason: item.reason })
|
|
142
143
|
}
|
|
144
|
+
// 两个计数分开累计:duplicates = 已存在 + 批内重复;rejected 只数真正非法的条目。
|
|
145
|
+
// (1.1.0 曾用 `validated.rejected.length - duplicates` 计算 rejected,重投时会得到负数。)
|
|
146
|
+
const duplicates = alreadySeen + inBatchDuplicates
|
|
147
|
+
counters.duplicates += duplicates
|
|
148
|
+
counters.rejected += rejectedCount
|
|
143
149
|
const batchId = String(params?.batchId ?? `batch-${counters.batches}`)
|
|
144
150
|
const receipt = Object.freeze({
|
|
145
151
|
ok: true,
|
|
@@ -147,7 +153,7 @@ export function createRelayStore(options = {}) {
|
|
|
147
153
|
taskId: params?.taskId === undefined ? null : String(params.taskId),
|
|
148
154
|
accepted: acceptedIds.length,
|
|
149
155
|
duplicates,
|
|
150
|
-
rejected:
|
|
156
|
+
rejected: rejectedCount,
|
|
151
157
|
cursor,
|
|
152
158
|
acceptedIds,
|
|
153
159
|
peer: peerLabel,
|