@ai-ecoverse/slicc-kernel 1.127.0 → 1.127.1
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 +3 -1
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +79 -25
- package/dist/kernel-worker.js.map +3 -3
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.js +3 -1
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +79 -25
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +3 -1
- package/dist/process-worker.js.map +2 -2
- package/dist/types/fs/opfs.d.ts +5 -0
- package/dist/types/fs/types.d.ts +1 -0
- package/dist/types/kernel/proc-info.d.ts +1 -0
- package/package.json +2 -2
package/dist/node.js
CHANGED
|
@@ -4593,7 +4593,7 @@ var OpfsFs = class {
|
|
|
4593
4593
|
}
|
|
4594
4594
|
async recounting(handle, target) {
|
|
4595
4595
|
if (this.counted.length === 0) return;
|
|
4596
|
-
const where = await this.root.resolve(handle).catch(() => null);
|
|
4596
|
+
const where = await this.io(this.root.resolve(handle)).catch(() => null);
|
|
4597
4597
|
await this.counting(where ? `/${where.join("/")}` : target);
|
|
4598
4598
|
}
|
|
4599
4599
|
resolvePath(base, path) {
|
|
@@ -4795,9 +4795,17 @@ var OpfsFs = class {
|
|
|
4795
4795
|
}
|
|
4796
4796
|
exact = 0;
|
|
4797
4797
|
calls = 0;
|
|
4798
|
+
others = 0;
|
|
4798
4799
|
opfsCalls() {
|
|
4799
4800
|
return this.calls;
|
|
4800
4801
|
}
|
|
4802
|
+
opfsOps() {
|
|
4803
|
+
return this.calls + this.others;
|
|
4804
|
+
}
|
|
4805
|
+
io(request) {
|
|
4806
|
+
this.others++;
|
|
4807
|
+
return request;
|
|
4808
|
+
}
|
|
4801
4809
|
fresh() {
|
|
4802
4810
|
this.changes++;
|
|
4803
4811
|
this.absent.clear();
|
|
@@ -4821,7 +4829,13 @@ var OpfsFs = class {
|
|
|
4821
4829
|
this.absent.set(path, performance.now());
|
|
4822
4830
|
}
|
|
4823
4831
|
remember(path, handle, looked = false) {
|
|
4824
|
-
if (handle.kind !== "file")
|
|
4832
|
+
if (handle.kind !== "file") {
|
|
4833
|
+
if (looked) {
|
|
4834
|
+
this.dirs.set(path, handle);
|
|
4835
|
+
this.checked.set(handle, performance.now());
|
|
4836
|
+
}
|
|
4837
|
+
return handle;
|
|
4838
|
+
}
|
|
4825
4839
|
if (looked) {
|
|
4826
4840
|
this.found.set(handle, performance.now());
|
|
4827
4841
|
this.glances.delete(handle);
|
|
@@ -5202,7 +5216,7 @@ var OpfsFs = class {
|
|
|
5202
5216
|
async readFileBuffer(path) {
|
|
5203
5217
|
const bytes = await this.reading(
|
|
5204
5218
|
path,
|
|
5205
|
-
async (handle) => new Uint8Array(await (await handle.getFile()).arrayBuffer())
|
|
5219
|
+
async (handle) => new Uint8Array(await (await this.io(handle.getFile())).arrayBuffer())
|
|
5206
5220
|
);
|
|
5207
5221
|
await this.refuseNode(path, bytes.length === 0);
|
|
5208
5222
|
return bytes;
|
|
@@ -5210,7 +5224,7 @@ var OpfsFs = class {
|
|
|
5210
5224
|
async readVersioned(path, cached = false) {
|
|
5211
5225
|
return this.reading(path, async (handle) => {
|
|
5212
5226
|
const stamp = await this.stamp(path, cached);
|
|
5213
|
-
const file = await handle.getFile();
|
|
5227
|
+
const file = await this.io(handle.getFile());
|
|
5214
5228
|
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
5215
5229
|
await this.refuseNode(path, bytes.length === 0);
|
|
5216
5230
|
return { bytes, version: `${file.lastModified}:${file.size}:${stamp}` };
|
|
@@ -5219,23 +5233,53 @@ var OpfsFs = class {
|
|
|
5219
5233
|
async version(path, cached = false) {
|
|
5220
5234
|
return this.reading(path, async (handle) => {
|
|
5221
5235
|
const stamp = await this.stamp(path, cached);
|
|
5222
|
-
const file = await handle.getFile();
|
|
5236
|
+
const file = await this.io(handle.getFile());
|
|
5223
5237
|
return `${file.lastModified}:${file.size}:${stamp}`;
|
|
5224
5238
|
});
|
|
5225
5239
|
}
|
|
5226
5240
|
async pread(path, offset, length2) {
|
|
5227
5241
|
return this.reading(path, async (handle) => {
|
|
5228
|
-
const file = await handle.getFile();
|
|
5242
|
+
const file = await this.io(handle.getFile());
|
|
5229
5243
|
await this.refuseNode(path, file.size === 0);
|
|
5230
5244
|
return new Uint8Array(await file.slice(offset, offset + length2).arrayBuffer());
|
|
5231
5245
|
});
|
|
5232
5246
|
}
|
|
5233
5247
|
async pwrite(path, offset, bytes) {
|
|
5234
|
-
const [
|
|
5248
|
+
const [kept, target] = await this.keptFor(path);
|
|
5249
|
+
if (kept) {
|
|
5250
|
+
try {
|
|
5251
|
+
await this.writeAt(kept, target, path, offset, bytes);
|
|
5252
|
+
return;
|
|
5253
|
+
} catch (err) {
|
|
5254
|
+
if (err.code !== "ENOENT") throw err;
|
|
5255
|
+
this.files.delete(target);
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
const [handle] = await this.fileFor(path);
|
|
5259
|
+
await this.writeAt(handle, target, path, offset, bytes);
|
|
5260
|
+
}
|
|
5261
|
+
async keptFor(path) {
|
|
5262
|
+
const at = normalizePath(path);
|
|
5263
|
+
const cached = this.files.get(at);
|
|
5264
|
+
const fresh2 = cached && performance.now() - (this.found.get(cached) ?? -CHECK_MS) < CHECK_MS;
|
|
5265
|
+
const [target, existed] = fresh2 ? [at, true] : await this.writeTarget(path);
|
|
5266
|
+
if (!existed) return [void 0, target];
|
|
5267
|
+
this.refuse(target);
|
|
5268
|
+
const [entry] = await this.meta.get([target]);
|
|
5269
|
+
if (entry?.fifo || entry?.socket) throw fsError("ENXIO", path);
|
|
5270
|
+
const kept = fresh2 ? cached : this.files.get(target);
|
|
5271
|
+
const usable2 = kept && performance.now() - (this.found.get(kept) ?? -CHECK_MS) < CHECK_MS;
|
|
5272
|
+
return [usable2 ? kept : void 0, target];
|
|
5273
|
+
}
|
|
5274
|
+
async writeAt(handle, target, path, offset, bytes) {
|
|
5235
5275
|
await this.counting(target);
|
|
5236
5276
|
this.wrote(handle);
|
|
5237
5277
|
try {
|
|
5238
|
-
await this.retrying(
|
|
5278
|
+
await this.retrying(
|
|
5279
|
+
path,
|
|
5280
|
+
() => this.io(positioned(handle, (io) => io.write(offset, bytes))),
|
|
5281
|
+
true
|
|
5282
|
+
);
|
|
5239
5283
|
} finally {
|
|
5240
5284
|
this.wrote(handle);
|
|
5241
5285
|
await this.recounting(handle, target);
|
|
@@ -5244,13 +5288,13 @@ var OpfsFs = class {
|
|
|
5244
5288
|
}
|
|
5245
5289
|
async truncate(path, size) {
|
|
5246
5290
|
const handle = await this.existing(path, true);
|
|
5247
|
-
await this.refuseNode(path, (await handle.getFile()).size === 0);
|
|
5291
|
+
await this.refuseNode(path, (await this.io(handle.getFile())).size === 0);
|
|
5248
5292
|
const resolve2 = this.ranged || this.remote?.watched();
|
|
5249
5293
|
const target = resolve2 || this.counted.length > 0 ? (await this.locate(path, true)).path : path;
|
|
5250
5294
|
await this.counting(target);
|
|
5251
5295
|
this.wrote(handle);
|
|
5252
5296
|
try {
|
|
5253
|
-
await this.retrying(path, () => positioned(handle, (io) => io.truncate(size)), true);
|
|
5297
|
+
await this.retrying(path, () => this.io(positioned(handle, (io) => io.truncate(size))), true);
|
|
5254
5298
|
} finally {
|
|
5255
5299
|
this.wrote(handle);
|
|
5256
5300
|
await this.recounting(handle, target);
|
|
@@ -5261,7 +5305,7 @@ var OpfsFs = class {
|
|
|
5261
5305
|
const [handle, , target] = await this.fileFor(path);
|
|
5262
5306
|
const writable2 = await this.retrying(
|
|
5263
5307
|
path,
|
|
5264
|
-
() => handle.createWritable({ keepExistingData: !truncate }),
|
|
5308
|
+
() => this.io(handle.createWritable({ keepExistingData: !truncate })),
|
|
5265
5309
|
true
|
|
5266
5310
|
);
|
|
5267
5311
|
return {
|
|
@@ -5310,7 +5354,7 @@ var OpfsFs = class {
|
|
|
5310
5354
|
try {
|
|
5311
5355
|
const handle = await this.inDir(
|
|
5312
5356
|
dir,
|
|
5313
|
-
(parent) => parent.getFileHandle(name2, { create: true })
|
|
5357
|
+
(parent) => this.io(parent.getFileHandle(name2, { create: true }))
|
|
5314
5358
|
);
|
|
5315
5359
|
if (!existed) this.touch(Date.now(), parentOf4(target));
|
|
5316
5360
|
return [handle, existed, target];
|
|
@@ -5326,7 +5370,7 @@ var OpfsFs = class {
|
|
|
5326
5370
|
let writable2;
|
|
5327
5371
|
this.wrote(file);
|
|
5328
5372
|
try {
|
|
5329
|
-
writable2 = await file.createWritable();
|
|
5373
|
+
writable2 = await this.io(file.createWritable());
|
|
5330
5374
|
await writable2.write(content);
|
|
5331
5375
|
await writable2.close();
|
|
5332
5376
|
} catch (err) {
|
|
@@ -5342,6 +5386,7 @@ var OpfsFs = class {
|
|
|
5342
5386
|
const handle = found.handle;
|
|
5343
5387
|
if (handle.kind !== "directory") throw fsError("ENOTDIR", path);
|
|
5344
5388
|
const children3 = /* @__PURE__ */ new Map();
|
|
5389
|
+
this.others++;
|
|
5345
5390
|
for await (const child of handle.values()) children3.set(child.name, child);
|
|
5346
5391
|
for (const link2 of await this.meta.links(found.path)) {
|
|
5347
5392
|
const name2 = baseOf(link2.path);
|
|
@@ -5395,7 +5440,7 @@ var OpfsFs = class {
|
|
|
5395
5440
|
const parent = await this.locate(parentOf4(path), true);
|
|
5396
5441
|
if (parent.handle?.kind !== "directory") throw fsError("ENOTDIR", path);
|
|
5397
5442
|
this.refuse(resolvePath(parent.path, baseOf(path)));
|
|
5398
|
-
await parent.handle.getDirectoryHandle(baseOf(path), { create: true });
|
|
5443
|
+
await this.io(parent.handle.getDirectoryHandle(baseOf(path), { create: true }));
|
|
5399
5444
|
const now = Date.now();
|
|
5400
5445
|
const made2 = `${parent.path === "/" ? "" : parent.path}/${baseOf(path)}`;
|
|
5401
5446
|
await this.stampNew(made2, owner, true);
|
|
@@ -5416,7 +5461,7 @@ var OpfsFs = class {
|
|
|
5416
5461
|
if (found !== void 0 && !found.vacated) await this.meta.remove([path]);
|
|
5417
5462
|
this.forget(physical);
|
|
5418
5463
|
this.refuse(physical);
|
|
5419
|
-
await dir.getDirectoryHandle(name2, { create: true });
|
|
5464
|
+
await this.io(dir.getDirectoryHandle(name2, { create: true }));
|
|
5420
5465
|
const now = Date.now();
|
|
5421
5466
|
const made2 = `${parent.path === "/" ? "" : parent.path}/${name2}`;
|
|
5422
5467
|
await this.stampNew(made2, owner, true);
|
|
@@ -5438,9 +5483,10 @@ var OpfsFs = class {
|
|
|
5438
5483
|
if (found !== void 0 && !found.vacated) await this.meta.remove([path]);
|
|
5439
5484
|
this.forget(physical);
|
|
5440
5485
|
this.refuse(physical);
|
|
5441
|
-
await dir.getFileHandle(name2, { create: true });
|
|
5486
|
+
const handle = await this.io(dir.getFileHandle(name2, { create: true }));
|
|
5442
5487
|
const now = Date.now();
|
|
5443
5488
|
const made2 = `${parent.path === "/" ? "" : parent.path}/${name2}`;
|
|
5489
|
+
this.remember(made2, handle, true);
|
|
5444
5490
|
await this.stampNew(made2, owner, false);
|
|
5445
5491
|
this.touch(now, parent.path, made2);
|
|
5446
5492
|
});
|
|
@@ -5472,7 +5518,7 @@ var OpfsFs = class {
|
|
|
5472
5518
|
try {
|
|
5473
5519
|
await this.inDir(
|
|
5474
5520
|
dir,
|
|
5475
|
-
(parent) => parent.removeEntry(name2, { recursive: options.recursive === true })
|
|
5521
|
+
(parent) => this.io(parent.removeEntry(name2, { recursive: options.recursive === true }))
|
|
5476
5522
|
);
|
|
5477
5523
|
} catch (err) {
|
|
5478
5524
|
throw translate(err, path);
|
|
@@ -5713,7 +5759,9 @@ var OpfsFs = class {
|
|
|
5713
5759
|
}
|
|
5714
5760
|
}
|
|
5715
5761
|
async place(handle, dir, name2) {
|
|
5716
|
-
const
|
|
5762
|
+
const move = handle.move;
|
|
5763
|
+
if (move) this.others++;
|
|
5764
|
+
const moved2 = await move?.call(handle, dir, name2).then(
|
|
5717
5765
|
() => true,
|
|
5718
5766
|
() => false
|
|
5719
5767
|
);
|
|
@@ -5723,7 +5771,7 @@ var OpfsFs = class {
|
|
|
5723
5771
|
await this.copy(handle, dir, name2);
|
|
5724
5772
|
} catch (err) {
|
|
5725
5773
|
if (handle.kind === "directory" && this.fileMoves === before) {
|
|
5726
|
-
await dir.removeEntry(name2, { recursive: true });
|
|
5774
|
+
await this.io(dir.removeEntry(name2, { recursive: true }));
|
|
5727
5775
|
}
|
|
5728
5776
|
throw translate(err, name2);
|
|
5729
5777
|
}
|
|
@@ -5732,6 +5780,7 @@ var OpfsFs = class {
|
|
|
5732
5780
|
fileMoves = 0;
|
|
5733
5781
|
async copy(handle, dir, name2) {
|
|
5734
5782
|
if (handle.kind === "file" && movable(handle)) {
|
|
5783
|
+
this.others++;
|
|
5735
5784
|
const moved2 = await handle.move?.(dir, name2).then(
|
|
5736
5785
|
() => true,
|
|
5737
5786
|
() => false
|
|
@@ -5742,12 +5791,14 @@ var OpfsFs = class {
|
|
|
5742
5791
|
}
|
|
5743
5792
|
}
|
|
5744
5793
|
if (handle.kind === "file") {
|
|
5745
|
-
const
|
|
5746
|
-
|
|
5794
|
+
const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
|
|
5795
|
+
const writable2 = await this.io(made2.createWritable());
|
|
5796
|
+
await writable2.write(await this.io(handle.getFile()));
|
|
5747
5797
|
await writable2.close();
|
|
5748
5798
|
return;
|
|
5749
5799
|
}
|
|
5750
|
-
const target = await dir.getDirectoryHandle(name2, { create: true });
|
|
5800
|
+
const target = await this.io(dir.getDirectoryHandle(name2, { create: true }));
|
|
5801
|
+
this.others++;
|
|
5751
5802
|
for await (const child of handle.values()) await this.copy(child, target, child.name);
|
|
5752
5803
|
}
|
|
5753
5804
|
async symlink(target, path, owner) {
|
|
@@ -5820,7 +5871,7 @@ var OpfsFs = class {
|
|
|
5820
5871
|
return;
|
|
5821
5872
|
}
|
|
5822
5873
|
const handle = found.handle;
|
|
5823
|
-
const file = handle.kind === "file" ? await handle.getFile() : void 0;
|
|
5874
|
+
const file = handle.kind === "file" ? await this.io(handle.getFile()) : void 0;
|
|
5824
5875
|
this.dirTimes.delete(found.path);
|
|
5825
5876
|
this.fileTimes.delete(found.path);
|
|
5826
5877
|
const ctimeMs = Date.now();
|
|
@@ -7277,7 +7328,7 @@ function satisfies(version, range2) {
|
|
|
7277
7328
|
}
|
|
7278
7329
|
|
|
7279
7330
|
// src/version.ts
|
|
7280
|
-
var KERNEL_VERSION = true ? "1.127.
|
|
7331
|
+
var KERNEL_VERSION = true ? "1.127.1" : "0.0.0-dev";
|
|
7281
7332
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7282
7333
|
function procVersion() {
|
|
7283
7334
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -13363,6 +13414,8 @@ var SYS_TREE = {
|
|
|
13363
13414
|
slicc_fs_calls: (listing) => `${listing.fsCalls ?? 0}
|
|
13364
13415
|
`,
|
|
13365
13416
|
slicc_opfs_calls: (listing) => `${listing.opfsCalls ?? 0}
|
|
13417
|
+
`,
|
|
13418
|
+
slicc_opfs_ops: (listing) => `${listing.opfsOps ?? 0}
|
|
13366
13419
|
`
|
|
13367
13420
|
}
|
|
13368
13421
|
};
|
|
@@ -26955,7 +27008,8 @@ var Launcher = class {
|
|
|
26955
27008
|
wasm: this.memories.count(),
|
|
26956
27009
|
peers: Number(this.locks.shared?.() === true),
|
|
26957
27010
|
fsCalls: servedFsCalls(),
|
|
26958
|
-
opfsCalls: this.rootFs.opfsCalls?.() ?? 0
|
|
27011
|
+
opfsCalls: this.rootFs.opfsCalls?.() ?? 0,
|
|
27012
|
+
opfsOps: this.rootFs.opfsOps?.() ?? 0
|
|
26959
27013
|
}),
|
|
26960
27014
|
sudo: (call, signal) => this.sudo(pid, call, signal),
|
|
26961
27015
|
crontab: (call) => this.crontab(pid, call),
|