@miraland-labs/conduit-bridge 0.16.120 → 0.16.121

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/service.js +16 -4
  2. package/package.json +1 -1
package/dist/service.js CHANGED
@@ -90,7 +90,17 @@ export function applyRunnerToolPath(env = process.env, home = homedir(), nodeBin
90
90
  env.PATH = next;
91
91
  return next;
92
92
  }
93
- export function launchdPlist(programArguments, stdoutPath, pathEnv = runnerServicePath()) {
93
+ /**
94
+ * A service must run the installation that installed it. Without this the unit started with the
95
+ * default configuration directory, so the second lane's service ran the first lane's credentials —
96
+ * seen on the trial host the moment two lanes existed.
97
+ */
98
+ export function installationEnvironment(configDirectory = configDir()) {
99
+ return resolve(configDirectory) === resolve(join(homedir(), ".config", "conduit"))
100
+ ? {}
101
+ : { CONDUIT_BRIDGE_CONFIG_DIR: configDirectory };
102
+ }
103
+ export function launchdPlist(programArguments, stdoutPath, pathEnv = runnerServicePath(), environment = {}) {
94
104
  const argsXml = programArguments.map((arg) => ` <string>${escapeXml(arg)}</string>`).join("\n");
95
105
  return `<?xml version="1.0" encoding="UTF-8"?>
96
106
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -106,6 +116,7 @@ ${argsXml}
106
116
  <dict>
107
117
  <key>PATH</key>
108
118
  <string>${escapeXml(pathEnv)}</string>
119
+ ${Object.entries(environment).map(([key, value]) => ` <key>${escapeXml(key)}</key>\n <string>${escapeXml(value)}</string>`).join("\n")}
109
120
  </dict>
110
121
  <key>RunAtLoad</key>
111
122
  <true/>
@@ -119,7 +130,7 @@ ${argsXml}
119
130
  </plist>
120
131
  `;
121
132
  }
122
- export function systemdUserUnit(programArguments, workingDirectory, pathEnv = runnerServicePath()) {
133
+ export function systemdUserUnit(programArguments, workingDirectory, pathEnv = runnerServicePath(), environment = {}) {
123
134
  const execStart = programArguments.map(escapeSystemdExecArgument).join(" ");
124
135
  return `[Unit]
125
136
  Description=Conduit Bridge runner
@@ -131,6 +142,7 @@ Type=simple
131
142
  WorkingDirectory=${escapeSystemdUnitValue(workingDirectory)}
132
143
  Environment=PATH=${escapeSystemdUnitValue(pathEnv)}
133
144
  Environment=CONDUIT_RUNNER_SERVICE=systemd
145
+ ${Object.entries(environment).map(([key, value]) => `Environment=${key}=${escapeSystemdUnitValue(value)}`).join("\n")}
134
146
  ExecStart=${execStart}
135
147
  Restart=always
136
148
  RestartSec=5
@@ -390,7 +402,7 @@ export async function installRunnerService(options = {}) {
390
402
  const log = logPath(serviceName);
391
403
  await mkdir(dirname(plistPath), { recursive: true });
392
404
  await mkdir(dirname(log), { recursive: true });
393
- await writeFile(plistPath, launchdPlist(programArguments, log), { mode: 0o644 });
405
+ await writeFile(plistPath, launchdPlist(programArguments, log, runnerServicePath(), installationEnvironment()), { mode: 0o644 });
394
406
  const domain = `gui/${process.getuid?.() ?? 501}`;
395
407
  let loaded = false;
396
408
  if (runningInsideRunnerLaunchAgent()) {
@@ -430,7 +442,7 @@ export async function installRunnerService(options = {}) {
430
442
  }
431
443
  await mkdir(dirname(unitPath), { recursive: true });
432
444
  await mkdir(linuxLogDir(), { recursive: true });
433
- await writeFile(unitPath, systemdUserUnit(programArguments, configDir()), { mode: 0o644 });
445
+ await writeFile(unitPath, systemdUserUnit(programArguments, configDir(), runnerServicePath(), installationEnvironment()), { mode: 0o644 });
434
446
  run("systemctl", ["--user", "daemon-reload"]);
435
447
  for (const args of systemdActivationCommands(runningInsideRunnerSystemd(), serviceName)) {
436
448
  run("systemctl", args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miraland-labs/conduit-bridge",
3
- "version": "0.16.120",
3
+ "version": "0.16.121",
4
4
  "description": "Conduit Bridge CLI \u2014 join, connect, disconnect, multi-driver lanes, and run Claude Code / Codex / Cursor / OpenCode / Pi / Kiro / Antigravity / Grok Build agents for a Conduit organization",
5
5
  "type": "module",
6
6
  "bin": {