@ai-ecoverse/slicc-kernel 1.180.0 → 1.181.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.
@@ -827,7 +827,7 @@ async function loopbackFetch(dial, input, options) {
827
827
  }
828
828
 
829
829
  // src/client/protocol.ts
830
- var PROTOCOL = [1, 15];
830
+ var PROTOCOL = [1, 16];
831
831
  function locksOf(scope = globalThis) {
832
832
  const locks = scope.navigator?.locks;
833
833
  return typeof locks?.request === "function" ? locks : void 0;
@@ -1133,6 +1133,19 @@ async function spawnOn(channel, argv, opts) {
1133
1133
  signal: async (name = "SIGTERM") => void await channel.call({ op: "kill", pid: -pgid, signal: name })
1134
1134
  };
1135
1135
  }
1136
+ async function sudoRunOn(channel, replay, { stdout, stderr, tag }) {
1137
+ await since(channel, 16, "sudoRun", async () => {
1138
+ });
1139
+ const started = Promise.withResolvers();
1140
+ let endedBy;
1141
+ const { done } = channel.request(
1142
+ { op: "sudo-run", replay, options: { stdout, stderr, tag } },
1143
+ { started: started.resolve, ended: (signal) => endedBy = signal }
1144
+ );
1145
+ done.catch(started.reject);
1146
+ const pid = await started.promise;
1147
+ return { pid, pgid: pid, ended: endedOf(done, () => endedBy) };
1148
+ }
1136
1149
  function endedOf(done, signal) {
1137
1150
  return quiet(
1138
1151
  done.then((status) => {
@@ -1334,6 +1347,7 @@ async function attachKernel(port, options = {}) {
1334
1347
  return () => channel.traitsListeners.delete(listener);
1335
1348
  },
1336
1349
  trace: (tag, onEvents, options2 = {}) => traceOn(channel, tag, onEvents, options2),
1350
+ sudoRun: (replay, options2 = {}) => sudoRunOn(channel, replay, options2),
1337
1351
  async close(o = {}) {
1338
1352
  if (channel.failure) return;
1339
1353
  await channel.call({ op: "detach", ...o.kill ? { kill: true } : {} }).catch(() => void 0);