@deepseek-ai/dsh-session-telemetry 0.1.6-alpha.1 → 0.1.7-alpha.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 +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/index.js +6 -5
- package/lib/types/coordinator.d.ts +4 -4
- package/lib/types/index.d.ts +1 -1
- package/package.json +7 -7
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/session/session-telemetry/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: c7d76686415ee4874e29ec191d8456c31a3019f4
|
|
6
|
+
README.zh.md: 2e9bc7e6619f30d18660ef2a11ab703b02647aa3
|
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ Live capture registers Session events, flush hints, shutdown markers, and agent/
|
|
|
78
78
|
|
|
79
79
|
### The handoff cursor
|
|
80
80
|
|
|
81
|
-
A module-scope `WeakMap<Session, seq>` records the highest sequence handed off, not delivered. Re-adopting the same object resumes after that cursor. Capture
|
|
81
|
+
A module-scope `WeakMap<Session, seq>` records the highest sequence handed off, not delivered. Re-adopting the same object resumes after that cursor. Capture starts at `firstLifecycleSeq`: a new fork includes its child-owned marker and closers, while a restored Session excludes its stored prefix, including prior child turns; explicit `includeHistory: true` starts an unhanded object at seq 0, including restored or fork history. The backend owns capture authorization. Stored history does not itself authorize capture; the OTel backend waits for new explicit feedback. Receivers deduplicate repeated records by `(session.id, session.format_version, event.seq)`.
|
|
82
82
|
|
|
83
83
|
</details>
|
|
84
84
|
|
package/README.zh.md
CHANGED
|
@@ -78,7 +78,7 @@ seam 建立在一个边界之上:harness 的职责止于 `emit()`。完整事
|
|
|
78
78
|
|
|
79
79
|
### handoff 游标
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
模块级 `WeakMap<Session, seq>` 记录已经移交的最高序号,而不是已送达的最高序号。再次接管同一对象时从该游标之后继续。采集从 `firstLifecycleSeq` 开始:新 fork 包含子会话自有的标记与 fork 结束事件;恢复的 Session 排除已存储前缀,包括先前的子会话轮次。显式 `includeHistory: true` 会让尚未移交的对象从 seq 0 开始,包括恢复或 fork 历史。Backend 负责采集授权;已有存储历史本身不构成授权,OTel backend 等待新的显式反馈。接收方通过 `(session.id, session.format_version, event.seq)` 对重复记录去重。
|
|
82
82
|
|
|
83
83
|
</details>
|
|
84
84
|
|
package/lib/index.js
CHANGED
|
@@ -111,7 +111,8 @@ var SessionTelemetryCoordinator = class {
|
|
|
111
111
|
* @param throughSeq - optional last sequence included in this capture.
|
|
112
112
|
*/
|
|
113
113
|
captureSession(session, throughSeq) {
|
|
114
|
-
const
|
|
114
|
+
const start = session.firstLifecycleSeq;
|
|
115
|
+
const cursor = handoffCursor.get(session) ?? (this.options.includeHistory === true || start === 0 ? -1 : SessionSeq(start - 1));
|
|
115
116
|
for (const event of session.snapshotEvents(SessionLogOffset(cursor + 1))) {
|
|
116
117
|
if (throughSeq !== void 0 && event.seq > throughSeq) break;
|
|
117
118
|
this.contain(() => {
|
|
@@ -121,9 +122,9 @@ var SessionTelemetryCoordinator = class {
|
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
123
124
|
* Adopt a session and replay after its handoff cursor, then follow live events.
|
|
124
|
-
* New objects include
|
|
125
|
-
*
|
|
126
|
-
* object resumes after its cursor.
|
|
125
|
+
* New fork objects include child-owned seed markers and closers. Restored
|
|
126
|
+
* objects start after the stored prefix, including restored forks. includeHistory starts either object at seq 0;
|
|
127
|
+
* re-adopting the same object resumes after its cursor.
|
|
127
128
|
* @param session - the live session to adopt; a second adoption is a no-op.
|
|
128
129
|
*/
|
|
129
130
|
adopt(session) {
|
|
@@ -214,7 +215,7 @@ function shutdownRecord(session) {
|
|
|
214
215
|
/** Map an event's own outcome flag to the pre-baked alerting severity. */
|
|
215
216
|
function severityOf(event) {
|
|
216
217
|
switch (event.type) {
|
|
217
|
-
case "tool/result": return event.data.message.
|
|
218
|
+
case "tool/result": return event.data.message.isError === true ? "error" : "info";
|
|
218
219
|
case "turn/end": return event.data.reason.kind === "error" ? "error" : "info";
|
|
219
220
|
default: return "info";
|
|
220
221
|
}
|
|
@@ -22,7 +22,7 @@ export type SessionTelemetryCapture = 'live' | 'on-demand';
|
|
|
22
22
|
export interface SessionTelemetryCaptureOptions {
|
|
23
23
|
/** Follow live events, or wait for explicit capture; defaults to live. */
|
|
24
24
|
capture?: SessionTelemetryCapture;
|
|
25
|
-
/** Include stored history
|
|
25
|
+
/** Include inherited fork history and stored history from earlier lifecycles; defaults to false. */
|
|
26
26
|
includeHistory?: boolean;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -69,9 +69,9 @@ export declare class SessionTelemetryCoordinator {
|
|
|
69
69
|
captureSession(session: Session, throughSeq?: SessionSeqType): void;
|
|
70
70
|
/**
|
|
71
71
|
* Adopt a session and replay after its handoff cursor, then follow live events.
|
|
72
|
-
* New objects include
|
|
73
|
-
*
|
|
74
|
-
* object resumes after its cursor.
|
|
72
|
+
* New fork objects include child-owned seed markers and closers. Restored
|
|
73
|
+
* objects start after the stored prefix, including restored forks. includeHistory starts either object at seq 0;
|
|
74
|
+
* re-adopting the same object resumes after its cursor.
|
|
75
75
|
* @param session - the live session to adopt; a second adoption is a no-op.
|
|
76
76
|
*/
|
|
77
77
|
private adopt;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ declare module '@deepseek-ai/cordis' {
|
|
|
43
43
|
/**
|
|
44
44
|
* Severity of a telemetry record, pre-mapped at capture so a receiver can
|
|
45
45
|
* alert with zero configuration: `error` for events whose own outcome flag
|
|
46
|
-
* says so (the tool
|
|
46
|
+
* says so (the tool message's `isError`, `turn/end` error reasons) and for
|
|
47
47
|
* `agent-error` operational records. Captured events otherwise default to
|
|
48
48
|
* `info`; `warn` remains available to `session-telemetry/record` policies and
|
|
49
49
|
* backends.
|
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.
|
|
4
|
+
"version": "0.1.7-alpha.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-agent": "^0.1.
|
|
31
|
-
"@deepseek-ai/
|
|
32
|
-
"@deepseek-ai/
|
|
30
|
+
"@deepseek-ai/dsh-agent": "^0.1.7-alpha.1",
|
|
31
|
+
"@deepseek-ai/dsh-session": "^0.1.7-alpha.1",
|
|
32
|
+
"@deepseek-ai/cordis": "^4.0.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@deepseek-ai/dsh-
|
|
36
|
-
"@deepseek-ai/
|
|
37
|
-
"@deepseek-ai/
|
|
35
|
+
"@deepseek-ai/dsh-agent": "^0.1.7-alpha.1",
|
|
36
|
+
"@deepseek-ai/dsh-session": "^0.1.7-alpha.1",
|
|
37
|
+
"@deepseek-ai/cordis": "^4.0.3"
|
|
38
38
|
}
|
|
39
39
|
}
|