opencode-windows-scheduler 1.5.0 → 1.5.1
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 +37 -1
- package/LICENSE +21 -21
- package/README.md +24 -2
- package/ROADMAP-STRATEGY.md +16 -16
- package/ROADMAP.md +410 -141
- package/dist/core/dry-run.d.ts +10 -0
- package/dist/core/dry-run.d.ts.map +1 -1
- package/dist/core/dry-run.js +55 -34
- package/dist/core/git-trigger.d.ts.map +1 -1
- package/dist/core/git-trigger.js +15 -9
- package/dist/core/matrix.d.ts.map +1 -1
- package/dist/core/matrix.js +48 -22
- package/dist/core/schedule-v2.d.ts.map +1 -1
- package/dist/core/schedule-v2.js +29 -17
- package/dist/core/scheduler/types.d.ts +6 -0
- package/dist/core/scheduler/types.d.ts.map +1 -1
- package/dist/core/scheduler/windows.d.ts +6 -2
- package/dist/core/scheduler/windows.d.ts.map +1 -1
- package/dist/core/scheduler/windows.js +25 -10
- package/dist/core/telegram.d.ts.map +1 -1
- package/dist/core/telegram.js +13 -10
- package/dist/i18n.d.ts +52 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +292 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +781 -179
- package/dist/notifications.d.ts.map +1 -1
- package/dist/notifications.js +74 -40
- package/dist/rpc.d.ts +15 -2
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +6 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +89 -48
- package/dist/settings.d.ts +3 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +20 -8
- package/dist/task-transfer.d.ts +13 -0
- package/dist/task-transfer.d.ts.map +1 -1
- package/dist/task-transfer.js +11 -0
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +32 -0
- package/docs/ARCHITECTURE.md +36 -1
- package/docs/FEATURES.md +19 -0
- package/docs/README.ru.md +17 -1
- package/gui-experimental.cjs +9 -9
- package/locales/en.json +695 -0
- package/locales/ru.json +695 -0
- package/package.json +6 -3
- package/scripts/test-locale.mjs +44 -0
- package/src/core/dry-run.ts +76 -38
- package/src/core/git-trigger.ts +15 -9
- package/src/core/matrix.ts +52 -26
- package/src/core/schedule-v2.ts +47 -17
- package/src/core/scheduler/types.ts +6 -0
- package/src/core/scheduler/windows.ts +25 -10
- package/src/core/telegram.ts +16 -10
- package/src/gui.tsx +575 -480
- package/src/i18n.ts +339 -0
- package/src/index.ts +943 -191
- package/src/notifications.ts +83 -42
- package/src/rpc.ts +6 -2
- package/src/server.ts +89 -48
- package/src/settings.ts +38 -10
- package/src/task-transfer.ts +24 -0
- package/src/types.ts +37 -0
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -16,6 +16,7 @@ model, the modules, the data model and the extension points.
|
|
|
16
16
|
- [Triggers](#triggers)
|
|
17
17
|
- [Storage](#storage)
|
|
18
18
|
- [Interfaces](#interfaces)
|
|
19
|
+
- [Localization](#localization)
|
|
19
20
|
- [Security model](#security-model)
|
|
20
21
|
- [Extension points](#extension-points)
|
|
21
22
|
|
|
@@ -129,7 +130,8 @@ from their clones instead of their own last run.
|
|
|
129
130
|
| `src/profiles.ts` | Profile directory resolution: per-profile plugin dir (base for `default`, `<base>/profiles/<name>` for named profiles); profile name, marker, port, create/delete/switch |
|
|
130
131
|
| `src/workspaces.ts` | Workspace registry and path validation; env pairs and `.env` file resolution with secret masking |
|
|
131
132
|
| `src/templates.ts` | Reusable task templates |
|
|
132
|
-
| `src/settings.ts` | Plugin settings: notifications, history retention, audit |
|
|
133
|
+
| `src/settings.ts` | Plugin settings: notifications, history retention, audit, interface locale |
|
|
134
|
+
| `src/i18n.ts` | Interface locale (`ru` default, `en`), JSON catalogs in `locales/`, ICU subset (`{param}`, `plural`) via built-in `Intl`, fallback to `ru` |
|
|
133
135
|
| `src/notifications.ts` | Multi-channel delivery (webhook, Telegram, native OS) with retries/backoff, templates, task filters, quiet hours, matrix and stuck-clone notifications, daily/weekly digest |
|
|
134
136
|
| `src/core/telegram.ts` | Telegram Bot API `sendMessage`: parse-mode escaping, dashboard link, token validation and masking |
|
|
135
137
|
| `src/core/native-notify.ts` | Native OS notifications: Windows Toast (PowerShell/WinRT), macOS `osascript`, Linux `notify-send`; no external dependency |
|
|
@@ -315,6 +317,39 @@ never requires a manual migration.
|
|
|
315
317
|
| Sidebar GUI | Human | `gui-experimental.cjs` |
|
|
316
318
|
| Web dashboard | Human | `startDashboardServer` (localhost, random/fixed port) |
|
|
317
319
|
|
|
320
|
+
## Localization
|
|
321
|
+
|
|
322
|
+
User-visible text lives in flat JSON catalogs: `locales/ru.json` (default) and
|
|
323
|
+
`locales/en.json`. Keys are dot-separated and grouped by surface — `gui.*`, `notify.*`,
|
|
324
|
+
`tool.*`, `dryRun.*`, `matrix.*`, `schedule.*` — and both catalogs must have the same
|
|
325
|
+
key set with non-empty values.
|
|
326
|
+
|
|
327
|
+
`src/i18n.ts` loads the catalogs once and caches them. It exposes `t(key, params)`,
|
|
328
|
+
`setLocale(locale)`, `messageIn(locale, key)` and `hasKey(key, locale)`. Lookup order is
|
|
329
|
+
active locale → `en` → `ru` → the key itself, so a missing translation never renders as
|
|
330
|
+
an empty string. The `locale` setting (`ru` default, `en` optional) is applied
|
|
331
|
+
immediately, without restarting OpenCode. The sidebar GUI embeds the catalogs at build
|
|
332
|
+
time via `registerCatalog`, because a webview bundle cannot read package files at
|
|
333
|
+
runtime.
|
|
334
|
+
|
|
335
|
+
The template subset is deliberately small and dependency-free:
|
|
336
|
+
|
|
337
|
+
- `{name}` — interpolation; the caller formats the value (duration, money, date).
|
|
338
|
+
- `{count, plural, one {…} few {…} many {…} other {…}}` — plural forms through
|
|
339
|
+
`Intl.PluralRules` for the active locale (`ru` uses one/few/many, `en` one/other).
|
|
340
|
+
|
|
341
|
+
Rules:
|
|
342
|
+
|
|
343
|
+
- a user-visible message is a whole phrase in the catalog, including punctuation; never
|
|
344
|
+
concatenate translated fragments;
|
|
345
|
+
- store stable codes, not localized text, in the database; translate at render time;
|
|
346
|
+
- agent tool descriptions, schemas and API payloads stay English; `console.*`
|
|
347
|
+
diagnostics stay Russian;
|
|
348
|
+
- add every new key to both catalogs. `test-docs.mjs` enforces parity and non-empty
|
|
349
|
+
values; `npm run test:en` replays all suites under `en` and CI runs it on Linux.
|
|
350
|
+
`OPENCODE_SCHEDULER_LOCALE` only overrides the initial locale for tests and services —
|
|
351
|
+
it is not a user-facing setting.
|
|
352
|
+
|
|
318
353
|
## Security model
|
|
319
354
|
|
|
320
355
|
- The dashboard has **no authentication** and binds to localhost. Do not expose it.
|
package/docs/FEATURES.md
CHANGED
|
@@ -191,6 +191,24 @@ Events are emitted through the `emit_event` RPC method.
|
|
|
191
191
|
- `pause_task` / `resume_task` disable and re-enable the OS entry. For a matrix parent
|
|
192
192
|
every clone is paused.
|
|
193
193
|
|
|
194
|
+
### Logon mode (Windows)
|
|
195
|
+
|
|
196
|
+
By default a task is **interactive only**: Task Scheduler runs it only while the user
|
|
197
|
+
who created it is logged on. That is the safe default — the job sees the user profile,
|
|
198
|
+
mapped drives, the project's `opencode.json` and saved credentials.
|
|
199
|
+
|
|
200
|
+
Some jobs must run outside business hours or on a locked/signed-out machine. Pass
|
|
201
|
+
`runWhenLoggedOff: true` (agent tool `schedule_task` / `update_task`, or the sidebar) to
|
|
202
|
+
register the task as `schtasks /ru SYSTEM` instead. The run then happens in session 0,
|
|
203
|
+
without the user's profile, mapped drives, network shares or saved credentials. Tasks
|
|
204
|
+
that depend on the user environment can fail with `Access is denied` or missing files,
|
|
205
|
+
so check them with `dry_run` first and prefer absolute paths.
|
|
206
|
+
|
|
207
|
+
`runWhenLoggedOff` is Windows-only: Linux crontab already runs without a logged-on user,
|
|
208
|
+
and a macOS launchd agent runs only inside a user session. `list_tasks` reports both the
|
|
209
|
+
OS value (`logonMode`) and the plugin setting (`runWhenLoggedOff`); `dry_run` shows the
|
|
210
|
+
same pair before the task is registered.
|
|
211
|
+
|
|
194
212
|
## Execution policy
|
|
195
213
|
|
|
196
214
|
### Timeout and no-overlap
|
|
@@ -554,6 +572,7 @@ plugin, no installation step required.
|
|
|
554
572
|
| File triggers | chokidar | chokidar | chokidar |
|
|
555
573
|
| History, metrics, dashboard | yes | yes | yes |
|
|
556
574
|
| Agent tools and skill | yes | yes | yes |
|
|
575
|
+
| Runs without a logged-on user | opt-in (`runWhenLoggedOff`) | always (crontab) | no (per-user agent) |
|
|
557
576
|
|
|
558
577
|
## Limits and non-goals
|
|
559
578
|
|
package/docs/README.ru.md
CHANGED
|
@@ -41,6 +41,12 @@ English version: [README.md](../README.md).
|
|
|
41
41
|
| Эксплуатация | dry-run, экспорт/импорт JSON, шаблоны, уведомления по нескольким каналам (webhook, Telegram, нативные toast), тихие часы, дайджест, зашифрованные секреты (`${secret:NAME}`), журнал аудита, настройки |
|
|
42
42
|
| Интерфейсы | панель OpenCode GUI, веб-дашборд, 24 инструмента для агента, встроенный скилл |
|
|
43
43
|
|
|
44
|
+
### Язык интерфейса
|
|
45
|
+
|
|
46
|
+
Интерфейс доступен на русском (по умолчанию) и английском. Язык переключается в настройках сайдбара (Настройки → Язык) или инструментом `manage_settings` (`action: "update"`, `locale: "en"`). Изменение применяется сразу к панели, уведомлениям и дайджесту, дашборду и результатам инструментов агента — перезапуск не нужен. Описания и схемы инструментов агента остаются английскими, диагностика в консоли — русской.
|
|
47
|
+
|
|
48
|
+
Каталоги лежат в `locales/ru.json` и `locales/en.json`; набор ключей в них должен совпадать, иначе CI падает.
|
|
49
|
+
|
|
44
50
|
## Установка
|
|
45
51
|
|
|
46
52
|
Нужны OpenCode v2 и Node.js 20+.
|
|
@@ -168,15 +174,22 @@ src/
|
|
|
168
174
|
|
|
169
175
|
Обёртки задач запускают `opencode run` в рабочей директории задачи, поэтому MCP-серверы проекта подхватываются автоматически.
|
|
170
176
|
|
|
177
|
+
### Режим входа (Windows)
|
|
178
|
+
|
|
179
|
+
По умолчанию задачи **интерактивные** (`Interactive only`): Планировщик Windows запускает их только при активном входе пользователя, создавшего задачу, — с обычным профилем, дисками и сохранёнными учётными данными. Передайте `runWhenLoggedOff: true`, чтобы задача работала без входа (`schtasks /ru SYSTEM`). Такая задача идёт в session 0 — без профиля пользователя, подключённых дисков, сетевых ресурсов и сохранённых паролей, поэтому задачи, которым нужно ваше окружение, могут упасть; проверяйте их через `dry_run`. На Linux crontab и так работает без входа, а launchd-агент macOS — только внутри пользовательской сессии.
|
|
180
|
+
|
|
171
181
|
## Разработка
|
|
172
182
|
|
|
173
183
|
```bash
|
|
174
184
|
npm install
|
|
175
185
|
npm run build # tsc
|
|
176
186
|
npm run build:gui # vite
|
|
177
|
-
npm test #
|
|
187
|
+
npm test # 33 сюиты, 500+ проверок
|
|
188
|
+
npm run test:en # те же сюиты с английской локалью
|
|
178
189
|
```
|
|
179
190
|
|
|
191
|
+
`npm run test:en` выставляет `OPENCODE_SCHEDULER_LOCALE=en` для каждой сюиты; переменная нужна тестам и сервисам, это не пользовательская настройка.
|
|
192
|
+
|
|
180
193
|
Подробности — в [CONTRIBUTING.md](../CONTRIBUTING.md).
|
|
181
194
|
|
|
182
195
|
## Документация
|
|
@@ -190,6 +203,9 @@ npm test # полный набор тестов, 500+ проверо
|
|
|
190
203
|
**Работает ли плагин, когда OpenCode закрыт?**
|
|
191
204
|
Да. Задачи регистрируются в нативном планировщике ОС, поэтому выполняются без открытого OpenCode.
|
|
192
205
|
|
|
206
|
+
**Выполняются ли задачи, когда никто не вошёл в систему?**
|
|
207
|
+
На Windows — только если явно включить `runWhenLoggedOff: true`: задача регистрируется как `schtasks /ru SYSTEM` и идёт в session 0 без вашего профиля, подключённых дисков и сохранённых учётных данных. По умолчанию задача интерактивная и работает при активном входе. Linux crontab выполняет задачи и без входа, а launchd-агент macOS — только внутри пользовательской сессии.
|
|
208
|
+
|
|
193
209
|
**Какие платформы поддерживаются?**
|
|
194
210
|
Windows (Планировщик Windows), macOS (launchd) и Linux (crontab). Различия описаны в [CROSS_PLATFORM.md](../CROSS_PLATFORM.md).
|
|
195
211
|
|