@hy-sde-org/dsh-zstd-frame

中文文档
0.2.1-rc.5发布于 2026/11/01MITTypeScriptES Module零依赖

Zstandard frame primitives (scan / compress / decompress / multi-frame decoder) shared by the DeepSeek Harness session persistence backend and project memory bank, as a standalone npm package.

原始使用文档
文档目录3 节
  1. API
  2. Known Limitations and Deferred Work
  3. License

@hy-sde-org/dsh-zstd-frame

Zstandard frame primitives shared by the DeepSeek Harness session persistence backend (session.jsonl.zstd) and the project memory bank (bank.jsonl.zstd). Both store append-only, checksummed, per-batch zstd frames; this package owns the structural scan, the one-shot compress / decompress API with checksum, torn-frame recovery, and the interchangeable multi-frame decoders, so consumers never reimplement frame layout or Node-private decoder lifecycle.

Published standalone as @hy-sde-org/dsh-zstd-frame; it mirrors @deepseek-ai/dsh-zstd-frame in the hy-sde deepseek-harness fork.

Backed entirely by node:zlib — no native module, works in-process.

API

import {
  compressZstdFrame,
  decompressZstdFrame,
  decompressZstdFrameSync,
  decompressZstdPrefix,
  scanZstdFrames,
  createZstdFrameDecoder,
} from '@hy-sde-org/dsh-zstd-frame'
  • scanZstdFrames(buffer, maxFrames?) → { frames: ZstdFrameRange[], tornStart? } — locate complete frames without decompressing their blocks; EOF inside the final frame returns its start for repair.
  • compressZstdFrame(input) — one independently decodable, checksummed frame.
  • decompressZstdFrame(input, maxOutput?) / decompressZstdFrameSync(...) — one-frame decompression with optional plaintext bound.
  • decompressZstdPrefix(input) — recover available plaintext from a structurally incomplete final frame.
  • createZstdFrameDecoder() — NodePrivateZstdFrameDecoder when the running Node shape is compatible, else PublicZstdFrameDecoder; both implement the common ZstdFrameDecoder interface (decode(source, frames) generator + close()).

Known Limitations and Deferred Work

  • The private-handle decoder (NodePrivateZstdFrameDecoder) depends on the private zlib._handle.writeSync shape, which the public Node API does not document; the decoder feature-probes at load and falls back to the one-shot-based PublicZstdFrameDecoder when the shape is incompatible, so correctness never depends on private internals.
  • No streaming incremental compressor; frames are written whole per batch.
  • Only checksummed frames are produced by compressZstdFrame (ZSTD_c_checksumFlag), and decompressZstdPrefix deliberately suppresses final-frame/checksum completion — callers must establish the torn boundary themselves before using it.

License

MIT. Derived from the DeepSeek Harness codebase; see THIRD-PARTY-NOTICES.md for provenance.

版本与发布记录

@hy-sde-org/dsh-zstd-frame 共发布 10 个版本,首次发布于 2026/08/26;过去 12 个月发布了 10 个版本。

版本发布日期距今
0.2.1-rc.5latest2026/11/012 天前
0.2.1-rc.32026/10/259 天前
0.2.1-alpha.42026/10/1618 天前
0.2.1-alpha.22026/10/1321 天前
0.2.0-rc.22026/10/011 个月前
0.1.7-rc.22026/09/291 个月前

关于 @hy-sde-org/dsh-zstd-frame 的常见问题

@hy-sde-org/dsh-zstd-frame 是什么?

由DeepSeek Harness会话持久性后端和项目内存库共享的标准帧原语(扫描/压缩/解压/多帧解码器),作为一个独立的npm包。

如何安装 @hy-sde-org/dsh-zstd-frame?

在项目目录运行 npm install @hy-sde-org/dsh-zstd-frame,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@deepseek-ai/cordis(~4.0.5)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@hy-sde-org/dsh-zstd-frame 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@hy-sde-org/dsh-zstd-frame 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@hy-sde-org/dsh-zstd-frame 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.19.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@hy-sde-org/dsh-zstd-frame 可以商用吗?

@hy-sde-org/dsh-zstd-frame 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@hy-sde-org/dsh-zstd-frame 还在维护吗?

最新版本 0.2.1-rc.5 发布于 2026/11/01(2 天前);至今共发布 10 个版本,其中过去 12 个月发布了 10 个;首次发布于 2026/08/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。