@celljs/ta-web 4.27.0 → 4.28.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 (264) hide show
  1. package/esm/browser/assistant/assistant-role.d.ts +9 -4
  2. package/esm/browser/assistant/assistant-role.js +17 -5
  3. package/esm/browser/assistant/assistant-task-util.d.ts +6 -0
  4. package/esm/browser/assistant/assistant-task-util.js +12 -1
  5. package/esm/browser/assistant/assistant-view.js +4 -1
  6. package/esm/browser/assistant/assistant.d.ts +2 -1
  7. package/esm/browser/assistant/assistant.js +9 -7
  8. package/esm/browser/assistant/call-conversing.d.ts +45 -0
  9. package/esm/browser/assistant/call-conversing.js +91 -0
  10. package/esm/browser/assistant/call-face.d.ts +13 -0
  11. package/esm/browser/assistant/call-face.js +81 -0
  12. package/esm/browser/assistant/call-keeper.d.ts +8 -4
  13. package/esm/browser/assistant/call-keeper.js +32 -11
  14. package/esm/browser/assistant/call-partnering.d.ts +37 -0
  15. package/esm/browser/assistant/call-partnering.js +79 -0
  16. package/esm/browser/assistant/call-scenes.d.ts +25 -0
  17. package/esm/browser/assistant/call-scenes.js +82 -0
  18. package/esm/browser/assistant/call-screen.d.ts +3 -0
  19. package/esm/browser/assistant/call-screen.js +15 -0
  20. package/esm/browser/assistant/mic-sense.d.ts +31 -0
  21. package/esm/browser/assistant/mic-sense.js +119 -0
  22. package/esm/browser/assistant/noise-gate.d.ts +32 -0
  23. package/esm/browser/assistant/noise-gate.js +66 -0
  24. package/esm/browser/assistant/pcm-util.d.ts +10 -0
  25. package/esm/browser/assistant/pcm-util.js +55 -0
  26. package/esm/browser/assistant/read-aloud.d.ts +2 -1
  27. package/esm/browser/assistant/realtime-voice-protocol.d.ts +84 -0
  28. package/esm/browser/assistant/realtime-voice-protocol.js +40 -0
  29. package/esm/browser/assistant/realtime-voice.d.ts +50 -62
  30. package/esm/browser/assistant/realtime-voice.js +213 -134
  31. package/esm/browser/assistant/spoken-timeline.d.ts +27 -0
  32. package/esm/browser/assistant/spoken-timeline.js +49 -0
  33. package/esm/browser/assistant/voice-call-bar.d.ts +9 -2
  34. package/esm/browser/assistant/voice-call-bar.js +81 -31
  35. package/esm/browser/assistant/voice-call-protocol.d.ts +61 -4
  36. package/esm/browser/assistant/voice-call.d.ts +16 -23
  37. package/esm/browser/assistant/voice-call.js +134 -117
  38. package/esm/browser/assistant/voice-reading.d.ts +83 -0
  39. package/esm/browser/assistant/voice-reading.js +150 -0
  40. package/esm/browser/avatar/dino-talk.d.ts +15 -0
  41. package/esm/browser/avatar/dino-talk.js +34 -0
  42. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  43. package/esm/browser/components/conversation-scroll-util.d.ts +8 -1
  44. package/esm/browser/components/conversation-scroll-util.js +21 -0
  45. package/esm/browser/components/conversation-scroll.js +10 -11
  46. package/esm/browser/components/gallery.js +28 -7
  47. package/esm/browser/components/host-view.d.ts +1 -1
  48. package/esm/browser/components/image-pull.d.ts +64 -0
  49. package/esm/browser/components/image-pull.js +202 -0
  50. package/esm/browser/components/kept-call-bar.js +2 -1
  51. package/esm/browser/components/lightbox.d.ts +1 -1
  52. package/esm/browser/components/lightbox.js +57 -2
  53. package/esm/browser/components/markdown.d.ts +3 -1
  54. package/esm/browser/components/markdown.js +8 -4
  55. package/esm/browser/components/partner-row.js +2 -1
  56. package/esm/browser/components/relay-services.d.ts +9 -3
  57. package/esm/browser/components/relay-services.js +73 -35
  58. package/esm/browser/components/session-view.js +4 -2
  59. package/esm/browser/components/settings-parts.js +2 -0
  60. package/esm/browser/components/ta-avatar.d.ts +15 -1
  61. package/esm/browser/components/ta-avatar.js +38 -5
  62. package/esm/browser/components/voice-services.js +6 -1
  63. package/esm/browser/extension/web-api-call.d.ts +64 -2
  64. package/esm/browser/extension/web-api-contributions.d.ts +1 -0
  65. package/esm/browser/extension/web-api-partners.d.ts +2 -0
  66. package/esm/browser/extension/web-extension-api.d.ts +6 -6
  67. package/esm/browser/extension/web-extension-context.js +1 -0
  68. package/esm/browser/extension/web-extension-protocol.d.ts +3 -1
  69. package/esm/browser/extension/web-extension-run.d.ts +3 -2
  70. package/esm/browser/extension/web-extension-run.js +2 -0
  71. package/esm/browser/i18n/locales.d.ts +24 -5
  72. package/esm/browser/i18n/messages-ja.js +25 -6
  73. package/esm/browser/i18n/messages-zh-tw.js +25 -6
  74. package/esm/browser/i18n/messages.d.ts +23 -4
  75. package/esm/browser/i18n/messages.js +50 -12
  76. package/esm/browser/markdown/code-renderers.d.ts +2 -0
  77. package/esm/browser/markdown/code-renderers.js +2 -0
  78. package/esm/browser/screen/page-answers.d.ts +2 -1
  79. package/esm/browser/screen/page-answers.js +7 -4
  80. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  81. package/esm/browser/settings/settings-protocol.js +2 -0
  82. package/esm/browser/style/chat-list.d.ts +1 -1
  83. package/esm/browser/style/chat-list.js +1 -1
  84. package/esm/browser/style/conversation.d.ts +1 -1
  85. package/esm/browser/style/conversation.js +6 -1
  86. package/esm/browser/style/device.js +1 -0
  87. package/esm/browser/style/dialogs.d.ts +1 -1
  88. package/esm/browser/style/dialogs.js +1 -1
  89. package/esm/browser/style/layout.d.ts +1 -1
  90. package/esm/browser/style/layout.js +135 -57
  91. package/esm/browser/style/shell.d.ts +1 -1
  92. package/esm/browser/style/shell.js +8 -0
  93. package/esm/browser/style/video-call.d.ts +2 -0
  94. package/esm/browser/style/video-call.js +52 -0
  95. package/esm/browser/style.js +2 -0
  96. package/esm/browser/util/desktop.d.ts +10 -1
  97. package/esm/browser/util/desktop.js +10 -0
  98. package/esm/browser/util/image-pull.d.ts +61 -0
  99. package/esm/browser/util/image-pull.js +88 -0
  100. package/esm/browser/util/spoken.d.ts +3 -3
  101. package/esm/browser/util/spoken.js +4 -4
  102. package/esm/browser/video-call/call-camera.d.ts +59 -0
  103. package/esm/browser/video-call/call-camera.js +188 -0
  104. package/esm/browser/video-call/call-window.d.ts +19 -0
  105. package/esm/browser/video-call/call-window.js +80 -0
  106. package/esm/browser/video-call/clip-plan.d.ts +47 -0
  107. package/esm/browser/video-call/clip-plan.js +60 -0
  108. package/esm/browser/video-call/face-clips.d.ts +33 -0
  109. package/esm/browser/video-call/face-clips.js +93 -0
  110. package/esm/browser/video-call/face-files.d.ts +31 -0
  111. package/esm/browser/video-call/face-files.js +77 -0
  112. package/esm/browser/video-call/video-call-view.d.ts +19 -0
  113. package/esm/browser/video-call/video-call-view.js +214 -0
  114. package/esm/browser/video-call/video-face.d.ts +13 -0
  115. package/esm/browser/video-call/video-face.js +497 -0
  116. package/esm/browser/workbench-hosts.d.ts +1 -0
  117. package/esm/browser/workbench-protocol.d.ts +2 -0
  118. package/esm/browser/workbench-util.d.ts +5 -0
  119. package/esm/browser/workbench-util.js +18 -0
  120. package/esm/browser/workbench.d.ts +6 -0
  121. package/esm/browser/workbench.js +36 -5
  122. package/lib/browser/assistant/assistant-role.d.ts +9 -4
  123. package/lib/browser/assistant/assistant-role.js +17 -5
  124. package/lib/browser/assistant/assistant-task-util.d.ts +6 -0
  125. package/lib/browser/assistant/assistant-task-util.js +11 -0
  126. package/lib/browser/assistant/assistant-view.js +3 -0
  127. package/lib/browser/assistant/assistant.d.ts +2 -1
  128. package/lib/browser/assistant/assistant.js +9 -7
  129. package/lib/browser/assistant/call-conversing.d.ts +46 -0
  130. package/lib/browser/assistant/call-conversing.js +96 -0
  131. package/lib/browser/assistant/call-face.d.ts +14 -0
  132. package/lib/browser/assistant/call-face.js +117 -0
  133. package/lib/browser/assistant/call-keeper.d.ts +8 -4
  134. package/lib/browser/assistant/call-keeper.js +32 -11
  135. package/lib/browser/assistant/call-partnering.d.ts +38 -0
  136. package/lib/browser/assistant/call-partnering.js +83 -0
  137. package/lib/browser/assistant/call-scenes.d.ts +26 -0
  138. package/lib/browser/assistant/call-scenes.js +85 -0
  139. package/lib/browser/assistant/call-screen.d.ts +3 -0
  140. package/lib/browser/assistant/call-screen.js +15 -0
  141. package/lib/browser/assistant/mic-sense.d.ts +32 -0
  142. package/lib/browser/assistant/mic-sense.js +123 -0
  143. package/lib/browser/assistant/noise-gate.d.ts +33 -0
  144. package/lib/browser/assistant/noise-gate.js +71 -0
  145. package/lib/browser/assistant/pcm-util.d.ts +11 -0
  146. package/lib/browser/assistant/pcm-util.js +58 -0
  147. package/lib/browser/assistant/read-aloud.d.ts +2 -1
  148. package/lib/browser/assistant/realtime-voice-protocol.d.ts +85 -0
  149. package/lib/browser/assistant/realtime-voice-protocol.js +43 -0
  150. package/lib/browser/assistant/realtime-voice.d.ts +50 -62
  151. package/lib/browser/assistant/realtime-voice.js +217 -138
  152. package/lib/browser/assistant/spoken-timeline.d.ts +28 -0
  153. package/lib/browser/assistant/spoken-timeline.js +53 -0
  154. package/lib/browser/assistant/voice-call-bar.d.ts +9 -2
  155. package/lib/browser/assistant/voice-call-bar.js +81 -30
  156. package/lib/browser/assistant/voice-call-protocol.d.ts +61 -4
  157. package/lib/browser/assistant/voice-call.d.ts +16 -23
  158. package/lib/browser/assistant/voice-call.js +134 -117
  159. package/lib/browser/assistant/voice-reading.d.ts +84 -0
  160. package/lib/browser/assistant/voice-reading.js +156 -0
  161. package/lib/browser/avatar/dino-talk.d.ts +16 -0
  162. package/lib/browser/avatar/dino-talk.js +37 -0
  163. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  164. package/lib/browser/components/conversation-scroll-util.d.ts +8 -1
  165. package/lib/browser/components/conversation-scroll-util.js +21 -0
  166. package/lib/browser/components/conversation-scroll.js +10 -11
  167. package/lib/browser/components/gallery.js +28 -7
  168. package/lib/browser/components/host-view.d.ts +1 -1
  169. package/lib/browser/components/image-pull.d.ts +65 -0
  170. package/lib/browser/components/image-pull.js +206 -0
  171. package/lib/browser/components/kept-call-bar.js +2 -1
  172. package/lib/browser/components/lightbox.d.ts +1 -1
  173. package/lib/browser/components/lightbox.js +57 -2
  174. package/lib/browser/components/markdown.d.ts +3 -1
  175. package/lib/browser/components/markdown.js +7 -3
  176. package/lib/browser/components/partner-row.js +2 -1
  177. package/lib/browser/components/relay-services.d.ts +9 -3
  178. package/lib/browser/components/relay-services.js +71 -33
  179. package/lib/browser/components/session-view.js +3 -1
  180. package/lib/browser/components/settings-parts.js +2 -0
  181. package/lib/browser/components/ta-avatar.d.ts +15 -1
  182. package/lib/browser/components/ta-avatar.js +38 -5
  183. package/lib/browser/components/voice-services.js +5 -0
  184. package/lib/browser/extension/web-api-call.d.ts +64 -2
  185. package/lib/browser/extension/web-api-contributions.d.ts +1 -0
  186. package/lib/browser/extension/web-api-partners.d.ts +2 -0
  187. package/lib/browser/extension/web-extension-api.d.ts +6 -6
  188. package/lib/browser/extension/web-extension-context.js +1 -0
  189. package/lib/browser/extension/web-extension-protocol.d.ts +3 -1
  190. package/lib/browser/extension/web-extension-run.d.ts +3 -2
  191. package/lib/browser/extension/web-extension-run.js +2 -0
  192. package/lib/browser/i18n/locales.d.ts +24 -5
  193. package/lib/browser/i18n/messages-ja.js +25 -6
  194. package/lib/browser/i18n/messages-zh-tw.js +25 -6
  195. package/lib/browser/i18n/messages.d.ts +23 -4
  196. package/lib/browser/i18n/messages.js +50 -12
  197. package/lib/browser/markdown/code-renderers.d.ts +2 -0
  198. package/lib/browser/markdown/code-renderers.js +3 -1
  199. package/lib/browser/screen/page-answers.d.ts +2 -1
  200. package/lib/browser/screen/page-answers.js +7 -4
  201. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  202. package/lib/browser/settings/settings-protocol.js +2 -0
  203. package/lib/browser/style/chat-list.d.ts +1 -1
  204. package/lib/browser/style/chat-list.js +1 -1
  205. package/lib/browser/style/conversation.d.ts +1 -1
  206. package/lib/browser/style/conversation.js +6 -1
  207. package/lib/browser/style/device.js +1 -0
  208. package/lib/browser/style/dialogs.d.ts +1 -1
  209. package/lib/browser/style/dialogs.js +1 -1
  210. package/lib/browser/style/layout.d.ts +1 -1
  211. package/lib/browser/style/layout.js +135 -57
  212. package/lib/browser/style/shell.d.ts +1 -1
  213. package/lib/browser/style/shell.js +8 -0
  214. package/lib/browser/style/video-call.d.ts +3 -0
  215. package/lib/browser/style/video-call.js +55 -0
  216. package/lib/browser/style.js +2 -0
  217. package/lib/browser/util/desktop.d.ts +10 -1
  218. package/lib/browser/util/desktop.js +10 -0
  219. package/lib/browser/util/image-pull.d.ts +62 -0
  220. package/lib/browser/util/image-pull.js +91 -0
  221. package/lib/browser/util/spoken.d.ts +3 -3
  222. package/lib/browser/util/spoken.js +4 -4
  223. package/lib/browser/video-call/call-camera.d.ts +60 -0
  224. package/lib/browser/video-call/call-camera.js +192 -0
  225. package/lib/browser/video-call/call-window.d.ts +20 -0
  226. package/lib/browser/video-call/call-window.js +83 -0
  227. package/lib/browser/video-call/clip-plan.d.ts +48 -0
  228. package/lib/browser/video-call/clip-plan.js +64 -0
  229. package/lib/browser/video-call/face-clips.d.ts +34 -0
  230. package/lib/browser/video-call/face-clips.js +96 -0
  231. package/lib/browser/video-call/face-files.d.ts +32 -0
  232. package/lib/browser/video-call/face-files.js +82 -0
  233. package/lib/browser/video-call/video-call-view.d.ts +20 -0
  234. package/lib/browser/video-call/video-call-view.js +250 -0
  235. package/lib/browser/video-call/video-face.d.ts +14 -0
  236. package/lib/browser/video-call/video-face.js +533 -0
  237. package/lib/browser/workbench-hosts.d.ts +1 -0
  238. package/lib/browser/workbench-protocol.d.ts +2 -0
  239. package/lib/browser/workbench-util.d.ts +5 -0
  240. package/lib/browser/workbench-util.js +18 -0
  241. package/lib/browser/workbench.d.ts +6 -0
  242. package/lib/browser/workbench.js +35 -4
  243. package/package.json +7 -7
  244. package/public/faces/README.md +27 -0
  245. package/public/faces/clap.mp4 +0 -0
  246. package/public/faces/dance.mp4 +0 -0
  247. package/public/faces/happy.mp4 +0 -0
  248. package/public/faces/heart.mp4 +0 -0
  249. package/public/faces/idle-1.mp4 +0 -0
  250. package/public/faces/idle-2.mp4 +0 -0
  251. package/public/faces/idle-3.mp4 +0 -0
  252. package/public/faces/laugh.mp4 +0 -0
  253. package/public/faces/lips.json +1 -0
  254. package/public/faces/listening.mp4 +0 -0
  255. package/public/faces/poster.jpg +0 -0
  256. package/public/faces/shy.mp4 +0 -0
  257. package/public/faces/sorry.mp4 +0 -0
  258. package/public/faces/stretch.mp4 +0 -0
  259. package/public/faces/surprised.mp4 +0 -0
  260. package/public/faces/talk-1.mp4 +0 -0
  261. package/public/faces/talk-2.mp4 +0 -0
  262. package/public/faces/think-2.mp4 +0 -0
  263. package/public/faces/thinking.mp4 +0 -0
  264. package/public/faces/wave.mp4 +0 -0
@@ -3,24 +3,60 @@ import * as React from 'react';
3
3
  import { useBackLayer } from '../device/back-stack.js';
4
4
  import { useT } from '../i18n/use-t.js';
5
5
  import { Icon } from './icon.js';
6
+ import { ImagePull } from './image-pull.js';
6
7
  import { ImageViewer } from './image-viewer.js';
7
8
  /**
8
9
  * An image over the page, to look at closely (ImageViewer): pinched, zoomed, dragged, and with `onPrevious` /
9
10
  * `onNext` the images beside it, by its side buttons, ← → and a finger that swipes it (`previousSrc` / `nextSrc`
10
11
  * in sight as it does, as the viewers of pictures of a phone). A click or tap beside it,
11
- * its close button or Escape closes it. In the top layer, so no container clips it; the touches in it are its
12
+ * its close button, Escape, back or a finger that pulls it down closes it, shrinking back onto its thumbnail (ImagePull). In the top layer, so no container clips it; the touches in it are its
12
13
  * own, never a swipe of a sheet under it.
13
14
  */
14
15
  export function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext, previousSrc, nextSrc, }) {
15
16
  const t = useT();
16
17
  const dialog = React.useRef(null);
18
+ /** What opened it (the thumbnail tapped): the picture goes back there first, of those that show the same. */
19
+ const opener = React.useRef(null);
17
20
  React.useEffect(() => {
18
21
  var _a, _b;
22
+ opener.current = document.activeElement;
19
23
  (_b = (_a = dialog.current) === null || _a === void 0 ? void 0 : _a.showModal) === null || _b === void 0 ? void 0 : _b.call(_a);
20
24
  }, []);
21
- const close = () => { var _a; return (_a = dialog.current) === null || _a === void 0 ? void 0 : _a.close(); };
25
+ const pull = React.useRef(undefined);
26
+ // It shrinks back onto its thumbnail, then closes.
27
+ const close = () => { var _a; return (pull.current ? pull.current.leave() : (_a = dialog.current) === null || _a === void 0 ? void 0 : _a.close()); };
22
28
  useBackLayer(true, close);
29
+ const shade = React.useRef(null);
30
+ const shown = React.useRef(src);
31
+ shown.current = src;
32
+ React.useEffect(() => {
33
+ const box = dialog.current;
34
+ const viewport = box === null || box === void 0 ? void 0 : box.querySelector('.ta-zoom-viewport');
35
+ const image = viewport === null || viewport === void 0 ? void 0 : viewport.querySelector('img');
36
+ if (!box || !viewport || !image || !shade.current) {
37
+ return;
38
+ }
39
+ const controller = new ImagePull(viewport, image, shade.current, {
40
+ origin: () => LightboxUtil.thumbnail(shown.current, box, opener.current),
41
+ pulling: pulling => box.toggleAttribute('data-pulling', pulling),
42
+ close: () => box.close(),
43
+ });
44
+ pull.current = controller;
45
+ // Escape shrinks it back too.
46
+ const onCancel = (event) => {
47
+ event.preventDefault();
48
+ controller.leave();
49
+ };
50
+ box.addEventListener('cancel', onCancel);
51
+ const detach = controller.attach();
52
+ return () => {
53
+ box.removeEventListener('cancel', onCancel);
54
+ detach();
55
+ pull.current = undefined;
56
+ };
57
+ }, []);
23
58
  return (React.createElement("dialog", { ref: dialog, className: "ta-lightbox", onClose: onClose, onTouchStart: event => event.stopPropagation() },
59
+ React.createElement("div", { ref: shade, className: "ta-lightbox-shade" }),
24
60
  React.createElement(ImageViewer, { src: src, alt: alt, onBackground: close, onPrevious: onPrevious, onNext: onNext, previousSrc: previousSrc, nextSrc: nextSrc, autoFocus: true }),
25
61
  (caption || count) && (React.createElement("div", { className: "ta-lightbox-caption" },
26
62
  caption && React.createElement("span", { className: "ta-lightbox-words" }, caption),
@@ -28,4 +64,23 @@ export function Lightbox({ src, alt, caption, count, onClose, onPrevious, onNext
28
64
  React.createElement("button", { type: "button", className: "ta-lightbox-close", title: t('ta.close'), "aria-label": t('ta.close'), onClick: close },
29
65
  React.createElement(Icon, { icon: X, size: 18 }))));
30
66
  }
67
+ var LightboxUtil;
68
+ (function (LightboxUtil) {
69
+ /** The picture `src` small on the page, in sight (the thumbnail it was opened from, in `opener` first), out of `lightbox`. */
70
+ function thumbnail(src, lightbox, opener) {
71
+ var _a;
72
+ const url = new URL(src, location.href).href;
73
+ for (const image of [...((_a = opener === null || opener === void 0 ? void 0 : opener.querySelectorAll('img')) !== null && _a !== void 0 ? _a : []), ...document.images]) {
74
+ if (lightbox.contains(image) || (image.currentSrc || image.src) !== url) {
75
+ continue;
76
+ }
77
+ const rect = image.getBoundingClientRect();
78
+ if (rect.width > 0 && rect.height > 0 && rect.bottom > 0 && rect.top < window.innerHeight && rect.right > 0 && rect.left < window.innerWidth) {
79
+ return image;
80
+ }
81
+ }
82
+ return undefined;
83
+ }
84
+ LightboxUtil.thumbnail = thumbnail;
85
+ })(LightboxUtil || (LightboxUtil = {}));
31
86
  //# sourceMappingURL=lightbox.js.map
@@ -6,8 +6,10 @@ export declare function CodeBlock({ code }: {
6
6
  /**
7
7
  * Markdown as React elements; drawn again only when its text changes, and then only the blocks that did.
8
8
  * `streaming`: the text is a reply still coming, which shows nothing that is about to turn into something else.
9
+ * `inline`: a short text in a line (an option, an answer, a label), its marks and formulas drawn without blocks.
9
10
  */
10
- export declare function Markdown({ text, streaming }: {
11
+ export declare function Markdown({ text, streaming, inline }: {
11
12
  text: string;
12
13
  streaming?: boolean;
14
+ inline?: boolean;
13
15
  }): React.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { Check, Copy } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { useT } from '../i18n/use-t.js';
4
- import { CodeAnswer, CodeRenderers, CodeReply } from '../markdown/code-renderers.js';
4
+ import { CodeAnswer, CodeEmbedded, CodeRenderers, CodeReply } from '../markdown/code-renderers.js';
5
5
  import { MermaidUtil } from '../markdown/mermaid.js';
6
6
  import { GalleryUtil } from '../util/gallery.js';
7
7
  import { MarkdownUtil } from '../util/markdown.js';
@@ -81,6 +81,7 @@ function CodeView({ language, code, closed }) {
81
81
  const Renderer = React.useContext(CodeRenderers)[language.trim().toLowerCase()];
82
82
  const send = React.useContext(CodeReply);
83
83
  const answer = React.useContext(CodeAnswer);
84
+ const embedded = React.useContext(CodeEmbedded);
84
85
  // What a reply holds for the ear alone (SpokenReply) is heard, not shown.
85
86
  if (language.trim().toLowerCase() === SpokenReply.LANGUAGE) {
86
87
  return null;
@@ -88,7 +89,8 @@ function CodeView({ language, code, closed }) {
88
89
  const plain = React.createElement(CodeBlock, { code: code, language: language });
89
90
  if (Renderer) {
90
91
  return (React.createElement(CodeBoundary, { retry: closed, fallback: plain },
91
- React.createElement(Renderer, { code: code, language: language, closed: closed, send: send, answer: answer })));
92
+ React.createElement(CodeEmbedded.Provider, { value: true }, embedded ? (React.createElement("div", { className: "ta-code-embedded" },
93
+ React.createElement(Renderer, { code: code, language: language, closed: closed, send: send, answer: answer, embedded: true }))) : (React.createElement(Renderer, { code: code, language: language, closed: closed, send: send, answer: answer })))));
92
94
  }
93
95
  if (MermaidUtil.isDiagram(language, code)) {
94
96
  return React.createElement(MermaidView, { code: code, fallback: plain });
@@ -150,8 +152,10 @@ const MarkdownBody = React.memo(function MarkdownBody({ text, streaming }) {
150
152
  /**
151
153
  * Markdown as React elements; drawn again only when its text changes, and then only the blocks that did.
152
154
  * `streaming`: the text is a reply still coming, which shows nothing that is about to turn into something else.
155
+ * `inline`: a short text in a line (an option, an answer, a label), its marks and formulas drawn without blocks.
153
156
  */
154
- export function Markdown({ text, streaming = false }) {
155
- return React.createElement(MarkdownBody, { text: text, streaming: streaming });
157
+ export function Markdown({ text, streaming = false, inline = false }) {
158
+ return inline ? (React.createElement("span", { className: "ta-markdown ta-markdown-inline" },
159
+ React.createElement(Text, { text: text }))) : (React.createElement(MarkdownBody, { text: text, streaming: streaming }));
156
160
  }
157
161
  //# sourceMappingURL=markdown.js.map
@@ -17,6 +17,7 @@ import { SwipeRow } from './swipe-row.js';
17
17
  */
18
18
  export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
19
19
  var _a, _b;
20
+ var _c;
20
21
  const t = useT();
21
22
  const [menu, openMenu] = useContextMenu();
22
23
  const [opening, setOpening] = React.useState(false);
@@ -55,6 +56,6 @@ export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
55
56
  React.createElement(Own, { size: 38 }))) : (React.createElement("span", { className: "ta-chat-avatar ta-chat-icon", style: { background: `var(--ta-tint-${partner.tone})`, color: `var(--ta-tint-ink-${partner.tone})`, width: 38, height: 38 }, "aria-hidden": "true" }, opening ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Glyph, { size: 18, strokeWidth: 1.8 }))),
56
57
  partner.online && React.createElement("span", { className: "ta-partner-online", "aria-hidden": "true" }),
57
58
  React.createElement(ChatDot, { unseen: unseen, asks: asks })),
58
- React.createElement(RowText, { title: partner.name, time: time, line: PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(HostTag, { location: partner.location }) : undefined, badge: partner.friends ? t('ta.partners.withFriends') : undefined }))));
59
+ React.createElement(RowText, { title: partner.name, time: time, line: PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(HostTag, { location: partner.location }) : undefined, badge: (_c = partner.label) !== null && _c !== void 0 ? _c : (partner.friends ? t('ta.partners.withFriends') : undefined) }))));
59
60
  }
60
61
  //# sourceMappingURL=partner-row.js.map
@@ -1,4 +1,4 @@
1
- import type { TaJoinedDeployment, TaRelayFeature, TaRelayProbe, TaRelayService, TaRelayTypeInfo } from '@celljs/ta-protocol';
1
+ import type { TaJoinedDeployment, TaRelayFeature, TaRelayProbe, TaRelayService, TaRelays, TaRelayTypeInfo } from '@celljs/ta-protocol';
2
2
  import { type LucideIcon } from 'lucide-react';
3
3
  import * as React from 'react';
4
4
  import { useT } from '../i18n/use-t.js';
@@ -11,14 +11,20 @@ export declare namespace RelayServicesUtil {
11
11
  function serves(service: TaRelayService, feature: TaRelayFeature): boolean;
12
12
  /** The icon of a service: the official relay, a relay, a folder, a store by the icon its package gave its type. */
13
13
  function icon(service: TaRelayService, types?: readonly TaRelayTypeInfo[]): LucideIcon;
14
+ /** The ways of the phones, in order: as the computer lists them, else the relay of `devices` alone. */
15
+ function routes(relays: TaRelays): string[];
16
+ /** The ways of the phones as relays.json keeps them: `direct` first while it is on. */
17
+ function withDirect(relays: TaRelays, ids: readonly string[], on?: boolean): string[];
18
+ /** The ways with the one at `index` tried one earlier. */
19
+ function earlier(routes: readonly string[], index: number): string[];
14
20
  /** What a deployment is called: its name, else the host of the address it was joined by. */
15
21
  function deploymentName(deployment: TaJoinedDeployment): string;
16
22
  function host(url: string): string;
17
23
  /** A name for the cloud workspace of a deployment's gateway (ta://<name>): its first label, as TaLocation takes it. */
18
24
  function cloudName(gateway: string): string;
19
25
  function iconNamed(name: string | undefined): LucideIcon;
20
- /** What a relay shows under its name: where it is, whether it answers, what it keeps. */
21
- function line(service: TaRelayService, probe: TaRelayProbe | undefined, t: ReturnType<typeof useT>): string;
26
+ /** Where a relay is and whether it answers, short enough for a phone beside its controls. */
27
+ function brief(service: TaRelayService, probe: TaRelayProbe | undefined, t: ReturnType<typeof useT>): string;
22
28
  }
23
29
  /**
24
30
  * The relays of relays.json (docs/design/ta-relays.md) and which one each feature uses: phones that reach this
@@ -1,12 +1,17 @@
1
- import { Building2, Cloud, Database, ExternalLink, FileJson, Folder, GitBranch, HardDrive, Plus, RefreshCw, Server, ShieldCheck, Trash2, } from 'lucide-react';
1
+ import { ArrowUp, Building2, Cloud, Database, ExternalLink, FileJson, Folder, GitBranch, HardDrive, Plus, RefreshCw, Server, ShieldCheck, Trash2, Zap, } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { useNotices, useWorkbench } from '../hooks.js';
4
4
  import { useT } from '../i18n/use-t.js';
5
5
  import { Icon, IconButton } from './icon.js';
6
6
  import { AddCloudHost } from './remote-hosts.js';
7
- import { Row } from './settings-controls.js';
8
- /** The features that go through a relay, in the order the settings list them; where sync goes is chosen in its own settings (ta-sync). */
9
- const FEATURES = ['devices', 'share', 'rooms'];
7
+ import { Row, Switch } from './settings-controls.js';
8
+ /** In `use.devices`, the direct connection of a phone to this computer (DIRECT_ROUTE of ta-relay). */
9
+ const DIRECT = 'direct';
10
+ /**
11
+ * The features that go through one relay, in the order the settings list them, after the ways of the phones
12
+ * (DeviceRoutes); where sync goes is chosen in its own settings (ta-sync).
13
+ */
14
+ const FEATURES = ['share', 'rooms'];
10
15
  export var RelayServicesUtil;
11
16
  (function (RelayServicesUtil) {
12
17
  /** What a service is called: the official relay, its name, else its host or its folder. */
@@ -46,6 +51,30 @@ export var RelayServicesUtil;
46
51
  return iconNamed((_a = types.find(each => each.type === service.type)) === null || _a === void 0 ? void 0 : _a.icon);
47
52
  }
48
53
  RelayServicesUtil.icon = icon;
54
+ /** The ways of the phones, in order: as the computer lists them, else the relay of `devices` alone. */
55
+ function routes(relays) {
56
+ var _a;
57
+ const listed = ((_a = relays.routes) === null || _a === void 0 ? void 0 : _a.length) ? relays.routes : [relays.use.devices];
58
+ return listed.filter(id => relays.relays.some(relay => relay.id === id && relay.type === 'ta-relay'));
59
+ }
60
+ RelayServicesUtil.routes = routes;
61
+ /** The ways of the phones as relays.json keeps them: `direct` first while it is on. */
62
+ function withDirect(relays, ids, on) {
63
+ var _a;
64
+ var _b;
65
+ if (on === void 0) { on = (_b = (_a = relays.direct) === null || _a === void 0 ? void 0 : _a.on) !== null && _b !== void 0 ? _b : false; }
66
+ return [...(on ? [DIRECT] : []), ...ids.filter(id => id !== DIRECT)];
67
+ }
68
+ RelayServicesUtil.withDirect = withDirect;
69
+ /** The ways with the one at `index` tried one earlier. */
70
+ function earlier(routes, index) {
71
+ const next = [...routes];
72
+ if (index > 0 && index < next.length) {
73
+ [next[index - 1], next[index]] = [next[index], next[index - 1]];
74
+ }
75
+ return next;
76
+ }
77
+ RelayServicesUtil.earlier = earlier;
49
78
  /** What a deployment is called: its name, else the host of the address it was joined by. */
50
79
  function deploymentName(deployment) {
51
80
  var _a;
@@ -75,38 +104,20 @@ export var RelayServicesUtil;
75
104
  return name === 'Database' ? Database : name === 'GitBranch' ? GitBranch : name === 'HardDrive' ? HardDrive : name === 'Server' ? Server : Cloud;
76
105
  }
77
106
  RelayServicesUtil.iconNamed = iconNamed;
78
- /** What a relay shows under its name: where it is, whether it answers, what it keeps. */
79
- function line(service, probe, t) {
80
- var _a, _b;
107
+ /** Where a relay is and whether it answers, short enough for a phone beside its controls. */
108
+ function brief(service, probe, t) {
81
109
  const host = where(service);
82
- if (service.type === 'folder') {
83
- return probe && !probe.online ? `${host} · ${(_a = probe.error) !== null && _a !== void 0 ? _a : t('ta.relays.offline')}` : `${host} · ${t('ta.relays.folderOnly')}`;
84
- }
85
- if (service.type !== 'ta-relay') {
86
- if (service.unavailable) {
87
- return `${service.type} · ${t('ta.relays.unavailable')}`;
88
- }
89
- if (probe && !probe.online) {
90
- return `${host} · ${(_b = probe.error) !== null && _b !== void 0 ? _b : t('ta.relays.offline')}`;
91
- }
92
- return [host, (probe === null || probe === void 0 ? void 0 : probe.ms) !== undefined ? t('ta.relays.online', { ms: probe.ms }) : undefined, t('ta.relays.storeOnly')].filter(Boolean).join(' · ');
93
- }
94
110
  if (!probe) {
95
111
  return host;
96
112
  }
97
113
  if (!probe.online) {
98
114
  return `${host} · ${t('ta.relays.offline')}`;
99
115
  }
100
- const parts = [host, probe.ms !== undefined ? t('ta.relays.online', { ms: probe.ms }) : t('ta.relays.onlineNoTime')];
101
- if (probe.persistent === false) {
102
- parts.push(t('ta.relays.memory'));
103
- }
104
- if (probe.limits && !probe.legacy) {
105
- parts.push(t('ta.relays.limits', { members: probe.limits.hubMembers, state: Math.round(probe.limits.hubStateBytes / 1024 / 1024) }));
106
- }
107
- return parts.join(' · ');
116
+ const answers = probe.ms !== undefined ? t('ta.relays.online', { ms: probe.ms }) : t('ta.relays.onlineNoTime');
117
+ // A relay that keeps group chats in memory loses them when it restarts: worth saying.
118
+ return [host, answers, probe.persistent === false ? t('ta.relays.memory') : undefined].filter(Boolean).join(' · ');
108
119
  }
109
- RelayServicesUtil.line = line;
120
+ RelayServicesUtil.brief = brief;
110
121
  })(RelayServicesUtil || (RelayServicesUtil = {}));
111
122
  /**
112
123
  * The relays of relays.json (docs/design/ta-relays.md) and which one each feature uses: phones that reach this
@@ -166,10 +177,7 @@ export function RelayServices() {
166
177
  if (!relays) {
167
178
  return null;
168
179
  }
169
- const used = new Set(Object.values(relays.use));
170
- const types = (_a = relays.types) !== null && _a !== void 0 ? _a : [];
171
- // Folders and stores are places of sync, chosen and removed there.
172
- const shown = relays.relays.filter(relay => relay.type === 'ta-relay');
180
+ const used = new Set([...Object.values(relays.use), ...((_a = relays.routes) !== null && _a !== void 0 ? _a : [])]);
173
181
  return (React.createElement(React.Fragment, null,
174
182
  React.createElement(Deployment, { relays: relays, changed: listed => {
175
183
  var _a;
@@ -184,9 +192,9 @@ export function RelayServices() {
184
192
  React.createElement("select", { className: "ta-input ta-select", "aria-label": t(`ta.relays.feature.${feature}`), disabled: busy !== undefined, value: (_a = relays.use[feature]) !== null && _a !== void 0 ? _a : '', onChange: event => void run(feature, async () => setRelays(await bench.relay.chooseRelay(feature, event.target.value || null))) }, relays.relays
185
193
  .filter(relay => RelayServicesUtil.serves(relay, feature) || relays.use[feature] === relay.id)
186
194
  .map(relay => (React.createElement("option", { key: relay.id, value: relay.id }, RelayServicesUtil.label(relay, t))))))); }),
187
- shown.map(relay => { var _a; return (React.createElement(Row, { key: relay.id, icon: RelayServicesUtil.icon(relay, types), label: RelayServicesUtil.label(relay, t), description: React.createElement("span", { className: "ta-remote-state" },
188
- React.createElement("span", { className: `ta-remote-light${((_a = probes[relay.id]) === null || _a === void 0 ? void 0 : _a.online) ? ' ta-on' : ''}` }),
189
- RelayServicesUtil.line(relay, probes[relay.id], t)) }, !relay.builtin && relay.id !== 'relay-json' && !used.has(relay.id) && (React.createElement(IconButton, { icon: Trash2, label: t('ta.relays.remove', { name: RelayServicesUtil.label(relay, t) }), disabled: busy !== undefined, onClick: () => void run(relay.id, () => bench.relay.removeRelay(relay.id)) })))); }),
195
+ React.createElement(DeviceRoutes, { relays: relays, probes: probes, busy: busy !== undefined, chooseWays: ids => void run('devices', async () => setRelays(await bench.relay.chooseRelay('devices', ids))), choose: ids => void run('devices', async () => setRelays(await bench.relay.chooseRelay('devices', RelayServicesUtil.withDirect(relays, ids)))), remove: relay => !relay.builtin && relay.id !== 'relay-json' && !used.has(relay.id)
196
+ ? () => void run(relay.id, () => bench.relay.removeRelay(relay.id))
197
+ : undefined }),
190
198
  React.createElement(Row, { label: t('ta.relays.add'), description: t('ta.relays.addHint'), stacked: true },
191
199
  React.createElement("form", { className: "ta-trusted-add", onSubmit: event => {
192
200
  event.preventDefault();
@@ -200,6 +208,36 @@ export function RelayServices() {
200
208
  React.createElement(Row, { icon: RefreshCw, label: t('ta.relays.syncElsewhere'), description: t('ta.relays.syncElsewhereHint') }),
201
209
  React.createElement(Row, { icon: FileJson, label: t('ta.relays.file'), description: React.createElement("span", { className: "ta-path" }, relays.file) })));
202
210
  }
211
+ /**
212
+ * The relays, as the ways of the phones to this computer (docs/design/ta-relays.md 12): each relay a row with whether it
213
+ * answers, on or off for phones and moved earlier by its arrow, the phones trying them in that order and keeping the first
214
+ * that connects; one stays on. A relay nothing uses can be removed. Folders and stores are places of sync, listed there.
215
+ */
216
+ function DeviceRoutes({ relays, probes, busy, choose, chooseWays, remove, }) {
217
+ const t = useT();
218
+ const routes = RelayServicesUtil.routes(relays);
219
+ const all = relays.relays.filter(relay => relay.type === 'ta-relay');
220
+ const ordered = [...routes.flatMap(id => all.filter(relay => relay.id === id)), ...all.filter(relay => !routes.includes(relay.id))];
221
+ return (React.createElement(React.Fragment, null,
222
+ React.createElement(Row, { label: t('ta.relays.feature.devices'), description: t('ta.relays.feature.devicesHint') }),
223
+ relays.direct && (React.createElement(Row, { icon: Zap, label: t('ta.relays.direct'), description: relays.direct.available ? t('ta.relays.directHint') : t('ta.relays.directUnavailable') },
224
+ React.createElement(Switch, { checked: relays.direct.on && relays.direct.available, label: t('ta.relays.direct'), disabled: busy || !relays.direct.available, onChange: on => chooseWays(RelayServicesUtil.withDirect(relays, routes, on)) }))),
225
+ ordered.map(relay => {
226
+ var _a;
227
+ const at = routes.indexOf(relay.id);
228
+ const name = RelayServicesUtil.label(relay, t);
229
+ const removing = remove(relay);
230
+ return (React.createElement(Row, { key: relay.id, icon: RelayServicesUtil.icon(relay, relays.types), label: name, description: React.createElement("span", { className: "ta-remote-state" },
231
+ React.createElement("span", { className: `ta-remote-light${((_a = probes[relay.id]) === null || _a === void 0 ? void 0 : _a.online) ? ' ta-on' : ''}` }),
232
+ [
233
+ at >= 0 ? t('ta.relays.routeAt', { n: at + 1 }) : t('ta.relays.routeOff'),
234
+ RelayServicesUtil.brief(relay, probes[relay.id], t),
235
+ ].join(' · ')) },
236
+ removing && React.createElement(IconButton, { icon: Trash2, label: t('ta.relays.remove', { name }), disabled: busy, onClick: removing }),
237
+ at > 0 && (React.createElement(IconButton, { icon: ArrowUp, label: t('ta.relays.routeUp', { name }), disabled: busy, onClick: () => choose(RelayServicesUtil.earlier(routes, at)) })),
238
+ React.createElement(Switch, { checked: at >= 0, label: t('ta.relays.routeUse', { name }), disabled: busy || (at >= 0 && routes.length === 1), onChange: on => choose(on ? [...routes, relay.id] : routes.filter(id => id !== relay.id)) })));
239
+ })));
240
+ }
203
241
  /**
204
242
  * A deployment of Ta, inside a company or outside it (docs/design/ta-deploy.md 8): joined by the address of any of its
205
243
  * services, its relay is the default of what is new, and its gateway gives a Ta in the cloud to open, or its sandbox as a
@@ -2,7 +2,8 @@ import { useInject } from '@celljs/react';
2
2
  import { TA_OWNER } from '@celljs/ta-protocol';
3
3
  import { ArrowDown, TextSearch } from 'lucide-react';
4
4
  import * as React from 'react';
5
- import { CallBar, callAction, callEndedNotice, dialogAnnouncements, talkCall, useCallAnnouncements, useCallTurns, useTalkCalls, useVoiceCall, } from '../assistant/voice-call-bar.js';
5
+ import { CallFace } from '../assistant/call-face.js';
6
+ import { CallBar, callAction, callEndedNotice, dialogAnnouncements, talkCall, useCallAnnouncements, useCallTurns, useTalkCalls, useVoiceCall, videoCallAction, } from '../assistant/voice-call-bar.js';
6
7
  import { useKeyboardDismiss } from '../device/device.js';
7
8
  import { DraftPlaces } from '../drafts/drafts-protocol.js';
8
9
  import { TaFiles } from '../files/files-protocol.js';
@@ -322,7 +323,7 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
322
323
  disabled: nothingSaid,
323
324
  run: () => setFinding(count => count + 1),
324
325
  },
325
- ...(callable ? [callAction(callState, call, t)] : []),
326
+ ...(callable ? [callAction(callState, call, t), videoCallAction(callState, call, t)] : []),
326
327
  ],
327
328
  ...addons.actions,
328
329
  ], [actions, addons.actions, t, nothingSaid, callable, callState, call]);
@@ -344,6 +345,7 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
344
345
  info && (React.createElement("span", { className: "ta-muted ta-path", title: info.cwd }, MessageUtil.shortPath(info.cwd)))),
345
346
  React.createElement(PeopleFaces, { people: viewing, size: 24, label: t('ta.presence.viewing') }),
346
347
  trailing)),
348
+ React.createElement(CallFace, { state: callState, call: call }),
347
349
  finding > 0 && React.createElement(ConversationFind, { store: store, state: state, rows: rows, scroller: scroller, focusKey: finding, onClose: closeFind }),
348
350
  React.createElement("div", { className: "ta-scroll ta-conversation", ref: scroller },
349
351
  React.createElement("div", { className: "ta-thread" },
@@ -127,6 +127,8 @@ export function useParts(scope, onScope, onClose, onDialog) {
127
127
  React.createElement(Switch, { label: t('ta.settings.speakTalk'), checked: settings.speakTalk, onChange: speakTalk => store.update({ speakTalk }) }))),
128
128
  row('callCaptions', [t('ta.settings.callCaptions'), t('ta.settings.callCaptionsHint')], React.createElement(Row, { label: t('ta.settings.callCaptions'), description: t('ta.settings.callCaptionsHint') },
129
129
  React.createElement(Switch, { label: t('ta.settings.callCaptions'), checked: settings.callCaptions, onChange: callCaptions => store.update({ callCaptions }) }))),
130
+ row('callFace', [t('ta.settings.callFace'), t('ta.settings.callFaceHint')], React.createElement(Row, { label: t('ta.settings.callFace'), description: t('ta.settings.callFaceHint') },
131
+ React.createElement(Switch, { label: t('ta.settings.callFace'), checked: settings.callFace, onChange: callFace => store.update({ callFace }) }))),
130
132
  ...(Voice.canSpeak()
131
133
  ? [
132
134
  row('voiceName', [t('ta.settings.voiceName'), t('ta.settings.voiceNameHint')], React.createElement(Row, { label: t('ta.settings.voiceName'), description: t('ta.settings.voiceNameHint'), stacked: true },
@@ -2,6 +2,16 @@ import * as React from 'react';
2
2
  import { type Mood } from '../avatar/dino-avatar.js';
3
3
  import { type Gait } from '../avatar/dino-motion.js';
4
4
  import { type SpeciesId } from '../avatar/dino-species.js';
5
+ /**
6
+ * What moves a close-up in a call (the face of a call): the mouth by the sound that plays while it speaks, a nod as the
7
+ * user's words come.
8
+ */
9
+ export interface DinoTalk {
10
+ /** How loud what plays now is (RMS, 0 to 1); undefined when nothing tells, and the mouth moves by itself. */
11
+ level?(): number | undefined;
12
+ /** Changes as the user's words come: it nods (once in a while). */
13
+ nods?: number;
14
+ }
5
15
  /** The kind of dinosaur ta is and how it walks, as the user picked them for the double; the logo walking until then. */
6
16
  export interface DinoLook {
7
17
  species: SpeciesId;
@@ -26,9 +36,13 @@ export declare function TaAvatar({ mood, size, mark, className, roam, species, g
26
36
  * A close-up of ta's head in a round frame tinted with its color, sweet rather than fierce: the figure of the
27
37
  * account. It tilts its head, blinks, follows the pointer with its eyes, and laughs when poked.
28
38
  */
29
- export declare function DinoFace({ mood, size, species, className }: {
39
+ export declare function DinoFace({ mood, size, species, className, talk, fill, }: {
30
40
  mood?: Mood;
31
41
  size?: number;
32
42
  species?: SpeciesId;
33
43
  className?: string;
44
+ /** In a call: its mouth moves by the sound it plays, it nods to the words it hears. */
45
+ talk?: DinoTalk;
46
+ /** As large as its box, which the styles size; `size` says how large it is drawn at most. */
47
+ fill?: boolean;
34
48
  }): React.JSX.Element;
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { AVATAR_VIEWBOX, DinoAvatar, frame, headAt } from '../avatar/dino-avatar.js';
3
3
  import { DinoMotion, POKE } from '../avatar/dino-motion.js';
4
4
  import { DinoSpecies } from '../avatar/dino-species.js';
5
+ import { DinoTalkMotion } from '../avatar/dino-talk.js';
5
6
  import { ScrollRest } from '../util/scroll-rest.js';
6
7
  let next = 0;
7
8
  /** How long a change of mood takes to blend into the new motion, in seconds. */
@@ -14,6 +15,8 @@ const FINE = 48;
14
15
  const BOX_MS = 200;
15
16
  /** The whole dinosaur's viewBox: its left and top edge, and its width. */
16
17
  const WHOLE = [-8, -8, 272];
18
+ /** How long after a nod a close-up nods again, however often the words it hears come, in seconds. */
19
+ const NOD_GAP = 1.4;
17
20
  export const DinoLook = React.createContext({ species: DinoSpecies.DEFAULT, gait: 'walk' });
18
21
  /** One loop of animation frames for every ta on the page; only those on screen move, and none when motion is reduced. */
19
22
  const players = new Set();
@@ -78,6 +81,9 @@ function draw(player, now) {
78
81
  player.last = now;
79
82
  const since = (now - player.poked) / 1000;
80
83
  // A close-up only tilts its head toward the pointer, and laughs when poked; the whole dinosaur roars.
84
+ if (player.face && player.talk) {
85
+ pose = talking(player, pose, now, dt);
86
+ }
81
87
  pose = player.face
82
88
  ? DinoMotion.tickle(DinoMotion.look(pose, { ...look, weight: look.weight * 0.5 }), since)
83
89
  : DinoMotion.poke(DinoMotion.look(pose, look), since);
@@ -128,6 +134,27 @@ function draw(player, now) {
128
134
  svg.classList.toggle('ta-dino-poked', since >= 0 && since < POKE);
129
135
  }
130
136
  }
137
+ /** A close-up in a call: its mouth by the sound it plays as it speaks, a nod to the words it hears. */
138
+ function talking(player, pose, now, dt) {
139
+ var _a;
140
+ const talk = player.talk;
141
+ const level = player.mood === 'speaking' ? (_a = talk === null || talk === void 0 ? void 0 : talk.level) === null || _a === void 0 ? void 0 : _a.call(talk) : undefined;
142
+ let posed = pose;
143
+ if (level !== undefined) {
144
+ player.open = DinoTalkMotion.mouth(player.open, level, dt);
145
+ posed = DinoTalkMotion.speak(posed, player.open);
146
+ }
147
+ else {
148
+ player.open = 0;
149
+ }
150
+ if ((talk === null || talk === void 0 ? void 0 : talk.nods) !== player.nods) {
151
+ player.nods = talk === null || talk === void 0 ? void 0 : talk.nods;
152
+ if (player.mood === 'listening' && (now - player.nodded) / 1000 >= NOD_GAP) {
153
+ player.nodded = now;
154
+ }
155
+ }
156
+ return DinoTalkMotion.nod(posed, (now - player.nodded) / 1000);
157
+ }
131
158
  function tick(now) {
132
159
  loop = 0;
133
160
  if (document.documentElement.hasAttribute('data-reduce-motion')) {
@@ -195,7 +222,7 @@ function start(player) {
195
222
  };
196
223
  }
197
224
  /** Plays the drawing in `svg`: its markup (which changes with the mood and the kind only) and the frames that move what is in it. */
198
- function usePlayer(svg, { mood, size, roam, species, gait, face }) {
225
+ function usePlayer(svg, { mood, size, roam, species, gait, face, talk }) {
199
226
  const id = React.useMemo(() => `ta-${++next}`, []);
200
227
  const player = React.useRef(undefined);
201
228
  const detail = size >= FINE;
@@ -217,6 +244,7 @@ function usePlayer(svg, { mood, size, roam, species, gait, face }) {
217
244
  const view = face ? species.face : WHOLE;
218
245
  if (current) {
219
246
  current.svg = element;
247
+ current.talk = talk;
220
248
  current.fine = size >= FINE;
221
249
  current.view = view;
222
250
  if (current.species !== species) {
@@ -249,10 +277,14 @@ function usePlayer(svg, { mood, size, roam, species, gait, face }) {
249
277
  look: { x: 0, y: 0, weight: 0 },
250
278
  last: now,
251
279
  poked: -Infinity,
280
+ talk,
281
+ open: 0,
282
+ nods: talk === null || talk === void 0 ? void 0 : talk.nods,
283
+ nodded: -Infinity,
252
284
  boxedAt: -Infinity,
253
285
  parts: new Map(),
254
286
  };
255
- }, [mood, roam, size, species, gait, face]);
287
+ }, [mood, roam, size, species, gait, face, talk]);
256
288
  React.useEffect(() => {
257
289
  const current = player.current;
258
290
  return current ? start(current) : undefined;
@@ -284,12 +316,13 @@ export function TaAvatar({ mood = 'idle', size = 40, mark, className = '', roam
284
316
  * A close-up of ta's head in a round frame tinted with its color, sweet rather than fierce: the figure of the
285
317
  * account. It tilts its head, blinks, follows the pointer with its eyes, and laughs when poked.
286
318
  */
287
- export function DinoFace({ mood = 'idle', size = 32, species, className = '' }) {
319
+ export function DinoFace({ mood = 'idle', size = 32, species, className = '', talk, fill = false, }) {
288
320
  const look = React.useContext(DinoLook);
289
321
  const kind = DinoSpecies.of(species !== null && species !== void 0 ? species : look.species);
290
322
  const svgRef = React.useRef(null);
291
- const markup = usePlayer(svgRef, { mood, size, roam: false, species: kind, gait: look.gait, face: true });
292
- return (React.createElement("span", { className: `ta-dino-face ${className}`, style: { width: size, height: size, '--ta-dino': kind.colors.skin } },
323
+ const markup = usePlayer(svgRef, { mood, size, roam: false, species: kind, gait: look.gait, face: true, talk });
324
+ const box = fill ? {} : { width: size, height: size };
325
+ return (React.createElement("span", { className: `ta-dino-face ${className}`, style: { ...box, ['--ta-dino']: kind.colors.skin } },
293
326
  React.createElement("svg", { ref: svgRef, className: `ta-avatar ta-avatar-${mood}`, width: size, height: size, viewBox: DinoAvatar.faceBox(kind), "aria-hidden": "true",
294
327
  // biome-ignore lint/security/noDangerouslySetInnerHtml: markup made here from constants, nothing from outside
295
328
  dangerouslySetInnerHTML: { __html: markup } })));
@@ -1,5 +1,5 @@
1
1
  import { TaBargeIn, TaPackageTextUtil } from '@celljs/ta-protocol';
2
- import { AudioLines, Check, FileJson, Hand, Pencil, Plus, ShieldCheck, Smartphone, Trash2 } from 'lucide-react';
2
+ import { AudioLines, BrainCircuit, Check, FileJson, Hand, Pencil, Plus, ShieldCheck, Smartphone, Trash2 } from 'lucide-react';
3
3
  import * as React from 'react';
4
4
  import { useNotices, useWorkbench } from '../hooks.js';
5
5
  import { useLanguage, useT } from '../i18n/use-t.js';
@@ -11,6 +11,7 @@ import { Row, Switch } from './settings-controls.js';
11
11
  * to use it; the types packages registered, each with a form to add one. Keys are typed here and never shown again.
12
12
  */
13
13
  export function VoiceServices() {
14
+ var _a;
14
15
  const t = useT();
15
16
  const language = useLanguage();
16
17
  const [workbench, bench] = useWorkbench();
@@ -42,6 +43,8 @@ export function VoiceServices() {
42
43
  }
43
44
  const title = (type, fallback) => (type && TaPackageTextUtil.pick(type.title, language)) || fallback;
44
45
  const typeOf = (name) => voices.types.find(type => type.type === name);
46
+ const inUse = voices.services.find(service => service.id === voices.use);
47
+ const thinks = !!inUse && !!((_a = typeOf(inUse.type)) === null || _a === void 0 ? void 0 : _a.thinks);
45
48
  const chosen = (id) => voices.use === id ? (React.createElement(Icon, { icon: Check, size: 18, className: "ta-setting-check" })) : (React.createElement("button", { type: "button", className: "ta-button", disabled: busy !== undefined, onClick: () => void run('use', () => bench.voice.chooseVoice(id !== null && id !== void 0 ? id : null)) }, t('ta.voices.use')));
46
49
  return (React.createElement(React.Fragment, null,
47
50
  React.createElement(Row, { icon: Smartphone, label: t('ta.voices.device'), description: t('ta.voices.deviceHint') }, chosen(undefined)),
@@ -61,6 +64,8 @@ export function VoiceServices() {
61
64
  await read();
62
65
  } })))));
63
66
  }),
67
+ thinks && (React.createElement(Row, { icon: BrainCircuit, label: t('ta.voices.brain'), description: t('ta.voices.brainHint') },
68
+ React.createElement(Switch, { checked: voices.brain === 'service', label: t('ta.voices.brain'), onChange: on => run('brain', () => bench.voice.setBrain(on ? 'service' : 'ta')) }))),
64
69
  voices.use && (React.createElement(Row, { icon: Hand, label: t('ta.voices.cutIn'), description: t('ta.voices.cutInHint') },
65
70
  React.createElement(Switch, { checked: !voices.bargeIn.tap, label: t('ta.voices.cutIn'), onChange: on => run('bargeIn', () => bench.voice.setBargeIn({ tap: !on })) }))),
66
71
  voices.use && !voices.bargeIn.tap && (React.createElement(BargeInRow, { bargeIn: voices.bargeIn, onChange: bargeIn => void run('bargeIn', () => bench.voice.setBargeIn(bargeIn)) })),