@ai-ecoverse/slicc-kernel 1.102.5 → 1.103.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 +10 -2
- package/dist/kernel-worker.js +18 -3
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +18 -3
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +1 -1
- package/dist/types/body-idle.d.ts +3 -0
- package/dist/types/bytes.d.ts +1 -0
- package/dist/types/cdp/facade.d.ts +27 -0
- package/dist/types/cdp/hosts.d.ts +14 -0
- package/dist/types/cdp/port.d.ts +24 -0
- package/dist/types/cdp/types.d.ts +12 -0
- package/dist/types/cdp/websocket.d.ts +61 -0
- package/dist/types/client/attach.d.ts +132 -0
- package/dist/types/client/dial-stream.d.ts +23 -0
- package/dist/types/client/loopback-fetch.d.ts +5 -0
- package/dist/types/client/protocol.d.ts +153 -0
- package/dist/types/client/serve-client.d.ts +18 -0
- package/dist/types/clipboard-relay.d.ts +25 -0
- package/dist/types/commands.d.ts +38 -0
- package/dist/types/cron/clock.d.ts +13 -0
- package/dist/types/driver.d.ts +3 -0
- package/dist/types/facade/hosts.d.ts +12 -0
- package/dist/types/facade/port.d.ts +16 -0
- package/dist/types/facade/types.d.ts +23 -0
- package/dist/types/fs/access.d.ts +29 -0
- package/dist/types/fs/attest.d.ts +41 -0
- package/dist/types/fs/changes.d.ts +19 -0
- package/dist/types/fs/commands.d.ts +4 -0
- package/dist/types/fs/dac.d.ts +64 -0
- package/dist/types/fs/dev-removal.d.ts +9 -0
- package/dist/types/fs/fresh-modules.d.ts +9 -0
- package/dist/types/fs/integrity.d.ts +53 -0
- package/dist/types/fs/meta.d.ts +85 -0
- package/dist/types/fs/opfs.d.ts +141 -0
- package/dist/types/fs/owners.d.ts +17 -0
- package/dist/types/fs/pages.d.ts +41 -0
- package/dist/types/fs/path-map.d.ts +16 -0
- package/dist/types/fs/physical-path.d.ts +14 -0
- package/dist/types/fs/protect.d.ts +27 -0
- package/dist/types/fs/ranged.d.ts +73 -0
- package/dist/types/fs/remote.d.ts +45 -0
- package/dist/types/fs/types.d.ts +115 -0
- package/dist/types/fs/unlinked.d.ts +75 -0
- package/dist/types/fs/view.d.ts +1 -0
- package/dist/types/fs/walk.d.ts +12 -0
- package/dist/types/fs/watch.d.ts +23 -0
- package/dist/types/index.d.ts +159 -0
- package/dist/types/integrity-relay.d.ts +18 -0
- package/dist/types/kernel/children.d.ts +90 -0
- package/dist/types/kernel/clipboard.d.ts +49 -0
- package/dist/types/kernel/cpu-clock.d.ts +56 -0
- package/dist/types/kernel/cred.d.ts +17 -0
- package/dist/types/kernel/dgram.d.ts +56 -0
- package/dist/types/kernel/dial.d.ts +20 -0
- package/dist/types/kernel/epoll.d.ts +67 -0
- package/dist/types/kernel/eventfd.d.ts +19 -0
- package/dist/types/kernel/exec-ticket.d.ts +25 -0
- package/dist/types/kernel/fd-table.d.ts +107 -0
- package/dist/types/kernel/host-ops.d.ts +98 -0
- package/dist/types/kernel/host.d.ts +116 -0
- package/dist/types/kernel/jobs.d.ts +50 -0
- package/dist/types/kernel/locks.d.ts +40 -0
- package/dist/types/kernel/net/datagram-wire.d.ts +8 -0
- package/dist/types/kernel/net/http-syscalls.d.ts +58 -0
- package/dist/types/kernel/net/http1.d.ts +48 -0
- package/dist/types/kernel/net/loopback-names.d.ts +14 -0
- package/dist/types/kernel/net/loopback-transport.d.ts +13 -0
- package/dist/types/kernel/net/network.d.ts +29 -0
- package/dist/types/kernel/net/proxy-service.d.ts +70 -0
- package/dist/types/kernel/net/realm-ca.d.ts +28 -0
- package/dist/types/kernel/net/redirect-hops.d.ts +5 -0
- package/dist/types/kernel/net/remote-transport.d.ts +98 -0
- package/dist/types/kernel/net/resolver.d.ts +29 -0
- package/dist/types/kernel/net/routes.d.ts +15 -0
- package/dist/types/kernel/net/tls-engine.d.ts +46 -0
- package/dist/types/kernel/net/tls-tunnel.d.ts +35 -0
- package/dist/types/kernel/net/transport.d.ts +64 -0
- package/dist/types/kernel/net/uplink-socket.d.ts +11 -0
- package/dist/types/kernel/net/uplink.d.ts +163 -0
- package/dist/types/kernel/net/ws-queue.d.ts +21 -0
- package/dist/types/kernel/net/ws-syscalls.d.ts +45 -0
- package/dist/types/kernel/net/x509.d.ts +34 -0
- package/dist/types/kernel/pipe.d.ts +29 -0
- package/dist/types/kernel/proc-info.d.ts +44 -0
- package/dist/types/kernel/process.d.ts +525 -0
- package/dist/types/kernel/protocol.d.ts +126 -0
- package/dist/types/kernel/pty.d.ts +84 -0
- package/dist/types/kernel/run-child.d.ts +39 -0
- package/dist/types/kernel/scrub-file.d.ts +13 -0
- package/dist/types/kernel/sealed.d.ts +74 -0
- package/dist/types/kernel/select.d.ts +7 -0
- package/dist/types/kernel/sem.d.ts +72 -0
- package/dist/types/kernel/settling.d.ts +16 -0
- package/dist/types/kernel/signals.d.ts +44 -0
- package/dist/types/kernel/socket-syscalls.d.ts +74 -0
- package/dist/types/kernel/socket.d.ts +125 -0
- package/dist/types/kernel/timer.d.ts +4 -0
- package/dist/types/kernel/tty.d.ts +53 -0
- package/dist/types/kernel/vfs-file.d.ts +149 -0
- package/dist/types/launcher.d.ts +359 -0
- package/dist/types/local-proxy-transport.d.ts +39 -0
- package/dist/types/meta.d.ts +11 -0
- package/dist/types/mount/chunked.d.ts +9 -0
- package/dist/types/mount/connection.d.ts +35 -0
- package/dist/types/mount/driver.d.ts +50 -0
- package/dist/types/mount/fsa.d.ts +26 -0
- package/dist/types/mount/fstab.d.ts +17 -0
- package/dist/types/mount/host.d.ts +24 -0
- package/dist/types/mount/hostfs.d.ts +129 -0
- package/dist/types/mount/media.d.ts +8 -0
- package/dist/types/mount/medium.d.ts +12 -0
- package/dist/types/mount/mount-fs.d.ts +136 -0
- package/dist/types/mount/protocol.d.ts +140 -0
- package/dist/types/mount/syscall.d.ts +27 -0
- package/dist/types/mount/tmpfs.d.ts +2 -0
- package/dist/types/node/loopback.d.ts +11 -0
- package/dist/types/node/memory-root.d.ts +2 -0
- package/dist/types/node/ws-diagnose.d.ts +4 -0
- package/dist/types/node.d.ts +85 -0
- package/dist/types/process/fd-metadata.d.ts +4 -0
- package/dist/types/process/js/async-sab.d.ts +15 -0
- package/dist/types/process/js/js-children.d.ts +63 -0
- package/dist/types/process/js/js-context.d.ts +133 -0
- package/dist/types/process/js/js-dev.d.ts +50 -0
- package/dist/types/process/js/js-exit.d.ts +15 -0
- package/dist/types/process/js/js-fetch.d.ts +2 -0
- package/dist/types/process/js/js-io.d.ts +81 -0
- package/dist/types/process/js/js-kernel.d.ts +61 -0
- package/dist/types/process/js/js-net.d.ts +42 -0
- package/dist/types/process/js/js-proc.d.ts +31 -0
- package/dist/types/process/js/js-run.d.ts +35 -0
- package/dist/types/process/js/js-sync.d.ts +86 -0
- package/dist/types/process/js/js-tty.d.ts +30 -0
- package/dist/types/process/js/js-websocket.d.ts +21 -0
- package/dist/types/process/kernel-streams.d.ts +196 -0
- package/dist/types/process/process-fds.d.ts +95 -0
- package/dist/types/process/process-locks.d.ts +29 -0
- package/dist/types/process/process-pty.d.ts +20 -0
- package/dist/types/process/process-signals.d.ts +33 -0
- package/dist/types/process/procfs.d.ts +41 -0
- package/dist/types/process/wasi/dylink.d.ts +9 -0
- package/dist/types/process/wasi/slicc-lock.d.ts +26 -0
- package/dist/types/process/wasi/slicc-sem.d.ts +3 -0
- package/dist/types/process/wasi/wasi-abi.d.ts +156 -0
- package/dist/types/process/wasi/wasi-fds.d.ts +130 -0
- package/dist/types/process/wasi/wasi-files.d.ts +99 -0
- package/dist/types/process/wasi/wasi-host.d.ts +104 -0
- package/dist/types/process/wasi/wasi-memory.d.ts +16 -0
- package/dist/types/process/wasi/wasi-module.d.ts +13 -0
- package/dist/types/process/wasi/wasi-poll.d.ts +13 -0
- package/dist/types/process/wasi/wasi-procfs.d.ts +36 -0
- package/dist/types/process/wasi/wasi-sigmask.d.ts +19 -0
- package/dist/types/process/wasi/wasi-signals.d.ts +43 -0
- package/dist/types/process/wasi/wasi-termios.d.ts +10 -0
- package/dist/types/process/wasi/wasix-fork.d.ts +63 -0
- package/dist/types/process/wasi/wasix-linker.d.ts +108 -0
- package/dist/types/process/wasi/wasix-sockets.d.ts +9 -0
- package/dist/types/process/wasi/wasix-trampoline.d.ts +18 -0
- package/dist/types/process/wasi/wasm-functypes.d.ts +25 -0
- package/dist/types/process/wasi-errno.d.ts +1 -0
- package/dist/types/realm/emscripten-vfs-hook.d.ts +19 -0
- package/dist/types/realm/live-vfs-fs.d.ts +186 -0
- package/dist/types/realm/sync-fs-dispatch.d.ts +26 -0
- package/dist/types/realm/sync-fs-token-registry.d.ts +36 -0
- package/dist/types/realm/sync-fs-wire.d.ts +118 -0
- package/dist/types/realm/sync-sab-bridge.d.ts +21 -0
- package/dist/types/realm/sync-sab-responder.d.ts +16 -0
- package/dist/types/realm/sync-sab-wire.d.ts +64 -0
- package/dist/types/sealed-relay.d.ts +26 -0
- package/dist/types/serve.d.ts +190 -0
- package/dist/types/sudo-command.d.ts +4 -0
- package/dist/types/sudo.d.ts +105 -0
- package/dist/types/testing.d.ts +46 -0
- package/dist/types/transport.d.ts +25 -0
- package/dist/types/users.d.ts +86 -0
- package/dist/types/version.d.ts +3 -0
- package/dist/types/websocket-transport.d.ts +12 -0
- package/package.json +22 -6
package/dist/process-worker.js
CHANGED
|
@@ -2484,7 +2484,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
2484
2484
|
var init_version = __esm({
|
|
2485
2485
|
"src/version.ts"() {
|
|
2486
2486
|
"use strict";
|
|
2487
|
-
KERNEL_VERSION = true ? "1.
|
|
2487
|
+
KERNEL_VERSION = true ? "1.103.0" : "0.0.0-dev";
|
|
2488
2488
|
OS_RELEASE = "6.0.0-slicc";
|
|
2489
2489
|
}
|
|
2490
2490
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fresh(bytes: Uint8Array, start?: number, end?: number): Uint8Array;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { LoopbackNet } from '../kernel/socket.js';
|
|
2
|
+
import type { CdpHosts } from './hosts.js';
|
|
3
|
+
export interface CdpFacadeOptions {
|
|
4
|
+
net: LoopbackNet;
|
|
5
|
+
hosts: CdpHosts;
|
|
6
|
+
port?: number;
|
|
7
|
+
maxMessage?: number;
|
|
8
|
+
closeWaitMs?: number;
|
|
9
|
+
listTimeout?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class CdpFacade {
|
|
12
|
+
private readonly options;
|
|
13
|
+
private readonly listener;
|
|
14
|
+
private readonly stop;
|
|
15
|
+
private readonly connections;
|
|
16
|
+
readonly closed: Promise<void>;
|
|
17
|
+
constructor(options: CdpFacadeOptions);
|
|
18
|
+
close(): void;
|
|
19
|
+
private acceptLoop;
|
|
20
|
+
private serve;
|
|
21
|
+
private write;
|
|
22
|
+
private route;
|
|
23
|
+
private list;
|
|
24
|
+
private host;
|
|
25
|
+
private upgrade;
|
|
26
|
+
}
|
|
27
|
+
export declare function enableCdp(net: LoopbackNet, hosts: CdpHosts): () => CdpFacade | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CdpConnection, type CdpHook, type CdpRequest } from './types.js';
|
|
2
|
+
export declare class CdpHosts {
|
|
3
|
+
private readonly embedder;
|
|
4
|
+
private readonly clients;
|
|
5
|
+
private closed;
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly url: string;
|
|
8
|
+
constructor(hook?: CdpHook);
|
|
9
|
+
register(hook: CdpHook, runtime?: string): () => void;
|
|
10
|
+
private pick;
|
|
11
|
+
available(runtime?: string): boolean;
|
|
12
|
+
connect(request: CdpRequest): Promise<CdpConnection>;
|
|
13
|
+
close(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CdpHook, CdpRequest } from './types.js';
|
|
2
|
+
export interface CdpPortLike {
|
|
3
|
+
postMessage(message: unknown): void;
|
|
4
|
+
addEventListener(type: 'message', handler: (event: MessageEvent) => void): void;
|
|
5
|
+
start?(): void;
|
|
6
|
+
close(): void;
|
|
7
|
+
}
|
|
8
|
+
export type CdpWire = {
|
|
9
|
+
open: true;
|
|
10
|
+
} | {
|
|
11
|
+
error: string;
|
|
12
|
+
} | {
|
|
13
|
+
m: string;
|
|
14
|
+
} | {
|
|
15
|
+
close: string | null;
|
|
16
|
+
};
|
|
17
|
+
export interface CdpOpen {
|
|
18
|
+
cdpOpen: CdpRequest & {
|
|
19
|
+
registration?: number;
|
|
20
|
+
};
|
|
21
|
+
port: CdpPortLike;
|
|
22
|
+
}
|
|
23
|
+
export declare function serveCdpPort(port: CdpPortLike, hook: CdpHook, request: CdpRequest, onDone?: () => void): () => void;
|
|
24
|
+
export declare function portCdpHook(ask: (request: CdpRequest, port: CdpPortLike) => void, gone?: Promise<unknown>): CdpHook;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CdpConnection {
|
|
2
|
+
send(message: string): void;
|
|
3
|
+
onmessage: ((message: string) => void) | null;
|
|
4
|
+
onclose: ((reason?: string) => void) | null;
|
|
5
|
+
close(): void;
|
|
6
|
+
}
|
|
7
|
+
export interface CdpRequest {
|
|
8
|
+
runtime?: string;
|
|
9
|
+
}
|
|
10
|
+
export type CdpHook = (request: CdpRequest) => Promise<CdpConnection>;
|
|
11
|
+
export declare const CDP_PORT = 9222;
|
|
12
|
+
export declare const NO_CDP_HOST = "slicc-kernel: no CDP host is attached (createKernel({ cdp }) or client.serveCdp)";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type Incoming } from '../kernel/net/http1.js';
|
|
2
|
+
import type { HeaderList } from '../kernel/net/transport.js';
|
|
3
|
+
export declare const MAX_MESSAGE: number;
|
|
4
|
+
export declare const CLOSE: {
|
|
5
|
+
readonly normal: 1000;
|
|
6
|
+
readonly protocol: 1002;
|
|
7
|
+
readonly unsupported: 1003;
|
|
8
|
+
readonly invalid: 1007;
|
|
9
|
+
readonly tooBig: 1009;
|
|
10
|
+
readonly error: 1011;
|
|
11
|
+
};
|
|
12
|
+
export declare const OP_TEXT = 1;
|
|
13
|
+
export declare const OP_BINARY = 2;
|
|
14
|
+
export interface Sink {
|
|
15
|
+
write(bytes: Uint8Array, signal?: AbortSignal): Promise<unknown>;
|
|
16
|
+
}
|
|
17
|
+
export type WsEvent = {
|
|
18
|
+
kind: 'text';
|
|
19
|
+
text: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'ping';
|
|
22
|
+
payload: Uint8Array;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'close';
|
|
25
|
+
code: number;
|
|
26
|
+
reason: string;
|
|
27
|
+
};
|
|
28
|
+
export type WsBinaryEvent = {
|
|
29
|
+
kind: 'binary';
|
|
30
|
+
bytes: Uint8Array;
|
|
31
|
+
};
|
|
32
|
+
export declare class WsError extends Error {
|
|
33
|
+
readonly code: number;
|
|
34
|
+
constructor(code: number, message: string);
|
|
35
|
+
}
|
|
36
|
+
export declare function sendableCode(code: number): boolean;
|
|
37
|
+
export declare function acceptKey(headers: HeaderList): Promise<string>;
|
|
38
|
+
export declare function acceptFor(key: string): Promise<string>;
|
|
39
|
+
export declare function isUpgrade(headers: HeaderList): boolean;
|
|
40
|
+
export declare function frame(opcode: number, payload: Uint8Array): Uint8Array;
|
|
41
|
+
export declare function clientFrame(opcode: number, payload: Uint8Array): Uint8Array;
|
|
42
|
+
export declare function closeFrame(code: number, reason?: string): Uint8Array;
|
|
43
|
+
export declare function pongFrame(payload: Uint8Array): Uint8Array;
|
|
44
|
+
export declare class WsReader<Binary extends boolean = false> {
|
|
45
|
+
private readonly incoming;
|
|
46
|
+
private readonly max;
|
|
47
|
+
private parts;
|
|
48
|
+
private size;
|
|
49
|
+
private continuing;
|
|
50
|
+
private binaryMessage;
|
|
51
|
+
private readonly binary;
|
|
52
|
+
private readonly fromServer;
|
|
53
|
+
constructor(incoming: Incoming, max?: number, binary?: Binary, fromServer?: boolean);
|
|
54
|
+
next(signal?: AbortSignal): Promise<WsEvent | (Binary extends true ? WsBinaryEvent : never) | null>;
|
|
55
|
+
private masking;
|
|
56
|
+
private data;
|
|
57
|
+
private payload;
|
|
58
|
+
private length;
|
|
59
|
+
private take;
|
|
60
|
+
}
|
|
61
|
+
export declare function switchingHead(accept: string, protocol?: string): Uint8Array;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { CdpHook } from '../cdp/types.js';
|
|
2
|
+
import type { FacadeHook } from '../facade/types.js';
|
|
3
|
+
import type { FsStat, UsersMode } from '../fs/types.js';
|
|
4
|
+
import type { WatchChange } from '../fs/watch.js';
|
|
5
|
+
import type { RealmTransport, RealmTransportRequest, RealmTransportResponse, RealmTransportTraits } from '../kernel/net/transport.js';
|
|
6
|
+
import type { MountEntry, MountSpec } from '../mount/mount-fs.js';
|
|
7
|
+
import { type DialledSocket, type DialOptions } from './dial-stream.js';
|
|
8
|
+
import { type LoopbackFetchOptions } from './loopback-fetch.js';
|
|
9
|
+
import { type LockManagerLike, type MessagePortLike, type ProcessEntry } from './protocol.js';
|
|
10
|
+
export type { WatchChange } from '../fs/watch.js';
|
|
11
|
+
export type { ProcessEntry } from './protocol.js';
|
|
12
|
+
export declare class KernelGoneError extends Error {
|
|
13
|
+
constructor(message?: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class KernelCallError extends Error {
|
|
16
|
+
readonly code: string | undefined;
|
|
17
|
+
constructor(message: string, code?: string);
|
|
18
|
+
}
|
|
19
|
+
export interface AttachOptions {
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
locks?: LockManagerLike | null;
|
|
22
|
+
}
|
|
23
|
+
export interface SpawnOptions {
|
|
24
|
+
cwd?: string;
|
|
25
|
+
user?: string | number;
|
|
26
|
+
env?: Record<string, string>;
|
|
27
|
+
stdin?: string | Uint8Array;
|
|
28
|
+
group?: 'new';
|
|
29
|
+
pgid?: number;
|
|
30
|
+
onStdout?: (bytes: Uint8Array) => void;
|
|
31
|
+
onStderr?: (bytes: Uint8Array) => void;
|
|
32
|
+
}
|
|
33
|
+
export interface ClientEnded {
|
|
34
|
+
status: number;
|
|
35
|
+
signal?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface SpawnedProcess {
|
|
38
|
+
readonly pid: number;
|
|
39
|
+
readonly pgid: number;
|
|
40
|
+
readonly exited: Promise<number>;
|
|
41
|
+
readonly ended: Promise<ClientEnded>;
|
|
42
|
+
signal(name?: string): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
export interface ClientRunOptions {
|
|
45
|
+
cwd?: string;
|
|
46
|
+
user?: string | number;
|
|
47
|
+
env?: Record<string, string>;
|
|
48
|
+
stdin?: string | Uint8Array;
|
|
49
|
+
onStdout?: (text: string) => void;
|
|
50
|
+
onStderr?: (text: string) => void;
|
|
51
|
+
}
|
|
52
|
+
export interface ClientRunResult {
|
|
53
|
+
pid: number;
|
|
54
|
+
status: number;
|
|
55
|
+
signal?: string;
|
|
56
|
+
stdout: string;
|
|
57
|
+
stderr: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ClientTerminalOptions {
|
|
60
|
+
cwd?: string;
|
|
61
|
+
user?: string | number;
|
|
62
|
+
env?: Record<string, string>;
|
|
63
|
+
cols?: number;
|
|
64
|
+
rows?: number;
|
|
65
|
+
onData?: (bytes: Uint8Array) => void;
|
|
66
|
+
}
|
|
67
|
+
export interface ClientTerminal {
|
|
68
|
+
readonly pid: number;
|
|
69
|
+
readonly exited: Promise<number>;
|
|
70
|
+
readonly ended: Promise<ClientEnded>;
|
|
71
|
+
onData: ((bytes: Uint8Array) => void) | null;
|
|
72
|
+
write(data: string | Uint8Array): void;
|
|
73
|
+
resize(cols: number, rows: number): void;
|
|
74
|
+
signal(name: string): void;
|
|
75
|
+
close(): void;
|
|
76
|
+
}
|
|
77
|
+
export interface ClientFs {
|
|
78
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
79
|
+
readText(path: string): Promise<string>;
|
|
80
|
+
writeFile(path: string, data: string | Uint8Array): Promise<void>;
|
|
81
|
+
stat(path: string): Promise<FsStat>;
|
|
82
|
+
lstat(path: string): Promise<FsStat>;
|
|
83
|
+
readdir(path: string): Promise<string[]>;
|
|
84
|
+
mkdir(path: string): Promise<void>;
|
|
85
|
+
rm(path: string, options?: {
|
|
86
|
+
force?: boolean;
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
rename(from: string, to: string): Promise<void>;
|
|
89
|
+
realpath(path: string): Promise<string>;
|
|
90
|
+
symlink(target: string, path: string): Promise<void>;
|
|
91
|
+
readlink(path: string): Promise<string>;
|
|
92
|
+
exists(path: string): Promise<boolean>;
|
|
93
|
+
watch(paths: string[], options: {
|
|
94
|
+
recursive?: boolean;
|
|
95
|
+
}, onChange: (change: WatchChange) => void): Promise<{
|
|
96
|
+
close(): void;
|
|
97
|
+
}>;
|
|
98
|
+
}
|
|
99
|
+
export type ClientFetchRequest = Omit<RealmTransportRequest, 'signal'> & {
|
|
100
|
+
signal?: AbortSignal;
|
|
101
|
+
};
|
|
102
|
+
export interface KernelClient {
|
|
103
|
+
readonly protocol: readonly [number, number];
|
|
104
|
+
readonly transport: RealmTransport;
|
|
105
|
+
readonly users: UsersMode;
|
|
106
|
+
readonly closed: Promise<Error>;
|
|
107
|
+
spawn(argv: string[], options?: SpawnOptions): Promise<SpawnedProcess>;
|
|
108
|
+
run(argv: string[], options?: ClientRunOptions): Promise<ClientRunResult>;
|
|
109
|
+
openTerminal(argv: string[], options?: ClientTerminalOptions): Promise<ClientTerminal>;
|
|
110
|
+
ps(): Promise<ProcessEntry[]>;
|
|
111
|
+
mount(spec: MountSpec): Promise<MountEntry>;
|
|
112
|
+
umount(target: string): Promise<void>;
|
|
113
|
+
mounts(): Promise<MountEntry[]>;
|
|
114
|
+
kill(pid: number, signal?: string): Promise<void>;
|
|
115
|
+
fetch(request: ClientFetchRequest): Promise<RealmTransportResponse>;
|
|
116
|
+
dial(options: DialOptions): Promise<DialledSocket>;
|
|
117
|
+
loopbackFetch(input: RequestInfo | URL, options: LoopbackFetchOptions): Promise<Response>;
|
|
118
|
+
readonly fs: ClientFs;
|
|
119
|
+
serveCdp(hook: CdpHook, options?: {
|
|
120
|
+
runtime?: string;
|
|
121
|
+
}): Promise<{
|
|
122
|
+
close(): void;
|
|
123
|
+
}>;
|
|
124
|
+
serveFacade(name: string, hook: FacadeHook): Promise<{
|
|
125
|
+
close(): void;
|
|
126
|
+
}>;
|
|
127
|
+
onTraits(listener: (traits: RealmTransportTraits) => void): () => void;
|
|
128
|
+
close(options?: {
|
|
129
|
+
kill?: boolean;
|
|
130
|
+
}): Promise<void>;
|
|
131
|
+
}
|
|
132
|
+
export declare function attachKernel(port: MessagePortLike, options?: AttachOptions): Promise<KernelClient>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface DialledSocket {
|
|
2
|
+
readable: ReadableStream<Uint8Array>;
|
|
3
|
+
writable: WritableStream<Uint8Array>;
|
|
4
|
+
close(): void;
|
|
5
|
+
}
|
|
6
|
+
export interface DialOptions {
|
|
7
|
+
port: number;
|
|
8
|
+
host?: string;
|
|
9
|
+
}
|
|
10
|
+
interface StreamPort {
|
|
11
|
+
postMessage(message: unknown, transfer?: Transferable[]): void;
|
|
12
|
+
addEventListener(type: 'message', handler: (event: MessageEvent) => void): void;
|
|
13
|
+
start?(): void;
|
|
14
|
+
close(): void;
|
|
15
|
+
}
|
|
16
|
+
export interface DialHandle extends DialledSocket {
|
|
17
|
+
fail(error: Error): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function errorWithCode(message: string): Error & {
|
|
20
|
+
code?: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function dialStream(port: StreamPort, onClose?: () => void): DialHandle;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DialledSocket, type DialOptions } from './dial-stream.js';
|
|
2
|
+
export interface LoopbackFetchOptions extends DialOptions {
|
|
3
|
+
signal?: AbortSignal;
|
|
4
|
+
}
|
|
5
|
+
export declare function loopbackFetch(dial: (options: DialOptions) => Promise<DialledSocket>, input: RequestInfo | URL, options: LoopbackFetchOptions): Promise<Response>;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { UsersMode } from '../fs/types.js';
|
|
2
|
+
import type { WatchChange } from '../fs/watch.js';
|
|
3
|
+
import type { TransportCall, TransportReply } from '../kernel/net/remote-transport.js';
|
|
4
|
+
import type { RealmTransportTraits } from '../kernel/net/transport.js';
|
|
5
|
+
import type { MountSpec } from '../mount/mount-fs.js';
|
|
6
|
+
export declare const PROTOCOL: readonly [number, number];
|
|
7
|
+
export interface ClientHello {
|
|
8
|
+
protocol: readonly [number, number];
|
|
9
|
+
lock?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface KernelHello {
|
|
12
|
+
protocol: readonly [number, number];
|
|
13
|
+
lock?: string;
|
|
14
|
+
traits?: RealmTransportTraits;
|
|
15
|
+
users?: UsersMode;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SpawnRequestOptions {
|
|
19
|
+
cwd?: string;
|
|
20
|
+
user?: string | number;
|
|
21
|
+
env?: Record<string, string>;
|
|
22
|
+
stdin?: Uint8Array;
|
|
23
|
+
pgid?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface TerminalRequestOptions {
|
|
26
|
+
cwd?: string;
|
|
27
|
+
user?: string | number;
|
|
28
|
+
env?: Record<string, string>;
|
|
29
|
+
cols?: number;
|
|
30
|
+
rows?: number;
|
|
31
|
+
}
|
|
32
|
+
export type TerminalAction = {
|
|
33
|
+
action: 'write';
|
|
34
|
+
bytes: Uint8Array;
|
|
35
|
+
} | {
|
|
36
|
+
action: 'resize';
|
|
37
|
+
cols: number;
|
|
38
|
+
rows: number;
|
|
39
|
+
} | {
|
|
40
|
+
action: 'signal';
|
|
41
|
+
signal: string;
|
|
42
|
+
} | {
|
|
43
|
+
action: 'close';
|
|
44
|
+
};
|
|
45
|
+
export declare const FS_METHODS: readonly ['readFile', 'writeFile', 'stat', 'lstat', 'readdir', 'mkdir', 'rm', 'rename', 'realpath', 'symlink', 'readlink', 'exists'];
|
|
46
|
+
export type FsMethod = (typeof FS_METHODS)[number];
|
|
47
|
+
export type ClientCall = {
|
|
48
|
+
op: 'spawn';
|
|
49
|
+
argv: string[];
|
|
50
|
+
options: SpawnRequestOptions;
|
|
51
|
+
} | {
|
|
52
|
+
op: 'open-terminal';
|
|
53
|
+
argv: string[];
|
|
54
|
+
options: TerminalRequestOptions;
|
|
55
|
+
} | ({
|
|
56
|
+
op: 'terminal';
|
|
57
|
+
terminal: number;
|
|
58
|
+
} & TerminalAction) | {
|
|
59
|
+
op: 'kill';
|
|
60
|
+
pid: number;
|
|
61
|
+
signal: string;
|
|
62
|
+
} | {
|
|
63
|
+
op: 'ps';
|
|
64
|
+
} | {
|
|
65
|
+
op: 'fs';
|
|
66
|
+
method: FsMethod;
|
|
67
|
+
args: unknown[];
|
|
68
|
+
} | {
|
|
69
|
+
op: 'watch';
|
|
70
|
+
paths: string[];
|
|
71
|
+
recursive: boolean;
|
|
72
|
+
} | {
|
|
73
|
+
op: 'unwatch';
|
|
74
|
+
watch: number;
|
|
75
|
+
} | {
|
|
76
|
+
op: 'mount';
|
|
77
|
+
spec: MountSpec;
|
|
78
|
+
} | {
|
|
79
|
+
op: 'umount';
|
|
80
|
+
target: string;
|
|
81
|
+
} | {
|
|
82
|
+
op: 'mounts';
|
|
83
|
+
} | {
|
|
84
|
+
op: 'dial';
|
|
85
|
+
port: number;
|
|
86
|
+
host?: string;
|
|
87
|
+
} | {
|
|
88
|
+
op: 'serve-cdp';
|
|
89
|
+
runtime?: string;
|
|
90
|
+
} | {
|
|
91
|
+
op: 'unserve-cdp';
|
|
92
|
+
registration: number;
|
|
93
|
+
} | {
|
|
94
|
+
op: 'serve-facade';
|
|
95
|
+
name: string;
|
|
96
|
+
} | {
|
|
97
|
+
op: 'unserve-facade';
|
|
98
|
+
registration: number;
|
|
99
|
+
} | {
|
|
100
|
+
op: 'detach';
|
|
101
|
+
kill?: boolean;
|
|
102
|
+
};
|
|
103
|
+
export type ClientRequest = ClientCall & {
|
|
104
|
+
id: number;
|
|
105
|
+
};
|
|
106
|
+
export interface ClientReply {
|
|
107
|
+
id: number;
|
|
108
|
+
result?: unknown;
|
|
109
|
+
error?: string;
|
|
110
|
+
code?: string;
|
|
111
|
+
fd?: 1 | 2;
|
|
112
|
+
bytes?: Uint8Array;
|
|
113
|
+
started?: number;
|
|
114
|
+
signal?: string;
|
|
115
|
+
}
|
|
116
|
+
export type ClientMessage = {
|
|
117
|
+
hello: ClientHello;
|
|
118
|
+
} | ClientRequest | TransportCall;
|
|
119
|
+
export interface WatchEvent {
|
|
120
|
+
watch: number;
|
|
121
|
+
change: WatchChange;
|
|
122
|
+
}
|
|
123
|
+
export type KernelMessage = {
|
|
124
|
+
hello: KernelHello;
|
|
125
|
+
} | ClientReply | WatchEvent | TransportReply;
|
|
126
|
+
export interface ProcessEntry {
|
|
127
|
+
pid: number;
|
|
128
|
+
ppid: number;
|
|
129
|
+
pgid: number;
|
|
130
|
+
sid: number;
|
|
131
|
+
argv: string[];
|
|
132
|
+
tty: string | null;
|
|
133
|
+
started: number;
|
|
134
|
+
state: 'S' | 'T' | 'Z';
|
|
135
|
+
memory: number;
|
|
136
|
+
rss?: number;
|
|
137
|
+
utime?: number;
|
|
138
|
+
stime?: number;
|
|
139
|
+
uid?: number;
|
|
140
|
+
gid?: number;
|
|
141
|
+
tag?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface MessagePortLike {
|
|
144
|
+
postMessage(message: unknown, transfer?: Transferable[]): void;
|
|
145
|
+
addEventListener(type: 'message' | 'close', handler: (event: MessageEvent) => void): void;
|
|
146
|
+
start?(): void;
|
|
147
|
+
close?(): void;
|
|
148
|
+
}
|
|
149
|
+
export interface LockManagerLike {
|
|
150
|
+
request(name: string, callback: () => Promise<unknown> | unknown): Promise<unknown>;
|
|
151
|
+
}
|
|
152
|
+
export declare function locksOf(scope?: object): LockManagerLike | undefined;
|
|
153
|
+
export declare function versionError(theirs: unknown): string | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RealmTransport } from '../kernel/net/transport.js';
|
|
2
|
+
import type { Launcher } from '../launcher.js';
|
|
3
|
+
import { type LockManagerLike, type MessagePortLike } from './protocol.js';
|
|
4
|
+
export interface ClientHost {
|
|
5
|
+
scope?: 'transport';
|
|
6
|
+
launcher: () => Promise<Launcher>;
|
|
7
|
+
transport?: () => RealmTransport;
|
|
8
|
+
locks?: LockManagerLike;
|
|
9
|
+
lock?: string;
|
|
10
|
+
signal?: (name: string) => number;
|
|
11
|
+
user?: string | number;
|
|
12
|
+
tag?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ServedClient {
|
|
15
|
+
detach(kill?: boolean): void;
|
|
16
|
+
readonly closed: Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function serveClient(port: MessagePortLike, host: ClientHost): ServedClient;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ClipboardHook, type ClipboardStamp } from './kernel/clipboard.js';
|
|
2
|
+
export interface ClipboardPort {
|
|
3
|
+
postMessage(message: unknown): void;
|
|
4
|
+
}
|
|
5
|
+
export interface ClipboardAsk {
|
|
6
|
+
id: number;
|
|
7
|
+
op: 'read' | 'write';
|
|
8
|
+
text?: string;
|
|
9
|
+
stamp: ClipboardStamp;
|
|
10
|
+
}
|
|
11
|
+
export interface ClipboardReply {
|
|
12
|
+
id: number;
|
|
13
|
+
text?: string;
|
|
14
|
+
error?: {
|
|
15
|
+
name: string;
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare function clipboardAsker(port: ClipboardPort): {
|
|
20
|
+
hook: ClipboardHook;
|
|
21
|
+
answer(reply: ClipboardReply): void;
|
|
22
|
+
};
|
|
23
|
+
export declare function clipboardAnswerer(port: ClipboardPort, hook: ClipboardHook | undefined): {
|
|
24
|
+
handle(data: unknown): boolean;
|
|
25
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type KernelFs } from './fs/types.js';
|
|
2
|
+
export type Abi = 'emscripten' | 'wasi' | 'js';
|
|
3
|
+
export interface Command {
|
|
4
|
+
name: string;
|
|
5
|
+
abi: Abi;
|
|
6
|
+
glue: string;
|
|
7
|
+
wasm: string;
|
|
8
|
+
argv0: string;
|
|
9
|
+
argv0Path?: boolean;
|
|
10
|
+
argv0Fixed?: true;
|
|
11
|
+
preopenRoot?: boolean;
|
|
12
|
+
args?: string[];
|
|
13
|
+
env?: Record<string, string>;
|
|
14
|
+
unset?: string[];
|
|
15
|
+
script?: string;
|
|
16
|
+
bin?: true;
|
|
17
|
+
imports?: string;
|
|
18
|
+
}
|
|
19
|
+
interface Manifest {
|
|
20
|
+
name?: unknown;
|
|
21
|
+
bin?: unknown;
|
|
22
|
+
slicc?: {
|
|
23
|
+
abi?: unknown;
|
|
24
|
+
commands?: unknown;
|
|
25
|
+
env?: unknown;
|
|
26
|
+
filesystems?: unknown;
|
|
27
|
+
binfmt?: unknown;
|
|
28
|
+
replaces?: unknown;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare function commandsOf(pkg: string, manifest: Manifest): Command[];
|
|
32
|
+
export declare function pnpmGlobalRoots(fs: KernelFs, home: string): Promise<string[]>;
|
|
33
|
+
export declare function scanCommands(fs: KernelFs, modules: string | (string | string[])[], binsFrom?: number): Promise<Map<string, Command>>;
|
|
34
|
+
export declare function scanFilesystems(fs: KernelFs, modules: string | string[]): Promise<Map<string, string>>;
|
|
35
|
+
export declare function scanBinfmts(fs: KernelFs, modules: string | string[], warn?: (message: string) => void, owners?: Map<string, string>): Promise<Map<string, string>>;
|
|
36
|
+
export declare function binfmtSuffix(binfmts: ReadonlyMap<string, string>, path: string): string | undefined;
|
|
37
|
+
export declare function binfmtOf(binfmts: ReadonlyMap<string, string>, path: string): string | undefined;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface CronClock {
|
|
2
|
+
now(): number;
|
|
3
|
+
readonly utc?: boolean;
|
|
4
|
+
sleep(until: number, signal: AbortSignal): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare const systemCronClock: CronClock;
|
|
7
|
+
export interface FakeCronClock extends CronClock {
|
|
8
|
+
set(ms: number): void;
|
|
9
|
+
advance(ms: number): void;
|
|
10
|
+
flush(): Promise<void>;
|
|
11
|
+
readonly sleepers: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function fakeCronClock(start?: number, utc?: boolean): FakeCronClock;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { type DriverPort, type FilesystemHandlers, fsError, type OpenFlags, type ServedFilesystem, serveFilesystem, } from './mount/driver.js';
|
|
2
|
+
export type { DriverEnv, DriverFactory } from './mount/host.js';
|
|
3
|
+
export type { DriverAttr, DriverCapabilities, DriverEntry, DriverStatfs, MountRequestInfo, } from './mount/protocol.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LoopbackNet } from '../kernel/socket.js';
|
|
2
|
+
import { type FacadeHook, type FacadeSpecs } from './types.js';
|
|
3
|
+
export declare const FACADE_MAX_PENDING: number;
|
|
4
|
+
export declare const FACADE_FLOODED = "slicc-kernel: more than 16777216 bytes are waiting for the program to read";
|
|
5
|
+
export declare class FacadeHosts {
|
|
6
|
+
private readonly facades;
|
|
7
|
+
constructor(specs?: FacadeSpecs);
|
|
8
|
+
env(): Record<string, string>;
|
|
9
|
+
enable(net: LoopbackNet): void;
|
|
10
|
+
register(name: string, hook: FacadeHook): () => void;
|
|
11
|
+
private serve;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FacadeHook, FacadeOpenRequest } from './types.js';
|
|
2
|
+
export interface FacadePortLike {
|
|
3
|
+
postMessage(message: unknown, transfer?: Transferable[]): void;
|
|
4
|
+
addEventListener(type: 'message', handler: (event: MessageEvent) => void): void;
|
|
5
|
+
start?(): void;
|
|
6
|
+
close(): void;
|
|
7
|
+
}
|
|
8
|
+
export interface FacadeOpen {
|
|
9
|
+
facadeOpen: FacadeOpenRequest & {
|
|
10
|
+
registration?: number;
|
|
11
|
+
};
|
|
12
|
+
port: FacadePortLike;
|
|
13
|
+
}
|
|
14
|
+
export declare const FACADE_GONE = "the facade host is gone";
|
|
15
|
+
export declare function serveFacadePort(port: FacadePortLike, hook: FacadeHook, { name, stamp }: FacadeOpenRequest, onDone?: () => void): () => void;
|
|
16
|
+
export declare function portFacadeHook(ask: (request: FacadeOpenRequest, port: FacadePortLike) => void, gone?: Promise<unknown>): FacadeHook;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ConnectorStamp } from '../kernel/socket.js';
|
|
2
|
+
export interface FacadeConnection {
|
|
3
|
+
send(bytes: Uint8Array): void;
|
|
4
|
+
onmessage: ((bytes: Uint8Array) => void) | null;
|
|
5
|
+
onclose: ((reason?: string) => void) | null;
|
|
6
|
+
close(reason?: string): void;
|
|
7
|
+
}
|
|
8
|
+
export interface FacadeInfo {
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
export type FacadeHook = (stamp: ConnectorStamp, info: FacadeInfo) => FacadeConnection | Promise<FacadeConnection>;
|
|
12
|
+
export interface FacadeSpec {
|
|
13
|
+
port: number;
|
|
14
|
+
hook?: FacadeHook;
|
|
15
|
+
}
|
|
16
|
+
export type FacadeSpecs = Readonly<Record<string, FacadeSpec>>;
|
|
17
|
+
export interface FacadeOpenRequest {
|
|
18
|
+
name: string;
|
|
19
|
+
stamp: ConnectorStamp;
|
|
20
|
+
}
|
|
21
|
+
export declare const FACADE_NAME: RegExp;
|
|
22
|
+
export declare function facadeEnvName(name: string): string;
|
|
23
|
+
export declare function facadeUrl(port: number): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Cred } from '../kernel/cred.js';
|
|
2
|
+
import { type FsStat, type KernelFs, type Perm } from './types.js';
|
|
3
|
+
export type { Perm };
|
|
4
|
+
export declare const R_OK = 4;
|
|
5
|
+
export declare const W_OK = 2;
|
|
6
|
+
export declare const X_OK = 1;
|
|
7
|
+
export interface Walked {
|
|
8
|
+
path: string;
|
|
9
|
+
perm: Perm | undefined;
|
|
10
|
+
denied?: string;
|
|
11
|
+
missing?: boolean;
|
|
12
|
+
link?: true;
|
|
13
|
+
}
|
|
14
|
+
export declare function permOf(st: FsStat, link?: string): Perm;
|
|
15
|
+
export declare function permits(cred: Readonly<Cred>, perm: Perm, want: number, directory?: boolean): boolean;
|
|
16
|
+
export declare function sticky(cred: Readonly<Cred>, dir: Perm, entry: Perm | undefined): boolean;
|
|
17
|
+
export declare function ancestryOf(fs: KernelFs, path: string): Promise<Array<Perm | undefined>>;
|
|
18
|
+
export declare function trustedLink(perm: Perm, links: number | undefined): boolean;
|
|
19
|
+
export declare function walk(fs: KernelFs, cred: Readonly<Cred>, path: string, follow: boolean, links?: number): Promise<Walked>;
|
|
20
|
+
export declare function present(fs: KernelFs, path: string, directory: boolean): Promise<boolean>;
|
|
21
|
+
export interface AccessOptions {
|
|
22
|
+
follow?: boolean;
|
|
23
|
+
directory?: boolean;
|
|
24
|
+
links?: number | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare function access(fs: KernelFs, cred: Readonly<Cred>, path: string, want: number, options?: AccessOptions): Promise<Walked>;
|
|
27
|
+
export declare function refused(path: string, errno?: string): Error & {
|
|
28
|
+
code: string;
|
|
29
|
+
};
|