wasm-posix-host
    Preparing search index...

    Interface NodeKernelHostOptions

    interface NodeKernelHostOptions {
        dataBufferSize?: number;
        defaultThreadSlots?: number;
        enableTcpNetwork?: boolean;
        execPrograms?: Record<string, string>;
        extraMounts?: {
            gid?: number;
            hostPath: string;
            mountPoint: string;
            readonly?: boolean;
            uid?: number;
        }[];
        maxPages?: number;
        maxProcessMemoryBytes?: number;
        maxWorkers?: number;
        onHostDiagnostic?: (diagnostic: HostDiagnostic) => void;
        onLazyDownload?: (event: LazyDownloadEvent) => void;
        onProcessEvent?: (
            event: {
                exitStatus?: number;
                kind: "exit" | "spawn" | "exec";
                pid: number;
                ppid?: number;
            },
        ) => void;
        onPtyOutput?: (pid: number, data: Uint8Array) => void;
        onResolveExec?: (
            path: string,
        ) => ArrayBuffer | Promise<ArrayBuffer | null> | null;
        onStderr?: (pid: number, data: Uint8Array) => void;
        onStdout?: (pid: number, data: Uint8Array) => void;
        rootfsImage?: ArrayBuffer | Uint8Array<ArrayBufferLike> | "default";
        rootfsLazyAssets?: readonly ClosedLazyAsset[];
        rootfsLazyUrlBase?: string;
    }
    Index

    Properties

    dataBufferSize?: number

    Size of the data buffer for syscall data transfer (default: 65536). Increase for programs that do large pwrite() calls (e.g. InnoDB).

    defaultThreadSlots?: number

    Host default pthread slots when a wasm binary declares -1 (default: 16).

    enableTcpNetwork?: boolean

    Attach a real-TCP backend in the worker so wasm programs can dial external hosts via Node net.Socket.

    execPrograms?: Record<string, string>

    Virtual path → host filesystem path for exec resolution inside the worker

    extraMounts?: {
        gid?: number;
        hostPath: string;
        mountPoint: string;
        readonly?: boolean;
        uid?: number;
    }[]

    Type Declaration

    • Optionalgid?: number

      Virtual group for existing host-backed mount entries. Defaults to root.

    • hostPath: string
    • mountPoint: string
    • Optionalreadonly?: boolean
    • Optionaluid?: number

      Virtual owner for existing host-backed mount entries. Defaults to root.

    maxPages?: number

    Maximum wasm memory pages per process (default: 16384 = 1GB). Initial memory is smaller and grows on demand up to this cap.

    maxProcessMemoryBytes?: number

    Allocation-admission budget sampled from simultaneously live process address spaces before each new allocation.

    A running guest can grow its own memory without a JavaScript callback, so aggregate growth may cross this value until the next allocation observes it. maxPages remains the hard per-process growth cap.

    Retired generations are never reused and pass through a separate short, admission-threshold window before new churn proceeds.

    maxWorkers?: number

    Maximum concurrent workers (default: 4)

    onHostDiagnostic?: (diagnostic: HostDiagnostic) => void

    Called for host-runtime diagnostics that are not guest stderr.

    onLazyDownload?: (event: LazyDownloadEvent) => void

    Called as lazy VFS files or trees are fetched on demand.

    onProcessEvent?: (
        event: {
            exitStatus?: number;
            kind: "exit" | "spawn" | "exec";
            pid: number;
            ppid?: number;
        },
    ) => void

    Called when a process is spawned, execs a new program, or exits. Used by Inspector-style UIs to refresh their process table without polling. Kernel-internal fork and posix_spawn events carry ppid; the synthetic root spawn does not.

    onPtyOutput?: (pid: number, data: Uint8Array) => void

    Called when a process writes PTY output

    onResolveExec?: (
        path: string,
    ) => ArrayBuffer | Promise<ArrayBuffer | null> | null

    Called when the worker can't resolve an exec path locally. Return the program bytes or null if not found.

    onStderr?: (pid: number, data: Uint8Array) => void

    Called when a process writes to stderr

    onStdout?: (pid: number, data: Uint8Array) => void

    Called when a process writes to stdout

    rootfsImage?: ArrayBuffer | Uint8Array<ArrayBufferLike> | "default"

    Opt in to mount-based VFS for this kernel boot.

    • "default" — load <repoRoot>/host/wasm/rootfs.vfs, falling back to the resolver-managed programs/rootfs.vfs artifact, and apply DEFAULT_MOUNT_SPEC via resolveForNode. The worker constructs a VirtualPlatformIO (rootfs at /, host-fs scratch dirs at /tmp etc.).
    • ArrayBuffer | Uint8Array — use the supplied image bytes instead of reading from disk. Same mount spec applied.
    • undefined (default) — use raw NodePlatformIO (every host path reachable). Preserves the pre-cutover behaviour for the direct-host-fs callers (demos, scripts) that haven't migrated to a VFS-only world yet.
    rootfsLazyAssets?: readonly ClosedLazyAsset[]

    Exhaustive exact URL-to-byte transport for lazy entries in rootfsImage. Intended for offline and pre-publication acceptance: when set, unbound URLs fail instead of falling through to ambient network fetch.

    rootfsLazyUrlBase?: string

    Resolve relative lazy URLs embedded in rootfsImage before transport. This is the Node peer of BrowserKernel's lazyUrlBase contract.