mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
git mv the 12 packages from session-persistence/, session-projection/, session-title/, and telemetry/ into one session/ group per the regrouping RFC; merge the four group READMEs into one bilingual triplet; rewrite the group segment in tsconfig references (intra-group references shorten to ../<pkg>), tsconfig.base.json paths/globs, knip.json keys, vitest include, gate scripts, and authored doc/note citations; regenerate module graph, doc graphs, catalogs, and the lockfile importer keys. No npm names change. Full unit suite: 8779 passed; the 18 reported failures reproduce as env flakes (ambient-proxy IPv6 tunneling, watched-dir inotify timeouts under parallel load) — each passes in isolation with NO_PROXY set, matching their known pre-existing behavior on master.
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
/**
|
|
* Public-API synchronous Zstandard frame decoder fallback.
|
|
* @module dsh-session-persistence-jsonl/zstd-public-decoder
|
|
*/
|
|
|
|
import { zstdDecompressSync } from 'node:zlib'
|
|
import type { ZstdFrameDecoder, ZstdFrameRange } from './zstd.ts'
|
|
|
|
/** Multi-frame adapter built exclusively from Node's supported one-shot API. */
|
|
export class PublicZstdFrameDecoder implements ZstdFrameDecoder {
|
|
private started = false
|
|
private closed = false
|
|
|
|
/** @inheritdoc */
|
|
public *decode(source: Buffer, frames: readonly ZstdFrameRange[]): Generator<Buffer, void, void> {
|
|
if (this.started) throw new Error('Zstandard frame decoder was already started')
|
|
if (this.closed) throw new Error('cannot start a closed Zstandard frame decoder')
|
|
this.started = true
|
|
try {
|
|
for (const { start, end } of frames) {
|
|
let decoded: Buffer
|
|
try {
|
|
decoded = zstdDecompressSync(source.subarray(start, end))
|
|
} catch (error) {
|
|
throw new Error(`corrupt Zstandard session log: frame at byte ${start} failed validation`, {
|
|
cause: error,
|
|
})
|
|
}
|
|
yield decoded
|
|
}
|
|
} finally {
|
|
this.close()
|
|
}
|
|
}
|
|
|
|
/** @inheritdoc */
|
|
close(): void {
|
|
this.closed = true
|
|
}
|
|
}
|