@usine/executor 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 -128
  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 +140 -41
  38. package/dist/executor.d.ts.map +1 -1
  39. package/dist/executor.js +90 -19
  40. package/dist/executor.js.map +1 -1
  41. package/dist/guard.d.ts +57 -7
  42. package/dist/guard.d.ts.map +1 -1
  43. package/dist/guard.js +273 -59
  44. package/dist/guard.js.map +1 -1
  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 +163 -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 -31
  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 -12
  159. package/dist/exe-dev/channel.d.ts.map +0 -1
  160. package/dist/exe-dev/channel.js +0 -42
  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 -27
  175. package/dist/run-host-session.d.ts.map +0 -1
  176. package/dist/run-host-session.js +0 -303
  177. package/dist/run-host-session.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/exe-dev/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,MAAM,EAAe,MAAM,QAAQ,CAAC;AAC7C,OAAO,EACL,sBAAsB,EAEtB,KAAK,cAAc,EACnB,qBAAqB,EAEtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAA4B,KAAK,qBAAqB,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAoBhG,eAAO,MAAM,YAAY;;;gBA2JvB,CAAC"}
1
+ {"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/exe-dev/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAe,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,sBAAsB,EAEtB,qBAAqB,EAEtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAY,KAAK,qBAAqB,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAkBhF,eAAO,MAAM,YAAY;;;0BASM,WAAW;oEAyHxC,CAAC"}
@@ -1,10 +1,11 @@
1
- import * as AttemptChannel from "@usine/core/attempt/channel";
2
- import { WorkerName } from "@usine/core/worker";
1
+ import { ClaudeLoginLock } from "@usine/agents/runtime";
2
+ import { SshDestination, WorkerName } from "@usine/core/worker";
3
3
  import { Effect, Ref, Schema } from "effect";
4
+ import { ChildProcessSpawner } from "effect/unstable/process";
4
5
  import { ExecutorOperationError, logPreflightFailure, WorkerCapabilityError, } from "../executor.js";
5
- import { verifyHarnesses } from "../harness-preflight.js";
6
- import { HomePath, SshDestination } from "./model.js";
7
- const MINIMUM_NODE_MAJOR = 22;
6
+ import { agentsHarnessProbe, verifyHarnessReadiness } from "../harness-preflight.js";
7
+ import { verifyLinuxMemory } from "../memory-preflight.js";
8
+ import { HomePath } from "./model.js";
8
9
  const Vm = Schema.Struct({
9
10
  vmName: Schema.NonEmptyString,
10
11
  sshDest: SshDestination,
@@ -14,45 +15,38 @@ const VmList = Schema.Struct({ vms: Schema.Array(Vm) });
14
15
  const decodeVmList = Schema.decodeUnknownEffect(Schema.fromJsonString(VmList));
15
16
  const decodeHome = Schema.decodeUnknownEffect(HomePath);
16
17
  const capabilityError = (worker, capability, message, cause) => new WorkerCapabilityError({ worker, capability, message, cause });
17
- export const preflightFor = Effect.fn("ExeDevExecutor.preflightFor")(function* (options, commands, runHost) {
18
+ export const preflightFor = Effect.fn("ExeDevExecutor.preflightFor")(function* (options, commands) {
19
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
20
+ const logins = yield* ClaudeLoginLock;
18
21
  const workers = yield* Ref.make(new Map());
22
+ /** Returns a harness probe that runs on the VM with no extra environment variables. */
23
+ const harnessProbe = (shell) => agentsHarnessProbe(spawner, shell, {});
19
24
  const resolveVm = Effect.fn("ExeDevExecutor.resolveVm")(function* (worker) {
20
25
  const response = yield* commands.lobbyJson("preflight", ["ls", worker]);
21
- const decoded = yield* decodeVmList(response).pipe(Effect.mapError((cause) => capabilityError(worker, "machine", `exe.dev returned invalid machine metadata for Worker ${worker}`, cause)));
26
+ const decoded = yield* decodeVmList(response).pipe(Effect.mapError((cause) => capabilityError(worker, "machine", `exe.dev returned invalid machine metadata for worker "${worker}"`, cause)));
22
27
  const vm = decoded.vms.find(({ vmName }) => vmName === worker);
23
28
  if (vm === undefined) {
24
- return yield* capabilityError(worker, "machine", `exe.dev has no VM named ${worker}`, new Error("worker VM missing"));
29
+ return yield* capabilityError(worker, "machine", `exe.dev has no VM named "${worker}"`, new Error("worker VM missing"));
25
30
  }
26
31
  if (vm.status !== "running") {
27
- return yield* capabilityError(worker, "machine", `exe.dev VM ${worker} is ${vm.status}, not running`, new Error(`VM status: ${vm.status}`));
32
+ return yield* capabilityError(worker, "machine", `exe.dev VM "${worker}" is ${vm.status}, not running`, new Error(`VM status: ${vm.status}`));
28
33
  }
29
34
  const reported = (yield* commands.remote("preflight", vm.sshDest, "printenv", ["HOME"])).trim();
30
- const home = yield* decodeHome(reported).pipe(Effect.mapError((cause) => capabilityError(worker, "toolchain", `exe.dev VM ${worker} returned an invalid home directory`, cause)));
35
+ const home = yield* decodeHome(reported).pipe(Effect.mapError((cause) => capabilityError(worker, "toolchain", `exe.dev VM "${worker}" returned an invalid home directory`, cause)));
31
36
  return { home, sshDest: vm.sshDest };
32
37
  });
33
38
  const asCapability = (worker, capability, message, effect) => effect.pipe(Effect.mapError((cause) => capabilityError(worker, capability, message, cause)));
34
- const preflight = Effect.fn("ExeDevExecutor.preflight")(function* (worker, brains) {
35
- const vm = yield* resolveVm(worker).pipe(Effect.catchTag("ExecutorOperationError", (cause) => capabilityError(worker, "machine", `Could not reach exe.dev Worker ${worker}`, cause)));
39
+ const preflight = Effect.fn("ExeDevExecutor.preflight")(function* (worker, brains, maxConcurrentAttempts) {
40
+ const vm = yield* resolveVm(worker).pipe(Effect.catchTag("ExecutorOperationError", (cause) => capabilityError(worker, "machine", `Can't reach exe.dev worker "${worker}"`, cause)));
36
41
  yield* Effect.annotateCurrentSpan({ worker, host: vm.sshDest });
37
- const gitVersion = (yield* asCapability(worker, "toolchain", `Worker ${worker} cannot run Git`, commands.remote("preflight", vm.sshDest, "git", ["--version"]))).trim();
42
+ const gitVersion = (yield* asCapability(worker, "toolchain", `Worker "${worker}" can't run Git`, commands.remote("preflight", vm.sshDest, "git", ["--version"]))).trim();
38
43
  if (!gitVersion.startsWith("git version ")) {
39
- return yield* capabilityError(worker, "toolchain", `Worker ${worker} returned an unrecognized Git version`, new Error(gitVersion));
44
+ return yield* capabilityError(worker, "toolchain", `Worker "${worker}" returned an unrecognized Git version`, new Error(gitVersion));
40
45
  }
41
- const nodeVersion = (yield* asCapability(worker, "toolchain", `Worker ${worker} cannot run Node.js`, commands.remote("preflight", vm.sshDest, "node", ["--version"]))).trim();
42
- const nodeMajor = Number(/^v(?<major>\d+)/u.exec(nodeVersion)?.groups?.major ?? Number.NaN);
43
- if (!Number.isSafeInteger(nodeMajor) || nodeMajor < MINIMUM_NODE_MAJOR) {
44
- return yield* capabilityError(worker, "toolchain", `Worker ${worker} has Node.js ${nodeVersion || "unknown"}; expected ${MINIMUM_NODE_MAJOR}+`, new Error("Node.js version mismatch"));
45
- }
46
- const protocol = (yield* asCapability(worker, "run-host", `Worker ${worker} cannot run ${runHost.command}`, commands.remote("preflight", vm.sshDest, runHost.command, [
47
- ...runHost.args,
48
- "--protocol-version",
49
- ]))).trim();
50
- if (protocol !== String(AttemptChannel.PROTOCOL_VERSION)) {
51
- return yield* capabilityError(worker, "run-host", `Worker ${worker} has run-host protocol ${protocol || "unknown"}; expected ${AttemptChannel.PROTOCOL_VERSION}`, new Error("run-host protocol mismatch"));
52
- }
53
- yield* verifyHarnesses(worker, brains, runHost, (command, args) => commands.remote("preflight", vm.sshDest, command, args));
46
+ yield* verifyLinuxMemory(worker, maxConcurrentAttempts, commands.remote("preflight", vm.sshDest, "cat", ["/proc/meminfo"]));
47
+ yield* verifyHarnessReadiness(worker, brains, harnessProbe(commands.childHost(vm.sshDest)), logins);
54
48
  for (const integration of options.githubIntegrations) {
55
- yield* asCapability(worker, "credentials", `exe.dev GitHub integration ${integration.name} is not ready for ${integration.repository}`, commands.lobby("preflight", ["integrations", "test", integration.name]));
49
+ yield* asCapability(worker, "credentials", `exe.dev GitHub integration "${integration.name}" isn't ready for ${integration.repository}`, commands.lobby("preflight", ["integrations", "test", integration.name]));
56
50
  }
57
51
  yield* Ref.update(workers, (current) => {
58
52
  const next = new Map(current);
@@ -63,20 +57,16 @@ export const preflightFor = Effect.fn("ExeDevExecutor.preflightFor")(function* (
63
57
  worker,
64
58
  host: vm.sshDest,
65
59
  gitVersion,
66
- nodeVersion,
67
- protocolVersion: AttemptChannel.PROTOCOL_VERSION,
68
60
  harnesses: [...new Set(brains.map(({ harness }) => harness))].join(","),
69
61
  integrations: options.githubIntegrations.length,
70
62
  });
71
63
  }, logPreflightFailure);
72
- // Both resolveVm failures are members of the ExecutorError union prepare
73
- // reports, so a stopped VM keeps its typed capability shape.
74
64
  const vmFor = Effect.fn("ExeDevExecutor.vmFor")(function* (worker) {
75
65
  const cached = (yield* Ref.get(workers)).get(worker);
76
66
  if (cached !== undefined)
77
67
  return cached;
78
68
  return yield* resolveVm(worker);
79
69
  });
80
- return { preflight, vmFor };
70
+ return { preflight, vmFor, harnessProbe };
81
71
  });
82
72
  //# sourceMappingURL=preflight.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/exe-dev/preflight.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC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CAAC,CAAC;QACH,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,mCAAmC,EAAE;YACzD,MAAM;YACN,IAAI,EAAE,EAAE,CAAC,OAAO;YAChB,UAAU;YACV,SAAS,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACvE,YAAY,EAAE,OAAO,CAAC,kBAAkB,CAAC,MAAM;SAChD,CAAC,CAAC;IACL,CAAC,EAAE,mBAAmB,CAAC,CAAC;IAExB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAkB;QAC3E,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrD,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC;QACxC,OAAO,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;AAC5C,CAAC,CAAC,CAAC"}
@@ -1,122 +1,221 @@
1
+ import type { AttemptRecovery, RecoverySink } from "@usine/core/attempt/salvage";
1
2
  import { Agent } from "@usine/core/agent";
2
3
  import { BrainSpec } from "@usine/core/agent/brain";
3
4
  import { AttemptId } from "@usine/core/attempt";
4
5
  import * as AttemptChannel from "@usine/core/attempt/channel";
5
6
  import { AttemptFailure } from "@usine/core/attempt/failure";
7
+ import { LoopPermissions } from "@usine/core/loop";
8
+ import { SalvagePushed } from "@usine/core/attempt/salvage";
6
9
  import { RepositoryName } from "@usine/core/repository";
7
10
  import { WorkerName, WorkerKind } from "@usine/core/worker";
8
11
  import { StepResult } from "@usine/core/step/result";
9
- import { Context, Effect, Redacted, Schema, Scope } from "effect";
10
- /** The Worker operation that failed during readiness checks or an Attempt's lifecycle. */
12
+ import { Context, Effect, Option, type Result, Schema, Scope } from "effect";
11
13
  export declare const ExecutorOperation: Schema.Literals<readonly ["preflight", "prepare", "launch", "cancel", "cleanup"]>;
12
14
  export type ExecutorOperation = typeof ExecutorOperation.Type;
13
- /** A prerequisite a Worker must satisfy before it can accept Attempts. */
14
- export declare const WorkerCapability: Schema.Literals<readonly ["machine", "toolchain", "run-host", "harness-login", "credentials"]>;
15
+ export declare const WorkerCapability: Schema.Literals<readonly ["machine", "toolchain", "memory", "harness-login", "credentials", "gateway"]>;
15
16
  export type WorkerCapability = typeof WorkerCapability.Type;
16
17
  declare const ExecutorOperationError_base: Schema.Class<ExecutorOperationError, Schema.TaggedStruct<"ExecutorOperationError", {
18
+ /** `cleanup` includes removing a checkout, its credential, or credentials left by an earlier process. */
17
19
  readonly operation: Schema.Literals<readonly ["preflight", "prepare", "launch", "cancel", "cleanup"]>;
20
+ /** An operator-facing summary without the Worker name. Not part of the contract; branch on `operation`. */
18
21
  readonly message: Schema.NonEmptyString;
22
+ /** The underlying failure, for example an `Error` with the command's stderr, or a timeout. */
19
23
  readonly cause: Schema.Defect;
20
24
  }>, import("effect/Cause").YieldableError>;
21
- /** A Worker operation failed before its requested work completed. */
22
25
  export declare class ExecutorOperationError extends ExecutorOperationError_base {
23
26
  }
27
+ /**
28
+ * `refused` if a retry gets the same result: the installation doesn't cover the repository,
29
+ * lacks a permission, or is suspended, or an exe.dev Worker has no integration for it.
30
+ * `unreachable` if a retry can succeed: a GitHub outage or rate limit, or no response from a
31
+ * Gateway or exe.dev command.
32
+ */
33
+ export declare const CredentialUnavailableReason: Schema.Literals<readonly ["refused", "unreachable"]>;
34
+ export type CredentialUnavailableReason = typeof CredentialUnavailableReason.Type;
24
35
  declare const CredentialUnavailableError_base: Schema.Class<CredentialUnavailableError, Schema.TaggedStruct<"CredentialUnavailableError", {
25
36
  readonly repository: Schema.brand<Schema.String, "RepositoryName">;
37
+ readonly reason: Schema.Literals<readonly ["refused", "unreachable"]>;
38
+ /** An operator-facing summary, including GitHub's reason for a refusal. */
26
39
  readonly message: Schema.NonEmptyString;
40
+ /** The underlying failure, for example the GitHub API error from minting the token. */
27
41
  readonly cause: Schema.Defect;
28
42
  }>, import("effect/Cause").YieldableError>;
29
- /** A Worker could not obtain access to the repository assigned to an Attempt. */
30
43
  export declare class CredentialUnavailableError extends CredentialUnavailableError_base {
31
44
  }
32
45
  declare const WorkerCapabilityError_base: Schema.Class<WorkerCapabilityError, Schema.TaggedStruct<"WorkerCapabilityError", {
33
46
  readonly worker: Schema.brand<Schema.String, "WorkerName">;
34
- readonly capability: Schema.Literals<readonly ["machine", "toolchain", "run-host", "harness-login", "credentials"]>;
47
+ /**
48
+ * - `machine`: the machine or VM is absent, stopped, or unreachable, or its Worker directory
49
+ * isn't writable.
50
+ * - `toolchain`: Git or a brain's harness doesn't run.
51
+ * - `memory`: less than 1.5 GiB per concurrent Attempt, no swap for more than one, or memory
52
+ * not reported.
53
+ * - `harness-login`: a brain's harness isn't logged in.
54
+ * - `credentials`: an exe.dev integration isn't ready, or the Worker kind can't issue a
55
+ * read-only credential for a `permissions: read` Loop.
56
+ * - `gateway`: the Gateway doesn't respond or isn't reachable from the machine.
57
+ */
58
+ readonly capability: Schema.Literals<readonly ["machine", "toolchain", "memory", "harness-login", "credentials", "gateway"]>;
35
59
  readonly message: Schema.NonEmptyString;
60
+ /** The observed value, for example unrecognized `git --version` output or the harness readiness report. */
36
61
  readonly cause: Schema.Defect;
37
62
  }>, import("effect/Cause").YieldableError>;
38
- /** A verify-only preflight found a Worker capability missing or incompatible. */
63
+ /** The error when preflight finds a Worker capability missing or incompatible. */
39
64
  export declare class WorkerCapabilityError extends WorkerCapabilityError_base {
40
65
  }
41
- /** A readiness, access, or lifecycle failure reported by a Worker operation. */
42
66
  export declare const ExecutorError: Schema.Union<readonly [typeof ExecutorOperationError, typeof CredentialUnavailableError, typeof WorkerCapabilityError]>;
43
67
  export type ExecutorError = typeof ExecutorError.Type;
44
- /** Logs every preflight refusal so a missing capability is explainable from logs alone. */
68
+ /** Logs each preflight failure at error level. */
45
69
  export declare const logPreflightFailure: <A, R>(effect: Effect.Effect<A, ExecutorError, R>) => Effect.Effect<A, ExecutorError, R>;
46
- /** Process command for a one-shot run host or a preflight capability probe. */
47
- export interface RunHostCommand {
48
- readonly command: string;
49
- readonly args: ReadonlyArray<string>;
50
- }
51
70
  declare const CheckoutRequest_base: Schema.Class<CheckoutRequest, Schema.Struct<{
71
+ /** The checkout directory name, and the key for `cancel`, `intervene`, `isLive`, and `outcome`. */
52
72
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
53
73
  readonly worker: Schema.brand<Schema.String, "WorkerName">;
74
+ /** The only repository the Attempt's credential can access (ADR 0011). */
54
75
  readonly repository: Schema.brand<Schema.String, "RepositoryName">;
76
+ /** The Loop of the Attempt's Run, shown in a `read` checkout's pre-push hook message. */
77
+ readonly loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
78
+ /**
79
+ * The Attempt's access to `repository` (ADR 0011). With `read`, the credential can't push, a
80
+ * pre-push hook explains rejected pushes, and an unsuccessful Attempt's checkout is removed
81
+ * without salvage. A Worker kind that can't issue such a credential fails `prepare` with a
82
+ * `credentials` capability error.
83
+ */
84
+ readonly permissions: Schema.Literals<readonly ["write", "read"]>;
85
+ /** The revision to fetch, resolved to a commit during preparation and stored as the RunSpec's `baseCommit`. */
55
86
  readonly revision: Schema.brand<Schema.String, "RepositoryRevision">;
87
+ /** The payload of the event that triggered the Run, included as JSON in the parent's prompt. */
56
88
  readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
89
+ /** The parent's task text, after Loop interpolation or operator amendment. */
57
90
  readonly task: Schema.brand<Schema.String, "AttemptTask">;
91
+ /**
92
+ * The Agent whose persona and name go in the parent's prompt and whose brain runs the
93
+ * children. Preparation verifies the brain on the Worker.
94
+ */
58
95
  readonly agent: typeof Agent;
96
+ /**
97
+ * The Pi parent's model. If `None`, uses the configured default model, then the first model
98
+ * with a credential. A model unknown to Pi fails the launch.
99
+ */
59
100
  readonly parentModel: Schema.Option<Schema.brand<Schema.String, "ModelId">>;
101
+ /** The maximum child sessions per Attempt. One more fails the Attempt with `ChildSessionBudgetFailure`. */
60
102
  readonly maxChildren: Schema.brand<Schema.Int, "ChildSessionBudget">;
61
- /** Maximum minutes of live run-host execution; preparation and resource cleanup are outside this budget. */
62
- readonly maxAttemptMinutes: Schema.Int;
63
- /** Maximum reported tokens across the parent and every child; operator Holds never pause this ceiling. */
64
- readonly maxAttemptTokens: Schema.Int;
103
+ /** The maximum minutes of Attempt execution, excluding preparation and cleanup, or `None` for no limit. */
104
+ readonly maxAttemptMinutes: Schema.Option<Schema.Int>;
105
+ /** The maximum tokens consumed by the parent and all children, or `None` for no limit. Holds don't pause it. */
106
+ readonly maxAttemptTokens: Schema.Option<Schema.Int>;
107
+ /** The Pi parent's reasoning effort. The launch fails if the model doesn't support it. */
65
108
  readonly parentEffort: Schema.Literals<readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"]>;
109
+ /** The ref that unfinished work is pushed to if the Attempt doesn't succeed. */
110
+ readonly salvageRef: Schema.brand<Schema.NonEmptyString, "SalvageRef">;
111
+ /** The previous Attempt's pushed salvage, checked out instead of `revision`. */
112
+ readonly resume: Schema.Option<typeof SalvagePushed>;
113
+ /**
114
+ * Whether the parent task is still live after an orchestrator restart. If true, preparation
115
+ * reuses the existing checkout and launch reattaches to the parent.
116
+ */
117
+ readonly reattach: Schema.withConstructorDefault<Schema.Boolean>;
118
+ /**
119
+ * The GitHub login the Attempt writes as, copied into the RunSpec; harvesting collects comments
120
+ * by this author. If `None`, harvesting asks GitHub for the credential's login.
121
+ */
122
+ readonly botLogin: Schema.withConstructorDefault<Schema.Option<Schema.brand<Schema.String, "BotLogin">>>;
66
123
  }>, {}>;
67
- /** The repository, revision, and Agent task assigned to a Worker for one fresh Attempt checkout. */
68
124
  export declare class CheckoutRequest extends CheckoutRequest_base {
69
125
  }
70
- /** One Attempt's disposable checkout directory. */
71
126
  export declare const WorktreePath: Schema.brand<Schema.NonEmptyString, "WorktreePath">;
72
127
  export type WorktreePath = typeof WorktreePath.Type;
73
128
  declare const AttemptWorkspace_base: Schema.Class<AttemptWorkspace, Schema.Struct<{
74
129
  readonly worker: Schema.brand<Schema.String, "WorkerName">;
130
+ /** The request's fields plus the commit that `revision` resolved to. */
75
131
  readonly spec: typeof AttemptChannel.RunSpec;
132
+ /** The checkout path on the Worker's machine, where the children run. */
76
133
  readonly worktree: Schema.brand<Schema.NonEmptyString, "WorktreePath">;
77
134
  }>, {}>;
78
- /** The serializable location and RunSpec of an Attempt checkout. Owning this record does not grant access to live resources or credentials. */
135
+ /** A serializable checkout location and RunSpec, without credentials or live resources. */
79
136
  export declare class AttemptWorkspace extends AttemptWorkspace_base {
80
137
  }
81
138
  /**
82
- * One prepared Attempt with a scoped checkout and repository access. Use it within
83
- * the scope that prepared it. Closing that scope stops any active run host before
84
- * removing the checkout and releasing credentials, including when launch never starts.
139
+ * An Attempt prepared in the caller's scope and valid only within it. Closing that scope stops
140
+ * any active session, removes the checkout, and releases credentials, whether or not `launch`
141
+ * ran.
85
142
  */
86
143
  export interface PreparedAttempt {
87
- /** Checkout metadata suitable for inspection or serialization; contains no credentials. */
88
144
  readonly workspace: AttemptWorkspace;
89
145
  /**
90
- * Runs this Attempt once, recording channel activity through `io`. Completion,
91
- * failure, or interruption releases its resources before returning. Cleanup
92
- * failures are logged without replacing the agent's outcome or retrying its work.
93
- * Reusing an Attempt after launch or release fails with an infrastructure error.
146
+ * Runs the Attempt once, writing channel activity to `io`, and releases its resources before
147
+ * returning. Cleanup failures are logged without changing the result. Fails with an
148
+ * infrastructure `AttemptFailure` if called again or after release.
94
149
  */
95
150
  readonly launch: (io: AttemptChannel.Sink) => Effect.Effect<StepResult, AttemptFailure>;
96
151
  }
152
+ declare const WorkerCredential_base: Schema.Class<WorkerCredential, Schema.Struct<{
153
+ /**
154
+ * The token for git and gh, never written inside the checkout. Wiped when the Attempt's scope
155
+ * closes; `Redacted.value` then throws.
156
+ */
157
+ readonly value: Schema.Redacted<Schema.String>;
158
+ /** A new credential is requested when five minutes or less remain. */
159
+ readonly expiresAt: Schema.DateTimeUtc;
160
+ }>, {}>;
161
+ export declare class WorkerCredential extends WorkerCredential_base {
162
+ }
97
163
  declare const CredentialProvider_base: Context.ServiceClass<CredentialProvider, "@usine/executor/CredentialProvider", {
98
- readonly issue: (repository: RepositoryName, attemptId: AttemptId) => Effect.Effect<Redacted.Redacted<string>, CredentialUnavailableError>;
164
+ /**
165
+ * Returns a credential for `repository` only, with `permissions` (`read` can't push). The local
166
+ * and SSH executors call it during `prepare` and again before each expiry until the Attempt's
167
+ * resources are released; a failed renewal is logged and retried after 30 seconds.
168
+ */
169
+ readonly issue: (repository: RepositoryName, attemptId: AttemptId, permissions: LoopPermissions) => Effect.Effect<WorkerCredential, CredentialUnavailableError>;
99
170
  }>;
100
- /** Mints exactly one repository-scoped credential for each prepared Attempt. */
101
171
  export declare class CredentialProvider extends CredentialProvider_base {
102
172
  }
103
173
  declare const Executor_base: Context.ServiceClass<Executor, "@usine/executor/Executor", {
174
+ /**
175
+ * Reconciles the checkout of an Attempt that no Run reattaches, recording its salvage before
176
+ * releasing any work, even if `isLive` returns true. First stops the parent task if durable
177
+ * storage marks it live; if the task can't be confirmed stopped, fails with a `cancel`
178
+ * `ExecutorOperationError` and leaves the checkout. For an open Attempt whose parent task
179
+ * failed before the orchestrator stopped, first records the comments it posted on the Run's
180
+ * Item.
181
+ */
182
+ readonly recover: <E>(attempt: AttemptRecovery, record: RecoverySink<E>) => Effect.Effect<void, E | ExecutorError>;
183
+ /** The orchestrator doesn't start if a configured Worker has a different kind. */
104
184
  readonly kind: WorkerKind;
105
- /** Verifies Git, the run host, and each rostered brain in the Worker environment; never installs tools or logs in. */
106
- readonly preflight: (worker: WorkerName, brains: ReadonlyArray<BrainSpec>) => Effect.Effect<void, ExecutorError>;
107
185
  /**
108
- * Verifies the assigned brain before acquiring a fresh Attempt in the caller's scope. Clone, fetch, and lock waits
109
- * remain interruptible; partial preparation releases everything already acquired
110
- * before reporting failure. Each request must identify a fresh Attempt.
186
+ * Returns whether the parent task is still running, or reported success before its checkout
187
+ * was harvested. If true, the orchestrator reattaches after a restart.
188
+ */
189
+ readonly isLive: (attemptId: AttemptId) => Effect.Effect<boolean, AttemptFailure>;
190
+ /**
191
+ * Returns the result a finished parent task stored before an orchestrator restart: the
192
+ * harvested result or the parent's failure. Returns `None` if nothing is stored or `isLive` is
193
+ * true.
194
+ */
195
+ readonly outcome: (attemptId: AttemptId) => Effect.Effect<Option.Option<Result.Result<StepResult, AttemptFailure>>, AttemptFailure>;
196
+ /**
197
+ * Verifies Git, enough memory for `maxConcurrentAttempts` concurrent Attempts, and each brain
198
+ * in `brains`. Never installs tools or logs in.
199
+ */
200
+ readonly preflight: (worker: WorkerName, brains: ReadonlyArray<BrainSpec>, maxConcurrentAttempts: number) => Effect.Effect<void, ExecutorError>;
201
+ /**
202
+ * Verifies the Agent's brain, then acquires the checkout and credential in the caller's scope.
203
+ * Clone, fetch, and lock waits are interruptible; on failure, releases everything acquired so
204
+ * far. `attemptId` must be new unless `reattach` is set.
111
205
  */
112
206
  readonly prepare: (request: CheckoutRequest) => Effect.Effect<PreparedAttempt, ExecutorError, Scope.Scope>;
113
- /** Requests an active Attempt to stop, allowing a grace period before forcing termination. */
207
+ /**
208
+ * Stops preparation and releases partial resources, or cancels the live parent task with a
209
+ * grace period before forced termination, including one not reattached after a restart. Fails
210
+ * if the parent task can't be confirmed stopped. A canceled Attempt can't launch; after
211
+ * release, does nothing.
212
+ */
114
213
  readonly cancel: (attemptId: AttemptId) => Effect.Effect<void, ExecutorError>;
115
- /** Delivers an attributed operator action through the active Attempt's channel. */
214
+ /** Sends an operator intervention to the Attempt's live session. */
116
215
  readonly intervene: (attemptId: AttemptId, intervention: AttemptChannel.Intervention) => Effect.Effect<void, AttemptFailure>;
117
216
  }>;
118
- /** Prepares isolated checkouts, runs Attempts on a Worker, and releases their resources (ADR 0006). */
217
+ /** The service that prepares checkouts, runs Attempts on a Worker, and releases their resources (ADR 0006). */
119
218
  export declare class Executor extends Executor_base {
120
219
  }
121
- export {};
220
+ export { claudeLoginLockLayer } from "./claude-login-lock.ts";
122
221
  //# sourceMappingURL=executor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAmB,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAe,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAsB,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAElE,0FAA0F;AAC1F,eAAO,MAAM,iBAAiB,mFAM5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAE9D,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,gGAM3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAC;;;;;;AAE5D,qEAAqE;AACrE,qBAAa,sBAAuB,SAAQ,2BAM1C;CAAG;;;;;;AAEL,iFAA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c,CAAC;IACjF;;;;OAIG;sBACe,CAChB,SAAS,EAAE,SAAS,KACjB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,cAAc,CAAC;IAC5F;;;OAGG;wBACiB,CAClB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,EAChC,qBAAqB,EAAE,MAAM,KAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC;IACvC;;;;OAIG;sBACe,CAChB,OAAO,EAAE,eAAe,KACrB,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC;IAC/D;;;;;OAKG;qBACc,CAAC,SAAS,EAAE,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7E,oEAAoE;wBAChD,CAClB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,cAAc,CAAC,YAAY,KACtC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC;;AA3D5C,+GAA+G;AAC/G,qBAAa,QAAS,SAAQ,aA4DC;CAAG;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/executor.js CHANGED
@@ -4,11 +4,12 @@ import { ChildSessionBudget } from "@usine/core/agent/session";
4
4
  import { AttemptTask, AttemptId } from "@usine/core/attempt";
5
5
  import * as AttemptChannel from "@usine/core/attempt/channel";
6
6
  import { AttemptFailure } from "@usine/core/attempt/failure";
7
+ import { LoopName, LoopPermissions } from "@usine/core/loop";
8
+ import { SalvagePushed, SalvageRef } from "@usine/core/attempt/salvage";
7
9
  import { RepositoryName, RepositoryRevision } from "@usine/core/repository";
8
- import { WorkerName, WorkerKind } from "@usine/core/worker";
10
+ import { BotLogin, WorkerName, WorkerKind } from "@usine/core/worker";
9
11
  import { StepResult } from "@usine/core/step/result";
10
- import { Context, Effect, Redacted, Schema, Scope } from "effect";
11
- /** The Worker operation that failed during readiness checks or an Attempt's lifecycle. */
12
+ import { Context, Effect, Option, Schema, Scope } from "effect";
12
13
  export const ExecutorOperation = Schema.Literals([
13
14
  "preflight",
14
15
  "prepare",
@@ -16,43 +17,65 @@ export const ExecutorOperation = Schema.Literals([
16
17
  "cancel",
17
18
  "cleanup",
18
19
  ]);
19
- /** A prerequisite a Worker must satisfy before it can accept Attempts. */
20
20
  export const WorkerCapability = Schema.Literals([
21
21
  "machine",
22
22
  "toolchain",
23
- "run-host",
23
+ "memory",
24
24
  "harness-login",
25
25
  "credentials",
26
+ "gateway",
26
27
  ]);
27
- /** A Worker operation failed before its requested work completed. */
28
28
  export class ExecutorOperationError extends Schema.TaggedError("@usine/executor/ExecutorOperationError")("ExecutorOperationError", {
29
+ /** `cleanup` includes removing a checkout, its credential, or credentials left by an earlier process. */
29
30
  operation: ExecutorOperation,
31
+ /** An operator-facing summary without the Worker name. Not part of the contract; branch on `operation`. */
30
32
  message: Schema.NonEmptyString,
33
+ /** The underlying failure, for example an `Error` with the command's stderr, or a timeout. */
31
34
  cause: Schema.Defect(),
32
35
  }) {
33
36
  }
34
- /** A Worker could not obtain access to the repository assigned to an Attempt. */
37
+ /**
38
+ * `refused` if a retry gets the same result: the installation doesn't cover the repository,
39
+ * lacks a permission, or is suspended, or an exe.dev Worker has no integration for it.
40
+ * `unreachable` if a retry can succeed: a GitHub outage or rate limit, or no response from a
41
+ * Gateway or exe.dev command.
42
+ */
43
+ export const CredentialUnavailableReason = Schema.Literals(["refused", "unreachable"]);
35
44
  export class CredentialUnavailableError extends Schema.TaggedError("@usine/executor/CredentialUnavailableError")("CredentialUnavailableError", {
36
45
  repository: RepositoryName,
46
+ reason: CredentialUnavailableReason,
47
+ /** An operator-facing summary, including GitHub's reason for a refusal. */
37
48
  message: Schema.NonEmptyString,
49
+ /** The underlying failure, for example the GitHub API error from minting the token. */
38
50
  cause: Schema.Defect(),
39
51
  }) {
40
52
  }
41
- /** A verify-only preflight found a Worker capability missing or incompatible. */
53
+ /** The error when preflight finds a Worker capability missing or incompatible. */
42
54
  export class WorkerCapabilityError extends Schema.TaggedError("@usine/executor/WorkerCapabilityError")("WorkerCapabilityError", {
43
55
  worker: WorkerName,
56
+ /**
57
+ * - `machine`: the machine or VM is absent, stopped, or unreachable, or its Worker directory
58
+ * isn't writable.
59
+ * - `toolchain`: Git or a brain's harness doesn't run.
60
+ * - `memory`: less than 1.5 GiB per concurrent Attempt, no swap for more than one, or memory
61
+ * not reported.
62
+ * - `harness-login`: a brain's harness isn't logged in.
63
+ * - `credentials`: an exe.dev integration isn't ready, or the Worker kind can't issue a
64
+ * read-only credential for a `permissions: read` Loop.
65
+ * - `gateway`: the Gateway doesn't respond or isn't reachable from the machine.
66
+ */
44
67
  capability: WorkerCapability,
45
68
  message: Schema.NonEmptyString,
69
+ /** The observed value, for example unrecognized `git --version` output or the harness readiness report. */
46
70
  cause: Schema.Defect(),
47
71
  }) {
48
72
  }
49
- /** A readiness, access, or lifecycle failure reported by a Worker operation. */
50
73
  export const ExecutorError = Schema.Union([
51
74
  ExecutorOperationError,
52
75
  CredentialUnavailableError,
53
76
  WorkerCapabilityError,
54
77
  ]);
55
- /** Logs every preflight refusal so a missing capability is explainable from logs alone. */
78
+ /** Logs each preflight failure at error level. */
56
79
  export const logPreflightFailure = (effect) => Effect.tapError(effect, (error) => error instanceof WorkerCapabilityError
57
80
  ? Effect.logError("Worker preflight failed", {
58
81
  error: error._tag,
@@ -64,37 +87,85 @@ export const logPreflightFailure = (effect) => Effect.tapError(effect, (error) =
64
87
  error: error._tag,
65
88
  message: error.message,
66
89
  }));
67
- /** The repository, revision, and Agent task assigned to a Worker for one fresh Attempt checkout. */
68
90
  export class CheckoutRequest extends Schema.Class("@usine/executor/CheckoutRequest")({
91
+ /** The checkout directory name, and the key for `cancel`, `intervene`, `isLive`, and `outcome`. */
69
92
  attemptId: AttemptId,
70
93
  worker: WorkerName,
94
+ /** The only repository the Attempt's credential can access (ADR 0011). */
71
95
  repository: RepositoryName,
96
+ /** The Loop of the Attempt's Run, shown in a `read` checkout's pre-push hook message. */
97
+ loop: LoopName,
98
+ /**
99
+ * The Attempt's access to `repository` (ADR 0011). With `read`, the credential can't push, a
100
+ * pre-push hook explains rejected pushes, and an unsuccessful Attempt's checkout is removed
101
+ * without salvage. A Worker kind that can't issue such a credential fails `prepare` with a
102
+ * `credentials` capability error.
103
+ */
104
+ permissions: LoopPermissions,
105
+ /** The revision to fetch, resolved to a commit during preparation and stored as the RunSpec's `baseCommit`. */
72
106
  revision: RepositoryRevision,
107
+ /** The payload of the event that triggered the Run, included as JSON in the parent's prompt. */
73
108
  payload: Schema.Json,
109
+ /** The parent's task text, after Loop interpolation or operator amendment. */
74
110
  task: AttemptTask,
111
+ /**
112
+ * The Agent whose persona and name go in the parent's prompt and whose brain runs the
113
+ * children. Preparation verifies the brain on the Worker.
114
+ */
75
115
  agent: Agent,
116
+ /**
117
+ * The Pi parent's model. If `None`, uses the configured default model, then the first model
118
+ * with a credential. A model unknown to Pi fails the launch.
119
+ */
76
120
  parentModel: Schema.Option(ModelId),
121
+ /** The maximum child sessions per Attempt. One more fails the Attempt with `ChildSessionBudgetFailure`. */
77
122
  maxChildren: ChildSessionBudget,
78
- /** Maximum minutes of live run-host execution; preparation and resource cleanup are outside this budget. */
79
- maxAttemptMinutes: Schema.Int.check(Schema.isGreaterThan(0)),
80
- /** Maximum reported tokens across the parent and every child; operator Holds never pause this ceiling. */
81
- maxAttemptTokens: Schema.Int.check(Schema.isGreaterThan(0)),
123
+ /** The maximum minutes of Attempt execution, excluding preparation and cleanup, or `None` for no limit. */
124
+ maxAttemptMinutes: Schema.Option(Schema.Int.check(Schema.isGreaterThan(0))),
125
+ /** The maximum tokens consumed by the parent and all children, or `None` for no limit. Holds don't pause it. */
126
+ maxAttemptTokens: Schema.Option(Schema.Int.check(Schema.isGreaterThan(0))),
127
+ /** The Pi parent's reasoning effort. The launch fails if the model doesn't support it. */
82
128
  parentEffort: Effort,
129
+ /** The ref that unfinished work is pushed to if the Attempt doesn't succeed. */
130
+ salvageRef: SalvageRef,
131
+ /** The previous Attempt's pushed salvage, checked out instead of `revision`. */
132
+ resume: Schema.Option(SalvagePushed),
133
+ /**
134
+ * Whether the parent task is still live after an orchestrator restart. If true, preparation
135
+ * reuses the existing checkout and launch reattaches to the parent.
136
+ */
137
+ reattach: Schema.Boolean.pipe(Schema.withConstructorDefault(Effect.succeed(false))),
138
+ /**
139
+ * The GitHub login the Attempt writes as, copied into the RunSpec; harvesting collects comments
140
+ * by this author. If `None`, harvesting asks GitHub for the credential's login.
141
+ */
142
+ botLogin: Schema.Option(BotLogin).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
83
143
  }) {
84
144
  }
85
- /** One Attempt's disposable checkout directory. */
86
145
  export const WorktreePath = Schema.NonEmptyString.pipe(Schema.brand("WorktreePath"));
87
- /** The serializable location and RunSpec of an Attempt checkout. Owning this record does not grant access to live resources or credentials. */
146
+ /** A serializable checkout location and RunSpec, without credentials or live resources. */
88
147
  export class AttemptWorkspace extends Schema.Class("@usine/executor/AttemptWorkspace")({
89
148
  worker: WorkerName,
149
+ /** The request's fields plus the commit that `revision` resolved to. */
90
150
  spec: AttemptChannel.RunSpec,
151
+ /** The checkout path on the Worker's machine, where the children run. */
91
152
  worktree: WorktreePath,
92
153
  }) {
93
154
  }
94
- /** Mints exactly one repository-scoped credential for each prepared Attempt. */
155
+ export class WorkerCredential extends Schema.Class("@usine/executor/WorkerCredential")({
156
+ /**
157
+ * The token for git and gh, never written inside the checkout. Wiped when the Attempt's scope
158
+ * closes; `Redacted.value` then throws.
159
+ */
160
+ value: Schema.Redacted(Schema.String),
161
+ /** A new credential is requested when five minutes or less remain. */
162
+ expiresAt: Schema.DateTimeUtc,
163
+ }) {
164
+ }
95
165
  export class CredentialProvider extends Context.Service()("@usine/executor/CredentialProvider") {
96
166
  }
97
- /** Prepares isolated checkouts, runs Attempts on a Worker, and releases their resources (ADR 0006). */
167
+ /** The service that prepares checkouts, runs Attempts on a Worker, and releases their resources (ADR 0006). */
98
168
  export class Executor extends Context.Service()("@usine/executor/Executor") {
99
169
  }
170
+ export { claudeLoginLockLayer } from "./claude-login-lock.js";
100
171
  //# sourceMappingURL=executor.js.map