Commit Graph

80 Commits

Author SHA1 Message Date
d4adbde3df Fix issues #6, #7, #11, #12, #13: med reminders, push notifications, auth persistence, scheduling conflicts
- Fix TIME object vs string comparison in scheduler preventing adaptive med
  reminders from ever firing (#12, #6)
- Add frequency filtering to midnight schedule creation for every_n_days meds
- Require start_date and interval_days for every_n_days medications
- Add refresh token support (30-day) to API and bot for persistent sessions (#13)
- Add "trusted device" checkbox to frontend login for long-lived sessions (#7)
- Auto-refresh expired tokens in both bot (apiRequest) and frontend (api.ts)
- Restore bot sessions from cache on restart using refresh tokens
- Duration-aware routine scheduling conflict detection (#11)
- Add conflict check when starting routine sessions against medication times
- Add diagnostic logging to notification delivery channels

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:05:48 -06:00
6850abf7d2 fix partial-update overwrite bug in snitch and adaptive meds PUT handlers
Both handlers were building update_data with defaults for every field,
so a partial save (e.g. toggling one toggle) would silently reset all
other settings back to their defaults. Now only fields explicitly
present in the request body are written to the DB.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-17 19:05:09 -06:00
f826e511d5 fixing snitch and adaptive medication timing persistance and logic 2026-02-17 18:52:35 -06:00
cf2b4be033 med scheduling fixes 2026-02-17 18:33:43 -06:00
8ac7a5129a fixed spamming i hope 2026-02-17 18:11:44 -06:00
80ebecf0b1 Changes Made
1. config/schema.sql — Added timezone_name VARCHAR(100) to user_preferences table + an ALTER TABLE migration at the bottom for existing DBs.
  2. core/tz.py — Rewrote with dual-path timezone support:
  - Request context: _get_request_tz() now checks X-Timezone-Name header (IANA) first, falls back to X-Timezone-Offset
  - Background jobs: New tz_for_user(user_uuid) and user_now_for(user_uuid) read stored timezone_name from prefs, fall back to numeric offset, then UTC
  - All existing function signatures (user_now(), user_today()) preserved for backward compat

  3. scheduler/daemon.py — Fixed 3 bugs:
  - _user_now_for() now delegates to tz.user_now_for() which uses IANA timezone names (DST-safe)
  - check_nagging() — replaced datetime.utcnow() with _user_now_for(user_uuid) so nags evaluate in user's timezone
  - poll_callback() — replaced single UTC midnight check with _check_per_user_midnight_schedules() that iterates users and creates daily schedules at their local midnight

  4. api/routes/preferences.py — Added "timezone_name" to allowed PUT fields.

  5. synculous-client/src/lib/api.ts — Added X-Timezone-Name header to every request + added timezone_name to preferences update type.

  6. synculous-client/src/app/dashboard/layout.tsx — Now syncs both timezone_offset and timezone_name (via Intl.DateTimeFormat().resolvedOptions().timeZone) on session start.
2026-02-17 18:02:07 -06:00
0e28e1ac9d logo update from ai logo to human made 2026-02-17 16:43:23 -06:00
ac27a9fb69 you can pick your friends but you shouldnt pick your skin 2026-02-17 03:39:43 -06:00
d673d73530 opus pass 2 2026-02-17 00:30:05 -06:00
123a7ce3e7 claude bugpass 2026-02-17 00:20:06 -06:00
Chelsea
3d3b80fe96 partial 2026-02-17 05:46:59 +00:00
Chelsea
596467628f feat: add Discord presence status indicator in settings
Add a visual status indicator showing:
- Online/offline status with colored dot indicator
- Last seen timestamp
- Typical wake time (if available)

The indicator now displays whenever Discord notifications are enabled,
not just when presence tracking is active.
2026-02-17 04:37:13 +00:00
Chelsea
a0126d0aba fix: include adaptive_mode when enabling adaptive timing toggle
The API requires adaptive_mode when adaptive_timing_enabled is true,
but the frontend was only sending the enabled flag. This caused 400
errors when users tried to toggle adaptive timing on.

Now the toggle sends both fields when enabling, satisfying the API
validation requirements.
2026-02-17 04:35:55 +00:00
Chelsea
a2c7940a5c Fix issues #8, #9, #10, #11: scheduling conflicts, med reminders, adaptive timing, nagging
- #11: Add validation to prevent simultaneous scheduling of routines and medications
  - Added _check_schedule_conflicts() in routines.py
  - Added _check_med_schedule_conflicts() in medications.py
  - Returns HTTP 409 with descriptive error on conflict

- #10: Fix medication reminders not being sent
  - Added call to check_adaptive_medication_reminders() in daemon poll loop

- #9: Fix can't enable adaptive timing
  - Added proper error handling and logging in update_adaptive_settings()
  - Returns meaningful error message on database failures

- #8: Fix nagging not working
  - Added debug logging for missing settings
  - Auto-create medication schedules if they don't exist
  - Improved error logging (warning -> error)
2026-02-17 04:20:34 +00:00
3aad7a4867 Fix snitch test to actually insert a log entry that the bot will send 2026-02-16 21:20:25 -06:00
98706702da Fix snitch test to not send to wrong user, implement Discord DM sending for snitches 2026-02-16 21:16:33 -06:00
1d79516794 Temporarily disable adaptive medication check until database migration is run 2026-02-16 21:09:05 -06:00
f740fe8be2 Add fallback to original medication reminders when adaptive tables don't exist 2026-02-16 21:02:34 -06:00
6e875186b4 Fix datetime import and add database migration script 2026-02-16 20:21:07 -06:00
35f51e6d27 Add complete snitch system UI to settings page with contact management and consent flow 2026-02-16 20:16:29 -06:00
a6ae4e13fd Add complete snitch feature with contact management, consent system, and notification delivery 2026-02-16 20:14:03 -06:00
69163a37d1 Add complete UI for adaptive medication settings with presence tracking and nagging configuration 2026-02-16 20:04:58 -06:00
84c6032dc9 Register adaptive medication API routes 2026-02-16 20:01:27 -06:00
d4fb41ae6b Add adaptive medication timing, Discord presence tracking, and nagging system 2026-02-16 20:00:53 -06:00
1ed187b0dd Properly merge original Discord bot with JurySystem DBT integration 2026-02-16 19:29:35 -06:00
2feaf0cdc0 Convert JurySystem to Discord bot 2026-02-16 19:26:16 -06:00
09d453017c Update embedding file path in config 2026-02-16 19:22:58 -06:00
833800842a Add config.json for JurySystem with OpenRouter API key 2026-02-16 19:20:40 -06:00
e4e6ad44ac Fix datetime comparison error in victories API 2026-02-16 19:14:36 -06:00
c7be19611a Merge branch 'main' of https://git.scorpi.us/chelsea/Synculous-2 2026-02-16 19:08:19 -06:00
b1bb05e879 Fix knowledge base loader to handle list format embeddings
Handle both dict and list formats in load_knowledge_base function to fix AttributeError
2026-02-16 19:06:31 -06:00
Bongobutt
b3dab95cf9 Please enter the commit message for your changes. Lines starting 2026-02-16 18:58:35 -06:00
Bongobutt
d5737e97bf fixe 2026-02-16 18:52:38 -06:00
Bongobutt
ad0faf72e1 i sniffed the wrong week to quit picking glue. 2026-02-16 18:51:15 -06:00
832c1e1a23 i bliggleblorfed 2026-02-16 14:00:18 -06:00
c693572069 ms potato head 2026-02-16 13:44:33 -06:00
028bdfa4f9 mr potato head 2026-02-16 13:42:24 -06:00
a395f221cc i quit the wrong week the pick sniffing glue 2026-02-16 13:29:44 -06:00
f140f8f75c no 2026-02-16 13:16:18 -06:00
d262d80199 debug: add API call logging to medication take action 2026-02-16 12:46:22 -06:00
382e62cee7 fix: add missing await in parse retry call 2026-02-16 12:40:25 -06:00
79fe51392d fix(api): auto-determine scheduled_time when logging medications 2026-02-16 12:37:08 -06:00
7cf0681deb debug: add logging and partial name matching for med context lookup 2026-02-16 12:30:25 -06:00
a53187d6a9 fix: make AI parser async to prevent Discord heartbeat blocking 2026-02-16 12:24:13 -06:00
9cc2f19ce8 fix: include scheduled_time when logging medication intake from reminders 2026-02-16 12:13:25 -06:00
398e1ce334 fix: correct embedding model name from l2 to v2 2026-02-16 11:32:06 -06:00
d407a4bd9d Add knowledge base RAG module for book Q&A 2026-02-16 11:27:48 -06:00
85f7b6faac Add knowledge base RAG module for book Q&A
- Create knowledge.py handler with dynamic book selection
- Support list/select/query actions for multiple books
- Implement vector search with cosine similarity
- Add knowledge detection to AI parser config
- Cache embeddings per-book for performance
- Add numpy dependency for vector operations
2026-02-16 11:23:57 -06:00
0f270dbba2 Add knowledge base RAG module for book Q&A
- Create knowledge.py handler with dynamic book selection
- Support list/select/query actions for multiple books
- Implement vector search with cosine similarity
- Add knowledge detection to AI parser config
- Cache embeddings per-book for performance
2026-02-16 11:20:22 -06:00
362716e093 fix(timer): replace TimerIcon with TomatoIcon in expanded view 2026-02-16 07:13:37 -06:00