@deepseek-ai/dsh-session-persistence-jsonl 0.2.1-rc.5 → 0.2.2-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
@@ -30,8 +30,8 @@
30
30
  en: 96498792672f6d50
31
31
  zh: d767a9c69dced889
32
32
  /deepseek-ai-dsh-session-persistence-jsonl/use-this-package/reading-the-logs:
33
- en: 3e53fc90a486d373
34
- zh: 00e6c6e65c56629e
33
+ en: 4cec8a6c9f6e488b
34
+ zh: 4757440a552db5e3
35
35
  /deepseek-ai-dsh-session-persistence-jsonl/understand-the-implementation:
36
36
  en: a35407bb25671e7e
37
37
  zh: 6a00f9510c85adcb
package/README.md CHANGED
@@ -82,7 +82,7 @@ Unloading the backend waits for the consumer unloads it triggers through `sessio
82
82
 
83
83
  ### Reading the logs
84
84
 
85
- Materialized `stat` and `list` snapshots include the format catalog's header classification as `formatStatus`, alongside the translated logical `header`. A read-only preparation leaves the selected historical version unchanged; the status becomes `current` after publication of the successor. Unmaterialized pending Sessions omit `formatStatus`.
85
+ Materialized `stat` and `list` snapshots include the format catalog's header classification as `formatStatus`, alongside the translated logical `header`. They also include `location: { kind: 'jsonl', path }` for the selected physical generation. A read-only preparation leaves the selected historical version unchanged; the status becomes `current` after publication of the successor. Unmaterialized pending Sessions omit `formatStatus` and `location`.
86
86
 
87
87
  `open(id, 'read'|'write')` selects the highest canonical generation. Current input follows the ordinary fast path. For historical input, a read open decodes and migrates the source once, validates the current logical result, and returns it without publishing a successor. A write open reuses that revision-keyed preparation when available, or performs the same preparation, then encodes a same-directory temporary file in bounded chunks, verifies it in a Worker Thread, rechecks the source revision, and publishes the current successor without overwrite before returning. The source remains byte-identical. Source drift after preparation rejects that write open without replacing the logical history already returned to readers; a later write open prepares the new revision. The backend marks decoded event graphs `shared-frozen` when it freezes them before memoization; every nested object and array is frozen, and handle reads and slices preserve that state, including empty slices. Only an unmaterialized pending log reports `detached`. `stat(id)` and `list()` select and translate only the highest generation header without reading event rows or starting migration; snapshots carry the selected file’s `sizeBytes` and a best-effort revision. Current revisions identify that file; historical revisions also fingerprint the selected files across the persistence root, so child changes invalidate cached logical events. Fingerprinting reads filesystem metadata only; unrelated changes conservatively invalidate historical revisions. One `list()` call shares a corpus fingerprint across its historical entries. With `compression: 'none'`, the log is newline-delimited text an external reader can consume directly; the compressed default must be read through the backend.
88
88
 
package/README.zh.md CHANGED
@@ -82,7 +82,7 @@ kind: "package-reference"
82
82
 
83
83
  ### 读取日志
84
84
 
85
- 已实体化的 `stat` 与 `list` 快照在转换后的逻辑 `header` 之外,通过 `formatStatus` 保留格式 catalog 的头部分类。只读准备不会改变所选历史版本;发布后继之后,状态才变为 `current`。尚未实体化的待定 Session 省略 `formatStatus`。
85
+ 已实体化的 `stat` 与 `list` 快照在转换后的逻辑 `header` 之外,通过 `formatStatus` 保留格式 catalog 的头部分类。它们还包含选中物理 generation 的 `location: { kind: 'jsonl', path }`。只读准备不会改变所选历史版本;发布后继之后,状态才变为 `current`。尚未实体化的待定 Session 省略 `formatStatus` 与 `location`。
86
86
 
87
87
  `open(id, 'read'|'write')` 选择最高规范 generation。当前格式输入走普通快速路径。对于历史输入,只读 open 会单遍解码并迁移源、校验当前逻辑结果,然后在不发布后继的情况下返回。写 open 会在可用时复用按 revision 为键的 preparation,否则执行同一套 preparation,再按有界分片编码同目录临时文件、在 Worker Thread 中校验、复查源修订,并在返回前以不覆盖方式发布当前后继。源保持逐字节不变。如果源在 preparation 后发生变化,该次写 open 会失败,已经返回给读方的逻辑历史不会被替换;后续写 open 会针对新的 revision 重新执行 preparation。后端在 memo 化前冻结已解码的 event graph,并在此时将其标记为 `shared-frozen`;每个嵌套对象和数组都会冻结,句柄读取和 slice 即使为空也保留该状态。只有尚未实体化的 pending 空日志报告 `detached`。`stat(id)` 与 `list()` 只选择并转换最高 generation 的 header,不读取事件行,也不启动迁移;快照携带所选文件的 `sizeBytes` 与尽力而为的修订号。当前格式修订号标识该文件;历史格式修订号还包含持久化根目录中所选文件的指纹,因此子日志变化会使缓存的逻辑事件失效。指纹只读取文件系统元数据;无关变化也会保守地使历史修订号失效。一次 `list()` 为其历史条目共用一个全库指纹。选择 `compression: 'none'` 后,日志是外部读取方可直接消费的换行分隔文本;压缩默认值必须经后端读取。
88
88
 
package/lib/index.js CHANGED
@@ -1146,7 +1146,7 @@ function privateZstdStream(stream) {
1146
1146
  const candidate = stream;
1147
1147
  const handle = candidate._handle;
1148
1148
  const errorKey = Reflect.ownKeys(stream).find((key) => typeof key === "symbol" && key.description === "kError");
1149
- /* v8 ignore next -- one test runtime exposes one Node-private shape; the Node 22/24/26 matrix checks compatibility. */
1149
+ /* v8 ignore next -- one test runtime exposes one Node-private shape; the Node 24/26 matrix checks compatibility. */
1150
1150
  if (typeof handle !== "object" || handle === null || typeof handle.writeSync !== "function" || !(candidate._writeState instanceof Uint32Array) || candidate._writeState.length < 2 || typeof candidate._defaultFlushFlag !== "number" || errorKey === void 0 || candidate[errorKey] !== null) return void 0;
1151
1151
  return {
1152
1152
  stream,
@@ -1383,7 +1383,7 @@ async function decompressZstdFrame(input) {
1383
1383
  return zstdDecompressAsync(input);
1384
1384
  }
1385
1385
  /**
1386
- * Select the shared private decoder when the running Node 22/24/26 shape is
1386
+ * Select the shared private decoder when the running Node 24/26 shape is
1387
1387
  * compatible, otherwise preserve correctness with the public one-shot API.
1388
1388
  * @returns a synchronous decoder with an implementation-independent lifecycle.
1389
1389
  */
@@ -2586,7 +2586,11 @@ var JsonlSessionPersistence = class extends SessionPersistence {
2586
2586
  return {
2587
2587
  ...metadata,
2588
2588
  revision: selected.sourceVersion < SESSION_FORMAT_VERSION ? SessionPersistenceRevision(`${fileRevision(identity)}:${await this.historicalCorpusRevision(options?.signal)}`) : fileRevision(identity),
2589
- sizeBytes: Number(identity.size)
2589
+ sizeBytes: Number(identity.size),
2590
+ location: {
2591
+ kind: "jsonl",
2592
+ path: selected.sourcePath
2593
+ }
2590
2594
  };
2591
2595
  } catch (error) {
2592
2596
  options?.signal?.throwIfAborted();
@@ -2630,7 +2634,11 @@ var JsonlSessionPersistence = class extends SessionPersistence {
2630
2634
  header: artifact.header,
2631
2635
  formatStatus: artifact.formatStatus,
2632
2636
  revision: artifact.sourceVersion < SESSION_FORMAT_VERSION ? SessionPersistenceRevision(`${fileRevision(identity)}:${corpusRevision}`) : fileRevision(identity),
2633
- sizeBytes: Number(identity.size)
2637
+ sizeBytes: Number(identity.size),
2638
+ location: {
2639
+ kind: "jsonl",
2640
+ path: artifact.path
2641
+ }
2634
2642
  });
2635
2643
  }
2636
2644
  for (const [id, entry] of pending) if (!listed.has(id)) snapshots.push({
@@ -52,7 +52,7 @@ export interface ZstdFrameDecoder {
52
52
  close(): void;
53
53
  }
54
54
  /**
55
- * Select the shared private decoder when the running Node 22/24/26 shape is
55
+ * Select the shared private decoder when the running Node 24/26 shape is
56
56
  * compatible, otherwise preserve correctness with the public one-shot API.
57
57
  * @returns a synchronous decoder with an implementation-independent lifecycle.
58
58
  */