@zixt/host 0.0.127 → 0.0.129
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/index.js +23 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import { homedir as homedir4 } from "node:os";
|
|
|
28
28
|
// package.json
|
|
29
29
|
var package_default = {
|
|
30
30
|
name: "@zixt/host",
|
|
31
|
-
version: "0.0.
|
|
31
|
+
version: "0.0.129",
|
|
32
32
|
type: "module",
|
|
33
33
|
exports: {
|
|
34
34
|
".": "./src/client.ts",
|
|
@@ -25600,6 +25600,9 @@ function watchForUpdates(options) {
|
|
|
25600
25600
|
};
|
|
25601
25601
|
}
|
|
25602
25602
|
|
|
25603
|
+
// src/exit-codes.ts
|
|
25604
|
+
var DO_NOT_RESTART_EXIT_CODE = 64;
|
|
25605
|
+
|
|
25603
25606
|
// src/runners/process-tree.ts
|
|
25604
25607
|
import { spawn as spawn3 } from "node:child_process";
|
|
25605
25608
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
@@ -26629,8 +26632,9 @@ var CONTAINMENT_SUMMARY = {
|
|
|
26629
26632
|
probation_commit: "could not commit its probation evidence"
|
|
26630
26633
|
};
|
|
26631
26634
|
function describeWorkerExit(record2) {
|
|
26635
|
+
const controlledStop = record2.containment === null && record2.signal === null && record2.code === DO_NOT_RESTART_EXIT_CODE;
|
|
26632
26636
|
return {
|
|
26633
|
-
summary: record2.containment ? CONTAINMENT_SUMMARY[record2.containment] : record2.signal ? `was killed by ${record2.signal}` : `exited unexpectedly with code ${record2.code ?? "unknown"}`,
|
|
26637
|
+
summary: controlledStop ? "stopped because this Machine needed attention" : record2.containment ? CONTAINMENT_SUMMARY[record2.containment] : record2.signal ? `was killed by ${record2.signal}` : `exited unexpectedly with code ${record2.code ?? "unknown"}`,
|
|
26634
26638
|
context: {
|
|
26635
26639
|
...record2.version ? { version: record2.version } : {},
|
|
26636
26640
|
...record2.pid === null ? {} : { pid: record2.pid },
|
|
@@ -26640,7 +26644,8 @@ function describeWorkerExit(record2) {
|
|
|
26640
26644
|
heartbeats: record2.heartbeats,
|
|
26641
26645
|
readiness: record2.readinessMilestones,
|
|
26642
26646
|
...record2.msSinceHeartbeat === null ? {} : { sinceHeartbeat: `${record2.msSinceHeartbeat}ms` }
|
|
26643
|
-
}
|
|
26647
|
+
},
|
|
26648
|
+
replayNext: controlledStop ? "This was a controlled stop, not a crash. Review the earlier Host message if this Machine still needs attention" : "This Machine restarted itself; report it if the same exit repeats"
|
|
26644
26649
|
};
|
|
26645
26650
|
}
|
|
26646
26651
|
|
|
@@ -27852,7 +27857,6 @@ var SUPERVISOR_PROTOCOL_ENV = "ZIXT_HOST_SUPERVISOR_PROTOCOL";
|
|
|
27852
27857
|
var SUPERVISOR_VERSION_ENV = "ZIXT_HOST_SUPERVISOR_VERSION";
|
|
27853
27858
|
var SUPERVISOR_PROTOCOL = "2";
|
|
27854
27859
|
var SUPERVISOR_RELOAD_EXIT_CODE = 76;
|
|
27855
|
-
var DO_NOT_RESTART_EXIT_CODE = 64;
|
|
27856
27860
|
var RESTART_BACKOFF_MS = 2e3;
|
|
27857
27861
|
var MAX_RESTART_BACKOFF_MS = 6e4;
|
|
27858
27862
|
var CRASH_STREAK_RESET_MS = 6e4;
|
|
@@ -42638,6 +42642,7 @@ import { homedir as homedir12, userInfo as userInfo2 } from "node:os";
|
|
|
42638
42642
|
import { basename as basename5, dirname as dirname12, join as join23, relative as relative10, resolve as resolve14, sep as sep7 } from "node:path";
|
|
42639
42643
|
var LAUNCH_AGENT_LABEL = "ai.zixt.host";
|
|
42640
42644
|
var SERVICE_STABILITY_DELAY_MS2 = 2e3;
|
|
42645
|
+
var STATUS_WAIT_MS = 2e4;
|
|
42641
42646
|
var COMMAND_TIMEOUT_MS2 = 7e4;
|
|
42642
42647
|
var COMMAND_OUTPUT_LIMIT2 = 64 * 1024;
|
|
42643
42648
|
function oneLine2(value, name) {
|
|
@@ -42851,13 +42856,18 @@ async function installMacosService(options) {
|
|
|
42851
42856
|
const observe = async () => {
|
|
42852
42857
|
const result = await run3(launchctl, ["print", target]);
|
|
42853
42858
|
if (result.code !== 0) throw commandFailure2("Checking Zixt startup", result);
|
|
42854
|
-
|
|
42855
|
-
if (!status) throw new Error("Zixt started but did not reach a running process state.");
|
|
42856
|
-
return status;
|
|
42859
|
+
return parseLaunchdStatus(result.stdout);
|
|
42857
42860
|
};
|
|
42858
|
-
const
|
|
42861
|
+
const deadline = Date.now() + (options.statusWaitMs ?? STATUS_WAIT_MS);
|
|
42862
|
+
let first = await observe();
|
|
42863
|
+
while (!first && Date.now() < deadline) {
|
|
42864
|
+
await delay4(250);
|
|
42865
|
+
first = await observe();
|
|
42866
|
+
}
|
|
42867
|
+
if (!first) throw new Error("Zixt started but did not reach a running process state.");
|
|
42859
42868
|
await delay4(options.serviceStabilityDelayMs ?? SERVICE_STABILITY_DELAY_MS2);
|
|
42860
42869
|
const second = await observe();
|
|
42870
|
+
if (!second) throw new Error("Zixt started but did not reach a running process state.");
|
|
42861
42871
|
if (first.pid !== second.pid || first.runs !== second.runs) {
|
|
42862
42872
|
throw new Error("Zixt started but restarted during its readiness check.");
|
|
42863
42873
|
}
|
|
@@ -42881,7 +42891,7 @@ import { basename as basename6, dirname as dirname13, isAbsolute as isAbsolute18
|
|
|
42881
42891
|
var TASK_NAME = "Zixt Host";
|
|
42882
42892
|
var COMMAND_TIMEOUT_MS3 = 7e4;
|
|
42883
42893
|
var SERVICE_STABILITY_DELAY_MS3 = 2e3;
|
|
42884
|
-
var
|
|
42894
|
+
var STATUS_WAIT_MS2 = 2e4;
|
|
42885
42895
|
var SAFE_SID = /^S-1-(?:\d+-){1,14}\d+$/;
|
|
42886
42896
|
function oneLine3(value, name) {
|
|
42887
42897
|
if (!value || /[\0\r\n]/.test(value)) throw new Error(`${name} is not a valid one-line value`);
|
|
@@ -43217,7 +43227,7 @@ async function installWindowsService(options) {
|
|
|
43217
43227
|
if (create.code !== 0) throw commandFailure3("Installing Zixt at sign-in", create);
|
|
43218
43228
|
const start = await run3(schtasks, ["/Run", "/TN", TASK_NAME]);
|
|
43219
43229
|
if (start.code !== 0) throw commandFailure3("Starting Zixt", start);
|
|
43220
|
-
const deadline = Date.now() + (options.statusWaitMs ??
|
|
43230
|
+
const deadline = Date.now() + (options.statusWaitMs ?? STATUS_WAIT_MS2);
|
|
43221
43231
|
let first = null;
|
|
43222
43232
|
do {
|
|
43223
43233
|
first = await observe(statusPath, generation);
|
|
@@ -44584,12 +44594,12 @@ clientForConsole.current = client;
|
|
|
44584
44594
|
var diagnosticsRoot = configuredWorkerDiagnosticsRoot();
|
|
44585
44595
|
var reportedWorkerExits = diagnosticsRoot ? await readWorkerExits(diagnosticsRoot) : [];
|
|
44586
44596
|
for (const { record: record2 } of reportedWorkerExits) {
|
|
44587
|
-
const { summary, context } = describeWorkerExit(record2);
|
|
44597
|
+
const { summary, context, replayNext } = describeWorkerExit(record2);
|
|
44588
44598
|
replayConsoleLine("error", `The previous Zixt Host worker ${summary}`, {
|
|
44589
44599
|
machine,
|
|
44590
44600
|
at: record2.at,
|
|
44591
44601
|
...context,
|
|
44592
|
-
next:
|
|
44602
|
+
next: replayNext
|
|
44593
44603
|
});
|
|
44594
44604
|
for (const line of record2.stderr) replayConsoleLine("error", "Previous worker output", { line });
|
|
44595
44605
|
}
|
|
@@ -44626,7 +44636,7 @@ function shutdown(exitCode = 0) {
|
|
|
44626
44636
|
// the honoured code can differ from the verdict this stop was for.
|
|
44627
44637
|
...code === exitCode ? {} : { requested: exitCode },
|
|
44628
44638
|
activeTasks: activeSessions,
|
|
44629
|
-
next: "The Host restarts automatically; report this if it repeats"
|
|
44639
|
+
next: code === DO_NOT_RESTART_EXIT_CODE ? "Resolve the earlier Host message, then start the Host again" : "The Host restarts automatically; report this if it repeats"
|
|
44630
44640
|
}
|
|
44631
44641
|
);
|
|
44632
44642
|
}
|