@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.
- package/README.md +115 -37
- package/dist/child-command.d.ts +4 -7
- package/dist/child-command.d.ts.map +1 -1
- package/dist/child-command.js +6 -12
- package/dist/child-command.js.map +1 -1
- package/dist/claude-login-lock.d.ts +8 -0
- package/dist/claude-login-lock.d.ts.map +1 -0
- package/dist/claude-login-lock.js +9 -0
- package/dist/claude-login-lock.js.map +1 -0
- package/dist/credential-environment.d.ts +20 -0
- package/dist/credential-environment.d.ts.map +1 -0
- package/dist/credential-environment.js +20 -0
- package/dist/credential-environment.js.map +1 -0
- package/dist/durable-session.d.ts +63 -0
- package/dist/durable-session.d.ts.map +1 -0
- package/dist/durable-session.js +491 -0
- package/dist/durable-session.js.map +1 -0
- package/dist/exe-dev/commands.d.ts +23 -13
- package/dist/exe-dev/commands.d.ts.map +1 -1
- package/dist/exe-dev/commands.js +11 -57
- package/dist/exe-dev/commands.js.map +1 -1
- package/dist/exe-dev/exe-dev.d.ts +9 -3
- package/dist/exe-dev/exe-dev.d.ts.map +1 -1
- package/dist/exe-dev/exe-dev.js +53 -127
- package/dist/exe-dev/exe-dev.js.map +1 -1
- package/dist/exe-dev/grants.d.ts.map +1 -1
- package/dist/exe-dev/grants.js +35 -15
- package/dist/exe-dev/grants.js.map +1 -1
- package/dist/exe-dev/model.d.ts +15 -19
- package/dist/exe-dev/model.d.ts.map +1 -1
- package/dist/exe-dev/model.js +9 -12
- package/dist/exe-dev/model.js.map +1 -1
- package/dist/exe-dev/preflight.d.ts +8 -4
- package/dist/exe-dev/preflight.d.ts.map +1 -1
- package/dist/exe-dev/preflight.js +23 -33
- package/dist/exe-dev/preflight.js.map +1 -1
- package/dist/executor.d.ts +141 -38
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +90 -17
- package/dist/executor.js.map +1 -1
- package/dist/guard.d.ts +61 -0
- package/dist/guard.d.ts.map +1 -0
- package/dist/guard.js +288 -0
- package/dist/guard.js.map +1 -0
- package/dist/harness-preflight.d.ts +25 -4
- package/dist/harness-preflight.d.ts.map +1 -1
- package/dist/harness-preflight.js +25 -29
- package/dist/harness-preflight.js.map +1 -1
- package/dist/keyed-lock.d.ts +2 -3
- package/dist/keyed-lock.d.ts.map +1 -1
- package/dist/keyed-lock.js +2 -3
- package/dist/keyed-lock.js.map +1 -1
- package/dist/leftovers.d.ts +9 -0
- package/dist/leftovers.d.ts.map +1 -0
- package/dist/leftovers.js +14 -0
- package/dist/leftovers.js.map +1 -0
- package/dist/local/credentials.d.ts +21 -0
- package/dist/local/credentials.d.ts.map +1 -0
- package/dist/local/credentials.js +39 -0
- package/dist/local/credentials.js.map +1 -0
- package/dist/local/leftovers.d.ts +8 -0
- package/dist/local/leftovers.d.ts.map +1 -0
- package/dist/local/leftovers.js +23 -0
- package/dist/local/leftovers.js.map +1 -0
- package/dist/local/local.d.ts +16 -10
- package/dist/local/local.d.ts.map +1 -1
- package/dist/local/local.js +164 -129
- package/dist/local/local.js.map +1 -1
- package/dist/memory-preflight.d.ts +25 -0
- package/dist/memory-preflight.d.ts.map +1 -0
- package/dist/memory-preflight.js +83 -0
- package/dist/memory-preflight.js.map +1 -0
- package/dist/pre-push-hook.d.ts +20 -0
- package/dist/pre-push-hook.d.ts.map +1 -0
- package/dist/pre-push-hook.js +33 -0
- package/dist/pre-push-hook.js.map +1 -0
- package/dist/prepared-attempt.d.ts +33 -3
- package/dist/prepared-attempt.d.ts.map +1 -1
- package/dist/prepared-attempt.js +109 -39
- package/dist/prepared-attempt.js.map +1 -1
- package/dist/provision.d.ts +77 -14
- package/dist/provision.d.ts.map +1 -1
- package/dist/provision.js +357 -55
- package/dist/provision.js.map +1 -1
- package/dist/remote/commands.d.ts +51 -0
- package/dist/remote/commands.d.ts.map +1 -0
- package/dist/remote/commands.js +94 -0
- package/dist/remote/commands.js.map +1 -0
- package/dist/remote/leftovers.d.ts +14 -0
- package/dist/remote/leftovers.d.ts.map +1 -0
- package/dist/remote/leftovers.js +22 -0
- package/dist/remote/leftovers.js.map +1 -0
- package/dist/remote/liveness.d.ts +33 -0
- package/dist/remote/liveness.d.ts.map +1 -0
- package/dist/remote/liveness.js +194 -0
- package/dist/remote/liveness.js.map +1 -0
- package/dist/remote/machine.d.ts +64 -0
- package/dist/remote/machine.d.ts.map +1 -0
- package/dist/remote/machine.js +2 -0
- package/dist/remote/machine.js.map +1 -0
- package/dist/remote/remote.d.ts +24 -0
- package/dist/remote/remote.d.ts.map +1 -0
- package/dist/remote/remote.js +308 -0
- package/dist/remote/remote.js.map +1 -0
- package/dist/remote/sweep.d.ts +15 -0
- package/dist/remote/sweep.d.ts.map +1 -0
- package/dist/remote/sweep.js +116 -0
- package/dist/remote/sweep.js.map +1 -0
- package/dist/renewable-credential.d.ts +17 -0
- package/dist/renewable-credential.d.ts.map +1 -0
- package/dist/renewable-credential.js +58 -0
- package/dist/renewable-credential.js.map +1 -0
- package/dist/salvage.d.ts +30 -0
- package/dist/salvage.d.ts.map +1 -0
- package/dist/salvage.js +104 -0
- package/dist/salvage.js.map +1 -0
- package/dist/ssh/credentials.d.ts +40 -0
- package/dist/ssh/credentials.d.ts.map +1 -0
- package/dist/ssh/credentials.js +83 -0
- package/dist/ssh/credentials.js.map +1 -0
- package/dist/ssh/gateway/admin.d.ts +45 -0
- package/dist/ssh/gateway/admin.d.ts.map +1 -0
- package/dist/ssh/gateway/admin.js +129 -0
- package/dist/ssh/gateway/admin.js.map +1 -0
- package/dist/ssh/gateway/attachments.d.ts +22 -0
- package/dist/ssh/gateway/attachments.d.ts.map +1 -0
- package/dist/ssh/gateway/attachments.js +154 -0
- package/dist/ssh/gateway/attachments.js.map +1 -0
- package/dist/ssh/gateway/environment.d.ts +52 -0
- package/dist/ssh/gateway/environment.d.ts.map +1 -0
- package/dist/ssh/gateway/environment.js +78 -0
- package/dist/ssh/gateway/environment.js.map +1 -0
- package/dist/ssh/gateway/forward.d.ts +74 -0
- package/dist/ssh/gateway/forward.d.ts.map +1 -0
- package/dist/ssh/gateway/forward.js +247 -0
- package/dist/ssh/gateway/forward.js.map +1 -0
- package/dist/ssh/gateway/preflight.d.ts +28 -0
- package/dist/ssh/gateway/preflight.d.ts.map +1 -0
- package/dist/ssh/gateway/preflight.js +234 -0
- package/dist/ssh/gateway/preflight.js.map +1 -0
- package/dist/ssh/model.d.ts +65 -0
- package/dist/ssh/model.d.ts.map +1 -0
- package/dist/ssh/model.js +2 -0
- package/dist/ssh/model.js.map +1 -0
- package/dist/ssh/preflight.d.ts +16 -0
- package/dist/ssh/preflight.d.ts.map +1 -0
- package/dist/ssh/preflight.js +47 -0
- package/dist/ssh/preflight.js.map +1 -0
- package/dist/ssh/ssh.d.ts +20 -0
- package/dist/ssh/ssh.d.ts.map +1 -0
- package/dist/ssh/ssh.js +78 -0
- package/dist/ssh/ssh.js.map +1 -0
- package/dist/ssh/workers.d.ts +53 -0
- package/dist/ssh/workers.d.ts.map +1 -0
- package/dist/ssh/workers.js +173 -0
- package/dist/ssh/workers.js.map +1 -0
- package/package.json +12 -4
- package/dist/exe-dev/channel.d.ts +0 -11
- package/dist/exe-dev/channel.d.ts.map +0 -1
- package/dist/exe-dev/channel.js +0 -41
- package/dist/exe-dev/channel.js.map +0 -1
- package/dist/exe-dev/shell.d.ts +0 -12
- package/dist/exe-dev/shell.d.ts.map +0 -1
- package/dist/exe-dev/shell.js +0 -31
- package/dist/exe-dev/shell.js.map +0 -1
- package/dist/exe-dev/sweep.d.ts +0 -10
- package/dist/exe-dev/sweep.d.ts.map +0 -1
- package/dist/exe-dev/sweep.js +0 -117
- package/dist/exe-dev/sweep.js.map +0 -1
- package/dist/invalid-frame.d.ts +0 -17
- package/dist/invalid-frame.d.ts.map +0 -1
- package/dist/invalid-frame.js +0 -111
- package/dist/invalid-frame.js.map +0 -1
- package/dist/run-host-session.d.ts +0 -26
- package/dist/run-host-session.d.ts.map +0 -1
- package/dist/run-host-session.js +0 -241
- 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;
|
|
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
|
|
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 {
|
|
6
|
-
import {
|
|
7
|
-
|
|
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
|
|
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
|
|
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", `
|
|
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}
|
|
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
|
-
|
|
42
|
-
|
|
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}
|
|
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,
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/exe-dev/preflight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,GAEtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,sBAAs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AAC,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"}
|
package/dist/executor.d.ts
CHANGED
|
@@ -1,118 +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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
/**
|
|
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
|
|
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
|
-
/**
|
|
62
|
-
readonly maxAttemptMinutes: 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. */
|
|
63
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">>>;
|
|
64
123
|
}>, {}>;
|
|
65
|
-
/** The repository, revision, and Agent task assigned to a Worker for one fresh Attempt checkout. */
|
|
66
124
|
export declare class CheckoutRequest extends CheckoutRequest_base {
|
|
67
125
|
}
|
|
68
|
-
/** One Attempt's disposable checkout directory. */
|
|
69
126
|
export declare const WorktreePath: Schema.brand<Schema.NonEmptyString, "WorktreePath">;
|
|
70
127
|
export type WorktreePath = typeof WorktreePath.Type;
|
|
71
128
|
declare const AttemptWorkspace_base: Schema.Class<AttemptWorkspace, Schema.Struct<{
|
|
72
129
|
readonly worker: Schema.brand<Schema.String, "WorkerName">;
|
|
130
|
+
/** The request's fields plus the commit that `revision` resolved to. */
|
|
73
131
|
readonly spec: typeof AttemptChannel.RunSpec;
|
|
132
|
+
/** The checkout path on the Worker's machine, where the children run. */
|
|
74
133
|
readonly worktree: Schema.brand<Schema.NonEmptyString, "WorktreePath">;
|
|
75
134
|
}>, {}>;
|
|
76
|
-
/**
|
|
135
|
+
/** A serializable checkout location and RunSpec, without credentials or live resources. */
|
|
77
136
|
export declare class AttemptWorkspace extends AttemptWorkspace_base {
|
|
78
137
|
}
|
|
79
138
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
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.
|
|
83
142
|
*/
|
|
84
143
|
export interface PreparedAttempt {
|
|
85
|
-
/** Checkout metadata suitable for inspection or serialization; contains no credentials. */
|
|
86
144
|
readonly workspace: AttemptWorkspace;
|
|
87
145
|
/**
|
|
88
|
-
* Runs
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* 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.
|
|
92
149
|
*/
|
|
93
150
|
readonly launch: (io: AttemptChannel.Sink) => Effect.Effect<StepResult, AttemptFailure>;
|
|
94
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
|
+
}
|
|
95
163
|
declare const CredentialProvider_base: Context.ServiceClass<CredentialProvider, "@usine/executor/CredentialProvider", {
|
|
96
|
-
|
|
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>;
|
|
97
170
|
}>;
|
|
98
|
-
/** Mints exactly one repository-scoped credential for each prepared Attempt. */
|
|
99
171
|
export declare class CredentialProvider extends CredentialProvider_base {
|
|
100
172
|
}
|
|
101
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. */
|
|
102
184
|
readonly kind: WorkerKind;
|
|
103
|
-
/** Verifies Git, the run host, and each rostered brain in the Worker environment; never installs tools or logs in. */
|
|
104
|
-
readonly preflight: (worker: WorkerName, brains: ReadonlyArray<BrainSpec>) => Effect.Effect<void, ExecutorError>;
|
|
105
185
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
|
|
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.
|
|
109
205
|
*/
|
|
110
206
|
readonly prepare: (request: CheckoutRequest) => Effect.Effect<PreparedAttempt, ExecutorError, Scope.Scope>;
|
|
111
|
-
/**
|
|
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
|
+
*/
|
|
112
213
|
readonly cancel: (attemptId: AttemptId) => Effect.Effect<void, ExecutorError>;
|
|
214
|
+
/** Sends an operator intervention to the Attempt's live session. */
|
|
215
|
+
readonly intervene: (attemptId: AttemptId, intervention: AttemptChannel.Intervention) => Effect.Effect<void, AttemptFailure>;
|
|
113
216
|
}>;
|
|
114
|
-
/**
|
|
217
|
+
/** The service that prepares checkouts, runs Attempts on a Worker, and releases their resources (ADR 0006). */
|
|
115
218
|
export declare class Executor extends Executor_base {
|
|
116
219
|
}
|
|
117
|
-
export {};
|
|
220
|
+
export { claudeLoginLockLayer } from "./claude-login-lock.ts";
|
|
118
221
|
//# sourceMappingURL=executor.d.ts.map
|
package/dist/executor.d.ts.map
CHANGED
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACjF,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,EAAY,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAc,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,cAAc,EAAsB,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAY,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,UAAU,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AM,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,
|
|
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
|
-
"
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
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,35 +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
|
-
/**
|
|
79
|
-
maxAttemptMinutes: 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. */
|
|
80
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()))),
|
|
81
143
|
}) {
|
|
82
144
|
}
|
|
83
|
-
/** One Attempt's disposable checkout directory. */
|
|
84
145
|
export const WorktreePath = Schema.NonEmptyString.pipe(Schema.brand("WorktreePath"));
|
|
85
|
-
/**
|
|
146
|
+
/** A serializable checkout location and RunSpec, without credentials or live resources. */
|
|
86
147
|
export class AttemptWorkspace extends Schema.Class("@usine/executor/AttemptWorkspace")({
|
|
87
148
|
worker: WorkerName,
|
|
149
|
+
/** The request's fields plus the commit that `revision` resolved to. */
|
|
88
150
|
spec: AttemptChannel.RunSpec,
|
|
151
|
+
/** The checkout path on the Worker's machine, where the children run. */
|
|
89
152
|
worktree: WorktreePath,
|
|
90
153
|
}) {
|
|
91
154
|
}
|
|
92
|
-
|
|
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
|
+
}
|
|
93
165
|
export class CredentialProvider extends Context.Service()("@usine/executor/CredentialProvider") {
|
|
94
166
|
}
|
|
95
|
-
/**
|
|
167
|
+
/** The service that prepares checkouts, runs Attempts on a Worker, and releases their resources (ADR 0006). */
|
|
96
168
|
export class Executor extends Context.Service()("@usine/executor/Executor") {
|
|
97
169
|
}
|
|
170
|
+
export { claudeLoginLockLayer } from "./claude-login-lock.js";
|
|
98
171
|
//# sourceMappingURL=executor.js.map
|