@ai-ecoverse/slicc-kernel 1.183.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 +96 -0
- 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.map +2 -2
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +134 -39
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.cjs +3985 -574
- package/dist/node-process-worker.cjs.map +4 -4
- package/dist/node-process-worker.js +3985 -574
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +1478 -193
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +3901 -490
- 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/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/facade/port.d.ts +2 -1
- package/dist/types/kernel/host.d.ts +1 -0
- package/dist/types/kernel/process.d.ts +2 -0
- package/dist/types/kernel/protocol.d.ts +1 -0
- package/dist/types/launcher.d.ts +16 -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 +14 -0
- package/dist/types/ports.d.ts +7 -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/wasm-reentry.d.ts +1 -0
- package/dist/types/realm/sync-sab-bridge.d.ts +1 -0
- package/package.json +10 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { IsolateGate } from './isolates.js';
|
|
2
|
+
export declare const ISOLATE_MEMORY_BUDGET: number;
|
|
3
|
+
export declare const INSTANCE_ALLOWANCE: number;
|
|
4
|
+
export declare const MODULE_ALLOWANCE_FACTOR = 3;
|
|
5
|
+
export declare const MAX_SHARDS = 8;
|
|
6
|
+
export declare const DEPTH_RESERVE = 2;
|
|
7
|
+
export interface PlacementOptions {
|
|
8
|
+
budget?: number;
|
|
9
|
+
perInstance?: number;
|
|
10
|
+
waitMs: number;
|
|
11
|
+
}
|
|
12
|
+
export interface Seat {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly shard: number;
|
|
15
|
+
readonly image: string;
|
|
16
|
+
readonly depth: number;
|
|
17
|
+
readonly forking: number;
|
|
18
|
+
memory(bytes: number): void;
|
|
19
|
+
hold(bytes: number): () => void;
|
|
20
|
+
release(): void;
|
|
21
|
+
}
|
|
22
|
+
export interface ImageSize {
|
|
23
|
+
image: string;
|
|
24
|
+
base: string;
|
|
25
|
+
initial: number;
|
|
26
|
+
module: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function shardId(base: string, index: number): string;
|
|
29
|
+
export declare class Placement {
|
|
30
|
+
private readonly shards;
|
|
31
|
+
private readonly waiters;
|
|
32
|
+
private readonly gate;
|
|
33
|
+
readonly budget: number;
|
|
34
|
+
readonly perInstance: number;
|
|
35
|
+
readonly waitMs: number;
|
|
36
|
+
peakShards: number;
|
|
37
|
+
constructor(gate: IsolateGate, options: PlacementOptions);
|
|
38
|
+
shardsOf(base: string): number[];
|
|
39
|
+
used(id: string): number;
|
|
40
|
+
describe(): Record<string, {
|
|
41
|
+
seats: number;
|
|
42
|
+
used: number;
|
|
43
|
+
pending: number;
|
|
44
|
+
holds: number[];
|
|
45
|
+
}>;
|
|
46
|
+
private pending;
|
|
47
|
+
private expected;
|
|
48
|
+
private fits;
|
|
49
|
+
private perShard;
|
|
50
|
+
spare(size: ImageSize, need: number): number;
|
|
51
|
+
private seat;
|
|
52
|
+
private shard;
|
|
53
|
+
private drop;
|
|
54
|
+
private anyLive;
|
|
55
|
+
private lastSlot;
|
|
56
|
+
tryOn(size: ImageSize, index: number, need?: number, depth?: number): Seat | undefined;
|
|
57
|
+
tryPlace(size: ImageSize, need?: number, depth?: number): Seat | undefined;
|
|
58
|
+
place(size: ImageSize, need?: number, depth?: number, parent?: Seat): Promise<Seat>;
|
|
59
|
+
private wake;
|
|
60
|
+
private changed;
|
|
61
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface Answer {
|
|
2
|
+
value: unknown;
|
|
3
|
+
held?: number;
|
|
4
|
+
count?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface WireEnd {
|
|
7
|
+
part(bytes: Uint8Array): unknown;
|
|
8
|
+
post(value: unknown, count: number): unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface KernelEndStub extends WireEnd {
|
|
11
|
+
call(value: unknown, count: number, sent?: number): Promise<Answer>;
|
|
12
|
+
take(held: number, index: number): Promise<Uint8Array>;
|
|
13
|
+
dup(): KernelEndStub;
|
|
14
|
+
}
|
|
15
|
+
export interface ProcessEndStub extends WireEnd {
|
|
16
|
+
close(reason: string): Promise<void>;
|
|
17
|
+
settled(): Promise<string>;
|
|
18
|
+
snapshot(token: string, offset: number, max: number): Promise<Uint8Array | null>;
|
|
19
|
+
dup(): ProcessEndStub;
|
|
20
|
+
}
|
|
21
|
+
export declare function dispose(stub: object): void;
|
|
22
|
+
export declare function quietly(result: unknown): void;
|
|
23
|
+
export declare function send(end: WireEnd, message: unknown): void;
|
|
24
|
+
export declare class Inbox {
|
|
25
|
+
private readonly pieces;
|
|
26
|
+
private readonly early;
|
|
27
|
+
private handlers;
|
|
28
|
+
part(bytes: Uint8Array): void;
|
|
29
|
+
take(value: unknown, count: number): unknown;
|
|
30
|
+
deliver(message: unknown): void;
|
|
31
|
+
listen(handler: (message: unknown) => void): void;
|
|
32
|
+
clear(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare class Held {
|
|
35
|
+
private next;
|
|
36
|
+
private readonly answers;
|
|
37
|
+
answer(result: unknown): Answer;
|
|
38
|
+
take(held: number, index: number): Uint8Array;
|
|
39
|
+
clear(): void;
|
|
40
|
+
}
|
|
41
|
+
export declare function answered(end: KernelEndStub, answer: Answer): Promise<unknown>;
|
|
42
|
+
export declare class Closers {
|
|
43
|
+
private readonly handlers;
|
|
44
|
+
private readonly pending;
|
|
45
|
+
reason: string | undefined;
|
|
46
|
+
listen(handler: (reason: string) => void): void;
|
|
47
|
+
guard<T>(work: Promise<T>): Promise<T>;
|
|
48
|
+
close(reason: string): boolean;
|
|
49
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MetaStore } from '../fs/meta.js';
|
|
2
|
+
import { type SqliteOptions, type SqlStorageLike } from './sqlite-store.js';
|
|
3
|
+
export type { SqlCursorLike, SqliteOptions, SqlStorageLike } from './sqlite-store.js';
|
|
4
|
+
export declare function sqliteMeta(sql: SqlStorageLike, options?: SqliteOptions): MetaStore;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type SqliteOptions, type SqlStorageLike } from './sqlite-store.js';
|
|
2
|
+
export type { SqlCursorLike, SqliteOptions, SqlStorageLike } from './sqlite-store.js';
|
|
3
|
+
export declare const CHUNK_BYTES: number;
|
|
4
|
+
export declare function sqliteRoot(sql: SqlStorageLike, options?: SqliteOptions): FileSystemDirectoryHandle;
|
|
5
|
+
export declare function isSqliteRoot(handle: FileSystemDirectoryHandle): boolean;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export interface SqlCursorLike {
|
|
2
|
+
toArray(): Record<string, unknown>[];
|
|
3
|
+
one(): Record<string, unknown>;
|
|
4
|
+
readonly rowsWritten: number;
|
|
5
|
+
}
|
|
6
|
+
export interface SqlStorageLike {
|
|
7
|
+
exec(query: string, ...bindings: unknown[]): SqlCursorLike;
|
|
8
|
+
transaction?<T>(fn: () => T): T;
|
|
9
|
+
}
|
|
10
|
+
export interface WriteBehindOptions {
|
|
11
|
+
idleMs?: number;
|
|
12
|
+
maxMs?: number;
|
|
13
|
+
maxBytes?: number;
|
|
14
|
+
maxEntries?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface SqliteOptions {
|
|
17
|
+
transaction?: <T>(fn: () => T) => T;
|
|
18
|
+
writeBehind?: boolean | WriteBehindOptions;
|
|
19
|
+
}
|
|
20
|
+
export interface Overlay {
|
|
21
|
+
flushInto(store: SqlStore): void;
|
|
22
|
+
flushed(): void;
|
|
23
|
+
}
|
|
24
|
+
interface Behind {
|
|
25
|
+
idleMs: number;
|
|
26
|
+
maxMs: number;
|
|
27
|
+
maxBytes: number;
|
|
28
|
+
maxEntries: number;
|
|
29
|
+
}
|
|
30
|
+
export interface FlushStats {
|
|
31
|
+
flushes: number;
|
|
32
|
+
pending: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const SCHEMA_VERSION = 1;
|
|
35
|
+
export declare class SqlStore {
|
|
36
|
+
readonly sql: SqlStorageLike;
|
|
37
|
+
transaction: (<T>(fn: () => T) => T) | undefined;
|
|
38
|
+
behind: Behind | undefined;
|
|
39
|
+
private depth;
|
|
40
|
+
private holds;
|
|
41
|
+
private readonly overlays;
|
|
42
|
+
private dirtyBytes;
|
|
43
|
+
private dirtyEntries;
|
|
44
|
+
private firstDirty;
|
|
45
|
+
private lastDirty;
|
|
46
|
+
private timer;
|
|
47
|
+
private flushing;
|
|
48
|
+
private failures;
|
|
49
|
+
flushes: number;
|
|
50
|
+
constructor(sql: SqlStorageLike, options?: SqliteOptions);
|
|
51
|
+
configure(options: SqliteOptions): void;
|
|
52
|
+
register(overlay: Overlay): void;
|
|
53
|
+
get dirty(): boolean;
|
|
54
|
+
changed(entries: number, bytes: number): void;
|
|
55
|
+
batch<T>(fn: () => T): T;
|
|
56
|
+
settle(): void;
|
|
57
|
+
private schedule;
|
|
58
|
+
private tick;
|
|
59
|
+
flush(extra?: () => void): void;
|
|
60
|
+
stats(): FlushStats;
|
|
61
|
+
rows(query: string, ...bindings: unknown[]): Record<string, unknown>[];
|
|
62
|
+
row(query: string, ...bindings: unknown[]): Record<string, unknown> | undefined;
|
|
63
|
+
run(query: string, ...bindings: unknown[]): number;
|
|
64
|
+
atomically<T>(fn: () => T): T;
|
|
65
|
+
private current;
|
|
66
|
+
private migrate;
|
|
67
|
+
}
|
|
68
|
+
export declare function storeOf(sql: SqlStorageLike, options?: SqliteOptions): SqlStore;
|
|
69
|
+
export declare function encodeText(text: string): Uint8Array;
|
|
70
|
+
export declare function decodeText(value: unknown): string;
|
|
71
|
+
export declare function bytesOf(value: unknown): Uint8Array;
|
|
72
|
+
export declare function sqliteFlush(sql: SqlStorageLike): FlushStats;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CloudflareKernel, CloudflareKernelOptions } from './cloudflare/options.js';
|
|
2
|
+
import { memoryRoot } from './node/memory-root.js';
|
|
3
|
+
export { attachKernel, type KernelClient } from './client/attach.js';
|
|
4
|
+
export { type ExecEvent, type KillSignalName, type ShellExecInput, type SliccBackend, type SliccBackendHandle, type SliccBackendHost, type SliccBackendOptions, type SliccKernelLike, sliccBackend, type WorkspaceDirentLike, type WorkspaceDriver, type WorkspaceDriverOptions, type WorkspaceFilesystemLike, type WorkspaceStatLike, workspaceDriver, } from './cloudflare/computer.js';
|
|
5
|
+
export { type ImageHandle, Images } from './cloudflare/images.js';
|
|
6
|
+
export { ISOLATE_WAIT_MS, IsolateGate, MAX_ISOLATES } from './cloudflare/isolates.js';
|
|
7
|
+
export { cloudflareProcesses, type Processes, type ProcessHostCode, type WorkerCode, type WorkerLoaderLike, } from './cloudflare/loader.js';
|
|
8
|
+
export type { CloudflareKernel, CloudflareKernelOptions } from './cloudflare/options.js';
|
|
9
|
+
export { sqliteMeta } from './cloudflare/sqlite-meta.js';
|
|
10
|
+
export { isSqliteRoot, sqliteRoot } from './cloudflare/sqlite-root.js';
|
|
11
|
+
export type { FlushStats, SqlCursorLike, SqliteOptions, SqlStorageLike, WriteBehindOptions, } from './cloudflare/sqlite-store.js';
|
|
12
|
+
export { sqliteFlush } from './cloudflare/sqlite-store.js';
|
|
13
|
+
export { memoryRoot };
|
|
14
|
+
export declare const PROCESS_HOST_SOURCE: string;
|
|
15
|
+
export declare const ASYNC_PROCESS_SOURCE: string | undefined;
|
|
16
|
+
export declare function createCloudflareKernel(options: CloudflareKernelOptions): Promise<CloudflareKernel>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type MakePortPair } from '../ports.js';
|
|
1
2
|
import type { FacadeHook, FacadeOpenRequest } from './types.js';
|
|
2
3
|
export interface FacadePortLike {
|
|
3
4
|
postMessage(message: unknown, transfer?: Transferable[]): void;
|
|
@@ -13,4 +14,4 @@ export interface FacadeOpen {
|
|
|
13
14
|
}
|
|
14
15
|
export declare const FACADE_GONE = "the facade host is gone";
|
|
15
16
|
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
|
|
17
|
+
export declare function portFacadeHook(ask: (request: FacadeOpenRequest, port: FacadePortLike) => void, gone?: Promise<unknown>, ports?: MakePortPair): FacadeHook;
|
|
@@ -107,6 +107,7 @@ export type WasmSyscall = {
|
|
|
107
107
|
} | {
|
|
108
108
|
op: 'fd-path-flush';
|
|
109
109
|
path: string;
|
|
110
|
+
durable?: true;
|
|
110
111
|
} | {
|
|
111
112
|
op: 'fd-path-unlinking';
|
|
112
113
|
path: string;
|
|
@@ -410,6 +411,7 @@ export interface WasmProcessOptions {
|
|
|
410
411
|
ppid: number;
|
|
411
412
|
}>;
|
|
412
413
|
onSyscall?: (req: WasmSyscall) => void;
|
|
414
|
+
durable?: () => void | Promise<void>;
|
|
413
415
|
spawner?: ChildSpawner;
|
|
414
416
|
forker?: ChildForker;
|
|
415
417
|
fs: VfsFileFs;
|
|
@@ -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;
|
package/dist/types/launcher.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { type SealedFetchHook } from './kernel/net/sealed-fetch.js';
|
|
|
29
29
|
import type { RealmTransport } from './kernel/net/transport.js';
|
|
30
30
|
import type { NetworkUplink } from './kernel/net/uplink.js';
|
|
31
31
|
import { type ProcessInfo } from './kernel/proc-info.js';
|
|
32
|
+
import type { Program } from './kernel/protocol.js';
|
|
32
33
|
import { type SealedCaller, type SealedHook } from './kernel/sealed.js';
|
|
33
34
|
import { type SigInfo } from './kernel/signals.js';
|
|
34
35
|
import { LoopbackNet } from './kernel/socket.js';
|
|
@@ -39,10 +40,12 @@ import { type FetchLike, type HostfsGrantHook, type HostfsTiming } from './mount
|
|
|
39
40
|
import { type MediaStore } from './mount/media.js';
|
|
40
41
|
import { type MountEntry, type MountSpec, MountTable } from './mount/mount-fs.js';
|
|
41
42
|
import { type ProcessMountPolicy } from './mount/syscall.js';
|
|
43
|
+
import { type MakePortPair } from './ports.js';
|
|
42
44
|
import { type ApproveHook } from './sudo.js';
|
|
43
45
|
import { type Account, UserDb } from './users.js';
|
|
44
46
|
export interface LauncherOptions {
|
|
45
47
|
unlinkOwner?: UnlinkOwner;
|
|
48
|
+
durable?: () => void | Promise<void>;
|
|
46
49
|
fs: KernelFs;
|
|
47
50
|
createWorker: () => WasmWorkerLike;
|
|
48
51
|
modules?: string;
|
|
@@ -86,6 +89,12 @@ export interface LauncherOptions {
|
|
|
86
89
|
cron?: CronOptions;
|
|
87
90
|
moduleUrl?: ModuleUrlMaker;
|
|
88
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;
|
|
89
98
|
}
|
|
90
99
|
export interface ModuleUrl {
|
|
91
100
|
url: string;
|
|
@@ -192,6 +201,8 @@ export declare function withTag(tags: readonly string[] | undefined, tag: string
|
|
|
192
201
|
export declare function cronPath(path: string): boolean;
|
|
193
202
|
export declare function expandDefaults(defaults: Readonly<Record<string, string>> | undefined, env: Readonly<Record<string, string>>): Record<string, string>;
|
|
194
203
|
export declare class Launcher {
|
|
204
|
+
private readonly emscripten;
|
|
205
|
+
private readonly admit;
|
|
195
206
|
readonly fs: KernelFs;
|
|
196
207
|
readonly processFs: KernelFs;
|
|
197
208
|
private readonly noLinksFs;
|
|
@@ -202,8 +213,10 @@ export declare class Launcher {
|
|
|
202
213
|
private readonly unguardedRoot;
|
|
203
214
|
private writers;
|
|
204
215
|
private readonly unlinkOwnerOption;
|
|
216
|
+
private readonly durable;
|
|
205
217
|
private readonly base;
|
|
206
218
|
private readonly createWorker;
|
|
219
|
+
private readonly compile;
|
|
207
220
|
private readonly moduleUrl;
|
|
208
221
|
private readonly moduleUrls;
|
|
209
222
|
private readonly urlsInUse;
|
|
@@ -218,6 +231,7 @@ export declare class Launcher {
|
|
|
218
231
|
private unwatchScopes;
|
|
219
232
|
private readonly warned;
|
|
220
233
|
private readonly compiled;
|
|
234
|
+
private readonly libcs;
|
|
221
235
|
private readonly texts;
|
|
222
236
|
private revocations;
|
|
223
237
|
private integrity;
|
|
@@ -273,6 +287,7 @@ export declare class Launcher {
|
|
|
273
287
|
private readonly onMountPending;
|
|
274
288
|
private readonly removable;
|
|
275
289
|
private readonly hostfs;
|
|
290
|
+
get ports(): MakePortPair;
|
|
276
291
|
private readonly fstabRetries;
|
|
277
292
|
private readonly inserted;
|
|
278
293
|
private readonly openFiles;
|
|
@@ -399,6 +414,7 @@ export declare class Launcher {
|
|
|
399
414
|
private sourceCheck;
|
|
400
415
|
private treeScrubs;
|
|
401
416
|
private marks;
|
|
417
|
+
private reserved;
|
|
402
418
|
private admitted;
|
|
403
419
|
private start;
|
|
404
420
|
private shownIds;
|
|
@@ -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,10 +1,12 @@
|
|
|
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
12
|
import type { ConnectOptions, KernelDevices, KernelGroups, KernelIntegrity, KernelSealed, KernelUsers, RunOptions, RunResult, Terminal, TerminalOptions } from './index.js';
|
|
@@ -21,6 +23,12 @@ import { type HostLoopback } from './node/loopback.js';
|
|
|
21
23
|
import { memoryRoot } from './node/memory-root.js';
|
|
22
24
|
import type { ApproveHook, SudoReplay } from './sudo.js';
|
|
23
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';
|
|
24
32
|
export type { CdpConnection, CdpHook, CdpRequest } from './cdp/types.js';
|
|
25
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';
|
|
26
34
|
export type { FacadeConnection, FacadeHook, FacadeInfo, FacadeSpec, FacadeSpecs, } from './facade/types.js';
|
|
@@ -43,6 +51,9 @@ export { fetchTransport, type NetworkTransport } from './transport.js';
|
|
|
43
51
|
export { memoryRoot };
|
|
44
52
|
export interface NodeKernelOptions {
|
|
45
53
|
root?: FileSystemDirectoryHandle;
|
|
54
|
+
meta?: MetaStore;
|
|
55
|
+
ranged?: boolean;
|
|
56
|
+
durable?: () => void | Promise<void>;
|
|
46
57
|
modules?: string;
|
|
47
58
|
commands?: {
|
|
48
59
|
append?: readonly string[];
|
|
@@ -87,6 +98,9 @@ export interface NodeKernelOptions {
|
|
|
87
98
|
ceiling?: number;
|
|
88
99
|
idleMs?: number;
|
|
89
100
|
};
|
|
101
|
+
emscripten?: 'glue' | 'kernel';
|
|
102
|
+
blocking?: 'sync' | 'async';
|
|
103
|
+
asyncProcess?: AsyncProcessOptions;
|
|
90
104
|
}
|
|
91
105
|
export interface NodeKernel {
|
|
92
106
|
readonly root: FileSystemDirectoryHandle;
|
|
@@ -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];
|
|
@@ -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/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,7 +74,7 @@
|
|
|
70
74
|
},
|
|
71
75
|
"devDependencies": {
|
|
72
76
|
"@ai-ecoverse/py-numpy": "2.5.4-4",
|
|
73
|
-
"@ai-ecoverse/slicc-cdp": "1.49.
|
|
77
|
+
"@ai-ecoverse/slicc-cdp": "1.49.1",
|
|
74
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",
|
|
@@ -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
|
}
|