agent-steward 0.0.3 → 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 +20 -0
- package/README.md +3 -3
- package/ROADMAP-STRATEGY.md +9 -9
- package/ROADMAP.md +50 -34
- 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 +18 -1
- package/dist/core/lock.d.ts +20 -4
- package/dist/core/lock.d.ts.map +1 -1
- package/dist/core/lock.js +97 -22
- package/dist/core/one-shot.d.ts +5 -1
- package/dist/core/one-shot.d.ts.map +1 -1
- package/dist/core/one-shot.js +33 -8
- 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/ps-wrapper.d.ts +1 -1
- package/dist/core/ps-wrapper.d.ts.map +1 -1
- package/dist/core/ps-wrapper.js +11 -1
- 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 +56 -32
- 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 +34 -0
- package/dist/core/schedule-v2.d.ts.map +1 -1
- package/dist/core/schedule-v2.js +91 -5
- package/dist/core/scheduler/at-fallback.d.ts +55 -2
- package/dist/core/scheduler/at-fallback.d.ts.map +1 -1
- package/dist/core/scheduler/at-fallback.js +135 -5
- package/dist/core/scheduler/linux.d.ts +10 -1
- package/dist/core/scheduler/linux.d.ts.map +1 -1
- package/dist/core/scheduler/linux.js +29 -11
- package/dist/core/scheduler/posix.d.ts.map +1 -1
- package/dist/core/scheduler/posix.js +25 -1
- package/dist/core/scheduler/registry.d.ts +11 -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/secrets.d.ts.map +1 -1
- package/dist/core/secrets.js +125 -28
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +18 -11
- 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/wrappers/bash.d.ts.map +1 -1
- package/dist/core/wrappers/bash.js +49 -4
- 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 +4 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +39 -1
- 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-resume.d.ts +5 -2
- package/dist/db/run-resume.d.ts.map +1 -1
- package/dist/db/run-resume.js +30 -11
- package/dist/db/runs-repo.d.ts +13 -5
- package/dist/db/runs-repo.d.ts.map +1 -1
- package/dist/db/runs-repo.js +28 -5
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +154 -2
- 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 +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +102 -4
- package/dist/rpc.d.ts +678 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +235 -0
- package/dist/server.d.ts +31 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +95 -35
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +7 -0
- package/dist/workspaces.d.ts +25 -3
- package/dist/workspaces.d.ts.map +1 -1
- package/dist/workspaces.js +43 -8
- package/docs/ARCHITECTURE.md +229 -5
- package/docs/CONCEPT.md +171 -91
- package/docs/EXECUTION-LOOP.md +196 -0
- package/docs/README.ru.md +2 -2
- package/docs/README.zh.md +3 -3
- 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/gui-experimental.cjs +8 -8
- package/locales/en.json +67 -0
- package/locales/ru.json +67 -0
- package/locales/zh.json +67 -0
- package/package.json +28 -3
- package/scripts/audit-bundle.mjs +215 -0
- package/src/core/dlq-api.ts +98 -0
- package/src/core/dry-run.ts +25 -1
- package/src/core/lock.ts +95 -22
- package/src/core/one-shot.ts +36 -8
- package/src/core/opencode-cli.ts +103 -0
- package/src/core/opencode-models.ts +315 -0
- package/src/core/ps-wrapper.ts +11 -1
- package/src/core/record-history.ts +75 -37
- 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/schedule-gate.ts +6 -2
- package/src/core/schedule-v2.ts +114 -5
- package/src/core/scheduler/at-fallback.ts +190 -5
- package/src/core/scheduler/linux.ts +32 -10
- package/src/core/scheduler/posix.ts +20 -1
- package/src/core/scheduler/registry.ts +107 -26
- package/src/core/scheduler/run-now.ts +32 -0
- package/src/core/secrets.ts +127 -27
- package/src/core/session.ts +23 -10
- package/src/core/task-name.ts +67 -0
- package/src/core/wrappers/bash.ts +49 -4
- package/src/db/capability-repo.ts +285 -0
- package/src/db/history-repo.ts +22 -0
- package/src/db/index.ts +37 -1
- package/src/db/migrate.ts +3 -1
- package/src/db/run-context.ts +370 -0
- package/src/db/run-dlq.ts +310 -0
- package/src/db/run-resume.ts +48 -12
- package/src/db/runs-repo.ts +30 -7
- package/src/db/schema.ts +154 -2
- package/src/db/settings-repo.ts +31 -0
- package/src/db/step-idempotency.ts +185 -0
- package/src/gui.tsx +515 -0
- package/src/index.ts +124 -4
- package/src/rpc.ts +251 -0
- package/src/server.ts +112 -36
- package/src/types.ts +9 -0
- package/src/workspaces.ts +58 -9
package/src/gui.tsx
CHANGED
|
@@ -258,6 +258,60 @@ interface ProfileInfo {
|
|
|
258
258
|
active: boolean
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
/** Запись dead-letter queue (Спринт 36.6). */
|
|
262
|
+
interface DlqEntry {
|
|
263
|
+
id: string
|
|
264
|
+
runId: string
|
|
265
|
+
stepName: string
|
|
266
|
+
status: "open" | "retried" | "discarded" | string
|
|
267
|
+
reason: string | null
|
|
268
|
+
error: string | null
|
|
269
|
+
attempts: number
|
|
270
|
+
createdAt: string
|
|
271
|
+
updatedAt: string
|
|
272
|
+
resolvedAt: string | null
|
|
273
|
+
resolution: string | null
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** Шаг durable-запуска в панели pause/resume (Спринт 36.8). */
|
|
277
|
+
interface RunPanelStep {
|
|
278
|
+
stepName: string
|
|
279
|
+
position: number
|
|
280
|
+
status: string
|
|
281
|
+
attempt: number
|
|
282
|
+
error: string | null
|
|
283
|
+
anchor: string
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** Вставка контекста в истории запуска. */
|
|
287
|
+
interface RunPanelInjection {
|
|
288
|
+
id: string
|
|
289
|
+
kind: string
|
|
290
|
+
content: string
|
|
291
|
+
contentLength: number
|
|
292
|
+
author: string
|
|
293
|
+
createdAt: string
|
|
294
|
+
consumedAt: string | null
|
|
295
|
+
consumedByStep: string | null
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** Durable-запуск в панели pause/resume. */
|
|
299
|
+
interface RunPanelRun {
|
|
300
|
+
id: string
|
|
301
|
+
taskName: string
|
|
302
|
+
status: "pending" | "running" | "paused" | "passed" | "failed" | "cancelled"
|
|
303
|
+
createdAt: string
|
|
304
|
+
startedAt: string | null
|
|
305
|
+
finishedAt: string | null
|
|
306
|
+
error: string | null
|
|
307
|
+
steps: RunPanelStep[]
|
|
308
|
+
currentStep: RunPanelStep | null
|
|
309
|
+
doneSteps: number
|
|
310
|
+
totalSteps: number
|
|
311
|
+
injections: RunPanelInjection[]
|
|
312
|
+
pendingInjections: number
|
|
313
|
+
}
|
|
314
|
+
|
|
261
315
|
function statusColor(status: JobStatus): string {
|
|
262
316
|
switch (status) {
|
|
263
317
|
case "running": return "#f5a623"
|
|
@@ -547,7 +601,20 @@ export default Plugin.define({
|
|
|
547
601
|
const [secretName, setSecretName] = createSignal("")
|
|
548
602
|
const [secretValue, setSecretValue] = createSignal("")
|
|
549
603
|
|
|
604
|
+
// Durable-запуски (Спринт 36.8): пауза, комментарий и resume в GUI.
|
|
605
|
+
const [runPanelRuns, setRunPanelRuns] = createSignal<RunPanelRun[]>([])
|
|
606
|
+
const [runPanelActive, setRunPanelActive] = createSignal(0)
|
|
607
|
+
const [runPanelBusy, setRunPanelBusy] = createSignal(false)
|
|
608
|
+
const [runPanelCollapsed, setRunPanelCollapsed] = createSignal(true)
|
|
609
|
+
const [runPanelFilter, setRunPanelFilter] = createSignal<"active" | "all" | "running" | "paused" | "failed">("active")
|
|
610
|
+
const [runPanelComments, setRunPanelComments] = createSignal<Record<string, string>>({})
|
|
611
|
+
|
|
550
612
|
// Аудит (Спринт 26): журнал мутаций.
|
|
613
|
+
const [dlqEntries, setDlqEntries] = createSignal<DlqEntry[]>([])
|
|
614
|
+
const [dlqOpen, setDlqOpen] = createSignal(0)
|
|
615
|
+
const [dlqBusy, setDlqBusy] = createSignal(false)
|
|
616
|
+
const [dlqCollapsed, setDlqCollapsed] = createSignal(true)
|
|
617
|
+
const [dlqFilter, setDlqFilter] = createSignal<"open" | "all" | "retried" | "discarded">("open")
|
|
551
618
|
const [auditRecords, setAuditRecords] = createSignal<{ id: number; ts: string; action: string; targetType: string | null; target: string | null; actor: string; source: string | null; details: unknown; remote: string | null }[]>([])
|
|
552
619
|
const [auditBusy, setAuditBusy] = createSignal(false)
|
|
553
620
|
const [auditCollapsed, setAuditCollapsed] = createSignal(true)
|
|
@@ -676,6 +743,8 @@ export default Plugin.define({
|
|
|
676
743
|
|
|
677
744
|
void loadSecretsGui()
|
|
678
745
|
void loadAuditGui()
|
|
746
|
+
void loadDlqGui()
|
|
747
|
+
void loadRunPanel()
|
|
679
748
|
}
|
|
680
749
|
|
|
681
750
|
/** Текущие настройки уведомлений из сигналов формы. */
|
|
@@ -930,6 +999,160 @@ export default Plugin.define({
|
|
|
930
999
|
await persistSettings({ audit: { enabled: auditRetentionEnabled(), retentionDays: auditRetentionDays(), maxRecords: auditMaxRecords() } })
|
|
931
1000
|
}
|
|
932
1001
|
|
|
1002
|
+
/** Загрузка durable-запусков (Спринт 36.8). */
|
|
1003
|
+
async function loadRunPanel() {
|
|
1004
|
+
setRunPanelBusy(true)
|
|
1005
|
+
try {
|
|
1006
|
+
const result = await rpc.list_durable_runs({ filter: runPanelFilter(), limit: 20 })
|
|
1007
|
+
if (result?.success) {
|
|
1008
|
+
setRunPanelRuns(result.runs ?? [])
|
|
1009
|
+
setRunPanelActive(Number(result.active ?? 0))
|
|
1010
|
+
} else if (result?.error) {
|
|
1011
|
+
console.error("RPC Error (list_durable_runs):", result.error)
|
|
1012
|
+
}
|
|
1013
|
+
} catch (err: any) {
|
|
1014
|
+
console.error("RPC Error (list_durable_runs):", err)
|
|
1015
|
+
} finally {
|
|
1016
|
+
setRunPanelBusy(false)
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/** Пауза с комментарием: следующий шаг получит его при resume. */
|
|
1021
|
+
async function handlePauseRun(run: RunPanelRun) {
|
|
1022
|
+
const comment = (runPanelComments()[run.id] ?? "").trim()
|
|
1023
|
+
if (!window.confirm(gt("gui.runsPauseConfirm", { task: run.taskName }))) return
|
|
1024
|
+
setRunPanelBusy(true)
|
|
1025
|
+
try {
|
|
1026
|
+
const result = await rpc.pause_durable_run({
|
|
1027
|
+
runId: run.id,
|
|
1028
|
+
comment: comment || undefined,
|
|
1029
|
+
author: "gui",
|
|
1030
|
+
})
|
|
1031
|
+
if (result?.success) {
|
|
1032
|
+
setRunPanelComments((prev) => ({ ...prev, [run.id]: "" }))
|
|
1033
|
+
ctx.toast.show({
|
|
1034
|
+
title: gt("gui.runsPaused"),
|
|
1035
|
+
variant: "success",
|
|
1036
|
+
description: gt("gui.runsPausedDescription", { step: result.stepName ?? "—" }),
|
|
1037
|
+
})
|
|
1038
|
+
} else {
|
|
1039
|
+
ctx.toast.show({
|
|
1040
|
+
title: gt("gui.runsPauseFailed"),
|
|
1041
|
+
variant: "error",
|
|
1042
|
+
description: result?.error ?? gt("gui.runsUnknownError"),
|
|
1043
|
+
})
|
|
1044
|
+
}
|
|
1045
|
+
await loadRunPanel()
|
|
1046
|
+
} catch (err: any) {
|
|
1047
|
+
console.error("RPC Error (pause_durable_run):", err)
|
|
1048
|
+
ctx.toast.show({ title: gt("gui.runsPauseFailed"), variant: "error", description: errorMessage(err) })
|
|
1049
|
+
} finally {
|
|
1050
|
+
setRunPanelBusy(false)
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/** Resume только готовит запуск: снимает паузу и выбирает следующий шаг. */
|
|
1055
|
+
async function handleResumeRun(run: RunPanelRun) {
|
|
1056
|
+
if (!window.confirm(gt("gui.runsResumeConfirm", { task: run.taskName }))) return
|
|
1057
|
+
setRunPanelBusy(true)
|
|
1058
|
+
try {
|
|
1059
|
+
const result = await rpc.resume_durable_run({ runId: run.id })
|
|
1060
|
+
if (result?.success) {
|
|
1061
|
+
ctx.toast.show({
|
|
1062
|
+
title: gt("gui.runsResumed"),
|
|
1063
|
+
variant: "success",
|
|
1064
|
+
description: gt("gui.runsResumedDescription", { step: result.stepName ?? "—" }),
|
|
1065
|
+
})
|
|
1066
|
+
} else {
|
|
1067
|
+
ctx.toast.show({
|
|
1068
|
+
title: gt("gui.runsResumeFailed"),
|
|
1069
|
+
variant: "error",
|
|
1070
|
+
description: result?.error ?? gt("gui.runsUnknownError"),
|
|
1071
|
+
})
|
|
1072
|
+
}
|
|
1073
|
+
await loadRunPanel()
|
|
1074
|
+
} catch (err: any) {
|
|
1075
|
+
console.error("RPC Error (resume_durable_run):", err)
|
|
1076
|
+
ctx.toast.show({ title: gt("gui.runsResumeFailed"), variant: "error", description: errorMessage(err) })
|
|
1077
|
+
} finally {
|
|
1078
|
+
setRunPanelBusy(false)
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
/** Загрузка dead-letter queue (Спринт 36.6). */
|
|
1083
|
+
async function loadDlqGui() {
|
|
1084
|
+
setDlqBusy(true)
|
|
1085
|
+
try {
|
|
1086
|
+
const result = await rpc.list_dlq({ status: dlqFilter(), limit: 100 })
|
|
1087
|
+
if (result?.success) {
|
|
1088
|
+
setDlqEntries(result.entries ?? [])
|
|
1089
|
+
setDlqOpen(Number(result.open ?? 0))
|
|
1090
|
+
} else if (result?.error) {
|
|
1091
|
+
console.error("RPC Error (list_dlq):", result.error)
|
|
1092
|
+
}
|
|
1093
|
+
} catch (err: any) {
|
|
1094
|
+
console.error("RPC Error (list_dlq):", err)
|
|
1095
|
+
} finally {
|
|
1096
|
+
setDlqBusy(false)
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/** Ручной retry записи DLQ: шаг вернётся в запуск, выполнение подхватит resume. */
|
|
1101
|
+
async function handleRetryDlq(entry: DlqEntry) {
|
|
1102
|
+
if (!window.confirm(gt("gui.dlqRetryConfirm", { step: entry.stepName, run: entry.runId }))) return
|
|
1103
|
+
setDlqBusy(true)
|
|
1104
|
+
try {
|
|
1105
|
+
const result = await rpc.retry_dlq({ id: entry.id })
|
|
1106
|
+
if (result?.success) {
|
|
1107
|
+
ctx.toast.show({
|
|
1108
|
+
title: gt("gui.dlqRetried"),
|
|
1109
|
+
variant: "success",
|
|
1110
|
+
description: gt("gui.dlqRetriedDescription", { step: entry.stepName }),
|
|
1111
|
+
})
|
|
1112
|
+
} else {
|
|
1113
|
+
ctx.toast.show({
|
|
1114
|
+
title: gt("gui.dlqRetryFailed"),
|
|
1115
|
+
variant: "error",
|
|
1116
|
+
description: result?.error ?? gt("gui.dlqUnknownError"),
|
|
1117
|
+
})
|
|
1118
|
+
}
|
|
1119
|
+
await loadDlqGui()
|
|
1120
|
+
} catch (err: any) {
|
|
1121
|
+
console.error("RPC Error (retry_dlq):", err)
|
|
1122
|
+
ctx.toast.show({ title: gt("gui.dlqRetryFailed"), variant: "error", description: errorMessage(err) })
|
|
1123
|
+
} finally {
|
|
1124
|
+
setDlqBusy(false)
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/** Осознанный отказ от повтора: запись закрывается, шаг остаётся failed. */
|
|
1129
|
+
async function handleDiscardDlq(entry: DlqEntry) {
|
|
1130
|
+
if (!window.confirm(gt("gui.dlqDiscardConfirm", { step: entry.stepName, run: entry.runId }))) return
|
|
1131
|
+
setDlqBusy(true)
|
|
1132
|
+
try {
|
|
1133
|
+
const result = await rpc.discard_dlq({ id: entry.id })
|
|
1134
|
+
if (result?.success) {
|
|
1135
|
+
ctx.toast.show({
|
|
1136
|
+
title: gt("gui.dlqDiscarded"),
|
|
1137
|
+
variant: "success",
|
|
1138
|
+
description: gt("gui.dlqDiscardedDescription", { step: entry.stepName }),
|
|
1139
|
+
})
|
|
1140
|
+
} else {
|
|
1141
|
+
ctx.toast.show({
|
|
1142
|
+
title: gt("gui.dlqDiscardFailed"),
|
|
1143
|
+
variant: "error",
|
|
1144
|
+
description: result?.error ?? gt("gui.dlqUnknownError"),
|
|
1145
|
+
})
|
|
1146
|
+
}
|
|
1147
|
+
await loadDlqGui()
|
|
1148
|
+
} catch (err: any) {
|
|
1149
|
+
console.error("RPC Error (discard_dlq):", err)
|
|
1150
|
+
ctx.toast.show({ title: gt("gui.dlqDiscardFailed"), variant: "error", description: errorMessage(err) })
|
|
1151
|
+
} finally {
|
|
1152
|
+
setDlqBusy(false)
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
933
1156
|
/** Кнопка «🧪 Тестовое уведомление». */
|
|
934
1157
|
async function handleTestNotification() {
|
|
935
1158
|
setTestNotificationBusy(true)
|
|
@@ -3689,6 +3912,298 @@ export default Plugin.define({
|
|
|
3689
3912
|
)}
|
|
3690
3913
|
</div>
|
|
3691
3914
|
|
|
3915
|
+
{/* ⏯️ Durable-запуски: пауза и resume (Спринт 36.8) */}
|
|
3916
|
+
<div style="width:100%;max-width:900px;box-sizing:border-box;margin-top:8px;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden">
|
|
3917
|
+
<button
|
|
3918
|
+
onClick={() => setRunPanelCollapsed(!runPanelCollapsed())}
|
|
3919
|
+
style="display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;box-sizing:border-box;padding:10px 14px;background:transparent;border:none;color:#e0e0e0;font-size:12px;font-weight:600;cursor:pointer;text-align:left"
|
|
3920
|
+
>
|
|
3921
|
+
<span>{gt("gui.runsHeading")}</span>
|
|
3922
|
+
<span style="display:flex;align-items:center;gap:8px;font-size:11px;font-weight:400;color:#8e8e93">
|
|
3923
|
+
{gt("gui.runsActiveCount", { count: runPanelActive() })}
|
|
3924
|
+
<span>{runPanelCollapsed() ? "▾" : "▴"}</span>
|
|
3925
|
+
</span>
|
|
3926
|
+
</button>
|
|
3927
|
+
|
|
3928
|
+
{!runPanelCollapsed() && (
|
|
3929
|
+
<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px">
|
|
3930
|
+
<div style="font-size:11px;color:#8e8e93">{gt("gui.runsHint")}</div>
|
|
3931
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
3932
|
+
<label style="font-size:12px;color:#e0e0e0;white-space:nowrap">{gt("gui.runsFilter")}</label>
|
|
3933
|
+
<select
|
|
3934
|
+
value={runPanelFilter()}
|
|
3935
|
+
onChange={(e) => {
|
|
3936
|
+
setRunPanelFilter(e.currentTarget.value as "active" | "all" | "running" | "paused" | "failed")
|
|
3937
|
+
void loadRunPanel()
|
|
3938
|
+
}}
|
|
3939
|
+
style="padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
3940
|
+
>
|
|
3941
|
+
<option value="active">{gt("gui.runsFilterActive")}</option>
|
|
3942
|
+
<option value="all">{gt("gui.runsFilterAll")}</option>
|
|
3943
|
+
<option value="running">{gt("gui.runsFilterRunning")}</option>
|
|
3944
|
+
<option value="paused">{gt("gui.runsFilterPaused")}</option>
|
|
3945
|
+
<option value="failed">{gt("gui.runsFilterFailed")}</option>
|
|
3946
|
+
</select>
|
|
3947
|
+
<button
|
|
3948
|
+
onClick={() => void loadRunPanel()}
|
|
3949
|
+
disabled={runPanelBusy()}
|
|
3950
|
+
style={runPanelBusy()
|
|
3951
|
+
? "padding:6px 12px;background:#666;color:white;border:none;border-radius:6px;cursor:not-allowed;font-size:12px;font-weight:500;opacity:0.6"
|
|
3952
|
+
: "padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:pointer;font-size:12px;font-weight:500;opacity:1"}
|
|
3953
|
+
>
|
|
3954
|
+
{runPanelBusy() ? gt("gui.loading") : gt("gui.refresh")}
|
|
3955
|
+
</button>
|
|
3956
|
+
</div>
|
|
3957
|
+
|
|
3958
|
+
{runPanelRuns().map((run) => (
|
|
3959
|
+
<div style="border:1px solid #333;border-radius:8px;background:#0f0f0f;padding:10px;display:flex;flex-direction:column;gap:8px">
|
|
3960
|
+
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap">
|
|
3961
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
3962
|
+
<span style="color:#5ac8fa;font-weight:600;font-size:12px">{run.taskName}</span>
|
|
3963
|
+
<span style="font-size:10px;color:#8e8e93">run: {run.id.slice(0, 8)}</span>
|
|
3964
|
+
<span
|
|
3965
|
+
style={`font-size:10px;font-weight:600;padding:2px 7px;border-radius:999px;border:1px solid ${
|
|
3966
|
+
run.status === "paused"
|
|
3967
|
+
? "#ff9f0a"
|
|
3968
|
+
: run.status === "running"
|
|
3969
|
+
? "#f5a623"
|
|
3970
|
+
: run.status === "failed"
|
|
3971
|
+
? "#ff3b30"
|
|
3972
|
+
: run.status === "passed"
|
|
3973
|
+
? "#34c759"
|
|
3974
|
+
: "#555"
|
|
3975
|
+
};color:#e0e0e0`}
|
|
3976
|
+
>
|
|
3977
|
+
{run.status}
|
|
3978
|
+
</span>
|
|
3979
|
+
</div>
|
|
3980
|
+
<span style="font-size:10px;color:#8e8e93">
|
|
3981
|
+
{gt("gui.runsProgress", { done: run.doneSteps, total: run.totalSteps })}
|
|
3982
|
+
</span>
|
|
3983
|
+
</div>
|
|
3984
|
+
|
|
3985
|
+
<div style="font-size:11px;color:#e0e0e0">
|
|
3986
|
+
{run.currentStep ? (
|
|
3987
|
+
<span>
|
|
3988
|
+
{gt("gui.runsCurrentStep")}{" "}
|
|
3989
|
+
<a href={`#${run.currentStep.anchor}`} style="color:#5ac8fa;text-decoration:none">
|
|
3990
|
+
{run.currentStep.stepName}
|
|
3991
|
+
</a>{" "}
|
|
3992
|
+
<span style="color:#8e8e93">
|
|
3993
|
+
· {run.currentStep.status} · attempt {run.currentStep.attempt}
|
|
3994
|
+
</span>
|
|
3995
|
+
</span>
|
|
3996
|
+
) : (
|
|
3997
|
+
<span style="color:#8e8e93">{gt("gui.runsNoCurrentStep")}</span>
|
|
3998
|
+
)}
|
|
3999
|
+
</div>
|
|
4000
|
+
|
|
4001
|
+
{run.currentStep?.status === "running" && (
|
|
4002
|
+
<div style="font-size:11px;color:#ff9f0a;background:#2a1f00;border:1px solid #5a3d00;border-radius:6px;padding:6px 8px">
|
|
4003
|
+
{gt("gui.runsRunningWarning")}
|
|
4004
|
+
</div>
|
|
4005
|
+
)}
|
|
4006
|
+
|
|
4007
|
+
{(run.status === "pending" || run.status === "running") && (
|
|
4008
|
+
<div style="display:flex;align-items:center;gap:6px;flex-wrap:wrap">
|
|
4009
|
+
<input
|
|
4010
|
+
type="text"
|
|
4011
|
+
value={runPanelComments()[run.id] ?? ""}
|
|
4012
|
+
placeholder={gt("gui.runsCommentPlaceholder")}
|
|
4013
|
+
onInput={(e) =>
|
|
4014
|
+
setRunPanelComments((prev) => ({ ...prev, [run.id]: e.currentTarget.value }))
|
|
4015
|
+
}
|
|
4016
|
+
style="flex:1;min-width:180px;padding:5px 7px;background:#1e1e1e;border:1px solid #333;border-radius:5px;color:#fff;font-size:11px;outline:none"
|
|
4017
|
+
/>
|
|
4018
|
+
<button
|
|
4019
|
+
onClick={() => void handlePauseRun(run)}
|
|
4020
|
+
disabled={runPanelBusy() || run.currentStep?.status === "running"}
|
|
4021
|
+
title={run.currentStep?.status === "running"
|
|
4022
|
+
? gt("gui.runsRunningWarning")
|
|
4023
|
+
: gt("gui.runsPauseTitle")}
|
|
4024
|
+
style={runPanelBusy() || run.currentStep?.status === "running"
|
|
4025
|
+
? "padding:5px 10px;background:#666;color:white;border:none;border-radius:5px;cursor:not-allowed;font-size:11px;opacity:0.6"
|
|
4026
|
+
: "padding:5px 10px;background:#ff9f0a;color:#1a1a1a;border:none;border-radius:5px;cursor:pointer;font-size:11px;font-weight:600"}
|
|
4027
|
+
>
|
|
4028
|
+
⏸ {gt("gui.runsPause")}
|
|
4029
|
+
</button>
|
|
4030
|
+
</div>
|
|
4031
|
+
)}
|
|
4032
|
+
|
|
4033
|
+
{(run.status === "paused" || run.status === "failed") && (
|
|
4034
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
4035
|
+
<button
|
|
4036
|
+
onClick={() => void handleResumeRun(run)}
|
|
4037
|
+
disabled={runPanelBusy()}
|
|
4038
|
+
title={gt("gui.runsResumeTitle")}
|
|
4039
|
+
style="padding:5px 10px;background:#34c759;color:#0a1a0a;border:none;border-radius:5px;cursor:pointer;font-size:11px;font-weight:600"
|
|
4040
|
+
>
|
|
4041
|
+
▶ {gt("gui.runsResume")}
|
|
4042
|
+
</button>
|
|
4043
|
+
<span style="font-size:10px;color:#8e8e93">{gt("gui.runsResumeHint")}</span>
|
|
4044
|
+
</div>
|
|
4045
|
+
)}
|
|
4046
|
+
|
|
4047
|
+
{run.error && (
|
|
4048
|
+
<div style="font-size:11px;color:#ff9f0a;overflow-wrap:anywhere">{shortError(run.error)}</div>
|
|
4049
|
+
)}
|
|
4050
|
+
|
|
4051
|
+
<div style="display:flex;flex-direction:column;gap:3px">
|
|
4052
|
+
{run.steps.map((step) => (
|
|
4053
|
+
<div
|
|
4054
|
+
id={step.anchor}
|
|
4055
|
+
style="display:flex;align-items:center;gap:8px;font-size:11px;padding:3px 5px;border-radius:4px;background:#161616"
|
|
4056
|
+
>
|
|
4057
|
+
<span style="width:18px;color:#8e8e93;text-align:right">{step.position}</span>
|
|
4058
|
+
<span style="flex:1;color:#e0e0e0;overflow-wrap:anywhere">{step.stepName}</span>
|
|
4059
|
+
<span style="color:#8e8e93">{step.status}</span>
|
|
4060
|
+
<span style="color:#8e8e93">#{step.attempt}</span>
|
|
4061
|
+
{step.error && (
|
|
4062
|
+
<span style="color:#ff9f0a;max-width:260px;overflow-wrap:anywhere" title={step.error}>
|
|
4063
|
+
{shortError(step.error, 80)}
|
|
4064
|
+
</span>
|
|
4065
|
+
)}
|
|
4066
|
+
</div>
|
|
4067
|
+
))}
|
|
4068
|
+
</div>
|
|
4069
|
+
|
|
4070
|
+
{run.injections.length > 0 && (
|
|
4071
|
+
<div style="border-top:1px solid #222;padding-top:6px;display:flex;flex-direction:column;gap:4px">
|
|
4072
|
+
<div style="font-size:10px;color:#8e8e93">
|
|
4073
|
+
{gt("gui.runsContextHistory", { count: run.injections.length })}
|
|
4074
|
+
</div>
|
|
4075
|
+
{run.injections.slice(-3).map((injection) => (
|
|
4076
|
+
<div style="font-size:10px;color:#c7c7cc">
|
|
4077
|
+
<span style="color:#5ac8fa">{injection.author}</span>
|
|
4078
|
+
<span style="color:#8e8e93"> · {injection.kind} · {new Date(injection.createdAt).toLocaleString()}</span>
|
|
4079
|
+
{injection.consumedAt ? (
|
|
4080
|
+
<span style="color:#34c759"> · {gt("gui.runsConsumedBy", { step: injection.consumedByStep ?? "—" })}</span>
|
|
4081
|
+
) : (
|
|
4082
|
+
<span style="color:#ff9f0a"> · {gt("gui.runsPending")}</span>
|
|
4083
|
+
)}
|
|
4084
|
+
<div style="color:#e0e0e0;overflow-wrap:anywhere">{injection.content}</div>
|
|
4085
|
+
</div>
|
|
4086
|
+
))}
|
|
4087
|
+
</div>
|
|
4088
|
+
)}
|
|
4089
|
+
</div>
|
|
4090
|
+
))}
|
|
4091
|
+
|
|
4092
|
+
{runPanelRuns().length === 0 && (
|
|
4093
|
+
<div style="font-size:11px;color:#8e8e93;padding:6px 0">{gt("gui.runsEmpty")}</div>
|
|
4094
|
+
)}
|
|
4095
|
+
</div>
|
|
4096
|
+
)}
|
|
4097
|
+
</div>
|
|
4098
|
+
|
|
4099
|
+
{/* ♻️ Dead-letter queue (Спринт 36.6) */}
|
|
4100
|
+
<div style="width:100%;max-width:900px;box-sizing:border-box;margin-top:8px;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden">
|
|
4101
|
+
<button
|
|
4102
|
+
onClick={() => setDlqCollapsed(!dlqCollapsed())}
|
|
4103
|
+
style="display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;box-sizing:border-box;padding:10px 14px;background:transparent;border:none;color:#e0e0e0;font-size:12px;font-weight:600;cursor:pointer;text-align:left"
|
|
4104
|
+
>
|
|
4105
|
+
<span>{gt("gui.dlqHeading")}</span>
|
|
4106
|
+
<span style="display:flex;align-items:center;gap:8px;font-size:11px;font-weight:400;color:#8e8e93">
|
|
4107
|
+
{gt("gui.dlqOpenCount", { count: dlqOpen() })}
|
|
4108
|
+
<span>{dlqCollapsed() ? "▾" : "▴"}</span>
|
|
4109
|
+
</span>
|
|
4110
|
+
</button>
|
|
4111
|
+
|
|
4112
|
+
{!dlqCollapsed() && (
|
|
4113
|
+
<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px">
|
|
4114
|
+
<div style="font-size:11px;color:#8e8e93">{gt("gui.dlqHint")}</div>
|
|
4115
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
4116
|
+
<label style="font-size:12px;color:#e0e0e0;white-space:nowrap">{gt("gui.dlqFilter")}</label>
|
|
4117
|
+
<select
|
|
4118
|
+
value={dlqFilter()}
|
|
4119
|
+
onChange={(e) => {
|
|
4120
|
+
setDlqFilter(e.currentTarget.value as "open" | "all" | "retried" | "discarded")
|
|
4121
|
+
void loadDlqGui()
|
|
4122
|
+
}}
|
|
4123
|
+
style="padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
4124
|
+
>
|
|
4125
|
+
<option value="open">{gt("gui.dlqFilterOpen")}</option>
|
|
4126
|
+
<option value="all">{gt("gui.dlqFilterAll")}</option>
|
|
4127
|
+
<option value="retried">{gt("gui.dlqFilterRetried")}</option>
|
|
4128
|
+
<option value="discarded">{gt("gui.dlqFilterDiscarded")}</option>
|
|
4129
|
+
</select>
|
|
4130
|
+
<button
|
|
4131
|
+
onClick={() => void loadDlqGui()}
|
|
4132
|
+
disabled={dlqBusy()}
|
|
4133
|
+
style={dlqBusy()
|
|
4134
|
+
? "padding:6px 12px;background:#666;color:white;border:none;border-radius:6px;cursor:not-allowed;font-size:12px;font-weight:500;opacity:0.6"
|
|
4135
|
+
: "padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:pointer;font-size:12px;font-weight:500;opacity:1"}
|
|
4136
|
+
>
|
|
4137
|
+
{dlqBusy() ? gt("gui.loading") : gt("gui.refresh")}
|
|
4138
|
+
</button>
|
|
4139
|
+
</div>
|
|
4140
|
+
<div style="width:100%;overflow:auto;border:1px solid #333;border-radius:6px;background:#0f0f0f">
|
|
4141
|
+
<table style="width:100%;border-collapse:collapse;font-size:11px">
|
|
4142
|
+
<thead>
|
|
4143
|
+
<tr style="border-bottom:1px solid #333">
|
|
4144
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqCreated")}</th>
|
|
4145
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqRun")}</th>
|
|
4146
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqReason")}</th>
|
|
4147
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqAttempts")}</th>
|
|
4148
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqError")}</th>
|
|
4149
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqActions")}</th>
|
|
4150
|
+
</tr>
|
|
4151
|
+
</thead>
|
|
4152
|
+
<tbody>
|
|
4153
|
+
{dlqEntries().map((entry) => (
|
|
4154
|
+
<tr key={entry.id} style="border-bottom:1px solid #222">
|
|
4155
|
+
<td style="padding:5px 8px;color:#8e8e93;white-space:nowrap">{new Date(entry.createdAt).toLocaleString()}</td>
|
|
4156
|
+
<td style="padding:5px 8px;color:#e0e0e0">
|
|
4157
|
+
<div style="color:#5ac8fa">{entry.stepName}</div>
|
|
4158
|
+
<div style="color:#8e8e93;font-size:10px">run: {entry.runId}</div>
|
|
4159
|
+
</td>
|
|
4160
|
+
<td style="padding:5px 8px;color:#e0e0e0;white-space:nowrap">
|
|
4161
|
+
{entry.reason === "attempts-exhausted"
|
|
4162
|
+
? gt("gui.dlqReasonAttempts")
|
|
4163
|
+
: entry.reason === "manual"
|
|
4164
|
+
? gt("gui.dlqReasonManual")
|
|
4165
|
+
: (entry.reason ?? "—")}
|
|
4166
|
+
</td>
|
|
4167
|
+
<td style="padding:5px 8px;color:#e0e0e0">{entry.attempts}</td>
|
|
4168
|
+
<td style="padding:5px 8px;color:#ff9f0a;max-width:280px;overflow-wrap:anywhere" title={entry.error ?? ""}>{entry.error ? shortError(entry.error) : "—"}</td>
|
|
4169
|
+
<td style="padding:5px 8px;white-space:nowrap">
|
|
4170
|
+
{entry.status === "open" ? (
|
|
4171
|
+
<div style="display:flex;align-items:center;gap:6px">
|
|
4172
|
+
<button
|
|
4173
|
+
onClick={() => void handleRetryDlq(entry)}
|
|
4174
|
+
disabled={dlqBusy()}
|
|
4175
|
+
title={gt("gui.dlqRetryTitle")}
|
|
4176
|
+
style="padding:3px 8px;background:#007acc;color:white;border:none;border-radius:5px;cursor:pointer;font-size:11px"
|
|
4177
|
+
>
|
|
4178
|
+
↻ {gt("gui.dlqRetry")}
|
|
4179
|
+
</button>
|
|
4180
|
+
<button
|
|
4181
|
+
onClick={() => void handleDiscardDlq(entry)}
|
|
4182
|
+
disabled={dlqBusy()}
|
|
4183
|
+
title={gt("gui.dlqDiscardTitle")}
|
|
4184
|
+
style="padding:3px 8px;background:#3a3a3c;color:#e0e0e0;border:none;border-radius:5px;cursor:pointer;font-size:11px"
|
|
4185
|
+
>
|
|
4186
|
+
✕ {gt("gui.dlqDiscard")}
|
|
4187
|
+
</button>
|
|
4188
|
+
</div>
|
|
4189
|
+
) : (
|
|
4190
|
+
<span style="color:#8e8e93">{entry.status}{entry.resolution ? ` · ${entry.resolution}` : ""}</span>
|
|
4191
|
+
)}
|
|
4192
|
+
</td>
|
|
4193
|
+
</tr>
|
|
4194
|
+
))}
|
|
4195
|
+
{dlqEntries().length === 0 && (
|
|
4196
|
+
<tr>
|
|
4197
|
+
<td colspan="6" style="padding:8px;color:#8e8e93">{gt("gui.dlqEmpty")}</td>
|
|
4198
|
+
</tr>
|
|
4199
|
+
)}
|
|
4200
|
+
</tbody>
|
|
4201
|
+
</table>
|
|
4202
|
+
</div>
|
|
4203
|
+
</div>
|
|
4204
|
+
)}
|
|
4205
|
+
</div>
|
|
4206
|
+
|
|
3692
4207
|
{/* 📜 Журнал аудита (Спринт 26) */}
|
|
3693
4208
|
<div style="width:100%;max-width:900px;box-sizing:border-box;margin-top:8px;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden">
|
|
3694
4209
|
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px">
|