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.
40 lines
1.9 KiB
TypeScript
40 lines
1.9 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
compressZstdFrame, createZstdFrameDecoder, decompressZstdFrame, decompressZstdPrefix, scanZstdFrames,
|
|
} from '../src/zstd.ts'
|
|
import { NodePrivateZstdFrameDecoder } from '../src/zstd-private-decoder.ts'
|
|
import { PublicZstdFrameDecoder } from '../src/zstd-public-decoder.ts'
|
|
|
|
describe('JSONL Zstandard compatibility', () => {
|
|
it('round-trips concatenated checksummed frames through the built-in Node API', async () => {
|
|
const encoded = Buffer.concat([
|
|
await compressZstdFrame('{"type":"session","version":0,"id":"compat","createdAt":1}\n'),
|
|
await compressZstdFrame('{"type":"turn/start","seq":0,"turn":1}\n'),
|
|
])
|
|
const { frames, tornStart } = scanZstdFrames(encoded)
|
|
|
|
expect(tornStart).toBeUndefined()
|
|
expect(frames).toHaveLength(2)
|
|
expect(frames.map(frame => encoded.subarray(frame.start, frame.start + 4).toString('hex')))
|
|
.toEqual(['28b52ffd', '28b52ffd'])
|
|
const decoded = await Promise.all(frames.map(frame => decompressZstdFrame(encoded.subarray(frame.start, frame.end))))
|
|
expect(Buffer.concat(decoded).toString()).toContain('"type":"turn/start"')
|
|
|
|
const preferred = createZstdFrameDecoder()
|
|
expect(preferred).toBeInstanceOf(NodePrivateZstdFrameDecoder)
|
|
for (const decoder of [preferred, new PublicZstdFrameDecoder()]) {
|
|
try {
|
|
const plaintext = Array.from(decoder.decode(encoded, frames), chunk => Buffer.from(chunk))
|
|
expect(Buffer.concat(plaintext).toString()).toContain('"type":"turn/start"')
|
|
} finally {
|
|
decoder.close()
|
|
}
|
|
}
|
|
|
|
const eventFrame = encoded.subarray(frames[1]!.start, frames[1]!.end)
|
|
const missingChecksumByte = eventFrame.subarray(0, -1)
|
|
expect(scanZstdFrames(missingChecksumByte)).toEqual({ frames: [], tornStart: 0 })
|
|
expect((await decompressZstdPrefix(missingChecksumByte)).toString()).toContain('"type":"turn/start"')
|
|
})
|
|
})
|