Add Outlook Teams recording prompts

This commit is contained in:
2026-06-03 10:45:20 +02:00
parent edade8ab62
commit 50daa88389
17 changed files with 1435 additions and 234 deletions
@@ -0,0 +1,67 @@
## Context
Meeting Assistant already supports manual recording starts through hotkeys, HTTP endpoints, and the tray menu. It also reads the current Outlook Classic Teams appointment when a recording starts so meeting artifacts can be enriched with title, attendees, agenda, and scheduled end.
This change adds an optional proactive prompt before Teams meetings. The app must not depend on Teams APIs for the primary meeting flow, and Outlook integration remains Windows-only because it uses Outlook Classic COM.
## Goals / Non-Goals
**Goals:**
- Sync today's Outlook Classic Teams appointments when enabled.
- Avoid frequent Outlook COM polling by caching all Teams appointments for the current local day.
- Schedule prompt checks from the in-memory cache so back-to-back short meetings can prompt without another Outlook sync.
- Reuse the existing native Windows app notification pattern with affirmative and negative actions.
- Start recording on acceptance, stopping any active recording through the normal stop path first.
**Non-Goals:**
- Join, inspect, or control Teams meetings through Teams APIs.
- Detect Zoom, Webex, or other meeting providers in this change.
- Persist the daily prompt cache across application restarts.
- Prompt for meetings from non-Windows builds.
## Decisions
### Use a day cache instead of per-minute Outlook polling
Meeting Assistant syncs all Teams appointments for the current local day into memory on a configurable interval, defaulting to 30 minutes. Prompt checks then operate on that cached list.
This avoids using Outlook COM as a high-frequency scheduler and supports multiple short meetings close together without requiring a sync between them. The alternative was checking Outlook every minute for due meetings, which is simpler but unnecessarily noisy and risks Outlook responsiveness issues.
### Keep prompt scheduling independent from Outlook sync
The hosted scheduler separates `SyncOnceAsync` from due prompt checks. Its runtime loop wakes for the earlier of the next sync or the next cached meeting start.
This keeps Outlook interaction slow and bounded while preserving timely prompts. The alternative was a fixed timer that checks both cache and Outlook on the same cadence, which either polls Outlook too often or risks late prompts.
### Use a recording controller adapter over direct coordinator coupling
Prompt acceptance is handled through a small adapter over `MeetingRecordingCoordinator`. The adapter exposes current status, normal start, and normal stop.
This keeps the prompt scheduler focused on calendar prompt behavior and leaves minimum-duration cleanup, transcription drain, speaker recognition, and summary continuation in the existing coordinator. The alternative was embedding handoff logic in the scheduler, which would duplicate recording lifecycle policy.
### Use Windows-specific adapters for COM and notifications
The Outlook calendar provider and meeting-start prompt service are Windows-only implementations behind platform-neutral interfaces. Non-Windows builds register no-op implementations.
This preserves cross-target builds and keeps platform-specific packages and COM usage isolated. The alternative was spreading `#if WINDOWS` checks into scheduler logic, which would make the core behavior harder to test.
## Risks / Trade-offs
[Missed updates between syncs] -> A meeting created or changed after the last sync may not prompt until the next sync. The default 30-minute sync interval balances freshness against Outlook COM overhead and can be configured lower if needed.
[App restart loses prompt memory] -> Prompted appointment keys are in memory only. A restart during the day may allow a meeting to prompt again if it is still in the prompt window. This is acceptable for the first version and avoids persistence complexity.
[Outlook COM availability] -> Outlook Classic may be unavailable or slow. Sync failures are logged and retried on the next sync interval without blocking recording controls.
[Notification ignored] -> Ignored prompts do not block later prompt checks, but the appointment is marked prompted for the day so the app does not spam repeated notifications.
## Migration Plan
The feature is disabled by default. Existing installations keep current manual recording behavior until `CalendarRecordingPrompts:Enabled` is set to `true`.
Rollback is disabling `CalendarRecordingPrompts:Enabled` or reverting the change. No data migration is required because the cache is in-memory only.
## Open Questions
- Should the prompt cache become persistent if duplicate prompts after app restarts become annoying?
- Should future provider detection include Zoom or other meeting links from the same Outlook appointment sync?
@@ -0,0 +1,13 @@
## Why
Meeting Assistant can enrich a recording from the current Outlook Teams appointment, but it still relies on the user remembering to start recording manually.
## What Changes
- Add an optional scheduled Outlook Classic calendar check for today's Teams appointments.
- Prompt the user through native Windows app notifications when a Teams appointment reaches its start time.
- Start recording when the user accepts the prompt.
- If another recording is active when the user accepts, stop it normally first, then start the new recording.
## Impact
- Adds a Windows-only Outlook calendar reader for daily Teams appointments.
- Adds a Windows notification prompt alongside the existing inactivity prompt.
- Adds a hosted scheduler guarded by configuration.
@@ -0,0 +1,54 @@
## ADDED Requirements
### Requirement: Outlook Teams meetings can prompt recording start
Meeting Assistant SHALL provide a disabled-by-default setting that enables scheduled Outlook Classic calendar checks for recording-start prompts.
When scheduled recording prompts are enabled on Windows, Meeting Assistant SHALL periodically read the user's Outlook Classic calendar appointments for the current local day through COM into an in-memory cache.
Meeting Assistant SHALL default the Outlook calendar sync interval to 30 minutes when scheduled recording prompts are enabled.
Meeting Assistant SHALL schedule recording-start prompts from the cached calendar appointments rather than querying Outlook for each prompt.
Meeting Assistant SHALL consider Teams appointments from Outlook calendar data as initial prompt candidates. The detection MAY be extended later for other meeting providers.
When a Teams appointment reaches its scheduled start window, Meeting Assistant SHALL show a native Windows app notification asking whether to record the meeting, with affirmative and negative actions.
Meeting Assistant SHALL prompt at most once per calendar appointment during a local day, regardless of whether the user accepts, declines, or ignores the notification.
If the user accepts the recording prompt while no recording is active, Meeting Assistant SHALL start a new recording normally.
If the user accepts the recording prompt while another recording is active, Meeting Assistant SHALL stop the active recording normally and then start the prompted meeting recording.
When stopping an active recording for an accepted prompt, Meeting Assistant SHALL use the normal stop path so empty or too-short recordings are removed according to existing settings and other completed recordings continue normal transcription, speaker recognition, and summary processing.
#### Scenario: Teams meeting start prompts the user
- **GIVEN** scheduled Outlook recording prompts are enabled
- **AND** Meeting Assistant has synced Outlook Classic Teams appointments for today
- **WHEN** the appointment reaches its scheduled start window
- **THEN** Meeting Assistant shows a native Windows app notification asking whether to record the meeting
- **AND** marks that appointment as prompted for the day
#### Scenario: Back-to-back cached Teams meetings prompt without another Outlook sync
- **GIVEN** scheduled Outlook recording prompts are enabled
- **AND** Meeting Assistant has synced two Teams appointments for today that start ten minutes apart
- **WHEN** each appointment reaches its scheduled start window
- **THEN** Meeting Assistant shows a recording prompt for each appointment
- **AND** does not require another Outlook calendar sync between the prompts
#### Scenario: User accepts prompt while idle
- **GIVEN** scheduled Outlook recording prompts are enabled
- **AND** no meeting recording is active
- **WHEN** the user accepts a Teams meeting recording prompt
- **THEN** Meeting Assistant starts recording normally
#### Scenario: User accepts prompt while already recording
- **GIVEN** scheduled Outlook recording prompts are enabled
- **AND** a meeting recording is active
- **WHEN** the user accepts a Teams meeting recording prompt
- **THEN** Meeting Assistant stops the active recording normally
- **AND** starts a new recording normally after the stop request
#### Scenario: Prompt is disabled
- **GIVEN** scheduled Outlook recording prompts are disabled
- **WHEN** a Teams appointment reaches its scheduled start
- **THEN** Meeting Assistant does not query Outlook for recording prompt candidates
- **AND** does not show a recording prompt
@@ -0,0 +1,13 @@
## 1. Specification
- [x] Add scheduled Outlook Teams recording prompt requirements and scenarios.
## 2. Behavior
- [x] Add settings for enabling scheduled calendar prompts and controlling Outlook sync timing.
- [x] Read today's Teams appointments from Outlook Classic COM on Windows into a day cache.
- [x] Prompt once per appointment when it reaches its start window.
- [x] On accepted prompt, stop any active recording normally and start the new recording.
## 3. Verification
- [x] Add focused behavior tests for prompt selection and accepted handoff.
- [x] Run relevant tests.
- [x] Validate OpenSpec change.