@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,66 +1,20 @@
1
1
  import { Effect } from "effect";
2
- import { ChildProcessSpawner } from "effect/unstable/process";
3
- import { allowlistedEnvironment, collectCommand, requireSuccess, } from "../child-command.js";
4
- import { shellCommand } from "./shell.js";
5
- /**
6
- * The local SSH client inherits only what SSH itself needs; GitHub and factory
7
- * credentials from the orchestrator environment never reach it or the VM.
8
- */
9
- const SSH_ENVIRONMENT_ALLOWLIST = [
10
- "HOME",
11
- "LANG",
12
- "LC_ALL",
13
- "PATH",
14
- "SHELL",
15
- "SSH_AGENT_PID",
16
- "SSH_AUTH_SOCK",
17
- "TMPDIR",
18
- "USER",
19
- ];
2
+ import { DEFAULT_SSH, remoteCommandsFor, } from "../remote/commands.js";
20
3
  export const commandsFor = Effect.fn("ExeDevExecutor.commandsFor")(function* (configuredSsh) {
21
- const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
22
- const environment = yield* allowlistedEnvironment(SSH_ENVIRONMENT_ALLOWLIST);
23
- const ssh = configuredSsh ?? {
24
- command: "ssh",
25
- // The keepalive pair turns a dead TCP link into a non-zero SSH exit instead
26
- // of a silent park, so a lost VM fails the operation.
27
- args: ["-o", "BatchMode=yes", "-o", "ServerAliveInterval=30", "-o", "ServerAliveCountMax=4"],
28
- };
29
- const executeRaw = Effect.fn("ExeDevExecutor.executeRaw")(function* (operation, host, command, args) {
30
- yield* Effect.annotateCurrentSpan({ host, operation });
31
- return yield* collectCommand(spawner, operation, command, args, {
32
- env: environment,
33
- extendEnv: false,
34
- });
35
- });
36
- const executeChecked = Effect.fn("ExeDevExecutor.executeChecked")(function* (operation, host, command, args) {
37
- const result = yield* executeRaw(operation, host, command, args);
38
- return yield* requireSuccess(operation, host, command, args, result);
39
- });
40
- // Lobby arguments pass unquoted through OpenSSH's argv join, so every value
41
- // must be a brand-validated token (WorkerName, IntegrationName,
42
- // CredentialGrantMinutes), never free-form text.
43
- const lobby = (operation, args) => executeChecked(operation, "exe.dev", ssh.command, [...ssh.args, "exe.dev", ...args]);
4
+ const shared = yield* remoteCommandsFor;
5
+ const ssh = configuredSsh ?? DEFAULT_SSH;
6
+ const childHost = (sshDest) => shared.shellFor(ssh, sshDest);
7
+ // OpenSSH joins lobby arguments without quoting, so each value must be a brand-validated
8
+ // token (WorkerName, IntegrationName, CredentialGrantMinutes), never free-form text.
9
+ const lobby = (operation, args) => shared.local(operation, "exe.dev", ssh.command, [...ssh.args, "exe.dev", ...args]);
44
10
  const lobbyJson = (operation, args) => lobby(operation, [...args, "--json"]);
45
- const remoteRaw = (operation, sshDest, command, args) => executeRaw(operation, sshDest, ssh.command, [
46
- ...ssh.args,
47
- sshDest,
48
- "--",
49
- shellCommand(command, args),
50
- ]);
51
- const remote = (operation, sshDest, command, args) => executeChecked(operation, sshDest, ssh.command, [
52
- ...ssh.args,
53
- sshDest,
54
- "--",
55
- shellCommand(command, args),
56
- ]);
57
11
  return {
58
- environment,
12
+ shared,
13
+ childHost,
59
14
  lobby,
60
15
  lobbyJson,
61
- remote,
62
- remoteRaw,
63
- ssh,
16
+ remoteRaw: (operation, sshDest, command, args) => shared.inspect(operation, childHost(sshDest), command, args),
17
+ remote: (operation, sshDest, command, args, context) => shared.run(operation, childHost(sshDest), command, args, context),
64
18
  };
65
19
  });
66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;IAE1F,OAAO;QACL,MAAM;QACN,SAAS;QACT,KAAK;QACL,SAAS;QACT,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAC/C,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC;QAC9D,MAAM,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CACrD,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;KAC3C,CAAC;AAC7B,CAAC,CAAC,CAAC"}
@@ -1,8 +1,14 @@
1
+ import type { ClaudeLoginLock } from "@usine/agents/runtime";
2
+ import type { AttemptRuntime } from "@usine/durable/attempt-runtime";
1
3
  import { Layer } from "effect";
2
- import { ChildProcessSpawner } from "effect/unstable/process";
4
+ import type { ChildProcessSpawner } from "effect/unstable/process";
3
5
  import { Executor } from "../executor.ts";
4
6
  import type { ExeDevExecutorOptions } from "./model.ts";
5
- /** Runs Attempts on exe.dev Workers over SSH. Requires Node; worker contracts are platform-free. */
6
- export declare const layer: (options: ExeDevExecutorOptions) => Layer.Layer<Executor, never, ChildProcessSpawner.ChildProcessSpawner>;
7
+ /**
8
+ * The executor for exe.dev Workers. Each Attempt's Pi parent is a durable task in this process
9
+ * (`AttemptRuntime`), and its children run on the Worker's VM over SSH. A live Attempt
10
+ * reattaches to its checkout after an orchestrator restart. Requires Node.
11
+ */
12
+ export declare const layer: (options: ExeDevExecutorOptions) => Layer.Layer<Executor, never, AttemptRuntime | ClaudeLoginLock | ChildProcessSpawner.ChildProcessSpawner>;
7
13
  export { CredentialGrantMinutes, type ExeDevExecutorOptions, GitHubIntegration, IntegrationName, } from "./model.ts";
8
14
  //# sourceMappingURL=exe-dev.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exe-dev.d.ts","sourceRoot":"","sources":["../../src/exe-dev/exe-dev.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,EAAiB,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAIL,QAAQ,EAGT,MAAM,gBAAgB,CAAC;AAQxB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AA4MxD,oGAAoG;AACpG,eAAO,MAAM,KAAK,YACP,qBAAqB,KAC7B,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,mBAAmB,CAAC,mBAAmB,CAClB,CAAC;AAEtD,OAAO,EACL,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"exe-dev.d.ts","sourceRoot":"","sources":["../../src/exe-dev/exe-dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAU,KAAK,EAAU,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAA8B,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAKtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAqFxD;;;;GAIG;AACH,eAAO,MAAM,KAAK,YACP,qBAAqB,KAC7B,KAAK,CAAC,KAAK,CACZ,QAAQ,EACR,KAAK,EACL,cAAc,GAAG,eAAe,GAAG,mBAAmB,CAAC,mBAAmB,CACpB,CAAC;AAEzD,OAAO,EACL,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC"}
@@ -1,153 +1,79 @@
1
- import { RepositoryName } from "@usine/core/repository";
2
- import { Effect, Exit, Layer, Schema, Scope } from "effect";
3
- import { ChildProcessSpawner } from "effect/unstable/process";
4
- import { CheckoutRequest, CredentialUnavailableError, Executor, ExecutorError, ExecutorOperationError, } from "../executor.js";
5
- import { verifyHarnesses } from "../harness-preflight.js";
6
- import { prepareAttempt } from "../prepared-attempt.js";
7
- import { keyedLockFor } from "../keyed-lock.js";
8
- import { provisionWorktree, safeSegment } from "../provision.js";
9
- import { attemptChannelFor } from "./channel.js";
1
+ import { RepositoryName, safeSegment } from "@usine/core/repository";
2
+ import { Effect, Layer, Option } from "effect";
3
+ import { CredentialUnavailableError, Executor } from "../executor.js";
4
+ import { remoteExecutorFor } from "../remote/remote.js";
10
5
  import { commandsFor } from "./commands.js";
11
6
  import { credentialGrantsFor } from "./grants.js";
12
7
  import { preflightFor } from "./preflight.js";
13
- import { RUN_HOST_KILL_SCRIPT, runHostPidFile } from "./shell.js";
14
- import { abandonedWorktreeSweepFor } from "./sweep.js";
15
- const isExecutorError = Schema.is(ExecutorError);
16
- const executorError = (message, cause) => new ExecutorOperationError({ operation: "prepare", message, cause });
8
+ /** The host for which the exe.dev edge injects the GitHub credential. */
9
+ const EDGE_GITHUB_HOST = "github.int.exe.xyz";
10
+ /**
11
+ * Returns the environment for every child and harvesting command on the VM. It contains no
12
+ * secrets; the exe.dev edge injects the credential (ADR 0011).
13
+ */
14
+ const edgeAccess = (machine) => ({
15
+ shell: machine.shell,
16
+ environment: { GH_HOST: EDGE_GITHUB_HOST },
17
+ gitEnvironment: {},
18
+ refresh: Effect.void,
19
+ scrub: (text) => text,
20
+ });
17
21
  const makeExeDevExecutor = (options) => Effect.gen(function* () {
18
22
  const commands = yield* commandsFor(options.ssh);
19
- const fetches = yield* keyedLockFor();
20
23
  const integrations = new Map(options.githubIntegrations.map(({ name, repository }) => [repository, name]));
21
24
  const integrationNames = new Set(options.githubIntegrations.map(({ name }) => name));
22
- const runHost = options.runHost ?? { command: "usine-run-host", args: [] };
23
- // The grace covers an SSH round trip plus the agent flushing its final
24
- // events, not just a local pipe.
25
- const interruptGrace = options.interruptGrace ?? "10 seconds";
26
25
  if (integrations.size !== options.githubIntegrations.length) {
27
26
  return yield* Effect.die(new Error("ExeDevExecutorOptions.githubIntegrations contains duplicate repositories"));
28
27
  }
29
28
  if (integrationNames.size !== options.githubIntegrations.length) {
30
29
  return yield* Effect.die(new Error("ExeDevExecutorOptions.githubIntegrations contains duplicate integration names"));
31
30
  }
32
- const machines = yield* preflightFor(options, commands, runHost);
31
+ const machines = yield* preflightFor(options, commands);
33
32
  const credentialGrants = yield* credentialGrantsFor(options, commands);
34
- const sweepAbandonedWorktrees = yield* abandonedWorktreeSweepFor(commands);
35
- const attemptChannel = yield* attemptChannelFor(commands, runHost, interruptGrace);
36
- const prepare = Effect.fn("ExeDevExecutor.prepare")(function* (request) {
37
- yield* Effect.annotateCurrentSpan({
38
- attemptId: request.attemptId,
39
- worker: request.worker,
40
- repository: request.repository,
41
- });
42
- const integration = integrations.get(request.repository);
43
- if (integration === undefined) {
33
+ const machineFor = Effect.fn("ExeDevExecutor.machineFor")(function* (worker) {
34
+ const vm = yield* machines.vmFor(worker);
35
+ return {
36
+ shell: commands.childHost(vm.sshDest),
37
+ workerDirectory: `${vm.home}/.usine/workers/${safeSegment(worker)}`,
38
+ };
39
+ });
40
+ const grantFor = Effect.fn("ExeDevExecutor.grantFor")(function* (repository) {
41
+ const integration = integrations.get(repository);
42
+ if (integration === undefined)
44
43
  return yield* new CredentialUnavailableError({
45
- repository: request.repository,
46
- message: `No exe.dev GitHub integration is configured for ${request.repository}`,
44
+ repository,
45
+ reason: "refused",
46
+ message: `No exe.dev GitHub integration is configured for ${repository}`,
47
47
  cause: new Error("repository integration missing"),
48
48
  });
49
- }
50
- const vm = yield* machines.vmFor(request.worker);
51
- yield* verifyHarnesses(request.worker, [request.agent.brain], runHost, (command, args) => commands.remote("preflight", vm.sshDest, command, args));
52
- const root = `${vm.home}/.usine/workers/${safeSegment(request.worker)}`;
53
- const cache = `${root}/repos/${safeSegment(request.repository)}.git`;
54
- const worktree = `${root}/attempts/${safeSegment(request.attemptId)}`;
55
- const staging = `${cache}.cloning`;
56
- const remoteUrl = `https://github.int.exe.xyz/${request.repository}.git`;
57
- yield* Effect.annotateCurrentSpan({ host: vm.sshDest });
58
- yield* sweepAbandonedWorktrees(request.attemptId, request.worker, vm, root);
59
- const remove = (operation, target) => Effect.asVoid(commands.remote(operation, vm.sshDest, "rm", ["-rf", target]));
60
- const ops = {
61
- ensureRoots: Effect.asVoid(commands.remote("prepare", vm.sshDest, "mkdir", [
62
- "-p",
63
- `${root}/repos`,
64
- `${root}/attempts`,
65
- ])),
66
- removePath: remove,
67
- cacheExists: Effect.gen(function* () {
68
- const inspected = yield* commands.remoteRaw("prepare", vm.sshDest, "test", ["-d", cache]);
69
- if (inspected.exitCode === 0)
70
- return true;
71
- if (inspected.exitCode === 1)
72
- return false;
73
- return yield* executorError(`Could not inspect the cached clone on Worker ${request.worker}`, new Error(inspected.stderr.trim()));
74
- }),
75
- promoteStaging: Effect.asVoid(commands.remote("prepare", vm.sshDest, "mv", [staging, cache])),
76
- git: (operation, args) => commands.remote(operation, vm.sshDest, "git", args),
77
- };
78
- const releaseWorkspace = Effect.fn("ExeDevExecutor.releaseWorkspace")(function* (resource, exit) {
79
- yield* Effect.annotateCurrentSpan({
80
- attemptId: request.attemptId,
81
- worker: request.worker,
82
- host: vm.sshDest,
83
- });
84
- // The remote run host and its checkout form one cleanup dependency:
85
- // an SSH exit does not prove the process on the VM has stopped. Never
86
- // close the checkout scope unless this independent stop request succeeds.
87
- const confirmed = yield* commands.remote("cleanup", vm.sshDest, "sh", [
88
- "-c",
89
- RUN_HOST_KILL_SCRIPT,
90
- "sh",
91
- runHostPidFile(resource.workspace.worktree),
92
- ]);
93
- yield* Effect.logInfo("Confirmed the remote run host before workspace removal", {
94
- attemptId: request.attemptId,
95
- worker: request.worker,
96
- host: vm.sshDest,
97
- runHost: confirmed.trim(),
98
- });
99
- yield* Scope.close(resource.scope, exit);
100
- }, (effect) => effect.pipe(Effect.tapError((error) => Effect.logError("Remote termination failed; Attempt checkout retained for recovery", {
101
- attemptId: request.attemptId,
102
- worker: request.worker,
103
- host: vm.sshDest,
104
- worktree,
105
- message: error.message,
106
- })), Effect.ignore));
107
- const { workspace: prepared } = yield* fetches
108
- .withLock(request.repository)(Effect.gen(function* () {
109
- // Credentials belong to the Attempt scope independently of the checkout:
110
- // refusing destructive cleanup must still release this grant exactly once.
111
- yield* credentialGrants.acquire(request.attemptId, request.worker, request.repository, integration);
112
- return yield* Effect.acquireRelease(Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
113
- const scope = yield* Scope.make();
114
- // Before preparation succeeds no run host can exist. Roll back the
115
- // partial checkout unconditionally; only a completed workspace is
116
- // transferred to the guarded remote-process release above.
117
- const workspace = yield* restore(provisionWorktree({
118
- request,
119
- url: remoteUrl,
120
- host: vm.sshDest,
121
- layout: { cache, staging, worktree },
122
- ops,
123
- })).pipe(Scope.provide(scope), Effect.onError((cause) => Scope.close(scope, Exit.failCause(cause))));
124
- return { workspace, scope };
125
- })), releaseWorkspace, { interruptible: true });
126
- }))
127
- .pipe(Effect.mapError((cause) => isExecutorError(cause)
128
- ? cause
129
- : executorError("exe.dev workspace preparation failed", cause)));
130
- yield* Effect.logInfo("exe.dev Attempt workspace ready", {
131
- attemptId: request.attemptId,
132
- worker: request.worker,
133
- host: vm.sshDest,
134
- repository: request.repository,
135
- baseCommit: prepared.spec.baseCommit,
136
- worktree,
137
- });
138
49
  return {
139
- workspace: prepared,
140
- launch: (io) => attemptChannel.launch(prepared, vm, io),
50
+ acquire: (attemptId, worker, _permissions, machine) => credentialGrants
51
+ .acquire(attemptId, worker, repository, integration)
52
+ .pipe(Effect.as(edgeAccess(machine))),
141
53
  };
142
- }, prepareAttempt);
143
- return Executor.of({
54
+ });
55
+ return yield* remoteExecutorFor({
144
56
  kind: "exe.dev",
145
- cancel: attemptChannel.cancel,
57
+ spanPrefix: "ExeDevExecutor",
58
+ label: "exe.dev",
59
+ commands: commands.shared,
60
+ machineFor,
146
61
  preflight: machines.preflight,
147
- prepare,
62
+ harnessProbe: (machine) => machines.harnessProbe(machine.shell),
63
+ repositoryUrl: (_machine, repository) => `https://${EDGE_GITHUB_HOST}/${repository}.git`,
64
+ // exe.dev Workers have no Gateway; every harness uses its own login.
65
+ gatewayCredential: () => Effect.succeedNone,
66
+ grantFor,
67
+ readOnlyAccessGap: Option.some("An exe.dev GitHub integration has the access of exe.dev's GitHub App, which can't be limited to read-only"),
68
+ reclaim: () => Effect.void,
69
+ interruptGrace: options.interruptGrace ?? "10 seconds",
148
70
  });
149
71
  });
150
- /** Runs Attempts on exe.dev Workers over SSH. Requires Node; worker contracts are platform-free. */
72
+ /**
73
+ * The executor for exe.dev Workers. Each Attempt's Pi parent is a durable task in this process
74
+ * (`AttemptRuntime`), and its children run on the Worker's VM over SSH. A live Attempt
75
+ * reattaches to its checkout after an orchestrator restart. Requires Node.
76
+ */
151
77
  export const layer = (options) => Layer.effect(Executor, makeExeDevExecutor(options));
152
78
  export { CredentialGrantMinutes, GitHubIntegration, IntegrationName, } from "./model.js";
153
79
  //# sourceMappingURL=exe-dev.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exe-dev.js","sourceRoot":"","sources":["../../src/exe-dev/exe-dev.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAEL,eAAe,EACf,0BAA0B,EAC1B,QAAQ,EACR,aAAa,EACb,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAy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c,EAAE,OAAO,CAAC,cAAc,IAAI,YAAY;KACvD,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,OAA8B,EAK9B,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEzD,OAAO,EACL,sBAAsB,EAEtB,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../../src/exe-dev/grants.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAO,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,YAAY,CAAC;AAKpB,eAAO,MAAM,mBAAmB;;gBA2I9B,CAAC"}
1
+ {"version":3,"file":"grants.d.ts","sourceRoot":"","sources":["../../src/exe-dev/grants.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAO,KAAK,EAAY,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,YAAY,CAAC;AAOpB,eAAO,MAAM,mBAAmB;;gBA0K9B,CAAC"}
@@ -1,10 +1,11 @@
1
1
  import { AttemptId } from "@usine/core/attempt";
2
2
  import { RepositoryName } from "@usine/core/repository";
3
3
  import { WorkerName } from "@usine/core/worker";
4
- import { Effect, Ref, Scope } from "effect";
4
+ import { Effect, Ref, Scope, Schedule } from "effect";
5
5
  import { CredentialUnavailableError } from "../executor.js";
6
6
  import { keyedLockFor } from "../keyed-lock.js";
7
7
  import { CredentialGrantMinutes, } from "./model.js";
8
+ const RENEWAL_RETRY_INTERVAL = "1 minute";
8
9
  const grantKey = (worker, integration) => `${worker} ${integration}`;
9
10
  export const credentialGrantsFor = Effect.fn("ExeDevExecutor.credentialGrantsFor")(function* (options, commands) {
10
11
  const locks = yield* keyedLockFor();
@@ -14,11 +15,18 @@ export const credentialGrantsFor = Effect.fn("ExeDevExecutor.credentialGrantsFor
14
15
  yield* Effect.annotateCurrentSpan({ attemptId, worker, repository, integration });
15
16
  const scope = yield* Effect.scope;
16
17
  const key = grantKey(worker, integration);
18
+ const attach = commands.lobby("prepare", [
19
+ "integrations",
20
+ "attach",
21
+ integration,
22
+ `vm:${worker}`,
23
+ "--for",
24
+ `${grantMinutes}m`,
25
+ ]);
17
26
  yield* locks.withLock(key)(Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
18
27
  const current = (yield* Ref.get(counts)).get(key) ?? 0;
19
- // Own a reference before attempting the attachment: a failed SSH reply
20
- // may still mean the edge accepted it. This reservation is released once
21
- // by this scope, and never borrows a sibling's reference on interruption.
28
+ // Counts the reference before attaching, because a failed SSH reply can still mean the edge
29
+ // accepted the attachment. This scope's finalizer releases it exactly once.
22
30
  yield* Ref.update(counts, (currentCounts) => new Map(currentCounts).set(key, current + 1));
23
31
  yield* Scope.addFinalizer(scope, release(attemptId, worker, integration).pipe(Effect.tapError((error) => Effect.logError("Attempt credential cleanup failed", {
24
32
  attemptId,
@@ -27,18 +35,10 @@ export const credentialGrantsFor = Effect.fn("ExeDevExecutor.credentialGrantsFor
27
35
  integration,
28
36
  message: error.message,
29
37
  })), Effect.ignore));
30
- yield* restore(commands
31
- .lobby("prepare", [
32
- "integrations",
33
- "attach",
34
- integration,
35
- `vm:${worker}`,
36
- "--for",
37
- `${grantMinutes}m`,
38
- ])
39
- .pipe(Effect.mapError((cause) => new CredentialUnavailableError({
38
+ yield* restore(attach.pipe(Effect.mapError((cause) => new CredentialUnavailableError({
40
39
  repository,
41
- message: `Could not attach exe.dev GitHub integration ${integration}`,
40
+ reason: "unreachable",
41
+ message: `Can't attach exe.dev GitHub integration "${integration}"`,
42
42
  cause,
43
43
  }))));
44
44
  yield* Effect.logInfo("Attached or refreshed time-boxed exe.dev GitHub integration", {
@@ -50,6 +50,26 @@ export const credentialGrantsFor = Effect.fn("ExeDevExecutor.credentialGrantsFor
50
50
  activeGrants: current + 1,
51
51
  });
52
52
  })));
53
+ // Renews at half the grant length until the scope closes and retries a failed renewal every
54
+ // minute. Finalizers stop this fiber before releasing the reference, after checkout cleanup.
55
+ const renew = Effect.fn("ExeDevExecutor.renewGrant")(function* () {
56
+ yield* Effect.annotateCurrentSpan({ attemptId, worker, repository, integration });
57
+ yield* locks.withLock(key)(attach);
58
+ yield* Effect.logInfo("Renewed exe.dev credential grant", {
59
+ attemptId,
60
+ worker,
61
+ repository,
62
+ integration,
63
+ grantMinutes,
64
+ });
65
+ });
66
+ yield* Effect.forever(Effect.sleep(`${grantMinutes * 30} seconds`).pipe(Effect.andThen(renew().pipe(Effect.tapError((error) => Effect.logError("Credential grant renewal failed; retrying in one minute", {
67
+ attemptId,
68
+ worker,
69
+ repository,
70
+ integration,
71
+ message: error.message,
72
+ })), Effect.retry(Schedule.spaced(RENEWAL_RETRY_INTERVAL)))), Effect.ignore)).pipe(Effect.forkScoped);
53
73
  });
54
74
  const release = Effect.fn("ExeDevExecutor.releaseGrant")(function* (attemptId, worker, integration) {
55
75
  yield* Effect.annotateCurrentSpan({ attemptId, worker, integration });
@@ -1 +1 @@
1
- {"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/exe-dev/grants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAA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ACD,KAAK,CAAC,CAAC,QAAQ;iBACZ,KAAK,CAAC,SAAS,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,MAAM,EAAE,CAAC,CAAC;iBACzE,IAAI,CACH,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,MAAM,CAAC,UAAU,CAAC,iDAAiD,EAAE;gBACnE,SAAS;gBACT,MAAM;gBACN,WAAW;gBACX,YAAY;gBACZ,KAAK,EAAE,sCAAsC,YAAY,oBAAoB;gBAC7E,OAAO,EAAE,KAAK,CAAC,OAAO;aACvB,CAAC,CACH,EACD,MAAM,CAAC,QAAQ,CACb,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE;gBACnC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;gBACpC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACjB,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CACH,CACF,CAAC;YACJ,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,qCAAqC,EAAE;gBAC3D,SAAS;gBACT,MAAM;gBACN,WAAW;aACZ,CAAC,CAAC;QACL,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC,CAAC,CAAC"}
@@ -1,38 +1,34 @@
1
+ import type { SshDestination } from "@usine/core/worker";
1
2
  import { Schema, type Effect } from "effect";
2
- import type { RunHostCommand } from "../executor.ts";
3
- /** The name of one exe.dev edge-injected integration. */
3
+ import type { SshCommand } from "@usine/agents/child-host";
4
4
  export declare const IntegrationName: Schema.brand<Schema.String, "ExeDevIntegrationName">;
5
5
  export type IntegrationName = typeof IntegrationName.Type;
6
- /**
7
- * An SSH destination handed to the local `ssh` client as argv, so anything
8
- * that could read as an option (`-oProxyCommand=...`) is unrepresentable.
9
- */
10
- export declare const SshDestination: Schema.brand<Schema.String, "ExeDevSshDestination">;
11
- export type SshDestination = typeof SshDestination.Type;
12
- /** An absolute remote home directory that cannot smuggle bytes past shell quoting. */
6
+ /** An absolute remote home directory path without NUL, CR, or LF bytes. */
13
7
  export declare const HomePath: Schema.brand<Schema.String, "ExeDevHomePath">;
14
8
  export type HomePath = typeof HomePath.Type;
15
9
  declare const GitHubIntegration_base: Schema.Class<GitHubIntegration, Schema.Struct<{
10
+ /** Must be unique across integrations. */
16
11
  readonly repository: Schema.brand<Schema.String, "RepositoryName">;
12
+ /**
13
+ * The integration name on exe.dev, unique in the options. Each Attempt attaches it to the
14
+ * Worker's VM for `credentialGrantMinutes`.
15
+ */
17
16
  readonly name: Schema.brand<Schema.String, "ExeDevIntegrationName">;
18
17
  }>, {}>;
19
- /** One standing exe.dev GitHub integration; only its VM attachment is per Attempt. */
18
+ /** An existing exe.dev GitHub integration, attached to the Worker's VM per Attempt. */
20
19
  export declare class GitHubIntegration extends GitHubIntegration_base {
21
20
  }
22
- /** How long an exe.dev Worker's repository credential attachment may remain active, in minutes. */
21
+ /** The duration of one credential attachment, in minutes. */
23
22
  export declare const CredentialGrantMinutes: Schema.brand<Schema.Int, "ExeDevCredentialGrantMinutes">;
24
23
  export type CredentialGrantMinutes = typeof CredentialGrantMinutes.Type;
25
- /** Repository access and run-host settings for the configured exe.dev Workers. */
26
24
  export interface ExeDevExecutorOptions {
27
- /** Existing native GitHub integrations, one per repository this Worker may receive. */
25
+ /** Existing exe.dev GitHub integrations, one per repository. */
28
26
  readonly githubIntegrations: ReadonlyArray<GitHubIntegration>;
29
- /** Installed in the baked image; defaults to the published worker executable. */
30
- readonly runHost?: RunHostCommand;
31
- /** Local SSH executable and its control-plane-only arguments. */
32
- readonly ssh?: RunHostCommand;
33
- /** Time-box for the edge credential attachment. Defaults to 65 minutes. */
27
+ /** The local SSH command for lobby, VM, and child commands. */
28
+ readonly ssh?: SshCommand;
29
+ /** The length of each credential attachment, in minutes, renewed at half this length. Defaults to 65. */
34
30
  readonly credentialGrantMinutes?: CredentialGrantMinutes;
35
- /** Grace for delivering a stop request, then for the run host to exit; each wait is bounded separately. Defaults to 10 seconds. */
31
+ /** The timeout for the parent task's cancellation, then separately for the Attempt to finish. Defaults to 10 seconds. */
36
32
  readonly interruptGrace?: Parameters<typeof Effect.timeoutOption>[1];
37
33
  }
38
34
  export interface VmState {
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/exe-dev/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,yDAAyD;AACzD,eAAO,MAAM,eAAe,sDAIiB,CAAC;AAC9C,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,cAAc,qDAIiB,CAAC;AAC7C,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC;AAExD,sFAAsF;AACtF,eAAO,MAAM,QAAQ,+CAIiB,CAAC;AACvC,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;;;;;AAE5C,sFAAsF;AACtF,qBAAa,iBAAkB,SAAQ,sBAKrC;CAAG;AAEL,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,0DAElC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,IAAI,CAAC;AAExE,kFAAkF;AAClF,MAAM,WAAW,qBAAqB;IACpC,uFAAuF;IACvF,QAAQ,CAAC,kBAAkB,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC9D,iFAAiF;IACjF,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC;IAClC,iEAAiE;IACjE,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC;IA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B,CAAC;IACzD,yHAAyH;IACzH,QAAQ,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CAClC"}
@@ -1,26 +1,23 @@
1
1
  import { RepositoryName } from "@usine/core/repository";
2
2
  import { Schema } from "effect";
3
- /** The name of one exe.dev edge-injected integration. */
4
3
  export const IntegrationName = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9]+(?:[._-][A-Za-z0-9]+)*$/u, {
5
- message: "Expected an exe.dev integration name safe for the lobby command boundary",
4
+ message: "Expected an exe.dev integration name of letters and digits, separated by single dots, underscores, or hyphens",
6
5
  })).pipe(Schema.brand("ExeDevIntegrationName"));
7
- /**
8
- * An SSH destination handed to the local `ssh` client as argv, so anything
9
- * that could read as an option (`-oProxyCommand=...`) is unrepresentable.
10
- */
11
- export const SshDestination = Schema.String.check(Schema.isPattern(/^(?:[A-Za-z0-9._-]+@)?[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?$/u, {
12
- message: "Expected an exe.dev SSH hostname, optionally prefixed by a user",
13
- })).pipe(Schema.brand("ExeDevSshDestination"));
14
- /** An absolute remote home directory that cannot smuggle bytes past shell quoting. */
6
+ /** An absolute remote home directory path without NUL, CR, or LF bytes. */
15
7
  export const HomePath = Schema.String.check(Schema.isPattern(/^\/[^\0\r\n]*$/u, {
16
8
  message: "Expected an absolute remote home directory without control bytes",
17
9
  })).pipe(Schema.brand("ExeDevHomePath"));
18
- /** One standing exe.dev GitHub integration; only its VM attachment is per Attempt. */
10
+ /** An existing exe.dev GitHub integration, attached to the Worker's VM per Attempt. */
19
11
  export class GitHubIntegration extends Schema.Class("@usine/executor/ExeDevGitHubIntegration")({
12
+ /** Must be unique across integrations. */
20
13
  repository: RepositoryName,
14
+ /**
15
+ * The integration name on exe.dev, unique in the options. Each Attempt attaches it to the
16
+ * Worker's VM for `credentialGrantMinutes`.
17
+ */
21
18
  name: IntegrationName,
22
19
  }) {
23
20
  }
24
- /** How long an exe.dev Worker's repository credential attachment may remain active, in minutes. */
21
+ /** The duration of one credential attachment, in minutes. */
25
22
  export const CredentialGrantMinutes = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).pipe(Schema.brand("ExeDevCredentialGrantMinutes"));
26
23
  //# sourceMappingURL=model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/exe-dev/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAe,MAAM,QAAQ,CAAC;AAG7C,yDAAyD;AACzD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAChD,MAAM,CAAC,SAAS,CAAC,uCAAuC,EAAE;IACxD,OAAO,EAAE,0EAA0E;CACpF,CAAC,CACH,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAG9C;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAC/C,MAAM,CAAC,SAAS,CAAC,mEAAmE,EAAE;IACpF,OAAO,EAAE,iEAAiE;CAC3E,CAAC,CACH,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAG7C,sFAAsF;AACtF,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CACzC,MAAM,CAAC,SAAS,CAAC,iBAAiB,EAAE;IAClC,OAAO,EAAE,kEAAkE;CAC5E,CAAC,CACH,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;AA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AAsB,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAC3F,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAC7C,CAAC"}
@@ -1,10 +1,14 @@
1
+ import type { RemoteShell } from "@usine/agents/child-host";
2
+ import { ClaudeLoginLock } from "@usine/agents/runtime";
1
3
  import type { BrainSpec } from "@usine/core/agent/brain";
2
4
  import { Effect } from "effect";
3
- import { ExecutorOperationError, type RunHostCommand, WorkerCapabilityError } from "../executor.ts";
5
+ import { ChildProcessSpawner } from "effect/unstable/process";
6
+ import { ExecutorOperationError, WorkerCapabilityError } from "../executor.ts";
4
7
  import type { ExeDevCommands } from "./commands.ts";
5
8
  import { type ExeDevExecutorOptions, type VmState } from "./model.ts";
6
- export declare const preflightFor: (options: ExeDevExecutorOptions, commands: ExeDevCommands, runHost: RunHostCommand) => Effect.Effect<{
7
- preflight: (worker: string & import("effect/Brand").Brand<"WorkerName">, brains: readonly BrainSpec[]) => Effect.Effect<undefined, import("../executor.ts").CredentialUnavailableError | ExecutorOperationError | WorkerCapabilityError, never>;
9
+ export declare const preflightFor: (options: ExeDevExecutorOptions, commands: ExeDevCommands) => Effect.Effect<{
10
+ preflight: (worker: string & import("effect/Brand").Brand<"WorkerName">, brains: readonly BrainSpec[], maxConcurrentAttempts: number) => Effect.Effect<undefined, import("../executor.ts").CredentialUnavailableError | ExecutorOperationError | WorkerCapabilityError, never>;
8
11
  vmFor: (worker: string & import("effect/Brand").Brand<"WorkerName">) => Effect.Effect<VmState, ExecutorOperationError | WorkerCapabilityError, never>;
9
- }, never, never>;
12
+ harnessProbe: (shell: RemoteShell) => import("../harness-preflight.ts").HarnessProbe;
13
+ }, never, ChildProcessSpawner.ChildProcessSpawner | ClaudeLoginLock>;
10
14
  //# sourceMappingURL=preflight.d.ts.map