Refactor: How to eliminate the duplicate VittoApiService and BrainCont...

Documentation for Sessions

♻️ Refactor: How to eliminate the duplicate VittoApiService and BrainCont...

Date: 2026-03-03
Time: 00:29:23 UTC
Session: gspace1-165.18
Agent: angular
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

How to eliminate the duplicate VittoApiService and BrainContextService files between vitto-hub and vitto-core?

Task: Eliminate duplicate service files and fix broken redo + governance


🎯 Decision Made

Chosen:

Replaced the 1128-line VittoApiService and 87-line BrainContextService files in vitto-hub with thin re-export wrappers that forward to @libs-ai/vitto-core. Also re-exported types (ComputerUseSession, GoalHistoryEntry, SupervisionStatus, BrainUserInfo) that vitto-hub components need. Disabled the broken redo() implementation with clear TODO. Wired Governance segment autonomy selector to updateVittoConfig() API.

Options Considered:


💭 Reasoning

Duplicate source files are a silent divergence risk — edits to one copy won't affect the other, causing subtle bugs. The 32 internal vitto-hub components use relative imports to the local service files, so we can't delete them. But we CAN replace them with one-line re-exports from vitto-core, making vitto-core the single source of truth while preserving all relative import paths. The redo stub was actively dangerous — it re-pushed to history without making the forward API call, which would desync server and client state. Better to disable it honestly than ship a broken feature.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation