@ai-ecoverse/slicc-kernel 1.182.0 → 1.184.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 +150 -5
- package/dist/async-process.js +14060 -0
- package/dist/async-process.js.map +7 -0
- package/dist/cloudflare-sources.js +2 -0
- package/dist/cloudflare.js +42562 -0
- package/dist/cloudflare.js.map +7 -0
- package/dist/driver-worker.js +290 -90
- package/dist/driver-worker.js.map +4 -4
- package/dist/index.js +328 -102
- package/dist/index.js.map +4 -4
- package/dist/kernel-worker.js +1837 -732
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-driver-worker.js +298 -98
- package/dist/node-driver-worker.js.map +4 -4
- package/dist/node-process-worker.cjs +4719 -652
- package/dist/node-process-worker.cjs.map +4 -4
- package/dist/node-process-worker.js +4719 -652
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +3341 -924
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +4625 -558
- package/dist/process-worker.js.map +4 -4
- package/dist/types/async/header-hook.d.ts +3 -0
- package/dist/types/async/link.d.ts +14 -0
- package/dist/types/async/message-link.d.ts +15 -0
- package/dist/types/async/node-host.d.ts +16 -0
- package/dist/types/async/remote-worker.d.ts +12 -0
- package/dist/types/async/snapshots.d.ts +13 -0
- package/dist/types/async/transport.d.ts +28 -0
- package/dist/types/async/wire.d.ts +113 -0
- package/dist/types/cdp/port.d.ts +2 -1
- package/dist/types/client/attach.d.ts +2 -0
- package/dist/types/client/protocol.d.ts +1 -0
- package/dist/types/client/serve-client.d.ts +1 -0
- package/dist/types/cloudflare/clock-skew.d.ts +2 -0
- package/dist/types/cloudflare/computer-driver.d.ts +65 -0
- package/dist/types/cloudflare/computer.d.ts +105 -0
- package/dist/types/cloudflare/fork-tokens.d.ts +17 -0
- package/dist/types/cloudflare/images.d.ts +20 -0
- package/dist/types/cloudflare/isolates.d.ts +17 -0
- package/dist/types/cloudflare/kernel-end.d.ts +45 -0
- package/dist/types/cloudflare/loader.d.ts +54 -0
- package/dist/types/cloudflare/options.d.ts +81 -0
- package/dist/types/cloudflare/placement.d.ts +61 -0
- package/dist/types/cloudflare/rpc-link.d.ts +49 -0
- package/dist/types/cloudflare/rpc-pack.d.ts +7 -0
- package/dist/types/cloudflare/sqlite-meta.d.ts +4 -0
- package/dist/types/cloudflare/sqlite-root.d.ts +5 -0
- package/dist/types/cloudflare/sqlite-store.d.ts +73 -0
- package/dist/types/cloudflare.d.ts +16 -0
- package/dist/types/devices-relay.d.ts +74 -0
- package/dist/types/facade/port.d.ts +2 -1
- package/dist/types/index.d.ts +14 -0
- package/dist/types/kernel/devices.d.ts +155 -0
- package/dist/types/kernel/embedder.d.ts +2 -0
- package/dist/types/kernel/fd-table.d.ts +3 -1
- package/dist/types/kernel/host.d.ts +3 -0
- package/dist/types/kernel/process.d.ts +22 -0
- package/dist/types/kernel/protocol.d.ts +1 -0
- package/dist/types/kernel/serial-ioctl.d.ts +73 -0
- package/dist/types/launcher.d.ts +20 -0
- package/dist/types/mount/hostfs.d.ts +2 -1
- package/dist/types/mount/in-process.d.ts +15 -0
- package/dist/types/node.d.ts +20 -2
- package/dist/types/ports.d.ts +7 -0
- package/dist/types/process/js/js-dev.d.ts +24 -0
- package/dist/types/process/kernel-streams.d.ts +11 -1
- package/dist/types/process/process-pty.d.ts +1 -0
- package/dist/types/process/wasi/wasi-fds.d.ts +1 -0
- package/dist/types/process/wasi/wasi-files.d.ts +1 -0
- package/dist/types/process/wasi/wasi-host.d.ts +3 -2
- package/dist/types/process/wasi/wasi-module.d.ts +2 -0
- package/dist/types/process/wasi/wasi-sigmask.d.ts +2 -1
- package/dist/types/process/wasi/wasi-termios.d.ts +1 -0
- package/dist/types/process/wasi/wasm-reentry.d.ts +1 -0
- package/dist/types/realm/sync-sab-bridge.d.ts +1 -0
- package/dist/types/serve.d.ts +14 -1
- package/package.json +11 -5
|
@@ -10,6 +10,7 @@ import { type SudoCall, type SudoResult, type SudoStdin, type VisudoCall, type V
|
|
|
10
10
|
import { type ChildForker, type ChildSpawner, type ChildStdio, type InheritedSlot } from './children.js';
|
|
11
11
|
import type { ClipboardBroker } from './clipboard.js';
|
|
12
12
|
import { type Cred, type CredChange } from './cred.js';
|
|
13
|
+
import type { DeviceMetaChange, DeviceNodes } from './devices.js';
|
|
13
14
|
import { type EmbedderBroker } from './embedder.js';
|
|
14
15
|
import { type EpollSyscall } from './epoll.js';
|
|
15
16
|
import { type DeviceAccess, type FdTable, type HeldMeta, type KernelFdKind, type OpenFile } from './fd-table.js';
|
|
@@ -106,6 +107,7 @@ export type WasmSyscall = {
|
|
|
106
107
|
} | {
|
|
107
108
|
op: 'fd-path-flush';
|
|
108
109
|
path: string;
|
|
110
|
+
durable?: true;
|
|
109
111
|
} | {
|
|
110
112
|
op: 'fd-path-unlinking';
|
|
111
113
|
path: string;
|
|
@@ -235,6 +237,20 @@ export type WasmSyscall = {
|
|
|
235
237
|
op: 'fd-open-embedder';
|
|
236
238
|
flags: number;
|
|
237
239
|
} | {
|
|
240
|
+
op: 'fd-dev-nodes';
|
|
241
|
+
} | {
|
|
242
|
+
op: 'fd-open-dev';
|
|
243
|
+
path: string;
|
|
244
|
+
flags: number;
|
|
245
|
+
} | {
|
|
246
|
+
op: 'fd-dev-ioctl';
|
|
247
|
+
fd: number;
|
|
248
|
+
request: number;
|
|
249
|
+
arg?: unknown;
|
|
250
|
+
} | ({
|
|
251
|
+
op: 'fd-dev-meta';
|
|
252
|
+
path: string;
|
|
253
|
+
} & DeviceMetaChange) | {
|
|
238
254
|
op: 'tty-get';
|
|
239
255
|
fd: number;
|
|
240
256
|
} | {
|
|
@@ -242,6 +258,7 @@ export type WasmSyscall = {
|
|
|
242
258
|
fd: number;
|
|
243
259
|
termios: Termios;
|
|
244
260
|
flush?: boolean;
|
|
261
|
+
drain?: boolean;
|
|
245
262
|
} | {
|
|
246
263
|
op: 'tty-winsz';
|
|
247
264
|
fd: number;
|
|
@@ -380,6 +397,7 @@ export interface WasmProcessOptions {
|
|
|
380
397
|
uid: number;
|
|
381
398
|
};
|
|
382
399
|
embedderName?: string;
|
|
400
|
+
devices?: DeviceNodes;
|
|
383
401
|
readonlyAt?: (path: string) => boolean;
|
|
384
402
|
guard?: {
|
|
385
403
|
dac: Dac;
|
|
@@ -393,6 +411,7 @@ export interface WasmProcessOptions {
|
|
|
393
411
|
ppid: number;
|
|
394
412
|
}>;
|
|
395
413
|
onSyscall?: (req: WasmSyscall) => void;
|
|
414
|
+
durable?: () => void | Promise<void>;
|
|
396
415
|
spawner?: ChildSpawner;
|
|
397
416
|
forker?: ChildForker;
|
|
398
417
|
fs: VfsFileFs;
|
|
@@ -521,6 +540,9 @@ export declare class WasmProcess {
|
|
|
521
540
|
private complainLine;
|
|
522
541
|
private embedderCaller;
|
|
523
542
|
private closeFd;
|
|
543
|
+
private openDev;
|
|
544
|
+
private devMeta;
|
|
545
|
+
private devIoctl;
|
|
524
546
|
private openEmbedder;
|
|
525
547
|
complain(line: string): Promise<boolean>;
|
|
526
548
|
private clipboardComplaint;
|
|
@@ -23,6 +23,7 @@ export declare const JS_THREAD_CRASHED = 257;
|
|
|
23
23
|
export declare const JS_THREAD_OWNED_FDS = 1024;
|
|
24
24
|
export interface WasmProgram {
|
|
25
25
|
abi?: 'emscripten' | 'wasi';
|
|
26
|
+
emscripten?: 'kernel';
|
|
26
27
|
glue: string;
|
|
27
28
|
module: WebAssembly.Module;
|
|
28
29
|
memory?: ImportedMemory;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Termios } from './tty.js';
|
|
2
|
+
export declare const IOCTL: {
|
|
3
|
+
readonly TCGETS: 21505;
|
|
4
|
+
readonly TCSETS: 21506;
|
|
5
|
+
readonly TCSETSW: 21507;
|
|
6
|
+
readonly TCSETSF: 21508;
|
|
7
|
+
readonly TCSBRK: 21513;
|
|
8
|
+
readonly TCFLSH: 21515;
|
|
9
|
+
readonly TIOCEXCL: 21516;
|
|
10
|
+
readonly TIOCNXCL: 21517;
|
|
11
|
+
readonly TIOCSCTTY: 21518;
|
|
12
|
+
readonly TIOCGPGRP: 21519;
|
|
13
|
+
readonly TIOCSPGRP: 21520;
|
|
14
|
+
readonly TIOCOUTQ: 21521;
|
|
15
|
+
readonly TIOCGWINSZ: 21523;
|
|
16
|
+
readonly TIOCSWINSZ: 21524;
|
|
17
|
+
readonly TIOCMGET: 21525;
|
|
18
|
+
readonly TIOCMBIS: 21526;
|
|
19
|
+
readonly TIOCMBIC: 21527;
|
|
20
|
+
readonly TIOCMSET: 21528;
|
|
21
|
+
readonly FIONREAD: 21531;
|
|
22
|
+
readonly TIOCNOTTY: 21538;
|
|
23
|
+
readonly TCSBRKP: 21541;
|
|
24
|
+
readonly TIOCSBRK: 21543;
|
|
25
|
+
readonly TIOCCBRK: 21544;
|
|
26
|
+
readonly TCGETS2: 2150388778;
|
|
27
|
+
readonly TCSETS2: 1076646955;
|
|
28
|
+
readonly TCSETSW2: 1076646956;
|
|
29
|
+
readonly TCSETSF2: 1076646957;
|
|
30
|
+
};
|
|
31
|
+
export declare const FILE_IOCTLS: ReadonlySet<number>;
|
|
32
|
+
export declare const TERMIOS_GETS: ReadonlySet<number>;
|
|
33
|
+
export declare const TERMIOS_SETS: ReadonlySet<number>;
|
|
34
|
+
export declare const INT_OUT: ReadonlySet<number>;
|
|
35
|
+
export declare const INT_IN: ReadonlySet<number>;
|
|
36
|
+
export declare const INT_ARG: ReadonlySet<number>;
|
|
37
|
+
export declare const TIOCM: {
|
|
38
|
+
readonly DTR: 2;
|
|
39
|
+
readonly RTS: 4;
|
|
40
|
+
readonly CTS: 32;
|
|
41
|
+
readonly CD: 64;
|
|
42
|
+
readonly RI: 128;
|
|
43
|
+
readonly DSR: 256;
|
|
44
|
+
};
|
|
45
|
+
export interface SerialTermios extends Termios {
|
|
46
|
+
c_ispeed?: number;
|
|
47
|
+
c_ospeed?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface SerialSettings {
|
|
50
|
+
baudRate: number;
|
|
51
|
+
dataBits: number;
|
|
52
|
+
parity: 'none' | 'even' | 'odd';
|
|
53
|
+
stopBits: 1 | 2;
|
|
54
|
+
flowControl: 'none' | 'hardware';
|
|
55
|
+
}
|
|
56
|
+
export declare const CBAUD = 4111;
|
|
57
|
+
export declare const BOTHER = 4096;
|
|
58
|
+
export declare function speedOf(code: number): number | undefined;
|
|
59
|
+
export declare function codeOf(speed: number): number;
|
|
60
|
+
export declare function speedsOf(termios: SerialTermios, current: {
|
|
61
|
+
ispeed: number;
|
|
62
|
+
ospeed: number;
|
|
63
|
+
}, extended: boolean): {
|
|
64
|
+
ispeed: number;
|
|
65
|
+
ospeed: number;
|
|
66
|
+
};
|
|
67
|
+
export declare function settingsOf(cflag: number, baudRate: number): SerialSettings;
|
|
68
|
+
export declare function sameSettings(a: SerialSettings, b: SerialSettings): boolean;
|
|
69
|
+
export declare const SERIAL_CFLAG: number;
|
|
70
|
+
export declare const SERIAL_LFLAG: number;
|
|
71
|
+
export declare const SERIAL_OFLAG = 4;
|
|
72
|
+
export declare function ioctlArg(view: DataView, request: number, arg: number): unknown;
|
|
73
|
+
export declare function ioctlResult(view: DataView, request: number, arg: number, result: unknown): void;
|
package/dist/types/launcher.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { KernelFs, UsersMode } from './fs/types.js';
|
|
|
12
12
|
import { type UnlinkOwner } from './fs/unlinked.js';
|
|
13
13
|
import { FsWatchers } from './fs/watch.js';
|
|
14
14
|
import { type ClipboardHook } from './kernel/clipboard.js';
|
|
15
|
+
import { type DeviceHook, DeviceNodes } from './kernel/devices.js';
|
|
15
16
|
import { EmbedderBroker, type EmbedderHook } from './kernel/embedder.js';
|
|
16
17
|
type EmbedderSession = {
|
|
17
18
|
client: number;
|
|
@@ -28,6 +29,7 @@ import { type SealedFetchHook } from './kernel/net/sealed-fetch.js';
|
|
|
28
29
|
import type { RealmTransport } from './kernel/net/transport.js';
|
|
29
30
|
import type { NetworkUplink } from './kernel/net/uplink.js';
|
|
30
31
|
import { type ProcessInfo } from './kernel/proc-info.js';
|
|
32
|
+
import type { Program } from './kernel/protocol.js';
|
|
31
33
|
import { type SealedCaller, type SealedHook } from './kernel/sealed.js';
|
|
32
34
|
import { type SigInfo } from './kernel/signals.js';
|
|
33
35
|
import { LoopbackNet } from './kernel/socket.js';
|
|
@@ -38,10 +40,12 @@ import { type FetchLike, type HostfsGrantHook, type HostfsTiming } from './mount
|
|
|
38
40
|
import { type MediaStore } from './mount/media.js';
|
|
39
41
|
import { type MountEntry, type MountSpec, MountTable } from './mount/mount-fs.js';
|
|
40
42
|
import { type ProcessMountPolicy } from './mount/syscall.js';
|
|
43
|
+
import { type MakePortPair } from './ports.js';
|
|
41
44
|
import { type ApproveHook } from './sudo.js';
|
|
42
45
|
import { type Account, UserDb } from './users.js';
|
|
43
46
|
export interface LauncherOptions {
|
|
44
47
|
unlinkOwner?: UnlinkOwner;
|
|
48
|
+
durable?: () => void | Promise<void>;
|
|
45
49
|
fs: KernelFs;
|
|
46
50
|
createWorker: () => WasmWorkerLike;
|
|
47
51
|
modules?: string;
|
|
@@ -75,6 +79,7 @@ export interface LauncherOptions {
|
|
|
75
79
|
sealedFetch?: SealedFetchHook;
|
|
76
80
|
clipboard?: ClipboardHook;
|
|
77
81
|
embedder?: EmbedderHook;
|
|
82
|
+
devices?: DeviceHook;
|
|
78
83
|
approve?: ApproveHook;
|
|
79
84
|
sudoTimeoutMs?: number;
|
|
80
85
|
sudoClock?: {
|
|
@@ -84,6 +89,12 @@ export interface LauncherOptions {
|
|
|
84
89
|
cron?: CronOptions;
|
|
85
90
|
moduleUrl?: ModuleUrlMaker;
|
|
86
91
|
packageLocks?: string;
|
|
92
|
+
emscripten?: 'glue' | 'kernel';
|
|
93
|
+
admit?: (program: Program, from: {
|
|
94
|
+
ppid?: number;
|
|
95
|
+
}) => Promise<() => void>;
|
|
96
|
+
compile?: (bytes: Uint8Array, key: string) => Promise<WebAssembly.Module>;
|
|
97
|
+
ports?: MakePortPair;
|
|
87
98
|
}
|
|
88
99
|
export interface ModuleUrl {
|
|
89
100
|
url: string;
|
|
@@ -190,6 +201,8 @@ export declare function withTag(tags: readonly string[] | undefined, tag: string
|
|
|
190
201
|
export declare function cronPath(path: string): boolean;
|
|
191
202
|
export declare function expandDefaults(defaults: Readonly<Record<string, string>> | undefined, env: Readonly<Record<string, string>>): Record<string, string>;
|
|
192
203
|
export declare class Launcher {
|
|
204
|
+
private readonly emscripten;
|
|
205
|
+
private readonly admit;
|
|
193
206
|
readonly fs: KernelFs;
|
|
194
207
|
readonly processFs: KernelFs;
|
|
195
208
|
private readonly noLinksFs;
|
|
@@ -200,8 +213,10 @@ export declare class Launcher {
|
|
|
200
213
|
private readonly unguardedRoot;
|
|
201
214
|
private writers;
|
|
202
215
|
private readonly unlinkOwnerOption;
|
|
216
|
+
private readonly durable;
|
|
203
217
|
private readonly base;
|
|
204
218
|
private readonly createWorker;
|
|
219
|
+
private readonly compile;
|
|
205
220
|
private readonly moduleUrl;
|
|
206
221
|
private readonly moduleUrls;
|
|
207
222
|
private readonly urlsInUse;
|
|
@@ -216,6 +231,7 @@ export declare class Launcher {
|
|
|
216
231
|
private unwatchScopes;
|
|
217
232
|
private readonly warned;
|
|
218
233
|
private readonly compiled;
|
|
234
|
+
private readonly libcs;
|
|
219
235
|
private readonly texts;
|
|
220
236
|
private revocations;
|
|
221
237
|
private integrity;
|
|
@@ -271,6 +287,7 @@ export declare class Launcher {
|
|
|
271
287
|
private readonly onMountPending;
|
|
272
288
|
private readonly removable;
|
|
273
289
|
private readonly hostfs;
|
|
290
|
+
get ports(): MakePortPair;
|
|
274
291
|
private readonly fstabRetries;
|
|
275
292
|
private readonly inserted;
|
|
276
293
|
private readonly openFiles;
|
|
@@ -295,6 +312,7 @@ export declare class Launcher {
|
|
|
295
312
|
private readonly scrubs;
|
|
296
313
|
private readonly clipboard;
|
|
297
314
|
readonly embedder: EmbedderBroker;
|
|
315
|
+
readonly devices: DeviceNodes;
|
|
298
316
|
private readonly rootFs;
|
|
299
317
|
private fileWatches;
|
|
300
318
|
private nextPid;
|
|
@@ -396,6 +414,7 @@ export declare class Launcher {
|
|
|
396
414
|
private sourceCheck;
|
|
397
415
|
private treeScrubs;
|
|
398
416
|
private marks;
|
|
417
|
+
private reserved;
|
|
399
418
|
private admitted;
|
|
400
419
|
private start;
|
|
401
420
|
private shownIds;
|
|
@@ -457,6 +476,7 @@ export declare class Launcher {
|
|
|
457
476
|
private imageOf;
|
|
458
477
|
credOf(pid: number): Cred;
|
|
459
478
|
private wireSealed;
|
|
479
|
+
private deviceNodes;
|
|
460
480
|
private embedderBroker;
|
|
461
481
|
sessionOf(pid: number): EmbedderSession;
|
|
462
482
|
tagOf(pid: number): string | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type MakePortPair } from '../ports.js';
|
|
1
2
|
import { type MediumHandlers } from './medium.js';
|
|
2
3
|
import type { MountSpec, OpenedDriver } from './mount-fs.js';
|
|
3
4
|
import type { DriverCapabilities } from './protocol.js';
|
|
@@ -126,4 +127,4 @@ export declare class PortTransport implements HostfsTransport {
|
|
|
126
127
|
}
|
|
127
128
|
export declare function serveHostfsPort(port: MessagePort, transport: HostfsTransport): () => void;
|
|
128
129
|
export declare function grantConnect(hook: HostfsGrantHook, fetch: FetchLike, liveness?: PortLiveness): HostfsConnect;
|
|
129
|
-
export declare function openHostfs(spec: MountSpec, connect: HostfsConnect, timing?: HostfsTiming): Promise<OpenedDriver>;
|
|
130
|
+
export declare function openHostfs(spec: MountSpec, connect: HostfsConnect, timing?: HostfsTiming, ports?: MakePortPair): Promise<OpenedDriver>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type MakePortPair } from '../ports.js';
|
|
2
|
+
import { type FilesystemHandlers, type ServedFilesystem } from './driver.js';
|
|
3
|
+
import type { MountSpec, OpenedDriver } from './mount-fs.js';
|
|
4
|
+
import type { DriverCapabilities } from './protocol.js';
|
|
5
|
+
export declare const IN_PROCESS_DRIVER: unique symbol;
|
|
6
|
+
export interface InProcessDriver {
|
|
7
|
+
handlers: FilesystemHandlers;
|
|
8
|
+
capabilities?: DriverCapabilities;
|
|
9
|
+
served?(served: ServedFilesystem): void;
|
|
10
|
+
}
|
|
11
|
+
export type InProcessMountSpec = MountSpec & {
|
|
12
|
+
[IN_PROCESS_DRIVER]?: InProcessDriver;
|
|
13
|
+
};
|
|
14
|
+
export declare function inProcessMount(spec: MountSpec, driver: InProcessDriver): InProcessMountSpec;
|
|
15
|
+
export declare function openInProcess(spec: MountSpec, ports?: MakePortPair): OpenedDriver | undefined;
|
package/dist/types/node.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { type MessagePort, type Worker } from 'node:worker_threads';
|
|
2
|
+
import { type AsyncProcessOptions } from './async/node-host.js';
|
|
2
3
|
import type { CdpHook } from './cdp/types.js';
|
|
3
4
|
import type { SudoRun, SudoRunOptions } from './client/attach.js';
|
|
4
5
|
import { type CronClock } from './cron/clock.js';
|
|
5
6
|
import type { FacadeSpecs } from './facade/types.js';
|
|
6
7
|
import type { Attestation, AttestTombstone } from './fs/attest.js';
|
|
7
8
|
import type { DenialHook } from './fs/dac.js';
|
|
9
|
+
import type { MetaStore } from './fs/meta.js';
|
|
8
10
|
import type { Protection } from './fs/protect.js';
|
|
9
11
|
import { type UsersMode } from './fs/types.js';
|
|
10
|
-
import type { ConnectOptions, KernelGroups, KernelIntegrity, KernelSealed, KernelUsers, RunOptions, RunResult, Terminal, TerminalOptions } from './index.js';
|
|
12
|
+
import type { ConnectOptions, KernelDevices, KernelGroups, KernelIntegrity, KernelSealed, KernelUsers, RunOptions, RunResult, Terminal, TerminalOptions } from './index.js';
|
|
11
13
|
import type { ClipboardHook } from './kernel/clipboard.js';
|
|
14
|
+
import { type DeviceHook } from './kernel/devices.js';
|
|
12
15
|
import { type EmbedderHook } from './kernel/embedder.js';
|
|
13
16
|
import type { RouteTable } from './kernel/net/routes.js';
|
|
14
17
|
import { type SealedOption } from './kernel/net/sealed-fetch.js';
|
|
@@ -20,13 +23,20 @@ import { type HostLoopback } from './node/loopback.js';
|
|
|
20
23
|
import { memoryRoot } from './node/memory-root.js';
|
|
21
24
|
import type { ApproveHook, SudoReplay } from './sudo.js';
|
|
22
25
|
import { type NetworkTransport } from './transport.js';
|
|
26
|
+
export type { KernelLink, ProcessLink } from './async/link.js';
|
|
27
|
+
export { type MessageLinks, type MessagePortLike, messageLinks } from './async/message-link.js';
|
|
28
|
+
export type { AsyncProcessDeps, AsyncProcessEntry, AsyncProcessOptions, } from './async/node-host.js';
|
|
29
|
+
export { type RemoteWorkerOptions, remoteWorker } from './async/remote-worker.js';
|
|
30
|
+
export { type AsyncTransport, type AsyncTransportOptions, createAsyncTransport, } from './async/transport.js';
|
|
31
|
+
export type { AsyncProcessInit } from './async/wire.js';
|
|
23
32
|
export type { CdpConnection, CdpHook, CdpRequest } from './cdp/types.js';
|
|
24
33
|
export { type AttachOptions, attachKernel, type ClientEnded, type ClientFetchRequest, type ClientFs, type ClientRunOptions, type ClientRunResult, type ClientTerminal, type ClientTerminalOptions, KernelCallError, type KernelClient, KernelGoneError, type ProcessEntry, type SpawnedProcess, type SpawnOptions, type SudoRun, type SudoRunOptions, type TraceBatch, type TraceEvent, type TraceExec, type TraceExit, type TraceFork, type TraceOptions, type WatchChange, } from './client/attach.js';
|
|
25
34
|
export type { FacadeConnection, FacadeHook, FacadeInfo, FacadeSpec, FacadeSpecs, } from './facade/types.js';
|
|
26
35
|
export type { Attestation, AttestedDir, AttestOptions, AttestTombstone } from './fs/attest.js';
|
|
27
36
|
export type { Denial, DenialHook } from './fs/dac.js';
|
|
28
|
-
export type { ConnectOptions, CwdMissing, Ended, KernelGroups, KernelIntegrity, KernelSealed, KernelUsers, NetworkUplink, ResolveAnswer, ResolveFamily, RouteTable, RunOptions, RunResult, Terminal, TerminalOptions, TerminalSignal, } from './index.js';
|
|
37
|
+
export type { ConnectOptions, CwdMissing, DeviceAddOptions, DeviceNodeHandle, Ended, KernelDevices, KernelGroups, KernelIntegrity, KernelSealed, KernelUsers, NetworkUplink, ResolveAnswer, ResolveFamily, RouteTable, RunOptions, RunResult, Terminal, TerminalOptions, TerminalSignal, } from './index.js';
|
|
29
38
|
export type { ClipboardHook, ClipboardStamp } from './kernel/clipboard.js';
|
|
39
|
+
export type { DeviceHook, DeviceOpenRequest, DeviceSignals, DeviceSpec, DeviceStamp, DeviceStreams, } from './kernel/devices.js';
|
|
30
40
|
export type { EmbedderHook, EmbedderKindPolicy, EmbedderReply, EmbedderRequest, EmbedderStamp, } from './kernel/embedder.js';
|
|
31
41
|
export { SEALED_FETCH_VERSION, type SealedFetchHook, type SealedFetchRequest, type SealedOption, } from './kernel/net/sealed-fetch.js';
|
|
32
42
|
export type { SealedAbortReason, SealedCaller, SealedHook, SealedRequest, SealedRequester, } from './kernel/sealed.js';
|
|
@@ -41,6 +51,9 @@ export { fetchTransport, type NetworkTransport } from './transport.js';
|
|
|
41
51
|
export { memoryRoot };
|
|
42
52
|
export interface NodeKernelOptions {
|
|
43
53
|
root?: FileSystemDirectoryHandle;
|
|
54
|
+
meta?: MetaStore;
|
|
55
|
+
ranged?: boolean;
|
|
56
|
+
durable?: () => void | Promise<void>;
|
|
44
57
|
modules?: string;
|
|
45
58
|
commands?: {
|
|
46
59
|
append?: readonly string[];
|
|
@@ -67,6 +80,7 @@ export interface NodeKernelOptions {
|
|
|
67
80
|
sealed?: SealedOption;
|
|
68
81
|
clipboard?: ClipboardHook;
|
|
69
82
|
requests?: EmbedderHook;
|
|
83
|
+
devices?: DeviceHook;
|
|
70
84
|
approve?: ApproveHook;
|
|
71
85
|
protect?: Protection;
|
|
72
86
|
cron?: {
|
|
@@ -84,6 +98,9 @@ export interface NodeKernelOptions {
|
|
|
84
98
|
ceiling?: number;
|
|
85
99
|
idleMs?: number;
|
|
86
100
|
};
|
|
101
|
+
emscripten?: 'glue' | 'kernel';
|
|
102
|
+
blocking?: 'sync' | 'async';
|
|
103
|
+
asyncProcess?: AsyncProcessOptions;
|
|
87
104
|
}
|
|
88
105
|
export interface NodeKernel {
|
|
89
106
|
readonly root: FileSystemDirectoryHandle;
|
|
@@ -104,6 +121,7 @@ export interface NodeKernel {
|
|
|
104
121
|
sudoRun(request: SudoReplay, options?: SudoRunOptions): Promise<SudoRun>;
|
|
105
122
|
readonly users: KernelUsers;
|
|
106
123
|
readonly groups: KernelGroups;
|
|
124
|
+
readonly devices: KernelDevices;
|
|
107
125
|
setRoutes(routes: RouteTable): Promise<void>;
|
|
108
126
|
updateTransportTraits(): Promise<boolean>;
|
|
109
127
|
mount(spec: MountSpec): Promise<MountEntry>;
|
|
@@ -17,6 +17,7 @@ export interface DevOpened {
|
|
|
17
17
|
file: boolean;
|
|
18
18
|
read: boolean;
|
|
19
19
|
write: boolean;
|
|
20
|
+
device?: boolean;
|
|
20
21
|
}
|
|
21
22
|
export declare function devOpen(abs: string, o: JsOpenOptions): DevStep<DevOpened>;
|
|
22
23
|
export declare function devAsync<T>(kernel: {
|
|
@@ -29,15 +30,38 @@ export interface StreamIo {
|
|
|
29
30
|
read(fd: number, max: number): Promise<Uint8Array>;
|
|
30
31
|
write(fd: number, data: Uint8Array): Promise<void>;
|
|
31
32
|
close(fd: number): Promise<void>;
|
|
33
|
+
ioctl?(fd: number, request: number, arg?: unknown): Promise<unknown>;
|
|
32
34
|
}
|
|
33
35
|
export interface StreamSyncIo {
|
|
34
36
|
read(fd: number, max: number): Uint8Array;
|
|
35
37
|
write(fd: number, data: Uint8Array): void;
|
|
36
38
|
close(fd: number): void;
|
|
39
|
+
ioctl?(fd: number, request: number, arg?: unknown): unknown;
|
|
37
40
|
}
|
|
41
|
+
export declare function ioctlRequest(fd: number, request: number, arg?: unknown): SyncSabRequestBody;
|
|
42
|
+
export interface JsSerialTermios {
|
|
43
|
+
c_iflag: number;
|
|
44
|
+
c_oflag: number;
|
|
45
|
+
c_cflag: number;
|
|
46
|
+
c_lflag: number;
|
|
47
|
+
c_cc: number[];
|
|
48
|
+
ispeed: number;
|
|
49
|
+
ospeed: number;
|
|
50
|
+
}
|
|
51
|
+
export interface JsModem {
|
|
52
|
+
dtr: boolean;
|
|
53
|
+
rts: boolean;
|
|
54
|
+
cts: boolean;
|
|
55
|
+
dsr: boolean;
|
|
56
|
+
cd: boolean;
|
|
57
|
+
ri: boolean;
|
|
58
|
+
}
|
|
59
|
+
export type JsTermiosWhen = 'now' | 'drain' | 'flush';
|
|
60
|
+
export type JsFlushQueue = 'input' | 'output' | 'both';
|
|
38
61
|
export interface StreamAccess {
|
|
39
62
|
read: boolean;
|
|
40
63
|
write: boolean;
|
|
64
|
+
device?: boolean;
|
|
41
65
|
}
|
|
42
66
|
export declare function streamFile(fd: number, path: string, io: StreamIo, access: StreamAccess): {
|
|
43
67
|
file: JsFile;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DeviceMetaChange, DeviceNodeInfo } from '../kernel/devices.js';
|
|
1
2
|
import type { HeldMeta, PollState } from '../kernel/fd-table.js';
|
|
2
3
|
import type { MountLine, ProcessListing } from '../kernel/proc-info.js';
|
|
3
4
|
import type { Termios } from '../kernel/tty.js';
|
|
@@ -56,7 +57,11 @@ export interface ProcessSys {
|
|
|
56
57
|
ttyNames?(): string[];
|
|
57
58
|
ttyOwner?(name: string): TtyOwner | null;
|
|
58
59
|
tcgets?(fd: number): Termios;
|
|
59
|
-
tcsets?(fd: number, termios: Termios, flush?: boolean): void;
|
|
60
|
+
tcsets?(fd: number, termios: Termios, flush?: boolean, drain?: boolean): void;
|
|
61
|
+
devNodes?(): DeviceNodeInfo[];
|
|
62
|
+
openDev?(path: string, flags: number): number;
|
|
63
|
+
devIoctl?(fd: number, request: number, arg?: unknown): unknown;
|
|
64
|
+
devMeta?(path: string, change: DeviceMetaChange): void;
|
|
60
65
|
winsize?(fd: number): [number, number];
|
|
61
66
|
openPty?(): number;
|
|
62
67
|
openPts?(n: number, noctty: boolean): number;
|
|
@@ -87,6 +92,7 @@ export interface ProcessStream {
|
|
|
87
92
|
sliccCloexec?: boolean;
|
|
88
93
|
sliccKernelSocket?: boolean;
|
|
89
94
|
sliccKernelFifo?: string;
|
|
95
|
+
sliccDevice?: boolean;
|
|
90
96
|
path?: string;
|
|
91
97
|
flags: number;
|
|
92
98
|
position: number;
|
|
@@ -174,6 +180,10 @@ export declare class KernelStreams {
|
|
|
174
180
|
private creatingTerminal;
|
|
175
181
|
private useTerminalNodes;
|
|
176
182
|
private usePtsNodes;
|
|
183
|
+
private useDeviceNodes;
|
|
184
|
+
private useDeviceMeta;
|
|
185
|
+
private liveDeviceStat;
|
|
186
|
+
private openDeviceNode;
|
|
177
187
|
private ptyNode;
|
|
178
188
|
private ptsTarget;
|
|
179
189
|
private ttyNode;
|
|
@@ -11,6 +11,7 @@ export interface PtyKernel {
|
|
|
11
11
|
setControllingTerminal(kfd: number): void;
|
|
12
12
|
setPacketMode(kfd: number, on: boolean): void;
|
|
13
13
|
setWinsize(kfd: number, rows: number, cols: number): void;
|
|
14
|
+
devIoctl?(fd: number, request: number, arg?: unknown): unknown;
|
|
14
15
|
}
|
|
15
16
|
export interface PtyIoctlDeps {
|
|
16
17
|
fs(): ProcessFs | undefined;
|
|
@@ -133,6 +133,7 @@ export declare class WasiFds {
|
|
|
133
133
|
resolve(dirfd: number, path: string): string;
|
|
134
134
|
private joined;
|
|
135
135
|
private openKernelDevice;
|
|
136
|
+
private openSerial;
|
|
136
137
|
private openCharDevice;
|
|
137
138
|
open(path: string, oflags: number, rights: bigint, fdflags: number, mode?: number, nofollow?: boolean): number;
|
|
138
139
|
private nofollow;
|
|
@@ -28,6 +28,7 @@ export declare class FileBuffer {
|
|
|
28
28
|
real: string | undefined;
|
|
29
29
|
constructor(fs: SyncFsFileIo, path: string, empty: boolean, maxFile?: number, size?: number, version?: string, watch?: RangedWatch);
|
|
30
30
|
get path(): string;
|
|
31
|
+
emptied(empty: boolean): this;
|
|
31
32
|
private retried;
|
|
32
33
|
set path(path: string);
|
|
33
34
|
get isRanged(): boolean;
|
|
@@ -64,11 +64,12 @@ export declare class WasiHost {
|
|
|
64
64
|
interrupted: (() => boolean) | undefined;
|
|
65
65
|
quietly: <T>(fn: () => T) => T;
|
|
66
66
|
deliverDue: () => void;
|
|
67
|
-
private
|
|
67
|
+
private listening;
|
|
68
68
|
readonly o: WasiHostOptions;
|
|
69
69
|
constructor(o: WasiHostOptions);
|
|
70
|
+
attach(): this;
|
|
70
71
|
private fromCwd;
|
|
71
|
-
|
|
72
|
+
workingDir(): string;
|
|
72
73
|
umask(mask?: number): number;
|
|
73
74
|
private copyImport;
|
|
74
75
|
copyFile(from: string, to: string, mode: number, exclusive: boolean): void;
|
|
@@ -11,3 +11,5 @@ export type ForeignResult = 'none' | 'i32' | 'i64' | 'f32' | 'f64' | 'other';
|
|
|
11
11
|
export type ForeignResults = Record<string, Record<string, ForeignResult>>;
|
|
12
12
|
export declare function foreignImports(bytes: Uint8Array): ForeignResults | undefined;
|
|
13
13
|
export declare function libcVersion(module: WebAssembly.Module): number | undefined;
|
|
14
|
+
export declare function customSectionsOf(bytes: Uint8Array, wanted: string): Uint8Array[];
|
|
15
|
+
export declare function libcVersionOf(bytes: Uint8Array): number | undefined;
|
|
@@ -11,7 +11,8 @@ export declare class WasiSigmask {
|
|
|
11
11
|
private readonly deliver;
|
|
12
12
|
private readonly process;
|
|
13
13
|
readonly tid: number;
|
|
14
|
-
|
|
14
|
+
private readonly published;
|
|
15
|
+
constructor(header: Int32Array, deliver: () => void, process?: Int32Array, tid?: number, published?: () => void);
|
|
15
16
|
static unsupported(header: Int32Array): void;
|
|
16
17
|
set(how: number, setLo: number, setHi: number, old: (lo: number, hi: number) => void): number;
|
|
17
18
|
swap(setLo: number, setHi: number): [number, number];
|
|
@@ -7,4 +7,5 @@ export declare function sliccTty(mem: WasiMemory, fds: WasiFds, kernel: WasiKern
|
|
|
7
7
|
tcgetattr: (fd: number, ptr: number) => undefined;
|
|
8
8
|
tcsetattr: (fd: number, actions: number, ptr: number) => undefined;
|
|
9
9
|
winsize: (fd: number, ptr: number) => undefined;
|
|
10
|
+
ioctl: (fd: number, request: number, arg: number) => undefined;
|
|
10
11
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function reentered<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R;
|
|
@@ -5,6 +5,7 @@ export interface SabPostLike {
|
|
|
5
5
|
}
|
|
6
6
|
export interface SyncSabTransport {
|
|
7
7
|
call(req: SyncSabRequestBody, timeoutMs: number, label: string, transfer?: Transferable[], sink?: Uint8Array): SyncFsResult;
|
|
8
|
+
publish?(): void;
|
|
8
9
|
}
|
|
9
10
|
export type AtomicsWaitLike = (typedArray: Int32Array, index: number, value: number, timeout?: number) => 'ok' | 'not-equal' | 'timed-out';
|
|
10
11
|
export declare function exactBody<T extends object>(req: T, transfer?: Transferable[]): {
|
package/dist/types/serve.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type MetaStore } from './fs/meta.js';
|
|
|
4
4
|
import { type Portable } from './fs/portable.js';
|
|
5
5
|
import { type ProtectInit } from './fs/protect.js';
|
|
6
6
|
import { type UsersMode } from './fs/types.js';
|
|
7
|
+
import type { DeviceSpec } from './kernel/devices.js';
|
|
7
8
|
import type { EmbedderKindPolicy } from './kernel/embedder.js';
|
|
8
9
|
import type { WasmWorkerLike } from './kernel/host.js';
|
|
9
10
|
import type { RouteTable } from './kernel/net/routes.js';
|
|
@@ -49,6 +50,7 @@ export interface InitRequest {
|
|
|
49
50
|
sealedFetch?: boolean;
|
|
50
51
|
clipboard?: boolean;
|
|
51
52
|
requests?: Record<string, EmbedderKindPolicy>;
|
|
53
|
+
devices?: boolean;
|
|
52
54
|
approve?: boolean;
|
|
53
55
|
processMounts?: boolean | 'ask';
|
|
54
56
|
cdp?: boolean;
|
|
@@ -103,7 +105,18 @@ export interface ConnectRequest {
|
|
|
103
105
|
user?: string | number;
|
|
104
106
|
tag?: string;
|
|
105
107
|
requests?: Record<string, EmbedderKindPolicy> | 'attach';
|
|
108
|
+
devices?: true | 'attach';
|
|
106
109
|
}
|
|
110
|
+
export type DevicesRequest = {
|
|
111
|
+
id: number;
|
|
112
|
+
op: 'devices-add';
|
|
113
|
+
spec: DeviceSpec;
|
|
114
|
+
client: number;
|
|
115
|
+
} | {
|
|
116
|
+
id: number;
|
|
117
|
+
op: 'devices-remove';
|
|
118
|
+
node: number;
|
|
119
|
+
};
|
|
107
120
|
export type UsersRequest = {
|
|
108
121
|
id: number;
|
|
109
122
|
op: 'users-add';
|
|
@@ -196,7 +209,7 @@ export type KernelRequest = {
|
|
|
196
209
|
id: number;
|
|
197
210
|
op: 'sealed-placeholders';
|
|
198
211
|
list: readonly string[];
|
|
199
|
-
} | AttestRequest | InitRequest | RunRequest | OpenTerminalRequest | SudoRunKernelRequest | TerminalRequest | ConnectRequest | UsersRequest | MountRequest | DialRequest | RoutesRequest | TraitsRequest;
|
|
212
|
+
} | AttestRequest | InitRequest | RunRequest | OpenTerminalRequest | SudoRunKernelRequest | TerminalRequest | ConnectRequest | DevicesRequest | UsersRequest | MountRequest | DialRequest | RoutesRequest | TraitsRequest;
|
|
200
213
|
type WithoutId<T> = T extends unknown ? Omit<T, 'id'> : never;
|
|
201
214
|
export type KernelCall = WithoutId<KernelRequest>;
|
|
202
215
|
export declare function inOpfs(deps: ServeDeps, root: FileSystemDirectoryHandle): Promise<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-kernel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.184.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",
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
"types": "./dist/types/node.d.ts",
|
|
38
38
|
"default": "./dist/node.js"
|
|
39
39
|
},
|
|
40
|
+
"./cloudflare": {
|
|
41
|
+
"types": "./dist/types/cloudflare.d.ts",
|
|
42
|
+
"default": "./dist/cloudflare.js"
|
|
43
|
+
},
|
|
40
44
|
"./driver": {
|
|
41
45
|
"types": "./dist/types/driver.d.ts",
|
|
42
46
|
"default": "./dist/driver.js"
|
|
@@ -62,7 +66,7 @@
|
|
|
62
66
|
"release": "semantic-release",
|
|
63
67
|
"start": "npm run build && node test/integration/chrome.mjs",
|
|
64
68
|
"pretest": "npm run build && slicc-cdp install-browser",
|
|
65
|
-
"test": "node --test --test-timeout=180000 --test-global-setup=node_modules/@ai-ecoverse/slicc-shared-web/harness/global.mjs 'test/integration
|
|
69
|
+
"test": "node --test --test-timeout=180000 --test-global-setup=node_modules/@ai-ecoverse/slicc-shared-web/harness/global.mjs 'test/integration/{,cf/}*.test.mjs'",
|
|
66
70
|
"test:unit": "tools/heavy.sh env NODE_NO_WARNINGS=1 mcr -c node_modules/@ai-ecoverse/slicc-shared-web/mcr.config.mjs node --import fake-indexeddb/auto --test --test-concurrency=2 --test-timeout=180000 'test/unit/**/*.test.mjs'",
|
|
67
71
|
"typecheck": "tsc && tsc -p tsconfig.node.json",
|
|
68
72
|
"lint": "slicc-lint",
|
|
@@ -70,8 +74,8 @@
|
|
|
70
74
|
},
|
|
71
75
|
"devDependencies": {
|
|
72
76
|
"@ai-ecoverse/py-numpy": "2.5.4-4",
|
|
73
|
-
"@ai-ecoverse/slicc-cdp": "1.49.
|
|
74
|
-
"@ai-ecoverse/slicc-scrub": "1.1.
|
|
77
|
+
"@ai-ecoverse/slicc-cdp": "1.49.1",
|
|
78
|
+
"@ai-ecoverse/slicc-scrub": "1.1.1",
|
|
75
79
|
"@ai-ecoverse/slicc-shared-web": "2.14.2",
|
|
76
80
|
"@ai-ecoverse/wasi-cargo": "0.99.0-6",
|
|
77
81
|
"@ai-ecoverse/wasi-pnpm": "12.9.1-21",
|
|
@@ -90,6 +94,7 @@
|
|
|
90
94
|
"@ai-ecoverse/wasm-tls-engine": "4.2.0-12",
|
|
91
95
|
"@ai-ecoverse/wasm-util-linux": "2.42.4-7",
|
|
92
96
|
"@biomejs/biome": "2.6.5",
|
|
97
|
+
"@cloudflare/computer": "0.11.1",
|
|
93
98
|
"@types/node": "26.6.6",
|
|
94
99
|
"acorn": "8.19.0",
|
|
95
100
|
"esbuild": "0.28.2",
|
|
@@ -99,6 +104,7 @@
|
|
|
99
104
|
"pg-gateway": "0.3.0-beta.4",
|
|
100
105
|
"semantic-release": "25.0.9",
|
|
101
106
|
"typescript": "7.0.2",
|
|
102
|
-
"wabt": "1.0.39"
|
|
107
|
+
"wabt": "1.0.39",
|
|
108
|
+
"wrangler": "4.161.0"
|
|
103
109
|
}
|
|
104
110
|
}
|