@shgroup/dsh-serenity-hooks 1.27.9 → 1.27.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-serenity-hooks",
3
- "version": "1.27.9",
3
+ "version": "1.27.12",
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": {
@@ -48,8 +48,6 @@ export declare const DEFAULT_AVOID_HOURS: {
48
48
  export declare const BIAS_OUTPUT_MAX: number;
49
49
  /** 偏见脚本执行超时(正式版沙箱;原 600s 过长阻塞 tick) */
50
50
  export declare const BIAS_RUN_TIMEOUT_MS = 60000;
51
- /** 每日唤起预算缺省上限(轮次预算——正式版 v1.27.4;防失控 + 控成本) */
52
- export declare const DEFAULT_MAX_DAILY_WAKES = 24;
53
51
  /** 审计历史 ring 上限(每 CCC 保留最近 N 条唤起记录) */
54
52
  export declare const AUDIT_HISTORY_MAX = 50;
55
53
  /** 读配置:新键 autopilotTrajectory 优先,旧键 autotrajectory 回退(正式化兼容) */
@@ -58,8 +56,6 @@ export declare function readAutopilotSettings(root: string): AutopilotTrajectory
58
56
  * 北京时间(UTC+8)当前小时——不依赖服务器时区(服务器可能 UTC/本地任意)。
59
57
  */
60
58
  export declare function beijingHour(nowMs: number): number;
61
- /** 当日已用唤起次数(按北京时间日;轮次预算 maxDailyWakes 判定) */
62
- export declare function dailyWakeCount(history: readonly WakeRecord[], nowMs: number): number;
63
59
  /**
64
60
  * 唤起窗口判定:北京时间 [avoidStart, avoidEnd) 内不唤起(缺省 8~18)。
65
61
  * 单段避开(start<=end):窗口 = [0,start) ∪ [end,24);跨零点避开(start>end):窗口 = [end,start)。
@@ -77,9 +73,10 @@ export declare function isAutopilotSession(mdPath: string): boolean;
77
73
  */
78
74
  export declare function resolveTargetMd(root: string, cfg: AutopilotTrajectorySettings): string | null;
79
75
  /**
80
- * 唤起条件(纯逻辑,可测):enabled + 未在运行 + 目录标志 + mtime 超间隔 + 窗口允许 + 预算未超。
76
+ * 唤起条件(纯逻辑,可测):enabled + 未在运行 + 目录标志 + mtime 超间隔 + 窗口允许。
77
+ * v1.27.12:移除每日唤起预算上限(用户"把这个上限删了吧,没意义"——高频实验不受限)。
81
78
  */
82
- export declare function shouldWake(settings: AutopilotTrajectorySettings, mdPath: string | null, nowMs: number, running: boolean, history?: readonly WakeRecord[]): boolean;
79
+ export declare function shouldWake(settings: AutopilotTrajectorySettings, mdPath: string | null, nowMs: number, running: boolean, _history?: readonly WakeRecord[]): boolean;
83
80
  /** 自生动机读取:SESSION.md「下一轮动机」段内容(到下一个二级标题或文件尾;无 → null) */
84
81
  export declare function readSelfGeneratedMotivation(mdPath: string): string | null;
85
82
  /**
@@ -120,8 +117,9 @@ export declare function wakeHistoryFor(root: string): WakeRecord[];
120
117
  export declare function resetWakeHistory(): void;
121
118
  /**
122
119
  * 执行一次唤起(时钟 tick 与面板「立即唤起」共用):
123
- * - force=false(时钟):完整校验——enabled / 目标命中 / --auto 标志 / 窗口 / 间隔 / 预算 / 偏见脚本
124
- * - force=true(手动调试,用户在场):跳过窗口/间隔/预算,仍校验 enabled / 目标命中 / --auto / 偏见脚本
120
+ * - force=false(时钟):完整校验——enabled / 目标命中 / --auto 标志 / 窗口 / 间隔 / 偏见脚本
121
+ * - force=true(手动调试,用户在场):跳过窗口/间隔,仍校验 enabled / 目标命中 / --auto / 偏见脚本
122
+ * (v1.27.12 移除每日唤起预算——force 无预算可跳,时钟也不受限)
125
123
  * 成功 → 注入前台会话(agent.steer,用户可见);返回结果供调用方(tick 打日志 / 面板显示 / 审计)。
126
124
  */
127
125
  export declare function performAutopilotWake(ctx: Context, root: string, settings: AutopilotTrajectorySettings, opts?: {
@@ -156,8 +154,6 @@ export interface AutopilotTrajectoryStatus {
156
154
  enabled: boolean;
157
155
  /** 无人类活动 N 小时后自动唤起(缺省 12) */
158
156
  intervalHours: number;
159
- /** 每日唤起预算上限(缺省 24) */
160
- maxDailyWakes: number;
161
157
  /** 偏见内容提供者脚本(相对 CCC 根;缺省 autopilot-bias.ts) */
162
158
  biasProvider: string;
163
159
  /** 顶层提示词(每次唤起最先注入的稳定指令;未配置 → null) */
@@ -177,7 +173,7 @@ export interface AutopilotTrajectoryStatus {
177
173
  autoFlag: boolean;
178
174
  /** 距上次轨迹活动(小时) */
179
175
  idleHours: number;
180
- /** 当前时刻是否满足唤起条件(标志+间隔+窗口+预算,未运行中) */
176
+ /** 当前时刻是否满足唤起条件(标志+间隔+窗口,未运行中;v1.27.12 移除每日预算) */
181
177
  wakeable: boolean;
182
178
  } | null;
183
179
  /** 当前北京时间小时 */
package/lib/ccc.d.ts CHANGED
@@ -86,10 +86,8 @@ export interface SerenityConfig {
86
86
  export interface AutopilotTrajectorySettings {
87
87
  /** 总开关(缺省 false——默认关,未开零资源占用) */
88
88
  enabled?: boolean;
89
- /** 无人类活动 N 小时后自动唤起(缺省 12;下限 1h) */
89
+ /** 无人类活动 N 小时后自动唤起(缺省 12;下限 0.01h——v1.27.8 支持小数高频实验) */
90
90
  intervalHours?: number;
91
- /** 每日唤起预算上限(缺省 24——正式版 v1.27.4 轮次预算:防失控 + 控成本) */
92
- maxDailyWakes?: number;
93
91
  /** 偏见内容提供者脚本(相对 CCC 根;缺省 autopilot-bias.ts——缺失报错要求实现) */
94
92
  biasProvider?: string;
95
93
  /**
package/lib/client.js CHANGED
@@ -4910,7 +4910,7 @@ Instruction-following style:
4910
4910
  }
4911
4911
  /** 「Autopilot Trajectory」只读状态区块(v1.26.14;v1.27.4 多 CCC:显式 CCC 选择器——
4912
4912
  * GET/POST 带 ?ccc=/body.ccc——用户"两个 CCC 都设定了,但手工唤起只能唤起一个"修复):
4913
- * 展示所选 CCC 的状态(配置摘要 + 目标会话 + 窗口/预算/可唤起判定 + 审计);配置改走 CCC 配置文件 */
4913
+ * 展示所选 CCC 的状态(配置摘要 + 目标会话 + 窗口/可唤起判定 + 审计);配置改走 CCC 配置文件 */
4914
4914
  function AutopilotTrajectoryStatusBlock() {
4915
4915
  const [cccs, setCccs] = (0, react.useState)([]);
4916
4916
  const [selectedRoot, setSelectedRoot] = (0, react.useState)("");
@@ -5043,10 +5043,6 @@ Instruction-following style:
5043
5043
  term: "唤起窗口",
5044
5044
  value: `北京 ${status.beijingHour} 点 — ${status.windowAllowed ? "允许" : `避开 ${status.avoidWakeHours.start}~${status.avoidWakeHours.end}`}`
5045
5045
  },
5046
- {
5047
- term: "每日预算",
5048
- value: `${status.maxDailyWakes} 次/日`
5049
- },
5050
5046
  {
5051
5047
  term: "偏见提供者",
5052
5048
  value: status.biasProvider
@@ -5063,8 +5059,8 @@ Instruction-following style:
5063
5059
  }) }),
5064
5060
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowCard, {
5065
5061
  title: "立即唤起",
5066
- desc: wakeResult ?? "调试:手动触发一次(跳过窗口/间隔/预算,仍校验配置与偏见脚本)",
5067
- help: "立即唤起(调试语义):\n· 用途:手动触发一次该 CCC 的自动唤起(不等时钟)\n· 跳过:唤起窗口(北京 8~18 点避开)/ 间隔 / 每日预算\n· 保留校验:enabled、目标会话(--auto)、偏见脚本可运行\n· 场景:验证配置/偏见脚本是否就绪,或想立刻跑一轮",
5062
+ desc: wakeResult ?? "调试:手动触发一次(跳过窗口/间隔,仍校验配置与偏见脚本)",
5063
+ help: "立即唤起(调试语义):\n· 用途:手动触发一次该 CCC 的自动唤起(不等时钟)\n· 跳过:唤起窗口(北京 8~18 点避开)/ 间隔\n· 保留校验:enabled、目标会话(--auto)、偏见脚本可运行\n· 场景:验证配置/偏见脚本是否就绪,或想立刻跑一轮",
5068
5064
  control: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
5069
5065
  type: "button",
5070
5066
  className: "ss-wakeBtn",
package/lib/index.js CHANGED
@@ -4027,7 +4027,6 @@ var autopilot_trajectory_exports = /* @__PURE__ */ __exportAll({
4027
4027
  BIAS_RUN_TIMEOUT_MS: () => BIAS_RUN_TIMEOUT_MS,
4028
4028
  DEFAULT_AVOID_HOURS: () => DEFAULT_AVOID_HOURS,
4029
4029
  DEFAULT_BIAS_PROVIDER: () => DEFAULT_BIAS_PROVIDER,
4030
- DEFAULT_MAX_DAILY_WAKES: () => 24,
4031
4030
  LEGACY_BIAS_PROVIDER: () => LEGACY_BIAS_PROVIDER,
4032
4031
  MIN_INTERVAL_HOURS: () => MIN_INTERVAL_HOURS,
4033
4032
  MOTIVATION_MARKER: () => MOTIVATION_MARKER,
@@ -4035,7 +4034,6 @@ var autopilot_trajectory_exports = /* @__PURE__ */ __exportAll({
4035
4034
  beijingHour: () => beijingHour,
4036
4035
  buildWakeMessage: () => buildWakeMessage,
4037
4036
  collectAutopilotCccs: () => collectAutopilotCccs,
4038
- dailyWakeCount: () => dailyWakeCount,
4039
4037
  diagLive: () => diagLive,
4040
4038
  fetchBiasContent: () => fetchBiasContent,
4041
4039
  getAutopilotStatus: () => getAutopilotStatus,
@@ -4087,11 +4085,6 @@ function readAutopilotSettings(root) {
4087
4085
  function beijingHour(nowMs) {
4088
4086
  return Math.floor((nowMs + 288e5) % 864e5 / 36e5);
4089
4087
  }
4090
- /** 当日已用唤起次数(按北京时间日;轮次预算 maxDailyWakes 判定) */
4091
- function dailyWakeCount(history, nowMs) {
4092
- const day = Math.floor((nowMs + 288e5) / 864e5);
4093
- return history.filter((r) => Math.floor((r.time + 288e5) / 864e5) === day).length;
4094
- }
4095
4088
  /**
4096
4089
  * 唤起窗口判定:北京时间 [avoidStart, avoidEnd) 内不唤起(缺省 8~18)。
4097
4090
  * 单段避开(start<=end):窗口 = [0,start) ∪ [end,24);跨零点避开(start>end):窗口 = [end,start)。
@@ -4120,14 +4113,13 @@ function resolveTargetMd(root, cfg) {
4120
4113
  return existsSync(md) ? md : null;
4121
4114
  }
4122
4115
  /**
4123
- * 唤起条件(纯逻辑,可测):enabled + 未在运行 + 目录标志 + mtime 超间隔 + 窗口允许 + 预算未超。
4116
+ * 唤起条件(纯逻辑,可测):enabled + 未在运行 + 目录标志 + mtime 超间隔 + 窗口允许。
4117
+ * v1.27.12:移除每日唤起预算上限(用户"把这个上限删了吧,没意义"——高频实验不受限)。
4124
4118
  */
4125
- function shouldWake(settings, mdPath, nowMs, running, history = []) {
4119
+ function shouldWake(settings, mdPath, nowMs, running, _history = []) {
4126
4120
  if (!settings?.enabled || running) return false;
4127
4121
  if (!mdPath || !isAutopilotSession(mdPath)) return false;
4128
4122
  if (!inAllowedWakeWindow(nowMs, settings.avoidWakeHours)) return false;
4129
- const maxDaily = Math.max(1, settings.maxDailyWakes ?? 24);
4130
- if (dailyWakeCount(history, nowMs) >= maxDaily) return false;
4131
4123
  try {
4132
4124
  const mtime = statSync(mdPath).mtimeMs;
4133
4125
  const hours = Math.max(MIN_INTERVAL_HOURS, settings.intervalHours ?? 12);
@@ -4231,8 +4223,9 @@ function wakeHistoryFor(root) {
4231
4223
  }
4232
4224
  /**
4233
4225
  * 执行一次唤起(时钟 tick 与面板「立即唤起」共用):
4234
- * - force=false(时钟):完整校验——enabled / 目标命中 / --auto 标志 / 窗口 / 间隔 / 预算 / 偏见脚本
4235
- * - force=true(手动调试,用户在场):跳过窗口/间隔/预算,仍校验 enabled / 目标命中 / --auto / 偏见脚本
4226
+ * - force=false(时钟):完整校验——enabled / 目标命中 / --auto 标志 / 窗口 / 间隔 / 偏见脚本
4227
+ * - force=true(手动调试,用户在场):跳过窗口/间隔,仍校验 enabled / 目标命中 / --auto / 偏见脚本
4228
+ * (v1.27.12 移除每日唤起预算——force 无预算可跳,时钟也不受限)
4236
4229
  * 成功 → 注入前台会话(agent.steer,用户可见);返回结果供调用方(tick 打日志 / 面板显示 / 审计)。
4237
4230
  */
4238
4231
  async function performAutopilotWake(ctx, root, settings, opts = {}) {
@@ -4373,6 +4366,9 @@ function registerAutopilot(ctx) {
4373
4366
  try {
4374
4367
  ctx.on("session/created", () => startTimer());
4375
4368
  } catch {}
4369
+ try {
4370
+ ctx.on("serenity/settings-changed", () => startTimer());
4371
+ } catch {}
4376
4372
  }
4377
4373
  /** 目标 agent:从 SESSION.md 反向定位 dsh 会话(标题 F3 命名 S###-日期 匹配 + cwd 归属校验);不可得 → null */
4378
4374
  function resolveTargetAgent(ctx, mdPath) {
@@ -4459,7 +4455,6 @@ function getAutopilotStatus(root) {
4459
4455
  configured: cfg !== null,
4460
4456
  enabled: cfg?.enabled ?? false,
4461
4457
  intervalHours: Math.max(MIN_INTERVAL_HOURS, cfg?.intervalHours ?? 12),
4462
- maxDailyWakes: Math.max(1, cfg?.maxDailyWakes ?? 24),
4463
4458
  biasProvider: cfg?.biasProvider?.trim() || "autopilot-bias.ts",
4464
4459
  topPrompt: cfg?.topPrompt?.trim() || null,
4465
4460
  session: cfg?.session ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.27.9",
3
+ "version": "1.27.12",
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": {