Files
davidandClaude Opus 5.5 08e6b2ee4f Set up a Mac for a Federated Core, like CoreDesktop's configure
A macOS counterpart of CoreDesktop's configure, with the same drop-in
items in configure.d/:

- core: Mail, Calendar and Contacts through a configuration profile,
  Superpanel as an app, Nextcloud files through the Nextcloud app, and
  Element; with test-and-fix, password change and removal
- tailscale: join the Core's network through headscale
- backup: restic to Nextcloud through rclone, run by launchd through an
  app that can be given Full Disk Access
- storage: SMB shares mounted the way Finder does, again at login and
  on network changes
- agents, claude, opencode, hermes, sandbox: install the agents and run
  them in Anthropic's sandbox runtime (Seatbelt on macOS)
- ai-servers: LLM servers on this Mac or the network, for the agents

Apps and tools macOS lacks are offered for download, checked against
their makers' Team IDs and notarization, or published SHA-256 sums.
Everything runs on macOS' bash 3.2 with only built-in tools.

smoketest/ runs scenarios in fresh macOS VMs with Tart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:34:42 -07:00

48 lines
1.5 KiB
Bash

#!/bin/bash
#
# Purpose : Find the AI agents' real commands, outside the sandbox's own
# (sandbox/bin), and the sandbox runtime. Sourced by configure.d
# items and by sandbox/agent. Needs CONNECTOR.
SANDBOX_BIN="$CONNECTOR/sandbox/bin"
FC_TOOLS="$HOME/.local/share/federated-connector"
# Where the agents' installers put them, in case your shell's PATH doesn't
# have them yet (e.g. right after installing)
AGENT_DIRS="$HOME/.local/bin:$HOME/.opencode/bin:$HOME/.hermes/bin:/opt/homebrew/bin:/usr/local/bin"
# The real command for an agent: the first on PATH, or in AGENT_DIRS, that
# isn't in sandbox/bin
agent_path() {
local dir bin_dir IFS=:
bin_dir="$(cd "$SANDBOX_BIN" 2> /dev/null && pwd -P)"
for dir in $PATH:$AGENT_DIRS; do
[ -n "$dir" ] && [ -d "$dir" ] || continue
[ "$(cd "$dir" && pwd -P)" = "$bin_dir" ] && continue
if [ -x "$dir/$1" ] && [ ! -d "$dir/$1" ]; then
echo "$dir/$1"
return 0
fi
done
return 1
}
agent_installed() {
agent_path "$1" > /dev/null
}
# Run an agent's real command rather than its sandboxed one: setting an agent
# up writes outside its sandbox
unsandboxed() {
local agent="$1" real
shift
real="$(agent_path "$agent")" || { echo "$agent isn't installed."; return 127; }
"$real" "$@"
}
# srt, and the Node.js it runs with: Federated Connector's own, or one
# already installed
srt_path() {
PATH="$FC_TOOLS/srt/bin:$FC_TOOLS/node/bin:$PATH:/opt/homebrew/bin:/usr/local/bin" command -v srt
}