feat(coach): Apple Health metric slots + PROMPT_VERSION 4.23.0

Extends the strict insight schema, Coach snapshot pipeline, and
provenance envelope with the seven Apple Health categories that landed
in Wave 2 (HRV, sleep, resting HR, steps, active energy, flights,
distance, VO2 max, body temperature). All fields are additive and
optional — web-only accounts pay zero extra SQL and the prompt's new
GROUND RULE 12 instructs the model to stay silent when the snapshot
doesn't carry the HealthKit blocks.

Ratchets PROMPT_VERSION 4.22.0 → 4.23.0 and refreshes the
sourceMetric / trendAnnotations enums in both EN + DE. Two new test
files pin the prompt body and the snapshot fan-out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.7 committed 2026-05-11 01:07:03 +02:00
1 parent 2fbc0650a6
commit f2bc4f478a
12 files changed
+538 -29

No files matched your search

@@ -31,6 +31,20 @@ const METRIC_KEYS: Record<CoachProvenance["metrics"][number], string> = {
mood: "insights.coach.metric.mood",
compliance: "insights.coach.metric.compliance",
general: "insights.coach.metric.general",
// ── v1.4.23 Apple Health additive ──
// Optional metric tags surfaced when the iOS app's HealthKit snapshot
// contains the matching block. The translation keys follow the same
// `insights.coach.metric.<token>` namespace and fall back to the raw
// token when a new metric ships before the locale files catch up.
hrv: "insights.coach.metric.hrv",
sleep: "insights.coach.metric.sleep",
resting_hr: "insights.coach.metric.resting_hr",
steps: "insights.coach.metric.steps",
active_energy: "insights.coach.metric.active_energy",
flights: "insights.coach.metric.flights",
distance: "insights.coach.metric.distance",
vo2_max: "insights.coach.metric.vo2_max",
body_temp: "insights.coach.metric.body_temp",
};
const WINDOW_KEYS: Record<CoachProvenance["windows"][number], string> = {
@@ -3,11 +3,20 @@
import {
Activity,
FileText,
Flame,
Footprints,
Heart,
HeartPulse,
Mountain,
Moon,
Pill,
Route,
Scale,
Smile,
Sparkles,
Thermometer,
Wind,
Zap,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
@@ -63,6 +72,19 @@ const METRIC_ICON: Record<
pulse: Activity,
mood: Smile,
compliance: Pill,
// ── v1.4.23 Apple Health additive ──
// Icon picks track the metric domain rather than the brand. Web-only
// accounts never receive findings keyed to these metrics, so the
// mapping is only exercised on iOS-connected snapshots.
hrv: Wind,
sleep: Moon,
resting_hr: HeartPulse,
steps: Footprints,
active_energy: Flame,
flights: Mountain,
distance: Route,
vo2_max: Zap,
body_temp: Thermometer,
};
const TONE_BAR_CLASSNAME: Record<DailyBriefingKeyFinding["tone"], string> = {