dsh-over-ssh 0.1.0 → 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 (250) hide show
  1. package/README.md +19 -17
  2. package/agents/agent-manifest.json +6 -6
  3. package/agents/linux-amd64/dsh-over-ssh-agent +0 -0
  4. package/agents/linux-arm64/dsh-over-ssh-agent +0 -0
  5. package/lib/client.js +422 -337
  6. package/lib/file-references.js +92 -35
  7. package/lib/fs.js +295 -113
  8. package/lib/index.js +6912 -4330
  9. package/lib/terminal-wrapper.js +9 -4
  10. package/lib/types/src/config.d.ts +156 -9
  11. package/lib/types/src/file-references.d.ts +0 -1
  12. package/lib/types/src/host/app/backend.d.ts +44 -3
  13. package/lib/types/src/host/app/recycle-bin/recycle-bin-contract.d.ts +0 -1
  14. package/lib/types/src/host/app/recycle-bin/recycle-bin-service.d.ts +0 -1
  15. package/lib/types/src/host/app/session-admin/session-admin-contract.d.ts +12 -1
  16. package/lib/types/src/host/app/session-admin/session-admin-service.d.ts +0 -1
  17. package/lib/types/src/host/app/transport/transport-selector.d.ts +0 -1
  18. package/lib/types/src/host/app/transport/transport-service.d.ts +0 -1
  19. package/lib/types/src/host/domain/capability.d.ts +0 -1
  20. package/lib/types/src/host/domain/errors.d.ts +0 -1
  21. package/lib/types/src/host/domain/roots/connection.d.ts +0 -1
  22. package/lib/types/src/host/domain/roots/root.d.ts +24 -9
  23. package/lib/types/src/host/domain/roots/session-roots.d.ts +23 -1
  24. package/lib/types/src/host/domain/roots/ssh-config.d.ts +0 -1
  25. package/lib/types/src/host/domain/session/session-admin.d.ts +0 -1
  26. package/lib/types/src/host/domain/transfer/recycle-bin.d.ts +0 -1
  27. package/lib/types/src/host/domain/transfer/transfer.d.ts +0 -1
  28. package/lib/types/src/host/infra/transport/agent/agent-installer.d.ts +0 -1
  29. package/lib/types/src/host/infra/transport/forward.d.ts +75 -0
  30. package/lib/types/src/host/infra/transport/ssh/ssh2-transport.d.ts +5 -1
  31. package/lib/types/src/host/infra/transport/transport-base.d.ts +0 -1
  32. package/lib/types/src/host/infra/transport/transport.d.ts +42 -2
  33. package/lib/types/src/host/integration/agent/agent-preflight.d.ts +0 -1
  34. package/lib/types/src/host/integration/fs/file-reference-provider.d.ts +0 -1
  35. package/lib/types/src/host/integration/fs/fs-provider.d.ts +18 -3
  36. package/lib/types/src/host/integration/transfer/transfer-service.d.ts +0 -1
  37. package/lib/types/src/index.d.ts +23 -1
  38. package/lib/types/src/local-bridge-refs.d.ts +0 -1
  39. package/lib/types/src/local-bridge.d.ts +0 -1
  40. package/lib/types/src/shared/root-keys.d.ts +120 -0
  41. package/lib/types/src/wiring/helpers.d.ts +0 -1
  42. package/package.json +5 -3
  43. package/lib/types/src/client/controls.d.ts +0 -131
  44. package/lib/types/src/client/core/card-focus-trap.d.ts +0 -45
  45. package/lib/types/src/client/core/controls.d.ts +0 -164
  46. package/lib/types/src/client/core/latest.d.ts +0 -48
  47. package/lib/types/src/client/core/locale.d.ts +0 -38
  48. package/lib/types/src/client/core/message.d.ts +0 -37
  49. package/lib/types/src/client/core/panel-model.d.ts +0 -134
  50. package/lib/types/src/client/core/portal.d.ts +0 -266
  51. package/lib/types/src/client/core/remote.d.ts +0 -84
  52. package/lib/types/src/client/core/styles.d.ts +0 -458
  53. package/lib/types/src/client/file-tree-io.d.ts +0 -19
  54. package/lib/types/src/client/file-tree.d.ts +0 -271
  55. package/lib/types/src/client/flows/directory-browser.d.ts +0 -587
  56. package/lib/types/src/client/flows/session-directory.d.ts +0 -415
  57. package/lib/types/src/client/flows/workspace-directory-flow.d.ts +0 -480
  58. package/lib/types/src/client/locale.d.ts +0 -31
  59. package/lib/types/src/client/panel-model.d.ts +0 -37
  60. package/lib/types/src/client/panel.d.ts +0 -77
  61. package/lib/types/src/client/roots/connection-test.d.ts +0 -69
  62. package/lib/types/src/client/roots/roots-panel-state.d.ts +0 -307
  63. package/lib/types/src/client/roots/roots-panel-view.d.ts +0 -280
  64. package/lib/types/src/client/roots/roots-panel.d.ts +0 -364
  65. package/lib/types/src/client/roots/transfer-panel-view.d.ts +0 -35
  66. package/lib/types/src/client/roots/transfer-panel.d.ts +0 -241
  67. package/lib/types/src/client/roots/transfer-progress.d.ts +0 -67
  68. package/lib/types/src/client/roots-panel-view.d.ts +0 -236
  69. package/lib/types/src/client/roots-panel.d.ts +0 -347
  70. package/lib/types/src/client/session/session-panel-view.d.ts +0 -336
  71. package/lib/types/src/client/session/session-panel.d.ts +0 -322
  72. package/lib/types/src/client/session/session-remote-mark.d.ts +0 -110
  73. package/lib/types/src/client/session/session-row-actions.d.ts +0 -398
  74. package/lib/types/src/client/session-panel.d.ts +0 -152
  75. package/lib/types/src/client/styles.d.ts +0 -252
  76. package/lib/types/src/client/workspace-directory-flow.d.ts +0 -342
  77. package/lib/types/src/fs.d.ts +0 -46
  78. package/lib/types/src/host/app/recycle-bin/recycle-bin-move.d.ts +0 -18
  79. package/lib/types/src/host/app/recycle-bin/recycle-bin-world.d.ts +0 -38
  80. package/lib/types/src/host/app/recycle-bin-contract.d.ts +0 -215
  81. package/lib/types/src/host/app/recycle-bin-move.d.ts +0 -18
  82. package/lib/types/src/host/app/recycle-bin-service.d.ts +0 -45
  83. package/lib/types/src/host/app/recycle-bin-world.d.ts +0 -35
  84. package/lib/types/src/host/app/roots/roots-api-connections.d.ts +0 -49
  85. package/lib/types/src/host/app/roots/roots-api-contract.d.ts +0 -369
  86. package/lib/types/src/host/app/roots/roots-api-directories.d.ts +0 -13
  87. package/lib/types/src/host/app/roots/roots-api-http.d.ts +0 -77
  88. package/lib/types/src/host/app/roots/roots-api-long-poll.d.ts +0 -130
  89. package/lib/types/src/host/app/roots/roots-api-projections.d.ts +0 -102
  90. package/lib/types/src/host/app/roots/roots-api-roots.d.ts +0 -13
  91. package/lib/types/src/host/app/roots/roots-api-state.d.ts +0 -22
  92. package/lib/types/src/host/app/roots/roots-api-transfers.d.ts +0 -26
  93. package/lib/types/src/host/app/roots/roots-api.d.ts +0 -55
  94. package/lib/types/src/host/app/roots/user-roots.d.ts +0 -552
  95. package/lib/types/src/host/app/roots-api-connections.d.ts +0 -49
  96. package/lib/types/src/host/app/roots-api-contract.d.ts +0 -339
  97. package/lib/types/src/host/app/roots-api-directories.d.ts +0 -13
  98. package/lib/types/src/host/app/roots-api-http.d.ts +0 -77
  99. package/lib/types/src/host/app/roots-api-projections.d.ts +0 -102
  100. package/lib/types/src/host/app/roots-api-roots.d.ts +0 -13
  101. package/lib/types/src/host/app/roots-api-state.d.ts +0 -22
  102. package/lib/types/src/host/app/roots-api-support.d.ts +0 -182
  103. package/lib/types/src/host/app/roots-api-transfers.d.ts +0 -13
  104. package/lib/types/src/host/app/roots-api.d.ts +0 -55
  105. package/lib/types/src/host/app/routed-fs.d.ts +0 -239
  106. package/lib/types/src/host/app/serialize.d.ts +0 -37
  107. package/lib/types/src/host/app/session-admin/session-admin-context.d.ts +0 -36
  108. package/lib/types/src/host/app/session-admin/session-admin-delete.d.ts +0 -34
  109. package/lib/types/src/host/app/session-admin-context.d.ts +0 -36
  110. package/lib/types/src/host/app/session-admin-contract.d.ts +0 -214
  111. package/lib/types/src/host/app/session-admin-delete.d.ts +0 -34
  112. package/lib/types/src/host/app/session-admin-service.d.ts +0 -38
  113. package/lib/types/src/host/app/takeover/takeover-plan.d.ts +0 -227
  114. package/lib/types/src/host/app/takeover/takeover-rows.d.ts +0 -55
  115. package/lib/types/src/host/app/transport-selector.d.ts +0 -98
  116. package/lib/types/src/host/app/transport-service.d.ts +0 -75
  117. package/lib/types/src/host/app/user-roots.d.ts +0 -461
  118. package/lib/types/src/host/domain/bin-location.d.ts +0 -79
  119. package/lib/types/src/host/domain/connection.d.ts +0 -95
  120. package/lib/types/src/host/domain/glob-pattern.d.ts +0 -62
  121. package/lib/types/src/host/domain/literal-text.d.ts +0 -63
  122. package/lib/types/src/host/domain/path-grammar.d.ts +0 -84
  123. package/lib/types/src/host/domain/recycle-bin.d.ts +0 -337
  124. package/lib/types/src/host/domain/root.d.ts +0 -74
  125. package/lib/types/src/host/domain/roots/bin-location.d.ts +0 -91
  126. package/lib/types/src/host/domain/roots/route-table.d.ts +0 -102
  127. package/lib/types/src/host/domain/route-table.d.ts +0 -80
  128. package/lib/types/src/host/domain/session/terminal-target.d.ts +0 -136
  129. package/lib/types/src/host/domain/session-admin.d.ts +0 -330
  130. package/lib/types/src/host/domain/shell.d.ts +0 -47
  131. package/lib/types/src/host/domain/ssh-config.d.ts +0 -73
  132. package/lib/types/src/host/domain/terminal-target.d.ts +0 -132
  133. package/lib/types/src/host/domain/tool-requests.d.ts +0 -369
  134. package/lib/types/src/host/domain/transfer.d.ts +0 -260
  135. package/lib/types/src/host/infra/backend/local-backend.d.ts +0 -84
  136. package/lib/types/src/host/infra/backend/local-version.d.ts +0 -43
  137. package/lib/types/src/host/infra/backend/platform-local-backend.d.ts +0 -89
  138. package/lib/types/src/host/infra/backend/remote-backend.d.ts +0 -239
  139. package/lib/types/src/host/infra/cache/lru.d.ts +0 -52
  140. package/lib/types/src/host/infra/cache/versioned.d.ts +0 -77
  141. package/lib/types/src/host/infra/temp-name.d.ts +0 -19
  142. package/lib/types/src/host/infra/transport/agent/agent-protocol-client.d.ts +0 -132
  143. package/lib/types/src/host/infra/transport/agent/agent-protocol-codec.d.ts +0 -140
  144. package/lib/types/src/host/infra/transport/agent/agent-protocol-errors.d.ts +0 -41
  145. package/lib/types/src/host/infra/transport/agent/agent-protocol-frames.d.ts +0 -197
  146. package/lib/types/src/host/infra/transport/agent/agent-protocol-types.d.ts +0 -564
  147. package/lib/types/src/host/infra/transport/agent/agent-transport.d.ts +0 -418
  148. package/lib/types/src/host/infra/transport/agent-installer.d.ts +0 -121
  149. package/lib/types/src/host/infra/transport/agent-protocol-client.d.ts +0 -123
  150. package/lib/types/src/host/infra/transport/agent-protocol-codec.d.ts +0 -131
  151. package/lib/types/src/host/infra/transport/agent-protocol-errors.d.ts +0 -41
  152. package/lib/types/src/host/infra/transport/agent-protocol-frames.d.ts +0 -197
  153. package/lib/types/src/host/infra/transport/agent-protocol-types.d.ts +0 -509
  154. package/lib/types/src/host/infra/transport/agent-transport.d.ts +0 -353
  155. package/lib/types/src/host/infra/transport/alias-transport.d.ts +0 -206
  156. package/lib/types/src/host/infra/transport/askpass-fs.d.ts +0 -20
  157. package/lib/types/src/host/infra/transport/askpass.d.ts +0 -133
  158. package/lib/types/src/host/infra/transport/command-pool.d.ts +0 -61
  159. package/lib/types/src/host/infra/transport/fs-commands.d.ts +0 -140
  160. package/lib/types/src/host/infra/transport/git-status-route.d.ts +0 -63
  161. package/lib/types/src/host/infra/transport/git-status.d.ts +0 -101
  162. package/lib/types/src/host/infra/transport/node-spawn.d.ts +0 -26
  163. package/lib/types/src/host/infra/transport/session-window.d.ts +0 -51
  164. package/lib/types/src/host/infra/transport/shell-quote.d.ts +0 -59
  165. package/lib/types/src/host/infra/transport/ssh/alias-transport.d.ts +0 -206
  166. package/lib/types/src/host/infra/transport/ssh/askpass-fs.d.ts +0 -20
  167. package/lib/types/src/host/infra/transport/ssh/askpass.d.ts +0 -133
  168. package/lib/types/src/host/infra/transport/ssh/shell-quote.d.ts +0 -62
  169. package/lib/types/src/host/infra/transport/ssh/ssh-argv.d.ts +0 -43
  170. package/lib/types/src/host/infra/transport/ssh-argv.d.ts +0 -43
  171. package/lib/types/src/host/infra/transport/ssh2-transport.d.ts +0 -302
  172. package/lib/types/src/host/integration/agent/agent-install-io.d.ts +0 -33
  173. package/lib/types/src/host/integration/agent/askpass-registry.d.ts +0 -66
  174. package/lib/types/src/host/integration/agent-install-io.d.ts +0 -33
  175. package/lib/types/src/host/integration/agent-preflight.d.ts +0 -56
  176. package/lib/types/src/host/integration/anchor-directory.d.ts +0 -56
  177. package/lib/types/src/host/integration/askpass-registry.d.ts +0 -59
  178. package/lib/types/src/host/integration/bin-root-resolver.d.ts +0 -81
  179. package/lib/types/src/host/integration/connection-test.d.ts +0 -73
  180. package/lib/types/src/host/integration/file-reference-provider.d.ts +0 -115
  181. package/lib/types/src/host/integration/fs/git-status-wiring.d.ts +0 -21
  182. package/lib/types/src/host/integration/fs/platform-errors.d.ts +0 -94
  183. package/lib/types/src/host/integration/fs/remote-file-tools.d.ts +0 -369
  184. package/lib/types/src/host/integration/fs/remote-index.d.ts +0 -177
  185. package/lib/types/src/host/integration/fs-provider.d.ts +0 -226
  186. package/lib/types/src/host/integration/lsp/lsp-framing.d.ts +0 -38
  187. package/lib/types/src/host/integration/lsp/lsp-registry.d.ts +0 -67
  188. package/lib/types/src/host/integration/lsp/lsp-session.d.ts +0 -130
  189. package/lib/types/src/host/integration/management-tools.d.ts +0 -64
  190. package/lib/types/src/host/integration/recycle-bin-service.d.ts +0 -247
  191. package/lib/types/src/host/integration/remote/connection-test.d.ts +0 -73
  192. package/lib/types/src/host/integration/remote/remote-face.d.ts +0 -127
  193. package/lib/types/src/host/integration/remote/remote-tool-backend.d.ts +0 -108
  194. package/lib/types/src/host/integration/remote-face.d.ts +0 -127
  195. package/lib/types/src/host/integration/remote-file-tools.d.ts +0 -241
  196. package/lib/types/src/host/integration/remote-home.d.ts +0 -69
  197. package/lib/types/src/host/integration/remote-index.d.ts +0 -165
  198. package/lib/types/src/host/integration/remote-job-tools.d.ts +0 -295
  199. package/lib/types/src/host/integration/remote-tool-backend.d.ts +0 -97
  200. package/lib/types/src/host/integration/remote-tools.d.ts +0 -206
  201. package/lib/types/src/host/integration/root-registry.d.ts +0 -115
  202. package/lib/types/src/host/integration/roots/anchor-directory.d.ts +0 -56
  203. package/lib/types/src/host/integration/roots/bin-root-resolver.d.ts +0 -81
  204. package/lib/types/src/host/integration/roots/remote-home.d.ts +0 -69
  205. package/lib/types/src/host/integration/roots/root-registry.d.ts +0 -144
  206. package/lib/types/src/host/integration/roots/roots-wiring.d.ts +0 -219
  207. package/lib/types/src/host/integration/roots/session-root-index.d.ts +0 -52
  208. package/lib/types/src/host/integration/roots-api.d.ts +0 -407
  209. package/lib/types/src/host/integration/roots-wiring.d.ts +0 -211
  210. package/lib/types/src/host/integration/session/session-api.d.ts +0 -88
  211. package/lib/types/src/host/integration/session/session-bin-lock.d.ts +0 -80
  212. package/lib/types/src/host/integration/session/session-header.d.ts +0 -151
  213. package/lib/types/src/host/integration/session/session-labels.d.ts +0 -56
  214. package/lib/types/src/host/integration/session/session-route-wiring.d.ts +0 -50
  215. package/lib/types/src/host/integration/session-admin-service.d.ts +0 -236
  216. package/lib/types/src/host/integration/session-api.d.ts +0 -81
  217. package/lib/types/src/host/integration/session-bin-lock.d.ts +0 -80
  218. package/lib/types/src/host/integration/session-header.d.ts +0 -118
  219. package/lib/types/src/host/integration/session-labels.d.ts +0 -56
  220. package/lib/types/src/host/integration/session-route-wiring.d.ts +0 -50
  221. package/lib/types/src/host/integration/session-scope.d.ts +0 -113
  222. package/lib/types/src/host/integration/session-tools.d.ts +0 -44
  223. package/lib/types/src/host/integration/strict-arguments.d.ts +0 -79
  224. package/lib/types/src/host/integration/takeover/takeover-api.d.ts +0 -62
  225. package/lib/types/src/host/integration/takeover/takeover-route-wiring.d.ts +0 -60
  226. package/lib/types/src/host/integration/takeover/takeover-service.d.ts +0 -167
  227. package/lib/types/src/host/integration/terminal-manifest.d.ts +0 -94
  228. package/lib/types/src/host/integration/tools/management-tools.d.ts +0 -245
  229. package/lib/types/src/host/integration/tools/remote-job-tools.d.ts +0 -316
  230. package/lib/types/src/host/integration/tools/remote-lsp-tools.d.ts +0 -43
  231. package/lib/types/src/host/integration/tools/remote-tools.d.ts +0 -236
  232. package/lib/types/src/host/integration/tools/session-target.d.ts +0 -52
  233. package/lib/types/src/host/integration/tools/session-tools.d.ts +0 -46
  234. package/lib/types/src/host/integration/tools/strict-arguments.d.ts +0 -79
  235. package/lib/types/src/host/integration/tools/terminal-manifest.d.ts +0 -94
  236. package/lib/types/src/host/integration/transfer/remote-copy.d.ts +0 -66
  237. package/lib/types/src/host/integration/transfer/transfer-adapters.d.ts +0 -48
  238. package/lib/types/src/host/integration/transfer/transfer-tracker.d.ts +0 -106
  239. package/lib/types/src/host/integration/transfer-adapters.d.ts +0 -44
  240. package/lib/types/src/host/integration/transfer-service.d.ts +0 -164
  241. package/lib/types/src/host/integration/transfer-tracker.d.ts +0 -106
  242. package/lib/types/src/host/integration/user-roots.d.ts +0 -461
  243. package/lib/types/src/wiring/connections.d.ts +0 -189
  244. package/lib/types/src/wiring/fs.d.ts +0 -13
  245. package/lib/types/src/wiring/install-memo.d.ts +0 -32
  246. package/lib/types/src/wiring/legacy-dirs.d.ts +0 -62
  247. package/lib/types/src/wiring/package-paths.d.ts +0 -35
  248. package/lib/types/src/wiring/roots.d.ts +0 -21
  249. package/lib/types/src/wiring/state-dir.d.ts +0 -29
  250. package/lib/types/src/wiring/tools.d.ts +0 -35
@@ -1,81 +0,0 @@
1
- /**
2
- * Decide, per root, where its file-level recycle bin lives — and make that place resolvable.
3
- *
4
- * The bin must sit **outside** the caller's repository (a "safe delete" that pollutes `git status` is not safe),
5
- * yet it must be reachable by the router, which only resolves paths inside a registered root (ADR-0011). So the
6
- * bin directory is registered as a **hidden root**: routable, but absent from `RootRegistry.records` and
7
- * therefore from every user-facing list.
8
- *
9
- * This module owns the one decision that cannot be pure — *is the chosen directory usable?* — and it answers by
10
- * measuring rather than assuming: the bin's parent must exist and must be on the **same device** as the root,
11
- * because a cross-device `rename` is refused outright and the file-level bin has no copy fallback
12
- * (`fs-commands.ts`, `recycle-bin-service.ts`). If a measurement fails, the bin stays inside the root — the old
13
- * behaviour — and the reason is recorded, so a fallback is **visible** rather than silent.
14
- *
15
- * @module dsh-remote-workspace/integration/bin-root-resolver
16
- */
17
- import { type RootRef } from '../domain/root.ts';
18
- import type { RootRecord } from './root-registry.ts';
19
- /** Where one root's bin ended up, and why. */
20
- export interface BinRootChoice {
21
- /** Absolute bin directory. */
22
- readonly binRoot: string;
23
- /** `beside` = outside the repository (the goal); `inside` = the documented fallback. */
24
- readonly placement: 'beside' | 'inside';
25
- /** Whether a hidden root was registered for it (only for `beside`). */
26
- readonly hidden: boolean;
27
- /** Human-readable reason for a fallback, or for an inconclusive measurement. */
28
- note?: string;
29
- }
30
- /** What the resolver needs from its owner. */
31
- export interface BinRootResolverDeps {
32
- /** Register a hidden root; returns the record. */
33
- readonly addHiddenRoot: (root: RootRef) => RootRecord;
34
- /** Drop a hidden root by key; used when a migration fails and the new location is abandoned. */
35
- readonly removeHiddenRoot?: (key: string) => void;
36
- /** The configured bin directory name (`limits.binDir`). */
37
- readonly binDir: string;
38
- /**
39
- * Whether two paths are on the same device.
40
- *
41
- * `undefined` means **unknown**, and unknown is treated as *usable*: refusing to move a file into the bin is
42
- * worse than putting the bin in an untidy place, and a transport without a working `stat` cannot answer.
43
- */
44
- readonly sameDevice: (root: RootRef, left: string, right: string) => Promise<boolean | undefined>;
45
- /** Whether a directory exists. */
46
- readonly exists: (root: RootRef, path: string) => Promise<boolean>;
47
- /**
48
- * Move a directory, creating the destination's parents.
49
- *
50
- * Only ever called for the **old bin → new bin** migration, where the two are on one device (already
51
- * measured), so a plain `rename` is the whole implementation.
52
- */
53
- readonly moveDirectory: (root: RootRef, from: string, to: string) => Promise<void>;
54
- }
55
- /** The resolver handed to the recycle-bin wiring. */
56
- export interface BinRootResolver {
57
- /**
58
- * The bin directory for one root, registering a hidden root on first use.
59
- *
60
- * Synchronous by contract: the bin service asks repeatedly and cannot await (`binRootFor`). The measurement
61
- * therefore happens in {@link BinRootResolver.prepare}, which the composition calls when a root is registered.
62
- *
63
- * @param root - the root being served.
64
- * @returns its bin directory.
65
- */
66
- binRootFor: (root: RootRef) => string;
67
- /** Measure and register a root's bin placement; call this when the root is added. */
68
- prepare: (root: RootRef) => Promise<BinRootChoice>;
69
- /** The choice made for one root, if any (for diagnostics). */
70
- choiceFor: (root: RootRef) => BinRootChoice | undefined;
71
- /** Drop one root's cached choice (its root was removed, or its connection changed). */
72
- forget: (key: string) => void;
73
- }
74
- /**
75
- * Build the resolver.
76
- *
77
- * @param deps - injected registration, configuration and measurement seams.
78
- * @returns the resolver.
79
- */
80
- export declare function createBinRootResolver(deps: BinRootResolverDeps): BinRootResolver;
81
- //# sourceMappingURL=bin-root-resolver.d.ts.map
@@ -1,73 +0,0 @@
1
- /**
2
- * The connectivity probe behind the panel's 「测试」 button.
3
- *
4
- * What "testing a connection" means here, and why it is a real connection rather than a TCP ping:
5
- *
6
- * - it goes through the **same transport service** the rest of the plugin uses, so it answers the only question
7
- * that matters to the user - "would a remote operation work right now" - including the transport the
8
- * selector picked and whether that pick was a degradation;
9
- * - the last step is an actual command round-trip (`printf`), so a host that accepts TCP but has no usable
10
- * shell (or a transport that cannot execute) is reported as a failure, not as a success;
11
- * - the probe **warms the connection** the caller will use next, because `acquire` is memoized per connection.
12
- *
13
- * Everything it needs is injected (红线 3: 外部依赖走注入), so the whole classification is testable without a
14
- * server, and the entry is the only place that knows about profiles.
15
- *
16
- * @module dsh-remote-workspace/integration/connection-test
17
- */
18
- /** The slice of `Transport` the probe uses. Narrow on purpose: the probe must not be able to do more. */
19
- export interface ProbeTransport {
20
- readonly id: string;
21
- connect(signal?: AbortSignal): Promise<void>;
22
- exec(request: {
23
- readonly argv: readonly string[];
24
- readonly maxBytes?: number;
25
- }, signal?: AbortSignal): Promise<{
26
- readonly exitCode: number;
27
- readonly stdout: string;
28
- }>;
29
- }
30
- /** One acquisition: the transport plus the decision that produced it. */
31
- export interface ProbeAcquisition {
32
- readonly transport: ProbeTransport;
33
- readonly decision: {
34
- readonly kind: string;
35
- readonly degradations?: readonly {
36
- readonly code: string;
37
- }[];
38
- };
39
- }
40
- /** What the probe needs. */
41
- export interface ConnectionProbeDeps {
42
- /** Acquire (and, on first use, connect) the connection's transport. Rejects with `CONNECTION_NOT_FOUND` for an unknown id. */
43
- readonly acquire: (connectionId: string) => Promise<ProbeAcquisition>;
44
- /** Budget for the whole probe; each transport keeps its own timeouts on top of it. */
45
- readonly timeoutMs?: number;
46
- /** Clock, injected so a test can assert the reported milliseconds. */
47
- readonly now?: () => number;
48
- }
49
- /** The wire answer: success carries the facts the row shows, failure carries a reason it can print. */
50
- export type ConnectionProbeResult = {
51
- readonly ok: true;
52
- readonly transport: string;
53
- readonly degraded: boolean;
54
- readonly degradation?: string;
55
- readonly ms: number;
56
- } | {
57
- readonly ok: false;
58
- readonly code: string;
59
- readonly message: string;
60
- readonly ms: number;
61
- };
62
- /**
63
- * Probe one connection.
64
- *
65
- * Never throws: a refused or broken connection is a **result** the panel prints, because a button that rejects
66
- * leaves the user with nothing to read.
67
- *
68
- * @param connectionId - the connection to test.
69
- * @param deps - the injected acquisition, clock and budget.
70
- * @returns the outcome, with the elapsed milliseconds either way.
71
- */
72
- export declare function probeConnection(connectionId: string, deps: ConnectionProbeDeps): Promise<ConnectionProbeResult>;
73
- //# sourceMappingURL=connection-test.d.ts.map
@@ -1,115 +0,0 @@
1
- /**
2
- * Multi-root implementation of the core `ctx.fileReferences` seam.
3
- *
4
- * The core ships [`@deepseek-ai/dsh-file-reference-local`] for **one** local workspace. This plugin's whole
5
- * point is several roots of two kinds, so this provider answers the same contract for both:
6
- *
7
- * - a **remote** root is enumerated by {@link RemoteIndex} (Tier 2 `index.scan` when the connection has an
8
- * agent, else one bounded `find`/`git ls-files`), cached per root;
9
- * - a **local** root is enumerated here with a bounded walk, because installing this provider **replaces**
10
- * the core's local one — returning nothing for local agents would be a regression, not a feature.
11
- *
12
- * Candidate paths use the router's display spelling (`ssh://<connection>/abs` for remote roots) so a token
13
- * stays unambiguous in a multi-root workspace; the local case keeps ordinary host paths.
14
- *
15
- * @module dsh-remote-workspace/integration/file-reference-provider
16
- */
17
- import { Context } from '@deepseek-ai/cordis';
18
- import FileReferenceService, { type FileReferenceCandidate } from '@deepseek-ai/dsh-file-reference';
19
- import type { Agent } from '@deepseek-ai/dsh-agent';
20
- /** What the provider needs from the index layer (provided as `ctx.sshDevIndex`). */
21
- export interface FileReferenceIndex {
22
- /**
23
- * Rank candidates for a partially typed `@` query inside one remote root.
24
- *
25
- * @param connectionId - connection that owns the root.
26
- * @param root - backend-absolute remote root path.
27
- * @param query - text after `@`.
28
- * @param signal - caller cancellation.
29
- * @returns ranked candidates whose `path` is a router-resolvable spelling
30
- * (`ssh://<connection>/abs`), so a token stays unambiguous across roots.
31
- */
32
- complete(connectionId: string, root: string, query: string, signal: AbortSignal): Promise<readonly FileReferenceCandidate[]>;
33
- }
34
- declare module '@deepseek-ai/cordis' {
35
- interface Context {
36
- /** Remote index used by the file-reference provider. */
37
- sshDevIndex: FileReferenceIndex;
38
- }
39
- }
40
- /** Directory names never traversed by the local walk (same intent as the core's exclusion list). */
41
- export declare const LOCAL_EXCLUDED_DIRECTORIES: readonly string[];
42
- /** Default cap for the local walk; the core uses a comparable bound for its own index. */
43
- export declare const LOCAL_MAX_ENTRIES = 20000;
44
- /** How deep the local walk may go before it gives up (protects against pathological trees). */
45
- export declare const LOCAL_MAX_DEPTH = 12;
46
- /**
47
- * How long a local enumeration may be reused before the tree is walked again.
48
- *
49
- * **Short on purpose, and much shorter than the remote branch's 30 s** (`RemoteIndex` `ttlMs`). That cache
50
- * exists to avoid a *network round trip*; this one exists only to collapse **one typing burst** into a single
51
- * walk. A burst is a few keystrokes a couple of hundred milliseconds apart, so a quarter second folds the
52
- * whole burst while keeping staleness below the threshold where a user could notice — creating a file and
53
- * typing `@` again within 250 ms is not something a person does.
54
- *
55
- * The failure mode is deliberately the cheap one: a miss costs a walk, i.e. exactly today's behaviour, so
56
- * this can never be *slower* than not caching, only less fresh for at most this long.
57
- *
58
- * Measured (`.verify/probe-local-fref-cache.ts`, 10 000-entry tree): typing `@module` walked the whole tree
59
- * **6 times** and cost 413 ms; the walk is ~68 ms each, and it is paid per keystroke, on the host's event loop.
60
- */
61
- export declare const LOCAL_CACHE_TTL_MS = 250;
62
- /**
63
- * Cap for the local enumeration cache.
64
- *
65
- * Keys are registry root paths, so the set is bounded by how many roots the user registered — but it is
66
- * capped anyway, for the same reason `RemoteIndex` bounds its own caches: a bound that depends on "the
67
- * caller will not do that" is not a bound.
68
- */
69
- export declare const LOCAL_MAX_CACHED_ROOTS = 8;
70
- /** How many candidates one query returns (the core's local provider uses the same order of magnitude). */
71
- export declare const DEFAULT_MAX_RESULTS = 50;
72
- /** One locally enumerated entry, with the kind completion needs. */
73
- export interface LocalEntry {
74
- readonly path: string;
75
- readonly kind: 'file' | 'directory';
76
- }
77
- /** Construction options; `walk` is injected so tests never touch a real filesystem. */
78
- export interface RemoteFileReferenceOptions {
79
- /** Maximum entries collected in one local walk. Default {@link LOCAL_MAX_ENTRIES}. */
80
- readonly maxEntries?: number;
81
- /** Maximum depth of the local walk. Default {@link LOCAL_MAX_DEPTH}. */
82
- readonly maxDepth?: number;
83
- /** Maximum candidates returned per query. Default {@link DEFAULT_MAX_RESULTS}. */
84
- readonly maxResults?: number;
85
- /** Local enumerator, injected for tests. Defaults to a real bounded `readdir` walk. */
86
- readonly walk?: (root: string, signal: AbortSignal) => Promise<readonly LocalEntry[]>;
87
- /** How long a local enumeration stays reusable. Default {@link LOCAL_CACHE_TTL_MS}. */
88
- readonly localTtlMs?: number;
89
- /** Cap for the local enumeration cache. Default {@link LOCAL_MAX_CACHED_ROOTS}. */
90
- readonly maxCachedRoots?: number;
91
- /** Injectable clock, so the TTL is testable without sleeping. */
92
- readonly now?: () => number;
93
- }
94
- /**
95
- * The provider.
96
- *
97
- * Lifecycle note: it is registered as a **separate module** (`dsh-remote-workspace/file-references`) so the
98
- * composition decides whether to replace the core's local service — enabling it is an explicit choice.
99
- */
100
- export declare class RemoteFileReferenceService extends FileReferenceService {
101
- #private;
102
- static inject: string[];
103
- constructor(ctx: Context, options?: RemoteFileReferenceOptions);
104
- /**
105
- * List candidates for one agent's working directory.
106
- *
107
- * @param agent - target agent; its session cwd decides which root answers.
108
- * @param query - text after `@` (may be empty: "show the shallowest entries").
109
- * @param signal - caller cancellation.
110
- * @returns ranked candidates, best first; empty when the cwd is outside every registered root.
111
- */
112
- list(agent: Agent, query: string, signal: AbortSignal): Promise<FileReferenceCandidate[]>;
113
- }
114
- export default RemoteFileReferenceService;
115
- //# sourceMappingURL=file-reference-provider.d.ts.map
@@ -1,21 +0,0 @@
1
- /**
2
- * Compose remote git status from the services the main entry already publishes.
3
- *
4
- * This is the only glue the fs entry needs: the cache/route live in `infra/transport` (they are HTTP/data-plane
5
- * concerns), while *where a connection's transport comes from* and *which root covers a path* are facts of this
6
- * plugin's composition. Keeping the glue here (rather than in the main entry's wiring) means the `./fs` row is
7
- * self-contained: enabling it is enough for the browser's badge route to appear, with no second wiring edit.
8
- *
9
- * Everything is read through `ctx.get` at call time, not captured at activation: the fs row may activate before
10
- * a later composition layer provides `webServer`, and the transport service installs its entries lazily.
11
- *
12
- * @module dsh-over-ssh/integration/fs/git-status-wiring
13
- */
14
- import type { Context } from '@deepseek-ai/cordis';
15
- /**
16
- * Wire the badge route onto this composition (no-op when the needed services are absent).
17
- *
18
- * @param ctx - the `./fs` plugin context (it sees the main entry's services at root scope).
19
- */
20
- export declare function wireGitStatus(ctx: Context): void;
21
- //# sourceMappingURL=git-status-wiring.d.ts.map
@@ -1,94 +0,0 @@
1
- /**
2
- * Build filesystem errors with **the host's own `FsError` class**, not ours.
3
- *
4
- * Why this exists: this plugin and the harness each resolve their own copy of `@deepseek-ai/dsh-fs`
5
- * (`dsh-over-ssh/node_modules/…` versus `…/dsh/node_modules/…`), so `new FsError(…)` here produces an
6
- * object that fails the platform's `error instanceof FsError` test. Measured consequences of that mismatch:
7
- *
8
- * - `dsh-api-session-controller/lib/index.js:2459` re-throws anything that is not an `FsError`, so serving a
9
- * missing or oversized workspace file answered **500** instead of 404/413;
10
- * - `dsh-tools/lib/index.js:2711` (`errorInfo`) reports `{ name, code }` only for its own `HarnessError`, so tool
11
- * results lost the structured code and the model saw prose only;
12
- * - `dsh-tool-fs`'s `remediateFsError` hints never matched, so "read the file first" style guidance disappeared.
13
- *
14
- * The fix cannot be an import: our specifier resolves to our copy. It can be a **runtime lookup of the host's
15
- * copy**, which is what this module does once, at startup, and then reuses for every error that crosses the
16
- * boundary. The lookup asks Node (`createRequire(<harness entry>).resolve(…)`) rather than guessing directories,
17
- * so it follows the harness wherever it is installed. When the host copy cannot be found (unit tests, a bundled deployment, a future layout) the local
18
- * class is used and behaviour is exactly what it was — the detection is an improvement, never a dependency.
19
- *
20
- * @module dsh-over-ssh/integration/fs/platform-errors
21
- */
22
- import { FsError } from '@deepseek-ai/dsh-fs';
23
- /** What one `FsError` construction needs; the third argument is the standard `{ cause }` bag. */
24
- type FsErrorConstructor = new (message: string, code: string, options?: {
25
- readonly cause?: unknown;
26
- }) => FsError;
27
- /**
28
- * Ask Node where the harness itself would resolve `@deepseek-ai/dsh-fs`.
29
- *
30
- * This is the authoritative lookup, and it is **layout-free**: `createRequire(<harness entry>)` makes Node apply
31
- * exactly the rules the harness applies when it imports the package (its `node_modules` chain, its `exports`
32
- * map). The directory candidates below only exist as a fallback for a harness whose entry is not a real file
33
- * path, because guessing a layout is what makes a fix like this rot.
34
- *
35
- * @param entryScript - `process.argv[1]`, the harness entry point.
36
- * @returns the resolved file path, or `undefined` when the harness cannot see the package.
37
- */
38
- export declare function resolveHostFsPath(entryScript: string | undefined): string | undefined;
39
- /**
40
- * Where the host's copy of `@deepseek-ai/dsh-fs` may live, given the executable that booted us.
41
- *
42
- * Only a fallback for {@link resolveHostFsPath}: used when Node cannot resolve the specifier from the entry
43
- * script (a harness booted from a virtual path, say). Kept as a pure function so a test can pin the layout
44
- * instead of the developer's machine.
45
- *
46
- * @param entryScript - `process.argv[1]`, the harness entry point.
47
- * @returns candidate file URLs, nearest first.
48
- */
49
- export declare function hostFsCandidates(entryScript: string | undefined): readonly string[];
50
- /**
51
- * Detect the host's `FsError` class once, in the background.
52
- *
53
- * Fire-and-forget on purpose: the provider is constructed synchronously during plugin load, and an error thrown
54
- * before detection finishes simply uses the local class (the pre-existing behaviour).
55
- *
56
- * @param entryScript - override for tests; defaults to `process.argv[1]`.
57
- */
58
- export declare function startHostErrorDetection(entryScript?: string | undefined): void;
59
- /**
60
- * Look for the host's `FsError` class under one entry script and adopt it when found.
61
- *
62
- * Exported so a contract test can drive the detection deterministically instead of depending on how the test
63
- * runner was invoked.
64
- *
65
- * @param entryScript - the harness entry point to search around.
66
- * @returns the adopted class, or `undefined` when no other copy exists.
67
- */
68
- export declare function detectHostFsError(entryScript: string | undefined): Promise<FsErrorConstructor | undefined>;
69
- /**
70
- * Whether an error is an `FsError` from **either** copy.
71
- *
72
- * Both copies exist in a real host (see the module note), so a bare `error instanceof FsError` is only half the
73
- * question: after detection our own boundary errors are the host's class, and the local check would no longer
74
- * recognise them — which silently re-wrapped codes that were already correct.
75
- *
76
- * @param error - anything caught.
77
- * @returns true when the error already carries an `FS_*` code from either class.
78
- */
79
- export declare function isFsError(error: unknown): boolean;
80
- /** The class boundary errors are built from: the host's when detected, ours otherwise. */
81
- export declare function activeFsErrorClass(): FsErrorConstructor;
82
- /**
83
- * Build one error for the platform boundary.
84
- *
85
- * @param message - human-readable text.
86
- * @param code - the `FS_*` code the platform maps to an HTTP status.
87
- * @param options - `{ cause }` when wrapping another error.
88
- * @returns an `FsError` the **platform's** `instanceof` accepts, whenever its class could be detected.
89
- */
90
- export declare function platformFsError(message: string, code: string, options?: {
91
- readonly cause?: unknown;
92
- }): FsError;
93
- export {};
94
- //# sourceMappingURL=platform-errors.d.ts.map