dsh-over-ssh 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -2
  3. package/agents/agent-manifest.json +20 -0
  4. package/agents/linux-amd64/dsh-over-ssh-agent +0 -0
  5. package/agents/linux-arm64/dsh-over-ssh-agent +0 -0
  6. package/cordis.patch.yml +84 -0
  7. package/lib/client.js +6611 -0
  8. package/lib/file-references.js +366 -0
  9. package/lib/fs.js +1368 -0
  10. package/lib/index.js +19034 -0
  11. package/lib/local-bridge-refs.js +16 -0
  12. package/lib/local-bridge.js +16 -0
  13. package/lib/terminal-wrapper.js +294 -0
  14. package/lib/types/src/client/controls.d.ts +131 -0
  15. package/lib/types/src/client/core/card-focus-trap.d.ts +45 -0
  16. package/lib/types/src/client/core/controls.d.ts +164 -0
  17. package/lib/types/src/client/core/latest.d.ts +48 -0
  18. package/lib/types/src/client/core/locale.d.ts +38 -0
  19. package/lib/types/src/client/core/message.d.ts +37 -0
  20. package/lib/types/src/client/core/panel-model.d.ts +134 -0
  21. package/lib/types/src/client/core/portal.d.ts +266 -0
  22. package/lib/types/src/client/core/remote.d.ts +84 -0
  23. package/lib/types/src/client/core/styles.d.ts +458 -0
  24. package/lib/types/src/client/file-tree-io.d.ts +19 -0
  25. package/lib/types/src/client/file-tree.d.ts +271 -0
  26. package/lib/types/src/client/flows/directory-browser.d.ts +587 -0
  27. package/lib/types/src/client/flows/session-directory.d.ts +415 -0
  28. package/lib/types/src/client/flows/workspace-directory-flow.d.ts +480 -0
  29. package/lib/types/src/client/index.d.ts +49 -0
  30. package/lib/types/src/client/locale.d.ts +31 -0
  31. package/lib/types/src/client/panel-model.d.ts +37 -0
  32. package/lib/types/src/client/panel.d.ts +77 -0
  33. package/lib/types/src/client/roots/connection-test.d.ts +69 -0
  34. package/lib/types/src/client/roots/roots-panel-state.d.ts +307 -0
  35. package/lib/types/src/client/roots/roots-panel-view.d.ts +280 -0
  36. package/lib/types/src/client/roots/roots-panel.d.ts +364 -0
  37. package/lib/types/src/client/roots/transfer-panel-view.d.ts +35 -0
  38. package/lib/types/src/client/roots/transfer-panel.d.ts +241 -0
  39. package/lib/types/src/client/roots/transfer-progress.d.ts +67 -0
  40. package/lib/types/src/client/roots-panel-view.d.ts +236 -0
  41. package/lib/types/src/client/roots-panel.d.ts +347 -0
  42. package/lib/types/src/client/session/session-panel-view.d.ts +336 -0
  43. package/lib/types/src/client/session/session-panel.d.ts +322 -0
  44. package/lib/types/src/client/session/session-remote-mark.d.ts +110 -0
  45. package/lib/types/src/client/session/session-row-actions.d.ts +398 -0
  46. package/lib/types/src/client/session-panel.d.ts +152 -0
  47. package/lib/types/src/client/styles.d.ts +252 -0
  48. package/lib/types/src/client/workspace-directory-flow.d.ts +342 -0
  49. package/lib/types/src/config.d.ts +312 -0
  50. package/lib/types/src/file-references.d.ts +25 -0
  51. package/lib/types/src/fs.d.ts +46 -0
  52. package/lib/types/src/host/app/backend.d.ts +170 -0
  53. package/lib/types/src/host/app/recycle-bin/recycle-bin-contract.d.ts +247 -0
  54. package/lib/types/src/host/app/recycle-bin/recycle-bin-move.d.ts +18 -0
  55. package/lib/types/src/host/app/recycle-bin/recycle-bin-service.d.ts +45 -0
  56. package/lib/types/src/host/app/recycle-bin/recycle-bin-world.d.ts +38 -0
  57. package/lib/types/src/host/app/recycle-bin-contract.d.ts +215 -0
  58. package/lib/types/src/host/app/recycle-bin-move.d.ts +18 -0
  59. package/lib/types/src/host/app/recycle-bin-service.d.ts +45 -0
  60. package/lib/types/src/host/app/recycle-bin-world.d.ts +35 -0
  61. package/lib/types/src/host/app/roots/roots-api-connections.d.ts +49 -0
  62. package/lib/types/src/host/app/roots/roots-api-contract.d.ts +369 -0
  63. package/lib/types/src/host/app/roots/roots-api-directories.d.ts +13 -0
  64. package/lib/types/src/host/app/roots/roots-api-http.d.ts +77 -0
  65. package/lib/types/src/host/app/roots/roots-api-long-poll.d.ts +130 -0
  66. package/lib/types/src/host/app/roots/roots-api-projections.d.ts +102 -0
  67. package/lib/types/src/host/app/roots/roots-api-roots.d.ts +13 -0
  68. package/lib/types/src/host/app/roots/roots-api-state.d.ts +22 -0
  69. package/lib/types/src/host/app/roots/roots-api-transfers.d.ts +26 -0
  70. package/lib/types/src/host/app/roots/roots-api.d.ts +55 -0
  71. package/lib/types/src/host/app/roots/user-roots.d.ts +552 -0
  72. package/lib/types/src/host/app/roots-api-connections.d.ts +49 -0
  73. package/lib/types/src/host/app/roots-api-contract.d.ts +339 -0
  74. package/lib/types/src/host/app/roots-api-directories.d.ts +13 -0
  75. package/lib/types/src/host/app/roots-api-http.d.ts +77 -0
  76. package/lib/types/src/host/app/roots-api-projections.d.ts +102 -0
  77. package/lib/types/src/host/app/roots-api-roots.d.ts +13 -0
  78. package/lib/types/src/host/app/roots-api-state.d.ts +22 -0
  79. package/lib/types/src/host/app/roots-api-support.d.ts +182 -0
  80. package/lib/types/src/host/app/roots-api-transfers.d.ts +13 -0
  81. package/lib/types/src/host/app/roots-api.d.ts +55 -0
  82. package/lib/types/src/host/app/routed-fs.d.ts +239 -0
  83. package/lib/types/src/host/app/serialize.d.ts +37 -0
  84. package/lib/types/src/host/app/session-admin/session-admin-context.d.ts +36 -0
  85. package/lib/types/src/host/app/session-admin/session-admin-contract.d.ts +221 -0
  86. package/lib/types/src/host/app/session-admin/session-admin-delete.d.ts +34 -0
  87. package/lib/types/src/host/app/session-admin/session-admin-service.d.ts +40 -0
  88. package/lib/types/src/host/app/session-admin-context.d.ts +36 -0
  89. package/lib/types/src/host/app/session-admin-contract.d.ts +214 -0
  90. package/lib/types/src/host/app/session-admin-delete.d.ts +34 -0
  91. package/lib/types/src/host/app/session-admin-service.d.ts +38 -0
  92. package/lib/types/src/host/app/takeover/takeover-plan.d.ts +227 -0
  93. package/lib/types/src/host/app/takeover/takeover-rows.d.ts +55 -0
  94. package/lib/types/src/host/app/transport/transport-selector.d.ts +98 -0
  95. package/lib/types/src/host/app/transport/transport-service.d.ts +82 -0
  96. package/lib/types/src/host/app/transport-selector.d.ts +98 -0
  97. package/lib/types/src/host/app/transport-service.d.ts +75 -0
  98. package/lib/types/src/host/app/user-roots.d.ts +461 -0
  99. package/lib/types/src/host/domain/bin-location.d.ts +79 -0
  100. package/lib/types/src/host/domain/capability.d.ts +78 -0
  101. package/lib/types/src/host/domain/connection.d.ts +95 -0
  102. package/lib/types/src/host/domain/errors.d.ts +55 -0
  103. package/lib/types/src/host/domain/glob-pattern.d.ts +62 -0
  104. package/lib/types/src/host/domain/literal-text.d.ts +63 -0
  105. package/lib/types/src/host/domain/path-grammar.d.ts +84 -0
  106. package/lib/types/src/host/domain/recycle-bin.d.ts +337 -0
  107. package/lib/types/src/host/domain/root.d.ts +74 -0
  108. package/lib/types/src/host/domain/roots/bin-location.d.ts +91 -0
  109. package/lib/types/src/host/domain/roots/connection.d.ts +106 -0
  110. package/lib/types/src/host/domain/roots/root.d.ts +108 -0
  111. package/lib/types/src/host/domain/roots/route-table.d.ts +102 -0
  112. package/lib/types/src/host/domain/roots/session-roots.d.ts +151 -0
  113. package/lib/types/src/host/domain/roots/ssh-config.d.ts +73 -0
  114. package/lib/types/src/host/domain/route-table.d.ts +80 -0
  115. package/lib/types/src/host/domain/session/session-admin.d.ts +345 -0
  116. package/lib/types/src/host/domain/session/terminal-target.d.ts +136 -0
  117. package/lib/types/src/host/domain/session-admin.d.ts +330 -0
  118. package/lib/types/src/host/domain/shell.d.ts +47 -0
  119. package/lib/types/src/host/domain/ssh-config.d.ts +73 -0
  120. package/lib/types/src/host/domain/terminal-target.d.ts +132 -0
  121. package/lib/types/src/host/domain/tool-requests.d.ts +369 -0
  122. package/lib/types/src/host/domain/transfer/recycle-bin.d.ts +337 -0
  123. package/lib/types/src/host/domain/transfer/transfer.d.ts +260 -0
  124. package/lib/types/src/host/domain/transfer.d.ts +260 -0
  125. package/lib/types/src/host/infra/backend/local-backend.d.ts +84 -0
  126. package/lib/types/src/host/infra/backend/local-version.d.ts +43 -0
  127. package/lib/types/src/host/infra/backend/platform-local-backend.d.ts +89 -0
  128. package/lib/types/src/host/infra/backend/remote-backend.d.ts +239 -0
  129. package/lib/types/src/host/infra/cache/lru.d.ts +52 -0
  130. package/lib/types/src/host/infra/cache/versioned.d.ts +77 -0
  131. package/lib/types/src/host/infra/temp-name.d.ts +19 -0
  132. package/lib/types/src/host/infra/transport/agent/agent-installer.d.ts +121 -0
  133. package/lib/types/src/host/infra/transport/agent/agent-protocol-client.d.ts +132 -0
  134. package/lib/types/src/host/infra/transport/agent/agent-protocol-codec.d.ts +140 -0
  135. package/lib/types/src/host/infra/transport/agent/agent-protocol-errors.d.ts +41 -0
  136. package/lib/types/src/host/infra/transport/agent/agent-protocol-frames.d.ts +197 -0
  137. package/lib/types/src/host/infra/transport/agent/agent-protocol-types.d.ts +564 -0
  138. package/lib/types/src/host/infra/transport/agent/agent-transport.d.ts +418 -0
  139. package/lib/types/src/host/infra/transport/agent-installer.d.ts +121 -0
  140. package/lib/types/src/host/infra/transport/agent-protocol-client.d.ts +123 -0
  141. package/lib/types/src/host/infra/transport/agent-protocol-codec.d.ts +131 -0
  142. package/lib/types/src/host/infra/transport/agent-protocol-errors.d.ts +41 -0
  143. package/lib/types/src/host/infra/transport/agent-protocol-frames.d.ts +197 -0
  144. package/lib/types/src/host/infra/transport/agent-protocol-types.d.ts +509 -0
  145. package/lib/types/src/host/infra/transport/agent-transport.d.ts +353 -0
  146. package/lib/types/src/host/infra/transport/alias-transport.d.ts +206 -0
  147. package/lib/types/src/host/infra/transport/askpass-fs.d.ts +20 -0
  148. package/lib/types/src/host/infra/transport/askpass.d.ts +133 -0
  149. package/lib/types/src/host/infra/transport/command-pool.d.ts +61 -0
  150. package/lib/types/src/host/infra/transport/fs-commands.d.ts +140 -0
  151. package/lib/types/src/host/infra/transport/git-status-route.d.ts +63 -0
  152. package/lib/types/src/host/infra/transport/git-status.d.ts +101 -0
  153. package/lib/types/src/host/infra/transport/node-spawn.d.ts +26 -0
  154. package/lib/types/src/host/infra/transport/session-window.d.ts +51 -0
  155. package/lib/types/src/host/infra/transport/shell-quote.d.ts +59 -0
  156. package/lib/types/src/host/infra/transport/ssh/alias-transport.d.ts +206 -0
  157. package/lib/types/src/host/infra/transport/ssh/askpass-fs.d.ts +20 -0
  158. package/lib/types/src/host/infra/transport/ssh/askpass.d.ts +133 -0
  159. package/lib/types/src/host/infra/transport/ssh/shell-quote.d.ts +62 -0
  160. package/lib/types/src/host/infra/transport/ssh/ssh-argv.d.ts +43 -0
  161. package/lib/types/src/host/infra/transport/ssh/ssh2-transport.d.ts +328 -0
  162. package/lib/types/src/host/infra/transport/ssh-argv.d.ts +43 -0
  163. package/lib/types/src/host/infra/transport/ssh2-transport.d.ts +302 -0
  164. package/lib/types/src/host/infra/transport/transport-base.d.ts +34 -0
  165. package/lib/types/src/host/infra/transport/transport.d.ts +527 -0
  166. package/lib/types/src/host/integration/agent/agent-install-io.d.ts +33 -0
  167. package/lib/types/src/host/integration/agent/agent-preflight.d.ts +56 -0
  168. package/lib/types/src/host/integration/agent/askpass-registry.d.ts +66 -0
  169. package/lib/types/src/host/integration/agent-install-io.d.ts +33 -0
  170. package/lib/types/src/host/integration/agent-preflight.d.ts +56 -0
  171. package/lib/types/src/host/integration/anchor-directory.d.ts +56 -0
  172. package/lib/types/src/host/integration/askpass-registry.d.ts +59 -0
  173. package/lib/types/src/host/integration/bin-root-resolver.d.ts +81 -0
  174. package/lib/types/src/host/integration/connection-test.d.ts +73 -0
  175. package/lib/types/src/host/integration/file-reference-provider.d.ts +115 -0
  176. package/lib/types/src/host/integration/fs/file-reference-provider.d.ts +142 -0
  177. package/lib/types/src/host/integration/fs/fs-provider.d.ts +368 -0
  178. package/lib/types/src/host/integration/fs/git-status-wiring.d.ts +21 -0
  179. package/lib/types/src/host/integration/fs/platform-errors.d.ts +94 -0
  180. package/lib/types/src/host/integration/fs/remote-file-tools.d.ts +369 -0
  181. package/lib/types/src/host/integration/fs/remote-index.d.ts +177 -0
  182. package/lib/types/src/host/integration/fs-provider.d.ts +226 -0
  183. package/lib/types/src/host/integration/lsp/lsp-framing.d.ts +38 -0
  184. package/lib/types/src/host/integration/lsp/lsp-registry.d.ts +67 -0
  185. package/lib/types/src/host/integration/lsp/lsp-session.d.ts +130 -0
  186. package/lib/types/src/host/integration/management-tools.d.ts +64 -0
  187. package/lib/types/src/host/integration/recycle-bin-service.d.ts +247 -0
  188. package/lib/types/src/host/integration/remote/connection-test.d.ts +73 -0
  189. package/lib/types/src/host/integration/remote/remote-face.d.ts +127 -0
  190. package/lib/types/src/host/integration/remote/remote-tool-backend.d.ts +108 -0
  191. package/lib/types/src/host/integration/remote-face.d.ts +127 -0
  192. package/lib/types/src/host/integration/remote-file-tools.d.ts +241 -0
  193. package/lib/types/src/host/integration/remote-home.d.ts +69 -0
  194. package/lib/types/src/host/integration/remote-index.d.ts +165 -0
  195. package/lib/types/src/host/integration/remote-job-tools.d.ts +295 -0
  196. package/lib/types/src/host/integration/remote-tool-backend.d.ts +97 -0
  197. package/lib/types/src/host/integration/remote-tools.d.ts +206 -0
  198. package/lib/types/src/host/integration/root-registry.d.ts +115 -0
  199. package/lib/types/src/host/integration/roots/anchor-directory.d.ts +56 -0
  200. package/lib/types/src/host/integration/roots/bin-root-resolver.d.ts +81 -0
  201. package/lib/types/src/host/integration/roots/remote-home.d.ts +69 -0
  202. package/lib/types/src/host/integration/roots/root-registry.d.ts +144 -0
  203. package/lib/types/src/host/integration/roots/roots-wiring.d.ts +219 -0
  204. package/lib/types/src/host/integration/roots/session-root-index.d.ts +52 -0
  205. package/lib/types/src/host/integration/roots-api.d.ts +407 -0
  206. package/lib/types/src/host/integration/roots-wiring.d.ts +211 -0
  207. package/lib/types/src/host/integration/session/session-api.d.ts +88 -0
  208. package/lib/types/src/host/integration/session/session-bin-lock.d.ts +80 -0
  209. package/lib/types/src/host/integration/session/session-header.d.ts +151 -0
  210. package/lib/types/src/host/integration/session/session-labels.d.ts +56 -0
  211. package/lib/types/src/host/integration/session/session-route-wiring.d.ts +50 -0
  212. package/lib/types/src/host/integration/session-admin-service.d.ts +236 -0
  213. package/lib/types/src/host/integration/session-api.d.ts +81 -0
  214. package/lib/types/src/host/integration/session-bin-lock.d.ts +80 -0
  215. package/lib/types/src/host/integration/session-header.d.ts +118 -0
  216. package/lib/types/src/host/integration/session-labels.d.ts +56 -0
  217. package/lib/types/src/host/integration/session-route-wiring.d.ts +50 -0
  218. package/lib/types/src/host/integration/session-scope.d.ts +113 -0
  219. package/lib/types/src/host/integration/session-tools.d.ts +44 -0
  220. package/lib/types/src/host/integration/strict-arguments.d.ts +79 -0
  221. package/lib/types/src/host/integration/takeover/takeover-api.d.ts +62 -0
  222. package/lib/types/src/host/integration/takeover/takeover-route-wiring.d.ts +60 -0
  223. package/lib/types/src/host/integration/takeover/takeover-service.d.ts +167 -0
  224. package/lib/types/src/host/integration/terminal-manifest.d.ts +94 -0
  225. package/lib/types/src/host/integration/tools/management-tools.d.ts +245 -0
  226. package/lib/types/src/host/integration/tools/remote-job-tools.d.ts +316 -0
  227. package/lib/types/src/host/integration/tools/remote-lsp-tools.d.ts +43 -0
  228. package/lib/types/src/host/integration/tools/remote-tools.d.ts +236 -0
  229. package/lib/types/src/host/integration/tools/session-target.d.ts +52 -0
  230. package/lib/types/src/host/integration/tools/session-tools.d.ts +46 -0
  231. package/lib/types/src/host/integration/tools/strict-arguments.d.ts +79 -0
  232. package/lib/types/src/host/integration/tools/terminal-manifest.d.ts +94 -0
  233. package/lib/types/src/host/integration/transfer/remote-copy.d.ts +66 -0
  234. package/lib/types/src/host/integration/transfer/transfer-adapters.d.ts +48 -0
  235. package/lib/types/src/host/integration/transfer/transfer-service.d.ts +212 -0
  236. package/lib/types/src/host/integration/transfer/transfer-tracker.d.ts +106 -0
  237. package/lib/types/src/host/integration/transfer-adapters.d.ts +44 -0
  238. package/lib/types/src/host/integration/transfer-service.d.ts +164 -0
  239. package/lib/types/src/host/integration/transfer-tracker.d.ts +106 -0
  240. package/lib/types/src/host/integration/user-roots.d.ts +461 -0
  241. package/lib/types/src/index.d.ts +66 -0
  242. package/lib/types/src/local-bridge-refs.d.ts +26 -0
  243. package/lib/types/src/local-bridge.d.ts +36 -0
  244. package/lib/types/src/shared/format.d.ts +13 -0
  245. package/lib/types/src/wiring/connections.d.ts +189 -0
  246. package/lib/types/src/wiring/fs.d.ts +13 -0
  247. package/lib/types/src/wiring/helpers.d.ts +144 -0
  248. package/lib/types/src/wiring/install-memo.d.ts +32 -0
  249. package/lib/types/src/wiring/legacy-dirs.d.ts +62 -0
  250. package/lib/types/src/wiring/package-paths.d.ts +35 -0
  251. package/lib/types/src/wiring/roots.d.ts +21 -0
  252. package/lib/types/src/wiring/state-dir.d.ts +29 -0
  253. package/lib/types/src/wiring/tools.d.ts +35 -0
  254. package/package.json +120 -4
@@ -0,0 +1,312 @@
1
+ /**
2
+ * The plugin's configuration schema — **the only copy**.
3
+ *
4
+ * ## Why this is its own module
5
+ *
6
+ * The 84-line `z.object({...})` used to exist twice, byte for byte: once as `export const Config` in the entry
7
+ * (`src/index.ts`) and once in `src/wiring/helpers.ts`. Cordis only ever reads the **entry's** `Config`, so the
8
+ * wiring copy was dead as a value — but it still fed `ResolvedConfig`, the type every wiring function takes.
9
+ *
10
+ * That split is the dangerous part: adding a field to one copy and not the other leaves the **type** and the
11
+ * **runtime** disagreeing, and `tsc` stays silent because both copies type-check on their own. The next
12
+ * `config.limits.<newField>` would be `undefined` at runtime while the type says otherwise.
13
+ *
14
+ * Neither file can own it directly — `helpers.ts` importing the entry would make the entry depend on wiring and
15
+ * wiring on the entry. A third module is the only place both can depend on without a cycle.
16
+ *
17
+ * @module dsh-over-ssh/config
18
+ */
19
+ import z from '@deepseek-ai/schemastery';
20
+ /** Validated configuration schema (defaults are the documented defaults). */
21
+ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
22
+ connections: z<({
23
+ id?: string | null;
24
+ name?: string | null;
25
+ host?: string | null;
26
+ port?: number | null;
27
+ user?: string | null;
28
+ transport?: "alias" | "ssh2" | "agent" | null;
29
+ alias?: string | null;
30
+ authKind?: "agent" | "key" | "password" | null;
31
+ keyPath?: string | null;
32
+ credentialKey?: string | null;
33
+ proxyJump?: string[] | null;
34
+ hostKeyPolicy?: "strict" | "accept-new" | null;
35
+ remoteDefaultRoot?: string | null;
36
+ } & import("@deepseek-ai/cosmokit").Dict)[], Schemastery.ObjectT<NoInfer<{
37
+ id: z<string, string, "defined">;
38
+ name: z<string, string, "plain">;
39
+ host: z<string, string, "defined">;
40
+ port: z<number, number, "defined">;
41
+ user: z<string, string, "defined">;
42
+ transport: z<"alias" | "ssh2" | "agent", "alias" | "ssh2" | "agent", "defined">;
43
+ alias: z<string, string, "plain">;
44
+ authKind: z<"agent" | "key" | "password", "agent" | "key" | "password", "defined">;
45
+ keyPath: z<string, string, "plain">;
46
+ credentialKey: z<string, string, "plain">;
47
+ proxyJump: z<string[], string[], "defined">;
48
+ hostKeyPolicy: z<"strict" | "accept-new", "strict" | "accept-new", "defined">;
49
+ remoteDefaultRoot: z<string, string, "plain">;
50
+ }>>[], "defined">;
51
+ roots: z<({
52
+ location?: "local" | "remote" | null;
53
+ path?: string | null;
54
+ connectionId?: string | null;
55
+ label?: string | null;
56
+ writable?: boolean | null;
57
+ anchorPath?: string | null;
58
+ } & import("@deepseek-ai/cosmokit").Dict)[], Schemastery.ObjectT<NoInfer<{
59
+ location: z<"local" | "remote", "local" | "remote", "defined">;
60
+ path: z<string, string, "defined">;
61
+ connectionId: z<string, string, "plain">;
62
+ label: z<string, string, "plain">;
63
+ writable: z<boolean, boolean, "defined">;
64
+ anchorPath: z<string, string, "plain">;
65
+ }>>[], "defined">;
66
+ limits: z<Schemastery.ObjectS<NoInfer<{
67
+ maxReadBytes: z<number, number, "defined">;
68
+ connectTimeoutMs: z<number, number, "defined">;
69
+ commandTimeoutMs: z<number, number, "defined">;
70
+ keepAliveSeconds: z<number, number, "defined">;
71
+ controlDir: z<string, string, "plain">;
72
+ knownHostsFile: z<string, string, "plain">;
73
+ /** Manifest shipped with the package; defaults to `<package>/agents/agent-manifest.json`. */
74
+ agentManifestPath: z<string, string, "plain">;
75
+ /** Remote directory the agent is installed into (under the login user's `$HOME`). */
76
+ agentRemoteDir: z<string, string, "defined">;
77
+ indexTtlMs: z<number, number, "defined">;
78
+ indexMaxEntries: z<number, number, "defined">;
79
+ /**
80
+ * Read-path freshness window (FR-2.7: the requirement names 5 s).
81
+ *
82
+ * `0` disables retention, so every read goes to the host — the honest escape hatch for a host where
83
+ * the clock or the mtime granularity makes `size:seconds` a weak version token.
84
+ */
85
+ readCacheTtlMs: z<number, number, "defined">;
86
+ readCacheMaxEntries: z<number, number, "defined">;
87
+ readCacheMaxBytes: z<number, number, "defined">;
88
+ terminalStateDir: z<string, string, "plain">;
89
+ transferChunkBytes: z<number, number, "defined">;
90
+ /** Chunks in flight at once during a transfer. 1 restores the sequential behaviour. */
91
+ transferConcurrency: z<number, number, "defined">;
92
+ /** How many finished transfers the progress table retains (FR-2.6.4). */
93
+ transferHistoryEntries: z<number, number, "defined">;
94
+ binDir: z<string, string, "defined">;
95
+ binMaxEntries: z<number, number, "defined">;
96
+ binMaxBytes: z<number, number, "defined">;
97
+ binMaxAgeMs: z<number, number, "defined">;
98
+ undoDepth: z<number, number, "defined">;
99
+ rangeChunkBytes: z<number, number, "defined">;
100
+ /** Session store root; defaults to the platform's `~/.dsh/sessions`. */
101
+ sessionsRoot: z<string, string, "plain">;
102
+ /**
103
+ * Session recycle bin root (FR-3.5).
104
+ *
105
+ * **Must not live under {@link sessionsRoot}**: the platform lists every directory under the sessions
106
+ * root and fails the whole listing on a duplicate session id, so a bin there would make deleted
107
+ * sessions reappear. See ADR-0009.
108
+ */
109
+ sessionBinRoot: z<string, string, "plain">;
110
+ sessionBinMaxEntries: z<number, number, "defined">;
111
+ sessionBinMaxBytes: z<number, number, "defined">;
112
+ sessionBinMaxAgeMs: z<number, number, "defined">;
113
+ /** Delete the projection cache alongside the log when true (FR-3.4 step 8). */
114
+ sessionPurgeProjection: z<boolean, boolean, "defined">;
115
+ }>>, Schemastery.ObjectT<NoInfer<{
116
+ maxReadBytes: z<number, number, "defined">;
117
+ connectTimeoutMs: z<number, number, "defined">;
118
+ commandTimeoutMs: z<number, number, "defined">;
119
+ keepAliveSeconds: z<number, number, "defined">;
120
+ controlDir: z<string, string, "plain">;
121
+ knownHostsFile: z<string, string, "plain">;
122
+ /** Manifest shipped with the package; defaults to `<package>/agents/agent-manifest.json`. */
123
+ agentManifestPath: z<string, string, "plain">;
124
+ /** Remote directory the agent is installed into (under the login user's `$HOME`). */
125
+ agentRemoteDir: z<string, string, "defined">;
126
+ indexTtlMs: z<number, number, "defined">;
127
+ indexMaxEntries: z<number, number, "defined">;
128
+ /**
129
+ * Read-path freshness window (FR-2.7: the requirement names 5 s).
130
+ *
131
+ * `0` disables retention, so every read goes to the host — the honest escape hatch for a host where
132
+ * the clock or the mtime granularity makes `size:seconds` a weak version token.
133
+ */
134
+ readCacheTtlMs: z<number, number, "defined">;
135
+ readCacheMaxEntries: z<number, number, "defined">;
136
+ readCacheMaxBytes: z<number, number, "defined">;
137
+ terminalStateDir: z<string, string, "plain">;
138
+ transferChunkBytes: z<number, number, "defined">;
139
+ /** Chunks in flight at once during a transfer. 1 restores the sequential behaviour. */
140
+ transferConcurrency: z<number, number, "defined">;
141
+ /** How many finished transfers the progress table retains (FR-2.6.4). */
142
+ transferHistoryEntries: z<number, number, "defined">;
143
+ binDir: z<string, string, "defined">;
144
+ binMaxEntries: z<number, number, "defined">;
145
+ binMaxBytes: z<number, number, "defined">;
146
+ binMaxAgeMs: z<number, number, "defined">;
147
+ undoDepth: z<number, number, "defined">;
148
+ rangeChunkBytes: z<number, number, "defined">;
149
+ /** Session store root; defaults to the platform's `~/.dsh/sessions`. */
150
+ sessionsRoot: z<string, string, "plain">;
151
+ /**
152
+ * Session recycle bin root (FR-3.5).
153
+ *
154
+ * **Must not live under {@link sessionsRoot}**: the platform lists every directory under the sessions
155
+ * root and fails the whole listing on a duplicate session id, so a bin there would make deleted
156
+ * sessions reappear. See ADR-0009.
157
+ */
158
+ sessionBinRoot: z<string, string, "plain">;
159
+ sessionBinMaxEntries: z<number, number, "defined">;
160
+ sessionBinMaxBytes: z<number, number, "defined">;
161
+ sessionBinMaxAgeMs: z<number, number, "defined">;
162
+ /** Delete the projection cache alongside the log when true (FR-3.4 step 8). */
163
+ sessionPurgeProjection: z<boolean, boolean, "defined">;
164
+ }>>, "defined">;
165
+ }>>, Schemastery.ObjectT<NoInfer<{
166
+ connections: z<({
167
+ id?: string | null;
168
+ name?: string | null;
169
+ host?: string | null;
170
+ port?: number | null;
171
+ user?: string | null;
172
+ transport?: "alias" | "ssh2" | "agent" | null;
173
+ alias?: string | null;
174
+ authKind?: "agent" | "key" | "password" | null;
175
+ keyPath?: string | null;
176
+ credentialKey?: string | null;
177
+ proxyJump?: string[] | null;
178
+ hostKeyPolicy?: "strict" | "accept-new" | null;
179
+ remoteDefaultRoot?: string | null;
180
+ } & import("@deepseek-ai/cosmokit").Dict)[], Schemastery.ObjectT<NoInfer<{
181
+ id: z<string, string, "defined">;
182
+ name: z<string, string, "plain">;
183
+ host: z<string, string, "defined">;
184
+ port: z<number, number, "defined">;
185
+ user: z<string, string, "defined">;
186
+ transport: z<"alias" | "ssh2" | "agent", "alias" | "ssh2" | "agent", "defined">;
187
+ alias: z<string, string, "plain">;
188
+ authKind: z<"agent" | "key" | "password", "agent" | "key" | "password", "defined">;
189
+ keyPath: z<string, string, "plain">;
190
+ credentialKey: z<string, string, "plain">;
191
+ proxyJump: z<string[], string[], "defined">;
192
+ hostKeyPolicy: z<"strict" | "accept-new", "strict" | "accept-new", "defined">;
193
+ remoteDefaultRoot: z<string, string, "plain">;
194
+ }>>[], "defined">;
195
+ roots: z<({
196
+ location?: "local" | "remote" | null;
197
+ path?: string | null;
198
+ connectionId?: string | null;
199
+ label?: string | null;
200
+ writable?: boolean | null;
201
+ anchorPath?: string | null;
202
+ } & import("@deepseek-ai/cosmokit").Dict)[], Schemastery.ObjectT<NoInfer<{
203
+ location: z<"local" | "remote", "local" | "remote", "defined">;
204
+ path: z<string, string, "defined">;
205
+ connectionId: z<string, string, "plain">;
206
+ label: z<string, string, "plain">;
207
+ writable: z<boolean, boolean, "defined">;
208
+ anchorPath: z<string, string, "plain">;
209
+ }>>[], "defined">;
210
+ limits: z<Schemastery.ObjectS<NoInfer<{
211
+ maxReadBytes: z<number, number, "defined">;
212
+ connectTimeoutMs: z<number, number, "defined">;
213
+ commandTimeoutMs: z<number, number, "defined">;
214
+ keepAliveSeconds: z<number, number, "defined">;
215
+ controlDir: z<string, string, "plain">;
216
+ knownHostsFile: z<string, string, "plain">;
217
+ /** Manifest shipped with the package; defaults to `<package>/agents/agent-manifest.json`. */
218
+ agentManifestPath: z<string, string, "plain">;
219
+ /** Remote directory the agent is installed into (under the login user's `$HOME`). */
220
+ agentRemoteDir: z<string, string, "defined">;
221
+ indexTtlMs: z<number, number, "defined">;
222
+ indexMaxEntries: z<number, number, "defined">;
223
+ /**
224
+ * Read-path freshness window (FR-2.7: the requirement names 5 s).
225
+ *
226
+ * `0` disables retention, so every read goes to the host — the honest escape hatch for a host where
227
+ * the clock or the mtime granularity makes `size:seconds` a weak version token.
228
+ */
229
+ readCacheTtlMs: z<number, number, "defined">;
230
+ readCacheMaxEntries: z<number, number, "defined">;
231
+ readCacheMaxBytes: z<number, number, "defined">;
232
+ terminalStateDir: z<string, string, "plain">;
233
+ transferChunkBytes: z<number, number, "defined">;
234
+ /** Chunks in flight at once during a transfer. 1 restores the sequential behaviour. */
235
+ transferConcurrency: z<number, number, "defined">;
236
+ /** How many finished transfers the progress table retains (FR-2.6.4). */
237
+ transferHistoryEntries: z<number, number, "defined">;
238
+ binDir: z<string, string, "defined">;
239
+ binMaxEntries: z<number, number, "defined">;
240
+ binMaxBytes: z<number, number, "defined">;
241
+ binMaxAgeMs: z<number, number, "defined">;
242
+ undoDepth: z<number, number, "defined">;
243
+ rangeChunkBytes: z<number, number, "defined">;
244
+ /** Session store root; defaults to the platform's `~/.dsh/sessions`. */
245
+ sessionsRoot: z<string, string, "plain">;
246
+ /**
247
+ * Session recycle bin root (FR-3.5).
248
+ *
249
+ * **Must not live under {@link sessionsRoot}**: the platform lists every directory under the sessions
250
+ * root and fails the whole listing on a duplicate session id, so a bin there would make deleted
251
+ * sessions reappear. See ADR-0009.
252
+ */
253
+ sessionBinRoot: z<string, string, "plain">;
254
+ sessionBinMaxEntries: z<number, number, "defined">;
255
+ sessionBinMaxBytes: z<number, number, "defined">;
256
+ sessionBinMaxAgeMs: z<number, number, "defined">;
257
+ /** Delete the projection cache alongside the log when true (FR-3.4 step 8). */
258
+ sessionPurgeProjection: z<boolean, boolean, "defined">;
259
+ }>>, Schemastery.ObjectT<NoInfer<{
260
+ maxReadBytes: z<number, number, "defined">;
261
+ connectTimeoutMs: z<number, number, "defined">;
262
+ commandTimeoutMs: z<number, number, "defined">;
263
+ keepAliveSeconds: z<number, number, "defined">;
264
+ controlDir: z<string, string, "plain">;
265
+ knownHostsFile: z<string, string, "plain">;
266
+ /** Manifest shipped with the package; defaults to `<package>/agents/agent-manifest.json`. */
267
+ agentManifestPath: z<string, string, "plain">;
268
+ /** Remote directory the agent is installed into (under the login user's `$HOME`). */
269
+ agentRemoteDir: z<string, string, "defined">;
270
+ indexTtlMs: z<number, number, "defined">;
271
+ indexMaxEntries: z<number, number, "defined">;
272
+ /**
273
+ * Read-path freshness window (FR-2.7: the requirement names 5 s).
274
+ *
275
+ * `0` disables retention, so every read goes to the host — the honest escape hatch for a host where
276
+ * the clock or the mtime granularity makes `size:seconds` a weak version token.
277
+ */
278
+ readCacheTtlMs: z<number, number, "defined">;
279
+ readCacheMaxEntries: z<number, number, "defined">;
280
+ readCacheMaxBytes: z<number, number, "defined">;
281
+ terminalStateDir: z<string, string, "plain">;
282
+ transferChunkBytes: z<number, number, "defined">;
283
+ /** Chunks in flight at once during a transfer. 1 restores the sequential behaviour. */
284
+ transferConcurrency: z<number, number, "defined">;
285
+ /** How many finished transfers the progress table retains (FR-2.6.4). */
286
+ transferHistoryEntries: z<number, number, "defined">;
287
+ binDir: z<string, string, "defined">;
288
+ binMaxEntries: z<number, number, "defined">;
289
+ binMaxBytes: z<number, number, "defined">;
290
+ binMaxAgeMs: z<number, number, "defined">;
291
+ undoDepth: z<number, number, "defined">;
292
+ rangeChunkBytes: z<number, number, "defined">;
293
+ /** Session store root; defaults to the platform's `~/.dsh/sessions`. */
294
+ sessionsRoot: z<string, string, "plain">;
295
+ /**
296
+ * Session recycle bin root (FR-3.5).
297
+ *
298
+ * **Must not live under {@link sessionsRoot}**: the platform lists every directory under the sessions
299
+ * root and fails the whole listing on a duplicate session id, so a bin there would make deleted
300
+ * sessions reappear. See ADR-0009.
301
+ */
302
+ sessionBinRoot: z<string, string, "plain">;
303
+ sessionBinMaxEntries: z<number, number, "defined">;
304
+ sessionBinMaxBytes: z<number, number, "defined">;
305
+ sessionBinMaxAgeMs: z<number, number, "defined">;
306
+ /** Delete the projection cache alongside the log when true (FR-3.4 step 8). */
307
+ sessionPurgeProjection: z<boolean, boolean, "defined">;
308
+ }>>, "defined">;
309
+ }>>, "plain">;
310
+ /** What {@link apply} receives: the schema's resolved output, which is what the loader passes. */
311
+ export type ResolvedConfig = Schemastery.TypeT<typeof Config>;
312
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The `./file-references` entry: the multi-root `ctx.fileReferences` provider.
3
+ *
4
+ * Enabling this module **replaces** the core `dsh-file-reference-local` row (one local workspace) with a
5
+ * provider that also serves remote roots - the same shape as `./fs` replacing `fs-sandbox`. The provider
6
+ * answers for local roots too, so a workspace mixing both kinds stays complete.
7
+ *
8
+ * **Both rows must be switched together.** Cordis refuses a second service with the same name, so enabling
9
+ * this entry while `file-reference-local` is still active used to fail activation and the plugin-manager row
10
+ * showed "异常". A takeover is a composition decision, so this entry now **degrades instead of throwing**:
11
+ * when `fileReferences` is already provided it logs why and leaves the core provider in place. To really take
12
+ * over, disable the core row (see cordis.patch.yml, stage 2) and then enable this one.
13
+ *
14
+ * @module dsh-over-ssh/file-references
15
+ */
16
+ import { Context } from '@deepseek-ai/cordis';
17
+ /**
18
+ * Install the multi-root provider, unless something else already owns `fileReferences`.
19
+ *
20
+ * @param ctx - plugin context.
21
+ * @returns the provider's fiber, or `undefined` when the core provider keeps the service.
22
+ */
23
+ export default function apply(ctx: Context): (import("@deepseek-ai/cordis").Fiber & PromiseLike<import("@deepseek-ai/cordis").Fiber>) | undefined;
24
+ export { RemoteFileReferenceService, DEFAULT_MAX_RESULTS, LOCAL_EXCLUDED_DIRECTORIES, LOCAL_MAX_DEPTH, LOCAL_MAX_ENTRIES, type FileReferenceIndex, type LocalEntry, type RemoteFileReferenceOptions, } from './host/integration/fs/file-reference-provider.ts';
25
+ //# sourceMappingURL=file-references.d.ts.map
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The `./fs` entry: the filesystem provider as a Cordis service package.
3
+ *
4
+ * The composition replaces the core `fs-sandbox` row with this module (see `cordis.patch.yml`), so the
5
+ * model's file tools follow the plugin's router without any consumer change.
6
+ *
7
+ * Two registration shapes exist, and both are exported:
8
+ *
9
+ * - the **class** (`RoutedFsProvider`) — what `ctx.plugin(RoutedFsProvider)` installs; every read keeps the
10
+ * original whole-prefix semantics;
11
+ * - this module's **default function plugin** — it reads `ctx.sshDevRangeReader` when the main entry is
12
+ * loaded and hands it to {@link createRoutedFsProvider}, so a large remote read becomes several bounded
13
+ * offset requests instead of one `[0, end)` prefix read.
14
+ *
15
+ * @module dsh-over-ssh/fs
16
+ */
17
+ import { Context } from '@deepseek-ai/cordis';
18
+ import { RoutedFsProvider, createRoutedFsProvider, toFsError, MAPPED_DOMAIN_CODES, type BackendRangeReader } from './host/integration/fs/fs-provider.ts';
19
+ /** The optional capability the main entry publishes. */
20
+ export interface RangeReaderService {
21
+ readonly readBytesRange: BackendRangeReader;
22
+ readonly rangeChunkBytes?: number;
23
+ }
24
+ declare module '@deepseek-ai/cordis' {
25
+ interface Context {
26
+ /** Offset-read capability for routed backends, present when the main entry is loaded. */
27
+ sshDevRangeReader?: RangeReaderService;
28
+ }
29
+ }
30
+ /**
31
+ * Install the provider, using the chunked read when the capability is available.
32
+ *
33
+ * The capability is read through `ctx.get` instead of being declared in `inject`: the provider must still
34
+ * install when the main entry is absent — it then keeps the old read semantics rather than failing to load.
35
+ *
36
+ * The returned fiber **must be handed back** to the loader. Returning `undefined` here makes Cordis treat
37
+ * the entry as "did nothing": the plugin is installed as a child fiber, but the row never reaches the
38
+ * active state and every consumer waiting on `fs` stays pending forever. The early return below is the
39
+ * only case that legitimately answers nothing (a takeover that another provider already owns).
40
+ *
41
+ * @param ctx - plugin context.
42
+ * @returns the provider plugin's fiber, or `undefined` when the takeover is skipped.
43
+ */
44
+ export default function apply(ctx: Context): (import("@deepseek-ai/cordis").Fiber & PromiseLike<import("@deepseek-ai/cordis").Fiber>) | undefined;
45
+ export { RoutedFsProvider, createRoutedFsProvider, toFsError, MAPPED_DOMAIN_CODES };
46
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1,170 @@
1
+ /**
2
+ * The backend contract: what the router needs from any one root.
3
+ *
4
+ * A "root" is served by exactly one backend: the local disk, or one remote connection's transport.
5
+ * The router (`routed-fs.ts`) never talks to a filesystem directly — it resolves a path to a root
6
+ * and hands the root-absolute path to that backend. That split is what lets one workspace mix local
7
+ * and remote roots (ADR-0003), and it keeps every backend testable on its own.
8
+ *
9
+ * Contract notes:
10
+ *
11
+ * - Paths crossing this boundary are **root-absolute in the backend's own spelling** (POSIX for
12
+ * remote, host paths for local). The router owns all translation.
13
+ * - `version` is an opaque token that must change whenever the content changes. Tokens are only
14
+ * compared **within one backend**; the router keys its cache by backend, not globally.
15
+ * - `stat` never throws for a missing path: it returns `exists: false`, so "create if absent"
16
+ * flows need one round trip rather than an error path.
17
+ *
18
+ * @module dsh-over-ssh/app/backend
19
+ */
20
+ /** One directory entry, as reported by a backend. */
21
+ export interface BackendEntry {
22
+ readonly name: string;
23
+ readonly isDirectory: boolean;
24
+ readonly isFile: boolean;
25
+ readonly isSymlink: boolean;
26
+ /** 0 for directories and for backends that cannot cheaply report sizes. */
27
+ readonly size: number;
28
+ /** Milliseconds since the epoch; 0 when unknown. */
29
+ readonly mtimeMs: number;
30
+ /**
31
+ * 这一项自己的版本令牌,由后端给出。
32
+ *
33
+ * 为什么不由消费方用 `size:mtimeMs` 现算:那样算出来的令牌没有 inode,而原子写换 inode 是唯一
34
+ * 与 mtime 精度无关的「换过文件」信号。只有后端手里有 stat 结果,所以令牌由它给。
35
+ */
36
+ readonly version?: string;
37
+ }
38
+ /** Metadata for one path. */
39
+ export interface BackendStat {
40
+ readonly exists: boolean;
41
+ readonly isDirectory: boolean;
42
+ readonly isFile: boolean;
43
+ readonly isSymlink: boolean;
44
+ readonly size: number;
45
+ readonly mtimeMs: number;
46
+ /** Opaque change token; empty when the backend cannot provide one. */
47
+ readonly version: string;
48
+ }
49
+ /** Bytes read from a backend. */
50
+ export interface BackendRead {
51
+ readonly bytes: Uint8Array;
52
+ /** Full size of the file when known, not the length of `bytes`. */
53
+ readonly size: number;
54
+ readonly truncated: boolean;
55
+ readonly version: string;
56
+ }
57
+ /** Text read from a backend. */
58
+ export interface BackendText {
59
+ readonly text: string;
60
+ readonly size: number;
61
+ readonly truncated: boolean;
62
+ readonly version: string;
63
+ }
64
+ /** Outcome of a write. */
65
+ export interface BackendWrite {
66
+ readonly bytes: number;
67
+ /** Version observed after the write, when the backend can report it cheaply. */
68
+ readonly version: string;
69
+ }
70
+ /** How a backend confines writes, mirroring the core's `SandboxMode`. */
71
+ export type BackendSandboxMode = 'read-only' | 'workspace-write' | 'danger-full-access';
72
+ /** One backend serving one root. */
73
+ export interface Backend {
74
+ /** Stable id, also the namespace prefix of every target key it produces. */
75
+ readonly id: string;
76
+ /** Whether the backend's own confinement applies, or `undefined` when it has none. */
77
+ readonly sandboxMode: BackendSandboxMode | undefined;
78
+ /** Whether the backend can watch for changes natively. */
79
+ readonly watches: boolean;
80
+ /**
81
+ * Watch one path for changes, in this backend's own absolute spelling (the backend layer has no `FsTarget`).
82
+ *
83
+ * The callback shape is the platform's own (`FsProvider.watch`): `changed()` means "re-stat this path, it
84
+ * may have changed"; `changed(error)` means the **watcher itself** failed and the subscription must be
85
+ * treated as dead. The returned function stops the watcher and must be idempotent.
86
+ *
87
+ * Optional on purpose: a backend that cannot watch (a local world without the platform seat, a Tier 1
88
+ * remote root) omits it and the provider keeps answering `FS_IO_ERROR` — the pre-existing refusal, never a
89
+ * silent no-op that would make a file panel look live while it never refreshes.
90
+ */
91
+ watch?(absolute: string, changed: (error?: Error) => void, signal: AbortSignal): Promise<() => Promise<void>>;
92
+ stat(absolute: string, signal?: AbortSignal): Promise<BackendStat>;
93
+ /**
94
+ * Stat the path entry itself, without following a final symlink.
95
+ *
96
+ * Optional: a backend that cannot distinguish a link from its target simply omits it, and the
97
+ * router falls back to {@link stat} (reporting `isSymlink: false`).
98
+ */
99
+ lstat?(absolute: string, signal?: AbortSignal): Promise<BackendStat>;
100
+ list(absolute: string, signal?: AbortSignal): Promise<readonly BackendEntry[]>;
101
+ readBytes(absolute: string, maxBytes: number, signal?: AbortSignal): Promise<BackendRead>;
102
+ readText(absolute: string, maxBytes: number, signal?: AbortSignal): Promise<BackendText>;
103
+ /**
104
+ * Write text, atomically where the backend can.
105
+ *
106
+ * @param expectedVersion - when non-empty the write must fail if the current version differs.
107
+ */
108
+ writeText(absolute: string, text: string, expectedVersion: string | undefined, signal?: AbortSignal): Promise<BackendWrite>;
109
+ /**
110
+ * Apply a unified diff to one file, atomically.
111
+ *
112
+ * Optional: only backends with a server-side patcher implement it. Absent means the caller must refuse
113
+ * rather than approximate the result with a read-modify-write it cannot make atomic on the far side.
114
+ */
115
+ patchText?(absolute: string, diff: string, expectedVersion: string | undefined, signal?: AbortSignal): Promise<BackendWrite & {
116
+ readonly hunks: number;
117
+ }>;
118
+ /**
119
+ * Atomic in-place edit (审计 0030), when the backend can do it without shipping the whole file back.
120
+ *
121
+ * Optional: a backend that omits it makes `ctx.fs` fall back to read → replace → write. When present it must
122
+ * apply the **same** three-state semantics as that fallback (not found / ambiguous / replaceAll) and
123
+ * must honour `expectedVersion` across its own read-modify-write.
124
+ */
125
+ editText?(absolute: string, oldString: string, newString: string, replaceAll: boolean, expectedVersion: string | undefined, signal?: AbortSignal): Promise<BackendWrite & {
126
+ readonly replaced: number;
127
+ }>;
128
+ /**
129
+ * Create a directory, and its parents when asked (FR-2.2.2: the file tree's 「新建目录」).
130
+ *
131
+ * Optional: a backend that cannot create directories simply omits it, and the route answers an explicit
132
+ * failure rather than a silent no-op. `recursive: false` must **fail** when the parent is missing or the
133
+ * target exists — a non-recursive mkdir that succeeds on an existing directory is indistinguishable from a
134
+ * successful creation, which is how a rename dialog ends up overwriting a folder.
135
+ */
136
+ mkdir?(absolute: string, options: {
137
+ readonly recursive: boolean;
138
+ }, signal?: AbortSignal): Promise<void>;
139
+ /**
140
+ * Rename (or move) a path, creating the destination's parents when asked (FR-2.2.2: 「重命名」).
141
+ *
142
+ * Must **refuse** to clobber an existing destination: the failure has to be visible, because the caller's
143
+ * intent was a rename and silently replacing a directory would be data loss.
144
+ */
145
+ rename?(from: string, to: string, options: {
146
+ readonly createParents: boolean;
147
+ }, signal?: AbortSignal): Promise<void>;
148
+ /**
149
+ * Remove a path (FR-2.2.2: 「删除」). `recursive: false` refuses a non-empty directory.
150
+ *
151
+ * The recycle-bin path (`remote_delete` with `mode: 'recycle'`) is a *rename*, not this: this is the plain
152
+ * removal the file tree's delete action uses after the user confirmed it.
153
+ */
154
+ remove?(absolute: string, options: {
155
+ readonly recursive: boolean;
156
+ }, signal?: AbortSignal): Promise<void>;
157
+ /**
158
+ * Change one path's permission bits, as a 3-4 digit **octal string** (`"755"`).
159
+ *
160
+ * Optional, and deliberately one narrow operation: `remote_write` needs it so a written build or probe
161
+ * script can be executed, and nothing else in this plugin does. A string rather than a number because the
162
+ * caller's `755` is octal digits, not decimal seven hundred and fifty-five, and that confusion is silent.
163
+ */
164
+ chmod?(absolute: string, mode: string, signal?: AbortSignal): Promise<void>;
165
+ /** Host path a child process in this backend's world can open, if any. */
166
+ processPath?(absolute: string): string | undefined;
167
+ /** `file:` URL for this path in the backend's world. */
168
+ fileUrl?(absolute: string): string;
169
+ }
170
+ //# sourceMappingURL=backend.d.ts.map