feat: Wave 5 — sysinfo speaks, smart reminders, outlook COM, time tracker, WOL, conversation tools
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

Voice sysinfo overhaul (6 scripts: battery/cpu/ram/disk/time/all):
- Now SPEAK the result via jarvis.cmd.ok instead of notify-only. Toast
  still fires for visual reference, but real Jarvis tells you out loud.
- `all` joins lines with commas so TTS doesn't over-pause on linebreaks.

Smart reminders (`reminders/set.lua` rewrite):
- Was: detached `Start-Sleep` PowerShell subprocesses that died on
  jarvis-app restart and spawned a hidden process per timer.
- Now: routes through `jarvis.scheduler.add(... type=speak ...)`. Persists
  to schedule.json, survives restart, no zombie processes. Trade-off:
  sub-minute timers round up to 1 min (rare in voice UX).
- Drops UA triggers from earlier UA-removal sweep.

Translation polish (`translate/translate.lua` + `clipboard.lua`):
- Drops UA target language; adds Italian, Polish, Turkish, French ru
  triggers + English target detectors.
- `language_iso()` helper picks the SAPI voice locale for the TARGET
  language (German translation → German SAPI voice if installed).

LLM system prompt (config.rs):
- New LLM_SYSTEM_PROMPT_EN counterpart. Both languages now mention the
  assistant's tooling (memory / scheduler / profiles / macros / vision /
  clipboard) so the LLM knows it can DO things, not suggest the user
  install something.
- `get_llm_system_prompt(lang)` picks EN/RU.

Conversation pack (NEW `conversation/`):
- 2 commands. `conversation.summary` ("о чём мы говорили") pulls the
  last 12 turns from persisted history, asks LLM for a 1-3 sentence
  recap in Jarvis tone. Falls back gracefully when offline.
- `conversation.repeat` ("повтори") re-speaks the last assistant message.
- New Lua API `jarvis.llm_history()` returns array of {role, content}
  tables, excluding the system prompt.

WOL pack (NEW `wol/`):
- Voice "разбуди сервер" / "wake server" fires a magic packet at a MAC
  stored in long-term memory under `wol_<alias>` (default alias "server").
- Setup via voice: "запомни wol_server AA:BB:CC:DD:EE:FF". Falls back to
  `JARVIS_WOL_TARGET` env if memory empty. Handles every standard MAC
  format (colons / dashes / dots / bare). Broadcast on UDP 9 via
  PowerShell System.Net.Sockets.UdpClient.

Outlook COM pack (NEW `outlook/`, via subagent):
- 4 commands: unread_count, latest, send_clipboard, summarize_inbox.
- PowerShell COM bridge `_outlook.ps1` with tab-delimited line protocol.
- summarize_inbox calls LLM for a one-paragraph summary. Graceful
  failure when Outlook isn't running.

Time tracker pack (NEW `time_tracker/`, via subagent):
- 5 commands: start, stop, today, week, reset.
- Persists via `jarvis.state` (structured object: current_session_start
  + sessions array of {start, end}).
- Local-calendar "today" boundary, full Russian pluralisation
  (час/часа/часов, минута/минуты/минут, сессия/сессии/сессий).

Tests: 139 rust (no regression), 81 python (60 → 81, +14 time_tracker
+7 outlook). Release build green for jarvis-app and jarvis-cli.

Pack count: 88 → 92 rust packs.
This commit is contained in:
Bossiara13 2026-05-16 14:34:29 +03:00
parent 919d565879
commit df799b6cd2
29 changed files with 1383 additions and 106 deletions

View file

@ -0,0 +1,121 @@
# Voice-driven daily time tracking.
#
# Storage: jarvis.state on this pack — a single key "data" holding
# { current_session_start = <ts>|nil, sessions = { {start=ts,end=ts}, ... } }
#
# tracker.start marks the beginning of an active session.
# tracker.stop closes the open session and pushes it onto the array.
# tracker.today / tracker.week report totals (sum of completed +
# current open session if any).
# tracker.reset wipes today's entries; speech reply confirms what was wiped.
[[commands]]
id = "tracker.start"
type = "lua"
script = "start.lua"
sandbox = "standard"
timeout = 3000
[commands.phrases]
ru = [
"начни отсчёт",
"начни отсчет",
"запусти трекер",
"я начинаю работу",
"начало рабочего дня",
]
en = [
"start tracking",
"I'm starting work",
"begin tracking",
"start the tracker",
]
[[commands]]
id = "tracker.stop"
type = "lua"
script = "stop.lua"
sandbox = "standard"
timeout = 3000
[commands.phrases]
ru = [
"закончи отсчёт",
"закончи отсчет",
"останови трекер",
"я закончил работу",
"конец рабочего дня",
]
en = [
"stop tracking",
"I'm done",
"end the tracker",
"stop the tracker",
]
[[commands]]
id = "tracker.today"
type = "lua"
script = "today.lua"
sandbox = "standard"
timeout = 3000
[commands.phrases]
ru = [
"сколько я работаю сегодня",
"сколько отработал сегодня",
"сколько часов сегодня",
"сколько времени за сегодня",
]
en = [
"how long today",
"how much have I worked today",
"hours today",
"time today",
]
[[commands]]
id = "tracker.week"
type = "lua"
script = "week.lua"
sandbox = "standard"
timeout = 3000
[commands.phrases]
ru = [
"сколько на этой неделе",
"сколько отработал на неделе",
"часы за неделю",
"статистика за неделю",
]
en = [
"hours this week",
"how long this week",
"time this week",
"weekly hours",
]
[[commands]]
id = "tracker.reset"
type = "lua"
script = "reset.lua"
sandbox = "standard"
timeout = 3000
[commands.phrases]
ru = [
"сбрось трекер",
"обнули трекер",
"очисти трекер",
"сбрось отсчёт",
]
en = [
"reset tracker",
"clear tracker",
"wipe today's tracker",
"reset today's tracker",
]

View file

@ -0,0 +1,59 @@
-- tracker.reset — wipe today's entries (and the open session).
local lang = jarvis.context.language or "ru"
local now = jarvis.context.time.timestamp or os.time()
local t = jarvis.context.time
local h = tonumber(t.hour) or 0
local mi = tonumber(t.minute) or 0
local s = tonumber(t.second) or 0
local today_start = now - (h * 3600 + mi * 60 + s)
local data = jarvis.state.get("data") or {}
local sessions = data.sessions or {}
local kept = {}
local dropped = 0
for _, sess in ipairs(sessions) do
local sstart = tonumber(sess.start) or 0
if sstart < today_start then
table.insert(kept, sess)
else
dropped = dropped + 1
end
end
local had_open = data.current_session_start ~= nil
data.sessions = kept
data.current_session_start = nil
jarvis.state.set("data", data)
if dropped == 0 and not had_open then
return jarvis.cmd.ok(lang == "ru"
and "Сегодня сбрасывать нечего, сэр."
or "Nothing to reset today, sir.")
end
local confirm
if lang == "ru" then
confirm = "Подтверждаю: трекер за сегодня очищен"
if dropped > 0 then
local sw
local n10 = dropped % 10; local n100 = dropped % 100
if n100 >= 11 and n100 <= 14 then sw = "сессий"
elseif n10 == 1 then sw = "сессия"
elseif n10 >= 2 and n10 <= 4 then sw = "сессии"
else sw = "сессий" end
confirm = confirm .. ", удалено " .. dropped .. " " .. sw
end
if had_open then confirm = confirm .. ", активный отсчёт остановлен" end
confirm = confirm .. "."
else
confirm = "Confirmed: tracker for today cleared"
if dropped > 0 then
confirm = confirm .. ", " .. dropped .. " session" .. (dropped == 1 and "" or "s") .. " removed"
end
if had_open then confirm = confirm .. ", running session stopped" end
confirm = confirm .. "."
end
return jarvis.cmd.ok(confirm)

View file

@ -0,0 +1,22 @@
-- tracker.start — open a new active session.
local lang = jarvis.context.language or "ru"
local now = jarvis.context.time.timestamp or os.time()
local data = jarvis.state.get("data") or {}
local sessions = data.sessions or {}
if data.current_session_start then
-- already running — don't overwrite; just acknowledge.
return jarvis.cmd.ok(lang == "ru"
and "Уже считаю, сэр."
or "Already tracking, sir.")
end
data.current_session_start = now
data.sessions = sessions
jarvis.state.set("data", data)
return jarvis.cmd.ok(lang == "ru"
and "Отсчёт пошёл."
or "Tracking started.")

View file

@ -0,0 +1,41 @@
-- tracker.stop — close the currently open session.
local lang = jarvis.context.language or "ru"
local now = jarvis.context.time.timestamp or os.time()
local data = jarvis.state.get("data") or {}
local sessions = data.sessions or {}
local start_ts = data.current_session_start
if not start_ts then
return jarvis.cmd.not_found(lang == "ru"
and "Трекер не запущен, сэр."
or "Tracker isn't running, sir.")
end
local elapsed = now - start_ts
if elapsed < 1 then elapsed = 1 end
table.insert(sessions, { start = start_ts, ["end"] = now })
data.current_session_start = nil
data.sessions = sessions
jarvis.state.set("data", data)
local function format_dur(sec)
sec = math.floor(sec)
local h = math.floor(sec / 3600)
local m = math.floor((sec % 3600) / 60)
if lang == "ru" then
if h > 0 and m > 0 then return h .. " ч " .. m .. " мин" end
if h > 0 then return h .. " ч" end
return m .. " мин"
else
if h > 0 and m > 0 then return h .. "h " .. m .. "m" end
if h > 0 then return h .. "h" end
return m .. "m"
end
end
return jarvis.cmd.ok(lang == "ru"
and ("Записал. Сессия: " .. format_dur(elapsed) .. ".")
or ("Done. Session: " .. format_dur(elapsed) .. "."))

View file

@ -0,0 +1,81 @@
-- tracker.today — report total active time accrued today (local-day).
local lang = jarvis.context.language or "ru"
local now = jarvis.context.time.timestamp or os.time()
local data = jarvis.state.get("data") or {}
local sessions = data.sessions or {}
-- Local-day boundary: use the calendar fields (already in local time).
local t = jarvis.context.time
local y = tonumber(t.year) or 1970
local mo = tonumber(t.month) or 1
local d = tonumber(t.day) or 1
local h = tonumber(t.hour) or 0
local mi = tonumber(t.minute) or 0
local s = tonumber(t.second) or 0
-- Seconds since local midnight today, derived from the broken-down time.
local secs_today = h * 3600 + mi * 60 + s
local today_start = now - secs_today
local total = 0
for _, sess in ipairs(sessions) do
local sstart = tonumber(sess.start) or 0
local send = tonumber(sess["end"]) or 0
-- Overlap with [today_start, now]
local lo = math.max(sstart, today_start)
local hi = math.min(send, now)
if hi > lo then total = total + (hi - lo) end
end
-- Include the open session, if any, up to now.
local open_start = data.current_session_start
if open_start then
local lo = math.max(tonumber(open_start) or 0, today_start)
if now > lo then total = total + (now - lo) end
end
local function format_dur(sec)
sec = math.floor(sec)
local hh = math.floor(sec / 3600)
local mm = math.floor((sec % 3600) / 60)
if lang == "ru" then
local function h_word(n)
local n10 = n % 10; local n100 = n % 100
if n100 >= 11 and n100 <= 14 then return "часов" end
if n10 == 1 then return "час" end
if n10 >= 2 and n10 <= 4 then return "часа" end
return "часов"
end
local function m_word(n)
local n10 = n % 10; local n100 = n % 100
if n100 >= 11 and n100 <= 14 then return "минут" end
if n10 == 1 then return "минута" end
if n10 >= 2 and n10 <= 4 then return "минуты" end
return "минут"
end
if hh > 0 and mm > 0 then
return hh .. " " .. h_word(hh) .. " " .. mm .. " " .. m_word(mm)
end
if hh > 0 then return hh .. " " .. h_word(hh) end
return mm .. " " .. m_word(mm)
else
if hh > 0 and mm > 0 then return hh .. "h " .. mm .. "m" end
if hh > 0 then return hh .. "h" end
return mm .. "m"
end
end
-- Suppress unused-warning for y/mo/d — only h/mi/s feed the calc, but having
-- y/mo/d on hand keeps the script easy to extend later.
local _ = y + mo + d
if total < 60 then
return jarvis.cmd.ok(lang == "ru"
and "Сегодня ещё ничего не отработано, сэр."
or "Nothing tracked yet today, sir.")
end
return jarvis.cmd.ok(lang == "ru"
and ("Сегодня отработано " .. format_dur(total) .. ".")
or ("Today: " .. format_dur(total) .. "."))

View file

@ -0,0 +1,71 @@
-- tracker.week — total active time over the last 7 calendar days.
local lang = jarvis.context.language or "ru"
local now = jarvis.context.time.timestamp or os.time()
local data = jarvis.state.get("data") or {}
local sessions = data.sessions or {}
-- Local-day boundary today, then back up 6 days to get a 7-day window.
local t = jarvis.context.time
local h = tonumber(t.hour) or 0
local mi = tonumber(t.minute) or 0
local s = tonumber(t.second) or 0
local secs_today = h * 3600 + mi * 60 + s
local today_start = now - secs_today
local week_start = today_start - 6 * 86400
local total = 0
for _, sess in ipairs(sessions) do
local sstart = tonumber(sess.start) or 0
local send = tonumber(sess["end"]) or 0
local lo = math.max(sstart, week_start)
local hi = math.min(send, now)
if hi > lo then total = total + (hi - lo) end
end
local open_start = data.current_session_start
if open_start then
local lo = math.max(tonumber(open_start) or 0, week_start)
if now > lo then total = total + (now - lo) end
end
local function format_dur(sec)
sec = math.floor(sec)
local hh = math.floor(sec / 3600)
local mm = math.floor((sec % 3600) / 60)
if lang == "ru" then
local function h_word(n)
local n10 = n % 10; local n100 = n % 100
if n100 >= 11 and n100 <= 14 then return "часов" end
if n10 == 1 then return "час" end
if n10 >= 2 and n10 <= 4 then return "часа" end
return "часов"
end
local function m_word(n)
local n10 = n % 10; local n100 = n % 100
if n100 >= 11 and n100 <= 14 then return "минут" end
if n10 == 1 then return "минута" end
if n10 >= 2 and n10 <= 4 then return "минуты" end
return "минут"
end
if hh > 0 and mm > 0 then
return hh .. " " .. h_word(hh) .. " " .. mm .. " " .. m_word(mm)
end
if hh > 0 then return hh .. " " .. h_word(hh) end
return mm .. " " .. m_word(mm)
else
if hh > 0 and mm > 0 then return hh .. "h " .. mm .. "m" end
if hh > 0 then return hh .. "h" end
return mm .. "m"
end
end
if total < 60 then
return jarvis.cmd.ok(lang == "ru"
and "За эту неделю ничего не отработано, сэр."
or "Nothing tracked this week, sir.")
end
return jarvis.cmd.ok(lang == "ru"
and ("За неделю отработано " .. format_dur(total) .. ".")
or ("This week: " .. format_dur(total) .. "."))