dsh-over-ssh 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +119 -2
- package/agents/agent-manifest.json +20 -0
- package/agents/linux-amd64/dsh-over-ssh-agent +0 -0
- package/agents/linux-arm64/dsh-over-ssh-agent +0 -0
- package/cordis.patch.yml +84 -0
- package/lib/client.js +6611 -0
- package/lib/file-references.js +366 -0
- package/lib/fs.js +1368 -0
- package/lib/index.js +19034 -0
- package/lib/local-bridge-refs.js +16 -0
- package/lib/local-bridge.js +16 -0
- package/lib/terminal-wrapper.js +294 -0
- package/lib/types/src/client/controls.d.ts +131 -0
- package/lib/types/src/client/core/card-focus-trap.d.ts +45 -0
- package/lib/types/src/client/core/controls.d.ts +164 -0
- package/lib/types/src/client/core/latest.d.ts +48 -0
- package/lib/types/src/client/core/locale.d.ts +38 -0
- package/lib/types/src/client/core/message.d.ts +37 -0
- package/lib/types/src/client/core/panel-model.d.ts +134 -0
- package/lib/types/src/client/core/portal.d.ts +266 -0
- package/lib/types/src/client/core/remote.d.ts +84 -0
- package/lib/types/src/client/core/styles.d.ts +458 -0
- package/lib/types/src/client/file-tree-io.d.ts +19 -0
- package/lib/types/src/client/file-tree.d.ts +271 -0
- package/lib/types/src/client/flows/directory-browser.d.ts +587 -0
- package/lib/types/src/client/flows/session-directory.d.ts +415 -0
- package/lib/types/src/client/flows/workspace-directory-flow.d.ts +480 -0
- package/lib/types/src/client/index.d.ts +49 -0
- package/lib/types/src/client/locale.d.ts +31 -0
- package/lib/types/src/client/panel-model.d.ts +37 -0
- package/lib/types/src/client/panel.d.ts +77 -0
- package/lib/types/src/client/roots/connection-test.d.ts +69 -0
- package/lib/types/src/client/roots/roots-panel-state.d.ts +307 -0
- package/lib/types/src/client/roots/roots-panel-view.d.ts +280 -0
- package/lib/types/src/client/roots/roots-panel.d.ts +364 -0
- package/lib/types/src/client/roots/transfer-panel-view.d.ts +35 -0
- package/lib/types/src/client/roots/transfer-panel.d.ts +241 -0
- package/lib/types/src/client/roots/transfer-progress.d.ts +67 -0
- package/lib/types/src/client/roots-panel-view.d.ts +236 -0
- package/lib/types/src/client/roots-panel.d.ts +347 -0
- package/lib/types/src/client/session/session-panel-view.d.ts +336 -0
- package/lib/types/src/client/session/session-panel.d.ts +322 -0
- package/lib/types/src/client/session/session-remote-mark.d.ts +110 -0
- package/lib/types/src/client/session/session-row-actions.d.ts +398 -0
- package/lib/types/src/client/session-panel.d.ts +152 -0
- package/lib/types/src/client/styles.d.ts +252 -0
- package/lib/types/src/client/workspace-directory-flow.d.ts +342 -0
- package/lib/types/src/config.d.ts +312 -0
- package/lib/types/src/file-references.d.ts +25 -0
- package/lib/types/src/fs.d.ts +46 -0
- package/lib/types/src/host/app/backend.d.ts +170 -0
- package/lib/types/src/host/app/recycle-bin/recycle-bin-contract.d.ts +247 -0
- package/lib/types/src/host/app/recycle-bin/recycle-bin-move.d.ts +18 -0
- package/lib/types/src/host/app/recycle-bin/recycle-bin-service.d.ts +45 -0
- package/lib/types/src/host/app/recycle-bin/recycle-bin-world.d.ts +38 -0
- package/lib/types/src/host/app/recycle-bin-contract.d.ts +215 -0
- package/lib/types/src/host/app/recycle-bin-move.d.ts +18 -0
- package/lib/types/src/host/app/recycle-bin-service.d.ts +45 -0
- package/lib/types/src/host/app/recycle-bin-world.d.ts +35 -0
- package/lib/types/src/host/app/roots/roots-api-connections.d.ts +49 -0
- package/lib/types/src/host/app/roots/roots-api-contract.d.ts +369 -0
- package/lib/types/src/host/app/roots/roots-api-directories.d.ts +13 -0
- package/lib/types/src/host/app/roots/roots-api-http.d.ts +77 -0
- package/lib/types/src/host/app/roots/roots-api-long-poll.d.ts +130 -0
- package/lib/types/src/host/app/roots/roots-api-projections.d.ts +102 -0
- package/lib/types/src/host/app/roots/roots-api-roots.d.ts +13 -0
- package/lib/types/src/host/app/roots/roots-api-state.d.ts +22 -0
- package/lib/types/src/host/app/roots/roots-api-transfers.d.ts +26 -0
- package/lib/types/src/host/app/roots/roots-api.d.ts +55 -0
- package/lib/types/src/host/app/roots/user-roots.d.ts +552 -0
- package/lib/types/src/host/app/roots-api-connections.d.ts +49 -0
- package/lib/types/src/host/app/roots-api-contract.d.ts +339 -0
- package/lib/types/src/host/app/roots-api-directories.d.ts +13 -0
- package/lib/types/src/host/app/roots-api-http.d.ts +77 -0
- package/lib/types/src/host/app/roots-api-projections.d.ts +102 -0
- package/lib/types/src/host/app/roots-api-roots.d.ts +13 -0
- package/lib/types/src/host/app/roots-api-state.d.ts +22 -0
- package/lib/types/src/host/app/roots-api-support.d.ts +182 -0
- package/lib/types/src/host/app/roots-api-transfers.d.ts +13 -0
- package/lib/types/src/host/app/roots-api.d.ts +55 -0
- package/lib/types/src/host/app/routed-fs.d.ts +239 -0
- package/lib/types/src/host/app/serialize.d.ts +37 -0
- package/lib/types/src/host/app/session-admin/session-admin-context.d.ts +36 -0
- package/lib/types/src/host/app/session-admin/session-admin-contract.d.ts +221 -0
- package/lib/types/src/host/app/session-admin/session-admin-delete.d.ts +34 -0
- package/lib/types/src/host/app/session-admin/session-admin-service.d.ts +40 -0
- package/lib/types/src/host/app/session-admin-context.d.ts +36 -0
- package/lib/types/src/host/app/session-admin-contract.d.ts +214 -0
- package/lib/types/src/host/app/session-admin-delete.d.ts +34 -0
- package/lib/types/src/host/app/session-admin-service.d.ts +38 -0
- package/lib/types/src/host/app/takeover/takeover-plan.d.ts +227 -0
- package/lib/types/src/host/app/takeover/takeover-rows.d.ts +55 -0
- package/lib/types/src/host/app/transport/transport-selector.d.ts +98 -0
- package/lib/types/src/host/app/transport/transport-service.d.ts +82 -0
- package/lib/types/src/host/app/transport-selector.d.ts +98 -0
- package/lib/types/src/host/app/transport-service.d.ts +75 -0
- package/lib/types/src/host/app/user-roots.d.ts +461 -0
- package/lib/types/src/host/domain/bin-location.d.ts +79 -0
- package/lib/types/src/host/domain/capability.d.ts +78 -0
- package/lib/types/src/host/domain/connection.d.ts +95 -0
- package/lib/types/src/host/domain/errors.d.ts +55 -0
- package/lib/types/src/host/domain/glob-pattern.d.ts +62 -0
- package/lib/types/src/host/domain/literal-text.d.ts +63 -0
- package/lib/types/src/host/domain/path-grammar.d.ts +84 -0
- package/lib/types/src/host/domain/recycle-bin.d.ts +337 -0
- package/lib/types/src/host/domain/root.d.ts +74 -0
- package/lib/types/src/host/domain/roots/bin-location.d.ts +91 -0
- package/lib/types/src/host/domain/roots/connection.d.ts +106 -0
- package/lib/types/src/host/domain/roots/root.d.ts +108 -0
- package/lib/types/src/host/domain/roots/route-table.d.ts +102 -0
- package/lib/types/src/host/domain/roots/session-roots.d.ts +151 -0
- package/lib/types/src/host/domain/roots/ssh-config.d.ts +73 -0
- package/lib/types/src/host/domain/route-table.d.ts +80 -0
- package/lib/types/src/host/domain/session/session-admin.d.ts +345 -0
- package/lib/types/src/host/domain/session/terminal-target.d.ts +136 -0
- package/lib/types/src/host/domain/session-admin.d.ts +330 -0
- package/lib/types/src/host/domain/shell.d.ts +47 -0
- package/lib/types/src/host/domain/ssh-config.d.ts +73 -0
- package/lib/types/src/host/domain/terminal-target.d.ts +132 -0
- package/lib/types/src/host/domain/tool-requests.d.ts +369 -0
- package/lib/types/src/host/domain/transfer/recycle-bin.d.ts +337 -0
- package/lib/types/src/host/domain/transfer/transfer.d.ts +260 -0
- package/lib/types/src/host/domain/transfer.d.ts +260 -0
- package/lib/types/src/host/infra/backend/local-backend.d.ts +84 -0
- package/lib/types/src/host/infra/backend/local-version.d.ts +43 -0
- package/lib/types/src/host/infra/backend/platform-local-backend.d.ts +89 -0
- package/lib/types/src/host/infra/backend/remote-backend.d.ts +239 -0
- package/lib/types/src/host/infra/cache/lru.d.ts +52 -0
- package/lib/types/src/host/infra/cache/versioned.d.ts +77 -0
- package/lib/types/src/host/infra/temp-name.d.ts +19 -0
- package/lib/types/src/host/infra/transport/agent/agent-installer.d.ts +121 -0
- package/lib/types/src/host/infra/transport/agent/agent-protocol-client.d.ts +132 -0
- package/lib/types/src/host/infra/transport/agent/agent-protocol-codec.d.ts +140 -0
- package/lib/types/src/host/infra/transport/agent/agent-protocol-errors.d.ts +41 -0
- package/lib/types/src/host/infra/transport/agent/agent-protocol-frames.d.ts +197 -0
- package/lib/types/src/host/infra/transport/agent/agent-protocol-types.d.ts +564 -0
- package/lib/types/src/host/infra/transport/agent/agent-transport.d.ts +418 -0
- package/lib/types/src/host/infra/transport/agent-installer.d.ts +121 -0
- package/lib/types/src/host/infra/transport/agent-protocol-client.d.ts +123 -0
- package/lib/types/src/host/infra/transport/agent-protocol-codec.d.ts +131 -0
- package/lib/types/src/host/infra/transport/agent-protocol-errors.d.ts +41 -0
- package/lib/types/src/host/infra/transport/agent-protocol-frames.d.ts +197 -0
- package/lib/types/src/host/infra/transport/agent-protocol-types.d.ts +509 -0
- package/lib/types/src/host/infra/transport/agent-transport.d.ts +353 -0
- package/lib/types/src/host/infra/transport/alias-transport.d.ts +206 -0
- package/lib/types/src/host/infra/transport/askpass-fs.d.ts +20 -0
- package/lib/types/src/host/infra/transport/askpass.d.ts +133 -0
- package/lib/types/src/host/infra/transport/command-pool.d.ts +61 -0
- package/lib/types/src/host/infra/transport/fs-commands.d.ts +140 -0
- package/lib/types/src/host/infra/transport/git-status-route.d.ts +63 -0
- package/lib/types/src/host/infra/transport/git-status.d.ts +101 -0
- package/lib/types/src/host/infra/transport/node-spawn.d.ts +26 -0
- package/lib/types/src/host/infra/transport/session-window.d.ts +51 -0
- package/lib/types/src/host/infra/transport/shell-quote.d.ts +59 -0
- package/lib/types/src/host/infra/transport/ssh/alias-transport.d.ts +206 -0
- package/lib/types/src/host/infra/transport/ssh/askpass-fs.d.ts +20 -0
- package/lib/types/src/host/infra/transport/ssh/askpass.d.ts +133 -0
- package/lib/types/src/host/infra/transport/ssh/shell-quote.d.ts +62 -0
- package/lib/types/src/host/infra/transport/ssh/ssh-argv.d.ts +43 -0
- package/lib/types/src/host/infra/transport/ssh/ssh2-transport.d.ts +328 -0
- package/lib/types/src/host/infra/transport/ssh-argv.d.ts +43 -0
- package/lib/types/src/host/infra/transport/ssh2-transport.d.ts +302 -0
- package/lib/types/src/host/infra/transport/transport-base.d.ts +34 -0
- package/lib/types/src/host/infra/transport/transport.d.ts +527 -0
- package/lib/types/src/host/integration/agent/agent-install-io.d.ts +33 -0
- package/lib/types/src/host/integration/agent/agent-preflight.d.ts +56 -0
- package/lib/types/src/host/integration/agent/askpass-registry.d.ts +66 -0
- package/lib/types/src/host/integration/agent-install-io.d.ts +33 -0
- package/lib/types/src/host/integration/agent-preflight.d.ts +56 -0
- package/lib/types/src/host/integration/anchor-directory.d.ts +56 -0
- package/lib/types/src/host/integration/askpass-registry.d.ts +59 -0
- package/lib/types/src/host/integration/bin-root-resolver.d.ts +81 -0
- package/lib/types/src/host/integration/connection-test.d.ts +73 -0
- package/lib/types/src/host/integration/file-reference-provider.d.ts +115 -0
- package/lib/types/src/host/integration/fs/file-reference-provider.d.ts +142 -0
- package/lib/types/src/host/integration/fs/fs-provider.d.ts +368 -0
- package/lib/types/src/host/integration/fs/git-status-wiring.d.ts +21 -0
- package/lib/types/src/host/integration/fs/platform-errors.d.ts +94 -0
- package/lib/types/src/host/integration/fs/remote-file-tools.d.ts +369 -0
- package/lib/types/src/host/integration/fs/remote-index.d.ts +177 -0
- package/lib/types/src/host/integration/fs-provider.d.ts +226 -0
- package/lib/types/src/host/integration/lsp/lsp-framing.d.ts +38 -0
- package/lib/types/src/host/integration/lsp/lsp-registry.d.ts +67 -0
- package/lib/types/src/host/integration/lsp/lsp-session.d.ts +130 -0
- package/lib/types/src/host/integration/management-tools.d.ts +64 -0
- package/lib/types/src/host/integration/recycle-bin-service.d.ts +247 -0
- package/lib/types/src/host/integration/remote/connection-test.d.ts +73 -0
- package/lib/types/src/host/integration/remote/remote-face.d.ts +127 -0
- package/lib/types/src/host/integration/remote/remote-tool-backend.d.ts +108 -0
- package/lib/types/src/host/integration/remote-face.d.ts +127 -0
- package/lib/types/src/host/integration/remote-file-tools.d.ts +241 -0
- package/lib/types/src/host/integration/remote-home.d.ts +69 -0
- package/lib/types/src/host/integration/remote-index.d.ts +165 -0
- package/lib/types/src/host/integration/remote-job-tools.d.ts +295 -0
- package/lib/types/src/host/integration/remote-tool-backend.d.ts +97 -0
- package/lib/types/src/host/integration/remote-tools.d.ts +206 -0
- package/lib/types/src/host/integration/root-registry.d.ts +115 -0
- package/lib/types/src/host/integration/roots/anchor-directory.d.ts +56 -0
- package/lib/types/src/host/integration/roots/bin-root-resolver.d.ts +81 -0
- package/lib/types/src/host/integration/roots/remote-home.d.ts +69 -0
- package/lib/types/src/host/integration/roots/root-registry.d.ts +144 -0
- package/lib/types/src/host/integration/roots/roots-wiring.d.ts +219 -0
- package/lib/types/src/host/integration/roots/session-root-index.d.ts +52 -0
- package/lib/types/src/host/integration/roots-api.d.ts +407 -0
- package/lib/types/src/host/integration/roots-wiring.d.ts +211 -0
- package/lib/types/src/host/integration/session/session-api.d.ts +88 -0
- package/lib/types/src/host/integration/session/session-bin-lock.d.ts +80 -0
- package/lib/types/src/host/integration/session/session-header.d.ts +151 -0
- package/lib/types/src/host/integration/session/session-labels.d.ts +56 -0
- package/lib/types/src/host/integration/session/session-route-wiring.d.ts +50 -0
- package/lib/types/src/host/integration/session-admin-service.d.ts +236 -0
- package/lib/types/src/host/integration/session-api.d.ts +81 -0
- package/lib/types/src/host/integration/session-bin-lock.d.ts +80 -0
- package/lib/types/src/host/integration/session-header.d.ts +118 -0
- package/lib/types/src/host/integration/session-labels.d.ts +56 -0
- package/lib/types/src/host/integration/session-route-wiring.d.ts +50 -0
- package/lib/types/src/host/integration/session-scope.d.ts +113 -0
- package/lib/types/src/host/integration/session-tools.d.ts +44 -0
- package/lib/types/src/host/integration/strict-arguments.d.ts +79 -0
- package/lib/types/src/host/integration/takeover/takeover-api.d.ts +62 -0
- package/lib/types/src/host/integration/takeover/takeover-route-wiring.d.ts +60 -0
- package/lib/types/src/host/integration/takeover/takeover-service.d.ts +167 -0
- package/lib/types/src/host/integration/terminal-manifest.d.ts +94 -0
- package/lib/types/src/host/integration/tools/management-tools.d.ts +245 -0
- package/lib/types/src/host/integration/tools/remote-job-tools.d.ts +316 -0
- package/lib/types/src/host/integration/tools/remote-lsp-tools.d.ts +43 -0
- package/lib/types/src/host/integration/tools/remote-tools.d.ts +236 -0
- package/lib/types/src/host/integration/tools/session-target.d.ts +52 -0
- package/lib/types/src/host/integration/tools/session-tools.d.ts +46 -0
- package/lib/types/src/host/integration/tools/strict-arguments.d.ts +79 -0
- package/lib/types/src/host/integration/tools/terminal-manifest.d.ts +94 -0
- package/lib/types/src/host/integration/transfer/remote-copy.d.ts +66 -0
- package/lib/types/src/host/integration/transfer/transfer-adapters.d.ts +48 -0
- package/lib/types/src/host/integration/transfer/transfer-service.d.ts +212 -0
- package/lib/types/src/host/integration/transfer/transfer-tracker.d.ts +106 -0
- package/lib/types/src/host/integration/transfer-adapters.d.ts +44 -0
- package/lib/types/src/host/integration/transfer-service.d.ts +164 -0
- package/lib/types/src/host/integration/transfer-tracker.d.ts +106 -0
- package/lib/types/src/host/integration/user-roots.d.ts +461 -0
- package/lib/types/src/index.d.ts +66 -0
- package/lib/types/src/local-bridge-refs.d.ts +26 -0
- package/lib/types/src/local-bridge.d.ts +36 -0
- package/lib/types/src/shared/format.d.ts +13 -0
- package/lib/types/src/wiring/connections.d.ts +189 -0
- package/lib/types/src/wiring/fs.d.ts +13 -0
- package/lib/types/src/wiring/helpers.d.ts +144 -0
- package/lib/types/src/wiring/install-memo.d.ts +32 -0
- package/lib/types/src/wiring/legacy-dirs.d.ts +62 -0
- package/lib/types/src/wiring/package-paths.d.ts +35 -0
- package/lib/types/src/wiring/roots.d.ts +21 -0
- package/lib/types/src/wiring/state-dir.d.ts +29 -0
- package/lib/types/src/wiring/tools.d.ts +35 -0
- package/package.json +120 -4
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection profiles and their validation.
|
|
3
|
+
*
|
|
4
|
+
* A profile never carries secret material: a password is referenced by credential key and
|
|
5
|
+
* resolved from `ctx.credentials` per operation.
|
|
6
|
+
*
|
|
7
|
+
* @module dsh-remote-workspace/domain/connection
|
|
8
|
+
*/
|
|
9
|
+
import type { SshConfigImportDraft } from './ssh-config.ts';
|
|
10
|
+
/** How the transport reaches the host. `agent` is the opt-in Tier 2 proxy (launched over the system ssh). */
|
|
11
|
+
export type TransportKind = 'alias' | 'ssh2' | 'agent';
|
|
12
|
+
/** Host key verification policy. */
|
|
13
|
+
export type HostKeyPolicy = 'strict' | 'accept-new';
|
|
14
|
+
/** Authentication method. */
|
|
15
|
+
export type AuthSpec = {
|
|
16
|
+
readonly kind: 'agent';
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'key';
|
|
19
|
+
readonly keyPath: string;
|
|
20
|
+
readonly hasPassphrase: boolean;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: 'password';
|
|
23
|
+
readonly credentialKey: string;
|
|
24
|
+
};
|
|
25
|
+
/** One saved connection. */
|
|
26
|
+
export interface ConnectionProfile {
|
|
27
|
+
/** Stable slug used inside `ssh://` paths and as the pool key. */
|
|
28
|
+
readonly id: string;
|
|
29
|
+
/** Human-facing name. */
|
|
30
|
+
readonly name: string;
|
|
31
|
+
/** Transport implementation. */
|
|
32
|
+
readonly transport: TransportKind;
|
|
33
|
+
/** Host name used by the ssh2 transport, and by alias transport only for diagnostics. */
|
|
34
|
+
readonly host: string;
|
|
35
|
+
readonly port: number;
|
|
36
|
+
readonly user: string;
|
|
37
|
+
/** OpenSSH alias; required by the alias transport. */
|
|
38
|
+
readonly alias?: string;
|
|
39
|
+
readonly auth: AuthSpec;
|
|
40
|
+
/** ProxyJump chain, applied through `-J` (ssh2) or the alias (config). */
|
|
41
|
+
readonly proxyJump: readonly string[];
|
|
42
|
+
readonly hostKeyPolicy: HostKeyPolicy;
|
|
43
|
+
/** Remote directory used as the default root when creating a remote workspace. */
|
|
44
|
+
readonly remoteDefaultRoot?: string;
|
|
45
|
+
readonly connectTimeoutMs: number;
|
|
46
|
+
readonly commandTimeoutMs: number;
|
|
47
|
+
readonly keepAliveSeconds: number;
|
|
48
|
+
}
|
|
49
|
+
/** Defaults for a new connection. */
|
|
50
|
+
export declare const CONNECTION_DEFAULTS: {
|
|
51
|
+
readonly port: 22;
|
|
52
|
+
readonly connectTimeoutMs: 15000;
|
|
53
|
+
readonly commandTimeoutMs: 30000;
|
|
54
|
+
readonly keepAliveSeconds: 60;
|
|
55
|
+
};
|
|
56
|
+
/** Whether a string can name a value in the credential store. */
|
|
57
|
+
export declare function isValidCredentialRef(value: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Derive the credential-reference name that holds one connection's password.
|
|
60
|
+
*
|
|
61
|
+
* The platform names stored values with a POSIX identifier, so a user-chosen name — `腾讯云` included —
|
|
62
|
+
* cannot be used verbatim. The derivation keeps whatever ASCII is readable and then appends a 64-bit digest
|
|
63
|
+
* of the **exact** id: readable enough to find in the credentials file, and collision-free between two names
|
|
64
|
+
* that sanitise to the same slug (`a b` and `a_b`). It is a pure function of the id, so re-adding the same
|
|
65
|
+
* name reuses one stored secret instead of accumulating orphans.
|
|
66
|
+
*
|
|
67
|
+
* @param connectionId - the user's connection name.
|
|
68
|
+
* @returns a name satisfying {@link isValidCredentialRef}.
|
|
69
|
+
*/
|
|
70
|
+
export declare function credentialRefFor(connectionId: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Validate untrusted input into a connection profile.
|
|
73
|
+
*
|
|
74
|
+
* Misconfiguration fails loudly at this boundary, so the rest of the plugin can treat a
|
|
75
|
+
* `ConnectionProfile` as trustworthy.
|
|
76
|
+
*
|
|
77
|
+
* @param input - candidate value (settings JSON, import draft or test fixture).
|
|
78
|
+
* @returns the validated profile.
|
|
79
|
+
* @throws SshDevError with code `CONNECTION_INVALID`.
|
|
80
|
+
*/
|
|
81
|
+
export declare function validateConnectionProfile(input: unknown): ConnectionProfile;
|
|
82
|
+
/**
|
|
83
|
+
* Turn one importable `~/.ssh/config` alias into a profile.
|
|
84
|
+
*
|
|
85
|
+
* The alias transport inherits user/port/identity/proxy settings from the alias itself, so
|
|
86
|
+
* the draft's explicit values are kept only for display and for the ssh2 fallback.
|
|
87
|
+
*
|
|
88
|
+
* @param id - connection id assigned by the caller (keeps this function deterministic).
|
|
89
|
+
* @param draft - one draft from {@link importableEntries}.
|
|
90
|
+
* @returns the validated profile.
|
|
91
|
+
*/
|
|
92
|
+
export declare function profileFromImportDraft(id: string, draft: SshConfigImportDraft): ConnectionProfile;
|
|
93
|
+
/** One-line summary used by diagnostics and the settings list. */
|
|
94
|
+
export declare function connectionSummary(profile: ConnectionProfile): string;
|
|
95
|
+
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain errors and SSH failure diagnostics.
|
|
3
|
+
*
|
|
4
|
+
* Failure classification satisfies the requirement that a failed connection must name
|
|
5
|
+
* an actionable cause (missing key vs rejected key vs unreachable host vs changed host key)
|
|
6
|
+
* instead of a generic "connection failed".
|
|
7
|
+
*
|
|
8
|
+
* @module dsh-over-ssh/domain/errors
|
|
9
|
+
*/
|
|
10
|
+
/** Stable error codes crossing the plugin's internal and remote boundaries. */
|
|
11
|
+
export declare const SSH_DEV_ERROR_CODES: readonly ["CONNECTION_INVALID", "CONNECTION_NOT_FOUND", "CONNECTION_LOST", "CONNECTION_UNREACHABLE", "AUTH_FAILED", "HOST_KEY_CHANGED", "ROOT_INVALID", "ROOT_AMBIGUOUS", "ROOT_OUTSIDE", "REMOTE_NOT_FOUND", "REMOTE_UNSUPPORTED", "REMOTE_COMMAND_FAILED", "SANDBOX_DENIED", "TRANSFER_CONFLICT", "TRASH_NOT_FOUND", "SESSION_ACTIVE", "CANCELLED"];
|
|
12
|
+
/** One stable plugin error code. */
|
|
13
|
+
export type SshDevErrorCode = (typeof SSH_DEV_ERROR_CODES)[number];
|
|
14
|
+
/** A plugin-owned failure that carries a stable code and structured details. */
|
|
15
|
+
export declare class SshDevError extends Error {
|
|
16
|
+
readonly code: SshDevErrorCode;
|
|
17
|
+
readonly details: Readonly<Record<string, unknown>>;
|
|
18
|
+
constructor(code: SshDevErrorCode, message: string, details?: Readonly<Record<string, unknown>>);
|
|
19
|
+
}
|
|
20
|
+
/** Test whether a value is a plugin-owned failure. */
|
|
21
|
+
export declare function isSshDevError(value: unknown): value is SshDevError;
|
|
22
|
+
/** Actionable classification of one local `ssh` failure. */
|
|
23
|
+
export type SshFailureKind = 'auth-failed' | 'key-missing' | 'key-permissions' | 'agent-unavailable' | 'host-unreachable' | 'dns-failed' | 'host-key-changed' | 'host-key-unknown' | 'timeout' | 'remote-command-missing' | 'connection-lost' | 'unknown';
|
|
24
|
+
/** A classified failure plus the next action a user can take. */
|
|
25
|
+
export interface SshDiagnostic {
|
|
26
|
+
readonly kind: SshFailureKind;
|
|
27
|
+
readonly hint: string;
|
|
28
|
+
}
|
|
29
|
+
/** Classify one local `ssh` attempt from its exit status, stderr and signal. */
|
|
30
|
+
export declare function classifySshFailure(input: {
|
|
31
|
+
readonly exitCode?: number | undefined;
|
|
32
|
+
readonly stderr?: string | undefined;
|
|
33
|
+
readonly signal?: string | null | undefined;
|
|
34
|
+
}): SshDiagnostic;
|
|
35
|
+
/**
|
|
36
|
+
* Build the plugin failure for one unclassified-or-classified ssh failure.
|
|
37
|
+
*
|
|
38
|
+
* The classification is what decides the **code**, and the two host-key kinds have codes of their own. Mapping
|
|
39
|
+
* them onto `CONNECTION_LOST` (the old fallback) told the user "the connection dropped, reconnect" for a
|
|
40
|
+
* condition where reconnecting is exactly what must not happen silently — a changed host key is the one
|
|
41
|
+
* failure whose whole point is to stop and be looked at. `HOST_KEY_CHANGED` was declared in
|
|
42
|
+
* {@link SSH_DEV_ERROR_CODES} and never thrown anywhere until this mapping existed (audit 0043).
|
|
43
|
+
*
|
|
44
|
+
* @param connectionId - the connection the attempt belonged to.
|
|
45
|
+
* @param input - exit status, stderr and signal of the failed attempt.
|
|
46
|
+
* @returns the error to surface.
|
|
47
|
+
*/
|
|
48
|
+
export declare function sshFailureToError(connectionId: string, input: {
|
|
49
|
+
readonly exitCode?: number | undefined;
|
|
50
|
+
readonly stderr?: string | undefined;
|
|
51
|
+
readonly signal?: string | null | undefined;
|
|
52
|
+
}): SshDevError;
|
|
53
|
+
/** Keep only the tail of a long diagnostic string so details stay bounded. */
|
|
54
|
+
export declare function tail(text: string, maxChars: number): string;
|
|
55
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glob patterns, matched the way the Tier 2 agent matches them.
|
|
3
|
+
*
|
|
4
|
+
* Why this module exists: `remote_glob` used to mean two different things depending on which transport answered.
|
|
5
|
+
* The Tier 2 agent delegates to Go's `doublestar`, while the Tier 1 fallback ran a literal substring test
|
|
6
|
+
* (`path.includes(pattern)`), so `*.cpp` matched nothing on one tier and every `.cpp` on the other, and the
|
|
7
|
+
* tool description described only the substring half. The two behaviours were introduced by different audits
|
|
8
|
+
* (0052 P3 chose substring, 0030 added the Go fast path) and nothing compared them afterwards.
|
|
9
|
+
*
|
|
10
|
+
* The rules below are a port of `dsh-over-ssh-agent/internal/agent/glob_semantics_test.go`, and that same table is
|
|
11
|
+
* mirrored in this module's test. A divergence between the two implementations is therefore a test failure on
|
|
12
|
+
* one side or the other, instead of a surprise for whoever happens to run on the other tier.
|
|
13
|
+
*
|
|
14
|
+
* The language:
|
|
15
|
+
*
|
|
16
|
+
* - A pattern **without** `/` matches the basename at any depth (`*.h` finds `app/include/header.h`).
|
|
17
|
+
* - A pattern **with** `/` is anchored at the enumerated root, and `*` never crosses a `/`.
|
|
18
|
+
* - `**` as a whole segment crosses zero or more segments: `**\/a` matches `a`, `x/a`, `x/y/a`; `a/**`
|
|
19
|
+
* matches `a` itself as well as everything below it. `**` inside a segment (`a**b`) behaves like `*`.
|
|
20
|
+
* - `?` is one character other than `/`.
|
|
21
|
+
* - `[...]` is a character class; a leading `!` or `^` negates it.
|
|
22
|
+
* - `{a,b}` alternates (and `{a}` is just `a`).
|
|
23
|
+
* - `\x` is a literal `x`.
|
|
24
|
+
* - An unclosed `[` or `{` **throws**: a caller who wrote a broken pattern must be told, because an empty
|
|
25
|
+
* result would otherwise read as "no such file".
|
|
26
|
+
*
|
|
27
|
+
* Matching is case-sensitive, like `doublestar`. Paths are `/`-separated and **relative to the enumerated
|
|
28
|
+
* root** — the caller normalizes them, so this module needs no filesystem knowledge and stays offline-testable.
|
|
29
|
+
*
|
|
30
|
+
* @module dsh-over-ssh/domain/glob-pattern
|
|
31
|
+
*/
|
|
32
|
+
/** A pattern that cannot be compiled; the message names the offending construct. */
|
|
33
|
+
export declare class GlobPatternError extends Error {
|
|
34
|
+
constructor(message: string);
|
|
35
|
+
}
|
|
36
|
+
/** One compiled pattern. */
|
|
37
|
+
export interface CompiledGlob {
|
|
38
|
+
/** The pattern as the caller wrote it. */
|
|
39
|
+
readonly pattern: string;
|
|
40
|
+
/**
|
|
41
|
+
* True when the pattern has no `/`, so it is matched against the basename at any depth.
|
|
42
|
+
*
|
|
43
|
+
* The test is on the **raw** pattern, matching the agent (`!strings.Contains(pattern, "/")`): a `/` inside
|
|
44
|
+
* braces still anchors the pattern.
|
|
45
|
+
*/
|
|
46
|
+
readonly basenameOnly: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether one root-relative path matches.
|
|
49
|
+
*
|
|
50
|
+
* @param relativePath - `/`-separated path relative to the enumerated root.
|
|
51
|
+
*/
|
|
52
|
+
matches(relativePath: string): boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Compile one glob pattern.
|
|
56
|
+
*
|
|
57
|
+
* @param pattern - the pattern as the caller wrote it.
|
|
58
|
+
* @returns the compiled pattern.
|
|
59
|
+
* @throws GlobPatternError when the pattern is not a valid glob.
|
|
60
|
+
*/
|
|
61
|
+
export declare function compileGlob(pattern: string): CompiledGlob;
|
|
62
|
+
//# sourceMappingURL=glob-pattern.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Literal string helpers shared by the two write paths.
|
|
3
|
+
*
|
|
4
|
+
* The plugin has **three** literal edit call sites — `app/routed-fs.ts` (the path-based `FileSystem`
|
|
5
|
+
* surface), `integration/fs/fs-provider.ts` (the core `ctx.fs` provider) and
|
|
6
|
+
* `integration/fs/remote-file-tools.ts` (`remote_edit`) — because the seams were written separately. They
|
|
7
|
+
* must agree on what "the requested text appears N times" means and on what "replace it" produces, or the
|
|
8
|
+
* same edit is ambiguous through one seam and corrupting through another.
|
|
9
|
+
*
|
|
10
|
+
* They already diverged twice. First on counting: each carried its **own** private `countOccurrences`,
|
|
11
|
+
* and only one of the two guarded the empty needle — without that guard `indexOf('')` returns `0` forever,
|
|
12
|
+
* so the unguarded copy was an **infinite loop** (audit 0057 §11 #4, latent because a caller happened to
|
|
13
|
+
* reject the empty needle first). Then on replacing: two of the three used
|
|
14
|
+
* `source.replace(needle, replacement)`, whose **string** replacement expands `$&`, `` $` ``, `$'` and
|
|
15
|
+
* `$$` — so a replacement containing `$$` (a shell PID in a Makefile, say) was written back as `$`, and on
|
|
16
|
+
* the Tier 1 fallback path that corrupted the remote file (audit 2026-10-31 P1). One implementation each,
|
|
17
|
+
* in the domain layer, removes the possibility of a further divergence.
|
|
18
|
+
*
|
|
19
|
+
* @module dsh-over-ssh/domain/literal-text
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Count non-overlapping occurrences of a literal needle.
|
|
23
|
+
*
|
|
24
|
+
* **An empty needle returns 0, never "matches everywhere".** That is not a style choice: the loop below
|
|
25
|
+
* advances by `needle.length`, so a zero-length needle would never advance and the loop would never end.
|
|
26
|
+
* Returning 0 keeps the "0 occurrences ⇒ the text was not found" branch in the callers correct, which is
|
|
27
|
+
* the answer an empty search deserves.
|
|
28
|
+
*
|
|
29
|
+
* Occurrences are non-overlapping: `countOccurrences('aaaa', 'aa') === 2`, matching what
|
|
30
|
+
* `String.prototype.split(needle).length - 1` (the replacement the callers use) would produce.
|
|
31
|
+
*
|
|
32
|
+
* @param haystack - the text to search.
|
|
33
|
+
* @param needle - the literal text to count; treated verbatim, never as a pattern.
|
|
34
|
+
* @returns how many times `needle` occurs, or 0 when `needle` is empty.
|
|
35
|
+
*/
|
|
36
|
+
export declare function countOccurrences(haystack: string, needle: string): number;
|
|
37
|
+
/** What one literal replacement produced. */
|
|
38
|
+
export interface LiteralReplacement {
|
|
39
|
+
/** The text after the replacement. */
|
|
40
|
+
readonly text: string;
|
|
41
|
+
/** How many occurrences were replaced (`all ? occurrences : 1`), or `0` when the needle is absent. */
|
|
42
|
+
readonly replacements: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Replace occurrences of a literal needle, **verbatim on both sides**.
|
|
46
|
+
*
|
|
47
|
+
* The replacement text is spliced in by index (single) or joined from `split` (all), never passed to
|
|
48
|
+
* `String.prototype.replace` as a string replacement: that overload expands `$&`, `` $` ``, `$'` and `$$`,
|
|
49
|
+
* so `new: '$$'` would be written as `$`. Splicing is the only way to make "the replacement is inserted
|
|
50
|
+
* verbatim" true for a caller that has no idea what a `$` means to JavaScript.
|
|
51
|
+
*
|
|
52
|
+
* Total by construction: an empty or absent needle replaces nothing and returns the source unchanged, so a
|
|
53
|
+
* caller cannot turn a policy question ("should this have matched?") into a corrupted file. Every caller
|
|
54
|
+
* validates the occurrence count *before* calling this.
|
|
55
|
+
*
|
|
56
|
+
* @param source - the text to edit.
|
|
57
|
+
* @param needle - literal text to find; treated verbatim, never as a pattern.
|
|
58
|
+
* @param replacement - text to insert; no `$` expansion of any kind.
|
|
59
|
+
* @param all - replace every occurrence, or only the first.
|
|
60
|
+
* @returns the new text plus how many occurrences were replaced.
|
|
61
|
+
*/
|
|
62
|
+
export declare function replaceLiteral(source: string, needle: string, replacement: string, all: boolean): LiteralReplacement;
|
|
63
|
+
//# sourceMappingURL=literal-text.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model-facing path grammar for remote roots.
|
|
3
|
+
*
|
|
4
|
+
* Remote files are addressed as `ssh://<connectionId>/<absolute remote path>` so that a
|
|
5
|
+
* POSIX remote path can never be confused with a local POSIX path. Local anchor directories
|
|
6
|
+
* are an implementation detail of the workspace requirement (a workspace path must exist
|
|
7
|
+
* locally); they are not part of the model-facing grammar.
|
|
8
|
+
*
|
|
9
|
+
* @module dsh-over-ssh/domain/path-grammar
|
|
10
|
+
*/
|
|
11
|
+
/** The scheme that marks a remote path. */
|
|
12
|
+
export declare const SSH_SCHEME = "ssh://";
|
|
13
|
+
/** A parsed `ssh://` reference. */
|
|
14
|
+
export interface RemotePathRef {
|
|
15
|
+
/** Connection id (slug). */
|
|
16
|
+
readonly connectionId: string;
|
|
17
|
+
/** Absolute POSIX path on that host. */
|
|
18
|
+
readonly path: string;
|
|
19
|
+
}
|
|
20
|
+
/** Whether a string is written in the remote grammar. */
|
|
21
|
+
export declare function isSshPath(input: string): boolean;
|
|
22
|
+
/** Validate a connection id slug. */
|
|
23
|
+
export declare function isValidConnectionId(id: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Parse `ssh://<connectionId>/<absolute path>`.
|
|
26
|
+
*
|
|
27
|
+
* @param input - candidate reference.
|
|
28
|
+
* @returns the parsed reference, or `undefined` when the input is not in the grammar.
|
|
29
|
+
* @throws SshDevError when the input uses the scheme but is malformed.
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseSshPath(input: string): RemotePathRef | undefined;
|
|
32
|
+
/** Format a remote reference into the model-facing grammar. */
|
|
33
|
+
export declare function formatSshPath(connectionId: string, remotePath: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Normalize an absolute POSIX path: collapse repeated separators, resolve `.` and `..`,
|
|
36
|
+
* and reject relative spellings. Trailing separators are dropped except for the root.
|
|
37
|
+
*
|
|
38
|
+
* @param path - absolute POSIX path.
|
|
39
|
+
* @returns the normalized absolute path.
|
|
40
|
+
* @throws SshDevError when the path is not absolute.
|
|
41
|
+
*/
|
|
42
|
+
export declare function normalizeRemotePath(path: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Join a relative spelling onto an absolute remote base, then normalize.
|
|
45
|
+
*
|
|
46
|
+
* @param base - absolute POSIX base directory.
|
|
47
|
+
* @param relative - relative spelling, optionally containing `.`/`..`.
|
|
48
|
+
* @returns the normalized absolute path.
|
|
49
|
+
*/
|
|
50
|
+
export declare function joinRemotePath(base: string, relative: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Whether `candidate` is `root` itself or a descendant of it, compared per path segment
|
|
53
|
+
* (so `/srv/appdata` is not contained by `/srv/app`).
|
|
54
|
+
*
|
|
55
|
+
* @param root - absolute POSIX directory.
|
|
56
|
+
* @param candidate - absolute POSIX path.
|
|
57
|
+
* @returns whether the candidate is inside the root.
|
|
58
|
+
*/
|
|
59
|
+
export declare function remotePathContains(root: string, candidate: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The parent directory of an absolute remote path; the root's parent is the root.
|
|
62
|
+
*
|
|
63
|
+
* @param path - absolute POSIX path.
|
|
64
|
+
* @returns the normalized parent directory.
|
|
65
|
+
*/
|
|
66
|
+
export declare function remoteDirname(path: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* The final segment of an absolute remote path; the root yields an empty string.
|
|
69
|
+
*
|
|
70
|
+
* @param path - absolute POSIX path.
|
|
71
|
+
* @returns the final segment.
|
|
72
|
+
*/
|
|
73
|
+
export declare function remoteBasename(path: string): string;
|
|
74
|
+
/**
|
|
75
|
+
* Whether `candidate` is a descendant of one of the roots, returning the longest match.
|
|
76
|
+
*
|
|
77
|
+
* Longest-prefix matching is what keeps nested roots (`/srv` and `/srv/app`) unambiguous.
|
|
78
|
+
*
|
|
79
|
+
* @param roots - absolute POSIX roots to test.
|
|
80
|
+
* @param candidate - absolute POSIX path.
|
|
81
|
+
* @returns the matched root, or `undefined` when nothing contains the candidate.
|
|
82
|
+
*/
|
|
83
|
+
export declare function longestContainingRoot(roots: readonly string[], candidate: string): string | undefined;
|
|
84
|
+
//# sourceMappingURL=path-grammar.d.ts.map
|