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).
75 lines
5.2 KiB
Lua
75 lines
5.2 KiB
Lua
local lang = jarvis.context.language
|
|
|
|
local commands_dir = jarvis.context.command_path:match("^(.*[/\\])[^/\\]+[/\\]?$")
|
|
if not commands_dir then
|
|
jarvis.audio.play_error()
|
|
return { chain = false }
|
|
end
|
|
|
|
local entries = jarvis.fs.list(commands_dir)
|
|
local packs = {}
|
|
for _, e in ipairs(entries) do
|
|
if e.is_dir then table.insert(packs, e.name) end
|
|
end
|
|
table.sort(packs)
|
|
|
|
local descriptions = {
|
|
apps = lang == "ru" and "браузер, блокнот, калькулятор, проводник, терминал, настройки, диспетчер задач, блокировка, скриншот" or "browser, notepad, calculator, explorer, terminal, settings, taskmgr, lock, screenshot",
|
|
volume = lang == "ru" and "громче, тише, mute, максимум" or "louder, quieter, mute, max",
|
|
media = lang == "ru" and "пауза, play, следующий/предыдущий трек, стоп" or "pause/play, next/prev track, stop",
|
|
file_search = lang == "ru" and "найди файл X" or "find file X",
|
|
output_device = lang == "ru" and "список устройств вывода, переключи" or "list/cycle audio out",
|
|
sysinfo = lang == "ru" and "время, заряд, CPU, RAM, диск, статус системы" or "time, battery, cpu, ram, disk",
|
|
window = lang == "ru" and "сверни/разверни/закрой окно, snap влево/вправо, рабочий стол" or "min/max/close window, snap, desktop",
|
|
clipboard_read = lang == "ru" and "прочитай буфер" or "read clipboard",
|
|
notes = lang == "ru" and "запиши/покажи заметки" or "write/show notes",
|
|
process_kill = lang == "ru" and "закрой программу X" or "kill process X",
|
|
websearch = lang == "ru" and "загугли / ютуб / вики / яндекс" or "search google/youtube/wiki/yandex",
|
|
translate = lang == "ru" and "переведи на X" or "translate to X",
|
|
math = lang == "ru" and "посчитай X" or "calculate X",
|
|
theme = lang == "ru" and "тёмная/светлая тема" or "dark/light theme",
|
|
projects = lang == "ru" and "открой/список проектов" or "open/list projects",
|
|
sound_panel = lang == "ru" and "панель звука" or "sound panel",
|
|
codegen = lang == "ru" and "напиши код X" or "write code X",
|
|
ocr = lang == "ru" and "прочитай экран" or "read screen",
|
|
reminders = lang == "ru" and "напомни через N минут X" or "remind me in N min X",
|
|
date_query = lang == "ru" and "что сегодня / завтра / вчера" or "today/tomorrow/yesterday",
|
|
voice_type = lang == "ru" and "напечатай X" or "type X",
|
|
dice = lang == "ru" and "монетка, кубик, случайное число" or "coin, dice, random",
|
|
stopwatch = lang == "ru" and "засеки время / стоп секундомер" or "start/stop stopwatch",
|
|
news = lang == "ru" and "что нового" or "what's new",
|
|
currency = lang == "ru" and "курс доллара / евро / юаня" or "USD/EUR/CNY rate",
|
|
crypto = lang == "ru" and "цена биткоина / эфира" or "BTC/ETH price",
|
|
fun = lang == "ru" and "шутка, факт, цитата, комплимент" or "joke, fact, quote, compliment",
|
|
wiki = lang == "ru" and "что такое / кто такой X" or "what/who is X",
|
|
power = lang == "ru" and "выключи / перезагрузи / усыпи / гибернация" or "shutdown / restart / sleep / hibernate",
|
|
weather = lang == "ru" and "какая погода" or "what's the weather",
|
|
counter = lang == "ru" and "счётчик" or "counter",
|
|
help = lang == "ru" and "что ты умеешь" or "what can you do",
|
|
}
|
|
|
|
local lines = {}
|
|
for _, p in ipairs(packs) do
|
|
local desc = descriptions[p] or ""
|
|
if desc ~= "" then
|
|
table.insert(lines, "• " .. p .. ": " .. desc)
|
|
end
|
|
end
|
|
|
|
local title = string.format(lang == "ru" and "Команды (%d пакетов)" or "Commands (%d packs)", #packs)
|
|
local body = table.concat(lines, "\n")
|
|
jarvis.system.clipboard.set(body)
|
|
jarvis.system.notify(title, body:sub(1, 800))
|
|
|
|
local say = lang == "ru"
|
|
and string.format("Загружено %d пакетов команд. Полный список скопирован в буфер.", #packs)
|
|
or string.format("Loaded %d command packs. Full list is on the clipboard.", #packs)
|
|
local sapi = say:gsub("'", "''")
|
|
local ps = string.format(
|
|
[[Add-Type -AssemblyName System.Speech; $s = New-Object System.Speech.Synthesis.SpeechSynthesizer; foreach ($v in $s.GetInstalledVoices()) { if ($v.VoiceInfo.Culture.TwoLetterISOLanguageName -eq 'ru') { try { $s.SelectVoice($v.VoiceInfo.Name); break } catch {} } } $s.Speak('%s')]],
|
|
sapi
|
|
)
|
|
jarvis.system.exec(string.format('powershell -NoProfile -Command "%s"', ps:gsub('"', '\\"')))
|
|
|
|
jarvis.audio.play_ok()
|
|
return { chain = false }
|