fix: expose codex cli to local agent launchd
This commit is contained in:
@@ -5,6 +5,24 @@ ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
CONFIG_PATH="${1:-$ROOT_DIR/local-agent/config.example.json}"
|
||||
NODE_BIN="${BOSS_NODE_BIN:-}"
|
||||
|
||||
append_path_if_dir() {
|
||||
local candidate="$1"
|
||||
if [[ -d "$candidate" && ":$PATH:" != *":$candidate:"* ]]; then
|
||||
PATH="$candidate:$PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
# launchd starts with a very small PATH. Keep CLI runtimes discoverable for
|
||||
# Master Codex Node tasks that spawn `codex`, `node`, or Homebrew tools.
|
||||
append_path_if_dir "/Applications/Codex.app/Contents/Resources"
|
||||
append_path_if_dir "$HOME/Applications/Codex.app/Contents/Resources"
|
||||
append_path_if_dir "/opt/homebrew/bin"
|
||||
append_path_if_dir "/opt/homebrew/sbin"
|
||||
append_path_if_dir "/usr/local/bin"
|
||||
append_path_if_dir "$HOME/.local/bin"
|
||||
append_path_if_dir "$HOME/.bun/bin"
|
||||
export PATH
|
||||
|
||||
if [[ -z "$NODE_BIN" ]]; then
|
||||
NODE_BIN="$(command -v node 2>/dev/null || true)"
|
||||
fi
|
||||
|
||||
@@ -185,4 +185,9 @@ test("repo ships browser and desktop runtime scripts", async () => {
|
||||
assert.match(installLocalLaunchAgent, /codexComputerUseWorkdir/);
|
||||
assert.match(startLocalAgent, /BOSS_NODE_BIN/);
|
||||
assert.match(startLocalAgent, /\.boss-runtime\/node-\*\/bin\/node/);
|
||||
assert.match(
|
||||
startLocalAgent,
|
||||
/\/Applications\/Codex\.app\/Contents\/Resources/,
|
||||
"local-agent launchd startup must include Codex.app CLI in PATH so Master Codex Node can spawn codex",
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user