@shgroup/dsh-serenity-hooks 1.25.5 → 1.25.7

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.5",
3
+ "version": "1.25.7",
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
@@ -9382,30 +9382,32 @@ function sendHtml(res, html) {
9382
9382
  res.end(html);
9383
9383
  }
9384
9384
  /**
9385
- * 发现候选 CCC 列表(多 CCC 手工切换,v1.25.4+):
9385
+ * 发现候选 CCC 列表(多 CCC 手工切换,v1.25.6):
9386
9386
  * ① **dsh 工作区注册表**(workspaceRegistry.list,持久化——所有工作目录即使无 live 会话;
9387
9387
  * S142 用户 2026-08-29:应直接拉 dsh 工作区,且只列具体 CCC)
9388
- * ② live 会话兜底(无 workspace 服务 / 注册表为空)
9389
- * 默认绑定 root 兜底(不在列表时放首位)
9388
+ * ② **sessionPersistence 兜底**(持久化会话 headers——必装配服务,覆盖所有历史会话工作目录;
9389
+ * 用户实测 workspaceRegistry 拉取仍空时兜底)
9390
+ * ③ live 会话兜底
9391
+ * ④ 默认绑定 root 兜底(不在列表时放首位)
9390
9392
  */
9391
- function discoverCccs(ctx, defaultRoot) {
9393
+ async function discoverCccs(ctx, defaultRoot) {
9392
9394
  const roots = [];
9395
+ const pushRoot = (cwd) => {
9396
+ if (typeof cwd !== "string" || cwd === "") return;
9397
+ const r = findSerenityRoot(cwd);
9398
+ if (r && !roots.includes(r)) roots.push(r);
9399
+ };
9393
9400
  try {
9394
9401
  const registry = ctx.get?.("workspaceRegistry");
9395
- for (const ws of registry?.list?.() ?? []) if (typeof ws.path === "string" && ws.path !== "") {
9396
- const r = findSerenityRoot(ws.path);
9397
- if (r && !roots.includes(r)) roots.push(r);
9398
- }
9402
+ for (const ws of registry?.list?.() ?? []) pushRoot(ws?.path);
9403
+ } catch {}
9404
+ if (roots.length === 0) try {
9405
+ const sp = ctx.get?.("sessionPersistence");
9406
+ for (const h of await sp?.list?.() ?? []) pushRoot(h?.cwd);
9399
9407
  } catch {}
9400
9408
  if (roots.length === 0) try {
9401
9409
  const sessions = ctx.sessions;
9402
- for (const s of sessions?.list?.() ?? []) {
9403
- const cwd = s?.header?.cwd;
9404
- if (typeof cwd === "string") {
9405
- const r = findSerenityRoot(cwd);
9406
- if (r && !roots.includes(r)) roots.push(r);
9407
- }
9408
- }
9410
+ for (const s of sessions?.list?.() ?? []) pushRoot(s?.header?.cwd);
9409
9411
  } catch {}
9410
9412
  if (!roots.includes(defaultRoot)) roots.unshift(defaultRoot);
9411
9413
  return roots.map((root) => ({
@@ -9416,7 +9418,7 @@ function discoverCccs(ctx, defaultRoot) {
9416
9418
  }
9417
9419
  /** 问答页 HTML:CCC 切换器 + 角色下拉 + 输入 + 答案区 + 轨迹区(JS 渲染)+ WebUI 链接 */
9418
9420
  function skiffDebugPage(cccs, defaultRoot, webPort) {
9419
- const data = JSON.stringify(cccs);
9421
+ const data = JSON.stringify(cccs).replace(/</g, "\\u003c");
9420
9422
  return `<!DOCTYPE html>
9421
9423
  <html lang="zh">
9422
9424
  <head>
@@ -9466,7 +9468,7 @@ function skiffDebugPage(cccs, defaultRoot, webPort) {
9466
9468
  <div id="trajectory"></div>
9467
9469
  <p class="muted"><a href="${`http://127.0.0.1:${webPort}`}" target="_blank" rel="noopener">在 dsh WebUI 查看完整会话</a>(会话列表搜索 sessionId;WebUI 有完整交互)</p>
9468
9470
  </main>
9469
- <script id="skiff-data" type="application/json" data-default="${escapeHtml(defaultRoot)}">${escapeHtml(data)}<\/script>
9471
+ <script id="skiff-data" type="application/json" data-default="${escapeHtml(defaultRoot)}">${data}<\/script>
9470
9472
  <script>
9471
9473
  const CCCS = JSON.parse(document.getElementById('skiff-data').textContent)
9472
9474
  const defaultRoot = document.getElementById('skiff-data').dataset.default
@@ -9578,7 +9580,7 @@ async function handle(ctx, defaultRoot, webPort, req, res) {
9578
9580
  try {
9579
9581
  const url = (req.url ?? "/").split("?")[0] ?? "/";
9580
9582
  if (req.method === "GET" && url === "/") {
9581
- sendHtml(res, skiffDebugPage(discoverCccs(ctx, defaultRoot), defaultRoot, webPort));
9583
+ sendHtml(res, skiffDebugPage(await discoverCccs(ctx, defaultRoot), defaultRoot, webPort));
9582
9584
  return;
9583
9585
  }
9584
9586
  if (req.method === "POST" && url === "/ask") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.25.5",
3
+ "version": "1.25.7",
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": {