@hasna/machines 0.0.40 → 0.0.42

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/cli/index.js CHANGED
@@ -10730,7 +10730,7 @@ function resolveDaemonServiceOptions(options) {
10730
10730
  serviceId: serviceName,
10731
10731
  executable,
10732
10732
  intervalMs,
10733
- env: buildEnvironment(serviceName, options, warnings),
10733
+ env: buildEnvironment(serviceName, executable, options, warnings),
10734
10734
  warnings
10735
10735
  };
10736
10736
  }
@@ -10758,11 +10758,15 @@ function normalizeIntervalMs(value, warnings) {
10758
10758
  warnings.push(`Invalid intervalMs "${String(value)}"; using ${DEFAULT_INTERVAL_MS}.`);
10759
10759
  return DEFAULT_INTERVAL_MS;
10760
10760
  }
10761
- function buildEnvironment(serviceName, options, warnings) {
10761
+ function buildEnvironment(serviceName, executable, options, warnings) {
10762
10762
  const env2 = {
10763
10763
  HASNA_MACHINES_AGENT_MODE: "daemon",
10764
10764
  HASNA_MACHINES_AGENT_SERVICE: serviceName
10765
10765
  };
10766
+ const executableDir = dirname4(executable);
10767
+ if (!isStandardExecutableDir(executableDir)) {
10768
+ env2["PATH"] = `${executableDir}:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`;
10769
+ }
10766
10770
  if (options.storagePush) {
10767
10771
  env2["HASNA_MACHINES_AGENT_STORAGE_PUSH"] = "1";
10768
10772
  env2["HASNA_MACHINES_AGENT_STORAGE_PUSH_BACKOFF_MS"] = "250";
@@ -10783,6 +10787,9 @@ function buildEnvironment(serviceName, options, warnings) {
10783
10787
  addEnvPlaceholders(env2, options.env ?? [], warnings);
10784
10788
  return Object.fromEntries(Object.entries(env2).sort(([left], [right]) => left.localeCompare(right)));
10785
10789
  }
10790
+ function isStandardExecutableDir(path) {
10791
+ return ["/bin", "/usr/bin", "/usr/local/bin", "/usr/sbin", "/sbin"].includes(path);
10792
+ }
10786
10793
  function addEnvPlaceholders(env2, names, warnings) {
10787
10794
  for (const rawName of names) {
10788
10795
  const name = rawName.trim();
@@ -10982,7 +10989,7 @@ function launchdLogPath(options, stream) {
10982
10989
  const fileName = `${options.serviceId}.${stream}.log`;
10983
10990
  if (options.mode === "system")
10984
10991
  return `/var/log/${fileName}`;
10985
- return `$HOME/Library/Logs/${fileName}`;
10992
+ return `${process.env["HOME"] ?? "/tmp"}/Library/Logs/${fileName}`;
10986
10993
  }
10987
10994
  function systemdUnitName(options) {
10988
10995
  return `${options.serviceId}.service`;
package/dist/index.js CHANGED
@@ -13893,7 +13893,7 @@ function resolveDaemonServiceOptions(options) {
13893
13893
  serviceId: serviceName,
13894
13894
  executable,
13895
13895
  intervalMs,
13896
- env: buildEnvironment(serviceName, options, warnings),
13896
+ env: buildEnvironment(serviceName, executable, options, warnings),
13897
13897
  warnings
13898
13898
  };
13899
13899
  }
@@ -13921,11 +13921,15 @@ function normalizeIntervalMs(value, warnings) {
13921
13921
  warnings.push(`Invalid intervalMs "${String(value)}"; using ${DEFAULT_INTERVAL_MS}.`);
13922
13922
  return DEFAULT_INTERVAL_MS;
13923
13923
  }
13924
- function buildEnvironment(serviceName, options, warnings) {
13924
+ function buildEnvironment(serviceName, executable, options, warnings) {
13925
13925
  const env = {
13926
13926
  HASNA_MACHINES_AGENT_MODE: "daemon",
13927
13927
  HASNA_MACHINES_AGENT_SERVICE: serviceName
13928
13928
  };
13929
+ const executableDir = dirname4(executable);
13930
+ if (!isStandardExecutableDir(executableDir)) {
13931
+ env["PATH"] = `${executableDir}:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`;
13932
+ }
13929
13933
  if (options.storagePush) {
13930
13934
  env["HASNA_MACHINES_AGENT_STORAGE_PUSH"] = "1";
13931
13935
  env["HASNA_MACHINES_AGENT_STORAGE_PUSH_BACKOFF_MS"] = "250";
@@ -13946,6 +13950,9 @@ function buildEnvironment(serviceName, options, warnings) {
13946
13950
  addEnvPlaceholders(env, options.env ?? [], warnings);
13947
13951
  return Object.fromEntries(Object.entries(env).sort(([left], [right]) => left.localeCompare(right)));
13948
13952
  }
13953
+ function isStandardExecutableDir(path) {
13954
+ return ["/bin", "/usr/bin", "/usr/local/bin", "/usr/sbin", "/sbin"].includes(path);
13955
+ }
13949
13956
  function addEnvPlaceholders(env, names, warnings) {
13950
13957
  for (const rawName of names) {
13951
13958
  const name = rawName.trim();
@@ -14145,7 +14152,7 @@ function launchdLogPath(options, stream) {
14145
14152
  const fileName = `${options.serviceId}.${stream}.log`;
14146
14153
  if (options.mode === "system")
14147
14154
  return `/var/log/${fileName}`;
14148
- return `$HOME/Library/Logs/${fileName}`;
14155
+ return `${process.env["HOME"] ?? "/tmp"}/Library/Logs/${fileName}`;
14149
14156
  }
14150
14157
  function systemdUnitName(options) {
14151
14158
  return `${options.serviceId}.service`;
package/dist/mcp/index.js CHANGED
@@ -5954,6 +5954,7 @@ function diffMachines(leftMachineId, rightMachineId) {
5954
5954
  }
5955
5955
 
5956
5956
  // src/commands/daemon.ts
5957
+ import { dirname as dirname4 } from "path";
5957
5958
  import { platform as osPlatform } from "os";
5958
5959
  var DEFAULT_SERVICE_NAME = "machines-agent";
5959
5960
  var DEFAULT_EXECUTABLE = "/usr/local/bin/machines-agent";
@@ -5995,7 +5996,7 @@ function resolveDaemonServiceOptions(options) {
5995
5996
  serviceId: serviceName,
5996
5997
  executable,
5997
5998
  intervalMs,
5998
- env: buildEnvironment(serviceName, options, warnings),
5999
+ env: buildEnvironment(serviceName, executable, options, warnings),
5999
6000
  warnings
6000
6001
  };
6001
6002
  }
@@ -6023,11 +6024,15 @@ function normalizeIntervalMs(value, warnings) {
6023
6024
  warnings.push(`Invalid intervalMs "${String(value)}"; using ${DEFAULT_INTERVAL_MS}.`);
6024
6025
  return DEFAULT_INTERVAL_MS;
6025
6026
  }
6026
- function buildEnvironment(serviceName, options, warnings) {
6027
+ function buildEnvironment(serviceName, executable, options, warnings) {
6027
6028
  const env = {
6028
6029
  HASNA_MACHINES_AGENT_MODE: "daemon",
6029
6030
  HASNA_MACHINES_AGENT_SERVICE: serviceName
6030
6031
  };
6032
+ const executableDir = dirname4(executable);
6033
+ if (!isStandardExecutableDir(executableDir)) {
6034
+ env["PATH"] = `${executableDir}:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`;
6035
+ }
6031
6036
  if (options.storagePush) {
6032
6037
  env["HASNA_MACHINES_AGENT_STORAGE_PUSH"] = "1";
6033
6038
  env["HASNA_MACHINES_AGENT_STORAGE_PUSH_BACKOFF_MS"] = "250";
@@ -6048,6 +6053,9 @@ function buildEnvironment(serviceName, options, warnings) {
6048
6053
  addEnvPlaceholders(env, options.env ?? [], warnings);
6049
6054
  return Object.fromEntries(Object.entries(env).sort(([left], [right]) => left.localeCompare(right)));
6050
6055
  }
6056
+ function isStandardExecutableDir(path) {
6057
+ return ["/bin", "/usr/bin", "/usr/local/bin", "/usr/sbin", "/sbin"].includes(path);
6058
+ }
6051
6059
  function addEnvPlaceholders(env, names, warnings) {
6052
6060
  for (const rawName of names) {
6053
6061
  const name = rawName.trim();
@@ -6220,7 +6228,7 @@ function launchdLogPath(options, stream) {
6220
6228
  const fileName = `${options.serviceId}.${stream}.log`;
6221
6229
  if (options.mode === "system")
6222
6230
  return `/var/log/${fileName}`;
6223
- return `$HOME/Library/Logs/${fileName}`;
6231
+ return `${process.env["HOME"] ?? "/tmp"}/Library/Logs/${fileName}`;
6224
6232
  }
6225
6233
  function systemdUnitName(options) {
6226
6234
  return `${options.serviceId}.service`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/machines",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
4
4
  "description": "Machine fleet management CLI + MCP for developers",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",