@deepseek-ai/dsh-session-log-deepseek 0.2.1-alpha.1 → 0.2.1-alpha.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 CHANGED
@@ -18,8 +18,8 @@
18
18
  en: 1b899e63d8039643
19
19
  zh: d489461bbb618b5d
20
20
  /deepseek-ai-dsh-session-log-deepseek/request-field:
21
- en: 197814e2c48d05b5
22
- zh: f4616fb23a3c7a32
21
+ en: 65795dc44af4b15e
22
+ zh: 849c7d57f16f66af
23
23
  /deepseek-ai-dsh-session-log-deepseek/acceptance-and-retry:
24
24
  en: 3688592c474b3e95
25
25
  zh: 5e83afeb9aa9e9e3
package/README.md CHANGED
@@ -39,7 +39,7 @@ The Web **Settings → General → Upload Session Log when using the official mo
39
39
 
40
40
  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 longest contiguous run after the watermark that fits `maxBytes`. 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.
41
41
 
42
- `maxBytes` bounds the complete serialized field in UTF-8 bytes, including the header and numeric envelope fields. A backlog above the limit drains across consecutive accepted requests, each continuing after the previous `throughSeq`. When the first pending event alone exceeds the limit, the request omits `dsh_session_log`, the plugin logs a warning, and the watermark stays before that event until `maxBytes` admits it. An event too large for the runtime to serialize at all is handled the same way, and no `maxBytes` value admits it.
42
+ `maxBytes` bounds the complete serialized field in UTF-8 bytes, including the header and numeric envelope fields. A backlog above the limit drains across consecutive accepted requests, each continuing after the previous `throughSeq`. When the first pending event alone exceeds the limit, the request omits `dsh_session_log`, the plugin logs one warning per blocking event, and the watermark stays before that event until `maxBytes` admits it. An event too large for the runtime to serialize at all is handled the same way, and no `maxBytes` value admits it.
43
43
 
44
44
  <a id="acceptance-and-retry"></a>
45
45
  ## Acceptance and retry
package/README.zh.md CHANGED
@@ -39,7 +39,7 @@ Web **设置 → 通用 → 在使用官方模型 API 时上传 Session Log**
39
39
 
40
40
  对于携带存活 `sessionId` 的请求,插件会折叠该确切会话格式代的最大已接受水位,对 `Session.events` 取快照,并发送水位之后能放进 `maxBytes` 的最长连续事件段。进程内 fold 会让每条事件只被扫描一次并增量消费后续追加;重启与 HMR(热模块替换)会从持久日志重建它。版本 1 字段包含 `sessionFormatVersion`、原始会话 header(仅 seeded Session 携带 `seedLength`)、数值型 `afterSeq` 与 `throughSeq`,以及每个已转换为原始数值 envelope 字段的完整规范事件。只有记录的会话 id 与格式代均匹配请求来源时水位才生效,因此 fork 会话会忽略从父会话继承的水位。表层事件必须携带 `surfaceOp`,替换范围使用数值型 `startSeq` 与 `endSeq`;仅 system、user 与 tool 事件可以携带 `sourceEventSeqs`。assistant 的提供方元数据保留在内嵌流中,只出现在日志中的事件不携带这两个元数据字段。
41
41
 
42
- `maxBytes` 按 UTF-8 字节限制完整的序列化字段,包括 header 与数值型 envelope 字段。超过上限的积压会分多次已接受的请求补传,每次都从上一次的 `throughSeq` 之后继续。第一条待发事件本身就超过上限时,请求会省略 `dsh_session_log`,插件记录一条告警,水位停在该事件之前,直到 `maxBytes` 能容纳它。运行时根本无法序列化的超大事件也按同样方式处理,且任何 `maxBytes` 都无法容纳它。
42
+ `maxBytes` 按 UTF-8 字节限制完整的序列化字段,包括 header 与数值型 envelope 字段。超过上限的积压会分多次已接受的请求补传,每次都从上一次的 `throughSeq` 之后继续。第一条待发事件本身就超过上限时,请求会省略 `dsh_session_log`,插件对每个阻塞事件只记录一次告警,水位停在该事件之前,直到 `maxBytes` 能容纳它。运行时根本无法序列化的超大事件也按同样方式处理,且任何 `maxBytes` 都无法容纳它。
43
43
 
44
44
  <a id="acceptance-and-retry"></a>
45
45
  ## 接受与重试
package/lib/index.js CHANGED
@@ -19,6 +19,8 @@ const Config = z.object({
19
19
  maxBytes: z.number().step(1).min(1).default(8 * 1024 * 1024)
20
20
  });
21
21
  const acceptanceFolds = /* @__PURE__ */ new WeakMap();
22
+ /** Event each Session's upload was last reported blocked at; a block is logged once. */
23
+ const blockedWarnings = /* @__PURE__ */ new WeakMap();
22
24
  /** Translate logical Session metadata to raw external request fields. */
23
25
  function wireHeader(session) {
24
26
  const header = session.header;
@@ -165,7 +167,8 @@ function apply(ctx, config) {
165
167
  const last = events.length === 0 ? void 0 : pending[events.length - 1];
166
168
  if (last === void 0) {
167
169
  const first = pending[0];
168
- if (first !== void 0) {
170
+ if (first !== void 0 && blockedWarnings.get(session) !== first.seq) {
171
+ blockedWarnings.set(session, first.seq);
169
172
  const seq = String(first.seq);
170
173
  ctx.logger.warn(Number.isFinite(candidateBytes) ? `session-log-deepseek: event ${seq} of session "${session.id}" needs a ${String(candidateBytes)}-byte dsh_session_log field, above maxBytes ${String(maxBytes)}; this session's upload stays at event ${seq} until maxBytes admits it` : `session-log-deepseek: event ${seq} of session "${session.id}" is too large to serialize into a dsh_session_log field; this session's upload stays at event ${seq}`);
171
174
  }
@@ -18,6 +18,8 @@ export const Config = z.object({
18
18
  maxBytes: z.number().step(1).min(1).default(8 * 1024 * 1024),
19
19
  });
20
20
  const acceptanceFolds = new WeakMap();
21
+ /** Event each Session's upload was last reported blocked at; a block is logged once. */
22
+ const blockedWarnings = new WeakMap();
21
23
  /** Translate logical Session metadata to raw external request fields. */
22
24
  function wireHeader(session) {
23
25
  const header = session.header;
@@ -177,7 +179,8 @@ export function apply(ctx, config) {
177
179
  const last = events.length === 0 ? undefined : pending[events.length - 1];
178
180
  if (last === undefined) {
179
181
  const first = pending[0];
180
- if (first !== undefined) {
182
+ if (first !== undefined && blockedWarnings.get(session) !== first.seq) {
183
+ blockedWarnings.set(session, first.seq);
181
184
  const seq = String(first.seq);
182
185
  ctx.logger.warn(Number.isFinite(candidateBytes)
183
186
  ? `session-log-deepseek: event ${seq} of session "${session.id}" needs a ${String(candidateBytes)}-byte`
package/locale/en.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "session-log-deepseek"
4
+ }
5
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "DeepSeek 会话日志上传",
4
+ "description": "启用后,随官方模型 API 请求向 DeepSeek 上传会话日志。"
5
+ }
6
+ }
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.2.1-alpha.1",
4
+ "version": "0.2.1-alpha.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -23,36 +23,38 @@
23
23
  "default": "./lib/types/types.js"
24
24
  },
25
25
  "./src/*": "./src/*",
26
- "./package.json": "./package.json"
26
+ "./package.json": "./package.json",
27
+ "./locale/*.json": "./locale/*.json"
27
28
  },
28
29
  "files": [
30
+ "locale/*.json",
29
31
  "lib/index.js",
30
32
  "lib/types/**/*.js",
31
33
  "lib/types/**/*.d.ts"
32
34
  ],
33
35
  "license": "MIT",
34
36
  "dependencies": {
35
- "@deepseek-ai/dsh-util-values": "0.2.1-alpha.1",
36
- "@deepseek-ai/dsh-brand": "0.2.1-alpha.1",
37
- "@deepseek-ai/schemastery": "~3.18.5-alpha.1"
37
+ "@deepseek-ai/dsh-brand": "0.2.1-alpha.3",
38
+ "@deepseek-ai/dsh-util-values": "0.2.1-alpha.3",
39
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.2"
38
40
  },
39
41
  "peerDependencies": {
40
- "@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.1-alpha.1",
41
- "@deepseek-ai/cordis": "~4.0.5-alpha.1",
42
- "@deepseek-ai/dsh-session": "0.2.1-alpha.1"
42
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2",
43
+ "@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.1-alpha.3",
44
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.3"
43
45
  },
44
46
  "devDependencies": {
45
- "@deepseek-ai/cordis": "~4.0.5-alpha.1",
46
- "@deepseek-ai/cordis-plugin-include": "~1.0.10-alpha.1",
47
- "@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.1",
48
- "@deepseek-ai/dsh-command-feedback": "0.2.1-alpha.1",
49
- "@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.1-alpha.1",
50
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
51
- "@deepseek-ai/dsh-llm-deepseek": "0.2.1-alpha.1",
52
- "@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.1-alpha.1",
53
- "@deepseek-ai/dsh-llm-mock-server": "0.2.1-alpha.1",
54
- "@deepseek-ai/dsh-session": "0.2.1-alpha.1",
55
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-alpha.1",
56
- "@deepseek-ai/dsh-message-feedback": "0.2.1-alpha.1"
47
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2",
48
+ "@deepseek-ai/cordis-plugin-include": "~1.0.10-alpha.2",
49
+ "@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.2",
50
+ "@deepseek-ai/dsh-command-feedback": "0.2.1-alpha.3",
51
+ "@deepseek-ai/dsh-deepseek-llm-api-extensions": "0.2.1-alpha.3",
52
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
53
+ "@deepseek-ai/dsh-llm-deepseek": "0.2.1-alpha.3",
54
+ "@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.1-alpha.3",
55
+ "@deepseek-ai/dsh-llm-mock-server": "0.2.1-alpha.3",
56
+ "@deepseek-ai/dsh-message-feedback": "0.2.1-alpha.3",
57
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.3",
58
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-alpha.3"
57
59
  }
58
60
  }