@shgroup/dsh-serenity-hooks 1.57.0 → 1.57.1

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.
@@ -1,43 +0,0 @@
1
- import { dirname, join } from "node:path";
2
- import { readFileSync } from "node:fs";
3
- import { fileURLToPath } from "node:url";
4
- //#region src/constants.ts
5
- /** 常量(纯模块,零 DSH 依赖) */
6
- /**
7
- * ACC 版本:自动从 package.json 读取(单一真相源,消除与 CHANGELOG 的漂移)。
8
- * 发布时只需改 package.json 的 version。
9
- */
10
- const ACC_VERSION = (() => {
11
- try {
12
- const here = dirname(fileURLToPath(import.meta.url));
13
- return JSON.parse(readFileSync(join(here, "..", "package.json"), "utf-8")).version ?? "0.0.0";
14
- } catch {
15
- return "0.0.0";
16
- }
17
- })();
18
- //#endregion
19
- //#region src/skiff-registry.ts
20
- const skiffSessions = /* @__PURE__ */ new Map();
21
- /** 查 sessionId 的 Skiff 角色名(无 → null)——向后兼容(guards/seams 依赖) */
22
- function skiffRoleFor(sessionId) {
23
- return skiffSessions.get(sessionId)?.role ?? null;
24
- }
25
- /** 查 sessionId 的完整绑定(role + ccc;无 → null)——v1.25.10 会话追问校验 */
26
- function skiffSessionInfo(sessionId) {
27
- return skiffSessions.get(sessionId) ?? null;
28
- }
29
- function registerSkiffSession(sessionId, role, ccc) {
30
- skiffSessions.set(sessionId, {
31
- role,
32
- ccc
33
- });
34
- }
35
- function unregisterSkiffSession(sessionId) {
36
- skiffSessions.delete(sessionId);
37
- }
38
- /** 测试/调试:注册表快照(sessionId → {role, ccc}) */
39
- function skiffSessionSnapshot() {
40
- return new Map(skiffSessions);
41
- }
42
- //#endregion
43
- export { unregisterSkiffSession as a, skiffSessionSnapshot as i, skiffRoleFor as n, ACC_VERSION as o, skiffSessionInfo as r, registerSkiffSession as t };