dsh-over-ssh 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/README.md +10 -10
  2. package/agents/agent-manifest.json +1 -1
  3. package/lib/client.js +363 -314
  4. package/lib/file-references.js +80 -35
  5. package/lib/fs.js +158 -75
  6. package/lib/index.js +4103 -3397
  7. package/lib/terminal-wrapper.js +9 -4
  8. package/lib/types/src/config.d.ts +80 -9
  9. package/lib/types/src/file-references.d.ts +0 -1
  10. package/lib/types/src/host/app/backend.d.ts +9 -1
  11. package/lib/types/src/host/app/recycle-bin/recycle-bin-contract.d.ts +0 -1
  12. package/lib/types/src/host/app/recycle-bin/recycle-bin-service.d.ts +0 -1
  13. package/lib/types/src/host/app/session-admin/session-admin-contract.d.ts +12 -1
  14. package/lib/types/src/host/app/session-admin/session-admin-service.d.ts +0 -1
  15. package/lib/types/src/host/app/transport/transport-selector.d.ts +0 -1
  16. package/lib/types/src/host/app/transport/transport-service.d.ts +0 -1
  17. package/lib/types/src/host/domain/capability.d.ts +0 -1
  18. package/lib/types/src/host/domain/errors.d.ts +0 -1
  19. package/lib/types/src/host/domain/roots/connection.d.ts +0 -1
  20. package/lib/types/src/host/domain/roots/root.d.ts +24 -9
  21. package/lib/types/src/host/domain/roots/session-roots.d.ts +0 -1
  22. package/lib/types/src/host/domain/roots/ssh-config.d.ts +0 -1
  23. package/lib/types/src/host/domain/session/session-admin.d.ts +0 -1
  24. package/lib/types/src/host/domain/transfer/recycle-bin.d.ts +0 -1
  25. package/lib/types/src/host/domain/transfer/transfer.d.ts +0 -1
  26. package/lib/types/src/host/infra/transport/agent/agent-installer.d.ts +0 -1
  27. package/lib/types/src/host/infra/transport/ssh/ssh2-transport.d.ts +0 -1
  28. package/lib/types/src/host/infra/transport/transport-base.d.ts +0 -1
  29. package/lib/types/src/host/infra/transport/transport.d.ts +16 -2
  30. package/lib/types/src/host/integration/agent/agent-preflight.d.ts +0 -1
  31. package/lib/types/src/host/integration/fs/file-reference-provider.d.ts +0 -1
  32. package/lib/types/src/host/integration/fs/fs-provider.d.ts +0 -2
  33. package/lib/types/src/host/integration/transfer/transfer-service.d.ts +0 -1
  34. package/lib/types/src/index.d.ts +23 -1
  35. package/lib/types/src/local-bridge-refs.d.ts +0 -1
  36. package/lib/types/src/local-bridge.d.ts +0 -1
  37. package/lib/types/src/shared/root-keys.d.ts +120 -0
  38. package/lib/types/src/wiring/helpers.d.ts +0 -1
  39. package/package.json +5 -3
  40. package/lib/types/src/client/controls.d.ts +0 -131
  41. package/lib/types/src/client/core/card-focus-trap.d.ts +0 -45
  42. package/lib/types/src/client/core/controls.d.ts +0 -164
  43. package/lib/types/src/client/core/latest.d.ts +0 -48
  44. package/lib/types/src/client/core/locale.d.ts +0 -38
  45. package/lib/types/src/client/core/message.d.ts +0 -37
  46. package/lib/types/src/client/core/panel-model.d.ts +0 -134
  47. package/lib/types/src/client/core/portal.d.ts +0 -266
  48. package/lib/types/src/client/core/remote.d.ts +0 -84
  49. package/lib/types/src/client/core/styles.d.ts +0 -458
  50. package/lib/types/src/client/file-tree-io.d.ts +0 -19
  51. package/lib/types/src/client/file-tree.d.ts +0 -271
  52. package/lib/types/src/client/flows/directory-browser.d.ts +0 -587
  53. package/lib/types/src/client/flows/session-directory.d.ts +0 -415
  54. package/lib/types/src/client/flows/workspace-directory-flow.d.ts +0 -480
  55. package/lib/types/src/client/locale.d.ts +0 -31
  56. package/lib/types/src/client/panel-model.d.ts +0 -37
  57. package/lib/types/src/client/panel.d.ts +0 -77
  58. package/lib/types/src/client/roots/connection-test.d.ts +0 -69
  59. package/lib/types/src/client/roots/roots-panel-state.d.ts +0 -307
  60. package/lib/types/src/client/roots/roots-panel-view.d.ts +0 -280
  61. package/lib/types/src/client/roots/roots-panel.d.ts +0 -364
  62. package/lib/types/src/client/roots/transfer-panel-view.d.ts +0 -35
  63. package/lib/types/src/client/roots/transfer-panel.d.ts +0 -241
  64. package/lib/types/src/client/roots/transfer-progress.d.ts +0 -67
  65. package/lib/types/src/client/roots-panel-view.d.ts +0 -236
  66. package/lib/types/src/client/roots-panel.d.ts +0 -347
  67. package/lib/types/src/client/session/session-panel-view.d.ts +0 -336
  68. package/lib/types/src/client/session/session-panel.d.ts +0 -322
  69. package/lib/types/src/client/session/session-remote-mark.d.ts +0 -110
  70. package/lib/types/src/client/session/session-row-actions.d.ts +0 -398
  71. package/lib/types/src/client/session-panel.d.ts +0 -152
  72. package/lib/types/src/client/styles.d.ts +0 -252
  73. package/lib/types/src/client/workspace-directory-flow.d.ts +0 -342
  74. package/lib/types/src/fs.d.ts +0 -46
  75. package/lib/types/src/host/app/recycle-bin/recycle-bin-move.d.ts +0 -18
  76. package/lib/types/src/host/app/recycle-bin/recycle-bin-world.d.ts +0 -38
  77. package/lib/types/src/host/app/recycle-bin-contract.d.ts +0 -215
  78. package/lib/types/src/host/app/recycle-bin-move.d.ts +0 -18
  79. package/lib/types/src/host/app/recycle-bin-service.d.ts +0 -45
  80. package/lib/types/src/host/app/recycle-bin-world.d.ts +0 -35
  81. package/lib/types/src/host/app/roots/roots-api-connections.d.ts +0 -49
  82. package/lib/types/src/host/app/roots/roots-api-contract.d.ts +0 -369
  83. package/lib/types/src/host/app/roots/roots-api-directories.d.ts +0 -13
  84. package/lib/types/src/host/app/roots/roots-api-http.d.ts +0 -77
  85. package/lib/types/src/host/app/roots/roots-api-long-poll.d.ts +0 -130
  86. package/lib/types/src/host/app/roots/roots-api-projections.d.ts +0 -102
  87. package/lib/types/src/host/app/roots/roots-api-roots.d.ts +0 -13
  88. package/lib/types/src/host/app/roots/roots-api-state.d.ts +0 -22
  89. package/lib/types/src/host/app/roots/roots-api-transfers.d.ts +0 -26
  90. package/lib/types/src/host/app/roots/roots-api.d.ts +0 -55
  91. package/lib/types/src/host/app/roots/user-roots.d.ts +0 -552
  92. package/lib/types/src/host/app/roots-api-connections.d.ts +0 -49
  93. package/lib/types/src/host/app/roots-api-contract.d.ts +0 -339
  94. package/lib/types/src/host/app/roots-api-directories.d.ts +0 -13
  95. package/lib/types/src/host/app/roots-api-http.d.ts +0 -77
  96. package/lib/types/src/host/app/roots-api-projections.d.ts +0 -102
  97. package/lib/types/src/host/app/roots-api-roots.d.ts +0 -13
  98. package/lib/types/src/host/app/roots-api-state.d.ts +0 -22
  99. package/lib/types/src/host/app/roots-api-support.d.ts +0 -182
  100. package/lib/types/src/host/app/roots-api-transfers.d.ts +0 -13
  101. package/lib/types/src/host/app/roots-api.d.ts +0 -55
  102. package/lib/types/src/host/app/routed-fs.d.ts +0 -239
  103. package/lib/types/src/host/app/serialize.d.ts +0 -37
  104. package/lib/types/src/host/app/session-admin/session-admin-context.d.ts +0 -36
  105. package/lib/types/src/host/app/session-admin/session-admin-delete.d.ts +0 -34
  106. package/lib/types/src/host/app/session-admin-context.d.ts +0 -36
  107. package/lib/types/src/host/app/session-admin-contract.d.ts +0 -214
  108. package/lib/types/src/host/app/session-admin-delete.d.ts +0 -34
  109. package/lib/types/src/host/app/session-admin-service.d.ts +0 -38
  110. package/lib/types/src/host/app/takeover/takeover-plan.d.ts +0 -227
  111. package/lib/types/src/host/app/takeover/takeover-rows.d.ts +0 -55
  112. package/lib/types/src/host/app/transport-selector.d.ts +0 -98
  113. package/lib/types/src/host/app/transport-service.d.ts +0 -75
  114. package/lib/types/src/host/app/user-roots.d.ts +0 -461
  115. package/lib/types/src/host/domain/bin-location.d.ts +0 -79
  116. package/lib/types/src/host/domain/connection.d.ts +0 -95
  117. package/lib/types/src/host/domain/glob-pattern.d.ts +0 -62
  118. package/lib/types/src/host/domain/literal-text.d.ts +0 -63
  119. package/lib/types/src/host/domain/path-grammar.d.ts +0 -84
  120. package/lib/types/src/host/domain/recycle-bin.d.ts +0 -337
  121. package/lib/types/src/host/domain/root.d.ts +0 -74
  122. package/lib/types/src/host/domain/roots/bin-location.d.ts +0 -91
  123. package/lib/types/src/host/domain/roots/route-table.d.ts +0 -102
  124. package/lib/types/src/host/domain/route-table.d.ts +0 -80
  125. package/lib/types/src/host/domain/session/terminal-target.d.ts +0 -136
  126. package/lib/types/src/host/domain/session-admin.d.ts +0 -330
  127. package/lib/types/src/host/domain/shell.d.ts +0 -47
  128. package/lib/types/src/host/domain/ssh-config.d.ts +0 -73
  129. package/lib/types/src/host/domain/terminal-target.d.ts +0 -132
  130. package/lib/types/src/host/domain/tool-requests.d.ts +0 -369
  131. package/lib/types/src/host/domain/transfer.d.ts +0 -260
  132. package/lib/types/src/host/infra/backend/local-backend.d.ts +0 -84
  133. package/lib/types/src/host/infra/backend/local-version.d.ts +0 -43
  134. package/lib/types/src/host/infra/backend/platform-local-backend.d.ts +0 -89
  135. package/lib/types/src/host/infra/backend/remote-backend.d.ts +0 -239
  136. package/lib/types/src/host/infra/cache/lru.d.ts +0 -52
  137. package/lib/types/src/host/infra/cache/versioned.d.ts +0 -77
  138. package/lib/types/src/host/infra/temp-name.d.ts +0 -19
  139. package/lib/types/src/host/infra/transport/agent/agent-protocol-client.d.ts +0 -132
  140. package/lib/types/src/host/infra/transport/agent/agent-protocol-codec.d.ts +0 -140
  141. package/lib/types/src/host/infra/transport/agent/agent-protocol-errors.d.ts +0 -41
  142. package/lib/types/src/host/infra/transport/agent/agent-protocol-frames.d.ts +0 -197
  143. package/lib/types/src/host/infra/transport/agent/agent-protocol-types.d.ts +0 -564
  144. package/lib/types/src/host/infra/transport/agent/agent-transport.d.ts +0 -418
  145. package/lib/types/src/host/infra/transport/agent-installer.d.ts +0 -121
  146. package/lib/types/src/host/infra/transport/agent-protocol-client.d.ts +0 -123
  147. package/lib/types/src/host/infra/transport/agent-protocol-codec.d.ts +0 -131
  148. package/lib/types/src/host/infra/transport/agent-protocol-errors.d.ts +0 -41
  149. package/lib/types/src/host/infra/transport/agent-protocol-frames.d.ts +0 -197
  150. package/lib/types/src/host/infra/transport/agent-protocol-types.d.ts +0 -509
  151. package/lib/types/src/host/infra/transport/agent-transport.d.ts +0 -353
  152. package/lib/types/src/host/infra/transport/alias-transport.d.ts +0 -206
  153. package/lib/types/src/host/infra/transport/askpass-fs.d.ts +0 -20
  154. package/lib/types/src/host/infra/transport/askpass.d.ts +0 -133
  155. package/lib/types/src/host/infra/transport/command-pool.d.ts +0 -61
  156. package/lib/types/src/host/infra/transport/fs-commands.d.ts +0 -140
  157. package/lib/types/src/host/infra/transport/git-status-route.d.ts +0 -63
  158. package/lib/types/src/host/infra/transport/git-status.d.ts +0 -101
  159. package/lib/types/src/host/infra/transport/node-spawn.d.ts +0 -26
  160. package/lib/types/src/host/infra/transport/session-window.d.ts +0 -51
  161. package/lib/types/src/host/infra/transport/shell-quote.d.ts +0 -59
  162. package/lib/types/src/host/infra/transport/ssh/alias-transport.d.ts +0 -206
  163. package/lib/types/src/host/infra/transport/ssh/askpass-fs.d.ts +0 -20
  164. package/lib/types/src/host/infra/transport/ssh/askpass.d.ts +0 -133
  165. package/lib/types/src/host/infra/transport/ssh/shell-quote.d.ts +0 -62
  166. package/lib/types/src/host/infra/transport/ssh/ssh-argv.d.ts +0 -43
  167. package/lib/types/src/host/infra/transport/ssh-argv.d.ts +0 -43
  168. package/lib/types/src/host/infra/transport/ssh2-transport.d.ts +0 -302
  169. package/lib/types/src/host/integration/agent/agent-install-io.d.ts +0 -33
  170. package/lib/types/src/host/integration/agent/askpass-registry.d.ts +0 -66
  171. package/lib/types/src/host/integration/agent-install-io.d.ts +0 -33
  172. package/lib/types/src/host/integration/agent-preflight.d.ts +0 -56
  173. package/lib/types/src/host/integration/anchor-directory.d.ts +0 -56
  174. package/lib/types/src/host/integration/askpass-registry.d.ts +0 -59
  175. package/lib/types/src/host/integration/bin-root-resolver.d.ts +0 -81
  176. package/lib/types/src/host/integration/connection-test.d.ts +0 -73
  177. package/lib/types/src/host/integration/file-reference-provider.d.ts +0 -115
  178. package/lib/types/src/host/integration/fs/git-status-wiring.d.ts +0 -21
  179. package/lib/types/src/host/integration/fs/platform-errors.d.ts +0 -94
  180. package/lib/types/src/host/integration/fs/remote-file-tools.d.ts +0 -369
  181. package/lib/types/src/host/integration/fs/remote-index.d.ts +0 -177
  182. package/lib/types/src/host/integration/fs-provider.d.ts +0 -226
  183. package/lib/types/src/host/integration/lsp/lsp-framing.d.ts +0 -38
  184. package/lib/types/src/host/integration/lsp/lsp-registry.d.ts +0 -67
  185. package/lib/types/src/host/integration/lsp/lsp-session.d.ts +0 -130
  186. package/lib/types/src/host/integration/management-tools.d.ts +0 -64
  187. package/lib/types/src/host/integration/recycle-bin-service.d.ts +0 -247
  188. package/lib/types/src/host/integration/remote/connection-test.d.ts +0 -73
  189. package/lib/types/src/host/integration/remote/remote-face.d.ts +0 -127
  190. package/lib/types/src/host/integration/remote/remote-tool-backend.d.ts +0 -108
  191. package/lib/types/src/host/integration/remote-face.d.ts +0 -127
  192. package/lib/types/src/host/integration/remote-file-tools.d.ts +0 -241
  193. package/lib/types/src/host/integration/remote-home.d.ts +0 -69
  194. package/lib/types/src/host/integration/remote-index.d.ts +0 -165
  195. package/lib/types/src/host/integration/remote-job-tools.d.ts +0 -295
  196. package/lib/types/src/host/integration/remote-tool-backend.d.ts +0 -97
  197. package/lib/types/src/host/integration/remote-tools.d.ts +0 -206
  198. package/lib/types/src/host/integration/root-registry.d.ts +0 -115
  199. package/lib/types/src/host/integration/roots/anchor-directory.d.ts +0 -56
  200. package/lib/types/src/host/integration/roots/bin-root-resolver.d.ts +0 -81
  201. package/lib/types/src/host/integration/roots/remote-home.d.ts +0 -69
  202. package/lib/types/src/host/integration/roots/root-registry.d.ts +0 -144
  203. package/lib/types/src/host/integration/roots/roots-wiring.d.ts +0 -219
  204. package/lib/types/src/host/integration/roots/session-root-index.d.ts +0 -52
  205. package/lib/types/src/host/integration/roots-api.d.ts +0 -407
  206. package/lib/types/src/host/integration/roots-wiring.d.ts +0 -211
  207. package/lib/types/src/host/integration/session/session-api.d.ts +0 -88
  208. package/lib/types/src/host/integration/session/session-bin-lock.d.ts +0 -80
  209. package/lib/types/src/host/integration/session/session-header.d.ts +0 -151
  210. package/lib/types/src/host/integration/session/session-labels.d.ts +0 -56
  211. package/lib/types/src/host/integration/session/session-route-wiring.d.ts +0 -50
  212. package/lib/types/src/host/integration/session-admin-service.d.ts +0 -236
  213. package/lib/types/src/host/integration/session-api.d.ts +0 -81
  214. package/lib/types/src/host/integration/session-bin-lock.d.ts +0 -80
  215. package/lib/types/src/host/integration/session-header.d.ts +0 -118
  216. package/lib/types/src/host/integration/session-labels.d.ts +0 -56
  217. package/lib/types/src/host/integration/session-route-wiring.d.ts +0 -50
  218. package/lib/types/src/host/integration/session-scope.d.ts +0 -113
  219. package/lib/types/src/host/integration/session-tools.d.ts +0 -44
  220. package/lib/types/src/host/integration/strict-arguments.d.ts +0 -79
  221. package/lib/types/src/host/integration/takeover/takeover-api.d.ts +0 -62
  222. package/lib/types/src/host/integration/takeover/takeover-route-wiring.d.ts +0 -60
  223. package/lib/types/src/host/integration/takeover/takeover-service.d.ts +0 -167
  224. package/lib/types/src/host/integration/terminal-manifest.d.ts +0 -94
  225. package/lib/types/src/host/integration/tools/management-tools.d.ts +0 -245
  226. package/lib/types/src/host/integration/tools/remote-job-tools.d.ts +0 -316
  227. package/lib/types/src/host/integration/tools/remote-lsp-tools.d.ts +0 -43
  228. package/lib/types/src/host/integration/tools/remote-tools.d.ts +0 -236
  229. package/lib/types/src/host/integration/tools/session-target.d.ts +0 -52
  230. package/lib/types/src/host/integration/tools/session-tools.d.ts +0 -46
  231. package/lib/types/src/host/integration/tools/strict-arguments.d.ts +0 -79
  232. package/lib/types/src/host/integration/tools/terminal-manifest.d.ts +0 -94
  233. package/lib/types/src/host/integration/transfer/remote-copy.d.ts +0 -66
  234. package/lib/types/src/host/integration/transfer/transfer-adapters.d.ts +0 -48
  235. package/lib/types/src/host/integration/transfer/transfer-tracker.d.ts +0 -106
  236. package/lib/types/src/host/integration/transfer-adapters.d.ts +0 -44
  237. package/lib/types/src/host/integration/transfer-service.d.ts +0 -164
  238. package/lib/types/src/host/integration/transfer-tracker.d.ts +0 -106
  239. package/lib/types/src/host/integration/user-roots.d.ts +0 -461
  240. package/lib/types/src/wiring/connections.d.ts +0 -189
  241. package/lib/types/src/wiring/fs.d.ts +0 -13
  242. package/lib/types/src/wiring/install-memo.d.ts +0 -32
  243. package/lib/types/src/wiring/legacy-dirs.d.ts +0 -62
  244. package/lib/types/src/wiring/package-paths.d.ts +0 -35
  245. package/lib/types/src/wiring/roots.d.ts +0 -21
  246. package/lib/types/src/wiring/state-dir.d.ts +0 -29
  247. package/lib/types/src/wiring/tools.d.ts +0 -35
@@ -1,564 +0,0 @@
1
- /**
2
- * 代理协议的**类型层**:会话/启动器抽象、协议方法请求与响应 DTO、各类默认上限、能力映射。
3
- *
4
- * 从 `agent-transport.ts` 拆出(审计 0077)。放在帧层之上、客户端之下:客户端与传输适配器
5
- * 都需要这些类型,若留在任一侧都会形成环。
6
- *
7
- * @module dsh-over-ssh/infra/transport/agent-protocol-types
8
- */
9
- import { type RemoteCapabilities } from '../../../domain/capability.ts';
10
- import { type ExecRequest, type ExecResult } from '../transport.ts';
11
- export interface AgentSession {
12
- /**
13
- * Send bytes to the agent's stdin. Returns `false` when the pipe is above its high-water mark.
14
- *
15
- * Synchronous on purpose: a control frame and the blob that follows it must be queued back to back,
16
- * so the write itself must not yield. Call {@link drain} when it reports backpressure.
17
- */
18
- write(bytes: Uint8Array): boolean;
19
- /** Resolve once the pipe has drained (or ended). Only meaningful after `write` returned `false`. */
20
- drain(): Promise<void>;
21
- /** Observe stdout bytes. Called once at most; the session keeps ownership of its own handlers. */
22
- onData(callback: (chunk: Uint8Array) => void): void;
23
- /** Observe the remote process's exit. Called once at most. */
24
- onExit(callback: (code: number | null) => void): void;
25
- /** Terminate the session; safe to call more than once. */
26
- close(): void;
27
- }
28
- /** Options handed to a launcher. Kept inert so tests can assert on the launch shape. */
29
- export interface AgentSessionOptions {
30
- /** ssh alias (or `user@host`) that carries the user's own ssh configuration. */
31
- readonly alias: string;
32
- /** Remote command line for the agent; defaults to `<agentPath> --stdio`. */
33
- readonly remoteCommand: string;
34
- /** `ssh` argv *without* the remote command, e.g. `['ssh','-T','-o','BatchMode=yes','gpu01']`. */
35
- readonly sshArgv: readonly string[];
36
- /**
37
- * Extra environment for the `ssh` child, merged over the parent's.
38
- *
39
- * Carries the askpass wiring for password connections (`askpass.ts`): the agent session must authenticate
40
- * exactly like the ladder that installed it, so a password connection needs the helper here too.
41
- */
42
- readonly env?: Record<string, string>;
43
- /** Cancellation for the launch itself. */
44
- readonly signal?: AbortSignal;
45
- }
46
- /** Opens one agent session; injected so tests never start a process. */
47
- export type AgentLauncher = (options: AgentSessionOptions) => Promise<AgentSession>;
48
- /** Run one remote command through the agent. Injected: protocol v1 has no command-execution method. */
49
- export type AgentExecCommand = (request: ExecRequest, signal?: AbortSignal) => Promise<ExecResult>;
50
- /** Construction options for {@link AgentTransport}. */
51
- export interface AgentTransportOptions {
52
- /** Connection id (also the pool key). */
53
- readonly connectionId: string;
54
- /** Session factory; defaults to {@link defaultLauncher} (real `ssh` over `node:child_process`). */
55
- readonly launch?: AgentLauncher;
56
- /** `ssh` argv *without* the remote command. Used by the default launcher. */
57
- readonly sshArgv?: readonly string[];
58
- /** Extra environment for the `ssh` child that carries the session; see {@link AgentSessionOptions.env}. */
59
- readonly env?: Record<string, string>;
60
- /** Remote path of the agent binary; used by the default launcher. */
61
- readonly agentPath?: string;
62
- /** Extra argv inserted after the agent path (before the mode flag). */
63
- readonly agentArgs?: readonly string[];
64
- /**
65
- * Mode flag handed to the agent: {@link DEFAULT_AGENT_MODE} (`--shared`, prefer a resident daemon)
66
- * or {@link STDIO_AGENT_MODE} (`--stdio`, one process per connection).
67
- *
68
- * `--shared` is the default because it is what makes "one agent process serving many sessions" real:
69
- * jobs, LSP sessions and index snapshots are shared instead of duplicated per connection. The agent
70
- * falls back to `--stdio` on its own when no daemon can run, so this does not remove the Tier 2
71
- * capability on hosts where the daemon is unavailable.
72
- */
73
- readonly agentMode?: string;
74
- /** Command runner for {@link AgentTransport.exec}; see the module note about protocol v1. */
75
- readonly execCommand?: AgentExecCommand;
76
- /** Method name used by the default {@link AgentTransport.exec}; defaults to `proc.exec`. */
77
- readonly execMethod?: string;
78
- /** Deadline applied to one request when the caller names none. Default 15 s. */
79
- readonly requestTimeoutMs?: number;
80
- /**
81
- * How many requests may be in flight on this connection. Defaults to
82
- * {@link DEFAULT_AGENT_MAX_IN_FLIGHT} (8), which mirrors the agent's own limit; set `1` to restore the
83
- * old strictly serial behaviour.
84
- */
85
- readonly maxInFlight?: number;
86
- /** Client identifier sent in `hello`; defaults to {@link AGENT_CLIENT_ID}. */
87
- readonly clientId?: string;
88
- /**
89
- * Default session for every request on this connection (`hello.params.sessionId`).
90
- *
91
- * Omitted means the field is not sent at all, so the agent uses its own `"default"` and this connection
92
- * behaves exactly as it did before sessions existed. Set it when several logical sessions share one
93
- * connection: the agent then gives each its own share of the in-flight window, which is what stops one
94
- * session's long request from queueing another's short one (audit 0021: 3502 ms → 0.7 ms).
95
- */
96
- readonly sessionId?: string;
97
- /** Injectable clock (diagnostics and duration measurement). */
98
- readonly now?: () => number;
99
- }
100
- /** One decoded frame. */
101
- export declare const DEFAULT_INDEX_MAX_ENTRIES = 20000;
102
- /** Client-side default for `index.scan` `maxDepth`; mirrors the agent's `index.DefaultMaxDepth`. */
103
- export declare const DEFAULT_INDEX_MAX_DEPTH = 12;
104
- /** Client-side default for `index.scan` / `search.grep` `timeoutMs` (agent: 5000 ms). */
105
- export declare const DEFAULT_INDEX_TIMEOUT_MS = 5000;
106
- /** Client-side default for `search.grep` `maxResults`; mirrors the agent's `search.DefaultMaxResults`. */
107
- export declare const DEFAULT_SEARCH_MAX_RESULTS = 1000;
108
- /** Client-side default for `search.grep` `maxFileBytes` (agent: 8 MiB). */
109
- export declare const DEFAULT_SEARCH_MAX_FILE_BYTES: number;
110
- /** Client-side default for `search.grep` `maxBytesScanned` (agent: 512 MiB). */
111
- export declare const DEFAULT_SEARCH_MAX_BYTES_SCANNED: number;
112
- /** Client-side default for `search.grep` `maxLineBytes` (agent: 1 MiB). */
113
- export declare const DEFAULT_SEARCH_MAX_LINE_BYTES: number;
114
- /** Client-side default for `watch.start` `maxWatches`; mirrors the agent's `watch.DefaultMaxWatches`. */
115
- export declare const DEFAULT_WATCH_MAX_WATCHES = 4096;
116
- /** Client-side default for `watch.start` `debounceMs`; mirrors the agent's `watch.DefaultDebounceMs`. */
117
- export declare const DEFAULT_WATCH_DEBOUNCE_MS = 150;
118
- /** Client-side default for `watch.poll` `timeoutMs`; mirrors the agent's `watch.DefaultPollTimeoutMs`. */
119
- export declare const DEFAULT_WATCH_POLL_TIMEOUT_MS = 1000;
120
- /** Client-side default for `watch.poll` `maxEvents`; mirrors the agent's `watch.DefaultMaxEvents`. */
121
- export declare const DEFAULT_WATCH_MAX_EVENTS = 256;
122
- /** One indexed file (`index.scan` `entries[i]`). */
123
- export interface AgentIndexEntry {
124
- /** Absolute remote path. */
125
- readonly path: string;
126
- /** File size in bytes as reported by the agent (`size`). */
127
- readonly size: number;
128
- /**
129
- * Modification time in **milliseconds** since the epoch, converted from the agent's `mtimeNs`.
130
- * `null` when the agent sent no usable `mtimeNs`.
131
- */
132
- readonly mtimeMs: number | null;
133
- /**
134
- * Whether the entry is a directory. v1's `index.scan` enumerates **files only** and sends no `isDir`,
135
- * so this is `false` unless a future agent adds the field.
136
- */
137
- readonly isDir: boolean;
138
- }
139
- /** Result of {@link AgentTransport.scanIndex} (`index.scan`). */
140
- export interface AgentIndexScanResult {
141
- /** Entries in the order the agent returned them (the agent sorts by path). */
142
- readonly entries: readonly AgentIndexEntry[];
143
- /** `"git-ls-files"` / `"find-bounded"` as reported; `"unknown"` when the agent sent nothing usable. */
144
- readonly strategy: string;
145
- /** True when any of the four bounds (entries / depth / excludes / deadline) fired. */
146
- readonly truncated: boolean;
147
- /** Files enumerated (`scanned` on the wire); `0` when absent. */
148
- readonly filesScanned: number;
149
- /** Per-root problems the agent chose not to fail on (`warnings`); empty when absent. */
150
- readonly warnings: readonly string[];
151
- /** Agent-side duration in ms, or `null` when absent. */
152
- readonly durationMs: number | null;
153
- }
154
- /** {@link AgentTransport.procStart} request. Mirrors the agent's `proc.exec` fields plus an output cap. */
155
- export interface AgentProcStartRequest {
156
- /** A command line; exactly one of `argv`/`script` must be given (the agent refuses both). */
157
- readonly argv?: readonly string[];
158
- /** A shell script, run via `/bin/sh -c` (POSIX) or `cmd /c` (Windows). */
159
- readonly script?: string;
160
- readonly cwd?: string;
161
- readonly env?: Readonly<Record<string, string>>;
162
- /** Text written to stdin, then closed. Mutually exclusive with `stdinBytes`. */
163
- readonly stdin?: string;
164
- /** Bytes written to stdin, then closed (base64 on the wire). Mutually exclusive with `stdin`. */
165
- readonly stdinBytes?: Uint8Array;
166
- /** Keep the stdin pipe open so `proc.stdin` can append input later (审计 0030). */
167
- readonly interactive?: boolean;
168
- /**
169
- * Kill the job after this long. **0 or absent means no limit** - unlike `proc.exec`, where a missing
170
- * timeout means the agent's default.
171
- */
172
- readonly timeoutMs?: number;
173
- /** Retained output cap (the agent's ring buffer drops the oldest bytes past it). */
174
- readonly maxOutputBytes?: number;
175
- /**
176
- * Landlock write fence: when non-empty the job may only write under these roots.
177
- * The agent refuses with `REMOTE_UNSUPPORTED` when it cannot build the fence rather than running unfenced.
178
- */
179
- readonly writeRoots?: readonly string[];
180
- }
181
- /** One background job (`proc.start` / `proc.status` / `proc.list`). */
182
- export interface AgentJobStatus {
183
- readonly id: string;
184
- /** `running` / `exited` / `killed` / `failed`. */
185
- readonly state: string;
186
- readonly command: string;
187
- readonly pid?: number;
188
- readonly exitCode: number;
189
- readonly signal?: string;
190
- readonly timedOut: boolean;
191
- readonly startedMs: number;
192
- readonly durationMs: number;
193
- readonly outputBytes: number;
194
- /** Bytes dropped from the **oldest** end of the ring buffer; non-zero means the output has a hole. */
195
- readonly droppedBytes: number;
196
- }
197
- /** {@link AgentTransport.procKill} result. `killed: false` for a job that had already finished. */
198
- export interface AgentJobKill {
199
- readonly id: string;
200
- readonly killed: boolean;
201
- readonly state: string;
202
- }
203
- /** {@link AgentTransport.procOutput} result. */
204
- export interface AgentJobOutput {
205
- readonly id: string;
206
- readonly state: string;
207
- readonly data: string;
208
- /** Pass this as the next `offset` to get only what is new. */
209
- readonly nextOffset: number;
210
- readonly droppedBytes: number;
211
- readonly totalBytes: number;
212
- /** True when the requested span was already dropped: `data` is not continuous output. */
213
- readonly lost: boolean;
214
- readonly exitCode: number;
215
- readonly signal?: string;
216
- readonly timedOut: boolean;
217
- }
218
- /** {@link AgentTransport.lspStart} request. */
219
- export interface AgentLspStartRequest {
220
- /** The language server executable (a name on PATH or an absolute path). */
221
- readonly command: string;
222
- readonly args?: readonly string[];
223
- /** Working directory - language servers use it to find project config, so it matters. */
224
- readonly cwd?: string;
225
- readonly env?: Readonly<Record<string, string>>;
226
- readonly maxOutputBytes?: number;
227
- }
228
- /** One language-server session (`lsp.start` / `lsp.status` / `lsp.stop`). */
229
- export interface AgentLspStatus {
230
- readonly id: string;
231
- readonly command: string;
232
- /** `running` / `exited`. */
233
- readonly state: string;
234
- readonly pid?: number;
235
- readonly exitCode: number;
236
- readonly startedMs: number;
237
- readonly durationMs: number;
238
- readonly outputBytes: number;
239
- readonly droppedBytes: number;
240
- readonly wroteBytes: number;
241
- /**
242
- * Session that owns this language server (ADR-0011).
243
- *
244
- * With `--shared` the agent's LSP session table is **one global table per daemon** - deliberately,
245
- * because language servers are memory-heavy and one process per connection fights the "low memory"
246
- * goal. Sharing is why `lsp.list`/`lsp.read` can see another session's server, and ownership is why
247
- * `lsp.stop`/`lsp.forget` cannot touch it: an ownerless kill would leave the victim unable to tell
248
- * what happened (it only sees `exited`). Absent on agents that predate ADR-0011.
249
- */
250
- readonly session?: string;
251
- }
252
- /** {@link AgentTransport.lspRead} result. */
253
- export interface AgentLspRead {
254
- readonly id: string;
255
- /** Raw LSP bytes (a `Content-Length`-framed JSON-RPC stream) - the agent does not parse them. */
256
- readonly data: string;
257
- readonly nextOffset: number;
258
- readonly state: string;
259
- readonly droppedBytes: number;
260
- readonly totalBytes: number;
261
- readonly lost: boolean;
262
- }
263
- /** {@link AgentTransport.scanIndex} request. Untyped fields are omitted from the frame, not defaulted. */
264
- export interface AgentIndexScanRequest {
265
- /** Absolute remote roots. Empty is a local `REMOTE_COMMAND_FAILED` (`E_PARAMS` on the wire). */
266
- readonly roots: readonly string[];
267
- /** Entry ceiling; the agent applies {@link DEFAULT_INDEX_MAX_ENTRIES} when omitted or non-positive. */
268
- readonly maxEntries?: number;
269
- /** Depth ceiling; the agent applies {@link DEFAULT_INDEX_MAX_DEPTH} when omitted or non-positive. */
270
- readonly maxDepth?: number;
271
- /** Directory names to skip; omitted means the agent's built-in noise table. */
272
- readonly exclude?: readonly string[];
273
- /** Agent-side deadline; the agent applies {@link DEFAULT_INDEX_TIMEOUT_MS} when omitted or non-positive. */
274
- readonly timeoutMs?: number;
275
- /** `false` forces the standard-library walk (the agent's `preferGit`, diagnostic escape hatch). */
276
- readonly preferGit?: boolean;
277
- }
278
- /** One content match (`search.grep` `matches[i]`). */
279
- export interface AgentSearchMatch {
280
- /** Absolute remote path. */
281
- readonly path: string;
282
- /** 1-based line number as reported. */
283
- readonly line: number;
284
- /** 1-based column as reported; `0` when the agent sent no column (it does send one today). */
285
- readonly column: number;
286
- /** The matched line's text, exactly as the agent sent it. */
287
- readonly text: string;
288
- /** Context lines before the match (`before`); empty when absent. */
289
- readonly before: readonly string[];
290
- /** Context lines after the match (`after`); empty when absent. */
291
- readonly after: readonly string[];
292
- }
293
- /** Result of {@link AgentTransport.searchGrep} (`search.grep`). */
294
- export interface AgentSearchResult {
295
- /** Matches, in the agent's order (path → line → column). */
296
- readonly matches: readonly AgentSearchMatch[];
297
- /** `"in-process"` / `"ripgrep"` as reported; `"unknown"` when the agent sent nothing usable. */
298
- readonly strategy: string;
299
- /** True when any workload bound (results / bytes / deadline / file size) cut the scan short. */
300
- readonly truncated: boolean;
301
- /**
302
- * **Cumulative** events dropped since `watch.start` (`dropped` on the wire). On `search.grep` the
303
- * agent reports no such field, so it is `0`; it exists here only for wire-shape symmetry with
304
- * {@link AgentWatchPollResult} — do not read it as "matches lost".
305
- */
306
- readonly dropped: number;
307
- /** Files actually opened (`filesScanned`); `0` when absent. */
308
- readonly filesScanned: number;
309
- /** Bytes actually read (`bytesScanned`); `0` when absent. */
310
- readonly bytesScanned: number;
311
- /** Non-fatal problems (`warnings`); empty when absent. */
312
- readonly warnings: readonly string[];
313
- /** Agent-side duration in ms, or `null` when absent. */
314
- readonly durationMs: number | null;
315
- /**
316
- * Which workload bounds cut the scan short (`truncatedReasons`), de-duplicated by the agent.
317
- *
318
- * Values are `maxResults` / `bytesScanned` / `maxFileBytes` / `timeout` / `maxEntries`. The list is kept
319
- * **verbatim**: a newer agent may name a bound this client does not know, and dropping it would report a
320
- * truncated scan as an untruncated one. Empty when the agent sent nothing.
321
- */
322
- readonly truncatedReasons: readonly string[];
323
- /**
324
- * Candidate files the request's `include` filters removed, or `undefined` when the agent did not say.
325
- *
326
- * `undefined` and `0` are different facts: `0` means "the filters removed nothing", `undefined` means "this
327
- * agent cannot tell you". Reading a missing field as `0` would invent the first from the second.
328
- */
329
- readonly filesFiltered: number | undefined;
330
- }
331
- /**
332
- * {@link AgentTransport.searchGrep} request.
333
- *
334
- * Note the one place this API deliberately does **not** mirror the wire: the agent's field is
335
- * `caseSensitive` (default `false` = case-insensitive), and this option is its inverse
336
- * (`ignoreCase`, default `true`). The mapping is explicit in {@link AgentTransport.searchGrep}, so
337
- * callers never have to remember which way the flag points.
338
- */
339
- export interface AgentSearchGrepRequest {
340
- /** Absolute remote roots (files or directories). Empty is refused locally with `REMOTE_COMMAND_FAILED`. */
341
- readonly paths: readonly string[];
342
- /** Literal or Go regular expression, depending on `literal`. Empty is a local `REMOTE_COMMAND_FAILED`. */
343
- readonly query: string;
344
- /** `true` (default on the wire) means literal substring matching; `false` means Go regexp. */
345
- readonly literal?: boolean;
346
- /** Case-insensitive matching; **default `true`**, inverted onto the wire's `caseSensitive`. */
347
- readonly ignoreCase?: boolean;
348
- /** Result ceiling; the agent applies {@link DEFAULT_SEARCH_MAX_RESULTS} when omitted or non-positive. */
349
- readonly maxResults?: number;
350
- /** Whole-request byte ceiling; agent default {@link DEFAULT_SEARCH_MAX_BYTES_SCANNED}. */
351
- readonly maxBytesScanned?: number;
352
- /** Per-file byte ceiling; agent default {@link DEFAULT_SEARCH_MAX_FILE_BYTES}. */
353
- readonly maxFileBytes?: number;
354
- /** Per-line byte ceiling; agent default {@link DEFAULT_SEARCH_MAX_LINE_BYTES}. */
355
- readonly maxLineBytes?: number;
356
- /** Agent-side deadline; agent default {@link DEFAULT_INDEX_TIMEOUT_MS}. */
357
- readonly timeoutMs?: number;
358
- /** Context lines around a match; `>0` forces the in-process path (no `rg` delegation). */
359
- readonly contextLines?: number;
360
- /**
361
- * Filename patterns to keep (e.g. `*.cpp`), forwarded as the agent's `include`.
362
- *
363
- * Distinct from {@link paths}: `paths` decides what is **walked**, `include` decides which walked **files**
364
- * are read, and it does not prune directories. Omitted means "no filename filtering" — the agent applies
365
- * none, rather than this layer inventing an empty filter list.
366
- */
367
- readonly include?: readonly string[];
368
- /**
369
- * Drop the ignore rules the agent would otherwise apply: VCS ignores (`.gitignore` / `.ignore` /
370
- * `.rgignore`) and its built-in `index.DefaultExcludes` noise directories.
371
- *
372
- * Omitted means the agent's own default (ignore rules applied), so an older agent that does not know the
373
- * field still behaves exactly as before. The two search paths inside the agent both honour it — see
374
- * `dsh-over-ssh-agent/internal/search/search.go`.
375
- */
376
- readonly noIgnore?: boolean;
377
- }
378
- /** One filesystem event (`watch.poll` `events[i]`). */
379
- export interface AgentWatchEvent {
380
- /** Absolute remote path. */
381
- readonly path: string;
382
- /** `create` / `write` / `remove` / `rename`; `"unknown"` for a kind this client does not recognise. */
383
- readonly kind: string;
384
- /**
385
- * When the **agent read** the event, in milliseconds since the epoch, converted from `atNs`.
386
- * inotify carries no kernel timestamp, so this is not the moment the change happened; `null` when absent.
387
- */
388
- readonly atMs: number | null;
389
- }
390
- /** Result of {@link AgentTransport.startWatch} (`watch.start`). */
391
- export interface AgentWatchStartResult {
392
- /**
393
- * The watcher this result belongs to, as the agent normalised it (`"default"` when the caller omitted
394
- * `watcherId`). Echoed so a caller sharing one connection can confirm which watcher it touched.
395
- */
396
- readonly watcherId: string;
397
- /** The **roots** actually registered (absolute, deduplicated, ascending) — not every subdirectory. */
398
- readonly watched: readonly string[];
399
- /** True when `maxWatches` (or the kernel's `max_user_watches`) cut registration short. */
400
- readonly truncated: boolean;
401
- /** `"inotify"` today (Linux only); `"unknown"` when the agent sent nothing usable. */
402
- readonly strategy: string;
403
- }
404
- /**
405
- * {@link AgentTransport.startWatch} request.
406
- *
407
- * Calling `start` with the **same** `watcherId` while that watcher runs **replaces** it (the agent stops
408
- * the old one first); if the new start fails, the old watcher is already gone. Different ids are
409
- * independent — that is what lets several sessions share one agent process without one session's
410
- * `watch.start` silently killing another's listener.
411
- */
412
- export interface AgentWatchStartRequest {
413
- /**
414
- * Which watcher to start or replace; omitted means the agent's `"default"` watcher, which is what a
415
- * caller that never sets this has always used. The agent caps a connection at 16 watchers and answers
416
- * `E_TOO_LARGE` beyond that (it never evicts someone else's watcher).
417
- */
418
- readonly watcherId?: string;
419
- /** Absolute remote roots. Empty is a local `REMOTE_COMMAND_FAILED`. Non-absolute roots are `E_PARAMS`. */
420
- readonly roots: readonly string[];
421
- /** Recursively registered **directory** ceiling; agent default {@link DEFAULT_WATCH_MAX_WATCHES}. */
422
- readonly maxWatches?: number;
423
- /** Debounce window for merging same-`(path, kind)` events; agent default {@link DEFAULT_WATCH_DEBOUNCE_MS}. */
424
- readonly debounceMs?: number;
425
- }
426
- /** Result of {@link AgentTransport.pollWatch} (`watch.poll`). */
427
- export interface AgentWatchPollResult {
428
- /** The watcher this poll read from, as the agent normalised it (`"default"` when omitted). */
429
- readonly watcherId: string;
430
- /** Events returned by this poll (possibly empty, and empty is not an error). */
431
- readonly events: readonly AgentWatchEvent[];
432
- /** True when `maxEvents` was hit (more events remain queued) or the kernel queue overflowed. */
433
- readonly truncated: boolean;
434
- /** True when this poll returned because its deadline expired, not because it had events. */
435
- readonly timeout: boolean;
436
- /**
437
- * Events dropped because the agent's queue limit was reached, **cumulative since `watch.start`** —
438
- * never subtract two polls to get a delta, and do not read it as the total number of lost events
439
- * (debounce merging also removes duplicates, which are not counted here).
440
- */
441
- readonly dropped: number;
442
- }
443
- /** {@link AgentTransport.pollWatch} request. */
444
- export interface AgentWatchPollRequest {
445
- /** Which watcher to poll; omitted means the agent's `"default"` watcher. */
446
- readonly watcherId?: string;
447
- /**
448
- * How long the agent may block waiting for events; agent default
449
- * {@link DEFAULT_WATCH_POLL_TIMEOUT_MS}. See {@link AgentTransport.pollWatch}: this occupies the
450
- * connection, and it must stay below the transport's `requestTimeoutMs` or the client deadline fires
451
- * first.
452
- */
453
- readonly timeoutMs?: number;
454
- /** Events per poll; agent default {@link DEFAULT_WATCH_MAX_EVENTS}. The rest stay queued. */
455
- readonly maxEvents?: number;
456
- }
457
- /** Result of {@link AgentTransport.stopWatch} (`watch.stop`). */
458
- export interface AgentWatchStopResult {
459
- /** The watcher this stop targeted, as the agent normalised it (`"default"` when omitted). */
460
- readonly watcherId: string;
461
- /** `true` when a watcher was running, `false` when there was nothing to stop (not an error). */
462
- readonly stopped: boolean;
463
- }
464
- /**
465
- * One normalized work-tree change status.
466
- *
467
- * The agent normalizes porcelain's XY columns into exactly these six values; anything else is a protocol
468
- * violation the client drops (an unknown status must not become a guessed badge).
469
- */
470
- export type AgentGitChangeStatus = 'modified' | 'added' | 'deleted' | 'renamed' | 'untracked' | 'conflicted';
471
- /** One `git.status` change: path relative to the queried root (POSIX separators). */
472
- export interface AgentGitChange {
473
- readonly path: string;
474
- readonly status: AgentGitChangeStatus;
475
- }
476
- /**
477
- * `git.status` result (`git.status` params: `{ root }`).
478
- *
479
- * `branch` is **absent** for a detached HEAD (or when the agent could not read it) — the client must not
480
- * substitute a name. `truncated` means one of the agent's output caps fired, so the list is a prefix.
481
- */
482
- export interface AgentGitStatusResult {
483
- readonly branch?: string;
484
- readonly changes: readonly AgentGitChange[];
485
- readonly truncated: boolean;
486
- }
487
- /** The agent's capability record, as the plugin cares about it. */
488
- /** One language server the agent found on the remote `PATH` (`capabilities.lspServers`). */
489
- export interface AgentLspServerInfo {
490
- /** Executable name, e.g. `gopls`. */
491
- readonly command: string;
492
- /** Language it mainly serves, for display only. */
493
- readonly language: string;
494
- /** Absolute path it resolved to. */
495
- readonly path: string;
496
- }
497
- export interface AgentCapabilities {
498
- /** `"native"` / `"poll"` / `"none"`: only `native` may use `watch.*`. */
499
- readonly watch?: string;
500
- readonly index?: boolean;
501
- readonly atomicWrite?: boolean;
502
- readonly landlock?: string;
503
- readonly git?: boolean;
504
- readonly ripgrep?: boolean;
505
- readonly grep?: boolean;
506
- /** `proc.exec` support. Only `true` may call the command-execution path. */
507
- readonly exec?: boolean;
508
- /**
509
- * Request-level cancellation: the agent accepts a `cancel` frame (`params.id` = the request to abort)
510
- * and answers the cancelled request with `E_CANCELLED`.
511
- *
512
- * Absent on older agents, which is exactly the pre-D3 behaviour: the client stops waiting locally and
513
- * sends no frame (there is nothing to send it to). Never assumed true.
514
- */
515
- readonly cancel?: boolean;
516
- /**
517
- * Language servers found on the remote `PATH`.
518
- *
519
- * The agent probes a **fixed** list of known commands and only looks at `PATH` — it does not start
520
- * anything. Absent means the agent predates the probe; an empty array means it looked and found none,
521
- * which is a different and actionable answer.
522
- */
523
- readonly lspServers?: readonly AgentLspServerInfo[];
524
- }
525
- /** Optional metadata a `hello` result may carry beyond the capability bits. */
526
- export interface AgentHelloExtras {
527
- /** `hello.result.agent.os` (`linux`, `darwin`, …). */
528
- readonly os?: string;
529
- /** `hello.result.agent.arch`. */
530
- readonly arch?: string;
531
- /** `hello.result.agent.version`. */
532
- readonly version?: string;
533
- /** Explicit `uname` if a future agent sends one; preferred over the derivation from `os`. */
534
- readonly uname?: string;
535
- }
536
- /**
537
- * Map agent capability bits onto this plugin's {@link RemoteCapabilities}.
538
- *
539
- * Honesty rules followed here, because each one would otherwise be an invented capability:
540
- *
541
- * - a bit the agent did not send is **false**, never assumed;
542
- * - `sha256` stays `null`: the agent computes versions itself and never advertises a digest tool;
543
- * - `base64` / `findMaxDepth` stay `false`: those are Tier 1 shell-tool facts, and the agent does not
544
- * use either command;
545
- * - `posix` is true only for a POSIX `os`;
546
- * - `uname` is derived from `os` (linux→Linux) when the agent sends no explicit `uname`. **That
547
- * derivation is unverified against the wire** (v1 `hello` carries `os`, not `uname`) and is listed as
548
- * an unverified assumption in the module documentation.
549
- */
550
- export declare function capabilitiesFromAgent(caps: AgentCapabilities | undefined, extras?: AgentHelloExtras): RemoteCapabilities;
551
- /**
552
- * The protocol v1 client: framing, request/response correlation and the `hello` handshake.
553
- *
554
- * Scope: **one session, up to {@link maxInFlight} requests in flight**. Requests are pipelined because the
555
- * agent dispatches them concurrently (ADR-0009) and answers by id, so the only thing that must stay
556
- * ordered is the blob stream — and the agent writes a response and its blob inside one critical section,
557
- * which makes blob arrival order equal declaration order. {@link readBlob} therefore binds to the blob
558
- * channel of *its own* control response rather than to a single global slot.
559
- *
560
- * A request that times out or is aborted is not simply forgotten — its response (and its blob) is still on
561
- * the wire, so the client drains it before reporting the failure, and it declares the connection lost when
562
- * it cannot.
563
- */
564
- //# sourceMappingURL=agent-protocol-types.d.ts.map