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,295 +0,0 @@
1
- /**
2
- * Background jobs on the remote host: `remote_exec_background` plus the four job controls.
3
- *
4
- * The transport could already do every one of these things — `AgentTransport.procStart` / `procStatus` /
5
- * `procOutput` / `procKill` / `procList` — and **nothing called them**: a long remote build had to be
6
- * hand-rolled as `nohup … &` plus manual polling, with no exit code, no job identity and no way to cancel.
7
- * These five tools close that gap and mirror the platform's local `job_output` / `job_list` / `job_kill`
8
- * semantics, which is what the caller already knows.
9
- *
10
- * Four facts the wording is built on, each verified in the agent's own source rather than assumed:
11
- *
12
- * - **Jobs die with the connection** (`dsh-ssh-agent/internal/proc/jobs.go` module notes: the agent kills
13
- * every job when the ssh channel closes). "Background job" here means "background within this connection",
14
- * never a durable queue, so each description says so instead of letting the caller assume durability.
15
- * - **Nothing is pushed.** Protocol v1's frame discipline has no server-initiated frames, so progress is
16
- * polled. The `wait` parameter below is a bounded poll loop inside the plugin, not a subscription.
17
- * - **A job's output is a bounded ring that drops the OLDEST bytes** (`proc.start`), unlike `proc.exec`,
18
- * which keeps head+tail and spills the rest to a file. There is **no spill file** for a job, so
19
- * `droppedBytes` is the only signal that output has a hole, and `proc.output` adds `lost: true` when the
20
- * requested span itself was already dropped. A renderer that hid either would let a caller read a torn
21
- * log as a complete one — the exact failure the user reported.
22
- * - **`proc.*` needs a Tier 2 agent.** {@link isAgentJobCapable} decides by method presence (the agent's
23
- * capability frame has no `proc` bit), and a transport that fails the check is refused with
24
- * `REMOTE_UNSUPPORTED` instead of silently degrading to a foreground command.
25
- *
26
- * @module dsh-remote-workspace/integration/remote-job-tools
27
- */
28
- import type { Context } from '@deepseek-ai/cordis';
29
- import { type ToolDefinition } from '@deepseek-ai/dsh-tools';
30
- import type { Transport } from '../infra/transport/transport.ts';
31
- import type { AgentJobKill, AgentJobOutput, AgentJobStatus, AgentProcStartRequest } from '../infra/transport/agent-transport.ts';
32
- /** Default wait applied when `wait: true` is set without `timeoutMs`. */
33
- export declare const DEFAULT_JOB_WAIT_MS = 30000;
34
- /** Hard cap on one wait, so a poll loop cannot hold a tool call open indefinitely. */
35
- export declare const MAX_JOB_WAIT_MS = 600000;
36
- /** Poll interval of the wait loop. */
37
- export declare const DEFAULT_JOB_POLL_MS = 500;
38
- /**
39
- * Server-side wait requested per long-poll slice.
40
- *
41
- * 5 s is chosen against the transport's request budget: the slice plus `waitBudget`'s 5 s margin stays
42
- * inside the 15 s default, so a normal wait can never trip the per-request deadline (which is fatal to
43
- * the connection). A finished job returns from the slice immediately, so this only bounds the idle case.
44
- */
45
- export declare const WAIT_SLICE_MS = 5000;
46
- /** Retained-output cap the tool applies when the caller does not ask for one. */
47
- export declare const DEFAULT_JOB_OUTPUT_BYTES: number;
48
- /**
49
- * Largest retained-output cap the tool will pass on.
50
- *
51
- * Pinned to the agent's own `MaxJobOutputBytes` (`dsh-ssh-agent/internal/proc/jobs.go`): the agent refuses a
52
- * larger value with `E_TOO_LARGE`, so clamping here keeps the caller inside the contract and lets the echoed
53
- * `maxOutputBytes` in the result be the truth about what was actually applied.
54
- */
55
- export declare const MAX_JOB_OUTPUT_BYTES: number;
56
- /** The remote root one job call targets. */
57
- export interface RemoteJobTarget {
58
- readonly connectionId: string;
59
- readonly root: string;
60
- }
61
- /** One job's state, as the tools expose it. */
62
- export interface RemoteJobView {
63
- readonly id: string;
64
- /** `running` / `exited` / `killed` / `failed`. */
65
- readonly state: string;
66
- readonly command: string;
67
- readonly pid?: number | undefined;
68
- readonly exitCode: number;
69
- readonly signal?: string | undefined;
70
- readonly timedOut: boolean;
71
- readonly startedMs: number;
72
- readonly durationMs: number;
73
- readonly outputBytes: number;
74
- /** Bytes dropped from the **oldest** end of the ring; non-zero means the output has a hole. */
75
- readonly droppedBytes: number;
76
- }
77
- /** One job's output window, as the tools expose it. */
78
- export interface RemoteJobOutputView {
79
- readonly id: string;
80
- readonly state: string;
81
- readonly data: string;
82
- /** Pass this as the next `offset` to get only what is new. */
83
- readonly nextOffset: number;
84
- readonly droppedBytes: number;
85
- readonly totalBytes: number;
86
- /** The requested span was already dropped: `data` is **not** continuous output. */
87
- readonly lost: boolean;
88
- readonly exitCode: number;
89
- readonly signal?: string | undefined;
90
- readonly timedOut: boolean;
91
- }
92
- /** One `remote_exec_background` request, after validation. */
93
- export interface JobStartRequest {
94
- readonly command: string;
95
- /** Root-absolute working directory. */
96
- readonly cwd: string;
97
- readonly env: Readonly<Record<string, string>> | undefined;
98
- /** `undefined` means **no limit** (the agent's `proc.start` treats 0/absent as unlimited). */
99
- readonly timeoutMs: number | undefined;
100
- readonly maxOutputBytes: number;
101
- /** Text written to stdin at start (one-shot). */
102
- readonly stdin?: string;
103
- /** Keep stdin open so `remote_job_stdin` can append later (审计 0030). */
104
- readonly interactive?: boolean;
105
- }
106
- /** What the job tools need, injected so the definitions stay testable without a transport. */
107
- export interface RemoteJobBackend {
108
- /** Resolve an agent working directory to a remote root. */
109
- resolve(cwd: string): RemoteJobTarget | undefined;
110
- /** Start a job and return immediately. */
111
- start(target: RemoteJobTarget, request: JobStartRequest, signal: AbortSignal): Promise<RemoteJobView>;
112
- /**
113
- * One job's state.
114
- *
115
- * `waitMs` asks the agent to block (server-side) up to that long before answering — the v1
116
- * long-poll that turns "60 round trips per wait" into one. Omitted means "answer immediately",
117
- * which is what an agent that predates the field does anyway.
118
- */
119
- status(target: RemoteJobTarget, jobId: string, signal: AbortSignal, waitMs?: number): Promise<RemoteJobView>;
120
- /** One job's output from `offset`; `waitMs` as in {@link status}. */
121
- output(target: RemoteJobTarget, jobId: string, offset: number, signal: AbortSignal, waitMs?: number): Promise<RemoteJobOutputView>;
122
- /** Request termination. */
123
- kill(target: RemoteJobTarget, jobId: string, signal: AbortSignal): Promise<AgentJobKill>;
124
- /**
125
- * Feed a running interactive job's stdin (审计 0030).
126
- *
127
- * Throws `REMOTE_UNSUPPORTED` when the agent predates `proc.stdin` **or** the job was not started with
128
- * `interactive` — both are capability facts the caller can only report, not work around.
129
- */
130
- stdin(target: RemoteJobTarget, jobId: string, request: {
131
- readonly data?: string;
132
- readonly dataBase64?: string;
133
- readonly close?: boolean;
134
- }, signal: AbortSignal): Promise<{
135
- readonly id: string;
136
- readonly bytes: number;
137
- readonly closed: boolean;
138
- }>;
139
- /** Every job this connection has started. */
140
- list(target: RemoteJobTarget, signal: AbortSignal): Promise<readonly RemoteJobView[]>;
141
- /** Bounded poll until the job settles; reports how long it waited. */
142
- waitFor(target: RemoteJobTarget, jobId: string, timeoutMs: number, signal: AbortSignal): Promise<{
143
- readonly status: RemoteJobView;
144
- readonly waitedMs: number;
145
- }>;
146
- }
147
- /** The slice of an agent-capable transport the job tools use. */
148
- export interface AgentJobCapable {
149
- procStart(request: AgentProcStartRequest, signal?: AbortSignal): Promise<AgentJobStatus>;
150
- /** `waitMs` is the v1 long-poll budget (server blocks up to that long); omitted = immediate. */
151
- procStatus(id: string, signal?: AbortSignal, waitMs?: number): Promise<AgentJobStatus>;
152
- procOutput(id: string, offset?: number, signal?: AbortSignal, waitMs?: number): Promise<AgentJobOutput>;
153
- procKill(id: string, signal?: AbortSignal): Promise<AgentJobKill>;
154
- procList(signal?: AbortSignal): Promise<readonly AgentJobStatus[]>;
155
- /** `proc.stdin`: feed a running interactive job (审计 0030). */
156
- procStdin?(id: string, data: string, close: boolean, signal?: AbortSignal): Promise<{
157
- readonly id: string;
158
- readonly bytes: number;
159
- readonly closed: boolean;
160
- }>;
161
- /** `proc.stdin` with base64 support (the transport-level shape the backend forwards to). */
162
- jobStdin?(request: {
163
- readonly id: string;
164
- readonly data?: string;
165
- readonly dataBase64?: string;
166
- readonly close?: boolean;
167
- }, signal?: AbortSignal): Promise<{
168
- readonly id: string;
169
- readonly bytes: number;
170
- readonly closed: boolean;
171
- }>;
172
- /** `proc.stdin` (审计 0030): optional, because an older agent answers E_METHOD for it. */
173
- procStdin?(id: string, data: string, close: boolean, signal?: AbortSignal): Promise<{
174
- readonly id: string;
175
- readonly bytes: number;
176
- readonly closed: boolean;
177
- }>;
178
- }
179
- /** What the backend needs from its owner. All injected, so it is testable without a real host. */
180
- export interface RemoteJobBackendDeps {
181
- /** Resolve a caller's working directory to a remote root. */
182
- readonly resolveRoot: (cwd: string) => RemoteJobTarget | undefined;
183
- /** Acquire the connection's transport. */
184
- readonly acquire: (connectionId: string) => Promise<Transport>;
185
- /** Poll interval of the wait loop. */
186
- readonly pollIntervalMs?: number;
187
- /** Injectable clock, so a wait's deadline can be tested without sleeping. */
188
- readonly now?: () => number;
189
- /** Injectable sleep, so the wait loop can be tested without waiting. */
190
- readonly sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
191
- }
192
- /**
193
- * Whether a transport can answer the `proc.*` family.
194
- *
195
- * Structural on purpose, and for the same reason `isAgentSearchCapable` is: the agent's capability frame
196
- * carries no `proc` bit (`AgentCapabilities` in `agent-transport.ts`), so the honest question is "does this
197
- * transport implement the methods", not "does it claim a flag". A wrapper or a future transport that speaks
198
- * the same protocol still passes, and a test can supply one.
199
- *
200
- * Method presence is a **necessary** condition, not a sufficient one: an agent older than `proc.start`
201
- * implements none of them, and an agent that implements them but cannot build the Landlock fence answers
202
- * `E_METHOD` / `E_UNSUPPORTED`, which the transport already translates into `REMOTE_UNSUPPORTED`.
203
- *
204
- * @param transport - candidate transport.
205
- * @returns whether every `proc.*` method is present.
206
- */
207
- export declare function isAgentJobCapable(transport: unknown): transport is AgentJobCapable;
208
- /**
209
- * Build the job backend the entry registers.
210
- *
211
- * @param deps - injected host wiring.
212
- * @returns the backend consumed by {@link registerRemoteJobTools}.
213
- */
214
- export declare function createRemoteJobBackend(deps: RemoteJobBackendDeps): RemoteJobBackend;
215
- /** One job rendered as a single line, for the list. */
216
- export declare function formatJobLine(job: RemoteJobView): string;
217
- /** The fields the one-line job status needs; a status and an output window both carry them. */
218
- export interface JobStatusFields {
219
- readonly id: string;
220
- readonly state: string;
221
- readonly exitCode: number;
222
- readonly signal?: string | undefined;
223
- readonly timedOut: boolean;
224
- /** Absent for an output window, which does not report a duration. */
225
- readonly durationMs?: number | undefined;
226
- readonly outputBytes: number;
227
- readonly droppedBytes: number;
228
- }
229
- /** The status line shared by the job tools' renderings. */
230
- export declare function formatJobStatusLine(job: JobStatusFields): string;
231
- /** Model-facing rendering of a started job. */
232
- export declare function formatJobStarted(job: RemoteJobView, cwd: string, maxOutputBytes: number): string;
233
- /** Model-facing rendering of one job's status. */
234
- export declare function formatJobStatus(job: RemoteJobView): string;
235
- /**
236
- * The job-output value as rendered: the window plus what the wait loop learned.
237
- *
238
- * Deliberately the schema's own shape (including `jobId`, and including `running`), so the renderer reads
239
- * exactly what the tool returned rather than a re-projection that could drift from it.
240
- */
241
- export interface JobOutputView {
242
- readonly jobId: string;
243
- readonly state: string;
244
- readonly data: string;
245
- readonly nextOffset: number;
246
- readonly droppedBytes: number;
247
- readonly totalBytes: number;
248
- readonly lost: boolean;
249
- readonly exitCode: number;
250
- readonly signal?: string | undefined;
251
- readonly timedOut: boolean;
252
- readonly running: boolean;
253
- /** Milliseconds the bounded wait actually spent; `0` when the caller did not wait. */
254
- readonly waitedMs: number;
255
- /** Whether the caller asked to wait. */
256
- readonly waited: boolean;
257
- }
258
- /** Model-facing rendering of one job's output window. */
259
- export declare function formatJobOutput(view: JobOutputView): string;
260
- /** Model-facing rendering of a kill request. */
261
- export declare function formatJobKill(result: AgentJobKill): string;
262
- /** Model-facing rendering of the job list. */
263
- export declare function formatJobList(jobs: readonly RemoteJobView[]): string;
264
- /**
265
- * Validate an `env` argument.
266
- *
267
- * The rule is the one `infra/transport/shell-quote.ts` and `domain/tool-requests.ts` already enforce for
268
- * `remote_exec`; the third copy is deliberate only because the two existing ones are private to their
269
- * modules, and it is pinned by a test. Refusing by name beats the alternative the transport used to have,
270
- * where an unusable key was silently dropped.
271
- *
272
- * @param value - the model's `env` argument, however malformed.
273
- * @returns the validated map, or an error naming the offending key.
274
- */
275
- export declare function readJobEnv(value: unknown): {
276
- readonly env: Readonly<Record<string, string>> | undefined;
277
- } | {
278
- readonly error: string;
279
- };
280
- /**
281
- * Build the five job definitions.
282
- *
283
- * @param backend - injected implementations.
284
- * @returns the definitions, ready for `ctx.tools.register`.
285
- */
286
- export declare function remoteJobToolDefinitions(backend: RemoteJobBackend): ToolDefinition[];
287
- /**
288
- * Register the five job tools on one context.
289
- *
290
- * @param ctx - host context with the `tools` service.
291
- * @param backend - injected implementations.
292
- * @returns a disposer removing every registration (idempotent).
293
- */
294
- export declare function registerRemoteJobTools(ctx: Context, backend: RemoteJobBackend): () => void;
295
- //# sourceMappingURL=remote-job-tools.d.ts.map
@@ -1,97 +0,0 @@
1
- /**
2
- * The `remote_grep` / `remote_glob` / `remote_exec` backend.
3
- *
4
- * Extracted from the plugin entry for two reasons: the entry was growing a second responsibility, and the
5
- * Tier 2/Tier 1 decision below could not be exercised by any test while it lived inline (the tools'
6
- * end-to-end verification needs to build exactly this object against a real host).
7
- *
8
- * Two decisions worth naming:
9
- *
10
- * - **Structural capability checks, not `instanceof`.** The agent path is chosen by asking the transport what
11
- * it can do (`agentCapabilities.grep` + a `searchGrep` method), so a wrapper or a future transport that
12
- * speaks the same protocol still gets Tier 2 — and a test can supply one.
13
- * - **Tier 2 first, Tier 1 always available.** The agent measured ~0.16 ms/file for scans against ~635 ms per
14
- * per-file round trip (审计 0009), so search prefers it; when it is absent or fails to answer the shell
15
- * path takes over. Failing over is reported through `strategy`, never hidden.
16
- *
17
- * @module dsh-remote-workspace/integration/remote-tool-backend
18
- */
19
- import type { Transport } from '../infra/transport/transport.ts';
20
- import type { RemoteToolBackend } from './remote-tools.ts';
21
- /** One search hit as the agent transport reports it (only the fields this module reads). */
22
- export interface AgentSearchHit {
23
- readonly path: string;
24
- readonly line: number;
25
- readonly text: string;
26
- }
27
- /** The agent search result shape this module consumes. */
28
- export interface AgentSearchOutcome {
29
- readonly matches: readonly AgentSearchHit[];
30
- readonly strategy: string;
31
- readonly truncated: boolean;
32
- /** Which bounds stopped the scan (agent `truncatedReasons`); empty when the agent did not say. */
33
- readonly truncatedReasons?: readonly string[] | undefined;
34
- /** Candidate files the `include` filters removed; `undefined` when the agent did not say. */
35
- readonly filesFiltered?: number | undefined;
36
- }
37
- /** The slice of an agent-capable transport the backend uses. */
38
- export interface AgentSearchCapable {
39
- readonly agentCapabilities: {
40
- readonly grep?: boolean;
41
- };
42
- searchGrep(request: {
43
- readonly paths: readonly string[];
44
- readonly query: string;
45
- readonly literal?: boolean;
46
- /** Case-insensitive matching; the agent's own default is `true`. */
47
- readonly ignoreCase?: boolean;
48
- /** Drop VCS ignore rules and the agent's built-in noise directories (audit 0064 P3). */
49
- readonly noIgnore?: boolean;
50
- readonly maxResults?: number;
51
- /** Filename patterns to keep, e.g. `*.cpp` (audit 0052 P10). */
52
- readonly include?: readonly string[];
53
- }, signal?: AbortSignal): Promise<AgentSearchOutcome>;
54
- }
55
- /** What the backend needs from its owner. All injected, so it is testable without a real host. */
56
- export interface RemoteToolBackendDeps {
57
- /**
58
- * Resolve a caller's working directory to a remote root.
59
- *
60
- * @param cwd - the agent's session cwd.
61
- * @returns the target, or `undefined` when no remote root contains it.
62
- */
63
- readonly resolveRoot: (cwd: string) => {
64
- readonly connectionId: string;
65
- readonly root: string;
66
- } | undefined;
67
- /**
68
- * Acquire the connection's transport.
69
- *
70
- * @param connectionId - configured connection id.
71
- * @returns the transport (the caller owns its lifetime).
72
- */
73
- readonly acquire: (connectionId: string) => Promise<Transport>;
74
- /**
75
- * Enumerate a remote root (the shared index).
76
- *
77
- * @param connectionId - connection owning the root.
78
- * @param root - backend-absolute root path.
79
- * @param signal - caller cancellation.
80
- * @returns enumerated paths, whether a cap was hit, and which strategy answered.
81
- */
82
- readonly enumerate: (connectionId: string, root: string, signal?: AbortSignal) => Promise<{
83
- readonly paths: readonly string[];
84
- readonly truncated: boolean;
85
- readonly source: string;
86
- }>;
87
- }
88
- /** Whether a transport can answer agent-side searches. */
89
- export declare function isAgentSearchCapable(transport: unknown): transport is AgentSearchCapable;
90
- /**
91
- * Build the tool backend the entry registers.
92
- *
93
- * @param deps - injected host wiring.
94
- * @returns the backend consumed by {@link registerRemoteTools}.
95
- */
96
- export declare function createRemoteToolBackend(deps: RemoteToolBackendDeps): RemoteToolBackend;
97
- //# sourceMappingURL=remote-tool-backend.d.ts.map
@@ -1,206 +0,0 @@
1
- /**
2
- * The agent-facing tool surface: `remote_grep`, `remote_glob`, `remote_exec`.
3
- *
4
- * Before this module the plugin could do everything *for the user* (files, terminal, completion) but exposed
5
- * nothing *to the model*: a turn could not search or run anything on the remote host. These three tools close
6
- * that hole, and every one of them is bounded and reports its truncation.
7
- *
8
- * Targeting: a tool call runs on behalf of one agent, so the agent's session cwd decides which registered root
9
- * answers — the same rule the file-reference provider uses. A cwd outside every root is an error, not a
10
- * silent fallback to the local machine.
11
- *
12
- * **Path spelling is one rule for every tool** (audit 0052 P1/P2): `cwd` / `path` accept an absolute path
13
- * inside the root *or* a root-relative one, resolved by `resolveUnderRoot`. An absolute path outside the root
14
- * is refused by name instead of being silently re-rooted, and `..` folds without leaving the root. All three
15
- * tools say so in their parameter descriptions, because the previous wording ("relative to the workspace
16
- * root") described one contract while the host enforced another.
17
- *
18
- * **Remote calls are serial within a session** (audit 0052 P5): `Promise.all` over several remote calls
19
- * produces no overlap. That is deliberate for a shared build server (concurrent `make` invocations trample
20
- * each other), and every tool says so instead of leaving the caller to discover it by timing three sleeps.
21
- *
22
- * @module dsh-remote-workspace/integration/remote-tools
23
- */
24
- import type { Context } from '@deepseek-ai/cordis';
25
- import { type ToolDefinition } from '@deepseek-ai/dsh-tools';
26
- import { type ExecRequest, type GlobRequest, type GrepRequest, type GrepOutcome, type SearchTruncation } from '../domain/tool-requests.ts';
27
- /** The remote root one call targets. */
28
- export interface RemoteToolTarget {
29
- readonly connectionId: string;
30
- readonly root: string;
31
- }
32
- /** Result of a glob/listing call. */
33
- export interface GlobOutcome {
34
- readonly paths: readonly string[];
35
- readonly truncated: boolean;
36
- readonly strategy: string;
37
- }
38
- /**
39
- * Result of a command call.
40
- *
41
- * The per-stream fields are **optional on purpose**: they are what a current agent reports, and an older
42
- * agent (or the shell transports, which report one `truncated` for the whole result) simply omits them.
43
- * {@link readExecTruncation} normalizes both shapes, so nothing here has to guess.
44
- */
45
- export interface ExecOutcome {
46
- readonly exitCode: number;
47
- /**
48
- * The signal that ended the command, or `null`/absent when it exited on its own.
49
- *
50
- * Together with {@link timedOut} this is what makes `exitCode = -1` readable: the code alone cannot say
51
- * whether the deadline fired or the process was signalled (audit 0064 P4).
52
- */
53
- readonly signal?: string | null | undefined;
54
- /**
55
- * Whether the answering transport's own deadline ended the command.
56
- *
57
- * `true` does **not** claim the remote process is dead — only that this plugin stopped waiting, which is
58
- * exactly what its `timeoutMs` description promises.
59
- */
60
- readonly timedOut?: boolean | undefined;
61
- readonly stdout: string;
62
- readonly stderr: string;
63
- readonly durationMs: number;
64
- /** Deprecated single flag: at least one stream was cut. */
65
- readonly truncated: boolean;
66
- /** Whether **stdout** was cut (agent `proc.exec` `stdoutTruncated`). */
67
- readonly stdoutTruncated?: boolean | undefined;
68
- /** Whether **stderr** was cut (agent `proc.exec` `stderrTruncated`). */
69
- readonly stderrTruncated?: boolean | undefined;
70
- /** Remote path holding the full stdout; present only when stdout was cut. */
71
- readonly stdoutSpillPath?: string | undefined;
72
- /** Remote path holding the full stderr; present only when stderr was cut. */
73
- readonly stderrSpillPath?: string | undefined;
74
- }
75
- /** Everything the tools need, injected so the definitions stay testable without transports. */
76
- export interface RemoteToolBackend {
77
- /**
78
- * Resolve an agent working directory to a remote root.
79
- *
80
- * @param cwd - the agent's session cwd.
81
- * @returns the target, or `undefined` when the cwd is outside every remote root.
82
- */
83
- resolve(cwd: string): RemoteToolTarget | undefined;
84
- /** Search one remote root. */
85
- grep(target: RemoteToolTarget, request: GrepRequest, signal: AbortSignal): Promise<GrepOutcome>;
86
- /** Enumerate one remote root and match paths. */
87
- glob(target: RemoteToolTarget, request: GlobRequest, signal: AbortSignal): Promise<GlobOutcome>;
88
- /** Run one command on the remote host. */
89
- exec(target: RemoteToolTarget, request: ExecRequest, signal: AbortSignal): Promise<ExecOutcome>;
90
- }
91
- /**
92
- * Build the tool definitions.
93
- *
94
- * @param backend - injected implementations.
95
- * @returns the three definitions, ready for `ctx.tools.register`.
96
- */
97
- export declare function remoteToolDefinitions(backend: RemoteToolBackend): ToolDefinition[];
98
- /** The grep value as rendered: the outcome plus the echo fields the schema also carries. */
99
- export interface GrepView extends GrepOutcome {
100
- /** Filters the search was built with (empty when none). */
101
- readonly include?: readonly string[] | undefined;
102
- /** The root-absolute directory that was searched. */
103
- readonly path?: string | undefined;
104
- /**
105
- * Which bounds stopped the search (agent `truncatedReasons`), flattened onto the value because that is the
106
- * shape the output schema exposes. Empty/absent means the answering tier could not say.
107
- */
108
- readonly truncatedReasons?: readonly string[] | undefined;
109
- /** Candidate files the `include` filters removed, when the agent reported it. */
110
- readonly filesFiltered?: number | undefined;
111
- /** The structured report, when a caller has one in hand (the backend's own outcome). */
112
- readonly truncation?: SearchTruncation | undefined;
113
- /** Whether the search distinguished case; echoed because it changes what "no matches" means. */
114
- readonly caseSensitive?: boolean | undefined;
115
- /** Whether the search dropped the ignore rules it could apply. */
116
- readonly noIgnore?: boolean | undefined;
117
- }
118
- /** The glob value as rendered: the outcome plus the semantics echo and the hint. */
119
- export interface GlobView extends GlobOutcome {
120
- /** The pattern as the caller wrote it. */
121
- readonly pattern?: string | undefined;
122
- /** The root-absolute directory that was enumerated. */
123
- readonly path?: string | undefined;
124
- /** How the pattern was interpreted (`substring`). */
125
- readonly matchSemantics?: string | undefined;
126
- /** Actionable note when zero paths came back, or when the caller probably expected a glob. */
127
- readonly hint?: string | undefined;
128
- }
129
- /**
130
- * Whether a pattern looks like a glob, and if so what to do instead.
131
- *
132
- * Exported because the wording is part of the tool's contract: the tool is named `remote_glob` but matches
133
- * substrings, so "0 results" has two very different meanings that must not look alike (audit 0052 P3).
134
- *
135
- * @param pattern - the pattern as the caller wrote it.
136
- * @param matchCount - how many paths came back.
137
- * @returns the hint, or `undefined` when there is nothing worth saying.
138
- */
139
- export declare function globHint(pattern: string, matchCount: number): string | undefined;
140
- /**
141
- * Explain a failure that is really about the working directory.
142
- *
143
- * The user-visible symptom this addresses (audit 0052 P1): an unusable `cwd` surfaced as
144
- * `E_IO:无法启动进程:fork/exec /bin/sh: no such file or directory`, which reads as "the remote host has no
145
- * shell" and sends the reader off to debug the SSH environment instead of the path they passed. The message
146
- * below names the directory instead.
147
- *
148
- * **Why this is a message and not a pre-flight `stat`.** Two reasons, both deliberate:
149
- *
150
- * 1. A stat costs a full round trip on every single command, including the overwhelming majority that use a
151
- * valid cwd; and it would still race (the directory can vanish between the check and the `chdir`).
152
- * 2. The signature is unambiguous: `fork/exec` failing on the shell binary is what Go's `exec.Cmd` produces
153
- * when `Dir` cannot be entered, and the shell transports emit `cd: … No such file or directory` from the
154
- * `cd` prefix `scriptPrefixes` builds. Both are matched below.
155
- *
156
- * It is worded as a **likely** cause rather than a diagnosis, because the plugin has not stat'd the path.
157
- *
158
- * @param cwd - the root-absolute directory the command was asked to run in.
159
- * @param text - the failure text: the agent error's message, or the command's stderr.
160
- * @param failed - whether the command actually failed (a thrown error counts).
161
- * @param requested - whether the caller named a `cwd` at all; without one there is nothing to explain.
162
- * @returns a model-facing explanation, or `undefined` when the failure is not cwd-shaped.
163
- */
164
- export declare function cwdFailureHint(cwd: string, text: string, failed: boolean, requested: boolean): string | undefined;
165
- /** Model-facing rendering of a search outcome. */
166
- export declare function formatGrep(outcome: GrepView): string;
167
- /**
168
- * The truncation paragraph: which bound was hit, and what to change.
169
- *
170
- * Exported for the same reason as the renderers: the wording is the contract. Note what it deliberately does
171
- * **not** say — there is no offset, cursor or page parameter, because the agent keeps no server-side state
172
- * between calls, so "continue from where you stopped" is not an option and must not be implied.
173
- *
174
- * @param truncation - the normalized report, when the answering tier could provide one.
175
- * @returns zero or more model-facing lines.
176
- */
177
- export declare function truncationLines(truncation: SearchTruncation | undefined): string[];
178
- /** Model-facing rendering of a glob outcome. */
179
- export declare function formatGlob(outcome: GlobView): string;
180
- /**
181
- * The exec value as rendered: the outcome plus the cwd diagnosis the tool adds.
182
- *
183
- * `cwdFailure` lives on the **rendered value**, not on {@link ExecOutcome}: the outcome is what the backend
184
- * reported, while this is the tool layer's own explanation of it.
185
- */
186
- export interface ExecView extends ExecOutcome {
187
- /** Set when the command failed with the signature of an unusable `cwd`. */
188
- readonly cwdFailure?: string | undefined;
189
- }
190
- /**
191
- * Model-facing rendering of a command outcome.
192
- *
193
- * Truncation is reported **per stream** (audit 0052 P4): "output was cut" left the reader unable to tell
194
- * whether the compiler's diagnostics in stderr were complete. When the agent spilled a stream, the message
195
- * names the remote path holding the full text so the model can go read it instead of re-running a build.
196
- */
197
- export declare function formatExec(outcome: ExecView): string;
198
- /**
199
- * Register the tools on one context.
200
- *
201
- * @param ctx - host context with the `tools` service.
202
- * @param backend - injected implementations.
203
- * @returns a disposer removing every registration (idempotent).
204
- */
205
- export declare function registerRemoteTools(ctx: Context, backend: RemoteToolBackend): () => void;
206
- //# sourceMappingURL=remote-tools.d.ts.map