@celljs/ta-host 4.8.0 → 4.9.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 (435) hide show
  1. package/README.en.md +33 -5
  2. package/README.md +33 -5
  3. package/cell.schema.json +4 -0
  4. package/cell.yml +2 -0
  5. package/esm/node/client-tool-broker.d.ts +11 -3
  6. package/esm/node/client-tool-broker.js +23 -3
  7. package/esm/node/host-protocol.d.ts +22 -1
  8. package/esm/node/host-protocol.js +1 -0
  9. package/esm/node/index.d.ts +4 -0
  10. package/esm/node/index.js +4 -0
  11. package/esm/node/live-run.d.ts +22 -0
  12. package/esm/node/live-run.js +58 -0
  13. package/esm/node/message-page.d.ts +17 -0
  14. package/esm/node/message-page.js +71 -0
  15. package/esm/node/package-server-impl.d.ts +9 -1
  16. package/esm/node/package-server-impl.js +16 -1
  17. package/esm/node/relay-bridge.d.ts +9 -1
  18. package/esm/node/relay-bridge.js +44 -4
  19. package/esm/node/session-catalog.d.ts +69 -0
  20. package/esm/node/session-catalog.js +213 -0
  21. package/esm/node/session-info-util.d.ts +4 -1
  22. package/esm/node/session-info-util.js +8 -3
  23. package/esm/node/settings-store.d.ts +1 -4
  24. package/esm/node/settings-store.js +11 -3
  25. package/esm/node/sign-in/access-server-impl.d.ts +19 -0
  26. package/esm/node/sign-in/access-server-impl.js +82 -0
  27. package/esm/node/sign-in/access-store.d.ts +65 -0
  28. package/esm/node/sign-in/access-store.js +175 -0
  29. package/esm/node/sign-in/index.d.ts +7 -0
  30. package/esm/node/sign-in/index.js +8 -0
  31. package/esm/node/sign-in/sign-in-flow.d.ts +58 -0
  32. package/esm/node/sign-in/sign-in-flow.js +104 -0
  33. package/esm/node/sign-in/sign-in-middleware.d.ts +10 -0
  34. package/esm/node/sign-in/sign-in-middleware.js +48 -0
  35. package/esm/node/sign-in/sign-in-pages.d.ts +31 -0
  36. package/esm/node/sign-in/sign-in-pages.js +124 -0
  37. package/esm/node/sign-in/sign-in-provider.d.ts +135 -0
  38. package/esm/node/sign-in/sign-in-provider.js +225 -0
  39. package/esm/node/sign-in/ta-sign-in.d.ts +10 -0
  40. package/esm/node/sign-in/ta-sign-in.js +32 -0
  41. package/esm/node/ta-access.d.ts +7 -0
  42. package/esm/node/ta-access.js +30 -1
  43. package/esm/node/ta-server-impl.d.ts +8 -3
  44. package/esm/node/ta-server-impl.js +25 -6
  45. package/esm/node/ta-session-factory.d.ts +1 -1
  46. package/esm/node/ta-session-factory.js +14 -4
  47. package/esm/node/ta-session-registry.d.ts +2 -0
  48. package/esm/node/ta-session-registry.js +23 -3
  49. package/esm/node/ta-session.d.ts +24 -2
  50. package/esm/node/ta-session.js +83 -6
  51. package/esm/node/temporary-packages.d.ts +46 -0
  52. package/esm/node/temporary-packages.js +114 -0
  53. package/esm/node/temporary-purge.d.ts +13 -0
  54. package/esm/node/temporary-purge.js +51 -0
  55. package/esm/node/web-extension-catalog.d.ts +28 -1
  56. package/esm/node/web-extension-catalog.js +173 -5
  57. package/esm/node/web-extension-util.d.ts +5 -1
  58. package/esm/node/web-extension-util.js +36 -5
  59. package/esm/node/workspace-service.js +1 -1
  60. package/lib/node/client-tool-broker.d.ts +11 -3
  61. package/lib/node/client-tool-broker.js +23 -3
  62. package/lib/node/host-protocol.d.ts +22 -1
  63. package/lib/node/host-protocol.js +2 -1
  64. package/lib/node/index.d.ts +4 -0
  65. package/lib/node/index.js +4 -0
  66. package/lib/node/live-run.d.ts +23 -0
  67. package/lib/node/live-run.js +62 -0
  68. package/lib/node/message-page.d.ts +18 -0
  69. package/lib/node/message-page.js +74 -0
  70. package/lib/node/package-server-impl.d.ts +9 -1
  71. package/lib/node/package-server-impl.js +15 -0
  72. package/lib/node/relay-bridge.d.ts +9 -1
  73. package/lib/node/relay-bridge.js +43 -3
  74. package/lib/node/session-catalog.d.ts +70 -0
  75. package/lib/node/session-catalog.js +216 -0
  76. package/lib/node/session-info-util.d.ts +4 -1
  77. package/lib/node/session-info-util.js +7 -2
  78. package/lib/node/settings-store.d.ts +1 -4
  79. package/lib/node/settings-store.js +11 -3
  80. package/lib/node/sign-in/access-server-impl.d.ts +20 -0
  81. package/lib/node/sign-in/access-server-impl.js +85 -0
  82. package/lib/node/sign-in/access-store.d.ts +66 -0
  83. package/lib/node/sign-in/access-store.js +179 -0
  84. package/lib/node/sign-in/index.d.ts +8 -0
  85. package/lib/node/sign-in/index.js +24 -0
  86. package/lib/node/sign-in/sign-in-flow.d.ts +59 -0
  87. package/lib/node/sign-in/sign-in-flow.js +108 -0
  88. package/lib/node/sign-in/sign-in-middleware.d.ts +11 -0
  89. package/lib/node/sign-in/sign-in-middleware.js +51 -0
  90. package/lib/node/sign-in/sign-in-pages.d.ts +32 -0
  91. package/lib/node/sign-in/sign-in-pages.js +127 -0
  92. package/lib/node/sign-in/sign-in-provider.d.ts +136 -0
  93. package/lib/node/sign-in/sign-in-provider.js +232 -0
  94. package/lib/node/sign-in/ta-sign-in.d.ts +11 -0
  95. package/lib/node/sign-in/ta-sign-in.js +35 -0
  96. package/lib/node/ta-access.d.ts +7 -0
  97. package/lib/node/ta-access.js +30 -1
  98. package/lib/node/ta-server-impl.d.ts +8 -3
  99. package/lib/node/ta-server-impl.js +24 -5
  100. package/lib/node/ta-session-factory.d.ts +1 -1
  101. package/lib/node/ta-session-factory.js +14 -4
  102. package/lib/node/ta-session-registry.d.ts +2 -0
  103. package/lib/node/ta-session-registry.js +23 -3
  104. package/lib/node/ta-session.d.ts +24 -2
  105. package/lib/node/ta-session.js +83 -6
  106. package/lib/node/temporary-packages.d.ts +47 -0
  107. package/lib/node/temporary-packages.js +118 -0
  108. package/lib/node/temporary-purge.d.ts +14 -0
  109. package/lib/node/temporary-purge.js +54 -0
  110. package/lib/node/web-extension-catalog.d.ts +28 -1
  111. package/lib/node/web-extension-catalog.js +172 -4
  112. package/lib/node/web-extension-util.d.ts +5 -1
  113. package/lib/node/web-extension-util.js +36 -5
  114. package/lib/node/workspace-service.js +1 -1
  115. package/package.json +17 -12
  116. package/esm/node/auth-server-impl.js.map +0 -1
  117. package/esm/node/client-channel.js.map +0 -1
  118. package/esm/node/client-tool-broker.js.map +0 -1
  119. package/esm/node/event-log.js.map +0 -1
  120. package/esm/node/exec-environment-factory.js.map +0 -1
  121. package/esm/node/extension-data-notifier.js.map +0 -1
  122. package/esm/node/extension-data.js.map +0 -1
  123. package/esm/node/extension-providers.js.map +0 -1
  124. package/esm/node/host-protocol.js.map +0 -1
  125. package/esm/node/index.js.map +0 -1
  126. package/esm/node/module.js.map +0 -1
  127. package/esm/node/package-host-extension.js.map +0 -1
  128. package/esm/node/package-hosts.js.map +0 -1
  129. package/esm/node/package-server-impl.js.map +0 -1
  130. package/esm/node/package-switch.js.map +0 -1
  131. package/esm/node/receipt-book.js.map +0 -1
  132. package/esm/node/relay-bridge.js.map +0 -1
  133. package/esm/node/remote/index.js.map +0 -1
  134. package/esm/node/remote/pi-directories.js.map +0 -1
  135. package/esm/node/remote/port-forwards.js.map +0 -1
  136. package/esm/node/remote/remote-hosts.js.map +0 -1
  137. package/esm/node/remote/remote-protocol.js.map +0 -1
  138. package/esm/node/remote/remote-server-impl.js.map +0 -1
  139. package/esm/node/remote-ui-context.js.map +0 -1
  140. package/esm/node/session-files.js.map +0 -1
  141. package/esm/node/session-info-util.js.map +0 -1
  142. package/esm/node/session-storage/file-session-storage.js.map +0 -1
  143. package/esm/node/session-storage/index.js.map +0 -1
  144. package/esm/node/session-storage/session-storage-protocol.js.map +0 -1
  145. package/esm/node/session-storage/stored-session.js.map +0 -1
  146. package/esm/node/settings-server-impl.js.map +0 -1
  147. package/esm/node/settings-store.js.map +0 -1
  148. package/esm/node/ta-access.js.map +0 -1
  149. package/esm/node/ta-errors.js.map +0 -1
  150. package/esm/node/ta-event-util.js.map +0 -1
  151. package/esm/node/ta-server-impl.js.map +0 -1
  152. package/esm/node/ta-session-factory.js.map +0 -1
  153. package/esm/node/ta-session-registry.js.map +0 -1
  154. package/esm/node/ta-session.js.map +0 -1
  155. package/esm/node/terminal-protocol.js.map +0 -1
  156. package/esm/node/terminal-service.js.map +0 -1
  157. package/esm/node/terminal-util.js.map +0 -1
  158. package/esm/node/web-extension-catalog.js.map +0 -1
  159. package/esm/node/web-extension-util.js.map +0 -1
  160. package/esm/node/working-directory.js.map +0 -1
  161. package/esm/node/workspace-files.js.map +0 -1
  162. package/esm/node/workspace-protocol.js.map +0 -1
  163. package/esm/node/workspace-server-impl.js.map +0 -1
  164. package/esm/node/workspace-service.js.map +0 -1
  165. package/esm/node/workspace-util.js.map +0 -1
  166. package/lib/node/auth-server-impl.d.ts.map +0 -1
  167. package/lib/node/auth-server-impl.js.map +0 -1
  168. package/lib/node/auth-server-impl.spec.d.ts +0 -2
  169. package/lib/node/auth-server-impl.spec.d.ts.map +0 -1
  170. package/lib/node/auth-server-impl.spec.js +0 -47
  171. package/lib/node/auth-server-impl.spec.js.map +0 -1
  172. package/lib/node/client-channel.d.ts.map +0 -1
  173. package/lib/node/client-channel.js.map +0 -1
  174. package/lib/node/client-channel.spec.d.ts +0 -2
  175. package/lib/node/client-channel.spec.d.ts.map +0 -1
  176. package/lib/node/client-channel.spec.js +0 -106
  177. package/lib/node/client-channel.spec.js.map +0 -1
  178. package/lib/node/client-tool-broker.d.ts.map +0 -1
  179. package/lib/node/client-tool-broker.js.map +0 -1
  180. package/lib/node/client-tool-broker.spec.d.ts +0 -2
  181. package/lib/node/client-tool-broker.spec.d.ts.map +0 -1
  182. package/lib/node/client-tool-broker.spec.js +0 -49
  183. package/lib/node/client-tool-broker.spec.js.map +0 -1
  184. package/lib/node/event-log.d.ts.map +0 -1
  185. package/lib/node/event-log.js.map +0 -1
  186. package/lib/node/event-log.spec.d.ts +0 -2
  187. package/lib/node/event-log.spec.d.ts.map +0 -1
  188. package/lib/node/event-log.spec.js +0 -48
  189. package/lib/node/event-log.spec.js.map +0 -1
  190. package/lib/node/exec-environment-factory.d.ts.map +0 -1
  191. package/lib/node/exec-environment-factory.js.map +0 -1
  192. package/lib/node/extension-data-notifier.d.ts.map +0 -1
  193. package/lib/node/extension-data-notifier.js.map +0 -1
  194. package/lib/node/extension-data-notifier.spec.d.ts +0 -2
  195. package/lib/node/extension-data-notifier.spec.d.ts.map +0 -1
  196. package/lib/node/extension-data-notifier.spec.js +0 -35
  197. package/lib/node/extension-data-notifier.spec.js.map +0 -1
  198. package/lib/node/extension-data.d.ts.map +0 -1
  199. package/lib/node/extension-data.js.map +0 -1
  200. package/lib/node/extension-data.spec.d.ts +0 -2
  201. package/lib/node/extension-data.spec.d.ts.map +0 -1
  202. package/lib/node/extension-data.spec.js +0 -99
  203. package/lib/node/extension-data.spec.js.map +0 -1
  204. package/lib/node/extension-providers.d.ts.map +0 -1
  205. package/lib/node/extension-providers.js.map +0 -1
  206. package/lib/node/host-protocol.d.ts.map +0 -1
  207. package/lib/node/host-protocol.js.map +0 -1
  208. package/lib/node/index.d.ts.map +0 -1
  209. package/lib/node/index.js.map +0 -1
  210. package/lib/node/module.d.ts.map +0 -1
  211. package/lib/node/module.js.map +0 -1
  212. package/lib/node/package-host-extension.d.ts.map +0 -1
  213. package/lib/node/package-host-extension.js.map +0 -1
  214. package/lib/node/package-hosts.d.ts.map +0 -1
  215. package/lib/node/package-hosts.js.map +0 -1
  216. package/lib/node/package-hosts.spec.d.ts +0 -2
  217. package/lib/node/package-hosts.spec.d.ts.map +0 -1
  218. package/lib/node/package-hosts.spec.js +0 -53
  219. package/lib/node/package-hosts.spec.js.map +0 -1
  220. package/lib/node/package-server-impl.d.ts.map +0 -1
  221. package/lib/node/package-server-impl.js.map +0 -1
  222. package/lib/node/package-switch.d.ts.map +0 -1
  223. package/lib/node/package-switch.js.map +0 -1
  224. package/lib/node/receipt-book.d.ts.map +0 -1
  225. package/lib/node/receipt-book.js.map +0 -1
  226. package/lib/node/receipt-book.spec.d.ts +0 -2
  227. package/lib/node/receipt-book.spec.d.ts.map +0 -1
  228. package/lib/node/receipt-book.spec.js +0 -39
  229. package/lib/node/receipt-book.spec.js.map +0 -1
  230. package/lib/node/relay-bridge.d.ts.map +0 -1
  231. package/lib/node/relay-bridge.js.map +0 -1
  232. package/lib/node/remote/index.d.ts.map +0 -1
  233. package/lib/node/remote/index.js.map +0 -1
  234. package/lib/node/remote/pi-directories.d.ts.map +0 -1
  235. package/lib/node/remote/pi-directories.js.map +0 -1
  236. package/lib/node/remote/port-forwards.d.ts.map +0 -1
  237. package/lib/node/remote/port-forwards.js.map +0 -1
  238. package/lib/node/remote/remote-hosts.d.ts.map +0 -1
  239. package/lib/node/remote/remote-hosts.js.map +0 -1
  240. package/lib/node/remote/remote-protocol.d.ts.map +0 -1
  241. package/lib/node/remote/remote-protocol.js.map +0 -1
  242. package/lib/node/remote/remote-server-impl.d.ts.map +0 -1
  243. package/lib/node/remote/remote-server-impl.js.map +0 -1
  244. package/lib/node/remote/remote.spec.d.ts +0 -2
  245. package/lib/node/remote/remote.spec.d.ts.map +0 -1
  246. package/lib/node/remote/remote.spec.js +0 -130
  247. package/lib/node/remote/remote.spec.js.map +0 -1
  248. package/lib/node/remote-ui-context.d.ts.map +0 -1
  249. package/lib/node/remote-ui-context.js.map +0 -1
  250. package/lib/node/remote-ui-context.spec.d.ts +0 -2
  251. package/lib/node/remote-ui-context.spec.d.ts.map +0 -1
  252. package/lib/node/remote-ui-context.spec.js +0 -85
  253. package/lib/node/remote-ui-context.spec.js.map +0 -1
  254. package/lib/node/session-files.d.ts.map +0 -1
  255. package/lib/node/session-files.js.map +0 -1
  256. package/lib/node/session-files.spec.d.ts +0 -2
  257. package/lib/node/session-files.spec.d.ts.map +0 -1
  258. package/lib/node/session-files.spec.js +0 -51
  259. package/lib/node/session-files.spec.js.map +0 -1
  260. package/lib/node/session-info-util.d.ts.map +0 -1
  261. package/lib/node/session-info-util.js.map +0 -1
  262. package/lib/node/session-info-util.spec.d.ts +0 -2
  263. package/lib/node/session-info-util.spec.d.ts.map +0 -1
  264. package/lib/node/session-info-util.spec.js +0 -22
  265. package/lib/node/session-info-util.spec.js.map +0 -1
  266. package/lib/node/session-storage/file-session-storage.d.ts.map +0 -1
  267. package/lib/node/session-storage/file-session-storage.js.map +0 -1
  268. package/lib/node/session-storage/file-session-storage.spec.d.ts +0 -2
  269. package/lib/node/session-storage/file-session-storage.spec.d.ts.map +0 -1
  270. package/lib/node/session-storage/file-session-storage.spec.js +0 -70
  271. package/lib/node/session-storage/file-session-storage.spec.js.map +0 -1
  272. package/lib/node/session-storage/index.d.ts.map +0 -1
  273. package/lib/node/session-storage/index.js.map +0 -1
  274. package/lib/node/session-storage/session-storage-protocol.d.ts.map +0 -1
  275. package/lib/node/session-storage/session-storage-protocol.js.map +0 -1
  276. package/lib/node/session-storage/stored-session.d.ts.map +0 -1
  277. package/lib/node/session-storage/stored-session.js.map +0 -1
  278. package/lib/node/session-storage/stored-session.spec.d.ts +0 -2
  279. package/lib/node/session-storage/stored-session.spec.d.ts.map +0 -1
  280. package/lib/node/session-storage/stored-session.spec.js +0 -73
  281. package/lib/node/session-storage/stored-session.spec.js.map +0 -1
  282. package/lib/node/settings-server-impl.d.ts.map +0 -1
  283. package/lib/node/settings-server-impl.js.map +0 -1
  284. package/lib/node/settings-store.d.ts.map +0 -1
  285. package/lib/node/settings-store.js.map +0 -1
  286. package/lib/node/settings-store.spec.d.ts +0 -2
  287. package/lib/node/settings-store.spec.d.ts.map +0 -1
  288. package/lib/node/settings-store.spec.js +0 -148
  289. package/lib/node/settings-store.spec.js.map +0 -1
  290. package/lib/node/ta-access.d.ts.map +0 -1
  291. package/lib/node/ta-access.js.map +0 -1
  292. package/lib/node/ta-access.spec.d.ts +0 -2
  293. package/lib/node/ta-access.spec.d.ts.map +0 -1
  294. package/lib/node/ta-access.spec.js +0 -33
  295. package/lib/node/ta-access.spec.js.map +0 -1
  296. package/lib/node/ta-errors.d.ts.map +0 -1
  297. package/lib/node/ta-errors.js.map +0 -1
  298. package/lib/node/ta-errors.spec.d.ts +0 -2
  299. package/lib/node/ta-errors.spec.d.ts.map +0 -1
  300. package/lib/node/ta-errors.spec.js +0 -25
  301. package/lib/node/ta-errors.spec.js.map +0 -1
  302. package/lib/node/ta-event-util.d.ts.map +0 -1
  303. package/lib/node/ta-event-util.js.map +0 -1
  304. package/lib/node/ta-event-util.spec.d.ts +0 -2
  305. package/lib/node/ta-event-util.spec.d.ts.map +0 -1
  306. package/lib/node/ta-event-util.spec.js +0 -28
  307. package/lib/node/ta-event-util.spec.js.map +0 -1
  308. package/lib/node/ta-server-impl.d.ts.map +0 -1
  309. package/lib/node/ta-server-impl.js.map +0 -1
  310. package/lib/node/ta-session-factory.d.ts.map +0 -1
  311. package/lib/node/ta-session-factory.js.map +0 -1
  312. package/lib/node/ta-session-registry.d.ts.map +0 -1
  313. package/lib/node/ta-session-registry.js.map +0 -1
  314. package/lib/node/ta-session.d.ts.map +0 -1
  315. package/lib/node/ta-session.js.map +0 -1
  316. package/lib/node/terminal-protocol.d.ts.map +0 -1
  317. package/lib/node/terminal-protocol.js.map +0 -1
  318. package/lib/node/terminal-service.d.ts.map +0 -1
  319. package/lib/node/terminal-service.js.map +0 -1
  320. package/lib/node/terminal-service.spec.d.ts +0 -2
  321. package/lib/node/terminal-service.spec.d.ts.map +0 -1
  322. package/lib/node/terminal-service.spec.js +0 -110
  323. package/lib/node/terminal-service.spec.js.map +0 -1
  324. package/lib/node/terminal-util.d.ts.map +0 -1
  325. package/lib/node/terminal-util.js.map +0 -1
  326. package/lib/node/terminal-util.spec.d.ts +0 -2
  327. package/lib/node/terminal-util.spec.d.ts.map +0 -1
  328. package/lib/node/terminal-util.spec.js +0 -95
  329. package/lib/node/terminal-util.spec.js.map +0 -1
  330. package/lib/node/web-extension-catalog.d.ts.map +0 -1
  331. package/lib/node/web-extension-catalog.js.map +0 -1
  332. package/lib/node/web-extension-catalog.spec.d.ts +0 -2
  333. package/lib/node/web-extension-catalog.spec.d.ts.map +0 -1
  334. package/lib/node/web-extension-catalog.spec.js +0 -157
  335. package/lib/node/web-extension-catalog.spec.js.map +0 -1
  336. package/lib/node/web-extension-util.d.ts.map +0 -1
  337. package/lib/node/web-extension-util.js.map +0 -1
  338. package/lib/node/working-directory.d.ts.map +0 -1
  339. package/lib/node/working-directory.js.map +0 -1
  340. package/lib/node/workspace-files.d.ts.map +0 -1
  341. package/lib/node/workspace-files.js.map +0 -1
  342. package/lib/node/workspace-files.spec.d.ts +0 -2
  343. package/lib/node/workspace-files.spec.d.ts.map +0 -1
  344. package/lib/node/workspace-files.spec.js +0 -133
  345. package/lib/node/workspace-files.spec.js.map +0 -1
  346. package/lib/node/workspace-protocol.d.ts.map +0 -1
  347. package/lib/node/workspace-protocol.js.map +0 -1
  348. package/lib/node/workspace-server-impl.d.ts.map +0 -1
  349. package/lib/node/workspace-server-impl.js.map +0 -1
  350. package/lib/node/workspace-service.d.ts.map +0 -1
  351. package/lib/node/workspace-service.js.map +0 -1
  352. package/lib/node/workspace-service.spec.d.ts +0 -2
  353. package/lib/node/workspace-service.spec.d.ts.map +0 -1
  354. package/lib/node/workspace-service.spec.js +0 -113
  355. package/lib/node/workspace-service.spec.js.map +0 -1
  356. package/lib/node/workspace-util.d.ts.map +0 -1
  357. package/lib/node/workspace-util.js.map +0 -1
  358. package/lib/node/workspace-util.spec.d.ts +0 -2
  359. package/lib/node/workspace-util.spec.d.ts.map +0 -1
  360. package/lib/node/workspace-util.spec.js +0 -44
  361. package/lib/node/workspace-util.spec.js.map +0 -1
  362. package/src/node/auth-server-impl.spec.ts +0 -49
  363. package/src/node/auth-server-impl.ts +0 -258
  364. package/src/node/client-channel.spec.ts +0 -117
  365. package/src/node/client-channel.ts +0 -94
  366. package/src/node/client-tool-broker.spec.ts +0 -53
  367. package/src/node/client-tool-broker.ts +0 -106
  368. package/src/node/event-log.spec.ts +0 -52
  369. package/src/node/event-log.ts +0 -59
  370. package/src/node/exec-environment-factory.ts +0 -66
  371. package/src/node/extension-data-notifier.spec.ts +0 -34
  372. package/src/node/extension-data-notifier.ts +0 -124
  373. package/src/node/extension-data.spec.ts +0 -105
  374. package/src/node/extension-data.ts +0 -180
  375. package/src/node/extension-providers.ts +0 -49
  376. package/src/node/host-protocol.ts +0 -62
  377. package/src/node/index.ts +0 -39
  378. package/src/node/module.ts +0 -4
  379. package/src/node/package-host-extension.ts +0 -23
  380. package/src/node/package-hosts.spec.ts +0 -54
  381. package/src/node/package-hosts.ts +0 -204
  382. package/src/node/package-server-impl.ts +0 -87
  383. package/src/node/package-switch.ts +0 -80
  384. package/src/node/receipt-book.spec.ts +0 -41
  385. package/src/node/receipt-book.ts +0 -40
  386. package/src/node/relay-bridge.ts +0 -94
  387. package/src/node/remote/index.ts +0 -5
  388. package/src/node/remote/pi-directories.ts +0 -49
  389. package/src/node/remote/port-forwards.ts +0 -148
  390. package/src/node/remote/remote-hosts.ts +0 -170
  391. package/src/node/remote/remote-protocol.ts +0 -57
  392. package/src/node/remote/remote-server-impl.ts +0 -60
  393. package/src/node/remote/remote.spec.ts +0 -142
  394. package/src/node/remote-ui-context.spec.ts +0 -93
  395. package/src/node/remote-ui-context.ts +0 -197
  396. package/src/node/session-files.spec.ts +0 -52
  397. package/src/node/session-files.ts +0 -41
  398. package/src/node/session-info-util.spec.ts +0 -23
  399. package/src/node/session-info-util.ts +0 -55
  400. package/src/node/session-storage/file-session-storage.spec.ts +0 -72
  401. package/src/node/session-storage/file-session-storage.ts +0 -145
  402. package/src/node/session-storage/index.ts +0 -3
  403. package/src/node/session-storage/session-storage-protocol.ts +0 -81
  404. package/src/node/session-storage/stored-session.spec.ts +0 -80
  405. package/src/node/session-storage/stored-session.ts +0 -149
  406. package/src/node/settings-server-impl.ts +0 -42
  407. package/src/node/settings-store.spec.ts +0 -158
  408. package/src/node/settings-store.ts +0 -327
  409. package/src/node/ta-access.spec.ts +0 -36
  410. package/src/node/ta-access.ts +0 -156
  411. package/src/node/ta-errors.spec.ts +0 -25
  412. package/src/node/ta-errors.ts +0 -75
  413. package/src/node/ta-event-util.spec.ts +0 -29
  414. package/src/node/ta-event-util.ts +0 -23
  415. package/src/node/ta-server-impl.ts +0 -341
  416. package/src/node/ta-session-factory.ts +0 -216
  417. package/src/node/ta-session-registry.ts +0 -75
  418. package/src/node/ta-session.ts +0 -241
  419. package/src/node/terminal-protocol.ts +0 -18
  420. package/src/node/terminal-service.spec.ts +0 -119
  421. package/src/node/terminal-service.ts +0 -291
  422. package/src/node/terminal-util.spec.ts +0 -109
  423. package/src/node/terminal-util.ts +0 -197
  424. package/src/node/web-extension-catalog.spec.ts +0 -172
  425. package/src/node/web-extension-catalog.ts +0 -177
  426. package/src/node/web-extension-util.ts +0 -144
  427. package/src/node/working-directory.ts +0 -71
  428. package/src/node/workspace-files.spec.ts +0 -145
  429. package/src/node/workspace-files.ts +0 -256
  430. package/src/node/workspace-protocol.ts +0 -24
  431. package/src/node/workspace-server-impl.ts +0 -108
  432. package/src/node/workspace-service.spec.ts +0 -123
  433. package/src/node/workspace-service.ts +0 -235
  434. package/src/node/workspace-util.spec.ts +0 -47
  435. package/src/node/workspace-util.ts +0 -103
@@ -1,94 +0,0 @@
1
- import { unwatchFile, watchFile } from 'node:fs';
2
- import type { Server } from 'node:http';
3
- import type { AddressInfo } from 'node:net';
4
- import { type Application, ApplicationLifecycle, Autowired, Component } from '@celljs/core';
5
- import { Rpc } from '@celljs/rpc';
6
- import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
7
- import { TA_WEBSOCKET_PATH, type TaRelayDevice, type TaRelayInfo, TaRelayServer } from '@celljs/ta-protocol';
8
- import { RELAY_DEFAULT_URL, RelayHost, RelayPairingUtil, RelayStore } from '@celljs/ta-relay/lib/node';
9
- import { ServerAware } from '@celljs/web/lib/node';
10
- import { TA_ACCESS, type TaAccess } from './ta-access';
11
- import { TaErrors } from './ta-errors';
12
-
13
- /** The id of {@link RelayBridge}, for TaRelayServerImpl. */
14
- export const RELAY_BRIDGE = Symbol('RelayBridge');
15
-
16
- /** How often relay.json is looked at, for devices that `ta pair` adds or removes while the server runs. */
17
- const WATCH_INTERVAL_MS = 2000;
18
-
19
- /**
20
- * Paired devices reach this server through a relay (@celljs/ta-relay): with a device in relay.json, it
21
- * keeps a connection out to the relay and gives each device a connection of its own to this server.
22
- * Without one it does nothing.
23
- */
24
- @Component([RELAY_BRIDGE, ServerAware, ApplicationLifecycle])
25
- export class RelayBridge implements ServerAware, ApplicationLifecycle<Application> {
26
- @Autowired(TA_ACCESS)
27
- protected readonly access: TaAccess;
28
-
29
- readonly store = new RelayStore(TaBrand.agentDir());
30
- protected host?: RelayHost;
31
-
32
- get online(): boolean {
33
- return this.host?.online ?? false;
34
- }
35
-
36
- /** relay.json changed here: no need to wait for the watch. */
37
- refresh(): void {
38
- this.host?.refresh();
39
- }
40
-
41
- async setServer(server: Server): Promise<void> {
42
- const start = () => this.start(server);
43
- if (server.listening) {
44
- start();
45
- } else {
46
- server.once('listening', start);
47
- }
48
- }
49
-
50
- async onStop(): Promise<void> {
51
- unwatchFile(this.store.file);
52
- this.host?.stop();
53
- }
54
-
55
- protected start(server: Server): void {
56
- const { port } = server.address() as AddressInfo;
57
- const localUrl = `ws://127.0.0.1:${port}${TA_WEBSOCKET_PATH}?token=${encodeURIComponent(this.access.token)}`;
58
- const host = new RelayHost({ store: this.store, localUrl });
59
- this.host = host;
60
- host.start();
61
- watchFile(this.store.file, { interval: WATCH_INTERVAL_MS }, () => host.refresh());
62
- }
63
- }
64
- const device = ({ id, name, createdAt }: TaRelayDevice): TaRelayDevice => ({ id, name, createdAt });
65
-
66
- /** `ta pair` for clients: the devices of relay.json, which RelayBridge serves. Their keys never leave, but in the link of a new one. */
67
- @Rpc(TaRelayServer)
68
- export class TaRelayServerImpl implements TaRelayServer {
69
- @Autowired(RELAY_BRIDGE)
70
- protected readonly bridge: RelayBridge;
71
-
72
- async getRelay(): Promise<TaRelayInfo> {
73
- const { url, devices } = this.bridge.store.read();
74
- return { relay: url, defaultRelay: RELAY_DEFAULT_URL, online: this.bridge.online, devices: devices.map(device) };
75
- }
76
-
77
- pair(relay: string, name: string): Promise<{ link: string; device: TaRelayDevice }> {
78
- return TaErrors.guard(() => {
79
- const url = typeof relay === 'string' ? relay.trim().replace(/\/+$/, '') : '';
80
- if (!/^https?:\/\/[^/\s]+$/.test(url)) {
81
- throw TaErrors.invalidArgument(`${relay} is not the address of a relay.`, 'Pass https://<host> of a relay, such as the default one.');
82
- }
83
- const pairing = this.bridge.store.pair(url, (typeof name === 'string' && name.trim()) || 'device');
84
- this.bridge.refresh();
85
- const created = this.bridge.store.device(pairing.device);
86
- return { link: RelayPairingUtil.link(pairing), device: device(created ?? { id: pairing.device, name, createdAt: Date.now(), key: '' }) };
87
- });
88
- }
89
-
90
- async unpair(deviceId: string): Promise<void> {
91
- this.bridge.store.remove(deviceId);
92
- this.bridge.refresh();
93
- }
94
- }
@@ -1,5 +0,0 @@
1
- export * from './pi-directories';
2
- export * from './port-forwards';
3
- export * from './remote-hosts';
4
- export * from './remote-protocol';
5
- export * from './remote-server-impl';
@@ -1,49 +0,0 @@
1
- import { mkdirSync } from 'node:fs';
2
- import { join, sep } from 'node:path';
3
- import { CODING_AGENT_OPTIONS, type CodingAgentOptions } from '@celljs/ai-coding-agent';
4
- import { Component, Value } from '@celljs/core';
5
- import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
6
- import { TaLocation } from '@celljs/ta-protocol';
7
- import { TA_EXEC_OPTIONS, type TaExecOptions } from '../host-protocol';
8
- import { PiDirectories } from './remote-protocol';
9
-
10
- /**
11
- * `<agent directory>/remote/ssh/<host>/<path>` for `ssh://<host>/<path>`. With `ta.exec.url` every
12
- * directory is one of the machine of the exec server: `<agent directory>/remote/exec/<path>`.
13
- */
14
- @Component(PiDirectories)
15
- export class DefaultPiDirectories implements PiDirectories {
16
- @Value(CODING_AGENT_OPTIONS)
17
- protected readonly codingAgentOptions?: CodingAgentOptions;
18
-
19
- @Value(TA_EXEC_OPTIONS)
20
- protected readonly execOptions?: TaExecOptions;
21
-
22
- toPi(location: string): string {
23
- const remote = TaLocation.parse(location);
24
- const prefix = remote ? join('ssh', remote.host) : this.execOptions?.url ? 'exec' : undefined;
25
- if (!prefix) {
26
- return location;
27
- }
28
- const path = remote ? remote.path : location;
29
- const cwd = join(this.root(), prefix, ...path.split('/').filter(Boolean));
30
- mkdirSync(cwd, { recursive: true });
31
- return cwd;
32
- }
33
-
34
- fromPi(cwd: string): string {
35
- const root = this.root() + sep;
36
- if (!cwd.startsWith(root)) {
37
- return cwd;
38
- }
39
- const [kind, ...rest] = cwd.slice(root.length).split(sep);
40
- if (kind === 'ssh' && rest.length > 0 && TaLocation.isHost(rest[0])) {
41
- return TaLocation.ssh(rest[0], `/${rest.slice(1).join('/')}`);
42
- }
43
- return kind === 'exec' ? `/${rest.join('/')}` : cwd;
44
- }
45
-
46
- protected root(): string {
47
- return join(this.codingAgentOptions?.agentDir ?? TaBrand.agentDir(), 'remote');
48
- }
49
- }
@@ -1,148 +0,0 @@
1
- import { createServer, type Server, type Socket } from 'node:net';
2
- import { type Application, ApplicationLifecycle, Autowired, Component } from '@celljs/core';
3
- import { type ExecEnvironment, ExecEnvironmentFactory, type ExecSocket } from '@celljs/ta-exec';
4
- import { type TaForwardedPort, TaLocation } from '@celljs/ta-protocol';
5
- import { TaErrors } from '../ta-errors';
6
- import { PortForwards, RemoteHosts } from './remote-protocol';
7
-
8
- interface Forward {
9
- info: TaForwardedPort;
10
- server: Server;
11
- sockets: Set<Socket>;
12
- }
13
-
14
- /**
15
- * A port of another machine as a port of 127.0.0.1 here: each connection to it is one from the server
16
- * of Ta there (ExecEnvironment.connect). The same number when it is free here, as VS Code does, so that
17
- * the pages of a dev server keep their links.
18
- */
19
- @Component([PortForwards, ApplicationLifecycle])
20
- export class DefaultPortForwards implements PortForwards, ApplicationLifecycle<Application> {
21
- @Autowired(ExecEnvironmentFactory)
22
- protected readonly environments: ExecEnvironmentFactory;
23
-
24
- @Autowired(RemoteHosts)
25
- protected readonly hosts: RemoteHosts;
26
-
27
- protected readonly forwards = new Map<string, Promise<Forward>>();
28
- /** Those open. */
29
- protected readonly open = new Map<string, TaForwardedPort>();
30
- protected watching = false;
31
-
32
- async forward(cwd: string, port: number): Promise<TaForwardedPort> {
33
- if (!Number.isInteger(port) || port < 1 || port > 65535) {
34
- throw TaErrors.invalidArgument(`${port} is not a port.`, 'Pass a port from 1 to 65535.');
35
- }
36
- const env = this.environments.create(cwd);
37
- const host = TaLocation.host(cwd) ?? '';
38
- if (!env.connect) {
39
- return { host, remotePort: port, localPort: port };
40
- }
41
- this.watch();
42
- const key = `${host}:${port}`;
43
- let forward = this.forwards.get(key);
44
- if (!forward) {
45
- forward = this.listenFor(env, host, port);
46
- this.forwards.set(key, forward);
47
- forward.then(
48
- ({ info }) => this.forwards.has(key) && this.open.set(key, info),
49
- () => this.forwards.delete(key),
50
- );
51
- }
52
- return (await forward).info;
53
- }
54
-
55
- list(): TaForwardedPort[] {
56
- return [...this.open.values()];
57
- }
58
-
59
- async close(host: string, remotePort: number): Promise<void> {
60
- const key = `${host}:${remotePort}`;
61
- const forward = await this.forwards.get(key)?.catch(() => undefined);
62
- this.forwards.delete(key);
63
- this.open.delete(key);
64
- if (forward) {
65
- for (const socket of forward.sockets) {
66
- socket.destroy();
67
- }
68
- await new Promise<void>(resolve => forward.server.close(() => resolve()));
69
- }
70
- }
71
-
72
- async onStop(): Promise<void> {
73
- await Promise.all([...this.forwards.keys()].map(key => this.close(...this.split(key))));
74
- }
75
-
76
- protected async listenFor(env: ExecEnvironment, host: string, port: number): Promise<Forward> {
77
- const sockets = new Set<Socket>();
78
- const server = createServer(socket => {
79
- sockets.add(socket);
80
- socket.once('close', () => sockets.delete(socket));
81
- void this.pipe(env, port, socket);
82
- });
83
- const localPort = await this.listen(server, port).catch(() => this.listen(server, 0));
84
- return { info: { host, remotePort: port, localPort }, server, sockets };
85
- }
86
-
87
- protected listen(server: Server, port: number): Promise<number> {
88
- return new Promise((resolve, reject) => {
89
- const failed = (error: Error) => reject(error);
90
- server.once('error', failed);
91
- server.listen(port, '127.0.0.1', () => {
92
- server.removeListener('error', failed);
93
- resolve((server.address() as { port: number }).port);
94
- });
95
- });
96
- }
97
-
98
- /** One connection: data both ways until either side ends it. */
99
- protected async pipe(env: ExecEnvironment, port: number, socket: Socket): Promise<void> {
100
- // What comes before the other end is there waits for it.
101
- const early: Buffer[] = [];
102
- let ended = false;
103
- let remote: ExecSocket | undefined;
104
- const end = () => {
105
- if (remote) {
106
- remote.end();
107
- } else {
108
- ended = true;
109
- }
110
- };
111
- socket.on('data', data => (remote ? remote.write(data) : early.push(data)));
112
- socket.once('end', end);
113
- socket.once('error', end);
114
- try {
115
- remote = await (env.connect as NonNullable<ExecEnvironment['connect']>)(port);
116
- } catch {
117
- socket.destroy();
118
- return;
119
- }
120
- remote.onData(data => socket.write(data));
121
- remote.onClose(() => socket.end());
122
- for (const data of early) {
123
- remote.write(data);
124
- }
125
- if (ended) {
126
- remote.end();
127
- }
128
- }
129
-
130
- /** A host disconnected on purpose takes its ports with it. */
131
- protected watch(): void {
132
- if (!this.watching) {
133
- this.watching = true;
134
- this.hosts.onDisconnect(host => {
135
- for (const key of [...this.forwards.keys()]) {
136
- if (key.startsWith(`${host}:`)) {
137
- void this.close(...this.split(key));
138
- }
139
- }
140
- });
141
- }
142
- }
143
-
144
- protected split(key: string): [string, number] {
145
- const at = key.lastIndexOf(':');
146
- return [key.slice(0, at), Number(key.slice(at + 1))];
147
- }
148
- }
@@ -1,170 +0,0 @@
1
- import { randomUUID } from 'node:crypto';
2
- import { CODING_AGENT_OPTIONS, type CodingAgentOptions } from '@celljs/ai-coding-agent';
3
- import { type Application, ApplicationLifecycle, Autowired, Component, Value } from '@celljs/core';
4
- import type { RpcConnection } from '@celljs/rpc/lib/node';
5
- import { type ExecClient, SshConfig, SshHost, type SshQuestion } from '@celljs/ta-exec';
6
- import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
7
- import { TaClient, TaLocation, type TaRemoteEvent, type TaRemoteHost, type TaRemotePrompt } from '@celljs/ta-protocol';
8
- import { TaErrors } from '../ta-errors';
9
- import { TaWorkingDirectory } from '../working-directory';
10
- import { RemoteHosts, TA_REMOTE_OPTIONS, type TaRemoteOptions } from './remote-protocol';
11
-
12
- /** A prompt nobody answers is cancelled after this: ssh gives up. */
13
- const PROMPT_TIMEOUT_MS = 5 * 60 * 1000;
14
-
15
- interface Waiting {
16
- prompt: TaRemotePrompt;
17
- settle(value: string | undefined): void;
18
- }
19
-
20
- /**
21
- * One SshHost per host, which connects on the first call there and again after a loss. What ssh asks
22
- * goes to every client that watches, and the first answer counts, as with the dialogs of sessions.
23
- */
24
- @Component([RemoteHosts, ApplicationLifecycle])
25
- export class DefaultRemoteHosts implements RemoteHosts, ApplicationLifecycle<Application> {
26
- @Value(TA_REMOTE_OPTIONS)
27
- protected readonly options?: TaRemoteOptions;
28
-
29
- @Value(CODING_AGENT_OPTIONS)
30
- protected readonly codingAgentOptions?: CodingAgentOptions;
31
-
32
- @Autowired(TaWorkingDirectory)
33
- protected readonly workingDirectory: TaWorkingDirectory;
34
-
35
- protected readonly hosts = new Map<string, SshHost>();
36
- protected readonly waiting = new Map<string, Waiting>();
37
- protected readonly watchers = new Set<RpcConnection>();
38
- protected readonly disconnectListeners = new Set<(host: string) => void>();
39
-
40
- client(host: string): ExecClient {
41
- this.check(host);
42
- let ssh = this.hosts.get(host);
43
- if (!ssh) {
44
- ssh = new SshHost({
45
- host,
46
- stateDir: this.codingAgentOptions?.agentDir ?? TaBrand.agentDir(),
47
- ssh: this.options?.ssh || undefined,
48
- sshArgs: this.options?.sshArgs,
49
- nodeMirror: this.options?.nodeMirror || undefined,
50
- ask: question => this.ask(host, question),
51
- onStep: (step, detail) => this.broadcast({ type: 'progress', host, step, detail }),
52
- });
53
- ssh.client.onState((connected, error) => {
54
- if (connected) {
55
- this.workingDirectory.addRecentHost(host);
56
- }
57
- this.broadcast(error ? { type: 'connection', host, connected, error } : { type: 'connection', host, connected });
58
- });
59
- this.hosts.set(host, ssh);
60
- }
61
- return ssh.client;
62
- }
63
-
64
- list(): TaRemoteHost[] {
65
- const recent = this.workingDirectory.recentHosts();
66
- const config = SshConfig.hosts().filter(host => TaLocation.isHost(host) && !recent.includes(host));
67
- return [
68
- ...recent.map(host => ({ host, source: 'recent' as const, connected: this.connected(host) })),
69
- ...config.map(host => ({ host, source: 'config' as const, connected: this.connected(host) })),
70
- ];
71
- }
72
-
73
- add(host: string): void {
74
- this.workingDirectory.addRecentHost(this.check(host));
75
- }
76
-
77
- async remove(host: string): Promise<void> {
78
- await this.disconnect(host);
79
- this.workingDirectory.removeRecentHost(host);
80
- }
81
-
82
- async resolve(location: string): Promise<string> {
83
- const remote = this.parse(location);
84
- if (!remote || remote.path) {
85
- return location;
86
- }
87
- return TaLocation.ssh(remote.host, (await this.client(remote.host).info()).cwd);
88
- }
89
-
90
- async disconnect(host: string): Promise<void> {
91
- const ssh = this.hosts.get(host);
92
- this.hosts.delete(host);
93
- for (const listener of this.disconnectListeners) {
94
- listener(host);
95
- }
96
- await ssh?.dispose();
97
- }
98
-
99
- onDisconnect(listener: (host: string) => void): () => void {
100
- this.disconnectListeners.add(listener);
101
- return () => this.disconnectListeners.delete(listener);
102
- }
103
-
104
- watch(connection: RpcConnection): TaRemotePrompt[] {
105
- if (!this.watchers.has(connection)) {
106
- this.watchers.add(connection);
107
- connection.onClose(() => this.watchers.delete(connection));
108
- }
109
- return [...this.waiting.values()].map(({ prompt }) => prompt);
110
- }
111
-
112
- answer(promptId: string, value: string | null): boolean {
113
- const waiting = this.waiting.get(promptId);
114
- waiting?.settle(typeof value === 'string' ? value : undefined);
115
- return waiting !== undefined;
116
- }
117
-
118
- async onStop(): Promise<void> {
119
- for (const waiting of [...this.waiting.values()]) {
120
- waiting.settle(undefined);
121
- }
122
- await Promise.all([...this.hosts.keys()].map(host => this.disconnect(host)));
123
- }
124
-
125
- protected ask(host: string, question: SshQuestion): Promise<string | undefined> {
126
- const prompt: TaRemotePrompt = { promptId: randomUUID(), host, ...question };
127
- return new Promise(resolve => {
128
- const timer = setTimeout(() => settle(undefined), PROMPT_TIMEOUT_MS);
129
- const settle = (value: string | undefined) => {
130
- clearTimeout(timer);
131
- if (this.waiting.delete(prompt.promptId)) {
132
- this.broadcast({ type: 'prompt_closed', promptId: prompt.promptId });
133
- resolve(value);
134
- }
135
- };
136
- this.waiting.set(prompt.promptId, { prompt, settle });
137
- this.broadcast({ type: 'prompt', prompt });
138
- });
139
- }
140
-
141
- protected broadcast(event: TaRemoteEvent): void {
142
- for (const connection of this.watchers) {
143
- if (!connection.closed) {
144
- connection
145
- .client<TaClient>(TaClient)
146
- .onRemoteEvent(event)
147
- .catch(() => undefined);
148
- }
149
- }
150
- }
151
-
152
- protected check(host: string): string {
153
- if (typeof host !== 'string' || !TaLocation.isHost(host)) {
154
- throw TaErrors.invalidArgument(`${JSON.stringify(host)} is not a host.`, 'Name a Host of ~/.ssh/config, or [user@]host[:port].');
155
- }
156
- return host;
157
- }
158
-
159
- protected connected(host: string): boolean {
160
- return this.hosts.get(host)?.client.connected ?? false;
161
- }
162
-
163
- protected parse(location: string): TaLocation.Remote | undefined {
164
- try {
165
- return TaLocation.parse(location);
166
- } catch (error) {
167
- throw TaErrors.invalidArgument((error as Error).message, 'Write ssh://<host>/<absolute path>.');
168
- }
169
- }
170
- }
@@ -1,57 +0,0 @@
1
- import type { RpcConnection } from '@celljs/rpc/lib/node';
2
- import type { ExecClient } from '@celljs/ta-exec';
3
- import type { TaForwardedPort, TaRemoteHost, TaRemotePrompt } from '@celljs/ta-protocol';
4
-
5
- export const TA_REMOTE_OPTIONS = 'ta.remote';
6
-
7
- /** `ta.remote`: how ta serve reaches other machines. */
8
- export interface TaRemoteOptions {
9
- /** The ssh command; default `ssh`. */
10
- ssh?: string;
11
- /** Before each host, as `-F <file>`. */
12
- sshArgs?: string[];
13
- /** Where Node.js comes from for hosts without one; empty: nodejs.org. */
14
- nodeMirror?: string;
15
- }
16
-
17
- export const RemoteHosts = Symbol('RemoteHosts');
18
- export const PiDirectories = Symbol('PiDirectories');
19
- export const PortForwards = Symbol('PortForwards');
20
-
21
- /** The hosts of `ssh://` locations, one connection each, and what their ssh asks the users. */
22
- export interface RemoteHosts {
23
- /** The connection to a host, made on its first call. */
24
- client(host: string): ExecClient;
25
- list(): TaRemoteHost[];
26
- /** Keeps a host in the list without connecting; throws for what is not a host. */
27
- add(host: string): void;
28
- /** Disconnects and drops it from the list of those opened before. */
29
- remove(host: string): Promise<void>;
30
- /** The location with the home directory as its path when it has none. */
31
- resolve(location: string): Promise<string>;
32
- disconnect(host: string): Promise<void>;
33
- /** Runs once a host is disconnected on purpose. */
34
- onDisconnect(listener: (host: string) => void): () => void;
35
- /** The connection hears TaClient.onRemoteEvent; the prompts that wait now. */
36
- watch(connection: RpcConnection): TaRemotePrompt[];
37
- answer(promptId: string, value: string | null): boolean;
38
- }
39
-
40
- /**
41
- * The directory pi works in for a location. pi reads and writes this machine's files in it (its
42
- * sessions are named after it, the project's settings are there), so a directory of another machine
43
- * gets one here, empty, under `<agent directory>/remote/`; the agent's tools work there.
44
- */
45
- export interface PiDirectories {
46
- /** Creates it when it is not there. */
47
- toPi(location: string): string;
48
- /** The location of a directory that `toPi` gave; any other is a directory of this machine. */
49
- fromPi(cwd: string): string;
50
- }
51
-
52
- /** Ports of other machines, opened on this one. */
53
- export interface PortForwards {
54
- forward(cwd: string, port: number): Promise<TaForwardedPort>;
55
- list(): TaForwardedPort[];
56
- close(host: string, remotePort: number): Promise<void>;
57
- }
@@ -1,60 +0,0 @@
1
- import { Autowired } from '@celljs/core';
2
- import { Rpc } from '@celljs/rpc';
3
- import { RpcContext } from '@celljs/rpc/lib/node';
4
- import { ExecEnvironmentFactory } from '@celljs/ta-exec';
5
- import { type TaForwardedPort, type TaRemoteHost, type TaRemotePrompt, TaRemoteServer } from '@celljs/ta-protocol';
6
- import { TaErrors } from '../ta-errors';
7
- import { PortForwards, RemoteHosts } from './remote-protocol';
8
-
9
- /** The other machines that conversations work on, for the clients. */
10
- @Rpc(TaRemoteServer)
11
- export class TaRemoteServerImpl implements TaRemoteServer {
12
- @Autowired(RemoteHosts)
13
- protected readonly hosts: RemoteHosts;
14
-
15
- @Autowired(PortForwards)
16
- protected readonly ports: PortForwards;
17
-
18
- @Autowired(ExecEnvironmentFactory)
19
- protected readonly environments: ExecEnvironmentFactory;
20
-
21
- async listHosts(): Promise<TaRemoteHost[]> {
22
- return TaErrors.guard(() => this.hosts.list());
23
- }
24
-
25
- addHost(host: string): Promise<void> {
26
- return TaErrors.guard(() => this.hosts.add(host));
27
- }
28
-
29
- removeHost(host: string): Promise<void> {
30
- return TaErrors.guard(() => this.hosts.remove(host));
31
- }
32
-
33
- resolveLocation(location: string): Promise<string> {
34
- return TaErrors.guard(() => this.hosts.resolve(location));
35
- }
36
-
37
- forwardPort(port: number, cwd?: string): Promise<TaForwardedPort> {
38
- return TaErrors.guard(async () => this.ports.forward(cwd || (await this.environments.defaultCwd()), port));
39
- }
40
-
41
- async listForwardedPorts(): Promise<TaForwardedPort[]> {
42
- return this.ports.list();
43
- }
44
-
45
- closeForwardedPort(host: string, remotePort: number): Promise<void> {
46
- return TaErrors.guard(() => this.ports.close(host, remotePort));
47
- }
48
-
49
- async watch(): Promise<TaRemotePrompt[]> {
50
- return this.hosts.watch(RpcContext.requireConnection());
51
- }
52
-
53
- async answer(promptId: string, value: string | null): Promise<boolean> {
54
- return this.hosts.answer(promptId, value);
55
- }
56
-
57
- disconnect(host: string): Promise<void> {
58
- return TaErrors.guard(() => this.hosts.disconnect(host));
59
- }
60
- }