opencode-windows-scheduler 0.0.0-stage → 1.0.0
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 -0
- package/CROSS_PLATFORM.md +113 -0
- package/LICENSE +21 -0
- package/README.md +173 -2
- package/README.ru.md +131 -0
- package/ROADMAP-STRATEGY.md +217 -0
- package/ROADMAP.md +87 -0
- package/dist/core/cron-to-schtasks.d.ts +20 -0
- package/dist/core/cron-to-schtasks.d.ts.map +1 -0
- package/dist/core/cron-to-schtasks.js +233 -0
- package/dist/core/dry-run.d.ts +44 -0
- package/dist/core/dry-run.d.ts.map +1 -0
- package/dist/core/dry-run.js +252 -0
- package/dist/core/file-watcher.d.ts +31 -0
- package/dist/core/file-watcher.d.ts.map +1 -0
- package/dist/core/file-watcher.js +128 -0
- package/dist/core/lock.d.ts +43 -0
- package/dist/core/lock.d.ts.map +1 -0
- package/dist/core/lock.js +118 -0
- package/dist/core/matrix.d.ts +167 -0
- package/dist/core/matrix.d.ts.map +1 -0
- package/dist/core/matrix.js +687 -0
- package/dist/core/ps-wrapper.d.ts +60 -0
- package/dist/core/ps-wrapper.d.ts.map +1 -0
- package/dist/core/ps-wrapper.js +538 -0
- package/dist/core/record-history.d.ts +14 -0
- package/dist/core/record-history.d.ts.map +1 -0
- package/dist/core/record-history.js +360 -0
- package/dist/core/scheduler/index.d.ts +20 -0
- package/dist/core/scheduler/index.d.ts.map +1 -0
- package/dist/core/scheduler/index.js +32 -0
- package/dist/core/scheduler/linux.d.ts +32 -0
- package/dist/core/scheduler/linux.d.ts.map +1 -0
- package/dist/core/scheduler/linux.js +115 -0
- package/dist/core/scheduler/logs.d.ts +11 -0
- package/dist/core/scheduler/logs.d.ts.map +1 -0
- package/dist/core/scheduler/logs.js +34 -0
- package/dist/core/scheduler/mac.d.ts +39 -0
- package/dist/core/scheduler/mac.d.ts.map +1 -0
- package/dist/core/scheduler/mac.js +175 -0
- package/dist/core/scheduler/posix.d.ts +40 -0
- package/dist/core/scheduler/posix.d.ts.map +1 -0
- package/dist/core/scheduler/posix.js +86 -0
- package/dist/core/scheduler/registry.d.ts +36 -0
- package/dist/core/scheduler/registry.d.ts.map +1 -0
- package/dist/core/scheduler/registry.js +56 -0
- package/dist/core/scheduler/types.d.ts +63 -0
- package/dist/core/scheduler/types.d.ts.map +1 -0
- package/dist/core/scheduler/types.js +1 -0
- package/dist/core/scheduler/windows.d.ts +47 -0
- package/dist/core/scheduler/windows.d.ts.map +1 -0
- package/dist/core/scheduler/windows.js +375 -0
- package/dist/core/wrappers/bash.d.ts +58 -0
- package/dist/core/wrappers/bash.d.ts.map +1 -0
- package/dist/core/wrappers/bash.js +223 -0
- package/dist/db/history-repo.d.ts +69 -0
- package/dist/db/history-repo.d.ts.map +1 -0
- package/dist/db/history-repo.js +150 -0
- package/dist/db/index.d.ts +47 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +120 -0
- package/dist/db/metrics-repo.d.ts +43 -0
- package/dist/db/metrics-repo.d.ts.map +1 -0
- package/dist/db/metrics-repo.js +95 -0
- package/dist/db/migrate.d.ts +24 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +237 -0
- package/dist/db/recovery.d.ts +11 -0
- package/dist/db/recovery.d.ts.map +1 -0
- package/dist/db/recovery.js +38 -0
- package/dist/db/schema.d.ts +24 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +97 -0
- package/dist/db/settings-repo.d.ts +8 -0
- package/dist/db/settings-repo.d.ts.map +1 -0
- package/dist/db/settings-repo.js +27 -0
- package/dist/db/tasks-repo.d.ts +26 -0
- package/dist/db/tasks-repo.d.ts.map +1 -0
- package/dist/db/tasks-repo.js +120 -0
- package/dist/db/templates-repo.d.ts +17 -0
- package/dist/db/templates-repo.d.ts.map +1 -0
- package/dist/db/templates-repo.js +57 -0
- package/dist/gui-experimental.cjs +1 -0
- package/dist/history.d.ts +53 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +57 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2077 -0
- package/dist/notifications.d.ts +45 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +135 -0
- package/dist/rpc.d.ts +2052 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +863 -0
- package/dist/schtasks.d.ts +32 -0
- package/dist/schtasks.d.ts.map +1 -0
- package/dist/schtasks.js +45 -0
- package/dist/server.d.ts +106 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1478 -0
- package/dist/settings.d.ts +43 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +96 -0
- package/dist/shared/jobs-view.d.ts +21 -0
- package/dist/shared/jobs-view.d.ts.map +1 -0
- package/dist/shared/jobs-view.js +28 -0
- package/dist/skill.d.ts +15 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +93 -0
- package/dist/task-transfer.d.ts +176 -0
- package/dist/task-transfer.d.ts.map +1 -0
- package/dist/task-transfer.js +442 -0
- package/dist/templates.d.ts +57 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +16 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +88 -0
- package/dist/workspaces.d.ts +55 -0
- package/dist/workspaces.d.ts.map +1 -0
- package/dist/workspaces.js +183 -0
- package/docs/ARCHITECTURE.md +302 -0
- package/docs/FEATURES.md +288 -0
- package/docs/MIGRATION.md +266 -0
- package/docs/dashboard.png +0 -0
- package/gui-experimental.cjs +2 -0
- package/index.js +1 -0
- package/package.json +92 -4
- package/scripts/demo-dashboard.mjs +199 -0
- package/skills/scheduled-job-best-practices/SKILL.md +155 -0
- package/skills/scheduled-job-best-practices/references/recipes.md +123 -0
- package/src/core/cron-to-schtasks.ts +269 -0
- package/src/core/dry-run.ts +315 -0
- package/src/core/file-watcher.ts +171 -0
- package/src/core/lock.ts +134 -0
- package/src/core/matrix.ts +907 -0
- package/src/core/ps-wrapper.ts +572 -0
- package/src/core/record-history.ts +493 -0
- package/src/core/scheduler/index.ts +44 -0
- package/src/core/scheduler/linux.ts +125 -0
- package/src/core/scheduler/logs.ts +37 -0
- package/src/core/scheduler/mac.ts +222 -0
- package/src/core/scheduler/posix.ts +111 -0
- package/src/core/scheduler/registry.ts +93 -0
- package/src/core/scheduler/types.ts +67 -0
- package/src/core/scheduler/windows.ts +469 -0
- package/src/core/wrappers/bash.ts +282 -0
- package/src/db/history-repo.ts +303 -0
- package/src/db/index.ts +166 -0
- package/src/db/metrics-repo.ts +158 -0
- package/src/db/migrate.ts +322 -0
- package/src/db/recovery.ts +46 -0
- package/src/db/schema.ts +109 -0
- package/src/db/settings-repo.ts +31 -0
- package/src/db/tasks-repo.ts +162 -0
- package/src/db/templates-repo.ts +77 -0
- package/src/gui.tsx +2725 -0
- package/src/history.ts +107 -0
- package/src/index.ts +2672 -0
- package/src/notifications.ts +174 -0
- package/src/rpc.ts +933 -0
- package/src/schtasks.ts +75 -0
- package/src/server.ts +1663 -0
- package/src/settings.ts +157 -0
- package/src/shared/jobs-view.ts +38 -0
- package/src/skill.ts +113 -0
- package/src/task-transfer.ts +648 -0
- package/src/templates.ts +67 -0
- package/src/tui.tsx +46 -0
- package/src/types.ts +145 -0
- package/src/workspaces.ts +236 -0
package/src/gui.tsx
ADDED
|
@@ -0,0 +1,2725 @@
|
|
|
1
|
+
import { createSignal, onCleanup, ErrorBoundary } from "solid-js"
|
|
2
|
+
import { Panel, Plugin } from "@opencode/plugin/gui"
|
|
3
|
+
import { SchedulerRpc } from "./rpc.js"
|
|
4
|
+
import { loadHistory, loadMetrics, type HistoryRecord } from "./history.js"
|
|
5
|
+
|
|
6
|
+
/** Статус задачи для отображения в GUI. */
|
|
7
|
+
type JobStatus = "running" | "success" | "error" | "partial" | "unknown"
|
|
8
|
+
|
|
9
|
+
/** Per-workspace переопределения клона (Спринт 17). */
|
|
10
|
+
interface MatrixOverrideFields {
|
|
11
|
+
prompt?: string
|
|
12
|
+
model?: string
|
|
13
|
+
qualityGate?: string
|
|
14
|
+
beforeScript?: string
|
|
15
|
+
afterScript?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Matrix-настройки задачи-шаблона (Спринт 15: fan-out по workspace). */
|
|
19
|
+
interface MatrixConfig {
|
|
20
|
+
workspaceIds: string[]
|
|
21
|
+
strategy?: "parallel" | "sequential"
|
|
22
|
+
failureMode?: "continue" | "stop"
|
|
23
|
+
aggregation?: "summary" | "per-task"
|
|
24
|
+
createAggregator?: boolean
|
|
25
|
+
concurrency?: number
|
|
26
|
+
overrides?: Record<string, MatrixOverrideFields>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Настройки уведомлений (webhook). */
|
|
30
|
+
interface NotificationSettings {
|
|
31
|
+
enabled: boolean
|
|
32
|
+
onlyOnError: boolean
|
|
33
|
+
webhook?: { enabled: boolean; url: string }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface Job {
|
|
37
|
+
name: string
|
|
38
|
+
schedule: string
|
|
39
|
+
status: JobStatus
|
|
40
|
+
nextRun?: string
|
|
41
|
+
paused?: boolean
|
|
42
|
+
retryCount?: number
|
|
43
|
+
retryDelay?: number
|
|
44
|
+
qualityGate?: string
|
|
45
|
+
/** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
|
|
46
|
+
dependsOn?: string[]
|
|
47
|
+
prompt?: string
|
|
48
|
+
/** LLM-модель задачи (undefined — модель OpenCode по умолчанию). */
|
|
49
|
+
model?: string
|
|
50
|
+
/** Приоритет задачи 0..10 (10 — наивысший). */
|
|
51
|
+
priority?: number
|
|
52
|
+
/** Pre-flight команда (undefined — не задана). */
|
|
53
|
+
beforeScript?: string
|
|
54
|
+
/** Post-flight команда (undefined — не задана). */
|
|
55
|
+
afterScript?: string
|
|
56
|
+
triggerType?: "cron" | "file" | "mcp-event"
|
|
57
|
+
/** Параметры MCP-события. */
|
|
58
|
+
mcpEvent?: { server: string; event: string; filter?: string }
|
|
59
|
+
watchPath?: string
|
|
60
|
+
workingDirectory?: string
|
|
61
|
+
/** Привязка к multi-repo workspace. */
|
|
62
|
+
workspaceId?: string
|
|
63
|
+
workspaceName?: string
|
|
64
|
+
workspaceColor?: string
|
|
65
|
+
/** Ограничения инструментов (role-scoped, metadata-only). */
|
|
66
|
+
allowedTools?: string[] | null
|
|
67
|
+
deniedTools?: string[] | null
|
|
68
|
+
/** Matrix (fan-out): задача-шаблон раскладывается на клоны. */
|
|
69
|
+
matrix?: MatrixConfig | null
|
|
70
|
+
/** Для клона матрицы — имя родительской задачи. */
|
|
71
|
+
matrixParentId?: string | null
|
|
72
|
+
/** true — задача является родителем матрицы. */
|
|
73
|
+
isMatrixParent?: boolean
|
|
74
|
+
/** Агрегат по клонам (только для родителя). */
|
|
75
|
+
matrixSummary?: {
|
|
76
|
+
totalCount: number
|
|
77
|
+
successCount: number
|
|
78
|
+
errorCount: number
|
|
79
|
+
pendingCount: number
|
|
80
|
+
status: string
|
|
81
|
+
message: string
|
|
82
|
+
} | null
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Пользовательский шаблон, сохранённый в templates.json. */
|
|
86
|
+
interface CustomTemplate {
|
|
87
|
+
id: string
|
|
88
|
+
name: string
|
|
89
|
+
prompt: string
|
|
90
|
+
schedule?: string
|
|
91
|
+
timeoutSeconds?: number
|
|
92
|
+
model?: string
|
|
93
|
+
priority?: number
|
|
94
|
+
retryCount?: number
|
|
95
|
+
retryDelay?: number
|
|
96
|
+
qualityGate?: string
|
|
97
|
+
beforeScript?: string
|
|
98
|
+
afterScript?: string
|
|
99
|
+
dependsOn?: string[]
|
|
100
|
+
triggerType?: "cron" | "file" | "mcp-event"
|
|
101
|
+
mcpEvent?: { server: string; event: string; filter?: string }
|
|
102
|
+
watchPath?: string
|
|
103
|
+
workingDirectory?: string
|
|
104
|
+
workspaceId?: string
|
|
105
|
+
allowedTools?: string[]
|
|
106
|
+
deniedTools?: string[]
|
|
107
|
+
matrix?: MatrixConfig
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Multi-repo workspace: один репозиторий = один cwd = один git-контекст. */
|
|
111
|
+
interface Workspace {
|
|
112
|
+
id: string
|
|
113
|
+
name: string
|
|
114
|
+
path: string
|
|
115
|
+
gitRemote?: string | null
|
|
116
|
+
gitBranch?: string | null
|
|
117
|
+
color?: string | null
|
|
118
|
+
createdAt: string
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function statusColor(status: JobStatus): string {
|
|
122
|
+
switch (status) {
|
|
123
|
+
case "running": return "#f5a623"
|
|
124
|
+
case "success": return "#34c759"
|
|
125
|
+
case "error": return "#ff3b30"
|
|
126
|
+
case "partial": return "#ff9f0a"
|
|
127
|
+
default: return "#8e8e93"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Приоритет по умолчанию — «Обычный». */
|
|
132
|
+
const DEFAULT_PRIORITY = 5
|
|
133
|
+
|
|
134
|
+
/** Человекочитаемая подпись приоритета (0..10). */
|
|
135
|
+
function priorityLabel(priority?: number): string {
|
|
136
|
+
const value =
|
|
137
|
+
typeof priority === "number" && Number.isFinite(priority)
|
|
138
|
+
? Math.min(10, Math.max(0, Math.floor(priority)))
|
|
139
|
+
: DEFAULT_PRIORITY
|
|
140
|
+
if (value >= 10) return "Критический"
|
|
141
|
+
if (value >= 8) return "Высокий"
|
|
142
|
+
if (value <= 3) return "Низкий"
|
|
143
|
+
return "Обычный"
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Варианты выпадающего списка «Приоритет». */
|
|
147
|
+
const PRIORITY_OPTIONS: Array<{ value: number; label: string }> = [
|
|
148
|
+
{ value: 2, label: "Низкий" },
|
|
149
|
+
{ value: 5, label: "Обычный" },
|
|
150
|
+
{ value: 8, label: "Высокий" },
|
|
151
|
+
{ value: 10, label: "Критический" },
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
/** Безопасно извлекает текст ошибки из любого thrown value. */
|
|
155
|
+
function errorMessage(err: any): string {
|
|
156
|
+
if (err instanceof Error) return err.message
|
|
157
|
+
if (typeof err === "object" && err !== null && "message" in err)
|
|
158
|
+
return String((err as any).message)
|
|
159
|
+
return JSON.stringify(err)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Укорачивает текст ошибки для показа в интерфейсе:
|
|
164
|
+
* берёт первую непустую строку и обрезает её до 150 символов.
|
|
165
|
+
* Полные «простыни» из документации/стека в UI не попадают.
|
|
166
|
+
*/
|
|
167
|
+
function shortError(msg: string, limit = 150): string {
|
|
168
|
+
const firstLine = (msg || "").split(/\r?\n/).map((s) => s.trim()).find(Boolean) ?? ""
|
|
169
|
+
return firstLine.length > limit ? firstLine.slice(0, limit - 1).trimEnd() + "…" : firstLine
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Пресеты cron-расписаний */
|
|
173
|
+
const CRON_PRESETS: Array<{ label: string; value: string }> = [
|
|
174
|
+
{ label: "Каждую минуту", value: "* * * * *" },
|
|
175
|
+
{ label: "Каждый час", value: "0 * * * *" },
|
|
176
|
+
{ label: "Каждый день в 09:00", value: "0 9 * * *" },
|
|
177
|
+
{ label: "Каждый понедельник в 10:00", value: "0 10 * * 1" },
|
|
178
|
+
{ label: "Свое расписание…", value: "__custom__" },
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
export default Plugin.define({
|
|
182
|
+
setup(ctx) {
|
|
183
|
+
const rpc = ctx.client.rpc(SchedulerRpc)
|
|
184
|
+
|
|
185
|
+
const [jobs, setJobs] = createSignal<Job[]>([])
|
|
186
|
+
const [workspaces, setWorkspaces] = createSignal<Workspace[]>([])
|
|
187
|
+
const [workspacesCollapsed, setWorkspacesCollapsed] = createSignal(false)
|
|
188
|
+
const [workspaceFilter, setWorkspaceFilter] = createSignal("all")
|
|
189
|
+
const [workspaceBusy, setWorkspaceBusy] = createSignal(false)
|
|
190
|
+
const [workspaceId, setWorkspaceId] = createSignal("")
|
|
191
|
+
const [logs, setLogs] = createSignal("")
|
|
192
|
+
const [logsTask, setLogsTask] = createSignal<string | null>(null)
|
|
193
|
+
const [busy, setBusy] = createSignal(false)
|
|
194
|
+
const [cronError, setCronError] = createSignal("")
|
|
195
|
+
|
|
196
|
+
// Метрики и история запусков
|
|
197
|
+
const [metrics, setMetrics] = createSignal<{ total: number; success: number; error: number }>({ total: 0, success: 0, error: 0 })
|
|
198
|
+
const [historyOpen, setHistoryOpen] = createSignal<string | null>(null)
|
|
199
|
+
const [history, setHistory] = createSignal<HistoryRecord[]>([])
|
|
200
|
+
|
|
201
|
+
// Шаблоны промптов
|
|
202
|
+
const TEMPLATES: Array<{ label: string; value: string; prompt: string }> = [
|
|
203
|
+
{ label: "Свой промпт", value: "custom", prompt: "" },
|
|
204
|
+
{
|
|
205
|
+
label: "Ночной сторож (тесты)",
|
|
206
|
+
value: "night-watch",
|
|
207
|
+
prompt: "Запусти ночные проверки: прогнали тесты, зафиксируй ошибки и составь краткий отчёт о состоянии репозитория.",
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
label: "Утренний дайджест",
|
|
211
|
+
value: "morning-digest",
|
|
212
|
+
prompt: "Собери утренний дайджест: какие изменения были за ночь, есть ли проваленные сборки, что требует внимания сегодня.",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
label: "Гигиена кода",
|
|
216
|
+
value: "code-hygiene",
|
|
217
|
+
prompt: "Проведи аудит гигиены кода: найди неиспользуемые импорты, неиспользуемые переменные, лишние зависимости и предложи правки.",
|
|
218
|
+
},
|
|
219
|
+
]
|
|
220
|
+
const [template, setTemplate] = createSignal<string>("custom")
|
|
221
|
+
|
|
222
|
+
// Пользовательские шаблоны (templates.json) — загружаются при монтировании панели.
|
|
223
|
+
const [customTemplates, setCustomTemplates] = createSignal<CustomTemplate[]>([])
|
|
224
|
+
|
|
225
|
+
// Таймер для выполнения задачи (секунды)
|
|
226
|
+
const [runningSec, setRunningSec] = createSignal(0)
|
|
227
|
+
setInterval(() => setRunningSec((s) => s + 1), 1000)
|
|
228
|
+
|
|
229
|
+
// Глобальные настройки (макс. одновременных задач, зимняя тема)
|
|
230
|
+
const [maxConcurrent, setMaxConcurrent] = createSignal(1)
|
|
231
|
+
const [winterMode, setWinterMode] = createSignal(false)
|
|
232
|
+
|
|
233
|
+
// Настройки уведомлений (webhook)
|
|
234
|
+
const [notificationsEnabled, setNotificationsEnabled] = createSignal(false)
|
|
235
|
+
const [onlyOnError, setOnlyOnError] = createSignal(true)
|
|
236
|
+
const [webhookEnabled, setWebhookEnabled] = createSignal(false)
|
|
237
|
+
const [webhookUrl, setWebhookUrl] = createSignal("")
|
|
238
|
+
const [notificationsCollapsed, setNotificationsCollapsed] = createSignal(true)
|
|
239
|
+
const [testNotificationBusy, setTestNotificationBusy] = createSignal(false)
|
|
240
|
+
|
|
241
|
+
// Таймеры ожидания завершения ручных запусков (для тостов OpenCode).
|
|
242
|
+
const pendingRunTimers = new Map<string, ReturnType<typeof setInterval>>()
|
|
243
|
+
onCleanup(() => {
|
|
244
|
+
for (const timer of pendingRunTimers.values()) clearInterval(timer)
|
|
245
|
+
pendingRunTimers.clear()
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
// Название планировщика приходит с бэкенда: на Windows — «Планировщик Windows»,
|
|
249
|
+
// на macOS/Linux — «OpenCode Scheduler». GUI не зависит от ОС напрямую.
|
|
250
|
+
const [schedulerTitle, setSchedulerTitle] = createSignal("Планировщик задач")
|
|
251
|
+
|
|
252
|
+
async function loadPlatformGui() {
|
|
253
|
+
try {
|
|
254
|
+
const info = await rpc.get_platform({})
|
|
255
|
+
if (info?.title) setSchedulerTitle(info.title)
|
|
256
|
+
} catch (err: any) {
|
|
257
|
+
console.error("RPC Error (get_platform):", err)
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
async function loadSettingsGui() {
|
|
262
|
+
try {
|
|
263
|
+
const s = await rpc.get_settings({})
|
|
264
|
+
setMaxConcurrent(s.maxConcurrent ?? 1)
|
|
265
|
+
setWinterMode(Boolean(s.winterMode))
|
|
266
|
+
const n = s.notifications
|
|
267
|
+
setNotificationsEnabled(Boolean(n?.enabled))
|
|
268
|
+
setOnlyOnError(n?.onlyOnError !== false)
|
|
269
|
+
setWebhookEnabled(Boolean(n?.webhook?.enabled))
|
|
270
|
+
setWebhookUrl(n?.webhook?.url ?? "")
|
|
271
|
+
} catch (err: any) {
|
|
272
|
+
console.error("RPC Error (get_settings):", err)
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** Текущие настройки уведомлений из сигналов формы. */
|
|
277
|
+
function currentNotificationSettings(): NotificationSettings {
|
|
278
|
+
return {
|
|
279
|
+
enabled: notificationsEnabled(),
|
|
280
|
+
onlyOnError: onlyOnError(),
|
|
281
|
+
webhook: { enabled: webhookEnabled(), url: (webhookUrl() || "").trim() },
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
async function persistSettings(patch: {
|
|
286
|
+
maxConcurrent?: number
|
|
287
|
+
winterMode?: boolean
|
|
288
|
+
notifications?: NotificationSettings
|
|
289
|
+
}) {
|
|
290
|
+
try {
|
|
291
|
+
const s = await rpc.save_settings(patch)
|
|
292
|
+
if (patch.maxConcurrent !== undefined) setMaxConcurrent(s.maxConcurrent)
|
|
293
|
+
if (patch.winterMode !== undefined) setWinterMode(Boolean(s.winterMode))
|
|
294
|
+
if (patch.notifications !== undefined) {
|
|
295
|
+
const n = s.notifications
|
|
296
|
+
setNotificationsEnabled(Boolean(n?.enabled))
|
|
297
|
+
setOnlyOnError(n?.onlyOnError !== false)
|
|
298
|
+
setWebhookEnabled(Boolean(n?.webhook?.enabled))
|
|
299
|
+
setWebhookUrl(n?.webhook?.url ?? "")
|
|
300
|
+
}
|
|
301
|
+
} catch (err: any) {
|
|
302
|
+
console.error("RPC Error (save_settings):", err)
|
|
303
|
+
ctx.toast.show({ title: "Не удалось сохранить настройки", variant: "error", description: errorMessage(err) })
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** Сохраняет настройки уведомлений (вызывается после изменения любого поля). */
|
|
308
|
+
async function saveNotificationSettings() {
|
|
309
|
+
await persistSettings({ notifications: currentNotificationSettings() })
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** Кнопка «🧪 Тестовое уведомление». */
|
|
313
|
+
async function handleTestNotification() {
|
|
314
|
+
setTestNotificationBusy(true)
|
|
315
|
+
try {
|
|
316
|
+
// Сначала фиксируем текущие значения, чтобы тест использовал введённый URL.
|
|
317
|
+
await saveNotificationSettings()
|
|
318
|
+
const result = await rpc.test_notification({})
|
|
319
|
+
ctx.toast.show({
|
|
320
|
+
title: result.success ? "Тестовое уведомление отправлено" : "Тест не удался",
|
|
321
|
+
variant: result.success ? "success" : "error",
|
|
322
|
+
description: result.message,
|
|
323
|
+
})
|
|
324
|
+
} catch (err: any) {
|
|
325
|
+
console.error("RPC Error (test_notification):", err)
|
|
326
|
+
ctx.toast.show({
|
|
327
|
+
title: "Тест не удался",
|
|
328
|
+
variant: "error",
|
|
329
|
+
description: errorMessage(err),
|
|
330
|
+
})
|
|
331
|
+
} finally {
|
|
332
|
+
setTestNotificationBusy(false)
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
async function saveSettingsGui(val: number) {
|
|
337
|
+
setMaxConcurrent(val)
|
|
338
|
+
await persistSettings({ maxConcurrent: val })
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** Переключатель зимней темы: сразу применяем в UI и сохраняем в settings.json. */
|
|
342
|
+
async function toggleWinterMode(next: boolean) {
|
|
343
|
+
setWinterMode(next)
|
|
344
|
+
await persistSettings({ winterMode: next })
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Режим редактирования
|
|
348
|
+
const [editingJob, setEditingJob] = createSignal<Job | null>(null)
|
|
349
|
+
|
|
350
|
+
// Свёрнута ли форма создания/редактирования (чтобы не скроллить длинную форму)
|
|
351
|
+
const [formCollapsed, setFormCollapsed] = createSignal(false)
|
|
352
|
+
|
|
353
|
+
// Поля формы создания/редактирования задачи
|
|
354
|
+
const [name, setName] = createSignal("")
|
|
355
|
+
const [schedule, setSchedule] = createSignal("* * * * *")
|
|
356
|
+
const [prompt, setPrompt] = createSignal("")
|
|
357
|
+
const [cronPreset, setCronPreset] = createSignal<"* * * * *" | "0 * * * *" | "0 9 * * *" | "0 10 * * 1" | "__custom__">("* * * * *")
|
|
358
|
+
|
|
359
|
+
// Повторы при ошибке
|
|
360
|
+
const [retryCount, setRetryCount] = createSignal(0)
|
|
361
|
+
const [retryDelay, setRetryDelay] = createSignal(60)
|
|
362
|
+
|
|
363
|
+
// Модель LLM и приоритет запуска
|
|
364
|
+
const [model, setModel] = createSignal("")
|
|
365
|
+
const [priority, setPriority] = createSignal(DEFAULT_PRIORITY)
|
|
366
|
+
|
|
367
|
+
// Quality Gate и DAG-зависимости
|
|
368
|
+
const [qualityGate, setQualityGate] = createSignal("")
|
|
369
|
+
const [dependsOn, setDependsOn] = createSignal<string[]>([])
|
|
370
|
+
|
|
371
|
+
// Lifecycle hooks (CI/CD): pre-flight и post-flight команды
|
|
372
|
+
const [beforeScript, setBeforeScript] = createSignal("")
|
|
373
|
+
const [afterScript, setAfterScript] = createSignal("")
|
|
374
|
+
|
|
375
|
+
// Триггеры (cron / file / mcp-event) и рабочая директория
|
|
376
|
+
const [triggerType, setTriggerType] = createSignal<"cron" | "file" | "mcp-event">("cron")
|
|
377
|
+
const [watchPath, setWatchPath] = createSignal("")
|
|
378
|
+
const [mcpServer, setMcpServer] = createSignal("")
|
|
379
|
+
const [mcpEventName, setMcpEventName] = createSignal("")
|
|
380
|
+
const [mcpFilter, setMcpFilter] = createSignal("")
|
|
381
|
+
const [workingDirectory, setWorkingDirectory] = createSignal("")
|
|
382
|
+
|
|
383
|
+
// Ограничения инструментов (role-scoped, Спринт 14): metadata-only,
|
|
384
|
+
// denied имеет приоритет над allowed.
|
|
385
|
+
const [allowedTools, setAllowedTools] = createSignal<string[]>([])
|
|
386
|
+
const [deniedTools, setDeniedTools] = createSignal<string[]>([])
|
|
387
|
+
const [customTool, setCustomTool] = createSignal("")
|
|
388
|
+
// Matrix (fan-out, Спринт 15): задача-шаблон + список workspace.
|
|
389
|
+
const [matrixMode, setMatrixMode] = createSignal(false)
|
|
390
|
+
const [matrixWorkspaceIds, setMatrixWorkspaceIds] = createSignal<string[]>([])
|
|
391
|
+
const [matrixStrategy, setMatrixStrategy] = createSignal<"parallel" | "sequential">("parallel")
|
|
392
|
+
const [matrixFailureMode, setMatrixFailureMode] = createSignal<"continue" | "stop">("continue")
|
|
393
|
+
const [matrixAggregation, setMatrixAggregation] = createSignal<"summary" | "per-task">("summary")
|
|
394
|
+
const [matrixAggregator, setMatrixAggregator] = createSignal(false)
|
|
395
|
+
// Спринт 17: лимит одновременных клонов и per-workspace переопределения.
|
|
396
|
+
const [matrixConcurrency, setMatrixConcurrency] = createSignal("")
|
|
397
|
+
const [matrixOverrides, setMatrixOverrides] = createSignal<Record<string, MatrixOverrideFields>>({})
|
|
398
|
+
const [dryRunOpen, setDryRunOpen] = createSignal(false)
|
|
399
|
+
const [dryRunBusy, setDryRunBusy] = createSignal(false)
|
|
400
|
+
const [dryRunReport, setDryRunReport] = createSignal<any>(null)
|
|
401
|
+
const [dryRunName, setDryRunName] = createSignal("")
|
|
402
|
+
|
|
403
|
+
/** Популярные инструменты для мультивыбора. */
|
|
404
|
+
const POPULAR_TOOLS = ["bash", "edit", "write", "read", "grep", "glob", "webfetch"]
|
|
405
|
+
|
|
406
|
+
function toggleTool(target: "allowed" | "denied", tool: string) {
|
|
407
|
+
if (target === "allowed") {
|
|
408
|
+
setAllowedTools((prev) => (prev.includes(tool) ? prev.filter((t) => t !== tool) : [...prev, tool]))
|
|
409
|
+
} else {
|
|
410
|
+
setDeniedTools((prev) => (prev.includes(tool) ? prev.filter((t) => t !== tool) : [...prev, tool]))
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function addCustomTool(target: "allowed" | "denied") {
|
|
415
|
+
const name = customTool().trim()
|
|
416
|
+
if (!name) return
|
|
417
|
+
if (target === "allowed") {
|
|
418
|
+
if (!allowedTools().includes(name)) setAllowedTools([...allowedTools(), name])
|
|
419
|
+
} else {
|
|
420
|
+
if (!deniedTools().includes(name)) setDeniedTools([...deniedTools(), name])
|
|
421
|
+
}
|
|
422
|
+
setCustomTool("")
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/** Добавляет/убирает workspace из матрицы. */
|
|
426
|
+
function toggleMatrixWorkspace(id: string, checked: boolean) {
|
|
427
|
+
setMatrixWorkspaceIds((current) => {
|
|
428
|
+
if (checked) return current.includes(id) ? current : [...current, id]
|
|
429
|
+
return current.filter((item) => item !== id)
|
|
430
|
+
})
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** Имя клона — та же санитизация, что и на бэкенде (expandMatrixTask). */
|
|
434
|
+
function matrixClonePreviewName(parent: string, workspaceName: string): string {
|
|
435
|
+
const base = parent.trim() || "task"
|
|
436
|
+
const safe = workspaceName.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, "-")
|
|
437
|
+
return `${base}-matrix-${safe || "workspace"}`
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/** Превью имён клонов по текущим полям формы. */
|
|
441
|
+
const matrixPreview = () =>
|
|
442
|
+
matrixWorkspaceIds()
|
|
443
|
+
.map((id) => workspaces().find((w) => w.id === id))
|
|
444
|
+
.filter((w): w is Workspace => Boolean(w))
|
|
445
|
+
.map((w) => matrixClonePreviewName(name(), w.name))
|
|
446
|
+
|
|
447
|
+
/** Обновляет одно поле per-workspace переопределения. */
|
|
448
|
+
function updateMatrixOverride(
|
|
449
|
+
workspaceId: string,
|
|
450
|
+
field: keyof MatrixOverrideFields,
|
|
451
|
+
value: string
|
|
452
|
+
) {
|
|
453
|
+
setMatrixOverrides((prev) => {
|
|
454
|
+
const current: MatrixOverrideFields = { ...(prev[workspaceId] ?? {}) }
|
|
455
|
+
if (value.trim()) {
|
|
456
|
+
current[field] = value
|
|
457
|
+
} else {
|
|
458
|
+
delete current[field]
|
|
459
|
+
}
|
|
460
|
+
const next = { ...prev }
|
|
461
|
+
if (Object.keys(current).length > 0) {
|
|
462
|
+
next[workspaceId] = current
|
|
463
|
+
} else {
|
|
464
|
+
delete next[workspaceId]
|
|
465
|
+
}
|
|
466
|
+
return next
|
|
467
|
+
})
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/** Сколько workspace имеют переопределения (для подписи). */
|
|
471
|
+
const matrixOverrideCount = () => Object.keys(matrixOverrides()).length
|
|
472
|
+
|
|
473
|
+
/** Matrix-поле для payload RPC (undefined — обычная задача). */
|
|
474
|
+
const matrixPayload = (): MatrixConfig | undefined => {
|
|
475
|
+
if (!matrixMode()) return undefined
|
|
476
|
+
const concurrencyRaw = matrixConcurrency().trim()
|
|
477
|
+
const concurrency = concurrencyRaw ? Number(concurrencyRaw) : undefined
|
|
478
|
+
const overrides = matrixOverrides()
|
|
479
|
+
return {
|
|
480
|
+
workspaceIds: matrixWorkspaceIds(),
|
|
481
|
+
strategy: matrixStrategy(),
|
|
482
|
+
failureMode: matrixFailureMode(),
|
|
483
|
+
aggregation: matrixAggregation(),
|
|
484
|
+
createAggregator: matrixAggregator(),
|
|
485
|
+
...(concurrency !== undefined && Number.isFinite(concurrency) && concurrency >= 1
|
|
486
|
+
? { concurrency: Math.floor(concurrency) }
|
|
487
|
+
: {}),
|
|
488
|
+
...(Object.keys(overrides).length > 0 ? { overrides } : {}),
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/** Сбрасывает поля формы матрицы. */
|
|
493
|
+
function resetMatrixForm() {
|
|
494
|
+
setMatrixMode(false)
|
|
495
|
+
setMatrixWorkspaceIds([])
|
|
496
|
+
setMatrixStrategy("parallel")
|
|
497
|
+
setMatrixFailureMode("continue")
|
|
498
|
+
setMatrixAggregation("summary")
|
|
499
|
+
setMatrixAggregator(false)
|
|
500
|
+
setMatrixConcurrency("")
|
|
501
|
+
setMatrixOverrides({})
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/** Превью конвейера по текущим полям формы (dry_run требует сохранённую задачу —
|
|
505
|
+
* для несохранённой формы показываем локальную оценку без RPC). */
|
|
506
|
+
function buildFormCommand(): string {
|
|
507
|
+
const modelArg = model().trim() ? ` --model ${model().trim()}` : ""
|
|
508
|
+
return `opencode run${modelArg} "${prompt().replace(/\s+/g, " ").trim()}"`
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// Экспорт/импорт задач
|
|
512
|
+
const [exportData, setExportData] = createSignal<string | null>(null)
|
|
513
|
+
const [exportBusy, setExportBusy] = createSignal(false)
|
|
514
|
+
const [importBusy, setImportBusy] = createSignal(false)
|
|
515
|
+
const [importFile, setImportFile] = createSignal<File | null>(null)
|
|
516
|
+
|
|
517
|
+
async function handleExport() {
|
|
518
|
+
setExportBusy(true)
|
|
519
|
+
try {
|
|
520
|
+
const result = await rpc.export_tasks({})
|
|
521
|
+
if (!result.success) {
|
|
522
|
+
ctx.toast.show({ title: "Ошибка экспорта", variant: "error", description: result.error })
|
|
523
|
+
return
|
|
524
|
+
}
|
|
525
|
+
setExportData(result.data)
|
|
526
|
+
const blob = new Blob([result.data], { type: "application/json" })
|
|
527
|
+
const url = URL.createObjectURL(blob)
|
|
528
|
+
const a = document.createElement("a")
|
|
529
|
+
a.href = url
|
|
530
|
+
a.download = `windows-scheduler-tasks-${new Date().toISOString().slice(0, 10)}.json`
|
|
531
|
+
document.body.appendChild(a)
|
|
532
|
+
a.click()
|
|
533
|
+
document.body.removeChild(a)
|
|
534
|
+
URL.revokeObjectURL(url)
|
|
535
|
+
ctx.toast.show({ title: `Экспортировано задач: ${result.count}`, variant: "success" })
|
|
536
|
+
} catch (err: any) {
|
|
537
|
+
console.error("RPC Error (export_tasks):", err)
|
|
538
|
+
ctx.toast.show({ title: "Ошибка экспорта", variant: "error", description: errorMessage(err) })
|
|
539
|
+
} finally {
|
|
540
|
+
setExportBusy(false)
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function handleImportFile(e: Event) {
|
|
545
|
+
const input = e.target as HTMLInputElement
|
|
546
|
+
const file = input.files?.[0] ?? null
|
|
547
|
+
setImportFile(file)
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
async function handleImport() {
|
|
551
|
+
const file = importFile()
|
|
552
|
+
if (!file) {
|
|
553
|
+
ctx.toast.show({ title: "Выберите файл", variant: "error", description: "Не выбран файл для импорта." })
|
|
554
|
+
return
|
|
555
|
+
}
|
|
556
|
+
setImportBusy(true)
|
|
557
|
+
try {
|
|
558
|
+
const text = await file.text()
|
|
559
|
+
const result = await rpc.import_tasks({ data: text })
|
|
560
|
+
if (!result.success) {
|
|
561
|
+
ctx.toast.show({ title: "Ошибка импорта", variant: "error", description: result.error })
|
|
562
|
+
return
|
|
563
|
+
}
|
|
564
|
+
setImportFile(null)
|
|
565
|
+
ctx.toast.show({ title: `Импортировано задач: ${result.imported}`, variant: "success" })
|
|
566
|
+
await loadJobs()
|
|
567
|
+
} catch (err: any) {
|
|
568
|
+
console.error("RPC Error (import_tasks):", err)
|
|
569
|
+
ctx.toast.show({ title: "Ошибка импорта", variant: "error", description: errorMessage(err) })
|
|
570
|
+
} finally {
|
|
571
|
+
setImportBusy(false)
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
async function loadTemplatesGui() {
|
|
576
|
+
try {
|
|
577
|
+
const result = await rpc.get_templates({})
|
|
578
|
+
const list = Array.isArray(result?.templates) ? (result.templates as CustomTemplate[]) : []
|
|
579
|
+
setCustomTemplates(list)
|
|
580
|
+
} catch (err: any) {
|
|
581
|
+
console.error("RPC Error (get_templates):", err)
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
async function loadWorkspacesGui() {
|
|
586
|
+
try {
|
|
587
|
+
const result = await rpc.get_workspaces({})
|
|
588
|
+
const list = Array.isArray(result?.workspaces) ? (result.workspaces as Workspace[]) : []
|
|
589
|
+
setWorkspaces(list)
|
|
590
|
+
} catch (err: any) {
|
|
591
|
+
console.error("RPC Error (get_workspaces):", err)
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/** Активный workspace выбранной задачи (для dry-run подсказки). */
|
|
596
|
+
const selectedWorkspace = () => workspaces().find((w) => w.id === workspaceId())
|
|
597
|
+
|
|
598
|
+
async function handleAddWorkspace() {
|
|
599
|
+
const workspacePath = (window.prompt("Путь к git-репозиторию (workspace)", "") ?? "").trim()
|
|
600
|
+
if (!workspacePath) return
|
|
601
|
+
const workspaceName = (window.prompt("Название workspace (необязательно)", "") ?? "").trim()
|
|
602
|
+
setWorkspaceBusy(true)
|
|
603
|
+
try {
|
|
604
|
+
const result = await rpc.add_workspace({
|
|
605
|
+
path: workspacePath,
|
|
606
|
+
...(workspaceName ? { name: workspaceName } : {}),
|
|
607
|
+
})
|
|
608
|
+
if (!result.success) {
|
|
609
|
+
ctx.toast.show({ title: "Ошибка добавления workspace", variant: "error", description: result.error ?? "Неизвестная ошибка" })
|
|
610
|
+
return
|
|
611
|
+
}
|
|
612
|
+
await loadWorkspacesGui()
|
|
613
|
+
if (result.workspace?.id) setWorkspaceId(result.workspace.id)
|
|
614
|
+
ctx.toast.show({ title: "Workspace добавлен", variant: "success" })
|
|
615
|
+
} catch (err: any) {
|
|
616
|
+
console.error("RPC Error (add_workspace):", err)
|
|
617
|
+
ctx.toast.show({ title: "Ошибка добавления workspace", variant: "error", description: shortError(errorMessage(err)) })
|
|
618
|
+
} finally {
|
|
619
|
+
setWorkspaceBusy(false)
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
async function handleEditWorkspace(workspace: Workspace) {
|
|
624
|
+
const nextPath = (window.prompt("Путь к git-репозиторию", workspace.path) ?? "").trim()
|
|
625
|
+
if (!nextPath) return
|
|
626
|
+
const nextName = (window.prompt("Название workspace", workspace.name) ?? "").trim()
|
|
627
|
+
setWorkspaceBusy(true)
|
|
628
|
+
try {
|
|
629
|
+
const result = await rpc.update_workspace({
|
|
630
|
+
id: workspace.id,
|
|
631
|
+
path: nextPath,
|
|
632
|
+
...(nextName ? { name: nextName } : {}),
|
|
633
|
+
})
|
|
634
|
+
if (!result.success) {
|
|
635
|
+
ctx.toast.show({ title: "Ошибка обновления workspace", variant: "error", description: result.error ?? "Неизвестная ошибка" })
|
|
636
|
+
return
|
|
637
|
+
}
|
|
638
|
+
await loadWorkspacesGui()
|
|
639
|
+
ctx.toast.show({ title: "Workspace обновлён", variant: "success" })
|
|
640
|
+
} catch (err: any) {
|
|
641
|
+
console.error("RPC Error (update_workspace):", err)
|
|
642
|
+
ctx.toast.show({ title: "Ошибка обновления workspace", variant: "error", description: shortError(errorMessage(err)) })
|
|
643
|
+
} finally {
|
|
644
|
+
setWorkspaceBusy(false)
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
async function handleDeleteWorkspace(workspace: Workspace) {
|
|
649
|
+
if (!window.confirm(`Удалить workspace "${workspace.name}"? Задачи сохранены, привязка будет очищена.`)) return
|
|
650
|
+
setWorkspaceBusy(true)
|
|
651
|
+
try {
|
|
652
|
+
const result = await rpc.delete_workspace({ id: workspace.id })
|
|
653
|
+
if (!result.success) {
|
|
654
|
+
ctx.toast.show({ title: "Ошибка удаления workspace", variant: "error", description: result.message ?? "Неизвестная ошибка" })
|
|
655
|
+
return
|
|
656
|
+
}
|
|
657
|
+
if (workspaceId() === workspace.id) setWorkspaceId("")
|
|
658
|
+
if (workspaceFilter() === workspace.id) setWorkspaceFilter("all")
|
|
659
|
+
await loadWorkspacesGui()
|
|
660
|
+
await loadJobs()
|
|
661
|
+
ctx.toast.show({ title: "Workspace удалён", variant: "success", description: result.message })
|
|
662
|
+
} catch (err: any) {
|
|
663
|
+
console.error("RPC Error (delete_workspace):", err)
|
|
664
|
+
ctx.toast.show({ title: "Ошибка удаления workspace", variant: "error", description: shortError(errorMessage(err)) })
|
|
665
|
+
} finally {
|
|
666
|
+
setWorkspaceBusy(false)
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* При выборе шаблона:
|
|
672
|
+
* — встроенный подставляет только промпт (как раньше);
|
|
673
|
+
* — пользовательский заполняет ВСЕ поля формы (расписание, ретраи,
|
|
674
|
+
* Quality Gate, цепочки, триггер и рабочую директорию).
|
|
675
|
+
*/
|
|
676
|
+
const selectTemplate = (val: string) => {
|
|
677
|
+
setTemplate(val)
|
|
678
|
+
|
|
679
|
+
if (val.startsWith("custom:")) {
|
|
680
|
+
const t = customTemplates().find((item) => `custom:${item.id}` === val)
|
|
681
|
+
if (!t) return
|
|
682
|
+
setPrompt(t.prompt ?? "")
|
|
683
|
+
if (t.schedule) {
|
|
684
|
+
setSchedule(t.schedule)
|
|
685
|
+
const preset = CRON_PRESETS.find((p) => p.value === t.schedule)
|
|
686
|
+
setCronPreset((preset ? preset.value : "__custom__") as any)
|
|
687
|
+
}
|
|
688
|
+
setRetryCount(t.retryCount ?? 0)
|
|
689
|
+
setRetryDelay(t.retryDelay ?? 60)
|
|
690
|
+
setQualityGate(t.qualityGate ?? "")
|
|
691
|
+
setModel(t.model ?? "")
|
|
692
|
+
setPriority(typeof t.priority === "number" ? t.priority : DEFAULT_PRIORITY)
|
|
693
|
+
setDependsOn(Array.isArray(t.dependsOn) ? t.dependsOn : [])
|
|
694
|
+
setBeforeScript(t.beforeScript ?? "")
|
|
695
|
+
setAfterScript(t.afterScript ?? "")
|
|
696
|
+
setTriggerType(
|
|
697
|
+
t.triggerType === "file"
|
|
698
|
+
? "file"
|
|
699
|
+
: t.triggerType === "mcp-event"
|
|
700
|
+
? "mcp-event"
|
|
701
|
+
: "cron"
|
|
702
|
+
)
|
|
703
|
+
setWatchPath(t.watchPath ?? "")
|
|
704
|
+
setMcpServer(t.mcpEvent?.server ?? "")
|
|
705
|
+
setMcpEventName(t.mcpEvent?.event ?? "")
|
|
706
|
+
setMcpFilter(t.mcpEvent?.filter ?? "")
|
|
707
|
+
setWorkingDirectory(t.workingDirectory ?? "")
|
|
708
|
+
setWorkspaceId(t.workspaceId ?? "")
|
|
709
|
+
setAllowedTools(Array.isArray(t.allowedTools) ? t.allowedTools : [])
|
|
710
|
+
setDeniedTools(Array.isArray(t.deniedTools) ? t.deniedTools : [])
|
|
711
|
+
if (t.matrix) {
|
|
712
|
+
setMatrixMode(true)
|
|
713
|
+
setMatrixWorkspaceIds(Array.isArray(t.matrix.workspaceIds) ? t.matrix.workspaceIds : [])
|
|
714
|
+
setMatrixStrategy(t.matrix.strategy === "sequential" ? "sequential" : "parallel")
|
|
715
|
+
setMatrixFailureMode(t.matrix.failureMode === "stop" ? "stop" : "continue")
|
|
716
|
+
setMatrixAggregation(t.matrix.aggregation === "per-task" ? "per-task" : "summary")
|
|
717
|
+
setMatrixAggregator(Boolean(t.matrix.createAggregator))
|
|
718
|
+
setMatrixConcurrency(
|
|
719
|
+
typeof t.matrix.concurrency === "number" ? String(t.matrix.concurrency) : ""
|
|
720
|
+
)
|
|
721
|
+
const overrides = (t.matrix as MatrixConfig).overrides
|
|
722
|
+
setMatrixOverrides(overrides ? { ...overrides } : {})
|
|
723
|
+
} else {
|
|
724
|
+
resetMatrixForm()
|
|
725
|
+
}
|
|
726
|
+
return
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
const builtin = TEMPLATES.find((t) => t.value === val)
|
|
730
|
+
if (builtin) setPrompt(builtin.prompt)
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/** Сохраняет текущие значения формы как пользовательский шаблон. */
|
|
734
|
+
async function handleSaveAsTemplate() {
|
|
735
|
+
if (!(prompt() || "").trim()) {
|
|
736
|
+
ctx.toast.show({
|
|
737
|
+
title: "Нечего сохранять",
|
|
738
|
+
variant: "error",
|
|
739
|
+
description: "Сначала заполните промпт — он обязателен для шаблона.",
|
|
740
|
+
})
|
|
741
|
+
return
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
const templateName = (window.prompt("Название шаблона", "") ?? "").trim()
|
|
745
|
+
if (!templateName) return
|
|
746
|
+
|
|
747
|
+
try {
|
|
748
|
+
const result = await rpc.save_template({
|
|
749
|
+
name: templateName,
|
|
750
|
+
prompt: (prompt() || "").trim(),
|
|
751
|
+
schedule: (schedule() || "").trim(),
|
|
752
|
+
timeoutSeconds: 3600,
|
|
753
|
+
model: (model() || "").trim(),
|
|
754
|
+
priority: priority(),
|
|
755
|
+
retryCount: retryCount(),
|
|
756
|
+
retryDelay: retryDelay(),
|
|
757
|
+
qualityGate: (qualityGate() || "").trim(),
|
|
758
|
+
beforeScript: (beforeScript() || "").trim(),
|
|
759
|
+
afterScript: (afterScript() || "").trim(),
|
|
760
|
+
dependsOn: dependsOn(),
|
|
761
|
+
triggerType: triggerType(),
|
|
762
|
+
mcpEvent:
|
|
763
|
+
triggerType() === "mcp-event"
|
|
764
|
+
? {
|
|
765
|
+
server: (mcpServer() || "").trim(),
|
|
766
|
+
event: (mcpEventName() || "").trim(),
|
|
767
|
+
...(mcpFilter().trim() ? { filter: mcpFilter().trim() } : {}),
|
|
768
|
+
}
|
|
769
|
+
: undefined,
|
|
770
|
+
watchPath: (watchPath() || "").trim(),
|
|
771
|
+
workingDirectory: (workingDirectory() || "").trim(),
|
|
772
|
+
workspaceId: (workspaceId() || "").trim() || undefined,
|
|
773
|
+
allowedTools: allowedTools().length > 0 ? allowedTools() : undefined,
|
|
774
|
+
deniedTools: deniedTools().length > 0 ? deniedTools() : undefined,
|
|
775
|
+
matrix: matrixPayload(),
|
|
776
|
+
})
|
|
777
|
+
if (!result.success) {
|
|
778
|
+
ctx.toast.show({
|
|
779
|
+
title: "Не удалось сохранить шаблон",
|
|
780
|
+
variant: "error",
|
|
781
|
+
description: result.error || "Неизвестная ошибка",
|
|
782
|
+
})
|
|
783
|
+
return
|
|
784
|
+
}
|
|
785
|
+
await loadTemplatesGui()
|
|
786
|
+
const saved = (result as any).template
|
|
787
|
+
if (saved?.id) setTemplate(`custom:${saved.id}`)
|
|
788
|
+
ctx.toast.show({ title: `Шаблон "${templateName}" сохранён`, variant: "success" })
|
|
789
|
+
} catch (err: any) {
|
|
790
|
+
console.error("RPC Error (save_template):", err)
|
|
791
|
+
ctx.toast.show({
|
|
792
|
+
title: "Ошибка сохранения шаблона",
|
|
793
|
+
variant: "error",
|
|
794
|
+
description: errorMessage(err),
|
|
795
|
+
})
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/** Удаляет пользовательский шаблон по id. */
|
|
800
|
+
async function handleDeleteTemplate(t: CustomTemplate) {
|
|
801
|
+
if (!window.confirm(`Удалить шаблон "${t.name}"?`)) return
|
|
802
|
+
try {
|
|
803
|
+
const result = await rpc.delete_template({ id: t.id })
|
|
804
|
+
if (!result.success) {
|
|
805
|
+
ctx.toast.show({
|
|
806
|
+
title: "Не удалось удалить шаблон",
|
|
807
|
+
variant: "error",
|
|
808
|
+
description: result.error || "Неизвестная ошибка",
|
|
809
|
+
})
|
|
810
|
+
return
|
|
811
|
+
}
|
|
812
|
+
if (template() === `custom:${t.id}`) setTemplate("custom")
|
|
813
|
+
await loadTemplatesGui()
|
|
814
|
+
ctx.toast.show({ title: `Шаблон "${t.name}" удалён`, variant: "success" })
|
|
815
|
+
} catch (err: any) {
|
|
816
|
+
console.error("RPC Error (delete_template):", err)
|
|
817
|
+
ctx.toast.show({
|
|
818
|
+
title: "Ошибка удаления шаблона",
|
|
819
|
+
variant: "error",
|
|
820
|
+
description: errorMessage(err),
|
|
821
|
+
})
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
async function loadJobs() {
|
|
826
|
+
try {
|
|
827
|
+
const result = await rpc.get_tasks({})
|
|
828
|
+
console.log("[GUI] Received tasks:", result)
|
|
829
|
+
const tasks = Array.isArray(result?.tasks) ? (result.tasks as any[]) : []
|
|
830
|
+
console.log("[GUI] tasks count:", tasks.length)
|
|
831
|
+
const mapped: Job[] = tasks.map((t: any) => ({
|
|
832
|
+
name: t.name,
|
|
833
|
+
schedule: t.schedule,
|
|
834
|
+
status: (t.status as JobStatus) ?? "unknown",
|
|
835
|
+
nextRun: t.nextRun ?? undefined,
|
|
836
|
+
paused: t.status?.toLowerCase().includes("disabled"),
|
|
837
|
+
retryCount: t.retryCount ?? 0,
|
|
838
|
+
retryDelay: t.retryDelay ?? 60,
|
|
839
|
+
qualityGate: t.qualityGate ?? undefined,
|
|
840
|
+
dependsOn: Array.isArray(t.dependsOn) ? t.dependsOn : undefined,
|
|
841
|
+
model: t.model ?? undefined,
|
|
842
|
+
priority: typeof t.priority === "number" ? t.priority : DEFAULT_PRIORITY,
|
|
843
|
+
beforeScript: t.beforeScript ?? undefined,
|
|
844
|
+
afterScript: t.afterScript ?? undefined,
|
|
845
|
+
triggerType: (t.triggerType ?? "cron") as "cron" | "file" | "mcp-event",
|
|
846
|
+
mcpEvent: t.mcpEvent ?? undefined,
|
|
847
|
+
watchPath: t.watchPath ?? undefined,
|
|
848
|
+
workingDirectory: t.workingDirectory ?? undefined,
|
|
849
|
+
workspaceId: t.workspaceId ?? undefined,
|
|
850
|
+
workspaceName: t.workspaceName ?? undefined,
|
|
851
|
+
workspaceColor: t.workspaceColor ?? undefined,
|
|
852
|
+
allowedTools: Array.isArray(t.allowedTools) ? t.allowedTools : undefined,
|
|
853
|
+
deniedTools: Array.isArray(t.deniedTools) ? t.deniedTools : undefined,
|
|
854
|
+
matrix: (t as any).matrix ?? null,
|
|
855
|
+
matrixParentId: (t as any).matrixParentId ?? null,
|
|
856
|
+
isMatrixParent: Boolean((t as any).isMatrixParent),
|
|
857
|
+
matrixSummary: (t as any).matrixSummary ?? null,
|
|
858
|
+
prompt: t.prompt ?? "",
|
|
859
|
+
}))
|
|
860
|
+
setJobs(mapped)
|
|
861
|
+
console.log("[GUI] jobs:", jobs())
|
|
862
|
+
await loadMetrics()
|
|
863
|
+
} catch (err: any) {
|
|
864
|
+
console.error("RPC Error (get_tasks):", err)
|
|
865
|
+
// Оставляем старые данные на экране, не роняем UI
|
|
866
|
+
ctx.toast.show({ title: "Ошибка загрузки задач", variant: "error", description: shortError(errorMessage(err)) })
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
async function loadMetrics() {
|
|
871
|
+
try {
|
|
872
|
+
const m = await rpc.get_metrics({})
|
|
873
|
+
setMetrics({ total: m.total ?? 0, success: m.success ?? 0, error: m.error ?? 0 })
|
|
874
|
+
} catch (err: any) {
|
|
875
|
+
console.error("RPC Error (get_metrics):", err)
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
async function fetchHistory(taskName: string) {
|
|
880
|
+
setHistoryOpen(taskName)
|
|
881
|
+
try {
|
|
882
|
+
const result = await rpc.get_history({ limit: 10 })
|
|
883
|
+
setHistory(result.records ?? [])
|
|
884
|
+
} catch (err: any) {
|
|
885
|
+
console.error("RPC Error (get_history):", err)
|
|
886
|
+
ctx.toast.show({ title: "Ошибка загрузки истории", variant: "error", description: errorMessage(err) })
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/** Dry-Run: симуляция конвейера задачи без реального запуска (Спринт 14). */
|
|
891
|
+
async function openDryRun(taskName: string) {
|
|
892
|
+
setDryRunOpen(true)
|
|
893
|
+
setDryRunName(taskName)
|
|
894
|
+
setDryRunBusy(true)
|
|
895
|
+
setDryRunReport(null)
|
|
896
|
+
try {
|
|
897
|
+
const result: any = await rpc.dry_run({ taskName })
|
|
898
|
+
setDryRunReport(result)
|
|
899
|
+
} catch (err: any) {
|
|
900
|
+
console.error("RPC Error (dry_run):", err)
|
|
901
|
+
setDryRunReport({ success: false, error: errorMessage(err), tasks: [], warnings: [] })
|
|
902
|
+
} finally {
|
|
903
|
+
setDryRunBusy(false)
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
function closeDryRun() {
|
|
908
|
+
setDryRunOpen(false)
|
|
909
|
+
setDryRunName("")
|
|
910
|
+
setDryRunReport(null)
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
async function handleCreate() {
|
|
914
|
+
setBusy(true)
|
|
915
|
+
setCronError("")
|
|
916
|
+
try {
|
|
917
|
+
const result = await rpc.create_task({
|
|
918
|
+
name: (name() || "").trim(),
|
|
919
|
+
schedule: (schedule() || "").trim(),
|
|
920
|
+
prompt: (prompt() || "").trim(),
|
|
921
|
+
model: (model() || "").trim(),
|
|
922
|
+
priority: priority(),
|
|
923
|
+
retryCount: retryCount(),
|
|
924
|
+
retryDelay: retryDelay(),
|
|
925
|
+
qualityGate: (qualityGate() || "").trim(),
|
|
926
|
+
beforeScript: (beforeScript() || "").trim(),
|
|
927
|
+
afterScript: (afterScript() || "").trim(),
|
|
928
|
+
dependsOn: dependsOn(),
|
|
929
|
+
triggerType: triggerType(),
|
|
930
|
+
mcpEvent:
|
|
931
|
+
triggerType() === "mcp-event"
|
|
932
|
+
? {
|
|
933
|
+
server: (mcpServer() || "").trim(),
|
|
934
|
+
event: (mcpEventName() || "").trim(),
|
|
935
|
+
...(mcpFilter().trim() ? { filter: mcpFilter().trim() } : {}),
|
|
936
|
+
}
|
|
937
|
+
: undefined,
|
|
938
|
+
watchPath: (watchPath() || "").trim(),
|
|
939
|
+
workingDirectory: (workingDirectory() || "").trim(),
|
|
940
|
+
workspaceId: (workspaceId() || "").trim() || undefined,
|
|
941
|
+
allowedTools: allowedTools().length > 0 ? allowedTools() : undefined,
|
|
942
|
+
deniedTools: deniedTools().length > 0 ? deniedTools() : undefined,
|
|
943
|
+
matrix: matrixPayload(),
|
|
944
|
+
})
|
|
945
|
+
if (!result.success) {
|
|
946
|
+
const short = shortError(result.message)
|
|
947
|
+
setCronError(short)
|
|
948
|
+
ctx.toast.show({ title: "Ошибка создания задачи", variant: "error", description: short })
|
|
949
|
+
return
|
|
950
|
+
}
|
|
951
|
+
// Windows регистрирует задачу в Планировщике не мгновенно:
|
|
952
|
+
// даём schtasks ~500 мс, иначе get_tasks может вернуть список без новой задачи.
|
|
953
|
+
await new Promise((r) => setTimeout(r, 500))
|
|
954
|
+
await loadJobs()
|
|
955
|
+
|
|
956
|
+
// Форму очищаем только после успешного создания и обновления списка.
|
|
957
|
+
setName("")
|
|
958
|
+
setSchedule("* * * * *")
|
|
959
|
+
setPrompt("")
|
|
960
|
+
setCronPreset("* * * * *")
|
|
961
|
+
setRetryCount(0)
|
|
962
|
+
setRetryDelay(60)
|
|
963
|
+
setQualityGate("")
|
|
964
|
+
setDependsOn([])
|
|
965
|
+
setModel("")
|
|
966
|
+
setPriority(DEFAULT_PRIORITY)
|
|
967
|
+
setBeforeScript("")
|
|
968
|
+
setAfterScript("")
|
|
969
|
+
setTriggerType("cron")
|
|
970
|
+
setWatchPath("")
|
|
971
|
+
setMcpServer("")
|
|
972
|
+
setMcpEventName("")
|
|
973
|
+
setMcpFilter("")
|
|
974
|
+
setWorkingDirectory("")
|
|
975
|
+
setWorkspaceId("")
|
|
976
|
+
setAllowedTools([])
|
|
977
|
+
setDeniedTools([])
|
|
978
|
+
resetMatrixForm()
|
|
979
|
+
setEditingJob(null)
|
|
980
|
+
setTemplate("custom")
|
|
981
|
+
ctx.toast.show({ title: "Задача создана", variant: "success" })
|
|
982
|
+
} catch (err: any) {
|
|
983
|
+
console.error("RPC Error (create_task):", err)
|
|
984
|
+
const msg = shortError(errorMessage(err))
|
|
985
|
+
setCronError(msg)
|
|
986
|
+
ctx.toast.show({ title: "Ошибка создания задачи", variant: "error", description: msg })
|
|
987
|
+
} finally {
|
|
988
|
+
setBusy(false)
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Следит за завершением ручного запуска и показывает тост OpenCode.
|
|
994
|
+
*
|
|
995
|
+
* Серверный контекст плагина не имеет ctx.toast, поэтому тост показываем
|
|
996
|
+
* в GUI: опрашиваем историю и ждём запись с taskName и startedAt >= since.
|
|
997
|
+
*/
|
|
998
|
+
function watchManualRun(jobName: string) {
|
|
999
|
+
const since = new Date().toISOString()
|
|
1000
|
+
const previous = pendingRunTimers.get(jobName)
|
|
1001
|
+
if (previous) clearInterval(previous)
|
|
1002
|
+
|
|
1003
|
+
let attempts = 0
|
|
1004
|
+
const timer = setInterval(() => {
|
|
1005
|
+
attempts += 1
|
|
1006
|
+
// 900 попыток × 2 с = 30 минут; дальше просто прекращаем опрос.
|
|
1007
|
+
if (attempts > 900) {
|
|
1008
|
+
clearInterval(timer)
|
|
1009
|
+
pendingRunTimers.delete(jobName)
|
|
1010
|
+
return
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
void (async () => {
|
|
1014
|
+
try {
|
|
1015
|
+
const result = await rpc.get_history({ limit: 50 })
|
|
1016
|
+
const records = (result.records ?? []) as HistoryRecord[]
|
|
1017
|
+
const record = records.find(
|
|
1018
|
+
(r) =>
|
|
1019
|
+
String(r.taskName ?? "").toLowerCase() === jobName.toLowerCase() &&
|
|
1020
|
+
typeof r.startedAt === "string" &&
|
|
1021
|
+
r.startedAt >= since
|
|
1022
|
+
)
|
|
1023
|
+
if (!record) return
|
|
1024
|
+
|
|
1025
|
+
clearInterval(timer)
|
|
1026
|
+
pendingRunTimers.delete(jobName)
|
|
1027
|
+
|
|
1028
|
+
const ok = record.status === "success"
|
|
1029
|
+
const seconds = ((Number(record.durationMs) || 0) / 1000).toFixed(1)
|
|
1030
|
+
const reason = record.error ? `: ${record.error}` : ""
|
|
1031
|
+
ctx.toast.show({
|
|
1032
|
+
title: ok ? `Задача "${jobName}" выполнена` : `Задача "${jobName}" упала`,
|
|
1033
|
+
variant: ok ? "success" : "error",
|
|
1034
|
+
description: `${seconds}s${reason}`,
|
|
1035
|
+
})
|
|
1036
|
+
await loadJobs()
|
|
1037
|
+
} catch (err: any) {
|
|
1038
|
+
console.error("RPC Error (get_history):", err)
|
|
1039
|
+
}
|
|
1040
|
+
})()
|
|
1041
|
+
}, 2000)
|
|
1042
|
+
|
|
1043
|
+
pendingRunTimers.set(jobName, timer)
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
async function handleRun(jobName: string) {
|
|
1047
|
+
// Защита от { name: undefined }: без валидного имени RPC не отправляем.
|
|
1048
|
+
if (!jobName || typeof jobName !== "string") {
|
|
1049
|
+
console.error("[GUI] run_task aborted: empty task name")
|
|
1050
|
+
return
|
|
1051
|
+
}
|
|
1052
|
+
try {
|
|
1053
|
+
const result = await rpc.run_task({ name: jobName })
|
|
1054
|
+
if (!result.success) {
|
|
1055
|
+
ctx.toast.show({ title: `Не удалось запустить "${jobName}"`, variant: "error", description: result.message })
|
|
1056
|
+
return
|
|
1057
|
+
}
|
|
1058
|
+
// Уже выполняющаяся задача приходит как success с сообщением
|
|
1059
|
+
// «Задача ... уже выполняется» — показываем мягкое уведомление, не ошибку.
|
|
1060
|
+
ctx.toast.show({ title: result.message || `Задача "${jobName}" запущена`, variant: "success" })
|
|
1061
|
+
// Для уже идущего запуска не ждём новую запись истории.
|
|
1062
|
+
if (!/уже выполняется/i.test(result.message || "")) {
|
|
1063
|
+
watchManualRun(jobName)
|
|
1064
|
+
}
|
|
1065
|
+
await loadJobs()
|
|
1066
|
+
} catch (err: any) {
|
|
1067
|
+
console.error("RPC Error (run_task):", err)
|
|
1068
|
+
ctx.toast.show({ title: "Ошибка запуска", variant: "error", description: errorMessage(err) })
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
async function handlePause(jobName: string) {
|
|
1073
|
+
try {
|
|
1074
|
+
const result = await rpc.pause_task({ name: jobName })
|
|
1075
|
+
if (!result.success) {
|
|
1076
|
+
ctx.toast.show({ title: `Не удалось поставить на паузу "${jobName}"`, variant: "error", description: result.message })
|
|
1077
|
+
return
|
|
1078
|
+
}
|
|
1079
|
+
ctx.toast.show({ title: `Задача "${jobName}" поставлена на паузу`, variant: "success" })
|
|
1080
|
+
await loadJobs()
|
|
1081
|
+
} catch (err: any) {
|
|
1082
|
+
console.error("RPC Error (pause_task):", err)
|
|
1083
|
+
ctx.toast.show({ title: "Ошибка паузы", variant: "error", description: errorMessage(err) })
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
async function handleResume(jobName: string) {
|
|
1088
|
+
try {
|
|
1089
|
+
const result = await rpc.resume_task({ name: jobName })
|
|
1090
|
+
if (!result.success) {
|
|
1091
|
+
ctx.toast.show({ title: `Не удалось возобновить "${jobName}"`, variant: "error", description: result.message })
|
|
1092
|
+
return
|
|
1093
|
+
}
|
|
1094
|
+
ctx.toast.show({ title: `Задача "${jobName}" возобновлена`, variant: "success" })
|
|
1095
|
+
await loadJobs()
|
|
1096
|
+
} catch (err: any) {
|
|
1097
|
+
console.error("RPC Error (resume_task):", err)
|
|
1098
|
+
ctx.toast.show({ title: "Ошибка возобновления", variant: "error", description: errorMessage(err) })
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
async function handleCancelMatrix(jobName: string) {
|
|
1103
|
+
if (!window.confirm(`Отменить выполняющиеся клоны матрицы "${jobName}"?`)) return
|
|
1104
|
+
try {
|
|
1105
|
+
const result = await rpc.cancel_matrix({ name: jobName })
|
|
1106
|
+
if (!result.success) {
|
|
1107
|
+
ctx.toast.show({ title: "Не удалось отменить матрицу", variant: "error", description: result.message })
|
|
1108
|
+
return
|
|
1109
|
+
}
|
|
1110
|
+
ctx.toast.show({ title: result.message, variant: "success" })
|
|
1111
|
+
await loadJobs()
|
|
1112
|
+
} catch (err: any) {
|
|
1113
|
+
console.error("RPC Error (cancel_matrix):", err)
|
|
1114
|
+
ctx.toast.show({ title: "Ошибка отмены матрицы", variant: "error", description: errorMessage(err) })
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
async function handleDelete(jobName: string) {
|
|
1119
|
+
const target = jobs().find((job) => job.name === jobName)
|
|
1120
|
+
const message = target?.matrix
|
|
1121
|
+
? `Удалить матрицу "${jobName}" вместе со всеми клонами и агрегатором?`
|
|
1122
|
+
: `Удалить задачу "${jobName}"?`
|
|
1123
|
+
if (!window.confirm(message)) return
|
|
1124
|
+
try {
|
|
1125
|
+
const result = await rpc.delete_task({ name: jobName })
|
|
1126
|
+
if (!result.success) {
|
|
1127
|
+
ctx.toast.show({ title: "Ошибка удаления", variant: "error", description: result.message })
|
|
1128
|
+
return
|
|
1129
|
+
}
|
|
1130
|
+
ctx.toast.show({ title: `Задача "${jobName}" удалена`, variant: "success" })
|
|
1131
|
+
if (logsTask() === jobName) {
|
|
1132
|
+
setLogs("")
|
|
1133
|
+
setLogsTask(null)
|
|
1134
|
+
}
|
|
1135
|
+
if (editingJob()?.name === jobName) setEditingJob(null)
|
|
1136
|
+
await loadJobs()
|
|
1137
|
+
} catch (err: any) {
|
|
1138
|
+
console.error("RPC Error (delete_task):", err)
|
|
1139
|
+
ctx.toast.show({ title: "Ошибка удаления", variant: "error", description: errorMessage(err) })
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
async function showLogs(jobName: string) {
|
|
1144
|
+
setLogsTask(jobName)
|
|
1145
|
+
setLogs("Загрузка логов…")
|
|
1146
|
+
try {
|
|
1147
|
+
const result = await rpc.get_task_logs({ name: jobName })
|
|
1148
|
+
if (!result.success) {
|
|
1149
|
+
setLogs(result.error || "Не удалось загрузить логи")
|
|
1150
|
+
ctx.toast.show({ title: "Ошибка чтения логов", variant: "error", description: result.error })
|
|
1151
|
+
return
|
|
1152
|
+
}
|
|
1153
|
+
setLogs(result.logs || "(пусто)")
|
|
1154
|
+
} catch (err: any) {
|
|
1155
|
+
console.error("RPC Error (get_task_logs):", err)
|
|
1156
|
+
setLogs("Ошибка чтения логов: " + errorMessage(err))
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
async function handleUpdate() {
|
|
1161
|
+
const job = editingJob()
|
|
1162
|
+
if (!job) return
|
|
1163
|
+
setBusy(true)
|
|
1164
|
+
try {
|
|
1165
|
+
const result = await rpc.update_task({
|
|
1166
|
+
name: job.name,
|
|
1167
|
+
newSchedule: (schedule() || "").trim(),
|
|
1168
|
+
newPrompt: (prompt() || "").trim(),
|
|
1169
|
+
model: (model() || "").trim(),
|
|
1170
|
+
priority: priority(),
|
|
1171
|
+
retryCount: retryCount(),
|
|
1172
|
+
retryDelay: retryDelay(),
|
|
1173
|
+
qualityGate: (qualityGate() || "").trim(),
|
|
1174
|
+
beforeScript: (beforeScript() || "").trim(),
|
|
1175
|
+
afterScript: (afterScript() || "").trim(),
|
|
1176
|
+
dependsOn: dependsOn(),
|
|
1177
|
+
triggerType: triggerType(),
|
|
1178
|
+
mcpEvent:
|
|
1179
|
+
triggerType() === "mcp-event"
|
|
1180
|
+
? {
|
|
1181
|
+
server: (mcpServer() || "").trim(),
|
|
1182
|
+
event: (mcpEventName() || "").trim(),
|
|
1183
|
+
...(mcpFilter().trim() ? { filter: mcpFilter().trim() } : {}),
|
|
1184
|
+
}
|
|
1185
|
+
: undefined,
|
|
1186
|
+
watchPath: (watchPath() || "").trim(),
|
|
1187
|
+
workingDirectory: (workingDirectory() || "").trim(),
|
|
1188
|
+
workspaceId: (workspaceId() || "").trim() || undefined,
|
|
1189
|
+
allowedTools: allowedTools().length > 0 ? allowedTools() : [],
|
|
1190
|
+
deniedTools: deniedTools().length > 0 ? deniedTools() : [],
|
|
1191
|
+
matrix: matrixPayload(),
|
|
1192
|
+
})
|
|
1193
|
+
if (!result.success) {
|
|
1194
|
+
setCronError(result.message)
|
|
1195
|
+
ctx.toast.show({ title: "Ошибка обновления задачи", variant: "error", description: result.message })
|
|
1196
|
+
return
|
|
1197
|
+
}
|
|
1198
|
+
setEditingJob(null)
|
|
1199
|
+
setName("")
|
|
1200
|
+
setSchedule("* * * * *")
|
|
1201
|
+
setPrompt("")
|
|
1202
|
+
setRetryCount(0)
|
|
1203
|
+
setRetryDelay(60)
|
|
1204
|
+
setQualityGate("")
|
|
1205
|
+
setDependsOn([])
|
|
1206
|
+
setModel("")
|
|
1207
|
+
setPriority(DEFAULT_PRIORITY)
|
|
1208
|
+
setBeforeScript("")
|
|
1209
|
+
setAfterScript("")
|
|
1210
|
+
setTriggerType("cron")
|
|
1211
|
+
setWatchPath("")
|
|
1212
|
+
setMcpServer("")
|
|
1213
|
+
setMcpEventName("")
|
|
1214
|
+
setMcpFilter("")
|
|
1215
|
+
setWorkingDirectory("")
|
|
1216
|
+
setWorkspaceId("")
|
|
1217
|
+
setAllowedTools([])
|
|
1218
|
+
setDeniedTools([])
|
|
1219
|
+
resetMatrixForm()
|
|
1220
|
+
setCronPreset("* * * * *")
|
|
1221
|
+
await loadJobs()
|
|
1222
|
+
ctx.toast.show({ title: "Задача обновлена", variant: "success" })
|
|
1223
|
+
} catch (err: any) {
|
|
1224
|
+
console.error("RPC Error (update_task):", err)
|
|
1225
|
+
const msg = errorMessage(err)
|
|
1226
|
+
setCronError(msg)
|
|
1227
|
+
ctx.toast.show({ title: "Ошибка обновления задачи", variant: "error", description: msg })
|
|
1228
|
+
} finally {
|
|
1229
|
+
setBusy(false)
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
function startEditing(job: Job) {
|
|
1234
|
+
setEditingJob(job)
|
|
1235
|
+
setFormCollapsed(false)
|
|
1236
|
+
setName(job.name)
|
|
1237
|
+
setSchedule(job.schedule)
|
|
1238
|
+
setPrompt(job.prompt ?? "")
|
|
1239
|
+
setModel(job.model ?? "")
|
|
1240
|
+
setPriority(typeof job.priority === "number" ? job.priority : DEFAULT_PRIORITY)
|
|
1241
|
+
setRetryCount(job.retryCount ?? 0)
|
|
1242
|
+
setRetryDelay(job.retryDelay ?? 60)
|
|
1243
|
+
setQualityGate(job.qualityGate ?? "")
|
|
1244
|
+
setDependsOn(Array.isArray(job.dependsOn) ? job.dependsOn : [])
|
|
1245
|
+
setBeforeScript(job.beforeScript ?? "")
|
|
1246
|
+
setAfterScript(job.afterScript ?? "")
|
|
1247
|
+
setTriggerType(job.triggerType ?? "cron")
|
|
1248
|
+
setWatchPath(job.watchPath ?? "")
|
|
1249
|
+
setMcpServer(job.mcpEvent?.server ?? "")
|
|
1250
|
+
setMcpEventName(job.mcpEvent?.event ?? "")
|
|
1251
|
+
setMcpFilter(job.mcpEvent?.filter ?? "")
|
|
1252
|
+
setWorkingDirectory(job.workingDirectory ?? "")
|
|
1253
|
+
setWorkspaceId(job.workspaceId ?? "")
|
|
1254
|
+
setAllowedTools(Array.isArray(job.allowedTools) ? job.allowedTools : [])
|
|
1255
|
+
setDeniedTools(Array.isArray(job.deniedTools) ? job.deniedTools : [])
|
|
1256
|
+
if (job.matrix) {
|
|
1257
|
+
setMatrixMode(true)
|
|
1258
|
+
setMatrixWorkspaceIds(Array.isArray(job.matrix.workspaceIds) ? job.matrix.workspaceIds : [])
|
|
1259
|
+
setMatrixStrategy(job.matrix.strategy === "sequential" ? "sequential" : "parallel")
|
|
1260
|
+
setMatrixFailureMode(job.matrix.failureMode === "stop" ? "stop" : "continue")
|
|
1261
|
+
setMatrixAggregation(job.matrix.aggregation === "per-task" ? "per-task" : "summary")
|
|
1262
|
+
setMatrixAggregator(Boolean(job.matrix.createAggregator))
|
|
1263
|
+
setMatrixConcurrency(
|
|
1264
|
+
typeof job.matrix.concurrency === "number" ? String(job.matrix.concurrency) : ""
|
|
1265
|
+
)
|
|
1266
|
+
setMatrixOverrides(job.matrix.overrides ? { ...job.matrix.overrides } : {})
|
|
1267
|
+
} else {
|
|
1268
|
+
resetMatrixForm()
|
|
1269
|
+
}
|
|
1270
|
+
// Определяем пресет по расписанию
|
|
1271
|
+
const preset = CRON_PRESETS.find((p) => p.value === job.schedule)
|
|
1272
|
+
setCronPreset((preset ? preset.value : "__custom__") as any)
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
// Автообновление списка задач каждые 5 секунд
|
|
1276
|
+
loadJobs()
|
|
1277
|
+
loadWorkspacesGui()
|
|
1278
|
+
loadSettingsGui()
|
|
1279
|
+
loadPlatformGui()
|
|
1280
|
+
loadTemplatesGui()
|
|
1281
|
+
const timer = setInterval(loadJobs, 5000)
|
|
1282
|
+
onCleanup(() => clearInterval(timer))
|
|
1283
|
+
|
|
1284
|
+
const showCustomCron = cronPreset() === "__custom__"
|
|
1285
|
+
const isEditing = editingJob() !== null
|
|
1286
|
+
|
|
1287
|
+
const jobsArr = () => jobs() ?? []
|
|
1288
|
+
const visibleJobs = () => {
|
|
1289
|
+
const filter = workspaceFilter()
|
|
1290
|
+
if (filter === "all") return jobsArr()
|
|
1291
|
+
if (filter === "none") return jobsArr().filter((job) => !job.workspaceId)
|
|
1292
|
+
return jobsArr().filter((job) => job.workspaceId === filter)
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Кандидаты в зависимости: все задачи, кроме редактируемой/создаваемой.
|
|
1297
|
+
* Сравнение без учёта регистра — как в tasks.json.
|
|
1298
|
+
*/
|
|
1299
|
+
const dependencyCandidates = () => {
|
|
1300
|
+
const self = (editingJob()?.name ?? name()).trim().toLowerCase()
|
|
1301
|
+
return jobsArr()
|
|
1302
|
+
.map((job) => job.name)
|
|
1303
|
+
.filter((taskName) => taskName.trim().toLowerCase() !== self)
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
/** Добавляет/убирает задачу из списка DAG-зависимостей. */
|
|
1307
|
+
function toggleDependsOn(taskName: string, checked: boolean) {
|
|
1308
|
+
setDependsOn((current) => {
|
|
1309
|
+
if (checked) {
|
|
1310
|
+
return current.some((n) => n.toLowerCase() === taskName.toLowerCase())
|
|
1311
|
+
? current
|
|
1312
|
+
: [...current, taskName]
|
|
1313
|
+
}
|
|
1314
|
+
return current.filter((n) => n.toLowerCase() !== taskName.toLowerCase())
|
|
1315
|
+
})
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
// Имя задачи, на кнопке «Запустить» которой сейчас курсор (для снежинки в зимнем режиме).
|
|
1319
|
+
const [hoveredRun, setHoveredRun] = createSignal<string | null>(null)
|
|
1320
|
+
|
|
1321
|
+
/** Базовый стиль маленькой иконки-кнопки в карточке задачи. */
|
|
1322
|
+
function iconButtonStyle(active = false): string {
|
|
1323
|
+
return `background:${active ? "rgba(90,200,250,0.16)" : "transparent"};border:1px solid ${active ? "rgba(90,200,250,0.5)" : "#333"};border-radius:6px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;color:${active ? "#5ac8fa" : "#cfcfd2"};font-size:14px;line-height:1;padding:0;transition:background 0.18s ease, border-color 0.18s ease, color 0.18s ease`
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
/** Плавный hover: лёгкая подсветка фона + смена цвета иконки. */
|
|
1327
|
+
function iconHover(e: MouseEvent, on: boolean, active = false) {
|
|
1328
|
+
const btn = e.currentTarget as HTMLButtonElement | null
|
|
1329
|
+
if (!btn) return
|
|
1330
|
+
btn.style.background = on
|
|
1331
|
+
? "rgba(255,255,255,0.09)"
|
|
1332
|
+
: active
|
|
1333
|
+
? "rgba(90,200,250,0.16)"
|
|
1334
|
+
: "transparent"
|
|
1335
|
+
btn.style.borderColor = on ? "#5ac8fa" : active ? "rgba(90,200,250,0.5)" : "#333"
|
|
1336
|
+
btn.style.color = on || active ? "#5ac8fa" : "#cfcfd2"
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Карточка задачи.
|
|
1341
|
+
* SolidJS вызывает компонент с объектом пропсов, поэтому сигнатура
|
|
1342
|
+
* `(props: { job: Job })` соответствует вызову `<JobCard job={job} />`.
|
|
1343
|
+
* Обращаемся к `props.job` (а не деструктурируем) — так сохраняется реактивность.
|
|
1344
|
+
*/
|
|
1345
|
+
const JobCard = (props: { job: Job }) => {
|
|
1346
|
+
const job = props.job
|
|
1347
|
+
// Защита: без имени задача не может быть отрендерена и не должна слать RPC.
|
|
1348
|
+
if (!job || !job.name) return null
|
|
1349
|
+
return (
|
|
1350
|
+
<div
|
|
1351
|
+
style={`background:#252526;border-radius:10px;padding:16px;margin-bottom:12px;display:flex;flex-direction:column;gap:10px;border:1px solid ${winterMode() ? "rgba(135, 206, 250, 0.4)" : "#333"}`}
|
|
1352
|
+
>
|
|
1353
|
+
<div style="display:flex;justify-content:space-between;align-items:center;gap:12px;width:100%">
|
|
1354
|
+
<div style="display:flex;align-items:center;gap:12px;flex:1;min-width:0">
|
|
1355
|
+
<div style="flex:1;min-width:0">
|
|
1356
|
+
<div style="display:flex;align-items:center;gap:6px;min-width:0">
|
|
1357
|
+
<div style="font-weight:700;font-size:16px;color:#ffffff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">
|
|
1358
|
+
{job.name}
|
|
1359
|
+
</div>
|
|
1360
|
+
{job.workspaceName && (
|
|
1361
|
+
<span
|
|
1362
|
+
title={`Workspace: ${job.workspaceName}${job.workingDirectory ? ` (${job.workingDirectory})` : ""}`}
|
|
1363
|
+
style={`font-size:11px;font-weight:600;flex-shrink:0;cursor:help;white-space:nowrap;padding:2px 7px;border-radius:999px;border:1px solid ${job.workspaceColor || "#5ac8fa"};color:${job.workspaceColor || "#5ac8fa"};background:${(job.workspaceColor || "#5ac8fa")}1a`}
|
|
1364
|
+
>📦 {job.workspaceName}</span>
|
|
1365
|
+
)}
|
|
1366
|
+
{job.isMatrixParent && job.matrix && (
|
|
1367
|
+
<span
|
|
1368
|
+
title={`Matrix fan-out: ${job.matrix.workspaceIds.length} клонов, стратегия: ${job.matrix.strategy ?? "parallel"}, при ошибке: ${job.matrix.failureMode ?? "continue"}${
|
|
1369
|
+
job.matrix.concurrency
|
|
1370
|
+
? `, одновременно: ${job.matrix.concurrency}`
|
|
1371
|
+
: ""
|
|
1372
|
+
}${
|
|
1373
|
+
job.matrix.overrides
|
|
1374
|
+
? `, переопределено workspace: ${Object.keys(job.matrix.overrides).length}`
|
|
1375
|
+
: ""
|
|
1376
|
+
}`}
|
|
1377
|
+
style="font-size:11px;font-weight:600;flex-shrink:0;cursor:help;white-space:nowrap;padding:2px 7px;border-radius:999px;border:1px solid #ff9f0a;color:#ff9f0a;background:rgba(255,159,10,0.12)"
|
|
1378
|
+
>📦 Matrix ({job.matrix.workspaceIds.length}){job.matrix.concurrency ? ` ⚙${job.matrix.concurrency}` : ""}</span>
|
|
1379
|
+
)}
|
|
1380
|
+
{job.matrixParentId && (
|
|
1381
|
+
<span
|
|
1382
|
+
title={`Клон матрицы. Родитель: ${job.matrixParentId}`}
|
|
1383
|
+
style="font-size:11px;font-weight:600;flex-shrink:0;cursor:help;white-space:nowrap;padding:2px 7px;border-radius:999px;border:1px solid #8e8e93;color:#b0b0b6;background:rgba(142,142,147,0.12)"
|
|
1384
|
+
>↳ matrix {job.matrixParentId}</span>
|
|
1385
|
+
)}
|
|
1386
|
+
{job.watchPath && (
|
|
1387
|
+
<span title={`Отслеживание файла: ${job.watchPath}`} style="font-size:13px;flex-shrink:0;cursor:help">👁️</span>
|
|
1388
|
+
)}
|
|
1389
|
+
{(job.beforeScript || job.afterScript) && (
|
|
1390
|
+
<span
|
|
1391
|
+
title={`Lifecycle hooks: ${[job.beforeScript ? `pre: ${job.beforeScript}` : "", job.afterScript ? `post: ${job.afterScript}` : ""].filter(Boolean).join(" · ")}`}
|
|
1392
|
+
style="font-size:13px;flex-shrink:0;cursor:help"
|
|
1393
|
+
>⚡</span>
|
|
1394
|
+
)}
|
|
1395
|
+
{job.triggerType === "mcp-event" && (
|
|
1396
|
+
<span
|
|
1397
|
+
title={`MCP-событие: ${job.mcpEvent?.event ?? "—"}${job.mcpEvent?.filter ? ` (фильтр: ${job.mcpEvent.filter})` : ""}`}
|
|
1398
|
+
style="font-size:13px;flex-shrink:0;cursor:help"
|
|
1399
|
+
>📡</span>
|
|
1400
|
+
)}
|
|
1401
|
+
{job.model && (
|
|
1402
|
+
<span title={`Модель LLM: ${job.model}`} style="font-size:12px;flex-shrink:0;cursor:help;color:#c084fc;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:200px">🧠 {job.model}</span>
|
|
1403
|
+
)}
|
|
1404
|
+
{typeof job.priority === "number" && job.priority !== DEFAULT_PRIORITY && (
|
|
1405
|
+
<span title={`Приоритет: ${priorityLabel(job.priority)} (${job.priority})`} style="font-size:12px;flex-shrink:0;cursor:help;color:#f5a623;white-space:nowrap">🚀 {priorityLabel(job.priority)}</span>
|
|
1406
|
+
)}
|
|
1407
|
+
{(Array.isArray(job.allowedTools) && job.allowedTools.length > 0) || (Array.isArray(job.deniedTools) && job.deniedTools.length > 0) ? (
|
|
1408
|
+
<span
|
|
1409
|
+
title={`Ограничения инструментов: ${[
|
|
1410
|
+
job.allowedTools?.length ? `allowed=[${job.allowedTools.join(", ")}]` : "",
|
|
1411
|
+
job.deniedTools?.length ? `denied=[${job.deniedTools.join(", ")}]` : "",
|
|
1412
|
+
].filter(Boolean).join(" · ")}`}
|
|
1413
|
+
style="font-size:13px;flex-shrink:0;cursor:help"
|
|
1414
|
+
>🔒</span>
|
|
1415
|
+
) : null}
|
|
1416
|
+
</div>
|
|
1417
|
+
{Array.isArray(job.dependsOn) && job.dependsOn.length > 0 && (
|
|
1418
|
+
<div style="display:flex;flex-direction:column;gap:2px;margin-top:4px;font-size:11px;line-height:1.35">
|
|
1419
|
+
<span style="color:#5ac8fa;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">🔗 Зависит от: {job.dependsOn.join(" + ")}</span>
|
|
1420
|
+
</div>
|
|
1421
|
+
)}
|
|
1422
|
+
{job.isMatrixParent && job.matrixSummary && (
|
|
1423
|
+
<div style="display:flex;flex-direction:column;gap:2px;margin-top:4px;font-size:11px;line-height:1.35">
|
|
1424
|
+
<span
|
|
1425
|
+
title={job.matrixSummary.message}
|
|
1426
|
+
style={`cursor:help;color:${statusColor(job.matrixSummary.status as JobStatus)};white-space:nowrap;overflow:hidden;text-overflow:ellipsis`}
|
|
1427
|
+
>
|
|
1428
|
+
📦 Matrix: {job.matrixSummary.successCount}/{job.matrixSummary.totalCount} успешных
|
|
1429
|
+
{job.matrixSummary.errorCount > 0 ? ` · ❌ ${job.matrixSummary.errorCount}` : ""}
|
|
1430
|
+
{job.matrixSummary.pendingCount > 0 ? ` · ⏳ ${job.matrixSummary.pendingCount}` : ""}
|
|
1431
|
+
</span>
|
|
1432
|
+
</div>
|
|
1433
|
+
)}
|
|
1434
|
+
<div style="font-size:12px;color:#a0a0a6;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">
|
|
1435
|
+
📊 Всего: {metrics().total} | ✅ {metrics().success} | ❌ {metrics().error}
|
|
1436
|
+
</div>
|
|
1437
|
+
{(job.schedule || job.nextRun) && (
|
|
1438
|
+
<div style="display:flex;align-items:center;gap:8px;font-size:12px;color:#a0a0a6;margin-top:2px">
|
|
1439
|
+
<span style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">{job.schedule}</span>
|
|
1440
|
+
{job.nextRun && <span>→ {job.nextRun}</span>}
|
|
1441
|
+
</div>
|
|
1442
|
+
)}
|
|
1443
|
+
</div>
|
|
1444
|
+
<div style="display:flex;align-items:center;gap:8px;flex-shrink:0;min-width:110px">
|
|
1445
|
+
{job.status === "running" ? (
|
|
1446
|
+
<div style="font-size:12px;color:#f5a623;font-weight:600;white-space:nowrap">
|
|
1447
|
+
🟡 Выполняется: {runningSec()} сек
|
|
1448
|
+
</div>
|
|
1449
|
+
) : (
|
|
1450
|
+
<div style="font-size:12px;font-weight:600;white-space:nowrap">
|
|
1451
|
+
{job.status === "success"
|
|
1452
|
+
? "🟢 Готова"
|
|
1453
|
+
: job.status === "error"
|
|
1454
|
+
? "🔴 Ошибка"
|
|
1455
|
+
: job.status === "partial"
|
|
1456
|
+
? "🟠 Частично"
|
|
1457
|
+
: "⚪ Пауза"}
|
|
1458
|
+
</div>
|
|
1459
|
+
)}
|
|
1460
|
+
</div>
|
|
1461
|
+
</div>
|
|
1462
|
+
<div style="display:flex;gap:6px">
|
|
1463
|
+
<button
|
|
1464
|
+
onClick={() => void handleRun(job.name)}
|
|
1465
|
+
title={`Запустить "${job.name}"`}
|
|
1466
|
+
style={iconButtonStyle()}
|
|
1467
|
+
onMouseEnter={(e) => {
|
|
1468
|
+
iconHover(e, true)
|
|
1469
|
+
if (winterMode()) setHoveredRun(job.name)
|
|
1470
|
+
}}
|
|
1471
|
+
onMouseLeave={(e) => {
|
|
1472
|
+
iconHover(e, false)
|
|
1473
|
+
setHoveredRun((n) => (n === job.name ? null : n))
|
|
1474
|
+
}}
|
|
1475
|
+
>
|
|
1476
|
+
{winterMode() && hoveredRun() === job.name ? "❄️" : "▶"}
|
|
1477
|
+
</button>
|
|
1478
|
+
<button
|
|
1479
|
+
onClick={() => void (job.paused ? handleResume(job.name) : handlePause(job.name))}
|
|
1480
|
+
title={job.paused ? `Возобновить "${job.name}"` : `Поставить на паузу "${job.name}"`}
|
|
1481
|
+
style={iconButtonStyle()}
|
|
1482
|
+
onMouseEnter={(e) => iconHover(e, true)}
|
|
1483
|
+
onMouseLeave={(e) => iconHover(e, false)}
|
|
1484
|
+
>
|
|
1485
|
+
{job.paused ? "▶" : "⏸"}
|
|
1486
|
+
</button>
|
|
1487
|
+
<button
|
|
1488
|
+
onClick={() => void showLogs(job.name)}
|
|
1489
|
+
title={`Логи "${job.name}"`}
|
|
1490
|
+
style={iconButtonStyle()}
|
|
1491
|
+
onMouseEnter={(e) => iconHover(e, true)}
|
|
1492
|
+
onMouseLeave={(e) => iconHover(e, false)}
|
|
1493
|
+
>
|
|
1494
|
+
📄
|
|
1495
|
+
</button>
|
|
1496
|
+
<button
|
|
1497
|
+
onClick={() => void openDryRun(job.name)}
|
|
1498
|
+
title={`Dry-Run симуляция "${job.name}"`}
|
|
1499
|
+
style={iconButtonStyle(dryRunOpen() && dryRunName() === job.name)}
|
|
1500
|
+
onMouseEnter={(e) => iconHover(e, true, dryRunOpen() && dryRunName() === job.name)}
|
|
1501
|
+
onMouseLeave={(e) => iconHover(e, false, dryRunOpen() && dryRunName() === job.name)}
|
|
1502
|
+
>
|
|
1503
|
+
🧪
|
|
1504
|
+
</button>
|
|
1505
|
+
<button
|
|
1506
|
+
onClick={() => void fetchHistory(job.name)}
|
|
1507
|
+
title={`История "${job.name}"`}
|
|
1508
|
+
style={iconButtonStyle(historyOpen() === job.name)}
|
|
1509
|
+
onMouseEnter={(e) => iconHover(e, true, historyOpen() === job.name)}
|
|
1510
|
+
onMouseLeave={(e) => iconHover(e, false, historyOpen() === job.name)}
|
|
1511
|
+
>
|
|
1512
|
+
📜
|
|
1513
|
+
</button>
|
|
1514
|
+
<button
|
|
1515
|
+
onClick={() => void startEditing(job)}
|
|
1516
|
+
title={`Редактировать "${job.name}"`}
|
|
1517
|
+
style={iconButtonStyle()}
|
|
1518
|
+
onMouseEnter={(e) => iconHover(e, true)}
|
|
1519
|
+
onMouseLeave={(e) => iconHover(e, false)}
|
|
1520
|
+
>
|
|
1521
|
+
✏️
|
|
1522
|
+
</button>
|
|
1523
|
+
{job.matrix && (
|
|
1524
|
+
<button
|
|
1525
|
+
onClick={() => void handleCancelMatrix(job.name)}
|
|
1526
|
+
title={`Отменить выполняющиеся клоны матрицы "${job.name}"`}
|
|
1527
|
+
style={iconButtonStyle()}
|
|
1528
|
+
onMouseEnter={(e) => iconHover(e, true)}
|
|
1529
|
+
onMouseLeave={(e) => iconHover(e, false)}
|
|
1530
|
+
>
|
|
1531
|
+
⛔
|
|
1532
|
+
</button>
|
|
1533
|
+
)}
|
|
1534
|
+
{!job.matrixParentId && (
|
|
1535
|
+
<button
|
|
1536
|
+
onClick={() => void handleDelete(job.name)}
|
|
1537
|
+
title={job.matrix ? `Удалить матрицу "${job.name}" вместе с клонами` : `Удалить "${job.name}"`}
|
|
1538
|
+
style={iconButtonStyle()}
|
|
1539
|
+
onMouseEnter={(e) => iconHover(e, true)}
|
|
1540
|
+
onMouseLeave={(e) => iconHover(e, false)}
|
|
1541
|
+
>
|
|
1542
|
+
🗑
|
|
1543
|
+
</button>
|
|
1544
|
+
)}
|
|
1545
|
+
</div>
|
|
1546
|
+
</div>
|
|
1547
|
+
{historyOpen() === job.name && (
|
|
1548
|
+
<div style="margin-top:8px;padding:8px 12px;background:#1e1e1e;border:1px solid #333;border-radius:6px;display:flex;flex-direction:column;gap:6px;width:100%">
|
|
1549
|
+
<div style="font-size:12px;font-weight:600;color:#ffffff;display:flex;align-items:center;gap:6px">
|
|
1550
|
+
📜 История последних запусков
|
|
1551
|
+
<button
|
|
1552
|
+
onClick={() => setHistoryOpen(null)}
|
|
1553
|
+
style="background:none;border:none;color:#8e8e93;cursor:pointer;font-size:14px;padding:0"
|
|
1554
|
+
onMouseEnter={(e) => { (e.target as HTMLButtonElement).style.color = "#ffffff" }}
|
|
1555
|
+
onMouseLeave={(e) => { (e.target as HTMLButtonElement).style.color = "#8e8e93" }}
|
|
1556
|
+
>
|
|
1557
|
+
✕
|
|
1558
|
+
</button>
|
|
1559
|
+
</div>
|
|
1560
|
+
{history().length === 0 ? (
|
|
1561
|
+
<div style="font-size:12px;color:#8e8e93;padding:6px 0">Запусков пока нет.</div>
|
|
1562
|
+
) : (
|
|
1563
|
+
history().map((r) => (
|
|
1564
|
+
<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">
|
|
1565
|
+
<span style="color:#8e8e93;white-space:nowrap">{new Date(r.startedAt).toLocaleString()}</span>
|
|
1566
|
+
<span style={{color: r.status === "success" ? "#34c759" : "#ff3b30", fontWeight: 600, whiteSpace: "nowrap"}}>
|
|
1567
|
+
{r.status === "success" ? "✅ Успех" : "❌ Ошибка"}
|
|
1568
|
+
</span>
|
|
1569
|
+
<span style="color:#b0b0b0;white-space:nowrap">{r.durationMs} мс</span>
|
|
1570
|
+
{r.model && (
|
|
1571
|
+
<span style="color:#c084fc;white-space:nowrap" title={`Модель: ${r.model}`}>🧠 {r.model}</span>
|
|
1572
|
+
)}
|
|
1573
|
+
{r.preFlightStatus && r.preFlightStatus !== "skipped" && (
|
|
1574
|
+
<span
|
|
1575
|
+
title={`Pre-flight: ${r.preFlightStatus}`}
|
|
1576
|
+
style={{ color: r.preFlightStatus === "success" ? "#34c759" : "#ff3b30", whiteSpace: "nowrap" }}
|
|
1577
|
+
>
|
|
1578
|
+
⚡ pre: {r.preFlightStatus === "success" ? "✅" : "❌"}
|
|
1579
|
+
</span>
|
|
1580
|
+
)}
|
|
1581
|
+
{r.postFlightStatus && r.postFlightStatus !== "skipped" && (
|
|
1582
|
+
<span
|
|
1583
|
+
title={`Post-flight: ${r.postFlightStatus}`}
|
|
1584
|
+
style={{ color: r.postFlightStatus === "success" ? "#34c759" : "#ff3b30", whiteSpace: "nowrap" }}
|
|
1585
|
+
>
|
|
1586
|
+
⚡ post: {r.postFlightStatus === "success" ? "✅" : "❌"}
|
|
1587
|
+
</span>
|
|
1588
|
+
)}
|
|
1589
|
+
{r.error && (
|
|
1590
|
+
<div style="margin-top:2px;color:#ff6b6b;font-size:11px;white-space:pre-wrap;word-break:break-word">{r.error}</div>
|
|
1591
|
+
)}
|
|
1592
|
+
{r.nextTask && (
|
|
1593
|
+
<span style="color:#5ac8fa;font-size:11px;white-space:nowrap" title="Запущена следующая задача в цепочке">🔗 → {r.nextTask}</span>
|
|
1594
|
+
)}
|
|
1595
|
+
</div>
|
|
1596
|
+
))
|
|
1597
|
+
)}
|
|
1598
|
+
</div>
|
|
1599
|
+
)}
|
|
1600
|
+
{dryRunOpen() && dryRunName() === job.name && (
|
|
1601
|
+
<div style="margin-top:8px;padding:8px 12px;background:#1e1e1e;border:1px solid #333;border-radius:6px;display:flex;flex-direction:column;gap:6px;width:100%">
|
|
1602
|
+
<div style="font-size:12px;font-weight:600;color:#ffffff;display:flex;align-items:center;gap:6px">
|
|
1603
|
+
🧪 Dry-Run: {job.name}
|
|
1604
|
+
<button
|
|
1605
|
+
onClick={() => closeDryRun()}
|
|
1606
|
+
style="background:none;border:none;color:#8e8e93;cursor:pointer;font-size:14px;padding:0"
|
|
1607
|
+
onMouseEnter={(e) => { (e.target as HTMLButtonElement).style.color = "#ffffff" }}
|
|
1608
|
+
onMouseLeave={(e) => { (e.target as HTMLButtonElement).style.color = "#8e8e93" }}
|
|
1609
|
+
>
|
|
1610
|
+
✕
|
|
1611
|
+
</button>
|
|
1612
|
+
</div>
|
|
1613
|
+
{dryRunBusy() && <div style="font-size:12px;color:#8e8e93;padding:6px 0">Симуляция…</div>}
|
|
1614
|
+
{!dryRunBusy() && dryRunReport() && !dryRunReport().success && (
|
|
1615
|
+
<div style="font-size:12px;color:#ff6b6b;padding:6px 0">❌ {dryRunReport().error ?? "Симуляция не удалась"}</div>
|
|
1616
|
+
)}
|
|
1617
|
+
{!dryRunBusy() && dryRunReport() && dryRunReport().success && (
|
|
1618
|
+
<div style="display:flex;flex-direction:column;gap:4px">
|
|
1619
|
+
{Array.isArray(dryRunReport().warnings) && dryRunReport().warnings.length > 0 && (
|
|
1620
|
+
<div style="font-size:11px;color:#f5a623;padding:4px 0">
|
|
1621
|
+
⚠ {dryRunReport().warnings.map((w: string) => `· ${w}`).join(" | ")}
|
|
1622
|
+
</div>
|
|
1623
|
+
)}
|
|
1624
|
+
{dryRunReport().tasks.map((t: any) => (
|
|
1625
|
+
<div key={`${t.name}-${t.order}`} style="font-size:11px;color:#e0e0e0;padding:4px 0;border-bottom:1px solid #333;display:flex;flex-wrap:wrap;gap:6px;align-items:baseline">
|
|
1626
|
+
<span style="color:#8e8e93;white-space:nowrap">#{(t.order ?? 0) + 1} {t.trigger}</span>
|
|
1627
|
+
<span style="font-weight:600;white-space:nowrap">🧪 {t.name}</span>
|
|
1628
|
+
{t.workspace && <span style="color:#5ac8fa;white-space:nowrap">📦 {t.workspace.name}</span>}
|
|
1629
|
+
{t.matrixParent && <span style="color:#ff9f0a;white-space:nowrap">↳ matrix {t.matrixParent}</span>}
|
|
1630
|
+
<span style="color:#8e8e93;white-space:nowrap">cwd: {t.cwd || "(папка проекта)"}</span>
|
|
1631
|
+
{t.roleScoped && <span style="cursor:help" title={`allowed=[${(t.roleScoped.allowed ?? []).join(", ")}] · denied=[${(t.roleScoped.denied ?? []).join(", ")}]`}>🔒</span>}
|
|
1632
|
+
{t.estimatedDurationSec != null && <span style="color:#8e8e93;white-space:nowrap">⏱ ~{t.estimatedDurationSec} с</span>}
|
|
1633
|
+
{t.estimatedTokens != null && <span style="color:#8e8e93;white-space:nowrap">· ~{t.estimatedTokens} ток.</span>}
|
|
1634
|
+
{t.estimatedCostUsd != null && <span style="color:#8e8e93;white-space:nowrap">· ~${Number(t.estimatedCostUsd).toFixed(4)}</span>}
|
|
1635
|
+
<div style="width:100%;color:#a0a0a6;overflow-wrap:anywhere">$ {t.command}</div>
|
|
1636
|
+
{t.preFlight && <div style="width:100%;color:#8e8e93;overflow-wrap:anywhere">⚡ pre: {t.preFlight}</div>}
|
|
1637
|
+
{t.postFlight && <div style="width:100%;color:#8e8e93;overflow-wrap:anywhere">⚡ post: {t.postFlight}</div>}
|
|
1638
|
+
{t.qualityGate && <div style="width:100%;color:#8e8e93;overflow-wrap:anywhere">✅ QG: {t.qualityGate}</div>}
|
|
1639
|
+
</div>
|
|
1640
|
+
))}
|
|
1641
|
+
{dryRunReport().totals && (dryRunReport().totals.estimatedDurationSec != null || dryRunReport().totals.estimatedTokens != null) && (
|
|
1642
|
+
<div style="font-size:11px;color:#b0b0b0;padding:4px 0">
|
|
1643
|
+
Σ {(dryRunReport().totals.estimatedDurationSec ?? "—") + " с · " +
|
|
1644
|
+
(dryRunReport().totals.estimatedTokens ?? "—") + " токенов" +
|
|
1645
|
+
(dryRunReport().totals.estimatedCostUsd != null ? ` · ~$${Number(dryRunReport().totals.estimatedCostUsd).toFixed(4)}` : "")}
|
|
1646
|
+
</div>
|
|
1647
|
+
)}
|
|
1648
|
+
</div>
|
|
1649
|
+
)}
|
|
1650
|
+
</div>
|
|
1651
|
+
)}
|
|
1652
|
+
</div>
|
|
1653
|
+
)
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
try {
|
|
1657
|
+
return ctx.add(Panel, {
|
|
1658
|
+
id: "scheduler-jobs",
|
|
1659
|
+
region: "side",
|
|
1660
|
+
list: () => [{ id: "jobs", title: "Планировщик", pinned: true }],
|
|
1661
|
+
render: () => (
|
|
1662
|
+
<ErrorBoundary fallback={(err: any) => (
|
|
1663
|
+
<div style="padding:16px;color:#ff3b30;font-size:13px">
|
|
1664
|
+
Ошибка UI: {err.message}
|
|
1665
|
+
</div>
|
|
1666
|
+
)}>
|
|
1667
|
+
<div style={`display:flex;flex-direction:column;width:100%;height:100%;max-height:100vh;min-height:0;box-sizing:border-box;overflow-y:auto;overflow-x:hidden;gap:24px;padding:20px;font-size:13px;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;color:#e0e0e0;transition:background 0.3s ease;scrollbar-width:thin;scrollbar-color:#444 transparent;background:${winterMode() ? "linear-gradient(180deg, #0f172a 0%, #000000 100%)" : "#0f0f0f"}`}>
|
|
1668
|
+
<div style="display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap">
|
|
1669
|
+
<div style="min-width:0">
|
|
1670
|
+
<h2 style="margin:0;font-size:22px;font-weight:800;letter-spacing:0.2px;line-height:1.2;color:#ffffff">
|
|
1671
|
+
{winterMode() ? `❄️ ${schedulerTitle()} ❄️` : schedulerTitle()}
|
|
1672
|
+
</h2>
|
|
1673
|
+
<div style="margin-top:5px;font-size:11px;font-weight:600;letter-spacing:1.2px;text-transform:uppercase;color:#8e8e93">
|
|
1674
|
+
Local AI CI/CD Orchestrator
|
|
1675
|
+
</div>
|
|
1676
|
+
</div>
|
|
1677
|
+
<div style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
|
1678
|
+
<select
|
|
1679
|
+
value={workspaceFilter()}
|
|
1680
|
+
onChange={(e) => setWorkspaceFilter(e.currentTarget.value)}
|
|
1681
|
+
title="Фильтр задач по workspace"
|
|
1682
|
+
style="padding:6px 10px;border-radius:999px;cursor:pointer;font-size:12px;border:1px solid #333;background:#1e1e1e;color:#e0e0e0;outline:none;max-width:200px"
|
|
1683
|
+
>
|
|
1684
|
+
<option value="all">Все workspace</option>
|
|
1685
|
+
{workspaces().map((workspace) => (
|
|
1686
|
+
<option key={workspace.id} value={workspace.id}>📦 {workspace.name}</option>
|
|
1687
|
+
))}
|
|
1688
|
+
<option value="none">Без workspace</option>
|
|
1689
|
+
</select>
|
|
1690
|
+
<button
|
|
1691
|
+
onClick={async () => {
|
|
1692
|
+
// Открываем окно сразу (внутри клика), чтобы не сработал блокировщик попапов.
|
|
1693
|
+
const win = window.open("", "_blank");
|
|
1694
|
+
let port = 3782;
|
|
1695
|
+
try {
|
|
1696
|
+
const info = await rpc.get_dashboard_port({});
|
|
1697
|
+
if (info && typeof info.port === "number" && info.port > 0) {
|
|
1698
|
+
port = info.port;
|
|
1699
|
+
}
|
|
1700
|
+
} catch (err) {
|
|
1701
|
+
console.warn("[scheduler] Не удалось получить порт дашборда:", err);
|
|
1702
|
+
}
|
|
1703
|
+
const url = "http://localhost:" + port;
|
|
1704
|
+
if (win) win.location.href = url;
|
|
1705
|
+
else window.open(url, "_blank");
|
|
1706
|
+
}}
|
|
1707
|
+
title="Открыть локальный веб-дашборд (фактический порт сервера)"
|
|
1708
|
+
style="display:flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;cursor:pointer;font-size:12px;user-select:none;white-space:nowrap;transition:background 0.2s ease, border-color 0.2s ease;border:1px solid #333;background:#1e1e1e;color:#e0e0e0"
|
|
1709
|
+
onMouseEnter={(e) => { const b = e.currentTarget; b.style.borderColor = "#5ac8fa"; b.style.background = "rgba(90,200,250,0.12)"; b.style.color = "#5ac8fa" }}
|
|
1710
|
+
onMouseLeave={(e) => { const b = e.currentTarget; b.style.borderColor = "#333"; b.style.background = "#1e1e1e"; b.style.color = "#e0e0e0" }}
|
|
1711
|
+
>
|
|
1712
|
+
🌐 Открыть дашборд
|
|
1713
|
+
</button>
|
|
1714
|
+
<label
|
|
1715
|
+
title="Переключить зимнюю тему"
|
|
1716
|
+
style={`display:flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;cursor:pointer;font-size:12px;user-select:none;white-space:nowrap;transition:background 0.2s ease, border-color 0.2s ease;border:1px solid ${winterMode() ? "rgba(135, 206, 250, 0.5)" : "#333"};background:${winterMode() ? "rgba(135, 206, 250, 0.12)" : "#1e1e1e"};color:#e0e0e0`}
|
|
1717
|
+
>
|
|
1718
|
+
<input
|
|
1719
|
+
type="checkbox"
|
|
1720
|
+
checked={winterMode()}
|
|
1721
|
+
onChange={(e) => void toggleWinterMode(e.currentTarget.checked)}
|
|
1722
|
+
style="accent-color:#5ac8fa;cursor:pointer;margin:0"
|
|
1723
|
+
/>
|
|
1724
|
+
❄️ Зимний режим
|
|
1725
|
+
</label>
|
|
1726
|
+
</div>
|
|
1727
|
+
</div>
|
|
1728
|
+
|
|
1729
|
+
<div style="display:flex;gap:8px;flex-wrap:wrap;margin-top:8px">
|
|
1730
|
+
<button
|
|
1731
|
+
onClick={handleExport}
|
|
1732
|
+
disabled={exportBusy()}
|
|
1733
|
+
style={`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${exportBusy() ? "not-allowed" : "pointer"};font-size:12px;font-weight:500;opacity:${exportBusy() ? 0.6 : 1};transition:background 0.18s ease`}
|
|
1734
|
+
>
|
|
1735
|
+
{exportBusy() ? "Экспорт..." : "Экспорт"}
|
|
1736
|
+
</button>
|
|
1737
|
+
<input
|
|
1738
|
+
type="file"
|
|
1739
|
+
accept=".json"
|
|
1740
|
+
onChange={handleImportFile}
|
|
1741
|
+
style="display:none"
|
|
1742
|
+
/>
|
|
1743
|
+
<button
|
|
1744
|
+
onClick={() => document.querySelector('input[type="file"]')?.click()}
|
|
1745
|
+
disabled={importBusy()}
|
|
1746
|
+
style={`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${importBusy() ? "not-allowed" : "pointer"};font-size:12px;font-weight:500;opacity:${importBusy() ? 0.6 : 1};transition:background 0.18s ease`}
|
|
1747
|
+
>
|
|
1748
|
+
{importBusy() ? "Импорт..." : "Импорт"}
|
|
1749
|
+
</button>
|
|
1750
|
+
</div>
|
|
1751
|
+
|
|
1752
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px">
|
|
1753
|
+
<label style="font-size:12px;color:#b0b0b0;font-weight:500;white-space:nowrap">Макс. одновременных задач:</label>
|
|
1754
|
+
<input
|
|
1755
|
+
type="number"
|
|
1756
|
+
min="0"
|
|
1757
|
+
value={maxConcurrent()}
|
|
1758
|
+
onChange={(e) => saveSettingsGui(Number(e.currentTarget.value) || 1)}
|
|
1759
|
+
style="width:60px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
1760
|
+
/>
|
|
1761
|
+
<span style="font-size:11px;color:#8e8e93;white-space:nowrap">(0 = без ограничений)</span>
|
|
1762
|
+
</div>
|
|
1763
|
+
|
|
1764
|
+
{/* 🔔 Уведомления (сворачиваемая секция, чтобы не загромождать форму) */}
|
|
1765
|
+
<div style="width:100%;max-width:700px;box-sizing:border-box;margin-top:8px;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden">
|
|
1766
|
+
<button
|
|
1767
|
+
onClick={() => setNotificationsCollapsed(!notificationsCollapsed())}
|
|
1768
|
+
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"
|
|
1769
|
+
>
|
|
1770
|
+
<span>🔔 Уведомления</span>
|
|
1771
|
+
<span style="display:flex;align-items:center;gap:8px;font-size:11px;font-weight:400;color:#8e8e93">
|
|
1772
|
+
{notificationsEnabled() ? (onlyOnError() ? "только ошибки" : "все запуски") : "выключены"}
|
|
1773
|
+
<span>{notificationsCollapsed() ? "▾" : "▴"}</span>
|
|
1774
|
+
</span>
|
|
1775
|
+
</button>
|
|
1776
|
+
|
|
1777
|
+
{!notificationsCollapsed() && (
|
|
1778
|
+
<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px">
|
|
1779
|
+
<label style="display:flex;align-items:center;gap:8px;font-size:12px;color:#e0e0e0;cursor:pointer">
|
|
1780
|
+
<input
|
|
1781
|
+
type="checkbox"
|
|
1782
|
+
checked={notificationsEnabled()}
|
|
1783
|
+
onChange={(e) => {
|
|
1784
|
+
setNotificationsEnabled(e.currentTarget.checked)
|
|
1785
|
+
void saveNotificationSettings()
|
|
1786
|
+
}}
|
|
1787
|
+
style="accent-color:#5ac8fa;cursor:pointer;margin:0"
|
|
1788
|
+
/>
|
|
1789
|
+
Включить уведомления
|
|
1790
|
+
</label>
|
|
1791
|
+
|
|
1792
|
+
<label style={`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${notificationsEnabled() ? 1 : 0.5}`}>
|
|
1793
|
+
<input
|
|
1794
|
+
type="checkbox"
|
|
1795
|
+
checked={onlyOnError()}
|
|
1796
|
+
disabled={!notificationsEnabled()}
|
|
1797
|
+
onChange={(e) => {
|
|
1798
|
+
setOnlyOnError(e.currentTarget.checked)
|
|
1799
|
+
void saveNotificationSettings()
|
|
1800
|
+
}}
|
|
1801
|
+
style="accent-color:#5ac8fa;cursor:pointer;margin:0"
|
|
1802
|
+
/>
|
|
1803
|
+
Только при ошибке
|
|
1804
|
+
</label>
|
|
1805
|
+
|
|
1806
|
+
<div style="border-top:1px solid #333;padding-top:10px;display:flex;flex-direction:column;gap:8px">
|
|
1807
|
+
<label style={`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${notificationsEnabled() ? 1 : 0.5}`}>
|
|
1808
|
+
<input
|
|
1809
|
+
type="checkbox"
|
|
1810
|
+
checked={webhookEnabled()}
|
|
1811
|
+
disabled={!notificationsEnabled()}
|
|
1812
|
+
onChange={(e) => {
|
|
1813
|
+
setWebhookEnabled(e.currentTarget.checked)
|
|
1814
|
+
void saveNotificationSettings()
|
|
1815
|
+
}}
|
|
1816
|
+
style="accent-color:#5ac8fa;cursor:pointer;margin:0"
|
|
1817
|
+
/>
|
|
1818
|
+
Webhook (Discord / Slack / generic)
|
|
1819
|
+
</label>
|
|
1820
|
+
<input
|
|
1821
|
+
type="url"
|
|
1822
|
+
value={webhookUrl() || ""}
|
|
1823
|
+
disabled={!notificationsEnabled() || !webhookEnabled()}
|
|
1824
|
+
onInput={(e) => setWebhookUrl(e.currentTarget.value)}
|
|
1825
|
+
onChange={() => void saveNotificationSettings()}
|
|
1826
|
+
placeholder="https://discord.com/api/webhooks/..."
|
|
1827
|
+
style={`display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none;opacity:${notificationsEnabled() && webhookEnabled() ? 1 : 0.5}`}
|
|
1828
|
+
/>
|
|
1829
|
+
<div style="font-size:11px;color:#8e8e93">
|
|
1830
|
+
POST с JSON {"{ content, text }"} — совместимо с Discord и Slack.
|
|
1831
|
+
</div>
|
|
1832
|
+
</div>
|
|
1833
|
+
|
|
1834
|
+
<div style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
|
1835
|
+
<button
|
|
1836
|
+
onClick={() => void handleTestNotification()}
|
|
1837
|
+
disabled={testNotificationBusy() || !webhookEnabled()}
|
|
1838
|
+
style={`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${testNotificationBusy() || !webhookEnabled() ? "not-allowed" : "pointer"};font-size:12px;font-weight:500;opacity:${testNotificationBusy() || !webhookEnabled() ? 0.6 : 1}`}
|
|
1839
|
+
>
|
|
1840
|
+
{testNotificationBusy() ? "Отправка..." : "🧪 Тестовое уведомление"}
|
|
1841
|
+
</button>
|
|
1842
|
+
<span style="font-size:11px;color:#8e8e93">
|
|
1843
|
+
ntfy.sh не используется — только webhook.
|
|
1844
|
+
</span>
|
|
1845
|
+
</div>
|
|
1846
|
+
</div>
|
|
1847
|
+
)}
|
|
1848
|
+
</div>
|
|
1849
|
+
|
|
1850
|
+
{/* 📦 Multi-repo workspaces */}
|
|
1851
|
+
<div style="width:100%;max-width:700px;box-sizing:border-box;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden">
|
|
1852
|
+
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px">
|
|
1853
|
+
<button
|
|
1854
|
+
onClick={() => setWorkspacesCollapsed(!workspacesCollapsed())}
|
|
1855
|
+
style="display:flex;align-items:center;gap:8px;background:transparent;border:none;color:#e0e0e0;font-size:12px;font-weight:600;cursor:pointer;text-align:left;padding:0"
|
|
1856
|
+
>
|
|
1857
|
+
<span>📦 Workspaces</span>
|
|
1858
|
+
<span style="font-size:11px;font-weight:400;color:#8e8e93">{workspaces().length}</span>
|
|
1859
|
+
<span style="font-size:11px;color:#8e8e93">{workspacesCollapsed() ? "▾" : "▴"}</span>
|
|
1860
|
+
</button>
|
|
1861
|
+
<button
|
|
1862
|
+
onClick={() => void handleAddWorkspace()}
|
|
1863
|
+
disabled={workspaceBusy()}
|
|
1864
|
+
title="Добавить workspace (git-репозиторий)"
|
|
1865
|
+
style={`padding:5px 10px;border-radius:6px;border:1px solid #333;background:#252526;color:${workspaceBusy() ? "#666" : "#5ac8fa"};font-size:11px;font-weight:600;cursor:${workspaceBusy() ? "not-allowed" : "pointer"}`}
|
|
1866
|
+
>
|
|
1867
|
+
+ Добавить
|
|
1868
|
+
</button>
|
|
1869
|
+
</div>
|
|
1870
|
+
{!workspacesCollapsed() && (
|
|
1871
|
+
<div style="display:flex;flex-direction:column;gap:6px;padding:0 14px 12px">
|
|
1872
|
+
{workspaces().length === 0 ? (
|
|
1873
|
+
<div style="font-size:12px;color:#8e8e93;padding:4px 0">
|
|
1874
|
+
Workspace не добавлен. Задача без workspace использует рабочую директорию проекта.
|
|
1875
|
+
</div>
|
|
1876
|
+
) : (
|
|
1877
|
+
workspaces().map((workspace) => (
|
|
1878
|
+
<div style="display:flex;align-items:center;gap:10px;padding:8px 10px;background:#252526;border:1px solid #333;border-radius:8px;min-width:0">
|
|
1879
|
+
<span style={`width:9px;height:9px;border-radius:50%;background:${workspace.color || "#5ac8fa"};flex-shrink:0`}></span>
|
|
1880
|
+
<div style="display:flex;flex-direction:column;gap:2px;flex:1;min-width:0">
|
|
1881
|
+
<span style="font-size:12px;font-weight:700;color:#ffffff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">📦 {workspace.name}</span>
|
|
1882
|
+
<span style="font-size:10px;color:#8e8e93;white-space:nowrap;overflow:hidden;text-overflow:ellipsis" title={workspace.path}>{workspace.path}</span>
|
|
1883
|
+
<span style="font-size:10px;color:#a0a0a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">
|
|
1884
|
+
git: {workspace.gitBranch || "—"} · {workspace.gitRemote || "remote не задан"}
|
|
1885
|
+
</span>
|
|
1886
|
+
</div>
|
|
1887
|
+
<div style="display:flex;gap:4px;flex-shrink:0">
|
|
1888
|
+
<button
|
|
1889
|
+
onClick={() => void handleEditWorkspace(workspace)}
|
|
1890
|
+
disabled={workspaceBusy()}
|
|
1891
|
+
title="Редактировать workspace"
|
|
1892
|
+
style="background:transparent;border:none;color:#a0a0a6;cursor:pointer;font-size:14px;padding:2px"
|
|
1893
|
+
>✏️</button>
|
|
1894
|
+
<button
|
|
1895
|
+
onClick={() => void handleDeleteWorkspace(workspace)}
|
|
1896
|
+
disabled={workspaceBusy()}
|
|
1897
|
+
title="Удалить workspace (задачи сохраняются)"
|
|
1898
|
+
style="background:transparent;border:none;color:#ff3b30;cursor:pointer;font-size:14px;padding:2px"
|
|
1899
|
+
>🗑</button>
|
|
1900
|
+
</div>
|
|
1901
|
+
</div>
|
|
1902
|
+
))
|
|
1903
|
+
)}
|
|
1904
|
+
</div>
|
|
1905
|
+
)}
|
|
1906
|
+
</div>
|
|
1907
|
+
|
|
1908
|
+
{/* Форма создания/редактирования задачи (сворачиваемая) */}
|
|
1909
|
+
{formCollapsed() ? (
|
|
1910
|
+
<button
|
|
1911
|
+
onClick={() => setFormCollapsed(false)}
|
|
1912
|
+
title="Развернуть форму создания задачи"
|
|
1913
|
+
style="display:flex;align-items:center;justify-content:center;gap:8px;width:100%;max-width:700px;box-sizing:border-box;padding:12px 16px;background:#1e1e1e;border:1px dashed #3a3a3a;border-radius:10px;color:#e0e0e0;font-size:13px;font-weight:600;cursor:pointer;transition:border-color 0.18s ease, background 0.18s ease"
|
|
1914
|
+
onMouseEnter={(e) => { const b = e.currentTarget; b.style.borderColor = "#5ac8fa"; b.style.background = "#232326" }}
|
|
1915
|
+
onMouseLeave={(e) => { const b = e.currentTarget; b.style.borderColor = "#3a3a3a"; b.style.background = "#1e1e1e" }}
|
|
1916
|
+
>
|
|
1917
|
+
➕ Создать задачу
|
|
1918
|
+
</button>
|
|
1919
|
+
) : (
|
|
1920
|
+
<div style="display:block;width:100%;max-width:700px;box-sizing:border-box;background:#1e1e1e;padding:20px;border-radius:10px;box-shadow:0 4px 12px rgba(0,0,0,0.2)">
|
|
1921
|
+
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:16px">
|
|
1922
|
+
<h3 style="margin:0;font-size:14px;font-weight:600;color:#ffffff">
|
|
1923
|
+
{isEditing ? "Редактирование задачи" : "Новая задача"}
|
|
1924
|
+
</h3>
|
|
1925
|
+
<div style="display:flex;align-items:center;gap:8px">
|
|
1926
|
+
<button
|
|
1927
|
+
onClick={handleSaveAsTemplate}
|
|
1928
|
+
title="Сохранить текущие настройки формы как шаблон"
|
|
1929
|
+
style="background:transparent;border:1px solid #333;border-radius:6px;padding:4px 10px;color:#a0a0a6;font-size:11px;cursor:pointer;white-space:nowrap;transition:color 0.18s ease, border-color 0.18s ease"
|
|
1930
|
+
onMouseEnter={(e) => { const b = e.currentTarget; b.style.color = "#5ac8fa"; b.style.borderColor = "#5ac8fa" }}
|
|
1931
|
+
onMouseLeave={(e) => { const b = e.currentTarget; b.style.color = "#a0a0a6"; b.style.borderColor = "#333" }}
|
|
1932
|
+
>
|
|
1933
|
+
💾 Сохранить как шаблон
|
|
1934
|
+
</button>
|
|
1935
|
+
<button
|
|
1936
|
+
onClick={() => setFormCollapsed(true)}
|
|
1937
|
+
title="Свернуть форму"
|
|
1938
|
+
style="background:transparent;border:1px solid #333;border-radius:6px;padding:4px 10px;color:#a0a0a6;font-size:11px;cursor:pointer;white-space:nowrap;transition:color 0.18s ease, border-color 0.18s ease"
|
|
1939
|
+
onMouseEnter={(e) => { const b = e.currentTarget; b.style.color = "#5ac8fa"; b.style.borderColor = "#5ac8fa" }}
|
|
1940
|
+
onMouseLeave={(e) => { const b = e.currentTarget; b.style.color = "#a0a0a6"; b.style.borderColor = "#333" }}
|
|
1941
|
+
>
|
|
1942
|
+
Скрыть форму ▴
|
|
1943
|
+
</button>
|
|
1944
|
+
</div>
|
|
1945
|
+
</div>
|
|
1946
|
+
|
|
1947
|
+
{/* Matrix (fan-out, Спринт 15): вместо одного workspace — список. */}
|
|
1948
|
+
<div style="display:block;width:100%;margin-bottom:12px;padding:10px 12px;background:#1a1a1a;border:1px solid #333;border-radius:8px">
|
|
1949
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;font-weight:600;color:#fff">
|
|
1950
|
+
<input
|
|
1951
|
+
type="checkbox"
|
|
1952
|
+
checked={matrixMode()}
|
|
1953
|
+
onChange={(e) => {
|
|
1954
|
+
const on = e.currentTarget.checked
|
|
1955
|
+
setMatrixMode(on)
|
|
1956
|
+
if (on) {
|
|
1957
|
+
setWorkspaceId("")
|
|
1958
|
+
if (matrixWorkspaceIds().length === 0) {
|
|
1959
|
+
setMatrixWorkspaceIds(workspaces().map((w) => w.id))
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
}}
|
|
1963
|
+
style="accent-color:#ff9f0a"
|
|
1964
|
+
/>
|
|
1965
|
+
📦 Matrix (Fan-Out)
|
|
1966
|
+
</label>
|
|
1967
|
+
<div style="font-size:11px;color:#8e8e93;margin-top:4px;line-height:1.45">
|
|
1968
|
+
Задача-шаблон раскладывается на клоны по workspace. Родитель сам не выполняется — он запускает клоны и агрегирует результат.
|
|
1969
|
+
</div>
|
|
1970
|
+
|
|
1971
|
+
{matrixMode() && (
|
|
1972
|
+
<div style="margin-top:10px;display:flex;flex-direction:column;gap:10px">
|
|
1973
|
+
<div>
|
|
1974
|
+
<div style="font-size:12px;color:#b0b0b0;font-weight:500;margin-bottom:6px">
|
|
1975
|
+
Workspaces (для матрицы) — выбрано {matrixWorkspaceIds().length}
|
|
1976
|
+
</div>
|
|
1977
|
+
{workspaces().length === 0 ? (
|
|
1978
|
+
<div style="font-size:11px;color:#f5a623">Сначала добавьте хотя бы один workspace.</div>
|
|
1979
|
+
) : (
|
|
1980
|
+
<div style="display:flex;flex-direction:column;gap:4px;max-height:170px;overflow:auto;padding:6px 8px;background:#141414;border:1px solid #333;border-radius:6px">
|
|
1981
|
+
{workspaces().map((workspace) => (
|
|
1982
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer;font-size:12px;color:#e0e0e0">
|
|
1983
|
+
<input
|
|
1984
|
+
type="checkbox"
|
|
1985
|
+
checked={matrixWorkspaceIds().includes(workspace.id)}
|
|
1986
|
+
onChange={(e) => toggleMatrixWorkspace(workspace.id, e.currentTarget.checked)}
|
|
1987
|
+
style="accent-color:#ff9f0a"
|
|
1988
|
+
/>
|
|
1989
|
+
<span style={`color:${workspace.color || "#5ac8fa"}`}>📦 {workspace.name}</span>
|
|
1990
|
+
<span style="font-size:10px;color:#8e8e93;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">{workspace.path}</span>
|
|
1991
|
+
</label>
|
|
1992
|
+
))}
|
|
1993
|
+
</div>
|
|
1994
|
+
)}
|
|
1995
|
+
</div>
|
|
1996
|
+
|
|
1997
|
+
<div style="display:flex;gap:8px;flex-wrap:wrap">
|
|
1998
|
+
<label style="flex:1;min-width:150px;font-size:11px;color:#b0b0b0">
|
|
1999
|
+
Стратегия
|
|
2000
|
+
<select
|
|
2001
|
+
value={matrixStrategy()}
|
|
2002
|
+
onChange={(e) => setMatrixStrategy(e.currentTarget.value === "sequential" ? "sequential" : "parallel")}
|
|
2003
|
+
style="display:block;width:100%;box-sizing:border-box;margin-top:4px;padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"
|
|
2004
|
+
>
|
|
2005
|
+
<option value="parallel">parallel — все сразу</option>
|
|
2006
|
+
<option value="sequential">sequential — по одному</option>
|
|
2007
|
+
</select>
|
|
2008
|
+
</label>
|
|
2009
|
+
<label style="flex:1;min-width:150px;font-size:11px;color:#b0b0b0">
|
|
2010
|
+
При ошибке
|
|
2011
|
+
<select
|
|
2012
|
+
value={matrixFailureMode()}
|
|
2013
|
+
onChange={(e) => setMatrixFailureMode(e.currentTarget.value === "stop" ? "stop" : "continue")}
|
|
2014
|
+
style="display:block;width:100%;box-sizing:border-box;margin-top:4px;padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"
|
|
2015
|
+
>
|
|
2016
|
+
<option value="continue">continue — продолжать</option>
|
|
2017
|
+
<option value="stop">stop — остановить</option>
|
|
2018
|
+
</select>
|
|
2019
|
+
</label>
|
|
2020
|
+
<label style="flex:1;min-width:150px;font-size:11px;color:#b0b0b0">
|
|
2021
|
+
Агрегация
|
|
2022
|
+
<select
|
|
2023
|
+
value={matrixAggregation()}
|
|
2024
|
+
onChange={(e) => setMatrixAggregation(e.currentTarget.value === "per-task" ? "per-task" : "summary")}
|
|
2025
|
+
style="display:block;width:100%;box-sizing:border-box;margin-top:4px;padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"
|
|
2026
|
+
>
|
|
2027
|
+
<option value="summary">summary — сводка</option>
|
|
2028
|
+
<option value="per-task">per-task — по задачам</option>
|
|
2029
|
+
</select>
|
|
2030
|
+
</label>
|
|
2031
|
+
</div>
|
|
2032
|
+
|
|
2033
|
+
<label style="display:flex;align-items:center;gap:8px;cursor:pointer;font-size:12px;color:#e0e0e0">
|
|
2034
|
+
<input
|
|
2035
|
+
type="checkbox"
|
|
2036
|
+
checked={matrixAggregator()}
|
|
2037
|
+
onChange={(e) => setMatrixAggregator(e.currentTarget.checked)}
|
|
2038
|
+
style="accent-color:#ff9f0a"
|
|
2039
|
+
/>
|
|
2040
|
+
Создать aggregator-задачу matrix-complete (запустится после всех клонов)
|
|
2041
|
+
</label>
|
|
2042
|
+
|
|
2043
|
+
<label style="font-size:11px;color:#b0b0b0;max-width:240px">
|
|
2044
|
+
Одновременно клонов (concurrency)
|
|
2045
|
+
<input
|
|
2046
|
+
type="number"
|
|
2047
|
+
min="1"
|
|
2048
|
+
step="1"
|
|
2049
|
+
value={matrixConcurrency()}
|
|
2050
|
+
onInput={(e) => setMatrixConcurrency(e.currentTarget.value)}
|
|
2051
|
+
placeholder={
|
|
2052
|
+
matrixStrategy() === "sequential" ? "1 (sequential)" : "без лимита"
|
|
2053
|
+
}
|
|
2054
|
+
style="display:block;width:100%;box-sizing:border-box;margin-top:4px;padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"
|
|
2055
|
+
/>
|
|
2056
|
+
</label>
|
|
2057
|
+
|
|
2058
|
+
{matrixWorkspaceIds().length > 0 && (
|
|
2059
|
+
<details style="padding:8px 10px;background:#141414;border:1px solid #333;border-radius:6px">
|
|
2060
|
+
<summary style="cursor:pointer;font-size:12px;color:#b0b0b0;font-weight:500">
|
|
2061
|
+
⚙ Настройки по workspace — переопределено {matrixOverrideCount()}
|
|
2062
|
+
</summary>
|
|
2063
|
+
<div style="margin-top:8px;display:flex;flex-direction:column;gap:8px;max-height:340px;overflow:auto">
|
|
2064
|
+
{matrixWorkspaceIds().map((wsId) => {
|
|
2065
|
+
const workspace = workspaces().find((w) => w.id === wsId)
|
|
2066
|
+
if (!workspace) return null
|
|
2067
|
+
const override = matrixOverrides()[wsId] ?? {}
|
|
2068
|
+
const inputStyle =
|
|
2069
|
+
"padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box"
|
|
2070
|
+
return (
|
|
2071
|
+
<div style="padding:8px;background:#101010;border:1px solid #2a2a2a;border-radius:6px">
|
|
2072
|
+
<div style={`font-size:12px;font-weight:600;margin-bottom:6px;color:${workspace.color || "#5ac8fa"}`}>
|
|
2073
|
+
📦 {workspace.name}
|
|
2074
|
+
<span style="margin-left:6px;font-size:10px;color:#8e8e93">{matrixClonePreviewName(name(), workspace.name)}</span>
|
|
2075
|
+
</div>
|
|
2076
|
+
<div style="display:flex;flex-direction:column;gap:6px">
|
|
2077
|
+
<textarea
|
|
2078
|
+
rows={2}
|
|
2079
|
+
placeholder="Промпт (по умолчанию — общий промпт формы)"
|
|
2080
|
+
value={override.prompt ?? ""}
|
|
2081
|
+
onInput={(e) => updateMatrixOverride(wsId, "prompt", e.currentTarget.value)}
|
|
2082
|
+
style={`${inputStyle};width:100%;resize:vertical;font-family:inherit`}
|
|
2083
|
+
/>
|
|
2084
|
+
<div style="display:flex;gap:6px;flex-wrap:wrap">
|
|
2085
|
+
<input
|
|
2086
|
+
placeholder="Модель (override)"
|
|
2087
|
+
value={override.model ?? ""}
|
|
2088
|
+
onInput={(e) => updateMatrixOverride(wsId, "model", e.currentTarget.value)}
|
|
2089
|
+
style={`${inputStyle};flex:1;min-width:150px`}
|
|
2090
|
+
/>
|
|
2091
|
+
<input
|
|
2092
|
+
placeholder="Quality Gate (override)"
|
|
2093
|
+
value={override.qualityGate ?? ""}
|
|
2094
|
+
onInput={(e) => updateMatrixOverride(wsId, "qualityGate", e.currentTarget.value)}
|
|
2095
|
+
style={`${inputStyle};flex:1;min-width:150px`}
|
|
2096
|
+
/>
|
|
2097
|
+
</div>
|
|
2098
|
+
<div style="display:flex;gap:6px;flex-wrap:wrap">
|
|
2099
|
+
<input
|
|
2100
|
+
placeholder="beforeScript (override)"
|
|
2101
|
+
value={override.beforeScript ?? ""}
|
|
2102
|
+
onInput={(e) => updateMatrixOverride(wsId, "beforeScript", e.currentTarget.value)}
|
|
2103
|
+
style={`${inputStyle};flex:1;min-width:150px`}
|
|
2104
|
+
/>
|
|
2105
|
+
<input
|
|
2106
|
+
placeholder="afterScript (override)"
|
|
2107
|
+
value={override.afterScript ?? ""}
|
|
2108
|
+
onInput={(e) => updateMatrixOverride(wsId, "afterScript", e.currentTarget.value)}
|
|
2109
|
+
style={`${inputStyle};flex:1;min-width:150px`}
|
|
2110
|
+
/>
|
|
2111
|
+
</div>
|
|
2112
|
+
</div>
|
|
2113
|
+
</div>
|
|
2114
|
+
)
|
|
2115
|
+
})}
|
|
2116
|
+
</div>
|
|
2117
|
+
</details>
|
|
2118
|
+
)}
|
|
2119
|
+
|
|
2120
|
+
<div style="padding:8px 10px;background:#141414;border:1px solid #333;border-radius:6px;font-size:11px;line-height:1.55;color:#a0a0a6">
|
|
2121
|
+
{matrixPreview().length > 0 ? (
|
|
2122
|
+
<>
|
|
2123
|
+
<div style="color:#ff9f0a;font-weight:600">Будет создано {matrixPreview().length} клон(а/ов):</div>
|
|
2124
|
+
<div style="color:#e0e0e0;word-break:break-all">{matrixPreview().join(", ")}</div>
|
|
2125
|
+
</>
|
|
2126
|
+
) : (
|
|
2127
|
+
<span style="color:#f5a623">Выберите хотя бы один workspace — превью клонов появится здесь.</span>
|
|
2128
|
+
)}
|
|
2129
|
+
</div>
|
|
2130
|
+
</div>
|
|
2131
|
+
)}
|
|
2132
|
+
</div>
|
|
2133
|
+
|
|
2134
|
+
{!matrixMode() && (
|
|
2135
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2136
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Workspace (multi-repo)</label>
|
|
2137
|
+
<select
|
|
2138
|
+
value={workspaceId()}
|
|
2139
|
+
onChange={(e) => {
|
|
2140
|
+
setWorkspaceId(e.currentTarget.value)
|
|
2141
|
+
if (e.currentTarget.value) setWorkingDirectory("")
|
|
2142
|
+
}}
|
|
2143
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2144
|
+
>
|
|
2145
|
+
<option value="">Без workspace — рабочая директория</option>
|
|
2146
|
+
{workspaces().map((workspace) => (
|
|
2147
|
+
<option key={workspace.id} value={workspace.id}>📦 {workspace.name}</option>
|
|
2148
|
+
))}
|
|
2149
|
+
</select>
|
|
2150
|
+
{selectedWorkspace() && (
|
|
2151
|
+
<div style="margin-top:8px;padding:8px 10px;background:#141414;border:1px solid #333;border-radius:6px;font-size:11px;line-height:1.55;color:#a0a0a6">
|
|
2152
|
+
<div>cwd = <span style="color:#e0e0e0">{selectedWorkspace()!.path}</span></div>
|
|
2153
|
+
<div>git branch = <span style="color:#5ac8fa">{selectedWorkspace()!.gitBranch || "—"}</span></div>
|
|
2154
|
+
<div>git remote = <span style="color:#e0e0e0">{selectedWorkspace()!.gitRemote || "—"}</span></div>
|
|
2155
|
+
</div>
|
|
2156
|
+
)}
|
|
2157
|
+
</div>
|
|
2158
|
+
)}
|
|
2159
|
+
|
|
2160
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2161
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Имя задачи</label>
|
|
2162
|
+
<input
|
|
2163
|
+
type="text"
|
|
2164
|
+
value={name() || ""}
|
|
2165
|
+
onInput={(e) => setName(e.currentTarget.value)}
|
|
2166
|
+
placeholder="например, Gui-Test"
|
|
2167
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2168
|
+
/>
|
|
2169
|
+
</div>
|
|
2170
|
+
|
|
2171
|
+
{!workspaceId() && !matrixMode() && (
|
|
2172
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2173
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Рабочая директория</label>
|
|
2174
|
+
<input
|
|
2175
|
+
type="text"
|
|
2176
|
+
value={workingDirectory() || ""}
|
|
2177
|
+
onInput={(e) => setWorkingDirectory(e.currentTarget.value)}
|
|
2178
|
+
placeholder="по умолчанию — папка проекта"
|
|
2179
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2180
|
+
/>
|
|
2181
|
+
<div style="font-size:11px;color:#8e8e93;margin-top:6px">В этой папке задача запустит opencode run — здесь подхватятся MCP-серверы из opencode.json.</div>
|
|
2182
|
+
</div>
|
|
2183
|
+
)}
|
|
2184
|
+
|
|
2185
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2186
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Тип триггера</label>
|
|
2187
|
+
<div style="display:flex;gap:8px">
|
|
2188
|
+
<label style="display:flex;align-items:center;gap:6px;cursor:pointer;flex:1">
|
|
2189
|
+
<input
|
|
2190
|
+
type="radio"
|
|
2191
|
+
name="triggerType"
|
|
2192
|
+
checked={triggerType() === "cron"}
|
|
2193
|
+
onChange={() => setTriggerType("cron")}
|
|
2194
|
+
style="accent-color:#007acc"
|
|
2195
|
+
/>
|
|
2196
|
+
По расписанию (Cron)
|
|
2197
|
+
</label>
|
|
2198
|
+
<label style="display:flex;align-items:center;gap:6px;cursor:pointer;flex:1">
|
|
2199
|
+
<input
|
|
2200
|
+
type="radio"
|
|
2201
|
+
name="triggerType"
|
|
2202
|
+
checked={triggerType() === "file"}
|
|
2203
|
+
onChange={() => setTriggerType("file")}
|
|
2204
|
+
style="accent-color:#007acc"
|
|
2205
|
+
/>
|
|
2206
|
+
При изменении файла
|
|
2207
|
+
</label>
|
|
2208
|
+
<label style="display:flex;align-items:center;gap:6px;cursor:pointer;flex:1">
|
|
2209
|
+
<input
|
|
2210
|
+
type="radio"
|
|
2211
|
+
name="triggerType"
|
|
2212
|
+
checked={triggerType() === "mcp-event"}
|
|
2213
|
+
onChange={() => setTriggerType("mcp-event")}
|
|
2214
|
+
style="accent-color:#007acc"
|
|
2215
|
+
/>
|
|
2216
|
+
MCP Event
|
|
2217
|
+
</label>
|
|
2218
|
+
</div>
|
|
2219
|
+
</div>
|
|
2220
|
+
|
|
2221
|
+
{triggerType() === "file" && (
|
|
2222
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2223
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Путь к файлу для отслеживания</label>
|
|
2224
|
+
<input
|
|
2225
|
+
type="text"
|
|
2226
|
+
value={watchPath() || ""}
|
|
2227
|
+
onInput={(e) => setWatchPath(e.currentTarget.value)}
|
|
2228
|
+
placeholder="например, C:\project\src\main.ts"
|
|
2229
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2230
|
+
/>
|
|
2231
|
+
</div>
|
|
2232
|
+
)}
|
|
2233
|
+
|
|
2234
|
+
{triggerType() === "mcp-event" && (
|
|
2235
|
+
<>
|
|
2236
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2237
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">MCP-сервер / источник</label>
|
|
2238
|
+
<input
|
|
2239
|
+
type="text"
|
|
2240
|
+
value={mcpServer() || ""}
|
|
2241
|
+
onInput={(e) => setMcpServer(e.currentTarget.value)}
|
|
2242
|
+
placeholder="например, github"
|
|
2243
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2244
|
+
/>
|
|
2245
|
+
</div>
|
|
2246
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2247
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Имя события</label>
|
|
2248
|
+
<input
|
|
2249
|
+
type="text"
|
|
2250
|
+
value={mcpEventName() || ""}
|
|
2251
|
+
onInput={(e) => setMcpEventName(e.currentTarget.value)}
|
|
2252
|
+
placeholder="например, github.pr.opened"
|
|
2253
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2254
|
+
/>
|
|
2255
|
+
</div>
|
|
2256
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2257
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Фильтр (опционально)</label>
|
|
2258
|
+
<input
|
|
2259
|
+
type="text"
|
|
2260
|
+
value={mcpFilter() || ""}
|
|
2261
|
+
onInput={(e) => setMcpFilter(e.currentTarget.value)}
|
|
2262
|
+
placeholder='например, repo="my-project" или regex'
|
|
2263
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2264
|
+
/>
|
|
2265
|
+
<div style="font-size:11px;color:#8e8e93;margin-top:6px">key=value сравнивается с полем payload, иначе фильтр считается regex/подстрокой. События приходят через RPC emit_event.</div>
|
|
2266
|
+
</div>
|
|
2267
|
+
</>
|
|
2268
|
+
)}
|
|
2269
|
+
|
|
2270
|
+
<div
|
|
2271
|
+
style={{
|
|
2272
|
+
display: triggerType() !== "cron" ? "none" : "block",
|
|
2273
|
+
width: "100%",
|
|
2274
|
+
marginBottom: "12px",
|
|
2275
|
+
}}
|
|
2276
|
+
>
|
|
2277
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Расписание</label>
|
|
2278
|
+
<select
|
|
2279
|
+
value={cronPreset()}
|
|
2280
|
+
onChange={(e) => {
|
|
2281
|
+
const val = e.currentTarget.value
|
|
2282
|
+
setCronPreset(val)
|
|
2283
|
+
if (val !== "__custom__") setSchedule(val)
|
|
2284
|
+
}}
|
|
2285
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2286
|
+
>
|
|
2287
|
+
{CRON_PRESETS.map((p) => (
|
|
2288
|
+
<option key={p.value} value={p.value}>{p.label}</option>
|
|
2289
|
+
))}
|
|
2290
|
+
</select>
|
|
2291
|
+
{showCustomCron && (
|
|
2292
|
+
<div style="display:block;width:100%;margin-top:8px">
|
|
2293
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Cron-выражение</label>
|
|
2294
|
+
<input
|
|
2295
|
+
type="text"
|
|
2296
|
+
value={schedule() || ""}
|
|
2297
|
+
onInput={(e) => setSchedule(e.currentTarget.value)}
|
|
2298
|
+
placeholder="* * * * *"
|
|
2299
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2300
|
+
/>
|
|
2301
|
+
</div>
|
|
2302
|
+
)}
|
|
2303
|
+
{cronError() && (
|
|
2304
|
+
<div style="display:block;max-height:80px;overflow-y:auto;margin-top:8px;padding:8px;background:#2a1113;border:1px solid #5a1d21;border-radius:6px;font-size:11px;line-height:1.4;color:#ff6b6b;white-space:pre-wrap;word-break:break-word">{cronError()}</div>
|
|
2305
|
+
)}
|
|
2306
|
+
</div>
|
|
2307
|
+
|
|
2308
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2309
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Промпт</label>
|
|
2310
|
+
<textarea
|
|
2311
|
+
value={prompt() || ""}
|
|
2312
|
+
onInput={(e) => setPrompt(e.currentTarget.value)}
|
|
2313
|
+
placeholder="Напиши краткий отчет о состоянии рынка"
|
|
2314
|
+
rows={2}
|
|
2315
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none;resize:vertical"
|
|
2316
|
+
/>
|
|
2317
|
+
</div>
|
|
2318
|
+
|
|
2319
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2320
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Шаблон промпта</label>
|
|
2321
|
+
<select
|
|
2322
|
+
value={template()}
|
|
2323
|
+
onChange={(e) => selectTemplate(e.currentTarget.value)}
|
|
2324
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2325
|
+
>
|
|
2326
|
+
{TEMPLATES.map((t) => (
|
|
2327
|
+
<option key={t.value} value={t.value}>{t.label}</option>
|
|
2328
|
+
))}
|
|
2329
|
+
{customTemplates().map((t) => (
|
|
2330
|
+
<option key={t.id} value={`custom:${t.id}`}>{t.name}</option>
|
|
2331
|
+
))}
|
|
2332
|
+
</select>
|
|
2333
|
+
{template().startsWith("custom:") && (
|
|
2334
|
+
<div style="display:flex;align-items:center;gap:6px;margin-top:8px">
|
|
2335
|
+
<span style="font-size:10px;color:#8e8e93">Кастомный шаблон:</span>
|
|
2336
|
+
{customTemplates().map((t) => {
|
|
2337
|
+
if (`custom:${t.id}` !== template()) return null;
|
|
2338
|
+
return (
|
|
2339
|
+
<span key={t.id} style="font-size:11px;color:#ff3b30;font-weight:500;cursor:default">
|
|
2340
|
+
{t.name}
|
|
2341
|
+
</span>
|
|
2342
|
+
);
|
|
2343
|
+
})}
|
|
2344
|
+
<button
|
|
2345
|
+
onClick={() => {
|
|
2346
|
+
const t = customTemplates().find((x) => `custom:${x.id}` === template());
|
|
2347
|
+
if (t) handleDeleteTemplate(t);
|
|
2348
|
+
}}
|
|
2349
|
+
title="Удалить шаблон"
|
|
2350
|
+
style="background:transparent;border:none;color:#ff3b30;cursor:pointer;font-size:14px;line-height:1;padding:0"
|
|
2351
|
+
onMouseEnter={(e) => { e.currentTarget.style.color = "#c92a2a"; }}
|
|
2352
|
+
onMouseLeave={(e) => { e.currentTarget.style.color = "#ff3b30"; }}
|
|
2353
|
+
>
|
|
2354
|
+
🗑
|
|
2355
|
+
</button>
|
|
2356
|
+
</div>
|
|
2357
|
+
)}
|
|
2358
|
+
</div>
|
|
2359
|
+
|
|
2360
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2361
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Модель LLM</label>
|
|
2362
|
+
<input
|
|
2363
|
+
type="text"
|
|
2364
|
+
list="scheduler-model-presets"
|
|
2365
|
+
value={model() || ""}
|
|
2366
|
+
onInput={(e) => setModel(e.currentTarget.value)}
|
|
2367
|
+
placeholder="по умолчанию (как в OpenCode)"
|
|
2368
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2369
|
+
/>
|
|
2370
|
+
<datalist id="scheduler-model-presets">
|
|
2371
|
+
<option value="anthropic/claude-3-5-sonnet" />
|
|
2372
|
+
<option value="openai/gpt-4o" />
|
|
2373
|
+
<option value="deepseek/deepseek-coder" />
|
|
2374
|
+
<option value="google/gemini-2.5-pro" />
|
|
2375
|
+
<option value="openai/gpt-4o-mini" />
|
|
2376
|
+
</datalist>
|
|
2377
|
+
<div style="font-size:11px;color:#8e8e93;margin-top:6px">Пусто — модель OpenCode по умолчанию. Иначе будет передан флаг --model.</div>
|
|
2378
|
+
</div>
|
|
2379
|
+
|
|
2380
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2381
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Приоритет</label>
|
|
2382
|
+
<select
|
|
2383
|
+
value={String(priority())}
|
|
2384
|
+
onChange={(e) => setPriority(Number(e.currentTarget.value) || DEFAULT_PRIORITY)}
|
|
2385
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2386
|
+
>
|
|
2387
|
+
{PRIORITY_OPTIONS.map((p) => (
|
|
2388
|
+
<option key={p.value} value={String(p.value)}>{p.label}</option>
|
|
2389
|
+
))}
|
|
2390
|
+
{!PRIORITY_OPTIONS.some((p) => p.value === priority()) && (
|
|
2391
|
+
<option value={String(priority())}>Другой ({priority()})</option>
|
|
2392
|
+
)}
|
|
2393
|
+
</select>
|
|
2394
|
+
<div style="font-size:11px;color:#8e8e93;margin-top:6px">Если готовы несколько задач сразу, первой запускается задача с более высоким приоритетом.</div>
|
|
2395
|
+
</div>
|
|
2396
|
+
|
|
2397
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2398
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Кол-во повторов при ошибке</label>
|
|
2399
|
+
<input
|
|
2400
|
+
type="number"
|
|
2401
|
+
min="0"
|
|
2402
|
+
value={retryCount()}
|
|
2403
|
+
onInput={(e) => setRetryCount(Number(e.currentTarget.value) || 0)}
|
|
2404
|
+
placeholder="0"
|
|
2405
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2406
|
+
/>
|
|
2407
|
+
</div>
|
|
2408
|
+
|
|
2409
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2410
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Задержка перед повтором (сек)</label>
|
|
2411
|
+
<input
|
|
2412
|
+
type="number"
|
|
2413
|
+
min="1"
|
|
2414
|
+
value={retryDelay()}
|
|
2415
|
+
onInput={(e) => setRetryDelay(Number(e.currentTarget.value) || 60)}
|
|
2416
|
+
placeholder="60"
|
|
2417
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2418
|
+
/>
|
|
2419
|
+
</div>
|
|
2420
|
+
|
|
2421
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2422
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Проверочная команда (Quality Gate)</label>
|
|
2423
|
+
<input
|
|
2424
|
+
type="text"
|
|
2425
|
+
value={qualityGate() || ""}
|
|
2426
|
+
onInput={(e) => setQualityGate(e.currentTarget.value)}
|
|
2427
|
+
placeholder="например: npm run test"
|
|
2428
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2429
|
+
/>
|
|
2430
|
+
<div style="font-size:11px;color:#8e8e93;margin-top:6px">Выполняется после успешного ответа ИИ. Ненулевой код = ошибка задачи.</div>
|
|
2431
|
+
</div>
|
|
2432
|
+
|
|
2433
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2434
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Команда перед запуском (Pre-flight)</label>
|
|
2435
|
+
<input
|
|
2436
|
+
type="text"
|
|
2437
|
+
value={beforeScript() || ""}
|
|
2438
|
+
onInput={(e) => setBeforeScript(e.currentTarget.value)}
|
|
2439
|
+
placeholder="например: git pull"
|
|
2440
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2441
|
+
/>
|
|
2442
|
+
<div style="font-size:11px;color:#8e8e93;margin-top:6px">Например: git pull или npm install. Выполняется в рабочей директории задачи. Ненулевой код отменяет запуск (Pre-flight script failed).</div>
|
|
2443
|
+
</div>
|
|
2444
|
+
|
|
2445
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2446
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Команда после запуска (Post-flight)</label>
|
|
2447
|
+
<input
|
|
2448
|
+
type="text"
|
|
2449
|
+
value={afterScript() || ""}
|
|
2450
|
+
onInput={(e) => setAfterScript(e.currentTarget.value)}
|
|
2451
|
+
placeholder="например: git push"
|
|
2452
|
+
style="display:block;width:100%;box-sizing:border-box;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:13px;outline:none"
|
|
2453
|
+
/>
|
|
2454
|
+
<div style="font-size:11px;color:#8e8e93;margin-top:6px">Например: git push или npm run build. Выполняется в рабочей директории задачи даже при ошибке основной задачи.</div>
|
|
2455
|
+
</div>
|
|
2456
|
+
|
|
2457
|
+
<div style="display:block;width:100%;margin-bottom:12px">
|
|
2458
|
+
<label style="display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500">Зависит от задач (успешное завершение)</label>
|
|
2459
|
+
<div style="display:flex;flex-wrap:wrap;gap:6px;padding:8px;background:#1e1e1e;border:1px solid #333;border-radius:6px;min-height:38px;box-sizing:border-box">
|
|
2460
|
+
{dependencyCandidates().length === 0 ? (
|
|
2461
|
+
<span style="font-size:12px;color:#8e8e93">Других задач пока нет</span>
|
|
2462
|
+
) : (
|
|
2463
|
+
dependencyCandidates().map((candidate) => (
|
|
2464
|
+
<label style={`display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:14px;border:1px solid ${dependsOn().includes(candidate) ? "#5ac8fa" : "#333"};background:${dependsOn().includes(candidate) ? "rgba(90,200,250,0.12)" : "transparent"};color:${dependsOn().includes(candidate) ? "#5ac8fa" : "#cfcfd2"};font-size:12px;cursor:pointer;user-select:none`}>
|
|
2465
|
+
<input
|
|
2466
|
+
type="checkbox"
|
|
2467
|
+
checked={dependsOn().includes(candidate)}
|
|
2468
|
+
onChange={(e) => toggleDependsOn(candidate, e.currentTarget.checked)}
|
|
2469
|
+
style="margin:0"
|
|
2470
|
+
/>
|
|
2471
|
+
{candidate}
|
|
2472
|
+
</label>
|
|
2473
|
+
))
|
|
2474
|
+
)}
|
|
2475
|
+
</div>
|
|
2476
|
+
<div style="font-size:11px;color:#8e8e93;margin-top:6px">Задача запустится автоматически, когда все отмеченные задачи завершатся успешно.</div>
|
|
2477
|
+
</div>
|
|
2478
|
+
|
|
2479
|
+
{/* Role-scoped tools (Спринт 14): metadata-only, denied имеет приоритет */}
|
|
2480
|
+
<details style="display:block;width:100%;margin-bottom:12px">
|
|
2481
|
+
<summary style="cursor:pointer;font-size:12px;color:#b0b0b0;font-weight:500;margin-bottom:8px;user-select:none">
|
|
2482
|
+
🔒 Ограничения инструментов
|
|
2483
|
+
{(allowedTools().length > 0 || deniedTools().length > 0) && (
|
|
2484
|
+
<span style="color:#5ac8fa;font-size:11px;margin-left:6px">
|
|
2485
|
+
({allowedTools().length} allowed · {deniedTools().length} denied)
|
|
2486
|
+
</span>
|
|
2487
|
+
)}
|
|
2488
|
+
</summary>
|
|
2489
|
+
<div style="display:block;width:100%;padding:10px;background:#1e1e1e;border:1px solid #333;border-radius:6px;box-sizing:border-box">
|
|
2490
|
+
<div style="font-size:11px;color:#8e8e93;margin-bottom:8px">
|
|
2491
|
+
⚠ Metadata-only: opencode 2.2.3 не поддерживает allow/deny флаги — ограничения фиксируются в логе и истории.
|
|
2492
|
+
При конфликте приоритет у <b>denied</b>. Пустой allowedTools запрещён.
|
|
2493
|
+
</div>
|
|
2494
|
+
<div style="font-size:11px;color:#b0b0b0;margin-bottom:4px">Белый список (allowedTools)</div>
|
|
2495
|
+
<div style="display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px">
|
|
2496
|
+
{POPULAR_TOOLS.map((tool) => (
|
|
2497
|
+
<label style={`display:flex;align-items:center;gap:5px;padding:4px 9px;border-radius:12px;border:1px solid ${allowedTools().includes(tool) ? "#34c759" : "#333"};background:${allowedTools().includes(tool) ? "rgba(52,199,89,0.12)" : "transparent"};color:${allowedTools().includes(tool) ? "#34c759" : "#cfcfd2"};font-size:11px;cursor:pointer;user-select:none`}>
|
|
2498
|
+
<input
|
|
2499
|
+
type="checkbox"
|
|
2500
|
+
checked={allowedTools().includes(tool)}
|
|
2501
|
+
onChange={() => toggleTool("allowed", tool)}
|
|
2502
|
+
style="margin:0"
|
|
2503
|
+
/>
|
|
2504
|
+
{tool}
|
|
2505
|
+
</label>
|
|
2506
|
+
))}
|
|
2507
|
+
</div>
|
|
2508
|
+
<div style="font-size:11px;color:#b0b0b0;margin-bottom:4px">Чёрный список (deniedTools)</div>
|
|
2509
|
+
<div style="display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px">
|
|
2510
|
+
{POPULAR_TOOLS.map((tool) => (
|
|
2511
|
+
<label style={`display:flex;align-items:center;gap:5px;padding:4px 9px;border-radius:12px;border:1px solid ${deniedTools().includes(tool) ? "#ff3b30" : "#333"};background:${deniedTools().includes(tool) ? "rgba(255,59,48,0.12)" : "transparent"};color:${deniedTools().includes(tool) ? "#ff3b30" : "#cfcfd2"};font-size:11px;cursor:pointer;user-select:none`}>
|
|
2512
|
+
<input
|
|
2513
|
+
type="checkbox"
|
|
2514
|
+
checked={deniedTools().includes(tool)}
|
|
2515
|
+
onChange={() => toggleTool("denied", tool)}
|
|
2516
|
+
style="margin:0"
|
|
2517
|
+
/>
|
|
2518
|
+
{tool}
|
|
2519
|
+
</label>
|
|
2520
|
+
))}
|
|
2521
|
+
</div>
|
|
2522
|
+
<div style="display:flex;gap:6px">
|
|
2523
|
+
<input
|
|
2524
|
+
type="text"
|
|
2525
|
+
value={customTool()}
|
|
2526
|
+
onInput={(e) => setCustomTool(e.currentTarget.value)}
|
|
2527
|
+
placeholder="свой инструмент, например websearch"
|
|
2528
|
+
style="flex:1;padding:6px 8px;background:#141414;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"
|
|
2529
|
+
/>
|
|
2530
|
+
<button onClick={() => addCustomTool("allowed")} style="padding:6px 10px;background:transparent;border:1px solid #34c759;color:#34c759;border-radius:6px;cursor:pointer;font-size:12px">+ allowed</button>
|
|
2531
|
+
<button onClick={() => addCustomTool("denied")} style="padding:6px 10px;background:transparent;border:1px solid #ff3b30;color:#ff3b30;border-radius:6px;cursor:pointer;font-size:12px">+ denied</button>
|
|
2532
|
+
</div>
|
|
2533
|
+
{(allowedTools().length > 0 || deniedTools().length > 0) && (
|
|
2534
|
+
<div style="font-size:11px;color:#cfcfd2;margin-top:8px">
|
|
2535
|
+
{allowedTools().length > 0 && <div>allowed: [{allowedTools().join(", ")}]</div>}
|
|
2536
|
+
{deniedTools().length > 0 && <div>denied: [{deniedTools().join(", ")}]</div>}
|
|
2537
|
+
</div>
|
|
2538
|
+
)}
|
|
2539
|
+
</div>
|
|
2540
|
+
</details>
|
|
2541
|
+
|
|
2542
|
+
<div style="display:block;width:100%;margin-top:8px">
|
|
2543
|
+
<button
|
|
2544
|
+
onClick={() => {
|
|
2545
|
+
setDryRunName("(форма)")
|
|
2546
|
+
const baseTask = {
|
|
2547
|
+
order: 0,
|
|
2548
|
+
trigger: "manual",
|
|
2549
|
+
command: buildFormCommand(),
|
|
2550
|
+
roleScoped:
|
|
2551
|
+
allowedTools().length > 0 || deniedTools().length > 0
|
|
2552
|
+
? { allowed: allowedTools(), denied: deniedTools() }
|
|
2553
|
+
: null,
|
|
2554
|
+
preFlight: (beforeScript() || "").trim() || null,
|
|
2555
|
+
postFlight: (afterScript() || "").trim() || null,
|
|
2556
|
+
qualityGate: (qualityGate() || "").trim() || null,
|
|
2557
|
+
}
|
|
2558
|
+
const matrixTasks = matrixWorkspaceIds()
|
|
2559
|
+
.map((id) => workspaces().find((w) => w.id === id))
|
|
2560
|
+
.filter((w): w is Workspace => Boolean(w))
|
|
2561
|
+
.map((w, index) => ({
|
|
2562
|
+
...baseTask,
|
|
2563
|
+
name: matrixClonePreviewName(name(), w.name),
|
|
2564
|
+
order: index,
|
|
2565
|
+
cwd: w.path,
|
|
2566
|
+
matrixParent: name() || "(без имени)",
|
|
2567
|
+
}))
|
|
2568
|
+
setDryRunReport({
|
|
2569
|
+
tasks: matrixMode()
|
|
2570
|
+
? matrixTasks
|
|
2571
|
+
: [
|
|
2572
|
+
{
|
|
2573
|
+
...baseTask,
|
|
2574
|
+
name: name() || "(без имени)",
|
|
2575
|
+
cwd:
|
|
2576
|
+
selectedWorkspace()?.path ||
|
|
2577
|
+
(workingDirectory() || "").trim() ||
|
|
2578
|
+
"(папка проекта)",
|
|
2579
|
+
},
|
|
2580
|
+
],
|
|
2581
|
+
totals: {},
|
|
2582
|
+
warnings: [
|
|
2583
|
+
...(!name().trim() ? ["Не указано имя — превью локальное (форма не сохранена)."] : []),
|
|
2584
|
+
...(matrixMode()
|
|
2585
|
+
? [
|
|
2586
|
+
`Matrix: будет создано ${matrixTasks.length} клон(а/ов) по workspace; родитель сам не выполняется.`,
|
|
2587
|
+
]
|
|
2588
|
+
: []),
|
|
2589
|
+
],
|
|
2590
|
+
})
|
|
2591
|
+
setDryRunOpen(true)
|
|
2592
|
+
}}
|
|
2593
|
+
title="Локальное превью команды по текущим полям формы (без RPC и без запуска)"
|
|
2594
|
+
style="display:block;width:100%;padding:8px;margin-top:4px;background:transparent;border:1px solid #333;border-radius:6px;color:#d4e6ff;cursor:pointer;font-size:12px"
|
|
2595
|
+
>
|
|
2596
|
+
🧪 Превью
|
|
2597
|
+
</button>
|
|
2598
|
+
<button
|
|
2599
|
+
onClick={handleCreate}
|
|
2600
|
+
disabled={busy() || !(name() || "").trim() || !(schedule() || "").trim() || !(prompt() || "").trim() || (matrixMode() && matrixWorkspaceIds().length === 0)}
|
|
2601
|
+
style={`display:block;width:100%;padding:10px;margin-top:8px;background:${busy() ? "#666" : "#007acc"};color:white;border-radius:6px;border:none;cursor:${busy() || (!(name() || "").trim() || !(schedule() || "").trim() || !(prompt() || "").trim()) ? "not-allowed" : "pointer"};font-size:13px;font-weight:500;opacity:${(busy() || !(name() || "").trim() || !(schedule() || "").trim() || !(prompt() || "").trim()) ? 0.6 : 1}`}
|
|
2602
|
+
>
|
|
2603
|
+
{busy() ? "Создание..." : isEditing ? "Сохранить" : "Создать задачу"}
|
|
2604
|
+
</button>
|
|
2605
|
+
{isEditing && (
|
|
2606
|
+
<button
|
|
2607
|
+
onClick={() => { setEditingJob(null); setName(""); setSchedule("* * * * *"); setPrompt(""); setModel(""); setPriority(DEFAULT_PRIORITY); setRetryCount(0); setRetryDelay(60); setQualityGate(""); setDependsOn([]); setBeforeScript(""); setAfterScript(""); setTriggerType("cron"); setWatchPath(""); setMcpServer(""); setMcpEventName(""); setMcpFilter(""); setWorkingDirectory(""); setWorkspaceId(""); setAllowedTools([]); setDeniedTools([]); resetMatrixForm(); setCronPreset("* * * * *"); setCronError("") }}
|
|
2608
|
+
style="background:transparent;border:1px solid #333;border-radius:6px;padding:8px 16px;color:#ff3b30;cursor:pointer;font-size:13px;width:100%"
|
|
2609
|
+
>
|
|
2610
|
+
Отмена
|
|
2611
|
+
</button>
|
|
2612
|
+
)}
|
|
2613
|
+
</div>
|
|
2614
|
+
|
|
2615
|
+
{dryRunOpen() && dryRunName() === "(форма)" && (
|
|
2616
|
+
<div style="display:block;width:100%;margin-top:8px;padding:10px;background:#1e1e1e;border:1px solid #333;border-radius:6px">
|
|
2617
|
+
<div style="font-size:12px;font-weight:600;color:#ffffff;display:flex;justify-content:space-between;align-items:center">
|
|
2618
|
+
🧪 Превью (локальное, по полям формы)
|
|
2619
|
+
<button onClick={() => closeDryRun()} style="background:none;border:none;color:#8e8e93;cursor:pointer;font-size:14px;padding:0">✕</button>
|
|
2620
|
+
</div>
|
|
2621
|
+
{(() => {
|
|
2622
|
+
const r: any = dryRunReport()
|
|
2623
|
+
if (!r) return null
|
|
2624
|
+
const t = r.tasks?.[0]
|
|
2625
|
+
return (
|
|
2626
|
+
<div style="display:flex;flex-direction:column;gap:4px;font-size:11px;color:#e0e0e0;margin-top:6px">
|
|
2627
|
+
<div style="overflow-wrap:anywhere">$ {t?.command}</div>
|
|
2628
|
+
<div style="color:#8e8e93">cwd: {t?.cwd}</div>
|
|
2629
|
+
{t?.roleScoped && (
|
|
2630
|
+
<div style="color:#8e8e93">
|
|
2631
|
+
🔒 allowed=[{(t.roleScoped.allowed ?? []).join(", ")}] · denied=[{(t.roleScoped.denied ?? []).join(", ")}]
|
|
2632
|
+
</div>
|
|
2633
|
+
)}
|
|
2634
|
+
{t?.preFlight && <div style="color:#8e8e93">⚡ pre: {t.preFlight}</div>}
|
|
2635
|
+
{t?.postFlight && <div style="color:#8e8e93">⚡ post: {t.postFlight}</div>}
|
|
2636
|
+
{t?.qualityGate && <div style="color:#8e8e93">✅ QG: {t.qualityGate}</div>}
|
|
2637
|
+
{Array.isArray(r.warnings) && r.warnings.length > 0 && (
|
|
2638
|
+
<div style="color:#f5a623">⚠ {r.warnings.join(" | ")}</div>
|
|
2639
|
+
)}
|
|
2640
|
+
</div>
|
|
2641
|
+
)
|
|
2642
|
+
})()}
|
|
2643
|
+
</div>
|
|
2644
|
+
)}
|
|
2645
|
+
</div>
|
|
2646
|
+
)}
|
|
2647
|
+
|
|
2648
|
+
{/* Список задач */}
|
|
2649
|
+
<div style="display:block;width:100%;margin-top:24px">
|
|
2650
|
+
<h3 style="margin:0;margin-bottom:8px;font-size:14px;font-weight:600;color:#ffffff">Задачи</h3>
|
|
2651
|
+
{workspaceFilter() !== "all" && (
|
|
2652
|
+
<div style="font-size:11px;color:#8e8e93;margin-bottom:8px">
|
|
2653
|
+
Фильтр: {workspaceFilter() === "none" ? "без workspace" : `📦 ${workspaces().find((w) => w.id === workspaceFilter())?.name ?? "workspace"}`} · показано {visibleJobs().length} из {jobsArr().length}
|
|
2654
|
+
</div>
|
|
2655
|
+
)}
|
|
2656
|
+
{visibleJobs().length === 0 ?
|
|
2657
|
+
<div style="display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:40px 16px;color:#a0a0a6;font-size:13px;gap:10px">
|
|
2658
|
+
<span style="font-size:40px;line-height:1">{winterMode() ? "🎄" : "📅"}</span>
|
|
2659
|
+
<span style="max-width:380px;line-height:1.5">
|
|
2660
|
+
{winterMode()
|
|
2661
|
+
? "Задач пока нет. Самое время украсить ёлку!"
|
|
2662
|
+
: "Нет активных задач. Создайте первую и доверьте рутину ИИ!"}
|
|
2663
|
+
</span>
|
|
2664
|
+
</div>
|
|
2665
|
+
:
|
|
2666
|
+
<div style="display:flex;flex-direction:column;gap:0">
|
|
2667
|
+
{visibleJobs().map(job => <JobCard key={job.name} job={job} />)}
|
|
2668
|
+
</div>
|
|
2669
|
+
}
|
|
2670
|
+
</div>
|
|
2671
|
+
|
|
2672
|
+
{/* Панель логов */}
|
|
2673
|
+
{logsTask() && (
|
|
2674
|
+
<div style="position:fixed;bottom:16px;left:16px;right:16px;background:#1e1e1e;border:1px solid #333;border-radius:8px;padding:0;max-height:300px;overflow:hidden;display:flex;flex-direction:column;z-index:1000">
|
|
2675
|
+
<div style="display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid #333;background:#252526;border-radius:8px 8px 0 0">
|
|
2676
|
+
<div style="display:flex;align-items:center;gap:8px">
|
|
2677
|
+
<span style="font-size:13px;font-weight:600;color:#ffffff">Логи</span>
|
|
2678
|
+
<span style="font-size:11px;color:#8e8e93">{logsTask()}</span>
|
|
2679
|
+
</div>
|
|
2680
|
+
<button
|
|
2681
|
+
onClick={() => { setLogsTask(null); setLogs("") }}
|
|
2682
|
+
style="background:transparent;border:none;color:#8e8e93;cursor:pointer;font-size:18px;line-height:1;padding:0;width:24px;height:24px;display:flex;align-items:center;justify-content:center"
|
|
2683
|
+
onMouseEnter={(e) => { (e.target as HTMLButtonElement).style.color = "#ff3b30" }}
|
|
2684
|
+
onMouseLeave={(e) => { (e.target as HTMLButtonElement).style.color = "#8e8e93" }}
|
|
2685
|
+
>
|
|
2686
|
+
✕
|
|
2687
|
+
</button>
|
|
2688
|
+
</div>
|
|
2689
|
+
<div style="flex:1;overflow-y:auto;padding:12px;font-family:Menlo, Monaco, 'Courier New', monospace;font-size:11px;line-height:1.5;color:#d4d4d4;background:#1e1e1e;border-radius:0 0 8px 8px">
|
|
2690
|
+
{logs().split("\n").map((line, i) => (
|
|
2691
|
+
<div key={i} style="white-space:pre-wrap;margin-bottom:2px">{line}</div>
|
|
2692
|
+
))}
|
|
2693
|
+
</div>
|
|
2694
|
+
</div>
|
|
2695
|
+
)}
|
|
2696
|
+
</div>
|
|
2697
|
+
</ErrorBoundary>
|
|
2698
|
+
),
|
|
2699
|
+
})
|
|
2700
|
+
} catch (err: any) {
|
|
2701
|
+
// Error boundary: если рендеринг падает, выводим сообщение вместо исчезновения панели
|
|
2702
|
+
console.error("GUI render error:", err)
|
|
2703
|
+
return ctx.add(Panel, {
|
|
2704
|
+
id: "scheduler-jobs",
|
|
2705
|
+
region: "side",
|
|
2706
|
+
list: () => [{ id: "jobs", title: "Планировщик", pinned: true }],
|
|
2707
|
+
render: () => (
|
|
2708
|
+
<ErrorBoundary fallback={(err: any) => (
|
|
2709
|
+
<div style="padding:16px;color:#ff3b30;font-size:13px">
|
|
2710
|
+
Ошибка UI: {err.message}
|
|
2711
|
+
</div>
|
|
2712
|
+
)}>
|
|
2713
|
+
<div style="padding:16px;display:flex;flex-direction:column;gap:16px;font-size:13px;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;color:#e0e0e0;background:#0f0f0f">
|
|
2714
|
+
<h2 style="margin:0;font-size:22px;font-weight:800;color:#ffffff">{schedulerTitle()}</h2>
|
|
2715
|
+
<div style="margin-top:5px;font-size:11px;font-weight:600;letter-spacing:1.2px;text-transform:uppercase;color:#8e8e93">Local AI CI/CD Orchestrator</div>
|
|
2716
|
+
<div style="background:#2a1a1a;border:1px solid #ff3b30;border-radius:8px;padding:16px;color:#ff3b30">
|
|
2717
|
+
Произошла ошибка отображения. Попробуйте перезагрузить панель.
|
|
2718
|
+
</div>
|
|
2719
|
+
</div>
|
|
2720
|
+
</ErrorBoundary>
|
|
2721
|
+
),
|
|
2722
|
+
})
|
|
2723
|
+
}
|
|
2724
|
+
},
|
|
2725
|
+
})
|