feat: extensions module + 19 new commands (100 → 119)

Mirror of new packs from the rust fork. Self-contained `extensions.py` with
new do_* handlers, registered via 'set_speak' / 'set_clipboard_fn' callbacks
from main.py.

Wiring (main.py)
  - `import extensions` at top.
  - `extensions.set_speak(_speak)` + `extensions.set_clipboard_fn(_set_clipboard)`
    right after _set_clipboard is defined.
  - Added 15 new action-type dispatches in run_action.

extensions.py (new, ~360 lines)
  Action types:
    lock_workstation  → rundll32 user32.dll,LockWorkStation
    screenshot {mode} → clipboard via System.Windows.Forms.Clipboard.SetImage
                        OR file → ~/Pictures/Screenshots/jarvis-<ts>.png
    disk_free / disk_list → PowerShell Get-PSDrive
    coin_flip / uuid_gen / password_gen (length 6..64, copies to clipboard,
                        speaks length only — never echoes the password)
    ssl_check {domain} → PowerShell TCP+SslStream→X509Certificate2 expiry
    wifi_ssid → netsh wlan show interfaces parser (ru + en field names)
    public_ip → urllib request to api.ipify.org
    unit_convert {mode: length|weight|temperature|speed}
                  Russian-grammar pluralisation (фут/фута/футов).
    date_math {mode: days_until|day_of_week}
                  Recognises Новый год, Рождество, 8 марта, 9 мая + "до N <месяц>".
    echo_repeat / self_ping — debug commands
    interesting_fact → Groq LLM (requires GROQ_TOKEN)

commands.yaml — 19 new entries:
  lock_workstation, screenshot_clipboard, screenshot_file, disk_free, disk_list,
  coin_flip, password_gen, uuid_gen, ssl_check, wifi_ssid, public_ip,
  convert_length, convert_weight, convert_temperature, convert_speed,
  days_until, day_of_week, echo_repeat, self_ping, interesting_fact.

Tests: python syntax check + yaml.safe_load both pass. Total commands: 119.

NOT YET mirrored from rust (would require deeper rework):
  memory_pack / profile_switch / scheduler / macros / vision / codebase_qa
  / github_pr / llm_switch / llm_context / media_keys / mood_log / pomodoro
  / habit_nudge / daily_briefing / quick_search / diagnostics / sleep_timer
  / wikipedia (the rewritten one) / intro / mailto / generators (UUID, coin,
  password ARE included — others can follow).

The reason these weren't mirrored: they need new state files
(memory.json, profiles.json, schedule.json, macros.json) and background
threads (scheduler tick). Doable as a follow-up but out of scope here.
This commit is contained in:
Bossiara13 2026-05-15 23:51:13 +03:00
parent ef8da9cba8
commit f82427c7b6
3 changed files with 715 additions and 0 deletions

View file

@ -855,3 +855,181 @@ stupid:
steps:
- {type: play_sound, name: "off"}
- {type: system, op: exit}
# ─── Ported from rust fork (2026-05-15) ───────────────────────────────────
lock_workstation:
phrases:
- заблокируй компьютер
- заблокируй пк
- заблокируй комп
- заблокируй экран
- запри компьютер
action: {type: lock_workstation}
screenshot_clipboard:
phrases:
- сделай скриншот
- сделай скрин
- скопируй экран
- скриншот в буфер
- захвати экран
action: {type: screenshot, mode: clipboard}
screenshot_file:
phrases:
- сохрани скриншот
- сохрани скрин
- скриншот в файл
- сохрани экран
action: {type: screenshot, mode: file}
disk_free:
phrases:
- сколько свободного места
- сколько места на диске
- сколько свободно на диске
- место на диске
- свободное место
action: {type: disk_free}
disk_list:
phrases:
- какие у меня диски
- список дисков
- перечень дисков
action: {type: disk_list}
coin_flip:
phrases:
- подбрось монету
- брось монетку
- орёл или решка
- монетка
action: {type: coin_flip}
password_gen:
phrases:
- сгенерируй пароль
- придумай пароль
- сгенерируй надёжный пароль
action: {type: password_gen}
uuid_gen:
phrases:
- сгенерируй uuid
- сгенерируй юид
- юид
- уникальный идентификатор
action: {type: uuid_gen}
ssl_check:
phrases:
- проверь сертификат
- когда истекает сертификат
- проверь tls
- проверь ssl
- сертификат сайта
action: {type: ssl_check}
wifi_ssid:
phrases:
- к какой сети я подключен
- какой wifi
- какой вайфай
- какая сеть
- имя сети
action: {type: wifi_ssid}
public_ip:
phrases:
- мой внешний ip
- публичный ip
- внешний айпи
- какой у меня внешний
action: {type: public_ip}
convert_length:
phrases:
- переведи метры в футы
- переведи футы в метры
- сколько метров
- сколько футов
- сколько километров
- сколько миль
- переведи в метры
- переведи в футы
- переведи в км
- переведи в мили
action: {type: unit_convert, mode: length}
convert_weight:
phrases:
- переведи килограммы в фунты
- переведи фунты в килограммы
- сколько кг в фунтах
- сколько фунтов
- сколько килограммов
action: {type: unit_convert, mode: weight}
convert_temperature:
phrases:
- переведи цельсий в фаренгейт
- переведи фаренгейт в цельсий
- сколько по фаренгейту
- сколько по цельсию
action: {type: unit_convert, mode: temperature}
convert_speed:
phrases:
- переведи километры в час в мили в час
- переведи в кмч
- переведи в мили в час
- сколько миль в час
- сколько км в час
action: {type: unit_convert, mode: speed}
days_until:
phrases:
- сколько дней до
- сколько до нового года
- сколько до
- до нового года
action: {type: date_math, mode: days_until}
day_of_week:
phrases:
- какой сегодня день недели
- какой день недели
- сегодня какой
action: {type: date_math, mode: day_of_week}
echo_repeat:
phrases:
- повтори за мной
- скажи как я
- эхо
- проверка эхо
action: {type: echo_repeat}
self_ping:
phrases:
- ты тут
- ты слышишь
- ты меня слышишь
- пинг
- ты живой
- ты на месте
- проверка связи
action: {type: self_ping}
interesting_fact:
phrases:
- расскажи интересный факт
- интересный факт о
- интересный факт про
- удиви меня
- интересный факт
- расскажи факт
action: {type: interesting_fact}