@ai-ecoverse/slicc-kernel 1.80.0 → 1.82.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.
@@ -6135,7 +6135,12 @@ function createContext(o) {
6135
6135
  exiting ??= status2 & 255;
6136
6136
  return exitAtOnce(lane, [...writes], terminal.modes(), exiting);
6137
6137
  },
6138
- kill: killer({ self: o.pid, kernel, syncKernel, lane, writes, modes: terminal.modes })
6138
+ kill: killer({ self: o.pid, kernel, syncKernel, lane, writes, modes: terminal.modes }),
6139
+ cred: () => syncKernel.json({ op: "proc-cred" }),
6140
+ setcred(change) {
6141
+ if (typeof change !== "object" || change === null) throw new JsCallError("EINVAL", "setcred");
6142
+ return syncKernel.json({ op: "proc-setcred", change: { ...change } });
6143
+ }
6139
6144
  };
6140
6145
  const io = { read: read2, send: writeAll, close: (fd) => ctx.close(fd) };
6141
6146
  const children = childOps(kernel, io, { env: o.env, cwd: o.cwd, signal: signalNumber });
@@ -8240,7 +8245,7 @@ function importKey(namespace, name2, glue) {
8240
8245
  const literal = LITERALS[name2];
8241
8246
  return typeof namespace[literal] === "function" ? literal : void 0;
8242
8247
  }
8243
- function wrapImport(imports, name2, glue, wrap2) {
8248
+ function wrapImport(imports, name2, glue, wrap2, optional = false) {
8244
8249
  let wrapped = false;
8245
8250
  for (const ns of namespaces(imports)) {
8246
8251
  const key = importKey(ns, name2, glue);
@@ -8248,7 +8253,7 @@ function wrapImport(imports, name2, glue, wrap2) {
8248
8253
  ns[key] = wrap2(ns[key]);
8249
8254
  wrapped = true;
8250
8255
  }
8251
- if (!wrapped && typeof glue?.[name2] === "function") {
8256
+ if (!wrapped && !optional && typeof glue?.[name2] === "function") {
8252
8257
  throw new Error(`slicc-kernel cannot find the glue's ${LITERALS[name2]} among its imports`);
8253
8258
  }
8254
8259
  }
@@ -10169,12 +10174,18 @@ function holdWhileStopped(imports, header, glue) {
10169
10174
  while (Atomics.load(header, SAB_I_STOP) === 1) Atomics.wait(header, SAB_I_STOP, 1);
10170
10175
  };
10171
10176
  for (const name2 of ["fdWrite", "fdRead", "sleepMs"]) {
10172
- wrapImport(imports, name2, glue, (original) => (...args) => {
10173
- hold();
10174
- const done = original(...args);
10175
- hold();
10176
- return done;
10177
- });
10177
+ wrapImport(
10178
+ imports,
10179
+ name2,
10180
+ glue,
10181
+ (original) => (...args) => {
10182
+ hold();
10183
+ const done = original(...args);
10184
+ hold();
10185
+ return done;
10186
+ },
10187
+ true
10188
+ );
10178
10189
  }
10179
10190
  }
10180
10191
  function callerOwner(Fs, init) {