Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(macos): route companion build through Xcode for SwiftUIMacros

Jefferson Mariano de Souza834f1c5c7306
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8cf2a5e1..fffb273a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
+- `companions/ai-memory-macos/build.sh` no longer fails on machines whose
+ active developer directory is Command Line Tools only: SwiftUI `@State`
+ needs the `SwiftUIMacros` plugin shipped with full Xcode, so the script
+ now exports `DEVELOPER_DIR` to Xcode (or a caller-set path) before
+ `swift build`, with a clear error when no macOS platform is present.
- `ai-memory serve` no longer leaked file descriptors from half-open HTTP
connections until `EMFILE`, breaking the healthcheck (an unauthenticated
availability/DoS). A hook or MCP client whose peer died without sending FIN
diff --git a/companions/ai-memory-macos/build.sh b/companions/ai-memory-macos/build.sh
index e215e41e..37d0e682 100755
--- a/companions/ai-memory-macos/build.sh
+++ b/companions/ai-memory-macos/build.sh
@@ -19,6 +19,14 @@ else
fi
echo "building AIMemoryMenu"
+# SwiftUI @State needs libSwiftUIMacros; Command Line Tools alone do not ship it.
+XCODE_DEVELOPER="${DEVELOPER_DIR:-/Applications/Xcode.app/Contents/Developer}"
+if [[ ! -d "$XCODE_DEVELOPER/Platforms/MacOSX.platform" ]]; then
+ echo "error: install Xcode or set DEVELOPER_DIR to Xcode.app/Contents/Developer" >&2
+ exit 1
+fi
+export DEVELOPER_DIR="$XCODE_DEVELOPER"
+
swift build "${SWIFT_FLAGS[@]}" --package-path "$COMPANION"
BIN_PATH="$(swift build "${SWIFT_FLAGS[@]}" --package-path "$COMPANION" --show-bin-path)"