@celljs/ta-exec 4.6.1 → 4.8.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.en.md +43 -0
- package/README.md +5 -1
- package/esm/node/exec-client.d.ts +28 -11
- package/esm/node/exec-client.js +89 -33
- package/esm/node/exec-client.js.map +1 -1
- package/esm/node/exec-peer.d.ts +40 -0
- package/esm/node/exec-peer.js +167 -0
- package/esm/node/exec-peer.js.map +1 -0
- package/esm/node/exec-protocol.d.ts +19 -1
- package/esm/node/exec-remote-source.d.ts +5 -0
- package/esm/node/exec-remote-source.js +9 -0
- package/esm/node/exec-remote-source.js.map +1 -0
- package/esm/node/exec-rpc.d.ts +21 -3
- package/esm/node/exec-rpc.js +14 -3
- package/esm/node/exec-rpc.js.map +1 -1
- package/esm/node/exec-server.d.ts +2 -26
- package/esm/node/exec-server.js +3 -132
- package/esm/node/exec-server.js.map +1 -1
- package/esm/node/exec-stdio.d.ts +27 -0
- package/esm/node/exec-stdio.js +60 -0
- package/esm/node/exec-stdio.js.map +1 -0
- package/esm/node/index.d.ts +8 -0
- package/esm/node/index.js +8 -0
- package/esm/node/index.js.map +1 -1
- package/esm/node/local-exec-environment.d.ts +2 -2
- package/esm/node/local-exec-environment.js +11 -11
- package/esm/node/local-exec-environment.js.map +1 -1
- package/esm/node/remote-exec-environment.d.ts +3 -2
- package/esm/node/remote-exec-environment.js +41 -2
- package/esm/node/remote-exec-environment.js.map +1 -1
- package/esm/node/ssh/node-dist.d.ts +20 -0
- package/esm/node/ssh/node-dist.js +77 -0
- package/esm/node/ssh/node-dist.js.map +1 -0
- package/esm/node/ssh/ssh-askpass.d.ts +24 -0
- package/esm/node/ssh/ssh-askpass.js +112 -0
- package/esm/node/ssh/ssh-askpass.js.map +1 -0
- package/esm/node/ssh/ssh-config.d.ts +20 -0
- package/esm/node/ssh/ssh-config.js +127 -0
- package/esm/node/ssh/ssh-config.js.map +1 -0
- package/esm/node/ssh/ssh-host.d.ts +73 -0
- package/esm/node/ssh/ssh-host.js +258 -0
- package/esm/node/ssh/ssh-host.js.map +1 -0
- package/esm/node/ssh/ssh-util.d.ts +45 -0
- package/esm/node/ssh/ssh-util.js +110 -0
- package/esm/node/ssh/ssh-util.js.map +1 -0
- package/lib/node/exec-client.d.ts +28 -11
- package/lib/node/exec-client.d.ts.map +1 -1
- package/lib/node/exec-client.js +89 -33
- package/lib/node/exec-client.js.map +1 -1
- package/lib/node/exec-peer.d.ts +41 -0
- package/lib/node/exec-peer.d.ts.map +1 -0
- package/lib/node/exec-peer.js +171 -0
- package/lib/node/exec-peer.js.map +1 -0
- package/lib/node/exec-protocol.d.ts +19 -1
- package/lib/node/exec-protocol.d.ts.map +1 -1
- package/lib/node/exec-remote-source.d.ts +6 -0
- package/lib/node/exec-remote-source.d.ts.map +1 -0
- package/lib/node/exec-remote-source.js +10 -0
- package/lib/node/exec-remote-source.js.map +1 -0
- package/lib/node/exec-rpc.d.ts +21 -3
- package/lib/node/exec-rpc.d.ts.map +1 -1
- package/lib/node/exec-rpc.js +14 -3
- package/lib/node/exec-rpc.js.map +1 -1
- package/lib/node/exec-server.d.ts +2 -26
- package/lib/node/exec-server.d.ts.map +1 -1
- package/lib/node/exec-server.js +4 -134
- package/lib/node/exec-server.js.map +1 -1
- package/lib/node/exec-server.spec.js +4 -1
- package/lib/node/exec-server.spec.js.map +1 -1
- package/lib/node/exec-stdio.d.ts +28 -0
- package/lib/node/exec-stdio.d.ts.map +1 -0
- package/lib/node/exec-stdio.js +64 -0
- package/lib/node/exec-stdio.js.map +1 -0
- package/lib/node/exec-stdio.spec.d.ts +2 -0
- package/lib/node/exec-stdio.spec.d.ts.map +1 -0
- package/lib/node/exec-stdio.spec.js +106 -0
- package/lib/node/exec-stdio.spec.js.map +1 -0
- package/lib/node/index.d.ts +8 -0
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +8 -0
- package/lib/node/index.js.map +1 -1
- package/lib/node/local-exec-environment.d.ts +2 -2
- package/lib/node/local-exec-environment.d.ts.map +1 -1
- package/lib/node/local-exec-environment.js +10 -10
- package/lib/node/local-exec-environment.js.map +1 -1
- package/lib/node/local-exec-environment.spec.js +2 -0
- package/lib/node/local-exec-environment.spec.js.map +1 -1
- package/lib/node/remote-exec-environment.d.ts +3 -2
- package/lib/node/remote-exec-environment.d.ts.map +1 -1
- package/lib/node/remote-exec-environment.js +41 -2
- package/lib/node/remote-exec-environment.js.map +1 -1
- package/lib/node/ssh/node-dist.d.ts +21 -0
- package/lib/node/ssh/node-dist.d.ts.map +1 -0
- package/lib/node/ssh/node-dist.js +80 -0
- package/lib/node/ssh/node-dist.js.map +1 -0
- package/lib/node/ssh/ssh-askpass.d.ts +25 -0
- package/lib/node/ssh/ssh-askpass.d.ts.map +1 -0
- package/lib/node/ssh/ssh-askpass.js +114 -0
- package/lib/node/ssh/ssh-askpass.js.map +1 -0
- package/lib/node/ssh/ssh-config.d.ts +21 -0
- package/lib/node/ssh/ssh-config.d.ts.map +1 -0
- package/lib/node/ssh/ssh-config.js +130 -0
- package/lib/node/ssh/ssh-config.js.map +1 -0
- package/lib/node/ssh/ssh-host.d.ts +74 -0
- package/lib/node/ssh/ssh-host.d.ts.map +1 -0
- package/lib/node/ssh/ssh-host.js +262 -0
- package/lib/node/ssh/ssh-host.js.map +1 -0
- package/lib/node/ssh/ssh-host.spec.d.ts +2 -0
- package/lib/node/ssh/ssh-host.spec.d.ts.map +1 -0
- package/lib/node/ssh/ssh-host.spec.js +182 -0
- package/lib/node/ssh/ssh-host.spec.js.map +1 -0
- package/lib/node/ssh/ssh-util.d.ts +46 -0
- package/lib/node/ssh/ssh-util.d.ts.map +1 -0
- package/lib/node/ssh/ssh-util.js +113 -0
- package/lib/node/ssh/ssh-util.js.map +1 -0
- package/lib/node/ssh/ssh-util.spec.d.ts +2 -0
- package/lib/node/ssh/ssh-util.spec.d.ts.map +1 -0
- package/lib/node/ssh/ssh-util.spec.js +87 -0
- package/lib/node/ssh/ssh-util.spec.js.map +1 -0
- package/package.json +3 -3
- package/src/node/exec-client.ts +108 -39
- package/src/node/exec-peer.ts +186 -0
- package/src/node/exec-protocol.ts +21 -1
- package/src/node/exec-remote-source.ts +7 -0
- package/src/node/exec-rpc.ts +23 -3
- package/src/node/exec-server.spec.ts +4 -1
- package/src/node/exec-server.ts +4 -140
- package/src/node/exec-stdio.spec.ts +108 -0
- package/src/node/exec-stdio.ts +75 -0
- package/src/node/index.ts +8 -0
- package/src/node/local-exec-environment.spec.ts +2 -0
- package/src/node/local-exec-environment.ts +11 -10
- package/src/node/remote-exec-environment.ts +41 -3
- package/src/node/ssh/node-dist.ts +83 -0
- package/src/node/ssh/ssh-askpass.ts +117 -0
- package/src/node/ssh/ssh-config.ts +128 -0
- package/src/node/ssh/ssh-host.spec.ts +189 -0
- package/src/node/ssh/ssh-host.ts +300 -0
- package/src/node/ssh/ssh-util.spec.ts +97 -0
- package/src/node/ssh/ssh-util.ts +127 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SshConfig = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_os_1 = require("node:os");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
/**
|
|
8
|
+
* The hosts of an OpenSSH configuration that a person picks from: `Host` names without wildcards, as
|
|
9
|
+
* ssh reads them. An `Include` inside a `Host` block counts only for the hosts that block matches (ssh
|
|
10
|
+
* reads the file only for them), and one inside a `Match` block not at all.
|
|
11
|
+
*/
|
|
12
|
+
var SshConfig;
|
|
13
|
+
(function (SshConfig) {
|
|
14
|
+
const MAX_FILES = 16;
|
|
15
|
+
/** The hosts of ~/.ssh/config and the files it includes, in order, each once. */
|
|
16
|
+
function hosts(file = (0, node_path_1.join)((0, node_os_1.homedir)(), '.ssh', 'config')) {
|
|
17
|
+
const found = new Set();
|
|
18
|
+
read(file, ['*'], found, new Set());
|
|
19
|
+
return [...found];
|
|
20
|
+
}
|
|
21
|
+
SshConfig.hosts = hosts;
|
|
22
|
+
function parse(text) {
|
|
23
|
+
const entries = [];
|
|
24
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
25
|
+
const line = raw.replace(/#.*/, '').trim();
|
|
26
|
+
const found = /^(\w+)(?:\s*=\s*|\s+)(.+)$/.exec(line);
|
|
27
|
+
if (!found) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const values = words(found[2]);
|
|
31
|
+
const keyword = found[1].toLowerCase();
|
|
32
|
+
if (keyword === 'host') {
|
|
33
|
+
entries.push({ host: values });
|
|
34
|
+
}
|
|
35
|
+
else if (keyword === 'match') {
|
|
36
|
+
entries.push({ match: true });
|
|
37
|
+
}
|
|
38
|
+
else if (keyword === 'include') {
|
|
39
|
+
entries.push(...values.map(include => ({ include })));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return entries;
|
|
43
|
+
}
|
|
44
|
+
SshConfig.parse = parse;
|
|
45
|
+
/** Whether ssh applies a `Host` line of these patterns to `host`: one matches, and no `!` one does. */
|
|
46
|
+
function matches(patterns, host) {
|
|
47
|
+
let matched = false;
|
|
48
|
+
for (const pattern of patterns) {
|
|
49
|
+
const negated = pattern.startsWith('!');
|
|
50
|
+
if (glob(negated ? pattern.slice(1) : pattern).test(host)) {
|
|
51
|
+
if (negated) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
matched = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return matched;
|
|
58
|
+
}
|
|
59
|
+
SshConfig.matches = matches;
|
|
60
|
+
/**
|
|
61
|
+
* `scope`: the patterns of the `Host` block the file is included from (`['*']` at the top). A host of
|
|
62
|
+
* the file counts when that block applies to it.
|
|
63
|
+
*/
|
|
64
|
+
function read(file, scope, found, seen) {
|
|
65
|
+
if (seen.has(file) || seen.size >= MAX_FILES) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
seen.add(file);
|
|
69
|
+
let text;
|
|
70
|
+
try {
|
|
71
|
+
text = (0, node_fs_1.readFileSync)(file, 'utf8');
|
|
72
|
+
}
|
|
73
|
+
catch (_a) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// Before the first Host or Match, a file applies as its scope does.
|
|
77
|
+
let block = scope;
|
|
78
|
+
for (const entry of parse(text)) {
|
|
79
|
+
if ('host' in entry) {
|
|
80
|
+
block = entry.host;
|
|
81
|
+
for (const host of entry.host) {
|
|
82
|
+
if (!/[*?!]/.test(host) && matches(scope, host)) {
|
|
83
|
+
found.add(host);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if ('match' in entry) {
|
|
88
|
+
block = undefined;
|
|
89
|
+
}
|
|
90
|
+
else if (block) {
|
|
91
|
+
for (const path of expand(entry.include, (0, node_path_1.dirname)(file))) {
|
|
92
|
+
read(path, block === scope ? scope : narrow(scope, block), found, seen);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** The patterns of a block inside another: those of the inner one, when the outer one is everything. */
|
|
98
|
+
function narrow(outer, inner) {
|
|
99
|
+
return outer.length === 1 && outer[0] === '*' ? inner : inner.filter(pattern => !/[*?!]/.test(pattern) && matches(outer, pattern));
|
|
100
|
+
}
|
|
101
|
+
function glob(pattern) {
|
|
102
|
+
const escaped = pattern
|
|
103
|
+
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
|
104
|
+
.replace(/\*/g, '.*')
|
|
105
|
+
.replace(/\?/g, '.');
|
|
106
|
+
return new RegExp(`^${escaped}$`, 'i');
|
|
107
|
+
}
|
|
108
|
+
/** A path of `Include`: `~` is home, relative ones are beside the file, `*` in its last part matches names. */
|
|
109
|
+
function expand(pattern, dir) {
|
|
110
|
+
const path = pattern.startsWith('~/') ? (0, node_path_1.join)((0, node_os_1.homedir)(), pattern.slice(2)) : (0, node_path_1.isAbsolute)(pattern) ? pattern : (0, node_path_1.join)(dir, pattern);
|
|
111
|
+
const name = (0, node_path_1.basename)(path);
|
|
112
|
+
if (!/[*?]/.test(name)) {
|
|
113
|
+
return [path];
|
|
114
|
+
}
|
|
115
|
+
const match = glob(name);
|
|
116
|
+
try {
|
|
117
|
+
return (0, node_fs_1.readdirSync)((0, node_path_1.dirname)(path))
|
|
118
|
+
.filter(entry => match.test(entry))
|
|
119
|
+
.sort()
|
|
120
|
+
.map(entry => (0, node_path_1.join)((0, node_path_1.dirname)(path), entry));
|
|
121
|
+
}
|
|
122
|
+
catch (_a) {
|
|
123
|
+
return [];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function words(value) {
|
|
127
|
+
return [...value.matchAll(/"([^"]*)"|(\S+)/g)].map(match => { var _a; return (_a = match[1]) !== null && _a !== void 0 ? _a : match[2]; }).filter(Boolean);
|
|
128
|
+
}
|
|
129
|
+
})(SshConfig || (exports.SshConfig = SshConfig = {}));
|
|
130
|
+
//# sourceMappingURL=ssh-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-config.js","sourceRoot":"","sources":["../../../src/node/ssh/ssh-config.ts"],"names":[],"mappings":";;;AAAA,qCAAoD;AACpD,qCAAkC;AAClC,yCAAgE;AAKhE;;;;GAIG;AACH,IAAiB,SAAS,CAmHzB;AAnHD,WAAiB,SAAS;IACtB,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,iFAAiF;IACjF,SAAgB,KAAK,CAAC,IAAI,GAAG,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,MAAM,EAAE,QAAQ,CAAC;QAC1D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;QAChC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IACtB,CAAC;IAJe,UA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} from 'node:stream';
|
|
3
|
+
import { ExecClient, type ExecConnection, ExecError } from '../exec-client';
|
|
4
|
+
import { SshAskpass } from './ssh-askpass';
|
|
5
|
+
import { type SshProbe, type SshQuestion } from './ssh-util';
|
|
6
|
+
/** The steps of connecting, as TaRemoteStep names them. */
|
|
7
|
+
export type SshStep = 'connecting' | 'checking' | 'installing-node' | 'copying-server' | 'starting';
|
|
8
|
+
export interface SshHostOptions {
|
|
9
|
+
/** What ssh takes: a Host of its configuration, or `[user@]host[:port]`. */
|
|
10
|
+
host: string;
|
|
11
|
+
/** Where this machine keeps the sockets of ssh, the askpass script and downloaded Node.js. */
|
|
12
|
+
stateDir: string;
|
|
13
|
+
/** Default `ssh`, the OpenSSH client of the system with its configuration. */
|
|
14
|
+
ssh?: string;
|
|
15
|
+
/** Before the host, as `-F <file>`. */
|
|
16
|
+
sshArgs?: string[];
|
|
17
|
+
/** What ssh asks (a password, a new host key); undefined cancels. Without it, ssh asks nobody. */
|
|
18
|
+
ask?(question: SshQuestion): Promise<string | undefined>;
|
|
19
|
+
onStep?(step: SshStep, detail?: string): void;
|
|
20
|
+
/** Where Node.js comes from for a host without one; default nodejs.org. */
|
|
21
|
+
nodeMirror?: string;
|
|
22
|
+
/** For tests: the server to copy. */
|
|
23
|
+
server?: {
|
|
24
|
+
hash: string;
|
|
25
|
+
script: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface RunResult {
|
|
29
|
+
code: number | null;
|
|
30
|
+
stdout: string;
|
|
31
|
+
stderr: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Another machine through the `ssh` of this one, as VS Code's Remote SSH reaches it: one ssh of its own
|
|
35
|
+
* signs in (and asks through {@link SshHostOptions.ask}), the others share its connection
|
|
36
|
+
* (ControlMaster, never the user's own). The first time, it copies a small `ta exec-server` there,
|
|
37
|
+
* with Node.js when the host has none, and then runs it on the standard input and output of ssh.
|
|
38
|
+
* Only processes it started are ended; what the server started there ends with its input.
|
|
39
|
+
*/
|
|
40
|
+
export declare class SshHost {
|
|
41
|
+
protected readonly options: SshHostOptions;
|
|
42
|
+
readonly client: ExecClient;
|
|
43
|
+
protected master?: ChildProcess;
|
|
44
|
+
protected ready?: Promise<void>;
|
|
45
|
+
protected askpass?: SshAskpass;
|
|
46
|
+
protected readonly running: Set<ChildProcess>;
|
|
47
|
+
protected disposed: boolean;
|
|
48
|
+
constructor(options: SshHostOptions);
|
|
49
|
+
get host(): string;
|
|
50
|
+
/** Ends the server there, the connection, and every ssh this object started. */
|
|
51
|
+
dispose(): Promise<void>;
|
|
52
|
+
protected launch(): Promise<ExecConnection>;
|
|
53
|
+
protected probe(hash: string): Promise<SshProbe>;
|
|
54
|
+
protected installNode(probe: SshProbe): Promise<string>;
|
|
55
|
+
/** The server on the standard input and output of an ssh: one message per line. */
|
|
56
|
+
protected start(node: string, script: string): Promise<ExecConnection>;
|
|
57
|
+
/** The ssh that signs in, and stays for the others to share; none on Windows, whose ssh cannot share. */
|
|
58
|
+
protected connectMaster(): Promise<void>;
|
|
59
|
+
protected openMaster(): Promise<void>;
|
|
60
|
+
protected control(command: string): Promise<number | null>;
|
|
61
|
+
/** Runs a script there, with `input` on its standard input. */
|
|
62
|
+
protected run(script: string, args?: string[], input?: string | Readable): Promise<RunResult>;
|
|
63
|
+
protected check(running: Promise<RunResult>, what: string): Promise<RunResult>;
|
|
64
|
+
protected spawn(remote: string[], env: NodeJS.ProcessEnv): ChildProcess;
|
|
65
|
+
protected common(): string[];
|
|
66
|
+
protected destination(): string;
|
|
67
|
+
/** In the state directory, or a short one of this user when that path is too long for a socket. */
|
|
68
|
+
protected controlPath(): string;
|
|
69
|
+
protected env(): Promise<NodeJS.ProcessEnv>;
|
|
70
|
+
protected step(step: SshStep, detail?: string): void;
|
|
71
|
+
protected error(message: string): ExecError;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=ssh-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|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CAAC,CAsBtG;IAED,UAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAMnF;IAED,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,YAAY,CAMtE;IAED,SAAS,CAAC,MAAM,IAAI,MAAM,EAAE,CAY3B;IAED,SAAS,CAAC,WAAW,IAAI,MAAM,CAE9B;IAED,mGAAmG;IACnG,SAAS,CAAC,WAAW,IAAI,MAAM,CAI9B;IAED,UAAgB,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAOhD;IAED,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAEnD;IAED,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAE1C;CACJ"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SshHost = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const exec_client_1 = require("../exec-client");
|
|
8
|
+
const exec_remote_source_1 = require("../exec-remote-source");
|
|
9
|
+
const exec_rpc_1 = require("../exec-rpc");
|
|
10
|
+
const node_dist_1 = require("./node-dist");
|
|
11
|
+
const ssh_askpass_1 = require("./ssh-askpass");
|
|
12
|
+
const ssh_util_1 = require("./ssh-util");
|
|
13
|
+
/** The pings of the client; the server ends after four times this without any message. */
|
|
14
|
+
const PING_MS = 15000;
|
|
15
|
+
const CHECK_MS = 150;
|
|
16
|
+
/** A Unix socket's path has at most 104 bytes: `/%C` takes 41, and ssh adds 17 while it creates one. */
|
|
17
|
+
const MAX_SOCKET_DIR = 44;
|
|
18
|
+
const STDERR_KEPT = 2000;
|
|
19
|
+
const STOP_MS = 2000;
|
|
20
|
+
/**
|
|
21
|
+
* Another machine through the `ssh` of this one, as VS Code's Remote SSH reaches it: one ssh of its own
|
|
22
|
+
* signs in (and asks through {@link SshHostOptions.ask}), the others share its connection
|
|
23
|
+
* (ControlMaster, never the user's own). The first time, it copies a small `ta exec-server` there,
|
|
24
|
+
* with Node.js when the host has none, and then runs it on the standard input and output of ssh.
|
|
25
|
+
* Only processes it started are ended; what the server started there ends with its input.
|
|
26
|
+
*/
|
|
27
|
+
class SshHost {
|
|
28
|
+
constructor(options) {
|
|
29
|
+
this.options = options;
|
|
30
|
+
this.running = new Set();
|
|
31
|
+
this.disposed = false;
|
|
32
|
+
this.client = new exec_client_1.ExecClient({ epoch: Date.now(), pingMs: PING_MS, connect: () => this.launch() });
|
|
33
|
+
}
|
|
34
|
+
get host() {
|
|
35
|
+
return this.options.host;
|
|
36
|
+
}
|
|
37
|
+
/** Ends the server there, the connection, and every ssh this object started. */
|
|
38
|
+
async dispose() {
|
|
39
|
+
var _a;
|
|
40
|
+
this.disposed = true;
|
|
41
|
+
this.client.close();
|
|
42
|
+
for (const child of this.running) {
|
|
43
|
+
child.kill();
|
|
44
|
+
}
|
|
45
|
+
const master = this.master;
|
|
46
|
+
this.master = undefined;
|
|
47
|
+
this.ready = undefined;
|
|
48
|
+
if (master && master.exitCode === null && master.signalCode === null) {
|
|
49
|
+
const exited = new Promise(resolve => master.once('close', resolve));
|
|
50
|
+
master.kill();
|
|
51
|
+
const timer = setTimeout(() => master.kill('SIGKILL'), STOP_MS);
|
|
52
|
+
await exited;
|
|
53
|
+
clearTimeout(timer);
|
|
54
|
+
}
|
|
55
|
+
await ((_a = this.askpass) === null || _a === void 0 ? void 0 : _a.close());
|
|
56
|
+
}
|
|
57
|
+
async launch() {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
if (this.disposed) {
|
|
60
|
+
throw new exec_client_1.ExecError(`The connection to ${this.host} was closed.`, exec_rpc_1.ExecRpc.ErrorCode.CONNECTION_LOST);
|
|
61
|
+
}
|
|
62
|
+
this.step('connecting');
|
|
63
|
+
await this.connectMaster();
|
|
64
|
+
this.step('checking');
|
|
65
|
+
const server = (_a = this.options.server) !== null && _a !== void 0 ? _a : exec_remote_source_1.EXEC_REMOTE_SOURCE;
|
|
66
|
+
const probe = await this.probe(server.hash);
|
|
67
|
+
const node = (_b = probe.node) !== null && _b !== void 0 ? _b : (await this.installNode(probe));
|
|
68
|
+
const script = `${probe.home}/${ssh_util_1.SshUtil.REMOTE_DIR}/${server.hash}/exec-server.js`;
|
|
69
|
+
if (!probe.server) {
|
|
70
|
+
this.step('copying-server');
|
|
71
|
+
await this.check(this.run(ssh_util_1.SshUtil.uploadScript(`${server.hash}/exec-server.js`), [], server.script), 'copy the server of Ta');
|
|
72
|
+
}
|
|
73
|
+
this.step('starting');
|
|
74
|
+
return this.start(node, script);
|
|
75
|
+
}
|
|
76
|
+
async probe(hash) {
|
|
77
|
+
const result = await this.check(this.run(ssh_util_1.SshUtil.probeScript(hash)), 'look at the host');
|
|
78
|
+
const probe = ssh_util_1.SshUtil.parseProbe(result.stdout);
|
|
79
|
+
if (!probe) {
|
|
80
|
+
throw this.error(`${this.host} has no POSIX shell: Ta works on Linux and macOS hosts.`);
|
|
81
|
+
}
|
|
82
|
+
return probe;
|
|
83
|
+
}
|
|
84
|
+
async installNode(probe) {
|
|
85
|
+
const platform = ssh_util_1.SshUtil.nodePlatform(probe.os, probe.arch);
|
|
86
|
+
if (!platform || probe.musl) {
|
|
87
|
+
throw this.error(`${this.host} (${probe.os} ${probe.arch}${probe.musl ? ', musl' : ''}) has no Node.js ${ssh_util_1.SshUtil.MIN_NODE_MAJOR} or later, and Node.js has no build Ta can install there: install one there.`);
|
|
88
|
+
}
|
|
89
|
+
this.step('installing-node');
|
|
90
|
+
const tarball = await node_dist_1.NodeDist.download(platform, (0, node_path_1.join)(this.options.stateDir, 'node'), this.options.nodeMirror, version => this.step('installing-node', version));
|
|
91
|
+
await this.check(this.run(ssh_util_1.SshUtil.installNodeScript(), [], (0, node_fs_1.createReadStream)(tarball.file)), 'install Node.js');
|
|
92
|
+
return `${probe.home}/${ssh_util_1.SshUtil.REMOTE_DIR}/node/bin/node`;
|
|
93
|
+
}
|
|
94
|
+
/** The server on the standard input and output of an ssh: one message per line. */
|
|
95
|
+
async start(node, script) {
|
|
96
|
+
var _a, _b, _c;
|
|
97
|
+
const child = this.spawn([ssh_util_1.SshUtil.remoteCommand(ssh_util_1.SshUtil.launchScript(), node, script)], await this.env());
|
|
98
|
+
const messages = new Set();
|
|
99
|
+
let closed;
|
|
100
|
+
let closing = false;
|
|
101
|
+
let rest = '';
|
|
102
|
+
let stderr = '';
|
|
103
|
+
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on('data', data => {
|
|
104
|
+
var _a;
|
|
105
|
+
const lines = (rest + data.toString()).split('\n');
|
|
106
|
+
rest = (_a = lines.pop()) !== null && _a !== void 0 ? _a : '';
|
|
107
|
+
for (const line of lines) {
|
|
108
|
+
for (const listener of messages) {
|
|
109
|
+
listener(line);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on('data', data => (stderr = (stderr + data.toString()).slice(-STDERR_KEPT)));
|
|
114
|
+
(_c = child.stdin) === null || _c === void 0 ? void 0 : _c.on('error', () => undefined);
|
|
115
|
+
child.once('close', code => {
|
|
116
|
+
const reason = stderr.trim() || `ssh to ${this.host} ended with code ${code}.`;
|
|
117
|
+
closed === null || closed === void 0 ? void 0 : closed(closing ? undefined : `The connection to ${this.host} was lost: ${reason}`);
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
send: text => { var _a; return (_a = child.stdin) === null || _a === void 0 ? void 0 : _a.write(`${text}\n`); },
|
|
121
|
+
close: () => {
|
|
122
|
+
closing = true;
|
|
123
|
+
child.kill();
|
|
124
|
+
},
|
|
125
|
+
onMessage: listener => messages.add(listener),
|
|
126
|
+
onClose: listener => (closed = listener),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/** The ssh that signs in, and stays for the others to share; none on Windows, whose ssh cannot share. */
|
|
130
|
+
connectMaster() {
|
|
131
|
+
var _a;
|
|
132
|
+
if (process.platform === 'win32') {
|
|
133
|
+
return Promise.resolve();
|
|
134
|
+
}
|
|
135
|
+
(_a = this.ready) !== null && _a !== void 0 ? _a : (this.ready = this.openMaster().catch(error => {
|
|
136
|
+
this.ready = undefined;
|
|
137
|
+
throw error;
|
|
138
|
+
}));
|
|
139
|
+
return this.ready;
|
|
140
|
+
}
|
|
141
|
+
async openMaster() {
|
|
142
|
+
var _a;
|
|
143
|
+
var _b;
|
|
144
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(this.controlPath()), { recursive: true, mode: 0o700 });
|
|
145
|
+
const env = await this.env();
|
|
146
|
+
const master = (0, node_child_process_1.spawn)((_b = this.options.ssh) !== null && _b !== void 0 ? _b : 'ssh', [...this.common(), '-N', '-o', 'ControlMaster=yes', '-o', 'ControlPersist=no', '-o', `ControlPath=${this.controlPath()}`, '--', this.destination()], { stdio: ['ignore', 'ignore', 'pipe'], env });
|
|
147
|
+
this.master = master;
|
|
148
|
+
let stderr = '';
|
|
149
|
+
(_a = master.stderr) === null || _a === void 0 ? void 0 : _a.on('data', data => (stderr = (stderr + data.toString()).slice(-STDERR_KEPT)));
|
|
150
|
+
const exited = new Promise(resolve => master.once('close', resolve));
|
|
151
|
+
void exited.then(() => {
|
|
152
|
+
if (this.master === master) {
|
|
153
|
+
this.master = undefined;
|
|
154
|
+
this.ready = undefined;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
for (;;) {
|
|
158
|
+
const done = await Promise.race([exited, new Promise(resolve => setTimeout(() => resolve('wait'), CHECK_MS))]);
|
|
159
|
+
if (done !== 'wait') {
|
|
160
|
+
throw this.error(stderr.trim() || `ssh cannot connect to ${this.host}.`);
|
|
161
|
+
}
|
|
162
|
+
if ((await this.control('check')) === 0) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
control(command) {
|
|
168
|
+
var _a;
|
|
169
|
+
const child = (0, node_child_process_1.spawn)((_a = this.options.ssh) !== null && _a !== void 0 ? _a : 'ssh', [...this.common(), '-O', command, '-o', `ControlPath=${this.controlPath()}`, '--', this.destination()], {
|
|
170
|
+
stdio: 'ignore',
|
|
171
|
+
});
|
|
172
|
+
return new Promise(resolve => {
|
|
173
|
+
child.once('error', () => resolve(null));
|
|
174
|
+
child.once('close', resolve);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/** Runs a script there, with `input` on its standard input. */
|
|
178
|
+
async run(script, args = [], input) {
|
|
179
|
+
var _a, _b, _c, _d, _e;
|
|
180
|
+
const child = this.spawn([ssh_util_1.SshUtil.remoteCommand(script, ...args)], await this.env());
|
|
181
|
+
this.running.add(child);
|
|
182
|
+
let stdout = '';
|
|
183
|
+
let stderr = '';
|
|
184
|
+
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on('data', data => (stdout += data.toString()));
|
|
185
|
+
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on('data', data => (stderr = (stderr + data.toString()).slice(-STDERR_KEPT)));
|
|
186
|
+
(_c = child.stdin) === null || _c === void 0 ? void 0 : _c.on('error', () => undefined);
|
|
187
|
+
if (typeof input === 'string') {
|
|
188
|
+
(_d = child.stdin) === null || _d === void 0 ? void 0 : _d.end(input);
|
|
189
|
+
}
|
|
190
|
+
else if (input) {
|
|
191
|
+
input.pipe(child.stdin);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
(_e = child.stdin) === null || _e === void 0 ? void 0 : _e.end();
|
|
195
|
+
}
|
|
196
|
+
return new Promise(resolve => {
|
|
197
|
+
child.once('error', error => resolve({ code: null, stdout, stderr: error.message }));
|
|
198
|
+
child.once('close', code => {
|
|
199
|
+
this.running.delete(child);
|
|
200
|
+
resolve({ code, stdout, stderr });
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
async check(running, what) {
|
|
205
|
+
const result = await running;
|
|
206
|
+
if (result.code !== 0) {
|
|
207
|
+
throw this.error(`Ta could not ${what} on ${this.host}: ${result.stderr.trim() || `ssh ended with code ${result.code}`}`);
|
|
208
|
+
}
|
|
209
|
+
return result;
|
|
210
|
+
}
|
|
211
|
+
spawn(remote, env) {
|
|
212
|
+
var _a;
|
|
213
|
+
const shared = process.platform === 'win32' ? [] : ['-o', 'ControlMaster=no', '-o', `ControlPath=${this.controlPath()}`];
|
|
214
|
+
return (0, node_child_process_1.spawn)((_a = this.options.ssh) !== null && _a !== void 0 ? _a : 'ssh', [...this.common(), ...shared, '-T', '--', this.destination(), ...remote], {
|
|
215
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
216
|
+
env,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
common() {
|
|
220
|
+
var _a;
|
|
221
|
+
return [
|
|
222
|
+
...((_a = this.options.sshArgs) !== null && _a !== void 0 ? _a : []),
|
|
223
|
+
'-o',
|
|
224
|
+
'ServerAliveInterval=15',
|
|
225
|
+
'-o',
|
|
226
|
+
'ServerAliveCountMax=3',
|
|
227
|
+
'-o',
|
|
228
|
+
'ConnectTimeout=20',
|
|
229
|
+
'-o',
|
|
230
|
+
'LogLevel=ERROR',
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
destination() {
|
|
234
|
+
return ssh_util_1.SshUtil.destination(this.host);
|
|
235
|
+
}
|
|
236
|
+
/** In the state directory, or a short one of this user when that path is too long for a socket. */
|
|
237
|
+
controlPath() {
|
|
238
|
+
var _a;
|
|
239
|
+
var _b;
|
|
240
|
+
const dir = (0, node_path_1.join)(this.options.stateDir, 'ssh');
|
|
241
|
+
const short = dir.length <= MAX_SOCKET_DIR ? dir : `/tmp/ta-ssh-${(_b = (_a = process.getuid) === null || _a === void 0 ? void 0 : _a.call(process)) !== null && _b !== void 0 ? _b : 'user'}`;
|
|
242
|
+
return (0, node_path_1.join)(short, '%C');
|
|
243
|
+
}
|
|
244
|
+
async env() {
|
|
245
|
+
var _a;
|
|
246
|
+
const ask = this.options.ask;
|
|
247
|
+
if (!ask) {
|
|
248
|
+
return process.env;
|
|
249
|
+
}
|
|
250
|
+
(_a = this.askpass) !== null && _a !== void 0 ? _a : (this.askpass = new ssh_askpass_1.SshAskpass((0, node_path_1.dirname)(this.controlPath()), ask));
|
|
251
|
+
return this.askpass.env();
|
|
252
|
+
}
|
|
253
|
+
step(step, detail) {
|
|
254
|
+
var _a, _b;
|
|
255
|
+
(_b = (_a = this.options).onStep) === null || _b === void 0 ? void 0 : _b.call(_a, step, detail);
|
|
256
|
+
}
|
|
257
|
+
error(message) {
|
|
258
|
+
return new exec_client_1.ExecError(message, exec_rpc_1.ExecRpc.ErrorCode.CONNECTION_LOST);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
exports.SshHost = SshHost;
|
|
262
|
+
//# sourceMappingURL=ssh-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-host.js","sourceRoot":"","sources":["../../../src/node/ssh/ssh-host.ts"],"names":[],"mappings":";;;AAAA,2DAA8D;AAC9D,qCAAsD;AACtD,yCAA0C;AAE1C,gDAA4E;AAC5E,8DAA2D;AAC3D,0CAAsC;AACtC,2CAAuC;AACvC,+CAA2C;AAC3C,yCAAsE;AA6BtE,0FAA0F;AAC1F,MAAM,OAAO,GAAG,KAAK,CAAC;AACtB,MAAM,QAAQ,GAAG,GAAG,CAAC;AACrB,wGAAwG;AACxG,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,MAAM,OAAO,GAAG,IAAI,CAAC;AAErB;;;;;;GAMG;AACH;IAQI,YAA+B,OAAuB;QAAvB,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