feat: Wave 8 — bedtime/morning/coffee routine packs
Some checks are pending
Rust CI / cargo test (jarvis-core) (push) Waiting to run
Rust CI / cargo clippy (push) Waiting to run
Rust CI / cargo check (workspace) (push) Waiting to run

routines/good_night:
- Switch profile to "sleep" (silences idle banter overnight).
- Cancel one-shot timers (Таймер:/Timer:/Кухня:/Cooking: name prefix)
  so a forgotten 6-hour reminder doesn't wake the user up.
- Speak a varied 5-line RU/EN good night with cancelled-count suffix.
- Deliberately does NOT lock PC / shut displays — too destructive
  without an explicit confirm step.

routines/good_morning:
- Switch profile back to "default".
- Report scheduled task count for the day.
- Speak a varied 5-line greeting with agenda preview.

routines/coffee_break:
- Pause idle banter so Jarvis isn't talking to an empty chair.
- Schedule a 5-minute check-in via the persistent scheduler.
- Speak a varied 3-line acknowledgement.

Pack count: 97 → 98 (one pack, three commands).
Tests: 140 still pass.
This commit is contained in:
Bossiara13 2026-05-16 14:43:28 +03:00
parent 7e1d1c3cc7
commit bb2799ed8c
4 changed files with 193 additions and 0 deletions

View file

@ -0,0 +1,49 @@
-- "Good night" routine:
-- 1. switch active profile to "sleep" (so idle-banter shuts up overnight)
-- 2. clear any one-shot pending reminders that would wake the user up
-- after midnight — daily ones stay (those are intentional)
-- 3. wish good night with a varied line
-- We deliberately DO NOT lock the PC / power off displays / sleep — too
-- destructive without explicit user confirmation, easy to misfire.
local lang = jarvis.context.language
-- 1) Switch to "sleep" profile (best effort)
pcall(function() jarvis.profile.set("sleep") end)
-- 2) Cancel one-shot timers that look user-set (anything starting with
-- "Таймер:" or "Timer:" — the prefix our reminders/set.lua uses).
local cancelled = 0
for _, task in ipairs(jarvis.scheduler.list() or {}) do
local n = task.name or ""
if n:find("^Таймер:") or n:find("^Timer:") or n:find("^Кухня:")
or n:find("^Cooking:") then
jarvis.scheduler.remove(task.id)
cancelled = cancelled + 1
end
end
local lines_ru = {
"Спокойной ночи, сэр. Я остаюсь на связи.",
"Доброй ночи, сэр. Системы переведены в тихий режим.",
"Спите крепко, сэр. Утром доложу о всём важном.",
"Хорошо, сэр. Не отвлекаю до утра.",
"Спокойной ночи. Завтра ещё один день.",
}
local lines_en = {
"Good night, sir. I'll be on standby.",
"Sleep well, sir. Systems set to quiet.",
"Good night, sir. I'll brief you in the morning.",
"Very well, sir. Quiet mode until dawn.",
"Good night. Tomorrow's another day.",
}
local pool = (lang == "ru") and lines_ru or lines_en
local line = pool[math.random(#pool)]
if cancelled > 0 then
line = line .. (lang == "ru"
and (" Отменил " .. tostring(cancelled) .. " одноразовых таймеров.")
or (" Cancelled " .. tostring(cancelled) .. " one-shot timers."))
end
return jarvis.cmd.ok(line)