agent-steward 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/CHANGELOG.md +134 -2
  2. package/CROSS_PLATFORM.md +19 -0
  3. package/README.md +52 -7
  4. package/ROADMAP-STRATEGY.md +21 -18
  5. package/ROADMAP.md +140 -159
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +351 -0
  9. package/dist/core/execution.d.ts +203 -0
  10. package/dist/core/execution.d.ts.map +1 -0
  11. package/dist/core/execution.js +309 -0
  12. package/dist/core/gate-integrity.d.ts +35 -0
  13. package/dist/core/gate-integrity.d.ts.map +1 -0
  14. package/dist/core/gate-integrity.js +132 -0
  15. package/dist/core/git-trigger.d.ts.map +1 -1
  16. package/dist/core/git-trigger.js +14 -2
  17. package/dist/core/guard-run.d.ts +4 -0
  18. package/dist/core/guard-run.d.ts.map +1 -0
  19. package/dist/core/guard-run.js +101 -0
  20. package/dist/core/guard.d.ts +52 -0
  21. package/dist/core/guard.d.ts.map +1 -0
  22. package/dist/core/guard.js +362 -0
  23. package/dist/core/lock.d.ts +41 -0
  24. package/dist/core/lock.d.ts.map +1 -1
  25. package/dist/core/lock.js +141 -29
  26. package/dist/core/matrix.d.ts.map +1 -1
  27. package/dist/core/matrix.js +75 -15
  28. package/dist/core/mission.d.ts +83 -0
  29. package/dist/core/mission.d.ts.map +1 -0
  30. package/dist/core/mission.js +334 -0
  31. package/dist/core/pipeline-apply.d.ts +38 -0
  32. package/dist/core/pipeline-apply.d.ts.map +1 -0
  33. package/dist/core/pipeline-apply.js +117 -0
  34. package/dist/core/pipeline-io.d.ts +13 -0
  35. package/dist/core/pipeline-io.d.ts.map +1 -0
  36. package/dist/core/pipeline-io.js +64 -0
  37. package/dist/core/pipeline-map.d.ts +46 -0
  38. package/dist/core/pipeline-map.d.ts.map +1 -0
  39. package/dist/core/pipeline-map.js +196 -0
  40. package/dist/core/pipeline-spec.d.ts +109 -0
  41. package/dist/core/pipeline-spec.d.ts.map +1 -0
  42. package/dist/core/pipeline-spec.js +554 -0
  43. package/dist/core/ps-wrapper.d.ts +19 -2
  44. package/dist/core/ps-wrapper.d.ts.map +1 -1
  45. package/dist/core/ps-wrapper.js +250 -62
  46. package/dist/core/record-history.d.ts.map +1 -1
  47. package/dist/core/record-history.js +130 -29
  48. package/dist/core/router/rules.d.ts.map +1 -1
  49. package/dist/core/router/rules.js +6 -0
  50. package/dist/core/scheduler/linux.d.ts +8 -1
  51. package/dist/core/scheduler/linux.d.ts.map +1 -1
  52. package/dist/core/scheduler/linux.js +34 -9
  53. package/dist/core/scheduler/mac.d.ts +44 -2
  54. package/dist/core/scheduler/mac.d.ts.map +1 -1
  55. package/dist/core/scheduler/mac.js +126 -15
  56. package/dist/core/scheduler/windows.d.ts.map +1 -1
  57. package/dist/core/scheduler/windows.js +15 -12
  58. package/dist/core/structured-log.d.ts +7 -1
  59. package/dist/core/structured-log.d.ts.map +1 -1
  60. package/dist/core/worktree-run.d.ts +4 -0
  61. package/dist/core/worktree-run.d.ts.map +1 -0
  62. package/dist/core/worktree-run.js +164 -0
  63. package/dist/core/worktree.d.ts +115 -0
  64. package/dist/core/worktree.d.ts.map +1 -0
  65. package/dist/core/worktree.js +462 -0
  66. package/dist/core/wrappers/bash.d.ts +17 -0
  67. package/dist/core/wrappers/bash.d.ts.map +1 -1
  68. package/dist/core/wrappers/bash.js +175 -24
  69. package/dist/db/capability-repo.d.ts +43 -2
  70. package/dist/db/capability-repo.d.ts.map +1 -1
  71. package/dist/db/capability-repo.js +96 -11
  72. package/dist/db/history-repo.d.ts +38 -5
  73. package/dist/db/history-repo.d.ts.map +1 -1
  74. package/dist/db/history-repo.js +88 -25
  75. package/dist/db/metrics-repo.js +2 -2
  76. package/dist/db/recovery.d.ts.map +1 -1
  77. package/dist/db/recovery.js +5 -4
  78. package/dist/db/run-journal.d.ts +33 -5
  79. package/dist/db/run-journal.d.ts.map +1 -1
  80. package/dist/db/run-journal.js +78 -14
  81. package/dist/db/run-resume.d.ts +5 -0
  82. package/dist/db/run-resume.d.ts.map +1 -1
  83. package/dist/db/run-resume.js +9 -2
  84. package/dist/db/runs-repo.d.ts +19 -2
  85. package/dist/db/runs-repo.d.ts.map +1 -1
  86. package/dist/db/runs-repo.js +22 -6
  87. package/dist/db/schema.d.ts +2 -2
  88. package/dist/db/schema.d.ts.map +1 -1
  89. package/dist/db/schema.js +63 -2
  90. package/dist/history.d.ts +1 -1
  91. package/dist/history.d.ts.map +1 -1
  92. package/dist/i18n.d.ts +5 -0
  93. package/dist/i18n.d.ts.map +1 -1
  94. package/dist/i18n.js +11 -4
  95. package/dist/index.d.ts +136 -2
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +378 -14
  98. package/dist/notifications.d.ts +22 -0
  99. package/dist/notifications.d.ts.map +1 -1
  100. package/dist/notifications.js +36 -8
  101. package/dist/profiles.d.ts.map +1 -1
  102. package/dist/profiles.js +25 -4
  103. package/dist/rpc.d.ts +246 -0
  104. package/dist/rpc.d.ts.map +1 -1
  105. package/dist/rpc.js +117 -0
  106. package/dist/server.d.ts +15 -0
  107. package/dist/server.d.ts.map +1 -1
  108. package/dist/server.js +77 -18
  109. package/dist/settings.d.ts +2 -2
  110. package/dist/settings.d.ts.map +1 -1
  111. package/dist/settings.js +3 -3
  112. package/dist/shared/jobs-view.d.ts +1 -1
  113. package/dist/shared/jobs-view.d.ts.map +1 -1
  114. package/dist/shared/jobs-view.js +2 -0
  115. package/dist/task-transfer.d.ts +16 -0
  116. package/dist/task-transfer.d.ts.map +1 -1
  117. package/dist/task-transfer.js +16 -0
  118. package/docs/ARCHITECTURE.md +281 -65
  119. package/docs/COMPATIBILITY.md +2 -2
  120. package/docs/CONCEPT.md +18 -4
  121. package/docs/CROSS_PLATFORM.ru.md +20 -0
  122. package/docs/CROSS_PLATFORM.zh.md +18 -0
  123. package/docs/EXECUTION-LOOP.md +22 -7
  124. package/docs/FEATURES.md +65 -4
  125. package/docs/FEATURES.zh.md +52 -4
  126. package/docs/MIGRATION.md +2 -2
  127. package/docs/PIPELINE.md +293 -0
  128. package/docs/README.ru.md +42 -3
  129. package/docs/README.zh.md +43 -3
  130. package/docs/SAFETY.md +23 -3
  131. package/gui-experimental.cjs +9 -8
  132. package/locales/en.json +17 -1
  133. package/locales/ru.json +17 -1
  134. package/locales/zh.json +17 -1
  135. package/opencode.pipeline.yaml +35 -0
  136. package/package.json +23 -4
  137. package/scripts/test-home.mjs +83 -0
  138. package/src/cli.ts +412 -0
  139. package/src/core/dry-run.ts +2 -2
  140. package/src/core/execution.ts +538 -0
  141. package/src/core/file-watcher.ts +2 -2
  142. package/src/core/gate-integrity.ts +160 -0
  143. package/src/core/git-trigger.ts +18 -5
  144. package/src/core/guard-run.ts +119 -0
  145. package/src/core/guard.ts +431 -0
  146. package/src/core/lock.ts +178 -37
  147. package/src/core/matrix.ts +95 -50
  148. package/src/core/mission.ts +485 -0
  149. package/src/core/native-notify.ts +1 -1
  150. package/src/core/pipeline-apply.ts +158 -0
  151. package/src/core/pipeline-io.ts +79 -0
  152. package/src/core/pipeline-map.ts +264 -0
  153. package/src/core/pipeline-spec.ts +775 -0
  154. package/src/core/ps-wrapper.ts +263 -63
  155. package/src/core/record-history.ts +164 -77
  156. package/src/core/router/rules.ts +6 -0
  157. package/src/core/schedule-gate.ts +1 -1
  158. package/src/core/scheduler/at-fallback.ts +1 -1
  159. package/src/core/scheduler/linux.ts +40 -11
  160. package/src/core/scheduler/logs.ts +2 -2
  161. package/src/core/scheduler/mac.ts +174 -14
  162. package/src/core/scheduler/registry.ts +2 -2
  163. package/src/core/scheduler/windows.ts +19 -15
  164. package/src/core/secrets.ts +8 -8
  165. package/src/core/structured-log.ts +22 -5
  166. package/src/core/telegram.ts +2 -2
  167. package/src/core/triage-worker.ts +7 -7
  168. package/src/core/triage.ts +2 -2
  169. package/src/core/worktree-run.ts +199 -0
  170. package/src/core/worktree.ts +600 -0
  171. package/src/core/wrappers/bash.ts +190 -23
  172. package/src/db/capability-repo.ts +127 -10
  173. package/src/db/history-repo.ts +129 -22
  174. package/src/db/metrics-repo.ts +2 -2
  175. package/src/db/recovery.ts +5 -4
  176. package/src/db/run-journal.ts +100 -13
  177. package/src/db/run-resume.ts +17 -1
  178. package/src/db/runs-repo.ts +36 -6
  179. package/src/db/schema.ts +65 -2
  180. package/src/gui.tsx +177 -13
  181. package/src/history.ts +1 -1
  182. package/src/i18n.ts +12 -4
  183. package/src/index.ts +524 -4
  184. package/src/notifications.ts +38 -8
  185. package/src/profiles.ts +26 -4
  186. package/src/rpc.ts +128 -0
  187. package/src/server.ts +94 -18
  188. package/src/settings.ts +5 -5
  189. package/src/shared/jobs-view.ts +3 -1
  190. package/src/task-transfer.ts +31 -0
@@ -0,0 +1,196 @@
1
+ import { PIPELINE_VERSION, pipelineStepTaskName, } from "./pipeline-spec.js";
2
+ /**
3
+ * Преобразует провалидированный pipeline в определения задач.
4
+ *
5
+ * Правила:
6
+ * - `trigger: dag` → задача без собственного триггера (`triggerType: "file"`),
7
+ * как матричные родители: её запускает только DAG-движок по `dependsOn`;
8
+ * - `needs` → `dependsOn` с именами задач (`<pipeline> <step>`);
9
+ * - `defaults` наследуются шагом;
10
+ * - матрица `workspaces` переносится в `matrix.workspaceIds`.
11
+ */
12
+ export function pipelineSpecToTasks(spec, options = {}) {
13
+ const defaults = spec.defaults ?? {};
14
+ const warnings = [];
15
+ const nameByStep = new Map();
16
+ for (const step of spec.steps) {
17
+ const explicit = step.name?.trim();
18
+ nameByStep.set(step.id.toLowerCase(), explicit || pipelineStepTaskName(spec.name, step.id));
19
+ }
20
+ const tasks = spec.steps.map((step) => {
21
+ const trigger = step.trigger ?? defaults.trigger ?? "cron";
22
+ const scheduleValue = step.schedule ?? defaults.schedule ?? "";
23
+ const schedule = trigger === "cron" ? scheduleValue : "";
24
+ const dependsOn = step.needs?.length
25
+ ? step.needs.map((need) => nameByStep.get(need.toLowerCase()))
26
+ : undefined;
27
+ const task = {
28
+ name: nameByStep.get(step.id.toLowerCase()),
29
+ schedule,
30
+ prompt: step.prompt,
31
+ // TaskDefinition не знает "dag": ручной триггер "file" не регистрирует
32
+ // cron, задачу запускает DAG-движок после успеха зависимостей.
33
+ triggerType: trigger === "dag" ? "file" : trigger,
34
+ ...(dependsOn ? { dependsOn } : {}),
35
+ ...(step.qualityGate !== undefined ? { qualityGate: step.qualityGate } : {}),
36
+ ...(step.beforeScript !== undefined ? { beforeScript: step.beforeScript } : {}),
37
+ ...(step.afterScript !== undefined ? { afterScript: step.afterScript } : {}),
38
+ ...(step.guards !== undefined ? { guards: step.guards } : {}),
39
+ ...(step.model !== undefined || defaults.model !== undefined
40
+ ? { model: step.model ?? defaults.model }
41
+ : {}),
42
+ ...(step.priority !== undefined || defaults.priority !== undefined
43
+ ? { priority: step.priority ?? defaults.priority }
44
+ : {}),
45
+ ...(step.timeoutSeconds !== undefined || defaults.timeoutSeconds !== undefined
46
+ ? { timeoutSeconds: step.timeoutSeconds ?? defaults.timeoutSeconds }
47
+ : {}),
48
+ ...(step.workingDirectory !== undefined || defaults.workingDirectory !== undefined
49
+ ? { workingDirectory: step.workingDirectory ?? defaults.workingDirectory }
50
+ : {}),
51
+ ...(step.workspaceId !== undefined ? { workspaceId: step.workspaceId } : {}),
52
+ ...(step.retryCount !== undefined || defaults.retryCount !== undefined
53
+ ? { retryCount: step.retryCount ?? defaults.retryCount }
54
+ : {}),
55
+ ...(step.retryDelay !== undefined || defaults.retryDelay !== undefined
56
+ ? { retryDelay: step.retryDelay ?? defaults.retryDelay }
57
+ : {}),
58
+ ...(step.allowedTools !== undefined || defaults.allowedTools !== undefined
59
+ ? { allowedTools: step.allowedTools ?? defaults.allowedTools }
60
+ : {}),
61
+ ...(step.deniedTools !== undefined || defaults.deniedTools !== undefined
62
+ ? { deniedTools: step.deniedTools ?? defaults.deniedTools }
63
+ : {}),
64
+ ...(step.timezone !== undefined || defaults.timezone !== undefined
65
+ ? { timezone: step.timezone ?? defaults.timezone }
66
+ : {}),
67
+ ...(step.notBefore !== undefined ? { notBefore: step.notBefore } : {}),
68
+ ...(step.notAfter !== undefined ? { notAfter: step.notAfter } : {}),
69
+ ...(step.activeDays !== undefined ? { activeDays: step.activeDays } : {}),
70
+ ...(step.windowPolicy !== undefined ? { windowPolicy: step.windowPolicy } : {}),
71
+ ...(trigger === "once" && step.runAt !== undefined ? { runAt: step.runAt } : {}),
72
+ ...(step.matrix ? { matrix: mapMatrix(step.matrix, options, warnings) } : {}),
73
+ pipelineName: spec.name,
74
+ pipelineStepId: step.id,
75
+ };
76
+ return task;
77
+ });
78
+ return { tasks, warnings };
79
+ }
80
+ function mapMatrix(matrix, options, warnings) {
81
+ const workspaceIds = matrix.workspaces.map((raw) => {
82
+ const value = raw.trim();
83
+ const resolved = options.resolveWorkspaceId?.(value);
84
+ if (options.resolveWorkspaceId && !resolved) {
85
+ warnings.push(`workspace «${value}» не найден — шаг будет отклонён при apply.`);
86
+ return value;
87
+ }
88
+ return resolved ?? value;
89
+ });
90
+ return {
91
+ workspaceIds,
92
+ ...(matrix.strategy ? { strategy: matrix.strategy } : {}),
93
+ ...(matrix.failureMode ? { failureMode: matrix.failureMode } : {}),
94
+ ...(matrix.aggregation ? { aggregation: matrix.aggregation } : {}),
95
+ ...(matrix.concurrency !== undefined ? { concurrency: matrix.concurrency } : {}),
96
+ ...(matrix.createAggregator !== undefined
97
+ ? { createAggregator: matrix.createAggregator }
98
+ : {}),
99
+ };
100
+ }
101
+ /**
102
+ * Обратный маппинг: задачи одного pipeline из БД → `PipelineSpec` для export.
103
+ *
104
+ * Восстанавливает `needs` по `dependsOn`, `matrix.workspaces` по
105
+ * `matrix.workspaceIds`, trigger по `triggerType`. Шаг `dag` неотличим от
106
+ * ручного `file`-шага с зависимостями, поэтому восстанавливается эвристикой:
107
+ * `file`, без cron и watchPath, но с `dependsOn` → `dag`.
108
+ */
109
+ export function tasksToPipelineSpec(tasks, pipelineName) {
110
+ const warnings = [];
111
+ const own = tasks.filter((task) => task.pipelineName?.toLowerCase() === pipelineName.toLowerCase() &&
112
+ Boolean(task.pipelineStepId));
113
+ const stepIdByTaskName = new Map();
114
+ for (const task of own) {
115
+ const key = task.name.trim().toLowerCase();
116
+ if (key && !stepIdByTaskName.has(key)) {
117
+ stepIdByTaskName.set(key, task.pipelineStepId);
118
+ }
119
+ }
120
+ const steps = own.map((task) => {
121
+ const stepId = task.pipelineStepId;
122
+ const trigger = inferTrigger(task);
123
+ const needs = task.dependsOn
124
+ ?.map((dep) => {
125
+ const id = stepIdByTaskName.get(dep.trim().toLowerCase());
126
+ if (!id) {
127
+ warnings.push(`Шаг «${stepId}»: зависимость «${dep}» не входит в pipeline и опущена.`);
128
+ }
129
+ return id;
130
+ })
131
+ .filter((value) => Boolean(value));
132
+ const defaultName = pipelineStepTaskName(pipelineName, stepId);
133
+ const step = {
134
+ id: stepId,
135
+ ...(task.name.trim() !== defaultName ? { name: task.name } : {}),
136
+ prompt: task.prompt,
137
+ ...(needs?.length ? { needs } : {}),
138
+ ...(trigger === "cron" && task.schedule ? { schedule: task.schedule } : {}),
139
+ ...(trigger !== "cron" ? { trigger } : {}),
140
+ ...(trigger === "once" && task.runAt !== undefined ? { runAt: task.runAt } : {}),
141
+ ...(task.model !== undefined ? { model: task.model } : {}),
142
+ ...(task.priority !== undefined ? { priority: task.priority } : {}),
143
+ ...(task.timeoutSeconds !== undefined ? { timeoutSeconds: task.timeoutSeconds } : {}),
144
+ ...(task.workingDirectory !== undefined
145
+ ? { workingDirectory: task.workingDirectory }
146
+ : {}),
147
+ ...(task.workspaceId !== undefined ? { workspaceId: task.workspaceId } : {}),
148
+ ...(task.retryCount !== undefined ? { retryCount: task.retryCount } : {}),
149
+ ...(task.retryDelay !== undefined ? { retryDelay: task.retryDelay } : {}),
150
+ ...(task.qualityGate !== undefined ? { qualityGate: task.qualityGate } : {}),
151
+ ...(task.beforeScript !== undefined ? { beforeScript: task.beforeScript } : {}),
152
+ ...(task.afterScript !== undefined ? { afterScript: task.afterScript } : {}),
153
+ ...(task.guards !== undefined ? { guards: task.guards } : {}),
154
+ ...(task.allowedTools !== undefined ? { allowedTools: task.allowedTools } : {}),
155
+ ...(task.deniedTools !== undefined ? { deniedTools: task.deniedTools } : {}),
156
+ ...(task.matrix
157
+ ? {
158
+ matrix: {
159
+ workspaces: task.matrix.workspaceIds,
160
+ ...(task.matrix.strategy ? { strategy: task.matrix.strategy } : {}),
161
+ ...(task.matrix.failureMode ? { failureMode: task.matrix.failureMode } : {}),
162
+ ...(task.matrix.aggregation ? { aggregation: task.matrix.aggregation } : {}),
163
+ ...(task.matrix.concurrency !== undefined
164
+ ? { concurrency: task.matrix.concurrency }
165
+ : {}),
166
+ ...(task.matrix.createAggregator !== undefined
167
+ ? { createAggregator: task.matrix.createAggregator }
168
+ : {}),
169
+ },
170
+ }
171
+ : {}),
172
+ ...(task.timezone !== undefined ? { timezone: task.timezone } : {}),
173
+ ...(task.notBefore !== undefined ? { notBefore: task.notBefore } : {}),
174
+ ...(task.notAfter !== undefined ? { notAfter: task.notAfter } : {}),
175
+ ...(task.activeDays !== undefined ? { activeDays: task.activeDays } : {}),
176
+ ...(task.windowPolicy !== undefined
177
+ ? { windowPolicy: task.windowPolicy }
178
+ : {}),
179
+ };
180
+ return step;
181
+ });
182
+ return {
183
+ spec: { version: PIPELINE_VERSION, name: pipelineName, steps },
184
+ warnings,
185
+ };
186
+ }
187
+ function inferTrigger(task) {
188
+ const trigger = task.triggerType ?? "cron";
189
+ if (trigger === "file" &&
190
+ !task.schedule &&
191
+ !task.watchPath &&
192
+ Boolean(task.dependsOn?.length)) {
193
+ return "dag";
194
+ }
195
+ return trigger;
196
+ }
@@ -0,0 +1,109 @@
1
+ import { type TaskGuards } from "./guard.js";
2
+ /** Версия формата, которую понимает этот модуль. */
3
+ export declare const PIPELINE_VERSION = 1;
4
+ /** Защита от случайно огромного файла: шагов в одном pipeline. */
5
+ export declare const MAX_PIPELINE_STEPS = 200;
6
+ /** Максимальная длина id шага (id попадает в имена задач и логи). */
7
+ export declare const MAX_STEP_ID_LENGTH = 64;
8
+ /**
9
+ * Чем запускается шаг.
10
+ *
11
+ * `dag` — шаг без собственного триггера: он запускается только как
12
+ * зависимость другого шага (`needs` непустой). Это позволяет описывать
13
+ * pipeline целиком, не придумывая каждому шагу cron.
14
+ */
15
+ export type PipelineTrigger = "cron" | "file" | "git" | "mcp-event" | "once" | "dag";
16
+ export type PipelineMatrixStrategy = "parallel" | "sequential";
17
+ export type PipelineMatrixFailureMode = "continue" | "stop";
18
+ export type PipelineMatrixAggregation = "summary" | "per-task";
19
+ export type PipelineWindowPolicy = "skip" | "postpone" | "run";
20
+ /** Fan-out матрицы в терминах pipeline-файла. */
21
+ export interface PipelineMatrix {
22
+ /** Имена или id workspace, по одному клону на каждый. */
23
+ workspaces: string[];
24
+ strategy?: PipelineMatrixStrategy;
25
+ failureMode?: PipelineMatrixFailureMode;
26
+ aggregation?: PipelineMatrixAggregation;
27
+ /** Максимум одновременно выполняющихся клонов. */
28
+ concurrency?: number;
29
+ createAggregator?: boolean;
30
+ }
31
+ /** Значения по умолчанию для всех шагов pipeline. */
32
+ export interface PipelineDefaults {
33
+ schedule?: string;
34
+ trigger?: PipelineTrigger;
35
+ model?: string;
36
+ priority?: number;
37
+ timeoutSeconds?: number;
38
+ workingDirectory?: string;
39
+ retryCount?: number;
40
+ retryDelay?: number;
41
+ allowedTools?: string[];
42
+ deniedTools?: string[];
43
+ timezone?: string;
44
+ }
45
+ /** Один шаг pipeline. */
46
+ export interface PipelineStep {
47
+ /** Уникальный стабильный идентификатор шага (латиница/кириллица, цифры, `. _ -`). */
48
+ id: string;
49
+ /** Имя задачи в планировщике; по умолчанию `<pipeline> <id>`. */
50
+ name?: string;
51
+ prompt: string;
52
+ /** id шагов, которые должны успешно завершиться раньше. */
53
+ needs?: string[];
54
+ /** Cron-выражение (для trigger: cron). */
55
+ schedule?: string;
56
+ trigger?: PipelineTrigger;
57
+ /** ISO-8601 для trigger: once. */
58
+ runAt?: string;
59
+ model?: string;
60
+ priority?: number;
61
+ timeoutSeconds?: number;
62
+ workingDirectory?: string;
63
+ workspaceId?: string;
64
+ retryCount?: number;
65
+ retryDelay?: number;
66
+ qualityGate?: string;
67
+ beforeScript?: string;
68
+ afterScript?: string;
69
+ /** W-3: guard-условия шага; при невыполнении запуск пропускается. */
70
+ guards?: TaskGuards;
71
+ allowedTools?: string[];
72
+ deniedTools?: string[];
73
+ matrix?: PipelineMatrix;
74
+ timezone?: string;
75
+ notBefore?: string;
76
+ notAfter?: string;
77
+ activeDays?: number[];
78
+ windowPolicy?: PipelineWindowPolicy;
79
+ }
80
+ /** Корневой документ `opencode.pipeline.yaml`. */
81
+ export interface PipelineSpec {
82
+ version: typeof PIPELINE_VERSION;
83
+ name: string;
84
+ description?: string;
85
+ defaults?: PipelineDefaults;
86
+ steps: PipelineStep[];
87
+ }
88
+ /** Одна находка валидатора. */
89
+ export interface PipelineIssue {
90
+ /** Путь до поля: `steps[2].schedule`, `defaults.model` и т.п. */
91
+ path: string;
92
+ message: string;
93
+ }
94
+ /** Результат валидации: ошибки блокируют apply, предупреждения — нет. */
95
+ export interface PipelineValidationResult {
96
+ ok: boolean;
97
+ errors: PipelineIssue[];
98
+ warnings: PipelineIssue[];
99
+ }
100
+ /** Имя задачи по умолчанию для шага pipeline. */
101
+ export declare function pipelineStepTaskName(pipelineName: string, stepId: string): string;
102
+ /**
103
+ * Валидирует произвольный разобранный YAML.
104
+ *
105
+ * Не бросает исключений: все проблемы складываются в `errors`/`warnings`,
106
+ * чтобы CLI мог напечатать их списком и вернуть exit code.
107
+ */
108
+ export declare function validatePipelineSpec(input: unknown): PipelineValidationResult;
109
+ //# sourceMappingURL=pipeline-spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-spec.d.ts","sourceRoot":"","sources":["../../src/core/pipeline-spec.ts"],"names":[],"mappings":"AAgBA,OAA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