agent-steward 0.0.3 → 0.0.5
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 +154 -2
- package/CROSS_PLATFORM.md +19 -0
- package/README.md +54 -9
- package/ROADMAP-STRATEGY.md +23 -20
- package/ROADMAP.md +140 -143
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +351 -0
- 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/execution.d.ts +203 -0
- package/dist/core/execution.d.ts.map +1 -0
- package/dist/core/execution.js +309 -0
- package/dist/core/gate-integrity.d.ts +35 -0
- package/dist/core/gate-integrity.d.ts.map +1 -0
- package/dist/core/gate-integrity.js +132 -0
- package/dist/core/git-trigger.d.ts.map +1 -1
- package/dist/core/git-trigger.js +14 -2
- package/dist/core/guard-run.d.ts +4 -0
- package/dist/core/guard-run.d.ts.map +1 -0
- package/dist/core/guard-run.js +101 -0
- package/dist/core/guard.d.ts +52 -0
- package/dist/core/guard.d.ts.map +1 -0
- package/dist/core/guard.js +362 -0
- package/dist/core/lock.d.ts +61 -4
- package/dist/core/lock.d.ts.map +1 -1
- package/dist/core/lock.js +213 -26
- package/dist/core/matrix.d.ts.map +1 -1
- package/dist/core/matrix.js +75 -15
- package/dist/core/mission.d.ts +83 -0
- package/dist/core/mission.d.ts.map +1 -0
- package/dist/core/mission.js +334 -0
- 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/pipeline-apply.d.ts +38 -0
- package/dist/core/pipeline-apply.d.ts.map +1 -0
- package/dist/core/pipeline-apply.js +117 -0
- package/dist/core/pipeline-io.d.ts +13 -0
- package/dist/core/pipeline-io.d.ts.map +1 -0
- package/dist/core/pipeline-io.js +64 -0
- package/dist/core/pipeline-map.d.ts +46 -0
- package/dist/core/pipeline-map.d.ts.map +1 -0
- package/dist/core/pipeline-map.js +196 -0
- package/dist/core/pipeline-spec.d.ts +109 -0
- package/dist/core/pipeline-spec.d.ts.map +1 -0
- package/dist/core/pipeline-spec.js +554 -0
- package/dist/core/ps-wrapper.d.ts +19 -2
- package/dist/core/ps-wrapper.d.ts.map +1 -1
- package/dist/core/ps-wrapper.js +261 -63
- 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 +183 -58
- 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 +91 -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 +18 -2
- package/dist/core/scheduler/linux.d.ts.map +1 -1
- package/dist/core/scheduler/linux.js +63 -20
- package/dist/core/scheduler/mac.d.ts +44 -2
- package/dist/core/scheduler/mac.d.ts.map +1 -1
- package/dist/core/scheduler/mac.js +126 -15
- 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/scheduler/windows.d.ts.map +1 -1
- package/dist/core/scheduler/windows.js +15 -12
- 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/structured-log.d.ts +7 -1
- package/dist/core/structured-log.d.ts.map +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/worktree-run.d.ts +4 -0
- package/dist/core/worktree-run.d.ts.map +1 -0
- package/dist/core/worktree-run.js +164 -0
- package/dist/core/worktree.d.ts +115 -0
- package/dist/core/worktree.d.ts.map +1 -0
- package/dist/core/worktree.js +462 -0
- package/dist/core/wrappers/bash.d.ts +17 -0
- package/dist/core/wrappers/bash.d.ts.map +1 -1
- package/dist/core/wrappers/bash.js +224 -28
- package/dist/db/capability-repo.d.ts +124 -0
- package/dist/db/capability-repo.d.ts.map +1 -0
- package/dist/db/capability-repo.js +267 -0
- package/dist/db/history-repo.d.ts +46 -5
- package/dist/db/history-repo.d.ts.map +1 -1
- package/dist/db/history-repo.js +107 -25
- 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/metrics-repo.js +2 -2
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +3 -1
- package/dist/db/recovery.d.ts.map +1 -1
- package/dist/db/recovery.js +5 -4
- 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 +33 -5
- package/dist/db/run-journal.d.ts.map +1 -1
- package/dist/db/run-journal.js +78 -14
- package/dist/db/run-resume.d.ts +10 -2
- package/dist/db/run-resume.d.ts.map +1 -1
- package/dist/db/run-resume.js +39 -13
- package/dist/db/runs-repo.d.ts +32 -7
- package/dist/db/runs-repo.d.ts.map +1 -1
- package/dist/db/runs-repo.js +50 -11
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +216 -3
- 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/history.d.ts +1 -1
- package/dist/history.d.ts.map +1 -1
- package/dist/i18n.d.ts +5 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +11 -4
- package/dist/index.d.ts +140 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +480 -18
- package/dist/notifications.d.ts +22 -0
- package/dist/notifications.d.ts.map +1 -1
- package/dist/notifications.js +36 -8
- package/dist/profiles.d.ts.map +1 -1
- package/dist/profiles.js +25 -4
- package/dist/rpc.d.ts +924 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +352 -0
- package/dist/server.d.ts +46 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +172 -53
- package/dist/settings.d.ts +2 -2
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +3 -3
- package/dist/shared/jobs-view.d.ts +1 -1
- package/dist/shared/jobs-view.d.ts.map +1 -1
- package/dist/shared/jobs-view.js +2 -0
- package/dist/task-transfer.d.ts +16 -0
- package/dist/task-transfer.d.ts.map +1 -1
- package/dist/task-transfer.js +16 -0
- 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 +498 -58
- package/docs/COMPATIBILITY.md +2 -2
- package/docs/CONCEPT.md +185 -91
- package/docs/CROSS_PLATFORM.ru.md +20 -0
- package/docs/CROSS_PLATFORM.zh.md +18 -0
- package/docs/EXECUTION-LOOP.md +211 -0
- package/docs/FEATURES.md +65 -4
- package/docs/FEATURES.zh.md +52 -4
- package/docs/MIGRATION.md +2 -2
- package/docs/PIPELINE.md +293 -0
- package/docs/README.ru.md +44 -5
- package/docs/README.zh.md +46 -6
- package/docs/SAFETY.md +142 -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 +9 -8
- package/locales/en.json +84 -1
- package/locales/ru.json +84 -1
- package/locales/zh.json +84 -1
- package/opencode.pipeline.yaml +35 -0
- package/package.json +46 -2
- package/scripts/audit-bundle.mjs +215 -0
- package/scripts/test-home.mjs +83 -0
- package/src/cli.ts +412 -0
- package/src/core/dlq-api.ts +98 -0
- package/src/core/dry-run.ts +27 -3
- package/src/core/execution.ts +538 -0
- package/src/core/file-watcher.ts +2 -2
- package/src/core/gate-integrity.ts +160 -0
- package/src/core/git-trigger.ts +18 -5
- package/src/core/guard-run.ts +119 -0
- package/src/core/guard.ts +431 -0
- package/src/core/lock.ts +244 -30
- package/src/core/matrix.ts +95 -50
- package/src/core/mission.ts +485 -0
- package/src/core/native-notify.ts +1 -1
- 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/pipeline-apply.ts +158 -0
- package/src/core/pipeline-io.ts +79 -0
- package/src/core/pipeline-map.ts +264 -0
- package/src/core/pipeline-spec.ts +775 -0
- package/src/core/ps-wrapper.ts +274 -64
- package/src/core/record-history.ts +229 -104
- 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 +115 -0
- package/src/core/run-panel-api.ts +262 -0
- package/src/core/schedule-gate.ts +7 -3
- package/src/core/schedule-v2.ts +114 -5
- package/src/core/scheduler/at-fallback.ts +190 -5
- package/src/core/scheduler/linux.ts +72 -21
- package/src/core/scheduler/logs.ts +2 -2
- package/src/core/scheduler/mac.ts +174 -14
- 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/scheduler/windows.ts +19 -15
- package/src/core/secrets.ts +131 -31
- package/src/core/session.ts +23 -10
- package/src/core/structured-log.ts +22 -5
- package/src/core/task-name.ts +67 -0
- package/src/core/telegram.ts +2 -2
- package/src/core/triage-worker.ts +7 -7
- package/src/core/triage.ts +2 -2
- package/src/core/worktree-run.ts +199 -0
- package/src/core/worktree.ts +600 -0
- package/src/core/wrappers/bash.ts +239 -27
- package/src/db/capability-repo.ts +402 -0
- package/src/db/history-repo.ts +151 -22
- package/src/db/index.ts +37 -1
- package/src/db/metrics-repo.ts +2 -2
- package/src/db/migrate.ts +3 -1
- package/src/db/recovery.ts +5 -4
- package/src/db/run-context.ts +370 -0
- package/src/db/run-dlq.ts +310 -0
- package/src/db/run-journal.ts +100 -13
- package/src/db/run-resume.ts +65 -13
- package/src/db/runs-repo.ts +66 -13
- package/src/db/schema.ts +218 -3
- package/src/db/settings-repo.ts +31 -0
- package/src/db/step-idempotency.ts +185 -0
- package/src/gui.tsx +692 -13
- package/src/history.ts +1 -1
- package/src/i18n.ts +12 -4
- package/src/index.ts +648 -8
- package/src/notifications.ts +38 -8
- package/src/profiles.ts +26 -4
- package/src/rpc.ts +379 -0
- package/src/server.ts +206 -54
- package/src/settings.ts +5 -5
- package/src/shared/jobs-view.ts +3 -1
- package/src/task-transfer.ts +31 -0
- package/src/types.ts +9 -0
- package/src/workspaces.ts +58 -9
package/src/gui.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { createEffect, createSignal, onCleanup, ErrorBoundary } from "solid-js"
|
|
|
2
2
|
import { Panel, Plugin } from "@opencode/plugin/gui"
|
|
3
3
|
import { SchedulerRpc } from "./rpc.js"
|
|
4
4
|
import { loadHistory, loadMetrics, type HistoryRecord } from "./history.js"
|
|
5
|
-
import { normalizeLocale, normalizeLocaleMode, registerCatalog, setLocale, t, type LocaleMode, type TranslateParams, type Locale } from "./i18n.js"
|
|
5
|
+
import { DEFAULT_LOCALE, DEFAULT_LOCALE_MODE, normalizeLocale, normalizeLocaleMode, registerCatalog, setLocale, t, type LocaleMode, type TranslateParams, type Locale } from "./i18n.js"
|
|
6
6
|
// Каталоги встраиваются в бандл на этапе сборки: в webview OpenCode нет
|
|
7
7
|
// доступа к файлам пакета, поэтому ленивый fs-загрузчик из i18n.ts не работает.
|
|
8
8
|
import ruCatalog from "../locales/ru.json"
|
|
@@ -29,7 +29,7 @@ const applyLocale = (locale: unknown): void => {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/** Статус задачи для отображения в GUI. */
|
|
32
|
-
type JobStatus = "running" | "success" | "error" | "partial" | "idle" | "unknown"
|
|
32
|
+
type JobStatus = "running" | "success" | "error" | "partial" | "skipped" | "idle" | "unknown"
|
|
33
33
|
|
|
34
34
|
/** Per-workspace переопределения клона (Спринт 17). */
|
|
35
35
|
interface MatrixOverrideFields {
|
|
@@ -258,12 +258,67 @@ 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"
|
|
264
318
|
case "success": return "#34c759"
|
|
265
319
|
case "error": return "#ff3b30"
|
|
266
320
|
case "partial": return "#ff9f0a"
|
|
321
|
+
case "skipped": return "#5ac8fa"
|
|
267
322
|
default: return "#8e8e93"
|
|
268
323
|
}
|
|
269
324
|
}
|
|
@@ -418,7 +473,7 @@ export default Plugin.define({
|
|
|
418
473
|
const [winterMode, setWinterMode] = createSignal(false)
|
|
419
474
|
|
|
420
475
|
// Режим языка (T7): auto — следовать за локалью интерфейса OpenCode.
|
|
421
|
-
const [localeMode, setLocaleMode] = createSignal<LocaleMode>(
|
|
476
|
+
const [localeMode, setLocaleMode] = createSignal<LocaleMode>(DEFAULT_LOCALE_MODE)
|
|
422
477
|
// Последняя известная серверу локаль интерфейса (уведомления, дайджест, дашборд).
|
|
423
478
|
const [uiLocaleKnown, setUiLocaleKnown] = createSignal<Locale>("ru")
|
|
424
479
|
|
|
@@ -444,7 +499,7 @@ export default Plugin.define({
|
|
|
444
499
|
const app = appLocale()
|
|
445
500
|
if (mode !== "auto") return
|
|
446
501
|
applyLocale(app)
|
|
447
|
-
const resolved = normalizeLocale(app,
|
|
502
|
+
const resolved = normalizeLocale(app, DEFAULT_LOCALE)
|
|
448
503
|
if (resolved !== uiLocaleKnown()) {
|
|
449
504
|
setUiLocaleKnown(resolved)
|
|
450
505
|
void rpc.save_settings({ uiLocale: resolved }).catch((err: any) => {
|
|
@@ -547,7 +602,32 @@ export default Plugin.define({
|
|
|
547
602
|
const [secretName, setSecretName] = createSignal("")
|
|
548
603
|
const [secretValue, setSecretValue] = createSignal("")
|
|
549
604
|
|
|
605
|
+
// Durable-запуски (Спринт 36.8): пауза, комментарий и resume в GUI.
|
|
606
|
+
const [runPanelRuns, setRunPanelRuns] = createSignal<RunPanelRun[]>([])
|
|
607
|
+
const [runPanelActive, setRunPanelActive] = createSignal(0)
|
|
608
|
+
const [runPanelBusy, setRunPanelBusy] = createSignal(false)
|
|
609
|
+
const [runPanelCollapsed, setRunPanelCollapsed] = createSignal(true)
|
|
610
|
+
// AB-8: ad-hoc миссия без регистрации в ОС.
|
|
611
|
+
const [missionCollapsed, setMissionCollapsed] = createSignal(true)
|
|
612
|
+
const [missionPrompt, setMissionPrompt] = createSignal("")
|
|
613
|
+
const [missionCwd, setMissionCwd] = createSignal("")
|
|
614
|
+
const [missionGate, setMissionGate] = createSignal("")
|
|
615
|
+
const [missionModel, setMissionModel] = createSignal("")
|
|
616
|
+
const [missionTimeout, setMissionTimeout] = createSignal("")
|
|
617
|
+
const [missionPolicy, setMissionPolicy] = createSignal<"hybrid" | "secure" | "legacy">("hybrid")
|
|
618
|
+
const [missionSession, setMissionSession] = createSignal<"new" | "reuse" | "last">("new")
|
|
619
|
+
const [missionDryRun, setMissionDryRun] = createSignal(false)
|
|
620
|
+
const [missionBusy, setMissionBusy] = createSignal(false)
|
|
621
|
+
const [missionResult, setMissionResult] = createSignal("")
|
|
622
|
+
const [runPanelFilter, setRunPanelFilter] = createSignal<"active" | "all" | "running" | "paused" | "failed">("active")
|
|
623
|
+
const [runPanelComments, setRunPanelComments] = createSignal<Record<string, string>>({})
|
|
624
|
+
|
|
550
625
|
// Аудит (Спринт 26): журнал мутаций.
|
|
626
|
+
const [dlqEntries, setDlqEntries] = createSignal<DlqEntry[]>([])
|
|
627
|
+
const [dlqOpen, setDlqOpen] = createSignal(0)
|
|
628
|
+
const [dlqBusy, setDlqBusy] = createSignal(false)
|
|
629
|
+
const [dlqCollapsed, setDlqCollapsed] = createSignal(true)
|
|
630
|
+
const [dlqFilter, setDlqFilter] = createSignal<"open" | "all" | "retried" | "discarded">("open")
|
|
551
631
|
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
632
|
const [auditBusy, setAuditBusy] = createSignal(false)
|
|
553
633
|
const [auditCollapsed, setAuditCollapsed] = createSignal(true)
|
|
@@ -653,8 +733,8 @@ export default Plugin.define({
|
|
|
653
733
|
setAuditRetentionEnabled(Boolean(au?.enabled !== false))
|
|
654
734
|
setAuditRetentionDays(Number(au?.retentionDays ?? 90))
|
|
655
735
|
setAuditMaxRecords(Number(au?.maxRecords ?? 10000))
|
|
656
|
-
setUiLocaleKnown(normalizeLocale((s as { uiLocale?: string }).uiLocale,
|
|
657
|
-
const mode = normalizeLocaleMode((s as { locale?: string }).locale,
|
|
736
|
+
setUiLocaleKnown(normalizeLocale((s as { uiLocale?: string }).uiLocale, DEFAULT_LOCALE))
|
|
737
|
+
const mode = normalizeLocaleMode((s as { locale?: string }).locale, DEFAULT_LOCALE_MODE)
|
|
658
738
|
setLocaleMode(mode)
|
|
659
739
|
// При auto язык задаёт OpenCode: ответ сервера его не переопределяет.
|
|
660
740
|
applyLocaleMode(mode)
|
|
@@ -676,6 +756,8 @@ export default Plugin.define({
|
|
|
676
756
|
|
|
677
757
|
void loadSecretsGui()
|
|
678
758
|
void loadAuditGui()
|
|
759
|
+
void loadDlqGui()
|
|
760
|
+
void loadRunPanel()
|
|
679
761
|
}
|
|
680
762
|
|
|
681
763
|
/** Текущие настройки уведомлений из сигналов формы. */
|
|
@@ -790,8 +872,8 @@ export default Plugin.define({
|
|
|
790
872
|
setAuditRetentionDays(Number(au?.retentionDays ?? 90))
|
|
791
873
|
setAuditMaxRecords(Number(au?.maxRecords ?? 10000))
|
|
792
874
|
}
|
|
793
|
-
setUiLocaleKnown(normalizeLocale((s as { uiLocale?: string }).uiLocale,
|
|
794
|
-
const mode = normalizeLocaleMode((s as { locale?: string }).locale,
|
|
875
|
+
setUiLocaleKnown(normalizeLocale((s as { uiLocale?: string }).uiLocale, DEFAULT_LOCALE))
|
|
876
|
+
const mode = normalizeLocaleMode((s as { locale?: string }).locale, DEFAULT_LOCALE_MODE)
|
|
795
877
|
setLocaleMode(mode)
|
|
796
878
|
// При auto язык задаёт OpenCode: ответ сервера его не переопределяет.
|
|
797
879
|
applyLocaleMode(mode)
|
|
@@ -827,8 +909,8 @@ export default Plugin.define({
|
|
|
827
909
|
setHistoryMaxRecords(Number(h?.maxRecords ?? 5000))
|
|
828
910
|
setHistoryLastCleanupAt(h?.lastCleanupAt ?? null)
|
|
829
911
|
setHistoryLastCleanupDeleted(Number(h?.lastCleanupDeleted ?? 0))
|
|
830
|
-
setUiLocaleKnown(normalizeLocale((s as { uiLocale?: string }).uiLocale,
|
|
831
|
-
const mode = normalizeLocaleMode((s as { locale?: string }).locale,
|
|
912
|
+
setUiLocaleKnown(normalizeLocale((s as { uiLocale?: string }).uiLocale, DEFAULT_LOCALE))
|
|
913
|
+
const mode = normalizeLocaleMode((s as { locale?: string }).locale, DEFAULT_LOCALE_MODE)
|
|
832
914
|
setLocaleMode(mode)
|
|
833
915
|
// При auto язык задаёт OpenCode: ответ сервера его не переопределяет.
|
|
834
916
|
applyLocaleMode(mode)
|
|
@@ -930,6 +1012,215 @@ export default Plugin.define({
|
|
|
930
1012
|
await persistSettings({ audit: { enabled: auditRetentionEnabled(), retentionDays: auditRetentionDays(), maxRecords: auditMaxRecords() } })
|
|
931
1013
|
}
|
|
932
1014
|
|
|
1015
|
+
/** Загрузка durable-запусков (Спринт 36.8). */
|
|
1016
|
+
async function loadRunPanel() {
|
|
1017
|
+
setRunPanelBusy(true)
|
|
1018
|
+
try {
|
|
1019
|
+
const result = await rpc.list_durable_runs({ filter: runPanelFilter(), limit: 20 })
|
|
1020
|
+
if (result?.success) {
|
|
1021
|
+
setRunPanelRuns(result.runs ?? [])
|
|
1022
|
+
setRunPanelActive(Number(result.active ?? 0))
|
|
1023
|
+
} else if (result?.error) {
|
|
1024
|
+
console.error("RPC Error (list_durable_runs):", result.error)
|
|
1025
|
+
}
|
|
1026
|
+
} catch (err: any) {
|
|
1027
|
+
console.error("RPC Error (list_durable_runs):", err)
|
|
1028
|
+
} finally {
|
|
1029
|
+
setRunPanelBusy(false)
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/** AB-8: ad-hoc миссия через единый execution path, без записи в планировщик ОС. */
|
|
1034
|
+
async function handleRunMission() {
|
|
1035
|
+
const prompt = missionPrompt().trim()
|
|
1036
|
+
if (!prompt) {
|
|
1037
|
+
ctx.toast.show({
|
|
1038
|
+
title: gt("gui.missionTitle"),
|
|
1039
|
+
variant: "warning",
|
|
1040
|
+
description: gt("gui.missionEmptyPrompt"),
|
|
1041
|
+
})
|
|
1042
|
+
return
|
|
1043
|
+
}
|
|
1044
|
+
const timeoutNumber = Number(missionTimeout())
|
|
1045
|
+
setMissionBusy(true)
|
|
1046
|
+
setMissionResult("")
|
|
1047
|
+
try {
|
|
1048
|
+
const result: any = await rpc.run_mission({
|
|
1049
|
+
prompt,
|
|
1050
|
+
cwd: missionCwd().trim() || undefined,
|
|
1051
|
+
gate: missionGate().trim() || undefined,
|
|
1052
|
+
model: missionModel().trim() || undefined,
|
|
1053
|
+
timeoutSeconds:
|
|
1054
|
+
Number.isFinite(timeoutNumber) && timeoutNumber > 0 ? timeoutNumber : undefined,
|
|
1055
|
+
policy: missionPolicy(),
|
|
1056
|
+
session: missionSession(),
|
|
1057
|
+
dryRun: missionDryRun(),
|
|
1058
|
+
})
|
|
1059
|
+
if (result?.success) {
|
|
1060
|
+
ctx.toast.show({
|
|
1061
|
+
title: gt("gui.missionStarted"),
|
|
1062
|
+
variant: "success",
|
|
1063
|
+
description: result.runId ? `run: ${String(result.runId).slice(0, 8)}` : undefined,
|
|
1064
|
+
})
|
|
1065
|
+
} else {
|
|
1066
|
+
ctx.toast.show({
|
|
1067
|
+
title: gt("gui.missionFailed"),
|
|
1068
|
+
variant: "error",
|
|
1069
|
+
description: result?.error ?? gt("gui.runsUnknownError"),
|
|
1070
|
+
})
|
|
1071
|
+
}
|
|
1072
|
+
setMissionResult(
|
|
1073
|
+
[result?.description, result?.error].filter((line: unknown) => Boolean(line)).join("\n"),
|
|
1074
|
+
)
|
|
1075
|
+
await loadJobs()
|
|
1076
|
+
} catch (err: any) {
|
|
1077
|
+
console.error("RPC Error (run_mission):", err)
|
|
1078
|
+
ctx.toast.show({
|
|
1079
|
+
title: gt("gui.missionFailed"),
|
|
1080
|
+
variant: "error",
|
|
1081
|
+
description: errorMessage(err),
|
|
1082
|
+
})
|
|
1083
|
+
} finally {
|
|
1084
|
+
setMissionBusy(false)
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
/** Пауза с комментарием: следующий шаг получит его при resume. */
|
|
1089
|
+
async function handlePauseRun(run: RunPanelRun) {
|
|
1090
|
+
const comment = (runPanelComments()[run.id] ?? "").trim()
|
|
1091
|
+
if (!window.confirm(gt("gui.runsPauseConfirm", { task: run.taskName }))) return
|
|
1092
|
+
setRunPanelBusy(true)
|
|
1093
|
+
try {
|
|
1094
|
+
const result = await rpc.pause_durable_run({
|
|
1095
|
+
runId: run.id,
|
|
1096
|
+
comment: comment || undefined,
|
|
1097
|
+
author: "gui",
|
|
1098
|
+
})
|
|
1099
|
+
if (result?.success) {
|
|
1100
|
+
setRunPanelComments((prev) => ({ ...prev, [run.id]: "" }))
|
|
1101
|
+
ctx.toast.show({
|
|
1102
|
+
title: gt("gui.runsPaused"),
|
|
1103
|
+
variant: "success",
|
|
1104
|
+
description: gt("gui.runsPausedDescription", { step: result.stepName ?? "—" }),
|
|
1105
|
+
})
|
|
1106
|
+
} else {
|
|
1107
|
+
ctx.toast.show({
|
|
1108
|
+
title: gt("gui.runsPauseFailed"),
|
|
1109
|
+
variant: "error",
|
|
1110
|
+
description: result?.error ?? gt("gui.runsUnknownError"),
|
|
1111
|
+
})
|
|
1112
|
+
}
|
|
1113
|
+
await loadRunPanel()
|
|
1114
|
+
} catch (err: any) {
|
|
1115
|
+
console.error("RPC Error (pause_durable_run):", err)
|
|
1116
|
+
ctx.toast.show({ title: gt("gui.runsPauseFailed"), variant: "error", description: errorMessage(err) })
|
|
1117
|
+
} finally {
|
|
1118
|
+
setRunPanelBusy(false)
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
/** Resume только готовит запуск: снимает паузу и выбирает следующий шаг. */
|
|
1123
|
+
async function handleResumeRun(run: RunPanelRun) {
|
|
1124
|
+
if (!window.confirm(gt("gui.runsResumeConfirm", { task: run.taskName }))) return
|
|
1125
|
+
setRunPanelBusy(true)
|
|
1126
|
+
try {
|
|
1127
|
+
const result = await rpc.resume_durable_run({ runId: run.id })
|
|
1128
|
+
if (result?.success) {
|
|
1129
|
+
ctx.toast.show({
|
|
1130
|
+
title: gt("gui.runsResumed"),
|
|
1131
|
+
variant: "success",
|
|
1132
|
+
description: gt("gui.runsResumedDescription", { step: result.stepName ?? "—" }),
|
|
1133
|
+
})
|
|
1134
|
+
} else {
|
|
1135
|
+
ctx.toast.show({
|
|
1136
|
+
title: gt("gui.runsResumeFailed"),
|
|
1137
|
+
variant: "error",
|
|
1138
|
+
description: result?.error ?? gt("gui.runsUnknownError"),
|
|
1139
|
+
})
|
|
1140
|
+
}
|
|
1141
|
+
await loadRunPanel()
|
|
1142
|
+
} catch (err: any) {
|
|
1143
|
+
console.error("RPC Error (resume_durable_run):", err)
|
|
1144
|
+
ctx.toast.show({ title: gt("gui.runsResumeFailed"), variant: "error", description: errorMessage(err) })
|
|
1145
|
+
} finally {
|
|
1146
|
+
setRunPanelBusy(false)
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/** Загрузка dead-letter queue (Спринт 36.6). */
|
|
1151
|
+
async function loadDlqGui() {
|
|
1152
|
+
setDlqBusy(true)
|
|
1153
|
+
try {
|
|
1154
|
+
const result = await rpc.list_dlq({ status: dlqFilter(), limit: 100 })
|
|
1155
|
+
if (result?.success) {
|
|
1156
|
+
setDlqEntries(result.entries ?? [])
|
|
1157
|
+
setDlqOpen(Number(result.open ?? 0))
|
|
1158
|
+
} else if (result?.error) {
|
|
1159
|
+
console.error("RPC Error (list_dlq):", result.error)
|
|
1160
|
+
}
|
|
1161
|
+
} catch (err: any) {
|
|
1162
|
+
console.error("RPC Error (list_dlq):", err)
|
|
1163
|
+
} finally {
|
|
1164
|
+
setDlqBusy(false)
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/** Ручной retry записи DLQ: шаг вернётся в запуск, выполнение подхватит resume. */
|
|
1169
|
+
async function handleRetryDlq(entry: DlqEntry) {
|
|
1170
|
+
if (!window.confirm(gt("gui.dlqRetryConfirm", { step: entry.stepName, run: entry.runId }))) return
|
|
1171
|
+
setDlqBusy(true)
|
|
1172
|
+
try {
|
|
1173
|
+
const result = await rpc.retry_dlq({ id: entry.id })
|
|
1174
|
+
if (result?.success) {
|
|
1175
|
+
ctx.toast.show({
|
|
1176
|
+
title: gt("gui.dlqRetried"),
|
|
1177
|
+
variant: "success",
|
|
1178
|
+
description: gt("gui.dlqRetriedDescription", { step: entry.stepName }),
|
|
1179
|
+
})
|
|
1180
|
+
} else {
|
|
1181
|
+
ctx.toast.show({
|
|
1182
|
+
title: gt("gui.dlqRetryFailed"),
|
|
1183
|
+
variant: "error",
|
|
1184
|
+
description: result?.error ?? gt("gui.dlqUnknownError"),
|
|
1185
|
+
})
|
|
1186
|
+
}
|
|
1187
|
+
await loadDlqGui()
|
|
1188
|
+
} catch (err: any) {
|
|
1189
|
+
console.error("RPC Error (retry_dlq):", err)
|
|
1190
|
+
ctx.toast.show({ title: gt("gui.dlqRetryFailed"), variant: "error", description: errorMessage(err) })
|
|
1191
|
+
} finally {
|
|
1192
|
+
setDlqBusy(false)
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/** Осознанный отказ от повтора: запись закрывается, шаг остаётся failed. */
|
|
1197
|
+
async function handleDiscardDlq(entry: DlqEntry) {
|
|
1198
|
+
if (!window.confirm(gt("gui.dlqDiscardConfirm", { step: entry.stepName, run: entry.runId }))) return
|
|
1199
|
+
setDlqBusy(true)
|
|
1200
|
+
try {
|
|
1201
|
+
const result = await rpc.discard_dlq({ id: entry.id })
|
|
1202
|
+
if (result?.success) {
|
|
1203
|
+
ctx.toast.show({
|
|
1204
|
+
title: gt("gui.dlqDiscarded"),
|
|
1205
|
+
variant: "success",
|
|
1206
|
+
description: gt("gui.dlqDiscardedDescription", { step: entry.stepName }),
|
|
1207
|
+
})
|
|
1208
|
+
} else {
|
|
1209
|
+
ctx.toast.show({
|
|
1210
|
+
title: gt("gui.dlqDiscardFailed"),
|
|
1211
|
+
variant: "error",
|
|
1212
|
+
description: result?.error ?? gt("gui.dlqUnknownError"),
|
|
1213
|
+
})
|
|
1214
|
+
}
|
|
1215
|
+
await loadDlqGui()
|
|
1216
|
+
} catch (err: any) {
|
|
1217
|
+
console.error("RPC Error (discard_dlq):", err)
|
|
1218
|
+
ctx.toast.show({ title: gt("gui.dlqDiscardFailed"), variant: "error", description: errorMessage(err) })
|
|
1219
|
+
} finally {
|
|
1220
|
+
setDlqBusy(false)
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
|
|
933
1224
|
/** Кнопка «🧪 Тестовое уведомление». */
|
|
934
1225
|
async function handleTestNotification() {
|
|
935
1226
|
setTestNotificationBusy(true)
|
|
@@ -2487,6 +2778,8 @@ export default Plugin.define({
|
|
|
2487
2778
|
? gt("gui.jobStatus.error")
|
|
2488
2779
|
: job.status === "partial"
|
|
2489
2780
|
? gt("gui.jobStatus.partial")
|
|
2781
|
+
: job.status === "skipped"
|
|
2782
|
+
? gt("gui.jobStatus.skipped")
|
|
2490
2783
|
: job.status === "idle"
|
|
2491
2784
|
? gt("gui.jobStatus.never")
|
|
2492
2785
|
: gt("gui.jobStatus.unknown")}
|
|
@@ -2608,8 +2901,8 @@ export default Plugin.define({
|
|
|
2608
2901
|
history().map((r) => (
|
|
2609
2902
|
<div key={r.startedAt + r.durationMs} style="display:flex;align-items:flex-start;gap:10px;font-size:12px;color:#e0e0e0;padding:4px 0;border-bottom:1px solid #333">
|
|
2610
2903
|
<span style="color:#8e8e93;white-space:nowrap">{new Date(r.startedAt).toLocaleString()}</span>
|
|
2611
|
-
<span style={{color: r.status === "success" ? "#34c759" : "#ff3b30", fontWeight: 600, whiteSpace: "nowrap"}}>
|
|
2612
|
-
{r.status === "success" ? gt("gui.history.success") : gt("gui.history.error")}
|
|
2904
|
+
<span style={{color: r.status === "success" ? "#34c759" : r.status === "skipped" ? "#5ac8fa" : "#ff3b30", fontWeight: 600, whiteSpace: "nowrap"}}>
|
|
2905
|
+
{r.status === "success" ? gt("gui.history.success") : r.status === "skipped" ? gt("gui.history.skipped") : gt("gui.history.error")}
|
|
2613
2906
|
</span>
|
|
2614
2907
|
<span style="color:#b0b0b0;white-space:nowrap">{gt("gui.history.durationMs", { ms: r.durationMs })}</span>
|
|
2615
2908
|
{r.model && (
|
|
@@ -2733,7 +3026,7 @@ export default Plugin.define({
|
|
|
2733
3026
|
<select
|
|
2734
3027
|
value={localeMode()}
|
|
2735
3028
|
onChange={async (e) => {
|
|
2736
|
-
const next = normalizeLocaleMode(e.currentTarget.value,
|
|
3029
|
+
const next = normalizeLocaleMode(e.currentTarget.value, DEFAULT_LOCALE_MODE)
|
|
2737
3030
|
setLocaleMode(next)
|
|
2738
3031
|
applyLocaleMode(next)
|
|
2739
3032
|
await persistSettings({ locale: next })
|
|
@@ -3689,6 +3982,392 @@ export default Plugin.define({
|
|
|
3689
3982
|
)}
|
|
3690
3983
|
</div>
|
|
3691
3984
|
|
|
3985
|
+
{/* AB-8: ad-hoc миссия (CLI/RPC/GUI), без регистрации в ОС */}
|
|
3986
|
+
<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">
|
|
3987
|
+
<button
|
|
3988
|
+
onClick={() => setMissionCollapsed(!missionCollapsed())}
|
|
3989
|
+
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"
|
|
3990
|
+
>
|
|
3991
|
+
<span>{gt("gui.missionHeading")}</span>
|
|
3992
|
+
<span>{missionCollapsed() ? "▾" : "▴"}</span>
|
|
3993
|
+
</button>
|
|
3994
|
+
{!missionCollapsed() && (
|
|
3995
|
+
<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px">
|
|
3996
|
+
<div style="font-size:11px;color:#8e8e93">{gt("gui.missionHint")}</div>
|
|
3997
|
+
<textarea
|
|
3998
|
+
value={missionPrompt()}
|
|
3999
|
+
onInput={(e) => setMissionPrompt(e.currentTarget.value)}
|
|
4000
|
+
placeholder={gt("gui.promptPlaceholder")}
|
|
4001
|
+
rows={4}
|
|
4002
|
+
style="width:100%;box-sizing:border-box;padding:8px;background:#0f0f0f;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;resize:vertical;outline:none"
|
|
4003
|
+
/>
|
|
4004
|
+
<div style="display:flex;gap:8px;flex-wrap:wrap">
|
|
4005
|
+
<input
|
|
4006
|
+
value={missionCwd()}
|
|
4007
|
+
onInput={(e) => setMissionCwd(e.currentTarget.value)}
|
|
4008
|
+
placeholder={gt("gui.missionCwdPlaceholder")}
|
|
4009
|
+
style="flex:1 1 260px;min-width:180px;padding:6px 8px;background:#0f0f0f;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"
|
|
4010
|
+
/>
|
|
4011
|
+
<input
|
|
4012
|
+
value={missionModel()}
|
|
4013
|
+
onInput={(e) => setMissionModel(e.currentTarget.value)}
|
|
4014
|
+
placeholder={gt("gui.modelPlaceholder")}
|
|
4015
|
+
style="flex:0 1 200px;padding:6px 8px;background:#0f0f0f;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"
|
|
4016
|
+
/>
|
|
4017
|
+
<input
|
|
4018
|
+
value={missionTimeout()}
|
|
4019
|
+
onInput={(e) => setMissionTimeout(e.currentTarget.value)}
|
|
4020
|
+
placeholder={gt("gui.missionTimeout")}
|
|
4021
|
+
inputMode="numeric"
|
|
4022
|
+
style="width:130px;padding:6px 8px;background:#0f0f0f;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"
|
|
4023
|
+
/>
|
|
4024
|
+
</div>
|
|
4025
|
+
<input
|
|
4026
|
+
value={missionGate()}
|
|
4027
|
+
onInput={(e) => setMissionGate(e.currentTarget.value)}
|
|
4028
|
+
placeholder={gt("gui.qualityGatePlaceholder")}
|
|
4029
|
+
style="width:100%;box-sizing:border-box;padding:6px 8px;background:#0f0f0f;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"
|
|
4030
|
+
/>
|
|
4031
|
+
<div style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
|
4032
|
+
<label style="font-size:11px;color:#8e8e93">{gt("gui.missionPolicy")}</label>
|
|
4033
|
+
<select
|
|
4034
|
+
value={missionPolicy()}
|
|
4035
|
+
onChange={(e) => setMissionPolicy(e.currentTarget.value as "hybrid" | "secure" | "legacy")}
|
|
4036
|
+
style="padding:4px 6px;background:#0f0f0f;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
4037
|
+
>
|
|
4038
|
+
<option value="hybrid">{gt("gui.missionPolicyHybrid")}</option>
|
|
4039
|
+
<option value="secure">{gt("gui.missionPolicySecure")}</option>
|
|
4040
|
+
<option value="legacy">{gt("gui.missionPolicyLegacy")}</option>
|
|
4041
|
+
</select>
|
|
4042
|
+
<label style="font-size:11px;color:#8e8e93">{gt("gui.sessionLabel")}</label>
|
|
4043
|
+
<select
|
|
4044
|
+
value={missionSession()}
|
|
4045
|
+
onChange={(e) => setMissionSession(e.currentTarget.value as "new" | "reuse" | "last")}
|
|
4046
|
+
style="padding:4px 6px;background:#0f0f0f;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
4047
|
+
>
|
|
4048
|
+
<option value="new">{gt("gui.sessionNew")}</option>
|
|
4049
|
+
<option value="reuse">{gt("gui.sessionReuse")}</option>
|
|
4050
|
+
<option value="last">{gt("gui.sessionContinue")}</option>
|
|
4051
|
+
</select>
|
|
4052
|
+
<label style="display:flex;align-items:center;gap:6px;font-size:11px;color:#8e8e93">
|
|
4053
|
+
<input
|
|
4054
|
+
type="checkbox"
|
|
4055
|
+
checked={missionDryRun()}
|
|
4056
|
+
onChange={(e) => setMissionDryRun(e.currentTarget.checked)}
|
|
4057
|
+
/>
|
|
4058
|
+
{gt("gui.missionDryRun")}
|
|
4059
|
+
</label>
|
|
4060
|
+
<button
|
|
4061
|
+
onClick={() => void handleRunMission()}
|
|
4062
|
+
disabled={missionBusy()}
|
|
4063
|
+
style={missionBusy()
|
|
4064
|
+
? "margin-left:auto;padding:6px 12px;background:#666;color:white;border:none;border-radius:6px;cursor:not-allowed;font-size:12px;font-weight:500;opacity:0.6"
|
|
4065
|
+
: "margin-left:auto;padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:pointer;font-size:12px;font-weight:500;opacity:1"}
|
|
4066
|
+
>
|
|
4067
|
+
{missionBusy() ? gt("gui.loading") : gt("gui.missionRun")}
|
|
4068
|
+
</button>
|
|
4069
|
+
</div>
|
|
4070
|
+
{missionResult() && (
|
|
4071
|
+
<pre style="margin:0;padding:8px;background:#0f0f0f;border:1px solid #333;border-radius:6px;color:#e0e0e0;font-size:11px;white-space:pre-wrap;word-break:break-word">
|
|
4072
|
+
{missionResult()}
|
|
4073
|
+
</pre>
|
|
4074
|
+
)}
|
|
4075
|
+
</div>
|
|
4076
|
+
)}
|
|
4077
|
+
</div>
|
|
4078
|
+
|
|
4079
|
+
{/* ⏯️ Durable-запуски: пауза и resume (Спринт 36.8) */}
|
|
4080
|
+
<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">
|
|
4081
|
+
<button
|
|
4082
|
+
onClick={() => setRunPanelCollapsed(!runPanelCollapsed())}
|
|
4083
|
+
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"
|
|
4084
|
+
>
|
|
4085
|
+
<span>{gt("gui.runsHeading")}</span>
|
|
4086
|
+
<span style="display:flex;align-items:center;gap:8px;font-size:11px;font-weight:400;color:#8e8e93">
|
|
4087
|
+
{gt("gui.runsActiveCount", { count: runPanelActive() })}
|
|
4088
|
+
<span>{runPanelCollapsed() ? "▾" : "▴"}</span>
|
|
4089
|
+
</span>
|
|
4090
|
+
</button>
|
|
4091
|
+
|
|
4092
|
+
{!runPanelCollapsed() && (
|
|
4093
|
+
<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px">
|
|
4094
|
+
<div style="font-size:11px;color:#8e8e93">{gt("gui.runsHint")}</div>
|
|
4095
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
4096
|
+
<label style="font-size:12px;color:#e0e0e0;white-space:nowrap">{gt("gui.runsFilter")}</label>
|
|
4097
|
+
<select
|
|
4098
|
+
value={runPanelFilter()}
|
|
4099
|
+
onChange={(e) => {
|
|
4100
|
+
setRunPanelFilter(e.currentTarget.value as "active" | "all" | "running" | "paused" | "failed")
|
|
4101
|
+
void loadRunPanel()
|
|
4102
|
+
}}
|
|
4103
|
+
style="padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
4104
|
+
>
|
|
4105
|
+
<option value="active">{gt("gui.runsFilterActive")}</option>
|
|
4106
|
+
<option value="all">{gt("gui.runsFilterAll")}</option>
|
|
4107
|
+
<option value="running">{gt("gui.runsFilterRunning")}</option>
|
|
4108
|
+
<option value="paused">{gt("gui.runsFilterPaused")}</option>
|
|
4109
|
+
<option value="failed">{gt("gui.runsFilterFailed")}</option>
|
|
4110
|
+
</select>
|
|
4111
|
+
<button
|
|
4112
|
+
onClick={() => void loadRunPanel()}
|
|
4113
|
+
disabled={runPanelBusy()}
|
|
4114
|
+
style={runPanelBusy()
|
|
4115
|
+
? "padding:6px 12px;background:#666;color:white;border:none;border-radius:6px;cursor:not-allowed;font-size:12px;font-weight:500;opacity:0.6"
|
|
4116
|
+
: "padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:pointer;font-size:12px;font-weight:500;opacity:1"}
|
|
4117
|
+
>
|
|
4118
|
+
{runPanelBusy() ? gt("gui.loading") : gt("gui.refresh")}
|
|
4119
|
+
</button>
|
|
4120
|
+
</div>
|
|
4121
|
+
|
|
4122
|
+
{runPanelRuns().map((run) => (
|
|
4123
|
+
<div style="border:1px solid #333;border-radius:8px;background:#0f0f0f;padding:10px;display:flex;flex-direction:column;gap:8px">
|
|
4124
|
+
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap">
|
|
4125
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
4126
|
+
<span style="color:#5ac8fa;font-weight:600;font-size:12px">{run.taskName}</span>
|
|
4127
|
+
<span style="font-size:10px;color:#8e8e93">run: {run.id.slice(0, 8)}</span>
|
|
4128
|
+
<span
|
|
4129
|
+
style={`font-size:10px;font-weight:600;padding:2px 7px;border-radius:999px;border:1px solid ${
|
|
4130
|
+
run.status === "paused"
|
|
4131
|
+
? "#ff9f0a"
|
|
4132
|
+
: run.status === "running"
|
|
4133
|
+
? "#f5a623"
|
|
4134
|
+
: run.status === "failed"
|
|
4135
|
+
? "#ff3b30"
|
|
4136
|
+
: run.status === "passed"
|
|
4137
|
+
? "#34c759"
|
|
4138
|
+
: "#555"
|
|
4139
|
+
};color:#e0e0e0`}
|
|
4140
|
+
>
|
|
4141
|
+
{run.status}
|
|
4142
|
+
</span>
|
|
4143
|
+
</div>
|
|
4144
|
+
<span style="font-size:10px;color:#8e8e93">
|
|
4145
|
+
{gt("gui.runsProgress", { done: run.doneSteps, total: run.totalSteps })}
|
|
4146
|
+
</span>
|
|
4147
|
+
</div>
|
|
4148
|
+
|
|
4149
|
+
<div style="font-size:11px;color:#e0e0e0">
|
|
4150
|
+
{run.currentStep ? (
|
|
4151
|
+
<span>
|
|
4152
|
+
{gt("gui.runsCurrentStep")}{" "}
|
|
4153
|
+
<a href={`#${run.currentStep.anchor}`} style="color:#5ac8fa;text-decoration:none">
|
|
4154
|
+
{run.currentStep.stepName}
|
|
4155
|
+
</a>{" "}
|
|
4156
|
+
<span style="color:#8e8e93">
|
|
4157
|
+
· {run.currentStep.status} · attempt {run.currentStep.attempt}
|
|
4158
|
+
</span>
|
|
4159
|
+
</span>
|
|
4160
|
+
) : (
|
|
4161
|
+
<span style="color:#8e8e93">{gt("gui.runsNoCurrentStep")}</span>
|
|
4162
|
+
)}
|
|
4163
|
+
</div>
|
|
4164
|
+
|
|
4165
|
+
{run.currentStep?.status === "running" && (
|
|
4166
|
+
<div style="font-size:11px;color:#ff9f0a;background:#2a1f00;border:1px solid #5a3d00;border-radius:6px;padding:6px 8px">
|
|
4167
|
+
{gt("gui.runsRunningWarning")}
|
|
4168
|
+
</div>
|
|
4169
|
+
)}
|
|
4170
|
+
|
|
4171
|
+
{(run.status === "pending" || run.status === "running") && (
|
|
4172
|
+
<div style="display:flex;align-items:center;gap:6px;flex-wrap:wrap">
|
|
4173
|
+
<input
|
|
4174
|
+
type="text"
|
|
4175
|
+
value={runPanelComments()[run.id] ?? ""}
|
|
4176
|
+
placeholder={gt("gui.runsCommentPlaceholder")}
|
|
4177
|
+
onInput={(e) =>
|
|
4178
|
+
setRunPanelComments((prev) => ({ ...prev, [run.id]: e.currentTarget.value }))
|
|
4179
|
+
}
|
|
4180
|
+
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"
|
|
4181
|
+
/>
|
|
4182
|
+
<button
|
|
4183
|
+
onClick={() => void handlePauseRun(run)}
|
|
4184
|
+
disabled={runPanelBusy() || run.currentStep?.status === "running"}
|
|
4185
|
+
title={run.currentStep?.status === "running"
|
|
4186
|
+
? gt("gui.runsRunningWarning")
|
|
4187
|
+
: gt("gui.runsPauseTitle")}
|
|
4188
|
+
style={runPanelBusy() || run.currentStep?.status === "running"
|
|
4189
|
+
? "padding:5px 10px;background:#666;color:white;border:none;border-radius:5px;cursor:not-allowed;font-size:11px;opacity:0.6"
|
|
4190
|
+
: "padding:5px 10px;background:#ff9f0a;color:#1a1a1a;border:none;border-radius:5px;cursor:pointer;font-size:11px;font-weight:600"}
|
|
4191
|
+
>
|
|
4192
|
+
⏸ {gt("gui.runsPause")}
|
|
4193
|
+
</button>
|
|
4194
|
+
</div>
|
|
4195
|
+
)}
|
|
4196
|
+
|
|
4197
|
+
{(run.status === "paused" || run.status === "failed") && (
|
|
4198
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
4199
|
+
<button
|
|
4200
|
+
onClick={() => void handleResumeRun(run)}
|
|
4201
|
+
disabled={runPanelBusy()}
|
|
4202
|
+
title={gt("gui.runsResumeTitle")}
|
|
4203
|
+
style="padding:5px 10px;background:#34c759;color:#0a1a0a;border:none;border-radius:5px;cursor:pointer;font-size:11px;font-weight:600"
|
|
4204
|
+
>
|
|
4205
|
+
▶ {gt("gui.runsResume")}
|
|
4206
|
+
</button>
|
|
4207
|
+
<span style="font-size:10px;color:#8e8e93">{gt("gui.runsResumeHint")}</span>
|
|
4208
|
+
</div>
|
|
4209
|
+
)}
|
|
4210
|
+
|
|
4211
|
+
{run.error && (
|
|
4212
|
+
<div style="font-size:11px;color:#ff9f0a;overflow-wrap:anywhere">{shortError(run.error)}</div>
|
|
4213
|
+
)}
|
|
4214
|
+
|
|
4215
|
+
<div style="display:flex;flex-direction:column;gap:3px">
|
|
4216
|
+
{run.steps.map((step) => (
|
|
4217
|
+
<div
|
|
4218
|
+
id={step.anchor}
|
|
4219
|
+
style="display:flex;align-items:center;gap:8px;font-size:11px;padding:3px 5px;border-radius:4px;background:#161616"
|
|
4220
|
+
>
|
|
4221
|
+
<span style="width:18px;color:#8e8e93;text-align:right">{step.position}</span>
|
|
4222
|
+
<span style="flex:1;color:#e0e0e0;overflow-wrap:anywhere">{step.stepName}</span>
|
|
4223
|
+
<span style="color:#8e8e93">{step.status}</span>
|
|
4224
|
+
<span style="color:#8e8e93">#{step.attempt}</span>
|
|
4225
|
+
{step.error && (
|
|
4226
|
+
<span style="color:#ff9f0a;max-width:260px;overflow-wrap:anywhere" title={step.error}>
|
|
4227
|
+
{shortError(step.error, 80)}
|
|
4228
|
+
</span>
|
|
4229
|
+
)}
|
|
4230
|
+
</div>
|
|
4231
|
+
))}
|
|
4232
|
+
</div>
|
|
4233
|
+
|
|
4234
|
+
{run.injections.length > 0 && (
|
|
4235
|
+
<div style="border-top:1px solid #222;padding-top:6px;display:flex;flex-direction:column;gap:4px">
|
|
4236
|
+
<div style="font-size:10px;color:#8e8e93">
|
|
4237
|
+
{gt("gui.runsContextHistory", { count: run.injections.length })}
|
|
4238
|
+
</div>
|
|
4239
|
+
{run.injections.slice(-3).map((injection) => (
|
|
4240
|
+
<div style="font-size:10px;color:#c7c7cc">
|
|
4241
|
+
<span style="color:#5ac8fa">{injection.author}</span>
|
|
4242
|
+
<span style="color:#8e8e93"> · {injection.kind} · {new Date(injection.createdAt).toLocaleString()}</span>
|
|
4243
|
+
{injection.consumedAt ? (
|
|
4244
|
+
<span style="color:#34c759"> · {gt("gui.runsConsumedBy", { step: injection.consumedByStep ?? "—" })}</span>
|
|
4245
|
+
) : (
|
|
4246
|
+
<span style="color:#ff9f0a"> · {gt("gui.runsPending")}</span>
|
|
4247
|
+
)}
|
|
4248
|
+
<div style="color:#e0e0e0;overflow-wrap:anywhere">{injection.content}</div>
|
|
4249
|
+
</div>
|
|
4250
|
+
))}
|
|
4251
|
+
</div>
|
|
4252
|
+
)}
|
|
4253
|
+
</div>
|
|
4254
|
+
))}
|
|
4255
|
+
|
|
4256
|
+
{runPanelRuns().length === 0 && (
|
|
4257
|
+
<div style="font-size:11px;color:#8e8e93;padding:6px 0">{gt("gui.runsEmpty")}</div>
|
|
4258
|
+
)}
|
|
4259
|
+
</div>
|
|
4260
|
+
)}
|
|
4261
|
+
</div>
|
|
4262
|
+
|
|
4263
|
+
{/* ♻️ Dead-letter queue (Спринт 36.6) */}
|
|
4264
|
+
<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">
|
|
4265
|
+
<button
|
|
4266
|
+
onClick={() => setDlqCollapsed(!dlqCollapsed())}
|
|
4267
|
+
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"
|
|
4268
|
+
>
|
|
4269
|
+
<span>{gt("gui.dlqHeading")}</span>
|
|
4270
|
+
<span style="display:flex;align-items:center;gap:8px;font-size:11px;font-weight:400;color:#8e8e93">
|
|
4271
|
+
{gt("gui.dlqOpenCount", { count: dlqOpen() })}
|
|
4272
|
+
<span>{dlqCollapsed() ? "▾" : "▴"}</span>
|
|
4273
|
+
</span>
|
|
4274
|
+
</button>
|
|
4275
|
+
|
|
4276
|
+
{!dlqCollapsed() && (
|
|
4277
|
+
<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px">
|
|
4278
|
+
<div style="font-size:11px;color:#8e8e93">{gt("gui.dlqHint")}</div>
|
|
4279
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
4280
|
+
<label style="font-size:12px;color:#e0e0e0;white-space:nowrap">{gt("gui.dlqFilter")}</label>
|
|
4281
|
+
<select
|
|
4282
|
+
value={dlqFilter()}
|
|
4283
|
+
onChange={(e) => {
|
|
4284
|
+
setDlqFilter(e.currentTarget.value as "open" | "all" | "retried" | "discarded")
|
|
4285
|
+
void loadDlqGui()
|
|
4286
|
+
}}
|
|
4287
|
+
style="padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
4288
|
+
>
|
|
4289
|
+
<option value="open">{gt("gui.dlqFilterOpen")}</option>
|
|
4290
|
+
<option value="all">{gt("gui.dlqFilterAll")}</option>
|
|
4291
|
+
<option value="retried">{gt("gui.dlqFilterRetried")}</option>
|
|
4292
|
+
<option value="discarded">{gt("gui.dlqFilterDiscarded")}</option>
|
|
4293
|
+
</select>
|
|
4294
|
+
<button
|
|
4295
|
+
onClick={() => void loadDlqGui()}
|
|
4296
|
+
disabled={dlqBusy()}
|
|
4297
|
+
style={dlqBusy()
|
|
4298
|
+
? "padding:6px 12px;background:#666;color:white;border:none;border-radius:6px;cursor:not-allowed;font-size:12px;font-weight:500;opacity:0.6"
|
|
4299
|
+
: "padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:pointer;font-size:12px;font-weight:500;opacity:1"}
|
|
4300
|
+
>
|
|
4301
|
+
{dlqBusy() ? gt("gui.loading") : gt("gui.refresh")}
|
|
4302
|
+
</button>
|
|
4303
|
+
</div>
|
|
4304
|
+
<div style="width:100%;overflow:auto;border:1px solid #333;border-radius:6px;background:#0f0f0f">
|
|
4305
|
+
<table style="width:100%;border-collapse:collapse;font-size:11px">
|
|
4306
|
+
<thead>
|
|
4307
|
+
<tr style="border-bottom:1px solid #333">
|
|
4308
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqCreated")}</th>
|
|
4309
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqRun")}</th>
|
|
4310
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqReason")}</th>
|
|
4311
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqAttempts")}</th>
|
|
4312
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqError")}</th>
|
|
4313
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">{gt("gui.dlqActions")}</th>
|
|
4314
|
+
</tr>
|
|
4315
|
+
</thead>
|
|
4316
|
+
<tbody>
|
|
4317
|
+
{dlqEntries().map((entry) => (
|
|
4318
|
+
<tr key={entry.id} style="border-bottom:1px solid #222">
|
|
4319
|
+
<td style="padding:5px 8px;color:#8e8e93;white-space:nowrap">{new Date(entry.createdAt).toLocaleString()}</td>
|
|
4320
|
+
<td style="padding:5px 8px;color:#e0e0e0">
|
|
4321
|
+
<div style="color:#5ac8fa">{entry.stepName}</div>
|
|
4322
|
+
<div style="color:#8e8e93;font-size:10px">run: {entry.runId}</div>
|
|
4323
|
+
</td>
|
|
4324
|
+
<td style="padding:5px 8px;color:#e0e0e0;white-space:nowrap">
|
|
4325
|
+
{entry.reason === "attempts-exhausted"
|
|
4326
|
+
? gt("gui.dlqReasonAttempts")
|
|
4327
|
+
: entry.reason === "manual"
|
|
4328
|
+
? gt("gui.dlqReasonManual")
|
|
4329
|
+
: (entry.reason ?? "—")}
|
|
4330
|
+
</td>
|
|
4331
|
+
<td style="padding:5px 8px;color:#e0e0e0">{entry.attempts}</td>
|
|
4332
|
+
<td style="padding:5px 8px;color:#ff9f0a;max-width:280px;overflow-wrap:anywhere" title={entry.error ?? ""}>{entry.error ? shortError(entry.error) : "—"}</td>
|
|
4333
|
+
<td style="padding:5px 8px;white-space:nowrap">
|
|
4334
|
+
{entry.status === "open" ? (
|
|
4335
|
+
<div style="display:flex;align-items:center;gap:6px">
|
|
4336
|
+
<button
|
|
4337
|
+
onClick={() => void handleRetryDlq(entry)}
|
|
4338
|
+
disabled={dlqBusy()}
|
|
4339
|
+
title={gt("gui.dlqRetryTitle")}
|
|
4340
|
+
style="padding:3px 8px;background:#007acc;color:white;border:none;border-radius:5px;cursor:pointer;font-size:11px"
|
|
4341
|
+
>
|
|
4342
|
+
↻ {gt("gui.dlqRetry")}
|
|
4343
|
+
</button>
|
|
4344
|
+
<button
|
|
4345
|
+
onClick={() => void handleDiscardDlq(entry)}
|
|
4346
|
+
disabled={dlqBusy()}
|
|
4347
|
+
title={gt("gui.dlqDiscardTitle")}
|
|
4348
|
+
style="padding:3px 8px;background:#3a3a3c;color:#e0e0e0;border:none;border-radius:5px;cursor:pointer;font-size:11px"
|
|
4349
|
+
>
|
|
4350
|
+
✕ {gt("gui.dlqDiscard")}
|
|
4351
|
+
</button>
|
|
4352
|
+
</div>
|
|
4353
|
+
) : (
|
|
4354
|
+
<span style="color:#8e8e93">{entry.status}{entry.resolution ? ` · ${entry.resolution}` : ""}</span>
|
|
4355
|
+
)}
|
|
4356
|
+
</td>
|
|
4357
|
+
</tr>
|
|
4358
|
+
))}
|
|
4359
|
+
{dlqEntries().length === 0 && (
|
|
4360
|
+
<tr>
|
|
4361
|
+
<td colspan="6" style="padding:8px;color:#8e8e93">{gt("gui.dlqEmpty")}</td>
|
|
4362
|
+
</tr>
|
|
4363
|
+
)}
|
|
4364
|
+
</tbody>
|
|
4365
|
+
</table>
|
|
4366
|
+
</div>
|
|
4367
|
+
</div>
|
|
4368
|
+
)}
|
|
4369
|
+
</div>
|
|
4370
|
+
|
|
3692
4371
|
{/* 📜 Журнал аудита (Спринт 26) */}
|
|
3693
4372
|
<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
4373
|
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px">
|