@ai-ecoverse/slicc-kernel 1.196.36 → 1.196.37
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 -3
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +78 -72
- package/dist/cloudflare.js.map +3 -3
- package/dist/kernel-worker.js +69 -63
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +92 -86
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/package.json +2 -2
package/dist/cloudflare.js
CHANGED
|
@@ -372,23 +372,23 @@ var KernelSide = class {
|
|
|
372
372
|
...cwds ? { cwds } : {}
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
applyWords(
|
|
376
|
-
if (!
|
|
377
|
-
this.words =
|
|
378
|
-
while (this.history.length > 0 && (this.history[0]?.seq ?? 0) <=
|
|
375
|
+
applyWords(words2) {
|
|
376
|
+
if (!words2 || typeof words2.n !== "number" || words2.n <= this.words) return;
|
|
377
|
+
this.words = words2.n;
|
|
378
|
+
while (this.history.length > 0 && (this.history[0]?.seq ?? 0) <= words2.seen) {
|
|
379
379
|
this.history.shift();
|
|
380
380
|
}
|
|
381
|
-
let signals =
|
|
382
|
-
let timers =
|
|
381
|
+
let signals = words2.signals | this.raised.signals;
|
|
382
|
+
let timers = words2.timers | this.raised.timers;
|
|
383
383
|
for (const entry of this.history) {
|
|
384
384
|
signals |= entry.signals;
|
|
385
385
|
timers |= entry.timers;
|
|
386
386
|
}
|
|
387
387
|
Atomics.store(this.header, SAB_I_SIGNALS, signals);
|
|
388
388
|
Atomics.store(this.header, SAB_I_TIMERS, timers);
|
|
389
|
-
storeBlocked(this.header,
|
|
390
|
-
Atomics.store(this.header, SAB_I_MEMORY,
|
|
391
|
-
Atomics.store(this.clock, CLOCK_IDLE, BigInt(
|
|
389
|
+
storeBlocked(this.header, words2.blocked);
|
|
390
|
+
Atomics.store(this.header, SAB_I_MEMORY, words2.memory);
|
|
391
|
+
Atomics.store(this.clock, CLOCK_IDLE, BigInt(words2.idle));
|
|
392
392
|
}
|
|
393
393
|
keep(bytes) {
|
|
394
394
|
const id2 = ++this.nextPart;
|
|
@@ -5303,7 +5303,7 @@ function satisfies(version, range2) {
|
|
|
5303
5303
|
}
|
|
5304
5304
|
|
|
5305
5305
|
// src/version.ts
|
|
5306
|
-
var KERNEL_VERSION = true ? "1.196.
|
|
5306
|
+
var KERNEL_VERSION = true ? "1.196.37" : "0.0.0-dev";
|
|
5307
5307
|
var OS_RELEASE = "6.0.0-slicc";
|
|
5308
5308
|
function procVersion() {
|
|
5309
5309
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -6238,27 +6238,27 @@ function hashId(text) {
|
|
|
6238
6238
|
return hex5(a) + hex5(b);
|
|
6239
6239
|
}
|
|
6240
6240
|
function split(text, count3) {
|
|
6241
|
-
const
|
|
6241
|
+
const words2 = [];
|
|
6242
6242
|
let rest2 = text;
|
|
6243
6243
|
for (let i = 0; i < count3; i++) {
|
|
6244
6244
|
const match = /^(\S+)\s+/.exec(rest2);
|
|
6245
6245
|
if (!match) return void 0;
|
|
6246
|
-
|
|
6246
|
+
words2.push(match[1]);
|
|
6247
6247
|
rest2 = rest2.slice(match[0].length);
|
|
6248
6248
|
}
|
|
6249
|
-
return [
|
|
6249
|
+
return [words2, rest2.trim()];
|
|
6250
6250
|
}
|
|
6251
6251
|
function jobOf(content, pending, ctx, env) {
|
|
6252
6252
|
const fields2 = content.startsWith("@") ? 1 : 5;
|
|
6253
6253
|
const parts2 = split(content, fields2 + (ctx.system ? 1 : 0));
|
|
6254
6254
|
if (!parts2 || parts2[1] === "") throw new Error("no command");
|
|
6255
|
-
const [
|
|
6256
|
-
const schedule =
|
|
6255
|
+
const [words2, command] = parts2;
|
|
6256
|
+
const schedule = words2.slice(0, fields2).join(" ");
|
|
6257
6257
|
const when = parseWhen(schedule);
|
|
6258
6258
|
const zone = env.CRON_TZ;
|
|
6259
6259
|
if (zone && !when.reboot && canonicalZone(zone) === void 0)
|
|
6260
6260
|
throw new Error(`CRON_TZ: unknown time zone "${zone}"`);
|
|
6261
|
-
const user = ctx.system ?
|
|
6261
|
+
const user = ctx.system ? words2[fields2] : void 0;
|
|
6262
6262
|
if (user !== void 0 && !USER_NAME.test(user)) throw new Error(`bad user name ${user}`);
|
|
6263
6263
|
if (pending !== void 0 && !JOB_NAME.test(pending))
|
|
6264
6264
|
throw new Error(`bad job name "${pending}"`);
|
|
@@ -19197,21 +19197,21 @@ function unescaped2(double) {
|
|
|
19197
19197
|
}
|
|
19198
19198
|
function splitWords(text) {
|
|
19199
19199
|
const piece = /'([^']*)'|"((?:[^"\\]|\\[\s\S])*)"|\\([\s\S])|([^\s'"\\]+)|(\s+)/y;
|
|
19200
|
-
const
|
|
19200
|
+
const words2 = [];
|
|
19201
19201
|
let word;
|
|
19202
19202
|
while (piece.lastIndex < text.length) {
|
|
19203
19203
|
const m = piece.exec(text);
|
|
19204
19204
|
if (!m) return void 0;
|
|
19205
19205
|
const [, single, double, escaped, plain3, space] = m;
|
|
19206
19206
|
if (space !== void 0) {
|
|
19207
|
-
if (word !== void 0)
|
|
19207
|
+
if (word !== void 0) words2.push(word);
|
|
19208
19208
|
word = void 0;
|
|
19209
19209
|
continue;
|
|
19210
19210
|
}
|
|
19211
19211
|
word = (word ?? "") + (single ?? (double !== void 0 ? unescaped2(double) : escaped ?? plain3));
|
|
19212
19212
|
}
|
|
19213
|
-
if (word !== void 0)
|
|
19214
|
-
return
|
|
19213
|
+
if (word !== void 0) words2.push(word);
|
|
19214
|
+
return words2;
|
|
19215
19215
|
}
|
|
19216
19216
|
function shellQuote(word) {
|
|
19217
19217
|
return PLAIN.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
|
|
@@ -19234,14 +19234,14 @@ function addPlain(word, plain3) {
|
|
|
19234
19234
|
}
|
|
19235
19235
|
function splitPatterns(text) {
|
|
19236
19236
|
const piece = /'([^']*)'|"((?:[^"\\]|\\[\s\S])*)"|\\([\s\S])|([^\s'"\\]+)|(\s+)/y;
|
|
19237
|
-
const
|
|
19237
|
+
const words2 = [];
|
|
19238
19238
|
let word;
|
|
19239
19239
|
while (piece.lastIndex < text.length) {
|
|
19240
19240
|
const m = piece.exec(text);
|
|
19241
19241
|
if (!m) return void 0;
|
|
19242
19242
|
const [, single, double, escaped, plain3, space] = m;
|
|
19243
19243
|
if (space !== void 0) {
|
|
19244
|
-
if (word !== void 0)
|
|
19244
|
+
if (word !== void 0) words2.push(word);
|
|
19245
19245
|
word = void 0;
|
|
19246
19246
|
continue;
|
|
19247
19247
|
}
|
|
@@ -19249,8 +19249,8 @@ function splitPatterns(text) {
|
|
|
19249
19249
|
if (plain3 !== void 0) addPlain(word, plain3);
|
|
19250
19250
|
else addPart(word, single ?? (double !== void 0 ? unescaped2(double) : escaped));
|
|
19251
19251
|
}
|
|
19252
|
-
if (word !== void 0)
|
|
19253
|
-
return
|
|
19252
|
+
if (word !== void 0) words2.push(word);
|
|
19253
|
+
return words2;
|
|
19254
19254
|
}
|
|
19255
19255
|
var literal = (pattern) => pattern.map((p) => p ?? "*").join("");
|
|
19256
19256
|
var isAny = (pattern) => pattern?.length === 1 && pattern[0] === null;
|
|
@@ -19326,14 +19326,14 @@ function whoError(who) {
|
|
|
19326
19326
|
return `expected a user name, %group or ALL first, not ${shown(who)}`;
|
|
19327
19327
|
}
|
|
19328
19328
|
function cwdOf(word) {
|
|
19329
|
-
const
|
|
19330
|
-
const path =
|
|
19329
|
+
const words2 = splitWords(word);
|
|
19330
|
+
const path = words2?.length === 1 ? words2[0] : "";
|
|
19331
19331
|
return path.startsWith("/") ? normalizePath(path) : "";
|
|
19332
19332
|
}
|
|
19333
19333
|
function commandOf2(text, after) {
|
|
19334
|
-
const
|
|
19335
|
-
if (
|
|
19336
|
-
const [first, ...args] =
|
|
19334
|
+
const words2 = splitPatterns(text);
|
|
19335
|
+
if (words2 === void 0) return "a quote in the command is not closed, or it ends in a \\";
|
|
19336
|
+
const [first, ...args] = words2;
|
|
19337
19337
|
const path = first ? literal(first) : "";
|
|
19338
19338
|
if (path === "") return `expected a command after ${after}`;
|
|
19339
19339
|
if (!path.startsWith("/")) return `expected an absolute command path, not ${shown(path)}`;
|
|
@@ -19516,14 +19516,14 @@ function legacyApproval(line, file, rule2) {
|
|
|
19516
19516
|
const stdin = rule2.stdin === void 0 ? "" : "Stdin none ";
|
|
19517
19517
|
const prefix = `NOPASSWD ${rule2.who} (${rule2.target}) ${cwd}${stdin}Cmnd `;
|
|
19518
19518
|
if (!line.startsWith(prefix)) return rule2;
|
|
19519
|
-
const
|
|
19519
|
+
const words2 = line.slice(prefix.length).trimEnd();
|
|
19520
19520
|
if (cmnd.args === void 0) {
|
|
19521
|
-
if (
|
|
19521
|
+
if (words2 !== quote(cmnd.path)) return rule2;
|
|
19522
19522
|
return { ...rule2, cmnd: { ...cmnd, args: [] }, ...stdin ? {} : { sha256: {} } };
|
|
19523
19523
|
}
|
|
19524
19524
|
if (cmnd.args.some((arg) => arg.includes(null))) return rule2;
|
|
19525
|
-
const current = rule2.cwd !== void 0 &&
|
|
19526
|
-
const earliest = !stdin &&
|
|
19525
|
+
const current = rule2.cwd !== void 0 && words2 === formatCommand(cmnd, quote);
|
|
19526
|
+
const earliest = !stdin && words2 === [cmnd.path, ...cmnd.args.map(literal)].map(quote).join(" ");
|
|
19527
19527
|
return current || earliest ? { ...rule2, sha256: {} } : rule2;
|
|
19528
19528
|
}
|
|
19529
19529
|
function kernelLine(m, line, file) {
|
|
@@ -21051,8 +21051,8 @@ ${lines3}
|
|
|
21051
21051
|
const st = await fs.lstat(path).catch(() => void 0);
|
|
21052
21052
|
if (st && !await this.trusted(path)) return false;
|
|
21053
21053
|
const old = st ? await fs.readFile(path) : "";
|
|
21054
|
-
const
|
|
21055
|
-
const line = `NOPASSWD ${self.name} (${target.name}) Cwd ${quoteWord(cwd)} Stdin none ${sha256Text(bound3, routeSha256, chainSha256)}Cmnd ${
|
|
21054
|
+
const words2 = recordedCommand(argv);
|
|
21055
|
+
const line = `NOPASSWD ${self.name} (${target.name}) Cwd ${quoteWord(cwd)} Stdin none ${sha256Text(bound3, routeSha256, chainSha256)}Cmnd ${words2}
|
|
21056
21056
|
`;
|
|
21057
21057
|
const text = old === "" || old.endsWith("\n") ? `${old}${line}` : `${old}
|
|
21058
21058
|
${line}`;
|
|
@@ -22359,8 +22359,8 @@ function ipv6(host) {
|
|
|
22359
22359
|
const head = groups(halves[0]);
|
|
22360
22360
|
const back = halves.length === 2 ? groups(halves[1]) : [];
|
|
22361
22361
|
if (![...head, ...back].every((g) => /^[0-9A-Fa-f]{1,4}$/.test(g))) return void 0;
|
|
22362
|
-
const
|
|
22363
|
-
const missing7 = 8 -
|
|
22362
|
+
const words2 = [...head, ...back].map((g) => Number.parseInt(g, 16));
|
|
22363
|
+
const missing7 = 8 - words2.length - tail2.length;
|
|
22364
22364
|
if (halves.length === 2 ? missing7 < 1 : missing7 !== 0) return void 0;
|
|
22365
22365
|
const all = [
|
|
22366
22366
|
...head.map((g) => Number.parseInt(g, 16)),
|
|
@@ -28544,21 +28544,26 @@ var PATH_FLAGS = PATH_ONLY | 65536 | 131072;
|
|
|
28544
28544
|
var KEYBOARD = /* @__PURE__ */ new Set([SIG.INT, SIG.QUIT, SIG.TSTP]);
|
|
28545
28545
|
var STUCK_ESCAPES = /* @__PURE__ */ new Set([SIG.INT, SIG.TERM, SIG.QUIT, SIG.HUP]);
|
|
28546
28546
|
var DEFAULT_UMASK2 = 18;
|
|
28547
|
-
|
|
28548
|
-
|
|
28549
|
-
|
|
28550
|
-
|
|
28551
|
-
return
|
|
28552
|
-
|
|
28553
|
-
|
|
28554
|
-
|
|
28555
|
-
|
|
28547
|
+
var SUDO_VECTOR_MAX = 4096;
|
|
28548
|
+
var SUDO_INPUT_BYTES = 1024 * 1024;
|
|
28549
|
+
function budgetAfterArgs(args) {
|
|
28550
|
+
if (!Array.isArray(args)) throw new KernelError("EINVAL");
|
|
28551
|
+
if (args.length > SUDO_VECTOR_MAX) return -1;
|
|
28552
|
+
let remaining = SUDO_INPUT_BYTES;
|
|
28553
|
+
for (const word of args) {
|
|
28554
|
+
if (typeof word !== "string") throw new KernelError("EINVAL");
|
|
28555
|
+
if (word.length + 1 > remaining) return -1;
|
|
28556
|
+
remaining -= storedSize(word) + 1;
|
|
28557
|
+
if (remaining < 0) return -1;
|
|
28558
|
+
}
|
|
28559
|
+
return remaining;
|
|
28560
|
+
}
|
|
28561
|
+
function sudoVariables(value2, term, budget) {
|
|
28556
28562
|
const input = typeof value2 === "object" && value2 !== null ? value2 : {};
|
|
28557
28563
|
const env = /* @__PURE__ */ Object.create(null);
|
|
28558
28564
|
let count3 = 0;
|
|
28559
|
-
let budget = SUDO_ENV_BYTES;
|
|
28560
28565
|
const fits = (name2, text) => {
|
|
28561
|
-
if (++count3 >
|
|
28566
|
+
if (++count3 > SUDO_VECTOR_MAX || name2.length + text.length + 2 > budget) return false;
|
|
28562
28567
|
budget -= storedSize(name2) + storedSize(text) + 2;
|
|
28563
28568
|
return budget >= 0;
|
|
28564
28569
|
};
|
|
@@ -30607,14 +30612,15 @@ var WasmProcess = class _WasmProcess {
|
|
|
30607
30612
|
async sudo(req, cancelled) {
|
|
30608
30613
|
const { sudo } = this.options;
|
|
30609
30614
|
if (!sudo) throw new KernelError("ENOSYS");
|
|
30610
|
-
const
|
|
30615
|
+
const budget = budgetAfterArgs(req.args);
|
|
30616
|
+
if (budget < 0) return { errno: "E2BIG", error: "sudo: the submitted arguments are too large" };
|
|
30611
30617
|
const term = typeof req.term === "string" ? req.term : void 0;
|
|
30612
|
-
const submitted = sudoVariables(req.env, term);
|
|
30618
|
+
const submitted = sudoVariables(req.env, term, budget);
|
|
30613
30619
|
if (submitted === void 0)
|
|
30614
30620
|
return { errno: "E2BIG", error: "sudo: the submitted environment is too large" };
|
|
30615
30621
|
const call = {
|
|
30616
30622
|
op: "proc-sudo",
|
|
30617
|
-
args,
|
|
30623
|
+
args: [...req.args],
|
|
30618
30624
|
cwd: typeof req.cwd === "string" && req.cwd.startsWith("/") ? req.cwd : "/",
|
|
30619
30625
|
...term !== void 0 ? { term } : {},
|
|
30620
30626
|
env: submitted
|
|
@@ -38914,27 +38920,27 @@ function appendedRoots(given) {
|
|
|
38914
38920
|
}
|
|
38915
38921
|
return [...roots];
|
|
38916
38922
|
}
|
|
38917
|
-
function plainEnv(
|
|
38918
|
-
const next3 =
|
|
38919
|
-
if (baseName3(
|
|
38923
|
+
function plainEnv(words2) {
|
|
38924
|
+
const next3 = words2[1];
|
|
38925
|
+
if (baseName3(words2[0] ?? "") !== "env" || next3 === void 0) return false;
|
|
38920
38926
|
return next3 === "-S" || !next3.startsWith("-") && !next3.includes("=");
|
|
38921
38927
|
}
|
|
38922
|
-
function shebangCommand(
|
|
38923
|
-
if (!plainEnv(
|
|
38924
|
-
const arg2 =
|
|
38925
|
-
return { interp:
|
|
38928
|
+
function shebangCommand(words2) {
|
|
38929
|
+
if (!plainEnv(words2)) {
|
|
38930
|
+
const arg2 = words2.slice(1).join(" ");
|
|
38931
|
+
return { interp: words2[0], args: arg2 ? [arg2] : [] };
|
|
38926
38932
|
}
|
|
38927
|
-
const split3 =
|
|
38928
|
-
const [interp, ...rest2] =
|
|
38933
|
+
const split3 = words2[1] === "-S";
|
|
38934
|
+
const [interp, ...rest2] = words2.slice(split3 ? 2 : 1);
|
|
38929
38935
|
const arg = rest2.join(" ");
|
|
38930
38936
|
return { interp, args: split3 ? rest2 : arg ? [arg] : [] };
|
|
38931
38937
|
}
|
|
38932
38938
|
function interpreter(head) {
|
|
38933
|
-
const
|
|
38934
|
-
if (!
|
|
38935
|
-
if (baseName3(
|
|
38936
|
-
if (
|
|
38937
|
-
return baseName3(
|
|
38939
|
+
const words2 = shebang(head);
|
|
38940
|
+
if (!words2) return "node";
|
|
38941
|
+
if (baseName3(words2[0]) === "env") words2.shift();
|
|
38942
|
+
if (words2[0] === "-S") words2.shift();
|
|
38943
|
+
return baseName3(words2[0] ?? "");
|
|
38938
38944
|
}
|
|
38939
38945
|
function expandDefaults(defaults2, env) {
|
|
38940
38946
|
const out = {};
|
|
@@ -39872,13 +39878,13 @@ var Launcher = class {
|
|
|
39872
39878
|
const named = byPath ? { [script]: this.fs.resolvePath(cwd, file) } : {};
|
|
39873
39879
|
const head = await this.head(script, who.reads);
|
|
39874
39880
|
if (!head) return void 0;
|
|
39875
|
-
const
|
|
39876
|
-
if (!
|
|
39877
|
-
const { interp, args } = shebangCommand(
|
|
39878
|
-
const passed = [...args, command ? script : file, ...
|
|
39881
|
+
const words2 = await this.interpreterWords(head, script, { ...who, argv: [...argv, file] });
|
|
39882
|
+
if (!words2) return void 0;
|
|
39883
|
+
const { interp, args } = shebangCommand(words2.words);
|
|
39884
|
+
const passed = [...args, command ? script : file, ...words2.kept, ...argv.slice(1)];
|
|
39879
39885
|
if (!interp) return void 0;
|
|
39880
39886
|
who.reads?.operandsFromEnd.set(passed.length - args.length, script);
|
|
39881
|
-
who.reads?.interpreters.push([script, ...
|
|
39887
|
+
who.reads?.interpreters.push([script, ...words2.words, String(words2.kept.length)]);
|
|
39882
39888
|
const entry = await this.interpreterFile(interp, cwd, reader, who.pid, who.relative);
|
|
39883
39889
|
if (!entry) return void 0;
|
|
39884
39890
|
const { file: walked2, parentHops } = entry;
|
|
@@ -39897,7 +39903,7 @@ var Launcher = class {
|
|
|
39897
39903
|
const via = [interp, ...inner?.via ?? []];
|
|
39898
39904
|
const sources = [script, ...inner?.sources ?? []];
|
|
39899
39905
|
const bins = [...command?.bin ? [script] : [], ...inner?.bins ?? []];
|
|
39900
|
-
const chain2 = [...
|
|
39906
|
+
const chain2 = [...words2.binfmts, ...inner?.binfmts ?? []];
|
|
39901
39907
|
return inner && {
|
|
39902
39908
|
...inner,
|
|
39903
39909
|
target: withScriptEnv(inner.target, command),
|
|
@@ -39917,7 +39923,7 @@ var Launcher = class {
|
|
|
39917
39923
|
walkedVia: [walked2],
|
|
39918
39924
|
sources: [script],
|
|
39919
39925
|
...command?.bin ? { bins: [script] } : {},
|
|
39920
|
-
...
|
|
39926
|
+
...words2.binfmts.length > 0 ? { binfmts: words2.binfmts } : {},
|
|
39921
39927
|
asked: named
|
|
39922
39928
|
};
|
|
39923
39929
|
}
|