@x1a0f3n9/dsh-session-log-deepseek 0.1.5-alpha.2 → 0.1.5-rc.3
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 +1 -1
- package/README.zh.md +7 -7
- package/lib/types/index.js +3 -0
- package/lib/types/invariant.js +1 -0
- package/package.json +15 -15
package/README.i18n.yaml
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
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
5
|
README.md: 38a5ec64cee32c25b11e5b7c0b55b7302f66952a
|
|
6
|
-
README.zh.md:
|
|
6
|
+
README.zh.md: 2764b3d14ed5a98e140e43583c94424b527065e0
|
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
|
|
|
@@ -34,12 +34,12 @@ kind: "package-reference"
|
|
|
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`;仅 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,9 +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
|
-
-
|
|
69
|
+
- **崩溃窗口重复**——2xx 后、接受水位持久化前进程终止,会在恢复时触发保守重放。
|
|
70
|
+
- **缺少存活会话就没有字段**——直接调用或陈旧会话调用没有可供快照的规范日志;显式缺失语义仍暂缓处理。
|
|
71
|
+
- **没有独立请求大小上限**——完整交付采用 fail-closed 策略;提供方拒绝会保持游标不变,而非截断日志。
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
<a id="dev-note"></a>
|
package/lib/types/index.js
CHANGED
|
@@ -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)}`);
|
|
@@ -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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x1a0f3n9/dsh-session-log-deepseek",
|
|
3
3
|
"description": "Incremental lossless session-log request extension for the official DeepSeek LLM API",
|
|
4
|
-
"version": "0.1.5-
|
|
4
|
+
"version": "0.1.5-rc.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -37,28 +37,28 @@
|
|
|
37
37
|
],
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@x1a0f3n9/dsh-brand": "^0.1.5-
|
|
41
|
-
"@x1a0f3n9/dsh-util-values": "^0.1.5-
|
|
40
|
+
"@x1a0f3n9/dsh-brand": "^0.1.5-rc.3",
|
|
41
|
+
"@x1a0f3n9/dsh-util-values": "^0.1.5-rc.3",
|
|
42
42
|
"@deepseek-ai/schemastery": "^3.18.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
46
|
-
"@x1a0f3n9/dsh-deepseek-llm-api-extensions": "^0.1.5-
|
|
47
|
-
"@x1a0f3n9/dsh-invariants": "^0.1.5-
|
|
48
|
-
"@x1a0f3n9/dsh-session": "^0.1.5-
|
|
46
|
+
"@x1a0f3n9/dsh-deepseek-llm-api-extensions": "^0.1.5-rc.3",
|
|
47
|
+
"@x1a0f3n9/dsh-invariants": "^0.1.5-rc.3",
|
|
48
|
+
"@x1a0f3n9/dsh-session": "^0.1.5-rc.3"
|
|
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
|
-
"@x1a0f3n9/dsh-command-feedback": "^0.1.5-
|
|
55
|
-
"@x1a0f3n9/dsh-deepseek-llm-api-extensions": "^0.1.5-
|
|
56
|
-
"@x1a0f3n9/dsh-invariants": "^0.1.5-
|
|
57
|
-
"@x1a0f3n9/dsh-llm": "^0.1.5-
|
|
58
|
-
"@x1a0f3n9/dsh-llm-deepseek": "^0.1.5-
|
|
59
|
-
"@x1a0f3n9/dsh-llm-mock-server": "^0.1.5-
|
|
60
|
-
"@x1a0f3n9/dsh-message-feedback": "^0.1.5-
|
|
61
|
-
"@x1a0f3n9/dsh-session": "^0.1.5-
|
|
62
|
-
"@x1a0f3n9/dsh-session-persistence-jsonl": "^0.1.5-
|
|
54
|
+
"@x1a0f3n9/dsh-command-feedback": "^0.1.5-rc.3",
|
|
55
|
+
"@x1a0f3n9/dsh-deepseek-llm-api-extensions": "^0.1.5-rc.3",
|
|
56
|
+
"@x1a0f3n9/dsh-invariants": "^0.1.5-rc.3",
|
|
57
|
+
"@x1a0f3n9/dsh-llm": "^0.1.5-rc.3",
|
|
58
|
+
"@x1a0f3n9/dsh-llm-deepseek": "^0.1.5-rc.3",
|
|
59
|
+
"@x1a0f3n9/dsh-llm-mock-server": "^0.1.5-rc.3",
|
|
60
|
+
"@x1a0f3n9/dsh-message-feedback": "^0.1.5-rc.3",
|
|
61
|
+
"@x1a0f3n9/dsh-session": "^0.1.5-rc.3",
|
|
62
|
+
"@x1a0f3n9/dsh-session-persistence-jsonl": "^0.1.5-rc.3"
|
|
63
63
|
}
|
|
64
64
|
}
|