@shgroup/dsh-serenity-hooks 1.27.14 → 1.28.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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-serenity-hooks",
3
- "version": "1.27.14",
3
+ "version": "1.28.0",
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": {
@@ -19,7 +19,8 @@
19
19
  "handyman",
20
20
  "session_rebuild",
21
21
  "localstore",
22
- "skiff_admin"
22
+ "skiff_admin",
23
+ "autopilot-trajectory"
23
24
  ],
24
25
  "skills": []
25
26
  }
@@ -59,6 +59,24 @@ function resolveInside(root, p) {
59
59
  return abs;
60
60
  }
61
61
  /**
62
+ * CCC 名:从 .serenity 标记解析——**跳过 # 注释与空行的首个非空行**。
63
+ * 注册表聚合档路径(.opencode/skills/<cccName>/references/mech-registry.json)以此为准,
64
+ * 是 guards/fs-ops/msm-ops/kit-ops 四处解析的唯一真相源(review P2-2 收口,09-05:
65
+ * 原四处分叉——msm-ops/kit-ops 取严格首行、guards/fs-ops 跳注释——首行为注释/空行时
66
+ * register 目标路径与保护路径分叉,潜在隐患)。
67
+ * @returns CCC 名;无标记/读失败/全注释空行 → null
68
+ */
69
+ function readCccName(root) {
70
+ try {
71
+ const marker = resolve(root, ".serenity");
72
+ if (!existsSync(marker)) return null;
73
+ const line = readFileSync(marker, "utf-8").split("\n").map((l) => l.trim()).find((l) => l !== "" && !l.startsWith("#"));
74
+ return line && line !== "" ? line : null;
75
+ } catch {
76
+ return null;
77
+ }
78
+ }
79
+ /**
62
80
  * 解析 handyman 配置(v1.24.0:取代 loop.defaultModel;不兼容旧 loop 配置——用户拍板)。
63
81
  * @returns 白名单 + 缺省模型 + 上限;models 未配置返回 null(工具应报错要求配置)
64
82
  */
@@ -138,4 +156,4 @@ function matchBlacklist(relPath, rules) {
138
156
  return null;
139
157
  }
140
158
  //#endregion
141
- export { findSerenityRoot as a, matchBlacklist as c, readHandymanConfig as d, readUtf8 as f, findGitRoot as i, pathInside as l, SAFE_MODE_MARKER as n, isSafeModeOn as o, resolveInside as p, classifyPath as r, loadSerenityConfig as s, DEFAULT_SERENITY_CONFIG_PATHS as t, readBlacklist as u };
159
+ export { findSerenityRoot as a, matchBlacklist as c, readCccName as d, readHandymanConfig as f, findGitRoot as i, pathInside as l, resolveInside as m, SAFE_MODE_MARKER as n, isSafeModeOn as o, readUtf8 as p, classifyPath as r, loadSerenityConfig as s, DEFAULT_SERENITY_CONFIG_PATHS as t, readBlacklist as u };
package/lib/ccc.d.ts CHANGED
@@ -22,6 +22,15 @@ export type PathClass = 'inside' | 'outside' | 'same';
22
22
  export declare function pathInside(rootAbs: string, abs: string, caseInsensitive?: boolean): boolean;
23
23
  export declare function classifyPath(p: string, root: string): PathClass;
24
24
  export declare function resolveInside(root: string, p: string): string;
25
+ /**
26
+ * CCC 名:从 .serenity 标记解析——**跳过 # 注释与空行的首个非空行**。
27
+ * 注册表聚合档路径(.opencode/skills/<cccName>/references/mech-registry.json)以此为准,
28
+ * 是 guards/fs-ops/msm-ops/kit-ops 四处解析的唯一真相源(review P2-2 收口,09-05:
29
+ * 原四处分叉——msm-ops/kit-ops 取严格首行、guards/fs-ops 跳注释——首行为注释/空行时
30
+ * register 目标路径与保护路径分叉,潜在隐患)。
31
+ * @returns CCC 名;无标记/读失败/全注释空行 → null
32
+ */
33
+ export declare function readCccName(root: string): string | null;
25
34
  export interface SerenityConfig {
26
35
  /** handyman(杂工)配置:模型白名单(v1.24.0 取代 loop) */
27
36
  handyman?: {
package/lib/client.js CHANGED
@@ -4737,7 +4737,7 @@ Instruction-following style:
4737
4737
  scope.set(field, on);
4738
4738
  };
4739
4739
  const setThreshold = (v) => {
4740
- scope.set("rebuildThreshold", Math.min(1, Math.max(.01, v)));
4740
+ scope.set("rebuildThresholdK", Math.min(4e3, Math.max(50, Math.round(v))));
4741
4741
  };
4742
4742
  const setSkiffPort = (v) => {
4743
4743
  scope.set("skiffDebugPort", Math.min(65535, Math.max(1024, Math.round(v))));
@@ -4754,7 +4754,7 @@ Instruction-following style:
4754
4754
  });
4755
4755
  const gatewayOn = value?.gatewayEnabled ?? false;
4756
4756
  const rebuildOn = value?.rebuildEnabled ?? true;
4757
- const threshold = value?.rebuildThreshold ?? .9;
4757
+ const thresholdK = value?.rebuildThresholdK ?? 400;
4758
4758
  const skiffOn = value?.skiffEnabled ?? false;
4759
4759
  const skiffPort = value?.skiffDebugPort ?? 3099;
4760
4760
  const acpOn = value?.acpEnabled ?? false;
@@ -4796,22 +4796,18 @@ Instruction-following style:
4796
4796
  })
4797
4797
  }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowCard, {
4798
4798
  title: "重建阈值",
4799
- desc: "上下文占用达到该比例时提示(0.10 ~ 1.00)",
4800
- help: "重建触发阈值(0.10~1.00,默认 0.90):\n· 含义:上下文占用达到该比例时,轨迹跟踪器开始提醒重建\n· 调低:更早触发(适合长任务,避免上下文耗尽前措手不及)\n· 调高:更晚触发(适合短对话,减少不必要的重建提示)\n· 仅「超限重建」开启时有意义",
4801
- control: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4802
- className: "ss-threshold",
4803
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4804
- type: "range",
4805
- min: .1,
4806
- max: 1,
4807
- step: .05,
4808
- value: threshold,
4809
- disabled: !rebuildOn,
4810
- onChange: (e) => setThreshold(Number(e.target.value))
4811
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4812
- className: "ss-value",
4813
- children: threshold.toFixed(2)
4814
- })]
4799
+ desc: "上下文占用达到该 K 数值时提示(单位 K token,默认 400)",
4800
+ help: "重建触发阈值(需求①:K 数值,默认 400K,范围 50~4000K):\n· 含义:上下文 projected tokens 达到 thresholdK × 1000 时,轨迹跟踪器开始提醒重建\n· 纯绝对数值(不再依赖窗口比例)——配多大就多大,无窗口上限保护\n· 迁移:旧版 0~1 比例(settings.yaml rebuildThreshold,如 0.9)已废弃并被忽略——\n 请按 K 数值在此重设(如 0.9 → 900);若从未设置则默认 400K 生效\n· 调低:更早触发(适合长任务,避免上下文耗尽前措手不及)\n· 调高:更晚触发(适合短对话,减少不必要的重建提示)\n· 仅「超限重建」开启时有意义",
4801
+ control: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4802
+ className: "ss-portInput",
4803
+ type: "number",
4804
+ min: 50,
4805
+ max: 4e3,
4806
+ step: 50,
4807
+ value: thresholdK,
4808
+ disabled: !rebuildOn,
4809
+ title: "重建阈值(K token,默认 400)",
4810
+ onChange: (e) => setThreshold(Number(e.target.value))
4815
4811
  })
4816
4812
  }) })]
4817
4813
  }),
@@ -42,12 +42,6 @@ export interface GatewaySettings {
42
42
  /** 是否启用 Authenticator 第二因素(v1.22.4;false = TOTP 完全禁用——登录不要求、绑定入口隐藏) */
43
43
  totpEnabled: boolean;
44
44
  }
45
- /** F2 超限重建配置 */
46
- export interface RebuildSettings {
47
- enabled: boolean;
48
- /** contextPressure 触发比例(0~1) */
49
- thresholdRatio: number;
50
- }
51
45
  /** 彩蛋功能:persona 模式(v1.23.1,S142 用户需求)
52
46
  * 配置后替换 ACC 系统提示词中"输出约束/指令遵循约束"部分(EAP 块 + MSM 原则段);
53
47
  * 未配置(mode 空)→ 完全默认行为,零影响。 */
@@ -66,10 +60,15 @@ export interface PublicAskSettings {
66
60
  /** 开放容器白名单(CCC 目录名,如 home-serenity);空数组 = 全部容器开放 */
67
61
  allowed: string[];
68
62
  }
69
- /** 高级设定全量(localstore.json 持久化形态;passHash 含 hash) */
63
+ /**
64
+ * 高级设定全量(~/.dsh/serenity-hooks.json 持久化形态;passHash 含 hash)。
65
+ * review P2-3:**rebuild 已从高级配置删除**——rebuild 开关/阈值归"简单配置"
66
+ * (settings.yaml 原生面板,见 settings-section.ts),运行时只读 readSimpleSettings();
67
+ * 旧高级 rebuild 字段是死双胞胎(/serenity/config PUT 回显但运行时从不读它)——
68
+ * 删除防误导(用户在高级面板改了却无效)。历史残留字段被 mergeWithDefaults 忽略(幂等安全)。
69
+ */
70
70
  export interface AdvancedSettings {
71
71
  gateway: GatewaySettings;
72
- rebuild: RebuildSettings;
73
72
  persona: PersonaSettings;
74
73
  publicAsk: PublicAskSettings;
75
74
  }
@@ -131,7 +130,7 @@ export interface GatewayAccountWire {
131
130
  /** 该账号是否已绑定 TOTP(v1.22.4) */
132
131
  hasTotp: boolean;
133
132
  }
134
- /** 设定 wire 形态(GET /serenity/config 返回;rebuild 同持久化,gateway 去 hash) */
133
+ /** 设定 wire 形态(GET /serenity/config 返回;gateway 去 hash) */
135
134
  export interface AdvancedSettingsWire {
136
135
  gateway: {
137
136
  enabled: boolean;
@@ -143,7 +142,6 @@ export interface AdvancedSettingsWire {
143
142
  allowWorkspaceCreate: boolean;
144
143
  totpEnabled: boolean;
145
144
  };
146
- rebuild: RebuildSettings;
147
145
  persona: PersonaSettings;
148
146
  publicAsk: {
149
147
  /** 开放容器白名单(v1.26.2:容器名数组;空 = 全部开放) */
package/lib/index.d.ts CHANGED
@@ -47,7 +47,7 @@ export interface Config {
47
47
  /** F2 超限重建(entry 默认值,运行时经 DSH settings) */
48
48
  rebuild?: {
49
49
  enabled?: boolean;
50
- thresholdRatio?: number;
50
+ thresholdK?: number;
51
51
  };
52
52
  /** F4 Skiff(实验性):调试服务启停(entry 默认值,运行时经 DSH settings) */
53
53
  skiff?: {