Add the Patrol weekly digest endpoint

Nothing in Pulse showed a paying customer what Patrol had done for them:
about 164 runs a month per install, findings raised, investigations and
fixes, and none of it summarised. GET /api/ai/patrol/digest rolls the last
N days (default 7, max 30) up from records Pulse already keeps: run
history, the findings store, Patrol-origin action audits, and the usage
cost store. It adds no telemetry and persists nothing. The payload
reports when the bounded run history no longer covers the window and when
model pricing is unknown, rather than quietly under-counting.

This is the first slice of the "Patrol weekly digest" named bet in the
pulse-pro demand ledger; the in-app "This week" card follows once its
browser pass is recorded. docs/PATROL_WEEKLY_DIGEST.md holds the design
note and the honest limits of each line.

status.json registers the patrol-value-visibility coverage gap, the
candidate lane, and its work claim. It also drops the second, identical
copy of the ai-provider-guided-setup coverage gap that landed with #1853;
the duplicate id fails the status audit on main for every pull request.
This commit is contained in:
rcourtman
2026-09-02 08:53:50 +01:00
parent b1d1a03643
commit 8ea94d792b
17 changed files with 1223 additions and 46 deletions
+14
View File
@@ -1138,6 +1138,20 @@ Kubernetes-specific analysis as a standalone plan pillar.
Runs a focused investigation for an alert payload (used by the UI).
### Patrol
- `GET /api/ai/patrol/digest`
- Returns the "what Patrol did for you" rollup for the last `days` days
(query `days`, 130, default 7): the window and whether retained run
history covers it, the effective Patrol mode, runs (total, scheduled,
event-triggered, manual, failed, checks, resources covered, last run),
findings (new, still open by severity, resolved, auto-resolved,
dismissed, suppressed), investigations by outcome, Patrol-origin actions
(proposed, approved, rejected, executed, verified, failed, pending),
alerts Patrol reviewed, and estimated model spend with a pricing-known
flag.
- Computed from records Pulse already retains (run history, the findings
store, canonical action audits, and usage cost events); nothing new is
persisted. Requires the `ai:execute` scope. Backs the Patrol page's
"This week" card; see `docs/PATROL_WEEKLY_DIGEST.md`.
- `GET /api/ai/patrol/attention`
- Returns the typed Patrol attention queue projected from canonical
operational lifecycle records. This is the active-count and queue source