/** * A local Tenant's Compose file (Runtime Architecture §14.3), written to * `/docker/compose.yaml` by `nylorun start`. Each local Tenant is one installation * (tenancy.md §6): its own Compose project (`nylorun-`, the file's `name`), volumes, * network and ports. Container, network and volume names are global on the Docker engine, so * every one is `-` (`nylorun-shop-studio`, network `nylorun-shop`, volume * `nylorun-shop-postgres`), labelled `dev.nylorun.tenant: `; they are written here, from * the project and the Tenant's name. Everything else that varies (ports, the Postgres password and the other * secrets, UID/GID, the Host root, the images) comes from `docker/.env`. * * The Tenant's state is its Postgres database, executed through Restate, with its * history in s2-lite; the Runtime's /ready checks Postgres and Restate. Postgres initialises the * database with C collation (`--locale=C`) and runs with `wal_level=logical`: the stream * relay feeds s2-lite from the record over logical replication (Durable Streams), and * `max_slot_wal_keep_size` caps the WAL a stuck relay can hold. The Runtime creates the * Tenant on its first start, with its name (`NYLORUN_TENANT_NAME`). * * Restate signs requests to the Worker endpoint with the private key in * `docker/restate-identity.pem`, mounted read-only; the Runtime gets the public * key as NYLORUN_RESTATE_IDENTITY_KEY. * * The combined packing (blueprint D12): the `runtime` container runs the core * and loop services, and the `gateway` container runs gates: the Model Gate, * which alone reads model credentials, and the Tool Gate (F4.1), which alone * holds remote MCP connections and their credentials and makes every HTTP tool * request. Every model call, remote MCP call and HTTP tool call of the loop crosses it * (NYLORUN_GATES_URL, with NYLORUN_GATES_TOKEN from `.env`, or a run's token from the * harness). The gateway also runs keys (F4.2): the only * holder of the vault key, it runs every vault write that touches a secret and signs * every token (NYLORUN_KEYS_URL). The gateway mounts only the Host's Tenant directory * (`tenant/`) and its keys directory (`keys/`, the vault key), read-only: never * host-credentials.json. The runtime mounts the Host root with `keys/` and `docker/` * covered by empty read-only mounts, so it can read neither the vault key nor * Restate's private key and `.env`. The runtime does not wait for the gateway: while * it is down, model, MCP and HTTP tool calls fail, vault writes and * token minting answer 503, and the session takes the next message. * * The Object store (blueprint D35) is RustFS, single node and single drive, pinned by digest, * on the `rustfs` volume; it is not published. Its credential is the access key `nylorun` and * the secret key NYLORUN_OBJECT_STORE_SECRET_KEY from `.env`, and only the runtime and the * gateway receive it (NYLORUN_OBJECT_STORE_*). The runtime creates the bucket at boot and * reaches the store through its `s3` BlobStore. * * With `sandboxes` (after `nylorun local sandbox enable`, F7.2) the `sandboxes` service runs the * agent-sandbox driver: the only container holding the cluster credentials * (`/sandboxes`, read-only), not published, reached by the runtime alone with * NYLORUN_SANDBOXES_TOKEN. The runtime gets an empty read-only mount over that directory. * Sandbox pods reach the stack only on the Docker host's address (NYLORUN_SANDBOX_HOST_ADDRESS), * where three ports are published on NYLORUN_SANDBOX_BIND: the runtime's Harness API listener * (NYLORUN_SANDBOX_HARNESS_PORT → 4200: pods join and connect with host tokens), the * gateway's gates (NYLORUN_SANDBOX_GATES_PORT → 4100: model and MCP calls with run tokens) and * egress-gate (NYLORUN_SANDBOX_EGRESS_PORT → 4200 in the gateway, `--service gates,keys,egress`: * CONNECT with the egress token, to the hosts the sandbox spec allows). The two HTTP listeners * accept that address as a Host. * * The harness (F6.2, `harness: "remote"`, the default) runs every agent turn and workspace in * its own container: the runtime image with `--service harness`, connected to core's Harness * API (`ws://runtime:4200/nylorun/harness/v1`) with NYLORUN_HARNESS_TOKEN, its only * credential, and calling models and remote MCP servers through the gateway with each run's * token. It mounts only the Tenant's `sandboxes/` under `/harness`. NYLORUN_HARNESS=in-process * in `.env` rolls back to turns in the runtime container, without the harness service. * * Three networks: `store` (internal: no egress) joins Postgres, s2-lite, Restate and RustFS to * the runtime and the gateway; `harness` joins the harness to the runtime and the gateway only; * `default` carries egress and the published ports (runtime, gateway, Studio, sandboxes). * Restate's admin port (its UI, unauthenticated) is published, and Restate joins `default`, * only with `restateUi` (`nylorun start --restate-ui`). * * With `identity` (when `/identity.yaml` exists) the runtime reads its trusted issuers * from it, through the Host root mount (NYLORUN_IDENTITY_FILE=/nylorun/identity.yaml). * * The healthchecks and Postgres's WAL cap come from the CLI tuning (`NYLORUN_CLI_TUNING`). The * `tmpfs` masks are empty: 4096 bytes is one page, the least a tmpfs takes (Linux's page size). */ export declare function renderComposeFile(project: string, name: string, options?: { sandboxes?: true; /** The sandboxes container serves the edge (backend substrate, ADR-138). */ sandboxEdge?: true; /** The edge also serves the keys provider's port (ADR-142). */ sandboxKeys?: true; harness?: "remote" | "in-process"; restateUi?: true; identity?: true; }): string;