@usine/orchestrator 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +151 -50
  2. package/dist/board/items.d.ts +9 -1
  3. package/dist/board/items.d.ts.map +1 -1
  4. package/dist/board/items.js +16 -4
  5. package/dist/board/items.js.map +1 -1
  6. package/dist/board/projection.d.ts +7 -1
  7. package/dist/board/projection.d.ts.map +1 -1
  8. package/dist/board/projection.js +53 -14
  9. package/dist/board/projection.js.map +1 -1
  10. package/dist/board/tasks.d.ts +14 -2
  11. package/dist/board/tasks.d.ts.map +1 -1
  12. package/dist/board/tasks.js +23 -8
  13. package/dist/board/tasks.js.map +1 -1
  14. package/dist/credentials.d.ts +5 -6
  15. package/dist/credentials.d.ts.map +1 -1
  16. package/dist/credentials.js +22 -15
  17. package/dist/credentials.js.map +1 -1
  18. package/dist/current-instance/changes.d.ts +87 -0
  19. package/dist/current-instance/changes.d.ts.map +1 -0
  20. package/dist/current-instance/changes.js +138 -0
  21. package/dist/current-instance/changes.js.map +1 -0
  22. package/dist/current-instance/current-instance.d.ts +89 -0
  23. package/dist/current-instance/current-instance.d.ts.map +1 -0
  24. package/dist/current-instance/current-instance.js +163 -0
  25. package/dist/current-instance/current-instance.js.map +1 -0
  26. package/dist/exe-dev.d.ts +6 -2
  27. package/dist/exe-dev.d.ts.map +1 -1
  28. package/dist/exe-dev.js +7 -8
  29. package/dist/exe-dev.js.map +1 -1
  30. package/dist/idle-triggers.d.ts +1 -1
  31. package/dist/idle-triggers.d.ts.map +1 -1
  32. package/dist/idle-triggers.js +1 -1
  33. package/dist/idle-triggers.js.map +1 -1
  34. package/dist/label-reconciler.d.ts +5 -2
  35. package/dist/label-reconciler.d.ts.map +1 -1
  36. package/dist/label-reconciler.js.map +1 -1
  37. package/dist/local.d.ts +4 -18
  38. package/dist/local.d.ts.map +1 -1
  39. package/dist/local.js +7 -45
  40. package/dist/local.js.map +1 -1
  41. package/dist/loop-matches.d.ts +28 -0
  42. package/dist/loop-matches.d.ts.map +1 -0
  43. package/dist/loop-matches.js +74 -0
  44. package/dist/loop-matches.js.map +1 -0
  45. package/dist/operator/attempt.d.ts +60 -10
  46. package/dist/operator/attempt.d.ts.map +1 -1
  47. package/dist/operator/attempt.js +54 -11
  48. package/dist/operator/attempt.js.map +1 -1
  49. package/dist/operator/board.d.ts +43 -16
  50. package/dist/operator/board.d.ts.map +1 -1
  51. package/dist/operator/board.js +43 -16
  52. package/dist/operator/board.js.map +1 -1
  53. package/dist/operator/configuration.d.ts +258 -0
  54. package/dist/operator/configuration.d.ts.map +1 -0
  55. package/dist/operator/configuration.js +410 -0
  56. package/dist/operator/configuration.js.map +1 -0
  57. package/dist/operator/desk.d.ts +181 -0
  58. package/dist/operator/desk.d.ts.map +1 -0
  59. package/dist/operator/desk.js +463 -0
  60. package/dist/operator/desk.js.map +1 -0
  61. package/dist/operator/github-changes.d.ts +88 -0
  62. package/dist/operator/github-changes.d.ts.map +1 -0
  63. package/dist/operator/github-changes.js +266 -0
  64. package/dist/operator/github-changes.js.map +1 -0
  65. package/dist/operator/http.d.ts +191 -30
  66. package/dist/operator/http.d.ts.map +1 -1
  67. package/dist/operator/http.js +153 -23
  68. package/dist/operator/http.js.map +1 -1
  69. package/dist/operator/need.d.ts +44 -11
  70. package/dist/operator/need.d.ts.map +1 -1
  71. package/dist/operator/need.js +46 -9
  72. package/dist/operator/need.js.map +1 -1
  73. package/dist/operator/operator.d.ts +111 -27
  74. package/dist/operator/operator.d.ts.map +1 -1
  75. package/dist/operator/operator.js +286 -45
  76. package/dist/operator/operator.js.map +1 -1
  77. package/dist/operator/overview.d.ts +7 -7
  78. package/dist/operator/overview.d.ts.map +1 -1
  79. package/dist/operator/overview.js +5 -5
  80. package/dist/operator/overview.js.map +1 -1
  81. package/dist/operator/projection.d.ts +56 -4
  82. package/dist/operator/projection.d.ts.map +1 -1
  83. package/dist/operator/projection.js +125 -15
  84. package/dist/operator/projection.js.map +1 -1
  85. package/dist/operator/run.d.ts +92 -3
  86. package/dist/operator/run.d.ts.map +1 -1
  87. package/dist/operator/run.js +87 -4
  88. package/dist/operator/run.js.map +1 -1
  89. package/dist/operator/task.d.ts +93 -0
  90. package/dist/operator/task.d.ts.map +1 -0
  91. package/dist/operator/task.js +204 -0
  92. package/dist/operator/task.js.map +1 -0
  93. package/dist/operator/transcript.d.ts +14 -12
  94. package/dist/operator/transcript.d.ts.map +1 -1
  95. package/dist/operator/transcript.js +18 -9
  96. package/dist/operator/transcript.js.map +1 -1
  97. package/dist/operator/usage.d.ts +111 -0
  98. package/dist/operator/usage.d.ts.map +1 -0
  99. package/dist/operator/usage.js +219 -0
  100. package/dist/operator/usage.js.map +1 -0
  101. package/dist/orchestrator.d.ts +8 -5
  102. package/dist/orchestrator.d.ts.map +1 -1
  103. package/dist/orchestrator.js +4 -2
  104. package/dist/orchestrator.js.map +1 -1
  105. package/dist/polling/cycle.d.ts +28 -10
  106. package/dist/polling/cycle.d.ts.map +1 -1
  107. package/dist/polling/cycle.js +20 -6
  108. package/dist/polling/cycle.js.map +1 -1
  109. package/dist/polling/evaluation-failures.d.ts +42 -0
  110. package/dist/polling/evaluation-failures.d.ts.map +1 -0
  111. package/dist/polling/evaluation-failures.js +103 -0
  112. package/dist/polling/evaluation-failures.js.map +1 -0
  113. package/dist/polling/hints.d.ts +2 -2
  114. package/dist/polling/hints.d.ts.map +1 -1
  115. package/dist/polling/hints.js +2 -2
  116. package/dist/polling/hints.js.map +1 -1
  117. package/dist/polling/loop-evaluation.d.ts +21 -11
  118. package/dist/polling/loop-evaluation.d.ts.map +1 -1
  119. package/dist/polling/loop-evaluation.js +70 -27
  120. package/dist/polling/loop-evaluation.js.map +1 -1
  121. package/dist/polling/open-issues.d.ts +23 -0
  122. package/dist/polling/open-issues.d.ts.map +1 -0
  123. package/dist/polling/open-issues.js +77 -0
  124. package/dist/polling/open-issues.js.map +1 -0
  125. package/dist/polling/polling.d.ts +20 -11
  126. package/dist/polling/polling.d.ts.map +1 -1
  127. package/dist/polling/polling.js +201 -51
  128. package/dist/polling/polling.js.map +1 -1
  129. package/dist/polling/repository-sync.d.ts +20 -14
  130. package/dist/polling/repository-sync.d.ts.map +1 -1
  131. package/dist/polling/repository-sync.js +34 -27
  132. package/dist/polling/repository-sync.js.map +1 -1
  133. package/dist/polling-triggers.d.ts +1 -1
  134. package/dist/polling-triggers.d.ts.map +1 -1
  135. package/dist/polling-triggers.js +1 -1
  136. package/dist/polling-triggers.js.map +1 -1
  137. package/dist/reloads.d.ts +14 -0
  138. package/dist/reloads.d.ts.map +1 -0
  139. package/dist/reloads.js +7 -0
  140. package/dist/reloads.js.map +1 -0
  141. package/dist/runtime.d.ts +24 -0
  142. package/dist/runtime.d.ts.map +1 -0
  143. package/dist/runtime.js +58 -0
  144. package/dist/runtime.js.map +1 -0
  145. package/dist/schedule-triggers.d.ts +14 -10
  146. package/dist/schedule-triggers.d.ts.map +1 -1
  147. package/dist/schedule-triggers.js +36 -31
  148. package/dist/schedule-triggers.js.map +1 -1
  149. package/dist/scheduler.d.ts +35 -4
  150. package/dist/scheduler.d.ts.map +1 -1
  151. package/dist/scheduler.js +327 -40
  152. package/dist/scheduler.js.map +1 -1
  153. package/dist/ssh.d.ts +39 -0
  154. package/dist/ssh.d.ts.map +1 -0
  155. package/dist/ssh.js +75 -0
  156. package/dist/ssh.js.map +1 -0
  157. package/dist/trigger-condition.d.ts +12 -0
  158. package/dist/trigger-condition.d.ts.map +1 -0
  159. package/dist/trigger-condition.js +88 -0
  160. package/dist/trigger-condition.js.map +1 -0
  161. package/dist/trigger-submission.d.ts +16 -13
  162. package/dist/trigger-submission.d.ts.map +1 -1
  163. package/dist/trigger-submission.js +21 -26
  164. package/dist/trigger-submission.js.map +1 -1
  165. package/dist/worker-engine.d.ts +10 -0
  166. package/dist/worker-engine.d.ts.map +1 -0
  167. package/dist/worker-engine.js +25 -0
  168. package/dist/worker-engine.js.map +1 -0
  169. package/dist/worker-status.d.ts +70 -0
  170. package/dist/worker-status.d.ts.map +1 -0
  171. package/dist/worker-status.js +55 -0
  172. package/dist/worker-status.js.map +1 -0
  173. package/package.json +31 -10
@@ -0,0 +1,266 @@
1
+ import { LaneName } from "@usine/config/board";
2
+ import { canonicalLabelName, GitHubLabelName } from "@usine/config/label";
3
+ import { AttemptId, AttemptWindow, windowHolds, windowOf } from "@usine/core/attempt";
4
+ import { BoardMoves } from "@usine/engine/board-moves";
5
+ import { RunReader } from "@usine/engine/run-reader";
6
+ import { TranscriptPageQuery } from "@usine/engine/transcript";
7
+ import { GitHubItemHistory, ReviewState, } from "@usine/github/item-history";
8
+ import { Clock, Context, DateTime, Effect, Layer, Match, Option, Ref, Schema } from "effect";
9
+ import { GitHubItemKey } from "../polling/repository-sync.js";
10
+ import { LabelView } from "./board.js";
11
+ /**
12
+ * A label that an Attempt's Agent added to the Run's Item, with GitHub's current label definition.
13
+ */
14
+ export class LabelAddedView extends Schema.TaggedClass("@usine/orchestrator/LabelAddedView")("LabelAdded", { at: Schema.String, label: LabelView }) {
15
+ }
16
+ /**
17
+ * A label that an Attempt's Agent removed from the Run's Item, with GitHub's current label
18
+ * definition.
19
+ */
20
+ export class LabelRemovedView extends Schema.TaggedClass("@usine/orchestrator/LabelRemovedView")("LabelRemoved", { at: Schema.String, label: LabelView }) {
21
+ }
22
+ /** A comment that an Attempt's Agent posted on the Run's Item. */
23
+ export class CommentedView extends Schema.TaggedClass("@usine/orchestrator/CommentedView")("Commented", { at: Schema.String, url: Schema.String }) {
24
+ }
25
+ /** A review that an Attempt's Agent submitted on the Run's pull request, with its current state. */
26
+ export class ReviewedView extends Schema.TaggedClass("@usine/orchestrator/ReviewedView")("Reviewed", { at: Schema.String, url: Schema.String, state: ReviewState }) {
27
+ }
28
+ /**
29
+ * An operator move of the Run's Item between Board lanes during an Attempt. `at` is when the
30
+ * operator made the move.
31
+ */
32
+ export class BoardMovedView extends Schema.TaggedClass("@usine/orchestrator/BoardMovedView")("BoardMoved", { at: Schema.String, fromLane: LaneName, toLane: LaneName }) {
33
+ }
34
+ /**
35
+ * A change on the Run's GitHub Item during an Attempt: one made by the Agent, or an operator Board
36
+ * move.
37
+ */
38
+ export const GitHubChangeView = Schema.Union([
39
+ LabelAddedView,
40
+ LabelRemovedView,
41
+ CommentedView,
42
+ ReviewedView,
43
+ BoardMovedView,
44
+ ]);
45
+ /** The changes on the Run's GitHub Item during one Attempt, oldest first. */
46
+ export class AttemptGitHubChangesView extends Schema.Class("@usine/orchestrator/AttemptGitHubChangesView")({ attemptId: AttemptId, changes: Schema.Array(GitHubChangeView) }) {
47
+ }
48
+ /**
49
+ * The GitHub changes of each of a Run's Attempts, in Attempt order. Empty for a Run without a
50
+ * GitHub Item, such as a schedule Run.
51
+ */
52
+ export class RunGitHubChangesView extends Schema.Class("@usine/orchestrator/RunGitHubChangesView")({ attempts: Schema.Array(AttemptGitHubChangesView) }) {
53
+ }
54
+ /** The maximum number of ended Attempts whose changes are cached; the oldest are evicted first. */
55
+ const CACHE_CAPACITY = 1_000;
56
+ /**
57
+ * The time after an Attempt ends before its changes are cached, since GitHub's timeline can trail a
58
+ * write by seconds.
59
+ */
60
+ const SETTLE_MILLIS = 60_000;
61
+ /**
62
+ * The maximum lag of GitHub's clock behind the orchestrator's when recording a Board move's label
63
+ * change.
64
+ */
65
+ const CLOCK_SKEW_MILLIS = 1_000;
66
+ /** The maximum time after a Board move is recorded for all its label writes to appear on GitHub. */
67
+ const MOVE_SPAN_MILLIS = 10_000;
68
+ /**
69
+ * Assigns each change to the one Attempt whose window contains it. A change inside two Attempts'
70
+ * windows is assigned to neither, since every Agent writes as the same App.
71
+ */
72
+ const attribute = (windows, changes) => {
73
+ const attributed = new Map();
74
+ const ambiguous = [];
75
+ for (const change of changes) {
76
+ const holders = windows.filter((window) => windowHolds(window, change.at));
77
+ const [holder, ...others] = holders;
78
+ if (holder === undefined)
79
+ continue;
80
+ if (others.length > 0) {
81
+ ambiguous.push(change);
82
+ continue;
83
+ }
84
+ attributed.set(holder.attemptId, [...(attributed.get(holder.attemptId) ?? []), change]);
85
+ }
86
+ return { attributed, ambiguous };
87
+ };
88
+ /**
89
+ * Whether `move` made this label change: same label and direction, recorded between the move time
90
+ * minus clock skew and the end of the move's span.
91
+ */
92
+ const madeBy = (change) => (move) => {
93
+ const recorded = DateTime.toEpochMillis(move.at);
94
+ const earliest = recorded - CLOCK_SKEW_MILLIS;
95
+ const at = DateTime.toEpochMillis(change.at);
96
+ const name = canonicalLabelName(change.label.name);
97
+ return (earliest - (earliest % 1_000) <= at &&
98
+ at <= recorded + MOVE_SPAN_MILLIS &&
99
+ (change._tag === "LabelAdded" ? move.added : move.removed).some((label) => canonicalLabelName(label) === name));
100
+ };
101
+ /**
102
+ * Splits the App's changes into the Board moves that made some of them and the remaining changes.
103
+ * Drops moves with no change on the timeline, such as writes GitHub refused.
104
+ */
105
+ const separateBoardMoves = (moves, changes) => {
106
+ const made = new Set();
107
+ const rest = [];
108
+ for (const change of changes) {
109
+ const move = change._tag === "LabelAdded" || change._tag === "LabelRemoved"
110
+ ? moves.find(madeBy(change))
111
+ : undefined;
112
+ if (move === undefined)
113
+ rest.push(change);
114
+ else
115
+ made.add(move);
116
+ }
117
+ return { moves: moves.filter((move) => made.has(move)), rest };
118
+ };
119
+ const labelView = (label) => new LabelView({
120
+ name: GitHubLabelName.make(label.name),
121
+ color: label.color,
122
+ description: Option.getOrNull(label.description),
123
+ });
124
+ const changeView = (change) => Match.valueTags(change, {
125
+ LabelAdded: ({ at, label }) => new LabelAddedView({ at: DateTime.formatIso(at), label: labelView(label) }),
126
+ LabelRemoved: ({ at, label }) => new LabelRemovedView({ at: DateTime.formatIso(at), label: labelView(label) }),
127
+ Commented: ({ at, url }) => new CommentedView({ at: DateTime.formatIso(at), url }),
128
+ Reviewed: ({ at, url, state }) => new ReviewedView({ at: DateTime.formatIso(at), url, state }),
129
+ });
130
+ const moveView = (move) => new BoardMovedView({
131
+ at: DateTime.formatIso(move.at),
132
+ fromLane: LaneName.make(move.fromLane),
133
+ toLane: LaneName.make(move.toLane),
134
+ });
135
+ const makeRunGitHubChanges = Effect.gen(function* () {
136
+ const reader = yield* RunReader;
137
+ const history = yield* GitHubItemHistory;
138
+ const boardMoves = yield* BoardMoves;
139
+ const cache = yield* Ref.make(new Map());
140
+ // Attempts that ended before end times were recorded end at their last transcript row.
141
+ const windowFor = Effect.fn("RunGitHubChanges.windowFor")(function* (attempt) {
142
+ const recorded = windowOf(attempt);
143
+ if (Option.isSome(recorded))
144
+ return recorded;
145
+ const [last] = yield* reader.transcript(new TranscriptPageQuery({ attemptId: attempt.id, before: Option.none(), limit: 1 }));
146
+ if (last === undefined) {
147
+ yield* Effect.logInfo("An ended Attempt has neither an end time nor a transcript; no GitHub change is placed in it", { attemptId: attempt.id });
148
+ return Option.none();
149
+ }
150
+ return Option.some(new AttemptWindow({
151
+ attemptId: attempt.id,
152
+ startedAt: attempt.startedAt,
153
+ endedAt: Option.some(last.receivedAt),
154
+ }));
155
+ });
156
+ const read = Effect.fn("RunGitHubChanges.read")(function* (runId) {
157
+ yield* Effect.annotateCurrentSpan({ runId });
158
+ const snapshot = yield* reader.inspect(runId);
159
+ const item = Schema.decodeOption(GitHubItemKey)(snapshot.itemKey);
160
+ if (Option.isNone(item)) {
161
+ yield* Effect.logDebug("The Run has no GitHub Item, so it has no GitHub changes", { runId });
162
+ return new RunGitHubChangesView({ attempts: [] });
163
+ }
164
+ const [, , number] = item.value;
165
+ const repository = snapshot.repository;
166
+ yield* Effect.annotateCurrentSpan({ repository, item: number });
167
+ const view = (changes) => new RunGitHubChangesView({
168
+ attempts: snapshot.attempts.map(({ id }) => new AttemptGitHubChangesView({ attemptId: id, changes: changes.get(id) ?? [] })),
169
+ });
170
+ const cached = yield* Ref.get(cache);
171
+ const missing = snapshot.attempts.filter(({ id }) => !cached.has(id));
172
+ if (missing.length === 0) {
173
+ yield* Effect.logDebug("Served the Run's GitHub changes from the Attempt cache", {
174
+ runId,
175
+ attempts: snapshot.attempts.length,
176
+ });
177
+ return view(cached);
178
+ }
179
+ const itemRuns = yield* reader.forItems([snapshot.itemKey]);
180
+ const onItem = new Map([...itemRuns.flatMap(({ attempts }) => attempts), ...snapshot.attempts].map((attempt) => [
181
+ attempt.id,
182
+ attempt,
183
+ ]));
184
+ const windows = (yield* Effect.forEach([...onItem.values()], windowFor)).flatMap(Option.toArray);
185
+ const now = yield* Clock.currentTimeMillis;
186
+ const fresh = new Map();
187
+ const settled = [];
188
+ const placeable = missing.flatMap((attempt) => {
189
+ const window = windows.find(({ attemptId }) => attemptId === attempt.id);
190
+ if (window !== undefined)
191
+ return [window];
192
+ fresh.set(attempt.id, []);
193
+ settled.push(attempt.id);
194
+ return [];
195
+ });
196
+ if (placeable.length > 0) {
197
+ const earliest = Math.min(...placeable.map(({ startedAt }) => DateTime.toEpochMillis(startedAt)));
198
+ const since = DateTime.makeUnsafe(earliest - (earliest % 1_000));
199
+ // A move recorded shortly before the earliest window can still appear in it.
200
+ const [changes, recorded] = yield* Effect.all([
201
+ history.appChanges(repository, number, since),
202
+ boardMoves.onItem(snapshot.itemKey, DateTime.subtract(since, { milliseconds: MOVE_SPAN_MILLIS })),
203
+ ], { concurrency: "unbounded" });
204
+ const { moves, rest } = separateBoardMoves(recorded, changes);
205
+ const { attributed, ambiguous } = attribute(windows, rest);
206
+ if (ambiguous.length > 0)
207
+ yield* Effect.logInfo("Left out GitHub changes that overlapping Attempts on the Item could each have made", {
208
+ runId,
209
+ repository,
210
+ item: number,
211
+ changes: ambiguous.length,
212
+ at: ambiguous.map(({ at }) => DateTime.formatIso(at)).join(", "),
213
+ });
214
+ for (const window of placeable) {
215
+ const own = [
216
+ ...(attributed.get(window.attemptId) ?? []).map((change) => ({
217
+ at: DateTime.toEpochMillis(change.at),
218
+ view: changeView(change),
219
+ })),
220
+ ...moves.flatMap((move) => {
221
+ const at = DateTime.toEpochMillis(move.at);
222
+ const during = DateTime.toEpochMillis(window.startedAt) <= at &&
223
+ Option.match(window.endedAt, {
224
+ onNone: () => true,
225
+ onSome: (last) => at <= DateTime.toEpochMillis(last),
226
+ });
227
+ return during ? [{ at, view: moveView(move) }] : [];
228
+ }),
229
+ ];
230
+ fresh.set(window.attemptId, own.sort((left, right) => left.at - right.at).map(({ view }) => view));
231
+ if (Option.isSome(window.endedAt) &&
232
+ now - DateTime.toEpochMillis(window.endedAt.value) >= SETTLE_MILLIS)
233
+ settled.push(window.attemptId);
234
+ }
235
+ yield* Effect.logInfo("Read the App's GitHub changes on a Run's Item", {
236
+ runId,
237
+ repository,
238
+ item: number,
239
+ since: DateTime.formatIso(since),
240
+ appChanges: changes.length,
241
+ boardMoves: recorded.length,
242
+ boardMoveChanges: changes.length - rest.length,
243
+ placed: placeable.reduce((count, { attemptId }) => count + (attributed.get(attemptId)?.length ?? 0), 0),
244
+ cachedAttempts: settled.length,
245
+ });
246
+ }
247
+ const merged = yield* Ref.updateAndGet(cache, (current) => {
248
+ const next = new Map(current);
249
+ for (const attemptId of settled)
250
+ next.set(attemptId, fresh.get(attemptId) ?? []);
251
+ for (const oldest of [...next.keys()].slice(0, Math.max(0, next.size - CACHE_CAPACITY)))
252
+ next.delete(oldest);
253
+ return next;
254
+ });
255
+ return view(new Map([...merged, ...fresh]));
256
+ });
257
+ return { read };
258
+ });
259
+ /**
260
+ * Reads the Agent's label, comment, and review changes and the operator's Board moves on the Run's
261
+ * GitHub Item during each Attempt. Label changes made by a recorded Board move are the operator's.
262
+ */
263
+ export class RunGitHubChanges extends Context.Service()("@usine/orchestrator/RunGitHubChanges") {
264
+ static layer = Layer.effect(RunGitHubChanges, makeRunGitHubChanges);
265
+ }
266
+ //# sourceMappingURL=github-changes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-changes.js","sourceRoot":"","sources":["../../src/operator/github-changes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,E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OAAO,CAAC,CAAC;YAC9B,KAAK,MAAM,SAAS,IAAI,OAAO;gBAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;YACjF,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,CAAC;gBACrF,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACtB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAW,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,OAAO,CAAC,OAAO,EAKlD,CAAC,sCAAsC,CAAC;IACzC,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;CAC9E"}
@@ -1,69 +1,134 @@
1
1
  import { Schema } from "effect";
2
2
  import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware } from "effect/unstable/httpapi";
3
+ import { InstanceReload } from "../current-instance/changes.ts";
4
+ import type { InstanceReloadError } from "../current-instance/current-instance.ts";
3
5
  import { ColdTranscriptRequest, EarlierTranscriptRequest, TailTranscriptRequest } from "./transcript.ts";
4
- import { RunDetailView } from "./run.ts";
6
+ import { RunDetailView, EditAndRetry, SessionIntervention } from "./run.ts";
7
+ import { RunGitHubChangesView } from "./github-changes.ts";
8
+ import { TaskView } from "./task.ts";
9
+ import { ConfigurationView } from "./configuration.ts";
10
+ import { DeskView } from "./desk.ts";
5
11
  declare const OperatorHttpError_base: Schema.Class<OperatorHttpError, Schema.Struct<{
6
- readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
12
+ readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "FactoryConfigError" | "GitHubApiError" | "GitHubItemNotFoundError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "LeftoversDiscardRejectedError" | "LoopNotFoundError" | "ReloadPreflightError" | "RestartRequiredError" | "RosterAgentNotFoundError" | "RunInterventionRejectedError" | "RunNotFoundError" | "RunOperationRejectedError" | "RunRetryBlockedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
7
13
  readonly message: Schema.String;
8
14
  }>, import("effect/Cause").YieldableError>;
9
15
  /**
10
- * An operator request that could not be fulfilled. `error` preserves the domain
11
- * failure's identity and `message` is safe to show to the operator; persistence
12
- * details, credentials, and defect causes never travel in this envelope.
16
+ * A failed operator request. `error` is the domain failure's tag and `message` is safe to show;
17
+ * persistence details, credentials, and defect causes are never included.
13
18
  */
14
19
  export declare class OperatorHttpError extends OperatorHttpError_base {
15
- /** The existing HTTP status associated with this refusal or failure. */
16
- get status(): 400 | 403 | 404 | 409 | 500 | 502 | 503;
20
+ /** The HTTP status for this error. */
21
+ get status(): 400 | 403 | 404 | 409 | 422 | 500 | 502 | 503;
17
22
  }
18
23
  declare const OperatorHttpPolicy_base: HttpApiMiddleware.ServiceClass<OperatorHttpPolicy, "@usine/orchestrator/OperatorHttpPolicy", {
19
24
  requires: never;
20
25
  provides: never;
21
26
  error: Schema.decodeTo<Schema.declareConstructor<OperatorHttpError, {
22
- readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
27
+ readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "FactoryConfigError" | "GitHubApiError" | "GitHubItemNotFoundError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "LeftoversDiscardRejectedError" | "LoopNotFoundError" | "ReloadPreflightError" | "RestartRequiredError" | "RosterAgentNotFoundError" | "RunInterventionRejectedError" | "RunNotFoundError" | "RunOperationRejectedError" | "RunRetryBlockedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
23
28
  readonly message: string;
24
29
  }, readonly [Schema.Struct<{
25
- readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
30
+ readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "FactoryConfigError" | "GitHubApiError" | "GitHubItemNotFoundError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "LeftoversDiscardRejectedError" | "LoopNotFoundError" | "ReloadPreflightError" | "RestartRequiredError" | "RosterAgentNotFoundError" | "RunInterventionRejectedError" | "RunNotFoundError" | "RunOperationRejectedError" | "RunRetryBlockedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
26
31
  readonly message: Schema.String;
27
32
  }>], {
28
- readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
33
+ readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "FactoryConfigError" | "GitHubApiError" | "GitHubItemNotFoundError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "LeftoversDiscardRejectedError" | "LoopNotFoundError" | "ReloadPreflightError" | "RestartRequiredError" | "RosterAgentNotFoundError" | "RunInterventionRejectedError" | "RunNotFoundError" | "RunOperationRejectedError" | "RunRetryBlockedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
29
34
  readonly message: string;
30
35
  }>, Schema.Struct<{
31
- readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
36
+ readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "FactoryConfigError" | "GitHubApiError" | "GitHubItemNotFoundError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "LeftoversDiscardRejectedError" | "LoopNotFoundError" | "ReloadPreflightError" | "RestartRequiredError" | "RosterAgentNotFoundError" | "RunInterventionRejectedError" | "RunNotFoundError" | "RunOperationRejectedError" | "RunRetryBlockedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
32
37
  readonly message: Schema.String;
33
38
  }>, never, never>[];
34
39
  clientError: never;
35
40
  requiredForClient: false;
36
41
  security: never;
37
42
  }, HttpApiMiddleware.HttpApiMiddleware<never, Schema.decodeTo<Schema.declareConstructor<OperatorHttpError, {
38
- readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
43
+ readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "FactoryConfigError" | "GitHubApiError" | "GitHubItemNotFoundError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "LeftoversDiscardRejectedError" | "LoopNotFoundError" | "ReloadPreflightError" | "RestartRequiredError" | "RosterAgentNotFoundError" | "RunInterventionRejectedError" | "RunNotFoundError" | "RunOperationRejectedError" | "RunRetryBlockedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
39
44
  readonly message: string;
40
45
  }, readonly [Schema.Struct<{
41
- readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
46
+ readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "FactoryConfigError" | "GitHubApiError" | "GitHubItemNotFoundError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "LeftoversDiscardRejectedError" | "LoopNotFoundError" | "ReloadPreflightError" | "RestartRequiredError" | "RosterAgentNotFoundError" | "RunInterventionRejectedError" | "RunNotFoundError" | "RunOperationRejectedError" | "RunRetryBlockedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
42
47
  readonly message: Schema.String;
43
48
  }>], {
44
- readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
49
+ readonly error: "AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "FactoryConfigError" | "GitHubApiError" | "GitHubItemNotFoundError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "LeftoversDiscardRejectedError" | "LoopNotFoundError" | "ReloadPreflightError" | "RestartRequiredError" | "RosterAgentNotFoundError" | "RunInterventionRejectedError" | "RunNotFoundError" | "RunOperationRejectedError" | "RunRetryBlockedError" | "SchemaError" | "TranscriptAttemptNotFoundError";
45
50
  readonly message: string;
46
51
  }>, Schema.Struct<{
47
- readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "GitHubApiError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "RunNotFoundError" | "RunOperationRejectedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
52
+ readonly error: Schema.Literals<("AppPermissionError" | "AttemptCancellationError" | "BackendUnavailableError" | "BoardItemNotFoundError" | "BoardLaneNotFoundError" | "BoardLaneReadOnlyError" | "BoardProjectNotFoundError" | "CrossSiteRequestError" | "CycleBudgetResetRejectedError" | "EnginePersistenceError" | "FactoryConfigError" | "GitHubApiError" | "GitHubItemNotFoundError" | "GitHubRateLimitError" | "HttpBodyError" | "InstallationDiscoveryError" | "InvalidGitHubResponseError" | "InvalidRequestError" | "LeftoversDiscardRejectedError" | "LoopNotFoundError" | "ReloadPreflightError" | "RestartRequiredError" | "RosterAgentNotFoundError" | "RunInterventionRejectedError" | "RunNotFoundError" | "RunOperationRejectedError" | "RunRetryBlockedError" | "SchemaError" | "TranscriptAttemptNotFoundError")[]>;
48
53
  readonly message: Schema.String;
49
54
  }>, never, never>[], never>>;
50
55
  /**
51
- * Server policy for the operator transport: refuse cross-site origins before
52
- * decoding or executing requests, and translate failures into operator envelopes.
53
- * A server must supply this middleware; generated clients need no middleware layer.
56
+ * Server middleware for the operator API that refuses cross-site origins before decoding requests
57
+ * and maps failures to operator envelopes. Servers must provide it; generated clients don't need
58
+ * it.
54
59
  */
55
60
  export declare class OperatorHttpPolicy extends OperatorHttpPolicy_base {
56
61
  }
57
62
  /**
58
- * The operator's HTTP reads and interventions. Server handlers and generated
59
- * clients derive URLs, request codecs, successful responses, and typed failures
60
- * from this contract. Action acknowledgement means the request was accepted;
61
- * subsequent observation reports execution and GitHub polling progress.
62
- *
63
- * This capability is platform-free (ADRs 0012 and 0020). Library consumers can
64
- * continue using Operator directly without an HTTP server or client.
63
+ * The Worker preflight failure behind a refused reload. The check's observation isn't sent to the
64
+ * client.
65
65
  */
66
- export declare const OperatorApi: HttpApi.HttpApi<"OperatorApi", HttpApiGroup.HttpApiGroup<"operator", HttpApiEndpoint.HttpApiEndpoint<"approve", "POST", "/api/runs/:runId/approve", Schema.toCodecStringTree<Schema.Struct<{
66
+ export declare const ReloadPreflightFailure: Schema.Union<readonly [Schema.TaggedStruct<"WorkerCapabilityError", {
67
+ readonly worker: Schema.brand<Schema.String, "WorkerName">;
68
+ readonly capability: Schema.Literals<readonly ["machine", "toolchain", "memory", "harness-login", "credentials", "gateway"]>;
69
+ readonly message: Schema.String;
70
+ }>, Schema.TaggedStruct<"ExecutorOperationError", {
71
+ readonly operation: Schema.Literals<readonly ["preflight", "prepare", "launch", "cancel", "cleanup"]>;
72
+ readonly message: Schema.String;
73
+ }>, Schema.TaggedStruct<"CredentialUnavailableError", {
74
+ readonly repository: Schema.brand<Schema.String, "RepositoryName">;
75
+ readonly message: Schema.String;
76
+ }>]>;
77
+ export type ReloadPreflightFailure = typeof ReloadPreflightFailure.Type;
78
+ declare const RestartRequiredRefusal_base: Schema.Class<RestartRequiredRefusal, Schema.Struct<{
79
+ readonly error: Schema.Literal<"RestartRequiredError">;
80
+ readonly message: Schema.String;
81
+ /** The `usine.yaml` blocks that contain the changed fields. */
82
+ readonly blocks: Schema.NonEmptyArray<Schema.Literals<readonly ["workers", "webhooks"]>>;
83
+ /**
84
+ * The changed fields as paths into `usine.yaml`, such as `webhooks` or
85
+ * `workers.build-1.destination`.
86
+ */
87
+ readonly fields: Schema.NonEmptyArray<Schema.NonEmptyString>;
88
+ }>, import("effect/Cause").YieldableError>;
89
+ /** A reload refused because `usine.yaml` changed in a way that needs a restart of `usine up`. */
90
+ export declare class RestartRequiredRefusal extends RestartRequiredRefusal_base {
91
+ }
92
+ declare const ReloadPreflightRefusal_base: Schema.Class<ReloadPreflightRefusal, Schema.Struct<{
93
+ readonly error: Schema.Literal<"ReloadPreflightError">;
94
+ readonly message: Schema.String;
95
+ /** The reloaded Agents whose brains preflight checked on every Worker. */
96
+ readonly agents: Schema.$Array<Schema.brand<Schema.String, "AgentName">>;
97
+ /** The Workers added or given more slots by the reload, which preflight checked. */
98
+ readonly workers: Schema.$Array<Schema.brand<Schema.String, "WorkerName">>;
99
+ readonly cause: Schema.Union<readonly [Schema.TaggedStruct<"WorkerCapabilityError", {
100
+ readonly worker: Schema.brand<Schema.String, "WorkerName">;
101
+ readonly capability: Schema.Literals<readonly ["machine", "toolchain", "memory", "harness-login", "credentials", "gateway"]>;
102
+ readonly message: Schema.String;
103
+ }>, Schema.TaggedStruct<"ExecutorOperationError", {
104
+ readonly operation: Schema.Literals<readonly ["preflight", "prepare", "launch", "cancel", "cleanup"]>;
105
+ readonly message: Schema.String;
106
+ }>, Schema.TaggedStruct<"CredentialUnavailableError", {
107
+ readonly repository: Schema.brand<Schema.String, "RepositoryName">;
108
+ readonly message: Schema.String;
109
+ }>]>;
110
+ }>, import("effect/Cause").YieldableError>;
111
+ /** A reload refused because Worker preflight failed for the Agents and Workers it adds. */
112
+ export declare class ReloadPreflightRefusal extends ReloadPreflightRefusal_base {
113
+ }
114
+ declare const FactoryConfigRefusal_base: Schema.Class<FactoryConfigRefusal, Schema.Struct<{
115
+ readonly error: Schema.Literal<"FactoryConfigError">;
116
+ readonly message: Schema.String;
117
+ readonly file: Schema.brand<Schema.NonEmptyString, "InstancePath">;
118
+ readonly stage: Schema.Literals<readonly ["expression", "frontmatter", "read", "reference", "schema", "yaml"]>;
119
+ }>, import("effect/Cause").YieldableError>;
120
+ /** A reload refused because `usine.yaml` or a file it depends on couldn't be loaded. */
121
+ export declare class FactoryConfigRefusal extends FactoryConfigRefusal_base {
122
+ }
123
+ /** The reason a reload kept the running instance. */
124
+ export type ReloadRefusal = RestartRequiredRefusal | ReloadPreflightRefusal | FactoryConfigRefusal;
125
+ /** Returns the reload endpoint's refusal for `error`, with `message` for the operator. */
126
+ export declare const reloadRefusal: (error: InstanceReloadError, message: string) => ReloadRefusal;
127
+ /**
128
+ * The operator's HTTP API contract for reads and interventions, shared by server handlers and
129
+ * generated clients. An action's acknowledgement only means the request was accepted.
130
+ */
131
+ export declare const OperatorApi: HttpApi.HttpApi<"OperatorApi", HttpApiGroup.HttpApiGroup<"operator", HttpApiEndpoint.HttpApiEndpoint<"agents", "GET", "/api/agents", never, never, never, never, Schema.toCodecJson<Schema.$Array<Schema.brand<Schema.String, "AgentName">>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"approve", "POST", "/api/runs/:runId/approve", Schema.toCodecStringTree<Schema.Struct<{
67
132
  runId: Schema.brand<Schema.NonEmptyString, "RunId">;
68
133
  }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
69
134
  readonly ok: Schema.Literal<true>;
@@ -71,7 +136,7 @@ export declare const OperatorApi: HttpApi.HttpApi<"OperatorApi", HttpApiGroup.Ht
71
136
  runId: Schema.brand<Schema.NonEmptyString, "RunId">;
72
137
  }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
73
138
  readonly ok: Schema.Literal<true>;
74
- }>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"detail", "GET", "/api/runs/:runId", Schema.toCodecStringTree<Schema.Struct<{
139
+ }>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"configuration", "GET", "/api/configuration", never, never, never, never, Schema.toCodecJson<typeof ConfigurationView>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"desk", "GET", "/api/desk", never, never, never, never, Schema.toCodecJson<typeof DeskView>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"detail", "GET", "/api/runs/:runId", Schema.toCodecStringTree<Schema.Struct<{
75
140
  runId: Schema.brand<Schema.NonEmptyString, "RunId">;
76
141
  }>>, Schema.toCodecStringTree<Schema.Union<readonly [Schema.decodeTo<Schema.toType<typeof ColdTranscriptRequest>, Schema.Struct<{
77
142
  readonly after: Schema.optionalKey<Schema.Never>;
@@ -85,7 +150,79 @@ export declare const OperatorApi: HttpApi.HttpApi<"OperatorApi", HttpApiGroup.Ht
85
150
  readonly after: Schema.optionalKey<Schema.Never>;
86
151
  readonly before: Schema.compose<Schema.brand<Schema.Int, "TranscriptSequence">, Schema.compose<Schema.FiniteFromString, Schema.Union<readonly [Schema.String, Schema.decodeTo<Schema.String, Schema.NonEmptyArray<Schema.String>, never, never>]>>>;
87
152
  readonly attempt: Schema.compose<Schema.brand<Schema.NonEmptyString, "AttemptId">, Schema.Union<readonly [Schema.String, Schema.decodeTo<Schema.String, Schema.NonEmptyArray<Schema.String>, never, never>]>>;
88
- }>, never, never>]>>, never, never, Schema.toCodecJson<typeof RunDetailView>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"moveBoardItem", "POST", "/api/projects/:owner/:repository/items/:item/lane", Schema.toCodecStringTree<Schema.Struct<{
153
+ }>, never, never>]>>, never, never, Schema.toCodecJson<typeof RunDetailView>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"discardLeftovers", "POST", "/api/workers/:worker/discard-leftovers", Schema.toCodecStringTree<Schema.Struct<{
154
+ worker: Schema.brand<Schema.String, "WorkerName">;
155
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
156
+ readonly ok: Schema.Literal<true>;
157
+ }>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"editAndRetry", "POST", "/api/runs/:runId/edit-and-retry", Schema.toCodecStringTree<Schema.Struct<{
158
+ runId: Schema.brand<Schema.NonEmptyString, "RunId">;
159
+ }>>, never, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<EditAndRetry, {
160
+ readonly task: string;
161
+ readonly agent: string;
162
+ }, readonly [Schema.Struct<{
163
+ readonly task: Schema.brand<Schema.String, "AttemptTask">;
164
+ readonly agent: Schema.brand<Schema.String, "AgentName">;
165
+ }>], {
166
+ readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
167
+ readonly agent: string & import("effect/Brand").Brand<"AgentName">;
168
+ }>, Schema.Struct<{
169
+ readonly task: Schema.brand<Schema.String, "AttemptTask">;
170
+ readonly agent: Schema.brand<Schema.String, "AgentName">;
171
+ }>, never, never>>, never, Schema.toCodecJson<Schema.Struct<{
172
+ readonly ok: Schema.Literal<true>;
173
+ }>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"githubChanges", "GET", "/api/runs/:runId/github-changes", Schema.toCodecStringTree<Schema.Struct<{
174
+ runId: Schema.brand<Schema.NonEmptyString, "RunId">;
175
+ }>>, never, never, never, Schema.toCodecJson<typeof RunGitHubChangesView>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"intervene", "POST", "/api/runs/:runId/intervene", Schema.toCodecStringTree<Schema.Struct<{
176
+ runId: Schema.brand<Schema.NonEmptyString, "RunId">;
177
+ }>>, never, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<SessionIntervention, {
178
+ readonly attemptId: string;
179
+ readonly target?: {
180
+ readonly _tag: "Parent";
181
+ } | {
182
+ readonly _tag: "Child";
183
+ readonly sessionId: string;
184
+ };
185
+ readonly action: {
186
+ readonly _tag: "Steer";
187
+ readonly message: string;
188
+ } | {
189
+ readonly _tag: "Interrupt";
190
+ } | {
191
+ readonly _tag: "OperatorMessage";
192
+ readonly message: string;
193
+ } | {
194
+ readonly _tag: "Release";
195
+ };
196
+ }, readonly [Schema.Struct<{
197
+ readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
198
+ readonly target: Schema.withDecodingDefaultKey<Schema.Union<readonly [typeof import("@usine/core/attempt/channel").ParentTarget, typeof import("@usine/core/attempt/channel").ChildTarget]>, never>;
199
+ readonly action: Schema.Union<readonly [typeof import("@usine/core/attempt/channel").Steer, typeof import("@usine/core/attempt/channel").Interrupt, typeof import("@usine/core/attempt/channel").OperatorMessage, typeof import("@usine/core/attempt/channel").Release]>;
200
+ }>], {
201
+ readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
202
+ readonly target: {
203
+ readonly _tag: "Parent";
204
+ } | {
205
+ readonly _tag: "Child";
206
+ readonly sessionId: string & import("effect/Brand").Brand<"AgentSessionId">;
207
+ };
208
+ readonly action: {
209
+ readonly _tag: "Steer";
210
+ readonly message: string;
211
+ } | {
212
+ readonly _tag: "Interrupt";
213
+ } | {
214
+ readonly _tag: "OperatorMessage";
215
+ readonly message: string;
216
+ } | {
217
+ readonly _tag: "Release";
218
+ };
219
+ }>, Schema.Struct<{
220
+ readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
221
+ readonly target: Schema.withDecodingDefaultKey<Schema.Union<readonly [typeof import("@usine/core/attempt/channel").ParentTarget, typeof import("@usine/core/attempt/channel").ChildTarget]>, never>;
222
+ readonly action: Schema.Union<readonly [typeof import("@usine/core/attempt/channel").Steer, typeof import("@usine/core/attempt/channel").Interrupt, typeof import("@usine/core/attempt/channel").OperatorMessage, typeof import("@usine/core/attempt/channel").Release]>;
223
+ }>, never, never>>, never, Schema.toCodecJson<Schema.Struct<{
224
+ readonly ok: Schema.Literal<true>;
225
+ }>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"moveBoardItem", "POST", "/api/projects/:owner/:repository/items/:item/lane", Schema.toCodecStringTree<Schema.Struct<{
89
226
  owner: Schema.String;
90
227
  repository: Schema.String;
91
228
  item: Schema.compose<Schema.brand<Schema.Int, "ItemNumber">, Schema.FiniteFromString>;
@@ -101,14 +238,38 @@ export declare const OperatorApi: HttpApi.HttpApi<"OperatorApi", HttpApiGroup.Ht
101
238
  readonly askId: Schema.brand<Schema.brand<Schema.NonEmptyString, "EventId">, "CycleBudgetAskId">;
102
239
  }>>, never, Schema.toCodecJson<Schema.Struct<{
103
240
  readonly ok: Schema.Literal<true>;
241
+ }>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"resolveFailure", "POST", "/api/runs/:runId/resolve-failure", Schema.toCodecStringTree<Schema.Struct<{
242
+ runId: Schema.brand<Schema.NonEmptyString, "RunId">;
243
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
244
+ readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
245
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
246
+ readonly ok: Schema.Literal<true>;
104
247
  }>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"retry", "POST", "/api/runs/:runId/retry", Schema.toCodecStringTree<Schema.Struct<{
105
248
  runId: Schema.brand<Schema.NonEmptyString, "RunId">;
106
249
  }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
107
250
  readonly ok: Schema.Literal<true>;
108
- }>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"unpause", "POST", "/api/loops/:loop/unpause", Schema.toCodecStringTree<Schema.Struct<{
251
+ }>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"runAgain", "POST", "/api/runs/:runId/run-again", Schema.toCodecStringTree<Schema.Struct<{
252
+ runId: Schema.brand<Schema.NonEmptyString, "RunId">;
253
+ }>>, never, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<EditAndRetry, {
254
+ readonly task: string;
255
+ readonly agent: string;
256
+ }, readonly [Schema.Struct<{
257
+ readonly task: Schema.brand<Schema.String, "AttemptTask">;
258
+ readonly agent: Schema.brand<Schema.String, "AgentName">;
259
+ }>], {
260
+ readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
261
+ readonly agent: string & import("effect/Brand").Brand<"AgentName">;
262
+ }>, Schema.Struct<{
263
+ readonly task: Schema.brand<Schema.String, "AttemptTask">;
264
+ readonly agent: Schema.brand<Schema.String, "AgentName">;
265
+ }>, never, never>>, never, Schema.toCodecJson<Schema.Union<readonly [typeof import("@usine/engine/engine").Claimed, typeof import("@usine/engine/engine").CycleBlocked]>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"task", "GET", "/api/projects/:owner/:repository/tasks/:item", Schema.toCodecStringTree<Schema.Struct<{
266
+ owner: Schema.String;
267
+ repository: Schema.String;
268
+ item: Schema.compose<Schema.brand<Schema.Int, "ItemNumber">, Schema.FiniteFromString>;
269
+ }>>, never, never, never, Schema.toCodecJson<typeof TaskView>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"unpause", "POST", "/api/loops/:loop/unpause", Schema.toCodecStringTree<Schema.Struct<{
109
270
  loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
110
271
  }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
111
272
  readonly ok: Schema.Literal<true>;
112
- }>>, never, OperatorHttpPolicy, never>, false>>;
273
+ }>>, never, OperatorHttpPolicy, never> | HttpApiEndpoint.HttpApiEndpoint<"reload", "POST", "/api/instance/reload", never, never, never, never, Schema.toCodecJson<typeof InstanceReload>, Schema.toCodecJson<typeof RestartRequiredRefusal | typeof ReloadPreflightRefusal | typeof FactoryConfigRefusal>, OperatorHttpPolicy, never>, false>>;
113
274
  export {};
114
275
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/operator/http.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,MAAM,EAAwB,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEpG,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,MAA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