@celljs/ta-web 4.26.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 (290) 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/chat-home.d.ts +6 -4
  43. package/esm/browser/components/chat-home.js +7 -7
  44. package/esm/browser/components/chat-icon.js +9 -5
  45. package/esm/browser/components/chat-list-hooks.d.ts +14 -4
  46. package/esm/browser/components/chat-list-hooks.js +11 -5
  47. package/esm/browser/components/chat-list-row.d.ts +7 -4
  48. package/esm/browser/components/chat-list-row.js +22 -10
  49. package/esm/browser/components/chat-list.js +6 -11
  50. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  51. package/esm/browser/components/conversation-scroll-util.d.ts +8 -1
  52. package/esm/browser/components/conversation-scroll-util.js +21 -0
  53. package/esm/browser/components/conversation-scroll.js +10 -11
  54. package/esm/browser/components/gallery.js +28 -7
  55. package/esm/browser/components/host-view.d.ts +1 -1
  56. package/esm/browser/components/image-pull.d.ts +64 -0
  57. package/esm/browser/components/image-pull.js +202 -0
  58. package/esm/browser/components/kept-call-bar.js +2 -1
  59. package/esm/browser/components/lightbox.d.ts +1 -1
  60. package/esm/browser/components/lightbox.js +57 -2
  61. package/esm/browser/components/markdown.d.ts +3 -1
  62. package/esm/browser/components/markdown.js +8 -4
  63. package/esm/browser/components/partner-row.js +2 -1
  64. package/esm/browser/components/relay-services.d.ts +9 -3
  65. package/esm/browser/components/relay-services.js +73 -35
  66. package/esm/browser/components/session-view.js +4 -2
  67. package/esm/browser/components/settings-parts.js +2 -0
  68. package/esm/browser/components/ta-avatar.d.ts +15 -1
  69. package/esm/browser/components/ta-avatar.js +72 -11
  70. package/esm/browser/components/voice-services.js +6 -1
  71. package/esm/browser/extension/web-api-call.d.ts +64 -2
  72. package/esm/browser/extension/web-api-contributions.d.ts +1 -0
  73. package/esm/browser/extension/web-api-partners.d.ts +2 -0
  74. package/esm/browser/extension/web-extension-api.d.ts +6 -6
  75. package/esm/browser/extension/web-extension-context.js +1 -0
  76. package/esm/browser/extension/web-extension-protocol.d.ts +3 -1
  77. package/esm/browser/extension/web-extension-run.d.ts +3 -2
  78. package/esm/browser/extension/web-extension-run.js +2 -0
  79. package/esm/browser/hosts.d.ts +2 -0
  80. package/esm/browser/hosts.js +22 -3
  81. package/esm/browser/i18n/locales.d.ts +24 -5
  82. package/esm/browser/i18n/messages-ja.js +25 -6
  83. package/esm/browser/i18n/messages-zh-tw.js +25 -6
  84. package/esm/browser/i18n/messages.d.ts +23 -4
  85. package/esm/browser/i18n/messages.js +50 -12
  86. package/esm/browser/markdown/code-renderers.d.ts +2 -0
  87. package/esm/browser/markdown/code-renderers.js +2 -0
  88. package/esm/browser/screen/page-answers.d.ts +2 -1
  89. package/esm/browser/screen/page-answers.js +7 -4
  90. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  91. package/esm/browser/settings/settings-protocol.js +2 -0
  92. package/esm/browser/style/chat-list.d.ts +1 -1
  93. package/esm/browser/style/chat-list.js +1 -1
  94. package/esm/browser/style/conversation.d.ts +1 -1
  95. package/esm/browser/style/conversation.js +6 -1
  96. package/esm/browser/style/device.js +1 -0
  97. package/esm/browser/style/dialogs.d.ts +1 -1
  98. package/esm/browser/style/dialogs.js +1 -1
  99. package/esm/browser/style/layout.d.ts +1 -1
  100. package/esm/browser/style/layout.js +135 -57
  101. package/esm/browser/style/shell.d.ts +1 -1
  102. package/esm/browser/style/shell.js +8 -0
  103. package/esm/browser/style/video-call.d.ts +2 -0
  104. package/esm/browser/style/video-call.js +52 -0
  105. package/esm/browser/style.js +2 -0
  106. package/esm/browser/util/desktop.d.ts +10 -1
  107. package/esm/browser/util/desktop.js +10 -0
  108. package/esm/browser/util/image-pull.d.ts +61 -0
  109. package/esm/browser/util/image-pull.js +88 -0
  110. package/esm/browser/util/spoken.d.ts +3 -3
  111. package/esm/browser/util/spoken.js +4 -4
  112. package/esm/browser/video-call/call-camera.d.ts +59 -0
  113. package/esm/browser/video-call/call-camera.js +188 -0
  114. package/esm/browser/video-call/call-window.d.ts +19 -0
  115. package/esm/browser/video-call/call-window.js +80 -0
  116. package/esm/browser/video-call/clip-plan.d.ts +47 -0
  117. package/esm/browser/video-call/clip-plan.js +60 -0
  118. package/esm/browser/video-call/face-clips.d.ts +33 -0
  119. package/esm/browser/video-call/face-clips.js +93 -0
  120. package/esm/browser/video-call/face-files.d.ts +31 -0
  121. package/esm/browser/video-call/face-files.js +77 -0
  122. package/esm/browser/video-call/video-call-view.d.ts +19 -0
  123. package/esm/browser/video-call/video-call-view.js +214 -0
  124. package/esm/browser/video-call/video-face.d.ts +13 -0
  125. package/esm/browser/video-call/video-face.js +497 -0
  126. package/esm/browser/workbench-hosts.d.ts +1 -0
  127. package/esm/browser/workbench-hosts.js +8 -4
  128. package/esm/browser/workbench-lists.d.ts +16 -1
  129. package/esm/browser/workbench-lists.js +38 -3
  130. package/esm/browser/workbench-protocol.d.ts +2 -0
  131. package/esm/browser/workbench-util.d.ts +5 -0
  132. package/esm/browser/workbench-util.js +18 -0
  133. package/esm/browser/workbench.d.ts +6 -0
  134. package/esm/browser/workbench.js +36 -5
  135. package/lib/browser/assistant/assistant-role.d.ts +9 -4
  136. package/lib/browser/assistant/assistant-role.js +17 -5
  137. package/lib/browser/assistant/assistant-task-util.d.ts +6 -0
  138. package/lib/browser/assistant/assistant-task-util.js +11 -0
  139. package/lib/browser/assistant/assistant-view.js +3 -0
  140. package/lib/browser/assistant/assistant.d.ts +2 -1
  141. package/lib/browser/assistant/assistant.js +9 -7
  142. package/lib/browser/assistant/call-conversing.d.ts +46 -0
  143. package/lib/browser/assistant/call-conversing.js +96 -0
  144. package/lib/browser/assistant/call-face.d.ts +14 -0
  145. package/lib/browser/assistant/call-face.js +117 -0
  146. package/lib/browser/assistant/call-keeper.d.ts +8 -4
  147. package/lib/browser/assistant/call-keeper.js +32 -11
  148. package/lib/browser/assistant/call-partnering.d.ts +38 -0
  149. package/lib/browser/assistant/call-partnering.js +83 -0
  150. package/lib/browser/assistant/call-scenes.d.ts +26 -0
  151. package/lib/browser/assistant/call-scenes.js +85 -0
  152. package/lib/browser/assistant/call-screen.d.ts +3 -0
  153. package/lib/browser/assistant/call-screen.js +15 -0
  154. package/lib/browser/assistant/mic-sense.d.ts +32 -0
  155. package/lib/browser/assistant/mic-sense.js +123 -0
  156. package/lib/browser/assistant/noise-gate.d.ts +33 -0
  157. package/lib/browser/assistant/noise-gate.js +71 -0
  158. package/lib/browser/assistant/pcm-util.d.ts +11 -0
  159. package/lib/browser/assistant/pcm-util.js +58 -0
  160. package/lib/browser/assistant/read-aloud.d.ts +2 -1
  161. package/lib/browser/assistant/realtime-voice-protocol.d.ts +85 -0
  162. package/lib/browser/assistant/realtime-voice-protocol.js +43 -0
  163. package/lib/browser/assistant/realtime-voice.d.ts +50 -62
  164. package/lib/browser/assistant/realtime-voice.js +217 -138
  165. package/lib/browser/assistant/spoken-timeline.d.ts +28 -0
  166. package/lib/browser/assistant/spoken-timeline.js +53 -0
  167. package/lib/browser/assistant/voice-call-bar.d.ts +9 -2
  168. package/lib/browser/assistant/voice-call-bar.js +81 -30
  169. package/lib/browser/assistant/voice-call-protocol.d.ts +61 -4
  170. package/lib/browser/assistant/voice-call.d.ts +16 -23
  171. package/lib/browser/assistant/voice-call.js +134 -117
  172. package/lib/browser/assistant/voice-reading.d.ts +84 -0
  173. package/lib/browser/assistant/voice-reading.js +156 -0
  174. package/lib/browser/avatar/dino-talk.d.ts +16 -0
  175. package/lib/browser/avatar/dino-talk.js +37 -0
  176. package/lib/browser/components/chat-home.d.ts +6 -4
  177. package/lib/browser/components/chat-home.js +8 -9
  178. package/lib/browser/components/chat-icon.js +9 -5
  179. package/lib/browser/components/chat-list-hooks.d.ts +14 -4
  180. package/lib/browser/components/chat-list-hooks.js +12 -6
  181. package/lib/browser/components/chat-list-row.d.ts +7 -4
  182. package/lib/browser/components/chat-list-row.js +23 -12
  183. package/lib/browser/components/chat-list.js +5 -10
  184. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  185. package/lib/browser/components/conversation-scroll-util.d.ts +8 -1
  186. package/lib/browser/components/conversation-scroll-util.js +21 -0
  187. package/lib/browser/components/conversation-scroll.js +10 -11
  188. package/lib/browser/components/gallery.js +28 -7
  189. package/lib/browser/components/host-view.d.ts +1 -1
  190. package/lib/browser/components/image-pull.d.ts +65 -0
  191. package/lib/browser/components/image-pull.js +206 -0
  192. package/lib/browser/components/kept-call-bar.js +2 -1
  193. package/lib/browser/components/lightbox.d.ts +1 -1
  194. package/lib/browser/components/lightbox.js +57 -2
  195. package/lib/browser/components/markdown.d.ts +3 -1
  196. package/lib/browser/components/markdown.js +7 -3
  197. package/lib/browser/components/partner-row.js +2 -1
  198. package/lib/browser/components/relay-services.d.ts +9 -3
  199. package/lib/browser/components/relay-services.js +71 -33
  200. package/lib/browser/components/session-view.js +3 -1
  201. package/lib/browser/components/settings-parts.js +2 -0
  202. package/lib/browser/components/ta-avatar.d.ts +15 -1
  203. package/lib/browser/components/ta-avatar.js +72 -11
  204. package/lib/browser/components/voice-services.js +5 -0
  205. package/lib/browser/extension/web-api-call.d.ts +64 -2
  206. package/lib/browser/extension/web-api-contributions.d.ts +1 -0
  207. package/lib/browser/extension/web-api-partners.d.ts +2 -0
  208. package/lib/browser/extension/web-extension-api.d.ts +6 -6
  209. package/lib/browser/extension/web-extension-context.js +1 -0
  210. package/lib/browser/extension/web-extension-protocol.d.ts +3 -1
  211. package/lib/browser/extension/web-extension-run.d.ts +3 -2
  212. package/lib/browser/extension/web-extension-run.js +2 -0
  213. package/lib/browser/hosts.d.ts +2 -0
  214. package/lib/browser/hosts.js +22 -3
  215. package/lib/browser/i18n/locales.d.ts +24 -5
  216. package/lib/browser/i18n/messages-ja.js +25 -6
  217. package/lib/browser/i18n/messages-zh-tw.js +25 -6
  218. package/lib/browser/i18n/messages.d.ts +23 -4
  219. package/lib/browser/i18n/messages.js +50 -12
  220. package/lib/browser/markdown/code-renderers.d.ts +2 -0
  221. package/lib/browser/markdown/code-renderers.js +3 -1
  222. package/lib/browser/screen/page-answers.d.ts +2 -1
  223. package/lib/browser/screen/page-answers.js +7 -4
  224. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  225. package/lib/browser/settings/settings-protocol.js +2 -0
  226. package/lib/browser/style/chat-list.d.ts +1 -1
  227. package/lib/browser/style/chat-list.js +1 -1
  228. package/lib/browser/style/conversation.d.ts +1 -1
  229. package/lib/browser/style/conversation.js +6 -1
  230. package/lib/browser/style/device.js +1 -0
  231. package/lib/browser/style/dialogs.d.ts +1 -1
  232. package/lib/browser/style/dialogs.js +1 -1
  233. package/lib/browser/style/layout.d.ts +1 -1
  234. package/lib/browser/style/layout.js +135 -57
  235. package/lib/browser/style/shell.d.ts +1 -1
  236. package/lib/browser/style/shell.js +8 -0
  237. package/lib/browser/style/video-call.d.ts +3 -0
  238. package/lib/browser/style/video-call.js +55 -0
  239. package/lib/browser/style.js +2 -0
  240. package/lib/browser/util/desktop.d.ts +10 -1
  241. package/lib/browser/util/desktop.js +10 -0
  242. package/lib/browser/util/image-pull.d.ts +62 -0
  243. package/lib/browser/util/image-pull.js +91 -0
  244. package/lib/browser/util/spoken.d.ts +3 -3
  245. package/lib/browser/util/spoken.js +4 -4
  246. package/lib/browser/video-call/call-camera.d.ts +60 -0
  247. package/lib/browser/video-call/call-camera.js +192 -0
  248. package/lib/browser/video-call/call-window.d.ts +20 -0
  249. package/lib/browser/video-call/call-window.js +83 -0
  250. package/lib/browser/video-call/clip-plan.d.ts +48 -0
  251. package/lib/browser/video-call/clip-plan.js +64 -0
  252. package/lib/browser/video-call/face-clips.d.ts +34 -0
  253. package/lib/browser/video-call/face-clips.js +96 -0
  254. package/lib/browser/video-call/face-files.d.ts +32 -0
  255. package/lib/browser/video-call/face-files.js +82 -0
  256. package/lib/browser/video-call/video-call-view.d.ts +20 -0
  257. package/lib/browser/video-call/video-call-view.js +250 -0
  258. package/lib/browser/video-call/video-face.d.ts +14 -0
  259. package/lib/browser/video-call/video-face.js +533 -0
  260. package/lib/browser/workbench-hosts.d.ts +1 -0
  261. package/lib/browser/workbench-hosts.js +8 -4
  262. package/lib/browser/workbench-lists.d.ts +16 -1
  263. package/lib/browser/workbench-lists.js +38 -3
  264. package/lib/browser/workbench-protocol.d.ts +2 -0
  265. package/lib/browser/workbench-util.d.ts +5 -0
  266. package/lib/browser/workbench-util.js +18 -0
  267. package/lib/browser/workbench.d.ts +6 -0
  268. package/lib/browser/workbench.js +35 -4
  269. package/package.json +7 -7
  270. package/public/faces/README.md +27 -0
  271. package/public/faces/clap.mp4 +0 -0
  272. package/public/faces/dance.mp4 +0 -0
  273. package/public/faces/happy.mp4 +0 -0
  274. package/public/faces/heart.mp4 +0 -0
  275. package/public/faces/idle-1.mp4 +0 -0
  276. package/public/faces/idle-2.mp4 +0 -0
  277. package/public/faces/idle-3.mp4 +0 -0
  278. package/public/faces/laugh.mp4 +0 -0
  279. package/public/faces/lips.json +1 -0
  280. package/public/faces/listening.mp4 +0 -0
  281. package/public/faces/poster.jpg +0 -0
  282. package/public/faces/shy.mp4 +0 -0
  283. package/public/faces/sorry.mp4 +0 -0
  284. package/public/faces/stretch.mp4 +0 -0
  285. package/public/faces/surprised.mp4 +0 -0
  286. package/public/faces/talk-1.mp4 +0 -0
  287. package/public/faces/talk-2.mp4 +0 -0
  288. package/public/faces/think-2.mp4 +0 -0
  289. package/public/faces/thinking.mp4 +0 -0
  290. package/public/faces/wave.mp4 +0 -0
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CallSounds = exports.VoiceSoundTap = exports.VoiceReading = void 0;
4
+ const spoken_timeline_1 = require("./spoken-timeline");
5
+ /** How often the captions look where the reading is, in ms. */
6
+ const CAPTION_MS = 80;
7
+ /**
8
+ * What a voice service reads now, on the clock of its sound as it plays (CallReading): it begins where its first sound
9
+ * plays, held as long as the face of a video call asks (RealtimeVoice.hold), and its captions show each sentence as it
10
+ * is heard, by the same timeline the face asks.
11
+ */
12
+ class VoiceReading {
13
+ constructor(say, pieces, context, holdS,
14
+ /** Whether it is still what plays: once not, its captions stop. */
15
+ live, onPiece) {
16
+ this.say = say;
17
+ this.pieces = pieces;
18
+ this.context = context;
19
+ this.holdS = holdS;
20
+ this.live = live;
21
+ this.onPiece = onPiece;
22
+ /** Its sound as it was put to play: from `at` on the clock of the audio context, `from` seconds into it, for `seconds`. */
23
+ this.played = [];
24
+ this.shown = -1;
25
+ this.timeline = new spoken_timeline_1.SpokenTimeline(pieces, spoken_timeline_1.SpokenTimeline.pace(pieces.join('')));
26
+ }
27
+ /**
28
+ * How far into its sound it plays: where the sound playing now is in it, or where the last played ended while what
29
+ * comes next is late (the sound stopped short), so that the words, the clip and the mouth wait with the voice.
30
+ */
31
+ now() {
32
+ if (this.startAt === undefined) {
33
+ return -this.holdS;
34
+ }
35
+ const time = this.context.currentTime;
36
+ for (let i = this.played.length - 1; i >= 0; i--) {
37
+ const sound = this.played[i];
38
+ if (sound.at <= time) {
39
+ return sound.from + Math.min(sound.seconds, time - sound.at);
40
+ }
41
+ }
42
+ return time - this.startAt;
43
+ }
44
+ pieceAt(seconds) {
45
+ return this.timeline.at(Math.max(0, seconds));
46
+ }
47
+ /** More of its sound came: when the first of it plays, and how much of it there is. */
48
+ heard(at, seconds) {
49
+ if (this.startAt === undefined) {
50
+ this.startAt = at;
51
+ this.caption();
52
+ }
53
+ this.played.push({ at, from: this.timeline.received, seconds });
54
+ this.timeline.received += seconds;
55
+ }
56
+ /** Its words, more of them as they came (a voice that thinks says them as it goes): its sentences timed again. */
57
+ words(pieces) {
58
+ if (pieces.join('') === this.pieces.join('')) {
59
+ return;
60
+ }
61
+ const { received, said } = this.timeline;
62
+ this.pieces = pieces;
63
+ this.timeline = new spoken_timeline_1.SpokenTimeline(pieces, spoken_timeline_1.SpokenTimeline.pace(pieces.join('')));
64
+ this.timeline.received = received;
65
+ this.timeline.said = said;
66
+ this.shown = Math.min(this.shown, pieces.length - 1);
67
+ this.lastPieces = undefined;
68
+ }
69
+ /** All of its sound came: the timeline knows how long it is. */
70
+ said() {
71
+ this.timeline.said = true;
72
+ }
73
+ caption() {
74
+ if (!this.onPiece || this.timer) {
75
+ return;
76
+ }
77
+ const tick = () => {
78
+ var _a;
79
+ if (!this.live()) {
80
+ clearInterval(this.timer);
81
+ return;
82
+ }
83
+ const now = this.now();
84
+ // A sentence shown stays until the next is heard, its words timed again or not.
85
+ const index = now < 0 ? -1 : Math.max(this.shown, this.pieceAt(now));
86
+ if (index >= 0 && (index !== this.shown || this.lastPieces !== this.pieces)) {
87
+ this.shown = index;
88
+ this.lastPieces = this.pieces;
89
+ (_a = this.onPiece) === null || _a === void 0 ? void 0 : _a.call(this, [...this.pieces], index);
90
+ }
91
+ };
92
+ this.timer = setInterval(tick, CAPTION_MS);
93
+ tick();
94
+ }
95
+ }
96
+ exports.VoiceReading = VoiceReading;
97
+ /** The sound of what a voice reads, for the face of a video call (CallVoice.onSound), and the hold it asks (hold). */
98
+ class VoiceSoundTap {
99
+ constructor() {
100
+ /** How long each reading waits before it plays, in seconds. */
101
+ this.holdS = 0;
102
+ this.listeners = new Set();
103
+ this.on = (listener) => {
104
+ this.listeners.add(listener);
105
+ return () => this.listeners.delete(listener);
106
+ };
107
+ this.hold = (ms) => {
108
+ var _a, _b;
109
+ this.holdS = Math.max(0, ms) / 1000;
110
+ (_b = (_a = this.voice) === null || _a === void 0 ? void 0 : _a.hold) === null || _b === void 0 ? void 0 : _b.call(_a, ms);
111
+ };
112
+ }
113
+ /** Of a call: the sound of its voice is told here, and the hold asked here goes to it; stops with what it returns. */
114
+ follow(voice) {
115
+ var _a, _b;
116
+ (_a = voice.hold) === null || _a === void 0 ? void 0 : _a.call(voice, this.holdS * 1000);
117
+ this.voice = voice;
118
+ const off = (_b = voice.onSound) === null || _b === void 0 ? void 0 : _b.call(voice, (say, pcm, rate) => this.tell(say, pcm, rate));
119
+ return () => {
120
+ off === null || off === void 0 ? void 0 : off();
121
+ if (this.voice === voice) {
122
+ this.voice = undefined;
123
+ }
124
+ };
125
+ }
126
+ tell(say, pcm, rate = 24000) {
127
+ for (const listener of this.listeners) {
128
+ listener(say, pcm, rate);
129
+ }
130
+ }
131
+ }
132
+ exports.VoiceSoundTap = VoiceSoundTap;
133
+ /**
134
+ * What the face of a call reads of its voice, whichever voice the call has now: how loud it plays (RMS, 0 to 1;
135
+ * undefined for the device's, which cannot tell), what it reads on the clock of its sound, and that sound.
136
+ */
137
+ class CallSounds extends VoiceSoundTap {
138
+ constructor(voiceNow) {
139
+ super();
140
+ this.voiceNow = voiceNow;
141
+ this.level = () => { var _a, _b; return (_b = (_a = this.voiceNow()).level) === null || _b === void 0 ? void 0 : _b.call(_a); };
142
+ this.nowReading = () => { var _a, _b; return (_b = (_a = this.voiceNow()).nowReading) === null || _b === void 0 ? void 0 : _b.call(_a); };
143
+ }
144
+ /** Hears the user cut in while the voice of the call reads, and its sound (follow): stops both with what it returns. */
145
+ heard(voice, cut) {
146
+ var _a;
147
+ const offSound = this.follow(voice);
148
+ const offSpeech = (_a = voice.onSpeech) === null || _a === void 0 ? void 0 : _a.call(voice, cut);
149
+ return () => {
150
+ offSound();
151
+ offSpeech === null || offSpeech === void 0 ? void 0 : offSpeech();
152
+ };
153
+ }
154
+ }
155
+ exports.CallSounds = CallSounds;
156
+ //# sourceMappingURL=voice-reading.js.map
@@ -0,0 +1,16 @@
1
+ import type { Pose } from './dino-avatar';
2
+ /** How long a nod of a close-up that hears the user takes, in seconds. */
3
+ export declare const NOD = 0.55;
4
+ /** How a close-up moves in a call (CallFace): its mouth by the sound it plays, a nod to the words it hears. */
5
+ export declare namespace DinoTalkMotion {
6
+ /**
7
+ * How open the mouth of a close-up in a call is, `dt` seconds after it was `open`, for what plays now as loud as
8
+ * `level` (RMS, 0 to 1): it opens at once with a syllable and closes a little slower, as a mouth does.
9
+ */
10
+ function mouth(open: number, level: number, dt: number): number;
11
+ /** A close-up speaking by the sound it plays: the jaw as open as `open` (0 to 1), the head lifted a little with it. */
12
+ function speak(pose: Pose, open: number): Pose;
13
+ /** A close-up that hears the user nods, `t` seconds into a nod (NOD long). */
14
+ function nod(pose: Pose, t: number): Pose;
15
+ }
16
+ //# sourceMappingURL=dino-talk.d.ts.map
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DinoTalkMotion = exports.NOD = void 0;
4
+ /** How long a nod of a close-up that hears the user takes, in seconds. */
5
+ exports.NOD = 0.55;
6
+ /** How quickly the mouth of a close-up in a call opens with a syllable, and closes after it, in seconds. */
7
+ const MOUTH_OPEN = 0.035;
8
+ const MOUTH_CLOSE = 0.09;
9
+ /** How a close-up moves in a call (CallFace): its mouth by the sound it plays, a nod to the words it hears. */
10
+ var DinoTalkMotion;
11
+ (function (DinoTalkMotion) {
12
+ /**
13
+ * How open the mouth of a close-up in a call is, `dt` seconds after it was `open`, for what plays now as loud as
14
+ * `level` (RMS, 0 to 1): it opens at once with a syllable and closes a little slower, as a mouth does.
15
+ */
16
+ function mouth(open, level, dt) {
17
+ // Speech plays at an RMS of about 0.05 to 0.3: its square root spreads it over the mouth.
18
+ const goal = Math.min(1, Math.sqrt(Math.max(0, level)) * 2.2);
19
+ const k = 1 - Math.exp(-dt / (goal > open ? MOUTH_OPEN : MOUTH_CLOSE));
20
+ return open + (goal - open) * k;
21
+ }
22
+ DinoTalkMotion.mouth = mouth;
23
+ /** A close-up speaking by the sound it plays: the jaw as open as `open` (0 to 1), the head lifted a little with it. */
24
+ function speak(pose, open) {
25
+ return { ...pose, jaw: 2 + 16 * open, head: pose.head - 2.5 * open };
26
+ }
27
+ DinoTalkMotion.speak = speak;
28
+ /** A close-up that hears the user nods, `t` seconds into a nod (NOD long). */
29
+ function nod(pose, t) {
30
+ if (t < 0 || t >= exports.NOD) {
31
+ return pose;
32
+ }
33
+ return { ...pose, head: pose.head + 7 * Math.sin((t / exports.NOD) * Math.PI), y: pose.y + 1.5 * Math.sin((t / exports.NOD) * Math.PI) };
34
+ }
35
+ DinoTalkMotion.nod = nod;
36
+ })(DinoTalkMotion || (exports.DinoTalkMotion = DinoTalkMotion = {}));
37
+ //# sourceMappingURL=dino-talk.js.map
@@ -30,15 +30,17 @@ export declare function ChatDoubleItem({ home, counts, unseen, now }: {
30
30
  * or unpinned as a folder is. What it opens shows as a conversation of the list does, the row selected while its page
31
31
  * or the conversation it stands for is in front.
32
32
  */
33
- export declare function ChatHomeItem({ row, time, home, selected, pinned, onPin, }: {
33
+ export declare const ChatHomeItem: React.MemoExoticComponent<({ row, time, shown, openItem, selected, pinned, onPin, }: {
34
34
  row: ChatHomeRow;
35
35
  time: string;
36
- home: ChatHome;
36
+ /** Its page is in front (ChatHome.shownItem). */
37
+ shown: boolean;
38
+ openItem: ChatHome['openItem'];
37
39
  /** The conversation it stands for is shown (WebHomeItem.sessionFile). */
38
40
  selected: boolean;
39
41
  pinned: boolean;
40
- onPin(pinned: boolean): void;
41
- }): React.JSX.Element;
42
+ onPin(key: string, pinned: boolean): void;
43
+ }) => React.JSX.Element>;
42
44
  /** What a row of a task does to the double's home: marks it seen, deletes it. */
43
45
  export type ChatTaskHome = Pick<ChatHome, 'look' | 'remove'>;
44
46
  /**
@@ -33,10 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ChatTaskItem = void 0;
36
+ exports.ChatTaskItem = exports.ChatHomeItem = void 0;
37
37
  exports.RowText = RowText;
38
38
  exports.ChatDoubleItem = ChatDoubleItem;
39
- exports.ChatHomeItem = ChatHomeItem;
40
39
  exports.ChatHomeTop = ChatHomeTop;
41
40
  const React = __importStar(require("react"));
42
41
  const task_views_1 = require("../assistant/task-views");
@@ -87,7 +86,7 @@ function ChatDoubleItem({ home, counts, unseen, now }) {
87
86
  * or unpinned as a folder is. What it opens shows as a conversation of the list does, the row selected while its page
88
87
  * or the conversation it stands for is in front.
89
88
  */
90
- function ChatHomeItem({ row, time, home, selected, pinned, onPin, }) {
89
+ exports.ChatHomeItem = React.memo(function ChatHomeItem({ row, time, shown, openItem, selected, pinned, onPin, }) {
91
90
  var _a;
92
91
  const t = (0, use_t_1.useT)();
93
92
  const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
@@ -95,20 +94,20 @@ function ChatHomeItem({ row, time, home, selected, pinned, onPin, }) {
95
94
  const { item, partner } = row;
96
95
  if (partner) {
97
96
  // A partner's conversation: the row the partners draw it with.
98
- const opens = () => home.openItem(item);
99
- return React.createElement(partner_row_1.PartnerRow, { partner: partner, time: time, selected: home.shownItem === partner.key, open: opens, pinned: pinned, onPin: onPin });
97
+ const opens = () => openItem(item);
98
+ return React.createElement(partner_row_1.PartnerRow, { partner: partner, time: time, selected: shown, open: opens, pinned: pinned, onPin: pin => onPin(row.key, pin) });
100
99
  }
101
100
  const Glyph = item.icon;
102
101
  const Own = item.face;
103
102
  const open = () => {
104
103
  setOpening(true);
105
104
  void Promise.resolve()
106
- .then(() => home.openItem(item))
105
+ .then(() => openItem(item))
107
106
  .catch(error => console.error(`A row of the home of ${item.extension} failed:`, error))
108
107
  .finally(() => setOpening(false));
109
108
  };
110
- const pin = { label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: () => onPin(!pinned) };
111
- const current = selected || home.shownItem === item.key;
109
+ const pin = { label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: () => onPin(row.key, !pinned) };
110
+ const current = selected || shown;
112
111
  return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-chat-row ta-chat-home-item${current ? ' ta-selected' : ''}`, "data-row": row.key, "data-unseen": item.unseen ? '' : undefined, actions: [{ key: 'pin', ...pin }], overlay: menu, onContextMenu: event => openMenu(event, context_menu_1.ContextMenuUtil.sections([{ label: t('ta.chat.open'), run: open }], [pin])) },
113
112
  React.createElement("button", { type: "button", className: "ta-chat-item", title: item.title, "aria-current": current ? 'true' : undefined, onClick: open },
114
113
  React.createElement("span", { className: "ta-chat-avatar-box" },
@@ -116,7 +115,7 @@ function ChatHomeItem({ row, time, home, selected, pinned, onPin, }) {
116
115
  React.createElement(Own, { size: 38 }))) : (React.createElement("span", { className: "ta-chat-avatar ta-chat-icon", style: { background: `var(--ta-tint-${item.tone})`, color: `var(--ta-tint-ink-${item.tone})`, width: 38, height: 38 }, "aria-hidden": "true" }, opening ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Glyph, { size: 18, strokeWidth: 1.8 }))),
117
116
  React.createElement(chat_list_row_1.ChatDot, { unseen: !!item.unseen, asks: false })),
118
117
  React.createElement(RowText, { title: item.title, time: time, line: (_a = item.detail) !== null && _a !== void 0 ? _a : '', unseen: item.unseen }))));
119
- }
118
+ });
120
119
  /**
121
120
  * A task of the double that is no conversation (a team), or one that waits for the user: who does it, what it is at,
122
121
  * when; a blue ? while it waits, an amber dot once it ended unseen. It opens in the main area, its conversation or its
@@ -64,15 +64,19 @@ var ChatIconUtil;
64
64
  }
65
65
  let memo = remembered.get(entries);
66
66
  if ((memo === null || memo === void 0 ? void 0 : memo.generation) !== generation) {
67
- memo = { generation, found: new Map() };
67
+ memo = { generation, found: new Map(), byChat: new WeakMap() };
68
68
  remembered.set(entries, memo);
69
69
  }
70
- const key = `${(_a = chat.group) !== null && _a !== void 0 ? _a : ''}\n${chat.cwd}\n${(_b = chat.sessionFile) !== null && _b !== void 0 ? _b : ''}`;
71
- if (memo.found.has(key)) {
72
- return memo.found.get(key);
70
+ // The same info of a conversation, asked again by each list and dot as they draw: found without a key made.
71
+ if (memo.byChat.has(chat)) {
72
+ return memo.byChat.get(chat);
73
73
  }
74
- const found = ask(entries, { sessionFile: chat.sessionFile, cwd: chat.cwd, ...(chat.group ? { group: chat.group } : {}) });
74
+ const key = `${(_a = chat.group) !== null && _a !== void 0 ? _a : ''}\n${chat.cwd}\n${(_b = chat.sessionFile) !== null && _b !== void 0 ? _b : ''}`;
75
+ const found = memo.found.has(key)
76
+ ? memo.found.get(key)
77
+ : ask(entries, { sessionFile: chat.sessionFile, cwd: chat.cwd, ...(chat.group ? { group: chat.group } : {}) });
75
78
  memo.found.set(key, found);
79
+ memo.byChat.set(chat, found);
76
80
  return found;
77
81
  }
78
82
  ChatIconUtil.find = find;
@@ -33,11 +33,21 @@ page: string): void;
33
33
  /** A conversation that comes to the top, is pinned or let go slides to its place in the list and in a folder opened, as the others make room. */
34
34
  export declare function useChatListMotion(list: React.RefObject<HTMLElement | null>, folder: React.RefObject<HTMLElement | null>): void;
35
35
  /**
36
- * What the rows of tasks do (ChatTaskItem), the same function and object however often the list draws: a row draws
37
- * again as its task does, not as the list or the page around it does.
36
+ * What the rows do (ChatTaskItem, ChatHomeItem, ChatFolderItem), the same functions and object however often the list
37
+ * draws: a row draws again as what it shows does, not as the list or the page around it does.
38
38
  */
39
- export declare function useTaskRows(onPicked: () => void, home: ChatHome | undefined): {
40
- picked: () => void;
39
+ export declare function useRowCalls(given: {
40
+ onPicked(): void;
41
+ home: ChatHome | undefined;
42
+ openFolder(key: string, archived?: boolean): void;
43
+ pinned: readonly string[];
44
+ onPinned(pinned: string[]): void;
45
+ }): {
46
+ picked(): void;
41
47
  taskHome: ChatTaskHome;
48
+ openItem: ChatHome['openItem'];
49
+ openFolder(key: string, archived?: boolean): void;
50
+ /** Pins or unpins a conversation's file or a folder's key: the last pinned first, as several may be. */
51
+ pinKey(key: string, pin: boolean): void;
42
52
  };
43
53
  //# sourceMappingURL=chat-list-hooks.d.ts.map
@@ -38,7 +38,7 @@ exports.useReadArchive = useReadArchive;
38
38
  exports.useMinute = useMinute;
39
39
  exports.usePageEnd = usePageEnd;
40
40
  exports.useChatListMotion = useChatListMotion;
41
- exports.useTaskRows = useTaskRows;
41
+ exports.useRowCalls = useRowCalls;
42
42
  const react_1 = require("@celljs/react");
43
43
  const React = __importStar(require("react"));
44
44
  const state_protocol_1 = require("../state/state-protocol");
@@ -126,18 +126,24 @@ function useChatListMotion(list, folder) {
126
126
  (0, list_motion_1.useListMotion)(folder);
127
127
  }
128
128
  /**
129
- * What the rows of tasks do (ChatTaskItem), the same function and object however often the list draws: a row draws
130
- * again as its task does, not as the list or the page around it does.
129
+ * What the rows do (ChatTaskItem, ChatHomeItem, ChatFolderItem), the same functions and object however often the list
130
+ * draws: a row draws again as what it shows does, not as the list or the page around it does.
131
131
  */
132
- function useTaskRows(onPicked, home) {
133
- const latest = React.useRef({ onPicked, home });
134
- latest.current = { onPicked, home };
132
+ function useRowCalls(given) {
133
+ const latest = React.useRef(given);
134
+ latest.current = given;
135
135
  return React.useMemo(() => ({
136
+ pinKey: (key, pin) => {
137
+ const others = latest.current.pinned.filter(other => other !== key);
138
+ latest.current.onPinned(pin ? [key, ...others] : others);
139
+ },
136
140
  picked: () => latest.current.onPicked(),
137
141
  taskHome: {
138
142
  look: (key, at) => { var _a; return (_a = latest.current.home) === null || _a === void 0 ? void 0 : _a.look(key, at); },
139
143
  remove: tasks => { var _a; return (_a = latest.current.home) === null || _a === void 0 ? void 0 : _a.remove(tasks); },
140
144
  },
145
+ openItem: entry => { var _a; var _b; return (_b = (_a = latest.current.home) === null || _a === void 0 ? void 0 : _a.openItem(entry)) !== null && _b !== void 0 ? _b : Promise.resolve(); },
146
+ openFolder: (key, archived) => latest.current.openFolder(key, archived),
141
147
  }), []);
142
148
  }
143
149
  //# sourceMappingURL=chat-list-hooks.js.map
@@ -80,7 +80,7 @@ export declare function ChatDot({ unseen, asks, onSee }: {
80
80
  * of it with what it said; a dot while one of them said something unseen, a spinner while one works. It opens the folder,
81
81
  * and is pinned as a conversation is: from its menu, or a swipe to the left on a phone.
82
82
  */
83
- export declare function ChatFolderItem({ folder, time, selected, unseen, pinned, onOpen, onPin, actions, }: {
83
+ interface ChatFolderProps {
84
84
  folder: ChatFolder;
85
85
  time: string;
86
86
  /** The conversation shown is in it. */
@@ -88,10 +88,13 @@ export declare function ChatFolderItem({ folder, time, selected, unseen, pinned,
88
88
  /** Those of it that said something unseen: its dot, which dragged away sees them all. */
89
89
  unseen: ChatEntry[];
90
90
  pinned: boolean;
91
- onOpen(): void;
92
- onPin(pinned: boolean): void;
91
+ /** It is of the archive. */
92
+ archived?: boolean;
93
+ onOpen(key: string, archived?: boolean): void;
94
+ onPin(key: string, pinned: boolean): void;
93
95
  actions: ChatRowActions;
94
- }): React.JSX.Element;
96
+ }
97
+ export declare const ChatFolderItem: React.MemoExoticComponent<({ folder, time, selected, unseen, pinned, archived, onOpen, onPin, actions, }: ChatFolderProps) => React.JSX.Element>;
95
98
  export declare const ChatItem: React.MemoExoticComponent<({ session, source, selected, time, compact, actions, restorable, task, doubleName, handable, pinned, unseen, asking, draft, }: ItemProps) => React.JSX.Element>;
96
99
  export {};
97
100
  //# sourceMappingURL=chat-list-row.d.ts.map
@@ -33,10 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ChatItem = void 0;
36
+ exports.ChatItem = exports.ChatFolderItem = void 0;
37
37
  exports.ChatAvatar = ChatAvatar;
38
38
  exports.ChatDot = ChatDot;
39
- exports.ChatFolderItem = ChatFolderItem;
40
39
  const lucide_react_1 = require("lucide-react");
41
40
  const React = __importStar(require("react"));
42
41
  const device_1 = require("../device/device");
@@ -110,12 +109,23 @@ function ChatDot({ unseen, asks, onSee }) {
110
109
  }
111
110
  return (React.createElement(unseen_drop_1.UnseenDrop, { className: unseen ? 'ta-chat-dot ta-on' : 'ta-chat-dot', label: unseen ? t('ta.chat.unseen') : undefined, onDismiss: unseen ? onSee : undefined }));
112
111
  }
113
- /**
114
- * The row of a folder (WebChatIcon.folder), as a messenger folds its subscriptions: its icon, its title, and the latest
115
- * of it with what it said; a dot while one of them said something unseen, a spinner while one works. It opens the folder,
116
- * and is pinned as a conversation is: from its menu, or a swipe to the left on a phone.
117
- */
118
- function ChatFolderItem({ folder, time, selected, unseen, pinned, onOpen, onPin, actions, }) {
112
+ /** Folders are made again as any conversation changes: one draws again only when what it shows of them does. */
113
+ function sameFolder(a, b) {
114
+ const same = (x, y) => x.length === y.length && x.every((one, i) => one === y[i]);
115
+ return (a.time === b.time &&
116
+ a.selected === b.selected &&
117
+ a.pinned === b.pinned &&
118
+ a.archived === b.archived &&
119
+ a.onOpen === b.onOpen &&
120
+ a.onPin === b.onPin &&
121
+ a.actions === b.actions &&
122
+ same(a.unseen, b.unseen) &&
123
+ a.folder.key === b.folder.key &&
124
+ a.folder.title === b.folder.title &&
125
+ a.folder.icon === b.folder.icon &&
126
+ same(a.folder.sessions, b.folder.sessions));
127
+ }
128
+ exports.ChatFolderItem = React.memo(function ChatFolderItem({ folder, time, selected, unseen, pinned, archived, onOpen, onPin, actions, }) {
119
129
  const t = (0, use_t_1.useT)();
120
130
  const onSee = () => {
121
131
  for (const session of unseen) {
@@ -127,10 +137,11 @@ function ChatFolderItem({ folder, time, selected, unseen, pinned, onOpen, onPin,
127
137
  const shown = chat_list_util_1.ChatListUtil.preview(latest, latestTitle);
128
138
  const said = shown && secret_text_1.SecretTextUtil.plain(t, shown);
129
139
  const working = folder.sessions.some(session => chat_list_util_1.ChatListUtil.isOpen(session) && session.isStreaming);
130
- const pin = { label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: () => onPin(!pinned) };
140
+ const pin = { label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: () => onPin(folder.key, !pinned) };
141
+ const open = () => onOpen(folder.key, archived);
131
142
  const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
132
- return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-chat-row ta-chat-folder${selected ? ' ta-selected' : ''}`, "data-row": folder.key, "data-unseen": unseen.length > 0 ? '' : undefined, actions: [{ key: 'pin', ...pin }], overlay: menu, onContextMenu: event => openMenu(event, context_menu_1.ContextMenuUtil.sections([{ label: t('ta.chat.open'), run: onOpen }], [pin])) },
133
- React.createElement("button", { type: "button", className: "ta-chat-item", title: `${folder.title} (${folder.sessions.length})`, "aria-current": selected ? 'true' : undefined, onClick: onOpen },
143
+ return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-chat-row ta-chat-folder${selected ? ' ta-selected' : ''}`, "data-row": folder.key, "data-unseen": unseen.length > 0 ? '' : undefined, actions: [{ key: 'pin', ...pin }], overlay: menu, onContextMenu: event => openMenu(event, context_menu_1.ContextMenuUtil.sections([{ label: t('ta.chat.open'), run: open }], [pin])) },
144
+ React.createElement("button", { type: "button", className: "ta-chat-item", title: `${folder.title} (${folder.sessions.length})`, "aria-current": selected ? 'true' : undefined, onClick: open },
134
145
  React.createElement("span", { className: "ta-chat-avatar-box" },
135
146
  React.createElement(chat_icon_1.ChatIconTile, { found: folder.icon, size: 38 }),
136
147
  React.createElement(ChatDot, { unseen: unseen.length > 0, asks: false, onSee: onSee })),
@@ -141,7 +152,7 @@ function ChatFolderItem({ folder, time, selected, unseen, pinned, onOpen, onPin,
141
152
  React.createElement("span", { className: "ta-chat-line" },
142
153
  React.createElement("span", { className: `ta-chat-sub${unseen.length > 0 ? ' ta-unseen' : ''}` }, said ? t('ta.chat.folderLatest', { title: latestTitle, said }) : latestTitle),
143
154
  working && React.createElement("span", { className: "ta-chat-state ta-spinner" }))))));
144
- }
155
+ }, sameFolder);
145
156
  exports.ChatItem = React.memo(function ChatItem({ session, source, selected, time, compact, actions, restorable, task, doubleName, handable, pinned, unseen, asking, draft, }) {
146
157
  var _a;
147
158
  const t = (0, use_t_1.useT)();
@@ -88,12 +88,7 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
88
88
  const sessionMenus = React.useContext(extension_view_1.SessionMenus);
89
89
  const latest = React.useRef({ chat, double, onPicked, t, pinned, onPinned, sessionMenus, onLetGo, onUnseen });
90
90
  latest.current = { chat, double, onPicked, t, pinned, onPinned, sessionMenus, onLetGo, onUnseen };
91
- const { picked, taskHome } = (0, chat_list_hooks_1.useTaskRows)(onPicked, home);
92
- // The last pinned first, as several may be: a conversation's file, a folder's key.
93
- const pinKey = React.useCallback((key, pin) => {
94
- const others = latest.current.pinned.filter(other => other !== key);
95
- latest.current.onPinned(pin ? [key, ...others] : others);
96
- }, []);
91
+ const { picked, taskHome, openItem, openFolder: opensFolder, pinKey } = (0, chat_list_hooks_1.useRowCalls)({ onPicked, home, openFolder, pinned, onPinned });
97
92
  const actions = React.useMemo(() => {
98
93
  const pick = (change) => {
99
94
  void change;
@@ -270,7 +265,7 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
270
265
  });
271
266
  // Into a folder from the top of its list, and back where the list was left.
272
267
  const listScroll = React.useRef(0);
273
- const openFolder = (key, archived) => {
268
+ function openFolder(key, archived) {
274
269
  var _a;
275
270
  var _b;
276
271
  listScroll.current = (_b = (_a = scroller.current) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0;
@@ -280,7 +275,7 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
280
275
  if (!archivedSaved && pinned.includes(key)) {
281
276
  readArchive();
282
277
  }
283
- };
278
+ }
284
279
  const closeFolder = () => {
285
280
  setFolderShown(current => (handheld && current ? { ...current, open: false } : undefined));
286
281
  setQuery('');
@@ -305,9 +300,9 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
305
300
  setFolderShown(undefined);
306
301
  }
307
302
  }, [folderShown, folder]);
308
- const folderItem = (row, archived) => (React.createElement(chat_list_row_1.ChatFolderItem, { key: row.key, folder: row, time: chat_list_util_1.ChatListUtil.clock(row.updatedAt, now), selected: row.sessions.some(isSelected), unseen: row.sessions.filter(isUnseen), pinned: pinnedKeys.has(row.key), onOpen: () => openFolder(row.key, archived), onPin: pin => pinKey(row.key, pin), actions: actions }));
303
+ const folderItem = (row, archived) => (React.createElement(chat_list_row_1.ChatFolderItem, { key: row.key, folder: row, time: chat_list_util_1.ChatListUtil.clock(row.updatedAt, now), selected: row.sessions.some(isSelected), unseen: row.sessions.filter(isUnseen), pinned: pinnedKeys.has(row.key), archived: archived, onOpen: opensFolder, onPin: pinKey, actions: actions }));
309
304
  const taskItem = (row) => home && (React.createElement(chat_home_1.ChatTaskItem, { key: row.key, task: row.task, home: taskHome, unseen: taskUnseen(row.task), time: chat_list_util_1.ChatListUtil.clock(row.updatedAt, now), onPicked: picked }));
310
- const homeItem = (row) => { var _a; return home && (React.createElement(chat_home_1.ChatHomeItem, { key: row.key, row: row, time: row.updatedAt ? chat_list_util_1.ChatListUtil.clock(row.updatedAt, now) : '', home: home, selected: !!row.item.sessionFile && isSelected((_a = byFile.get(row.item.sessionFile)) !== null && _a !== void 0 ? _a : row.item.sessionFile), pinned: pinnedKeys.has(row.key), onPin: pin => pinKey(row.key, pin) })); };
305
+ const homeItem = (row) => { var _a; var _b, _c; return home && (React.createElement(chat_home_1.ChatHomeItem, { key: row.key, row: row, time: row.updatedAt ? chat_list_util_1.ChatListUtil.clock(row.updatedAt, now) : '', shown: home.shownItem === ((_b = (_a = row.partner) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : row.item.key), openItem: openItem, selected: !!row.item.sessionFile && isSelected((_c = byFile.get(row.item.sessionFile)) !== null && _c !== void 0 ? _c : row.item.sessionFile), pinned: pinnedKeys.has(row.key), onPin: pinKey })); };
311
306
  const rowItem = (row, compact) => chat_list_util_1.ChatListUtil.isFolder(row) ? folderItem(row) : chat_list_util_1.ChatListUtil.isTask(row) ? taskItem(row) : chat_list_util_1.ChatListUtil.isHome(row) ? homeItem(row) : item(row, compact);
312
307
  // The conversation shown is found in the list, however it came to be shown: out of a search that hides it, and scrolled to.
313
308
  const scroller = React.useRef(null);