@celljs/ta-host 4.7.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (466) hide show
  1. package/README.en.md +34 -4
  2. package/README.md +33 -3
  3. package/cell.schema.json +4 -0
  4. package/cell.yml +2 -0
  5. package/esm/node/auth-server-impl.d.ts +2 -0
  6. package/esm/node/auth-server-impl.js +7 -0
  7. package/esm/node/client-tool-broker.d.ts +11 -3
  8. package/esm/node/client-tool-broker.js +23 -3
  9. package/esm/node/extension-providers.d.ts +22 -0
  10. package/esm/node/extension-providers.js +52 -0
  11. package/esm/node/host-protocol.d.ts +22 -1
  12. package/esm/node/host-protocol.js +1 -0
  13. package/esm/node/index.d.ts +6 -0
  14. package/esm/node/index.js +6 -0
  15. package/esm/node/live-run.d.ts +22 -0
  16. package/esm/node/live-run.js +58 -0
  17. package/esm/node/message-page.d.ts +17 -0
  18. package/esm/node/message-page.js +71 -0
  19. package/esm/node/package-host-extension.d.ts +4 -2
  20. package/esm/node/package-host-extension.js +4 -3
  21. package/esm/node/package-hosts.d.ts +2 -2
  22. package/esm/node/package-hosts.js +2 -0
  23. package/esm/node/package-server-impl.d.ts +9 -1
  24. package/esm/node/package-server-impl.js +16 -1
  25. package/esm/node/relay-bridge.d.ts +9 -1
  26. package/esm/node/relay-bridge.js +44 -4
  27. package/esm/node/remote-ui-context.d.ts +6 -1
  28. package/esm/node/remote-ui-context.js +31 -3
  29. package/esm/node/session-catalog.d.ts +69 -0
  30. package/esm/node/session-catalog.js +211 -0
  31. package/esm/node/session-files.d.ts +18 -0
  32. package/esm/node/session-files.js +32 -0
  33. package/esm/node/session-info-util.d.ts +4 -1
  34. package/esm/node/session-info-util.js +8 -3
  35. package/esm/node/settings-server-impl.d.ts +1 -0
  36. package/esm/node/settings-server-impl.js +8 -0
  37. package/esm/node/settings-store.d.ts +3 -1
  38. package/esm/node/settings-store.js +25 -3
  39. package/esm/node/sign-in/access-server-impl.d.ts +19 -0
  40. package/esm/node/sign-in/access-server-impl.js +82 -0
  41. package/esm/node/sign-in/access-store.d.ts +65 -0
  42. package/esm/node/sign-in/access-store.js +175 -0
  43. package/esm/node/sign-in/index.d.ts +7 -0
  44. package/esm/node/sign-in/index.js +8 -0
  45. package/esm/node/sign-in/sign-in-flow.d.ts +58 -0
  46. package/esm/node/sign-in/sign-in-flow.js +104 -0
  47. package/esm/node/sign-in/sign-in-middleware.d.ts +10 -0
  48. package/esm/node/sign-in/sign-in-middleware.js +48 -0
  49. package/esm/node/sign-in/sign-in-pages.d.ts +31 -0
  50. package/esm/node/sign-in/sign-in-pages.js +118 -0
  51. package/esm/node/sign-in/sign-in-provider.d.ts +135 -0
  52. package/esm/node/sign-in/sign-in-provider.js +225 -0
  53. package/esm/node/sign-in/ta-sign-in.d.ts +10 -0
  54. package/esm/node/sign-in/ta-sign-in.js +32 -0
  55. package/esm/node/ta-access.d.ts +7 -0
  56. package/esm/node/ta-access.js +30 -1
  57. package/esm/node/ta-server-impl.d.ts +8 -3
  58. package/esm/node/ta-server-impl.js +25 -6
  59. package/esm/node/ta-session-factory.d.ts +4 -1
  60. package/esm/node/ta-session-factory.js +30 -7
  61. package/esm/node/ta-session-registry.d.ts +2 -0
  62. package/esm/node/ta-session-registry.js +23 -3
  63. package/esm/node/ta-session.d.ts +24 -2
  64. package/esm/node/ta-session.js +84 -6
  65. package/esm/node/temporary-packages.d.ts +46 -0
  66. package/esm/node/temporary-packages.js +114 -0
  67. package/esm/node/temporary-purge.d.ts +13 -0
  68. package/esm/node/temporary-purge.js +51 -0
  69. package/esm/node/terminal-service.d.ts +18 -2
  70. package/esm/node/terminal-service.js +45 -9
  71. package/esm/node/terminal-util.d.ts +14 -0
  72. package/esm/node/terminal-util.js +30 -1
  73. package/esm/node/web-extension-catalog.d.ts +28 -1
  74. package/esm/node/web-extension-catalog.js +173 -5
  75. package/esm/node/web-extension-util.d.ts +5 -1
  76. package/esm/node/web-extension-util.js +36 -5
  77. package/esm/node/workspace-protocol.d.ts +2 -0
  78. package/esm/node/workspace-server-impl.d.ts +2 -1
  79. package/esm/node/workspace-server-impl.js +13 -1
  80. package/esm/node/workspace-service.d.ts +1 -0
  81. package/esm/node/workspace-service.js +13 -1
  82. package/lib/node/auth-server-impl.d.ts +2 -0
  83. package/lib/node/auth-server-impl.js +7 -0
  84. package/lib/node/client-tool-broker.d.ts +11 -3
  85. package/lib/node/client-tool-broker.js +23 -3
  86. package/lib/node/extension-providers.d.ts +23 -0
  87. package/lib/node/extension-providers.js +55 -0
  88. package/lib/node/host-protocol.d.ts +22 -1
  89. package/lib/node/host-protocol.js +2 -1
  90. package/lib/node/index.d.ts +6 -0
  91. package/lib/node/index.js +6 -0
  92. package/lib/node/live-run.d.ts +23 -0
  93. package/lib/node/live-run.js +62 -0
  94. package/lib/node/message-page.d.ts +18 -0
  95. package/lib/node/message-page.js +74 -0
  96. package/lib/node/package-host-extension.d.ts +4 -2
  97. package/lib/node/package-host-extension.js +4 -3
  98. package/lib/node/package-hosts.d.ts +2 -2
  99. package/lib/node/package-hosts.js +2 -0
  100. package/lib/node/package-server-impl.d.ts +9 -1
  101. package/lib/node/package-server-impl.js +15 -0
  102. package/lib/node/relay-bridge.d.ts +9 -1
  103. package/lib/node/relay-bridge.js +43 -3
  104. package/lib/node/remote-ui-context.d.ts +6 -1
  105. package/lib/node/remote-ui-context.js +31 -3
  106. package/lib/node/session-catalog.d.ts +70 -0
  107. package/lib/node/session-catalog.js +214 -0
  108. package/lib/node/session-files.d.ts +19 -0
  109. package/lib/node/session-files.js +36 -0
  110. package/lib/node/session-info-util.d.ts +4 -1
  111. package/lib/node/session-info-util.js +7 -2
  112. package/lib/node/settings-server-impl.d.ts +1 -0
  113. package/lib/node/settings-server-impl.js +8 -0
  114. package/lib/node/settings-store.d.ts +3 -1
  115. package/lib/node/settings-store.js +25 -3
  116. package/lib/node/sign-in/access-server-impl.d.ts +20 -0
  117. package/lib/node/sign-in/access-server-impl.js +85 -0
  118. package/lib/node/sign-in/access-store.d.ts +66 -0
  119. package/lib/node/sign-in/access-store.js +179 -0
  120. package/lib/node/sign-in/index.d.ts +8 -0
  121. package/lib/node/sign-in/index.js +24 -0
  122. package/lib/node/sign-in/sign-in-flow.d.ts +59 -0
  123. package/lib/node/sign-in/sign-in-flow.js +108 -0
  124. package/lib/node/sign-in/sign-in-middleware.d.ts +11 -0
  125. package/lib/node/sign-in/sign-in-middleware.js +51 -0
  126. package/lib/node/sign-in/sign-in-pages.d.ts +32 -0
  127. package/lib/node/sign-in/sign-in-pages.js +121 -0
  128. package/lib/node/sign-in/sign-in-provider.d.ts +136 -0
  129. package/lib/node/sign-in/sign-in-provider.js +232 -0
  130. package/lib/node/sign-in/ta-sign-in.d.ts +11 -0
  131. package/lib/node/sign-in/ta-sign-in.js +35 -0
  132. package/lib/node/ta-access.d.ts +7 -0
  133. package/lib/node/ta-access.js +30 -1
  134. package/lib/node/ta-server-impl.d.ts +8 -3
  135. package/lib/node/ta-server-impl.js +24 -5
  136. package/lib/node/ta-session-factory.d.ts +4 -1
  137. package/lib/node/ta-session-factory.js +30 -7
  138. package/lib/node/ta-session-registry.d.ts +2 -0
  139. package/lib/node/ta-session-registry.js +23 -3
  140. package/lib/node/ta-session.d.ts +24 -2
  141. package/lib/node/ta-session.js +84 -6
  142. package/lib/node/temporary-packages.d.ts +47 -0
  143. package/lib/node/temporary-packages.js +118 -0
  144. package/lib/node/temporary-purge.d.ts +14 -0
  145. package/lib/node/temporary-purge.js +54 -0
  146. package/lib/node/terminal-service.d.ts +18 -2
  147. package/lib/node/terminal-service.js +44 -8
  148. package/lib/node/terminal-util.d.ts +14 -0
  149. package/lib/node/terminal-util.js +30 -1
  150. package/lib/node/web-extension-catalog.d.ts +28 -1
  151. package/lib/node/web-extension-catalog.js +172 -4
  152. package/lib/node/web-extension-util.d.ts +5 -1
  153. package/lib/node/web-extension-util.js +36 -5
  154. package/lib/node/workspace-protocol.d.ts +2 -0
  155. package/lib/node/workspace-server-impl.d.ts +2 -1
  156. package/lib/node/workspace-server-impl.js +12 -0
  157. package/lib/node/workspace-service.d.ts +1 -0
  158. package/lib/node/workspace-service.js +13 -1
  159. package/package.json +17 -12
  160. package/esm/node/auth-server-impl.js.map +0 -1
  161. package/esm/node/client-channel.js.map +0 -1
  162. package/esm/node/client-tool-broker.js.map +0 -1
  163. package/esm/node/event-log.js.map +0 -1
  164. package/esm/node/exec-environment-factory.js.map +0 -1
  165. package/esm/node/extension-data-notifier.js.map +0 -1
  166. package/esm/node/extension-data.js.map +0 -1
  167. package/esm/node/host-protocol.js.map +0 -1
  168. package/esm/node/index.js.map +0 -1
  169. package/esm/node/module.js.map +0 -1
  170. package/esm/node/package-host-extension.js.map +0 -1
  171. package/esm/node/package-hosts.js.map +0 -1
  172. package/esm/node/package-server-impl.js.map +0 -1
  173. package/esm/node/package-switch.js.map +0 -1
  174. package/esm/node/receipt-book.js.map +0 -1
  175. package/esm/node/relay-bridge.js.map +0 -1
  176. package/esm/node/remote/index.js.map +0 -1
  177. package/esm/node/remote/pi-directories.js.map +0 -1
  178. package/esm/node/remote/port-forwards.js.map +0 -1
  179. package/esm/node/remote/remote-hosts.js.map +0 -1
  180. package/esm/node/remote/remote-protocol.js.map +0 -1
  181. package/esm/node/remote/remote-server-impl.js.map +0 -1
  182. package/esm/node/remote-ui-context.js.map +0 -1
  183. package/esm/node/session-info-util.js.map +0 -1
  184. package/esm/node/session-storage/file-session-storage.js.map +0 -1
  185. package/esm/node/session-storage/index.js.map +0 -1
  186. package/esm/node/session-storage/session-storage-protocol.js.map +0 -1
  187. package/esm/node/session-storage/stored-session.js.map +0 -1
  188. package/esm/node/settings-server-impl.js.map +0 -1
  189. package/esm/node/settings-store.js.map +0 -1
  190. package/esm/node/ta-access.js.map +0 -1
  191. package/esm/node/ta-errors.js.map +0 -1
  192. package/esm/node/ta-event-util.js.map +0 -1
  193. package/esm/node/ta-server-impl.js.map +0 -1
  194. package/esm/node/ta-session-factory.js.map +0 -1
  195. package/esm/node/ta-session-registry.js.map +0 -1
  196. package/esm/node/ta-session.js.map +0 -1
  197. package/esm/node/terminal-protocol.js.map +0 -1
  198. package/esm/node/terminal-service.js.map +0 -1
  199. package/esm/node/terminal-util.js.map +0 -1
  200. package/esm/node/web-extension-catalog.js.map +0 -1
  201. package/esm/node/web-extension-util.js.map +0 -1
  202. package/esm/node/working-directory.js.map +0 -1
  203. package/esm/node/workspace-files.js.map +0 -1
  204. package/esm/node/workspace-protocol.js.map +0 -1
  205. package/esm/node/workspace-server-impl.js.map +0 -1
  206. package/esm/node/workspace-service.js.map +0 -1
  207. package/esm/node/workspace-util.js.map +0 -1
  208. package/lib/node/auth-server-impl.d.ts.map +0 -1
  209. package/lib/node/auth-server-impl.js.map +0 -1
  210. package/lib/node/auth-server-impl.spec.d.ts +0 -2
  211. package/lib/node/auth-server-impl.spec.d.ts.map +0 -1
  212. package/lib/node/auth-server-impl.spec.js +0 -47
  213. package/lib/node/auth-server-impl.spec.js.map +0 -1
  214. package/lib/node/client-channel.d.ts.map +0 -1
  215. package/lib/node/client-channel.js.map +0 -1
  216. package/lib/node/client-channel.spec.d.ts +0 -2
  217. package/lib/node/client-channel.spec.d.ts.map +0 -1
  218. package/lib/node/client-channel.spec.js +0 -106
  219. package/lib/node/client-channel.spec.js.map +0 -1
  220. package/lib/node/client-tool-broker.d.ts.map +0 -1
  221. package/lib/node/client-tool-broker.js.map +0 -1
  222. package/lib/node/client-tool-broker.spec.d.ts +0 -2
  223. package/lib/node/client-tool-broker.spec.d.ts.map +0 -1
  224. package/lib/node/client-tool-broker.spec.js +0 -49
  225. package/lib/node/client-tool-broker.spec.js.map +0 -1
  226. package/lib/node/event-log.d.ts.map +0 -1
  227. package/lib/node/event-log.js.map +0 -1
  228. package/lib/node/event-log.spec.d.ts +0 -2
  229. package/lib/node/event-log.spec.d.ts.map +0 -1
  230. package/lib/node/event-log.spec.js +0 -48
  231. package/lib/node/event-log.spec.js.map +0 -1
  232. package/lib/node/exec-environment-factory.d.ts.map +0 -1
  233. package/lib/node/exec-environment-factory.js.map +0 -1
  234. package/lib/node/extension-data-notifier.d.ts.map +0 -1
  235. package/lib/node/extension-data-notifier.js.map +0 -1
  236. package/lib/node/extension-data-notifier.spec.d.ts +0 -2
  237. package/lib/node/extension-data-notifier.spec.d.ts.map +0 -1
  238. package/lib/node/extension-data-notifier.spec.js +0 -35
  239. package/lib/node/extension-data-notifier.spec.js.map +0 -1
  240. package/lib/node/extension-data.d.ts.map +0 -1
  241. package/lib/node/extension-data.js.map +0 -1
  242. package/lib/node/extension-data.spec.d.ts +0 -2
  243. package/lib/node/extension-data.spec.d.ts.map +0 -1
  244. package/lib/node/extension-data.spec.js +0 -99
  245. package/lib/node/extension-data.spec.js.map +0 -1
  246. package/lib/node/host-protocol.d.ts.map +0 -1
  247. package/lib/node/host-protocol.js.map +0 -1
  248. package/lib/node/index.d.ts.map +0 -1
  249. package/lib/node/index.js.map +0 -1
  250. package/lib/node/module.d.ts.map +0 -1
  251. package/lib/node/module.js.map +0 -1
  252. package/lib/node/package-host-extension.d.ts.map +0 -1
  253. package/lib/node/package-host-extension.js.map +0 -1
  254. package/lib/node/package-hosts.d.ts.map +0 -1
  255. package/lib/node/package-hosts.js.map +0 -1
  256. package/lib/node/package-hosts.spec.d.ts +0 -2
  257. package/lib/node/package-hosts.spec.d.ts.map +0 -1
  258. package/lib/node/package-hosts.spec.js +0 -53
  259. package/lib/node/package-hosts.spec.js.map +0 -1
  260. package/lib/node/package-server-impl.d.ts.map +0 -1
  261. package/lib/node/package-server-impl.js.map +0 -1
  262. package/lib/node/package-switch.d.ts.map +0 -1
  263. package/lib/node/package-switch.js.map +0 -1
  264. package/lib/node/receipt-book.d.ts.map +0 -1
  265. package/lib/node/receipt-book.js.map +0 -1
  266. package/lib/node/receipt-book.spec.d.ts +0 -2
  267. package/lib/node/receipt-book.spec.d.ts.map +0 -1
  268. package/lib/node/receipt-book.spec.js +0 -39
  269. package/lib/node/receipt-book.spec.js.map +0 -1
  270. package/lib/node/relay-bridge.d.ts.map +0 -1
  271. package/lib/node/relay-bridge.js.map +0 -1
  272. package/lib/node/remote/index.d.ts.map +0 -1
  273. package/lib/node/remote/index.js.map +0 -1
  274. package/lib/node/remote/pi-directories.d.ts.map +0 -1
  275. package/lib/node/remote/pi-directories.js.map +0 -1
  276. package/lib/node/remote/port-forwards.d.ts.map +0 -1
  277. package/lib/node/remote/port-forwards.js.map +0 -1
  278. package/lib/node/remote/remote-hosts.d.ts.map +0 -1
  279. package/lib/node/remote/remote-hosts.js.map +0 -1
  280. package/lib/node/remote/remote-protocol.d.ts.map +0 -1
  281. package/lib/node/remote/remote-protocol.js.map +0 -1
  282. package/lib/node/remote/remote-server-impl.d.ts.map +0 -1
  283. package/lib/node/remote/remote-server-impl.js.map +0 -1
  284. package/lib/node/remote/remote.spec.d.ts +0 -2
  285. package/lib/node/remote/remote.spec.d.ts.map +0 -1
  286. package/lib/node/remote/remote.spec.js +0 -130
  287. package/lib/node/remote/remote.spec.js.map +0 -1
  288. package/lib/node/remote-ui-context.d.ts.map +0 -1
  289. package/lib/node/remote-ui-context.js.map +0 -1
  290. package/lib/node/remote-ui-context.spec.d.ts +0 -2
  291. package/lib/node/remote-ui-context.spec.d.ts.map +0 -1
  292. package/lib/node/remote-ui-context.spec.js +0 -62
  293. package/lib/node/remote-ui-context.spec.js.map +0 -1
  294. package/lib/node/session-info-util.d.ts.map +0 -1
  295. package/lib/node/session-info-util.js.map +0 -1
  296. package/lib/node/session-info-util.spec.d.ts +0 -2
  297. package/lib/node/session-info-util.spec.d.ts.map +0 -1
  298. package/lib/node/session-info-util.spec.js +0 -22
  299. package/lib/node/session-info-util.spec.js.map +0 -1
  300. package/lib/node/session-storage/file-session-storage.d.ts.map +0 -1
  301. package/lib/node/session-storage/file-session-storage.js.map +0 -1
  302. package/lib/node/session-storage/file-session-storage.spec.d.ts +0 -2
  303. package/lib/node/session-storage/file-session-storage.spec.d.ts.map +0 -1
  304. package/lib/node/session-storage/file-session-storage.spec.js +0 -70
  305. package/lib/node/session-storage/file-session-storage.spec.js.map +0 -1
  306. package/lib/node/session-storage/index.d.ts.map +0 -1
  307. package/lib/node/session-storage/index.js.map +0 -1
  308. package/lib/node/session-storage/session-storage-protocol.d.ts.map +0 -1
  309. package/lib/node/session-storage/session-storage-protocol.js.map +0 -1
  310. package/lib/node/session-storage/stored-session.d.ts.map +0 -1
  311. package/lib/node/session-storage/stored-session.js.map +0 -1
  312. package/lib/node/session-storage/stored-session.spec.d.ts +0 -2
  313. package/lib/node/session-storage/stored-session.spec.d.ts.map +0 -1
  314. package/lib/node/session-storage/stored-session.spec.js +0 -73
  315. package/lib/node/session-storage/stored-session.spec.js.map +0 -1
  316. package/lib/node/settings-server-impl.d.ts.map +0 -1
  317. package/lib/node/settings-server-impl.js.map +0 -1
  318. package/lib/node/settings-store.d.ts.map +0 -1
  319. package/lib/node/settings-store.js.map +0 -1
  320. package/lib/node/settings-store.spec.d.ts +0 -2
  321. package/lib/node/settings-store.spec.d.ts.map +0 -1
  322. package/lib/node/settings-store.spec.js +0 -146
  323. package/lib/node/settings-store.spec.js.map +0 -1
  324. package/lib/node/ta-access.d.ts.map +0 -1
  325. package/lib/node/ta-access.js.map +0 -1
  326. package/lib/node/ta-access.spec.d.ts +0 -2
  327. package/lib/node/ta-access.spec.d.ts.map +0 -1
  328. package/lib/node/ta-access.spec.js +0 -33
  329. package/lib/node/ta-access.spec.js.map +0 -1
  330. package/lib/node/ta-errors.d.ts.map +0 -1
  331. package/lib/node/ta-errors.js.map +0 -1
  332. package/lib/node/ta-errors.spec.d.ts +0 -2
  333. package/lib/node/ta-errors.spec.d.ts.map +0 -1
  334. package/lib/node/ta-errors.spec.js +0 -25
  335. package/lib/node/ta-errors.spec.js.map +0 -1
  336. package/lib/node/ta-event-util.d.ts.map +0 -1
  337. package/lib/node/ta-event-util.js.map +0 -1
  338. package/lib/node/ta-event-util.spec.d.ts +0 -2
  339. package/lib/node/ta-event-util.spec.d.ts.map +0 -1
  340. package/lib/node/ta-event-util.spec.js +0 -28
  341. package/lib/node/ta-event-util.spec.js.map +0 -1
  342. package/lib/node/ta-server-impl.d.ts.map +0 -1
  343. package/lib/node/ta-server-impl.js.map +0 -1
  344. package/lib/node/ta-session-factory.d.ts.map +0 -1
  345. package/lib/node/ta-session-factory.js.map +0 -1
  346. package/lib/node/ta-session-registry.d.ts.map +0 -1
  347. package/lib/node/ta-session-registry.js.map +0 -1
  348. package/lib/node/ta-session.d.ts.map +0 -1
  349. package/lib/node/ta-session.js.map +0 -1
  350. package/lib/node/terminal-protocol.d.ts.map +0 -1
  351. package/lib/node/terminal-protocol.js.map +0 -1
  352. package/lib/node/terminal-service.d.ts.map +0 -1
  353. package/lib/node/terminal-service.js.map +0 -1
  354. package/lib/node/terminal-service.spec.d.ts +0 -2
  355. package/lib/node/terminal-service.spec.d.ts.map +0 -1
  356. package/lib/node/terminal-service.spec.js +0 -79
  357. package/lib/node/terminal-service.spec.js.map +0 -1
  358. package/lib/node/terminal-util.d.ts.map +0 -1
  359. package/lib/node/terminal-util.js.map +0 -1
  360. package/lib/node/terminal-util.spec.d.ts +0 -2
  361. package/lib/node/terminal-util.spec.d.ts.map +0 -1
  362. package/lib/node/terminal-util.spec.js +0 -71
  363. package/lib/node/terminal-util.spec.js.map +0 -1
  364. package/lib/node/web-extension-catalog.d.ts.map +0 -1
  365. package/lib/node/web-extension-catalog.js.map +0 -1
  366. package/lib/node/web-extension-catalog.spec.d.ts +0 -2
  367. package/lib/node/web-extension-catalog.spec.d.ts.map +0 -1
  368. package/lib/node/web-extension-catalog.spec.js +0 -157
  369. package/lib/node/web-extension-catalog.spec.js.map +0 -1
  370. package/lib/node/web-extension-util.d.ts.map +0 -1
  371. package/lib/node/web-extension-util.js.map +0 -1
  372. package/lib/node/working-directory.d.ts.map +0 -1
  373. package/lib/node/working-directory.js.map +0 -1
  374. package/lib/node/workspace-files.d.ts.map +0 -1
  375. package/lib/node/workspace-files.js.map +0 -1
  376. package/lib/node/workspace-files.spec.d.ts +0 -2
  377. package/lib/node/workspace-files.spec.d.ts.map +0 -1
  378. package/lib/node/workspace-files.spec.js +0 -133
  379. package/lib/node/workspace-files.spec.js.map +0 -1
  380. package/lib/node/workspace-protocol.d.ts.map +0 -1
  381. package/lib/node/workspace-protocol.js.map +0 -1
  382. package/lib/node/workspace-server-impl.d.ts.map +0 -1
  383. package/lib/node/workspace-server-impl.js.map +0 -1
  384. package/lib/node/workspace-service.d.ts.map +0 -1
  385. package/lib/node/workspace-service.js.map +0 -1
  386. package/lib/node/workspace-service.spec.d.ts +0 -2
  387. package/lib/node/workspace-service.spec.d.ts.map +0 -1
  388. package/lib/node/workspace-service.spec.js +0 -104
  389. package/lib/node/workspace-service.spec.js.map +0 -1
  390. package/lib/node/workspace-util.d.ts.map +0 -1
  391. package/lib/node/workspace-util.js.map +0 -1
  392. package/lib/node/workspace-util.spec.d.ts +0 -2
  393. package/lib/node/workspace-util.spec.d.ts.map +0 -1
  394. package/lib/node/workspace-util.spec.js +0 -44
  395. package/lib/node/workspace-util.spec.js.map +0 -1
  396. package/src/node/auth-server-impl.spec.ts +0 -49
  397. package/src/node/auth-server-impl.ts +0 -252
  398. package/src/node/client-channel.spec.ts +0 -117
  399. package/src/node/client-channel.ts +0 -94
  400. package/src/node/client-tool-broker.spec.ts +0 -53
  401. package/src/node/client-tool-broker.ts +0 -106
  402. package/src/node/event-log.spec.ts +0 -52
  403. package/src/node/event-log.ts +0 -59
  404. package/src/node/exec-environment-factory.ts +0 -66
  405. package/src/node/extension-data-notifier.spec.ts +0 -34
  406. package/src/node/extension-data-notifier.ts +0 -124
  407. package/src/node/extension-data.spec.ts +0 -105
  408. package/src/node/extension-data.ts +0 -180
  409. package/src/node/host-protocol.ts +0 -62
  410. package/src/node/index.ts +0 -37
  411. package/src/node/module.ts +0 -4
  412. package/src/node/package-host-extension.ts +0 -20
  413. package/src/node/package-hosts.spec.ts +0 -54
  414. package/src/node/package-hosts.ts +0 -202
  415. package/src/node/package-server-impl.ts +0 -87
  416. package/src/node/package-switch.ts +0 -80
  417. package/src/node/receipt-book.spec.ts +0 -41
  418. package/src/node/receipt-book.ts +0 -40
  419. package/src/node/relay-bridge.ts +0 -94
  420. package/src/node/remote/index.ts +0 -5
  421. package/src/node/remote/pi-directories.ts +0 -49
  422. package/src/node/remote/port-forwards.ts +0 -148
  423. package/src/node/remote/remote-hosts.ts +0 -170
  424. package/src/node/remote/remote-protocol.ts +0 -57
  425. package/src/node/remote/remote-server-impl.ts +0 -60
  426. package/src/node/remote/remote.spec.ts +0 -142
  427. package/src/node/remote-ui-context.spec.ts +0 -68
  428. package/src/node/remote-ui-context.ts +0 -168
  429. package/src/node/session-info-util.spec.ts +0 -23
  430. package/src/node/session-info-util.ts +0 -55
  431. package/src/node/session-storage/file-session-storage.spec.ts +0 -72
  432. package/src/node/session-storage/file-session-storage.ts +0 -145
  433. package/src/node/session-storage/index.ts +0 -3
  434. package/src/node/session-storage/session-storage-protocol.ts +0 -81
  435. package/src/node/session-storage/stored-session.spec.ts +0 -80
  436. package/src/node/session-storage/stored-session.ts +0 -149
  437. package/src/node/settings-server-impl.ts +0 -33
  438. package/src/node/settings-store.spec.ts +0 -156
  439. package/src/node/settings-store.ts +0 -314
  440. package/src/node/ta-access.spec.ts +0 -36
  441. package/src/node/ta-access.ts +0 -156
  442. package/src/node/ta-errors.spec.ts +0 -25
  443. package/src/node/ta-errors.ts +0 -75
  444. package/src/node/ta-event-util.spec.ts +0 -29
  445. package/src/node/ta-event-util.ts +0 -23
  446. package/src/node/ta-server-impl.ts +0 -341
  447. package/src/node/ta-session-factory.ts +0 -203
  448. package/src/node/ta-session-registry.ts +0 -75
  449. package/src/node/ta-session.ts +0 -240
  450. package/src/node/terminal-protocol.ts +0 -18
  451. package/src/node/terminal-service.spec.ts +0 -84
  452. package/src/node/terminal-service.ts +0 -259
  453. package/src/node/terminal-util.spec.ts +0 -78
  454. package/src/node/terminal-util.ts +0 -166
  455. package/src/node/web-extension-catalog.spec.ts +0 -172
  456. package/src/node/web-extension-catalog.ts +0 -177
  457. package/src/node/web-extension-util.ts +0 -144
  458. package/src/node/working-directory.ts +0 -71
  459. package/src/node/workspace-files.spec.ts +0 -145
  460. package/src/node/workspace-files.ts +0 -256
  461. package/src/node/workspace-protocol.ts +0 -22
  462. package/src/node/workspace-server-impl.ts +0 -90
  463. package/src/node/workspace-service.spec.ts +0 -113
  464. package/src/node/workspace-service.ts +0 -223
  465. package/src/node/workspace-util.spec.ts +0 -47
  466. package/src/node/workspace-util.ts +0 -103
@@ -0,0 +1,135 @@
1
+ import type { TaSignInProvider } from '@celljs/ta-protocol';
2
+ /** Who signed in, as the provider says: `id` is the account as TA_ALLOWED_USERS names it (`github:<login>`). */
3
+ export interface SignInAccount {
4
+ id: string;
5
+ name?: string;
6
+ avatar?: string;
7
+ }
8
+ /** A sign-in that failed with the provider (a code refused, an account without what it needs). */
9
+ export declare class SignInError extends Error {
10
+ }
11
+ /**
12
+ * A provider of accounts, through OAuth 2.0's authorization code: the browser goes to {@link authorizeUrl},
13
+ * comes back with a code, which {@link account} turns into the account. `challenge` and `verifier` are those
14
+ * of PKCE (S256), for the providers that take them.
15
+ */
16
+ export interface SignInProvider extends TaSignInProvider {
17
+ authorizeUrl(params: {
18
+ redirectUri: string;
19
+ state: string;
20
+ challenge: string;
21
+ }): Promise<string>;
22
+ account(params: {
23
+ code: string;
24
+ redirectUri: string;
25
+ verifier: string;
26
+ }): Promise<SignInAccount>;
27
+ }
28
+ export declare namespace SignInHttp {
29
+ function url(base: string, params: Record<string, string | undefined>): string;
30
+ /** The JSON a provider answers; one that fails says what it said. */
31
+ function json<T>(url: string, init?: RequestInit): Promise<T>;
32
+ /** A form posted for a token, the way OAuth 2.0 wants it. */
33
+ function form(params: Record<string, string>): RequestInit;
34
+ }
35
+ export interface GitHubEndpoints {
36
+ authorize: string;
37
+ token: string;
38
+ user: string;
39
+ }
40
+ /** GitHub's OAuth apps; the account is `github:<login>`. GitHub Enterprise Server has the same at its own address. */
41
+ export declare class GitHubSignIn implements SignInProvider {
42
+ protected readonly clientId: string;
43
+ protected readonly clientSecret: string;
44
+ protected readonly endpoints: GitHubEndpoints;
45
+ readonly id = "github";
46
+ readonly name = "GitHub";
47
+ static endpoints(url?: string): GitHubEndpoints;
48
+ constructor(clientId: string, clientSecret: string, endpoints?: GitHubEndpoints);
49
+ authorizeUrl({ redirectUri, state, challenge }: {
50
+ redirectUri: string;
51
+ state: string;
52
+ challenge: string;
53
+ }): Promise<string>;
54
+ account({ code, redirectUri, verifier }: {
55
+ code: string;
56
+ redirectUri: string;
57
+ verifier: string;
58
+ }): Promise<SignInAccount>;
59
+ }
60
+ interface OidcConfiguration {
61
+ authorization_endpoint: string;
62
+ token_endpoint: string;
63
+ userinfo_endpoint: string;
64
+ }
65
+ export interface OidcOptions {
66
+ id: string;
67
+ name: string;
68
+ issuer: string;
69
+ clientId: string;
70
+ clientSecret: string;
71
+ /** The account is its address, verified; without one, a provider that requires it refuses (Google). */
72
+ requireEmail?: boolean;
73
+ /** More of the authorization request, such as Google's `prompt: select_account`. */
74
+ extra?: Record<string, string>;
75
+ }
76
+ /**
77
+ * OpenID Connect, found from the issuer (`/.well-known/openid-configuration`): Google, and the provider of
78
+ * the operator (Microsoft Entra, Okta, Keycloak, Authing...). The account is `<id>:<email>` when the
79
+ * address is verified, otherwise `<id>:<sub>`. The token is taken straight from the provider over TLS,
80
+ * so the user comes from its userinfo endpoint, with that token.
81
+ */
82
+ export declare class OidcSignIn implements SignInProvider {
83
+ protected readonly options: OidcOptions;
84
+ readonly id: string;
85
+ readonly name: string;
86
+ protected configuration?: Promise<OidcConfiguration>;
87
+ static google(clientId: string, clientSecret: string): OidcSignIn;
88
+ constructor(options: OidcOptions);
89
+ authorizeUrl({ redirectUri, state, challenge }: {
90
+ redirectUri: string;
91
+ state: string;
92
+ challenge: string;
93
+ }): Promise<string>;
94
+ account({ code, redirectUri, verifier }: {
95
+ code: string;
96
+ redirectUri: string;
97
+ verifier: string;
98
+ }): Promise<SignInAccount>;
99
+ protected discover(): Promise<OidcConfiguration>;
100
+ }
101
+ export interface WeChatEndpoints {
102
+ authorize: string;
103
+ token: string;
104
+ user: string;
105
+ }
106
+ /**
107
+ * WeChat's sign-in for websites (a website app of the WeChat Open Platform): the page shows a code to scan
108
+ * with WeChat. The account is `wechat:<unionid>`, or the openid when the app has no unionid.
109
+ */
110
+ export declare class WeChatSignIn implements SignInProvider {
111
+ protected readonly appId: string;
112
+ protected readonly appSecret: string;
113
+ protected readonly endpoints: WeChatEndpoints;
114
+ readonly id = "wechat";
115
+ readonly name = "WeChat";
116
+ static readonly ENDPOINTS: WeChatEndpoints;
117
+ constructor(appId: string, appSecret: string, endpoints?: WeChatEndpoints);
118
+ authorizeUrl({ redirectUri, state }: {
119
+ redirectUri: string;
120
+ state: string;
121
+ }): Promise<string>;
122
+ account({ code }: {
123
+ code: string;
124
+ }): Promise<SignInAccount>;
125
+ }
126
+ export declare namespace SignInProviders {
127
+ /** TA_PUBLIC_URL without its trailing `/`. */
128
+ function publicUrl(env: Record<string, string | undefined>): string | undefined;
129
+ /**
130
+ * The providers the operator configured in the environment of ta serve: a provider is offered when it
131
+ * has its id and its secret.
132
+ */
133
+ function fromEnv(env: Record<string, string | undefined>): SignInProvider[];
134
+ }
135
+ export {};
@@ -0,0 +1,225 @@
1
+ /** A sign-in that failed with the provider (a code refused, an account without what it needs). */
2
+ export class SignInError extends Error {
3
+ }
4
+ const TIMEOUT_MS = 10000;
5
+ export var SignInHttp;
6
+ (function (SignInHttp) {
7
+ function url(base, params) {
8
+ const url = new URL(base);
9
+ for (const [key, value] of Object.entries(params)) {
10
+ if (value !== undefined) {
11
+ url.searchParams.set(key, value);
12
+ }
13
+ }
14
+ return url.toString();
15
+ }
16
+ SignInHttp.url = url;
17
+ /** The JSON a provider answers; one that fails says what it said. */
18
+ async function json(url, init = {}) {
19
+ const response = await fetch(url, { ...init, signal: AbortSignal.timeout(TIMEOUT_MS) });
20
+ const text = await response.text();
21
+ if (!response.ok) {
22
+ throw new SignInError(`${new URL(url).host} answered ${response.status}: ${text.slice(0, 200)}`);
23
+ }
24
+ try {
25
+ return JSON.parse(text);
26
+ }
27
+ catch (_a) {
28
+ throw new SignInError(`${new URL(url).host} did not answer JSON: ${text.slice(0, 200)}`);
29
+ }
30
+ }
31
+ SignInHttp.json = json;
32
+ /** A form posted for a token, the way OAuth 2.0 wants it. */
33
+ function form(params) {
34
+ return {
35
+ method: 'POST',
36
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' },
37
+ body: new URLSearchParams(params).toString(),
38
+ };
39
+ }
40
+ SignInHttp.form = form;
41
+ })(SignInHttp || (SignInHttp = {}));
42
+ /** GitHub's OAuth apps; the account is `github:<login>`. GitHub Enterprise Server has the same at its own address. */
43
+ export class GitHubSignIn {
44
+ static endpoints(url = 'https://github.com') {
45
+ const base = url.replace(/\/+$/, '');
46
+ const api = base === 'https://github.com' ? 'https://api.github.com' : `${base}/api/v3`;
47
+ return { authorize: `${base}/login/oauth/authorize`, token: `${base}/login/oauth/access_token`, user: `${api}/user` };
48
+ }
49
+ constructor(clientId, clientSecret, endpoints = GitHubSignIn.endpoints()) {
50
+ this.clientId = clientId;
51
+ this.clientSecret = clientSecret;
52
+ this.endpoints = endpoints;
53
+ this.id = 'github';
54
+ this.name = 'GitHub';
55
+ }
56
+ async authorizeUrl({ redirectUri, state, challenge }) {
57
+ return SignInHttp.url(this.endpoints.authorize, {
58
+ client_id: this.clientId,
59
+ redirect_uri: redirectUri,
60
+ scope: 'read:user',
61
+ state,
62
+ allow_signup: 'false',
63
+ code_challenge: challenge,
64
+ code_challenge_method: 'S256',
65
+ });
66
+ }
67
+ async account({ code, redirectUri, verifier }) {
68
+ var _a, _b;
69
+ const token = await SignInHttp.json(this.endpoints.token, SignInHttp.form({ client_id: this.clientId, client_secret: this.clientSecret, code, redirect_uri: redirectUri, code_verifier: verifier }));
70
+ if (!token.access_token) {
71
+ throw new SignInError(`GitHub: ${(_b = (_a = token.error_description) !== null && _a !== void 0 ? _a : token.error) !== null && _b !== void 0 ? _b : 'no access token'}`);
72
+ }
73
+ const user = await SignInHttp.json(this.endpoints.user, {
74
+ headers: { Authorization: `Bearer ${token.access_token}`, Accept: 'application/vnd.github+json', 'User-Agent': 'Ta' },
75
+ });
76
+ if (!user.login) {
77
+ throw new SignInError('GitHub: the user has no login');
78
+ }
79
+ return { id: `github:${user.login.toLowerCase()}`, name: user.name || user.login, avatar: user.avatar_url };
80
+ }
81
+ }
82
+ /**
83
+ * OpenID Connect, found from the issuer (`/.well-known/openid-configuration`): Google, and the provider of
84
+ * the operator (Microsoft Entra, Okta, Keycloak, Authing...). The account is `<id>:<email>` when the
85
+ * address is verified, otherwise `<id>:<sub>`. The token is taken straight from the provider over TLS,
86
+ * so the user comes from its userinfo endpoint, with that token.
87
+ */
88
+ export class OidcSignIn {
89
+ static google(clientId, clientSecret) {
90
+ return new OidcSignIn({
91
+ id: 'google',
92
+ name: 'Google',
93
+ issuer: 'https://accounts.google.com',
94
+ clientId,
95
+ clientSecret,
96
+ requireEmail: true,
97
+ extra: { prompt: 'select_account' },
98
+ });
99
+ }
100
+ constructor(options) {
101
+ this.options = options;
102
+ this.id = options.id;
103
+ this.name = options.name;
104
+ }
105
+ async authorizeUrl({ redirectUri, state, challenge }) {
106
+ const { authorization_endpoint } = await this.discover();
107
+ return SignInHttp.url(authorization_endpoint, {
108
+ response_type: 'code',
109
+ client_id: this.options.clientId,
110
+ redirect_uri: redirectUri,
111
+ scope: 'openid email profile',
112
+ state,
113
+ code_challenge: challenge,
114
+ code_challenge_method: 'S256',
115
+ ...this.options.extra,
116
+ });
117
+ }
118
+ async account({ code, redirectUri, verifier }) {
119
+ var _a, _b;
120
+ const { token_endpoint, userinfo_endpoint } = await this.discover();
121
+ const token = await SignInHttp.json(token_endpoint, SignInHttp.form({
122
+ grant_type: 'authorization_code',
123
+ code,
124
+ redirect_uri: redirectUri,
125
+ client_id: this.options.clientId,
126
+ client_secret: this.options.clientSecret,
127
+ code_verifier: verifier,
128
+ }));
129
+ if (!token.access_token) {
130
+ throw new SignInError(`${this.name}: ${(_b = (_a = token.error_description) !== null && _a !== void 0 ? _a : token.error) !== null && _b !== void 0 ? _b : 'no access token'}`);
131
+ }
132
+ const user = await SignInHttp.json(userinfo_endpoint, { headers: { Authorization: `Bearer ${token.access_token}`, Accept: 'application/json' } });
133
+ // Some providers say "false" as a string.
134
+ const email = user.email && user.email_verified !== false && user.email_verified !== 'false' ? user.email : undefined;
135
+ if (!email && (this.options.requireEmail || !user.sub)) {
136
+ throw new SignInError(`${this.name}: the account has no verified email address`);
137
+ }
138
+ const id = email ? `${this.id}:${email.toLowerCase()}` : `${this.id}:${user.sub}`;
139
+ return { id, name: user.name || user.email || user.sub, avatar: user.picture };
140
+ }
141
+ discover() {
142
+ if (!this.configuration) {
143
+ const url = `${this.options.issuer.replace(/\/+$/, '')}/.well-known/openid-configuration`;
144
+ this.configuration = SignInHttp.json(url);
145
+ // A provider down now may answer later.
146
+ this.configuration.catch(() => (this.configuration = undefined));
147
+ }
148
+ return this.configuration;
149
+ }
150
+ }
151
+ /**
152
+ * WeChat's sign-in for websites (a website app of the WeChat Open Platform): the page shows a code to scan
153
+ * with WeChat. The account is `wechat:<unionid>`, or the openid when the app has no unionid.
154
+ */
155
+ export class WeChatSignIn {
156
+ constructor(appId, appSecret, endpoints = WeChatSignIn.ENDPOINTS) {
157
+ this.appId = appId;
158
+ this.appSecret = appSecret;
159
+ this.endpoints = endpoints;
160
+ this.id = 'wechat';
161
+ this.name = 'WeChat';
162
+ }
163
+ async authorizeUrl({ redirectUri, state }) {
164
+ // WeChat wants its fragment, and no PKCE.
165
+ const url = SignInHttp.url(this.endpoints.authorize, {
166
+ appid: this.appId,
167
+ redirect_uri: redirectUri,
168
+ response_type: 'code',
169
+ scope: 'snsapi_login',
170
+ state,
171
+ });
172
+ return `${url}#wechat_redirect`;
173
+ }
174
+ async account({ code }) {
175
+ var _a, _b, _c, _d;
176
+ const token = await SignInHttp.json(SignInHttp.url(this.endpoints.token, { appid: this.appId, secret: this.appSecret, code, grant_type: 'authorization_code' }));
177
+ if (!token.access_token || !token.openid) {
178
+ throw new SignInError(`WeChat: ${(_a = token.errmsg) !== null && _a !== void 0 ? _a : 'no access token'} (${(_b = token.errcode) !== null && _b !== void 0 ? _b : '-'})`);
179
+ }
180
+ const user = await SignInHttp.json(SignInHttp.url(this.endpoints.user, { access_token: token.access_token, openid: token.openid }));
181
+ return { id: `wechat:${(_d = (_c = user.unionid) !== null && _c !== void 0 ? _c : token.unionid) !== null && _d !== void 0 ? _d : token.openid}`, name: user.nickname, avatar: user.headimgurl || undefined };
182
+ }
183
+ }
184
+ WeChatSignIn.ENDPOINTS = {
185
+ authorize: 'https://open.weixin.qq.com/connect/qrconnect',
186
+ token: 'https://api.weixin.qq.com/sns/oauth2/access_token',
187
+ user: 'https://api.weixin.qq.com/sns/userinfo',
188
+ };
189
+ export var SignInProviders;
190
+ (function (SignInProviders) {
191
+ /** TA_PUBLIC_URL without its trailing `/`. */
192
+ function publicUrl(env) {
193
+ var _a;
194
+ return ((_a = env.TA_PUBLIC_URL) === null || _a === void 0 ? void 0 : _a.trim().replace(/\/+$/, '')) || undefined;
195
+ }
196
+ SignInProviders.publicUrl = publicUrl;
197
+ /**
198
+ * The providers the operator configured in the environment of ta serve: a provider is offered when it
199
+ * has its id and its secret.
200
+ */
201
+ function fromEnv(env) {
202
+ const providers = [];
203
+ if (env.TA_GITHUB_CLIENT_ID && env.TA_GITHUB_CLIENT_SECRET) {
204
+ providers.push(new GitHubSignIn(env.TA_GITHUB_CLIENT_ID, env.TA_GITHUB_CLIENT_SECRET, GitHubSignIn.endpoints(env.TA_GITHUB_URL || undefined)));
205
+ }
206
+ if (env.TA_GOOGLE_CLIENT_ID && env.TA_GOOGLE_CLIENT_SECRET) {
207
+ providers.push(OidcSignIn.google(env.TA_GOOGLE_CLIENT_ID, env.TA_GOOGLE_CLIENT_SECRET));
208
+ }
209
+ if (env.TA_WECHAT_APP_ID && env.TA_WECHAT_APP_SECRET) {
210
+ providers.push(new WeChatSignIn(env.TA_WECHAT_APP_ID, env.TA_WECHAT_APP_SECRET));
211
+ }
212
+ if (env.TA_OIDC_ISSUER && env.TA_OIDC_CLIENT_ID && env.TA_OIDC_CLIENT_SECRET) {
213
+ providers.push(new OidcSignIn({
214
+ id: 'oidc',
215
+ name: env.TA_OIDC_NAME || 'SSO',
216
+ issuer: env.TA_OIDC_ISSUER,
217
+ clientId: env.TA_OIDC_CLIENT_ID,
218
+ clientSecret: env.TA_OIDC_CLIENT_SECRET,
219
+ }));
220
+ }
221
+ return providers;
222
+ }
223
+ SignInProviders.fromEnv = fromEnv;
224
+ })(SignInProviders || (SignInProviders = {}));
225
+ //# sourceMappingURL=sign-in-provider.js.map
@@ -0,0 +1,10 @@
1
+ import { SignInFlow } from './sign-in-flow.js';
2
+ export declare const TA_SIGN_IN: unique symbol;
3
+ /**
4
+ * Signing in to ta serve with an account, besides its token. The providers come from the environment
5
+ * (SignInProviders.fromEnv); who may sign in from TA_ALLOWED_USERS and the accounts added in the web client
6
+ * (AccessStore). Someone else who signs in is told to wait, and shows up as a request.
7
+ */
8
+ export declare class TaSignIn extends SignInFlow {
9
+ constructor();
10
+ }
@@ -0,0 +1,32 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { join } from 'node:path';
11
+ import { Component } from '@celljs/core';
12
+ import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
13
+ import { AccessStore, AccessUtil } from './access-store.js';
14
+ import { SignInFlow } from './sign-in-flow.js';
15
+ import { SignInProviders } from './sign-in-provider.js';
16
+ export const TA_SIGN_IN = Symbol('TaSignIn');
17
+ /**
18
+ * Signing in to ta serve with an account, besides its token. The providers come from the environment
19
+ * (SignInProviders.fromEnv); who may sign in from TA_ALLOWED_USERS and the accounts added in the web client
20
+ * (AccessStore). Someone else who signs in is told to wait, and shows up as a request.
21
+ */
22
+ let TaSignIn = class TaSignIn extends SignInFlow {
23
+ constructor() {
24
+ super(SignInProviders.fromEnv(process.env), new AccessStore(join(TaBrand.agentDir(), 'access.json'), AccessUtil.parseList(process.env.TA_ALLOWED_USERS)), SignInProviders.publicUrl(process.env));
25
+ }
26
+ };
27
+ TaSignIn = __decorate([
28
+ Component(TA_SIGN_IN),
29
+ __metadata("design:paramtypes", [])
30
+ ], TaSignIn);
31
+ export { TaSignIn };
32
+ //# sourceMappingURL=ta-sign-in.js.map
@@ -3,6 +3,7 @@ import { type Application, ApplicationLifecycle } from '@celljs/core';
3
3
  import { RpcWebSocketGuard } from '@celljs/rpc/lib/node';
4
4
  import { type Context, Middleware, ServerAware } from '@celljs/web/lib/node';
5
5
  import { TaSessionRegistry } from './host-protocol.js';
6
+ import { type TaSignIn } from './sign-in/ta-sign-in.js';
6
7
  /** The id of {@link TaAccess}, for what needs the token, as RelayBridge does. */
7
8
  export declare const TA_ACCESS: unique symbol;
8
9
  /** Runs before everything else that handles a request. */
@@ -22,6 +23,11 @@ export declare namespace TaAccessUtil {
22
23
  function isHttpCall(request: IncomingMessage): boolean;
23
24
  /** The token goes in the fragment, which the browser does not send to the server or in `Referer`. */
24
25
  function webUrl(httpUrl: string, token: string): string;
26
+ /**
27
+ * What ta serve says where it starts on an address of the network: the link that signs in with its token
28
+ * (none for a token of TA_SERVE_TOKEN, which whoever set it knows), and the accounts that can sign in.
29
+ */
30
+ function signInLines(signIn: Pick<TaSignIn, 'publicUrl' | 'providers' | 'store'>, port: number, token?: string): string[];
25
31
  /** Opens a URL in the user's browser. */
26
32
  function openBrowser(url: string): void;
27
33
  }
@@ -36,6 +42,7 @@ export declare class TaAccess implements RpcWebSocketGuard, Middleware, ServerAw
36
42
  readonly token: string;
37
43
  protected readonly host?: string;
38
44
  protected readonly sessions: TaSessionRegistry;
45
+ protected readonly signIn: TaSignIn;
39
46
  protected readonly infoFile: string;
40
47
  allows(request: IncomingMessage): boolean;
41
48
  /** Calls over a WebSocket were checked when it opened; this covers plain HTTP. */
@@ -18,6 +18,7 @@ import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
18
18
  import { TA_SERVE_FILE, TA_WEBSOCKET_PATH } from '@celljs/ta-protocol';
19
19
  import { Middleware, ServerAware } from '@celljs/web/lib/node';
20
20
  import { TaSessionRegistry } from './host-protocol.js';
21
+ import { TA_SIGN_IN } from './sign-in/ta-sign-in.js';
21
22
  const LOOPBACK_NAMES = new Set(['127.0.0.1', 'localhost', '[::1]']);
22
23
  /** Where the calls go (`rpc.path`); everything else is the web client, if it is installed. */
23
24
  const API_PATH = '/api';
@@ -69,6 +70,23 @@ export var TaAccessUtil;
69
70
  return `${httpUrl}/#token=${token}`;
70
71
  }
71
72
  TaAccessUtil.webUrl = webUrl;
73
+ /**
74
+ * What ta serve says where it starts on an address of the network: the link that signs in with its token
75
+ * (none for a token of TA_SERVE_TOKEN, which whoever set it knows), and the accounts that can sign in.
76
+ */
77
+ function signInLines(signIn, port, token) {
78
+ var _a;
79
+ const base = (_a = signIn.publicUrl) !== null && _a !== void 0 ? _a : `http://localhost:${port}`;
80
+ const lines = [token ? `sign in at ${webUrl(base, token)}` : `web client at ${base}/ (sign in with TA_SERVE_TOKEN)`];
81
+ if (signIn.providers.length > 0) {
82
+ const names = signIn.providers.map(provider => provider.name).join(', ');
83
+ lines.push(signIn.store.open
84
+ ? `accounts let in sign in with ${names}`
85
+ : `sign-in with ${names} lets nobody in yet: set TA_ALLOWED_USERS, or open the link above and add your account in Settings, Access`);
86
+ }
87
+ return lines;
88
+ }
89
+ TaAccessUtil.signInLines = signInLines;
72
90
  /** Opens a URL in the user's browser. */
73
91
  function openBrowser(url) {
74
92
  const [command, ...args] = process.platform === 'darwin' ? ['open', url] : process.platform === 'win32' ? ['cmd', '/c', 'start', '""', url] : ['xdg-open', url];
@@ -92,7 +110,8 @@ let TaAccess = class TaAccess {
92
110
  }
93
111
  allows(request) {
94
112
  const token = TaAccessUtil.tokenOf(request);
95
- return token !== undefined && TaAccessUtil.equals(token, this.token) && this.acceptsHost(request);
113
+ // The token of the server, or that of a browser signed in with an account (TaSignIn).
114
+ return token !== undefined && (TaAccessUtil.equals(token, this.token) || this.signIn.store.check(token) !== undefined) && this.acceptsHost(request);
96
115
  }
97
116
  /** Calls over a WebSocket were checked when it opened; this covers plain HTTP. */
98
117
  async handle(ctx, next) {
@@ -147,6 +166,12 @@ let TaAccess = class TaAccess {
147
166
  console.log(`ta serve: web client at ${url}`);
148
167
  TaAccessUtil.openBrowser(url);
149
168
  }
169
+ else if (!TaAccessUtil.isLoopbackHost(this.host)) {
170
+ // Reached from elsewhere (a container, a server): whoever started it opens the link to sign in.
171
+ for (const line of TaAccessUtil.signInLines(this.signIn, port, process.env.TA_SERVE_TOKEN ? undefined : this.token)) {
172
+ console.log(`ta serve: ${line}`);
173
+ }
174
+ }
150
175
  }
151
176
  };
152
177
  __decorate([
@@ -157,6 +182,10 @@ __decorate([
157
182
  Autowired(TaSessionRegistry),
158
183
  __metadata("design:type", Object)
159
184
  ], TaAccess.prototype, "sessions", void 0);
185
+ __decorate([
186
+ Autowired(TA_SIGN_IN),
187
+ __metadata("design:type", Function)
188
+ ], TaAccess.prototype, "signIn", void 0);
160
189
  TaAccess = __decorate([
161
190
  Component([TA_ACCESS, RpcWebSocketGuard, Middleware, ServerAware, ApplicationLifecycle])
162
191
  ], TaAccess);
@@ -1,6 +1,6 @@
1
1
  import { ExecEnvironmentFactory } from '@celljs/ta-exec';
2
- import { type RpcExtensionUIResponse, type TaAttachResult, type TaClientToolResult, type TaCommandResult, type TaForkFileResult, type TaNavigateResult, type TaOpenSessionOptions, type TaPromptInput, type TaPromptReceipt, TaServer, type TaServerInfo, type TaSessionInfo, type ThinkingLevel } from '@celljs/ta-protocol';
3
- import { TaSessionRegistry } from './host-protocol.js';
2
+ import { type RpcExtensionUIResponse, type TaAttachOptions, type TaAttachResult, type TaClientToolResult, type TaCommandResult, type TaForkFileResult, type TaMessagePage, type TaNavigateResult, type TaOpenSessionOptions, type TaPromptInput, type TaPromptReceipt, type TaSavedSessionInfo, TaServer, type TaServerInfo, type TaSessionInfo, type ThinkingLevel } from '@celljs/ta-protocol';
3
+ import { TaSessionCatalog, TaSessionRegistry } from './host-protocol.js';
4
4
  import { RemoteHosts } from './remote/remote-protocol.js';
5
5
  import type { TaSession } from './ta-session.js';
6
6
  import { TaWorkingDirectory } from './working-directory.js';
@@ -14,20 +14,25 @@ export declare class TaServerImpl implements TaServer {
14
14
  protected readonly environments: ExecEnvironmentFactory;
15
15
  protected readonly workingDirectory: TaWorkingDirectory;
16
16
  protected readonly remoteHosts: RemoteHosts;
17
+ protected readonly catalog: TaSessionCatalog;
17
18
  getServerInfo(): Promise<TaServerInfo>;
18
19
  setWorkingDirectory(cwd: string): Promise<TaServerInfo>;
19
20
  openSession(options: TaOpenSessionOptions): Promise<TaSessionInfo>;
20
21
  closeSession(sessionId: string): Promise<void>;
21
22
  listSessions(): Promise<TaSessionInfo[]>;
22
- attach(sessionId: string, afterSeq?: number): Promise<TaAttachResult>;
23
+ listSavedSessions(): Promise<TaSavedSessionInfo[]>;
24
+ attach(sessionId: string, afterSeq?: number, options?: TaAttachOptions): Promise<TaAttachResult>;
25
+ getEarlierMessages(sessionId: string, before: number | undefined, timestamp: number | undefined, budget: number): Promise<TaMessagePage>;
23
26
  detach(sessionId: string): Promise<void>;
24
27
  respondUi(sessionId: string, response: RpcExtensionUIResponse): Promise<boolean>;
28
+ claimClientTool(sessionId: string, id: string): Promise<boolean>;
25
29
  respondClientTool(sessionId: string, result: TaClientToolResult): Promise<boolean>;
26
30
  prompt(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
27
31
  steer(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
28
32
  followUp(sessionId: string, input: TaPromptInput): Promise<TaPromptReceipt>;
29
33
  abort(sessionId: string): Promise<void>;
30
34
  clearQueue(sessionId: string): Promise<TaCommandResult<'clear_queue'>>;
35
+ removeQueued(sessionId: string, kind: 'steering' | 'followUp', index: number): Promise<boolean>;
31
36
  newSession(sessionId: string, parentSession?: string): Promise<TaCommandResult<'new_session'>>;
32
37
  getState(sessionId: string): Promise<TaCommandResult<'get_state'>>;
33
38
  setModel(sessionId: string, provider: string, modelId: string): Promise<TaCommandResult<'set_model'>>;
@@ -16,7 +16,7 @@ import { RpcContext } from '@celljs/rpc/lib/node';
16
16
  import { ExecEnvironmentFactory } from '@celljs/ta-exec';
17
17
  import { TaBrand } from '@celljs/ta-harness/lib/node/ta-brand';
18
18
  import { TaServer, } from '@celljs/ta-protocol';
19
- import { TaSessionRegistry } from './host-protocol.js';
19
+ import { TaSessionCatalog, TaSessionRegistry } from './host-protocol.js';
20
20
  import { RemoteHosts } from './remote/remote-protocol.js';
21
21
  import { SessionInfoUtil } from './session-info-util.js';
22
22
  import { TaErrors } from './ta-errors.js';
@@ -56,8 +56,17 @@ let TaServerImpl = class TaServerImpl {
56
56
  async listSessions() {
57
57
  return this.sessions.list().map(session => session.info());
58
58
  }
59
- attach(sessionId, afterSeq) {
60
- return this.on(sessionId, session => session.attach(this.sessions.channel(RpcContext.requireConnection()), afterSeq));
59
+ listSavedSessions() {
60
+ return this.guard(async () => {
61
+ const open = new Set(this.sessions.list().map(session => session.pi.sessionFile));
62
+ return (await this.catalog.list()).filter(session => !open.has(session.sessionFile));
63
+ });
64
+ }
65
+ attach(sessionId, afterSeq, options) {
66
+ return this.on(sessionId, session => session.attach(this.sessions.channel(RpcContext.requireConnection()), afterSeq !== null && afterSeq !== void 0 ? afterSeq : undefined, options !== null && options !== void 0 ? options : undefined));
67
+ }
68
+ getEarlierMessages(sessionId, before, timestamp, budget) {
69
+ return this.on(sessionId, session => session.earlierMessages(before !== null && before !== void 0 ? before : undefined, timestamp !== null && timestamp !== void 0 ? timestamp : undefined, budget));
61
70
  }
62
71
  detach(sessionId) {
63
72
  return this.on(sessionId, session => session.detach(this.sessions.channel(RpcContext.requireConnection())));
@@ -65,6 +74,9 @@ let TaServerImpl = class TaServerImpl {
65
74
  respondUi(sessionId, response) {
66
75
  return this.on(sessionId, session => session.respondUi(response));
67
76
  }
77
+ claimClientTool(sessionId, id) {
78
+ return this.on(sessionId, session => session.claimClientTool(this.sessions.channel(RpcContext.requireConnection()), id));
79
+ }
68
80
  respondClientTool(sessionId, result) {
69
81
  return this.on(sessionId, session => session.respondClientTool(result));
70
82
  }
@@ -83,6 +95,9 @@ let TaServerImpl = class TaServerImpl {
83
95
  clearQueue(sessionId) {
84
96
  return this.on(sessionId, ({ pi }) => pi.clearQueue());
85
97
  }
98
+ removeQueued(sessionId, kind, index) {
99
+ return this.on(sessionId, session => session.removeQueued(kind, index));
100
+ }
86
101
  newSession(sessionId, parentSession) {
87
102
  return this.on(sessionId, ({ runtime }) => runtime.newSession(parentSession ? { parentSession } : undefined));
88
103
  }
@@ -258,11 +273,11 @@ let TaServerImpl = class TaServerImpl {
258
273
  }));
259
274
  }
260
275
  reload(sessionId) {
261
- return this.on(sessionId, ({ pi }) => {
262
- if (pi.isStreaming) {
276
+ return this.on(sessionId, session => {
277
+ if (session.pi.isStreaming) {
263
278
  throw TaErrors.invalidArgument('The session is working.', 'Reload it once the run has ended, or abort the run first.');
264
279
  }
265
- return pi.reload();
280
+ return session.reload();
266
281
  });
267
282
  }
268
283
  on(sessionId, command) {
@@ -288,6 +303,10 @@ __decorate([
288
303
  Autowired(RemoteHosts),
289
304
  __metadata("design:type", Object)
290
305
  ], TaServerImpl.prototype, "remoteHosts", void 0);
306
+ __decorate([
307
+ Autowired(TaSessionCatalog),
308
+ __metadata("design:type", Object)
309
+ ], TaServerImpl.prototype, "catalog", void 0);
291
310
  TaServerImpl = __decorate([
292
311
  Rpc(TaServer)
293
312
  ], TaServerImpl);
@@ -2,6 +2,7 @@ import { AgentExtension, AgentTool, type CodingAgentOptions, ModelRuntimeProvide
2
2
  import { type ExecEnvironment, ExecEnvironmentFactory } from '@celljs/ta-exec';
3
3
  import { type ContextFile, type InlineExtension, SessionLock } from '@celljs/ta-harness';
4
4
  import type { TaOpenSessionOptions } from '@celljs/ta-protocol';
5
+ import { ExtensionProviders } from './extension-providers.js';
5
6
  import { type TaHostOptions, TaSessionFactory } from './host-protocol.js';
6
7
  import { PackageHosts } from './package-hosts.js';
7
8
  import { PiDirectories } from './remote/remote-protocol.js';
@@ -24,7 +25,8 @@ export declare class DefaultTaSessionFactory implements TaSessionFactory {
24
25
  protected readonly tools: AgentTool[];
25
26
  protected readonly packageHosts: PackageHosts;
26
27
  protected readonly directories: PiDirectories;
27
- create(options: TaOpenSessionOptions, requestClose: (session: TaSession) => void): Promise<TaSession>;
28
+ protected readonly extensionProviders: ExtensionProviders;
29
+ create(requested: TaOpenSessionOptions, requestClose: (session: TaSession) => void): Promise<TaSession>;
28
30
  protected openSessionManager(sdk: PiSdk, options: TaOpenSessionOptions): SessionManager;
29
31
  /**
30
32
  * For another machine, its context files (AGENTS.md...) instead of those pi finds above the directory
@@ -43,6 +45,7 @@ export declare class DefaultTaSessionFactory implements TaSessionFactory {
43
45
  protected piExtensions(sdk: PiSdk, environment: ExecEnvironment): InlineExtension[];
44
46
  /** Project resources load only in a project the user has trusted, or one without any. */
45
47
  protected isTrusted(sdk: PiSdk, cwd: string, agentDir: string): boolean;
48
+ protected findModel(modelRuntime: ModelRuntime, ref: string): Model | undefined;
46
49
  protected resolveModel(modelRuntime: ModelRuntime, ref: string): Model;
47
50
  }
48
51
  export {};