@celljs/ta-web 4.47.0 → 4.48.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 (269) hide show
  1. package/esm/browser/assistant/assistant-role.d.ts +1 -1
  2. package/esm/browser/assistant/assistant-role.js +1 -1
  3. package/esm/browser/assistant/assistant-task-source.js +6 -1
  4. package/esm/browser/assistant/assistant-task-util.d.ts +1 -0
  5. package/esm/browser/assistant/assistant-task-util.js +9 -3
  6. package/esm/browser/assistant/assistant-view.js +5 -2
  7. package/esm/browser/chat/chat-view.js +2 -1
  8. package/esm/browser/cloud/cloud-sign-in.d.ts +26 -4
  9. package/esm/browser/cloud/cloud-sign-in.js +88 -18
  10. package/esm/browser/components/app-nav.d.ts +3 -1
  11. package/esm/browser/components/app-nav.js +3 -3
  12. package/esm/browser/components/app-shell-state.js +11 -0
  13. package/esm/browser/components/app-view.js +16 -6
  14. package/esm/browser/components/asks-badge.d.ts +12 -0
  15. package/esm/browser/components/asks-badge.js +17 -1
  16. package/esm/browser/components/chat-list-row.d.ts +4 -1
  17. package/esm/browser/components/chat-list-row.js +7 -1
  18. package/esm/browser/components/chats-dot.d.ts +4 -1
  19. package/esm/browser/components/chats-dot.js +6 -2
  20. package/esm/browser/components/cloud-sign-in-view.d.ts +2 -1
  21. package/esm/browser/components/cloud-sign-in-view.js +28 -5
  22. package/esm/browser/components/composer-box-protocol.d.ts +5 -3
  23. package/esm/browser/components/composer-box.js +11 -11
  24. package/esm/browser/components/composer.d.ts +8 -1
  25. package/esm/browser/components/composer.js +57 -34
  26. package/esm/browser/components/discover-view.js +1 -1
  27. package/esm/browser/components/first-steps-util.d.ts +30 -0
  28. package/esm/browser/components/first-steps-util.js +36 -3
  29. package/esm/browser/components/host-view.d.ts +1 -1
  30. package/esm/browser/components/lightbox.d.ts +15 -1
  31. package/esm/browser/components/lightbox.js +14 -2
  32. package/esm/browser/components/link.js +8 -3
  33. package/esm/browser/components/list-rows.d.ts +1 -1
  34. package/esm/browser/components/list-rows.js +1 -1
  35. package/esm/browser/components/markdown.d.ts +4 -2
  36. package/esm/browser/components/markdown.js +13 -4
  37. package/esm/browser/components/media.d.ts +6 -0
  38. package/esm/browser/components/media.js +9 -1
  39. package/esm/browser/components/message-images.d.ts +5 -0
  40. package/esm/browser/components/message-images.js +40 -4
  41. package/esm/browser/components/message-user.js +4 -2
  42. package/esm/browser/components/partner-row.js +4 -4
  43. package/esm/browser/components/phone-hint.d.ts +6 -0
  44. package/esm/browser/components/phone-hint.js +63 -0
  45. package/esm/browser/components/phone-shell.d.ts +2 -0
  46. package/esm/browser/components/phone-shell.js +2 -2
  47. package/esm/browser/components/sending.d.ts +19 -0
  48. package/esm/browser/components/sending.js +27 -0
  49. package/esm/browser/components/session-view.js +5 -3
  50. package/esm/browser/components/settings-choices.js +1 -0
  51. package/esm/browser/components/settings-parts.js +28 -17
  52. package/esm/browser/components/share-dialog.js +3 -2
  53. package/esm/browser/components/share-item-sheet.js +1 -1
  54. package/esm/browser/components/share-sheet.d.ts +4 -2
  55. package/esm/browser/components/share-sheet.js +16 -2
  56. package/esm/browser/components/sign-in-accounts.js +7 -1
  57. package/esm/browser/components/unseen-drop.d.ts +2 -2
  58. package/esm/browser/components/unseen-drop.js +1 -1
  59. package/esm/browser/device/app-badge.d.ts +8 -0
  60. package/esm/browser/device/app-badge.js +28 -0
  61. package/esm/browser/device/code-scan.js +1 -1
  62. package/esm/browser/extension/web-api-code.d.ts +26 -0
  63. package/esm/browser/extension/web-api-components.d.ts +31 -0
  64. package/esm/browser/extension/web-api-menus.d.ts +15 -0
  65. package/esm/browser/extension/web-api-messages.d.ts +15 -0
  66. package/esm/browser/extension/web-api-messages.js +2 -0
  67. package/esm/browser/extension/web-api-partners.d.ts +16 -0
  68. package/esm/browser/extension/web-api-spec.js +1 -0
  69. package/esm/browser/extension/web-extension-api.d.ts +7 -13
  70. package/esm/browser/extension/web-extension-context.js +2 -0
  71. package/esm/browser/extension/web-session-notices.js +11 -2
  72. package/esm/browser/extension/web-share-ui.js +1 -0
  73. package/esm/browser/extension/web-share.js +3 -3
  74. package/esm/browser/extension/web-sharing.js +1 -1
  75. package/esm/browser/i18n/en/assistant.d.ts +2 -0
  76. package/esm/browser/i18n/en/assistant.js +2 -0
  77. package/esm/browser/i18n/en/chat.d.ts +11 -0
  78. package/esm/browser/i18n/en/chat.js +13 -2
  79. package/esm/browser/i18n/en/common.d.ts +4 -0
  80. package/esm/browser/i18n/en/common.js +4 -0
  81. package/esm/browser/i18n/en/service.d.ts +7 -0
  82. package/esm/browser/i18n/en/service.js +7 -0
  83. package/esm/browser/i18n/en/settings.d.ts +6 -0
  84. package/esm/browser/i18n/en/settings.js +8 -2
  85. package/esm/browser/i18n/ja/assistant.js +2 -0
  86. package/esm/browser/i18n/ja/chat.js +13 -2
  87. package/esm/browser/i18n/ja/common.js +4 -0
  88. package/esm/browser/i18n/ja/service.js +7 -0
  89. package/esm/browser/i18n/ja/settings.js +10 -4
  90. package/esm/browser/i18n/locales.d.ts +31 -1
  91. package/esm/browser/i18n/messages.d.ts +30 -0
  92. package/esm/browser/i18n/zh/assistant.js +2 -0
  93. package/esm/browser/i18n/zh/chat.js +13 -2
  94. package/esm/browser/i18n/zh/common.js +4 -0
  95. package/esm/browser/i18n/zh/service.js +7 -0
  96. package/esm/browser/i18n/zh/settings.js +8 -2
  97. package/esm/browser/i18n/zh-tw/assistant.js +2 -0
  98. package/esm/browser/i18n/zh-tw/chat.js +13 -2
  99. package/esm/browser/i18n/zh-tw/common.js +4 -0
  100. package/esm/browser/i18n/zh-tw/service.js +7 -0
  101. package/esm/browser/i18n/zh-tw/settings.js +8 -2
  102. package/esm/browser/links/links.js +1 -1
  103. package/esm/browser/notices/session-notices.d.ts +4 -4
  104. package/esm/browser/notices/session-notices.js +3 -6
  105. package/esm/browser/partners/partners-util.d.ts +6 -0
  106. package/esm/browser/partners/partners-util.js +22 -0
  107. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  108. package/esm/browser/settings/agent-settings.d.ts +2 -0
  109. package/esm/browser/settings/agent-settings.js +2 -0
  110. package/esm/browser/settings/settings-protocol.d.ts +8 -0
  111. package/esm/browser/settings/settings-protocol.js +5 -0
  112. package/esm/browser/style/base.d.ts +1 -1
  113. package/esm/browser/style/base.js +3 -0
  114. package/esm/browser/style/chat-list.d.ts +1 -1
  115. package/esm/browser/style/chat-list.js +8 -3
  116. package/esm/browser/style/conversation-column.d.ts +1 -1
  117. package/esm/browser/style/conversation-column.js +10 -1
  118. package/esm/browser/style/conversation.d.ts +1 -1
  119. package/esm/browser/style/conversation.js +18 -0
  120. package/esm/browser/style/phone.d.ts +1 -1
  121. package/esm/browser/style/phone.js +2 -0
  122. package/esm/browser/style/skins.d.ts +1 -1
  123. package/esm/browser/style/skins.js +1 -1
  124. package/esm/browser/util/composer.d.ts +18 -3
  125. package/esm/browser/util/composer.js +31 -5
  126. package/esm/browser/util/desktop.d.ts +8 -1
  127. package/esm/browser/util/desktop.js +10 -0
  128. package/esm/browser/util/image-shrink.d.ts +5 -1
  129. package/esm/browser/util/image-shrink.js +1 -1
  130. package/esm/browser/util/markdown.d.ts +3 -5
  131. package/esm/browser/util/markdown.js +5 -29
  132. package/esm/browser/util/process.js +2 -2
  133. package/lib/browser/assistant/assistant-role.d.ts +1 -1
  134. package/lib/browser/assistant/assistant-role.js +1 -1
  135. package/lib/browser/assistant/assistant-task-source.js +5 -0
  136. package/lib/browser/assistant/assistant-task-util.d.ts +1 -0
  137. package/lib/browser/assistant/assistant-task-util.js +8 -2
  138. package/lib/browser/assistant/assistant-view.js +5 -2
  139. package/lib/browser/chat/chat-view.js +2 -1
  140. package/lib/browser/cloud/cloud-sign-in.d.ts +26 -4
  141. package/lib/browser/cloud/cloud-sign-in.js +89 -19
  142. package/lib/browser/components/app-nav.d.ts +3 -1
  143. package/lib/browser/components/app-nav.js +2 -2
  144. package/lib/browser/components/app-shell-state.js +11 -0
  145. package/lib/browser/components/app-view.js +16 -6
  146. package/lib/browser/components/asks-badge.d.ts +12 -0
  147. package/lib/browser/components/asks-badge.js +19 -1
  148. package/lib/browser/components/chat-list-row.d.ts +4 -1
  149. package/lib/browser/components/chat-list-row.js +7 -1
  150. package/lib/browser/components/chats-dot.d.ts +4 -1
  151. package/lib/browser/components/chats-dot.js +6 -2
  152. package/lib/browser/components/cloud-sign-in-view.d.ts +2 -1
  153. package/lib/browser/components/cloud-sign-in-view.js +28 -5
  154. package/lib/browser/components/composer-box-protocol.d.ts +5 -3
  155. package/lib/browser/components/composer-box.js +11 -11
  156. package/lib/browser/components/composer.d.ts +8 -1
  157. package/lib/browser/components/composer.js +56 -33
  158. package/lib/browser/components/discover-view.js +1 -1
  159. package/lib/browser/components/first-steps-util.d.ts +30 -0
  160. package/lib/browser/components/first-steps-util.js +37 -4
  161. package/lib/browser/components/host-view.d.ts +1 -1
  162. package/lib/browser/components/lightbox.d.ts +15 -1
  163. package/lib/browser/components/lightbox.js +15 -2
  164. package/lib/browser/components/link.js +8 -3
  165. package/lib/browser/components/list-rows.d.ts +1 -1
  166. package/lib/browser/components/list-rows.js +1 -1
  167. package/lib/browser/components/markdown.d.ts +4 -2
  168. package/lib/browser/components/markdown.js +11 -2
  169. package/lib/browser/components/media.d.ts +6 -0
  170. package/lib/browser/components/media.js +10 -2
  171. package/lib/browser/components/message-images.d.ts +5 -0
  172. package/lib/browser/components/message-images.js +40 -4
  173. package/lib/browser/components/message-user.js +4 -2
  174. package/lib/browser/components/partner-row.js +4 -4
  175. package/lib/browser/components/phone-hint.d.ts +7 -0
  176. package/lib/browser/components/phone-hint.js +99 -0
  177. package/lib/browser/components/phone-shell.d.ts +2 -0
  178. package/lib/browser/components/phone-shell.js +1 -1
  179. package/lib/browser/components/sending.d.ts +20 -0
  180. package/lib/browser/components/sending.js +63 -0
  181. package/lib/browser/components/session-view.js +5 -3
  182. package/lib/browser/components/settings-choices.js +1 -0
  183. package/lib/browser/components/settings-parts.js +26 -15
  184. package/lib/browser/components/share-dialog.js +3 -2
  185. package/lib/browser/components/share-item-sheet.js +1 -1
  186. package/lib/browser/components/share-sheet.d.ts +4 -2
  187. package/lib/browser/components/share-sheet.js +16 -2
  188. package/lib/browser/components/sign-in-accounts.js +7 -1
  189. package/lib/browser/components/unseen-drop.d.ts +2 -2
  190. package/lib/browser/components/unseen-drop.js +1 -1
  191. package/lib/browser/device/app-badge.d.ts +9 -0
  192. package/lib/browser/device/app-badge.js +31 -0
  193. package/lib/browser/device/code-scan.js +1 -1
  194. package/lib/browser/extension/web-api-code.d.ts +26 -0
  195. package/lib/browser/extension/web-api-components.d.ts +31 -0
  196. package/lib/browser/extension/web-api-menus.d.ts +15 -0
  197. package/lib/browser/extension/web-api-messages.d.ts +16 -0
  198. package/lib/browser/extension/web-api-messages.js +3 -0
  199. package/lib/browser/extension/web-api-partners.d.ts +16 -0
  200. package/lib/browser/extension/web-api-spec.js +1 -0
  201. package/lib/browser/extension/web-extension-api.d.ts +7 -13
  202. package/lib/browser/extension/web-extension-context.js +2 -0
  203. package/lib/browser/extension/web-session-notices.js +10 -1
  204. package/lib/browser/extension/web-share-ui.js +1 -0
  205. package/lib/browser/extension/web-share.js +3 -3
  206. package/lib/browser/extension/web-sharing.js +1 -1
  207. package/lib/browser/i18n/en/assistant.d.ts +2 -0
  208. package/lib/browser/i18n/en/assistant.js +2 -0
  209. package/lib/browser/i18n/en/chat.d.ts +11 -0
  210. package/lib/browser/i18n/en/chat.js +13 -2
  211. package/lib/browser/i18n/en/common.d.ts +4 -0
  212. package/lib/browser/i18n/en/common.js +4 -0
  213. package/lib/browser/i18n/en/service.d.ts +7 -0
  214. package/lib/browser/i18n/en/service.js +7 -0
  215. package/lib/browser/i18n/en/settings.d.ts +6 -0
  216. package/lib/browser/i18n/en/settings.js +8 -2
  217. package/lib/browser/i18n/ja/assistant.js +2 -0
  218. package/lib/browser/i18n/ja/chat.js +13 -2
  219. package/lib/browser/i18n/ja/common.js +4 -0
  220. package/lib/browser/i18n/ja/service.js +7 -0
  221. package/lib/browser/i18n/ja/settings.js +10 -4
  222. package/lib/browser/i18n/locales.d.ts +31 -1
  223. package/lib/browser/i18n/messages.d.ts +30 -0
  224. package/lib/browser/i18n/zh/assistant.js +2 -0
  225. package/lib/browser/i18n/zh/chat.js +13 -2
  226. package/lib/browser/i18n/zh/common.js +4 -0
  227. package/lib/browser/i18n/zh/service.js +7 -0
  228. package/lib/browser/i18n/zh/settings.js +8 -2
  229. package/lib/browser/i18n/zh-tw/assistant.js +2 -0
  230. package/lib/browser/i18n/zh-tw/chat.js +13 -2
  231. package/lib/browser/i18n/zh-tw/common.js +4 -0
  232. package/lib/browser/i18n/zh-tw/service.js +7 -0
  233. package/lib/browser/i18n/zh-tw/settings.js +8 -2
  234. package/lib/browser/links/links.js +1 -1
  235. package/lib/browser/notices/session-notices.d.ts +4 -4
  236. package/lib/browser/notices/session-notices.js +3 -6
  237. package/lib/browser/partners/partners-util.d.ts +6 -0
  238. package/lib/browser/partners/partners-util.js +22 -0
  239. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  240. package/lib/browser/settings/agent-settings.d.ts +2 -0
  241. package/lib/browser/settings/agent-settings.js +3 -1
  242. package/lib/browser/settings/settings-protocol.d.ts +8 -0
  243. package/lib/browser/settings/settings-protocol.js +6 -1
  244. package/lib/browser/style/base.d.ts +1 -1
  245. package/lib/browser/style/base.js +3 -0
  246. package/lib/browser/style/chat-list.d.ts +1 -1
  247. package/lib/browser/style/chat-list.js +8 -3
  248. package/lib/browser/style/conversation-column.d.ts +1 -1
  249. package/lib/browser/style/conversation-column.js +10 -1
  250. package/lib/browser/style/conversation.d.ts +1 -1
  251. package/lib/browser/style/conversation.js +18 -0
  252. package/lib/browser/style/phone.d.ts +1 -1
  253. package/lib/browser/style/phone.js +2 -0
  254. package/lib/browser/style/skins.d.ts +1 -1
  255. package/lib/browser/style/skins.js +1 -1
  256. package/lib/browser/util/composer.d.ts +18 -3
  257. package/lib/browser/util/composer.js +31 -5
  258. package/lib/browser/util/desktop.d.ts +8 -1
  259. package/lib/browser/util/desktop.js +10 -0
  260. package/lib/browser/util/image-shrink.d.ts +5 -1
  261. package/lib/browser/util/image-shrink.js +1 -1
  262. package/lib/browser/util/markdown.d.ts +3 -5
  263. package/lib/browser/util/markdown.js +5 -29
  264. package/lib/browser/util/process.js +1 -1
  265. package/package.json +7 -7
  266. package/esm/browser/util/share-link.d.ts +0 -21
  267. package/esm/browser/util/share-link.js +0 -61
  268. package/lib/browser/util/share-link.d.ts +0 -22
  269. package/lib/browser/util/share-link.js +0 -64
@@ -68,7 +68,7 @@ const voice_talk_1 = require("./voice-talk");
68
68
  let talkFirst = false;
69
69
  exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
70
70
  var _a;
71
- const { placeholder, working = false, compacting = false, onStop, onSend, commands = [], onArgumentQuery, argumentItems, onMentionQuery, mentions, mentionLabel, images: takesImages, emoji: takesEmoji, recentShots, actions = [], above, head, after, voiceSends, talkPlace, onTalkSent, onTalkCall, talkCalls = ['keep', 'call'], onListening, autoFocus, onTextChange, draft, cwd, onError, } = props;
71
+ const { placeholder, working = false, compacting = false, onStop, onSend, sendTitle, commands = [], onArgumentQuery, argumentItems, onMentionQuery, mentions, mentionLabel, images: takesImages, emoji: takesEmoji, recentShots, actions = [], above, head, after, voiceSends, talkPlace, onTalkSent, onTalkCall, talkCalls = ['keep', 'call'], onListening, autoFocus, onTextChange, draft, cwd, onError, } = props;
72
72
  const t = (0, use_t_1.useT)();
73
73
  const drafts = (0, use_composer_draft_1.useTaDrafts)();
74
74
  const [text, setText] = React.useState(() => { var _a; var _b; return (_b = (draft === undefined ? undefined : (_a = drafts === null || drafts === void 0 ? void 0 : drafts.get(draft)) === null || _a === void 0 ? void 0 : _a.text)) !== null && _b !== void 0 ? _b : ''; });
@@ -211,7 +211,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
211
211
  /** A command, or what follows it, typed out in full: Enter sends it rather than picking it again. */
212
212
  const typed = (item) => ((trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'command' && (item === null || item === void 0 ? void 0 : item.label) === text.trim()) || ((trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'argument' && (item === null || item === void 0 ? void 0 : item.key.trim()) === trigger.query.trim());
213
213
  /** Sends; the sending, which fails as it does (what was sent back in the box), or nothing when there is nothing to send. */
214
- const send = (followUp, message = text.trim()) => {
214
+ const send = (key, message = text.trim()) => {
215
215
  if ((!message && !attachments.length) || reading) {
216
216
  return undefined;
217
217
  }
@@ -219,7 +219,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
219
219
  setText('');
220
220
  setCaret(0);
221
221
  setAttachments([]);
222
- const sent = onSend(message, composer_1.ComposerUtil.images(attached), followUp);
222
+ const sent = onSend(message, composer_1.ComposerUtil.images(attached), key);
223
223
  sent.then(() => composer_1.ComposerUtil.release(attached), error => {
224
224
  setText(message);
225
225
  setAttachments(attached);
@@ -236,7 +236,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
236
236
  const talk = (0, voice_talk_1.useVoiceTalk)((words, zone) => {
237
237
  if ((zone === 'keep' || zone === 'call') && onTalkCall) {
238
238
  const message = words && composer_1.ComposerUtil.insert(latest.current, latestCaret.current, words)[0].trim();
239
- const sent = message && !readingNow.current ? send(false, message) : undefined;
239
+ const sent = message && !readingNow.current ? send('enter', message) : undefined;
240
240
  if (message && !sent) {
241
241
  // An image still being read holds the message back: it waits in the box, the call listens.
242
242
  edit(message, message.length);
@@ -250,7 +250,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
250
250
  const [message, position] = composer_1.ComposerUtil.insert(latest.current, latestCaret.current, words);
251
251
  // An image still being read would hold the message back: it waits in the box instead.
252
252
  if (zone === 'send' && !readingNow.current) {
253
- send(false, message.trim());
253
+ send('enter', message.trim());
254
254
  onTalkSent === null || onTalkSent === void 0 ? void 0 : onTalkSent();
255
255
  }
256
256
  else {
@@ -291,7 +291,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
291
291
  React.createElement(icon_1.Icon, { icon: talkMode ? lucide_react_1.Keyboard : lucide_react_1.Mic, size: 18 }))) : (React.createElement(voice_button_1.VoiceButton, { hints: hints, onListening: listen, onText: words => {
292
292
  setText(speech(words));
293
293
  setCaret(spoken.current.before.length + words.length);
294
- }, onHeard: words => (voiceSends ? send(false, speech(words).trim()) : edit(speech(words), spoken.current.before.length + words.length)), onError: onError }));
294
+ }, onHeard: words => (voiceSends ? send('enter', speech(words).trim()) : edit(speech(words), spoken.current.before.length + words.length)), onError: onError }));
295
295
  // A finger held on the box while the keyboard is down talks (the field takes no finger then, .ta-talkable: a tap
296
296
  // on it is the box's, which types in it). With the keyboard up, the field and the box are the system's.
297
297
  const held = (0, hold_1.useHeld)();
@@ -364,7 +364,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
364
364
  }
365
365
  else if (composer_1.ComposerUtil.isSend({ key: event.key, shiftKey: event.shiftKey, isComposing: event.nativeEvent.isComposing, keyCode: event.keyCode })) {
366
366
  event.preventDefault();
367
- send(event.altKey);
367
+ send(event.metaKey || event.ctrlKey ? 'now' : event.altKey ? 'alt' : 'enter');
368
368
  }
369
369
  else if (event.key === 'Escape' && busy && onStop) {
370
370
  event.preventDefault();
@@ -468,12 +468,12 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
468
468
  ? t(stopping ? 'ta.composer.stopping' : 'ta.composer.stopTitle')
469
469
  : reading
470
470
  ? t('ta.composer.imageLoading')
471
- : working
472
- ? t('ta.composer.steerTitle')
471
+ : working && sendTitle
472
+ ? sendTitle
473
473
  : t('ta.send'), "aria-label": action === 'stop' ? t(stopping ? 'ta.composer.stopping' : 'ta.stop') : t('ta.send'), "aria-busy": action === 'stop' && stopping, "data-ta-action": action === 'stop' ? 'stop' : 'send',
474
474
  // Pressed with the keyboard open, the box keeps the focus and the keyboard stays, as in WeChat.
475
- onPointerDown: event => document.activeElement === input.current && event.preventDefault(), onClick: () => (action === 'stop' ? stop() : send(false)) }, action === 'stop' && stopping ? (React.createElement("span", { className: "ta-spinner" })) : (React.createElement(icon_1.Icon, { icon: action === 'stop' ? lucide_react_1.Square : lucide_react_1.ArrowUp, size: action === 'stop' ? 14 : 18 }))))),
476
- takesEmoji && handheld && (emojis.open || emojis.closing) && (React.createElement(emoji_panel_1.EmojiPanel, { ref: emojis.panel, docked: true, closing: !emojis.open, onClosed: emojis.closed, onPick: emoji => type(...emoji_panel_1.EmojiPanelUtil.insert(text, caret, emoji)), onDelete: () => type(...emoji_panel_1.EmojiPanelUtil.deleteBack(text, caret)), sendable: sendable && !reading, onSend: () => void send(false) })),
475
+ onPointerDown: event => document.activeElement === input.current && event.preventDefault(), onClick: () => (action === 'stop' ? stop() : send('enter')) }, action === 'stop' && stopping ? (React.createElement("span", { className: "ta-spinner" })) : (React.createElement(icon_1.Icon, { icon: action === 'stop' ? lucide_react_1.Square : lucide_react_1.ArrowUp, size: action === 'stop' ? 14 : 18 }))))),
476
+ takesEmoji && handheld && (emojis.open || emojis.closing) && (React.createElement(emoji_panel_1.EmojiPanel, { ref: emojis.panel, docked: true, closing: !emojis.open, onClosed: emojis.closed, onPick: emoji => type(...emoji_panel_1.EmojiPanelUtil.insert(text, caret, emoji)), onDelete: () => type(...emoji_panel_1.EmojiPanelUtil.deleteBack(text, caret)), sendable: sendable && !reading, onSend: () => void send('enter') })),
477
477
  handheld && (menu || closing) && sections.length > 0 && (React.createElement(plus_menu_1.PlusMenu, { ref: panel, sections: sections, docked: true, closing: !menu, onClosed: () => setClosing(false), onClose: closeMenu }))));
478
478
  });
479
479
  //# sourceMappingURL=composer-box.js.map
@@ -1,6 +1,7 @@
1
1
  import type { SessionStore } from '@celljs/ta-client';
2
2
  import { type TaServer, type TaSlashCommand, type TaWorkspaceServer } from '@celljs/ta-protocol';
3
3
  import * as React from 'react';
4
+ import type { SendWhileWorking } from '../settings/settings-protocol';
4
5
  import { type ComposerImage, type ComposerQueued } from '../util/composer';
5
6
  import type { ComposerAction, ComposerBoxHandle, ComposerBoxProps } from './composer-box-protocol';
6
7
  import type { TalkPlace } from './held-talk';
@@ -51,6 +52,10 @@ export interface ComposerProps {
51
52
  onTyping?(typing: boolean): void;
52
53
  /** Where what is typed is kept until it is sent (DraftPlaces, ComposerBoxProps.draft). */
53
54
  draft?: string;
55
+ /** What a message sent while the agent works does (the setting `sendWhileWorking`); default: it steers. */
56
+ sendWhileWorking?: SendWhileWorking;
57
+ /** Opens the settings of what is sent while the agent works, from the list of what waits. */
58
+ onQueueSettings?(): void;
54
59
  onError(error: unknown): void;
55
60
  }
56
61
  /**
@@ -59,9 +64,11 @@ export interface ComposerProps {
59
64
  */
60
65
  export declare const Composer: React.ForwardRefExoticComponent<ComposerProps & React.RefAttributes<ComposerBoxHandle>>;
61
66
  /** What waits to be sent, tucked on top of the box: as the conversation will show it, the package that sent it apart. */
62
- export declare function QueuedMessages({ waiting, onTakeBack, onRemove, }: {
67
+ export declare function QueuedMessages({ waiting, onTakeBack, onRemove, onSendNow, onSettings, }: {
63
68
  waiting: ComposerQueued[];
64
69
  onTakeBack(): void;
65
70
  onRemove(entry: ComposerQueued, back: boolean): void;
71
+ onSendNow?(entry: ComposerQueued): void;
72
+ onSettings?(): void;
66
73
  }): React.JSX.Element;
67
74
  //# sourceMappingURL=composer.d.ts.map
@@ -41,6 +41,7 @@ const React = __importStar(require("react"));
41
41
  const assistant_task_util_1 = require("../assistant/assistant-task-util");
42
42
  const device_1 = require("../device/device");
43
43
  const use_t_1 = require("../i18n/use-t");
44
+ const agent_settings_1 = require("../settings/agent-settings");
44
45
  const composer_1 = require("../util/composer");
45
46
  const message_1 = require("../util/message");
46
47
  const composer_box_1 = require("./composer-box");
@@ -113,33 +114,33 @@ function useArgumentCompletions(server, sessionId, query) {
113
114
  }, [server, sessionId, command, prefix]);
114
115
  return command !== undefined && (offer === null || offer === void 0 ? void 0 : offer.command) === command ? offer.items : undefined;
115
116
  }
116
- /** The messages waiting for the agent, from pi's `queue_update`. */
117
- function useQueue(store, working) {
118
- const [queue, setQueue] = React.useState(EMPTY_QUEUE);
119
- React.useEffect(() => store === null || store === void 0 ? void 0 : store.onEvent(event => {
120
- if (event.type === 'queue_update') {
121
- setQueue({ steering: [...event.steering], followUp: [...event.followUp] });
122
- }
123
- }), [store]);
117
+ /**
118
+ * The messages waiting for the agent, as the session has them (SessionState.queue): also after a run that stopped,
119
+ * which leaves them for the next. One taken out here is gone at once, until the session tells the queue again.
120
+ */
121
+ function useQueue(store) {
122
+ const [told, setTold] = React.useState(() => store === null || store === void 0 ? void 0 : store.state.queue);
124
123
  React.useEffect(() => {
125
- if (!working) {
126
- setQueue(EMPTY_QUEUE);
127
- }
128
- }, [working]);
129
- return [queue, setQueue];
124
+ setTold(store === null || store === void 0 ? void 0 : store.state.queue);
125
+ return store === null || store === void 0 ? void 0 : store.subscribe(state => setTold(state.queue));
126
+ }, [store]);
127
+ const [changed, setChanged] = React.useState();
128
+ const queue = changed && changed.of === told ? changed.queue : (told !== null && told !== void 0 ? told : EMPTY_QUEUE);
129
+ return [queue, next => setChanged({ of: told, queue: next })];
130
130
  }
131
131
  /**
132
132
  * The message box of a session, with the keys of pi's terminal: while the agent works, Enter steers it
133
133
  * and Alt+Enter queues a follow-up; Escape stops it.
134
134
  */
135
135
  exports.Composer = React.forwardRef(function Composer(props, ref) {
136
- const { store, onSubmit, head, after, voiceSends, recentShots, talkPlace, onTalkSent, onTalkCall, talkCalls, onListening, server, workspace, working, compacting = false, commands, cwd, actions, placeholder, above, onSending, onStop, onStopTimed, onTyping, draft, onError, } = props;
136
+ const { store, onSubmit, head, after, voiceSends, recentShots, talkPlace, onTalkSent, onTalkCall, talkCalls, onListening, server, workspace, working, compacting = false, commands, cwd, actions, placeholder, above, onSending, onStop, onStopTimed, onTyping, draft, sendWhileWorking = 'steer', onQueueSettings, onError, } = props;
137
137
  // A finger: the keyboard opens on focus, over the conversation, and there are no keys to name.
138
138
  const touch = (0, device_1.useDevice)(device => device.touch);
139
139
  const t = (0, use_t_1.useT)();
140
140
  const language = (0, use_t_1.useLanguage)();
141
141
  const listed = React.useMemo(() => commands.map(command => ({ name: command.name, description: composer_1.ComposerUtil.commandDescription(command, language, t), completes: command.completes })), [commands, language, t]);
142
- const [queue, setQueue] = useQueue(store, working);
142
+ const [queue, setQueue] = useQueue(store);
143
+ const keyNames = React.useMemo(() => composer_1.ComposerUtil.keyNames(agent_settings_1.ShortcutUtil.isMac()), []);
143
144
  const [query, setQuery] = React.useState();
144
145
  const files = useFiles(workspace, cwd, query);
145
146
  const [argumentQuery, setArgumentQuery] = React.useState();
@@ -176,10 +177,15 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
176
177
  // into the box. Not one of a scheduled task, a group or another device: only what was last sent here.
177
178
  const last = ((_a = box.current) === null || _a === void 0 ? void 0 : _a.text().trim()) ? undefined : message_1.MessageUtil.unanswered(store.state.messages);
178
179
  const unanswered = last && lastSent && (0, message_user_1.userWords)(message_1.MessageUtil.blocks(last)).text.includes(lastSent) ? last : undefined;
179
- return server.abort(store.sessionId).then(() => {
180
+ const waited = composer_1.ComposerUtil.queued(queue).length > 0;
181
+ return server.abort(store.sessionId).then(async () => {
180
182
  timed(clock, clock.answered(performance.now()));
181
183
  if (unanswered) {
182
- void takeBackUnanswered(unanswered);
184
+ await takeBackUnanswered(unanswered);
185
+ }
186
+ // What waited would go with the next message, unseen: back into the box, after what came back, as pi's terminal does.
187
+ if (waited) {
188
+ takeBack(true);
183
189
  }
184
190
  }, error => {
185
191
  timed(clock, clock.answered(performance.now(), true));
@@ -207,32 +213,44 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
207
213
  // The run was stopped all the same; the message stays in the conversation.
208
214
  }
209
215
  };
210
- const send = (message, images, followUp) => {
216
+ const send = (message, images, key) => {
211
217
  var _a;
212
218
  onSending === null || onSending === void 0 ? void 0 : onSending();
213
219
  onTyping === null || onTyping === void 0 ? void 0 : onTyping(false);
214
220
  const prompt = { clientMessageId: crypto.randomUUID(), message, images: images.length ? images : undefined };
215
- if (!working) {
221
+ const how = working ? composer_1.ComposerUtil.whileWorking(sendWhileWorking, key) : undefined;
222
+ if (!how || how === 'interrupt') {
216
223
  lastSent = message.trim();
217
224
  }
218
225
  if (!store) {
219
226
  return (_a = onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(message, prompt.images)) !== null && _a !== void 0 ? _a : Promise.resolve();
220
227
  }
221
- // A message that fails to go stays in the conversation, marked, to send again: not back in the box.
222
- return !working
223
- ? store.send(message, { images: prompt.images })
224
- : followUp
225
- ? server.followUp(store.sessionId, prompt)
226
- : server.steer(store.sessionId, prompt);
228
+ // A message that fails to go stays in the conversation, marked, to send again: not back in the box. One sent
229
+ // now shows in it at once, on its way, as the run stops.
230
+ if (!how || how === 'interrupt') {
231
+ return store.send(message, { images: prompt.images, ...(how ? { streamingBehavior: how } : {}) });
232
+ }
233
+ return how === 'followUp' ? server.followUp(store.sessionId, prompt) : server.steer(store.sessionId, prompt);
234
+ };
235
+ /** A waiting message goes now: the run stops, and it starts the next. */
236
+ const sendNow = (entry) => {
237
+ if (!store) {
238
+ return;
239
+ }
240
+ onSending === null || onSending === void 0 ? void 0 : onSending();
241
+ setQueue(composer_1.ComposerUtil.without(queue, entry));
242
+ server.sendNow(store.sessionId, entry.kind, entry.index).catch(onError);
227
243
  };
228
- const takeBack = () => {
244
+ /** Takes all that waits back into the box: before what is typed, or after it (`after`). */
245
+ const takeBack = (after = false) => {
229
246
  if (!store) {
230
247
  return;
231
248
  }
232
249
  server.clearQueue(store.sessionId).then(taken => {
233
250
  var _a;
234
251
  setQueue(EMPTY_QUEUE);
235
- (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(composer_1.ComposerUtil.restore({ steering: said(taken.steering), followUp: said(taken.followUp) }, box.current.text()));
252
+ const back = { steering: said(taken.steering), followUp: said(taken.followUp) };
253
+ (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(composer_1.ComposerUtil.restore(back, box.current.text(), after));
236
254
  }, onError);
237
255
  };
238
256
  /** Takes one message out; into the box when `back`. */
@@ -249,18 +267,20 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
249
267
  }, onError);
250
268
  };
251
269
  const waiting = composer_1.ComposerUtil.queued(queue);
252
- return (React.createElement(composer_box_1.ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(composer_1.ComposerUtil.placeholderKey(working, touch)), working: working, compacting: compacting, onStop: stop, onSend: send, commands: listed, onArgumentQuery: setArgumentQuery, argumentItems: argumentItems, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, recentShots: recentShots, actions: actions, head: head, after: after, voiceSends: voiceSends, talkPlace: talkPlace, onTalkSent: onTalkSent, onTalkCall: onTalkCall, talkCalls: talkCalls, onListening: onListening, autoFocus: !touch, onTextChange: onTyping && (text => onTyping(!!text.trim())), draft: draft, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
270
+ return (React.createElement(composer_box_1.ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(composer_1.ComposerUtil.placeholderKey(working, touch, sendWhileWorking), keyNames), sendTitle: t(composer_1.ComposerUtil.sendTitleKey(sendWhileWorking), keyNames), working: working, compacting: compacting, onStop: stop, onSend: send, commands: listed, onArgumentQuery: setArgumentQuery, argumentItems: argumentItems, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, recentShots: recentShots, actions: actions, head: head, after: after, voiceSends: voiceSends, talkPlace: talkPlace, onTalkSent: onTalkSent, onTalkCall: onTalkCall, talkCalls: talkCalls, onListening: onListening, autoFocus: !touch, onTextChange: onTyping && (text => onTyping(!!text.trim())), draft: draft, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
253
271
  above,
254
- waiting.length > 0 && React.createElement(QueuedMessages, { waiting: waiting, onTakeBack: takeBack, onRemove: remove })) }));
272
+ waiting.length > 0 && (React.createElement(QueuedMessages, { waiting: waiting, onTakeBack: () => takeBack(), onRemove: remove, onSendNow: sendNow, onSettings: onQueueSettings }))) }));
255
273
  });
256
274
  /** What waits to be sent, tucked on top of the box: as the conversation will show it, the package that sent it apart. */
257
- function QueuedMessages({ waiting, onTakeBack, onRemove, }) {
275
+ function QueuedMessages({ waiting, onTakeBack, onRemove, onSendNow, onSettings, }) {
258
276
  const t = (0, use_t_1.useT)();
259
277
  const { me, ownerName } = React.useContext(people_1.MessagePeople);
260
278
  return (React.createElement("div", { className: "ta-queue", "aria-live": "polite" },
261
- waiting.length > 1 && (React.createElement("div", { className: "ta-queue-head" },
279
+ (waiting.length > 1 || onSettings) && (React.createElement("div", { className: "ta-queue-head" },
262
280
  React.createElement("span", null, t('ta.composer.queue.count', { count: waiting.length })),
263
- React.createElement("button", { type: "button", className: "ta-queue-all", onClick: onTakeBack, title: t('ta.composer.queue.takeBackTitle') }, t('ta.composer.queue.takeBackAll')))),
281
+ waiting.length > 1 && (React.createElement("button", { type: "button", className: "ta-queue-all", onClick: onTakeBack, title: t('ta.composer.queue.takeBackTitle') }, t('ta.composer.queue.takeBackAll'))),
282
+ onSettings && (React.createElement("button", { type: "button", className: "ta-icon-button ta-queue-settings", onClick: onSettings, title: t('ta.composer.queue.settings'), "aria-label": t('ta.composer.queue.settings') },
283
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.Settings2, size: 13 }))))),
264
284
  waiting.map(entry => {
265
285
  var _a, _b, _c, _d;
266
286
  const note = assistant_task_util_1.AssistantTaskUtil.noteOf(entry.text);
@@ -283,7 +303,10 @@ function QueuedMessages({ waiting, onTakeBack, onRemove, }) {
283
303
  !note && mine && (React.createElement("button", { type: "button", className: "ta-icon-button", onClick: () => onRemove(entry, true), title: t('ta.composer.queue.editTitle'), "aria-label": t('ta.composer.queue.editTitle') },
284
304
  React.createElement(icon_1.Icon, { icon: lucide_react_1.PenLine, size: 13 }))),
285
305
  React.createElement("button", { type: "button", className: "ta-icon-button", onClick: () => onRemove(entry, false), title: t('ta.composer.queue.remove'), "aria-label": t('ta.composer.queue.remove') },
286
- React.createElement(icon_1.Icon, { icon: lucide_react_1.X, size: 13 })))));
306
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.X, size: 13 }))),
307
+ onSendNow && (mine || me === ta_protocol_1.TA_OWNER) && (React.createElement("button", { type: "button", className: "ta-queue-now", onClick: () => onSendNow(entry), title: t('ta.composer.queue.sendNowTitle') },
308
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.ArrowUp, size: 12 }),
309
+ React.createElement("span", null, t('ta.composer.queue.sendNow'))))));
287
310
  })));
288
311
  }
289
312
  //# sourceMappingURL=composer.js.map
@@ -93,7 +93,7 @@ function DiscoverView({ pages, onOpenPages, onOpen, onPin, onSettings, onScan, l
93
93
  React.createElement("div", { className: "ta-list-content" },
94
94
  (0, nav_places_1.discoverGroups)(entries).map(({ group, pages: rows }) => (React.createElement(list_rows_1.ListGroup, { key: group }, rows.map(row)))),
95
95
  React.createElement(list_rows_1.ListGroup, null,
96
- React.createElement(list_rows_1.ListRow, { label: t('ta.discover.showAll'), action: true, onClick: () => onAllFeatures(!!first), trailing: React.createElement(settings_controls_1.Switch, { label: t('ta.discover.showAll'), checked: !first, onChange: onAllFeatures }) })),
96
+ React.createElement(list_rows_1.ListRow, { label: t('ta.discover.showAll'), onClick: () => onAllFeatures(!!first), trailing: React.createElement(settings_controls_1.Switch, { label: t('ta.discover.showAll'), checked: !first, onChange: onAllFeatures }) })),
97
97
  React.createElement("p", { className: "ta-list-hint" }, t('ta.discover.allHint')))),
98
98
  menu));
99
99
  }
@@ -4,7 +4,16 @@ import type { StateSpec } from '../state/state-protocol';
4
4
  export interface FirstStepsKept {
5
5
  openedAt?: number;
6
6
  replied?: boolean;
7
+ /** When a newcomer's first conversation was answered (none for one of a Ta of before). */
8
+ repliedAt?: number;
9
+ /** The line that offers to connect a phone (FirstStepsUtil.phoneHint): when it first showed, and whether it is done with. */
10
+ phone?: {
11
+ at?: number;
12
+ done?: boolean;
13
+ };
7
14
  }
15
+ /** How long the line that offers a phone stays, from when it first showed, unless the user acted on it before. */
16
+ export declare const PHONE_HINT_MS: number;
8
17
  /** A count of the first steps (`step:<step>` of Ta's own metrics), with the time it took. */
9
18
  export interface FirstStep {
10
19
  item: string;
@@ -18,6 +27,17 @@ export declare namespace FirstStepsUtil {
18
27
  const STATE: StateSpec<FirstStepsKept>;
19
28
  /** Whether a conversation was answered (a message and what came after it), open or saved. */
20
29
  function answered(open: readonly Pick<TaSessionInfo, 'messageCount'>[], saved: readonly Pick<TaSavedSessionInfo, 'messageCount'>[]): boolean;
30
+ /**
31
+ * Whether the page opens on the double rather than on a new conversation (docs/design/ta-simple.md 4.2, 11): one
32
+ * start for a newcomer, nothing answered yet and nothing else to show. A phone opens on its list, where the double is
33
+ * the first row; a page or a conversation the tab had stays.
34
+ */
35
+ function startOnDouble(at: {
36
+ phone: boolean;
37
+ page: string | undefined;
38
+ conversation: boolean;
39
+ answered: boolean;
40
+ }): boolean;
21
41
  /**
22
42
  * What to keep and count now; nothing once done. One who had conversations answered before it was kept (a Ta of
23
43
  * before) is no newcomer: kept as done, not counted.
@@ -26,5 +46,15 @@ export declare namespace FirstStepsUtil {
26
46
  kept?: FirstStepsKept;
27
47
  steps: FirstStep[];
28
48
  };
49
+ /**
50
+ * Whether the line that offers to use Ta from a phone shows above the box (docs/design/ta-simple.md 4.6, 12): once,
51
+ * after a newcomer's first conversation was answered, on a computer with no phone paired yet; it stays for
52
+ * PHONE_HINT_MS from when it first showed, until the user pairs one or closes it.
53
+ */
54
+ function phoneHint(kept: FirstStepsKept, at: {
55
+ handheld: boolean;
56
+ paired: number;
57
+ now: number;
58
+ }): boolean;
29
59
  }
30
60
  //# sourceMappingURL=first-steps-util.d.ts.map
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FirstStepsUtil = void 0;
3
+ exports.FirstStepsUtil = exports.PHONE_HINT_MS = void 0;
4
4
  const ta_protocol_1 = require("@celljs/ta-protocol");
5
+ /** How long the line that offers a phone stays, from when it first showed, unless the user acted on it before. */
6
+ exports.PHONE_HINT_MS = 24 * 60 * 60 * 1000;
5
7
  /**
6
8
  * The first steps of a newcomer, as Ta's own metrics count them (docs/design/ta-simple.md 6), on this device only:
7
9
  * `step:first-open` once, `step:first-reply` once the first conversation was answered, with how long it took since.
@@ -17,8 +19,14 @@ var FirstStepsUtil;
17
19
  if (!value || typeof value !== 'object' || Array.isArray(value)) {
18
20
  return undefined;
19
21
  }
20
- const { openedAt, replied } = value;
21
- return { ...(typeof openedAt === 'number' ? { openedAt } : {}), ...(replied === true ? { replied } : {}) };
22
+ const { openedAt, replied, repliedAt, phone } = value;
23
+ const { at, done } = (phone && typeof phone === 'object' ? phone : {});
24
+ return {
25
+ ...(typeof openedAt === 'number' ? { openedAt } : {}),
26
+ ...(replied === true ? { replied } : {}),
27
+ ...(typeof repliedAt === 'number' ? { repliedAt } : {}),
28
+ ...(phone && typeof phone === 'object' ? { phone: { ...(typeof at === 'number' ? { at } : {}), ...(done === true ? { done } : {}) } } : {}),
29
+ };
22
30
  },
23
31
  };
24
32
  /** Whether a conversation was answered (a message and what came after it), open or saved. */
@@ -26,6 +34,15 @@ var FirstStepsUtil;
26
34
  return ta_protocol_1.TaFirstStepsUtil.answered(open, saved) > 0;
27
35
  }
28
36
  FirstStepsUtil.answered = answered;
37
+ /**
38
+ * Whether the page opens on the double rather than on a new conversation (docs/design/ta-simple.md 4.2, 11): one
39
+ * start for a newcomer, nothing answered yet and nothing else to show. A phone opens on its list, where the double is
40
+ * the first row; a page or a conversation the tab had stays.
41
+ */
42
+ function startOnDouble(at) {
43
+ return !at.phone && !at.page && !at.conversation && !at.answered;
44
+ }
45
+ FirstStepsUtil.startOnDouble = startOnDouble;
29
46
  /**
30
47
  * What to keep and count now; nothing once done. One who had conversations answered before it was kept (a Ta of
31
48
  * before) is no newcomer: kept as done, not counted.
@@ -37,8 +54,24 @@ var FirstStepsUtil;
37
54
  if (kept.openedAt === undefined) {
38
55
  return answered ? { kept: { openedAt: now, replied: true }, steps: [] } : { kept: { openedAt: now }, steps: [{ item: 'step:first-open' }] };
39
56
  }
40
- return answered ? { kept: { ...kept, replied: true }, steps: [{ item: 'step:first-reply', ms: Math.max(0, now - kept.openedAt) }] } : { steps: [] };
57
+ return answered
58
+ ? { kept: { ...kept, replied: true, repliedAt: now }, steps: [{ item: 'step:first-reply', ms: Math.max(0, now - kept.openedAt) }] }
59
+ : { steps: [] };
41
60
  }
42
61
  FirstStepsUtil.next = next;
62
+ /**
63
+ * Whether the line that offers to use Ta from a phone shows above the box (docs/design/ta-simple.md 4.6, 12): once,
64
+ * after a newcomer's first conversation was answered, on a computer with no phone paired yet; it stays for
65
+ * PHONE_HINT_MS from when it first showed, until the user pairs one or closes it.
66
+ */
67
+ function phoneHint(kept, at) {
68
+ var _a, _b;
69
+ return (kept.repliedAt !== undefined &&
70
+ !((_a = kept.phone) === null || _a === void 0 ? void 0 : _a.done) &&
71
+ (((_b = kept.phone) === null || _b === void 0 ? void 0 : _b.at) === undefined || at.now - kept.phone.at < exports.PHONE_HINT_MS) &&
72
+ !at.handheld &&
73
+ at.paired === 0);
74
+ }
75
+ FirstStepsUtil.phoneHint = phoneHint;
43
76
  })(FirstStepsUtil || (exports.FirstStepsUtil = FirstStepsUtil = {}));
44
77
  //# sourceMappingURL=first-steps-util.js.map