@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
23 lines • 1.02 kB
TypeScript
import type { ErrnoCodes, FSHost } from './fs/types.ts';
type SockOps = Record<'createPeer' | 'listen', (...args: never[]) => unknown>;
export interface NetworkHost {
SOCKFS?: {
websocket_sock_ops?: SockOps;
};
}
/**
* Make Emscripten's socket layer refuse instead of opening connections.
*
* SOCKFS implements guest sockets with host WebSockets. Refuse its peer and
* server factories so connect/sendto raise ENETUNREACH and listen/UDP bind/
* socketpair raise ENETDOWN. Socket creation, TCP bind, the offline resolver
* and socket options still work. A process runtime's useNodeSockFS() replaces
* this factory with real sockets.
*
* @param host The Emscripten module (`pyodide._module`).
* @param fs The module's FS, whose ErrnoError the sock ops throw.
* @param codes The module's errno table.
*/
export declare function sealNetwork(host: NetworkHost, fs: Pick<FSHost, 'ErrnoError'>, codes: Pick<ErrnoCodes, 'ENETUNREACH' | 'ENETDOWN'>): void;
export {};
//# sourceMappingURL=network.d.ts.map