@usine/executor 0.6.1-next.575.g3f7aea9.1.1 → 0.6.1-next.587.g514f9e3.1.1

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 (52) hide show
  1. package/README.md +6 -6
  2. package/dist/ssh/gateway/model-route.d.ts +2 -0
  3. package/dist/ssh/gateway/model-route.d.ts.map +1 -1
  4. package/dist/ssh/gateway/model-route.js +5 -5
  5. package/dist/ssh/gateway/model-route.js.map +1 -1
  6. package/dist/supervisor/confine.d.ts +9 -0
  7. package/dist/supervisor/confine.d.ts.map +1 -0
  8. package/dist/supervisor/confine.js +41 -0
  9. package/dist/supervisor/confine.js.map +1 -0
  10. package/dist/supervisor/container.d.ts +20 -21
  11. package/dist/supervisor/container.d.ts.map +1 -1
  12. package/dist/supervisor/container.js +263 -204
  13. package/dist/supervisor/container.js.map +1 -1
  14. package/dist/supervisor/detect.d.ts +15 -0
  15. package/dist/supervisor/detect.d.ts.map +1 -0
  16. package/dist/supervisor/detect.js +69 -0
  17. package/dist/supervisor/detect.js.map +1 -0
  18. package/dist/supervisor/homes/file.d.ts +10 -0
  19. package/dist/supervisor/homes/file.d.ts.map +1 -0
  20. package/dist/supervisor/homes/file.js +44 -0
  21. package/dist/supervisor/homes/file.js.map +1 -0
  22. package/dist/supervisor/homes/homes.d.ts +25 -0
  23. package/dist/supervisor/homes/homes.d.ts.map +1 -0
  24. package/dist/supervisor/homes/homes.js +13 -0
  25. package/dist/supervisor/homes/homes.js.map +1 -0
  26. package/dist/supervisor/homes/memory.d.ts +5 -0
  27. package/dist/supervisor/homes/memory.d.ts.map +1 -0
  28. package/dist/supervisor/homes/memory.js +19 -0
  29. package/dist/supervisor/homes/memory.js.map +1 -0
  30. package/dist/supervisor/model-relay.d.ts.map +1 -1
  31. package/dist/supervisor/model-relay.js +11 -5
  32. package/dist/supervisor/model-relay.js.map +1 -1
  33. package/dist/supervisor/names.d.ts +6 -0
  34. package/dist/supervisor/names.d.ts.map +1 -1
  35. package/dist/supervisor/names.js +4 -0
  36. package/dist/supervisor/names.js.map +1 -1
  37. package/dist/supervisor/privileges.d.ts +6 -0
  38. package/dist/supervisor/privileges.d.ts.map +1 -0
  39. package/dist/supervisor/privileges.js +10 -0
  40. package/dist/supervisor/privileges.js.map +1 -0
  41. package/dist/supervisor/sources.d.ts.map +1 -1
  42. package/dist/supervisor/sources.js +4 -0
  43. package/dist/supervisor/sources.js.map +1 -1
  44. package/dist/supervisor/storage.d.ts +44 -7
  45. package/dist/supervisor/storage.d.ts.map +1 -1
  46. package/dist/supervisor/storage.js +152 -116
  47. package/dist/supervisor/storage.js.map +1 -1
  48. package/dist/supervisor/supervisor.d.ts +4 -1
  49. package/dist/supervisor/supervisor.d.ts.map +1 -1
  50. package/dist/supervisor/supervisor.js +4 -1
  51. package/dist/supervisor/supervisor.js.map +1 -1
  52. package/package.json +6 -6
package/README.md CHANGED
@@ -16,19 +16,19 @@ Worker preflight checks each coding-agent brain with the shared `admitBrain` pol
16
16
 
17
17
  ## Supervisor sandbox
18
18
 
19
- `@usine/executor/supervisor` provides one container per supervisor turn on the orchestrator host. `containerSandboxLayer({ root, image, runtime, route, limits, imagePullTimeout })` finds Podman, then Docker, unless `runtime` names one. Startup prepares `image` in the background, using a cached image when available and retrying failed preparation every minute. A turn waits up to 30 seconds for the image before refusing with a retry message. The container has no network, a read-only root filesystem, no capabilities and no new privileges, and runs as the orchestrator's user. An `ExecShell` seat enters it with `<runtime> exec`.
19
+ `@usine/executor/supervisor` provides one container per supervisor turn on the orchestrator host. `containerSandboxLayer({ root, image, runtime, route, limits, imagePullTimeout })` finds Podman, then Docker, unless `runtime` names one, and requires `ConversationHomes`; `fileHomesLayer(directory)` provides it with one file per conversation. Startup prepares `image` in the background, using a cached image when available and retrying failed preparation every minute, and then runs a startup check: a container with a turn's limits and in-memory home, into which it copies a small home and back out. `unavailable` gives the reason while the check runs or after it fails, and `checked` waits for the check. A turn waits up to 30 seconds for the check before refusing with the reason. The container has no network, a read-only root filesystem, no capabilities and no new privileges, and runs as the orchestrator's user. An `ExecShell` seat enters it with `<runtime> exec`.
20
20
 
21
- `limits` defaults to `SupervisorLimits`: 1 CPU, 1024 MiB memory without swap, 256 processes/threads, 64 MiB `/tmp` and 512 MiB per conversation. Shared memory is capped at 16 MiB and container logs are disabled. Opening verifies the runtime's cgroup v2 limits and refuses a seat if they are not enforced. Runtime commands, including startup, have a 30-second timeout; image pulls have no timeout unless `imagePullTimeout` is set. Pull output is drained with a diagnostic tail of 8,192 characters.
21
+ `limits` defaults to `SupervisorLimits`: 1 CPU, 1024 MiB memory without swap, 256 processes/threads, 64 MiB `/tmp` and a 128 MiB home per conversation. The home and `/tmp` count against the memory limit, and together they may use at most half of it; otherwise every turn is refused. Shared memory is capped at 16 MiB and container logs are disabled. Opening verifies the runtime's cgroup v2 limits and refuses a seat if they are not enforced. Runtime commands, including startup, have a 30-second timeout; image pulls have no timeout unless `imagePullTimeout` is set. Pull output is drained with a diagnostic tail of 8,192 characters.
22
22
 
23
- On both Docker and Podman, each conversation uses a preallocated ext4 image in `<root>/disks/<sha256>.ext4`, mounted with `fuse2fs` at `<root>/conversations/<sha256>`. It bounds container writes and Pi's host-side session files. Linux, FUSE access, `user_allow_other` in `/etc/fuse.conf`, `fuse2fs`, `fusermount`, `e2fsprogs` and `util-linux` are required. Allocation or mount failure refuses the turn. An existing image must match the configured size; resizing requires an offline migration. The conversation's writable home persists across turns. Its workspace and every source are read-only bind mounts, passed with CSV-quoted `--mount` arguments that reject missing sources. Directory and settings creation replaces unsafe entries without following symlinks.
23
+ In the container, `<root>/conversations/<sha256>` is a tmpfs of `conversationSizeMib` that holds the harness's home and the PID files of its processes; no host path is writable. Before the harness starts, `open` extracts the conversation's saved home into it with `<runtime> exec -i ... tar -x` and writes the harness's gateway settings. `save(seat)` streams `tar -c` of the home to `ConversationHomes`, which fails once the archive exceeds `conversationSizeMib`; the file adapter writes `<key>.tar.partial`, syncs it, and renames it over `<key>.tar`, so a failed save keeps the previous home. Closing a turn's scope without `save` saves too, and logs a failure. `seat.restored` says whether the conversation had saved state. Pi writes its sessions under the workspace on the orchestrator; `open` refuses, and `save` fails, when those files exceed `conversationSizeMib`. When `<root>/disks` from earlier versions exists, startup removes it with every directory in `<root>/conversations`, which turns could write to then. The workspace and every source are read-only bind mounts, passed with CSV-quoted `--mount` arguments that reject missing sources. `confinedDirectory` creates the workspace and the sources' mount points without following a link, and refuses a path that resolves outside the sandbox root, because a runtime follows links in a mount source.
24
24
 
25
25
  The container relay forwards model requests over a Unix socket to the orchestrator. The HTTP server accepts at most eight connections and reads at most `limits.modelRequestMib` per body (32 MiB by default). It forwards only `POST /anthropic-messages/v1/messages` and `POST /openai-responses/v1/responses` for `SandboxRequest.model`, removes caller credential headers, and returns a generic 502 on route failure. The harness token contains no credential.
26
26
 
27
- Turn end, shutdown and startup remove containers by `usine.supervisor.root` and `usine.supervisor.conversation` labels and verify their removal. A remaining container prevents a new turn from accessing that conversation's filesystem. Cleanup owns this lifecycle even when a session stops the relay; after an orchestrator crash, startup removes leftovers. Preparation failures leave the supervisor unavailable with a reason while the instance remains usable.
27
+ Turn end, shutdown and startup remove containers by `usine.supervisor.root` and `usine.supervisor.conversation` labels and verify their removal. A remaining container prevents a new turn of that conversation. Cleanup owns this lifecycle even when a session stops the relay; after an orchestrator crash, startup removes leftovers. Preparation failures leave the supervisor unavailable with a reason while the instance remains usable.
28
28
 
29
- `makeSupervisorSources(root, origin)` prepares shallow source exports. Repository names reject `.` and `..` segments; cache and tree directories use SHA-256 names. Fetch sets `transfer.fsckObjects=true`, and exports remove absolute symlinks before publication. Preparations of one repository run one at a time. A tree stays available while a turn holds it and is removed when it is no longer the head and has no holders.
29
+ `makeSupervisorSources(root, origin)` prepares shallow source exports. Repository names reject `.` and `..` segments; cache and tree directories use SHA-256 names. Fetch sets `transfer.fsckObjects=true`, and exports remove absolute symlinks before publication. Preparations of one repository run one at a time. Automatic Git maintenance finishes under the repository lock before preparation returns, so cache cleanup can safely follow scope closure. A tree stays available while a turn holds it and is removed when it is no longer the head and has no holders.
30
30
 
31
- `test/supervisor/container-runtime.test.ts` runs on `USINE_SANDBOX_TEST_RUNTIME`, with `USINE_SANDBOX_TEST_IMAGE` (default `docker.io/library/node:22-slim`). CI runs Docker with the filesystem prerequisites. The suite checks isolation, persistence, relay-stop cleanup and restart, and disk, process and memory exhaustion while an outside SQLite database remains writable.
31
+ `test/supervisor/container-runtime.test.ts` runs on `USINE_SANDBOX_TEST_RUNTIME`, with `USINE_SANDBOX_TEST_IMAGE` (default `docker.io/library/node:22-slim`). CI runs it on Docker. The suite checks the startup check, isolation, persistence through a saved home, relay-stop cleanup and restart, and disk, process and memory exhaustion while an outside SQLite database remains writable.
32
32
 
33
33
  ## Attempt lifetime
34
34
 
@@ -15,6 +15,8 @@ export declare class GatewayModelError extends GatewayModelError_base {
15
15
  export interface GatewayModelRoute {
16
16
  readonly credential: (protocol: GatewayLlmProtocol) => Effect.Effect<Option.Option<GatewayCredentialKind>, GatewayModelError>;
17
17
  readonly request: (protocol: GatewayLlmProtocol, body: string, headers: Readonly<Record<string, string>>, signal?: AbortSignal) => Effect.Effect<Response, GatewayModelError>;
18
+ /** Counts the input tokens of an Anthropic Messages request, without running it. */
19
+ readonly countTokens: (body: string, headers: Readonly<Record<string, string>>, signal?: AbortSignal) => Effect.Effect<Response, GatewayModelError>;
18
20
  }
19
21
  /** Opens SSH forwards and a renewable anonymous attachment, and detaches it when the scope closes. */
20
22
  export declare const gatewayModelRouteFor: (worker: string & import("effect/Brand").Brand<"WorkerName">, repository: string & import("effect/Brand").Brand<"RepositoryName">, gateway: SshWorkerGateway) => Effect.Effect<GatewayModelRoute, GatewayModelError, ChildProcessSpawner.ChildProcessSpawner | HttpClient.HttpClient | import("effect/Scope").Scope>;
@@ -1 +1 @@
1
- {"version":3,"file":"model-route.d.ts","sourceRoot":"","sources":["../../../src/ssh/gateway/model-route.ts"],"names":[],"mappings":"AAAA,OAAO,K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ErD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;;;;oBAOhC,OAAO,MAAM;;AAHjC,wFAAwF;AACxF,qBAAa,iBAAkB,SAAQ,sBAGwD;CAAG;AAElG,+FAA+F;AAC/F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,UAAU,EAAE,CACnB,QAAQ,EAAE,kBAAkB,KACzB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC,CAAC;IAC5E,QAAQ,CAAC,OAAO,EAAE,CAChB,QAAQ,EAAE,kBAAkB,EAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACzC,MAAM,CAAC,EAAE,WAAW,KACjB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAChD,oFAAoF;IACpF,QAAQ,CAAC,WAAW,EAAE,CACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACzC,MAAM,CAAC,EAAE,WAAW,KACjB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;CACjD;AAED,sGAAsG;AACtG,eAAO,MAAM,oBAAoB,sTAqLhC,CAAC"}
@@ -60,11 +60,10 @@ export const gatewayModelRouteFor = Effect.fn("GatewayModelRoute.open")(function
60
60
  return yield* failed("Upgrade @usine/gateway: the coordinator requires gateway credential reporting.");
61
61
  return Option.fromUndefinedOr(listed.value.providers.find(({ provider }) => provider === protocol)?.credential);
62
62
  });
63
- const request = Effect.fn("GatewayModelRoute.request")(function* (protocol, body, headers, signal) {
64
- yield* Effect.annotateCurrentSpan({ worker, protocol });
63
+ const request = Effect.fn("GatewayModelRoute.request")(function* (protocol, path, body, headers, signal) {
64
+ yield* Effect.annotateCurrentSpan({ worker, protocol, path });
65
65
  const forward = yield* modelForward.current.pipe(Effect.catchTag("GatewayForwardClosed", (error) => modelForward.reopen(error.generation)));
66
- const path = protocol === "openai-responses" ? "responses" : "messages";
67
- const response = yield* http.execute(HttpClientRequest.post(new URL(`/${protocol}/v1/${path}`, forward.url)).pipe(HttpClientRequest.setHeaders(headers),
66
+ const response = yield* http.execute(HttpClientRequest.post(new URL(`/${protocol}${path}`, forward.url)).pipe(HttpClientRequest.setHeaders(headers),
68
67
  // The gateway reads its own token header before Authorization, so no caller header stays.
69
68
  (request) => CALLER_CREDENTIAL_HEADERS.reduce((remaining, name) => HttpClientRequest.removeHeader(remaining, name), request), HttpClientRequest.removeHeader("chatgpt-account-id"), HttpClientRequest.setHeader("host", `llm.${gateway.domain}`), HttpClientRequest.bearerToken(attached.callerToken), HttpClientRequest.bodyText(body, "application/json")));
70
69
  return new Response(Stream.toReadableStreamWith(response.stream, Context.empty(), { signal }), {
@@ -80,7 +79,8 @@ export const gatewayModelRouteFor = Effect.fn("GatewayModelRoute.open")(function
80
79
  credential: (protocol) => credential(protocol).pipe(Effect.mapError((error) => error._tag === "GatewayModelError"
81
80
  ? error
82
81
  : failed(`Can't check gateway credential for ${protocol} at ${gateway.destination}.`))),
83
- request: (protocol, body, headers, signal) => request(protocol, body, headers, signal).pipe(Effect.mapError(() => failed(`Can't call ${protocol} through gateway ${gateway.destination}.`))),
82
+ request: (protocol, body, headers, signal) => request(protocol, protocol === "openai-responses" ? "/v1/responses" : "/v1/messages", body, headers, signal).pipe(Effect.mapError(() => failed(`Can't call ${protocol} through gateway ${gateway.destination}.`))),
83
+ countTokens: (body, headers, signal) => request("anthropic-messages", "/v1/messages/count_tokens", body, headers, signal).pipe(Effect.mapError(() => failed(`Can't count tokens through gateway ${gateway.destination}.`))),
84
84
  };
85
85
  return route;
86
86
  }, Effect.mapError((error) => error._tag === "GatewayModelError"
@@ -1 +1 @@
1
- {"version":3,"file":"model-route.js","sourceRoot":"","sources":["../../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CACrE,CACF;KACJ,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC,EACD,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,KAAK,CAAC,IAAI,KAAK,mBAAmB;IAChC,CAAC,CAAC,KAAK;IACP,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC;QACrB,OAAO,EACL,KAAK,CAAC,IAAI,KAAK,mBAAmB;YAChC,CAAC,CAAC,KAAK,CAAC,OAAO;YACf,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,sBAAsB;gBACrC,CAAC,CAAC,uBAAuB,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,MAAM,GAAG;gBAC1D,CAAC,CAAC,oDAAoD,KAAK,CAAC,IAAI,IAAI;KAC3E,CAAC,CACP,CACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { SupervisorUnavailable } from "@usine/agents/supervisor";
2
+ import { Effect, FileSystem } from "effect";
3
+ /**
4
+ * Creates `path` and each missing directory between `root` and it, without following a symbolic
5
+ * link. Fails when `path` isn't below `root`, has an empty, `.` or `..` segment, has an entry on
6
+ * the way that is a link or not a directory, or resolves outside `root`.
7
+ */
8
+ export declare const confinedDirectory: (fs: FileSystem.FileSystem, root: string, path: string) => Effect.Effect<undefined, SupervisorUnavailable, never>;
9
+ //# sourceMappingURL=confine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confine.d.ts","sourceRoot":"","sources":["../../src/supervisor/confine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAU,MAAM,QAAQ,CAAC;AAOpD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,mHAsC7B,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { SupervisorUnavailable } from "@usine/agents/supervisor";
2
+ import { Effect, FileSystem, Option } from "effect";
3
+ const refused = (path, reason) => SupervisorUnavailable.make({
4
+ message: `Can't prepare the supervisor directory ${path}: ${reason}`,
5
+ });
6
+ /**
7
+ * Creates `path` and each missing directory between `root` and it, without following a symbolic
8
+ * link. Fails when `path` isn't below `root`, has an empty, `.` or `..` segment, has an entry on
9
+ * the way that is a link or not a directory, or resolves outside `root`.
10
+ */
11
+ export const confinedDirectory = Effect.fn("SupervisorSandbox.confinedDirectory")(function* (fs, root, path) {
12
+ if (!path.startsWith(`${root}/`))
13
+ return yield* refused(path, `it isn't below ${root}`);
14
+ const segments = path.slice(root.length + 1).split("/");
15
+ if (segments.some((segment) => segment === "" || segment === "." || segment === ".."))
16
+ return yield* refused(path, "it has an empty, . or .. segment");
17
+ yield* fs.makeDirectory(root, { recursive: true });
18
+ let current = root;
19
+ for (const segment of segments) {
20
+ current = `${current}/${segment}`;
21
+ const info = yield* fs.lstat(current).pipe(Effect.asSome, Effect.catchIf((error) => error.reason._tag === "NotFound", () => Effect.succeedNone));
22
+ if (Option.isNone(info))
23
+ yield* fs.makeDirectory(current);
24
+ else if (info.value.type !== "Directory") {
25
+ yield* Effect.logWarning("Refused a supervisor directory that isn't a plain directory", {
26
+ path: current,
27
+ type: info.value.type,
28
+ });
29
+ return yield* refused(path, `${current} is a ${info.value.type}, not a directory`);
30
+ }
31
+ }
32
+ const resolvedRoot = yield* fs.realPath(root);
33
+ const resolved = yield* fs.realPath(path);
34
+ if (!resolved.startsWith(`${resolvedRoot}/`))
35
+ return yield* refused(path, `it resolves to ${resolved}, outside ${resolvedRoot}`);
36
+ }, Effect.mapError((error) => error._tag === "SupervisorUnavailable"
37
+ ? error
38
+ : SupervisorUnavailable.make({
39
+ message: `Can't prepare a supervisor directory: ${error.message}`,
40
+ })));
41
+ //# sourceMappingURL=confine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confine.js","sourceRoot":"","sources":["../../src/supervisor/confine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,E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1,26 @@
1
- import { type SandboxRequest, SupervisorUnavailable } from "@usine/agents/supervisor";
1
+ import { type SandboxRequest } from "@usine/agents/supervisor";
2
+ import { ConversationHomes } from "./homes/homes.ts";
2
3
  import { type ContainerImage, SupervisorLimits } from "@usine/core/worker";
3
- import { type Duration, Effect, FileSystem, Layer, Option, Result } from "effect";
4
+ import { type Duration, Effect, FileSystem, Layer, Option } from "effect";
4
5
  import { ChildProcessSpawner } from "effect/process";
5
6
  import { type ContainerRuntime } from "../remote/runtime.ts";
6
7
  import type { GatewayModelError, GatewayModelRoute } from "../ssh/gateway/model-route.ts";
8
+ import { type SandboxRuntime } from "./detect.ts";
7
9
  /** The port inside the sandbox on which the model relay listens, on the loopback address. */
8
10
  export declare const MODEL_RELAY_PORT = 8787;
9
- /** The container runtime that runs supervisor sandboxes, and whether it runs without root. */
10
- export interface SandboxRuntime {
11
- readonly runtime: ContainerRuntime;
12
- readonly rootless: boolean;
13
- }
14
- /**
15
- * Finds the container runtime for supervisor sandboxes: `preferred`, or Podman and then Docker.
16
- * Returns why there is none when no candidate is installed or can run containers.
17
- */
18
- export declare const detectSandboxRuntime: (preferred: Option.Option<"docker" | "podman">) => Effect.Effect<Result.Result<never, SupervisorUnavailable> | Result.Result<SandboxRuntime, never>, never, ChildProcessSpawner.ChildProcessSpawner>;
19
- /** The directories of one conversation on the orchestrator, at the same paths in its sandbox. */
11
+ /** The paths of one conversation, which are the same on the orchestrator and in its sandbox. */
20
12
  interface ConversationPaths {
21
- /** Read-write: holds `home` and the PID files of the session's processes. */
13
+ /**
14
+ * In the sandbox: an in-memory filesystem of `conversation_size_mib` that holds `home` and the
15
+ * PID files of the session's processes.
16
+ */
22
17
  readonly root: string;
23
- /** Read-write: the harness's home directory, with its saved sessions. */
18
+ /** In the sandbox: the harness's home directory, with its saved sessions. */
24
19
  readonly home: string;
25
- /** Read-only: the session's working directory, with one source directory per repository. */
20
+ /**
21
+ * On the orchestrator, mounted read-only in the sandbox: the session's working directory, with
22
+ * one source directory per repository.
23
+ */
26
24
  readonly workspace: string;
27
25
  }
28
26
  /** The arguments of `<runtime> run` that start one turn's sandbox in the background. */
@@ -42,7 +40,7 @@ export declare const sandboxRunArguments: (options: {
42
40
  export interface ContainerSandboxOptions {
43
41
  /** The orchestrator directory that holds each conversation's directory. */
44
42
  readonly root: string;
45
- /** The image of each sandbox, with Node.js, a POSIX shell, and the harness CLIs. */
43
+ /** The image of each sandbox, with Node.js, a POSIX shell, tar, and the harness CLIs. */
46
44
  readonly image: ContainerImage;
47
45
  /** Image pulls have no timeout when omitted. */
48
46
  readonly imagePullTimeout?: Duration.Duration | undefined;
@@ -57,10 +55,11 @@ export interface ContainerSandboxOptions {
57
55
  * The container has no network: a relay inside it forwards the harness's model requests over a
58
56
  * socket to the orchestrator, which sends them through the instance's model route with the
59
57
  * instance's credential. Each repository's source is mounted read-only under the working
60
- * directory, and only the conversation's own directory is writable; no instance file is mounted.
61
- * The conversation's directory, with the harness's saved sessions, stays after the turn. Without
62
- * a container runtime or a model route, every turn fails with the reason.
58
+ * directory. The harness's home is an in-memory filesystem of `conversation_size_mib`, which each
59
+ * turn restores from `ConversationHomes` and saves back when it ends; no instance file is
60
+ * mounted. Without a container runtime, a model route, or limits that leave the harness memory,
61
+ * every turn fails with the reason.
63
62
  */
64
- export declare const containerSandboxLayer: (options: ContainerSandboxOptions) => Layer.Layer<never, never, ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem>;
63
+ export declare const containerSandboxLayer: (options: ContainerSandboxOptions) => Layer.Layer<never, never, ChildProcessSpawner.ChildProcessSpawner | ConversationHomes | FileSystem.FileSystem>;
65
64
  export {};
66
65
  //# sourceMappingURL=container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/supervisor/container.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,cAAc,EAInB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAAE,KAAK,cAA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