dsh-remote-go 0.0.1 → 0.2.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 (52) hide show
  1. package/README.md +87 -7
  2. package/client.js +8763 -0
  3. package/cordis.patch.yml +3 -0
  4. package/index.js +4 -0
  5. package/locale/en.json +6 -0
  6. package/locale/zh.json +6 -0
  7. package/package.json +77 -3
  8. package/src/admission.js +43 -0
  9. package/src/api.js +536 -0
  10. package/src/atomic-json.js +225 -0
  11. package/src/bootstrap.js +113 -0
  12. package/src/connect-log.js +176 -0
  13. package/src/connect-pipeline.js +1900 -0
  14. package/src/connect-progress.js +155 -0
  15. package/src/constants.js +93 -0
  16. package/src/diagnostics.js +160 -0
  17. package/src/download-jobs.js +234 -0
  18. package/src/errors.js +412 -0
  19. package/src/host-lifecycle.js +604 -0
  20. package/src/host-registry.js +217 -0
  21. package/src/host-runtime.js +127 -0
  22. package/src/host-view.js +75 -0
  23. package/src/index.js +206 -0
  24. package/src/key-files.js +54 -0
  25. package/src/known-hosts.js +133 -0
  26. package/src/layout.js +53 -0
  27. package/src/local-download.js +381 -0
  28. package/src/local-ssh.js +27 -0
  29. package/src/local-version.js +88 -0
  30. package/src/node-runtime.js +521 -0
  31. package/src/probe.js +101 -0
  32. package/src/prompts.js +229 -0
  33. package/src/redact.js +68 -0
  34. package/src/remote-files.js +71 -0
  35. package/src/remote-path.js +137 -0
  36. package/src/remote-proc.js +343 -0
  37. package/src/remote-proxy.js +815 -0
  38. package/src/remote-web.js +751 -0
  39. package/src/request-trust.js +89 -0
  40. package/src/secrets.js +109 -0
  41. package/src/service.js +459 -0
  42. package/src/settings.js +163 -0
  43. package/src/ssh-config.js +271 -0
  44. package/src/ssh.js +731 -0
  45. package/src/store.js +193 -0
  46. package/src/tools.js +386 -0
  47. package/src/tunnel.js +132 -0
  48. package/src/util.js +153 -0
  49. package/src/version.js +103 -0
  50. package/src/webapp.js +43 -0
  51. package/vendor/THIRD_PARTY_NOTICES.md +36 -0
  52. package/vendor/ssh2.bundle.cjs +25 -0
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: dsh-remote-go
3
+ name: dsh-remote-go
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Package entry for the DSH Loader. The implementation lives in `src/`.
3
+ */
4
+ export { apply, inject, name, optional } from './src/index.js'
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "dsh-remote-go",
4
+ "description": "Use a remote DSH over SSH inside your local DSH: the sidebar host bar switches between Local and each host, the remote UI takes over the whole window and comes back without reloading; the connect flow shows staged progress and a live log, and you can restart or stop the remote DSH, download remote files and folders, and expose a read-only host list to local AI sessions. The remote runs on a plugin-managed Node with npx pinned to the local version, keeping its data in the remote ~/.dsh."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "dsh-remote-go",
4
+ "description": "在本地 DSH 里通过 SSH 使用远端 DSH:侧边栏主机条在「本地」与各主机间切换,远端界面整窗接管、切回不重载;连接过程有阶段进度和实时日志,可重启/关闭远端 DSH、下载远端文件与文件夹,并向本地 AI 会话提供只读主机列表。远端由插件自带的 Node + npx 按本机版本启动,数据留在远端 ~/.dsh。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "dsh-remote-go",
3
- "version": "0.0.1",
4
- "description": "Placeholder release reserving the npm name for the dsh-remote-go DeepSeek Harness plugin; the plugin ships in 0.1.0 and later.",
3
+ "version": "0.2.0",
4
+ "description": "DSH 插件:在本地 DSH 里通过 SSH 使用远端 DSH(主机条切换、整窗接管、连接进度与日志、重启/关闭远端、远端文件下载、只读主机列表;插件自带 Node + npx,数据留在远端 ~/.dsh) | DSH plugin: use a remote DSH over SSH inside your local DSH (host switcher, full-window UI, connect progress and log, remote restart/stop, remote file downloads, read-only host list; plugin-managed Node + npx, data stays in the remote ~/.dsh)",
5
5
  "keywords": [
6
6
  "deepseek",
7
7
  "harness",
8
8
  "dsh",
9
9
  "dsh-plugin",
10
10
  "remote",
11
- "ssh"
11
+ "ssh",
12
+ "remote-development"
12
13
  ],
13
14
  "license": "MIT",
14
15
  "author": "Solaris136",
@@ -20,8 +21,81 @@
20
21
  "type": "git",
21
22
  "url": "git+https://github.com/Solaris136/dsh-remote-go.git"
22
23
  },
24
+ "type": "module",
25
+ "packageManager": "pnpm@11.28.9",
26
+ "engines": {
27
+ "dsh": ">=0.2.2-rc.3",
28
+ "node": ">=24"
29
+ },
30
+ "sideEffects": [
31
+ "./client.js"
32
+ ],
33
+ "exports": {
34
+ ".": "./index.js",
35
+ "./client": "./client.js",
36
+ "./locale/*.json": "./locale/*.json",
37
+ "./package.json": "./package.json"
38
+ },
39
+ "files": [
40
+ "index.js",
41
+ "client.js",
42
+ "src",
43
+ "vendor/ssh2.bundle.cjs",
44
+ "vendor/THIRD_PARTY_NOTICES.md",
45
+ "locale",
46
+ "cordis.patch.yml",
47
+ "README.md",
48
+ "LICENSE"
49
+ ],
50
+ "dsh": {
51
+ "bundle": {
52
+ "patch": "./cordis.patch.yml"
53
+ },
54
+ "client": {
55
+ "platform": "web",
56
+ "immediately": true,
57
+ "inject": [
58
+ "@deepseek-ai/dsh-client-ui-layout",
59
+ "@deepseek-ai/dsh-client-locale"
60
+ ]
61
+ }
62
+ },
23
63
  "publishConfig": {
24
64
  "access": "public",
25
65
  "registry": "https://registry.npmjs.org/"
66
+ },
67
+ "dependencies": {},
68
+ "devDependencies": {
69
+ "esbuild": "^0.28.2",
70
+ "js-yaml": "^5.5.0",
71
+ "prettier": "^3.10.1",
72
+ "puppeteer-core": "^25.17.0",
73
+ "react": "^19.3.1",
74
+ "react-dom": "^19.3.1",
75
+ "ssh2": "1.17.0"
76
+ },
77
+ "scripts": {
78
+ "test": "node --test \"test/unit/*.test.js\"",
79
+ "test:unit": "node --test \"test/unit/*.test.js\"",
80
+ "test:web": "node --test \"test/integration/web.e2e.js\"",
81
+ "test:desktop": "node --test \"test/integration/desktop.e2e.js\"",
82
+ "test:integration": "node --test --test-concurrency=1 \"test/integration/*.test.js\" \"test/integration/*.e2e.js\"",
83
+ "test:integration:local": "node --test --test-concurrency=1 test/integration/sim.test.js test/integration/remote-restart.test.js test/integration/stop-remote.test.js",
84
+ "test:integration:external": "node --test --test-concurrency=1 test/integration/client-ui.test.js test/integration/remote-proxy.test.js test/integration/web.e2e.js test/integration/browser-carrier.test.js test/integration/guest-tools.e2e.js test/integration/stop-remote.browser.test.js",
85
+ "sim:remote": "node e2e/sim/simulated-remote.mjs --self-test",
86
+ "test:coverage": "node scripts/check-coverage.mjs",
87
+ "lint": "node scripts/check-repo.mjs",
88
+ "check:repo": "node scripts/check-repo.mjs",
89
+ "check:syntax": "node scripts/check-syntax.mjs",
90
+ "check:workflows": "node scripts/check-workflows.mjs",
91
+ "check:pr-title": "node scripts/check-pr-title.mjs",
92
+ "format": "prettier --write .",
93
+ "format:check": "prettier --check .",
94
+ "gate": "node scripts/check-repo.mjs && prettier --check . && node scripts/check-syntax.mjs && node scripts/check-workflows.mjs && node scripts/pack-check.mjs && node scripts/check-coverage.mjs",
95
+ "verify": "node scripts/check-repo.mjs && prettier --check . && node scripts/check-syntax.mjs && node scripts/check-workflows.mjs && node scripts/pack-check.mjs && node scripts/check-coverage.mjs && node --test --test-concurrency=1 \"test/integration/*.test.js\" \"test/integration/*.e2e.js\"",
96
+ "build:vendor": "node scripts/build-vendor.mjs",
97
+ "pack:check": "node scripts/pack-check.mjs",
98
+ "pack:check:tarball": "node scripts/pack-check.mjs --find artifacts",
99
+ "prepack": "node scripts/build-vendor.mjs && git diff --exit-code -- vendor/"
26
100
  }
27
101
  }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * DSH's own admission for the routes this plugin serves.
3
+ *
4
+ * The kernel decides whether a request may reach a Host feature at all: its `Host`/`Origin` fence
5
+ * plus browser authentication against a live Peer (`ctx.connection.requestRejection`). This module
6
+ * is the one place that turns that service into a per-request function, so the local API and the
7
+ * same-origin proxy share the gate and both failure modes stay testable.
8
+ */
9
+
10
+ /**
11
+ * Build the admission gate for one plugin activation.
12
+ *
13
+ * `connection` is optional and has to be read through `ctx.get`: Cordis throws when a plugin reads
14
+ * a service its fiber did not inject, and an older kernel may not provide the service at all. In
15
+ * both cases the gate returns `undefined`, which hands the request to the caller's own fence
16
+ * instead of going dark. A gate that throws while judging a request returns `500` — failing closed,
17
+ * because a check that cannot decide must never admit.
18
+ *
19
+ * @param {object} ctx - plugin context; only `ctx.get` is read, and it may be missing in tests.
20
+ * @param {{ warn?: (...args: any[]) => void }} [logger]
21
+ * @returns {(req: { headers: object }) => (number | undefined)} rejection status, or undefined to admit.
22
+ */
23
+ export function createAdmission(ctx, logger = console) {
24
+ const warn = typeof logger.warn === 'function' ? logger.warn.bind(logger) : () => {}
25
+
26
+ return (req) => {
27
+ let connection = null
28
+ try {
29
+ connection = typeof ctx?.get === 'function' ? ctx.get('connection') : null
30
+ } catch (error) {
31
+ // A failed lookup says nothing about this request, so the caller's own fence decides it.
32
+ warn('[dsh-remote-go] DSH connection lookup failed; the local fence stays the only gate:', error)
33
+ return undefined
34
+ }
35
+ if (!connection || typeof connection.requestRejection !== 'function') return undefined
36
+ try {
37
+ return connection.requestRejection(req)
38
+ } catch (error) {
39
+ warn('[dsh-remote-go] DSH connection admission failed; rejecting the request:', error)
40
+ return 500
41
+ }
42
+ }
43
+ }