@ai-ecoverse/slicc-kernel 1.179.0 → 1.180.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 +17 -2
- package/dist/driver-worker.js +53 -1
- package/dist/driver-worker.js.map +2 -2
- package/dist/index.js +53 -1
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +217 -20
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-driver-worker.js +53 -1
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +267 -18
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +1 -1
- package/dist/types/client/attach.d.ts +15 -3
- package/dist/types/client/protocol.d.ts +20 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/kernel/jobs.d.ts +2 -1
- package/dist/types/kernel/trace.d.ts +59 -0
- package/dist/types/launcher.d.ts +9 -0
- package/dist/types/node.d.ts +1 -1
- package/package.json +2 -2
|
@@ -827,7 +827,7 @@ async function loopbackFetch(dial, input, options) {
|
|
|
827
827
|
}
|
|
828
828
|
|
|
829
829
|
// src/client/protocol.ts
|
|
830
|
-
var PROTOCOL = [1,
|
|
830
|
+
var PROTOCOL = [1, 15];
|
|
831
831
|
function locksOf(scope = globalThis) {
|
|
832
832
|
const locks = scope.navigator?.locks;
|
|
833
833
|
return typeof locks?.request === "function" ? locks : void 0;
|
|
@@ -892,6 +892,7 @@ var Channel = class {
|
|
|
892
892
|
failure;
|
|
893
893
|
pending = /* @__PURE__ */ new Map();
|
|
894
894
|
watching = /* @__PURE__ */ new Map();
|
|
895
|
+
tracing = /* @__PURE__ */ new Map();
|
|
895
896
|
cdpHooks = /* @__PURE__ */ new Map();
|
|
896
897
|
cdpOpen = /* @__PURE__ */ new Set();
|
|
897
898
|
facadeHooks = /* @__PURE__ */ new Map();
|
|
@@ -959,6 +960,10 @@ var Channel = class {
|
|
|
959
960
|
this.watching.get(data.watch)?.(data.change);
|
|
960
961
|
return;
|
|
961
962
|
}
|
|
963
|
+
if (data.trace !== void 0 && data.id === void 0) {
|
|
964
|
+
this.traced(data.trace, data.events ?? [], data.dropped ?? 0);
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
962
967
|
if (data.bye !== void 0) {
|
|
963
968
|
this.end(new KernelGoneError(data.bye));
|
|
964
969
|
return;
|
|
@@ -987,6 +992,23 @@ var Channel = class {
|
|
|
987
992
|
if (reply.error !== void 0) call.reject(new KernelCallError(reply.error, reply.code));
|
|
988
993
|
else call.resolve(reply.result);
|
|
989
994
|
}
|
|
995
|
+
traced(trace, events, dropped) {
|
|
996
|
+
const listener = this.tracing.get(trace);
|
|
997
|
+
if (!listener) return;
|
|
998
|
+
const ack = () => {
|
|
999
|
+
if (this.tracing.has(trace)) this.post({ traceAck: trace });
|
|
1000
|
+
};
|
|
1001
|
+
let consumed;
|
|
1002
|
+
try {
|
|
1003
|
+
consumed = listener({ events, dropped });
|
|
1004
|
+
} finally {
|
|
1005
|
+
if (typeof consumed?.then === "function") {
|
|
1006
|
+
void Promise.resolve(consumed).then(ack, ack);
|
|
1007
|
+
} else {
|
|
1008
|
+
ack();
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
990
1012
|
openCdp({ cdpOpen: { registration, ...request }, port }) {
|
|
991
1013
|
const hook = registration === void 0 ? void 0 : this.cdpHooks.get(registration);
|
|
992
1014
|
if (!hook || this.failure) {
|
|
@@ -1049,6 +1071,29 @@ async function serveCdpOn(channel, hook, options) {
|
|
|
1049
1071
|
}
|
|
1050
1072
|
};
|
|
1051
1073
|
}
|
|
1074
|
+
async function traceOn(channel, tag, onEvents, options) {
|
|
1075
|
+
if (typeof onEvents !== "function") throw new TypeError("trace: onEvents must be a function");
|
|
1076
|
+
await since(channel, 15, "trace", async () => {
|
|
1077
|
+
});
|
|
1078
|
+
const { id, done } = channel.request({
|
|
1079
|
+
op: "trace",
|
|
1080
|
+
tag,
|
|
1081
|
+
...options.limit !== void 0 ? { limit: options.limit } : {}
|
|
1082
|
+
});
|
|
1083
|
+
channel.tracing.set(id, onEvents);
|
|
1084
|
+
try {
|
|
1085
|
+
await done;
|
|
1086
|
+
} catch (error) {
|
|
1087
|
+
channel.tracing.delete(id);
|
|
1088
|
+
throw error;
|
|
1089
|
+
}
|
|
1090
|
+
return {
|
|
1091
|
+
close: () => {
|
|
1092
|
+
if (!channel.tracing.delete(id)) return;
|
|
1093
|
+
void channel.call({ op: "untrace", trace: id }).catch(() => void 0);
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1052
1097
|
async function dialOn(channel, { port, host }) {
|
|
1053
1098
|
const req = { op: "dial", port, ...host ? { host } : {} };
|
|
1054
1099
|
return dialStream(await since(channel, 4, "dial", () => channel.call(req)));
|
|
@@ -1062,6 +1107,8 @@ async function spawnOn(channel, argv, opts) {
|
|
|
1062
1107
|
});
|
|
1063
1108
|
if (opts.tag !== void 0) await since(channel, 12, "a tag per spawn", async () => {
|
|
1064
1109
|
});
|
|
1110
|
+
if (Array.isArray(opts.tag)) await since(channel, 15, "several tags per spawn", async () => {
|
|
1111
|
+
});
|
|
1065
1112
|
if (opts.cwdMissing === "error") await since(channel, 14, "cwdMissing: 'error'", async () => {
|
|
1066
1113
|
});
|
|
1067
1114
|
const started = Promise.withResolvers();
|
|
@@ -1123,6 +1170,10 @@ async function terminalOn(channel, argv, opts) {
|
|
|
1123
1170
|
});
|
|
1124
1171
|
if (opts.tag !== void 0) await since(channel, 12, "a tag per terminal", async () => {
|
|
1125
1172
|
});
|
|
1173
|
+
if (Array.isArray(opts.tag)) {
|
|
1174
|
+
await since(channel, 15, "several tags per terminal", async () => {
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1126
1177
|
if (opts.cwdMissing === "error") await since(channel, 14, "cwdMissing: 'error'", async () => {
|
|
1127
1178
|
});
|
|
1128
1179
|
let listener = onData ?? null;
|
|
@@ -1282,6 +1333,7 @@ async function attachKernel(port, options = {}) {
|
|
|
1282
1333
|
channel.traitsListeners.add(listener);
|
|
1283
1334
|
return () => channel.traitsListeners.delete(listener);
|
|
1284
1335
|
},
|
|
1336
|
+
trace: (tag, onEvents, options2 = {}) => traceOn(channel, tag, onEvents, options2),
|
|
1285
1337
|
async close(o = {}) {
|
|
1286
1338
|
if (channel.failure) return;
|
|
1287
1339
|
await channel.call({ op: "detach", ...o.kill ? { kill: true } : {} }).catch(() => void 0);
|