dsh-over-ssh 0.1.0 → 0.1.1

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 (247) hide show
  1. package/README.md +10 -10
  2. package/agents/agent-manifest.json +1 -1
  3. package/lib/client.js +363 -314
  4. package/lib/file-references.js +80 -35
  5. package/lib/fs.js +158 -75
  6. package/lib/index.js +4103 -3397
  7. package/lib/terminal-wrapper.js +9 -4
  8. package/lib/types/src/config.d.ts +80 -9
  9. package/lib/types/src/file-references.d.ts +0 -1
  10. package/lib/types/src/host/app/backend.d.ts +9 -1
  11. package/lib/types/src/host/app/recycle-bin/recycle-bin-contract.d.ts +0 -1
  12. package/lib/types/src/host/app/recycle-bin/recycle-bin-service.d.ts +0 -1
  13. package/lib/types/src/host/app/session-admin/session-admin-contract.d.ts +12 -1
  14. package/lib/types/src/host/app/session-admin/session-admin-service.d.ts +0 -1
  15. package/lib/types/src/host/app/transport/transport-selector.d.ts +0 -1
  16. package/lib/types/src/host/app/transport/transport-service.d.ts +0 -1
  17. package/lib/types/src/host/domain/capability.d.ts +0 -1
  18. package/lib/types/src/host/domain/errors.d.ts +0 -1
  19. package/lib/types/src/host/domain/roots/connection.d.ts +0 -1
  20. package/lib/types/src/host/domain/roots/root.d.ts +24 -9
  21. package/lib/types/src/host/domain/roots/session-roots.d.ts +0 -1
  22. package/lib/types/src/host/domain/roots/ssh-config.d.ts +0 -1
  23. package/lib/types/src/host/domain/session/session-admin.d.ts +0 -1
  24. package/lib/types/src/host/domain/transfer/recycle-bin.d.ts +0 -1
  25. package/lib/types/src/host/domain/transfer/transfer.d.ts +0 -1
  26. package/lib/types/src/host/infra/transport/agent/agent-installer.d.ts +0 -1
  27. package/lib/types/src/host/infra/transport/ssh/ssh2-transport.d.ts +0 -1
  28. package/lib/types/src/host/infra/transport/transport-base.d.ts +0 -1
  29. package/lib/types/src/host/infra/transport/transport.d.ts +16 -2
  30. package/lib/types/src/host/integration/agent/agent-preflight.d.ts +0 -1
  31. package/lib/types/src/host/integration/fs/file-reference-provider.d.ts +0 -1
  32. package/lib/types/src/host/integration/fs/fs-provider.d.ts +0 -2
  33. package/lib/types/src/host/integration/transfer/transfer-service.d.ts +0 -1
  34. package/lib/types/src/index.d.ts +23 -1
  35. package/lib/types/src/local-bridge-refs.d.ts +0 -1
  36. package/lib/types/src/local-bridge.d.ts +0 -1
  37. package/lib/types/src/shared/root-keys.d.ts +120 -0
  38. package/lib/types/src/wiring/helpers.d.ts +0 -1
  39. package/package.json +5 -3
  40. package/lib/types/src/client/controls.d.ts +0 -131
  41. package/lib/types/src/client/core/card-focus-trap.d.ts +0 -45
  42. package/lib/types/src/client/core/controls.d.ts +0 -164
  43. package/lib/types/src/client/core/latest.d.ts +0 -48
  44. package/lib/types/src/client/core/locale.d.ts +0 -38
  45. package/lib/types/src/client/core/message.d.ts +0 -37
  46. package/lib/types/src/client/core/panel-model.d.ts +0 -134
  47. package/lib/types/src/client/core/portal.d.ts +0 -266
  48. package/lib/types/src/client/core/remote.d.ts +0 -84
  49. package/lib/types/src/client/core/styles.d.ts +0 -458
  50. package/lib/types/src/client/file-tree-io.d.ts +0 -19
  51. package/lib/types/src/client/file-tree.d.ts +0 -271
  52. package/lib/types/src/client/flows/directory-browser.d.ts +0 -587
  53. package/lib/types/src/client/flows/session-directory.d.ts +0 -415
  54. package/lib/types/src/client/flows/workspace-directory-flow.d.ts +0 -480
  55. package/lib/types/src/client/locale.d.ts +0 -31
  56. package/lib/types/src/client/panel-model.d.ts +0 -37
  57. package/lib/types/src/client/panel.d.ts +0 -77
  58. package/lib/types/src/client/roots/connection-test.d.ts +0 -69
  59. package/lib/types/src/client/roots/roots-panel-state.d.ts +0 -307
  60. package/lib/types/src/client/roots/roots-panel-view.d.ts +0 -280
  61. package/lib/types/src/client/roots/roots-panel.d.ts +0 -364
  62. package/lib/types/src/client/roots/transfer-panel-view.d.ts +0 -35
  63. package/lib/types/src/client/roots/transfer-panel.d.ts +0 -241
  64. package/lib/types/src/client/roots/transfer-progress.d.ts +0 -67
  65. package/lib/types/src/client/roots-panel-view.d.ts +0 -236
  66. package/lib/types/src/client/roots-panel.d.ts +0 -347
  67. package/lib/types/src/client/session/session-panel-view.d.ts +0 -336
  68. package/lib/types/src/client/session/session-panel.d.ts +0 -322
  69. package/lib/types/src/client/session/session-remote-mark.d.ts +0 -110
  70. package/lib/types/src/client/session/session-row-actions.d.ts +0 -398
  71. package/lib/types/src/client/session-panel.d.ts +0 -152
  72. package/lib/types/src/client/styles.d.ts +0 -252
  73. package/lib/types/src/client/workspace-directory-flow.d.ts +0 -342
  74. package/lib/types/src/fs.d.ts +0 -46
  75. package/lib/types/src/host/app/recycle-bin/recycle-bin-move.d.ts +0 -18
  76. package/lib/types/src/host/app/recycle-bin/recycle-bin-world.d.ts +0 -38
  77. package/lib/types/src/host/app/recycle-bin-contract.d.ts +0 -215
  78. package/lib/types/src/host/app/recycle-bin-move.d.ts +0 -18
  79. package/lib/types/src/host/app/recycle-bin-service.d.ts +0 -45
  80. package/lib/types/src/host/app/recycle-bin-world.d.ts +0 -35
  81. package/lib/types/src/host/app/roots/roots-api-connections.d.ts +0 -49
  82. package/lib/types/src/host/app/roots/roots-api-contract.d.ts +0 -369
  83. package/lib/types/src/host/app/roots/roots-api-directories.d.ts +0 -13
  84. package/lib/types/src/host/app/roots/roots-api-http.d.ts +0 -77
  85. package/lib/types/src/host/app/roots/roots-api-long-poll.d.ts +0 -130
  86. package/lib/types/src/host/app/roots/roots-api-projections.d.ts +0 -102
  87. package/lib/types/src/host/app/roots/roots-api-roots.d.ts +0 -13
  88. package/lib/types/src/host/app/roots/roots-api-state.d.ts +0 -22
  89. package/lib/types/src/host/app/roots/roots-api-transfers.d.ts +0 -26
  90. package/lib/types/src/host/app/roots/roots-api.d.ts +0 -55
  91. package/lib/types/src/host/app/roots/user-roots.d.ts +0 -552
  92. package/lib/types/src/host/app/roots-api-connections.d.ts +0 -49
  93. package/lib/types/src/host/app/roots-api-contract.d.ts +0 -339
  94. package/lib/types/src/host/app/roots-api-directories.d.ts +0 -13
  95. package/lib/types/src/host/app/roots-api-http.d.ts +0 -77
  96. package/lib/types/src/host/app/roots-api-projections.d.ts +0 -102
  97. package/lib/types/src/host/app/roots-api-roots.d.ts +0 -13
  98. package/lib/types/src/host/app/roots-api-state.d.ts +0 -22
  99. package/lib/types/src/host/app/roots-api-support.d.ts +0 -182
  100. package/lib/types/src/host/app/roots-api-transfers.d.ts +0 -13
  101. package/lib/types/src/host/app/roots-api.d.ts +0 -55
  102. package/lib/types/src/host/app/routed-fs.d.ts +0 -239
  103. package/lib/types/src/host/app/serialize.d.ts +0 -37
  104. package/lib/types/src/host/app/session-admin/session-admin-context.d.ts +0 -36
  105. package/lib/types/src/host/app/session-admin/session-admin-delete.d.ts +0 -34
  106. package/lib/types/src/host/app/session-admin-context.d.ts +0 -36
  107. package/lib/types/src/host/app/session-admin-contract.d.ts +0 -214
  108. package/lib/types/src/host/app/session-admin-delete.d.ts +0 -34
  109. package/lib/types/src/host/app/session-admin-service.d.ts +0 -38
  110. package/lib/types/src/host/app/takeover/takeover-plan.d.ts +0 -227
  111. package/lib/types/src/host/app/takeover/takeover-rows.d.ts +0 -55
  112. package/lib/types/src/host/app/transport-selector.d.ts +0 -98
  113. package/lib/types/src/host/app/transport-service.d.ts +0 -75
  114. package/lib/types/src/host/app/user-roots.d.ts +0 -461
  115. package/lib/types/src/host/domain/bin-location.d.ts +0 -79
  116. package/lib/types/src/host/domain/connection.d.ts +0 -95
  117. package/lib/types/src/host/domain/glob-pattern.d.ts +0 -62
  118. package/lib/types/src/host/domain/literal-text.d.ts +0 -63
  119. package/lib/types/src/host/domain/path-grammar.d.ts +0 -84
  120. package/lib/types/src/host/domain/recycle-bin.d.ts +0 -337
  121. package/lib/types/src/host/domain/root.d.ts +0 -74
  122. package/lib/types/src/host/domain/roots/bin-location.d.ts +0 -91
  123. package/lib/types/src/host/domain/roots/route-table.d.ts +0 -102
  124. package/lib/types/src/host/domain/route-table.d.ts +0 -80
  125. package/lib/types/src/host/domain/session/terminal-target.d.ts +0 -136
  126. package/lib/types/src/host/domain/session-admin.d.ts +0 -330
  127. package/lib/types/src/host/domain/shell.d.ts +0 -47
  128. package/lib/types/src/host/domain/ssh-config.d.ts +0 -73
  129. package/lib/types/src/host/domain/terminal-target.d.ts +0 -132
  130. package/lib/types/src/host/domain/tool-requests.d.ts +0 -369
  131. package/lib/types/src/host/domain/transfer.d.ts +0 -260
  132. package/lib/types/src/host/infra/backend/local-backend.d.ts +0 -84
  133. package/lib/types/src/host/infra/backend/local-version.d.ts +0 -43
  134. package/lib/types/src/host/infra/backend/platform-local-backend.d.ts +0 -89
  135. package/lib/types/src/host/infra/backend/remote-backend.d.ts +0 -239
  136. package/lib/types/src/host/infra/cache/lru.d.ts +0 -52
  137. package/lib/types/src/host/infra/cache/versioned.d.ts +0 -77
  138. package/lib/types/src/host/infra/temp-name.d.ts +0 -19
  139. package/lib/types/src/host/infra/transport/agent/agent-protocol-client.d.ts +0 -132
  140. package/lib/types/src/host/infra/transport/agent/agent-protocol-codec.d.ts +0 -140
  141. package/lib/types/src/host/infra/transport/agent/agent-protocol-errors.d.ts +0 -41
  142. package/lib/types/src/host/infra/transport/agent/agent-protocol-frames.d.ts +0 -197
  143. package/lib/types/src/host/infra/transport/agent/agent-protocol-types.d.ts +0 -564
  144. package/lib/types/src/host/infra/transport/agent/agent-transport.d.ts +0 -418
  145. package/lib/types/src/host/infra/transport/agent-installer.d.ts +0 -121
  146. package/lib/types/src/host/infra/transport/agent-protocol-client.d.ts +0 -123
  147. package/lib/types/src/host/infra/transport/agent-protocol-codec.d.ts +0 -131
  148. package/lib/types/src/host/infra/transport/agent-protocol-errors.d.ts +0 -41
  149. package/lib/types/src/host/infra/transport/agent-protocol-frames.d.ts +0 -197
  150. package/lib/types/src/host/infra/transport/agent-protocol-types.d.ts +0 -509
  151. package/lib/types/src/host/infra/transport/agent-transport.d.ts +0 -353
  152. package/lib/types/src/host/infra/transport/alias-transport.d.ts +0 -206
  153. package/lib/types/src/host/infra/transport/askpass-fs.d.ts +0 -20
  154. package/lib/types/src/host/infra/transport/askpass.d.ts +0 -133
  155. package/lib/types/src/host/infra/transport/command-pool.d.ts +0 -61
  156. package/lib/types/src/host/infra/transport/fs-commands.d.ts +0 -140
  157. package/lib/types/src/host/infra/transport/git-status-route.d.ts +0 -63
  158. package/lib/types/src/host/infra/transport/git-status.d.ts +0 -101
  159. package/lib/types/src/host/infra/transport/node-spawn.d.ts +0 -26
  160. package/lib/types/src/host/infra/transport/session-window.d.ts +0 -51
  161. package/lib/types/src/host/infra/transport/shell-quote.d.ts +0 -59
  162. package/lib/types/src/host/infra/transport/ssh/alias-transport.d.ts +0 -206
  163. package/lib/types/src/host/infra/transport/ssh/askpass-fs.d.ts +0 -20
  164. package/lib/types/src/host/infra/transport/ssh/askpass.d.ts +0 -133
  165. package/lib/types/src/host/infra/transport/ssh/shell-quote.d.ts +0 -62
  166. package/lib/types/src/host/infra/transport/ssh/ssh-argv.d.ts +0 -43
  167. package/lib/types/src/host/infra/transport/ssh-argv.d.ts +0 -43
  168. package/lib/types/src/host/infra/transport/ssh2-transport.d.ts +0 -302
  169. package/lib/types/src/host/integration/agent/agent-install-io.d.ts +0 -33
  170. package/lib/types/src/host/integration/agent/askpass-registry.d.ts +0 -66
  171. package/lib/types/src/host/integration/agent-install-io.d.ts +0 -33
  172. package/lib/types/src/host/integration/agent-preflight.d.ts +0 -56
  173. package/lib/types/src/host/integration/anchor-directory.d.ts +0 -56
  174. package/lib/types/src/host/integration/askpass-registry.d.ts +0 -59
  175. package/lib/types/src/host/integration/bin-root-resolver.d.ts +0 -81
  176. package/lib/types/src/host/integration/connection-test.d.ts +0 -73
  177. package/lib/types/src/host/integration/file-reference-provider.d.ts +0 -115
  178. package/lib/types/src/host/integration/fs/git-status-wiring.d.ts +0 -21
  179. package/lib/types/src/host/integration/fs/platform-errors.d.ts +0 -94
  180. package/lib/types/src/host/integration/fs/remote-file-tools.d.ts +0 -369
  181. package/lib/types/src/host/integration/fs/remote-index.d.ts +0 -177
  182. package/lib/types/src/host/integration/fs-provider.d.ts +0 -226
  183. package/lib/types/src/host/integration/lsp/lsp-framing.d.ts +0 -38
  184. package/lib/types/src/host/integration/lsp/lsp-registry.d.ts +0 -67
  185. package/lib/types/src/host/integration/lsp/lsp-session.d.ts +0 -130
  186. package/lib/types/src/host/integration/management-tools.d.ts +0 -64
  187. package/lib/types/src/host/integration/recycle-bin-service.d.ts +0 -247
  188. package/lib/types/src/host/integration/remote/connection-test.d.ts +0 -73
  189. package/lib/types/src/host/integration/remote/remote-face.d.ts +0 -127
  190. package/lib/types/src/host/integration/remote/remote-tool-backend.d.ts +0 -108
  191. package/lib/types/src/host/integration/remote-face.d.ts +0 -127
  192. package/lib/types/src/host/integration/remote-file-tools.d.ts +0 -241
  193. package/lib/types/src/host/integration/remote-home.d.ts +0 -69
  194. package/lib/types/src/host/integration/remote-index.d.ts +0 -165
  195. package/lib/types/src/host/integration/remote-job-tools.d.ts +0 -295
  196. package/lib/types/src/host/integration/remote-tool-backend.d.ts +0 -97
  197. package/lib/types/src/host/integration/remote-tools.d.ts +0 -206
  198. package/lib/types/src/host/integration/root-registry.d.ts +0 -115
  199. package/lib/types/src/host/integration/roots/anchor-directory.d.ts +0 -56
  200. package/lib/types/src/host/integration/roots/bin-root-resolver.d.ts +0 -81
  201. package/lib/types/src/host/integration/roots/remote-home.d.ts +0 -69
  202. package/lib/types/src/host/integration/roots/root-registry.d.ts +0 -144
  203. package/lib/types/src/host/integration/roots/roots-wiring.d.ts +0 -219
  204. package/lib/types/src/host/integration/roots/session-root-index.d.ts +0 -52
  205. package/lib/types/src/host/integration/roots-api.d.ts +0 -407
  206. package/lib/types/src/host/integration/roots-wiring.d.ts +0 -211
  207. package/lib/types/src/host/integration/session/session-api.d.ts +0 -88
  208. package/lib/types/src/host/integration/session/session-bin-lock.d.ts +0 -80
  209. package/lib/types/src/host/integration/session/session-header.d.ts +0 -151
  210. package/lib/types/src/host/integration/session/session-labels.d.ts +0 -56
  211. package/lib/types/src/host/integration/session/session-route-wiring.d.ts +0 -50
  212. package/lib/types/src/host/integration/session-admin-service.d.ts +0 -236
  213. package/lib/types/src/host/integration/session-api.d.ts +0 -81
  214. package/lib/types/src/host/integration/session-bin-lock.d.ts +0 -80
  215. package/lib/types/src/host/integration/session-header.d.ts +0 -118
  216. package/lib/types/src/host/integration/session-labels.d.ts +0 -56
  217. package/lib/types/src/host/integration/session-route-wiring.d.ts +0 -50
  218. package/lib/types/src/host/integration/session-scope.d.ts +0 -113
  219. package/lib/types/src/host/integration/session-tools.d.ts +0 -44
  220. package/lib/types/src/host/integration/strict-arguments.d.ts +0 -79
  221. package/lib/types/src/host/integration/takeover/takeover-api.d.ts +0 -62
  222. package/lib/types/src/host/integration/takeover/takeover-route-wiring.d.ts +0 -60
  223. package/lib/types/src/host/integration/takeover/takeover-service.d.ts +0 -167
  224. package/lib/types/src/host/integration/terminal-manifest.d.ts +0 -94
  225. package/lib/types/src/host/integration/tools/management-tools.d.ts +0 -245
  226. package/lib/types/src/host/integration/tools/remote-job-tools.d.ts +0 -316
  227. package/lib/types/src/host/integration/tools/remote-lsp-tools.d.ts +0 -43
  228. package/lib/types/src/host/integration/tools/remote-tools.d.ts +0 -236
  229. package/lib/types/src/host/integration/tools/session-target.d.ts +0 -52
  230. package/lib/types/src/host/integration/tools/session-tools.d.ts +0 -46
  231. package/lib/types/src/host/integration/tools/strict-arguments.d.ts +0 -79
  232. package/lib/types/src/host/integration/tools/terminal-manifest.d.ts +0 -94
  233. package/lib/types/src/host/integration/transfer/remote-copy.d.ts +0 -66
  234. package/lib/types/src/host/integration/transfer/transfer-adapters.d.ts +0 -48
  235. package/lib/types/src/host/integration/transfer/transfer-tracker.d.ts +0 -106
  236. package/lib/types/src/host/integration/transfer-adapters.d.ts +0 -44
  237. package/lib/types/src/host/integration/transfer-service.d.ts +0 -164
  238. package/lib/types/src/host/integration/transfer-tracker.d.ts +0 -106
  239. package/lib/types/src/host/integration/user-roots.d.ts +0 -461
  240. package/lib/types/src/wiring/connections.d.ts +0 -189
  241. package/lib/types/src/wiring/fs.d.ts +0 -13
  242. package/lib/types/src/wiring/install-memo.d.ts +0 -32
  243. package/lib/types/src/wiring/legacy-dirs.d.ts +0 -62
  244. package/lib/types/src/wiring/package-paths.d.ts +0 -35
  245. package/lib/types/src/wiring/roots.d.ts +0 -21
  246. package/lib/types/src/wiring/state-dir.d.ts +0 -29
  247. package/lib/types/src/wiring/tools.d.ts +0 -35
@@ -1,337 +0,0 @@
1
- /**
2
- * Recycle bin: entry model, on-disk layout, retention policy and the undo stack — pure logic only.
3
- *
4
- * Why the domain layer (AGENTS.md 红线 2): entry ids, the bin path layout, the retention decision and the
5
- * undo state machine are all decisions that can be verified offline in milliseconds. Every real filesystem
6
- * or SSH interaction stays behind the injected seam of
7
- * [`integration/recycle-bin-service.ts`](../integration/recycle-bin-service.ts).
8
- *
9
- * Contract notes:
10
- *
11
- * - **Deterministic ids.** The same inputs (root key, original path, deletion instant, delete ordinal for
12
- * that path) always yield the same id. Two deletes of the same path at the same millisecond are told
13
- * apart by `sequence`, and {@link allocateRecycleBinId} breaks genuine hash collisions deterministically.
14
- * - **Layout.** `<binRoot>/<id>/<original basename>`. The id is unique, so same-named files never collide;
15
- * keeping the original basename in the bin means a restore does not rename anything. Everything else a
16
- * restore needs (root key, original absolute path) lives on the entry, which the service persists in an
17
- * index file next to the bins.
18
- * - **Restore conflicts.** When the original path is occupied, {@link planRestore} reports `blocked` plus an
19
- * informational suffix candidate; the caller must **refuse**, never silently write to a different name.
20
- * - **Retention.** `maxEntries` / `maxBytes` / `maxAgeMs` are applied per dimension: a **non-positive value
21
- * means "no limit"** for that dimension (0 and negatives never wipe anything — deliberate, because a
22
- * misconfigured 0 must not empty the bin). Oversized bins shed **oldest first**, with the id as a stable
23
- * tie-break, so the same input always produces the same decision.
24
- * - **Undo.** A stack. The inverse of `discard` is `restore` (and vice versa, which is what makes the undo
25
- * redoable); `purge` is a physical delete and is therefore **explicitly irreversible**.
26
- *
27
- * @module dsh-remote-workspace/domain/recycle-bin
28
- */
29
- /**
30
- * Opaque identity of one recycle-bin entry.
31
- *
32
- * Branded on purpose: an id is the directory name inside the bin and a handle the UI holds across calls, so
33
- * it must not be confused with a path or a session id.
34
- */
35
- export type RecycleBinEntryId = string & {
36
- readonly __recycleBinEntryId: 'RecycleBinEntryId';
37
- };
38
- /** Which world a target lives in; same vocabulary as `RootRef.location`. */
39
- export type RecycleBinLocation = 'local' | 'remote';
40
- /** Name of the index file inside a bin root. */
41
- export declare const RECYCLE_BIN_INDEX_FILE = "index.json";
42
- /** Version stamped into the index file; a different version is a hard parse failure. */
43
- export declare const RECYCLE_BIN_INDEX_VERSION = 1;
44
- /** Inputs that determine an entry id. */
45
- export interface RecycleBinIdInput {
46
- /** Stable root key (`rootKey()`); scopes ids to one root. */
47
- readonly rootKey: string;
48
- /** Absolute path of the deleted target, in this repository's normalized spelling. */
49
- readonly originalPath: string;
50
- /** Deletion instant in milliseconds since the epoch. */
51
- readonly deletedAtMs: number;
52
- /** Which delete of that same path this is, 1-based. */
53
- readonly sequence: number;
54
- }
55
- /** One recycle-bin entry: everything a restore needs, plus the facts the bin view shows. */
56
- export interface RecycleBinEntry {
57
- readonly id: RecycleBinEntryId;
58
- /** Root key (`rootKey()`) the target was deleted from. */
59
- readonly rootKey: string;
60
- readonly location: RecycleBinLocation;
61
- /** Original absolute path, normalized (local: `/` separators; remote: POSIX). */
62
- readonly originalPath: string;
63
- /** Final segment of {@link originalPath}; the bin keeps this name. */
64
- readonly originalName: string;
65
- /** Bin root directory (`binRootFor(root)`). */
66
- readonly binRoot: string;
67
- /** Actual location inside the bin: `<binRoot>/<id>/<originalName>`. */
68
- readonly binPath: string;
69
- readonly deletedAtMs: number;
70
- /** Bytes reported by the pre-delete `stat`; for directories this is the directory entry, not a sum. */
71
- readonly sizeBytes: number;
72
- readonly isDirectory: boolean;
73
- /** 1-based ordinal of this delete among deletes of the same path. */
74
- readonly sequence: number;
75
- }
76
- /** Input for {@link makeRecycleBinEntry}; {@link RecycleBinIdInput} plus the id and the observed facts. */
77
- export interface MakeRecycleBinEntryInput extends RecycleBinIdInput {
78
- readonly id: RecycleBinEntryId;
79
- readonly location: RecycleBinLocation;
80
- readonly binRoot: string;
81
- readonly sizeBytes: number;
82
- readonly isDirectory: boolean;
83
- }
84
- /**
85
- * Normalize a deletion target into the spelling the rest of the repository uses.
86
- *
87
- * Local targets go through `normalizeLocalPath` (separators to `/`, case preserved), remote targets through
88
- * `normalizeRemotePath` (POSIX, absolute). A filesystem root is rejected because it can never be a target.
89
- *
90
- * @param path - target path in either separator spelling.
91
- * @param location - which world the path belongs to.
92
- * @returns the normalized absolute path.
93
- * @throws SshDevError `ROOT_INVALID` when the path is empty, relative, or a filesystem root.
94
- */
95
- export declare function normalizeRecycleTarget(path: string, location: RecycleBinLocation): string;
96
- /**
97
- * The deterministic id for one {@link RecycleBinIdInput}.
98
- *
99
- * Same input → same id (a test can therefore pin ids). Different inputs collide only if FNV-1a collides,
100
- * which {@link allocateRecycleBinId} handles.
101
- *
102
- * @param input - root key, original path, deletion instant and delete ordinal.
103
- * @returns a filesystem-safe id of the form `rb-<8 hex>`.
104
- */
105
- export declare function makeRecycleBinEntryId(input: RecycleBinIdInput): RecycleBinEntryId;
106
- /**
107
- * Allocate an id that is not already taken by `existing`.
108
- *
109
- * The first candidate is {@link makeRecycleBinEntryId}; on collision the suffix `-2`, `-3`, … is appended.
110
- * The loop is bounded by the number of live entries, because every candidate it rejects is one of them.
111
- *
112
- * @param existing - ids already present in the bin index.
113
- * @param input - id material.
114
- * @returns an id not present in `existing`.
115
- */
116
- export declare function allocateRecycleBinId(existing: Iterable<string>, input: RecycleBinIdInput): RecycleBinEntryId;
117
- /**
118
- * Build one entry, validating its inputs and computing the bin layout.
119
- *
120
- * @param input - id, root, worlds, observed `stat` facts.
121
- * @returns the entry, with `binPath` = `<binRoot>/<id>/<originalName>`.
122
- * @throws SshDevError `ROOT_INVALID` when a path, the bin root, or a numeric field is unusable.
123
- */
124
- export declare function makeRecycleBinEntry(input: MakeRecycleBinEntryInput): RecycleBinEntry;
125
- /**
126
- * Join segments under an absolute base with `/`.
127
- *
128
- * Both worlds use this spelling (`local` roots are stored normalized by `normalizeLocalPath`, remote ones are
129
- * POSIX), so the bin layout is spelled the same way everywhere. A drive-rooted base (`D:`) keeps its slash.
130
- *
131
- * @param base - absolute base directory.
132
- * @param segments - segments to append.
133
- * @returns the joined path.
134
- */
135
- export declare function joinUnderPath(base: string, ...segments: readonly string[]): string;
136
- /** A restore decision: either the move is ready, or the original path is occupied and must not be reused. */
137
- export type RestorePlan = {
138
- readonly kind: 'ready';
139
- readonly from: string;
140
- readonly to: string;
141
- } | {
142
- readonly kind: 'blocked';
143
- readonly to: string;
144
- readonly reason: 'occupied';
145
- readonly suggestedPath: string;
146
- };
147
- /**
148
- * Decide how to restore one entry.
149
- *
150
- * Policy: **an occupied original path is refused, never renamed silently.** `suggestedPath` is returned so a
151
- * UI can *offer* an alternative, but no code path in this module moves a target to it.
152
- *
153
- * @param entry - entry to restore.
154
- * @param options - `occupied` is the caller's `stat` of `entry.originalPath`.
155
- * @returns the plan.
156
- */
157
- export declare function planRestore(entry: RecycleBinEntry, options: {
158
- readonly occupied: boolean;
159
- }): RestorePlan;
160
- /** Retention policy. A non-positive value means "no limit" for that dimension. */
161
- export interface RecycleBinPolicy {
162
- /** Keep at most this many entries; non-positive = unlimited. */
163
- readonly maxEntries: number;
164
- /** Keep at most this many bytes (sum of entry sizes); non-positive = unlimited. */
165
- readonly maxBytes: number;
166
- /** Keep entries at most this old, in milliseconds; non-positive = unlimited. */
167
- readonly maxAgeMs: number;
168
- }
169
- /** Neutral element: no dimension is limited, therefore nothing is ever swept with it. */
170
- export declare const NO_RECYCLE_BIN_LIMITS: RecycleBinPolicy;
171
- /** Which dimension caused one entry to be swept. */
172
- export type SweepDimension = 'age' | 'count' | 'bytes';
173
- /** Why one entry is scheduled for physical deletion. */
174
- export interface SweepReason {
175
- readonly id: RecycleBinEntryId;
176
- readonly dimension: SweepDimension;
177
- readonly detail: string;
178
- }
179
- /** The pure retention decision for one bin. */
180
- export interface SweepDecision {
181
- /** Ids to delete physically, oldest first. */
182
- readonly purge: readonly RecycleBinEntryId[];
183
- /** Ids to keep, oldest first. */
184
- readonly keep: readonly RecycleBinEntryId[];
185
- /** One reason per purged id, in the same order. */
186
- readonly reasons: readonly SweepReason[];
187
- /** Entries and bytes left after applying the decision. */
188
- readonly remainingEntries: number;
189
- readonly remainingBytes: number;
190
- }
191
- /**
192
- * Apply a retention policy to one bin.
193
- *
194
- * Rules, in this order (all of them deterministic: entries are ordered oldest first with the id as tie-break):
195
- *
196
- * 1. `maxAgeMs > 0`: purge everything older than the limit. An entry exactly **at** the limit is kept, and a
197
- * negative age (clock skew, future timestamp) is never purged.
198
- * 2. `maxBytes > 0`: walk the survivors oldest first and purge until the remaining sum is within the limit.
199
- * A single entry larger than the whole budget is purged too — otherwise the budget would be meaningless.
200
- * 3. `maxEntries > 0`: purge the oldest survivors until the count is within the limit.
201
- *
202
- * @param entries - entries of one bin.
203
- * @param policy - limits; non-positive values are ignored.
204
- * @param nowMs - current instant in milliseconds since the epoch.
205
- * @returns the decision.
206
- */
207
- export declare function decideSweep(entries: readonly RecycleBinEntry[], policy: RecycleBinPolicy, nowMs: number): SweepDecision;
208
- /** What one committed operation did; the unit of the undo stack. */
209
- export type OperationKind = 'discard' | 'restore' | 'purge';
210
- /** One committed operation. */
211
- export interface RecycleBinOperation {
212
- readonly kind: OperationKind;
213
- /** Entry the operation acted on; `undefined` for a permanent delete, which has no bin entry. */
214
- readonly entry: RecycleBinEntry | undefined;
215
- /** Entry id, or a synthesized id for a permanent delete. */
216
- readonly id: RecycleBinEntryId;
217
- readonly atMs: number;
218
- }
219
- /** Stack-shaped undo state: `undo` is the history, `redo` what was undone and can be re-applied. */
220
- export interface UndoStack {
221
- readonly undo: readonly RecycleBinOperation[];
222
- readonly redo: readonly RecycleBinOperation[];
223
- /** Operations dropped for exceeding the depth limit; explains "too old to undo". */
224
- readonly dropped: number;
225
- }
226
- /** Fresh state with no history. */
227
- export declare const EMPTY_UNDO_STACK: UndoStack;
228
- /** Why an undo/redo step was refused. */
229
- export type UndoRejectionReason = 'nothing-to-undo' | 'nothing-to-redo' | 'entry-missing' | 'irreversible';
230
- /** The world state an undo decision is validated against. */
231
- export interface UndoContext {
232
- /**
233
- * Ids **currently present in the recycle bin**.
234
- *
235
- * One rule covers both directions: a `restore` action needs the bin copy (the id must be listed), and a
236
- * `discard` action needs the file to be back at its original path (the id must not be listed).
237
- */
238
- readonly liveIds: readonly RecycleBinEntryId[];
239
- }
240
- /** A step to execute: move the entry out of the bin, or back into it. */
241
- export interface UndoAction {
242
- readonly kind: 'restore' | 'discard';
243
- readonly operation: RecycleBinOperation;
244
- readonly entry: RecycleBinEntry;
245
- }
246
- /** Why a step is not executable. */
247
- export interface UndoRejection {
248
- readonly reason: UndoRejectionReason;
249
- readonly message: string;
250
- readonly operation: RecycleBinOperation | undefined;
251
- }
252
- /** Outcome of one undo/redo step: either an action to run, or a rejection. */
253
- export interface UndoOutcome {
254
- /** State after the step; a rejected record is dropped from the stack (it can never succeed). */
255
- readonly stack: UndoStack;
256
- readonly action: UndoAction | undefined;
257
- readonly rejection: UndoRejection | undefined;
258
- }
259
- /**
260
- * Record one committed operation.
261
- *
262
- * The redo half is cleared (a new operation starts a new branch of history), the record goes on top of the
263
- * undo half, and anything beyond `undoDepth` is dropped. A non-positive `undoDepth` keeps no history at all.
264
- *
265
- * @param stack - current state.
266
- * @param operation - the operation that just succeeded.
267
- * @param options - `undoDepth` from configuration.
268
- * @returns the new state.
269
- */
270
- export declare function recordOperation(stack: UndoStack, operation: RecycleBinOperation, options: {
271
- readonly undoDepth: number;
272
- }): UndoStack;
273
- /** The operation {@link takeUndo} would consume, or `undefined` for an empty history. */
274
- export declare function nextUndo(stack: UndoStack): RecycleBinOperation | undefined;
275
- /** The operation that can be re-applied, or `undefined` when nothing was undone. */
276
- export declare function nextRedo(stack: UndoStack): RecycleBinOperation | undefined;
277
- /**
278
- * Consume the newest operation as an **inverse** step.
279
- *
280
- * `discard` reverses to `restore`; `restore` reverses to `discard`; `purge` is refused as `irreversible`
281
- * (a physical delete cannot be undone, and the record is dropped instead of being offered again).
282
- *
283
- * @param stack - current state.
284
- * @param context - which ids are actually in the bin right now.
285
- * @returns the action to run plus the new state, or a rejection plus the state with the dead record dropped.
286
- */
287
- export declare function takeUndo(stack: UndoStack, context: UndoContext): UndoOutcome;
288
- /**
289
- * Re-apply the newest undone operation.
290
- *
291
- * This is the exact inverse of {@link takeUndo}: it consumes the redo half and pushes the same operation back
292
- * onto the undo half.
293
- *
294
- * @param stack - current state.
295
- * @param context - which ids are actually in the bin right now.
296
- * @returns the action to run plus the new state, or a rejection.
297
- */
298
- export declare function takeRedo(stack: UndoStack, context: UndoContext): UndoOutcome;
299
- /** The persisted index document. */
300
- export interface RecycleBinIndex {
301
- readonly version: number;
302
- readonly entries: readonly RecycleBinEntry[];
303
- }
304
- /** One record the parser refused, with the reason (a corrupt index must never silently lose data). */
305
- export interface SkippedIndexRecord {
306
- readonly index: number;
307
- readonly reason: string;
308
- }
309
- /** Result of {@link parseRecycleBinIndex}. */
310
- export interface ParsedRecycleBinIndex {
311
- readonly entries: readonly RecycleBinEntry[];
312
- readonly skipped: readonly SkippedIndexRecord[];
313
- }
314
- /**
315
- * Serialize the index.
316
- *
317
- * Entries are sorted by id so the same set always produces byte-identical text (easy to diff, easy to test).
318
- * The result is a plain JavaScript string: written as UTF-8 it carries **no BOM**, and {@link parseRecycleBinIndex}
319
- * tolerates one anyway because remote tooling and editors add them.
320
- *
321
- * @param entries - entries to persist.
322
- * @returns JSON text.
323
- */
324
- export declare function serializeRecycleBinIndex(entries: readonly RecycleBinEntry[]): string;
325
- /**
326
- * Parse the index.
327
- *
328
- * A malformed document or an unknown version is a hard failure (the bin contents cannot be trusted); a single
329
- * unusable record is skipped and reported. Stored `binPath` values are taken as authoritative and not recomputed,
330
- * so changing the `binRootFor` configuration later does not invalidate existing entries.
331
- *
332
- * @param text - index file content.
333
- * @returns the usable entries plus the skipped records.
334
- * @throws SshDevError `TRASH_NOT_FOUND` when the document cannot be read as an index.
335
- */
336
- export declare function parseRecycleBinIndex(text: string): ParsedRecycleBinIndex;
337
- //# sourceMappingURL=recycle-bin.d.ts.map
@@ -1,74 +0,0 @@
1
- /**
2
- * Root references: one project root is either a local directory or a remote directory on
3
- * one connection. Remote roots additionally carry a local *anchor* directory, because DSH
4
- * requires a workspace path that exists on the host filesystem.
5
- *
6
- * @module dsh-remote-workspace/domain/root
7
- */
8
- /** Where a root lives. */
9
- export type RootLocation = 'local' | 'remote';
10
- /** One project root. */
11
- export interface RootRef {
12
- /** Local or remote. */
13
- readonly location: RootLocation;
14
- /** Connection id; present exactly for remote roots. */
15
- readonly connectionId?: string;
16
- /** Absolute local path, or absolute POSIX path for a remote root. */
17
- readonly path: string;
18
- /** Whether the sandbox fence admits writes under this root. */
19
- readonly writable: boolean;
20
- /** Local anchor directory for a remote root (empty directory, never mirrored content). */
21
- readonly anchorPath?: string;
22
- /** Display label; defaults to the final path segment. */
23
- readonly label?: string;
24
- }
25
- /** Options shared by both root kinds. */
26
- export interface RootOptions {
27
- /** Whether writes under this root are allowed; defaults to true. */
28
- readonly writable?: boolean;
29
- /** Display label override. */
30
- readonly label?: string;
31
- }
32
- /** Create a remote root, validating the connection id and remote path. */
33
- export declare function makeRemoteRoot(connectionId: string, remotePath: string, options?: RootOptions & {
34
- readonly anchorPath?: string;
35
- }): RootRef;
36
- /**
37
- * Create a local root from an absolute host path.
38
- *
39
- * The stored path **preserves the caller's case** (only separators, `.`/`..` and the drive letter
40
- * are canonicalised). Case folding belongs to comparison and keying — `rootKey` folds, and
41
- * `localPathContains` folds on request — because the root's path is also what the UI shows and what
42
- * a child process receives via `processPath`.
43
- */
44
- export declare function makeLocalRoot(path: string, options?: RootOptions): RootRef;
45
- /** Whether a host path is absolute in either the Windows or the POSIX spelling. */
46
- export declare function isAbsoluteLocalPath(path: string): boolean;
47
- /**
48
- * Normalize a host path for comparison: separators to `/`, `.`/`..` resolved, trailing
49
- * separators dropped, and (optionally) the drive letter and case folded.
50
- *
51
- * @param path - host path in either separator spelling.
52
- * @param options - `caseInsensitive` folds case for comparison keys.
53
- * @returns the normalized path.
54
- */
55
- export declare function normalizeLocalPath(path: string, options?: {
56
- readonly caseInsensitive?: boolean;
57
- }): string;
58
- /** Whether a host path is `root` itself or a descendant of it. */
59
- export declare function localPathContains(root: string, candidate: string, options?: {
60
- readonly caseInsensitive?: boolean;
61
- }): boolean;
62
- /** Stable identity of a root, used as a cache/route key. */
63
- export declare function rootKey(root: RootRef): string;
64
- /** The model-facing and UI-facing spelling of a root's directory. */
65
- export declare function rootDisplay(root: RootRef): string;
66
- /** The display label of a root: explicit label, else the final path segment. */
67
- export declare function rootLabel(root: RootRef): string;
68
- /** Whether two roots of the same location overlap (one contains the other). */
69
- export declare function rootsOverlap(left: RootRef, right: RootRef): boolean;
70
- /** Validate a root reference produced outside this module. */
71
- export declare function validateRoot(root: RootRef): void;
72
- /** FNV-1a (32-bit) over UTF-16 code units, rendered as 8 lowercase hex characters. */
73
- export declare function fnv1aHex(input: string): string;
74
- //# sourceMappingURL=root.d.ts.map
@@ -1,91 +0,0 @@
1
- /**
2
- * Where a root's **file-level recycle bin** lives, and how to tell whether that place is usable.
3
- *
4
- * The bin used to sit at `<root>/.dsh-remote-workspace/trash` — inside the caller's own repository, so every
5
- * `git status` and `git add .` saw the bytes someone had just "safely deleted". Moving it out is not a matter
6
- * of changing a default (audit 0064 §3): the router refuses any path that is not inside a registered root, so
7
- * the new location has to be *registered* as a root of its own — one that is deliberately **not** listed
8
- * anywhere the user looks. The placement rules live here, as pure functions, because they are the part that
9
- * must be identical for every root and every world.
10
- *
11
- * Two constraints decide the location, and both are hard:
12
- *
13
- * 1. **Same device as the root.** The bin's whole guarantee is "move first, then confirm", and a cross-device
14
- * `rename` is refused outright rather than degraded to a copy (`fs-commands.ts`), because a copy can fail
15
- * half way and leave the bytes neither here nor there. The file-level bin has no copy fallback. So the bin
16
- * must be on the root's own filesystem.
17
- * 2. **Outside the repository, but not somewhere unguessable.** `$HOME` looks tidy and is the wrong answer:
18
- * on the site this plugin was built against the login home is `/home1/<user>` while projects live under
19
- * `/srv` or `/mnt`, which are usually separate mounts (NFS/automount) — so a home-based bin would make
20
- * **every** delete fail with `cross-device`. The root's own **parent** is the closest directory that is
21
- * almost always on the same filesystem.
22
- *
23
- * @module dsh-over-ssh/domain/bin-location
24
- */
25
- import { type RootRef } from './root.ts';
26
- /** The bin directory name used when the caller configures none (`binDir`). */
27
- export declare const DEFAULT_BIN_DIR = ".dsh-over-ssh/trash";
28
- /**
29
- * Bin directory names this plugin used before it was renamed to `dsh-over-ssh`.
30
- *
31
- * Kept as **read sources**, never as write targets: the bin index is the only record of what is recoverable
32
- * and each entry names its bytes by absolute path, so a rename without a migration would leave every already
33
- * deleted file on disk but unreachable. The resolver moves an old bin into {@link DEFAULT_BIN_DIR} the first
34
- * time it sees one (see `bin-root-resolver.ts`).
35
- *
36
- * Both spellings are listed because the bin lived in two places over its lifetime: inside the root, and
37
- * beside it under the root's parent.
38
- */
39
- export declare const LEGACY_BIN_DIRS: readonly [".dsh-remote-workspace/trash"];
40
- /**
41
- * The root's own directory, in the spelling that world uses.
42
- *
43
- * Remote paths are always POSIX and are normalised as such; a local path is normalised by the host's rules
44
- * (which is what makes `D:\work\a` and `D:/work/a` the same directory on Windows).
45
- *
46
- * @param root - the root whose directory is wanted.
47
- * @returns a `/`-separated path.
48
- */
49
- export declare function rootDirectory(root: RootRef): string;
50
- /**
51
- * The bin directory **inside** the root — the historical location, kept as the documented fallback.
52
- *
53
- * @param root - the root being served.
54
- * @param binDir - configured directory name, relative to the root.
55
- * @returns the absolute bin directory.
56
- */
57
- export declare function binRootInsideRoot(root: RootRef, binDir?: string): string;
58
- /**
59
- * A stable, filesystem-safe directory name for one root's bin.
60
- *
61
- * Two roots can share a parent (and even a basename, across connections), so the name carries a hash of the
62
- * root's identity rather than only its last segment. Stable across runs: the bin directory must be findable
63
- * again after a restart, and an unstable name would silently orphan every deleted byte.
64
- *
65
- * @param root - the root being served.
66
- * @returns a name such as `work-1f3a9c02`.
67
- */
68
- export declare function binRootSlug(root: RootRef): string;
69
- /**
70
- * The bin directory **beside** the root, under its parent.
71
- *
72
- * The parent is used rather than `$HOME` because it is almost always the root's own filesystem, which is the
73
- * one property the bin cannot do without. `binDir` keeps its configured name so the plugin's footprint reads
74
- * the same as before; the per-root slug keeps two roots in one parent apart.
75
- *
76
- * @param root - the root being served.
77
- * @param binDir - configured directory name, relative to the parent.
78
- * @returns the absolute bin directory, or `undefined` when the root has no usable parent (it *is* `/`).
79
- */
80
- export declare function binRootBesideRoot(root: RootRef, binDir?: string): string | undefined;
81
- /**
82
- * The directory a same-device check must compare the bin directory against.
83
- *
84
- * The bin is created by the plugin, so on the first delete it may not exist yet; the parent is what has to be
85
- * on the same filesystem, and it always exists (it contains the root).
86
- *
87
- * @param root - the root being served.
88
- * @returns the absolute parent directory, or `undefined` for a root with no parent.
89
- */
90
- export declare function binParentDirectory(root: RootRef): string | undefined;
91
- //# sourceMappingURL=bin-location.d.ts.map
@@ -1,102 +0,0 @@
1
- /**
2
- * The route table: turns a model-facing path into one backend plus a root-relative path.
3
- *
4
- * This is the heart of "one workspace, several roots". Resolution order is deliberate, and
5
- * every branch is a documented rule rather than a heuristic:
6
- *
7
- * 1. `ssh://<connection>/abs` — the explicit remote grammar always wins.
8
- * 2. Anchor match — a path (or the session cwd) under a remote root's local anchor resolves
9
- * to that remote root. The anchor is what makes a remote root a legal DSH workspace.
10
- * 3. Local root containment — absolute host paths, and `cwd`-relative spellings.
11
- * 4. Bare POSIX absolute path matching remote roots — needed because a prompt lists remote
12
- * roots in POSIX spelling; two equally specific remote roots on different connections
13
- * are reported as ambiguous instead of being guessed.
14
- *
15
- * @module dsh-over-ssh/domain/route-table
16
- */
17
- import { SshDevError } from '../errors.ts';
18
- import { type RootRef } from './root.ts';
19
- import { type SessionIdentity } from './session-roots.ts';
20
- /** One resolved route. */
21
- export interface RouteTarget {
22
- /** The root the path belongs to. */
23
- readonly root: RootRef;
24
- /** Root-relative spelling with `/` separators; an empty string means the root itself. */
25
- readonly relativePath: string;
26
- /** Stable backend key; one backend serves all paths of one root. */
27
- readonly backendKey: string;
28
- }
29
- /** Per-call resolution options. */
30
- export interface RouteOptions {
31
- /** Session working directory used for relative spellings. */
32
- readonly cwd?: string;
33
- /**
34
- * Who is asking, when the caller knows more than its cwd (ADR-0013).
35
- *
36
- * The route table never invents this: the fs provider reads it from the session scope the tool dispatcher
37
- * carries down (`integration/session-scope.ts`) and hands it over. `undefined` means "no session identity" —
38
- * the workspace-level rule then stands, which is exactly the behaviour before ADR-0013.
39
- */
40
- readonly session?: SessionIdentity;
41
- /**
42
- * The asking session's own working directory, when the caller did not supply a `cwd`.
43
- *
44
- * Used **only** by the implicit session root (a session's own directory is always readable to it) — never by
45
- * the gate below, which must keep seeing exactly what the platform passed. Synthesising a `cwd` for the gate
46
- * would apply the workspace rule to calls that legitimately carry none, which is the failure ADR-0012 §4
47
- * boundary 2 records (a whole turn lost before the model was called).
48
- */
49
- readonly sessionCwd?: string;
50
- /** Override host-path case folding (defaults to the platform). */
51
- readonly caseInsensitive?: boolean;
52
- }
53
- /** A path resolved to a root, or a diagnostic reason why it could not be. */
54
- export type RouteOutcome = {
55
- readonly ok: true;
56
- readonly target: RouteTarget;
57
- } | {
58
- readonly ok: false;
59
- readonly error: SshDevError;
60
- };
61
- /** Resolution table over an ordered set of roots. */
62
- export declare class RouteTable {
63
- #private;
64
- constructor(roots?: readonly RootRef[], options?: {
65
- readonly caseInsensitive?: boolean;
66
- });
67
- /** Roots in registration order. */
68
- get roots(): readonly RootRef[];
69
- /**
70
- * Register a root.
71
- *
72
- * @param root - root to add.
73
- * @throws SshDevError `ROOT_INVALID` when the root is malformed or already registered.
74
- */
75
- add(root: RootRef): void;
76
- /** Remove a root by its key; returns whether it was present. */
77
- remove(key: string): boolean;
78
- /** Replace every root; throws like {@link add} when any root is invalid. */
79
- reset(roots: readonly RootRef[]): void;
80
- /**
81
- * Resolve a path, then apply the **session gate**.
82
- *
83
- * Two failures wear the same code on purpose: "no root covers this path" and "the root that covers it belongs
84
- * to another session" are both `ROOT_OUTSIDE`, because from the caller's side they are the same fact — this
85
- * session cannot use that path. The message and the `root` detail say which one it was.
86
- *
87
- * @param input - model-facing, host or remote spelling.
88
- * @param options - session cwd (also the session identity, see {@link rootVisibleToSession}) and case folding.
89
- * @returns the resolved route, or a failure carrying `ROOT_OUTSIDE` / `ROOT_AMBIGUOUS`.
90
- */
91
- tryResolve(input: string, options?: RouteOptions): RouteOutcome;
92
- /**
93
- * Resolve a path or throw.
94
- *
95
- * @param input - path to resolve.
96
- * @param options - session cwd and case-folding override.
97
- * @returns the resolved route.
98
- * @throws SshDevError `ROOT_OUTSIDE` or `ROOT_AMBIGUOUS`.
99
- */
100
- resolve(input: string, options?: RouteOptions): RouteTarget;
101
- }
102
- //# sourceMappingURL=route-table.d.ts.map