F3 follow-on to #595 (HB consistency) — the items flagged in the #595 review:
- defaultMosaicHome() honors MOSAIC_HOME env (not just --mosaic-home flag), so the
reader matches the writer/launcher when MOSAIC_HOME is set in the shell. The
systemd guard now checks the LITERAL ~/.config/mosaic (units use %h paths).
- heartbeatPath() honors MOSAIC_HEARTBEAT_RUN_DIR (the writer sidecar's override).
- sidecar: printf %q the interpolated hb path / pid / interval (defense-in-depth).
- vitest: heartbeatPath env-resolution coverage.
Deferred to next F3 milestone (need deeper code work): agent-watch viewer-leak
try/finally fix, and the test-start-agent-session.sh workdir-assumption fix.
Refs #588#542
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>