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,127 +0,0 @@
1
- /**
2
- * 宿主数据通道面:把「连接列表 + 每条连接的传输/降级」暴露成 Typert Remote 端点。
3
- *
4
- * 这一片只解决「宿主 → 客户端」的**只读**通道,契约见 [`doc/02-platform/remote-data-channel.md`](../../../doc/02-platform/remote-data-channel.md)。
5
- * 三条设计约束:
6
- *
7
- * 1. **不出凭据。** 行只挑 `id/host/transport/degraded/note` 五个字段;`ConnectionProfile.auth`
8
- * (`keyPath` / `credentialKey`)、`password`、`alias`、`proxyJump` 一律不进返回值——凭据只经
9
- * `ctx.credentials` 在真正建连时解析。
10
- * 2. **降级必须可见。** 传输决策与 Tier 2 回退原因都变成一行里的 `degraded` + `note`,用户看到的是
11
- * 「为什么慢」,而不是一个沉默的默认值。
12
- * 3. **没有代码生成也不伪造严格契约。** 0.2.0-rc.2 里 `@Remote` 装饰器写下的是一份版本化原型描述符;
13
- * 本仓库的**测试链路**(`node --test` + Node 24 原生类型剥离)不接受装饰器语法,而红线 1 要求每个源
14
- * 文件都有测试,所以这里用 {@link markRemoteMethod} 等价地写下同一份描述符。宿主网关据此走 SRC 兜底
15
- * 路径(`packages/api/gateway/src/index.ts:756-794`),**不需要** `lib/typert.host.js`。
16
- * 代价写清楚了:SRC 描述符的 codec 是 `src-json`,因此只能承载**零入参**方法;带参数的端点必须
17
- * 由 Typert 生成器产出严格描述符,本仓库目前产不出来。
18
- *
19
- * @module dsh-remote-workspace/integration/remote-face
20
- */
21
- import { Service, type Context } from '@deepseek-ai/cordis';
22
- import { type TypertGatewayBinding } from '@deepseek-ai/dsh-typert-protocol';
23
- import type { TransportDecision } from '../app/transport-selector.ts';
24
- import type { ConnectionProfile, TransportKind } from '../domain/connection.ts';
25
- import type { AgentPreflightOutcome } from './agent-preflight.ts';
26
- /**
27
- * 线命名空间。**客户端半有一份同样的常量拷贝**(`src/client/remote.ts`):客户端半与宿主半分属两个
28
- * tsconfig,不能互相 import,所以这一对常量是手工同步的契约,改一处必须改另一处。
29
- */
30
- export declare const SSH_DEV_REMOTE_NAMESPACE = "sshdev";
31
- /** 承载本面的 Cordis 服务键;调用方(插件入口)必须原样注册这个名字。 */
32
- export declare const SSH_DEV_REMOTE_SERVICE = "sshDevRemote";
33
- /** 端点方法名(`sshdev/connections`)。 */
34
- export declare const SSH_DEV_REMOTE_CONNECTIONS_METHOD = "connections";
35
- /** 一条连接在设置页里要显示的东西。**没有凭据字段,也不要加。** */
36
- export interface ConnectionStatusRow {
37
- /** 连接 id(profile 主键)。 */
38
- readonly id: string;
39
- /** 主机名(`ConnectionProfile.host`,不是别名,也不是密钥路径)。 */
40
- readonly host: string;
41
- /** 当前生效的传输;尚未建立过连接时为 `unknown`(选择器只在建连时决策一次)。 */
42
- readonly transport: TransportKind | 'unknown';
43
- /** 是否有降级(传输替换 / Tier 2 回退)。 */
44
- readonly degraded: boolean;
45
- /** 一句给人看的原因:优先降级原因,其次决策说明,最后是「还没连过」。 */
46
- readonly note: string;
47
- }
48
- /** 构建行所需的三个只读事实源;全部注入,所以这个模块可以离线测。 */
49
- export interface ConnectionStatusSource {
50
- /** 当前配置里的全部连接。 */
51
- readonly profiles: () => readonly ConnectionProfile[];
52
- /** 该连接**当前生效**的传输决策;从未建连(或已释放)时返回 `undefined`。 */
53
- readonly decisionFor: (connectionId: string) => TransportDecision | undefined;
54
- /** Tier 2 安装梯子对这条连接的结果,跑过才有。 */
55
- readonly agentOutcomeFor: (connectionId: string) => AgentPreflightOutcome | undefined;
56
- }
57
- /**
58
- * 把三个事实源折叠成面板要显示的行(纯函数)。
59
- *
60
- * @param source - 连接、决策、Tier 2 结果三个读取器。
61
- * @returns 每个连接一行,顺序与 `profiles()` 一致。
62
- */
63
- export declare function buildConnectionStatusRows(source: ConnectionStatusSource): readonly ConnectionStatusRow[];
64
- /**
65
- * 在一个类的 prototype 上登记一个直接调用的 Remote 方法——`@Remote` 装饰器的**可擦除等价物**。
66
- *
67
- * 为什么不用装饰器(两条实测事实):
68
- *
69
- * - `tsc` 本身**不**拒绝它:用本仓库 `tsconfig.json` 的真实选项(含 `erasableSyntaxOnly: true`)编译一个
70
- * 带标准装饰器的类,语法/语义错误为 0 条;
71
- * - **测试链路拒绝它**:Node 24 的原生类型剥离直接报 `SyntaxError`(`node --input-type=module-typescript`
72
- * 试过),而测试运行器就是 `node --test`。红线 1 要求每个源文件都有测试,含装饰器的模块因此无法被任何
73
- * 测试导入。
74
- *
75
- * 这个函数写下的字节与装饰器相同(`version: 1` 描述符,见协议运行时 `lib/index.js:248-268`),并且由
76
- * `tests/remote-face.test.ts` 用真的 `remoteMethods()` 读回来验证——协议包若改了这个属性名,测试先红。
77
- *
78
- * @param prototype - 目标类的 `prototype`。
79
- * @param method - 公开实例方法名(必须真的存在于该 prototype 上)。
80
- */
81
- export declare function markRemoteMethod(prototype: object, method: string): void;
82
- /**
83
- * 数据通道的宿主面。
84
- *
85
- * 方法必须写在类里(原型方法),不能是箭头函数字段:宿主网关的 SRC 路径用
86
- * `Function.prototype.toString()` 解析参数名(`packages/api/gateway/src/index.ts:1434-1468`),
87
- * 原型上的普通方法才有稳定的 `()` 参数表。
88
- */
89
- export declare class SshDevRemoteFace extends Service {
90
- #private;
91
- /** 网关按这个可见绑定把端点认到本服务上(`readBinding`,同文件 1387-1427)。 */
92
- readonly typertRemote: TypertGatewayBinding<this>;
93
- /**
94
- * 注册服务并绑定线命名空间。
95
- *
96
- * @param ctx - 宿主插件上下文(必须已提供 `sshDevConnections` / `sshDevTransports` / `sshDevAgent`)。
97
- * @param source - 三个只读事实源。
98
- */
99
- constructor(ctx: Context, source: ConnectionStatusSource);
100
- /**
101
- * 全部连接及其当前传输状态。
102
- *
103
- * **零入参是刻意的**:SRC 描述符的入参 codec 是 `src-json`,客户端 Remote 挂载时会因为
104
- * 「has no strict codec」拒绝带参数的 SRC 描述符(`packages/api/gateway/src/client/index.ts:790-805`),
105
- * 而零入参的方法不触发那条检查(同文件 449-451 只对 `result.decode` 做严格解码)。
106
- *
107
- * @returns 每个连接一行;返回值里没有任何凭据字段。
108
- */
109
- connections(): Promise<readonly ConnectionStatusRow[]>;
110
- }
111
- declare module '@deepseek-ai/cordis' {
112
- interface Context {
113
- /** 数据通道的宿主面,由 {@link installRemoteFace} 注册(网关按服务键反射调用)。 */
114
- sshDevRemote: SshDevRemoteFace;
115
- }
116
- }
117
- /**
118
- * 安装宿主面:从插件自己提供的三个服务上取事实源。
119
- *
120
- * 用 `ctx.get(name)`(宽松读取)而不是 `ctx.<service>`:即使某个服务没挂上,通道也只是少一行数据,
121
- * 不该让插件在激活期直接抛错。
122
- *
123
- * @param ctx - 宿主插件上下文。
124
- * @returns 已注册的服务实例(调用方通常不需要它)。
125
- */
126
- export declare function installRemoteFace(ctx: Context): SshDevRemoteFace;
127
- //# sourceMappingURL=remote-face.d.ts.map
@@ -1,241 +0,0 @@
1
- /**
2
- * Reading and writing one remote file: `remote_read`, `remote_write`, `remote_edit`.
3
- *
4
- * The pain these close (audit 0053): the only way to look at a remote file was `cat` through `remote_exec`,
5
- * which inherited that tool's 64 KiB per-stream truncation and printed no line numbers — and the only way to
6
- * change one was to run `python`/`sed` through `remote_exec`, which is how a `\n` in a patch string turned
7
- * into a real newline and produced an unterminated string literal that then needed a second repair.
8
- *
9
- * Three decisions worth naming:
10
- *
11
- * - **`remote_read` numbers its lines.** A window is rendered as `${number}: ${text}`, so a caller can name
12
- * a line in a follow-up edit instead of guessing from context. `offset`/`limit` are **lines**, and the
13
- * footer states what was shown and what to ask for next.
14
- * - **`remote_edit` replaces a LITERAL string.** `old` containing the two characters `\` and `n` matches
15
- * exactly those two characters, never a newline; the replacement is spliced in by index, so `$&`, `` $` ``,
16
- * `` $' `` and `$$` inside `new` are inserted verbatim rather than being interpreted (verified:
17
- * `String.prototype.replace` with a string replacement expands all four — `.verify/probe-replace-semantics.mjs`).
18
- * A default edit must match **exactly once**; a non-unique match is refused with the occurrence count, and
19
- * `all: true` is the caller's explicit opt-in to replace every occurrence.
20
- * - **`remote_write` and `remote_edit` are guarded by a version token.** `expectedVersion` comes from a
21
- * previous `remote_read`; when it does not match, the write is refused instead of clobbering an edit
22
- * somebody else made in between. The comparison is done by the backend, which knows how each tier spells
23
- * its version (the Tier 2 agent reports `size:mtimeNs`, the ssh transports report `size:seconds` and
24
- * verify a digest), so the tool never has to assume one spelling.
25
- *
26
- * Every path goes through `resolveUnderRoot`, the same one rule the rest of the tool family uses: an
27
- * absolute path outside the root is refused by name, and a relative one is resolved against the root.
28
- *
29
- * @module dsh-remote-workspace/integration/remote-file-tools
30
- */
31
- import type { Context } from '@deepseek-ai/cordis';
32
- import { type ToolDefinition } from '@deepseek-ai/dsh-tools';
33
- import type { Backend } from '../app/backend.ts';
34
- /** Default number of lines one read returns. */
35
- export declare const DEFAULT_READ_LINES = 2000;
36
- /** Hard cap on the number of lines one read returns. */
37
- export declare const MAX_READ_LINES = 5000;
38
- /** Default maximum characters returned for a single line. */
39
- export declare const DEFAULT_MAX_LINE_LENGTH = 2000;
40
- /**
41
- * Byte cap applied to the whole file read that feeds a window.
42
- *
43
- * Pinned to the transport's own default read cap (`DEFAULT_MAX_READ_BYTES`): asking for more would only make
44
- * the transport truncate instead, and the truncation would then be reported one layer deeper where the
45
- * renderer cannot see it.
46
- */
47
- export declare const MAX_READ_FILE_BYTES: number;
48
- /** The remote root one file call targets. */
49
- export interface RemoteFileTarget {
50
- readonly connectionId: string;
51
- readonly root: string;
52
- /** Whether the root admits writes; `false` refuses every write tool before it touches the host. */
53
- readonly writable: boolean;
54
- }
55
- /** One read window request, after validation. */
56
- export interface ReadWindowRequest {
57
- /** 1-based first line. */
58
- readonly offset: number;
59
- /** Maximum number of lines. */
60
- readonly limit: number;
61
- /** Maximum characters per returned line. */
62
- readonly maxLineLength: number;
63
- }
64
- /** One numbered line of a window. */
65
- export interface ReadLine {
66
- /** 1-based line number **in the file**. */
67
- readonly number: number;
68
- readonly text: string;
69
- }
70
- /** The window {@link buildLineWindow} produces. */
71
- export interface LineWindow {
72
- readonly lines: readonly ReadLine[];
73
- /** Lines counted in the text that was read; **not** the file's total when `sourceTruncated` is true. */
74
- readonly totalLines: number;
75
- /** Whether the byte cap cut the scan short, so `totalLines` is a lower bound. */
76
- readonly truncatedByBytes: boolean;
77
- }
78
- /** What the file tools need from a backend, injected so the definitions stay testable. */
79
- export interface RemoteFileBackend {
80
- /** Resolve an agent working directory to a remote root. */
81
- resolve(cwd: string): RemoteFileTarget | undefined;
82
- /**
83
- * The whole-file read cap this backend actually applies, in bytes.
84
- *
85
- * Exposed because the refusal messages name the cap, and a deployment may override it: a message quoting
86
- * the default while the backend applied a different one would send the caller to the wrong number.
87
- */
88
- readonly maxReadBytes: number;
89
- /** Read one root-absolute file as text, capped by the backend's own limit. */
90
- read(target: RemoteFileTarget, absolute: string, signal: AbortSignal): Promise<{
91
- readonly text: string;
92
- readonly size: number;
93
- readonly truncated: boolean;
94
- readonly version: string;
95
- }>;
96
- /**
97
- * Write one root-absolute file as text.
98
- *
99
- * @param expectedVersion - when non-empty, the write must fail if the current version differs.
100
- */
101
- write(target: RemoteFileTarget, absolute: string, text: string, expectedVersion: string | undefined, signal: AbortSignal): Promise<{
102
- readonly bytes: number;
103
- readonly version: string;
104
- }>;
105
- /**
106
- * Change one file's permission bits, after a write.
107
- *
108
- * @param mode - 3- or 4-digit octal string (already normalized by `fileModeArg`).
109
- */
110
- chmod(target: RemoteFileTarget, absolute: string, mode: string, signal: AbortSignal): Promise<void>;
111
- }
112
- /** What the backend needs from its owner. All injected, so it is testable without a real host. */
113
- export interface RemoteFileBackendDeps {
114
- /** Resolve a caller's working directory to a remote root. */
115
- readonly resolveRoot: (cwd: string) => RemoteFileTarget | undefined;
116
- /**
117
- * The backend serving one target.
118
- *
119
- * `undefined` means the root outlived its backend (the connection was removed), which is refused rather
120
- * than served by some other host's backend.
121
- */
122
- readonly backendFor: (target: RemoteFileTarget) => Backend | undefined;
123
- /** Override the whole-file read cap. */
124
- readonly maxReadBytes?: number;
125
- }
126
- /**
127
- * Build the file backend the entry registers.
128
- *
129
- * @param deps - injected host wiring.
130
- * @returns the backend consumed by {@link registerRemoteFileTools}.
131
- */
132
- export declare function createRemoteFileBackend(deps: RemoteFileBackendDeps): RemoteFileBackend;
133
- /**
134
- * Build one line window from a file's text.
135
- *
136
- * The scan always walks the whole text so `totalLines` is exact for what was read — the alternative (stop at
137
- * `limit`) would make the footer's "of N lines" a lie, and that number is what tells the caller whether to
138
- * page on. A line over `maxLineLength` is truncated **in place** rather than dropped, because dropping it
139
- * would silently renumber the window.
140
- *
141
- * @param source - the file text as read.
142
- * @param request - the validated window.
143
- * @returns the numbered lines plus the total line count of `source`.
144
- */
145
- export declare function buildLineWindow(source: string, request: ReadWindowRequest): LineWindow;
146
- /** The read value as rendered: the window plus what the read learned about the file. */
147
- export interface ReadView {
148
- /** Root-absolute path that was read. */
149
- readonly path: string;
150
- /** 1-based first line requested. */
151
- readonly offset: number;
152
- readonly lines: readonly ReadLine[];
153
- /** Exact line count of the file when the whole file was read; a lower bound when `sourceTruncated`. */
154
- readonly totalLines: number;
155
- /** The whole-file read was cut by the byte cap, so the window may be missing later lines. */
156
- readonly sourceTruncated: boolean;
157
- /** The byte cap that produced `sourceTruncated`, as the backend actually applied it. */
158
- readonly maxReadBytes: number;
159
- readonly size: number;
160
- /** Version token to pass to `remote_write` / `remote_edit` as `expectedVersion`. */
161
- readonly version: string;
162
- readonly limit: number;
163
- }
164
- /**
165
- * Model-facing rendering of one read window.
166
- *
167
- * The numbered lines and the footer mirror the platform's own `read` tool (`formatReadOutput`): a caller that
168
- * has used that tool already knows how to page with the footer's `offset=…`, and the last line number tells
169
- * it exactly which line it just saw.
170
- *
171
- * @param view - the read to render.
172
- * @returns the model-facing text block body.
173
- */
174
- export declare function formatRead(view: ReadView): string;
175
- /** The outcome of applying one literal edit. */
176
- export interface LiteralEditResult {
177
- readonly text: string;
178
- /** How many occurrences were replaced. */
179
- readonly replacements: number;
180
- /** How many occurrences the literal `old` had in the file. */
181
- readonly occurrences: number;
182
- }
183
- /**
184
- * Replace a literal string inside `text`.
185
- *
186
- * Two properties are the whole point of this function, and both are pinned by tests:
187
- *
188
- * - **The match is literal.** `old` is compared as text; a backslash-n in `old` matches a backslash and an
189
- * `n`, never a newline. The caller writes real newlines when it means newlines.
190
- * - **The replacement is verbatim.** The new text is spliced in by index, so `$&`, `` $` ``, `$'` and `$$`
191
- * inside `new` are inserted as those characters. `String.prototype.replace` with a string replacement
192
- * would expand all four, silently corrupting any patch that mentions a shell variable.
193
- *
194
- * @param source - the current file text.
195
- * @param request - `old`, `new` and the `all` opt-in.
196
- * @returns the new text plus the occurrence and replacement counts.
197
- * @throws Error when `old` is empty, absent, or ambiguous without `all`.
198
- */
199
- export declare function applyLiteralEdit(source: string, request: {
200
- readonly old: string;
201
- readonly new: string;
202
- readonly all: boolean;
203
- }): LiteralEditResult;
204
- /** The edit value as rendered. */
205
- export interface EditView {
206
- readonly path: string;
207
- readonly replacements: number;
208
- readonly occurrences: number;
209
- readonly version: string;
210
- readonly bytes: number;
211
- readonly all: boolean;
212
- }
213
- /** Model-facing rendering of one edit. */
214
- export declare function formatEdit(view: EditView): string;
215
- /** The write value as rendered. */
216
- export interface WriteView {
217
- readonly path: string;
218
- readonly bytes: number;
219
- readonly version: string;
220
- readonly guarded: boolean;
221
- /** The permission bits applied, when the caller asked for any. */
222
- readonly mode?: string | undefined;
223
- }
224
- /** Model-facing rendering of one write. */
225
- export declare function formatWrite(view: WriteView): string;
226
- /**
227
- * Build the three file definitions.
228
- *
229
- * @param backend - injected implementations.
230
- * @returns the definitions, ready for `ctx.tools.register`.
231
- */
232
- export declare function remoteFileToolDefinitions(backend: RemoteFileBackend): ToolDefinition[];
233
- /**
234
- * Register the three file tools on one context.
235
- *
236
- * @param ctx - host context with the `tools` service.
237
- * @param backend - injected implementations.
238
- * @returns a disposer removing every registration (idempotent).
239
- */
240
- export declare function registerRemoteFileTools(ctx: Context, backend: RemoteFileBackend): () => void;
241
- //# sourceMappingURL=remote-file-tools.d.ts.map
@@ -1,69 +0,0 @@
1
- /**
2
- * Resolve a connection's **home directory** on the remote host.
3
- *
4
- * Why this exists: the directory browser used to start remote listings at `/` (the filesystem root), which is
5
- * almost never what someone adding a remote folder wants — and on a shared server it shows every other
6
- * account's home. The obvious "fix" of spelling `home/<user>` is **wrong**, and this host proves it: the login
7
- * user's home is `/home1/yezhiyuan` while `/home/yezhiyuan` does not exist, because the site spreads accounts
8
- * across `/home`, `/home1`, `/home2`, … (an NFS/automount convention). Only the host can answer the question,
9
- * so the answer is **probed, never guessed**.
10
- *
11
- * Precedence, highest first:
12
- *
13
- * 1. `remoteDefaultRoot` from the connection's own configuration — an explicit choice always wins.
14
- * 2. A probe of the login user's home (`printf %s "$HOME"`), run over the connection's transport.
15
- * 3. `/`, the old behaviour, when the probe cannot answer (a transport without command execution, a shell
16
- * that prints nothing, a path that is not absolute). Degrading to the previous behaviour keeps a browse
17
- * surface usable instead of empty.
18
- *
19
- * Results are cached per connection: the answer is a property of the account, not of the moment, and browsing
20
- * re-asks on every level change. {@link RemoteHomeResolver.forget} drops one entry when a connection changes.
21
- *
22
- * @module dsh-remote-workspace/integration/remote-home
23
- */
24
- /** The fallback every path of last resort uses. */
25
- export declare const REMOTE_ROOT_FALLBACK = "/";
26
- /** Options for {@link createRemoteHomeResolver}. */
27
- export interface RemoteHomeResolverOptions {
28
- /**
29
- * Probe the login user's home over the connection's transport.
30
- *
31
- * @returns the absolute path, or `undefined` when the host could not answer.
32
- */
33
- readonly probe: (connectionId: string) => Promise<string | undefined>;
34
- /** The connection's configured `remoteDefaultRoot`, when it has one. */
35
- readonly configuredRoot?: (connectionId: string) => string | undefined;
36
- }
37
- /** The resolver the route calls. */
38
- export interface RemoteHomeResolver {
39
- /**
40
- * The directory a remote browse should start at.
41
- *
42
- * @param connectionId - the connection to resolve for.
43
- * @returns an absolute path; never empty, and never throws (failures degrade to `/`).
44
- */
45
- resolve(connectionId: string): Promise<string>;
46
- /** Drop one connection's cached answer (its profile changed, or it was removed). */
47
- forget(connectionId: string): void;
48
- /** Drop every cached answer. */
49
- disposeAll(): void;
50
- }
51
- /**
52
- * Whether a string is usable as a remote directory to list.
53
- *
54
- * The same fence the route applies to client-supplied paths: absolute, and no `..` segment. A probe that
55
- * answers something else (a shell banner, a relative path, a trailing newline artefact) must not become the
56
- * listing target.
57
- *
58
- * @param value - candidate path.
59
- * @returns the normalised path, or `undefined` when it is unusable.
60
- */
61
- export declare function normalizeRemoteDir(value: string | undefined): string | undefined;
62
- /**
63
- * Build the resolver.
64
- *
65
- * @param options - injected probe and configuration reader.
66
- * @returns the resolver.
67
- */
68
- export declare function createRemoteHomeResolver(options: RemoteHomeResolverOptions): RemoteHomeResolver;
69
- //# sourceMappingURL=remote-home.d.ts.map
@@ -1,165 +0,0 @@
1
- /**
2
- * The remote file index behind `@` completion.
3
- *
4
- * Requirement FR-2.5 asks for completion over a remote root: prefer `git ls-files` (fast, respects
5
- * `.gitignore`), fall back to a **bounded** `find` on hosts without git (our benchmark host has no git),
6
- * cache the result, and keep a 900 ms budget so typing never stalls.
7
- *
8
- * Two tiers serve it, and the choice is reported rather than hidden:
9
- *
10
- * - **Tier 2** (`agentScan`) runs the agent's `index.scan`, which measured ~0.16 ms/file on a real host;
11
- * - **Tier 1** runs one shell command over the transport (measured 187–248 ms for 2000 files).
12
- *
13
- * Budgets are enforced by passing them down (`timeoutMs`), not by hoping: an over-budget result comes back
14
- * with `timedOut: true` and whatever was enumerated, so the UI can show partial completion instead of
15
- * freezing. Nothing here silently returns a short list as if it were complete.
16
- *
17
- * @module dsh-remote-workspace/integration/remote-index
18
- */
19
- import { type RemoteCapabilities } from '../domain/capability.ts';
20
- /** Where a result came from. */
21
- export type IndexSource = 'agent-index' | 'git-ls-files' | 'find-bounded' | 'cache';
22
- /** What the index needs from the two tiers. All injected, so this module stays offline-testable. */
23
- export interface RemoteIndexTiers {
24
- /** Tier 2: the agent's `index.scan`. Absent when the connection has no agent. */
25
- readonly agentScan?: (root: string, options: {
26
- readonly maxEntries: number;
27
- readonly timeoutMs: number;
28
- readonly signal?: AbortSignal;
29
- }) => Promise<{
30
- readonly paths: readonly string[];
31
- readonly strategy: string;
32
- readonly truncated: boolean;
33
- }>;
34
- /**
35
- * Tier 2: the agent's `index.refresh` (incremental).
36
- *
37
- * Only useful **after** a scan the agent still holds a snapshot for; the agent falls back to a full scan
38
- * on its own when it cannot refresh, so a caller may always prefer this once it has scanned once. A
39
- * transport that predates the method reports `REMOTE_UNSUPPORTED`, which this module treats as "use
40
- * agentScan" — never as a failed completion.
41
- */
42
- readonly agentRefresh?: (root: string, options: {
43
- readonly maxEntries: number;
44
- readonly timeoutMs: number;
45
- readonly signal?: AbortSignal;
46
- }) => Promise<{
47
- readonly paths: readonly string[];
48
- readonly strategy: string;
49
- readonly truncated: boolean;
50
- }>;
51
- /** Tier 1: one shell command over the transport. */
52
- readonly exec: (command: string, options: {
53
- readonly timeoutMs: number;
54
- readonly maxBytes: number;
55
- readonly signal?: AbortSignal;
56
- }) => Promise<{
57
- readonly exitCode: number;
58
- readonly stdout: string;
59
- readonly stderr: string;
60
- readonly truncated?: boolean;
61
- }>;
62
- /** Tier 1 capability facts, used to pick the enumeration command. */
63
- readonly capabilities: () => Promise<RemoteCapabilities>;
64
- }
65
- /** Options for {@link RemoteIndex}. */
66
- export interface RemoteIndexOptions {
67
- readonly tiers: RemoteIndexTiers;
68
- /** How long an enumerated root stays usable. Default 30 s. */
69
- readonly ttlMs?: number;
70
- /** How many roots to keep. Default 8. */
71
- readonly maxRoots?: number;
72
- /**
73
- * Cap for the "already scanned" hint set (default {@link DEFAULTS.maxScannedRoots}).
74
- *
75
- * Exposed so a test can drive the bound with a small number instead of allocating 257 roots.
76
- */
77
- readonly maxScannedRoots?: number;
78
- /** Default enumeration budget. Default 900 ms (FR-2.5). */
79
- readonly budgetMs?: number;
80
- /** Default entry cap. Default 20 000. */
81
- readonly maxEntries?: number;
82
- /** Injectable clock, for the TTL and the budget assertions. */
83
- readonly now?: () => number;
84
- }
85
- /** One enumeration result. */
86
- export interface IndexResult {
87
- readonly paths: readonly string[];
88
- readonly source: IndexSource;
89
- /** The agent's own strategy string, when Tier 2 served it (`find-bounded`, `git`, …). */
90
- readonly agentStrategy?: string;
91
- readonly truncated: boolean;
92
- /** True when the enumeration stopped because the budget ran out. */
93
- readonly timedOut: boolean;
94
- /**
95
- * Whether the result was cached.
96
- *
97
- * `false` only for an enumeration that never completed (killed at the deadline, connection lost): such a
98
- * result must not be remembered, while a slow-but-successful one must be — the whole point of the cache
99
- * is to spare the *next* keystroke, and throwing away a good list because it took 1.2 s would mean
100
- * re-running it for every keystroke (found by the real-host measurement).
101
- */
102
- readonly cacheable: boolean;
103
- readonly ms: number;
104
- readonly cached: boolean;
105
- }
106
- /** One completion request. */
107
- export interface CompletionRequest {
108
- readonly root: string;
109
- /** What the user has typed after `@`. */
110
- readonly query: string;
111
- readonly limit?: number;
112
- readonly budgetMs?: number;
113
- readonly signal?: AbortSignal;
114
- }
115
- /** One completion result. */
116
- export interface CompletionResult {
117
- readonly matches: readonly string[];
118
- readonly source: IndexSource;
119
- readonly truncated: boolean;
120
- readonly timedOut: boolean;
121
- readonly ms: number;
122
- readonly cached: boolean;
123
- }
124
- /** Enumerates a remote root, with TTL caching, ranking and budget accounting. */
125
- export declare class RemoteIndex {
126
- #private;
127
- constructor(options: RemoteIndexOptions);
128
- /** Enumerate one root (or serve it from cache while fresh). */
129
- enumerate(root: string, options?: {
130
- readonly maxEntries?: number;
131
- readonly budgetMs?: number;
132
- readonly force?: boolean;
133
- readonly signal?: AbortSignal;
134
- }): Promise<IndexResult>;
135
- /**
136
- * Completion for a partially typed `@` query.
137
- *
138
- * Ranking is deliberate and cheap: a basename prefix match beats a path prefix match, which beats a
139
- * substring match — so typing `@main` prefers `main.ts` over `src/domain/main-helper.ts`.
140
- */
141
- complete(request: CompletionRequest): Promise<CompletionResult>;
142
- /** Drop one root (its files changed) or everything. */
143
- invalidate(root?: string): void;
144
- /** Whether a root is currently cached and fresh (used by tests and by the status UI). */
145
- isFresh(root: string): boolean;
146
- }
147
- /**
148
- * `git ls-files` for one root.
149
- *
150
- * `--cached --others --exclude-standard` lists tracked and untracked-but-not-ignored files, which is what
151
- * completion should offer; `head -n` bounds the output before it crosses the wire.
152
- */
153
- export declare function gitCommand(root: string, maxEntries: number): string;
154
- /** Bounded `find` for hosts without git (the benchmark host): files only, no `.git` internals. */
155
- export declare function findCommand(root: string, maxEntries: number): string;
156
- /**
157
- * Rank paths for a partially typed query.
158
- *
159
- * @param paths - enumerated paths (absolute or root-relative; both work).
160
- * @param query - what the user typed; empty means "show the shallowest entries first".
161
- * @param limit - maximum matches.
162
- * @returns up to `limit` paths, best first.
163
- */
164
- export declare function rankMatches(paths: readonly string[], query: string, limit: number): readonly string[];
165
- //# sourceMappingURL=remote-index.d.ts.map