- Added SWITCHER_TOGGLE message type (8) for reprocessing last user message with active switchers
- Backend: Handler fetches last user question from DB, mutates message in-place, injects switcher prompts into system_prompt
- Backend: Switcher replays skip message_history save to avoid duplication
- Frontend: toggleSwitcher() sends SWITCHER_TOGGLE when input empty, sendMessage() when text present
- Frontend: Added TOOL_EXEC and SWITCHER_TOGGLE to MessageType constants
- Fixed session_id shadowing bug in DB query (used session_id_for_query)
- Preserves conversation history for LLM context when reprocessing with switchers
- Split partials/chat.html (1513→70 lines) into 8 JS modules:
chat-state.js, chat-switchers.js, chat-mentions.js,
chat-messages.js, chat-suggestions.js, chat-theme.js,
chat-websocket.js, chat-init.js
- Centralized state in ChatState global object
- Switcher chips auto-activate on switch_context suggestion action
- active_switchers sent in every WS message payload
- Removed old chat-main.js (merged into modules)
- Split vibe.html into vibe/ module directory with CSS extraction
- Updated standalone chat/chat.html to use same modules
- Event listeners were lost when renderSwitchers() re-created DOM
- Now using event delegation on parent container
- Listener attached once, persists across re-renders
- Added logging to verify active_switchers payload
Fixes switcher toggle not persisting and LLM modifier not being sent.
- chat.html reduced from 1623 lines to 59 lines
- Created chat-switchers.js for switcher state management
- Created chat-messages.js for message rendering
- Created chat-main.js for initialization and coordination
- Added console logging to debug switcher toggle functionality
- Follows AGENTS.md 450-line limit rule
- Detect HTML content (starts with <) in streaming messages and
bypass marked.parse() to render directly as innerHTML
- marked.parse() was corrupting the LLM's raw HTML output by
treating it as Markdown (escaping tags, wrapping in <p>, etc.)
- Updated PROMPT.md for Salesianos to be more explicit about
returning ramal data directly from KB context without asking
for unnecessary clarification
- Fixed ramais.bas tool (removed invalid BEGIN/END syntax)