host-execution-mcp 1.0.1 → 2.0.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/CHANGELOG.md +37 -0
- package/README.md +13 -11
- package/SECURITY.md +3 -3
- package/dist/access/index.d.ts +21 -10
- package/dist/access/index.js +55 -27
- package/dist/access/index.js.map +1 -1
- package/dist/access/paradi-auth.d.ts +3 -3
- package/dist/access/paradi-auth.js +4 -4
- package/dist/access/paradi-auth.js.map +1 -1
- package/dist/access/paradi-transport.d.ts +1 -1
- package/dist/access/paradi-transport.js +3 -3
- package/dist/access/paradi-transport.js.map +1 -1
- package/dist/access/paradi-username.d.ts +1 -1
- package/dist/access/paradi-username.js +2 -2
- package/dist/access/paradi-username.js.map +1 -1
- package/dist/access/session-pool.d.ts +5 -0
- package/dist/access/session-pool.js +7 -0
- package/dist/access/session-pool.js.map +1 -1
- package/dist/access/ssh-transport.d.ts +1 -1
- package/dist/access/ssh-transport.js +3 -2
- package/dist/access/ssh-transport.js.map +1 -1
- package/dist/config-yaml.d.ts +54 -0
- package/dist/config-yaml.js +172 -0
- package/dist/config-yaml.js.map +1 -0
- package/dist/config.d.ts +45 -1
- package/dist/config.js +126 -22
- package/dist/config.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +4 -1
- package/dist/instructions.js +73 -51
- package/dist/instructions.js.map +1 -1
- package/dist/kubectl/runner.d.ts +7 -8
- package/dist/kubectl/runner.js +18 -21
- package/dist/kubectl/runner.js.map +1 -1
- package/dist/link-runtime.d.ts +39 -0
- package/dist/link-runtime.js +134 -0
- package/dist/link-runtime.js.map +1 -0
- package/dist/server.d.ts +2 -1
- package/dist/server.js +10 -12
- package/dist/server.js.map +1 -1
- package/dist/sources/guides.d.ts +34 -0
- package/dist/sources/guides.js +50 -0
- package/dist/sources/guides.js.map +1 -0
- package/dist/sources/index.d.ts +5 -0
- package/dist/sources/index.js +22 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/yaml-template.d.ts +31 -0
- package/dist/sources/yaml-template.js +35 -0
- package/dist/sources/yaml-template.js.map +1 -0
- package/dist/ssh/access-client.d.ts +6 -2
- package/dist/ssh/access-client.js +58 -27
- package/dist/ssh/access-client.js.map +1 -1
- package/dist/ssh/access-errors.js +1 -1
- package/dist/ssh/access-errors.js.map +1 -1
- package/dist/ssh/access-sftp.js +3 -3
- package/dist/ssh/access-sftp.js.map +1 -1
- package/dist/tools/copy-job-schemas.d.ts +96 -581
- package/dist/tools/copy-job-schemas.js +9 -9
- package/dist/tools/copy-job-schemas.js.map +1 -1
- package/dist/tools/register.d.ts +2 -10
- package/dist/tools/register.js +174 -331
- package/dist/tools/register.js.map +1 -1
- package/dist/tools/remote-schemas.d.ts +156 -708
- package/dist/tools/remote-schemas.js +99 -103
- package/dist/tools/remote-schemas.js.map +1 -1
- package/dist/utils/copy-executor.d.ts +3 -1
- package/dist/utils/copy-executor.js +39 -25
- package/dist/utils/copy-executor.js.map +1 -1
- package/dist/utils/copy-transfer.d.ts +2 -0
- package/dist/utils/copy-transfer.js.map +1 -1
- package/dist/utils/remote-executor.d.ts +3 -4
- package/dist/utils/remote-executor.js +8 -18
- package/dist/utils/remote-executor.js.map +1 -1
- package/dist/utils/remote-target.js +1 -1
- package/dist/utils/remote-target.js.map +1 -1
- package/docs/AGENT_GUIDE.md +31 -103
- package/docs/CONFIGURATION.md +30 -9
- package/docs/GUIDE.md +186 -0
- package/docs/PARADI_ACCESS_PLAN.md +6 -6
- package/docs/TODO.md +4 -11
- package/docs/USER_GUIDE.zh-CN.md +26 -173
- package/docs/host-execution.yaml +92 -0
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.0.0] - 2026-10-22
|
|
11
|
+
|
|
12
|
+
### Breaking
|
|
13
|
+
|
|
14
|
+
- Removed tools `context_derive` and `ssh_exec`. Agent selects a machine with YAML `description` + optional `host` (omit `host` = link landing; pass `host` = ssh hop-2 or Paradi TARGET). No `contextKey` on tools.
|
|
15
|
+
- `remote_read_file` / `remote_ps` no longer take `target=landing|context|pod`. Path is on the selected machine; add `namespace`+`pod` to go into a container via kubectl there.
|
|
16
|
+
- `remote_copy_*` endpoints are `target=local|remote|pod` (not landing/context). `remote` is the selected Linux.
|
|
17
|
+
- Env `TARGET_HOST` removed. Use `TARGET_HOSTS` (one host or comma-separated list of IP/hostname). CIDR/glob and JSON array strings are rejected. One TARGET is the default hop-2 / Paradi landing IP to pass as `host`; otherwise pass `host` from context.
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- YAML roster at `~/.agents/host-execution.yaml` (Windows `%USERPROFILE%\.agents\host-execution.yaml`): same GUIDE §2 fields as JSON, unique `description` per link, user+IP identity. YAML wins when at least one real link exists; empty roster + `ACCESS_*` keeps JSON. Empty roster still starts the MCP. Tools take optional exact `description`; 1 link may omit it. Template is MCP Resource `host-execution://guides/yaml`.
|
|
22
|
+
- MCP Resources `host-execution://guides/user` (`docs/GUIDE.md`) and `host-execution://guides/agent` (`docs/AGENT_GUIDE.md`), registered from `src/sources/`. Handshake tells the Agent to read both once; catalog `mcp/host-execution/GUIDE.md` is a pointer.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- `TARGET_HOSTS` is only concrete hosts. CIDR/glob no longer sit in the list as notes; they fail at parse. Paradi without a single default no longer creates a `paradi-unselected` Context — omit-host tools fail until `host` is passed.
|
|
27
|
+
- README tool table matches Paradi landing select. `USER_GUIDE.zh-CN.md` no longer duplicates GUIDE or embed credentials. User GUIDE resource audience includes `user`. Unused Catalog screenshot removed.
|
|
28
|
+
- Runtime tools share one machine selector: optional `host` (`shell_exec` / `docker_*` / `k8s_*` / `context_probe` / `remote_*`). `k8s_*` is not a separate landing path.
|
|
29
|
+
- Paradi `remote_copy_*` uses `target=remote` on the selected TARGET landing. Hop-2 `target=host` remains rejected.
|
|
30
|
+
- `remote_*` tool `inputSchema` is a plain Zod object (no `.refine()` / union). MCP `listTools` now exposes `path` / `host` / `target` instead of empty `properties`. Cross-field rules run in the handler.
|
|
31
|
+
- Removed unused `allowContext` schema switch (always on) and the extra copy assert before materialize.
|
|
32
|
+
- `description` is documented as a rewriteable scenario label (not a frozen key).
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Machine pick / select errors (`description` missing, empty roster, Paradi multi-TARGET without `host`) return tool JSON via `formatErrorResult`, not MCP protocol faults.
|
|
37
|
+
- Reloading a YAML link with the same `description` but changed credentials drops the stale `AccessClient` session instead of leaking it.
|
|
38
|
+
|
|
39
|
+
### Removed
|
|
40
|
+
|
|
41
|
+
- Internal live-test notes doc that listed real intranet IPs (not for npm / public tree).
|
|
42
|
+
|
|
43
|
+
### Tests
|
|
44
|
+
|
|
45
|
+
- Resource-list fixture (GPU-Genius GGN / S5000 OS IPs): multi-host ssh + Paradi select Context; copy follows landing, not hop-2.
|
|
46
|
+
|
|
10
47
|
## [1.0.1] - 2026-09-16
|
|
11
48
|
|
|
12
49
|
### Changed
|
package/README.md
CHANGED
|
@@ -15,20 +15,18 @@ Composable tools:
|
|
|
15
15
|
| Tool | Purpose |
|
|
16
16
|
|------|---------|
|
|
17
17
|
| `access_check` | Short ACCESS SSH probe (`reachable` / `latencyMs`; not kubectl) |
|
|
18
|
-
| `shell_exec` | Shell on landing
|
|
19
|
-
| `context_derive` | Derive child Context → `contextKey` (`ACCESS_KIND=ssh` only) |
|
|
18
|
+
| `shell_exec` | Shell on landing, or hop-2 / Paradi TARGET when `host` is set |
|
|
20
19
|
| `context_probe` | Probe docker/kubectl capabilities (unknown ≠ true) |
|
|
21
|
-
| `docker_ps` / `docker_exec` / `docker_logs` | Docker
|
|
20
|
+
| `docker_ps` / `docker_exec` / `docker_logs` | Docker on the selected machine (`host` optional) |
|
|
22
21
|
| `k8s_list_pods` | List pods (`kubectl get pods`) |
|
|
23
22
|
| `k8s_exec` | Run command in pod container |
|
|
24
23
|
| `k8s_logs` | Pod stdout/stderr (`kubectl logs`) |
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
27
|
-
| `remote_copy_file` | Sync copy between local/landing/pod/context (SFTP for local↔landing; `skipIfComplete` / `totalTimeoutMs` / progress) |
|
|
24
|
+
| `remote_read_file` | Read file head/tail on the selected machine; optional namespace+pod |
|
|
25
|
+
| `remote_copy_file` | Sync copy between local/remote/pod (SFTP for local↔remote; `skipIfComplete` / `totalTimeoutMs` / progress) |
|
|
28
26
|
| `remote_copy_start` | Async copy job — returns `transferId` immediately (prefer for >256MB or ETA>2min) |
|
|
29
27
|
| `remote_copy_status` | Poll async copy job progress |
|
|
30
28
|
| `remote_copy_cancel` | Cancel async copy job |
|
|
31
|
-
| `remote_ps` | List processes on
|
|
29
|
+
| `remote_ps` | List processes on the selected machine; optional namespace+pod |
|
|
32
30
|
|
|
33
31
|
Async job state: `~/.agent-compose/remote-copy/jobs/<transferId>.json` — see [docs/REMOTE_COPY_JOB_API.md](docs/REMOTE_COPY_JOB_API.md).
|
|
34
32
|
|
|
@@ -72,9 +70,11 @@ MCP config uses local path:
|
|
|
72
70
|
"args": ["<ABS_PATH>/packages/mcp/host-execution/dist/index.js"]
|
|
73
71
|
```
|
|
74
72
|
|
|
75
|
-
###
|
|
73
|
+
### YAML roster or minimal env
|
|
76
74
|
|
|
77
|
-
|
|
75
|
+
Preferred when you have more than one ACCESS/TARGET pair: write links to `~/.agents/host-execution.yaml` (Windows `%USERPROFILE%\.agents\host-execution.yaml`). mcp.json can stay empty of `ACCESS_*`. Template: MCP Resource `host-execution://guides/yaml`.
|
|
76
|
+
|
|
77
|
+
JSON/env still works when the roster has no real links. Then `ACCESS_HOST` and `ACCESS_USER` are required. Configure any SSH auth you use (key path, default `~/.ssh` keys, SSH agent, and/or `ACCESS_PASSWORD`); the client tries each until one works. If your IDE exposes an empty SSH agent, set `ACCESS_PASSWORD` and it will be used after agent/key attempts fail. See [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
|
|
78
78
|
|
|
79
79
|
## Publishing (maintainers)
|
|
80
80
|
|
|
@@ -85,8 +85,10 @@ npm publish # or --registry for private npm
|
|
|
85
85
|
|
|
86
86
|
## Documentation
|
|
87
87
|
|
|
88
|
-
- [
|
|
89
|
-
-
|
|
88
|
+
- [GUIDE.md](docs/GUIDE.md) — 用户用法(期望能力);MCP Resource `host-execution://guides/user`
|
|
89
|
+
- YAML 名册模板 — MCP Resource `host-execution://guides/yaml`(`docs/host-execution.yaml`)
|
|
90
|
+
- [使用教程(中文)](docs/USER_GUIDE.zh-CN.md) — Codex 接法、旧包迁移、场景示例;用法以 GUIDE 为准
|
|
91
|
+
- [Agent usage guide](docs/AGENT_GUIDE.md) — 操作说明;MCP Resource `host-execution://guides/agent`
|
|
90
92
|
- [Configuration](docs/CONFIGURATION.md) — env vars, auth, client setup
|
|
91
93
|
- [SECURITY.md](SECURITY.md) — trust boundaries, credentials, sshpass notes
|
|
92
94
|
- [CHANGELOG.md](CHANGELOG.md)
|
package/SECURITY.md
CHANGED
|
@@ -39,7 +39,7 @@ There is **no direct path** from the MCP client machine to cluster pods or worke
|
|
|
39
39
|
|
|
40
40
|
## sshpass and process visibility
|
|
41
41
|
|
|
42
|
-
When
|
|
42
|
+
When tools pass `host` with a password (or `TARGET_PASSWORD`), the ACCESS landing runs:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
sshpass -p '<password>' ssh ...
|
|
@@ -56,8 +56,8 @@ Remote host SSH uses `-o StrictHostKeyChecking=accept-new`. On first connect, un
|
|
|
56
56
|
`ALLOWED_NAMESPACES` restricts **kubectl tools only** (`k8s_list_pods`, `k8s_exec`, `k8s_logs`, and `remote_*` with `target=pod`). It does **not** restrict:
|
|
57
57
|
|
|
58
58
|
- `shell_exec` — arbitrary shell on the ACCESS landing Context, including `kubectl` against any namespace
|
|
59
|
-
- `
|
|
60
|
-
- `remote_*`
|
|
59
|
+
- `shell_exec` / `docker_*` / `remote_*` with `host` — SSH from ACCESS to that host
|
|
60
|
+
- `remote_*` on the selected machine (`target=remote` after materialize)
|
|
61
61
|
|
|
62
62
|
For defense in depth, combine namespace whitelist with bastion RBAC, kubeconfig permissions, and limiting who can run the MCP server.
|
|
63
63
|
|
package/dist/access/index.d.ts
CHANGED
|
@@ -16,31 +16,43 @@ export type ContextSummary = {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class AccessRuntime {
|
|
18
18
|
private readonly config;
|
|
19
|
-
|
|
19
|
+
/** Landing Context when one exists (ssh ACCESS, or Paradi with exactly one TARGET_HOSTS). */
|
|
20
|
+
readonly accessContext?: HostExecutionContext;
|
|
20
21
|
readonly pool: SessionPool;
|
|
21
22
|
private readonly sshTransport;
|
|
23
|
+
private readonly paradiTransport;
|
|
22
24
|
/** Capability cache by context.key (derive may recreate descriptor objects). */
|
|
23
25
|
private readonly capsByKey;
|
|
24
26
|
/** Live Context descriptors by key (landing + derived). */
|
|
25
27
|
private readonly contexts;
|
|
26
28
|
constructor(config: AppConfig, accessClient: AccessClient);
|
|
27
|
-
/** Landing Context key (ACCESS for ssh; TARGET for paradi). */
|
|
29
|
+
/** Landing Context key (ACCESS for ssh; TARGET for paradi with one default). */
|
|
28
30
|
get landingKey(): string;
|
|
31
|
+
hasContext(contextKey: string): boolean;
|
|
29
32
|
summarize(ctx?: HostExecutionContext): ContextSummary;
|
|
30
33
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
34
|
+
* Agent-facing pick: omit host = this link's landing; pass host =
|
|
35
|
+
* ssh hop-2 from ACCESS, or Paradi TARGET landing select.
|
|
36
|
+
*/
|
|
37
|
+
selectMachine(args?: {
|
|
38
|
+
host?: string;
|
|
39
|
+
user?: string;
|
|
40
|
+
password?: string;
|
|
41
|
+
}): HostExecutionContext;
|
|
42
|
+
/**
|
|
43
|
+
* Resolve Runtime Context by key. Omit / empty → the only landing Context
|
|
44
|
+
* (ssh ACCESS, or Paradi when TARGET_HOSTS has exactly one host).
|
|
33
45
|
*/
|
|
34
46
|
requireContext(contextKey?: string): HostExecutionContext;
|
|
35
|
-
/** Shell on a Context (
|
|
47
|
+
/** Shell on a Context (omit contextKey = the only landing, if one exists). */
|
|
36
48
|
shellExec(command: string, opts?: {
|
|
37
49
|
contextKey?: string;
|
|
38
50
|
timeoutMs?: number;
|
|
39
51
|
cwd?: string;
|
|
40
52
|
}): Promise<ExecOutput>;
|
|
41
53
|
/**
|
|
42
|
-
* Derive a child Context (
|
|
43
|
-
* Omitting host uses
|
|
54
|
+
* Derive a child Context (ssh hop-2) or select a Paradi TARGET landing.
|
|
55
|
+
* Omitting host uses the single TARGET_HOSTS entry when there is one.
|
|
44
56
|
*/
|
|
45
57
|
deriveContext(args?: {
|
|
46
58
|
host?: string;
|
|
@@ -49,8 +61,7 @@ export declare class AccessRuntime {
|
|
|
49
61
|
useTarget?: boolean;
|
|
50
62
|
}): ContextSummary;
|
|
51
63
|
/**
|
|
52
|
-
* deriveContext + shellExec
|
|
53
|
-
* Also returns the derived contextKey via summarize after exec (caller should use derive for key-only).
|
|
64
|
+
* deriveContext + shellExec. Returns the derived contextKey after exec.
|
|
54
65
|
*/
|
|
55
66
|
sshExec(args: {
|
|
56
67
|
host?: string;
|
|
@@ -102,7 +113,7 @@ export declare class AccessRuntime {
|
|
|
102
113
|
user?: string;
|
|
103
114
|
password?: string;
|
|
104
115
|
};
|
|
105
|
-
private
|
|
116
|
+
private requireLanding;
|
|
106
117
|
private remember;
|
|
107
118
|
private withCachedCaps;
|
|
108
119
|
private resolveHostContext;
|
package/dist/access/index.js
CHANGED
|
@@ -10,9 +10,11 @@ import * as docker from "./docker-runtime.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export class AccessRuntime {
|
|
12
12
|
config;
|
|
13
|
+
/** Landing Context when one exists (ssh ACCESS, or Paradi with exactly one TARGET_HOSTS). */
|
|
13
14
|
accessContext;
|
|
14
15
|
pool;
|
|
15
16
|
sshTransport = new SshAccessTransport();
|
|
17
|
+
paradiTransport = new ParadiAccessTransport();
|
|
16
18
|
/** Capability cache by context.key (derive may recreate descriptor objects). */
|
|
17
19
|
capsByKey = new Map();
|
|
18
20
|
/** Live Context descriptors by key (landing + derived). */
|
|
@@ -20,19 +22,28 @@ export class AccessRuntime {
|
|
|
20
22
|
constructor(config, accessClient) {
|
|
21
23
|
this.config = config;
|
|
22
24
|
this.pool = new SessionPool(accessClient);
|
|
23
|
-
|
|
24
|
-
config.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
if (config.accessKind === "paradi-gateway") {
|
|
26
|
+
if (config.targetHost?.trim()) {
|
|
27
|
+
this.accessContext = this.paradiTransport.createContext(config);
|
|
28
|
+
this.pool.bindParadiLanding(this.accessContext, config.targetHost.trim());
|
|
29
|
+
this.remember(this.accessContext);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.accessContext = this.sshTransport.createAccessContext(config);
|
|
34
|
+
this.pool.bindAccess(this.accessContext);
|
|
35
|
+
this.remember(this.accessContext);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Landing Context key (ACCESS for ssh; TARGET for paradi with one default). */
|
|
31
39
|
get landingKey() {
|
|
32
|
-
return this.
|
|
40
|
+
return this.requireLanding().key;
|
|
33
41
|
}
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
hasContext(contextKey) {
|
|
43
|
+
return this.contexts.has(contextKey.trim());
|
|
44
|
+
}
|
|
45
|
+
summarize(ctx) {
|
|
46
|
+
const withCaps = this.withCachedCaps(ctx ?? this.requireLanding());
|
|
36
47
|
return {
|
|
37
48
|
contextKey: withCaps.key,
|
|
38
49
|
endpoint: withCaps.endpoint,
|
|
@@ -41,41 +52,49 @@ export class AccessRuntime {
|
|
|
41
52
|
};
|
|
42
53
|
}
|
|
43
54
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
55
|
+
* Agent-facing pick: omit host = this link's landing; pass host =
|
|
56
|
+
* ssh hop-2 from ACCESS, or Paradi TARGET landing select.
|
|
57
|
+
*/
|
|
58
|
+
selectMachine(args = {}) {
|
|
59
|
+
const host = args.host?.trim();
|
|
60
|
+
if (!host) {
|
|
61
|
+
return this.requireLanding();
|
|
62
|
+
}
|
|
63
|
+
return this.resolveHostContext(host, args.user, args.password);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Resolve Runtime Context by key. Omit / empty → the only landing Context
|
|
67
|
+
* (ssh ACCESS, or Paradi when TARGET_HOSTS has exactly one host).
|
|
46
68
|
*/
|
|
47
69
|
requireContext(contextKey) {
|
|
48
70
|
const key = contextKey?.trim();
|
|
49
71
|
if (!key) {
|
|
50
|
-
return this.withCachedCaps(this.
|
|
72
|
+
return this.withCachedCaps(this.requireLanding());
|
|
51
73
|
}
|
|
52
74
|
const ctx = this.contexts.get(key);
|
|
53
75
|
if (!ctx) {
|
|
54
|
-
throw new Error(`Unknown contextKey=${key}.
|
|
76
|
+
throw new Error(`Unknown contextKey=${key}. Pass host on the tool (or omit host for landing).`);
|
|
55
77
|
}
|
|
56
78
|
return this.withCachedCaps(ctx);
|
|
57
79
|
}
|
|
58
|
-
/** Shell on a Context (
|
|
80
|
+
/** Shell on a Context (omit contextKey = the only landing, if one exists). */
|
|
59
81
|
shellExec(command, opts = {}) {
|
|
60
82
|
const ctx = this.requireContext(opts.contextKey);
|
|
61
83
|
return this.pool.exec(ctx, command, opts.timeoutMs, opts.cwd);
|
|
62
84
|
}
|
|
63
85
|
/**
|
|
64
|
-
* Derive a child Context (
|
|
65
|
-
* Omitting host uses
|
|
86
|
+
* Derive a child Context (ssh hop-2) or select a Paradi TARGET landing.
|
|
87
|
+
* Omitting host uses the single TARGET_HOSTS entry when there is one.
|
|
66
88
|
*/
|
|
67
89
|
deriveContext(args = {}) {
|
|
68
|
-
this.assertDeriveAllowed();
|
|
69
90
|
const host = args.useTarget ? undefined : args.host;
|
|
70
91
|
const ctx = this.resolveHostContext(host, args.user, args.password);
|
|
71
92
|
return this.summarize(ctx);
|
|
72
93
|
}
|
|
73
94
|
/**
|
|
74
|
-
* deriveContext + shellExec
|
|
75
|
-
* Also returns the derived contextKey via summarize after exec (caller should use derive for key-only).
|
|
95
|
+
* deriveContext + shellExec. Returns the derived contextKey after exec.
|
|
76
96
|
*/
|
|
77
97
|
async sshExec(args) {
|
|
78
|
-
this.assertDeriveAllowed();
|
|
79
98
|
const ctx = this.resolveHostContext(args.host, args.user, args.password);
|
|
80
99
|
const out = await this.pool.exec(ctx, args.command, args.timeoutMs);
|
|
81
100
|
return { ...out, contextKey: ctx.key, endpoint: ctx.endpoint };
|
|
@@ -119,6 +138,9 @@ export class AccessRuntime {
|
|
|
119
138
|
if (!entry) {
|
|
120
139
|
throw new Error(`No SessionPool binding for context key=${ctx.key}`);
|
|
121
140
|
}
|
|
141
|
+
if (entry.kind === "paradi-landing") {
|
|
142
|
+
return { target: "landing", path: endpoint.path, host: entry.host };
|
|
143
|
+
}
|
|
122
144
|
if (entry.kind === "access") {
|
|
123
145
|
return { target: "landing", path: endpoint.path };
|
|
124
146
|
}
|
|
@@ -130,10 +152,11 @@ export class AccessRuntime {
|
|
|
130
152
|
password: entry.password,
|
|
131
153
|
};
|
|
132
154
|
}
|
|
133
|
-
|
|
134
|
-
if (this.
|
|
135
|
-
throw new Error("
|
|
155
|
+
requireLanding() {
|
|
156
|
+
if (!this.accessContext) {
|
|
157
|
+
throw new Error("host required — TARGET_HOSTS has no single default; pass a host from user context");
|
|
136
158
|
}
|
|
159
|
+
return this.accessContext;
|
|
137
160
|
}
|
|
138
161
|
remember(ctx) {
|
|
139
162
|
this.contexts.set(ctx.key, ctx);
|
|
@@ -152,7 +175,12 @@ export class AccessRuntime {
|
|
|
152
175
|
}
|
|
153
176
|
resolveHostContext(host, user, password) {
|
|
154
177
|
const spec = this.resolveDeriveSpec(host, user, password);
|
|
155
|
-
|
|
178
|
+
if (this.config.accessKind === "paradi-gateway") {
|
|
179
|
+
const landing = this.paradiTransport.createContext(this.config, spec.host);
|
|
180
|
+
this.pool.bindParadiLanding(landing, spec.host);
|
|
181
|
+
return this.withCachedCaps(landing);
|
|
182
|
+
}
|
|
183
|
+
const child = this.sshTransport.deriveContext(this.requireLanding(), spec);
|
|
156
184
|
this.pool.bindDerived(child, spec);
|
|
157
185
|
return this.withCachedCaps(child);
|
|
158
186
|
}
|
|
@@ -160,7 +188,7 @@ export class AccessRuntime {
|
|
|
160
188
|
const defaultSpec = this.sshTransport.defaultDeriveSpec(this.config);
|
|
161
189
|
const resolvedHost = host?.trim() || defaultSpec?.host;
|
|
162
190
|
if (!resolvedHost) {
|
|
163
|
-
throw new Error("host required
|
|
191
|
+
throw new Error("host required — TARGET_HOSTS has no single default; pass a host from user context");
|
|
164
192
|
}
|
|
165
193
|
const resolvedUser = resolveRemoteUser(user, this.config.targetUser ?? defaultSpec?.user);
|
|
166
194
|
const resolvedPassword = resolveRemotePassword(password, this.config.targetPassword ?? defaultSpec?.password);
|
package/dist/access/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/access/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAoB,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAW9C;;;GAGG;AACH,MAAM,OAAO,aAAa;
|
|
1
|
+
{"version":3,"file":"index.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.json by default).
|
|
3
3
|
*
|
|
4
|
-
* - slash: username = ACCESS_USER
|
|
5
|
-
* - compound: username = ACCESS_USER, password = ACCESS_PASSWORD
|
|
4
|
+
* - slash: username = ACCESS_USER/<landing-ip>/TARGET_USER, password = ACCESS_PASSWORD
|
|
5
|
+
* - compound: username = ACCESS_USER, password = ACCESS_PASSWORD@##@<landing-ip>:SSH:22:TARGET_USER
|
|
6
6
|
* - auto: try slash then compound on AUTH_FAILED; pin winner for this MCP process
|
|
7
7
|
*/
|
|
8
8
|
import type { AppConfig } from "../config.js";
|
|
@@ -28,6 +28,6 @@ export declare function parseParadiAuthSetting(raw: string | undefined): ParadiA
|
|
|
28
28
|
export declare function resolveParadiAuthModesToTry(config: AppConfig): ParadiAuthMode[];
|
|
29
29
|
export declare function buildParadiCompoundPassword(accessPassword: string, targetHost: string, targetUser: string, targetSshPort?: number): string;
|
|
30
30
|
/** Build username+password for one Paradi auth mode (TCP still to ACCESS_HOST). */
|
|
31
|
-
export declare function resolveParadiConnectParams(config: AppConfig, mode: ParadiAuthMode): ParadiConnectParams;
|
|
31
|
+
export declare function resolveParadiConnectParams(config: AppConfig, mode: ParadiAuthMode, landingHost?: string): ParadiConnectParams;
|
|
32
32
|
/** True when failure is auth-only (safe to try the other Paradi mode). */
|
|
33
33
|
export declare function isParadiAuthFailureMessage(message: string): boolean;
|
|
@@ -48,16 +48,16 @@ export function buildParadiCompoundPassword(accessPassword, targetHost, targetUs
|
|
|
48
48
|
const h = targetHost.trim();
|
|
49
49
|
const u = targetUser.trim();
|
|
50
50
|
if (!h || !u) {
|
|
51
|
-
throw new Error("paradi compound password requires
|
|
51
|
+
throw new Error("paradi compound password requires a concrete TARGET_HOSTS landing IP and TARGET_USER");
|
|
52
52
|
}
|
|
53
53
|
return `${p}@##@${h}:SSH:${targetSshPort}:${u}`;
|
|
54
54
|
}
|
|
55
55
|
/** Build username+password for one Paradi auth mode (TCP still to ACCESS_HOST). */
|
|
56
|
-
export function resolveParadiConnectParams(config, mode) {
|
|
57
|
-
const targetHost = config.targetHost?.trim();
|
|
56
|
+
export function resolveParadiConnectParams(config, mode, landingHost) {
|
|
57
|
+
const targetHost = landingHost?.trim() || config.targetHost?.trim();
|
|
58
58
|
const targetUser = config.targetUser?.trim();
|
|
59
59
|
if (!targetHost || !targetUser) {
|
|
60
|
-
throw new Error("paradi-gateway requires
|
|
60
|
+
throw new Error("paradi-gateway requires a concrete landing host (TARGET_HOSTS default or pass host) and TARGET_USER");
|
|
61
61
|
}
|
|
62
62
|
const host = config.accessHost;
|
|
63
63
|
const port = config.accessPort;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paradi-auth.js","sourceRoot":"","sources":["../../src/access/paradi-auth.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAc9D,kEAAkE;AAClE,MAAM,eAAe,GAAG,IAAI,GAAG,EAA0B,CAAC;AAE1D,MAAM,UAAU,YAAY,CAAC,MAAiB;IAC5C,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,OAAO,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAiB,EAAE,IAAoB;IACnE,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;AAClD,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,mBAAmB;IACjC,eAAe,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,GAAuB;IAC5D,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,MAAM,C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B,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IAC/B,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAE7C,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO;YACL,IAAI;YACJ,IAAI;YACJ,QAAQ,EAAE,sBAAsB,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC;YAC3E,QAAQ,EAAE,cAAc;YACxB,IAAI;SACL,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,6EAA6E,CAC9E,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI;QACJ,IAAI;QACJ,QAAQ,EAAE,MAAM,CAAC,UAAU;QAC3B,QAAQ,EAAE,2BAA2B,CAAC,cAAc,EAAE,UAAU,EAAE,UAAU,CAAC;QAC7E,IAAI;KACL,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,0BAA0B,CAAC,OAAe;IACxD,OAAO,mIAAmI,CAAC,IAAI,CAC7I,OAAO,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -6,5 +6,5 @@ export { buildParadiSshUsername } from "./paradi-username.js";
|
|
|
6
6
|
* Runtime must not branch on Paradi; only Transport encodes gateway identity.
|
|
7
7
|
*/
|
|
8
8
|
export declare class ParadiAccessTransport {
|
|
9
|
-
createContext(config: AppConfig): HostExecutionContext;
|
|
9
|
+
createContext(config: AppConfig, landingHost?: string): HostExecutionContext;
|
|
10
10
|
}
|
|
@@ -6,14 +6,14 @@ export { buildParadiSshUsername } from "./paradi-username.js";
|
|
|
6
6
|
* Runtime must not branch on Paradi; only Transport encodes gateway identity.
|
|
7
7
|
*/
|
|
8
8
|
export class ParadiAccessTransport {
|
|
9
|
-
createContext(config) {
|
|
9
|
+
createContext(config, landingHost) {
|
|
10
10
|
if (config.accessKind !== "paradi-gateway") {
|
|
11
11
|
throw new Error(`ParadiAccessTransport only supports ACCESS_KIND=paradi-gateway (got ${config.accessKind})`);
|
|
12
12
|
}
|
|
13
|
-
const targetHost = config.targetHost?.trim();
|
|
13
|
+
const targetHost = landingHost?.trim() || config.targetHost?.trim();
|
|
14
14
|
const targetUser = config.targetUser?.trim();
|
|
15
15
|
if (!targetHost || !targetUser) {
|
|
16
|
-
throw new Error("paradi-gateway requires
|
|
16
|
+
throw new Error("paradi-gateway requires a concrete landing host (TARGET_HOSTS default or pass host) and TARGET_USER");
|
|
17
17
|
}
|
|
18
18
|
const sshUsername = buildParadiSshUsername(config.accessUser, targetHost, targetUser);
|
|
19
19
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paradi-transport.js","sourceRoot":"","sources":["../../src/access/paradi-transport.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IAChC,aAAa,CAAC,MAAiB;
|
|
1
|
+
{"version":3,"file":"paradi-transport.js","sourceRoot":"","sources":["../../src/access/paradi-transport.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IAChC,aAAa,CAAC,MAAiB,EAAE,WAAoB;QACnD,IAAI,MAAM,CAAC,UAAU,KAAK,gBAAgB,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CACb,uEAAuE,MAAM,CAAC,UAAU,GAAG,CAC5F,CAAC;QACJ,CAAC;QACD,MAAM,UAAU,GAAG,WAAW,EAAE,IAAI,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;QACpE,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;QAC7C,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CACb,qGAAqG,CACtG,CAAC;QACJ,CAAC;QAED,MAAM,WAAW,GAAG,sBAAsB,CACxC,MAAM,CAAC,UAAU,EACjB,UAAU,EACV,UAAU,CACX,CAAC;QAEF,OAAO;YACL,GAAG,EAAE,eAAe,CAAC;gBACnB,SAAS,EAAE,gBAAgB;gBAC3B,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,MAAM,CAAC,UAAU;gBACvB,YAAY,EAAE,WAAW;aAC1B,CAAC;YACF,SAAS,EAAE,gBAAgB;YAC3B,iEAAiE;YACjE,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;YAC1D,YAAY,EAAE;gBACZ,GAAG,mBAAmB,CAAC,IAAI,CAAC;gBAC5B,8EAA8E;gBAC9E,IAAI,EAAE,UAAU;gBAChB,oBAAoB,EAAE,IAAI;aAC3B;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Paradi Mode A identity encoding (user never puts this string in mcp.json).
|
|
3
|
-
* sshUsername = ACCESS_USER
|
|
3
|
+
* sshUsername = ACCESS_USER/<landing-ip>/TARGET_USER
|
|
4
4
|
*/
|
|
5
5
|
export declare function buildParadiSshUsername(accessUser: string, targetHost: string, targetUser: string): string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Paradi Mode A identity encoding (user never puts this string in mcp.json).
|
|
3
|
-
* sshUsername = ACCESS_USER
|
|
3
|
+
* sshUsername = ACCESS_USER/<landing-ip>/TARGET_USER
|
|
4
4
|
*/
|
|
5
5
|
export function buildParadiSshUsername(accessUser, targetHost, targetUser) {
|
|
6
6
|
const a = accessUser.trim();
|
|
7
7
|
const h = targetHost.trim();
|
|
8
8
|
const u = targetUser.trim();
|
|
9
9
|
if (!a || !h || !u) {
|
|
10
|
-
throw new Error("paradi-gateway requires ACCESS_USER,
|
|
10
|
+
throw new Error("paradi-gateway requires ACCESS_USER, a concrete TARGET_HOSTS landing IP, and TARGET_USER to build SSH username");
|
|
11
11
|
}
|
|
12
12
|
return `${a}/${h}/${u}`;
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paradi-username.js","sourceRoot":"","sources":["../../src/access/paradi-username.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAkB,EAClB,UAAkB,EAClB,UAAkB;IAElB,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,
|
|
1
|
+
{"version":3,"file":"paradi-username.js","sourceRoot":"","sources":["../../src/access/paradi-username.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAkB,EAClB,UAAkB,EAClB,UAAkB;IAElB,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,gHAAgH,CACjH,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -8,6 +8,9 @@ type PoolEntry = {
|
|
|
8
8
|
host: string;
|
|
9
9
|
user: string;
|
|
10
10
|
password?: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: "paradi-landing";
|
|
13
|
+
host: string;
|
|
11
14
|
};
|
|
12
15
|
/**
|
|
13
16
|
* Session pool keyed by context.key. Context itself never holds clients.
|
|
@@ -19,6 +22,8 @@ export declare class SessionPool {
|
|
|
19
22
|
constructor(accessClient: AccessClient);
|
|
20
23
|
bindAccess(ctx: HostExecutionContext): void;
|
|
21
24
|
bindDerived(ctx: HostExecutionContext, spec: DeriveSpec): void;
|
|
25
|
+
/** Paradi: selected TARGET landing (new gateway identity, not hop-2 from ACCESS). */
|
|
26
|
+
bindParadiLanding(ctx: HostExecutionContext, host: string): void;
|
|
22
27
|
getEntry(contextKey: string): PoolEntry | undefined;
|
|
23
28
|
exec(ctx: HostExecutionContext, command: string, timeoutMs?: number, cwd?: string): Promise<ExecOutput>;
|
|
24
29
|
}
|
|
@@ -24,6 +24,10 @@ export class SessionPool {
|
|
|
24
24
|
password: spec.password,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
+
/** Paradi: selected TARGET landing (new gateway identity, not hop-2 from ACCESS). */
|
|
28
|
+
bindParadiLanding(ctx, host) {
|
|
29
|
+
this.entries.set(ctx.key, { kind: "paradi-landing", host });
|
|
30
|
+
}
|
|
27
31
|
getEntry(contextKey) {
|
|
28
32
|
return this.entries.get(contextKey);
|
|
29
33
|
}
|
|
@@ -35,6 +39,9 @@ export class SessionPool {
|
|
|
35
39
|
if (entry.kind === "access") {
|
|
36
40
|
return this.accessClient.exec(command, timeoutMs, cwd);
|
|
37
41
|
}
|
|
42
|
+
if (entry.kind === "paradi-landing") {
|
|
43
|
+
return this.accessClient.exec(command, timeoutMs, cwd, undefined, entry.host);
|
|
44
|
+
}
|
|
38
45
|
// Derived host: wrap command in ssh from ACCESS (accessClient) session.
|
|
39
46
|
const remoteCommand = cwd
|
|
40
47
|
? `cd ${bashSingleQuote(cwd)} && ${command}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-pool.js","sourceRoot":"","sources":["../../src/access/session-pool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"session-pool.js","sourceRoot":"","sources":["../../src/access/session-pool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAiBjF;;;GAGG;AACH,MAAM,OAAO,WAAW;IAGO;IAFZ,OAAO,GAAG,IAAI,GAAG,EAAqB,CAAC;IAExD,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAE3D,UAAU,CAAC,GAAyB;QAClC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,WAAW,CAAC,GAAyB,EAAE,IAAgB;QACrD,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE;YACxB,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;IACL,CAAC;IAED,qFAAqF;IACrF,iBAAiB,CAAC,GA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C;IACvD,CAAC;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { defaultTargetHost } from "../config.js";
|
|
2
3
|
import { buildContextKey, initialCapabilities, } from "./types.js";
|
|
3
4
|
function deriveAuthIdentity(spec) {
|
|
4
5
|
if (!spec.password) {
|
|
@@ -56,13 +57,13 @@ export class SshAccessTransport {
|
|
|
56
57
|
}
|
|
57
58
|
/** Default derive target from config (selector only ??does not create a Context). */
|
|
58
59
|
defaultDeriveSpec(config) {
|
|
59
|
-
const host = config.targetHost?.trim();
|
|
60
|
+
const host = config.targetHost?.trim() || defaultTargetHost(config.targetHosts ?? []);
|
|
60
61
|
if (!host) {
|
|
61
62
|
return undefined;
|
|
62
63
|
}
|
|
63
64
|
const user = config.targetUser?.trim();
|
|
64
65
|
if (!user) {
|
|
65
|
-
throw new Error("
|
|
66
|
+
throw new Error("TARGET_HOSTS is set but TARGET_USER is missing");
|
|
66
67
|
}
|
|
67
68
|
return {
|
|
68
69
|
host,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssh-transport.js","sourceRoot":"","sources":["../../src/access/ssh-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ssh-transport.js","sourceRoot":"","sources":["../../src/access/ssh-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAkB,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,eAAe,EACf,mBAAmB,GAGpB,MAAM,YAAY,CAAC;AAEpB,SAAS,kBAAkB,CAAC,IAAgB;IAC1C,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACnB,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAA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