@ai-ecoverse/slicc-kernel 1.116.1 → 1.117.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 +19 -1
- package/dist/kernel-worker.js +147 -25
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +24 -8
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +147 -25
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +24 -8
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/opfs.d.ts +1 -0
- package/dist/types/kernel/fd-table.d.ts +1 -0
- package/dist/types/kernel/host-ops.d.ts +10 -1
- package/dist/types/kernel/locks.d.ts +11 -0
- package/dist/types/kernel/process.d.ts +2 -0
- package/dist/types/process/wasi/slicc-lock.d.ts +3 -0
- package/dist/types/process/wasi/wasi-fds.d.ts +3 -2
- package/package.json +1 -1
package/dist/types/fs/opfs.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ export declare class OpfsFs implements KernelFs {
|
|
|
100
100
|
exists(path: string): Promise<boolean>;
|
|
101
101
|
private retrying;
|
|
102
102
|
private existing;
|
|
103
|
+
private refuseNode;
|
|
103
104
|
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
104
105
|
readVersioned(path: string, cached?: boolean): Promise<{
|
|
105
106
|
bytes: Uint8Array;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SyncFsResult } from '../realm/sync-fs-wire.js';
|
|
2
|
-
import { type LockKind, type LockTable } from './locks.js';
|
|
2
|
+
import { type FlockKind, type LockKind, type LockTable } from './locks.js';
|
|
3
3
|
export interface LockTarget {
|
|
4
4
|
path?: string;
|
|
5
5
|
fd?: number;
|
|
@@ -26,6 +26,11 @@ export type HostSyscall = {
|
|
|
26
26
|
} & LockTarget) | ({
|
|
27
27
|
op: 'lk-close';
|
|
28
28
|
} & LockTarget) | {
|
|
29
|
+
op: 'flock';
|
|
30
|
+
fd: number;
|
|
31
|
+
kind: FlockKind | 'unlock';
|
|
32
|
+
wait?: boolean;
|
|
33
|
+
} | {
|
|
29
34
|
op: 'async-submit';
|
|
30
35
|
req: {
|
|
31
36
|
op: string;
|
|
@@ -87,6 +92,10 @@ export interface HostOpsContext {
|
|
|
87
92
|
pid: number;
|
|
88
93
|
owner?: () => number;
|
|
89
94
|
fileKey?: (target: LockTarget, kind: LockKind | 'unlock' | 'close', setting?: boolean) => Promise<string>;
|
|
95
|
+
flockOf?: (fd: number) => Promise<{
|
|
96
|
+
key: string;
|
|
97
|
+
owner: object;
|
|
98
|
+
}>;
|
|
90
99
|
locks: LockTable | undefined;
|
|
91
100
|
ops: AsyncOps;
|
|
92
101
|
blocking: () => AbortSignal;
|
|
@@ -15,7 +15,18 @@ export declare function lockRange(start: number, len: number): {
|
|
|
15
15
|
start: number;
|
|
16
16
|
end: number;
|
|
17
17
|
};
|
|
18
|
+
export type FlockKind = 'shared' | 'exclusive';
|
|
19
|
+
export declare class FlockTable {
|
|
20
|
+
private readonly held;
|
|
21
|
+
private readonly keys;
|
|
22
|
+
private readonly wakers;
|
|
23
|
+
private free;
|
|
24
|
+
set(key: string, owner: object, kind: FlockKind | 'unlock'): boolean;
|
|
25
|
+
wait(key: string, owner: object, kind: FlockKind, blocking: () => AbortSignal): Promise<void>;
|
|
26
|
+
drop(owner: object): void;
|
|
27
|
+
}
|
|
18
28
|
export declare class LockTable {
|
|
29
|
+
readonly flocks: FlockTable;
|
|
19
30
|
private readonly records;
|
|
20
31
|
private readonly blocked;
|
|
21
32
|
private readonly wakers;
|
|
@@ -12,15 +12,18 @@ export interface LockedFile {
|
|
|
12
12
|
offset(): number;
|
|
13
13
|
size(): number;
|
|
14
14
|
}
|
|
15
|
+
export type FlockKind = 'shared' | 'exclusive' | 'unlock';
|
|
15
16
|
export interface LockCalls {
|
|
16
17
|
set(target: LockTarget, kind: LockKind | 'unlock', start: number, len: number, wait: boolean): void;
|
|
17
18
|
get(target: LockTarget, kind: LockKind, start: number, len: number): LockHeld | null;
|
|
19
|
+
flock(fd: number, kind: FlockKind, wait: boolean): void;
|
|
18
20
|
}
|
|
19
21
|
export interface LockHost {
|
|
20
22
|
mem: WasiMemory;
|
|
21
23
|
file(fd: number): LockedFile;
|
|
22
24
|
flush(file: LockedFile): void;
|
|
23
25
|
locked(): void;
|
|
26
|
+
promote(fd: number): void;
|
|
24
27
|
calls: LockCalls;
|
|
25
28
|
}
|
|
26
29
|
export declare function lockImports(host: LockHost): Record<string, WasiFunction>;
|
|
@@ -2,7 +2,7 @@ import { type DeviceAccess, type DeviceMeta, type KernelFdKind } from '../../ker
|
|
|
2
2
|
import type { WasmSyscall } from '../../kernel/process.js';
|
|
3
3
|
import { type SyncFsBridgeStat, type SyncFsPosixBridge } from '../../realm/sync-fs-wire.js';
|
|
4
4
|
import type { ProcessSys } from '../kernel-streams.js';
|
|
5
|
-
import { type WasiEntry } from './wasi-files.js';
|
|
5
|
+
import { FileBuffer, type WasiEntry } from './wasi-files.js';
|
|
6
6
|
export interface WasiKernel {
|
|
7
7
|
sys: ProcessSys;
|
|
8
8
|
call(req: WasmSyscall): unknown;
|
|
@@ -77,7 +77,8 @@ export declare class WasiFds {
|
|
|
77
77
|
dup(fd: number, min: number, cloexec: boolean): number;
|
|
78
78
|
pipe(): [number, number];
|
|
79
79
|
chdir(path: string): void;
|
|
80
|
-
|
|
80
|
+
promote(fd: number): void;
|
|
81
|
+
promoteFiles(only?: FileBuffer): void;
|
|
81
82
|
snapshot(): WasiForkFd[];
|
|
82
83
|
restore(fds: readonly WasiForkFd[], cloexec: readonly number[]): void;
|
|
83
84
|
inheritable(): Map<number, number>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-kernel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.117.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",
|