wasm-posix-host
    Preparing search index...

    Interface NodeKernelHostOptions

    interface NodeKernelHostOptions {
        dataBufferSize?: number;
        defaultThreadSlots?: number;
        enableTcpNetwork?: boolean;
        execPrograms?: Record<string, string>;
        extraMounts?: { hostPath: string; mountPoint: string; readonly?: boolean }[];
        maxPages?: number;
        maxWorkers?: number;
        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";
    }
    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?: { hostPath: string; mountPoint: string; readonly?: boolean }[]
    maxPages?: number

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

    maxWorkers?: number

    Maximum concurrent workers (default: 4)

    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.

    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.