# Deployment & Update Plan: Aether Native V3

**Mechanism:** Syncthing + Admin Share
**Target:** macOS Fleet
**Primary Controller:** `admin_share` directory

## 1. Distribution via Syncthing
We will leverage the existing Syncthing mesh to distribute binaries and configurations.

### 1.1 Directory Structure (Admin Share)
```text
admin_share/
├── configs/
│   └── seed_[DEVICE_ID].json   # Specific seed files for auto-provisioning
├── binaries/
│   └── native_app/
│       ├── version.json        # Latest version metadata
│       └── Aether_Native.app/  # The macOS App Bundle (or .zip)
└── scripts/
    └── update_helper.sh        # macOS script to swap binaries
```

## 2. Self-Update Protocol
The V3 app will monitor for updates without relying on external internet access (perfect for isolated event networks).

### 2.1 The Update Flow
1.  **Check:** On launch (and periodically), the app reads `admin_share/binaries/native_app/version.json`.
2.  **Compare:** If `version.json > package.json`, the app signals the user: "Update Available".
3.  **Stage:** The app copies the new `.app` bundle from the sync folder to a local `~/Library/Caches/Aether/updates/` directory.
4.  **Swap:** The app launches `update_helper.sh` and exits. The script moves the new version into `/Applications/` and restarts the app.

## 3. Provisioning (The "Seed" Strategy)
To set up a new laptop:
1.  Install Syncthing and link the `admin_share`.
2.  The Electron app looks for `admin_share/configs/seed_$(hostname).json`.
3.  If found, it copies it to its local config path and bootstraps itself.
4.  **Result:** Zero manual configuration for the onsite tech.

## 4. macOS Specific Lifecycle
- **Gatekeeper:** Since these are distributed via Syncthing, we must handle the "App is damaged or from an unidentified developer" prompt.
- **Plan:** Include a `post-sync` script that runs `xattr -rd com.apple.quarantine` on the binary folder within the admin share (if permissions allow) or instructs the user on the first run.

## 5. Development Workflow (Arch Linux -> Mac)
1.  **Build:** On Arch Linux, run `npm run build:mac`.
2.  **Package:** Use `electron-packager` to create the macOS `.app` bundle.
3.  **Distribute:** Move the built `.app` into the local Syncthing `admin_share` folder.
4.  **Verify:** Watch the fleet of Macs automatically pull the update via Syncthing.

## 6. Project Document Updates
The following files have been updated to reflect this deployment strategy:
- `NATIVE_APP_V3_REWRITE_PLAN.md`: Added self-update logic requirements.
- `NATIVE_BRIDGE_INTERFACE_SPEC.md`: Added `ae_sys.checkForUpdates()` method.
