@deepseek-ai/dsh-session-telemetry 0.1.7-rc.2 → 0.2.0-rc.1

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/README.i18n.yaml CHANGED
@@ -24,8 +24,8 @@
24
24
  en: e3cc8ee7774a0ad5
25
25
  zh: 3c039339870b8cf9
26
26
  /deepseek-ai-dsh-session-telemetry/use-this-package/what-gets-captured:
27
- en: ed96f8ed3cf72fe8
28
- zh: b7f2b546b8639f43
27
+ en: 5b7fbbe1c55997e8
28
+ zh: d62d9118fd8df2f4
29
29
  /deepseek-ai-dsh-session-telemetry/use-this-package/the-sharing-disclosure:
30
30
  en: 5c325a8aaadf17c7
31
31
  zh: 5c493d2333f82b28
@@ -36,8 +36,8 @@
36
36
  en: cad1e9d195916553
37
37
  zh: 2192f3ce5e2196bd
38
38
  /deepseek-ai-dsh-session-telemetry/understand-the-implementation/design-concept:
39
- en: 3bac6e75e9e442eb
40
- zh: 88062e9d93a782eb
39
+ en: 56c449be11e6bac1
40
+ zh: 6b62969e93313c3e
41
41
  /deepseek-ai-dsh-session-telemetry/understand-the-implementation/source-map:
42
42
  en: 5dc345ec3dda38b8
43
43
  zh: 189d673734a2c20e
package/README.md CHANGED
@@ -39,6 +39,8 @@ A backend implements three members: `emit(record)` must be a non-blocking enqueu
39
39
 
40
40
  Capture runs in one of two modes. `live` capture follows session events as they are appended, replays already-live sessions at mount time, and records lifecycle markers; `on-demand` capture reads the canonical session log only when the backend requests a prefix through `captureSession(session, throughSeq?)`. Coordinator options select whether stored history is included. Every canonical session event maps to one ledger record in order. An `assistant/message` or `assistant/attempt` record carries its complete embedded compact stream, including failed and retried output. Each ledger record also carries `session.id`, `session.format_version`, the numeric event identity, optional header facts, and a pre-mapped severity (`error` for `tool/result.isError`, `turn/end` error reasons, and `agent-error`; `info` otherwise).
41
41
 
42
+ Ledger records carry `sourceEvent` with the owning Session id and a copied event envelope excluding `data`. The redaction waterfall receives `body` as the only payload copy. Backends can reconstruct a complete exported event from the envelope and redacted body without bypassing redaction.
43
+
42
44
  ### The sharing disclosure
43
45
 
44
46
  <a id="the-sharing-disclosure"></a>
@@ -63,7 +65,7 @@ This section explains the capture design; the observable behavior is fully cover
63
65
 
64
66
  ### Design concept
65
67
 
66
- The seam is built on one boundary: the harness's aspect ends at `emit()`. Complete event capture, redaction, and the handoff cursor live here; batching, retry, queueing, and loss policy are the reporting SDK's, deliberately not modelled or wrapped. The design and rejected alternatives are pinned in the [revival Agent Note](../../../.agents/notes/implemented/feature/2026-07-23-session-telemetry-otel-revival.md).
68
+ The capture package owns complete event capture, redaction, and handoff cursors. Redaction rules must preserve `sourceEvent` for OTel upload; returning a fresh record without it withholds the event with a diagnostic. Its cloned envelope excludes `data`, which is carried only in `body`. The OTel backend owns byte/count scheduling and uses SDK transport/retries. The [revival Agent Note](../../../.agents/notes/implemented/feature/2026-07-23-session-telemetry-otel-revival.md) owns capture and redaction rationale.
67
69
 
68
70
  ### Source map
69
71
 
package/README.zh.md CHANGED
@@ -39,6 +39,8 @@ kind: "package-library"
39
39
 
40
40
  捕获以两种模式之一运行。`live` 捕获在追加时跟随会话事件、在挂载时回放已存活会话并记录生命周期标记;`on-demand` 捕获只在后端通过 `captureSession(session, throughSeq?)` 请求前缀时读取权威会话日志。协调器选项决定是否包含存储历史。每条权威会话事件都按顺序映射为一条 ledger 记录。`assistant/message` 或 `assistant/attempt` 记录会携带完整的嵌入式紧凑流,包括失败和重试输出。每条 ledger 记录还携带 `session.id`、`session.format_version`、数值型事件标识、可选 header 事实与预先映射的严重级别(`tool/result.isError`、`turn/end` 的错误原因与 `agent-error` 映射为 `error`;其余为 `info`)。
41
41
 
42
+ ledger 记录携带 `sourceEvent`,其中包含所属 Session id 和不含 `data` 的事件信封副本。脱敏 waterfall 接收的 `body` 是唯一的载荷副本。后端可从信封和脱敏后的 body 重建完整导出事件,而不绕过脱敏。
43
+
42
44
  ### 共享披露
43
45
 
44
46
  <a id="the-sharing-disclosure"></a>
@@ -63,7 +65,7 @@ kind: "package-library"
63
65
 
64
66
  ### 设计理念
65
67
 
66
- seam 建立在一个边界之上:harness 的职责止于 `emit()`。完整事件捕获、脱敏与 handoff 游标都在这里;批处理、重试、排队与丢失策略属于上报 SDK,本包有意不建模也不包装。设计与被否决的替代方案见[复活 Agent Note](../../../.agents/notes/implemented/feature/2026-07-23-session-telemetry-otel-revival.zh.md)。
68
+ 捕获包负责完整事件捕获、脱敏和交接游标。脱敏规则必须保留 `sourceEvent` 才能通过 OTel 上传;返回不含它的新记录会阻止该事件上传并产生诊断。复制的 envelope 不含 `data`,数据仅由 `body` 携带。OTel 后端负责字节/条数调度并使用 SDK 传输和重试。[恢复遥测决策记录](../../../.agents/notes/implemented/feature/2026-07-23-session-telemetry-otel-revival.zh.md) 说明捕获和脱敏依据。
67
69
 
68
70
  ### 源码地图
69
71
 
package/lib/index.js CHANGED
@@ -134,13 +134,18 @@ var SessionTelemetryCoordinator = class {
134
134
  }
135
135
  /** Copy, redact, and hand one canonical event to the backend. */
136
136
  captureEvent(session, event) {
137
+ const { data, ...envelope } = event;
137
138
  this.deliver(session, {
138
139
  record: this.redact({
140
+ sourceEvent: {
141
+ sessionId: session.id,
142
+ envelope: structuredClone(envelope)
143
+ },
139
144
  channel: "ledger",
140
145
  time: event.time,
141
146
  severity: severityOf(event),
142
147
  attributes: identityOf(session, event),
143
- body: structuredClone(event.data)
148
+ body: structuredClone(data)
144
149
  }),
145
150
  seq: event.seq
146
151
  });
@@ -253,7 +258,7 @@ function identityOf(session, event) {
253
258
  * forwarding), live versus on-demand canonical-log capture, and the HMR
254
259
  * cursor. Everything downstream of
255
260
  * {@link SessionTelemetryBackend.emit} — batching, retry, queueing, and loss policy — is the
256
- * reporting SDK's territory and is deliberately not modelled here. The
261
+ * backend's responsibility and is deliberately not modelled here. The
257
262
  * design and its trade-offs are pinned in
258
263
  * .agents/notes/implemented/feature/2026-07-23-session-telemetry-otel-revival.md.
259
264
  *
@@ -7,13 +7,14 @@
7
7
  * forwarding), live versus on-demand canonical-log capture, and the HMR
8
8
  * cursor. Everything downstream of
9
9
  * {@link SessionTelemetryBackend.emit} — batching, retry, queueing, and loss policy — is the
10
- * reporting SDK's territory and is deliberately not modelled here. The
10
+ * backend's responsibility and is deliberately not modelled here. The
11
11
  * design and its trade-offs are pinned in
12
12
  * .agents/notes/implemented/feature/2026-07-23-session-telemetry-otel-revival.md.
13
13
  *
14
14
  * @module @deepseek-ai/dsh-session-telemetry
15
15
  */
16
16
  import { Context, Service } from '@deepseek-ai/cordis';
17
+ import type { SessionEvent, SessionId } from '@deepseek-ai/dsh-session';
17
18
  declare module '@deepseek-ai/cordis' {
18
19
  interface Context {
19
20
  sessionTelemetry: SessionTelemetryBackend;
@@ -57,6 +58,11 @@ export type SessionTelemetrySeverity = 'info' | 'warn' | 'error';
57
58
  * identity so they can never be mistaken for ledger rows.
58
59
  */
59
60
  export interface SessionTelemetryRecord {
61
+ /** Canonical envelope without data; body carries the separately redacted payload. Absent for operational records. */
62
+ sourceEvent?: {
63
+ sessionId: SessionId;
64
+ envelope: Omit<SessionEvent, 'data'>;
65
+ };
60
66
  /** Ledger (session-log mirror) or ops (operational signal) channel; backends keep the two under separate instrumentation scopes. */
61
67
  channel: 'ledger' | 'ops';
62
68
  /** Unix epoch milliseconds — the source event's append time for ledger records, the emission time for ops records. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-session-telemetry",
3
3
  "description": "SessionTelemetryBackend seam for the DeepSeek Harness: session-event capture, projection, redaction, and handoff to a reporting backend",
4
- "version": "0.1.7-rc.2",
4
+ "version": "0.2.0-rc.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,13 +27,13 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "peerDependencies": {
30
- "@deepseek-ai/dsh-session": "0.1.7-rc.2",
30
+ "@deepseek-ai/dsh-session": "0.2.0-rc.1",
31
31
  "@deepseek-ai/cordis": "~4.0.4",
32
- "@deepseek-ai/dsh-agent": "0.1.7-rc.2"
32
+ "@deepseek-ai/dsh-agent": "0.2.0-rc.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@deepseek-ai/dsh-agent": "0.1.7-rc.2",
36
- "@deepseek-ai/cordis": "~4.0.4",
37
- "@deepseek-ai/dsh-session": "0.1.7-rc.2"
35
+ "@deepseek-ai/dsh-agent": "0.2.0-rc.1",
36
+ "@deepseek-ai/dsh-session": "0.2.0-rc.1",
37
+ "@deepseek-ai/cordis": "~4.0.4"
38
38
  }
39
39
  }