opencode-windows-scheduler 1.2.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -2
- package/README.md +21 -4
- package/ROADMAP-STRATEGY.md +61 -159
- package/ROADMAP.md +60 -98
- package/dist/core/audit.d.ts +68 -0
- package/dist/core/audit.d.ts.map +1 -0
- package/dist/core/audit.js +206 -0
- package/dist/core/native-notify.d.ts +36 -0
- package/dist/core/native-notify.d.ts.map +1 -0
- package/dist/core/native-notify.js +110 -0
- package/dist/core/record-history.js +4 -4
- package/dist/core/secrets.d.ts +57 -0
- package/dist/core/secrets.d.ts.map +1 -0
- package/dist/core/secrets.js +331 -0
- package/dist/core/structured-log.d.ts.map +1 -1
- package/dist/core/structured-log.js +9 -0
- package/dist/core/telegram.d.ts +45 -0
- package/dist/core/telegram.d.ts.map +1 -0
- package/dist/core/telegram.js +160 -0
- package/dist/db/schema.d.ts +1 -1
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +15 -0
- package/dist/index.d.ts +30 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +349 -22
- package/dist/notifications.d.ts +26 -6
- package/dist/notifications.d.ts.map +1 -1
- package/dist/notifications.js +191 -34
- package/dist/rpc.d.ts +400 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +146 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +67 -0
- package/dist/settings.d.ts +63 -2
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +126 -2
- package/dist/workspaces.d.ts +8 -2
- package/dist/workspaces.d.ts.map +1 -1
- package/dist/workspaces.js +21 -4
- package/docs/ARCHITECTURE.md +16 -6
- package/docs/FEATURES.md +57 -12
- package/docs/README.ru.md +23 -4
- package/gui-experimental.cjs +4 -4
- package/package.json +5 -2
- package/src/core/audit.ts +291 -0
- package/src/core/native-notify.ts +154 -0
- package/src/core/record-history.ts +6 -4
- package/src/core/secrets.ts +385 -0
- package/src/core/structured-log.ts +9 -0
- package/src/core/telegram.ts +219 -0
- package/src/db/schema.ts +15 -0
- package/src/gui.tsx +543 -6
- package/src/index.ts +459 -22
- package/src/notifications.ts +232 -40
- package/src/rpc.ts +157 -0
- package/src/server.ts +67 -0
- package/src/settings.ts +213 -4
- package/src/workspaces.ts +22 -4
package/docs/FEATURES.md
CHANGED
|
@@ -397,27 +397,71 @@ matrix combinations are rejected explicitly.
|
|
|
397
397
|
|
|
398
398
|
### Notifications
|
|
399
399
|
|
|
400
|
-
|
|
400
|
+
Notifications on run completion through three independent channels — webhook, Telegram
|
|
401
|
+
and native OS notifications — configurable in settings and testable with
|
|
401
402
|
`test_notification`.
|
|
402
403
|
|
|
403
|
-
- **
|
|
404
|
-
compatible webhook (`{ content, text }`). `webhook.timeoutMs`
|
|
405
|
-
`webhook.retryCount` (default 2) and `webhook.retryDelayMs`
|
|
406
|
-
the request; network errors, timeouts, HTTP 5xx and 429 are
|
|
407
|
-
backoff (capped at 30 s), other 4xx are not.
|
|
404
|
+
- **Webhook delivery:** per-task completion (success/error/timeout) through a
|
|
405
|
+
Discord/Slack compatible webhook (`{ content, text }`). `webhook.timeoutMs`
|
|
406
|
+
(default 10 000), `webhook.retryCount` (default 2) and `webhook.retryDelayMs`
|
|
407
|
+
(default 1000) control the request; network errors, timeouts, HTTP 5xx and 429 are
|
|
408
|
+
retried with exponential backoff (capped at 30 s), other 4xx are not.
|
|
409
|
+
- **Telegram:** Bot API `sendMessage` with `chat_id`, `parse_mode` (`HTML`,
|
|
410
|
+
`MarkdownV2`, `Markdown` or plain text), optional silent mode, forum topic
|
|
411
|
+
(`messageThreadId`) and a dashboard link (`includeDashboardLink`). Configured in the
|
|
412
|
+
GUI or with `manage_settings` → `notifications.telegram`. `botToken` and `chatId`
|
|
413
|
+
may instead come from `OPENCODE_SCHEDULER_TELEGRAM_BOT_TOKEN` and
|
|
414
|
+
`OPENCODE_SCHEDULER_TELEGRAM_CHAT_ID` so no secret is stored in `settings.json`;
|
|
415
|
+
the token is masked in every error message and log line.
|
|
416
|
+
- **Native OS notifications:** Windows Toast (PowerShell/WinRT), macOS Notification
|
|
417
|
+
Center (`osascript`) and Linux `notify-send`. No extra dependency: `node-notifier`
|
|
418
|
+
is not required. `notifications.native.sound` toggles the sound where supported.
|
|
408
419
|
- **Templates:** `templates.success` and `templates.error` accept placeholders
|
|
409
|
-
`{task}`, `{status}`, `{duration}`, `{error}`, `{emoji}`.
|
|
420
|
+
`{task}`, `{status}`, `{duration}`, `{error}`, `{emoji}`, `{cost}` and `{tokens}`.
|
|
421
|
+
When token/cost data is present the message gains a ` · 1500 tok · $0.0060` suffix.
|
|
410
422
|
- **Filters:** `filters.include` / `filters.exclude` are task-name patterns with `*`
|
|
411
423
|
wildcards; an empty include list means all tasks, exclude wins.
|
|
424
|
+
- **Quiet hours:** `quietHours.enabled` with `from`/`to` in `HH:MM` (an overnight
|
|
425
|
+
range such as 22:00 → 08:00 is supported). During the window `success` and
|
|
426
|
+
`partial` are suppressed while `error` and `timeout` are still delivered.
|
|
412
427
|
- **Matrix notifications:** on family completion — success, `partial` (`onPartial`)
|
|
413
428
|
and all clones failed (`onAllFailed`). A stuck detector reports clones running
|
|
414
429
|
longer than `matrix.stuckAfterMinutes` (default 60, `0` disables) once per run.
|
|
415
430
|
- **Digest:** `digest.enabled` sends a daily (`frequency: "daily"`, at `digest.time`)
|
|
416
431
|
or weekly (Mondays, catch-up afterwards) summary: runs, success rate, cost, tokens
|
|
417
|
-
and top errors. Also available as the
|
|
418
|
-
«📊 Отправить дайджест сейчас» button (manual sends
|
|
419
|
-
|
|
420
|
-
|
|
432
|
+
and top errors through every enabled channel. Also available as the
|
|
433
|
+
`send_digest` RPC and the GUI's «📊 Отправить дайджест сейчас» button (manual sends
|
|
434
|
+
do not move the schedule).
|
|
435
|
+
- **Test button:** sends a test message to `all`, `webhook`, `telegram` or `native`
|
|
436
|
+
and reports per-channel success/failure. Failures in one channel never block the
|
|
437
|
+
others and never throw into the task run.
|
|
438
|
+
|
|
439
|
+
### Secrets (Спринт 26)
|
|
440
|
+
|
|
441
|
+
Encrypted secret storage in `<PLUGIN_DIR>/secrets.json` with AES-256-GCM and a
|
|
442
|
+
32-byte key file `secrets.key` (rights 0600). The `manage_secrets` tool (and the
|
|
443
|
+
«🔐 Секреты» GUI panel) supports `list`, `set` and `delete`. Secret names match
|
|
444
|
+
`[A-Za-z0-9_.-]` and are up to 64 characters; list shows only name, masked preview
|
|
445
|
+
(`••••` + last 4 chars) and update time — never the value.
|
|
446
|
+
|
|
447
|
+
In task workspace `env`, reference a secret as `${secret:NAME}`. The value is
|
|
448
|
+
substituted at run time (missing secrets resolve to an empty string with a
|
|
449
|
+
name-only warning). Secret references survive masking — they are shown verbatim in
|
|
450
|
+
the GUI env editor — while literal secret-like values (`TOKEN=`, `PASSWORD=`, …)
|
|
451
|
+
are masked as `***` in logs, structured logs, history and audit.
|
|
452
|
+
|
|
453
|
+
### Audit log (Спринт 26)
|
|
454
|
+
|
|
455
|
+
Every mutation — task create/update/delete/run, settings, templates, profiles,
|
|
456
|
+
workspaces, secrets, import, history cleanup — is recorded in an `audit_log`
|
|
457
|
+
table in SQLite with action, target type/target, actor (`mcp`/`gui`/`http`),
|
|
458
|
+
source, redacted details and remote address. Indexes on `ts` and `action`;
|
|
459
|
+
retention defaults to 90 days / 10 000 records with automatic cleanup.
|
|
460
|
+
|
|
461
|
+
The `get_audit_log` tool (and the «📜 Журнал аудита» GUI panel) reads the journal
|
|
462
|
+
with filters by `action`, `target`, `actor`, `since`/`until` and `limit`. Also
|
|
463
|
+
available as RPC `get_audit` and HTTP `GET /api/audit`. Secret values in details
|
|
464
|
+
are redacted; `${secret:NAME}` references are preserved verbatim.
|
|
421
465
|
|
|
422
466
|
### Crash recovery
|
|
423
467
|
|
|
@@ -436,11 +480,12 @@ the `cleanup_history` RPC and the GUI's «Очистить сейчас» button
|
|
|
436
480
|
|
|
437
481
|
## Agent interface
|
|
438
482
|
|
|
439
|
-
Twenty-
|
|
483
|
+
Twenty-four tools: `schedule_task`, `list_tasks`, `update_task`, `delete_task`,
|
|
440
484
|
`run_task_now`, `pause_task`, `resume_task`, `get_history`, `get_task_logs`, `dry_run`,
|
|
441
485
|
`manage_workspaces`, `matrix_control` (results/cancel/cleanup/preview), `get_metrics`,
|
|
442
486
|
`get_analytics`, `manage_settings`, `manage_templates`, `manage_profiles`,
|
|
443
487
|
`transfer_tasks`, `send_notification`, `get_dashboard_info`, `cleanup_history`,
|
|
488
|
+
`manage_secrets`, `get_audit_log`,
|
|
444
489
|
`emit_event`.
|
|
445
490
|
|
|
446
491
|
A bundled skill, `scheduled-job-best-practices`, teaches the agent safe defaults:
|
package/docs/README.ru.md
CHANGED
|
@@ -38,8 +38,8 @@ English version: [README.md](../README.md).
|
|
|
38
38
|
| Триггеры | cron, одноразовый запуск (`triggerType: "once"`), изменение файла (chokidar), MCP-события, входящие webhooks (`POST /api/hooks/:task` с HMAC) |
|
|
39
39
|
| Мультирепо | workspaces с валидацией путей, запуски по workspace, матрица поверх родительской задачи |
|
|
40
40
|
| Наблюдаемость | история SQLite (success / error / timeout / partial / running), метрики (длительность, токены, стоимость), JSONL-логи с `/api/logs`, Prometheus `/metrics`, экспорт OTLP, логи по задачам, веб-дашборд с аналитикой за 14 дней, ретеншн истории и экспорт CSV/JSON |
|
|
41
|
-
| Эксплуатация | dry-run, экспорт/импорт JSON, шаблоны, webhook
|
|
42
|
-
| Интерфейсы | панель OpenCode GUI, веб-дашборд,
|
|
41
|
+
| Эксплуатация | dry-run, экспорт/импорт JSON, шаблоны, уведомления по нескольким каналам (webhook, Telegram, нативные toast), тихие часы, дайджест, зашифрованные секреты (`${secret:NAME}`), журнал аудита, настройки |
|
|
42
|
+
| Интерфейсы | панель OpenCode GUI, веб-дашборд, 24 инструмента для агента, встроенный скилл |
|
|
43
43
|
|
|
44
44
|
## Установка
|
|
45
45
|
|
|
@@ -80,7 +80,7 @@ npm run build && npm run build:gui
|
|
|
80
80
|
|
|
81
81
|
## Инструменты для агента
|
|
82
82
|
|
|
83
|
-
Агенту доступен весь функционал —
|
|
83
|
+
Агенту доступен весь функционал — 24 инструмента: расписание, пайплайны, эксплуатация, аналитика и администрирование.
|
|
84
84
|
|
|
85
85
|
| Инструмент | Аргументы | Что делает |
|
|
86
86
|
|---|---|---|
|
|
@@ -102,7 +102,7 @@ npm run build && npm run build:gui
|
|
|
102
102
|
| `manage_templates` | `action`, поля шаблона | Список, сохранение и удаление шаблонов задач |
|
|
103
103
|
| `manage_profiles` | `action`, `name?`, `port?` | Список, создание, переключение и удаление изолированных профилей |
|
|
104
104
|
| `transfer_tasks` | `action`, `data?` | Экспорт всех задач в JSON и импорт обратно |
|
|
105
|
-
| `send_notification` | `action` (`test`/`digest`) | Проверка
|
|
105
|
+
| `send_notification` | `action` (`test`/`digest`), `channel?` (`all`/`webhook`/`telegram`/`native`) | Проверка каналов уведомлений или отправка дайджеста |
|
|
106
106
|
| `get_dashboard_info` | — | Порт/URL дашборда, платформа, заголовок, активный профиль |
|
|
107
107
|
| `cleanup_history` | `retentionDays?`, `maxRecords?` | Удаление старой истории по возрасту и/или лимиту записей |
|
|
108
108
|
| `emit_event` | `eventName`, `payload?` | Запуск задач, подписанных на MCP-событие |
|
|
@@ -158,6 +158,10 @@ src/
|
|
|
158
158
|
dry-run.ts симуляция пайплайна
|
|
159
159
|
lock.ts защита от наложения запусков
|
|
160
160
|
file-watcher.ts триггеры chokidar
|
|
161
|
+
telegram.ts доставка в Telegram Bot API
|
|
162
|
+
native-notify.ts нативные уведомления (Windows/macOS/Linux)
|
|
163
|
+
secrets.ts зашифрованное хранилище секретов (AES-256-GCM)
|
|
164
|
+
audit.ts журнал аудита (audit_log в SQLite)
|
|
161
165
|
db/ SQLite: задачи, история, метрики, настройки
|
|
162
166
|
task-transfer.ts экспорт / импорт / валидация
|
|
163
167
|
```
|
|
@@ -192,6 +196,21 @@ Windows (Планировщик Windows), macOS (launchd) и Linux (crontab). Р
|
|
|
192
196
|
**Куда отправляются данные?**
|
|
193
197
|
Никуда. История, логи, метрики и настройки хранятся локально в SQLite; телеметрии и аккаунтов нет.
|
|
194
198
|
|
|
199
|
+
**Как включить уведомления в Telegram?**
|
|
200
|
+
Создайте бота у [@BotFather](https://t.me/BotFather), скопируйте токен, напишите боту сообщение и возьмите `chat_id` из `getUpdates` (или используйте ID группы/канала). Укажите оба значения в панели или через `manage_settings` → `notifications.telegram` (`enabled`, `botToken`, `chatId`, при необходимости `parseMode`). Чтобы не хранить секреты в `settings.json`, задайте `OPENCODE_SCHEDULER_TELEGRAM_BOT_TOKEN` и `OPENCODE_SCHEDULER_TELEGRAM_CHAT_ID` — переменные используются, если поля пусты. Проверка: `send_notification` с `channel: "telegram"`.
|
|
201
|
+
|
|
202
|
+
**Нужен ли отдельный пакет для системных уведомлений?**
|
|
203
|
+
Нет. Windows Toast (PowerShell/WinRT), macOS Notification Center (`osascript`) и Linux `notify-send` вызываются напрямую, `node-notifier` не требуется. Включается через `notifications.native.enabled`.
|
|
204
|
+
|
|
205
|
+
**Можно ли отключить уведомления на ночь?**
|
|
206
|
+
Да. Задайте `notifications.quietHours` (`enabled`, `from`, `to` в `HH:MM`). В этом окне успешные и `partial` запуски не отправляются, а ошибки и таймауты приходят всегда.
|
|
207
|
+
|
|
208
|
+
**Как хранить секреты?**
|
|
209
|
+
Используйте `manage_secrets` (или панель «🔐 Секреты» в сайдбаре). Секреты хранятся в `<PLUGIN_DIR>/secrets.json` с шифрованием AES-256-GCM и ключевым файлом `secrets.key` (права 0600). В `env` задачи секрет ссылается как `${secret:NAME}` — значение подставляется при запуске и маскируется в логах, истории и аудите.
|
|
210
|
+
|
|
211
|
+
**Можно ли посмотреть, кто что изменил?**
|
|
212
|
+
Да. Журнал аудита (`get_audit_log`, панель «📜 Журнал аудита», `GET /api/audit`) записывает каждую мутацию — создание/изменение/удаление/запуск задачи, настройки, шаблоны, профили, workspace, секреты, импорт, очистку истории — с aktёром (mcp/gui/http), источником, временной меткой и замаскированными деталями. Ретеншн по умолчанию 90 дней / 10 000 записей.
|
|
213
|
+
|
|
195
214
|
**Чем это отличается от `experimental.schedules` в OpenCode?**
|
|
196
215
|
Встроенный планировщик выполняет задачи, пока OpenCode запущен. Этот плагин использует нативный планировщик ОС и добавляет DAG-пайплайны, матричные сборки, Quality Gates, webhooks и наблюдаемость.
|
|
197
216
|
|