Focus mode (`focus/`):
- focus.start ("режим фокуса" / "focus mode"): three side-effects in one
voice trigger:
1. switch profile to "work" (silences fun/banter)
2. enable Windows Focus Assist via registry tweak (QuietHours key)
3. schedule a stretch reminder in 50 minutes through the persistent
scheduler — so it survives daemon restart
- focus.stop: undoes all three, including cancelling pending stretch
reminders by matching their scheduler name. Best-effort: any one
failing doesn't block the others.
Cooking timer (`cooking/`):
- Recognises 16+ dish names (чай, кофе, омлет, яйца, макароны, паста,
рис, гречка, картошка, курица, пицца, etc.) and starts a preset-
duration scheduler reminder ("Сэр, чай готов.").
- Single Lua script, table-driven — adding a recipe is one line.
- EN phrases for the same dishes ("boiling pasta", "frying eggs", ...).
Memory admin (`memory_admin/`):
- memory_admin.count → speak fact count with full RU pluralisation.
- memory_admin.list → speak 5 most-recent + toast the rest.
- memory_admin.wipe → ONLY fires on "точно забудь все" prefix (not bare
"забудь все") so we can't disaster-wipe by accident.
- Adds `long_term_memory::clear_all() -> usize` returning removed count
+ Lua binding `jarvis.memory.clear_all()`.
- One extra unit test for `clear_all`.
Tests: 139 → 140 (+1). Pack count: 92 → 95.
20 lines
614 B
Lua
20 lines
614 B
Lua
local lang = jarvis.context.language
|
||
local facts = jarvis.memory.all() or {}
|
||
local n = #facts
|
||
|
||
local function ru_plural_facts(n)
|
||
local m100 = n % 100
|
||
if m100 >= 11 and m100 <= 14 then return "фактов" end
|
||
local m10 = n % 10
|
||
if m10 == 1 then return "факт" end
|
||
if m10 >= 2 and m10 <= 4 then return "факта" end
|
||
return "фактов"
|
||
end
|
||
|
||
local msg
|
||
if lang == "ru" then
|
||
msg = "В памяти " .. tostring(n) .. " " .. ru_plural_facts(n) .. ", сэр."
|
||
else
|
||
msg = "I remember " .. tostring(n) .. (n == 1 and " fact, sir." or " facts, sir.")
|
||
end
|
||
return jarvis.cmd.ok(msg)
|