@deepseek-ai/dsh-session-log-deepseek 0.1.2-rc.1 → 0.1.5-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 +2 -2
- package/README.zh.md +2 -2
- package/lib/index.js +47 -14
- package/lib/invariant.js +3 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +48 -16
- package/lib/types/invariant.js +9 -0
- package/lib/types/types.d.ts +37 -11
- package/package.json +17 -9
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-log-deepseek/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 38a5ec64cee32c25b11e5b7c0b55b7302f66952a
|
|
6
|
+
README.zh.md: 598345ebfbc24d4786aa9e7361d947b41b5d79d0
|
package/README.md
CHANGED
|
@@ -34,12 +34,12 @@ Shipped profiles mount the plugin so an overlay can enable it, but the default c
|
|
|
34
34
|
<a id="request-field"></a>
|
|
35
35
|
## Request field
|
|
36
36
|
|
|
37
|
-
For a request carrying a live `sessionId`, the plugin folds the greatest accepted watermark for that exact Session
|
|
37
|
+
For a request carrying a live `sessionId`, the plugin folds the greatest accepted watermark for that exact Session format generation, snapshots `Session.events`, and sends the contiguous suffix after the watermark. A process-local fold scans each event once and consumes later appends incrementally; restart and HMR rebuild it from the durable log. The version-1 field contains `sessionFormatVersion`, a raw session header (`seedLength` is present only for a seeded Session), numeric `afterSeq` and `throughSeq`, and every complete canonical event translated to raw-number envelope fields. Forked sessions ignore inherited parent watermarks because both the recorded Session id and format generation must match the request source. Surface events require `surfaceOp`, with numeric `startSeq` and `endSeq` for replacements; only user and tool events may carry `sourceEventSeqs`. Assistant provenance stays in the embedded stream, and log-only events carry neither metadata field.
|
|
38
38
|
|
|
39
39
|
<a id="acceptance-and-retry"></a>
|
|
40
40
|
## Acceptance and retry
|
|
41
41
|
|
|
42
|
-
The DeepSeek adapter calls the prepared contribution's `accept()` after HTTP 2xx, before it consumes the SSE body. Acceptance appends `session-log-deepseek/delivery-accepted` with the uploaded `throughSeq`; the next request uploads that event as part of its new suffix. Transport and non-2xx failures append no acceptance record, so later requests resend the uncertain range. Concurrent deliveries may be accepted out of order; folding the maximum matching `throughSeq` prevents cursor regression.
|
|
42
|
+
The DeepSeek adapter calls the prepared contribution's `accept()` after HTTP 2xx, before it consumes the SSE body. Acceptance appends `session-log-deepseek/delivery-accepted` with the uploaded `throughSeq` and `sessionFormatVersion`; a record that omits the format field denotes v0. The next request uploads that event as part of its new suffix. Transport and non-2xx failures append no acceptance record, so later requests resend the uncertain range. Concurrent deliveries may be accepted out of order; folding the maximum matching `throughSeq` prevents cursor regression.
|
|
43
43
|
|
|
44
44
|
A crash after server acceptance but before the watermark reaches persistence can replay an accepted range after restart. This is the at-least-once failure direction: uncertainty creates duplicates, never a skipped sequence. The ordinary session checkpoint policy persists the watermark at the next semantic checkpoint; this plugin performs no independent I/O.
|
|
45
45
|
|
package/README.zh.md
CHANGED
|
@@ -34,12 +34,12 @@ kind: "package-reference"
|
|
|
34
34
|
<a id="request-field"></a>
|
|
35
35
|
## 请求字段
|
|
36
36
|
|
|
37
|
-
对于携带存活 `sessionId`
|
|
37
|
+
对于携带存活 `sessionId` 的请求,插件会折叠该确切会话格式代的最大已接受水位,对 `Session.events` 取快照,并发送水位之后的连续后缀。进程内 fold 会让每条事件只被扫描一次并增量消费后续追加;重启与 HMR 会从持久日志重建它。版本 1 字段包含 `sessionFormatVersion`、原始会话 header(仅 seeded Session 携带 `seedLength`)、数值型 `afterSeq` 与 `throughSeq`,以及把完整权威事件翻译为原始数值 envelope 字段后的数组元素。只有记录的会话 id 与格式代均匹配请求来源时水位才生效,因此 fork 会话会忽略从父会话继承的水位。 表层事件必须携带 `surfaceOp`,替换范围使用数值型 `startSeq` 与 `endSeq`;仅 user 与 tool 事件可以携带 `sourceEventSeqs`。assistant 的来源保留在内嵌流中,仅日志事件不携带这两个元数据字段。
|
|
38
38
|
|
|
39
39
|
<a id="acceptance-and-retry"></a>
|
|
40
40
|
## 接受与重试
|
|
41
41
|
|
|
42
|
-
DeepSeek 适配器会在 HTTP 2xx 后、消费 SSE(Server-Sent Events)正文前调用已准备贡献的 `accept()`。接受操作会追加 `session-log-deepseek/delivery-accepted`
|
|
42
|
+
DeepSeek 适配器会在 HTTP 2xx 后、消费 SSE(Server-Sent Events)正文前调用已准备贡献的 `accept()`。接受操作会追加 `session-log-deepseek/delivery-accepted`、已上传的 `throughSeq` 与 `sessionFormatVersion`;省略格式字段的记录表示 v0。下一次请求再把该事件作为新后缀的一部分上传。传输失败与非 2xx 失败不会追加接受记录,因此后续请求会重发不确定范围。并发交付可能乱序得到接受;折叠匹配记录中最大的 `throughSeq` 可以防止游标回退。
|
|
43
43
|
|
|
44
44
|
服务端接受后、持久化水位前发生崩溃,可能让恢复后的进程重放已经接受的范围。这是至少一次交付的失败方向:不确定性会制造重复,绝不会跳过序列。普通会话检查点策略会在下一个语义检查点持久化水位;本插件不执行独立 I/O。
|
|
45
45
|
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
2
|
import { brandString } from "@deepseek-ai/dsh-brand";
|
|
3
|
-
import { SessionLogOffset, SessionSeq
|
|
3
|
+
import { KNOWN_SESSION_EVENT_TYPES, SessionLogOffset, SessionSeq } from "@deepseek-ai/dsh-session";
|
|
4
4
|
//#region lib/types/index.js
|
|
5
5
|
/**
|
|
6
6
|
* Incremental session-log contribution for official DeepSeek LLM API requests.
|
|
@@ -15,7 +15,7 @@ const inject = ["deepseekLlmApiExtensions", "sessions"];
|
|
|
15
15
|
/** Validated Session-log request contribution configuration. */
|
|
16
16
|
const Config = z.object({ enabled: z.boolean().default(false) });
|
|
17
17
|
const acceptanceFolds = /* @__PURE__ */ new WeakMap();
|
|
18
|
-
/** Translate logical Session metadata
|
|
18
|
+
/** Translate logical Session metadata to raw external request fields. */
|
|
19
19
|
function wireHeader(session) {
|
|
20
20
|
const header = session.header;
|
|
21
21
|
return {
|
|
@@ -32,24 +32,52 @@ function wireHeader(session) {
|
|
|
32
32
|
}
|
|
33
33
|
/** Translate compile-time sequence brands to raw numeric request fields. */
|
|
34
34
|
function wireEvent(event) {
|
|
35
|
-
const
|
|
36
|
-
const surfaceOp = surfaceEvent?.surfaceOp;
|
|
37
|
-
return {
|
|
38
|
-
type: event.type,
|
|
35
|
+
const common = {
|
|
39
36
|
seq: Number(event.seq),
|
|
40
37
|
time: event.time,
|
|
41
38
|
data: event.data,
|
|
42
|
-
...event.ignorable === void 0 ? {} : { ignorable: event.ignorable }
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
...event.ignorable === void 0 ? {} : { ignorable: event.ignorable }
|
|
40
|
+
};
|
|
41
|
+
switch (event.type) {
|
|
42
|
+
case "system/message":
|
|
43
|
+
case "user/message":
|
|
44
|
+
case "tool/result": return {
|
|
45
|
+
...common,
|
|
46
|
+
type: event.type,
|
|
47
|
+
surfaceOp: wireSurfaceOp(event.surfaceOp),
|
|
48
|
+
...event.sourceEventSeqs === void 0 ? {} : { sourceEventSeqs: event.sourceEventSeqs.map(Number) }
|
|
49
|
+
};
|
|
50
|
+
case "assistant/message": return {
|
|
51
|
+
...common,
|
|
52
|
+
type: event.type,
|
|
53
|
+
surfaceOp: wireSurfaceOp(event.surfaceOp)
|
|
54
|
+
};
|
|
55
|
+
default:
|
|
56
|
+
if (!KNOWN_SESSION_EVENT_TYPES.has(event.type) && event.ignorable === true) {
|
|
57
|
+
const opaque = event;
|
|
58
|
+
return {
|
|
59
|
+
...common,
|
|
60
|
+
type: event.type,
|
|
61
|
+
ignorable: true,
|
|
62
|
+
...opaque.surfaceOp === void 0 ? {} : { surfaceOp: opaque.surfaceOp },
|
|
63
|
+
...opaque.sourceEventSeqs === void 0 ? {} : { sourceEventSeqs: opaque.sourceEventSeqs }
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
...common,
|
|
68
|
+
type: event.type
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function wireSurfaceOp(op) {
|
|
73
|
+
return op === "append" ? op : {
|
|
74
|
+
op: "replace",
|
|
75
|
+
startSeq: Number(op.startSeq),
|
|
76
|
+
endSeq: Number(op.endSeq)
|
|
49
77
|
};
|
|
50
78
|
}
|
|
51
79
|
/**
|
|
52
|
-
* Highest confirmed sequence for this exact
|
|
80
|
+
* Highest confirmed sequence for this exact Session format generation.
|
|
53
81
|
* @param session - canonical log whose matching acceptance events are folded.
|
|
54
82
|
* @returns greatest accepted sequence, or `-1` before any accepted request.
|
|
55
83
|
*/
|
|
@@ -62,6 +90,9 @@ function acceptedThrough(session) {
|
|
|
62
90
|
const event = session.eventAt(SessionSeq(index));
|
|
63
91
|
if (event === void 0) throw new Error(`session-log-deepseek: missing event ${String(index)} below captured length ${String(length)}`);
|
|
64
92
|
if (event.type !== "session-log-deepseek/delivery-accepted") continue;
|
|
93
|
+
const acceptedFormatVersion = event.data.sessionFormatVersion ?? 0;
|
|
94
|
+
if (!Number.isSafeInteger(acceptedFormatVersion) || acceptedFormatVersion < 0 || Object.is(acceptedFormatVersion, -0)) throw new Error(`session-log-deepseek: malformed acceptance format version at seq ${event.seq}`);
|
|
95
|
+
if (acceptedFormatVersion !== session.header.version) continue;
|
|
65
96
|
let acceptedSeq;
|
|
66
97
|
try {
|
|
67
98
|
acceptedSeq = SessionSeq(event.data.throughSeq);
|
|
@@ -96,6 +127,7 @@ function apply(ctx, config) {
|
|
|
96
127
|
return {
|
|
97
128
|
value: {
|
|
98
129
|
version: 1,
|
|
130
|
+
sessionFormatVersion: session.header.version,
|
|
99
131
|
session: wireHeader(session),
|
|
100
132
|
afterSeq: Number(afterSeq),
|
|
101
133
|
throughSeq: Number(throughSeq),
|
|
@@ -104,6 +136,7 @@ function apply(ctx, config) {
|
|
|
104
136
|
accept: () => {
|
|
105
137
|
session.append("session-log-deepseek/delivery-accepted", {
|
|
106
138
|
sessionId: session.id,
|
|
139
|
+
sessionFormatVersion: session.header.version,
|
|
107
140
|
throughSeq
|
|
108
141
|
});
|
|
109
142
|
}
|
package/lib/invariant.js
CHANGED
|
@@ -9,6 +9,9 @@ const inject = ["invariants"];
|
|
|
9
9
|
/** Validate one acceptance watermark against its containing event and session. */
|
|
10
10
|
function validateDeliveryAccepted(session, event, fail) {
|
|
11
11
|
const { sessionId, throughSeq } = event.data;
|
|
12
|
+
const acceptedFormatVersion = event.data.sessionFormatVersion ?? 0;
|
|
13
|
+
if (!Number.isSafeInteger(acceptedFormatVersion) || acceptedFormatVersion < 0 || Object.is(acceptedFormatVersion, -0)) fail(`session-log-deepseek/delivery-accepted sessionFormatVersion must be a non-negative safe integer, got ${String(acceptedFormatVersion)}`);
|
|
14
|
+
if (acceptedFormatVersion !== session.header.version) return;
|
|
12
15
|
const inherited = session.header.parentSession !== void 0 && !session.isOwnSeq(event.seq);
|
|
13
16
|
if (sessionId !== session.id && !inherited) fail("a non-inherited session-log-deepseek/delivery-accepted event must name its containing session");
|
|
14
17
|
let acceptedSeq;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface Config {
|
|
|
20
20
|
/** Validated Session-log request contribution configuration. */
|
|
21
21
|
export declare const Config: z<Config>;
|
|
22
22
|
/**
|
|
23
|
-
* Highest confirmed sequence for this exact
|
|
23
|
+
* Highest confirmed sequence for this exact Session format generation.
|
|
24
24
|
* @param session - canonical log whose matching acceptance events are folded.
|
|
25
25
|
* @returns greatest accepted sequence, or `-1` before any accepted request.
|
|
26
26
|
*/
|
package/lib/types/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import z from '@deepseek-ai/schemastery';
|
|
8
8
|
import { brandString } from '@deepseek-ai/dsh-brand';
|
|
9
|
-
import {
|
|
9
|
+
import { KNOWN_SESSION_EVENT_TYPES, SessionLogOffset, SessionSeq } from '@deepseek-ai/dsh-session';
|
|
10
10
|
/** Cordis plugin name. */
|
|
11
11
|
export const name = 'session-log-deepseek';
|
|
12
12
|
/** Services required to resolve sessions and contribute the provider request field. */
|
|
@@ -16,7 +16,7 @@ export const Config = z.object({
|
|
|
16
16
|
enabled: z.boolean().default(false),
|
|
17
17
|
});
|
|
18
18
|
const acceptanceFolds = new WeakMap();
|
|
19
|
-
/** Translate logical Session metadata
|
|
19
|
+
/** Translate logical Session metadata to raw external request fields. */
|
|
20
20
|
function wireHeader(session) {
|
|
21
21
|
const header = session.header;
|
|
22
22
|
return {
|
|
@@ -33,26 +33,45 @@ function wireHeader(session) {
|
|
|
33
33
|
}
|
|
34
34
|
/** Translate compile-time sequence brands to raw numeric request fields. */
|
|
35
35
|
function wireEvent(event) {
|
|
36
|
-
const
|
|
37
|
-
const surfaceOp = surfaceEvent?.surfaceOp;
|
|
38
|
-
return {
|
|
39
|
-
type: event.type,
|
|
36
|
+
const common = {
|
|
40
37
|
seq: Number(event.seq),
|
|
41
38
|
time: event.time,
|
|
42
39
|
data: event.data,
|
|
43
40
|
...event.ignorable === undefined ? {} : { ignorable: event.ignorable },
|
|
44
|
-
...surfaceEvent?.sourceEventSeqs === undefined
|
|
45
|
-
? {}
|
|
46
|
-
: { sourceEventSeqs: surfaceEvent.sourceEventSeqs.map(Number) },
|
|
47
|
-
...surfaceOp === undefined
|
|
48
|
-
? {}
|
|
49
|
-
: surfaceOp === 'append'
|
|
50
|
-
? { surfaceOp }
|
|
51
|
-
: { surfaceOp: { op: 'replace', start: Number(surfaceOp.start), end: Number(surfaceOp.end) } },
|
|
52
41
|
};
|
|
42
|
+
switch (event.type) {
|
|
43
|
+
case 'system/message':
|
|
44
|
+
case 'user/message':
|
|
45
|
+
case 'tool/result':
|
|
46
|
+
return {
|
|
47
|
+
...common,
|
|
48
|
+
type: event.type,
|
|
49
|
+
surfaceOp: wireSurfaceOp(event.surfaceOp),
|
|
50
|
+
...event.sourceEventSeqs === undefined ? {} : { sourceEventSeqs: event.sourceEventSeqs.map(Number) },
|
|
51
|
+
};
|
|
52
|
+
case 'assistant/message':
|
|
53
|
+
return { ...common, type: event.type, surfaceOp: wireSurfaceOp(event.surfaceOp) };
|
|
54
|
+
default: {
|
|
55
|
+
// Restored unknown ignorable records are opaque, not current surface events.
|
|
56
|
+
if (!KNOWN_SESSION_EVENT_TYPES.has(event.type) && event.ignorable === true) {
|
|
57
|
+
const opaque = event;
|
|
58
|
+
return {
|
|
59
|
+
...common, type: event.type, ignorable: true,
|
|
60
|
+
...opaque.surfaceOp === undefined ? {} : { surfaceOp: opaque.surfaceOp },
|
|
61
|
+
...opaque.sourceEventSeqs === undefined ? {} : { sourceEventSeqs: opaque.sourceEventSeqs },
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return { ...common, type: event.type };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function wireSurfaceOp(op) {
|
|
69
|
+
return op === 'append'
|
|
70
|
+
? op
|
|
71
|
+
: { op: 'replace', startSeq: Number(op.startSeq), endSeq: Number(op.endSeq) };
|
|
53
72
|
}
|
|
54
73
|
/**
|
|
55
|
-
* Highest confirmed sequence for this exact
|
|
74
|
+
* Highest confirmed sequence for this exact Session format generation.
|
|
56
75
|
* @param session - canonical log whose matching acceptance events are folded.
|
|
57
76
|
* @returns greatest accepted sequence, or `-1` before any accepted request.
|
|
58
77
|
*/
|
|
@@ -68,6 +87,14 @@ export function acceptedThrough(session) {
|
|
|
68
87
|
}
|
|
69
88
|
if (event.type !== 'session-log-deepseek/delivery-accepted')
|
|
70
89
|
continue;
|
|
90
|
+
const acceptedFormatVersion = event.data.sessionFormatVersion ?? 0;
|
|
91
|
+
if (!Number.isSafeInteger(acceptedFormatVersion)
|
|
92
|
+
|| acceptedFormatVersion < 0
|
|
93
|
+
|| Object.is(acceptedFormatVersion, -0)) {
|
|
94
|
+
throw new Error(`session-log-deepseek: malformed acceptance format version at seq ${event.seq}`);
|
|
95
|
+
}
|
|
96
|
+
if (acceptedFormatVersion !== session.header.version)
|
|
97
|
+
continue;
|
|
71
98
|
let acceptedSeq;
|
|
72
99
|
try {
|
|
73
100
|
acceptedSeq = SessionSeq(event.data.throughSeq);
|
|
@@ -111,6 +138,7 @@ export function apply(ctx, config) {
|
|
|
111
138
|
const suffix = session.snapshotEvents(SessionLogOffset(afterSeq + 1));
|
|
112
139
|
const value = {
|
|
113
140
|
version: 1,
|
|
141
|
+
sessionFormatVersion: session.header.version,
|
|
114
142
|
session: wireHeader(session),
|
|
115
143
|
afterSeq: Number(afterSeq),
|
|
116
144
|
throughSeq: Number(throughSeq),
|
|
@@ -119,7 +147,11 @@ export function apply(ctx, config) {
|
|
|
119
147
|
return {
|
|
120
148
|
value,
|
|
121
149
|
accept: () => {
|
|
122
|
-
session.append('session-log-deepseek/delivery-accepted', {
|
|
150
|
+
session.append('session-log-deepseek/delivery-accepted', {
|
|
151
|
+
sessionId: session.id,
|
|
152
|
+
sessionFormatVersion: session.header.version,
|
|
153
|
+
throughSeq,
|
|
154
|
+
});
|
|
123
155
|
// TODO: Add an immediate lightweight checkpoint if duplicate replay after a 2xx crash window becomes unacceptable.
|
|
124
156
|
},
|
|
125
157
|
};
|
package/lib/types/invariant.js
CHANGED
|
@@ -8,6 +8,15 @@ export const inject = ['invariants'];
|
|
|
8
8
|
/** Validate one acceptance watermark against its containing event and session. */
|
|
9
9
|
function validateDeliveryAccepted(session, event, fail) {
|
|
10
10
|
const { sessionId, throughSeq } = event.data;
|
|
11
|
+
const acceptedFormatVersion = event.data.sessionFormatVersion ?? 0;
|
|
12
|
+
if (!Number.isSafeInteger(acceptedFormatVersion)
|
|
13
|
+
|| acceptedFormatVersion < 0
|
|
14
|
+
|| Object.is(acceptedFormatVersion, -0)) {
|
|
15
|
+
fail('session-log-deepseek/delivery-accepted sessionFormatVersion must be a non-negative safe integer'
|
|
16
|
+
+ `, got ${String(acceptedFormatVersion)}`);
|
|
17
|
+
}
|
|
18
|
+
if (acceptedFormatVersion !== session.header.version)
|
|
19
|
+
return;
|
|
11
20
|
const inherited = session.header.parentSession !== undefined
|
|
12
21
|
&& !session.isOwnSeq(event.seq);
|
|
13
22
|
if (sessionId !== session.id && !inherited) {
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Wire types for lossless incremental DeepSeek session-log upload. */
|
|
2
|
-
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
2
|
+
import type { SessionEvent, SurfaceEventType } from '@deepseek-ai/dsh-session';
|
|
3
3
|
import type { JsonValue } from '@deepseek-ai/dsh-util-values';
|
|
4
|
-
/**
|
|
4
|
+
/** Session header fields serialized as raw JSON primitives on the external request wire. */
|
|
5
5
|
export interface DeepSeekSessionLogWireHeader {
|
|
6
6
|
readonly version: number;
|
|
7
7
|
readonly id: string;
|
|
@@ -17,22 +17,46 @@ export interface DeepSeekSessionLogWireHeader {
|
|
|
17
17
|
/** Raw-number surface mutation serialized on the external request wire. */
|
|
18
18
|
export type DeepSeekSessionLogWireSurfaceOp = 'append' | {
|
|
19
19
|
readonly op: 'replace';
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
20
|
+
readonly startSeq: number;
|
|
21
|
+
readonly endSeq: number;
|
|
22
22
|
};
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
/**
|
|
24
|
+
* One canonical event translated to raw JSON primitives for upload. Surface
|
|
25
|
+
* events require an operation; system, user, and tool events may cite sources.
|
|
26
|
+
* Assistant provenance is embedded in its data; log-only events carry neither field.
|
|
27
|
+
*/
|
|
28
|
+
export type DeepSeekSessionLogWireEvent = {
|
|
29
|
+
[K in SessionEvent['type']]: {
|
|
30
|
+
readonly type: K;
|
|
31
|
+
readonly seq: number;
|
|
32
|
+
readonly time: number;
|
|
33
|
+
readonly data: JsonValue;
|
|
34
|
+
readonly ignorable?: true;
|
|
35
|
+
} & (K extends SurfaceEventType ? {
|
|
36
|
+
readonly surfaceOp: DeepSeekSessionLogWireSurfaceOp;
|
|
37
|
+
} & (K extends 'assistant/message' ? {
|
|
38
|
+
readonly sourceEventSeqs?: never;
|
|
39
|
+
} : {
|
|
40
|
+
readonly sourceEventSeqs?: readonly number[];
|
|
41
|
+
}) : {
|
|
42
|
+
readonly surfaceOp?: never;
|
|
43
|
+
readonly sourceEventSeqs?: never;
|
|
44
|
+
});
|
|
45
|
+
}[SessionEvent['type']] | {
|
|
46
|
+
/** Unrecognized ignorable records retain opaque metadata without surface semantics. */
|
|
47
|
+
readonly type: string;
|
|
26
48
|
readonly seq: number;
|
|
27
49
|
readonly time: number;
|
|
28
50
|
readonly data: JsonValue;
|
|
29
|
-
readonly ignorable
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
}
|
|
51
|
+
readonly ignorable: true;
|
|
52
|
+
readonly surfaceOp?: JsonValue;
|
|
53
|
+
readonly sourceEventSeqs?: JsonValue;
|
|
54
|
+
};
|
|
33
55
|
/** Versioned incremental session-log field carried by an official DeepSeek request. */
|
|
34
56
|
export interface DeepSeekSessionLogExtension {
|
|
35
57
|
readonly version: 1;
|
|
58
|
+
/** Session format generation represented by this suffix. */
|
|
59
|
+
readonly sessionFormatVersion: number;
|
|
36
60
|
readonly session: DeepSeekSessionLogWireHeader;
|
|
37
61
|
/** Highest sequence durably recorded as accepted before this request, or `-1`. */
|
|
38
62
|
readonly afterSeq: number;
|
|
@@ -52,6 +76,8 @@ declare module '@deepseek-ai/dsh-session/types' {
|
|
|
52
76
|
'session-log-deepseek/delivery-accepted': {
|
|
53
77
|
/** Session identity the accepted delivery carried; inherited fork markers retain the parent's id. */
|
|
54
78
|
sessionId: import('@deepseek-ai/dsh-session/types').SessionId;
|
|
79
|
+
/** Accepted Session format generation; absence identifies version 0. */
|
|
80
|
+
sessionFormatVersion?: number;
|
|
55
81
|
/** Last canonical event included in the accepted request. */
|
|
56
82
|
throughSeq: import('@deepseek-ai/dsh-session/types').SessionSeq;
|
|
57
83
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-session-log-deepseek",
|
|
3
3
|
"description": "Incremental lossless session-log request extension for the official DeepSeek LLM API",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -37,20 +37,28 @@
|
|
|
37
37
|
],
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@deepseek-ai/dsh-
|
|
41
|
-
"@deepseek-ai/dsh-
|
|
40
|
+
"@deepseek-ai/dsh-brand": "^0.1.5-alpha.1",
|
|
41
|
+
"@deepseek-ai/dsh-util-values": "^0.1.5-alpha.1",
|
|
42
42
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
47
|
-
"@deepseek-ai/dsh-
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
46
|
+
"@deepseek-ai/dsh-invariants": "^0.1.5-alpha.1",
|
|
47
|
+
"@deepseek-ai/dsh-session": "^0.1.5-alpha.1",
|
|
48
|
+
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.5-alpha.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
52
|
+
"@deepseek-ai/cordis-plugin-include": "^1.0.7",
|
|
51
53
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
54
|
-
"@deepseek-ai/dsh-
|
|
54
|
+
"@deepseek-ai/dsh-command-feedback": "^0.1.5-alpha.1",
|
|
55
|
+
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.5-alpha.1",
|
|
56
|
+
"@deepseek-ai/dsh-invariants": "^0.1.5-alpha.1",
|
|
57
|
+
"@deepseek-ai/dsh-llm": "^0.1.5-alpha.1",
|
|
58
|
+
"@deepseek-ai/dsh-llm-mock-server": "^0.1.5-alpha.1",
|
|
59
|
+
"@deepseek-ai/dsh-llm-deepseek": "^0.1.5-alpha.1",
|
|
60
|
+
"@deepseek-ai/dsh-session": "^0.1.5-alpha.1",
|
|
61
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.1.5-alpha.1",
|
|
62
|
+
"@deepseek-ai/dsh-message-feedback": "^0.1.5-alpha.1"
|
|
55
63
|
}
|
|
56
64
|
}
|