2g 0.4.2 → 0.4.3
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/CHANGELOG.md +7 -0
- package/README.md +3 -3
- package/dist/2g.d.ts +1 -0
- package/dist/2g.js +385 -327
- package/dist/2g.js.map +1 -1
- package/dist/2g.mjs +327 -269
- package/dist/2g.mjs.map +1 -1
- package/dist/chunks/api-chunk.js +8 -4
- package/dist/chunks/api-chunk.js.map +1 -1
- package/dist/chunks/api-chunk.mjs +9 -5
- package/dist/chunks/api-chunk.mjs.map +1 -1
- package/dist/chunks/cli-chunk.js +1 -1
- package/dist/chunks/cli-chunk.js.map +1 -1
- package/dist/chunks/cli-chunk.mjs +7 -7
- package/dist/chunks/cli-chunk.mjs.map +1 -1
- package/dist/chunks/sessionSockets-chunk.js +2 -0
- package/dist/chunks/sessionSockets-chunk.js.map +1 -1
- package/dist/chunks/sessionSockets-chunk.mjs +16 -14
- package/dist/chunks/sessionSockets-chunk.mjs.map +1 -1
- package/package.json +1 -1
package/dist/2g.mjs
CHANGED
|
@@ -2,25 +2,27 @@ import e from "node:path";
|
|
|
2
2
|
|
|
3
3
|
import { performance as t } from "node:perf_hooks";
|
|
4
4
|
|
|
5
|
-
import { E as i, f as s, e as n, m as r, L as o, b as c, I as l, g as h,
|
|
5
|
+
import { E as i, f as s, e as n, m as r, L as o, b as c, I as l, g as h, l as a, h as u, r as d, i as f, D as p, j as g, k as m, n as y, o as w, S as k, a as v, q as S, s as b } from "./chunks/sessionSockets-chunk.mjs";
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import L from "node:fs";
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import _ from "node:net";
|
|
10
10
|
|
|
11
|
-
import { s as
|
|
11
|
+
import { s as P, f as I, a as $ } from "./chunks/pretty-chunk.mjs";
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import E from "node:os";
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { Buffer as O } from "node:buffer";
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { EventEmitter as D } from "node:events";
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
import { isMainThread as C, threadId as T } from "node:worker_threads";
|
|
20
|
+
|
|
21
|
+
const j = Symbol.for(`2g/state-${i}`);
|
|
20
22
|
|
|
21
23
|
const x = function getEventLogState() {
|
|
22
24
|
const e = globalThis;
|
|
23
|
-
return e[
|
|
25
|
+
return e[j] ??= {
|
|
24
26
|
logPath: process.cwd(),
|
|
25
27
|
eventLoggerInfo: null,
|
|
26
28
|
debug: !1
|
|
@@ -29,17 +31,17 @@ const x = function getEventLogState() {
|
|
|
29
31
|
|
|
30
32
|
const N = t.timeOrigin;
|
|
31
33
|
|
|
32
|
-
const
|
|
34
|
+
const F = Array.from({
|
|
33
35
|
length: 1e3
|
|
34
36
|
}, (e, t) => `.${`${t}`.padStart(3, "0")}`);
|
|
35
37
|
|
|
36
|
-
let
|
|
38
|
+
let M = -1;
|
|
37
39
|
|
|
38
|
-
let
|
|
40
|
+
let R = "";
|
|
39
41
|
|
|
40
|
-
let
|
|
42
|
+
let U;
|
|
41
43
|
|
|
42
|
-
let
|
|
44
|
+
let A = "";
|
|
43
45
|
|
|
44
46
|
function writeEvent(e, t, i, s, n, r) {
|
|
45
47
|
try {
|
|
@@ -82,19 +84,19 @@ function writeCompleteEvent(e, t, i, s, n, r, o, c) {
|
|
|
82
84
|
function stringifyTimestamp() {
|
|
83
85
|
const e = N + t.now();
|
|
84
86
|
const i = Math.floor(e);
|
|
85
|
-
if (i !==
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
if (i !== M) {
|
|
88
|
+
M = i;
|
|
89
|
+
R = `${i}`;
|
|
88
90
|
}
|
|
89
|
-
return
|
|
91
|
+
return R + F[1e3 * (e - i) | 0];
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
function stringifyWorkerId(e) {
|
|
93
|
-
if (e !==
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
if (e !== U) {
|
|
96
|
+
U = e;
|
|
97
|
+
A = JSON.stringify(e);
|
|
96
98
|
}
|
|
97
|
-
return
|
|
99
|
+
return A;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
function appendPayload(e, t) {
|
|
@@ -189,7 +191,7 @@ function createDebugSink(e = process.env[o]) {
|
|
|
189
191
|
if (!t) {
|
|
190
192
|
return null;
|
|
191
193
|
}
|
|
192
|
-
const i =
|
|
194
|
+
const i = P(process.stderr);
|
|
193
195
|
return {
|
|
194
196
|
get writable() {
|
|
195
197
|
return !0;
|
|
@@ -211,7 +213,7 @@ function createDebugSink(e = process.env[o]) {
|
|
|
211
213
|
}, t)) {
|
|
212
214
|
continue;
|
|
213
215
|
}
|
|
214
|
-
process.stderr.write(`${
|
|
216
|
+
process.stderr.write(`${I(l, {
|
|
215
217
|
colorize: i,
|
|
216
218
|
stream: process.stderr
|
|
217
219
|
})}\n`);
|
|
@@ -226,7 +228,160 @@ function createDebugSink(e = process.env[o]) {
|
|
|
226
228
|
};
|
|
227
229
|
}
|
|
228
230
|
|
|
229
|
-
|
|
231
|
+
const B = Symbol.for("2g/process-cleanup");
|
|
232
|
+
|
|
233
|
+
function registerProcessCleanup(e) {
|
|
234
|
+
const t = getProcessCleanupState();
|
|
235
|
+
t.callbacks.add(e);
|
|
236
|
+
if (t.registered) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
t.registered = !0;
|
|
240
|
+
process.once("exit", runProcessCleanup);
|
|
241
|
+
for (const e of [ "SIGINT", "SIGTERM", "SIGHUP" ]) {
|
|
242
|
+
process.once(e, () => {
|
|
243
|
+
if (process.listenerCount(e) > 0) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
runProcessCleanup();
|
|
247
|
+
process.kill(process.pid, e);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function getProcessCleanupState() {
|
|
253
|
+
const e = globalThis;
|
|
254
|
+
return e[B] ??= {
|
|
255
|
+
registered: !1,
|
|
256
|
+
callbacks: new Set
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function runProcessCleanup() {
|
|
261
|
+
for (const e of getProcessCleanupState().callbacks) {
|
|
262
|
+
try {
|
|
263
|
+
e();
|
|
264
|
+
} catch {}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function listenIpcSink(e, t) {
|
|
269
|
+
const i = _.createServer(t => ingestIpcSocket(t, e));
|
|
270
|
+
const s = a(i, t);
|
|
271
|
+
const n = function publishIpcPath(e) {
|
|
272
|
+
process.env[l] = e;
|
|
273
|
+
return () => {
|
|
274
|
+
if (process.env[l] === e) {
|
|
275
|
+
delete process.env[l];
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}(t);
|
|
279
|
+
const r = x.debug;
|
|
280
|
+
if (r) {
|
|
281
|
+
process.env[h] = "1";
|
|
282
|
+
}
|
|
283
|
+
delete process.env[o];
|
|
284
|
+
delete process.env[u];
|
|
285
|
+
return () => {
|
|
286
|
+
s();
|
|
287
|
+
n();
|
|
288
|
+
if (r) {
|
|
289
|
+
delete process.env[h];
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function publishTempIpcSink(t) {
|
|
295
|
+
const i = function createTempIpcPath() {
|
|
296
|
+
const t = Date.now().toString(36);
|
|
297
|
+
const i = Math.random().toString(36).slice(2, 10);
|
|
298
|
+
const s = `${process.pid}-${t}-${i}`;
|
|
299
|
+
return "win32" === process.platform ? `\\\\.\\pipe\\event-log-${s}-ipc` : e.join(E.tmpdir(), `event-log-${s}.sock`);
|
|
300
|
+
}();
|
|
301
|
+
const s = listenIpcSink(t, i);
|
|
302
|
+
let n = !1;
|
|
303
|
+
const cleanup = () => {
|
|
304
|
+
if (n) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
n = !0;
|
|
308
|
+
s();
|
|
309
|
+
d(i);
|
|
310
|
+
};
|
|
311
|
+
const r = t.destroy.bind(t);
|
|
312
|
+
t.destroy = () => {
|
|
313
|
+
cleanup();
|
|
314
|
+
r();
|
|
315
|
+
};
|
|
316
|
+
t.once("close", cleanup);
|
|
317
|
+
registerProcessCleanup(cleanup);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function openIpc(e, t = {}) {
|
|
321
|
+
const i = t.retryMs ?? 50;
|
|
322
|
+
const s = t.maxRetryMs ?? 750;
|
|
323
|
+
return (t, n) => {
|
|
324
|
+
const r = Date.now();
|
|
325
|
+
const attempt = () => {
|
|
326
|
+
const o = _.connect(e);
|
|
327
|
+
let c = !1;
|
|
328
|
+
o.once("connect", () => {
|
|
329
|
+
const e = o._handle?.fd;
|
|
330
|
+
c = !0;
|
|
331
|
+
o.unref();
|
|
332
|
+
o.once("close", () => n.destroy());
|
|
333
|
+
const drain = (e, t) => {
|
|
334
|
+
o.ref();
|
|
335
|
+
o.write(e, e => {
|
|
336
|
+
o.unref();
|
|
337
|
+
t(e);
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
if ("number" == typeof e && e >= 0) {
|
|
341
|
+
t(null, e, drain);
|
|
342
|
+
} else {
|
|
343
|
+
t(null, null, drain);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
o.once("error", e => {
|
|
347
|
+
if (c) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
o.destroy();
|
|
351
|
+
((e, n) => {
|
|
352
|
+
if (Date.now() - r > s) {
|
|
353
|
+
t(e);
|
|
354
|
+
} else {
|
|
355
|
+
setTimeout(n, i);
|
|
356
|
+
}
|
|
357
|
+
})(e, attempt);
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
attempt();
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function ingestIpcSocket(e, t) {
|
|
365
|
+
let i = "";
|
|
366
|
+
e.unref();
|
|
367
|
+
e.setEncoding("utf8");
|
|
368
|
+
e.on("data", e => {
|
|
369
|
+
const s = i ? i + e : e;
|
|
370
|
+
const n = s.lastIndexOf("\n");
|
|
371
|
+
if (n === s.length - 1) {
|
|
372
|
+
i = "";
|
|
373
|
+
t._writeln(s);
|
|
374
|
+
} else if (-1 === n) {
|
|
375
|
+
i = s;
|
|
376
|
+
} else {
|
|
377
|
+
i = s.slice(n + 1);
|
|
378
|
+
t._writeln(s.slice(0, n + 1));
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
e.on("error", () => {});
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
class LogStream extends D {
|
|
230
385
|
#e=-1;
|
|
231
386
|
#t=null;
|
|
232
387
|
#i=null;
|
|
@@ -239,10 +394,10 @@ class LogStream extends $ {
|
|
|
239
394
|
#h=!1;
|
|
240
395
|
#a=!1;
|
|
241
396
|
#u="";
|
|
242
|
-
#
|
|
243
|
-
#
|
|
244
|
-
#g=0;
|
|
397
|
+
#d=0;
|
|
398
|
+
#f=[];
|
|
245
399
|
#p=0;
|
|
400
|
+
#g=0;
|
|
246
401
|
#m=0;
|
|
247
402
|
#y=!1;
|
|
248
403
|
#w=!1;
|
|
@@ -254,12 +409,12 @@ class LogStream extends $ {
|
|
|
254
409
|
if (null != e) {
|
|
255
410
|
this.#L(e);
|
|
256
411
|
} else {
|
|
257
|
-
this.#S(null,
|
|
412
|
+
this.#S(null, O.byteLength(this.#u));
|
|
258
413
|
}
|
|
259
414
|
};
|
|
260
415
|
#_=() => {
|
|
261
416
|
this.#w = !1;
|
|
262
|
-
if (!this.#n && !this.#l && (this.#
|
|
417
|
+
if (!this.#n && !this.#l && (this.#f.length - this.#p > this.#g || this.#u)) {
|
|
263
418
|
this.#P();
|
|
264
419
|
}
|
|
265
420
|
};
|
|
@@ -268,14 +423,14 @@ class LogStream extends $ {
|
|
|
268
423
|
this.#s = !1 !== t.closeFd;
|
|
269
424
|
if ("number" == typeof e) {
|
|
270
425
|
try {
|
|
271
|
-
|
|
426
|
+
L.fsyncSync(e);
|
|
272
427
|
} catch {}
|
|
273
428
|
this.#e = e;
|
|
274
429
|
process.nextTick(() => this.emit("ready"));
|
|
275
430
|
} else if ("string" == typeof e) {
|
|
276
|
-
this.#
|
|
431
|
+
this.#I(e);
|
|
277
432
|
} else {
|
|
278
|
-
this
|
|
433
|
+
this.#$(e, null);
|
|
279
434
|
}
|
|
280
435
|
}
|
|
281
436
|
get file() {
|
|
@@ -288,7 +443,7 @@ class LogStream extends $ {
|
|
|
288
443
|
return this.#n;
|
|
289
444
|
}
|
|
290
445
|
get buffered() {
|
|
291
|
-
return this.#
|
|
446
|
+
return this.#d;
|
|
292
447
|
}
|
|
293
448
|
get writable() {
|
|
294
449
|
return !this.#l && !this.#r;
|
|
@@ -309,16 +464,16 @@ class LogStream extends $ {
|
|
|
309
464
|
}
|
|
310
465
|
this.#a = !0;
|
|
311
466
|
if (!this.#n) {
|
|
312
|
-
this
|
|
467
|
+
this.#E();
|
|
313
468
|
}
|
|
314
469
|
}
|
|
315
|
-
|
|
470
|
+
#E() {
|
|
316
471
|
if (null == this.#t) {
|
|
317
472
|
return;
|
|
318
473
|
}
|
|
319
474
|
this.#a = !1;
|
|
320
475
|
this.#i = this.#e;
|
|
321
|
-
this.#
|
|
476
|
+
this.#I(this.#t);
|
|
322
477
|
}
|
|
323
478
|
#O(e) {
|
|
324
479
|
if ("EAGAIN" === e.code && null != this.#k) {
|
|
@@ -344,15 +499,15 @@ class LogStream extends $ {
|
|
|
344
499
|
this.#m = 0;
|
|
345
500
|
this.emit("write", t);
|
|
346
501
|
if (t === this.#u.length) {
|
|
347
|
-
this.#
|
|
502
|
+
this.#d -= this.#u.length;
|
|
348
503
|
this.#u = "";
|
|
349
504
|
} else {
|
|
350
|
-
if (
|
|
351
|
-
const e =
|
|
352
|
-
this.#
|
|
505
|
+
if (O.byteLength(this.#u) > t) {
|
|
506
|
+
const e = O.from(this.#u).toString("utf8", t);
|
|
507
|
+
this.#d -= this.#u.length - e.length;
|
|
353
508
|
this.#u = e;
|
|
354
509
|
} else {
|
|
355
|
-
this.#
|
|
510
|
+
this.#d -= this.#u.length;
|
|
356
511
|
this.#u = "";
|
|
357
512
|
}
|
|
358
513
|
}
|
|
@@ -361,11 +516,11 @@ class LogStream extends $ {
|
|
|
361
516
|
} else if (this.#o && !this.#r) {
|
|
362
517
|
this.#n = !1;
|
|
363
518
|
this.#D();
|
|
364
|
-
} else if (this.#
|
|
519
|
+
} else if (this.#f.length - this.#p > this.#g) {
|
|
365
520
|
this.#P();
|
|
366
521
|
} else if (this.#a) {
|
|
367
522
|
this.#n = !1;
|
|
368
|
-
this
|
|
523
|
+
this.#E();
|
|
369
524
|
} else if (this.#r) {
|
|
370
525
|
this.#n = !1;
|
|
371
526
|
this.#D();
|
|
@@ -377,24 +532,24 @@ class LogStream extends $ {
|
|
|
377
532
|
}
|
|
378
533
|
}
|
|
379
534
|
}
|
|
380
|
-
#
|
|
381
|
-
this
|
|
382
|
-
|
|
535
|
+
#I(t) {
|
|
536
|
+
this.#$(i => {
|
|
537
|
+
L.mkdir(e.dirname(t), {
|
|
383
538
|
recursive: !0
|
|
384
539
|
}, () => {
|
|
385
|
-
|
|
540
|
+
L.open(t, "a", 384, (e, t) => {
|
|
386
541
|
if (e || null == t) {
|
|
387
542
|
i(e);
|
|
388
543
|
return;
|
|
389
544
|
}
|
|
390
|
-
|
|
545
|
+
L.fchmod(t, 384, () => {
|
|
391
546
|
i(null, t);
|
|
392
547
|
});
|
|
393
548
|
});
|
|
394
549
|
});
|
|
395
550
|
}, t);
|
|
396
551
|
}
|
|
397
|
-
|
|
552
|
+
#$(e, t) {
|
|
398
553
|
this.#h = !0;
|
|
399
554
|
this.#n = !0;
|
|
400
555
|
e((e, i, s) => {
|
|
@@ -411,14 +566,14 @@ class LogStream extends $ {
|
|
|
411
566
|
this.#n = !1;
|
|
412
567
|
this.emit("ready");
|
|
413
568
|
if (null != n && n !== this.#e && !isStdFd(n)) {
|
|
414
|
-
fsFsync(n, () =>
|
|
569
|
+
fsFsync(n, () => L.close(n, () => {}));
|
|
415
570
|
}
|
|
416
571
|
if (this.#l) {
|
|
417
572
|
return;
|
|
418
573
|
}
|
|
419
574
|
if (this.#o) {
|
|
420
575
|
this.#D();
|
|
421
|
-
} else if (!this.#n && this.#
|
|
576
|
+
} else if (!this.#n && this.#f.length - this.#p > this.#g || this.#c) {
|
|
422
577
|
this.#P();
|
|
423
578
|
}
|
|
424
579
|
}
|
|
@@ -430,9 +585,9 @@ class LogStream extends $ {
|
|
|
430
585
|
return;
|
|
431
586
|
}
|
|
432
587
|
this.#l = !0;
|
|
433
|
-
this.#p = 0;
|
|
434
|
-
this.#d.length = 0;
|
|
435
588
|
this.#g = 0;
|
|
589
|
+
this.#f.length = 0;
|
|
590
|
+
this.#p = 0;
|
|
436
591
|
const onClose = e => {
|
|
437
592
|
if (e) {
|
|
438
593
|
this.emit("error", e);
|
|
@@ -450,7 +605,7 @@ class LogStream extends $ {
|
|
|
450
605
|
}
|
|
451
606
|
fsFsync(this.#e, e => {
|
|
452
607
|
if (!e && this.#s && !isStdFd(this.#e)) {
|
|
453
|
-
|
|
608
|
+
L.close(this.#e, onClose);
|
|
454
609
|
} else {
|
|
455
610
|
onClose();
|
|
456
611
|
}
|
|
@@ -472,22 +627,22 @@ class LogStream extends $ {
|
|
|
472
627
|
#P() {
|
|
473
628
|
this.#n = !0;
|
|
474
629
|
if (!this.#u) {
|
|
475
|
-
const e = this.#
|
|
476
|
-
if (e > this.#
|
|
477
|
-
this.#u = this.#
|
|
478
|
-
while (this.#
|
|
479
|
-
this.#u += this.#
|
|
630
|
+
const e = this.#f.length - this.#g;
|
|
631
|
+
if (e > this.#p) {
|
|
632
|
+
this.#u = this.#f[this.#p++] || "";
|
|
633
|
+
while (this.#p < e && this.#u.length < 65536) {
|
|
634
|
+
this.#u += this.#f[this.#p++];
|
|
480
635
|
}
|
|
481
|
-
if (this.#
|
|
482
|
-
this.#
|
|
483
|
-
this.#
|
|
636
|
+
if (this.#p === this.#f.length) {
|
|
637
|
+
this.#f.length = 0;
|
|
638
|
+
this.#p = 0;
|
|
484
639
|
}
|
|
485
640
|
}
|
|
486
641
|
}
|
|
487
642
|
if (null != this.#k && (this.#y || this.#e < 0)) {
|
|
488
643
|
this.#k(this.#u, this.#b);
|
|
489
644
|
} else {
|
|
490
|
-
|
|
645
|
+
L.write(this.#e, this.#u, this.#v);
|
|
491
646
|
}
|
|
492
647
|
}
|
|
493
648
|
_end() {
|
|
@@ -496,7 +651,7 @@ class LogStream extends $ {
|
|
|
496
651
|
if (this.#h) {
|
|
497
652
|
this.once("ready", () => this._end());
|
|
498
653
|
} else if (!this.#n && this.#e >= 0) {
|
|
499
|
-
if (this.#
|
|
654
|
+
if (this.#f.length - this.#p > this.#g) {
|
|
500
655
|
this.#P();
|
|
501
656
|
} else {
|
|
502
657
|
this.#D();
|
|
@@ -525,7 +680,7 @@ class LogStream extends $ {
|
|
|
525
680
|
}
|
|
526
681
|
if (this.#n || this.#h) {
|
|
527
682
|
this.#o = !0;
|
|
528
|
-
} else if (this.#
|
|
683
|
+
} else if (this.#f.length - this.#p > this.#g) {
|
|
529
684
|
this.#o = !0;
|
|
530
685
|
this.#P();
|
|
531
686
|
} else {
|
|
@@ -561,7 +716,7 @@ class LogStream extends $ {
|
|
|
561
716
|
this.once("drain", onDrain);
|
|
562
717
|
this.once("error", onError);
|
|
563
718
|
if (!this.#n) {
|
|
564
|
-
if (this.#
|
|
719
|
+
if (this.#f.length - this.#p > this.#g || this.#u) {
|
|
565
720
|
this.#P();
|
|
566
721
|
} else {
|
|
567
722
|
process.nextTick(() => this.emit("drain"));
|
|
@@ -573,51 +728,51 @@ class LogStream extends $ {
|
|
|
573
728
|
if (this.#l) {
|
|
574
729
|
return !1;
|
|
575
730
|
}
|
|
576
|
-
this.#
|
|
577
|
-
this.#
|
|
731
|
+
this.#d += e.length;
|
|
732
|
+
this.#f.push(e);
|
|
578
733
|
if (!this.#n) {
|
|
579
734
|
this.#C();
|
|
580
735
|
}
|
|
581
|
-
return this.#
|
|
736
|
+
return this.#d < 16384;
|
|
582
737
|
}
|
|
583
738
|
_write(e) {
|
|
584
739
|
if (this.#l) {
|
|
585
740
|
return !1;
|
|
586
741
|
}
|
|
587
|
-
if (0 === this.#
|
|
742
|
+
if (0 === this.#g && 10 === e.charCodeAt(e.length - 1)) {
|
|
588
743
|
return this._writeln(e);
|
|
589
744
|
}
|
|
590
|
-
this.#
|
|
745
|
+
this.#d += e.length;
|
|
591
746
|
let t = 0;
|
|
592
747
|
let i = -1;
|
|
593
748
|
while ((i = e.indexOf("\n", t)) > -1) {
|
|
594
749
|
const s = e.slice(t, i + 1);
|
|
595
|
-
if (this.#
|
|
596
|
-
this.#
|
|
750
|
+
if (this.#g > 0) {
|
|
751
|
+
this.#f[this.#f.length - 1] += s;
|
|
597
752
|
} else {
|
|
598
|
-
this.#
|
|
753
|
+
this.#f.push(s);
|
|
599
754
|
}
|
|
600
|
-
this.#
|
|
755
|
+
this.#g = 0;
|
|
601
756
|
t = ++i;
|
|
602
757
|
}
|
|
603
758
|
if (t < e.length) {
|
|
604
759
|
const i = e.slice(t);
|
|
605
|
-
if (this.#
|
|
606
|
-
this.#
|
|
760
|
+
if (this.#g > 0) {
|
|
761
|
+
this.#f[this.#f.length - 1] += i;
|
|
607
762
|
} else {
|
|
608
|
-
this.#
|
|
763
|
+
this.#f.push(e.slice(t));
|
|
609
764
|
}
|
|
610
|
-
this.#
|
|
765
|
+
this.#g = 1;
|
|
611
766
|
}
|
|
612
|
-
if (!this.#n && this.#
|
|
767
|
+
if (!this.#n && this.#f.length - this.#p > this.#g) {
|
|
613
768
|
this.#C();
|
|
614
769
|
}
|
|
615
|
-
return this.#
|
|
770
|
+
return this.#d < 16384;
|
|
616
771
|
}
|
|
617
772
|
write(e, t, i) {
|
|
618
773
|
const s = i || t;
|
|
619
774
|
const n = "string" == typeof t ? t : "utf8";
|
|
620
|
-
const r = "string" == typeof e ? e :
|
|
775
|
+
const r = "string" == typeof e ? e : O.from(e).toString(n);
|
|
621
776
|
const o = "function" == typeof s ? s : void 0;
|
|
622
777
|
try {
|
|
623
778
|
return this._write(r);
|
|
@@ -645,43 +800,43 @@ const isStdFd = e => {
|
|
|
645
800
|
|
|
646
801
|
const fsFsync = (e, t) => {
|
|
647
802
|
try {
|
|
648
|
-
|
|
803
|
+
L.fsync(e, t);
|
|
649
804
|
} catch (e) {
|
|
650
805
|
t(e);
|
|
651
806
|
}
|
|
652
807
|
};
|
|
653
808
|
|
|
654
809
|
class SocketSink {
|
|
655
|
-
#
|
|
810
|
+
#T;
|
|
656
811
|
constructor(e) {
|
|
657
|
-
this.#
|
|
812
|
+
this.#T = e;
|
|
658
813
|
e.on("error", () => {});
|
|
659
814
|
}
|
|
660
815
|
get writable() {
|
|
661
|
-
return this.#
|
|
816
|
+
return this.#T.writable;
|
|
662
817
|
}
|
|
663
818
|
get buffered() {
|
|
664
|
-
return this.#
|
|
819
|
+
return this.#T.writableLength;
|
|
665
820
|
}
|
|
666
821
|
_writeln(e) {
|
|
667
|
-
return this.#
|
|
822
|
+
return this.#T.write(e);
|
|
668
823
|
}
|
|
669
824
|
end(e) {
|
|
670
|
-
this.#
|
|
825
|
+
this.#T.end(e);
|
|
671
826
|
return this;
|
|
672
827
|
}
|
|
673
828
|
destroy() {
|
|
674
|
-
this.#
|
|
829
|
+
this.#T.destroy();
|
|
675
830
|
}
|
|
676
831
|
}
|
|
677
832
|
|
|
678
833
|
class BroadcastChannel {
|
|
679
|
-
#
|
|
680
|
-
#
|
|
834
|
+
#j;
|
|
835
|
+
#x=[];
|
|
681
836
|
#l=!1;
|
|
682
837
|
constructor(e) {
|
|
683
|
-
this.#
|
|
684
|
-
this.#
|
|
838
|
+
this.#j = e;
|
|
839
|
+
this.#x.push({
|
|
685
840
|
sink: e,
|
|
686
841
|
dropOnBackpressure: !1,
|
|
687
842
|
destroy: () => e.destroy()
|
|
@@ -691,8 +846,8 @@ class BroadcastChannel {
|
|
|
691
846
|
if (this.#l) {
|
|
692
847
|
return !1;
|
|
693
848
|
}
|
|
694
|
-
for (let e = 0; e < this.#
|
|
695
|
-
if (this.#
|
|
849
|
+
for (let e = 0; e < this.#x.length; e++) {
|
|
850
|
+
if (this.#x[e].sink.writable) {
|
|
696
851
|
return !0;
|
|
697
852
|
}
|
|
698
853
|
}
|
|
@@ -705,7 +860,7 @@ class BroadcastChannel {
|
|
|
705
860
|
if (this.#l) {
|
|
706
861
|
e.destroy();
|
|
707
862
|
} else {
|
|
708
|
-
this.#
|
|
863
|
+
this.#x.push({
|
|
709
864
|
sink: e,
|
|
710
865
|
dropOnBackpressure: !1,
|
|
711
866
|
destroy: () => e.destroy()
|
|
@@ -737,11 +892,11 @@ class BroadcastChannel {
|
|
|
737
892
|
e.destroy();
|
|
738
893
|
}
|
|
739
894
|
};
|
|
740
|
-
this.#
|
|
895
|
+
this.#x.push(i);
|
|
741
896
|
const detach = () => {
|
|
742
|
-
const e = this.#
|
|
897
|
+
const e = this.#x.indexOf(i);
|
|
743
898
|
if (e > -1) {
|
|
744
|
-
this.#
|
|
899
|
+
this.#x.splice(e, 1);
|
|
745
900
|
}
|
|
746
901
|
i.destroy();
|
|
747
902
|
};
|
|
@@ -749,26 +904,10 @@ class BroadcastChannel {
|
|
|
749
904
|
e.on("error", detach);
|
|
750
905
|
}
|
|
751
906
|
ingest(e) {
|
|
752
|
-
|
|
753
|
-
e.unref();
|
|
754
|
-
e.setEncoding("utf8");
|
|
755
|
-
e.on("data", e => {
|
|
756
|
-
const i = t ? t + e : e;
|
|
757
|
-
const s = i.lastIndexOf("\n");
|
|
758
|
-
if (s === i.length - 1) {
|
|
759
|
-
t = "";
|
|
760
|
-
this._writeln(i);
|
|
761
|
-
} else if (-1 === s) {
|
|
762
|
-
t = i;
|
|
763
|
-
} else {
|
|
764
|
-
t = i.slice(s + 1);
|
|
765
|
-
this._writeln(i.slice(0, s + 1));
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
e.on("error", () => {});
|
|
907
|
+
ingestIpcSocket(e, this);
|
|
769
908
|
}
|
|
770
909
|
_writeln(e) {
|
|
771
|
-
const t = this.#
|
|
910
|
+
const t = this.#x;
|
|
772
911
|
let i = !1;
|
|
773
912
|
for (let s = t.length - 1; s >= 0; s--) {
|
|
774
913
|
const n = t[s];
|
|
@@ -782,91 +921,47 @@ class BroadcastChannel {
|
|
|
782
921
|
return i;
|
|
783
922
|
}
|
|
784
923
|
flush(e) {
|
|
785
|
-
if (this.#
|
|
786
|
-
this.#
|
|
924
|
+
if (this.#j.flush) {
|
|
925
|
+
this.#j.flush(e);
|
|
787
926
|
} else {
|
|
788
927
|
e();
|
|
789
928
|
}
|
|
790
929
|
}
|
|
791
930
|
end(e) {
|
|
792
|
-
for (const t of this.#
|
|
793
|
-
t.sink.end(t.sink === this.#
|
|
931
|
+
for (const t of this.#x) {
|
|
932
|
+
t.sink.end(t.sink === this.#j ? e : void 0);
|
|
794
933
|
}
|
|
795
934
|
return this;
|
|
796
935
|
}
|
|
797
936
|
destroy() {
|
|
798
937
|
this.#l = !0;
|
|
799
|
-
for (const e of this.#
|
|
938
|
+
for (const e of this.#x) {
|
|
800
939
|
e.destroy();
|
|
801
940
|
}
|
|
802
|
-
this.#
|
|
941
|
+
this.#x.length = 0;
|
|
803
942
|
}
|
|
804
943
|
}
|
|
805
944
|
|
|
806
|
-
|
|
807
|
-
const i = t.retryMs ?? 50;
|
|
808
|
-
const s = t.maxRetryMs ?? 750;
|
|
809
|
-
return (t, n) => {
|
|
810
|
-
const r = Date.now();
|
|
811
|
-
const attempt = () => {
|
|
812
|
-
const o = L.connect(e);
|
|
813
|
-
let c = !1;
|
|
814
|
-
o.once("connect", () => {
|
|
815
|
-
const e = o._handle?.fd;
|
|
816
|
-
c = !0;
|
|
817
|
-
o.unref();
|
|
818
|
-
o.once("close", () => n.destroy());
|
|
819
|
-
const drain = (e, t) => {
|
|
820
|
-
o.ref();
|
|
821
|
-
o.write(e, e => {
|
|
822
|
-
o.unref();
|
|
823
|
-
t(e);
|
|
824
|
-
});
|
|
825
|
-
};
|
|
826
|
-
if ("number" == typeof e && e >= 0) {
|
|
827
|
-
t(null, e, drain);
|
|
828
|
-
} else {
|
|
829
|
-
t(null, null, drain);
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
o.once("error", e => {
|
|
833
|
-
if (c) {
|
|
834
|
-
return;
|
|
835
|
-
}
|
|
836
|
-
o.destroy();
|
|
837
|
-
((e, n) => {
|
|
838
|
-
if (Date.now() - r > s) {
|
|
839
|
-
t(e);
|
|
840
|
-
} else {
|
|
841
|
-
setTimeout(n, i);
|
|
842
|
-
}
|
|
843
|
-
})(e, attempt);
|
|
844
|
-
});
|
|
845
|
-
};
|
|
846
|
-
attempt();
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
const U = Symbol.for("2g/process-origin");
|
|
945
|
+
const W = Symbol.for("2g/process-origin");
|
|
851
946
|
|
|
852
947
|
function setLocalProcessOrigin(e) {
|
|
853
948
|
const t = globalThis;
|
|
854
949
|
if (e) {
|
|
855
|
-
t[
|
|
950
|
+
t[W] = e;
|
|
856
951
|
} else {
|
|
857
|
-
delete t[
|
|
952
|
+
delete t[W];
|
|
858
953
|
}
|
|
859
954
|
}
|
|
860
955
|
|
|
861
956
|
function getProcessOrigin() {
|
|
862
|
-
if (!
|
|
957
|
+
if (!C) {
|
|
863
958
|
return {
|
|
864
959
|
kind: "worker_thread",
|
|
865
|
-
id: String(
|
|
960
|
+
id: String(T)
|
|
866
961
|
};
|
|
867
962
|
}
|
|
868
|
-
const e = globalThis[
|
|
869
|
-
const t = process.env[
|
|
963
|
+
const e = globalThis[W];
|
|
964
|
+
const t = process.env[f];
|
|
870
965
|
if (t && t !== e) {
|
|
871
966
|
return {
|
|
872
967
|
kind: "event_log_child",
|
|
@@ -882,43 +977,25 @@ function getProcessOrigin() {
|
|
|
882
977
|
return null;
|
|
883
978
|
}
|
|
884
979
|
|
|
885
|
-
const A = Symbol.for("2g/process-cleanup");
|
|
886
|
-
|
|
887
|
-
function getProcessCleanupState() {
|
|
888
|
-
const e = globalThis;
|
|
889
|
-
return e[A] ??= {
|
|
890
|
-
registered: !1,
|
|
891
|
-
callbacks: new Set
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
function runProcessCleanup() {
|
|
896
|
-
for (const e of getProcessCleanupState().callbacks) {
|
|
897
|
-
try {
|
|
898
|
-
e();
|
|
899
|
-
} catch {}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
|
|
903
980
|
function createSession(t) {
|
|
904
|
-
const i =
|
|
981
|
+
const i = b();
|
|
905
982
|
const s = Date.now();
|
|
906
983
|
const n = `${process.pid}-${s.toString(36)}-${Math.random().toString(36).slice(2, 8).padEnd(6, "0")}`;
|
|
907
984
|
const r = e.join(i, n);
|
|
908
985
|
try {
|
|
909
|
-
|
|
986
|
+
L.mkdirSync(r, {
|
|
910
987
|
recursive: !0,
|
|
911
988
|
mode: 448
|
|
912
989
|
});
|
|
913
|
-
|
|
990
|
+
L.chmodSync(i, 448);
|
|
914
991
|
} catch {}
|
|
915
|
-
const o = t.maxSegments ?? (x.debug ?
|
|
916
|
-
const c = t.maxSegmentSize ?? (x.debug ?
|
|
917
|
-
const
|
|
918
|
-
const
|
|
919
|
-
const
|
|
920
|
-
const
|
|
921
|
-
|
|
992
|
+
const o = t.maxSegments ?? (x.debug ? p : g);
|
|
993
|
+
const c = t.maxSegmentSize ?? (x.debug ? m : y);
|
|
994
|
+
const l = w(r, n, "live");
|
|
995
|
+
const h = w(r, n, "ipc");
|
|
996
|
+
const u = new LogStream(e.join(r, "0.jsonl"));
|
|
997
|
+
const P = new BroadcastChannel(u);
|
|
998
|
+
P.add(createDebugSink());
|
|
922
999
|
!function trackSegmentRotation(t, i, s, n) {
|
|
923
1000
|
let r = 0;
|
|
924
1001
|
t.on("write", o => {
|
|
@@ -928,105 +1005,78 @@ function createSession(t) {
|
|
|
928
1005
|
}
|
|
929
1006
|
r = 0;
|
|
930
1007
|
!function rotateSegments(t, i) {
|
|
931
|
-
|
|
1008
|
+
L.rmSync(e.join(t, i - 1 + ".jsonl"), {
|
|
932
1009
|
force: !0
|
|
933
1010
|
});
|
|
934
1011
|
for (let s = i - 1; s >= 1; s--) {
|
|
935
1012
|
const i = e.join(t, s - 1 + ".jsonl");
|
|
936
1013
|
const n = e.join(t, `${s}.jsonl`);
|
|
937
1014
|
try {
|
|
938
|
-
|
|
1015
|
+
L.renameSync(i, n);
|
|
939
1016
|
} catch {}
|
|
940
1017
|
}
|
|
941
1018
|
}(i, s);
|
|
942
1019
|
t.reopen();
|
|
943
1020
|
});
|
|
944
|
-
}(
|
|
945
|
-
const I =
|
|
946
|
-
const $ =
|
|
947
|
-
const
|
|
948
|
-
const
|
|
949
|
-
const C = function publishIpcPath(e) {
|
|
950
|
-
process.env[l] = e;
|
|
951
|
-
return () => {
|
|
952
|
-
if (process.env[l] === e) {
|
|
953
|
-
delete process.env[l];
|
|
954
|
-
}
|
|
955
|
-
};
|
|
956
|
-
}(_.path);
|
|
957
|
-
const N = function publishProcessOrigin() {
|
|
1021
|
+
}(u, r, o, c);
|
|
1022
|
+
const I = _.createServer(e => P.attach(e));
|
|
1023
|
+
const $ = a(I, l.path);
|
|
1024
|
+
const E = listenIpcSink(P, h.path);
|
|
1025
|
+
const O = function publishProcessOrigin() {
|
|
958
1026
|
const e = String(process.pid);
|
|
959
|
-
process.env[
|
|
1027
|
+
process.env[f] = e;
|
|
960
1028
|
setLocalProcessOrigin(e);
|
|
961
1029
|
return () => {
|
|
962
|
-
if (process.env[
|
|
963
|
-
delete process.env[
|
|
1030
|
+
if (process.env[f] === e) {
|
|
1031
|
+
delete process.env[f];
|
|
964
1032
|
}
|
|
965
1033
|
setLocalProcessOrigin(void 0);
|
|
966
1034
|
};
|
|
967
1035
|
}();
|
|
968
|
-
const
|
|
1036
|
+
const D = {
|
|
969
1037
|
pid: process.pid,
|
|
970
|
-
formatVersion:
|
|
1038
|
+
formatVersion: S,
|
|
971
1039
|
startedAt: s,
|
|
972
1040
|
command: t.command ?? process.argv.slice(1).join(" "),
|
|
973
1041
|
cwd: process.cwd(),
|
|
974
1042
|
maxSegments: o,
|
|
975
1043
|
version: t.version,
|
|
976
|
-
socket:
|
|
977
|
-
ipcSocket:
|
|
1044
|
+
socket: l.name,
|
|
1045
|
+
ipcSocket: h.name,
|
|
978
1046
|
origin: createSessionOrigin()
|
|
979
1047
|
};
|
|
980
1048
|
try {
|
|
981
1049
|
!function writeJsonAtomic(e, t) {
|
|
982
1050
|
const i = `${e}.${process.pid}.tmp`;
|
|
983
|
-
|
|
1051
|
+
L.writeFileSync(i, JSON.stringify(t, null, 2), {
|
|
984
1052
|
mode: 384
|
|
985
1053
|
});
|
|
986
|
-
|
|
987
|
-
}(e.join(r,
|
|
1054
|
+
L.renameSync(i, e);
|
|
1055
|
+
}(e.join(r, k.meta), D);
|
|
988
1056
|
} catch {}
|
|
989
|
-
let
|
|
1057
|
+
let C = !1;
|
|
990
1058
|
const destroy = () => {
|
|
991
|
-
if (
|
|
1059
|
+
if (C) {
|
|
992
1060
|
return;
|
|
993
1061
|
}
|
|
994
|
-
|
|
995
|
-
|
|
1062
|
+
C = !0;
|
|
1063
|
+
P.destroy();
|
|
1064
|
+
$();
|
|
1065
|
+
E();
|
|
996
1066
|
O();
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
N();
|
|
1000
|
-
v(S.path);
|
|
1001
|
-
v(_.path);
|
|
1067
|
+
d(l.path);
|
|
1068
|
+
d(h.path);
|
|
1002
1069
|
};
|
|
1003
|
-
|
|
1004
|
-
const t = getProcessCleanupState();
|
|
1005
|
-
t.callbacks.add(e);
|
|
1006
|
-
if (t.registered) {
|
|
1007
|
-
return;
|
|
1008
|
-
}
|
|
1009
|
-
t.registered = !0;
|
|
1010
|
-
process.once("exit", runProcessCleanup);
|
|
1011
|
-
for (const e of [ "SIGINT", "SIGTERM", "SIGHUP" ]) {
|
|
1012
|
-
process.once(e, () => {
|
|
1013
|
-
if (process.listenerCount(e) > 0) {
|
|
1014
|
-
return;
|
|
1015
|
-
}
|
|
1016
|
-
runProcessCleanup();
|
|
1017
|
-
process.kill(process.pid, e);
|
|
1018
|
-
});
|
|
1019
|
-
}
|
|
1020
|
-
}(destroy);
|
|
1070
|
+
registerProcessCleanup(destroy);
|
|
1021
1071
|
setImmediate(() => {
|
|
1022
1072
|
try {
|
|
1023
|
-
|
|
1073
|
+
v();
|
|
1024
1074
|
} catch {}
|
|
1025
1075
|
});
|
|
1026
1076
|
return {
|
|
1027
1077
|
sessionDir: r,
|
|
1028
|
-
meta:
|
|
1029
|
-
sink:
|
|
1078
|
+
meta: D,
|
|
1079
|
+
sink: P,
|
|
1030
1080
|
destroy
|
|
1031
1081
|
};
|
|
1032
1082
|
}
|
|
@@ -1046,7 +1096,7 @@ function createSessionOrigin() {
|
|
|
1046
1096
|
};
|
|
1047
1097
|
}
|
|
1048
1098
|
|
|
1049
|
-
const
|
|
1099
|
+
const J = events("root");
|
|
1050
1100
|
|
|
1051
1101
|
function installChildEventLogger(e) {
|
|
1052
1102
|
if (x.primarySink) {
|
|
@@ -1065,16 +1115,19 @@ function installChildEventLogger(e) {
|
|
|
1065
1115
|
return process.env[l];
|
|
1066
1116
|
}();
|
|
1067
1117
|
if (i) {
|
|
1068
|
-
x.debug = e?.debug ??
|
|
1118
|
+
x.debug = e?.debug ?? (function isParentDebugEnabled() {
|
|
1119
|
+
return "1" === process.env[h];
|
|
1120
|
+
}() || !!process.env[o]);
|
|
1069
1121
|
!function connectToParent(e) {
|
|
1070
1122
|
x.primarySink = createPrimarySink(openIpc(e), {
|
|
1071
1123
|
closeFd: !1
|
|
1072
1124
|
});
|
|
1073
1125
|
x.eventLoggerInfo = {
|
|
1074
1126
|
destination: "ipc",
|
|
1075
|
-
isUserVisibleOutput: !1
|
|
1127
|
+
isUserVisibleOutput: !1,
|
|
1128
|
+
debug: x.debug
|
|
1076
1129
|
};
|
|
1077
|
-
|
|
1130
|
+
J("init", getInitMetadata());
|
|
1078
1131
|
}(i);
|
|
1079
1132
|
return !0;
|
|
1080
1133
|
} else {
|
|
@@ -1087,10 +1140,10 @@ function installEventLogger(e) {
|
|
|
1087
1140
|
if (installChildEventLogger(t)) {
|
|
1088
1141
|
return;
|
|
1089
1142
|
}
|
|
1090
|
-
const i = parseLogTarget(process.env[
|
|
1143
|
+
const i = parseLogTarget(process.env[u]) ?? parseLogTarget("string" == typeof e || "number" == typeof e ? e : void 0);
|
|
1091
1144
|
if (null != i) {
|
|
1092
1145
|
if ("number" == typeof i) {
|
|
1093
|
-
|
|
1146
|
+
$(i);
|
|
1094
1147
|
}
|
|
1095
1148
|
x.debug = t?.debug ?? !0;
|
|
1096
1149
|
x.eventLoggerInfo = function getExplicitTargetInfo(e) {
|
|
@@ -1098,16 +1151,20 @@ function installEventLogger(e) {
|
|
|
1098
1151
|
return {
|
|
1099
1152
|
destination: 1 === e ? "stdout" : 2 === e ? "stderr" : "fd",
|
|
1100
1153
|
isUserVisibleOutput: 1 === e || 2 === e,
|
|
1154
|
+
debug: x.debug,
|
|
1101
1155
|
fd: e
|
|
1102
1156
|
};
|
|
1103
1157
|
}
|
|
1104
1158
|
return {
|
|
1105
1159
|
destination: "file",
|
|
1106
1160
|
isUserVisibleOutput: !1,
|
|
1161
|
+
debug: x.debug,
|
|
1107
1162
|
file: e
|
|
1108
1163
|
};
|
|
1109
1164
|
}(i);
|
|
1110
|
-
|
|
1165
|
+
const e = createPrimarySink(i);
|
|
1166
|
+
publishTempIpcSink(e);
|
|
1167
|
+
activateSink(e);
|
|
1111
1168
|
return;
|
|
1112
1169
|
}
|
|
1113
1170
|
if (t && !1 !== t.session) {
|
|
@@ -1117,6 +1174,7 @@ function installEventLogger(e) {
|
|
|
1117
1174
|
x.eventLoggerInfo = {
|
|
1118
1175
|
destination: "session",
|
|
1119
1176
|
isUserVisibleOutput: !1,
|
|
1177
|
+
debug: x.debug,
|
|
1120
1178
|
sessionDir: e.sessionDir
|
|
1121
1179
|
};
|
|
1122
1180
|
activateSink(e.sink, t.version);
|
|
@@ -1170,7 +1228,7 @@ function createPrimarySink(e, t) {
|
|
|
1170
1228
|
function getInitMetadata(e) {
|
|
1171
1229
|
return {
|
|
1172
1230
|
format: "v0-jsonl",
|
|
1173
|
-
formatVersion:
|
|
1231
|
+
formatVersion: S,
|
|
1174
1232
|
version: e ?? "UNVERSIONED",
|
|
1175
1233
|
processOrigin: getProcessOrigin() ?? void 0
|
|
1176
1234
|
};
|
|
@@ -1178,7 +1236,7 @@ function getInitMetadata(e) {
|
|
|
1178
1236
|
|
|
1179
1237
|
function activateSink(e, t) {
|
|
1180
1238
|
x.primarySink = e;
|
|
1181
|
-
|
|
1239
|
+
J("init", getInitMetadata(t));
|
|
1182
1240
|
}
|
|
1183
1241
|
|
|
1184
1242
|
installChildEventLogger();
|