opencode-windows-scheduler 1.5.0 → 1.5.2

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/LICENSE +21 -21
  3. package/README.md +24 -2
  4. package/ROADMAP-STRATEGY.md +16 -16
  5. package/ROADMAP.md +649 -160
  6. package/dist/core/audit.d.ts +27 -0
  7. package/dist/core/audit.d.ts.map +1 -1
  8. package/dist/core/audit.js +60 -0
  9. package/dist/core/dry-run.d.ts +10 -0
  10. package/dist/core/dry-run.d.ts.map +1 -1
  11. package/dist/core/dry-run.js +55 -34
  12. package/dist/core/git-trigger.d.ts.map +1 -1
  13. package/dist/core/git-trigger.js +15 -9
  14. package/dist/core/matrix.d.ts.map +1 -1
  15. package/dist/core/matrix.js +48 -22
  16. package/dist/core/ps-wrapper.d.ts +1 -1
  17. package/dist/core/ps-wrapper.d.ts.map +1 -1
  18. package/dist/core/ps-wrapper.js +47 -10
  19. package/dist/core/schedule-v2.d.ts.map +1 -1
  20. package/dist/core/schedule-v2.js +29 -17
  21. package/dist/core/scheduler/types.d.ts +6 -0
  22. package/dist/core/scheduler/types.d.ts.map +1 -1
  23. package/dist/core/scheduler/windows.d.ts +6 -2
  24. package/dist/core/scheduler/windows.d.ts.map +1 -1
  25. package/dist/core/scheduler/windows.js +25 -10
  26. package/dist/core/secrets.d.ts +10 -3
  27. package/dist/core/secrets.d.ts.map +1 -1
  28. package/dist/core/secrets.js +28 -4
  29. package/dist/core/telegram.d.ts.map +1 -1
  30. package/dist/core/telegram.js +13 -10
  31. package/dist/core/wrappers/bash.d.ts +1 -0
  32. package/dist/core/wrappers/bash.d.ts.map +1 -1
  33. package/dist/core/wrappers/bash.js +91 -5
  34. package/dist/i18n.d.ts +52 -0
  35. package/dist/i18n.d.ts.map +1 -0
  36. package/dist/i18n.js +292 -0
  37. package/dist/index.d.ts +6 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +788 -183
  40. package/dist/notifications.d.ts.map +1 -1
  41. package/dist/notifications.js +74 -40
  42. package/dist/rpc.d.ts +15 -2
  43. package/dist/rpc.d.ts.map +1 -1
  44. package/dist/rpc.js +6 -2
  45. package/dist/server.d.ts.map +1 -1
  46. package/dist/server.js +89 -48
  47. package/dist/settings.d.ts +3 -0
  48. package/dist/settings.d.ts.map +1 -1
  49. package/dist/settings.js +20 -8
  50. package/dist/task-transfer.d.ts +13 -0
  51. package/dist/task-transfer.d.ts.map +1 -1
  52. package/dist/task-transfer.js +11 -0
  53. package/dist/types.d.ts +11 -0
  54. package/dist/types.d.ts.map +1 -1
  55. package/dist/types.js +32 -0
  56. package/dist/workspaces.d.ts +2 -2
  57. package/dist/workspaces.d.ts.map +1 -1
  58. package/dist/workspaces.js +6 -4
  59. package/docs/ARCHITECTURE.md +96 -4
  60. package/docs/FEATURES.md +34 -5
  61. package/docs/README.ru.md +17 -1
  62. package/gui-experimental.cjs +9 -9
  63. package/locales/en.json +695 -0
  64. package/locales/ru.json +695 -0
  65. package/package.json +6 -3
  66. package/scripts/test-locale.mjs +44 -0
  67. package/src/core/audit.ts +89 -0
  68. package/src/core/dry-run.ts +76 -38
  69. package/src/core/git-trigger.ts +15 -9
  70. package/src/core/matrix.ts +52 -26
  71. package/src/core/ps-wrapper.ts +47 -10
  72. package/src/core/schedule-v2.ts +47 -17
  73. package/src/core/scheduler/types.ts +6 -0
  74. package/src/core/scheduler/windows.ts +25 -10
  75. package/src/core/secrets.ts +34 -10
  76. package/src/core/telegram.ts +16 -10
  77. package/src/core/wrappers/bash.ts +112 -5
  78. package/src/gui.tsx +575 -480
  79. package/src/i18n.ts +339 -0
  80. package/src/index.ts +960 -193
  81. package/src/notifications.ts +83 -42
  82. package/src/rpc.ts +6 -2
  83. package/src/server.ts +89 -48
  84. package/src/settings.ts +38 -10
  85. package/src/task-transfer.ts +24 -0
  86. package/src/types.ts +37 -0
  87. package/src/workspaces.ts +9 -4
@@ -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,CA2BpB;AA2BD,6DAA6D;AAC7D,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAOjE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAavE;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAavE;AAED,gCAAgC;AAChC,wBAAgB,cAAc,IAAI,SAAS,EAAE,CAK5C;AAED,uBAAuB;AACvB,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAI9D;AAED,6DAA6D;AAC7D,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAM/E;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CA2ChE;AAED,yCAAyC;AACzC,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,GAAG,SAAS,CAgElF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAenD;AAED,kDAAkD;AAClD,wBAAgB,eAAe,IAAI,MAAM,CAGxC"}
@@ -93,14 +93,14 @@ export function readWorkspaceEnvFile(envFile) {
93
93
  * зашифрованного хранилища (Спринт 26); отсутствующий секрет даёт пустую
94
94
  * строку и предупреждение с именем — без значения. Никогда не бросает.
95
95
  */
96
- export function resolveWorkspaceEnv(workspace) {
96
+ export function resolveWorkspaceEnv(workspace, allowedSecretNames) {
97
97
  if (!workspace)
98
98
  return {};
99
99
  const merged = {
100
100
  ...readWorkspaceEnvFile(workspace.envFile),
101
101
  ...(workspace.env ?? {}),
102
102
  };
103
- const resolved = resolveSecretRefs(merged);
103
+ const resolved = resolveSecretRefs(merged, allowedSecretNames);
104
104
  if (resolved.missing.length > 0) {
105
105
  console.warn(`[workspace] "${workspace.name}": не найдены секреты: ${resolved.missing.join(", ")}`);
106
106
  }
@@ -143,9 +143,11 @@ export function workspaceEnvDir(pluginDir) {
143
143
  * Возвращает путь к файлу или undefined, если у workspace нет переменных.
144
144
  * Пустой env удаляет ранее созданный файл. На POSIX права 0600.
145
145
  */
146
- export function writeWorkspaceEnvFile(workspace, pluginDir, sanitizedName) {
146
+ export function writeWorkspaceEnvFile(workspace, pluginDir, sanitizedName, allowedSecretNames) {
147
+ if (!workspace)
148
+ return undefined;
147
149
  const file = join(workspaceEnvDir(pluginDir), `${sanitizedName}.env`);
148
- const env = resolveWorkspaceEnv(workspace);
150
+ const env = resolveWorkspaceEnv(workspace, allowedSecretNames);
149
151
  const keys = Object.keys(env);
150
152
  if (!keys.length) {
151
153
  try {
@@ -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,14 +317,61 @@ 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.
321
356
  - A job definition is **code**: prompts, hooks, Quality Gates and wrappers all execute
322
357
  with your user privileges. Treat task creation like granting shell access.
323
- - `allowedTools` / `deniedTools` are **metadata passed to the run**, not a sandbox.
324
- They are recorded in history for audit, but they do not constrain `opencode` at the
325
- OS level.
358
+ - `allowedTools` / `deniedTools` are **enforced at the run-wrapper level** (спринт 29.2).
359
+ Before each `opencode run`, the wrapper passes `permissions` rules through
360
+ `OPENCODE_CONFIG_CONTENT`: `deniedTools` are mapped to `effect: "deny"` for the
361
+ corresponding OpenCode action (`shell`, `edit`, `glob`, `grep`, `webfetch`,
362
+ `websearch`, `question`, `subagent`, `skill`), and `allowedTools` (if specified)
363
+ additionally denies every action not in the list. No config file is written, so a
364
+ project-level `opencode.jsonc` is preserved and parallel tasks in one workdir do not
365
+ race. The wrapper passes `--auto` so non-denied permissions are auto-approved.
366
+ `allowedTools`/`deniedTools` metadata is still recorded in history for audit.
367
+ - **Audit of blocked tools (спринт 29.4):** when a task definition is saved,
368
+ `recordTaskToolBlocks()` writes one `tool.blocked` audit event per entry in
369
+ `deniedTools` (`target` = task name, `details.tool` = tool, plus `allowedTools`,
370
+ `deniedTools` and `reason`). In allow-list mode one event with `tool: "*"` records
371
+ that every unlisted tool is denied. The event is emitted on create and on update, so
372
+ changing the task policy also changes the audited details. Because the wrapper runs
373
+ `opencode` as an external process, the plugin cannot observe individual blocked
374
+ attempts at runtime; the audit reflects the enforced policy, not each refusal.
326
375
  - Task prompts, hooks and Quality Gate scripts are **plain text** executed with your
327
376
  user privileges; only secrets (in `secrets.json`, AES-256-GCM) are encrypted.
328
377
  Workspace `env` can reference secrets as `${secret:NAME}`; values are masked in
@@ -334,6 +383,49 @@ never requires a manual migration.
334
383
  - Workspace paths are validated, but hooks are not sandboxed: only schedule jobs from
335
384
  repositories you trust.
336
385
 
386
+ ### Permission model
387
+
388
+ The effective policy is resolved in this order (later wins):
389
+
390
+ 1. Task `allowedTools` — if present, every action not listed is denied.
391
+ 2. Task `deniedTools` — always denied and takes priority over `allowedTools`.
392
+ 3. The generated `opencode.jsonc` — written into the task workdir for the run.
393
+ 4. Project `opencode.json(c)` and system config — merged by OpenCode; a closer or
394
+ system-level config can weaken task-scoped denies (see limitations below).
395
+ 5. `--auto` — auto-approves everything that remains, so no interactive prompts block
396
+ an unattended run.
397
+
398
+ Tool mapping used by both wrappers:
399
+
400
+ | Task tool | OpenCode action |
401
+ | --- | --- |
402
+ | `bash`, `shell` | `shell` |
403
+ | `write`, `edit`, `apply_patch`, `remove` | `edit` |
404
+ | `glob`, `grep`, `webfetch`, `websearch` | same name |
405
+ | `question`, `subagent`, `skill` | same name |
406
+
407
+ Hooks, Quality Gates and wrapper scripts are outside this model: they run before or
408
+ after the agent with the user's privileges and are not filtered by tool policy.
409
+
410
+ ### Permission enforcement — known limitations (spike 29.1 findings)
411
+
412
+ - `opencode run` CLI (v2.2.3) supports only `--auto` (auto-approve non-denied
413
+ permissions). There are **no** `--allow-tool` / `--deny-tool` CLI flags, so
414
+ per-task restrictions cannot be passed via arguments. Enforcement is done by
415
+ generating a task-scoped config and passing it through `OPENCODE_CONFIG_CONTENT`.
416
+ - OpenCode merges `opencode.json(c)` from the current directory up to the filesystem
417
+ root. A project-level `opencode.jsonc` with permissive rules can override or weaken
418
+ task-scoped denies (last matching rule wins, closer directory wins for merge).
419
+ System config (`/etc/opencode`, `%ProgramData%\opencode`) overrides project config.
420
+ - Nested agent calls (subagents) use their **own** permissions, not a subset of the
421
+ parent's. A task that denies `subagent` prevents launching subagents, but a launched
422
+ subagent is not further restricted by the parent task's policy.
423
+ - **Plan B**: if the task-scoped config passed via `OPENCODE_CONFIG_CONTENT` proves
424
+ insufficient, enforcement can be moved to wrapper-level tool filtering (intercepting
425
+ `opencode run` invocation and refusing to start when a denied tool would be needed)
426
+ or to a managed system-level `policies` entry that hard-denies specific tools
427
+ globally.
428
+
337
429
  ## Extension points
338
430
 
339
431
  | Goal | Where to start |
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
@@ -233,9 +251,17 @@ the scheduler entry.
233
251
 
234
252
  ### Tool restrictions
235
253
 
236
- `allowedTools` and `deniedTools` declare the intended role of the job. They are
237
- recorded in history for audit. They are **metadata, not a sandbox**: they do not
238
- restrict `opencode` at runtime today.
254
+ `allowedTools` and `deniedTools` are enforced for the `opencode run` process that the
255
+ task wrapper starts. The wrapper passes the generated `permissions` rules to the
256
+ process through `OPENCODE_CONFIG_CONTENT`; no file is written to the task workdir, so a
257
+ project-level `opencode.jsonc` is never overwritten. Each `deniedTools` entry becomes an
258
+ `effect: "deny"` rule for the matching OpenCode action, and `allowedTools` (when set)
259
+ denies every action that is not listed. The wrapper runs `opencode` with `--auto`, so
260
+ only non-denied permissions are auto-approved. Restrictions apply to the agent process,
261
+ not to hooks, Quality Gates or scripts, which still run with your user privileges. See
262
+ [ARCHITECTURE.md](ARCHITECTURE.md#permission-enforcement--known-limitations-spike-291-findings)
263
+ for the exact action mapping and known limitations (project/system config, nested
264
+ subagents).
239
265
 
240
266
  ## Orchestration
241
267
 
@@ -554,6 +580,7 @@ plugin, no installation step required.
554
580
  | File triggers | chokidar | chokidar | chokidar |
555
581
  | History, metrics, dashboard | yes | yes | yes |
556
582
  | Agent tools and skill | yes | yes | yes |
583
+ | Runs without a logged-on user | opt-in (`runWhenLoggedOff`) | always (crontab) | no (per-user agent) |
557
584
 
558
585
  ## Limits and non-goals
559
586
 
@@ -566,7 +593,9 @@ plugin, no installation step required.
566
593
  - **No authentication on the dashboard.** Localhost only by design.
567
594
  - **Secrets are not encrypted.** Use environment variables or an external secret
568
595
  manager.
569
- - **`allowedTools` / `deniedTools` are advisory.** They document intent and are
570
- recorded in history; enforcement is not implemented.
596
+ - **`allowedTools` / `deniedTools` restrict the agent process, not the whole job.**
597
+ Hooks, Quality Gates and wrapper scripts still run with your user privileges, and a
598
+ project-level or system `opencode.jsonc` can weaken task-scoped denies. See the
599
+ permission-enforcement limitations in ARCHITECTURE.md.
571
600
  - **Matrix clones are separate tasks.** They appear in the task list (grouped under the
572
601
  parent) and consume global concurrency slots like any other run.
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 # полный набор тестов, 500+ проверок
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