@ai-ecoverse/slicc-kernel 1.189.0 → 1.189.2

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.
@@ -3181,7 +3181,7 @@ var init_version = __esm({
3181
3181
  "src/version.ts"() {
3182
3182
  "use strict";
3183
3183
  init_captured_globals();
3184
- KERNEL_VERSION = true ? "1.189.0" : "0.0.0-dev";
3184
+ KERNEL_VERSION = true ? "1.189.2" : "0.0.0-dev";
3185
3185
  OS_RELEASE = "6.0.0-slicc";
3186
3186
  }
3187
3187
  });
@@ -3,12 +3,25 @@ export interface ImageHandle {
3
3
  }
4
4
  export declare function digest(data: string | Uint8Array): Promise<string>;
5
5
  export declare function initialMemory(bytes: Uint8Array): number;
6
+ export interface ImageSource {
7
+ readonly path: string;
8
+ read(): Promise<Uint8Array>;
9
+ stale?(): void;
10
+ kept?(): ImageSource[];
11
+ }
12
+ export declare class ImageError extends Error {
13
+ readonly code: string;
14
+ readonly exitStatus: number;
15
+ constructor(code: string, message: string);
16
+ }
6
17
  export declare class Images {
7
- private readonly initial;
8
- private readonly bytes;
9
- private readonly handles;
10
- register(source: ArrayBuffer | ArrayBufferView): Promise<ImageHandle>;
11
- compile: (bytes: ArrayBuffer | ArrayBufferView) => Promise<WebAssembly.Module>;
18
+ private readonly images;
19
+ private readonly reading;
20
+ register(source: ArrayBuffer | ArrayBufferView, from?: ImageSource): Promise<ImageHandle>;
21
+ compile: (bytes: ArrayBuffer | ArrayBufferView, _key?: string, from?: ImageSource) => Promise<WebAssembly.Module>;
22
+ load(image: string): Promise<ArrayBuffer>;
23
+ private read;
24
+ private matches;
12
25
  get(image: string): ArrayBuffer;
13
26
  sizeOf(image: string): {
14
27
  initial: number;
@@ -16,5 +29,6 @@ export declare class Images {
16
29
  };
17
30
  has(image: string): boolean;
18
31
  get size(): number;
32
+ get held(): number;
19
33
  }
20
34
  export declare function imageOf(module: unknown): string | undefined;
@@ -1,5 +1,6 @@
1
1
  export interface SqlCursorLike {
2
2
  toArray(): Record<string, unknown>[];
3
+ [Symbol.iterator]?(): Iterator<Record<string, unknown>>;
3
4
  one(): Record<string, unknown>;
4
5
  readonly rowsWritten: number;
5
6
  }
@@ -59,6 +60,7 @@ export declare class SqlStore {
59
60
  flush(extra?: () => void): void;
60
61
  stats(): FlushStats;
61
62
  rows(query: string, ...bindings: unknown[]): Record<string, unknown>[];
63
+ each(query: string, ...bindings: unknown[]): Iterable<Record<string, unknown>>;
62
64
  row(query: string, ...bindings: unknown[]): Record<string, unknown> | undefined;
63
65
  run(query: string, ...bindings: unknown[]): number;
64
66
  atomically<T>(fn: () => T): T;
@@ -94,10 +94,19 @@ export interface LauncherOptions {
94
94
  admit?: (program: Program, from: {
95
95
  ppid?: number;
96
96
  }) => Promise<() => void>;
97
- compile?: (bytes: Uint8Array, key: string) => Promise<WebAssembly.Module>;
97
+ compile?: (bytes: Uint8Array, key: string, source: ProgramSource) => Promise<WebAssembly.Module>;
98
98
  tlsEngine?: () => Promise<TlsEngineModule>;
99
99
  ports?: MakePortPair;
100
100
  }
101
+ export interface ProgramSource {
102
+ readonly path: string;
103
+ read(): Promise<Uint8Array>;
104
+ stale(): void;
105
+ kept(): {
106
+ path: string;
107
+ read(): Promise<Uint8Array>;
108
+ }[];
109
+ }
101
110
  export interface ModuleUrl {
102
111
  url: string;
103
112
  revoke(): void;
@@ -252,6 +261,8 @@ export declare class Launcher {
252
261
  private readonly tagBases;
253
262
  private readonly links;
254
263
  private readonly freshModules;
264
+ private readonly imagePaths;
265
+ private readonly imageHolds;
255
266
  private readonly granted;
256
267
  readonly users: UserDb;
257
268
  private readonly sudoer;
@@ -403,6 +414,10 @@ export declare class Launcher {
403
414
  private names;
404
415
  private loaded;
405
416
  private reread;
417
+ private forgetCompiled;
418
+ private sourceOf;
419
+ private keptCopies;
420
+ private holdImage;
406
421
  private exeId;
407
422
  private kernelProgram;
408
423
  private program;
@@ -131,6 +131,7 @@ export declare class MountTable {
131
131
  mountSystem(spec: MountSpec, fs: KernelFs): Promise<void>;
132
132
  note(spec: MountSpec, state: 'pending' | 'failed', error?: string): void;
133
133
  under(path: string): boolean;
134
+ readOnlyAt(path: string): boolean;
134
135
  locate(path: string): {
135
136
  mount: Mount;
136
137
  rel: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-kernel",
3
- "version": "1.189.0",
3
+ "version": "1.189.2",
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",