feat(commands): tier-1 — translate, math, theme toggle, project opener, sound panel
Five more portable Lua command packs. Bumps the total from 16 to 21
packs. cargo test -p jarvis-core --lib commands::tests still 3/3.
translate/ — translate.lua. Picks the target language from triggers
like "переведи на английский" / "translate to russian"; falls back to
English when only "переведи X" is heard. Sends to Groq with a strict
"translation only" system prompt at temp 0.3. Drops the result into
the clipboard, fires a notify, and speaks via PowerShell SAPI in the
matching ISO voice (ru-RU / uk-UA / en-US / de-DE etc.) so a German
translation actually sounds German.
math/ — math.lua. Strips the trigger ("посчитай" / "calculate" /
"сколько будет" / "what is" / ...), sends the remainder to Groq with
temp=0.0 and max_tokens=64, asking ONLY for the numeric result. If
the model replies "нет" (the system-prompt sentinel for non-math),
plays not_found instead of speaking nonsense. Otherwise speaks
"Получилось X" via SAPI.
theme/ — set.lua dispatched by command_id (theme_dark / theme_light).
Flips AppsUseLightTheme + SystemUsesLightTheme under
HKCU\...\Themes\Personalize via Set-ItemProperty. No reboot needed,
Windows shell re-themes immediately.
projects/ — open.lua + list.lua. Reads/creates
%USERPROFILE%\Documents\jarvis-projects.json (a flat
[{"name": ..., "path": ...}] list). open.lua strips the trigger,
exact-matches then substring-matches the project name, opens the path
in VS Code if `code.cmd` is on PATH, otherwise in Explorer. First
call creates a sample config with jarvis-rust / jarvis-python /
dietpi entries pointing under USERPROFILE so it works on any machine.
list.lua just notifies the configured project names.
sound_panel/ — open.lua. Two-liner: rundll32 mmsys.cpl,,1 (Recording
tab). Useful both as a standalone "открой настройки звука" and as
the place to fix the mic-disabled state that prevents jarvis-app
from starting.
Portability: USERPROFILE / SystemDrive / PATH lookup throughout.
2026-05-15 12:06:30 +03:00
|
|
|
[[commands]]
|
|
|
|
|
id = "translate"
|
|
|
|
|
type = "lua"
|
|
|
|
|
script = "translate.lua"
|
|
|
|
|
sandbox = "full"
|
|
|
|
|
timeout = 20000
|
|
|
|
|
|
|
|
|
|
[commands.phrases]
|
|
|
|
|
ru = [
|
|
|
|
|
"переведи на английский",
|
|
|
|
|
"переведи на русский",
|
|
|
|
|
"переведи на украинский",
|
|
|
|
|
"переведи на немецкий",
|
|
|
|
|
"переведи на французский",
|
|
|
|
|
"переведи на испанский",
|
|
|
|
|
"переведи на китайский",
|
|
|
|
|
"переведи на японский",
|
|
|
|
|
"переведи",
|
|
|
|
|
"как по английски",
|
|
|
|
|
"как по русски",
|
|
|
|
|
"как по немецки",
|
|
|
|
|
]
|
|
|
|
|
en = [
|
|
|
|
|
"translate to english",
|
|
|
|
|
"translate to russian",
|
|
|
|
|
"translate to ukrainian",
|
|
|
|
|
"translate",
|
|
|
|
|
"how to say in",
|
|
|
|
|
]
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
# Translate clipboard contents — no need to dictate the source text out loud.
|
|
|
|
|
[[commands]]
|
|
|
|
|
id = "translate_clipboard"
|
|
|
|
|
type = "lua"
|
|
|
|
|
script = "clipboard.lua"
|
|
|
|
|
sandbox = "full"
|
|
|
|
|
timeout = 20000
|
|
|
|
|
|
|
|
|
|
[commands.phrases]
|
|
|
|
|
ru = [
|
|
|
|
|
"переведи буфер",
|
|
|
|
|
"переведи из буфера",
|
|
|
|
|
"переведи буфер обмена",
|
|
|
|
|
"переведи скопированное",
|
|
|
|
|
"переведи то что я скопировал",
|
|
|
|
|
]
|
|
|
|
|
en = [
|
|
|
|
|
"translate clipboard",
|
|
|
|
|
"translate from clipboard",
|
|
|
|
|
]
|