@ai-ecoverse/slicc-kernel 1.110.8 → 1.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/dist/kernel-worker.js +790 -532
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-process-worker.js +21 -11
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +706 -448
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +21 -11
- package/dist/process-worker.js.map +2 -2
- package/dist/types/kernel/fd-table.d.ts +1 -1
- package/dist/types/kernel/net/datagram-wire.d.ts +1 -0
- package/dist/types/kernel/net/hosts-file.d.ts +5 -0
- package/dist/types/kernel/net/resolver.d.ts +4 -0
- package/dist/types/kernel/socket-syscalls.d.ts +1 -0
- package/dist/types/kernel/socket.d.ts +6 -0
- package/dist/types/kernel/unix-dgram.d.ts +47 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import type { ClipboardChannel } from './clipboard.js';
|
|
|
2
2
|
import type { PtyPair } from './pty.js';
|
|
3
3
|
import type { SealedChannel } from './sealed.js';
|
|
4
4
|
import type { KernelTty } from './tty.js';
|
|
5
|
-
export type KernelErrno = 'EBADF' | 'EDEADLK' | 'ENOLCK' | 'EEXIST' | 'ELOOP' | 'EOVERFLOW' | 'ENAMETOOLONG' | 'EPIPE' | 'EMFILE' | 'EINVAL' | 'ENOENT' | 'ENOTDIR' | 'ENOEXEC' | 'ECHILD' | 'ENOSYS' | 'ESPIPE' | 'ENOSPC' | 'EINTR' | 'ESRCH' | 'ENOTTY' | 'ENXIO' | 'EPERM' | 'EIO' | 'EACCES' | 'EAGAIN' | 'ENOTSOCK' | 'EAFNOSUPPORT' | 'EPROTONOSUPPORT' | 'EOPNOTSUPP' | 'EADDRINUSE' | 'EADDRNOTAVAIL' | 'ENETUNREACH' | 'ECONNREFUSED' | 'EINPROGRESS' | 'EISCONN' | 'ENOTCONN' | 'EROFS' | 'EFBIG' | 'EALREADY' | 'ETIMEDOUT' | 'ECONNABORTED' | 'EHOSTUNREACH' | 'ECONNRESET' | 'EMSGSIZE' | 'EDESTADDRREQ' | 'ENOPROTOOPT' | 'ENOTSUP' | 'EILSEQ';
|
|
5
|
+
export type KernelErrno = 'EBADF' | 'EDEADLK' | 'ENOLCK' | 'EEXIST' | 'ELOOP' | 'EOVERFLOW' | 'ENAMETOOLONG' | 'EPIPE' | 'EMFILE' | 'EINVAL' | 'ENOENT' | 'ENOTDIR' | 'ENOEXEC' | 'ECHILD' | 'ENOSYS' | 'ESPIPE' | 'ENOSPC' | 'EINTR' | 'ESRCH' | 'ENOTTY' | 'ENXIO' | 'EPERM' | 'EIO' | 'EACCES' | 'EAGAIN' | 'ENOTSOCK' | 'EAFNOSUPPORT' | 'EPROTONOSUPPORT' | 'EPROTOTYPE' | 'EOPNOTSUPP' | 'EADDRINUSE' | 'EADDRNOTAVAIL' | 'ENETUNREACH' | 'ECONNREFUSED' | 'EINPROGRESS' | 'EISCONN' | 'ENOTCONN' | 'EROFS' | 'EFBIG' | 'EALREADY' | 'ETIMEDOUT' | 'ECONNABORTED' | 'EHOSTUNREACH' | 'ECONNRESET' | 'EMSGSIZE' | 'EDESTADDRREQ' | 'ENOPROTOOPT' | 'ENOTSUP' | 'EILSEQ';
|
|
6
6
|
export declare class KernelError extends Error {
|
|
7
7
|
readonly code: KernelErrno;
|
|
8
8
|
readonly detail?: string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { KernelFs } from '../../fs/types.js';
|
|
2
|
+
export type HostsTable = ReadonlyMap<string, readonly string[]>;
|
|
3
|
+
export declare const HOSTS_PATH = "/etc/hosts";
|
|
4
|
+
export declare function parseHosts(text: string): HostsTable;
|
|
5
|
+
export declare function hostsReader(fs: Pick<KernelFs, 'stat' | 'readFile'>, path?: string): () => Promise<HostsTable | undefined>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HostsTable } from './hosts-file.js';
|
|
1
2
|
import { type Routes } from './routes.js';
|
|
2
3
|
import { type NetworkUplink, type ResolveFamily } from './uplink.js';
|
|
3
4
|
export declare const RESOLVE_TTL_MAX = 60;
|
|
@@ -10,6 +11,7 @@ export interface ResolverOptions {
|
|
|
10
11
|
timeoutMs?: number;
|
|
11
12
|
log?: (message: string) => void;
|
|
12
13
|
hostname?: string;
|
|
14
|
+
hosts?: () => Promise<HostsTable | undefined>;
|
|
13
15
|
}
|
|
14
16
|
export declare function hostsEntry(name: string, own?: readonly string[]): string | undefined;
|
|
15
17
|
export declare class Resolver {
|
|
@@ -21,7 +23,9 @@ export declare class Resolver {
|
|
|
21
23
|
private readonly own;
|
|
22
24
|
private readonly cache;
|
|
23
25
|
private readonly pending;
|
|
26
|
+
private readonly hosts;
|
|
24
27
|
constructor(options: ResolverOptions);
|
|
28
|
+
private fromFile;
|
|
25
29
|
resolve(name: string, family: ResolveFamily, blocking?: () => AbortSignal): Promise<string[]>;
|
|
26
30
|
private lookup;
|
|
27
31
|
private usable;
|
|
@@ -4,6 +4,7 @@ import { type Destination, Routes } from './net/routes.js';
|
|
|
4
4
|
import type { NetworkUplink } from './net/uplink.js';
|
|
5
5
|
import { KernelPipe } from './pipe.js';
|
|
6
6
|
import type { SealedCaller } from './sealed.js';
|
|
7
|
+
import type { UnixDgram } from './unix-dgram.js';
|
|
7
8
|
export type SockAddr = {
|
|
8
9
|
family: 'inet';
|
|
9
10
|
host: string;
|
|
@@ -93,9 +94,11 @@ export declare class KernelSocket implements KernelFile {
|
|
|
93
94
|
static pair(net: LoopbackNet, domain: SocketDomain, cred?: PeerCred): [KernelSocket, KernelSocket];
|
|
94
95
|
}
|
|
95
96
|
export declare function canonicalHost(host: string): string;
|
|
97
|
+
export declare function keyOf(addr: SockAddr, name?: SocketName): string;
|
|
96
98
|
export declare class LoopbackNet {
|
|
97
99
|
private readonly bound;
|
|
98
100
|
private readonly dgrams;
|
|
101
|
+
private readonly unixDgrams;
|
|
99
102
|
private readonly activators;
|
|
100
103
|
private readonly internal;
|
|
101
104
|
private readonly reserved;
|
|
@@ -106,6 +109,9 @@ export declare class LoopbackNet {
|
|
|
106
109
|
uplinkFor(host: string): UplinkRoute | undefined;
|
|
107
110
|
destination(host: string): Destination;
|
|
108
111
|
bindDgram(socket: KernelDgram, addr: SockAddr, kernel?: boolean): InetAddr;
|
|
112
|
+
bindUnixDgram(socket: UnixDgram, key: string): void;
|
|
113
|
+
releaseUnixDgram(key: string, socket: UnixDgram): void;
|
|
114
|
+
unixDgramAt(key: string): UnixDgram;
|
|
109
115
|
releaseDgram(addr: InetAddr, socket: KernelDgram): void;
|
|
110
116
|
deliverDgram(port: number, datagram: Datagram): boolean;
|
|
111
117
|
private bindable;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { KernelDgram } from './dgram.js';
|
|
2
|
+
import { type KernelFile, type PollState } from './fd-table.js';
|
|
3
|
+
import { type LoopbackNet, type PeerCred, type SockAddr } from './socket.js';
|
|
4
|
+
export type UnixAddr = Extract<SockAddr, {
|
|
5
|
+
family: 'unix';
|
|
6
|
+
}>;
|
|
7
|
+
export interface UnixDatagram {
|
|
8
|
+
bytes: Uint8Array;
|
|
9
|
+
from: UnixAddr;
|
|
10
|
+
sender: UnixDgram;
|
|
11
|
+
}
|
|
12
|
+
export interface UnixReceived {
|
|
13
|
+
bytes: Uint8Array;
|
|
14
|
+
from: UnixAddr;
|
|
15
|
+
truncated: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class UnixDgram implements KernelFile {
|
|
18
|
+
local: UnixAddr | undefined;
|
|
19
|
+
peer: UnixAddr | undefined;
|
|
20
|
+
key: string | undefined;
|
|
21
|
+
peerCred: PeerCred | undefined;
|
|
22
|
+
private target;
|
|
23
|
+
private readonly net;
|
|
24
|
+
private readonly queue;
|
|
25
|
+
private queued;
|
|
26
|
+
private closed;
|
|
27
|
+
private readonly changes;
|
|
28
|
+
private readonly options;
|
|
29
|
+
constructor(net: LoopbackNet);
|
|
30
|
+
static pair(net: LoopbackNet, cred?: PeerCred): [UnixDgram, UnixDgram];
|
|
31
|
+
bind(addr: SockAddr, key: string): void;
|
|
32
|
+
connectTo(addr: UnixAddr, target: UnixDgram): void;
|
|
33
|
+
destination(): UnixDgram;
|
|
34
|
+
room(bytes: number): boolean;
|
|
35
|
+
send(bytes: Uint8Array, to: UnixDgram, nonblock: boolean, signal?: AbortSignal): Promise<number>;
|
|
36
|
+
receive(max: number, peek: boolean, signal?: AbortSignal): Promise<UnixReceived>;
|
|
37
|
+
read(max: number, signal?: AbortSignal): Promise<Uint8Array>;
|
|
38
|
+
peek(max: number, signal?: AbortSignal): Promise<Uint8Array>;
|
|
39
|
+
write(bytes: Uint8Array, signal?: AbortSignal): Promise<number>;
|
|
40
|
+
poll(): PollState;
|
|
41
|
+
changed(signal?: AbortSignal): Promise<void>;
|
|
42
|
+
shutdown(how: number): void;
|
|
43
|
+
getOption(level: number, name: number): number;
|
|
44
|
+
setOption(level: number, name: number, value: number): void;
|
|
45
|
+
close(): void;
|
|
46
|
+
}
|
|
47
|
+
export declare function isDatagram(file: KernelFile): file is KernelDgram | UnixDgram;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-kernel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.112.0",
|
|
4
4
|
"description": "SLICC's wasm-realm kernel: run Emscripten programs in the browser against OPFS, with fork, spawn, pipes and waitpid",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|