@usine/core 0.2.0 → 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 (102) hide show
  1. package/README.md +43 -16
  2. package/dist/agent/agent.d.ts +12 -8
  3. package/dist/agent/agent.d.ts.map +1 -1
  4. package/dist/agent/agent.js +14 -10
  5. package/dist/agent/agent.js.map +1 -1
  6. package/dist/agent/brain.d.ts +2 -6
  7. package/dist/agent/brain.d.ts.map +1 -1
  8. package/dist/agent/brain.js +3 -7
  9. package/dist/agent/brain.js.map +1 -1
  10. package/dist/agent/capability.d.ts +4 -4
  11. package/dist/agent/capability.d.ts.map +1 -1
  12. package/dist/agent/capability.js +4 -4
  13. package/dist/agent/capability.js.map +1 -1
  14. package/dist/agent/session.d.ts +95 -21
  15. package/dist/agent/session.d.ts.map +1 -1
  16. package/dist/agent/session.js +100 -21
  17. package/dist/agent/session.js.map +1 -1
  18. package/dist/attempt/attempt.d.ts +63 -11
  19. package/dist/attempt/attempt.d.ts.map +1 -1
  20. package/dist/attempt/attempt.js +81 -11
  21. package/dist/attempt/attempt.js.map +1 -1
  22. package/dist/attempt/channel.d.ts +142 -44
  23. package/dist/attempt/channel.d.ts.map +1 -1
  24. package/dist/attempt/channel.js +124 -36
  25. package/dist/attempt/channel.js.map +1 -1
  26. package/dist/attempt/failure.d.ts +27 -14
  27. package/dist/attempt/failure.d.ts.map +1 -1
  28. package/dist/attempt/failure.js +27 -14
  29. package/dist/attempt/failure.js.map +1 -1
  30. package/dist/attempt/outcome.d.ts +3 -5
  31. package/dist/attempt/outcome.d.ts.map +1 -1
  32. package/dist/attempt/outcome.js +2 -4
  33. package/dist/attempt/outcome.js.map +1 -1
  34. package/dist/attempt/salvage.d.ts +50 -0
  35. package/dist/attempt/salvage.d.ts.map +1 -0
  36. package/dist/attempt/salvage.js +21 -0
  37. package/dist/attempt/salvage.js.map +1 -0
  38. package/dist/attempt/start.d.ts +35 -0
  39. package/dist/attempt/start.d.ts.map +1 -0
  40. package/dist/attempt/start.js +30 -0
  41. package/dist/attempt/start.js.map +1 -0
  42. package/dist/cycle-budget.d.ts +7 -8
  43. package/dist/cycle-budget.d.ts.map +1 -1
  44. package/dist/cycle-budget.js +9 -10
  45. package/dist/cycle-budget.js.map +1 -1
  46. package/dist/event.d.ts +4 -8
  47. package/dist/event.d.ts.map +1 -1
  48. package/dist/event.js +4 -8
  49. package/dist/event.js.map +1 -1
  50. package/dist/instance.d.ts +1 -1
  51. package/dist/instance.d.ts.map +1 -1
  52. package/dist/instance.js +1 -1
  53. package/dist/instance.js.map +1 -1
  54. package/dist/item.d.ts +1 -2
  55. package/dist/item.d.ts.map +1 -1
  56. package/dist/item.js +1 -2
  57. package/dist/item.js.map +1 -1
  58. package/dist/loop.d.ts +10 -2
  59. package/dist/loop.d.ts.map +1 -1
  60. package/dist/loop.js +9 -2
  61. package/dist/loop.js.map +1 -1
  62. package/dist/operator.d.ts +8 -0
  63. package/dist/operator.d.ts.map +1 -0
  64. package/dist/operator.js +9 -0
  65. package/dist/operator.js.map +1 -0
  66. package/dist/repository.d.ts +6 -8
  67. package/dist/repository.d.ts.map +1 -1
  68. package/dist/repository.js +8 -10
  69. package/dist/repository.js.map +1 -1
  70. package/dist/run/again.d.ts +13 -0
  71. package/dist/run/again.d.ts.map +1 -0
  72. package/dist/run/again.js +13 -0
  73. package/dist/run/again.js.map +1 -0
  74. package/dist/run/approval.d.ts +27 -0
  75. package/dist/run/approval.d.ts.map +1 -0
  76. package/dist/run/approval.js +26 -0
  77. package/dist/run/approval.js.map +1 -0
  78. package/dist/run/run.d.ts +2 -2
  79. package/dist/run/run.d.ts.map +1 -1
  80. package/dist/run/run.js +2 -2
  81. package/dist/run/run.js.map +1 -1
  82. package/dist/run/state.d.ts +22 -31
  83. package/dist/run/state.d.ts.map +1 -1
  84. package/dist/run/state.js +23 -36
  85. package/dist/run/state.js.map +1 -1
  86. package/dist/step/harvest.d.ts +44 -0
  87. package/dist/step/harvest.d.ts.map +1 -0
  88. package/dist/step/harvest.js +368 -0
  89. package/dist/step/harvest.js.map +1 -0
  90. package/dist/step/result.d.ts +15 -4
  91. package/dist/step/result.d.ts.map +1 -1
  92. package/dist/step/result.js +14 -4
  93. package/dist/step/result.js.map +1 -1
  94. package/dist/step/step.d.ts +2 -8
  95. package/dist/step/step.d.ts.map +1 -1
  96. package/dist/step/step.js +2 -8
  97. package/dist/step/step.js.map +1 -1
  98. package/dist/worker.d.ts +48 -4
  99. package/dist/worker.d.ts.map +1 -1
  100. package/dist/worker.js +47 -4
  101. package/dist/worker.js.map +1 -1
  102. package/package.json +27 -2
@@ -1,18 +1,16 @@
1
- import { Result, Schema, type Effect } from "effect";
1
+ import { Effect, Result, Schema } from "effect";
2
2
  import { Agent } from "../agent/agent.ts";
3
- import { AttemptId } from "./attempt.ts";
4
- import { StepResult } from "../step/result.ts";
3
+ import { AttemptId, type AttemptWindows } from "./attempt.ts";
4
+ import { type Comment, StepResult } from "../step/result.ts";
5
5
  import { AttemptFailure } from "./failure.ts";
6
- export declare const PROTOCOL_VERSION: 4;
7
- /**
8
- * Per-Attempt, per-direction message sequence, starting at 1. Distinct from the
9
- * engine's transcript sequence, which orders persisted rows globally.
10
- */
6
+ import { AttemptSalvage, SalvagePushed } from "./salvage.ts";
7
+ export declare const PROTOCOL_VERSION: 7;
8
+ /** The per-Attempt, per-direction message sequence, starting at 1; distinct from the transcript sequence. */
11
9
  export declare const Sequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
12
10
  export type Sequence = typeof Sequence.Type;
13
11
  /**
14
- * Relative to the run host: `inbound` frames go from the orchestrator to the run
15
- * host (Start, Steer, Interrupt) and `outbound` frames go the other way.
12
+ * The directions relative to the Attempt's parent: `inbound` for operator input and Cancel, and
13
+ * `outbound` for activity and outcome.
16
14
  */
17
15
  export declare const DIRECTIONS: readonly ["inbound", "outbound"];
18
16
  export declare const Direction: Schema.Literals<readonly ["inbound", "outbound"]>;
@@ -28,23 +26,32 @@ declare const RunSpec_base: Schema.Class<RunSpec, Schema.Struct<{
28
26
  readonly parentModel: Schema.OptionFromNullOr<Schema.brand<Schema.String, "ModelId">>;
29
27
  readonly maxChildren: Schema.brand<Schema.Int, "ChildSessionBudget">;
30
28
  readonly parentEffort: Schema.Literals<readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"]>;
29
+ /** The previous Attempt's pushed salvage, applied on top of `baseCommit` and rebased if the base moved. */
30
+ readonly resume: Schema.OptionFromNullOr<typeof SalvagePushed>;
31
+ /** The previous Attempt's pushed salvage that conflicts with `baseCommit` and isn't applied. */
32
+ readonly conflictingSalvage: Schema.withConstructorDefault<Schema.withDecodingDefaultKey<Schema.OptionFromNullOr<typeof SalvagePushed>, never>>;
33
+ /** The time the Worker prepared the checkout, from which harvesting reads the Item, or `None` for older Attempts. */
34
+ readonly preparedAt: Schema.withDecodingDefaultKey<Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>, never>;
35
+ /**
36
+ * The GitHub login the Attempt writes as. If `None`, harvesting asks GitHub for the credential's
37
+ * login.
38
+ */
39
+ readonly botLogin: Schema.withDecodingDefaultKey<Schema.OptionFromNullOr<Schema.brand<Schema.String, "BotLogin">>, never>;
31
40
  }>, {}>;
32
- /** Launch input for one Attempt. Worker credentials are never part of it. */
41
+ /** The launch input for one Attempt, without Worker credentials. */
33
42
  export declare class RunSpec extends RunSpec_base {
34
43
  }
35
44
  declare const Started_base: Schema.Class<Started, Schema.TaggedStruct<"Started", {
36
45
  readonly parentModel: Schema.brand<Schema.String, "ModelId">;
46
+ readonly conflictingSalvage: Schema.withConstructorDefault<Schema.withDecodingDefaultKey<Schema.OptionFromNullOr<typeof SalvagePushed>, never>>;
37
47
  }>, {}>;
38
- /**
39
- * The parent model the SDK selected at launch, which the roster may not declare.
40
- * Child sessions report their own model in `SessionStarted` events.
41
- */
48
+ /** The start of an Attempt, with the parent model selected at launch, which can differ from the roster. */
42
49
  export declare class Started extends Started_base {
43
50
  }
44
51
  declare const SessionEvent_base: Schema.Class<SessionEvent, Schema.TaggedStruct<"SessionEvent", {
45
- readonly event: Schema.Union<readonly [typeof import("../agent/session.ts").SessionStarted, typeof import("../agent/session.ts").TextOutput, typeof import("../agent/session.ts").ToolStarted, typeof import("../agent/session.ts").ToolFinished, typeof import("../agent/session.ts").PoolRateLimitsUpdated, typeof import("../agent/session.ts").SessionFinished]>;
52
+ readonly event: Schema.Union<readonly [typeof import("../agent/session.ts").SessionStarted, typeof import("../agent/session.ts").TextOutput, typeof import("../agent/session.ts").ToolStarted, typeof import("../agent/session.ts").ToolFinished, typeof import("../agent/session.ts").PoolRateLimitsUpdated, typeof import("../agent/session.ts").SessionFinished, typeof import("../agent/session.ts").SessionIdle, typeof import("../agent/session.ts").SessionResumed, typeof import("../agent/session.ts").SessionTokensUpdated, typeof import("../agent/session.ts").ProviderRetrying, typeof import("../agent/session.ts").ProviderRecovered]>;
46
53
  }>, {}>;
47
- /** One normalized parent or child session event, persisted in the Attempt transcript. */
54
+ /** A normalized parent or child session event, persisted in the Attempt transcript. */
48
55
  export declare class SessionEvent extends SessionEvent_base {
49
56
  }
50
57
  declare const Final_base: Schema.Class<Final, Schema.TaggedStruct<"Final", {
@@ -53,16 +60,14 @@ declare const Final_base: Schema.Class<Final, Schema.TaggedStruct<"Final", {
53
60
  export declare class Final extends Final_base {
54
61
  }
55
62
  declare const Failed_base: Schema.Class<Failed, Schema.TaggedStruct<"Failed", {
56
- readonly failure: Schema.Union<readonly [typeof import("./failure.ts").InfraFailure, typeof import("./failure.ts").DefectFailure, typeof import("./failure.ts").AgentFailure, typeof import("./failure.ts").RunawayFailure, typeof import("./failure.ts").ChildSessionBudgetFailure]>;
63
+ readonly failure: Schema.Union<readonly [typeof import("./failure.ts").InfraFailure, typeof import("./failure.ts").DefectFailure, typeof import("./failure.ts").AgentFailure, typeof import("./failure.ts").BlockedFailure, typeof import("./failure.ts").QuestionFailure, typeof import("./failure.ts").RunawayFailure, typeof import("./failure.ts").ChildSessionBudgetFailure]>;
57
64
  }>, {}>;
58
65
  export declare class Failed extends Failed_base {
59
66
  }
60
67
  declare const Interrupted_base: Schema.Class<Interrupted, Schema.TaggedStruct<"Interrupted", {}>, {}>;
61
- /** The run host stopped on an Interrupt frame. Terminal. */
68
+ /** The parent's terminal acknowledgment of cancellation. */
62
69
  export declare class Interrupted extends Interrupted_base {
63
70
  }
64
- export declare const OutboundPayload: Schema.Union<readonly [typeof Started, typeof SessionEvent, typeof Final, typeof Failed, typeof Interrupted]>;
65
- export type OutboundPayload = typeof OutboundPayload.Type;
66
71
  declare const Steer_base: Schema.Class<Steer, Schema.TaggedStruct<"Steer", {
67
72
  readonly message: Schema.NonEmptyString;
68
73
  }>, {}>;
@@ -71,59 +76,152 @@ export declare class Steer extends Steer_base {
71
76
  declare const Interrupt_base: Schema.Class<Interrupt, Schema.TaggedStruct<"Interrupt", {}>, {}>;
72
77
  export declare class Interrupt extends Interrupt_base {
73
78
  }
74
- export declare const InboundPayload: Schema.Union<readonly [typeof Steer, typeof Interrupt]>;
79
+ declare const Cancel_base: Schema.Class<Cancel, Schema.TaggedStruct<"Cancel", {}>, {}>;
80
+ /** The request to stop the whole Attempt, including held and paused sessions. */
81
+ export declare class Cancel extends Cancel_base {
82
+ }
83
+ declare const OperatorMessage_base: Schema.Class<OperatorMessage, Schema.TaggedStruct<"OperatorMessage", {
84
+ readonly message: Schema.NonEmptyString;
85
+ }>, {}>;
86
+ /** An operator turn for the target session; unlike `Steer`, it puts the session on hold (ADR 0018). */
87
+ export declare class OperatorMessage extends OperatorMessage_base {
88
+ }
89
+ declare const Release_base: Schema.Class<Release, Schema.TaggedStruct<"Release", {}>, {}>;
90
+ /**
91
+ * The request to end a takeover (ADR 0018). A held child returns its idle result to the parent,
92
+ * and a held or paused parent resumes the task.
93
+ */
94
+ export declare class Release extends Release_base {
95
+ }
96
+ /** The non-terminal operator actions; `Cancel` is separate. */
97
+ export declare const OperatorAction: Schema.Union<readonly [typeof Steer, typeof Interrupt, typeof OperatorMessage, typeof Release]>;
98
+ export type OperatorAction = typeof OperatorAction.Type;
99
+ export declare const InboundPayload: Schema.Union<readonly [Schema.Union<readonly [typeof Steer, typeof Interrupt, typeof OperatorMessage, typeof Release]>, typeof Cancel]>;
75
100
  export type InboundPayload = typeof InboundPayload.Type;
101
+ declare const ParentTarget_base: Schema.Class<ParentTarget, Schema.TaggedStruct<"Parent", {}>, {}>;
102
+ /** The default target of operator input. */
103
+ export declare class ParentTarget extends ParentTarget_base {
104
+ }
105
+ declare const ChildTarget_base: Schema.Class<ChildTarget, Schema.TaggedStruct<"Child", {
106
+ readonly sessionId: Schema.brand<Schema.NonEmptyString, "AgentSessionId">;
107
+ }>, {}>;
108
+ /** A child session, addressed by the session ID in its events. */
109
+ export declare class ChildTarget extends ChildTarget_base {
110
+ }
111
+ export declare const SessionTarget: Schema.Union<readonly [typeof ParentTarget, typeof ChildTarget]>;
112
+ export type SessionTarget = typeof SessionTarget.Type;
113
+ declare const Intervention_base: Schema.Class<Intervention, Schema.Struct<{
114
+ readonly operator: Schema.NonEmptyString;
115
+ readonly target: Schema.Union<readonly [typeof ParentTarget, typeof ChildTarget]>;
116
+ readonly action: Schema.Union<readonly [typeof Steer, typeof Interrupt, typeof OperatorMessage, typeof Release]>;
117
+ }>, {}>;
118
+ /** Operator input for one live session, never stored as an Event. */
119
+ export declare class Intervention extends Intervention_base {
120
+ }
121
+ declare const InterventionState_base: Schema.Class<InterventionState, Schema.Struct<{
122
+ readonly held: Schema.Boolean;
123
+ readonly paused: Schema.Boolean;
124
+ /**
125
+ * Whether the session reads the message only after its current tool call returns. A later
126
+ * receipt with the same input sequence reports delivery or rejection.
127
+ */
128
+ readonly queued: Schema.withConstructorDefault<Schema.withDecodingDefaultKey<Schema.Boolean, never>>;
129
+ }>, {}>;
130
+ /** The session's supervision state after an accepted operator action. */
131
+ export declare class InterventionState extends InterventionState_base {
132
+ }
133
+ declare const InterventionApplied_base: Schema.Class<InterventionApplied, Schema.TaggedStruct<"InterventionApplied", {
134
+ readonly inputSequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
135
+ readonly intervention: typeof Intervention;
136
+ readonly state: typeof InterventionState;
137
+ }>, {}>;
138
+ /**
139
+ * The receipt for an accepted operator input, with the resulting hold or pause state. A queued
140
+ * input gets a second receipt with the same `inputSequence` when the session reads it.
141
+ */
142
+ export declare class InterventionApplied extends InterventionApplied_base {
143
+ }
144
+ declare const InterventionRejected_base: Schema.Class<InterventionRejected, Schema.TaggedStruct<"InterventionRejected", {
145
+ readonly inputSequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
146
+ readonly intervention: typeof Intervention;
147
+ readonly message: Schema.NonEmptyString;
148
+ }>, {}>;
149
+ /** The rejection of an operator action by a closed or refusing session; the Attempt continues. */
150
+ export declare class InterventionRejected extends InterventionRejected_base {
151
+ }
152
+ declare const WorkerUnresponsive_base: Schema.Class<WorkerUnresponsive, Schema.TaggedStruct<"WorkerUnresponsive", {
153
+ readonly worker: Schema.brand<Schema.String, "WorkerName">;
154
+ /** The last successful probe, or the Attempt's launch time if no probe has run. */
155
+ readonly lastAnsweredAt: Schema.DateTimeUtcFromString;
156
+ /** The probe error, such as the SSH client's error or the exceeded timeout. */
157
+ readonly reason: Schema.NonEmptyString;
158
+ }>, {}>;
159
+ /**
160
+ * A probe of the Worker that didn't run a command over a new SSH connection within its timeout.
161
+ * The Attempt isn't stopped or failed (ADR 0013).
162
+ */
163
+ export declare class WorkerUnresponsive extends WorkerUnresponsive_base {
164
+ }
165
+ declare const WorkerResponsive_base: Schema.Class<WorkerResponsive, Schema.TaggedStruct<"WorkerResponsive", {
166
+ readonly worker: Schema.brand<Schema.String, "WorkerName">;
167
+ /** The value from the preceding `WorkerUnresponsive`. */
168
+ readonly lastAnsweredAt: Schema.DateTimeUtcFromString;
169
+ }>, {}>;
170
+ /** A successful probe after `WorkerUnresponsive`. */
171
+ export declare class WorkerResponsive extends WorkerResponsive_base {
172
+ }
173
+ export declare const WorkerNotice: Schema.Union<readonly [typeof WorkerUnresponsive, typeof WorkerResponsive]>;
174
+ export type WorkerNotice = typeof WorkerNotice.Type;
175
+ export declare const OutboundPayload: Schema.Union<readonly [typeof Started, typeof SessionEvent, typeof Final, typeof Failed, typeof Interrupted, typeof InterventionApplied, typeof InterventionRejected, typeof WorkerUnresponsive, typeof WorkerResponsive]>;
176
+ export type OutboundPayload = typeof OutboundPayload.Type;
76
177
  declare const OutboundEnvelope_base: Schema.Class<OutboundEnvelope, Schema.TaggedStruct<"OutboundEnvelope", {
77
- readonly version: Schema.Literal<4>;
178
+ readonly version: Schema.Literal<7>;
78
179
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
79
180
  readonly sequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
80
181
  readonly sentAt: Schema.DateTimeUtcFromString;
81
- readonly payload: Schema.Union<readonly [typeof Started, typeof SessionEvent, typeof Final, typeof Failed, typeof Interrupted]>;
182
+ readonly payload: Schema.Union<readonly [typeof Started, typeof SessionEvent, typeof Final, typeof Failed, typeof Interrupted, typeof InterventionApplied, typeof InterventionRejected, typeof WorkerUnresponsive, typeof WorkerResponsive]>;
82
183
  }>, {}>;
83
184
  export declare class OutboundEnvelope extends OutboundEnvelope_base {
84
185
  }
85
186
  declare const InboundEnvelope_base: Schema.Class<InboundEnvelope, Schema.TaggedStruct<"InboundEnvelope", {
86
- readonly version: Schema.Literal<4>;
187
+ readonly version: Schema.Literal<7>;
87
188
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
88
189
  readonly sequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
89
190
  readonly sentAt: Schema.DateTimeUtcFromString;
90
- readonly payload: Schema.Union<readonly [typeof Steer, typeof Interrupt]>;
191
+ /** The target session, the parent by default. */
192
+ readonly target: Schema.withDecodingDefaultKey<Schema.Union<readonly [typeof ParentTarget, typeof ChildTarget]>, never>;
193
+ readonly operator: Schema.NonEmptyString;
194
+ readonly payload: Schema.Union<readonly [Schema.Union<readonly [typeof Steer, typeof Interrupt, typeof OperatorMessage, typeof Release]>, typeof Cancel]>;
91
195
  }>, {}>;
92
196
  export declare class InboundEnvelope extends InboundEnvelope_base {
93
197
  }
94
198
  export declare const Envelope: Schema.Union<readonly [typeof OutboundEnvelope, typeof InboundEnvelope]>;
95
199
  export type Envelope = typeof Envelope.Type;
96
- declare const Start_base: Schema.Class<Start, Schema.TaggedStruct<"Start", {
97
- readonly version: Schema.Literal<4>;
98
- readonly spec: typeof RunSpec;
99
- }>, {}>;
100
- /** The first framed stdin message. Later frames are inbound envelopes. */
101
- export declare class Start extends Start_base {
102
- }
103
- export declare const InputFrame: Schema.Union<readonly [typeof Start, typeof InboundEnvelope]>;
104
- export type InputFrame = typeof InputFrame.Type;
105
- export declare const EnvelopeFromJson: Schema.fromJsonString<Schema.Union<readonly [typeof OutboundEnvelope, typeof InboundEnvelope]>>;
106
- export declare const InputFrameFromJson: Schema.fromJsonString<Schema.Union<readonly [typeof Start, typeof InboundEnvelope]>>;
107
- export declare const OutboundEnvelopeFromJson: Schema.fromJsonString<typeof OutboundEnvelope>;
108
- /** Where a channel consumer persists envelopes. */
200
+ /** The orchestrator storage that an executor uses for one Attempt. */
109
201
  export interface Sink {
110
202
  readonly append: (direction: Direction, envelope: Envelope) => Effect.Effect<void, AttemptFailure>;
203
+ /** Records what the executor kept of the workspace after an unsuccessful end. */
204
+ readonly salvage: (salvage: AttemptSalvage) => Effect.Effect<void, AttemptFailure>;
205
+ /** Records the comments and reviews an unsuccessful Attempt posted on the Run's Item. */
206
+ readonly comments: (comments: ReadonlyArray<Comment>) => Effect.Effect<void, AttemptFailure>;
207
+ /** Reads the Attempt windows; harvesting runs it after GitHub lists the Attempt's comments. */
208
+ readonly windows: Effect.Effect<AttemptWindows, AttemptFailure>;
209
+ /** Reads the envelopes recorded by `append`, in order; reattach uses them to restore counters. */
210
+ readonly transcript: Effect.Effect<ReadonlyArray<Envelope>, AttemptFailure>;
111
211
  }
112
- /** How far one outbound channel has legally progressed. */
113
212
  export interface Progress {
114
213
  readonly state: "AwaitingStarted" | "Running" | "Terminal";
115
214
  readonly nextSequence: number;
116
215
  }
117
216
  export declare const initialProgress: Progress;
118
- /** One protocol violation, described for the infra failure that reports it. */
217
+ /** A protocol violation, reported as an infrastructure failure. */
119
218
  export interface Violation {
120
219
  readonly message: string;
121
220
  readonly detail: string;
122
221
  }
123
222
  /**
124
- * Checks one outbound envelope against the progress so far and returns the next
125
- * progress, or the violation. Every transport adapter folds the same state
126
- * machine through it.
223
+ * Validates an outbound envelope against `progress` and returns the next progress or the
224
+ * violation. Every outbound envelope passes through it before `append`.
127
225
  */
128
226
  export declare const admit: (progress: Progress, attemptId: AttemptId, envelope: OutboundEnvelope) => Result.Result<Progress, Violation>;
129
227
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/attempt/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAE,SAAS,EAAe,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,QAAQ,oDAEpB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,UAAU,YAAI,SAAS,EAAE,UAAU,CAAU,CAAC;AAC3D,eAAO,MAAM,SAAS,mDAA8B,CAAC;AACrD,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;;;;;;;;;;;;;AAE9C,6EAA6E;AAC7E,qBAA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;IAC7F,+FAA+F;IAC/F,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IAChE,kGAAkG;IAClG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC;CAC7E;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,GAAG,UAAU,CAAC;IAC3D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,eAAe,EAAE,QAAwD,CAAC;AAEvF,mEAAmE;AACnE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAKD;;;GAGG;AACH,eAAO,MAAM,KAAK,aACN,QAAQ,aACP,SAAS,YACV,gBAAgB,KACzB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAuCnC,CAAC"}
@@ -1,24 +1,23 @@
1
- import { Result, Schema } from "effect";
1
+ import { Effect, Option, Result, Schema } from "effect";
2
2
  import { Agent } from "../agent/agent.js";
3
3
  import { Effort, ModelId } from "../agent/brain.js";
4
- import { AgentSessionEvent, ChildSessionBudget } from "../agent/session.js";
4
+ import { AgentSessionEvent, AgentSessionId, ChildSessionBudget } from "../agent/session.js";
5
5
  import { AttemptId, AttemptTask } from "./attempt.js";
6
6
  import { RepositoryName, CommitSha, RepositoryRevision } from "../repository.js";
7
7
  import { StepResult } from "../step/result.js";
8
+ import { BotLogin, WorkerName } from "../worker.js";
8
9
  import { AttemptFailure } from "./failure.js";
9
- export const PROTOCOL_VERSION = 4;
10
- /**
11
- * Per-Attempt, per-direction message sequence, starting at 1. Distinct from the
12
- * engine's transcript sequence, which orders persisted rows globally.
13
- */
10
+ import { AttemptSalvage, SalvagePushed } from "./salvage.js";
11
+ export const PROTOCOL_VERSION = 7;
12
+ /** The per-Attempt, per-direction message sequence, starting at 1; distinct from the transcript sequence. */
14
13
  export const Sequence = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).pipe(Schema.brand("AttemptChannelSequence"));
15
14
  /**
16
- * Relative to the run host: `inbound` frames go from the orchestrator to the run
17
- * host (Start, Steer, Interrupt) and `outbound` frames go the other way.
15
+ * The directions relative to the Attempt's parent: `inbound` for operator input and Cancel, and
16
+ * `outbound` for activity and outcome.
18
17
  */
19
18
  export const DIRECTIONS = ["inbound", "outbound"];
20
19
  export const Direction = Schema.Literals(DIRECTIONS);
21
- /** Launch input for one Attempt. Worker credentials are never part of it. */
20
+ /** The launch input for one Attempt, without Worker credentials. */
22
21
  export class RunSpec extends Schema.Class("AttemptChannel/RunSpec")({
23
22
  attemptId: AttemptId,
24
23
  repository: RepositoryName,
@@ -30,17 +29,26 @@ export class RunSpec extends Schema.Class("AttemptChannel/RunSpec")({
30
29
  parentModel: Schema.OptionFromNullOr(ModelId),
31
30
  maxChildren: ChildSessionBudget,
32
31
  parentEffort: Effort,
32
+ /** The previous Attempt's pushed salvage, applied on top of `baseCommit` and rebased if the base moved. */
33
+ resume: Schema.OptionFromNullOr(SalvagePushed),
34
+ /** The previous Attempt's pushed salvage that conflicts with `baseCommit` and isn't applied. */
35
+ conflictingSalvage: Schema.OptionFromNullOr(SalvagePushed).pipe(Schema.withDecodingDefaultKey(Effect.succeed(null)), Schema.withConstructorDefault(Effect.succeed(Option.none()))),
36
+ /** The time the Worker prepared the checkout, from which harvesting reads the Item, or `None` for older Attempts. */
37
+ preparedAt: Schema.OptionFromNullOr(Schema.DateTimeUtcFromString).pipe(Schema.withDecodingDefaultKey(Effect.succeed(null))),
38
+ /**
39
+ * The GitHub login the Attempt writes as. If `None`, harvesting asks GitHub for the credential's
40
+ * login.
41
+ */
42
+ botLogin: Schema.OptionFromNullOr(BotLogin).pipe(Schema.withDecodingDefaultKey(Effect.succeed(null))),
33
43
  }) {
34
44
  }
35
- /**
36
- * The parent model the SDK selected at launch, which the roster may not declare.
37
- * Child sessions report their own model in `SessionStarted` events.
38
- */
45
+ /** The start of an Attempt, with the parent model selected at launch, which can differ from the roster. */
39
46
  export class Started extends Schema.TaggedClass("AttemptChannel/Started")("Started", {
40
47
  parentModel: ModelId,
48
+ conflictingSalvage: Schema.OptionFromNullOr(SalvagePushed).pipe(Schema.withDecodingDefaultKey(Effect.succeed(null)), Schema.withConstructorDefault(Effect.succeed(Option.none()))),
41
49
  }) {
42
50
  }
43
- /** One normalized parent or child session event, persisted in the Attempt transcript. */
51
+ /** A normalized parent or child session event, persisted in the Attempt transcript. */
44
52
  export class SessionEvent extends Schema.TaggedClass("AttemptChannel/SessionEvent")("SessionEvent", { event: AgentSessionEvent }) {
45
53
  }
46
54
  export class Final extends Schema.TaggedClass("AttemptChannel/Final")("Final", {
@@ -51,17 +59,105 @@ export class Failed extends Schema.TaggedClass("AttemptChannel/Failed")("Failed"
51
59
  failure: AttemptFailure,
52
60
  }) {
53
61
  }
54
- /** The run host stopped on an Interrupt frame. Terminal. */
62
+ /** The parent's terminal acknowledgment of cancellation. */
55
63
  export class Interrupted extends Schema.TaggedClass("AttemptChannel/Interrupted")("Interrupted", {}) {
56
64
  }
57
- export const OutboundPayload = Schema.Union([Started, SessionEvent, Final, Failed, Interrupted]);
58
65
  export class Steer extends Schema.TaggedClass("AttemptChannel/Steer")("Steer", {
59
66
  message: Schema.NonEmptyString,
60
67
  }) {
61
68
  }
62
69
  export class Interrupt extends Schema.TaggedClass("AttemptChannel/Interrupt")("Interrupt", {}) {
63
70
  }
64
- export const InboundPayload = Schema.Union([Steer, Interrupt]);
71
+ /** The request to stop the whole Attempt, including held and paused sessions. */
72
+ export class Cancel extends Schema.TaggedClass("AttemptChannel/Cancel")("Cancel", {}) {
73
+ }
74
+ /** An operator turn for the target session; unlike `Steer`, it puts the session on hold (ADR 0018). */
75
+ export class OperatorMessage extends Schema.TaggedClass("AttemptChannel/OperatorMessage")("OperatorMessage", {
76
+ message: Schema.NonEmptyString,
77
+ }) {
78
+ }
79
+ /**
80
+ * The request to end a takeover (ADR 0018). A held child returns its idle result to the parent,
81
+ * and a held or paused parent resumes the task.
82
+ */
83
+ export class Release extends Schema.TaggedClass("AttemptChannel/Release")("Release", {}) {
84
+ }
85
+ /** The non-terminal operator actions; `Cancel` is separate. */
86
+ export const OperatorAction = Schema.Union([Steer, Interrupt, OperatorMessage, Release]);
87
+ export const InboundPayload = Schema.Union([OperatorAction, Cancel]);
88
+ /** The default target of operator input. */
89
+ export class ParentTarget extends Schema.TaggedClass("AttemptChannel/ParentTarget")("Parent", {}) {
90
+ }
91
+ /** A child session, addressed by the session ID in its events. */
92
+ export class ChildTarget extends Schema.TaggedClass("AttemptChannel/ChildTarget")("Child", { sessionId: AgentSessionId }) {
93
+ }
94
+ export const SessionTarget = Schema.Union([ParentTarget, ChildTarget]);
95
+ /** Operator input for one live session, never stored as an Event. */
96
+ export class Intervention extends Schema.Class("AttemptChannel/Intervention")({
97
+ operator: Schema.NonEmptyString,
98
+ target: SessionTarget,
99
+ action: OperatorAction,
100
+ }) {
101
+ }
102
+ /** The session's supervision state after an accepted operator action. */
103
+ export class InterventionState extends Schema.Class("AttemptChannel/InterventionState")({
104
+ held: Schema.Boolean,
105
+ paused: Schema.Boolean,
106
+ /**
107
+ * Whether the session reads the message only after its current tool call returns. A later
108
+ * receipt with the same input sequence reports delivery or rejection.
109
+ */
110
+ queued: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(false)), Schema.withConstructorDefault(Effect.succeed(false))),
111
+ }) {
112
+ }
113
+ /**
114
+ * The receipt for an accepted operator input, with the resulting hold or pause state. A queued
115
+ * input gets a second receipt with the same `inputSequence` when the session reads it.
116
+ */
117
+ export class InterventionApplied extends Schema.TaggedClass("AttemptChannel/InterventionApplied")("InterventionApplied", {
118
+ inputSequence: Sequence,
119
+ intervention: Intervention,
120
+ state: InterventionState,
121
+ }) {
122
+ }
123
+ /** The rejection of an operator action by a closed or refusing session; the Attempt continues. */
124
+ export class InterventionRejected extends Schema.TaggedClass("AttemptChannel/InterventionRejected")("InterventionRejected", {
125
+ inputSequence: Sequence,
126
+ intervention: Intervention,
127
+ message: Schema.NonEmptyString,
128
+ }) {
129
+ }
130
+ /**
131
+ * A probe of the Worker that didn't run a command over a new SSH connection within its timeout.
132
+ * The Attempt isn't stopped or failed (ADR 0013).
133
+ */
134
+ export class WorkerUnresponsive extends Schema.TaggedClass("AttemptChannel/WorkerUnresponsive")("WorkerUnresponsive", {
135
+ worker: WorkerName,
136
+ /** The last successful probe, or the Attempt's launch time if no probe has run. */
137
+ lastAnsweredAt: Schema.DateTimeUtcFromString,
138
+ /** The probe error, such as the SSH client's error or the exceeded timeout. */
139
+ reason: Schema.NonEmptyString,
140
+ }) {
141
+ }
142
+ /** A successful probe after `WorkerUnresponsive`. */
143
+ export class WorkerResponsive extends Schema.TaggedClass("AttemptChannel/WorkerResponsive")("WorkerResponsive", {
144
+ worker: WorkerName,
145
+ /** The value from the preceding `WorkerUnresponsive`. */
146
+ lastAnsweredAt: Schema.DateTimeUtcFromString,
147
+ }) {
148
+ }
149
+ export const WorkerNotice = Schema.Union([WorkerUnresponsive, WorkerResponsive]);
150
+ export const OutboundPayload = Schema.Union([
151
+ Started,
152
+ SessionEvent,
153
+ Final,
154
+ Failed,
155
+ Interrupted,
156
+ InterventionApplied,
157
+ InterventionRejected,
158
+ WorkerUnresponsive,
159
+ WorkerResponsive,
160
+ ]);
65
161
  const EnvelopeFields = {
66
162
  version: Schema.Literal(PROTOCOL_VERSION),
67
163
  attemptId: AttemptId,
@@ -75,43 +171,35 @@ export class OutboundEnvelope extends Schema.TaggedClass("AttemptChannel/Outboun
75
171
  }
76
172
  export class InboundEnvelope extends Schema.TaggedClass("AttemptChannel/InboundEnvelope")("InboundEnvelope", {
77
173
  ...EnvelopeFields,
174
+ /** The target session, the parent by default. */
175
+ target: SessionTarget.pipe(Schema.withDecodingDefaultKey(Effect.succeed({ _tag: "Parent" }))),
176
+ operator: Schema.NonEmptyString,
78
177
  payload: InboundPayload,
79
178
  }) {
80
179
  }
81
180
  export const Envelope = Schema.Union([OutboundEnvelope, InboundEnvelope]);
82
- /** The first framed stdin message. Later frames are inbound envelopes. */
83
- export class Start extends Schema.TaggedClass("AttemptChannel/Start")("Start", {
84
- version: Schema.Literal(PROTOCOL_VERSION),
85
- spec: RunSpec,
86
- }) {
87
- }
88
- export const InputFrame = Schema.Union([Start, InboundEnvelope]);
89
- export const EnvelopeFromJson = Schema.fromJsonString(Envelope);
90
- export const InputFrameFromJson = Schema.fromJsonString(InputFrame);
91
- export const OutboundEnvelopeFromJson = Schema.fromJsonString(OutboundEnvelope);
92
181
  export const initialProgress = { state: "AwaitingStarted", nextSequence: 1 };
93
182
  const isTerminal = (payload) => payload._tag === "Final" || payload._tag === "Failed" || payload._tag === "Interrupted";
94
183
  /**
95
- * Checks one outbound envelope against the progress so far and returns the next
96
- * progress, or the violation. Every transport adapter folds the same state
97
- * machine through it.
184
+ * Validates an outbound envelope against `progress` and returns the next progress or the
185
+ * violation. Every outbound envelope passes through it before `append`.
98
186
  */
99
187
  export const admit = (progress, attemptId, envelope) => {
100
188
  if (envelope.attemptId !== attemptId) {
101
189
  return Result.fail({
102
- message: "The run host emitted a frame for another Attempt",
190
+ message: "The outbound channel has an envelope for another attempt",
103
191
  detail: String(envelope.attemptId),
104
192
  });
105
193
  }
106
194
  if (envelope.sequence !== progress.nextSequence) {
107
195
  return Result.fail({
108
- message: "The run host emitted a non-contiguous sequence",
196
+ message: "The outbound channel has a non-contiguous sequence number",
109
197
  detail: `expected ${progress.nextSequence}, received ${envelope.sequence}`,
110
198
  });
111
199
  }
112
200
  if (progress.state === "Terminal") {
113
201
  return Result.fail({
114
- message: "The run host emitted an envelope after its terminal envelope",
202
+ message: "The outbound channel has an envelope after the terminal envelope",
115
203
  detail: envelope.payload._tag,
116
204
  });
117
205
  }
@@ -119,13 +207,13 @@ export const admit = (progress, attemptId, envelope) => {
119
207
  envelope.payload._tag !== "Started" &&
120
208
  envelope.payload._tag !== "Failed") {
121
209
  return Result.fail({
122
- message: "The run host did not begin with a Started or Failed envelope",
210
+ message: "The outbound channel doesn't start with a Started or Failed envelope",
123
211
  detail: envelope.payload._tag,
124
212
  });
125
213
  }
126
214
  if (progress.state === "Running" && envelope.payload._tag === "Started") {
127
215
  return Result.fail({
128
- message: "The run host emitted more than one Started envelope",
216
+ message: "The outbound channel has more than one Started envelope",
129
217
  detail: "duplicate Started envelope",
130
218
  });
131
219
  }
@@ -1 +1 @@
1
- {"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/attempt/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAe,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAU,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAC7E,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CACvC,CAAC;AAGF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG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