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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-windows-scheduler",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "OpenCode v2 plugin for scheduling and orchestrating AI agent jobs: cron, one-shot runs, DAG pipelines, matrix builds, quality gates, SQLite history, metrics and a local web dashboard. Windows, macOS and Linux. Free and open source (MIT).",
5
5
  "license": "MIT",
6
6
  "author": "opencode-windows-scheduler contributors",
@@ -48,6 +48,7 @@
48
48
  "index.js",
49
49
  "gui-experimental.cjs",
50
50
  "skills",
51
+ "locales",
51
52
  "scripts",
52
53
  "docs",
53
54
  "README.md",
@@ -69,7 +70,7 @@
69
70
  "demo": "node scripts/demo-dashboard.mjs",
70
71
  "prepare": "npm run build",
71
72
  "prepublishOnly": "npm run build && npm run build:gui",
72
- "test": "node test-sqlite.mjs && node test-crash-recovery.mjs && node test-workspaces.mjs && node test-role-scoped.mjs && node test-dry-run.mjs && node test-matrix.mjs && node test-matrix-lifecycle.mjs && node test-matrix-sync.mjs && node test-retention.mjs && node test-metrics.mjs && node test-schedule-v2.mjs && node test-notifications-v2.mjs && node test-notifications-v3.mjs && node test-secrets.mjs && node test-audit.mjs && node test-profiles.mjs && node test-env.mjs && node test-agent-tools.mjs && node test-skill.mjs && node test-integrations.mjs && node test-one-shot.mjs && node test-session-continuity.mjs && node test-task-status.mjs && node test-jobs-view.mjs && node test-dag.mjs && node test-dashboard.mjs && node test-dashboard-dag.mjs && node test-dashboard-json.mjs && node test-docs.mjs && node test-glob.mjs && node test-git-trigger.mjs && node test-window-v3.mjs",
73
+ "test": "node test-sqlite.mjs && node test-crash-recovery.mjs && node test-workspaces.mjs && node test-role-scoped.mjs && node test-dry-run.mjs && node test-matrix.mjs && node test-matrix-lifecycle.mjs && node test-matrix-sync.mjs && node test-retention.mjs && node test-metrics.mjs && node test-schedule-v2.mjs && node test-notifications-v2.mjs && node test-notifications-v3.mjs && node test-secrets.mjs && node test-audit.mjs && node test-profiles.mjs && node test-env.mjs && node test-agent-tools.mjs && node test-skill.mjs && node test-integrations.mjs && node test-one-shot.mjs && node test-session-continuity.mjs && node test-task-status.mjs && node test-jobs-view.mjs && node test-dag.mjs && node test-dashboard.mjs && node test-dashboard-dag.mjs && node test-dashboard-json.mjs && node test-docs.mjs && node test-glob.mjs && node test-git-trigger.mjs && node test-window-v3.mjs && node test-i18n.mjs",
73
74
  "test:sqlite": "node test-sqlite.mjs",
74
75
  "test:crash": "node test-crash-recovery.mjs",
75
76
  "test:workspaces": "node test-workspaces.mjs",
@@ -101,7 +102,9 @@
101
102
  "test:docs": "node test-docs.mjs",
102
103
  "test:glob": "node test-glob.mjs",
103
104
  "test:git-trigger": "node test-git-trigger.mjs",
104
- "test:window-v3": "node test-window-v3.mjs"
105
+ "test:window-v3": "node test-window-v3.mjs",
106
+ "test:i18n": "node test-i18n.mjs",
107
+ "test:en": "node scripts/test-locale.mjs en"
105
108
  },
106
109
  "dependencies": {
107
110
  "@opencode/plugin": "^2.2.7",
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Прогоняет тот же набор сюит, что `npm test`, с заданной локалью.
3
+ *
4
+ * Локаль задаётся переменной `OPENCODE_SCHEDULER_LOCALE`, которую читает
5
+ * `src/i18n.ts` при загрузке: так один и тот же код проверяется в ru и en
6
+ * без правки settings.json.
7
+ *
8
+ * Запуск: node scripts/test-locale.mjs en
9
+ */
10
+ import fs from "node:fs";
11
+ import path from "node:path";
12
+ import { spawnSync } from "node:child_process";
13
+ import { fileURLToPath } from "node:url";
14
+
15
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
16
+ const locale = process.argv[2] ?? "en";
17
+
18
+ if (locale !== "ru" && locale !== "en") {
19
+ console.error(`Неизвестная локаль: ${locale}. Ожидается ru или en.`);
20
+ process.exit(2);
21
+ }
22
+
23
+ const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
24
+ const suites = pkg.scripts.test
25
+ .split("&&")
26
+ .map((part) => part.trim().replace(/^node\s+/, ""))
27
+ .filter(Boolean);
28
+
29
+ const failed = [];
30
+ for (const suite of suites) {
31
+ const result = spawnSync(process.execPath, [suite], {
32
+ cwd: root,
33
+ env: { ...process.env, OPENCODE_SCHEDULER_LOCALE: locale },
34
+ stdio: "inherit",
35
+ });
36
+ if (result.status !== 0) failed.push(suite);
37
+ }
38
+
39
+ if (failed.length > 0) {
40
+ console.error(`\n${locale}: провалено ${failed.length} из ${suites.length}: ${failed.join(", ")}`);
41
+ process.exit(1);
42
+ }
43
+
44
+ console.log(`\n${locale}: все ${suites.length} сюит зелёные.`);
package/src/core/audit.ts CHANGED
@@ -174,6 +174,95 @@ function rowToRecord(row: any): AuditRecord {
174
174
  };
175
175
  }
176
176
 
177
+ export interface ToolBlockedInput {
178
+ /** Имя задачи, для которой действует запрет. */
179
+ task: string;
180
+ /** Заблокированный инструмент (например, shell или write). */
181
+ tool: string;
182
+ actor?: AuditActor;
183
+ source?: string | null;
184
+ /** Дополнительные детали события; можно переопределить/дополнить. */
185
+ details?: Record<string, unknown>;
186
+ }
187
+
188
+ /**
189
+ * Записывает событие tool.blocked для задачи и инструмента.
190
+ *
191
+ * Детали события — обычный объект, поэтому вызывающая сторона может добавить
192
+ * причину, список разрешённых инструментов и любые другие поля.
193
+ * Возвращает id записи или null, если журнал недоступен.
194
+ */
195
+ export function recordToolBlocked(input: ToolBlockedInput): number | null {
196
+ return recordAudit({
197
+ action: "tool.blocked",
198
+ targetType: "task",
199
+ target: input.task,
200
+ actor: input.actor ?? "system",
201
+ source: input.source ?? "policy",
202
+ details: { tool: input.tool, ...(input.details ?? {}) },
203
+ });
204
+ }
205
+
206
+ /**
207
+ * Фиксирует запреты задачи из её политики allowedTools/deniedTools.
208
+ *
209
+ * Явно запрещённые инструменты попадают в аудит по одному событию на
210
+ * инструмент. Для режима «только разрешённые» пишется одно событие с
211
+ * инструментом `*`, потому что список заблокированных в этом режиме
212
+ * неограничен. Возвращает число записанных событий.
213
+ */
214
+ export function recordTaskToolBlocks(
215
+ task: string,
216
+ allowedTools: readonly string[] | null | undefined,
217
+ deniedTools: readonly string[] | null | undefined,
218
+ actor: AuditActor = "system",
219
+ source = "policy"
220
+ ): number {
221
+ const normalizedDenied = Array.from(
222
+ new Set(
223
+ (deniedTools ?? [])
224
+ .map((tool) => String(tool).trim())
225
+ .filter(Boolean)
226
+ )
227
+ );
228
+ const normalizedAllowed = Array.from(
229
+ new Set(
230
+ (allowedTools ?? [])
231
+ .map((tool) => String(tool).trim())
232
+ .filter(Boolean)
233
+ )
234
+ );
235
+ const details = {
236
+ reason: "deniedTools",
237
+ allowedTools: normalizedAllowed.length > 0 ? normalizedAllowed : null,
238
+ deniedTools: normalizedDenied.length > 0 ? normalizedDenied : null,
239
+ };
240
+ let written = 0;
241
+ for (const tool of normalizedDenied) {
242
+ if (recordToolBlocked({ task, tool, actor, source, details }) != null) {
243
+ written++;
244
+ }
245
+ }
246
+ if (normalizedDenied.length === 0 && normalizedAllowed.length > 0) {
247
+ if (
248
+ recordToolBlocked({
249
+ task,
250
+ tool: "*",
251
+ actor,
252
+ source,
253
+ details: {
254
+ reason: "allowedTools",
255
+ allowedTools: normalizedAllowed,
256
+ deniedTools: null,
257
+ },
258
+ }) != null
259
+ ) {
260
+ written++;
261
+ }
262
+ }
263
+ return written;
264
+ }
265
+
177
266
  /** Читает журнал аудита (новые сверху). */
178
267
  export function readAuditLog(filter: ReadAuditFilter = {}): ReadAuditResult {
179
268
  const limit = Math.max(1, Math.min(5000, Math.floor(filter.limit ?? 200) || 200));
@@ -12,6 +12,7 @@ import { getWorkspace } from "../workspaces.js";
12
12
  import { expandMatrixTask } from "./matrix.js";
13
13
  import { nextRun, activeWindowState } from "./schedule-v2.js";
14
14
  import { checkGitTrigger } from "./git-trigger.js";
15
+ import { t } from "../i18n.js";
15
16
  import type { TaskDefinition } from "../task-transfer.js";
16
17
 
17
18
  export interface DryRunRoleScoped {
@@ -69,6 +70,16 @@ export interface DryRunTaskItem {
69
70
  session?: string | null;
70
71
  /** Идентификатор переиспользуемой сессии (только для session=reuse). */
71
72
  sessionId?: string | null;
73
+ /**
74
+ * Windows-режим входа (Спринт 27.5.4): false — задача интерактивная и идёт
75
+ * только при активном входе пользователя (Interactive only); true — запуск
76
+ * без входа через `/ru SYSTEM` (session 0, без профиля пользователя).
77
+ * На Linux/macOS поле всегда false: cron работает без входа, launchd-агент —
78
+ * только при входе.
79
+ */
80
+ runWhenLoggedOff?: boolean;
81
+ /** Человекочитаемое пояснение к режиму входа (для отчёта dry-run). */
82
+ logonMode?: string | null;
72
83
  /**
73
84
  * Эффективное расписание cron-задачи (Спринт 19): пояс, окно запуска и
74
85
  * ближайшие срабатывания с учётом часового пояса. Позволяет проверить
@@ -106,10 +117,10 @@ const ESTIMATE_SAMPLE = 10;
106
117
  /** Средняя цена за 1K токенов (должна совпадать с dashboards/server.ts). */
107
118
  export const ESTIMATED_COST_PER_1K_TOKENS_USD = 0.003;
108
119
 
109
- /** Опасные паттерны, о которых обязательно предупреждаем. */
110
- const DANGEROUS_PATTERNS: Array<{ test: RegExp; message: string }> = [
111
- { test: /rm\s+-rf\s+\/(?:\s|$)/, message: "возможна рекурсивная очистка корня файловой системы (`rm -rf /`)" },
112
- { test: /git\s+push\s+.*--force(?:\s|$)/, message: "принудительный push в git (`git push --force`)" },
120
+ /** Опасные паттерны, о которых обязательно предупреждаем (ключи каталога). */
121
+ const DANGEROUS_PATTERNS: Array<{ test: RegExp; messageKey: string }> = [
122
+ { test: /rm\s+-rf\s+\/(?:\s|$)/, messageKey: "dryRun.danger.rmRoot" },
123
+ { test: /git\s+push\s+.*--force(?:\s|$)/, messageKey: "dryRun.danger.forcePush" },
113
124
  ];
114
125
 
115
126
  /**
@@ -166,12 +177,16 @@ async function describeTrigger(opts: DescribeTriggerOptions): Promise<DryRunTrig
166
177
  base.explanation = result.message;
167
178
 
168
179
  if (result.status === "no-repo") {
169
- warnings.push("Задача с git-триггером, но рабочая директория не является git-репозиторием.");
180
+ warnings.push(t("dryRun.git.notRepo"));
170
181
  } else if (result.status === "branch-mismatch") {
171
- warnings.push(`Ветка не подходит под фильтр «${def.gitBranch ?? ""}».`);
182
+ warnings.push(
183
+ t("dryRun.git.branchMismatch", { branch: def.gitBranch ?? "" })
184
+ );
172
185
  }
173
186
  } catch (err: any) {
174
- base.explanation = `Git-триггер: ошибка проверки — ${err instanceof Error ? err.message : String(err)}.`;
187
+ base.explanation = t("dryRun.git.checkError", {
188
+ error: err instanceof Error ? err.message : String(err),
189
+ });
175
190
  warnings.push(base.explanation);
176
191
  }
177
192
  break;
@@ -185,38 +200,51 @@ async function describeTrigger(opts: DescribeTriggerOptions): Promise<DryRunTrig
185
200
  };
186
201
  const parts: string[] = [];
187
202
  if (def.watchPath) parts.push(`«${def.watchPath}»`);
188
- if (def.watchGlobs?.length) parts.push(`маски: ${def.watchGlobs.length}`);
189
- if (def.watchIgnore?.length) parts.push(`исключения: ${def.watchIgnore.length}`);
203
+ if (def.watchGlobs?.length)
204
+ parts.push(t("dryRun.file.globs", { count: def.watchGlobs.length }));
205
+ if (def.watchIgnore?.length)
206
+ parts.push(t("dryRun.file.ignore", { count: def.watchIgnore.length }));
190
207
  base.explanation =
191
208
  parts.length > 0
192
- ? `Файловый триггер: ${parts.join("; ")}.`
193
- : "Файловый триггер: любое изменение подходит.";
209
+ ? t("dryRun.file.trigger", { parts: parts.join("; ") })
210
+ : t("dryRun.file.any");
194
211
  break;
195
212
  }
196
213
 
197
214
  case "mcp-event": {
198
215
  const ev = def.mcpEvent;
199
216
  base.explanation = ev && ev.event
200
- ? `MCP-событие ${ev.server}:${ev.event}${ev.filter ? ` (фильтр «${ev.filter}»)` : ""}.`
201
- : "MCP-событие (параметры не заданы).";
217
+ ? t("dryRun.mcp.event", {
218
+ server: ev.server,
219
+ event: ev.event,
220
+ filter: ev.filter
221
+ ? t("dryRun.mcp.filter", { filter: ev.filter })
222
+ : "",
223
+ })
224
+ : t("dryRun.mcp.missing");
202
225
  break;
203
226
  }
204
227
 
205
228
  case "cron": {
206
- let text = `По расписанию «${def.schedule}»`;
207
- if (def.timezone) text += ` (${def.timezone})`;
208
- base.explanation = text + ".";
229
+ base.explanation = def.timezone
230
+ ? t("dryRun.cronTimezone", {
231
+ schedule: def.schedule,
232
+ timezone: def.timezone,
233
+ })
234
+ : t("dryRun.cron", { schedule: def.schedule });
209
235
  break;
210
236
  }
211
237
 
212
238
  case "once": {
213
- base.explanation = def.runAt ? `Однократно в ${def.runAt}.` : "Однократный запуск.";
239
+ base.explanation = def.runAt
240
+ ? t("dryRun.once.at", { runAt: def.runAt })
241
+ : t("dryRun.once");
214
242
  break;
215
243
  }
216
244
 
217
245
  case "manual":
218
246
  default: {
219
- base.explanation = "Запуск вручную (в составе конвейера).";
247
+ base.explanation = t("dryRun.manual");
220
248
  break;
221
249
  }
222
250
  }
@@ -236,21 +264,24 @@ async function describeTrigger(opts: DescribeTriggerOptions): Promise<DryRunTrig
236
264
  };
237
265
 
238
266
  if (!state.active && policy !== "run") {
267
+ const reason = state.reason ?? t("dryRun.window.outside");
239
268
  if (policy === "skip") {
240
- warnings.push(
241
- `Сейчас ${state.reason ?? "вне окна"}: при политике skip запуск будет пропущен.`
242
- );
269
+ warnings.push(t("dryRun.window.skip", { reason }));
243
270
  } else {
244
271
  // postpone — переносим на ближайшее открытие.
245
272
  const iso = base.activeWindow.nextOpenAt ?? null;
246
273
  warnings.push(
247
274
  iso
248
- ? `Сейчас ${state.reason ?? "вне окна"}: запуск будет перенесён на ${iso}.`
249
- : `Сейчас ${state.reason ?? "вне окна"}: открытие окна не найдено, запуск пропущен.`
275
+ ? t("dryRun.window.postpone", { reason, nextOpenAt: iso })
276
+ : t("dryRun.window.noOpening", { reason })
250
277
  );
251
278
  }
252
279
  } else if (!state.active && policy === "run") {
253
- warnings.push(`Сейчас ${state.reason ?? "вне окна"}: политика run — задача выполнится всё равно.`);
280
+ warnings.push(
281
+ t("dryRun.window.run", {
282
+ reason: state.reason ?? t("dryRun.window.outside"),
283
+ })
284
+ );
254
285
  }
255
286
  }
256
287
 
@@ -268,7 +299,7 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
268
299
  const rootLower = taskName.trim().toLowerCase();
269
300
  const root = allDefs.find((d) => d.name.toLowerCase() === rootLower);
270
301
  if (!root) {
271
- throw new Error(`Задача "${taskName}" не найдена.`);
302
+ throw new Error(t("dryRun.taskNotFound", { task: taskName }));
272
303
  }
273
304
 
274
305
  // Собираем подграф зависимостей рекурсивно, обнаруживая циклы.
@@ -280,7 +311,7 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
280
311
  const collect = (lowerName: string): TaskDefinition | undefined => {
281
312
  if (visiting.has(lowerName)) {
282
313
  const list = warningsPerTask.get(lowerName) ?? [];
283
- list.push(`Обнаружена циклическая зависимость вокруг задачи "${lowerName}" — конвейер разорван на этом узле.`);
314
+ list.push(t("dryRun.cycle", { task: lowerName }));
284
315
  warningsPerTask.set(lowerName, list);
285
316
  return undefined;
286
317
  }
@@ -289,7 +320,7 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
289
320
  const def = byLower.get(lowerName);
290
321
  if (!def) {
291
322
  const list = warningsPerTask.get(lowerName) ?? [];
292
- list.push(`Зависимость "${lowerName}" не найдена среди задач — узел пропущен.`);
323
+ list.push(t("dryRun.dependencyMissing", { task: lowerName }));
293
324
  warningsPerTask.set(lowerName, list);
294
325
  return undefined;
295
326
  }
@@ -351,15 +382,15 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
351
382
  try {
352
383
  const clones = expandMatrixTask(def);
353
384
  warnings.push(
354
- `[${def.name}] Родитель матрицы не выполняется сам — показаны ${clones.length} клон(а/ов) по workspace.`
385
+ t("dryRun.matrix.parent", { name: def.name, count: clones.length })
355
386
  );
356
387
  for (const clone of clones) units.push({ def: clone, matrixParent: def.name });
357
388
  } catch (err: any) {
358
389
  const list = warningsPerTask.get(def.name.toLowerCase()) ?? [];
359
390
  list.push(
360
- `Матрица не может быть развёрнута: ${
361
- err instanceof Error ? err.message : String(err)
362
- }`
391
+ t("dryRun.matrix.expandError", {
392
+ error: err instanceof Error ? err.message : String(err),
393
+ })
363
394
  );
364
395
  warningsPerTask.set(def.name.toLowerCase(), list);
365
396
  warnings.push(`[${def.name}] ${list[list.length - 1]}`);
@@ -386,15 +417,15 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
386
417
  const workspace = def.workspaceId ? getWorkspace(def.workspaceId) : undefined;
387
418
  const cwd = workspace?.path || def.workingDirectory || def.workdir || "";
388
419
  if (!cwd) {
389
- taskWarnings.push("Рабочая директория не задана явно — будет использована папка текущего проекта.");
420
+ taskWarnings.push(t("dryRun.cwdImplicit"));
390
421
  } else {
391
422
  try {
392
423
  const stat = fs.statSync(cwd);
393
424
  if (!stat.isDirectory()) {
394
- taskWarnings.push(`Путь "${cwd}" существует, но не является директорией.`);
425
+ taskWarnings.push(t("dryRun.cwdNotDir", { path: cwd }));
395
426
  }
396
427
  } catch {
397
- taskWarnings.push(`Рабочая директория "${cwd}" не существует на диске.`);
428
+ taskWarnings.push(t("dryRun.cwdMissing", { path: cwd }));
398
429
  }
399
430
  }
400
431
 
@@ -427,7 +458,7 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
427
458
  let estimatedCostUsd: number | null = null;
428
459
  let estimatedTokens: number | null = null;
429
460
  if (records.length === 0) {
430
- taskWarnings.push("Нет успешных запусков в истории — оценка длительности/токенов/стоимости недоступна.");
461
+ taskWarnings.push(t("dryRun.noHistory"));
431
462
  } else {
432
463
  const sample = records.slice(0, ESTIMATE_SAMPLE);
433
464
  const avg = (pick: (r: (typeof sample)[number]) => number | null | undefined) => {
@@ -447,9 +478,11 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
447
478
  .filter((s): s is string => typeof s === "string")
448
479
  .join("\n")
449
480
  .toLowerCase();
450
- for (const { test, message } of DANGEROUS_PATTERNS) {
481
+ for (const { test, messageKey } of DANGEROUS_PATTERNS) {
451
482
  if (test.test(scanned)) {
452
- taskWarnings.push(`Опасный паттерн: ${message}.`);
483
+ taskWarnings.push(
484
+ t("dryRun.dangerPattern", { message: t(messageKey) })
485
+ );
453
486
  }
454
487
  }
455
488
 
@@ -485,7 +518,9 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
485
518
  cursor = next;
486
519
  }
487
520
  } catch {
488
- taskWarnings.push(`Не удалось разобрать cron "${def.schedule}" для расчёта ближайших запусков.`);
521
+ taskWarnings.push(
522
+ t("dryRun.cronParseError", { schedule: def.schedule })
523
+ );
489
524
  }
490
525
  scheduleDetails = {
491
526
  cron: def.schedule,
@@ -503,6 +538,9 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
503
538
  trigger,
504
539
  session: def.session ?? "new",
505
540
  sessionId: def.session === "reuse" ? def.sessionId ?? null : null,
541
+ // Спринт 27.5.4: показываем режим входа до регистрации в ОС.
542
+ runWhenLoggedOff: def.runWhenLoggedOff === true,
543
+ logonMode: def.runWhenLoggedOff === true ? "background" : "interactive",
506
544
  cwd,
507
545
  command,
508
546
  workspace: workspace ? { name: workspace.name, path: workspace.path } : undefined,
@@ -5,6 +5,7 @@ import { loadTaskDefinitions, type TaskDefinition } from "../task-transfer.js";
5
5
  import { getGitState, setGitState, deleteGitState } from "../db/git-state-repo.js";
6
6
  import { filterPaths } from "./glob.js";
7
7
  import { getWorkspace } from "../workspaces.js";
8
+ import { t } from "../i18n.js";
8
9
 
9
10
  /**
10
11
  * Git-триггеры (Спринт 27).
@@ -161,7 +162,7 @@ export async function checkGitTrigger(
161
162
  status: "no-repo",
162
163
  files: [],
163
164
  matched: [],
164
- message: `«${task.cwd}» не git-репозиторий — git-триггер не сработает.`,
165
+ message: t("gitTrigger.noRepo", { cwd: task.cwd }),
165
166
  };
166
167
  }
167
168
 
@@ -174,7 +175,7 @@ export async function checkGitTrigger(
174
175
  branch: probe.branch,
175
176
  files: [],
176
177
  matched: [],
177
- message: `Запомнен текущий коммит ${probe.head.slice(0, 7)} — задача запустится на следующем изменении.`,
178
+ message: t("gitTrigger.baseline", { commit: probe.head.slice(0, 7) }),
178
179
  };
179
180
  }
180
181
 
@@ -186,7 +187,10 @@ export async function checkGitTrigger(
186
187
  from: state.commitSha,
187
188
  files: [],
188
189
  matched: [],
189
- message: `Ветка ${probe.branch ?? "(detached)"} не подходит под фильтр «${task.branch}».`,
190
+ message: t("gitTrigger.branchMismatch", {
191
+ branch: probe.branch ?? "(detached)",
192
+ pattern: task.branch,
193
+ }),
190
194
  };
191
195
  }
192
196
 
@@ -198,7 +202,7 @@ export async function checkGitTrigger(
198
202
  from: state.commitSha,
199
203
  files: [],
200
204
  matched: [],
201
- message: "Новых коммитов нет.",
205
+ message: t("gitTrigger.noChanges"),
202
206
  };
203
207
  }
204
208
 
@@ -216,8 +220,8 @@ export async function checkGitTrigger(
216
220
  matched: [],
217
221
  message:
218
222
  files.length === 0
219
- ? "Новых коммитов нет."
220
- : `Изменено файлов: ${files.length}, но ни один не подходит под фильтры.`,
223
+ ? t("gitTrigger.noChanges")
224
+ : t("gitTrigger.ignored", { count: files.length }),
221
225
  };
222
226
  }
223
227
 
@@ -229,9 +233,11 @@ export async function checkGitTrigger(
229
233
  from: state.commitSha,
230
234
  files,
231
235
  matched,
232
- message: `Новый коммит ${probe.head.slice(0, 7)}: изменено файлов ${matched.length} (${matched
233
- .slice(0, 3)
234
- .join(", ")}${matched.length > 3 ? ", …" : ""}).`,
236
+ message: t("gitTrigger.changed", {
237
+ commit: probe.head.slice(0, 7),
238
+ count: matched.length,
239
+ files: `${matched.slice(0, 3).join(", ")}${matched.length > 3 ? ", …" : ""}`,
240
+ }),
235
241
  };
236
242
  }
237
243