@deepseek-ai/dsh-session-log-deepseek 0.1.2-alpha.2 → 0.1.2-alpha.4
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 +55 -15
- package/lib/invariant.js +10 -3
- package/lib/types/index.d.ts +2 -2
- package/lib/types/index.js +62 -16
- package/lib/types/invariant.js +11 -4
- package/lib/types/types.d.ts +34 -4
- package/package.json +9 -8
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: b08b2d3cde78e7a3cf7050e90ff57655ad70d409
|
|
6
|
+
README.zh.md: 0ee216c6c69178695eb629b2a81faef73103b13d
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ 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 identity, 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
|
|
37
|
+
For a request carrying a live `sessionId`, the plugin folds the greatest accepted watermark for that exact Session identity, 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 a v0-compatible 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 each watermark records the Session id sent on the accepted request.
|
|
38
38
|
|
|
39
39
|
<a id="acceptance-and-retry"></a>
|
|
40
40
|
## Acceptance and retry
|
package/README.zh.md
CHANGED
|
@@ -34,7 +34,7 @@ kind: "package-reference"
|
|
|
34
34
|
<a id="request-field"></a>
|
|
35
35
|
## 请求字段
|
|
36
36
|
|
|
37
|
-
对于携带存活 `sessionId` 的请求,插件会折叠该确切会话身份的最大已接受水位,对 `Session.events` 取快照,并发送水位之后的连续后缀。进程内 fold 会让每条事件只被扫描一次并增量消费后续追加;重启与 HMR 会从持久日志重建它。版本 1
|
|
37
|
+
对于携带存活 `sessionId` 的请求,插件会折叠该确切会话身份的最大已接受水位,对 `Session.events` 取快照,并发送水位之后的连续后缀。进程内 fold 会让每条事件只被扫描一次并增量消费后续追加;重启与 HMR 会从持久日志重建它。版本 1 字段包含兼容 v0 的原始会话 header(仅 seeded Session 携带 `seedLength`)、数值型 `afterSeq` 与 `throughSeq`,以及把完整权威事件翻译为原始数值 envelope 字段后的数组元素。每个水位都会记录已接受请求发送的会话 id,因此 fork 会话会忽略从父会话继承的水位。
|
|
38
38
|
|
|
39
39
|
<a id="acceptance-and-retry"></a>
|
|
40
40
|
## 接受与重试
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
2
|
import { brandString } from "@deepseek-ai/dsh-brand";
|
|
3
|
+
import { SessionLogOffset, SessionSeq, isSurfaceEvent } from "@deepseek-ai/dsh-session";
|
|
3
4
|
//#region lib/types/index.js
|
|
4
5
|
/**
|
|
5
6
|
* Incremental session-log contribution for official DeepSeek LLM API requests.
|
|
@@ -14,6 +15,39 @@ const inject = ["deepseekLlmApiExtensions", "sessions"];
|
|
|
14
15
|
/** Validated Session-log request contribution configuration. */
|
|
15
16
|
const Config = z.object({ enabled: z.boolean().default(false) });
|
|
16
17
|
const acceptanceFolds = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
/** Translate logical Session metadata back to the stable version-0 wire header. */
|
|
19
|
+
function wireHeader(session) {
|
|
20
|
+
const header = session.header;
|
|
21
|
+
return {
|
|
22
|
+
version: header.version,
|
|
23
|
+
id: String(header.id),
|
|
24
|
+
createdAt: header.createdAt,
|
|
25
|
+
...header.cwd === void 0 ? {} : { cwd: header.cwd },
|
|
26
|
+
...header.parentSession === void 0 ? {} : { parentSession: String(header.parentSession) },
|
|
27
|
+
...header.isSeeded ? { seedLength: Number(session.inheritedEventCount) } : {},
|
|
28
|
+
...header.origin === void 0 ? {} : { origin: header.origin },
|
|
29
|
+
...header.delegationDepth === void 0 ? {} : { delegationDepth: header.delegationDepth },
|
|
30
|
+
...header.agentPreset === void 0 ? {} : { agentPreset: header.agentPreset }
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Translate compile-time sequence brands to raw numeric request fields. */
|
|
34
|
+
function wireEvent(event) {
|
|
35
|
+
const surfaceEvent = isSurfaceEvent(event) ? event : void 0;
|
|
36
|
+
const surfaceOp = surfaceEvent?.surfaceOp;
|
|
37
|
+
return {
|
|
38
|
+
type: event.type,
|
|
39
|
+
seq: Number(event.seq),
|
|
40
|
+
time: event.time,
|
|
41
|
+
data: event.data,
|
|
42
|
+
...event.ignorable === void 0 ? {} : { ignorable: event.ignorable },
|
|
43
|
+
...surfaceEvent?.sourceEventSeqs === void 0 ? {} : { sourceEventSeqs: surfaceEvent.sourceEventSeqs.map(Number) },
|
|
44
|
+
...surfaceOp === void 0 ? {} : surfaceOp === "append" ? { surfaceOp } : { surfaceOp: {
|
|
45
|
+
op: "replace",
|
|
46
|
+
start: Number(surfaceOp.start),
|
|
47
|
+
end: Number(surfaceOp.end)
|
|
48
|
+
} }
|
|
49
|
+
};
|
|
50
|
+
}
|
|
17
51
|
/**
|
|
18
52
|
* Highest confirmed sequence for this exact session identity.
|
|
19
53
|
* @param session - canonical log whose matching acceptance events are folded.
|
|
@@ -22,17 +56,24 @@ const acceptanceFolds = /* @__PURE__ */ new WeakMap();
|
|
|
22
56
|
function acceptedThrough(session) {
|
|
23
57
|
const previous = acceptanceFolds.get(session);
|
|
24
58
|
let throughSeq = previous?.throughSeq ?? -1;
|
|
25
|
-
const
|
|
26
|
-
const start = previous?.scannedEvents ?? 0;
|
|
27
|
-
for (let index = start; index <
|
|
28
|
-
const event =
|
|
59
|
+
const length = session.seq;
|
|
60
|
+
const start = previous?.scannedEvents ?? SessionLogOffset(0);
|
|
61
|
+
for (let index = start; index < length; index++) {
|
|
62
|
+
const event = session.eventAt(SessionSeq(index));
|
|
63
|
+
if (event === void 0) throw new Error(`session-log-deepseek: missing event ${String(index)} below captured length ${String(length)}`);
|
|
29
64
|
if (event.type !== "session-log-deepseek/delivery-accepted") continue;
|
|
30
|
-
|
|
65
|
+
let acceptedSeq;
|
|
66
|
+
try {
|
|
67
|
+
acceptedSeq = SessionSeq(event.data.throughSeq);
|
|
68
|
+
} catch {
|
|
69
|
+
throw new Error(`session-log-deepseek: malformed acceptance watermark at seq ${event.seq}`);
|
|
70
|
+
}
|
|
71
|
+
if (typeof event.data.sessionId !== "string" || event.data.sessionId.length === 0 || acceptedSeq >= event.seq) throw new Error(`session-log-deepseek: malformed acceptance watermark at seq ${event.seq}`);
|
|
31
72
|
if (event.data.sessionId !== session.id) continue;
|
|
32
|
-
|
|
73
|
+
if (acceptedSeq > throughSeq) throughSeq = acceptedSeq;
|
|
33
74
|
}
|
|
34
75
|
acceptanceFolds.set(session, {
|
|
35
|
-
scannedEvents:
|
|
76
|
+
scannedEvents: length,
|
|
36
77
|
throughSeq
|
|
37
78
|
});
|
|
38
79
|
return throughSeq;
|
|
@@ -49,17 +90,16 @@ function apply(ctx, config) {
|
|
|
49
90
|
const session = ctx.sessions.get(brandString(request.sessionId));
|
|
50
91
|
if (session === void 0) return void 0;
|
|
51
92
|
const afterSeq = acceptedThrough(session);
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const suffix = snapshot.slice(afterSeq + 1);
|
|
93
|
+
const throughSeq = session.snapshotEvents().at(-1)?.seq;
|
|
94
|
+
if (throughSeq === void 0) return void 0;
|
|
95
|
+
const suffix = session.snapshotEvents(SessionLogOffset(afterSeq + 1));
|
|
56
96
|
return {
|
|
57
97
|
value: {
|
|
58
98
|
version: 1,
|
|
59
|
-
session: session
|
|
60
|
-
afterSeq,
|
|
61
|
-
throughSeq,
|
|
62
|
-
events: suffix
|
|
99
|
+
session: wireHeader(session),
|
|
100
|
+
afterSeq: Number(afterSeq),
|
|
101
|
+
throughSeq: Number(throughSeq),
|
|
102
|
+
events: suffix.map(wireEvent)
|
|
63
103
|
},
|
|
64
104
|
accept: () => {
|
|
65
105
|
session.append("session-log-deepseek/delivery-accepted", {
|
package/lib/invariant.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SessionSeq } from "@deepseek-ai/dsh-session";
|
|
1
2
|
//#region lib/types/invariant.js
|
|
2
3
|
/** Package-owned invariants for DeepSeek session-log acceptance watermarks. */
|
|
3
4
|
const PACKAGE_NAME = "@deepseek-ai/dsh-session-log-deepseek";
|
|
@@ -8,13 +9,19 @@ const inject = ["invariants"];
|
|
|
8
9
|
/** Validate one acceptance watermark against its containing event and session. */
|
|
9
10
|
function validateDeliveryAccepted(session, event, fail) {
|
|
10
11
|
const { sessionId, throughSeq } = event.data;
|
|
11
|
-
const inherited = session.header.parentSession !== void 0 && session.
|
|
12
|
+
const inherited = session.header.parentSession !== void 0 && !session.isOwnSeq(event.seq);
|
|
12
13
|
if (sessionId !== session.id && !inherited) fail("a non-inherited session-log-deepseek/delivery-accepted event must name its containing session");
|
|
13
|
-
|
|
14
|
+
let acceptedSeq;
|
|
15
|
+
try {
|
|
16
|
+
acceptedSeq = SessionSeq(throughSeq);
|
|
17
|
+
} catch {
|
|
18
|
+
fail(`session-log-deepseek/delivery-accepted throughSeq must identify an earlier event, got ${throughSeq} at seq ${event.seq}`);
|
|
19
|
+
}
|
|
20
|
+
if (acceptedSeq >= event.seq) fail(`session-log-deepseek/delivery-accepted throughSeq must identify an earlier event, got ${throughSeq} at seq ${event.seq}`);
|
|
14
21
|
}
|
|
15
22
|
/** Validate acceptance watermarks already present in one Session. */
|
|
16
23
|
function validateSession(session, fail) {
|
|
17
|
-
for (const event of session.
|
|
24
|
+
for (const event of session.snapshotEvents()) if (event.type === "session-log-deepseek/delivery-accepted") validateDeliveryAccepted(session, event, fail);
|
|
18
25
|
}
|
|
19
26
|
/** Validate one live session-event dispatch. */
|
|
20
27
|
function validateDispatched(args, fail) {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { Context } from '@deepseek-ai/cordis';
|
|
8
8
|
import z from '@deepseek-ai/schemastery';
|
|
9
|
-
import type { Session } from '@deepseek-ai/dsh-session';
|
|
9
|
+
import type { Session, SessionSeqCursor } from '@deepseek-ai/dsh-session';
|
|
10
10
|
export type * from './types.ts';
|
|
11
11
|
/** Cordis plugin name. */
|
|
12
12
|
export declare const name = "session-log-deepseek";
|
|
@@ -24,7 +24,7 @@ export declare const Config: z<Config>;
|
|
|
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
|
*/
|
|
27
|
-
export declare function acceptedThrough(session: Session):
|
|
27
|
+
export declare function acceptedThrough(session: Session): SessionSeqCursor;
|
|
28
28
|
/**
|
|
29
29
|
* Register the incremental `dsh_session_log` request contribution when enabled.
|
|
30
30
|
* @param ctx - plugin context carrying Sessions and the DeepSeek request-extension registry.
|
package/lib/types/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import z from '@deepseek-ai/schemastery';
|
|
8
8
|
import { brandString } from '@deepseek-ai/dsh-brand';
|
|
9
|
+
import { isSurfaceEvent, SessionLogOffset, SessionSeq } from '@deepseek-ai/dsh-session';
|
|
9
10
|
/** Cordis plugin name. */
|
|
10
11
|
export const name = 'session-log-deepseek';
|
|
11
12
|
/** Services required to resolve sessions and contribute the provider request field. */
|
|
@@ -15,6 +16,41 @@ export const Config = z.object({
|
|
|
15
16
|
enabled: z.boolean().default(false),
|
|
16
17
|
});
|
|
17
18
|
const acceptanceFolds = new WeakMap();
|
|
19
|
+
/** Translate logical Session metadata back to the stable version-0 wire header. */
|
|
20
|
+
function wireHeader(session) {
|
|
21
|
+
const header = session.header;
|
|
22
|
+
return {
|
|
23
|
+
version: header.version,
|
|
24
|
+
id: String(header.id),
|
|
25
|
+
createdAt: header.createdAt,
|
|
26
|
+
...header.cwd === undefined ? {} : { cwd: header.cwd },
|
|
27
|
+
...header.parentSession === undefined ? {} : { parentSession: String(header.parentSession) },
|
|
28
|
+
...header.isSeeded ? { seedLength: Number(session.inheritedEventCount) } : {},
|
|
29
|
+
...header.origin === undefined ? {} : { origin: header.origin },
|
|
30
|
+
...header.delegationDepth === undefined ? {} : { delegationDepth: header.delegationDepth },
|
|
31
|
+
...header.agentPreset === undefined ? {} : { agentPreset: header.agentPreset },
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Translate compile-time sequence brands to raw numeric request fields. */
|
|
35
|
+
function wireEvent(event) {
|
|
36
|
+
const surfaceEvent = isSurfaceEvent(event) ? event : undefined;
|
|
37
|
+
const surfaceOp = surfaceEvent?.surfaceOp;
|
|
38
|
+
return {
|
|
39
|
+
type: event.type,
|
|
40
|
+
seq: Number(event.seq),
|
|
41
|
+
time: event.time,
|
|
42
|
+
data: event.data,
|
|
43
|
+
...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
|
+
};
|
|
53
|
+
}
|
|
18
54
|
/**
|
|
19
55
|
* Highest confirmed sequence for this exact session identity.
|
|
20
56
|
* @param session - canonical log whose matching acceptance events are folded.
|
|
@@ -23,22 +59,32 @@ const acceptanceFolds = new WeakMap();
|
|
|
23
59
|
export function acceptedThrough(session) {
|
|
24
60
|
const previous = acceptanceFolds.get(session);
|
|
25
61
|
let throughSeq = previous?.throughSeq ?? -1;
|
|
26
|
-
const
|
|
27
|
-
const start = previous?.scannedEvents ?? 0;
|
|
28
|
-
for (let index = start; index <
|
|
29
|
-
const event =
|
|
62
|
+
const length = session.seq;
|
|
63
|
+
const start = previous?.scannedEvents ?? SessionLogOffset(0);
|
|
64
|
+
for (let index = start; index < length; index++) {
|
|
65
|
+
const event = session.eventAt(SessionSeq(index));
|
|
66
|
+
if (event === undefined) {
|
|
67
|
+
throw new Error(`session-log-deepseek: missing event ${String(index)} below captured length ${String(length)}`);
|
|
68
|
+
}
|
|
30
69
|
if (event.type !== 'session-log-deepseek/delivery-accepted')
|
|
31
70
|
continue;
|
|
71
|
+
let acceptedSeq;
|
|
72
|
+
try {
|
|
73
|
+
acceptedSeq = SessionSeq(event.data.throughSeq);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
throw new Error(`session-log-deepseek: malformed acceptance watermark at seq ${event.seq}`);
|
|
77
|
+
}
|
|
32
78
|
if (typeof event.data.sessionId !== 'string' || event.data.sessionId.length === 0
|
|
33
|
-
||
|
|
34
|
-
|| event.data.throughSeq >= event.seq) {
|
|
79
|
+
|| acceptedSeq >= event.seq) {
|
|
35
80
|
throw new Error(`session-log-deepseek: malformed acceptance watermark at seq ${event.seq}`);
|
|
36
81
|
}
|
|
37
82
|
if (event.data.sessionId !== session.id)
|
|
38
83
|
continue;
|
|
39
|
-
|
|
84
|
+
if (acceptedSeq > throughSeq)
|
|
85
|
+
throughSeq = acceptedSeq;
|
|
40
86
|
}
|
|
41
|
-
acceptanceFolds.set(session, { scannedEvents:
|
|
87
|
+
acceptanceFolds.set(session, { scannedEvents: length, throughSeq });
|
|
42
88
|
return throughSeq;
|
|
43
89
|
}
|
|
44
90
|
/**
|
|
@@ -58,17 +104,17 @@ export function apply(ctx, config) {
|
|
|
58
104
|
if (session === undefined)
|
|
59
105
|
return undefined;
|
|
60
106
|
const afterSeq = acceptedThrough(session);
|
|
61
|
-
const snapshot = session.
|
|
62
|
-
const throughSeq = snapshot.
|
|
63
|
-
if (throughSeq
|
|
107
|
+
const snapshot = session.snapshotEvents();
|
|
108
|
+
const throughSeq = snapshot.at(-1)?.seq;
|
|
109
|
+
if (throughSeq === undefined)
|
|
64
110
|
return undefined;
|
|
65
|
-
const suffix =
|
|
111
|
+
const suffix = session.snapshotEvents(SessionLogOffset(afterSeq + 1));
|
|
66
112
|
const value = {
|
|
67
113
|
version: 1,
|
|
68
|
-
session: session
|
|
69
|
-
afterSeq,
|
|
70
|
-
throughSeq,
|
|
71
|
-
events: suffix,
|
|
114
|
+
session: wireHeader(session),
|
|
115
|
+
afterSeq: Number(afterSeq),
|
|
116
|
+
throughSeq: Number(throughSeq),
|
|
117
|
+
events: suffix.map(wireEvent),
|
|
72
118
|
};
|
|
73
119
|
return {
|
|
74
120
|
value,
|
package/lib/types/invariant.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Package-owned invariants for DeepSeek session-log acceptance watermarks. */
|
|
2
|
+
import { SessionSeq } from '@deepseek-ai/dsh-session';
|
|
2
3
|
const PACKAGE_NAME = '@deepseek-ai/dsh-session-log-deepseek';
|
|
3
4
|
/** Cordis companion plugin name. */
|
|
4
5
|
export const name = 'session-log-deepseek-invariant';
|
|
@@ -8,18 +9,24 @@ export const inject = ['invariants'];
|
|
|
8
9
|
function validateDeliveryAccepted(session, event, fail) {
|
|
9
10
|
const { sessionId, throughSeq } = event.data;
|
|
10
11
|
const inherited = session.header.parentSession !== undefined
|
|
11
|
-
&& session.
|
|
12
|
-
&& event.seq < session.header.seedLength;
|
|
12
|
+
&& !session.isOwnSeq(event.seq);
|
|
13
13
|
if (sessionId !== session.id && !inherited) {
|
|
14
14
|
fail('a non-inherited session-log-deepseek/delivery-accepted event must name its containing session');
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
let acceptedSeq;
|
|
17
|
+
try {
|
|
18
|
+
acceptedSeq = SessionSeq(throughSeq);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
fail(`session-log-deepseek/delivery-accepted throughSeq must identify an earlier event, got ${throughSeq} at seq ${event.seq}`);
|
|
22
|
+
}
|
|
23
|
+
if (acceptedSeq >= event.seq) {
|
|
17
24
|
fail(`session-log-deepseek/delivery-accepted throughSeq must identify an earlier event, got ${throughSeq} at seq ${event.seq}`);
|
|
18
25
|
}
|
|
19
26
|
}
|
|
20
27
|
/** Validate acceptance watermarks already present in one Session. */
|
|
21
28
|
function validateSession(session, fail) {
|
|
22
|
-
for (const event of session.
|
|
29
|
+
for (const event of session.snapshotEvents()) {
|
|
23
30
|
if (event.type === 'session-log-deepseek/delivery-accepted')
|
|
24
31
|
validateDeliveryAccepted(session, event, fail);
|
|
25
32
|
}
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,15 +1,45 @@
|
|
|
1
1
|
/** Wire types for lossless incremental DeepSeek session-log upload. */
|
|
2
|
-
import type { SessionEvent
|
|
2
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
3
|
+
import type { JsonValue } from '@deepseek-ai/dsh-util-values';
|
|
4
|
+
/** Version-0 Session header fields serialized on the external request wire. */
|
|
5
|
+
export interface DeepSeekSessionLogWireHeader {
|
|
6
|
+
readonly version: number;
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly createdAt: number;
|
|
9
|
+
readonly cwd?: string;
|
|
10
|
+
readonly parentSession?: string;
|
|
11
|
+
/** Exact inherited prefix length; absent for an unseeded Session. */
|
|
12
|
+
readonly seedLength?: number;
|
|
13
|
+
readonly origin?: 'subagent';
|
|
14
|
+
readonly delegationDepth?: number;
|
|
15
|
+
readonly agentPreset?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Raw-number surface mutation serialized on the external request wire. */
|
|
18
|
+
export type DeepSeekSessionLogWireSurfaceOp = 'append' | {
|
|
19
|
+
readonly op: 'replace';
|
|
20
|
+
readonly start: number;
|
|
21
|
+
readonly end: number;
|
|
22
|
+
};
|
|
23
|
+
/** One complete canonical event translated to raw JSON primitives for upload. */
|
|
24
|
+
export interface DeepSeekSessionLogWireEvent {
|
|
25
|
+
readonly type: SessionEvent['type'];
|
|
26
|
+
readonly seq: number;
|
|
27
|
+
readonly time: number;
|
|
28
|
+
readonly data: JsonValue;
|
|
29
|
+
readonly ignorable?: true;
|
|
30
|
+
readonly sourceEventSeqs?: readonly number[];
|
|
31
|
+
readonly surfaceOp?: DeepSeekSessionLogWireSurfaceOp;
|
|
32
|
+
}
|
|
3
33
|
/** Versioned incremental session-log field carried by an official DeepSeek request. */
|
|
4
34
|
export interface DeepSeekSessionLogExtension {
|
|
5
35
|
readonly version: 1;
|
|
6
|
-
readonly session:
|
|
36
|
+
readonly session: DeepSeekSessionLogWireHeader;
|
|
7
37
|
/** Highest sequence durably recorded as accepted before this request, or `-1`. */
|
|
8
38
|
readonly afterSeq: number;
|
|
9
39
|
/** Highest sequence represented by {@link events}. */
|
|
10
40
|
readonly throughSeq: number;
|
|
11
41
|
/** Complete canonical event envelopes for every sequence from `afterSeq + 1` through `throughSeq`. */
|
|
12
|
-
readonly events: readonly
|
|
42
|
+
readonly events: readonly DeepSeekSessionLogWireEvent[];
|
|
13
43
|
}
|
|
14
44
|
declare module '@deepseek-ai/dsh-deepseek-llm-api-extensions/types' {
|
|
15
45
|
interface DeepSeekLlmApiExtensionMap {
|
|
@@ -23,7 +53,7 @@ declare module '@deepseek-ai/dsh-session/types' {
|
|
|
23
53
|
/** Session identity the accepted delivery carried; inherited fork markers retain the parent's id. */
|
|
24
54
|
sessionId: import('@deepseek-ai/dsh-session/types').SessionId;
|
|
25
55
|
/** Last canonical event included in the accepted request. */
|
|
26
|
-
throughSeq:
|
|
56
|
+
throughSeq: import('@deepseek-ai/dsh-session/types').SessionSeq;
|
|
27
57
|
};
|
|
28
58
|
}
|
|
29
59
|
}
|
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.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -37,19 +37,20 @@
|
|
|
37
37
|
],
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@deepseek-ai/dsh-
|
|
40
|
+
"@deepseek-ai/dsh-util-values": "^0.1.2-alpha.4",
|
|
41
|
+
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.4",
|
|
41
42
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.2-alpha.2",
|
|
45
45
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
47
|
-
"@deepseek-ai/dsh-
|
|
46
|
+
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.2-alpha.4",
|
|
47
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.4",
|
|
48
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.4"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
51
|
-
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.2-alpha.
|
|
52
|
-
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.
|
|
53
|
-
"@deepseek-ai/dsh-session": "^0.1.2-alpha.
|
|
52
|
+
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.2-alpha.4",
|
|
53
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.4",
|
|
54
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.4"
|
|
54
55
|
}
|
|
55
56
|
}
|