@ai-ecoverse/slicc-kernel 1.178.4 → 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 +20 -4
- package/dist/driver-worker.js +57 -1
- package/dist/driver-worker.js.map +2 -2
- package/dist/index.js +57 -1
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +235 -24
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-driver-worker.js +57 -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 +289 -22
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +1 -1
- package/dist/types/client/attach.d.ts +18 -3
- package/dist/types/client/protocol.d.ts +22 -4
- package/dist/types/index.d.ts +4 -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 +13 -0
- package/dist/types/node.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1958,7 +1958,7 @@ var RemoteTransport = class {
|
|
|
1958
1958
|
};
|
|
1959
1959
|
|
|
1960
1960
|
// src/client/protocol.ts
|
|
1961
|
-
var PROTOCOL = [1,
|
|
1961
|
+
var PROTOCOL = [1, 15];
|
|
1962
1962
|
function locksOf(scope = globalThis) {
|
|
1963
1963
|
const locks = scope.navigator?.locks;
|
|
1964
1964
|
return typeof locks?.request === "function" ? locks : void 0;
|
|
@@ -2023,6 +2023,7 @@ var Channel = class {
|
|
|
2023
2023
|
failure;
|
|
2024
2024
|
pending = /* @__PURE__ */ new Map();
|
|
2025
2025
|
watching = /* @__PURE__ */ new Map();
|
|
2026
|
+
tracing = /* @__PURE__ */ new Map();
|
|
2026
2027
|
cdpHooks = /* @__PURE__ */ new Map();
|
|
2027
2028
|
cdpOpen = /* @__PURE__ */ new Set();
|
|
2028
2029
|
facadeHooks = /* @__PURE__ */ new Map();
|
|
@@ -2090,6 +2091,10 @@ var Channel = class {
|
|
|
2090
2091
|
this.watching.get(data.watch)?.(data.change);
|
|
2091
2092
|
return;
|
|
2092
2093
|
}
|
|
2094
|
+
if (data.trace !== void 0 && data.id === void 0) {
|
|
2095
|
+
this.traced(data.trace, data.events ?? [], data.dropped ?? 0);
|
|
2096
|
+
return;
|
|
2097
|
+
}
|
|
2093
2098
|
if (data.bye !== void 0) {
|
|
2094
2099
|
this.end(new KernelGoneError(data.bye));
|
|
2095
2100
|
return;
|
|
@@ -2118,6 +2123,23 @@ var Channel = class {
|
|
|
2118
2123
|
if (reply.error !== void 0) call.reject(new KernelCallError(reply.error, reply.code));
|
|
2119
2124
|
else call.resolve(reply.result);
|
|
2120
2125
|
}
|
|
2126
|
+
traced(trace, events, dropped) {
|
|
2127
|
+
const listener = this.tracing.get(trace);
|
|
2128
|
+
if (!listener) return;
|
|
2129
|
+
const ack = () => {
|
|
2130
|
+
if (this.tracing.has(trace)) this.post({ traceAck: trace });
|
|
2131
|
+
};
|
|
2132
|
+
let consumed;
|
|
2133
|
+
try {
|
|
2134
|
+
consumed = listener({ events, dropped });
|
|
2135
|
+
} finally {
|
|
2136
|
+
if (typeof consumed?.then === "function") {
|
|
2137
|
+
void Promise.resolve(consumed).then(ack, ack);
|
|
2138
|
+
} else {
|
|
2139
|
+
ack();
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2121
2143
|
openCdp({ cdpOpen: { registration, ...request }, port }) {
|
|
2122
2144
|
const hook = registration === void 0 ? void 0 : this.cdpHooks.get(registration);
|
|
2123
2145
|
if (!hook || this.failure) {
|
|
@@ -2180,6 +2202,29 @@ async function serveCdpOn(channel, hook, options) {
|
|
|
2180
2202
|
}
|
|
2181
2203
|
};
|
|
2182
2204
|
}
|
|
2205
|
+
async function traceOn(channel, tag, onEvents, options) {
|
|
2206
|
+
if (typeof onEvents !== "function") throw new TypeError("trace: onEvents must be a function");
|
|
2207
|
+
await since(channel, 15, "trace", async () => {
|
|
2208
|
+
});
|
|
2209
|
+
const { id, done } = channel.request({
|
|
2210
|
+
op: "trace",
|
|
2211
|
+
tag,
|
|
2212
|
+
...options.limit !== void 0 ? { limit: options.limit } : {}
|
|
2213
|
+
});
|
|
2214
|
+
channel.tracing.set(id, onEvents);
|
|
2215
|
+
try {
|
|
2216
|
+
await done;
|
|
2217
|
+
} catch (error) {
|
|
2218
|
+
channel.tracing.delete(id);
|
|
2219
|
+
throw error;
|
|
2220
|
+
}
|
|
2221
|
+
return {
|
|
2222
|
+
close: () => {
|
|
2223
|
+
if (!channel.tracing.delete(id)) return;
|
|
2224
|
+
void channel.call({ op: "untrace", trace: id }).catch(() => void 0);
|
|
2225
|
+
}
|
|
2226
|
+
};
|
|
2227
|
+
}
|
|
2183
2228
|
async function dialOn(channel, { port, host }) {
|
|
2184
2229
|
const req = { op: "dial", port, ...host ? { host } : {} };
|
|
2185
2230
|
return dialStream(await since(channel, 4, "dial", () => channel.call(req)));
|
|
@@ -2193,6 +2238,10 @@ async function spawnOn(channel, argv, opts) {
|
|
|
2193
2238
|
});
|
|
2194
2239
|
if (opts.tag !== void 0) await since(channel, 12, "a tag per spawn", async () => {
|
|
2195
2240
|
});
|
|
2241
|
+
if (Array.isArray(opts.tag)) await since(channel, 15, "several tags per spawn", async () => {
|
|
2242
|
+
});
|
|
2243
|
+
if (opts.cwdMissing === "error") await since(channel, 14, "cwdMissing: 'error'", async () => {
|
|
2244
|
+
});
|
|
2196
2245
|
const started = Promise.withResolvers();
|
|
2197
2246
|
let endedBy;
|
|
2198
2247
|
const options = { ...rest, ...stdin !== void 0 ? { stdin: bytesOf2(stdin) } : {} };
|
|
@@ -2252,6 +2301,12 @@ async function terminalOn(channel, argv, opts) {
|
|
|
2252
2301
|
});
|
|
2253
2302
|
if (opts.tag !== void 0) await since(channel, 12, "a tag per terminal", async () => {
|
|
2254
2303
|
});
|
|
2304
|
+
if (Array.isArray(opts.tag)) {
|
|
2305
|
+
await since(channel, 15, "several tags per terminal", async () => {
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
if (opts.cwdMissing === "error") await since(channel, 14, "cwdMissing: 'error'", async () => {
|
|
2309
|
+
});
|
|
2255
2310
|
let listener = onData ?? null;
|
|
2256
2311
|
const backlog = [];
|
|
2257
2312
|
const started = Promise.withResolvers();
|
|
@@ -2409,6 +2464,7 @@ async function attachKernel(port, options = {}) {
|
|
|
2409
2464
|
channel.traitsListeners.add(listener);
|
|
2410
2465
|
return () => channel.traitsListeners.delete(listener);
|
|
2411
2466
|
},
|
|
2467
|
+
trace: (tag, onEvents, options2 = {}) => traceOn(channel, tag, onEvents, options2),
|
|
2412
2468
|
async close(o = {}) {
|
|
2413
2469
|
if (channel.failure) return;
|
|
2414
2470
|
await channel.call({ op: "detach", ...o.kill ? { kill: true } : {} }).catch(() => void 0);
|