@shgroup/dsh-serenity-hooks 1.46.0 → 1.47.1

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.
@@ -918,4 +918,10 @@ function appendBound(session, action, rec) {
918
918
  }
919
919
  }
920
920
  //#endregion
921
- export { useSession as C, localIdStamp as D, localHuman as E, summarize as S, localFileStamp as T, resolveSessionByTitle as _, resolveSessionTrajectoryLabel as a, setActiveSessionInfo as b, TRAJECTORY_ACTIONS as c, extractSessionMdPathFromText as d, findSession as f, readActiveSessionMd as g, parseSessionContextFromEvents as h, readLastBound as i, clearActiveSessionInfo as l, listSessions as m, listBoundSessionIds as n, setBindingStore as o, getActiveSessionInfo as p, pruneMissingBindings as r, DEFAULT_SESSION_SCOPE as s, appendBound as t, createSession as u, sessionEvents as v, isoLocal as w, showSession as x, sessionsRoot as y };
921
+ //#region src/message-source.ts
922
+ /** ACC 注入消息的 kind —— 唤醒 / 打回 / keeper 提醒 / 锚定轮 / rebuild 交接等一律同值。 */
923
+ const ACC_MESSAGE_KIND = "plugin:dsh-serenity-hooks";
924
+ /** ACC 注入消息的统一来源值(各缝共用;需要 `form` 时按 `ContextFormed` 另加字段)。 */
925
+ const PLUGIN_SOURCE = { kind: ACC_MESSAGE_KIND };
926
+ //#endregion
927
+ export { showSession as C, localFileStamp as D, isoLocal as E, localHuman as O, setActiveSessionInfo as S, useSession as T, parseSessionContextFromEvents as _, pruneMissingBindings as a, sessionEvents as b, setBindingStore as c, clearActiveSessionInfo as d, createSession as f, listSessions as g, getActiveSessionInfo as h, listBoundSessionIds as i, localIdStamp as k, DEFAULT_SESSION_SCOPE as l, findSession as m, PLUGIN_SOURCE as n, readLastBound as o, extractSessionMdPathFromText as p, appendBound as r, resolveSessionTrajectoryLabel as s, ACC_MESSAGE_KIND as t, TRAJECTORY_ACTIONS as u, readActiveSessionMd as v, summarize as w, sessionsRoot as x, resolveSessionByTitle as y };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * message-source.ts — ACC 注入消息的来源标识(**单一真相源**,v1.47.0 / DSH 0.1.7-rc.1 适配)
3
+ *
4
+ * **为什么有这个文件**:DSH 0.1.7-rc.1(session format v3→v4)把消息来源从
5
+ * 「`kind: 'plugin'` + `plugin` 字段」改成**每个生产者声明自己的 kind** ——
6
+ * `@deepseek-ai/dsh-llm` 的 `MessageSourceMap` 逐字写着:
7
+ * *"each producer declares its own `kind` in its own module; there is no shared
8
+ * catch-all `plugin` kind"*。⇒ 旧写法 `{ kind: 'plugin', plugin: 'dsh-serenity-hooks' }`
9
+ * **在类型层不再合法**(合并和类型里没有 `plugin` 这一支),必须用**模块声明合并**
10
+ * 补上自己的 kind(宿主 `dsh-session-title-llm` 与 `dsh-compaction` 都用此法)。
11
+ *
12
+ * **为什么取字面量 `plugin:dsh-serenity-hooks`**:v3→v4 迁移的 `producerKind()`
13
+ * (`session-format-v3-to-v4/src/sources.ts`)把**第一方之外**的旧生产者一律写为
14
+ * `plugin:${旧 plugin 字段}` ⇒ **存量会话升级后就是这个字面量**。新代码沿用同一字面量,
15
+ * 使同一生产者在旧数据与新数据里**只有一个 kind**(否则下游与我方读取面都要处理两种)。
16
+ */
17
+ import type { ContextFormed, MessageSource } from '@deepseek-ai/dsh-llm';
18
+ declare module '@deepseek-ai/dsh-llm' {
19
+ interface MessageSourceMap {
20
+ 'plugin:dsh-serenity-hooks': {
21
+ kind: 'plugin:dsh-serenity-hooks';
22
+ } & ContextFormed;
23
+ }
24
+ }
25
+ /** ACC 注入消息的 kind —— 唤醒 / 打回 / keeper 提醒 / 锚定轮 / rebuild 交接等一律同值。 */
26
+ export declare const ACC_MESSAGE_KIND: "plugin:dsh-serenity-hooks";
27
+ /** ACC 注入消息的统一来源值(各缝共用;需要 `form` 时按 `ContextFormed` 另加字段)。 */
28
+ export declare const PLUGIN_SOURCE: MessageSource;
@@ -69,7 +69,7 @@ export declare const OPENCODE_API_KEY_ENV = "OPENCODE_API_KEY";
69
69
  */
70
70
  export declare function opencodeRouteHeaders(): Record<string, string>;
71
71
  interface OpencodeAutoConfigInput {
72
- /** `llm-pi-ai` 命名空间**解析后**的值(`settings.get` 结果;undefined = 命名空间未注册) */
72
+ /** `llm-pi-ai` 命名空间**解析后**的值(0.1.7 读面 `settings.describe()` 里按 `ns` 挑出的 `value`;undefined = 命名空间未注册) */
73
73
  resolved: unknown;
74
74
  /** 进程环境(注入以便测试) */
75
75
  env: Readonly<Record<string, string | undefined>>;
@@ -11,6 +11,15 @@
11
11
  * (dsh-serenity-hooks/container_trajectory rebuild/mech-registry),打回会瘫痪自身工作。
12
12
  */
13
13
  import type { Context } from 'cordis';
14
+ import type { Agent } from '@deepseek-ai/dsh-agent';
15
+ /** 读会话最后一个 assistant/message 文本(skiff-core 同款)
16
+ * **2026-09-23(S142 D77)起导出**:`unattended-seam.ts` 复用同一读法(本容器纪律:
17
+ * 「同一读法只留一份」——两份 `lastAssistantText` 会在宿主改事件形状时**只修一处**)。
18
+ * **v1.27.7:剥离 think 块再检测**(用户:"不检查think内容(因为不输出)")——
19
+ * ` think…` 是模型思考过程,不进入用户可见输出;敏感词检测只针对**最终呈现文本**,
20
+ * 否则 think 内提及内部机制词(思考过程必然推演机制)会误打回。复用 stripThink
21
+ * (v1.26.8 状态机,弃正则——同 v1.27.1 微信桥回复链路)。 */
22
+ export declare function lastAssistantText(agent: Agent): string;
14
23
  /**
15
24
  * 注册输出守卫(index.ts apply 调用):
16
25
  * turn-stopping 时检测最终输出,命中敏感词 → steer 打回重生成(官方机制,零改 DSH)。
@@ -1,5 +1,5 @@
1
1
  /**
2
- * context.ts — 拦截缝:ACC 上下文注入(agent/session-start + agent/prompt-submit)
2
+ * context.ts — 拦截缝:ACC 上下文注入(agent/created + agent/prompt-submit)
3
3
  *
4
4
  * 对应 opencode-serenity-plugin 的 system.transform(ACC 身份/约束注入)+ Phase 2 访谈提示。
5
5
  *
@@ -1,6 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
2
  import { a as hostSettings } from "./access-fiehjxV6.js";
3
- import z from "@deepseek-ai/schemastery";
4
3
  //#region src/ports.ts
5
4
  /**
6
5
  * 集中端口表。
@@ -62,43 +61,11 @@ const MECHANISM_PORTS = Object.keys(FACE_PORTS).map((id) => String(FACE_PORTS[id
62
61
  var settings_section_exports = /* @__PURE__ */ __exportAll({
63
62
  SERENITY_SETTINGS_NS: () => SERENITY_SETTINGS_NS,
64
63
  defaultSimpleSettings: () => defaultSimpleSettings,
65
- entryDefaults: () => entryDefaults,
66
64
  readSimpleSettings: () => readSimpleSettings,
67
- registerSettingsSection: () => registerSettingsSection
65
+ registerSettingsSection: () => registerSettingsSection,
66
+ simpleSettingsFromConfig: () => simpleSettingsFromConfig
68
67
  });
69
- /** 简单配置命名空间(dsh 设置面板的 section id / settings.yaml section) */
70
- const SERENITY_SETTINGS_NS = "serenity-hooks";
71
- /** schemastery schema(与 DSH 各插件 Config 同款) */
72
- const simpleSettingsSchema = z.object({
73
- gatewayEnabled: z.boolean().default(false),
74
- rebuildEnabled: z.boolean().default(true),
75
- rebuildThresholdK: z.number().min(50).max(4e3).default(400),
76
- skiffEnabled: z.boolean().default(false),
77
- skiffDebugPort: z.number().min(1024).max(65535).default(SKIFF_DEBUG_PORT),
78
- acpEnabled: z.boolean().default(false),
79
- acpHttpPort: z.number().min(1024).max(65535).default(ACP_HTTP_PORT),
80
- publicAskEnabled: z.boolean().default(false),
81
- croEnabled: z.boolean().default(true)
82
- });
83
- /** 从插件 Config 提取 entry 默认(settings base 层) */
84
- function entryDefaults(config) {
85
- return {
86
- gatewayEnabled: config.gateway?.enabled ?? false,
87
- rebuildEnabled: config.rebuild?.enabled ?? true,
88
- rebuildThresholdK: config.rebuild?.thresholdK ?? 400,
89
- skiffEnabled: config.skiff?.enabled ?? false,
90
- skiffDebugPort: config.skiff?.debugPort ?? SKIFF_DEBUG_PORT,
91
- acpEnabled: config.acp?.enabled ?? false,
92
- acpHttpPort: config.acp?.httpPort ?? ACP_HTTP_PORT,
93
- publicAskEnabled: config.publicAsk?.enabled ?? false,
94
- croEnabled: true
95
- };
96
- }
97
- /** 运行时源(installSettingsSection 注入:settings scope 或 entry fallback) */
98
- let simpleSource = null;
99
- /** 缺 settings provider 的告警去重(进程级一次;降级路径可能被多次注册调用) */
100
- let warnedNoSettingsProvider = false;
101
- /** 进程级默认(无 settings 服务时的兜底) */
68
+ /** 进程级默认(无 Config 可读时的兜底;与 Config 各字段的缺省一致) */
102
69
  function defaultSimpleSettings() {
103
70
  return {
104
71
  gatewayEnabled: false,
@@ -109,46 +76,65 @@ function defaultSimpleSettings() {
109
76
  acpEnabled: false,
110
77
  acpHttpPort: ACP_HTTP_PORT,
111
78
  publicAskEnabled: false,
112
- croEnabled: true
79
+ croEnabled: true,
80
+ unattendedEnabled: false
81
+ };
82
+ }
83
+ /**
84
+ * Config(宿主 Loader 校验后的解析值)→ 扁平简单配置。**本文件唯一的读取语义**。
85
+ *
86
+ * 优先级:**面板层(扁平键)> 部署层(嵌套段)> 内建缺省**。
87
+ * @param config - 插件 Config(`fiber.config` 或 apply 收到的 config)
88
+ * @returns 扁平开关集合
89
+ */
90
+ function simpleSettingsFromConfig(config) {
91
+ const d = defaultSimpleSettings();
92
+ return {
93
+ gatewayEnabled: config.gatewayEnabled ?? config.gateway?.enabled ?? d.gatewayEnabled,
94
+ rebuildEnabled: config.rebuildEnabled ?? config.rebuild?.enabled ?? d.rebuildEnabled,
95
+ rebuildThresholdK: config.rebuildThresholdK ?? config.rebuild?.thresholdK ?? d.rebuildThresholdK,
96
+ skiffEnabled: config.skiffEnabled ?? config.skiff?.enabled ?? d.skiffEnabled,
97
+ skiffDebugPort: config.skiffDebugPort ?? config.skiff?.debugPort ?? d.skiffDebugPort,
98
+ acpEnabled: config.acpEnabled ?? config.acp?.enabled ?? d.acpEnabled,
99
+ acpHttpPort: config.acpHttpPort ?? config.acp?.httpPort ?? d.acpHttpPort,
100
+ publicAskEnabled: config.publicAskEnabled ?? d.publicAskEnabled,
101
+ croEnabled: config.croEnabled ?? d.croEnabled,
102
+ unattendedEnabled: config.unattendedEnabled ?? d.unattendedEnabled
113
103
  };
114
104
  }
105
+ /** 运行时源(`registerSettingsSection` 装配:读本插件 fiber 的**当前** Config) */
106
+ let simpleSource = null;
115
107
  /**
116
- * 读取当前简单配置(settings 解析值;无 provider/未注册 → entry 默认)。
117
- * 各功能(gateway/rebuild/naming)启动与运行时判断开关都经此函数。
108
+ * 读取当前简单配置(各功能 gateway/rebuild/skiff/… 的启动与运行时判断都经此)。
109
+ *
110
+ * 源 = 本插件 fiber 的 `config`(宿主在配置变更时走 `fiber.update()` ⇒ `config` 始终最新,
111
+ * **不必**依赖 apply 重跑,也不必缓存)。
112
+ * @returns 扁平开关集合
118
113
  */
119
114
  function readSimpleSettings() {
120
115
  return simpleSource ? simpleSource() : defaultSimpleSettings();
121
116
  }
122
117
  /**
123
- * 注册简单配置到 DSH settings(零改 DSH;settings.yaml 持久化 + 原生面板渲染)。
124
- * 注:插件 Config(cordis.yml 组合层)作为 base;用户文档层叠加其上。
125
- * 运行时读取简单配置统一经 `readSimpleSettings()`。
126
- * v1.28.0 适配 0.1.2-rc.1(B4):`installSettingsSection`/`settingsNamespace` 便捷函数在
127
- * rc.1 消失 → 改 `SettingsProvider.installSection(owner, ns, schema, entry, hooks)`
128
- * (owner = consumer 插件 ctx;ns 直接字符串)。
118
+ * 装配简单配置读取面(v1.21 分层;**v0.1.7 起不再注册任何 section**)。
119
+ *
120
+ * 两件事:
121
+ * 1. 把"本插件自己的 Config"接成简单配置源 —— 读 `ctx.fiber.config`(宿主 `fiber.update()`
122
+ * 保证最新),拿不到 fiber 时退回 apply 收到的 `config`。
123
+ * 2. 关掉宿主按 Config schema **自动生成**的通用页(`settings.configure({ auto: false })`)——
124
+ * 门面是我们的自定义页 `client/SettingsSection.tsx`(同一个命名空间,同一份数据)。
125
+ *
126
+ * ⚠️ 两个失败都不阻断插件装载(面板是附属能力,绝不能成为启动单点)。
127
+ * @param ctx - 插件上下文
128
+ * @param config - apply 收到的 Config(fiber.config 不可用时的兜底)
129
129
  */
130
130
  function registerSettingsSection(ctx, config) {
131
- const hooks = {
132
- setSource: (get) => {
133
- simpleSource = get;
134
- },
135
- onChange: () => {
136
- try {
137
- ctx.emit?.("serenity/settings-changed");
138
- } catch {}
139
- }
140
- };
141
- const settingsAny = hostSettings(ctx);
142
- if (settingsAny) {
143
- settingsAny.installSection.call(settingsAny, ctx, SERENITY_SETTINGS_NS, simpleSettingsSchema, entryDefaults(config), hooks);
144
- return;
145
- }
146
- if (!warnedNoSettingsProvider) {
147
- warnedNoSettingsProvider = true;
148
- console.warn("[serenity-hooks] ✗ settings 服务不可用 → 简单配置降级为 entry 默认值(面板开关/阈值改动不生效;检查宿主 settings provider 是否装载)");
149
- }
150
- hooks.setSource(() => ({}));
151
- hooks.onChange();
131
+ const fiber = ctx.fiber;
132
+ const readConfig = () => fiber?.config ?? config;
133
+ simpleSource = () => simpleSettingsFromConfig(readConfig());
134
+ const settings = hostSettings(ctx);
135
+ try {
136
+ settings?.configure?.({ auto: false }, fiber);
137
+ } catch {}
152
138
  }
153
139
  //#endregion
154
140
  export { FACE_PORTS as a, MECHANISM_PORTS as c, ACP_HTTP_PORT as i, SKIFF_DEBUG_PORT as l, registerSettingsSection as n, GATEWAY_PORT as o, settings_section_exports as r, MAIN_WEB_PORT as s, readSimpleSettings as t, WEIXIN_SEND_PORT as u };
@@ -1,22 +1,40 @@
1
1
  /**
2
- * settings-section.ts — 简单配置注册(dsh 原生设置面板,v1.21 分层)
2
+ * settings-section.ts — 简单配置读取(dsh 原生设置面板;v1.21 分层,**v1.47 A 案移植到 0.1.7 表单模型**)
3
3
  *
4
4
  * 分层决策(S142):**简单配置(开关/阈值)→ dsh 原生设置面板**;
5
5
  * **复杂配置(账号列表)→ 宁静号高级面板**(localstore + /serenity/config)。
6
6
  *
7
- * 本模块承载简单配置层:`SettingsProvider.installSection(ctx, 'serenity-hooks', schema, entry)`
8
- * 注册 `serenity-hooks` namespace——三功能总开关 + F2 阈值。
9
- * (v1.28.0 适配 0.1.2-rc.1:installSettingsSection/settingsNamespace 便捷函数消失 → 方法调用)
7
+ * ## 🔴 v0.1.7 起(A 案):**"安装 section"这件事整段退场**
10
8
  *
11
- * 运行时降级守卫(版本鲁棒性):旧 RC(staging 架构)api-proxy 有
12
- * `WEB_SETTINGS_NAMESPACES` 静态白名单,第三方 ns 会收到 settings-not-exposed
13
- * ——client 面板读不到。新 RC(官方 master)已删除白名单(全量 describe)。
14
- * 本模块不依赖白名单状态:register 总是执行(host 侧零成本);
15
- * **client 侧**(SettingsSection 组件)以 describe 结果为据——ns 不在描述列表
16
- * 则显示降级提示(引导去宁静号面板),在则渲染 schema 表单。零配置自动适配。
9
+ * 宿主把 `SettingsProvider.installSection` 换成 `SettingsForms`:设置页不再由插件
10
+ * "注册一个 namespace + schema + entry + hooks",而是**由插件自己的 cordis `Config`
11
+ * schema 投影成表单**(`packages/settings/settings` 的 `describe()` 遍历 profile 条目)。
12
+ * ⇒ 命名空间**就是 profile 条目 id** —— 本插件 = `serenity-hooks`
13
+ * (见 `cordis.patch.yml` 的 `- insert: - id: serenity-hooks`)。
14
+ *
15
+ * ## 为什么旧扁平键**原样保留**(这是本文件最容易被后人改错的地方)
16
+ *
17
+ * 旧模型把简单配置存成 `~/.dsh/settings.yaml` 的 `serenity-hooks:` 段,字段名是**扁平**的
18
+ * (`gatewayEnabled` / `skiffEnabled` / …)。新模型的命名空间**逐字相同**
19
+ * (`serenity-hooks`),而宿主的 `SettingsForms.importLegacyDocument()` 会把该段
20
+ * **按同名条目导入**;schemastery 的 object 解析在非 strict 模式下 `merge(result, data)`
21
+ * ⇒ **未声明的键会被保留而非报错**。⇒ 只要这些扁平键**仍在本插件 Config 里声明**,
22
+ * **旧值就自动随宿主导入搬过来,零迁移代码**(这正是宿主的迁移惯例:`LEGACY_SECTION_ENTRIES`
23
+ * 只重映射**段名**,从不改写字段名)。
24
+ *
25
+ * ## 两层拼写(**有意保留,不是重复真相源**)
26
+ *
27
+ * | 层 | 拼写 | 谁写 | 语义 |
28
+ * |---|---|---|---|
29
+ * | **面板层**(用户层) | 扁平键 `gatewayEnabled` | 设置面板 / 宿主 legacy 导入 | 用户在界面上改的那个 |
30
+ * | **部署层** | 嵌套段 `gateway.enabled` | `cordis.yml` / bundle patch | 部署时的缺省 |
31
+ *
32
+ * 读取优先级 = **面板层 > 部署层 > 内建缺省**(`simpleSettingsFromConfig`)。
33
+ * 🔴 面板层的键**故意不带 schemastery 默认值** —— 有默认值就永远非 `undefined`,
34
+ * 部署层会被无声压死("未设置"必须可观测)。
17
35
  */
18
36
  import type { Context } from 'cordis';
19
- /** 插件 Config 的简单配置片段(index.ts Config 组合;settings entry base) */
37
+ /** 插件 Config 的简单配置片段(index.ts 的 Config 子集;面板层 + 部署层两种拼写) */
20
38
  interface SimpleConfigFragment {
21
39
  gateway?: {
22
40
  enabled?: boolean;
@@ -35,68 +53,92 @@ interface SimpleConfigFragment {
35
53
  enabled?: boolean;
36
54
  httpPort?: number;
37
55
  };
38
- /** F4d 建议问答页(实验性):按认知容器暴露问答页供他人验证(全局开关;与 ACP 共用端口) */
39
- publicAsk?: {
40
- enabled?: boolean;
41
- };
56
+ gatewayEnabled?: boolean;
57
+ rebuildEnabled?: boolean;
58
+ rebuildThresholdK?: number;
59
+ skiffEnabled?: boolean;
60
+ skiffDebugPort?: number;
61
+ acpEnabled?: boolean;
62
+ acpHttpPort?: number;
63
+ publicAskEnabled?: boolean;
64
+ croEnabled?: boolean;
65
+ unattendedEnabled?: boolean;
42
66
  }
43
- /** 简单配置命名空间(dsh 设置面板的 section id / settings.yaml section) */
44
- export declare const SERENITY_SETTINGS_NS = "serenity-hooks";
45
67
  /**
46
- * 简单配置 schema(schemastery):三功能总开关 + F2 阈值 + F4 Skiff 启停。
47
- * 与 DSH settings 的 schema 语义一致(z.object 布尔/数字)。
68
+ * 设置面板命名空间 = **profile 条目 id**(v0.1.7 起;与旧 `settings.yaml` 段名逐字相同)。
48
69
  */
70
+ export declare const SERENITY_SETTINGS_NS = "serenity-hooks";
71
+ /** 简单配置的扁平形态(运行时读取的统一形状;各功能门控只看它) */
49
72
  interface SerenitySimpleSettings {
50
73
  /** F1 双端口网关总开关 */
51
74
  gatewayEnabled: boolean;
52
75
  /** F2 超限重建总开关 */
53
76
  rebuildEnabled: boolean;
54
- /** F2 触发阈值(需求① S142 用户拍板:百分比比例 → K 数值;projectedTokens ≥ thresholdK*1000 触发,纯绝对无窗口比例保护) */
77
+ /** F2 触发阈值(需求① S142 用户拍板:百分比比例 → K 数值;projectedTokens ≥ thresholdK*1000 触发) */
55
78
  rebuildThresholdK: number;
56
79
  /** F4 Skiff 调试服务总开关(实验性;默认关——不随插件加载自动启动,人工开启) */
57
80
  skiffEnabled: boolean;
58
81
  /** F4 Skiff 调试端口(默认 3099,仅 127.0.0.1) */
59
82
  skiffDebugPort: number;
60
- /** F4c ACP HTTP JSON-RPC 端点总开关(实验性;默认关——人工开启) */
83
+ /** F4c ACP HTTP JSON-RPC 端点总开关(实验性;默认关) */
61
84
  acpEnabled: boolean;
62
85
  /** F4c ACP HTTP 端口(默认 3100,仅 127.0.0.1) */
63
86
  acpHttpPort: number;
64
87
  /** F4d 建议问答页总开关(实验性;默认关——按认知容器暴露问答页,key 认证) */
65
88
  publicAskEnabled: boolean;
66
- /** **CRO(轨迹自编程唤起)总开关** —— 2026-09-21 所有者令新增。
89
+ /** **CRO(轨迹自编程唤起)总开关**(2026-09-21 所有者令新增;**缺省开**)。
67
90
  *
68
91
  * CRO = 轨迹目录下放一个 `continuous-re-occurrence.ts`,由 ACC 的 5min tick spawn,
69
92
  * 由**程序**决定"要不要唤、何时唤、唤起的提示词是什么"。
70
- *
71
- * **缺省开**:① 它已在生产上稳定运行(S151 / S185 各有程序在跑);② 它的**默认存在感为零**
72
- * ——没有程序文件的轨迹本来就不参与;③ 缺省关会让"已上线的程序突然不跑"(等于静默回退)。
73
- * **只关 CRO 阶段**:`send-later` / `send-now` / 唤醒表投递**照常**(见 `cro.ts` 头注的承诺)。
74
- *
75
- * ⚠️ 与它**同时废止**的键:`wakeSchedulerEnabled`(所有者 2026-09-21 令「send-later 的开关
76
- * 不再重要了,砍掉」)——唤醒调度器**不再有任何闸**(恒开);旧配置里的该键**静默忽略**。 */
93
+ * 缺省开的理由:① 已在生产稳定运行(S151 / S185);② 默认存在感为零(没有程序文件的轨迹
94
+ * 本来就不参与);③ 缺省关会让"已上线的程序突然不跑"。
95
+ * **只关 CRO 阶段**:`send-later` / `send-now` / 唤醒表投递**照常**。
96
+ * ⚠️ 与它**同时废止**的键:`wakeSchedulerEnabled`(唤醒调度器现恒开、无闸;旧键静默忽略)。 */
77
97
  croEnabled: boolean;
98
+ /** **无人值守代理回复(unattended proxy)总开关**(2026-09-23 所有者令新增;**缺省关**)。
99
+ *
100
+ * 开启后:CCC 会话**被 LLM 主动停止**且无人应答时,ACC 注入一次**代理用户的结构化回复**,
101
+ * 以**验证码(nonce)**作「合法收束」判据 —— **未回码 ⇒ 继续,回码 ⇒ 放过**。
102
+ * **缺省关**:它把**人**从回路里拿掉(失败模式是静默的)。
103
+ * **排除面**:仅有 CRO 程序的轨迹不适用(所有者 2026-09-23 裁决:口径由"宽"改"窄"
104
+ * —— 原"任何自排唤醒都排除"会让本机制永远够不着靠续接绳活着的维护会话;改窄后
105
+ * **自排绳不再排除**,绳退化为**长周期保险丝**)。设计全文见 S142 的 **D77**。 */
106
+ unattendedEnabled: boolean;
78
107
  }
79
- /** 从插件 Config 提取 entry 默认(settings base 层) */
80
- export declare function entryDefaults(config: SimpleConfigFragment): SerenitySimpleSettings;
81
- /** 进程级默认(无 settings 服务时的兜底) */
108
+ /** 进程级默认(无 Config 可读时的兜底;与 Config 各字段的缺省一致) */
82
109
  export declare function defaultSimpleSettings(): SerenitySimpleSettings;
83
110
  /**
84
- * 读取当前简单配置(settings 解析值;无 provider/未注册 → entry 默认)。
85
- * 各功能(gateway/rebuild/naming)启动与运行时判断开关都经此函数。
111
+ * Config(宿主 Loader 校验后的解析值)→ 扁平简单配置。**本文件唯一的读取语义**。
112
+ *
113
+ * 优先级:**面板层(扁平键)> 部署层(嵌套段)> 内建缺省**。
114
+ * @param config - 插件 Config(`fiber.config` 或 apply 收到的 config)
115
+ * @returns 扁平开关集合
116
+ */
117
+ export declare function simpleSettingsFromConfig(config: SimpleConfigFragment): SerenitySimpleSettings;
118
+ /**
119
+ * 读取当前简单配置(各功能 gateway/rebuild/skiff/… 的启动与运行时判断都经此)。
120
+ *
121
+ * 源 = 本插件 fiber 的 `config`(宿主在配置变更时走 `fiber.update()` ⇒ `config` 始终最新,
122
+ * **不必**依赖 apply 重跑,也不必缓存)。
123
+ * @returns 扁平开关集合
86
124
  */
87
125
  export declare function readSimpleSettings(): SerenitySimpleSettings;
88
126
  /**
89
- * 测试注入钩子(生产零调用):替换/恢复运行时源,便于单测各功能门控
90
- * (registerSettingsSection 的 setSource 回调在 mock dsh-settings 时不会触发)。
127
+ * 测试注入钩子(生产零调用):替换/恢复运行时源,便于单测各功能门控。
91
128
  */
92
129
  export declare function __setSimpleSourceForTest(source: (() => SerenitySimpleSettings) | null): void;
93
130
  /**
94
- * 注册简单配置到 DSH settings(零改 DSH;settings.yaml 持久化 + 原生面板渲染)。
95
- * 注:插件 Config(cordis.yml 组合层)作为 base;用户文档层叠加其上。
96
- * 运行时读取简单配置统一经 `readSimpleSettings()`。
97
- * v1.28.0 适配 0.1.2-rc.1(B4):`installSettingsSection`/`settingsNamespace` 便捷函数在
98
- * rc.1 消失 → 改 `SettingsProvider.installSection(owner, ns, schema, entry, hooks)`
99
- * (owner = consumer 插件 ctx;ns 直接字符串)。
131
+ * 装配简单配置读取面(v1.21 分层;**v0.1.7 起不再注册任何 section**)。
132
+ *
133
+ * 两件事:
134
+ * 1. 把"本插件自己的 Config"接成简单配置源 —— 读 `ctx.fiber.config`(宿主 `fiber.update()`
135
+ * 保证最新),拿不到 fiber 时退回 apply 收到的 `config`。
136
+ * 2. 关掉宿主按 Config schema **自动生成**的通用页(`settings.configure({ auto: false })`)——
137
+ * 门面是我们的自定义页 `client/SettingsSection.tsx`(同一个命名空间,同一份数据)。
138
+ *
139
+ * ⚠️ 两个失败都不阻断插件装载(面板是附属能力,绝不能成为启动单点)。
140
+ * @param ctx - 插件上下文
141
+ * @param config - apply 收到的 Config(fiber.config 不可用时的兜底)
100
142
  */
101
143
  export declare function registerSettingsSection(ctx: Context, config: SimpleConfigFragment): void;
102
144
  export {};