@usine/orchestrator 0.2.1 → 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 -52
  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 +57 -10
  46. package/dist/operator/attempt.d.ts.map +1 -1
  47. package/dist/operator/attempt.js +49 -10
  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 +152 -57
  66. package/dist/operator/http.d.ts.map +1 -1
  67. package/dist/operator/http.js +140 -21
  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 +109 -29
  74. package/dist/operator/operator.d.ts.map +1 -1
  75. package/dist/operator/operator.js +254 -52
  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 +54 -5
  82. package/dist/operator/projection.d.ts.map +1 -1
  83. package/dist/operator/projection.js +100 -9
  84. package/dist/operator/projection.js.map +1 -1
  85. package/dist/operator/run.d.ts +71 -6
  86. package/dist/operator/run.d.ts.map +1 -1
  87. package/dist/operator/run.js +69 -6
  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 +12 -12
  94. package/dist/operator/transcript.d.ts.map +1 -1
  95. package/dist/operator/transcript.js +11 -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 -41
  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 +19 -14
  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
@@ -1,14 +1,20 @@
1
+ import { RunAgain } from "@usine/core/run/again";
2
+ import { ApprovalSource } from "@usine/core/run/approval";
1
3
  import { Schema } from "effect";
2
4
  import { AttemptView } from "./attempt.ts";
3
5
  import { TranscriptEventView, TranscriptPageCursor } from "./transcript.ts";
4
- /** The persisted Run lifecycle state as exposed in operator views. */
6
+ import { RunUsageView } from "./usage.ts";
7
+ /** The stored Run lifecycle state as shown in operator views. */
5
8
  export declare const RunStateTag: Schema.Literals<readonly ["Pending", "Waiting", "Queued", "Running", "Succeeded", "Failed", "Canceled"]>;
6
9
  export type RunStateTag = typeof RunStateTag.Type;
7
10
  declare const EditAndRetry_base: Schema.Class<EditAndRetry, Schema.Struct<{
8
11
  readonly task: Schema.brand<Schema.String, "AttemptTask">;
9
12
  readonly agent: Schema.brand<Schema.String, "AgentName">;
10
13
  }>, {}>;
11
- /** The operator's replacement task and selected roster member; the server derives the Agent's persona and brain. */
14
+ /**
15
+ * The operator's replacement task and roster Agent. The server derives the Agent's persona and
16
+ * brain.
17
+ */
12
18
  export declare class EditAndRetry extends EditAndRetry_base {
13
19
  }
14
20
  declare const SessionIntervention_base: Schema.Class<SessionIntervention, Schema.Struct<{
@@ -23,9 +29,24 @@ declare const RosterAgentNotFoundError_base: Schema.Class<RosterAgentNotFoundErr
23
29
  readonly agent: Schema.brand<Schema.String, "AgentName">;
24
30
  readonly message: Schema.String;
25
31
  }>, import("effect/Cause").YieldableError>;
26
- /** The requested Agent is absent from the loaded instance roster. */
32
+ /** The requested Agent isn't in the loaded roster. */
27
33
  export declare class RosterAgentNotFoundError extends RosterAgentNotFoundError_base {
28
34
  }
35
+ declare const LoopNotFoundError_base: Schema.Class<LoopNotFoundError, Schema.TaggedStruct<"LoopNotFoundError", {
36
+ readonly loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
37
+ readonly message: Schema.String;
38
+ }>, import("effect/Cause").YieldableError>;
39
+ /** The Run's Loop isn't in the loaded instance, so a new Run of it can't be opened. */
40
+ export declare class LoopNotFoundError extends LoopNotFoundError_base {
41
+ }
42
+ declare const ApprovalView_base: Schema.Class<ApprovalView, Schema.Struct<{
43
+ readonly approvedAt: Schema.String;
44
+ /** Null for approvals given before the approver was recorded. */
45
+ readonly source: Schema.NullOr<typeof ApprovalSource>;
46
+ }>, {}>;
47
+ /** A Run's approval: when it was given and, if recorded, who gave it and through which channel. */
48
+ export declare class ApprovalView extends ApprovalView_base {
49
+ }
29
50
  declare const RunView_base: Schema.Class<RunView, Schema.Struct<{
30
51
  readonly id: Schema.brand<Schema.NonEmptyString, "RunId">;
31
52
  readonly itemKey: Schema.brand<Schema.NonEmptyString, "ItemKey">;
@@ -35,27 +56,71 @@ declare const RunView_base: Schema.Class<RunView, Schema.Struct<{
35
56
  readonly state: Schema.Literals<readonly ["Pending", "Waiting", "Queued", "Running", "Succeeded", "Failed", "Canceled"]>;
36
57
  readonly loopPaused: Schema.Boolean;
37
58
  readonly openedAt: Schema.String;
59
+ /**
60
+ * When the Run last succeeded, failed, or was canceled, even before any Attempt. Null while open;
61
+ * a retry reopens a failed Run and clears it.
62
+ */
63
+ readonly closedAt: Schema.NullOr<Schema.String>;
38
64
  readonly task: Schema.String;
39
65
  readonly attempts: Schema.$Array<typeof AttemptView>;
66
+ /**
67
+ * The approval the Run consumed, or null until one arrives. Always null for a Loop with
68
+ * `approval: none`.
69
+ */
70
+ readonly approval: Schema.NullOr<typeof ApprovalView>;
71
+ /**
72
+ * The closed Run that the operator ran again to open this one, and who asked, or null for a
73
+ * trigger-opened Run. Its time is `openedAt`.
74
+ */
75
+ readonly runAgain: Schema.NullOr<typeof RunAgain>;
40
76
  readonly resultMessage: Schema.NullOr<Schema.String>;
41
77
  readonly pullRequestUrl: Schema.NullOr<Schema.String>;
42
78
  readonly canApprove: Schema.Boolean;
43
79
  readonly canRetry: Schema.Boolean;
80
+ /**
81
+ * Whether the latest failed Attempt still requests attention, independent of retry availability.
82
+ */
83
+ readonly canResolveFailure: Schema.Boolean;
44
84
  readonly canCancel: Schema.Boolean;
85
+ /**
86
+ * Whether the Run succeeded or was canceled, so the operator can open a new Run for its Item
87
+ * state.
88
+ */
89
+ readonly canRunAgain: Schema.Boolean;
45
90
  }>, {}>;
46
- /** A Run summary with its Attempts, result links, and currently available operator actions. */
91
+ /** A Run with its Attempts, result links, and available operator actions. */
47
92
  export declare class RunView extends RunView_base {
48
93
  }
94
+ declare const RunDurationView_base: Schema.Class<RunDurationView, Schema.Struct<{
95
+ /** The ended Attempts' time, each from start to recorded end. */
96
+ readonly endedMillis: Schema.Int;
97
+ /** The start of the running Attempt, or null if none runs. */
98
+ readonly runningSince: Schema.NullOr<Schema.String>;
99
+ /**
100
+ * The number of ended Attempts closed before end times were recorded, excluded from the total.
101
+ */
102
+ readonly unmeasured: Schema.Int;
103
+ }>, {}>;
104
+ /** The time a Run's Attempts worked, summed per Attempt. */
105
+ export declare class RunDurationView extends RunDurationView_base {
106
+ }
49
107
  declare const RunDetailView_base: Schema.Class<RunDetailView, Schema.Struct<{
50
108
  readonly run: typeof RunView;
51
109
  readonly eventDedupKey: Schema.String;
52
110
  readonly eventPayload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
53
111
  readonly transcript: Schema.$Array<typeof TranscriptEventView>;
54
- /** Current session controls remain available when their last activity predates the transcript page. */
112
+ /**
113
+ * The current session controls, included even when their last activity is before the transcript
114
+ * page.
115
+ */
55
116
  readonly sessionState: Schema.$Array<typeof TranscriptEventView>;
56
117
  readonly earlierTranscript: Schema.$Array<typeof TranscriptPageCursor>;
118
+ /** The Worker of the newest Attempt, or null before the first Attempt. */
119
+ readonly worker: Schema.withConstructorDefault<Schema.NullOr<Schema.brand<Schema.String, "WorkerName">>>;
120
+ readonly duration: Schema.withConstructorDefault<typeof RunDurationView>;
121
+ readonly usage: Schema.withConstructorDefault<typeof RunUsageView>;
57
122
  }>, {}>;
58
- /** A Run summary with its triggering Event payload and a bounded portion of its transcript. */
123
+ /** A Run with its triggering Event payload, a page of its transcript, and its usage. */
59
124
  export declare class RunDetailView extends RunDetailView_base {
60
125
  }
61
126
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/operator/run.ts"],"names":[],"mappings":"AAQA,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,sEAAsE;AACtE,eAAO,MAAM,WAAW,0GAAuC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAC;;;;;AAIlD,oHAAoH;AACpH,qBAAa,YAAa,SAAQ,iBAGhC;CAAG;;;;;;AAEL,wGAAwG;AACxG,qBAAa,mBAAoB,SAAQ,wBAMvC;CAAG;;;;;AAEL,qEAAqE;AACrE,qBAAa,wBAAyB,SAAQ,6BAE6B;CAAG;;;;;;;;;;;;;;;;;;AAE9E,+FAA+F;AAC/F,qBAAa,OAAQ,SAAQ,YAgB3B;CAAG;;;;;;IASD,uGAAuG;;;;AAP3G,+FAA+F;AAC/F,qBAAa,aAAc,SAAQ,kBAUlC;CAAG"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/operator/run.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,iEAAiE;AACjE,eAAO,MAAM,WAAW,0GAAuC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAC;;;;;AAIlD;;;GAGG;AACH,qBAAa,YAAa,SAAQ,iBAGhC;CAAG;;;;;;AAEL,wGAAwG;AACxG,qBAAa,mBAAoB,SAAQ,wBAMvC;CAAG;;;;;AAEL,sDAAsD;AACtD,qBAAa,wBAAyB,SAAQ,6BAE6B;CAAG;;;;;AAE9E,uFAAuF;AACvF,qBAAa,iBAAkB,SAAQ,sBAE2B;CAAG;;;IAKnE,iEAAiE;;;AAHnE,mGAAmG;AACnG,qBAAa,YAAa,SAAQ,iBAIhC;CAAG;;;;;;;;;;IAYH;;;OAGG;;;;IAIH;;;OAGG;;IAEH;;;OAGG;;;;;;IAMH;;OAEG;;;IAGH;;;OAGG;;;AAvCL,6EAA6E;AAC7E,qBAAa,OAAQ,SAAQ,YAwC3B;CAAG;;IASH,iEAAiE;;IAEjE,8DAA8D;;IAE9D;;OAEG;;;AAVL,4DAA4D;AAC5D,qBAAa,eAAgB,SAAQ,oBAWnC;CAAG;;;;;;IASD;;;OAGG;;;IAGH,0EAA0E;;;;;AAb9E,wFAAwF;AACxF,qBAAa,aAAc,SAAQ,kBAyBlC;CAAG"}
@@ -1,18 +1,26 @@
1
1
  import { AgentName } from "@usine/core/agent";
2
+ import { TokenCount } from "@usine/core/agent/session";
2
3
  import { AttemptId, AttemptTask } from "@usine/core/attempt";
3
4
  import { OperatorAction, SessionTarget } from "@usine/core/attempt/channel";
4
5
  import { ItemKey } from "@usine/core/item";
5
6
  import { LoopName } from "@usine/core/loop";
6
7
  import { RepositoryName } from "@usine/core/repository";
7
8
  import { RunId } from "@usine/core/run";
9
+ import { RunAgain } from "@usine/core/run/again";
10
+ import { ApprovalSource } from "@usine/core/run/approval";
8
11
  import * as RunState from "@usine/core/run/state";
12
+ import { WorkerName } from "@usine/core/worker";
9
13
  import { Effect, Schema } from "effect";
10
14
  import { AttemptView } from "./attempt.js";
11
15
  import { TranscriptEventView, TranscriptPageCursor } from "./transcript.js";
12
- /** The persisted Run lifecycle state as exposed in operator views. */
16
+ import { RunUsageView } from "./usage.js";
17
+ /** The stored Run lifecycle state as shown in operator views. */
13
18
  export const RunStateTag = Schema.Literals(RunState.STATE_TAGS);
14
19
  const NullableString = Schema.NullOr(Schema.String);
15
- /** The operator's replacement task and selected roster member; the server derives the Agent's persona and brain. */
20
+ /**
21
+ * The operator's replacement task and roster Agent. The server derives the Agent's persona and
22
+ * brain.
23
+ */
16
24
  export class EditAndRetry extends Schema.Class("@usine/orchestrator/EditAndRetry")({
17
25
  task: AttemptTask,
18
26
  agent: AgentName,
@@ -25,10 +33,20 @@ export class SessionIntervention extends Schema.Class("@usine/orchestrator/Sessi
25
33
  action: OperatorAction,
26
34
  }) {
27
35
  }
28
- /** The requested Agent is absent from the loaded instance roster. */
36
+ /** The requested Agent isn't in the loaded roster. */
29
37
  export class RosterAgentNotFoundError extends Schema.TaggedError("@usine/orchestrator/RosterAgentNotFoundError")("RosterAgentNotFoundError", { agent: AgentName, message: Schema.String }) {
30
38
  }
31
- /** A Run summary with its Attempts, result links, and currently available operator actions. */
39
+ /** The Run's Loop isn't in the loaded instance, so a new Run of it can't be opened. */
40
+ export class LoopNotFoundError extends Schema.TaggedError("@usine/orchestrator/LoopNotFoundError")("LoopNotFoundError", { loop: LoopName, message: Schema.String }) {
41
+ }
42
+ /** A Run's approval: when it was given and, if recorded, who gave it and through which channel. */
43
+ export class ApprovalView extends Schema.Class("@usine/orchestrator/ApprovalView")({
44
+ approvedAt: Schema.String,
45
+ /** Null for approvals given before the approver was recorded. */
46
+ source: Schema.NullOr(ApprovalSource),
47
+ }) {
48
+ }
49
+ /** A Run with its Attempts, result links, and available operator actions. */
32
50
  export class RunView extends Schema.Class("@usine/orchestrator/RunView")({
33
51
  id: RunId,
34
52
  itemKey: ItemKey,
@@ -38,24 +56,69 @@ export class RunView extends Schema.Class("@usine/orchestrator/RunView")({
38
56
  state: RunStateTag,
39
57
  loopPaused: Schema.Boolean,
40
58
  openedAt: Schema.String,
59
+ /**
60
+ * When the Run last succeeded, failed, or was canceled, even before any Attempt. Null while open;
61
+ * a retry reopens a failed Run and clears it.
62
+ */
63
+ closedAt: Schema.NullOr(Schema.String),
41
64
  task: Schema.String,
42
65
  attempts: Schema.Array(AttemptView),
66
+ /**
67
+ * The approval the Run consumed, or null until one arrives. Always null for a Loop with
68
+ * `approval: none`.
69
+ */
70
+ approval: Schema.NullOr(ApprovalView),
71
+ /**
72
+ * The closed Run that the operator ran again to open this one, and who asked, or null for a
73
+ * trigger-opened Run. Its time is `openedAt`.
74
+ */
75
+ runAgain: Schema.NullOr(RunAgain),
43
76
  resultMessage: NullableString,
44
77
  pullRequestUrl: NullableString,
45
78
  canApprove: Schema.Boolean,
46
79
  canRetry: Schema.Boolean,
80
+ /**
81
+ * Whether the latest failed Attempt still requests attention, independent of retry availability.
82
+ */
83
+ canResolveFailure: Schema.Boolean,
47
84
  canCancel: Schema.Boolean,
85
+ /**
86
+ * Whether the Run succeeded or was canceled, so the operator can open a new Run for its Item
87
+ * state.
88
+ */
89
+ canRunAgain: Schema.Boolean,
90
+ }) {
91
+ }
92
+ const Milliseconds = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
93
+ const Count = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
94
+ /** The time a Run's Attempts worked, summed per Attempt. */
95
+ export class RunDurationView extends Schema.Class("@usine/orchestrator/RunDurationView")({
96
+ /** The ended Attempts' time, each from start to recorded end. */
97
+ endedMillis: Milliseconds,
98
+ /** The start of the running Attempt, or null if none runs. */
99
+ runningSince: Schema.NullOr(Schema.String),
100
+ /**
101
+ * The number of ended Attempts closed before end times were recorded, excluded from the total.
102
+ */
103
+ unmeasured: Count,
48
104
  }) {
49
105
  }
50
- /** A Run summary with its triggering Event payload and a bounded portion of its transcript. */
106
+ /** A Run with its triggering Event payload, a page of its transcript, and its usage. */
51
107
  export class RunDetailView extends Schema.Class("@usine/orchestrator/RunDetailView")({
52
108
  run: RunView,
53
109
  eventDedupKey: Schema.String,
54
110
  eventPayload: Schema.Json,
55
111
  transcript: Schema.Array(TranscriptEventView),
56
- /** Current session controls remain available when their last activity predates the transcript page. */
112
+ /**
113
+ * The current session controls, included even when their last activity is before the transcript
114
+ * page.
115
+ */
57
116
  sessionState: Schema.Array(TranscriptEventView),
58
117
  earlierTranscript: Schema.Array(TranscriptPageCursor),
118
+ /** The Worker of the newest Attempt, or null before the first Attempt. */
119
+ worker: Schema.NullOr(WorkerName).pipe(Schema.withConstructorDefault(Effect.succeed(null))),
120
+ duration: RunDurationView.pipe(Schema.withConstructorDefault(Effect.succeed(new RunDurationView({ endedMillis: 0, runningSince: null, unmeasured: 0 })))),
121
+ usage: RunUsageView.pipe(Schema.withConstructorDefault(Effect.succeed(new RunUsageView({ tokens: TokenCount.make(0), pools: [], sessions: [] })))),
59
122
  }) {
60
123
  }
61
124
  //# sourceMappingURL=run.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/operator/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,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CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAC3F,CACF;IACD,KAAK,EAAE,YAAY,CAAC,IAAI,CACtB,MAAM,CAAC,sBAAsB,CAC3B,MAAM,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,CAC1F,CACF;CACF,CACF;CAAG"}
@@ -0,0 +1,93 @@
1
+ import type { LoadedInstance } from "@usine/config/instance";
2
+ import { ItemNumber } from "@usine/core/item";
3
+ import { RepositoryName } from "@usine/core/repository";
4
+ import { CycleBudgets } from "@usine/engine/cycle-budget";
5
+ import type { RunStoreError } from "@usine/engine/engine";
6
+ import { ItemProjectionReader } from "@usine/engine/item-projection";
7
+ import { LoopControl } from "@usine/engine/loop-control";
8
+ import { RepositoryLabelProjectionReader } from "@usine/engine/repository-label-projection";
9
+ import { RunReader } from "@usine/engine/run-reader";
10
+ import { Context, Effect, Layer, Schema } from "effect";
11
+ import { BoardItemNotFoundError, BoardProjectNotFoundError } from "./board.ts";
12
+ import { RunView } from "./run.ts";
13
+ declare const TaskItemView_base: Schema.Class<TaskItemView, Schema.Struct<{
14
+ readonly itemKey: Schema.brand<Schema.NonEmptyString, "ItemKey">;
15
+ readonly kind: Schema.Literals<readonly ["issue", "pr"]>;
16
+ readonly number: Schema.brand<Schema.Int, "ItemNumber">;
17
+ readonly title: Schema.String;
18
+ readonly url: Schema.NonEmptyString;
19
+ readonly state: Schema.Literals<readonly ["issue-open", "issue-closed", "pr-open", "pr-closed", "pr-merged"]>;
20
+ readonly labels: Schema.$Array<Schema.brand<Schema.String, "GitHubLabelName">>;
21
+ /** Whether the Item is an open pull request whose branch conflicts with its base. */
22
+ readonly conflicting: Schema.Boolean;
23
+ }>, {}>;
24
+ /** One issue or pull request of a Task, with its GitHub state as the Board card shows it. */
25
+ export declare class TaskItemView extends TaskItemView_base {
26
+ }
27
+ declare const TaskLaneView_base: Schema.Class<TaskLaneView, Schema.Struct<{
28
+ readonly id: Schema.brand<Schema.NonEmptyString, "BoardLaneId">;
29
+ readonly name: Schema.brand<Schema.String, "LaneName">;
30
+ }>, {}>;
31
+ /**
32
+ * The Task's Board lane: its current Item's lane, or the lane its running Run was triggered from.
33
+ */
34
+ export declare class TaskLaneView extends TaskLaneView_base {
35
+ }
36
+ declare const TaskCommentView_base: Schema.Class<TaskCommentView, Schema.Struct<{
37
+ readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
38
+ readonly kind: Schema.Literals<readonly ["issue-comment", "review", "review-comment"]>;
39
+ readonly url: Schema.String;
40
+ readonly postedAt: Schema.NullOr<Schema.String>;
41
+ readonly attemptEndedAt: Schema.NullOr<Schema.String>;
42
+ }>, {}>;
43
+ /**
44
+ * A comment or review an Attempt posted on its Run's Item. `postedAt` and `attemptEndedAt` are null
45
+ * for records made before those times were stored.
46
+ */
47
+ export declare class TaskCommentView extends TaskCommentView_base {
48
+ }
49
+ declare const TaskView_base: Schema.Class<TaskView, Schema.Struct<{
50
+ readonly repository: Schema.brand<Schema.String, "RepositoryName">;
51
+ readonly number: Schema.brand<Schema.Int, "ItemNumber">;
52
+ readonly title: Schema.String;
53
+ /**
54
+ * The Item whose labels and state set the Task's lane (unless a running Run keeps it in its
55
+ * trigger lane), and whose labels a Board move changes.
56
+ */
57
+ readonly current: Schema.brand<Schema.NonEmptyString, "ItemKey">;
58
+ readonly lane: typeof TaskLaneView;
59
+ /**
60
+ * Whether a Run on the Task's Items waits for approval or a failure decision, or an Item used up
61
+ * its cycle budget.
62
+ */
63
+ readonly needsYou: Schema.Boolean;
64
+ /** Issues first, then pull requests, each by number; the first is the originating Item. */
65
+ readonly items: Schema.NonEmptyArray<typeof TaskItemView>;
66
+ /** Every saved Run on the Task's Items, newest first. */
67
+ readonly runs: Schema.$Array<typeof RunView>;
68
+ /** The harvested comments and reviews of those Runs, newest Run first, and newest first within a Run. */
69
+ readonly comments: Schema.$Array<typeof TaskCommentView>;
70
+ }>, {}>;
71
+ /**
72
+ * One Task as its page shows it (ADR 0024). Tasks have no stored identity; `number` is the
73
+ * originating Item: the earliest issue, or else the earliest pull request.
74
+ */
75
+ export declare class TaskView extends TaskView_base {
76
+ }
77
+ export type TaskReadError = RunStoreError | BoardProjectNotFoundError | BoardItemNotFoundError;
78
+ declare const TaskReader_base: Context.ServiceClass<TaskReader, "@usine/orchestrator/TaskReader", {
79
+ /**
80
+ * Returns the Task that contains Item `item` of `repository`. Fails if the repository isn't a
81
+ * Project or the Item isn't among the Board's newest Items.
82
+ */
83
+ readonly read: (instance: LoadedInstance, repository: RepositoryName, item: ItemNumber) => Effect.Effect<TaskView, TaskReadError>;
84
+ }>;
85
+ /**
86
+ * Reads one Task from the Board projection over the Project's newest Items and the saved Runs of
87
+ * those Items.
88
+ */
89
+ export declare class TaskReader extends TaskReader_base {
90
+ static readonly layer: Layer.Layer<TaskReader, never, CycleBudgets | ItemProjectionReader | LoopControl | RepositoryLabelProjectionReader | RunReader>;
91
+ }
92
+ export {};
93
+ //# sourceMappingURL=task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/operator/task.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAW,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAA2B,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGjF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAmB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAEL,OAAO,EAEP,MAAM,EACN,KAAK,EAGL,MAAM,EACP,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAEL,sBAAsB,EAEtB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;;;;;;;;;IAUjC,qFAAqF;;;AALvF,6FAA6F;AAC7F,qBAAa,YAAa,SAAQ,iBAMhC;CAAG;;;;;AAEL;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAGhC;CAAG;;;;;;;;AAEL;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,oBAQnC;CAAG;;;;;IAUH;;;OAGG;;;IAGH;;;OAGG;;IAEH,2FAA2F;;IAE3F,yDAAyD;;IAEzD,yGAAyG;;;AAvB3G;;;GAGG;AACH,qBAAa,QAAS,SAAQ,aAqB5B;CAAG;AAEL,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,yBAAyB,GAAG,sBAAsB,CAAC;;IAuL3F;;;OAGG;mBACY,CACb,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,cAAc,EAC1B,IAAI,EAAE,UAAU,KACb,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC;;AAf/C;;;GAGG;AACH,qBAAa,UAAW,SAAQ,eAaK;IACnC,MAAM,CAAC,QAAQ,CAAC,KAAK,kIAA4C;CAClE"}
@@ -0,0 +1,204 @@
1
+ import { LaneItemState, LaneName } from "@usine/config/board";
2
+ import { GitHubLabelName } from "@usine/config/label";
3
+ import { ItemKey, ItemNumber } from "@usine/core/item";
4
+ import { canonicalRepositoryName, RepositoryName } from "@usine/core/repository";
5
+ import { RunId } from "@usine/core/run";
6
+ import { CommentKind } from "@usine/core/step/result";
7
+ import { CycleBudgets } from "@usine/engine/cycle-budget";
8
+ import { ItemProjectionReader } from "@usine/engine/item-projection";
9
+ import { LoopControl } from "@usine/engine/loop-control";
10
+ import { RepositoryLabelProjectionReader } from "@usine/engine/repository-label-projection";
11
+ import { RunReader } from "@usine/engine/run-reader";
12
+ import { Array as EffectArray, Context, DateTime, Effect, Layer, Option, Result, Schema, } from "effect";
13
+ import { projectedItem } from "../board/items.js";
14
+ import { projectBoard } from "../board/projection.js";
15
+ import { BoardItemLink, BoardItemNotFoundError, BoardLaneId, BoardProjectNotFoundError, } from "./board.js";
16
+ import { readRunningEvents, runView, workerAccesses } from "./projection.js";
17
+ import { RunView } from "./run.js";
18
+ /** The number of newest Items the Board considers for Task membership. */
19
+ const TASK_BOARD_ITEMS = 500;
20
+ /** One issue or pull request of a Task, with its GitHub state as the Board card shows it. */
21
+ export class TaskItemView extends Schema.Class("@usine/orchestrator/TaskItemView")({
22
+ ...BoardItemLink.fields,
23
+ state: LaneItemState,
24
+ labels: Schema.Array(GitHubLabelName),
25
+ /** Whether the Item is an open pull request whose branch conflicts with its base. */
26
+ conflicting: Schema.Boolean,
27
+ }) {
28
+ }
29
+ /**
30
+ * The Task's Board lane: its current Item's lane, or the lane its running Run was triggered from.
31
+ */
32
+ export class TaskLaneView extends Schema.Class("@usine/orchestrator/TaskLaneView")({
33
+ id: BoardLaneId,
34
+ name: LaneName,
35
+ }) {
36
+ }
37
+ /**
38
+ * A comment or review an Attempt posted on its Run's Item. `postedAt` and `attemptEndedAt` are null
39
+ * for records made before those times were stored.
40
+ */
41
+ export class TaskCommentView extends Schema.Class("@usine/orchestrator/TaskCommentView")({
42
+ runId: RunId,
43
+ kind: CommentKind,
44
+ url: Schema.String,
45
+ postedAt: Schema.NullOr(Schema.String),
46
+ attemptEndedAt: Schema.NullOr(Schema.String),
47
+ }) {
48
+ }
49
+ /**
50
+ * One Task as its page shows it (ADR 0024). Tasks have no stored identity; `number` is the
51
+ * originating Item: the earliest issue, or else the earliest pull request.
52
+ */
53
+ export class TaskView extends Schema.Class("@usine/orchestrator/TaskView")({
54
+ repository: RepositoryName,
55
+ number: ItemNumber,
56
+ title: Schema.String,
57
+ /**
58
+ * The Item whose labels and state set the Task's lane (unless a running Run keeps it in its
59
+ * trigger lane), and whose labels a Board move changes.
60
+ */
61
+ current: ItemKey,
62
+ lane: TaskLaneView,
63
+ /**
64
+ * Whether a Run on the Task's Items waits for approval or a failure decision, or an Item used up
65
+ * its cycle budget.
66
+ */
67
+ needsYou: Schema.Boolean,
68
+ /** Issues first, then pull requests, each by number; the first is the originating Item. */
69
+ items: Schema.NonEmptyArray(TaskItemView),
70
+ /** Every saved Run on the Task's Items, newest first. */
71
+ runs: Schema.Array(RunView),
72
+ /** The harvested comments and reviews of those Runs, newest Run first, and newest first within a Run. */
73
+ comments: Schema.Array(TaskCommentView),
74
+ }) {
75
+ }
76
+ const isoOrNull = Option.match({ onNone: () => null, onSome: DateTime.formatIso });
77
+ /**
78
+ * Returns the comments and reviews that a Run's Attempts posted, newest first and without
79
+ * duplicates.
80
+ */
81
+ const harvestedComments = (summary) => {
82
+ const view = (comment, endedAt) => new TaskCommentView({
83
+ runId: summary.run.id,
84
+ kind: comment.kind,
85
+ url: comment.url.toString(),
86
+ postedAt: isoOrNull(comment.at),
87
+ attemptEndedAt: isoOrNull(endedAt),
88
+ });
89
+ const succeededEnd = EffectArray.findLast(summary.attempts, (attempt) => Option.exists(attempt.outcome, ({ _tag }) => _tag === "Succeeded")).pipe(Option.flatMap(({ endedAt }) => endedAt));
90
+ const delivered = Option.match(summary.step.result, {
91
+ onNone: () => [],
92
+ onSome: ({ facts }) => facts.flatMap((fact) => (fact._tag === "Comment" ? [view(fact, succeededEnd)] : [])),
93
+ });
94
+ const unsuccessful = summary.attempts.flatMap((attempt) => attempt.comments.map((comment) => view(comment, attempt.endedAt)));
95
+ const time = ({ postedAt, attemptEndedAt }) => postedAt ?? attemptEndedAt ?? "";
96
+ return EffectArray.dedupeWith([...delivered, ...unsuccessful].sort((a, b) => time(b).localeCompare(time(a))), (a, b) => a.url === b.url);
97
+ };
98
+ const makeTaskReader = Effect.gen(function* () {
99
+ const reader = yield* RunReader;
100
+ const controls = yield* LoopControl;
101
+ const itemReader = yield* ItemProjectionReader;
102
+ const repositoryLabels = yield* RepositoryLabelProjectionReader;
103
+ const budgets = yield* CycleBudgets;
104
+ const read = Effect.fn("TaskReader.read")(function* (instance, repository, number) {
105
+ yield* Effect.annotateCurrentSpan({ repository, item: number });
106
+ const managed = instance.config.repos.find(({ name }) => canonicalRepositoryName(name) === canonicalRepositoryName(repository));
107
+ if (managed === undefined) {
108
+ yield* Effect.logInfo("Task read refused; the repository is not a registered Project", {
109
+ repository,
110
+ item: number,
111
+ });
112
+ return yield* new BoardProjectNotFoundError({ repository });
113
+ }
114
+ const [stored, labelProjection, states, asks] = yield* Effect.all([
115
+ itemReader.list(managed.name, { limit: TASK_BOARD_ITEMS }),
116
+ repositoryLabels.get(managed.name),
117
+ controls.states,
118
+ budgets.asks(),
119
+ ], { concurrency: "unbounded" });
120
+ const summaries = yield* reader.forItems(stored.map(({ itemKey }) => itemKey));
121
+ const runEvents = yield* readRunningEvents(reader, summaries);
122
+ const paused = new Set(states.filter((state) => state.paused).map((state) => state.loop));
123
+ const access = workerAccesses(instance.config.workers);
124
+ const board = yield* projectBoard(managed, Option.match(labelProjection, {
125
+ onNone: () => [],
126
+ onSome: ({ labels }) => labels.map(({ name }) => name),
127
+ }), stored, summaries.map((summary) => runView(summary, paused, access)), asks.map(({ itemKey }) => itemKey), new Map(), new Map(), runEvents);
128
+ const placed = board.lanes
129
+ .flatMap((lane) => lane.items.map((task) => ({ lane, task })))
130
+ .find(({ task }) => task.items.some((member) => member.number === number));
131
+ if (placed === undefined) {
132
+ yield* Effect.logInfo("Task read found no Task; the Item is not among the Project's newest Board Items", { repository: managed.name, item: number, window: TASK_BOARD_ITEMS });
133
+ return yield* new BoardItemNotFoundError({ repository: managed.name, item: number });
134
+ }
135
+ const { lane, task } = placed;
136
+ const memberKeys = new Set(task.items.map(({ itemKey }) => itemKey));
137
+ const projected = yield* Effect.forEach(stored.filter(({ itemKey }) => memberKeys.has(itemKey)), (item) => projectedItem(item).pipe(Effect.result));
138
+ const details = new Map();
139
+ for (const result of projected) {
140
+ if (Result.isFailure(result)) {
141
+ yield* Effect.logError("Task Item could not be projected; the other Items are shown", {
142
+ repository: managed.name,
143
+ itemKey: result.failure.itemKey,
144
+ message: result.failure.message,
145
+ });
146
+ continue;
147
+ }
148
+ const { itemKey, kind, number: itemNumber, title, url, state, labels, conflicting, } = result.success;
149
+ details.set(itemKey, new TaskItemView({
150
+ itemKey,
151
+ kind,
152
+ number: itemNumber,
153
+ title,
154
+ url,
155
+ state,
156
+ labels,
157
+ conflicting,
158
+ }));
159
+ }
160
+ const [first, ...rest] = task.items.flatMap(({ itemKey }) => {
161
+ const detail = details.get(itemKey);
162
+ return detail === undefined ? [] : [detail];
163
+ });
164
+ if (first === undefined) {
165
+ return yield* new BoardItemNotFoundError({ repository: managed.name, item: number });
166
+ }
167
+ const taskRuns = new Set(task.runs.map(({ id }) => id));
168
+ const comments = summaries
169
+ .filter(({ run }) => taskRuns.has(run.id))
170
+ .sort((a, b) => DateTime.toEpochMillis(b.run.openedAt) - DateTime.toEpochMillis(a.run.openedAt) ||
171
+ b.run.id.localeCompare(a.run.id))
172
+ .flatMap(harvestedComments);
173
+ const view = new TaskView({
174
+ repository: managed.name,
175
+ number: first.number,
176
+ title: task.title,
177
+ current: task.itemKey,
178
+ lane: new TaskLaneView({ id: lane.id, name: lane.name }),
179
+ needsYou: task.needsYou,
180
+ items: [first, ...rest],
181
+ runs: [...task.runs].reverse(),
182
+ comments,
183
+ });
184
+ yield* Effect.logDebug("Read a Task", {
185
+ repository: managed.name,
186
+ item: number,
187
+ origin: view.number,
188
+ lane: lane.name,
189
+ items: view.items.length,
190
+ runs: view.runs.length,
191
+ comments: comments.length,
192
+ });
193
+ return view;
194
+ });
195
+ return { read };
196
+ });
197
+ /**
198
+ * Reads one Task from the Board projection over the Project's newest Items and the saved Runs of
199
+ * those Items.
200
+ */
201
+ export class TaskReader extends Context.Service()("@usine/orchestrator/TaskReader") {
202
+ static layer = Layer.effect(TaskReader, makeTaskReader);
203
+ }
204
+ //# sourceMappingURL=task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/operator/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAgB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,+BAA+B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAmB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EACL,KAAK,IAAI,WAAW,EACpB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,MAAM,GACP,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,cAAc,EAAE,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