@ai-ecoverse/slicc-kernel 1.76.0 → 1.77.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 +4 -4
- package/dist/driver-worker.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +73 -9
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-driver-worker.js.map +1 -1
- package/dist/node-process-worker.js +170 -133
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +73 -9
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +44 -7
- package/dist/process-worker.js.map +2 -2
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -7961,6 +7961,7 @@ var IDLE_OPS = /* @__PURE__ */ new Set([
|
|
|
7961
7961
|
]);
|
|
7962
7962
|
var SYS_CAP_US = 2e4;
|
|
7963
7963
|
var LOCAL = SAB_CLOCK_OFFSET;
|
|
7964
|
+
var BLOCKED = 0;
|
|
7964
7965
|
var IDLE = 1;
|
|
7965
7966
|
function epochMicros() {
|
|
7966
7967
|
return Math.floor((performance.timeOrigin + performance.now()) * 1e3);
|
|
@@ -8035,6 +8036,7 @@ var CpuClock = class {
|
|
|
8035
8036
|
const busy = this.kind === "sys" ? Math.min(spent, SYS_CAP_US) : 0;
|
|
8036
8037
|
this.sys += busy;
|
|
8037
8038
|
this.idle += spent - busy;
|
|
8039
|
+
Atomics.store(slots(this.sab), BLOCKED, BigInt(this.idle));
|
|
8038
8040
|
}
|
|
8039
8041
|
};
|
|
8040
8042
|
var ProcessClocks = class {
|
|
@@ -8406,8 +8408,8 @@ function pidStat(info, boot) {
|
|
|
8406
8408
|
0,
|
|
8407
8409
|
ticks(info.utime ?? 0),
|
|
8408
8410
|
ticks(info.stime ?? 0),
|
|
8409
|
-
0,
|
|
8410
|
-
0,
|
|
8411
|
+
ticks(info.cutime ?? 0),
|
|
8412
|
+
ticks(info.cstime ?? 0),
|
|
8411
8413
|
20,
|
|
8412
8414
|
0,
|
|
8413
8415
|
1,
|
|
@@ -8431,8 +8433,9 @@ function pidStat(info, boot) {
|
|
|
8431
8433
|
`;
|
|
8432
8434
|
}
|
|
8433
8435
|
var sigMask = (mask = 0) => (mask >>> 1).toString(16).padStart(16, "0");
|
|
8436
|
+
var STATES = { S: "S (sleeping)", T: "T (stopped)", Z: "Z (zombie)" };
|
|
8434
8437
|
function pidStatus(info) {
|
|
8435
|
-
const state = info.state
|
|
8438
|
+
const state = STATES[info.state];
|
|
8436
8439
|
const c = info.cred ?? ROOT;
|
|
8437
8440
|
const ids = (r, e, s) => `${r} ${e} ${s} ${e}`;
|
|
8438
8441
|
return [
|
|
@@ -12042,6 +12045,16 @@ function words(value) {
|
|
|
12042
12045
|
}
|
|
12043
12046
|
return [...value];
|
|
12044
12047
|
}
|
|
12048
|
+
var ESCAPES = { " ": "\\t", "\n": "\\n", "\r": "\\r" };
|
|
12049
|
+
function clipboardLine(text) {
|
|
12050
|
+
let out = "";
|
|
12051
|
+
for (const c of text) {
|
|
12052
|
+
const code = c.charCodeAt(0);
|
|
12053
|
+
const control = code < 32 || code === 127;
|
|
12054
|
+
out += control ? ESCAPES[c] ?? `\\x${code.toString(16).padStart(2, "0")}` : c;
|
|
12055
|
+
}
|
|
12056
|
+
return out.length > 200 ? `${out.slice(0, 200)}\u2026` : out;
|
|
12057
|
+
}
|
|
12045
12058
|
var DYING = { ok: false, errno: "EINTR", message: "the process is being killed" };
|
|
12046
12059
|
var HOSTS_ONLY = new Resolver({ routes: new Routes() });
|
|
12047
12060
|
var WasmProcess = class {
|
|
@@ -12294,7 +12307,22 @@ var WasmProcess = class {
|
|
|
12294
12307
|
if (req.max <= 0) return new Uint8Array(0);
|
|
12295
12308
|
if (channel.unread) channel.stamp = await this.clipboardStamp();
|
|
12296
12309
|
const signal = channel.settled ? this.interrupt.signal : this.blockingSignal(cancelled);
|
|
12297
|
-
|
|
12310
|
+
try {
|
|
12311
|
+
return await channel.read(Math.min(req.max, MAX_READ), signal);
|
|
12312
|
+
} catch (err) {
|
|
12313
|
+
await this.clipboardComplaint(err);
|
|
12314
|
+
throw err;
|
|
12315
|
+
}
|
|
12316
|
+
}
|
|
12317
|
+
async clipboardComplaint(err) {
|
|
12318
|
+
const name2 = this.options.clipboardName;
|
|
12319
|
+
if (name2 === void 0 || !(err instanceof KernelError) || err.detail === void 0) return;
|
|
12320
|
+
if (err.code !== "EACCES" && err.code !== "EIO") return;
|
|
12321
|
+
const stderr = this.fds.has(2) ? this.fds.get(2).file : void 0;
|
|
12322
|
+
if (!stderr?.write || stderr.clipboard) return;
|
|
12323
|
+
const line = `${name2}: /dev/clipboard: ${clipboardLine(err.detail)}
|
|
12324
|
+
`;
|
|
12325
|
+
await stderr.write(new TextEncoder().encode(line), AbortSignal.timeout(1e3)).catch(() => 0);
|
|
12298
12326
|
}
|
|
12299
12327
|
async write(fd, body, nonblock = false, cancelled) {
|
|
12300
12328
|
const file = this.fds.get(fd).file;
|
|
@@ -12507,7 +12535,10 @@ var WasmProcess = class {
|
|
|
12507
12535
|
this.options.locks?.closed(this.pid, req.fd);
|
|
12508
12536
|
const channel = this.fds.get(req.fd).file.clipboard;
|
|
12509
12537
|
if (channel) channel.stamp = await this.clipboardStamp();
|
|
12510
|
-
await Promise.resolve(this.fds.close(req.fd))
|
|
12538
|
+
await Promise.resolve(this.fds.close(req.fd)).catch(async (err) => {
|
|
12539
|
+
if (channel) await this.clipboardComplaint(err);
|
|
12540
|
+
throw err;
|
|
12541
|
+
});
|
|
12511
12542
|
return { ok: true, kind: "void" };
|
|
12512
12543
|
}
|
|
12513
12544
|
case "fd-pipe": {
|
|
@@ -13198,12 +13229,15 @@ function holdingToken(opts, holds, caller) {
|
|
|
13198
13229
|
renamed: (from, to) => holds.renamed(from, to)
|
|
13199
13230
|
});
|
|
13200
13231
|
}
|
|
13232
|
+
function clipboardName(opts) {
|
|
13233
|
+
return opts.program.abi === "js" ? {} : { clipboardName: opts.argv0 };
|
|
13234
|
+
}
|
|
13201
13235
|
function processOptions(opts, header4, hooks, created3) {
|
|
13202
13236
|
return {
|
|
13203
13237
|
...inherited(opts),
|
|
13204
13238
|
...opts.owners ? { owners: true } : {},
|
|
13205
13239
|
...opts.sealed ? { sealed: opts.sealed } : {},
|
|
13206
|
-
...opts.clipboard ? { clipboard: opts.clipboard } : {},
|
|
13240
|
+
...opts.clipboard ? { clipboard: opts.clipboard, ...clipboardName(opts) } : {},
|
|
13207
13241
|
...opts.readonlyAt ? { readonlyAt: opts.readonlyAt } : {},
|
|
13208
13242
|
...opts.dac ? { guard: { dac: opts.dac, fs: opts.fs, created: created3 } } : {},
|
|
13209
13243
|
...opts.identity ? { identity: opts.identity } : {},
|
|
@@ -16095,6 +16129,10 @@ function concat5(chunks2) {
|
|
|
16095
16129
|
}
|
|
16096
16130
|
return out;
|
|
16097
16131
|
}
|
|
16132
|
+
function addTimes(into, pid, t) {
|
|
16133
|
+
const at = into.get(pid) ?? { utime: 0, stime: 0 };
|
|
16134
|
+
into.set(pid, { utime: at.utime + t.utime, stime: at.stime + t.stime });
|
|
16135
|
+
}
|
|
16098
16136
|
var Launcher = class {
|
|
16099
16137
|
fs;
|
|
16100
16138
|
processFs;
|
|
@@ -16632,7 +16670,7 @@ var Launcher = class {
|
|
|
16632
16670
|
http: new HttpHandles(this.transport, pid),
|
|
16633
16671
|
locks: this.locks,
|
|
16634
16672
|
resolver: this.resolver,
|
|
16635
|
-
onReap: (child) => this.reaped(child),
|
|
16673
|
+
onReap: (child) => this.reaped(child, pid),
|
|
16636
16674
|
...req.fork ? { fork: req.fork } : {},
|
|
16637
16675
|
...this.shownIds(req)
|
|
16638
16676
|
});
|
|
@@ -16651,9 +16689,14 @@ var Launcher = class {
|
|
|
16651
16689
|
tty: terminal?.name ?? null,
|
|
16652
16690
|
started: Date.now()
|
|
16653
16691
|
});
|
|
16692
|
+
handle.onState(
|
|
16693
|
+
(state) => state === "stopped" ? this.stopped.add(pid) : this.stopped.delete(pid)
|
|
16694
|
+
);
|
|
16654
16695
|
void handle.exited.then(() => {
|
|
16655
16696
|
const spent = handle.times?.();
|
|
16656
16697
|
if (spent) this.spent.set(pid, spent);
|
|
16698
|
+
if (spent) addTimes(this.imageTimes, this.jobs.shown(pid), spent);
|
|
16699
|
+
this.stopped.delete(pid);
|
|
16657
16700
|
this.processes.delete(pid);
|
|
16658
16701
|
if (this.processes.size === 0) {
|
|
16659
16702
|
clearInterval(this.sampler);
|
|
@@ -16681,11 +16724,20 @@ var Launcher = class {
|
|
|
16681
16724
|
this.reapedTimes.stime += spent.stime;
|
|
16682
16725
|
}
|
|
16683
16726
|
this.spent.delete(pid);
|
|
16727
|
+
this.imageTimes.delete(pid);
|
|
16728
|
+
this.childTimes.delete(pid);
|
|
16684
16729
|
this.creds.delete(pid);
|
|
16685
16730
|
this.tags.delete(pid);
|
|
16686
16731
|
this.granted.delete(pid);
|
|
16687
16732
|
}
|
|
16688
|
-
reaped(pid) {
|
|
16733
|
+
reaped(pid, parent) {
|
|
16734
|
+
const own = this.imageTimes.get(pid);
|
|
16735
|
+
const theirs = this.childTimes.get(pid);
|
|
16736
|
+
const into = this.jobs.shown(parent);
|
|
16737
|
+
if (own) addTimes(this.childTimes, into, own);
|
|
16738
|
+
if (theirs) addTimes(this.childTimes, into, theirs);
|
|
16739
|
+
this.imageTimes.delete(pid);
|
|
16740
|
+
this.childTimes.delete(pid);
|
|
16689
16741
|
if (this.zombies.delete(pid)) this.forget(pid);
|
|
16690
16742
|
else this.orphans.add(pid);
|
|
16691
16743
|
}
|
|
@@ -16737,6 +16789,17 @@ var Launcher = class {
|
|
|
16737
16789
|
this.sampler.unref?.();
|
|
16738
16790
|
}
|
|
16739
16791
|
spent = /* @__PURE__ */ new Map();
|
|
16792
|
+
imageTimes = /* @__PURE__ */ new Map();
|
|
16793
|
+
childTimes = /* @__PURE__ */ new Map();
|
|
16794
|
+
stopped = /* @__PURE__ */ new Set();
|
|
16795
|
+
stateOf(pid) {
|
|
16796
|
+
if (!this.processes.has(pid)) return "Z";
|
|
16797
|
+
return this.stopped.has(pid) ? "T" : "S";
|
|
16798
|
+
}
|
|
16799
|
+
childrenOf(pid) {
|
|
16800
|
+
const t = this.childTimes.get(pid);
|
|
16801
|
+
return t ? { cutime: t.utime, cstime: t.stime } : {};
|
|
16802
|
+
}
|
|
16740
16803
|
timesAt(pid) {
|
|
16741
16804
|
return this.processes.get(pid)?.times?.() ?? this.spent.get(pid);
|
|
16742
16805
|
}
|
|
@@ -16782,9 +16845,10 @@ var Launcher = class {
|
|
|
16782
16845
|
sid: member.sid,
|
|
16783
16846
|
...described2,
|
|
16784
16847
|
started: (this.described.get(root.pid) ?? described2).started,
|
|
16785
|
-
state: this.
|
|
16848
|
+
state: this.stateOf(member.pid),
|
|
16786
16849
|
memory: this.processes.get(member.pid)?.memory() ?? 0,
|
|
16787
16850
|
...this.timesOf(member, members),
|
|
16851
|
+
...this.childrenOf(root.pid),
|
|
16788
16852
|
umask: this.umaskOf(member.pid),
|
|
16789
16853
|
cred,
|
|
16790
16854
|
...this.signalMasksOf(member.pid)
|