@celljs/ta-web 4.15.2 → 4.17.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 (601) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-ask-book.d.ts +35 -0
  4. package/esm/browser/assistant/assistant-ask-book.js +96 -0
  5. package/esm/browser/assistant/assistant-conversation.d.ts +110 -0
  6. package/esm/browser/assistant/assistant-conversation.js +351 -0
  7. package/esm/browser/assistant/assistant-export.js +6 -7
  8. package/esm/browser/assistant/assistant-extension.d.ts +3 -2
  9. package/esm/browser/assistant/assistant-extension.js +57 -4
  10. package/esm/browser/assistant/assistant-protocol.d.ts +17 -2
  11. package/esm/browser/assistant/assistant-role.d.ts +22 -4
  12. package/esm/browser/assistant/assistant-role.js +29 -7
  13. package/esm/browser/assistant/assistant-state.d.ts +5 -1
  14. package/esm/browser/assistant/assistant-state.js +11 -0
  15. package/esm/browser/assistant/assistant-task-source.js +7 -1
  16. package/esm/browser/assistant/assistant-task-util.d.ts +19 -7
  17. package/esm/browser/assistant/assistant-task-util.js +73 -20
  18. package/esm/browser/assistant/assistant-tasks.d.ts +0 -7
  19. package/esm/browser/assistant/assistant-tasks.js +0 -2
  20. package/esm/browser/assistant/assistant-thread.d.ts +22 -0
  21. package/esm/browser/assistant/assistant-thread.js +108 -0
  22. package/esm/browser/assistant/assistant-view.js +77 -126
  23. package/esm/browser/assistant/assistant.d.ts +33 -105
  24. package/esm/browser/assistant/assistant.js +103 -356
  25. package/esm/browser/assistant/chat-task-source.d.ts +58 -0
  26. package/esm/browser/assistant/chat-task-source.js +107 -0
  27. package/esm/browser/assistant/read-aloud.d.ts +34 -0
  28. package/esm/browser/assistant/read-aloud.js +98 -0
  29. package/esm/browser/assistant/realtime-voice.d.ts +77 -0
  30. package/esm/browser/assistant/realtime-voice.js +320 -0
  31. package/esm/browser/assistant/task-views.d.ts +2 -3
  32. package/esm/browser/assistant/task-views.js +20 -16
  33. package/esm/browser/assistant/voice-call-bar.d.ts +60 -0
  34. package/esm/browser/assistant/voice-call-bar.js +260 -0
  35. package/esm/browser/assistant/voice-call.d.ts +175 -0
  36. package/esm/browser/assistant/voice-call.js +366 -0
  37. package/esm/browser/chat/chat-shown.d.ts +78 -0
  38. package/esm/browser/chat/chat-shown.js +262 -0
  39. package/esm/browser/chat/chat-view.js +2 -1
  40. package/esm/browser/chat/chat.d.ts +4 -68
  41. package/esm/browser/chat/chat.js +5 -253
  42. package/esm/browser/chat/draft-model.d.ts +1 -1
  43. package/esm/browser/components/access-view.js +1 -1
  44. package/esm/browser/components/account-menu.js +1 -1
  45. package/esm/browser/components/app-nav.d.ts +3 -1
  46. package/esm/browser/components/app-nav.js +7 -7
  47. package/esm/browser/components/app-shell-hooks.d.ts +11 -2
  48. package/esm/browser/components/app-shell-hooks.js +25 -4
  49. package/esm/browser/components/app-shell-state.d.ts +80 -0
  50. package/esm/browser/components/app-shell-state.js +466 -0
  51. package/esm/browser/components/app-view.js +128 -334
  52. package/esm/browser/components/asks-badge.d.ts +6 -2
  53. package/esm/browser/components/asks-badge.js +7 -3
  54. package/esm/browser/components/auth-pictures.d.ts +2 -2
  55. package/esm/browser/components/auth-pictures.js +13 -1
  56. package/esm/browser/components/auth-view.d.ts +4 -3
  57. package/esm/browser/components/auth-view.js +54 -5
  58. package/esm/browser/components/chat-asks.d.ts +2 -0
  59. package/esm/browser/components/chat-asks.js +8 -0
  60. package/esm/browser/components/chat-busy.d.ts +32 -0
  61. package/esm/browser/components/chat-busy.js +49 -0
  62. package/esm/browser/components/chat-icon.d.ts +6 -0
  63. package/esm/browser/components/chat-icon.js +17 -1
  64. package/esm/browser/components/chat-list-row.d.ts +84 -0
  65. package/esm/browser/components/chat-list-row.js +198 -0
  66. package/esm/browser/components/chat-list-util.d.ts +166 -0
  67. package/esm/browser/components/chat-list-util.js +335 -0
  68. package/esm/browser/components/chat-list.d.ts +11 -148
  69. package/esm/browser/components/chat-list.js +280 -511
  70. package/esm/browser/components/chat-seen.d.ts +7 -0
  71. package/esm/browser/components/chat-seen.js +58 -10
  72. package/esm/browser/components/composer-addon-util.d.ts +1 -1
  73. package/esm/browser/components/composer-addons.d.ts +1 -1
  74. package/esm/browser/components/composer-attachments.d.ts +11 -0
  75. package/esm/browser/components/composer-attachments.js +27 -0
  76. package/esm/browser/components/composer-box-hooks.d.ts +9 -0
  77. package/esm/browser/components/composer-box-hooks.js +138 -0
  78. package/esm/browser/components/composer-box-protocol.d.ts +108 -0
  79. package/esm/browser/components/composer-box-protocol.js +2 -0
  80. package/esm/browser/components/composer-box.d.ts +1 -95
  81. package/esm/browser/components/composer-box.js +49 -156
  82. package/esm/browser/components/composer-target.d.ts +21 -0
  83. package/esm/browser/components/composer-target.js +43 -0
  84. package/esm/browser/components/composer.d.ts +7 -1
  85. package/esm/browser/components/composer.js +13 -9
  86. package/esm/browser/components/context-menu.js +4 -0
  87. package/esm/browser/components/conversation-find.d.ts +27 -0
  88. package/esm/browser/components/conversation-find.js +151 -0
  89. package/esm/browser/components/conversation-scroll-hooks.js +2 -1
  90. package/esm/browser/components/conversation-scroll-util.d.ts +73 -0
  91. package/esm/browser/components/conversation-scroll-util.js +80 -0
  92. package/esm/browser/components/conversation-scroll.d.ts +1 -35
  93. package/esm/browser/components/conversation-scroll.js +2 -81
  94. package/esm/browser/components/conversation-view.d.ts +8 -0
  95. package/esm/browser/components/conversation-view.js +41 -0
  96. package/esm/browser/components/discover-view.d.ts +3 -2
  97. package/esm/browser/components/discover-view.js +31 -26
  98. package/esm/browser/components/dismiss.js +2 -0
  99. package/esm/browser/components/earlier-messages.d.ts +2 -0
  100. package/esm/browser/components/earlier-messages.js +2 -1
  101. package/esm/browser/components/environment-view.js +50 -1
  102. package/esm/browser/components/folder-picker.d.ts +7 -0
  103. package/esm/browser/components/folder-picker.js +90 -20
  104. package/esm/browser/components/gallery.d.ts +1 -1
  105. package/esm/browser/components/gallery.js +57 -14
  106. package/esm/browser/components/host-tag.js +2 -2
  107. package/esm/browser/components/host-view.d.ts +1 -1
  108. package/esm/browser/components/host-view.js +3 -1
  109. package/esm/browser/components/image-menu.d.ts +11 -0
  110. package/esm/browser/components/image-menu.js +29 -0
  111. package/esm/browser/components/image-viewer.d.ts +3 -2
  112. package/esm/browser/components/image-viewer.js +29 -4
  113. package/esm/browser/components/lightbox.js +2 -0
  114. package/esm/browser/components/link-dialog.js +2 -0
  115. package/esm/browser/components/list-rows.d.ts +3 -1
  116. package/esm/browser/components/list-rows.js +2 -1
  117. package/esm/browser/components/markdown.js +5 -0
  118. package/esm/browser/components/media.d.ts +2 -0
  119. package/esm/browser/components/media.js +16 -1
  120. package/esm/browser/components/message-actions.d.ts +1 -1
  121. package/esm/browser/components/message-actions.js +9 -0
  122. package/esm/browser/components/message-footer.d.ts +3 -1
  123. package/esm/browser/components/message-footer.js +3 -2
  124. package/esm/browser/components/message-images.d.ts +41 -0
  125. package/esm/browser/components/message-images.js +120 -0
  126. package/esm/browser/components/message-list.d.ts +4 -100
  127. package/esm/browser/components/message-list.js +10 -447
  128. package/esm/browser/components/message-menu.js +4 -0
  129. package/esm/browser/components/message-steps.d.ts +21 -0
  130. package/esm/browser/components/message-steps.js +182 -0
  131. package/esm/browser/components/message-user.d.ts +54 -0
  132. package/esm/browser/components/message-user.js +169 -0
  133. package/esm/browser/components/model-picker.d.ts +1 -1
  134. package/esm/browser/components/model-picker.js +2 -0
  135. package/esm/browser/components/moved-notice.d.ts +14 -0
  136. package/esm/browser/components/moved-notice.js +60 -0
  137. package/esm/browser/components/nav-places.d.ts +12 -1
  138. package/esm/browser/components/nav-places.js +10 -2
  139. package/esm/browser/components/notice-center.js +36 -1
  140. package/esm/browser/components/notice-face.js +2 -1
  141. package/esm/browser/components/phone-shell.d.ts +4 -3
  142. package/esm/browser/components/phone-shell.js +60 -68
  143. package/esm/browser/components/plus-menu.d.ts +1 -1
  144. package/esm/browser/components/relay-services.d.ts +6 -1
  145. package/esm/browser/components/relay-services.js +109 -2
  146. package/esm/browser/components/relay-view.js +2 -0
  147. package/esm/browser/components/remote-hosts.d.ts +10 -0
  148. package/esm/browser/components/remote-hosts.js +67 -5
  149. package/esm/browser/components/remote-prompts.js +2 -0
  150. package/esm/browser/components/scan-screen.js +7 -0
  151. package/esm/browser/components/screen-navigator-util.d.ts +28 -0
  152. package/esm/browser/components/screen-navigator-util.js +33 -0
  153. package/esm/browser/components/screen-navigator.d.ts +30 -0
  154. package/esm/browser/components/screen-navigator.js +47 -0
  155. package/esm/browser/components/session-settings.d.ts +1 -1
  156. package/esm/browser/components/session-view.js +157 -7
  157. package/esm/browser/components/settings-choices.d.ts +6 -0
  158. package/esm/browser/components/settings-choices.js +8 -0
  159. package/esm/browser/components/settings-more.d.ts +7 -0
  160. package/esm/browser/components/settings-more.js +263 -0
  161. package/esm/browser/components/settings-parts.d.ts +8 -3
  162. package/esm/browser/components/settings-parts.js +31 -249
  163. package/esm/browser/components/settings-view.js +43 -15
  164. package/esm/browser/components/stop-times.js +1 -0
  165. package/esm/browser/components/surface-flyout.js +2 -0
  166. package/esm/browser/components/unseen-drop.d.ts +10 -4
  167. package/esm/browser/components/unseen-drop.js +9 -8
  168. package/esm/browser/components/use-seen-chats.js +1 -1
  169. package/esm/browser/components/voice-services.d.ts +6 -0
  170. package/esm/browser/components/voice-services.js +137 -0
  171. package/esm/browser/components/voice-talk.d.ts +23 -6
  172. package/esm/browser/components/voice-talk.js +46 -11
  173. package/esm/browser/components/web-composer.d.ts +1 -1
  174. package/esm/browser/components/web-composer.js +2 -2
  175. package/esm/browser/components/web-dialog.js +2 -0
  176. package/esm/browser/device/back-stack.d.ts +89 -11
  177. package/esm/browser/device/back-stack.js +200 -29
  178. package/esm/browser/device/device-protocol.d.ts +1 -1
  179. package/esm/browser/device/device-protocol.js +1 -1
  180. package/esm/browser/device/own-gestures.d.ts +1 -1
  181. package/esm/browser/device/pull-down.js +3 -1
  182. package/esm/browser/device/row-swipe.js +3 -1
  183. package/esm/browser/device/sheet-swipe.d.ts +1 -179
  184. package/esm/browser/device/sheet-swipe.js +3 -433
  185. package/esm/browser/device/swipe-finger.d.ts +31 -0
  186. package/esm/browser/device/swipe-finger.js +83 -0
  187. package/esm/browser/device/swipe-settle.d.ts +52 -0
  188. package/esm/browser/device/swipe-settle.js +170 -0
  189. package/esm/browser/device/swipe-util.d.ts +97 -0
  190. package/esm/browser/device/swipe-util.js +183 -0
  191. package/esm/browser/drafts/drafts-protocol.d.ts +58 -0
  192. package/esm/browser/drafts/drafts-protocol.js +75 -0
  193. package/esm/browser/drafts/drafts.d.ts +21 -0
  194. package/esm/browser/drafts/drafts.js +91 -0
  195. package/esm/browser/drafts/use-composer-draft.d.ts +20 -0
  196. package/esm/browser/drafts/use-composer-draft.js +108 -0
  197. package/esm/browser/extension/icons.js +25 -4
  198. package/esm/browser/extension/web-api-components.d.ts +13 -0
  199. package/esm/browser/extension/web-api-contributions.d.ts +125 -0
  200. package/esm/browser/extension/web-extension-api.d.ts +88 -5
  201. package/esm/browser/extension/web-extension-context.d.ts +5 -0
  202. package/esm/browser/extension/web-extension-context.js +60 -7
  203. package/esm/browser/extension/web-extension-protocol.d.ts +19 -1
  204. package/esm/browser/extension/web-extension-protocol.js +3 -0
  205. package/esm/browser/extension/web-extension-run.d.ts +5 -2
  206. package/esm/browser/extension/web-extension-run.js +13 -1
  207. package/esm/browser/extension/web-extensions-running.d.ts +93 -0
  208. package/esm/browser/extension/web-extensions-running.js +339 -0
  209. package/esm/browser/extension/web-extensions.d.ts +6 -82
  210. package/esm/browser/extension/web-extensions.js +10 -319
  211. package/esm/browser/extension/web-pages.js +1 -0
  212. package/esm/browser/extension/web-session-notices.js +6 -1
  213. package/esm/browser/extension/web-tasks.d.ts +2 -0
  214. package/esm/browser/extension/web-tasks.js +6 -0
  215. package/esm/browser/extension/web-view-util.d.ts +2 -1
  216. package/esm/browser/extension/web-view-util.js +4 -1
  217. package/esm/browser/gateway/console-parts.d.ts +4 -12
  218. package/esm/browser/gateway/console-parts.js +42 -125
  219. package/esm/browser/gateway/console-tenant.js +3 -2
  220. package/esm/browser/gateway/console-trend.d.ts +11 -0
  221. package/esm/browser/gateway/console-trend.js +115 -0
  222. package/esm/browser/gateway/console-util.js +2 -2
  223. package/esm/browser/gateway/console-view.js +49 -3
  224. package/esm/browser/i18n/locales.d.ts +170 -6
  225. package/esm/browser/i18n/messages-ja.js +171 -7
  226. package/esm/browser/i18n/messages-zh-tw.js +171 -7
  227. package/esm/browser/i18n/messages.d.ts +167 -3
  228. package/esm/browser/i18n/messages.js +342 -14
  229. package/esm/browser/index.d.ts +17 -0
  230. package/esm/browser/index.js +17 -0
  231. package/esm/browser/notices/notices-protocol.d.ts +12 -0
  232. package/esm/browser/notices/notices.js +7 -4
  233. package/esm/browser/offline/device-values.d.ts +2 -0
  234. package/esm/browser/offline/device-values.js +6 -1
  235. package/esm/browser/screen/page-answers.d.ts +42 -0
  236. package/esm/browser/screen/page-answers.js +89 -0
  237. package/esm/browser/screen/screen-protocol.d.ts +112 -0
  238. package/esm/browser/screen/screen-protocol.js +45 -0
  239. package/esm/browser/screen/screen.d.ts +20 -0
  240. package/esm/browser/screen/screen.js +122 -0
  241. package/esm/browser/screen/use-screen-part.d.ts +6 -0
  242. package/esm/browser/screen/use-screen-part.js +14 -0
  243. package/esm/browser/settings/settings-protocol.d.ts +5 -1
  244. package/esm/browser/settings/settings-protocol.js +6 -2
  245. package/esm/browser/share/shared-extensions.d.ts +29 -0
  246. package/esm/browser/share/shared-extensions.js +145 -0
  247. package/esm/browser/share/shared-link.d.ts +11 -0
  248. package/esm/browser/share/shared-link.js +38 -0
  249. package/esm/browser/share/shared-page.d.ts +5 -0
  250. package/esm/browser/share/shared-page.js +137 -0
  251. package/esm/browser/state/state-protocol.d.ts +14 -0
  252. package/esm/browser/state/state-protocol.js +18 -0
  253. package/esm/browser/state/state.d.ts +10 -2
  254. package/esm/browser/state/state.js +19 -3
  255. package/esm/browser/style/base.d.ts +1 -1
  256. package/esm/browser/style/base.js +4 -0
  257. package/esm/browser/style/chat-list.d.ts +2 -0
  258. package/esm/browser/style/chat-list.js +153 -0
  259. package/esm/browser/style/conversation-column.d.ts +2 -0
  260. package/esm/browser/style/conversation-column.js +250 -0
  261. package/esm/browser/style/conversation.d.ts +1 -1
  262. package/esm/browser/style/conversation.js +24 -8
  263. package/esm/browser/style/dialogs.d.ts +2 -0
  264. package/esm/browser/style/dialogs.js +163 -0
  265. package/esm/browser/style/layout.d.ts +2 -2
  266. package/esm/browser/style/layout.js +1 -525
  267. package/esm/browser/style/pages.d.ts +1 -1
  268. package/esm/browser/style/pages.js +10 -3
  269. package/esm/browser/style/phone.d.ts +1 -1
  270. package/esm/browser/style/phone.js +6 -2
  271. package/esm/browser/style/shared.d.ts +2 -0
  272. package/esm/browser/style/shared.js +23 -0
  273. package/esm/browser/style/shell.d.ts +1 -1
  274. package/esm/browser/style/shell.js +47 -0
  275. package/esm/browser/style/tasks.d.ts +1 -1
  276. package/esm/browser/style/tasks.js +13 -8
  277. package/esm/browser/style.js +8 -0
  278. package/esm/browser/util/gallery.d.ts +24 -2
  279. package/esm/browser/util/gallery.js +82 -2
  280. package/esm/browser/util/image-copy.d.ts +16 -0
  281. package/esm/browser/util/image-copy.js +57 -0
  282. package/esm/browser/util/message.d.ts +5 -0
  283. package/esm/browser/util/message.js +14 -0
  284. package/esm/browser/util/process.d.ts +6 -2
  285. package/esm/browser/util/process.js +6 -2
  286. package/esm/browser/util/spoken.d.ts +24 -0
  287. package/esm/browser/util/spoken.js +83 -0
  288. package/esm/browser/util/transcript.d.ts +22 -0
  289. package/esm/browser/util/transcript.js +46 -0
  290. package/esm/browser/util/voice.d.ts +5 -1
  291. package/esm/browser/util/voice.js +6 -1
  292. package/esm/browser/workbench-hosts.d.ts +36 -0
  293. package/esm/browser/workbench-hosts.js +120 -0
  294. package/esm/browser/workbench-lists.d.ts +33 -0
  295. package/esm/browser/workbench-lists.js +128 -0
  296. package/esm/browser/workbench-protocol.d.ts +14 -1
  297. package/esm/browser/workbench-services.d.ts +49 -0
  298. package/esm/browser/workbench-services.js +120 -0
  299. package/esm/browser/workbench-util.d.ts +1 -1
  300. package/esm/browser/workbench.d.ts +6 -89
  301. package/esm/browser/workbench.js +26 -336
  302. package/lib/browser/assistant/assistant-ask-book.d.ts +36 -0
  303. package/lib/browser/assistant/assistant-ask-book.js +100 -0
  304. package/lib/browser/assistant/assistant-conversation.d.ts +111 -0
  305. package/lib/browser/assistant/assistant-conversation.js +355 -0
  306. package/lib/browser/assistant/assistant-export.js +6 -7
  307. package/lib/browser/assistant/assistant-extension.d.ts +3 -2
  308. package/lib/browser/assistant/assistant-extension.js +55 -2
  309. package/lib/browser/assistant/assistant-protocol.d.ts +17 -2
  310. package/lib/browser/assistant/assistant-role.d.ts +22 -4
  311. package/lib/browser/assistant/assistant-role.js +30 -8
  312. package/lib/browser/assistant/assistant-state.d.ts +5 -1
  313. package/lib/browser/assistant/assistant-state.js +11 -0
  314. package/lib/browser/assistant/assistant-task-source.js +7 -1
  315. package/lib/browser/assistant/assistant-task-util.d.ts +19 -7
  316. package/lib/browser/assistant/assistant-task-util.js +73 -20
  317. package/lib/browser/assistant/assistant-tasks.d.ts +0 -7
  318. package/lib/browser/assistant/assistant-tasks.js +1 -3
  319. package/lib/browser/assistant/assistant-thread.d.ts +23 -0
  320. package/lib/browser/assistant/assistant-thread.js +144 -0
  321. package/lib/browser/assistant/assistant-view.js +74 -123
  322. package/lib/browser/assistant/assistant.d.ts +33 -105
  323. package/lib/browser/assistant/assistant.js +100 -353
  324. package/lib/browser/assistant/chat-task-source.d.ts +59 -0
  325. package/lib/browser/assistant/chat-task-source.js +111 -0
  326. package/lib/browser/assistant/read-aloud.d.ts +35 -0
  327. package/lib/browser/assistant/read-aloud.js +102 -0
  328. package/lib/browser/assistant/realtime-voice.d.ts +78 -0
  329. package/lib/browser/assistant/realtime-voice.js +324 -0
  330. package/lib/browser/assistant/task-views.d.ts +2 -3
  331. package/lib/browser/assistant/task-views.js +19 -15
  332. package/lib/browser/assistant/voice-call-bar.d.ts +61 -0
  333. package/lib/browser/assistant/voice-call-bar.js +306 -0
  334. package/lib/browser/assistant/voice-call.d.ts +176 -0
  335. package/lib/browser/assistant/voice-call.js +370 -0
  336. package/lib/browser/chat/chat-shown.d.ts +79 -0
  337. package/lib/browser/chat/chat-shown.js +266 -0
  338. package/lib/browser/chat/chat-view.js +2 -1
  339. package/lib/browser/chat/chat.d.ts +4 -68
  340. package/lib/browser/chat/chat.js +3 -251
  341. package/lib/browser/chat/draft-model.d.ts +1 -1
  342. package/lib/browser/components/access-view.js +2 -2
  343. package/lib/browser/components/account-menu.js +1 -1
  344. package/lib/browser/components/app-nav.d.ts +3 -1
  345. package/lib/browser/components/app-nav.js +7 -7
  346. package/lib/browser/components/app-shell-hooks.d.ts +11 -2
  347. package/lib/browser/components/app-shell-hooks.js +26 -5
  348. package/lib/browser/components/app-shell-state.d.ts +81 -0
  349. package/lib/browser/components/app-shell-state.js +502 -0
  350. package/lib/browser/components/app-view.js +120 -326
  351. package/lib/browser/components/asks-badge.d.ts +6 -2
  352. package/lib/browser/components/asks-badge.js +7 -3
  353. package/lib/browser/components/auth-pictures.d.ts +2 -2
  354. package/lib/browser/components/auth-pictures.js +13 -1
  355. package/lib/browser/components/auth-view.d.ts +4 -3
  356. package/lib/browser/components/auth-view.js +53 -4
  357. package/lib/browser/components/chat-asks.d.ts +2 -0
  358. package/lib/browser/components/chat-asks.js +8 -0
  359. package/lib/browser/components/chat-busy.d.ts +33 -0
  360. package/lib/browser/components/chat-busy.js +52 -0
  361. package/lib/browser/components/chat-icon.d.ts +6 -0
  362. package/lib/browser/components/chat-icon.js +17 -1
  363. package/lib/browser/components/chat-list-row.d.ts +85 -0
  364. package/lib/browser/components/chat-list-row.js +236 -0
  365. package/lib/browser/components/chat-list-util.d.ts +167 -0
  366. package/lib/browser/components/chat-list-util.js +338 -0
  367. package/lib/browser/components/chat-list.d.ts +11 -148
  368. package/lib/browser/components/chat-list.js +297 -530
  369. package/lib/browser/components/chat-seen.d.ts +7 -0
  370. package/lib/browser/components/chat-seen.js +58 -10
  371. package/lib/browser/components/composer-addon-util.d.ts +1 -1
  372. package/lib/browser/components/composer-addons.d.ts +1 -1
  373. package/lib/browser/components/composer-attachments.d.ts +12 -0
  374. package/lib/browser/components/composer-attachments.js +64 -0
  375. package/lib/browser/components/composer-box-hooks.d.ts +10 -0
  376. package/lib/browser/components/composer-box-hooks.js +178 -0
  377. package/lib/browser/components/composer-box-protocol.d.ts +109 -0
  378. package/lib/browser/components/composer-box-protocol.js +3 -0
  379. package/lib/browser/components/composer-box.d.ts +1 -95
  380. package/lib/browser/components/composer-box.js +51 -159
  381. package/lib/browser/components/composer-target.d.ts +22 -0
  382. package/lib/browser/components/composer-target.js +46 -0
  383. package/lib/browser/components/composer.d.ts +7 -1
  384. package/lib/browser/components/composer.js +15 -11
  385. package/lib/browser/components/context-menu.js +4 -0
  386. package/lib/browser/components/conversation-find.d.ts +28 -0
  387. package/lib/browser/components/conversation-find.js +188 -0
  388. package/lib/browser/components/conversation-scroll-hooks.js +3 -2
  389. package/lib/browser/components/conversation-scroll-util.d.ts +73 -0
  390. package/lib/browser/components/conversation-scroll-util.js +85 -1
  391. package/lib/browser/components/conversation-scroll.d.ts +1 -35
  392. package/lib/browser/components/conversation-scroll.js +20 -100
  393. package/lib/browser/components/conversation-view.d.ts +9 -0
  394. package/lib/browser/components/conversation-view.js +77 -0
  395. package/lib/browser/components/discover-view.d.ts +3 -2
  396. package/lib/browser/components/discover-view.js +30 -25
  397. package/lib/browser/components/dismiss.js +2 -0
  398. package/lib/browser/components/earlier-messages.d.ts +2 -0
  399. package/lib/browser/components/earlier-messages.js +2 -1
  400. package/lib/browser/components/environment-view.js +49 -0
  401. package/lib/browser/components/folder-picker.d.ts +7 -0
  402. package/lib/browser/components/folder-picker.js +89 -19
  403. package/lib/browser/components/gallery.d.ts +1 -1
  404. package/lib/browser/components/gallery.js +56 -13
  405. package/lib/browser/components/host-tag.js +1 -1
  406. package/lib/browser/components/host-view.d.ts +1 -1
  407. package/lib/browser/components/host-view.js +4 -2
  408. package/lib/browser/components/image-menu.d.ts +12 -0
  409. package/lib/browser/components/image-menu.js +65 -0
  410. package/lib/browser/components/image-viewer.d.ts +3 -2
  411. package/lib/browser/components/image-viewer.js +28 -3
  412. package/lib/browser/components/lightbox.js +2 -0
  413. package/lib/browser/components/link-dialog.js +2 -0
  414. package/lib/browser/components/list-rows.d.ts +3 -1
  415. package/lib/browser/components/list-rows.js +2 -1
  416. package/lib/browser/components/markdown.js +5 -0
  417. package/lib/browser/components/media.d.ts +2 -0
  418. package/lib/browser/components/media.js +17 -1
  419. package/lib/browser/components/message-actions.d.ts +1 -1
  420. package/lib/browser/components/message-actions.js +9 -0
  421. package/lib/browser/components/message-footer.d.ts +3 -1
  422. package/lib/browser/components/message-footer.js +2 -1
  423. package/lib/browser/components/message-images.d.ts +42 -0
  424. package/lib/browser/components/message-images.js +157 -0
  425. package/lib/browser/components/message-list.d.ts +4 -100
  426. package/lib/browser/components/message-list.js +11 -455
  427. package/lib/browser/components/message-menu.js +4 -0
  428. package/lib/browser/components/message-steps.d.ts +22 -0
  429. package/lib/browser/components/message-steps.js +218 -0
  430. package/lib/browser/components/message-user.d.ts +55 -0
  431. package/lib/browser/components/message-user.js +211 -0
  432. package/lib/browser/components/model-picker.d.ts +1 -1
  433. package/lib/browser/components/model-picker.js +2 -0
  434. package/lib/browser/components/moved-notice.d.ts +15 -0
  435. package/lib/browser/components/moved-notice.js +96 -0
  436. package/lib/browser/components/nav-places.d.ts +12 -1
  437. package/lib/browser/components/nav-places.js +12 -3
  438. package/lib/browser/components/notice-center.js +35 -0
  439. package/lib/browser/components/notice-face.js +7 -6
  440. package/lib/browser/components/phone-shell.d.ts +4 -3
  441. package/lib/browser/components/phone-shell.js +59 -67
  442. package/lib/browser/components/plus-menu.d.ts +1 -1
  443. package/lib/browser/components/relay-services.d.ts +6 -1
  444. package/lib/browser/components/relay-services.js +107 -0
  445. package/lib/browser/components/relay-view.js +2 -0
  446. package/lib/browser/components/remote-hosts.d.ts +10 -0
  447. package/lib/browser/components/remote-hosts.js +67 -4
  448. package/lib/browser/components/remote-prompts.js +2 -0
  449. package/lib/browser/components/scan-screen.js +7 -0
  450. package/lib/browser/components/screen-navigator-util.d.ts +29 -0
  451. package/lib/browser/components/screen-navigator-util.js +36 -0
  452. package/lib/browser/components/screen-navigator.d.ts +31 -0
  453. package/lib/browser/components/screen-navigator.js +83 -0
  454. package/lib/browser/components/session-settings.d.ts +1 -1
  455. package/lib/browser/components/session-view.js +157 -7
  456. package/lib/browser/components/settings-choices.d.ts +7 -1
  457. package/lib/browser/components/settings-choices.js +9 -1
  458. package/lib/browser/components/settings-more.d.ts +8 -0
  459. package/lib/browser/components/settings-more.js +299 -0
  460. package/lib/browser/components/settings-parts.d.ts +8 -3
  461. package/lib/browser/components/settings-parts.js +27 -245
  462. package/lib/browser/components/settings-view.js +43 -15
  463. package/lib/browser/components/stop-times.js +1 -0
  464. package/lib/browser/components/surface-flyout.js +2 -0
  465. package/lib/browser/components/unseen-drop.d.ts +10 -4
  466. package/lib/browser/components/unseen-drop.js +9 -8
  467. package/lib/browser/components/use-seen-chats.js +2 -2
  468. package/lib/browser/components/voice-services.d.ts +7 -0
  469. package/lib/browser/components/voice-services.js +173 -0
  470. package/lib/browser/components/voice-talk.d.ts +23 -6
  471. package/lib/browser/components/voice-talk.js +45 -10
  472. package/lib/browser/components/web-composer.d.ts +1 -1
  473. package/lib/browser/components/web-composer.js +2 -2
  474. package/lib/browser/components/web-dialog.js +2 -0
  475. package/lib/browser/device/back-stack.d.ts +89 -11
  476. package/lib/browser/device/back-stack.js +205 -31
  477. package/lib/browser/device/device-protocol.d.ts +1 -1
  478. package/lib/browser/device/device-protocol.js +1 -1
  479. package/lib/browser/device/own-gestures.d.ts +1 -1
  480. package/lib/browser/device/pull-down.js +8 -6
  481. package/lib/browser/device/row-swipe.js +11 -9
  482. package/lib/browser/device/sheet-swipe.d.ts +1 -179
  483. package/lib/browser/device/sheet-swipe.js +16 -452
  484. package/lib/browser/device/swipe-finger.d.ts +32 -0
  485. package/lib/browser/device/swipe-finger.js +87 -0
  486. package/lib/browser/device/swipe-settle.d.ts +53 -0
  487. package/lib/browser/device/swipe-settle.js +176 -0
  488. package/lib/browser/device/swipe-util.d.ts +98 -0
  489. package/lib/browser/device/swipe-util.js +187 -0
  490. package/lib/browser/drafts/drafts-protocol.d.ts +59 -0
  491. package/lib/browser/drafts/drafts-protocol.js +78 -0
  492. package/lib/browser/drafts/drafts.d.ts +22 -0
  493. package/lib/browser/drafts/drafts.js +94 -0
  494. package/lib/browser/drafts/use-composer-draft.d.ts +21 -0
  495. package/lib/browser/drafts/use-composer-draft.js +146 -0
  496. package/lib/browser/extension/icons.js +24 -3
  497. package/lib/browser/extension/web-api-components.d.ts +13 -0
  498. package/lib/browser/extension/web-api-contributions.d.ts +125 -0
  499. package/lib/browser/extension/web-extension-api.d.ts +88 -5
  500. package/lib/browser/extension/web-extension-context.d.ts +5 -0
  501. package/lib/browser/extension/web-extension-context.js +62 -9
  502. package/lib/browser/extension/web-extension-protocol.d.ts +19 -1
  503. package/lib/browser/extension/web-extension-protocol.js +3 -0
  504. package/lib/browser/extension/web-extension-run.d.ts +5 -2
  505. package/lib/browser/extension/web-extension-run.js +13 -1
  506. package/lib/browser/extension/web-extensions-running.d.ts +94 -0
  507. package/lib/browser/extension/web-extensions-running.js +343 -0
  508. package/lib/browser/extension/web-extensions.d.ts +6 -82
  509. package/lib/browser/extension/web-extensions.js +7 -316
  510. package/lib/browser/extension/web-pages.js +1 -0
  511. package/lib/browser/extension/web-session-notices.js +8 -3
  512. package/lib/browser/extension/web-tasks.d.ts +2 -0
  513. package/lib/browser/extension/web-tasks.js +6 -0
  514. package/lib/browser/extension/web-view-util.d.ts +2 -1
  515. package/lib/browser/extension/web-view-util.js +4 -1
  516. package/lib/browser/gateway/console-parts.d.ts +4 -12
  517. package/lib/browser/gateway/console-parts.js +42 -126
  518. package/lib/browser/gateway/console-tenant.js +3 -2
  519. package/lib/browser/gateway/console-trend.d.ts +12 -0
  520. package/lib/browser/gateway/console-trend.js +151 -0
  521. package/lib/browser/gateway/console-util.js +2 -2
  522. package/lib/browser/gateway/console-view.js +48 -2
  523. package/lib/browser/i18n/locales.d.ts +170 -6
  524. package/lib/browser/i18n/messages-ja.js +171 -7
  525. package/lib/browser/i18n/messages-zh-tw.js +171 -7
  526. package/lib/browser/i18n/messages.d.ts +167 -3
  527. package/lib/browser/i18n/messages.js +342 -14
  528. package/lib/browser/index.d.ts +17 -0
  529. package/lib/browser/index.js +17 -0
  530. package/lib/browser/notices/notices-protocol.d.ts +12 -0
  531. package/lib/browser/notices/notices.js +7 -4
  532. package/lib/browser/offline/device-values.d.ts +2 -0
  533. package/lib/browser/offline/device-values.js +6 -1
  534. package/lib/browser/screen/page-answers.d.ts +43 -0
  535. package/lib/browser/screen/page-answers.js +93 -0
  536. package/lib/browser/screen/screen-protocol.d.ts +113 -0
  537. package/lib/browser/screen/screen-protocol.js +48 -0
  538. package/lib/browser/screen/screen.d.ts +21 -0
  539. package/lib/browser/screen/screen.js +125 -0
  540. package/lib/browser/screen/use-screen-part.d.ts +7 -0
  541. package/lib/browser/screen/use-screen-part.js +50 -0
  542. package/lib/browser/settings/settings-protocol.d.ts +5 -1
  543. package/lib/browser/settings/settings-protocol.js +5 -1
  544. package/lib/browser/share/shared-extensions.d.ts +30 -0
  545. package/lib/browser/share/shared-extensions.js +181 -0
  546. package/lib/browser/share/shared-link.d.ts +12 -0
  547. package/lib/browser/share/shared-link.js +41 -0
  548. package/lib/browser/share/shared-page.d.ts +6 -0
  549. package/lib/browser/share/shared-page.js +173 -0
  550. package/lib/browser/state/state-protocol.d.ts +14 -0
  551. package/lib/browser/state/state-protocol.js +20 -1
  552. package/lib/browser/state/state.d.ts +10 -2
  553. package/lib/browser/state/state.js +18 -2
  554. package/lib/browser/style/base.d.ts +1 -1
  555. package/lib/browser/style/base.js +4 -0
  556. package/lib/browser/style/chat-list.d.ts +3 -0
  557. package/lib/browser/style/chat-list.js +156 -0
  558. package/lib/browser/style/conversation-column.d.ts +3 -0
  559. package/lib/browser/style/conversation-column.js +253 -0
  560. package/lib/browser/style/conversation.d.ts +1 -1
  561. package/lib/browser/style/conversation.js +24 -8
  562. package/lib/browser/style/dialogs.d.ts +3 -0
  563. package/lib/browser/style/dialogs.js +166 -0
  564. package/lib/browser/style/layout.d.ts +2 -2
  565. package/lib/browser/style/layout.js +1 -525
  566. package/lib/browser/style/pages.d.ts +1 -1
  567. package/lib/browser/style/pages.js +10 -3
  568. package/lib/browser/style/phone.d.ts +1 -1
  569. package/lib/browser/style/phone.js +7 -3
  570. package/lib/browser/style/shared.d.ts +3 -0
  571. package/lib/browser/style/shared.js +26 -0
  572. package/lib/browser/style/shell.d.ts +1 -1
  573. package/lib/browser/style/shell.js +47 -0
  574. package/lib/browser/style/tasks.d.ts +1 -1
  575. package/lib/browser/style/tasks.js +13 -8
  576. package/lib/browser/style.js +8 -0
  577. package/lib/browser/util/gallery.d.ts +24 -2
  578. package/lib/browser/util/gallery.js +82 -2
  579. package/lib/browser/util/image-copy.d.ts +17 -0
  580. package/lib/browser/util/image-copy.js +60 -0
  581. package/lib/browser/util/message.d.ts +5 -0
  582. package/lib/browser/util/message.js +14 -0
  583. package/lib/browser/util/process.d.ts +6 -2
  584. package/lib/browser/util/process.js +6 -2
  585. package/lib/browser/util/spoken.d.ts +25 -0
  586. package/lib/browser/util/spoken.js +86 -0
  587. package/lib/browser/util/transcript.d.ts +23 -0
  588. package/lib/browser/util/transcript.js +49 -0
  589. package/lib/browser/util/voice.d.ts +5 -1
  590. package/lib/browser/util/voice.js +6 -1
  591. package/lib/browser/workbench-hosts.d.ts +37 -0
  592. package/lib/browser/workbench-hosts.js +124 -0
  593. package/lib/browser/workbench-lists.d.ts +34 -0
  594. package/lib/browser/workbench-lists.js +132 -0
  595. package/lib/browser/workbench-protocol.d.ts +14 -1
  596. package/lib/browser/workbench-services.d.ts +50 -0
  597. package/lib/browser/workbench-services.js +124 -0
  598. package/lib/browser/workbench-util.d.ts +1 -1
  599. package/lib/browser/workbench.d.ts +6 -89
  600. package/lib/browser/workbench.js +23 -333
  601. package/package.json +7 -7
@@ -1,7 +1,4 @@
1
1
  import * as React from 'react';
2
- import { Callout } from '../components/callout.js';
3
- import { Segmented } from '../components/settings-controls.js';
4
- import { useWorkbench } from '../hooks.js';
5
2
  import { useLanguage, useT } from '../i18n/use-t.js';
6
3
  import { ConsoleUtil } from './console-util.js';
7
4
  /** How often what the console shows is read again while it is seen. */
@@ -52,131 +49,50 @@ export function Stat({ value, label, tone, onClick, title, }) {
52
49
  return onClick ? (React.createElement("button", { type: "button", className: "ta-console-stat", onClick: onClick, title: title }, body)) : (React.createElement("div", { className: "ta-console-stat" }, body));
53
50
  }
54
51
  /** This month's minutes and tokens of an account, as bars; the limits of messages and pages in a line. */
52
+ const REFUSED = {
53
+ host: 'ta.console.egressReasonHost',
54
+ port: 'ta.console.egressReasonPort',
55
+ network: 'ta.console.egressReasonNetwork',
56
+ };
57
+ /** The connections a sandbox was refused lately, under the meters. */
58
+ function EgressRefused({ refused }) {
59
+ const t = useT();
60
+ const language = useLanguage();
61
+ return (React.createElement("div", { className: "ta-console-card ta-console-refused" }, refused.map(each => (React.createElement("div", { key: `${each.host}-${each.reason}`, className: "ta-console-refused-row" },
62
+ React.createElement("span", { className: "ta-console-activity-name ta-ellipsis" }, each.host),
63
+ React.createElement("span", { className: "ta-console-refused-reason ta-ellipsis" },
64
+ t(REFUSED[each.reason]),
65
+ each.count > 1 ? ` ×${each.count}` : ''),
66
+ React.createElement("span", { className: "ta-console-activity-time" }, ConsoleUtil.ago(each.at, language)))))));
67
+ }
55
68
  export function QuotaMeters({ quota }) {
56
69
  const t = useT();
57
70
  const language = useLanguage();
58
71
  const { minutes, tokens } = quota;
59
72
  const allowed = minutes.limit === undefined ? undefined : minutes.limit + minutes.bonus;
60
73
  const resets = new Date(quota.resetsAt).toLocaleDateString(language, { month: 'short', day: 'numeric' });
61
- return (React.createElement("div", { className: "ta-console-usage" },
62
- React.createElement(Meter, { label: t('ta.console.freeMinutes'), value: allowed === undefined
63
- ? `${ConsoleUtil.minutes(minutes.used)} · ${t('ta.console.unlimited')}`
64
- : `${ConsoleUtil.minutes(minutes.used)} / ${ConsoleUtil.minutes(allowed)}`, share: allowed === undefined ? undefined : ConsoleUtil.share(minutes.used, allowed), hint: [minutes.bonus > 0 ? t('ta.console.bonus', { minutes: minutes.bonus }) : '', t('ta.console.resets', { date: resets })]
65
- .filter(Boolean)
66
- .join(' · ') }),
67
- React.createElement(Meter, { label: t('ta.console.monthTokens'), value: [ConsoleUtil.count(tokens.used), ConsoleUtil.cost(tokens.cost)].filter(Boolean).join(' · '), hint: [
68
- quota.promptsPerMinute !== undefined ? t('ta.console.promptsLimit', { count: quota.promptsPerMinute }) : '',
69
- quota.connections !== undefined ? t('ta.console.connectionsLimit', { count: quota.connections }) : '',
70
- ]
71
- .filter(Boolean)
72
- .join(' · ') })));
73
- }
74
- const RANGES = [
75
- { value: '1', label: 'ta.console.range1' },
76
- { value: '7', label: 'ta.console.range7' },
77
- { value: '30', label: 'ta.console.range30' },
78
- ];
79
- function pointLabel(point, range, language) {
80
- const date = new Date(point.at);
81
- return range === 1
82
- ? date.toLocaleTimeString(language, { hour: '2-digit', minute: '2-digit' })
83
- : date.toLocaleDateString(language, { month: 'numeric', day: 'numeric', weekday: range === 7 ? 'short' : undefined });
84
- }
85
- /** Bars of a trend, the one under the pointer said above them. */
86
- function TrendBars({ points, metric, range }) {
87
- const t = useT();
88
- const language = useLanguage();
89
- const [hovered, setHovered] = React.useState();
90
- const values = points.map(point => (metric === 'tokens' ? point.tokens : point.cost));
91
- const max = Math.max(...values, 0);
92
- const shown = hovered !== undefined ? points[hovered] : undefined;
93
- const format = (value) => { var _a; return (metric === 'tokens' ? ConsoleUtil.count(value) : ((_a = ConsoleUtil.cost(value)) !== null && _a !== void 0 ? _a : '$0')); };
94
- const width = 600;
95
- const height = 120;
96
- const slot = width / points.length;
97
- const gap = Math.min(4, slot * 0.25);
98
- return (React.createElement("div", { className: "ta-console-chart" },
99
- React.createElement("div", { className: "ta-console-chart-hover" }, shown ? (React.createElement(React.Fragment, null,
100
- React.createElement("span", null, pointLabel(shown, range, language)),
101
- React.createElement("strong", null, format(metric === 'tokens' ? shown.tokens : shown.cost)),
102
- React.createElement("span", null, t('ta.console.turns', { count: shown.turns })))) : (React.createElement("span", null, t('ta.console.peak', { value: format(max) })))),
103
- React.createElement("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", role: "img", "aria-label": t('ta.console.trend'), onPointerMove: event => {
104
- const box = event.currentTarget.getBoundingClientRect();
105
- setHovered(Math.min(points.length - 1, Math.max(0, Math.floor(((event.clientX - box.left) / box.width) * points.length))));
106
- }, onPointerLeave: () => setHovered(undefined) },
107
- values.map((value, index) => {
108
- const barHeight = max > 0 ? Math.max(value > 0 ? 2 : 0, (value / max) * (height - 4)) : 0;
109
- return (React.createElement("rect", { key: points[index].at, x: index * slot + gap / 2, y: height - barHeight, width: Math.max(1, slot - gap), height: barHeight, rx: Math.min(3, (slot - gap) / 3), className: hovered === index ? 'ta-console-chart-bar ta-on' : 'ta-console-chart-bar' }));
110
- }),
111
- React.createElement("line", { x1: 0, x2: width, y1: height - 0.5, y2: height - 0.5, className: "ta-console-chart-axis" })),
112
- React.createElement("div", { className: "ta-console-chart-ticks" },
113
- React.createElement("span", null, pointLabel(points[0], range, language)),
114
- React.createElement("span", null, pointLabel(points[Math.floor(points.length / 2)], range, language)),
115
- React.createElement("span", null, pointLabel(points[points.length - 1], range, language)))));
116
- }
117
- function Shares({ rows, total, metric }) {
118
- return (React.createElement("div", { className: "ta-console-shares" }, rows.map(row => {
119
- var _a;
120
- const value = metric === 'tokens' ? row.tokens : row.cost;
121
- return (React.createElement("div", { key: row.key, className: "ta-console-share" },
122
- React.createElement("span", { className: "ta-console-share-label ta-ellipsis", title: row.label }, row.label),
123
- React.createElement(Bar, { share: total > 0 ? Math.round((value / total) * 100) : 0, small: true, part: true }),
124
- React.createElement("span", { className: "ta-console-share-value" }, metric === 'tokens' ? ConsoleUtil.count(value) : ((_a = ConsoleUtil.cost(value)) !== null && _a !== void 0 ? _a : '—'))));
125
- })));
126
- }
127
- /**
128
- * What agents took over time, of the gateway or of one account: tokens or dollars by hour (a day) or by day (a week,
129
- * a month), the totals, and the models and accounts that took most.
130
- */
131
- export function TrendCard({ tenantId, tenants, onTenant }) {
132
- var _a, _b, _c, _d, _e, _f;
133
- const t = useT();
134
- const [, bench] = useWorkbench();
135
- const [range, setRange] = React.useState(7);
136
- const [metric, setMetric] = React.useState('tokens');
137
- const { value: trend, error } = usePolled(() => bench.gateway.getUsageTrend(range === 1 ? 2 : range, tenantId), `${range}|${tenantId}`, 60000);
138
- const points = trend ? ConsoleUtil.points(trend, range) : undefined;
139
- const totals = points === null || points === void 0 ? void 0 : points.reduce((sum, point) => ({ tokens: sum.tokens + point.tokens, cost: sum.cost + point.cost, turns: sum.turns + point.turns }), {
140
- tokens: 0,
141
- cost: 0,
142
- turns: 0,
143
- });
144
- const total = metric === 'tokens' ? ((_a = totals === null || totals === void 0 ? void 0 : totals.tokens) !== null && _a !== void 0 ? _a : 0) : ((_b = totals === null || totals === void 0 ? void 0 : totals.cost) !== null && _b !== void 0 ? _b : 0);
145
- const names = new Map(tenants === null || tenants === void 0 ? void 0 : tenants.map(tenant => [tenant.id, tenant.name || tenant.account]));
146
- return (React.createElement("div", { className: "ta-console-card" },
147
- React.createElement("div", { className: "ta-console-card-head" },
148
- React.createElement("div", { className: "ta-console-total" },
149
- React.createElement("strong", null, metric === 'tokens' ? ConsoleUtil.count((_c = totals === null || totals === void 0 ? void 0 : totals.tokens) !== null && _c !== void 0 ? _c : 0) : ((_e = ConsoleUtil.cost((_d = totals === null || totals === void 0 ? void 0 : totals.cost) !== null && _d !== void 0 ? _d : 0)) !== null && _e !== void 0 ? _e : '$0')),
150
- React.createElement("span", null, t('ta.console.turns', { count: (_f = totals === null || totals === void 0 ? void 0 : totals.turns) !== null && _f !== void 0 ? _f : 0 }))),
151
- React.createElement("div", { className: "ta-console-card-controls" },
152
- React.createElement(Segmented, { label: t('ta.console.metric'), value: metric, onChange: setMetric, choices: [
153
- { value: 'tokens', label: 'ta.console.tokens' },
154
- { value: 'cost', label: 'ta.console.cost' },
155
- ] }),
156
- React.createElement(Segmented, { label: t('ta.console.range'), value: String(range), onChange: value => setRange(Number(value)), choices: RANGES }))),
157
- error && !trend ? (React.createElement(Callout, { level: "warning" }, error)) : !points ? (React.createElement("div", { className: "ta-console-chart ta-console-chart-loading" })) : (React.createElement(TrendBars, { points: points, metric: metric, range: range })),
158
- trend && trend.byModel.length > 0 && (React.createElement(React.Fragment, null,
159
- React.createElement("span", { className: "ta-console-card-label" }, t('ta.console.byModel')),
160
- React.createElement(Shares, { metric: metric, total: metric === 'tokens'
161
- ? trend.byModel.reduce((sum, row) => sum + row.tokens, 0)
162
- : trend.byModel.reduce((sum, row) => sum + row.cost, 0), rows: trend.byModel
163
- .slice(0, 5)
164
- .map(row => { var _a; return ({ key: row.model, label: (_a = row.model.split('/').pop()) !== null && _a !== void 0 ? _a : row.model, tokens: row.tokens, cost: row.cost }); }) }))),
165
- trend && tenants && trend.byTenant.length > 0 && (React.createElement(React.Fragment, null,
166
- React.createElement("span", { className: "ta-console-card-label" }, t('ta.console.byAccount')),
167
- React.createElement("div", { className: "ta-console-shares" }, trend.byTenant.slice(0, 5).map(row => {
168
- var _a, _b;
169
- const value = metric === 'tokens' ? row.tokens : row.cost;
170
- const all = metric === 'tokens'
171
- ? trend.byTenant.reduce((sum, each) => sum + each.tokens, 0)
172
- : trend.byTenant.reduce((sum, each) => sum + each.cost, 0);
173
- return (React.createElement("button", { key: row.tenantId, type: "button", className: "ta-console-share ta-console-share-button", onClick: () => onTenant === null || onTenant === void 0 ? void 0 : onTenant(row.tenantId) },
174
- React.createElement("span", { className: "ta-console-share-label ta-ellipsis" }, (_a = names.get(row.tenantId)) !== null && _a !== void 0 ? _a : row.tenantId),
175
- React.createElement(Bar, { share: all > 0 ? Math.round((value / all) * 100) : 0, small: true, part: true }),
176
- React.createElement("span", { className: "ta-console-share-value" }, metric === 'tokens' ? ConsoleUtil.count(value) : ((_b = ConsoleUtil.cost(value)) !== null && _b !== void 0 ? _b : '—'))));
177
- })))),
178
- trend && trend.stale.length > 0 && React.createElement("p", { className: "ta-list-hint" }, t('ta.console.stale', { count: trend.stale.length })),
179
- total === 0 && trend && React.createElement("p", { className: "ta-list-hint" }, t('ta.console.trendEmpty'))));
74
+ const { egress } = quota;
75
+ return (React.createElement(React.Fragment, null,
76
+ React.createElement("div", { className: "ta-console-usage" },
77
+ React.createElement(Meter, { label: t('ta.console.freeMinutes'), value: allowed === undefined
78
+ ? `${ConsoleUtil.minutes(minutes.used)} · ${t('ta.console.unlimited')}`
79
+ : `${ConsoleUtil.minutes(minutes.used)} / ${ConsoleUtil.minutes(allowed)}`, share: allowed === undefined ? undefined : ConsoleUtil.share(minutes.used, allowed), hint: [minutes.bonus > 0 ? t('ta.console.bonus', { minutes: minutes.bonus }) : '', t('ta.console.resets', { date: resets })]
80
+ .filter(Boolean)
81
+ .join(' · ') }),
82
+ React.createElement(Meter, { label: t('ta.console.monthTokens'), value: [
83
+ tokens.limit === undefined ? ConsoleUtil.count(tokens.used) : `${ConsoleUtil.count(tokens.used)} / ${ConsoleUtil.count(tokens.limit)}`,
84
+ ConsoleUtil.cost(tokens.cost),
85
+ ]
86
+ .filter(Boolean)
87
+ .join(' · '), share: tokens.limit === undefined ? undefined : ConsoleUtil.share(tokens.used, tokens.limit), hint: [
88
+ t(tokens.metered ? 'ta.console.tokensMetered' : 'ta.console.tokensReported'),
89
+ quota.promptsPerMinute !== undefined ? t('ta.console.promptsLimit', { count: quota.promptsPerMinute }) : '',
90
+ quota.connections !== undefined ? t('ta.console.connectionsLimit', { count: quota.connections }) : '',
91
+ ]
92
+ .filter(Boolean)
93
+ .join(' · ') }),
94
+ egress && (React.createElement(Meter, { label: t('ta.console.egressBytes'), value: egress.bytes > 0 ? ConsoleUtil.bytes(egress.bytes) : '0 MB', hint: egress.refused.length > 0 ? t('ta.console.egressRefused', { count: egress.refused.length }) : t('ta.console.egressThrough') }))),
95
+ egress && egress.refused.length > 0 && React.createElement(EgressRefused, { refused: egress.refused })));
180
96
  }
181
97
  function modeOf(value, nullable) {
182
98
  return value === null ? 'none' : value === undefined ? (nullable ? 'inherit' : 'none') : 'set';
@@ -215,17 +131,18 @@ function NumberLimit({ label, hint, value, base, nullable, readOnly, onChange, }
215
131
  * Limits to change: the gateway's defaults (`nullable` false: a limit is a number or none), or an account's over them
216
132
  * (each the default's, none, or its own). Saved as a whole.
217
133
  */
218
- export function LimitsForm({ value, defaults, providers, nullable, readOnly, onSave, }) {
134
+ export function LimitsForm({ value, defaults, providers, nullable, readOnly, metered, onSave, }) {
219
135
  const t = useT();
220
136
  const [draft, setDraft] = React.useState(value);
221
137
  const [busy, setBusy] = React.useState(false);
222
138
  React.useEffect(() => setDraft(value), [value]);
223
139
  const changed = JSON.stringify(draft) !== JSON.stringify(value);
224
140
  const set = (change) => setDraft(current => Object.fromEntries(Object.entries({ ...current, ...change }).filter(([, item]) => item !== undefined)));
225
- const base = (key) => (typeof (defaults === null || defaults === void 0 ? void 0 : defaults[key]) === 'number' ? String(defaults[key]) : undefined);
141
+ const base = (key) => typeof (defaults === null || defaults === void 0 ? void 0 : defaults[key]) === 'number' ? String(defaults[key]) : undefined;
226
142
  const providersMode = draft.providers === null ? 'none' : draft.providers === undefined ? (nullable ? 'inherit' : 'none') : 'set';
227
143
  return (React.createElement("div", { className: "ta-console-card ta-console-limits" },
228
144
  React.createElement(NumberLimit, { label: t('ta.console.freeMinutes'), hint: t('ta.console.freeMinutesHint'), value: draft.freeMinutes, base: base('freeMinutes'), nullable: nullable, readOnly: readOnly, onChange: freeMinutes => set({ freeMinutes }) }),
145
+ React.createElement(NumberLimit, { label: t('ta.console.monthlyTokens'), hint: t(metered ? 'ta.console.monthlyTokensHint' : 'ta.console.monthlyTokensOff'), value: draft.monthlyTokens, base: base('monthlyTokens'), nullable: nullable, readOnly: readOnly, onChange: monthlyTokens => set({ monthlyTokens }) }),
229
146
  React.createElement(NumberLimit, { label: t('ta.console.promptsPerMinute'), hint: t('ta.console.promptsPerMinuteHint'), value: draft.promptsPerMinute, base: base('promptsPerMinute'), nullable: nullable, readOnly: readOnly, onChange: promptsPerMinute => set({ promptsPerMinute }) }),
230
147
  React.createElement(NumberLimit, { label: t('ta.console.connectionsMax'), hint: t('ta.console.connectionsMaxHint'), value: draft.connections, base: base('connections'), nullable: nullable, readOnly: readOnly, onChange: connections => set({ connections }) }),
231
148
  React.createElement("div", { className: "ta-console-limit" },
@@ -263,7 +180,7 @@ export function LimitsForm({ value, defaults, providers, nullable, readOnly, onS
263
180
  React.createElement("button", { type: "button", className: "ta-button", disabled: !changed || busy, onClick: () => setDraft(value) }, t('ta.console.reset')),
264
181
  React.createElement("button", { type: "button", className: "ta-button ta-primary", disabled: !changed ||
265
182
  busy ||
266
- [draft.freeMinutes, draft.promptsPerMinute, draft.connections].some(item => typeof item === 'number' && Number.isNaN(item)), onClick: () => {
183
+ [draft.freeMinutes, draft.monthlyTokens, draft.promptsPerMinute, draft.connections].some(item => typeof item === 'number' && Number.isNaN(item)), onClick: () => {
267
184
  setBusy(true);
268
185
  void onSave(draft).finally(() => setBusy(false));
269
186
  } }, busy ? React.createElement("span", { className: "ta-spinner" }) : t('ta.console.save'))))));
@@ -7,7 +7,8 @@ import { Icon, IconButton } from '../components/icon.js';
7
7
  import { useNotices, useWorkbench } from '../hooks.js';
8
8
  import { useLanguage, useT } from '../i18n/use-t.js';
9
9
  import { TerminalText } from '../util/terminal-text.js';
10
- import { Bar, LimitsForm, Meter, QuotaMeters, SectionTitle, Stat, TrendCard, usePolled } from './console-parts.js';
10
+ import { Bar, LimitsForm, Meter, QuotaMeters, SectionTitle, Stat, usePolled } from './console-parts.js';
11
+ import { TrendCard } from './console-trend.js';
11
12
  import { ConsoleUtil } from './console-util.js';
12
13
  export const STATUS = {
13
14
  starting: 'ta.environment.starting',
@@ -250,7 +251,7 @@ export function TenantDetail({ tenant, info, onChanged }) {
250
251
  t('ta.console.grant')),
251
252
  React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => setEditing(!editing) }, t(editing ? 'ta.console.limitsDone' : 'ta.console.limitsEdit')))) : undefined }, t('ta.console.quota')),
252
253
  React.createElement(QuotaMeters, { quota: tenant.quota }),
253
- editing && manage && (React.createElement(LimitsForm, { value: (_a = tenant.limits) !== null && _a !== void 0 ? _a : {}, defaults: info.policy.defaults, providers: info.providers, nullable: true, onSave: limits => bench.gateway
254
+ editing && manage && (React.createElement(LimitsForm, { value: (_a = tenant.limits) !== null && _a !== void 0 ? _a : {}, defaults: info.policy.defaults, providers: info.providers, nullable: true, metered: info.models.length > 0, onSave: limits => bench.gateway
254
255
  .setTenantLimits(tenant.id, Object.keys(limits).length ? limits : null)
255
256
  .then(() => notices.notify(t('ta.console.saved'), { level: 'success' }))
256
257
  .then(onChanged)
@@ -0,0 +1,11 @@
1
+ import type { TaGatewayTenant } from '@celljs/ta-protocol';
2
+ import * as React from 'react';
3
+ /**
4
+ * What agents took over time, of the gateway or of one account: tokens or dollars by hour (a day) or by day (a week,
5
+ * a month), the totals, and the models and accounts that took most.
6
+ */
7
+ export declare function TrendCard({ tenantId, tenants, onTenant }: {
8
+ tenantId?: string;
9
+ tenants?: TaGatewayTenant[];
10
+ onTenant?(id: string): void;
11
+ }): React.JSX.Element;
@@ -0,0 +1,115 @@
1
+ import * as React from 'react';
2
+ import { Callout } from '../components/callout.js';
3
+ import { Segmented } from '../components/settings-controls.js';
4
+ import { useWorkbench } from '../hooks.js';
5
+ import { useLanguage, useT } from '../i18n/use-t.js';
6
+ import { Bar, usePolled } from './console-parts.js';
7
+ import { ConsoleUtil } from './console-util.js';
8
+ const RANGES = [
9
+ { value: '1', label: 'ta.console.range1' },
10
+ { value: '7', label: 'ta.console.range7' },
11
+ { value: '30', label: 'ta.console.range30' },
12
+ ];
13
+ function pointLabel(point, range, language) {
14
+ const date = new Date(point.at);
15
+ return range === 1
16
+ ? date.toLocaleTimeString(language, { hour: '2-digit', minute: '2-digit' })
17
+ : date.toLocaleDateString(language, { month: 'numeric', day: 'numeric', weekday: range === 7 ? 'short' : undefined });
18
+ }
19
+ /** Bars of a trend, the one under the pointer said above them. */
20
+ function TrendBars({ points, metric, range }) {
21
+ const t = useT();
22
+ const language = useLanguage();
23
+ const [hovered, setHovered] = React.useState();
24
+ const values = points.map(point => (metric === 'tokens' ? point.tokens : point.cost));
25
+ const max = Math.max(...values, 0);
26
+ const shown = hovered !== undefined ? points[hovered] : undefined;
27
+ const format = (value) => { var _a; return (metric === 'tokens' ? ConsoleUtil.count(value) : ((_a = ConsoleUtil.cost(value)) !== null && _a !== void 0 ? _a : '$0')); };
28
+ const width = 600;
29
+ const height = 120;
30
+ const slot = width / points.length;
31
+ const gap = Math.min(4, slot * 0.25);
32
+ return (React.createElement("div", { className: "ta-console-chart" },
33
+ React.createElement("div", { className: "ta-console-chart-hover" }, shown ? (React.createElement(React.Fragment, null,
34
+ React.createElement("span", null, pointLabel(shown, range, language)),
35
+ React.createElement("strong", null, format(metric === 'tokens' ? shown.tokens : shown.cost)),
36
+ React.createElement("span", null, t('ta.console.turns', { count: shown.turns })))) : (React.createElement("span", null, t('ta.console.peak', { value: format(max) })))),
37
+ React.createElement("svg", { viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", role: "img", "aria-label": t('ta.console.trend'), onPointerMove: event => {
38
+ const box = event.currentTarget.getBoundingClientRect();
39
+ setHovered(Math.min(points.length - 1, Math.max(0, Math.floor(((event.clientX - box.left) / box.width) * points.length))));
40
+ }, onPointerLeave: () => setHovered(undefined) },
41
+ values.map((value, index) => {
42
+ const barHeight = max > 0 ? Math.max(value > 0 ? 2 : 0, (value / max) * (height - 4)) : 0;
43
+ return (React.createElement("rect", { key: points[index].at, x: index * slot + gap / 2, y: height - barHeight, width: Math.max(1, slot - gap), height: barHeight, rx: Math.min(3, (slot - gap) / 3), className: hovered === index ? 'ta-console-chart-bar ta-on' : 'ta-console-chart-bar' }));
44
+ }),
45
+ React.createElement("line", { x1: 0, x2: width, y1: height - 0.5, y2: height - 0.5, className: "ta-console-chart-axis" })),
46
+ React.createElement("div", { className: "ta-console-chart-ticks" },
47
+ React.createElement("span", null, pointLabel(points[0], range, language)),
48
+ React.createElement("span", null, pointLabel(points[Math.floor(points.length / 2)], range, language)),
49
+ React.createElement("span", null, pointLabel(points[points.length - 1], range, language)))));
50
+ }
51
+ function Shares({ rows, total, metric }) {
52
+ return (React.createElement("div", { className: "ta-console-shares" }, rows.map(row => {
53
+ var _a;
54
+ const value = metric === 'tokens' ? row.tokens : row.cost;
55
+ return (React.createElement("div", { key: row.key, className: "ta-console-share" },
56
+ React.createElement("span", { className: "ta-console-share-label ta-ellipsis", title: row.label }, row.label),
57
+ React.createElement(Bar, { share: total > 0 ? Math.round((value / total) * 100) : 0, small: true, part: true }),
58
+ React.createElement("span", { className: "ta-console-share-value" }, metric === 'tokens' ? ConsoleUtil.count(value) : ((_a = ConsoleUtil.cost(value)) !== null && _a !== void 0 ? _a : '—'))));
59
+ })));
60
+ }
61
+ /**
62
+ * What agents took over time, of the gateway or of one account: tokens or dollars by hour (a day) or by day (a week,
63
+ * a month), the totals, and the models and accounts that took most.
64
+ */
65
+ export function TrendCard({ tenantId, tenants, onTenant }) {
66
+ var _a, _b, _c, _d, _e, _f;
67
+ const t = useT();
68
+ const [, bench] = useWorkbench();
69
+ const [range, setRange] = React.useState(7);
70
+ const [metric, setMetric] = React.useState('tokens');
71
+ const { value: trend, error } = usePolled(() => bench.gateway.getUsageTrend(range === 1 ? 2 : range, tenantId), `${range}|${tenantId}`, 60000);
72
+ const points = trend ? ConsoleUtil.points(trend, range) : undefined;
73
+ const totals = points === null || points === void 0 ? void 0 : points.reduce((sum, point) => ({ tokens: sum.tokens + point.tokens, cost: sum.cost + point.cost, turns: sum.turns + point.turns }), {
74
+ tokens: 0,
75
+ cost: 0,
76
+ turns: 0,
77
+ });
78
+ const total = metric === 'tokens' ? ((_a = totals === null || totals === void 0 ? void 0 : totals.tokens) !== null && _a !== void 0 ? _a : 0) : ((_b = totals === null || totals === void 0 ? void 0 : totals.cost) !== null && _b !== void 0 ? _b : 0);
79
+ const names = new Map(tenants === null || tenants === void 0 ? void 0 : tenants.map(tenant => [tenant.id, tenant.name || tenant.account]));
80
+ return (React.createElement("div", { className: "ta-console-card" },
81
+ React.createElement("div", { className: "ta-console-card-head" },
82
+ React.createElement("div", { className: "ta-console-total" },
83
+ React.createElement("strong", null, metric === 'tokens' ? ConsoleUtil.count((_c = totals === null || totals === void 0 ? void 0 : totals.tokens) !== null && _c !== void 0 ? _c : 0) : ((_e = ConsoleUtil.cost((_d = totals === null || totals === void 0 ? void 0 : totals.cost) !== null && _d !== void 0 ? _d : 0)) !== null && _e !== void 0 ? _e : '$0')),
84
+ React.createElement("span", null, t('ta.console.turns', { count: (_f = totals === null || totals === void 0 ? void 0 : totals.turns) !== null && _f !== void 0 ? _f : 0 }))),
85
+ React.createElement("div", { className: "ta-console-card-controls" },
86
+ React.createElement(Segmented, { label: t('ta.console.metric'), value: metric, onChange: setMetric, choices: [
87
+ { value: 'tokens', label: 'ta.console.tokens' },
88
+ { value: 'cost', label: 'ta.console.cost' },
89
+ ] }),
90
+ React.createElement(Segmented, { label: t('ta.console.range'), value: String(range), onChange: value => setRange(Number(value)), choices: RANGES }))),
91
+ error && !trend ? (React.createElement(Callout, { level: "warning" }, error)) : !points ? (React.createElement("div", { className: "ta-console-chart ta-console-chart-loading" })) : (React.createElement(TrendBars, { points: points, metric: metric, range: range })),
92
+ trend && trend.byModel.length > 0 && (React.createElement(React.Fragment, null,
93
+ React.createElement("span", { className: "ta-console-card-label" }, t('ta.console.byModel')),
94
+ React.createElement(Shares, { metric: metric, total: metric === 'tokens'
95
+ ? trend.byModel.reduce((sum, row) => sum + row.tokens, 0)
96
+ : trend.byModel.reduce((sum, row) => sum + row.cost, 0), rows: trend.byModel
97
+ .slice(0, 5)
98
+ .map(row => { var _a; return ({ key: row.model, label: (_a = row.model.split('/').pop()) !== null && _a !== void 0 ? _a : row.model, tokens: row.tokens, cost: row.cost }); }) }))),
99
+ trend && tenants && trend.byTenant.length > 0 && (React.createElement(React.Fragment, null,
100
+ React.createElement("span", { className: "ta-console-card-label" }, t('ta.console.byAccount')),
101
+ React.createElement("div", { className: "ta-console-shares" }, trend.byTenant.slice(0, 5).map(row => {
102
+ var _a, _b;
103
+ const value = metric === 'tokens' ? row.tokens : row.cost;
104
+ const all = metric === 'tokens'
105
+ ? trend.byTenant.reduce((sum, each) => sum + each.tokens, 0)
106
+ : trend.byTenant.reduce((sum, each) => sum + each.cost, 0);
107
+ return (React.createElement("button", { key: row.tenantId, type: "button", className: "ta-console-share ta-console-share-button", onClick: () => onTenant === null || onTenant === void 0 ? void 0 : onTenant(row.tenantId) },
108
+ React.createElement("span", { className: "ta-console-share-label ta-ellipsis" }, (_a = names.get(row.tenantId)) !== null && _a !== void 0 ? _a : row.tenantId),
109
+ React.createElement(Bar, { share: all > 0 ? Math.round((value / all) * 100) : 0, small: true, part: true }),
110
+ React.createElement("span", { className: "ta-console-share-value" }, metric === 'tokens' ? ConsoleUtil.count(value) : ((_b = ConsoleUtil.cost(value)) !== null && _b !== void 0 ? _b : '—'))));
111
+ })))),
112
+ trend && trend.stale.length > 0 && React.createElement("p", { className: "ta-list-hint" }, t('ta.console.stale', { count: trend.stale.length })),
113
+ total === 0 && trend && React.createElement("p", { className: "ta-list-hint" }, t('ta.console.trendEmpty'))));
114
+ }
115
+ //# sourceMappingURL=console-trend.js.map
@@ -30,14 +30,14 @@ export var ConsoleUtil;
30
30
  ConsoleUtil.matches = matches;
31
31
  function filter(tenant, by) {
32
32
  var _a;
33
- var _b, _c;
33
+ var _b, _c, _d;
34
34
  switch (by) {
35
35
  case 'running':
36
36
  return tenant.environment.status === 'running';
37
37
  case 'working':
38
38
  return ((_b = (_a = tenant.agents) === null || _a === void 0 ? void 0 : _a.working) !== null && _b !== void 0 ? _b : 0) > 0;
39
39
  case 'limited':
40
- return !!tenant.quota.blocked || ((_c = minutesShare(tenant.quota)) !== null && _c !== void 0 ? _c : 0) >= 80;
40
+ return (!!tenant.quota.blocked || ((_c = minutesShare(tenant.quota)) !== null && _c !== void 0 ? _c : 0) >= 80 || ((_d = share(tenant.quota.tokens.used, tenant.quota.tokens.limit)) !== null && _d !== void 0 ? _d : 0) >= 80);
41
41
  case 'admins':
42
42
  return tenant.role !== 'member';
43
43
  default:
@@ -1,4 +1,4 @@
1
- import { ChevronLeft, Copy, RefreshCw, Search, Server, ShieldCheck, UserPlus } from 'lucide-react';
1
+ import { Bot, ChevronLeft, Copy, RefreshCw, Search, Server, ShieldCheck, UserPlus } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { useBusy } from '../components/busy.js';
4
4
  import { Callout } from '../components/callout.js';
@@ -10,8 +10,9 @@ import { Segmented } from '../components/settings-controls.js';
10
10
  import { WorkbenchToggle } from '../components/workbench-toggle.js';
11
11
  import { useNotices, useWebExtensions, useWorkbench } from '../hooks.js';
12
12
  import { useLanguage, useT } from '../i18n/use-t.js';
13
- import { LimitsForm, REFRESH_MS, SectionTitle, Stat, TrendCard, usePolled } from './console-parts.js';
13
+ import { LimitsForm, REFRESH_MS, SectionTitle, Stat, usePolled } from './console-parts.js';
14
14
  import { TenantDetail, TenantRow } from './console-tenant.js';
15
+ import { TrendCard } from './console-trend.js';
15
16
  import { ConsoleUtil } from './console-util.js';
16
17
  const FILTERS = [
17
18
  { value: 'all', label: 'ta.console.filterAll' },
@@ -32,6 +33,7 @@ const ACTIONS = {
32
33
  setSuspended: 'ta.console.auditSuspend',
33
34
  setDefaultLimits: 'ta.console.auditDefaults',
34
35
  setRole: 'ta.console.auditRole',
36
+ setEgressHosts: 'ta.console.auditEgress',
35
37
  allow: 'ta.console.auditAllow',
36
38
  dismiss: 'ta.console.auditDismiss',
37
39
  disallow: 'ta.console.auditDisallow',
@@ -145,6 +147,40 @@ function Audit() {
145
147
  entry.detail)),
146
148
  React.createElement("span", { className: "ta-console-activity-time" }, ConsoleUtil.ago(entry.at, language)))))));
147
149
  }
150
+ /** The hosts members' sandboxes may reach through the gateway, one a line; owners change them. */
151
+ function Egress({ info, onChanged }) {
152
+ const t = useT();
153
+ const [, bench] = useWorkbench();
154
+ const [, notices] = useNotices();
155
+ const { egress } = info.policy;
156
+ const owner = info.role === 'owner';
157
+ const saved = egress.hosts.join('\n');
158
+ const [draft, setDraft] = React.useState(saved);
159
+ const [busy, setBusy] = React.useState(false);
160
+ React.useEffect(() => setDraft(saved), [saved]);
161
+ if (!egress.enabled) {
162
+ return React.createElement("p", { className: "ta-list-hint" }, t('ta.console.egressOff'));
163
+ }
164
+ const save = () => {
165
+ setBusy(true);
166
+ void bench.gateway
167
+ .setEgressHosts(draft.split(/[\s,]+/).filter(Boolean))
168
+ .then(() => notices.notify(t('ta.console.saved'), { level: 'success' }))
169
+ .then(onChanged)
170
+ .catch(error => notices.error(error))
171
+ .finally(() => setBusy(false));
172
+ };
173
+ return (React.createElement(React.Fragment, null,
174
+ React.createElement("div", { className: "ta-console-card ta-console-egress" },
175
+ React.createElement("div", { className: "ta-console-limit-text" },
176
+ React.createElement("span", null, t('ta.console.egressHosts')),
177
+ React.createElement("span", { className: "ta-console-limit-hint" }, t('ta.console.egressHostsHint'))),
178
+ React.createElement("textarea", { className: "ta-input ta-console-hosts", rows: 4, value: draft, readOnly: !owner, spellCheck: false, placeholder: t('ta.console.egressHostsPlaceholder'), "aria-label": t('ta.console.egressHosts'), onChange: event => setDraft(event.target.value) }),
179
+ owner && (React.createElement("div", { className: "ta-console-actions ta-console-form-actions" },
180
+ React.createElement("button", { type: "button", className: "ta-button", disabled: draft === saved || busy, onClick: () => setDraft(saved) }, t('ta.console.reset')),
181
+ React.createElement("button", { type: "button", className: "ta-button ta-primary", disabled: draft === saved || busy, onClick: save }, busy ? React.createElement("span", { className: "ta-spinner" }) : t('ta.console.save'))))),
182
+ React.createElement("p", { className: "ta-list-hint" }, egress.networks.length > 0 ? t('ta.console.egressNetworks', { networks: egress.networks.join(', ') }) : t('ta.console.egressHint'))));
183
+ }
148
184
  function Policy({ info, onChanged }) {
149
185
  const t = useT();
150
186
  const [, bench] = useWorkbench();
@@ -153,11 +189,21 @@ function Policy({ info, onChanged }) {
153
189
  return (React.createElement(React.Fragment, null,
154
190
  React.createElement(SectionTitle, null, t('ta.console.defaults')),
155
191
  React.createElement("p", { className: "ta-list-hint" }, t(owner ? 'ta.console.defaultsHint' : 'ta.console.defaultsReadOnly')),
156
- React.createElement(LimitsForm, { value: info.policy.defaults, providers: info.providers, nullable: false, readOnly: !owner, onSave: limits => bench.gateway
192
+ React.createElement(LimitsForm, { value: info.policy.defaults, providers: info.providers, nullable: false, readOnly: !owner, metered: info.models.length > 0, onSave: limits => bench.gateway
157
193
  .setDefaultLimits(limits)
158
194
  .then(() => notices.notify(t('ta.console.saved'), { level: 'success' }))
159
195
  .then(onChanged)
160
196
  .catch(error => notices.error(error)) }),
197
+ React.createElement(SectionTitle, null, t('ta.console.models')),
198
+ info.models.length === 0 ? (React.createElement("p", { className: "ta-list-hint" }, t('ta.console.modelsNone'))) : (React.createElement(React.Fragment, null,
199
+ React.createElement(ListGroup, null, info.models.map(provider => (React.createElement("div", { key: provider.id, className: "ta-console-provider" },
200
+ React.createElement(Icon, { icon: Bot, size: 18, className: "ta-list-icon" }),
201
+ React.createElement("span", { className: "ta-console-tenant-text" },
202
+ React.createElement("span", { className: "ta-console-tenant-name ta-ellipsis" }, provider.name || provider.id),
203
+ React.createElement("span", { className: "ta-console-tenant-state" }, t('ta.console.modelsOf', { api: provider.api, count: provider.models }))))))),
204
+ React.createElement("p", { className: "ta-list-hint" }, t('ta.console.modelsHint')))),
205
+ React.createElement(SectionTitle, null, t('ta.console.egress')),
206
+ React.createElement(Egress, { info: info, onChanged: onChanged }),
161
207
  React.createElement(SectionTitle, null, t('ta.console.managers')),
162
208
  React.createElement("div", { className: "ta-list-group" }, info.policy.admins.map(admin => (React.createElement("div", { key: admin.account, className: "ta-console-audit" },
163
209
  React.createElement("span", { className: "ta-console-audit-text ta-ellipsis" },