@shgroup/dsh-serenity-hooks 1.73.0 → 1.75.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.
Files changed (48) hide show
  1. package/README.md +18 -12
  2. package/dsh.plugin.json +2 -2
  3. package/lib/accounts-BHQbakUh.js +33 -0
  4. package/lib/{ccc-CZUOq3NY.js → ccc-CyYJL4F2.js} +9 -9
  5. package/lib/{ccc-roots-BhoA7G-0.js → ccc-roots-BVxn97dY.js} +4 -4
  6. package/lib/client.js +116 -1
  7. package/lib/cro/core.d.ts +11 -1
  8. package/lib/cro/log.d.ts +54 -4
  9. package/lib/guard/seam.d.ts +4 -4
  10. package/lib/host/effect.d.ts +1 -1
  11. package/lib/im/bridge.d.ts +3 -3
  12. package/lib/im/endpoint.d.ts +2 -2
  13. package/lib/im/guard.d.ts +1 -1
  14. package/lib/im/hook.d.ts +1 -1
  15. package/lib/im/inbound-event.d.ts +6 -6
  16. package/lib/im/route.d.ts +25 -3
  17. package/lib/index.d.ts +5 -5
  18. package/lib/index.js +680 -295
  19. package/lib/kernel/ccc-roots.d.ts +4 -4
  20. package/lib/kernel/ccc.d.ts +20 -19
  21. package/lib/kernel/ports.d.ts +1 -1
  22. package/lib/{message-source-ChyVfev9.js → message-source-JhN-qyfn.js} +2 -2
  23. package/lib/patches/opencode-provider.d.ts +1 -1
  24. package/lib/{profile-BIQ2widI.js → profile-Cz4oBXlI.js} +197 -65
  25. package/lib/{route-ItCgAsnz.js → route-COOFLTpU.js} +44 -6
  26. package/lib/seams/guards.d.ts +14 -14
  27. package/lib/seams/keeper.d.ts +1 -1
  28. package/lib/seams/lifecycle.d.ts +2 -2
  29. package/lib/{settings-UcwIPJhM.js → settings-CII0Y597.js} +40 -26
  30. package/lib/surface/faces.d.ts +1 -1
  31. package/lib/surface/http.d.ts +1 -1
  32. package/lib/surface/settings.d.ts +7 -7
  33. package/lib/surface/text.d.ts +3 -3
  34. package/lib/tools/config-docs.d.ts +71 -0
  35. package/lib/tools/container-admin.d.ts +24 -12
  36. package/lib/tools/msm/service.d.ts +18 -0
  37. package/lib/tools/trajectory-constraint-admin.d.ts +30 -0
  38. package/lib/trajectory/carrier.d.ts +1 -1
  39. package/lib/trajectory/core.d.ts +11 -1
  40. package/lib/trajectory/policy/files.d.ts +75 -0
  41. package/lib/trajectory/policy/profile.d.ts +41 -36
  42. package/lib/trajectory/policy/rules.d.ts +33 -20
  43. package/lib/trajectory/policy/window.d.ts +13 -13
  44. package/lib/trajectory/prompt.d.ts +12 -12
  45. package/lib/trajectory/rebuild.d.ts +2 -2
  46. package/lib/trajectory/session.d.ts +49 -49
  47. package/package.json +2 -2
  48. package/lib/tools/skiff-admin.d.ts +0 -30
@@ -8,7 +8,7 @@
8
8
  * **轨迹提示词** = 一条认知轨迹的**可编辑章程声明**,由 ACC 按固定顺序装配进系统提示词。
9
9
  * 三个关键词各是一条判据:
10
10
  * - **可编辑**:住在 CCC(盘上),改它**不发版**(D23 归属判据的直接推论)
11
- * - **声明**:它声明**身份/章程/方法论**,**不声明能力**(能力面归 `skiff.json` 白名单与工具 schema)
11
+ * - **声明**:它声明**身份/章程/方法论**,**不声明能力**(能力面归 `trajectory-constraint.json` 白名单与工具 schema)
12
12
  * - **固定顺序**:装配顺序由 ACC 定死(见 `seams/system-prompt.ts` 的 ⑧ 位)
13
13
  *
14
14
  * ## 为什么取代「人格」
@@ -23,24 +23,24 @@
23
23
  *
24
24
  * - **跟着轨迹走**:`archive` 时整个目录搬走,章程不会掉队(旧形态 `.opencode/skiff/<name>.md`
25
25
  * 与轨迹**分居两处** —— 多条轨迹共用一份文件正是那个后果)。
26
- * - **每条轨迹都能有**:不只是 skiff。普通轨迹同样需要"我是谁、按什么章程"。
27
- * - 与 `SESSION.md`(身体:延续/日志)、`skiff.json`(约束面:能力)三件并列,
26
+ * - **每条轨迹都能有**:不只是 轨迹约束。普通轨迹同样需要"我是谁、按什么章程"。
27
+ * - 与 `SESSION.md`(身体:延续/日志)、`trajectory-constraint.json`(约束面:能力)三件并列,
28
28
  * 各管一件事,不合并(合并会让"改能力"与"改身份"互相牵连)。
29
29
  *
30
30
  * ## 兼容(不静默坏)
31
31
  *
32
- * `PROMPT.md` 不存在时**不报错**(普通轨迹常态)。skiff 的旧字段 `systemPromptFile`
32
+ * `PROMPT.md` 不存在时**不报错**(普通轨迹常态)。轨迹约束的旧字段 `systemPromptFile`
33
33
  * 在兼容期仍被读取——优先级见 {@link resolveTrajectoryPrompt}。
34
34
  */
35
- import type { SkiffProfile } from './policy/profile.js';
35
+ import type { TrajectoryConstraint } from './policy/profile.js';
36
36
  /** 轨迹提示词的固定文件名(**判据就是它存在**——不是目录名前缀,也不是配置里的一行) */
37
37
  export declare const TRAJECTORY_PROMPT_FILENAME = "PROMPT.md";
38
38
  /** 一次解析的结果(`source` 说明正文**从哪来**,便于诊断与「为什么我改的不生效」) */
39
39
  export interface TrajectoryPromptResolution {
40
40
  /** 提示词正文(已 trim);无来源 ⇒ 空串 */
41
41
  text: string;
42
- /** 来源:轨迹目录的 PROMPT.md / skiff 旧字段 / 无 */
43
- source: 'trajectory-file' | 'skiff-legacy' | 'none';
42
+ /** 来源:轨迹目录的 PROMPT.md / 轨迹约束 旧字段 / 无 */
43
+ source: 'trajectory-file' | '轨迹约束-legacy' | 'none';
44
44
  /** 实际读取的绝对路径(`none` ⇒ null) */
45
45
  path: string | null;
46
46
  }
@@ -49,9 +49,9 @@ export declare function trajectoryPromptPath(root: string, dirName: string): str
49
49
  /**
50
50
  * 该轨迹**有没有**轨迹提示词(单一判据)。
51
51
  *
52
- * 用途:兼容期的"让位"判定 —— 若已有 `PROMPT.md`,skiff 旧字段 `systemPromptFile`
53
- * 必须**让位**,否则同一份章程会在两处各注入一遍(第 ⑧ 段 + `serenity-skiff` 段)。
54
- * 🔴 判据只有这一处:别在 skiff 那边自己拼路径再判(两处会漂)。
52
+ * 用途:兼容期的"让位"判定 —— 若已有 `PROMPT.md`,轨迹约束 旧字段 `systemPromptFile`
53
+ * 必须**让位**,否则同一份章程会在两处各注入一遍(第 ⑧ 段 + `serenity-轨迹约束` 段)。
54
+ * 🔴 判据只有这一处:别在 轨迹约束那边自己拼路径再判(两处会漂)。
55
55
  */
56
56
  export declare function hasTrajectoryPrompt(root: string, dirName: string): boolean;
57
57
  /**
@@ -61,13 +61,13 @@ export declare function hasTrajectoryPrompt(root: string, dirName: string): bool
61
61
  *
62
62
  * 优先级(**确定性,只有这一条**):
63
63
  * ① `<轨迹目录>/PROMPT.md` —— 新形态,**所有轨迹**都能有
64
- * ② skiff 的 `systemPromptFile` —— **兼容期**旧形态(存量 CCC 不必同批迁移)
64
+ * ② 轨迹约束的 `systemPromptFile` —— **兼容期**旧形态(存量 CCC 不必同批迁移)
65
65
  * ③ 无 ⇒ 空串(**不是错误**:没有章程的轨迹是常态)
66
66
  *
67
67
  * ⚠️ 读失败(权限/坏文件)⇒ 空串而不是抛错:提示词读不到不该阻断会话创建;
68
68
  * 但**会告警**(见 reader 版本),不静默。
69
69
  */
70
- export declare function resolveTrajectoryPrompt(root: string, dirName: string, legacyProfile?: SkiffProfile | null): TrajectoryPromptResolution;
70
+ export declare function resolveTrajectoryPrompt(root: string, dirName: string, legacyProfile?: TrajectoryConstraint | null): TrajectoryPromptResolution;
71
71
  /**
72
72
  * 轨迹提示词的**读取器**(长期热更新;改文件即生效,无需重启)。
73
73
  *
@@ -75,9 +75,9 @@ interface RebuildResult {
75
75
  * → ②b **权威绑定**(`AGENT_SESSIONS/.bindings.json`,本会话持久绑定)→ ③ surface 首条锚点
76
76
  * (events 异常时兜底)。
77
77
  *
78
- * v1.30.13(S142 用户"微信桥 + skiff 会话锚定要准确",诊断 D4):**移除**原 ④「全局最新未完成
78
+ * v1.30.13(S142 用户"微信桥 + 轨迹约束会话锚定要准确",诊断 D4):**移除**原 ④「全局最新未完成
79
79
  * 会话」(`findLatestActiveSessionMd`)。理由(R↓):④ 是**跨轨迹**猜测——候选①②③全空时,
80
- * 它会把 rebuild 静默接到 AGENT_SESSIONS 里最新的另一个会话(临时 skiff 会话 persistent=false、
80
+ * 它会把 rebuild 静默接到 AGENT_SESSIONS 里最新的另一个会话(临时 轨迹约束会话 persistent=false、
81
81
  * 重启后首条消息前、新会话首条消息都命中该形态),而"接错轨迹"比重建失败危险得多
82
82
  * (错误轨迹被继续写入 + 正确轨迹静默丢失)。现在全部候选失败 → 返回 null → 调用方
83
83
  * 报错引导用户显式 `cognitive_trajectory use`(响亮失败优于静默接错)。
@@ -1,24 +1,24 @@
1
1
  /**
2
- * trajectory/session.ts — 轨迹的**会话(载体)管理**(**2026-10-19 重做**:skiff = 带 `skiff.json` 的认知轨迹)
2
+ * trajectory/session.ts — 轨迹的**会话(载体)管理**(**2026-10-19 重做**:轨迹约束 = 带 `trajectory-constraint.json` 的认知轨迹)
3
3
  *
4
4
  * ## 与旧版的根本差别(R↓,这是那次重做的全部内容)
5
5
  *
6
- * 旧版:skiff 是**一个角色**(`serenity.json` 的 `skiff.roles.<name>`),会话身份由
7
- * dsh sessionId 前缀 `skiff-` 判定,工作台由 `ensureSkiffSession` **另建一个 SESSION**。
6
+ * 旧版:轨迹约束是**一个角色**(`serenity.json` 的 `轨迹约束.roles.<name>`),会话身份由
7
+ * dsh sessionId 前缀 `轨迹约束-` 判定,工作台由 `ensureTrajectorySession` **另建一个 SESSION**。
8
8
  *
9
- * 新版:skiff 是**一条认知轨迹**(目录里有 `skiff.json`)——
9
+ * 新版:轨迹约束是**一条认知轨迹**(目录里有 `trajectory-constraint.json`)——
10
10
  * · **身份 = 轨迹编码**(不是角色名,不是 sessionId 前缀);
11
- * · **工作台 = 该轨迹自己的 SESSION.md**(不再另建,`ensureSkiffSession` 已删除);
12
- * · **判据 = 绑定的轨迹有没有 `skiff.json`**(唯一入口 `policy/profile.ts` 的 `skiffProfileForSession`)。
11
+ * · **工作台 = 该轨迹自己的 SESSION.md**(不再另建,`ensureTrajectorySession` 已删除);
12
+ * · **判据 = 绑定的轨迹有没有 `trajectory-constraint.json`**(唯一入口 `policy/profile.ts` 的 `trajectoryConstraintForSession`)。
13
13
  *
14
14
  * ⇒ 删掉的东西(它们只是旧模型的补丁,不是通用机制):
15
- * `SKIFF_SESSION_PREFIX` 判定 / `ensureSkiffSession` 自动建工作台 /
15
+ * `SKIFF_SESSION_PREFIX` 判定 / `ensureTrajectorySession` 自动建工作台 /
16
16
  * `kind: temporary|persistent` / 换代计数器(`im/route.ts` 的 `.weixin-session-gen.json`)。
17
17
  *
18
18
  * ## 本文件仍负责
19
19
  * agent 创建/复用(resume-or-create)/系统提示词段注册/提问与等本轮回答/守门查询。
20
20
  *
21
- * ## S13(2026-10-19,轨迹中心重构):此前位于 `role/skiff/` 下(该目录已随本重构消失)
21
+ * ## S13(2026-10-19,轨迹中心重构):此前位于 `role/轨迹约束/` 下(该目录已随本重构消失)
22
22
  *
23
23
  * 文件名从 `core` 改为 `session`:它管的是**轨迹的会话(载体)**——
24
24
  * 与同目录 `live.ts`(活载体查询)/`rebuild.ts`(换船板)/`cleanup.ts`(清理)同族。
@@ -29,61 +29,61 @@
29
29
  */
30
30
  import type { Context } from 'cordis';
31
31
  import type { Agent, AgentHandle } from '@deepseek-ai/dsh-agent';
32
- import { type SkiffProfile } from './policy/profile.js';
33
- export type { SkiffProfile };
32
+ import { type TrajectoryConstraint } from './policy/profile.js';
33
+ export type { TrajectoryConstraint };
34
34
  /** 查 sessionId 承载的轨迹目录名(无 → null) */
35
- export declare function skiffTrajectoryDirNameFor(sessionId: string): string | null;
35
+ export declare function trajectoryDirNameForSession(sessionId: string): string | null;
36
36
  /** 查 sessionId 的会话绑定(轨迹 + ccc;无 → null)——追问校验 */
37
- export declare function skiffSessionInfo(sessionId: string): {
37
+ export declare function trajectorySessionInfo(sessionId: string): {
38
38
  trajectoryDirName: string;
39
39
  ccc: string;
40
40
  } | null;
41
41
  /** 查 sessionId 的活体 agent(进程内会话延续用;未注册/已清理 → undefined) */
42
- export declare function getSkiffAgent(sessionId: string): Agent | undefined;
43
- /** 该会话当前绑定的 skiff 约束面(不是 skiff → null)。**守门与提示词的唯一查询入口。** */
44
- export declare function skiffProfileFor(root: string, sessionId: string | undefined): SkiffProfile | null;
45
- export declare function registerSkiffSession(sessionId: string, trajectoryDirName: string, ccc: string, agent: Agent): void;
46
- export declare function unregisterSkiffSession(sessionId: string): void;
42
+ export declare function getTrajectoryAgent(sessionId: string): Agent | undefined;
43
+ /** 该会话当前绑定的 轨迹约束面(不是 轨迹约束 → null)。**守门与提示词的唯一查询入口。** */
44
+ export declare function trajectoryConstraintFor(root: string, sessionId: string | undefined): TrajectoryConstraint | null;
45
+ export declare function registerTrajectorySession(sessionId: string, trajectoryDirName: string, ccc: string, agent: Agent): void;
46
+ export declare function unregisterTrajectorySession(sessionId: string): void;
47
47
  /** 测试/调试:注册表快照 */
48
- export declare function skiffSessionSnapshot(): ReadonlyMap<string, {
48
+ export declare function trajectorySessionSnapshot(): ReadonlyMap<string, {
49
49
  trajectoryDirName: string;
50
50
  ccc: string;
51
51
  }>;
52
52
  /**
53
- * 该 skiff 会话的**工作台路径** = 它自己轨迹的 SESSION.md。
53
+ * 该 轨迹约束会话的**工作台路径** = 它自己轨迹的 SESSION.md。
54
54
  *
55
- * 🔴 与旧版的差别:旧版会在这里**自动新建**一个 SESSION(`ensureSkiffSession`);
56
- * 新版**没有新建这个动作** —— 轨迹就是工作台,`skiff.json` 与 `SESSION.md` 同处一个目录。
55
+ * 🔴 与旧版的差别:旧版会在这里**自动新建**一个 SESSION(`ensureTrajectorySession`);
56
+ * 新版**没有新建这个动作** —— 轨迹就是工作台,`trajectory-constraint.json` 与 `SESSION.md` 同处一个目录。
57
57
  * ⇒ 语义变成纯粹的"查询:我自己的身体在哪"。
58
58
  *
59
- * @returns SESSION.md 绝对路径;不是 skiff / 文件不在 → null
59
+ * @returns SESSION.md 绝对路径;不是 轨迹约束 / 文件不在 → null
60
60
  */
61
- export declare function skiffWorkspaceMdPath(root: string, sessionId: string | undefined): string | null;
61
+ export declare function trajectoryWorkspaceMdPath(root: string, sessionId: string | undefined): string | null;
62
62
  /**
63
63
  * 系统提示词中的**工作台纪律块**(S142 用户:只给路径 LLM 不会主动用)。
64
64
  *
65
- * SESSION = 工作台 —— skiff 与主舱同一套机制(**零特调**,用户拍板):
65
+ * SESSION = 工作台 —— 轨迹约束与主舱同一套机制(**零特调**,用户拍板):
66
66
  * SESSION.md 是持久记忆载体、rebuild 自动从本 SESSION 续接。
67
67
  * 注入 agent 系统提示词(用户对话面不可见)。
68
68
  *
69
69
  * v1.30.13(S142 诊断 D5):写入纪律**不点名具体工具** —— 旧文案写死 "with write/edit",
70
- * 而某个 skiff 的工具白名单里根本没有 write/edit ⇒ 指令指向它没有的工具
70
+ * 而某个 轨迹约束的工具白名单里根本没有 write/edit ⇒ 指令指向它没有的工具
71
71
  * (注入纪律与能力面矛盾,模型只能猜)。现文案改为「用本轨迹被授权的写入通道」。
72
72
  */
73
73
  export declare function workspaceCognitiveTrajectoryLine(mdPath: string): string;
74
74
  /**
75
75
  * 把**工作台纪律块**挂到 agent 的系统提示词段(单一注入点)。
76
76
  *
77
- * 用户原话(S142,2026-09-08):"微信桥的注入机制,每个用户消息都会注入,skiff 本身也会注入,
78
- * 这样就重复,能否微信桥情况下,注入内容直接取 skiff 的,这样不用配两遍"。
77
+ * 用户原话(S142,2026-09-08):"微信桥的注入机制,每个用户消息都会注入,轨迹约束本身也会注入,
78
+ * 这样就重复,能否微信桥情况下,注入内容直接取 轨迹约束的,这样不用配两遍"。
79
79
  *
80
- * 现形态:工作台行**只**经本函数挂系统提示词段(name `serenity-skiff-workspace`,
80
+ * 现形态:工作台行**只**经本函数挂系统提示词段(name `serenity-轨迹约束-workspace`,
81
81
  * 动态 `text()` 每轮按 scope 读当前活跃 mdPath)。
82
82
  *
83
83
  * @returns true = 段已在位;false = 该 agent 挂不上(调用方降级为 question 前缀注入)
84
84
  */
85
85
  export declare function ensureWorkspacePromptSection(agent: Agent, scope: string, root: string): boolean;
86
- interface SkiffAgentRef {
86
+ interface TrajectoryAgentRef {
87
87
  handle: AgentHandle;
88
88
  agent: Agent;
89
89
  sessionId: string;
@@ -91,17 +91,17 @@ interface SkiffAgentRef {
91
91
  resumed: boolean;
92
92
  }
93
93
  /**
94
- * 创建(或复用)一个 skiff 会话。
94
+ * 创建(或复用)一个 轨迹约束会话。
95
95
  *
96
96
  * **固定 sessionId 的 resume-or-create**(v1.27.2):指定 sessionId 且磁盘已有持久化 log →
97
97
  * `ctx.agents.resume`(DSH 持久化语义:sessionId 即身份,历史 + turn 续号延续);
98
98
  * 无 log(首次)→ `ctx.agents.create`。不指定 → 随机 id 恒 create(调试页路径)。
99
99
  *
100
- * @param profile 该 skiff 的约束面(来自 `skiff.json`)
100
+ * @param profile 该 轨迹约束的约束面(来自 `trajectory-constraint.json`)
101
101
  * @param sessionId 指定会话 id(可选;微信桥等外部面用固定 id 实现"轨迹 ↔ 会话"长期映射)
102
102
  */
103
- export declare function createSkiffAgent(ctx: Context, root: string, profile: SkiffProfile, defaultModel?: string, sessionId?: string): Promise<SkiffAgentRef>;
104
- interface SkiffAskResult {
103
+ export declare function createTrajectoryAgent(ctx: Context, root: string, profile: TrajectoryConstraint, defaultModel?: string, sessionId?: string): Promise<TrajectoryAgentRef>;
104
+ interface TrajectoryAskResult {
105
105
  answer: string;
106
106
  sessionId: string;
107
107
  }
@@ -130,35 +130,35 @@ export declare function waitForTurnAssistant(ctx: unknown, agent: Agent, beforeA
130
130
  *
131
131
  * @param options.timeoutMs 本轮等待上限(测试注入;生产用缺省)
132
132
  */
133
- export declare function askSkiff(ctx: Context, agent: Agent, question: string, options?: {
133
+ export declare function askTrajectory(ctx: Context, agent: Agent, question: string, options?: {
134
134
  timeoutMs?: number;
135
- }): Promise<SkiffAskResult>;
135
+ }): Promise<TrajectoryAskResult>;
136
136
  /**
137
- * skiff 会话的轨迹纪律参与判定:**不是 skiff 恒 true**(正常参与);
138
- * skiff 按 `skiff.json` 的 `cognitiveTrajectory` 子集决定。
137
+ * 轨迹约束会话的轨迹纪律参与判定:**不是 轨迹约束恒 true**(正常参与);
138
+ * 轨迹约束 按 `trajectory-constraint.json` 的 `cognitiveTrajectory` 子集决定。
139
139
  *
140
- * 注册表缺失(进程刚重启、绑定还没读)⇒ 由 `skiffProfileForSession` 回落持久绑定;
141
- * 两者都不中 ⇒ 判"不是 skiff" ⇒ 恒 true(正常参与)。**fail-open 是有意的**:
140
+ * 注册表缺失(进程刚重启、绑定还没读)⇒ 由 `trajectoryConstraintForSession` 回落持久绑定;
141
+ * 两者都不中 ⇒ 判"不是 轨迹约束" ⇒ 恒 true(正常参与)。**fail-open 是有意的**:
142
142
  * 纪律参与项的失败不该让会话失去 keeper/rebuild(那是能力倒退,比多跑一次更糟)。
143
143
  */
144
- export declare function skiffCognitiveTrajectoryEnabled(root: string, sessionId: string | undefined, key: 'session' | 'keeper' | 'rebuild'): boolean;
145
- interface SkiffMsmGate {
144
+ export declare function trajectoryConstraintParticipates(root: string, sessionId: string | undefined, key: 'session' | 'keeper' | 'rebuild'): boolean;
145
+ interface TrajectoryConstraintMsmGate {
146
146
  /** 拒绝原因(有则拒绝执行) */
147
147
  reject?: string;
148
148
  /** list 显示白名单(msms);仅 action==='list' 时有值 */
149
149
  whitelist?: Set<string>;
150
150
  }
151
151
  /**
152
- * `msm` 工具的 skiff 门控:非 skiff 恒放行;skiff 会话——
152
+ * `msm` 工具的 轨迹约束门控:非 轨迹约束恒放行;轨迹约束会话——
153
153
  * exec 非白名单 MSM 拒绝(**不列名单**)、register/deregister 必拒、
154
154
  * list 白名单过滤、check/guide/ccc-config 只读放行。
155
155
  */
156
- export declare function skiffMsmGate(root: string, sessionId: string | undefined, action: string, name?: string): SkiffMsmGate;
157
- /** 该 skiff 会话的工具白名单(guards 的 schema 收窄用) */
158
- export declare function skiffToolWhitelist(root: string, sessionId: string | undefined): Set<string> | null;
159
- /** 按编码解析 skiff(路由/调试页/审计用) */
160
- export declare function skiffProfileByCode(root: string, code: string): SkiffProfile | null;
156
+ export declare function trajectoryConstraintMsmGate(root: string, sessionId: string | undefined, action: string, name?: string): TrajectoryConstraintMsmGate;
157
+ /** 该轨迹约束会话的工具白名单(guards 的 schema 收窄用) */
158
+ export declare function trajectoryConstraintToolWhitelist(root: string, sessionId: string | undefined): Set<string> | null;
159
+ /** 按编码解析 轨迹约束(路由/调试页/审计用) */
160
+ export declare function trajectoryConstraintByCode(root: string, code: string): TrajectoryConstraint | null;
161
161
  /** 编码 → 轨迹目录名(路由用;只做精确匹配) */
162
- export declare function skiffDirNameByCode(root: string, code: string): string | null;
162
+ export declare function trajectoryConstraintDirNameByCode(root: string, code: string): string | null;
163
163
  /** 一次性解析提示词全文(admin/validate 用;热路径不要用) */
164
- export declare function skiffSystemPrompt(root: string, profile: SkiffProfile | null | undefined): string;
164
+ export declare function trajectoryConstraintSystemPrompt(root: string, profile: TrajectoryConstraint | null | undefined): string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.73.0",
4
- "description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:14 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/cheap-worker/localstore/container_admin;另三个 im-bridge/acc-diag/diagram 按配置条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/微信桥/认知轨迹唤醒注册表。skiff = 目录下有 skiff.json 的认知轨迹(约束面住在轨迹里);轨迹提示词 = 轨迹目录下的 PROMPT.md(一条轨迹「是谁、按什么章程工作」,所有轨迹通用,追加在容器层与质量层之后,不替换它们)。适配 DSH 0.1.7-rc.1 / 0.2.0-rc.1 / 0.2.1-rc.1(三档)。",
3
+ "version": "1.75.0",
4
+ "description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:14 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/cheap-worker/localstore/container_admin;另三个 im-bridge/acc-diag/diagram 按配置条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表。轨迹声明 = 轨迹目录下的 trajectory.json(约束面 + 旧标识 uid + CRO 机器绑定 cro.host;旧名 trajectory-constraint.json / skiff.json 仍在读取族里);轨迹提示词 = 轨迹目录下的 PROMPT.md(一条轨迹「是谁、按什么章程工作」,所有轨迹通用,追加在容器层与质量层之后,不替换它们)。适配 DSH 0.1.7-rc.1 / 0.2.0-rc.1 / 0.2.1-rc.1(三档)。",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,30 +0,0 @@
1
- /**
2
- * skiff-admin.ts — Skiff 约束面逻辑层(公开入口 = `container_admin` 的 `role` 域)
3
- *
4
- * 三动作分工(用户拍板 2026-08-28,2026-10-19 重做后语义不变):guide 定义教程 /
5
- * validate 校验 / list 摘要 / apply 显式应用确认。
6
- *
7
- * ## 🔴 2026-10-19 重做后,本文件的**数据源变了**
8
- *
9
- * 旧:读 `.opencode/serenity.json` 的 `skiff.roles`(容器级配置表)。
10
- * 新:读**轨迹目录里的 `skiff.json`**(owner:「目录下拥有 `skiff.json` 的认知轨迹自动是一个 skiff」)。
11
- * ⇒ `roleCount` 的语义 = **本 CCC 有几条 skiff 轨迹**;"角色名"这个概念没有了,只有**轨迹编码**。
12
- *
13
- * 归属(D23)不变:ACC 提供机制(教程 + 校验 + 列表),**约束内容归 CCC**(写进 `skiff.json`)。
14
- */
15
- import type { JsonValue } from '../kernel/json.js';
16
- /** Skiff 定义教程:概念 / `skiff.json` schema / 双白名单 / 轨迹纪律 / 微信路由 */
17
- export declare const SKIFF_GUIDE = "\u2550\u2550\u2550 Skiff Guide (2026-10-19 redesigned) \u2550\u2550\u2550\n\n**A skiff IS a cognitive trajectory \u2014 the one whose directory contains `skiff.json`.**\nThat is the whole rule. No role table, no name registry: put the file there and the trajectory\nbecomes a skiff; delete it and it goes back to being an ordinary trajectory (takes effect at once).\n\n AGENT_SESSIONS/<YYYY-MM-DD--<code>--<desc>>/\n \u251C\u2500 SESSION.md \u2190 its persistent body (this IS the workspace \u2014 nothing is auto-created)\n \u251C\u2500 skiff.json \u2190 its constraints (this file is what makes it a skiff)\n \u2514\u2500 TRAJECTORY-UID \u2190 legacy, read-only (superseded by the code)\n\n\u2500\u2500 skiff.json schema \u2500\u2500\n {\n \"model\": \"provider/model\", // optional; falls back to cheap-worker.defaultModel\n \"tools\": [\"read\",\"grep\",\"msm\",...], // non-MSM toolbar whitelist \u2014 anything not listed is REMOVED from the schema\n \"msms\": [\"msm-a\",\"msm-b\"], // MSM whitelist \u2014 msm exec may only run these; register/deregister always refused\n \"cognitiveTrajectory\": { \"session\": true, \"keeper\": true, \"rebuild\": true }, // defaults TRUE (see below)\n \"systemPromptFile\": \".opencode/skiff/<role>.md\", // recommended: relative to CCC root, hot-reloads on save\n \"systemPrompt\": \"...\" // inline fallback; systemPromptFile wins when both are set\n }\n\n\u2500\u2500 Two whitelists, both default-deny \u2500\u2500\n - `tools: []` + non-empty `msms` = pure-MSM skiff (the usual knowledge-QA shape)\n - non-empty `msms` \u21D2 the `msm` tool is added automatically (the only entry point for MSMs)\n - anything outside both lists is invisible in the schema, not merely rejected at call time\n\n\u2500\u2500 cognitiveTrajectory: why the defaults are TRUE \u2500\u2500\n The workspace of a skiff is its own SESSION.md. Setting these to false would cut it off from\n its own body, so `session`/`keeper`/`rebuild` all default to true. Set false explicitly only\n when you deliberately want that participation off.\n\n\u2500\u2500 WeChat routing: user \u2192 trajectory code \u2500\u2500\n `weixin.routes`: `[{ \"user\": \"<wx id or *>\", \"trajectory\": \"<code>\" }]`\n A route pointing at a code with no such trajectory is a hard error (the message is NOT delivered).\n A trajectory WITHOUT `skiff.json` is still a legal target \u2014 it is just an ordinary trajectory.\n\n\u2500\u2500 Operating it \u2500\u2500\n Debug page: Settings \u2192 Serenity \u2192 enable the Skiff block \u2192 http://127.0.0.1:<debugPort>\n Everything is read live: saving `skiff.json` takes effect on the next turn, no restart.\n (The prompt FILE hot-reloads by mtime; the JSON itself is re-read every turn.)\n After editing, run container_admin role apply for an explicit validation + confirmation pass.\n Skill loading is always available to skiff sessions (skills are not whitelisted \u2014 they are read-only knowledge).";
18
- /** 校验当前 CCC 的 skiff 约束面:msms 均已注册 / model ∈ cheap-worker.models / 提示词非空 */
19
- export declare function validateSkiffConfig(root: string): JsonValue;
20
- /** 列出当前 CCC 的 skiff 轨迹(编码 / 模型 / msms / tools / 纪律摘要 / 提示词来源) */
21
- export declare function listSkiffRoles(root: string): JsonValue;
22
- /**
23
- * 应用当前 skiff 配置(S142 用户:改了 json 应该有个生效机制)。
24
- *
25
- * 语义:约束面是**每轮实时读取**的 ⇒ apply 不是"推送",而是**显式校验 + 应用确认**:
26
- * ① 校验合法(复用 validate:msms 注册 / model 白名单 / 提示词非空)
27
- * ② 非法 → 报告问题清单,不应用(提示修复后重跑 apply)
28
- * ③ 合法 → 应用确认:绑定 CCC + 轨迹清单 + 说明(下一轮即生效)
29
- */
30
- export declare function applySkiffConfig(root: string): JsonValue;