Files
Ewen 6978302ed5 feat(notebook): v4 runtime registry — persistent kernels, bindings, offline provisioning, crash recovery (#223)
Redesigns the notebook runtime subsystem around a v4 runtime registry: persistent multi-kernel execution, a per-session binding as the single source of truth, offline provisioning, disable/drain lifecycle, and crash-recoverable operation journaling. Includes review-hardening for the operation journal, tri-state crash-recovery liveness, unknown-orphan prefix blocking, unified binding gates, cache locking, and pinned+verified micromamba. Known follow-ups documented in the PR.
2026-07-20 23:06:23 +08:00

23 lines
798 B
JavaScript

/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { compress, init as initZstd } from '@bokuweb/zstd-wasm'
import { c as createTar } from 'tar'
import { writeFile } from 'node:fs/promises'
/** @type {Promise<void> | undefined} */
let zstdReady
/** @returns {Promise<void>} */
const ensureZstd = () => {
zstdReady ??= initZstd()
return zstdReady
}
/** @param {string} sourceDir @param {string} archivePath @returns {Promise<void>} */
export const createPackArchive = async (sourceDir, archivePath) => {
await ensureZstd()
const stream = createTar({ cwd: sourceDir, portable: true }, ['.'])
const chunks = []
for await (const chunk of stream) chunks.push(Buffer.from(chunk))
await writeFile(archivePath, Buffer.from(compress(Buffer.concat(chunks), 10)))
}