From bb2799ed8c22771ad37195a79df9c08cb4db1e92 Mon Sep 17 00:00:00 2001 From: Bossiara13 <236771060+DmitryBykov-ISPO@users.noreply.github.com> Date: Sat, 16 May 2026 14:43:28 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20Wave=208=20=E2=80=94=20bedtime/morning/?= =?UTF-8?q?coffee=20routine=20packs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- resources/commands/routines/coffee_break.lua | 31 +++++++++ resources/commands/routines/command.toml | 68 ++++++++++++++++++++ resources/commands/routines/good_morning.lua | 45 +++++++++++++ resources/commands/routines/good_night.lua | 49 ++++++++++++++ 4 files changed, 193 insertions(+) create mode 100644 resources/commands/routines/coffee_break.lua create mode 100644 resources/commands/routines/command.toml create mode 100644 resources/commands/routines/good_morning.lua create mode 100644 resources/commands/routines/good_night.lua diff --git a/resources/commands/routines/coffee_break.lua b/resources/commands/routines/coffee_break.lua new file mode 100644 index 0000000..9491ddf --- /dev/null +++ b/resources/commands/routines/coffee_break.lua @@ -0,0 +1,31 @@ +-- Coffee break — schedule a "вы вернулись?" check-in in 5 minutes, and +-- pause idle banter so Jarvis isn't talking to an empty chair. + +local lang = jarvis.context.language + +jarvis.banter.pause() + +local check_in = lang == "ru" + and "Сэр, прошло пять минут. Вы вернулись?" + or "Sir, five minutes are up. Are you back?" + +pcall(function() + jarvis.scheduler.add({ + name = lang == "ru" and "Чек-ин после кофе" or "Coffee check-in", + schedule = "in 5 minutes", + action = { type = "speak", text = check_in }, + }) +end) + +local lines_ru = { + "Хорошо, сэр. Возвращайтесь через пять.", + "Тихо в эфире пять минут. Удачно вам.", + "Пять минут — норма для кофе, не более.", +} +local lines_en = { + "Right, sir. Back in five.", + "Quiet for five. Good luck.", + "Five minutes for coffee — not more.", +} +local pool = (lang == "ru") and lines_ru or lines_en +return jarvis.cmd.ok(pool[math.random(#pool)]) diff --git a/resources/commands/routines/command.toml b/resources/commands/routines/command.toml new file mode 100644 index 0000000..c014499 --- /dev/null +++ b/resources/commands/routines/command.toml @@ -0,0 +1,68 @@ +# Bedtime / wake-up routines — bundle several actions into one voice trigger. +# These are the Jarvis equivalents of Alexa "routines": one phrase, many +# side-effects. + +[[commands]] +id = "routines.good_night" +type = "lua" +script = "good_night.lua" +sandbox = "full" +timeout = 8000 + +[commands.phrases] +ru = [ + "спокойной ночи", + "иду спать", + "пока я в кровати", + "ночной режим", + "выключи всё на ночь", +] +en = [ + "good night", + "i'm going to bed", + "bedtime mode", + "shut down for the night", +] + + +[[commands]] +id = "routines.good_morning" +type = "lua" +script = "good_morning.lua" +sandbox = "full" +timeout = 8000 + +[commands.phrases] +ru = [ + "доброе утро джарвис", + "доброе утро", + "я проснулся", + "начинаем день", +] +en = [ + "good morning", + "i'm awake", + "start the day", +] + + +[[commands]] +id = "routines.coffee_break" +type = "lua" +script = "coffee_break.lua" +sandbox = "full" +timeout = 5000 + +[commands.phrases] +ru = [ + "иду за кофе", + "перерыв на кофе", + "перерыв на чай", + "отойду минут на пять", +] +en = [ + "going for coffee", + "coffee break", + "back in 5", + "afk five minutes", +] diff --git a/resources/commands/routines/good_morning.lua b/resources/commands/routines/good_morning.lua new file mode 100644 index 0000000..8f84bbd --- /dev/null +++ b/resources/commands/routines/good_morning.lua @@ -0,0 +1,45 @@ +-- "Good morning" routine: +-- 1. switch active profile back to "default" +-- 2. count today's scheduled tasks +-- 3. reply with a varied morning greeting + agenda hint + +local lang = jarvis.context.language + +pcall(function() jarvis.profile.set("default") end) + +local tasks_today = jarvis.scheduler.list() or {} +local n_tasks = #tasks_today + +local lines_ru = { + "Доброе утро, сэр. Системы в порядке.", + "Доброе утро. Готов к новому дню.", + "С пробуждением, сэр. День в норме.", + "Доброе утро, сэр. Кофе сам себя не сварит.", + "Доброе утро. Все онлайн, рапорт по запросу.", +} +local lines_en = { + "Good morning, sir. All systems nominal.", + "Good morning. Ready for the day.", + "Welcome back, sir. The day looks normal.", + "Good morning, sir. The coffee won't brew itself.", + "Good morning. Everything online, ready when you are.", +} +local pool = (lang == "ru") and lines_ru or lines_en +local greeting = pool[math.random(#pool)] + +local agenda +if n_tasks > 0 then + if lang == "ru" then + agenda = " В расписании " .. tostring(n_tasks) .. ", скажите 'покажи расписание', чтобы услышать." + else + agenda = " " .. tostring(n_tasks) .. " scheduled — say 'show schedule' for details." + end +else + if lang == "ru" then + agenda = " Расписание чистое." + else + agenda = " Schedule is clear." + end +end + +return jarvis.cmd.ok(greeting .. agenda) diff --git a/resources/commands/routines/good_night.lua b/resources/commands/routines/good_night.lua new file mode 100644 index 0000000..7173cc9 --- /dev/null +++ b/resources/commands/routines/good_night.lua @@ -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)