Files
deepseek-harness/packages/experimental/webworker-packer/src/transform-image.ts
T
imccyu f47b1ecac2 feat(webworker): browser worker host runtime and the vfs image packer
Two private experimental packages run the whole harness tree inside one
dedicated Web Worker. dsh-experimental-webworker-runtime owns the in-memory
VFS (BigInt stats with per-path identity and strictly increasing mtimes),
the CommonJS wrapper loader over a lazily-evaluated builtin table whose
shims typecheck against Node's own module types, the postMessage tunnel
speaking plain HTTP, the AsyncLocalStorage runtime, and the worker
assembly. dsh-experimental-webworker-packer lowers every module body at
pack time against the shared wrapper contract, sweeps the profile closure
by static reachability, and writes a deterministically gzip-compressed tar
the worker inflates through the browser's native DecompressionStream while
it downloads.
2026-08-21 20:35:32 +08:00

27 lines
1.1 KiB
TypeScript

/**
* The wrapper contract packed bodies are emitted against, and the image-entry
* types the pack pass consumes.
*
* One transform serves both sides — the pack pass lowers with the runtime's
* own `lowerModuleSource`, never a reimplementation — and the image records
* the contract version it was lowered against. Bodies emitted against a
* different wrapper contract are refused at mount time rather than
* half-working at run time.
* @module @deepseek-ai/dsh-experimental-webworker-packer/src/transform-image
*/
import { LOWERING_VERSION } from '@deepseek-ai/dsh-experimental-webworker-runtime'
/** Image entries, keyed by their path relative to the virtual root. */
export type ImageFiles = Record<string, Uint8Array>
/** Wrapper contract the packed bodies are emitted against. */
export const WRAPPER_CONTRACT: string = LOWERING_VERSION
/** What one pack-time transform pass did. */
export interface TransformOutcome {
/** JavaScript entries visited. */
readonly visited: number
/** How many changed; the rest were already in final form. */
readonly rewritten: number
}