@usine/executor 0.6.1-next.465.g7204c3c.1.1 → 0.6.1-next.470.g5ae7631.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.
- package/README.md +6 -4
- package/dist/executor.d.ts +4 -4
- package/dist/remote/commands.d.ts +4 -4
- package/dist/remote/commands.d.ts.map +1 -1
- package/dist/remote/commands.js +22 -24
- package/dist/remote/commands.js.map +1 -1
- package/dist/ssh/gateway/environment.d.ts +1 -3
- package/dist/ssh/gateway/environment.d.ts.map +1 -1
- package/dist/ssh/gateway/environment.js +0 -8
- package/dist/ssh/gateway/environment.js.map +1 -1
- package/dist/ssh/gateway/preflight.d.ts.map +1 -1
- package/dist/ssh/gateway/preflight.js +10 -5
- package/dist/ssh/gateway/preflight.js.map +1 -1
- package/dist/ssh/gateway/tailnet.d.ts +1 -2
- package/dist/ssh/gateway/tailnet.d.ts.map +1 -1
- package/dist/ssh/gateway/tailnet.js +2 -9
- package/dist/ssh/gateway/tailnet.js.map +1 -1
- package/dist/ssh/model.d.ts +25 -7
- package/dist/ssh/model.d.ts.map +1 -1
- package/dist/ssh/model.js +4 -4
- package/dist/ssh/model.js.map +1 -1
- package/dist/ssh/preflight.d.ts.map +1 -1
- package/dist/ssh/preflight.js +1 -1
- package/dist/ssh/preflight.js.map +1 -1
- package/dist/ssh/provisioner/boxd/api-pb.d.ts +549 -0
- package/dist/ssh/provisioner/boxd/api-pb.d.ts.map +1 -0
- package/dist/ssh/provisioner/boxd/api-pb.js +210 -0
- package/dist/ssh/provisioner/boxd/api-pb.js.map +1 -0
- package/dist/ssh/provisioner/boxd/client.d.ts +78 -0
- package/dist/ssh/provisioner/boxd/client.d.ts.map +1 -0
- package/dist/ssh/provisioner/boxd/client.js +34 -0
- package/dist/ssh/provisioner/boxd/client.js.map +1 -0
- package/dist/ssh/provisioner/boxd/grpc-client.d.ts +10 -0
- package/dist/ssh/provisioner/boxd/grpc-client.d.ts.map +1 -0
- package/dist/ssh/provisioner/boxd/grpc-client.js +130 -0
- package/dist/ssh/provisioner/boxd/grpc-client.js.map +1 -0
- package/dist/ssh/provisioner/boxd.d.ts +37 -0
- package/dist/ssh/provisioner/boxd.d.ts.map +1 -0
- package/dist/ssh/provisioner/boxd.js +235 -0
- package/dist/ssh/provisioner/boxd.js.map +1 -0
- package/dist/ssh/provisioner/drivers.d.ts +1 -1
- package/dist/ssh/provisioner/drivers.d.ts.map +1 -1
- package/dist/ssh/provisioner/drivers.js +10 -1
- package/dist/ssh/provisioner/drivers.js.map +1 -1
- package/dist/ssh/provisioner/machines.d.ts +1 -1
- package/dist/ssh/provisioner/machines.d.ts.map +1 -1
- package/dist/ssh/provisioner/machines.js +2 -2
- package/dist/ssh/provisioner/machines.js.map +1 -1
- package/dist/ssh/provisioner/model.d.ts +1 -1
- package/dist/ssh/provisioner/starts.d.ts +1 -1
- package/dist/ssh/provisioner/tailnet/bootstrap.d.ts +3 -4
- package/dist/ssh/provisioner/tailnet/bootstrap.d.ts.map +1 -1
- package/dist/ssh/provisioner/tailnet/bootstrap.js +14 -16
- package/dist/ssh/provisioner/tailnet/bootstrap.js.map +1 -1
- package/dist/ssh/provisioner/tailnet/client.d.ts +2 -2
- package/dist/ssh/provisioner/tailnet/client.d.ts.map +1 -1
- package/dist/ssh/provisioner/tailnet/client.js.map +1 -1
- package/dist/ssh/ssh.d.ts +1 -1
- package/dist/ssh/ssh.d.ts.map +1 -1
- package/dist/ssh/ssh.js.map +1 -1
- package/package.json +13 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @usine/executor
|
|
2
2
|
|
|
3
|
-
Gateway, provisioner API-key, and Cloudflare environment wiring reads the registered harness descriptors. Credential preparation selects the attempt's harness before adding its variables or forwarding tokens; repository-only recovery commands use the base git and gh environment. Other harnesses' variables and provisioner API keys do not enter the launched process or its tool commands. SSH
|
|
3
|
+
Gateway, provisioner API-key, and Cloudflare environment wiring reads the registered harness descriptors. Credential preparation selects the attempt's harness before adding its variables or forwarding tokens; repository-only recovery commands use the base git and gh environment. Other harnesses' variables and provisioner API keys do not enter the launched process or its tool commands. SSH workers receive the base git and gh variables, harness tokens whose protocols the gateway serves, and provisioner API keys as an environment block on each command's stdin; gateway preflight checks that they arrive. SSH attempt homes are tracked per harness and attempt and mounted writable when required. Scope closure removes a home only after its attempt checkout is gone, preserving Codex threads and Claude Code container sessions across orchestrator stops and restarts. Claude projects are stored in `<root>/workers/<name>/claude/<attempt>` and mounted writable at `/home/usine/.claude/projects`, separately from the existing credential mounts. Shared-user SSH uses the worker login and session directories. Cleanup preserves homes still in use or associated with an existing checkout.
|
|
4
4
|
|
|
5
5
|
Worker execution for [usine](https://github.com/basaltbytes/usine). The platform-free root defines worker preflight, scoped attempt preparation, and cancellation, plus the credential provider, worker capability errors, and adapter-neutral request types. Each prepared attempt runs its Pi parent in this process as a durable task, tells it where the worker runs children (local processes, SSH on an exe.dev VM or any Linux machine, or a Cloudflare sandbox), and releases its resources at completion or when its scope closes. [Attempt execution](https://github.com/basaltbytes/usine/blob/main/docs/architecture/execution.mdx) and [Workers and the gateway](https://github.com/basaltbytes/usine/blob/main/docs/architecture/workers-and-gateway.mdx) cover the executors.
|
|
6
6
|
|
|
@@ -214,11 +214,11 @@ The gateway command persists attachments, allowing requests immediately after a
|
|
|
214
214
|
|
|
215
215
|
The cached clone fetches `http://git.<domain>/<repository>.git`. Children, harvesting, and the executor's git commands export settings that point git, gh, and package managers at the gateway: git sends the caller token only to `git.<domain>` and rewrites `https://github.com/` there, gh uses `git.<domain>` through the worker's socket with its config in `<root>/workers/<name>/gh`, and `HTTPS_PROXY` is the forward proxy.
|
|
216
216
|
|
|
217
|
-
If the gateway has the Anthropic credential, Claude Code calls `llm.<domain>/anthropic-messages`, and preflight checks only its binary. If it has the OpenAI credential, prepare writes Codex's `config.toml` to the attempt's Codex home, `<root>/workers/<name>/codex/<attempt>`, children get that directory as `CODEX_HOME`, and Codex sends the Responses API to `llm.<domain>/openai-responses/v1` with the caller token from `USINE_GATEWAY_TOKEN`; preflight checks only its binary and version. The file has a `model_provider` and no token. Codex also writes its sessions there, so an attempt's container mounts the directory read-write, and cleanup removes it after the container. An orderly orchestrator stop or a crash keeps the directory while the checkout remains, so reattached children can resume their saved threads. `Executor.sweep` removes each Codex home on a worker with its own machine whose attempt has no checkout there and that no attempt in this process holds; an attempt holds its Codex home from before it's written until its credential scope closes. A checkout kept for a reattachment or with unpreserved work keeps its Codex home, and a later sweep removes it after the checkout is gone. The sweep visits only the workers the executor has. For a worker that `usine.yaml` no longer declares, `sshWorkerRecordsFor(directory).discard(worker, attempts)` removes the Codex homes of the attempts whose leftovers the operator discarded, over SSH with the worker's port and key from its record in `directory`, and never fails. Without a record, it removes nothing. Otherwise each harness uses the operator's login on the machine through the forward proxy: preflight checks the login as without a gateway, then that each of the login's hosts answers HTTP through the proxy (`api.anthropic.com` and `platform.claude.com`, or `chatgpt.com` and `auth.openai.com`). A refused host is a `gateway` capability error naming the host to add to the egress allowlist. The caller token is in no command line: each SSH command sends `GIT_CONFIG_VALUE_0`, `GH_ENTERPRISE_TOKEN`, `GH_TOKEN`, `ANTHROPIC_AUTH_TOKEN`, and `USINE_GATEWAY_TOKEN`
|
|
217
|
+
If the gateway has the Anthropic credential, Claude Code calls `llm.<domain>/anthropic-messages`, and preflight checks only its binary. If it has the OpenAI credential, prepare writes Codex's `config.toml` to the attempt's Codex home, `<root>/workers/<name>/codex/<attempt>`, children get that directory as `CODEX_HOME`, and Codex sends the Responses API to `llm.<domain>/openai-responses/v1` with the caller token from `USINE_GATEWAY_TOKEN`; preflight checks only its binary and version. The file has a `model_provider` and no token. Codex also writes its sessions there, so an attempt's container mounts the directory read-write, and cleanup removes it after the container. An orderly orchestrator stop or a crash keeps the directory while the checkout remains, so reattached children can resume their saved threads. `Executor.sweep` removes each Codex home on a worker with its own machine whose attempt has no checkout there and that no attempt in this process holds; an attempt holds its Codex home from before it's written until its credential scope closes. A checkout kept for a reattachment or with unpreserved work keeps its Codex home, and a later sweep removes it after the checkout is gone. The sweep visits only the workers the executor has. For a worker that `usine.yaml` no longer declares, `sshWorkerRecordsFor(directory).discard(worker, attempts)` removes the Codex homes of the attempts whose leftovers the operator discarded, over SSH with the worker's port and key from its record in `directory`, and never fails. Without a record, it removes nothing. Otherwise each harness uses the operator's login on the machine through the forward proxy: preflight checks the login as without a gateway, then that each of the login's hosts answers HTTP through the proxy (`api.anthropic.com` and `platform.claude.com`, or `chatgpt.com` and `auth.openai.com`). A refused host is a `gateway` capability error naming the host to add to the egress allowlist. The caller token is in no command line: each SSH command sends `GIT_CONFIG_VALUE_0`, `GH_ENTERPRISE_TOKEN`, `GH_TOKEN`, `ANTHROPIC_AUTH_TOKEN`, and `USINE_GATEWAY_TOKEN` as a base64 environment block on its stdin. The remote shell consumes that block before command or child-protocol input, with no credential file, so the machine needs a POSIX `sh` and `base64` but no sshd `AcceptEnv` entry. Provisioner API keys, reused machines, and salvage after an orchestrator restart use the same block. With a container runtime, only the cached clone's fetch sends them; the attempt's container gets them when it starts.
|
|
218
218
|
|
|
219
219
|
The admin API listens on the gateway's loopback. With the first worker behind a gateway, the executor opens its own forward, `ssh -N -L 127.0.0.1:<port>:127.0.0.1:<adminPort> <destination>`, with the same SSH command and environment as its other clients, on a local port the kernel picks; workers behind that gateway share it. When the client exits, the executor starts another after a pause of one second, doubling up to one minute, and logs each open, exit, and reopen with the gateway's destination. An admin request that finds the forward closed, or gets no answer, reopens it at once and is sent once more. A second failure fails the request, with a message giving since when the forward has been closed, or, if it opens but the admin API doesn't answer, since when the API last answered through it. The forward closes when the last worker behind the gateway is removed, or with the layer.
|
|
220
220
|
|
|
221
|
-
Preflight also checks, without attaching, that the forward opens (giving the `ssh` command to run if it doesn't), that the admin API accepts the admin token, that
|
|
221
|
+
Preflight also checks, without attaching, that the forward opens (giving the `ssh` command to run if it doesn't), that the admin API accepts the admin token, that the machine receives placeholder caller token variables over stdin (a gap names the missing variables), and that the machine reaches `git.<domain>`, which refuses requests without a caller token. A gap is a `gateway` `WorkerCapabilityError`.
|
|
222
222
|
|
|
223
223
|
If the worker's `llmProviders` lists a provider, preflight also reads the gateway's credential kinds (`GET /v1/providers`) and records them with the worker, and logs each provider's mode in `SSH Worker Gateway verified`: `gateway-api-key`, `gateway-subscription`, or `worker-login`. A gateway without a listed provider's credential is a `gateway` capability error, and so is one too old to report its credentials while `llmProviders` lists `openai`. Each child reads its provider's recorded kind as `AttemptRequest.gatewayCredential` when it starts: Anthropic's for Claude Code, OpenAI's for Codex, none for Pi. Its session records the credential, and usage counts a child on the gateway's API key in the API keys pool, and on a subscription in the Claude or ChatGPT plan pool ([ADR 0013](../../docs/adr/0013-cost-accounting-native-meters-guardrails.md)).
|
|
224
224
|
|
|
@@ -342,7 +342,7 @@ const executorLayer = layer({
|
|
|
342
342
|
|
|
343
343
|
Boat workers can use gateway subscription credentials over Tailscale. Set `snapshot` and `tailnet` on their provisioner. Preflight checks the saved snapshot, OAuth key creation, and the gateway address. After SSH readiness, the executor joins with a single-use ephemeral key on stdin and configures gateway names in the host and container. Boat uses its own SSH endpoint and direct internet access for downloads. Cleanup logs out before sandbox deletion; orphan reconciliation and ephemeral expiry cover interrupted cleanup. Build snapshots with `infra/boat/build-snapshot.sh`; see the [setup guide](https://docs.usine.dev/guides/add-a-provisioned-worker/#gateway-subscriptions-over-tailscale).
|
|
344
344
|
|
|
345
|
-
Long-lived SSH machines can set `machine.tailnet` to `Option.some({ gatewayAddress })` when already joined to Tailscale. Preflight configures gateway host entries
|
|
345
|
+
Long-lived SSH machines can set `machine.tailnet` to `Option.some({ gatewayAddress })` when already joined to Tailscale. Preflight configures gateway host entries and gh's HTTP socket through passwordless sudo, then verifies gateway access. These workers use direct internet egress and container host entries like Boat; cleanup preserves their tailnet identity. See the [home-worker guide](https://docs.usine.dev/guides/add-an-ssh-worker/#home-worker-on-a-mac).
|
|
346
346
|
|
|
347
347
|
Worker liveness notices report the first unanswered SSH probe and the third consecutive unanswered probe, with `unansweredProbes` and `lastAnsweredAt`. A new attempt on a silent worker receives the current count. Recovery emits `WorkerResponsive`; connectivity loss leaves attempts running.
|
|
348
348
|
|
|
@@ -377,3 +377,5 @@ Run `pnpm --filter @usine/executor check` after building dependencies to check T
|
|
|
377
377
|
Preparation creates `.usine/outputs/` and excludes `.usine/` from Git commits and salvage. After the parent reports, all worker adapters collect whole JSON documents through the checkout command runner and attempt container. Each envelope contains a non-empty opaque `type` of at most 128 UTF-16 code units, JSON `content`, and an optional `commit` matching `RunSpec.baseCommit`. Invalid output files fail with a file-specific `AgentFailure` and ordinary salvage still runs.
|
|
378
378
|
|
|
379
379
|
`PreparedAttempt.launch` and `Executor.outcome` return `StepCompletion`, whose `result` contains output refs and whose `outputs` contains the full documents. Durable storage records both before checkout cleanup. Collection allows at most ten files of at most 8 MiB each, with the same size limit on each compact JSON content body. The orchestrator caps command output before decoding and independently checks the count and content sizes.
|
|
380
|
+
|
|
381
|
+
The SSH provisioner restores boxd machines from prepared snapshots, validates their captured size and region, disables idle timers, and pins the regional SSH proxy key. Boat and boxd share the provisioner tailnet bootstrap. The gRPC transport uses a generated projection of the boxd 0.3.0 API behind a decoded client port; regenerate it with `pnpm boxd:generate` from this package. See [Add a boxd worker](https://docs.usine.dev/guides/add-a-boxd-worker/) for snapshot and live-test setup.
|
package/dist/executor.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export declare const MachineUnavailableReason: Schema.Literals<readonly ["capaci
|
|
|
81
81
|
export type MachineUnavailableReason = typeof MachineUnavailableReason.Type;
|
|
82
82
|
declare const MachineUnavailableError_base: Schema.Class<MachineUnavailableError, Schema.TaggedStruct<"MachineUnavailableError", {
|
|
83
83
|
readonly worker: Schema.brand<Schema.String, "WorkerName">;
|
|
84
|
-
readonly provider: Schema.Literals<readonly ["hetzner", "boat"]>;
|
|
84
|
+
readonly provider: Schema.Literals<readonly ["hetzner", "boat", "boxd"]>;
|
|
85
85
|
readonly reason: Schema.Literals<readonly ["capacity", "quota", "refused", "provider", "unreachable", "timeout"]>;
|
|
86
86
|
/** An operator-facing summary with the provider's own message. Contains no token. */
|
|
87
87
|
readonly message: Schema.NonEmptyString;
|
|
@@ -309,7 +309,7 @@ declare const MachineGrant_base: Schema.Class<MachineGrant, Schema.Struct<{
|
|
|
309
309
|
readonly hold: Schema.brand<Schema.NonEmptyString, "MachineHold">;
|
|
310
310
|
readonly id: Schema.brand<Schema.String, "MachineId">;
|
|
311
311
|
readonly worker: Schema.brand<Schema.String, "WorkerName">;
|
|
312
|
-
readonly provider: Schema.Literals<readonly ["hetzner", "boat"]>;
|
|
312
|
+
readonly provider: Schema.Literals<readonly ["hetzner", "boat", "boxd"]>;
|
|
313
313
|
/** The check that this machine got as the Worker's first each day, or `None` if it got none. */
|
|
314
314
|
readonly checked: Schema.Option<typeof MachineCheck>;
|
|
315
315
|
}>, Brand.Brand<"@usine/executor/executor/MachineGrant">>;
|
|
@@ -325,7 +325,7 @@ export declare const MachineState: Schema.Literals<readonly ["creating", "prepar
|
|
|
325
325
|
export type MachineState = typeof MachineState.Type;
|
|
326
326
|
declare const MachineStatus_base: Schema.Class<MachineStatus, Schema.Struct<{
|
|
327
327
|
readonly worker: Schema.brand<Schema.String, "WorkerName">;
|
|
328
|
-
readonly provider: Schema.Literals<readonly ["hetzner", "boat"]>;
|
|
328
|
+
readonly provider: Schema.Literals<readonly ["hetzner", "boat", "boxd"]>;
|
|
329
329
|
readonly state: Schema.Literals<readonly ["creating", "preparing", "ready", "idle", "deleting"]>;
|
|
330
330
|
/** `None` until the provider accepts the creation. */
|
|
331
331
|
readonly id: Schema.Option<Schema.brand<Schema.String, "MachineId">>;
|
|
@@ -342,7 +342,7 @@ export declare class MachineStatus extends MachineStatus_base {
|
|
|
342
342
|
}
|
|
343
343
|
declare const MachineStarts_base: Schema.Class<MachineStarts, Schema.Struct<{
|
|
344
344
|
readonly worker: Schema.brand<Schema.String, "WorkerName">;
|
|
345
|
-
readonly provider: Schema.Literals<readonly ["hetzner", "boat"]>;
|
|
345
|
+
readonly provider: Schema.Literals<readonly ["hetzner", "boat", "boxd"]>;
|
|
346
346
|
readonly day: Schema.String;
|
|
347
347
|
readonly count: Schema.Int;
|
|
348
348
|
}>, Brand.Brand<"@usine/executor/executor/MachineStarts">>;
|
|
@@ -3,7 +3,7 @@ import type { SshDestination } from "@usine/core/worker";
|
|
|
3
3
|
import { Effect, Redacted } from "effect";
|
|
4
4
|
import { ChildProcessSpawner } from "effect/process";
|
|
5
5
|
import { type CommandResult } from "../child-command.ts";
|
|
6
|
-
import type
|
|
6
|
+
import { type ExecutorOperation, ExecutorOperationError } from "../executor.ts";
|
|
7
7
|
/**
|
|
8
8
|
* The working directory and extra environment for a remote command. `scrub` is applied to the
|
|
9
9
|
* output first, so a credential printed by git or gh isn't kept in any error, log, or parsed
|
|
@@ -36,9 +36,9 @@ export declare const SSH_ENVIRONMENT_ALLOWLIST: readonly ["HOME", "LANG", "LC_AL
|
|
|
36
36
|
*/
|
|
37
37
|
export declare const DEFAULT_SSH: SshCommand;
|
|
38
38
|
/**
|
|
39
|
-
* Returns `shell` with `variables`
|
|
40
|
-
* so the values
|
|
41
|
-
*
|
|
39
|
+
* Returns `shell` with `variables` added to the environment block that each command reads from
|
|
40
|
+
* stdin before it starts, so the values stay out of command arguments and the SSH client's
|
|
41
|
+
* environment.
|
|
42
42
|
*/
|
|
43
43
|
export declare const sendingShell: (shell: RemoteShell, variables: Readonly<Record<string, Redacted.Redacted<string>>>) => RemoteShell;
|
|
44
44
|
/** The `RemoteCommands` that use this process's spawner and the allowlisted SSH environment. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/remote/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,WAAW,EACX,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/remote/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,K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CAAC,GAAG,EAAE,CACZ,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,OAAO,CAAC,EAAE,aAAa,KACpB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IACnD,kGAAkG;IAClG,QAAQ,CAAC,YAAY,EAAE,CACrB,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,KAC7B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;CACpD;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,YACpC,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,OAAO,EACP,eAAe,EACf,eAAe,EACf,QAAQ,EACR,MAAM,CACE,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,UAGzB,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,YAAY,UAChB,WAAW,aACP,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAC7D,WAMK,CAAC;AAET,gGAAgG;AAChG,eAAO,MAAM,iBAAiB;oBAIL,UAAU,eAAe,cAAc;;yBAsCjD,iBAAiB,SACrB,WAAW,WACT,MAAM,QACT,aAAa,CAAC,MAAM,CAAC,KAC1B,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,sBAAsB,CAAC;;;kDAuEvD,CAAC"}
|
package/dist/remote/commands.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { RemoteShell, sshArguments, } from "@usine/agents/child-host";
|
|
1
|
+
import { RemoteShell, sshArguments, sshInput, } from "@usine/agents/child-host";
|
|
2
2
|
import { Effect, Redacted, Stream } from "effect";
|
|
3
3
|
import { ChildProcessSpawner } from "effect/process";
|
|
4
4
|
import { allowlistedEnvironment, collectCommand, requireSuccess, } from "../child-command.js";
|
|
5
|
+
import { ExecutorOperationError } from "../executor.js";
|
|
5
6
|
/**
|
|
6
7
|
* The variables the local SSH client inherits. GitHub and factory credentials in the
|
|
7
8
|
* orchestrator environment aren't passed to the client or the machine.
|
|
@@ -27,43 +28,34 @@ export const DEFAULT_SSH = {
|
|
|
27
28
|
};
|
|
28
29
|
const encoder = new TextEncoder();
|
|
29
30
|
/**
|
|
30
|
-
* Returns `shell` with `variables`
|
|
31
|
-
* so the values
|
|
32
|
-
*
|
|
31
|
+
* Returns `shell` with `variables` added to the environment block that each command reads from
|
|
32
|
+
* stdin before it starts, so the values stay out of command arguments and the SSH client's
|
|
33
|
+
* environment.
|
|
33
34
|
*/
|
|
34
|
-
export const sendingShell = (shell, variables) =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
ssh: {
|
|
40
|
-
command: shell.ssh.command,
|
|
41
|
-
args: [...shell.ssh.args, "-o", `SendEnv=${entries.map(([name]) => name).join(" ")}`],
|
|
42
|
-
},
|
|
43
|
-
sshEnvironment: {
|
|
44
|
-
...shell.sshEnvironment,
|
|
45
|
-
...Object.fromEntries(entries.map(([name, value]) => [name, Redacted.value(value)])),
|
|
46
|
-
},
|
|
47
|
-
destination: shell.destination,
|
|
35
|
+
export const sendingShell = (shell, variables) => Object.keys(variables).length === 0
|
|
36
|
+
? shell
|
|
37
|
+
: RemoteShell.make({
|
|
38
|
+
...shell,
|
|
39
|
+
stdinEnvironment: { ...shell.stdinEnvironment, ...variables },
|
|
48
40
|
});
|
|
49
|
-
};
|
|
50
41
|
/** The `RemoteCommands` that use this process's spawner and the allowlisted SSH environment. */
|
|
51
42
|
export const remoteCommandsFor = Effect.gen(function* () {
|
|
52
43
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
53
44
|
const environment = yield* allowlistedEnvironment(SSH_ENVIRONMENT_ALLOWLIST);
|
|
54
45
|
const shellFor = (ssh, destination) => RemoteShell.make({ ssh, sshEnvironment: environment, destination });
|
|
55
|
-
const executeRaw = Effect.fn("RemoteExecutor.executeRaw")(function* (operation, host, command, args, clientEnvironment, maxOutputBytes) {
|
|
46
|
+
const executeRaw = Effect.fn("RemoteExecutor.executeRaw")(function* (operation, host, command, args, clientEnvironment, maxOutputBytes, input = Stream.empty) {
|
|
56
47
|
yield* Effect.annotateCurrentSpan({ host, operation });
|
|
57
48
|
return yield* collectCommand(spawner, operation, command, args, {
|
|
58
49
|
env: { ...clientEnvironment },
|
|
59
50
|
extendEnv: false,
|
|
51
|
+
stdin: input,
|
|
60
52
|
}, maxOutputBytes);
|
|
61
53
|
});
|
|
62
54
|
const local = Effect.fn("RemoteExecutor.local")(function* (operation, host, command, args) {
|
|
63
55
|
const result = yield* executeRaw(operation, host, command, args, environment);
|
|
64
56
|
return yield* requireSuccess(operation, host, command, args, result);
|
|
65
57
|
});
|
|
66
|
-
const inspect = (operation, shell, command, args) => executeRaw(operation, shell.destination, shell.ssh.command, sshArguments(shell, { command, args }), shell.sshEnvironment);
|
|
58
|
+
const inspect = (operation, shell, command, args) => executeRaw(operation, shell.destination, shell.ssh.command, sshArguments(shell, { command, args }), shell.sshEnvironment, undefined, sshInput(shell, Stream.empty));
|
|
67
59
|
const run = Effect.fn("RemoteExecutor.run")(function* (operation, shell, command, args, context = {}) {
|
|
68
60
|
const sshArgs = sshArguments(shell, {
|
|
69
61
|
cwd: context.cwd,
|
|
@@ -71,7 +63,7 @@ export const remoteCommandsFor = Effect.gen(function* () {
|
|
|
71
63
|
command,
|
|
72
64
|
args,
|
|
73
65
|
});
|
|
74
|
-
const result = yield* executeRaw(operation, shell.destination, shell.ssh.command, sshArgs, shell.sshEnvironment, context.maxOutputBytes);
|
|
66
|
+
const result = yield* executeRaw(operation, shell.destination, shell.ssh.command, sshArgs, shell.sshEnvironment, context.maxOutputBytes, sshInput(shell, Stream.empty));
|
|
75
67
|
const scrub = context.scrub ?? ((text) => text);
|
|
76
68
|
return yield* requireSuccess(operation, shell.destination, shell.ssh.command, sshArgs, {
|
|
77
69
|
...result,
|
|
@@ -85,7 +77,7 @@ export const remoteCommandsFor = Effect.gen(function* () {
|
|
|
85
77
|
const result = yield* collectCommand(spawner, operation, shell.ssh.command, sshArgs, {
|
|
86
78
|
env: { ...shell.sshEnvironment },
|
|
87
79
|
extendEnv: false,
|
|
88
|
-
stdin: Stream.make(encoder.encode(Redacted.value(input))),
|
|
80
|
+
stdin: sshInput(shell, Stream.make(encoder.encode(Redacted.value(input)))),
|
|
89
81
|
});
|
|
90
82
|
const secret = Redacted.value(input);
|
|
91
83
|
const scrub = (text) => (secret === "" ? text : text.replaceAll(secret, "[REDACTED]"));
|
|
@@ -95,6 +87,12 @@ export const remoteCommandsFor = Effect.gen(function* () {
|
|
|
95
87
|
stderr: scrub(result.stderr),
|
|
96
88
|
});
|
|
97
89
|
});
|
|
98
|
-
return {
|
|
90
|
+
return {
|
|
91
|
+
shellFor,
|
|
92
|
+
local,
|
|
93
|
+
inspect,
|
|
94
|
+
run,
|
|
95
|
+
runWithInput,
|
|
96
|
+
};
|
|
99
97
|
});
|
|
100
98
|
//# sourceMappingURL=commands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/remote/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAEX,YAAY,
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/remote/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAEX,YAAY,EACZ,QAAQ,GACT,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,mB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Harness } from "@usine/core/agent/brain";
|
|
2
|
-
import {
|
|
2
|
+
import type { HarnessCatalog } from "@usine/agents/harness";
|
|
3
3
|
import type { RepositoryName } from "@usine/core/repository";
|
|
4
4
|
import type { GatewayDomain, GatewayLlmProtocol } from "@usine/core/worker";
|
|
5
5
|
import { type CallerToken } from "@usine/gateway/admin";
|
|
6
6
|
import { Option, Redacted } from "effect";
|
|
7
7
|
/** The directory of the Unix socket that gh reaches the Gateway through. */
|
|
8
8
|
export declare const GH_GATEWAY_SOCKET_DIRECTORY = "/run/usine-gateway";
|
|
9
|
-
/** Caller-token variables that the worker's sshd must accept. */
|
|
10
|
-
export declare const gatewaySentVariables: (catalog: HarnessCatalog) => string[];
|
|
11
9
|
/** Returns the Gateway's forward proxy URL from a Worker; children receive it as `HTTPS_PROXY`. */
|
|
12
10
|
export declare const forwardProxyUrl: (domain: GatewayDomain) => string;
|
|
13
11
|
/** Returns the URL a Worker behind the Gateway clones and fetches `repository` from. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/ssh/gateway/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/ssh/gateway/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAwB,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAA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O,MAAM,0BAA0B,aAC3B,IAAI,CAAC,yBAAyB,EAAE,SAAS,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,CAAC,qBACxE,MAAM,KACxB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOrB,CAAC;AAEd;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,YACpB,yBAAyB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;CAAE,KAChF,kBA0CF,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { gatewayTokenVariables } from "@usine/agents/harness";
|
|
2
1
|
import { GATEWAY_TOKEN_HEADER } from "@usine/gateway/admin";
|
|
3
2
|
import { Option, Redacted } from "effect";
|
|
4
3
|
/** The directory of the Unix socket that gh reaches the Gateway through. */
|
|
@@ -10,13 +9,6 @@ export const GH_GATEWAY_SOCKET_DIRECTORY = "/run/usine-gateway";
|
|
|
10
9
|
*/
|
|
11
10
|
const GH_GATEWAY_SOCKET = `${GH_GATEWAY_SOCKET_DIRECTORY}/http.sock`;
|
|
12
11
|
const FORWARD_PROXY_PORT = 3128;
|
|
13
|
-
/** Caller-token variables that the worker's sshd must accept. */
|
|
14
|
-
export const gatewaySentVariables = (catalog) => [
|
|
15
|
-
"GIT_CONFIG_VALUE_0",
|
|
16
|
-
"GH_ENTERPRISE_TOKEN",
|
|
17
|
-
"GH_TOKEN",
|
|
18
|
-
...gatewayTokenVariables(catalog),
|
|
19
|
-
];
|
|
20
12
|
/** Returns the Gateway's forward proxy URL from a Worker; children receive it as `HTTPS_PROXY`. */
|
|
21
13
|
export const forwardProxyUrl = (domain) => `http://${domain}:${FORWARD_PROXY_PORT}`;
|
|
22
14
|
/** Returns the URL a Worker behind the Gateway clones and fetches `repository` from. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/ssh/gateway/environment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/ssh/gateway/environment.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE1C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,GAAG,2BAA2B,YAAY,CAAC;AAErE,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,mGAAmG;AACnG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAqB,EAAU,EAAE,CAC/D,UAAU,MAAM,IAAI,kBAAkB,EAAE,CAAC;AAE3C,wFAAwF;AACxF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAqB,EAAE,UAA0B,EAAU,EAAE,CAChG,cAAc,MAAM,IAAI,UAAU,MAAM,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAqB,EAAE,EAAE,CACvD,CAAC;IACC,YAAY,EAAE,mCAAmC,iBAAiB,IAAI;IACtE,WAAW,EAAE,OAAO,MAAM,8BAA8B;CACzD,CAAU,CAAC;AAcd;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,OAAuD,EACG,EAAE;IAC5D,MAAM,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO;QACL,CAAC,GAAG,OAAO,CAAC,iBAAiB,aAAa,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC;QAC7D,CAAC,GAAG,OAAO,CAAC,iBAAiB,YAAY,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC;QAC3D,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAA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E,CAAC,CAAC;IAClC,OAAO,EAAE,EAAE;IACX,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,OAAO,CAAC,MAAM,IAAI,WAAW,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;CAC1F,CAAC,CAAC,CACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../../src/ssh/gateway/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAa,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAsB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAiB,MAAM,QAAQ,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,KAAK,cAAc,EAAgB,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAsB,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAiHlF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,YACtB,cAAc,WACd,cAAc,WACd,OAAO,KACf,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAKlD,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,6IAqC7B,CAAC;
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../../src/ssh/gateway/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAa,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAsB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAiB,MAAM,QAAQ,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,KAAK,cAAc,EAAgB,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAsB,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAiHlF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,YACtB,cAAc,WACd,cAAc,WACd,OAAO,KACf,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAKlD,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,6IAqC7B,CAAC;AAwFH;;;GAGG;AACH,eAAO,MAAM,aAAa,YACf,cAAc,YACb,cAAc,UAChB,UAAU,WACT,UAAU,WACV,cAAc,oFAItB,CAAC;AAqBJ;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,YACrB,cAAc,YACb,cAAc,WACf,UAAU,WACV,cAAc,SAChB,YAAY,SACZ,WAAW,YACR,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,YAC7B,YAAY,KACrB,YAqFF,CAAC"}
|
|
@@ -112,8 +112,8 @@ export const verifyGatewayAdmin = Effect.fn("SshExecutor.verifyGatewayAdmin")(fu
|
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
114
|
/**
|
|
115
|
-
* Verifies the Gateway from an SSH Worker's machine without attaching anything: the machine
|
|
116
|
-
*
|
|
115
|
+
* Verifies the Gateway from an SSH Worker's machine without attaching anything: the machine
|
|
116
|
+
* receives the caller-token variables, and the machine can connect to `git.<domain>`, which
|
|
117
117
|
* rejects a request without a caller token.
|
|
118
118
|
*/
|
|
119
119
|
const verifyGatewayFromMachine = Effect.fn("SshExecutor.verifyGatewayFromMachine")(function* (catalog, commands, worker, machine, gateway) {
|
|
@@ -133,15 +133,20 @@ const verifyGatewayFromMachine = Effect.fn("SshExecutor.verifyGatewayFromMachine
|
|
|
133
133
|
...baseSent,
|
|
134
134
|
...Object.fromEntries(catalog.ids.flatMap((harness) => Object.entries(gatewayEnvironment({ ...environment, harness: Option.some(harness) }).sent))),
|
|
135
135
|
};
|
|
136
|
-
const received = yield* commands.
|
|
136
|
+
const received = yield* commands.inspect("preflight", sendingShell(machine.shell, sent), "sh", [
|
|
137
137
|
"-c",
|
|
138
138
|
SENT_VARIABLES_SCRIPT,
|
|
139
139
|
"sh",
|
|
140
140
|
...Object.entries(sent).flatMap(([name, value]) => [name, Redacted.value(value)]),
|
|
141
141
|
]);
|
|
142
|
-
|
|
142
|
+
if (received.exitCode === SSH_FAILURE)
|
|
143
|
+
return yield* unreachable(machine.shell.destination, "sh", received);
|
|
144
|
+
const dropped = received.exitCode === 0
|
|
145
|
+
? received.stdout.split("\n").filter((name) => name !== "")
|
|
146
|
+
: Object.keys(sent);
|
|
143
147
|
if (dropped.length > 0)
|
|
144
|
-
return yield* gatewayGap(worker, `
|
|
148
|
+
return yield* gatewayGap(worker, `SSH worker "${worker}" doesn't receive ${dropped.join(", ")} over standard input. Its SSH commands must run in a POSIX sh with base64.`, new Error(received.stderr.trim() ||
|
|
149
|
+
`variables not received: ${dropped.join(" ")} (exit code ${String(received.exitCode)})`));
|
|
145
150
|
const probed = yield* commands.inspect("preflight", machine.shell, "curl", [
|
|
146
151
|
"-sS",
|
|
147
152
|
"--noproxy",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../../src/ssh/gateway/preflight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,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,CACvF,EACD;QACE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC;QACjC,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,CACrC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC;YACzD,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;YACxB,CAAC,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC;KAC3D,CACF,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { HarnessCatalog } from "@usine/agents/harness";
|
|
2
1
|
import { Effect } from "effect";
|
|
3
2
|
import { WorkerCapabilityError } from "../../executor.ts";
|
|
4
3
|
import type { RemoteCommands } from "../../remote/commands.ts";
|
|
5
4
|
import type { SshMachine, SshTailnet } from "../model.ts";
|
|
6
|
-
export declare const configureTailnetGateway: (
|
|
5
|
+
export declare const configureTailnetGateway: (commands: RemoteCommands, operation: "preflight" | "prepare", machine: SshMachine, tailnet: SshTailnet, domain: string & import("effect/Brand").Brand<"GatewayDomain">) => Effect.Effect<void, WorkerCapabilityError, never>;
|
|
7
6
|
//# sourceMappingURL=tailnet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailnet.d.ts","sourceRoot":"","sources":["../../../src/ssh/gateway/tailnet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tailnet.d.ts","sourceRoot":"","sources":["../../../src/ssh/gateway/tailnet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAwC1D,eAAO,MAAM,uBAAuB,+NAqClC,CAAC"}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { WorkerCapabilityError } from "../../executor.js";
|
|
3
|
-
import { gatewaySentVariables } from "./environment.js";
|
|
4
3
|
const CONFIGURE = String.raw `
|
|
5
4
|
set -eu
|
|
6
5
|
address=$1
|
|
7
6
|
domain=$2
|
|
8
|
-
variables=$3
|
|
9
7
|
work=$(mktemp)
|
|
10
8
|
trap 'rm -f "$work"' EXIT
|
|
11
9
|
grep -v '# usine-tailnet$' /etc/hosts > "$work" || true
|
|
12
10
|
printf '%s git.%s llm.%s # usine-tailnet\n' "$address" "$domain" "$domain" >> "$work"
|
|
13
11
|
cat "$work" > /etc/hosts
|
|
14
|
-
mkdir -p /etc/ssh/sshd_config.d
|
|
15
|
-
printf 'AcceptEnv %s\n' "$variables" > /etc/ssh/sshd_config.d/40-usine-gateway.conf
|
|
16
|
-
sshd -t
|
|
17
|
-
systemctl reload ssh
|
|
18
12
|
cat > /etc/systemd/system/usine-gateway-http.socket <<UNIT
|
|
19
13
|
[Socket]
|
|
20
14
|
ListenStream=/run/usine-gateway/http.sock
|
|
@@ -43,7 +37,7 @@ if [ "$previous_proxy_unit" != "$(cat "$proxy_unit")" ]; then
|
|
|
43
37
|
systemctl try-restart usine-gateway-http.service
|
|
44
38
|
fi
|
|
45
39
|
`.trim();
|
|
46
|
-
export const configureTailnetGateway = Effect.fn("SshExecutor.configureTailnetGateway")(function* (
|
|
40
|
+
export const configureTailnetGateway = Effect.fn("SshExecutor.configureTailnetGateway")(function* (commands, operation, machine, tailnet, domain) {
|
|
47
41
|
const worker = machine.address.name;
|
|
48
42
|
const fields = {
|
|
49
43
|
worker,
|
|
@@ -61,12 +55,11 @@ export const configureTailnetGateway = Effect.fn("SshExecutor.configureTailnetGa
|
|
|
61
55
|
"sh",
|
|
62
56
|
tailnet.gatewayAddress,
|
|
63
57
|
domain,
|
|
64
|
-
gatewaySentVariables(catalog).join(" "),
|
|
65
58
|
])
|
|
66
59
|
.pipe(Effect.mapError((cause) => WorkerCapabilityError.make({
|
|
67
60
|
worker,
|
|
68
61
|
capability: "gateway",
|
|
69
|
-
message: `SSH worker "${worker}" could not configure its tailnet gateway. Check passwordless sudo
|
|
62
|
+
message: `SSH worker "${worker}" could not configure its tailnet gateway. Check passwordless sudo and systemd on the worker.`,
|
|
70
63
|
cause,
|
|
71
64
|
})), Effect.tapError((error) => Effect.logWarning(error.message, fields)));
|
|
72
65
|
yield* Effect.logInfo("Configured tailnet gateway access on the SSH worker", fields);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailnet.js","sourceRoot":"","sources":["../../../src/ssh/gateway/tailnet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tailnet.js","sourceRoot":"","sources":["../../../src/ssh/gateway/tailnet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAI1D,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC3B,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,EAAE,CAAC,qCAAqC,CAAC,CAAC,QAAQ,CAAC,EAC/F,QAAwB,EACxB,SAAkC,EAClC,OAAmB,EACnB,OAAmB,EACnB,MAAqB;IAErB,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;IACpC,MAAM,MAAM,GAAG;QACb,MAAM;QACN,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,WAAW;QAC/B,OAAO,EAAE,OAAO,CAAC,cAAc;QAC/B,MAAM;KACP,CAAC;IACF,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,KAAK,CAAC,CAAC,QAAQ;SACZ,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE;QACrC,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,SAAS;QACT,IAAI;QACJ,OAAO,CAAC,cAAc;QACtB,MAAM;KACP,CAAC;SACD,IAAI,CACH,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,qBAAqB,CAAC,IAAI,CAAC;QACzB,MAAM;QACN,UAAU,EAAE,SAAS;QACrB,OAAO,EAAE,eAAe,MAAM,+FAA+F;QAC7H,KAAK;KACN,CAAC,CACH,EACD,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CACrE,CAAC;IACJ,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,qDAAqD,EAAE,MAAM,CAAC,CAAC;AACvF,CAAC,CAAC,CAAC"}
|
package/dist/ssh/model.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { boxdApiLayer } from "./provisioner/boxd/grpc-client.ts";
|
|
1
2
|
import type { AttemptConnections } from "../attempt-connections.ts";
|
|
2
3
|
import type { SshCommand } from "@usine/agents/child-host";
|
|
3
4
|
import type { InstanceId } from "@usine/core/instance";
|
|
4
|
-
import type { ProvisionerTimings, ProvisionerReuse, BoatSize, BoatSnapshotName, TailnetAddress, ContainerCpus, ContainerImage, ContainerMemoryMib, ContainerScratchMib, ContainerPids, GatewayAdminPort, GatewayCredentialKind, GatewayDomain, GatewayLlmProtocol, HetznerImage, HetznerLabels, HetznerLocation, HetznerResourceName, HetznerServerType, MachineProvider, SshDestination, SshIdentityFile, SshPort, SshUser, WorkerName, WorkerRoot } from "@usine/core/worker";
|
|
5
|
+
import type { ProvisionerTimings, ProvisionerReuse, BoatSize, BoxdSize, BoxdRegion, BoxdSnapshotName, BoatSnapshotName, TailnetAddress, ContainerCpus, ContainerImage, ContainerMemoryMib, ContainerScratchMib, ContainerPids, GatewayAdminPort, GatewayCredentialKind, GatewayDomain, GatewayLlmProtocol, HetznerImage, HetznerLabels, HetznerLocation, HetznerResourceName, HetznerServerType, MachineProvider, SshDestination, SshIdentityFile, SshPort, SshUser, WorkerName, WorkerRoot } from "@usine/core/worker";
|
|
5
6
|
import { Option, type Duration, type Effect, type Redacted, type Ref } from "effect";
|
|
6
7
|
import type { HarnessProbe } from "../harness-preflight.ts";
|
|
7
8
|
import type { RemoteMachine } from "../remote/machine.ts";
|
|
@@ -70,7 +71,7 @@ export interface SshTailnet {
|
|
|
70
71
|
readonly gatewayAddress: TailnetAddress;
|
|
71
72
|
}
|
|
72
73
|
/** Credentials for creating single-use auth keys tagged tag:usine-attempt. */
|
|
73
|
-
export interface
|
|
74
|
+
export interface ProvisionerTailnet extends SshTailnet {
|
|
74
75
|
readonly clientId: Redacted.Redacted<string>;
|
|
75
76
|
readonly clientSecret: Redacted.Redacted<string>;
|
|
76
77
|
}
|
|
@@ -81,12 +82,27 @@ export interface BoatProvisioner {
|
|
|
81
82
|
readonly token: Redacted.Redacted<string>;
|
|
82
83
|
readonly size: BoatSize;
|
|
83
84
|
readonly snapshot: Option.Option<BoatSnapshotName>;
|
|
84
|
-
readonly tailnet: Option.Option<
|
|
85
|
+
readonly tailnet: Option.Option<ProvisionerTailnet>;
|
|
85
86
|
readonly apiKeys: ProviderApiKeys;
|
|
86
87
|
readonly timings: ProvisionerTimings;
|
|
87
88
|
readonly reuse: Option.Option<ProvisionerReuse>;
|
|
88
89
|
}
|
|
89
|
-
|
|
90
|
+
/** @deprecated Use ProvisionerTailnet. */
|
|
91
|
+
export type BoatTailnet = ProvisionerTailnet;
|
|
92
|
+
/** Restores each attempt's boxd machine from a prepared snapshot. */
|
|
93
|
+
export interface BoxdProvisioner {
|
|
94
|
+
readonly provider: "boxd";
|
|
95
|
+
readonly token: Redacted.Redacted<string>;
|
|
96
|
+
readonly region: BoxdRegion;
|
|
97
|
+
readonly size: BoxdSize;
|
|
98
|
+
readonly snapshot: BoxdSnapshotName;
|
|
99
|
+
readonly isolated: boolean;
|
|
100
|
+
readonly tailnet: Option.Option<ProvisionerTailnet>;
|
|
101
|
+
readonly apiKeys: ProviderApiKeys;
|
|
102
|
+
readonly timings: ProvisionerTimings;
|
|
103
|
+
readonly reuse: Option.Option<ProvisionerReuse>;
|
|
104
|
+
}
|
|
105
|
+
export type SshProvisioner = HetznerProvisioner | BoatProvisioner | BoxdProvisioner;
|
|
90
106
|
/** How the executor finds a Worker's machines: one long-lived machine, or one per Attempt. */
|
|
91
107
|
export type SshWorkerMachine = {
|
|
92
108
|
readonly _tag: "Fixed";
|
|
@@ -148,6 +164,8 @@ export interface SshExecutorOptions {
|
|
|
148
164
|
* directory removed with the executor.
|
|
149
165
|
*/
|
|
150
166
|
readonly workerRecordsDirectory?: string;
|
|
167
|
+
/** Builds the boxd transport. Defaults to the gRPC adapter. */
|
|
168
|
+
readonly boxdClient?: typeof boxdApiLayer;
|
|
151
169
|
/** The provider API endpoints, which tests replace. Defaults to the providers' own. */
|
|
152
170
|
readonly providerEndpoints?: Partial<Record<MachineProvider, string>>;
|
|
153
171
|
/** The longest wait for a created machine to answer over SSH. Defaults to 10 minutes. */
|
|
@@ -175,8 +193,8 @@ export interface SshMachine extends RemoteMachine {
|
|
|
175
193
|
readonly address: SshWorkerAddress;
|
|
176
194
|
readonly gateway: Option.Option<MachineGateway>;
|
|
177
195
|
}
|
|
178
|
-
/** Returns a
|
|
179
|
-
export declare const
|
|
180
|
-
/** Returns the gateway routing for a fixed or
|
|
196
|
+
/** Returns a provisioned worker's tailnet settings, if configured. */
|
|
197
|
+
export declare const provisionerTailnetOf: (address: SshWorkerAddress) => Option.Option<ProvisionerTailnet>;
|
|
198
|
+
/** Returns the gateway routing for a fixed or provisioned machine on the tailnet. */
|
|
181
199
|
export declare const tailnetOf: (address: SshWorkerAddress) => Option.Option<SshTailnet>;
|
|
182
200
|
//# sourceMappingURL=model.d.ts.map
|