diff --git a/src/components/today/SummaryBar.tsx b/src/components/today/SummaryBar.tsx
index a477dc830..558fc0c8d 100644
--- a/src/components/today/SummaryBar.tsx
+++ b/src/components/today/SummaryBar.tsx
@@ -1,4 +1,4 @@
-import { Target, Bell, Inbox, AlertCircle, Clock, Calendar, Users, Repeat2, Bot } from "lucide-react";
+import { Target, Bell, Inbox, AlertCircle, Clock, Calendar, Users, Repeat2, Bot, Activity } from "lucide-react";
import Link from "next/link";
import { getTodaySummary, getFleetSummary } from "@/db/queries/today";
import { getCurrentUserId } from "@/lib/session";
@@ -41,6 +41,9 @@ export async function SummaryBar() {
{s.urgentAlerts > 0 && (
)}
+ {fleet.degraded > 0 && (
+
+ )}
{fleet.running > 0 && (
)}
diff --git a/src/db/queries/today.ts b/src/db/queries/today.ts
index 252041bfb..1fe86996d 100644
--- a/src/db/queries/today.ts
+++ b/src/db/queries/today.ts
@@ -10,7 +10,7 @@ import { commitments, subscriptions, goals, alerts, actions, events, projectStat
import { eq, and, lte, isNotNull, sql } from "drizzle-orm";
import { HEALTH_FADING_DAYS } from "@/lib/constants/people";
import { GOAL_STATUS, SUB_STATUS, COMMITMENT_STATUS, ACTION_STATUS, ALERT_SEVERITY, EVENT_STATUS } from "@/lib/constants/statuses";
-import { READY_WINDOW_S, PROMPT_RUNNING_WINDOW_S } from "@/lib/constants/control";
+import { READY_WINDOW_S, PROMPT_RUNNING_WINDOW_S, getHealthShort } from "@/lib/constants/control";
import { z } from "zod";
export const CreateCommitmentBody = z.object({
@@ -239,18 +239,24 @@ export async function getFleetSummary(userId: string) {
.select({
currentPromptStartedAt: projectStates.currentPromptStartedAt,
readyAt: projectStates.readyAt,
+ sessionHealth: projectStates.sessionHealth,
})
.from(projectStates)
.where(eq(projectStates.userId, userId));
let running = 0;
let waiting = 0;
+ let degraded = 0;
for (const r of rows) {
if (r.currentPromptStartedAt && r.currentPromptStartedAt > cutoffRunning) {
running++;
} else if (r.readyAt && r.readyAt > cutoffWaiting) {
waiting++;
}
+ if (r.sessionHealth) {
+ const short = getHealthShort(r.sessionHealth);
+ if (short === "degraded" || short === "critical") degraded++;
+ }
}
- return { running, waiting };
+ return { running, waiting, degraded };
}