Add Patrol assessment Assistant handoff

This commit is contained in:
rcourtman
2026-05-07 08:52:38 +01:00
parent 812c86692d
commit 73b4cf25c3
7 changed files with 769 additions and 10 deletions
@@ -431,6 +431,11 @@ the canonical monitored-system blocked payload.
and the shared dashboard-load bundle inside `frontend-modern/src/stores/aiIntelligence.ts`, so the page orchestration stays on the store-owned bundle instead of enumerating the AI fetches inline
and the shared `frontend-modern/src/components/Infrastructure/ResourcePolicySummary.tsx` card, so the AI summary page renders the governed policy-posture counts while the resource drawer stays on per-resource policy lines instead of carrying duplicate posture UI loops
and the dedicated `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts` owner, so recent-change, learned-correlation, and policy-coverage summary text stays derived from the canonical AI payload in one place instead of as hook-local count and pluralization logic
and that same Patrol investigation-context owner, so the current Patrol
assessment summary may open Assistant with bounded model-only assessment,
verification, latest-run, supporting-context, active-finding, and resource
reference context instead of pasting page-local UI text or raw command
payloads into chat
and that same Patrol investigation-context owner, so visible Assistant
drawer handoffs may include live pending-approval metadata only as safe
operator context: approval ID, status, risk, requested/expiry timestamps,
@@ -809,7 +809,12 @@ frontend primitive boundary.
investigation-record framing must derive that prompt copy through
`frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`
so shared drawer primitives stay shell-owned rather than becoming a
Patrol-specific prompt formatter. The drawer may render a generic
Patrol-specific prompt formatter. Patrol assessment-level handoffs must use
that same feature helper to attach bounded model-only assessment,
verification, latest-run, supporting-context, active-finding, and resource
reference context while forcing request-local approval-required mode, so the
shared drawer stays a generic shell rather than a Patrol summary prompt
builder. The drawer may render a generic
context-briefing band from `frontend-modern/src/stores/aiChat.ts`, but
feature-owned helpers must provide the source labels, attention reason,
evidence summaries, operator-decision copy, action copy, and safety note.
@@ -188,6 +188,16 @@ Patrol-specific presentation helpers.
structured `investigationRecord` as investigation data, even when the legacy
investigation-detail endpoint has no separate session payload, so it must not
render empty-state copy above a durable Patrol record.
The primary Patrol assessment summary may open Assistant as a whole-surface
review handoff, but that handoff must also flow through
`frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`.
The summary action may pass the current assessment title, health score,
verification recency, latest run, secondary investigation context, bounded
active-finding summaries, and structured resource references as model-only
context. It must force request-local approval-required mode, keep raw command
and approval payloads out of prompt and drawer copy, and frame Assistant as
explanation, prioritization, and safe next-step review rather than a generic
reactive chat box.
## Current State
@@ -235,6 +245,14 @@ render contract: the header chip, primary summary card, and status bar must
all route through the shared `frontend-modern/src/utils/patrolRuntimePresentation.ts`
helper plus the backend `runtime_state` payload instead of inferring operator
state from the last healthy summary snapshot or run history alone.
The primary summary card now also has a Patrol-owned Assistant assessment
handoff. `frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx`
opens Assistant through
`frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts`, which
packages the current Patrol assessment, verification posture, latest run,
secondary investigation context, bounded active-finding summaries, and deduped
resource references as model-only context while forcing `autonomousMode:false`
and summarizing proposed-fix command-bearing records by count only.
That active-runtime label must stay operational rather than verdict-like: the
header chip should communicate that Patrol is enabled or available, not imply
that infrastructure health is currently good merely because the runtime is on.