mac: bring the laptop ecosystem back in step with the architecture

ecosystem.mac.config.cjs was written on 2026-07-28 and broken within days by two
changes it never caught up with, leaving two of its four processes dead:

- it ran `officer-claude` against src/servers/sidecar/claude/index.ts. That file
  is the Anthropic credential proxy; the process that actually spawns `claude`
  is user-instance.ts, which was never started. Chat had a credential holder and
  nothing driving it. Split into officer-anthropic-proxy + officer-agent to
  match the host, and retired the `officer-claude` name that caused it.
- officer-pty pointed at src/servers/api/terminal/pty-sidecar.mjs, which no
  longer exists; the sidecar moved to src/servers/sidecar/pty/index.mjs. The
  terminal could not start at all.

No startup ordering is needed between the proxy and the agent: the agent reads
the proxy secret from disk and, when it is not there yet, warns and re-reads
before the next spawn.

Five sidecars have been added since the file was written (memos, caldav, photos,
notify, wallet). All are excluded, and every exclusion is now listed with its
reason so the next reader can tell "not applicable on macOS" from "forgotten" —
which is the failure this commit is fixing.

setup_mac.sh needed no path corrections; its verification loop derives the
process names from the ecosystem file, so it picks the new list up on its own.
Two gaps closed there:

- it called `pm2 save` without `pm2 startup`, writing a process list that
  nothing reads — a reboot left the machine with nothing running. Added the
  launchd equivalent behind SETUP_BOOT, optional because a laptop is not a
  server, and non-fatal because pm2's launchd integration can want a prompt.
- the closing "not installed on macOS" note listed four omissions when there are
  now fourteen.

Both files parse and every ecosystem entry point resolves to a file that exists.
The launchd path is the one thing not verified here — it cannot be exercised
from the Linux host.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-04 12:31:06 +00:00
co-authored by Claude Opus 5
parent 0e893cc292
commit 37ff7c3103
2 changed files with 67 additions and 12 deletions
+20 -1
View File
@@ -442,6 +442,23 @@ elif confirm SETUP_SERVICES "Start Officer and its sidecars with pm2?" y; then
note_failure "pm2 could not start the services — check 'pm2 logs'"
fi
if pm2 save >/dev/null 2>&1; then ok "process list saved"; else warn "pm2 save failed"; fi
# `pm2 save` on its own writes a process list that nothing ever reads. The Linux setup pairs it with
# `pm2 startup`, which installs the boot unit that resurrects that list; without the pair, a reboot
# silently leaves the machine with nothing running. On macOS the equivalent is a launchd agent rather
# than a systemd unit. Kept optional because a laptop is not a server — you may not want the whole
# stack coming back at every login — and non-fatal, because pm2's launchd integration can want an
# elevated prompt that a scripted run should not force.
if confirm SETUP_BOOT "Start Officer automatically at login (pm2 + launchd)?" y; then
if pm2 startup launchd -u "$(whoami)" --hp "$HOME" >/dev/null 2>&1; then
pm2 save >/dev/null 2>&1
ok "services will start at login"
else
warn "Could not install the launchd agent — run: pm2 startup (and follow its instructions)"
fi
else
skip "login startup (declined — 'pm2 startup' enables it later)"
fi
else
skip "services (declined)"
fi
@@ -504,7 +521,9 @@ echo "Notes:"
echo " • Open ${ENV_PUBLIC_URL:-http://localhost:9010} — the first-run screen creates the owner account"
echo " • Logs: pm2 logs Restart: pm2 restart ecosystem.mac.config.cjs"
echo " • Postgres must be running before the services start, or db:push and boot will fail"
echo " • Not installed on macOS: VNC desktop, email sync, music indexer, cliamp audio"
echo " • Not run on macOS: VNC desktop, email sync, music indexer, cliamp audio, and the sidecars"
echo " that front a container or an external service — vault, slskd, headscale, transmission,"
echo " invoiceshelf, memos, photos, caldav, notify, wallet. See ecosystem.mac.config.cjs."
echo " • Pin a specific Claude CLI with CLAUDE_BIN=/path/to/claude in .env if you need to"
echo " • Re-run any single step with e.g. SETUP_OPENCODE=1 bash scripts/setup_mac.sh"
echo ""