@shgroup/dsh-serenity-hooks 1.28.0 → 1.28.2

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.
@@ -396,9 +396,20 @@ function waitIdle(ctx, agent) {
396
396
  });
397
397
  });
398
398
  }
399
+ /**
400
+ * 会话事件读取(v1.28.0 适配 0.1.2-rc.1):rc.1 Session 移除 `.events` 属性 → `snapshotEvents()` 方法。
401
+ * 兼容双形态(运行时 rc.1 snapshotEvents;测试替身 events)——同一函数两处语义,测试注入零侵入。
402
+ * 注:与 session-ops.ts 导出的共享 `sessionEvents` 同构(v1.28.1 收敛基准)。本模块保留本地副本
403
+ * 以维持独立 import 面(零 DSH 依赖测试替身形态一致);若未来重构可统一 import 共享版。
404
+ */
405
+ function sessionEvents(session) {
406
+ const s = session;
407
+ if (typeof s.snapshotEvents === "function") return s.snapshotEvents();
408
+ return s.events ?? [];
409
+ }
399
410
  /** 读会话最后一个 assistant/message 文本(handyman 同款) */
400
411
  function lastAssistantText(agent) {
401
- const events = agent.session.events;
412
+ const events = sessionEvents(agent.session);
402
413
  for (let i = events.length - 1; i >= 0; i--) {
403
414
  const e = events[i];
404
415
  if (e && e.type === "assistant/message") {
@@ -462,7 +473,7 @@ function truncate(s, n) {
462
473
  * 公开问答页 / ACP JSON-RPC 不返回 trajectory,传 false 跳过计算;3099 调试页默认 true 保留)
463
474
  */
464
475
  async function askSkiff(ctx, agent, question, eventsStart, options) {
465
- const before = eventsStart === void 0 ? agent.session.events.length : eventsStart;
476
+ const before = eventsStart === void 0 ? sessionEvents(agent.session).length : eventsStart;
466
477
  agent.followup(createUserMessage({
467
478
  content: [{
468
479
  type: "text",
@@ -472,7 +483,7 @@ async function askSkiff(ctx, agent, question, eventsStart, options) {
472
483
  }));
473
484
  await waitIdle(ctx, agent);
474
485
  const answer = lastAssistantText(agent);
475
- const trajectory = options?.includeTrajectory === false ? [] : eventsToTrajectory(agent.session.events.slice(before));
486
+ const trajectory = options?.includeTrajectory === false ? [] : eventsToTrajectory(sessionEvents(agent.session).slice(before));
476
487
  return {
477
488
  answer,
478
489
  sessionId: String(agent.session.id ?? ""),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgroup/dsh-serenity-hooks",
3
- "version": "1.28.0",
3
+ "version": "1.28.2",
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": {
@@ -46,27 +46,28 @@
46
46
  },
47
47
  "client": {
48
48
  "inject": [
49
- "@deepseek-ai/dsh-client-runtime"
49
+ "@deepseek-ai/dsh-client-ui-settings"
50
50
  ],
51
51
  "platform": "web"
52
52
  }
53
53
  },
54
54
  "peerDependencies": {
55
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.5",
56
- "@deepseek-ai/dsh-agent-loop": "^0.1.0-rc.5",
57
- "@deepseek-ai/dsh-agent-presets": "^0.1.0-rc.5",
58
- "@deepseek-ai/dsh-compaction": "^0.1.0-rc.5",
59
- "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.5",
60
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.5",
61
- "@deepseek-ai/dsh-session": "^0.1.0-rc.5",
62
- "@deepseek-ai/dsh-session-title": "^0.1.0-rc.5",
63
- "@deepseek-ai/dsh-shell": "^0.1.0-rc.5",
64
- "@deepseek-ai/dsh-shell-env": "^0.1.0-rc.5",
65
- "@deepseek-ai/dsh-skill": "^0.1.0-rc.5",
66
- "@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.5",
67
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.5",
55
+ "@deepseek-ai/dsh-agent": "^0.1.2-rc.1",
56
+ "@deepseek-ai/dsh-agent-loop": "^0.1.2-rc.1",
57
+ "@deepseek-ai/dsh-agent-presets": "^0.1.2-rc.1",
58
+ "@deepseek-ai/dsh-compaction": "^0.1.2-rc.1",
59
+ "@deepseek-ai/dsh-host-webserver": "^0.1.2-rc.1",
60
+ "@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
61
+ "@deepseek-ai/dsh-session": "^0.1.2-rc.1",
62
+ "@deepseek-ai/dsh-session-title": "^0.1.2-rc.1",
63
+ "@deepseek-ai/dsh-shell": "^0.1.2-rc.1",
64
+ "@deepseek-ai/dsh-shell-env": "^0.1.2-rc.1",
65
+ "@deepseek-ai/dsh-skill": "^0.1.2-rc.1",
66
+ "@deepseek-ai/dsh-system-prompt": "^0.1.2-rc.1",
67
+ "@deepseek-ai/dsh-tools": "^0.1.2-rc.1",
68
68
  "@deepseek-ai/schemastery": "^3.18.1",
69
- "cordis": "^4.0.0-rc.7"
69
+ "cordis": "^4.0.0-rc.7",
70
+ "@deepseek-ai/cordis": "^4.0.0-rc.7"
70
71
  },
71
72
  "peerDependenciesMeta": {
72
73
  "@deepseek-ai/dsh-host-webserver": {
@@ -92,6 +93,7 @@
92
93
  "@types/node": "^20.0.0",
93
94
  "@types/qrcode-generator": "^1.0.6",
94
95
  "@types/react": "^18.2.0",
96
+ "@vitest/coverage-v8": "^1.6.1",
95
97
  "marked": "^18.0.11",
96
98
  "qrcode-generator": "^2.0.4",
97
99
  "react": "^18.2.0",