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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-windows-scheduler",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
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/dry-run.ts
CHANGED
|
@@ -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;
|
|
111
|
-
{ test: /rm\s+-rf\s+\/(?:\s|$)/,
|
|
112
|
-
{ test: /git\s+push\s+.*--force(?:\s|$)/,
|
|
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("
|
|
180
|
+
warnings.push(t("dryRun.git.notRepo"));
|
|
170
181
|
} else if (result.status === "branch-mismatch") {
|
|
171
|
-
warnings.push(
|
|
182
|
+
warnings.push(
|
|
183
|
+
t("dryRun.git.branchMismatch", { branch: def.gitBranch ?? "" })
|
|
184
|
+
);
|
|
172
185
|
}
|
|
173
186
|
} catch (err: any) {
|
|
174
|
-
base.explanation =
|
|
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)
|
|
189
|
-
|
|
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
|
-
?
|
|
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
|
-
?
|
|
201
|
-
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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
|
|
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
|
-
?
|
|
249
|
-
:
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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(
|
|
425
|
+
taskWarnings.push(t("dryRun.cwdNotDir", { path: cwd }));
|
|
395
426
|
}
|
|
396
427
|
} catch {
|
|
397
|
-
taskWarnings.push(
|
|
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,
|
|
481
|
+
for (const { test, messageKey } of DANGEROUS_PATTERNS) {
|
|
451
482
|
if (test.test(scanned)) {
|
|
452
|
-
taskWarnings.push(
|
|
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(
|
|
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,
|
package/src/core/git-trigger.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
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
|
-
:
|
|
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:
|
|
233
|
-
.slice(0,
|
|
234
|
-
|
|
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
|
|
package/src/core/matrix.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { getHistory, recordRun } from "../db/history-repo.js";
|
|
|
21
21
|
import { notifyMatrixCompletion } from "../notifications.js";
|
|
22
22
|
import { getWorkspace } from "../workspaces.js";
|
|
23
23
|
import { createSchedulerBackend } from "./scheduler/index.js";
|
|
24
|
+
import { t } from "../i18n.js";
|
|
24
25
|
|
|
25
26
|
/** Суффикс агрегирующей задачи, запускаемой после всех клонов. */
|
|
26
27
|
export const MATRIX_COMPLETE_SUFFIX = "-matrix-complete";
|
|
@@ -29,7 +30,11 @@ export const MATRIX_COMPLETE_SUFFIX = "-matrix-complete";
|
|
|
29
30
|
export function matrixCloneName(parentName: string, workspaceName: string): string {
|
|
30
31
|
const parent = parentName.trim();
|
|
31
32
|
const ws = workspaceName.trim() || "workspace";
|
|
32
|
-
const safeWs = ws
|
|
33
|
+
const safeWs = ws
|
|
34
|
+
// Спринт 27.5: метасимволы оболочки и недопустимые для имени задачи
|
|
35
|
+
// символы заменяем на дефис, чтобы имя клона проходило validateTaskName.
|
|
36
|
+
.replace(/[\\/:*?"<>|&^%'`;()]+/g, "-")
|
|
37
|
+
.replace(/\s+/g, "-");
|
|
33
38
|
return `${parent}-matrix-${safeWs}`;
|
|
34
39
|
}
|
|
35
40
|
|
|
@@ -50,7 +55,9 @@ export function isMatrixCompleteName(name: string): boolean {
|
|
|
50
55
|
export function expandMatrixTask(task: TaskDefinition): TaskDefinition[] {
|
|
51
56
|
const matrix = task.matrix;
|
|
52
57
|
if (!matrix || !Array.isArray(matrix.workspaceIds) || matrix.workspaceIds.length === 0) {
|
|
53
|
-
throw new Error(
|
|
58
|
+
throw new Error(
|
|
59
|
+
t("matrix.error.workspaceIdsEmpty", { task: task.name })
|
|
60
|
+
);
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
const clones: TaskDefinition[] = [];
|
|
@@ -60,7 +67,10 @@ export function expandMatrixTask(task: TaskDefinition): TaskDefinition[] {
|
|
|
60
67
|
const workspace = getWorkspace(workspaceId);
|
|
61
68
|
if (!workspace) {
|
|
62
69
|
throw new Error(
|
|
63
|
-
|
|
70
|
+
t("matrix.error.workspaceMissing", {
|
|
71
|
+
task: task.name,
|
|
72
|
+
workspace: workspaceId,
|
|
73
|
+
})
|
|
64
74
|
);
|
|
65
75
|
}
|
|
66
76
|
const name = matrixCloneName(task.name, workspace.name);
|
|
@@ -108,7 +118,9 @@ export function expandMatrixTask(task: TaskDefinition): TaskDefinition[] {
|
|
|
108
118
|
}
|
|
109
119
|
|
|
110
120
|
if (clones.length === 0) {
|
|
111
|
-
throw new Error(
|
|
121
|
+
throw new Error(
|
|
122
|
+
t("matrix.error.cloneCreation", { task: task.name })
|
|
123
|
+
);
|
|
112
124
|
}
|
|
113
125
|
return clones;
|
|
114
126
|
}
|
|
@@ -181,22 +193,37 @@ export function aggregateMatrixResults(parentId: string): MatrixAggregate {
|
|
|
181
193
|
|
|
182
194
|
if (totalCount === 0) {
|
|
183
195
|
status = "empty";
|
|
184
|
-
message =
|
|
196
|
+
message = t("matrix.aggregate.empty", { parent: parentId });
|
|
185
197
|
} else if (pendingCount > 0) {
|
|
186
198
|
status = "running";
|
|
187
|
-
message =
|
|
199
|
+
message = t("matrix.aggregate.running", {
|
|
200
|
+
done: totalCount - pendingCount,
|
|
201
|
+
total: totalCount,
|
|
202
|
+
});
|
|
188
203
|
} else if (errorCount === 0) {
|
|
189
204
|
status = "success";
|
|
190
|
-
message =
|
|
205
|
+
message = t("matrix.aggregate.success", { total: totalCount });
|
|
191
206
|
} else if (failureMode === "stop") {
|
|
192
207
|
const firstError = results.find((r) => r.status === "error");
|
|
193
208
|
status = "error";
|
|
194
209
|
message =
|
|
195
|
-
|
|
196
|
-
|
|
210
|
+
t("matrix.aggregate.stopped", {
|
|
211
|
+
errors: errorCount,
|
|
212
|
+
total: totalCount,
|
|
213
|
+
}) +
|
|
214
|
+
(firstError?.error
|
|
215
|
+
? t("matrix.aggregate.stoppedFirst", {
|
|
216
|
+
name: firstError.name,
|
|
217
|
+
error: firstError.error,
|
|
218
|
+
})
|
|
219
|
+
: "");
|
|
197
220
|
} else {
|
|
198
221
|
status = "partial";
|
|
199
|
-
message =
|
|
222
|
+
message = t("matrix.aggregate.partial", {
|
|
223
|
+
success: successCount,
|
|
224
|
+
total: totalCount,
|
|
225
|
+
errors: errorCount,
|
|
226
|
+
});
|
|
200
227
|
}
|
|
201
228
|
|
|
202
229
|
return {
|
|
@@ -250,13 +277,11 @@ export function resolveMatrixConcurrency(
|
|
|
250
277
|
export async function runMatrix(task: TaskDefinition): Promise<MatrixRunResult> {
|
|
251
278
|
const matrix = task.matrix;
|
|
252
279
|
if (!matrix) {
|
|
253
|
-
throw new Error(
|
|
280
|
+
throw new Error(t("matrix.error.notMatrix", { task: task.name }));
|
|
254
281
|
}
|
|
255
282
|
const clones = listMatrixClones(task.name);
|
|
256
283
|
if (clones.length === 0) {
|
|
257
|
-
throw new Error(
|
|
258
|
-
`У матрицы "${task.name}" нет клонов — пересоздайте задачу, чтобы развернуть её по workspace.`
|
|
259
|
-
);
|
|
284
|
+
throw new Error(t("matrix.error.noClones", { task: task.name }));
|
|
260
285
|
}
|
|
261
286
|
|
|
262
287
|
const strategy = matrix.strategy === "sequential" ? "sequential" : "parallel";
|
|
@@ -467,8 +492,10 @@ export function ensureMatrixCompleteTask(parent: TaskDefinition): TaskDefinition
|
|
|
467
492
|
schedule: parent.schedule,
|
|
468
493
|
prompt:
|
|
469
494
|
existing?.prompt ??
|
|
470
|
-
|
|
471
|
-
|
|
495
|
+
t("matrix.aggregator.prompt", {
|
|
496
|
+
parent: parent.name,
|
|
497
|
+
clones: clones.map((c) => c.name).join(", "),
|
|
498
|
+
}),
|
|
472
499
|
triggerType: "file",
|
|
473
500
|
watchPath: undefined,
|
|
474
501
|
mcpEvent: undefined,
|
|
@@ -542,7 +569,7 @@ export interface MatrixSyncPlan {
|
|
|
542
569
|
*/
|
|
543
570
|
export function planMatrixSync(parent: TaskDefinition): MatrixSyncPlan {
|
|
544
571
|
if (!parent.matrix) {
|
|
545
|
-
throw new Error(
|
|
572
|
+
throw new Error(t("matrix.error.notMatrix", { task: parent.name }));
|
|
546
573
|
}
|
|
547
574
|
const desired = expandMatrixTask(parent);
|
|
548
575
|
const existing = listMatrixClones(parent.name);
|
|
@@ -570,7 +597,7 @@ export function planMatrixSync(parent: TaskDefinition): MatrixSyncPlan {
|
|
|
570
597
|
running.push(current.name);
|
|
571
598
|
if (cloneSignature(current) !== cloneSignature(wanted)) {
|
|
572
599
|
warnings.push(
|
|
573
|
-
|
|
600
|
+
t("matrix.clone.runningChanges", { name: current.name })
|
|
574
601
|
);
|
|
575
602
|
}
|
|
576
603
|
continue;
|
|
@@ -586,7 +613,7 @@ export function planMatrixSync(parent: TaskDefinition): MatrixSyncPlan {
|
|
|
586
613
|
if (latest.status === "running") {
|
|
587
614
|
running.push(current.name);
|
|
588
615
|
warnings.push(
|
|
589
|
-
|
|
616
|
+
t("matrix.clone.runningDeletion", { name: current.name })
|
|
590
617
|
);
|
|
591
618
|
continue;
|
|
592
619
|
}
|
|
@@ -689,11 +716,10 @@ export function getMatrixDeletionGuard(
|
|
|
689
716
|
const definition = getTask(taskName);
|
|
690
717
|
const parentId = definition?.matrixParentId?.trim();
|
|
691
718
|
if (!parentId) return undefined;
|
|
692
|
-
return (
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
);
|
|
719
|
+
return t("matrix.deletionGuard", {
|
|
720
|
+
name: definition?.name ?? taskName,
|
|
721
|
+
parent: parentId,
|
|
722
|
+
});
|
|
697
723
|
}
|
|
698
724
|
|
|
699
725
|
/**
|
|
@@ -743,11 +769,11 @@ export interface MatrixCancelResult {
|
|
|
743
769
|
*/
|
|
744
770
|
export async function cancelPendingMatrixClones(
|
|
745
771
|
parentName: string,
|
|
746
|
-
reason = "
|
|
772
|
+
reason = t("matrix.cancel.defaultReason")
|
|
747
773
|
): Promise<MatrixCancelResult> {
|
|
748
774
|
const parent = getTask(parentName);
|
|
749
775
|
if (!parent?.matrix) {
|
|
750
|
-
throw new Error(
|
|
776
|
+
throw new Error(t("matrix.error.notMatrix", { task: parentName }));
|
|
751
777
|
}
|
|
752
778
|
|
|
753
779
|
const clones = listMatrixClones(parent.name);
|