feat: Ollama LLM backend + 5 utility packs (daily briefing, pomodoro, currency convert, stocks, habits, translate clipboard)
Local-LLM support so J.A.R.V.I.S. works offline without GROQ_TOKEN.
LLM multi-backend (crates/jarvis-core/src/llm/client.rs)
- LlmBackend enum {Groq, Ollama}. Both use OpenAI-compatible /v1/chat/completions
(Ollama exposes one natively at :11434/v1).
- LlmClient::from_env() now dispatches on JARVIS_LLM=groq|ollama. Auto-detect:
Groq if GROQ_TOKEN set, else Ollama.
- New helpers: LlmClient::groq() (was: from_env), LlmClient::ollama().
- Reqwest client now has a 60s timeout (was: unbounded — Groq freezes could hang).
- api_key skipped when empty (Ollama doesn't need auth).
- Defaults: OLLAMA_BASE_URL=http://localhost:11434/v1, OLLAMA_MODEL=qwen2.5:3b.
Override via OLLAMA_BASE_URL / OLLAMA_MODEL env.
- llm_fallback + llm_router log the active backend on init.
- Tests: 32/32 pass. Renamed `from_env_fails` → `groq_fails_when_token_missing`,
added `ollama_works_without_token`.
Daily briefing pack (resources/commands/daily_briefing/, 3 commands)
- setup.lua: "настрой утренний брифинг на 9:00" → adds a daily scheduled task
that runs now.lua via the scheduler's Lua-action support.
- now.lua: greeting + time + active profile + scheduled task count + memory recap
+ LLM motivational nudge. Voice-triggered ("утренний брифинг") works the same.
- off.lua: removes the scheduled task.
Pomodoro pack (resources/commands/pomodoro/, 2 commands)
- start.lua / stop.lua + tick.lua (re-scheduled by itself). State stored in
jarvis.state — phase alternates work (25 min) / break (5 min) until stop.
Currency conversion (resources/commands/currency/convert.lua)
- "сколько будет 1000 долларов в рублях" — fetches CBR daily rates from
cbr-xml-daily.ru, normalises by Nominal, prints both directions.
- Recognises USD/EUR/CNY/GBP/JPY/RUB by substring. Pluralises russian units.
Stocks pack (resources/commands/stocks/, 1 command)
- "сколько Сбер" → MOEX ISS /iss/engines/stock/markets/shares/securities/<TKR>.
- Mapping of 22 popular Russian tickers to common names (Сбер→SBER, Газпром→GAZP,
Лукойл→LKOH, Яндекс→YDEX, Т-банк→T, etc).
- Picks TQBR (main board) row, reports LAST + LASTTOPREVPRICE%.
Habit nudges (resources/commands/habit_nudge/, 4 commands)
- "напоминай мне пить воду" → every 2 hours
- "напоминай мне размяться" → every 50 minutes
- "напоминай отдыхать глазам" → every 20 minutes (20-20-20 rule)
- "отключи все привычки" → stops all three by id.
Translate clipboard (resources/commands/translate/clipboard.lua)
- "переведи буфер на английский" → grabs clipboard, sends to LLM, speaks first
sentence, replaces clipboard with full translation, fires notification.
Build: cargo build --release -p jarvis-app -p jarvis-gui both green. 32/32 tests.
To use Ollama:
1. Install + run Ollama (https://ollama.com).
2. `ollama pull qwen2.5:3b` (or any chat model).
3. Optional: `set JARVIS_LLM=ollama` (auto-picked if GROQ_TOKEN unset).
2026-05-15 15:51:24 +03:00
|
|
|
|
-- "Переведи буфер на английский" → grab clipboard, translate, speak, put back
|
|
|
|
|
|
local phrase = (jarvis.context.phrase or ""):lower()
|
|
|
|
|
|
|
|
|
|
|
|
-- Detect target language from phrase, default English.
|
|
|
|
|
|
local target = "english"
|
feat: Wave 5 — sysinfo speaks, smart reminders, outlook COM, time tracker, WOL, conversation tools
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.
2026-05-16 14:34:29 +03:00
|
|
|
|
if phrase:find("на русск") then target = "русский"
|
|
|
|
|
|
elseif phrase:find("на немецк") then target = "немецкий"
|
|
|
|
|
|
elseif phrase:find("на французск") then target = "французский"
|
|
|
|
|
|
elseif phrase:find("на испанск") then target = "испанский"
|
|
|
|
|
|
elseif phrase:find("на итальянск") then target = "итальянский"
|
|
|
|
|
|
elseif phrase:find("на польск") then target = "польский"
|
|
|
|
|
|
elseif phrase:find("на турецк") then target = "турецкий"
|
|
|
|
|
|
elseif phrase:find("на китайск") then target = "китайский"
|
|
|
|
|
|
elseif phrase:find("на японск") then target = "японский"
|
|
|
|
|
|
elseif phrase:find("german") then target = "german"
|
|
|
|
|
|
elseif phrase:find("french") then target = "french"
|
|
|
|
|
|
elseif phrase:find("spanish") then target = "spanish"
|
|
|
|
|
|
elseif phrase:find("english") then target = "english"
|
|
|
|
|
|
elseif phrase:find("russian") then target = "русский"
|
feat: Ollama LLM backend + 5 utility packs (daily briefing, pomodoro, currency convert, stocks, habits, translate clipboard)
Local-LLM support so J.A.R.V.I.S. works offline without GROQ_TOKEN.
LLM multi-backend (crates/jarvis-core/src/llm/client.rs)
- LlmBackend enum {Groq, Ollama}. Both use OpenAI-compatible /v1/chat/completions
(Ollama exposes one natively at :11434/v1).
- LlmClient::from_env() now dispatches on JARVIS_LLM=groq|ollama. Auto-detect:
Groq if GROQ_TOKEN set, else Ollama.
- New helpers: LlmClient::groq() (was: from_env), LlmClient::ollama().
- Reqwest client now has a 60s timeout (was: unbounded — Groq freezes could hang).
- api_key skipped when empty (Ollama doesn't need auth).
- Defaults: OLLAMA_BASE_URL=http://localhost:11434/v1, OLLAMA_MODEL=qwen2.5:3b.
Override via OLLAMA_BASE_URL / OLLAMA_MODEL env.
- llm_fallback + llm_router log the active backend on init.
- Tests: 32/32 pass. Renamed `from_env_fails` → `groq_fails_when_token_missing`,
added `ollama_works_without_token`.
Daily briefing pack (resources/commands/daily_briefing/, 3 commands)
- setup.lua: "настрой утренний брифинг на 9:00" → adds a daily scheduled task
that runs now.lua via the scheduler's Lua-action support.
- now.lua: greeting + time + active profile + scheduled task count + memory recap
+ LLM motivational nudge. Voice-triggered ("утренний брифинг") works the same.
- off.lua: removes the scheduled task.
Pomodoro pack (resources/commands/pomodoro/, 2 commands)
- start.lua / stop.lua + tick.lua (re-scheduled by itself). State stored in
jarvis.state — phase alternates work (25 min) / break (5 min) until stop.
Currency conversion (resources/commands/currency/convert.lua)
- "сколько будет 1000 долларов в рублях" — fetches CBR daily rates from
cbr-xml-daily.ru, normalises by Nominal, prints both directions.
- Recognises USD/EUR/CNY/GBP/JPY/RUB by substring. Pluralises russian units.
Stocks pack (resources/commands/stocks/, 1 command)
- "сколько Сбер" → MOEX ISS /iss/engines/stock/markets/shares/securities/<TKR>.
- Mapping of 22 popular Russian tickers to common names (Сбер→SBER, Газпром→GAZP,
Лукойл→LKOH, Яндекс→YDEX, Т-банк→T, etc).
- Picks TQBR (main board) row, reports LAST + LASTTOPREVPRICE%.
Habit nudges (resources/commands/habit_nudge/, 4 commands)
- "напоминай мне пить воду" → every 2 hours
- "напоминай мне размяться" → every 50 minutes
- "напоминай отдыхать глазам" → every 20 minutes (20-20-20 rule)
- "отключи все привычки" → stops all three by id.
Translate clipboard (resources/commands/translate/clipboard.lua)
- "переведи буфер на английский" → grabs clipboard, sends to LLM, speaks first
sentence, replaces clipboard with full translation, fires notification.
Build: cargo build --release -p jarvis-app -p jarvis-gui both green. 32/32 tests.
To use Ollama:
1. Install + run Ollama (https://ollama.com).
2. `ollama pull qwen2.5:3b` (or any chat model).
3. Optional: `set JARVIS_LLM=ollama` (auto-picked if GROQ_TOKEN unset).
2026-05-15 15:51:24 +03:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local src = jarvis.system.clipboard.get()
|
|
|
|
|
|
if not src or src == "" then
|
|
|
|
|
|
jarvis.speak("Буфер пуст.")
|
|
|
|
|
|
jarvis.audio.play_not_found()
|
|
|
|
|
|
return { chain = false }
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Trim long input — translate first ~2000 chars for cost/latency.
|
|
|
|
|
|
if #src > 2000 then
|
|
|
|
|
|
src = src:sub(1, 2000) .. "..."
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local result = jarvis.llm({
|
|
|
|
|
|
{ role = "system", content = "Ты переводчик. Переводи строго на запрошенный язык без комментариев и пояснений. Сохраняй смысл и стиль." },
|
|
|
|
|
|
{ role = "user", content = string.format("Переведи на %s:\n\n%s", target, src) }
|
|
|
|
|
|
}, { max_tokens = 800, temperature = 0.2 })
|
|
|
|
|
|
|
|
|
|
|
|
if not result or result == "" then
|
|
|
|
|
|
jarvis.speak("Не получилось перевести.")
|
|
|
|
|
|
jarvis.audio.play_error()
|
|
|
|
|
|
return { chain = false }
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Put translation back into clipboard
|
|
|
|
|
|
jarvis.system.clipboard.set(result)
|
|
|
|
|
|
|
|
|
|
|
|
-- Speak only first sentence to avoid long monologue.
|
|
|
|
|
|
local first_sentence = result:match("^[^%.!?]*[%.!?]") or result:sub(1, 200)
|
|
|
|
|
|
jarvis.speak("Перевёл на " .. target .. ". " .. first_sentence)
|
|
|
|
|
|
jarvis.system.notify("Перевод (в буфере)", result:sub(1, 200))
|
|
|
|
|
|
jarvis.audio.play_ok()
|
|
|
|
|
|
return { chain = false }
|