@ai-ecoverse/slicc-kernel 1.172.2 → 1.173.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 +12 -6
- package/dist/index.js.map +1 -1
- package/dist/kernel-worker.js +469 -163
- package/dist/kernel-worker.js.map +4 -4
- package/dist/meta.js +204 -27
- package/dist/meta.js.map +4 -4
- package/dist/node-process-worker.cjs +3 -1
- package/dist/node-process-worker.cjs.map +2 -2
- package/dist/node-process-worker.js +3 -1
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +139 -10
- 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/meta-reads.d.ts +41 -0
- package/dist/types/fs/meta.d.ts +12 -1
- package/dist/types/fs/opfs.d.ts +2 -1
- package/dist/types/fs/types.d.ts +4 -0
- package/dist/types/fs/watch.d.ts +3 -0
- package/dist/types/kernel/proc-info.d.ts +4 -0
- package/dist/types/sudo.d.ts +6 -1
- package/package.json +4 -4
package/dist/node.js
CHANGED
|
@@ -3702,7 +3702,7 @@ function satisfies(version, range2) {
|
|
|
3702
3702
|
}
|
|
3703
3703
|
|
|
3704
3704
|
// src/version.ts
|
|
3705
|
-
var KERNEL_VERSION = true ? "1.
|
|
3705
|
+
var KERNEL_VERSION = true ? "1.173.1" : "0.0.0-dev";
|
|
3706
3706
|
var OS_RELEASE = "6.0.0-slicc";
|
|
3707
3707
|
function procVersion() {
|
|
3708
3708
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -7842,6 +7842,7 @@ var FsWatchers = class {
|
|
|
7842
7842
|
const watcher = {
|
|
7843
7843
|
paths: paths.map(normalizePath),
|
|
7844
7844
|
recursive: options.recursive === true,
|
|
7845
|
+
peers: options.peers === true,
|
|
7845
7846
|
notify,
|
|
7846
7847
|
pending: /* @__PURE__ */ new Set(),
|
|
7847
7848
|
scheduled: false
|
|
@@ -7963,10 +7964,16 @@ var FsWatchers = class {
|
|
|
7963
7964
|
this.report(paths);
|
|
7964
7965
|
this.emit("change", paths);
|
|
7965
7966
|
}
|
|
7967
|
+
peerChanged(paths) {
|
|
7968
|
+
if (paths.length > 0) this.notify(paths, true);
|
|
7969
|
+
}
|
|
7966
7970
|
report(paths, notify = true) {
|
|
7967
7971
|
for (const tap of this.taps) tap(paths);
|
|
7968
|
-
if (
|
|
7972
|
+
if (notify) this.notify(paths);
|
|
7973
|
+
}
|
|
7974
|
+
notify(paths, peer = false) {
|
|
7969
7975
|
for (const watcher of this.watchers) {
|
|
7976
|
+
if (peer && !watcher.peers) continue;
|
|
7970
7977
|
for (const path of paths) {
|
|
7971
7978
|
const changed = normalizePath(path);
|
|
7972
7979
|
if (touches(watcher, changed)) watcher.pending.add(changed);
|
|
@@ -12376,6 +12383,8 @@ var SYS_TREE = {
|
|
|
12376
12383
|
slicc_opfs_calls: (listing) => `${listing.opfsCalls ?? 0}
|
|
12377
12384
|
`,
|
|
12378
12385
|
slicc_opfs_ops: (listing) => `${listing.opfsOps ?? 0}
|
|
12386
|
+
`,
|
|
12387
|
+
slicc_meta_transactions: ({ meta }) => `${meta?.reads ?? 0} ${meta?.writes ?? 0}
|
|
12379
12388
|
`,
|
|
12380
12389
|
slicc_cwd_checks: (listing) => `${listing.cwdChecks ?? 0}
|
|
12381
12390
|
`,
|
|
@@ -26355,6 +26364,7 @@ function sidecar(meta) {
|
|
|
26355
26364
|
};
|
|
26356
26365
|
if (meta.absent) ops.absent = meta.absent.bind(meta);
|
|
26357
26366
|
if (meta.forgetTrees) ops.forgetTrees = meta.forgetTrees.bind(meta);
|
|
26367
|
+
if (meta.transactions) ops.transactions = meta.transactions.bind(meta);
|
|
26358
26368
|
const { removeFile } = meta;
|
|
26359
26369
|
if (removeFile)
|
|
26360
26370
|
ops.removeFile = (path) => removeFile.call(meta, path).catch((err) => {
|
|
@@ -26921,6 +26931,9 @@ var OpfsFs = class {
|
|
|
26921
26931
|
opfsOps() {
|
|
26922
26932
|
return this.calls + this.others;
|
|
26923
26933
|
}
|
|
26934
|
+
metaTransactions() {
|
|
26935
|
+
return this.meta.transactions?.();
|
|
26936
|
+
}
|
|
26924
26937
|
io(request) {
|
|
26925
26938
|
this.others++;
|
|
26926
26939
|
return request;
|
|
@@ -30664,6 +30677,104 @@ function splitWords(text) {
|
|
|
30664
30677
|
function quoteWord(word) {
|
|
30665
30678
|
return PLAIN3.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
|
|
30666
30679
|
}
|
|
30680
|
+
function addPart(word, part) {
|
|
30681
|
+
const last = word.length - 1;
|
|
30682
|
+
if (part === null) {
|
|
30683
|
+
if (word[last] !== null) word.push(null);
|
|
30684
|
+
} else if (typeof word[last] === "string") word[last] += part;
|
|
30685
|
+
else word.push(part);
|
|
30686
|
+
}
|
|
30687
|
+
function addPlain(word, plain3) {
|
|
30688
|
+
for (const [i, part] of plain3.split("*").entries()) {
|
|
30689
|
+
if (i > 0) addPart(word, null);
|
|
30690
|
+
if (part !== "") addPart(word, part);
|
|
30691
|
+
}
|
|
30692
|
+
}
|
|
30693
|
+
function splitPatterns(text) {
|
|
30694
|
+
const piece = /'([^']*)'|"((?:[^"\\]|\\[\s\S])*)"|\\([\s\S])|([^\s'"\\]+)|(\s+)/y;
|
|
30695
|
+
const words2 = [];
|
|
30696
|
+
let word;
|
|
30697
|
+
while (piece.lastIndex < text.length) {
|
|
30698
|
+
const m = piece.exec(text);
|
|
30699
|
+
if (!m) return void 0;
|
|
30700
|
+
const [, single, double, escaped, plain3, space] = m;
|
|
30701
|
+
if (space !== void 0) {
|
|
30702
|
+
if (word !== void 0) words2.push(word);
|
|
30703
|
+
word = void 0;
|
|
30704
|
+
continue;
|
|
30705
|
+
}
|
|
30706
|
+
word ??= [];
|
|
30707
|
+
if (plain3 !== void 0) addPlain(word, plain3);
|
|
30708
|
+
else addPart(word, single ?? (double !== void 0 ? unescaped(double) : escaped));
|
|
30709
|
+
}
|
|
30710
|
+
if (word !== void 0) words2.push(word);
|
|
30711
|
+
return words2;
|
|
30712
|
+
}
|
|
30713
|
+
var literal2 = (pattern) => pattern.map((p) => p ?? "*").join("");
|
|
30714
|
+
var isAny = (pattern) => pattern?.length === 1 && pattern[0] === null;
|
|
30715
|
+
function literalWord(word) {
|
|
30716
|
+
if (!word.includes("*")) return quoteWord(word);
|
|
30717
|
+
const bare = word.replaceAll("*", "");
|
|
30718
|
+
return bare === "" || PLAIN3.test(bare) ? word.replaceAll("*", "\\*") : quoteWord(word);
|
|
30719
|
+
}
|
|
30720
|
+
function patternWord(pattern) {
|
|
30721
|
+
if (pattern.length === 1 && typeof pattern[0] === "string") return literalWord(pattern[0]);
|
|
30722
|
+
return pattern.map((p) => p === null ? "*" : literalWord(p)).join("");
|
|
30723
|
+
}
|
|
30724
|
+
function globMatch(items, subjects, star, one) {
|
|
30725
|
+
let i = 0;
|
|
30726
|
+
let j = 0;
|
|
30727
|
+
let back = -1;
|
|
30728
|
+
let from = 0;
|
|
30729
|
+
while (j < subjects) {
|
|
30730
|
+
if (i < items && star(i)) {
|
|
30731
|
+
back = i++;
|
|
30732
|
+
from = j;
|
|
30733
|
+
} else if (i < items && one(i, j)) {
|
|
30734
|
+
i++;
|
|
30735
|
+
j++;
|
|
30736
|
+
} else if (back >= 0) {
|
|
30737
|
+
i = back + 1;
|
|
30738
|
+
j = ++from;
|
|
30739
|
+
} else return false;
|
|
30740
|
+
}
|
|
30741
|
+
while (i < items && star(i)) i++;
|
|
30742
|
+
return i === items;
|
|
30743
|
+
}
|
|
30744
|
+
function wordMatch(pattern, arg) {
|
|
30745
|
+
if (pattern.every((p) => p !== null)) return literal2(pattern) === arg;
|
|
30746
|
+
const chars = pattern.flatMap((p) => p === null ? [null] : [...p]);
|
|
30747
|
+
const subject = [...arg];
|
|
30748
|
+
return globMatch(
|
|
30749
|
+
chars.length,
|
|
30750
|
+
subject.length,
|
|
30751
|
+
(i) => chars[i] === null,
|
|
30752
|
+
(i, j) => chars[i] === subject[j]
|
|
30753
|
+
);
|
|
30754
|
+
}
|
|
30755
|
+
function commandMatches(cmnd, argv) {
|
|
30756
|
+
if (cmnd === "*") return true;
|
|
30757
|
+
const [path, ...args] = argv;
|
|
30758
|
+
if (path !== cmnd.path) return false;
|
|
30759
|
+
const want = cmnd.args;
|
|
30760
|
+
if (want === void 0) return true;
|
|
30761
|
+
return globMatch(
|
|
30762
|
+
want.length,
|
|
30763
|
+
args.length,
|
|
30764
|
+
(i) => isAny(want[i]),
|
|
30765
|
+
(i, j) => wordMatch(want[i], args[j])
|
|
30766
|
+
);
|
|
30767
|
+
}
|
|
30768
|
+
function commandText(cmnd) {
|
|
30769
|
+
const path = quoteWord(cmnd.path);
|
|
30770
|
+
if (cmnd.args === void 0) return path;
|
|
30771
|
+
if (cmnd.args.length === 0) return `${path} ""`;
|
|
30772
|
+
return [path, ...cmnd.args.map(patternWord)].join(" ");
|
|
30773
|
+
}
|
|
30774
|
+
function recordedCommand(argv) {
|
|
30775
|
+
const [path = "", ...args] = argv;
|
|
30776
|
+
return commandText({ path, args: args.map((a) => [a]) });
|
|
30777
|
+
}
|
|
30667
30778
|
function validWho(who) {
|
|
30668
30779
|
if (who === "ALL") return true;
|
|
30669
30780
|
return NAME3.test(who.startsWith("%") ? who.slice(1) : who);
|
|
@@ -30684,9 +30795,23 @@ function parseRule(line) {
|
|
|
30684
30795
|
if (cwd === "") return void 0;
|
|
30685
30796
|
const rule = { nopasswd: !!nopasswd, who, target, ...cwd !== void 0 ? { cwd } : {} };
|
|
30686
30797
|
if (rest2.trim() === "*") return { ...rule, cmnd: "*" };
|
|
30687
|
-
const
|
|
30688
|
-
|
|
30689
|
-
|
|
30798
|
+
const words2 = splitPatterns(rest2);
|
|
30799
|
+
const [first, ...args] = words2 ?? [];
|
|
30800
|
+
const path = first ? literal2(first) : "";
|
|
30801
|
+
if (!path.startsWith("/")) return void 0;
|
|
30802
|
+
const only = args.length === 1 && args[0]?.length === 1 && args[0][0] === "";
|
|
30803
|
+
if (only && /\s""$/.test(rest2.trim())) return { ...rule, cmnd: { path, args: [] } };
|
|
30804
|
+
return { ...rule, cmnd: args.length === 0 ? { path } : { path, args } };
|
|
30805
|
+
}
|
|
30806
|
+
function recordedBare(line, file, rule) {
|
|
30807
|
+
if (rule.cmnd === "*" || rule.cmnd.args !== void 0 || !rule.nopasswd) return false;
|
|
30808
|
+
if (file !== `${SUDOERS_D}/${rule.who}` || !NAME3.test(rule.who) || !NAME3.test(rule.target)) {
|
|
30809
|
+
return false;
|
|
30810
|
+
}
|
|
30811
|
+
const head = `NOPASSWD ${rule.who} (${rule.target}) `;
|
|
30812
|
+
const cmnd = `Cmnd ${quoteWord(rule.cmnd.path)}`;
|
|
30813
|
+
const cwd = rule.cwd === void 0 ? "" : `Cwd ${quoteWord(rule.cwd)} `;
|
|
30814
|
+
return line === `${head}${cwd}${cmnd}`;
|
|
30690
30815
|
}
|
|
30691
30816
|
function flags(parsed2, arg, next3) {
|
|
30692
30817
|
for (let j = 1; j < arg.length; j++) {
|
|
@@ -30724,7 +30849,7 @@ function parseArgs(args) {
|
|
|
30724
30849
|
return parsed2;
|
|
30725
30850
|
}
|
|
30726
30851
|
function described(rule) {
|
|
30727
|
-
const cmnd = rule.cmnd === "*" ? "ALL" : rule.cmnd
|
|
30852
|
+
const cmnd = rule.cmnd === "*" ? "ALL" : commandText(rule.cmnd);
|
|
30728
30853
|
const cwd = rule.cwd === void 0 ? "" : `CWD=${quoteWord(rule.cwd)} `;
|
|
30729
30854
|
return ` (${rule.target}) ${cwd}${rule.nopasswd ? "NOPASSWD: " : ""}${cmnd}`;
|
|
30730
30855
|
}
|
|
@@ -30770,7 +30895,9 @@ var Sudo = class {
|
|
|
30770
30895
|
const rules = [];
|
|
30771
30896
|
for (const [n, line] of text.split("\n").entries()) {
|
|
30772
30897
|
const rule = parseRule(line);
|
|
30773
|
-
if (rule
|
|
30898
|
+
if (rule && recordedBare(line, path, rule) && rule.cmnd !== "*") {
|
|
30899
|
+
rules.push({ ...rule, cmnd: { path: rule.cmnd.path, args: [] } });
|
|
30900
|
+
} else if (rule) rules.push(rule);
|
|
30774
30901
|
else if (rule === void 0) this.warn(`sudo: ${path}:${n + 1}: bad line skipped: ${line}`);
|
|
30775
30902
|
}
|
|
30776
30903
|
return rules;
|
|
@@ -30866,7 +30993,7 @@ var Sudo = class {
|
|
|
30866
30993
|
if (untrusted2) return untrusted2;
|
|
30867
30994
|
const argv = [path, ...args];
|
|
30868
30995
|
const matching = rules.filter(
|
|
30869
|
-
(rule) => applies(rule) && (rule.target === "ALL" || rule.target === target.name) && (rule.cwd === void 0 || rule.cwd === cwd) && (rule.cmnd
|
|
30996
|
+
(rule) => applies(rule) && (rule.target === "ALL" || rule.target === target.name) && (rule.cwd === void 0 || rule.cwd === cwd) && commandMatches(rule.cmnd, argv)
|
|
30870
30997
|
);
|
|
30871
30998
|
const grant = () => this.grant(self, target, cred, parsed2.command, path, cwd, call.term);
|
|
30872
30999
|
if (root || matching.some((rule) => rule.nopasswd)) return grant();
|
|
@@ -30963,7 +31090,7 @@ ${lines2}
|
|
|
30963
31090
|
const st = await fs.lstat(path).catch(() => void 0);
|
|
30964
31091
|
if (st && !await this.trusted(path)) return false;
|
|
30965
31092
|
const old = st ? await fs.readFile(path) : "";
|
|
30966
|
-
const words2 = argv
|
|
31093
|
+
const words2 = recordedCommand(argv);
|
|
30967
31094
|
const line = `NOPASSWD ${self.name} (${target.name}) Cwd ${quoteWord(cwd)} Cmnd ${words2}
|
|
30968
31095
|
`;
|
|
30969
31096
|
const text = old === "" || old.endsWith("\n") ? `${old}${line}` : `${old}
|
|
@@ -31767,6 +31894,7 @@ var Launcher = class {
|
|
|
31767
31894
|
this.rewritten(change.paths, change.trees);
|
|
31768
31895
|
this.watchers.heard(change.content ? "change" : "rename", change.paths);
|
|
31769
31896
|
this.watchers.heard("rename", change.trees ?? []);
|
|
31897
|
+
this.watchers.peerChanged([...change.paths, ...change.trees ?? []]);
|
|
31770
31898
|
if (change.outside && this.catalogChanged([...change.paths, ...change.trees ?? []])) {
|
|
31771
31899
|
this.resetCatalogs();
|
|
31772
31900
|
}
|
|
@@ -32721,6 +32849,7 @@ var Launcher = class {
|
|
|
32721
32849
|
fsCalls: servedFsCalls(),
|
|
32722
32850
|
opfsCalls: this.rootFs.opfsCalls?.() ?? 0,
|
|
32723
32851
|
opfsOps: this.rootFs.opfsOps?.() ?? 0,
|
|
32852
|
+
meta: this.rootFs.metaTransactions?.(),
|
|
32724
32853
|
cwdChecks: this.cwds.checks,
|
|
32725
32854
|
renameAcks: this.rootFs.renameWaits?.(),
|
|
32726
32855
|
swaps: this.swaps.counts(),
|
|
@@ -34774,7 +34903,7 @@ async function watchOp(l, req, watches, send2, g) {
|
|
|
34774
34903
|
}
|
|
34775
34904
|
if (g) for (const path of req.paths) await readable(g, "watch", l.fs.resolvePath("/", path));
|
|
34776
34905
|
const notify = visibleTo2(g, (change) => send2({ watch: req.id, change }));
|
|
34777
|
-
const unwatch = l.watchers.watch(req.paths, { recursive: req.recursive }, notify);
|
|
34906
|
+
const unwatch = l.watchers.watch(req.paths, { recursive: req.recursive, peers: true }, notify);
|
|
34778
34907
|
watches.set(req.id, unwatch);
|
|
34779
34908
|
return { result: req.id };
|
|
34780
34909
|
}
|