# Hearbit AI 🦉🎙️

**Hearbit AI** is your professional meeting assistant for macOS. It records both your microphone and system audio (e.g., Teams, Zoom, 3CX, Talk), transcribes it with high precision using Infomaniak's Whisper API, and generates intelligent, structured summaries.

![App Icon](src-tauri/icons/128x128@2x.png)

## ✨ New in v1.2.x

### v1.2.3: App Blocking & Selective Recording 🚫🎧
*   **🔇 App Blocking (Selective Recording)**: You can now exclude specific applications from being captured by the system audio recording. 
*   **🧠 Smart Matching**: Uses prefix-based matching (e.g., `com.apple.Safari`) to reliably block main apps AND their background/helper processes (e.g., "Safari Web Content").
*   **🚀 Quick Select Presets**: Quickly block common background apps like **Spotify, Apple Music, VLC, Safari, or Chrome** with one click.
*   **🔍 Live App List**: Filter any currently running application directly from the new **Apps** tab in Settings.
*   **🔄 Robust Auto-Refresh**: The capture filter automatically updates every 5 seconds to account for newly opened browsers or media players.

### v1.2.0: Native Audio & Auto-Loop 🦉
*   **🎧 Native System Audio**: No more BlackHole driver needed! Captures Teams, Zoom, 3CX, and Talk audio directly via macOS ScreenCaptureKit.
*   **🔁 Auto-Loop (Standby Mode)**: Automatically "re-arms" after a call finishes.
*   **⚡ Smart VAD & Pre-Roll**: 3-second pre-roll and noise filtering.
*   **🛡️ Empty Audio Guard**: Automatically discards silent recordings.
*   **💾 Daily Security Backups**: Automatic JSON history backups every 24 hours.

## 🚀 Key Features

*   **🎙️ Dual-Channel Recording**: Seamlessly capture your voice and meeting audio.
*   **📁 Import Audio Files**: Upload existing recordings (MP3, WAV, M4A, etc.).
*   **⏱️ Long Meeting Support**: Handles meetings 2+ hours with automatic chunking.
*   **📅 Microsoft 365 Integration**: View upcoming meetings and join with one click.
*   **💾 Persistent History**: Automatically saves all transcripts and summaries locally.
*   **✉️ Email Summaries**: Send formatted HTML summaries via your own SMTP server.
*   **🎨 White-Labeling**: Upload your custom company logo.

---

## 🛠️ Usage Guide

### 1. Installation
1.  Download the latest `.dmg` file from the [Releases page](#).
2.  Open the `.dmg` and drag **Hearbit AI** to your Applications folder.
3.  **Permission Check**: On first launch, grant "Screen Recording" permission (required for capturing System Audio).

### 2. Configuration
1.  Click **Settings** (gear icon).
2.  Enter your **Infomaniak API Key** and **Product ID**.
3.  (Optional) Configure **SMTP** for email sending and **Microsoft 365** for calendar integration.

### 3. Recording a Meeting
1.  **Select Mode**: Choose "Meeting" (captures Mic + System) or "Voice Memo" (Mic only).
2.  **Auto-Start Logic**: 
    - **Meeting Mode**: Triggers only when the call actually starts (system audio detected).
    - **Voice Memo**: Triggers immediately when you start speaking.
3.  **Standby**: Click "Standby (Auto-Start)". The app waits silently.
4.  **Join Call**: Join your Teams/Zoom call.
5.  **Trigger**: Hearbit starts recording automatically based on the selected mode.
6.  **Finish**: When the call ends (silence > 25s), Hearbit stops, transcribes, summarizes, and **goes back to Standby** for the next call.

### 4. Optimal Setup (MS Teams / Zoom / 3CX)
For the best experience without changing any software settings:
*   **Hearbit App**: Select your **real microphone** (e.g., "MacBook Mic" or Headset).
*   **Meeting Software**: Use your standard output (Speakers/Headset).
*   *How it works*: Hearbit captures your voice via mic and the other side via macOS System Audio Capture automatically.

*Note: If you choose "Hearbit Audio" (Aggregate Device) in the app, you MUST set your Teams/Zoom/3CX speaker output to "Hearbit Audio" as well.*

### 5. Customizing Prompts
You can create custom AI templates in Settings -> Prompts. Example:
*   **"Sales Call"**: Focus on budget, timeline, and decision makers.
*   **"Daily Standup"**: Extract blockers and next steps.
*   **"General Protocol"**: Standard meeting minutes.

---

## ❓ Troubleshooting

### "Hearbit AI is damaged and can't be opened"
If macOS blocks the app because it's not notarized:
1.  Open **Terminal**.
2.  Run: `sudo xattr -cr /Applications/Hearbit\ AI.app`
3.  Enter your password and try again.

### Audio cuts off at the start?
v1.2.0 includes a **3-second buffer**. The Meeting mode now uses a more sensitive trigger (0.005 energy) to catch even quiet participants.

### "Batch processing failed"
This means the audio was empty or too short. Check the **Logs** tab for detailed error messages from Infomaniak. The most common cause is selecting the wrong input device or a lack of Screen Recording permissions.

---

## 👨‍💻 Development

Built with **Tauri v2**, **React**, and **TypeScript**.

### Setup
```bash
npm install
```

### Run Locally
```bash
npm run tauri dev
```

### Build for Production
```bash
npm run tauri build
```

---

## 📄 License

This project is licensed under the **GNU Affero General Public License v3.0 (AGPLv3)**. See the [LICENSE](LICENSE) file for details.
