@deepseek-ai/dsh-session-log-deepseek 0.1.5-rc.2 → 0.1.6-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 +4 -5
- package/README.zh.md +9 -10
- package/lib/index.js +2 -2
- package/lib/types/index.d.ts +2 -2
- package/lib/types/index.js +5 -2
- package/lib/types/invariant.js +1 -0
- package/lib/types/types.d.ts +1 -1
- package/package.json +15 -15
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: 27396f96191e0f88268558a1426b28e0b7dc6f12
|
|
6
|
+
README.zh.md: a2840223f043283b0f7f0176108d23a5c94213ef
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
Incremental canonical session-log upload for official DeepSeek LLM API requests. This function plugin injects `ctx.sessions` and `ctx.deepseekLlmApiExtensions`, then owns the `dsh_session_log` request field and the durable `session-log-deepseek/delivery-accepted` event from which it derives the acceptance watermark.
|
|
12
|
+
Incremental canonical session-log upload for official DeepSeek LLM API requests. This function plugin injects `ctx.sessions` and `ctx.deepseekLlmApiExtensions`, then owns the `dsh_session_log` request field and the durable `session-log-deepseek/delivery-accepted` event from which it derives the acceptance watermark. Disable it only when the official API must not receive a Session-log suffix.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -27,14 +27,14 @@ Incremental canonical session-log upload for official DeepSeek LLM API requests.
|
|
|
27
27
|
|
|
28
28
|
| Key | Default | Meaning |
|
|
29
29
|
|---|---:|---|
|
|
30
|
-
| `enabled` | `
|
|
30
|
+
| `enabled` | `true` | Register the `dsh_session_log` contribution. Set it to `false` to stop Session-log upload. |
|
|
31
31
|
|
|
32
|
-
Shipped profiles mount the plugin so
|
|
32
|
+
Shipped profiles mount the plugin, so the default configuration registers the request field and appends the acceptance watermark; an overlay opts out with `enabled: false`.
|
|
33
33
|
|
|
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 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
|
|
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 system, user, and tool events may carry `sourceEventSeqs`. Assistant provider metadata 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
|
|
@@ -70,7 +70,6 @@ None; the model-visible request prefix remains unchanged.
|
|
|
70
70
|
- **No live Session means no field** — direct or stale-session calls have no canonical log to snapshot; explicit absence semantics remain deferred.
|
|
71
71
|
- **No independent request-size cap** — complete delivery is fail-closed; provider rejection leaves the cursor unchanged instead of truncating the log.
|
|
72
72
|
|
|
73
|
-
|
|
74
73
|
<a id="dev-note"></a>
|
|
75
74
|
### Dev Note
|
|
76
75
|
|
package/README.zh.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "面向启用官方 DeepSeek
|
|
2
|
+
description: "面向启用官方 DeepSeek 请求元数据的部署,增量上传规范会话日志。"
|
|
3
3
|
kind: "package-reference"
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ kind: "package-reference"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
用于 DeepSeek 官方 LLM
|
|
12
|
+
用于 DeepSeek 官方 LLM(大语言模型)API 请求的增量规范会话日志上传。该函数插件注入 `ctx.sessions` 与 `ctx.deepseekLlmApiExtensions`,并拥有 `dsh_session_log` 请求字段以及用于派生接受水位的持久 `session-log-deepseek/delivery-accepted` 事件。仅当官方 API 不得接收会话日志后缀时才禁用它。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -27,19 +27,19 @@ kind: "package-reference"
|
|
|
27
27
|
|
|
28
28
|
| 配置键 | 默认值 | 含义 |
|
|
29
29
|
|---|---:|---|
|
|
30
|
-
| `enabled` | `
|
|
30
|
+
| `enabled` | `true` | 注册 `dsh_session_log` 贡献。将其设为 `false` 可停止会话日志上传。 |
|
|
31
31
|
|
|
32
|
-
随附 profile
|
|
32
|
+
随附 profile 会挂载该插件,因此默认配置会注册请求字段并追加接受水位;overlay 可用 `enabled: false` 选择退出。
|
|
33
33
|
|
|
34
34
|
<a id="request-field"></a>
|
|
35
35
|
## 请求字段
|
|
36
36
|
|
|
37
|
-
对于携带存活 `sessionId` 的请求,插件会折叠该确切会话格式代的最大已接受水位,对 `Session.events` 取快照,并发送水位之后的连续后缀。进程内 fold 会让每条事件只被扫描一次并增量消费后续追加;重启与 HMR
|
|
37
|
+
对于携带存活 `sessionId` 的请求,插件会折叠该确切会话格式代的最大已接受水位,对 `Session.events` 取快照,并发送水位之后的连续后缀。进程内 fold 会让每条事件只被扫描一次并增量消费后续追加;重启与 HMR(热模块替换)会从持久日志重建它。版本 1 字段包含 `sessionFormatVersion`、原始会话 header(仅 seeded Session 携带 `seedLength`)、数值型 `afterSeq` 与 `throughSeq`,以及每个已转换为原始数值 envelope 字段的完整规范事件。只有记录的会话 id 与格式代均匹配请求来源时水位才生效,因此 fork 会话会忽略从父会话继承的水位。表层事件必须携带 `surfaceOp`,替换范围使用数值型 `startSeq` 与 `endSeq`;仅 system、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
|
|
|
@@ -66,10 +66,9 @@ DeepSeek 适配器会在 HTTP 2xx 后、消费 SSE(Server-Sent Events)正文
|
|
|
66
66
|
|
|
67
67
|
<a id="known-limitations-and-deferred-work"></a>
|
|
68
68
|
|
|
69
|
-
- **崩溃窗口重复**——2xx
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
|
|
69
|
+
- **崩溃窗口重复**——2xx 后、接受水位持久化前进程终止,会在恢复时触发保守重放。
|
|
70
|
+
- **缺少存活会话就没有字段**——直接调用或陈旧会话调用没有可供快照的规范日志;显式缺失语义仍暂缓处理。
|
|
71
|
+
- **没有独立请求大小上限**——完整交付采用 fail-closed 策略;提供方拒绝会保持游标不变,而非截断日志。
|
|
73
72
|
|
|
74
73
|
<a id="dev-note"></a>
|
|
75
74
|
### 开发备注
|
package/lib/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const name = "session-log-deepseek";
|
|
|
13
13
|
/** Services required to resolve sessions and contribute the provider request field. */
|
|
14
14
|
const inject = ["deepseekLlmApiExtensions", "sessions"];
|
|
15
15
|
/** Validated Session-log request contribution configuration. */
|
|
16
|
-
const Config = z.object({ enabled: z.boolean().default(
|
|
16
|
+
const Config = z.object({ enabled: z.boolean().default(true) });
|
|
17
17
|
const acceptanceFolds = /* @__PURE__ */ new WeakMap();
|
|
18
18
|
/** Translate logical Session metadata to raw external request fields. */
|
|
19
19
|
function wireHeader(session) {
|
|
@@ -112,7 +112,7 @@ function acceptedThrough(session) {
|
|
|
112
112
|
/**
|
|
113
113
|
* Register the incremental `dsh_session_log` request contribution when enabled.
|
|
114
114
|
* @param ctx - plugin context carrying Sessions and the DeepSeek request-extension registry.
|
|
115
|
-
* @param config - validated
|
|
115
|
+
* @param config - validated configuration.
|
|
116
116
|
*/
|
|
117
117
|
function apply(ctx, config) {
|
|
118
118
|
if (config.enabled !== true) return;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const name = "session-log-deepseek";
|
|
|
14
14
|
export declare const inject: string[];
|
|
15
15
|
/** Session-log request contribution configuration. */
|
|
16
16
|
export interface Config {
|
|
17
|
-
/** Contribute `dsh_session_log` to official DeepSeek requests. Defaults to `
|
|
17
|
+
/** Contribute `dsh_session_log` to official DeepSeek requests. Defaults to `true`. */
|
|
18
18
|
enabled?: boolean;
|
|
19
19
|
}
|
|
20
20
|
/** Validated Session-log request contribution configuration. */
|
|
@@ -28,7 +28,7 @@ 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.
|
|
31
|
-
* @param config - validated
|
|
31
|
+
* @param config - validated configuration.
|
|
32
32
|
*/
|
|
33
33
|
export declare function apply(ctx: Context, config: Config): void;
|
|
34
34
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/types/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export const name = 'session-log-deepseek';
|
|
|
13
13
|
export const inject = ['deepseekLlmApiExtensions', 'sessions'];
|
|
14
14
|
/** Validated Session-log request contribution configuration. */
|
|
15
15
|
export const Config = z.object({
|
|
16
|
-
enabled: z.boolean().default(
|
|
16
|
+
enabled: z.boolean().default(true),
|
|
17
17
|
});
|
|
18
18
|
const acceptanceFolds = new WeakMap();
|
|
19
19
|
/** Translate logical Session metadata to raw external request fields. */
|
|
@@ -81,6 +81,7 @@ export function acceptedThrough(session) {
|
|
|
81
81
|
const length = session.seq;
|
|
82
82
|
const start = previous?.scannedEvents ?? SessionLogOffset(0);
|
|
83
83
|
for (let index = start; index < length; index++) {
|
|
84
|
+
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
|
|
84
85
|
const event = session.eventAt(SessionSeq(index));
|
|
85
86
|
if (event === undefined) {
|
|
86
87
|
throw new Error(`session-log-deepseek: missing event ${String(index)} below captured length ${String(length)}`);
|
|
@@ -117,7 +118,7 @@ export function acceptedThrough(session) {
|
|
|
117
118
|
/**
|
|
118
119
|
* Register the incremental `dsh_session_log` request contribution when enabled.
|
|
119
120
|
* @param ctx - plugin context carrying Sessions and the DeepSeek request-extension registry.
|
|
120
|
-
* @param config - validated
|
|
121
|
+
* @param config - validated configuration.
|
|
121
122
|
*/
|
|
122
123
|
export function apply(ctx, config) {
|
|
123
124
|
if (config.enabled !== true)
|
|
@@ -131,10 +132,12 @@ export function apply(ctx, config) {
|
|
|
131
132
|
if (session === undefined)
|
|
132
133
|
return undefined;
|
|
133
134
|
const afterSeq = acceptedThrough(session);
|
|
135
|
+
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
|
|
134
136
|
const snapshot = session.snapshotEvents();
|
|
135
137
|
const throughSeq = snapshot.at(-1)?.seq;
|
|
136
138
|
if (throughSeq === undefined)
|
|
137
139
|
return undefined;
|
|
140
|
+
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
|
|
138
141
|
const suffix = session.snapshotEvents(SessionLogOffset(afterSeq + 1));
|
|
139
142
|
const value = {
|
|
140
143
|
version: 1,
|
package/lib/types/invariant.js
CHANGED
|
@@ -35,6 +35,7 @@ function validateDeliveryAccepted(session, event, fail) {
|
|
|
35
35
|
}
|
|
36
36
|
/** Validate acceptance watermarks already present in one Session. */
|
|
37
37
|
function validateSession(session, fail) {
|
|
38
|
+
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
|
|
38
39
|
for (const event of session.snapshotEvents()) {
|
|
39
40
|
if (event.type === 'session-log-deepseek/delivery-accepted')
|
|
40
41
|
validateDeliveryAccepted(session, event, fail);
|
package/lib/types/types.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type DeepSeekSessionLogWireSurfaceOp = 'append' | {
|
|
|
23
23
|
/**
|
|
24
24
|
* One canonical event translated to raw JSON primitives for upload. Surface
|
|
25
25
|
* events require an operation; system, user, and tool events may cite sources.
|
|
26
|
-
* Assistant
|
|
26
|
+
* Assistant provider metadata is embedded in its data; log-only events carry neither field.
|
|
27
27
|
*/
|
|
28
28
|
export type DeepSeekSessionLogWireEvent = {
|
|
29
29
|
[K in SessionEvent['type']]: {
|
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.6-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -37,28 +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.6-alpha.1",
|
|
41
|
+
"@deepseek-ai/dsh-util-values": "^0.1.6-alpha.1",
|
|
42
42
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.5-rc.2",
|
|
46
|
-
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
|
|
47
45
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
46
|
+
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.6-alpha.1",
|
|
47
|
+
"@deepseek-ai/dsh-invariants": "^0.1.6-alpha.1",
|
|
48
|
+
"@deepseek-ai/dsh-session": "^0.1.6-alpha.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
52
52
|
"@deepseek-ai/cordis-plugin-include": "^1.0.7",
|
|
53
53
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
54
|
-
"@deepseek-ai/dsh-command-feedback": "^0.1.
|
|
55
|
-
"@deepseek-ai/dsh-llm": "^0.1.
|
|
56
|
-
"@deepseek-ai/dsh-
|
|
57
|
-
"@deepseek-ai/dsh-
|
|
58
|
-
"@deepseek-ai/dsh-
|
|
59
|
-
"@deepseek-ai/dsh-
|
|
60
|
-
"@deepseek-ai/dsh-session": "^0.1.
|
|
61
|
-
"@deepseek-ai/dsh-
|
|
62
|
-
"@deepseek-ai/dsh-llm
|
|
54
|
+
"@deepseek-ai/dsh-command-feedback": "^0.1.6-alpha.1",
|
|
55
|
+
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.6-alpha.1",
|
|
56
|
+
"@deepseek-ai/dsh-invariants": "^0.1.6-alpha.1",
|
|
57
|
+
"@deepseek-ai/dsh-llm-mock-server": "^0.1.6-alpha.1",
|
|
58
|
+
"@deepseek-ai/dsh-message-feedback": "^0.1.6-alpha.1",
|
|
59
|
+
"@deepseek-ai/dsh-session": "^0.1.6-alpha.1",
|
|
60
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.1.6-alpha.1",
|
|
61
|
+
"@deepseek-ai/dsh-llm-deepseek": "^0.1.6-alpha.1",
|
|
62
|
+
"@deepseek-ai/dsh-llm": "^0.1.6-alpha.1"
|
|
63
63
|
}
|
|
64
64
|
}
|