opencode-windows-scheduler 0.0.0-stage → 1.1.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 +52 -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 +90 -0
- package/dist/core/analytics.d.ts +119 -0
- package/dist/core/analytics.d.ts.map +1 -0
- package/dist/core/analytics.js +265 -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/retention.d.ts +29 -0
- package/dist/core/retention.d.ts.map +1 -0
- package/dist/core/retention.js +98 -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 +102 -0
- package/dist/db/history-repo.d.ts.map +1 -0
- package/dist/db/history-repo.js +215 -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/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 +2159 -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 +2186 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +924 -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 +1668 -0
- package/dist/settings.d.ts +66 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +137 -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/version.d.ts +8 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +27 -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 +314 -0
- package/docs/FEATURES.md +300 -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 +94 -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/analytics.ts +378 -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/retention.ts +141 -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 +396 -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 +2868 -0
- package/src/history.ts +107 -0
- package/src/index.ts +2768 -0
- package/src/notifications.ts +174 -0
- package/src/rpc.ts +999 -0
- package/src/schtasks.ts +75 -0
- package/src/server.ts +1879 -0
- package/src/settings.ts +228 -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/version.ts +27 -0
- package/src/workspaces.ts +236 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Migration guide
|
|
2
|
+
|
|
3
|
+
How to move existing automation into `opencode-windows-scheduler` from cron, systemd
|
|
4
|
+
timers, launchd, Windows Task Scheduler, or another scheduler plugin.
|
|
5
|
+
|
|
6
|
+
- [Before you start](#before-you-start)
|
|
7
|
+
- [From cron / crontab](#from-cron--crontab)
|
|
8
|
+
- [From systemd timers](#from-systemd-timers)
|
|
9
|
+
- [From launchd](#from-launchd)
|
|
10
|
+
- [From Windows Task Scheduler](#from-windows-task-scheduler)
|
|
11
|
+
- [From another scheduler plugin](#from-another-scheduler-plugin)
|
|
12
|
+
- [Bulk import and export](#bulk-import-and-export)
|
|
13
|
+
- [Verification checklist](#verification-checklist)
|
|
14
|
+
- [Common pitfalls](#common-pitfalls)
|
|
15
|
+
- [Rollback](#rollback)
|
|
16
|
+
|
|
17
|
+
## Before you start
|
|
18
|
+
|
|
19
|
+
1. **Install and build.**
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g opencode-windows-scheduler
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Add the plugin to `opencode.json` and restart OpenCode. If OpenCode's built-in
|
|
26
|
+
schedules are enabled, disable them so two schedulers do not run the same work.
|
|
27
|
+
|
|
28
|
+
2. **Check Node.** `node --version` must be 20 or newer (22.5+ for the built-in SQLite
|
|
29
|
+
driver; Node 24 recommended).
|
|
30
|
+
|
|
31
|
+
3. **Inventory the old jobs.** For each job write down: name, schedule, command,
|
|
32
|
+
working directory, environment variables, timeout, and what "success" means. The
|
|
33
|
+
last one becomes your Quality Gate.
|
|
34
|
+
|
|
35
|
+
4. **Do not delete the old jobs yet.** Run both schedulers side by side for a few days,
|
|
36
|
+
then remove the old entries.
|
|
37
|
+
|
|
38
|
+
## From cron / crontab
|
|
39
|
+
|
|
40
|
+
Cron expressions are compatible (five fields). The differences are in the command.
|
|
41
|
+
|
|
42
|
+
**Before (crontab)**
|
|
43
|
+
|
|
44
|
+
```cron
|
|
45
|
+
0 2 * * * cd /srv/api && /usr/bin/git pull && /usr/bin/npm test >> /var/log/api.log 2>&1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**After (agent tool or GUI)**
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"name": "api-nightly",
|
|
53
|
+
"schedule": "0 2 * * *",
|
|
54
|
+
"workingDirectory": "/srv/api",
|
|
55
|
+
"beforeScript": "git pull --ff-only",
|
|
56
|
+
"prompt": "Inspect the repository, apply safe dependency updates, and explain every change you made.",
|
|
57
|
+
"qualityGate": "npm test",
|
|
58
|
+
"timeoutSeconds": 1800
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Mapping table:
|
|
63
|
+
|
|
64
|
+
| Cron concept | Scheduler equivalent |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `cd /path && command` | `workingDirectory` or `workspaceId` |
|
|
67
|
+
| `>> file 2>&1` | log file is written automatically (`logs/<task>.log`) |
|
|
68
|
+
| `&&` chains | `beforeScript`, `prompt`, `qualityGate`, `afterScript` |
|
|
69
|
+
| exit code check | Quality Gate |
|
|
70
|
+
| `MAILTO` | webhook notifications |
|
|
71
|
+
| `%` escapes | not needed; write the prompt as normal text |
|
|
72
|
+
| `@reboot` | not supported; use a file/MCP trigger or a frequent cron |
|
|
73
|
+
|
|
74
|
+
Notes:
|
|
75
|
+
|
|
76
|
+
- `@daily`, `@hourly` and similar macros are not supported — write `0 0 * * *`,
|
|
77
|
+
`0 * * * *`, and so on.
|
|
78
|
+
- `@reboot` and `@yearly` have no direct equivalent.
|
|
79
|
+
- Cron environments are minimal. The wrapper inherits the user environment of the OS
|
|
80
|
+
scheduler entry, not your interactive shell. Absolute paths are safer than relying on
|
|
81
|
+
`PATH` from `.bashrc`.
|
|
82
|
+
|
|
83
|
+
## From systemd timers
|
|
84
|
+
|
|
85
|
+
The plugin schedules through the user crontab on Linux, so systemd calendar syntax is
|
|
86
|
+
translated to a cron expression when you migrate.
|
|
87
|
+
|
|
88
|
+
**Before**
|
|
89
|
+
|
|
90
|
+
```ini
|
|
91
|
+
# api-nightly.timer
|
|
92
|
+
[Timer]
|
|
93
|
+
OnCalendar=*-*-* 02:00:00
|
|
94
|
+
Persistent=true
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```ini
|
|
98
|
+
# api-nightly.service
|
|
99
|
+
[Service]
|
|
100
|
+
WorkingDirectory=/srv/api
|
|
101
|
+
ExecStart=/usr/bin/npm run nightly
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**After**
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"name": "api-nightly",
|
|
109
|
+
"schedule": "0 2 * * *",
|
|
110
|
+
"workingDirectory": "/srv/api",
|
|
111
|
+
"prompt": "Run the nightly routine described in package.json and summarize the result.",
|
|
112
|
+
"qualityGate": "npm test"
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
| systemd | Scheduler |
|
|
117
|
+
| --- | --- |
|
|
118
|
+
| `OnCalendar=*-*-* 02:00` | `0 2 * * *` |
|
|
119
|
+
| `OnUnitActiveSec=15min` | `*/15 * * * *` |
|
|
120
|
+
| `WorkingDirectory` | `workingDirectory` / `workspaceId` |
|
|
121
|
+
| `Environment=` | set it in the hook or in the user environment |
|
|
122
|
+
| `TimeoutStartSec` | `timeoutSeconds` |
|
|
123
|
+
| `Persistent=true` | catch-up is not implemented; a missed window is skipped |
|
|
124
|
+
| `Requires=` / `After=` | `dependsOn` |
|
|
125
|
+
|
|
126
|
+
Disable the old units (`systemctl --user disable --now api-nightly.timer`) only after
|
|
127
|
+
the new task has run successfully at least once.
|
|
128
|
+
|
|
129
|
+
## From launchd
|
|
130
|
+
|
|
131
|
+
**Before**
|
|
132
|
+
|
|
133
|
+
```xml
|
|
134
|
+
<key>StartCalendarInterval</key>
|
|
135
|
+
<dict><key>Hour</key><integer>2</integer></dict>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**After**
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"name": "mac-nightly",
|
|
143
|
+
"schedule": "0 2 * * *",
|
|
144
|
+
"workingDirectory": "/Users/me/projects/api",
|
|
145
|
+
"prompt": "Run the nightly maintenance and report anything unusual."
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
| launchd | Scheduler |
|
|
150
|
+
| --- | --- |
|
|
151
|
+
| `StartCalendarInterval` | cron expression |
|
|
152
|
+
| `StartInterval` (seconds) | `*/N * * * *` (minute granularity) |
|
|
153
|
+
| `WorkingDirectory` | `workingDirectory` |
|
|
154
|
+
| `StandardOutPath` / `StandardErrorPath` | automatic log file |
|
|
155
|
+
| `RunAtLoad` | not supported; use a manual run or a file trigger |
|
|
156
|
+
|
|
157
|
+
## From Windows Task Scheduler
|
|
158
|
+
|
|
159
|
+
Existing tasks usually point to a `.bat`/`.ps1` file or a command line.
|
|
160
|
+
|
|
161
|
+
**After**
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"name": "win-nightly",
|
|
166
|
+
"schedule": "0 2 * * *",
|
|
167
|
+
"workingDirectory": "C:\\projects\\api",
|
|
168
|
+
"prompt": "Run the nightly maintenance for this repository.",
|
|
169
|
+
"qualityGate": "npm test"
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
| Task Scheduler | Scheduler |
|
|
174
|
+
| --- | --- |
|
|
175
|
+
| Trigger "Daily" | `0 2 * * *` |
|
|
176
|
+
| Trigger "At log on" | not supported; use a file trigger or a start-up hook |
|
|
177
|
+
| "Run whether user is logged on" | the plugin registers tasks in the current user context |
|
|
178
|
+
| "Stop task if it runs longer than" | `timeoutSeconds` |
|
|
179
|
+
| "If the task is already running" | lock file, the second run is `skipped` |
|
|
180
|
+
| Action "Start a program" | you describe the goal in a prompt instead of a command |
|
|
181
|
+
| Multiple actions | `beforeScript` + `prompt` + `qualityGate` + `afterScript` |
|
|
182
|
+
|
|
183
|
+
Delete the old task only after verifying the new one:
|
|
184
|
+
`schtasks /delete /tn "<old task>" /f`.
|
|
185
|
+
|
|
186
|
+
## From another scheduler plugin
|
|
187
|
+
|
|
188
|
+
There is no universal importer, because definition formats differ. The workflow is:
|
|
189
|
+
|
|
190
|
+
1. List the old jobs and copy their schedules, prompts and working directories.
|
|
191
|
+
2. Recreate them with `schedule_task` or the GUI.
|
|
192
|
+
3. If the old plugin exports JSON, transform it into the import format below and use
|
|
193
|
+
`import_tasks` — validation reports per-record errors.
|
|
194
|
+
4. Disable the old plugin before the first overlapping run.
|
|
195
|
+
|
|
196
|
+
## Bulk import and export
|
|
197
|
+
|
|
198
|
+
**Export format**
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"version": 1,
|
|
203
|
+
"exportedAt": "2026-01-01T00:00:00.000Z",
|
|
204
|
+
"tasks": [
|
|
205
|
+
{
|
|
206
|
+
"name": "api-nightly",
|
|
207
|
+
"schedule": "0 2 * * *",
|
|
208
|
+
"prompt": "Nightly maintenance.",
|
|
209
|
+
"qualityGate": "npm test",
|
|
210
|
+
"workspaceId": "ws-api"
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Import**
|
|
217
|
+
|
|
218
|
+
Use `import_tasks` from the GUI or the RPC layer. Rules:
|
|
219
|
+
|
|
220
|
+
- `name` and `prompt` are required.
|
|
221
|
+
- `cron` tasks need a schedule; `file` tasks need `watchPath`; `mcp-event` tasks need
|
|
222
|
+
`mcpEvent.event`.
|
|
223
|
+
- Matrix tasks cannot also set `workspaceId`, and `matrix.workspaceIds` must not be
|
|
224
|
+
empty.
|
|
225
|
+
- Workspace ids must exist in the target installation, or the record is rejected.
|
|
226
|
+
- Errors are reported per record; valid records are imported.
|
|
227
|
+
|
|
228
|
+
Workspaces are not exported as directories — recreate them with
|
|
229
|
+
`manage_workspaces` first, then map old paths by hand.
|
|
230
|
+
|
|
231
|
+
## Verification checklist
|
|
232
|
+
|
|
233
|
+
For every migrated job:
|
|
234
|
+
|
|
235
|
+
1. `dry_run` with the task name — check order, dependencies and estimated time.
|
|
236
|
+
2. `run_task_now` — confirm the log shows the expected work.
|
|
237
|
+
3. Check the Quality Gate result in `get_history`.
|
|
238
|
+
4. Confirm the next scheduled run appears with a correct "next run" timestamp.
|
|
239
|
+
5. For matrix jobs, expand the parent in the dashboard and verify every clone has the
|
|
240
|
+
right workspace path.
|
|
241
|
+
6. Wait for at least one natural scheduled run before deleting the old definition.
|
|
242
|
+
|
|
243
|
+
## Common pitfalls
|
|
244
|
+
|
|
245
|
+
| Symptom | Cause | Fix |
|
|
246
|
+
| --- | --- | --- |
|
|
247
|
+
| `skipped` in history | previous run still holds the lock | wait, or lower `timeoutSeconds` |
|
|
248
|
+
| `timeout` every run | the agent needs more time | raise `timeoutSeconds` |
|
|
249
|
+
| Quality Gate fails but the work looks fine | gate runs in the task directory, not a subdirectory | prefix the command with `cd subdir && ...` |
|
|
250
|
+
| Agent cannot find the project | no `workingDirectory`/`workspaceId`, so it ran in the plugin directory | set the working directory |
|
|
251
|
+
| "Workspace path does not exist" on import | workspace ids belong to another machine | recreate workspaces and remap ids |
|
|
252
|
+
| Two runs at once after migration | old scheduler is still enabled | disable the old job |
|
|
253
|
+
| Cron rejected | expression not expressible by `schtasks` | use a supported pattern (`*/N`, fixed minute/hour, weekdays) |
|
|
254
|
+
| Prompts behave differently at night | interactive shell environment vs scheduler environment | use absolute paths, avoid alias-dependent commands |
|
|
255
|
+
|
|
256
|
+
## Rollback
|
|
257
|
+
|
|
258
|
+
If something goes wrong:
|
|
259
|
+
|
|
260
|
+
1. Re-enable the old jobs (they were never deleted).
|
|
261
|
+
2. `pause_task` the migrated ones, or delete them.
|
|
262
|
+
3. Export the plugin definitions before major changes: `export_tasks` gives a single
|
|
263
|
+
JSON file you can re-import on any machine.
|
|
264
|
+
|
|
265
|
+
Definitions live in `scheduler.db`; deleting the plugin directory removes all state.
|
|
266
|
+
Export first if you might want it back.
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("solid-js/web"),p=require("solid-js"),bi=require("@opencode/plugin/gui"),tl=require("@opencode/plugin/rpc"),Nt={type:["object","null"],properties:{server:{type:"string"},event:{type:"string"},filter:{type:"string"}},required:["server","event"]},$i={type:["object","null"],properties:{workspaceIds:{type:"array",items:{type:"string"}},strategy:{type:["string","null"]},failureMode:{type:["string","null"]},aggregation:{type:["string","null"]},createAggregator:{type:["boolean","null"]},concurrency:{type:["number","null"]},overrides:{type:["object","null"],additionalProperties:{type:"object",properties:{prompt:{type:["string","null"]},model:{type:["string","null"]},qualityGate:{type:["string","null"]},beforeScript:{type:["string","null"]},afterScript:{type:["string","null"]}}}}},required:["workspaceIds"]},rl={type:"object",properties:{name:{type:"string"},schedule:{type:"string"},status:{type:"string"},nextRun:{type:["string","null"]},model:{type:["string","null"]},priority:{type:["number","null"]},retryCount:{type:["number","null"]},retryDelay:{type:["number","null"]},qualityGate:{type:["string","null"]},nextTaskOnSuccess:{type:["string","null"]},nextTaskOnError:{type:["string","null"]},dependsOn:{type:"array",items:{type:"string"}},prompt:{type:"string"},beforeScript:{type:["string","null"]},afterScript:{type:["string","null"]},triggerType:{type:["string","null"]},mcpEvent:Nt,watchPath:{type:["string","null"]},workingDirectory:{type:["string","null"]},workspaceId:{type:["string","null"]},workspaceName:{type:["string","null"]},workspaceColor:{type:["string","null"]},allowedTools:{type:["array","null"],items:{type:"string"}},deniedTools:{type:["array","null"],items:{type:"string"}},matrix:$i,matrixParentId:{type:["string","null"]},isMatrixParent:{type:"boolean"},matrixSummary:{type:["object","null"],properties:{totalCount:{type:"number"},successCount:{type:"number"},errorCount:{type:"number"},pendingCount:{type:"number"},status:{type:"string"},message:{type:"string"}}}},required:["name","schedule","status"]},xi={type:"object",properties:{},additionalProperties:!1},il={type:"object",properties:{tasks:{type:"array",items:rl}},required:["tasks"]},nl={type:"object",properties:{name:{type:"string"},schedule:{type:"string"},prompt:{type:"string"},model:{type:"string"},priority:{type:"number"},retryCount:{type:"number"},retryDelay:{type:"number"},qualityGate:{type:"string"},nextTaskOnSuccess:{type:"string"},nextTaskOnError:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},beforeScript:{type:"string"},afterScript:{type:"string"},triggerType:{type:"string"},mcpEvent:Nt,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}},matrix:$i},required:["name","schedule","prompt"]},ol={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},Wt={type:"object",properties:{name:{type:"string"}},required:["name"]},ll=Wt,sl=Wt,Bt={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},al=Bt,pl=Wt,cl={type:"object",properties:{success:{type:"boolean"},logs:{type:"string"},error:{type:"string"}},required:["success","logs"]},dl={type:"object",properties:{taskName:{type:"string"},status:{type:"string"},startedAt:{type:"string"},finishedAt:{type:"string"},durationMs:{type:"number"},error:{type:["string","null"]},nextTask:{type:["string","null"]},model:{type:["string","null"]},preFlightStatus:{type:["string","null"]},postFlightStatus:{type:["string","null"]},allowedTools:{type:["array","null"],items:{type:"string"}},deniedTools:{type:["array","null"],items:{type:"string"}}},required:["taskName","status","startedAt","finishedAt","durationMs","error"]},ul={type:"object",properties:{limit:{type:"number"}},additionalProperties:!1},gl={type:"object",properties:{records:{type:"array",items:dl}},required:["records"]},fl={type:"object",properties:{total:{type:"number"},success:{type:"number"},error:{type:"number"}},required:["total","success","error"]},ml={type:"object",properties:{},additionalProperties:!1},yl=fl,bl={type:"object",properties:{},additionalProperties:!1},xl={type:"object",properties:{port:{type:["number","null"]}},required:["port"]},vl={type:"object",properties:{},additionalProperties:!1},hl={type:"object",properties:{platform:{type:"string"},title:{type:"string"}},required:["platform","title"]},$l={type:"object",properties:{},additionalProperties:!1},wl={type:"object",properties:{success:{type:"boolean"},data:{type:"string"},count:{type:"number"},error:{type:"string"}},required:["success"]},_l={type:"object",properties:{data:{type:"string"}},required:["data"]},kl={type:"object",properties:{success:{type:"boolean"},imported:{type:"number"},errors:{type:"array",items:{type:"string"}},error:{type:"string"}},required:["success"]},Sl={type:"object",properties:{},additionalProperties:!1},wi={type:"object",properties:{enabled:{type:"boolean"},onlyOnError:{type:"boolean"},webhook:{type:"object",properties:{enabled:{type:"boolean"},url:{type:"string"}},required:["enabled","url"]}},required:["enabled","onlyOnError"]},_i={type:"object",properties:{retentionDays:{type:"number"},maxRecords:{type:"number"},lastCleanupAt:{type:["string","null"]},lastCleanupDeleted:{type:"number"}},required:["retentionDays","maxRecords"]},Cl={type:"object",properties:{maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:wi,history:_i},required:["maxConcurrent","winterMode","notifications"]},zl={type:"object",properties:{maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:wi,history:_i},additionalProperties:!1},Tl={type:"object",properties:{success:{type:"boolean"},maxConcurrent:{type:"number"},winterMode:{type:"boolean"},notifications:wi,history:_i},required:["success","maxConcurrent","winterMode","notifications"]},El={type:"object",properties:{retentionDays:{type:"number"},maxRecords:{type:"number"}},additionalProperties:!1},Pl={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},deleted:{type:"number"},deletedByAge:{type:"number"},deletedByCount:{type:"number"},kept:{type:"number"},retentionDays:{type:"number"},maxRecords:{type:"number"},vacuumed:{type:"boolean"}},required:["success","message","deleted","kept"]},Al={type:"object",properties:{days:{type:"number"},topLimit:{type:"number"}},additionalProperties:!1},Ol={type:"object",properties:{success:{type:"boolean"},report:{type:["object","null"]},error:{type:"string"}},required:["success","report"]},Ml={type:"object",properties:{},additionalProperties:!1},Rl={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success","message"]},In={type:"object",properties:{id:{type:"string"},name:{type:"string"},prompt:{type:"string"},schedule:{type:"string"},timeoutSeconds:{type:"number"},model:{type:"string"},priority:{type:"number"},retryCount:{type:"number"},retryDelay:{type:"number"},qualityGate:{type:"string"},nextTaskOnSuccess:{type:"string"},nextTaskOnError:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},beforeScript:{type:"string"},afterScript:{type:"string"},triggerType:{type:"string"},mcpEvent:Nt,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}}},required:["id","name","prompt"]},Il={type:"object",properties:{},additionalProperties:!1},Ll={type:"object",properties:{templates:{type:"array",items:In}},required:["templates"]},ql={type:"object",properties:{id:{type:"string"},name:{type:"string"},prompt:{type:"string"},schedule:{type:"string"},timeoutSeconds:{type:"number"},model:{type:"string"},priority:{type:"number"},retryCount:{type:"number"},retryDelay:{type:"number"},qualityGate:{type:"string"},nextTaskOnSuccess:{type:"string"},nextTaskOnError:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},beforeScript:{type:"string"},afterScript:{type:"string"},triggerType:{type:"string"},mcpEvent:Nt,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}}},required:["name","prompt"],additionalProperties:!1},Dl={type:"object",properties:{success:{type:"boolean"},template:In,error:{type:"string"}},required:["success"]},jl={type:"object",properties:{id:{type:"string"}},required:["id"]},Gl={type:"object",properties:{success:{type:"boolean"},error:{type:"string"}},required:["success"]},En=Wt,Fl={type:"object",properties:{name:{type:"string"},newSchedule:{type:"string"},newPrompt:{type:"string"},model:{type:"string"},priority:{type:"number"},retryCount:{type:"number"},retryDelay:{type:"number"},qualityGate:{type:"string"},nextTaskOnSuccess:{type:"string"},nextTaskOnError:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},beforeScript:{type:"string"},afterScript:{type:"string"},triggerType:{type:"string"},mcpEvent:Nt,watchPath:{type:"string"},workspaceId:{type:"string"},workingDirectory:{type:"string"},allowedTools:{type:"array",items:{type:"string"}},deniedTools:{type:"array",items:{type:"string"}},matrix:$i},required:["name"]},Bl=Bt,Ln={type:"object",properties:{id:{type:"string"},name:{type:"string"},path:{type:"string"},gitRemote:{type:["string","null"]},gitBranch:{type:["string","null"]},color:{type:["string","null"]},createdAt:{type:"string"}},required:["id","name","path","createdAt"]},Nl={type:"object",properties:{},additionalProperties:!1},Wl={type:"object",properties:{workspaces:{type:"array",items:Ln}},required:["workspaces"]},Ul={type:"object",properties:{name:{type:"string"},path:{type:"string"},color:{type:"string"}},required:["path"],additionalProperties:!1},Pn={type:"object",properties:{success:{type:"boolean"},workspace:Ln,error:{type:"string"}},required:["success"]},Hl={type:"object",properties:{id:{type:"string"},name:{type:"string"},path:{type:"string"},color:{type:"string"}},required:["id"],additionalProperties:!1},Jl={type:"object",properties:{id:{type:"string"}},required:["id"]},Ql={type:"object",properties:{success:{type:"boolean"},message:{type:"string"}},required:["success"]},Yl={type:"object",properties:{eventName:{type:"string"},payload:{type:["object","null","string","number","boolean","array"]}},required:["eventName"]},Kl={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},triggered:{type:"array",items:{type:"string"}}},required:["success","triggered"]},Vl={type:"object",properties:{name:{type:"string"},order:{type:"number"},trigger:{type:"string"},cwd:{type:"string"},command:{type:"string"},workspace:{type:["object","null"],properties:{name:{type:"string"},path:{type:"string"}},required:["name","path"]},preFlight:{type:["string","null"]},postFlight:{type:["string","null"]},qualityGate:{type:["string","null"]},roleScoped:{type:["object","null"],properties:{allowed:{type:"array",items:{type:"string"}},denied:{type:"array",items:{type:"string"}}}},estimatedDurationSec:{type:["number","null"]},estimatedCostUsd:{type:["number","null"]},estimatedTokens:{type:["number","null"]},matrixParent:{type:"string"}},required:["name","order","trigger","cwd","command"]},qn={type:"object",properties:{success:{type:"boolean"},taskName:{type:"string"},tasks:{type:"array",items:Vl},totals:{type:"object",properties:{estimatedDurationSec:{type:["number","null"]},estimatedCostUsd:{type:["number","null"]},estimatedTokens:{type:["number","null"]}},required:[]},warnings:{type:"array",items:{type:"string"}},error:{type:"string"}},required:["success","taskName","tasks","warnings"]},Xl={type:"object",properties:{taskName:{type:"string"}},required:["taskName"],additionalProperties:!1},Zl={type:"object",properties:{success:{type:"boolean"},reports:{type:"array",items:qn}},required:["success","reports"]},es={type:"object",properties:{name:{type:"string"},workspaceId:{type:["string","null"]},workspaceName:{type:["string","null"]},status:{type:"string"},error:{type:["string","null"]},finishedAt:{type:["string","null"]}},required:["name","status"]},ts={type:"object",properties:{parentId:{type:"string"}},required:["parentId"],additionalProperties:!1},rs={type:"object",properties:{parentId:{type:"string"},totalCount:{type:"number"},successCount:{type:"number"},errorCount:{type:"number"},pendingCount:{type:"number"},status:{type:"string"},message:{type:"string"},clones:{type:"array",items:es}},required:["parentId","totalCount","successCount","errorCount","status"]},is={type:"object",properties:{success:{type:"boolean"},report:rs,error:{type:"string"}},required:["success"]},ns={type:"object",properties:{name:{type:"string"},workspaceIds:{type:"array",items:{type:"string"}},strategy:{type:"string"},failureMode:{type:"string"},aggregation:{type:"string"}},required:["workspaceIds"],additionalProperties:!1},os={type:"object",properties:{success:{type:"boolean"},clones:{type:"array",items:{type:"object",properties:{name:{type:"string"},workspaceId:{type:"string"},workspaceName:{type:["string","null"]}},required:["name","workspaceId"]}},error:{type:"string"}},required:["success","clones"]},ls={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},cancelled:{type:"array",items:{type:"string"}}},required:["success","message","cancelled"]},ss={type:"object",properties:{success:{type:"boolean"},message:{type:"string"},removed:{type:"array",items:{type:"string"}}},required:["success","message","removed"]},as=tl.Rpc.define({id:"opencode-windows-scheduler",methods:{get_tasks:{input:xi,output:il},create_task:{input:nl,output:ol},delete_task:{input:ll,output:Bt},run_task:{input:sl,output:al},pause_task:{input:En,output:Bt},resume_task:{input:En,output:Bt},update_task:{input:Fl,output:Bl},get_task_logs:{input:pl,output:cl},get_history:{input:ul,output:gl},get_metrics:{input:ml,output:yl},get_dashboard_port:{input:bl,output:xl},get_platform:{input:vl,output:hl},dry_run:{input:Xl,output:qn},dry_run_all:{input:xi,output:Zl},get_matrix_results:{input:ts,output:is},cancel_matrix:{input:Wt,output:ls},cleanup_matrix_orphans:{input:xi,output:ss},cleanup_history:{input:El,output:Pl},get_analytics:{input:Al,output:Ol},expand_matrix_preview:{input:ns,output:os},get_workspaces:{input:Nl,output:Wl},add_workspace:{input:Ul,output:Pn},update_workspace:{input:Hl,output:Pn},delete_workspace:{input:Jl,output:Ql},export_tasks:{input:$l,output:wl},import_tasks:{input:_l,output:kl},get_settings:{input:Sl,output:Cl},save_settings:{input:zl,output:Tl},get_templates:{input:Il,output:Ll},save_template:{input:ql,output:Dl},delete_template:{input:jl,output:Gl},emit_event:{input:Yl,output:Kl},test_notification:{input:Ml,output:Rl}},events:{}});var ps=e.template("<div><div style=display:flex;justify-content:space-between;align-items:center;gap:12px;width:100%><div style=display:flex;align-items:center;gap:12px;flex:1;min-width:0><div style=flex:1;min-width:0><div style=display:flex;align-items:center;gap:6px;min-width:0><div style=font-weight:700;font-size:16px;color:#ffffff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis></div></div><div style=font-size:12px;color:#a0a0a6;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>📊 Всего: <!> | ✅ <!> | ❌ </div></div><div style=display:flex;align-items:center;gap:8px;flex-shrink:0;min-width:110px></div></div><div style=display:flex;gap:6px><button></button><button></button><button>📄</button><button>🧪</button><button>📜</button><button>✏️"),cs=e.template("<span>📦 "),ds=e.template('<span 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)">📦 Matrix (<!>)'),us=e.template('<span 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)">↳ matrix '),gs=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>👁️"),fs=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>⚡"),ms=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>📡"),ys=e.template("<span style=font-size:12px;flex-shrink:0;cursor:help;color:#c084fc;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:200px>🧠 "),bs=e.template("<span style=font-size:12px;flex-shrink:0;cursor:help;color:#f5a623;white-space:nowrap>🚀 "),xs=e.template("<span style=font-size:13px;flex-shrink:0;cursor:help>🔒"),vs=e.template("<div style=display:flex;flex-direction:column;gap:2px;margin-top:4px;font-size:11px;line-height:1.35><span style=color:#5ac8fa;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>🔗 Зависит от: "),hs=e.template("<div style=display:flex;flex-direction:column;gap:2px;margin-top:4px;font-size:11px;line-height:1.35><span>📦 Matrix: <!>/<!> успешных"),$s=e.template("<div style=display:flex;align-items:center;gap:8px;font-size:12px;color:#a0a0a6;margin-top:2px><span style=white-space:nowrap;overflow:hidden;text-overflow:ellipsis>"),ws=e.template("<span>→ "),_s=e.template("<div style=font-size:12px;color:#f5a623;font-weight:600;white-space:nowrap>🟡 Выполняется: <!> сек"),ks=e.template("<div style=font-size:12px;font-weight:600;white-space:nowrap>"),Ss=e.template("<button>⛔"),Cs=e.template("<button>🗑"),zs=e.template('<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%"><div style=font-size:12px;font-weight:600;color:#ffffff;display:flex;align-items:center;gap:6px>📜 История последних запусков<button style=background:none;border:none;color:#8e8e93;cursor:pointer;font-size:14px;padding:0>✕'),Ts=e.template('<div style="font-size:12px;color:#8e8e93;padding:6px 0">Запусков пока нет.'),Es=e.template('<div style="display:flex;align-items:flex-start;gap:10px;font-size:12px;color:#e0e0e0;padding:4px 0;border-bottom:1px solid #333"><span style=color:#8e8e93;white-space:nowrap></span><span style=fontWeight:600;whiteSpace:nowrap></span><span style=color:#b0b0b0;white-space:nowrap> мс'),Ps=e.template("<span style=color:#c084fc;white-space:nowrap>🧠 "),As=e.template("<span style=whiteSpace:nowrap>⚡ pre: "),Os=e.template("<span style=whiteSpace:nowrap>⚡ post: "),Ms=e.template("<div style=margin-top:2px;color:#ff6b6b;font-size:11px;white-space:pre-wrap;word-break:break-word>"),Rs=e.template('<span title="Запущена следующая задача в цепочке"style=color:#5ac8fa;font-size:11px;white-space:nowrap>🔗 → '),Is=e.template('<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%"><div style=font-size:12px;font-weight:600;color:#ffffff;display:flex;align-items:center;gap:6px>🧪 Dry-Run: <button style=background:none;border:none;color:#8e8e93;cursor:pointer;font-size:14px;padding:0>✕'),Ls=e.template('<div style="font-size:12px;color:#8e8e93;padding:6px 0">Симуляция…'),qs=e.template('<div style="font-size:12px;color:#ff6b6b;padding:6px 0">❌ '),Ds=e.template("<div style=display:flex;flex-direction:column;gap:4px>"),js=e.template('<div style="font-size:11px;color:#f5a623;padding:4px 0">⚠ '),Gs=e.template('<div style="font-size:11px;color:#e0e0e0;padding:4px 0;border-bottom:1px solid #333;display:flex;flex-wrap:wrap;gap:6px;align-items:baseline"><span style=color:#8e8e93;white-space:nowrap>#<!> </span><span style=font-weight:600;white-space:nowrap>🧪 </span><span style=color:#8e8e93;white-space:nowrap>cwd: </span><div style=width:100%;color:#a0a0a6;overflow-wrap:anywhere>$ '),Fs=e.template("<span style=color:#5ac8fa;white-space:nowrap>📦 "),Bs=e.template("<span style=color:#ff9f0a;white-space:nowrap>↳ matrix "),Ns=e.template("<span style=cursor:help>🔒"),Ws=e.template("<span style=color:#8e8e93;white-space:nowrap>⏱ ~<!> с"),Us=e.template("<span style=color:#8e8e93;white-space:nowrap>· ~<!> ток."),Hs=e.template("<span style=color:#8e8e93;white-space:nowrap>· ~$"),Js=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>⚡ pre: "),Qs=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>⚡ post: "),Ys=e.template("<div style=width:100%;color:#8e8e93;overflow-wrap:anywhere>✅ QG: "),Ks=e.template('<div style="font-size:11px;color:#b0b0b0;padding:4px 0">Σ '),Vs=e.template('<div><div style=display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap><div style=min-width:0><h2 style=margin:0;font-size:22px;font-weight:800;letter-spacing:0.2px;line-height:1.2;color:#ffffff></h2><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></div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><select title="Фильтр задач по workspace"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"><option value=all>Все workspace</option><option value=none>Без workspace</option></select><button title="Открыть локальный веб-дашборд (фактический порт сервера)"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">🌐 Открыть дашборд</button><label title="Переключить зимнюю тему"><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>❄️ Зимний режим</label></div></div><div style=display:flex;gap:8px;flex-wrap:wrap;margin-top:8px><button></button><input type=file accept=.json style=display:none><button></button></div><div style=display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px><label style=font-size:12px;color:#b0b0b0;font-weight:500;white-space:nowrap>Макс. одновременных задач:</label><input type=number min=0 style="width:60px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"><span style=font-size:11px;color:#8e8e93;white-space:nowrap>(0 = без ограничений)</span></div><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"><button 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"><span>🔔 Уведомления</span><span style=display:flex;align-items:center;gap:8px;font-size:11px;font-weight:400;color:#8e8e93><span></span></span></button></div><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"><button 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"><span>🧹 История и ретеншн</span><span style=display:flex;align-items:center;gap:8px;font-size:11px;font-weight:400;color:#8e8e93> · <span></span></span></button></div><div style="width:100%;max-width:700px;box-sizing:border-box;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden"><div style="display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px"><button 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><span>📦 Workspaces</span><span style=font-size:11px;font-weight:400;color:#8e8e93></span><span style=font-size:11px;color:#8e8e93></span></button><button title="Добавить workspace (git-репозиторий)">+ Добавить</button></div></div><div style=display:block;width:100%;margin-top:24px><h3 style=margin:0;margin-bottom:8px;font-size:14px;font-weight:600;color:#ffffff>Задачи'),An=e.template("<div style=padding:16px;color:#ff3b30;font-size:13px>Ошибка UI: "),On=e.template("<option>📦 "),Xs=e.template('<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px"><label style=display:flex;align-items:center;gap:8px;font-size:12px;color:#e0e0e0;cursor:pointer><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>Включить уведомления</label><label><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>Только при ошибке</label><div style="border-top:1px solid #333;padding-top:10px;display:flex;flex-direction:column;gap:8px"><label><input type=checkbox style=accent-color:#5ac8fa;cursor:pointer;margin:0>Webhook (Discord / Slack / generic)</label><input type=url placeholder=https://discord.com/api/webhooks/...><div style=font-size:11px;color:#8e8e93>POST с JSON { content, text } — совместимо с Discord и Slack.</div></div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><button></button><span style=font-size:11px;color:#8e8e93>ntfy.sh не используется — только webhook.'),Zs=e.template('<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px"><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><label style=font-size:12px;color:#e0e0e0;white-space:nowrap>Удалять записи старше, дней</label><input type=number min=0 style="width:70px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"><span style=font-size:11px;color:#8e8e93>0 = не удалять по возрасту</span></div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><label style=font-size:12px;color:#e0e0e0;white-space:nowrap>Хранить не более записей</label><input type=number min=0 style="width:80px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"><span style=font-size:11px;color:#8e8e93>0 = без ограничения</span></div><div style=font-size:11px;color:#8e8e93>Последняя очистка: </div><div style=display:flex;align-items:center;gap:10px;flex-wrap:wrap><button></button><span style=font-size:11px;color:#8e8e93>Удаляются только завершённые записи; незавершённые запуски не трогаются.'),ea=e.template('<div style="display:flex;flex-direction:column;gap:6px;padding:0 14px 12px">'),ta=e.template('<div style="font-size:12px;color:#8e8e93;padding:4px 0">Workspace не добавлен. Задача без workspace использует рабочую директорию проекта.'),ra=e.template('<div style="display:flex;align-items:center;gap:10px;padding:8px 10px;background:#252526;border:1px solid #333;border-radius:8px;min-width:0"><span></span><div style=display:flex;flex-direction:column;gap:2px;flex:1;min-width:0><span style=font-size:12px;font-weight:700;color:#ffffff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>📦 </span><span style=font-size:10px;color:#8e8e93;white-space:nowrap;overflow:hidden;text-overflow:ellipsis></span><span style=font-size:10px;color:#a0a0a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>git: <!> · </span></div><div style=display:flex;gap:4px;flex-shrink:0><button title="Редактировать workspace"style=background:transparent;border:none;color:#a0a0a6;cursor:pointer;font-size:14px;padding:2px>✏️</button><button title="Удалить workspace (задачи сохраняются)"style=background:transparent;border:none;color:#ff3b30;cursor:pointer;font-size:14px;padding:2px>🗑'),ia=e.template('<button title="Развернуть форму создания задачи"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">➕ Создать задачу'),na=e.template('<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)"><div style=display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:16px><h3 style=margin:0;font-size:14px;font-weight:600;color:#ffffff></h3><div style=display:flex;align-items:center;gap:8px><button title="Сохранить текущие настройки формы как шаблон"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">💾 Сохранить как шаблон</button><button title="Свернуть форму"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">Скрыть форму ▴</button></div></div><div style="display:block;width:100%;margin-bottom:12px;padding:10px 12px;background:#1a1a1a;border:1px solid #333;border-radius:8px"><label style=display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;font-weight:600;color:#fff><input type=checkbox style=accent-color:#ff9f0a>📦 Matrix (Fan-Out)</label><div style=font-size:11px;color:#8e8e93;margin-top:4px;line-height:1.45>Задача-шаблон раскладывается на клоны по workspace. Родитель сам не выполняется — он запускает клоны и агрегирует результат.</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Имя задачи</label><input type=text placeholder="например, Gui-Test"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"></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Тип триггера</label><div style=display:flex;gap:8px><label style=display:flex;align-items:center;gap:6px;cursor:pointer;flex:1><input type=radio name=triggerType style=accent-color:#007acc>По расписанию (Cron)</label><label style=display:flex;align-items:center;gap:6px;cursor:pointer;flex:1><input type=radio name=triggerType style=accent-color:#007acc>При изменении файла</label><label style=display:flex;align-items:center;gap:6px;cursor:pointer;flex:1><input type=radio name=triggerType style=accent-color:#007acc>MCP Event</label></div></div><div style=width:100%;marginBottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Расписание</label><select 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"></select></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Промпт</label><textarea placeholder="Напиши краткий отчет о состоянии рынка"rows=2 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"></textarea></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Шаблон промпта</label><select 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"></select></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Модель LLM</label><input type=text list=scheduler-model-presets placeholder="по умолчанию (как в OpenCode)"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"><datalist id=scheduler-model-presets><option value=anthropic/claude-3-5-sonnet></option><option value=openai/gpt-4o></option><option value=deepseek/deepseek-coder></option><option value=google/gemini-2.5-pro></option><option value=openai/gpt-4o-mini></option></datalist><div style=font-size:11px;color:#8e8e93;margin-top:6px>Пусто — модель OpenCode по умолчанию. Иначе будет передан флаг --model.</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Приоритет</label><select 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"></select><div style=font-size:11px;color:#8e8e93;margin-top:6px>Если готовы несколько задач сразу, первой запускается задача с более высоким приоритетом.</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Кол-во повторов при ошибке</label><input type=number min=0 placeholder=0 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"></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Задержка перед повтором (сек)</label><input type=number min=1 placeholder=60 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"></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Проверочная команда (Quality Gate)</label><input type=text placeholder="например: npm run test"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"><div style=font-size:11px;color:#8e8e93;margin-top:6px>Выполняется после успешного ответа ИИ. Ненулевой код = ошибка задачи.</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Команда перед запуском (Pre-flight)</label><input type=text placeholder="например: git pull"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"><div style=font-size:11px;color:#8e8e93;margin-top:6px>Например: git pull или npm install. Выполняется в рабочей директории задачи. Ненулевой код отменяет запуск (Pre-flight script failed).</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Команда после запуска (Post-flight)</label><input type=text placeholder="например: git push"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"><div style=font-size:11px;color:#8e8e93;margin-top:6px>Например: git push или npm run build. Выполняется в рабочей директории задачи даже при ошибке основной задачи.</div></div><div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Зависит от задач (успешное завершение)</label><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"></div><div style=font-size:11px;color:#8e8e93;margin-top:6px>Задача запустится автоматически, когда все отмеченные задачи завершатся успешно.</div></div><details style=display:block;width:100%;margin-bottom:12px><summary style=cursor:pointer;font-size:12px;color:#b0b0b0;font-weight:500;margin-bottom:8px;user-select:none>🔒 Ограничения инструментов</summary><div style="display:block;width:100%;padding:10px;background:#1e1e1e;border:1px solid #333;border-radius:6px;box-sizing:border-box"><div style=font-size:11px;color:#8e8e93;margin-bottom:8px>⚠ Metadata-only: opencode 2.2.3 не поддерживает allow/deny флаги — ограничения фиксируются в логе и истории. При конфликте приоритет у <b>denied</b>. Пустой allowedTools запрещён.</div><div style=font-size:11px;color:#b0b0b0;margin-bottom:4px>Белый список (allowedTools)</div><div style=display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px></div><div style=font-size:11px;color:#b0b0b0;margin-bottom:4px>Чёрный список (deniedTools)</div><div style=display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px></div><div style=display:flex;gap:6px><input type=text placeholder="свой инструмент, например websearch"style="flex:1;padding:6px 8px;background:#141414;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none"><button style="padding:6px 10px;background:transparent;border:1px solid #34c759;color:#34c759;border-radius:6px;cursor:pointer;font-size:12px">+ allowed</button><button style="padding:6px 10px;background:transparent;border:1px solid #ff3b30;color:#ff3b30;border-radius:6px;cursor:pointer;font-size:12px">+ denied</button></div></div></details><div style=display:block;width:100%;margin-top:8px><button title="Локальное превью команды по текущим полям формы (без RPC и без запуска)"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">🧪 Превью</button><button>'),oa=e.template('<div style=margin-top:10px;display:flex;flex-direction:column;gap:10px><div><div style=font-size:12px;color:#b0b0b0;font-weight:500;margin-bottom:6px>Workspaces (для матрицы) — выбрано </div></div><div style=display:flex;gap:8px;flex-wrap:wrap><label style=flex:1;min-width:150px;font-size:11px;color:#b0b0b0>Стратегия<select 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"><option value=parallel>parallel — все сразу</option><option value=sequential>sequential — по одному</option></select></label><label style=flex:1;min-width:150px;font-size:11px;color:#b0b0b0>При ошибке<select 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"><option value=continue>continue — продолжать</option><option value=stop>stop — остановить</option></select></label><label style=flex:1;min-width:150px;font-size:11px;color:#b0b0b0>Агрегация<select 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"><option value=summary>summary — сводка</option><option value=per-task>per-task — по задачам</option></select></label></div><label style=display:flex;align-items:center;gap:8px;cursor:pointer;font-size:12px;color:#e0e0e0><input type=checkbox style=accent-color:#ff9f0a>Создать aggregator-задачу matrix-complete (запустится после всех клонов)</label><label style=font-size:11px;color:#b0b0b0;max-width:240px>Одновременно клонов (concurrency)<input type=number min=1 step=1 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"></label><div style="padding:8px 10px;background:#141414;border:1px solid #333;border-radius:6px;font-size:11px;line-height:1.55;color:#a0a0a6">'),la=e.template("<div style=font-size:11px;color:#f5a623>Сначала добавьте хотя бы один workspace."),sa=e.template('<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">'),aa=e.template("<label style=display:flex;align-items:center;gap:8px;cursor:pointer;font-size:12px;color:#e0e0e0><input type=checkbox style=accent-color:#ff9f0a><span>📦 </span><span style=font-size:10px;color:#8e8e93;white-space:nowrap;overflow:hidden;text-overflow:ellipsis>"),pa=e.template('<details style="padding:8px 10px;background:#141414;border:1px solid #333;border-radius:6px"><summary style=cursor:pointer;font-size:12px;color:#b0b0b0;font-weight:500>⚙ Настройки по workspace — переопределено </summary><div style=margin-top:8px;display:flex;flex-direction:column;gap:8px;max-height:340px;overflow:auto>'),ca=e.template('<div style="padding:8px;background:#101010;border:1px solid #2a2a2a;border-radius:6px"><div>📦 <span style=margin-left:6px;font-size:10px;color:#8e8e93></span></div><div style=display:flex;flex-direction:column;gap:6px><textarea rows=2 placeholder="Промпт (по умолчанию — общий промпт формы)"style="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box;width:100%;resize:vertical;font-family:inherit"></textarea><div style=display:flex;gap:6px;flex-wrap:wrap><input placeholder="Модель (override)"style="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box;flex:1;min-width:150px"><input placeholder="Quality Gate (override)"style="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box;flex:1;min-width:150px"></div><div style=display:flex;gap:6px;flex-wrap:wrap><input placeholder="beforeScript (override)"style="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box;flex:1;min-width:150px"><input placeholder="afterScript (override)"style="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box;flex:1;min-width:150px">'),da=e.template("<div style=color:#ff9f0a;font-weight:600>Будет создано <!> клон(а/ов):"),ua=e.template("<div style=color:#e0e0e0;word-break:break-all>"),ga=e.template("<span style=color:#f5a623>Выберите хотя бы один workspace — превью клонов появится здесь."),fa=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Workspace (multi-repo)</label><select 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"><option value>Без workspace — рабочая директория'),ma=e.template('<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"><div>cwd = <span style=color:#e0e0e0></span></div><div>git branch = <span style=color:#5ac8fa></span></div><div>git remote = <span style=color:#e0e0e0>'),ya=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Рабочая директория</label><input type=text placeholder="по умолчанию — папка проекта"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"><div style=font-size:11px;color:#8e8e93;margin-top:6px>В этой папке задача запустит opencode run — здесь подхватятся MCP-серверы из opencode.json.'),ba=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Путь к файлу для отслеживания</label><input type=text placeholder="например, C:\\project\\src\\main.ts"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">'),xa=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>MCP-сервер / источник</label><input type=text placeholder="например, github"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">'),va=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Имя события</label><input type=text placeholder="например, github.pr.opened"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">'),ha=e.template('<div style=display:block;width:100%;margin-bottom:12px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Фильтр (опционально)</label><input type=text placeholder="например, repo="my-project" или regex"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"><div style=font-size:11px;color:#8e8e93;margin-top:6px>key=value сравнивается с полем payload, иначе фильтр считается regex/подстрокой. События приходят через RPC emit_event.'),zr=e.template("<option>"),$a=e.template('<div style=display:block;width:100%;margin-top:8px><label style=display:block;margin-bottom:8px;font-size:12px;color:#b0b0b0;font-weight:500>Cron-выражение</label><input type=text placeholder="* * * * *"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">'),wa=e.template('<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">'),_a=e.template('<div style=display:flex;align-items:center;gap:6px;margin-top:8px><span style=font-size:10px;color:#8e8e93>Кастомный шаблон:</span><button title="Удалить шаблон"style=background:transparent;border:none;color:#ff3b30;cursor:pointer;font-size:14px;line-height:1;padding:0>🗑'),ka=e.template("<span style=font-size:11px;color:#ff3b30;font-weight:500;cursor:default>"),Sa=e.template("<option>Другой (<!>)"),Ca=e.template("<span style=font-size:12px;color:#8e8e93>Других задач пока нет"),vi=e.template("<label><input type=checkbox style=margin:0>"),za=e.template("<span style=color:#5ac8fa;font-size:11px;margin-left:6px>(<!> allowed · <!> denied)"),Ta=e.template("<div style=font-size:11px;color:#cfcfd2;margin-top:8px>"),Ea=e.template("<div>allowed: [<!>]"),Pa=e.template("<div>denied: [<!>]"),Aa=e.template('<button style="background:transparent;border:1px solid #333;border-radius:6px;padding:8px 16px;color:#ff3b30;cursor:pointer;font-size:13px;width:100%">Отмена'),Oa=e.template('<div style="display:block;width:100%;margin-top:8px;padding:10px;background:#1e1e1e;border:1px solid #333;border-radius:6px"><div style=font-size:12px;font-weight:600;color:#ffffff;display:flex;justify-content:space-between;align-items:center>🧪 Превью (локальное, по полям формы)<button style=background:none;border:none;color:#8e8e93;cursor:pointer;font-size:14px;padding:0>✕'),Ma=e.template("<div style=display:flex;flex-direction:column;gap:4px;font-size:11px;color:#e0e0e0;margin-top:6px><div style=overflow-wrap:anywhere>$ </div><div style=color:#8e8e93>cwd: "),Ra=e.template("<div style=color:#8e8e93>🔒 allowed=[<!>] · denied=[<!>]"),Ia=e.template("<div style=color:#8e8e93>⚡ pre: "),La=e.template("<div style=color:#8e8e93>⚡ post: "),qa=e.template("<div style=color:#8e8e93>✅ QG: "),Da=e.template("<div style=color:#f5a623>⚠ "),ja=e.template("<div style=font-size:11px;color:#8e8e93;margin-bottom:8px>Фильтр: <!> · показано <!> из "),Ga=e.template('<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"><span style=font-size:40px;line-height:1></span><span style=max-width:380px;line-height:1.5>'),Fa=e.template("<div style=display:flex;flex-direction:column;gap:0>"),Ba=e.template(`<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"><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"><div style=display:flex;align-items:center;gap:8px><span style=font-size:13px;font-weight:600;color:#ffffff>Логи</span><span style=font-size:11px;color:#8e8e93></span></div><button 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>✕</button></div><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">`),Na=e.template("<div style=white-space:pre-wrap;margin-bottom:2px>"),Wa=e.template(`<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"><h2 style=margin:0;font-size:22px;font-weight:800;color:#ffffff></h2><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><div style="background:#2a1a1a;border:1px solid #ff3b30;border-radius:8px;padding:16px;color:#ff3b30">Произошла ошибка отображения. Попробуйте перезагрузить панель.`);function Ua(c){switch(c){case"running":return"#f5a623";case"success":return"#34c759";case"error":return"#ff3b30";case"partial":return"#ff9f0a";default:return"#8e8e93"}}const _e=5;function Mn(c){const _=typeof c=="number"&&Number.isFinite(c)?Math.min(10,Math.max(0,Math.floor(c))):_e;return _>=10?"Критический":_>=8?"Высокий":_<=3?"Низкий":"Обычный"}const Rn=[{value:2,label:"Низкий"},{value:5,label:"Обычный"},{value:8,label:"Высокий"},{value:10,label:"Критический"}];function D(c){return c instanceof Error?c.message:typeof c=="object"&&c!==null&&"message"in c?String(c.message):JSON.stringify(c)}function ct(c,_=150){const Ie=(c||"").split(/\r?\n/).map(Tr=>Tr.trim()).find(Boolean)??"";return Ie.length>_?Ie.slice(0,_-1).trimEnd()+"…":Ie}const hi=[{label:"Каждую минуту",value:"* * * * *"},{label:"Каждый час",value:"0 * * * *"},{label:"Каждый день в 09:00",value:"0 9 * * *"},{label:"Каждый понедельник в 10:00",value:"0 10 * * 1"},{label:"Свое расписание…",value:"__custom__"}],Ha=bi.Plugin.define({setup(c){const _=c.client.rpc(as),[Ie,Tr]=p.createSignal([]),[ee,Dn]=p.createSignal([]),[Er,jn]=p.createSignal(!1),[Je,ki]=p.createSignal("all"),[dt,Qe]=p.createSignal(!1),[Ye,ke]=p.createSignal(""),[Gn,Ke]=p.createSignal(""),[Pr,Ar]=p.createSignal(null),[ut,Si]=p.createSignal(!1),[Ci,Ut]=p.createSignal(""),[Or,Fn]=p.createSignal({total:0,success:0,error:0}),[Ht,zi]=p.createSignal(null),[Ti,Bn]=p.createSignal([]),Ei=[{label:"Свой промпт",value:"custom",prompt:""},{label:"Ночной сторож (тесты)",value:"night-watch",prompt:"Запусти ночные проверки: прогнали тесты, зафиксируй ошибки и составь краткий отчёт о состоянии репозитория."},{label:"Утренний дайджест",value:"morning-digest",prompt:"Собери утренний дайджест: какие изменения были за ночь, есть ли проваленные сборки, что требует внимания сегодня."},{label:"Гигиена кода",value:"code-hygiene",prompt:"Проведи аудит гигиены кода: найди неиспользуемые импорты, неиспользуемые переменные, лишние зависимости и предложи правки."}],[gt,Jt]=p.createSignal("custom"),[Qt,Nn]=p.createSignal([]),[Wn,Un]=p.createSignal(0);setInterval(()=>Un(r=>r+1),1e3);const[Hn,Mr]=p.createSignal(1),[ce,Rr]=p.createSignal(!1),[be,Ir]=p.createSignal(!1),[Lr,qr]=p.createSignal(!0),[Le,Dr]=p.createSignal(!1),[Pi,jr]=p.createSignal(""),[Gr,Jn]=p.createSignal(!0),[Yt,Ai]=p.createSignal(!1),[Kt,Vt]=p.createSignal(30),[Xt,Zt]=p.createSignal(5e3),[Fr,Br]=p.createSignal(null),[Oi,Nr]=p.createSignal(0),[Wr,Qn]=p.createSignal(!0),[er,Mi]=p.createSignal(!1),Ve=new Map;p.onCleanup(()=>{for(const r of Ve.values())clearInterval(r);Ve.clear()});const[Ur,Yn]=p.createSignal("Планировщик задач");async function Kn(){try{const r=await _.get_platform({});r?.title&&Yn(r.title)}catch(r){console.error("RPC Error (get_platform):",r)}}async function Vn(){try{const r=await _.get_settings({});Mr(r.maxConcurrent??1),Rr(!!r.winterMode);const t=r.notifications;Ir(!!t?.enabled),qr(t?.onlyOnError!==!1),Dr(!!t?.webhook?.enabled),jr(t?.webhook?.url??"");const i=r.history;Vt(Number(i?.retentionDays??30)),Zt(Number(i?.maxRecords??5e3)),Br(i?.lastCleanupAt??null),Nr(Number(i?.lastCleanupDeleted??0))}catch(r){console.error("RPC Error (get_settings):",r)}}function Xn(){return{enabled:be(),onlyOnError:Lr(),webhook:{enabled:Le(),url:(Pi()||"").trim()}}}function Ri(){return{retentionDays:Math.max(0,Math.floor(Number(Kt())||0)),maxRecords:Math.max(0,Math.floor(Number(Xt())||0)),lastCleanupAt:Fr(),lastCleanupDeleted:Math.max(0,Math.floor(Number(Oi())||0))}}async function ft(r){try{const t=await _.save_settings(r);if(r.maxConcurrent!==void 0&&Mr(t.maxConcurrent),r.winterMode!==void 0&&Rr(!!t.winterMode),r.notifications!==void 0){const i=t.notifications;Ir(!!i?.enabled),qr(i?.onlyOnError!==!1),Dr(!!i?.webhook?.enabled),jr(i?.webhook?.url??"")}if(r.history!==void 0){const i=t.history;Vt(Number(i?.retentionDays??30)),Zt(Number(i?.maxRecords??5e3)),Br(i?.lastCleanupAt??null),Nr(Number(i?.lastCleanupDeleted??0))}}catch(t){console.error("RPC Error (save_settings):",t),c.toast.show({title:"Не удалось сохранить настройки",variant:"error",description:D(t)})}}async function mt(){await ft({notifications:Xn()})}async function Ii(){await ft({history:Ri()})}async function Zn(){Mi(!0);try{await ft({history:Ri()});const r=await _.cleanup_history({}),i=(await _.get_settings({})).history;Vt(Number(i?.retentionDays??30)),Zt(Number(i?.maxRecords??5e3)),Br(i?.lastCleanupAt??null),Nr(Number(i?.lastCleanupDeleted??0)),c.toast.show({title:r.success?"Очистка истории завершена":"Очистка не удалась",variant:r.success?"success":"error",description:r.message})}catch(r){console.error("RPC Error (cleanup_history):",r),c.toast.show({title:"Очистка не удалась",variant:"error",description:D(r)})}finally{Mi(!1)}}async function eo(){Ai(!0);try{await mt();const r=await _.test_notification({});c.toast.show({title:r.success?"Тестовое уведомление отправлено":"Тест не удался",variant:r.success?"success":"error",description:r.message})}catch(r){console.error("RPC Error (test_notification):",r),c.toast.show({title:"Тест не удался",variant:"error",description:D(r)})}finally{Ai(!1)}}async function to(r){Mr(r),await ft({maxConcurrent:r})}async function ro(r){Rr(r),await ft({winterMode:r})}const[Hr,tr]=p.createSignal(null),[io,Jr]=p.createSignal(!1),[ie,rr]=p.createSignal(""),[Xe,Ze]=p.createSignal("* * * * *"),[Se,et]=p.createSignal(""),[Li,yt]=p.createSignal("* * * * *"),[Qr,bt]=p.createSignal(0),[Yr,xt]=p.createSignal(60),[vt,ht]=p.createSignal(""),[tt,$t]=p.createSignal(_e),[ir,wt]=p.createSignal(""),[rt,_t]=p.createSignal([]),[nr,kt]=p.createSignal(""),[or,St]=p.createSignal(""),[de,qe]=p.createSignal("cron"),[Kr,Ct]=p.createSignal(""),[Vr,zt]=p.createSignal(""),[Xr,Tt]=p.createSignal(""),[Et,Pt]=p.createSignal(""),[lr,it]=p.createSignal(""),[F,nt]=p.createSignal([]),[B,ot]=p.createSignal([]),[qi,Di]=p.createSignal(""),[Ce,sr]=p.createSignal(!1),[xe,At]=p.createSignal([]),[Zr,ar]=p.createSignal("parallel"),[ji,pr]=p.createSignal("continue"),[Gi,cr]=p.createSignal("summary"),[Fi,dr]=p.createSignal(!1),[Bi,ur]=p.createSignal(""),[ei,gr]=p.createSignal({}),[Ot,ti]=p.createSignal(!1),[ri,Ni]=p.createSignal(!1),[N,Mt]=p.createSignal(null),[Rt,ii]=p.createSignal(""),Wi=["bash","edit","write","read","grep","glob","webfetch"];function Ui(r,t){r==="allowed"?nt(i=>i.includes(t)?i.filter(a=>a!==t):[...i,t]):ot(i=>i.includes(t)?i.filter(a=>a!==t):[...i,t])}function Hi(r){const t=qi().trim();t&&(r==="allowed"?F().includes(t)||nt([...F(),t]):B().includes(t)||ot([...B(),t]),Di(""))}function no(r,t){At(i=>t?i.includes(r)?i:[...i,r]:i.filter(a=>a!==r))}function ni(r,t){const i=r.trim()||"task",a=t.trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g,"-");return`${i}-matrix-${a||"workspace"}`}const oi=()=>xe().map(r=>ee().find(t=>t.id===r)).filter(r=>!!r).map(r=>ni(ie(),r.name));function It(r,t,i){gr(a=>{const J={...a[r]??{}};i.trim()?J[t]=i:delete J[t];const j={...a};return Object.keys(J).length>0?j[r]=J:delete j[r],j})}const oo=()=>Object.keys(ei()).length,Ji=()=>{if(!Ce())return;const r=Bi().trim(),t=r?Number(r):void 0,i=ei();return{workspaceIds:xe(),strategy:Zr(),failureMode:ji(),aggregation:Gi(),createAggregator:Fi(),...t!==void 0&&Number.isFinite(t)&&t>=1?{concurrency:Math.floor(t)}:{},...Object.keys(i).length>0?{overrides:i}:{}}};function fr(){sr(!1),At([]),ar("parallel"),pr("continue"),cr("summary"),dr(!1),ur(""),gr({})}function lo(){return`opencode run${vt().trim()?` --model ${vt().trim()}`:""} "${Se().replace(/\s+/g," ").trim()}"`}const[Ja,so]=p.createSignal(null),[mr,Qi]=p.createSignal(!1),[yr,Qa]=p.createSignal(!1),[Ya,ao]=p.createSignal(null);async function po(){Qi(!0);try{const r=await _.export_tasks({});if(!r.success){c.toast.show({title:"Ошибка экспорта",variant:"error",description:r.error});return}so(r.data);const t=new Blob([r.data],{type:"application/json"}),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=`windows-scheduler-tasks-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i),c.toast.show({title:`Экспортировано задач: ${r.count}`,variant:"success"})}catch(r){console.error("RPC Error (export_tasks):",r),c.toast.show({title:"Ошибка экспорта",variant:"error",description:D(r)})}finally{Qi(!1)}}function co(r){const i=r.target.files?.[0]??null;ao(i)}async function li(){try{const r=await _.get_templates({}),t=Array.isArray(r?.templates)?r.templates:[];Nn(t)}catch(r){console.error("RPC Error (get_templates):",r)}}async function br(){try{const r=await _.get_workspaces({}),t=Array.isArray(r?.workspaces)?r.workspaces:[];Dn(t)}catch(r){console.error("RPC Error (get_workspaces):",r)}}const Lt=()=>ee().find(r=>r.id===Ye());async function uo(){const r=(window.prompt("Путь к git-репозиторию (workspace)","")??"").trim();if(!r)return;const t=(window.prompt("Название workspace (необязательно)","")??"").trim();Qe(!0);try{const i=await _.add_workspace({path:r,...t?{name:t}:{}});if(!i.success){c.toast.show({title:"Ошибка добавления workspace",variant:"error",description:i.error??"Неизвестная ошибка"});return}await br(),i.workspace?.id&&ke(i.workspace.id),c.toast.show({title:"Workspace добавлен",variant:"success"})}catch(i){console.error("RPC Error (add_workspace):",i),c.toast.show({title:"Ошибка добавления workspace",variant:"error",description:ct(D(i))})}finally{Qe(!1)}}async function go(r){const t=(window.prompt("Путь к git-репозиторию",r.path)??"").trim();if(!t)return;const i=(window.prompt("Название workspace",r.name)??"").trim();Qe(!0);try{const a=await _.update_workspace({id:r.id,path:t,...i?{name:i}:{}});if(!a.success){c.toast.show({title:"Ошибка обновления workspace",variant:"error",description:a.error??"Неизвестная ошибка"});return}await br(),c.toast.show({title:"Workspace обновлён",variant:"success"})}catch(a){console.error("RPC Error (update_workspace):",a),c.toast.show({title:"Ошибка обновления workspace",variant:"error",description:ct(D(a))})}finally{Qe(!1)}}async function fo(r){if(window.confirm(`Удалить workspace "${r.name}"? Задачи сохранены, привязка будет очищена.`)){Qe(!0);try{const t=await _.delete_workspace({id:r.id});if(!t.success){c.toast.show({title:"Ошибка удаления workspace",variant:"error",description:t.message??"Неизвестная ошибка"});return}Ye()===r.id&&ke(""),Je()===r.id&&ki("all"),await br(),await ue(),c.toast.show({title:"Workspace удалён",variant:"success",description:t.message})}catch(t){console.error("RPC Error (delete_workspace):",t),c.toast.show({title:"Ошибка удаления workspace",variant:"error",description:ct(D(t))})}finally{Qe(!1)}}}const mo=r=>{if(Jt(r),r.startsWith("custom:")){const i=Qt().find(a=>`custom:${a.id}`===r);if(!i)return;if(et(i.prompt??""),i.schedule){Ze(i.schedule);const a=hi.find(J=>J.value===i.schedule);yt(a?a.value:"__custom__")}if(bt(i.retryCount??0),xt(i.retryDelay??60),wt(i.qualityGate??""),ht(i.model??""),$t(typeof i.priority=="number"?i.priority:_e),_t(Array.isArray(i.dependsOn)?i.dependsOn:[]),kt(i.beforeScript??""),St(i.afterScript??""),qe(i.triggerType==="file"?"file":i.triggerType==="mcp-event"?"mcp-event":"cron"),Ct(i.watchPath??""),zt(i.mcpEvent?.server??""),Tt(i.mcpEvent?.event??""),Pt(i.mcpEvent?.filter??""),it(i.workingDirectory??""),ke(i.workspaceId??""),nt(Array.isArray(i.allowedTools)?i.allowedTools:[]),ot(Array.isArray(i.deniedTools)?i.deniedTools:[]),i.matrix){sr(!0),At(Array.isArray(i.matrix.workspaceIds)?i.matrix.workspaceIds:[]),ar(i.matrix.strategy==="sequential"?"sequential":"parallel"),pr(i.matrix.failureMode==="stop"?"stop":"continue"),cr(i.matrix.aggregation==="per-task"?"per-task":"summary"),dr(!!i.matrix.createAggregator),ur(typeof i.matrix.concurrency=="number"?String(i.matrix.concurrency):"");const a=i.matrix.overrides;gr(a?{...a}:{})}else fr();return}const t=Ei.find(i=>i.value===r);t&&et(t.prompt)};async function yo(){if(!(Se()||"").trim()){c.toast.show({title:"Нечего сохранять",variant:"error",description:"Сначала заполните промпт — он обязателен для шаблона."});return}const r=(window.prompt("Название шаблона","")??"").trim();if(r)try{const t=await _.save_template({name:r,prompt:(Se()||"").trim(),schedule:(Xe()||"").trim(),timeoutSeconds:3600,model:(vt()||"").trim(),priority:tt(),retryCount:Qr(),retryDelay:Yr(),qualityGate:(ir()||"").trim(),beforeScript:(nr()||"").trim(),afterScript:(or()||"").trim(),dependsOn:rt(),triggerType:de(),mcpEvent:de()==="mcp-event"?{server:(Vr()||"").trim(),event:(Xr()||"").trim(),...Et().trim()?{filter:Et().trim()}:{}}:void 0,watchPath:(Kr()||"").trim(),workingDirectory:(lr()||"").trim(),workspaceId:(Ye()||"").trim()||void 0,allowedTools:F().length>0?F():void 0,deniedTools:B().length>0?B():void 0,matrix:Ji()});if(!t.success){c.toast.show({title:"Не удалось сохранить шаблон",variant:"error",description:t.error||"Неизвестная ошибка"});return}await li();const i=t.template;i?.id&&Jt(`custom:${i.id}`),c.toast.show({title:`Шаблон "${r}" сохранён`,variant:"success"})}catch(t){console.error("RPC Error (save_template):",t),c.toast.show({title:"Ошибка сохранения шаблона",variant:"error",description:D(t)})}}async function bo(r){if(window.confirm(`Удалить шаблон "${r.name}"?`))try{const t=await _.delete_template({id:r.id});if(!t.success){c.toast.show({title:"Не удалось удалить шаблон",variant:"error",description:t.error||"Неизвестная ошибка"});return}gt()===`custom:${r.id}`&&Jt("custom"),await li(),c.toast.show({title:`Шаблон "${r.name}" удалён`,variant:"success"})}catch(t){console.error("RPC Error (delete_template):",t),c.toast.show({title:"Ошибка удаления шаблона",variant:"error",description:D(t)})}}async function ue(){try{const r=await _.get_tasks({});console.log("[GUI] Received tasks:",r);const t=Array.isArray(r?.tasks)?r.tasks:[];console.log("[GUI] tasks count:",t.length);const i=t.map(a=>({name:a.name,schedule:a.schedule,status:a.status??"unknown",nextRun:a.nextRun??void 0,paused:a.status?.toLowerCase().includes("disabled"),retryCount:a.retryCount??0,retryDelay:a.retryDelay??60,qualityGate:a.qualityGate??void 0,dependsOn:Array.isArray(a.dependsOn)?a.dependsOn:void 0,model:a.model??void 0,priority:typeof a.priority=="number"?a.priority:_e,beforeScript:a.beforeScript??void 0,afterScript:a.afterScript??void 0,triggerType:a.triggerType??"cron",mcpEvent:a.mcpEvent??void 0,watchPath:a.watchPath??void 0,workingDirectory:a.workingDirectory??void 0,workspaceId:a.workspaceId??void 0,workspaceName:a.workspaceName??void 0,workspaceColor:a.workspaceColor??void 0,allowedTools:Array.isArray(a.allowedTools)?a.allowedTools:void 0,deniedTools:Array.isArray(a.deniedTools)?a.deniedTools:void 0,matrix:a.matrix??null,matrixParentId:a.matrixParentId??null,isMatrixParent:!!a.isMatrixParent,matrixSummary:a.matrixSummary??null,prompt:a.prompt??""}));Tr(i),console.log("[GUI] jobs:",Ie()),await xo()}catch(r){console.error("RPC Error (get_tasks):",r),c.toast.show({title:"Ошибка загрузки задач",variant:"error",description:ct(D(r))})}}async function xo(){try{const r=await _.get_metrics({});Fn({total:r.total??0,success:r.success??0,error:r.error??0})}catch(r){console.error("RPC Error (get_metrics):",r)}}async function vo(r){zi(r);try{const t=await _.get_history({limit:10});Bn(t.records??[])}catch(t){console.error("RPC Error (get_history):",t),c.toast.show({title:"Ошибка загрузки истории",variant:"error",description:D(t)})}}async function ho(r){ti(!0),ii(r),Ni(!0),Mt(null);try{const t=await _.dry_run({taskName:r});Mt(t)}catch(t){console.error("RPC Error (dry_run):",t),Mt({success:!1,error:D(t),tasks:[],warnings:[]})}finally{Ni(!1)}}function Yi(){ti(!1),ii(""),Mt(null)}async function $o(){Si(!0),Ut("");try{const r=await _.create_task({name:(ie()||"").trim(),schedule:(Xe()||"").trim(),prompt:(Se()||"").trim(),model:(vt()||"").trim(),priority:tt(),retryCount:Qr(),retryDelay:Yr(),qualityGate:(ir()||"").trim(),beforeScript:(nr()||"").trim(),afterScript:(or()||"").trim(),dependsOn:rt(),triggerType:de(),mcpEvent:de()==="mcp-event"?{server:(Vr()||"").trim(),event:(Xr()||"").trim(),...Et().trim()?{filter:Et().trim()}:{}}:void 0,watchPath:(Kr()||"").trim(),workingDirectory:(lr()||"").trim(),workspaceId:(Ye()||"").trim()||void 0,allowedTools:F().length>0?F():void 0,deniedTools:B().length>0?B():void 0,matrix:Ji()});if(!r.success){const t=ct(r.message);Ut(t),c.toast.show({title:"Ошибка создания задачи",variant:"error",description:t});return}await new Promise(t=>setTimeout(t,500)),await ue(),rr(""),Ze("* * * * *"),et(""),yt("* * * * *"),bt(0),xt(60),wt(""),_t([]),ht(""),$t(_e),kt(""),St(""),qe("cron"),Ct(""),zt(""),Tt(""),Pt(""),it(""),ke(""),nt([]),ot([]),fr(),tr(null),Jt("custom"),c.toast.show({title:"Задача создана",variant:"success"})}catch(r){console.error("RPC Error (create_task):",r);const t=ct(D(r));Ut(t),c.toast.show({title:"Ошибка создания задачи",variant:"error",description:t})}finally{Si(!1)}}function wo(r){const t=new Date().toISOString(),i=Ve.get(r);i&&clearInterval(i);let a=0;const J=setInterval(()=>{if(a+=1,a>900){clearInterval(J),Ve.delete(r);return}(async()=>{try{const ve=((await _.get_history({limit:50})).records??[]).find(Te=>String(Te.taskName??"").toLowerCase()===r.toLowerCase()&&typeof Te.startedAt=="string"&&Te.startedAt>=t);if(!ve)return;clearInterval(J),Ve.delete(r);const Z=ve.status==="success",lt=((Number(ve.durationMs)||0)/1e3).toFixed(1),De=ve.error?`: ${ve.error}`:"";c.toast.show({title:Z?`Задача "${r}" выполнена`:`Задача "${r}" упала`,variant:Z?"success":"error",description:`${lt}s${De}`}),await ue()}catch(j){console.error("RPC Error (get_history):",j)}})()},2e3);Ve.set(r,J)}async function _o(r){if(!r||typeof r!="string"){console.error("[GUI] run_task aborted: empty task name");return}try{const t=await _.run_task({name:r});if(!t.success){c.toast.show({title:`Не удалось запустить "${r}"`,variant:"error",description:t.message});return}c.toast.show({title:t.message||`Задача "${r}" запущена`,variant:"success"}),/уже выполняется/i.test(t.message||"")||wo(r),await ue()}catch(t){console.error("RPC Error (run_task):",t),c.toast.show({title:"Ошибка запуска",variant:"error",description:D(t)})}}async function ko(r){try{const t=await _.pause_task({name:r});if(!t.success){c.toast.show({title:`Не удалось поставить на паузу "${r}"`,variant:"error",description:t.message});return}c.toast.show({title:`Задача "${r}" поставлена на паузу`,variant:"success"}),await ue()}catch(t){console.error("RPC Error (pause_task):",t),c.toast.show({title:"Ошибка паузы",variant:"error",description:D(t)})}}async function So(r){try{const t=await _.resume_task({name:r});if(!t.success){c.toast.show({title:`Не удалось возобновить "${r}"`,variant:"error",description:t.message});return}c.toast.show({title:`Задача "${r}" возобновлена`,variant:"success"}),await ue()}catch(t){console.error("RPC Error (resume_task):",t),c.toast.show({title:"Ошибка возобновления",variant:"error",description:D(t)})}}async function Co(r){if(window.confirm(`Отменить выполняющиеся клоны матрицы "${r}"?`))try{const t=await _.cancel_matrix({name:r});if(!t.success){c.toast.show({title:"Не удалось отменить матрицу",variant:"error",description:t.message});return}c.toast.show({title:t.message,variant:"success"}),await ue()}catch(t){console.error("RPC Error (cancel_matrix):",t),c.toast.show({title:"Ошибка отмены матрицы",variant:"error",description:D(t)})}}async function zo(r){const i=Ie().find(a=>a.name===r)?.matrix?`Удалить матрицу "${r}" вместе со всеми клонами и агрегатором?`:`Удалить задачу "${r}"?`;if(window.confirm(i))try{const a=await _.delete_task({name:r});if(!a.success){c.toast.show({title:"Ошибка удаления",variant:"error",description:a.message});return}c.toast.show({title:`Задача "${r}" удалена`,variant:"success"}),Pr()===r&&(Ke(""),Ar(null)),Hr()?.name===r&&tr(null),await ue()}catch(a){console.error("RPC Error (delete_task):",a),c.toast.show({title:"Ошибка удаления",variant:"error",description:D(a)})}}async function To(r){Ar(r),Ke("Загрузка логов…");try{const t=await _.get_task_logs({name:r});if(!t.success){Ke(t.error||"Не удалось загрузить логи"),c.toast.show({title:"Ошибка чтения логов",variant:"error",description:t.error});return}Ke(t.logs||"(пусто)")}catch(t){console.error("RPC Error (get_task_logs):",t),Ke("Ошибка чтения логов: "+D(t))}}function Eo(r){tr(r),Jr(!1),rr(r.name),Ze(r.schedule),et(r.prompt??""),ht(r.model??""),$t(typeof r.priority=="number"?r.priority:_e),bt(r.retryCount??0),xt(r.retryDelay??60),wt(r.qualityGate??""),_t(Array.isArray(r.dependsOn)?r.dependsOn:[]),kt(r.beforeScript??""),St(r.afterScript??""),qe(r.triggerType??"cron"),Ct(r.watchPath??""),zt(r.mcpEvent?.server??""),Tt(r.mcpEvent?.event??""),Pt(r.mcpEvent?.filter??""),it(r.workingDirectory??""),ke(r.workspaceId??""),nt(Array.isArray(r.allowedTools)?r.allowedTools:[]),ot(Array.isArray(r.deniedTools)?r.deniedTools:[]),r.matrix?(sr(!0),At(Array.isArray(r.matrix.workspaceIds)?r.matrix.workspaceIds:[]),ar(r.matrix.strategy==="sequential"?"sequential":"parallel"),pr(r.matrix.failureMode==="stop"?"stop":"continue"),cr(r.matrix.aggregation==="per-task"?"per-task":"summary"),dr(!!r.matrix.createAggregator),ur(typeof r.matrix.concurrency=="number"?String(r.matrix.concurrency):""),gr(r.matrix.overrides?{...r.matrix.overrides}:{})):fr();const t=hi.find(i=>i.value===r.schedule);yt(t?t.value:"__custom__")}ue(),br(),Vn(),Kn(),li();const Po=setInterval(ue,5e3);p.onCleanup(()=>clearInterval(Po));const Ao=Li()==="__custom__",si=Hr()!==null,qt=()=>Ie()??[],ai=()=>{const r=Je();return r==="all"?qt():r==="none"?qt().filter(t=>!t.workspaceId):qt().filter(t=>t.workspaceId===r)},Ki=()=>{const r=(Hr()?.name??ie()).trim().toLowerCase();return qt().map(t=>t.name).filter(t=>t.trim().toLowerCase()!==r)};function Oo(r,t){_t(i=>t?i.some(a=>a.toLowerCase()===r.toLowerCase())?i:[...i,r]:i.filter(a=>a.toLowerCase()!==r.toLowerCase()))}const[Mo,Vi]=p.createSignal(null);function ze(r=!1){return`background:${r?"rgba(90,200,250,0.16)":"transparent"};border:1px solid ${r?"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:${r?"#5ac8fa":"#cfcfd2"};font-size:14px;line-height:1;padding:0;transition:background 0.18s ease, border-color 0.18s ease, color 0.18s ease`}function U(r,t,i=!1){const a=r.currentTarget;a&&(a.style.background=t?"rgba(255,255,255,0.09)":i?"rgba(90,200,250,0.16)":"transparent",a.style.borderColor=t?"#5ac8fa":i?"rgba(90,200,250,0.5)":"#333",a.style.color=t||i?"#5ac8fa":"#cfcfd2")}const Ro=r=>{const t=r.job;return!t||!t.name?null:(()=>{var i=ps(),a=i.firstChild,J=a.firstChild,j=J.firstChild,X=j.firstChild,ve=X.firstChild,Z=X.nextSibling,lt=Z.firstChild,De=lt.nextSibling,Te=De.nextSibling,Ee=Te.nextSibling;Ee.nextSibling;var xr=j.nextSibling,Pe=J.nextSibling,ge=Pe.firstChild,he=ge.nextSibling,$e=he.nextSibling,fe=$e.nextSibling,we=fe.nextSibling,je=we.nextSibling;return e.insert(ve,()=>t.name),e.insert(X,(()=>{var l=e.memo(()=>!!t.workspaceName);return()=>l()&&(()=>{var s=cs();return s.firstChild,e.insert(s,()=>t.workspaceName,null),e.effect(f=>{var E=`Workspace: ${t.workspaceName}${t.workingDirectory?` (${t.workingDirectory})`:""}`,z=`font-size:11px;font-weight:600;flex-shrink:0;cursor:help;white-space:nowrap;padding:2px 7px;border-radius:999px;border:1px solid ${t.workspaceColor||"#5ac8fa"};color:${t.workspaceColor||"#5ac8fa"};background:${t.workspaceColor||"#5ac8fa"}1a`;return E!==f.e&&e.setAttribute(s,"title",f.e=E),f.t=e.style(s,z,f.t),f},{e:void 0,t:void 0}),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!(t.isMatrixParent&&t.matrix));return()=>l()&&(()=>{var s=ds(),f=s.firstChild,E=f.nextSibling;return E.nextSibling,e.insert(s,()=>t.matrix.workspaceIds.length,E),e.insert(s,(()=>{var z=e.memo(()=>!!t.matrix.concurrency);return()=>z()?` ⚙${t.matrix.concurrency}`:""})(),null),e.effect(()=>e.setAttribute(s,"title",`Matrix fan-out: ${t.matrix.workspaceIds.length} клонов, стратегия: ${t.matrix.strategy??"parallel"}, при ошибке: ${t.matrix.failureMode??"continue"}${t.matrix.concurrency?`, одновременно: ${t.matrix.concurrency}`:""}${t.matrix.overrides?`, переопределено workspace: ${Object.keys(t.matrix.overrides).length}`:""}`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!t.matrixParentId);return()=>l()&&(()=>{var s=us();return s.firstChild,e.insert(s,()=>t.matrixParentId,null),e.effect(()=>e.setAttribute(s,"title",`Клон матрицы. Родитель: ${t.matrixParentId}`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!t.watchPath);return()=>l()&&(()=>{var s=gs();return e.effect(()=>e.setAttribute(s,"title",`Отслеживание файла: ${t.watchPath}`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!(t.beforeScript||t.afterScript));return()=>l()&&(()=>{var s=fs();return e.effect(()=>e.setAttribute(s,"title",`Lifecycle hooks: ${[t.beforeScript?`pre: ${t.beforeScript}`:"",t.afterScript?`post: ${t.afterScript}`:""].filter(Boolean).join(" · ")}`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>t.triggerType==="mcp-event");return()=>l()&&(()=>{var s=ms();return e.effect(()=>e.setAttribute(s,"title",`MCP-событие: ${t.mcpEvent?.event??"—"}${t.mcpEvent?.filter?` (фильтр: ${t.mcpEvent.filter})`:""}`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!t.model);return()=>l()&&(()=>{var s=ys();return s.firstChild,e.insert(s,()=>t.model,null),e.effect(()=>e.setAttribute(s,"title",`Модель LLM: ${t.model}`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>typeof t.priority=="number"&&t.priority!==_e);return()=>l()&&(()=>{var s=bs();return s.firstChild,e.insert(s,()=>Mn(t.priority),null),e.effect(()=>e.setAttribute(s,"title",`Приоритет: ${Mn(t.priority)} (${t.priority})`)),s})()})(),null),e.insert(X,(()=>{var l=e.memo(()=>!!(Array.isArray(t.allowedTools)&&t.allowedTools.length>0||Array.isArray(t.deniedTools)&&t.deniedTools.length>0));return()=>l()?(()=>{var s=xs();return e.effect(()=>e.setAttribute(s,"title",`Ограничения инструментов: ${[t.allowedTools?.length?`allowed=[${t.allowedTools.join(", ")}]`:"",t.deniedTools?.length?`denied=[${t.deniedTools.join(", ")}]`:""].filter(Boolean).join(" · ")}`)),s})():null})(),null),e.insert(j,(()=>{var l=e.memo(()=>!!(Array.isArray(t.dependsOn)&&t.dependsOn.length>0));return()=>l()&&(()=>{var s=vs(),f=s.firstChild;return f.firstChild,e.insert(f,()=>t.dependsOn.join(" + "),null),s})()})(),Z),e.insert(j,(()=>{var l=e.memo(()=>!!(t.isMatrixParent&&t.matrixSummary));return()=>l()&&(()=>{var s=hs(),f=s.firstChild,E=f.firstChild,z=E.nextSibling,R=z.nextSibling,x=R.nextSibling;return x.nextSibling,e.insert(f,()=>t.matrixSummary.successCount,z),e.insert(f,()=>t.matrixSummary.totalCount,x),e.insert(f,(()=>{var m=e.memo(()=>t.matrixSummary.errorCount>0);return()=>m()?` · ❌ ${t.matrixSummary.errorCount}`:""})(),null),e.insert(f,(()=>{var m=e.memo(()=>t.matrixSummary.pendingCount>0);return()=>m()?` · ⏳ ${t.matrixSummary.pendingCount}`:""})(),null),e.effect(m=>{var k=t.matrixSummary.message,H=`cursor:help;color:${Ua(t.matrixSummary.status)};white-space:nowrap;overflow:hidden;text-overflow:ellipsis`;return k!==m.e&&e.setAttribute(f,"title",m.e=k),m.t=e.style(f,H,m.t),m},{e:void 0,t:void 0}),s})()})(),Z),e.insert(Z,()=>Or().total,De),e.insert(Z,()=>Or().success,Ee),e.insert(Z,()=>Or().error,null),e.insert(j,(()=>{var l=e.memo(()=>!!(t.schedule||t.nextRun));return()=>l()&&(()=>{var s=$s(),f=s.firstChild;return e.insert(f,()=>t.schedule),e.insert(s,(()=>{var E=e.memo(()=>!!t.nextRun);return()=>E()&&(()=>{var z=ws();return z.firstChild,e.insert(z,()=>t.nextRun,null),z})()})(),null),s})()})(),null),e.insert(xr,(()=>{var l=e.memo(()=>t.status==="running");return()=>l()?(()=>{var s=_s(),f=s.firstChild,E=f.nextSibling;return E.nextSibling,e.insert(s,Wn,E),s})():(()=>{var s=ks();return e.insert(s,(()=>{var f=e.memo(()=>t.status==="success");return()=>f()?"🟢 Готова":e.memo(()=>t.status==="error")()?"🔴 Ошибка":t.status==="partial"?"🟠 Частично":"⚪ Пауза"})()),s})()})()),ge.addEventListener("mouseleave",l=>{U(l,!1),Vi(s=>s===t.name?null:s)}),ge.addEventListener("mouseenter",l=>{U(l,!0),ce()&&Vi(t.name)}),ge.$$click=()=>{_o(t.name)},e.insert(ge,()=>ce()&&Mo()===t.name?"❄️":"▶"),he.addEventListener("mouseleave",l=>U(l,!1)),he.addEventListener("mouseenter",l=>U(l,!0)),he.$$click=()=>{t.paused?So(t.name):ko(t.name)},e.insert(he,()=>t.paused?"▶":"⏸"),$e.addEventListener("mouseleave",l=>U(l,!1)),$e.addEventListener("mouseenter",l=>U(l,!0)),$e.$$click=()=>{To(t.name)},fe.addEventListener("mouseleave",l=>U(l,!1,Ot()&&Rt()===t.name)),fe.addEventListener("mouseenter",l=>U(l,!0,Ot()&&Rt()===t.name)),fe.$$click=()=>{ho(t.name)},we.addEventListener("mouseleave",l=>U(l,!1,Ht()===t.name)),we.addEventListener("mouseenter",l=>U(l,!0,Ht()===t.name)),we.$$click=()=>{vo(t.name)},je.addEventListener("mouseleave",l=>U(l,!1)),je.addEventListener("mouseenter",l=>U(l,!0)),je.$$click=()=>{Eo(t)},e.insert(Pe,(()=>{var l=e.memo(()=>!!t.matrix);return()=>l()&&(()=>{var s=Ss();return s.addEventListener("mouseleave",f=>U(f,!1)),s.addEventListener("mouseenter",f=>U(f,!0)),s.$$click=()=>{Co(t.name)},e.effect(f=>{var E=`Отменить выполняющиеся клоны матрицы "${t.name}"`,z=ze();return E!==f.e&&e.setAttribute(s,"title",f.e=E),f.t=e.style(s,z,f.t),f},{e:void 0,t:void 0}),s})()})(),null),e.insert(Pe,(()=>{var l=e.memo(()=>!t.matrixParentId);return()=>l()&&(()=>{var s=Cs();return s.addEventListener("mouseleave",f=>U(f,!1)),s.addEventListener("mouseenter",f=>U(f,!0)),s.$$click=()=>{zo(t.name)},e.effect(f=>{var E=t.matrix?`Удалить матрицу "${t.name}" вместе с клонами`:`Удалить "${t.name}"`,z=ze();return E!==f.e&&e.setAttribute(s,"title",f.e=E),f.t=e.style(s,z,f.t),f},{e:void 0,t:void 0}),s})()})(),null),e.insert(i,(()=>{var l=e.memo(()=>Ht()===t.name);return()=>l()&&(()=>{var s=zs(),f=s.firstChild,E=f.firstChild,z=E.nextSibling;return z.addEventListener("mouseleave",R=>{R.target.style.color="#8e8e93"}),z.addEventListener("mouseenter",R=>{R.target.style.color="#ffffff"}),z.$$click=()=>zi(null),e.insert(s,(()=>{var R=e.memo(()=>Ti().length===0);return()=>R()?Ts():Ti().map(x=>(()=>{var m=Es(),k=m.firstChild,H=k.nextSibling,se=H.nextSibling,Ae=se.firstChild;return e.insert(k,()=>new Date(x.startedAt).toLocaleString()),e.insert(H,()=>x.status==="success"?"✅ Успех":"❌ Ошибка"),e.insert(se,()=>x.durationMs,Ae),e.insert(m,(()=>{var A=e.memo(()=>!!x.model);return()=>A()&&(()=>{var $=Ps();return $.firstChild,e.insert($,()=>x.model,null),e.effect(()=>e.setAttribute($,"title",`Модель: ${x.model}`)),$})()})(),null),e.insert(m,(()=>{var A=e.memo(()=>!!(x.preFlightStatus&&x.preFlightStatus!=="skipped"));return()=>A()&&(()=>{var $=As();return $.firstChild,e.insert($,()=>x.preFlightStatus==="success"?"✅":"❌",null),e.effect(O=>{var T=`Pre-flight: ${x.preFlightStatus}`,v=x.preFlightStatus==="success"?"#34c759":"#ff3b30";return T!==O.e&&e.setAttribute($,"title",O.e=T),v!==O.t&&e.setStyleProperty($,"color",O.t=v),O},{e:void 0,t:void 0}),$})()})(),null),e.insert(m,(()=>{var A=e.memo(()=>!!(x.postFlightStatus&&x.postFlightStatus!=="skipped"));return()=>A()&&(()=>{var $=Os();return $.firstChild,e.insert($,()=>x.postFlightStatus==="success"?"✅":"❌",null),e.effect(O=>{var T=`Post-flight: ${x.postFlightStatus}`,v=x.postFlightStatus==="success"?"#34c759":"#ff3b30";return T!==O.e&&e.setAttribute($,"title",O.e=T),v!==O.t&&e.setStyleProperty($,"color",O.t=v),O},{e:void 0,t:void 0}),$})()})(),null),e.insert(m,(()=>{var A=e.memo(()=>!!x.error);return()=>A()&&(()=>{var $=Ms();return e.insert($,()=>x.error),$})()})(),null),e.insert(m,(()=>{var A=e.memo(()=>!!x.nextTask);return()=>A()&&(()=>{var $=Rs();return $.firstChild,e.insert($,()=>x.nextTask,null),$})()})(),null),e.effect(A=>{var $=x.startedAt+x.durationMs,O=x.status==="success"?"#34c759":"#ff3b30";return $!==A.e&&e.setAttribute(m,"key",A.e=$),O!==A.t&&e.setStyleProperty(H,"color",A.t=O),A},{e:void 0,t:void 0}),m})())})(),null),s})()})(),null),e.insert(i,(()=>{var l=e.memo(()=>!!(Ot()&&Rt()===t.name));return()=>l()&&(()=>{var s=Is(),f=s.firstChild,E=f.firstChild,z=E.nextSibling;return e.insert(f,()=>t.name,z),z.addEventListener("mouseleave",R=>{R.target.style.color="#8e8e93"}),z.addEventListener("mouseenter",R=>{R.target.style.color="#ffffff"}),z.$$click=()=>Yi(),e.insert(s,(()=>{var R=e.memo(()=>!!ri());return()=>R()&&Ls()})(),null),e.insert(s,(()=>{var R=e.memo(()=>!!(!ri()&&N()&&!N().success));return()=>R()&&(()=>{var x=qs();return x.firstChild,e.insert(x,()=>N().error??"Симуляция не удалась",null),x})()})(),null),e.insert(s,(()=>{var R=e.memo(()=>!!(!ri()&&N()&&N().success));return()=>R()&&(()=>{var x=Ds();return e.insert(x,(()=>{var m=e.memo(()=>!!(Array.isArray(N().warnings)&&N().warnings.length>0));return()=>m()&&(()=>{var k=js();return k.firstChild,e.insert(k,()=>N().warnings.map(H=>`· ${H}`).join(" | "),null),k})()})(),null),e.insert(x,()=>N().tasks.map(m=>(()=>{var k=Gs(),H=k.firstChild,se=H.firstChild,Ae=se.nextSibling;Ae.nextSibling;var A=H.nextSibling;A.firstChild;var $=A.nextSibling;$.firstChild;var O=$.nextSibling;return O.firstChild,e.insert(H,()=>(m.order??0)+1,Ae),e.insert(H,()=>m.trigger,null),e.insert(A,()=>m.name,null),e.insert(k,(()=>{var T=e.memo(()=>!!m.workspace);return()=>T()&&(()=>{var v=Fs();return v.firstChild,e.insert(v,()=>m.workspace.name,null),v})()})(),$),e.insert(k,(()=>{var T=e.memo(()=>!!m.matrixParent);return()=>T()&&(()=>{var v=Bs();return v.firstChild,e.insert(v,()=>m.matrixParent,null),v})()})(),$),e.insert($,()=>m.cwd||"(папка проекта)",null),e.insert(k,(()=>{var T=e.memo(()=>!!m.roleScoped);return()=>T()&&(()=>{var v=Ns();return e.effect(()=>e.setAttribute(v,"title",`allowed=[${(m.roleScoped.allowed??[]).join(", ")}] · denied=[${(m.roleScoped.denied??[]).join(", ")}]`)),v})()})(),O),e.insert(k,(()=>{var T=e.memo(()=>m.estimatedDurationSec!=null);return()=>T()&&(()=>{var v=Ws(),u=v.firstChild,d=u.nextSibling;return d.nextSibling,e.insert(v,()=>m.estimatedDurationSec,d),v})()})(),O),e.insert(k,(()=>{var T=e.memo(()=>m.estimatedTokens!=null);return()=>T()&&(()=>{var v=Us(),u=v.firstChild,d=u.nextSibling;return d.nextSibling,e.insert(v,()=>m.estimatedTokens,d),v})()})(),O),e.insert(k,(()=>{var T=e.memo(()=>m.estimatedCostUsd!=null);return()=>T()&&(()=>{var v=Hs();return v.firstChild,e.insert(v,()=>Number(m.estimatedCostUsd).toFixed(4),null),v})()})(),O),e.insert(O,()=>m.command,null),e.insert(k,(()=>{var T=e.memo(()=>!!m.preFlight);return()=>T()&&(()=>{var v=Js();return v.firstChild,e.insert(v,()=>m.preFlight,null),v})()})(),null),e.insert(k,(()=>{var T=e.memo(()=>!!m.postFlight);return()=>T()&&(()=>{var v=Qs();return v.firstChild,e.insert(v,()=>m.postFlight,null),v})()})(),null),e.insert(k,(()=>{var T=e.memo(()=>!!m.qualityGate);return()=>T()&&(()=>{var v=Ys();return v.firstChild,e.insert(v,()=>m.qualityGate,null),v})()})(),null),e.effect(()=>e.setAttribute(k,"key",`${m.name}-${m.order}`)),k})()),null),e.insert(x,(()=>{var m=e.memo(()=>!!(N().totals&&(N().totals.estimatedDurationSec!=null||N().totals.estimatedTokens!=null)));return()=>m()&&(()=>{var k=Ks();return k.firstChild,e.insert(k,()=>(N().totals.estimatedDurationSec??"—")+" с · "+(N().totals.estimatedTokens??"—")+" токенов"+(N().totals.estimatedCostUsd!=null?` · ~$${Number(N().totals.estimatedCostUsd).toFixed(4)}`:""),null),k})()})(),null),x})()})(),null),s})()})(),null),e.effect(l=>{var s=`background:#252526;border-radius:10px;padding:16px;margin-bottom:12px;display:flex;flex-direction:column;gap:10px;border:1px solid ${ce()?"rgba(135, 206, 250, 0.4)":"#333"}`,f=`Запустить "${t.name}"`,E=ze(),z=t.paused?`Возобновить "${t.name}"`:`Поставить на паузу "${t.name}"`,R=ze(),x=`Логи "${t.name}"`,m=ze(),k=`Dry-Run симуляция "${t.name}"`,H=ze(Ot()&&Rt()===t.name),se=`История "${t.name}"`,Ae=ze(Ht()===t.name),A=`Редактировать "${t.name}"`,$=ze();return l.e=e.style(i,s,l.e),f!==l.t&&e.setAttribute(ge,"title",l.t=f),l.a=e.style(ge,E,l.a),z!==l.o&&e.setAttribute(he,"title",l.o=z),l.i=e.style(he,R,l.i),x!==l.n&&e.setAttribute($e,"title",l.n=x),l.s=e.style($e,m,l.s),k!==l.h&&e.setAttribute(fe,"title",l.h=k),l.r=e.style(fe,H,l.r),se!==l.d&&e.setAttribute(we,"title",l.d=se),l.l=e.style(we,Ae,l.l),A!==l.u&&e.setAttribute(je,"title",l.u=A),l.c=e.style(je,$,l.c),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0}),i})()};try{return c.add(bi.Panel,{id:"scheduler-jobs",region:"side",list:()=>[{id:"jobs",title:"Планировщик",pinned:!0}],render:()=>e.createComponent(p.ErrorBoundary,{fallback:r=>(()=>{var t=An(),i=t.firstChild;return e.insert(t,()=>r.message,null),t})(),get children(){var r=Vs(),t=r.firstChild,i=t.firstChild,a=i.firstChild,J=i.nextSibling,j=J.firstChild,X=j.firstChild,ve=X.nextSibling,Z=j.nextSibling,lt=Z.nextSibling,De=lt.firstChild,Te=t.nextSibling,Ee=Te.firstChild,xr=Ee.nextSibling,Pe=xr.nextSibling,ge=Te.nextSibling,he=ge.firstChild,$e=he.nextSibling,fe=ge.nextSibling,we=fe.firstChild,je=we.firstChild,l=je.nextSibling,s=l.firstChild,f=fe.nextSibling,E=f.firstChild,z=E.firstChild,R=z.nextSibling,x=R.firstChild,m=x.nextSibling,k=f.nextSibling,H=k.firstChild,se=H.firstChild,Ae=se.firstChild,A=Ae.nextSibling,$=A.nextSibling,O=se.nextSibling,T=k.nextSibling,v=T.firstChild;return e.insert(a,(()=>{var u=e.memo(()=>!!ce());return()=>u()?`❄️ ${Ur()} ❄️`:Ur()})()),j.addEventListener("change",u=>ki(u.currentTarget.value)),e.insert(j,()=>ee().map(u=>(()=>{var d=On(),C=d.firstChild;return e.insert(d,()=>u.name,null),e.effect(()=>e.setAttribute(d,"key",u.id)),e.effect(()=>d.value=u.id),d})()),ve),Z.addEventListener("mouseleave",u=>{const d=u.currentTarget;d.style.borderColor="#333",d.style.background="#1e1e1e",d.style.color="#e0e0e0"}),Z.addEventListener("mouseenter",u=>{const d=u.currentTarget;d.style.borderColor="#5ac8fa",d.style.background="rgba(90,200,250,0.12)",d.style.color="#5ac8fa"}),Z.$$click=async()=>{const u=window.open("","_blank");let d=3782;try{const h=await _.get_dashboard_port({});h&&typeof h.port=="number"&&h.port>0&&(d=h.port)}catch(h){console.warn("[scheduler] Не удалось получить порт дашборда:",h)}const C="http://localhost:"+d;u?u.location.href=C:window.open(C,"_blank")},De.addEventListener("change",u=>{ro(u.currentTarget.checked)}),Ee.$$click=po,e.insert(Ee,()=>mr()?"Экспорт...":"Экспорт"),xr.addEventListener("change",co),Pe.$$click=()=>document.querySelector('input[type="file"]')?.click(),e.insert(Pe,()=>yr()?"Импорт...":"Импорт"),$e.addEventListener("change",u=>to(Number(u.currentTarget.value)||1)),we.$$click=()=>Jn(!Gr()),e.insert(l,(()=>{var u=e.memo(()=>!!be());return()=>u()?Lr()?"только ошибки":"все запуски":"выключены"})(),s),e.insert(s,()=>Gr()?"▾":"▴"),e.insert(fe,(()=>{var u=e.memo(()=>!Gr());return()=>u()&&(()=>{var d=Xs(),C=d.firstChild,h=C.firstChild,W=C.nextSibling,I=W.firstChild,G=W.nextSibling,L=G.firstChild,q=L.firstChild,Q=L.nextSibling,ne=G.nextSibling,Y=ne.firstChild;return h.addEventListener("change",b=>{Ir(b.currentTarget.checked),mt()}),I.addEventListener("change",b=>{qr(b.currentTarget.checked),mt()}),q.addEventListener("change",b=>{Dr(b.currentTarget.checked),mt()}),Q.addEventListener("change",()=>{mt()}),Q.$$input=b=>jr(b.currentTarget.value),Y.$$click=()=>{eo()},e.insert(Y,()=>Yt()?"Отправка...":"🧪 Тестовое уведомление"),e.effect(b=>{var Oe=`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${be()?1:.5}`,me=!be(),Ge=`display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;opacity:${be()?1:.5}`,Fe=!be(),K=!be()||!Le(),st=`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:${be()&&Le()?1:.5}`,Me=Yt()||!Le(),Be=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${Yt()||!Le()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${Yt()||!Le()?.6:1}`;return b.e=e.style(W,Oe,b.e),me!==b.t&&(I.disabled=b.t=me),b.a=e.style(L,Ge,b.a),Fe!==b.o&&(q.disabled=b.o=Fe),K!==b.i&&(Q.disabled=b.i=K),b.n=e.style(Q,st,b.n),Me!==b.s&&(Y.disabled=b.s=Me),b.h=e.style(Y,Be,b.h),b},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e.effect(()=>h.checked=be()),e.effect(()=>I.checked=Lr()),e.effect(()=>q.checked=Le()),e.effect(()=>Q.value=Pi()||""),d})()})(),null),E.$$click=()=>Qn(!Wr()),e.insert(R,(()=>{var u=e.memo(()=>Kt()>0);return()=>u()?`старше ${Kt()} дн.`:"без срока"})(),x),e.insert(R,(()=>{var u=e.memo(()=>Xt()>0);return()=>u()?`до ${Xt()} записей`:"без лимита"})(),m),e.insert(m,()=>Wr()?"▾":"▴"),e.insert(f,(()=>{var u=e.memo(()=>!Wr());return()=>u()&&(()=>{var d=Zs(),C=d.firstChild,h=C.firstChild,W=h.nextSibling,I=C.nextSibling,G=I.firstChild,L=G.nextSibling,q=I.nextSibling,Q=q.firstChild,ne=q.nextSibling,Y=ne.firstChild;return W.addEventListener("change",b=>{Vt(Math.max(0,Math.floor(Number(b.currentTarget.value)||0))),Ii()}),L.addEventListener("change",b=>{Zt(Math.max(0,Math.floor(Number(b.currentTarget.value)||0))),Ii()}),e.insert(q,(()=>{var b=e.memo(()=>!!Fr());return()=>b()?`${new Date(Fr()).toLocaleString()} · удалено ${Oi()}`:"ещё не выполнялась"})(),null),Y.$$click=()=>{Zn()},e.insert(Y,()=>er()?"Очистка...":"🧹 Очистить сейчас"),e.effect(b=>{var Oe=er(),me=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${er()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${er()?.6:1}`;return Oe!==b.e&&(Y.disabled=b.e=Oe),b.t=e.style(Y,me,b.t),b},{e:void 0,t:void 0}),e.effect(()=>W.value=Kt()),e.effect(()=>L.value=Xt()),d})()})(),null),se.$$click=()=>jn(!Er()),e.insert(A,()=>ee().length),e.insert($,()=>Er()?"▾":"▴"),O.$$click=()=>{uo()},e.insert(k,(()=>{var u=e.memo(()=>!Er());return()=>u()&&(()=>{var d=ea();return e.insert(d,(()=>{var C=e.memo(()=>ee().length===0);return()=>C()?ta():ee().map(h=>(()=>{var W=ra(),I=W.firstChild,G=I.nextSibling,L=G.firstChild,q=L.firstChild,Q=L.nextSibling,ne=Q.nextSibling,Y=ne.firstChild,b=Y.nextSibling,Oe=b.nextSibling,me=G.nextSibling,Ge=me.firstChild,Fe=Ge.nextSibling;return e.insert(L,()=>h.name,null),e.insert(Q,()=>h.path),e.insert(ne,()=>h.gitBranch||"—",b),e.insert(ne,()=>h.gitRemote||"remote не задан",null),Ge.$$click=()=>{go(h)},Fe.$$click=()=>{fo(h)},e.effect(K=>{var st=`width:9px;height:9px;border-radius:50%;background:${h.color||"#5ac8fa"};flex-shrink:0`,Me=h.path,Be=dt(),vr=dt();return K.e=e.style(I,st,K.e),Me!==K.t&&e.setAttribute(Q,"title",K.t=Me),Be!==K.a&&(Ge.disabled=K.a=Be),vr!==K.o&&(Fe.disabled=K.o=vr),K},{e:void 0,t:void 0,a:void 0,o:void 0}),W})())})()),d})()})(),null),e.insert(r,(()=>{var u=e.memo(()=>!!io());return()=>u()?(()=>{var d=ia();return d.addEventListener("mouseleave",C=>{const h=C.currentTarget;h.style.borderColor="#3a3a3a",h.style.background="#1e1e1e"}),d.addEventListener("mouseenter",C=>{const h=C.currentTarget;h.style.borderColor="#5ac8fa",h.style.background="#232326"}),d.$$click=()=>Jr(!1),d})():(()=>{var d=na(),C=d.firstChild,h=C.firstChild,W=h.nextSibling,I=W.firstChild,G=I.nextSibling,L=C.nextSibling,q=L.firstChild,Q=q.firstChild,ne=q.nextSibling,Y=L.nextSibling,b=Y.firstChild,Oe=b.nextSibling,me=Y.nextSibling,Ge=me.firstChild,Fe=Ge.nextSibling,K=Fe.firstChild,st=K.firstChild,Me=K.nextSibling,Be=Me.firstChild,vr=Me.nextSibling,Xi=vr.firstChild,Ne=me.nextSibling,Io=Ne.firstChild,pi=Io.nextSibling,Zi=Ne.nextSibling,Lo=Zi.firstChild,en=Lo.nextSibling,ci=Zi.nextSibling,qo=ci.firstChild,hr=qo.nextSibling,tn=ci.nextSibling,Do=tn.firstChild,rn=Do.nextSibling,nn=tn.nextSibling,jo=nn.firstChild,$r=jo.nextSibling,on=nn.nextSibling,Go=on.firstChild,ln=Go.nextSibling,sn=on.nextSibling,Fo=sn.firstChild,an=Fo.nextSibling,pn=sn.nextSibling,Bo=pn.firstChild,cn=Bo.nextSibling,dn=pn.nextSibling,No=dn.firstChild,un=No.nextSibling,gn=dn.nextSibling,Wo=gn.firstChild,fn=Wo.nextSibling,mn=gn.nextSibling,Uo=mn.firstChild,Ho=Uo.nextSibling,yn=mn.nextSibling,di=yn.firstChild,Ka=di.firstChild,bn=di.nextSibling,Jo=bn.firstChild,Qo=Jo.nextSibling,xn=Qo.nextSibling,Yo=xn.nextSibling,vn=Yo.nextSibling,Ko=vn.nextSibling,ui=Ko.firstChild,hn=ui.nextSibling,Vo=hn.nextSibling,$n=yn.nextSibling,wn=$n.firstChild,wr=wn.nextSibling;return e.insert(h,si?"Редактирование задачи":"Новая задача"),I.addEventListener("mouseleave",o=>{const n=o.currentTarget;n.style.color="#a0a0a6",n.style.borderColor="#333"}),I.addEventListener("mouseenter",o=>{const n=o.currentTarget;n.style.color="#5ac8fa",n.style.borderColor="#5ac8fa"}),I.$$click=yo,G.addEventListener("mouseleave",o=>{const n=o.currentTarget;n.style.color="#a0a0a6",n.style.borderColor="#333"}),G.addEventListener("mouseenter",o=>{const n=o.currentTarget;n.style.color="#5ac8fa",n.style.borderColor="#5ac8fa"}),G.$$click=()=>Jr(!0),Q.addEventListener("change",o=>{const n=o.currentTarget.checked;sr(n),n&&(ke(""),xe().length===0&&At(ee().map(y=>y.id)))}),e.insert(L,(()=>{var o=e.memo(()=>!!Ce());return()=>o()&&(()=>{var n=oa(),y=n.firstChild,g=y.firstChild,w=g.firstChild,S=y.nextSibling,P=S.firstChild,te=P.firstChild,Re=te.nextSibling,Dt=P.nextSibling,We=Dt.firstChild,jt=We.nextSibling,re=Dt.nextSibling,M=re.firstChild,ye=M.nextSibling,Ue=S.nextSibling,_r=Ue.firstChild,Gt=Ue.nextSibling,_n=Gt.firstChild,gi=_n.nextSibling,kn=Gt.nextSibling;return e.insert(g,()=>xe().length,null),e.insert(y,(()=>{var V=e.memo(()=>ee().length===0);return()=>V()?la():(()=>{var oe=sa();return e.insert(oe,()=>ee().map(ae=>(()=>{var at=aa(),pt=at.firstChild,le=pt.nextSibling,Ft=le.firstChild,He=le.nextSibling;return pt.addEventListener("change",kr=>no(ae.id,kr.currentTarget.checked)),e.insert(le,()=>ae.name,null),e.insert(He,()=>ae.path),e.effect(kr=>e.style(le,`color:${ae.color||"#5ac8fa"}`,kr)),e.effect(()=>pt.checked=xe().includes(ae.id)),at})())),oe})()})(),null),Re.addEventListener("change",V=>ar(V.currentTarget.value==="sequential"?"sequential":"parallel")),jt.addEventListener("change",V=>pr(V.currentTarget.value==="stop"?"stop":"continue")),ye.addEventListener("change",V=>cr(V.currentTarget.value==="per-task"?"per-task":"summary")),_r.addEventListener("change",V=>dr(V.currentTarget.checked)),gi.$$input=V=>ur(V.currentTarget.value),e.insert(n,(()=>{var V=e.memo(()=>xe().length>0);return()=>V()&&(()=>{var oe=pa(),ae=oe.firstChild,at=ae.firstChild,pt=ae.nextSibling;return e.insert(ae,oo,null),e.insert(pt,()=>xe().map(le=>{const Ft=ee().find(Sr=>Sr.id===le);if(!Ft)return null;const He=ei()[le]??{},kr="padding:6px;background:#1e1e1e;border:1px solid #333;border-radius:6px;color:#fff;font-size:12px;outline:none;box-sizing:border-box";return(()=>{var Sr=ca(),Cr=Sr.firstChild,Xo=Cr.firstChild,Sn=Xo.nextSibling,Zo=Cr.nextSibling,fi=Zo.firstChild,Cn=fi.nextSibling,mi=Cn.firstChild,zn=mi.nextSibling,el=Cn.nextSibling,yi=el.firstChild,Tn=yi.nextSibling;return e.insert(Cr,()=>Ft.name,Sn),e.insert(Sn,()=>ni(ie(),Ft.name)),fi.$$input=pe=>It(le,"prompt",pe.currentTarget.value),mi.$$input=pe=>It(le,"model",pe.currentTarget.value),zn.$$input=pe=>It(le,"qualityGate",pe.currentTarget.value),yi.$$input=pe=>It(le,"beforeScript",pe.currentTarget.value),Tn.$$input=pe=>It(le,"afterScript",pe.currentTarget.value),e.effect(pe=>e.style(Cr,`font-size:12px;font-weight:600;margin-bottom:6px;color:${Ft.color||"#5ac8fa"}`,pe)),e.effect(()=>fi.value=He.prompt??""),e.effect(()=>mi.value=He.model??""),e.effect(()=>zn.value=He.qualityGate??""),e.effect(()=>yi.value=He.beforeScript??""),e.effect(()=>Tn.value=He.afterScript??""),Sr})()})),oe})()})(),kn),e.insert(kn,(()=>{var V=e.memo(()=>oi().length>0);return()=>V()?[(()=>{var oe=da(),ae=oe.firstChild,at=ae.nextSibling,pt=at.nextSibling;return e.insert(oe,()=>oi().length,at),oe})(),(()=>{var oe=ua();return e.insert(oe,()=>oi().join(", ")),oe})()]:ga()})()),e.effect(()=>e.setAttribute(gi,"placeholder",Zr()==="sequential"?"1 (sequential)":"без лимита")),e.effect(()=>Re.value=Zr()),e.effect(()=>jt.value=ji()),e.effect(()=>ye.value=Gi()),e.effect(()=>_r.checked=Fi()),e.effect(()=>gi.value=Bi()),n})()})(),null),e.insert(d,(()=>{var o=e.memo(()=>!Ce());return()=>o()&&(()=>{var n=fa(),y=n.firstChild,g=y.nextSibling,w=g.firstChild;return g.addEventListener("change",S=>{ke(S.currentTarget.value),S.currentTarget.value&&it("")}),e.insert(g,()=>ee().map(S=>(()=>{var P=On(),te=P.firstChild;return e.insert(P,()=>S.name,null),e.effect(()=>e.setAttribute(P,"key",S.id)),e.effect(()=>P.value=S.id),P})()),null),e.insert(n,(()=>{var S=e.memo(()=>!!Lt());return()=>S()&&(()=>{var P=ma(),te=P.firstChild,Re=te.firstChild,Dt=Re.nextSibling,We=te.nextSibling,jt=We.firstChild,re=jt.nextSibling,M=We.nextSibling,ye=M.firstChild,Ue=ye.nextSibling;return e.insert(Dt,()=>Lt().path),e.insert(re,()=>Lt().gitBranch||"—"),e.insert(Ue,()=>Lt().gitRemote||"—"),P})()})(),null),e.effect(()=>g.value=Ye()),n})()})(),Y),Oe.$$input=o=>rr(o.currentTarget.value),e.insert(d,(()=>{var o=e.memo(()=>!Ye()&&!Ce());return()=>o()&&(()=>{var n=ya(),y=n.firstChild,g=y.nextSibling;return g.$$input=w=>it(w.currentTarget.value),e.effect(()=>g.value=lr()||""),n})()})(),me),st.addEventListener("change",()=>qe("cron")),Be.addEventListener("change",()=>qe("file")),Xi.addEventListener("change",()=>qe("mcp-event")),e.insert(d,(()=>{var o=e.memo(()=>de()==="file");return()=>o()&&(()=>{var n=ba(),y=n.firstChild,g=y.nextSibling;return g.$$input=w=>Ct(w.currentTarget.value),e.effect(()=>g.value=Kr()||""),n})()})(),Ne),e.insert(d,(()=>{var o=e.memo(()=>de()==="mcp-event");return()=>o()&&[(()=>{var n=xa(),y=n.firstChild,g=y.nextSibling;return g.$$input=w=>zt(w.currentTarget.value),e.effect(()=>g.value=Vr()||""),n})(),(()=>{var n=va(),y=n.firstChild,g=y.nextSibling;return g.$$input=w=>Tt(w.currentTarget.value),e.effect(()=>g.value=Xr()||""),n})(),(()=>{var n=ha(),y=n.firstChild,g=y.nextSibling;return g.$$input=w=>Pt(w.currentTarget.value),e.effect(()=>g.value=Et()||""),n})()]})(),Ne),pi.addEventListener("change",o=>{const n=o.currentTarget.value;yt(n),n!=="__custom__"&&Ze(n)}),e.insert(pi,()=>hi.map(o=>(()=>{var n=zr();return e.insert(n,()=>o.label),e.effect(()=>e.setAttribute(n,"key",o.value)),e.effect(()=>n.value=o.value),n})())),e.insert(Ne,Ao&&(()=>{var o=$a(),n=o.firstChild,y=n.nextSibling;return y.$$input=g=>Ze(g.currentTarget.value),e.effect(()=>y.value=Xe()||""),o})(),null),e.insert(Ne,(()=>{var o=e.memo(()=>!!Ci());return()=>o()&&(()=>{var n=wa();return e.insert(n,Ci),n})()})(),null),en.$$input=o=>et(o.currentTarget.value),hr.addEventListener("change",o=>mo(o.currentTarget.value)),e.insert(hr,()=>Ei.map(o=>(()=>{var n=zr();return e.insert(n,()=>o.label),e.effect(()=>e.setAttribute(n,"key",o.value)),e.effect(()=>n.value=o.value),n})()),null),e.insert(hr,()=>Qt().map(o=>(()=>{var n=zr();return e.insert(n,()=>o.name),e.effect(()=>e.setAttribute(n,"key",o.id)),e.effect(()=>n.value=`custom:${o.id}`),n})()),null),e.insert(ci,(()=>{var o=e.memo(()=>!!gt().startsWith("custom:"));return()=>o()&&(()=>{var n=_a(),y=n.firstChild,g=y.nextSibling;return e.insert(n,()=>Qt().map(w=>`custom:${w.id}`!==gt()?null:(()=>{var S=ka();return e.insert(S,()=>w.name),e.effect(()=>e.setAttribute(S,"key",w.id)),S})()),g),g.addEventListener("mouseleave",w=>{w.currentTarget.style.color="#ff3b30"}),g.addEventListener("mouseenter",w=>{w.currentTarget.style.color="#c92a2a"}),g.$$click=()=>{const w=Qt().find(S=>`custom:${S.id}`===gt());w&&bo(w)},n})()})(),null),rn.$$input=o=>ht(o.currentTarget.value),$r.addEventListener("change",o=>$t(Number(o.currentTarget.value)||_e)),e.insert($r,()=>Rn.map(o=>(()=>{var n=zr();return e.insert(n,()=>o.label),e.effect(()=>e.setAttribute(n,"key",o.value)),e.effect(()=>n.value=String(o.value)),n})()),null),e.insert($r,(()=>{var o=e.memo(()=>!Rn.some(n=>n.value===tt()));return()=>o()&&(()=>{var n=Sa(),y=n.firstChild,g=y.nextSibling,w=g.nextSibling;return e.insert(n,tt,g),e.effect(()=>n.value=String(tt())),n})()})(),null),ln.$$input=o=>bt(Number(o.currentTarget.value)||0),an.$$input=o=>xt(Number(o.currentTarget.value)||60),cn.$$input=o=>wt(o.currentTarget.value),un.$$input=o=>kt(o.currentTarget.value),fn.$$input=o=>St(o.currentTarget.value),e.insert(Ho,(()=>{var o=e.memo(()=>Ki().length===0);return()=>o()?Ca():Ki().map(n=>(()=>{var y=vi(),g=y.firstChild;return g.addEventListener("change",w=>Oo(n,w.currentTarget.checked)),e.insert(y,n,null),e.effect(w=>e.style(y,`display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:14px;border:1px solid ${rt().includes(n)?"#5ac8fa":"#333"};background:${rt().includes(n)?"rgba(90,200,250,0.12)":"transparent"};color:${rt().includes(n)?"#5ac8fa":"#cfcfd2"};font-size:12px;cursor:pointer;user-select:none`,w)),e.effect(()=>g.checked=rt().includes(n)),y})())})()),e.insert(di,(()=>{var o=e.memo(()=>F().length>0||B().length>0);return()=>o()&&(()=>{var n=za(),y=n.firstChild,g=y.nextSibling,w=g.nextSibling,S=w.nextSibling,P=S.nextSibling;return e.insert(n,()=>F().length,g),e.insert(n,()=>B().length,S),n})()})(),null),e.insert(xn,()=>Wi.map(o=>(()=>{var n=vi(),y=n.firstChild;return y.addEventListener("change",()=>Ui("allowed",o)),e.insert(n,o,null),e.effect(g=>e.style(n,`display:flex;align-items:center;gap:5px;padding:4px 9px;border-radius:12px;border:1px solid ${F().includes(o)?"#34c759":"#333"};background:${F().includes(o)?"rgba(52,199,89,0.12)":"transparent"};color:${F().includes(o)?"#34c759":"#cfcfd2"};font-size:11px;cursor:pointer;user-select:none`,g)),e.effect(()=>y.checked=F().includes(o)),n})())),e.insert(vn,()=>Wi.map(o=>(()=>{var n=vi(),y=n.firstChild;return y.addEventListener("change",()=>Ui("denied",o)),e.insert(n,o,null),e.effect(g=>e.style(n,`display:flex;align-items:center;gap:5px;padding:4px 9px;border-radius:12px;border:1px solid ${B().includes(o)?"#ff3b30":"#333"};background:${B().includes(o)?"rgba(255,59,48,0.12)":"transparent"};color:${B().includes(o)?"#ff3b30":"#cfcfd2"};font-size:11px;cursor:pointer;user-select:none`,g)),e.effect(()=>y.checked=B().includes(o)),n})())),ui.$$input=o=>Di(o.currentTarget.value),hn.$$click=()=>Hi("allowed"),Vo.$$click=()=>Hi("denied"),e.insert(bn,(()=>{var o=e.memo(()=>F().length>0||B().length>0);return()=>o()&&(()=>{var n=Ta();return e.insert(n,(()=>{var y=e.memo(()=>F().length>0);return()=>y()&&(()=>{var g=Ea(),w=g.firstChild,S=w.nextSibling,P=S.nextSibling;return e.insert(g,()=>F().join(", "),S),g})()})(),null),e.insert(n,(()=>{var y=e.memo(()=>B().length>0);return()=>y()&&(()=>{var g=Pa(),w=g.firstChild,S=w.nextSibling,P=S.nextSibling;return e.insert(g,()=>B().join(", "),S),g})()})(),null),n})()})(),null),wn.$$click=()=>{ii("(форма)");const o={order:0,trigger:"manual",command:lo(),roleScoped:F().length>0||B().length>0?{allowed:F(),denied:B()}:null,preFlight:(nr()||"").trim()||null,postFlight:(or()||"").trim()||null,qualityGate:(ir()||"").trim()||null},n=xe().map(y=>ee().find(g=>g.id===y)).filter(y=>!!y).map((y,g)=>({...o,name:ni(ie(),y.name),order:g,cwd:y.path,matrixParent:ie()||"(без имени)"}));Mt({tasks:Ce()?n:[{...o,name:ie()||"(без имени)",cwd:Lt()?.path||(lr()||"").trim()||"(папка проекта)"}],totals:{},warnings:[...ie().trim()?[]:["Не указано имя — превью локальное (форма не сохранена)."],...Ce()?[`Matrix: будет создано ${n.length} клон(а/ов) по workspace; родитель сам не выполняется.`]:[]]}),ti(!0)},wr.$$click=$o,e.insert(wr,()=>ut()?"Создание...":si?"Сохранить":"Создать задачу"),e.insert($n,si&&(()=>{var o=Aa();return o.$$click=()=>{tr(null),rr(""),Ze("* * * * *"),et(""),ht(""),$t(_e),bt(0),xt(60),wt(""),_t([]),kt(""),St(""),qe("cron"),Ct(""),zt(""),Tt(""),Pt(""),it(""),ke(""),nt([]),ot([]),fr(),yt("* * * * *"),Ut("")},o})(),null),e.insert(d,(()=>{var o=e.memo(()=>!!(Ot()&&Rt()==="(форма)"));return()=>o()&&(()=>{var n=Oa(),y=n.firstChild,g=y.firstChild,w=g.nextSibling;return w.$$click=()=>Yi(),e.insert(n,()=>{const S=N();if(!S)return null;const P=S.tasks?.[0];return(()=>{var te=Ma(),Re=te.firstChild,Dt=Re.firstChild,We=Re.nextSibling,jt=We.firstChild;return e.insert(Re,()=>P?.command,null),e.insert(We,()=>P?.cwd,null),e.insert(te,(()=>{var re=e.memo(()=>!!P?.roleScoped);return()=>re()&&(()=>{var M=Ra(),ye=M.firstChild,Ue=ye.nextSibling,_r=Ue.nextSibling,Gt=_r.nextSibling,_n=Gt.nextSibling;return e.insert(M,()=>(P.roleScoped.allowed??[]).join(", "),Ue),e.insert(M,()=>(P.roleScoped.denied??[]).join(", "),Gt),M})()})(),null),e.insert(te,(()=>{var re=e.memo(()=>!!P?.preFlight);return()=>re()&&(()=>{var M=Ia(),ye=M.firstChild;return e.insert(M,()=>P.preFlight,null),M})()})(),null),e.insert(te,(()=>{var re=e.memo(()=>!!P?.postFlight);return()=>re()&&(()=>{var M=La(),ye=M.firstChild;return e.insert(M,()=>P.postFlight,null),M})()})(),null),e.insert(te,(()=>{var re=e.memo(()=>!!P?.qualityGate);return()=>re()&&(()=>{var M=qa(),ye=M.firstChild;return e.insert(M,()=>P.qualityGate,null),M})()})(),null),e.insert(te,(()=>{var re=e.memo(()=>!!(Array.isArray(S.warnings)&&S.warnings.length>0));return()=>re()&&(()=>{var M=Da(),ye=M.firstChild;return e.insert(M,()=>S.warnings.join(" | "),null),M})()})(),null),te})()},null),n})()})(),null),e.effect(o=>{var n=de()!=="cron"?"none":"block",y=ut()||!(ie()||"").trim()||!(Xe()||"").trim()||!(Se()||"").trim()||Ce()&&xe().length===0,g=`display:block;width:100%;padding:10px;margin-top:8px;background:${ut()?"#666":"#007acc"};color:white;border-radius:6px;border:none;cursor:${ut()||!(ie()||"").trim()||!(Xe()||"").trim()||!(Se()||"").trim()?"not-allowed":"pointer"};font-size:13px;font-weight:500;opacity:${ut()||!(ie()||"").trim()||!(Xe()||"").trim()||!(Se()||"").trim()?.6:1}`;return n!==o.e&&e.setStyleProperty(Ne,"display",o.e=n),y!==o.t&&(wr.disabled=o.t=y),o.a=e.style(wr,g,o.a),o},{e:void 0,t:void 0,a:void 0}),e.effect(()=>Q.checked=Ce()),e.effect(()=>Oe.value=ie()||""),e.effect(()=>st.checked=de()==="cron"),e.effect(()=>Be.checked=de()==="file"),e.effect(()=>Xi.checked=de()==="mcp-event"),e.effect(()=>pi.value=Li()),e.effect(()=>en.value=Se()||""),e.effect(()=>hr.value=gt()),e.effect(()=>rn.value=vt()||""),e.effect(()=>$r.value=String(tt())),e.effect(()=>ln.value=Qr()),e.effect(()=>an.value=Yr()),e.effect(()=>cn.value=ir()||""),e.effect(()=>un.value=nr()||""),e.effect(()=>fn.value=or()||""),e.effect(()=>ui.value=qi()),d})()})(),T),e.insert(T,(()=>{var u=e.memo(()=>Je()!=="all");return()=>u()&&(()=>{var d=ja(),C=d.firstChild,h=C.nextSibling,W=h.nextSibling,I=W.nextSibling,G=I.nextSibling;return e.insert(d,(()=>{var L=e.memo(()=>Je()==="none");return()=>L()?"без workspace":`📦 ${ee().find(q=>q.id===Je())?.name??"workspace"}`})(),h),e.insert(d,()=>ai().length,I),e.insert(d,()=>qt().length,null),d})()})(),null),e.insert(T,(()=>{var u=e.memo(()=>ai().length===0);return()=>u()?(()=>{var d=Ga(),C=d.firstChild,h=C.nextSibling;return e.insert(C,()=>ce()?"🎄":"📅"),e.insert(h,()=>ce()?"Задач пока нет. Самое время украсить ёлку!":"Нет активных задач. Создайте первую и доверьте рутину ИИ!"),d})():(()=>{var d=Fa();return e.insert(d,()=>ai().map(C=>e.createComponent(Ro,{get key(){return C.name},job:C}))),d})()})(),null),e.insert(r,(()=>{var u=e.memo(()=>!!Pr());return()=>u()&&(()=>{var d=Ba(),C=d.firstChild,h=C.firstChild,W=h.firstChild,I=W.nextSibling,G=h.nextSibling,L=C.nextSibling;return e.insert(I,Pr),G.addEventListener("mouseleave",q=>{q.target.style.color="#8e8e93"}),G.addEventListener("mouseenter",q=>{q.target.style.color="#ff3b30"}),G.$$click=()=>{Ar(null),Ke("")},e.insert(L,()=>Gn().split(`
|
|
2
|
+
`).map((q,Q)=>(()=>{var ne=Na();return e.setAttribute(ne,"key",Q),e.insert(ne,q),ne})())),d})()})(),null),e.effect(u=>{var d=`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:${ce()?"linear-gradient(180deg, #0f172a 0%, #000000 100%)":"#0f0f0f"}`,C=`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 ${ce()?"rgba(135, 206, 250, 0.5)":"#333"};background:${ce()?"rgba(135, 206, 250, 0.12)":"#1e1e1e"};color:#e0e0e0`,h=mr(),W=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${mr()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${mr()?.6:1};transition:background 0.18s ease`,I=yr(),G=`padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:${yr()?"not-allowed":"pointer"};font-size:12px;font-weight:500;opacity:${yr()?.6:1};transition:background 0.18s ease`,L=dt(),q=`padding:5px 10px;border-radius:6px;border:1px solid #333;background:#252526;color:${dt()?"#666":"#5ac8fa"};font-size:11px;font-weight:600;cursor:${dt()?"not-allowed":"pointer"}`;return u.e=e.style(r,d,u.e),u.t=e.style(lt,C,u.t),h!==u.a&&(Ee.disabled=u.a=h),u.o=e.style(Ee,W,u.o),I!==u.i&&(Pe.disabled=u.i=I),u.n=e.style(Pe,G,u.n),L!==u.s&&(O.disabled=u.s=L),u.h=e.style(O,q,u.h),u},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e.effect(()=>j.value=Je()),e.effect(()=>De.checked=ce()),e.effect(()=>$e.value=Hn()),r}})})}catch(r){return console.error("GUI render error:",r),c.add(bi.Panel,{id:"scheduler-jobs",region:"side",list:()=>[{id:"jobs",title:"Планировщик",pinned:!0}],render:()=>e.createComponent(p.ErrorBoundary,{fallback:t=>(()=>{var i=An();return i.firstChild,e.insert(i,()=>t.message,null),i})(),get children(){var t=Wa(),i=t.firstChild;return e.insert(i,Ur),t}})})}}});e.delegateEvents(["click","input"]);exports.default=Ha;
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './dist/index.js';
|