Architecture: Session 184.5: Fix AI panel architecture — shouldInject dete...
Documentation for Sessions
🏗️ Architecture: Session 184.5: Fix AI panel architecture — shouldInject dete...
Date: 2026-03-06
Time: 19:23:39 UTC
Session: gspace1-184.6
Agent: angular
Confidence: 92%
Status: ✅ Documented
📋 Decision Context
Question:
Session 184.5: Fix AI panel architecture — shouldInject detection, module boundary, auth state, extension header
Task: Fix AI panel architecture across all platforms
🎯 Decision Made
Chosen:
4 fixes: (1) shouldInject() now checks all 6 root selectors + port convention to prevent double-panel on GoGrab apps. (2) Moved AiPanelTabsComponent from ai-panel-core to vitto-chat, re-exported from ai-panel-core for backward compat. (3) Added isSleeping computed signal for auth-aware panel state. (4) Enhanced extension header with profile pill + close, inner close hidden when embedded.
Options Considered:
- Make vitto-chat buildable (rejected: cascading deps)
- Move AiPanelTabsComponent to vitto-chat with re-export (chosen)
- Create new non-buildable lib for the component (over-engineering)
💭 Reasoning
Root cause: shouldInject() only knew about 2 of 6 app root selectors, causing iframe injection on top of native panels. Module boundary: ai-panel-core (buildable) importing from vitto-chat (non-buildable) violates NX build graph — moving the component is simpler than making vitto-chat buildable (would cascade into many deps). Auth state: embedded panels without auth show empty UI with failing API calls — isSleeping computed from AuthService + URL params provides clear feedback. Extension header: was just a floating close button — now an inline bar with profile pill matching the app's design language.
📁 Files Involved
apps/vitto-chrome-extension/content/inject.jsapps/vitto-chrome-extension/styles/panel.csslibs/libs-ai/vitto-chat/src/lib/components/ai-panel-tabs/ai-panel-tabs.component.tslibs/libs-ai/vitto-chat/src/lib/components/ai-panel-tabs/ai-panel-tabs.component.htmllibs/libs-ai/vitto-chat/src/lib/components/ai-panel-tabs/ai-panel-tabs.component.scsslibs/libs-ai/vitto-chat/src/index.tslibs/libs-ai/ai-panel-core/src/index.tslibs/libs-ai/ai-panel-core/src/lib/services/ai-panel-core-state.service.ts
🔗 Related
- Decision ID:
dev_1772825019484_7vooxj6 - Session: 184
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation