opencode-windows-scheduler 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/CROSS_PLATFORM.md +113 -0
- package/LICENSE +21 -0
- package/README.md +173 -2
- package/README.ru.md +131 -0
- package/ROADMAP-STRATEGY.md +217 -0
- package/ROADMAP.md +87 -0
- package/dist/core/cron-to-schtasks.d.ts +20 -0
- package/dist/core/cron-to-schtasks.d.ts.map +1 -0
- package/dist/core/cron-to-schtasks.js +233 -0
- package/dist/core/dry-run.d.ts +44 -0
- package/dist/core/dry-run.d.ts.map +1 -0
- package/dist/core/dry-run.js +252 -0
- package/dist/core/file-watcher.d.ts +31 -0
- package/dist/core/file-watcher.d.ts.map +1 -0
- package/dist/core/file-watcher.js +128 -0
- package/dist/core/lock.d.ts +43 -0
- package/dist/core/lock.d.ts.map +1 -0
- package/dist/core/lock.js +118 -0
- package/dist/core/matrix.d.ts +167 -0
- package/dist/core/matrix.d.ts.map +1 -0
- package/dist/core/matrix.js +687 -0
- package/dist/core/ps-wrapper.d.ts +60 -0
- package/dist/core/ps-wrapper.d.ts.map +1 -0
- package/dist/core/ps-wrapper.js +538 -0
- package/dist/core/record-history.d.ts +14 -0
- package/dist/core/record-history.d.ts.map +1 -0
- package/dist/core/record-history.js +360 -0
- package/dist/core/scheduler/index.d.ts +20 -0
- package/dist/core/scheduler/index.d.ts.map +1 -0
- package/dist/core/scheduler/index.js +32 -0
- package/dist/core/scheduler/linux.d.ts +32 -0
- package/dist/core/scheduler/linux.d.ts.map +1 -0
- package/dist/core/scheduler/linux.js +115 -0
- package/dist/core/scheduler/logs.d.ts +11 -0
- package/dist/core/scheduler/logs.d.ts.map +1 -0
- package/dist/core/scheduler/logs.js +34 -0
- package/dist/core/scheduler/mac.d.ts +39 -0
- package/dist/core/scheduler/mac.d.ts.map +1 -0
- package/dist/core/scheduler/mac.js +175 -0
- package/dist/core/scheduler/posix.d.ts +40 -0
- package/dist/core/scheduler/posix.d.ts.map +1 -0
- package/dist/core/scheduler/posix.js +86 -0
- package/dist/core/scheduler/registry.d.ts +36 -0
- package/dist/core/scheduler/registry.d.ts.map +1 -0
- package/dist/core/scheduler/registry.js +56 -0
- package/dist/core/scheduler/types.d.ts +63 -0
- package/dist/core/scheduler/types.d.ts.map +1 -0
- package/dist/core/scheduler/types.js +1 -0
- package/dist/core/scheduler/windows.d.ts +47 -0
- package/dist/core/scheduler/windows.d.ts.map +1 -0
- package/dist/core/scheduler/windows.js +375 -0
- package/dist/core/wrappers/bash.d.ts +58 -0
- package/dist/core/wrappers/bash.d.ts.map +1 -0
- package/dist/core/wrappers/bash.js +223 -0
- package/dist/db/history-repo.d.ts +69 -0
- package/dist/db/history-repo.d.ts.map +1 -0
- package/dist/db/history-repo.js +150 -0
- package/dist/db/index.d.ts +47 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +120 -0
- package/dist/db/metrics-repo.d.ts +43 -0
- package/dist/db/metrics-repo.d.ts.map +1 -0
- package/dist/db/metrics-repo.js +95 -0
- package/dist/db/migrate.d.ts +24 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +237 -0
- package/dist/db/recovery.d.ts +11 -0
- package/dist/db/recovery.d.ts.map +1 -0
- package/dist/db/recovery.js +38 -0
- package/dist/db/schema.d.ts +24 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +97 -0
- package/dist/db/settings-repo.d.ts +8 -0
- package/dist/db/settings-repo.d.ts.map +1 -0
- package/dist/db/settings-repo.js +27 -0
- package/dist/db/tasks-repo.d.ts +26 -0
- package/dist/db/tasks-repo.d.ts.map +1 -0
- package/dist/db/tasks-repo.js +120 -0
- package/dist/db/templates-repo.d.ts +17 -0
- package/dist/db/templates-repo.d.ts.map +1 -0
- package/dist/db/templates-repo.js +57 -0
- package/dist/gui-experimental.cjs +1 -0
- package/dist/history.d.ts +53 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +57 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2077 -0
- package/dist/notifications.d.ts +45 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +135 -0
- package/dist/rpc.d.ts +2052 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +863 -0
- package/dist/schtasks.d.ts +32 -0
- package/dist/schtasks.d.ts.map +1 -0
- package/dist/schtasks.js +45 -0
- package/dist/server.d.ts +106 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1478 -0
- package/dist/settings.d.ts +43 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +96 -0
- package/dist/shared/jobs-view.d.ts +21 -0
- package/dist/shared/jobs-view.d.ts.map +1 -0
- package/dist/shared/jobs-view.js +28 -0
- package/dist/skill.d.ts +15 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +93 -0
- package/dist/task-transfer.d.ts +176 -0
- package/dist/task-transfer.d.ts.map +1 -0
- package/dist/task-transfer.js +442 -0
- package/dist/templates.d.ts +57 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +16 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +88 -0
- package/dist/workspaces.d.ts +55 -0
- package/dist/workspaces.d.ts.map +1 -0
- package/dist/workspaces.js +183 -0
- package/docs/ARCHITECTURE.md +302 -0
- package/docs/FEATURES.md +288 -0
- package/docs/MIGRATION.md +266 -0
- package/docs/dashboard.png +0 -0
- package/gui-experimental.cjs +2 -0
- package/index.js +1 -0
- package/package.json +92 -4
- package/scripts/demo-dashboard.mjs +199 -0
- package/skills/scheduled-job-best-practices/SKILL.md +155 -0
- package/skills/scheduled-job-best-practices/references/recipes.md +123 -0
- package/src/core/cron-to-schtasks.ts +269 -0
- package/src/core/dry-run.ts +315 -0
- package/src/core/file-watcher.ts +171 -0
- package/src/core/lock.ts +134 -0
- package/src/core/matrix.ts +907 -0
- package/src/core/ps-wrapper.ts +572 -0
- package/src/core/record-history.ts +493 -0
- package/src/core/scheduler/index.ts +44 -0
- package/src/core/scheduler/linux.ts +125 -0
- package/src/core/scheduler/logs.ts +37 -0
- package/src/core/scheduler/mac.ts +222 -0
- package/src/core/scheduler/posix.ts +111 -0
- package/src/core/scheduler/registry.ts +93 -0
- package/src/core/scheduler/types.ts +67 -0
- package/src/core/scheduler/windows.ts +469 -0
- package/src/core/wrappers/bash.ts +282 -0
- package/src/db/history-repo.ts +303 -0
- package/src/db/index.ts +166 -0
- package/src/db/metrics-repo.ts +158 -0
- package/src/db/migrate.ts +322 -0
- package/src/db/recovery.ts +46 -0
- package/src/db/schema.ts +109 -0
- package/src/db/settings-repo.ts +31 -0
- package/src/db/tasks-repo.ts +162 -0
- package/src/db/templates-repo.ts +77 -0
- package/src/gui.tsx +2725 -0
- package/src/history.ts +107 -0
- package/src/index.ts +2672 -0
- package/src/notifications.ts +174 -0
- package/src/rpc.ts +933 -0
- package/src/schtasks.ts +75 -0
- package/src/server.ts +1663 -0
- package/src/settings.ts +157 -0
- package/src/shared/jobs-view.ts +38 -0
- package/src/skill.ts +113 -0
- package/src/task-transfer.ts +648 -0
- package/src/templates.ts +67 -0
- package/src/tui.tsx +46 -0
- package/src/types.ts +145 -0
- package/src/workspaces.ts +236 -0
package/src/rpc.ts
ADDED
|
@@ -0,0 +1,933 @@
|
|
|
1
|
+
import { Rpc } from "@opencode/plugin/rpc"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Общее определение RPC-контракта между серверной частью плагина (src/index.ts)
|
|
5
|
+
* и GUI-панелью (src/gui.tsx).
|
|
6
|
+
*
|
|
7
|
+
* Сервер регистрирует обработчики через ctx.rpc.register(SchedulerRpc, handlers).
|
|
8
|
+
* GUI вызывает методы через ctx.client.rpc(SchedulerRpc).<имя>(аргументы).
|
|
9
|
+
*
|
|
10
|
+
* Схемы ввода/вывода — чистый JSON Schema (не Zod), чтобы сервер мог
|
|
11
|
+
* надёжно кодировать/декодировать ответы через RPC-мост.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Параметры MCP-события (triggerType === "mcp-event"). */
|
|
15
|
+
const McpEventSchema = {
|
|
16
|
+
type: ["object", "null"] as const,
|
|
17
|
+
properties: {
|
|
18
|
+
server: { type: "string" },
|
|
19
|
+
event: { type: "string" },
|
|
20
|
+
filter: { type: "string" },
|
|
21
|
+
},
|
|
22
|
+
required: ["server", "event"],
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
/** Настройки matrix (fan-out, Спринт 15). */
|
|
26
|
+
const MatrixSchema = {
|
|
27
|
+
type: ["object", "null"] as const,
|
|
28
|
+
properties: {
|
|
29
|
+
workspaceIds: { type: "array", items: { type: "string" } },
|
|
30
|
+
strategy: { type: ["string", "null"] },
|
|
31
|
+
failureMode: { type: ["string", "null"] },
|
|
32
|
+
aggregation: { type: ["string", "null"] },
|
|
33
|
+
createAggregator: { type: ["boolean", "null"] },
|
|
34
|
+
/** Лимит одновременных клонов матрицы (Спринт 17). */
|
|
35
|
+
concurrency: { type: ["number", "null"] },
|
|
36
|
+
/** Per-workspace переопределения промпта/модели/хуков/QG (Спринт 17). */
|
|
37
|
+
overrides: {
|
|
38
|
+
type: ["object", "null"],
|
|
39
|
+
additionalProperties: {
|
|
40
|
+
type: "object",
|
|
41
|
+
properties: {
|
|
42
|
+
prompt: { type: ["string", "null"] },
|
|
43
|
+
model: { type: ["string", "null"] },
|
|
44
|
+
qualityGate: { type: ["string", "null"] },
|
|
45
|
+
beforeScript: { type: ["string", "null"] },
|
|
46
|
+
afterScript: { type: ["string", "null"] },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
required: ["workspaceIds"],
|
|
52
|
+
} as const;
|
|
53
|
+
|
|
54
|
+
/** Запись задачи, возвращаемая get_tasks. */
|
|
55
|
+
const TaskItem = {
|
|
56
|
+
type: "object" as const,
|
|
57
|
+
properties: {
|
|
58
|
+
name: { type: "string" },
|
|
59
|
+
schedule: { type: "string" },
|
|
60
|
+
status: { type: "string" },
|
|
61
|
+
nextRun: { type: ["string", "null"] },
|
|
62
|
+
/** LLM-модель задачи (null — модель OpenCode по умолчанию). */
|
|
63
|
+
model: { type: ["string", "null"] },
|
|
64
|
+
/** Приоритет задачи 0..10 (10 — наивысший). */
|
|
65
|
+
priority: { type: ["number", "null"] },
|
|
66
|
+
/** Количество повторов при ошибке (опционально). */
|
|
67
|
+
retryCount: { type: ["number", "null"] },
|
|
68
|
+
/** Задержка перед повтором в секундах (опционально). */
|
|
69
|
+
retryDelay: { type: ["number", "null"] },
|
|
70
|
+
/** Проверочная команда после успешного ответа ИИ. */
|
|
71
|
+
qualityGate: { type: ["string", "null"] },
|
|
72
|
+
/** Задача, запускаемая при успехе. */
|
|
73
|
+
nextTaskOnSuccess: { type: ["string", "null"] },
|
|
74
|
+
/** Компенсирующая задача, запускаемая при ошибке. */
|
|
75
|
+
nextTaskOnError: { type: ["string", "null"] },
|
|
76
|
+
/** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
|
|
77
|
+
dependsOn: { type: "array", items: { type: "string" } },
|
|
78
|
+
/** Промпт задачи (для заполнения формы редактирования). */
|
|
79
|
+
prompt: { type: "string" },
|
|
80
|
+
/** Pre-flight команда (null — не задана). */
|
|
81
|
+
beforeScript: { type: ["string", "null"] },
|
|
82
|
+
/** Post-flight команда (null — не задана). */
|
|
83
|
+
afterScript: { type: ["string", "null"] },
|
|
84
|
+
/** Тип триггера: "cron" (по умолчанию), "file" или "mcp-event". */
|
|
85
|
+
triggerType: { type: ["string", "null"] },
|
|
86
|
+
/** Параметры MCP-события (null — не MCP-триггер). */
|
|
87
|
+
mcpEvent: McpEventSchema,
|
|
88
|
+
/** Путь к файлу/папке для файлового триггера. */
|
|
89
|
+
watchPath: { type: ["string", "null"] },
|
|
90
|
+
/** Рабочая директория задачи (null — папка проекта по умолчанию). */
|
|
91
|
+
workingDirectory: { type: ["string", "null"] },
|
|
92
|
+
/** Привязка к multi-repo workspace (null — без workspace). */
|
|
93
|
+
workspaceId: { type: ["string", "null"] },
|
|
94
|
+
/** Имя workspace для отображения (null — без workspace). */
|
|
95
|
+
workspaceName: { type: ["string", "null"] },
|
|
96
|
+
/** Цвет маркера workspace. */
|
|
97
|
+
workspaceColor: { type: ["string", "null"] },
|
|
98
|
+
/** Белый список инструментов задачи (role-scoped, null — без ограничений). */
|
|
99
|
+
allowedTools: { type: ["array", "null"], items: { type: "string" } },
|
|
100
|
+
/** Чёрный список инструментов задачи (приоритет над allowedTools). */
|
|
101
|
+
deniedTools: { type: ["array", "null"], items: { type: "string" } },
|
|
102
|
+
/** Matrix-настройки родителя (null — обычная задача). */
|
|
103
|
+
matrix: MatrixSchema,
|
|
104
|
+
/** Для клона матрицы — имя родителя (null — не клон). */
|
|
105
|
+
matrixParentId: { type: ["string", "null"] },
|
|
106
|
+
/** true — задача является родителем матрицы. */
|
|
107
|
+
isMatrixParent: { type: "boolean" },
|
|
108
|
+
/** Агрегат по клонам для родителя (null — не матрица). */
|
|
109
|
+
matrixSummary: {
|
|
110
|
+
type: ["object", "null"],
|
|
111
|
+
properties: {
|
|
112
|
+
totalCount: { type: "number" },
|
|
113
|
+
successCount: { type: "number" },
|
|
114
|
+
errorCount: { type: "number" },
|
|
115
|
+
pendingCount: { type: "number" },
|
|
116
|
+
status: { type: "string" },
|
|
117
|
+
message: { type: "string" },
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
required: ["name", "schedule", "status"],
|
|
122
|
+
} as const;
|
|
123
|
+
|
|
124
|
+
const GetTasksInput = {
|
|
125
|
+
type: "object" as const,
|
|
126
|
+
properties: {},
|
|
127
|
+
additionalProperties: false,
|
|
128
|
+
} as const;
|
|
129
|
+
|
|
130
|
+
const GetTasksOutput = {
|
|
131
|
+
type: "object" as const,
|
|
132
|
+
properties: {
|
|
133
|
+
tasks: {
|
|
134
|
+
type: "array",
|
|
135
|
+
items: TaskItem,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
required: ["tasks"],
|
|
139
|
+
} as const;
|
|
140
|
+
|
|
141
|
+
const CreateTaskInput = {
|
|
142
|
+
type: "object" as const,
|
|
143
|
+
properties: {
|
|
144
|
+
name: { type: "string" },
|
|
145
|
+
schedule: { type: "string" },
|
|
146
|
+
prompt: { type: "string" },
|
|
147
|
+
/** LLM-модель (например, anthropic/claude-3-5-sonnet). */
|
|
148
|
+
model: { type: "string" },
|
|
149
|
+
/** Приоритет задачи 0..10 (10 — наивысший). */
|
|
150
|
+
priority: { type: "number" },
|
|
151
|
+
/** Сколько раз повторять при ошибке (по умолчанию 0). */
|
|
152
|
+
retryCount: { type: "number" },
|
|
153
|
+
/** Задержка перед повтором в секундах (по умолчанию 60). */
|
|
154
|
+
retryDelay: { type: "number" },
|
|
155
|
+
/** Проверочная команда (Quality Gate), выполняется после успешного ответа ИИ. */
|
|
156
|
+
qualityGate: { type: "string" },
|
|
157
|
+
/** Имя задачи, запускаемой при успехе. */
|
|
158
|
+
nextTaskOnSuccess: { type: "string" },
|
|
159
|
+
/** Имя компенсирующей задачи, запускаемой при ошибке. */
|
|
160
|
+
nextTaskOnError: { type: "string" },
|
|
161
|
+
/** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
|
|
162
|
+
dependsOn: { type: "array", items: { type: "string" } },
|
|
163
|
+
/** Команда перед запуском (pre-flight). */
|
|
164
|
+
beforeScript: { type: "string" },
|
|
165
|
+
/** Команда после запуска (post-flight). */
|
|
166
|
+
afterScript: { type: "string" },
|
|
167
|
+
/** Тип триггера: "cron" (по умолчанию), "file" или "mcp-event". */
|
|
168
|
+
triggerType: { type: "string" },
|
|
169
|
+
/** Параметры MCP-события. */
|
|
170
|
+
mcpEvent: McpEventSchema,
|
|
171
|
+
/** Путь к файлу/папке для файлового триггера. */
|
|
172
|
+
watchPath: { type: "string" },
|
|
173
|
+
/** Привязка к multi-repo workspace. */
|
|
174
|
+
workspaceId: { type: "string" },
|
|
175
|
+
/** Рабочая директория задачи (по умолчанию — папка проекта). */
|
|
176
|
+
workingDirectory: { type: "string" },
|
|
177
|
+
/** Белый список инструментов задачи (role-scoped, metadata-only). Пустой массив запрещён. */
|
|
178
|
+
allowedTools: { type: "array", items: { type: "string" } },
|
|
179
|
+
/** Чёрный список инструментов задачи (приоритет над allowedTools). Metadata-only. */
|
|
180
|
+
deniedTools: { type: "array", items: { type: "string" } },
|
|
181
|
+
/** Matrix (fan-out): раскладывает задачу-шаблон на клоны по workspace. */
|
|
182
|
+
matrix: MatrixSchema,
|
|
183
|
+
},
|
|
184
|
+
required: ["name", "schedule", "prompt"],
|
|
185
|
+
} as const;
|
|
186
|
+
|
|
187
|
+
const CreateTaskOutput = {
|
|
188
|
+
type: "object" as const,
|
|
189
|
+
properties: {
|
|
190
|
+
success: { type: "boolean" },
|
|
191
|
+
message: { type: "string" },
|
|
192
|
+
},
|
|
193
|
+
required: ["success", "message"],
|
|
194
|
+
} as const;
|
|
195
|
+
|
|
196
|
+
const NameOnly = {
|
|
197
|
+
type: "object" as const,
|
|
198
|
+
properties: {
|
|
199
|
+
name: { type: "string" },
|
|
200
|
+
},
|
|
201
|
+
required: ["name"],
|
|
202
|
+
} as const;
|
|
203
|
+
|
|
204
|
+
const DeleteTaskInput = NameOnly;
|
|
205
|
+
const RunTaskInput = NameOnly;
|
|
206
|
+
|
|
207
|
+
const DeleteTaskOutput = {
|
|
208
|
+
type: "object" as const,
|
|
209
|
+
properties: {
|
|
210
|
+
success: { type: "boolean" },
|
|
211
|
+
message: { type: "string" },
|
|
212
|
+
},
|
|
213
|
+
required: ["success", "message"],
|
|
214
|
+
} as const;
|
|
215
|
+
|
|
216
|
+
const RunTaskOutput = DeleteTaskOutput;
|
|
217
|
+
|
|
218
|
+
const GetTaskLogsInput = NameOnly;
|
|
219
|
+
|
|
220
|
+
const GetTaskLogsOutput = {
|
|
221
|
+
type: "object" as const,
|
|
222
|
+
properties: {
|
|
223
|
+
success: { type: "boolean" },
|
|
224
|
+
logs: { type: "string" },
|
|
225
|
+
error: { type: "string" },
|
|
226
|
+
},
|
|
227
|
+
required: ["success", "logs"],
|
|
228
|
+
} as const;
|
|
229
|
+
|
|
230
|
+
const HistoryRecord = {
|
|
231
|
+
type: "object" as const,
|
|
232
|
+
properties: {
|
|
233
|
+
taskName: { type: "string" },
|
|
234
|
+
status: { type: "string" },
|
|
235
|
+
startedAt: { type: "string" },
|
|
236
|
+
finishedAt: { type: "string" },
|
|
237
|
+
durationMs: { type: "number" },
|
|
238
|
+
error: { type: ["string", "null"] },
|
|
239
|
+
nextTask: { type: ["string", "null"] },
|
|
240
|
+
/** LLM-модель, использованная в запуске. */
|
|
241
|
+
model: { type: ["string", "null"] },
|
|
242
|
+
/** Итог pre-flight: success / error / skipped. */
|
|
243
|
+
preFlightStatus: { type: ["string", "null"] },
|
|
244
|
+
/** Итог post-flight: success / error / skipped. */
|
|
245
|
+
postFlightStatus: { type: ["string", "null"] },
|
|
246
|
+
/** Ограничения инструментов, действовавшие на момент запуска. */
|
|
247
|
+
allowedTools: { type: ["array", "null"], items: { type: "string" } },
|
|
248
|
+
deniedTools: { type: ["array", "null"], items: { type: "string" } },
|
|
249
|
+
},
|
|
250
|
+
required: ["taskName", "status", "startedAt", "finishedAt", "durationMs", "error"],
|
|
251
|
+
} as const;
|
|
252
|
+
|
|
253
|
+
const GetHistoryInput = {
|
|
254
|
+
type: "object" as const,
|
|
255
|
+
properties: {
|
|
256
|
+
limit: { type: "number" },
|
|
257
|
+
},
|
|
258
|
+
additionalProperties: false,
|
|
259
|
+
} as const;
|
|
260
|
+
|
|
261
|
+
const GetHistoryOutput = {
|
|
262
|
+
type: "object" as const,
|
|
263
|
+
properties: {
|
|
264
|
+
records: {
|
|
265
|
+
type: "array",
|
|
266
|
+
items: HistoryRecord,
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
required: ["records"],
|
|
270
|
+
} as const;
|
|
271
|
+
|
|
272
|
+
const Metrics = {
|
|
273
|
+
type: "object" as const,
|
|
274
|
+
properties: {
|
|
275
|
+
total: { type: "number" },
|
|
276
|
+
success: { type: "number" },
|
|
277
|
+
error: { type: "number" },
|
|
278
|
+
},
|
|
279
|
+
required: ["total", "success", "error"],
|
|
280
|
+
} as const;
|
|
281
|
+
|
|
282
|
+
const GetMetricsInput = {
|
|
283
|
+
type: "object" as const,
|
|
284
|
+
properties: {},
|
|
285
|
+
additionalProperties: false,
|
|
286
|
+
} as const;
|
|
287
|
+
|
|
288
|
+
const GetMetricsOutput = Metrics;
|
|
289
|
+
|
|
290
|
+
const GetDashboardPortInput = {
|
|
291
|
+
type: "object" as const,
|
|
292
|
+
properties: {},
|
|
293
|
+
additionalProperties: false,
|
|
294
|
+
} as const;
|
|
295
|
+
|
|
296
|
+
const GetDashboardPortOutput = {
|
|
297
|
+
type: "object" as const,
|
|
298
|
+
properties: {
|
|
299
|
+
/** Фактический порт дашборда (null, если сервер ещё не поднялся). */
|
|
300
|
+
port: { type: ["number", "null"] },
|
|
301
|
+
},
|
|
302
|
+
required: ["port"],
|
|
303
|
+
} as const;
|
|
304
|
+
|
|
305
|
+
const GetPlatformInput = {
|
|
306
|
+
type: "object" as const,
|
|
307
|
+
properties: {},
|
|
308
|
+
additionalProperties: false,
|
|
309
|
+
} as const;
|
|
310
|
+
|
|
311
|
+
const GetPlatformOutput = {
|
|
312
|
+
type: "object" as const,
|
|
313
|
+
properties: {
|
|
314
|
+
/** process.platform: 'win32' | 'darwin' | 'linux' | ... */
|
|
315
|
+
platform: { type: "string" },
|
|
316
|
+
/** Название планировщика для заголовка GUI. */
|
|
317
|
+
title: { type: "string" },
|
|
318
|
+
},
|
|
319
|
+
required: ["platform", "title"],
|
|
320
|
+
} as const;
|
|
321
|
+
|
|
322
|
+
const ExportTasksInput = {
|
|
323
|
+
type: "object" as const,
|
|
324
|
+
properties: {},
|
|
325
|
+
additionalProperties: false,
|
|
326
|
+
} as const;
|
|
327
|
+
|
|
328
|
+
const ExportTasksOutput = {
|
|
329
|
+
type: "object" as const,
|
|
330
|
+
properties: {
|
|
331
|
+
success: { type: "boolean" },
|
|
332
|
+
data: { type: "string" },
|
|
333
|
+
count: { type: "number" },
|
|
334
|
+
error: { type: "string" },
|
|
335
|
+
},
|
|
336
|
+
required: ["success"],
|
|
337
|
+
} as const;
|
|
338
|
+
|
|
339
|
+
const ImportTasksInput = {
|
|
340
|
+
type: "object" as const,
|
|
341
|
+
properties: {
|
|
342
|
+
data: { type: "string" },
|
|
343
|
+
},
|
|
344
|
+
required: ["data"],
|
|
345
|
+
} as const;
|
|
346
|
+
|
|
347
|
+
const ImportTasksOutput = {
|
|
348
|
+
type: "object" as const,
|
|
349
|
+
properties: {
|
|
350
|
+
success: { type: "boolean" },
|
|
351
|
+
imported: { type: "number" },
|
|
352
|
+
errors: { type: "array", items: { type: "string" } },
|
|
353
|
+
error: { type: "string" },
|
|
354
|
+
},
|
|
355
|
+
required: ["success"],
|
|
356
|
+
} as const;
|
|
357
|
+
|
|
358
|
+
const GetSettingsInput = {
|
|
359
|
+
type: "object" as const,
|
|
360
|
+
properties: {},
|
|
361
|
+
additionalProperties: false,
|
|
362
|
+
} as const;
|
|
363
|
+
|
|
364
|
+
/** Настройки уведомлений: webhook (Discord/Slack/generic). */
|
|
365
|
+
const NotificationSettingsSchema = {
|
|
366
|
+
type: "object" as const,
|
|
367
|
+
properties: {
|
|
368
|
+
enabled: { type: "boolean" },
|
|
369
|
+
onlyOnError: { type: "boolean" },
|
|
370
|
+
webhook: {
|
|
371
|
+
type: "object" as const,
|
|
372
|
+
properties: {
|
|
373
|
+
enabled: { type: "boolean" },
|
|
374
|
+
url: { type: "string" },
|
|
375
|
+
},
|
|
376
|
+
required: ["enabled", "url"],
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
required: ["enabled", "onlyOnError"],
|
|
380
|
+
} as const;
|
|
381
|
+
|
|
382
|
+
const GetSettingsOutput = {
|
|
383
|
+
type: "object" as const,
|
|
384
|
+
properties: {
|
|
385
|
+
maxConcurrent: { type: "number" },
|
|
386
|
+
winterMode: { type: "boolean" },
|
|
387
|
+
notifications: NotificationSettingsSchema,
|
|
388
|
+
},
|
|
389
|
+
required: ["maxConcurrent", "winterMode", "notifications"],
|
|
390
|
+
} as const;
|
|
391
|
+
|
|
392
|
+
const SaveSettingsInput = {
|
|
393
|
+
type: "object" as const,
|
|
394
|
+
properties: {
|
|
395
|
+
maxConcurrent: { type: "number" },
|
|
396
|
+
winterMode: { type: "boolean" },
|
|
397
|
+
notifications: NotificationSettingsSchema,
|
|
398
|
+
},
|
|
399
|
+
additionalProperties: false,
|
|
400
|
+
} as const;
|
|
401
|
+
|
|
402
|
+
const SaveSettingsOutput = {
|
|
403
|
+
type: "object" as const,
|
|
404
|
+
properties: {
|
|
405
|
+
success: { type: "boolean" },
|
|
406
|
+
maxConcurrent: { type: "number" },
|
|
407
|
+
winterMode: { type: "boolean" },
|
|
408
|
+
notifications: NotificationSettingsSchema,
|
|
409
|
+
},
|
|
410
|
+
required: ["success", "maxConcurrent", "winterMode", "notifications"],
|
|
411
|
+
} as const;
|
|
412
|
+
|
|
413
|
+
const TestNotificationInput = {
|
|
414
|
+
type: "object" as const,
|
|
415
|
+
properties: {},
|
|
416
|
+
additionalProperties: false,
|
|
417
|
+
} as const;
|
|
418
|
+
|
|
419
|
+
const TestNotificationOutput = {
|
|
420
|
+
type: "object" as const,
|
|
421
|
+
properties: {
|
|
422
|
+
success: { type: "boolean" },
|
|
423
|
+
message: { type: "string" },
|
|
424
|
+
},
|
|
425
|
+
required: ["success", "message"],
|
|
426
|
+
} as const;
|
|
427
|
+
|
|
428
|
+
const TemplateItem = {
|
|
429
|
+
type: "object" as const,
|
|
430
|
+
properties: {
|
|
431
|
+
id: { type: "string" },
|
|
432
|
+
name: { type: "string" },
|
|
433
|
+
prompt: { type: "string" },
|
|
434
|
+
schedule: { type: "string" },
|
|
435
|
+
timeoutSeconds: { type: "number" },
|
|
436
|
+
/** LLM-модель шаблона. */
|
|
437
|
+
model: { type: "string" },
|
|
438
|
+
/** Приоритет задачи 0..10. */
|
|
439
|
+
priority: { type: "number" },
|
|
440
|
+
retryCount: { type: "number" },
|
|
441
|
+
retryDelay: { type: "number" },
|
|
442
|
+
qualityGate: { type: "string" },
|
|
443
|
+
nextTaskOnSuccess: { type: "string" },
|
|
444
|
+
nextTaskOnError: { type: "string" },
|
|
445
|
+
/** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
|
|
446
|
+
dependsOn: { type: "array", items: { type: "string" } },
|
|
447
|
+
beforeScript: { type: "string" },
|
|
448
|
+
afterScript: { type: "string" },
|
|
449
|
+
triggerType: { type: "string" },
|
|
450
|
+
mcpEvent: McpEventSchema,
|
|
451
|
+
watchPath: { type: "string" },
|
|
452
|
+
workspaceId: { type: "string" },
|
|
453
|
+
workingDirectory: { type: "string" },
|
|
454
|
+
/** Белый список инструментов задачи (role-scoped, metadata-only). */
|
|
455
|
+
allowedTools: { type: "array", items: { type: "string" } },
|
|
456
|
+
/** Чёрный список инструментов задачи (приоритет над allowedTools). */
|
|
457
|
+
deniedTools: { type: "array", items: { type: "string" } },
|
|
458
|
+
},
|
|
459
|
+
required: ["id", "name", "prompt"],
|
|
460
|
+
} as const;
|
|
461
|
+
|
|
462
|
+
const GetTemplatesInput = {
|
|
463
|
+
type: "object" as const,
|
|
464
|
+
properties: {},
|
|
465
|
+
additionalProperties: false,
|
|
466
|
+
} as const;
|
|
467
|
+
|
|
468
|
+
const GetTemplatesOutput = {
|
|
469
|
+
type: "object" as const,
|
|
470
|
+
properties: {
|
|
471
|
+
templates: {
|
|
472
|
+
type: "array",
|
|
473
|
+
items: TemplateItem,
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
required: ["templates"],
|
|
477
|
+
} as const;
|
|
478
|
+
|
|
479
|
+
const SaveTemplateInput = {
|
|
480
|
+
type: "object" as const,
|
|
481
|
+
properties: {
|
|
482
|
+
id: { type: "string" },
|
|
483
|
+
name: { type: "string" },
|
|
484
|
+
prompt: { type: "string" },
|
|
485
|
+
schedule: { type: "string" },
|
|
486
|
+
timeoutSeconds: { type: "number" },
|
|
487
|
+
/** LLM-модель шаблона. */
|
|
488
|
+
model: { type: "string" },
|
|
489
|
+
/** Приоритет задачи 0..10. */
|
|
490
|
+
priority: { type: "number" },
|
|
491
|
+
retryCount: { type: "number" },
|
|
492
|
+
retryDelay: { type: "number" },
|
|
493
|
+
qualityGate: { type: "string" },
|
|
494
|
+
nextTaskOnSuccess: { type: "string" },
|
|
495
|
+
nextTaskOnError: { type: "string" },
|
|
496
|
+
/** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
|
|
497
|
+
dependsOn: { type: "array", items: { type: "string" } },
|
|
498
|
+
beforeScript: { type: "string" },
|
|
499
|
+
afterScript: { type: "string" },
|
|
500
|
+
triggerType: { type: "string" },
|
|
501
|
+
mcpEvent: McpEventSchema,
|
|
502
|
+
watchPath: { type: "string" },
|
|
503
|
+
workspaceId: { type: "string" },
|
|
504
|
+
workingDirectory: { type: "string" },
|
|
505
|
+
/** Белый список инструментов шаблона (role-scoped). */
|
|
506
|
+
allowedTools: { type: "array", items: { type: "string" } },
|
|
507
|
+
/** Чёрный список инструментов шаблона. */
|
|
508
|
+
deniedTools: { type: "array", items: { type: "string" } },
|
|
509
|
+
},
|
|
510
|
+
required: ["name", "prompt"],
|
|
511
|
+
additionalProperties: false,
|
|
512
|
+
} as const;
|
|
513
|
+
|
|
514
|
+
const SaveTemplateOutput = {
|
|
515
|
+
type: "object" as const,
|
|
516
|
+
properties: {
|
|
517
|
+
success: { type: "boolean" },
|
|
518
|
+
template: TemplateItem,
|
|
519
|
+
error: { type: "string" },
|
|
520
|
+
},
|
|
521
|
+
required: ["success"],
|
|
522
|
+
} as const;
|
|
523
|
+
|
|
524
|
+
const DeleteTemplateInput = {
|
|
525
|
+
type: "object" as const,
|
|
526
|
+
properties: {
|
|
527
|
+
id: { type: "string" },
|
|
528
|
+
},
|
|
529
|
+
required: ["id"],
|
|
530
|
+
} as const;
|
|
531
|
+
|
|
532
|
+
const DeleteTemplateOutput = {
|
|
533
|
+
type: "object" as const,
|
|
534
|
+
properties: {
|
|
535
|
+
success: { type: "boolean" },
|
|
536
|
+
error: { type: "string" },
|
|
537
|
+
},
|
|
538
|
+
required: ["success"],
|
|
539
|
+
} as const;
|
|
540
|
+
|
|
541
|
+
const PauseResumeInput = NameOnly;
|
|
542
|
+
|
|
543
|
+
const UpdateTaskInput = {
|
|
544
|
+
type: "object" as const,
|
|
545
|
+
properties: {
|
|
546
|
+
name: { type: "string" },
|
|
547
|
+
newSchedule: { type: "string" },
|
|
548
|
+
newPrompt: { type: "string" },
|
|
549
|
+
/** LLM-модель задачи. */
|
|
550
|
+
model: { type: "string" },
|
|
551
|
+
/** Приоритет задачи 0..10. */
|
|
552
|
+
priority: { type: "number" },
|
|
553
|
+
retryCount: { type: "number" },
|
|
554
|
+
retryDelay: { type: "number" },
|
|
555
|
+
qualityGate: { type: "string" },
|
|
556
|
+
nextTaskOnSuccess: { type: "string" },
|
|
557
|
+
nextTaskOnError: { type: "string" },
|
|
558
|
+
/** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
|
|
559
|
+
dependsOn: { type: "array", items: { type: "string" } },
|
|
560
|
+
/** Команда перед запуском (pre-flight). */
|
|
561
|
+
beforeScript: { type: "string" },
|
|
562
|
+
/** Команда после запуска (post-flight). */
|
|
563
|
+
afterScript: { type: "string" },
|
|
564
|
+
/** Тип триггера: "cron" (по умолчанию), "file" или "mcp-event". */
|
|
565
|
+
triggerType: { type: "string" },
|
|
566
|
+
/** Параметры MCP-события. */
|
|
567
|
+
mcpEvent: McpEventSchema,
|
|
568
|
+
/** Путь к файлу/папке для файлового триггера. */
|
|
569
|
+
watchPath: { type: "string" },
|
|
570
|
+
/** Привязка к multi-repo workspace. */
|
|
571
|
+
workspaceId: { type: "string" },
|
|
572
|
+
/** Рабочая директория задачи (по умолчанию — папка проекта). */
|
|
573
|
+
workingDirectory: { type: "string" },
|
|
574
|
+
/** Белый список инструментов задачи (role-scoped). Пустой массив запрещён. */
|
|
575
|
+
allowedTools: { type: "array", items: { type: "string" } },
|
|
576
|
+
/** Чёрный список инструментов задачи (приоритет над allowedTools). */
|
|
577
|
+
deniedTools: { type: "array", items: { type: "string" } },
|
|
578
|
+
/** Matrix (fan-out): раскладывает задачу-шаблон на клоны по workspace. */
|
|
579
|
+
matrix: MatrixSchema,
|
|
580
|
+
},
|
|
581
|
+
required: ["name"],
|
|
582
|
+
} as const;
|
|
583
|
+
|
|
584
|
+
const UpdateTaskOutput = DeleteTaskOutput;
|
|
585
|
+
|
|
586
|
+
const WorkspaceItem = {
|
|
587
|
+
type: "object" as const,
|
|
588
|
+
properties: {
|
|
589
|
+
id: { type: "string" },
|
|
590
|
+
name: { type: "string" },
|
|
591
|
+
path: { type: "string" },
|
|
592
|
+
gitRemote: { type: ["string", "null"] },
|
|
593
|
+
gitBranch: { type: ["string", "null"] },
|
|
594
|
+
color: { type: ["string", "null"] },
|
|
595
|
+
createdAt: { type: "string" },
|
|
596
|
+
},
|
|
597
|
+
required: ["id", "name", "path", "createdAt"],
|
|
598
|
+
} as const;
|
|
599
|
+
|
|
600
|
+
const GetWorkspacesInput = {
|
|
601
|
+
type: "object" as const,
|
|
602
|
+
properties: {},
|
|
603
|
+
additionalProperties: false,
|
|
604
|
+
} as const;
|
|
605
|
+
|
|
606
|
+
const GetWorkspacesOutput = {
|
|
607
|
+
type: "object" as const,
|
|
608
|
+
properties: {
|
|
609
|
+
workspaces: { type: "array", items: WorkspaceItem },
|
|
610
|
+
},
|
|
611
|
+
required: ["workspaces"],
|
|
612
|
+
} as const;
|
|
613
|
+
|
|
614
|
+
const AddWorkspaceInput = {
|
|
615
|
+
type: "object" as const,
|
|
616
|
+
properties: {
|
|
617
|
+
name: { type: "string" },
|
|
618
|
+
path: { type: "string" },
|
|
619
|
+
color: { type: "string" },
|
|
620
|
+
},
|
|
621
|
+
required: ["path"],
|
|
622
|
+
additionalProperties: false,
|
|
623
|
+
} as const;
|
|
624
|
+
|
|
625
|
+
const AddWorkspaceOutput = {
|
|
626
|
+
type: "object" as const,
|
|
627
|
+
properties: {
|
|
628
|
+
success: { type: "boolean" },
|
|
629
|
+
workspace: WorkspaceItem,
|
|
630
|
+
error: { type: "string" },
|
|
631
|
+
},
|
|
632
|
+
required: ["success"],
|
|
633
|
+
} as const;
|
|
634
|
+
|
|
635
|
+
const UpdateWorkspaceInput = {
|
|
636
|
+
type: "object" as const,
|
|
637
|
+
properties: {
|
|
638
|
+
id: { type: "string" },
|
|
639
|
+
name: { type: "string" },
|
|
640
|
+
path: { type: "string" },
|
|
641
|
+
color: { type: "string" },
|
|
642
|
+
},
|
|
643
|
+
required: ["id"],
|
|
644
|
+
additionalProperties: false,
|
|
645
|
+
} as const;
|
|
646
|
+
|
|
647
|
+
const DeleteWorkspaceInput = {
|
|
648
|
+
type: "object" as const,
|
|
649
|
+
properties: {
|
|
650
|
+
id: { type: "string" },
|
|
651
|
+
},
|
|
652
|
+
required: ["id"],
|
|
653
|
+
} as const;
|
|
654
|
+
|
|
655
|
+
const DeleteWorkspaceOutput = {
|
|
656
|
+
type: "object" as const,
|
|
657
|
+
properties: {
|
|
658
|
+
success: { type: "boolean" },
|
|
659
|
+
message: { type: "string" },
|
|
660
|
+
},
|
|
661
|
+
required: ["success"],
|
|
662
|
+
} as const;
|
|
663
|
+
|
|
664
|
+
const EmitEventInput = {
|
|
665
|
+
type: "object" as const,
|
|
666
|
+
properties: {
|
|
667
|
+
/** Имя события, например github.pr.opened. */
|
|
668
|
+
eventName: { type: "string" },
|
|
669
|
+
/** Произвольный payload события (используется фильтрами задач). */
|
|
670
|
+
payload: { type: ["object", "null", "string", "number", "boolean", "array"] },
|
|
671
|
+
},
|
|
672
|
+
required: ["eventName"],
|
|
673
|
+
} as const;
|
|
674
|
+
|
|
675
|
+
const EmitEventOutput = {
|
|
676
|
+
type: "object" as const,
|
|
677
|
+
properties: {
|
|
678
|
+
success: { type: "boolean" },
|
|
679
|
+
message: { type: "string" },
|
|
680
|
+
/** Задачи, запущенные по событию (в порядке приоритета). */
|
|
681
|
+
triggered: { type: "array", items: { type: "string" } },
|
|
682
|
+
},
|
|
683
|
+
required: ["success", "triggered"],
|
|
684
|
+
} as const;
|
|
685
|
+
|
|
686
|
+
const DryRunTaskItem = {
|
|
687
|
+
type: "object" as const,
|
|
688
|
+
properties: {
|
|
689
|
+
name: { type: "string" },
|
|
690
|
+
/** Порядок выполнения в конвейере (0 — первый). */
|
|
691
|
+
order: { type: "number" },
|
|
692
|
+
/** Триггер запуска: manual (первая в конвейере), cron или dag (по dependsOn). */
|
|
693
|
+
trigger: { type: "string" },
|
|
694
|
+
/** Рабочая директория, в которой будет выполнена задача. */
|
|
695
|
+
cwd: { type: "string" },
|
|
696
|
+
/** Команда, которую фактически выполнит обёртка (без реального запуска). */
|
|
697
|
+
command: { type: "string" },
|
|
698
|
+
/** Workspace задачи (null — без workspace). */
|
|
699
|
+
workspace: {
|
|
700
|
+
type: ["object", "null"],
|
|
701
|
+
properties: {
|
|
702
|
+
name: { type: "string" },
|
|
703
|
+
path: { type: "string" },
|
|
704
|
+
},
|
|
705
|
+
required: ["name", "path"],
|
|
706
|
+
},
|
|
707
|
+
/** Pre-flight команда (null — не задана). */
|
|
708
|
+
preFlight: { type: ["string", "null"] },
|
|
709
|
+
/** Post-flight команда (null — не задана). */
|
|
710
|
+
postFlight: { type: ["string", "null"] },
|
|
711
|
+
/** Quality Gate (null — не задан). */
|
|
712
|
+
qualityGate: { type: ["string", "null"] },
|
|
713
|
+
/** Ограничения инструментов (null — без ограничений). */
|
|
714
|
+
roleScoped: {
|
|
715
|
+
type: ["object", "null"],
|
|
716
|
+
properties: {
|
|
717
|
+
allowed: { type: "array", items: { type: "string" } },
|
|
718
|
+
denied: { type: "array", items: { type: "string" } },
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
/** Оценка длительности по последним запускам (null — нет истории). */
|
|
722
|
+
estimatedDurationSec: { type: ["number", "null"] },
|
|
723
|
+
/** Оценка стоимости по последним запускам (null — нет истории). */
|
|
724
|
+
estimatedCostUsd: { type: ["number", "null"] },
|
|
725
|
+
/** Оценка токенов по последним запускам (null — нет истории). */
|
|
726
|
+
estimatedTokens: { type: ["number", "null"] },
|
|
727
|
+
/** Для клона матрицы — имя родителя-шаблона (Спринт 15). */
|
|
728
|
+
matrixParent: { type: "string" },
|
|
729
|
+
},
|
|
730
|
+
required: ["name", "order", "trigger", "cwd", "command"],
|
|
731
|
+
} as const;
|
|
732
|
+
|
|
733
|
+
const DryRunReportOutput = {
|
|
734
|
+
type: "object" as const,
|
|
735
|
+
properties: {
|
|
736
|
+
success: { type: "boolean" },
|
|
737
|
+
taskName: { type: "string" },
|
|
738
|
+
/** Упорядоченный список задач конвейера (топологический порядок зависимостей). */
|
|
739
|
+
tasks: { type: "array", items: DryRunTaskItem },
|
|
740
|
+
/** Суммарные оценки по всем задачам. */
|
|
741
|
+
totals: {
|
|
742
|
+
type: "object",
|
|
743
|
+
properties: {
|
|
744
|
+
estimatedDurationSec: { type: ["number", "null"] },
|
|
745
|
+
estimatedCostUsd: { type: ["number", "null"] },
|
|
746
|
+
estimatedTokens: { type: ["number", "null"] },
|
|
747
|
+
},
|
|
748
|
+
required: [],
|
|
749
|
+
},
|
|
750
|
+
/** Предупреждения: опасные команды, недоступные пути, отсутствие истории. */
|
|
751
|
+
warnings: { type: "array", items: { type: "string" } },
|
|
752
|
+
error: { type: "string" },
|
|
753
|
+
},
|
|
754
|
+
required: ["success", "taskName", "tasks", "warnings"],
|
|
755
|
+
} as const;
|
|
756
|
+
|
|
757
|
+
const DryRunInput = {
|
|
758
|
+
type: "object" as const,
|
|
759
|
+
properties: {
|
|
760
|
+
taskName: { type: "string" },
|
|
761
|
+
},
|
|
762
|
+
required: ["taskName"],
|
|
763
|
+
additionalProperties: false,
|
|
764
|
+
} as const;
|
|
765
|
+
|
|
766
|
+
const DryRunAllOutput = {
|
|
767
|
+
type: "object" as const,
|
|
768
|
+
properties: {
|
|
769
|
+
success: { type: "boolean" },
|
|
770
|
+
reports: {
|
|
771
|
+
type: "array",
|
|
772
|
+
items: DryRunReportOutput,
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
required: ["success", "reports"],
|
|
776
|
+
} as const;
|
|
777
|
+
|
|
778
|
+
/** Детальный отчёт по одному клону матрицы. */
|
|
779
|
+
const MatrixCloneResult = {
|
|
780
|
+
type: "object" as const,
|
|
781
|
+
properties: {
|
|
782
|
+
name: { type: "string" },
|
|
783
|
+
workspaceId: { type: ["string", "null"] },
|
|
784
|
+
workspaceName: { type: ["string", "null"] },
|
|
785
|
+
/** success | error | timeout | partial | pending | running */
|
|
786
|
+
status: { type: "string" },
|
|
787
|
+
error: { type: ["string", "null"] },
|
|
788
|
+
finishedAt: { type: ["string", "null"] },
|
|
789
|
+
},
|
|
790
|
+
required: ["name", "status"],
|
|
791
|
+
} as const;
|
|
792
|
+
|
|
793
|
+
const GetMatrixResultsInput = {
|
|
794
|
+
type: "object" as const,
|
|
795
|
+
properties: {
|
|
796
|
+
parentId: { type: "string" },
|
|
797
|
+
},
|
|
798
|
+
required: ["parentId"],
|
|
799
|
+
additionalProperties: false,
|
|
800
|
+
} as const;
|
|
801
|
+
|
|
802
|
+
const MatrixReport = {
|
|
803
|
+
type: "object" as const,
|
|
804
|
+
properties: {
|
|
805
|
+
parentId: { type: "string" },
|
|
806
|
+
totalCount: { type: "number" },
|
|
807
|
+
successCount: { type: "number" },
|
|
808
|
+
errorCount: { type: "number" },
|
|
809
|
+
pendingCount: { type: "number" },
|
|
810
|
+
/** success | error | partial | running | empty */
|
|
811
|
+
status: { type: "string" },
|
|
812
|
+
message: { type: "string" },
|
|
813
|
+
clones: { type: "array", items: MatrixCloneResult },
|
|
814
|
+
},
|
|
815
|
+
required: ["parentId", "totalCount", "successCount", "errorCount", "status"],
|
|
816
|
+
} as const;
|
|
817
|
+
|
|
818
|
+
const GetMatrixResultsOutput = {
|
|
819
|
+
type: "object" as const,
|
|
820
|
+
properties: {
|
|
821
|
+
success: { type: "boolean" },
|
|
822
|
+
report: MatrixReport,
|
|
823
|
+
error: { type: "string" },
|
|
824
|
+
},
|
|
825
|
+
required: ["success"],
|
|
826
|
+
} as const;
|
|
827
|
+
|
|
828
|
+
const ExpandMatrixPreviewInput = {
|
|
829
|
+
type: "object" as const,
|
|
830
|
+
properties: {
|
|
831
|
+
/** Имя задачи-родителя (используется в именах клонов). */
|
|
832
|
+
name: { type: "string" },
|
|
833
|
+
workspaceIds: { type: "array", items: { type: "string" } },
|
|
834
|
+
strategy: { type: "string" },
|
|
835
|
+
failureMode: { type: "string" },
|
|
836
|
+
aggregation: { type: "string" },
|
|
837
|
+
},
|
|
838
|
+
required: ["workspaceIds"],
|
|
839
|
+
additionalProperties: false,
|
|
840
|
+
} as const;
|
|
841
|
+
|
|
842
|
+
const ExpandMatrixPreviewOutput = {
|
|
843
|
+
type: "object" as const,
|
|
844
|
+
properties: {
|
|
845
|
+
success: { type: "boolean" },
|
|
846
|
+
clones: {
|
|
847
|
+
type: "array",
|
|
848
|
+
items: {
|
|
849
|
+
type: "object",
|
|
850
|
+
properties: {
|
|
851
|
+
name: { type: "string" },
|
|
852
|
+
workspaceId: { type: "string" },
|
|
853
|
+
workspaceName: { type: ["string", "null"] },
|
|
854
|
+
},
|
|
855
|
+
required: ["name", "workspaceId"],
|
|
856
|
+
},
|
|
857
|
+
},
|
|
858
|
+
error: { type: "string" },
|
|
859
|
+
},
|
|
860
|
+
required: ["success", "clones"],
|
|
861
|
+
} as const;
|
|
862
|
+
|
|
863
|
+
const CancelMatrixOutput = {
|
|
864
|
+
type: "object" as const,
|
|
865
|
+
properties: {
|
|
866
|
+
success: { type: "boolean" },
|
|
867
|
+
message: { type: "string" },
|
|
868
|
+
cancelled: { type: "array", items: { type: "string" } },
|
|
869
|
+
},
|
|
870
|
+
required: ["success", "message", "cancelled"],
|
|
871
|
+
} as const;
|
|
872
|
+
|
|
873
|
+
const CleanupMatrixOrphansOutput = {
|
|
874
|
+
type: "object" as const,
|
|
875
|
+
properties: {
|
|
876
|
+
success: { type: "boolean" },
|
|
877
|
+
message: { type: "string" },
|
|
878
|
+
removed: { type: "array", items: { type: "string" } },
|
|
879
|
+
},
|
|
880
|
+
required: ["success", "message", "removed"],
|
|
881
|
+
} as const;
|
|
882
|
+
|
|
883
|
+
export const SchedulerRpc = Rpc.define({
|
|
884
|
+
id: "opencode-windows-scheduler",
|
|
885
|
+
methods: {
|
|
886
|
+
get_tasks: { input: GetTasksInput, output: GetTasksOutput },
|
|
887
|
+
create_task: { input: CreateTaskInput, output: CreateTaskOutput },
|
|
888
|
+
delete_task: { input: DeleteTaskInput, output: DeleteTaskOutput },
|
|
889
|
+
run_task: { input: RunTaskInput, output: RunTaskOutput },
|
|
890
|
+
pause_task: { input: PauseResumeInput, output: DeleteTaskOutput },
|
|
891
|
+
resume_task: { input: PauseResumeInput, output: DeleteTaskOutput },
|
|
892
|
+
update_task: { input: UpdateTaskInput, output: UpdateTaskOutput },
|
|
893
|
+
get_task_logs: { input: GetTaskLogsInput, output: GetTaskLogsOutput },
|
|
894
|
+
get_history: { input: GetHistoryInput, output: GetHistoryOutput },
|
|
895
|
+
get_metrics: { input: GetMetricsInput, output: GetMetricsOutput },
|
|
896
|
+
get_dashboard_port: { input: GetDashboardPortInput, output: GetDashboardPortOutput },
|
|
897
|
+
get_platform: { input: GetPlatformInput, output: GetPlatformOutput },
|
|
898
|
+
dry_run: { input: DryRunInput, output: DryRunReportOutput },
|
|
899
|
+
dry_run_all: { input: GetTasksInput, output: DryRunAllOutput },
|
|
900
|
+
get_matrix_results: {
|
|
901
|
+
input: GetMatrixResultsInput,
|
|
902
|
+
output: GetMatrixResultsOutput,
|
|
903
|
+
},
|
|
904
|
+
cancel_matrix: { input: NameOnly, output: CancelMatrixOutput },
|
|
905
|
+
cleanup_matrix_orphans: {
|
|
906
|
+
input: GetTasksInput,
|
|
907
|
+
output: CleanupMatrixOrphansOutput,
|
|
908
|
+
},
|
|
909
|
+
expand_matrix_preview: {
|
|
910
|
+
input: ExpandMatrixPreviewInput,
|
|
911
|
+
output: ExpandMatrixPreviewOutput,
|
|
912
|
+
},
|
|
913
|
+
get_workspaces: { input: GetWorkspacesInput, output: GetWorkspacesOutput },
|
|
914
|
+
add_workspace: { input: AddWorkspaceInput, output: AddWorkspaceOutput },
|
|
915
|
+
update_workspace: { input: UpdateWorkspaceInput, output: AddWorkspaceOutput },
|
|
916
|
+
delete_workspace: { input: DeleteWorkspaceInput, output: DeleteWorkspaceOutput },
|
|
917
|
+
export_tasks: { input: ExportTasksInput, output: ExportTasksOutput },
|
|
918
|
+
import_tasks: { input: ImportTasksInput, output: ImportTasksOutput },
|
|
919
|
+
get_settings: { input: GetSettingsInput, output: GetSettingsOutput },
|
|
920
|
+
save_settings: { input: SaveSettingsInput, output: SaveSettingsOutput },
|
|
921
|
+
get_templates: { input: GetTemplatesInput, output: GetTemplatesOutput },
|
|
922
|
+
save_template: { input: SaveTemplateInput, output: SaveTemplateOutput },
|
|
923
|
+
delete_template: { input: DeleteTemplateInput, output: DeleteTemplateOutput },
|
|
924
|
+
emit_event: { input: EmitEventInput, output: EmitEventOutput },
|
|
925
|
+
test_notification: {
|
|
926
|
+
input: TestNotificationInput,
|
|
927
|
+
output: TestNotificationOutput,
|
|
928
|
+
},
|
|
929
|
+
},
|
|
930
|
+
events: {},
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
export type SchedulerRpc = typeof SchedulerRpc;
|