feat: Wave 8 — bedtime/morning/coffee routine packs
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:
parent
7e1d1c3cc7
commit
bb2799ed8c
4 changed files with 193 additions and 0 deletions
31
resources/commands/routines/coffee_break.lua
Normal file
31
resources/commands/routines/coffee_break.lua
Normal file
|
|
@ -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)])
|
||||
68
resources/commands/routines/command.toml
Normal file
68
resources/commands/routines/command.toml
Normal file
|
|
@ -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",
|
||||
]
|
||||
45
resources/commands/routines/good_morning.lua
Normal file
45
resources/commands/routines/good_morning.lua
Normal file
|
|
@ -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)
|
||||
49
resources/commands/routines/good_night.lua
Normal file
49
resources/commands/routines/good_night.lua
Normal 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue