@celljs/ta-web 4.49.0 → 4.50.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.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/account/account-side.js +4 -0
- package/esm/browser/account/device-account.d.ts +6 -0
- package/esm/browser/account/device-account.js +20 -5
- package/esm/browser/assistant/assistant-view.js +2 -0
- package/esm/browser/assistant/call-announcing.d.ts +25 -0
- package/esm/browser/assistant/call-announcing.js +32 -0
- package/esm/browser/assistant/call-answering.d.ts +43 -0
- package/esm/browser/assistant/call-answering.js +63 -0
- package/esm/browser/assistant/call-hearing.d.ts +53 -0
- package/esm/browser/assistant/call-hearing.js +98 -0
- package/esm/browser/assistant/call-pausing.d.ts +40 -0
- package/esm/browser/assistant/call-pausing.js +82 -0
- package/esm/browser/assistant/call-reading.d.ts +32 -0
- package/esm/browser/assistant/call-reading.js +35 -0
- package/esm/browser/assistant/call-revoicing.d.ts +33 -0
- package/esm/browser/assistant/call-revoicing.js +68 -0
- package/esm/browser/assistant/call-turns.d.ts +29 -0
- package/esm/browser/assistant/call-turns.js +33 -0
- package/esm/browser/assistant/spoken-answer.d.ts +21 -0
- package/esm/browser/assistant/spoken-answer.js +69 -0
- package/esm/browser/assistant/spoken-call.d.ts +7 -0
- package/esm/browser/assistant/spoken-call.js +16 -0
- package/esm/browser/assistant/voice-call-protocol.d.ts +5 -0
- package/esm/browser/assistant/voice-call.d.ts +47 -43
- package/esm/browser/assistant/voice-call.js +193 -219
- package/esm/browser/chat/chat-view.js +2 -1
- package/esm/browser/components/account-recovery-view.d.ts +11 -0
- package/esm/browser/components/account-recovery-view.js +81 -0
- package/esm/browser/components/account-view.d.ts +1 -2
- package/esm/browser/components/account-view.js +10 -1
- package/esm/browser/components/app-nav.js +19 -8
- package/esm/browser/components/app-shell-hooks.d.ts +5 -0
- package/esm/browser/components/app-shell-hooks.js +45 -0
- package/esm/browser/components/app-shell-state.js +2 -1
- package/esm/browser/components/app-view.js +9 -5
- package/esm/browser/components/chat-emoji.d.ts +35 -0
- package/esm/browser/components/chat-emoji.js +129 -0
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-attachments.d.ts +6 -0
- package/esm/browser/components/composer-attachments.js +12 -1
- package/esm/browser/components/composer-box-protocol.d.ts +15 -0
- package/esm/browser/components/composer-box.js +110 -87
- package/esm/browser/components/composer-drop-hooks.d.ts +26 -0
- package/esm/browser/components/composer-drop-hooks.js +36 -0
- package/esm/browser/components/composer-emoji.js +1 -1
- package/esm/browser/components/composer-faces.d.ts +16 -0
- package/esm/browser/components/composer-faces.js +37 -0
- package/esm/browser/components/composer-media.d.ts +10 -0
- package/esm/browser/components/composer-media.js +12 -1
- package/esm/browser/components/composer-target.d.ts +4 -0
- package/esm/browser/components/composer-target.js +18 -7
- package/esm/browser/components/composer-type-focus.d.ts +24 -0
- package/esm/browser/components/composer-type-focus.js +17 -0
- package/esm/browser/components/composer-voice.d.ts +24 -0
- package/esm/browser/components/composer-voice.js +37 -0
- package/esm/browser/components/composer.d.ts +2 -2
- package/esm/browser/components/composer.js +39 -8
- package/esm/browser/components/context-menu.js +2 -1
- package/esm/browser/components/emoji-panel.d.ts +11 -7
- package/esm/browser/components/emoji-panel.js +40 -22
- package/esm/browser/components/extension-settings.js +2 -2
- package/esm/browser/components/folder-new.d.ts +18 -0
- package/esm/browser/components/folder-new.js +53 -0
- package/esm/browser/components/folder-picker.d.ts +5 -2
- package/esm/browser/components/folder-picker.js +18 -6
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/image-menu.d.ts +8 -3
- package/esm/browser/components/image-menu.js +34 -9
- package/esm/browser/components/markdown.js +9 -2
- package/esm/browser/components/media.js +3 -2
- package/esm/browser/components/message-list.js +2 -2
- package/esm/browser/components/message-steps.js +20 -11
- package/esm/browser/components/message-user.js +2 -2
- package/esm/browser/components/moved-notice.js +2 -1
- package/esm/browser/components/nav-places.d.ts +2 -0
- package/esm/browser/components/nav-places.js +4 -2
- package/esm/browser/components/phone-shell.d.ts +2 -0
- package/esm/browser/components/phone-shell.js +5 -1
- package/esm/browser/components/secret-text.d.ts +1 -1
- package/esm/browser/components/secret-text.js +4 -3
- package/esm/browser/components/session-view.js +3 -0
- package/esm/browser/components/settings-choices.d.ts +2 -1
- package/esm/browser/components/settings-choices.js +13 -5
- package/esm/browser/components/settings-more.js +3 -3
- package/esm/browser/components/settings-parts.js +13 -2
- package/esm/browser/components/share-item-sheet.js +7 -1
- package/esm/browser/components/tab-title.d.ts +27 -0
- package/esm/browser/components/tab-title.js +35 -0
- package/esm/browser/components/use-composer-attachments.d.ts +28 -0
- package/esm/browser/components/use-composer-attachments.js +65 -0
- package/esm/browser/components/use-composer-files.d.ts +25 -0
- package/esm/browser/components/use-composer-files.js +52 -0
- package/esm/browser/components/web-composer.d.ts +3 -1
- package/esm/browser/components/web-composer.js +3 -2
- package/esm/browser/components/workbench-view.js +1 -0
- package/esm/browser/components/working-directory.js +2 -1
- package/esm/browser/device/drag-move.d.ts +21 -0
- package/esm/browser/device/drag-move.js +86 -0
- package/esm/browser/extension/icons.js +7 -1
- package/esm/browser/extension/web-api-desktop.d.ts +19 -0
- package/esm/browser/extension/web-api-menus.d.ts +19 -0
- package/esm/browser/extension/web-api-spec.js +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +24 -23
- package/esm/browser/extension/web-extension-context.d.ts +1 -0
- package/esm/browser/extension/web-extension-context.js +12 -5
- package/esm/browser/extension/web-extension-run.js +1 -0
- package/esm/browser/extension/web-share-ui.d.ts +1 -1
- package/esm/browser/extension/web-share-ui.js +2 -0
- package/esm/browser/extension/web-share.d.ts +13 -0
- package/esm/browser/extension/web-share.js +37 -2
- package/esm/browser/i18n/en/account.d.ts +18 -0
- package/esm/browser/i18n/en/account.js +18 -0
- package/esm/browser/i18n/en/call.js +1 -1
- package/esm/browser/i18n/en/chat.d.ts +15 -0
- package/esm/browser/i18n/en/chat.js +16 -1
- package/esm/browser/i18n/en/common.d.ts +2 -0
- package/esm/browser/i18n/en/common.js +2 -0
- package/esm/browser/i18n/en/discover.d.ts +2 -0
- package/esm/browser/i18n/en/discover.js +2 -0
- package/esm/browser/i18n/en/settings.d.ts +17 -0
- package/esm/browser/i18n/en/settings.js +17 -0
- package/esm/browser/i18n/ja/account.js +18 -0
- package/esm/browser/i18n/ja/call.js +1 -1
- package/esm/browser/i18n/ja/chat.js +16 -1
- package/esm/browser/i18n/ja/common.js +2 -0
- package/esm/browser/i18n/ja/discover.js +3 -1
- package/esm/browser/i18n/ja/settings.js +17 -0
- package/esm/browser/i18n/locales.d.ts +55 -1
- package/esm/browser/i18n/messages.d.ts +54 -0
- package/esm/browser/i18n/zh/account.js +18 -0
- package/esm/browser/i18n/zh/call.js +1 -1
- package/esm/browser/i18n/zh/chat.js +16 -1
- package/esm/browser/i18n/zh/common.js +2 -0
- package/esm/browser/i18n/zh/discover.js +3 -1
- package/esm/browser/i18n/zh/settings.js +17 -0
- package/esm/browser/i18n/zh-tw/account.js +18 -0
- package/esm/browser/i18n/zh-tw/call.js +1 -1
- package/esm/browser/i18n/zh-tw/chat.js +16 -1
- package/esm/browser/i18n/zh-tw/common.js +2 -0
- package/esm/browser/i18n/zh-tw/discover.js +3 -1
- package/esm/browser/i18n/zh-tw/settings.js +17 -0
- package/esm/browser/offline/kept-chats.d.ts +3 -1
- package/esm/browser/offline/kept-chats.js +1 -1
- package/esm/browser/partners/group-picker.d.ts +3 -2
- package/esm/browser/partners/group-picker.js +8 -3
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/sandbox/work/work-docs.js +5 -2
- package/esm/browser/sandbox/work/work-frame.d.ts +3 -0
- package/esm/browser/sandbox/work/work-frame.js +9 -3
- package/esm/browser/sandbox/work/work-gates.d.ts +77 -0
- package/esm/browser/sandbox/work/work-gates.js +182 -0
- package/esm/browser/settings/agent-settings.js +1 -1
- package/esm/browser/settings/navigation.d.ts +38 -10
- package/esm/browser/settings/navigation.js +73 -17
- package/esm/browser/settings/settings-protocol.d.ts +16 -1
- package/esm/browser/settings/settings-protocol.js +20 -2
- package/esm/browser/settings/settings.js +4 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +15 -2
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +6 -3
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +28 -8
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +5 -0
- package/esm/browser/style/device.js +5 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +3 -3
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +13 -6
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +4 -2
- package/esm/browser/util/chat-emoji.d.ts +44 -0
- package/esm/browser/util/chat-emoji.js +269 -0
- package/esm/browser/util/composer-drop.d.ts +26 -0
- package/esm/browser/util/composer-drop.js +40 -0
- package/esm/browser/util/composer-files.d.ts +48 -0
- package/esm/browser/util/composer-files.js +99 -0
- package/esm/browser/util/composer.d.ts +13 -1
- package/esm/browser/util/composer.js +24 -6
- package/esm/browser/util/markdown.d.ts +5 -0
- package/esm/browser/util/markdown.js +18 -0
- package/esm/browser/util/message.d.ts +6 -1
- package/esm/browser/util/message.js +13 -2
- package/esm/browser/util/process.d.ts +10 -13
- package/esm/browser/util/process.js +31 -83
- package/esm/browser/util/turn-join.d.ts +38 -0
- package/esm/browser/util/turn-join.js +119 -0
- package/esm/browser/workbench-services.js +1 -1
- package/lib/browser/account/account-side.js +4 -0
- package/lib/browser/account/device-account.d.ts +6 -0
- package/lib/browser/account/device-account.js +20 -5
- package/lib/browser/assistant/assistant-view.js +2 -0
- package/lib/browser/assistant/call-announcing.d.ts +26 -0
- package/lib/browser/assistant/call-announcing.js +36 -0
- package/lib/browser/assistant/call-answering.d.ts +44 -0
- package/lib/browser/assistant/call-answering.js +67 -0
- package/lib/browser/assistant/call-hearing.d.ts +54 -0
- package/lib/browser/assistant/call-hearing.js +102 -0
- package/lib/browser/assistant/call-pausing.d.ts +41 -0
- package/lib/browser/assistant/call-pausing.js +86 -0
- package/lib/browser/assistant/call-reading.d.ts +33 -0
- package/lib/browser/assistant/call-reading.js +39 -0
- package/lib/browser/assistant/call-revoicing.d.ts +34 -0
- package/lib/browser/assistant/call-revoicing.js +72 -0
- package/lib/browser/assistant/call-turns.d.ts +30 -0
- package/lib/browser/assistant/call-turns.js +37 -0
- package/lib/browser/assistant/spoken-answer.d.ts +22 -0
- package/lib/browser/assistant/spoken-answer.js +73 -0
- package/lib/browser/assistant/spoken-call.d.ts +8 -0
- package/lib/browser/assistant/spoken-call.js +19 -0
- package/lib/browser/assistant/voice-call-protocol.d.ts +5 -0
- package/lib/browser/assistant/voice-call.d.ts +47 -43
- package/lib/browser/assistant/voice-call.js +192 -218
- package/lib/browser/chat/chat-view.js +2 -1
- package/lib/browser/components/account-recovery-view.d.ts +12 -0
- package/lib/browser/components/account-recovery-view.js +117 -0
- package/lib/browser/components/account-view.d.ts +1 -2
- package/lib/browser/components/account-view.js +10 -1
- package/lib/browser/components/app-nav.js +19 -8
- package/lib/browser/components/app-shell-hooks.d.ts +5 -0
- package/lib/browser/components/app-shell-hooks.js +46 -0
- package/lib/browser/components/app-shell-state.js +1 -0
- package/lib/browser/components/app-view.js +8 -4
- package/lib/browser/components/chat-emoji.d.ts +36 -0
- package/lib/browser/components/chat-emoji.js +167 -0
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-attachments.d.ts +6 -0
- package/lib/browser/components/composer-attachments.js +12 -0
- package/lib/browser/components/composer-box-protocol.d.ts +15 -0
- package/lib/browser/components/composer-box.js +107 -84
- package/lib/browser/components/composer-drop-hooks.d.ts +27 -0
- package/lib/browser/components/composer-drop-hooks.js +72 -0
- package/lib/browser/components/composer-emoji.js +1 -1
- package/lib/browser/components/composer-faces.d.ts +17 -0
- package/lib/browser/components/composer-faces.js +73 -0
- package/lib/browser/components/composer-media.d.ts +10 -0
- package/lib/browser/components/composer-media.js +13 -0
- package/lib/browser/components/composer-target.d.ts +4 -0
- package/lib/browser/components/composer-target.js +18 -7
- package/lib/browser/components/composer-type-focus.d.ts +25 -0
- package/lib/browser/components/composer-type-focus.js +20 -0
- package/lib/browser/components/composer-voice.d.ts +25 -0
- package/lib/browser/components/composer-voice.js +73 -0
- package/lib/browser/components/composer.d.ts +2 -2
- package/lib/browser/components/composer.js +38 -7
- package/lib/browser/components/context-menu.js +2 -1
- package/lib/browser/components/emoji-panel.d.ts +11 -7
- package/lib/browser/components/emoji-panel.js +40 -22
- package/lib/browser/components/extension-settings.js +1 -1
- package/lib/browser/components/folder-new.d.ts +19 -0
- package/lib/browser/components/folder-new.js +90 -0
- package/lib/browser/components/folder-picker.d.ts +5 -2
- package/lib/browser/components/folder-picker.js +17 -5
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/image-menu.d.ts +8 -3
- package/lib/browser/components/image-menu.js +34 -9
- package/lib/browser/components/markdown.js +9 -2
- package/lib/browser/components/media.js +3 -2
- package/lib/browser/components/message-list.js +2 -2
- package/lib/browser/components/message-steps.js +20 -11
- package/lib/browser/components/message-user.js +1 -1
- package/lib/browser/components/moved-notice.js +2 -1
- package/lib/browser/components/nav-places.d.ts +2 -0
- package/lib/browser/components/nav-places.js +4 -2
- package/lib/browser/components/phone-shell.d.ts +2 -0
- package/lib/browser/components/phone-shell.js +5 -1
- package/lib/browser/components/secret-text.d.ts +1 -1
- package/lib/browser/components/secret-text.js +4 -3
- package/lib/browser/components/session-view.js +3 -0
- package/lib/browser/components/settings-choices.d.ts +2 -1
- package/lib/browser/components/settings-choices.js +12 -4
- package/lib/browser/components/settings-more.js +2 -2
- package/lib/browser/components/settings-parts.js +11 -0
- package/lib/browser/components/share-item-sheet.js +7 -1
- package/lib/browser/components/tab-title.d.ts +28 -0
- package/lib/browser/components/tab-title.js +38 -0
- package/lib/browser/components/use-composer-attachments.d.ts +29 -0
- package/lib/browser/components/use-composer-attachments.js +101 -0
- package/lib/browser/components/use-composer-files.d.ts +26 -0
- package/lib/browser/components/use-composer-files.js +88 -0
- package/lib/browser/components/web-composer.d.ts +3 -1
- package/lib/browser/components/web-composer.js +3 -2
- package/lib/browser/components/workbench-view.js +1 -0
- package/lib/browser/components/working-directory.js +2 -1
- package/lib/browser/device/drag-move.d.ts +22 -0
- package/lib/browser/device/drag-move.js +122 -0
- package/lib/browser/extension/icons.js +6 -0
- package/lib/browser/extension/web-api-desktop.d.ts +19 -0
- package/lib/browser/extension/web-api-menus.d.ts +19 -0
- package/lib/browser/extension/web-api-spec.js +2 -0
- package/lib/browser/extension/web-extension-api.d.ts +24 -23
- package/lib/browser/extension/web-extension-context.d.ts +1 -0
- package/lib/browser/extension/web-extension-context.js +12 -5
- package/lib/browser/extension/web-extension-run.js +1 -0
- package/lib/browser/extension/web-share-ui.d.ts +1 -1
- package/lib/browser/extension/web-share-ui.js +2 -0
- package/lib/browser/extension/web-share.d.ts +13 -0
- package/lib/browser/extension/web-share.js +37 -2
- package/lib/browser/i18n/en/account.d.ts +18 -0
- package/lib/browser/i18n/en/account.js +18 -0
- package/lib/browser/i18n/en/call.js +1 -1
- package/lib/browser/i18n/en/chat.d.ts +15 -0
- package/lib/browser/i18n/en/chat.js +16 -1
- package/lib/browser/i18n/en/common.d.ts +2 -0
- package/lib/browser/i18n/en/common.js +2 -0
- package/lib/browser/i18n/en/discover.d.ts +2 -0
- package/lib/browser/i18n/en/discover.js +2 -0
- package/lib/browser/i18n/en/settings.d.ts +17 -0
- package/lib/browser/i18n/en/settings.js +17 -0
- package/lib/browser/i18n/ja/account.js +18 -0
- package/lib/browser/i18n/ja/call.js +1 -1
- package/lib/browser/i18n/ja/chat.js +16 -1
- package/lib/browser/i18n/ja/common.js +2 -0
- package/lib/browser/i18n/ja/discover.js +3 -1
- package/lib/browser/i18n/ja/settings.js +17 -0
- package/lib/browser/i18n/locales.d.ts +55 -1
- package/lib/browser/i18n/messages.d.ts +54 -0
- package/lib/browser/i18n/zh/account.js +18 -0
- package/lib/browser/i18n/zh/call.js +1 -1
- package/lib/browser/i18n/zh/chat.js +16 -1
- package/lib/browser/i18n/zh/common.js +2 -0
- package/lib/browser/i18n/zh/discover.js +3 -1
- package/lib/browser/i18n/zh/settings.js +17 -0
- package/lib/browser/i18n/zh-tw/account.js +18 -0
- package/lib/browser/i18n/zh-tw/call.js +1 -1
- package/lib/browser/i18n/zh-tw/chat.js +16 -1
- package/lib/browser/i18n/zh-tw/common.js +2 -0
- package/lib/browser/i18n/zh-tw/discover.js +3 -1
- package/lib/browser/i18n/zh-tw/settings.js +17 -0
- package/lib/browser/offline/kept-chats.d.ts +3 -1
- package/lib/browser/offline/kept-chats.js +1 -1
- package/lib/browser/partners/group-picker.d.ts +3 -2
- package/lib/browser/partners/group-picker.js +8 -3
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/sandbox/work/work-docs.js +5 -2
- package/lib/browser/sandbox/work/work-frame.d.ts +3 -0
- package/lib/browser/sandbox/work/work-frame.js +9 -3
- package/lib/browser/sandbox/work/work-gates.d.ts +78 -0
- package/lib/browser/sandbox/work/work-gates.js +185 -0
- package/lib/browser/settings/agent-settings.js +1 -1
- package/lib/browser/settings/navigation.d.ts +38 -10
- package/lib/browser/settings/navigation.js +74 -18
- package/lib/browser/settings/settings-protocol.d.ts +16 -1
- package/lib/browser/settings/settings-protocol.js +21 -3
- package/lib/browser/settings/settings.js +3 -0
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +15 -2
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +6 -3
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +28 -8
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +5 -0
- package/lib/browser/style/device.js +5 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +3 -3
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +13 -6
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +4 -2
- package/lib/browser/util/chat-emoji.d.ts +45 -0
- package/lib/browser/util/chat-emoji.js +272 -0
- package/lib/browser/util/composer-drop.d.ts +27 -0
- package/lib/browser/util/composer-drop.js +43 -0
- package/lib/browser/util/composer-files.d.ts +49 -0
- package/lib/browser/util/composer-files.js +102 -0
- package/lib/browser/util/composer.d.ts +13 -1
- package/lib/browser/util/composer.js +24 -6
- package/lib/browser/util/markdown.d.ts +5 -0
- package/lib/browser/util/markdown.js +18 -0
- package/lib/browser/util/message.d.ts +6 -1
- package/lib/browser/util/message.js +13 -2
- package/lib/browser/util/process.d.ts +10 -13
- package/lib/browser/util/process.js +32 -84
- package/lib/browser/util/turn-join.d.ts +39 -0
- package/lib/browser/util/turn-join.js +122 -0
- package/lib/browser/workbench-services.js +1 -1
- package/package.json +7 -7
- package/public/emoji/wechat-v1.webp +0 -0
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { TurnEnd } from '../util/turn-end.js';
|
|
2
2
|
import { Voice } from '../util/voice.js';
|
|
3
|
+
import { CallAnnouncing } from './call-announcing.js';
|
|
4
|
+
import { CallAnswering } from './call-answering.js';
|
|
3
5
|
import { CallConversing, CallDrafts } from './call-conversing.js';
|
|
6
|
+
import { CallHearing } from './call-hearing.js';
|
|
4
7
|
import { CallPartnering } from './call-partnering.js';
|
|
5
|
-
import {
|
|
8
|
+
import { CallPausing } from './call-pausing.js';
|
|
9
|
+
import { CallReading } from './call-reading.js';
|
|
10
|
+
import { CallRevoicing } from './call-revoicing.js';
|
|
11
|
+
import { CallTurnEnd, SILENT_MS } from './call-turn-end.js';
|
|
12
|
+
import { CallTurns } from './call-turns.js';
|
|
6
13
|
import { CallSounds } from './voice-reading.js';
|
|
7
|
-
import { VoiceReopen } from './voice-reopen.js';
|
|
8
14
|
const IDLE = { active: false, phase: 'listening', heard: '' };
|
|
9
15
|
/**
|
|
10
16
|
* A call with a conversation (the double's, or any other), by the voice of the page: Ta listens until the user pauses, sends what they said, reads
|
|
@@ -20,17 +26,12 @@ export class VoiceCall {
|
|
|
20
26
|
this.listeners = new Set();
|
|
21
27
|
/** Of the listen now: one that ended or was stopped for another says nothing more. */
|
|
22
28
|
this.round = 0;
|
|
23
|
-
this.silent = 0;
|
|
24
|
-
/** When someone last spoke (the user, or Ta): the silence that ends the call counts from it. */
|
|
25
|
-
this.spoke = 0;
|
|
26
29
|
/** Of the call now: a voice opened for a call hung up is let go. */
|
|
27
30
|
this.calls = 0;
|
|
28
31
|
/** Its voice service is opening: an answer that comes meanwhile waits for it (`waiting`, '' for none). */
|
|
29
32
|
this.opening = false;
|
|
30
33
|
/** The answer begun on what the user said so far (CallPartner.draft). */
|
|
31
34
|
this.drafts = new CallDrafts();
|
|
32
|
-
/** What waits to be said that the user did not ask for (a dialog, a task that ended), in order. */
|
|
33
|
-
this.announcements = [];
|
|
34
35
|
/** For the face of the call (CallSounds): Ta's voice, whichever the call has (it opens after the call shows). */
|
|
35
36
|
this.sounds = new CallSounds(() => this.voice);
|
|
36
37
|
this.level = this.sounds.level;
|
|
@@ -57,6 +58,124 @@ export class VoiceCall {
|
|
|
57
58
|
end: reason => this.end(reason),
|
|
58
59
|
lost: () => this.revoice(),
|
|
59
60
|
}, options.silentMs);
|
|
61
|
+
this.turns = new CallTurns({
|
|
62
|
+
get state() {
|
|
63
|
+
return call.state;
|
|
64
|
+
},
|
|
65
|
+
get partnered() {
|
|
66
|
+
return !!call.partners.partner;
|
|
67
|
+
},
|
|
68
|
+
turnEnded: reply => this.turnEnded(reply),
|
|
69
|
+
});
|
|
70
|
+
this.pausing = new CallPausing({
|
|
71
|
+
get state() {
|
|
72
|
+
return call.state;
|
|
73
|
+
},
|
|
74
|
+
get voice() {
|
|
75
|
+
return call.voice;
|
|
76
|
+
},
|
|
77
|
+
get opening() {
|
|
78
|
+
return call.opening;
|
|
79
|
+
},
|
|
80
|
+
get pending() {
|
|
81
|
+
return call.pending;
|
|
82
|
+
},
|
|
83
|
+
setPending: pending => {
|
|
84
|
+
call.pending = pending;
|
|
85
|
+
},
|
|
86
|
+
get speaking() {
|
|
87
|
+
return call.speaking;
|
|
88
|
+
},
|
|
89
|
+
set: change => call.set(change),
|
|
90
|
+
stopListening: () => call.stopListening(),
|
|
91
|
+
listen: announce => call.listen(announce),
|
|
92
|
+
read: text => call.read(text),
|
|
93
|
+
dropDrafts: () => call.drafts.drop(),
|
|
94
|
+
conversingResumed: () => call.conversing.resumed(),
|
|
95
|
+
interrupt: () => call.interrupt(),
|
|
96
|
+
});
|
|
97
|
+
this.answering = options.answer
|
|
98
|
+
? new CallAnswering({
|
|
99
|
+
get state() {
|
|
100
|
+
return call.state;
|
|
101
|
+
},
|
|
102
|
+
answer: said => options.answer(said),
|
|
103
|
+
round: () => call.round,
|
|
104
|
+
waiting: () => call.turns.waiting,
|
|
105
|
+
set: change => call.set(change),
|
|
106
|
+
over: () => call.over(),
|
|
107
|
+
send: said => call.send(said),
|
|
108
|
+
unsent: () => call.unsent(),
|
|
109
|
+
})
|
|
110
|
+
: undefined;
|
|
111
|
+
this.revoicing = new CallRevoicing({
|
|
112
|
+
get state() {
|
|
113
|
+
return call.state;
|
|
114
|
+
},
|
|
115
|
+
calls: () => call.calls,
|
|
116
|
+
thought: () => { var _a; return !!((_a = call.partners.partner) === null || _a === void 0 ? void 0 : _a.brain); },
|
|
117
|
+
setOpening: opening => {
|
|
118
|
+
call.opening = opening;
|
|
119
|
+
},
|
|
120
|
+
set: change => call.set(change),
|
|
121
|
+
takeVoice: (voice, partner) => {
|
|
122
|
+
if (partner) {
|
|
123
|
+
call.partners.adopt(partner);
|
|
124
|
+
}
|
|
125
|
+
call.takeVoice(voice);
|
|
126
|
+
},
|
|
127
|
+
voiced: () => call.voiced(),
|
|
128
|
+
options: () => options,
|
|
129
|
+
failed: error => call.end('failed', error instanceof Error ? error.message : String(error)),
|
|
130
|
+
});
|
|
131
|
+
this.announcing = new CallAnnouncing({
|
|
132
|
+
get state() {
|
|
133
|
+
return call.state;
|
|
134
|
+
},
|
|
135
|
+
get voice() {
|
|
136
|
+
return call.voice;
|
|
137
|
+
},
|
|
138
|
+
get opening() {
|
|
139
|
+
return call.opening;
|
|
140
|
+
},
|
|
141
|
+
listen: () => call.listen(),
|
|
142
|
+
});
|
|
143
|
+
this.reading = new CallReading({
|
|
144
|
+
get state() {
|
|
145
|
+
return call.state;
|
|
146
|
+
},
|
|
147
|
+
get voice() {
|
|
148
|
+
return call.voice;
|
|
149
|
+
},
|
|
150
|
+
options: () => options,
|
|
151
|
+
set: change => call.set(change),
|
|
152
|
+
round: () => call.round,
|
|
153
|
+
nextRound: () => ++call.round,
|
|
154
|
+
ending: () => { var _a, _b; return !!((_b = (_a = call.partners.partner) === null || _a === void 0 ? void 0 : _a.ending) === null || _b === void 0 ? void 0 : _b.call(_a)); },
|
|
155
|
+
hangUp: () => call.hangUp(),
|
|
156
|
+
listen: () => call.listen(),
|
|
157
|
+
});
|
|
158
|
+
this.hearing = new CallHearing({
|
|
159
|
+
get state() {
|
|
160
|
+
return call.state;
|
|
161
|
+
},
|
|
162
|
+
get thinks() {
|
|
163
|
+
return !!call.voice.thinks;
|
|
164
|
+
},
|
|
165
|
+
get turnEnd() {
|
|
166
|
+
return call.turnEnd;
|
|
167
|
+
},
|
|
168
|
+
silentMs: () => { var _a; return (_a = options.silentMs) !== null && _a !== void 0 ? _a : SILENT_MS; },
|
|
169
|
+
get listening() {
|
|
170
|
+
return !!call.listening;
|
|
171
|
+
},
|
|
172
|
+
stopListening: () => call.stopListening(),
|
|
173
|
+
listen: (announce, held) => call.listen(announce, held),
|
|
174
|
+
take: said => call.take(said),
|
|
175
|
+
waits: said => call.turnEnd.waits(said),
|
|
176
|
+
set: change => call.set(change),
|
|
177
|
+
end: reason => call.end(reason),
|
|
178
|
+
});
|
|
60
179
|
this.turnEnd = new CallTurnEnd(options, () => this.quiet(), text => this.suspect(text));
|
|
61
180
|
}
|
|
62
181
|
subscribe(listener) {
|
|
@@ -71,9 +190,8 @@ export class VoiceCall {
|
|
|
71
190
|
if (this.state.active)
|
|
72
191
|
return;
|
|
73
192
|
this.device.hush();
|
|
74
|
-
this.
|
|
75
|
-
this.
|
|
76
|
-
const call = ++this.calls;
|
|
193
|
+
this.hearing.spokeNow();
|
|
194
|
+
this.calls++;
|
|
77
195
|
const opening = this.open(direct);
|
|
78
196
|
// Said as they called: the turn is at work already, its answer is read once the voice is there.
|
|
79
197
|
this.set({
|
|
@@ -89,6 +207,11 @@ export class VoiceCall {
|
|
|
89
207
|
return;
|
|
90
208
|
}
|
|
91
209
|
this.opening = true;
|
|
210
|
+
this.opened(opening);
|
|
211
|
+
}
|
|
212
|
+
/** Its voice service and partner are there, or none is: the call hears it, or says why it failed. */
|
|
213
|
+
opened(opening) {
|
|
214
|
+
const call = this.calls;
|
|
92
215
|
opening.then(([voice, partner]) => {
|
|
93
216
|
var _a;
|
|
94
217
|
if (!this.state.active || call !== this.calls) {
|
|
@@ -100,9 +223,9 @@ export class VoiceCall {
|
|
|
100
223
|
this.partners.adopt(partner);
|
|
101
224
|
// Said as they called, to the conversation: the partner answers it, not the turn; a voice that thinks
|
|
102
225
|
// begins afresh.
|
|
103
|
-
if (partner &&
|
|
226
|
+
if (partner && this.state.heard && this.state.phase === 'thinking' && !(voice === null || voice === void 0 ? void 0 : voice.thinks)) {
|
|
104
227
|
this.waiting = undefined;
|
|
105
|
-
this.partners.ask(
|
|
228
|
+
this.partners.ask(this.state.heard, true);
|
|
106
229
|
}
|
|
107
230
|
if (voice) {
|
|
108
231
|
this.takeVoice(voice);
|
|
@@ -148,173 +271,72 @@ export class VoiceCall {
|
|
|
148
271
|
}
|
|
149
272
|
/**
|
|
150
273
|
* Its voice service is gone (ta serve restarted, the connection dropped): the call says it connects, and opens it
|
|
151
|
-
* again as the connection comes back (
|
|
274
|
+
* again as the connection comes back (CallRevoicing); a service no longer chosen gives the voice of the device.
|
|
152
275
|
*/
|
|
153
276
|
revoice() {
|
|
154
277
|
var _a, _b, _c, _d;
|
|
155
|
-
const call = this.calls;
|
|
156
|
-
// A voice that thought had the brain of the partner: both open again.
|
|
157
|
-
const thought = !!((_a = this.partners.partner) === null || _a === void 0 ? void 0 : _a.brain);
|
|
158
278
|
this.conversing.stop();
|
|
159
|
-
(
|
|
279
|
+
(_a = this.offSpeech) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
160
280
|
this.offSpeech = undefined;
|
|
161
|
-
(
|
|
281
|
+
(_c = (_b = this.voice).stop) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
162
282
|
this.voice = this.device;
|
|
163
|
-
if (
|
|
283
|
+
if ((_d = this.partners.partner) === null || _d === void 0 ? void 0 : _d.brain) {
|
|
164
284
|
this.partners.close();
|
|
165
285
|
}
|
|
166
|
-
this.
|
|
167
|
-
this.set({ phase: 'connecting', heard: '', bargeIn: false });
|
|
168
|
-
let partner;
|
|
169
|
-
this.reopening = new VoiceReopen(async () => {
|
|
170
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
171
|
-
var _h;
|
|
172
|
-
if (!thought) {
|
|
173
|
-
return (_b = (_a = this.options).openVoice) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
174
|
-
}
|
|
175
|
-
partner === null || partner === void 0 ? void 0 : partner.close();
|
|
176
|
-
const opening = (_h = (_e = (_d = (_c = this.options).openPartner) === null || _d === void 0 ? void 0 : _d.call(_c)) === null || _e === void 0 ? void 0 : _e.catch(() => undefined)) !== null && _h !== void 0 ? _h : Promise.resolve(undefined);
|
|
177
|
-
const voice = await ((_g = (_f = this.options).openVoice) === null || _g === void 0 ? void 0 : _g.call(_f, opening));
|
|
178
|
-
partner = await opening;
|
|
179
|
-
return voice;
|
|
180
|
-
});
|
|
181
|
-
this.reopening.run().then(voice => {
|
|
182
|
-
var _a;
|
|
183
|
-
if (call !== this.calls || !this.state.active) {
|
|
184
|
-
(_a = voice === null || voice === void 0 ? void 0 : voice.stop) === null || _a === void 0 ? void 0 : _a.call(voice);
|
|
185
|
-
partner === null || partner === void 0 ? void 0 : partner.close();
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
this.opening = false;
|
|
189
|
-
if (thought) {
|
|
190
|
-
this.partners.adopt(partner);
|
|
191
|
-
}
|
|
192
|
-
if (voice) {
|
|
193
|
-
this.takeVoice(voice);
|
|
194
|
-
}
|
|
195
|
-
this.voiced();
|
|
196
|
-
}, (error) => call === this.calls && this.state.active && this.end('failed', error instanceof Error ? error.message : String(error)));
|
|
286
|
+
this.revoicing.run();
|
|
197
287
|
}
|
|
198
288
|
hangUp() {
|
|
199
|
-
var _a, _b, _c
|
|
289
|
+
var _a, _b, _c;
|
|
200
290
|
if (!this.state.active)
|
|
201
291
|
return;
|
|
202
292
|
this.drafts.drop();
|
|
203
293
|
this.conversing.stop();
|
|
204
294
|
this.partners.close();
|
|
205
295
|
this.calls++;
|
|
206
|
-
|
|
207
|
-
this.reopening = undefined;
|
|
296
|
+
this.revoicing.cancel();
|
|
208
297
|
this.opening = false;
|
|
209
298
|
this.waiting = undefined;
|
|
210
299
|
this.stopListening();
|
|
211
300
|
this.voice.hush();
|
|
212
|
-
(
|
|
301
|
+
(_a = this.offSpeech) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
213
302
|
this.offSpeech = undefined;
|
|
214
|
-
(
|
|
303
|
+
(_c = (_b = this.voice).stop) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
215
304
|
this.voice = this.device;
|
|
216
305
|
this.pending = undefined;
|
|
217
|
-
this.
|
|
306
|
+
this.announcing.clear();
|
|
218
307
|
this.set(IDLE);
|
|
219
308
|
}
|
|
220
|
-
/**
|
|
221
|
-
* Says something the user did not ask for, which they should hear in a call (Ta waits for them, a task ended):
|
|
222
|
-
* at once while Ta listens and the user has said nothing yet, else once what goes on now is over; never over
|
|
223
|
-
* the user, nor over an answer.
|
|
224
|
-
*/
|
|
309
|
+
/** What the user did not ask for, said in a silence (CallAnnouncing). */
|
|
225
310
|
announce(text) {
|
|
226
|
-
|
|
227
|
-
// A voice that thinks is told the news of the work by Ta itself (TaVoiceEngine.tell).
|
|
228
|
-
if (!this.state.active || !said || this.voice.thinks)
|
|
229
|
-
return;
|
|
230
|
-
this.announcements.push(said);
|
|
231
|
-
if (!this.state.paused && !this.opening && this.state.phase === 'listening' && !this.state.heard.trim()) {
|
|
232
|
-
this.listen();
|
|
233
|
-
}
|
|
311
|
+
this.announcing.announce(text);
|
|
234
312
|
}
|
|
235
313
|
/** The user began to speak while Ta reads: it stops and listens to them. */
|
|
236
314
|
bargeIn() {
|
|
237
|
-
|
|
238
|
-
this.interrupt();
|
|
239
|
-
}
|
|
315
|
+
this.pausing.bargeIn();
|
|
240
316
|
}
|
|
241
|
-
/**
|
|
242
|
-
* The page went to the background, where the device stops its listening and reading: the call stops them itself
|
|
243
|
-
* and waits, rather than look as if it listened. What was being said is said again on resume.
|
|
244
|
-
*/
|
|
317
|
+
/** The page went to the background: the call waits, rather than look as if it listened (CallPausing). */
|
|
245
318
|
pause() {
|
|
246
|
-
|
|
247
|
-
if (!this.state.active || this.state.paused) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
if (this.voice.thinks) {
|
|
251
|
-
(_b = (_a = this.voice).mute) === null || _b === void 0 ? void 0 : _b.call(_a, true);
|
|
252
|
-
this.voice.hush();
|
|
253
|
-
this.set({ paused: true, phase: 'listening', heard: '' });
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
this.stopListening();
|
|
257
|
-
this.drafts.drop();
|
|
258
|
-
if (this.state.phase === 'speaking') {
|
|
259
|
-
this.voice.hush();
|
|
260
|
-
this.pending = this.speaking;
|
|
261
|
-
}
|
|
262
|
-
this.set({ paused: true, heard: this.state.phase === 'thinking' ? this.state.heard : '' });
|
|
319
|
+
this.pausing.pause();
|
|
263
320
|
}
|
|
264
321
|
/** The page shows again: the answer that waits is read, a turn at work is waited for, else Ta listens. */
|
|
265
322
|
resume() {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
this.
|
|
279
|
-
if (pending) {
|
|
280
|
-
this.read(pending);
|
|
281
|
-
}
|
|
282
|
-
else if (this.state.phase !== 'thinking' && this.state.phase !== 'connecting') {
|
|
283
|
-
this.listen();
|
|
284
|
-
}
|
|
323
|
+
this.pausing.resume();
|
|
324
|
+
}
|
|
325
|
+
/** What was said is over: Ta listens again, or hangs up when the partner ended the call. */
|
|
326
|
+
over() {
|
|
327
|
+
this.reading.over();
|
|
328
|
+
}
|
|
329
|
+
/** What is being read now, to read again after a pause. */
|
|
330
|
+
get speaking() {
|
|
331
|
+
return this.reading.now;
|
|
332
|
+
}
|
|
333
|
+
/** A call says \`said\` aloud, then listens. */
|
|
334
|
+
read(said) {
|
|
335
|
+
this.reading.read(said);
|
|
285
336
|
}
|
|
286
337
|
/** While Ta speaks (an answer, or news it tells by itself): it stops and listens to the user, before any more news. */
|
|
287
338
|
interrupt() {
|
|
288
|
-
|
|
289
|
-
this.voice.hush();
|
|
290
|
-
if (this.voice.thinks) {
|
|
291
|
-
this.set({ phase: 'listening', heard: '' });
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
this.listen(false);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* How the conversation is, as it changes: a run that started after what the user said is the call's turn, and
|
|
300
|
-
* once it settles its reply is read. A run already going when the call asked (a follow-up) is its turn too.
|
|
301
|
-
*/
|
|
302
|
-
turn(working, reply) {
|
|
303
|
-
var _a;
|
|
304
|
-
// A partner answers in this call: the turns of the conversation are its work, not the call's.
|
|
305
|
-
if (!this.state.active || this.state.phase !== 'thinking' || this.partners.partner) {
|
|
306
|
-
this.asked = undefined;
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
if (working) {
|
|
310
|
-
(_a = this.asked) !== null && _a !== void 0 ? _a : (this.asked = { before: reply === null || reply === void 0 ? void 0 : reply.index });
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
if (this.asked) {
|
|
314
|
-
const fresh = reply && reply.index !== this.asked.before ? reply.text : undefined;
|
|
315
|
-
this.asked = undefined;
|
|
316
|
-
this.turnEnded(fresh);
|
|
317
|
-
}
|
|
339
|
+
this.pausing.interrupt();
|
|
318
340
|
}
|
|
319
341
|
/**
|
|
320
342
|
* The conversation's turn settled: its answer, if a new one came, is read out, and Ta listens again. Only for a turn
|
|
@@ -341,27 +363,6 @@ export class VoiceCall {
|
|
|
341
363
|
}
|
|
342
364
|
this.read(said);
|
|
343
365
|
}
|
|
344
|
-
/** What was said is over: Ta listens again, or hangs up when the partner ended the call. */
|
|
345
|
-
over() {
|
|
346
|
-
var _a, _b;
|
|
347
|
-
if ((_b = (_a = this.partners.partner) === null || _a === void 0 ? void 0 : _a.ending) === null || _b === void 0 ? void 0 : _b.call(_a)) {
|
|
348
|
-
this.hangUp();
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
this.listen();
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
read(said) {
|
|
355
|
-
const round = ++this.round;
|
|
356
|
-
this.speaking = said;
|
|
357
|
-
this.spoke = Date.now();
|
|
358
|
-
this.set({ phase: 'speaking', heard: '', reading: undefined });
|
|
359
|
-
this.voice.speak(said, this.options.language(), () => {
|
|
360
|
-
if (this.state.active && round === this.round) {
|
|
361
|
-
this.over();
|
|
362
|
-
}
|
|
363
|
-
}, this.options.voice(), (pieces, at) => this.state.active && round === this.round && this.set({ reading: { pieces, at } }));
|
|
364
|
-
}
|
|
365
366
|
/**
|
|
366
367
|
* Listens; first says what waits to be said, unless the user just cut in to speak (`announce` false). `held`: sounds
|
|
367
368
|
* alone a listen ended on, which what is heard now follows, gone or sent once it waited FILLER_MS for words.
|
|
@@ -376,7 +377,7 @@ export class VoiceCall {
|
|
|
376
377
|
if (this.state.paused) {
|
|
377
378
|
return;
|
|
378
379
|
}
|
|
379
|
-
const announcement =
|
|
380
|
+
const announcement = this.announcing.next(announce);
|
|
380
381
|
if (announcement) {
|
|
381
382
|
this.read(announcement);
|
|
382
383
|
return;
|
|
@@ -421,71 +422,39 @@ export class VoiceCall {
|
|
|
421
422
|
}
|
|
422
423
|
/** The user says they are done (the mark of the bar tapped): what was heard goes now as it is, sounds alone too. */
|
|
423
424
|
endTurn() {
|
|
424
|
-
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
const said = this.listened();
|
|
428
|
-
if (said) {
|
|
429
|
-
this.stopListening();
|
|
430
|
-
this.take(said);
|
|
431
|
-
}
|
|
425
|
+
this.hearing.endTurn();
|
|
432
426
|
}
|
|
433
|
-
/** The words heard stayed the same a while
|
|
427
|
+
/** The words heard stayed the same a while: the user is done (CallHearing). */
|
|
434
428
|
quiet() {
|
|
435
|
-
|
|
436
|
-
if (said) {
|
|
437
|
-
this.stopListening();
|
|
438
|
-
this.heard(said, undefined, true);
|
|
439
|
-
}
|
|
429
|
+
this.hearing.quiet();
|
|
440
430
|
}
|
|
441
|
-
/** What was heard of a listen going on
|
|
431
|
+
/** What was heard of a listen going on (CallHearing). */
|
|
442
432
|
listened() {
|
|
443
|
-
|
|
444
|
-
|
|
433
|
+
return this.hearing.listened();
|
|
434
|
+
}
|
|
435
|
+
/** A listen ended (CallHearing). */
|
|
436
|
+
heard(said, error, waited = false) {
|
|
437
|
+
this.hearing.heard(said, error, waited);
|
|
445
438
|
}
|
|
446
439
|
/**
|
|
447
|
-
*
|
|
448
|
-
* the
|
|
440
|
+
* What the user said goes to the partner, or to the conversation; words that answer the question it waits on answer
|
|
441
|
+
* it, and the work goes on from there (CallAnswering).
|
|
449
442
|
*/
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
if (
|
|
453
|
-
this.
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
456
|
-
if (said && !waited && this.turnEnd.waits(said)) {
|
|
457
|
-
if (error) {
|
|
458
|
-
this.retry = setTimeout(() => this.state.active && this.state.phase === 'listening' && this.listen(false, said), RETRY_MS);
|
|
459
|
-
}
|
|
460
|
-
else {
|
|
461
|
-
this.listen(false, said);
|
|
462
|
-
}
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
if (said && TurnEnd.sounds(said) === 'hesitation') {
|
|
466
|
-
said = '';
|
|
467
|
-
this.set({ heard: '' });
|
|
468
|
-
}
|
|
469
|
-
if (said) {
|
|
470
|
-
this.take(said);
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
if (++this.silent >= SILENT_ROUNDS && Date.now() - this.spoke >= ((_a = this.options.silentMs) !== null && _a !== void 0 ? _a : SILENT_MS)) {
|
|
474
|
-
this.end('silent');
|
|
443
|
+
take(said) {
|
|
444
|
+
this.hearing.heardWords();
|
|
445
|
+
if (this.answering && !this.partners.partner) {
|
|
446
|
+
this.answering.take(said);
|
|
475
447
|
return;
|
|
476
448
|
}
|
|
477
|
-
|
|
478
|
-
this.retry = setTimeout(() => this.state.active && this.state.phase === 'listening' && this.listen(), RETRY_MS);
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
this.listen();
|
|
482
|
-
}
|
|
449
|
+
this.thinking(said);
|
|
483
450
|
}
|
|
484
|
-
/** What the user said goes to the
|
|
485
|
-
|
|
486
|
-
this.silent = 0;
|
|
487
|
-
this.spoke = Date.now();
|
|
451
|
+
/** What the user said goes to the conversation: it thinks of it, and its reply is read as any turn. */
|
|
452
|
+
thinking(said) {
|
|
488
453
|
this.set({ phase: 'thinking', heard: said, said, reading: undefined });
|
|
454
|
+
this.send(said);
|
|
455
|
+
}
|
|
456
|
+
/** What the user said goes to the partner, or to the conversation. */
|
|
457
|
+
send(said) {
|
|
489
458
|
const draft = this.drafts.take(said);
|
|
490
459
|
if (this.partners.partner && draft) {
|
|
491
460
|
this.partners.kept(draft, said);
|
|
@@ -526,8 +495,13 @@ export class VoiceCall {
|
|
|
526
495
|
this.hangUp();
|
|
527
496
|
(_b = (_a = this.options).ended) === null || _b === void 0 ? void 0 : _b.call(_a, reason, detail);
|
|
528
497
|
}
|
|
498
|
+
turn(working, reply) {
|
|
499
|
+
this.turns.turn(working, reply);
|
|
500
|
+
}
|
|
529
501
|
stopListening() {
|
|
530
|
-
|
|
502
|
+
var _a;
|
|
503
|
+
this.hearing.stop();
|
|
504
|
+
(_a = this.answering) === null || _a === void 0 ? void 0 : _a.stop();
|
|
531
505
|
this.turnEnd.stop();
|
|
532
506
|
this.round++;
|
|
533
507
|
const listening = this.listening;
|
|
@@ -64,6 +64,7 @@ function DraftView({ draft, menu, aboveComposer, belowComposer }) {
|
|
|
64
64
|
const fail = (cause) => notices.error(cause);
|
|
65
65
|
const submit = (message, images) => chat.submit(message, images);
|
|
66
66
|
const list = React.useCallback((directory) => workbench.workspace.listDirectory('.', directory), [workbench]);
|
|
67
|
+
const create = React.useCallback((directory, name) => workbench.workspace.createDirectory(name, directory), [workbench]);
|
|
67
68
|
const pickModel = React.useCallback((model) => chat.setDraftModel(model), [chat]);
|
|
68
69
|
const model = useDraftModel(workbench.settings, draft, pickModel, t);
|
|
69
70
|
const commands = useDirectoryCommands(workbench.server, draft.cwd || undefined);
|
|
@@ -94,7 +95,7 @@ function DraftView({ draft, menu, aboveComposer, belowComposer }) {
|
|
|
94
95
|
React.createElement("div", { className: "ta-thread" }, sent ? React.createElement(MessageList, { state: sent, outbox: outbox }) : React.createElement(Hero, { cwd: draft.cwd, onPick: text => void submit(text).catch(fail) }))),
|
|
95
96
|
React.createElement("div", { className: "ta-bottom" },
|
|
96
97
|
aboveComposer,
|
|
97
|
-
React.createElement(Composer, { above: React.createElement(PhoneHint, null), server: workbench.server, workspace: workbench.workspace, working: going, onStop: () => chat.stopDraft(), commands: commands, cwd: draft.cwd || undefined, onSubmit: submit, onError: fail, talkPlace: "draft", draft: DraftPlaces.NEW, recentShots: recentShots, actions: model ? [[model]] : undefined, head: going ? undefined : React.createElement(DirectoryButton, { cwd: draft.cwd, list: list, remote: workbench, onPick: cwd => chat.setDraftCwd(cwd) }) }),
|
|
98
|
+
React.createElement(Composer, { above: React.createElement(PhoneHint, null), server: workbench.server, workspace: workbench.workspace, working: going, onStop: () => chat.stopDraft(), commands: commands, cwd: draft.cwd || undefined, onSubmit: submit, onError: fail, talkPlace: "draft", draft: DraftPlaces.NEW, recentShots: recentShots, actions: model ? [[model]] : undefined, head: going ? undefined : (React.createElement(DirectoryButton, { cwd: draft.cwd, list: list, create: create, remote: workbench, onPick: cwd => chat.setDraftCwd(cwd) })) }),
|
|
98
99
|
belowComposer)));
|
|
99
100
|
}
|
|
100
101
|
/** A conversation picked that is still loading, laid out as it will be: its head, a spinner, a message box that waits. */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TaAccountInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { Act } from './account-view.js';
|
|
4
|
+
/**
|
|
5
|
+
* The recovery code of the account (docs/design/ta-account.md 10): made here and written down, or made on another
|
|
6
|
+
* computer, or given on a new one to bring the friends and group chats back. A computer's alone: the app has none.
|
|
7
|
+
*/
|
|
8
|
+
export declare function RecoveryPart({ info, act }: {
|
|
9
|
+
info: TaAccountInfo;
|
|
10
|
+
act: Act;
|
|
11
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConsoleUtil } from '../gateway/console-util.js';
|
|
3
|
+
import { useNotices } from '../hooks.js';
|
|
4
|
+
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
5
|
+
import { BusyMark, useBusy } from './busy.js';
|
|
6
|
+
/**
|
|
7
|
+
* The recovery code of the account (docs/design/ta-account.md 10): made here and written down, or made on another
|
|
8
|
+
* computer, or given on a new one to bring the friends and group chats back. A computer's alone: the app has none.
|
|
9
|
+
*/
|
|
10
|
+
export function RecoveryPart({ info, act }) {
|
|
11
|
+
var _a;
|
|
12
|
+
const t = useT();
|
|
13
|
+
const language = useLanguage();
|
|
14
|
+
const [, notices] = useNotices();
|
|
15
|
+
const [busy, run] = useBusy();
|
|
16
|
+
const [entering, setEntering] = React.useState(false);
|
|
17
|
+
const [code, setCode] = React.useState('');
|
|
18
|
+
const recovery = info.recovery;
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (info.recovered) {
|
|
21
|
+
notices.notify(t('ta.recovery.restored', { friends: info.recovered.friends, rooms: info.recovered.rooms }), { level: 'success' });
|
|
22
|
+
}
|
|
23
|
+
}, [info.recovered, notices, t]);
|
|
24
|
+
const make = async () => {
|
|
25
|
+
await act(one => (one.makeRecovery ? one.makeRecovery() : Promise.resolve(info))).catch((error) => notices.error(error));
|
|
26
|
+
};
|
|
27
|
+
const saved = async () => {
|
|
28
|
+
await act(one => (one.recoverySaved ? one.recoverySaved() : Promise.resolve(info))).catch((error) => notices.error(error));
|
|
29
|
+
};
|
|
30
|
+
const drop = async () => {
|
|
31
|
+
if (!(await notices.confirm({ title: t('ta.recovery.dropConfirm'), confirmLabel: t('ta.recovery.drop'), danger: true }))) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
await act(one => (one.dropRecovery ? one.dropRecovery() : Promise.resolve(info))).catch((error) => notices.error(error));
|
|
35
|
+
};
|
|
36
|
+
const restore = async () => {
|
|
37
|
+
try {
|
|
38
|
+
await act(one => (one.recover ? one.recover(code) : Promise.resolve(info)));
|
|
39
|
+
setEntering(false);
|
|
40
|
+
setCode('');
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
notices.error(error);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
if (entering) {
|
|
47
|
+
return (React.createElement("section", { className: "ta-account-recovery" },
|
|
48
|
+
React.createElement("h2", null, t('ta.recovery.code')),
|
|
49
|
+
React.createElement("p", { className: "ta-account-hint" }, t('ta.recovery.hint')),
|
|
50
|
+
React.createElement("form", { className: "ta-host-form", onSubmit: event => {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
void run(restore);
|
|
53
|
+
} },
|
|
54
|
+
React.createElement("label", { className: "ta-field" },
|
|
55
|
+
React.createElement("input", { autoFocus: true, autoComplete: "off", spellCheck: false, "aria-label": t('ta.recovery.code'), placeholder: t('ta.recovery.placeholder'), value: code, onChange: event => setCode(event.target.value) }))),
|
|
56
|
+
React.createElement("div", { className: "ta-host-actions" },
|
|
57
|
+
React.createElement("button", { type: "button", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || !code.trim(), onClick: () => void run(restore) },
|
|
58
|
+
React.createElement(BusyMark, { busy: busy }),
|
|
59
|
+
t('ta.recovery.restoreNow')),
|
|
60
|
+
React.createElement("button", { type: "button", className: "ta-button", disabled: busy, onClick: () => setEntering(false) }, t('ta.cancel')))));
|
|
61
|
+
}
|
|
62
|
+
if (info.waiting) {
|
|
63
|
+
// A new computer waiting to be let in: the recovery code lets it in, with no other device at hand.
|
|
64
|
+
return (React.createElement("div", { className: "ta-host-actions" },
|
|
65
|
+
React.createElement("button", { type: "button", className: "ta-button", onClick: () => setEntering(true) }, t('ta.recovery.restore'))));
|
|
66
|
+
}
|
|
67
|
+
return (React.createElement("section", { className: "ta-account-recovery" },
|
|
68
|
+
React.createElement("h2", null, t('ta.recovery.title')),
|
|
69
|
+
(recovery === null || recovery === void 0 ? void 0 : recovery.code) ? (React.createElement(React.Fragment, null,
|
|
70
|
+
React.createElement("p", { className: "ta-account-hint" }, t('ta.recovery.show', { code: recovery.code })),
|
|
71
|
+
React.createElement("div", { className: "ta-host-actions" },
|
|
72
|
+
React.createElement("button", { type: "button", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy, onClick: () => void run(saved) },
|
|
73
|
+
React.createElement(BusyMark, { busy: busy }),
|
|
74
|
+
t('ta.recovery.saved'))))) : (recovery === null || recovery === void 0 ? void 0 : recovery.made) ? (React.createElement("p", { className: "ta-account-hint" }, t('ta.recovery.made', { time: ConsoleUtil.ago((_a = recovery.at) !== null && _a !== void 0 ? _a : Date.now(), language) }))) : (React.createElement("p", { className: "ta-account-hint" }, t('ta.recovery.none'))),
|
|
75
|
+
React.createElement("div", { className: "ta-host-actions" },
|
|
76
|
+
(recovery === null || recovery === void 0 ? void 0 : recovery.made) ? (React.createElement("button", { type: "button", className: "ta-button", disabled: busy, onClick: () => void run(drop) }, t('ta.recovery.drop'))) : (React.createElement("button", { type: "button", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy, onClick: () => void run(make) },
|
|
77
|
+
React.createElement(BusyMark, { busy: busy }),
|
|
78
|
+
t('ta.recovery.make'))),
|
|
79
|
+
React.createElement("button", { type: "button", className: "ta-button", disabled: busy, onClick: () => setEntering(true) }, t('ta.recovery.restore')))));
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=account-recovery-view.js.map
|