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.
Files changed (254) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -2
  3. package/agents/agent-manifest.json +20 -0
  4. package/agents/linux-amd64/dsh-over-ssh-agent +0 -0
  5. package/agents/linux-arm64/dsh-over-ssh-agent +0 -0
  6. package/cordis.patch.yml +84 -0
  7. package/lib/client.js +6611 -0
  8. package/lib/file-references.js +366 -0
  9. package/lib/fs.js +1368 -0
  10. package/lib/index.js +19034 -0
  11. package/lib/local-bridge-refs.js +16 -0
  12. package/lib/local-bridge.js +16 -0
  13. package/lib/terminal-wrapper.js +294 -0
  14. package/lib/types/src/client/controls.d.ts +131 -0
  15. package/lib/types/src/client/core/card-focus-trap.d.ts +45 -0
  16. package/lib/types/src/client/core/controls.d.ts +164 -0
  17. package/lib/types/src/client/core/latest.d.ts +48 -0
  18. package/lib/types/src/client/core/locale.d.ts +38 -0
  19. package/lib/types/src/client/core/message.d.ts +37 -0
  20. package/lib/types/src/client/core/panel-model.d.ts +134 -0
  21. package/lib/types/src/client/core/portal.d.ts +266 -0
  22. package/lib/types/src/client/core/remote.d.ts +84 -0
  23. package/lib/types/src/client/core/styles.d.ts +458 -0
  24. package/lib/types/src/client/file-tree-io.d.ts +19 -0
  25. package/lib/types/src/client/file-tree.d.ts +271 -0
  26. package/lib/types/src/client/flows/directory-browser.d.ts +587 -0
  27. package/lib/types/src/client/flows/session-directory.d.ts +415 -0
  28. package/lib/types/src/client/flows/workspace-directory-flow.d.ts +480 -0
  29. package/lib/types/src/client/index.d.ts +49 -0
  30. package/lib/types/src/client/locale.d.ts +31 -0
  31. package/lib/types/src/client/panel-model.d.ts +37 -0
  32. package/lib/types/src/client/panel.d.ts +77 -0
  33. package/lib/types/src/client/roots/connection-test.d.ts +69 -0
  34. package/lib/types/src/client/roots/roots-panel-state.d.ts +307 -0
  35. package/lib/types/src/client/roots/roots-panel-view.d.ts +280 -0
  36. package/lib/types/src/client/roots/roots-panel.d.ts +364 -0
  37. package/lib/types/src/client/roots/transfer-panel-view.d.ts +35 -0
  38. package/lib/types/src/client/roots/transfer-panel.d.ts +241 -0
  39. package/lib/types/src/client/roots/transfer-progress.d.ts +67 -0
  40. package/lib/types/src/client/roots-panel-view.d.ts +236 -0
  41. package/lib/types/src/client/roots-panel.d.ts +347 -0
  42. package/lib/types/src/client/session/session-panel-view.d.ts +336 -0
  43. package/lib/types/src/client/session/session-panel.d.ts +322 -0
  44. package/lib/types/src/client/session/session-remote-mark.d.ts +110 -0
  45. package/lib/types/src/client/session/session-row-actions.d.ts +398 -0
  46. package/lib/types/src/client/session-panel.d.ts +152 -0
  47. package/lib/types/src/client/styles.d.ts +252 -0
  48. package/lib/types/src/client/workspace-directory-flow.d.ts +342 -0
  49. package/lib/types/src/config.d.ts +312 -0
  50. package/lib/types/src/file-references.d.ts +25 -0
  51. package/lib/types/src/fs.d.ts +46 -0
  52. package/lib/types/src/host/app/backend.d.ts +170 -0
  53. package/lib/types/src/host/app/recycle-bin/recycle-bin-contract.d.ts +247 -0
  54. package/lib/types/src/host/app/recycle-bin/recycle-bin-move.d.ts +18 -0
  55. package/lib/types/src/host/app/recycle-bin/recycle-bin-service.d.ts +45 -0
  56. package/lib/types/src/host/app/recycle-bin/recycle-bin-world.d.ts +38 -0
  57. package/lib/types/src/host/app/recycle-bin-contract.d.ts +215 -0
  58. package/lib/types/src/host/app/recycle-bin-move.d.ts +18 -0
  59. package/lib/types/src/host/app/recycle-bin-service.d.ts +45 -0
  60. package/lib/types/src/host/app/recycle-bin-world.d.ts +35 -0
  61. package/lib/types/src/host/app/roots/roots-api-connections.d.ts +49 -0
  62. package/lib/types/src/host/app/roots/roots-api-contract.d.ts +369 -0
  63. package/lib/types/src/host/app/roots/roots-api-directories.d.ts +13 -0
  64. package/lib/types/src/host/app/roots/roots-api-http.d.ts +77 -0
  65. package/lib/types/src/host/app/roots/roots-api-long-poll.d.ts +130 -0
  66. package/lib/types/src/host/app/roots/roots-api-projections.d.ts +102 -0
  67. package/lib/types/src/host/app/roots/roots-api-roots.d.ts +13 -0
  68. package/lib/types/src/host/app/roots/roots-api-state.d.ts +22 -0
  69. package/lib/types/src/host/app/roots/roots-api-transfers.d.ts +26 -0
  70. package/lib/types/src/host/app/roots/roots-api.d.ts +55 -0
  71. package/lib/types/src/host/app/roots/user-roots.d.ts +552 -0
  72. package/lib/types/src/host/app/roots-api-connections.d.ts +49 -0
  73. package/lib/types/src/host/app/roots-api-contract.d.ts +339 -0
  74. package/lib/types/src/host/app/roots-api-directories.d.ts +13 -0
  75. package/lib/types/src/host/app/roots-api-http.d.ts +77 -0
  76. package/lib/types/src/host/app/roots-api-projections.d.ts +102 -0
  77. package/lib/types/src/host/app/roots-api-roots.d.ts +13 -0
  78. package/lib/types/src/host/app/roots-api-state.d.ts +22 -0
  79. package/lib/types/src/host/app/roots-api-support.d.ts +182 -0
  80. package/lib/types/src/host/app/roots-api-transfers.d.ts +13 -0
  81. package/lib/types/src/host/app/roots-api.d.ts +55 -0
  82. package/lib/types/src/host/app/routed-fs.d.ts +239 -0
  83. package/lib/types/src/host/app/serialize.d.ts +37 -0
  84. package/lib/types/src/host/app/session-admin/session-admin-context.d.ts +36 -0
  85. package/lib/types/src/host/app/session-admin/session-admin-contract.d.ts +221 -0
  86. package/lib/types/src/host/app/session-admin/session-admin-delete.d.ts +34 -0
  87. package/lib/types/src/host/app/session-admin/session-admin-service.d.ts +40 -0
  88. package/lib/types/src/host/app/session-admin-context.d.ts +36 -0
  89. package/lib/types/src/host/app/session-admin-contract.d.ts +214 -0
  90. package/lib/types/src/host/app/session-admin-delete.d.ts +34 -0
  91. package/lib/types/src/host/app/session-admin-service.d.ts +38 -0
  92. package/lib/types/src/host/app/takeover/takeover-plan.d.ts +227 -0
  93. package/lib/types/src/host/app/takeover/takeover-rows.d.ts +55 -0
  94. package/lib/types/src/host/app/transport/transport-selector.d.ts +98 -0
  95. package/lib/types/src/host/app/transport/transport-service.d.ts +82 -0
  96. package/lib/types/src/host/app/transport-selector.d.ts +98 -0
  97. package/lib/types/src/host/app/transport-service.d.ts +75 -0
  98. package/lib/types/src/host/app/user-roots.d.ts +461 -0
  99. package/lib/types/src/host/domain/bin-location.d.ts +79 -0
  100. package/lib/types/src/host/domain/capability.d.ts +78 -0
  101. package/lib/types/src/host/domain/connection.d.ts +95 -0
  102. package/lib/types/src/host/domain/errors.d.ts +55 -0
  103. package/lib/types/src/host/domain/glob-pattern.d.ts +62 -0
  104. package/lib/types/src/host/domain/literal-text.d.ts +63 -0
  105. package/lib/types/src/host/domain/path-grammar.d.ts +84 -0
  106. package/lib/types/src/host/domain/recycle-bin.d.ts +337 -0
  107. package/lib/types/src/host/domain/root.d.ts +74 -0
  108. package/lib/types/src/host/domain/roots/bin-location.d.ts +91 -0
  109. package/lib/types/src/host/domain/roots/connection.d.ts +106 -0
  110. package/lib/types/src/host/domain/roots/root.d.ts +108 -0
  111. package/lib/types/src/host/domain/roots/route-table.d.ts +102 -0
  112. package/lib/types/src/host/domain/roots/session-roots.d.ts +151 -0
  113. package/lib/types/src/host/domain/roots/ssh-config.d.ts +73 -0
  114. package/lib/types/src/host/domain/route-table.d.ts +80 -0
  115. package/lib/types/src/host/domain/session/session-admin.d.ts +345 -0
  116. package/lib/types/src/host/domain/session/terminal-target.d.ts +136 -0
  117. package/lib/types/src/host/domain/session-admin.d.ts +330 -0
  118. package/lib/types/src/host/domain/shell.d.ts +47 -0
  119. package/lib/types/src/host/domain/ssh-config.d.ts +73 -0
  120. package/lib/types/src/host/domain/terminal-target.d.ts +132 -0
  121. package/lib/types/src/host/domain/tool-requests.d.ts +369 -0
  122. package/lib/types/src/host/domain/transfer/recycle-bin.d.ts +337 -0
  123. package/lib/types/src/host/domain/transfer/transfer.d.ts +260 -0
  124. package/lib/types/src/host/domain/transfer.d.ts +260 -0
  125. package/lib/types/src/host/infra/backend/local-backend.d.ts +84 -0
  126. package/lib/types/src/host/infra/backend/local-version.d.ts +43 -0
  127. package/lib/types/src/host/infra/backend/platform-local-backend.d.ts +89 -0
  128. package/lib/types/src/host/infra/backend/remote-backend.d.ts +239 -0
  129. package/lib/types/src/host/infra/cache/lru.d.ts +52 -0
  130. package/lib/types/src/host/infra/cache/versioned.d.ts +77 -0
  131. package/lib/types/src/host/infra/temp-name.d.ts +19 -0
  132. package/lib/types/src/host/infra/transport/agent/agent-installer.d.ts +121 -0
  133. package/lib/types/src/host/infra/transport/agent/agent-protocol-client.d.ts +132 -0
  134. package/lib/types/src/host/infra/transport/agent/agent-protocol-codec.d.ts +140 -0
  135. package/lib/types/src/host/infra/transport/agent/agent-protocol-errors.d.ts +41 -0
  136. package/lib/types/src/host/infra/transport/agent/agent-protocol-frames.d.ts +197 -0
  137. package/lib/types/src/host/infra/transport/agent/agent-protocol-types.d.ts +564 -0
  138. package/lib/types/src/host/infra/transport/agent/agent-transport.d.ts +418 -0
  139. package/lib/types/src/host/infra/transport/agent-installer.d.ts +121 -0
  140. package/lib/types/src/host/infra/transport/agent-protocol-client.d.ts +123 -0
  141. package/lib/types/src/host/infra/transport/agent-protocol-codec.d.ts +131 -0
  142. package/lib/types/src/host/infra/transport/agent-protocol-errors.d.ts +41 -0
  143. package/lib/types/src/host/infra/transport/agent-protocol-frames.d.ts +197 -0
  144. package/lib/types/src/host/infra/transport/agent-protocol-types.d.ts +509 -0
  145. package/lib/types/src/host/infra/transport/agent-transport.d.ts +353 -0
  146. package/lib/types/src/host/infra/transport/alias-transport.d.ts +206 -0
  147. package/lib/types/src/host/infra/transport/askpass-fs.d.ts +20 -0
  148. package/lib/types/src/host/infra/transport/askpass.d.ts +133 -0
  149. package/lib/types/src/host/infra/transport/command-pool.d.ts +61 -0
  150. package/lib/types/src/host/infra/transport/fs-commands.d.ts +140 -0
  151. package/lib/types/src/host/infra/transport/git-status-route.d.ts +63 -0
  152. package/lib/types/src/host/infra/transport/git-status.d.ts +101 -0
  153. package/lib/types/src/host/infra/transport/node-spawn.d.ts +26 -0
  154. package/lib/types/src/host/infra/transport/session-window.d.ts +51 -0
  155. package/lib/types/src/host/infra/transport/shell-quote.d.ts +59 -0
  156. package/lib/types/src/host/infra/transport/ssh/alias-transport.d.ts +206 -0
  157. package/lib/types/src/host/infra/transport/ssh/askpass-fs.d.ts +20 -0
  158. package/lib/types/src/host/infra/transport/ssh/askpass.d.ts +133 -0
  159. package/lib/types/src/host/infra/transport/ssh/shell-quote.d.ts +62 -0
  160. package/lib/types/src/host/infra/transport/ssh/ssh-argv.d.ts +43 -0
  161. package/lib/types/src/host/infra/transport/ssh/ssh2-transport.d.ts +328 -0
  162. package/lib/types/src/host/infra/transport/ssh-argv.d.ts +43 -0
  163. package/lib/types/src/host/infra/transport/ssh2-transport.d.ts +302 -0
  164. package/lib/types/src/host/infra/transport/transport-base.d.ts +34 -0
  165. package/lib/types/src/host/infra/transport/transport.d.ts +527 -0
  166. package/lib/types/src/host/integration/agent/agent-install-io.d.ts +33 -0
  167. package/lib/types/src/host/integration/agent/agent-preflight.d.ts +56 -0
  168. package/lib/types/src/host/integration/agent/askpass-registry.d.ts +66 -0
  169. package/lib/types/src/host/integration/agent-install-io.d.ts +33 -0
  170. package/lib/types/src/host/integration/agent-preflight.d.ts +56 -0
  171. package/lib/types/src/host/integration/anchor-directory.d.ts +56 -0
  172. package/lib/types/src/host/integration/askpass-registry.d.ts +59 -0
  173. package/lib/types/src/host/integration/bin-root-resolver.d.ts +81 -0
  174. package/lib/types/src/host/integration/connection-test.d.ts +73 -0
  175. package/lib/types/src/host/integration/file-reference-provider.d.ts +115 -0
  176. package/lib/types/src/host/integration/fs/file-reference-provider.d.ts +142 -0
  177. package/lib/types/src/host/integration/fs/fs-provider.d.ts +368 -0
  178. package/lib/types/src/host/integration/fs/git-status-wiring.d.ts +21 -0
  179. package/lib/types/src/host/integration/fs/platform-errors.d.ts +94 -0
  180. package/lib/types/src/host/integration/fs/remote-file-tools.d.ts +369 -0
  181. package/lib/types/src/host/integration/fs/remote-index.d.ts +177 -0
  182. package/lib/types/src/host/integration/fs-provider.d.ts +226 -0
  183. package/lib/types/src/host/integration/lsp/lsp-framing.d.ts +38 -0
  184. package/lib/types/src/host/integration/lsp/lsp-registry.d.ts +67 -0
  185. package/lib/types/src/host/integration/lsp/lsp-session.d.ts +130 -0
  186. package/lib/types/src/host/integration/management-tools.d.ts +64 -0
  187. package/lib/types/src/host/integration/recycle-bin-service.d.ts +247 -0
  188. package/lib/types/src/host/integration/remote/connection-test.d.ts +73 -0
  189. package/lib/types/src/host/integration/remote/remote-face.d.ts +127 -0
  190. package/lib/types/src/host/integration/remote/remote-tool-backend.d.ts +108 -0
  191. package/lib/types/src/host/integration/remote-face.d.ts +127 -0
  192. package/lib/types/src/host/integration/remote-file-tools.d.ts +241 -0
  193. package/lib/types/src/host/integration/remote-home.d.ts +69 -0
  194. package/lib/types/src/host/integration/remote-index.d.ts +165 -0
  195. package/lib/types/src/host/integration/remote-job-tools.d.ts +295 -0
  196. package/lib/types/src/host/integration/remote-tool-backend.d.ts +97 -0
  197. package/lib/types/src/host/integration/remote-tools.d.ts +206 -0
  198. package/lib/types/src/host/integration/root-registry.d.ts +115 -0
  199. package/lib/types/src/host/integration/roots/anchor-directory.d.ts +56 -0
  200. package/lib/types/src/host/integration/roots/bin-root-resolver.d.ts +81 -0
  201. package/lib/types/src/host/integration/roots/remote-home.d.ts +69 -0
  202. package/lib/types/src/host/integration/roots/root-registry.d.ts +144 -0
  203. package/lib/types/src/host/integration/roots/roots-wiring.d.ts +219 -0
  204. package/lib/types/src/host/integration/roots/session-root-index.d.ts +52 -0
  205. package/lib/types/src/host/integration/roots-api.d.ts +407 -0
  206. package/lib/types/src/host/integration/roots-wiring.d.ts +211 -0
  207. package/lib/types/src/host/integration/session/session-api.d.ts +88 -0
  208. package/lib/types/src/host/integration/session/session-bin-lock.d.ts +80 -0
  209. package/lib/types/src/host/integration/session/session-header.d.ts +151 -0
  210. package/lib/types/src/host/integration/session/session-labels.d.ts +56 -0
  211. package/lib/types/src/host/integration/session/session-route-wiring.d.ts +50 -0
  212. package/lib/types/src/host/integration/session-admin-service.d.ts +236 -0
  213. package/lib/types/src/host/integration/session-api.d.ts +81 -0
  214. package/lib/types/src/host/integration/session-bin-lock.d.ts +80 -0
  215. package/lib/types/src/host/integration/session-header.d.ts +118 -0
  216. package/lib/types/src/host/integration/session-labels.d.ts +56 -0
  217. package/lib/types/src/host/integration/session-route-wiring.d.ts +50 -0
  218. package/lib/types/src/host/integration/session-scope.d.ts +113 -0
  219. package/lib/types/src/host/integration/session-tools.d.ts +44 -0
  220. package/lib/types/src/host/integration/strict-arguments.d.ts +79 -0
  221. package/lib/types/src/host/integration/takeover/takeover-api.d.ts +62 -0
  222. package/lib/types/src/host/integration/takeover/takeover-route-wiring.d.ts +60 -0
  223. package/lib/types/src/host/integration/takeover/takeover-service.d.ts +167 -0
  224. package/lib/types/src/host/integration/terminal-manifest.d.ts +94 -0
  225. package/lib/types/src/host/integration/tools/management-tools.d.ts +245 -0
  226. package/lib/types/src/host/integration/tools/remote-job-tools.d.ts +316 -0
  227. package/lib/types/src/host/integration/tools/remote-lsp-tools.d.ts +43 -0
  228. package/lib/types/src/host/integration/tools/remote-tools.d.ts +236 -0
  229. package/lib/types/src/host/integration/tools/session-target.d.ts +52 -0
  230. package/lib/types/src/host/integration/tools/session-tools.d.ts +46 -0
  231. package/lib/types/src/host/integration/tools/strict-arguments.d.ts +79 -0
  232. package/lib/types/src/host/integration/tools/terminal-manifest.d.ts +94 -0
  233. package/lib/types/src/host/integration/transfer/remote-copy.d.ts +66 -0
  234. package/lib/types/src/host/integration/transfer/transfer-adapters.d.ts +48 -0
  235. package/lib/types/src/host/integration/transfer/transfer-service.d.ts +212 -0
  236. package/lib/types/src/host/integration/transfer/transfer-tracker.d.ts +106 -0
  237. package/lib/types/src/host/integration/transfer-adapters.d.ts +44 -0
  238. package/lib/types/src/host/integration/transfer-service.d.ts +164 -0
  239. package/lib/types/src/host/integration/transfer-tracker.d.ts +106 -0
  240. package/lib/types/src/host/integration/user-roots.d.ts +461 -0
  241. package/lib/types/src/index.d.ts +66 -0
  242. package/lib/types/src/local-bridge-refs.d.ts +26 -0
  243. package/lib/types/src/local-bridge.d.ts +36 -0
  244. package/lib/types/src/shared/format.d.ts +13 -0
  245. package/lib/types/src/wiring/connections.d.ts +189 -0
  246. package/lib/types/src/wiring/fs.d.ts +13 -0
  247. package/lib/types/src/wiring/helpers.d.ts +144 -0
  248. package/lib/types/src/wiring/install-memo.d.ts +32 -0
  249. package/lib/types/src/wiring/legacy-dirs.d.ts +62 -0
  250. package/lib/types/src/wiring/package-paths.d.ts +35 -0
  251. package/lib/types/src/wiring/roots.d.ts +21 -0
  252. package/lib/types/src/wiring/state-dir.d.ts +29 -0
  253. package/lib/types/src/wiring/tools.d.ts +35 -0
  254. package/package.json +120 -4
@@ -0,0 +1,102 @@
1
+ /**
2
+ * 根路由的**投影层**:把内部状态/后端条目压成对外的 DTO,以及路径面包屑与失败文案。
3
+ *
4
+ * 从 `roots-api-support.ts` 拆出(审计 0079):纯函数,输入输出都是普通对象,
5
+ * 因此可以单独断言「哪些字段能出网」。
6
+ *
7
+ * @module dsh-over-ssh/app/roots-api-projections
8
+ */
9
+ import { type ConnectionPatch, type UserRootEntry, type UserRootsState } from './user-roots.ts';
10
+ /**
11
+ * Whitelist one live root, dropping everything else it carries (argv, anchor paths, transports).
12
+ *
13
+ * Both spellings the Lead may hand over are accepted: a bare `RootRef` and a `RootRecord`
14
+ * (`{ key, root, backend }` — what `RootRegistry.records` returns). Reading the nested `root` here is what
15
+ * keeps a wiring mistake from showing every root as `location: "unknown", path: ""`.
16
+ */
17
+ export declare function publicRoot(raw: unknown): PublicRoot;
18
+ /**
19
+ * Whitelist one live connection.
20
+ *
21
+ * This is the only place the host's connection profiles are turned into wire data, so it is the one place
22
+ * that must never copy a field it was not explicitly told to copy: `auth`, `keyPath`, `credentialKey`,
23
+ * `password`, `alias`, `proxyJump` and everything added later stay behind.
24
+ */
25
+ export declare function publicConnection(raw: unknown): PublicConnection;
26
+ /** The persisted state as the panel may see it: same connection projection, so `keyPath` never travels. */
27
+ export declare function publicUserState(state: UserRootsState): {
28
+ readonly version: number;
29
+ readonly roots: readonly UserRootEntry[];
30
+ readonly connections: readonly PublicConnection[];
31
+ };
32
+ /**
33
+ * The wire shape of one tracked transfer.
34
+ *
35
+ * Whitelisted field by field, like every other projection on this route: the tracker's own object is a
36
+ * host-side value, and a field added there must be a deliberate decision to publish, not a leak.
37
+ *
38
+ * @param value - one entry from the tracker.
39
+ * @returns the row the client may see.
40
+ */
41
+ export declare function publicTransfer(value: unknown): Record<string, unknown>;
42
+ /**
43
+ * The absolute chain from the filesystem root down to `absolute`, inclusive.
44
+ *
45
+ * The client renders "up" and "home" from this instead of composing a parent path itself: drive letters, UNC
46
+ * shares and `/` are exactly the dialects a web client gets wrong, and one wrong guess sends `list-local` to a
47
+ * directory the user never asked for. Every element is an ancestor of the path the answer already carries, so
48
+ * the field discloses nothing the `path` field did not.
49
+ *
50
+ * @param absolute - an absolute, resolved path (what the handler answers with).
51
+ * @returns the chain, root first; empty when the platform reports no root (impossible for a resolved path).
52
+ */
53
+ export declare function localPathCrumbs(absolute: string): readonly string[];
54
+ /** The machine-readable reason for one local listing failure, or `undefined` when it is not the caller's fault. */
55
+ export declare function localFailureReason(error: unknown): LocalFailureReason | undefined;
56
+ /** The human text for one {@link LocalFailureReason}; the path is always named so the message is actionable. */
57
+ export declare function localFailureMessage(reason: LocalFailureReason, path: string): string;
58
+ /**
59
+ * Narrow a whitelisted body down to the fields of a {@link ConnectionPatch} (never the id: see
60
+ * {@link UPDATE_CONNECTION_FIELDS}).
61
+ *
62
+ * **Absent means "keep what is there"** for every field, and this function is what makes that true rather than
63
+ * accidental: only keys the body actually carries are copied, so a body that names three fields cannot blank
64
+ * the four it did not mention.
65
+ *
66
+ * `port: ''`/`null` becomes `null`, which is the one value that means **drop the field** (back to the ssh
67
+ * default). Every other value is passed through untouched and judged by `normalizeConnectionEntry`; nothing is
68
+ * coerced here, because a bad port must be reported, not silently rounded.
69
+ *
70
+ * @param source - the whitelisted fields of the request body.
71
+ * @returns the patch.
72
+ */
73
+ export declare function connectionPatchOf(source: Record<string, unknown>): Omit<ConnectionPatch, 'id'>;
74
+ /** One root as the panel may see it: no credential can appear in a root, but the shape is still fixed. */
75
+ export interface PublicRoot {
76
+ readonly key?: string;
77
+ readonly location: string;
78
+ readonly connectionId?: string;
79
+ readonly path: string;
80
+ readonly label?: string;
81
+ readonly writable?: boolean;
82
+ }
83
+ /**
84
+ * One connection as the panel may see it. **Deliberately without `keyPath`.**
85
+ *
86
+ * `transport` **is** projected, and it has to be: the edit form is filled from this answer and submits what it
87
+ * was filled with, so omitting the field silently rewrote every `alias`/`ssh2` connection to the default
88
+ * (`agent`) on the next save - even when the operator only changed the host.
89
+ */
90
+ export interface PublicConnection {
91
+ readonly id: string;
92
+ readonly host: string;
93
+ readonly user: string;
94
+ readonly port?: number;
95
+ readonly authKind: string;
96
+ /** The transport this connection asks for; absent only for a record that names none. */
97
+ readonly transport?: string;
98
+ }
99
+ /** The reasons a local listing of a syntactically valid path can be refused with. */
100
+ type LocalFailureReason = 'not-found' | 'not-a-directory' | 'unreadable';
101
+ export {};
102
+ //# sourceMappingURL=roots-api-projections.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * roots-api-roots
3
+ *
4
+ * 根的两个 action:add-root / remove-root,以及根的存活判定与锚点解析。
5
+ *
6
+ * 从 `roots-api-roots.ts` 拆出(审计 0077):根与连接是两套独立的状态机,
7
+ * 原先共处一个 switch,各自的辅助函数也互不相干。
8
+ *
9
+ * @module dsh-over-ssh/app/roots-api-roots
10
+ */
11
+ import type { RootsApiRequest, RootsApiResponse, RootsApiDeps } from './roots-api-contract.ts';
12
+ export declare function handleRootActions(action: string, body: Record<string, unknown>, req: RootsApiRequest, res: RootsApiResponse, deps: RootsApiDeps): Promise<boolean>;
13
+ //# sourceMappingURL=roots-api-roots.d.ts.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 根路由的**状态读取**:取当前用户状态、在其上做一次可串行化的变更。
3
+ *
4
+ * 从 `roots-api-support.ts` 拆出(审计 0079):它是根与连接两族 handler 的公共入口,
5
+ * 与 HTTP 原语、DTO 投影互不相干。
6
+ *
7
+ * @module dsh-over-ssh/app/roots-api-state
8
+ */
9
+ import { type UserRootsState } from './user-roots.ts';
10
+ import type { RootsApiDeps } from './roots-api-contract.ts';
11
+ /** The persisted state, read fresh for every check (the file is the source of truth, not a cache). */
12
+ export declare function currentUserState(deps: RootsApiDeps): Promise<UserRootsState>;
13
+ /**
14
+ * Converge the persisted state on a target shape and return it.
15
+ *
16
+ * The handler never assumes who persisted what: it consults the file **after** the live seam ran, computes
17
+ * the state the request implies, and writes only when that differs. So a wiring whose `registerRoot` already
18
+ * persists produces no second write, and a wiring that only touches the live registry still ends with a file
19
+ * that matches reality.
20
+ */
21
+ export declare function reconcile(deps: RootsApiDeps, transition: (state: UserRootsState) => UserRootsState): Promise<UserRootsState>;
22
+ //# sourceMappingURL=roots-api-state.d.ts.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * roots-api-transfers
3
+ *
4
+ * 传输面板的 2 个 action:列表与清空。
5
+ *
6
+ * 从 `roots-api.ts` 的 `serveAction`(543 行 / 15 个 case)拆出(审计 0076):
7
+ * case 体逐字搬移,只把 `return;` 改成 `return true;`,未命中时返回 `false` 由分发器报 400。
8
+ *
9
+ * ## `list-transfers` 的长轮询(task-19)
10
+ *
11
+ * 面板以前按 1 s / 5 s 定时全量拉取,进度条于是按「间隔 × 速率」跳格——这就是用户报的「一顿一顿」。
12
+ * 现在请求可以带 `waitMs`:宿主在**没有变化**时挂起,变化或预算用尽时返回当前快照。
13
+ *
14
+ * 三条实现规则:
15
+ *
16
+ * 1. **没有挂起的请求时什么都不做**:不缓存、不攒状态,`waitMs` 缺省/为 0 直接返回快照(旧行为)。
17
+ * 2. **超时是正常答案**:不是错误,回答里带 `waitedMs`,客户端据此立刻再发下一次。
18
+ * 3. **挂起不占配额**:平台载体(`dsh-host-webserver`)只有路由表、每个请求一个独立处理函数,没有
19
+ * 「每条路由的在飞配额」可以被挂起请求占住;真正会累积的是 socket,所以同时挂起数被
20
+ * {@link MAX_TRANSFER_WAITERS} 封顶,超出的请求**立即**返回快照并标记 `degraded`,绝不排队。
21
+ *
22
+ * @module dsh-over-ssh/app/roots-api-transfers
23
+ */
24
+ import type { RootsApiRequest, RootsApiResponse, RootsApiDeps } from './roots-api-contract.ts';
25
+ export declare function handleTransferActions(action: string, body: Record<string, unknown>, req: RootsApiRequest, res: RootsApiResponse, deps: RootsApiDeps): Promise<boolean>;
26
+ //# sourceMappingURL=roots-api-transfers.d.ts.map
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The same-origin HTTP route a client panel uses to **edit** roots and connections.
3
+ *
4
+ * Why a plain HTTP route instead of a Typert `@Remote` service (the shape audit 0021 used for reads):
5
+ *
6
+ * - every action here carries **parameters**, and a Client Remote descriptor with parameters requires a
7
+ * generated strict codec that this repository cannot produce (`doc/02-platform/client-plugin.md` §4);
8
+ * - the panel is served from the GUI's own origin, so a relative `fetch` is same-origin: no CORS
9
+ * concession, no code generation, no `@Remote` registration — exactly the shape the third-party
10
+ * `dsh-plugin-stock-market` uses (`ctx.webServer.register({ kind: 'exact', path, handler })`).
11
+ *
12
+ * This module is a **handler factory decoupled from cordis**: everything it needs arrives through
13
+ * {@link RootsApiDeps}, so it can be unit-tested with fake dependencies and fake request/response objects.
14
+ * The Lead performs the actual registration:
15
+ *
16
+ * ```ts
17
+ * const api = createRootsApi({ ... })
18
+ * disposers.push(webServer.register({ kind: 'exact', path: ROOTS_API_PATH, handler: api.handle }))
19
+ * ```
20
+ *
21
+ * Contract:
22
+ *
23
+ * | Request | Answer |
24
+ * |---|---|
25
+ * | `GET` | `200 { ok: true, roots, connections, userRoots, warnings }` |
26
+ * | `POST` `{ action: 'add-root' \| 'remove-root' \| 'add-connection' \| 'update-connection' \| 'remove-connection', ... }` | `200 { ok: true, action, state }` |
27
+ * | `POST` `{ action: 'add-root', location, path, connectionId?, workspaces?, reuseExisting? }` | `200 { ok: true, action, state, anchorPath? }` — `reuseExisting: true` makes an already-persisted root idempotent and answers its anchor instead of `400 该根已存在` |
28
+ * | `POST` `{ action: 'remove-root', key, workspace? }` | `200 { ok: true, action, state }` — `workspace` removes the root from that workspace only; the root disappears when the last one drops it |
29
+ * | `POST` `{ action: 'update-connection', id, newId?, host?, user?, port?, authKind?, keyPath?, credentialKey?, transport?, password? }` | `200 { ok: true, action, state }` — absent fields keep their value; `newId` renames and migrates the connection's roots (keeping their anchors) |
30
+ * | `POST` `{ action: 'list-remote', connectionId, path }` | `200 { ok: true, action, connectionId, path, entries: [{ name, kind }], truncated }` |
31
+ * | `POST` `{ action: 'list-local', path? }` | `200 { ok: true, action, path, entries: [{ name, kind }], crumbs, truncated }` |
32
+ * | `POST` `{ action: 'list-ssh-config' }` | `200 { ok: true, action, candidates: [{ alias, host, user?, port?, hasIdentityFile, hasProxyJump, suggestedId }], skipped: [{ pattern, reason, line }] }` (FR-2.1.4) |
33
+ * | `POST` `{ action: 'import-ssh-config', aliases: [alias, …] }` | `200 { ok: true, action, imported: [id, …], refused: [{ alias, reason }], state }` — the body names **aliases**, never ids/hosts/paths: every field is re-derived from the config |
34
+ * | any validation / trust / body failure | `400`/`403` `{ ok: false, error, reason? }` |
35
+ * | any other method | `405` `{ ok: false, error }` + `Allow: GET, HEAD, POST` |
36
+ *
37
+ * Two invariants this layer owns:
38
+ *
39
+ * 1. **Credentials never come back out.** `connections` (live and persisted), the `state` echoed by
40
+ * `POST` and every directory row (`list-remote` and `list-local`) are whitelist projections:
41
+ * `{ id, host, user, port, authKind, transport? }` and `{ name, kind }` respectively. `keyPath`, `password`,
42
+ * `passphrase`, `credentialKey`, `alias`, `proxyJump`, sizes, times, modes and symlink targets are
43
+ * never serialised, and no file content is readable through this route at all.
44
+ * 2. **Parameters are taken from a whitelist, one field at a time** — the body is never spread into a
45
+ * call. A field the UI does not own cannot reach the seam, however the body is shaped.
46
+ *
47
+ * @module dsh-over-ssh/integration/roots-api
48
+ */
49
+ import type { RootsApiDeps, RootsApi } from './roots-api-contract.ts';
50
+ export * from './roots-api-contract.ts';
51
+ export { localPathCrumbs } from './roots-api-projections.ts';
52
+ export { connectionIdFromAlias } from './roots-api-http.ts';
53
+ export type { PublicRoot, PublicConnection } from './roots-api-projections.ts';
54
+ export declare function createRootsApi(deps: RootsApiDeps): RootsApi;
55
+ //# sourceMappingURL=roots-api.d.ts.map