@vibedeckx/darwin-arm64 0.3.54-win.2 → 0.3.54-win.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/dist/bin.js +45 -15
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -271187,7 +271187,7 @@ function judgeLiveness(status, pid, now3 = /* @__PURE__ */ new Date()) {
|
|
|
271187
271187
|
}
|
|
271188
271188
|
|
|
271189
271189
|
// src/connect-service.ts
|
|
271190
|
-
import { spawnSync as
|
|
271190
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
271191
271191
|
import { createHash as createHash14 } from "node:crypto";
|
|
271192
271192
|
import fs14 from "node:fs";
|
|
271193
271193
|
import os3 from "node:os";
|
|
@@ -271545,7 +271545,7 @@ function pruneRuntimeVersions(dataDir, keep) {
|
|
|
271545
271545
|
}
|
|
271546
271546
|
|
|
271547
271547
|
// src/connect-windows-supervise.ts
|
|
271548
|
-
import { spawn as spawn8 } from "node:child_process";
|
|
271548
|
+
import { spawn as spawn8, spawnSync as spawnSync2 } from "node:child_process";
|
|
271549
271549
|
import { createHash as createHash13 } from "node:crypto";
|
|
271550
271550
|
import fs13 from "node:fs";
|
|
271551
271551
|
import net2 from "node:net";
|
|
@@ -271569,20 +271569,38 @@ function stopMarkerPath(dataDir) {
|
|
|
271569
271569
|
function currentBootTimeMs(now3 = Date.now(), uptimeSeconds = os2.uptime()) {
|
|
271570
271570
|
return now3 - uptimeSeconds * 1e3;
|
|
271571
271571
|
}
|
|
271572
|
-
function
|
|
271573
|
-
|
|
271572
|
+
function parseLogonId(whoamiOutput) {
|
|
271573
|
+
return /S-1-5-5-\d+-\d+/.exec(whoamiOutput)?.[0];
|
|
271574
|
+
}
|
|
271575
|
+
var cachedLogonId;
|
|
271576
|
+
function currentLogonId() {
|
|
271577
|
+
if (process.platform !== "win32") return void 0;
|
|
271578
|
+
if (cachedLogonId) return cachedLogonId;
|
|
271579
|
+
const result = spawnSync2("whoami", ["/logonid"], { encoding: "utf8", windowsHide: true, timeout: 15e3 });
|
|
271580
|
+
cachedLogonId = result.status === 0 ? parseLogonId(result.stdout ?? "") : void 0;
|
|
271581
|
+
return cachedLogonId;
|
|
271582
|
+
}
|
|
271583
|
+
function currentStopScope() {
|
|
271584
|
+
return { bootTimeMs: currentBootTimeMs(), logonId: currentLogonId() };
|
|
271585
|
+
}
|
|
271586
|
+
function writeStopMarker(dataDir, scope = currentStopScope()) {
|
|
271587
|
+
writeFileAtomic(stopMarkerPath(dataDir), `${JSON.stringify(scope)}
|
|
271574
271588
|
`);
|
|
271575
271589
|
}
|
|
271576
271590
|
function clearStopMarker(dataDir) {
|
|
271577
271591
|
fs13.rmSync(stopMarkerPath(dataDir), { force: true });
|
|
271578
271592
|
}
|
|
271579
|
-
function
|
|
271593
|
+
function stopMarkerActive(dataDir, scope = currentStopScope()) {
|
|
271594
|
+
let marker25;
|
|
271580
271595
|
try {
|
|
271581
|
-
|
|
271582
|
-
return typeof parsed.bootTimeMs === "number" && Math.abs(parsed.bootTimeMs - bootTimeMs) < BOOT_TOLERANCE_MS;
|
|
271596
|
+
marker25 = JSON.parse(fs13.readFileSync(stopMarkerPath(dataDir), "utf8"));
|
|
271583
271597
|
} catch {
|
|
271584
271598
|
return false;
|
|
271585
271599
|
}
|
|
271600
|
+
if (typeof marker25.bootTimeMs !== "number" || Math.abs(marker25.bootTimeMs - scope.bootTimeMs) >= BOOT_TOLERANCE_MS) {
|
|
271601
|
+
return false;
|
|
271602
|
+
}
|
|
271603
|
+
return !marker25.logonId || !scope.logonId || marker25.logonId === scope.logonId;
|
|
271586
271604
|
}
|
|
271587
271605
|
function sendSuperviseCommand(dataDir, command, timeoutMs = 3e4) {
|
|
271588
271606
|
return new Promise((resolve3, reject) => {
|
|
@@ -271646,8 +271664,8 @@ async function runSupervise(options) {
|
|
|
271646
271664
|
fs13.writeSync(logFd, `${(/* @__PURE__ */ new Date()).toISOString()} [${process.pid}] ${message}
|
|
271647
271665
|
`);
|
|
271648
271666
|
};
|
|
271649
|
-
if (
|
|
271650
|
-
log("stopped by `connect stop`
|
|
271667
|
+
if (stopMarkerActive(dataDir)) {
|
|
271668
|
+
log("stopped by `connect stop` in this logon session; not starting the worker");
|
|
271651
271669
|
return 0;
|
|
271652
271670
|
}
|
|
271653
271671
|
const server = net2.createServer();
|
|
@@ -271737,8 +271755,10 @@ async function runSupervise(options) {
|
|
|
271737
271755
|
const command = buffer.slice(0, newline).trim();
|
|
271738
271756
|
buffer = "";
|
|
271739
271757
|
if (command === "ping") {
|
|
271740
|
-
socket.end(
|
|
271741
|
-
|
|
271758
|
+
socket.end(
|
|
271759
|
+
`${JSON.stringify({ pid: process.pid, workerPid: worker?.pid ?? null, logonId: currentLogonId() ?? null })}
|
|
271760
|
+
`
|
|
271761
|
+
);
|
|
271742
271762
|
return;
|
|
271743
271763
|
}
|
|
271744
271764
|
if (command === "quit") {
|
|
@@ -271767,7 +271787,7 @@ async function runSupervise(options) {
|
|
|
271767
271787
|
|
|
271768
271788
|
// src/connect-service.ts
|
|
271769
271789
|
var defaultExec = (command, args) => {
|
|
271770
|
-
const result =
|
|
271790
|
+
const result = spawnSync3(command, args, { encoding: "utf8", windowsHide: true });
|
|
271771
271791
|
if (result.error) {
|
|
271772
271792
|
return { status: null, stdout: "", stderr: result.error.message };
|
|
271773
271793
|
}
|
|
@@ -272296,9 +272316,19 @@ var TaskSchedulerAdapter = class {
|
|
|
272296
272316
|
`${this.name} was started but its supervisor did not come up; see logs\\supervise.log in ${this.dataDir}`
|
|
272297
272317
|
);
|
|
272298
272318
|
}
|
|
272299
|
-
/**
|
|
272319
|
+
/**
|
|
272320
|
+
* Stopped until the next login or boot (the marker) or `start`; auto-start
|
|
272321
|
+
* is kept. The marker names the supervisor's logon session, which need not
|
|
272322
|
+
* be ours (e.g. `connect stop` over SSH).
|
|
272323
|
+
*/
|
|
272300
272324
|
async stop() {
|
|
272301
|
-
|
|
272325
|
+
const scope = currentStopScope();
|
|
272326
|
+
try {
|
|
272327
|
+
const reply = JSON.parse(await this.client(this.dataDir, "ping") ?? "{}");
|
|
272328
|
+
if (typeof reply.logonId === "string") scope.logonId = reply.logonId;
|
|
272329
|
+
} catch {
|
|
272330
|
+
}
|
|
272331
|
+
writeStopMarker(this.dataDir, scope);
|
|
272302
272332
|
await this.quit();
|
|
272303
272333
|
}
|
|
272304
272334
|
/** Restarts the supervisor too, so it picks up a new runtime. */
|
|
@@ -272703,7 +272733,7 @@ async function lifecycleStop(options) {
|
|
|
272703
272733
|
if (adapter) {
|
|
272704
272734
|
return runServiceAction(
|
|
272705
272735
|
() => adapter.stop(),
|
|
272706
|
-
`Stopped ${adapter.name}. It starts again at the next
|
|
272736
|
+
`Stopped ${adapter.name}. It starts again at the next boot/login; use \`vibedeckx connect disable\` to keep it off.`
|
|
272707
272737
|
);
|
|
272708
272738
|
}
|
|
272709
272739
|
return stopConnectDaemon(options.dataDir);
|