@shgroup/dsh-serenity-hooks 1.25.10 → 1.25.11

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.25.10",
3
+ "version": "1.25.11",
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": {
package/lib/index.js CHANGED
@@ -5984,6 +5984,43 @@ function renameDshSessionOnUse(deps, session, titles, active) {
5984
5984
  };
5985
5985
  }
5986
5986
  }
5987
+ /**
5988
+ * 从 create 结果构造命名用 ActiveSessionInfo(v1.25.11,S142 用户:create 也要命名):
5989
+ * createSession 返回的 result 已含 sessionId(S###/issue)与 dirName——无需等待 use 激活,
5990
+ * 直接构造(mdPath = sessionPath/SESSION.md,与 use 时一致)即可驱动 renameDshSessionOnUse。
5991
+ */
5992
+ function activeInfoFromCreate(result) {
5993
+ return {
5994
+ sessionId: result.sessionId,
5995
+ dirName: result.dirName,
5996
+ mdPath: join(result.sessionPath, "SESSION.md")
5997
+ };
5998
+ }
5999
+ /**
6000
+ * 把当前 dsh 会话重命名为指定 SESSION 的命名标题(use/create 共用;v1.25.11)。
6001
+ * 门控/失败可见性与 renameDshSessionOnUse 一致(不静默:成功 log / 失败 warn)。
6002
+ * 调用点(use 分支原内联逻辑提取,create 分支复用):
6003
+ * - use:激活后从 activeStore 取 info
6004
+ * - create:createSession 结果经 activeInfoFromCreate 构造 info
6005
+ */
6006
+ function renameDshSessionForActive(ctx, exec, info) {
6007
+ try {
6008
+ const titles = ctx.get?.("sessionTitle");
6009
+ const dshSession = exec.agent?.session;
6010
+ if (!dshSession) {
6011
+ console.warn(`[serenity-hooks] dsh 会话重命名未执行: 缺少 agent session(info: ${info.sessionId})`);
6012
+ return;
6013
+ }
6014
+ const result = renameDshSessionOnUse({
6015
+ namingEnabled: readSimpleSettings().namingEnabled,
6016
+ sessionTitleAvailable: true
6017
+ }, dshSession, titles, info);
6018
+ if (result.ok) console.log(`[serenity-hooks] dsh 会话已重命名: ${String(dshSession.id ?? "?")} → ${result.title}`);
6019
+ else console.warn(`[serenity-hooks] dsh 会话重命名未执行: ${result.reason}`);
6020
+ } catch (err) {
6021
+ console.warn(`[serenity-hooks] dsh 会话重命名异常: ${String(err?.message ?? err)}`);
6022
+ }
6023
+ }
5987
6024
  function renderText$3(value) {
5988
6025
  return [{
5989
6026
  type: "text",
@@ -6142,6 +6179,7 @@ function createSessionTool(ctx) {
6142
6179
  dryRun: args.dryRun ?? false
6143
6180
  });
6144
6181
  let message = result.message;
6182
+ if (!(args.dryRun ?? false)) renameDshSessionForActive(ctx, exec, activeInfoFromCreate(result));
6145
6183
  if (!(args.dryRun ?? false) && cccHooks.includes("create-transform")) try {
6146
6184
  const hookResult = await runMsmAsync(root, {
6147
6185
  action: "exec",
@@ -6159,23 +6197,8 @@ function createSessionTool(ctx) {
6159
6197
  if (!args.name) throw new Error("use requires name (S### or directory name)");
6160
6198
  const scope = agentScope$2(exec);
6161
6199
  const active = useSession(root, args.name, scope);
6162
- try {
6163
- const info = getActiveSessionInfo(scope);
6164
- if (info) {
6165
- const titles = ctx.get?.("sessionTitle");
6166
- const dshSession = exec.agent?.session;
6167
- if (dshSession) {
6168
- const result = renameDshSessionOnUse({
6169
- namingEnabled: readSimpleSettings().namingEnabled,
6170
- sessionTitleAvailable: true
6171
- }, dshSession, titles, info);
6172
- if (result.ok) console.log(`[serenity-hooks] dsh 会话已重命名: ${String(dshSession.id ?? "?")} → ${result.title}`);
6173
- else console.warn(`[serenity-hooks] dsh 会话重命名未执行: ${result.reason}`);
6174
- } else console.warn(`[serenity-hooks] dsh 会话重命名未执行: 缺少 agent session`);
6175
- }
6176
- } catch (err) {
6177
- console.warn(`[serenity-hooks] dsh 会话重命名异常: ${String(err?.message ?? err)}`);
6178
- }
6200
+ const info = getActiveSessionInfo(scope);
6201
+ if (info) renameDshSessionForActive(ctx, exec, info);
6179
6202
  return active;
6180
6203
  }
6181
6204
  case "close":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.25.10",
3
+ "version": "1.25.11",
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": {