@shgroup/dsh-serenity-hooks 1.27.6 → 1.27.8
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/dsh.plugin.json +1 -1
- package/lib/autopilot-trajectory.d.ts +3 -1
- package/lib/index.js +17 -9
- package/package.json +1 -1
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-serenity-hooks",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.8",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "宁静号 ACC harness(Native Cordis 插件):真实 DSH 工具 cc_fs/session/acc_msm/eap/neat/cce/handyman/session_rebuild/skiff_admin + 拦截缝机械约束(safe-mode/路径守卫)+ 高级设定面板(双端口网关/账号管理)+ Skiff 认知子集角色(实验性)。适配 DSH 公开版(0.1.0-rc,deepseek-ai/deepseek-harness)。",
|
|
6
6
|
"engines": {
|
|
@@ -33,8 +33,10 @@ export declare const DEFAULT_BIAS_PROVIDER = "autopilot-bias.ts";
|
|
|
33
33
|
export declare const LEGACY_BIAS_PROVIDER = "autotrajectory-bias.ts";
|
|
34
34
|
/** 自主轨迹会话目录后缀标志(--auto 保留——简短且历史会话 S060--auto 已存在) */
|
|
35
35
|
export declare const AUTO_DIR_SUFFIX = "--auto";
|
|
36
|
-
/** 调度 tick 周期(
|
|
36
|
+
/** 调度 tick 周期(5min——用户"tick改为5分钟吧";0.01h 间隔下每 5min 评估一次) */
|
|
37
37
|
export declare const TICK_MS: number;
|
|
38
|
+
/** 间隔下限(支持小数——用户"让它支持小数行吗,这样可以配0.01";0.01h ≈ 36s) */
|
|
39
|
+
export declare const MIN_INTERVAL_HOURS = 0.01;
|
|
38
40
|
/** SESSION.md 内「下一轮动机」段标记(自生偏见载体——轨迹预设自己的未来) */
|
|
39
41
|
export declare const MOTIVATION_MARKER = "\u4E0B\u4E00\u8F6E\u52A8\u673A";
|
|
40
42
|
/** 缺省避开的高峰时段(北京时间 [start, end) 不唤起——用量峰谷省钱) */
|
package/lib/index.js
CHANGED
|
@@ -6146,6 +6146,7 @@ var autopilot_trajectory_exports = /* @__PURE__ */ __exportAll({
|
|
|
6146
6146
|
DEFAULT_BIAS_PROVIDER: () => DEFAULT_BIAS_PROVIDER,
|
|
6147
6147
|
DEFAULT_MAX_DAILY_WAKES: () => 24,
|
|
6148
6148
|
LEGACY_BIAS_PROVIDER: () => LEGACY_BIAS_PROVIDER,
|
|
6149
|
+
MIN_INTERVAL_HOURS: () => MIN_INTERVAL_HOURS,
|
|
6149
6150
|
MOTIVATION_MARKER: () => MOTIVATION_MARKER,
|
|
6150
6151
|
TICK_MS: () => TICK_MS,
|
|
6151
6152
|
beijingHour: () => beijingHour,
|
|
@@ -6177,8 +6178,10 @@ const DEFAULT_BIAS_PROVIDER = "autopilot-bias.ts";
|
|
|
6177
6178
|
const LEGACY_BIAS_PROVIDER = "autotrajectory-bias.ts";
|
|
6178
6179
|
/** 自主轨迹会话目录后缀标志(--auto 保留——简短且历史会话 S060--auto 已存在) */
|
|
6179
6180
|
const AUTO_DIR_SUFFIX = "--auto";
|
|
6180
|
-
/** 调度 tick 周期(
|
|
6181
|
-
const TICK_MS =
|
|
6181
|
+
/** 调度 tick 周期(5min——用户"tick改为5分钟吧";0.01h 间隔下每 5min 评估一次) */
|
|
6182
|
+
const TICK_MS = 3e5;
|
|
6183
|
+
/** 间隔下限(支持小数——用户"让它支持小数行吗,这样可以配0.01";0.01h ≈ 36s) */
|
|
6184
|
+
const MIN_INTERVAL_HOURS = .01;
|
|
6182
6185
|
/** SESSION.md 内「下一轮动机」段标记(自生偏见载体——轨迹预设自己的未来) */
|
|
6183
6186
|
const MOTIVATION_MARKER = "下一轮动机";
|
|
6184
6187
|
/** 缺省避开的高峰时段(北京时间 [start, end) 不唤起——用量峰谷省钱) */
|
|
@@ -6244,7 +6247,7 @@ function shouldWake(settings, mdPath, nowMs, running, history = []) {
|
|
|
6244
6247
|
if (dailyWakeCount(history, nowMs) >= maxDaily) return false;
|
|
6245
6248
|
try {
|
|
6246
6249
|
const mtime = statSync(mdPath).mtimeMs;
|
|
6247
|
-
const hours = Math.max(
|
|
6250
|
+
const hours = Math.max(MIN_INTERVAL_HOURS, settings.intervalHours ?? 12);
|
|
6248
6251
|
return nowMs - mtime >= hours * 36e5;
|
|
6249
6252
|
} catch {
|
|
6250
6253
|
return false;
|
|
@@ -6317,12 +6320,13 @@ async function fetchBiasContent(root, providerRel) {
|
|
|
6317
6320
|
}
|
|
6318
6321
|
/** 唤起消息(四段式:轨迹焦点[CCC 定义,稳定] / 身份锚定 / 先验偏见[自生动机+偏见内容] / 任务)——注入前台会话,用户可见 */
|
|
6319
6322
|
function buildWakeMessage(opts) {
|
|
6323
|
+
const intervalLabel = opts.intervalHours >= 1 ? `${opts.intervalHours} 小时` : `约 ${Math.round(opts.intervalHours * 60)} 分钟`;
|
|
6320
6324
|
const lines = [];
|
|
6321
6325
|
if (opts.topPrompt) {
|
|
6322
6326
|
lines.push(`[轨迹焦点] ${opts.topPrompt}`);
|
|
6323
6327
|
lines.push("");
|
|
6324
6328
|
}
|
|
6325
|
-
lines.push(`[Autopilot Trajectory 唤起] — 距上次轨迹活动已满 ${
|
|
6329
|
+
lines.push(`[Autopilot Trajectory 唤起] — 距上次轨迹活动已满 ${intervalLabel},自动继续。`, "", `身份锚定:继续 ${opts.sessionName} 的 trajectory(SESSION.md: ${opts.mdPath})。`, "先验偏见:");
|
|
6326
6330
|
if (opts.motivation) lines.push(` · 自生动机:${opts.motivation}`);
|
|
6327
6331
|
if (opts.biasContent) lines.push(` · 偏见内容:${opts.biasContent}`);
|
|
6328
6332
|
if (!opts.motivation && !opts.biasContent) lines.push(" · (无——本轮纯自主探索)");
|
|
@@ -6370,7 +6374,7 @@ async function performAutopilotWake(ctx, root, settings, opts = {}) {
|
|
|
6370
6374
|
};
|
|
6371
6375
|
try {
|
|
6372
6376
|
const mtime = statSync(mdPath).mtimeMs;
|
|
6373
|
-
const hours = Math.max(
|
|
6377
|
+
const hours = Math.max(MIN_INTERVAL_HOURS, settings.intervalHours ?? 12);
|
|
6374
6378
|
if (now - mtime < hours * 36e5) return {
|
|
6375
6379
|
ok: false,
|
|
6376
6380
|
detail: `距上次轨迹活动不足 ${hours}h(等待中)`
|
|
@@ -6397,7 +6401,7 @@ async function performAutopilotWake(ctx, root, settings, opts = {}) {
|
|
|
6397
6401
|
const message = buildWakeMessage({
|
|
6398
6402
|
sessionName: basename(dirname(mdPath)),
|
|
6399
6403
|
mdPath,
|
|
6400
|
-
intervalHours: Math.max(
|
|
6404
|
+
intervalHours: Math.max(MIN_INTERVAL_HOURS, settings.intervalHours ?? 12),
|
|
6401
6405
|
topPrompt: settings.topPrompt?.trim() || null,
|
|
6402
6406
|
motivation,
|
|
6403
6407
|
biasContent: biasRes.text
|
|
@@ -6562,7 +6566,7 @@ function getAutopilotStatus(root) {
|
|
|
6562
6566
|
const base = {
|
|
6563
6567
|
configured: cfg !== null,
|
|
6564
6568
|
enabled: cfg?.enabled ?? false,
|
|
6565
|
-
intervalHours: Math.max(
|
|
6569
|
+
intervalHours: Math.max(MIN_INTERVAL_HOURS, cfg?.intervalHours ?? 12),
|
|
6566
6570
|
maxDailyWakes: Math.max(1, cfg?.maxDailyWakes ?? 24),
|
|
6567
6571
|
biasProvider: cfg?.biasProvider?.trim() || "autopilot-bias.ts",
|
|
6568
6572
|
topPrompt: cfg?.topPrompt?.trim() || null,
|
|
@@ -9780,14 +9784,18 @@ function isExternalFaceSession(sessionId) {
|
|
|
9780
9784
|
if (!sessionId) return false;
|
|
9781
9785
|
return isSkiffSessionId(sessionId) || sessionId.startsWith("acp-") || sessionId.startsWith("rebuild-");
|
|
9782
9786
|
}
|
|
9783
|
-
/** 读会话最后一个 assistant/message 文本(skiff-core 同款;仅用于守卫检测,不导出)
|
|
9787
|
+
/** 读会话最后一个 assistant/message 文本(skiff-core 同款;仅用于守卫检测,不导出)
|
|
9788
|
+
* **v1.27.7:剥离 think 块再检测**(用户:"不检查think内容(因为不输出)")——
|
|
9789
|
+
* ` think…` 是模型思考过程,不进入用户可见输出;敏感词检测只针对**最终呈现文本**,
|
|
9790
|
+
* 否则 think 内提及内部机制词(思考过程必然推演机制)会误打回。复用 stripThink
|
|
9791
|
+
* (v1.26.8 状态机,弃正则——同 v1.27.1 微信桥回复链路)。 */
|
|
9784
9792
|
function lastAssistantText(agent) {
|
|
9785
9793
|
const events = agent.session.events ?? [];
|
|
9786
9794
|
for (let i = events.length - 1; i >= 0; i--) {
|
|
9787
9795
|
const e = events[i];
|
|
9788
9796
|
if (e && e.type === "assistant/message") {
|
|
9789
9797
|
const text = (e.data?.message?.content ?? e.data?.content ?? []).filter((b) => b.type === "text" && b.text).map((b) => b.text).join("\n");
|
|
9790
|
-
if (text) return text;
|
|
9798
|
+
if (text) return stripThink(text);
|
|
9791
9799
|
}
|
|
9792
9800
|
}
|
|
9793
9801
|
return "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.8",
|
|
4
4
|
"description": "宁静号 ACC harness — Native Cordis 插件(DeepSeek Harness 运行时)。真实 DSH 工具注册(cc_fs/session/acc_msm 等 9 工具)+ 拦截缝机械约束(safe-mode/路径守卫/会话落盘)+ 系统提示词注入(ACC/CCE/Constraints/SKILL/Session 五块)。适配 DSH 公开版(deepseek-ai/deepseek-harness 0.1.0-rc)。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|