Commit Graph

123 Commits

Author SHA1 Message Date
9293aec301 feat: add Mood Activities editor to Web UI Status tab
Collapsible section in the Status tab with:
- Normal and Evil mood sections, each collapsible
- Per-mood expandable rows showing songs (🎵) and games (🎮)
- Inline editing: change type, name, weight
- Add/remove entries per mood
- Save via API with client-side validation
- Reload from disk button
- Lazy-loads data only when section is expanded
2026-04-24 13:46:04 +03:00
0f39ccd3c4 feat: set initial Discord presence on startup and on mood detection
- In on_ready(), set presence based on current mood (evil or normal)
  after all state is restored
- When LLM-detected mood shift is applied, update presence immediately
2026-04-24 13:39:39 +03:00
55c3c27f6f feat: integrate activity presence into evil mode
Update Discord presence when:
- Evil mood rotates (shows evil song/game)
- Evil mode is enabled (switches to evil activity pool)
- Evil mode is disabled (restores normal mood activity)
2026-04-24 13:37:21 +03:00
53c07d40e9 feat: integrate activity presence into mood rotation
Call update_bot_presence() in rotate_dm_mood() and
rotate_server_mood() so the Discord status updates whenever
a normal mood rotates automatically.
2026-04-24 13:35:03 +03:00
d6742b0c85 feat: add activities API routes and register in api.py
New endpoints:
- GET /activities — full data (normal + evil)
- GET /activities/{section}/{mood} — per-mood activities
- POST /activities/{section}/{mood} — update activities with validation
- POST /activities/reload — force reload from disk
2026-04-24 13:32:55 +03:00
a5916645df feat: add activities.py module for mood-based Discord presence
New module that loads activities.yaml and provides:
- Weighted random activity selection per mood
- Discord presence update (Listening/Playing)
- File mtime caching for hot-reload
- Validation for CRUD operations
- Fallback for moods with no activities defined
2026-04-24 13:30:54 +03:00
e30316f383 feat: add activities.yaml with mood-based songs and games
Curated list of Vocaloid/Miku songs and real game titles for each
normal mood (13 moods, excluding asleep) and each evil mood (10 moods).
Each entry has type (listening/playing), name, and weight for
weighted random selection. Editable via this file or the Web UI.
2026-04-24 13:20:47 +03:00
edc9f27925 feat: add proper HTTP status codes to all API error responses
- 217 error returns across 18 route files + api.py now use JSONResponse
  with appropriate HTTP status codes instead of returning HTTP 200
- Status code distribution: 500 (121), 400 (39), 503 (28), 404 (24), 409 (3), 502 (2)
- Fixed language.py tuple-return bug (was serializing as JSON array)
- Fixed bare except clauses in bipolar_mode.py and voice.py
- Body-level error schemas preserved (status/error + success/error patterns)
  so web UI continues working without changes
- chat.py (SSE) unchanged: errors sent within stream protocol
- All 170 tests pass
2026-04-15 15:43:18 +03:00
33b2033cc3 fix: clarify angry_wakeup_timer intent with TODO comment (Phase E Step 20)
- Change misleading 'Unused, kept for structural completeness' to
  'TODO: implement angry-wakeup mechanic or remove field'
- Field is dead code: never read or written in any Python code
2026-04-15 12:26:09 +03:00
fc4674bb13 refactor: extract media processing from bot.py into image_handling.py (Phase D Step 19)
- Create process_media_in_message() in utils/image_handling.py that handles all 4 media
  types: image attachments, video/GIF attachments, Tenor GIF embeds, and rich embeds
- DRY the send→log→bipolar tail pattern (5x repeated) into _send_log_bipolar() helper
- Unify rich/article/link embed handling to use rephrase_as_miku() instead of inline
  Cat→LLM routing, fixing a mood-resolution bug (was using globals.DM_MOOD for servers)
- Add 'rich_embed' media_type to rephrase_as_miku() prefix switch
- Remove 3 inline 'import base64' from bot.py (already module-level in image_handling.py)
- bot.py: 986 → 623 lines (-363)
- image_handling.py: 559 → 881 lines (+322)
- All 170 tests pass (21 config/state + 149 route split)
2026-04-15 12:19:37 +03:00
979217e7cc refactor: split api.py monolith into 19 route modules (Phase B)
Split 3,598-line api.py into thin orchestrator (128 lines) + 19 route
modules in bot/routes/:

  core.py (7 routes), mood.py (10), language.py (3), evil_mode.py (6),
  bipolar_mode.py (9), gpu.py (2), bot_actions.py (4), autonomous.py (13),
  profile_picture.py (26), manual_send.py (3), servers.py (6),
  figurines.py (5), dms.py (18), image_generation.py (4), chat.py (1),
  config.py (7), logging_config.py (9), voice.py (3), memory.py (10)

All 146 routes verified present via test_route_split.py (149 tests).
21/21 regression tests (test_config_state.py) pass.
Monolith backup: bot/api_monolith_backup.py (revert: cp it to api.py).
2026-04-15 11:38:14 +03:00
8b14160028 refactor: consolidate conversation_history to ConversationHistory class
Remove legacy globals.conversation_history (defaultdict of deques) and
route all callers through utils.conversation_history.ConversationHistory:

- globals.py: remove conversation_history + unused collections imports
- llm.py: remove backward-compat dual-write to legacy system
- api.py: /conversation/{user_id} now reads from ConversationHistory
- actions.py: reset_conversation uses clear_channel()
- figurine_notifier.py: use add_message() instead of buggy setdefault()
- bipolar_mode.py: fix clear_history -> clear_channel (was AttributeError
  silently swallowed by bare except), fix bare except -> except Exception
2026-04-11 00:21:44 +03:00
02686c3b96 fix: PREFER_AMD_GPU now lives in globals so config API changes affect GPU routing
Previously gpu_router.py had its own module-level PREFER_AMD_GPU constant
that was frozen at import time. The config API wrote to globals.PREFER_AMD_GPU
which didn't exist, so runtime GPU preference changes never took effect.

Now globals.py owns PREFER_AMD_GPU and gpu_router reads it from there.
2026-04-10 23:53:14 +03:00
366bee2e43 test: add regression test suite for config/state hardening (steps 1-10)
21 tests across 6 groups:
A. Config loading & persistence (runtime path, YAML schema, overrides)
B. Runtime state (live globals reading, /config/set sync, restore)
C. Reset (full reset, single-key reset)
D. Server manager (zero-server default, corrupt handling, CRUD, no dead code)
E. GPU deduplication (delegates to config_manager, correct URL switching)
F. Clean imports (no dead os/Union/GUILD_SETTINGS)

Run: ./bot/tests/run_tests.sh (builds + runs in Docker container)
2026-04-10 17:30:14 +03:00
5ac1f7fa8c cleanup: remove dead code + deduplicate GPU state reads
Dead code removed:
- globals.py: GUILD_SETTINGS (empty dict, zero consumers)
- config.py: unused 'import os'
- config_manager.py: unused 'import os' and 'Union'
- server_manager.py: duplicate 'from datetime import datetime, timedelta'

GPU deduplication:
- get_current_gpu_url() now delegates to config_manager.get_gpu()
- get_gpu_status() endpoint now delegates to config_manager.get_gpu()
- Both previously re-read memory/gpu_state.json directly
2026-04-09 20:34:17 +03:00
834b2ea188 fix: start with zero servers when config is missing or corrupt
Removed _create_default_config() which hardcoded a specific guild ID
(759889672804630530) as a fallback. Now:
- Missing servers_config.json → starts with empty servers dict
- Corrupt JSON → logs error, starts with empty servers dict
- Servers are added via the API/dashboard, not by magic defaults

All code that iterates server_manager.servers handles empty dicts safely.
2026-04-09 20:15:57 +03:00
7804aa4d76 cleanup: remove dead server_memories code
The server_memories dict and its methods (get_server_memory,
set_server_memory) plus API endpoints (GET/POST /servers/{guild_id}/memory)
were never called by any bot logic, command, or frontend code.

All per-server state is stored as ServerConfig dataclass fields and
persisted via servers_config.json. The generic key-value store was an
unfinished scaffolding feature superseded by the dataclass approach.
2026-04-09 20:10:53 +03:00
5c5c9e2723 cleanup: remove dead server config methods from config_manager
get_server_config() and set_server_config() in ConfigManager had zero
callers — every part of the codebase already uses the server_manager
singleton. Removing them eliminates the risk of a stale write that
bypasses the in-memory cache in ServerManager.

server_manager is now the sole owner of servers_config.json.
2026-04-08 15:47:36 +03:00
b4e48ce375 fix: /config/set now syncs all runtime-relevant globals
Previously only 4 of 5+ settings were synced to globals when set via
the generic /config/set endpoint. Added:
- memory.use_cheshire_cat -> globals.USE_CHESHIRE_CAT
- runtime.mood.dm_mood -> globals.DM_MOOD + DM_MOOD_DESCRIPTION
- Uses same _GLOBALS_SYNC mapping pattern as restore_runtime_settings
2026-04-08 15:05:25 +03:00
7c9cf0d8b4 fix: /config/reset now resets live globals to defaults
reset_to_defaults() previously only cleared the runtime_config dict and
saved config_runtime.yaml, but never touched the actual globals that
control runtime behavior. After a reset, LANGUAGE_MODE, AUTONOMOUS_DEBUG,
VOICE_DEBUG_MODE, USE_CHESHIRE_CAT, PREFER_AMD_GPU, and DM_MOOD all kept
their current in-memory values until the next restart.

Now reset_to_defaults() also resets the corresponding globals to their
default values from CONFIG (the static config loaded from config.yaml).
Both full reset and single-key reset are supported. The default values
come from the Pydantic AppConfig schema, ensuring consistency.

Tested: set non-default values, full reset -> all back to defaults,
single-key reset -> only that key back to default, runtime_state property
reflects the reset immediately.
2026-04-08 14:58:29 +03:00
9be7c0b1d2 fix: make /config/state return live runtime values from globals
config_manager.runtime_state was a plain dict initialized with hardcoded
defaults (dm_mood='neutral', evil_mode=False, etc.) that were never updated
by any code path except current_gpu. The /config/state endpoint and
get_full_config() both returned this stale dict, so the API always reported
neutral mood and english mode regardless of actual state.

Replaced the static dict with a @property that reads live values from
globals (DM_MOOD, EVIL_MODE, BIPOLAR_MODE, LANGUAGE_MODE) on every access.
GPU state is still managed via _current_gpu and persisted to gpu_state.json.

get_state() and set_state() continue to work for the GPU path.
2026-04-08 14:53:13 +03:00
0831f721e1 cleanup: remove dead backward-compat globals from config.py
Removed the Config Manager Integration block and all 19 backward-compat
variable re-exports (LLAMA_URL, CHESHIRE_CAT_URL, LANGUAGE_MODE, etc.)
from config.py. These were dead code because:

1. Circular import: config.py tried to import config_manager at module
   level, but config_manager.py imports from config.py first, so
   HAS_CONFIG_MANAGER was always False and _get_config_value() was a
   no-op that always returned the static value.

2. Frozen snapshots: Even if the circular import worked, the values were
   assigned to module-level names at import time and never updated. Other
   modules importing 'from config import LLAMA_URL' would get a stale
   snapshot, not a live value.

3. Nothing imports them: The entire codebase uses globals.py for mutable
   runtime state, not these config.py copies. Only ERROR_WEBHOOK_URL was
   imported (by error_handler.py), so it is kept as a simple re-export
   from SECRETS.

Also cleaned up unused imports: Any, field_validator.

Japanese mode is NOT affected — LANGUAGE_MODE and JAPANESE_TEXT_MODEL live
in globals.py and are untouched.
2026-04-08 14:40:16 +03:00
742b7b6b64 fix: persist config_runtime.yaml inside volume-mounted memory dir
config_runtime.yaml was written to the container root (/) because the path
resolved via Path(__file__).parent.parent from /app/config_manager.py = /.
This location is not volume-mounted, so all runtime config changes (language,
debug flags, Cheshire Cat toggle, mood, GPU preference) were lost on every
container restart.

Moved runtime_config_path to memory/config_runtime.yaml, which lives inside
the volume-mounted ./bot/memory:/app/memory directory and persists across
restarts. Also reordered __init__ so memory_dir is initialized before
runtime_config_path depends on it.
2026-04-08 14:14:31 +03:00
f50c677baf ui: move Re-crop Current button under cropped avatar preview in tab11
Relocated the button from the top action row to below the '512x512
displayed as circle' label for more intuitive placement next to the
avatar it acts on.
2026-03-31 15:16:40 +03:00
56a70705b2 feat: add PFP album/gallery system with batch upload, cropping, and disk management
- Backend: album storage in memory/profile_pictures/album/{uuid}/ with
  original.png, cropped.png, and metadata.json per entry
- add_to_album/add_batch_to_album with efficient resource management
  (vision model + face detector kept alive across batch)
- set_album_entry_as_current auto-archives current PFP before replacing
- manual/auto crop album entries without applying to Discord
- Disk usage tracking, single & bulk delete
- API: full CRUD endpoints under /profile-picture/album/*
- Frontend: collapsible album grid in tab11 with thumbnail cards,
  multi-select checkboxes for bulk delete, detail panel with crop
  interface (Cropper.js), description editor, set-as-current action
2026-03-31 15:09:57 +03:00
f092cadb9d feat: add Profile Picture Management tab with manual crop, description editor
- profile_picture_manager.py:
  - Add ORIGINAL_PATH constant; save full-res original before every crop
  - Add skip_crop param to change_profile_picture() for manual crop workflow
  - Add manual_crop(x,y,w,h) method with Discord avatar update + role color sync
  - Add auto_crop_only() to re-run face-detection crop on stored original
  - Add update_description() with Cheshire Cat declarative memory re-injection
  - Add regenerate_description() via vision model
  - Skip crop step if image is already at/below 512x512

- api.py:
  - GET /profile-picture/image/original — serve full-res original (no-cache)
  - GET /profile-picture/image/current  — serve current cropped avatar (no-cache)
  - POST /profile-picture/change-no-crop — acquire image, skip auto-crop
  - POST /profile-picture/manual-crop   — apply crop coords {x,y,width,height}
  - POST /profile-picture/auto-crop     — re-run intelligent crop on original
  - POST /profile-picture/description   — save freeform description + Cat inject
  - POST /profile-picture/regenerate-description — re-generate via vision model
  - GET  /profile-picture/description   — fetch current description text

- index.html:
  - Add new tab11 '🖼️ Profile Picture Management'
  - Remove PFP + role color sections from Actions tab (tab2)
  - Add Cropper.js 1.6.2 via CDN for manual square crop
  - Tab layout: action buttons, file upload, auto/manual crop toggle,
    Cropper.js interface, side-by-side original/cropped previews,
    role color management, freeform description editor, metadata box (bottom)
  - Wire switchTab hook for tab11 → loadPfpTab()
  - All new JS functions: pfpChangeDanbooru, pfpUploadCustom, pfpRestoreFallback,
    pfpShowCropInterface, pfpApplyManualCrop, pfpApplyAutoCrop, pfpSaveDescription,
    pfpRegenerateDescription, pfpRefreshPreviews, setCustomRoleColor, resetRoleColor
2026-03-30 15:10:19 +03:00
08fb465c67 Fix: Cache regular Miku avatar URL to prevent pfp bleed in bipolar arguments
When Evil Mode activates, the bot's Discord account avatar is changed to evil_pfp.png.
Previously, get_persona_avatar_urls() would read this swapped avatar and pass it to
the Miku webhook, causing both webhooks to display Evil Miku's pfp.

Now caching the regular Miku CDN URL before Evil Mode changes the bot's avatar.
When Evil Mode is active, the cached URL is used instead of reading from the bot
account. Discord CDN URLs remain valid after avatar changes, so this reliably
preserves the correct pfp for both regular and Evil Miku webhooks during arguments.

- Added MIKU_NORMAL_AVATAR_URL global in bot/globals.py
- Updated get_persona_avatar_urls() to cache and return the cached URL
- Save the normal avatar URL before Evil Mode switches the bot's avatar
2026-03-30 14:30:34 +03:00
e6529f1bc3 added check to only crop pfp if > minimum Discord pfp resolution 2026-03-30 12:50:34 +03:00
54d9a80089 fixed webhook pfp for regular miku being wrong when evil mode active 2026-03-05 22:16:14 +02:00
d5b9964ce7 Fix vision pipeline: route images through Cat, pass user question to vision model
- Fix silent None return in analyze_image_with_vision exception handler
- Add None/empty guards after vision analysis in bot.py (image, video, GIF, Tenor)
- Route all image/video/GIF responses through Cheshire Cat pipeline (was
  calling query_llama directly), enabling episodic memory storage for media
  interactions and correct Last Prompt display in Web UI
- Add media_type parameter to cat_adapter.query() and forward as
  discord_media_type in WebSocket payload
- Update discord_bridge plugin to read media_type from payload and inject
  MEDIA NOTE into system prefix in before_agent_starts hook
- Add _extract_vision_question() helper to strip Discord mentions and bot-name
  triggers from user message; pass cleaned question to vision model so specific
  questions (e.g. 'what is the person wearing?') go directly to the vision model
  instead of the generic 'Describe this image in detail.' fallback
- Pass user_prompt to all analyze_image_with_qwen / analyze_video_with_vision
  call sites in bot.py (image, video, GIF, Tenor, embed paths)
- Fix autonomous reaction loops skipping messages that @mention the bot or have
  media attachments in DMs, preventing duplicate vision model calls for images
  already being processed by the main message handler
- Increase vision max_tokens: images 300->800, video/GIF 400->1000 (no VRAM
  impact; KV cache is pre-allocated at model load time)
2026-03-05 21:59:27 +02:00
335b58a867 feat: fix evil mode race conditions, expand moods and PFP detection
bipolar_mode.py:
- Replace unsafe globals.EVIL_MODE temporary overrides with
  force_evil_context parameter to fix async race conditions (3 sites)

moods.py:
- Add 6 new evil mood emojis: bored, manic, jealous, melancholic,
  playful_cruel, contemptuous
- Refactor rotate_dm_mood() to skip when evil mode active (evil mode
  has its own independent 2-hour rotation timer)

persona_dialogue.py:
- Same force_evil_context race condition fix (2 sites)
- Fix over-aggressive response cleanup that stripped common words
  (YES/NO/HIGH) — now uses targeted regex for structural markers only
- Update evil mood multipliers to match new mood set

profile_picture_context:
- Expand PFP detection regex for broader coverage (appearance questions,
  opinion queries, selection/change questions)
- Add plugin.json metadata file
2026-03-04 00:45:23 +02:00
5898b0eb3b fix: update .gitignore to cover all bot/memory subdirs, untrack runtime data
- Change bot/memory/*.json to bot/memory/** to properly ignore all
  subdirectories (dms/, dm_reports/, profile_pictures/)
- Untrack bot/memory/ files from index (DMs, profile pics, dm reports)
- Untrack cheshire-cat discord_bridge __pycache__/*.pyc from index
- These files are runtime/user data that should never be in version control
2026-03-04 00:43:10 +02:00
fdde12c03d reorganize: move all test scripts to tests/ directory
- Moved 8 root-level test scripts + 2 from bot/ to tests/
- Moved run_rocinante_test.sh runner script to tests/
- Added tests/README.md documenting each test's purpose, type, and requirements
- Added test_pfp_context.py and test_rocinante_comparison.py (previously untracked)
2026-03-04 00:18:21 +02:00
431f675fc7 cleanup: update .gitignore, sanitize .env.example, remove stale files
- Expanded .gitignore: miku-app/, dashboard/, .continue/, *.code-workspace,
  cheshire-cat artifacts (venv, benchmarks, test output), jinja templates
- Sanitized .env.example: replaced real webhook URL and user ID with placeholders
- Removed SECRETS_CONFIGURED.md (contained sensitive token info)
- Removed bot/static/system.html.bak (stale backup)
- Removed bot/utils/voice_receiver.py.old (superseded)
2026-03-04 00:17:05 +02:00
a226bc41df Rewrite is_miku_addressed() to only trigger when addressed, not mentioned
- Pre-compile 393 name variants into 4 regex patterns at module load
  (was 7,300+ raw re.search() calls per message)
- Strict addressing detection using punctuation context:
  START:  name at beginning + punctuation (Miku, ... / みく!...)
  END:    comma + name at end (..., Miku / ...、ミク)
  MIDDLE: commas on both sides - vocative (..., Miku, ...)
  ALONE:  name is the entire message (Miku! / ミクちゃん)
- Rejects mere mentions: 'I like Miku' / 'Miku is cool' no longer trigger
- Script-family-aware pattern generation (Latin, Cyrillic, Japanese)
  eliminates nonsensical cross-script combos (e.g. o-みく)
- Word boundary enforcement prevents substring matches (mikumiku)
- Fixes regex 'unbalanced parenthesis' errors from old implementation
- Add comprehensive test suite (94 cases, all passing)
2026-03-03 12:42:33 +02:00
892edf5564 feat: Last Prompt shows full prompt with evil mode awareness
- discord_bridge before_agent_starts now checks evil_mode from
  working_memory to load the correct personality files:
  Normal: miku_lore/prompt/lyrics + /app/moods/{mood}.txt
  Evil: evil_miku_lore/prompt/lyrics + /app/moods/evil/{mood}.txt
- Reads files directly instead of relying on cross-plugin working_memory
- cat_client.query() returns (response, full_prompt) tuple
- Full prompt includes system prefix + recalled memories + conversation
- API /prompt/cat returns full_prompt field
2026-03-01 01:17:06 +02:00
a0a16e6784 fix: resolve Cat personality startup race condition
Bot was calling restore_evil_cat_state() in on_ready() before Cheshire
Cat finished booting (~25s), causing all plugin toggle API calls to fail
silently. Evil Miku plugin was left disabled and the bot used Cat's
default personality instead.

Changes:
- cat_client.py: add wait_for_ready() that polls Cat health endpoint
  every 5s for up to 120s before attempting any admin API calls
- evil_mode.py: rewrite restore_evil_cat_state() with:
  - wait_for_ready() gate before any plugin/model switching
  - 3-second extra delay after Cat is up (plugin registry fully loaded)
  - up to 3 retries on failure
  - post-switch verification that the correct plugins are actually active

Also fixes helcyon model references that leaked into the container image
(cat_client.py was switching Cat's LLM to 'helcyon' which has no
llama-swap handler; reverted to correct 'darkidol' / 'llama3.1').
2026-03-01 00:57:13 +02:00
f0b5d71097 feat: add loading spinners on tab switch for data-driven tabs
Show a CSS spinner overlay when switching to Autonomous Stats (tab6),
Memories (tab9), and DM Management (tab10). Spinner only shows on
first visit when content is empty, removed after data loads.
2026-03-01 00:29:03 +02:00
0cdf26dc34 feat: populate all mood dropdowns dynamically from API
Replace hardcoded <option> lists in #mood (tab1 DM mood) and
#chat-mood-select (tab7 chat mood) with empty selects populated
by populateMoodDropdowns(). Respects evil mode emoji mapping.
Called on DOMContentLoaded and after server cards render.
2026-03-01 00:28:07 +02:00
1037d13b0a feat: reorganize tabs + add Last Prompt CC/Fallback toggle
- Split Status tab: moved DM management to new dedicated 📱 DM Management tab
- Added Last Prompt source toggle (Cheshire Cat / Bot Fallback) with
  localStorage persistence, CC as default
- Backend: added LAST_CAT_INTERACTION global, /prompt/cat API endpoint
- Bot tracks Cat interactions (prompt, response, user, mood, timestamp)
- Auto-load data on tab switch (Status loads prompt, DM tab loads users)
2026-03-01 00:26:22 +02:00
5bdd907730 refactor: standardize raw fetch() calls to use apiCall() wrapper
Convert 47 raw fetch+response.json+error-handling patterns to use the
centralized apiCall() utility. The 11 remaining raw fetch() calls are
FormData uploads or SSE streaming that require direct fetch access.
2026-03-01 00:14:08 +02:00
820a226dd9 refactor: consolidate 3 DOMContentLoaded listeners into single init block
- Extract initTabState, initTabWheelScroll, initVisibilityPolling,
  initChatImagePreview, initModalAccessibility as named functions
- Move polling interval vars to outer scope for accessibility
- Single DOMContentLoaded calls all init functions in logical order
- Replace scattered listeners with comment markers at original locations
2026-02-28 23:50:40 +02:00
e0dc190710 feat: add responsive CSS breakpoints for mobile and tablet support
- 1200px: Adjust panel widths to 55/45
- 1024px: Stack panels vertically, logs below main content
- 768px: Tab buttons flow into auto-fill grid rows
- 480px: Two-column tab grid, reduced padding for small screens
2026-02-28 23:48:23 +02:00
191a368258 fix: prevent XSS in addChatMessage by using textContent for user input
- Escape sender name via escapeHtml in innerHTML template
- Set message content via textContent instead of innerHTML injection
- Prevents HTML/script injection from user input or LLM responses
2026-02-28 23:32:28 +02:00
7a10206617 feat: modal UX - close on Escape key and backdrop click, add ARIA attributes
- Escape key closes any open memory modal
- Clicking the dark backdrop behind a modal closes it
- Add role=dialog, aria-modal, aria-label for accessibility
2026-02-28 23:31:28 +02:00
8b96f4dc8a cleanup: remove duplicate escapeHtml function, add null check to remaining one 2026-02-28 23:30:05 +02:00
4666986f78 cleanup: remove ~70 lines of duplicate CSS for conversation view styles
First block of conversation-view, conversations-list, conversation-message,
message-header, sender, timestamp, message-content, message-attachments was
silently overridden by identical selectors defined later. Kept the unique
reaction/delete-button styles.
2026-02-28 23:29:15 +02:00
5e002004cc fix: notification system - timer race condition, success color, z-index above modals
- Cancel previous timer before starting new one (prevents early dismissal)
- Add green background for type='success' notifications
- Bump z-index from 1000 to 3000 so notifications show above modals
- Add fade-out transition for smoother dismissal
2026-02-28 23:28:30 +02:00
d3fb0eacb6 fix: updateBedtimeRange variable scoping - originalText accessible in finally block 2026-02-28 23:26:02 +02:00
7bcb670b96 perf: pause polling intervals when browser tab is hidden
- Replace raw setInterval with startPolling/stopPolling functions
- Add visibilitychange listener to pause when tab is hidden
- Immediately refresh data when tab becomes visible again
- Saves bandwidth and CPU when the dashboard is in background
2026-02-28 23:25:07 +02:00