@zixt/host 0.0.118 → 0.0.119
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 +71 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import { homedir as homedir3 } 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.119",
|
|
32
32
|
type: "module",
|
|
33
33
|
exports: {
|
|
34
34
|
".": "./src/client.ts",
|
|
@@ -27860,7 +27860,13 @@ process.stdin.on('data', (chunk) => {
|
|
|
27860
27860
|
const target = spawn(config.commandLine, {
|
|
27861
27861
|
cwd: config.cwd,
|
|
27862
27862
|
env: process.env,
|
|
27863
|
-
|
|
27863
|
+
// Never share this guardian's stdin with npm. The guardian keeps an
|
|
27864
|
+
// active read pending on that pipe (the config protocol above), and a
|
|
27865
|
+
// Windows child whose inherited stdin pipe has a concurrent reader wedges
|
|
27866
|
+
// inside Node startup until the reader dies - npm sat at zero CPU for the
|
|
27867
|
+
// whole install timeout on a real Machine (live, 2026-08-18). An
|
|
27868
|
+
// unattended install may never depend on stdin anyway.
|
|
27869
|
+
stdio: ['ignore', 'inherit', 'inherit'],
|
|
27864
27870
|
windowsHide: true,
|
|
27865
27871
|
// cmd.exe has to resolve npm.cmd, so the shell stays - but the whole line
|
|
27866
27872
|
// arrives pre-quoted as one string. Node's (command, args, shell) shape is
|
|
@@ -27924,7 +27930,10 @@ async function installRelease(version2, options = {}) {
|
|
|
27924
27930
|
});
|
|
27925
27931
|
}
|
|
27926
27932
|
return spawn5(installerCommand, installerArgs, {
|
|
27927
|
-
|
|
27933
|
+
// stdin stays closed for the same reason as the Windows guardian
|
|
27934
|
+
// above: this worker actively reads its own stdin (the supervisor's
|
|
27935
|
+
// stop pipe), and an unattended npm must not share or depend on it.
|
|
27936
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
27928
27937
|
env: sanitizedInstallerEnv(process.env),
|
|
27929
27938
|
detached: true
|
|
27930
27939
|
});
|
|
@@ -28330,6 +28339,8 @@ async function runWorkerCompatibilityProxy(env = process.env, argv = process.arg
|
|
|
28330
28339
|
delete workerEnv[WORKER_OWNERSHIP_FILE_ENV];
|
|
28331
28340
|
delete workerEnv[LAUNCHER_OWNERSHIP_DIR_ENV];
|
|
28332
28341
|
delete workerEnv[SUPERVISOR_OWNERSHIP_FILE_ENV];
|
|
28342
|
+
delete workerEnv[WINDOWS_CONTAINMENT_GATE_ENV];
|
|
28343
|
+
delete workerEnv[WINDOWS_POST_CONTAINMENT_CWD_ENV];
|
|
28333
28344
|
const child = spawn5(process.execPath, [target, ...ownership.argv], {
|
|
28334
28345
|
stdio: ["pipe", "inherit", "inherit"],
|
|
28335
28346
|
env: workerEnv,
|
|
@@ -30134,7 +30145,10 @@ async function installChromium() {
|
|
|
30134
30145
|
const child = spawn6(process.execPath, [cliPath, "install", "chromium"], {
|
|
30135
30146
|
env: process.env,
|
|
30136
30147
|
stdio: ["ignore", "inherit", "inherit"],
|
|
30137
|
-
|
|
30148
|
+
// A service-managed Host has no console; letting Windows allocate one
|
|
30149
|
+
// here would flash a visible window on the signed-in desktop for the
|
|
30150
|
+
// whole download. Progress still flows through the inherited pipes.
|
|
30151
|
+
windowsHide: true
|
|
30138
30152
|
});
|
|
30139
30153
|
let settled = false;
|
|
30140
30154
|
const finish = (error52) => {
|
|
@@ -42168,7 +42182,7 @@ async function installLinuxService(options) {
|
|
|
42168
42182
|
const unitRoot = options.userUnitRoot ?? join19(xdgConfigHome, "systemd", "user");
|
|
42169
42183
|
const environmentPath = join19(configRoot, "host.env");
|
|
42170
42184
|
const unitPath = join19(unitRoot, SERVICE_NAME);
|
|
42171
|
-
const installVersion = options.installVersion ?? installRelease;
|
|
42185
|
+
const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
|
|
42172
42186
|
const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : activateInstalledRelease);
|
|
42173
42187
|
const resolveCommand = options.resolveCommand ?? defaultResolveCommand;
|
|
42174
42188
|
const run3 = options.runCommand ?? defaultRunCommand;
|
|
@@ -42183,9 +42197,15 @@ async function installLinuxService(options) {
|
|
|
42183
42197
|
"This Linux computer does not have the systemd tools Zixt needs to start itself."
|
|
42184
42198
|
);
|
|
42185
42199
|
}
|
|
42186
|
-
const
|
|
42200
|
+
const attempt = { failure: null };
|
|
42201
|
+
const releaseEntry = await installVersion(options.hostVersion, (failure2) => {
|
|
42202
|
+
attempt.failure = failure2;
|
|
42203
|
+
});
|
|
42187
42204
|
if (!releaseEntry) {
|
|
42188
|
-
|
|
42205
|
+
const failed = attempt.failure;
|
|
42206
|
+
throw new Error(
|
|
42207
|
+
`Zixt Host ${options.hostVersion} could not be installed for automatic start${failed ? ` (${failed.reason}: ${failed.detail})` : ""}.`
|
|
42208
|
+
);
|
|
42189
42209
|
}
|
|
42190
42210
|
const currentEntry = await activateVersion(releaseEntry);
|
|
42191
42211
|
const linger = async () => {
|
|
@@ -42209,6 +42229,9 @@ async function installLinuxService(options) {
|
|
|
42209
42229
|
...env.ZIXT_HOST_UPDATE ? [`ZIXT_HOST_UPDATE=${systemdEnvironmentValue(env.ZIXT_HOST_UPDATE)}`] : [],
|
|
42210
42230
|
...env.ZIXT_HOST_UPDATE_URL ? [`ZIXT_HOST_UPDATE_URL=${systemdEnvironmentValue(env.ZIXT_HOST_UPDATE_URL)}`] : [],
|
|
42211
42231
|
...env.ZIXT_HOST_VERSIONS_DIR ? [`ZIXT_HOST_VERSIONS_DIR=${systemdEnvironmentValue(env.ZIXT_HOST_VERSIONS_DIR)}`] : [],
|
|
42232
|
+
// A Machine on a private registry mirror checks ZIXT_HOST_UPDATE_URL for
|
|
42233
|
+
// releases; its unattended npm installs must follow the same mirror.
|
|
42234
|
+
...env.NPM_CONFIG_REGISTRY ? [`NPM_CONFIG_REGISTRY=${systemdEnvironmentValue(env.NPM_CONFIG_REGISTRY)}`] : [],
|
|
42212
42235
|
""
|
|
42213
42236
|
].join("\n");
|
|
42214
42237
|
await replacePrivateFile(environmentPath, serviceEnvironment, 384, syncDirectory8);
|
|
@@ -42431,7 +42454,7 @@ async function installMacosService(options) {
|
|
|
42431
42454
|
const plistPath = join20(launchAgentsRoot, `${LAUNCH_AGENT_LABEL}.plist`);
|
|
42432
42455
|
const stdoutPath = join20(logRoot, "host.log");
|
|
42433
42456
|
const stderrPath = join20(logRoot, "host-error.log");
|
|
42434
|
-
const installVersion = options.installVersion ?? installRelease;
|
|
42457
|
+
const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
|
|
42435
42458
|
const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : (entry) => activateInstalledRelease(entry));
|
|
42436
42459
|
const resolveCommand = options.resolveCommand ?? (async () => defaultResolveCommand2());
|
|
42437
42460
|
const run3 = options.runCommand ?? ((command, args) => defaultRunCommand2(command, args, env));
|
|
@@ -42439,9 +42462,15 @@ async function installMacosService(options) {
|
|
|
42439
42462
|
const delay4 = options.delay ?? ((ms) => new Promise((done) => setTimeout(done, ms)));
|
|
42440
42463
|
const launchctl = await resolveCommand("launchctl");
|
|
42441
42464
|
if (!launchctl) throw new Error("macOS launchctl could not be found.");
|
|
42442
|
-
const
|
|
42465
|
+
const attempt = { failure: null };
|
|
42466
|
+
const releaseEntry = await installVersion(options.hostVersion, (failure2) => {
|
|
42467
|
+
attempt.failure = failure2;
|
|
42468
|
+
});
|
|
42443
42469
|
if (!releaseEntry) {
|
|
42444
|
-
|
|
42470
|
+
const failed = attempt.failure;
|
|
42471
|
+
throw new Error(
|
|
42472
|
+
`Zixt Host ${options.hostVersion} could not be installed for automatic start${failed ? ` (${failed.reason}: ${failed.detail})` : ""}.`
|
|
42473
|
+
);
|
|
42445
42474
|
}
|
|
42446
42475
|
const currentEntry = await activateVersion(releaseEntry);
|
|
42447
42476
|
await ensureDirectory2(configRoot, sync);
|
|
@@ -42456,6 +42485,9 @@ async function installMacosService(options) {
|
|
|
42456
42485
|
...env.ZIXT_HOST_UPDATE ? [`ZIXT_HOST_UPDATE=${shellValue(env.ZIXT_HOST_UPDATE)}`] : [],
|
|
42457
42486
|
...env.ZIXT_HOST_UPDATE_URL ? [`ZIXT_HOST_UPDATE_URL=${shellValue(env.ZIXT_HOST_UPDATE_URL)}`] : [],
|
|
42458
42487
|
...env.ZIXT_HOST_VERSIONS_DIR ? [`ZIXT_HOST_VERSIONS_DIR=${shellValue(env.ZIXT_HOST_VERSIONS_DIR)}`] : [],
|
|
42488
|
+
// A Machine on a private registry mirror checks ZIXT_HOST_UPDATE_URL for
|
|
42489
|
+
// releases; its unattended npm installs must follow the same mirror.
|
|
42490
|
+
...env.NPM_CONFIG_REGISTRY ? [`NPM_CONFIG_REGISTRY=${shellValue(env.NPM_CONFIG_REGISTRY)}`] : [],
|
|
42459
42491
|
""
|
|
42460
42492
|
].join("\n");
|
|
42461
42493
|
await replacePrivateFile2(configPath, serviceEnvironment, 384, sync);
|
|
@@ -42556,13 +42588,13 @@ async function ensureDirectory3(path, sync) {
|
|
|
42556
42588
|
current = join21(current, part);
|
|
42557
42589
|
}
|
|
42558
42590
|
}
|
|
42559
|
-
async function replacePrivateFile3(path, contents, sync) {
|
|
42591
|
+
async function replacePrivateFile3(path, contents, sync, encoding = "utf8") {
|
|
42560
42592
|
const parent = dirname12(path);
|
|
42561
42593
|
await ensureDirectory3(parent, sync);
|
|
42562
42594
|
const temporary = join21(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
42563
42595
|
const handle = await open9(temporary, "wx", 384);
|
|
42564
42596
|
try {
|
|
42565
|
-
await handle.writeFile(contents,
|
|
42597
|
+
await handle.writeFile(encoding === "utf16le" ? `\uFEFF${contents}` : contents, encoding);
|
|
42566
42598
|
await handle.sync();
|
|
42567
42599
|
await handle.close();
|
|
42568
42600
|
await rename8(temporary, path);
|
|
@@ -42666,6 +42698,7 @@ try {
|
|
|
42666
42698
|
if ($config.update) { $env:ZIXT_HOST_UPDATE = $config.update }
|
|
42667
42699
|
if ($config.updateUrl) { $env:ZIXT_HOST_UPDATE_URL = $config.updateUrl }
|
|
42668
42700
|
if ($config.versionsRoot) { $env:ZIXT_HOST_VERSIONS_DIR = $config.versionsRoot }
|
|
42701
|
+
if ($config.npmRegistry) { $env:NPM_CONFIG_REGISTRY = $config.npmRegistry }
|
|
42669
42702
|
Set-Location -LiteralPath $config.cwd
|
|
42670
42703
|
|
|
42671
42704
|
# Task Scheduler does not provide a durable stdin lifetime boundary. Give
|
|
@@ -42714,7 +42747,7 @@ async function defaultObserveStatus(path, generation) {
|
|
|
42714
42747
|
}
|
|
42715
42748
|
}
|
|
42716
42749
|
function taskXml(input) {
|
|
42717
|
-
return `<?xml version="1.0" encoding="UTF-
|
|
42750
|
+
return `<?xml version="1.0" encoding="UTF-16"?>
|
|
42718
42751
|
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
42719
42752
|
<Triggers><LogonTrigger><Enabled>true</Enabled><UserId>${xml2(input.sid)}</UserId></LogonTrigger></Triggers>
|
|
42720
42753
|
<Principals><Principal id="ZixtUser"><UserId>${xml2(input.sid)}</UserId><LogonType>InteractiveToken</LogonType><RunLevel>LeastPrivilege</RunLevel></Principal></Principals>
|
|
@@ -42756,7 +42789,7 @@ async function installWindowsService(options) {
|
|
|
42756
42789
|
const launcherPath = join21(configRoot, "host-launcher.ps1");
|
|
42757
42790
|
const taskXmlPath = join21(configRoot, "host-task.xml");
|
|
42758
42791
|
const statusPath = join21(configRoot, "host-status.json");
|
|
42759
|
-
const installVersion = options.installVersion ?? installRelease;
|
|
42792
|
+
const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
|
|
42760
42793
|
const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : (entry) => activateInstalledRelease(entry));
|
|
42761
42794
|
const resolveCommand = options.resolveCommand ?? ((name) => defaultResolveCommand3(name, env));
|
|
42762
42795
|
const run3 = options.runCommand ?? ((command, args) => runChild(command, args, env));
|
|
@@ -42773,9 +42806,15 @@ async function installWindowsService(options) {
|
|
|
42773
42806
|
}
|
|
42774
42807
|
const sid = options.sid ?? await defaultCurrentSid(powershell, env);
|
|
42775
42808
|
if (!sid || !SAFE_SID.test(sid)) throw new Error("Windows user identity could not be confirmed.");
|
|
42776
|
-
const
|
|
42809
|
+
const attempt = { failure: null };
|
|
42810
|
+
const releaseEntry = await installVersion(options.hostVersion, (failure2) => {
|
|
42811
|
+
attempt.failure = failure2;
|
|
42812
|
+
});
|
|
42777
42813
|
if (!releaseEntry) {
|
|
42778
|
-
|
|
42814
|
+
const failed = attempt.failure;
|
|
42815
|
+
throw new Error(
|
|
42816
|
+
`Zixt Host ${options.hostVersion} could not be installed for automatic start${failed ? ` (${failed.reason}: ${failed.detail})` : ""}.`
|
|
42817
|
+
);
|
|
42779
42818
|
}
|
|
42780
42819
|
const currentEntry = await activateVersion(releaseEntry);
|
|
42781
42820
|
const protectedToken = await (options.protectToken ?? ((value, shell) => defaultProtectToken(value, shell, env)))(token2, powershell);
|
|
@@ -42797,13 +42836,21 @@ async function installWindowsService(options) {
|
|
|
42797
42836
|
path,
|
|
42798
42837
|
...env.ZIXT_HOST_UPDATE ? { update: env.ZIXT_HOST_UPDATE } : {},
|
|
42799
42838
|
...env.ZIXT_HOST_UPDATE_URL ? { updateUrl: env.ZIXT_HOST_UPDATE_URL } : {},
|
|
42800
|
-
...env.ZIXT_HOST_VERSIONS_DIR ? { versionsRoot: env.ZIXT_HOST_VERSIONS_DIR } : {}
|
|
42839
|
+
...env.ZIXT_HOST_VERSIONS_DIR ? { versionsRoot: env.ZIXT_HOST_VERSIONS_DIR } : {},
|
|
42840
|
+
// A Machine on a private registry mirror checks updateUrl for releases;
|
|
42841
|
+
// its unattended npm installs must follow the same mirror.
|
|
42842
|
+
...env.NPM_CONFIG_REGISTRY ? { npmRegistry: env.NPM_CONFIG_REGISTRY } : {}
|
|
42801
42843
|
})}
|
|
42802
42844
|
`,
|
|
42803
42845
|
sync
|
|
42804
42846
|
);
|
|
42805
42847
|
await replacePrivateFile3(launcherPath, launcherSource2(configPath, statusPath), sync);
|
|
42806
|
-
await replacePrivateFile3(
|
|
42848
|
+
await replacePrivateFile3(
|
|
42849
|
+
taskXmlPath,
|
|
42850
|
+
taskXml({ sid, powershell, launcherPath, home }),
|
|
42851
|
+
sync,
|
|
42852
|
+
"utf16le"
|
|
42853
|
+
);
|
|
42807
42854
|
await rm11(statusPath, { force: true });
|
|
42808
42855
|
const acl = await run3(icacls, [
|
|
42809
42856
|
configRoot,
|
|
@@ -43330,6 +43377,9 @@ function parseHostCliOptions(argv) {
|
|
|
43330
43377
|
}
|
|
43331
43378
|
return options;
|
|
43332
43379
|
}
|
|
43380
|
+
function isServiceSetupInvocation(argv) {
|
|
43381
|
+
return argv.includes("--install-service");
|
|
43382
|
+
}
|
|
43333
43383
|
function forcedColor(mode) {
|
|
43334
43384
|
if (mode === "always") return true;
|
|
43335
43385
|
if (mode === "never") return false;
|
|
@@ -43412,7 +43462,9 @@ if (packagedBuild) {
|
|
|
43412
43462
|
if (isWorkerProxyRole()) process.exit(managedExit(await runWorkerCompatibilityProxy()));
|
|
43413
43463
|
if (needsLegacySupervisorHandoff()) process.exit(managedExit(await launchHostSupervisor()));
|
|
43414
43464
|
if (isSupervisorRole()) process.exit(managedExit(await superviseHost()));
|
|
43415
|
-
if (!isWorkerRole()
|
|
43465
|
+
if (!isWorkerRole() && !isServiceSetupInvocation(process.argv.slice(2))) {
|
|
43466
|
+
process.exit(managedExit(await launchHostSupervisor()));
|
|
43467
|
+
}
|
|
43416
43468
|
}
|
|
43417
43469
|
var workerWatchdog = startWorkerWatchdogHeartbeat();
|
|
43418
43470
|
if (packagedBuild && isWorkerRole() && process.env[WORKER_WATCHDOG_NONCE_ENV] !== void 0 && !workerWatchdog.active) {
|