agent-steward 0.0.0-stage → 0.0.2

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.
Files changed (334) hide show
  1. package/CHANGELOG.md +376 -0
  2. package/CROSS_PLATFORM.md +149 -0
  3. package/LICENSE +21 -0
  4. package/README.md +314 -2
  5. package/ROADMAP-STRATEGY.md +147 -0
  6. package/ROADMAP.md +1069 -0
  7. package/dist/core/analytics.d.ts +132 -0
  8. package/dist/core/analytics.d.ts.map +1 -0
  9. package/dist/core/analytics.js +290 -0
  10. package/dist/core/audit.d.ts +96 -0
  11. package/dist/core/audit.d.ts.map +1 -0
  12. package/dist/core/audit.js +297 -0
  13. package/dist/core/cron-to-schtasks.d.ts +20 -0
  14. package/dist/core/cron-to-schtasks.d.ts.map +1 -0
  15. package/dist/core/cron-to-schtasks.js +250 -0
  16. package/dist/core/dry-run.d.ts +102 -0
  17. package/dist/core/dry-run.d.ts.map +1 -0
  18. package/dist/core/dry-run.js +447 -0
  19. package/dist/core/file-watcher.d.ts +31 -0
  20. package/dist/core/file-watcher.d.ts.map +1 -0
  21. package/dist/core/file-watcher.js +186 -0
  22. package/dist/core/git-trigger.d.ts +82 -0
  23. package/dist/core/git-trigger.d.ts.map +1 -0
  24. package/dist/core/git-trigger.js +312 -0
  25. package/dist/core/glob.d.ts +38 -0
  26. package/dist/core/glob.d.ts.map +1 -0
  27. package/dist/core/glob.js +233 -0
  28. package/dist/core/local-ai.d.ts +52 -0
  29. package/dist/core/local-ai.d.ts.map +1 -0
  30. package/dist/core/local-ai.js +119 -0
  31. package/dist/core/lock.d.ts +57 -0
  32. package/dist/core/lock.d.ts.map +1 -0
  33. package/dist/core/lock.js +195 -0
  34. package/dist/core/matrix.d.ts +167 -0
  35. package/dist/core/matrix.d.ts.map +1 -0
  36. package/dist/core/matrix.js +724 -0
  37. package/dist/core/native-notify.d.ts +36 -0
  38. package/dist/core/native-notify.d.ts.map +1 -0
  39. package/dist/core/native-notify.js +113 -0
  40. package/dist/core/one-shot.d.ts +68 -0
  41. package/dist/core/one-shot.d.ts.map +1 -0
  42. package/dist/core/one-shot.js +139 -0
  43. package/dist/core/otel.d.ts +4 -0
  44. package/dist/core/otel.d.ts.map +1 -0
  45. package/dist/core/otel.js +98 -0
  46. package/dist/core/permissions.d.ts +69 -0
  47. package/dist/core/permissions.d.ts.map +1 -0
  48. package/dist/core/permissions.js +143 -0
  49. package/dist/core/prometheus.d.ts +23 -0
  50. package/dist/core/prometheus.d.ts.map +1 -0
  51. package/dist/core/prometheus.js +146 -0
  52. package/dist/core/ps-wrapper.d.ts +73 -0
  53. package/dist/core/ps-wrapper.d.ts.map +1 -0
  54. package/dist/core/ps-wrapper.js +1071 -0
  55. package/dist/core/record-history.d.ts +25 -0
  56. package/dist/core/record-history.d.ts.map +1 -0
  57. package/dist/core/record-history.js +471 -0
  58. package/dist/core/retention.d.ts +29 -0
  59. package/dist/core/retention.d.ts.map +1 -0
  60. package/dist/core/retention.js +98 -0
  61. package/dist/core/savings.d.ts +70 -0
  62. package/dist/core/savings.d.ts.map +1 -0
  63. package/dist/core/savings.js +87 -0
  64. package/dist/core/schedule-gate.d.ts +2 -0
  65. package/dist/core/schedule-gate.d.ts.map +1 -0
  66. package/dist/core/schedule-gate.js +211 -0
  67. package/dist/core/schedule-v2.d.ts +116 -0
  68. package/dist/core/schedule-v2.d.ts.map +1 -0
  69. package/dist/core/schedule-v2.js +586 -0
  70. package/dist/core/scheduler/index.d.ts +32 -0
  71. package/dist/core/scheduler/index.d.ts.map +1 -0
  72. package/dist/core/scheduler/index.js +63 -0
  73. package/dist/core/scheduler/linux.d.ts +44 -0
  74. package/dist/core/scheduler/linux.d.ts.map +1 -0
  75. package/dist/core/scheduler/linux.js +225 -0
  76. package/dist/core/scheduler/logs.d.ts +11 -0
  77. package/dist/core/scheduler/logs.d.ts.map +1 -0
  78. package/dist/core/scheduler/logs.js +34 -0
  79. package/dist/core/scheduler/mac.d.ts +40 -0
  80. package/dist/core/scheduler/mac.d.ts.map +1 -0
  81. package/dist/core/scheduler/mac.js +207 -0
  82. package/dist/core/scheduler/posix.d.ts +40 -0
  83. package/dist/core/scheduler/posix.d.ts.map +1 -0
  84. package/dist/core/scheduler/posix.js +89 -0
  85. package/dist/core/scheduler/registry.d.ts +41 -0
  86. package/dist/core/scheduler/registry.d.ts.map +1 -0
  87. package/dist/core/scheduler/registry.js +57 -0
  88. package/dist/core/scheduler/types.d.ts +86 -0
  89. package/dist/core/scheduler/types.d.ts.map +1 -0
  90. package/dist/core/scheduler/types.js +1 -0
  91. package/dist/core/scheduler/windows.d.ts +99 -0
  92. package/dist/core/scheduler/windows.d.ts.map +1 -0
  93. package/dist/core/scheduler/windows.js +596 -0
  94. package/dist/core/secrets.d.ts +66 -0
  95. package/dist/core/secrets.d.ts.map +1 -0
  96. package/dist/core/secrets.js +433 -0
  97. package/dist/core/self-analysis.d.ts +117 -0
  98. package/dist/core/self-analysis.d.ts.map +1 -0
  99. package/dist/core/self-analysis.js +539 -0
  100. package/dist/core/self-analysis.test.d.ts +2 -0
  101. package/dist/core/self-analysis.test.d.ts.map +1 -0
  102. package/dist/core/self-analysis.test.js +219 -0
  103. package/dist/core/session.d.ts +42 -0
  104. package/dist/core/session.d.ts.map +1 -0
  105. package/dist/core/session.js +134 -0
  106. package/dist/core/shutdown.d.ts +26 -0
  107. package/dist/core/shutdown.d.ts.map +1 -0
  108. package/dist/core/shutdown.js +49 -0
  109. package/dist/core/structured-log.d.ts +84 -0
  110. package/dist/core/structured-log.d.ts.map +1 -0
  111. package/dist/core/structured-log.js +146 -0
  112. package/dist/core/summary.d.ts +69 -0
  113. package/dist/core/summary.d.ts.map +1 -0
  114. package/dist/core/summary.js +250 -0
  115. package/dist/core/telegram.d.ts +55 -0
  116. package/dist/core/telegram.d.ts.map +1 -0
  117. package/dist/core/telegram.js +344 -0
  118. package/dist/core/triage-chain.d.ts +40 -0
  119. package/dist/core/triage-chain.d.ts.map +1 -0
  120. package/dist/core/triage-chain.js +80 -0
  121. package/dist/core/triage-compare.d.ts +68 -0
  122. package/dist/core/triage-compare.d.ts.map +1 -0
  123. package/dist/core/triage-compare.js +184 -0
  124. package/dist/core/triage-rules.d.ts +23 -0
  125. package/dist/core/triage-rules.d.ts.map +1 -0
  126. package/dist/core/triage-rules.js +196 -0
  127. package/dist/core/triage-shadow.d.ts +91 -0
  128. package/dist/core/triage-shadow.d.ts.map +1 -0
  129. package/dist/core/triage-shadow.js +160 -0
  130. package/dist/core/triage-worker.d.ts +55 -0
  131. package/dist/core/triage-worker.d.ts.map +1 -0
  132. package/dist/core/triage-worker.js +314 -0
  133. package/dist/core/triage.d.ts +76 -0
  134. package/dist/core/triage.d.ts.map +1 -0
  135. package/dist/core/triage.js +271 -0
  136. package/dist/core/watch-paths.d.ts +6 -0
  137. package/dist/core/watch-paths.d.ts.map +1 -0
  138. package/dist/core/watch-paths.js +62 -0
  139. package/dist/core/wrappers/bash.d.ts +95 -0
  140. package/dist/core/wrappers/bash.d.ts.map +1 -0
  141. package/dist/core/wrappers/bash.js +413 -0
  142. package/dist/db/git-state-repo.d.ts +16 -0
  143. package/dist/db/git-state-repo.d.ts.map +1 -0
  144. package/dist/db/git-state-repo.js +38 -0
  145. package/dist/db/history-repo.d.ts +110 -0
  146. package/dist/db/history-repo.d.ts.map +1 -0
  147. package/dist/db/history-repo.js +300 -0
  148. package/dist/db/index.d.ts +47 -0
  149. package/dist/db/index.d.ts.map +1 -0
  150. package/dist/db/index.js +120 -0
  151. package/dist/db/metrics-repo.d.ts +46 -0
  152. package/dist/db/metrics-repo.d.ts.map +1 -0
  153. package/dist/db/metrics-repo.js +103 -0
  154. package/dist/db/migrate.d.ts +24 -0
  155. package/dist/db/migrate.d.ts.map +1 -0
  156. package/dist/db/migrate.js +244 -0
  157. package/dist/db/recovery.d.ts +11 -0
  158. package/dist/db/recovery.d.ts.map +1 -0
  159. package/dist/db/recovery.js +38 -0
  160. package/dist/db/schema.d.ts +24 -0
  161. package/dist/db/schema.d.ts.map +1 -0
  162. package/dist/db/schema.js +170 -0
  163. package/dist/db/settings-repo.d.ts +8 -0
  164. package/dist/db/settings-repo.d.ts.map +1 -0
  165. package/dist/db/settings-repo.js +27 -0
  166. package/dist/db/tasks-repo.d.ts +26 -0
  167. package/dist/db/tasks-repo.d.ts.map +1 -0
  168. package/dist/db/tasks-repo.js +120 -0
  169. package/dist/db/templates-repo.d.ts +17 -0
  170. package/dist/db/templates-repo.d.ts.map +1 -0
  171. package/dist/db/templates-repo.js +57 -0
  172. package/dist/gui-experimental.cjs +1 -0
  173. package/dist/history.d.ts +60 -0
  174. package/dist/history.d.ts.map +1 -0
  175. package/dist/history.js +70 -0
  176. package/dist/i18n.d.ts +75 -0
  177. package/dist/i18n.d.ts.map +1 -0
  178. package/dist/i18n.js +357 -0
  179. package/dist/index.d.ts +858 -0
  180. package/dist/index.d.ts.map +1 -0
  181. package/dist/index.js +5179 -0
  182. package/dist/integrations.d.ts +72 -0
  183. package/dist/integrations.d.ts.map +1 -0
  184. package/dist/integrations.js +233 -0
  185. package/dist/notifications.d.ts +199 -0
  186. package/dist/notifications.d.ts.map +1 -0
  187. package/dist/notifications.js +967 -0
  188. package/dist/profiles.d.ts +60 -0
  189. package/dist/profiles.d.ts.map +1 -0
  190. package/dist/profiles.js +227 -0
  191. package/dist/rpc.d.ts +3806 -0
  192. package/dist/rpc.d.ts.map +1 -0
  193. package/dist/rpc.js +1507 -0
  194. package/dist/schtasks.d.ts +32 -0
  195. package/dist/schtasks.d.ts.map +1 -0
  196. package/dist/schtasks.js +45 -0
  197. package/dist/server.d.ts +128 -0
  198. package/dist/server.d.ts.map +1 -0
  199. package/dist/server.js +2413 -0
  200. package/dist/settings.d.ts +389 -0
  201. package/dist/settings.d.ts.map +1 -0
  202. package/dist/settings.js +770 -0
  203. package/dist/shared/jobs-view.d.ts +59 -0
  204. package/dist/shared/jobs-view.d.ts.map +1 -0
  205. package/dist/shared/jobs-view.js +146 -0
  206. package/dist/skill.d.ts +15 -0
  207. package/dist/skill.d.ts.map +1 -0
  208. package/dist/skill.js +93 -0
  209. package/dist/task-transfer.d.ts +252 -0
  210. package/dist/task-transfer.d.ts.map +1 -0
  211. package/dist/task-transfer.js +628 -0
  212. package/dist/templates.d.ts +57 -0
  213. package/dist/templates.d.ts.map +1 -0
  214. package/dist/templates.js +16 -0
  215. package/dist/types.d.ts +96 -0
  216. package/dist/types.d.ts.map +1 -0
  217. package/dist/types.js +130 -0
  218. package/dist/version.d.ts +8 -0
  219. package/dist/version.d.ts.map +1 -0
  220. package/dist/version.js +27 -0
  221. package/dist/workspaces.d.ts +113 -0
  222. package/dist/workspaces.d.ts.map +1 -0
  223. package/dist/workspaces.js +393 -0
  224. package/docs/ARCHITECTURE.md +457 -0
  225. package/docs/COMPATIBILITY.md +233 -0
  226. package/docs/CONCEPT.md +230 -0
  227. package/docs/CROSS_PLATFORM.ru.md +150 -0
  228. package/docs/CROSS_PLATFORM.zh.md +146 -0
  229. package/docs/FAQ.md +52 -0
  230. package/docs/FAQ.ru.md +53 -0
  231. package/docs/FAQ.zh.md +43 -0
  232. package/docs/FEATURES.md +698 -0
  233. package/docs/FEATURES.zh.md +655 -0
  234. package/docs/LOCAL-AI.md +300 -0
  235. package/docs/MIGRATION.md +355 -0
  236. package/docs/README.ru.md +268 -0
  237. package/docs/README.zh.md +305 -0
  238. package/docs/SAVINGS.md +61 -0
  239. package/docs/SAVINGS.ru.md +60 -0
  240. package/docs/SAVINGS.zh.md +52 -0
  241. package/docs/V1-V2-COMPATIBILITY-PLAN.md +366 -0
  242. package/docs/ZH-LOCALE-PLAN.md +324 -0
  243. package/docs/dashboard.png +0 -0
  244. package/docs/spikes/local-model-structured-output.md +81 -0
  245. package/docs/spikes/ollama-qwen3-4b-smoke.json +28 -0
  246. package/docs/spikes/ollama-qwen3-4b.json +163 -0
  247. package/gui-experimental.cjs +9 -0
  248. package/index.js +1 -0
  249. package/locales/en.json +780 -0
  250. package/locales/ru.json +780 -0
  251. package/locales/zh.json +780 -0
  252. package/package.json +149 -4
  253. package/scripts/bench-local.mjs +321 -0
  254. package/scripts/check-zh-locale.mjs +218 -0
  255. package/scripts/demo-dashboard.mjs +209 -0
  256. package/scripts/run-tests.mjs +236 -0
  257. package/scripts/spike-local-structured.mjs +182 -0
  258. package/scripts/test-locale.mjs +45 -0
  259. package/skills/scheduled-job-best-practices/SKILL.md +158 -0
  260. package/skills/scheduled-job-best-practices/references/recipes.md +163 -0
  261. package/src/core/analytics.ts +424 -0
  262. package/src/core/audit.ts +418 -0
  263. package/src/core/cron-to-schtasks.ts +288 -0
  264. package/src/core/dry-run.ts +601 -0
  265. package/src/core/file-watcher.ts +245 -0
  266. package/src/core/git-trigger.ts +391 -0
  267. package/src/core/glob.ts +226 -0
  268. package/src/core/local-ai.ts +173 -0
  269. package/src/core/lock.ts +219 -0
  270. package/src/core/matrix.ts +947 -0
  271. package/src/core/native-notify.ts +157 -0
  272. package/src/core/one-shot.ts +189 -0
  273. package/src/core/otel.ts +128 -0
  274. package/src/core/permissions.ts +200 -0
  275. package/src/core/prometheus.ts +215 -0
  276. package/src/core/ps-wrapper.ts +1140 -0
  277. package/src/core/record-history.ts +615 -0
  278. package/src/core/retention.ts +141 -0
  279. package/src/core/savings.ts +150 -0
  280. package/src/core/schedule-gate.ts +253 -0
  281. package/src/core/schedule-v2.ts +668 -0
  282. package/src/core/scheduler/index.ts +82 -0
  283. package/src/core/scheduler/linux.ts +257 -0
  284. package/src/core/scheduler/logs.ts +37 -0
  285. package/src/core/scheduler/mac.ts +270 -0
  286. package/src/core/scheduler/posix.ts +114 -0
  287. package/src/core/scheduler/registry.ts +99 -0
  288. package/src/core/scheduler/types.ts +90 -0
  289. package/src/core/scheduler/windows.ts +711 -0
  290. package/src/core/secrets.ts +503 -0
  291. package/src/core/self-analysis.ts +744 -0
  292. package/src/core/session.ts +150 -0
  293. package/src/core/shutdown.ts +69 -0
  294. package/src/core/structured-log.ts +214 -0
  295. package/src/core/summary.ts +318 -0
  296. package/src/core/telegram.ts +436 -0
  297. package/src/core/triage-chain.ts +125 -0
  298. package/src/core/triage-compare.ts +277 -0
  299. package/src/core/triage-rules.ts +238 -0
  300. package/src/core/triage-shadow.ts +240 -0
  301. package/src/core/triage-worker.ts +344 -0
  302. package/src/core/triage.ts +366 -0
  303. package/src/core/watch-paths.ts +70 -0
  304. package/src/core/wrappers/bash.ts +532 -0
  305. package/src/db/git-state-repo.ts +62 -0
  306. package/src/db/history-repo.ts +492 -0
  307. package/src/db/index.ts +166 -0
  308. package/src/db/metrics-repo.ts +170 -0
  309. package/src/db/migrate.ts +328 -0
  310. package/src/db/recovery.ts +46 -0
  311. package/src/db/schema.ts +188 -0
  312. package/src/db/settings-repo.ts +31 -0
  313. package/src/db/tasks-repo.ts +162 -0
  314. package/src/db/templates-repo.ts +77 -0
  315. package/src/gui.tsx +5222 -0
  316. package/src/history.ts +128 -0
  317. package/src/i18n.ts +413 -0
  318. package/src/index.ts +6605 -0
  319. package/src/integrations.ts +297 -0
  320. package/src/notifications.ts +1346 -0
  321. package/src/profiles.ts +254 -0
  322. package/src/rpc.ts +1609 -0
  323. package/src/schtasks.ts +75 -0
  324. package/src/server.ts +2662 -0
  325. package/src/settings.ts +1369 -0
  326. package/src/shared/jobs-view.ts +188 -0
  327. package/src/skill.ts +113 -0
  328. package/src/task-transfer.ts +944 -0
  329. package/src/templates.ts +67 -0
  330. package/src/tui-v1.tsx +341 -0
  331. package/src/tui.tsx +329 -0
  332. package/src/types.ts +191 -0
  333. package/src/version.ts +27 -0
  334. package/src/workspaces.ts +487 -0
package/dist/rpc.js ADDED
@@ -0,0 +1,1507 @@
1
+ import { Rpc } from "@opencode/plugin/rpc";
2
+ /**
3
+ * Общее определение RPC-контракта между серверной частью плагина (src/index.ts)
4
+ * и GUI-панелью (src/gui.tsx).
5
+ *
6
+ * Сервер регистрирует обработчики через ctx.rpc.register(SchedulerRpc, handlers).
7
+ * GUI вызывает методы через ctx.client.rpc(SchedulerRpc).<имя>(аргументы).
8
+ *
9
+ * Схемы ввода/вывода — чистый JSON Schema (не Zod), чтобы сервер мог
10
+ * надёжно кодировать/декодировать ответы через RPC-мост.
11
+ */
12
+ /** Параметры MCP-события (triggerType === "mcp-event"). */
13
+ const McpEventSchema = {
14
+ type: ["object", "null"],
15
+ properties: {
16
+ server: { type: "string" },
17
+ event: { type: "string" },
18
+ filter: { type: "string" },
19
+ },
20
+ required: ["server", "event"],
21
+ };
22
+ /** Настройки matrix (fan-out, Спринт 15). */
23
+ const MatrixSchema = {
24
+ type: ["object", "null"],
25
+ properties: {
26
+ workspaceIds: { type: "array", items: { type: "string" } },
27
+ strategy: { type: ["string", "null"] },
28
+ failureMode: { type: ["string", "null"] },
29
+ aggregation: { type: ["string", "null"] },
30
+ createAggregator: { type: ["boolean", "null"] },
31
+ /** Лимит одновременных клонов матрицы (Спринт 17). */
32
+ concurrency: { type: ["number", "null"] },
33
+ /** Per-workspace переопределения промпта/модели/хуков/QG (Спринт 17). */
34
+ overrides: {
35
+ type: ["object", "null"],
36
+ additionalProperties: {
37
+ type: "object",
38
+ properties: {
39
+ prompt: { type: ["string", "null"] },
40
+ model: { type: ["string", "null"] },
41
+ qualityGate: { type: ["string", "null"] },
42
+ beforeScript: { type: ["string", "null"] },
43
+ afterScript: { type: ["string", "null"] },
44
+ },
45
+ },
46
+ },
47
+ },
48
+ required: ["workspaceIds"],
49
+ };
50
+ /** Запись задачи, возвращаемая get_tasks. */
51
+ const TaskItem = {
52
+ type: "object",
53
+ properties: {
54
+ name: { type: "string" },
55
+ schedule: { type: "string" },
56
+ /** Hotfix 1.5.3.1: лимит времени задачи в секундах (null - по умолчанию). */
57
+ timeoutSeconds: { type: ["number", "null"] },
58
+ status: { type: "string" },
59
+ nextRun: { type: ["string", "null"] },
60
+ /** LLM-модель задачи (null — модель OpenCode по умолчанию). */
61
+ model: { type: ["string", "null"] },
62
+ /** Приоритет задачи 0..10 (10 — наивысший). */
63
+ priority: { type: ["number", "null"] },
64
+ /** Количество повторов при ошибке (опционально). */
65
+ retryCount: { type: ["number", "null"] },
66
+ /** Задержка перед повтором в секундах (опционально). */
67
+ retryDelay: { type: ["number", "null"] },
68
+ /** Проверочная команда после успешного ответа ИИ. */
69
+ qualityGate: { type: ["string", "null"] },
70
+ /** Задача, запускаемая при успехе. */
71
+ nextTaskOnSuccess: { type: ["string", "null"] },
72
+ /** Компенсирующая задача, запускаемая при ошибке. */
73
+ nextTaskOnError: { type: ["string", "null"] },
74
+ /** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
75
+ dependsOn: { type: "array", items: { type: "string" } },
76
+ /** Промпт задачи (для заполнения формы редактирования). */
77
+ prompt: { type: "string" },
78
+ /** Pre-flight команда (null — не задана). */
79
+ beforeScript: { type: ["string", "null"] },
80
+ /** Post-flight команда (null — не задана). */
81
+ afterScript: { type: ["string", "null"] },
82
+ /** Тип триггера: "cron" (по умолчанию), "file", "mcp-event" или "once". */
83
+ triggerType: { type: ["string", "null"] },
84
+ /** Время разового запуска (triggerType === "once"), ISO-8601; null для остальных. */
85
+ runAt: { type: ["string", "null"] },
86
+ /** Режим сессии OpenCode (Спринт 24): "new" (по умолчанию), "reuse" (--session), "last" (--continue). */
87
+ session: { type: ["string", "null"] },
88
+ /** Идентификатор переиспользуемой сессии (только для session === "reuse"); null для остальных. */
89
+ sessionId: { type: ["string", "null"] },
90
+ /** Сколько запусков переживает reuse-сессия до ротации; null — без ограничения. */
91
+ sessionMaxRuns: { type: ["number", "null"] },
92
+ /** Параметры MCP-события (null — не MCP-триггер). */
93
+ mcpEvent: McpEventSchema,
94
+ /** Путь к файлу/папке для файлового триггера. */
95
+ watchPath: { type: ["string", "null"] },
96
+ /** IANA-часовой пояс задачи (Спринт 19; null — системный). */
97
+ timezone: { type: ["string", "null"] },
98
+ /** Начало окна запуска "HH:MM" (null — без окна). */
99
+ notBefore: { type: ["string", "null"] },
100
+ /** Конец окна запуска "HH:MM" (null — без окна). */
101
+ notAfter: { type: ["string", "null"] },
102
+ /** Спринт 27: разрешённые дни недели 0=Вс..6=Сб (null — все дни). */
103
+ activeDays: {
104
+ type: ["array", "null"],
105
+ items: { type: "number" },
106
+ },
107
+ /** Поведение вне окна: skip, postpone или run (null — postpone). */
108
+ windowPolicy: { type: ["string", "null"] },
109
+ /** Glob-маски файлового триггера (null — без ограничения). */
110
+ watchGlobs: {
111
+ type: ["array", "null"],
112
+ items: { type: "string" },
113
+ },
114
+ /** Glob-маски исключений файлового триггера. */
115
+ watchIgnore: {
116
+ type: ["array", "null"],
117
+ items: { type: "string" },
118
+ },
119
+ /** Git-триггер: фильтр ветки (glob, через запятую). */
120
+ gitBranch: { type: ["string", "null"] },
121
+ /** Git-триггер: маски путей, изменения в которых запускают задачу. */
122
+ gitPaths: {
123
+ type: ["array", "null"],
124
+ items: { type: "string" },
125
+ },
126
+ /** Git-триггер: маски игнорируемых путей. */
127
+ gitIgnore: {
128
+ type: ["array", "null"],
129
+ items: { type: "string" },
130
+ },
131
+ /** Git-триггер: период опроса в секундах (null — 60). */
132
+ gitPollSeconds: { type: ["number", "null"] },
133
+ /** Пауза до даты в ISO (null — автопродолжение не запланировано). */
134
+ pausedUntil: { type: ["string", "null"] },
135
+ /** Рабочая директория задачи (null — папка проекта по умолчанию). */
136
+ workingDirectory: { type: ["string", "null"] },
137
+ /** Привязка к multi-repo workspace (null — без workspace). */
138
+ workspaceId: { type: ["string", "null"] },
139
+ /** Имя workspace для отображения (null — без workspace). */
140
+ workspaceName: { type: ["string", "null"] },
141
+ /** Цвет маркера workspace. */
142
+ workspaceColor: { type: ["string", "null"] },
143
+ /** Белый список инструментов задачи (role-scoped, null — без ограничений). */
144
+ allowedTools: { type: ["array", "null"], items: { type: "string" } },
145
+ /** Чёрный список инструментов задачи (приоритет над allowedTools). */
146
+ deniedTools: { type: ["array", "null"], items: { type: "string" } },
147
+ /** Matrix-настройки родителя (null — обычная задача). */
148
+ matrix: MatrixSchema,
149
+ /** Для клона матрицы — имя родителя (null — не клон). */
150
+ matrixParentId: { type: ["string", "null"] },
151
+ /** true — задача является родителем матрицы. */
152
+ isMatrixParent: { type: "boolean" },
153
+ /** true — задача поставлена на паузу (disabled в планировщике ОС). */
154
+ paused: { type: "boolean" },
155
+ /** true — определение есть в БД, но задачи нет в планировщике ОС. */
156
+ orphaned: { type: "boolean" },
157
+ /** Всего запусков именно этой задачи. */
158
+ runsTotal: { type: "number" },
159
+ /** Успешных запусков этой задачи. */
160
+ runsSuccess: { type: "number" },
161
+ /** Ошибок и таймаутов этой задачи. */
162
+ runsError: { type: "number" },
163
+ /** Частичных выполнений этой задачи (partial). */
164
+ runsPartial: { type: "number" },
165
+ /** Агрегат по клонам для родителя (null — не матрица). */
166
+ matrixSummary: {
167
+ type: ["object", "null"],
168
+ properties: {
169
+ totalCount: { type: "number" },
170
+ successCount: { type: "number" },
171
+ errorCount: { type: "number" },
172
+ pendingCount: { type: "number" },
173
+ status: { type: "string" },
174
+ message: { type: "string" },
175
+ },
176
+ },
177
+ },
178
+ required: ["name", "schedule", "status"],
179
+ };
180
+ const GetTasksInput = {
181
+ type: "object",
182
+ properties: {},
183
+ additionalProperties: false,
184
+ };
185
+ const GetTasksOutput = {
186
+ type: "object",
187
+ properties: {
188
+ tasks: {
189
+ type: "array",
190
+ items: TaskItem,
191
+ },
192
+ },
193
+ required: ["tasks"],
194
+ };
195
+ const CreateTaskInput = {
196
+ type: "object",
197
+ properties: {
198
+ name: { type: "string" },
199
+ schedule: { type: "string" },
200
+ prompt: { type: "string" },
201
+ /** LLM-модель (например, anthropic/claude-3-5-sonnet). */
202
+ model: { type: "string" },
203
+ /** Приоритет задачи 0..10 (10 — наивысший). */
204
+ priority: { type: "number" },
205
+ /** Сколько раз повторять при ошибке (по умолчанию 0). */
206
+ retryCount: { type: "number" },
207
+ /** Задержка перед повтором в секундах (по умолчанию 60). */
208
+ retryDelay: { type: "number" },
209
+ /** Проверочная команда (Quality Gate), выполняется после успешного ответа ИИ. */
210
+ qualityGate: { type: "string" },
211
+ /** Имя задачи, запускаемой при успехе. */
212
+ nextTaskOnSuccess: { type: "string" },
213
+ /** Имя компенсирующей задачи, запускаемой при ошибке. */
214
+ nextTaskOnError: { type: "string" },
215
+ /** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
216
+ dependsOn: { type: "array", items: { type: "string" } },
217
+ /** Команда перед запуском (pre-flight). */
218
+ beforeScript: { type: "string" },
219
+ /** Команда после запуска (post-flight). */
220
+ afterScript: { type: "string" },
221
+ /** Тип триггера: "cron" (по умолчанию; нужен schedule), "file", "mcp-event" или "once" (нужен runAt либо delaySeconds). */
222
+ triggerType: { type: "string" },
223
+ /** Время разового запуска (triggerType === "once"), ISO-8601. Взаимоисключает schedule/newSchedule. */
224
+ runAt: { type: "string" },
225
+ /** Отложенный разовый запуск через N секунд (triggerType === "once"). Взаимоисключает runAt. */
226
+ delaySeconds: { type: "number" },
227
+ /** Режим сессии OpenCode (Спринт 24): "new" (по умолчанию), "reuse" (--session <id>), "last" (--continue). sessionId генерируется плагином. */
228
+ session: { type: "string" },
229
+ /** Сколько запусков переживает reuse-сессия до ротации (удаление и чистый старт). 0/не задано — без ограничения. */
230
+ sessionMaxRuns: { type: "number" },
231
+ /** Параметры MCP-события. */
232
+ mcpEvent: McpEventSchema,
233
+ /** Путь к файлу/папке для файлового триггера. */
234
+ watchPath: { type: "string" },
235
+ /** Привязка к multi-repo workspace. */
236
+ workspaceId: { type: "string" },
237
+ /** Рабочая директория задачи (по умолчанию — папка проекта). */
238
+ workingDirectory: { type: "string" },
239
+ /** Белый список инструментов задачи (role-scoped, enforced through OPENCODE_CONFIG_CONTENT). Пустой массив запрещён. */
240
+ allowedTools: { type: "array", items: { type: "string" } },
241
+ /** Чёрный список инструментов задачи (приоритет над allowedTools и политикой). Enforced. */
242
+ deniedTools: { type: "array", items: { type: "string" } },
243
+ /** Matrix (fan-out): раскладывает задачу-шаблон на клоны по workspace. */
244
+ matrix: MatrixSchema,
245
+ /** IANA-часовой пояс задачи (например, Europe/Moscow). Пусто — системный. */
246
+ timezone: { type: "string" },
247
+ /** Начало окна запуска "HH:MM"; вне окна запуск переносится. */
248
+ notBefore: { type: "string" },
249
+ /** Конец окна запуска "HH:MM"; может быть меньше notBefore (через полночь). */
250
+ notAfter: { type: "string" },
251
+ /** Спринт 27: разрешённые дни недели 0=Вс..6=Сб. Пусто — все дни. */
252
+ activeDays: { type: "array", items: { type: "number" } },
253
+ /** Поведение вне окна/дня: postpone (по умолчанию), skip или run. */
254
+ windowPolicy: { type: "string" },
255
+ /** Glob-маски файлового триггера (например, src/** и *.md). */
256
+ watchGlobs: { type: "array", items: { type: "string" } },
257
+ /** Glob-маски исключений файлового триггера. */
258
+ watchIgnore: { type: "array", items: { type: "string" } },
259
+ /** Git-триггер: ветка или glob (main, release/*), через запятую. */
260
+ gitBranch: { type: "string" },
261
+ /** Git-триггер: маски изменённых файлов, при которых задача запускается. */
262
+ gitPaths: { type: "array", items: { type: "string" } },
263
+ /** Git-триггер: маски изменённых файлов, которые игнорируются. */
264
+ gitIgnore: { type: "array", items: { type: "string" } },
265
+ /** Git-триггер: период опроса в секундах (минимум 5, по умолчанию 60). */
266
+ gitPollSeconds: { type: "number" },
267
+ },
268
+ required: ["name", "prompt"],
269
+ };
270
+ const CreateTaskOutput = {
271
+ type: "object",
272
+ properties: {
273
+ success: { type: "boolean" },
274
+ message: { type: "string" },
275
+ },
276
+ required: ["success", "message"],
277
+ };
278
+ const NameOnly = {
279
+ type: "object",
280
+ properties: {
281
+ name: { type: "string" },
282
+ },
283
+ required: ["name"],
284
+ };
285
+ const DeleteTaskInput = NameOnly;
286
+ const RunTaskInput = NameOnly;
287
+ const DeleteTaskOutput = {
288
+ type: "object",
289
+ properties: {
290
+ success: { type: "boolean" },
291
+ message: { type: "string" },
292
+ },
293
+ required: ["success", "message"],
294
+ };
295
+ const RunTaskOutput = DeleteTaskOutput;
296
+ const GetTaskLogsInput = NameOnly;
297
+ const GetTaskLogsOutput = {
298
+ type: "object",
299
+ properties: {
300
+ success: { type: "boolean" },
301
+ logs: { type: "string" },
302
+ error: { type: "string" },
303
+ },
304
+ required: ["success", "logs"],
305
+ };
306
+ const HistoryRecord = {
307
+ type: "object",
308
+ properties: {
309
+ taskName: { type: "string" },
310
+ status: { type: "string" },
311
+ startedAt: { type: "string" },
312
+ finishedAt: { type: "string" },
313
+ durationMs: { type: "number" },
314
+ error: { type: ["string", "null"] },
315
+ nextTask: { type: ["string", "null"] },
316
+ /** LLM-модель, использованная в запуске. */
317
+ model: { type: ["string", "null"] },
318
+ /** Итог pre-flight: success / error / skipped. */
319
+ preFlightStatus: { type: ["string", "null"] },
320
+ /** Итог post-flight: success / error / skipped. */
321
+ postFlightStatus: { type: ["string", "null"] },
322
+ /** Ограничения инструментов, действовавшие на момент запуска. */
323
+ allowedTools: { type: ["array", "null"], items: { type: "string" } },
324
+ deniedTools: { type: ["array", "null"], items: { type: "string" } },
325
+ },
326
+ required: ["taskName", "status", "startedAt", "finishedAt", "durationMs", "error"],
327
+ };
328
+ const GetHistoryInput = {
329
+ type: "object",
330
+ properties: {
331
+ /** Сколько последних записей вернуть (по умолчанию 20, максимум 200). */
332
+ limit: { type: "number" },
333
+ /** Фильтр по имени задачи (регистр не важен). */
334
+ taskName: { type: "string" },
335
+ /** Фильтр по статусу: success | error | partial | running | timeout. */
336
+ status: { type: "string" },
337
+ },
338
+ additionalProperties: false,
339
+ };
340
+ const GetHistoryOutput = {
341
+ type: "object",
342
+ properties: {
343
+ records: {
344
+ type: "array",
345
+ items: HistoryRecord,
346
+ },
347
+ },
348
+ required: ["records"],
349
+ };
350
+ const Metrics = {
351
+ type: "object",
352
+ properties: {
353
+ total: { type: "number" },
354
+ success: { type: "number" },
355
+ error: { type: "number" },
356
+ },
357
+ required: ["total", "success", "error"],
358
+ };
359
+ const GetMetricsInput = {
360
+ type: "object",
361
+ properties: {},
362
+ additionalProperties: false,
363
+ };
364
+ const GetMetricsOutput = Metrics;
365
+ const GetDashboardPortInput = {
366
+ type: "object",
367
+ properties: {},
368
+ additionalProperties: false,
369
+ };
370
+ const GetDashboardPortOutput = {
371
+ type: "object",
372
+ properties: {
373
+ /** Фактический порт дашборда (null, если сервер ещё не поднялся). */
374
+ port: { type: ["number", "null"] },
375
+ },
376
+ required: ["port"],
377
+ };
378
+ const GetPlatformInput = {
379
+ type: "object",
380
+ properties: {},
381
+ additionalProperties: false,
382
+ };
383
+ const GetPlatformOutput = {
384
+ type: "object",
385
+ properties: {
386
+ /** process.platform: 'win32' | 'darwin' | 'linux' | ... */
387
+ platform: { type: "string" },
388
+ /** Название планировщика для заголовка GUI. */
389
+ title: { type: "string" },
390
+ },
391
+ required: ["platform", "title"],
392
+ };
393
+ const ExportTasksInput = {
394
+ type: "object",
395
+ properties: {},
396
+ additionalProperties: false,
397
+ };
398
+ const ExportTasksOutput = {
399
+ type: "object",
400
+ properties: {
401
+ success: { type: "boolean" },
402
+ data: { type: "string" },
403
+ count: { type: "number" },
404
+ error: { type: "string" },
405
+ },
406
+ required: ["success"],
407
+ };
408
+ const ImportTasksInput = {
409
+ type: "object",
410
+ properties: {
411
+ data: { type: "string" },
412
+ },
413
+ required: ["data"],
414
+ };
415
+ const ImportTasksOutput = {
416
+ type: "object",
417
+ properties: {
418
+ success: { type: "boolean" },
419
+ imported: { type: "number" },
420
+ errors: { type: "array", items: { type: "string" } },
421
+ error: { type: "string" },
422
+ },
423
+ required: ["success"],
424
+ };
425
+ const GetSettingsInput = {
426
+ type: "object",
427
+ properties: {},
428
+ additionalProperties: false,
429
+ };
430
+ /** Настройки уведомлений: webhook, шаблоны, фильтры, матрицы и дайджест (Спринт 20). */
431
+ const NotificationSettingsSchema = {
432
+ type: "object",
433
+ properties: {
434
+ enabled: { type: "boolean" },
435
+ onlyOnError: { type: "boolean" },
436
+ webhook: {
437
+ type: "object",
438
+ properties: {
439
+ enabled: { type: "boolean" },
440
+ url: { type: "string" },
441
+ timeoutMs: { type: "number" },
442
+ retryCount: { type: "number" },
443
+ retryDelayMs: { type: "number" },
444
+ },
445
+ required: ["enabled", "url"],
446
+ },
447
+ templates: {
448
+ type: "object",
449
+ properties: {
450
+ success: { type: "string" },
451
+ error: { type: "string" },
452
+ },
453
+ required: ["success", "error"],
454
+ },
455
+ filters: {
456
+ type: "object",
457
+ properties: {
458
+ include: { type: "array", items: { type: "string" } },
459
+ exclude: { type: "array", items: { type: "string" } },
460
+ },
461
+ required: ["include", "exclude"],
462
+ },
463
+ telegram: {
464
+ type: "object",
465
+ properties: {
466
+ enabled: { type: "boolean" },
467
+ botToken: { type: "string" },
468
+ chatId: { type: "string" },
469
+ parseMode: {
470
+ type: "string",
471
+ enum: ["", "HTML", "Markdown", "MarkdownV2"],
472
+ },
473
+ disableNotification: { type: "boolean" },
474
+ messageThreadId: { type: ["number", "null"] },
475
+ includeDashboardLink: { type: "boolean" },
476
+ apiBase: { type: "string" },
477
+ },
478
+ required: ["enabled"],
479
+ },
480
+ native: {
481
+ type: "object",
482
+ properties: {
483
+ enabled: { type: "boolean" },
484
+ sound: { type: "boolean" },
485
+ },
486
+ required: ["enabled"],
487
+ },
488
+ quietHours: {
489
+ type: "object",
490
+ properties: {
491
+ enabled: { type: "boolean" },
492
+ from: { type: "string" },
493
+ to: { type: "string" },
494
+ },
495
+ required: ["enabled", "from", "to"],
496
+ },
497
+ dashboardUrl: { type: "string" },
498
+ matrix: {
499
+ type: "object",
500
+ properties: {
501
+ enabled: { type: "boolean" },
502
+ onPartial: { type: "boolean" },
503
+ onAllFailed: { type: "boolean" },
504
+ stuckAfterMinutes: { type: "number" },
505
+ },
506
+ required: ["enabled", "onPartial", "onAllFailed", "stuckAfterMinutes"],
507
+ },
508
+ digest: {
509
+ type: "object",
510
+ properties: {
511
+ enabled: { type: "boolean" },
512
+ frequency: { type: "string", enum: ["daily", "weekly"] },
513
+ time: { type: "string" },
514
+ lastSentAt: { type: ["string", "null"] },
515
+ },
516
+ required: ["enabled", "frequency", "time"],
517
+ },
518
+ triage: {
519
+ type: "object",
520
+ properties: {
521
+ mode: { type: "string", enum: ["off", "rules", "llm", "auto"] },
522
+ baseUrl: { type: "string" },
523
+ model: { type: "string" },
524
+ timeoutMs: { type: "number" },
525
+ fallback: { type: "string", enum: ["rules", "notify", "skip"] },
526
+ confidenceThreshold: { type: "number" },
527
+ rules: {
528
+ type: "array",
529
+ items: {
530
+ type: "object",
531
+ properties: {
532
+ id: { type: "string" },
533
+ field: {
534
+ type: "string",
535
+ enum: ["status", "task", "error", "cost"],
536
+ },
537
+ operator: {
538
+ type: "string",
539
+ enum: ["equals", "contains", "regex", "gt", "lt", "gte", "lte"],
540
+ },
541
+ value: { type: ["string", "number"] },
542
+ category: {
543
+ type: "string",
544
+ enum: ["quality", "timeout", "permission", "network", "unknown"],
545
+ },
546
+ severity: { type: "string", enum: ["low", "medium", "high"] },
547
+ confidence: { type: "number" },
548
+ action: { type: "string", enum: ["notify", "skip"] },
549
+ reason: { type: "string" },
550
+ priority: { type: "number" },
551
+ },
552
+ required: ["field", "operator", "value"],
553
+ },
554
+ },
555
+ shadow: {
556
+ type: "object",
557
+ properties: {
558
+ enabled: { type: "boolean" },
559
+ days: { type: "number" },
560
+ startedAt: { type: ["string", "null"] },
561
+ },
562
+ required: ["enabled", "days", "startedAt"],
563
+ },
564
+ },
565
+ required: [
566
+ "mode",
567
+ "baseUrl",
568
+ "model",
569
+ "timeoutMs",
570
+ "fallback",
571
+ "confidenceThreshold",
572
+ ],
573
+ },
574
+ },
575
+ required: ["enabled", "onlyOnError"],
576
+ };
577
+ /** Ретеншн истории (Спринт 18). */
578
+ const HistorySettingsSchema = {
579
+ type: "object",
580
+ properties: {
581
+ retentionDays: { type: "number" },
582
+ maxRecords: { type: "number" },
583
+ lastCleanupAt: { type: ["string", "null"] },
584
+ lastCleanupDeleted: { type: "number" },
585
+ },
586
+ required: ["retentionDays", "maxRecords"],
587
+ };
588
+ /** Журнал аудита (Спринт 26). */
589
+ const AuditSettingsSchema = {
590
+ type: "object",
591
+ properties: {
592
+ enabled: { type: "boolean" },
593
+ retentionDays: { type: "number" },
594
+ maxRecords: { type: "number" },
595
+ },
596
+ required: ["enabled", "retentionDays", "maxRecords"],
597
+ };
598
+ /** Политика прав фоновых задач (Спринт 32). */
599
+ const PermissionSettingsSchema = {
600
+ type: "object",
601
+ properties: {
602
+ defaultPolicy: {
603
+ type: "string",
604
+ enum: ["hybrid", "secure", "legacy"],
605
+ },
606
+ },
607
+ required: ["defaultPolicy"],
608
+ };
609
+ const GetSettingsOutput = {
610
+ type: "object",
611
+ properties: {
612
+ maxConcurrent: { type: "number" },
613
+ locale: { type: "string", enum: ["auto", "ru", "en", "zh"] },
614
+ uiLocale: { type: "string", enum: ["ru", "en", "zh"] },
615
+ winterMode: { type: "boolean" },
616
+ notifications: NotificationSettingsSchema,
617
+ history: HistorySettingsSchema,
618
+ audit: AuditSettingsSchema,
619
+ permissions: PermissionSettingsSchema,
620
+ },
621
+ required: ["maxConcurrent", "locale", "winterMode", "notifications"],
622
+ };
623
+ const SaveSettingsInput = {
624
+ type: "object",
625
+ properties: {
626
+ maxConcurrent: { type: "number" },
627
+ /** Язык интерфейса (Спринт 28): ru по умолчанию, en — опционально. */
628
+ locale: { type: "string", enum: ["auto", "ru", "en", "zh"] },
629
+ uiLocale: { type: "string", enum: ["ru", "en", "zh"] },
630
+ winterMode: { type: "boolean" },
631
+ notifications: NotificationSettingsSchema,
632
+ history: HistorySettingsSchema,
633
+ audit: AuditSettingsSchema,
634
+ permissions: PermissionSettingsSchema,
635
+ },
636
+ additionalProperties: false,
637
+ };
638
+ const SaveSettingsOutput = {
639
+ type: "object",
640
+ properties: {
641
+ success: { type: "boolean" },
642
+ maxConcurrent: { type: "number" },
643
+ locale: { type: "string", enum: ["auto", "ru", "en", "zh"] },
644
+ uiLocale: { type: "string", enum: ["ru", "en", "zh"] },
645
+ winterMode: { type: "boolean" },
646
+ notifications: NotificationSettingsSchema,
647
+ history: HistorySettingsSchema,
648
+ audit: AuditSettingsSchema,
649
+ permissions: PermissionSettingsSchema,
650
+ },
651
+ required: ["success", "maxConcurrent", "locale", "winterMode", "notifications"],
652
+ };
653
+ const CleanupHistoryInput = {
654
+ type: "object",
655
+ properties: {
656
+ /** Удалять записи старше N дней (0 — выключить ограничение по возрасту). */
657
+ retentionDays: { type: "number" },
658
+ /** Хранить не более N записей (0 — без ограничения). */
659
+ maxRecords: { type: "number" },
660
+ },
661
+ additionalProperties: false,
662
+ };
663
+ const CleanupHistoryOutput = {
664
+ type: "object",
665
+ properties: {
666
+ success: { type: "boolean" },
667
+ message: { type: "string" },
668
+ deleted: { type: "number" },
669
+ deletedByAge: { type: "number" },
670
+ deletedByCount: { type: "number" },
671
+ kept: { type: "number" },
672
+ retentionDays: { type: "number" },
673
+ maxRecords: { type: "number" },
674
+ vacuumed: { type: "boolean" },
675
+ },
676
+ required: ["success", "message", "deleted", "kept"],
677
+ };
678
+ const GetAnalyticsInput = {
679
+ type: "object",
680
+ properties: {
681
+ /** Окно анализа в днях (по умолчанию 14, максимум 365). */
682
+ days: { type: "number" },
683
+ /** Сколько строк в топах (по умолчанию 10). */
684
+ topLimit: { type: "number" },
685
+ },
686
+ additionalProperties: false,
687
+ };
688
+ const GetAnalyticsOutput = {
689
+ type: "object",
690
+ properties: {
691
+ success: { type: "boolean" },
692
+ // null при ошибке: report формируется только при success=true.
693
+ report: { type: ["object", "null"] },
694
+ error: { type: "string" },
695
+ },
696
+ required: ["success", "report"],
697
+ };
698
+ const SelfAnalysisInput = {
699
+ type: "object",
700
+ properties: {
701
+ /** Окно анализа в днях (по умолчанию 14, максимум 365). */
702
+ days: { type: "number" },
703
+ /** Сколько строк в топах (по умолчанию 10). */
704
+ topLimit: { type: "number" },
705
+ /** Включить обнаружение аномалий (по умолчанию true). */
706
+ includeAnomalies: { type: "boolean" },
707
+ /** Включить анализ трендов (по умолчанию true). */
708
+ includeTrends: { type: "boolean" },
709
+ /** Включить рекомендации (по умолчанию true). */
710
+ includeRecommendations: { type: "boolean" },
711
+ },
712
+ additionalProperties: false,
713
+ };
714
+ const SelfAnalysisOutput = {
715
+ type: "object",
716
+ properties: {
717
+ success: { type: "boolean" },
718
+ // null при ошибке: report формируется только при success=true.
719
+ report: { type: ["object", "null"] },
720
+ error: { type: "string" },
721
+ },
722
+ required: ["success", "report"],
723
+ };
724
+ const TestNotificationInput = {
725
+ type: "object",
726
+ properties: {},
727
+ additionalProperties: false,
728
+ };
729
+ const TestNotificationOutput = {
730
+ type: "object",
731
+ properties: {
732
+ success: { type: "boolean" },
733
+ message: { type: "string" },
734
+ },
735
+ required: ["success", "message"],
736
+ };
737
+ /** Ручная отправка дайджеста (Спринт 20); не сдвигает плановое расписание. */
738
+ const SendDigestInput = {
739
+ type: "object",
740
+ properties: {},
741
+ additionalProperties: false,
742
+ };
743
+ const SendDigestOutput = {
744
+ type: "object",
745
+ properties: {
746
+ success: { type: "boolean" },
747
+ message: { type: "string" },
748
+ },
749
+ required: ["success", "message"],
750
+ };
751
+ /** Секрет: имя и маскированный превью, значение никогда не возвращается. */
752
+ const SecretItem = {
753
+ type: "object",
754
+ properties: {
755
+ name: { type: "string" },
756
+ preview: { type: "string" },
757
+ updatedAt: { type: "string" },
758
+ },
759
+ required: ["name", "preview"],
760
+ };
761
+ const ListSecretsInput = {
762
+ type: "object",
763
+ properties: {},
764
+ additionalProperties: false,
765
+ };
766
+ const ListSecretsOutput = {
767
+ type: "object",
768
+ properties: {
769
+ success: { type: "boolean" },
770
+ secrets: { type: "array", items: SecretItem },
771
+ },
772
+ required: ["success", "secrets"],
773
+ };
774
+ const SaveSecretInput = {
775
+ type: "object",
776
+ properties: {
777
+ name: { type: "string" },
778
+ value: { type: "string" },
779
+ },
780
+ required: ["name", "value"],
781
+ additionalProperties: false,
782
+ };
783
+ const SaveSecretOutput = {
784
+ type: "object",
785
+ properties: {
786
+ success: { type: "boolean" },
787
+ message: { type: "string" },
788
+ secret: SecretItem,
789
+ },
790
+ required: ["success"],
791
+ };
792
+ const DeleteSecretInput = {
793
+ type: "object",
794
+ properties: {
795
+ name: { type: "string" },
796
+ },
797
+ required: ["name"],
798
+ additionalProperties: false,
799
+ };
800
+ const DeleteSecretOutput = {
801
+ type: "object",
802
+ properties: {
803
+ success: { type: "boolean" },
804
+ message: { type: "string" },
805
+ },
806
+ required: ["success", "message"],
807
+ };
808
+ /** Запись журнала аудита (Спринт 26). */
809
+ const AuditRecordSchema = {
810
+ type: "object",
811
+ properties: {
812
+ id: { type: "number" },
813
+ ts: { type: "string" },
814
+ action: { type: "string" },
815
+ targetType: { type: ["string", "null"] },
816
+ target: { type: ["string", "null"] },
817
+ actor: { type: "string" },
818
+ source: { type: ["string", "null"] },
819
+ details: {},
820
+ remote: { type: ["string", "null"] },
821
+ },
822
+ required: ["id", "ts", "action", "actor"],
823
+ };
824
+ const GetAuditInput = {
825
+ type: "object",
826
+ properties: {
827
+ action: { type: "string" },
828
+ target: { type: "string" },
829
+ actor: { type: "string" },
830
+ since: { type: "string" },
831
+ until: { type: "string" },
832
+ limit: { type: "number" },
833
+ },
834
+ additionalProperties: false,
835
+ };
836
+ const GetAuditOutput = {
837
+ type: "object",
838
+ properties: {
839
+ success: { type: "boolean" },
840
+ records: { type: "array", items: AuditRecordSchema },
841
+ total: { type: "number" },
842
+ },
843
+ required: ["success", "records", "total"],
844
+ };
845
+ /** Сравнение триажа «до/после» (Спринт 31.5). */
846
+ const CompareTriageInput = {
847
+ type: "object",
848
+ properties: {
849
+ taskName: { type: "string" },
850
+ status: { type: "string" },
851
+ error: { type: ["string", "null"] },
852
+ durationMs: { type: "number" },
853
+ tokens: { type: "number" },
854
+ costUsd: { type: "number" },
855
+ before: { type: ["object", "null"] },
856
+ after: { type: ["object", "null"] },
857
+ dedupCount: { type: "number" },
858
+ },
859
+ required: ["taskName", "status"],
860
+ additionalProperties: false,
861
+ };
862
+ const CompareTriageOutput = {
863
+ type: "object",
864
+ properties: {
865
+ success: { type: "boolean" },
866
+ result: { type: "object" },
867
+ error: { type: "string" },
868
+ },
869
+ required: ["success", "result"],
870
+ additionalProperties: false,
871
+ };
872
+ const TemplateItem = {
873
+ type: "object",
874
+ properties: {
875
+ id: { type: "string" },
876
+ name: { type: "string" },
877
+ prompt: { type: "string" },
878
+ schedule: { type: "string" },
879
+ timeoutSeconds: { type: "number" },
880
+ /** LLM-модель шаблона. */
881
+ model: { type: "string" },
882
+ /** Приоритет задачи 0..10. */
883
+ priority: { type: "number" },
884
+ retryCount: { type: "number" },
885
+ retryDelay: { type: "number" },
886
+ qualityGate: { type: "string" },
887
+ nextTaskOnSuccess: { type: "string" },
888
+ nextTaskOnError: { type: "string" },
889
+ /** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
890
+ dependsOn: { type: "array", items: { type: "string" } },
891
+ beforeScript: { type: "string" },
892
+ afterScript: { type: "string" },
893
+ triggerType: { type: "string" },
894
+ mcpEvent: McpEventSchema,
895
+ watchPath: { type: "string" },
896
+ /** Спринт 27: glob-маски и исключения файлового триггера. */
897
+ watchGlobs: { type: "array", items: { type: "string" } },
898
+ watchIgnore: { type: "array", items: { type: "string" } },
899
+ /** Спринт 27: git-триггер и дни/политика окна. */
900
+ gitBranch: { type: "string" },
901
+ gitPaths: { type: "array", items: { type: "string" } },
902
+ gitIgnore: { type: "array", items: { type: "string" } },
903
+ gitPollSeconds: { type: "number" },
904
+ activeDays: { type: "array", items: { type: "number" } },
905
+ windowPolicy: { type: "string" },
906
+ workspaceId: { type: "string" },
907
+ workingDirectory: { type: "string" },
908
+ /** Белый список инструментов задачи (role-scoped, metadata-only). */
909
+ allowedTools: { type: "array", items: { type: "string" } },
910
+ /** Чёрный список инструментов задачи (приоритет над allowedTools). */
911
+ deniedTools: { type: "array", items: { type: "string" } },
912
+ },
913
+ required: ["id", "name", "prompt"],
914
+ };
915
+ const GetTemplatesInput = {
916
+ type: "object",
917
+ properties: {},
918
+ additionalProperties: false,
919
+ };
920
+ const GetTemplatesOutput = {
921
+ type: "object",
922
+ properties: {
923
+ templates: {
924
+ type: "array",
925
+ items: TemplateItem,
926
+ },
927
+ },
928
+ required: ["templates"],
929
+ };
930
+ const SaveTemplateInput = {
931
+ type: "object",
932
+ properties: {
933
+ id: { type: "string" },
934
+ name: { type: "string" },
935
+ prompt: { type: "string" },
936
+ schedule: { type: "string" },
937
+ timeoutSeconds: { type: "number" },
938
+ /** LLM-модель шаблона. */
939
+ model: { type: "string" },
940
+ /** Приоритет задачи 0..10. */
941
+ priority: { type: "number" },
942
+ retryCount: { type: "number" },
943
+ retryDelay: { type: "number" },
944
+ qualityGate: { type: "string" },
945
+ nextTaskOnSuccess: { type: "string" },
946
+ nextTaskOnError: { type: "string" },
947
+ /** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
948
+ dependsOn: { type: "array", items: { type: "string" } },
949
+ beforeScript: { type: "string" },
950
+ afterScript: { type: "string" },
951
+ triggerType: { type: "string" },
952
+ mcpEvent: McpEventSchema,
953
+ watchPath: { type: "string" },
954
+ workspaceId: { type: "string" },
955
+ workingDirectory: { type: "string" },
956
+ /** Белый список инструментов шаблона (role-scoped). */
957
+ allowedTools: { type: "array", items: { type: "string" } },
958
+ /** Чёрный список инструментов шаблона. */
959
+ deniedTools: { type: "array", items: { type: "string" } },
960
+ },
961
+ required: ["name", "prompt"],
962
+ additionalProperties: false,
963
+ };
964
+ const SaveTemplateOutput = {
965
+ type: "object",
966
+ properties: {
967
+ success: { type: "boolean" },
968
+ template: TemplateItem,
969
+ error: { type: "string" },
970
+ },
971
+ required: ["success"],
972
+ };
973
+ const DeleteTemplateInput = {
974
+ type: "object",
975
+ properties: {
976
+ id: { type: "string" },
977
+ },
978
+ required: ["id"],
979
+ };
980
+ const DeleteTemplateOutput = {
981
+ type: "object",
982
+ properties: {
983
+ success: { type: "boolean" },
984
+ error: { type: "string" },
985
+ },
986
+ required: ["success"],
987
+ };
988
+ const PauseResumeInput = {
989
+ type: "object",
990
+ properties: {
991
+ name: { type: "string" },
992
+ /**
993
+ * Только для pause: пауза до указанного момента (ISO). Плагин включит
994
+ * задачу автоматически; пусто — бессрочная пауза.
995
+ */
996
+ until: { type: "string" },
997
+ },
998
+ required: ["name"],
999
+ };
1000
+ const UpdateTaskInput = {
1001
+ type: "object",
1002
+ properties: {
1003
+ name: { type: "string" },
1004
+ newSchedule: { type: "string" },
1005
+ newPrompt: { type: "string" },
1006
+ /** LLM-модель задачи. */
1007
+ model: { type: "string" },
1008
+ /** Приоритет задачи 0..10. */
1009
+ priority: { type: "number" },
1010
+ retryCount: { type: "number" },
1011
+ retryDelay: { type: "number" },
1012
+ qualityGate: { type: "string" },
1013
+ nextTaskOnSuccess: { type: "string" },
1014
+ nextTaskOnError: { type: "string" },
1015
+ /** DAG-зависимости: задачи, которые должны успешно завершиться раньше этой. */
1016
+ dependsOn: { type: "array", items: { type: "string" } },
1017
+ /** Команда перед запуском (pre-flight). */
1018
+ beforeScript: { type: "string" },
1019
+ /** Команда после запуска (post-flight). */
1020
+ afterScript: { type: "string" },
1021
+ /** Тип триггера: "cron" (по умолчанию; нужен schedule), "file", "mcp-event" или "once" (нужен runAt либо delaySeconds). */
1022
+ triggerType: { type: "string" },
1023
+ /** Время разового запуска (triggerType === "once"), ISO-8601. Взаимоисключает schedule/newSchedule. */
1024
+ runAt: { type: "string" },
1025
+ /** Отложенный разовый запуск через N секунд (triggerType === "once"). Взаимоисключает runAt. */
1026
+ delaySeconds: { type: "number" },
1027
+ /** Режим сессии OpenCode (Спринт 24): "new" (по умолчанию), "reuse" (--session <id>), "last" (--continue). sessionId генерируется плагином. */
1028
+ session: { type: "string" },
1029
+ /** Сколько запусков переживает reuse-сессия до ротации (удаление и чистый старт). 0/не задано — без ограничения. */
1030
+ sessionMaxRuns: { type: "number" },
1031
+ /** Параметры MCP-события. */
1032
+ mcpEvent: McpEventSchema,
1033
+ /** Путь к файлу/папке для файлового триггера. */
1034
+ watchPath: { type: "string" },
1035
+ /** Привязка к multi-repo workspace. */
1036
+ workspaceId: { type: "string" },
1037
+ /** Рабочая директория задачи (по умолчанию — папка проекта). */
1038
+ workingDirectory: { type: "string" },
1039
+ /** Белый список инструментов задачи (role-scoped). Пустой массив запрещён. */
1040
+ allowedTools: { type: "array", items: { type: "string" } },
1041
+ /** Чёрный список инструментов задачи (приоритет над allowedTools). */
1042
+ deniedTools: { type: "array", items: { type: "string" } },
1043
+ /** Matrix (fan-out): раскладывает задачу-шаблон на клоны по workspace. */
1044
+ matrix: MatrixSchema,
1045
+ /** IANA-часовой пояс задачи. Пустая строка — сбросить на системный. */
1046
+ timezone: { type: "string" },
1047
+ /** Начало окна запуска "HH:MM". Пустая строка — сбросить окно. */
1048
+ notBefore: { type: "string" },
1049
+ /** Конец окна запуска "HH:MM". Пустая строка — сбросить окно. */
1050
+ notAfter: { type: "string" },
1051
+ /** Спринт 27: дни недели 0=Вс..6=Сб. Пустой массив — снять ограничение. */
1052
+ activeDays: { type: "array", items: { type: "number" } },
1053
+ /** Поведение вне окна: postpone (по умолчанию), skip или run. */
1054
+ windowPolicy: { type: "string" },
1055
+ /** Glob-маски файлового триггера. Пустой массив — снять ограничение. */
1056
+ watchGlobs: { type: "array", items: { type: "string" } },
1057
+ /** Glob-маски исключений файлового триггера. Пустой массив — очистить. */
1058
+ watchIgnore: { type: "array", items: { type: "string" } },
1059
+ /** Git-триггер: фильтр ветки (glob, через запятую). Пустая строка — сбросить. */
1060
+ gitBranch: { type: "string" },
1061
+ /** Git-триггер: маски путей. Пустой массив — сбросить. */
1062
+ gitPaths: { type: "array", items: { type: "string" } },
1063
+ /** Git-триггер: маски игнорируемых путей. Пустой массив — очистить. */
1064
+ gitIgnore: { type: "array", items: { type: "string" } },
1065
+ /** Git-триггер: период опроса в секундах (минимум 5). */
1066
+ gitPollSeconds: { type: "number" },
1067
+ },
1068
+ required: ["name"],
1069
+ };
1070
+ const UpdateTaskOutput = DeleteTaskOutput;
1071
+ const WorkspaceItem = {
1072
+ type: "object",
1073
+ properties: {
1074
+ id: { type: "string" },
1075
+ name: { type: "string" },
1076
+ path: { type: "string" },
1077
+ gitRemote: { type: ["string", "null"] },
1078
+ gitBranch: { type: ["string", "null"] },
1079
+ color: { type: ["string", "null"] },
1080
+ /** Env-переменные workspace; значения секретов замаскированы (***). */
1081
+ env: { type: ["object", "null"], additionalProperties: { type: "string" } },
1082
+ /** Путь к .env-файлу workspace (null — не задан). */
1083
+ envFile: { type: ["string", "null"] },
1084
+ createdAt: { type: "string" },
1085
+ },
1086
+ required: ["id", "name", "path", "createdAt"],
1087
+ };
1088
+ const GetWorkspacesInput = {
1089
+ type: "object",
1090
+ properties: {},
1091
+ additionalProperties: false,
1092
+ };
1093
+ const GetWorkspacesOutput = {
1094
+ type: "object",
1095
+ properties: {
1096
+ workspaces: { type: "array", items: WorkspaceItem },
1097
+ },
1098
+ required: ["workspaces"],
1099
+ };
1100
+ const AddWorkspaceInput = {
1101
+ type: "object",
1102
+ properties: {
1103
+ name: { type: "string" },
1104
+ path: { type: "string" },
1105
+ color: { type: "string" },
1106
+ /** Env-переменные workspace (ключ → значение). */
1107
+ env: { type: ["object", "null"], additionalProperties: { type: "string" } },
1108
+ /** Путь к .env-файлу workspace. */
1109
+ envFile: { type: ["string", "null"] },
1110
+ },
1111
+ required: ["path"],
1112
+ additionalProperties: false,
1113
+ };
1114
+ const AddWorkspaceOutput = {
1115
+ type: "object",
1116
+ properties: {
1117
+ success: { type: "boolean" },
1118
+ workspace: WorkspaceItem,
1119
+ error: { type: "string" },
1120
+ },
1121
+ required: ["success"],
1122
+ };
1123
+ const UpdateWorkspaceInput = {
1124
+ type: "object",
1125
+ properties: {
1126
+ id: { type: "string" },
1127
+ name: { type: "string" },
1128
+ path: { type: "string" },
1129
+ color: { type: "string" },
1130
+ /** Env-переменные workspace; null — очистить, отсутствие — не менять. */
1131
+ env: { type: ["object", "null"], additionalProperties: { type: "string" } },
1132
+ /** Путь к .env-файлу; null — очистить. */
1133
+ envFile: { type: ["string", "null"] },
1134
+ },
1135
+ required: ["id"],
1136
+ additionalProperties: false,
1137
+ };
1138
+ const DeleteWorkspaceInput = {
1139
+ type: "object",
1140
+ properties: {
1141
+ id: { type: "string" },
1142
+ },
1143
+ required: ["id"],
1144
+ };
1145
+ const DeleteWorkspaceOutput = {
1146
+ type: "object",
1147
+ properties: {
1148
+ success: { type: "boolean" },
1149
+ message: { type: "string" },
1150
+ },
1151
+ required: ["success"],
1152
+ };
1153
+ const EmitEventInput = {
1154
+ type: "object",
1155
+ properties: {
1156
+ /** Имя события, например github.pr.opened. */
1157
+ eventName: { type: "string" },
1158
+ /** Произвольный payload события (используется фильтрами задач). */
1159
+ payload: { type: ["object", "null", "string", "number", "boolean", "array"] },
1160
+ },
1161
+ required: ["eventName"],
1162
+ };
1163
+ const EmitEventOutput = {
1164
+ type: "object",
1165
+ properties: {
1166
+ success: { type: "boolean" },
1167
+ message: { type: "string" },
1168
+ /** Задачи, запущенные по событию (в порядке приоритета). */
1169
+ triggered: { type: "array", items: { type: "string" } },
1170
+ },
1171
+ required: ["success", "triggered"],
1172
+ };
1173
+ const DryRunTaskItem = {
1174
+ type: "object",
1175
+ properties: {
1176
+ name: { type: "string" },
1177
+ /** Порядок выполнения в конвейере (0 — первый). */
1178
+ order: { type: "number" },
1179
+ /** Триггер запуска: manual (первая в конвейере), cron или dag (по dependsOn). */
1180
+ trigger: { type: "string" },
1181
+ /** Рабочая директория, в которой будет выполнена задача. */
1182
+ cwd: { type: "string" },
1183
+ /** Команда, которую фактически выполнит обёртка (без реального запуска). */
1184
+ command: { type: "string" },
1185
+ /** Workspace задачи (null — без workspace). */
1186
+ workspace: {
1187
+ type: ["object", "null"],
1188
+ properties: {
1189
+ name: { type: "string" },
1190
+ path: { type: "string" },
1191
+ },
1192
+ required: ["name", "path"],
1193
+ },
1194
+ /** Pre-flight команда (null — не задана). */
1195
+ preFlight: { type: ["string", "null"] },
1196
+ /** Post-flight команда (null — не задана). */
1197
+ postFlight: { type: ["string", "null"] },
1198
+ /** Quality Gate (null — не задан). */
1199
+ qualityGate: { type: ["string", "null"] },
1200
+ /** Ограничения инструментов (null — без ограничений). */
1201
+ roleScoped: {
1202
+ type: ["object", "null"],
1203
+ properties: {
1204
+ allowed: { type: "array", items: { type: "string" } },
1205
+ denied: { type: "array", items: { type: "string" } },
1206
+ },
1207
+ },
1208
+ /** Оценка длительности по последним запускам (null — нет истории). */
1209
+ estimatedDurationSec: { type: ["number", "null"] },
1210
+ /** Оценка стоимости по последним запускам (null — нет истории). */
1211
+ estimatedCostUsd: { type: ["number", "null"] },
1212
+ /** Оценка токенов по последним запускам (null — нет истории). */
1213
+ estimatedTokens: { type: ["number", "null"] },
1214
+ /** Для клона матрицы — имя родителя-шаблона (Спринт 15). */
1215
+ matrixParent: { type: "string" },
1216
+ },
1217
+ required: ["name", "order", "trigger", "cwd", "command"],
1218
+ };
1219
+ const DryRunReportOutput = {
1220
+ type: "object",
1221
+ properties: {
1222
+ success: { type: "boolean" },
1223
+ taskName: { type: "string" },
1224
+ /** Упорядоченный список задач конвейера (топологический порядок зависимостей). */
1225
+ tasks: { type: "array", items: DryRunTaskItem },
1226
+ /** Суммарные оценки по всем задачам. */
1227
+ totals: {
1228
+ type: "object",
1229
+ properties: {
1230
+ estimatedDurationSec: { type: ["number", "null"] },
1231
+ estimatedCostUsd: { type: ["number", "null"] },
1232
+ estimatedTokens: { type: ["number", "null"] },
1233
+ },
1234
+ required: [],
1235
+ },
1236
+ /** Предупреждения: опасные команды, недоступные пути, отсутствие истории. */
1237
+ warnings: { type: "array", items: { type: "string" } },
1238
+ error: { type: "string" },
1239
+ },
1240
+ required: ["success", "taskName", "tasks", "warnings"],
1241
+ };
1242
+ const DryRunInput = {
1243
+ type: "object",
1244
+ properties: {
1245
+ taskName: { type: "string" },
1246
+ },
1247
+ required: ["taskName"],
1248
+ additionalProperties: false,
1249
+ };
1250
+ const DryRunAllOutput = {
1251
+ type: "object",
1252
+ properties: {
1253
+ success: { type: "boolean" },
1254
+ reports: {
1255
+ type: "array",
1256
+ items: DryRunReportOutput,
1257
+ },
1258
+ },
1259
+ required: ["success", "reports"],
1260
+ };
1261
+ /** Детальный отчёт по одному клону матрицы. */
1262
+ const MatrixCloneResult = {
1263
+ type: "object",
1264
+ properties: {
1265
+ name: { type: "string" },
1266
+ workspaceId: { type: ["string", "null"] },
1267
+ workspaceName: { type: ["string", "null"] },
1268
+ /** success | error | timeout | partial | pending | running */
1269
+ status: { type: "string" },
1270
+ error: { type: ["string", "null"] },
1271
+ finishedAt: { type: ["string", "null"] },
1272
+ },
1273
+ required: ["name", "status"],
1274
+ };
1275
+ const GetMatrixResultsInput = {
1276
+ type: "object",
1277
+ properties: {
1278
+ parentId: { type: "string" },
1279
+ },
1280
+ required: ["parentId"],
1281
+ additionalProperties: false,
1282
+ };
1283
+ const MatrixReport = {
1284
+ type: "object",
1285
+ properties: {
1286
+ parentId: { type: "string" },
1287
+ totalCount: { type: "number" },
1288
+ successCount: { type: "number" },
1289
+ errorCount: { type: "number" },
1290
+ pendingCount: { type: "number" },
1291
+ /** success | error | partial | running | empty */
1292
+ status: { type: "string" },
1293
+ message: { type: "string" },
1294
+ clones: { type: "array", items: MatrixCloneResult },
1295
+ },
1296
+ required: ["parentId", "totalCount", "successCount", "errorCount", "status"],
1297
+ };
1298
+ const GetMatrixResultsOutput = {
1299
+ type: "object",
1300
+ properties: {
1301
+ success: { type: "boolean" },
1302
+ report: MatrixReport,
1303
+ error: { type: "string" },
1304
+ },
1305
+ required: ["success"],
1306
+ };
1307
+ const ExpandMatrixPreviewInput = {
1308
+ type: "object",
1309
+ properties: {
1310
+ /** Имя задачи-родителя (используется в именах клонов). */
1311
+ name: { type: "string" },
1312
+ workspaceIds: { type: "array", items: { type: "string" } },
1313
+ strategy: { type: "string" },
1314
+ failureMode: { type: "string" },
1315
+ aggregation: { type: "string" },
1316
+ },
1317
+ required: ["workspaceIds"],
1318
+ additionalProperties: false,
1319
+ };
1320
+ const ExpandMatrixPreviewOutput = {
1321
+ type: "object",
1322
+ properties: {
1323
+ success: { type: "boolean" },
1324
+ clones: {
1325
+ type: "array",
1326
+ items: {
1327
+ type: "object",
1328
+ properties: {
1329
+ name: { type: "string" },
1330
+ workspaceId: { type: "string" },
1331
+ workspaceName: { type: ["string", "null"] },
1332
+ },
1333
+ required: ["name", "workspaceId"],
1334
+ },
1335
+ },
1336
+ error: { type: "string" },
1337
+ },
1338
+ required: ["success", "clones"],
1339
+ };
1340
+ const CancelMatrixOutput = {
1341
+ type: "object",
1342
+ properties: {
1343
+ success: { type: "boolean" },
1344
+ message: { type: "string" },
1345
+ cancelled: { type: "array", items: { type: "string" } },
1346
+ },
1347
+ required: ["success", "message", "cancelled"],
1348
+ };
1349
+ const CleanupMatrixOrphansOutput = {
1350
+ type: "object",
1351
+ properties: {
1352
+ success: { type: "boolean" },
1353
+ message: { type: "string" },
1354
+ removed: { type: "array", items: { type: "string" } },
1355
+ },
1356
+ required: ["success", "message", "removed"],
1357
+ };
1358
+ /** Профиль (Спринт 21): отдельная БД, настройки, логи и порт дашборда. */
1359
+ const ProfileItem = {
1360
+ type: "object",
1361
+ properties: {
1362
+ name: { type: "string" },
1363
+ dir: { type: "string" },
1364
+ port: { type: ["number", "null"] },
1365
+ isDefault: { type: "boolean" },
1366
+ active: { type: "boolean" },
1367
+ },
1368
+ required: ["name", "dir", "isDefault", "active"],
1369
+ };
1370
+ const GetProfilesInput = {
1371
+ type: "object",
1372
+ properties: {},
1373
+ additionalProperties: false,
1374
+ };
1375
+ const GetProfilesOutput = {
1376
+ type: "object",
1377
+ properties: {
1378
+ current: { type: "string" },
1379
+ /** true — профиль задан переменной OPENCODE_SCHEDULER_PROFILE. */
1380
+ pinnedByEnv: { type: "boolean" },
1381
+ profiles: { type: "array", items: ProfileItem },
1382
+ },
1383
+ required: ["current", "pinnedByEnv", "profiles"],
1384
+ };
1385
+ const SetProfileInput = {
1386
+ type: "object",
1387
+ properties: {
1388
+ name: { type: "string" },
1389
+ },
1390
+ required: ["name"],
1391
+ additionalProperties: false,
1392
+ };
1393
+ const SetProfileOutput = {
1394
+ type: "object",
1395
+ properties: {
1396
+ success: { type: "boolean" },
1397
+ message: { type: "string" },
1398
+ current: { type: "string" },
1399
+ /** true — изменения вступят в силу после перезапуска OpenCode. */
1400
+ restartRequired: { type: "boolean" },
1401
+ },
1402
+ required: ["success", "message", "current", "restartRequired"],
1403
+ };
1404
+ const CreateProfileInput = {
1405
+ type: "object",
1406
+ properties: {
1407
+ name: { type: "string" },
1408
+ /** Порт дашборда профиля (по умолчанию — свободный 3782+). */
1409
+ port: { type: "number" },
1410
+ },
1411
+ required: ["name"],
1412
+ additionalProperties: false,
1413
+ };
1414
+ const CreateProfileOutput = {
1415
+ type: "object",
1416
+ properties: {
1417
+ success: { type: "boolean" },
1418
+ message: { type: "string" },
1419
+ profile: ProfileItem,
1420
+ error: { type: "string" },
1421
+ },
1422
+ required: ["success"],
1423
+ };
1424
+ const DeleteProfileInput = {
1425
+ type: "object",
1426
+ properties: {
1427
+ name: { type: "string" },
1428
+ },
1429
+ required: ["name"],
1430
+ additionalProperties: false,
1431
+ };
1432
+ const DeleteProfileOutput = {
1433
+ type: "object",
1434
+ properties: {
1435
+ success: { type: "boolean" },
1436
+ message: { type: "string" },
1437
+ },
1438
+ required: ["success", "message"],
1439
+ };
1440
+ export const SchedulerRpc = Rpc.define({
1441
+ id: "opencode-windows-scheduler",
1442
+ methods: {
1443
+ get_tasks: { input: GetTasksInput, output: GetTasksOutput },
1444
+ create_task: { input: CreateTaskInput, output: CreateTaskOutput },
1445
+ delete_task: { input: DeleteTaskInput, output: DeleteTaskOutput },
1446
+ run_task: { input: RunTaskInput, output: RunTaskOutput },
1447
+ pause_task: { input: PauseResumeInput, output: DeleteTaskOutput },
1448
+ resume_task: { input: PauseResumeInput, output: DeleteTaskOutput },
1449
+ update_task: { input: UpdateTaskInput, output: UpdateTaskOutput },
1450
+ get_task_logs: { input: GetTaskLogsInput, output: GetTaskLogsOutput },
1451
+ get_history: { input: GetHistoryInput, output: GetHistoryOutput },
1452
+ get_metrics: { input: GetMetricsInput, output: GetMetricsOutput },
1453
+ get_dashboard_port: { input: GetDashboardPortInput, output: GetDashboardPortOutput },
1454
+ get_platform: { input: GetPlatformInput, output: GetPlatformOutput },
1455
+ dry_run: { input: DryRunInput, output: DryRunReportOutput },
1456
+ dry_run_all: { input: GetTasksInput, output: DryRunAllOutput },
1457
+ get_matrix_results: {
1458
+ input: GetMatrixResultsInput,
1459
+ output: GetMatrixResultsOutput,
1460
+ },
1461
+ cancel_matrix: { input: NameOnly, output: CancelMatrixOutput },
1462
+ cleanup_matrix_orphans: {
1463
+ input: GetTasksInput,
1464
+ output: CleanupMatrixOrphansOutput,
1465
+ },
1466
+ cleanup_history: { input: CleanupHistoryInput, output: CleanupHistoryOutput },
1467
+ get_analytics: { input: GetAnalyticsInput, output: GetAnalyticsOutput },
1468
+ self_analysis: { input: SelfAnalysisInput, output: SelfAnalysisOutput },
1469
+ expand_matrix_preview: {
1470
+ input: ExpandMatrixPreviewInput,
1471
+ output: ExpandMatrixPreviewOutput,
1472
+ },
1473
+ get_workspaces: { input: GetWorkspacesInput, output: GetWorkspacesOutput },
1474
+ add_workspace: { input: AddWorkspaceInput, output: AddWorkspaceOutput },
1475
+ update_workspace: { input: UpdateWorkspaceInput, output: AddWorkspaceOutput },
1476
+ delete_workspace: { input: DeleteWorkspaceInput, output: DeleteWorkspaceOutput },
1477
+ get_profiles: { input: GetProfilesInput, output: GetProfilesOutput },
1478
+ set_profile: { input: SetProfileInput, output: SetProfileOutput },
1479
+ create_profile: { input: CreateProfileInput, output: CreateProfileOutput },
1480
+ delete_profile: { input: DeleteProfileInput, output: DeleteProfileOutput },
1481
+ export_tasks: { input: ExportTasksInput, output: ExportTasksOutput },
1482
+ import_tasks: { input: ImportTasksInput, output: ImportTasksOutput },
1483
+ get_settings: { input: GetSettingsInput, output: GetSettingsOutput },
1484
+ save_settings: { input: SaveSettingsInput, output: SaveSettingsOutput },
1485
+ get_templates: { input: GetTemplatesInput, output: GetTemplatesOutput },
1486
+ save_template: { input: SaveTemplateInput, output: SaveTemplateOutput },
1487
+ delete_template: { input: DeleteTemplateInput, output: DeleteTemplateOutput },
1488
+ emit_event: { input: EmitEventInput, output: EmitEventOutput },
1489
+ test_notification: {
1490
+ input: TestNotificationInput,
1491
+ output: TestNotificationOutput,
1492
+ },
1493
+ send_digest: {
1494
+ input: SendDigestInput,
1495
+ output: SendDigestOutput,
1496
+ },
1497
+ list_secrets: { input: ListSecretsInput, output: ListSecretsOutput },
1498
+ save_secret: { input: SaveSecretInput, output: SaveSecretOutput },
1499
+ delete_secret: { input: DeleteSecretInput, output: DeleteSecretOutput },
1500
+ get_audit: { input: GetAuditInput, output: GetAuditOutput },
1501
+ compare_triage: {
1502
+ input: CompareTriageInput,
1503
+ output: CompareTriageOutput,
1504
+ },
1505
+ },
1506
+ events: {},
1507
+ });