@usine/executor 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -37
- package/dist/child-command.d.ts +4 -7
- package/dist/child-command.d.ts.map +1 -1
- package/dist/child-command.js +6 -12
- package/dist/child-command.js.map +1 -1
- package/dist/claude-login-lock.d.ts +8 -0
- package/dist/claude-login-lock.d.ts.map +1 -0
- package/dist/claude-login-lock.js +9 -0
- package/dist/claude-login-lock.js.map +1 -0
- package/dist/credential-environment.d.ts +20 -0
- package/dist/credential-environment.d.ts.map +1 -0
- package/dist/credential-environment.js +20 -0
- package/dist/credential-environment.js.map +1 -0
- package/dist/durable-session.d.ts +63 -0
- package/dist/durable-session.d.ts.map +1 -0
- package/dist/durable-session.js +491 -0
- package/dist/durable-session.js.map +1 -0
- package/dist/exe-dev/commands.d.ts +23 -13
- package/dist/exe-dev/commands.d.ts.map +1 -1
- package/dist/exe-dev/commands.js +11 -57
- package/dist/exe-dev/commands.js.map +1 -1
- package/dist/exe-dev/exe-dev.d.ts +9 -3
- package/dist/exe-dev/exe-dev.d.ts.map +1 -1
- package/dist/exe-dev/exe-dev.js +53 -127
- package/dist/exe-dev/exe-dev.js.map +1 -1
- package/dist/exe-dev/grants.d.ts.map +1 -1
- package/dist/exe-dev/grants.js +35 -15
- package/dist/exe-dev/grants.js.map +1 -1
- package/dist/exe-dev/model.d.ts +15 -19
- package/dist/exe-dev/model.d.ts.map +1 -1
- package/dist/exe-dev/model.js +9 -12
- package/dist/exe-dev/model.js.map +1 -1
- package/dist/exe-dev/preflight.d.ts +8 -4
- package/dist/exe-dev/preflight.d.ts.map +1 -1
- package/dist/exe-dev/preflight.js +23 -33
- package/dist/exe-dev/preflight.js.map +1 -1
- package/dist/executor.d.ts +141 -38
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +90 -17
- package/dist/executor.js.map +1 -1
- package/dist/guard.d.ts +61 -0
- package/dist/guard.d.ts.map +1 -0
- package/dist/guard.js +288 -0
- package/dist/guard.js.map +1 -0
- package/dist/harness-preflight.d.ts +25 -4
- package/dist/harness-preflight.d.ts.map +1 -1
- package/dist/harness-preflight.js +25 -29
- package/dist/harness-preflight.js.map +1 -1
- package/dist/keyed-lock.d.ts +2 -3
- package/dist/keyed-lock.d.ts.map +1 -1
- package/dist/keyed-lock.js +2 -3
- package/dist/keyed-lock.js.map +1 -1
- package/dist/leftovers.d.ts +9 -0
- package/dist/leftovers.d.ts.map +1 -0
- package/dist/leftovers.js +14 -0
- package/dist/leftovers.js.map +1 -0
- package/dist/local/credentials.d.ts +21 -0
- package/dist/local/credentials.d.ts.map +1 -0
- package/dist/local/credentials.js +39 -0
- package/dist/local/credentials.js.map +1 -0
- package/dist/local/leftovers.d.ts +8 -0
- package/dist/local/leftovers.d.ts.map +1 -0
- package/dist/local/leftovers.js +23 -0
- package/dist/local/leftovers.js.map +1 -0
- package/dist/local/local.d.ts +16 -10
- package/dist/local/local.d.ts.map +1 -1
- package/dist/local/local.js +164 -129
- package/dist/local/local.js.map +1 -1
- package/dist/memory-preflight.d.ts +25 -0
- package/dist/memory-preflight.d.ts.map +1 -0
- package/dist/memory-preflight.js +83 -0
- package/dist/memory-preflight.js.map +1 -0
- package/dist/pre-push-hook.d.ts +20 -0
- package/dist/pre-push-hook.d.ts.map +1 -0
- package/dist/pre-push-hook.js +33 -0
- package/dist/pre-push-hook.js.map +1 -0
- package/dist/prepared-attempt.d.ts +33 -3
- package/dist/prepared-attempt.d.ts.map +1 -1
- package/dist/prepared-attempt.js +109 -39
- package/dist/prepared-attempt.js.map +1 -1
- package/dist/provision.d.ts +77 -14
- package/dist/provision.d.ts.map +1 -1
- package/dist/provision.js +357 -55
- package/dist/provision.js.map +1 -1
- package/dist/remote/commands.d.ts +51 -0
- package/dist/remote/commands.d.ts.map +1 -0
- package/dist/remote/commands.js +94 -0
- package/dist/remote/commands.js.map +1 -0
- package/dist/remote/leftovers.d.ts +14 -0
- package/dist/remote/leftovers.d.ts.map +1 -0
- package/dist/remote/leftovers.js +22 -0
- package/dist/remote/leftovers.js.map +1 -0
- package/dist/remote/liveness.d.ts +33 -0
- package/dist/remote/liveness.d.ts.map +1 -0
- package/dist/remote/liveness.js +194 -0
- package/dist/remote/liveness.js.map +1 -0
- package/dist/remote/machine.d.ts +64 -0
- package/dist/remote/machine.d.ts.map +1 -0
- package/dist/remote/machine.js +2 -0
- package/dist/remote/machine.js.map +1 -0
- package/dist/remote/remote.d.ts +24 -0
- package/dist/remote/remote.d.ts.map +1 -0
- package/dist/remote/remote.js +308 -0
- package/dist/remote/remote.js.map +1 -0
- package/dist/remote/sweep.d.ts +15 -0
- package/dist/remote/sweep.d.ts.map +1 -0
- package/dist/remote/sweep.js +116 -0
- package/dist/remote/sweep.js.map +1 -0
- package/dist/renewable-credential.d.ts +17 -0
- package/dist/renewable-credential.d.ts.map +1 -0
- package/dist/renewable-credential.js +58 -0
- package/dist/renewable-credential.js.map +1 -0
- package/dist/salvage.d.ts +30 -0
- package/dist/salvage.d.ts.map +1 -0
- package/dist/salvage.js +104 -0
- package/dist/salvage.js.map +1 -0
- package/dist/ssh/credentials.d.ts +40 -0
- package/dist/ssh/credentials.d.ts.map +1 -0
- package/dist/ssh/credentials.js +83 -0
- package/dist/ssh/credentials.js.map +1 -0
- package/dist/ssh/gateway/admin.d.ts +45 -0
- package/dist/ssh/gateway/admin.d.ts.map +1 -0
- package/dist/ssh/gateway/admin.js +129 -0
- package/dist/ssh/gateway/admin.js.map +1 -0
- package/dist/ssh/gateway/attachments.d.ts +22 -0
- package/dist/ssh/gateway/attachments.d.ts.map +1 -0
- package/dist/ssh/gateway/attachments.js +154 -0
- package/dist/ssh/gateway/attachments.js.map +1 -0
- package/dist/ssh/gateway/environment.d.ts +52 -0
- package/dist/ssh/gateway/environment.d.ts.map +1 -0
- package/dist/ssh/gateway/environment.js +78 -0
- package/dist/ssh/gateway/environment.js.map +1 -0
- package/dist/ssh/gateway/forward.d.ts +74 -0
- package/dist/ssh/gateway/forward.d.ts.map +1 -0
- package/dist/ssh/gateway/forward.js +247 -0
- package/dist/ssh/gateway/forward.js.map +1 -0
- package/dist/ssh/gateway/preflight.d.ts +28 -0
- package/dist/ssh/gateway/preflight.d.ts.map +1 -0
- package/dist/ssh/gateway/preflight.js +234 -0
- package/dist/ssh/gateway/preflight.js.map +1 -0
- package/dist/ssh/model.d.ts +65 -0
- package/dist/ssh/model.d.ts.map +1 -0
- package/dist/ssh/model.js +2 -0
- package/dist/ssh/model.js.map +1 -0
- package/dist/ssh/preflight.d.ts +16 -0
- package/dist/ssh/preflight.d.ts.map +1 -0
- package/dist/ssh/preflight.js +47 -0
- package/dist/ssh/preflight.js.map +1 -0
- package/dist/ssh/ssh.d.ts +20 -0
- package/dist/ssh/ssh.d.ts.map +1 -0
- package/dist/ssh/ssh.js +78 -0
- package/dist/ssh/ssh.js.map +1 -0
- package/dist/ssh/workers.d.ts +53 -0
- package/dist/ssh/workers.d.ts.map +1 -0
- package/dist/ssh/workers.js +173 -0
- package/dist/ssh/workers.js.map +1 -0
- package/package.json +12 -4
- package/dist/exe-dev/channel.d.ts +0 -11
- package/dist/exe-dev/channel.d.ts.map +0 -1
- package/dist/exe-dev/channel.js +0 -41
- package/dist/exe-dev/channel.js.map +0 -1
- package/dist/exe-dev/shell.d.ts +0 -12
- package/dist/exe-dev/shell.d.ts.map +0 -1
- package/dist/exe-dev/shell.js +0 -31
- package/dist/exe-dev/shell.js.map +0 -1
- package/dist/exe-dev/sweep.d.ts +0 -10
- package/dist/exe-dev/sweep.d.ts.map +0 -1
- package/dist/exe-dev/sweep.js +0 -117
- package/dist/exe-dev/sweep.js.map +0 -1
- package/dist/invalid-frame.d.ts +0 -17
- package/dist/invalid-frame.d.ts.map +0 -1
- package/dist/invalid-frame.js +0 -111
- package/dist/invalid-frame.js.map +0 -1
- package/dist/run-host-session.d.ts +0 -26
- package/dist/run-host-session.d.ts.map +0 -1
- package/dist/run-host-session.js +0 -241
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Y,CAAC;SACvE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { RepositoryName } from "@usine/core/repository";
|
|
2
|
+
import type { GatewayDomain, GatewayLlmProvider } from "@usine/core/worker";
|
|
3
|
+
import { type CallerToken } from "@usine/gateway/admin";
|
|
4
|
+
import { Redacted } from "effect";
|
|
5
|
+
/** The variables sent through the SSH connection because they contain the caller token. The Worker's sshd must accept each in `AcceptEnv`. */
|
|
6
|
+
export declare const GATEWAY_SENT_VARIABLES: readonly ["GIT_CONFIG_VALUE_0", "GH_ENTERPRISE_TOKEN", "GH_TOKEN", "ANTHROPIC_AUTH_TOKEN"];
|
|
7
|
+
/** Returns the Gateway's forward proxy URL from a Worker; children receive it as `HTTPS_PROXY`. */
|
|
8
|
+
export declare const forwardProxyUrl: (domain: GatewayDomain) => string;
|
|
9
|
+
/** Returns the URL a Worker behind the Gateway clones and fetches `repository` from. */
|
|
10
|
+
export declare const gatewayRepositoryUrl: (domain: GatewayDomain, repository: RepositoryName) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Returns gh's configuration files for the Gateway at `domain`. Neither file contains a token;
|
|
13
|
+
* gh reads the caller token from `GH_ENTERPRISE_TOKEN` and `GH_TOKEN`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ghGatewayConfig: (domain: GatewayDomain) => {
|
|
16
|
+
readonly "config.yml": "version: \"1\"\nhttp_unix_socket: /run/usine-gateway/http.sock\n";
|
|
17
|
+
readonly "hosts.yml": `git.${string & import("effect/Brand").Brand<"GatewayDomain">}:
|
|
18
|
+
git_protocol: https
|
|
19
|
+
`;
|
|
20
|
+
};
|
|
21
|
+
export interface GatewayEnvironmentOptions {
|
|
22
|
+
readonly domain: GatewayDomain;
|
|
23
|
+
readonly llmProviders: ReadonlyArray<GatewayLlmProvider>;
|
|
24
|
+
/** The machine directory that contains the `ghGatewayConfig` files. */
|
|
25
|
+
readonly ghConfigDirectory: string;
|
|
26
|
+
readonly callerToken: CallerToken;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* An Attempt's environment behind a Gateway. `exported` has no secrets and goes in each command
|
|
30
|
+
* line; `sent` contains the caller token and goes only through the SSH connection.
|
|
31
|
+
*/
|
|
32
|
+
export interface GatewayEnvironment {
|
|
33
|
+
readonly exported: Readonly<Record<string, string>>;
|
|
34
|
+
readonly sent: Readonly<Record<string, Redacted.Redacted<string>>>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns the environment that points git, gh, package managers, and Claude Code at the
|
|
38
|
+
* Gateway at `domain`.
|
|
39
|
+
*
|
|
40
|
+
* - git sends the caller token in `x-usine-gateway-token` to `git.<domain>` only, and rewrites
|
|
41
|
+
* `https://github.com/` and `https://git.<domain>/` to the Gateway. The header value is
|
|
42
|
+
* config entry 0 (`GIT_CONFIG_VALUE_0`).
|
|
43
|
+
* - gh uses `git.<domain>` through the Gateway socket, with the caller token as both its
|
|
44
|
+
* enterprise and GitHub token, so absolute pagination links also authenticate.
|
|
45
|
+
* - Package managers use the forward proxy at `<domain>:3128`; local addresses and the
|
|
46
|
+
* Gateway's own names bypass it.
|
|
47
|
+
* - Claude Code calls `llm.<domain>/anthropic` with the caller token if the Gateway has the
|
|
48
|
+
* Anthropic credential. Otherwise, and for Codex, the harness uses its own login through the
|
|
49
|
+
* forward proxy, whose allowlist must include the login's hosts.
|
|
50
|
+
*/
|
|
51
|
+
export declare const gatewayEnvironment: (options: GatewayEnvironmentOptions) => GatewayEnvironment;
|
|
52
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/ssh/gateway/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7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
|
|
3
|
+
/**
|
|
4
|
+
* The Unix socket that systemd forwards to the Gateway's port 80
|
|
5
|
+
* (`infra/hetzner/gateway/worker-cloud-init.yaml`). gh sends plain HTTP over it, and only HTTPS
|
|
6
|
+
* to `GH_HOST` directly.
|
|
7
|
+
*/
|
|
8
|
+
const GH_GATEWAY_SOCKET = "/run/usine-gateway/http.sock";
|
|
9
|
+
const FORWARD_PROXY_PORT = 3128;
|
|
10
|
+
/** The variables sent through the SSH connection because they contain the caller token. The Worker's sshd must accept each in `AcceptEnv`. */
|
|
11
|
+
export const GATEWAY_SENT_VARIABLES = [
|
|
12
|
+
"GIT_CONFIG_VALUE_0",
|
|
13
|
+
"GH_ENTERPRISE_TOKEN",
|
|
14
|
+
"GH_TOKEN",
|
|
15
|
+
"ANTHROPIC_AUTH_TOKEN",
|
|
16
|
+
];
|
|
17
|
+
/** Returns the Gateway's forward proxy URL from a Worker; children receive it as `HTTPS_PROXY`. */
|
|
18
|
+
export const forwardProxyUrl = (domain) => `http://${domain}:${FORWARD_PROXY_PORT}`;
|
|
19
|
+
/** Returns the URL a Worker behind the Gateway clones and fetches `repository` from. */
|
|
20
|
+
export const gatewayRepositoryUrl = (domain, repository) => `http://git.${domain}/${repository}.git`;
|
|
21
|
+
/**
|
|
22
|
+
* Returns gh's configuration files for the Gateway at `domain`. Neither file contains a token;
|
|
23
|
+
* gh reads the caller token from `GH_ENTERPRISE_TOKEN` and `GH_TOKEN`.
|
|
24
|
+
*/
|
|
25
|
+
export const ghGatewayConfig = (domain) => ({
|
|
26
|
+
"config.yml": `version: "1"\nhttp_unix_socket: ${GH_GATEWAY_SOCKET}\n`,
|
|
27
|
+
"hosts.yml": `git.${domain}:\n git_protocol: https\n`,
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Returns the environment that points git, gh, package managers, and Claude Code at the
|
|
31
|
+
* Gateway at `domain`.
|
|
32
|
+
*
|
|
33
|
+
* - git sends the caller token in `x-usine-gateway-token` to `git.<domain>` only, and rewrites
|
|
34
|
+
* `https://github.com/` and `https://git.<domain>/` to the Gateway. The header value is
|
|
35
|
+
* config entry 0 (`GIT_CONFIG_VALUE_0`).
|
|
36
|
+
* - gh uses `git.<domain>` through the Gateway socket, with the caller token as both its
|
|
37
|
+
* enterprise and GitHub token, so absolute pagination links also authenticate.
|
|
38
|
+
* - Package managers use the forward proxy at `<domain>:3128`; local addresses and the
|
|
39
|
+
* Gateway's own names bypass it.
|
|
40
|
+
* - Claude Code calls `llm.<domain>/anthropic` with the caller token if the Gateway has the
|
|
41
|
+
* Anthropic credential. Otherwise, and for Codex, the harness uses its own login through the
|
|
42
|
+
* forward proxy, whose allowlist must include the login's hosts.
|
|
43
|
+
*/
|
|
44
|
+
export const gatewayEnvironment = (options) => {
|
|
45
|
+
const { domain, callerToken } = options;
|
|
46
|
+
const gitBase = `http://git.${domain}/`;
|
|
47
|
+
const proxy = forwardProxyUrl(domain);
|
|
48
|
+
const direct = `localhost,127.0.0.1,::1,${domain}`;
|
|
49
|
+
const exported = {
|
|
50
|
+
GIT_CONFIG_COUNT: "3",
|
|
51
|
+
GIT_CONFIG_KEY_0: `http.${gitBase}.extraHeader`,
|
|
52
|
+
GIT_CONFIG_KEY_1: `url.${gitBase}.insteadOf`,
|
|
53
|
+
GIT_CONFIG_VALUE_1: "https://github.com/",
|
|
54
|
+
GIT_CONFIG_KEY_2: `url.${gitBase}.insteadOf`,
|
|
55
|
+
GIT_CONFIG_VALUE_2: `https://git.${domain}/`,
|
|
56
|
+
GH_HOST: `git.${domain}`,
|
|
57
|
+
GH_CONFIG_DIR: options.ghConfigDirectory,
|
|
58
|
+
GH_PROMPT_DISABLED: "1",
|
|
59
|
+
HTTPS_PROXY: proxy,
|
|
60
|
+
HTTP_PROXY: proxy,
|
|
61
|
+
https_proxy: proxy,
|
|
62
|
+
http_proxy: proxy,
|
|
63
|
+
NO_PROXY: direct,
|
|
64
|
+
no_proxy: direct,
|
|
65
|
+
};
|
|
66
|
+
const sent = {
|
|
67
|
+
GIT_CONFIG_VALUE_0: Redacted.make(`${GATEWAY_TOKEN_HEADER}: ${Redacted.value(callerToken)}`),
|
|
68
|
+
GH_ENTERPRISE_TOKEN: callerToken,
|
|
69
|
+
GH_TOKEN: callerToken,
|
|
70
|
+
};
|
|
71
|
+
if (!options.llmProviders.includes("anthropic"))
|
|
72
|
+
return { exported, sent };
|
|
73
|
+
return {
|
|
74
|
+
exported: { ...exported, ANTHROPIC_BASE_URL: `http://llm.${domain}/anthropic` },
|
|
75
|
+
sent: { ...sent, ANTHROPIC_AUTH_TOKEN: callerToken },
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/ssh/gateway/environment.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AAEzD,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,8IAA8I;AAC9I,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,oBAAoB;IACpB,qBAAqB;IACrB,UAAU;IACV,sBAAsB;CACd,CAAC;AAEX,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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AAQ,EAAE,kBAAkB,EAAE,cAAc,MAAM,YAAY,EAAE;QAC/E,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE;KACrD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { RemoteShell } from "@usine/agents/child-host";
|
|
2
|
+
import { SshDestination } from "@usine/core/worker";
|
|
3
|
+
import { DateTime, Effect, Schema, Stream } from "effect";
|
|
4
|
+
import { ChildProcess, type ChildProcessSpawner } from "effect/unstable/process";
|
|
5
|
+
export interface OpenForward {
|
|
6
|
+
/** The SSH client number, starting at 1. `reopen` replaces only this generation. */
|
|
7
|
+
readonly generation: number;
|
|
8
|
+
readonly url: URL;
|
|
9
|
+
}
|
|
10
|
+
declare const GatewayForwardClosed_base: Schema.Class<GatewayForwardClosed, Schema.TaggedStruct<"GatewayForwardClosed", {
|
|
11
|
+
readonly gateway: Schema.brand<Schema.String, "SshDestination">;
|
|
12
|
+
readonly generation: Schema.Int;
|
|
13
|
+
readonly since: Schema.DateTimeUtc;
|
|
14
|
+
readonly reason: Schema.NonEmptyString;
|
|
15
|
+
}>, import("effect/Cause").YieldableError>;
|
|
16
|
+
/**
|
|
17
|
+
* The error for a closed admin API forward, whose SSH client didn't open or exited. `since` is
|
|
18
|
+
* when the Gateway became unreachable, and `reason` is the SSH client's error.
|
|
19
|
+
*/
|
|
20
|
+
export declare class GatewayForwardClosed extends GatewayForwardClosed_base {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* An SSH forward from a local port to a Gateway's admin API (ADR 0027, amendment of
|
|
24
|
+
* 2026-10-19). It opens with the first Worker behind the Gateway, reopens after a pause when
|
|
25
|
+
* its client exits, and closes with the last Worker or the executor.
|
|
26
|
+
*/
|
|
27
|
+
export interface GatewayForward {
|
|
28
|
+
/** The Gateway's SSH destination, used to identify it in logs and messages. */
|
|
29
|
+
readonly gateway: SshDestination;
|
|
30
|
+
/** The SSH command an operator can run to open the same forward manually. */
|
|
31
|
+
readonly command: string;
|
|
32
|
+
/** Returns the open forward, waiting while a client is opening. Fails immediately while the forward is closed. */
|
|
33
|
+
readonly current: Effect.Effect<OpenForward, GatewayForwardClosed>;
|
|
34
|
+
/**
|
|
35
|
+
* Replaces SSH client `generation`, or ends the pause after it closed, and waits for the next
|
|
36
|
+
* client. If another request already replaced it, waits for the current forward.
|
|
37
|
+
*/
|
|
38
|
+
readonly reopen: (generation: number) => Effect.Effect<OpenForward, GatewayForwardClosed>;
|
|
39
|
+
/** Records an unanswered request sent at `sentAt`, and returns when the first unanswered request since the last response was sent. */
|
|
40
|
+
readonly unanswered: (sentAt: DateTime.Utc) => Effect.Effect<DateTime.Utc>;
|
|
41
|
+
/** Records a response from the admin API, so the next unanswered request starts a new outage. */
|
|
42
|
+
readonly answered: Effect.Effect<void>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Opens a forward to the admin API at `adminPort` on `gateway`, using the SSH client and
|
|
46
|
+
* environment of `shell`, and keeps it open until the caller's scope closes. Each client
|
|
47
|
+
* listens on a kernel-picked port of 127.0.0.1, so it never conflicts with an operator's
|
|
48
|
+
* forward.
|
|
49
|
+
*/
|
|
50
|
+
export declare const gatewayForwardFor: (spawner: {
|
|
51
|
+
spawn(command: ChildProcess.Command): Effect.Effect<ChildProcessSpawner.ChildProcessHandle, import("effect/PlatformError").PlatformError, import("effect/Scope").Scope>;
|
|
52
|
+
exitCode(command: ChildProcess.Command): Effect.Effect<ChildProcessSpawner.ExitCode, import("effect/PlatformError").PlatformError>;
|
|
53
|
+
streamString(command: ChildProcess.Command, options?: {
|
|
54
|
+
readonly includeStderr?: boolean | undefined;
|
|
55
|
+
}): Stream.Stream<string, import("effect/PlatformError").PlatformError>;
|
|
56
|
+
streamLines(command: ChildProcess.Command, options?: {
|
|
57
|
+
readonly includeStderr?: boolean | undefined;
|
|
58
|
+
}): Stream.Stream<string, import("effect/PlatformError").PlatformError>;
|
|
59
|
+
lines(command: ChildProcess.Command, options?: {
|
|
60
|
+
readonly includeStderr?: boolean | undefined;
|
|
61
|
+
}): Effect.Effect<Array<string>, import("effect/PlatformError").PlatformError>;
|
|
62
|
+
string(command: ChildProcess.Command, options?: {
|
|
63
|
+
readonly includeStderr?: boolean | undefined;
|
|
64
|
+
}): Effect.Effect<string, import("effect/PlatformError").PlatformError>;
|
|
65
|
+
}, shell: Pick<RemoteShell, "ssh" | "sshEnvironment">, gateway: string & import("effect/Brand").Brand<"SshDestination">, adminPort: number & import("effect/Brand").Brand<"GatewayAdminPort">) => Effect.Effect<{
|
|
66
|
+
gateway: string & import("effect/Brand").Brand<"SshDestination">;
|
|
67
|
+
command: string;
|
|
68
|
+
current: Effect.Effect<OpenForward, GatewayForwardClosed, never>;
|
|
69
|
+
reopen: (generation: number) => Effect.Effect<OpenForward, GatewayForwardClosed, never>;
|
|
70
|
+
unanswered: (sentAt: DateTime.Utc) => Effect.Effect<DateTime.Utc, never, never>;
|
|
71
|
+
answered: Effect.Effect<void, never, never>;
|
|
72
|
+
}, never, import("effect/Scope").Scope>;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=forward.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forward.d.ts","sourceRoot":"","sources":["../../../src/ssh/gateway/forward.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAyB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAY,MAAM,EAA8B,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAcjF,MAAM,WAAW,WAAW;IAC1B,oFAAoF;IACpF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;CACnB;;;;;;;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,yBAOxC;CAAG;AAEL;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kHAAkH;IAClH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IACnE;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IAC1F,sIAAsI;IACtI,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,KAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3E,iGAAiG;IACjG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CACxC;AA6DD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;yBAyQA,QAAQ,CAAC,GAAG;;uCAWxC,CAAC"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { createServer } from "node:net";
|
|
2
|
+
import { SshDestination } from "@usine/core/worker";
|
|
3
|
+
import { DateTime, Deferred, Effect, Fiber, Option, Ref, Result, Schema, Stream } from "effect";
|
|
4
|
+
import { ChildProcess } from "effect/unstable/process";
|
|
5
|
+
/** The line the SSH client prints through `LocalCommand` when its local port is listening. */
|
|
6
|
+
const OPEN_LINE = "usine-gateway-forward-open";
|
|
7
|
+
/** The time an SSH client has to connect and listen before it's replaced. */
|
|
8
|
+
const OPEN_TIMEOUT = "30 seconds";
|
|
9
|
+
/** The time a request waits for the forward to open. */
|
|
10
|
+
const OPEN_WAIT = "1 minute";
|
|
11
|
+
/** The maximum pause between SSH clients, in milliseconds. The pause doubles from one second after each failure. */
|
|
12
|
+
const MAX_PAUSE_MILLIS = 60_000;
|
|
13
|
+
/**
|
|
14
|
+
* The error for a closed admin API forward, whose SSH client didn't open or exited. `since` is
|
|
15
|
+
* when the Gateway became unreachable, and `reason` is the SSH client's error.
|
|
16
|
+
*/
|
|
17
|
+
export class GatewayForwardClosed extends Schema.TaggedError("@usine/executor/GatewayForwardClosed")("GatewayForwardClosed", {
|
|
18
|
+
gateway: SshDestination,
|
|
19
|
+
generation: Schema.Int,
|
|
20
|
+
since: Schema.DateTimeUtc,
|
|
21
|
+
reason: Schema.NonEmptyString,
|
|
22
|
+
}) {
|
|
23
|
+
}
|
|
24
|
+
const notOpened = (reason) => ({ _tag: "NotOpened", reason });
|
|
25
|
+
const exited = (reason) => ({ _tag: "Exited", reason });
|
|
26
|
+
const REPLACED = { _tag: "Replaced" };
|
|
27
|
+
const ListenerAddress = Schema.Struct({ port: Schema.Int });
|
|
28
|
+
/** Returns a free port on 127.0.0.1 picked by the kernel, released for the SSH client to listen on. */
|
|
29
|
+
const freeLocalPort = Effect.callback((resume) => {
|
|
30
|
+
const server = createServer();
|
|
31
|
+
server.once("error", (cause) => resume(Effect.fail(cause)));
|
|
32
|
+
server.listen(0, "127.0.0.1", () => {
|
|
33
|
+
const address = Schema.decodeUnknownOption(ListenerAddress)(server.address());
|
|
34
|
+
server.close(() => resume(Option.match(address, {
|
|
35
|
+
onNone: () => Effect.fail(new Error("the listener reported no port")),
|
|
36
|
+
onSome: ({ port }) => Effect.succeed(port),
|
|
37
|
+
})));
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
/** Returns the SSH client's stderr on one line, or its exit code if stderr is empty. */
|
|
41
|
+
const complaint = (stderr, exitCode) => {
|
|
42
|
+
const lines = stderr
|
|
43
|
+
.split("\n")
|
|
44
|
+
.map((line) => line.trim())
|
|
45
|
+
.filter((line) => line !== "");
|
|
46
|
+
return lines.length > 0 ? lines.join("; ") : `ssh exited with code ${String(exitCode)}`;
|
|
47
|
+
};
|
|
48
|
+
const pauseAfter = (failures) => Math.min(1000 * 2 ** Math.max(failures - 1, 0), MAX_PAUSE_MILLIS);
|
|
49
|
+
/**
|
|
50
|
+
* Opens a forward to the admin API at `adminPort` on `gateway`, using the SSH client and
|
|
51
|
+
* environment of `shell`, and keeps it open until the caller's scope closes. Each client
|
|
52
|
+
* listens on a kernel-picked port of 127.0.0.1, so it never conflicts with an operator's
|
|
53
|
+
* forward.
|
|
54
|
+
*/
|
|
55
|
+
export const gatewayForwardFor = Effect.fn("SshExecutor.gatewayForwardFor")(function* (spawner, shell, gateway, adminPort) {
|
|
56
|
+
const fields = { gateway, adminPort };
|
|
57
|
+
yield* Effect.annotateCurrentSpan(fields);
|
|
58
|
+
const forwardSpec = (port) => `127.0.0.1:${String(port)}:127.0.0.1:${String(adminPort)}`;
|
|
59
|
+
const command = [
|
|
60
|
+
shell.ssh.command,
|
|
61
|
+
...shell.ssh.args,
|
|
62
|
+
"-N",
|
|
63
|
+
"-o",
|
|
64
|
+
"ExitOnForwardFailure=yes",
|
|
65
|
+
"-L",
|
|
66
|
+
forwardSpec(adminPort),
|
|
67
|
+
gateway,
|
|
68
|
+
].join(" ");
|
|
69
|
+
const argumentsFor = (port) => [
|
|
70
|
+
...shell.ssh.args,
|
|
71
|
+
"-N",
|
|
72
|
+
// LocalCommand runs when all listeners are up, ExitOnForwardFailure exits if a listener fails, and ControlPath=none avoids the operator's shared connections.
|
|
73
|
+
"-o",
|
|
74
|
+
"ExitOnForwardFailure=yes",
|
|
75
|
+
"-o",
|
|
76
|
+
"ControlPath=none",
|
|
77
|
+
"-o",
|
|
78
|
+
"PermitLocalCommand=yes",
|
|
79
|
+
"-o",
|
|
80
|
+
`LocalCommand=echo ${OPEN_LINE}`,
|
|
81
|
+
"-L",
|
|
82
|
+
forwardSpec(port),
|
|
83
|
+
gateway,
|
|
84
|
+
];
|
|
85
|
+
const generationNumbered = (number) => Effect.all({
|
|
86
|
+
opened: Deferred.make(),
|
|
87
|
+
replace: Deferred.make(),
|
|
88
|
+
next: Deferred.make(),
|
|
89
|
+
}).pipe(Effect.map((signals) => ({ number, ...signals })));
|
|
90
|
+
const first = yield* generationNumbered(1);
|
|
91
|
+
const state = yield* Ref.make({ _tag: "Opening", generation: first });
|
|
92
|
+
const runClient = Effect.fn("SshExecutor.runGatewayForward")(function* (generation, closedSince) {
|
|
93
|
+
yield* Effect.annotateCurrentSpan({ ...fields, generation: generation.number });
|
|
94
|
+
const picked = yield* Effect.result(freeLocalPort);
|
|
95
|
+
if (Result.isFailure(picked))
|
|
96
|
+
return notOpened(`no free port on 127.0.0.1: ${picked.failure.message}`);
|
|
97
|
+
const port = picked.success;
|
|
98
|
+
yield* Effect.annotateCurrentSpan({ port });
|
|
99
|
+
yield* Effect.logDebug("Starting an SSH client for the forward to the Gateway's admin API", {
|
|
100
|
+
...fields,
|
|
101
|
+
generation: generation.number,
|
|
102
|
+
port,
|
|
103
|
+
});
|
|
104
|
+
return yield* Effect.scoped(Effect.gen(function* () {
|
|
105
|
+
const handle = yield* spawner.spawn(ChildProcess.make(shell.ssh.command, argumentsFor(port), {
|
|
106
|
+
env: { ...shell.sshEnvironment },
|
|
107
|
+
extendEnv: false,
|
|
108
|
+
detached: false,
|
|
109
|
+
forceKillAfter: "5 seconds",
|
|
110
|
+
stdin: "ignore",
|
|
111
|
+
}));
|
|
112
|
+
const stderr = yield* handle.stderr.pipe(Stream.decodeText(), Stream.mkString, Effect.forkScoped);
|
|
113
|
+
const reported = (exitCode) => Fiber.join(stderr).pipe(Effect.map((text) => complaint(text, exitCode)));
|
|
114
|
+
const listening = yield* handle.stdout.pipe(Stream.decodeText(), Stream.splitLines, Stream.filter((line) => line.trim() === OPEN_LINE), Stream.runHead, Effect.timeoutOption(OPEN_TIMEOUT));
|
|
115
|
+
if (Option.isNone(listening))
|
|
116
|
+
return notOpened(`ssh didn't open the forward within ${OPEN_TIMEOUT}`);
|
|
117
|
+
if (Option.isNone(listening.value))
|
|
118
|
+
return notOpened(yield* reported(Number(yield* handle.exitCode)));
|
|
119
|
+
const open = {
|
|
120
|
+
generation: generation.number,
|
|
121
|
+
url: new URL(`http://127.0.0.1:${String(port)}`),
|
|
122
|
+
};
|
|
123
|
+
yield* Ref.set(state, { _tag: "Open", generation, open });
|
|
124
|
+
yield* Deferred.succeed(generation.opened, open);
|
|
125
|
+
yield* Option.match(closedSince, {
|
|
126
|
+
onNone: () => Effect.logInfo("Opened the forward to the Gateway's admin API", {
|
|
127
|
+
...fields,
|
|
128
|
+
generation: generation.number,
|
|
129
|
+
port,
|
|
130
|
+
}),
|
|
131
|
+
onSome: (since) => Effect.logInfo("Reopened the forward to the Gateway's admin API", {
|
|
132
|
+
...fields,
|
|
133
|
+
generation: generation.number,
|
|
134
|
+
port,
|
|
135
|
+
closedSince: DateTime.formatIso(since),
|
|
136
|
+
}),
|
|
137
|
+
});
|
|
138
|
+
// Sets the state to closed first, so no request uses a port the client no longer listens on.
|
|
139
|
+
const closedNow = (reason) => DateTime.now.pipe(Effect.flatMap((since) => Ref.set(state, {
|
|
140
|
+
_tag: "Closed",
|
|
141
|
+
generation,
|
|
142
|
+
closed: new GatewayForwardClosed({
|
|
143
|
+
gateway,
|
|
144
|
+
generation: generation.number,
|
|
145
|
+
since,
|
|
146
|
+
reason,
|
|
147
|
+
}),
|
|
148
|
+
})));
|
|
149
|
+
return yield* Effect.raceFirst(handle.exitCode.pipe(Effect.flatMap((code) => reported(Number(code))), Effect.catch((error) => Effect.succeed(`can't read the SSH client's exit code: ${error.message}`)), Effect.tap(closedNow), Effect.map(exited)), Deferred.await(generation.replace).pipe(Effect.andThen(closedNow("replaced after a request got no response")), Effect.as(REPLACED)));
|
|
150
|
+
})).pipe(Effect.catch((error) => Effect.succeed(notOpened(`can't run ${shell.ssh.command}: ${error.message}`))));
|
|
151
|
+
});
|
|
152
|
+
// Runs until the caller's scope closes, with one span per SSH client.
|
|
153
|
+
const supervise = Effect.gen(function* () {
|
|
154
|
+
let generation = first;
|
|
155
|
+
let failures = 0;
|
|
156
|
+
let closedSince = Option.none();
|
|
157
|
+
while (true) {
|
|
158
|
+
const end = yield* runClient(generation, closedSince);
|
|
159
|
+
const now = yield* DateTime.now;
|
|
160
|
+
if (end._tag === "Replaced") {
|
|
161
|
+
failures = 0;
|
|
162
|
+
closedSince = Option.some(now);
|
|
163
|
+
yield* Effect.logInfo("Replacing the forward to the Gateway's admin API, which a request found unanswered", { ...fields, generation: generation.number });
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
failures = end._tag === "Exited" ? 1 : failures + 1;
|
|
167
|
+
const since = end._tag === "Exited" ? now : Option.getOrElse(closedSince, () => now);
|
|
168
|
+
closedSince = Option.some(since);
|
|
169
|
+
const pause = pauseAfter(failures);
|
|
170
|
+
const closed = new GatewayForwardClosed({
|
|
171
|
+
gateway,
|
|
172
|
+
generation: generation.number,
|
|
173
|
+
since,
|
|
174
|
+
reason: end.reason,
|
|
175
|
+
});
|
|
176
|
+
yield* Ref.set(state, { _tag: "Closed", generation, closed });
|
|
177
|
+
yield* Deferred.fail(generation.opened, closed);
|
|
178
|
+
yield* Effect.logWarning(end._tag === "Exited"
|
|
179
|
+
? "The forward to the Gateway's admin API exited; reopening it after a pause"
|
|
180
|
+
: "Could not open the forward to the Gateway's admin API; trying again after a pause", {
|
|
181
|
+
...fields,
|
|
182
|
+
generation: generation.number,
|
|
183
|
+
closedSince: DateTime.formatIso(since),
|
|
184
|
+
failures,
|
|
185
|
+
pauseSeconds: pause / 1000,
|
|
186
|
+
reason: end.reason,
|
|
187
|
+
});
|
|
188
|
+
const trigger = yield* Effect.raceFirst(Effect.sleep(pause).pipe(Effect.as("pause elapsed")), Deferred.await(generation.replace).pipe(Effect.as("request")));
|
|
189
|
+
yield* Effect.logInfo("Reopening the forward to the Gateway's admin API", {
|
|
190
|
+
...fields,
|
|
191
|
+
generation: generation.number + 1,
|
|
192
|
+
closedSince: DateTime.formatIso(since),
|
|
193
|
+
trigger,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
const next = yield* generationNumbered(generation.number + 1);
|
|
197
|
+
yield* Ref.set(state, { _tag: "Opening", generation: next });
|
|
198
|
+
yield* Deferred.succeed(generation.next, next);
|
|
199
|
+
generation = next;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
yield* supervise.pipe(Effect.onInterrupt(() => Effect.logInfo("Closed the forward to the Gateway's admin API", fields)), Effect.forkScoped);
|
|
203
|
+
const notOpenedWithin = (generation) => DateTime.now.pipe(Effect.flatMap((since) => new GatewayForwardClosed({
|
|
204
|
+
gateway,
|
|
205
|
+
generation,
|
|
206
|
+
since,
|
|
207
|
+
reason: `the forward didn't open within ${OPEN_WAIT}`,
|
|
208
|
+
})));
|
|
209
|
+
const current = Effect.gen(function* () {
|
|
210
|
+
const now = yield* Ref.get(state);
|
|
211
|
+
switch (now._tag) {
|
|
212
|
+
case "Open":
|
|
213
|
+
return now.open;
|
|
214
|
+
case "Closed":
|
|
215
|
+
return yield* now.closed;
|
|
216
|
+
case "Opening":
|
|
217
|
+
return yield* Deferred.await(now.generation.opened).pipe(Effect.timeoutOrElse({
|
|
218
|
+
duration: OPEN_WAIT,
|
|
219
|
+
orElse: () => notOpenedWithin(now.generation.number),
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
const reopen = Effect.fn("SshExecutor.reopenGatewayForward")(function* (generation) {
|
|
224
|
+
yield* Effect.annotateCurrentSpan({ ...fields, generation });
|
|
225
|
+
const now = yield* Ref.get(state);
|
|
226
|
+
if (now.generation.number !== generation) {
|
|
227
|
+
yield* Effect.logDebug("Another request replaced the forward to the Gateway's admin API already", { ...fields, generation, current: now.generation.number });
|
|
228
|
+
return yield* current;
|
|
229
|
+
}
|
|
230
|
+
yield* Deferred.succeed(now.generation.replace, undefined);
|
|
231
|
+
return yield* Deferred.await(now.generation.next).pipe(Effect.flatMap((next) => Deferred.await(next.opened)), Effect.timeoutOrElse({
|
|
232
|
+
duration: OPEN_WAIT,
|
|
233
|
+
orElse: () => notOpenedWithin(generation + 1),
|
|
234
|
+
}));
|
|
235
|
+
});
|
|
236
|
+
const silentSince = yield* Ref.make(Option.none());
|
|
237
|
+
const unanswered = (sentAt) => Ref.modify(silentSince, (since) => {
|
|
238
|
+
const first = Option.match(since, {
|
|
239
|
+
onNone: () => sentAt,
|
|
240
|
+
onSome: (earlier) => DateTime.min(earlier, sentAt),
|
|
241
|
+
});
|
|
242
|
+
return [first, Option.some(first)];
|
|
243
|
+
});
|
|
244
|
+
const answered = Ref.set(silentSince, Option.none());
|
|
245
|
+
return { gateway, command, current, reopen, unanswered, answered };
|
|
246
|
+
});
|
|
247
|
+
//# sourceMappingURL=forward.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forward.js","sourceRoot":"","sources":["../../../src/ssh/gateway/forward.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAyB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChG,OAAO,EAAE,YAAY,EAA4B,MAAM,yBAAyB,CAAC;AAEjF,8FAA8F;AAC9F,MAAM,SAAS,GAAG,4BAA4B,CAAC;AAE/C,6EAA6E;AAC7E,MAAM,YAAY,GAAG,YAAY,CAAC;AAElC,wDAAwD;AACxD,MAAM,SAAS,GAAG,UAAU,CAAC;AAE7B,oHAAoH;AACpH,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAQhC;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,MAAM,CAAC,WAAW,CAC1D,sCAAsC,CACvC,CAAC,sBA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CredentialKind } from "@usine/core/worker";
|
|
3
|
+
import { Effect, Option } from "effect";
|
|
4
|
+
import { ExecutorOperationError, WorkerCapabilityError } from "../../executor.ts";
|
|
5
|
+
import type { HarnessProbe } from "../../harness-preflight.ts";
|
|
6
|
+
import { type RemoteCommands } from "../../remote/commands.ts";
|
|
7
|
+
import type { MachineGateway, SshMachine } from "../model.ts";
|
|
8
|
+
/**
|
|
9
|
+
* Returns the credential kind the Gateway injects for `harness`, as recorded by the last
|
|
10
|
+
* preflight. Only Claude Code uses a Gateway credential; Codex and Pi use their own logins.
|
|
11
|
+
*/
|
|
12
|
+
export declare const gatewayCredentialFor: (gateway: MachineGateway, harness: Harness) => Effect.Effect<Option.Option<GatewayCredentialKind>>;
|
|
13
|
+
/**
|
|
14
|
+
* Verifies the Gateway in front of an SSH Worker without attaching anything: the admin API
|
|
15
|
+
* forward opens and accepts the admin token, the machine's sshd accepts the caller-token
|
|
16
|
+
* variables, and the machine can connect to `git.<domain>`, which rejects a request without a caller
|
|
17
|
+
* token. If the Gateway has the Anthropic credential, records its kind for the Worker.
|
|
18
|
+
*/
|
|
19
|
+
export declare const verifyGateway: (commands: RemoteCommands, worker: string & import("effect/Brand").Brand<"WorkerName">, machine: SshMachine, gateway: MachineGateway) => Effect.Effect<undefined, ExecutorOperationError | WorkerCapabilityError, never>;
|
|
20
|
+
/**
|
|
21
|
+
* Probes a brain on a Worker behind a Gateway (ADR 0027). If the Gateway has the Anthropic
|
|
22
|
+
* credential, checks only the Claude Code binary. Otherwise, Claude Code and Codex use the
|
|
23
|
+
* operator's login (ADR 0026): `probe` checks the login, then the machine must connect to the
|
|
24
|
+
* login's hosts through the forward proxy. Pi goes to `probe`, which rejects it on any remote
|
|
25
|
+
* machine.
|
|
26
|
+
*/
|
|
27
|
+
export declare const gatewayHarnessProbe: (commands: RemoteCommands, machine: SshMachine, gateway: MachineGateway, probe: HarnessProbe) => HarnessProbe;
|
|
28
|
+
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../../src/ssh/gateway/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,qBAAqB,EAAc,MAAM,oBAAoB,CAAC;AAC5E,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,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAwF9D;;;GAGG;AACH,eAAO,MAAM,oBAAoB,YACtB,cAAc,WACd,OAAO,KACf,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAQpD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,0NAgFxB,CAAC;AAmCH;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,aACpB,cAAc,WACf,UAAU,WACV,cAAc,SAChB,YAAY,KAClB,YA2FF,CAAC"}
|