@ai-ecoverse/slicc-kernel 1.193.3 → 1.194.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 +44 -0
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +783 -459
- package/dist/cloudflare.js.map +4 -4
- package/dist/index.js +347 -133
- package/dist/index.js.map +4 -4
- package/dist/kernel-worker.js +623 -85
- package/dist/kernel-worker.js.map +4 -4
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +804 -482
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +1 -1
- package/dist/types/cdp/facade.d.ts +0 -1
- package/dist/types/cdp/hosts.d.ts +12 -3
- package/dist/types/cdp/lease-cli.d.ts +23 -0
- package/dist/types/cdp/lease.d.ts +60 -0
- package/dist/types/cloudflare/options.d.ts +2 -0
- package/dist/types/cloudflare.d.ts +1 -0
- package/dist/types/fs/attest.d.ts +1 -0
- package/dist/types/fs/memory-budget.d.ts +10 -0
- package/dist/types/fs/meta.d.ts +2 -0
- package/dist/types/index.d.ts +6 -1
- package/dist/types/kernel/replacing.d.ts +1 -1
- package/dist/types/launcher.d.ts +9 -0
- package/dist/types/node/memory-root.d.ts +4 -0
- package/dist/types/node.d.ts +3 -0
- package/dist/types/serve.d.ts +10 -0
- package/package.json +1 -1
package/dist/process-worker.js
CHANGED
|
@@ -3188,7 +3188,7 @@ var init_version = __esm({
|
|
|
3188
3188
|
"src/version.ts"() {
|
|
3189
3189
|
"use strict";
|
|
3190
3190
|
init_captured_globals();
|
|
3191
|
-
KERNEL_VERSION = true ? "1.
|
|
3191
|
+
KERNEL_VERSION = true ? "1.194.0" : "0.0.0-dev";
|
|
3192
3192
|
OS_RELEASE = "6.0.0-slicc";
|
|
3193
3193
|
}
|
|
3194
3194
|
});
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { KernelSocket } from '../kernel/socket.js';
|
|
2
|
+
import { type CdpConnection, type CdpHook } from './types.js';
|
|
2
3
|
export declare class CdpHosts {
|
|
3
4
|
private readonly embedder;
|
|
4
5
|
private readonly clients;
|
|
5
6
|
private closed;
|
|
7
|
+
private readonly leaseTag;
|
|
8
|
+
private readonly sessionOf;
|
|
9
|
+
private session;
|
|
10
|
+
private opening;
|
|
6
11
|
readonly path: string;
|
|
7
12
|
readonly url: string;
|
|
8
|
-
constructor(hook?: CdpHook);
|
|
13
|
+
constructor(hook?: CdpHook, leaseTag?: string, sessionOf?: (_pid: number) => number);
|
|
14
|
+
get leaseOnly(): boolean;
|
|
15
|
+
env(session?: number): Record<string, string>;
|
|
16
|
+
bindClient(session: number, tag: string | undefined, extraHost: unknown): (() => void) | undefined;
|
|
17
|
+
authorize(socket: KernelSocket): void;
|
|
9
18
|
register(hook: CdpHook, runtime?: string): () => void;
|
|
10
19
|
private pick;
|
|
11
20
|
available(runtime?: string): boolean;
|
|
12
|
-
connect(
|
|
21
|
+
connect(peer: KernelSocket, runtime?: string): Promise<CdpConnection>;
|
|
13
22
|
close(): void;
|
|
14
23
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Attestation, AttestTombstone } from '../fs/attest.js';
|
|
2
|
+
import { type KernelFs } from '../fs/types.js';
|
|
3
|
+
export declare const CLI_PKG = "/node_modules/@ai-ecoverse/slicc-cdp";
|
|
4
|
+
export declare const CLI_FILE = "/node_modules/@ai-ecoverse/slicc-cdp/bin/playwright-cli.wasm";
|
|
5
|
+
export declare const CLI_MAX: number;
|
|
6
|
+
export declare const LEASE_USER = "leasejob";
|
|
7
|
+
export interface LeaseCliInput {
|
|
8
|
+
wasm: Uint8Array;
|
|
9
|
+
sha256: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function checkCli({ wasm, sha256 }: LeaseCliInput): void;
|
|
12
|
+
export declare class LeaseCliImage {
|
|
13
|
+
private state;
|
|
14
|
+
private sha;
|
|
15
|
+
private readonly fs;
|
|
16
|
+
constructor(fs: KernelFs);
|
|
17
|
+
install(input: LeaseCliInput): Promise<void>;
|
|
18
|
+
private active;
|
|
19
|
+
attest(record: Attestation | AttestTombstone): void;
|
|
20
|
+
ready(): void;
|
|
21
|
+
bytes(path: string): Promise<Uint8Array>;
|
|
22
|
+
close(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ConnectorStamp } from '../kernel/socket.js';
|
|
2
|
+
import type { CdpHook } from './types.js';
|
|
3
|
+
export declare const CDP_LEASE_VERSION = 1;
|
|
4
|
+
export declare const LEASE_MAX_MESSAGE: number;
|
|
5
|
+
interface LeaseRule {
|
|
6
|
+
kind: 'origin' | 'exact' | 'path-prefix';
|
|
7
|
+
url: string;
|
|
8
|
+
}
|
|
9
|
+
export type CdpLeaseRequest = {
|
|
10
|
+
allow: LeaseRule[];
|
|
11
|
+
reason?: string;
|
|
12
|
+
} & ({
|
|
13
|
+
ttlSeconds: number;
|
|
14
|
+
lease?: never;
|
|
15
|
+
} | {
|
|
16
|
+
lease: string;
|
|
17
|
+
ttlSeconds?: never;
|
|
18
|
+
});
|
|
19
|
+
export type CdpLeaseAction = {
|
|
20
|
+
lease: string;
|
|
21
|
+
} & ({
|
|
22
|
+
op: 'goto';
|
|
23
|
+
args: {
|
|
24
|
+
url: string;
|
|
25
|
+
};
|
|
26
|
+
} | {
|
|
27
|
+
op: 'snapshot';
|
|
28
|
+
args: Record<string, never>;
|
|
29
|
+
});
|
|
30
|
+
export interface CdpLeaseContext {
|
|
31
|
+
stamp: ConnectorStamp;
|
|
32
|
+
signal: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
export interface CdpLeaseAdapter {
|
|
35
|
+
request(params: CdpLeaseRequest, context: CdpLeaseContext): Promise<{
|
|
36
|
+
request: string;
|
|
37
|
+
lease: string;
|
|
38
|
+
jkt: string;
|
|
39
|
+
}>;
|
|
40
|
+
action(params: CdpLeaseAction, context: CdpLeaseContext): Promise<{
|
|
41
|
+
result: Record<string, never> | {
|
|
42
|
+
text: string;
|
|
43
|
+
};
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
export interface CdpLeaseOptions {
|
|
47
|
+
tag: string;
|
|
48
|
+
adapter: CdpLeaseAdapter;
|
|
49
|
+
}
|
|
50
|
+
declare const BOOT_FIELDS: {
|
|
51
|
+
browser: Set<string>;
|
|
52
|
+
node: Set<string>;
|
|
53
|
+
cloudflare: Set<string>;
|
|
54
|
+
};
|
|
55
|
+
export declare function checkedLease(options: {
|
|
56
|
+
cdpLease?: CdpLeaseOptions;
|
|
57
|
+
}, host: keyof typeof BOOT_FIELDS): CdpLeaseOptions | undefined;
|
|
58
|
+
export declare const LEASE_MAX_CONNECTIONS = 8;
|
|
59
|
+
export declare function leaseHook({ tag, adapter }: CdpLeaseOptions): CdpHook;
|
|
60
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CdpLeaseOptions } from '../cdp/lease.js';
|
|
1
2
|
import type { CdpHook } from '../cdp/types.js';
|
|
2
3
|
import type { CronClock } from '../cron/clock.js';
|
|
3
4
|
import type { DenialHook } from '../fs/dac.js';
|
|
@@ -20,6 +21,7 @@ import type { Processes, ProcessHostCode, WorkerLoaderLike } from './loader.js';
|
|
|
20
21
|
import type { SqliteOptions, SqlStorageLike } from './sqlite-store.js';
|
|
21
22
|
export interface CloudflareKernelOptions {
|
|
22
23
|
loader: WorkerLoaderLike;
|
|
24
|
+
cdpLease?: CdpLeaseOptions;
|
|
23
25
|
root?: FileSystemDirectoryHandle;
|
|
24
26
|
meta?: MetaStore;
|
|
25
27
|
ranged?: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CloudflareKernel, CloudflareKernelOptions } from './cloudflare/options.js';
|
|
2
2
|
import { memoryRoot } from './node/memory-root.js';
|
|
3
|
+
export { CDP_LEASE_VERSION, type CdpLeaseAction, type CdpLeaseAdapter, type CdpLeaseContext, type CdpLeaseOptions, type CdpLeaseRequest, } from './cdp/lease.js';
|
|
3
4
|
export type { CdpConnection, CdpHook, CdpRequest } from './cdp/types.js';
|
|
4
5
|
export { attachKernel, type KernelClient } from './client/attach.js';
|
|
5
6
|
export { type ExecEvent, type KillSignalName, type ShellExecInput, type SliccBackend, type SliccBackendHandle, type SliccBackendHost, type SliccBackendOptions, type SliccKernelLike, sliccBackend, type WorkspaceDatabaseLike, type WorkspaceDirentLike, type WorkspaceDriver, type WorkspaceDriverOptions, type WorkspaceFilesystemLike, type WorkspaceStatLike, workspaceDriver, } from './cloudflare/computer.js';
|
|
@@ -34,6 +34,7 @@ export interface AttestOptions {
|
|
|
34
34
|
export interface AttestContext extends AttestOptions {
|
|
35
35
|
users: UsersMode;
|
|
36
36
|
mounts: readonly string[];
|
|
37
|
+
maxBytes?: number;
|
|
37
38
|
}
|
|
38
39
|
export declare function attest(fs: KernelFs, asked: string, o: AttestContext): Promise<Attestation | AttestTombstone>;
|
|
39
40
|
export declare const WATCH_DEBOUNCE_MS = 50;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const LEASE_FS_BYTES: number;
|
|
2
|
+
export declare const LEASE_FS_ENTRIES = 4096;
|
|
3
|
+
export declare class MemoryBudget {
|
|
4
|
+
private bytes;
|
|
5
|
+
private entries;
|
|
6
|
+
private closed;
|
|
7
|
+
resize(before: number, after: number): void;
|
|
8
|
+
entry(add: 1 | -1): void;
|
|
9
|
+
close(): void;
|
|
10
|
+
}
|
package/dist/types/fs/meta.d.ts
CHANGED
|
@@ -62,6 +62,8 @@ export declare const META_VERSION = 1;
|
|
|
62
62
|
export declare const META_STORE = "entries";
|
|
63
63
|
export declare class MemoryMeta implements MetaStore {
|
|
64
64
|
private readonly entries;
|
|
65
|
+
private readonly limit;
|
|
66
|
+
constructor(limit?: number);
|
|
65
67
|
get(paths: readonly string[]): Promise<Array<MetaEntry | undefined>>;
|
|
66
68
|
fresh(paths: readonly string[]): Promise<Array<MetaEntry | undefined>>;
|
|
67
69
|
update(path: string, change: MetaChange): Promise<void>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type CdpLeaseOptions } from './cdp/lease.js';
|
|
2
|
+
import { type LeaseCliInput } from './cdp/lease-cli.js';
|
|
1
3
|
import type { CdpHook } from './cdp/types.js';
|
|
2
4
|
import type { SudoRun, SudoRunOptions } from './client/attach.js';
|
|
3
5
|
import { type DialledSocket, type DialOptions } from './client/dial-stream.js';
|
|
@@ -19,6 +21,7 @@ import type { ProcessMountPolicy } from './mount/syscall.js';
|
|
|
19
21
|
import type { ApproveHook, SudoReplay } from './sudo.js';
|
|
20
22
|
import { type NetworkTransport } from './transport.js';
|
|
21
23
|
import type { Account, AddGroup, AddUser, Group, RemoveUser } from './users.js';
|
|
24
|
+
export { CDP_LEASE_VERSION, type CdpLeaseAction, type CdpLeaseAdapter, type CdpLeaseContext, type CdpLeaseOptions, type CdpLeaseRequest, } from './cdp/lease.js';
|
|
22
25
|
export type { CdpConnection, CdpHook, CdpRequest } from './cdp/types.js';
|
|
23
26
|
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';
|
|
24
27
|
export type { DialledSocket, DialOptions } from './client/dial-stream.js';
|
|
@@ -73,6 +76,7 @@ export interface KernelOptions {
|
|
|
73
76
|
hostfs?: HostfsGrantHook;
|
|
74
77
|
processMounts?: ProcessMountPolicy;
|
|
75
78
|
cdp?: CdpHook;
|
|
79
|
+
cdpLease?: CdpLeaseOptions;
|
|
76
80
|
facades?: FacadeSpecs;
|
|
77
81
|
hostname?: string;
|
|
78
82
|
timeZone?: string;
|
|
@@ -141,6 +145,7 @@ export interface KernelSealed {
|
|
|
141
145
|
setPlaceholders(list: readonly string[]): Promise<void>;
|
|
142
146
|
}
|
|
143
147
|
export interface Kernel {
|
|
148
|
+
installLeaseCli(input: LeaseCliInput): Promise<void>;
|
|
144
149
|
run(argv: string[], options?: RunOptions): Promise<RunResult>;
|
|
145
150
|
openTerminal(argv: string[], options?: TerminalOptions): Promise<Terminal>;
|
|
146
151
|
connect(options?: ConnectOptions): Promise<MessagePort>;
|
|
@@ -164,7 +169,7 @@ export interface Kernel {
|
|
|
164
169
|
absent: 'allow';
|
|
165
170
|
}): Promise<Attestation | AttestTombstone>;
|
|
166
171
|
watch(paths: string[], onChange: (path: string) => void): Promise<() => void>;
|
|
167
|
-
terminate(): void
|
|
172
|
+
terminate(): void | Promise<void>;
|
|
168
173
|
}
|
|
169
174
|
export interface TerminalOptions {
|
|
170
175
|
cwd?: string;
|
|
@@ -12,7 +12,7 @@ export declare function exclusively<T>(locks: ReplacingLocks, names: readonly st
|
|
|
12
12
|
export declare class PackageLocks {
|
|
13
13
|
private readonly locks;
|
|
14
14
|
private readonly metadata;
|
|
15
|
-
constructor(metadata: string, locks?: ReplacingLocks | undefined);
|
|
15
|
+
constructor(metadata: string, locks?: ReplacingLocks | null | undefined);
|
|
16
16
|
loading<T>(roots: readonly string[], run: (waited: boolean) => Promise<T>): Promise<T>;
|
|
17
17
|
holding(root: string): Promise<() => void>;
|
|
18
18
|
}
|
package/dist/types/launcher.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CdpHosts } from './cdp/hosts.js';
|
|
2
|
+
import { type LeaseCliImage } from './cdp/lease-cli.js';
|
|
2
3
|
import type { CdpHook } from './cdp/types.js';
|
|
3
4
|
import { type Abi, type Command, type CommandVariant } from './commands.js';
|
|
4
5
|
import { type CronClock } from './cron/clock.js';
|
|
@@ -65,6 +66,8 @@ export interface LauncherOptions {
|
|
|
65
66
|
processMounts?: ProcessMountPolicy;
|
|
66
67
|
fstabRetries?: readonly number[];
|
|
67
68
|
cdp?: CdpHook;
|
|
69
|
+
leaseTag?: string;
|
|
70
|
+
leaseImage?: LeaseCliImage;
|
|
68
71
|
facades?: FacadeSpecs;
|
|
69
72
|
uplink?: NetworkUplink;
|
|
70
73
|
doh?: string | false;
|
|
@@ -227,6 +230,8 @@ export declare class Launcher {
|
|
|
227
230
|
private readonly unlinkOwnerOption;
|
|
228
231
|
private readonly durable;
|
|
229
232
|
private readonly base;
|
|
233
|
+
readonly leaseImage: LeaseCliImage | undefined;
|
|
234
|
+
private disposing;
|
|
230
235
|
private readonly createWorker;
|
|
231
236
|
private readonly compile;
|
|
232
237
|
private readonly moduleUrl;
|
|
@@ -338,6 +343,7 @@ export declare class Launcher {
|
|
|
338
343
|
private crontabs;
|
|
339
344
|
private terminals;
|
|
340
345
|
constructor(options: LauncherOptions);
|
|
346
|
+
private watchCatalogs;
|
|
341
347
|
private cronService;
|
|
342
348
|
get owners(): boolean;
|
|
343
349
|
setRoutes(table: RouteTable): void;
|
|
@@ -426,6 +432,7 @@ export declare class Launcher {
|
|
|
426
432
|
private holdImage;
|
|
427
433
|
private exeId;
|
|
428
434
|
private kernelProgram;
|
|
435
|
+
private checkLeaseProgram;
|
|
429
436
|
private program;
|
|
430
437
|
private launch;
|
|
431
438
|
private loadPlanned;
|
|
@@ -441,6 +448,7 @@ export declare class Launcher {
|
|
|
441
448
|
private marks;
|
|
442
449
|
private reserved;
|
|
443
450
|
private admitted;
|
|
451
|
+
private mayStart;
|
|
444
452
|
private start;
|
|
445
453
|
private shownIds;
|
|
446
454
|
private forget;
|
|
@@ -534,6 +542,7 @@ export declare class Launcher {
|
|
|
534
542
|
private mountRoot;
|
|
535
543
|
insert(target: string, handle: MediumHandle, source?: string): Promise<void>;
|
|
536
544
|
umount(target: string, detach?: boolean): void;
|
|
545
|
+
endLeaseProcesses(): void;
|
|
537
546
|
unmountAll(): void;
|
|
538
547
|
private permit;
|
|
539
548
|
private processMount;
|
package/dist/types/node.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type MessagePort, type Worker } from 'node:worker_threads';
|
|
2
2
|
import { type AsyncProcessOptions } from './async/node-host.js';
|
|
3
|
+
import { type CdpLeaseOptions } from './cdp/lease.js';
|
|
3
4
|
import type { CdpHook } from './cdp/types.js';
|
|
4
5
|
import type { SudoRun, SudoRunOptions } from './client/attach.js';
|
|
5
6
|
import { type CronClock } from './cron/clock.js';
|
|
@@ -29,6 +30,7 @@ export type { AsyncProcessDeps, AsyncProcessEntry, AsyncProcessOptions, } from '
|
|
|
29
30
|
export { type RemoteWorkerOptions, remoteWorker } from './async/remote-worker.js';
|
|
30
31
|
export { type AsyncTransport, type AsyncTransportOptions, createAsyncTransport, } from './async/transport.js';
|
|
31
32
|
export type { AsyncProcessInit } from './async/wire.js';
|
|
33
|
+
export { CDP_LEASE_VERSION, type CdpLeaseAction, type CdpLeaseAdapter, type CdpLeaseContext, type CdpLeaseOptions, type CdpLeaseRequest, } from './cdp/lease.js';
|
|
32
34
|
export type { CdpConnection, CdpHook, CdpRequest } from './cdp/types.js';
|
|
33
35
|
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';
|
|
34
36
|
export type { FacadeConnection, FacadeHook, FacadeInfo, FacadeSpec, FacadeSpecs, } from './facade/types.js';
|
|
@@ -72,6 +74,7 @@ export interface NodeKernelOptions {
|
|
|
72
74
|
hostfsFetch?: FetchLike;
|
|
73
75
|
hostfsOrigin?: string;
|
|
74
76
|
cdp?: CdpHook;
|
|
77
|
+
cdpLease?: CdpLeaseOptions;
|
|
75
78
|
facades?: FacadeSpecs;
|
|
76
79
|
hostname?: string;
|
|
77
80
|
timeZone?: string;
|
package/dist/types/serve.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LeaseCliInput } from './cdp/lease-cli.js';
|
|
1
2
|
import { type LockManagerLike } from './client/protocol.js';
|
|
2
3
|
import type { AttestOptions } from './fs/attest.js';
|
|
3
4
|
import { type MetaStore } from './fs/meta.js';
|
|
@@ -54,6 +55,8 @@ export interface InitRequest {
|
|
|
54
55
|
approve?: boolean;
|
|
55
56
|
processMounts?: boolean | 'ask';
|
|
56
57
|
cdp?: boolean;
|
|
58
|
+
leaseTag?: string;
|
|
59
|
+
leaseMemory?: true;
|
|
57
60
|
facades?: Record<string, {
|
|
58
61
|
port: number;
|
|
59
62
|
hook?: boolean;
|
|
@@ -206,6 +209,13 @@ export interface FileChanged {
|
|
|
206
209
|
};
|
|
207
210
|
}
|
|
208
211
|
export type KernelRequest = {
|
|
212
|
+
id: number;
|
|
213
|
+
op: 'lease-cli-install';
|
|
214
|
+
input: LeaseCliInput;
|
|
215
|
+
} | {
|
|
216
|
+
id: number;
|
|
217
|
+
op: 'lease-memory-end';
|
|
218
|
+
} | {
|
|
209
219
|
id: number;
|
|
210
220
|
op: 'sealed-placeholders';
|
|
211
221
|
list: readonly string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-kernel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.194.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",
|