@ai-zen/agents-host 0.1.0-alpha.2 → 0.1.0-alpha.4

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 (42) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/app.d.ts +0 -5
  3. package/dist/app.js +3 -9
  4. package/dist/config.d.ts +3 -2
  5. package/dist/config.js +30 -4
  6. package/dist/handlers/configHandlers.d.ts +1 -3
  7. package/dist/handlers/conversationHandlers.d.ts +0 -2
  8. package/dist/handlers/conversationHandlers.js +2 -16
  9. package/dist/handlers/hostHandlers.d.ts +4 -5
  10. package/dist/handlers/hostHandlers.js +3 -21
  11. package/dist/handlers/index.d.ts +2 -4
  12. package/dist/handlers/index.js +0 -1
  13. package/dist/handlers/noticeHandlers.d.ts +0 -8
  14. package/dist/handlers/noticeHandlers.js +0 -10
  15. package/dist/i18n/en.d.ts +0 -168
  16. package/dist/i18n/en.js +0 -171
  17. package/dist/i18n/zh.d.ts +0 -168
  18. package/dist/i18n/zh.js +0 -169
  19. package/dist/index.d.ts +1 -0
  20. package/dist/net/WsHub.d.ts +1 -2
  21. package/dist/net/WsHub.js +0 -2
  22. package/dist/services/AutoNaming.d.ts +0 -5
  23. package/dist/services/AutoNaming.js +0 -18
  24. package/dist/services/ConfigService.d.ts +2 -2
  25. package/dist/services/ConfigService.js +11 -20
  26. package/dist/services/DiscoveryService.d.ts +10 -2
  27. package/dist/services/DiscoveryService.js +10 -2
  28. package/dist/services/ModelService.d.ts +1 -3
  29. package/dist/services/ModelService.js +0 -4
  30. package/dist/services/QuestionService.d.ts +0 -7
  31. package/dist/services/QuestionService.js +0 -15
  32. package/dist/storage/ConversationRepository.d.ts +0 -3
  33. package/dist/storage/ConversationRepository.js +0 -12
  34. package/dist/storage/QuestionRepository.d.ts +0 -1
  35. package/dist/storage/QuestionRepository.js +0 -4
  36. package/dist/storage/types.d.ts +0 -2
  37. package/dist/wire/methods.d.ts +4 -52
  38. package/dist/wire/methods.js +0 -5
  39. package/dist/wire/states.d.ts +5 -12
  40. package/package.json +4 -3
  41. package/dist/handlers/capabilities.d.ts +0 -26
  42. package/dist/handlers/capabilities.js +0 -138
package/CHANGELOG.md CHANGED
@@ -3,6 +3,45 @@
3
3
  All notable changes to `@ai-zen/agents-host` are documented here.
4
4
  Format follows [Keep a Changelog](https://keepachangelog.com/); versions use SemVer.
5
5
 
6
+ ## [0.1.0-alpha.4] - 2026-11-14
7
+
8
+ > The capability list is gone. `host.capabilities` existed to tell clients "what this build can
9
+ > do", but the only client that ever read it was the TUI's `/help` — and `/help` already had a
10
+ > local command table. A list that duplicates a list is a list that drifts: the host called it
11
+ > "项目", the CLI called it "工作区". So the method, its 252 copy entries and the `CapabilityView`
12
+ > shape are removed — **63 → 62 methods** — and the CLI's `/help` now costs zero round trips.
13
+ >
14
+ > Ships on `@ai-zen/agents-core@4.6.0-alpha.0` + `@ai-zen/agents-sdk@1.2.0-alpha.2` (both
15
+ > unchanged since the previous alpha, so this release is host-only).
16
+
17
+ ### ⚠️ Breaking
18
+
19
+ - **`host.capabilities` removed** (63 → 62 methods), together with `hello.capabilities`,
20
+ `CapabilityView` / `HostCapabilitiesResult` / `MethodDomain`, the `handlers/capabilities.ts`
21
+ wiring and 252 `capability.*` strings. Nothing depended on it: the CLI's `/help` is local
22
+ now, the Desktop never called it.
23
+ - **`host.reload` no longer takes `scope`** — the host is the only one who knows what is
24
+ reloadable, so it decides; `reloadedOf()` is unconditionally `true`.
25
+ - **`StatusBlock.label` removed** — block names are client concepts ("sidebar" is not a host
26
+ word). The CLI carries its own eight `status.block.*` strings.
27
+
28
+ ### 🧹 Changed
29
+
30
+ - **i18n now has a consumer rule**: the 33 entries no production code ever emitted are deleted,
31
+ and a guard test fails the suite if any entry has no reader. PLAN.md §7.5 keeps the 19 cases
32
+ where the host *should* say something and currently says nothing — those are gaps, not strings.
33
+ - 4 exports with zero references removed, along with the long-dead `localizeCapabilities`.
34
+ - The two real-process cases moved to `test:e2e` (out of the default suite's 759); test fixtures
35
+ went "one file, one database" with one `db.tx()` table wipe.
36
+
37
+ ## [0.1.0-alpha.1 … 0.1.0-alpha.3] - 2026-11-14
38
+
39
+ - **`agents-host` bin got its shebang** (alpha.1) — without it `npm i -g` installed a file the
40
+ shell refuses to execute.
41
+ - **A configuration file that does not parse is reset to factory values** and written back, the
42
+ broken one kept as `<name>.broken`, plus one warning notice naming the file (D32;
43
+ alpha.2 / alpha.3). No fallback layers, no throwing upwards.
44
+
6
45
  ## [0.1.0] - 2026-11-09
7
46
 
8
47
  First extraction step. The package exists so that CLI and Desktop stop maintaining two
package/dist/app.d.ts CHANGED
@@ -39,7 +39,6 @@ import { ModelService } from "./services/ModelService.js";
39
39
  import { NoticeService } from "./services/NoticeService.js";
40
40
  import { QuestionService } from "./services/QuestionService.js";
41
41
  import { AssetRepository, ConversationRepository, CredentialRepository, Database, MessageRepository, NoticeRepository, QuestionRepository, WorkspaceRepository } from "./storage/index.js";
42
- import type { CapabilityView } from "./wire/index.js";
43
42
  /**
44
43
  * 起一个低频定时器,返回取消函数。
45
44
  *
@@ -97,8 +96,6 @@ export interface HostAppOptions {
97
96
  clock?: Clock;
98
97
  /** 真退出时做什么;缺省 `process.exit(0)` */
99
98
  exit?: ExitHook;
100
- /** 能力清单(PRD F-E5);缺省用 `handlers/capabilities.ts` 里那份与契约同步的清单 */
101
- capabilities?: (language: Language) => CapabilityView[];
102
99
  /** 连接未声明语言时的缺省语言(PRD D8);不给时用配置里的 `language`,再缺省英文 */
103
100
  defaultLanguage?: Language;
104
101
  /** 日志口(连接事件与内部错误);缺省写到 `<dataRoot>/logs/host.log` 并按大小轮转 */
@@ -168,8 +165,6 @@ export declare class HostApp {
168
165
  readonly handlers: HandlerTable;
169
166
  /** 宿主版本(`hello` 与 `host.version` 报的那一个) */
170
167
  readonly version: string;
171
- /** 能力清单(PRD F-E5:帮助页与指令菜单按它渲染;按给定语言出句子) */
172
- readonly capabilities: (language: Language) => CapabilityView[];
173
168
  /** 进程启动时刻(ISO 8601) */
174
169
  readonly startedAt: string;
175
170
  /** 是不是本地实例(PRD A6:决定监听范围与要不要发本地凭证交付文件) */
package/dist/app.js CHANGED
@@ -21,7 +21,7 @@ import { mkdir } from "node:fs/promises";
21
21
  import { join } from "node:path";
22
22
  import { AgentRepository, ConfigManager } from "@ai-zen/agents-sdk";
23
23
  import { readHostSettings, resolveListenTarget, resolvePaths } from "./config.js";
24
- import { createCapabilities, createHandlers } from "./handlers/index.js";
24
+ import { createHandlers } from "./handlers/index.js";
25
25
  import { DEFAULT_LANGUAGE, normalizeLanguage } from "./i18n/index.js";
26
26
  import { clearHostFile, createLocalCredential, createTokenVerifier, readHostFile, UploadReceiver, writeHostFile, WsHub, } from "./net/index.js";
27
27
  import { ChatRunner, createSdkAgentFactory, createWorkspaceScopeFactory, RunRegistry, ScopeRegistry, systemClock, } from "./runtime/index.js";
@@ -162,8 +162,6 @@ export class HostApp {
162
162
  handlers;
163
163
  /** 宿主版本(`hello` 与 `host.version` 报的那一个) */
164
164
  version;
165
- /** 能力清单(PRD F-E5:帮助页与指令菜单按它渲染;按给定语言出句子) */
166
- capabilities;
167
165
  /** 进程启动时刻(ISO 8601) */
168
166
  startedAt;
169
167
  /** 是不是本地实例(PRD A6:决定监听范围与要不要发本地凭证交付文件) */
@@ -427,7 +425,6 @@ export class HostApp {
427
425
  // ---- 9. 接线:方法表 + 一条 WebSocket ----
428
426
  this.handlers = createHandlers(this.handlerDeps());
429
427
  const target = this.resolveTarget();
430
- this.capabilities = options.capabilities ?? ((language) => createCapabilities(language));
431
428
  this.hub = new WsHub({
432
429
  host: target.host,
433
430
  port: target.port,
@@ -436,8 +433,6 @@ export class HostApp {
436
433
  uploads: this.uploads,
437
434
  hostVersion: this.version,
438
435
  startedAt: this.startedAt,
439
- // 握手只用它的 id(R57);`host.capabilities` 按连接语言重渲染(R58)
440
- capabilities: (language) => this.capabilities(language),
441
436
  // 连接没带语言时用配置里的缺省语言(再缺省英文,D8 / R58);配置可变,所以每一跳现读
442
437
  defaultLanguage: options.defaultLanguage ?? (() => this.configuredLanguage()),
443
438
  // 通知与问题里的句子按收件人那条连接的语言重新渲染一次(D8)
@@ -767,7 +762,6 @@ export class HostApp {
767
762
  return {
768
763
  version: this.version,
769
764
  startedAt: this.startedAt,
770
- capabilities: () => this.capabilities(DEFAULT_LANGUAGE),
771
765
  workspaces: this.workspaceService,
772
766
  conversations: this.conversationService,
773
767
  messages: this.messageService,
@@ -810,8 +804,8 @@ export class HostApp {
810
804
  upgrade: (params) => this.upgradeHost(params),
811
805
  // 从磁盘重载(F-E1 / R63):走配置服务那条「生效」路(回收 Scope + 合成一条通知);
812
806
  // 思考策略表是启动时的快照,重载时一并重读(否则改完档位表要等 setThinking 才生效)
813
- reload: async (params) => {
814
- const report = await this.configService.reload(params);
807
+ reload: async () => {
808
+ const report = await this.configService.reload();
815
809
  this.presets = await this.configManager.readReasoningPresets();
816
810
  return report;
817
811
  },
package/dist/config.d.ts CHANGED
@@ -92,8 +92,9 @@ export interface HostSettings {
92
92
  * 读 `<dataRoot>/host.json`。
93
93
  *
94
94
  * 三种情况分开:文件不在 → 空设置(这一档没说话,静默);读不出来 / 不是 JSON / 不是对象 →
95
- * 就是坏文件,恢复出厂:当空设置用(默认端口、默认语言)、写回一份合法的 `{}`、回调一次
96
- * (D32:坏了就恢复出厂,下次启动不再遇到同一个坏文件);`port` 在但不是可用端口 →
95
+ * 就是坏文件,恢复出厂:先把坏文件改名留档为 `host.json.broken`、再写回一份合法的 `{}`、
96
+ * 再回调一次(D32:坏了就恢复出厂,下次启动不再遇到同一个坏文件;留档是数据,不是兜底 ——
97
+ * 用户手写的端口设置得能查回来);`port` 在但不是可用端口 →
97
98
  * `config_invalid`(裁定 R67:显式给出的非法值报错,不静默回落)。
98
99
  */
99
100
  export declare function readHostSettings(paths: HostPaths, onRecovered?: ConfigRecoveredHandler): Promise<HostSettings>;
package/dist/config.js CHANGED
@@ -1,4 +1,4 @@
1
- import { readFile, writeFile } from "node:fs/promises";
1
+ import { access, readFile, rename, writeFile } from "node:fs/promises";
2
2
  import { homedir } from "node:os";
3
3
  import { join } from "node:path";
4
4
  import { HostError } from "./wire/errors.js";
@@ -120,8 +120,9 @@ function invalidPort(field, value, source) {
120
120
  * 读 `<dataRoot>/host.json`。
121
121
  *
122
122
  * 三种情况分开:文件不在 → 空设置(这一档没说话,静默);读不出来 / 不是 JSON / 不是对象 →
123
- * 就是坏文件,恢复出厂:当空设置用(默认端口、默认语言)、写回一份合法的 `{}`、回调一次
124
- * (D32:坏了就恢复出厂,下次启动不再遇到同一个坏文件);`port` 在但不是可用端口 →
123
+ * 就是坏文件,恢复出厂:先把坏文件改名留档为 `host.json.broken`、再写回一份合法的 `{}`、
124
+ * 再回调一次(D32:坏了就恢复出厂,下次启动不再遇到同一个坏文件;留档是数据,不是兜底 ——
125
+ * 用户手写的端口设置得能查回来);`port` 在但不是可用端口 →
125
126
  * `config_invalid`(裁定 R67:显式给出的非法值报错,不静默回落)。
126
127
  */
127
128
  export async function readHostSettings(paths, onRecovered) {
@@ -154,13 +155,38 @@ export async function readHostSettings(paths, onRecovered) {
154
155
  return { port };
155
156
  }
156
157
  /**
157
- * 坏掉之后恢复出厂:写回一份合法的 `{}`(=默认端口、默认语言),再回调一次。
158
+ * 坏掉之后恢复出厂:先把坏文件留档,再写回一份合法的 `{}`(=默认端口、默认语言),再回调一次。
158
159
  */
159
160
  async function recoverHostSettings(paths, onRecovered) {
161
+ await archiveBroken(paths.hostConfigFile);
160
162
  await writeFile(paths.hostConfigFile, "{}\n", "utf8");
161
163
  await onRecovered?.(paths.hostConfigFile);
162
164
  return {};
163
165
  }
166
+ /**
167
+ * 把坏掉的设置文件改名留档为 `host.json.broken`。
168
+ *
169
+ * 与 SDK 的 `ConfigManager.archiveBroken()` 同一条规则(三个配置文件同一口径):同名残骸
170
+ * 已经在就带上时间戳(同一毫秒再撞上就补序号),不覆盖上一份残骸。
171
+ */
172
+ async function archiveBroken(path) {
173
+ const base = `${path}.broken`;
174
+ let target = base;
175
+ for (let index = 0; await exists(target); index += 1) {
176
+ target = index === 0 ? `${base}.${Date.now()}` : `${base}.${Date.now()}-${index}`;
177
+ }
178
+ await rename(path, target);
179
+ }
180
+ /** 这个路径在不在(`access` 不抛就是在) */
181
+ async function exists(path) {
182
+ try {
183
+ await access(path);
184
+ return true;
185
+ }
186
+ catch {
187
+ return false;
188
+ }
189
+ }
164
190
  function isMissingFile(error) {
165
191
  return (typeof error === "object" &&
166
192
  error !== null &&
@@ -7,7 +7,7 @@
7
7
  * 业务判断都在 `services/ConfigService.ts`;这里没有一条分支是在决定「该怎么算」。
8
8
  */
9
9
  import { type Language } from "../i18n/index.js";
10
- import type { HandlerTable, MethodHandler } from "../net/WsHub.js";
10
+ import type { HandlerTable } from "../net/WsHub.js";
11
11
  import type { ConfigService } from "../services/ConfigService.js";
12
12
  /** 本文件负责的方法名(其余域各有各的文件) */
13
13
  export type ConfigHandlerName = "config.get" | "config.patch" | "config.setDefaults" | "config.getDiscovery" | "config.saveMcp" | "config.deleteMcp" | "config.saveEndpoint" | "config.deleteEndpoint";
@@ -27,5 +27,3 @@ export interface ConfigHandlerDeps {
27
27
  export declare function localizeLocalizedTexts<T>(value: T, language: Language): T;
28
28
  /** 造出 `config.*` 的 handler 表 */
29
29
  export declare function createConfigHandlers(deps: ConfigHandlerDeps): ConfigHandlers;
30
- /** 单个方法也导出,便于用例直接调(不必造整张表) */
31
- export type ConfigMethodHandler<M extends ConfigHandlerName> = MethodHandler<M>;
@@ -86,8 +86,6 @@ export interface StatusBlockInput {
86
86
  context: ContextState;
87
87
  /** 累计用量 */
88
88
  usage: UsageSnapshot;
89
- /** 收件人的语言(块的标签是给人看的一句话) */
90
- language: Language;
91
89
  }
92
90
  /**
93
91
  * 按 `STATUS_BLOCK_IDS` 的顺序拼装状态栏的块(PRD F-I6 / 裁定 R65)。
@@ -15,7 +15,6 @@
15
15
  * - `conversation.transient` 走不落库的那条执行路径(R1 / R49)。
16
16
  */
17
17
  import { addUsage, sumUsage, ZERO_USAGE } from "@ai-zen/agents-core";
18
- import { render } from "../i18n/index.js";
19
18
  import { STATUS_BLOCK_IDS } from "../wire/index.js";
20
19
  import { localizeOutcome } from "./assetHandlers.js";
21
20
  /**
@@ -162,7 +161,7 @@ async function conversationStateOf(deps, conversationId, language) {
162
161
  thinking: conversation.thinking,
163
162
  usage,
164
163
  questions: deps.questionsFor ? await deps.questionsFor(conversationId) : [],
165
- statusBlocks: statusBlocksOf({ conversation, agent, run, context, usage, language }),
164
+ statusBlocks: statusBlocksOf({ conversation, agent, run, context, usage }),
166
165
  updatedAt: now,
167
166
  },
168
167
  // 这份消息就是上面算用量与上下文用的那一次读取,不是又读一遍
@@ -185,11 +184,6 @@ async function agentFactOf(deps, agentId) {
185
184
  return { name: null, available: null };
186
185
  return { name: described.name, available: described.available };
187
186
  }
188
- /** 块的标签(`label.agent` / `label.model` …,PRD F-I6:宿主给块名,客户端排版) */
189
- function blockLabel(id, language) {
190
- const messageKey = `label.${id}`;
191
- return { code: messageKey, messageKey, params: {}, message: render(language, messageKey) };
192
- }
193
187
  /**
194
188
  * 按 `STATUS_BLOCK_IDS` 的顺序拼装状态栏的块(PRD F-I6 / 裁定 R65)。
195
189
  *
@@ -202,48 +196,40 @@ function blockLabel(id, language) {
202
196
  * (`input.agent`):本函数保持同步纯函数,不在这里做 IO。
203
197
  */
204
198
  export function statusBlocksOf(input) {
205
- const { conversation, agent, run, context, usage, language } = input;
199
+ const { conversation, agent, run, context, usage } = input;
206
200
  const generation = run.generation;
207
201
  const runningTools = generation?.phase === "awaiting_tools" ? generation.runningTools : [];
208
202
  const blocks = {
209
203
  agent: {
210
204
  id: "agent",
211
- label: blockLabel("agent", language),
212
205
  facts: { agentId: conversation.agentId, name: agent.name, available: agent.available },
213
206
  },
214
207
  model: {
215
208
  id: "model",
216
- label: blockLabel("model", language),
217
209
  facts: conversation.model,
218
210
  },
219
211
  thinking: {
220
212
  id: "thinking",
221
- label: blockLabel("thinking", language),
222
213
  facts: conversation.thinking,
223
214
  },
224
215
  context: {
225
216
  id: "context",
226
- label: blockLabel("context", language),
227
217
  facts: context,
228
218
  },
229
219
  usage: {
230
220
  id: "usage",
231
- label: blockLabel("usage", language),
232
221
  facts: usage,
233
222
  },
234
223
  cwd: {
235
224
  id: "cwd",
236
- label: blockLabel("cwd", language),
237
225
  facts: conversation.folder,
238
226
  },
239
227
  tools: {
240
228
  id: "tools",
241
- label: blockLabel("tools", language),
242
229
  facts: { running: runningTools },
243
230
  },
244
231
  subagents: {
245
232
  id: "subagents",
246
- label: blockLabel("subagents", language),
247
233
  facts: { items: run.subagents },
248
234
  },
249
235
  };
@@ -2,8 +2,8 @@
2
2
  * `host.*`:进程事实(PRD F-E5 / D4 / L4)。
3
3
  *
4
4
  * 三件事在这里:
5
- * - `version` / `capabilities`:报事实,供帮助页与指令菜单渲染(能力清单只在配置层维护一份,
6
- * 这里不编造);
5
+ * - `version` / `capabilities`:报事实(能力清单只在配置层维护一份,这里不编造;
6
+ * 清单里没有文案 —— 一份能力怎么跟用户说,归客户端);
7
7
  * - `upgrade`:比磁盘上的版本与正在跑的版本,确认新版本真的落盘了才安排重启(D4 / F-E3);
8
8
  * - `shutdown`:受理一次收尾请求。真正退不退由单根的退出判据决定(PRD L4 / 裁定 R53)。
9
9
  *
@@ -18,7 +18,7 @@
18
18
  * 没有任何客户端消费,已从契约面删除。
19
19
  */
20
20
  import type { HandlerTable } from "../net/index.js";
21
- import type { CapabilityView, HostReloadParams, HostReloadResult, HostUpgradeParams, HostUpgradeResult } from "../wire/index.js";
21
+ import type { HostReloadResult, HostUpgradeParams, HostUpgradeResult } from "../wire/index.js";
22
22
  /** `host.*` 的实现要的持有者 */
23
23
  export interface HostHandlerDeps {
24
24
  /** 宿主版本(`hello` 报的那一个) */
@@ -26,11 +26,10 @@ export interface HostHandlerDeps {
26
26
  /** 进程启动时刻(ISO 8601) */
27
27
  startedAt: string;
28
28
  /** 能力清单(PRD F-E5);内容归配置层,本轮由单根注入 */
29
- capabilities: () => CapabilityView[];
30
29
  /** 请求收尾(`host.shutdown`):单根排程,先让回包写出去 */
31
30
  requestStop: (reason?: string) => void;
32
31
  /** 从磁盘重载(`host.reload`):配置服务那边跑「生效」那条路(回收 Scope + 合成通知) */
33
- reload: (params: HostReloadParams) => Promise<HostReloadResult>;
32
+ reload: () => Promise<HostReloadResult>;
34
33
  /** 升级判定与重启排程(磁盘版本归单根去读,这里只把结论转给客户端) */
35
34
  upgrade: HostUpgradeHandler;
36
35
  }
@@ -2,8 +2,8 @@
2
2
  * `host.*`:进程事实(PRD F-E5 / D4 / L4)。
3
3
  *
4
4
  * 三件事在这里:
5
- * - `version` / `capabilities`:报事实,供帮助页与指令菜单渲染(能力清单只在配置层维护一份,
6
- * 这里不编造);
5
+ * - `version` / `capabilities`:报事实(能力清单只在配置层维护一份,这里不编造;
6
+ * 清单里没有文案 —— 一份能力怎么跟用户说,归客户端);
7
7
  * - `upgrade`:比磁盘上的版本与正在跑的版本,确认新版本真的落盘了才安排重启(D4 / F-E3);
8
8
  * - `shutdown`:受理一次收尾请求。真正退不退由单根的退出判据决定(PRD L4 / 裁定 R53)。
9
9
  *
@@ -17,7 +17,6 @@
17
17
  * `conversation.state` 的 `usage`(`UsageSnapshot`)给,`host.usage` 的「按项目 / 整机」聚合
18
18
  * 没有任何客户端消费,已从契约面删除。
19
19
  */
20
- import { relocalizeText } from "../services/NoticeService.js";
21
20
  import { PROTOCOL_VERSION } from "../wire/index.js";
22
21
  export function createHostHandlers(deps) {
23
22
  return {
@@ -27,10 +26,6 @@ export function createHostHandlers(deps) {
27
26
  startedAt: deps.startedAt,
28
27
  pid: process.pid,
29
28
  }),
30
- "host.capabilities": (context) => ({
31
- // 清单按这条连接的语言出句子(裁定 R58):id / 顺序与语言无关(R57)
32
- capabilities: localizeCapabilities(deps.capabilities(), context.connection.language),
33
- }),
34
29
  "host.shutdown": (context) => {
35
30
  deps.requestStop(context.params.reason);
36
31
  return { accepted: true };
@@ -38,19 +33,6 @@ export function createHostHandlers(deps) {
38
33
  // 升级即重启(D4 / F-E3):结论由单根给,它知道磁盘上的版本与重启排程
39
34
  "host.upgrade": async (context) => await deps.upgrade(context.params),
40
35
  // 重载不重启(F-E1 / F-E2 / R63):与改配置走同一条生效路径,回同一份报告
41
- "host.reload": async (context) => await deps.reload(context.params),
36
+ "host.reload": async () => await deps.reload(),
42
37
  };
43
38
  }
44
- /**
45
- * 能力清单按这条连接的语言重渲染(裁定 R58)。
46
- *
47
- * 清单本身由配置层按缺省语言产出(每项的标题与说明都带着 `messageKey` + `params`),这里只把
48
- * 句子换成收件人的语言 —— 与通知、问题出网前那一跳同一个口径(D8:存码不存句子)。
49
- */
50
- function localizeCapabilities(capabilities, language) {
51
- return capabilities.map((capability) => ({
52
- ...capability,
53
- title: relocalizeText(capability.title, language),
54
- description: relocalizeText(capability.description, language),
55
- }));
56
- }
@@ -34,7 +34,7 @@ import type { NoticeService } from "../services/NoticeService.js";
34
34
  import type { QuestionService } from "../services/QuestionService.js";
35
35
  import type { SearchService } from "../services/SearchService.js";
36
36
  import type { WorkspaceService } from "../services/WorkspaceService.js";
37
- import type { CapabilityView, MethodName, QuestionView, HostReloadParams, HostReloadResult } from "../wire/index.js";
37
+ import type { MethodName, QuestionView, HostReloadResult } from "../wire/index.js";
38
38
  import type { EventMap, EventName } from "../wire/events.js";
39
39
  export type { AgentHandlerDeps } from "./agentHandlers.js";
40
40
  export type { AssetHandlerDeps } from "./assetHandlers.js";
@@ -49,7 +49,6 @@ export type { QuestionHandlerDeps } from "./questionHandlers.js";
49
49
  export type { SearchHandlerDeps } from "./searchHandlers.js";
50
50
  export type { HostHandlerDeps } from "./hostHandlers.js";
51
51
  export type { WorkspaceHandlerDeps } from "./workspaceHandlers.js";
52
- export { createCapabilities } from "./capabilities.js";
53
52
  /**
54
53
  * 由接线层代管、因此不在 handler 表里的方法名。
55
54
  *
@@ -70,7 +69,6 @@ export interface HandlerDeps {
70
69
  /** 进程启动时刻(ISO 8601) */
71
70
  startedAt: string;
72
71
  /** 能力清单(PRD F-E5) */
73
- capabilities: () => CapabilityView[];
74
72
  workspaces: WorkspaceService;
75
73
  conversations: ConversationService;
76
74
  messages: MessageService;
@@ -117,7 +115,7 @@ export interface HandlerDeps {
117
115
  targetVersion: string | null;
118
116
  }>;
119
117
  /** 从磁盘重载(`host.reload`:与改配置同一条生效路径) */
120
- reload: (params: HostReloadParams) => Promise<HostReloadResult>;
118
+ reload: () => Promise<HostReloadResult>;
121
119
  }
122
120
  /**
123
121
  * 造出整张 handler 表。
@@ -30,7 +30,6 @@ import { createQuestionHandlers } from "./questionHandlers.js";
30
30
  import { createSearchHandlers } from "./searchHandlers.js";
31
31
  import { createHostHandlers } from "./hostHandlers.js";
32
32
  import { createWorkspaceHandlers } from "./workspaceHandlers.js";
33
- export { createCapabilities } from "./capabilities.js";
34
33
  /**
35
34
  * 由接线层代管、因此不在 handler 表里的方法名。
36
35
  *
@@ -6,7 +6,6 @@
6
6
  * 一层只解释一次,多一层翻译就多一处会漂的地方。
7
7
  */
8
8
  import type { HandlerTable } from "../net/WsHub.js";
9
- import type { EventLocalizer } from "../services/NoticeService.js";
10
9
  import type { NoticeService } from "../services/NoticeService.js";
11
10
  export interface NoticeHandlerDeps {
12
11
  /** 只要本域用到的那三个方法(结构上 `NoticeService` 满足,用例可以给替身) */
@@ -15,10 +14,3 @@ export interface NoticeHandlerDeps {
15
14
  /** 本域注册的方法 */
16
15
  export type NoticeHandlers = Pick<HandlerTable, "notice.list" | "notice.dismiss" | "notice.clear">;
17
16
  export declare function createNoticeHandlers(deps: NoticeHandlerDeps): NoticeHandlers;
18
- /**
19
- * 事件出网前的按连接本地化(`WsHub` 的 `localizeEvent` 注入点)。
20
- *
21
- * 通知与问题的统一入口在这里:两类事件都带 `LocalizedText`,语言是连接的事,
22
- * 所以「产生时按缺省语言渲染、出网时换成这条连接的语言」这一步落在接线层。
23
- */
24
- export declare function createNoticeEventLocalizer(): EventLocalizer;
@@ -5,7 +5,6 @@
5
5
  * 以及把服务层的返回值原样交回。业务事实全在 `NoticeService` 里,这里不做判断 ——
6
6
  * 一层只解释一次,多一层翻译就多一处会漂的地方。
7
7
  */
8
- import { createEventLocalizer } from "../services/NoticeService.js";
9
8
  export function createNoticeHandlers(deps) {
10
9
  return {
11
10
  "notice.list": async (context) => await deps.notices.list(context.params, context.connection.language),
@@ -13,12 +12,3 @@ export function createNoticeHandlers(deps) {
13
12
  "notice.clear": async (context) => await deps.notices.clear(context.params),
14
13
  };
15
14
  }
16
- /**
17
- * 事件出网前的按连接本地化(`WsHub` 的 `localizeEvent` 注入点)。
18
- *
19
- * 通知与问题的统一入口在这里:两类事件都带 `LocalizedText`,语言是连接的事,
20
- * 所以「产生时按缺省语言渲染、出网时换成这条连接的语言」这一步落在接线层。
21
- */
22
- export function createNoticeEventLocalizer() {
23
- return createEventLocalizer();
24
- }