hy-sde/dsh-zstd-frame--packages-zstd-frame ↗★ 0
@hy-sde-org/dsh-zstd-frame
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. 适合需要处理会话持久化与项目记忆库中的Zstandard压缩数据的开发者。
インストール
検証済み bundle がないか、互換性チェックに失敗しています。先にリポジトリの説明を読んでください。 README 全文を読む ↗
ドキュメント
README 全文を読む ↗@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()—NodePrivateZstdFrameDecoderwhen the running Node shape is compatible, elsePublicZstdFrameDecoder; both implement the commonZstdFrameDecoderinterface (decode(source, frames)generator +close()).
Known Limitations and Deferred Work
- The private-handle decoder (
NodePrivateZstdFrameDecoder) depends on the privatezlib._handle.writeSyncshape, which the public Node API does not document; the decoder feature-probes at load and falls back to the one-shot-basedPublicZstdFrameDecoderwhen 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), anddecompressZstdPrefixdeliberately suppresses final-frame/checksum completion — callers must establish the torn boundary themselves before using it.
The optional ./invariant entry registers the package into a Cordis host's
ctx.invariants service (no-op) and needs @deepseek-ai/cordis +
@deepseek-ai/dsh-invariants peers only when you use that entry.
License
MIT. Derived from the DeepSeek Harness codebase; see
THIRD-PARTY-NOTICES.md for provenance.