J.A.R.V.I.S-rust/resources/commands/scheduler/command.toml

126 lines
2.6 KiB
TOML
Raw Permalink Normal View History

feat(scheduler): IMBA-5 proactive scheduler — reminders, daily briefings, intervals Background thread that wakes J.A.R.V.I.S. on a schedule to speak reminders. Nothing else competes here on desktop — Алиса/Сири are reactive-only. Core (crates/jarvis-core/src/scheduler.rs) - Schedule::{Daily{h,m}, Interval{secs}, Once{at}} with Schedule::parse for "daily HH:MM" / "at HH:MM" / "every N minutes|hours" / "in N minutes|hours". Russian units (час/часа/часов/минут/секунд) also accepted. - ScheduledTask {id, name, schedule, action, last_fired, enabled, created_at}. Action::Speak{text} | Action::Lua{script_path}. - JSON persistence at <APP_CONFIG_DIR>/schedule.json, atomic write-through. - add/remove/clear/list/find; mark_fired auto-deletes Once tasks. - start_background() spawns a 30-second tick thread (idempotent). Each tick calls due_tasks(), fires Action via tts::speak_default (after voices::play_reply "ahem" cue) or Lua engine. - 7 unit tests (all passing). Lua API (crates/jarvis-core/src/lua/api/scheduler.rs) - jarvis.scheduler.add({name, schedule, action={type, text|script_path}}) - jarvis.scheduler.{list, count, remove(id), clear}. - Tasks come back as {id, name, schedule_human, action, enabled, last_fired}. Wire-up (crates/jarvis-app/src/main.rs) - scheduler::init() + scheduler::start_background() after profiles::init. - Tasks survive restarts via schedule.json. Voice commands (resources/commands/scheduler/, 6 ids) - scheduler.add_reminder "напомни через 5 минут выключить кофеварку" - scheduler.add_at "напомни в 18:00 забрать ребёнка" - scheduler.add_recurring "каждые 2 часа напоминай попить воды" - scheduler.add_daily "каждый день в 9:00 делай briefing" - scheduler.list "что у меня запланировано" - scheduler.clear "очисти расписание" Russian-aware parsers (час/часа/часов, минут/минуту/минуты) live inside the Lua packs — easy to extend without touching Rust. Tests: 31/31 jarvis-core unit tests pass (24 prior + 7 scheduler). Build: cargo build --release -p jarvis-app and -p jarvis-gui both green.
2026-05-15 15:43:04 +03:00
# IMBA-5: Proactive scheduler — recurring reminders, daily briefings, intervals.
[[commands]]
id = "scheduler.add_reminder"
type = "lua"
script = "add_reminder.lua"
sandbox = "standard"
timeout = 5000
[commands.phrases]
ru = [
"напомни мне через", "напомни через",
"поставь напоминалку через", "поставь напоминание через",
"разбуди через",
]
en = ["remind me in", "set a reminder in"]
[[commands]]
id = "scheduler.add_at"
type = "lua"
script = "add_at.lua"
sandbox = "standard"
timeout = 5000
[commands.phrases]
ru = [
"напомни в",
"напомни сегодня в",
"разбуди в",
"поставь напоминалку на",
]
en = ["remind me at", "wake me at"]
[[commands]]
id = "scheduler.add_recurring"
type = "lua"
script = "add_recurring.lua"
sandbox = "standard"
timeout = 5000
[commands.phrases]
ru = [
"каждые",
"каждый час",
"каждые два часа",
"напоминай каждые",
"напоминай каждый",
]
en = ["every", "remind me every"]
[[commands]]
id = "scheduler.add_daily"
type = "lua"
script = "add_daily.lua"
sandbox = "standard"
timeout = 5000
[commands.phrases]
ru = [
"каждый день в",
"каждое утро в",
"ежедневно в",
"по утрам в",
]
en = ["every day at", "daily at"]
[[commands]]
id = "scheduler.list"
type = "lua"
script = "list.lua"
sandbox = "minimal"
timeout = 3000
[commands.phrases]
ru = [
"что у меня запланировано",
"какие напоминания",
"покажи расписание",
"какие задачи у меня",
"что в расписании",
]
en = ["what's on my schedule", "show schedule", "list reminders"]
[[commands]]
id = "scheduler.clear"
type = "lua"
script = "clear.lua"
sandbox = "minimal"
timeout = 3000
[commands.phrases]
ru = [
"очисти расписание",
"удали все напоминания",
"отмени все напоминания",
"сбрось расписание",
]
en = ["clear schedule", "cancel all reminders"]
feat: hot-swap LLM backend + media keys + codebase Q&A + scheduler cancel-by-text + TTS pre-warm Single biggest user-facing change: you can now switch local↔cloud LLM by voice without restarting. Plus four new packs and a perf nudge. Shared LLM global (crates/jarvis-core/src/llm/mod.rs) - GLOBAL: Lazy<RwLock<Option<Arc<LlmClient>>>>. Single source of truth. - init_global() / current() / swap_to(LlmBackend) / current_backend_name() / parse_backend(str). - llm_fallback + llm_router migrated: they no longer own a separate LlmClient, they read from the global on each request. Hot-swap is now LIVE — change backend, next chat call uses the new one. - parse_backend accepts both english and russian aliases: "groq"/"cloud"/"облако"/"клауд" → Groq "ollama"/"local"/"локал"/"локальный" → Ollama Voice + Lua LLM switcher (resources/commands/llm_switch/, 3 commands) - "переключись на локальный" / "перейди на оллама" → swap to Ollama - "переключись на облако" / "используй грок" → swap to Groq - "какой у тебя мозг" / "облако или локально" → status query Underlying Lua API (registered globally): jarvis.llm({messages}, opts) -- as before, now uses global client jarvis.llm_status() -> "groq" | "ollama" | "none" jarvis.llm_switch(name) -> name on success, nil on failure Media keys pack (resources/commands/media_keys/, 4 commands) - "пауза" / "плей" → VK_MEDIA_PLAY_PAUSE - "следующий трек" → VK_MEDIA_NEXT_TRACK - "предыдущий трек" → VK_MEDIA_PREV_TRACK - "стоп музыка" → VK_MEDIA_STOP - Helper _media.ps1 uses user32.keybd_event (P/Invoke through Add-Type). - Works with anything that listens to global media keys: Spotify, Yandex Music, YouTube (focused tab), Foobar2000, Winamp, etc. No OAuth, no API keys. Codebase Q&A pack (resources/commands/codebase_qa/, 3 commands) - "укажи проект <path>" → stores path in jarvis.memory under codebase.root - "какой проект сейчас" → speaks current path - "что делает функция X" / "найди в коде Y" / "объясни код" → walks the folder (depth 3, 30 files cap, 4KB per file, 50KB total), filters by source extensions (rs/py/ts/lua/go/...), feeds digest to LLM with a "senior reviewer" system prompt, speaks 3-5 sentence answer. Scheduler cancel-by-text (crates/jarvis-core/src/scheduler.rs) - new pub fn find_by_text(query, limit) -> Vec<ScheduledTask> - new pub fn remove_by_text(query) -> usize (count removed) - new pure helper find_by_text_in(tasks, query, limit) for tests - Lua: jarvis.scheduler.{find_by_text, remove_by_text} - Voice: "отмени напоминание про воду" / "удали задачу про разминку" - 3 new unit tests (52 total in jarvis-core). TTS pre-warm (crates/jarvis-app/src/main.rs) - Call jarvis_core::tts::backend() once on startup so the first speak() doesn't pay Piper binary discovery + voice loading cost. Cuts first-speak latency by ~150-300ms depending on backend. Build: cargo build --release -p jarvis-app -p jarvis-gui both green. Tests: 52/52 jarvis-core unit tests pass.
2026-05-15 16:15:59 +03:00
[[commands]]
id = "scheduler.cancel_by_text"
type = "lua"
script = "cancel_by_text.lua"
sandbox = "minimal"
timeout = 3000
[commands.phrases]
ru = [
"отмени напоминание про",
"отмени напоминание о",
"удали задачу про",
"удали задачу о",
"отмени про",
"забудь напоминание про",
]
en = [
"cancel reminder about",
"remove task about",
]