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,38 +0,0 @@
1
- /**
2
- * 回收站服务的**世界原语**:索引读写、按根取 IO、stat、根查找。
3
- *
4
- * 从 `recycle-bin-service.ts` 的工厂里抽出(审计 0076):只依赖 deps,不碰撤销栈与业务判断。
5
- *
6
- * @module dsh-over-ssh/app/recycle-bin-world
7
- */
8
- import type { BackendStat } from '../backend.ts';
9
- import { type RecycleBinEntry, type RecycleBinEntryId } from '../../domain/transfer/recycle-bin.ts';
10
- import { type RootRef } from '../../domain/roots/root.ts';
11
- import type { RecycleBinServiceDeps, RecycleBinWorldIo, RecycleBinRemovalOptions } from './recycle-bin-contract.ts';
12
- export type IndexState = {
13
- readonly path: string;
14
- readonly entries: readonly RecycleBinEntry[];
15
- readonly skipped: number;
16
- };
17
- export declare function createBinWorld(deps: RecycleBinServiceDeps): {
18
- describe: (error: unknown) => string;
19
- abortIfRequested: (signal: AbortSignal | undefined) => void;
20
- ioFor: (root: RootRef) => RecycleBinWorldIo;
21
- statFor: (root: RootRef, path: string, signal: AbortSignal | undefined) => Promise<BackendStat>;
22
- binRootOf: (root: RootRef) => string;
23
- readIndex: (root: RootRef, signal: AbortSignal | undefined) => Promise<IndexState>;
24
- writeIndex: (root: RootRef, path: string, entries: readonly RecycleBinEntry[], signal: AbortSignal | undefined) => Promise<void>;
25
- withIndexLock: <T>(key: string, operation: () => Promise<T>) => Promise<T>;
26
- removalOptions: (recursive: boolean, signal: AbortSignal | undefined) => RecycleBinRemovalOptions;
27
- knownRoots: () => readonly RootRef[];
28
- resolveRootOf: (key: string) => RootRef;
29
- findEntry: (id: RecycleBinEntryId, signal: AbortSignal | undefined) => Promise<{
30
- readonly root: RootRef;
31
- readonly entry: RecycleBinEntry;
32
- } | undefined>;
33
- contains: (root: RootRef, base: string, candidate: string) => boolean;
34
- entryDirOf: (entry: RecycleBinEntry) => string;
35
- pruneEntryDir: (root: RootRef, dir: string, signal: AbortSignal | undefined) => Promise<boolean>;
36
- };
37
- export type BinWorld = ReturnType<typeof createBinWorld>;
38
- //# sourceMappingURL=recycle-bin-world.d.ts.map
@@ -1,215 +0,0 @@
1
- /**
2
- * 回收站服务的**契约**:依赖注入形状、目标/结果类型、索引状态。
3
- *
4
- * 从 `recycle-bin-service.ts` 抽出(审计 0076)。抽出的直接原因不是"文件太长",而是
5
- * 世界原语模块需要这些类型:留在 service 里会形成 `world → service`(type)与
6
- * `service → world`(value)的环,架构测试会红。契约独立后方向单一。
7
- *
8
- * @module dsh-remote-workspace/app/recycle-bin-contract
9
- */
10
- import type { BackendEntry, BackendStat } from './backend.ts';
11
- import { type RecycleBinEntry, type RecycleBinEntryId } from '../domain/recycle-bin.ts';
12
- import { type RootRef } from '../domain/root.ts';
13
- export interface RecycleBinRemovalOptions {
14
- /** Whether the target is a directory that must be removed with its content. */
15
- readonly recursive: boolean;
16
- /** Caller cancellation. */
17
- readonly signal?: AbortSignal;
18
- }
19
- /** The mutating primitives of one execution world, shaped like the remote group. */
20
- export interface RecycleBinWorldIo {
21
- /**
22
- * Move (rename) a path.
23
- *
24
- * Contract: the implementation must create a missing destination parent directory (equivalent to
25
- * `mkdir -p` + `rename`). A cross-device move that cannot be done by rename must **fail loudly**; silently
26
- * degrading to copy-then-delete would break the "don't delete until it is in the bin" guarantee.
27
- */
28
- readonly move: (from: string, to: string, signal?: AbortSignal) => Promise<void>;
29
- /** Physically delete a path. */
30
- readonly remove: (path: string, options: RecycleBinRemovalOptions) => Promise<void>;
31
- /** List one directory. */
32
- readonly list: (dir: string, signal?: AbortSignal) => Promise<readonly BackendEntry[]>;
33
- /** Read a text file (the index). */
34
- readonly readText: (path: string, signal?: AbortSignal) => Promise<string>;
35
- /** Write a text file as UTF-8 **without BOM** (the index). */
36
- readonly writeText: (path: string, text: string, signal?: AbortSignal) => Promise<void>;
37
- }
38
- /** Everything {@link createRecycleBinService} needs; each field is injected so tests need no host. */
39
- export interface RecycleBinServiceDeps {
40
- /** Bin root directory for one root; a deployment setting, never hardcoded here. */
41
- readonly binRootFor: (root: RootRef) => string;
42
- /** Find a root by its `rootKey()`; `undefined` means the root is no longer registered. */
43
- readonly resolveRoot: (key: string) => RootRef | undefined;
44
- /** `stat` in the local world. */
45
- readonly statLocal: (path: string, signal?: AbortSignal) => Promise<BackendStat>;
46
- /** `stat` in the remote world. */
47
- readonly statRemote: (path: string, signal?: AbortSignal) => Promise<BackendStat>;
48
- /** Move primitive of the remote world. */
49
- readonly moveRemote: (from: string, to: string, signal?: AbortSignal) => Promise<void>;
50
- /** Remove primitive of the remote world. */
51
- readonly removeRemote: (path: string, options: RecycleBinRemovalOptions) => Promise<void>;
52
- /** List primitive of the remote world. */
53
- readonly listRemote: (dir: string, signal?: AbortSignal) => Promise<readonly BackendEntry[]>;
54
- /** Index read primitive of the remote world. */
55
- readonly readTextRemote: (path: string, signal?: AbortSignal) => Promise<string>;
56
- /** Index write primitive of the remote world (UTF-8, no BOM). */
57
- readonly writeTextRemote: (path: string, text: string, signal?: AbortSignal) => Promise<void>;
58
- /** Clock, injected so a test can pin "now". */
59
- readonly now: () => number;
60
- /** Undo depth from configuration (a non-positive value keeps no history). */
61
- readonly undoDepth: number;
62
- /** Roots whose bins exist, so `sweep()` can walk them all. */
63
- readonly knownRoots: () => readonly RootRef[];
64
- /**
65
- * Local-world mutators.
66
- *
67
- * Optional: a service built for remote work omits it, and touching a local target then fails with
68
- * `REMOTE_UNSUPPORTED` instead of misapplying the remote primitives to a local path.
69
- */
70
- readonly localIo?: RecycleBinWorldIo;
71
- }
72
- /** One deletion target: a root plus a path inside it. */
73
- export interface RecycleBinTarget {
74
- readonly root: RootRef;
75
- /** Absolute path in the root's own spelling. */
76
- readonly path: string;
77
- }
78
- /** A bin view scope: one root, optionally narrowed to targets deleted under one directory. */
79
- export interface RecycleBinScope {
80
- readonly root: RootRef;
81
- /** Optional directory prefix, matched per path segment. */
82
- readonly path?: string;
83
- }
84
- /** How {@link RecycleBinService.discard} removes a target. */
85
- export type DiscardMode = 'permanent' | 'recycle';
86
- /** Options for {@link RecycleBinService.discard}. */
87
- export interface DiscardOptions {
88
- readonly mode: DiscardMode;
89
- readonly signal?: AbortSignal;
90
- }
91
- /** Result of a discard. */
92
- export interface DiscardResult {
93
- readonly mode: DiscardMode;
94
- /** The bin entry in `recycle` mode; `undefined` for `permanent`. */
95
- readonly entry: RecycleBinEntry | undefined;
96
- /** Whether the content can still be recovered. **Always `false` for `permanent`.** */
97
- readonly recoverable: boolean;
98
- /** Post-operation confirmation: the original path is gone. */
99
- readonly verified: boolean;
100
- /** Human-facing note, mandatory for an irreversible delete. */
101
- readonly warning: string | undefined;
102
- }
103
- /** What a bin actually holds for one root. */
104
- export interface RecycleBinListing {
105
- readonly entries: readonly RecycleBinEntry[];
106
- /** Ids the index knows but the bin directory no longer contains. */
107
- readonly missing: readonly RecycleBinEntryId[];
108
- /** Directory names in the bin that no index record claims. */
109
- readonly orphans: readonly string[];
110
- /** Index records that were unusable and skipped. */
111
- readonly skipped: number;
112
- }
113
- /** Result of a restore. */
114
- export interface RestoreResult {
115
- readonly entry: RecycleBinEntry;
116
- readonly restoredPath: string;
117
- readonly verified: boolean;
118
- }
119
- /** Result of a physical delete from the bin. */
120
- export interface PurgeResult {
121
- readonly id: RecycleBinEntryId;
122
- readonly sizeBytes: number;
123
- /** Always true when the call returns; a failed delete throws instead. */
124
- readonly purged: boolean;
125
- readonly warning: string;
126
- }
127
- /** Options for `list`, `restore`, `purge`, `undo` and `redo`. */
128
- export interface OperationOptions {
129
- readonly signal?: AbortSignal;
130
- }
131
- /** Result of an undo or redo step. */
132
- export interface UndoResult {
133
- /** The action that was executed. */
134
- readonly action: 'discard' | 'restore';
135
- readonly entry: RecycleBinEntry;
136
- /** Human-facing description of what happened. */
137
- readonly message: string;
138
- }
139
- /** Retention limits for one sweep; all optional. */
140
- export interface SweepOptions {
141
- /** Keep at most this many entries per bin; non-positive/absent = unlimited. */
142
- readonly maxEntries?: number;
143
- /** Keep at most this many bytes per bin; non-positive/absent = unlimited. */
144
- readonly maxBytes?: number;
145
- /** Keep entries at most this old; non-positive/absent = unlimited. */
146
- readonly maxAgeMs?: number;
147
- readonly signal?: AbortSignal;
148
- }
149
- /** One entry physically removed by a sweep. */
150
- export interface SweepPurge {
151
- readonly rootKey: string;
152
- readonly id: RecycleBinEntryId;
153
- readonly sizeBytes: number;
154
- readonly dimension: 'age' | 'count' | 'bytes';
155
- }
156
- /** One entry a sweep could not delete; the sweep continues with the rest. */
157
- export interface SweepFailure {
158
- readonly rootKey: string;
159
- readonly id?: RecycleBinEntryId;
160
- readonly message: string;
161
- }
162
- /** Per-root summary of a sweep. */
163
- export interface SweepRootReport {
164
- readonly rootKey: string;
165
- readonly considered: number;
166
- readonly purged: readonly RecycleBinEntryId[];
167
- readonly kept: readonly RecycleBinEntryId[];
168
- readonly reasons: readonly {
169
- readonly id: RecycleBinEntryId;
170
- readonly dimension: 'age' | 'count' | 'bytes';
171
- }[];
172
- }
173
- /** Outcome of a sweep. */
174
- export interface SweepReport {
175
- readonly purged: readonly SweepPurge[];
176
- readonly roots: readonly SweepRootReport[];
177
- readonly failures: readonly SweepFailure[];
178
- /** `false` when no dimension was limited: nothing was touched (an unconfigured 0 must not empty a bin). */
179
- readonly policyApplied: boolean;
180
- }
181
- /** Read-only undo state, for a UI that needs to enable or disable the buttons. */
182
- export interface RecycleBinHistory {
183
- readonly canUndo: boolean;
184
- readonly canRedo: boolean;
185
- readonly undo: readonly {
186
- readonly kind: string;
187
- readonly id: string;
188
- }[];
189
- readonly redo: readonly {
190
- readonly kind: string;
191
- readonly id: string;
192
- }[];
193
- readonly dropped: number;
194
- readonly undoDepth: number;
195
- }
196
- /** The service surface. */
197
- export interface RecycleBinService {
198
- /** Delete a target permanently or into the recycle bin. */
199
- discard(target: RecycleBinTarget, options: DiscardOptions): Promise<DiscardResult>;
200
- /** List one bin, reconciled against the directory that actually exists. */
201
- list(scope: RecycleBinScope, options?: OperationOptions): Promise<RecycleBinListing>;
202
- /** Restore one entry to its original path. */
203
- restore(id: RecycleBinEntryId, options?: OperationOptions): Promise<RestoreResult>;
204
- /** Physically delete one entry from the bin. */
205
- purge(id: RecycleBinEntryId, options?: OperationOptions): Promise<PurgeResult>;
206
- /** Apply retention limits to every known bin. */
207
- sweep(options: SweepOptions): Promise<SweepReport>;
208
- /** Undo the newest operation. */
209
- undo(options?: OperationOptions): Promise<UndoResult>;
210
- /** Re-apply the newest undone operation. */
211
- redo(options?: OperationOptions): Promise<UndoResult>;
212
- /** Current undo/redo state. */
213
- history(): RecycleBinHistory;
214
- }
215
- //# sourceMappingURL=recycle-bin-contract.d.ts.map
@@ -1,18 +0,0 @@
1
- /**
2
- * 回收站服务的**移动/恢复族**:把条目搬进 bin、搬回原处,含"移动后确认"与"索引写失败回滚"。
3
- *
4
- * 从 `recycle-bin-service.ts` 的工厂里抽出(审计 0076)。只依赖世界原语,不碰撤销栈。
5
- *
6
- * @module dsh-remote-workspace/app/recycle-bin-move
7
- */
8
- import { type RecycleBinEntry } from '../domain/recycle-bin.ts';
9
- import { type RootRef } from '../domain/root.ts';
10
- import type { BinWorld } from './recycle-bin-world.ts';
11
- export declare function createBinMove(world: BinWorld): {
12
- tryMove: (root: RootRef, from: string, to: string, signal: AbortSignal | undefined) => Promise<boolean>;
13
- moveOrReport: (root: RootRef, from: string, to: string, signal: AbortSignal | undefined, reason: string) => Promise<void>;
14
- confirmInBin: (root: RootRef, entry: RecycleBinEntry, signal: AbortSignal | undefined) => Promise<void>;
15
- moveIntoBin: (root: RootRef, entry: RecycleBinEntry, signal: AbortSignal | undefined) => Promise<void>;
16
- restoreEntry: (root: RootRef, entry: RecycleBinEntry, signal: AbortSignal | undefined) => Promise<void>;
17
- };
18
- //# sourceMappingURL=recycle-bin-move.d.ts.map
@@ -1,45 +0,0 @@
1
- /**
2
- * The recycle-bin service: the domain's pure decisions wired to injected I/O primitives.
3
- *
4
- * The seam is deliberate (AGENTS.md 红线 3): every path that touches a real filesystem or a real SSH
5
- * connection arrives as a function, so this module is testable offline and a test can inject a move that fails.
6
- *
7
- * Two contracts matter more than the rest:
8
- *
9
- * 1. **Move first, then confirm.** In `recycle` mode a success is reported only after `stat` shows the entry
10
- * inside the bin **and** the original path gone. A move that throws is confirmed before anything is
11
- * claimed: if the move actually landed (a lost response) it counts as success, otherwise the call fails
12
- * and nothing is recorded — "deleted but not in the bin" must never be reported as success.
13
- * 2. **The index write is never swallowed.** If the index cannot be written after a successful move, the move
14
- * is rolled back and the failure is reported; a physical delete has no rollback, so that case is reported
15
- * with `purged: true, indexStale: true` instead of being hidden.
16
- *
17
- * Other decisions worth knowing:
18
- *
19
- * - A `permanent` discard is irreversible by construction and says so in its result (`recoverable: false`),
20
- * and its undo record is refused as `irreversible`.
21
- * - Restoring onto an occupied original path is **refused** (`TRANSFER_CONFLICT`, with the informational
22
- * `suggestedPath` in `details`); this module never silently restores to a different name.
23
- * - `*Remote` primitives are the **remote world's** mutators. A local root additionally needs `localIo`; when it
24
- * is missing the call fails with `REMOTE_UNSUPPORTED` rather than reusing remote primitives on local paths.
25
- * - Every destructive call takes an `AbortSignal`, propagated to every injected primitive.
26
- * - Error codes are reused from the existing table (no new code is registered): `TRASH_NOT_FOUND` (missing
27
- * entry, unreadable index), `REMOTE_NOT_FOUND` (target gone), `TRANSFER_CONFLICT` (occupied restore path),
28
- * `ROOT_OUTSIDE` (symlink target refused), `ROOT_AMBIGUOUS` (one id in two bins), `REMOTE_UNSUPPORTED`
29
- * (local root without local primitives), `REMOTE_COMMAND_FAILED` (an operation that could not be confirmed),
30
- * `ROOT_INVALID` (unusable configuration/input), `CANCELLED` (aborted signal).
31
- *
32
- * @module dsh-remote-workspace/integration/recycle-bin-service
33
- */
34
- import type { RecycleBinServiceDeps, RecycleBinService } from './recycle-bin-contract.ts';
35
- export * from './recycle-bin-contract.ts';
36
- /** Removal options for one physical delete. */
37
- export * from './recycle-bin-contract.ts';
38
- /**
39
- * Build the service.
40
- *
41
- * @param deps - injected I/O, clock, configuration and root lookup.
42
- * @returns a {@link RecycleBinService}; its undo stack is per-instance, in memory and not persisted.
43
- */
44
- export declare function createRecycleBinService(deps: RecycleBinServiceDeps): RecycleBinService;
45
- //# sourceMappingURL=recycle-bin-service.d.ts.map
@@ -1,35 +0,0 @@
1
- /**
2
- * 回收站服务的**世界原语**:索引读写、按根取 IO、stat、根查找。
3
- *
4
- * 从 `recycle-bin-service.ts` 的工厂里抽出(审计 0076):只依赖 deps,不碰撤销栈与业务判断。
5
- *
6
- * @module dsh-remote-workspace/app/recycle-bin-world
7
- */
8
- import type { BackendStat } from './backend.ts';
9
- import { type RecycleBinEntry, type RecycleBinEntryId } from '../domain/recycle-bin.ts';
10
- import { type RootRef } from '../domain/root.ts';
11
- import type { RecycleBinServiceDeps, RecycleBinWorldIo, RecycleBinRemovalOptions } from './recycle-bin-contract.ts';
12
- export type IndexState = {
13
- readonly path: string;
14
- readonly entries: readonly RecycleBinEntry[];
15
- readonly skipped: number;
16
- };
17
- export declare function createBinWorld(deps: RecycleBinServiceDeps): {
18
- describe: (error: unknown) => string;
19
- abortIfRequested: (signal: AbortSignal | undefined) => void;
20
- ioFor: (root: RootRef) => RecycleBinWorldIo;
21
- statFor: (root: RootRef, path: string, signal: AbortSignal | undefined) => Promise<BackendStat>;
22
- binRootOf: (root: RootRef) => string;
23
- readIndex: (root: RootRef, signal: AbortSignal | undefined) => Promise<IndexState>;
24
- writeIndex: (root: RootRef, path: string, entries: readonly RecycleBinEntry[], signal: AbortSignal | undefined) => Promise<void>;
25
- removalOptions: (recursive: boolean, signal: AbortSignal | undefined) => RecycleBinRemovalOptions;
26
- knownRoots: () => readonly RootRef[];
27
- resolveRootOf: (key: string) => RootRef;
28
- findEntry: (id: RecycleBinEntryId, signal: AbortSignal | undefined) => Promise<{
29
- readonly root: RootRef;
30
- readonly entry: RecycleBinEntry;
31
- } | undefined>;
32
- contains: (root: RootRef, base: string, candidate: string) => boolean;
33
- };
34
- export type BinWorld = ReturnType<typeof createBinWorld>;
35
- //# sourceMappingURL=recycle-bin-world.d.ts.map
@@ -1,49 +0,0 @@
1
- /**
2
- * roots-api-connections
3
- *
4
- * 连接的 6 个 action:ssh-config 发现/导入、增删改连接、连接自检。
5
- *
6
- * 从 `roots-api-roots.ts` 拆出(审计 0077):根与连接是两套独立的状态机,
7
- * 原先共处一个 switch,各自的辅助函数也互不相干。
8
- *
9
- * @module dsh-over-ssh/app/roots-api-connections
10
- */
11
- import type { RootsApiRequest, RootsApiResponse, RootsApiDeps } from './roots-api-contract.ts';
12
- export declare function handleConnectionActions(action: string, body: Record<string, unknown>, req: RootsApiRequest, res: RootsApiResponse, deps: RootsApiDeps): Promise<boolean>;
13
- /**
14
- * Importable `~/.ssh/config` aliases, and what the flow refuses.
15
- *
16
- * The refusal list is the point, not a nicety: a wildcard `Host *` or an alias already imported is skipped
17
- * **with its reason and line number**, so the dialog can say why a host the user can see in the file is not on
18
- * the list. Silently importing a subset is how a user concludes the feature is broken.
19
- */
20
- export interface SshConfigCandidates {
21
- /** Aliases the user may import, already filtered. */
22
- readonly candidates: readonly SshConfigCandidate[];
23
- /** Patterns that were refused, each with its reason. */
24
- readonly skipped: readonly {
25
- readonly pattern: string;
26
- readonly reason: string;
27
- readonly line: number;
28
- }[];
29
- /** Absolute path the text was read from, when the wiring knows it. */
30
- readonly path?: string;
31
- }
32
- /** One importable alias, projected to what the dialog renders. */
33
- export interface SshConfigCandidate {
34
- /** The literal alias; also the `ssh` target. */
35
- readonly alias: string;
36
- /** Resolved host name (falls back to the alias). */
37
- readonly host: string;
38
- /** Login user when the block named one. */
39
- readonly user?: string;
40
- /** Port when the block named a numeric one. */
41
- readonly port?: number;
42
- /** Whether the block named an identity file (the path itself is not sent: see the route's invariant 1). */
43
- readonly hasIdentityFile: boolean;
44
- /** Whether the block named a ProxyJump. */
45
- readonly hasProxyJump: boolean;
46
- /** The id this import would create, so the dialog can show and edit it before committing. */
47
- readonly suggestedId: string;
48
- }
49
- //# sourceMappingURL=roots-api-connections.d.ts.map