@ai-ecoverse/slicc-kernel 1.124.2 → 1.124.3
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 +7 -2
- package/dist/kernel-worker.js +65 -28
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +39 -10
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +65 -28
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +39 -10
- package/dist/process-worker.js.map +3 -3
- package/dist/types/fs/remote.d.ts +8 -0
- package/dist/types/kernel/proc-info.d.ts +1 -0
- package/dist/types/realm/live-vfs-fs.d.ts +1 -0
- package/dist/types/realm/sync-fs-dispatch.d.ts +1 -0
- package/dist/types/realm/sync-sab-bridge.d.ts +2 -0
- package/package.json +4 -4
package/dist/node.js
CHANGED
|
@@ -4112,6 +4112,8 @@ var ProtectedFs = class {
|
|
|
4112
4112
|
// src/fs/remote.ts
|
|
4113
4113
|
var ANNOUNCE_WAIT_MS = 500;
|
|
4114
4114
|
var PRUNE_EVERY_MS = 3e4;
|
|
4115
|
+
var MOURN_TRIES = 5;
|
|
4116
|
+
var MOURN_RETRY_MS = 100;
|
|
4115
4117
|
function lockManager() {
|
|
4116
4118
|
return globalThis.navigator?.locks;
|
|
4117
4119
|
}
|
|
@@ -4120,6 +4122,7 @@ var RemoteWatch = class {
|
|
|
4120
4122
|
name;
|
|
4121
4123
|
tab = crypto.randomUUID();
|
|
4122
4124
|
peers = /* @__PURE__ */ new Set();
|
|
4125
|
+
mourned = /* @__PURE__ */ new Set();
|
|
4123
4126
|
others = /* @__PURE__ */ new Map();
|
|
4124
4127
|
union = /* @__PURE__ */ new Set();
|
|
4125
4128
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -4188,8 +4191,7 @@ var RemoteWatch = class {
|
|
|
4188
4191
|
receive(data) {
|
|
4189
4192
|
if (data.hello !== void 0) this.greeted(data.hello);
|
|
4190
4193
|
if (data.here !== void 0 && data.to === this.tab) {
|
|
4191
|
-
this.
|
|
4192
|
-
this.recount();
|
|
4194
|
+
this.arrived(data.here);
|
|
4193
4195
|
this.met?.();
|
|
4194
4196
|
}
|
|
4195
4197
|
if (data.tab !== void 0 && data.paths !== void 0) this.announced(data);
|
|
@@ -4198,9 +4200,36 @@ var RemoteWatch = class {
|
|
|
4198
4200
|
}
|
|
4199
4201
|
if (data.changed !== void 0) this.emit({ paths: data.changed, trees: [] });
|
|
4200
4202
|
}
|
|
4201
|
-
|
|
4203
|
+
arrived(peer) {
|
|
4202
4204
|
this.peers.add(peer);
|
|
4203
4205
|
this.recount();
|
|
4206
|
+
void this.mourn(peer);
|
|
4207
|
+
}
|
|
4208
|
+
async mourn(peer, tries = MOURN_TRIES) {
|
|
4209
|
+
if (!this.locks || this.mourned.has(peer)) return;
|
|
4210
|
+
this.mourned.add(peer);
|
|
4211
|
+
const name2 = this.lockOf(peer);
|
|
4212
|
+
const { held = [], pending = [] } = await this.locks.query();
|
|
4213
|
+
if (![...held, ...pending].some((lock) => lock.name === name2)) {
|
|
4214
|
+
this.mourned.delete(peer);
|
|
4215
|
+
if (tries > 1 && this.peers.has(peer)) {
|
|
4216
|
+
setTimeout(() => void this.mourn(peer, tries - 1), MOURN_RETRY_MS);
|
|
4217
|
+
}
|
|
4218
|
+
return;
|
|
4219
|
+
}
|
|
4220
|
+
void this.locks.request(name2, async () => {
|
|
4221
|
+
this.mourned.delete(peer);
|
|
4222
|
+
this.others.delete(peer);
|
|
4223
|
+
this.peers.delete(peer);
|
|
4224
|
+
this.rebuild();
|
|
4225
|
+
this.recount();
|
|
4226
|
+
for (const wait2 of this.waiting.values()) {
|
|
4227
|
+
if (wait2.left.delete(peer) && wait2.left.size === 0) wait2.done();
|
|
4228
|
+
}
|
|
4229
|
+
});
|
|
4230
|
+
}
|
|
4231
|
+
greeted(peer) {
|
|
4232
|
+
this.arrived(peer);
|
|
4204
4233
|
const answer = () => {
|
|
4205
4234
|
this.channel.postMessage({ here: this.tab, to: peer });
|
|
4206
4235
|
if (this.mine.length > 0) void this.announce(this.mine);
|
|
@@ -4210,8 +4239,7 @@ var RemoteWatch = class {
|
|
|
4210
4239
|
}
|
|
4211
4240
|
announced({ tab, paths, seq: seq2 }) {
|
|
4212
4241
|
const from = tab;
|
|
4213
|
-
this.
|
|
4214
|
-
this.recount();
|
|
4242
|
+
this.arrived(from);
|
|
4215
4243
|
if (paths.length > 0) this.others.set(from, paths);
|
|
4216
4244
|
else this.others.delete(from);
|
|
4217
4245
|
this.rebuild();
|
|
@@ -4819,7 +4847,8 @@ var OpfsFs = class {
|
|
|
4819
4847
|
async linkAlong(path) {
|
|
4820
4848
|
for (const entry of await this.meta.get(prefixes(path))) {
|
|
4821
4849
|
if (entry?.link === void 0) continue;
|
|
4822
|
-
if (
|
|
4850
|
+
if (entry.path !== path && await this.real(entry.path)) continue;
|
|
4851
|
+
if (await this.real(parentOf4(entry.path))) return entry;
|
|
4823
4852
|
}
|
|
4824
4853
|
return void 0;
|
|
4825
4854
|
}
|
|
@@ -6541,7 +6570,7 @@ var CdpFacade = class {
|
|
|
6541
6570
|
for (const conn of this.connections) conn.close();
|
|
6542
6571
|
}
|
|
6543
6572
|
async acceptLoop() {
|
|
6544
|
-
const
|
|
6573
|
+
const served2 = /* @__PURE__ */ new Set();
|
|
6545
6574
|
for (; ; ) {
|
|
6546
6575
|
let conn;
|
|
6547
6576
|
try {
|
|
@@ -6549,10 +6578,10 @@ var CdpFacade = class {
|
|
|
6549
6578
|
} catch {
|
|
6550
6579
|
break;
|
|
6551
6580
|
}
|
|
6552
|
-
const done4 = this.serve(conn).finally(() =>
|
|
6553
|
-
|
|
6581
|
+
const done4 = this.serve(conn).finally(() => served2.delete(done4));
|
|
6582
|
+
served2.add(done4);
|
|
6554
6583
|
}
|
|
6555
|
-
await Promise.allSettled([...
|
|
6584
|
+
await Promise.allSettled([...served2]);
|
|
6556
6585
|
}
|
|
6557
6586
|
async serve(conn) {
|
|
6558
6587
|
this.connections.add(conn);
|
|
@@ -6944,7 +6973,7 @@ function satisfies(version, range2) {
|
|
|
6944
6973
|
}
|
|
6945
6974
|
|
|
6946
6975
|
// src/version.ts
|
|
6947
|
-
var KERNEL_VERSION = true ? "1.124.
|
|
6976
|
+
var KERNEL_VERSION = true ? "1.124.3" : "0.0.0-dev";
|
|
6948
6977
|
var OS_RELEASE = "6.0.0-slicc";
|
|
6949
6978
|
function procVersion() {
|
|
6950
6979
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -8359,7 +8388,7 @@ var RealmProxy = class {
|
|
|
8359
8388
|
for (const conn of this.connections) conn.close();
|
|
8360
8389
|
}
|
|
8361
8390
|
async acceptLoop() {
|
|
8362
|
-
const
|
|
8391
|
+
const served2 = /* @__PURE__ */ new Set();
|
|
8363
8392
|
try {
|
|
8364
8393
|
for (; ; ) {
|
|
8365
8394
|
await this.slots.acquire(1, this.stop.signal);
|
|
@@ -8372,13 +8401,13 @@ var RealmProxy = class {
|
|
|
8372
8401
|
}
|
|
8373
8402
|
const done4 = this.serve(conn).finally(() => {
|
|
8374
8403
|
this.slots.release(1);
|
|
8375
|
-
|
|
8404
|
+
served2.delete(done4);
|
|
8376
8405
|
});
|
|
8377
|
-
|
|
8406
|
+
served2.add(done4);
|
|
8378
8407
|
}
|
|
8379
8408
|
} catch {
|
|
8380
8409
|
}
|
|
8381
|
-
await Promise.allSettled([...
|
|
8410
|
+
await Promise.allSettled([...served2]);
|
|
8382
8411
|
}
|
|
8383
8412
|
async serve(conn) {
|
|
8384
8413
|
this.connections.add(conn);
|
|
@@ -12110,7 +12139,12 @@ var IDENTITY_OPS = /* @__PURE__ */ new Set([
|
|
|
12110
12139
|
"chown",
|
|
12111
12140
|
"lchown"
|
|
12112
12141
|
]);
|
|
12142
|
+
var served = 0;
|
|
12143
|
+
function servedFsCalls() {
|
|
12144
|
+
return served;
|
|
12145
|
+
}
|
|
12113
12146
|
async function dispatchSyncFs(req) {
|
|
12147
|
+
served++;
|
|
12114
12148
|
const entry = resolveSyncFsToken(req.token);
|
|
12115
12149
|
if (!entry) return { ok: false, errno: "EACCES", message: "sync-fs: unknown or revoked token" };
|
|
12116
12150
|
if (!req.identity || !IDENTITY_OPS.has(req.op)) return dispatchOne(entry, req);
|
|
@@ -12819,6 +12853,8 @@ var SYS_TREE = {
|
|
|
12819
12853
|
slicc_wasm_memories: (listing) => `${listing.wasm?.live ?? 0} ${listing.wasm?.ceiling ?? 0} ${listing.wasm?.source ?? "none"}
|
|
12820
12854
|
`,
|
|
12821
12855
|
slicc_shared_root: (listing) => `${listing.peers ?? 0}
|
|
12856
|
+
`,
|
|
12857
|
+
slicc_fs_calls: (listing) => `${listing.fsCalls ?? 0}
|
|
12822
12858
|
`
|
|
12823
12859
|
}
|
|
12824
12860
|
};
|
|
@@ -23122,7 +23158,7 @@ async function openHostfs(spec, connect2, timing = {}) {
|
|
|
23122
23158
|
...active?.capabilities.ranges === true ? { ranges: true } : {},
|
|
23123
23159
|
...active ? { maxIo: Math.min(active.maxIo, HOSTFS_IO) } : {}
|
|
23124
23160
|
});
|
|
23125
|
-
const
|
|
23161
|
+
const served2 = serveFilesystem(
|
|
23126
23162
|
port2,
|
|
23127
23163
|
{ ...slot2.handlers, mount: ranged2 },
|
|
23128
23164
|
{
|
|
@@ -23139,12 +23175,12 @@ async function openHostfs(spec, connect2, timing = {}) {
|
|
|
23139
23175
|
up(client) {
|
|
23140
23176
|
active = timed(client, timing.callMs ?? HOSTFS_CALL_MS);
|
|
23141
23177
|
slot2.insert(client, handlers);
|
|
23142
|
-
|
|
23178
|
+
served2.invalidate(true);
|
|
23143
23179
|
},
|
|
23144
|
-
event: (event) =>
|
|
23180
|
+
event: (event) => served2.invalidate(invalidation(event)),
|
|
23145
23181
|
down() {
|
|
23146
23182
|
slot2.eject();
|
|
23147
|
-
|
|
23183
|
+
served2.invalidate(true);
|
|
23148
23184
|
},
|
|
23149
23185
|
...timing
|
|
23150
23186
|
},
|
|
@@ -25322,7 +25358,8 @@ var Launcher = class {
|
|
|
25322
25358
|
load: this.loadAverage(),
|
|
25323
25359
|
cpu: this.cpuTotal(),
|
|
25324
25360
|
wasm: this.memories.count(),
|
|
25325
|
-
peers: Number(this.locks.shared?.() === true)
|
|
25361
|
+
peers: Number(this.locks.shared?.() === true),
|
|
25362
|
+
fsCalls: servedFsCalls()
|
|
25326
25363
|
}),
|
|
25327
25364
|
sudo: (call, signal) => this.sudo(pid, call, signal),
|
|
25328
25365
|
crontab: (call) => this.crontab(pid, call),
|
|
@@ -25816,7 +25853,7 @@ var Launcher = class {
|
|
|
25816
25853
|
const worker = this.createDriverWorker();
|
|
25817
25854
|
const driver = new MessageChannel();
|
|
25818
25855
|
const client = new MessageChannel();
|
|
25819
|
-
const
|
|
25856
|
+
const served2 = serveClient(client.port1, {
|
|
25820
25857
|
launcher: async () => this,
|
|
25821
25858
|
scope: "transport"
|
|
25822
25859
|
});
|
|
@@ -25828,7 +25865,7 @@ var Launcher = class {
|
|
|
25828
25865
|
port: driver.port1,
|
|
25829
25866
|
dispose: () => {
|
|
25830
25867
|
worker.terminate();
|
|
25831
|
-
|
|
25868
|
+
served2.detach();
|
|
25832
25869
|
driver.port1.close();
|
|
25833
25870
|
},
|
|
25834
25871
|
onCrash: (listener) => worker.addEventListener("error", (event) => {
|
|
@@ -25842,12 +25879,12 @@ var Launcher = class {
|
|
|
25842
25879
|
const ask = (handle) => this.onMountPending?.({ target, source, ...handle ? { handle } : {} });
|
|
25843
25880
|
const { port1, port2 } = new MessageChannel();
|
|
25844
25881
|
const medium = removableMedium((handle) => {
|
|
25845
|
-
|
|
25882
|
+
served2.invalidate(true);
|
|
25846
25883
|
ask(handle);
|
|
25847
25884
|
});
|
|
25848
|
-
const
|
|
25885
|
+
const served2 = serveFilesystem(port2, medium.handlers, FSA_CAPABILITIES);
|
|
25849
25886
|
const id2 = source.slice("fsa:".length);
|
|
25850
|
-
this.removable.set(target, { id: id2, medium, served });
|
|
25887
|
+
this.removable.set(target, { id: id2, medium, served: served2 });
|
|
25851
25888
|
const stored = this.inserted.get(id2) ?? await this.media.get(id2);
|
|
25852
25889
|
if (stored && await granted(stored)) medium.insert(stored);
|
|
25853
25890
|
else ask(stored);
|
|
@@ -27906,14 +27943,14 @@ async function createNodeKernel(options = {}) {
|
|
|
27906
27943
|
throw fsError("ENOENT", `no user ${String(user)}`);
|
|
27907
27944
|
}
|
|
27908
27945
|
const { port1, port2 } = new MessageChannel2();
|
|
27909
|
-
const
|
|
27946
|
+
const served2 = serveClient(port1, {
|
|
27910
27947
|
launcher: async () => launcher,
|
|
27911
27948
|
signal: signalNumber,
|
|
27912
27949
|
...user !== void 0 ? { user } : {},
|
|
27913
27950
|
...tag !== void 0 ? { tag } : {}
|
|
27914
27951
|
});
|
|
27915
|
-
clients.add(
|
|
27916
|
-
void
|
|
27952
|
+
clients.add(served2);
|
|
27953
|
+
void served2.closed.then(() => clients.delete(served2));
|
|
27917
27954
|
return port2;
|
|
27918
27955
|
},
|
|
27919
27956
|
terminate() {
|