@shgroup/dsh-serenity-hooks 1.26.8 → 1.26.9

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.26.8",
3
+ "version": "1.26.9",
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
@@ -11479,6 +11479,7 @@ x.lex;
11479
11479
  */
11480
11480
  var skiff_debug_exports = /* @__PURE__ */ __exportAll({
11481
11481
  discoverCccs: () => discoverCccs,
11482
+ jscSafeJsonText: () => jscSafeJsonText,
11482
11483
  renderSkiffMarkdown: () => renderSkiffMarkdown,
11483
11484
  skiffDebugPage: () => skiffDebugPage,
11484
11485
  startSkiffDebugServer: () => startSkiffDebugServer,
@@ -11546,7 +11547,7 @@ async function discoverCccs(ctx, defaultRoot) {
11546
11547
  }
11547
11548
  /** 问答页 HTML:CCC 切换器 + 角色下拉 + 输入 + 答案区 + 轨迹区(JS 渲染)+ WebUI 链接 */
11548
11549
  function skiffDebugPage(cccs, defaultRoot, webPort) {
11549
- const data = JSON.stringify(cccs).replace(/</g, "\\u003c");
11550
+ const data = jscSafeJsonText(JSON.stringify(cccs).replace(/</g, "\\u003c"));
11550
11551
  return `<!DOCTYPE html>
11551
11552
  <html lang="zh">
11552
11553
  <head>
@@ -11724,6 +11725,25 @@ function escapeHtml(s) {
11724
11725
  })[c] ?? c);
11725
11726
  }
11726
11727
  /**
11728
+ * JSC (Safari/iOS) JSON.parse 快速路径正则兼容化(v1.26.9,S142 调研定稿)。
11729
+ *
11730
+ * 背景:WebKit bug 200190「JavaScriptCore's Regex can't match the content」——JSC 的
11731
+ * JSON.parse 用**内部正则**预校验字符串;内容含**原始** `\u2028`(行分隔符)/`\u2029`
11732
+ * (段分隔符)时正则无法匹配 → 对**合法 JSON** 也抛
11733
+ * `SyntaxError: The string did not match the expected pattern`(sentry-javascript #2487 同源)。
11734
+ * JSON.stringify **不转义** `\u2028`/`\u2029`/`\uFEFF`(它们都是合法 JSON 字符串字符)→
11735
+ * 在 JSON **文本层**把它们替换为 `\uXXXX` 转义序列:JSON.parse 后语义完全一致(还原原字符),
11736
+ * 且 JSC 正则看到的是常规 ASCII 转义(与 JSON.stringify 对控制字符的输出同形态,安全)。
11737
+ *
11738
+ * 3100 问答页客户端 `await res.json()`(acp-http.ts)与页面内嵌 JSON(skiff-debug/acp-http)
11739
+ * 均需此兼容层——iOS Safari 用户实测"复杂回答"触发。
11740
+ *
11741
+ * @param jsonText JSON.stringify 的输出文本;原地等价替换,返回 JSC 安全文本
11742
+ */
11743
+ function jscSafeJsonText(jsonText) {
11744
+ return jsonText.replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/\uFEFF/g, "\\uFEFF");
11745
+ }
11746
+ /**
11727
11747
  * 提取 `<think>…</think>` 块(v1.26.8:**状态机扫描,弃正则**——用户批评"老用正则不是个办法")。
11728
11748
  *
11729
11749
  * 逐字符扫描识别开/闭标签(大小写不敏感;`<think ...>` 允许属性变体;`</think >` 允许尾随空格),
@@ -12131,7 +12151,7 @@ function readBody(req) {
12131
12151
  });
12132
12152
  }
12133
12153
  function sendJson(res, status, payload) {
12134
- const body = JSON.stringify(payload);
12154
+ const body = jscSafeJsonText(JSON.stringify(payload));
12135
12155
  res.writeHead(status, {
12136
12156
  "Content-Type": "application/json; charset=utf-8",
12137
12157
  "Cache-Control": "no-store"
@@ -12530,11 +12550,11 @@ gateKey.focus()
12530
12550
  }
12531
12551
  /** 单容器问答页(v1.26.2→v1.26.6):URL 锁定容器;聊天 UI——消息流 + 连续对话 + key 从列表页记忆(v1.26.6 用户拍板:对话页不再填 key) */
12532
12552
  function publicAskContainerPage(ccc) {
12533
- const data = JSON.stringify({
12553
+ const data = jscSafeJsonText(JSON.stringify({
12534
12554
  name: ccc.name,
12535
12555
  root: ccc.root,
12536
12556
  roles: ccc.roles
12537
- }).replace(/</g, "\\u003c");
12557
+ }).replace(/</g, "\\u003c"));
12538
12558
  return `<!DOCTYPE html>
12539
12559
  <html lang="zh">
12540
12560
  <head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.26.8",
3
+ "version": "1.26.9",
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": {