fix(skills): stabilize compression across zlib versions

This commit is contained in:
Jinwoo-H
2026-08-11 11:37:26 -04:00
parent 6123082fa3
commit 568e66d801
2 changed files with 3 additions and 3 deletions
@@ -125,7 +125,7 @@ describe('skill package creation and extraction', () => {
archiveSha256: created.archiveSha256,
packageDigest: created.manifest.packageDigest
}).toEqual({
archiveSha256: '4a62b276b1e8100f0b437f2f0aa182d844768160ba30c5f76afd027acfe50ac8',
archiveSha256: '2abf449e92650f03b749631547c22e0f28facf6da9c36f0e77d6f8cc7df8e47a',
packageDigest: '3bb1fc63cfea2f2b7f2cf80e539735eebd5bfb6aa65f47cf0db7e9fd35297f57'
})
})
+2 -2
View File
@@ -4,7 +4,7 @@ import { once } from 'node:events'
import type { Readable, Writable } from 'node:stream'
import { Transform } from 'node:stream'
import { pipeline } from 'node:stream/promises'
import { createGunzip, createGzip } from 'node:zlib'
import { constants as zlibConstants, createGunzip, createGzip } from 'node:zlib'
import { SKILL_PACKAGE_MAX_COMPRESSED_BYTES } from '../../shared/skill-package-manifest'
const TAR_BLOCK_BYTES = 512
@@ -103,7 +103,7 @@ export async function writeSkillTarGzip(
): Promise<{ archiveSha256: string; compressedBytes: number }> {
const archiveHash = createHash('sha256')
let compressedBytes = 0
const gzip = createGzip({ level: 9 })
const gzip = createGzip({ level: 9, strategy: zlibConstants.Z_FIXED })
const hashTransform = new Transform({
transform(chunk: Buffer, _encoding, callback) {
compressedBytes += chunk.length