GUI: Memory management completes the management trio (/macros + /scheduler + /memory).
Tauri commands (crates/jarvis-gui/src/tauri_commands/memory.rs)
- memory_list → Vec<MemoryFact{key, value, created_at, last_used_at, use_count}>
- memory_remember(k, v) → persist new fact (or overwrite)
- memory_forget(key) → delete by exact key
- memory_search(q, limit) → substring search
GUI /memory page (frontend/src/routes/memory/index.svelte)
- Top: add-fact form (key + value inputs + "+Добавить" button)
- Substring filter input for the list
- Per-card: key + use_count badge + value (highlighted box) + timestamps +
"Забыть" button with confirm() guard
- Auto-sorted by recency (last_used_at desc)
- Empty state shows voice-hint: 'скажи Jarvis-у "запомни что я люблю чай улун"'
Header (frontend/src/components/Header.svelte)
- New "Память" button between /scheduler and /settings.
- i18n: header-memory in ru/en/ua FTL files.
New voice packs
resources/commands/disk/ (2 cmds)
- disk.free "сколько свободно на диске" / "сколько места на диске C"
PowerShell Get-PSDrive → speaks "Свободно X ГБ из Y, это N%"
- disk.list "какие у меня диски" → "C 120 ГБ, D 300 ГБ, E 50 ГБ"
resources/commands/date_math/ (2 cmds)
- date.days_until "сколько дней до нового года" / "сколько до 8 марта" /
"сколько до 15 марта" — recognises Russian months,
holidays (Новый год, Рождество, 8 марта, 9 мая).
Auto-rolls to next year if target already passed.
Russian-grammar pluralisation (день/дня/дней).
- date.day_of_week "какой сегодня день недели" — Zeller's congruence,
maps to ru day name.
resources/commands/sleep_timer/ (3 cmds)
- sleep_timer.pause_in "выключи музыку через 30 минут"
→ scheduler one-shot lua action that fires media
VK_MEDIA_PLAY_PAUSE via the existing media_keys helper.
(Auto-generates _fire_pause.lua wrapper if missing.)
- sleep_timer.shutdown_in "выключи компьютер через 1 час"
→ shutdown.exe /s /t <secs>. Caps at 24 hours.
Speaks "Скажите 'отмени таймер' чтобы передумать."
- sleep_timer.cancel "отмени таймер выключения" / "не выключай компьютер"
→ shutdown /a + scheduler.remove("sleep_timer_pause"),
idempotent.
Pack count: 64 → 67. Tests: 112/112 pass.
Build: cargo build --release -p jarvis-gui green.
21 lines
703 B
Lua
21 lines
703 B
Lua
local t = jarvis.context.time
|
|
|
|
-- Compute day-of-week using Zeller's congruence (0=Saturday).
|
|
local y, m, d = t.year, t.month, t.day
|
|
if m < 3 then m = m + 12; y = y - 1 end
|
|
local K = y % 100
|
|
local J = math.floor(y / 100)
|
|
local h = (d + math.floor(13 * (m + 1) / 5) + K + math.floor(K / 4) + math.floor(J / 4) - 2 * J) % 7
|
|
-- h: 0=Saturday, 1=Sunday, 2=Monday, ... 6=Friday
|
|
|
|
local days_ru = {
|
|
[0] = "суббота",
|
|
[1] = "воскресенье",
|
|
[2] = "понедельник",
|
|
[3] = "вторник",
|
|
[4] = "среда",
|
|
[5] = "четверг",
|
|
[6] = "пятница",
|
|
}
|
|
|
|
return jarvis.cmd.ok("Сегодня " .. (days_ru[h] or "неизвестный день") .. ".")
|