@runuai/host 0.9.54 → 0.9.55

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runuai/host",
3
- "version": "0.9.54",
3
+ "version": "0.9.55",
4
4
  "description": "Uai host — runs ephemeral AI tasks in containers on a machine you control.",
5
5
  "license": "MIT",
6
6
  "author": "Uai Tech <team@runuai.com>",
@@ -62,6 +62,20 @@ function systemdQuote(value: string): string {
62
62
  .replace(/"/g, '\\"')}"`;
63
63
  }
64
64
 
65
+ /** `WorkingDirectory=` takes a PLAIN path — systemd does no quote removal
66
+ * there, and a quoted value is a "bad unit file setting" that refuses to
67
+ * start (live 2026-08-21: the first real Linux service install, on AL2023,
68
+ * died on exactly this). Specifier escaping still applies; whitespace is
69
+ * unrepresentable, so it fails loudly instead. */
70
+ function systemdPath(value: string): string {
71
+ if (/[\n\r\0\s]/.test(value) || !value.startsWith("/")) {
72
+ throw new Error(
73
+ "systemd WorkingDirectory must be an absolute path without whitespace",
74
+ );
75
+ }
76
+ return value.replace(/%/g, "%%");
77
+ }
78
+
65
79
  export function renderUnit(p: UnitInputs): string {
66
80
  const exec = [p.execPath, ...p.args].map(systemdQuote).join(" ");
67
81
  return `[Unit]
@@ -71,7 +85,7 @@ Wants=network-online.target
71
85
 
72
86
  [Service]
73
87
  Type=simple
74
- WorkingDirectory=${systemdQuote(p.cwd)}
88
+ WorkingDirectory=${systemdPath(p.cwd)}
75
89
  Environment=${systemdQuote(`PATH=${p.path}`)}
76
90
  ExecStart=${exec}
77
91
  Restart=on-failure