@allbluecn/web-app 0.28.11 → 0.28.13

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.
Files changed (133) hide show
  1. package/package.json +5 -5
  2. package/public/dev-gallery.html +19 -0
  3. package/src/__tests__/bench/baselines/format-timestamp.json +44 -0
  4. package/src/__typeprobe__.d.ts +4 -0
  5. package/src/components/harness/extension-panel/panels/terminal/__tests__/terminal-instance.test.tsx +93 -4
  6. package/src/components/harness/extension-panel/panels/terminal/sse-transport.ts +28 -5
  7. package/src/components/harness/extension-panel/panels/terminal/terminal-instance.tsx +53 -10
  8. package/src/components/harness/extension-panel/panels/terminal/transport.ts +10 -3
  9. package/src/components/harness/extension-panel/panels/terminal/ws-transport.ts +13 -2
  10. package/src/components/settings/harness/connectors-card.tsx +5 -0
  11. package/src/components/story/detail/story-detail-toolbar/associated-attachments-panel.tsx +2 -1
  12. package/src/dev/gallery-entry.tsx +38 -0
  13. package/src/dev/gallery.tsx +610 -0
  14. package/src/lib/changelog/sdk-versions.ts +4 -4
  15. package/src/lib/session.ts +10 -0
  16. package/src/paraglide/README.md +1 -1
  17. package/src/paraglide/messages/_index.d.ts +9 -0
  18. package/src/paraglide/messages/_index.js +9 -0
  19. package/src/paraglide/messages/capabilities_webhook.d.ts +16 -0
  20. package/src/paraglide/messages/capabilities_webhook.js +29 -0
  21. package/src/paraglide/messages/capabilities_workflow.d.ts +16 -0
  22. package/src/paraglide/messages/capabilities_workflow.js +29 -0
  23. package/src/paraglide/messages/harness_panel_terminal_exitedrecycled1.d.ts +17 -0
  24. package/src/paraglide/messages/harness_panel_terminal_exitedrecycled1.js +30 -0
  25. package/src/paraglide/messages/harness_panel_terminal_restarted.d.ts +16 -0
  26. package/src/paraglide/messages/harness_panel_terminal_restarted.js +29 -0
  27. package/src/paraglide/messages/settings_harness_connectors_needsauth1.d.ts +17 -0
  28. package/src/paraglide/messages/settings_harness_connectors_needsauth1.js +30 -0
  29. package/src/paraglide/messages/settings_harness_ralphenabled1.d.ts +17 -0
  30. package/src/paraglide/messages/settings_harness_ralphenabled1.js +30 -0
  31. package/src/paraglide/messages/settings_harness_ralphenabled_description1.d.ts +17 -0
  32. package/src/paraglide/messages/settings_harness_ralphenabled_description1.js +30 -0
  33. package/src/paraglide/messages/settings_harness_ralphmaxrounds2.d.ts +17 -0
  34. package/src/paraglide/messages/settings_harness_ralphmaxrounds2.js +30 -0
  35. package/src/paraglide/messages/settings_harness_ralphmaxrounds_description2.d.ts +17 -0
  36. package/src/paraglide/messages/settings_harness_ralphmaxrounds_description2.js +30 -0
  37. package/src/routeTree.gen.ts +21 -0
  38. package/src/routes/api/auth/desktop-callback.ts +9 -0
  39. package/src/routes/api/chat.ts +8 -1
  40. package/src/routes/api/harness/browser/proxy.ts +41 -12
  41. package/src/routes/api/harness/terminal/$.ts +32 -13
  42. package/src/routes/api/harness/terminal/__tests__/route.test.ts +41 -0
  43. package/src/routes/api/harness/webhook/$token.ts +23 -0
  44. package/src/routes/api/sync/__tests__/bootstrap.test.ts +32 -1
  45. package/src/routes/api/sync/bootstrap.ts +11 -0
  46. package/src/server/ai-gateway/adapter.ts +7 -3
  47. package/src/server/ai-gateway/connectivity-check.ts +3 -2
  48. package/src/server/ai-gateway/durability/__tests__/sse-resume-frames.test.ts +123 -0
  49. package/src/server/ai-gateway/embedding.ts +3 -2
  50. package/src/server/ai-gateway/model-fetch.ts +3 -2
  51. package/src/server/ai-gateway/sandbox/__tests__/provider.test.ts +12 -1
  52. package/src/server/ai-gateway/sandbox/policy.ts +27 -1
  53. package/src/server/ai-gateway/sandbox/provider.ts +10 -0
  54. package/src/server/ai-gateway/tools/definitions.ts +1 -1
  55. package/src/server/ai-gateway/tools/server.ts +4 -2
  56. package/src/server/harness/__tests__/agent-terminal-sandbox.test.ts +23 -4
  57. package/src/server/harness/__tests__/agent-terminal.server.test.ts +118 -2
  58. package/src/server/harness/__tests__/credentials.server.test.ts +25 -2
  59. package/src/server/harness/__tests__/host-schedule-worker.test.ts +43 -0
  60. package/src/server/harness/__tests__/runtime-without-providers.test.ts +11 -0
  61. package/src/server/harness/__tests__/sticky-route.test.ts +86 -0
  62. package/src/server/harness/__tests__/terminal-foreground.server.test.ts +80 -0
  63. package/src/server/harness/__tests__/terminal-manager.server.test.ts +75 -1
  64. package/src/server/harness/__tests__/tool-entitlements.test.ts +6 -2
  65. package/src/server/harness/agent-terminal.server.ts +25 -4
  66. package/src/server/harness/agents/__tests__/agent-control.test.ts +1 -0
  67. package/src/server/harness/agents/run-view.server.ts +55 -2
  68. package/src/server/harness/capabilities/__tests__/__snapshots__/matrix.test.ts.snap +92 -0
  69. package/src/server/harness/capabilities/__tests__/execution-plane-denials.test.ts +3 -1
  70. package/src/server/harness/capabilities/__tests__/p3-matrix.test.ts +3 -3
  71. package/src/server/harness/capabilities/__tests__/p5-matrix.test.ts +293 -0
  72. package/src/server/harness/capabilities/__tests__/validate.test.ts +8 -2
  73. package/src/server/harness/capabilities/execution-plane-denials.ts +9 -3
  74. package/src/server/harness/capabilities/manifests/agent-terminal.ts +3 -2
  75. package/src/server/harness/capabilities/manifests/webhook.ts +45 -0
  76. package/src/server/harness/capabilities/manifests/workflow.ts +40 -0
  77. package/src/server/harness/capabilities/registry.ts +4 -0
  78. package/src/server/harness/connectors/__tests__/connector-accounts.test.ts +22 -1
  79. package/src/server/harness/connectors/connector-accounts.server.ts +7 -0
  80. package/src/server/harness/credentials.server.ts +3 -1
  81. package/src/server/harness/define.server.ts +11 -0
  82. package/src/server/harness/mcp/mcp-config.server.ts +3 -1
  83. package/src/server/harness/outbox/outbox-dispatcher.server.ts +9 -0
  84. package/src/server/harness/outbox/outbox-store.server.ts +7 -0
  85. package/src/server/harness/persistence/__tests__/log-store.server.test.ts +4 -1
  86. package/src/server/harness/plugins/__tests__/tool-risk-audit.test.ts +5 -1
  87. package/src/server/harness/plugins/builtin/agent-terminal.plugin.ts +12 -2
  88. package/src/server/harness/providers/contracts.ts +16 -0
  89. package/src/server/harness/schedule/schedule-dispatcher.server.ts +3 -0
  90. package/src/server/harness/search/__tests__/indexer.test.ts +4 -1
  91. package/src/server/harness/search/__tests__/lifecycle.test.ts +4 -1
  92. package/src/server/harness/search/__tests__/search.test.ts +4 -1
  93. package/src/server/harness/sticky-route.server.ts +72 -0
  94. package/src/server/harness/terminal-foreground.server.ts +90 -0
  95. package/src/server/harness/terminal-manager.server.ts +78 -3
  96. package/src/server/harness/tool-entitlements.server.ts +5 -0
  97. package/src/server/harness/webhook/__tests__/body.test.ts +73 -0
  98. package/src/server/harness/webhook/__tests__/payload.test.ts +215 -0
  99. package/src/server/harness/webhook/__tests__/signature.test.ts +170 -0
  100. package/src/server/harness/webhook/__tests__/webhook-dispatcher.test.ts +212 -0
  101. package/src/server/harness/webhook/__tests__/webhook.plugin.test.ts +195 -0
  102. package/src/server/harness/webhook/__tests__/webhook.service.test.ts +354 -0
  103. package/src/server/harness/webhook/body.server.ts +56 -0
  104. package/src/server/harness/webhook/payload.server.ts +169 -0
  105. package/src/server/harness/webhook/signature.server.ts +118 -0
  106. package/src/server/harness/webhook/types.ts +57 -0
  107. package/src/server/harness/webhook/webhook-dispatcher.server.ts +495 -0
  108. package/src/server/harness/webhook/webhook-store.server.ts +115 -0
  109. package/src/server/harness/webhook/webhook.plugin.ts +273 -0
  110. package/src/server/harness/webhook/webhook.service.server.ts +577 -0
  111. package/src/server/harness/worker/__tests__/worker-http.test.ts +8 -1
  112. package/src/server/harness/worker/worker-health.server.ts +4 -1
  113. package/src/server/harness/worker/worker-runtime.server.ts +43 -1
  114. package/src/server/harness/workflow/__tests__/engine.test.ts +195 -0
  115. package/src/server/harness/workflow/__tests__/settings.test.ts +125 -0
  116. package/src/server/harness/workflow/__tests__/validate.test.ts +151 -0
  117. package/src/server/harness/workflow/engine.server.ts +155 -0
  118. package/src/server/harness/workflow/settings.ts +84 -0
  119. package/src/server/harness/workflow/store.server.ts +147 -0
  120. package/src/server/harness/workflow/types.ts +80 -0
  121. package/src/server/harness/workflow/validate.ts +130 -0
  122. package/src/server/harness/workflow/workflow.plugin.ts +261 -0
  123. package/src/server/knowledge/search-scope.ts +8 -1
  124. package/src/server/middlewares/security-headers.ts +1 -0
  125. package/src/server/serverFns/__tests__/link-preview.test.ts +2 -2
  126. package/src/server/serverFns/collab.ts +4 -0
  127. package/src/server/serverFns/design/versions.ts +6 -0
  128. package/src/server/serverFns/harness/__tests__/fork-thread.test.ts +14 -1
  129. package/src/server/serverFns/harness/fork-thread.ts +17 -0
  130. package/src/server/serverFns/story/link-preview.ts +3 -2
  131. package/src/server-entry.ts +13 -1
  132. package/src/start.ts +15 -1
  133. package/vite.shared.ts +0 -13
@@ -0,0 +1,293 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ // @vitest-environment node
5
+ //
6
+ // P5 四端矩阵与 conformance 汇总(任务 9)。
7
+ //
8
+ // 职责与 p3-matrix 同:**汇总断言一处全**——P5 各任务(workflow / Ralph / webhook /
9
+ // 终端增强 / 会话同步 / 顺延项)在 oss-web / self-hosted / saas / desktop 四部署下的
10
+ // 就绪与缺席语义固化为可执行断言;各路径细节已有单测,这里导入同一实现做形态断言,
11
+ // 不重写单测。
12
+ //
13
+ // 「无一行沉默略过」在这份文件里的含义是三件事,缺一不可:
14
+ // 1. **能力行**:有 manifest 的(workflow / webhook / agent-terminal)逐端断言可用性
15
+ // + 工具名单精确相等(缺席即空集,不留假工具)。
16
+ // 2. **非能力行**:P5 有几件事**故意没有 manifest 行**(Ralph = workflow 的设置项、
17
+ // 会话同步 = 跨端数据面、auto-review = A3 顺延)。它们必须被**显式断言为「不存在
18
+ // 该行」**,否则「矩阵里没有它」和「忘了写它」在证据上不可区分。
19
+ // 3. **两条正交轴不许混**:部署轴(manifest.deployments)与执行世界轴
20
+ // (EXECUTION_PLANE_DENIALS)是两件事。终端就是典型:部署轴四端全绿,执行世界轴
21
+ // 云端缺席(PTY 不可远程化)。只测一条轴会得出相反结论。
22
+
23
+ import { describe, expect, it } from 'vitest'
24
+
25
+ import {
26
+ availableTools,
27
+ capabilityAvailability,
28
+ computeAvailability,
29
+ type HarnessDeployment,
30
+ type UnavailableReason,
31
+ } from '../availability'
32
+ import { CAPABILITY_REGISTRY } from '../registry'
33
+ import { PROVIDER_IDS, type ProviderId } from '../types'
34
+ import { EXECUTION_PLANE_DENIALS } from '../execution-plane-denials'
35
+ import { deriveMatrixMarkdown } from '../matrix-doc'
36
+ import { agentTerminalManifest } from '../manifests/agent-terminal'
37
+ import { webhookManifest } from '../manifests/webhook'
38
+ import { workflowManifest } from '../manifests/workflow'
39
+ import {
40
+ RALPH_ENABLED_SETTING,
41
+ RALPH_MAX_ROUNDS_SETTING,
42
+ WORKFLOW_SETTINGS,
43
+ } from '../../workflow/settings'
44
+ import { RALPH_DEFAULT_ROUNDS, RALPH_MAX_ROUNDS_CEILING } from '../../workflow/types'
45
+
46
+ const DEPLOYMENTS: ReadonlyArray<HarnessDeployment> = ['oss-web', 'self-hosted', 'saas', 'desktop']
47
+
48
+ type ProviderLookup = ReadonlySet<ProviderId>
49
+
50
+ const ALL_PROVIDERS: ProviderLookup = new Set(PROVIDER_IDS)
51
+
52
+ function availabilityFor(deployment: HarnessDeployment, providers: ProviderLookup = ALL_PROVIDERS) {
53
+ return computeAvailability({
54
+ deployment,
55
+ providers,
56
+ hostEnabled: deployment !== 'oss-web',
57
+ })
58
+ }
59
+
60
+ type ExpectedCell = { available: boolean; reason?: UnavailableReason }
61
+
62
+ const OK: ExpectedCell = { available: true }
63
+
64
+ /**
65
+ * P5 能力行 × 四端(manifest 层,全 Provider 在场)。
66
+ *
67
+ * 三行全部四端就绪是**有意的**结论,不是漏填:
68
+ * - workflow:编排经官方 subagent 派发,阶段脚本走 PTC(进程内 QuickJS isolate),
69
+ * 都不依赖执行平面 Provider;
70
+ * - webhook:规则定义是跨会话投影(同步白名单),接收端点四端各有形态(SaaS/自托管/
71
+ * OSS 走 HTTP 路由、桌面走 embedded Worker 端口);真正的依赖是 scheduler,见下一组用例;
72
+ * - agent-terminal:四端都能开本地终端(部署轴);云**执行世界**的缺席是另一条轴。
73
+ */
74
+ const P5_MATRIX_GRID: Record<string, Record<HarnessDeployment, ExpectedCell>> = {
75
+ workflow: { 'oss-web': OK, 'self-hosted': OK, saas: OK, desktop: OK },
76
+ webhook: { 'oss-web': OK, 'self-hosted': OK, saas: OK, desktop: OK },
77
+ 'agent-terminal': { 'oss-web': OK, 'self-hosted': OK, saas: OK, desktop: OK },
78
+ }
79
+
80
+ describe('P5 四端矩阵网格(能力行,无一行沉默略过)', () => {
81
+ it.each(DEPLOYMENTS)('%s:P5 三行落在预期网格,工具名单精确相等', (deployment) => {
82
+ const availability = availabilityFor(deployment)
83
+ for (const [id, row] of Object.entries(P5_MATRIX_GRID)) {
84
+ const expected = row[deployment]!
85
+ const entry = capabilityAvailability(availability, id)
86
+ expect(entry, `${id} @ ${deployment}`).toBeDefined()
87
+ expect(entry!.available, `${id} @ ${deployment}`).toBe(expected.available)
88
+ expect(entry!.reason ?? undefined, `${id} @ ${deployment}`).toBe(expected.reason)
89
+ }
90
+ // 工具名单精确相等:模型看到的就是 manifest 登记的那几个,多一个少一个都算缺陷。
91
+ expect(capabilityAvailability(availability, 'workflow')!.tools).toEqual([
92
+ 'workflow_start', 'workflow_list', 'workflow_view', 'workflow_cancel',
93
+ ])
94
+ expect(capabilityAvailability(availability, 'webhook')!.tools).toEqual([
95
+ 'webhook_create', 'webhook_list', 'webhook_view', 'webhook_edit', 'webhook_delete',
96
+ ])
97
+ expect(capabilityAvailability(availability, 'agent-terminal')!.tools).toEqual([
98
+ 'terminal_open', 'terminal_send', 'terminal_read', 'terminal_signal', 'terminal_close',
99
+ 'terminal_list', 'user_terminal_read', 'user_terminal_list',
100
+ ])
101
+ })
102
+
103
+ /**
104
+ * 计数断言:**2026-11-28 执行日实测**(不是估的)。
105
+ *
106
+ * 这几个数字会随能力增长而变,所以它们的作用不是「永远为真」,而是**变更时必须显式
107
+ * 改这里**——顺手提醒去跑 `pnpm matrix:gen` 重写文档、核对快照,并把新行补进本文的
108
+ * P5_MATRIX_GRID 或 p3-matrix 的网格。数字变了却没人改这里,就说明有人加了能力但
109
+ * 没进矩阵。
110
+ */
111
+ it('计数断言(2026-11-28 实测):31 能力 / 90 工具;四端 75/86/84/90 工具、25/29/27/31 能力', () => {
112
+ expect(CAPABILITY_REGISTRY).toHaveLength(31)
113
+ const tools = CAPABILITY_REGISTRY.flatMap((manifest) => manifest.tools.map((tool) => tool.name))
114
+ expect(tools).toHaveLength(90)
115
+ // 同名工具跨能力重复登记会让「工具名 → 风险/权益」的查表出现歧义。
116
+ expect(new Set(tools).size).toBe(90)
117
+
118
+ const measured = DEPLOYMENTS.map((deployment) => {
119
+ const availability = availabilityFor(deployment)
120
+ const availableCapabilities = CAPABILITY_REGISTRY.filter(
121
+ (manifest) => capabilityAvailability(availability, manifest.id)?.available,
122
+ )
123
+ return {
124
+ deployment,
125
+ tools: availableTools(availability).length,
126
+ capabilities: availableCapabilities.length,
127
+ }
128
+ })
129
+ expect(measured).toEqual([
130
+ { deployment: 'oss-web', tools: 75, capabilities: 25 },
131
+ { deployment: 'self-hosted', tools: 86, capabilities: 29 },
132
+ { deployment: 'saas', tools: 84, capabilities: 27 },
133
+ { deployment: 'desktop', tools: 90, capabilities: 31 },
134
+ ])
135
+ })
136
+ })
137
+
138
+ describe('P5 缺席语义(依赖 Provider 时不留半成品接口)', () => {
139
+ /**
140
+ * webhook 声明 `requires: ['scheduler']` 且 `unavailable: 'absent'`:scheduler Provider
141
+ * 缺席时四端**一律整体缺席、工具集空**。
142
+ *
143
+ * 为什么必须是 absent 而不是 deny:投递一律经 harness_outbox 由 Worker 驱动,没有
144
+ * Worker 的部署里「能建规则」只是让用户白等——收不到任何投递。缺席即不可见,比
145
+ * 「建得成、永远不触发」诚实。
146
+ */
147
+ it.each(DEPLOYMENTS)('%s:无 scheduler → webhook 整体缺席(reason=provider、工具空)', (deployment) => {
148
+ const entry = capabilityAvailability(availabilityFor(deployment, new Set<ProviderId>()), 'webhook')
149
+ expect(entry, `webhook @ ${deployment}`).toBeDefined()
150
+ expect(entry!.available).toBe(false)
151
+ expect(entry!.reason).toBe('provider')
152
+ expect(entry!.missingProviders).toEqual(['scheduler'])
153
+ expect(entry!.tools).toEqual([])
154
+ })
155
+
156
+ /**
157
+ * workflow 反过来:`requires` 为空 → **Provider 全缺席也照常可用**。编排面不直接碰
158
+ * 执行平面(阶段内调用的 workspace 类工具由各自能力负责),所以不能因为「没有
159
+ * scheduler/sandbox」就把编排判死。
160
+ */
161
+ it.each(DEPLOYMENTS)('%s:无任何 Provider → workflow 仍可用(编排不依赖执行平面)', (deployment) => {
162
+ const entry = capabilityAvailability(availabilityFor(deployment, new Set<ProviderId>()), 'workflow')
163
+ expect(entry!.available).toBe(true)
164
+ expect(entry!.missingProviders).toEqual([])
165
+ expect(entry!.tools).toHaveLength(4)
166
+ })
167
+
168
+ it('manifest 声明自洽:webhook requires scheduler;workflow 四端且无 requires', () => {
169
+ expect(webhookManifest.requires).toEqual(['scheduler'])
170
+ expect(webhookManifest.unavailable).toBe('absent')
171
+ expect(webhookManifest.deployments).toEqual(DEPLOYMENTS)
172
+ expect(workflowManifest.requires).toEqual([])
173
+ expect(workflowManifest.unavailable).toBe('absent')
174
+ expect(workflowManifest.deployments).toEqual(DEPLOYMENTS)
175
+ expect(agentTerminalManifest.deployments).toEqual(DEPLOYMENTS)
176
+ })
177
+ })
178
+
179
+ describe('两条正交轴:部署轴 vs 执行世界轴(终端是典型)', () => {
180
+ /**
181
+ * 部署轴(上一组)说四端全绿;执行世界轴说云端缺席。**两个都对**,因为它们回答不同
182
+ * 问题:前者「这个部署形态里有这个能力吗」,后者「这个执行世界能执行它吗」。PTY 是
183
+ * 活进程,云世界没有可托管的宿主进程 → 装配期按插件名过滤,工具整体不挂载。
184
+ *
185
+ * P5 任务 9 顺带结案 `revisit`:P5 已交付本地三端终端增强(O2 stdin readiness /
186
+ * O3 前台进程组定向信号 / epoch 分流 / 多实例 sticky),云世界**不随之改变**——所以
187
+ * revisit 从 `'P5'` 改为 `'—'`(缺席是终态)。留着 `'P5'` 会让人以为 P5 之后云端
188
+ * 终端该有了,而它永远不会。
189
+ */
190
+ it('agent-terminal:执行世界轴云端 absent + revisit 结案(—)', () => {
191
+ const denial = EXECUTION_PLANE_DENIALS.find((entry) => entry.id === 'agent-terminal')
192
+ expect(denial).toBeDefined()
193
+ expect(denial!.denialMode).toBe('absent')
194
+ expect(denial!.revisit).toBe('—')
195
+ expect(denial!.reason).toBe('pty-belongs-to-p5-terminal')
196
+ // 铁律 3:拒绝必须可引导(云世界用户要被告知去桌面客户端)。
197
+ expect(denial!.guidance).toBe('desktop')
198
+ // 缺席工具面与 manifest 工具面同源(8 个,逐个相等)。
199
+ expect([...denial!.tools]).toEqual(agentTerminalManifest.tools.map((tool) => tool.name))
200
+ })
201
+
202
+ it('执行世界的拒绝账本不含 workflow/webhook(它们是控制面能力,不是执行面)', () => {
203
+ const ids = EXECUTION_PLANE_DENIALS.map((denial) => denial.id as string)
204
+ expect(ids).not.toContain('workflow')
205
+ expect(ids).not.toContain('webhook')
206
+ })
207
+ })
208
+
209
+ describe('非能力行:显式断言「不存在该行」(否则与「忘了写」不可区分)', () => {
210
+ const ids = CAPABILITY_REGISTRY.map((manifest) => manifest.id)
211
+ const toolNames = CAPABILITY_REGISTRY.flatMap((manifest) => manifest.tools.map((tool) => tool.name))
212
+
213
+ /**
214
+ * Ralph(任务 2)不是独立能力:它是 **workflow 的两个设置项**(opt-in 开关 + 线程级
215
+ * 轮数上限)。做成独立能力行会让「关掉 Ralph」看起来像「卸掉一个能力」,而实际语义是
216
+ * 「workflow 的 ralph 模式拒绝启动」(fail-closed,不静默降级为单轮)。
217
+ */
218
+ it('Ralph:无独立能力行,语义落在 workflow 的 settings(默认 off / 硬上限)', () => {
219
+ expect(ids).not.toContain('ralph')
220
+ expect(toolNames.filter((name) => name.startsWith('ralph_'))).toEqual([])
221
+ // 设置与 manifest 同源(settings 面板直接枚举 manifest.settings)。
222
+ expect(workflowManifest.settings.map((setting) => setting.key)).toEqual([
223
+ 'ralphEnabled',
224
+ 'ralphMaxRounds',
225
+ ])
226
+ expect(workflowManifest.settings).toEqual([...WORKFLOW_SETTINGS])
227
+ // opt-in:默认关闭,用户不显式打开就用不了 ralph 模式。
228
+ expect(RALPH_ENABLED_SETTING.default).toBe(false)
229
+ expect(RALPH_ENABLED_SETTING.section).toBe('orchestration')
230
+ expect(RALPH_MAX_ROUNDS_SETTING.default).toBe(RALPH_DEFAULT_ROUNDS)
231
+ expect(RALPH_MAX_ROUNDS_SETTING.max).toBe(RALPH_MAX_ROUNDS_CEILING)
232
+ })
233
+
234
+ /**
235
+ * 会话同步(任务 5)不是模型面能力:它没有工具、没有 prompt、不该出现在能力矩阵里。
236
+ * 它是**跨端数据面**——注册面(`SYNC_TABLES`,18 表)与推送拓扑由 sync-core 负责,
237
+ * 用「部署」这个维度去描述它是错的(同一台桌面既是拉端也是推端)。
238
+ *
239
+ * 这里只钉「矩阵里不该有它」这一半;18 表/拓扑顺序/excludedColumns 那半边在
240
+ * packages/sync-core 的单测里(registrations / push-topology / overlay-migration)。
241
+ */
242
+ it('会话同步:无能力行(是跨端数据面,不是模型面工具)', () => {
243
+ for (const id of ['sync', 'session-sync', 'sessions-sync', 'cross-device-sync']) {
244
+ expect(ids, id).not.toContain(id)
245
+ }
246
+ expect(toolNames.filter((name) => /sync/.test(name))).toEqual([])
247
+ })
248
+
249
+ /**
250
+ * auto-review(任务 6,A3 顺延):官方 0.4.0 无 decide/score/boolean 评审 API,按纪律
251
+ * 不自研,故**不留空能力行**——空行会让人以为「已立项但未实现」,而它连立项条件都
252
+ * 没满足。判据固化在 docs/superpowers/specs/2026-11-28-auto-review-a3-deferral.md。
253
+ */
254
+ it('auto-review:A3 顺延,矩阵不留假行(无 review 能力/工具)', () => {
255
+ expect(ids.filter((id) => /review/i.test(id))).toEqual([])
256
+ expect(toolNames.filter((name) => /review/i.test(name))).toEqual([])
257
+ })
258
+ })
259
+
260
+ describe('矩阵文档与快照一致(pnpm matrix:gen 的产物可被断言)', () => {
261
+ const markdown = deriveMatrixMarkdown()
262
+
263
+ it('每个能力都在文档里有一行,且四端单元格无「—」(无沉默略过)', () => {
264
+ for (const manifest of CAPABILITY_REGISTRY) {
265
+ const row = markdown.split('\n').find((line) => line.startsWith(`| ${manifest.id} |`))
266
+ expect(row, manifest.id).toBeDefined()
267
+ // 单元格只能是 ✅ 或 ❌ <reason>;出现 '—' 就是 availability 没算出条目。
268
+ expect(row, manifest.id).not.toMatch(/\| — \|/)
269
+ expect(row, manifest.id).toMatch(/\| ✅ \||\| ❌ (deployment|provider|host) /)
270
+ }
271
+ // 能力表行数 = 表头 1 行 + 能力行(分隔行 '|---|' 已排除);多/少都说明生成结果被手改。
272
+ const capabilitySection = markdown.slice(0, markdown.indexOf('## 商业 adapter'))
273
+ const capabilityRows = capabilitySection
274
+ .split('\n')
275
+ .filter((line) => line.startsWith('| ') && !line.startsWith('|---'))
276
+ expect(capabilityRows.length).toBe(1 + CAPABILITY_REGISTRY.length)
277
+ })
278
+
279
+ it('P5 三行在文档里,且 webhook/agent-terminal 的缺席/结案在文档中可见', () => {
280
+ for (const id of ['workflow', 'webhook', 'agent-terminal']) {
281
+ expect(markdown).toContain(`| ${id} |`)
282
+ }
283
+ // 执行平面政策小节里,终端缺席是结案状态('—')且说明写着「终态/不可远程化」。
284
+ const section = markdown.slice(markdown.indexOf('## SaaS 执行平面政策(拒绝与缺席)'))
285
+ expect(section).toContain('| agent-terminal |')
286
+ expect(section).toMatch(/agent-terminal \| absent \| pty-belongs-to-p5-terminal \| — \|/)
287
+ expect(section).toContain('不可远程化')
288
+ })
289
+
290
+ it('文档无未替换的占位(undefined / TODO / TBD)', () => {
291
+ expect(markdown).not.toMatch(/undefined|TODO|TBD/)
292
+ })
293
+ })
@@ -29,6 +29,8 @@ import { forgeManifest } from '../manifests/forge'
29
29
  import { mcpManifest } from '../manifests/mcp'
30
30
  import { goalManifest } from '../manifests/goal'
31
31
  import { teamManifest } from '../manifests/team'
32
+ import { webhookManifest } from '../manifests/webhook'
33
+ import { workflowManifest } from '../manifests/workflow'
32
34
  import { agentsManifest } from '../manifests/agents'
33
35
  import { coreHarnessManifest } from '../manifests/core-harness'
34
36
  import { deliverablesManifest } from '../manifests/deliverables'
@@ -250,6 +252,8 @@ describe('Harness capability registry assembly(P3.5 任务 6:存量工具迁
250
252
  'mcp',
251
253
  'goal',
252
254
  'team',
255
+ 'workflow',
256
+ 'webhook',
253
257
  'agents',
254
258
  'deliverables',
255
259
  'question',
@@ -260,9 +264,9 @@ describe('Harness capability registry assembly(P3.5 任务 6:存量工具迁
260
264
  expect(getDeclaredHarnessToolRisk([])).toEqual({})
261
265
  })
262
266
 
263
- it('keeps the compatibility export as an exact 81-key risk record', () => {
267
+ it('keeps the compatibility export as an exact 90-key risk record', () => {
264
268
  expect(typeof HARNESS_TOOL_RISK).toBe('object')
265
- expect(Object.keys(HARNESS_TOOL_RISK)).toHaveLength(81)
269
+ expect(Object.keys(HARNESS_TOOL_RISK)).toHaveLength(90)
266
270
  expect(HARNESS_TOOL_RISK).toEqual({
267
271
  ...storyManifest.tools.reduce((acc, tool) => ({ ...acc, [tool.name]: tool.risk }), {}),
268
272
  ...bugManifest.tools.reduce((acc, tool) => ({ ...acc, [tool.name]: tool.risk }), {}),
@@ -281,6 +285,8 @@ describe('Harness capability registry assembly(P3.5 任务 6:存量工具迁
281
285
  ...Object.fromEntries(mcpManifest.tools.map((tool) => [tool.name, tool.risk])),
282
286
  ...Object.fromEntries(goalManifest.tools.map((tool) => [tool.name, tool.risk])),
283
287
  ...Object.fromEntries(teamManifest.tools.map((tool) => [tool.name, tool.risk])),
288
+ ...Object.fromEntries(workflowManifest.tools.map((tool) => [tool.name, tool.risk])),
289
+ ...Object.fromEntries(webhookManifest.tools.map((tool) => [tool.name, tool.risk])),
284
290
  ...Object.fromEntries(agentsManifest.tools.map((tool) => [tool.name, tool.risk])),
285
291
  ...Object.fromEntries(deliverablesManifest.tools.map((tool) => [tool.name, tool.risk])),
286
292
  ...Object.fromEntries(questionManifest.tools.map((tool) => [tool.name, tool.risk])),
@@ -47,7 +47,13 @@ export interface ExecutionPlaneDenial {
47
47
  denialMode: ExecutionPlaneDenialMode
48
48
  /** 人读原因(中文,进矩阵文档)。 */
49
49
  note: string
50
- revisit: 'P4+' | 'P5'
50
+ /**
51
+ * 计划重访窗口:`P4+`/`P5` = 已排期待重访;`'—'` = **已重访并结案**(缺席是终态,
52
+ * 不再排期)。P5 任务 9 起 agent-terminal 归结案:P5 已交付本地三端终端增强
53
+ * (O2 stdin readiness / O3 前台进程组定向信号 / epoch 分流 + sticky),云执行
54
+ * 世界的终端缺席**不随之改变**——PTY 是活进程,不可远程化。
55
+ */
56
+ revisit: 'P4+' | 'P5' | '—'
51
57
  }
52
58
 
53
59
  export type ExecutionPlaneDenialSummary = Pick<
@@ -185,8 +191,8 @@ export const EXECUTION_PLANE_DENIALS: readonly ExecutionPlaneDenial[] = [
185
191
  reason: 'pty-belongs-to-p5-terminal',
186
192
  guidance: 'desktop',
187
193
  denialMode: 'absent',
188
- note: 'agent 终端是 PTY 长连接,属于 P5 终端 O2/O3/epoch 范围;云执行世界按装配期插件名过滤拒绝,并在 /healthz 与能力矩阵显式记录。',
189
- revisit: 'P5',
194
+ note: 'agent 终端是 PTY 长连接,云执行世界按装配期插件名过滤拒绝,并在 /healthz 与能力矩阵显式记录。P5 已重访结案:终端增强(O2/O3/epoch + 多实例 sticky)只落在本地三端,云端缺席是终态——PTY 不可远程化。',
195
+ revisit: '—',
190
196
  },
191
197
  ]
192
198
 
@@ -45,8 +45,9 @@ export const agentTerminalManifest: CapabilityManifest = {
45
45
  name: 'terminal_signal',
46
46
  risk: 'read',
47
47
  description:
48
- '向 agent 终端发送信号。v1 仅 SIGINT(中断)/SIGTSTP(挂起)生效(控制字符送达,' +
49
- '非前台进程组定向);SIGTERM/SIGKILL/SIGHUP 统一拒绝并引导 terminal_close。',
48
+ '向 agent 终端发送信号。SIGINT/SIGTSTP 以控制字符送达(同用户按键);' +
49
+ 'SIGTERM/SIGKILL/SIGHUP 只定向到前台命令的进程组,不波及 shell 与后台作业' +
50
+ '(前台无命令或探不到前台组时拒绝并引导 terminal_close)。',
50
51
  },
51
52
  {
52
53
  name: 'terminal_close',
@@ -0,0 +1,45 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+
5
+ import type { CapabilityManifest } from '../types'
6
+
7
+ // webhook(P5 任务 3):入站触发器定义与投递。
8
+ //
9
+ // - deployments 四端全列:规则定义是跨会话投影(同步白名单),接收端点在
10
+ // SaaS / 自托管 / OSS 由 HTTP 路由提供,Desktop 由 embedded Worker 端口提供;
11
+ // 投递一律经 harness_outbox(kind='webhook.delivery')由 Worker 驱动。
12
+ // - requires ['scheduler']:投递依赖 outbox/Worker 基础设施(与 schedule 同源
13
+ // Provider)。Provider 缺席时整体缺席,不留「能建规则但无人投递」的半成品接口。
14
+ // - entitlement 不设:入站触发器属基础能力,无付费门控(计划裁决 10 预估一致)。
15
+ // - unavailable 'absent':能力缺席而非调用即拒(不暴露假端点)。
16
+ export const webhookManifest: CapabilityManifest = {
17
+ id: 'webhook',
18
+ version: 1,
19
+ i18nKey: 'capabilities.webhook',
20
+ tools: [
21
+ {
22
+ name: 'webhook_create',
23
+ risk: 'write',
24
+ description: '创建当前线程入站 webhook 触发器(必须配置 repo/owner 白名单)',
25
+ },
26
+ { name: 'webhook_list', risk: 'read', description: '列出当前线程 webhook 触发器' },
27
+ { name: 'webhook_view', risk: 'read', description: '查看当前线程 webhook 触发器' },
28
+ { name: 'webhook_edit', risk: 'write', description: '编辑、暂停或恢复 webhook 触发器' },
29
+ {
30
+ name: 'webhook_delete',
31
+ risk: 'destructive',
32
+ description: '删除 webhook 触发器并取消待投递 delivery',
33
+ },
34
+ ],
35
+ commands: [],
36
+ prompts: [],
37
+ views: [],
38
+ settings: [],
39
+ risk: 'high',
40
+ events: [],
41
+ telemetry: [],
42
+ deployments: ['oss-web', 'self-hosted', 'saas', 'desktop'],
43
+ requires: ['scheduler'],
44
+ unavailable: 'absent',
45
+ }
@@ -0,0 +1,40 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+
5
+ // workflow(P5 任务 1):多阶段 DAG 编排 + Ralph 长跑。
6
+ //
7
+ // - deployments 四端全列:编排面经官方 subagent 派发,四端一致;阶段脚本走 PTC
8
+ // (进程内 QuickJS isolate,不在执行平面拒绝范围)。
9
+ // - requires 空:编排不直接依赖执行平面 Provider;阶段内调用的 workspace 类工具
10
+ // 由各自能力清单的 requires/账本负责,不在此重复声明。
11
+ // - entitlement customAgents:workflow 派发子代理,与 team/subagent 同口径复用
12
+ // 既有权益(HARNESS_TOOL_FEATURE_MAP 同步登记四工具)。
13
+ // - unavailable 'absent':Provider/宿主缺失时整体缺席,不返回假运行态。
14
+ // - settings 两项(P5 任务 2):Ralph opt-in 开关(默认 off)+ 线程级轮数上限;
15
+ // 落 orchestration 设置卡(与 entitlement customAgents 同卡的锁定语义一致)。
16
+ import { WORKFLOW_SETTINGS } from '../../workflow/settings'
17
+ import type { CapabilityManifest } from '../types'
18
+
19
+ export const workflowManifest: CapabilityManifest = {
20
+ id: 'workflow',
21
+ version: 1,
22
+ i18nKey: 'capabilities.workflow',
23
+ tools: [
24
+ { name: 'workflow_start', risk: 'write', description: '启动多阶段 workflow(DAG)并按拓扑序推进' },
25
+ { name: 'workflow_list', risk: 'read', description: '列出当前线程的 workflow 运行' },
26
+ { name: 'workflow_view', risk: 'read', description: '读取单个 workflow 运行的阶段进度' },
27
+ { name: 'workflow_cancel', risk: 'write', description: '取消一个 running 的 workflow' },
28
+ ],
29
+ commands: [],
30
+ prompts: [],
31
+ views: [],
32
+ settings: [...WORKFLOW_SETTINGS],
33
+ risk: 'medium',
34
+ entitlement: 'customAgents',
35
+ events: ['workflow.changed'],
36
+ telemetry: [],
37
+ deployments: ['oss-web', 'self-hosted', 'saas', 'desktop'],
38
+ requires: [],
39
+ unavailable: 'absent',
40
+ }
@@ -28,6 +28,8 @@ import { computerUseManifest } from './manifests/computer-use'
28
28
  import { forgeManifest } from './manifests/forge'
29
29
  import { goalManifest } from './manifests/goal'
30
30
  import { teamManifest } from './manifests/team'
31
+ import { webhookManifest } from './manifests/webhook'
32
+ import { workflowManifest } from './manifests/workflow'
31
33
  import { agentsManifest } from './manifests/agents'
32
34
  import { deliverablesManifest } from './manifests/deliverables'
33
35
  import { questionManifest } from './manifests/question'
@@ -68,6 +70,8 @@ export const CAPABILITY_REGISTRY: CapabilityRegistry = [
68
70
  mcpManifest,
69
71
  goalManifest,
70
72
  teamManifest,
73
+ workflowManifest,
74
+ webhookManifest,
71
75
  agentsManifest,
72
76
  deliverablesManifest,
73
77
  questionManifest,
@@ -105,6 +105,7 @@ function accountRow(overrides: Partial<ConnectorAccountListItem> = {}): Connecto
105
105
  label: 'Acme',
106
106
  expiresAt: null,
107
107
  expired: false,
108
+ hasCredential: true,
108
109
  createdAt: '2026-11-28T00:00:00.000Z',
109
110
  ...overrides,
110
111
  }
@@ -115,7 +116,7 @@ beforeEach(() => {
115
116
  })
116
117
 
117
118
  describe('listConnectorAccounts(列表投影零凭据字段)', () => {
118
- it('行投影只有 id/kind/provider/label/expiresAt/expired/createdAt', async () => {
119
+ it('行投影只有 id/kind/provider/label/expiresAt/expired/hasCredential/createdAt', async () => {
119
120
  mocks.accountFindMany.mockResolvedValue([
120
121
  {
121
122
  id: 'acct-1',
@@ -124,6 +125,7 @@ describe('listConnectorAccounts(列表投影零凭据字段)', () => {
124
125
  provider: 'notion',
125
126
  label: 'Acme',
126
127
  expiresAt: new Date('2020-01-01T00:00:00Z'),
128
+ secretCipher: 'encrypted-blob',
127
129
  createdAt: new Date('2026-01-01T00:00:00Z'),
128
130
  },
129
131
  ])
@@ -131,9 +133,28 @@ describe('listConnectorAccounts(列表投影零凭据字段)', () => {
131
133
  expect(rows).toHaveLength(1)
132
134
  expect(JSON.stringify(rows[0])).not.toMatch(/token|secret|cipher/i)
133
135
  expect(rows[0].expired).toBe(true)
136
+ expect(rows[0].hasCredential).toBe(true)
134
137
  // 属主收敛:where 带 userId
135
138
  expect(mocks.accountFindMany.mock.calls[0][0].where).toEqual({ userId: 'user-1' })
136
139
  })
140
+
141
+ it('跨端同步而来的元数据行(secretCipher NULL)标 hasCredential=false', async () => {
142
+ mocks.accountFindMany.mockResolvedValue([
143
+ {
144
+ id: 'acct-synced',
145
+ userId: 'user-1',
146
+ kind: 'oauth',
147
+ provider: 'notion',
148
+ label: 'Acme',
149
+ expiresAt: null,
150
+ secretCipher: null,
151
+ createdAt: new Date('2026-01-01T00:00:00Z'),
152
+ },
153
+ ])
154
+ const rows = await listConnectorAccounts('user-1')
155
+ // 元数据可见(跨端定义一致),但凭据不在本机 → 需重新授权。
156
+ expect(rows[0]).toMatchObject({ provider: 'notion', label: 'Acme', hasCredential: false })
157
+ })
137
158
  })
138
159
 
139
160
  describe('revokeConnectorAccount(撤销 + 属主隔离)', () => {
@@ -36,6 +36,11 @@ export interface ConnectorAccountListItem {
36
36
  label: string
37
37
  expiresAt: string | null
38
38
  expired: boolean
39
+ /**
40
+ * 凭据是否在本设备可用(P5 任务 5):跨端同步只带元数据,凭据不跨端 →
41
+ * 同步而来的账号 hasCredential=false,须在本设备重新授权后该连接器才可用。
42
+ */
43
+ hasCredential: boolean
39
44
  createdAt: string
40
45
  }
41
46
 
@@ -46,6 +51,7 @@ const CONNECTOR_ACCOUNT_SELECT = {
46
51
  provider: true,
47
52
  label: true,
48
53
  expiresAt: true,
54
+ secretCipher: true,
49
55
  createdAt: true,
50
56
  } as const
51
57
 
@@ -64,6 +70,7 @@ export async function listConnectorAccounts(userId: string): Promise<ConnectorAc
64
70
  label: row.label,
65
71
  expiresAt: row.expiresAt ? row.expiresAt.toISOString() : null,
66
72
  expired: row.expiresAt ? row.expiresAt.getTime() <= now : false,
73
+ hasCredential: row.secretCipher !== null,
67
74
  createdAt: row.createdAt.toISOString(),
68
75
  }))
69
76
  }
@@ -112,7 +112,9 @@ function serializeConnectorCredential(credential: Credential): string {
112
112
  throw new Error('[harness] connector 不支持 secret_answer 凭据。')
113
113
  }
114
114
 
115
- function deserializeConnectorCredential(stored: string): Credential | null {
115
+ function deserializeConnectorCredential(stored: string | null): Credential | null {
116
+ // null = 跨端同步而来的元数据行(P5 任务 5):凭据留原设备,本机自然缺席。
117
+ if (!stored) return null
116
118
  const value = decryptApiKey(stored)
117
119
  if (!value) return null
118
120
  let parsed: unknown
@@ -92,11 +92,13 @@ import { buildSkillsStack } from '@/server/ai-gateway/skills'
92
92
  import { harnessWebToolsOptions } from '@/server/harness/web-tools.server'
93
93
  import { probeGit } from '@/server/harness/git-probe.server'
94
94
  import { createSchedulePlugin } from '@/server/harness/schedule/schedule.plugin'
95
+ import { createWebhookPlugin } from '@/server/harness/webhook/webhook.plugin'
95
96
  import { createJobsPlugin } from '@/server/harness/jobs/jobs.plugin'
96
97
  import { createMcpPlugin } from '@/server/harness/mcp/mcp.plugin'
97
98
  import { createGoalPlugin } from '@/server/harness/goal/goal.plugin'
98
99
  import { createGoalToolsPlugin } from '@/server/harness/goal/goal-tools.server'
99
100
  import { teamPlugin } from '@/server/harness/team/team.plugin'
101
+ import { workflowPlugin } from '@/server/harness/workflow/workflow.plugin'
100
102
  import { agentControlPlugin } from '@/server/harness/agents/agent-control.plugin'
101
103
  import { agentControlLogReduce } from '@/server/harness/agents/run-view.server'
102
104
  import { createPresentPlugin } from '@/server/harness/deliverables/present.plugin'
@@ -405,6 +407,9 @@ function harnessPlugins(
405
407
  },
406
408
  }
407
409
  const schedulePlugin = createSchedulePlugin(providers.get('scheduler'))
410
+ // webhook(P5 任务 3):投递依赖 outbox/Worker(与 schedule 同源 scheduler Provider)。
411
+ // Provider 缺席即整体缺席——不留「能建规则但无人投递」的半成品接口(纪律②)。
412
+ const webhookPlugin = createWebhookPlugin(providers.get('scheduler'))
408
413
  const sessionSearchPlugin = createSessionSearchPlugin({ provider: providers.get('sessionSearch') })
409
414
  // MCP(P1c):配置来自 DB(harness_mcp_servers + connector 凭据),与旧链的 env
410
415
  // 名单解耦。插件按 turn.run.user 加载该用户的服务器,工具名 `<server>_<tool>`;
@@ -486,6 +491,11 @@ function harnessPlugins(
486
491
  // 官方 goal 循环与工具成对挂载:无 adapter 时既无 judge 也无命令,避免遗留孤儿工具。
487
492
  ...(titleAdapter ? [createGoalPlugin(titleAdapter), createGoalToolsPlugin()] : []),
488
493
  teamPlugin,
494
+ // workflow(P5 任务 1):多阶段 DAG 编排 + Ralph。编排四端一致(官方 subagent
495
+ // 派发);阶段脚本走 PTC(进程内 QuickJS isolate),不在执行平面拒绝范围。
496
+ // 挂载守卫与 agents/agentControl 同源(titleAdapter):无 adapter 时官方 agents
497
+ // 插件不挂载,session.agent() 无从派发——workflow 整体缺席(无假工具)。
498
+ ...(titleAdapter ? [workflowPlugin] : []),
489
499
  // 交付物:本地执行世界全量可用(file 引用经 bind 的真实工作区校验);云端没有
490
500
  // 可校验的真实工作区(执行平面不提供,拒绝后端不可 stat),file/snapshot 稳定
491
501
  // 拒绝(deliverable_workspace_unavailable),media/url 不受影响(P3.5 任务 2)。
@@ -572,6 +582,7 @@ function harnessPlugins(
572
582
  createPluginManagerPlugin(),
573
583
  ...(sessionSearchPlugin ? [sessionSearchPlugin] : []),
574
584
  ...(schedulePlugin ? [schedulePlugin] : []),
585
+ ...(webhookPlugin ? [webhookPlugin] : []),
575
586
  ]
576
587
  }
577
588
 
@@ -347,7 +347,9 @@ export function createPrismaMcpStore(): McpStore {
347
347
  }
348
348
 
349
349
  /** 凭据列格式与 credentials.server 一致:{ type:'api_key', value }。 */
350
- function decryptSecretValue(cipher: string): string | null {
350
+ function decryptSecretValue(cipher: string | null): string | null {
351
+ // null = 跨端同步而来的元数据行(P5 任务 5):凭据留原设备,本机视为未配置。
352
+ if (!cipher) return null
351
353
  const plain = decryptApiKey(cipher)
352
354
  if (!plain) return null
353
355
  try {