@usine/executor 0.6.1-next.504.gbfa02ef.1.1 → 0.6.1-next.506.g3cf5894.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 +1 -1
- package/dist/ssh/model.d.ts +16 -6
- package/dist/ssh/model.d.ts.map +1 -1
- package/dist/ssh/model.js.map +1 -1
- package/dist/ssh/provisioner/boxd/client.d.ts +36 -9
- package/dist/ssh/provisioner/boxd/client.d.ts.map +1 -1
- package/dist/ssh/provisioner/boxd/client.js +12 -2
- package/dist/ssh/provisioner/boxd/client.js.map +1 -1
- package/dist/ssh/provisioner/boxd/endpoint.d.ts +23 -0
- package/dist/ssh/provisioner/boxd/endpoint.d.ts.map +1 -0
- package/dist/ssh/provisioner/boxd/endpoint.js +54 -0
- package/dist/ssh/provisioner/boxd/endpoint.js.map +1 -0
- package/dist/ssh/provisioner/boxd/exec.d.ts +4 -4
- package/dist/ssh/provisioner/boxd/exec.d.ts.map +1 -1
- package/dist/ssh/provisioner/boxd/exec.js +10 -7
- package/dist/ssh/provisioner/boxd/exec.js.map +1 -1
- package/dist/ssh/provisioner/boxd/grpc-client.d.ts +12 -9
- package/dist/ssh/provisioner/boxd/grpc-client.d.ts.map +1 -1
- package/dist/ssh/provisioner/boxd/grpc-client.js +108 -87
- package/dist/ssh/provisioner/boxd/grpc-client.js.map +1 -1
- package/dist/ssh/provisioner/boxd.d.ts +7 -11
- package/dist/ssh/provisioner/boxd.d.ts.map +1 -1
- package/dist/ssh/provisioner/boxd.js +23 -23
- package/dist/ssh/provisioner/boxd.js.map +1 -1
- package/dist/ssh/provisioner/drivers.d.ts.map +1 -1
- package/dist/ssh/provisioner/drivers.js +34 -12
- package/dist/ssh/provisioner/drivers.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -380,4 +380,4 @@ Preparation creates `.usine/outputs/` and excludes `.usine/` from Git commits an
|
|
|
380
380
|
|
|
381
381
|
boxd machines don't use SSH. Their endpoint is an `Exec` endpoint: the machine id and an `ExecTransport` that runs command lines on it through the `BoxdExec` service, in this process. `machineAt` gives such a machine an `ExecShell` instead of a `RemoteShell`, and `RemoteCommands`, liveness probes, containers, and the child host run its commands through the transport with no local program. Each boxd worker's driver builds one `BoxdExec` for its region, so every command of its machines shares one HTTP/2 connection, which holds the API key. `BoxdExec` raises the HTTP/2 connection and stream windows to 8 MiB, sends stdin in chunks of at most 64 KiB as the call writes them, pings a connection that receives nothing for 30 seconds, ends both output streams with every chunk received, and cancels the call when its scope closes. A call that ends without an exit code fails with `HostUnreachable`, so `RemoteCommands` fails with an `ExecutorOperationError` whose cause is `HostUnreachable`, and the readiness wait and liveness probe count the machine as not answering. `RemoteCommands` reports an SSH client's exit code 255 the same way, so no executor caller compares an exit code with 255, and a command on an exec shell that exits 255 itself returns that exit code. A boxd worker ignores `identity_file`, and its preflight warns when it is set; the executor pins no host key and writes no OpenSSH configuration for its machines. When a boxd machine stops answering, the executor asks boxd whether it still exists, and a deleted, stopped, failed, or destroyed machine ends its attempt as an infrastructure failure. If boxd's API fails, the machine counts as present and the attempt stays unresponsive.
|
|
382
382
|
|
|
383
|
-
The SSH provisioner restores boxd machines from prepared snapshots with the configured egress allowlist, labels, and isolation in the restore request's machine spec, validates their captured size and region, waits one second for the allowlist before connecting, and disables idle timers. The transport
|
|
383
|
+
The SSH provisioner restores boxd machines from prepared snapshots with the configured egress allowlist, labels, and isolation in the restore request's machine spec, validates their captured size and region, waits one second for the allowlist before connecting, and disables idle timers. The transport sends account calls and `ListRegions` to the worker's `endpoint`, which defaults to `https://boxd.sh:9443`. With a region, it finds the region's API endpoint with `ListRegions` when it starts, keeps the account endpoint for the region that it serves, and fails preflight with the listed region ids when boxd lists no such region with an API endpoint; without a region, every call goes to the account endpoint. Preflight compares the snapshot's region with the region that boxd serves, and warns when boxd stores the snapshot archived rather than locally. Every revision of a worker with the same API key, endpoint, and region shares one API client and one `Exec` connection, and callers that wait for a client share its build's result. Over TLS or to a loopback address, a call carries the API key as the bearer; once boxd refuses the key as a bearer, the transport exchanges it for a session at the URL that `exchangeUrl` derives from the endpoint, as `@boxd-sh/sdk` 0.3.0 does. A call that boxd refuses with `UNAUTHENTICATED` on a session exchanges the key for a new session and runs once more. `Exec` calls carry the bearer that the other calls settled on, after a `whoami` probe when no call has settled it yet. The driver refuses to connect to a region whose API endpoint uses neither TLS nor a loopback address. 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/ssh/model.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { boxdExecLayer } from "./provisioner/boxd/exec.ts";
|
|
|
3
3
|
import type { AttemptConnections } from "../attempt-connections.ts";
|
|
4
4
|
import type { SshCommand } from "@usine/agents/child-host";
|
|
5
5
|
import type { InstanceId } from "@usine/core/instance";
|
|
6
|
-
import type { ProvisionerTimings, ProvisionerReuse, BoatSize, BoxdSize, BoxdRegion, BoxdSnapshotName, BoxdEgressAllowlist, 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";
|
|
6
|
+
import type { ProvisionerTimings, ProvisionerReuse, BoatSize, BoxdSize, BoxdEndpoint, BoxdRegion, BoxdSnapshotName, BoxdEgressAllowlist, 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";
|
|
7
7
|
import { Option, type Duration, type Effect, type Redacted, type Ref } from "effect";
|
|
8
8
|
import type { HarnessProbe } from "../harness-preflight.ts";
|
|
9
9
|
import type { RemoteMachine } from "../remote/machine.ts";
|
|
@@ -94,7 +94,13 @@ export type BoatTailnet = ProvisionerTailnet;
|
|
|
94
94
|
export interface BoxdProvisioner {
|
|
95
95
|
readonly provider: "boxd";
|
|
96
96
|
readonly token: Redacted.Redacted<string>;
|
|
97
|
-
|
|
97
|
+
/**
|
|
98
|
+
* The account endpoint of the boxd cluster, or `None` for `providerEndpoints.boxd`, which
|
|
99
|
+
* defaults to the hosted service.
|
|
100
|
+
*/
|
|
101
|
+
readonly endpoint: Option.Option<BoxdEndpoint>;
|
|
102
|
+
/** The region of the machines, or `None` to create them where the account endpoint runs them. */
|
|
103
|
+
readonly region: Option.Option<BoxdRegion>;
|
|
98
104
|
readonly size: BoxdSize;
|
|
99
105
|
readonly snapshot: BoxdSnapshotName;
|
|
100
106
|
readonly isolated: boolean;
|
|
@@ -170,11 +176,15 @@ export interface SshExecutorOptions {
|
|
|
170
176
|
/** Builds the boxd transport. Defaults to the gRPC adapter. */
|
|
171
177
|
readonly boxdClient?: BoxdApiLayer;
|
|
172
178
|
/**
|
|
173
|
-
* Builds the `BoxdExec` of a boxd Worker from its region's API endpoint and
|
|
174
|
-
* to the gRPC adapter, with one HTTP/2 connection per
|
|
179
|
+
* Builds the `BoxdExec` of a boxd Worker from its region's API endpoint and the effect that
|
|
180
|
+
* returns the bearer of each call. Defaults to the gRPC adapter, with one HTTP/2 connection per
|
|
181
|
+
* Worker.
|
|
182
|
+
*/
|
|
183
|
+
readonly boxdExec?: (...args: Parameters<typeof boxdExecLayer>) => ReturnType<typeof boxdExecLayer>;
|
|
184
|
+
/**
|
|
185
|
+
* The provider API endpoints, which tests replace. Defaults to the providers' own. A boxd
|
|
186
|
+
* Worker's `endpoint` takes precedence over `boxd`.
|
|
175
187
|
*/
|
|
176
|
-
readonly boxdExec?: (endpoint: string, credential: Redacted.Redacted<string>) => ReturnType<typeof boxdExecLayer>;
|
|
177
|
-
/** The provider API endpoints, which tests replace. Defaults to the providers' own. */
|
|
178
188
|
readonly providerEndpoints?: Partial<Record<MachineProvider, string>>;
|
|
179
189
|
/** The longest wait for a created machine to answer over SSH. Defaults to 10 minutes. */
|
|
180
190
|
readonly machineReadyTimeout?: Duration.Input;
|
package/dist/ssh/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/ssh/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,KAAK,GA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AC/C,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,YACtB,gBAAgB,KACxB,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAGhB,CAAC;AAEpB,qFAAqF;AACrF,eAAO,MAAM,SAAS,YAAa,gBAAgB,KAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CACc,CAAC"}
|
package/dist/ssh/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/ssh/model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/ssh/model.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,MAAM,EAAuD,MAAM,QAAQ,CAAC;AAiOrF,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,OAAyB,EACU,EAAE,CACrC,OAAO,CAAC,OAAO,CAAC,IAAI,KAAK,aAAa,IAAI,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW;IAChF,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO;IACrC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AAEpB,qFAAqF;AACrF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAyB,EAA6B,EAAE,CAChF,OAAO,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { BoxdRegion, MachineId } from "@usine/core/worker";
|
|
2
|
-
import { type Brand, Context, Effect, type Layer, type Redacted, Schema } from "effect";
|
|
2
|
+
import { type Brand, Context, Effect, type Layer, type Option, type Redacted, Schema } from "effect";
|
|
3
3
|
import type { HttpClient } from "effect/http";
|
|
4
4
|
declare const BoxdCallError_base: Schema.Class<BoxdCallError, Schema.TaggedStruct<"BoxdCallError", {
|
|
5
5
|
readonly operation: Schema.String;
|
|
6
|
+
/** The URL that the call went to: a gRPC endpoint, or the token exchange URL. */
|
|
7
|
+
readonly url: Schema.String;
|
|
6
8
|
readonly code: Schema.String;
|
|
7
9
|
readonly message: Schema.String;
|
|
8
10
|
}>, import("effect/Cause").YieldableError & Brand.Brand<"@usine/executor/boxd/BoxdCallError">>;
|
|
@@ -14,10 +16,19 @@ declare const BoxdUnknownRegion_base: Schema.Class<BoxdUnknownRegion, Schema.Tag
|
|
|
14
16
|
}>, import("effect/Cause").YieldableError & Brand.Brand<"@usine/executor/boxd/BoxdUnknownRegion">>;
|
|
15
17
|
/**
|
|
16
18
|
* The error when boxd lists no region with the configured id, or lists it without an API endpoint;
|
|
17
|
-
* `available` lists the ids of the regions that
|
|
19
|
+
* `available` lists the ids of the regions that boxd can serve, empty when boxd runs in one place.
|
|
18
20
|
*/
|
|
19
21
|
export declare class BoxdUnknownRegion extends BoxdUnknownRegion_base {
|
|
20
22
|
}
|
|
23
|
+
declare const BoxdPlainTextEndpoint_base: Schema.Class<BoxdPlainTextEndpoint, Schema.TaggedStruct<"BoxdPlainTextEndpoint", {
|
|
24
|
+
readonly endpoint: Schema.String;
|
|
25
|
+
}>, import("effect/Cause").YieldableError & Brand.Brand<"@usine/executor/boxd/BoxdPlainTextEndpoint">>;
|
|
26
|
+
/**
|
|
27
|
+
* The error when the API endpoint of the machines' region uses neither TLS nor a loopback address,
|
|
28
|
+
* so that its `Exec` calls would carry the credential in clear text.
|
|
29
|
+
*/
|
|
30
|
+
export declare class BoxdPlainTextEndpoint extends BoxdPlainTextEndpoint_base {
|
|
31
|
+
}
|
|
21
32
|
export declare const BoxdMachine: Schema.Struct<{
|
|
22
33
|
readonly id: Schema.brand<Schema.String, "MachineId">;
|
|
23
34
|
readonly status: Schema.NonEmptyString;
|
|
@@ -78,14 +89,24 @@ export interface BoxdCreate {
|
|
|
78
89
|
readonly egress: ReadonlyArray<string>;
|
|
79
90
|
}
|
|
80
91
|
declare const BoxdApi_base: Context.ServiceClass<BoxdApi, "@usine/executor/ssh/provisioner/boxd/client/BoxdApi", {
|
|
81
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* The API endpoint URL of the machines' region, which serves their machine and `Exec` calls.
|
|
94
|
+
* Without a configured region, or for the region that the account endpoint serves, it is the
|
|
95
|
+
* account endpoint.
|
|
96
|
+
*/
|
|
82
97
|
readonly endpoint: string;
|
|
98
|
+
/**
|
|
99
|
+
* The bearer of an `Exec` call to `endpoint`: the API key, or a session once boxd refused the
|
|
100
|
+
* key as a bearer. When no call has shown yet which one boxd takes, it calls `whoami` first,
|
|
101
|
+
* as the boxd SDK does before a stream. Fails when the token exchange fails.
|
|
102
|
+
*/
|
|
103
|
+
readonly execBearer: Effect.Effect<Redacted.Redacted<string>, BoxdCallError>;
|
|
83
104
|
readonly whoami: Effect.Effect<typeof BoxdIdentity.Type, BoxdCallError>;
|
|
84
105
|
readonly orgMachineLimit: Effect.Effect<typeof BoxdLimit.Type, BoxdCallError>;
|
|
85
106
|
readonly snapshot: (name: string) => Effect.Effect<BoxdSnapshot, BoxdCallError>;
|
|
86
107
|
/**
|
|
87
|
-
* The region that `endpoint` serves
|
|
88
|
-
*
|
|
108
|
+
* The region that `endpoint` serves, `""` when boxd runs in one place. With a configured
|
|
109
|
+
* region, it is that region, without a call; otherwise boxd reports it.
|
|
89
110
|
*/
|
|
90
111
|
readonly servedRegion: Effect.Effect<string, BoxdCallError>;
|
|
91
112
|
readonly createFromSnapshot: (request: BoxdCreate) => Effect.Effect<typeof BoxdCreated.Type, BoxdCallError>;
|
|
@@ -104,11 +125,17 @@ declare const BoxdApi_base: Context.ServiceClass<BoxdApi, "@usine/executor/ssh/p
|
|
|
104
125
|
/** Transport boundary: responses contain only decoded values used by the driver. */
|
|
105
126
|
export declare class BoxdApi extends BoxdApi_base {
|
|
106
127
|
}
|
|
128
|
+
/** Where the calls of a boxd Worker go. */
|
|
129
|
+
export interface BoxdCluster {
|
|
130
|
+
/** The account endpoint URL, which serves account calls and `ListRegions`. */
|
|
131
|
+
readonly endpoint: string;
|
|
132
|
+
/** The region of the machines, or `None` to send every call to `endpoint`. */
|
|
133
|
+
readonly region: Option.Option<BoxdRegion>;
|
|
134
|
+
}
|
|
107
135
|
/**
|
|
108
|
-
* Builds the `BoxdApi`
|
|
109
|
-
*
|
|
110
|
-
* answer, or lists no such region.
|
|
136
|
+
* Builds the `BoxdApi` of `cluster` with the API key `token`. Building fails when boxd refuses the
|
|
137
|
+
* key, doesn't answer, or lists no such region.
|
|
111
138
|
*/
|
|
112
|
-
export type BoxdApiLayer = (token: Redacted.Redacted<string>,
|
|
139
|
+
export type BoxdApiLayer = (token: Redacted.Redacted<string>, cluster: BoxdCluster) => Layer.Layer<BoxdApi, BoxdCallError | BoxdUnknownRegion, HttpClient.HttpClient>;
|
|
113
140
|
export {};
|
|
114
141
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/ssh/provisioner/boxd/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/ssh/provisioner/boxd/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,KAAK,KAAK,EACV,OAAO,EACP,MAAM,EACN,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,MAAM,EACP,MAAM,QAAQ,CAAC;AAChB,OAAO,K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AC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CACzB,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAChC,OAAO,EAAE,WAAW,KACjB,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,iBAAiB,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import { BoxdRegion, MachineId } from "@usine/core/worker";
|
|
2
|
-
import { Context, Effect, Schema } from "effect";
|
|
2
|
+
import { Context, Effect, Schema, } from "effect";
|
|
3
3
|
export class BoxdCallError extends Schema.TaggedError()("BoxdCallError", {
|
|
4
4
|
operation: Schema.String,
|
|
5
|
+
/** The URL that the call went to: a gRPC endpoint, or the token exchange URL. */
|
|
6
|
+
url: Schema.String,
|
|
5
7
|
code: Schema.String,
|
|
6
8
|
message: Schema.String,
|
|
7
9
|
}) {
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* The error when boxd lists no region with the configured id, or lists it without an API endpoint;
|
|
11
|
-
* `available` lists the ids of the regions that
|
|
13
|
+
* `available` lists the ids of the regions that boxd can serve, empty when boxd runs in one place.
|
|
12
14
|
*/
|
|
13
15
|
export class BoxdUnknownRegion extends Schema.TaggedError()("BoxdUnknownRegion", {
|
|
14
16
|
region: BoxdRegion,
|
|
15
17
|
available: Schema.Array(Schema.String),
|
|
16
18
|
}) {
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The error when the API endpoint of the machines' region uses neither TLS nor a loopback address,
|
|
22
|
+
* so that its `Exec` calls would carry the credential in clear text.
|
|
23
|
+
*/
|
|
24
|
+
export class BoxdPlainTextEndpoint extends Schema.TaggedError()("BoxdPlainTextEndpoint", {
|
|
25
|
+
endpoint: Schema.String,
|
|
26
|
+
}) {
|
|
27
|
+
}
|
|
18
28
|
export const BoxdMachine = Schema.Struct({
|
|
19
29
|
id: MachineId,
|
|
20
30
|
status: Schema.NonEmptyString,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/ssh/provisioner/boxd/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/ssh/provisioner/boxd/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAEL,OAAO,EACP,MAAM,EAIN,MAAM,GACP,MAAM,QAAQ,CAAC;AAGhB,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,WAAW,EAGlD,CAAC,eAAe,EAAE;IACnB,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,iFAAiF;IACjF,GAAG,EAAE,MAAM,CAAC,MAAM;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC;CAAG;AAEL;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,WAAW,EAGtD,CAAC,mBAAmB,EAAE;IACvB,MAAM,EAAE,UAAU;IAClB,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;CACvC,CAAC;CAAG;AAEL;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,WAAW,EAG1D,CAAC,uBAAuB,EAAE;IAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM;CACxB,CAAC;CAAG;AAEL,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IACvC,EAAE,EAA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,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,SAAS;IACb,OAAO,EAAE,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC;CACnD,CAAC,CAAC;AAeH,oFAAoF;AACpF,MAAM,OAAO,OAAQ,SAAQ,OAAO,CAAC,OAAO,EAoDzC,CAAC,qDAAqD,CAAC;CAAG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The account endpoint of the hosted service, which also serves Frankfurt (`fra`). */
|
|
2
|
+
export declare const BOXD_API = "https://boxd.sh:9443";
|
|
3
|
+
/** Returns `endpoint` as a URL, adding `https://` when boxd lists only the host and port. */
|
|
4
|
+
export declare const endpointUrl: (endpoint: string) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Returns the URL that exchanges an API key for a session at the cluster of the account endpoint
|
|
7
|
+
* `endpoint`. A cluster serves its API at `<zone>:9443` and its console at `https://app.<zone>`, so
|
|
8
|
+
* the exchange is `https://app.<host>/api/v1/auth/token`, without the port and path of `endpoint`.
|
|
9
|
+
* A `localhost`, IP literal, or `app.` host serves both, so its scheme and port stay.
|
|
10
|
+
*/
|
|
11
|
+
export declare const exchangeUrl: (endpoint: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the API key may go as the bearer to `endpoint`: over TLS, or to a loopback address,
|
|
14
|
+
* where plain text never leaves the host.
|
|
15
|
+
*/
|
|
16
|
+
export declare const rawKeyAllowed: (endpoint: string) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether boxd refused the API key as a bearer, with the `UNAUTHENTICATED` message `message`,
|
|
19
|
+
* because it takes only sessions: a release from before raw keys reads the key as an invalid
|
|
20
|
+
* session, and one that takes keys refuses one sent without TLS.
|
|
21
|
+
*/
|
|
22
|
+
export declare const refusesRawKey: (message: string) => boolean;
|
|
23
|
+
//# sourceMappingURL=endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../../../src/ssh/provisioner/boxd/endpoint.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,eAAO,MAAM,QAAQ,yBAAyB,CAAC;AAI/C,6FAA6F;AAC7F,eAAO,MAAM,WAAW,aAAc,MAAM,KAAG,MACgC,CAAC;AAiBhF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,aAAc,MAAM,KAAG,MAS9C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,aAAc,MAAM,KAAG,OAMhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,YAAa,MAAM,KAAG,OACmC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// The rules below follow `dist/utils.js` and `dist/auth.js` of `@boxd-sh/sdk` 0.3.0.
|
|
2
|
+
/** The account endpoint of the hosted service, which also serves Frankfurt (`fra`). */
|
|
3
|
+
export const BOXD_API = "https://boxd.sh:9443";
|
|
4
|
+
const EXCHANGE_PATH = "/api/v1/auth/token";
|
|
5
|
+
/** Returns `endpoint` as a URL, adding `https://` when boxd lists only the host and port. */
|
|
6
|
+
export const endpointUrl = (endpoint) => /^[a-z][a-z0-9+.-]*:\/\//iu.test(endpoint) ? endpoint : `https://${endpoint}`;
|
|
7
|
+
/** Returns the host of a URL authority, with the brackets of an IPv6 literal, without the port. */
|
|
8
|
+
const bareHost = (authority) => {
|
|
9
|
+
if (!authority.startsWith("["))
|
|
10
|
+
return authority.split(":")[0] ?? authority;
|
|
11
|
+
const end = authority.indexOf("]");
|
|
12
|
+
return end === -1 ? authority : authority.slice(0, end + 1);
|
|
13
|
+
};
|
|
14
|
+
const isIpLiteral = (host) => (host.startsWith("[") && host.endsWith("]")) ||
|
|
15
|
+
(/^\d{1,3}(?:\.\d{1,3}){3}$/u.test(host) &&
|
|
16
|
+
host.split(".").every((octet) => Number(octet) <= 255));
|
|
17
|
+
/** Whether boxd dials `host` without TLS when the endpoint has no scheme. */
|
|
18
|
+
const isLocal = (host) => host.startsWith("localhost") || host.startsWith("127.");
|
|
19
|
+
/**
|
|
20
|
+
* Returns the URL that exchanges an API key for a session at the cluster of the account endpoint
|
|
21
|
+
* `endpoint`. A cluster serves its API at `<zone>:9443` and its console at `https://app.<zone>`, so
|
|
22
|
+
* the exchange is `https://app.<host>/api/v1/auth/token`, without the port and path of `endpoint`.
|
|
23
|
+
* A `localhost`, IP literal, or `app.` host serves both, so its scheme and port stay.
|
|
24
|
+
*/
|
|
25
|
+
export const exchangeUrl = (endpoint) => {
|
|
26
|
+
const trimmed = endpoint.trim().replace(/\/+$/u, "");
|
|
27
|
+
const scheme = ["https://", "http://"].find((prefix) => trimmed.startsWith(prefix)) ?? "";
|
|
28
|
+
const rest = trimmed.slice(scheme.length);
|
|
29
|
+
const authority = rest.split("/")[0] ?? rest;
|
|
30
|
+
const host = bareHost(authority);
|
|
31
|
+
if (host === "localhost" || isIpLiteral(host) || authority.startsWith("app."))
|
|
32
|
+
return `${scheme || (isLocal(host) ? "http://" : "https://")}${authority}${EXCHANGE_PATH}`;
|
|
33
|
+
return `https://app.${host}${EXCHANGE_PATH}`;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Whether the API key may go as the bearer to `endpoint`: over TLS, or to a loopback address,
|
|
37
|
+
* where plain text never leaves the host.
|
|
38
|
+
*/
|
|
39
|
+
export const rawKeyAllowed = (endpoint) => {
|
|
40
|
+
if (endpoint.startsWith("https://"))
|
|
41
|
+
return true;
|
|
42
|
+
const authority = endpoint.startsWith("http://") ? endpoint.slice("http://".length) : endpoint;
|
|
43
|
+
if (!endpoint.startsWith("http://") && !isLocal(authority))
|
|
44
|
+
return true;
|
|
45
|
+
const host = bareHost(authority.trim()).toLowerCase();
|
|
46
|
+
return host === "localhost" || host === "[::1]" || /^127(?:\.\d{1,3}){3}$/u.test(host);
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Whether boxd refused the API key as a bearer, with the `UNAUTHENTICATED` message `message`,
|
|
50
|
+
* because it takes only sessions: a release from before raw keys reads the key as an invalid
|
|
51
|
+
* session, and one that takes keys refuses one sent without TLS.
|
|
52
|
+
*/
|
|
53
|
+
export const refusesRawKey = (message) => message.startsWith("invalid token") || message.includes("accepted over TLS only");
|
|
54
|
+
//# sourceMappingURL=endpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../../../src/ssh/provisioner/boxd/endpoint.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,uFAAuF;AACvF,MAAM,CAAC,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AAE/C,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C,6FAA6F;AAC7F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAU,EAAE,CACtD,2BAA2B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,QAAQ,EAAE,CAAC;AAEhF,mGAAmG;AACnG,MAAM,QAAQ,GAAG,CAAC,SAAiB,EAAU,EAAE;IAC7C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;IAC5E,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAAY,EAAW,EAAE,CAC5C,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,Q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GAAG,aAAa,EAAE,CAAC;AAC/C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAW,EAAE;IACzD,IAAI,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IACjD,MAAM,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC/F,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IACxE,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACtD,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,OAAO,IAAI,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzF,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAW,EAAE,CACxD,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC"}
|
|
@@ -58,11 +58,11 @@ interface ExecTransportOptions {
|
|
|
58
58
|
readonly pingTimeout?: number;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* Returns the `BoxdExec` that calls `endpoint`, a region's API endpoint URL, with
|
|
62
|
-
*
|
|
63
|
-
* layer.
|
|
61
|
+
* Returns the `BoxdExec` that calls `endpoint`, a region's API endpoint URL, with the bearer that
|
|
62
|
+
* `credential` returns at the start of each call. A call whose `credential` fails ends with that
|
|
63
|
+
* error. Each layer owns one HTTP/2 connection, opened at the first call and closed with the layer.
|
|
64
64
|
*/
|
|
65
|
-
export declare const boxdExecLayer: (endpoint: string, credential: Redacted.Redacted<string>, options?: ExecTransportOptions) => Layer.Layer<BoxdExec, never, never>;
|
|
65
|
+
export declare const boxdExecLayer: (endpoint: string, credential: Effect.Effect<Redacted.Redacted<string>, BoxdCallError>, options?: ExecTransportOptions) => Layer.Layer<BoxdExec, never, never>;
|
|
66
66
|
/**
|
|
67
67
|
* Returns the `ExecTransport` that runs command lines on boxd machine `machine` through `exec`. A
|
|
68
68
|
* call that ends without an exit code fails with `HostUnreachable`, whose message says whether boxd
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../../../src/ssh/provisioner/boxd/exec.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,KAAK,KAAK,EACV,KAAK,KAAK,EACV,OAAO,EAEP,MAAM,EAEN,KAAK,EAEL,QAAQ,EACR,MAAM,EACN,KAAK,KAAK,EACV,MAAM,EACP,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;;;;;AAG5C,sGAAsG;AACtG,qBAAa,eAAgB,SAAQ,oBAMnC;CAAG;AAEL;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,eAAe,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACzD;;IAMG;;;;;;OAMG;mBACY,CACb,OAAO,EAAE,S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AM,CAAC,UAAU,CAAC,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACzD;;IAMG;;;;;;OAMG;mBACY,CACb,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,KAC7B,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;;AAfzD,qEAAqE;AACrE,qBAAa,QAAS,SAAQ,aAgB2B;CAAG;AAQ5D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAY,CAAC;AAQ3C,UAAU,oBAAoB;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,oGAAoG;IACpG,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AA2BD;;;;GAIG;AACH,eAAO,MAAM,aAAa,aACd,MAAM,cACJ,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,YAC1D,oBAAoB,wCAgH5B,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAU,QAAQ,CAAC,SAAS,CAAC,WAAW,SAAS,KAAG,aA0B5E,CAAC"}
|
|
@@ -46,9 +46,9 @@ class WindowedSessionManager extends Http2SessionManager {
|
|
|
46
46
|
/** Splits `bytes` into views of at most `STDIN_CHUNK_BYTES`, without copying. */
|
|
47
47
|
const stdinPieces = (bytes) => Array.from({ length: Math.ceil(bytes.length / STDIN_CHUNK_BYTES) }, (_, index) => bytes.subarray(index * STDIN_CHUNK_BYTES, (index + 1) * STDIN_CHUNK_BYTES));
|
|
48
48
|
/**
|
|
49
|
-
* Returns the `BoxdExec` that calls `endpoint`, a region's API endpoint URL, with
|
|
50
|
-
*
|
|
51
|
-
* layer.
|
|
49
|
+
* Returns the `BoxdExec` that calls `endpoint`, a region's API endpoint URL, with the bearer that
|
|
50
|
+
* `credential` returns at the start of each call. A call whose `credential` fails ends with that
|
|
51
|
+
* error. Each layer owns one HTTP/2 connection, opened at the first call and closed with the layer.
|
|
52
52
|
*/
|
|
53
53
|
export const boxdExecLayer = (endpoint, credential, options = {}) => Layer.effect(BoxdExec, Effect.gen(function* () {
|
|
54
54
|
const sessionManager = yield* Effect.acquireRelease(Effect.sync(() => new WindowedSessionManager(endpoint, {
|
|
@@ -56,14 +56,13 @@ export const boxdExecLayer = (endpoint, credential, options = {}) => Layer.effec
|
|
|
56
56
|
pingTimeoutMs: options.pingTimeout ?? 20_000,
|
|
57
57
|
}, { settings: { initialWindowSize: RECEIVE_WINDOW_BYTES } })), (manager) => Effect.sync(() => manager.abort()));
|
|
58
58
|
const client = createClient(BoxdService, createGrpcTransport({ baseUrl: endpoint, sessionManager }));
|
|
59
|
-
const
|
|
60
|
-
const failureOf = (machine, cause) => {
|
|
59
|
+
const failureOf = (machine, secret, cause) => {
|
|
61
60
|
const failure = ConnectError.from(cause);
|
|
62
61
|
const code = failureCode(failure);
|
|
63
62
|
const message = failure.rawMessage.replaceAll(secret, "[redacted]");
|
|
64
63
|
return code === "NOT_FOUND" || (code === "UNAVAILABLE" && message.includes(DESTROYED))
|
|
65
64
|
? BoxdMachineGone.make({ machine, message })
|
|
66
|
-
: BoxdCallError.make({ operation: "exec", code, message });
|
|
65
|
+
: BoxdCallError.make({ operation: "exec", url: endpoint, code, message });
|
|
67
66
|
};
|
|
68
67
|
const exec = Effect.fn("BoxdExec.exec")(function* (machine, command, stdin) {
|
|
69
68
|
yield* Effect.annotateCurrentSpan({ machine });
|
|
@@ -75,18 +74,21 @@ export const boxdExecLayer = (endpoint, credential, options = {}) => Layer.effec
|
|
|
75
74
|
});
|
|
76
75
|
yield* Effect.addFinalizer(() => settle(Exit.fail(BoxdCallError.make({
|
|
77
76
|
operation: "exec",
|
|
77
|
+
url: endpoint,
|
|
78
78
|
code: "CANCELLED",
|
|
79
79
|
message: "the call's scope closed before the command exited",
|
|
80
80
|
}))));
|
|
81
81
|
const requests = Stream.concat(Stream.succeed({ vmId: machine, command }), stdin.pipe(Stream.flatMap((bytes) => Stream.fromIterable(stdinPieces(bytes))), Stream.map((data) => ({ data, stdin: true }))));
|
|
82
82
|
const call = Effect.gen(function* () {
|
|
83
|
+
const bearer = yield* credential;
|
|
84
|
+
const secret = Redacted.value(bearer);
|
|
83
85
|
const controller = yield* Effect.acquireRelease(Effect.sync(() => new AbortController()), (controller) => Effect.sync(() => controller.abort()));
|
|
84
86
|
// connect-node stops pulling the requests when the response ends, but never returns the
|
|
85
87
|
// iterator, which would keep waiting for stdin.
|
|
86
88
|
const iterator = yield* Effect.acquireRelease(Effect.sync(() => Stream.toAsyncIterable(requests)[Symbol.asyncIterator]()), (iterator) => Effect.promise(() => Promise.resolve(iterator.return?.())));
|
|
87
89
|
const responses = client.exec({ [Symbol.asyncIterator]: () => iterator }, { signal: controller.signal, headers: { authorization: `Bearer ${secret}` } });
|
|
88
90
|
let exited;
|
|
89
|
-
yield* Stream.fromAsyncIterable(responses, (cause) => failureOf(machine, cause)).pipe(Stream.runForEach((chunk) => chunk.data.length === 0
|
|
91
|
+
yield* Stream.fromAsyncIterable(responses, (cause) => failureOf(machine, secret, cause)).pipe(Stream.runForEach((chunk) => chunk.data.length === 0
|
|
90
92
|
? Effect.sync(() => {
|
|
91
93
|
exited = chunk.exitCode;
|
|
92
94
|
})
|
|
@@ -94,6 +96,7 @@ export const boxdExecLayer = (endpoint, credential, options = {}) => Layer.effec
|
|
|
94
96
|
if (exited === undefined)
|
|
95
97
|
return yield* BoxdCallError.make({
|
|
96
98
|
operation: "exec",
|
|
99
|
+
url: endpoint,
|
|
97
100
|
code: "UNAVAILABLE",
|
|
98
101
|
message: "boxd ended the exec stream without an exit code",
|
|
99
102
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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,CAAC,CACH,CACF;KACF,CAAC,CAAC,CACJ;CACJ,CAAC,CAAC"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { createGrpcTransport } from "@connectrpc/connect-node";
|
|
2
|
-
import { type BoxdRegion } from "@usine/core/worker";
|
|
3
2
|
import { Redacted } from "effect";
|
|
4
|
-
import { type BoxdApiLayer } from "./client.ts";
|
|
3
|
+
import { type BoxdApiLayer, type BoxdCluster } from "./client.ts";
|
|
5
4
|
/**
|
|
6
5
|
* Generated gRPC calls retain the serving-region metadata that the SDK omits.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* Account calls and `ListRegions` go to `cluster.endpoint`. With a region, building the layer calls
|
|
8
|
+
* `ListRegions` to find the region's API endpoint, which serves machine and `Exec` calls; the
|
|
9
|
+
* region that the account endpoint serves stays there. Building fails with `BoxdUnknownRegion` when
|
|
10
|
+
* boxd lists no such region, or lists it without an API endpoint. Without a region, every call
|
|
11
|
+
* goes to the account endpoint.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Over TLS or to a loopback address, a call carries the API key as the bearer. Once boxd refuses
|
|
14
|
+
* the key as a bearer, the layer exchanges it for a session at the URL that `exchangeUrl` derives
|
|
15
|
+
* from the account endpoint, and every later call carries a session. A call that boxd refuses with
|
|
16
|
+
* `UNAUTHENTICATED` on a session drops the session and runs once more with a new one. `Exec`
|
|
17
|
+
* calls carry the bearer that the other calls settled on.
|
|
15
18
|
*/
|
|
16
|
-
export declare const boxdApiLayer: (token: Redacted.Redacted<string>,
|
|
19
|
+
export declare const boxdApiLayer: (token: Redacted.Redacted<string>, cluster: BoxdCluster, transport?: typeof createGrpcTransport) => ReturnType<BoxdApiLayer>;
|
|
17
20
|
//# sourceMappingURL=grpc-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc-client.d.ts","sourceRoot":"","sources":["../../../../src/ssh/provisioner/boxd/grpc-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"grpc-client.d.ts","sourceRoot":"","sources":["../../../../src/ssh/provisioner/boxd/grpc-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAmC,QAAQ,EAAqB,MAAM,QAAQ,CAAC;AAGtF,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,WAAW,EASjB,MAAM,aAAa,CAAC;AAoCrB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,UAChB,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,WACvB,WAAW,cACT,OAAO,mBAAmB,KACpC,UAAU,CAAC,YAAY,CA8TvB,CAAC"}
|