@usine/executor 0.0.0 → 0.1.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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -1
  3. package/dist/child-command.d.ts +18 -0
  4. package/dist/child-command.d.ts.map +1 -0
  5. package/dist/child-command.js +47 -0
  6. package/dist/child-command.js.map +1 -0
  7. package/dist/exe-dev/channel.d.ts +8 -0
  8. package/dist/exe-dev/channel.d.ts.map +1 -0
  9. package/dist/exe-dev/channel.js +45 -0
  10. package/dist/exe-dev/channel.js.map +1 -0
  11. package/dist/exe-dev/commands.d.ts +22 -0
  12. package/dist/exe-dev/commands.d.ts.map +1 -0
  13. package/dist/exe-dev/commands.js +67 -0
  14. package/dist/exe-dev/commands.js.map +1 -0
  15. package/dist/exe-dev/grants.d.ts +9 -0
  16. package/dist/exe-dev/grants.d.ts.map +1 -0
  17. package/dist/exe-dev/grants.js +88 -0
  18. package/dist/exe-dev/grants.js.map +1 -0
  19. package/dist/exe-dev/index.d.ts +8 -0
  20. package/dist/exe-dev/index.d.ts.map +1 -0
  21. package/dist/exe-dev/index.js +239 -0
  22. package/dist/exe-dev/index.js.map +1 -0
  23. package/dist/exe-dev/model.d.ts +58 -0
  24. package/dist/exe-dev/model.d.ts.map +1 -0
  25. package/dist/exe-dev/model.js +33 -0
  26. package/dist/exe-dev/model.js.map +1 -0
  27. package/dist/exe-dev/preflight.d.ts +9 -0
  28. package/dist/exe-dev/preflight.d.ts.map +1 -0
  29. package/dist/exe-dev/preflight.js +82 -0
  30. package/dist/exe-dev/preflight.js.map +1 -0
  31. package/dist/exe-dev/shell.d.ts +12 -0
  32. package/dist/exe-dev/shell.d.ts.map +1 -0
  33. package/dist/exe-dev/shell.js +31 -0
  34. package/dist/exe-dev/shell.js.map +1 -0
  35. package/dist/exe-dev/sweep.d.ts +12 -0
  36. package/dist/exe-dev/sweep.d.ts.map +1 -0
  37. package/dist/exe-dev/sweep.js +119 -0
  38. package/dist/exe-dev/sweep.js.map +1 -0
  39. package/dist/index.d.ts +82 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +82 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/invalid-frame.d.ts +17 -0
  44. package/dist/invalid-frame.d.ts.map +1 -0
  45. package/dist/invalid-frame.js +110 -0
  46. package/dist/invalid-frame.js.map +1 -0
  47. package/dist/keyed-lock.d.ts +11 -0
  48. package/dist/keyed-lock.d.ts.map +1 -0
  49. package/dist/keyed-lock.js +21 -0
  50. package/dist/keyed-lock.js.map +1 -0
  51. package/dist/local/index.d.ts +15 -0
  52. package/dist/local/index.d.ts.map +1 -0
  53. package/dist/local/index.js +302 -0
  54. package/dist/local/index.js.map +1 -0
  55. package/dist/provision.d.ts +33 -0
  56. package/dist/provision.d.ts.map +1 -0
  57. package/dist/provision.js +76 -0
  58. package/dist/provision.js.map +1 -0
  59. package/dist/run-host-session.d.ts +22 -0
  60. package/dist/run-host-session.d.ts.map +1 -0
  61. package/dist/run-host-session.js +228 -0
  62. package/dist/run-host-session.js.map +1 -0
  63. package/package.json +51 -4
@@ -0,0 +1,228 @@
1
+ import { Attempt, AttemptChannel, AttemptFailure, StepResult } from "@usine/core";
2
+ import { Cause, DateTime, Effect, Fiber, Option, Queue, Ref, Result, Schema, Scope, Stream, } from "effect";
3
+ import { ExecutorError, ExecutorOperationError } from "./index.js";
4
+ import { invalidFrameDiagnostic, invalidFrameMessage } from "./invalid-frame.js";
5
+ const STDERR_TAIL_BYTES = 4_096;
6
+ /** Sending SIGKILL is its own bounded step, unrelated to the interrupt grace. */
7
+ const KILL_TIMEOUT = "5 seconds";
8
+ const inputFrameToJson = Schema.encodeSync(AttemptChannel.InputFrameFromJson);
9
+ /** Strict by contract: an unknown key on a protocol frame is a rejected frame. */
10
+ const decodeOutboundEnvelope = (line) => Schema.decodeUnknownEffect(AttemptChannel.OutboundEnvelopeFromJson)(line, {
11
+ onExcessProperty: "error",
12
+ });
13
+ const isExecutorError = Schema.is(ExecutorError);
14
+ const encoder = new TextEncoder();
15
+ const frame = (input) => encoder.encode(`${inputFrameToJson(input)}\n`);
16
+ const infrastructureFailure = (message, cause) => new AttemptFailure.InfraFailure({ message, cause });
17
+ const violationFailure = (violation) => infrastructureFailure(violation.message, new Error(violation.detail));
18
+ const cancelError = (attemptId, cause) => new ExecutorOperationError({
19
+ operation: "cancel",
20
+ message: `Could not cancel Attempt ${attemptId}`,
21
+ cause,
22
+ });
23
+ /** One canonical byte-channel state machine shared by every process-backed Executor. */
24
+ export const runHostSessionFor = Effect.fn("RunHostSession.for")(function* (options) {
25
+ const activeAttempts = yield* Ref.make(new Map());
26
+ const hardKill = Effect.fn("RunHostSession.hardKill")(function* (attemptId, active, reason) {
27
+ yield* Effect.logWarning("Hard-killing the run host", {
28
+ attemptId,
29
+ worker: active.worker,
30
+ host: active.host,
31
+ reason,
32
+ });
33
+ // Best-effort by design: the kill failure is logged, never propagated,
34
+ // so it cannot mask the failure that forced the hard kill.
35
+ yield* active.handle.kill({ killSignal: "SIGKILL" }).pipe(Effect.timeout(KILL_TIMEOUT), Effect.tapError((error) => Effect.logError("Run-host hard kill failed", {
36
+ attemptId,
37
+ worker: active.worker,
38
+ host: active.host,
39
+ reason,
40
+ message: String(error),
41
+ })), Effect.ignore);
42
+ yield* Effect.logWarning("Run-host hard-kill signal sent", {
43
+ attemptId,
44
+ worker: active.worker,
45
+ host: active.host,
46
+ reason,
47
+ });
48
+ });
49
+ const cancelActive = Effect.fn("RunHostSession.cancelActive")(function* (attemptId, active) {
50
+ return yield* Effect.uninterruptible(Effect.gen(function* () {
51
+ yield* Effect.annotateCurrentSpan({
52
+ attemptId,
53
+ worker: active.worker,
54
+ host: active.host,
55
+ });
56
+ const first = yield* Ref.modify(active.cancelStarted, (started) => [!started, true]);
57
+ if (!first) {
58
+ yield* Effect.logDebug("Attempt cancellation was already started", {
59
+ attemptId,
60
+ worker: active.worker,
61
+ host: active.host,
62
+ });
63
+ return;
64
+ }
65
+ yield* Effect.logInfo("Sending the interrupt envelope", {
66
+ attemptId,
67
+ worker: active.worker,
68
+ host: active.host,
69
+ });
70
+ const sequence = yield* Ref.getAndUpdate(active.sequence, (value) => value + 1);
71
+ const envelope = new AttemptChannel.InboundEnvelope({
72
+ version: AttemptChannel.PROTOCOL_VERSION,
73
+ attemptId,
74
+ sequence: AttemptChannel.Sequence.make(sequence),
75
+ sentAt: yield* DateTime.now,
76
+ payload: new AttemptChannel.Interrupt(),
77
+ });
78
+ const delivered = yield* active.io.append("inbound", envelope).pipe(Effect.andThen(Queue.offer(active.input, frame(envelope))),
79
+ // The transcript store is outside the process adapter and may be
80
+ // parked. Bound it so the uninterruptible cancellation handshake
81
+ // always reaches the hard-kill phase.
82
+ Effect.timeoutOption(options.interruptGrace), Effect.result);
83
+ if (Result.isFailure(delivered)) {
84
+ yield* Effect.logWarning("Interrupt could not be delivered", {
85
+ attemptId,
86
+ worker: active.worker,
87
+ host: active.host,
88
+ message: String(delivered.failure),
89
+ });
90
+ yield* hardKill(attemptId, active, "delivery-failed");
91
+ return yield* delivered.failure;
92
+ }
93
+ if (Option.isNone(delivered.success)) {
94
+ const cause = new Error("interrupt delivery exceeded the cancellation grace");
95
+ yield* Effect.logWarning("Interrupt delivery timed out", {
96
+ attemptId,
97
+ worker: active.worker,
98
+ host: active.host,
99
+ });
100
+ yield* hardKill(attemptId, active, "delivery-failed");
101
+ return yield* cancelError(attemptId, cause);
102
+ }
103
+ const completed = yield* active.handle.exitCode.pipe(Effect.timeoutOption(options.interruptGrace));
104
+ if (Option.isNone(completed)) {
105
+ yield* Effect.logWarning("Interrupt grace expired", {
106
+ attemptId,
107
+ worker: active.worker,
108
+ host: active.host,
109
+ });
110
+ yield* hardKill(attemptId, active, "grace-expired");
111
+ }
112
+ else {
113
+ yield* Effect.logInfo("Run host stopped within the interrupt grace", {
114
+ attemptId,
115
+ worker: active.worker,
116
+ host: active.host,
117
+ });
118
+ }
119
+ }));
120
+ });
121
+ const cancel = Effect.fn("RunHostSession.cancel")(function* (attemptId) {
122
+ const active = (yield* Ref.get(activeAttempts)).get(attemptId);
123
+ if (active === undefined) {
124
+ yield* Effect.logDebug("Attempt cancellation was a no-op", { attemptId });
125
+ return;
126
+ }
127
+ yield* cancelActive(attemptId, active).pipe(Effect.mapError((cause) => isExecutorError(cause) ? cause : cancelError(attemptId, cause)));
128
+ });
129
+ const launch = Effect.fn("RunHostSession.launch")(function* (prepared, io) {
130
+ const attemptId = prepared.spec.attemptId;
131
+ yield* Effect.annotateCurrentSpan({ attemptId, worker: prepared.worker });
132
+ const execute = Effect.scoped(Effect.gen(function* () {
133
+ const input = yield* Queue.make();
134
+ const { handle, host, scrub } = yield* options.spawn(prepared, input);
135
+ yield* Effect.annotateCurrentSpan({ host });
136
+ const active = {
137
+ cancelStarted: yield* Ref.make(false),
138
+ handle,
139
+ host,
140
+ input,
141
+ io,
142
+ sequence: yield* Ref.make(1),
143
+ worker: prepared.worker,
144
+ };
145
+ yield* Ref.update(activeAttempts, (current) => {
146
+ const next = new Map(current);
147
+ next.set(attemptId, active);
148
+ return next;
149
+ });
150
+ yield* Queue.offer(input, frame(new AttemptChannel.Start({
151
+ version: AttemptChannel.PROTOCOL_VERSION,
152
+ spec: prepared.spec,
153
+ })));
154
+ const stderr = yield* Ref.make("");
155
+ const stderrFiber = yield* handle.stderr.pipe(Stream.decodeText(), Stream.runForEach((chunk) => Ref.update(stderr, (current) => `${current}${chunk}`.slice(-STDERR_TAIL_BYTES))), Effect.forkChild);
156
+ const terminal = yield* Ref.make(Option.none());
157
+ const progress = yield* Ref.make(AttemptChannel.initialProgress);
158
+ yield* handle.stdout.pipe(Stream.decodeText(), Stream.splitLines, Stream.runForEach((rawLine) => Effect.gen(function* () {
159
+ // Protocol v2 carries raw tool inputs and outputs; scrub the
160
+ // credential from the line before it is decoded or persisted.
161
+ const line = scrub(rawLine);
162
+ const envelope = yield* decodeOutboundEnvelope(line).pipe(Effect.catch((cause) => {
163
+ const diagnostic = invalidFrameDiagnostic(line, cause);
164
+ return Effect.logError("Run host emitted an invalid frame", {
165
+ attemptId,
166
+ ...diagnostic,
167
+ }).pipe(Effect.andThen(Effect.fail(infrastructureFailure(invalidFrameMessage(diagnostic), cause))));
168
+ }));
169
+ const admitted = AttemptChannel.admit(yield* Ref.get(progress), attemptId, envelope);
170
+ if (Result.isFailure(admitted))
171
+ return yield* violationFailure(admitted.failure);
172
+ yield* Ref.set(progress, admitted.success);
173
+ yield* io.append("outbound", envelope);
174
+ const payload = envelope.payload;
175
+ if (payload._tag === "Final" ||
176
+ payload._tag === "Failed" ||
177
+ payload._tag === "Interrupted") {
178
+ yield* Effect.logInfo("Run host reached its terminal envelope", {
179
+ attemptId,
180
+ terminal: payload._tag,
181
+ sequence: envelope.sequence,
182
+ });
183
+ yield* Ref.set(terminal, Option.some(payload));
184
+ yield* Queue.end(input);
185
+ }
186
+ })), Effect.mapError((error) => Schema.is(AttemptFailure.AttemptFailure)(error)
187
+ ? error
188
+ : infrastructureFailure("The run-host channel failed", error)));
189
+ const exitCode = yield* handle.exitCode.pipe(Effect.mapError((cause) => infrastructureFailure("Could not read the run-host exit code", cause)));
190
+ yield* Fiber.join(stderrFiber).pipe(Effect.tapError((error) => Effect.logWarning("Could not finish reading run-host stderr", {
191
+ attemptId,
192
+ message: String(error),
193
+ })), Effect.ignore);
194
+ yield* Effect.logInfo("Run host exited", {
195
+ attemptId,
196
+ exitCode: String(exitCode),
197
+ });
198
+ const ended = yield* Ref.get(terminal);
199
+ const errorOutput = scrub((yield* Ref.get(stderr)).trim());
200
+ if (Option.isNone(ended)) {
201
+ return yield* infrastructureFailure("The run-host channel closed without a final envelope", new Error(`run host exited with code ${String(exitCode)}: ${errorOutput}`));
202
+ }
203
+ if (ended.value._tag === "Failed")
204
+ return yield* ended.value.failure;
205
+ if (ended.value._tag === "Interrupted") {
206
+ return yield* new AttemptFailure.AgentFailure({
207
+ message: "The run host confirmed the interrupt and stopped",
208
+ });
209
+ }
210
+ if (Number(exitCode) !== 0) {
211
+ return yield* infrastructureFailure(`The run host exited with code ${String(exitCode)} after its final envelope`, new Error(errorOutput));
212
+ }
213
+ return ended.value.result;
214
+ }).pipe(Effect.onInterrupt(() => cancel(attemptId).pipe(Effect.tapError((error) => Effect.logWarning("Cancel-on-interrupt failed", {
215
+ attemptId,
216
+ message: String(error),
217
+ })), Effect.ignore))));
218
+ return yield* execute.pipe(Effect.ensuring(Ref.update(activeAttempts, (current) => {
219
+ const next = new Map(current);
220
+ next.delete(attemptId);
221
+ return next;
222
+ })), Effect.mapError((error) => Schema.is(AttemptFailure.AttemptFailure)(error)
223
+ ? error
224
+ : infrastructureFailure("The executor failed while running the run host", error)));
225
+ });
226
+ return { cancel, launch };
227
+ });
228
+ //# sourceMappingURL=run-host-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-host-session.js","sourceRoot":"","sources":["../src/run-host-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAClF,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,EAAwB,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAyCjF,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,kFAAkF;AAClF,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAE,EAAE,CAC9C,MAAM,CAAC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CAAC,CAAC,CACH,EACD,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,MAAM,CAAC,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC;YAC7C,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,qBAAqB,CAAC,gDAAgD,EAAE,KAAK,CAAC,CACnF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAA2B,CAAC;AACrD,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,54 @@
1
1
  {
2
2
  "name": "@usine/executor",
3
- "version": "0.0.0",
4
- "description": "Name reservation for the usine blocks; real releases start at 0.0.1.",
3
+ "version": "0.1.0",
4
+ "description": "The usine five-operation Worker contract with local and exe.dev adapters.",
5
5
  "license": "MIT",
6
- "repository": { "type": "git", "url": "git+https://github.com/basaltbytes/usine.git" }
7
- }
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/basaltbytes/usine.git",
9
+ "directory": "packages/executor"
10
+ },
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "type": "module",
15
+ "sideEffects": false,
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "./local": {
22
+ "types": "./dist/local/index.d.ts",
23
+ "default": "./dist/local/index.js"
24
+ },
25
+ "./exe-dev": {
26
+ "types": "./dist/exe-dev/index.d.ts",
27
+ "default": "./dist/exe-dev/index.js"
28
+ }
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "dependencies": {
34
+ "@usine/core": "0.1.0"
35
+ },
36
+ "devDependencies": {
37
+ "@effect/vitest": "4.0.0-rc.111",
38
+ "effect": "4.0.0-rc.111",
39
+ "typescript": "7.0.2",
40
+ "vitest": "4.1.11",
41
+ "@usine/tsconfig": "0.0.0"
42
+ },
43
+ "peerDependencies": {
44
+ "effect": "4.0.0-rc.111"
45
+ },
46
+ "engines": {
47
+ "node": ">=22"
48
+ },
49
+ "scripts": {
50
+ "build": "tsc -b",
51
+ "check": "tsc -p tsconfig.check.json",
52
+ "test": "vitest run"
53
+ }
54
+ }