@usine/executor 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/README.md +115 -37
  2. package/dist/child-command.d.ts +4 -7
  3. package/dist/child-command.d.ts.map +1 -1
  4. package/dist/child-command.js +6 -12
  5. package/dist/child-command.js.map +1 -1
  6. package/dist/claude-login-lock.d.ts +8 -0
  7. package/dist/claude-login-lock.d.ts.map +1 -0
  8. package/dist/claude-login-lock.js +9 -0
  9. package/dist/claude-login-lock.js.map +1 -0
  10. package/dist/credential-environment.d.ts +20 -0
  11. package/dist/credential-environment.d.ts.map +1 -0
  12. package/dist/credential-environment.js +20 -0
  13. package/dist/credential-environment.js.map +1 -0
  14. package/dist/durable-session.d.ts +63 -0
  15. package/dist/durable-session.d.ts.map +1 -0
  16. package/dist/durable-session.js +491 -0
  17. package/dist/durable-session.js.map +1 -0
  18. package/dist/exe-dev/commands.d.ts +23 -13
  19. package/dist/exe-dev/commands.d.ts.map +1 -1
  20. package/dist/exe-dev/commands.js +11 -57
  21. package/dist/exe-dev/commands.js.map +1 -1
  22. package/dist/exe-dev/exe-dev.d.ts +9 -3
  23. package/dist/exe-dev/exe-dev.d.ts.map +1 -1
  24. package/dist/exe-dev/exe-dev.js +53 -127
  25. package/dist/exe-dev/exe-dev.js.map +1 -1
  26. package/dist/exe-dev/grants.d.ts.map +1 -1
  27. package/dist/exe-dev/grants.js +35 -15
  28. package/dist/exe-dev/grants.js.map +1 -1
  29. package/dist/exe-dev/model.d.ts +15 -19
  30. package/dist/exe-dev/model.d.ts.map +1 -1
  31. package/dist/exe-dev/model.js +9 -12
  32. package/dist/exe-dev/model.js.map +1 -1
  33. package/dist/exe-dev/preflight.d.ts +8 -4
  34. package/dist/exe-dev/preflight.d.ts.map +1 -1
  35. package/dist/exe-dev/preflight.js +23 -33
  36. package/dist/exe-dev/preflight.js.map +1 -1
  37. package/dist/executor.d.ts +141 -38
  38. package/dist/executor.d.ts.map +1 -1
  39. package/dist/executor.js +90 -17
  40. package/dist/executor.js.map +1 -1
  41. package/dist/guard.d.ts +61 -0
  42. package/dist/guard.d.ts.map +1 -0
  43. package/dist/guard.js +288 -0
  44. package/dist/guard.js.map +1 -0
  45. package/dist/harness-preflight.d.ts +25 -4
  46. package/dist/harness-preflight.d.ts.map +1 -1
  47. package/dist/harness-preflight.js +25 -29
  48. package/dist/harness-preflight.js.map +1 -1
  49. package/dist/keyed-lock.d.ts +2 -3
  50. package/dist/keyed-lock.d.ts.map +1 -1
  51. package/dist/keyed-lock.js +2 -3
  52. package/dist/keyed-lock.js.map +1 -1
  53. package/dist/leftovers.d.ts +9 -0
  54. package/dist/leftovers.d.ts.map +1 -0
  55. package/dist/leftovers.js +14 -0
  56. package/dist/leftovers.js.map +1 -0
  57. package/dist/local/credentials.d.ts +21 -0
  58. package/dist/local/credentials.d.ts.map +1 -0
  59. package/dist/local/credentials.js +39 -0
  60. package/dist/local/credentials.js.map +1 -0
  61. package/dist/local/leftovers.d.ts +8 -0
  62. package/dist/local/leftovers.d.ts.map +1 -0
  63. package/dist/local/leftovers.js +23 -0
  64. package/dist/local/leftovers.js.map +1 -0
  65. package/dist/local/local.d.ts +16 -10
  66. package/dist/local/local.d.ts.map +1 -1
  67. package/dist/local/local.js +164 -129
  68. package/dist/local/local.js.map +1 -1
  69. package/dist/memory-preflight.d.ts +25 -0
  70. package/dist/memory-preflight.d.ts.map +1 -0
  71. package/dist/memory-preflight.js +83 -0
  72. package/dist/memory-preflight.js.map +1 -0
  73. package/dist/pre-push-hook.d.ts +20 -0
  74. package/dist/pre-push-hook.d.ts.map +1 -0
  75. package/dist/pre-push-hook.js +33 -0
  76. package/dist/pre-push-hook.js.map +1 -0
  77. package/dist/prepared-attempt.d.ts +33 -3
  78. package/dist/prepared-attempt.d.ts.map +1 -1
  79. package/dist/prepared-attempt.js +109 -39
  80. package/dist/prepared-attempt.js.map +1 -1
  81. package/dist/provision.d.ts +77 -14
  82. package/dist/provision.d.ts.map +1 -1
  83. package/dist/provision.js +357 -55
  84. package/dist/provision.js.map +1 -1
  85. package/dist/remote/commands.d.ts +51 -0
  86. package/dist/remote/commands.d.ts.map +1 -0
  87. package/dist/remote/commands.js +94 -0
  88. package/dist/remote/commands.js.map +1 -0
  89. package/dist/remote/leftovers.d.ts +14 -0
  90. package/dist/remote/leftovers.d.ts.map +1 -0
  91. package/dist/remote/leftovers.js +22 -0
  92. package/dist/remote/leftovers.js.map +1 -0
  93. package/dist/remote/liveness.d.ts +33 -0
  94. package/dist/remote/liveness.d.ts.map +1 -0
  95. package/dist/remote/liveness.js +194 -0
  96. package/dist/remote/liveness.js.map +1 -0
  97. package/dist/remote/machine.d.ts +64 -0
  98. package/dist/remote/machine.d.ts.map +1 -0
  99. package/dist/remote/machine.js +2 -0
  100. package/dist/remote/machine.js.map +1 -0
  101. package/dist/remote/remote.d.ts +24 -0
  102. package/dist/remote/remote.d.ts.map +1 -0
  103. package/dist/remote/remote.js +308 -0
  104. package/dist/remote/remote.js.map +1 -0
  105. package/dist/remote/sweep.d.ts +15 -0
  106. package/dist/remote/sweep.d.ts.map +1 -0
  107. package/dist/remote/sweep.js +116 -0
  108. package/dist/remote/sweep.js.map +1 -0
  109. package/dist/renewable-credential.d.ts +17 -0
  110. package/dist/renewable-credential.d.ts.map +1 -0
  111. package/dist/renewable-credential.js +58 -0
  112. package/dist/renewable-credential.js.map +1 -0
  113. package/dist/salvage.d.ts +30 -0
  114. package/dist/salvage.d.ts.map +1 -0
  115. package/dist/salvage.js +104 -0
  116. package/dist/salvage.js.map +1 -0
  117. package/dist/ssh/credentials.d.ts +40 -0
  118. package/dist/ssh/credentials.d.ts.map +1 -0
  119. package/dist/ssh/credentials.js +83 -0
  120. package/dist/ssh/credentials.js.map +1 -0
  121. package/dist/ssh/gateway/admin.d.ts +45 -0
  122. package/dist/ssh/gateway/admin.d.ts.map +1 -0
  123. package/dist/ssh/gateway/admin.js +129 -0
  124. package/dist/ssh/gateway/admin.js.map +1 -0
  125. package/dist/ssh/gateway/attachments.d.ts +22 -0
  126. package/dist/ssh/gateway/attachments.d.ts.map +1 -0
  127. package/dist/ssh/gateway/attachments.js +154 -0
  128. package/dist/ssh/gateway/attachments.js.map +1 -0
  129. package/dist/ssh/gateway/environment.d.ts +52 -0
  130. package/dist/ssh/gateway/environment.d.ts.map +1 -0
  131. package/dist/ssh/gateway/environment.js +78 -0
  132. package/dist/ssh/gateway/environment.js.map +1 -0
  133. package/dist/ssh/gateway/forward.d.ts +74 -0
  134. package/dist/ssh/gateway/forward.d.ts.map +1 -0
  135. package/dist/ssh/gateway/forward.js +247 -0
  136. package/dist/ssh/gateway/forward.js.map +1 -0
  137. package/dist/ssh/gateway/preflight.d.ts +28 -0
  138. package/dist/ssh/gateway/preflight.d.ts.map +1 -0
  139. package/dist/ssh/gateway/preflight.js +234 -0
  140. package/dist/ssh/gateway/preflight.js.map +1 -0
  141. package/dist/ssh/model.d.ts +65 -0
  142. package/dist/ssh/model.d.ts.map +1 -0
  143. package/dist/ssh/model.js +2 -0
  144. package/dist/ssh/model.js.map +1 -0
  145. package/dist/ssh/preflight.d.ts +16 -0
  146. package/dist/ssh/preflight.d.ts.map +1 -0
  147. package/dist/ssh/preflight.js +47 -0
  148. package/dist/ssh/preflight.js.map +1 -0
  149. package/dist/ssh/ssh.d.ts +20 -0
  150. package/dist/ssh/ssh.d.ts.map +1 -0
  151. package/dist/ssh/ssh.js +78 -0
  152. package/dist/ssh/ssh.js.map +1 -0
  153. package/dist/ssh/workers.d.ts +53 -0
  154. package/dist/ssh/workers.d.ts.map +1 -0
  155. package/dist/ssh/workers.js +173 -0
  156. package/dist/ssh/workers.js.map +1 -0
  157. package/package.json +12 -4
  158. package/dist/exe-dev/channel.d.ts +0 -11
  159. package/dist/exe-dev/channel.d.ts.map +0 -1
  160. package/dist/exe-dev/channel.js +0 -41
  161. package/dist/exe-dev/channel.js.map +0 -1
  162. package/dist/exe-dev/shell.d.ts +0 -12
  163. package/dist/exe-dev/shell.d.ts.map +0 -1
  164. package/dist/exe-dev/shell.js +0 -31
  165. package/dist/exe-dev/shell.js.map +0 -1
  166. package/dist/exe-dev/sweep.d.ts +0 -10
  167. package/dist/exe-dev/sweep.d.ts.map +0 -1
  168. package/dist/exe-dev/sweep.js +0 -117
  169. package/dist/exe-dev/sweep.js.map +0 -1
  170. package/dist/invalid-frame.d.ts +0 -17
  171. package/dist/invalid-frame.d.ts.map +0 -1
  172. package/dist/invalid-frame.js +0 -111
  173. package/dist/invalid-frame.js.map +0 -1
  174. package/dist/run-host-session.d.ts +0 -26
  175. package/dist/run-host-session.d.ts.map +0 -1
  176. package/dist/run-host-session.js +0 -241
  177. package/dist/run-host-session.js.map +0 -1
@@ -1,26 +0,0 @@
1
- import * as AttemptChannel from "@usine/core/attempt/channel";
2
- import { AttemptFailure } from "@usine/core/attempt/failure";
3
- import { AttemptId } from "@usine/core/attempt";
4
- import { StepResult } from "@usine/core/step/result";
5
- import { Cause, Effect, Queue, Scope, type PlatformError } from "effect";
6
- import type { ChildProcessHandle } from "effect/unstable/process/ChildProcessSpawner";
7
- import { ExecutorError, type AttemptWorkspace } from "./executor.ts";
8
- interface SpawnedRunHost {
9
- readonly handle: ChildProcessHandle;
10
- readonly host: string;
11
- /** Redacts the Attempt credential from run-host output before it is persisted. */
12
- readonly scrub: (text: string) => string;
13
- }
14
- export type RunHostInput = Queue.Queue<Uint8Array, Cause.Done>;
15
- export interface RunHostSessionOptions {
16
- readonly interruptGrace: Parameters<typeof Effect.timeoutOption>[1];
17
- }
18
- type SpawnRunHost = (input: RunHostInput) => Effect.Effect<SpawnedRunHost, AttemptFailure | PlatformError.PlatformError, Scope.Scope>;
19
- export interface RunHostSession {
20
- readonly cancel: (attemptId: AttemptId) => Effect.Effect<void, ExecutorError>;
21
- readonly launch: (prepared: AttemptWorkspace, io: AttemptChannel.Sink, spawn: SpawnRunHost) => Effect.Effect<StepResult, AttemptFailure>;
22
- }
23
- /** The run-host byte-channel session every process-backed Executor shares. */
24
- export declare const runHostSessionFor: (options: RunHostSessionOptions) => Effect.Effect<RunHostSession>;
25
- export {};
26
- //# sourceMappingURL=run-host-session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-host-session.d.ts","sourceRoot":"","sources":["../src/run-host-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAgB,cAAc,EAAgB,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACL,KAAK,EAEL,MAAM,EAGN,KAAK,EAIL,KAAK,EAEL,KAAK,aAAa,EACnB,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,aAAa,EAA0B,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG7F,UAAU,cAAc;IACtB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1C;AAED,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CACrE;AAED,KAAK,YAAY,GAAG,CAClB,KAAK,EAAE,YAAY,KAChB,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,cAAc,GAAG,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AAE9F,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9E,QAAQ,CAAC,MAAM,EAAE,CACf,QAAQ,EAAE,gBAAgB,EAC1B,EAAE,EAAE,cAAc,CAAC,IAAI,EACvB,KAAK,EAAE,YAAY,KAChB,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;CAChD;AAwCD,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,MAAM,CAAC,MAAM,CAAC,cAAc,CA6T5F,CAAC"}
@@ -1,241 +0,0 @@
1
- import * as AttemptChannel from "@usine/core/attempt/channel";
2
- import { AgentFailure, AttemptFailure, InfraFailure } from "@usine/core/attempt/failure";
3
- import { AttemptId } from "@usine/core/attempt";
4
- import { StepResult } from "@usine/core/step/result";
5
- import { Cause, DateTime, Effect, Fiber, Option, Queue, Ref, Result, Schema, Scope, Stream, } from "effect";
6
- import { ExecutorError, ExecutorOperationError } from "./executor.js";
7
- import { invalidFrameDiagnostic, invalidFrameMessage } from "./invalid-frame.js";
8
- const STDERR_TAIL_BYTES = 4_096;
9
- /** Sending SIGKILL is its own bounded step, unrelated to the interrupt grace. */
10
- const KILL_TIMEOUT = "5 seconds";
11
- const inputFrameToJson = Schema.encodeSync(AttemptChannel.InputFrameFromJson);
12
- /** Rejects a frame with any unknown key; the protocol is strict by contract. */
13
- const decodeOutboundEnvelope = (line) => Schema.decodeUnknownEffect(AttemptChannel.OutboundEnvelopeFromJson)(line, {
14
- onExcessProperty: "error",
15
- });
16
- const isExecutorError = Schema.is(ExecutorError);
17
- const encoder = new TextEncoder();
18
- const frame = (input) => encoder.encode(`${inputFrameToJson(input)}\n`);
19
- const infrastructureFailure = (message, cause) => new InfraFailure({ message, cause });
20
- const violationFailure = (violation) => infrastructureFailure(violation.message, new Error(violation.detail));
21
- const cancelError = (attemptId, cause) => new ExecutorOperationError({
22
- operation: "cancel",
23
- message: `Could not cancel Attempt ${attemptId}`,
24
- cause,
25
- });
26
- /** The run-host byte-channel session every process-backed Executor shares. */
27
- export const runHostSessionFor = Effect.fn("RunHostSession.for")(function* (options) {
28
- const activeAttempts = yield* Ref.make(new Map());
29
- const hardKill = Effect.fn("RunHostSession.hardKill")(function* (attemptId, active, reason) {
30
- yield* Effect.logWarning("Hard-killing the run host", {
31
- attemptId,
32
- worker: active.worker,
33
- host: active.host,
34
- reason,
35
- });
36
- // The kill failure is logged, never propagated, so it cannot mask the
37
- // failure that forced the hard kill.
38
- yield* active.handle.kill({ killSignal: "SIGKILL" }).pipe(Effect.timeout(KILL_TIMEOUT), Effect.tapError((error) => Effect.logError("Run-host hard kill failed", {
39
- attemptId,
40
- worker: active.worker,
41
- host: active.host,
42
- reason,
43
- message: String(error),
44
- })), Effect.ignore);
45
- yield* Effect.logWarning("Run-host hard-kill signal sent", {
46
- attemptId,
47
- worker: active.worker,
48
- host: active.host,
49
- reason,
50
- });
51
- });
52
- const cancelActive = Effect.fn("RunHostSession.cancelActive")(function* (attemptId, active) {
53
- return yield* Effect.uninterruptible(Effect.gen(function* () {
54
- yield* Effect.annotateCurrentSpan({
55
- attemptId,
56
- worker: active.worker,
57
- host: active.host,
58
- });
59
- const first = yield* Ref.modify(active.cancelStarted, (started) => [!started, true]);
60
- if (!first) {
61
- yield* Effect.logDebug("Attempt cancellation was already started", {
62
- attemptId,
63
- worker: active.worker,
64
- host: active.host,
65
- });
66
- return;
67
- }
68
- yield* Effect.logInfo("Sending the interrupt envelope", {
69
- attemptId,
70
- worker: active.worker,
71
- host: active.host,
72
- });
73
- const sequence = yield* Ref.getAndUpdate(active.sequence, (value) => value + 1);
74
- const envelope = new AttemptChannel.InboundEnvelope({
75
- version: AttemptChannel.PROTOCOL_VERSION,
76
- attemptId,
77
- sequence: AttemptChannel.Sequence.make(sequence),
78
- sentAt: yield* DateTime.now,
79
- payload: new AttemptChannel.Interrupt(),
80
- });
81
- const delivered = yield* active.io.append("inbound", envelope).pipe(Effect.andThen(Queue.offer(active.input, frame(envelope))),
82
- // The transcript store sits outside the process adapter and may be
83
- // parked; the bound keeps the uninterruptible cancellation handshake
84
- // moving on to the hard kill.
85
- Effect.timeoutOption(options.interruptGrace), Effect.result);
86
- if (Result.isFailure(delivered)) {
87
- yield* Effect.logWarning("Interrupt could not be delivered", {
88
- attemptId,
89
- worker: active.worker,
90
- host: active.host,
91
- message: String(delivered.failure),
92
- });
93
- yield* hardKill(attemptId, active, "delivery-failed");
94
- return yield* delivered.failure;
95
- }
96
- if (Option.isNone(delivered.success)) {
97
- const cause = new Error("interrupt delivery exceeded the cancellation grace");
98
- yield* Effect.logWarning("Interrupt delivery timed out", {
99
- attemptId,
100
- worker: active.worker,
101
- host: active.host,
102
- });
103
- yield* hardKill(attemptId, active, "delivery-failed");
104
- return yield* cancelError(attemptId, cause);
105
- }
106
- const completed = yield* active.handle.exitCode.pipe(Effect.timeoutOption(options.interruptGrace));
107
- if (Option.isNone(completed)) {
108
- yield* Effect.logWarning("Interrupt grace expired", {
109
- attemptId,
110
- worker: active.worker,
111
- host: active.host,
112
- });
113
- yield* hardKill(attemptId, active, "grace-expired");
114
- }
115
- else {
116
- yield* Effect.logInfo("Run host stopped within the interrupt grace", {
117
- attemptId,
118
- worker: active.worker,
119
- host: active.host,
120
- });
121
- }
122
- }));
123
- });
124
- const cancel = Effect.fn("RunHostSession.cancel")(function* (attemptId) {
125
- const active = (yield* Ref.get(activeAttempts)).get(attemptId);
126
- if (active === undefined) {
127
- yield* Effect.logDebug("Attempt cancellation was a no-op", { attemptId });
128
- return;
129
- }
130
- yield* cancelActive(attemptId, active).pipe(Effect.mapError((cause) => isExecutorError(cause) ? cause : cancelError(attemptId, cause)));
131
- });
132
- const launch = Effect.fn("RunHostSession.launch")(function* (prepared, io, spawn) {
133
- const attemptId = prepared.spec.attemptId;
134
- yield* Effect.annotateCurrentSpan({ attemptId, worker: prepared.worker });
135
- const execute = Effect.scoped(Effect.gen(function* () {
136
- const input = yield* Queue.make();
137
- const { handle, host, scrub } = yield* spawn(input);
138
- yield* Effect.annotateCurrentSpan({ host });
139
- const active = {
140
- cancelStarted: yield* Ref.make(false),
141
- handle,
142
- host,
143
- input,
144
- io,
145
- sequence: yield* Ref.make(1),
146
- worker: prepared.worker,
147
- };
148
- yield* Ref.update(activeAttempts, (current) => {
149
- const next = new Map(current);
150
- next.set(attemptId, active);
151
- return next;
152
- });
153
- yield* Queue.offer(input, frame(new AttemptChannel.Start({
154
- version: AttemptChannel.PROTOCOL_VERSION,
155
- spec: prepared.spec,
156
- })));
157
- const stderr = yield* Ref.make("");
158
- const stderrFiber = yield* handle.stderr.pipe(Stream.decodeText(), Stream.runForEach((chunk) => Ref.update(stderr, (current) => `${current}${chunk}`.slice(-STDERR_TAIL_BYTES))), Effect.forkChild);
159
- const terminal = yield* Ref.make(Option.none());
160
- const progress = yield* Ref.make(AttemptChannel.initialProgress);
161
- yield* handle.stdout.pipe(Stream.decodeText(), Stream.splitLines, Stream.runForEach((rawLine) => Effect.gen(function* () {
162
- // Frames include raw tool inputs and outputs; scrub the credential
163
- // from the line before it is decoded or persisted.
164
- const line = scrub(rawLine);
165
- const decoded = yield* decodeOutboundEnvelope(line).pipe(Effect.result);
166
- if (Result.isFailure(decoded)) {
167
- const diagnostic = invalidFrameDiagnostic(line, decoded.failure);
168
- if (diagnostic.source === "effect-log") {
169
- yield* Effect.logWarning("Dropped a run-host diagnostic from protocol output", {
170
- attemptId,
171
- ...diagnostic,
172
- });
173
- return;
174
- }
175
- yield* Effect.logError("Run host emitted an invalid frame", {
176
- attemptId,
177
- ...diagnostic,
178
- });
179
- return yield* infrastructureFailure(invalidFrameMessage(diagnostic), decoded.failure);
180
- }
181
- const envelope = decoded.success;
182
- const admitted = AttemptChannel.admit(yield* Ref.get(progress), attemptId, envelope);
183
- if (Result.isFailure(admitted))
184
- return yield* violationFailure(admitted.failure);
185
- yield* Ref.set(progress, admitted.success);
186
- yield* io.append("outbound", envelope);
187
- const payload = envelope.payload;
188
- if (payload._tag === "Final" ||
189
- payload._tag === "Failed" ||
190
- payload._tag === "Interrupted") {
191
- yield* Effect.logInfo("Run host reached its terminal envelope", {
192
- attemptId,
193
- terminal: payload._tag,
194
- sequence: envelope.sequence,
195
- });
196
- yield* Ref.set(terminal, Option.some(payload));
197
- yield* Queue.end(input);
198
- }
199
- })), Effect.mapError((error) => Schema.is(AttemptFailure)(error)
200
- ? error
201
- : infrastructureFailure("The run-host channel failed", error)));
202
- const exitCode = yield* handle.exitCode.pipe(Effect.mapError((cause) => infrastructureFailure("Could not read the run-host exit code", cause)));
203
- yield* Fiber.join(stderrFiber).pipe(Effect.tapError((error) => Effect.logWarning("Could not finish reading run-host stderr", {
204
- attemptId,
205
- message: String(error),
206
- })), Effect.ignore);
207
- yield* Effect.logInfo("Run host exited", {
208
- attemptId,
209
- exitCode: String(exitCode),
210
- });
211
- const ended = yield* Ref.get(terminal);
212
- const errorOutput = scrub((yield* Ref.get(stderr)).trim());
213
- if (Option.isNone(ended)) {
214
- return yield* infrastructureFailure("The run-host channel closed without a final envelope", new Error(`run host exited with code ${String(exitCode)}: ${errorOutput}`));
215
- }
216
- if (ended.value._tag === "Failed")
217
- return yield* ended.value.failure;
218
- if (ended.value._tag === "Interrupted") {
219
- return yield* new AgentFailure({
220
- message: "The run host confirmed the interrupt and stopped",
221
- });
222
- }
223
- if (Number(exitCode) !== 0) {
224
- return yield* infrastructureFailure(`The run host exited with code ${String(exitCode)} after its final envelope`, new Error(errorOutput));
225
- }
226
- return ended.value.result;
227
- }).pipe(Effect.onInterrupt(() => cancel(attemptId).pipe(Effect.tapError((error) => Effect.logWarning("Cancel-on-interrupt failed", {
228
- attemptId,
229
- message: String(error),
230
- })), Effect.ignore))));
231
- return yield* execute.pipe(Effect.ensuring(Ref.update(activeAttempts, (current) => {
232
- const next = new Map(current);
233
- next.delete(attemptId);
234
- return next;
235
- })), Effect.mapError((error) => Schema.is(AttemptFailure)(error)
236
- ? error
237
- : infrastructureFailure("The executor failed while running the run host", error)));
238
- });
239
- return { cancel, launch };
240
- });
241
- //# sourceMappingURL=run-host-session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-host-session.js","sourceRoot":"","sources":["../src/run-host-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,EACN,KAAK,EACL,GAAG,EACH,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,GAEP,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAyB,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAsCjF,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAChC,iFAAiF;AACjF,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAC9E,gFAAgF;AAChF,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAE,EAAE,CAC9C,MAAM,CAAC,mBAAmB,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC,IAAI,EAAE;IACxE,gBAAgB,EAAE,OAAO;CAC1B,CAAC,CAAC;AACL,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;AACjD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC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