agent-steward 0.0.2 → 0.0.3
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 +25 -2
- package/CROSS_PLATFORM.md +11 -9
- package/README.md +9 -8
- package/ROADMAP-STRATEGY.md +93 -44
- package/ROADMAP.md +114 -999
- package/dist/core/cron-to-schtasks.d.ts +0 -8
- package/dist/core/cron-to-schtasks.d.ts.map +1 -1
- package/dist/core/cron-to-schtasks.js +11 -86
- package/dist/core/dry-run.js +1 -1
- package/dist/core/file-watcher.js +9 -9
- package/dist/core/git-trigger.js +4 -4
- package/dist/core/lock.js +2 -4
- package/dist/core/one-shot.d.ts +27 -5
- package/dist/core/one-shot.d.ts.map +1 -1
- package/dist/core/one-shot.js +53 -10
- package/dist/core/otel.js +2 -2
- package/dist/core/ps-wrapper.d.ts +1 -1
- package/dist/core/ps-wrapper.d.ts.map +1 -1
- package/dist/core/ps-wrapper.js +55 -35
- package/dist/core/record-history.js +22 -22
- package/dist/core/schedule-v2.d.ts +2 -2
- package/dist/core/schedule-v2.d.ts.map +1 -1
- package/dist/core/schedule-v2.js +7 -7
- package/dist/core/scheduler/at-fallback.d.ts +42 -0
- package/dist/core/scheduler/at-fallback.d.ts.map +1 -0
- package/dist/core/scheduler/at-fallback.js +70 -0
- package/dist/core/scheduler/linux.d.ts +3 -1
- package/dist/core/scheduler/linux.d.ts.map +1 -1
- package/dist/core/scheduler/linux.js +43 -7
- package/dist/core/scheduler/mac.d.ts +14 -8
- package/dist/core/scheduler/mac.d.ts.map +1 -1
- package/dist/core/scheduler/mac.js +71 -22
- package/dist/core/scheduler/posix.d.ts.map +1 -1
- package/dist/core/scheduler/posix.js +12 -1
- package/dist/core/scheduler/registry.d.ts +2 -0
- package/dist/core/scheduler/registry.d.ts.map +1 -1
- package/dist/core/scheduler/windows.d.ts +16 -3
- package/dist/core/scheduler/windows.d.ts.map +1 -1
- package/dist/core/scheduler/windows.js +249 -96
- package/dist/core/secrets.js +2 -2
- package/dist/core/self-analysis.js +55 -55
- package/dist/core/summary.js +1 -1
- package/dist/core/triage-chain.js +1 -1
- package/dist/core/triage-worker.js +2 -2
- package/dist/core/triage.js +1 -1
- package/dist/core/wrappers/bash.js +33 -33
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +9 -1
- package/dist/db/run-journal.d.ts +60 -0
- package/dist/db/run-journal.d.ts.map +1 -0
- package/dist/db/run-journal.js +143 -0
- package/dist/db/run-resume.d.ts +48 -0
- package/dist/db/run-resume.d.ts.map +1 -0
- package/dist/db/run-resume.js +137 -0
- package/dist/db/runs-repo.d.ts +120 -0
- package/dist/db/runs-repo.d.ts.map +1 -0
- package/dist/db/runs-repo.js +319 -0
- package/dist/db/schema.d.ts +16 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +190 -35
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -36
- package/dist/notifications.js +18 -18
- package/dist/profiles.d.ts +7 -3
- package/dist/profiles.d.ts.map +1 -1
- package/dist/profiles.js +85 -7
- package/dist/rpc.d.ts +109 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +89 -0
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +20 -19
- package/dist/shared/jobs-view.d.ts.map +1 -1
- package/dist/skill.js +1 -1
- package/dist/task-transfer.d.ts +1 -1
- package/dist/task-transfer.d.ts.map +1 -1
- package/dist/task-transfer.js +14 -10
- package/dist/types.d.ts +20 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +37 -9
- package/dist/workspaces.js +1 -1
- package/docs/ARCHITECTURE.md +110 -8
- package/docs/COMPATIBILITY.md +10 -6
- package/docs/CONCEPT.md +15 -3
- package/docs/CROSS_PLATFORM.ru.md +11 -9
- package/docs/CROSS_PLATFORM.zh.md +11 -9
- package/docs/FAQ.md +2 -2
- package/docs/FAQ.ru.md +2 -2
- package/docs/FAQ.zh.md +2 -2
- package/docs/FEATURES.md +5 -4
- package/docs/FEATURES.zh.md +5 -4
- package/docs/MIGRATION.md +34 -26
- package/docs/README.ru.md +26 -7
- package/docs/README.zh.md +9 -8
- package/docs/V1-V2-COMPATIBILITY-PLAN.md +6 -6
- package/gui-experimental.cjs +8 -8
- package/index.js +1 -0
- package/locales/en.json +1 -0
- package/locales/ru.json +1 -0
- package/locales/zh.json +1 -0
- package/package.json +31 -10
- package/src/core/analytics.ts +2 -2
- package/src/core/audit.ts +17 -17
- package/src/core/cron-to-schtasks.ts +14 -93
- package/src/core/dry-run.ts +26 -26
- package/src/core/file-watcher.ts +17 -17
- package/src/core/git-trigger.ts +9 -9
- package/src/core/glob.ts +1 -1
- package/src/core/local-ai.ts +2 -2
- package/src/core/lock.ts +9 -9
- package/src/core/matrix.ts +31 -31
- package/src/core/native-notify.ts +2 -2
- package/src/core/one-shot.ts +63 -13
- package/src/core/otel.ts +4 -4
- package/src/core/permissions.ts +5 -5
- package/src/core/prometheus.ts +17 -17
- package/src/core/ps-wrapper.ts +57 -37
- package/src/core/record-history.ts +40 -40
- package/src/core/retention.ts +3 -3
- package/src/core/savings.ts +1 -1
- package/src/core/schedule-gate.ts +12 -12
- package/src/core/schedule-v2.ts +24 -24
- package/src/core/scheduler/at-fallback.ts +113 -0
- package/src/core/scheduler/index.ts +3 -3
- package/src/core/scheduler/linux.ts +64 -13
- package/src/core/scheduler/logs.ts +1 -1
- package/src/core/scheduler/mac.ts +112 -60
- package/src/core/scheduler/posix.ts +15 -1
- package/src/core/scheduler/registry.ts +6 -4
- package/src/core/scheduler/windows.ts +295 -125
- package/src/core/secrets.ts +13 -13
- package/src/core/self-analysis.ts +61 -61
- package/src/core/session.ts +3 -3
- package/src/core/structured-log.ts +3 -3
- package/src/core/summary.ts +25 -25
- package/src/core/telegram.ts +16 -16
- package/src/core/triage-chain.ts +4 -4
- package/src/core/triage-compare.ts +8 -8
- package/src/core/triage-rules.ts +4 -4
- package/src/core/triage-shadow.ts +7 -7
- package/src/core/triage-worker.ts +6 -6
- package/src/core/triage.ts +23 -23
- package/src/core/watch-paths.ts +1 -1
- package/src/core/wrappers/bash.ts +41 -41
- package/src/db/git-state-repo.ts +1 -1
- package/src/db/history-repo.ts +22 -22
- package/src/db/index.ts +16 -6
- package/src/db/metrics-repo.ts +10 -10
- package/src/db/migrate.ts +10 -10
- package/src/db/recovery.ts +3 -3
- package/src/db/run-journal.ts +212 -0
- package/src/db/run-resume.ts +220 -0
- package/src/db/runs-repo.ts +481 -0
- package/src/db/schema.ts +205 -44
- package/src/db/settings-repo.ts +2 -2
- package/src/db/tasks-repo.ts +10 -10
- package/src/db/templates-repo.ts +7 -7
- package/src/gui.tsx +1 -1
- package/src/history.ts +4 -4
- package/src/i18n.ts +7 -7
- package/src/index.ts +341 -304
- package/src/integrations.ts +6 -6
- package/src/notifications.ts +76 -76
- package/src/profiles.ts +98 -7
- package/src/rpc.ts +96 -1
- package/src/schtasks.ts +2 -2
- package/src/server.ts +43 -42
- package/src/settings.ts +44 -44
- package/src/shared/jobs-view.ts +60 -60
- package/src/skill.ts +1 -1
- package/src/task-transfer.ts +58 -56
- package/src/templates.ts +1 -1
- package/src/types.ts +45 -10
- package/src/workspaces.ts +16 -16
- package/dist/core/self-analysis.test.d.ts +0 -2
- package/dist/core/self-analysis.test.d.ts.map +0 -1
- package/dist/core/self-analysis.test.js +0 -219
- package/dist/gui-experimental.cjs +0 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAO,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAEL,KAAK,KAAK,IAAI,OAAO,EACrB,KAAK,WAAW,IAAI,aAAa,EAElC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,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} from "node:fs";
|
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { LockManager } from "./core/lock.js";
|
|
9
|
-
import { LOCK_DIR, LOG_DIR, PLUGIN_DIR, STALE_LOCK_MAX_AGE_MS, WRAPPER_DIR, sanitizeName, validateTaskName, } from "./types.js";
|
|
9
|
+
import { LOCK_DIR, LOG_DIR, PLUGIN_DIR, STALE_LOCK_MAX_AGE_MS, WRAPPER_DIR, sanitizeName, validateModelId, validateTaskName, } from "./types.js";
|
|
10
10
|
import { parseCron, buildScheduleGate, isValidIanaTimeZone, validateLaunchWindow, prevRun, nextRun as cronNextRun, normalizeActiveDays, activeWindowState, nextWindowOpenDelayMs } from "./core/schedule-v2.js";
|
|
11
11
|
import { buildLaunchdOneShotCleanup, normalizeOneShotRunAt, } from "./core/one-shot.js";
|
|
12
12
|
import { generateSessionId, normalizeSessionMode, preservedSessionRunCount, sessionStatePath, writeSessionStateFile, } from "./core/session.js";
|
|
@@ -67,7 +67,7 @@ const recorderPath = (() => {
|
|
|
67
67
|
.replace(/\.ts$/, ".js");
|
|
68
68
|
if (existsSync(distPath))
|
|
69
69
|
return distPath;
|
|
70
|
-
console.warn("[
|
|
70
|
+
console.warn("[agent-steward] Не найден собранный record-history.js: " +
|
|
71
71
|
`${distPath}. История/метрики не будут записываться. Выполните npm run build.`);
|
|
72
72
|
return distPath;
|
|
73
73
|
})();
|
|
@@ -84,7 +84,7 @@ const gatePath = (() => {
|
|
|
84
84
|
.replace(/\.ts$/, ".js");
|
|
85
85
|
if (existsSync(distPath))
|
|
86
86
|
return distPath;
|
|
87
|
-
console.warn("[
|
|
87
|
+
console.warn("[agent-steward] Не найден собранный schedule-gate.js: " +
|
|
88
88
|
`${distPath}. Гейт расписания не будет проверяться. Выполните npm run build.`);
|
|
89
89
|
return distPath;
|
|
90
90
|
})();
|
|
@@ -1475,12 +1475,25 @@ async function updateTaskFromInput(input) {
|
|
|
1475
1475
|
// после create — иначе задача молча начинает выполняться по расписанию.
|
|
1476
1476
|
const wasPaused = Boolean(previous.paused === true ||
|
|
1477
1477
|
(previous.pausedUntil && Date.parse(previous.pausedUntil) > Date.now()));
|
|
1478
|
+
const nextModel = clearableString(input.model, previous.model);
|
|
1479
|
+
if (nextModel) {
|
|
1480
|
+
const modelError = validateModelId(nextModel);
|
|
1481
|
+
if (modelError) {
|
|
1482
|
+
return {
|
|
1483
|
+
success: false,
|
|
1484
|
+
message: t("tool.error.modelInvalid", {
|
|
1485
|
+
model: nextModel,
|
|
1486
|
+
error: modelError,
|
|
1487
|
+
}),
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1478
1491
|
let previousDeleted = false;
|
|
1479
1492
|
try {
|
|
1480
1493
|
// Обновление = пересоздание в планировщике с сохранением старых значений.
|
|
1481
1494
|
await scheduler.deleteTask(name);
|
|
1482
1495
|
previousDeleted = true;
|
|
1483
|
-
await schedulerCreateTask(name, schedule ?? "", prompt, input.timeoutSeconds ?? previous.timeoutSeconds, clearableString(input.workingDirectory, previous.workingDirectory), input.retryCount ?? previous.retryCount, input.retryDelay ?? previous.retryDelay, clearableString(input.qualityGate, previous.qualityGate), clearableString(input.nextTaskOnSuccess, previous.nextTaskOnSuccess), clearableString(input.nextTaskOnError, previous.nextTaskOnError), triggerType, clearableString(input.watchPath, previous.watchPath), clearableList(input.dependsOn, previous.dependsOn),
|
|
1496
|
+
await schedulerCreateTask(name, schedule ?? "", prompt, input.timeoutSeconds ?? previous.timeoutSeconds, clearableString(input.workingDirectory, previous.workingDirectory), input.retryCount ?? previous.retryCount, input.retryDelay ?? previous.retryDelay, clearableString(input.qualityGate, previous.qualityGate), clearableString(input.nextTaskOnSuccess, previous.nextTaskOnSuccess), clearableString(input.nextTaskOnError, previous.nextTaskOnError), triggerType, clearableString(input.watchPath, previous.watchPath), clearableList(input.dependsOn, previous.dependsOn), nextModel, input.priority ?? previous.priority, clearableString(input.beforeScript, previous.beforeScript), clearableString(input.afterScript, previous.afterScript), input.mcpEvent ?? previous.mcpEvent, clearableString(input.workspaceId, previous.workspaceId), clearableList(input.allowedTools, previous.allowedTools), clearableList(input.deniedTools, previous.deniedTools), matrixNext, undefined,
|
|
1484
1497
|
// Если задача была матрицей — синхронизируем клонов, а не
|
|
1485
1498
|
// пересоздаём их с нуля (Спринт 17).
|
|
1486
1499
|
matrixWas && matrixNext ? "sync" : "create", timezone, notBefore, notAfter, previous.pausedUntil, runAt, session, sessionId, sessionMaxRuns, triggerExtras, input.runWhenLoggedOff ?? previous.runWhenLoggedOff, wasPaused, input.legacyShell ?? previous.legacyShell);
|
|
@@ -1761,10 +1774,10 @@ async function resumeExpiredPauses() {
|
|
|
1761
1774
|
pausedUntil: undefined,
|
|
1762
1775
|
paused: false,
|
|
1763
1776
|
});
|
|
1764
|
-
console.log(`[
|
|
1777
|
+
console.log(`[agent-steward] Автопродолжение: задача "${definition.name}" включена (пауза истекла).`);
|
|
1765
1778
|
}
|
|
1766
1779
|
catch (err) {
|
|
1767
|
-
console.error(`[
|
|
1780
|
+
console.error(`[agent-steward] Не удалось автопродолжить задачу "${definition.name}": ${err instanceof Error ? err.message : String(err)}`);
|
|
1768
1781
|
}
|
|
1769
1782
|
}
|
|
1770
1783
|
}
|
|
@@ -2452,7 +2465,7 @@ const emitEventExecute = wrapExecute(async (args) => {
|
|
|
2452
2465
|
triggered.push(def.name);
|
|
2453
2466
|
}
|
|
2454
2467
|
catch (err) {
|
|
2455
|
-
console.error(`[
|
|
2468
|
+
console.error(`[agent-steward] emit_event: не удалось запустить ${def.name}:`, err);
|
|
2456
2469
|
}
|
|
2457
2470
|
}
|
|
2458
2471
|
return {
|
|
@@ -2621,7 +2634,7 @@ function withRpcAudit(handlers) {
|
|
|
2621
2634
|
const input = args[0] ?? {};
|
|
2622
2635
|
const result = await handler(...args);
|
|
2623
2636
|
try {
|
|
2624
|
-
if (result?.success !== false) {
|
|
2637
|
+
if ((result)?.success !== false) {
|
|
2625
2638
|
recordAudit({
|
|
2626
2639
|
action: rule.action,
|
|
2627
2640
|
targetType: rule.targetType,
|
|
@@ -2661,7 +2674,7 @@ async function refreshTriggers() {
|
|
|
2661
2674
|
await fileWatcherManager.refresh();
|
|
2662
2675
|
}
|
|
2663
2676
|
catch (err) {
|
|
2664
|
-
console.error(`[
|
|
2677
|
+
console.error(`[agent-steward] Не удалось обновить файловые триггеры: ${err instanceof Error ? err.message : String(err)}`);
|
|
2665
2678
|
}
|
|
2666
2679
|
}
|
|
2667
2680
|
if (gitTriggerManager) {
|
|
@@ -2669,7 +2682,7 @@ async function refreshTriggers() {
|
|
|
2669
2682
|
await gitTriggerManager.refresh();
|
|
2670
2683
|
}
|
|
2671
2684
|
catch (err) {
|
|
2672
|
-
console.error(`[
|
|
2685
|
+
console.error(`[agent-steward] Не удалось обновить git-триггеры: ${err instanceof Error ? err.message : String(err)}`);
|
|
2673
2686
|
}
|
|
2674
2687
|
}
|
|
2675
2688
|
}
|
|
@@ -2695,22 +2708,22 @@ async function scheduleEventRun(taskName, reason) {
|
|
|
2695
2708
|
const state = activeWindowState(now, options);
|
|
2696
2709
|
if (state.active || policy === "run") {
|
|
2697
2710
|
await runTaskEntry(taskName);
|
|
2698
|
-
console.log(`[
|
|
2711
|
+
console.log(`[agent-steward] Запуск задачи "${taskName}" (${reason}).`);
|
|
2699
2712
|
return;
|
|
2700
2713
|
}
|
|
2701
2714
|
if (policy === "skip") {
|
|
2702
|
-
console.log(`[
|
|
2715
|
+
console.log(`[agent-steward] Задача "${taskName}" не запущена (${reason}): ${state.reason ?? "вне окна"} — политика skip.`);
|
|
2703
2716
|
return;
|
|
2704
2717
|
}
|
|
2705
2718
|
const delay = nextWindowOpenDelayMs(now, options);
|
|
2706
2719
|
if (delay <= 0 || delay > EVENT_POSTPONE_MAX_MS) {
|
|
2707
|
-
console.log(`[
|
|
2720
|
+
console.log(`[agent-steward] Задача "${taskName}" не запущена (${reason}): ${state.reason ?? "вне окна"} — до открытия окна больше 12 ч.`);
|
|
2708
2721
|
return;
|
|
2709
2722
|
}
|
|
2710
|
-
console.log(`[
|
|
2723
|
+
console.log(`[agent-steward] Задача "${taskName}" (${reason}) отложена на ~${Math.round(delay / 60000)} мин: ${state.reason ?? "вне окна"}.`);
|
|
2711
2724
|
const timer = setTimeout(() => {
|
|
2712
2725
|
void scheduleEventRun(taskName, reason).catch((err) => {
|
|
2713
|
-
console.error(`[
|
|
2726
|
+
console.error(`[agent-steward] Не удалось запустить отложенную задачу "${taskName}": ${err instanceof Error ? err.message : String(err)}`);
|
|
2714
2727
|
});
|
|
2715
2728
|
}, delay);
|
|
2716
2729
|
timer.unref?.();
|
|
@@ -2764,11 +2777,11 @@ export async function createRuntime(ctxLike) {
|
|
|
2764
2777
|
// Спринт 19: автопродолжение задач, поставленных на паузу до даты.
|
|
2765
2778
|
// Проверяем сразу при старте и далее раз в 5 минут, пока плагин жив.
|
|
2766
2779
|
void resumeExpiredPauses().catch((err) => {
|
|
2767
|
-
console.error(`[
|
|
2780
|
+
console.error(`[agent-steward] Не удалось проверить автопродолжение: ${err instanceof Error ? err.message : String(err)}`);
|
|
2768
2781
|
});
|
|
2769
2782
|
const pausedUntilTimer = setInterval(() => {
|
|
2770
2783
|
void resumeExpiredPauses().catch((err) => {
|
|
2771
|
-
console.error(`[
|
|
2784
|
+
console.error(`[agent-steward] Не удалось проверить автопродолжение: ${err instanceof Error ? err.message : String(err)}`);
|
|
2772
2785
|
});
|
|
2773
2786
|
}, PAUSED_UNTIL_CHECK_MS);
|
|
2774
2787
|
pausedUntilTimer.unref?.();
|
|
@@ -2777,7 +2790,7 @@ export async function createRuntime(ctxLike) {
|
|
|
2777
2790
|
const notificationTimer = setInterval(() => {
|
|
2778
2791
|
void maybeSendDigest().catch(() => undefined);
|
|
2779
2792
|
void checkStuckMatrices().catch((err) => {
|
|
2780
|
-
console.error(`[
|
|
2793
|
+
console.error(`[agent-steward] Детектор зависших матриц: ${err instanceof Error ? err.message : String(err)}`);
|
|
2781
2794
|
});
|
|
2782
2795
|
}, NOTIFICATION_CHECK_MS);
|
|
2783
2796
|
notificationTimer.unref?.();
|
|
@@ -2820,15 +2833,15 @@ export async function createRuntime(ctxLike) {
|
|
|
2820
2833
|
// Запускаем задачу и пишем в лог.
|
|
2821
2834
|
try {
|
|
2822
2835
|
await runTaskEntry(def.name);
|
|
2823
|
-
console.log(`[
|
|
2836
|
+
console.log(`[agent-steward] Запущено восстановление пропущенной задачи "${def.name}" (последний срабатывал ~${Math.round(ageMs / 1000)} с назад).`);
|
|
2824
2837
|
}
|
|
2825
2838
|
catch (err) {
|
|
2826
|
-
console.error(`[
|
|
2839
|
+
console.error(`[agent-steward] Не удалось восстановить задачу "${def.name}": ${err instanceof Error ? err.message : String(err)}`);
|
|
2827
2840
|
}
|
|
2828
2841
|
}
|
|
2829
2842
|
}
|
|
2830
2843
|
catch (err) {
|
|
2831
|
-
console.error(`[
|
|
2844
|
+
console.error(`[agent-steward] Catch-up ошибка: ${err instanceof Error ? err.message : String(err)}`);
|
|
2832
2845
|
}
|
|
2833
2846
|
})();
|
|
2834
2847
|
// Файловые триггеры (File Watchers): задачи с triggerType === "file"
|
|
@@ -2838,7 +2851,7 @@ export async function createRuntime(ctxLike) {
|
|
|
2838
2851
|
await scheduleEventRun(taskName, "изменение отслеживаемого файла");
|
|
2839
2852
|
}
|
|
2840
2853
|
catch (err) {
|
|
2841
|
-
console.error(`[
|
|
2854
|
+
console.error(`[agent-steward] Не удалось запустить задачу "${taskName}" по файловому триггеру: ${err instanceof Error ? err.message : String(err)}`);
|
|
2842
2855
|
}
|
|
2843
2856
|
});
|
|
2844
2857
|
// Спринт 27: git-триггеры — опрос HEAD и запуск при новых коммитах,
|
|
@@ -2848,7 +2861,7 @@ export async function createRuntime(ctxLike) {
|
|
|
2848
2861
|
await scheduleEventRun(taskName, `новый коммит ${info.head?.slice(0, 7) ?? ""}`);
|
|
2849
2862
|
}
|
|
2850
2863
|
catch (err) {
|
|
2851
|
-
console.error(`[
|
|
2864
|
+
console.error(`[agent-steward] Не удалось запустить задачу "${taskName}" по git-триггеру: ${err instanceof Error ? err.message : String(err)}`);
|
|
2852
2865
|
}
|
|
2853
2866
|
});
|
|
2854
2867
|
void refreshTriggers();
|
|
@@ -2914,7 +2927,7 @@ export function createShutdownHandler(runtime, registrations = [], options = {})
|
|
|
2914
2927
|
await registration.dispose();
|
|
2915
2928
|
}
|
|
2916
2929
|
catch (err) {
|
|
2917
|
-
console.warn(`[
|
|
2930
|
+
console.warn(`[agent-steward] Выгрузка: ошибка освобождения регистрации — ${err instanceof Error ? err.message : String(err)}`);
|
|
2918
2931
|
}
|
|
2919
2932
|
}
|
|
2920
2933
|
runtime.dispose();
|
|
@@ -2923,7 +2936,7 @@ export function createShutdownHandler(runtime, registrations = [], options = {})
|
|
|
2923
2936
|
await closeDashboardServer();
|
|
2924
2937
|
const wait = await shutdownGate.waitForIdle(waitMs);
|
|
2925
2938
|
if (wait.timedOut) {
|
|
2926
|
-
console.warn(`[
|
|
2939
|
+
console.warn(`[agent-steward] Выгрузка: ${wait.remaining} запуск(ов) не завершились за ${waitMs} мс — закрываем БД.`);
|
|
2927
2940
|
}
|
|
2928
2941
|
// Чекпойнт WAL выполняется в closeDb.
|
|
2929
2942
|
closeDb();
|
|
@@ -3176,7 +3189,7 @@ async function startSchedulerDashboard() {
|
|
|
3176
3189
|
cleanupMatrixOrphans: () => cleanupOrphanedMatrixTasks(),
|
|
3177
3190
|
});
|
|
3178
3191
|
if (dashboard) {
|
|
3179
|
-
console.log(`[
|
|
3192
|
+
console.log(`[agent-steward] Открыть дашборд в браузере: http://localhost:${dashboard.port}`);
|
|
3180
3193
|
}
|
|
3181
3194
|
}
|
|
3182
3195
|
const v2Plugin = Plugin.define({
|
|
@@ -3221,7 +3234,7 @@ const v2Plugin = Plugin.define({
|
|
|
3221
3234
|
}
|
|
3222
3235
|
}
|
|
3223
3236
|
catch (err) {
|
|
3224
|
-
console.error(`[
|
|
3237
|
+
console.error(`[agent-steward] Не удалось зарегистрировать скилл "${SCHEDULER_SKILL_ID}": ${err instanceof Error ? err.message : String(err)}`);
|
|
3225
3238
|
}
|
|
3226
3239
|
// Регистрируем RPC-методы, вызываемые из GUI-панели.
|
|
3227
3240
|
// Общая логика создания задачи вынесена в schedulerCreateTask, чтобы
|
|
@@ -3236,7 +3249,7 @@ const v2Plugin = Plugin.define({
|
|
|
3236
3249
|
};
|
|
3237
3250
|
},
|
|
3238
3251
|
create_task: async (input) => {
|
|
3239
|
-
console.log("[
|
|
3252
|
+
console.log("[agent-steward] create_task input:", input);
|
|
3240
3253
|
const { name, schedule, prompt, retryCount, retryDelay, qualityGate, nextTaskOnSuccess, nextTaskOnError, dependsOn, triggerType, watchPath, workingDirectory, model, priority, beforeScript, afterScript, mcpEvent, workspaceId, allowedTools, deniedTools, matrix, timezone, notBefore, notAfter, runAt, delaySeconds, session, sessionMaxRuns, runWhenLoggedOff, legacyShell, } = input;
|
|
3241
3254
|
let effectiveRunAt;
|
|
3242
3255
|
if (triggerType === "once") {
|
|
@@ -3405,10 +3418,10 @@ const v2Plugin = Plugin.define({
|
|
|
3405
3418
|
try {
|
|
3406
3419
|
await runTaskEntry(def.name);
|
|
3407
3420
|
triggered.push(def.name);
|
|
3408
|
-
console.log(`[
|
|
3421
|
+
console.log(`[agent-steward] Запуск задачи "${def.name}" по MCP-событию "${normalized}".`);
|
|
3409
3422
|
}
|
|
3410
3423
|
catch (err) {
|
|
3411
|
-
console.error(`[
|
|
3424
|
+
console.error(`[agent-steward] Не удалось запустить "${def.name}" по событию "${normalized}": ${err instanceof Error ? err.message : String(err)}`);
|
|
3412
3425
|
}
|
|
3413
3426
|
}
|
|
3414
3427
|
return {
|
|
@@ -3962,7 +3975,7 @@ const v2Plugin = Plugin.define({
|
|
|
3962
3975
|
return { templates: await loadTemplates() };
|
|
3963
3976
|
}
|
|
3964
3977
|
catch (err) {
|
|
3965
|
-
console.error("[
|
|
3978
|
+
console.error("[agent-steward] get_templates error:", err);
|
|
3966
3979
|
return { templates: [] };
|
|
3967
3980
|
}
|
|
3968
3981
|
},
|
|
@@ -4201,8 +4214,19 @@ function resolveMatrixExtraConfig(name, matrix, ids) {
|
|
|
4201
4214
|
"afterScript",
|
|
4202
4215
|
]) {
|
|
4203
4216
|
const raw = value[field];
|
|
4204
|
-
if (typeof raw === "string" && raw.trim())
|
|
4205
|
-
|
|
4217
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
4218
|
+
const trimmed = raw.trim();
|
|
4219
|
+
if (field === "model") {
|
|
4220
|
+
const modelError = validateModelId(trimmed);
|
|
4221
|
+
if (modelError) {
|
|
4222
|
+
throw new Error(t("tool.error.modelInvalid", {
|
|
4223
|
+
model: trimmed,
|
|
4224
|
+
error: modelError,
|
|
4225
|
+
}));
|
|
4226
|
+
}
|
|
4227
|
+
}
|
|
4228
|
+
override[field] = trimmed;
|
|
4229
|
+
}
|
|
4206
4230
|
}
|
|
4207
4231
|
if (Object.keys(override).length > 0)
|
|
4208
4232
|
overrides[workspaceKey] = override;
|
|
@@ -4274,6 +4298,12 @@ legacyShell) {
|
|
|
4274
4298
|
// удалять их при сбое нельзя — в БД остаётся прежнее определение.
|
|
4275
4299
|
const definitionExisted = Boolean(getTask(normalizedName));
|
|
4276
4300
|
const normalizedModel = model?.trim() || undefined;
|
|
4301
|
+
if (normalizedModel) {
|
|
4302
|
+
const modelError = validateModelId(normalizedModel);
|
|
4303
|
+
if (modelError) {
|
|
4304
|
+
throw new Error(t("tool.error.modelInvalid", { model: normalizedModel, error: modelError }));
|
|
4305
|
+
}
|
|
4306
|
+
}
|
|
4277
4307
|
const normalizedPriority = normalizePriority(priority);
|
|
4278
4308
|
const normalizedBefore = beforeScript?.trim() || undefined;
|
|
4279
4309
|
const normalizedAfter = afterScript?.trim() || undefined;
|
|
@@ -4309,7 +4339,7 @@ legacyShell) {
|
|
|
4309
4339
|
triggerExtras.gitPollSeconds >= 5
|
|
4310
4340
|
? Math.floor(triggerExtras.gitPollSeconds)
|
|
4311
4341
|
: undefined;
|
|
4312
|
-
const normalizedMcpEvent = mcpEvent
|
|
4342
|
+
const normalizedMcpEvent = mcpEvent?.event?.trim()
|
|
4313
4343
|
? {
|
|
4314
4344
|
server: mcpEvent.server?.trim() || "",
|
|
4315
4345
|
event: mcpEvent.event.trim(),
|
|
@@ -4658,7 +4688,7 @@ legacyShell) {
|
|
|
4658
4688
|
if (!listedTasks && verifyQueryError) {
|
|
4659
4689
|
// Список получить не удалось — не удаляем возможно созданную задачу,
|
|
4660
4690
|
// но явно предупреждаем: проверка наличия не выполнена.
|
|
4661
|
-
console.warn(`[
|
|
4691
|
+
console.warn(`[agent-steward] Задача "${name}" создана, но проверить её в планировщике не удалось: ${verifyQueryError instanceof Error ? verifyQueryError.message : String(verifyQueryError)}`);
|
|
4662
4692
|
}
|
|
4663
4693
|
// Сохраняем определение задачи для последующего экспорта/импорта.
|
|
4664
4694
|
// Определение до перезаписи: нужно и для очереди матрицы, и для счётчика сессии.
|
|
@@ -4868,7 +4898,7 @@ legacyShell) {
|
|
|
4868
4898
|
await scheduler.pauseTask(target);
|
|
4869
4899
|
}
|
|
4870
4900
|
catch (err) {
|
|
4871
|
-
console.warn(`[
|
|
4901
|
+
console.warn(`[agent-steward] Задача "${target}": пауза не восстановлена после пересоздания: ${err instanceof Error ? err.message : String(err)}`);
|
|
4872
4902
|
}
|
|
4873
4903
|
}
|
|
4874
4904
|
}
|
package/dist/notifications.js
CHANGED
|
@@ -281,12 +281,12 @@ async function deliverDetailed(config, message, only) {
|
|
|
281
281
|
webhook.url.trim()) {
|
|
282
282
|
try {
|
|
283
283
|
await sendWebhook(webhook.url, message, webhookOptionsFrom(config));
|
|
284
|
-
console.log("[
|
|
284
|
+
console.log("[agent-steward] Уведомление отправлено в webhook.");
|
|
285
285
|
results.push({ channel: "webhook", ok: true });
|
|
286
286
|
}
|
|
287
287
|
catch (err) {
|
|
288
288
|
const text = err instanceof Error ? err.message : String(err);
|
|
289
|
-
console.error(`[
|
|
289
|
+
console.error(`[agent-steward] Webhook: ${text}`);
|
|
290
290
|
results.push({ channel: "webhook", ok: false, error: text });
|
|
291
291
|
}
|
|
292
292
|
}
|
|
@@ -295,7 +295,7 @@ async function deliverDetailed(config, message, only) {
|
|
|
295
295
|
const { token, chatId } = telegramCredentials(config);
|
|
296
296
|
if (!token || !chatId) {
|
|
297
297
|
const text = t("notify.error.telegramNoCreds");
|
|
298
|
-
console.error(`[
|
|
298
|
+
console.error(`[agent-steward] ${text}`);
|
|
299
299
|
results.push({ channel: "telegram", ok: false, error: text });
|
|
300
300
|
}
|
|
301
301
|
else {
|
|
@@ -308,12 +308,12 @@ async function deliverDetailed(config, message, only) {
|
|
|
308
308
|
includeDashboardLink: telegram.includeDashboardLink,
|
|
309
309
|
dashboardUrl,
|
|
310
310
|
});
|
|
311
|
-
console.log("[
|
|
311
|
+
console.log("[agent-steward] Уведомление отправлено в Telegram.");
|
|
312
312
|
results.push({ channel: "telegram", ok: true });
|
|
313
313
|
}
|
|
314
314
|
catch (err) {
|
|
315
315
|
const text = err instanceof Error ? err.message : String(err);
|
|
316
|
-
console.error(`[
|
|
316
|
+
console.error(`[agent-steward] Telegram: ${text}`);
|
|
317
317
|
results.push({ channel: "telegram", ok: false, error: text });
|
|
318
318
|
}
|
|
319
319
|
}
|
|
@@ -322,12 +322,12 @@ async function deliverDetailed(config, message, only) {
|
|
|
322
322
|
if ((!only || only === "native") && config.enabled && native?.enabled) {
|
|
323
323
|
const result = await sendNativeNotification({ title: t("notify.native.title"), body: message, sound: native.sound }, {});
|
|
324
324
|
if (result.success) {
|
|
325
|
-
console.log("[
|
|
325
|
+
console.log("[agent-steward] Нативное уведомление показано.");
|
|
326
326
|
results.push({ channel: "native", ok: true });
|
|
327
327
|
}
|
|
328
328
|
else {
|
|
329
329
|
const text = result.error ?? t("notify.error.nativeFailed");
|
|
330
|
-
console.error(`[
|
|
330
|
+
console.error(`[agent-steward] Нативное уведомление: ${text}`);
|
|
331
331
|
results.push({ channel: "native", ok: false, error: text });
|
|
332
332
|
}
|
|
333
333
|
}
|
|
@@ -340,7 +340,7 @@ async function deliver(config, message) {
|
|
|
340
340
|
}
|
|
341
341
|
/** Ключ дедупа: комбинация задачи и статуса. */
|
|
342
342
|
function dedupKey(taskName, status) {
|
|
343
|
-
return (taskName +
|
|
343
|
+
return (taskName + "|" + status).toLowerCase();
|
|
344
344
|
}
|
|
345
345
|
/** Читает или создаёт запись дедупа. Возвращает { record, isDuplicate }.
|
|
346
346
|
* Если записи нет или окно истекло — создаёт новую с count=1.
|
|
@@ -409,7 +409,7 @@ function isDedupSuppressed(status, dedup) {
|
|
|
409
409
|
function messageWithDedupCount(message, count) {
|
|
410
410
|
if (count <= 1)
|
|
411
411
|
return message;
|
|
412
|
-
return message +
|
|
412
|
+
return message + " " + t("notify.dedup.count", { count });
|
|
413
413
|
}
|
|
414
414
|
/** Размерность вектора фиксирована: feature hashing, а не словарь сообщения. */
|
|
415
415
|
const EMBEDDING_DIMENSION = 512;
|
|
@@ -423,7 +423,7 @@ function fnv1a32(value) {
|
|
|
423
423
|
return hash >>> 0;
|
|
424
424
|
}
|
|
425
425
|
function embeddingKey(taskName, status) {
|
|
426
|
-
return `emb:${(taskName +
|
|
426
|
+
return `emb:${(taskName + "|" + status).toLowerCase()}`;
|
|
427
427
|
}
|
|
428
428
|
/** Простой токенизатор: слова, цифры, нижний регистр. */
|
|
429
429
|
function tokenize(text) {
|
|
@@ -570,12 +570,12 @@ export async function notifyTaskCompletion(taskName, status, durationMs, error,
|
|
|
570
570
|
// Injected scheduler может быть асинхронным — не оставляем rejection.
|
|
571
571
|
if (job && typeof job.then === "function") {
|
|
572
572
|
void Promise.resolve(job).catch((err) => {
|
|
573
|
-
console.error(`[
|
|
573
|
+
console.error(`[agent-steward] Ошибка фонового триажа: ${err instanceof Error ? err.message : String(err)}`);
|
|
574
574
|
});
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
catch (err) {
|
|
578
|
-
console.error(`[
|
|
578
|
+
console.error(`[agent-steward] Не удалось запустить фоновый триаж: ${err instanceof Error ? err.message : String(err)}`);
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
else if (mode !== "off") {
|
|
@@ -642,7 +642,7 @@ export async function notifyTaskCompletion(taskName, status, durationMs, error,
|
|
|
642
642
|
}
|
|
643
643
|
catch (err) {
|
|
644
644
|
// Уведомление не должно ломать запись истории и саму задачу.
|
|
645
|
-
console.error(`[
|
|
645
|
+
console.error(`[agent-steward] Ошибка подготовки уведомления: ${err instanceof Error ? err.message : String(err)}`);
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
/**
|
|
@@ -674,7 +674,7 @@ export async function notifyMatrixCompletion(info) {
|
|
|
674
674
|
await deliver(config, formatMatrixMessage(info));
|
|
675
675
|
}
|
|
676
676
|
catch (err) {
|
|
677
|
-
console.error(`[
|
|
677
|
+
console.error(`[agent-steward] Ошибка уведомления о матрице: ${err instanceof Error ? err.message : String(err)}`);
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
680
|
/**
|
|
@@ -729,7 +729,7 @@ export async function notifyStuckMatrix(stuck) {
|
|
|
729
729
|
return await deliver(config, formatStuckMatrixMessage(stuck));
|
|
730
730
|
}
|
|
731
731
|
catch (err) {
|
|
732
|
-
console.error(`[
|
|
732
|
+
console.error(`[agent-steward] Ошибка уведомления о зависшей матрице: ${err instanceof Error ? err.message : String(err)}`);
|
|
733
733
|
return false;
|
|
734
734
|
}
|
|
735
735
|
}
|
|
@@ -894,14 +894,14 @@ export async function maybeSendDigest(now = new Date()) {
|
|
|
894
894
|
return false;
|
|
895
895
|
const result = await sendDigestNow({ now, updateLastSentAt: true });
|
|
896
896
|
if (result.success) {
|
|
897
|
-
console.log("[
|
|
897
|
+
console.log("[agent-steward] Дайджест уведомлений отправлен.");
|
|
898
898
|
return true;
|
|
899
899
|
}
|
|
900
|
-
console.error(`[
|
|
900
|
+
console.error(`[agent-steward] Дайджест не отправлен: ${result.message}`);
|
|
901
901
|
return false;
|
|
902
902
|
}
|
|
903
903
|
catch (err) {
|
|
904
|
-
console.error(`[
|
|
904
|
+
console.error(`[agent-steward] Ошибка дайджеста: ${err instanceof Error ? err.message : String(err)}`);
|
|
905
905
|
return false;
|
|
906
906
|
}
|
|
907
907
|
}
|
package/dist/profiles.d.ts
CHANGED
|
@@ -21,10 +21,14 @@ export interface ProfileInfo {
|
|
|
21
21
|
/**
|
|
22
22
|
* Базовая директория плагина (до профилей).
|
|
23
23
|
*
|
|
24
|
-
* Windows: %APPDATA%\opencode\
|
|
25
|
-
* macOS/Linux: $XDG_CONFIG_HOME/opencode/
|
|
26
|
-
* ~/.config/opencode/
|
|
24
|
+
* Windows: %APPDATA%\opencode\agent-steward.
|
|
25
|
+
* macOS/Linux: $XDG_CONFIG_HOME/opencode/agent-steward или
|
|
26
|
+
* ~/.config/opencode/agent-steward.
|
|
27
27
|
* OPENCODE_SCHEDULER_HOME переопределяет всё (тесты, кастомные установки).
|
|
28
|
+
*
|
|
29
|
+
* При первом запуске после переименования данные из исторической
|
|
30
|
+
* .../opencode/windows-scheduler копируются в новую директорию (legacy
|
|
31
|
+
* остаётся на месте как резервная копия).
|
|
28
32
|
*/
|
|
29
33
|
export declare function getBasePluginDir(): string;
|
|
30
34
|
/** Нормализует имя профиля: нижний регистр, только [a-z0-9_-]. */
|
package/dist/profiles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,eAAO,MAAM,eAAe,YAAY,CAAC;AAKzC,+CAA+C;AAC/C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,oCAAoC;AACpC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,I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C,EAAE,MAAM,GAAG,WAAW,CAkBtE;AAED,iFAAiF;AACjF,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiClE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQnD;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
|
package/dist/profiles.js
CHANGED
|
@@ -13,21 +13,99 @@ const ACTIVE_PROFILE_FILE = "active-profile";
|
|
|
13
13
|
/**
|
|
14
14
|
* Базовая директория плагина (до профилей).
|
|
15
15
|
*
|
|
16
|
-
* Windows: %APPDATA%\opencode\
|
|
17
|
-
* macOS/Linux: $XDG_CONFIG_HOME/opencode/
|
|
18
|
-
* ~/.config/opencode/
|
|
16
|
+
* Windows: %APPDATA%\opencode\agent-steward.
|
|
17
|
+
* macOS/Linux: $XDG_CONFIG_HOME/opencode/agent-steward или
|
|
18
|
+
* ~/.config/opencode/agent-steward.
|
|
19
19
|
* OPENCODE_SCHEDULER_HOME переопределяет всё (тесты, кастомные установки).
|
|
20
|
+
*
|
|
21
|
+
* При первом запуске после переименования данные из исторической
|
|
22
|
+
* .../opencode/windows-scheduler копируются в новую директорию (legacy
|
|
23
|
+
* остаётся на месте как резервная копия).
|
|
20
24
|
*/
|
|
21
25
|
export function getBasePluginDir() {
|
|
22
26
|
const custom = process.env.OPENCODE_SCHEDULER_HOME?.trim();
|
|
23
27
|
if (custom)
|
|
24
28
|
return path.resolve(custom);
|
|
29
|
+
const root = path.join(pluginConfigRoot(), "opencode");
|
|
30
|
+
const target = path.join(root, "agent-steward");
|
|
31
|
+
const legacy = path.join(root, "windows-scheduler");
|
|
32
|
+
if (fs.existsSync(target) || !fs.existsSync(legacy))
|
|
33
|
+
return target;
|
|
34
|
+
try {
|
|
35
|
+
migrateLegacyBaseDir(legacy, target);
|
|
36
|
+
return target;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
// Не теряем доступ к данным: продолжаем работать в старой директории.
|
|
40
|
+
console.error(`[agent-steward] Не удалось перенести данные из "${legacy}" в "${target}": ${error instanceof Error ? error.message : String(error)}. Использую старую директорию.`);
|
|
41
|
+
return legacy;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Корень конфигурации пользователя (без .../opencode). */
|
|
45
|
+
function pluginConfigRoot() {
|
|
25
46
|
if (process.platform === "win32") {
|
|
26
|
-
|
|
27
|
-
return path.join(base, "opencode", "windows-scheduler");
|
|
47
|
+
return process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming");
|
|
28
48
|
}
|
|
29
|
-
|
|
30
|
-
|
|
49
|
+
return process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config");
|
|
50
|
+
}
|
|
51
|
+
const MIGRATION_MARKER = ".migrated-from-windows-scheduler";
|
|
52
|
+
/** Расширения текстовых файлов, в которых могут быть абсолютные пути. */
|
|
53
|
+
const PATH_REWRITE_EXTENSIONS = new Set([
|
|
54
|
+
".json",
|
|
55
|
+
".cmd",
|
|
56
|
+
".sh",
|
|
57
|
+
".bash",
|
|
58
|
+
".ps1",
|
|
59
|
+
".txt",
|
|
60
|
+
]);
|
|
61
|
+
/**
|
|
62
|
+
* Копирует legacy-директорию в новую и переписывает в текстовых файлах
|
|
63
|
+
* абсолютные пути старой директории на новую. Копия делается во временную
|
|
64
|
+
* директорию и переименовывается атомарно, чтобы не оставить половину данных.
|
|
65
|
+
*/
|
|
66
|
+
function migrateLegacyBaseDir(legacy, target) {
|
|
67
|
+
const temp = `${target}.migrating-${process.pid}`;
|
|
68
|
+
fs.rmSync(temp, { recursive: true, force: true });
|
|
69
|
+
fs.cpSync(legacy, temp, { recursive: true });
|
|
70
|
+
rewriteAbsolutePaths(temp, legacy, target);
|
|
71
|
+
fs.writeFileSync(path.join(temp, MIGRATION_MARKER), `${new Date().toISOString()}\n`, "utf8");
|
|
72
|
+
try {
|
|
73
|
+
fs.renameSync(temp, target);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
fs.rmSync(temp, { recursive: true, force: true });
|
|
77
|
+
// Параллельный процесс мог успеть создать target — это не ошибка.
|
|
78
|
+
if (fs.existsSync(target))
|
|
79
|
+
return;
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function rewriteAbsolutePaths(root, from, to) {
|
|
84
|
+
const variants = [
|
|
85
|
+
from,
|
|
86
|
+
from.replace(/\\/g, "/"),
|
|
87
|
+
from.replace(/\\/g, "\\\\"),
|
|
88
|
+
].filter((value, index, all) => value && all.indexOf(value) === index);
|
|
89
|
+
const walk = (dir) => {
|
|
90
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
91
|
+
const full = path.join(dir, entry.name);
|
|
92
|
+
if (entry.isDirectory()) {
|
|
93
|
+
walk(full);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (!PATH_REWRITE_EXTENSIONS.has(path.extname(entry.name).toLowerCase())) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const text = fs.readFileSync(full, "utf8");
|
|
100
|
+
let next = text;
|
|
101
|
+
for (const variant of variants) {
|
|
102
|
+
next = next.split(variant).join(variant.includes("\\\\") ? to.replace(/\\/g, "\\\\") : variant.includes("/") ? to.replace(/\\/g, "/") : to);
|
|
103
|
+
}
|
|
104
|
+
if (next !== text)
|
|
105
|
+
fs.writeFileSync(full, next, "utf8");
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
walk(root);
|
|
31
109
|
}
|
|
32
110
|
/** Нормализует имя профиля: нижний регистр, только [a-z0-9_-]. */
|
|
33
111
|
export function sanitizeProfileName(value) {
|