import { useDemoMode } from '../../lib/operations/demo-mode'; import { EnvironmentLabel } from '@szl-holdings/shared-ui/alloy-decision-card'; import { SectionErrorBoundary } from '@szl-holdings/shared-ui/error-boundary'; import { useAuth } from '@szl-holdings/replit-auth-web'; import { GettingStartedChecklist, type OnboardingConfig, OnboardingWizard, useOnboardingState, } from '@szl-holdings/shared-ui/onboarding'; import { RealtimeStatusIndicator } from '@szl-holdings/shared-ui/realtime-status-indicator'; import { useSandboxMode } from '@szl-holdings/shared-ui/sandbox-mode'; import { ServiceStatusRail } from '@szl-holdings/shared-ui/service-status-rail'; import { useRealtimeChannel } from '@szl-holdings/shared-ui/use-realtime-channel'; import { cn } from '@szl-holdings/shared-ui/utils'; import { Activity, AlertTriangle, BarChart3, Bell, BellOff, BookOpen, Bot, Boxes, Brain, Building, Calculator, Calendar, CheckSquare, ChevronDown, Clapperboard, Code, Cpu, Database, DollarSign, Download, FileText, Flag, Gauge, GitBranch, Globe, Headphones, Heart, History, Inbox, Layers, LayoutDashboard, Menu, Monitor, Network, Phone, Play, Power, Radio, RotateCcw, Scale, Search, Send, Settings, Shield, Sliders, Target, TrendingUp, Users, Workflow, X, Zap, } from 'lucide-react'; import { type ReactNode, useState } from 'react'; import { Link, useLocation } from 'wouter'; const COMMAND_ONBOARDING_CONFIG: OnboardingConfig = { appId: 'command', appName: 'KORA', accentColor: '#d4a054', steps: [ { id: 'welcome', title: 'Welcome to Command', description: 'Command is your business observability command center — detecting operational risk, surfacing ownership gaps, and routing action before business damage occurs.', placement: 'center', icon: Zap, }, { id: 'prism', title: 'The PRISM Framework', description: "PRISM is Command's intelligence spine: Pulse (health), Risk (exposure), Intelligence (analysis), Signals (events), and Motion (action). Each dimension gives you a different lens on your business.", placement: 'center', icon: Activity, }, { id: 'signals', title: 'Signals Feed', description: 'Signals are cross-system events that matter — approval delays, ownership gaps, compliance exposure, SLA risks. Each signal carries evidence, confidence scores, and recommended next actions.', targetSelector: "a[href='/operations/prism/signals']", placement: 'right', icon: Radio, }, { id: 'inbox', title: 'Command Inbox', description: 'Your inbox surfaces the highest-priority items requiring your attention — ranked by business impact and urgency, not alert timestamp.', targetSelector: "a[href='/operations/inbox']", placement: 'right', icon: Inbox, }, { id: 'ownership', title: 'Ownership Intelligence', description: "See who owns what, what's unassigned, where handoffs break, and who's overloaded — the gaps that cause issues to fall through the cracks.", targetSelector: "a[href='/operations/ownership']", placement: 'right', icon: Users, }, ], checklist: [ { id: 'explore-prism', label: 'Explore the PRISM framework', description: 'Check all five intelligence dimensions', }, { id: 'check-signals', label: 'Review your signals feed', description: 'See cross-system events by urgency', }, { id: 'check-inbox', label: 'Clear your command inbox', description: 'Review high-priority action items', }, { id: 'check-ownership', label: 'Check ownership gaps', description: 'Review unassigned ownership areas', }, { id: 'configure-alerts', label: 'Configure alert thresholds', description: 'Set risk tolerance and routing rules', }, { id: 'explore-topology', label: 'Explore service topology', description: 'View system dependency relationships', }, ], }; const BG = { sidebar: '#060a12', header: 'rgba(6,10,18,0.85)', main: 'var(--gi-bg-base)' }; const BORDER = { subtle: 'rgba(255,255,255,0.04)', muted: 'rgba(255,255,255,0.06)' }; const TEXT = { primary: 'rgba(255,255,255,0.88)', secondary: 'rgba(255,255,255,0.5)', tertiary: 'rgba(255,255,255,0.28)', muted: 'rgba(255,255,255,0.14)', }; const PRISM_ITEMS = [ { key: 'P', label: 'Pulse', color: '#c9b787', icon: Heart, href: '/operations/prism/pulse' }, { key: 'R', label: 'Risk', color: '#c45a4a', icon: AlertTriangle, href: '/operations/prism/risk', }, { key: 'I', label: 'Intelligence', color: '#8b7ac8', icon: Brain, href: '/operations/prism/intelligence', }, { key: 'S', label: 'Signals', color: '#c8953c', icon: Radio, href: '/operations/prism/signals' }, { key: 'M', label: 'Motion', color: '#4a90b8', icon: Workflow, href: '/operations/prism/motion' }, ]; const NAV_GROUPS = [ { label: null, items: [ { href: '/operations', label: 'Exec Command', icon: LayoutDashboard }, { href: '/operations/demo-live', label: 'Live Demo', icon: Clapperboard }, ], }, { label: 'Core', items: [ { href: '/operations/board-mode', label: 'Board Mode', icon: LayoutDashboard }, { href: '/operations/blocker-board', label: 'Blocker Board', icon: AlertTriangle }, { href: '/operations/bottleneck-heatmap', label: 'Bottleneck Heatmap', icon: BarChart3 }, { href: '/operations/governed-decision-loop', label: 'Decision Loop', icon: Scale }, { href: '/operations/decision-receipts', label: 'Decision Receipts', icon: FileText }, { href: '/operations/digest', label: 'Digest Center', icon: FileText }, { href: '/operations/approvals', label: 'Approvals', icon: CheckSquare }, { href: '/operations/trust-audit', label: 'Trust & Audit', icon: Shield }, ], }, { label: 'Intelligence', items: [ { href: '/operations/prism/pulse', label: 'Pulse', icon: Heart }, { href: '/operations/prism/risk', label: 'Risk', icon: AlertTriangle }, { href: '/operations/prism/intelligence', label: 'Intelligence', icon: Brain }, { href: '/operations/prism/signals', label: 'Signals Feed', icon: Radio }, { href: '/operations/prism/motion', label: 'Motion', icon: Workflow }, { href: '/operations/living-topology', label: 'Living Topology', icon: Network }, { href: '/operations/ai-ops', label: 'AI Quality Dashboard', icon: Brain }, { href: '/operations/gpu-observatory', label: 'GPU & AI Observatory', icon: Cpu }, { href: '/operations/business-signals', label: 'Business Signals', icon: DollarSign }, { href: '/operations/predictive-intelligence', label: 'Predictive Intel', icon: TrendingUp }, { href: '/operations/cognitive-runtime', label: 'Cognitive Runtime', icon: Brain }, { href: '/operations/revenue-impact', label: 'Revenue Impact', icon: DollarSign }, { href: '/operations/self-healing', label: 'Self-Healing Ops', icon: RotateCcw }, { href: '/operations/failure-timeline', label: 'Failure Timeline', icon: TrendingUp }, { href: '/operations/client-value', label: 'Client Value', icon: Users }, { href: '/operations/ops-savings', label: 'Ops Savings', icon: Calculator }, { href: '/operations/escalation-intelligence', label: 'Escalation Intel', icon: Brain }, { href: '/operations/outcome-loop', label: 'Outcome Loop', icon: Activity }, { href: '/operations/defer-lane', label: 'Defer Lane', icon: Gauge }, { href: '/operations/shadow-mode', label: 'Shadow Mode', icon: Brain }, ], }, { label: 'Observability', items: [ { href: '/operations/slo', label: 'SLO / SLI Management', icon: Target }, { href: '/operations/finops', label: 'FinOps & Cloud Cost', icon: DollarSign }, { href: '/operations/tracing', label: 'Distributed Tracing', icon: GitBranch }, { href: '/operations/logs', label: 'Log Analytics', icon: Database }, { href: '/operations/on-call', label: 'On-Call Management', icon: Phone }, { href: '/operations/change-management', label: 'Change Intelligence', icon: Calendar }, { href: '/operations/synthetic', label: 'Synthetic Monitoring', icon: Globe }, { href: '/operations/capacity-planning', label: 'Capacity Planning', icon: Layers }, ], }, { label: 'Autonomous NOC', items: [ { href: '/operations/autonomous-noc', label: 'Autonomous NOC', icon: Bot }, { href: '/operations/noise-reduction', label: 'Noise Reduction', icon: BellOff }, { href: '/operations/knowledge-graph', label: 'Knowledge Graph', icon: Network }, { href: '/operations/runbook-studio', label: 'Runbook Studio', icon: BookOpen }, { href: '/operations/dex', label: 'DEX Scoring', icon: Monitor }, { href: '/operations/msp-command', label: 'MSP Command', icon: Building }, { href: '/operations/dev-feedback', label: 'Dev Feedback', icon: Code }, ], }, { label: 'Operations', items: [ { href: '/operations/inbox', label: 'Inbox', icon: Inbox }, { href: '/operations/explorer', label: 'Explorer', icon: Search }, { href: '/operations/topology', label: 'Topology', icon: Network }, { href: '/operations/logs', label: 'Log Explorer', icon: Database }, { href: '/operations/alert-management', label: 'Alert Management', icon: Bell }, { href: '/operations/executive-summary', label: 'Executive Summary', icon: BarChart3 }, { href: '/operations/ownership', label: 'Ownership', icon: Users }, { href: '/operations/workflows', label: 'Workflows', icon: Workflow }, { href: '/operations/readiness', label: 'Readiness', icon: Shield }, { href: '/operations/continuum/actions', label: 'Action Queue', icon: Activity }, { href: '/operations/continuum/templates', label: 'Templates', icon: Workflow }, { href: '/operations/continuum/gates', label: 'Write-Back Gates', icon: CheckSquare }, { href: '/operations/continuum/intelligence', label: 'Intelligence Fabric', icon: Zap }, { href: '/operations/continuum/canvas', label: 'Workflow Canvas', icon: Brain }, { href: '/operations/continuum/agents', label: 'Agent Monitor', icon: Radio }, { href: '/operations/continuum/traces', label: 'Execution Traces', icon: Activity }, { href: '/operations/continuum/governance', label: 'Governance', icon: Shield }, { href: '/operations/continuum/integrations', label: 'Integration Health', icon: Network }, { href: '/operations/continuum/compiler', label: 'Graph Compiler', icon: GitBranch }, { href: '/operations/continuum/replay', label: 'Replay Timeline', icon: Play }, { href: '/operations/continuum/simulate', label: 'Policy Simulator', icon: Shield }, { href: '/operations/continuum/handoffs', label: 'Agent Handoffs', icon: Send }, { href: '/operations/continuum/receipts', label: 'Trust Receipts', icon: FileText }, ], }, ]; const ADMIN_NAV = [ { href: '/operations/admin/ops', label: 'Ops Console', icon: Network }, { href: '/operations/admin/overview', label: 'System', icon: Settings }, { href: '/operations/admin/settings', label: 'Platform Settings', icon: Settings }, { href: '/operations/admin/tenant-health', label: 'Tenant Health', icon: Building }, { href: '/operations/admin/users', label: 'Users', icon: Users }, { href: '/operations/admin/flags', label: 'Flags', icon: Flag }, { href: '/operations/admin/runtime-config', label: 'Runtime Config', icon: Sliders }, { href: '/operations/admin/runtime-config/history', label: 'Runtime Config History', icon: History }, { href: '/operations/admin/apps', label: 'Apps', icon: Boxes }, { href: '/operations/admin/runs', label: 'Runs', icon: Play }, { href: '/operations/admin/approvals', label: 'Queue', icon: CheckSquare }, { href: '/operations/admin/audit', label: 'Audit', icon: FileText }, { href: '/operations/admin/exports', label: 'Exports', icon: Download }, { href: '/operations/admin/seeder', label: 'Seeder', icon: Database }, { href: '/operations/admin/jobs', label: 'Jobs', icon: Activity }, { href: '/operations/admin/kb', label: 'Knowledge Base', icon: BookOpen }, { href: '/operations/admin/support', label: 'Support Ops', icon: Headphones }, ]; const ADMIN_ROLES = ['admin', 'super_admin', 'ops']; const PRISM_COLORS: Record = { Pulse: '#d4a054', Risk: '#c45a4a', Intelligence: '#8b7ac8', Signals: '#c8953c', Motion: '#4a90b8', }; function NavItem({ href, icon: Icon, label, isActive, accent, onClick, }: { href: string; icon: any; label: string; isActive: boolean; accent?: string; onClick?: () => void; }) { return ( {isActive && (
)} {label} ); } function DemoModeToggle() { const { state, activate, deactivate } = useDemoMode(); const isActive = state.active; return (
); } function AdminSection({ location }: { location: string }) { const [open, setOpen] = useState(false); const { user } = useAuth(); const userRoles: string[] = (user as { roles?: string[] })?.roles ?? []; const isAdmin = userRoles.some((r) => ADMIN_ROLES.includes(r)); if (!isAdmin) return null; const isInAdmin = location.startsWith('/operations/admin'); if (!open && !isInAdmin) { return (
); } return (
{ADMIN_NAV.map((item) => { const isActive = location === item.href || location.startsWith(item.href + '/') || (item.href !== '/operations/admin' && location.startsWith(item.href)); return ( ); })}
); } export function CommandLayout({ children }: { children: ReactNode }) { const [location] = useLocation(); const [sidebarOpen, setSidebarOpen] = useState(false); const { status: wsStatus } = useRealtimeChannel('command-metrics'); const { replay: replayOnboarding } = useOnboardingState('command'); const { sandboxActive } = useSandboxMode(); const isDemoMode = sandboxActive || new URLSearchParams(window.location.search).get('demo') === 'true'; const { state: demoState } = useDemoMode(); const isLiveDemoActive = demoState.active; return (
Skip to main content {sidebarOpen && (
setSidebarOpen(false)} aria-hidden="true" /> )}
{isLiveDemoActive && (
Demo Mode — Synthetic data only · No live systems connected SEEDED
)}
Stephen Lutar
SZL Holdings
SL
{children}
); }