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/src/core/session.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import { runOpencode } from "./opencode-cli.js";
|
|
5
5
|
import { getTask, saveTask } from "../db/tasks-repo.js";
|
|
6
6
|
import { appendStructuredLog } from "./structured-log.js";
|
|
7
7
|
import { WRAPPER_DIR, sanitizeName } from "../types.js";
|
|
@@ -67,7 +67,7 @@ export function preservedSessionRunCount(
|
|
|
67
67
|
| { session?: SessionMode; sessionId?: string; sessionRunCount?: number }
|
|
68
68
|
| undefined,
|
|
69
69
|
session: SessionMode,
|
|
70
|
-
sessionId: string | undefined
|
|
70
|
+
sessionId: string | undefined,
|
|
71
71
|
): number {
|
|
72
72
|
if (!previous) return 0;
|
|
73
73
|
if (previous.session !== session || previous.sessionId !== sessionId) return 0;
|
|
@@ -86,7 +86,7 @@ export function sessionStatePath(taskName: string): string {
|
|
|
86
86
|
*/
|
|
87
87
|
export async function writeSessionStateFile(
|
|
88
88
|
taskName: string,
|
|
89
|
-
sessionId: string | undefined
|
|
89
|
+
sessionId: string | undefined,
|
|
90
90
|
): Promise<void> {
|
|
91
91
|
try {
|
|
92
92
|
const file = sessionStatePath(taskName);
|
|
@@ -99,7 +99,7 @@ export async function writeSessionStateFile(
|
|
|
99
99
|
} catch (error) {
|
|
100
100
|
console.warn(
|
|
101
101
|
`[session] Не удалось обновить файл сессии задачи "${taskName}":`,
|
|
102
|
-
error
|
|
102
|
+
error,
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -119,16 +119,29 @@ export async function rotateSessionIfNeeded(taskName: string): Promise<void> {
|
|
|
119
119
|
const count = (def.sessionRunCount ?? 0) + 1;
|
|
120
120
|
|
|
121
121
|
if (shouldRotateSession(count, maxRuns)) {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
const oldSessionId = def.sessionId;
|
|
123
|
+
const hasOldSession = Boolean(oldSessionId && isValidSessionId(oldSessionId));
|
|
124
|
+
let deleteError: string | undefined;
|
|
125
|
+
|
|
126
|
+
if (hasOldSession && oldSessionId) {
|
|
127
|
+
// На Windows `opencode` — это `opencode.cmd`, который Node не запускает
|
|
128
|
+
// напрямую через execFile (ENOENT/EINVAL). Общий модуль сам выбирает
|
|
129
|
+
// cmd.exe на Windows, поэтому удаление действительно выполняется.
|
|
130
|
+
const result = await runOpencode(["session", "delete", oldSessionId]);
|
|
131
|
+
if (!result.ok) {
|
|
132
|
+
deleteError = result.error ?? "неизвестная ошибка";
|
|
133
|
+
console.warn(
|
|
134
|
+
`[session] Не удалось удалить сессию ${oldSessionId} задачи "${taskName}": ${deleteError}`,
|
|
135
|
+
);
|
|
130
136
|
}
|
|
131
137
|
}
|
|
138
|
+
|
|
139
|
+
const rotationNote = !hasOldSession
|
|
140
|
+
? "старой сессии не было"
|
|
141
|
+
: deleteError
|
|
142
|
+
? `старую сессию удалить не удалось (${deleteError})`
|
|
143
|
+
: "сессия удалена";
|
|
144
|
+
|
|
132
145
|
const newSessionId = generateSessionId();
|
|
133
146
|
await saveTask({
|
|
134
147
|
...def,
|
|
@@ -139,7 +152,7 @@ export async function rotateSessionIfNeeded(taskName: string): Promise<void> {
|
|
|
139
152
|
appendStructuredLog({
|
|
140
153
|
event: "session.rotated",
|
|
141
154
|
task: taskName,
|
|
142
|
-
reason: `maxRuns=${maxRuns} достигнут;
|
|
155
|
+
reason: `maxRuns=${maxRuns} достигнут; ${rotationNote}, создана новая, счётчик сброшен`,
|
|
143
156
|
});
|
|
144
157
|
} else {
|
|
145
158
|
await saveTask({ ...def, sessionRunCount: count });
|
|
@@ -79,7 +79,7 @@ export const STRUCTURED_LOG_MAX_BYTES = 10 * 1024 * 1024;
|
|
|
79
79
|
function warn(message: string, err: unknown): void {
|
|
80
80
|
try {
|
|
81
81
|
console.warn(
|
|
82
|
-
`[structured-log] ${message}: ${err instanceof Error ? err.message : String(err)}
|
|
82
|
+
`[structured-log] ${message}: ${err instanceof Error ? err.message : String(err)}`,
|
|
83
83
|
);
|
|
84
84
|
} catch {
|
|
85
85
|
// console может быть недоступен в урезанном окружении — молча игнорируем.
|
|
@@ -112,7 +112,7 @@ function rotateIfNeeded(): void {
|
|
|
112
112
|
* Не бросает исключений.
|
|
113
113
|
*/
|
|
114
114
|
export function appendStructuredLog(
|
|
115
|
-
record: Omit<StructuredLogRecord, "ts"> & { ts?: string }
|
|
115
|
+
record: Omit<StructuredLogRecord, "ts"> & { ts?: string },
|
|
116
116
|
): boolean {
|
|
117
117
|
try {
|
|
118
118
|
ensureLogDir();
|
|
@@ -156,7 +156,7 @@ function readLines(file: string): string[] {
|
|
|
156
156
|
* `total` считается до применения limit, чтобы клиент знал полный объём.
|
|
157
157
|
*/
|
|
158
158
|
export function readStructuredLogs(
|
|
159
|
-
filter: ReadStructuredLogsFilter = {}
|
|
159
|
+
filter: ReadStructuredLogsFilter = {},
|
|
160
160
|
): ReadStructuredLogsResult {
|
|
161
161
|
const limit = Math.max(1, Math.min(5000, Math.floor(filter.limit ?? 200) || 200));
|
|
162
162
|
const task = filter.task?.trim().toLowerCase();
|
package/src/core/summary.ts
CHANGED
|
@@ -62,7 +62,7 @@ class SummaryParseFailure extends Error {
|
|
|
62
62
|
| "invalid-json"
|
|
63
63
|
| "invalid-schema"
|
|
64
64
|
| "invalid-response",
|
|
65
|
-
message: string
|
|
65
|
+
message: string,
|
|
66
66
|
) {
|
|
67
67
|
super(message);
|
|
68
68
|
}
|
|
@@ -77,13 +77,13 @@ function resolveEndpoint(baseUrl: string): {
|
|
|
77
77
|
protocol: "ollama" | "openai";
|
|
78
78
|
} {
|
|
79
79
|
const base = baseUrl.replace(/\/+$/, "");
|
|
80
|
-
if (
|
|
80
|
+
if (base.endsWith("/v1")) {
|
|
81
81
|
return { url: `${base}/chat/completions`, protocol: "openai" };
|
|
82
82
|
}
|
|
83
83
|
return { url: `${base}/api/chat`, protocol: "ollama" };
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function buildMessages(input: SummaryInput):
|
|
86
|
+
function buildMessages(input: SummaryInput): { role: string; content: string }[] {
|
|
87
87
|
const payload = {
|
|
88
88
|
task: input.taskName,
|
|
89
89
|
status: input.status,
|
|
@@ -181,7 +181,7 @@ function formatDuration(ms: number): string {
|
|
|
181
181
|
export function truncateSummary(
|
|
182
182
|
input: SummaryInput,
|
|
183
183
|
maxLines: number,
|
|
184
|
-
maxChars: number
|
|
184
|
+
maxChars: number,
|
|
185
185
|
): string[] {
|
|
186
186
|
const lines: string[] = [];
|
|
187
187
|
lines.push(`${input.taskName}: ${input.status}`.slice(0, maxChars));
|
|
@@ -218,7 +218,7 @@ export async function summarizeNotification(
|
|
|
218
218
|
input: SummaryInput,
|
|
219
219
|
settings: NotificationSummarySettings,
|
|
220
220
|
provider: SummaryProvider,
|
|
221
|
-
options: { timeoutMs?: number } = {}
|
|
221
|
+
options: { timeoutMs?: number } = {},
|
|
222
222
|
): Promise<SummaryResult> {
|
|
223
223
|
const startedAt = Date.now();
|
|
224
224
|
const maxLines = settings.maxLines || 3;
|
|
@@ -250,26 +250,26 @@ export async function summarizeNotification(
|
|
|
250
250
|
const body =
|
|
251
251
|
protocol === "openai"
|
|
252
252
|
? {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
},
|
|
253
|
+
model,
|
|
254
|
+
messages,
|
|
255
|
+
temperature: 0,
|
|
256
|
+
stream: false,
|
|
257
|
+
response_format: {
|
|
258
|
+
type: "json_schema",
|
|
259
|
+
json_schema: {
|
|
260
|
+
name: "notification_summary",
|
|
261
|
+
strict: true,
|
|
262
|
+
schema: SUMMARY_SCHEMA,
|
|
264
263
|
},
|
|
265
|
-
}
|
|
264
|
+
},
|
|
265
|
+
}
|
|
266
266
|
: {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
267
|
+
model,
|
|
268
|
+
messages,
|
|
269
|
+
stream: false,
|
|
270
|
+
format: SUMMARY_SCHEMA,
|
|
271
|
+
options: { temperature: 0 },
|
|
272
|
+
};
|
|
273
273
|
|
|
274
274
|
const response = await fetch(url, {
|
|
275
275
|
method: "POST",
|
|
@@ -291,7 +291,7 @@ export async function summarizeNotification(
|
|
|
291
291
|
const lines = parseSummary(
|
|
292
292
|
contentFromBody(parsed, protocol),
|
|
293
293
|
maxLines,
|
|
294
|
-
maxChars
|
|
294
|
+
maxChars,
|
|
295
295
|
);
|
|
296
296
|
clearTimeout(timer);
|
|
297
297
|
return {
|
|
@@ -312,7 +312,7 @@ export async function summarizeNotification(
|
|
|
312
312
|
|
|
313
313
|
/** Провайдер из настроек триажа: baseUrl/model используются те же. */
|
|
314
314
|
export function summaryProviderFromTriage(
|
|
315
|
-
triage: TriageSettings | undefined
|
|
315
|
+
triage: TriageSettings | undefined,
|
|
316
316
|
): SummaryProvider {
|
|
317
317
|
return { baseUrl: triage?.baseUrl, model: triage?.model };
|
|
318
318
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { PLUGIN_DIR, WRAPPER_DIR, sanitizeName } from "../types.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* P1-10: разные имена задач могут сжаться в один sanitized-идентификатор
|
|
7
|
+
* («my task» и «my-task» → «my-task»), после чего делят wrapper, prompt,
|
|
8
|
+
* lock и log. При создании новой задачи такую коллизию нужно отклонить,
|
|
9
|
+
* иначе вторая задача молча перезапишет файлы первой.
|
|
10
|
+
*/
|
|
11
|
+
export type SanitizedConflict =
|
|
12
|
+
| { kind: "task"; taskName: string }
|
|
13
|
+
| { kind: "file"; file: string };
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Ищет конфликт sanitized-имени среди существующих задач и их артефактов.
|
|
17
|
+
*
|
|
18
|
+
* @param name имя создаваемой задачи;
|
|
19
|
+
* @param existingNames имена уже существующих задач (без самой создаваемой);
|
|
20
|
+
* @param artifactExists проверка существования файла — подменяется в тестах.
|
|
21
|
+
*/
|
|
22
|
+
export function findSanitizedNameConflict(
|
|
23
|
+
name: string,
|
|
24
|
+
existingNames: readonly string[],
|
|
25
|
+
artifactExists: (file: string) => boolean = existsSync,
|
|
26
|
+
): SanitizedConflict | null {
|
|
27
|
+
const sanitized = sanitizeName(name);
|
|
28
|
+
const self = name.toLowerCase();
|
|
29
|
+
|
|
30
|
+
const dbConflict = existingNames.find(
|
|
31
|
+
(existing) =>
|
|
32
|
+
existing.toLowerCase() !== self && sanitizeName(existing) === sanitized,
|
|
33
|
+
);
|
|
34
|
+
if (dbConflict) {
|
|
35
|
+
return { kind: "task", taskName: dbConflict };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Осиротевшие артефакты: в БД задачи уже нет, но файлы остались.
|
|
39
|
+
// Перезапись промпта/обёртки молча сломала бы такую задачу.
|
|
40
|
+
const artifacts = [
|
|
41
|
+
path.join(WRAPPER_DIR, `run-${sanitized}.cmd`),
|
|
42
|
+
path.join(WRAPPER_DIR, `run-${sanitized}.sh`),
|
|
43
|
+
path.join(PLUGIN_DIR, "prompts", `${sanitized}.txt`),
|
|
44
|
+
];
|
|
45
|
+
const orphan = artifacts.find((file) => artifactExists(file));
|
|
46
|
+
if (orphan) {
|
|
47
|
+
return { kind: "file", file: orphan };
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Человекочитаемое объяснение конфликта для ошибки создания задачи. */
|
|
53
|
+
export function sanitizedConflictMessage(
|
|
54
|
+
name: string,
|
|
55
|
+
conflict: SanitizedConflict,
|
|
56
|
+
): string {
|
|
57
|
+
const sanitized = sanitizeName(name);
|
|
58
|
+
const reason =
|
|
59
|
+
conflict.kind === "task"
|
|
60
|
+
? `существующая задача «${conflict.taskName}»`
|
|
61
|
+
: `оставшиеся файлы задачи (${conflict.file})`;
|
|
62
|
+
return (
|
|
63
|
+
`Имя задачи «${name}» приводит к тому же имени файла «${sanitized}», ` +
|
|
64
|
+
`что и ${reason}. Выберите другое имя` +
|
|
65
|
+
(conflict.kind === "file" ? " или удалите старые файлы." : ".")
|
|
66
|
+
);
|
|
67
|
+
}
|
package/src/core/telegram.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface TelegramSendOptions {
|
|
|
34
34
|
/** Экранирует текст под выбранный parse_mode. */
|
|
35
35
|
export function escapeTelegramText(
|
|
36
36
|
text: string,
|
|
37
|
-
parseMode: TelegramParseMode = ""
|
|
37
|
+
parseMode: TelegramParseMode = "",
|
|
38
38
|
): string {
|
|
39
39
|
const value = String(text ?? "");
|
|
40
40
|
if (parseMode === "HTML") {
|
|
@@ -69,7 +69,7 @@ function escapeHtmlAttribute(url: string): string {
|
|
|
69
69
|
export function formatTelegramText(
|
|
70
70
|
text: string,
|
|
71
71
|
parseMode: TelegramParseMode = "",
|
|
72
|
-
dashboardUrl?: string | null
|
|
72
|
+
dashboardUrl?: string | null,
|
|
73
73
|
): string {
|
|
74
74
|
const body = escapeTelegramText(text, parseMode);
|
|
75
75
|
const url = (dashboardUrl ?? "").trim();
|
|
@@ -148,7 +148,7 @@ const TELEGRAM_MAX_RETRIES = 3;
|
|
|
148
148
|
*/
|
|
149
149
|
export function splitTelegramMessage(
|
|
150
150
|
text: string,
|
|
151
|
-
limit = TELEGRAM_MAX_MESSAGE_LENGTH
|
|
151
|
+
limit = TELEGRAM_MAX_MESSAGE_LENGTH,
|
|
152
152
|
): string[] {
|
|
153
153
|
const value = String(text ?? "");
|
|
154
154
|
const max = Math.max(1, Math.floor(limit));
|
|
@@ -213,13 +213,13 @@ function cutRawChunk(
|
|
|
213
213
|
text: string,
|
|
214
214
|
start: number,
|
|
215
215
|
maxFormatted: number,
|
|
216
|
-
parseMode: TelegramParseMode
|
|
216
|
+
parseMode: TelegramParseMode,
|
|
217
217
|
): number {
|
|
218
218
|
let index = start;
|
|
219
219
|
let used = 0;
|
|
220
220
|
let lastNewline = -1;
|
|
221
221
|
while (index < text.length) {
|
|
222
|
-
const codePoint = text.codePointAt(index)
|
|
222
|
+
const codePoint = text.codePointAt(index)!;
|
|
223
223
|
const ch = String.fromCodePoint(codePoint);
|
|
224
224
|
const cost = escapedCharLength(ch, parseMode);
|
|
225
225
|
if (used + cost > maxFormatted) break;
|
|
@@ -233,7 +233,7 @@ function cutRawChunk(
|
|
|
233
233
|
}
|
|
234
234
|
if (index <= start) {
|
|
235
235
|
// Гарантируем прогресс хотя бы на один code point.
|
|
236
|
-
const codePoint = text.codePointAt(start)
|
|
236
|
+
const codePoint = text.codePointAt(start)!;
|
|
237
237
|
index = start + String.fromCodePoint(codePoint).length;
|
|
238
238
|
}
|
|
239
239
|
return index;
|
|
@@ -250,7 +250,7 @@ function splitRawMessageForSend(
|
|
|
250
250
|
text: string,
|
|
251
251
|
limit: number,
|
|
252
252
|
parseMode: TelegramParseMode,
|
|
253
|
-
linkReserve = 0
|
|
253
|
+
linkReserve = 0,
|
|
254
254
|
): string[] {
|
|
255
255
|
const value = String(text ?? "");
|
|
256
256
|
const max = Math.max(1, Math.floor(limit));
|
|
@@ -303,7 +303,7 @@ export async function sendTelegramMessage(
|
|
|
303
303
|
token: string,
|
|
304
304
|
chatId: string,
|
|
305
305
|
text: string,
|
|
306
|
-
options: TelegramSendOptions = {}
|
|
306
|
+
options: TelegramSendOptions = {},
|
|
307
307
|
): Promise<void> {
|
|
308
308
|
const safeToken = validateTelegramToken(token);
|
|
309
309
|
const target = (chatId ?? "").trim();
|
|
@@ -324,12 +324,12 @@ export async function sendTelegramMessage(
|
|
|
324
324
|
text,
|
|
325
325
|
TELEGRAM_MAX_MESSAGE_LENGTH,
|
|
326
326
|
parseMode,
|
|
327
|
-
linkSuffix.length
|
|
327
|
+
linkSuffix.length,
|
|
328
328
|
);
|
|
329
329
|
|
|
330
330
|
const timeoutMs = Math.max(
|
|
331
331
|
1_000,
|
|
332
|
-
Math.floor(options.timeoutMs ?? DEFAULT_TIMEOUT_MS)
|
|
332
|
+
Math.floor(options.timeoutMs ?? DEFAULT_TIMEOUT_MS),
|
|
333
333
|
);
|
|
334
334
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
335
335
|
const url = `${apiBase}/bot${safeToken}/sendMessage`;
|
|
@@ -341,7 +341,7 @@ export async function sendTelegramMessage(
|
|
|
341
341
|
const chunk = formatTelegramText(
|
|
342
342
|
rawChunks[chunkIndex],
|
|
343
343
|
parseMode,
|
|
344
|
-
isLastChunk ? dashboardUrl : null
|
|
344
|
+
isLastChunk ? dashboardUrl : null,
|
|
345
345
|
);
|
|
346
346
|
let parseModeForChunk = parseMode;
|
|
347
347
|
let downgradedParseMode = false;
|
|
@@ -398,14 +398,14 @@ export async function sendTelegramMessage(
|
|
|
398
398
|
parseModeForChunk &&
|
|
399
399
|
!downgradedParseMode &&
|
|
400
400
|
/parse entities|can't parse|unsupported start tag|can't find end/i.test(
|
|
401
|
-
description
|
|
401
|
+
description,
|
|
402
402
|
)
|
|
403
403
|
) {
|
|
404
404
|
console.warn(
|
|
405
405
|
`[notify] Telegram отклонил разметку (${sanitizeErrorText(
|
|
406
406
|
description,
|
|
407
|
-
safeToken
|
|
408
|
-
)}) — чанк повторно отправлен без parse_mode. Проверьте шаблоны
|
|
407
|
+
safeToken,
|
|
408
|
+
)}) — чанк повторно отправлен без parse_mode. Проверьте шаблоны уведомлений.`,
|
|
409
409
|
);
|
|
410
410
|
downgradedParseMode = true;
|
|
411
411
|
parseModeForChunk = "";
|
|
@@ -414,7 +414,7 @@ export async function sendTelegramMessage(
|
|
|
414
414
|
|
|
415
415
|
if (!response.ok || parsed?.ok === false) {
|
|
416
416
|
throw new Error(
|
|
417
|
-
`Telegram API: ${sanitizeErrorText(description, safeToken)}
|
|
417
|
+
`Telegram API: ${sanitizeErrorText(description, safeToken)}`,
|
|
418
418
|
);
|
|
419
419
|
}
|
|
420
420
|
break;
|
|
@@ -423,7 +423,7 @@ export async function sendTelegramMessage(
|
|
|
423
423
|
throw new Error(
|
|
424
424
|
t("notify.error.telegramTimeout", {
|
|
425
425
|
seconds: Math.floor(timeoutMs / 1000),
|
|
426
|
-
})
|
|
426
|
+
}),
|
|
427
427
|
);
|
|
428
428
|
}
|
|
429
429
|
const message = err instanceof Error ? err.message : String(err);
|
package/src/core/triage-chain.ts
CHANGED
|
@@ -33,7 +33,7 @@ const NOTIFY: TriageAction = "notify";
|
|
|
33
33
|
function ruleDecision(
|
|
34
34
|
input: TriageInput,
|
|
35
35
|
settings: TriageSettings,
|
|
36
|
-
source: TriageSource
|
|
36
|
+
source: TriageSource,
|
|
37
37
|
): TriageDecision {
|
|
38
38
|
const result = evaluateTriageRules(input, settings.rules);
|
|
39
39
|
return {
|
|
@@ -62,7 +62,7 @@ function ruleDecision(
|
|
|
62
62
|
export async function decideTriage(
|
|
63
63
|
input: TriageInput,
|
|
64
64
|
settings: TriageSettings | undefined,
|
|
65
|
-
options: TriageOptions = {}
|
|
65
|
+
options: TriageOptions = {},
|
|
66
66
|
): Promise<TriageDecision> {
|
|
67
67
|
if (!settings || settings.mode === "off") {
|
|
68
68
|
return { action: NOTIFY, source: "off", attempts: 0, latencyMs: 0 };
|
|
@@ -115,9 +115,9 @@ export async function decideTriage(
|
|
|
115
115
|
export function recordShadow(
|
|
116
116
|
input: TriageInput,
|
|
117
117
|
decision: TriageDecision,
|
|
118
|
-
shadow: TriageSettings["shadow"] | undefined
|
|
118
|
+
shadow: TriageSettings["shadow"] | undefined,
|
|
119
119
|
): void {
|
|
120
|
-
if (!shadow
|
|
120
|
+
if (!shadow?.enabled) return;
|
|
121
121
|
recordTriageOutcome(input, decision, {
|
|
122
122
|
shadowActive: isShadowActive(shadow),
|
|
123
123
|
suppressed: false,
|
|
@@ -97,7 +97,7 @@ function toCompared(
|
|
|
97
97
|
input: TriageInput,
|
|
98
98
|
decision: TriageDecision,
|
|
99
99
|
baseMessage: string,
|
|
100
|
-
dedupCount: number
|
|
100
|
+
dedupCount: number,
|
|
101
101
|
): ComparedDecision {
|
|
102
102
|
const suppressed = decision.action === "skip";
|
|
103
103
|
const message = suppressed
|
|
@@ -143,7 +143,7 @@ function timeoutDecision(): TriageDecision {
|
|
|
143
143
|
async function decideWithTimeout(
|
|
144
144
|
input: TriageInput,
|
|
145
145
|
settings: TriageSettings,
|
|
146
|
-
timeoutMs: number
|
|
146
|
+
timeoutMs: number,
|
|
147
147
|
): Promise<TriageDecision> {
|
|
148
148
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
149
149
|
return decideTriage(input, settings);
|
|
@@ -172,7 +172,7 @@ export async function compareTriage(
|
|
|
172
172
|
beforeSettings: TriageSettings | undefined,
|
|
173
173
|
afterSettings: TriageSettings | undefined,
|
|
174
174
|
dedupCount = 1,
|
|
175
|
-
timeoutMs = DEFAULT_COMPARE_TIMEOUT_MS
|
|
175
|
+
timeoutMs = DEFAULT_COMPARE_TIMEOUT_MS,
|
|
176
176
|
): Promise<CompareTriageResult> {
|
|
177
177
|
const durationMs =
|
|
178
178
|
typeof input.durationMs === "number" && Number.isFinite(input.durationMs)
|
|
@@ -187,7 +187,7 @@ export async function compareTriage(
|
|
|
187
187
|
tokens: input.tokens ?? undefined,
|
|
188
188
|
costUsd: input.costUsd ?? undefined,
|
|
189
189
|
},
|
|
190
|
-
undefined
|
|
190
|
+
undefined,
|
|
191
191
|
);
|
|
192
192
|
|
|
193
193
|
// before/after приходят из RPC как пользовательский ввод: нормализуем их
|
|
@@ -235,7 +235,7 @@ export async function compareTriage(
|
|
|
235
235
|
after: after.verdict?.confidence ?? null,
|
|
236
236
|
changed: changed(
|
|
237
237
|
before.verdict?.confidence ?? null,
|
|
238
|
-
after.verdict?.confidence ?? null
|
|
238
|
+
after.verdict?.confidence ?? null,
|
|
239
239
|
),
|
|
240
240
|
},
|
|
241
241
|
category: {
|
|
@@ -243,7 +243,7 @@ export async function compareTriage(
|
|
|
243
243
|
after: after.verdict?.category ?? null,
|
|
244
244
|
changed: changed(
|
|
245
245
|
before.verdict?.category ?? null,
|
|
246
|
-
after.verdict?.category ?? null
|
|
246
|
+
after.verdict?.category ?? null,
|
|
247
247
|
),
|
|
248
248
|
},
|
|
249
249
|
severity: {
|
|
@@ -251,7 +251,7 @@ export async function compareTriage(
|
|
|
251
251
|
after: after.verdict?.severity ?? null,
|
|
252
252
|
changed: changed(
|
|
253
253
|
before.verdict?.severity ?? null,
|
|
254
|
-
after.verdict?.severity ?? null
|
|
254
|
+
after.verdict?.severity ?? null,
|
|
255
255
|
),
|
|
256
256
|
},
|
|
257
257
|
reason: {
|
|
@@ -259,7 +259,7 @@ export async function compareTriage(
|
|
|
259
259
|
after: after.verdict?.reason ?? null,
|
|
260
260
|
changed: changed(
|
|
261
261
|
before.verdict?.reason ?? null,
|
|
262
|
-
after.verdict?.reason ?? null
|
|
262
|
+
after.verdict?.reason ?? null,
|
|
263
263
|
),
|
|
264
264
|
},
|
|
265
265
|
suppressed: {
|
package/src/core/triage-rules.ts
CHANGED
|
@@ -195,20 +195,20 @@ function conditionLabel(rule: TriageRule): string {
|
|
|
195
195
|
/** Оценивает одно уведомление по правилам. Не бросает исключений. */
|
|
196
196
|
export function evaluateTriageRules(
|
|
197
197
|
input: TriageInput,
|
|
198
|
-
rules: readonly TriageRule[] | undefined = DEFAULT_TRIAGE_RULES
|
|
198
|
+
rules: readonly TriageRule[] | undefined = DEFAULT_TRIAGE_RULES,
|
|
199
199
|
): TriageRuleResult {
|
|
200
200
|
const ordered = (rules ?? [])
|
|
201
201
|
.map((rule, index) => ({ rule, index }))
|
|
202
202
|
.sort(
|
|
203
203
|
(a, b) =>
|
|
204
|
-
(b.rule.priority ?? 0) - (a.rule.priority ?? 0) || a.index - b.index
|
|
204
|
+
(b.rule.priority ?? 0) - (a.rule.priority ?? 0) || a.index - b.index,
|
|
205
205
|
);
|
|
206
206
|
|
|
207
207
|
for (const { rule } of ordered) {
|
|
208
208
|
if (!matches(rule, input)) continue;
|
|
209
209
|
|
|
210
|
-
const category = (rule.category ?? "unknown")
|
|
211
|
-
const severity = (rule.severity ?? "medium")
|
|
210
|
+
const category = (rule.category ?? "unknown");
|
|
211
|
+
const severity = (rule.severity ?? "medium");
|
|
212
212
|
const confidence =
|
|
213
213
|
typeof rule.confidence === "number" && Number.isFinite(rule.confidence)
|
|
214
214
|
? Math.min(1, Math.max(0, rule.confidence))
|
|
@@ -76,7 +76,7 @@ function detailsOf(record: { details: unknown }): Record<string, any> {
|
|
|
76
76
|
export function recordTriageOutcome(
|
|
77
77
|
input: TriageInput,
|
|
78
78
|
decision: TriageDecision,
|
|
79
|
-
options: TriageOutcomeOptions = {}
|
|
79
|
+
options: TriageOutcomeOptions = {},
|
|
80
80
|
): number | null {
|
|
81
81
|
const shadow = Boolean(options.shadowActive);
|
|
82
82
|
const suppressed = Boolean(options.suppressed);
|
|
@@ -112,7 +112,7 @@ export function recordTriageOutcome(
|
|
|
112
112
|
/** Обратная совместимость: запись shadow-решения без деталей доставки. */
|
|
113
113
|
export function recordShadowDecision(
|
|
114
114
|
input: TriageInput,
|
|
115
|
-
decision: TriageDecision
|
|
115
|
+
decision: TriageDecision,
|
|
116
116
|
): void {
|
|
117
117
|
recordTriageOutcome(input, decision, { shadowActive: true });
|
|
118
118
|
}
|
|
@@ -124,7 +124,7 @@ export function recordShadowDecision(
|
|
|
124
124
|
* shadow-записи или все решения.
|
|
125
125
|
*/
|
|
126
126
|
export function readTriageDecisions(
|
|
127
|
-
filter: { since?: string; until?: string; taskName?: string; limit?: number } = {}
|
|
127
|
+
filter: { since?: string; until?: string; taskName?: string; limit?: number } = {},
|
|
128
128
|
): ShadowDecisionRecord[] {
|
|
129
129
|
const result = readAuditLog({
|
|
130
130
|
action: TRIAGE_AUDIT_ACTION,
|
|
@@ -185,15 +185,15 @@ export interface ShadowReport {
|
|
|
185
185
|
|
|
186
186
|
/** Сформировать отчёт по persistent-журналу за текущий/прошлый период. */
|
|
187
187
|
export function shadowReport(
|
|
188
|
-
shadow: TriageShadowSettings | undefined
|
|
188
|
+
shadow: TriageShadowSettings | undefined,
|
|
189
189
|
): ShadowReport {
|
|
190
190
|
const startedAt = shadow?.startedAt ?? null;
|
|
191
191
|
const days = shadow?.days ?? 0;
|
|
192
192
|
const until =
|
|
193
193
|
startedAt && days > 0
|
|
194
194
|
? new Date(
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
new Date(startedAt).getTime() + days * 24 * 60 * 60 * 1000,
|
|
196
|
+
).toISOString()
|
|
197
197
|
: undefined;
|
|
198
198
|
|
|
199
199
|
const records = readTriageDecisions({
|
|
@@ -231,7 +231,7 @@ export function resetShadowDecisions(): void {
|
|
|
231
231
|
.prepare(
|
|
232
232
|
`DELETE FROM audit_log
|
|
233
233
|
WHERE action = ?
|
|
234
|
-
AND json_extract(details_json, '$.shadow') = 1
|
|
234
|
+
AND json_extract(details_json, '$.shadow') = 1`,
|
|
235
235
|
)
|
|
236
236
|
.run(TRIAGE_AUDIT_ACTION);
|
|
237
237
|
} catch {
|
|
@@ -171,7 +171,7 @@ function safeUnlink(file: string | undefined): void {
|
|
|
171
171
|
export function writeTriageJob(
|
|
172
172
|
input: TriageInput,
|
|
173
173
|
triage: TriageSettings,
|
|
174
|
-
options: { tmpDir?: string } = {}
|
|
174
|
+
options: { tmpDir?: string } = {},
|
|
175
175
|
): string {
|
|
176
176
|
const payload: TriageJobPayload = {
|
|
177
177
|
version: 1,
|
|
@@ -238,7 +238,7 @@ export interface ScheduleTriageOptions {
|
|
|
238
238
|
export function scheduleTriageJob(
|
|
239
239
|
input: TriageInput,
|
|
240
240
|
triage: TriageSettings,
|
|
241
|
-
options: ScheduleTriageOptions = {}
|
|
241
|
+
options: ScheduleTriageOptions = {},
|
|
242
242
|
): { scheduled: boolean; file?: string; error?: string } {
|
|
243
243
|
let file: string | undefined;
|
|
244
244
|
try {
|
|
@@ -261,7 +261,7 @@ export function scheduleTriageJob(
|
|
|
261
261
|
stdio: "ignore",
|
|
262
262
|
windowsHide: true,
|
|
263
263
|
env: options.env ?? process.env,
|
|
264
|
-
}
|
|
264
|
+
},
|
|
265
265
|
);
|
|
266
266
|
child.unref();
|
|
267
267
|
// Если процесс не стартовал, файл задания останется сиротой — убираем.
|
|
@@ -281,7 +281,7 @@ async function main(): Promise<void> {
|
|
|
281
281
|
const index = process.argv.indexOf(TRIAGE_WORKER_FLAG);
|
|
282
282
|
const file = index >= 0 ? process.argv[index + 1] : undefined;
|
|
283
283
|
if (!file) {
|
|
284
|
-
console.error("[
|
|
284
|
+
console.error("[agent-steward] triage worker: не указан файл задания");
|
|
285
285
|
process.exitCode = 1;
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
@@ -317,9 +317,9 @@ async function drainQueue(first: string): Promise<void> {
|
|
|
317
317
|
await runTriageJob(file);
|
|
318
318
|
} catch (err: any) {
|
|
319
319
|
console.error(
|
|
320
|
-
`[
|
|
320
|
+
`[agent-steward] triage worker: ${
|
|
321
321
|
err instanceof Error ? err.message : String(err)
|
|
322
|
-
}
|
|
322
|
+
}`,
|
|
323
323
|
);
|
|
324
324
|
process.exitCode = 1;
|
|
325
325
|
} finally {
|