@ai-ecoverse/slicc-kernel 1.172.1 → 1.173.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.
@@ -0,0 +1,41 @@
1
+ import type { MetaEntry } from './meta.js';
2
+ export interface Invalidated {
3
+ paths?: readonly string[];
4
+ trees?: readonly string[];
5
+ }
6
+ export declare class Invalidations {
7
+ private seq;
8
+ private readonly log;
9
+ private readonly open;
10
+ start(): number;
11
+ end(at: number): void;
12
+ note({ paths, trees }: Invalidated): void;
13
+ private since;
14
+ entryStale(at: number, path: string): boolean;
15
+ listingStale(at: number, dir: string): boolean;
16
+ }
17
+ export type MetaReadKind = 'entry' | 'links';
18
+ export interface ReadBatch {
19
+ entries: readonly string[];
20
+ links: readonly string[];
21
+ }
22
+ export interface ReadResult {
23
+ entries: Map<string, MetaEntry | null>;
24
+ links: Map<string, MetaEntry[]>;
25
+ }
26
+ export declare const META_READS_IN_FLIGHT = 4;
27
+ export declare class BatchedReads {
28
+ private readonly run;
29
+ private readonly invalidations;
30
+ private readonly keep;
31
+ private readonly queued;
32
+ private readonly reading;
33
+ private inFlight;
34
+ constructor(invalidations: Invalidations, run: (batch: ReadBatch) => Promise<ReadResult>, keep: (kind: MetaReadKind, key: string, value: unknown) => void);
35
+ entries(paths: readonly string[]): Promise<Map<string, MetaEntry | null>>;
36
+ links(dir: string): Promise<MetaEntry[]>;
37
+ private stale;
38
+ private want;
39
+ private pump;
40
+ private flush;
41
+ }
@@ -51,6 +51,11 @@ export interface MetaStore {
51
51
  absent?(path: string): boolean;
52
52
  removeFile?(path: string): Promise<void>;
53
53
  forgetTrees?(trees: readonly string[]): void;
54
+ transactions?(): MetaTransactions;
55
+ }
56
+ export interface MetaTransactions {
57
+ reads: number;
58
+ writes: number;
54
59
  }
55
60
  export declare const META_DB = "slicc-kernel";
56
61
  export declare const META_VERSION = 1;
@@ -79,14 +84,20 @@ interface Invalidation {
79
84
  export declare class IndexedDbMeta implements MetaStore {
80
85
  private readonly db;
81
86
  private readonly cache;
87
+ private readonly listings;
82
88
  private readonly channel;
83
- private generation;
89
+ private readonly invalidations;
90
+ private readonly reads;
84
91
  private readonly listeners;
85
92
  listen(listener: (change: Invalidation) => void): void;
86
93
  constructor(db: IDBDatabase);
87
94
  forgetTrees(trees: readonly string[]): void;
88
95
  private drop;
96
+ private keepListing;
97
+ private read;
89
98
  private changed;
99
+ private readonly counted;
100
+ transactions(): MetaTransactions;
90
101
  private transaction;
91
102
  get(paths: readonly string[]): Promise<Array<MetaEntry | undefined>>;
92
103
  fresh(paths: readonly string[]): Promise<Array<MetaEntry | undefined>>;
@@ -1,4 +1,4 @@
1
- import { type MetaStore } from './meta.js';
1
+ import { type MetaStore, type MetaTransactions } from './meta.js';
2
2
  import { type KeepHandlers, type LockManagerLike, type RemoteListener } from './remote.js';
3
3
  import { type CopyOptions, type FsStat, type KernelFs, type NewOwner, type OwnerChange, type PeerKeeps, type Peers, type Perm, type PwriteOptions } from './types.js';
4
4
  export type OpfsOp = 'lookup' | 'read' | 'write' | 'commit' | 'sidecar';
@@ -101,6 +101,7 @@ export declare class OpfsFs implements KernelFs {
101
101
  private idWrites;
102
102
  fileIdWrites(): number;
103
103
  opfsOps(): number;
104
+ metaTransactions(): MetaTransactions | undefined;
104
105
  private io;
105
106
  private fresh;
106
107
  private exactly;
@@ -0,0 +1,11 @@
1
+ export type Portable<T extends FileSystemHandle> = {
2
+ handle: T;
3
+ } | {
4
+ path: string[];
5
+ };
6
+ type Top = () => Promise<FileSystemDirectoryHandle>;
7
+ export declare function clonable(handle: FileSystemHandle): boolean;
8
+ export declare function portable<T extends FileSystemHandle>(handle: T, top?: Top): Promise<Portable<T>>;
9
+ export declare function directoryAt(top: FileSystemDirectoryHandle, path: readonly string[]): Promise<FileSystemDirectoryHandle>;
10
+ export declare const samePath: (a: readonly string[], b: readonly string[]) => boolean;
11
+ export {};
@@ -1,3 +1,3 @@
1
1
  export declare const nameOf: (id: string) => string;
2
- export declare function rootId(factory: IDBFactory, root: FileSystemDirectoryHandle, locks?: LockManager | undefined): Promise<string>;
2
+ export declare function rootId(factory: IDBFactory, root: FileSystemDirectoryHandle, locks?: LockManager | undefined, top?: () => Promise<FileSystemDirectoryHandle>): Promise<string>;
3
3
  export declare function metadataName(top: FileSystemDirectoryHandle | undefined, root: FileSystemDirectoryHandle, id: (root: FileSystemDirectoryHandle) => Promise<string>): Promise<string>;
@@ -137,6 +137,10 @@ export interface KernelFs {
137
137
  ackMs: readonly number[];
138
138
  };
139
139
  opfsOps?(): number;
140
+ metaTransactions?(): {
141
+ reads: number;
142
+ writes: number;
143
+ } | undefined;
140
144
  fileIdWrites?(): number;
141
145
  announceHolds?(add: ReadonlyArray<[string, string | undefined]>, drop: readonly string[], wait: boolean): Promise<void>;
142
146
  holdCounts?(): {
@@ -35,6 +35,7 @@ interface Typed {
35
35
  export declare const WATCH_NOTES_LIMIT = 1000;
36
36
  export interface WatchOptions {
37
37
  recursive?: boolean;
38
+ peers?: boolean;
38
39
  }
39
40
  export declare const WATCH_BATCH_LIMIT = 1000;
40
41
  export declare class FsWatchers {
@@ -55,7 +56,9 @@ export declare class FsWatchers {
55
56
  private renamed;
56
57
  heard(type: WatchEventType, paths: readonly string[]): void;
57
58
  changed(...paths: string[]): void;
59
+ peerChanged(paths: readonly string[]): void;
58
60
  private report;
61
+ private notify;
59
62
  private flush;
60
63
  wrap(fs: KernelFs): KernelFs;
61
64
  }
@@ -53,6 +53,10 @@ export interface ProcessListing {
53
53
  fsCalls?: number;
54
54
  opfsCalls?: number;
55
55
  opfsOps?: number;
56
+ meta?: {
57
+ reads: number;
58
+ writes: number;
59
+ } | undefined;
56
60
  cwdChecks?: number;
57
61
  staleFds?: number;
58
62
  fileIds?: number;
@@ -5,4 +5,6 @@ export interface MediaStore {
5
5
  }
6
6
  export declare const MEDIA_STORE = "handles";
7
7
  export declare function memoryMedia(): MediaStore;
8
- export declare function openMedia(name: string, factory: IDBFactory): Promise<MediaStore>;
8
+ type Top = () => Promise<FileSystemDirectoryHandle>;
9
+ export declare function openMedia(name: string, factory: IDBFactory, top?: Top): Promise<MediaStore>;
10
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { type LockManagerLike } from './client/protocol.js';
2
2
  import type { AttestOptions } from './fs/attest.js';
3
3
  import { type MetaStore } from './fs/meta.js';
4
+ import { type Portable } from './fs/portable.js';
4
5
  import { type ProtectInit } from './fs/protect.js';
5
6
  import { type UsersMode } from './fs/types.js';
6
7
  import type { EmbedderKindPolicy } from './kernel/embedder.js';
@@ -8,7 +9,7 @@ import type { WasmWorkerLike } from './kernel/host.js';
8
9
  import type { RouteTable } from './kernel/net/routes.js';
9
10
  import type { RealmTransportTraits } from './kernel/net/transport.js';
10
11
  import { type UplinkTraits } from './kernel/net/uplink.js';
11
- import { type ModuleUrlMaker, type RunOptions, type TerminalOptions } from './launcher.js';
12
+ import { type ModuleUrlMaker, type PendingMedium, type RunOptions, type TerminalOptions } from './launcher.js';
12
13
  import type { MediumHandle } from './mount/fsa.js';
13
14
  import type { HostfsGrant, HostfsPortGrant } from './mount/hostfs.js';
14
15
  import type { MediaStore } from './mount/media.js';
@@ -22,6 +23,7 @@ export interface InitRequest {
22
23
  id: number;
23
24
  op: 'init';
24
25
  root?: FileSystemDirectoryHandle;
26
+ rootPath?: string[];
25
27
  modules?: string;
26
28
  commands?: {
27
29
  append?: readonly string[];
@@ -133,13 +135,12 @@ export type MountRequest = {
133
135
  } | {
134
136
  id: number;
135
137
  op: 'mounts';
136
- } | {
138
+ } | ({
137
139
  id: number;
138
140
  op: 'insert';
139
141
  target: string;
140
142
  source?: string;
141
- handle: MediumHandle;
142
- };
143
+ } & Portable<MediumHandle>);
143
144
  export interface DialRequest {
144
145
  id: number;
145
146
  op: 'dial';
@@ -183,6 +184,7 @@ export type KernelRequest = {
183
184
  type WithoutId<T> = T extends unknown ? Omit<T, 'id'> : never;
184
185
  export type KernelCall = WithoutId<KernelRequest>;
185
186
  export declare function inOpfs(deps: ServeDeps, root: FileSystemDirectoryHandle): Promise<boolean>;
187
+ export declare function crossable(medium: PendingMedium): PendingMedium;
186
188
  export interface ServeDeps {
187
189
  rootId?: (root: FileSystemDirectoryHandle) => Promise<string>;
188
190
  storage: () => Promise<FileSystemDirectoryHandle>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-kernel",
3
- "version": "1.172.1",
3
+ "version": "1.173.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",
@@ -70,9 +70,9 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@ai-ecoverse/py-numpy": "2.5.4-4",
73
- "@ai-ecoverse/slicc-cdp": "1.43.1",
73
+ "@ai-ecoverse/slicc-cdp": "1.44.3",
74
74
  "@ai-ecoverse/slicc-scrub": "1.1.0",
75
- "@ai-ecoverse/slicc-shared-web": "2.13.7",
75
+ "@ai-ecoverse/slicc-shared-web": "2.13.10",
76
76
  "@ai-ecoverse/wasi-cargo": "0.99.0-6",
77
77
  "@ai-ecoverse/wasi-pnpm": "12.9.1-21",
78
78
  "@ai-ecoverse/wasi-ripgrep": "15.2.0-5",
@@ -95,7 +95,7 @@
95
95
  "esbuild": "0.28.2",
96
96
  "fake-indexeddb": "6.2.6",
97
97
  "lefthook": "2.2.2",
98
- "monocart-coverage-reports": "2.13.2",
98
+ "monocart-coverage-reports": "3.1.0",
99
99
  "pg-gateway": "0.3.0-beta.4",
100
100
  "semantic-release": "25.0.9",
101
101
  "typescript": "7.0.2",