vibelet 1.2.184 → 1.2.185
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 +34 -0
- package/dist/index.cjs +1 -1
- package/dist/inventory-scan-worker.cjs +1 -1
- package/dist/runtime-version.cjs +1 -1
- package/dist/tailcat/vibelet-tailcat-darwin-amd64 +0 -0
- package/dist/tailcat/vibelet-tailcat-darwin-arm64 +0 -0
- package/dist/tailcat/vibelet-tailcat-linux-amd64 +0 -0
- package/dist/tailcat/vibelet-tailcat-linux-arm64 +0 -0
- package/dist/tailcat/vibelet-tailcat-win32-amd64.exe +0 -0
- package/dist/tailcat/vibelet-tailcat-win32-arm64.exe +0 -0
- package/dist/vibelet.mjs +115 -96
- package/package.json +1 -1
package/dist/runtime-version.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var c=require("node:fs"),n=require("node:path"),p="@vibelet/cli";function i(r){try{let e=JSON.parse((0,c.readFileSync)(r,"utf8"));if(e.name===p&&typeof e.version=="string"&&e.version.length>0)return e.version}catch{}return null}function l(){return"1.2.
|
|
1
|
+
var c=require("node:fs"),n=require("node:path"),p="@vibelet/cli";function i(r){try{let e=JSON.parse((0,c.readFileSync)(r,"utf8"));if(e.name===p&&typeof e.version=="string"&&e.version.length>0)return e.version}catch{}return null}function l(){return"1.2.185"}var a=l();process.stdout.write(`${a}
|
|
2
2
|
`);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/vibelet.mjs
CHANGED
|
@@ -12369,7 +12369,7 @@ function canUseSystemdUserManager({ spawnSyncImpl = node_child_process__WEBPACK_
|
|
|
12369
12369
|
|
|
12370
12370
|
/***/ }),
|
|
12371
12371
|
|
|
12372
|
-
/***/
|
|
12372
|
+
/***/ 2629:
|
|
12373
12373
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
|
|
12374
12374
|
|
|
12375
12375
|
|
|
@@ -12422,6 +12422,112 @@ var websocket_server = __nccwpck_require__(3261);
|
|
|
12422
12422
|
|
|
12423
12423
|
/* harmony default export */ const wrapper = (websocket);
|
|
12424
12424
|
|
|
12425
|
+
;// CONCATENATED MODULE: ./bin/terminal-process-tree.mjs
|
|
12426
|
+
|
|
12427
|
+
|
|
12428
|
+
const TAKEOVER_STOP_TIMEOUT_MS = 3000;
|
|
12429
|
+
|
|
12430
|
+
function terminal_process_tree_sendSignal(child, signal) {
|
|
12431
|
+
if (!child.pid || child.exitCode !== null || child.signalCode !== null) return;
|
|
12432
|
+
try {
|
|
12433
|
+
process.kill(child.pid, signal);
|
|
12434
|
+
} catch {
|
|
12435
|
+
// Already exited.
|
|
12436
|
+
}
|
|
12437
|
+
}
|
|
12438
|
+
|
|
12439
|
+
function isPidAlive(pid) {
|
|
12440
|
+
if (!pid) return false;
|
|
12441
|
+
try {
|
|
12442
|
+
process.kill(pid, 0);
|
|
12443
|
+
return true;
|
|
12444
|
+
} catch {
|
|
12445
|
+
return false;
|
|
12446
|
+
}
|
|
12447
|
+
}
|
|
12448
|
+
|
|
12449
|
+
function collectProcessTreePids(rootPid) {
|
|
12450
|
+
if (!rootPid) return [];
|
|
12451
|
+
let rows;
|
|
12452
|
+
try {
|
|
12453
|
+
rows = (0,external_node_child_process_.execFileSync)('ps', ['-axo', 'pid=,ppid='], {
|
|
12454
|
+
encoding: 'utf8',
|
|
12455
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
12456
|
+
});
|
|
12457
|
+
} catch {
|
|
12458
|
+
return [rootPid];
|
|
12459
|
+
}
|
|
12460
|
+
const childrenByParent = new Map();
|
|
12461
|
+
for (const line of rows.split('\n')) {
|
|
12462
|
+
const [pidText, ppidText] = line.trim().split(/\s+/);
|
|
12463
|
+
const pid = Number(pidText);
|
|
12464
|
+
const ppid = Number(ppidText);
|
|
12465
|
+
if (!Number.isFinite(pid) || !Number.isFinite(ppid)) continue;
|
|
12466
|
+
const children = childrenByParent.get(ppid) ?? [];
|
|
12467
|
+
children.push(pid);
|
|
12468
|
+
childrenByParent.set(ppid, children);
|
|
12469
|
+
}
|
|
12470
|
+
const out = [];
|
|
12471
|
+
const visit = (pid) => {
|
|
12472
|
+
out.push(pid);
|
|
12473
|
+
for (const childPid of childrenByParent.get(pid) ?? []) {
|
|
12474
|
+
visit(childPid);
|
|
12475
|
+
}
|
|
12476
|
+
};
|
|
12477
|
+
visit(rootPid);
|
|
12478
|
+
return out;
|
|
12479
|
+
}
|
|
12480
|
+
|
|
12481
|
+
function sendSignalToPids(pids, signal) {
|
|
12482
|
+
for (const pid of [...pids].reverse()) {
|
|
12483
|
+
try {
|
|
12484
|
+
process.kill(pid, signal);
|
|
12485
|
+
} catch {
|
|
12486
|
+
// Already exited.
|
|
12487
|
+
}
|
|
12488
|
+
}
|
|
12489
|
+
}
|
|
12490
|
+
|
|
12491
|
+
async function waitForProcessTreeExit(pids, timeoutMs) {
|
|
12492
|
+
const deadline = Date.now() + timeoutMs;
|
|
12493
|
+
while ([...pids].some(isPidAlive)) {
|
|
12494
|
+
const remainingMs = deadline - Date.now();
|
|
12495
|
+
if (remainingMs <= 0) return false;
|
|
12496
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(remainingMs, 10)));
|
|
12497
|
+
}
|
|
12498
|
+
return true;
|
|
12499
|
+
}
|
|
12500
|
+
|
|
12501
|
+
async function waitForExitOrTimeout(childExit, timeoutMs) {
|
|
12502
|
+
let timer;
|
|
12503
|
+
const timeout = new Promise((resolve) => {
|
|
12504
|
+
timer = setTimeout(() => resolve(null), timeoutMs);
|
|
12505
|
+
});
|
|
12506
|
+
const result = await Promise.race([childExit, timeout]);
|
|
12507
|
+
clearTimeout(timer);
|
|
12508
|
+
return result;
|
|
12509
|
+
}
|
|
12510
|
+
|
|
12511
|
+
async function stopNativeChild(
|
|
12512
|
+
child,
|
|
12513
|
+
childExit,
|
|
12514
|
+
{ interruptTimeoutMs = TAKEOVER_STOP_TIMEOUT_MS, terminateTimeoutMs = 1000, killTimeoutMs = 1000 } = {},
|
|
12515
|
+
) {
|
|
12516
|
+
if (child.exitCode !== null || child.signalCode !== null) return true;
|
|
12517
|
+
const trackedPids = new Set(collectProcessTreePids(child.pid));
|
|
12518
|
+
terminal_process_tree_sendSignal(child, 'SIGINT');
|
|
12519
|
+
await waitForExitOrTimeout(childExit, interruptTimeoutMs);
|
|
12520
|
+
if (await waitForProcessTreeExit(trackedPids, 0)) return true;
|
|
12521
|
+
|
|
12522
|
+
for (const pid of collectProcessTreePids(child.pid)) trackedPids.add(pid);
|
|
12523
|
+
sendSignalToPids(trackedPids, 'SIGTERM');
|
|
12524
|
+
if (await waitForProcessTreeExit(trackedPids, terminateTimeoutMs)) return true;
|
|
12525
|
+
|
|
12526
|
+
for (const pid of collectProcessTreePids(child.pid)) trackedPids.add(pid);
|
|
12527
|
+
sendSignalToPids(trackedPids, 'SIGKILL');
|
|
12528
|
+
return waitForProcessTreeExit(trackedPids, killTimeoutMs);
|
|
12529
|
+
}
|
|
12530
|
+
|
|
12425
12531
|
;// CONCATENATED MODULE: ./bin/terminal-wrapper.mjs
|
|
12426
12532
|
|
|
12427
12533
|
|
|
@@ -12430,10 +12536,13 @@ var websocket_server = __nccwpck_require__(3261);
|
|
|
12430
12536
|
|
|
12431
12537
|
|
|
12432
12538
|
|
|
12539
|
+
|
|
12540
|
+
|
|
12541
|
+
|
|
12433
12542
|
const terminalControlTokenPath = (0,external_node_path_.join)((0,external_node_os_.homedir)(), '.vibelet', 'runtime', 'terminal-control-token');
|
|
12434
12543
|
|
|
12435
|
-
const
|
|
12436
|
-
const TAKEOVER_MODE_SETTLE_TIMEOUT_MS =
|
|
12544
|
+
const terminal_wrapper_TAKEOVER_STOP_TIMEOUT_MS = 3000;
|
|
12545
|
+
const TAKEOVER_MODE_SETTLE_TIMEOUT_MS = terminal_wrapper_TAKEOVER_STOP_TIMEOUT_MS + 2000;
|
|
12437
12546
|
const SWITCHBACK_RESTORE_NOTICE_MS = 1200;
|
|
12438
12547
|
const SWITCHBACK_BUSY_RETRY_DELAY_MS = 750;
|
|
12439
12548
|
const TERMINAL_CONTROL_RECONNECT_DELAY_MS = 1000;
|
|
@@ -12765,94 +12874,6 @@ function waitForChildExit(child) {
|
|
|
12765
12874
|
});
|
|
12766
12875
|
}
|
|
12767
12876
|
|
|
12768
|
-
function sendSignal(child, signal) {
|
|
12769
|
-
if (!child.pid || child.exitCode !== null || child.signalCode !== null) return;
|
|
12770
|
-
try {
|
|
12771
|
-
process.kill(child.pid, signal);
|
|
12772
|
-
} catch {
|
|
12773
|
-
// Already exited.
|
|
12774
|
-
}
|
|
12775
|
-
}
|
|
12776
|
-
|
|
12777
|
-
function isPidAlive(pid) {
|
|
12778
|
-
if (!pid) return false;
|
|
12779
|
-
try {
|
|
12780
|
-
process.kill(pid, 0);
|
|
12781
|
-
return true;
|
|
12782
|
-
} catch {
|
|
12783
|
-
return false;
|
|
12784
|
-
}
|
|
12785
|
-
}
|
|
12786
|
-
|
|
12787
|
-
function collectProcessTreePids(rootPid) {
|
|
12788
|
-
if (!rootPid) return [];
|
|
12789
|
-
let rows;
|
|
12790
|
-
try {
|
|
12791
|
-
rows = (0,external_node_child_process_.execFileSync)('ps', ['-axo', 'pid=,ppid='], {
|
|
12792
|
-
encoding: 'utf8',
|
|
12793
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
12794
|
-
});
|
|
12795
|
-
} catch {
|
|
12796
|
-
return [rootPid];
|
|
12797
|
-
}
|
|
12798
|
-
const childrenByParent = new Map();
|
|
12799
|
-
for (const line of rows.split('\n')) {
|
|
12800
|
-
const [pidText, ppidText] = line.trim().split(/\s+/);
|
|
12801
|
-
const pid = Number(pidText);
|
|
12802
|
-
const ppid = Number(ppidText);
|
|
12803
|
-
if (!Number.isFinite(pid) || !Number.isFinite(ppid)) continue;
|
|
12804
|
-
const children = childrenByParent.get(ppid) ?? [];
|
|
12805
|
-
children.push(pid);
|
|
12806
|
-
childrenByParent.set(ppid, children);
|
|
12807
|
-
}
|
|
12808
|
-
const out = [];
|
|
12809
|
-
const visit = (pid) => {
|
|
12810
|
-
out.push(pid);
|
|
12811
|
-
for (const childPid of childrenByParent.get(pid) ?? []) {
|
|
12812
|
-
visit(childPid);
|
|
12813
|
-
}
|
|
12814
|
-
};
|
|
12815
|
-
visit(rootPid);
|
|
12816
|
-
return out;
|
|
12817
|
-
}
|
|
12818
|
-
|
|
12819
|
-
function sendSignalToProcessTree(child, signal) {
|
|
12820
|
-
if (!child.pid || child.exitCode !== null || child.signalCode !== null) return;
|
|
12821
|
-
const pids = collectProcessTreePids(child.pid);
|
|
12822
|
-
for (const pid of pids.reverse()) {
|
|
12823
|
-
try {
|
|
12824
|
-
process.kill(pid, signal);
|
|
12825
|
-
} catch {
|
|
12826
|
-
// Already exited.
|
|
12827
|
-
}
|
|
12828
|
-
}
|
|
12829
|
-
}
|
|
12830
|
-
|
|
12831
|
-
async function waitForExitOrTimeout(childExit, timeoutMs) {
|
|
12832
|
-
let timer;
|
|
12833
|
-
const timeout = new Promise((resolve) => {
|
|
12834
|
-
timer = setTimeout(() => resolve(null), timeoutMs);
|
|
12835
|
-
});
|
|
12836
|
-
const result = await Promise.race([childExit, timeout]);
|
|
12837
|
-
clearTimeout(timer);
|
|
12838
|
-
return result;
|
|
12839
|
-
}
|
|
12840
|
-
|
|
12841
|
-
async function stopNativeChild(
|
|
12842
|
-
child,
|
|
12843
|
-
childExit,
|
|
12844
|
-
{ interruptTimeoutMs = TAKEOVER_STOP_TIMEOUT_MS, terminateTimeoutMs = 1000, killTimeoutMs = 1000 } = {},
|
|
12845
|
-
) {
|
|
12846
|
-
if (child.exitCode !== null || child.signalCode !== null) return true;
|
|
12847
|
-
sendSignal(child, 'SIGINT');
|
|
12848
|
-
if (await waitForExitOrTimeout(childExit, interruptTimeoutMs)) return true;
|
|
12849
|
-
sendSignalToProcessTree(child, 'SIGTERM');
|
|
12850
|
-
if (await waitForExitOrTimeout(childExit, terminateTimeoutMs)) return true;
|
|
12851
|
-
sendSignalToProcessTree(child, 'SIGKILL');
|
|
12852
|
-
if (await waitForExitOrTimeout(childExit, killTimeoutMs)) return true;
|
|
12853
|
-
return !isPidAlive(child.pid);
|
|
12854
|
-
}
|
|
12855
|
-
|
|
12856
12877
|
function waitMs(ms) {
|
|
12857
12878
|
return new Promise((resolve) => {
|
|
12858
12879
|
setTimeout(resolve, ms);
|
|
@@ -14845,7 +14866,7 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
|
|
|
14845
14866
|
/* harmony import */ var _vibelet_help_mjs__WEBPACK_IMPORTED_MODULE_16__ = __nccwpck_require__(4162);
|
|
14846
14867
|
/* harmony import */ var _vibelet_tailcat_config_mjs__WEBPACK_IMPORTED_MODULE_10__ = __nccwpck_require__(5798);
|
|
14847
14868
|
/* harmony import */ var _vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_12__ = __nccwpck_require__(4);
|
|
14848
|
-
/* harmony import */ var _terminal_wrapper_mjs__WEBPACK_IMPORTED_MODULE_11__ = __nccwpck_require__(
|
|
14869
|
+
/* harmony import */ var _terminal_wrapper_mjs__WEBPACK_IMPORTED_MODULE_11__ = __nccwpck_require__(2629);
|
|
14849
14870
|
/* harmony import */ var _vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_15__ = __nccwpck_require__(7721);
|
|
14850
14871
|
|
|
14851
14872
|
|
|
@@ -15706,9 +15727,7 @@ async function ensureDaemonForTerminalControl(backend) {
|
|
|
15706
15727
|
const healthyDaemon = await probeHealth(1_500);
|
|
15707
15728
|
const tokenReady = (0,node_fs__WEBPACK_IMPORTED_MODULE_1__.existsSync)(runtimeTerminalControlTokenPath);
|
|
15708
15729
|
const terminalControlReady = healthyDaemon && tokenReady && (0,_vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_12__/* .doesHealthSupportTerminalControl */ .iX)(healthyDaemon);
|
|
15709
|
-
if (terminalControlReady)
|
|
15710
|
-
return healthyDaemon;
|
|
15711
|
-
}
|
|
15730
|
+
if (terminalControlReady) return healthyDaemon;
|
|
15712
15731
|
|
|
15713
15732
|
if (healthyDaemon && !terminalControlReady) {
|
|
15714
15733
|
const activeSessions = typeof healthyDaemon.activeSessions === 'number' ? healthyDaemon.activeSessions : 0;
|
|
@@ -15744,7 +15763,7 @@ async function printPairingQr(pairingPayload) {
|
|
|
15744
15763
|
type: 'png',
|
|
15745
15764
|
errorCorrectionLevel: 'M',
|
|
15746
15765
|
margin: 1,
|
|
15747
|
-
scale:
|
|
15766
|
+
scale: 4,
|
|
15748
15767
|
});
|
|
15749
15768
|
const qr = await qrcode__WEBPACK_IMPORTED_MODULE_6__.toString(payload, {
|
|
15750
15769
|
type: 'terminal',
|