@shgroup/dsh-serenity-hooks 1.57.2 → 1.58.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/lib/ports.d.ts CHANGED
@@ -20,8 +20,8 @@
20
20
  * 本模块是**零依赖叶模块**(纯常量,无 import)——output-guard(守卫词表)、config-ops
21
21
  * (默认值)、settings-section(面板默认)、index(Config 默认)都可安全引用而不引入依赖环。
22
22
  */
23
- /** 面标识(四个对外面;A 由宿主监听,B/C/D 由本插件监听) */
24
- export type FaceId = 'main' | 'gateway' | 'weixinSend' | 'skiffDebug';
23
+ /** 面标识(五个对外面;A 由宿主监听,B/C/D/E 由本插件监听) */
24
+ export type FaceId = 'main' | 'gateway' | 'weixinSend' | 'skiffDebug' | 'acp';
25
25
  /** 一个面的端口语义 */
26
26
  export interface PortSpec {
27
27
  /** 端口号 */
@@ -36,7 +36,7 @@ export interface PortSpec {
36
36
  /**
37
37
  * 集中端口表。
38
38
  * A=宿主主面(插件不监听)/ B=网关(可配,默认关)/ C=微信发送(默认开,仅 loopback)
39
- * / D=Skiff 调试(默认关)。
39
+ * / D=Skiff 调试(默认关)/ E=ACP(默认关,`0.0.0.0`)。
40
40
  */
41
41
  export declare const FACE_PORTS: Readonly<Record<FaceId, PortSpec>>;
42
42
  /** 宿主主 WebUI 端口(面 A:插件**不监听**,只读取;`readWebPort` 的回退值) */
@@ -47,6 +47,8 @@ export declare const GATEWAY_PORT: number;
47
47
  export declare const WEIXIN_SEND_PORT: number;
48
48
  /** Skiff 调试页端口默认值(面 D) */
49
49
  export declare const SKIFF_DEBUG_PORT: number;
50
+ /** 官方 ACP 面端口默认值(面 E,2026-10-16) */
51
+ export declare const ACP_PORT: number;
50
52
  /**
51
53
  * **机制端口**词表(output-guard 用:agent 在**用户可见输出**里提及内部端口即打回)。
52
54
  *
@@ -41,7 +41,7 @@ function unregisterSkiffSession(sessionId) {
41
41
  /**
42
42
  * 集中端口表。
43
43
  * A=宿主主面(插件不监听)/ B=网关(可配,默认关)/ C=微信发送(默认开,仅 loopback)
44
- * / D=Skiff 调试(默认关)。
44
+ * / D=Skiff 调试(默认关)/ E=ACP(默认关,`0.0.0.0`)。
45
45
  */
46
46
  const FACE_PORTS = {
47
47
  main: {
@@ -67,6 +67,26 @@ const FACE_PORTS = {
67
67
  host: "127.0.0.1",
68
68
  defaultEnabled: false,
69
69
  meaning: "Skiff 调试问答面(人工调试子角色;无认证,仅靠 loopback)"
70
+ },
71
+ /**
72
+ * 🔴 面 E:**官方 ACP 面**(2026-10-16,owner 令「跑在 dsh web 进程内」→ 已实测跑通)。
73
+ *
74
+ * 与已退役的**旧面 E(3100)不是一回事**,别混淆:
75
+ * · 旧面 E = 当年**自造**的 HTTP+HTML 问答面,2026-10-15 owner 裁「砍掉外部问答」时**整组退役**;
76
+ * · 本面 = **官方 `@deepseek-ai/dsh-acp`**(官方 SDK + 现成客户端 Agmente),
77
+ * 且**跑在宿主 web 进程内**(不另起进程、不需要 stdio 桥)。
78
+ * ⇒ 端口**另选 3200**:既避开 3080/3081/3082/3099,也让"新旧一眼可分"。
79
+ *
80
+ * ⚠️ **安全边界(不许含混)**:**ACP 协议本身不做认证**(`dsh-acp` 的 `authenticate` 恒成功),
81
+ * 而本面按 owner 裁决绑 **`0.0.0.0`**(局域网内任何设备可连)⇒ **必须靠外部接入层兜底**
82
+ * (现为 Cloudflare Access)。⛔ **"隧道不是 ACC 该关心的事"(Q3 裁决)成立,但
83
+ * "所以不需要认证层"不成立** —— 交付文档与诊断输出里都要显式带这个前提。
84
+ */
85
+ acp: {
86
+ port: 3200,
87
+ host: "0.0.0.0",
88
+ defaultEnabled: false,
89
+ meaning: "官方 ACP 面(Agmente 等标准客户端登入本 CCC;**协议无认证**,靠外部 Access 兜底)"
70
90
  }
71
91
  };
72
92
  /** 宿主主 WebUI 端口(面 A:插件**不监听**,只读取;`readWebPort` 的回退值) */
@@ -77,6 +97,8 @@ const GATEWAY_PORT = FACE_PORTS.gateway.port;
77
97
  const WEIXIN_SEND_PORT = FACE_PORTS.weixinSend.port;
78
98
  /** Skiff 调试页端口默认值(面 D) */
79
99
  const SKIFF_DEBUG_PORT = FACE_PORTS.skiffDebug.port;
100
+ /** 官方 ACP 面端口默认值(面 E,2026-10-16) */
101
+ const ACP_PORT = FACE_PORTS.acp.port;
80
102
  /**
81
103
  * **机制端口**词表(output-guard 用:agent 在**用户可见输出**里提及内部端口即打回)。
82
104
  *
@@ -103,6 +125,8 @@ function defaultSimpleSettings() {
103
125
  croEnabled: true,
104
126
  unattendedEnabled: false,
105
127
  diagramEnabled: false,
128
+ acpFaceEnabled: false,
129
+ acpFacePort: ACP_PORT,
106
130
  humanChannel: defaultHumanChannelSettings()
107
131
  };
108
132
  }
@@ -199,6 +223,8 @@ function simpleSettingsFromConfig(config) {
199
223
  croEnabled: unwrapVolatile(config.croEnabled) ?? d.croEnabled,
200
224
  unattendedEnabled: unwrapVolatile(config.unattendedEnabled) ?? d.unattendedEnabled,
201
225
  diagramEnabled: unwrapVolatile(config.diagramEnabled) ?? config.diagram?.enabled ?? d.diagramEnabled,
226
+ acpFaceEnabled: unwrapVolatile(config.acpFaceEnabled) ?? config.acpFace?.enabled ?? d.acpFaceEnabled,
227
+ acpFacePort: unwrapVolatile(config.acpFacePort) ?? config.acpFace?.port ?? d.acpFacePort,
202
228
  humanChannel: humanChannelSettingsFromConfig(config.humanChannel)
203
229
  };
204
230
  }
@@ -237,4 +263,4 @@ function registerSettingsSection(ctx, config) {
237
263
  } catch {}
238
264
  }
239
265
  //#endregion
240
- export { GATEWAY_PORT as a, SKIFF_DEBUG_PORT as c, skiffRoleFor as d, skiffSessionInfo as f, FACE_PORTS as i, WEIXIN_SEND_PORT as l, ACC_VERSION as m, readSimpleSettings as n, MAIN_WEB_PORT as o, unregisterSkiffSession as p, registerSettingsSection as r, MECHANISM_PORTS as s, SERENITY_SETTINGS_NS as t, registerSkiffSession as u };
266
+ export { FACE_PORTS as a, MECHANISM_PORTS as c, registerSkiffSession as d, skiffRoleFor as f, ACC_VERSION as h, ACP_PORT as i, SKIFF_DEBUG_PORT as l, unregisterSkiffSession as m, readSimpleSettings as n, GATEWAY_PORT as o, skiffSessionInfo as p, registerSettingsSection as r, MAIN_WEB_PORT as s, SERENITY_SETTINGS_NS as t, WEIXIN_SEND_PORT as u };
@@ -69,6 +69,13 @@ interface SimpleConfigFragment {
69
69
  diagram?: {
70
70
  enabled?: boolean;
71
71
  };
72
+ /** 🔴 面 E(官方 ACP,2026-10-16 owner 令「跑在 dsh web 进程内」):部署层嵌套段。
73
+ * ⚠️ **键名刻意不用 `acp.*`** —— 旧面 E 退役时 `acp.*` 是**被静默忽略**的遗留名,
74
+ * 复用会让"当年那份旧配置"在新面上复活(判据:退役 ≠ 删名,名字仍需保留为"无人读")。 */
75
+ acpFace?: {
76
+ enabled?: boolean;
77
+ port?: number;
78
+ };
72
79
  /** human-channel(人机信道;**机器级**;2026-09-26 owner 定案):账号 / 订阅表 / 主控 / 出站白名单 */
73
80
  humanChannel?: HumanChannelConfigFragment;
74
81
  gatewayEnabled?: PanelBoolean;
@@ -78,6 +85,9 @@ interface SimpleConfigFragment {
78
85
  croEnabled?: PanelBoolean;
79
86
  unattendedEnabled?: PanelBoolean;
80
87
  diagramEnabled?: PanelBoolean;
88
+ /** 🔴 面 E(官方 ACP,2026-10-16):开关 + 端口(面板层扁平键) */
89
+ acpFaceEnabled?: PanelBoolean;
90
+ acpFacePort?: PanelNumber;
81
91
  }
82
92
  /**
83
93
  * 设置面板命名空间 = **profile 条目 id**(v0.1.7 起;与旧 `settings.yaml` 段名逐字相同)。
@@ -122,6 +132,18 @@ interface SerenitySimpleSettings {
122
132
  * 零 token、不会被误调),同 `skiff` 的"未开启零资源占用"口径。
123
133
  * 依赖面:随包分发 3.8 MB 内置字体(`assets/diagram/`,wasm 对系统字体不可见)。 */
124
134
  diagramEnabled: boolean;
135
+ /** 🔴 **面 E:官方 ACP 总开关**(2026-10-16 owner 令「跑在 dsh web 进程内」;**缺省关**)。
136
+ *
137
+ * 开启后:ACC 在自己进程里起一个 **ACP 服务面**(面宿主统一建 listener),
138
+ * 标准 ACP 客户端(Agmente 等)经 WebSocket 登入本 CCC —— **不另起进程、不需 stdio 桥**。
139
+ * **缺省关**:① 它把本 CCC 开给外部客户端;② ⚠️ **ACP 协议本身无认证**(`dsh-acp` 的
140
+ * `authenticate` 恒成功),而本面按 owner 裁决绑 **`0.0.0.0`** ⇒ **开之前必须有外部接入层
141
+ * 兜底**(现为 Cloudflare Access)。缺省关 = "不配就没有暴露面"。
142
+ * ⚠️ **与已退役的旧面 E(3100 自造问答面)无关**:本面是**官方** `@deepseek-ai/dsh-acp`。
143
+ * 实测(P0′,8/8)见 S142 `2026-10-16T0745-…-p0prime-inproc-findings.md`。 */
144
+ acpFaceEnabled: boolean;
145
+ /** 面 E 端口(默认 3200;避开 3080/3081/3082/3099 与已退役的 3100) */
146
+ acpFacePort: number;
125
147
  /** **human-channel(人机信道)机器级配置**(2026-09-26 owner 定案;P0-1 立 schema + 投影)。
126
148
  * 三张表(账号 / 订阅 / 主控)+ 出站白名单;**跨 CCC** ⇒ 归机器级,CCC 侧 `weixin.*` 随之退役
127
149
  * (退役动作在 P0-2~P0-4;本版**只立机器级面**,旧面照旧)。缺省与归一规则见
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.57.2",
3
+ "version": "1.58.2",
4
4
  "description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:14 个工具(container_fs/container_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/cheap-worker/localstore/container_admin;另三个 im-bridge/acc-diag/diagram 按配置条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 工作日志与原地重建 + 网页登录入口/微信桥/子角色/对外问答页/trajectory 唤醒注册表。适配 DSH 0.1.7-rc.1 与 0.2.0-rc.1(双档)。",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,7 +45,8 @@
45
45
  "README.md"
46
46
  ],
47
47
  "dependencies": {
48
- "@resvg/resvg-wasm": "2.6.2"
48
+ "@resvg/resvg-wasm": "2.6.2",
49
+ "ws": "^8.22.0"
49
50
  },
50
51
  "scripts": {
51
52
  "typecheck": "tsc --noEmit",
@@ -66,6 +67,7 @@
66
67
  },
67
68
  "peerDependencies": {
68
69
  "@deepseek-ai/cordis": "^4.0.4",
70
+ "@deepseek-ai/dsh-acp": "^0.1.7-rc.1 || ^0.2.0-rc.1",
69
71
  "@deepseek-ai/dsh-agent": "^0.1.7-rc.1 || ^0.2.0-rc.1",
70
72
  "@deepseek-ai/dsh-agent-loop": "^0.1.7-rc.1 || ^0.2.0-rc.1",
71
73
  "@deepseek-ai/dsh-agent-preset-registry": "^0.1.7-rc.1 || ^0.2.0-rc.1",
@@ -85,6 +87,9 @@
85
87
  "cordis": "^4.0.0-rc.7"
86
88
  },
87
89
  "peerDependenciesMeta": {
90
+ "@deepseek-ai/dsh-acp": {
91
+ "optional": true
92
+ },
88
93
  "@deepseek-ai/dsh-host-webserver": {
89
94
  "optional": true
90
95
  },
@@ -109,6 +114,7 @@
109
114
  },
110
115
  "devDependencies": {
111
116
  "@deepseek-ai/cordis": "^4.0.4",
117
+ "@deepseek-ai/dsh-acp": "0.1.7-rc.1",
112
118
  "@deepseek-ai/dsh-agent": "0.1.7-rc.1",
113
119
  "@deepseek-ai/dsh-agent-loop": "0.1.7-rc.1",
114
120
  "@deepseek-ai/dsh-agent-preset-registry": "0.1.7-rc.1",
@@ -147,6 +153,7 @@
147
153
  "@types/node": "^20.0.0",
148
154
  "@types/qrcode-generator": "^1.0.6",
149
155
  "@types/react": "^18.2.0",
156
+ "@types/ws": "^8.18.2",
150
157
  "@vitest/coverage-v8": "^1.6.1",
151
158
  "marked": "^18.0.11",
152
159
  "qrcode-generator": "^2.0.4",
@@ -154,7 +161,8 @@
154
161
  "tsdown": "^0.22.14",
155
162
  "typescript": "^5.4.0",
156
163
  "unrun": "^0.3.1",
157
- "vitest": "^1.6.0"
164
+ "vitest": "^1.6.0",
165
+ "ws": "8.22.0"
158
166
  },
159
167
  "pnpm": {
160
168
  "onlyBuiltDependencies": [