feat(ai-session): add FlowPilot AI-powered troubleshooting sessions

Implements Phase 1 of the FlowPilot-First pivot — the core AI session
experience where engineers describe a problem and FlowPilot guides them
through structured diagnosis with selectable options, free-text escape
hatches, and auto-generated documentation on resolution.

Backend: AISession + AISessionStep models, FlowPilot Engine (LLM
orchestration with structured JSON output), Flow Matching Engine v1
(semantic + keyword + recency scoring), 8 API endpoints with auth,
rate limiting, and AI quota enforcement.

Frontend: Intake screen, conversational session view with sidebar,
step cards with options/actions/resolution suggestions, resolve/escalate
modals, documentation view with rating, session history integration,
and /pilot route with sidebar navigation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-18 14:27:36 +00:00
parent 44eb48e457
commit 5494816b06
29 changed files with 3647 additions and 5 deletions

View File

@@ -0,0 +1,44 @@
import { cn } from '@/lib/utils'
interface ConfidenceIndicatorProps {
tier: string
score: number
className?: string
}
const TIER_CONFIG = {
guided: {
color: 'bg-emerald-400',
label: 'Proven path',
description: 'FlowPilot is following a known resolution path with high confidence.',
},
exploring: {
color: 'bg-amber-400',
label: 'Investigating',
description: 'FlowPilot is narrowing down the issue based on your responses.',
},
discovery: {
color: 'bg-violet-400',
label: 'New territory',
description: 'FlowPilot is exploring this issue — your responses help build the knowledge base.',
},
} as const
export function ConfidenceIndicator({ tier, score, className }: ConfidenceIndicatorProps) {
const config = TIER_CONFIG[tier as keyof typeof TIER_CONFIG] ?? TIER_CONFIG.discovery
return (
<div className={cn('group relative inline-flex items-center gap-2', className)}>
<span className={cn('h-2 w-2 rounded-full', config.color)} />
<span className="font-label text-xs text-muted-foreground">{config.label}</span>
{/* Tooltip */}
<div className="pointer-events-none absolute left-0 top-full z-50 mt-2 w-56 rounded-lg border border-border bg-card p-3 opacity-0 shadow-lg transition-opacity group-hover:pointer-events-auto group-hover:opacity-100">
<p className="text-xs text-muted-foreground">{config.description}</p>
<p className="mt-1 font-label text-[0.625rem] text-[#5a6170]">
Confidence: {Math.round(score * 100)}%
</p>
</div>
</div>
)
}