agent-steward 0.0.2 → 0.0.4
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 +45 -2
- package/CROSS_PLATFORM.md +11 -9
- package/README.md +11 -10
- package/ROADMAP-STRATEGY.md +93 -44
- package/ROADMAP.md +148 -1017
- 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/dlq-api.d.ts +44 -0
- package/dist/core/dlq-api.d.ts.map +1 -0
- package/dist/core/dlq-api.js +68 -0
- package/dist/core/dry-run.d.ts.map +1 -1
- package/dist/core/dry-run.js +19 -2
- package/dist/core/file-watcher.js +9 -9
- package/dist/core/git-trigger.js +4 -4
- package/dist/core/lock.d.ts +20 -4
- package/dist/core/lock.d.ts.map +1 -1
- package/dist/core/lock.js +99 -26
- package/dist/core/one-shot.d.ts +31 -5
- package/dist/core/one-shot.d.ts.map +1 -1
- package/dist/core/one-shot.js +78 -10
- package/dist/core/opencode-cli.d.ts +28 -0
- package/dist/core/opencode-cli.d.ts.map +1 -0
- package/dist/core/opencode-cli.js +74 -0
- package/dist/core/opencode-models.d.ts +62 -0
- package/dist/core/opencode-models.d.ts.map +1 -0
- package/dist/core/opencode-models.js +277 -0
- 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 +66 -36
- package/dist/core/record-history.d.ts +15 -0
- package/dist/core/record-history.d.ts.map +1 -1
- package/dist/core/record-history.js +78 -54
- package/dist/core/router/dispatch.d.ts +36 -0
- package/dist/core/router/dispatch.d.ts.map +1 -0
- package/dist/core/router/dispatch.js +59 -0
- package/dist/core/router/escalation.d.ts +47 -0
- package/dist/core/router/escalation.d.ts.map +1 -0
- package/dist/core/router/escalation.js +87 -0
- package/dist/core/router/planner.d.ts +53 -0
- package/dist/core/router/planner.d.ts.map +1 -0
- package/dist/core/router/planner.js +113 -0
- package/dist/core/router/rules.d.ts +46 -0
- package/dist/core/router/rules.d.ts.map +1 -0
- package/dist/core/router/rules.js +85 -0
- package/dist/core/run-panel-api.d.ts +94 -0
- package/dist/core/run-panel-api.d.ts.map +1 -0
- package/dist/core/run-panel-api.js +169 -0
- package/dist/core/schedule-gate.js +5 -1
- package/dist/core/schedule-v2.d.ts +36 -2
- package/dist/core/schedule-v2.d.ts.map +1 -1
- package/dist/core/schedule-v2.js +98 -12
- package/dist/core/scheduler/at-fallback.d.ts +95 -0
- package/dist/core/scheduler/at-fallback.d.ts.map +1 -0
- package/dist/core/scheduler/at-fallback.js +200 -0
- package/dist/core/scheduler/linux.d.ts +13 -2
- package/dist/core/scheduler/linux.d.ts.map +1 -1
- package/dist/core/scheduler/linux.js +67 -13
- 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 +37 -2
- package/dist/core/scheduler/registry.d.ts +13 -0
- package/dist/core/scheduler/registry.d.ts.map +1 -1
- package/dist/core/scheduler/registry.js +83 -21
- package/dist/core/scheduler/run-now.d.ts +16 -0
- package/dist/core/scheduler/run-now.d.ts.map +1 -0
- package/dist/core/scheduler/run-now.js +28 -0
- 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.d.ts.map +1 -1
- package/dist/core/secrets.js +127 -30
- package/dist/core/self-analysis.js +55 -55
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +18 -11
- package/dist/core/summary.js +1 -1
- package/dist/core/task-name.d.ts +24 -0
- package/dist/core/task-name.d.ts.map +1 -0
- package/dist/core/task-name.js +40 -0
- 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.d.ts.map +1 -1
- package/dist/core/wrappers/bash.js +82 -37
- package/dist/db/capability-repo.d.ts +83 -0
- package/dist/db/capability-repo.d.ts.map +1 -0
- package/dist/db/capability-repo.js +182 -0
- package/dist/db/history-repo.d.ts +8 -0
- package/dist/db/history-repo.d.ts.map +1 -1
- package/dist/db/history-repo.js +19 -0
- package/dist/db/index.d.ts +6 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +48 -2
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +3 -1
- package/dist/db/run-context.d.ts +103 -0
- package/dist/db/run-context.d.ts.map +1 -0
- package/dist/db/run-context.js +224 -0
- package/dist/db/run-dlq.d.ts +100 -0
- package/dist/db/run-dlq.d.ts.map +1 -0
- package/dist/db/run-dlq.js +191 -0
- 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 +51 -0
- package/dist/db/run-resume.d.ts.map +1 -0
- package/dist/db/run-resume.js +156 -0
- package/dist/db/runs-repo.d.ts +128 -0
- package/dist/db/runs-repo.d.ts.map +1 -0
- package/dist/db/runs-repo.js +342 -0
- package/dist/db/schema.d.ts +16 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +342 -35
- package/dist/db/settings-repo.d.ts +11 -0
- package/dist/db/settings-repo.d.ts.map +1 -1
- package/dist/db/settings-repo.js +25 -0
- package/dist/db/step-idempotency.d.ts +51 -0
- package/dist/db/step-idempotency.d.ts.map +1 -0
- package/dist/db/step-idempotency.js +136 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +168 -40
- 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 +787 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +324 -0
- package/dist/server.d.ts +33 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +115 -54
- 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 +44 -9
- package/dist/workspaces.d.ts +25 -3
- package/dist/workspaces.d.ts.map +1 -1
- package/dist/workspaces.js +44 -9
- package/docs/ARCHITECTURE.md +335 -9
- package/docs/COMPATIBILITY.md +10 -6
- package/docs/CONCEPT.md +183 -91
- package/docs/CROSS_PLATFORM.ru.md +11 -9
- package/docs/CROSS_PLATFORM.zh.md +11 -9
- package/docs/EXECUTION-LOOP.md +196 -0
- 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 +27 -8
- package/docs/README.zh.md +11 -10
- package/docs/SAFETY.md +122 -0
- package/docs/SAVINGS.md +29 -0
- package/docs/SAVINGS.ru.md +29 -0
- package/docs/SAVINGS.zh.md +18 -0
- package/docs/V1-V2-COMPATIBILITY-PLAN.md +6 -6
- package/gui-experimental.cjs +8 -8
- package/index.js +1 -0
- package/locales/en.json +68 -0
- package/locales/ru.json +68 -0
- package/locales/zh.json +68 -0
- package/package.json +57 -11
- package/scripts/audit-bundle.mjs +215 -0
- 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/dlq-api.ts +98 -0
- package/src/core/dry-run.ts +51 -27
- 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 +104 -31
- package/src/core/matrix.ts +31 -31
- package/src/core/native-notify.ts +2 -2
- package/src/core/one-shot.ts +91 -13
- package/src/core/opencode-cli.ts +103 -0
- package/src/core/opencode-models.ts +315 -0
- 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 +68 -38
- package/src/core/record-history.ts +114 -76
- package/src/core/retention.ts +3 -3
- package/src/core/router/dispatch.ts +94 -0
- package/src/core/router/escalation.ts +129 -0
- package/src/core/router/planner.ts +166 -0
- package/src/core/router/rules.ts +109 -0
- package/src/core/run-panel-api.ts +262 -0
- package/src/core/savings.ts +1 -1
- package/src/core/schedule-gate.ts +17 -13
- package/src/core/schedule-v2.ts +138 -29
- package/src/core/scheduler/at-fallback.ts +298 -0
- package/src/core/scheduler/index.ts +3 -3
- package/src/core/scheduler/linux.ts +92 -19
- package/src/core/scheduler/logs.ts +1 -1
- package/src/core/scheduler/mac.ts +112 -60
- package/src/core/scheduler/posix.ts +35 -2
- package/src/core/scheduler/registry.ts +109 -26
- package/src/core/scheduler/run-now.ts +32 -0
- package/src/core/scheduler/windows.ts +295 -125
- package/src/core/secrets.ts +139 -39
- package/src/core/self-analysis.ts +61 -61
- package/src/core/session.ts +26 -13
- package/src/core/structured-log.ts +3 -3
- package/src/core/summary.ts +25 -25
- package/src/core/task-name.ts +67 -0
- 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 +90 -45
- package/src/db/capability-repo.ts +285 -0
- package/src/db/git-state-repo.ts +1 -1
- package/src/db/history-repo.ts +44 -22
- package/src/db/index.ts +53 -7
- package/src/db/metrics-repo.ts +10 -10
- package/src/db/migrate.ts +13 -11
- package/src/db/recovery.ts +3 -3
- package/src/db/run-context.ts +370 -0
- package/src/db/run-dlq.ts +310 -0
- package/src/db/run-journal.ts +212 -0
- package/src/db/run-resume.ts +256 -0
- package/src/db/runs-repo.ts +504 -0
- package/src/db/schema.ts +357 -44
- package/src/db/settings-repo.ts +33 -2
- package/src/db/step-idempotency.ts +185 -0
- package/src/db/tasks-repo.ts +10 -10
- package/src/db/templates-repo.ts +7 -7
- package/src/gui.tsx +516 -1
- package/src/history.ts +4 -4
- package/src/i18n.ts +7 -7
- package/src/index.ts +465 -308
- package/src/integrations.ts +6 -6
- package/src/notifications.ts +76 -76
- package/src/profiles.ts +98 -7
- package/src/rpc.ts +347 -1
- package/src/schtasks.ts +2 -2
- package/src/server.ts +155 -78
- 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 +54 -10
- package/src/workspaces.ts +73 -24
- 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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Plugin } from "@opencode/plugin";
|
|
2
2
|
import { type Hooks as V1Hooks, type PluginInput as V1PluginInput } from "@opencode-ai/plugin";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { Tool } from "@opencode/schema/tool";
|
|
4
|
+
import type { Tool } from "@opencode/schema/tool";
|
|
5
5
|
import { type LocalAiPatch } from "./core/local-ai.js";
|
|
6
6
|
import type { AuditEntryInput } from "./core/audit.js";
|
|
7
7
|
/** Per-workspace overrides for matrix clones (Sprint 17). */
|
|
@@ -86,8 +86,8 @@ export declare const scheduleTaskSchema: z.ZodObject<{
|
|
|
86
86
|
activeDays: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
87
87
|
windowPolicy: z.ZodOptional<z.ZodEnum<{
|
|
88
88
|
skip: "skip";
|
|
89
|
-
run: "run";
|
|
90
89
|
postpone: "postpone";
|
|
90
|
+
run: "run";
|
|
91
91
|
}>>;
|
|
92
92
|
workingDirectory: z.ZodOptional<z.ZodString>;
|
|
93
93
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
@@ -137,8 +137,8 @@ export declare const updateTaskSchema: z.ZodObject<{
|
|
|
137
137
|
activeDays: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
138
138
|
windowPolicy: z.ZodOptional<z.ZodEnum<{
|
|
139
139
|
skip: "skip";
|
|
140
|
-
run: "run";
|
|
141
140
|
postpone: "postpone";
|
|
141
|
+
run: "run";
|
|
142
142
|
}>>;
|
|
143
143
|
runWhenLoggedOff: z.ZodOptional<z.ZodBoolean>;
|
|
144
144
|
watchGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -433,7 +433,7 @@ declare const scheduleTaskExecute: (input: {
|
|
|
433
433
|
gitIgnore?: string[] | undefined;
|
|
434
434
|
gitPollSeconds?: number | undefined;
|
|
435
435
|
activeDays?: number[] | undefined;
|
|
436
|
-
windowPolicy?: "skip" | "
|
|
436
|
+
windowPolicy?: "skip" | "postpone" | "run" | undefined;
|
|
437
437
|
workingDirectory?: string | undefined;
|
|
438
438
|
workspaceId?: string | undefined;
|
|
439
439
|
allowedTools?: string[] | undefined;
|
|
@@ -478,7 +478,7 @@ declare const updateTaskExecute: (input: {
|
|
|
478
478
|
notBefore?: string | undefined;
|
|
479
479
|
notAfter?: string | undefined;
|
|
480
480
|
activeDays?: number[] | undefined;
|
|
481
|
-
windowPolicy?: "skip" | "
|
|
481
|
+
windowPolicy?: "skip" | "postpone" | "run" | undefined;
|
|
482
482
|
runWhenLoggedOff?: boolean | undefined;
|
|
483
483
|
watchGlobs?: string[] | undefined;
|
|
484
484
|
watchIgnore?: string[] | undefined;
|
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,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;
|
|
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,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AA2FlD,OAAO,EAAuC,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA4D5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAkDvD,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB;;;;;;iBAM/B,CAAC;AAEH,sCAAsC;AACtC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;iBAwCvB,CAAC;AAEH,yCAAyC;AACzC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiQ7B,CAAC;AAYH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4L3B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,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
package/dist/index.js
CHANGED
|
@@ -6,14 +6,15 @@ import { existsSync } 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";
|
|
10
|
-
import { parseCron, buildScheduleGate, isValidIanaTimeZone, validateLaunchWindow, prevRun, nextRun as cronNextRun, normalizeActiveDays, activeWindowState, nextWindowOpenDelayMs } from "./core/schedule-v2.js";
|
|
9
|
+
import { LOCK_DIR, LOG_DIR, PLUGIN_DIR, STALE_LOCK_MAX_AGE_MS, WRAPPER_DIR, sanitizeName, validateModelId, validateTaskName, } from "./types.js";
|
|
10
|
+
import { parseCron, buildScheduleGate, isValidIanaTimeZone, validateLaunchWindow, prevRun, nextRun as cronNextRun, normalizeActiveDays, activeWindowState, nextWindowOpenDelayMs, assessCronWindowFeasibility, windowFeasibilityReasonText } 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";
|
|
13
13
|
import { ensureWrapper, writePromptFile, writeWrapperCmd, lockFilePath, requestImmediateRun } from "./core/ps-wrapper.js";
|
|
14
|
-
import { getSchedulerBackend } from "./core/scheduler/index.js";
|
|
14
|
+
import { getSchedulerBackend, LinuxScheduler } from "./core/scheduler/index.js";
|
|
15
15
|
import { SCHEDULER_SKILL_ID, loadSchedulerSkill } from "./skill.js";
|
|
16
16
|
import { getTaskLogs } from "./core/scheduler/logs.js";
|
|
17
|
+
import { findSanitizedNameConflict, sanitizedConflictMessage } from "./core/task-name.js";
|
|
17
18
|
import { writeBashWrapper } from "./core/wrappers/bash.js";
|
|
18
19
|
import { simulatePipeline } from "./core/dry-run.js";
|
|
19
20
|
import { aggregateMatrixResults, cancelPendingMatrixClones, expandMatrixTask, findOrphanedMatrixTasks, getMatrixDeletionGuard, matrixCompleteName, planMatrixFamilyDelete, removeMatrixChildren, runMatrix, syncMatrixFamily, } from "./core/matrix.js";
|
|
@@ -29,6 +30,8 @@ import { buildAnalytics } from "./core/analytics.js";
|
|
|
29
30
|
import { generateSelfAnalysisReport } from "./core/self-analysis.js";
|
|
30
31
|
import { getHistory, listRunningRecords } from "./db/history-repo.js";
|
|
31
32
|
import { getAllMetrics } from "./db/metrics-repo.js";
|
|
33
|
+
import { discardDlq, listDlq, retryDlq } from "./core/dlq-api.js";
|
|
34
|
+
import { listRunPanel, pauseRunPanel, resumeRunPanel, } from "./core/run-panel-api.js";
|
|
32
35
|
import { findStuckMatrixClones, maybeSendDigest, notifyStuckMatrix, sendDigestNow, sendTestNotification, } from "./notifications.js";
|
|
33
36
|
import { shadowReport, resetShadowDecisions, } from "./core/triage-shadow.js";
|
|
34
37
|
import { compareTriage } from "./core/triage-compare.js";
|
|
@@ -67,7 +70,7 @@ const recorderPath = (() => {
|
|
|
67
70
|
.replace(/\.ts$/, ".js");
|
|
68
71
|
if (existsSync(distPath))
|
|
69
72
|
return distPath;
|
|
70
|
-
console.warn("[
|
|
73
|
+
console.warn("[agent-steward] Не найден собранный record-history.js: " +
|
|
71
74
|
`${distPath}. История/метрики не будут записываться. Выполните npm run build.`);
|
|
72
75
|
return distPath;
|
|
73
76
|
})();
|
|
@@ -84,7 +87,7 @@ const gatePath = (() => {
|
|
|
84
87
|
.replace(/\.ts$/, ".js");
|
|
85
88
|
if (existsSync(distPath))
|
|
86
89
|
return distPath;
|
|
87
|
-
console.warn("[
|
|
90
|
+
console.warn("[agent-steward] Не найден собранный schedule-gate.js: " +
|
|
88
91
|
`${distPath}. Гейт расписания не будет проверяться. Выполните npm run build.`);
|
|
89
92
|
return distPath;
|
|
90
93
|
})();
|
|
@@ -1475,12 +1478,25 @@ async function updateTaskFromInput(input) {
|
|
|
1475
1478
|
// после create — иначе задача молча начинает выполняться по расписанию.
|
|
1476
1479
|
const wasPaused = Boolean(previous.paused === true ||
|
|
1477
1480
|
(previous.pausedUntil && Date.parse(previous.pausedUntil) > Date.now()));
|
|
1481
|
+
const nextModel = clearableString(input.model, previous.model);
|
|
1482
|
+
if (nextModel) {
|
|
1483
|
+
const modelError = validateModelId(nextModel);
|
|
1484
|
+
if (modelError) {
|
|
1485
|
+
return {
|
|
1486
|
+
success: false,
|
|
1487
|
+
message: t("tool.error.modelInvalid", {
|
|
1488
|
+
model: nextModel,
|
|
1489
|
+
error: modelError,
|
|
1490
|
+
}),
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1478
1494
|
let previousDeleted = false;
|
|
1479
1495
|
try {
|
|
1480
1496
|
// Обновление = пересоздание в планировщике с сохранением старых значений.
|
|
1481
1497
|
await scheduler.deleteTask(name);
|
|
1482
1498
|
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),
|
|
1499
|
+
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
1500
|
// Если задача была матрицей — синхронизируем клонов, а не
|
|
1485
1501
|
// пересоздаём их с нуля (Спринт 17).
|
|
1486
1502
|
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 +1777,10 @@ async function resumeExpiredPauses() {
|
|
|
1761
1777
|
pausedUntil: undefined,
|
|
1762
1778
|
paused: false,
|
|
1763
1779
|
});
|
|
1764
|
-
console.log(`[
|
|
1780
|
+
console.log(`[agent-steward] Автопродолжение: задача "${definition.name}" включена (пауза истекла).`);
|
|
1765
1781
|
}
|
|
1766
1782
|
catch (err) {
|
|
1767
|
-
console.error(`[
|
|
1783
|
+
console.error(`[agent-steward] Не удалось автопродолжить задачу "${definition.name}": ${err instanceof Error ? err.message : String(err)}`);
|
|
1768
1784
|
}
|
|
1769
1785
|
}
|
|
1770
1786
|
}
|
|
@@ -1882,8 +1898,14 @@ async function refreshWorkspaceEnvFiles(workspaceId) {
|
|
|
1882
1898
|
for (const task of await loadTaskDefinitions()) {
|
|
1883
1899
|
if (task.workspaceId !== workspaceId)
|
|
1884
1900
|
continue;
|
|
1885
|
-
|
|
1886
|
-
|
|
1901
|
+
try {
|
|
1902
|
+
writeWorkspaceEnvFile(workspace, PLUGIN_DIR, sanitizeName(task.name));
|
|
1903
|
+
refreshed += 1;
|
|
1904
|
+
}
|
|
1905
|
+
catch (err) {
|
|
1906
|
+
// P2-21: не разрешаем задаче работать с литералом ${secret:...}.
|
|
1907
|
+
console.error(`[workspace] Задача "${task.name}": env-файл не обновлён — ${err instanceof Error ? err.message : String(err)}`);
|
|
1908
|
+
}
|
|
1887
1909
|
}
|
|
1888
1910
|
return refreshed;
|
|
1889
1911
|
}
|
|
@@ -2452,7 +2474,7 @@ const emitEventExecute = wrapExecute(async (args) => {
|
|
|
2452
2474
|
triggered.push(def.name);
|
|
2453
2475
|
}
|
|
2454
2476
|
catch (err) {
|
|
2455
|
-
console.error(`[
|
|
2477
|
+
console.error(`[agent-steward] emit_event: не удалось запустить ${def.name}:`, err);
|
|
2456
2478
|
}
|
|
2457
2479
|
}
|
|
2458
2480
|
return {
|
|
@@ -2563,6 +2585,18 @@ const RPC_AUDIT_RULES = {
|
|
|
2563
2585
|
targetType: "history",
|
|
2564
2586
|
target: () => "runs",
|
|
2565
2587
|
},
|
|
2588
|
+
retry_dlq: { action: "dlq.retry", targetType: "dlq", target: (i) => i.id ?? "" },
|
|
2589
|
+
discard_dlq: { action: "dlq.discard", targetType: "dlq", target: (i) => i.id ?? "" },
|
|
2590
|
+
pause_durable_run: {
|
|
2591
|
+
action: "run.pause",
|
|
2592
|
+
targetType: "run",
|
|
2593
|
+
target: (i) => i.runId ?? "",
|
|
2594
|
+
},
|
|
2595
|
+
resume_durable_run: {
|
|
2596
|
+
action: "run.resume",
|
|
2597
|
+
targetType: "run",
|
|
2598
|
+
target: (i) => i.runId ?? "",
|
|
2599
|
+
},
|
|
2566
2600
|
emit_event: { action: "event.emit", targetType: "event", target: (i) => i.eventName ?? "" },
|
|
2567
2601
|
add_workspace: {
|
|
2568
2602
|
action: "workspace.add",
|
|
@@ -2621,7 +2655,7 @@ function withRpcAudit(handlers) {
|
|
|
2621
2655
|
const input = args[0] ?? {};
|
|
2622
2656
|
const result = await handler(...args);
|
|
2623
2657
|
try {
|
|
2624
|
-
if (result?.success !== false) {
|
|
2658
|
+
if ((result)?.success !== false) {
|
|
2625
2659
|
recordAudit({
|
|
2626
2660
|
action: rule.action,
|
|
2627
2661
|
targetType: rule.targetType,
|
|
@@ -2661,7 +2695,7 @@ async function refreshTriggers() {
|
|
|
2661
2695
|
await fileWatcherManager.refresh();
|
|
2662
2696
|
}
|
|
2663
2697
|
catch (err) {
|
|
2664
|
-
console.error(`[
|
|
2698
|
+
console.error(`[agent-steward] Не удалось обновить файловые триггеры: ${err instanceof Error ? err.message : String(err)}`);
|
|
2665
2699
|
}
|
|
2666
2700
|
}
|
|
2667
2701
|
if (gitTriggerManager) {
|
|
@@ -2669,7 +2703,7 @@ async function refreshTriggers() {
|
|
|
2669
2703
|
await gitTriggerManager.refresh();
|
|
2670
2704
|
}
|
|
2671
2705
|
catch (err) {
|
|
2672
|
-
console.error(`[
|
|
2706
|
+
console.error(`[agent-steward] Не удалось обновить git-триггеры: ${err instanceof Error ? err.message : String(err)}`);
|
|
2673
2707
|
}
|
|
2674
2708
|
}
|
|
2675
2709
|
}
|
|
@@ -2695,22 +2729,22 @@ async function scheduleEventRun(taskName, reason) {
|
|
|
2695
2729
|
const state = activeWindowState(now, options);
|
|
2696
2730
|
if (state.active || policy === "run") {
|
|
2697
2731
|
await runTaskEntry(taskName);
|
|
2698
|
-
console.log(`[
|
|
2732
|
+
console.log(`[agent-steward] Запуск задачи "${taskName}" (${reason}).`);
|
|
2699
2733
|
return;
|
|
2700
2734
|
}
|
|
2701
2735
|
if (policy === "skip") {
|
|
2702
|
-
console.log(`[
|
|
2736
|
+
console.log(`[agent-steward] Задача "${taskName}" не запущена (${reason}): ${state.reason ?? "вне окна"} — политика skip.`);
|
|
2703
2737
|
return;
|
|
2704
2738
|
}
|
|
2705
2739
|
const delay = nextWindowOpenDelayMs(now, options);
|
|
2706
2740
|
if (delay <= 0 || delay > EVENT_POSTPONE_MAX_MS) {
|
|
2707
|
-
console.log(`[
|
|
2741
|
+
console.log(`[agent-steward] Задача "${taskName}" не запущена (${reason}): ${state.reason ?? "вне окна"} — до открытия окна больше 12 ч.`);
|
|
2708
2742
|
return;
|
|
2709
2743
|
}
|
|
2710
|
-
console.log(`[
|
|
2744
|
+
console.log(`[agent-steward] Задача "${taskName}" (${reason}) отложена на ~${Math.round(delay / 60000)} мин: ${state.reason ?? "вне окна"}.`);
|
|
2711
2745
|
const timer = setTimeout(() => {
|
|
2712
2746
|
void scheduleEventRun(taskName, reason).catch((err) => {
|
|
2713
|
-
console.error(`[
|
|
2747
|
+
console.error(`[agent-steward] Не удалось запустить отложенную задачу "${taskName}": ${err instanceof Error ? err.message : String(err)}`);
|
|
2714
2748
|
});
|
|
2715
2749
|
}, delay);
|
|
2716
2750
|
timer.unref?.();
|
|
@@ -2744,6 +2778,21 @@ export async function createRuntime(ctxLike) {
|
|
|
2744
2778
|
catch (err) {
|
|
2745
2779
|
console.error(`[recovery] Не удалось восстановить незавершённые запуски: ${err instanceof Error ? err.message : String(err)}`);
|
|
2746
2780
|
}
|
|
2781
|
+
// P1-14: pid:-записи fallback'а не переживают перезагрузку. Чистим их и
|
|
2782
|
+
// пересоздаём будущие one-shot, иначе после reboot можно убить чужой pid.
|
|
2783
|
+
if (scheduler instanceof LinuxScheduler) {
|
|
2784
|
+
try {
|
|
2785
|
+
const report = await scheduler.pruneStaleFallbacks();
|
|
2786
|
+
if (report.removed || report.rescheduled || report.missed) {
|
|
2787
|
+
console.log(`[scheduler] Fallback one-shot: удалено ${report.removed}, ` +
|
|
2788
|
+
`пересоздано ${report.rescheduled}, пропущено ${report.missed}, ` +
|
|
2789
|
+
`живо ${report.kept}.`);
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
catch (err) {
|
|
2793
|
+
console.error(`[scheduler] Не удалось очистить fallback-записи: ${err instanceof Error ? err.message : String(err)}`);
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2747
2796
|
checkJsonBackups();
|
|
2748
2797
|
void garbageCollectTaskArtifacts().catch((err) => {
|
|
2749
2798
|
console.log(`[gc] Не удалось вычистить мусорные файлы: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -2764,11 +2813,11 @@ export async function createRuntime(ctxLike) {
|
|
|
2764
2813
|
// Спринт 19: автопродолжение задач, поставленных на паузу до даты.
|
|
2765
2814
|
// Проверяем сразу при старте и далее раз в 5 минут, пока плагин жив.
|
|
2766
2815
|
void resumeExpiredPauses().catch((err) => {
|
|
2767
|
-
console.error(`[
|
|
2816
|
+
console.error(`[agent-steward] Не удалось проверить автопродолжение: ${err instanceof Error ? err.message : String(err)}`);
|
|
2768
2817
|
});
|
|
2769
2818
|
const pausedUntilTimer = setInterval(() => {
|
|
2770
2819
|
void resumeExpiredPauses().catch((err) => {
|
|
2771
|
-
console.error(`[
|
|
2820
|
+
console.error(`[agent-steward] Не удалось проверить автопродолжение: ${err instanceof Error ? err.message : String(err)}`);
|
|
2772
2821
|
});
|
|
2773
2822
|
}, PAUSED_UNTIL_CHECK_MS);
|
|
2774
2823
|
pausedUntilTimer.unref?.();
|
|
@@ -2777,7 +2826,7 @@ export async function createRuntime(ctxLike) {
|
|
|
2777
2826
|
const notificationTimer = setInterval(() => {
|
|
2778
2827
|
void maybeSendDigest().catch(() => undefined);
|
|
2779
2828
|
void checkStuckMatrices().catch((err) => {
|
|
2780
|
-
console.error(`[
|
|
2829
|
+
console.error(`[agent-steward] Детектор зависших матриц: ${err instanceof Error ? err.message : String(err)}`);
|
|
2781
2830
|
});
|
|
2782
2831
|
}, NOTIFICATION_CHECK_MS);
|
|
2783
2832
|
notificationTimer.unref?.();
|
|
@@ -2820,15 +2869,15 @@ export async function createRuntime(ctxLike) {
|
|
|
2820
2869
|
// Запускаем задачу и пишем в лог.
|
|
2821
2870
|
try {
|
|
2822
2871
|
await runTaskEntry(def.name);
|
|
2823
|
-
console.log(`[
|
|
2872
|
+
console.log(`[agent-steward] Запущено восстановление пропущенной задачи "${def.name}" (последний срабатывал ~${Math.round(ageMs / 1000)} с назад).`);
|
|
2824
2873
|
}
|
|
2825
2874
|
catch (err) {
|
|
2826
|
-
console.error(`[
|
|
2875
|
+
console.error(`[agent-steward] Не удалось восстановить задачу "${def.name}": ${err instanceof Error ? err.message : String(err)}`);
|
|
2827
2876
|
}
|
|
2828
2877
|
}
|
|
2829
2878
|
}
|
|
2830
2879
|
catch (err) {
|
|
2831
|
-
console.error(`[
|
|
2880
|
+
console.error(`[agent-steward] Catch-up ошибка: ${err instanceof Error ? err.message : String(err)}`);
|
|
2832
2881
|
}
|
|
2833
2882
|
})();
|
|
2834
2883
|
// Файловые триггеры (File Watchers): задачи с triggerType === "file"
|
|
@@ -2838,7 +2887,7 @@ export async function createRuntime(ctxLike) {
|
|
|
2838
2887
|
await scheduleEventRun(taskName, "изменение отслеживаемого файла");
|
|
2839
2888
|
}
|
|
2840
2889
|
catch (err) {
|
|
2841
|
-
console.error(`[
|
|
2890
|
+
console.error(`[agent-steward] Не удалось запустить задачу "${taskName}" по файловому триггеру: ${err instanceof Error ? err.message : String(err)}`);
|
|
2842
2891
|
}
|
|
2843
2892
|
});
|
|
2844
2893
|
// Спринт 27: git-триггеры — опрос HEAD и запуск при новых коммитах,
|
|
@@ -2848,7 +2897,7 @@ export async function createRuntime(ctxLike) {
|
|
|
2848
2897
|
await scheduleEventRun(taskName, `новый коммит ${info.head?.slice(0, 7) ?? ""}`);
|
|
2849
2898
|
}
|
|
2850
2899
|
catch (err) {
|
|
2851
|
-
console.error(`[
|
|
2900
|
+
console.error(`[agent-steward] Не удалось запустить задачу "${taskName}" по git-триггеру: ${err instanceof Error ? err.message : String(err)}`);
|
|
2852
2901
|
}
|
|
2853
2902
|
});
|
|
2854
2903
|
void refreshTriggers();
|
|
@@ -2914,7 +2963,7 @@ export function createShutdownHandler(runtime, registrations = [], options = {})
|
|
|
2914
2963
|
await registration.dispose();
|
|
2915
2964
|
}
|
|
2916
2965
|
catch (err) {
|
|
2917
|
-
console.warn(`[
|
|
2966
|
+
console.warn(`[agent-steward] Выгрузка: ошибка освобождения регистрации — ${err instanceof Error ? err.message : String(err)}`);
|
|
2918
2967
|
}
|
|
2919
2968
|
}
|
|
2920
2969
|
runtime.dispose();
|
|
@@ -2923,7 +2972,7 @@ export function createShutdownHandler(runtime, registrations = [], options = {})
|
|
|
2923
2972
|
await closeDashboardServer();
|
|
2924
2973
|
const wait = await shutdownGate.waitForIdle(waitMs);
|
|
2925
2974
|
if (wait.timedOut) {
|
|
2926
|
-
console.warn(`[
|
|
2975
|
+
console.warn(`[agent-steward] Выгрузка: ${wait.remaining} запуск(ов) не завершились за ${waitMs} мс — закрываем БД.`);
|
|
2927
2976
|
}
|
|
2928
2977
|
// Чекпойнт WAL выполняется в closeDb.
|
|
2929
2978
|
closeDb();
|
|
@@ -3176,7 +3225,7 @@ async function startSchedulerDashboard() {
|
|
|
3176
3225
|
cleanupMatrixOrphans: () => cleanupOrphanedMatrixTasks(),
|
|
3177
3226
|
});
|
|
3178
3227
|
if (dashboard) {
|
|
3179
|
-
console.log(`[
|
|
3228
|
+
console.log(`[agent-steward] Открыть дашборд в браузере: http://localhost:${dashboard.port}`);
|
|
3180
3229
|
}
|
|
3181
3230
|
}
|
|
3182
3231
|
const v2Plugin = Plugin.define({
|
|
@@ -3221,7 +3270,7 @@ const v2Plugin = Plugin.define({
|
|
|
3221
3270
|
}
|
|
3222
3271
|
}
|
|
3223
3272
|
catch (err) {
|
|
3224
|
-
console.error(`[
|
|
3273
|
+
console.error(`[agent-steward] Не удалось зарегистрировать скилл "${SCHEDULER_SKILL_ID}": ${err instanceof Error ? err.message : String(err)}`);
|
|
3225
3274
|
}
|
|
3226
3275
|
// Регистрируем RPC-методы, вызываемые из GUI-панели.
|
|
3227
3276
|
// Общая логика создания задачи вынесена в schedulerCreateTask, чтобы
|
|
@@ -3236,7 +3285,7 @@ const v2Plugin = Plugin.define({
|
|
|
3236
3285
|
};
|
|
3237
3286
|
},
|
|
3238
3287
|
create_task: async (input) => {
|
|
3239
|
-
console.log("[
|
|
3288
|
+
console.log("[agent-steward] create_task input:", input);
|
|
3240
3289
|
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
3290
|
let effectiveRunAt;
|
|
3242
3291
|
if (triggerType === "once") {
|
|
@@ -3405,10 +3454,10 @@ const v2Plugin = Plugin.define({
|
|
|
3405
3454
|
try {
|
|
3406
3455
|
await runTaskEntry(def.name);
|
|
3407
3456
|
triggered.push(def.name);
|
|
3408
|
-
console.log(`[
|
|
3457
|
+
console.log(`[agent-steward] Запуск задачи "${def.name}" по MCP-событию "${normalized}".`);
|
|
3409
3458
|
}
|
|
3410
3459
|
catch (err) {
|
|
3411
|
-
console.error(`[
|
|
3460
|
+
console.error(`[agent-steward] Не удалось запустить "${def.name}" по событию "${normalized}": ${err instanceof Error ? err.message : String(err)}`);
|
|
3412
3461
|
}
|
|
3413
3462
|
}
|
|
3414
3463
|
return {
|
|
@@ -3957,12 +4006,48 @@ const v2Plugin = Plugin.define({
|
|
|
3957
4006
|
});
|
|
3958
4007
|
return { success: true, ...result };
|
|
3959
4008
|
},
|
|
4009
|
+
list_dlq: async (input) => {
|
|
4010
|
+
const source = (input ?? {});
|
|
4011
|
+
return listDlq({ status: source.status, limit: source.limit });
|
|
4012
|
+
},
|
|
4013
|
+
retry_dlq: async (input) => {
|
|
4014
|
+
const source = (input ?? {});
|
|
4015
|
+
if (!source.id)
|
|
4016
|
+
return { success: false, error: "id is required" };
|
|
4017
|
+
return retryDlq(source.id);
|
|
4018
|
+
},
|
|
4019
|
+
discard_dlq: async (input) => {
|
|
4020
|
+
const source = (input ?? {});
|
|
4021
|
+
if (!source.id)
|
|
4022
|
+
return { success: false, error: "id is required" };
|
|
4023
|
+
return discardDlq(source.id, source.resolution);
|
|
4024
|
+
},
|
|
4025
|
+
list_durable_runs: async (input) => {
|
|
4026
|
+
const source = (input ?? {});
|
|
4027
|
+
return listRunPanel({ filter: source.filter, limit: source.limit });
|
|
4028
|
+
},
|
|
4029
|
+
pause_durable_run: async (input) => {
|
|
4030
|
+
const source = (input ?? {});
|
|
4031
|
+
if (!source.runId)
|
|
4032
|
+
return { success: false, error: "runId is required" };
|
|
4033
|
+
return pauseRunPanel(source.runId, {
|
|
4034
|
+
stepName: source.stepName,
|
|
4035
|
+
comment: source.comment,
|
|
4036
|
+
author: source.author,
|
|
4037
|
+
});
|
|
4038
|
+
},
|
|
4039
|
+
resume_durable_run: async (input) => {
|
|
4040
|
+
const source = (input ?? {});
|
|
4041
|
+
if (!source.runId)
|
|
4042
|
+
return { success: false, error: "runId is required" };
|
|
4043
|
+
return resumeRunPanel(source.runId);
|
|
4044
|
+
},
|
|
3960
4045
|
get_templates: async () => {
|
|
3961
4046
|
try {
|
|
3962
4047
|
return { templates: await loadTemplates() };
|
|
3963
4048
|
}
|
|
3964
4049
|
catch (err) {
|
|
3965
|
-
console.error("[
|
|
4050
|
+
console.error("[agent-steward] get_templates error:", err);
|
|
3966
4051
|
return { templates: [] };
|
|
3967
4052
|
}
|
|
3968
4053
|
},
|
|
@@ -4201,8 +4286,19 @@ function resolveMatrixExtraConfig(name, matrix, ids) {
|
|
|
4201
4286
|
"afterScript",
|
|
4202
4287
|
]) {
|
|
4203
4288
|
const raw = value[field];
|
|
4204
|
-
if (typeof raw === "string" && raw.trim())
|
|
4205
|
-
|
|
4289
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
4290
|
+
const trimmed = raw.trim();
|
|
4291
|
+
if (field === "model") {
|
|
4292
|
+
const modelError = validateModelId(trimmed);
|
|
4293
|
+
if (modelError) {
|
|
4294
|
+
throw new Error(t("tool.error.modelInvalid", {
|
|
4295
|
+
model: trimmed,
|
|
4296
|
+
error: modelError,
|
|
4297
|
+
}));
|
|
4298
|
+
}
|
|
4299
|
+
}
|
|
4300
|
+
override[field] = trimmed;
|
|
4301
|
+
}
|
|
4206
4302
|
}
|
|
4207
4303
|
if (Object.keys(override).length > 0)
|
|
4208
4304
|
overrides[workspaceKey] = override;
|
|
@@ -4273,7 +4369,22 @@ legacyShell) {
|
|
|
4273
4369
|
// Для отката файлов: при обновлении существующей задачи файлы переиспользуются,
|
|
4274
4370
|
// удалять их при сбое нельзя — в БД остаётся прежнее определение.
|
|
4275
4371
|
const definitionExisted = Boolean(getTask(normalizedName));
|
|
4372
|
+
// P1-10: при создании проверяем, что sanitized-имя не занято другой задачей
|
|
4373
|
+
// или её оставшимися файлами. Иначе «my task» и «my-task» делят
|
|
4374
|
+
// wrapper/prompt/lock/log, а вторая задача перезаписывает первую.
|
|
4375
|
+
if (!definitionExisted) {
|
|
4376
|
+
const conflict = findSanitizedNameConflict(normalizedName, listTaskDefinitions().map((def) => def.name));
|
|
4377
|
+
if (conflict) {
|
|
4378
|
+
throw new Error(sanitizedConflictMessage(normalizedName, conflict));
|
|
4379
|
+
}
|
|
4380
|
+
}
|
|
4276
4381
|
const normalizedModel = model?.trim() || undefined;
|
|
4382
|
+
if (normalizedModel) {
|
|
4383
|
+
const modelError = validateModelId(normalizedModel);
|
|
4384
|
+
if (modelError) {
|
|
4385
|
+
throw new Error(t("tool.error.modelInvalid", { model: normalizedModel, error: modelError }));
|
|
4386
|
+
}
|
|
4387
|
+
}
|
|
4277
4388
|
const normalizedPriority = normalizePriority(priority);
|
|
4278
4389
|
const normalizedBefore = beforeScript?.trim() || undefined;
|
|
4279
4390
|
const normalizedAfter = afterScript?.trim() || undefined;
|
|
@@ -4309,7 +4420,7 @@ legacyShell) {
|
|
|
4309
4420
|
triggerExtras.gitPollSeconds >= 5
|
|
4310
4421
|
? Math.floor(triggerExtras.gitPollSeconds)
|
|
4311
4422
|
: undefined;
|
|
4312
|
-
const normalizedMcpEvent = mcpEvent
|
|
4423
|
+
const normalizedMcpEvent = mcpEvent?.event?.trim()
|
|
4313
4424
|
? {
|
|
4314
4425
|
server: mcpEvent.server?.trim() || "",
|
|
4315
4426
|
event: mcpEvent.event.trim(),
|
|
@@ -4463,6 +4574,23 @@ legacyShell) {
|
|
|
4463
4574
|
if (windowError) {
|
|
4464
4575
|
throw new Error(t("tool.error.window", { task: name, error: windowError }));
|
|
4465
4576
|
}
|
|
4577
|
+
// P2-24: cron может быть валидным, но никогда не попадать в окно запуска
|
|
4578
|
+
// (например, daily 09:00 при окне 22:00–06:00). Предупреждаем сразу при
|
|
4579
|
+
// создании: иначе задача молча не выполняется из-за лимита переноса 12 ч.
|
|
4580
|
+
if (normalizedNotBefore || normalizedNotAfter || normalizedActiveDays) {
|
|
4581
|
+
const feasibility = assessCronWindowFeasibility(schedule, {
|
|
4582
|
+
notBefore: normalizedNotBefore,
|
|
4583
|
+
notAfter: normalizedNotAfter,
|
|
4584
|
+
days: normalizedActiveDays,
|
|
4585
|
+
timeZone: normalizedTz || undefined,
|
|
4586
|
+
}, normalizedWindowPolicy);
|
|
4587
|
+
if (!feasibility.feasible) {
|
|
4588
|
+
console.warn(`[scheduler] Задача "${name}": ${t("dryRun.window.unreachable", {
|
|
4589
|
+
cron: schedule,
|
|
4590
|
+
reason: windowFeasibilityReasonText(feasibility.reason),
|
|
4591
|
+
})}`);
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
4466
4594
|
}
|
|
4467
4595
|
// Спринт 27: окно и дни недели применимы и к событийным триггерам
|
|
4468
4596
|
// (file/git/mcp-event/once) — проверяем корректность до создания задачи.
|
|
@@ -4658,7 +4786,7 @@ legacyShell) {
|
|
|
4658
4786
|
if (!listedTasks && verifyQueryError) {
|
|
4659
4787
|
// Список получить не удалось — не удаляем возможно созданную задачу,
|
|
4660
4788
|
// но явно предупреждаем: проверка наличия не выполнена.
|
|
4661
|
-
console.warn(`[
|
|
4789
|
+
console.warn(`[agent-steward] Задача "${name}" создана, но проверить её в планировщике не удалось: ${verifyQueryError instanceof Error ? verifyQueryError.message : String(verifyQueryError)}`);
|
|
4662
4790
|
}
|
|
4663
4791
|
// Сохраняем определение задачи для последующего экспорта/импорта.
|
|
4664
4792
|
// Определение до перезаписи: нужно и для очереди матрицы, и для счётчика сессии.
|
|
@@ -4868,7 +4996,7 @@ legacyShell) {
|
|
|
4868
4996
|
await scheduler.pauseTask(target);
|
|
4869
4997
|
}
|
|
4870
4998
|
catch (err) {
|
|
4871
|
-
console.warn(`[
|
|
4999
|
+
console.warn(`[agent-steward] Задача "${target}": пауза не восстановлена после пересоздания: ${err instanceof Error ? err.message : String(err)}`);
|
|
4872
5000
|
}
|
|
4873
5001
|
}
|
|
4874
5002
|
}
|