@shgroup/dsh-serenity-hooks 1.45.1 → 1.47.0
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/dsh.plugin.json +1 -1
- package/lib/client.js +45 -34
- package/lib/cro-turns.d.ts +3 -3
- package/lib/host/access.d.ts +11 -1
- package/lib/host/contract.d.ts +2 -2
- package/lib/index.d.ts +20 -0
- package/lib/index.js +1009 -75
- package/lib/{trajectory-bound-BPWKkzJC.js → message-source-Boc-AbHs.js} +7 -1
- package/lib/message-source.d.ts +28 -0
- package/lib/output-guard-seam.d.ts +9 -0
- package/lib/seams/context.d.ts +1 -1
- package/lib/{settings-section-CIuyoSOX.js → settings-section-DTJW4smh.js} +52 -66
- package/lib/settings-section.d.ts +84 -42
- package/lib/skills-discovery.d.ts +5 -3
- package/lib/trajectory-skills.d.ts +3 -1
- package/lib/unattended-ops.d.ts +247 -0
- package/lib/unattended-seam.d.ts +49 -0
- package/lib/usage-stats.d.ts +128 -0
- package/lib/{wake-scheduler-DF-YWcX5.js → wake-scheduler-DdaRNofO.js} +10 -12
- package/package.json +52 -52
|
@@ -918,4 +918,10 @@ function appendBound(session, action, rec) {
|
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
920
|
//#endregion
|
|
921
|
-
|
|
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;
|
|
@@ -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)。
|
package/lib/seams/context.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
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
|
-
*
|
|
117
|
-
*
|
|
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
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
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
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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 —
|
|
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
|
-
*
|
|
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
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
*
|
|
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
|
|
89
|
+
/** **CRO(轨迹自编程唤起)总开关**(2026-09-21 所有者令新增;**缺省开**)。
|
|
67
90
|
*
|
|
68
91
|
* CRO = 轨迹目录下放一个 `continuous-re-occurrence.ts`,由 ACC 的 5min tick spawn,
|
|
69
92
|
* 由**程序**决定"要不要唤、何时唤、唤起的提示词是什么"。
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
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
|
-
/**
|
|
80
|
-
export declare function entryDefaults(config: SimpleConfigFragment): SerenitySimpleSettings;
|
|
81
|
-
/** 进程级默认(无 settings 服务时的兜底) */
|
|
108
|
+
/** 进程级默认(无 Config 可读时的兜底;与 Config 各字段的缺省一致) */
|
|
82
109
|
export declare function defaultSimpleSettings(): SerenitySimpleSettings;
|
|
83
110
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
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
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
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 {};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* skills-discovery.ts — CCC 入口 skill 自动发现(纯逻辑,零 DSH 依赖)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 发现全部入口技能(原文全量,不截断)—— **现行三个来源**(原为四个,**来源 3 已于 2026-09-21 删除**):
|
|
5
5
|
* 0. **`.serenity` 记号文件内容 = 顶层入口 skill 名**(CCC 记号文件的权威语义,
|
|
6
6
|
* tiangong-serenity 的 .serenity 内容为 `tg-serenity`)—— 最高优先
|
|
7
7
|
* 1. `.dsh/entry-skill` 指针文件(内容 = skill 名)—— 兼容旧约定
|
|
8
8
|
* 2. `.opencode/skills/*-serenity/SKILL.md` —— 自动扫描该 CCC 的顶层入口
|
|
9
9
|
* (home-serenity / tg-serenity / pangu-serenity …,命名模式 `*-serenity`)
|
|
10
|
-
* 3. `.dsh/skills/*-serenity/SKILL.md
|
|
11
|
-
*
|
|
10
|
+
* ~~3. `.dsh/skills/*-serenity/SKILL.md`(扫 ACC 装进 CCC 的技能副本)~~ —— 🔴 **已删**:
|
|
11
|
+
* owner 2026-09-21 令「连模板和安装命令一起删」(B 案)。**判据、实测证据与日期逐字记在
|
|
12
|
+
* `findEntrySkills()` 体内那一段注释里**——本头部只留结论,**不复述判据**(避免两处会漂的真相源)。
|
|
13
|
+
* 按名去重;顺序 = 记号文件 → 指针 → opencode 入口。
|
|
12
14
|
*
|
|
13
15
|
* 任何 CCC 都能自动注入其顶层入口 skill 全文(不硬编码名字)。
|
|
14
16
|
*/
|
|
@@ -81,8 +81,10 @@ export declare function mergeSkillNames(cccSkills: readonly string[], trajSkills
|
|
|
81
81
|
* @param mdPath 轨迹的 SESSION.md 路径(**来自绑定的 `mdPath`**,不用 label 拼)
|
|
82
82
|
* @param maxChars 总长上限(字符)
|
|
83
83
|
* @param cccSkills CCC 级声明(`readTrajectorySkills`;缺省空 = 只有轨迹级,行为与 v1.43 一致)
|
|
84
|
+
* @param onInjectedNames 观测回调(本次请求实际带上的 skill 名;**纯观测**,供用量统计用——
|
|
85
|
+
* 回调抛错被吞,**不影响注入正文**)
|
|
84
86
|
* @returns 注入正文;两条来源皆无声明 → `''`(空串 = 宿主不产出该 section 块);
|
|
85
87
|
* SESSION.md 缺失/读失败 → 响亮提示(若同时有 CCC 级声明,则提示在前、正文随后——
|
|
86
88
|
* **提示不因"别处有内容"而被吞掉**)
|
|
87
89
|
*/
|
|
88
|
-
export declare function buildTrajectorySkillsSection(root: string, mdPath: string, maxChars?: number, cccSkills?: readonly string[]): string;
|
|
90
|
+
export declare function buildTrajectorySkillsSection(root: string, mdPath: string, maxChars?: number, cccSkills?: readonly string[], onInjectedNames?: (names: readonly string[]) => void): string;
|