All checks were successful
Mirror to GitHub / mirror (push) Successful in 3s
Collapses the pre-existing dual-surface setup (AssistantChatPage at /assistant, FlowPilotSessionPage at /pilot) into a single chat-primary surface per architectural claim #1 of FLOWPILOT-MIGRATION.md. Router changes (frontend/src/router.tsx): - /pilot and /pilot/:sessionId now render AssistantChatPage. - /assistant redirects permanently to /pilot via <Navigate replace>. - /assistant/:sessionId redirects to /pilot/:sessionId preserving the ID via an AssistantSessionRedirect helper that reads the param. - FlowPilotSessionPage is no longer imported or mounted. Per the beta-history-disposable decision, the file stays on disk for reference but is unreachable; delete once nothing else in the tree imports it. Dispatcher de-branching — previously these sites routed by session_type (chat -> /assistant, otherwise -> /pilot). All now unconditionally go to /pilot/:id since session_type is no longer used for frontend routing: - components/dashboard/ActiveFlowPilotSessions.tsx - components/dashboard/RecentFlowPilotSessions.tsx - components/flowpilot/AISessionListItem.tsx (keeps isChat for icon selection, but linkTo is unconditional) User-facing label + navigation updates: - components/layout/CommandPalette.tsx: "AI Assistant" palette entry becomes "FlowPilot" pointing to /pilot; the sparkles quick-action also routes to /pilot. - components/dashboard/StartSessionInput.tsx: both navigate() call sites now go to /pilot instead of /assistant. - lib/routePrefetch.ts: prefetch entry for AssistantChatPage keyed to /pilot (the real surface) rather than /assistant (now redirect-only). Preserved intentionally (not user-facing routes): - Backend /assistant/retention API path and the assistantChatApi module name — those are internal API and module identifiers, not SPA routes. - src/components/assistant/* and src/types/assistant-chat — TypeScript module paths, not routes. - Sidebar.tsx — no top-level AI entry existed to rename; /pilot is already in the History group's matchPaths. Whether FlowPilot deserves its own rail entry is a future UX decision, not Phase 1 scope. - FlowPilotAnalyticsPage at /analytics/flowpilot — analytics for the unified product, not guided-only, per the agreed Q16 interpretation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
91 lines
3.8 KiB
TypeScript
91 lines
3.8 KiB
TypeScript
import { useState, useEffect } from 'react'
|
|
import { Link, useNavigate } from 'react-router-dom'
|
|
import { Clock, ArrowRight, Route, MessageCircle } from 'lucide-react'
|
|
import { aiSessionsApi } from '@/api/aiSessions'
|
|
import type { AISessionSummary } from '@/types/ai-session'
|
|
import { cn } from '@/lib/utils'
|
|
import { timeAgo } from '@/lib/timeAgo'
|
|
|
|
export function ActiveFlowPilotSessions({ hideHeader = false }: { hideHeader?: boolean }) {
|
|
const [sessions, setSessions] = useState<AISessionSummary[]>([])
|
|
const [loading, setLoading] = useState(true)
|
|
const navigate = useNavigate()
|
|
|
|
useEffect(() => {
|
|
aiSessionsApi.listSessions({ status: 'active', limit: 6 })
|
|
.then(setSessions)
|
|
.catch(() => {})
|
|
.finally(() => setLoading(false))
|
|
}, [])
|
|
|
|
if (loading || sessions.length === 0) return null
|
|
|
|
return (
|
|
<div className="card-flat">
|
|
{!hideHeader && (
|
|
<div
|
|
className="flex items-center justify-between px-5 py-3"
|
|
style={{ borderBottom: '1px solid var(--color-border-default)' }}
|
|
>
|
|
<div className="flex items-center gap-2">
|
|
<h3 className="font-heading text-sm font-bold text-foreground">Active Sessions</h3>
|
|
{sessions.length > 0 && (
|
|
<span className="inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-accent-dim px-1.5 text-[0.625rem] font-bold text-primary">
|
|
{sessions.length}
|
|
</span>
|
|
)}
|
|
</div>
|
|
<Link
|
|
to="/sessions?filter=active"
|
|
className="flex items-center gap-1 text-[0.6875rem] text-muted-foreground hover:text-foreground transition-colors"
|
|
>
|
|
View all <ArrowRight size={10} />
|
|
</Link>
|
|
</div>
|
|
)}
|
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 p-4">
|
|
{sessions.map((session) => (
|
|
<button
|
|
key={session.id}
|
|
onClick={() => navigate(`/pilot/${session.id}`)}
|
|
className="card-interactive p-4 text-left"
|
|
>
|
|
<div className="flex items-start justify-between gap-2 mb-2">
|
|
{session.session_type === 'chat' ? (
|
|
<MessageCircle size={14} className="shrink-0 text-violet-400 mt-0.5" />
|
|
) : (
|
|
<Route size={14} className="shrink-0 text-primary mt-0.5" />
|
|
)}
|
|
<span
|
|
className={cn(
|
|
'font-sans text-[0.5625rem] uppercase px-1.5 py-0.5 rounded',
|
|
session.confidence_tier === 'guided' && 'bg-emerald-400/10 text-emerald-400',
|
|
session.confidence_tier === 'exploring' && 'bg-amber-400/10 text-amber-400',
|
|
session.confidence_tier === 'discovery' && 'bg-blue-400/10 text-blue-400',
|
|
!session.confidence_tier && 'bg-card text-muted-foreground',
|
|
)}
|
|
>
|
|
{session.confidence_tier || 'starting'}
|
|
</span>
|
|
</div>
|
|
<p className="text-sm font-medium text-foreground line-clamp-2">
|
|
{session.session_type === 'chat'
|
|
? (session.title || session.problem_summary || 'Chat in progress')
|
|
: (session.problem_summary || 'Session in progress')}
|
|
</p>
|
|
<div className="mt-2 flex items-center gap-2 text-[0.625rem] text-muted-foreground">
|
|
<span className="flex items-center gap-1">
|
|
<Clock size={10} />
|
|
{timeAgo(session.created_at)}
|
|
</span>
|
|
<span>·</span>
|
|
<span>{session.step_count} {session.session_type === 'chat' ? 'messages' : 'steps'}</span>
|
|
</div>
|
|
</button>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|