feat: lock_workstation + screenshot + net_info packs + modernise power pack
Three handy daily-driver packs + cleanup of the oldest power/act.lua.
power pack — added lock_workstation (resources/commands/power/)
- New command id: lock_workstation
- Phrase: "заблокируй компьютер" / "заблокируй пк" / "заблокируй экран"
- Action: rundll32.exe user32.dll,LockWorkStation
- Sandbox: full (needs system.exec)
- act.lua modernised:
* No more inline PowerShell SAPI escape chain — now uses jarvis.speak
(TTS backend abstraction respects user's chosen Piper/SAPI/Silero).
* Returns via jarvis.cmd.ok/error helpers.
* Logged warning for failing cmds without crashing the pack.
* Cleaner per-action `warn` flag controls the "say cancel to abort" hint.
screenshot pack (NEW, resources/commands/screenshot/, 2 commands)
- "сделай скрин" / "сделай скриншот" → screenshot.to_clipboard
Uses [System.Windows.Forms.Clipboard]::SetImage() with a captured Bitmap.
No file artifact, no LLM call — pure capture, fastest path.
- "сохрани скрин" → screenshot.to_file
Saves to ~/Pictures/Screenshots/jarvis-YYYYMMDD-HHMMSS.png.
Creates dir if missing. Notifies with full path.
- Distinct from vision/ pack which captures + describes via LLM.
net_info pack (NEW, resources/commands/net_info/, 3 commands)
- "какая сеть" / "какой wifi" → net.wifi_ssid
Parses `netsh wlan show interfaces` for SSID line (RU + EN field names).
- "мой IP" / "локальный IP" → net.local_ip
PowerShell Get-NetIPAddress, filters out 127.* and 169.* (link-local).
- "внешний IP" / "публичный IP" → net.public_ip
Hits api.ipify.org via jarvis.http.get (no key, plain text).
Tests: 99/99 pass (commands::tests auto-validates new packs).
Build: cargo build --release -p jarvis-app green.
Pack count: 59 → 62 (intro/echo from prior commit + screenshot + net_info; power
already counted — added a command, not a pack).
2026-05-15 18:32:13 +03:00
|
|
|
|
-- Power-management dispatcher: shutdown/restart/sleep/hibernate/logoff/cancel/lock.
|
|
|
|
|
|
-- All commands share this script; behaviour selected by jarvis.context.command_id.
|
|
|
|
|
|
-- Modernised to use jarvis.speak (TTS backend abstraction) + jarvis.cmd helpers.
|
|
|
|
|
|
|
feat(commands): analog-inspired tier-2 — news, currency, crypto, fun, wiki, power, help (33 packs)
Seven more portable Lua packs lifted from common voice-assistant
playbooks (Siri/Alexa/Алиса/Cortana). All sandbox=full, jarvis.http
+ jarvis.system.exec, zero new Rust code. cargo test still 3/3.
news/ — pulls Lenta.ru RSS (en switches to BBC), regex-extracts the
top 5 <title> entries (skipping the channel header), drops them into
the clipboard, then asks Groq for a 2-3 sentence summary at temp 0.4
and speaks it via SAPI. If GROQ_TOKEN is missing it falls back to
just reading the first three headlines.
currency/ — cbr-xml-daily.ru/daily_json.js. Picks USD/EUR/CNY/GBP/
JPY/KZT by keyword in the phrase, computes value / nominal, diffs
against Valute.Previous, says "X стоит N рублей, поднялся/опустился
на M" with ▲/▼ in the notify body.
crypto/ — CoinGecko simple/price with usd,rub and 24hr_change.
Recognises bitcoin / ethereum / solana / dogecoin / the-open-network.
Reports price + direction in plain Russian.
fun/ — joke / fact / quote / compliment, single ask.lua dispatched by
command_id. Per-command system prompt at temp 1.0; seeds with a
random integer so consecutive calls don't repeat.
wiki/ — ru.wikipedia opensearch → REST summary endpoint. If Groq is
available and extract > 350 chars, asks for a 2-3 sentence retell;
otherwise speaks the first 400 chars verbatim. Full extract goes to
clipboard.
power/ — shutdown_pc / restart_pc / sleep_pc / hibernate_pc /
logoff_user / cancel_shutdown. Single act.lua keyed by command_id.
shutdown/restart use shutdown.exe /s|/r /t 30 with a /c message —
30-second grace window so "отмени выключение" actually works.
sleep uses rundll32 powrprof,SetSuspendState, hibernate uses
shutdown.exe /h.
help/ — "что ты умеешь". Reads the parent commands/ dir via
jarvis.fs.list, sorts subdirs (pack names), pairs each with a
hardcoded Russian/English one-liner description, copies the full
list to clipboard and speaks a count + "see clipboard for full list".
Total command packs is now 33 (was 26).
2026-05-15 12:43:09 +03:00
|
|
|
|
local cmd_id = jarvis.context.command_id
|
|
|
|
|
|
local lang = jarvis.context.language
|
|
|
|
|
|
|
|
|
|
|
|
local actions = {
|
feat: lock_workstation + screenshot + net_info packs + modernise power pack
Three handy daily-driver packs + cleanup of the oldest power/act.lua.
power pack — added lock_workstation (resources/commands/power/)
- New command id: lock_workstation
- Phrase: "заблокируй компьютер" / "заблокируй пк" / "заблокируй экран"
- Action: rundll32.exe user32.dll,LockWorkStation
- Sandbox: full (needs system.exec)
- act.lua modernised:
* No more inline PowerShell SAPI escape chain — now uses jarvis.speak
(TTS backend abstraction respects user's chosen Piper/SAPI/Silero).
* Returns via jarvis.cmd.ok/error helpers.
* Logged warning for failing cmds without crashing the pack.
* Cleaner per-action `warn` flag controls the "say cancel to abort" hint.
screenshot pack (NEW, resources/commands/screenshot/, 2 commands)
- "сделай скрин" / "сделай скриншот" → screenshot.to_clipboard
Uses [System.Windows.Forms.Clipboard]::SetImage() with a captured Bitmap.
No file artifact, no LLM call — pure capture, fastest path.
- "сохрани скрин" → screenshot.to_file
Saves to ~/Pictures/Screenshots/jarvis-YYYYMMDD-HHMMSS.png.
Creates dir if missing. Notifies with full path.
- Distinct from vision/ pack which captures + describes via LLM.
net_info pack (NEW, resources/commands/net_info/, 3 commands)
- "какая сеть" / "какой wifi" → net.wifi_ssid
Parses `netsh wlan show interfaces` for SSID line (RU + EN field names).
- "мой IP" / "локальный IP" → net.local_ip
PowerShell Get-NetIPAddress, filters out 127.* and 169.* (link-local).
- "внешний IP" / "публичный IP" → net.public_ip
Hits api.ipify.org via jarvis.http.get (no key, plain text).
Tests: 99/99 pass (commands::tests auto-validates new packs).
Build: cargo build --release -p jarvis-app green.
Pack count: 59 → 62 (intro/echo from prior commit + screenshot + net_info; power
already counted — added a command, not a pack).
2026-05-15 18:32:13 +03:00
|
|
|
|
shutdown_pc = {
|
|
|
|
|
|
cmd = 'shutdown.exe /s /t 30 /c "J.A.R.V.I.S.: shutdown in 30s. Say cancel to abort."',
|
|
|
|
|
|
label = lang == "ru" and "Выключение через 30 секунд" or "Shutdown in 30 sec",
|
|
|
|
|
|
warn = true,
|
|
|
|
|
|
},
|
|
|
|
|
|
restart_pc = {
|
|
|
|
|
|
cmd = 'shutdown.exe /r /t 30 /c "J.A.R.V.I.S.: restart in 30s. Say cancel to abort."',
|
|
|
|
|
|
label = lang == "ru" and "Перезагрузка через 30 секунд" or "Restart in 30 sec",
|
|
|
|
|
|
warn = true,
|
|
|
|
|
|
},
|
|
|
|
|
|
logoff_user = { cmd = 'shutdown.exe /l',
|
|
|
|
|
|
label = lang == "ru" and "Выход из системы" or "Sign out" },
|
|
|
|
|
|
sleep_pc = { cmd = 'rundll32.exe powrprof.dll,SetSuspendState 0,1,0',
|
|
|
|
|
|
label = lang == "ru" and "Сон" or "Sleep" },
|
|
|
|
|
|
hibernate_pc = { cmd = 'shutdown.exe /h',
|
|
|
|
|
|
label = lang == "ru" and "Гибернация" or "Hibernate" },
|
|
|
|
|
|
cancel_shutdown = { cmd = 'shutdown.exe /a',
|
|
|
|
|
|
label = lang == "ru" and "Выключение отменено" or "Shutdown cancelled" },
|
|
|
|
|
|
lock_workstation = { cmd = 'rundll32.exe user32.dll,LockWorkStation',
|
|
|
|
|
|
label = lang == "ru" and "Компьютер заблокирован" or "PC locked" },
|
feat(commands): analog-inspired tier-2 — news, currency, crypto, fun, wiki, power, help (33 packs)
Seven more portable Lua packs lifted from common voice-assistant
playbooks (Siri/Alexa/Алиса/Cortana). All sandbox=full, jarvis.http
+ jarvis.system.exec, zero new Rust code. cargo test still 3/3.
news/ — pulls Lenta.ru RSS (en switches to BBC), regex-extracts the
top 5 <title> entries (skipping the channel header), drops them into
the clipboard, then asks Groq for a 2-3 sentence summary at temp 0.4
and speaks it via SAPI. If GROQ_TOKEN is missing it falls back to
just reading the first three headlines.
currency/ — cbr-xml-daily.ru/daily_json.js. Picks USD/EUR/CNY/GBP/
JPY/KZT by keyword in the phrase, computes value / nominal, diffs
against Valute.Previous, says "X стоит N рублей, поднялся/опустился
на M" with ▲/▼ in the notify body.
crypto/ — CoinGecko simple/price with usd,rub and 24hr_change.
Recognises bitcoin / ethereum / solana / dogecoin / the-open-network.
Reports price + direction in plain Russian.
fun/ — joke / fact / quote / compliment, single ask.lua dispatched by
command_id. Per-command system prompt at temp 1.0; seeds with a
random integer so consecutive calls don't repeat.
wiki/ — ru.wikipedia opensearch → REST summary endpoint. If Groq is
available and extract > 350 chars, asks for a 2-3 sentence retell;
otherwise speaks the first 400 chars verbatim. Full extract goes to
clipboard.
power/ — shutdown_pc / restart_pc / sleep_pc / hibernate_pc /
logoff_user / cancel_shutdown. Single act.lua keyed by command_id.
shutdown/restart use shutdown.exe /s|/r /t 30 with a /c message —
30-second grace window so "отмени выключение" actually works.
sleep uses rundll32 powrprof,SetSuspendState, hibernate uses
shutdown.exe /h.
help/ — "что ты умеешь". Reads the parent commands/ dir via
jarvis.fs.list, sorts subdirs (pack names), pairs each with a
hardcoded Russian/English one-liner description, copies the full
list to clipboard and speaks a count + "see clipboard for full list".
Total command packs is now 33 (was 26).
2026-05-15 12:43:09 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
local a = actions[cmd_id]
|
|
|
|
|
|
if not a then
|
feat: lock_workstation + screenshot + net_info packs + modernise power pack
Three handy daily-driver packs + cleanup of the oldest power/act.lua.
power pack — added lock_workstation (resources/commands/power/)
- New command id: lock_workstation
- Phrase: "заблокируй компьютер" / "заблокируй пк" / "заблокируй экран"
- Action: rundll32.exe user32.dll,LockWorkStation
- Sandbox: full (needs system.exec)
- act.lua modernised:
* No more inline PowerShell SAPI escape chain — now uses jarvis.speak
(TTS backend abstraction respects user's chosen Piper/SAPI/Silero).
* Returns via jarvis.cmd.ok/error helpers.
* Logged warning for failing cmds without crashing the pack.
* Cleaner per-action `warn` flag controls the "say cancel to abort" hint.
screenshot pack (NEW, resources/commands/screenshot/, 2 commands)
- "сделай скрин" / "сделай скриншот" → screenshot.to_clipboard
Uses [System.Windows.Forms.Clipboard]::SetImage() with a captured Bitmap.
No file artifact, no LLM call — pure capture, fastest path.
- "сохрани скрин" → screenshot.to_file
Saves to ~/Pictures/Screenshots/jarvis-YYYYMMDD-HHMMSS.png.
Creates dir if missing. Notifies with full path.
- Distinct from vision/ pack which captures + describes via LLM.
net_info pack (NEW, resources/commands/net_info/, 3 commands)
- "какая сеть" / "какой wifi" → net.wifi_ssid
Parses `netsh wlan show interfaces` for SSID line (RU + EN field names).
- "мой IP" / "локальный IP" → net.local_ip
PowerShell Get-NetIPAddress, filters out 127.* and 169.* (link-local).
- "внешний IP" / "публичный IP" → net.public_ip
Hits api.ipify.org via jarvis.http.get (no key, plain text).
Tests: 99/99 pass (commands::tests auto-validates new packs).
Build: cargo build --release -p jarvis-app green.
Pack count: 59 → 62 (intro/echo from prior commit + screenshot + net_info; power
already counted — added a command, not a pack).
2026-05-15 18:32:13 +03:00
|
|
|
|
return jarvis.cmd.error("Unknown power command.")
|
feat(commands): analog-inspired tier-2 — news, currency, crypto, fun, wiki, power, help (33 packs)
Seven more portable Lua packs lifted from common voice-assistant
playbooks (Siri/Alexa/Алиса/Cortana). All sandbox=full, jarvis.http
+ jarvis.system.exec, zero new Rust code. cargo test still 3/3.
news/ — pulls Lenta.ru RSS (en switches to BBC), regex-extracts the
top 5 <title> entries (skipping the channel header), drops them into
the clipboard, then asks Groq for a 2-3 sentence summary at temp 0.4
and speaks it via SAPI. If GROQ_TOKEN is missing it falls back to
just reading the first three headlines.
currency/ — cbr-xml-daily.ru/daily_json.js. Picks USD/EUR/CNY/GBP/
JPY/KZT by keyword in the phrase, computes value / nominal, diffs
against Valute.Previous, says "X стоит N рублей, поднялся/опустился
на M" with ▲/▼ in the notify body.
crypto/ — CoinGecko simple/price with usd,rub and 24hr_change.
Recognises bitcoin / ethereum / solana / dogecoin / the-open-network.
Reports price + direction in plain Russian.
fun/ — joke / fact / quote / compliment, single ask.lua dispatched by
command_id. Per-command system prompt at temp 1.0; seeds with a
random integer so consecutive calls don't repeat.
wiki/ — ru.wikipedia opensearch → REST summary endpoint. If Groq is
available and extract > 350 chars, asks for a 2-3 sentence retell;
otherwise speaks the first 400 chars verbatim. Full extract goes to
clipboard.
power/ — shutdown_pc / restart_pc / sleep_pc / hibernate_pc /
logoff_user / cancel_shutdown. Single act.lua keyed by command_id.
shutdown/restart use shutdown.exe /s|/r /t 30 with a /c message —
30-second grace window so "отмени выключение" actually works.
sleep uses rundll32 powrprof,SetSuspendState, hibernate uses
shutdown.exe /h.
help/ — "что ты умеешь". Reads the parent commands/ dir via
jarvis.fs.list, sorts subdirs (pack names), pairs each with a
hardcoded Russian/English one-liner description, copies the full
list to clipboard and speaks a count + "see clipboard for full list".
Total command packs is now 33 (was 26).
2026-05-15 12:43:09 +03:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local res = jarvis.system.exec(a.cmd)
|
|
|
|
|
|
local ok = res.success
|
|
|
|
|
|
|
feat: lock_workstation + screenshot + net_info packs + modernise power pack
Three handy daily-driver packs + cleanup of the oldest power/act.lua.
power pack — added lock_workstation (resources/commands/power/)
- New command id: lock_workstation
- Phrase: "заблокируй компьютер" / "заблокируй пк" / "заблокируй экран"
- Action: rundll32.exe user32.dll,LockWorkStation
- Sandbox: full (needs system.exec)
- act.lua modernised:
* No more inline PowerShell SAPI escape chain — now uses jarvis.speak
(TTS backend abstraction respects user's chosen Piper/SAPI/Silero).
* Returns via jarvis.cmd.ok/error helpers.
* Logged warning for failing cmds without crashing the pack.
* Cleaner per-action `warn` flag controls the "say cancel to abort" hint.
screenshot pack (NEW, resources/commands/screenshot/, 2 commands)
- "сделай скрин" / "сделай скриншот" → screenshot.to_clipboard
Uses [System.Windows.Forms.Clipboard]::SetImage() with a captured Bitmap.
No file artifact, no LLM call — pure capture, fastest path.
- "сохрани скрин" → screenshot.to_file
Saves to ~/Pictures/Screenshots/jarvis-YYYYMMDD-HHMMSS.png.
Creates dir if missing. Notifies with full path.
- Distinct from vision/ pack which captures + describes via LLM.
net_info pack (NEW, resources/commands/net_info/, 3 commands)
- "какая сеть" / "какой wifi" → net.wifi_ssid
Parses `netsh wlan show interfaces` for SSID line (RU + EN field names).
- "мой IP" / "локальный IP" → net.local_ip
PowerShell Get-NetIPAddress, filters out 127.* and 169.* (link-local).
- "внешний IP" / "публичный IP" → net.public_ip
Hits api.ipify.org via jarvis.http.get (no key, plain text).
Tests: 99/99 pass (commands::tests auto-validates new packs).
Build: cargo build --release -p jarvis-app green.
Pack count: 59 → 62 (intro/echo from prior commit + screenshot + net_info; power
already counted — added a command, not a pack).
2026-05-15 18:32:13 +03:00
|
|
|
|
-- shutdown /a returns non-zero if there was no pending shutdown — treat as success
|
|
|
|
|
|
-- (idempotent "cancel if any").
|
feat(commands): analog-inspired tier-2 — news, currency, crypto, fun, wiki, power, help (33 packs)
Seven more portable Lua packs lifted from common voice-assistant
playbooks (Siri/Alexa/Алиса/Cortana). All sandbox=full, jarvis.http
+ jarvis.system.exec, zero new Rust code. cargo test still 3/3.
news/ — pulls Lenta.ru RSS (en switches to BBC), regex-extracts the
top 5 <title> entries (skipping the channel header), drops them into
the clipboard, then asks Groq for a 2-3 sentence summary at temp 0.4
and speaks it via SAPI. If GROQ_TOKEN is missing it falls back to
just reading the first three headlines.
currency/ — cbr-xml-daily.ru/daily_json.js. Picks USD/EUR/CNY/GBP/
JPY/KZT by keyword in the phrase, computes value / nominal, diffs
against Valute.Previous, says "X стоит N рублей, поднялся/опустился
на M" with ▲/▼ in the notify body.
crypto/ — CoinGecko simple/price with usd,rub and 24hr_change.
Recognises bitcoin / ethereum / solana / dogecoin / the-open-network.
Reports price + direction in plain Russian.
fun/ — joke / fact / quote / compliment, single ask.lua dispatched by
command_id. Per-command system prompt at temp 1.0; seeds with a
random integer so consecutive calls don't repeat.
wiki/ — ru.wikipedia opensearch → REST summary endpoint. If Groq is
available and extract > 350 chars, asks for a 2-3 sentence retell;
otherwise speaks the first 400 chars verbatim. Full extract goes to
clipboard.
power/ — shutdown_pc / restart_pc / sleep_pc / hibernate_pc /
logoff_user / cancel_shutdown. Single act.lua keyed by command_id.
shutdown/restart use shutdown.exe /s|/r /t 30 with a /c message —
30-second grace window so "отмени выключение" actually works.
sleep uses rundll32 powrprof,SetSuspendState, hibernate uses
shutdown.exe /h.
help/ — "что ты умеешь". Reads the parent commands/ dir via
jarvis.fs.list, sorts subdirs (pack names), pairs each with a
hardcoded Russian/English one-liner description, copies the full
list to clipboard and speaks a count + "see clipboard for full list".
Total command packs is now 33 (was 26).
2026-05-15 12:43:09 +03:00
|
|
|
|
if not ok and cmd_id == "cancel_shutdown" then
|
|
|
|
|
|
ok = true
|
|
|
|
|
|
end
|
|
|
|
|
|
|
feat: lock_workstation + screenshot + net_info packs + modernise power pack
Three handy daily-driver packs + cleanup of the oldest power/act.lua.
power pack — added lock_workstation (resources/commands/power/)
- New command id: lock_workstation
- Phrase: "заблокируй компьютер" / "заблокируй пк" / "заблокируй экран"
- Action: rundll32.exe user32.dll,LockWorkStation
- Sandbox: full (needs system.exec)
- act.lua modernised:
* No more inline PowerShell SAPI escape chain — now uses jarvis.speak
(TTS backend abstraction respects user's chosen Piper/SAPI/Silero).
* Returns via jarvis.cmd.ok/error helpers.
* Logged warning for failing cmds without crashing the pack.
* Cleaner per-action `warn` flag controls the "say cancel to abort" hint.
screenshot pack (NEW, resources/commands/screenshot/, 2 commands)
- "сделай скрин" / "сделай скриншот" → screenshot.to_clipboard
Uses [System.Windows.Forms.Clipboard]::SetImage() with a captured Bitmap.
No file artifact, no LLM call — pure capture, fastest path.
- "сохрани скрин" → screenshot.to_file
Saves to ~/Pictures/Screenshots/jarvis-YYYYMMDD-HHMMSS.png.
Creates dir if missing. Notifies with full path.
- Distinct from vision/ pack which captures + describes via LLM.
net_info pack (NEW, resources/commands/net_info/, 3 commands)
- "какая сеть" / "какой wifi" → net.wifi_ssid
Parses `netsh wlan show interfaces` for SSID line (RU + EN field names).
- "мой IP" / "локальный IP" → net.local_ip
PowerShell Get-NetIPAddress, filters out 127.* and 169.* (link-local).
- "внешний IP" / "публичный IP" → net.public_ip
Hits api.ipify.org via jarvis.http.get (no key, plain text).
Tests: 99/99 pass (commands::tests auto-validates new packs).
Build: cargo build --release -p jarvis-app green.
Pack count: 59 → 62 (intro/echo from prior commit + screenshot + net_info; power
already counted — added a command, not a pack).
2026-05-15 18:32:13 +03:00
|
|
|
|
if not ok then
|
feat(commands): analog-inspired tier-2 — news, currency, crypto, fun, wiki, power, help (33 packs)
Seven more portable Lua packs lifted from common voice-assistant
playbooks (Siri/Alexa/Алиса/Cortana). All sandbox=full, jarvis.http
+ jarvis.system.exec, zero new Rust code. cargo test still 3/3.
news/ — pulls Lenta.ru RSS (en switches to BBC), regex-extracts the
top 5 <title> entries (skipping the channel header), drops them into
the clipboard, then asks Groq for a 2-3 sentence summary at temp 0.4
and speaks it via SAPI. If GROQ_TOKEN is missing it falls back to
just reading the first three headlines.
currency/ — cbr-xml-daily.ru/daily_json.js. Picks USD/EUR/CNY/GBP/
JPY/KZT by keyword in the phrase, computes value / nominal, diffs
against Valute.Previous, says "X стоит N рублей, поднялся/опустился
на M" with ▲/▼ in the notify body.
crypto/ — CoinGecko simple/price with usd,rub and 24hr_change.
Recognises bitcoin / ethereum / solana / dogecoin / the-open-network.
Reports price + direction in plain Russian.
fun/ — joke / fact / quote / compliment, single ask.lua dispatched by
command_id. Per-command system prompt at temp 1.0; seeds with a
random integer so consecutive calls don't repeat.
wiki/ — ru.wikipedia opensearch → REST summary endpoint. If Groq is
available and extract > 350 chars, asks for a 2-3 sentence retell;
otherwise speaks the first 400 chars verbatim. Full extract goes to
clipboard.
power/ — shutdown_pc / restart_pc / sleep_pc / hibernate_pc /
logoff_user / cancel_shutdown. Single act.lua keyed by command_id.
shutdown/restart use shutdown.exe /s|/r /t 30 with a /c message —
30-second grace window so "отмени выключение" actually works.
sleep uses rundll32 powrprof,SetSuspendState, hibernate uses
shutdown.exe /h.
help/ — "что ты умеешь". Reads the parent commands/ dir via
jarvis.fs.list, sorts subdirs (pack names), pairs each with a
hardcoded Russian/English one-liner description, copies the full
list to clipboard and speaks a count + "see clipboard for full list".
Total command packs is now 33 (was 26).
2026-05-15 12:43:09 +03:00
|
|
|
|
jarvis.log("error", "power " .. cmd_id .. " failed: " .. tostring(res.stderr):sub(1, 200))
|
feat: lock_workstation + screenshot + net_info packs + modernise power pack
Three handy daily-driver packs + cleanup of the oldest power/act.lua.
power pack — added lock_workstation (resources/commands/power/)
- New command id: lock_workstation
- Phrase: "заблокируй компьютер" / "заблокируй пк" / "заблокируй экран"
- Action: rundll32.exe user32.dll,LockWorkStation
- Sandbox: full (needs system.exec)
- act.lua modernised:
* No more inline PowerShell SAPI escape chain — now uses jarvis.speak
(TTS backend abstraction respects user's chosen Piper/SAPI/Silero).
* Returns via jarvis.cmd.ok/error helpers.
* Logged warning for failing cmds without crashing the pack.
* Cleaner per-action `warn` flag controls the "say cancel to abort" hint.
screenshot pack (NEW, resources/commands/screenshot/, 2 commands)
- "сделай скрин" / "сделай скриншот" → screenshot.to_clipboard
Uses [System.Windows.Forms.Clipboard]::SetImage() with a captured Bitmap.
No file artifact, no LLM call — pure capture, fastest path.
- "сохрани скрин" → screenshot.to_file
Saves to ~/Pictures/Screenshots/jarvis-YYYYMMDD-HHMMSS.png.
Creates dir if missing. Notifies with full path.
- Distinct from vision/ pack which captures + describes via LLM.
net_info pack (NEW, resources/commands/net_info/, 3 commands)
- "какая сеть" / "какой wifi" → net.wifi_ssid
Parses `netsh wlan show interfaces` for SSID line (RU + EN field names).
- "мой IP" / "локальный IP" → net.local_ip
PowerShell Get-NetIPAddress, filters out 127.* and 169.* (link-local).
- "внешний IP" / "публичный IP" → net.public_ip
Hits api.ipify.org via jarvis.http.get (no key, plain text).
Tests: 99/99 pass (commands::tests auto-validates new packs).
Build: cargo build --release -p jarvis-app green.
Pack count: 59 → 62 (intro/echo from prior commit + screenshot + net_info; power
already counted — added a command, not a pack).
2026-05-15 18:32:13 +03:00
|
|
|
|
return jarvis.cmd.error((lang == "ru" and "Не получилось: " or "Failed: ") .. cmd_id)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
jarvis.system.notify("Power", a.label)
|
|
|
|
|
|
jarvis.log("info", "power: " .. cmd_id .. " -> " .. a.label)
|
|
|
|
|
|
|
|
|
|
|
|
-- For destructive ops with a 30-second window, give the user the abort hint.
|
|
|
|
|
|
local say = a.label
|
|
|
|
|
|
if a.warn then
|
|
|
|
|
|
say = say .. ". " .. (lang == "ru" and "Скажите отмени если передумали."
|
|
|
|
|
|
or "Say cancel to abort.")
|
feat(commands): analog-inspired tier-2 — news, currency, crypto, fun, wiki, power, help (33 packs)
Seven more portable Lua packs lifted from common voice-assistant
playbooks (Siri/Alexa/Алиса/Cortana). All sandbox=full, jarvis.http
+ jarvis.system.exec, zero new Rust code. cargo test still 3/3.
news/ — pulls Lenta.ru RSS (en switches to BBC), regex-extracts the
top 5 <title> entries (skipping the channel header), drops them into
the clipboard, then asks Groq for a 2-3 sentence summary at temp 0.4
and speaks it via SAPI. If GROQ_TOKEN is missing it falls back to
just reading the first three headlines.
currency/ — cbr-xml-daily.ru/daily_json.js. Picks USD/EUR/CNY/GBP/
JPY/KZT by keyword in the phrase, computes value / nominal, diffs
against Valute.Previous, says "X стоит N рублей, поднялся/опустился
на M" with ▲/▼ in the notify body.
crypto/ — CoinGecko simple/price with usd,rub and 24hr_change.
Recognises bitcoin / ethereum / solana / dogecoin / the-open-network.
Reports price + direction in plain Russian.
fun/ — joke / fact / quote / compliment, single ask.lua dispatched by
command_id. Per-command system prompt at temp 1.0; seeds with a
random integer so consecutive calls don't repeat.
wiki/ — ru.wikipedia opensearch → REST summary endpoint. If Groq is
available and extract > 350 chars, asks for a 2-3 sentence retell;
otherwise speaks the first 400 chars verbatim. Full extract goes to
clipboard.
power/ — shutdown_pc / restart_pc / sleep_pc / hibernate_pc /
logoff_user / cancel_shutdown. Single act.lua keyed by command_id.
shutdown/restart use shutdown.exe /s|/r /t 30 with a /c message —
30-second grace window so "отмени выключение" actually works.
sleep uses rundll32 powrprof,SetSuspendState, hibernate uses
shutdown.exe /h.
help/ — "что ты умеешь". Reads the parent commands/ dir via
jarvis.fs.list, sorts subdirs (pack names), pairs each with a
hardcoded Russian/English one-liner description, copies the full
list to clipboard and speaks a count + "see clipboard for full list".
Total command packs is now 33 (was 26).
2026-05-15 12:43:09 +03:00
|
|
|
|
end
|
|
|
|
|
|
|
feat: lock_workstation + screenshot + net_info packs + modernise power pack
Three handy daily-driver packs + cleanup of the oldest power/act.lua.
power pack — added lock_workstation (resources/commands/power/)
- New command id: lock_workstation
- Phrase: "заблокируй компьютер" / "заблокируй пк" / "заблокируй экран"
- Action: rundll32.exe user32.dll,LockWorkStation
- Sandbox: full (needs system.exec)
- act.lua modernised:
* No more inline PowerShell SAPI escape chain — now uses jarvis.speak
(TTS backend abstraction respects user's chosen Piper/SAPI/Silero).
* Returns via jarvis.cmd.ok/error helpers.
* Logged warning for failing cmds without crashing the pack.
* Cleaner per-action `warn` flag controls the "say cancel to abort" hint.
screenshot pack (NEW, resources/commands/screenshot/, 2 commands)
- "сделай скрин" / "сделай скриншот" → screenshot.to_clipboard
Uses [System.Windows.Forms.Clipboard]::SetImage() with a captured Bitmap.
No file artifact, no LLM call — pure capture, fastest path.
- "сохрани скрин" → screenshot.to_file
Saves to ~/Pictures/Screenshots/jarvis-YYYYMMDD-HHMMSS.png.
Creates dir if missing. Notifies with full path.
- Distinct from vision/ pack which captures + describes via LLM.
net_info pack (NEW, resources/commands/net_info/, 3 commands)
- "какая сеть" / "какой wifi" → net.wifi_ssid
Parses `netsh wlan show interfaces` for SSID line (RU + EN field names).
- "мой IP" / "локальный IP" → net.local_ip
PowerShell Get-NetIPAddress, filters out 127.* and 169.* (link-local).
- "внешний IP" / "публичный IP" → net.public_ip
Hits api.ipify.org via jarvis.http.get (no key, plain text).
Tests: 99/99 pass (commands::tests auto-validates new packs).
Build: cargo build --release -p jarvis-app green.
Pack count: 59 → 62 (intro/echo from prior commit + screenshot + net_info; power
already counted — added a command, not a pack).
2026-05-15 18:32:13 +03:00
|
|
|
|
return jarvis.cmd.ok(say)
|