@zixt/host 0.0.117 → 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.
Files changed (2) hide show
  1. package/dist/index.js +83 -21
  2. 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.117",
31
+ version: "0.0.119",
32
32
  type: "module",
33
33
  exports: {
34
34
  ".": "./src/client.ts",
@@ -21977,12 +21977,21 @@ var SetupGuideOnboardingState = external_exports.object({
21977
21977
  integrationCount: external_exports.number().int().min(0).max(1e5),
21978
21978
  completedTaskCount: external_exports.number().int().min(0).max(1e5)
21979
21979
  });
21980
+ var SetupGuideToolResult = external_exports.object({
21981
+ actionId: external_exports.string().regex(/^[a-z][a-z0-9_.-]{0,79}$/),
21982
+ label: external_exports.string().trim().min(1).max(100),
21983
+ parameters: external_exports.array(SetupGuideActionParameter).max(12),
21984
+ status: external_exports.enum(["success", "error"]),
21985
+ result: external_exports.string().trim().min(1).max(4e3),
21986
+ page: SetupGuidePageContext
21987
+ });
21980
21988
  var SetupGuideReplyRequest = external_exports.object({
21981
21989
  message: GuideText,
21982
21990
  history: external_exports.array(SetupGuideHistoryMessage).max(12).default([]),
21983
21991
  page: SetupGuidePageContext,
21984
21992
  onboarding: SetupGuideOnboardingState,
21985
- actions: external_exports.array(SetupGuideAvailableAction).max(64)
21993
+ actions: external_exports.array(SetupGuideAvailableAction).max(128),
21994
+ toolResults: external_exports.array(SetupGuideToolResult).max(8).default([])
21986
21995
  });
21987
21996
  var SetupGuideProposedAction = external_exports.object({
21988
21997
  actionId: external_exports.string().regex(/^[a-z][a-z0-9_.-]{0,79}$/),
@@ -21995,7 +22004,8 @@ var SetupGuideProposedAction = external_exports.object({
21995
22004
  });
21996
22005
  var SetupGuideReplyResponse = external_exports.object({
21997
22006
  message: GuideText,
21998
- proposedActions: external_exports.array(SetupGuideProposedAction).max(4)
22007
+ /** One tool at a time keeps UI execution and its result causally ordered. */
22008
+ proposedActions: external_exports.array(SetupGuideProposedAction).max(1)
21999
22009
  });
22000
22010
  var SetupGuideTranscriptionRequest = external_exports.object({
22001
22011
  mediaType: external_exports.enum(["audio/webm", "audio/mp4", "audio/ogg"]),
@@ -27850,7 +27860,13 @@ process.stdin.on('data', (chunk) => {
27850
27860
  const target = spawn(config.commandLine, {
27851
27861
  cwd: config.cwd,
27852
27862
  env: process.env,
27853
- stdio: 'inherit',
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'],
27854
27870
  windowsHide: true,
27855
27871
  // cmd.exe has to resolve npm.cmd, so the shell stays - but the whole line
27856
27872
  // arrives pre-quoted as one string. Node's (command, args, shell) shape is
@@ -27914,7 +27930,10 @@ async function installRelease(version2, options = {}) {
27914
27930
  });
27915
27931
  }
27916
27932
  return spawn5(installerCommand, installerArgs, {
27917
- stdio: "inherit",
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"],
27918
27937
  env: sanitizedInstallerEnv(process.env),
27919
27938
  detached: true
27920
27939
  });
@@ -28320,6 +28339,8 @@ async function runWorkerCompatibilityProxy(env = process.env, argv = process.arg
28320
28339
  delete workerEnv[WORKER_OWNERSHIP_FILE_ENV];
28321
28340
  delete workerEnv[LAUNCHER_OWNERSHIP_DIR_ENV];
28322
28341
  delete workerEnv[SUPERVISOR_OWNERSHIP_FILE_ENV];
28342
+ delete workerEnv[WINDOWS_CONTAINMENT_GATE_ENV];
28343
+ delete workerEnv[WINDOWS_POST_CONTAINMENT_CWD_ENV];
28323
28344
  const child = spawn5(process.execPath, [target, ...ownership.argv], {
28324
28345
  stdio: ["pipe", "inherit", "inherit"],
28325
28346
  env: workerEnv,
@@ -30124,7 +30145,10 @@ async function installChromium() {
30124
30145
  const child = spawn6(process.execPath, [cliPath, "install", "chromium"], {
30125
30146
  env: process.env,
30126
30147
  stdio: ["ignore", "inherit", "inherit"],
30127
- windowsHide: false
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
30128
30152
  });
30129
30153
  let settled = false;
30130
30154
  const finish = (error52) => {
@@ -42158,7 +42182,7 @@ async function installLinuxService(options) {
42158
42182
  const unitRoot = options.userUnitRoot ?? join19(xdgConfigHome, "systemd", "user");
42159
42183
  const environmentPath = join19(configRoot, "host.env");
42160
42184
  const unitPath = join19(unitRoot, SERVICE_NAME);
42161
- const installVersion = options.installVersion ?? installRelease;
42185
+ const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
42162
42186
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : activateInstalledRelease);
42163
42187
  const resolveCommand = options.resolveCommand ?? defaultResolveCommand;
42164
42188
  const run3 = options.runCommand ?? defaultRunCommand;
@@ -42173,9 +42197,15 @@ async function installLinuxService(options) {
42173
42197
  "This Linux computer does not have the systemd tools Zixt needs to start itself."
42174
42198
  );
42175
42199
  }
42176
- const releaseEntry = await installVersion(options.hostVersion);
42200
+ const attempt = { failure: null };
42201
+ const releaseEntry = await installVersion(options.hostVersion, (failure2) => {
42202
+ attempt.failure = failure2;
42203
+ });
42177
42204
  if (!releaseEntry) {
42178
- throw new Error(`Zixt Host ${options.hostVersion} could not be installed for automatic start.`);
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
+ );
42179
42209
  }
42180
42210
  const currentEntry = await activateVersion(releaseEntry);
42181
42211
  const linger = async () => {
@@ -42199,6 +42229,9 @@ async function installLinuxService(options) {
42199
42229
  ...env.ZIXT_HOST_UPDATE ? [`ZIXT_HOST_UPDATE=${systemdEnvironmentValue(env.ZIXT_HOST_UPDATE)}`] : [],
42200
42230
  ...env.ZIXT_HOST_UPDATE_URL ? [`ZIXT_HOST_UPDATE_URL=${systemdEnvironmentValue(env.ZIXT_HOST_UPDATE_URL)}`] : [],
42201
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)}`] : [],
42202
42235
  ""
42203
42236
  ].join("\n");
42204
42237
  await replacePrivateFile(environmentPath, serviceEnvironment, 384, syncDirectory8);
@@ -42421,7 +42454,7 @@ async function installMacosService(options) {
42421
42454
  const plistPath = join20(launchAgentsRoot, `${LAUNCH_AGENT_LABEL}.plist`);
42422
42455
  const stdoutPath = join20(logRoot, "host.log");
42423
42456
  const stderrPath = join20(logRoot, "host-error.log");
42424
- const installVersion = options.installVersion ?? installRelease;
42457
+ const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
42425
42458
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : (entry) => activateInstalledRelease(entry));
42426
42459
  const resolveCommand = options.resolveCommand ?? (async () => defaultResolveCommand2());
42427
42460
  const run3 = options.runCommand ?? ((command, args) => defaultRunCommand2(command, args, env));
@@ -42429,9 +42462,15 @@ async function installMacosService(options) {
42429
42462
  const delay4 = options.delay ?? ((ms) => new Promise((done) => setTimeout(done, ms)));
42430
42463
  const launchctl = await resolveCommand("launchctl");
42431
42464
  if (!launchctl) throw new Error("macOS launchctl could not be found.");
42432
- const releaseEntry = await installVersion(options.hostVersion);
42465
+ const attempt = { failure: null };
42466
+ const releaseEntry = await installVersion(options.hostVersion, (failure2) => {
42467
+ attempt.failure = failure2;
42468
+ });
42433
42469
  if (!releaseEntry) {
42434
- throw new Error(`Zixt Host ${options.hostVersion} could not be installed for automatic start.`);
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
+ );
42435
42474
  }
42436
42475
  const currentEntry = await activateVersion(releaseEntry);
42437
42476
  await ensureDirectory2(configRoot, sync);
@@ -42446,6 +42485,9 @@ async function installMacosService(options) {
42446
42485
  ...env.ZIXT_HOST_UPDATE ? [`ZIXT_HOST_UPDATE=${shellValue(env.ZIXT_HOST_UPDATE)}`] : [],
42447
42486
  ...env.ZIXT_HOST_UPDATE_URL ? [`ZIXT_HOST_UPDATE_URL=${shellValue(env.ZIXT_HOST_UPDATE_URL)}`] : [],
42448
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)}`] : [],
42449
42491
  ""
42450
42492
  ].join("\n");
42451
42493
  await replacePrivateFile2(configPath, serviceEnvironment, 384, sync);
@@ -42546,13 +42588,13 @@ async function ensureDirectory3(path, sync) {
42546
42588
  current = join21(current, part);
42547
42589
  }
42548
42590
  }
42549
- async function replacePrivateFile3(path, contents, sync) {
42591
+ async function replacePrivateFile3(path, contents, sync, encoding = "utf8") {
42550
42592
  const parent = dirname12(path);
42551
42593
  await ensureDirectory3(parent, sync);
42552
42594
  const temporary = join21(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
42553
42595
  const handle = await open9(temporary, "wx", 384);
42554
42596
  try {
42555
- await handle.writeFile(contents, "utf8");
42597
+ await handle.writeFile(encoding === "utf16le" ? `\uFEFF${contents}` : contents, encoding);
42556
42598
  await handle.sync();
42557
42599
  await handle.close();
42558
42600
  await rename8(temporary, path);
@@ -42656,6 +42698,7 @@ try {
42656
42698
  if ($config.update) { $env:ZIXT_HOST_UPDATE = $config.update }
42657
42699
  if ($config.updateUrl) { $env:ZIXT_HOST_UPDATE_URL = $config.updateUrl }
42658
42700
  if ($config.versionsRoot) { $env:ZIXT_HOST_VERSIONS_DIR = $config.versionsRoot }
42701
+ if ($config.npmRegistry) { $env:NPM_CONFIG_REGISTRY = $config.npmRegistry }
42659
42702
  Set-Location -LiteralPath $config.cwd
42660
42703
 
42661
42704
  # Task Scheduler does not provide a durable stdin lifetime boundary. Give
@@ -42704,7 +42747,7 @@ async function defaultObserveStatus(path, generation) {
42704
42747
  }
42705
42748
  }
42706
42749
  function taskXml(input) {
42707
- return `<?xml version="1.0" encoding="UTF-8"?>
42750
+ return `<?xml version="1.0" encoding="UTF-16"?>
42708
42751
  <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
42709
42752
  <Triggers><LogonTrigger><Enabled>true</Enabled><UserId>${xml2(input.sid)}</UserId></LogonTrigger></Triggers>
42710
42753
  <Principals><Principal id="ZixtUser"><UserId>${xml2(input.sid)}</UserId><LogonType>InteractiveToken</LogonType><RunLevel>LeastPrivilege</RunLevel></Principal></Principals>
@@ -42746,7 +42789,7 @@ async function installWindowsService(options) {
42746
42789
  const launcherPath = join21(configRoot, "host-launcher.ps1");
42747
42790
  const taskXmlPath = join21(configRoot, "host-task.xml");
42748
42791
  const statusPath = join21(configRoot, "host-status.json");
42749
- const installVersion = options.installVersion ?? installRelease;
42792
+ const installVersion = options.installVersion ?? ((version2, onFailure) => installRelease(version2, onFailure ? { onFailure } : {}));
42750
42793
  const activateVersion = options.activateVersion ?? (options.installVersion ? async (entry) => entry : (entry) => activateInstalledRelease(entry));
42751
42794
  const resolveCommand = options.resolveCommand ?? ((name) => defaultResolveCommand3(name, env));
42752
42795
  const run3 = options.runCommand ?? ((command, args) => runChild(command, args, env));
@@ -42763,9 +42806,15 @@ async function installWindowsService(options) {
42763
42806
  }
42764
42807
  const sid = options.sid ?? await defaultCurrentSid(powershell, env);
42765
42808
  if (!sid || !SAFE_SID.test(sid)) throw new Error("Windows user identity could not be confirmed.");
42766
- const releaseEntry = await installVersion(options.hostVersion);
42809
+ const attempt = { failure: null };
42810
+ const releaseEntry = await installVersion(options.hostVersion, (failure2) => {
42811
+ attempt.failure = failure2;
42812
+ });
42767
42813
  if (!releaseEntry) {
42768
- throw new Error(`Zixt Host ${options.hostVersion} could not be installed for automatic start.`);
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
+ );
42769
42818
  }
42770
42819
  const currentEntry = await activateVersion(releaseEntry);
42771
42820
  const protectedToken = await (options.protectToken ?? ((value, shell) => defaultProtectToken(value, shell, env)))(token2, powershell);
@@ -42787,13 +42836,21 @@ async function installWindowsService(options) {
42787
42836
  path,
42788
42837
  ...env.ZIXT_HOST_UPDATE ? { update: env.ZIXT_HOST_UPDATE } : {},
42789
42838
  ...env.ZIXT_HOST_UPDATE_URL ? { updateUrl: env.ZIXT_HOST_UPDATE_URL } : {},
42790
- ...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 } : {}
42791
42843
  })}
42792
42844
  `,
42793
42845
  sync
42794
42846
  );
42795
42847
  await replacePrivateFile3(launcherPath, launcherSource2(configPath, statusPath), sync);
42796
- await replacePrivateFile3(taskXmlPath, taskXml({ sid, powershell, launcherPath, home }), sync);
42848
+ await replacePrivateFile3(
42849
+ taskXmlPath,
42850
+ taskXml({ sid, powershell, launcherPath, home }),
42851
+ sync,
42852
+ "utf16le"
42853
+ );
42797
42854
  await rm11(statusPath, { force: true });
42798
42855
  const acl = await run3(icacls, [
42799
42856
  configRoot,
@@ -43320,6 +43377,9 @@ function parseHostCliOptions(argv) {
43320
43377
  }
43321
43378
  return options;
43322
43379
  }
43380
+ function isServiceSetupInvocation(argv) {
43381
+ return argv.includes("--install-service");
43382
+ }
43323
43383
  function forcedColor(mode) {
43324
43384
  if (mode === "always") return true;
43325
43385
  if (mode === "never") return false;
@@ -43402,7 +43462,9 @@ if (packagedBuild) {
43402
43462
  if (isWorkerProxyRole()) process.exit(managedExit(await runWorkerCompatibilityProxy()));
43403
43463
  if (needsLegacySupervisorHandoff()) process.exit(managedExit(await launchHostSupervisor()));
43404
43464
  if (isSupervisorRole()) process.exit(managedExit(await superviseHost()));
43405
- if (!isWorkerRole()) process.exit(managedExit(await launchHostSupervisor()));
43465
+ if (!isWorkerRole() && !isServiceSetupInvocation(process.argv.slice(2))) {
43466
+ process.exit(managedExit(await launchHostSupervisor()));
43467
+ }
43406
43468
  }
43407
43469
  var workerWatchdog = startWorkerWatchdogHeartbeat();
43408
43470
  if (packagedBuild && isWorkerRole() && process.env[WORKER_WATCHDOG_NONCE_ENV] !== void 0 && !workerWatchdog.active) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zixt/host",
3
- "version": "0.0.117",
3
+ "version": "0.0.119",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/client.ts",