@ai-ecoverse/slicc-kernel 1.186.1 → 1.187.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 +9 -1
- package/dist/async-process.js +23 -8
- package/dist/async-process.js.map +2 -2
- package/dist/cloudflare-sources.js +2 -2
- package/dist/cloudflare.js +53 -34
- package/dist/cloudflare.js.map +3 -3
- package/dist/kernel-worker.js +1 -1
- package/dist/node-process-worker.cjs +4 -4
- package/dist/node-process-worker.cjs.map +2 -2
- package/dist/node-process-worker.js +4 -4
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +10116 -10072
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +4 -4
- package/dist/process-worker.js.map +2 -2
- package/dist/types/async/node-host.d.ts +1 -0
- package/dist/types/cloudflare/loader.d.ts +4 -2
- package/dist/types/process/wasi/wasi-imports.d.ts +111 -0
- package/dist/types/process/wasi/wasi-threads.d.ts +23 -0
- package/dist/types/process/wasi/wasix-process.d.ts +39 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import type { WasmWorkerLike } from '../kernel/host.js';
|
|
|
2
2
|
import type { KernelLink } from './link.js';
|
|
3
3
|
export interface AsyncProcessDeps {
|
|
4
4
|
module(image: string): WebAssembly.Module | Promise<WebAssembly.Module>;
|
|
5
|
+
imports?(source: string): Promise<Record<string, unknown>>;
|
|
5
6
|
}
|
|
6
7
|
export type AsyncProcessEntry = (link: KernelLink, deps: AsyncProcessDeps) => void;
|
|
7
8
|
export interface AsyncProcessOptions {
|
|
@@ -36,14 +36,16 @@ export interface ProcessHostCode {
|
|
|
36
36
|
}
|
|
37
37
|
export declare const PROCESS_COMPATIBILITY_DATE = "2026-09-01";
|
|
38
38
|
export declare function imageOfInit(init: unknown): string | undefined;
|
|
39
|
+
export declare function importsOfInit(init: unknown): string | undefined;
|
|
40
|
+
export declare const NO_IMPORTS_MODULE = "export {};\n";
|
|
39
41
|
export interface Processes {
|
|
40
42
|
readonly forks: ForkTokens;
|
|
41
43
|
readonly placement: Placement;
|
|
42
44
|
open(init: unknown): Promise<ProcessLink>;
|
|
43
45
|
admit(module: unknown, from?: {
|
|
44
46
|
ppid?: number;
|
|
45
|
-
}): Promise<() => void>;
|
|
46
|
-
workerId(image: string): Promise<string>;
|
|
47
|
+
}, imports?: string): Promise<() => void>;
|
|
48
|
+
workerId(image: string, imports?: string): Promise<string>;
|
|
47
49
|
readonly loads: number;
|
|
48
50
|
}
|
|
49
51
|
export interface IsolateMemory {
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { SyncFsPosixBridge, SyncFsResult } from '../../realm/sync-fs-wire.js';
|
|
2
|
+
import type { WasiHost } from './wasi-host.js';
|
|
3
|
+
export interface Request {
|
|
4
|
+
op: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export type Raw = (req: Request) => SyncFsResult;
|
|
8
|
+
export interface OpenOptions {
|
|
9
|
+
read?: boolean;
|
|
10
|
+
write?: boolean;
|
|
11
|
+
append?: boolean;
|
|
12
|
+
create?: boolean;
|
|
13
|
+
exclusive?: boolean;
|
|
14
|
+
truncate?: boolean;
|
|
15
|
+
directory?: boolean;
|
|
16
|
+
nofollow?: boolean;
|
|
17
|
+
mode?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface FdStat {
|
|
20
|
+
kind: 'file' | 'dir' | 'device' | 'stream';
|
|
21
|
+
path?: string;
|
|
22
|
+
mode: number;
|
|
23
|
+
uid: number;
|
|
24
|
+
gid: number;
|
|
25
|
+
size: number;
|
|
26
|
+
ino?: number;
|
|
27
|
+
mtimeMs?: number;
|
|
28
|
+
}
|
|
29
|
+
export type Taken = {
|
|
30
|
+
value: unknown;
|
|
31
|
+
} | {
|
|
32
|
+
error: string;
|
|
33
|
+
};
|
|
34
|
+
export type Stdio = 'pipe' | 'inherit' | 'null';
|
|
35
|
+
export interface ConnectOptions {
|
|
36
|
+
host: string;
|
|
37
|
+
port: number;
|
|
38
|
+
nonblock?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface SpawnOptions {
|
|
41
|
+
argv: string[];
|
|
42
|
+
env?: Record<string, string>;
|
|
43
|
+
cwd?: string;
|
|
44
|
+
stdin?: Stdio;
|
|
45
|
+
stdout?: Stdio;
|
|
46
|
+
stderr?: Stdio;
|
|
47
|
+
}
|
|
48
|
+
export interface Spawned {
|
|
49
|
+
pid: number;
|
|
50
|
+
stdin?: number;
|
|
51
|
+
stdout?: number;
|
|
52
|
+
stderr?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface Waited {
|
|
55
|
+
status: number;
|
|
56
|
+
signal?: number;
|
|
57
|
+
}
|
|
58
|
+
export interface ImportsContext {
|
|
59
|
+
memory(): WebAssembly.Memory;
|
|
60
|
+
instance(): WebAssembly.Instance | undefined;
|
|
61
|
+
tid: number;
|
|
62
|
+
argv: readonly string[];
|
|
63
|
+
env: Readonly<Record<string, string>>;
|
|
64
|
+
cwd(): string;
|
|
65
|
+
fs: SyncFsPosixBridge & {
|
|
66
|
+
copyFile(from: string, to: string, options?: {
|
|
67
|
+
mode?: number;
|
|
68
|
+
excl?: boolean;
|
|
69
|
+
}): void;
|
|
70
|
+
};
|
|
71
|
+
fds: {
|
|
72
|
+
open(path: string, options?: OpenOptions): number;
|
|
73
|
+
close(fd: number): void;
|
|
74
|
+
fstat(fd: number): FdStat;
|
|
75
|
+
fchmod(fd: number, mode: number): void;
|
|
76
|
+
tryLock(fd: number, exclusive: boolean): number;
|
|
77
|
+
unlock(fd: number): void;
|
|
78
|
+
};
|
|
79
|
+
syscall(req: Request): unknown;
|
|
80
|
+
net: {
|
|
81
|
+
connect(options: ConnectOptions): number;
|
|
82
|
+
ready(fd: number): number;
|
|
83
|
+
};
|
|
84
|
+
spawn(options: SpawnOptions): Spawned;
|
|
85
|
+
wait(pid: number): Waited;
|
|
86
|
+
kill(pid: number, sig: number): void;
|
|
87
|
+
async: {
|
|
88
|
+
submit(req: Request): number;
|
|
89
|
+
wait(timeoutMs?: number): number;
|
|
90
|
+
take(id: number): Taken | undefined;
|
|
91
|
+
resolve(value: unknown): number;
|
|
92
|
+
hold(): number;
|
|
93
|
+
cancel(id: number): void;
|
|
94
|
+
close(): void;
|
|
95
|
+
};
|
|
96
|
+
errno(err: unknown): number;
|
|
97
|
+
readonly uid?: number;
|
|
98
|
+
readonly gid?: number;
|
|
99
|
+
}
|
|
100
|
+
export type ProgramImports = Record<string, Record<string, WebAssembly.ImportValue>>;
|
|
101
|
+
export type CreateImports = (ctx: ImportsContext) => ProgramImports;
|
|
102
|
+
export declare function importSource(source: string): Promise<Record<string, unknown>>;
|
|
103
|
+
export declare function loadImports(source: string): Promise<CreateImports>;
|
|
104
|
+
export interface ContextOptions {
|
|
105
|
+
host: WasiHost;
|
|
106
|
+
raw: Raw;
|
|
107
|
+
tid: number;
|
|
108
|
+
memory: () => WebAssembly.Memory;
|
|
109
|
+
instance: () => WebAssembly.Instance | undefined;
|
|
110
|
+
}
|
|
111
|
+
export declare function importsContext({ host, raw, tid, memory, instance, }: ContextOptions): ImportsContext;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SabPostLike } from '../../realm/sync-sab-bridge.js';
|
|
2
|
+
import { type BlockedMask } from '../../realm/sync-sab-wire.js';
|
|
3
|
+
export declare const MAIN_TID = 1;
|
|
4
|
+
export declare class ThreadExit extends Error {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
export declare function threadCap(env: Readonly<Record<string, string>>): number;
|
|
8
|
+
export declare class WasiThreads {
|
|
9
|
+
readonly ids: Int32Array;
|
|
10
|
+
beforeSpawn: (() => void) | undefined;
|
|
11
|
+
modules: (() => Record<string, WebAssembly.Module>) | undefined;
|
|
12
|
+
received: Readonly<Record<string, WebAssembly.Module>> | undefined;
|
|
13
|
+
blocked: (() => BlockedMask) | undefined;
|
|
14
|
+
private readonly port;
|
|
15
|
+
private readonly memory;
|
|
16
|
+
private readonly cap;
|
|
17
|
+
readonly tid: number;
|
|
18
|
+
constructor(port: SabPostLike, memory: WebAssembly.Memory, cap: number, tid: number, ids?: SharedArrayBuffer);
|
|
19
|
+
spawn(arg: number): number;
|
|
20
|
+
exited(): void;
|
|
21
|
+
known(tid: number): boolean;
|
|
22
|
+
parallelism(): number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type WasiHost } from './wasi-host.js';
|
|
2
|
+
import type { AsyncifyDriver } from './wasix-fork.js';
|
|
3
|
+
export interface SpawnFdOp {
|
|
4
|
+
cmd: 'close' | 'dup2' | 'open' | 'chdir' | 'fchdir';
|
|
5
|
+
fd: number;
|
|
6
|
+
srcFd: number;
|
|
7
|
+
path: string;
|
|
8
|
+
oflags: number;
|
|
9
|
+
rightsWrite: boolean;
|
|
10
|
+
append: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ChildRequest {
|
|
13
|
+
name: string;
|
|
14
|
+
argv: string[];
|
|
15
|
+
env?: Record<string, string>;
|
|
16
|
+
search: boolean;
|
|
17
|
+
path: string;
|
|
18
|
+
ops?: readonly SpawnFdOp[];
|
|
19
|
+
}
|
|
20
|
+
export declare function restarted(issue: () => unknown): unknown;
|
|
21
|
+
export declare class WasixProcess {
|
|
22
|
+
private readonly host;
|
|
23
|
+
private readonly driver;
|
|
24
|
+
private readonly inThread;
|
|
25
|
+
constructor(host: WasiHost, driver: AsyncifyDriver, inThread?: () => boolean);
|
|
26
|
+
private restart;
|
|
27
|
+
private call;
|
|
28
|
+
private environment;
|
|
29
|
+
private locate;
|
|
30
|
+
private childFds;
|
|
31
|
+
private applyFdOp;
|
|
32
|
+
private physicalFrom;
|
|
33
|
+
private openFor;
|
|
34
|
+
spawn(req: ChildRequest, exec?: boolean): number;
|
|
35
|
+
exec(req: ChildRequest): never;
|
|
36
|
+
join(pidPtr: number, flags: number, statusPtr: number): void;
|
|
37
|
+
fork(pidPtr: number): number | undefined;
|
|
38
|
+
private forkCall;
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-kernel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.187.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",
|