@usine/orchestrator 0.2.1 → 0.4.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 (222) hide show
  1. package/LICENSE +661 -21
  2. package/README.md +174 -52
  3. package/dist/board/items.d.ts +22 -3
  4. package/dist/board/items.d.ts.map +1 -1
  5. package/dist/board/items.js +44 -4
  6. package/dist/board/items.js.map +1 -1
  7. package/dist/board/projection.d.ts +8 -1
  8. package/dist/board/projection.d.ts.map +1 -1
  9. package/dist/board/projection.js +63 -14
  10. package/dist/board/projection.js.map +1 -1
  11. package/dist/board/tasks.d.ts +15 -3
  12. package/dist/board/tasks.d.ts.map +1 -1
  13. package/dist/board/tasks.js +28 -9
  14. package/dist/board/tasks.js.map +1 -1
  15. package/dist/cloudflare.d.ts +32 -0
  16. package/dist/cloudflare.d.ts.map +1 -0
  17. package/dist/cloudflare.js +68 -0
  18. package/dist/cloudflare.js.map +1 -0
  19. package/dist/credentials.d.ts +5 -6
  20. package/dist/credentials.d.ts.map +1 -1
  21. package/dist/credentials.js +22 -15
  22. package/dist/credentials.js.map +1 -1
  23. package/dist/current-instance/changes.d.ts +87 -0
  24. package/dist/current-instance/changes.d.ts.map +1 -0
  25. package/dist/current-instance/changes.js +141 -0
  26. package/dist/current-instance/changes.js.map +1 -0
  27. package/dist/current-instance/current-instance.d.ts +89 -0
  28. package/dist/current-instance/current-instance.d.ts.map +1 -0
  29. package/dist/current-instance/current-instance.js +163 -0
  30. package/dist/current-instance/current-instance.js.map +1 -0
  31. package/dist/exe-dev.d.ts +6 -2
  32. package/dist/exe-dev.d.ts.map +1 -1
  33. package/dist/exe-dev.js +10 -9
  34. package/dist/exe-dev.js.map +1 -1
  35. package/dist/http-client.d.ts +8 -0
  36. package/dist/http-client.d.ts.map +1 -0
  37. package/dist/http-client.js +8 -0
  38. package/dist/http-client.js.map +1 -0
  39. package/dist/idle-triggers.d.ts +1 -1
  40. package/dist/idle-triggers.d.ts.map +1 -1
  41. package/dist/idle-triggers.js +1 -1
  42. package/dist/idle-triggers.js.map +1 -1
  43. package/dist/label-reconciler.d.ts +5 -2
  44. package/dist/label-reconciler.d.ts.map +1 -1
  45. package/dist/label-reconciler.js.map +1 -1
  46. package/dist/lease-order.d.ts +60 -0
  47. package/dist/lease-order.d.ts.map +1 -0
  48. package/dist/lease-order.js +76 -0
  49. package/dist/lease-order.js.map +1 -0
  50. package/dist/local.d.ts +4 -18
  51. package/dist/local.d.ts.map +1 -1
  52. package/dist/local.js +9 -45
  53. package/dist/local.js.map +1 -1
  54. package/dist/loop-matches.d.ts +28 -0
  55. package/dist/loop-matches.d.ts.map +1 -0
  56. package/dist/loop-matches.js +74 -0
  57. package/dist/loop-matches.js.map +1 -0
  58. package/dist/operator/attempt.d.ts +76 -10
  59. package/dist/operator/attempt.d.ts.map +1 -1
  60. package/dist/operator/attempt.js +69 -11
  61. package/dist/operator/attempt.js.map +1 -1
  62. package/dist/operator/board.d.ts +48 -16
  63. package/dist/operator/board.d.ts.map +1 -1
  64. package/dist/operator/board.js +48 -17
  65. package/dist/operator/board.js.map +1 -1
  66. package/dist/operator/configuration.d.ts +314 -0
  67. package/dist/operator/configuration.d.ts.map +1 -0
  68. package/dist/operator/configuration.js +490 -0
  69. package/dist/operator/configuration.js.map +1 -0
  70. package/dist/operator/desk.d.ts +206 -0
  71. package/dist/operator/desk.d.ts.map +1 -0
  72. package/dist/operator/desk.js +525 -0
  73. package/dist/operator/desk.js.map +1 -0
  74. package/dist/operator/github-changes.d.ts +88 -0
  75. package/dist/operator/github-changes.d.ts.map +1 -0
  76. package/dist/operator/github-changes.js +266 -0
  77. package/dist/operator/github-changes.js.map +1 -0
  78. package/dist/operator/http.d.ts +135 -105
  79. package/dist/operator/http.d.ts.map +1 -1
  80. package/dist/operator/http.js +155 -30
  81. package/dist/operator/http.js.map +1 -1
  82. package/dist/operator/machines.d.ts +71 -0
  83. package/dist/operator/machines.d.ts.map +1 -0
  84. package/dist/operator/machines.js +103 -0
  85. package/dist/operator/machines.js.map +1 -0
  86. package/dist/operator/need.d.ts +58 -11
  87. package/dist/operator/need.d.ts.map +1 -1
  88. package/dist/operator/need.js +61 -9
  89. package/dist/operator/need.js.map +1 -1
  90. package/dist/operator/operator.d.ts +135 -29
  91. package/dist/operator/operator.d.ts.map +1 -1
  92. package/dist/operator/operator.js +370 -63
  93. package/dist/operator/operator.js.map +1 -1
  94. package/dist/operator/overview.d.ts +7 -7
  95. package/dist/operator/overview.d.ts.map +1 -1
  96. package/dist/operator/overview.js +5 -5
  97. package/dist/operator/overview.js.map +1 -1
  98. package/dist/operator/projection.d.ts +56 -5
  99. package/dist/operator/projection.d.ts.map +1 -1
  100. package/dist/operator/projection.js +108 -9
  101. package/dist/operator/projection.js.map +1 -1
  102. package/dist/operator/run.d.ts +101 -6
  103. package/dist/operator/run.d.ts.map +1 -1
  104. package/dist/operator/run.js +100 -7
  105. package/dist/operator/run.js.map +1 -1
  106. package/dist/operator/statistics/cache.d.ts +7 -0
  107. package/dist/operator/statistics/cache.d.ts.map +1 -0
  108. package/dist/operator/statistics/cache.js +40 -0
  109. package/dist/operator/statistics/cache.js.map +1 -0
  110. package/dist/operator/statistics/runs.d.ts +36 -0
  111. package/dist/operator/statistics/runs.d.ts.map +1 -0
  112. package/dist/operator/statistics/runs.js +284 -0
  113. package/dist/operator/statistics/runs.js.map +1 -0
  114. package/dist/operator/statistics/statistics.d.ts +20 -0
  115. package/dist/operator/statistics/statistics.d.ts.map +1 -0
  116. package/dist/operator/statistics/statistics.js +138 -0
  117. package/dist/operator/statistics/statistics.js.map +1 -0
  118. package/dist/operator/statistics/tasks.d.ts +30 -0
  119. package/dist/operator/statistics/tasks.d.ts.map +1 -0
  120. package/dist/operator/statistics/tasks.js +244 -0
  121. package/dist/operator/statistics/tasks.js.map +1 -0
  122. package/dist/operator/statistics/view.d.ts +302 -0
  123. package/dist/operator/statistics/view.d.ts.map +1 -0
  124. package/dist/operator/statistics/view.js +243 -0
  125. package/dist/operator/statistics/view.js.map +1 -0
  126. package/dist/operator/statistics/window.d.ts +24 -0
  127. package/dist/operator/statistics/window.d.ts.map +1 -0
  128. package/dist/operator/statistics/window.js +47 -0
  129. package/dist/operator/statistics/window.js.map +1 -0
  130. package/dist/operator/task.d.ts +94 -0
  131. package/dist/operator/task.d.ts.map +1 -0
  132. package/dist/operator/task.js +204 -0
  133. package/dist/operator/task.js.map +1 -0
  134. package/dist/operator/transcript.d.ts +12 -12
  135. package/dist/operator/transcript.d.ts.map +1 -1
  136. package/dist/operator/transcript.js +11 -9
  137. package/dist/operator/transcript.js.map +1 -1
  138. package/dist/operator/usage.d.ts +103 -0
  139. package/dist/operator/usage.d.ts.map +1 -0
  140. package/dist/operator/usage.js +234 -0
  141. package/dist/operator/usage.js.map +1 -0
  142. package/dist/orchestrator.d.ts +8 -5
  143. package/dist/orchestrator.d.ts.map +1 -1
  144. package/dist/orchestrator.js +4 -2
  145. package/dist/orchestrator.js.map +1 -1
  146. package/dist/polling/closed-item-asks.d.ts +8 -0
  147. package/dist/polling/closed-item-asks.d.ts.map +1 -0
  148. package/dist/polling/closed-item-asks.js +28 -0
  149. package/dist/polling/closed-item-asks.js.map +1 -0
  150. package/dist/polling/cycle.d.ts +28 -10
  151. package/dist/polling/cycle.d.ts.map +1 -1
  152. package/dist/polling/cycle.js +20 -6
  153. package/dist/polling/cycle.js.map +1 -1
  154. package/dist/polling/evaluation-failures.d.ts +42 -0
  155. package/dist/polling/evaluation-failures.d.ts.map +1 -0
  156. package/dist/polling/evaluation-failures.js +103 -0
  157. package/dist/polling/evaluation-failures.js.map +1 -0
  158. package/dist/polling/hints.d.ts +2 -2
  159. package/dist/polling/hints.d.ts.map +1 -1
  160. package/dist/polling/hints.js +2 -2
  161. package/dist/polling/hints.js.map +1 -1
  162. package/dist/polling/loop-evaluation.d.ts +21 -11
  163. package/dist/polling/loop-evaluation.d.ts.map +1 -1
  164. package/dist/polling/loop-evaluation.js +70 -27
  165. package/dist/polling/loop-evaluation.js.map +1 -1
  166. package/dist/polling/open-issues.d.ts +23 -0
  167. package/dist/polling/open-issues.d.ts.map +1 -0
  168. package/dist/polling/open-issues.js +77 -0
  169. package/dist/polling/open-issues.js.map +1 -0
  170. package/dist/polling/open-pull-requests.d.ts +28 -0
  171. package/dist/polling/open-pull-requests.d.ts.map +1 -0
  172. package/dist/polling/open-pull-requests.js +131 -0
  173. package/dist/polling/open-pull-requests.js.map +1 -0
  174. package/dist/polling/polling.d.ts +20 -11
  175. package/dist/polling/polling.d.ts.map +1 -1
  176. package/dist/polling/polling.js +215 -52
  177. package/dist/polling/polling.js.map +1 -1
  178. package/dist/polling/repository-sync.d.ts +21 -14
  179. package/dist/polling/repository-sync.d.ts.map +1 -1
  180. package/dist/polling/repository-sync.js +35 -28
  181. package/dist/polling/repository-sync.js.map +1 -1
  182. package/dist/polling-triggers.d.ts +1 -1
  183. package/dist/polling-triggers.d.ts.map +1 -1
  184. package/dist/polling-triggers.js +1 -1
  185. package/dist/polling-triggers.js.map +1 -1
  186. package/dist/reloads.d.ts +14 -0
  187. package/dist/reloads.d.ts.map +1 -0
  188. package/dist/reloads.js +7 -0
  189. package/dist/reloads.js.map +1 -0
  190. package/dist/runtime.d.ts +24 -0
  191. package/dist/runtime.d.ts.map +1 -0
  192. package/dist/runtime.js +58 -0
  193. package/dist/runtime.js.map +1 -0
  194. package/dist/schedule-triggers.d.ts +14 -10
  195. package/dist/schedule-triggers.d.ts.map +1 -1
  196. package/dist/schedule-triggers.js +36 -31
  197. package/dist/schedule-triggers.js.map +1 -1
  198. package/dist/scheduler.d.ts +45 -5
  199. package/dist/scheduler.d.ts.map +1 -1
  200. package/dist/scheduler.js +587 -44
  201. package/dist/scheduler.js.map +1 -1
  202. package/dist/ssh.d.ts +103 -0
  203. package/dist/ssh.d.ts.map +1 -0
  204. package/dist/ssh.js +144 -0
  205. package/dist/ssh.js.map +1 -0
  206. package/dist/trigger-condition.d.ts +12 -0
  207. package/dist/trigger-condition.d.ts.map +1 -0
  208. package/dist/trigger-condition.js +88 -0
  209. package/dist/trigger-condition.js.map +1 -0
  210. package/dist/trigger-submission.d.ts +16 -13
  211. package/dist/trigger-submission.d.ts.map +1 -1
  212. package/dist/trigger-submission.js +19 -14
  213. package/dist/trigger-submission.js.map +1 -1
  214. package/dist/worker-engine.d.ts +13 -0
  215. package/dist/worker-engine.d.ts.map +1 -0
  216. package/dist/worker-engine.js +56 -0
  217. package/dist/worker-engine.js.map +1 -0
  218. package/dist/worker-status.d.ts +140 -0
  219. package/dist/worker-status.d.ts.map +1 -0
  220. package/dist/worker-status.js +76 -0
  221. package/dist/worker-status.js.map +1 -0
  222. package/package.json +47 -22
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/operator/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,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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;YACf,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YACxB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;YACtB,QAAQ,EAAE,QAAQ,CAAC,MAAM;SAC1B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAW,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,OAAO,CAAC,OAAO,EAa5C,CAAC,gCAAgC,CAAC;IACnC,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;CAClE"}
@@ -1,13 +1,13 @@
1
1
  import * as AttemptChannel from "@usine/core/attempt/channel";
2
2
  import { Schema } from "effect";
3
3
  declare const FailedTranscriptView_base: Schema.Class<FailedTranscriptView, Schema.TaggedStruct<"Failed", {
4
- readonly failure: Schema.Union<readonly [typeof import("./attempt.ts").InfraFailureView, typeof import("./attempt.ts").DefectFailureView, typeof import("./attempt.ts").AgentFailureView, typeof import("./attempt.ts").RunawayFailureView, typeof import("./attempt.ts").ChildSessionBudgetFailureView]>;
4
+ readonly failure: Schema.Union<readonly [typeof import("./attempt.ts").InfraFailureView, typeof import("./attempt.ts").DefectFailureView, typeof import("./attempt.ts").AgentFailureView, typeof import("./attempt.ts").BlockedFailureView, typeof import("./attempt.ts").QuestionFailureView, typeof import("./attempt.ts").RunawayFailureView, typeof import("./attempt.ts").ChildSessionBudgetFailureView]>;
5
5
  }>, {}>;
6
- /** An Attempt failure recorded in the transcript with displayable details only. */
6
+ /** An Attempt failure in the transcript with only displayable details. */
7
7
  export declare class FailedTranscriptView extends FailedTranscriptView_base {
8
8
  }
9
- /** Attempt channel messages exposed to the operator, with defect causes removed from failures. */
10
- export declare const TranscriptPayload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof FailedTranscriptView, typeof AttemptChannel.Interrupted, typeof AttemptChannel.Steer, typeof AttemptChannel.Interrupt, typeof AttemptChannel.OperatorMessage, typeof AttemptChannel.Release, typeof AttemptChannel.Cancel, typeof AttemptChannel.InterventionApplied, typeof AttemptChannel.InterventionRejected]>;
9
+ /** The Attempt channel messages shown to the operator, with defect causes removed from failures. */
10
+ export declare const TranscriptPayload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof FailedTranscriptView, typeof AttemptChannel.Interrupted, typeof AttemptChannel.Steer, typeof AttemptChannel.Interrupt, typeof AttemptChannel.OperatorMessage, typeof AttemptChannel.Release, typeof AttemptChannel.Cancel, typeof AttemptChannel.InterventionApplied, typeof AttemptChannel.InterventionRejected, typeof AttemptChannel.WorkerUnresponsive, typeof AttemptChannel.WorkerResponsive]>;
11
11
  export type TranscriptPayload = typeof TranscriptPayload.Type;
12
12
  declare const TranscriptEventView_base: Schema.Class<TranscriptEventView, Schema.Struct<{
13
13
  readonly sequence: Schema.brand<Schema.Int, "TranscriptSequence">;
@@ -16,43 +16,43 @@ declare const TranscriptEventView_base: Schema.Class<TranscriptEventView, Schema
16
16
  readonly direction: Schema.Literals<readonly ["inbound", "outbound"]>;
17
17
  readonly target: Schema.optionalKey<Schema.Union<readonly [typeof AttemptChannel.ParentTarget, typeof AttemptChannel.ChildTarget]>>;
18
18
  readonly operator: Schema.optionalKey<Schema.NonEmptyString>;
19
- readonly payload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof FailedTranscriptView, typeof AttemptChannel.Interrupted, typeof AttemptChannel.Steer, typeof AttemptChannel.Interrupt, typeof AttemptChannel.OperatorMessage, typeof AttemptChannel.Release, typeof AttemptChannel.Cancel, typeof AttemptChannel.InterventionApplied, typeof AttemptChannel.InterventionRejected]>;
19
+ readonly payload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof FailedTranscriptView, typeof AttemptChannel.Interrupted, typeof AttemptChannel.Steer, typeof AttemptChannel.Interrupt, typeof AttemptChannel.OperatorMessage, typeof AttemptChannel.Release, typeof AttemptChannel.Cancel, typeof AttemptChannel.InterventionApplied, typeof AttemptChannel.InterventionRejected, typeof AttemptChannel.WorkerUnresponsive, typeof AttemptChannel.WorkerResponsive]>;
20
20
  }>, {}>;
21
- /** A persisted Attempt channel message with its sequence, direction, and receipt time. */
21
+ /** A stored Attempt channel message with its sequence, direction, and receipt time. */
22
22
  export declare class TranscriptEventView extends TranscriptEventView_base {
23
23
  }
24
24
  declare const TranscriptPageCursor_base: Schema.Class<TranscriptPageCursor, Schema.Struct<{
25
25
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
26
26
  readonly before: Schema.brand<Schema.Int, "TranscriptSequence">;
27
27
  }>, {}>;
28
- /** Where the next earlier transcript page starts, scoped to one Attempt. */
28
+ /** The start of the next earlier transcript page within one Attempt. */
29
29
  export declare class TranscriptPageCursor extends TranscriptPageCursor_base {
30
30
  }
31
31
  declare const ColdTranscriptRequest_base: Schema.Class<ColdTranscriptRequest, Schema.TaggedStruct<"ColdTranscriptRequest", {}>, {}>;
32
- /** Requests the newest bounded transcript window when opening a Run. */
32
+ /** A request for the newest bounded transcript window when a Run opens. */
33
33
  export declare class ColdTranscriptRequest extends ColdTranscriptRequest_base {
34
34
  }
35
35
  declare const TailTranscriptRequest_base: Schema.Class<TailTranscriptRequest, Schema.TaggedStruct<"TailTranscriptRequest", {
36
36
  readonly after: Schema.brand<Schema.Int, "TranscriptSequence">;
37
37
  }>, {}>;
38
- /** Requests transcript events after the last observed sequence. */
38
+ /** A request for transcript events after the last seen sequence. */
39
39
  export declare class TailTranscriptRequest extends TailTranscriptRequest_base {
40
40
  }
41
41
  declare const EarlierTranscriptRequest_base: Schema.Class<EarlierTranscriptRequest, Schema.TaggedStruct<"EarlierTranscriptRequest", {
42
42
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
43
43
  readonly before: Schema.brand<Schema.Int, "TranscriptSequence">;
44
44
  }>, {}>;
45
- /** Requests an earlier page before a sequence within one Attempt. */
45
+ /** A request for an earlier page before a sequence within one Attempt. */
46
46
  export declare class EarlierTranscriptRequest extends EarlierTranscriptRequest_base {
47
47
  }
48
- /** Selects the initial window, live tail, or earlier page of a Run transcript. */
48
+ /** A request for the initial window, live tail, or an earlier page of a Run transcript. */
49
49
  export declare const TranscriptRequest: Schema.Union<readonly [typeof ColdTranscriptRequest, typeof TailTranscriptRequest, typeof EarlierTranscriptRequest]>;
50
50
  export type TranscriptRequest = typeof TranscriptRequest.Type;
51
51
  declare const TranscriptAttemptNotFoundError_base: Schema.Class<TranscriptAttemptNotFoundError, Schema.TaggedStruct<"TranscriptAttemptNotFoundError", {
52
52
  readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
53
53
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
54
54
  }>, import("effect/Cause").YieldableError>;
55
- /** The requested Attempt is absent from the Run whose transcript is being read. */
55
+ /** The requested Attempt isn't in the Run whose transcript is being read. */
56
56
  export declare class TranscriptAttemptNotFoundError extends TranscriptAttemptNotFoundError_base {
57
57
  }
58
58
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../src/operator/transcript.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;AAGhC,mFAAmF;AACnF,qBAAa,oBAAqB,SAAQ,yBAEL;CAAG;AAExC,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,kbAa5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;;;;;;;;;;AAE9D,0FAA0F;AAC1F,qBAAa,mBAAoB,SAAQ,wBAUvC;CA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E9D,6EAA6E;AAC7E,qBAAa,8BAA+B,SAAQ,mCAKlD;CAAG"}
@@ -4,10 +4,10 @@ import { RunId } from "@usine/core/run";
4
4
  import { TranscriptSequence } from "@usine/engine/transcript";
5
5
  import { Schema } from "effect";
6
6
  import { FailureView } from "./attempt.js";
7
- /** An Attempt failure recorded in the transcript with displayable details only. */
7
+ /** An Attempt failure in the transcript with only displayable details. */
8
8
  export class FailedTranscriptView extends Schema.TaggedClass("@usine/orchestrator/FailedTranscriptView")("Failed", { failure: FailureView }) {
9
9
  }
10
- /** Attempt channel messages exposed to the operator, with defect causes removed from failures. */
10
+ /** The Attempt channel messages shown to the operator, with defect causes removed from failures. */
11
11
  export const TranscriptPayload = Schema.Union([
12
12
  AttemptChannel.Started,
13
13
  AttemptChannel.SessionEvent,
@@ -21,8 +21,10 @@ export const TranscriptPayload = Schema.Union([
21
21
  AttemptChannel.Cancel,
22
22
  AttemptChannel.InterventionApplied,
23
23
  AttemptChannel.InterventionRejected,
24
+ AttemptChannel.WorkerUnresponsive,
25
+ AttemptChannel.WorkerResponsive,
24
26
  ]);
25
- /** A persisted Attempt channel message with its sequence, direction, and receipt time. */
27
+ /** A stored Attempt channel message with its sequence, direction, and receipt time. */
26
28
  export class TranscriptEventView extends Schema.Class("@usine/orchestrator/TranscriptEventView")({
27
29
  sequence: TranscriptSequence,
28
30
  attemptId: AttemptId,
@@ -33,31 +35,31 @@ export class TranscriptEventView extends Schema.Class("@usine/orchestrator/Trans
33
35
  payload: TranscriptPayload,
34
36
  }) {
35
37
  }
36
- /** Where the next earlier transcript page starts, scoped to one Attempt. */
38
+ /** The start of the next earlier transcript page within one Attempt. */
37
39
  export class TranscriptPageCursor extends Schema.Class("@usine/orchestrator/TranscriptPageCursor")({
38
40
  attemptId: AttemptId,
39
41
  before: TranscriptSequence,
40
42
  }) {
41
43
  }
42
- /** Requests the newest bounded transcript window when opening a Run. */
44
+ /** A request for the newest bounded transcript window when a Run opens. */
43
45
  export class ColdTranscriptRequest extends Schema.TaggedClass("@usine/orchestrator/ColdTranscriptRequest")("ColdTranscriptRequest", {}) {
44
46
  }
45
- /** Requests transcript events after the last observed sequence. */
47
+ /** A request for transcript events after the last seen sequence. */
46
48
  export class TailTranscriptRequest extends Schema.TaggedClass("@usine/orchestrator/TailTranscriptRequest")("TailTranscriptRequest", { after: TranscriptSequence }) {
47
49
  }
48
- /** Requests an earlier page before a sequence within one Attempt. */
50
+ /** A request for an earlier page before a sequence within one Attempt. */
49
51
  export class EarlierTranscriptRequest extends Schema.TaggedClass("@usine/orchestrator/EarlierTranscriptRequest")("EarlierTranscriptRequest", {
50
52
  attemptId: AttemptId,
51
53
  before: TranscriptSequence,
52
54
  }) {
53
55
  }
54
- /** Selects the initial window, live tail, or earlier page of a Run transcript. */
56
+ /** A request for the initial window, live tail, or an earlier page of a Run transcript. */
55
57
  export const TranscriptRequest = Schema.Union([
56
58
  ColdTranscriptRequest,
57
59
  TailTranscriptRequest,
58
60
  EarlierTranscriptRequest,
59
61
  ]);
60
- /** The requested Attempt is absent from the Run whose transcript is being read. */
62
+ /** The requested Attempt isn't in the Run whose transcript is being read. */
61
63
  export class TranscriptAttemptNotFoundError extends Schema.TaggedError("@usine/orchestrator/TranscriptAttemptNotFoundError")("TranscriptAttemptNotFoundError", {
62
64
  runId: RunId,
63
65
  attemptId: AttemptId,
@@ -1 +1 @@
1
- {"version":3,"file":"transcript.js","sourceRoot":"","sources":["../../src/operator/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,mFAAmF;A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,wBAAyB,SAAQ,MAAM,CAAC,WAAW,CAC9D,8CAA8C,CAC/C,CAAC,0BAA0B,EAAE;IAC5B,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,kBAAkB;CAC3B,CAAC;CAAG;AAEL,2FAA2F;AAC3F,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5C,qBAAqB;IACrB,qBAAqB;IACrB,wBAAwB;CACzB,CAAC,CAAC;AAGH,6EAA6E;AAC7E,MAAM,OAAO,8BAA+B,SAAQ,MAAM,CAAC,WAAW,CACpE,oDAAoD,CACrD,CAAC,gCAAgC,EAAE;IAClC,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,SAAS;CACrB,CAAC;CAAG"}
@@ -0,0 +1,103 @@
1
+ import type { RunStoreError } from "@usine/engine/engine";
2
+ import type { RunId } from "@usine/core/run";
3
+ import { RunReader, type RunSnapshot } from "@usine/engine/run-reader";
4
+ import { Context, Effect, Layer, Schema } from "effect";
5
+ import type { AttemptView } from "./attempt.ts";
6
+ declare const UsageCostView_base: Schema.Class<UsageCostView, Schema.Struct<{
7
+ readonly usd: Schema.brand<Schema.Finite, "UsdAmount">;
8
+ readonly estimate: Schema.Boolean;
9
+ }>, {}>;
10
+ /**
11
+ * A dollar cost from a harness or from usine's OpenAI price table. `estimate` is true in the Claude
12
+ * and ChatGPT plans, which don't bill per token (ADR 0013).
13
+ */
14
+ export declare class UsageCostView extends UsageCostView_base {
15
+ }
16
+ declare const SessionUsageView_base: Schema.Class<SessionUsageView, Schema.Struct<{
17
+ readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
18
+ readonly session: Schema.Union<readonly [typeof import("@usine/core/agent/session").ParentSession, typeof import("@usine/core/agent/session").ChildSession]>;
19
+ readonly pool: Schema.Literals<readonly ["apiKeys", "claudePlan", "chatgptPlan"]>;
20
+ readonly tokens: Schema.brand<Schema.Int, "TokenCount">;
21
+ /** Null if neither the harness nor the OpenAI price table priced the session. */
22
+ readonly cost: Schema.NullOr<typeof UsageCostView>;
23
+ }>, {}>;
24
+ /** One Attempt session's usage from its highest token report, and its billing pool. */
25
+ export declare class SessionUsageView extends SessionUsageView_base {
26
+ }
27
+ declare const PoolUsageView_base: Schema.Class<PoolUsageView, Schema.Struct<{
28
+ readonly pool: Schema.Literals<readonly ["apiKeys", "claudePlan", "chatgptPlan"]>;
29
+ readonly tokens: Schema.brand<Schema.Int, "TokenCount">;
30
+ /** Null if any session in the pool has no price. */
31
+ readonly cost: Schema.NullOr<typeof UsageCostView>;
32
+ }>, {}>;
33
+ /** A Run's usage in one billing pool. */
34
+ export declare class PoolUsageView extends PoolUsageView_base {
35
+ }
36
+ declare const RunUsageView_base: Schema.Class<RunUsageView, Schema.Struct<{
37
+ readonly tokens: Schema.brand<Schema.Int, "TokenCount">;
38
+ /** In the order API keys, Claude plan, ChatGPT plan; unused pools are absent. */
39
+ readonly pools: Schema.$Array<typeof PoolUsageView>;
40
+ /** In order of Attempt start, then first report. */
41
+ readonly sessions: Schema.$Array<typeof SessionUsageView>;
42
+ }>, {}>;
43
+ /** The tokens a Run's Attempts used, per pool and session, with their prices. */
44
+ export declare class RunUsageView extends RunUsageView_base {
45
+ }
46
+ declare const TaskPoolUsageView_base: Schema.Class<TaskPoolUsageView, Schema.Struct<{
47
+ readonly pool: Schema.Literals<readonly ["apiKeys", "claudePlan", "chatgptPlan"]>;
48
+ readonly tokens: Schema.brand<Schema.Int, "TokenCount">;
49
+ /** The cost of the priced sessions, or null if no session in the pool has a price yet. */
50
+ readonly cost: Schema.NullOr<typeof UsageCostView>;
51
+ /** Whether a session in the pool has no price yet, so `cost` is a lower bound. */
52
+ readonly unpriced: Schema.Boolean;
53
+ }>, {}>;
54
+ /** A Task's usage in one billing pool, summed over every session of every Run. */
55
+ export declare class TaskPoolUsageView extends TaskPoolUsageView_base {
56
+ }
57
+ declare const TaskUsageView_base: Schema.Class<TaskUsageView, Schema.Struct<{
58
+ /** The summed wall time of ended Attempts, each from start to recorded end. */
59
+ readonly durationMillis: Schema.Int;
60
+ /** The start times of running Attempts; add the time since each to `durationMillis`. */
61
+ readonly runningSince: Schema.$Array<Schema.String>;
62
+ /** The number of ended Attempts with no recorded end, excluded from `durationMillis`. */
63
+ readonly unmeasured: Schema.Int;
64
+ readonly tokens: Schema.brand<Schema.Int, "TokenCount">;
65
+ /**
66
+ * Each pool summed over the Runs, in the order API keys, Claude plan, ChatGPT plan; unused
67
+ * pools are absent.
68
+ */
69
+ readonly pools: Schema.$Array<typeof TaskPoolUsageView>;
70
+ /**
71
+ * The summed cost of the priced pools, or null if no pool has a price. It's an estimate if it
72
+ * includes the Claude or ChatGPT plan, and a lower bound if a pool is `unpriced`.
73
+ */
74
+ readonly cost: Schema.NullOr<typeof UsageCostView>;
75
+ }>, {}>;
76
+ /**
77
+ * A Task's usage over every Run on its Items: Attempt wall time, and tokens and cost per billing
78
+ * pool.
79
+ */
80
+ export declare class TaskUsageView extends TaskUsageView_base {
81
+ }
82
+ /**
83
+ * Sums the Attempt time, tokens, and cost of a Task's `runs`. Pools sum sessions rather than Run
84
+ * pools, so priced sessions count even when another session is unpriced, which sets `unpriced`.
85
+ */
86
+ export declare const taskUsage: (runs: ReadonlyArray<{
87
+ readonly id: RunId;
88
+ readonly attempts: ReadonlyArray<Pick<AttemptView, "startedAt" | "endedAt" | "outcome">>;
89
+ }>, usage: ReadonlyMap<RunId, RunUsageView>) => TaskUsageView;
90
+ type RunUsageSource = Pick<RunSnapshot, "run" | "attempts">;
91
+ declare const RunUsageReader_base: Context.ServiceClass<RunUsageReader, "@usine/orchestrator/RunUsageReader", {
92
+ readonly read: (run: RunUsageSource) => Effect.Effect<RunUsageView, RunStoreError>;
93
+ }>;
94
+ /**
95
+ * Reads a Run's usage from each session's highest token report. Caches the reports of Attempts with
96
+ * an outcome and rereads running Attempts on every call. Logs one warning per Codex model that the
97
+ * OpenAI price table lacks.
98
+ */
99
+ export declare class RunUsageReader extends RunUsageReader_base {
100
+ static readonly layer: Layer.Layer<RunUsageReader, never, RunReader>;
101
+ }
102
+ export {};
103
+ //# sourceMappingURL=usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/operator/usage.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;;;;;AAEhD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,kBAElC;CAAG;;;;;;IAUF,iFAAiF;;;AARnF,uFAAuF;AACvF,qBAAa,gBAAiB,SAAQ,qBASpC;CAAG;;;;IAOD,oDAAoD;;;AALxD,yCAAyC;AACzC,qBAAa,aAAc,SAAQ,kBAOlC;CAAG;;;IAKF,iFAAiF;;IAEjF,oDAAoD;;;AALtD,iFAAiF;AACjF,qBAAa,YAAa,SAAQ,iBAMhC;CAAG;;;;IAQH,0FAA0F;;IAE1F,kFAAkF;;;AARpF,kFAAkF;AAClF,qBAAa,iBAAkB,SAAQ,sBASrC;CAAG;;IAQD,+EAA+E;;IAE/E,wFAAwF;;IAExF,yFAAyF;;;IAGzF;;;OAGG;;IAEH;;;OAGG;;;AArBP;;;GAGG;AACH,qBAAa,aAAc,SAAQ,kBAoBlC;CAAG;AA2FJ;;;GAGG;AACH,eAAO,MAAM,SAAS,SACd,aAAa,CAAC;IAClB,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC;CAC1F,CAAC,SACK,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,KACtC,aA6CF,CAAC;AAwCF,KAAK,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,GAAG,UAAU,CAAC,CAAC;;mBASzC,CAAC,GAAG,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,aAAa,CAAC;;AAPtF;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,mBAGK;IACvC,MAAM,CAAC,QAAQ,CAAC,KAAK,gDAAoD;CAC1E"}
@@ -0,0 +1,234 @@
1
+ import { openAiPrice } from "@usine/agents/openai-prices";
2
+ import { AgentSession, BillingPool, sessionPool, TokenCount, UsdAmount, } from "@usine/core/agent/session";
3
+ import { AttemptId } from "@usine/core/attempt";
4
+ import { RunReader } from "@usine/engine/run-reader";
5
+ import { TranscriptUsageQuery } from "@usine/engine/transcript";
6
+ import { Context, Effect, Layer, Option, Schema } from "effect";
7
+ /**
8
+ * A dollar cost from a harness or from usine's OpenAI price table. `estimate` is true in the Claude
9
+ * and ChatGPT plans, which don't bill per token (ADR 0013).
10
+ */
11
+ export class UsageCostView extends Schema.Class("@usine/orchestrator/UsageCostView")({ usd: UsdAmount, estimate: Schema.Boolean }) {
12
+ }
13
+ /** One Attempt session's usage from its highest token report, and its billing pool. */
14
+ export class SessionUsageView extends Schema.Class("@usine/orchestrator/SessionUsageView")({
15
+ attemptId: AttemptId,
16
+ session: AgentSession,
17
+ pool: BillingPool,
18
+ tokens: TokenCount,
19
+ /** Null if neither the harness nor the OpenAI price table priced the session. */
20
+ cost: Schema.NullOr(UsageCostView),
21
+ }) {
22
+ }
23
+ /** A Run's usage in one billing pool. */
24
+ export class PoolUsageView extends Schema.Class("@usine/orchestrator/PoolUsageView")({
25
+ pool: BillingPool,
26
+ tokens: TokenCount,
27
+ /** Null if any session in the pool has no price. */
28
+ cost: Schema.NullOr(UsageCostView),
29
+ }) {
30
+ }
31
+ /** The tokens a Run's Attempts used, per pool and session, with their prices. */
32
+ export class RunUsageView extends Schema.Class("@usine/orchestrator/RunUsageView")({
33
+ tokens: TokenCount,
34
+ /** In the order API keys, Claude plan, ChatGPT plan; unused pools are absent. */
35
+ pools: Schema.Array(PoolUsageView),
36
+ /** In order of Attempt start, then first report. */
37
+ sessions: Schema.Array(SessionUsageView),
38
+ }) {
39
+ }
40
+ /** A Task's usage in one billing pool, summed over every session of every Run. */
41
+ export class TaskPoolUsageView extends Schema.Class("@usine/orchestrator/TaskPoolUsageView")({
42
+ pool: BillingPool,
43
+ tokens: TokenCount,
44
+ /** The cost of the priced sessions, or null if no session in the pool has a price yet. */
45
+ cost: Schema.NullOr(UsageCostView),
46
+ /** Whether a session in the pool has no price yet, so `cost` is a lower bound. */
47
+ unpriced: Schema.Boolean,
48
+ }) {
49
+ }
50
+ /**
51
+ * A Task's usage over every Run on its Items: Attempt wall time, and tokens and cost per billing
52
+ * pool.
53
+ */
54
+ export class TaskUsageView extends Schema.Class("@usine/orchestrator/TaskUsageView")({
55
+ /** The summed wall time of ended Attempts, each from start to recorded end. */
56
+ durationMillis: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
57
+ /** The start times of running Attempts; add the time since each to `durationMillis`. */
58
+ runningSince: Schema.Array(Schema.String),
59
+ /** The number of ended Attempts with no recorded end, excluded from `durationMillis`. */
60
+ unmeasured: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
61
+ tokens: TokenCount,
62
+ /**
63
+ * Each pool summed over the Runs, in the order API keys, Claude plan, ChatGPT plan; unused
64
+ * pools are absent.
65
+ */
66
+ pools: Schema.Array(TaskPoolUsageView),
67
+ /**
68
+ * The summed cost of the priced pools, or null if no pool has a price. It's an estimate if it
69
+ * includes the Claude or ChatGPT plan, and a lower bound if a pool is `unpriced`.
70
+ */
71
+ cost: Schema.NullOr(UsageCostView),
72
+ }) {
73
+ }
74
+ const POOLS = ["apiKeys", "claudePlan", "chatgptPlan"];
75
+ const priced = (pool, usd) => Option.match(usd, {
76
+ onNone: () => null,
77
+ onSome: (value) => new UsageCostView({ usd: value, estimate: pool !== "apiKeys" }),
78
+ });
79
+ /** Returns the harness's price, or for a Codex session, the OpenAI table's price of its breakdown. */
80
+ const sessionPrice = ({ session, costUsd, breakdown, }) => Option.isSome(costUsd) || session.brain.harness !== "codex"
81
+ ? costUsd
82
+ : Option.flatMap(breakdown, (tokens) => openAiPrice(session.brain.model, tokens));
83
+ /**
84
+ * Sums a Run's token reports per pool and for the Run, using each session's highest report because
85
+ * reports are cumulative.
86
+ */
87
+ const runUsage = (reports) => {
88
+ const highest = new Map();
89
+ for (const { attemptId, envelope } of reports) {
90
+ const payload = envelope.payload;
91
+ if (payload._tag !== "SessionEvent" || payload.event._tag !== "SessionTokensUpdated")
92
+ continue;
93
+ const key = `${attemptId} ${payload.event.session.id}`;
94
+ const previous = highest.get(key);
95
+ if (previous !== undefined && previous.report.totalTokens >= payload.event.totalTokens)
96
+ continue;
97
+ highest.set(key, { attemptId, report: payload.event });
98
+ }
99
+ const latest = [...highest.values()].map((entry) => ({
100
+ ...entry,
101
+ price: sessionPrice(entry.report),
102
+ }));
103
+ const sessions = latest.map(({ attemptId, report, price }) => {
104
+ const pool = sessionPool(report.session);
105
+ return new SessionUsageView({
106
+ attemptId,
107
+ session: report.session,
108
+ pool,
109
+ tokens: report.totalTokens,
110
+ cost: priced(pool, price),
111
+ });
112
+ });
113
+ const unknownModels = new Set(latest.flatMap(({ report, price }) => Option.isNone(price) &&
114
+ report.session.brain.harness === "codex" &&
115
+ Option.isSome(report.breakdown)
116
+ ? [report.session.brain.model]
117
+ : []));
118
+ const pools = POOLS.flatMap((pool) => {
119
+ const members = sessions.filter((session) => session.pool === pool);
120
+ if (members.length === 0)
121
+ return [];
122
+ const costs = members.flatMap(({ cost }) => (cost === null ? [] : [cost.usd]));
123
+ return [
124
+ new PoolUsageView({
125
+ pool,
126
+ tokens: TokenCount.make(members.reduce((sum, { tokens }) => sum + tokens, 0)),
127
+ cost: priced(pool, costs.length === members.length
128
+ ? Option.some(UsdAmount.make(costs.reduce((sum, usd) => sum + usd, 0)))
129
+ : Option.none()),
130
+ }),
131
+ ];
132
+ });
133
+ return {
134
+ view: new RunUsageView({
135
+ tokens: TokenCount.make(sessions.reduce((sum, { tokens }) => sum + tokens, 0)),
136
+ pools,
137
+ sessions,
138
+ }),
139
+ unknownModels,
140
+ };
141
+ };
142
+ /**
143
+ * Sums the Attempt time, tokens, and cost of a Task's `runs`. Pools sum sessions rather than Run
144
+ * pools, so priced sessions count even when another session is unpriced, which sets `unpriced`.
145
+ */
146
+ export const taskUsage = (runs, usage) => {
147
+ let durationMillis = 0;
148
+ let unmeasured = 0;
149
+ const runningSince = [];
150
+ for (const { attempts } of runs) {
151
+ for (const { startedAt, endedAt, outcome } of attempts) {
152
+ if (outcome === null)
153
+ runningSince.push(startedAt);
154
+ else if (endedAt === null)
155
+ unmeasured += 1;
156
+ else
157
+ durationMillis += Math.max(0, Date.parse(endedAt) - Date.parse(startedAt));
158
+ }
159
+ }
160
+ const sessions = runs.flatMap(({ id }) => usage.get(id)?.sessions ?? []);
161
+ const pools = POOLS.flatMap((pool) => {
162
+ const members = sessions.filter((session) => session.pool === pool);
163
+ if (members.length === 0)
164
+ return [];
165
+ const costs = members.flatMap(({ cost }) => (cost === null ? [] : [cost.usd]));
166
+ return [
167
+ new TaskPoolUsageView({
168
+ pool,
169
+ tokens: TokenCount.make(members.reduce((sum, { tokens }) => sum + tokens, 0)),
170
+ cost: priced(pool, costs.length === 0
171
+ ? Option.none()
172
+ : Option.some(UsdAmount.make(costs.reduce((sum, usd) => sum + usd, 0)))),
173
+ unpriced: costs.length < members.length,
174
+ }),
175
+ ];
176
+ });
177
+ const costs = pools.flatMap(({ cost }) => (cost === null ? [] : [cost]));
178
+ return new TaskUsageView({
179
+ durationMillis: Math.round(durationMillis),
180
+ runningSince,
181
+ unmeasured,
182
+ tokens: TokenCount.make(sessions.reduce((sum, { tokens }) => sum + tokens, 0)),
183
+ pools,
184
+ cost: costs.length === 0
185
+ ? null
186
+ : new UsageCostView({
187
+ usd: UsdAmount.make(costs.reduce((sum, { usd }) => sum + usd, 0)),
188
+ estimate: costs.some(({ estimate }) => estimate),
189
+ }),
190
+ });
191
+ };
192
+ const makeRunUsageReader = Effect.gen(function* () {
193
+ const runs = yield* RunReader;
194
+ const ended = yield* Effect.sync(() => new Map());
195
+ const loggedModels = yield* Effect.sync(() => new Set());
196
+ const attemptReports = Effect.fn("RunUsageReader.attemptReports")(function* (attempt) {
197
+ const cached = ended.get(attempt.id);
198
+ if (cached !== undefined)
199
+ return { reports: cached, read: false };
200
+ const reports = yield* runs.transcript(new TranscriptUsageQuery({ attemptId: attempt.id }));
201
+ if (Option.isSome(attempt.outcome))
202
+ ended.set(attempt.id, reports);
203
+ return { reports, read: true };
204
+ });
205
+ const read = Effect.fn("RunUsageReader.read")(function* (snapshot) {
206
+ yield* Effect.annotateCurrentSpan({ runId: snapshot.run.id });
207
+ const attempts = yield* Effect.forEach(snapshot.attempts, attemptReports, { concurrency: 4 });
208
+ const { view: usage, unknownModels } = runUsage(attempts.flatMap(({ reports }) => reports));
209
+ for (const model of unknownModels) {
210
+ if (loggedModels.has(model))
211
+ continue;
212
+ loggedModels.add(model);
213
+ yield* Effect.logWarning("The OpenAI price table has no rates for a Codex model, so its sessions have no cost", { model, runId: snapshot.run.id });
214
+ }
215
+ yield* Effect.logDebug("Read Run usage", {
216
+ runId: snapshot.run.id,
217
+ sessions: usage.sessions.length,
218
+ tokens: usage.tokens,
219
+ attemptsRead: attempts.filter(({ read: queried }) => queried).length,
220
+ attemptsCached: attempts.filter(({ read: queried }) => !queried).length,
221
+ });
222
+ return usage;
223
+ });
224
+ return { read };
225
+ });
226
+ /**
227
+ * Reads a Run's usage from each session's highest token report. Caches the reports of Attempts with
228
+ * an outcome and rereads running Attempts on every call. Logs one warning per Codex model that the
229
+ * OpenAI price table lacks.
230
+ */
231
+ export class RunUsageReader extends Context.Service()("@usine/orchestrator/RunUsageReader") {
232
+ static layer = Layer.effect(RunUsageReader, makeRunUsageReader);
233
+ }
234
+ //# sourceMappingURL=usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/operator/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EAEX,UAAU,EACV,SAAS,GACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAgB,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAoB,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAwB,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhE;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,KAAK,CAAgB,mCAAmC,CAAC,CACjG,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,CAC7C;CAAG;AAEJ,uFAAuF;AACvF,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,KAAK,CAChD,sCAAsC,CACvC,CAAC;IACA,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,UAAU;IAClB,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;CACnC,CAAC;CAAG;AAEL,yCAAyC;AACzC,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,KAAK,CAAgB,mCAAmC,CAAC,CACjG;IACE,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,UAAU;IAClB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC,MAAM,CA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,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,MAAM;YACpE,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM;SACxE,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC,CAAC,CAAC;AAIH;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,OAAO,CAAC,OAAO,EAGhD,CAAC,oCAAoC,CAAC;IACvC,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;CAC1E"}
@@ -1,14 +1,17 @@
1
- import type { LoadedInstance } from "@usine/config/instance";
2
1
  import { Context, Effect, Layer } from "effect";
2
+ import { CurrentInstance } from "./current-instance/current-instance.ts";
3
3
  import { PollingTriggers } from "./polling-triggers.ts";
4
4
  import { ScheduleTriggers } from "./schedule-triggers.ts";
5
5
  declare const Orchestrator_base: Context.ServiceClass<Orchestrator, "@usine/orchestrator/Orchestrator", {
6
- /** Evaluates the supplied instance's triggers until interrupted, using that snapshot of its Loops and roster. */
7
- readonly run: (instance: LoadedInstance) => Effect.Effect<never>;
6
+ /**
7
+ * Evaluates the triggers until interrupted. Each cycle reads the current instance, and an
8
+ * accepted reload starts the next poll and schedule evaluation immediately.
9
+ */
10
+ readonly run: Effect.Effect<never>;
8
11
  }>;
9
- /** Coordinates polling and schedule triggers for one loaded factory instance. */
12
+ /** Coordinates polling and schedule triggers for the factory's current instance. */
10
13
  export declare class Orchestrator extends Orchestrator_base {
11
- static readonly layer: Layer.Layer<Orchestrator, never, PollingTriggers | ScheduleTriggers>;
14
+ static readonly layer: Layer.Layer<Orchestrator, never, CurrentInstance | PollingTriggers | ScheduleTriggers>;
12
15
  }
13
16
  export {};
14
17
  //# sourceMappingURL=orchestrator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;;IAgBtD,iHAAiH;kBACnG,CAAC,QAAQ,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;AALpE,iFAAiF;AACjF,qBAAa,YAAa,SAAQ,iBAMK;IACrC,MAAM,CAAC,QAAQ,CAAC,KAAK,uEAAgD;CACtE"}
1
+ {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;;IAmBtD;;;OAGG;kBACW,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;AARtC,oFAAoF;AACpF,qBAAa,YAAa,SAAQ,iBASK;IACrC,MAAM,CAAC,QAAQ,CAAC,KAAK,yFAAgD;CACtE"}
@@ -1,13 +1,15 @@
1
1
  import { Context, Effect, Layer } from "effect";
2
+ import { CurrentInstance } from "./current-instance/current-instance.js";
2
3
  import { PollingTriggers } from "./polling-triggers.js";
3
4
  import { ScheduleTriggers } from "./schedule-triggers.js";
4
5
  const makeOrchestrator = Effect.gen(function* () {
5
6
  const polling = yield* PollingTriggers;
6
7
  const schedules = yield* ScheduleTriggers;
7
- const run = (instance) => Effect.raceFirst(polling.run(instance), schedules.run(instance));
8
+ const instances = yield* CurrentInstance;
9
+ const run = Effect.raceFirst(polling.run(instances), schedules.run(instances));
8
10
  return { run };
9
11
  });
10
- /** Coordinates polling and schedule triggers for one loaded factory instance. */
12
+ /** Coordinates polling and schedule triggers for the factory's current instance. */
11
13
  export class Orchestrator extends Context.Service()("@usine/orchestrator/Orchestrator") {
12
14
  static layer = Layer.effect(Orchestrator, makeOrchestrator);
13
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,eAAe,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;IAE1C,MAAM,GAAG,GAAG,CAAC,QAAwB,EAAwB,EAAE,CAC7D,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEnE,OAAO,EAAE,GAAG,EAAW,CAAC;AAC1B,CAAC,CAAC,CAAC;AAEH,iFAAiF;AACjF,MAAM,OAAO,YAAa,SAAQ,OAAO,CAAC,OAAO,EAM9C,CAAC,kCAAkC,CAAC;IACrC,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;CACtE"}
1
+ {"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../src/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,eAAe,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,gBAAgB,CAAC;IAC1C,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,eAAe,CAAC;IAEzC,MAAM,GAAG,GAAyB,MAAM,CAAC,SAAS,CAChD,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EACtB,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CACzB,CAAC;IAEF,OAAO,EAAE,GAAG,EAAW,CAAC;AAC1B,CAAC,CAAC,CAAC;AAEH,oFAAoF;AACpF,MAAM,OAAO,YAAa,SAAQ,OAAO,CAAC,OAAO,EAS9C,CAAC,kCAAkC,CAAC;IACrC,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;CACtE"}
@@ -0,0 +1,8 @@
1
+ import { CycleBudgets } from "@usine/engine/cycle-budget";
2
+ import { Effect } from "effect";
3
+ /**
4
+ * Closes each open cycle-budget Ask of `repository` whose stored Item is closed, merged, or gone
5
+ * from GitHub, with the reason `ItemClosed`. The Items keep their cycle budgets.
6
+ */
7
+ export declare const closeAsksOfClosedItems: (repository: string & import("effect/Brand").Brand<"RepositoryName">) => Effect.Effect<void, import("@usine/engine/engine").EnginePersistenceError, CycleBudgets | import("@usine/engine/item-projection").ItemProjectionReader>;
8
+ //# sourceMappingURL=closed-item-asks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closed-item-asks.d.ts","sourceRoot":"","sources":["../../src/polling/closed-item-asks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAGxC;;;GAGG;AACH,eAAO,MAAM,sBAAsB,kOAyBlC,CAAC"}