dsh-remote-go 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +64 -95
  2. package/{client.js → dist/client.js} +7805 -5486
  3. package/dist/index.js +4 -0
  4. package/dist/src/admission.js +46 -0
  5. package/dist/src/api.js +442 -0
  6. package/dist/src/atomic-json.js +235 -0
  7. package/dist/src/bootstrap.js +106 -0
  8. package/dist/src/connect/attach.js +43 -0
  9. package/dist/src/connect/bootstrap.js +14 -0
  10. package/dist/src/connect/failures.js +44 -0
  11. package/dist/src/connect/guards.js +31 -0
  12. package/dist/src/connect/launch.js +80 -0
  13. package/dist/src/connect/links.js +70 -0
  14. package/dist/src/connect/ownership.js +220 -0
  15. package/dist/src/connect/pipeline.js +473 -0
  16. package/dist/src/connect/reattach.js +215 -0
  17. package/dist/src/connect/registry.js +11 -0
  18. package/dist/src/connect/repair.js +126 -0
  19. package/dist/src/connect/restart.js +316 -0
  20. package/dist/src/connect/stop.js +198 -0
  21. package/dist/src/connect/transport.js +109 -0
  22. package/dist/src/connect/verify.js +39 -0
  23. package/dist/src/connect/watchdog.js +76 -0
  24. package/dist/src/connect-log.js +162 -0
  25. package/dist/src/connect-progress.js +142 -0
  26. package/dist/src/constants.js +67 -0
  27. package/dist/src/context.js +117 -0
  28. package/dist/src/diagnostics.js +102 -0
  29. package/dist/src/download-jobs.js +230 -0
  30. package/dist/src/errors.js +243 -0
  31. package/dist/src/events.js +390 -0
  32. package/dist/src/host-lifecycle.js +504 -0
  33. package/dist/src/host-registry.js +232 -0
  34. package/dist/src/host-runtime.js +86 -0
  35. package/dist/src/host-view.js +75 -0
  36. package/dist/src/index.js +216 -0
  37. package/dist/src/kernel-adapter.js +434 -0
  38. package/dist/src/key-files.js +52 -0
  39. package/dist/src/known-hosts.js +125 -0
  40. package/dist/src/layout.js +43 -0
  41. package/dist/src/local-download.js +380 -0
  42. package/dist/src/local-ssh.js +30 -0
  43. package/dist/src/local-version.js +101 -0
  44. package/dist/src/node/download.js +160 -0
  45. package/dist/src/node-runtime.js +346 -0
  46. package/dist/src/probe.js +96 -0
  47. package/dist/src/prompts.js +270 -0
  48. package/dist/src/proxy/cookies.js +136 -0
  49. package/dist/src/proxy/headers.js +262 -0
  50. package/dist/src/proxy/http.js +142 -0
  51. package/dist/src/proxy/index.js +135 -0
  52. package/dist/src/proxy/limits.js +8 -0
  53. package/dist/src/proxy/routes.js +39 -0
  54. package/dist/src/proxy/upgrade.js +175 -0
  55. package/dist/src/redact.js +104 -0
  56. package/dist/src/remote-files.js +72 -0
  57. package/dist/src/remote-path.js +123 -0
  58. package/dist/src/remote-proc.js +339 -0
  59. package/dist/src/remote-web/registry.js +147 -0
  60. package/dist/src/remote-web/resolve.js +310 -0
  61. package/dist/src/remote-web/start.js +227 -0
  62. package/dist/src/remote-web/stop.js +93 -0
  63. package/dist/src/request-trust.js +87 -0
  64. package/dist/src/runtime/dispatch.js +310 -0
  65. package/dist/src/runtime/effects.js +91 -0
  66. package/dist/src/runtime/events.js +35 -0
  67. package/dist/src/runtime/fsm.js +120 -0
  68. package/dist/src/runtime/rules.js +565 -0
  69. package/dist/src/secrets.js +142 -0
  70. package/dist/src/service.js +406 -0
  71. package/dist/src/settings.js +144 -0
  72. package/dist/src/ssh-config.js +276 -0
  73. package/dist/src/ssh-failures.js +122 -0
  74. package/dist/src/ssh-port.js +4 -0
  75. package/dist/src/ssh-sftp.js +297 -0
  76. package/dist/src/ssh.js +477 -0
  77. package/dist/src/store.js +191 -0
  78. package/dist/src/tool-shared.js +181 -0
  79. package/dist/src/tools-exec-policy.js +167 -0
  80. package/dist/src/tools-exec.js +371 -0
  81. package/dist/src/tools-report.js +424 -0
  82. package/dist/src/tools.js +411 -0
  83. package/dist/src/tunnel.js +129 -0
  84. package/dist/src/util.js +149 -0
  85. package/dist/src/version.js +114 -0
  86. package/dist/src/watchdog-bus.js +29 -0
  87. package/dist/src/watchdog.js +156 -0
  88. package/index.js +5 -4
  89. package/locale/en.json +2 -2
  90. package/locale/zh.json +2 -2
  91. package/package.json +40 -21
  92. package/vendor/THIRD_PARTY_NOTICES.md +27 -1
  93. package/src/api.js +0 -340
  94. package/src/atomic-json.js +0 -208
  95. package/src/bootstrap.js +0 -100
  96. package/src/connect-log.js +0 -39
  97. package/src/connect-pipeline.js +0 -463
  98. package/src/connect-progress.js +0 -135
  99. package/src/constants.js +0 -31
  100. package/src/diagnostics.js +0 -157
  101. package/src/download-jobs.js +0 -217
  102. package/src/errors.js +0 -316
  103. package/src/host-lifecycle.js +0 -187
  104. package/src/host-registry.js +0 -145
  105. package/src/host-runtime.js +0 -53
  106. package/src/host-view.js +0 -51
  107. package/src/index.js +0 -162
  108. package/src/key-files.js +0 -49
  109. package/src/known-hosts.js +0 -94
  110. package/src/layout.js +0 -35
  111. package/src/local-download.js +0 -162
  112. package/src/local-ssh.js +0 -27
  113. package/src/local-version.js +0 -88
  114. package/src/node-runtime.js +0 -521
  115. package/src/probe.js +0 -89
  116. package/src/prompts.js +0 -132
  117. package/src/redact.js +0 -54
  118. package/src/remote-files.js +0 -71
  119. package/src/remote-path.js +0 -73
  120. package/src/remote-proc.js +0 -208
  121. package/src/remote-web.js +0 -300
  122. package/src/secrets.js +0 -79
  123. package/src/service.js +0 -250
  124. package/src/settings.js +0 -135
  125. package/src/ssh-config.js +0 -271
  126. package/src/ssh.js +0 -652
  127. package/src/store.js +0 -143
  128. package/src/tunnel.js +0 -73
  129. package/src/util.js +0 -153
  130. package/src/version.js +0 -103
  131. package/src/webapp.js +0 -28
  132. package/vendor/ssh2-entry.mjs +0 -12
  133. /package/{vendor → dist/vendor}/ssh2.bundle.cjs +0 -0
package/src/store.js DELETED
@@ -1,143 +0,0 @@
1
- /**
2
- * Durable local state under `$DSH_HOME/remote-go/`: hosts.json, settings.json and secrets.json; writes are atomic, a corrupt file falls back to defaults.
3
- */
4
- import { promises as fs } from 'node:fs'
5
- import path from 'node:path'
6
- import { readJsonFile, withProcessLock, writeJsonAtomic } from './atomic-json.js'
7
- import { nowIso, randomId } from './util.js'
8
- import { defaultSettings, sanitizeHostEntry, sanitizeSettings } from './settings.js'
9
-
10
- export class HostStore {
11
- constructor(options) {
12
- this.dir = options.dir
13
- this.logger = options.logger ?? console
14
- this.fs = options.fsImpl ?? fs
15
- this.hostsFile = path.join(this.dir, 'hosts.json')
16
- this.settingsFile = path.join(this.dir, 'settings.json')
17
- this.secretsFile = path.join(this.dir, 'secrets.json')
18
- this.data = { hosts: [], settings: defaultSettings() }
19
- this.secrets = {}
20
- this.loaded = false
21
- }
22
-
23
- async load() {
24
- if (this.loaded) return this.data
25
- try {
26
- await this.fs.mkdir(this.dir, { recursive: true, mode: 0o700 })
27
- } catch (error) {
28
- this.logger.warn?.('[dsh-remote-go] cannot create state directory:', error)
29
- }
30
- this.data.hosts = await this.#readJson(this.hostsFile, [])
31
- this.data.hosts = Array.isArray(this.data.hosts)
32
- ? this.data.hosts.filter((item) => item && typeof item === 'object')
33
- : []
34
- this.data.settings = sanitizeSettings(await this.#readJson(this.settingsFile, null))
35
- const secrets = await this.#readJson(this.secretsFile, null)
36
- this.secrets = secrets && typeof secrets === 'object' ? secrets : {}
37
- this.loaded = true
38
- return this.data
39
- }
40
-
41
- async #readJson(file, fallback) {
42
- const result = await readJsonFile(file, { fs: this.fs, logger: this.logger })
43
- return result.status === 'ok' ? result.value : fallback
44
- }
45
-
46
- #writeJson(file, value, mode = 0o600) {
47
- return withProcessLock(`${file}.lock`, { fs: this.fs, logger: this.logger }, () =>
48
- writeJsonAtomic(file, value, {
49
- dir: this.dir,
50
- fs: this.fs,
51
- logger: this.logger,
52
- fileMode: mode,
53
- }),
54
- )
55
- }
56
-
57
- async #persistHosts() {
58
- await this.#writeJson(this.hostsFile, this.data.hosts)
59
- }
60
-
61
- async #persistSettings() {
62
- await this.#writeJson(this.settingsFile, this.data.settings)
63
- }
64
-
65
- async #persistSecrets() {
66
- await this.#writeJson(this.secretsFile, this.secrets)
67
- }
68
-
69
- listHosts() {
70
- return this.data.hosts.map((host) => ({ ...host }))
71
- }
72
-
73
- getHost(id) {
74
- const host = this.data.hosts.find((item) => item.id === id)
75
- return host ? { ...host } : null
76
- }
77
-
78
- async upsertHost(rawEntry, options = {}) {
79
- await this.load()
80
- const existing =
81
- rawEntry && typeof rawEntry === 'object' && typeof rawEntry.id === 'string' ? this.getHost(rawEntry.id) : null
82
- const entry = sanitizeHostEntry(rawEntry, { settings: options.settings ?? this.data.settings, existing })
83
- if (!entry.id) entry.id = randomId('h')
84
- const index = this.data.hosts.findIndex((item) => item.id === entry.id)
85
- if (index >= 0) this.data.hosts[index] = { ...this.data.hosts[index], ...entry }
86
- else this.data.hosts.push(entry)
87
- await this.#persistHosts()
88
- return this.getHost(entry.id)
89
- }
90
-
91
- async removeHost(id) {
92
- await this.load()
93
- const before = this.data.hosts.length
94
- this.data.hosts = this.data.hosts.filter((item) => item.id !== id)
95
- if (this.data.hosts.length !== before) await this.#persistHosts()
96
- if (this.secrets[id]) {
97
- delete this.secrets[id]
98
- await this.#persistSecrets()
99
- }
100
- return before !== this.data.hosts.length
101
- }
102
-
103
- async patchHost(id, patch) {
104
- await this.load()
105
- const host = this.data.hosts.find((item) => item.id === id)
106
- if (!host) return null
107
- Object.assign(host, patch, { updatedAt: nowIso() })
108
- await this.#persistHosts()
109
- return { ...host }
110
- }
111
-
112
- getSettings() {
113
- return this.data.settings
114
- }
115
-
116
- async saveSettings(raw) {
117
- await this.load()
118
- this.data.settings = sanitizeSettings({ ...this.data.settings, ...(raw && typeof raw === 'object' ? raw : {}) })
119
- await this.#persistSettings()
120
- if (!this.data.settings.saveTokens) {
121
- this.secrets = {}
122
- await this.#persistSecrets()
123
- }
124
- return this.data.settings
125
- }
126
-
127
- async saveToken(hostId, token) {
128
- if (!this.data.settings.saveTokens) return
129
- this.secrets[hostId] = token
130
- await this.#persistSecrets()
131
- }
132
- }
133
-
134
- export function resolveDshHome(env = process.env) {
135
- const home = env.DSH_HOME && env.DSH_HOME.trim() !== '' ? env.DSH_HOME.trim() : null
136
- if (home) return home
137
- const userHome = env.USERPROFILE || env.HOME || process.cwd()
138
- return path.join(userHome, '.dsh')
139
- }
140
-
141
- export function resolveStateDir(home) {
142
- return path.join(home, 'remote-go')
143
- }
package/src/tunnel.js DELETED
@@ -1,73 +0,0 @@
1
- /**
2
- * Local loopback TCP listener piped through the SSH transport; the guest points at it, so its cookies never mix with the local GUI's.
3
- */
4
- import net from 'node:net'
5
-
6
- export async function createTunnel(options) {
7
- const remoteHost = options.remoteHost ?? '127.0.0.1'
8
- const listenHost = options.listenHost ?? '127.0.0.1'
9
- const sockets = new Set()
10
- let closed = false
11
-
12
- const server = net.createServer((socket) => {
13
- if (closed) {
14
- socket.destroy()
15
- return
16
- }
17
- sockets.add(socket)
18
- const cleanup = () => {
19
- sockets.delete(socket)
20
- }
21
- socket.once('close', cleanup)
22
- socket.once('error', cleanup)
23
- options.ssh
24
- .forwardOut(remoteHost, options.remotePort, '127.0.0.1', socket.remotePort ?? 0)
25
- .then((stream) => {
26
- if (closed) {
27
- stream.destroy()
28
- socket.destroy()
29
- return
30
- }
31
- socket.pipe(stream).pipe(socket)
32
- stream.once('close', () => {
33
- if (!socket.destroyed) socket.end()
34
- })
35
- stream.once('error', () => {
36
- socket.destroy()
37
- })
38
- })
39
- .catch((error) => {
40
- options.onError?.(error instanceof Error ? error : new Error(String(error)))
41
- socket.destroy()
42
- })
43
- })
44
-
45
- await new Promise((resolve, reject) => {
46
- server.once('error', reject)
47
- server.listen(options.listenPort ?? 0, listenHost, () => {
48
- server.removeListener('error', reject)
49
- resolve(undefined)
50
- })
51
- })
52
- const address = server.address()
53
- if (!address || typeof address === 'string') {
54
- server.close()
55
- throw new Error('tunnel listener did not expose a TCP address')
56
- }
57
-
58
- return {
59
- localPort: address.port,
60
- listenHost,
61
- urlHost: listenHost.includes(':') ? `[${listenHost}]` : listenHost,
62
- get connections() {
63
- return sockets.size
64
- },
65
- async close() {
66
- if (closed) return
67
- closed = true
68
- for (const socket of sockets) socket.destroy()
69
- sockets.clear()
70
- await new Promise((resolve) => server.close(() => resolve(undefined)))
71
- },
72
- }
73
- }
package/src/util.js DELETED
@@ -1,153 +0,0 @@
1
- /**
2
- * Small pure helpers shared by the host half, unit-tested with node:test.
3
- */
4
-
5
- export function sleep(ms) {
6
- return new Promise((resolve) => setTimeout(resolve, ms))
7
- }
8
-
9
- export function randomDelay(min, max) {
10
- return Math.round(min + Math.random() * Math.max(0, max - min))
11
- }
12
-
13
- const ID_ALPHABET = 'abcdefghijklmnopqrstuvwxyz0123456789'
14
-
15
- export function randomId(prefix = 'h') {
16
- let out = ''
17
- for (let i = 0; i < 10; i += 1) out += ID_ALPHABET[Math.floor(Math.random() * ID_ALPHABET.length)]
18
- return `${prefix}_${out}`
19
- }
20
-
21
- export function nowIso() {
22
- return new Date().toISOString()
23
- }
24
-
25
- export function isPlainObject(value) {
26
- return typeof value === 'object' && value !== null && !Array.isArray(value)
27
- }
28
-
29
- const LOG_LEVELS = { error: 0, warn: 1, info: 2, debug: 3 }
30
-
31
- /** Prototype-chain names that must never be written by a merge. */
32
- const UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype'])
33
-
34
- /**
35
- * Recursively merge `patch` into `base` (arrays and scalars replace). Only keys
36
- * `base` declares are written, so untrusted input can change known values but
37
- * never invent a property or poison the prototype.
38
- */
39
- export function deepMerge(base, patch) {
40
- if (!isPlainObject(base) || !isPlainObject(patch)) return /** @type {T} */ (patch === undefined ? base : patch)
41
- const out = { ...base }
42
- for (const key of Object.keys(base)) {
43
- if (UNSAFE_KEYS.has(key)) continue
44
- const value = patch[key]
45
- if (value === undefined) continue
46
- out[key] = isPlainObject(value) && isPlainObject(base[key]) ? deepMerge(base[key], value) : value
47
- }
48
- return out
49
- }
50
-
51
- export function clamp(value, min, max) {
52
- return Math.min(max, Math.max(min, value))
53
- }
54
-
55
- export function expandHome(value, home) {
56
- const text = typeof value === 'string' ? value.trim() : ''
57
- if (text === '') return ''
58
- if (text === '~') return home
59
- if (text.startsWith('~/') || text.startsWith('~\\')) return home.replace(/[\\/]+$/, '') + text.slice(1)
60
- return text
61
- }
62
-
63
- export function parseSshDestination(raw) {
64
- const text = String(raw ?? '').trim()
65
- if (text === '') return { user: null, host: '', port: null }
66
- let user = null
67
- let rest = text
68
- const at = rest.lastIndexOf('@')
69
- if (at >= 0) {
70
- user = rest.slice(0, at)
71
- rest = rest.slice(at + 1)
72
- }
73
- let host = rest
74
- let port = null
75
- if (rest.startsWith('[')) {
76
- const close = rest.indexOf(']')
77
- if (close > 0) {
78
- host = rest.slice(1, close)
79
- const tail = rest.slice(close + 1)
80
- if (/^:\d+$/.test(tail)) port = Number(tail.slice(1))
81
- }
82
- } else {
83
- const colon = rest.lastIndexOf(':')
84
- if (colon > 0 && rest.indexOf(':') === colon) {
85
- const maybePort = rest.slice(colon + 1)
86
- if (/^\d{1,5}$/.test(maybePort)) {
87
- host = rest.slice(0, colon)
88
- port = Number(maybePort)
89
- }
90
- }
91
- }
92
- return { user: user || null, host, port }
93
- }
94
-
95
- export function isLoopbackHost(host) {
96
- if (!host) return false
97
- const normalized = host
98
- .trim()
99
- .toLowerCase()
100
- .replace(/^\[|\]$/g, '')
101
- if (normalized === 'localhost' || normalized === '::1') return true
102
- if (normalized === '::ffff:127.0.0.1') return true
103
- return /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(normalized)
104
- }
105
-
106
- export function shellQuote(value) {
107
- return `'${String(value).replaceAll("'", `'\\''`)}'`
108
- }
109
-
110
- export function headTail(text, max = 4000) {
111
- const value = String(text ?? '')
112
- if (value.length <= max) return value
113
- const head = value.slice(0, Math.floor(max / 2))
114
- const tail = value.slice(-Math.floor(max / 2))
115
- return `${head}\n…\n${tail}`
116
- }
117
-
118
- export function logVisible(level, threshold = 'info') {
119
- const rank = LOG_LEVELS[level] ?? LOG_LEVELS.info
120
- const floor = LOG_LEVELS[threshold] ?? LOG_LEVELS.info
121
- return rank >= floor
122
- }
123
-
124
- /** Message of an unknown thrown value, so catch blocks need not spell the ternary. */
125
- export function messageOf(error) {
126
- return String(error?.message ?? error)
127
- }
128
-
129
- /** A positive integer — the only shape `kill`, `/proc` and a TCP port accept. */
130
- export function isPid(value) {
131
- return Number.isInteger(value) && value > 0
132
- }
133
-
134
- /**
135
- * A promise that resolves at most once: through `settle`, or with `onTimeout()`
136
- * when the deadline passes first. `onSettled` runs before the promise resolves so
137
- * a caller can clear the pending slot it installed on both paths.
138
- */
139
- export function createDecision(timeoutMs, onTimeout, onSettled) {
140
- let settle
141
- const promise = new Promise((resolve) => {
142
- let done = false
143
- const timer = setTimeout(() => settle(onTimeout?.()), timeoutMs)
144
- settle = (value) => {
145
- if (done) return
146
- done = true
147
- clearTimeout(timer)
148
- onSettled?.(value)
149
- resolve(value)
150
- }
151
- })
152
- return { promise, settle }
153
- }
package/src/version.js DELETED
@@ -1,103 +0,0 @@
1
- /**
2
- * Version parsing/comparison and the exact-version parity rule, covering the shapes DSH and Node publish (`0.2.2-rc.1`, `24.22.2`, optional `v`).
3
- */
4
-
5
- const VERSION_RE = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+([0-9A-Za-z.-]+))?$/
6
-
7
- export function parseVersion(input) {
8
- if (typeof input !== 'string') return null
9
- const match = VERSION_RE.exec(input.trim())
10
- if (!match) return null
11
- const [, major, minor, patch, prerelease, build] = match
12
- return {
13
- raw: input.trim(),
14
- major: Number(major),
15
- minor: Number(minor),
16
- patch: Number(patch),
17
- prerelease: prerelease ? prerelease.split('.').map((part) => (/^\d+$/.test(part) ? Number(part) : part)) : [],
18
- build: build ?? null,
19
- }
20
- }
21
-
22
- export function normalizeVersion(input) {
23
- const parsed = parseVersion(input)
24
- if (!parsed) return String(input ?? '').trim()
25
- const core = `${parsed.major}.${parsed.minor}.${parsed.patch}`
26
- return parsed.prerelease.length > 0 ? `${core}-${parsed.prerelease.join('.')}` : core
27
- }
28
-
29
- function compareIdentifiers(a, b) {
30
- const aNum = typeof a === 'number'
31
- const bNum = typeof b === 'number'
32
- if (aNum && bNum) return a === b ? 0 : a < b ? -1 : 1
33
- if (aNum) return -1 // numeric identifiers sort before alphanumeric ones
34
- if (bNum) return 1
35
- return a === b ? 0 : String(a) < String(b) ? -1 : 1
36
- }
37
-
38
- export function compareVersions(a, b) {
39
- const pa = parseVersion(a)
40
- const pb = parseVersion(b)
41
- if (!pa || !pb) {
42
- const sa = String(a ?? '')
43
- const sb = String(b ?? '')
44
- return sa === sb ? 0 : sa < sb ? -1 : 1
45
- }
46
- for (const key of ['major', 'minor', 'patch']) {
47
- if (pa[key] !== pb[key]) return pa[key] < pb[key] ? -1 : 1
48
- }
49
- if (pa.prerelease.length === 0 && pb.prerelease.length === 0) return 0
50
- if (pa.prerelease.length === 0) return 1
51
- if (pb.prerelease.length === 0) return -1
52
- const length = Math.max(pa.prerelease.length, pb.prerelease.length)
53
- for (let i = 0; i < length; i += 1) {
54
- const left = pa.prerelease[i]
55
- const right = pb.prerelease[i]
56
- if (left === undefined) return -1
57
- if (right === undefined) return 1
58
- const result = compareIdentifiers(left, right)
59
- if (result !== 0) return result
60
- }
61
- return 0
62
- }
63
-
64
- export function versionsEqual(a, b) {
65
- return compareVersions(normalizeVersion(a), normalizeVersion(b)) === 0
66
- }
67
-
68
- export function versionParity(localVersion, remoteVersion) {
69
- if (!localVersion || !remoteVersion) {
70
- return {
71
- status: /** @type {'unknown'} */ ('unknown'),
72
- local: localVersion ?? null,
73
- remote: remoteVersion ?? null,
74
- same: false,
75
- message: {
76
- zh: '无法确定版本一致性(缺少本机或远端版本)。',
77
- en: 'Version parity is unknown (a local or remote version is missing).',
78
- },
79
- }
80
- }
81
- const same = versionsEqual(localVersion, remoteVersion)
82
- return {
83
- status: /** @type {'same' | 'different'} */ (same ? 'same' : 'different'),
84
- local: normalizeVersion(localVersion),
85
- remote: normalizeVersion(remoteVersion),
86
- same,
87
- message: same
88
- ? { zh: '远端与本机 DSH 版本一致。', en: 'The remote DSH version matches this machine.' }
89
- : {
90
- zh: `远端 DSH(${normalizeVersion(remoteVersion)})与本机(${normalizeVersion(localVersion)})不一致。`,
91
- en: `Remote DSH (${normalizeVersion(remoteVersion)}) differs from this machine (${normalizeVersion(localVersion)}).`,
92
- },
93
- }
94
- }
95
-
96
- export const MIN_NODE_VERSION = '24.9.0'
97
-
98
- export function isNodeVersionSupported(version) {
99
- if (!version) return false
100
- // node -v prints "v24.22.2"; a bare "24" from a fallback should not pass.
101
- if (!parseVersion(version)) return false
102
- return compareVersions(normalizeVersion(version), MIN_NODE_VERSION) >= 0
103
- }
package/src/webapp.js DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * Remote DSH web lifecycle — the surface callers import: `remote-web.js` owns start/stop/adopt, `remote-proc.js` the scan and reachability primitives.
3
- */
4
- export {
5
- LAUNCH_MARKER,
6
- BROWSER_CARRIER_PATCH_FILE,
7
- parseWebLine,
8
- buildStartCommand,
9
- buildBrowserCarrierProbe,
10
- ensureBrowserCarrier,
11
- buildStartScript,
12
- startRemoteWeb,
13
- stopRemoteWeb,
14
- readRunRegistry,
15
- readWebLineFromLog,
16
- remotePidAlive,
17
- adoptRemoteWeb,
18
- } from './remote-web.js'
19
-
20
- export {
21
- buildForeignDshCommand,
22
- parseForeignDshOutput,
23
- findForeignDshProcesses,
24
- stopForeignDshProcesses,
25
- remoteHttpStatus,
26
- waitForRemoteUi,
27
- exchangeTokenOverTunnel,
28
- } from './remote-proc.js'
@@ -1,12 +0,0 @@
1
- // Vendored-ssh2 entry point. `scripts/build-vendor.mjs` bundles this file into
2
- // `vendor/ssh2.bundle.cjs`, so the published plugin ships with **zero runtime
3
- // dependencies and no install/build scripts** (design: keep install light, never
4
- // run arbitrary npm lifecycle scripts on the user's machine).
5
- //
6
- // Rebuild with: node scripts/build-vendor.mjs
7
- import ssh2 from 'ssh2'
8
-
9
- export const Client = ssh2.Client
10
- export const utils = ssh2.utils
11
- export const Server = ssh2.Server
12
- export default ssh2
File without changes