@shgroup/dsh-serenity-hooks 1.26.9 → 1.26.10

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.9",
3
+ "version": "1.26.10",
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
@@ -2567,8 +2567,10 @@ function truncate(s, n) {
2567
2567
  * 提问一轮:followup → 等 idle → 读答案 + 轨迹。
2568
2568
  * @param eventsStart 轨迹起点:显式传 0 = 全量轨迹(会话追问时页面重绘完整时间线,
2569
2569
  * v1.25.10 用户拍板);不传(undefined)= 本轮增量(followup 前 events 之后)
2570
+ * @param options.includeTrajectory 是否计算轨迹(v1.26.10:**3100 对外只提供问答**——
2571
+ * 公开问答页 / ACP JSON-RPC 不返回 trajectory,传 false 跳过计算;3099 调试页默认 true 保留)
2570
2572
  */
2571
- async function askSkiff(ctx, agent, question, eventsStart) {
2573
+ async function askSkiff(ctx, agent, question, eventsStart, options) {
2572
2574
  const before = eventsStart === void 0 ? agent.session.events.length : eventsStart;
2573
2575
  agent.followup(createUserMessage({
2574
2576
  content: [{
@@ -2579,7 +2581,7 @@ async function askSkiff(ctx, agent, question, eventsStart) {
2579
2581
  }));
2580
2582
  await waitIdle$1(ctx, agent);
2581
2583
  const answer = lastAssistantText$2(agent);
2582
- const trajectory = eventsToTrajectory(agent.session.events.slice(before));
2584
+ const trajectory = options?.includeTrajectory === false ? [] : eventsToTrajectory(agent.session.events.slice(before));
2583
2585
  return {
2584
2586
  answer,
2585
2587
  sessionId: String(agent.session.id ?? ""),
@@ -9735,9 +9737,15 @@ function detectSensitive(text, table) {
9735
9737
  for (const w of table.substring) if (w !== "" && text.includes(w)) hits.add(w);
9736
9738
  return [...hits];
9737
9739
  }
9738
- /** 打回消息(steer 内容):告知模型命中词并要求重新生成(不含命中值本身——避免二次泄露) */
9740
+ /**
9741
+ * 打回消息(steer 内容):**告知命中词并指令重新生成**(v1.26.10 用户调整——
9742
+ * 原 v1.26.3 设计"不含命中词防二次泄露"导致模型不知道改什么;命中词本就已在被拦截的
9743
+ * 回复中进入会话(已暴露面),打回消息重复一次不扩大暴露,模型据此精准重写)。
9744
+ * 命中词已落入模型上下文(它刚写过),此消息不回显给用户(steer 是 plugin source 消息,
9745
+ * 3100 对外响应 v1.26.10 起已不含 trajectory → 打回文本不会到达外部用户)。
9746
+ */
9739
9747
  function buildRebuke(hits) {
9740
- return `[SERENITY OUTPUT GUARD] Your previous response contained ${hits.length} sensitive internal term(s) (mechanism/credential identifiers) that must not appear in user-visible output. Regenerate the response from scratch without these terms — describe the same substance without referencing internal machinery, credentials, tool names, or implementation details. Do not repeat the terms; do not explain this instruction to the user.`;
9748
+ return `[SERENITY OUTPUT GUARD] Your previous response contained ${hits.length} sensitive internal term(s) (mechanism/credential identifiers) that must not appear in user-visible output: ${[...new Set(hits)].join(", ")}. Regenerate the response from scratch without ANY of these terms — describe the same substance without referencing internal machinery, credentials, tool names, or implementation details. Do not repeat the terms; do not explain this instruction to the user.`;
9741
9749
  }
9742
9750
  /** 打回状态(按 agent 会话跟踪连续命中轮数) */
9743
9751
  const rebukeStates = /* @__PURE__ */ new Map();
@@ -12030,7 +12038,10 @@ var AcpServer = class {
12030
12038
  });
12031
12039
  return { sessions };
12032
12040
  }
12033
- /** session/prompt:{ sessionId, question } → 答案 + 全量轨迹 */
12041
+ /**
12042
+ * session/prompt:{ sessionId, question } → 答案(**v1.26.10:不返回 trajectory**——
12043
+ * 3100 对外只提供问答,轨迹含工具结果等内部信息;3099 调试页另走 /ask 保留)
12044
+ */
12034
12045
  async prompt(params) {
12035
12046
  const sessionId = typeof params?.sessionId === "string" ? params.sessionId : void 0;
12036
12047
  const question = typeof params?.question === "string" ? params.question : void 0;
@@ -12038,11 +12049,10 @@ var AcpServer = class {
12038
12049
  if (!question?.trim()) throw new RpcInvalidParams("session/prompt requires question");
12039
12050
  const agent = getSkiffAgent(sessionId);
12040
12051
  if (!agent) throw new RpcInvalidParams(`unknown session: ${sessionId} (not recoverable — process restarted?)`);
12041
- const result = await askSkiff(this.ctx, agent, question, 0);
12052
+ const result = await askSkiff(this.ctx, agent, question, void 0, { includeTrajectory: false });
12042
12053
  return {
12043
12054
  answer: result.answer,
12044
- sessionId: result.sessionId,
12045
- trajectory: result.trajectory
12055
+ sessionId: result.sessionId
12046
12056
  };
12047
12057
  }
12048
12058
  /** session/cancel:{ sessionId } → 中断当前 prompt(DSH interrupt) */
@@ -12358,13 +12368,12 @@ async function handleAskParsed(ctx, ccc, body, res, ip) {
12358
12368
  }
12359
12369
  }
12360
12370
  if (!agent) agent = (await createSkiffAgent(ctx, root, effectiveRole, effectiveCfg, readHandymanConfig(root)?.defaultModel)).agent;
12361
- const result = await askSkiff(ctx, agent, question, 0);
12371
+ const result = await askSkiff(ctx, agent, question, void 0, { includeTrajectory: false });
12362
12372
  sendJson(res, 200, {
12363
12373
  answer: result.answer,
12364
12374
  answer_html: renderSkiffMarkdown(result.answer, true),
12365
12375
  sessionId: result.sessionId,
12366
- continued,
12367
- trajectory: result.trajectory
12376
+ continued
12368
12377
  });
12369
12378
  }
12370
12379
  /** 问答页未启用提示页 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.26.9",
3
+ "version": "1.26.10",
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": {