@celljs/ta-web 4.49.0 → 4.50.1
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-menu.js +1 -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-update-view.js +4 -4
- 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/app-update.d.ts +6 -3
- package/esm/browser/device/app-update.js +11 -5
- 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/service.d.ts +4 -0
- package/esm/browser/i18n/en/service.js +4 -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/service.js +4 -0
- package/esm/browser/i18n/ja/settings.js +17 -0
- package/esm/browser/i18n/locales.d.ts +59 -1
- package/esm/browser/i18n/messages.d.ts +58 -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/service.js +4 -0
- 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/service.js +4 -0
- 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-menu.js +1 -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-update-view.js +4 -4
- 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/app-update.d.ts +6 -3
- package/lib/browser/device/app-update.js +11 -5
- 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/service.d.ts +4 -0
- package/lib/browser/i18n/en/service.js +4 -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/service.js +4 -0
- package/lib/browser/i18n/ja/settings.js +17 -0
- package/lib/browser/i18n/locales.d.ts +59 -1
- package/lib/browser/i18n/messages.d.ts +58 -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/service.js +4 -0
- 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/service.js +4 -0
- 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
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The faces of a chat, as WeChat's: each said in the text as its name in brackets (`[微笑]`), as WeChat sends them, so
|
|
3
|
+
* that what is said stays text (the model reads it, a Ta of before shows the name, a copy pastes into WeChat) and the
|
|
4
|
+
* page draws the face in its place. Their pictures are one sheet (`public/emoji/wechat-v1.webp`, 10 a row, in this
|
|
5
|
+
* order), loaded once.
|
|
6
|
+
*/
|
|
7
|
+
export var ChatEmojiUtil;
|
|
8
|
+
(function (ChatEmojiUtil) {
|
|
9
|
+
/** The faces, in the order of the panel and of the sheet: the name said in the text, and in English. */
|
|
10
|
+
ChatEmojiUtil.FACES = [
|
|
11
|
+
['微笑', 'Smile'],
|
|
12
|
+
['撇嘴', 'Grimace'],
|
|
13
|
+
['色', 'Drool'],
|
|
14
|
+
['发呆', 'Scowl'],
|
|
15
|
+
['得意', 'Cool'],
|
|
16
|
+
['流泪', 'Sob'],
|
|
17
|
+
['害羞', 'Shy'],
|
|
18
|
+
['闭嘴', 'Silent'],
|
|
19
|
+
['睡', 'Sleep'],
|
|
20
|
+
['大哭', 'Cry'],
|
|
21
|
+
['尴尬', 'Awkward'],
|
|
22
|
+
['发怒', 'Angry'],
|
|
23
|
+
['调皮', 'Tongue'],
|
|
24
|
+
['呲牙', 'Grin'],
|
|
25
|
+
['惊讶', 'Surprise'],
|
|
26
|
+
['难过', 'Frown'],
|
|
27
|
+
['囧', 'Blush'],
|
|
28
|
+
['抓狂', 'Scream'],
|
|
29
|
+
['吐', 'Puke'],
|
|
30
|
+
['偷笑', 'Chuckle'],
|
|
31
|
+
['愉快', 'Joyful'],
|
|
32
|
+
['白眼', 'Slight'],
|
|
33
|
+
['傲慢', 'Smug'],
|
|
34
|
+
['困', 'Drowsy'],
|
|
35
|
+
['惊恐', 'Panic'],
|
|
36
|
+
['憨笑', 'Laugh'],
|
|
37
|
+
['悠闲', 'Relaxed'],
|
|
38
|
+
['咒骂', 'Scold'],
|
|
39
|
+
['疑问', 'Shocked'],
|
|
40
|
+
['嘘', 'Shhh'],
|
|
41
|
+
['晕', 'Dizzy'],
|
|
42
|
+
['衰', 'Toasted'],
|
|
43
|
+
['骷髅', 'Skull'],
|
|
44
|
+
['敲打', 'Hammer'],
|
|
45
|
+
['再见', 'Wave'],
|
|
46
|
+
['擦汗', 'Speechless'],
|
|
47
|
+
['抠鼻', 'Nose pick'],
|
|
48
|
+
['鼓掌', 'Clap'],
|
|
49
|
+
['坏笑', 'Trick'],
|
|
50
|
+
['右哼哼', 'Bah'],
|
|
51
|
+
['鄙视', 'Pooh-pooh'],
|
|
52
|
+
['委屈', 'Shrunken'],
|
|
53
|
+
['快哭了', 'Tearing up'],
|
|
54
|
+
['阴险', 'Sly'],
|
|
55
|
+
['亲亲', 'Kiss'],
|
|
56
|
+
['可怜', 'Whimper'],
|
|
57
|
+
['笑脸', 'Happy'],
|
|
58
|
+
['生病', 'Sick'],
|
|
59
|
+
['脸红', 'Flushed'],
|
|
60
|
+
['破涕为笑', 'Lol'],
|
|
61
|
+
['恐惧', 'Terror'],
|
|
62
|
+
['失望', 'Let down'],
|
|
63
|
+
['无语', 'Duh'],
|
|
64
|
+
['嘿哈', 'Hey'],
|
|
65
|
+
['捂脸', 'Facepalm'],
|
|
66
|
+
['奸笑', 'Smirk'],
|
|
67
|
+
['机智', 'Smart'],
|
|
68
|
+
['皱眉', 'Concerned'],
|
|
69
|
+
['耶', 'Yeah'],
|
|
70
|
+
['吃瓜', 'Onlooker'],
|
|
71
|
+
['加油', 'Go for it'],
|
|
72
|
+
['汗', 'Sweats'],
|
|
73
|
+
['天啊', 'OMG'],
|
|
74
|
+
['Emm', 'Emm'],
|
|
75
|
+
['社会社会', 'Respect'],
|
|
76
|
+
['旺柴', 'Doge'],
|
|
77
|
+
['好的', 'No prob'],
|
|
78
|
+
['打脸', 'My bad'],
|
|
79
|
+
['哇', 'Wow'],
|
|
80
|
+
['翻白眼', 'Boring'],
|
|
81
|
+
['666', 'Awesome'],
|
|
82
|
+
['让我看看', 'Let me see'],
|
|
83
|
+
['叹气', 'Sigh'],
|
|
84
|
+
['苦涩', 'Hurt'],
|
|
85
|
+
['裂开', 'Broken'],
|
|
86
|
+
['嘴唇', 'Lips'],
|
|
87
|
+
['爱心', 'Heart'],
|
|
88
|
+
['心碎', 'Broken heart'],
|
|
89
|
+
['拥抱', 'Hug'],
|
|
90
|
+
['强', 'Thumbs up'],
|
|
91
|
+
['弱', 'Thumbs down'],
|
|
92
|
+
['握手', 'Shake'],
|
|
93
|
+
['胜利', 'Peace'],
|
|
94
|
+
['抱拳', 'Salute'],
|
|
95
|
+
['勾引', 'Beckon'],
|
|
96
|
+
['拳头', 'Fist'],
|
|
97
|
+
['OK', 'OK'],
|
|
98
|
+
['合十', 'Worship'],
|
|
99
|
+
['啤酒', 'Beer'],
|
|
100
|
+
['咖啡', 'Coffee'],
|
|
101
|
+
['蛋糕', 'Cake'],
|
|
102
|
+
['玫瑰', 'Rose'],
|
|
103
|
+
['凋谢', 'Wilt'],
|
|
104
|
+
['菜刀', 'Cleaver'],
|
|
105
|
+
['炸弹', 'Bomb'],
|
|
106
|
+
['便便', 'Poop'],
|
|
107
|
+
['月亮', 'Moon'],
|
|
108
|
+
['太阳', 'Sun'],
|
|
109
|
+
['庆祝', 'Party'],
|
|
110
|
+
['礼物', 'Gift'],
|
|
111
|
+
['红包', 'Red packet'],
|
|
112
|
+
['發', 'Rich'],
|
|
113
|
+
['福', 'Blessing'],
|
|
114
|
+
['烟花', 'Fireworks'],
|
|
115
|
+
['爆竹', 'Firecracker'],
|
|
116
|
+
['猪头', 'Pig'],
|
|
117
|
+
['跳跳', 'Waddle'],
|
|
118
|
+
['发抖', 'Tremble'],
|
|
119
|
+
['转圈', 'Twirl'],
|
|
120
|
+
];
|
|
121
|
+
/** The sheet of the pictures, from the page: its faces in rows of {@link COLUMNS}. */
|
|
122
|
+
ChatEmojiUtil.SHEET = 'emoji/wechat-v1.webp';
|
|
123
|
+
ChatEmojiUtil.COLUMNS = 10;
|
|
124
|
+
const ROWS = Math.ceil(ChatEmojiUtil.FACES.length / ChatEmojiUtil.COLUMNS);
|
|
125
|
+
const INDEX = new Map(ChatEmojiUtil.FACES.map(([name], index) => [name, index]));
|
|
126
|
+
/** A name in brackets of a face: the longest name is a few characters. */
|
|
127
|
+
const CODE = /\[([^[\]\s]{1,5})\]/g;
|
|
128
|
+
/** A bracket at the start of a text that may be a face. */
|
|
129
|
+
const BRACKET = /^\[([^[\]\s]{1,5})\]/;
|
|
130
|
+
/** The text a face is said as. */
|
|
131
|
+
function code(index) {
|
|
132
|
+
return `[${ChatEmojiUtil.FACES[index][0]}]`;
|
|
133
|
+
}
|
|
134
|
+
ChatEmojiUtil.code = code;
|
|
135
|
+
/** The face a text is, alone (`[强]`), if it is one. */
|
|
136
|
+
function faceOf(text) {
|
|
137
|
+
var _a;
|
|
138
|
+
const name = (_a = BRACKET.exec(text)) === null || _a === void 0 ? void 0 : _a[1];
|
|
139
|
+
return name === undefined ? undefined : INDEX.get(name);
|
|
140
|
+
}
|
|
141
|
+
ChatEmojiUtil.faceOf = faceOf;
|
|
142
|
+
/** A face said at `at` of `text` (`[微笑]`): where it is and how long, none where the bracket is not a face. */
|
|
143
|
+
function at(text, from) {
|
|
144
|
+
if (text[from] !== '[') {
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
const found = BRACKET.exec(text.slice(from, from + 8));
|
|
148
|
+
const index = found ? INDEX.get(found[1]) : undefined;
|
|
149
|
+
return index === undefined || !found ? undefined : { index, length: found[0].length };
|
|
150
|
+
}
|
|
151
|
+
ChatEmojiUtil.at = at;
|
|
152
|
+
/** Whether a text says a face at all. */
|
|
153
|
+
function has(text) {
|
|
154
|
+
if (!text.includes('[')) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
CODE.lastIndex = 0;
|
|
158
|
+
for (let found = CODE.exec(text); found; found = CODE.exec(text)) {
|
|
159
|
+
if (INDEX.has(found[1])) {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
ChatEmojiUtil.has = has;
|
|
166
|
+
/** A text cut into its words and its faces, in order. */
|
|
167
|
+
function split(text) {
|
|
168
|
+
const parts = [];
|
|
169
|
+
let from = 0;
|
|
170
|
+
CODE.lastIndex = 0;
|
|
171
|
+
for (let found = CODE.exec(text); found; found = CODE.exec(text)) {
|
|
172
|
+
const index = INDEX.get(found[1]);
|
|
173
|
+
if (index === undefined) {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (found.index > from) {
|
|
177
|
+
parts.push(text.slice(from, found.index));
|
|
178
|
+
}
|
|
179
|
+
parts.push(index);
|
|
180
|
+
from = found.index + found[0].length;
|
|
181
|
+
}
|
|
182
|
+
if (from < text.length) {
|
|
183
|
+
parts.push(text.slice(from));
|
|
184
|
+
}
|
|
185
|
+
return parts;
|
|
186
|
+
}
|
|
187
|
+
ChatEmojiUtil.split = split;
|
|
188
|
+
/** The length of the face said just before `caret`, which Delete takes away whole, as WeChat's; 0 when there is none. */
|
|
189
|
+
function before(text, caret) {
|
|
190
|
+
const head = text.slice(Math.max(0, caret - 6), caret);
|
|
191
|
+
const found = /\[([^[\]\s]{1,5})\]$/.exec(head);
|
|
192
|
+
return found && INDEX.has(found[1]) ? found[0].length : 0;
|
|
193
|
+
}
|
|
194
|
+
ChatEmojiUtil.before = before;
|
|
195
|
+
/**
|
|
196
|
+
* The character a face is typed as in a field of the page (from U+E000, of the Private Use Area), as a field of
|
|
197
|
+
* WeChat shows the face rather than its name: one character a face, which the caret steps over and Delete takes
|
|
198
|
+
* whole. The field draws its picture over it (FaceField), and gives the text as it is said ({@link codes}).
|
|
199
|
+
*/
|
|
200
|
+
const GLYPH = 0xe000;
|
|
201
|
+
const GLYPHS = new RegExp(`[${String.fromCharCode(GLYPH)}-${String.fromCharCode(GLYPH + ChatEmojiUtil.FACES.length - 1)}]`, 'g');
|
|
202
|
+
/** The face a character of a field is, if it is one. */
|
|
203
|
+
function glyphFace(character) {
|
|
204
|
+
const index = character.length === 1 ? character.charCodeAt(0) - GLYPH : -1;
|
|
205
|
+
return index >= 0 && index < ChatEmojiUtil.FACES.length ? index : undefined;
|
|
206
|
+
}
|
|
207
|
+
ChatEmojiUtil.glyphFace = glyphFace;
|
|
208
|
+
/** The text as a field shows it: each face said in it (`[微笑]`) one character. */
|
|
209
|
+
function glyphs(text) {
|
|
210
|
+
return text.includes('[')
|
|
211
|
+
? text.replace(CODE, (said, name) => (INDEX.has(name) ? String.fromCharCode(GLYPH + INDEX.get(name)) : said))
|
|
212
|
+
: text;
|
|
213
|
+
}
|
|
214
|
+
ChatEmojiUtil.glyphs = glyphs;
|
|
215
|
+
/** The text of a field as it is said: each face its name in brackets again. */
|
|
216
|
+
function codes(shown) {
|
|
217
|
+
return shown.replace(GLYPHS, glyph => code(glyph.charCodeAt(0) - GLYPH));
|
|
218
|
+
}
|
|
219
|
+
ChatEmojiUtil.codes = codes;
|
|
220
|
+
/** Where `caret` of the text is in the field that shows it, and back. */
|
|
221
|
+
function shownCaret(text, caret) {
|
|
222
|
+
return glyphs(text.slice(0, caret)).length;
|
|
223
|
+
}
|
|
224
|
+
ChatEmojiUtil.shownCaret = shownCaret;
|
|
225
|
+
function saidCaret(shown, caret) {
|
|
226
|
+
return codes(shown.slice(0, caret)).length;
|
|
227
|
+
}
|
|
228
|
+
ChatEmojiUtil.saidCaret = saidCaret;
|
|
229
|
+
/** Where the face is on the sheet, as a background position. */
|
|
230
|
+
function position(index) {
|
|
231
|
+
// Rounded: a hundredth of a percent does not move a face of a few dozen pixels.
|
|
232
|
+
const x = Math.round(((index % ChatEmojiUtil.COLUMNS) * 10000) / (ChatEmojiUtil.COLUMNS - 1)) / 100;
|
|
233
|
+
const y = Math.round((Math.floor(index / ChatEmojiUtil.COLUMNS) * 10000) / (ROWS - 1)) / 100;
|
|
234
|
+
return `${x}% ${y}%`;
|
|
235
|
+
}
|
|
236
|
+
ChatEmojiUtil.position = position;
|
|
237
|
+
/** The size of the sheet as a background, for a face to fill its box. */
|
|
238
|
+
ChatEmojiUtil.SIZE = `${ChatEmojiUtil.COLUMNS * 100}% ${ROWS * 100}%`;
|
|
239
|
+
/** The faces used last, the last first, kept on this device as WeChat's 最近使用. */
|
|
240
|
+
const RECENT_KEY = 'ta.emoji.recent';
|
|
241
|
+
ChatEmojiUtil.RECENT = 8;
|
|
242
|
+
function recent(storage = globalThis.localStorage) {
|
|
243
|
+
var _a;
|
|
244
|
+
try {
|
|
245
|
+
const kept = JSON.parse((_a = storage === null || storage === void 0 ? void 0 : storage.getItem(RECENT_KEY)) !== null && _a !== void 0 ? _a : '[]');
|
|
246
|
+
return Array.isArray(kept)
|
|
247
|
+
? kept
|
|
248
|
+
.filter((name) => typeof name === 'string' && INDEX.has(name))
|
|
249
|
+
.slice(0, ChatEmojiUtil.RECENT)
|
|
250
|
+
.map(name => INDEX.get(name))
|
|
251
|
+
: [];
|
|
252
|
+
}
|
|
253
|
+
catch (_b) {
|
|
254
|
+
return [];
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
ChatEmojiUtil.recent = recent;
|
|
258
|
+
function used(index, storage = globalThis.localStorage) {
|
|
259
|
+
const names = [index, ...recent(storage).filter(each => each !== index)].slice(0, ChatEmojiUtil.RECENT).map(each => ChatEmojiUtil.FACES[each][0]);
|
|
260
|
+
try {
|
|
261
|
+
storage === null || storage === void 0 ? void 0 : storage.setItem(RECENT_KEY, JSON.stringify(names));
|
|
262
|
+
}
|
|
263
|
+
catch (_a) {
|
|
264
|
+
// A full or closed storage: nothing kept, the panel as before.
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
ChatEmojiUtil.used = used;
|
|
268
|
+
})(ChatEmojiUtil || (ChatEmojiUtil = {}));
|
|
269
|
+
//# sourceMappingURL=chat-emoji.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TaWorkspaceServer } from '@celljs/ta-protocol';
|
|
2
|
+
/** Files dropped or pasted into the message box, parted by what the box does with them. */
|
|
3
|
+
export interface ComposerDropParts {
|
|
4
|
+
/** Pictures the model reads itself (IMAGE_TYPES), and the videos where the box takes them: into the box. */
|
|
5
|
+
pictures: File[];
|
|
6
|
+
/** Every other file: written under the directory of the conversation, and named where the caret is. */
|
|
7
|
+
others: File[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Files dropped or pasted into the message box (ComposerBoxProps.droppedFiles): a document, a sheet, an archive,
|
|
11
|
+
* a video the box does not take; each is written under `uploads/` of the directory of the conversation in parts,
|
|
12
|
+
* its name one the file system takes and never over another, and the message names it as an `@` reference pi reads
|
|
13
|
+
* when it needs it. A file of any kind is therefore Ta's to read, never one it refuses as no picture.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace ComposerDropUtil {
|
|
16
|
+
/** The pictures of a drop (and the videos a box takes with them) from the rest. */
|
|
17
|
+
function part(files: readonly File[], videos: boolean): ComposerDropParts;
|
|
18
|
+
/**
|
|
19
|
+
* Writes the files under `uploads/` of the directory of the conversation, a part at a time, and answers where each
|
|
20
|
+
* went, relative to it (ComposerFileUtil.upload, its name as the file system takes it; none over another, not even
|
|
21
|
+
* one of the same drop).
|
|
22
|
+
*/
|
|
23
|
+
function write(workspace: Pick<TaWorkspaceServer, 'uploadFile'>, cwd: string | undefined, files: readonly File[]): Promise<string[]>;
|
|
24
|
+
/** The references of the paths, one after another, each quoted when its path has spaces (ComposerUtil.reference). */
|
|
25
|
+
function references(paths: readonly string[]): string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ComposerUtil, IMAGE_TYPES } from './composer.js';
|
|
2
|
+
import { ComposerFileUtil } from './composer-files.js';
|
|
3
|
+
/**
|
|
4
|
+
* Files dropped or pasted into the message box (ComposerBoxProps.droppedFiles): a document, a sheet, an archive,
|
|
5
|
+
* a video the box does not take; each is written under `uploads/` of the directory of the conversation in parts,
|
|
6
|
+
* its name one the file system takes and never over another, and the message names it as an `@` reference pi reads
|
|
7
|
+
* when it needs it. A file of any kind is therefore Ta's to read, never one it refuses as no picture.
|
|
8
|
+
*/
|
|
9
|
+
export var ComposerDropUtil;
|
|
10
|
+
(function (ComposerDropUtil) {
|
|
11
|
+
/** The pictures of a drop (and the videos a box takes with them) from the rest. */
|
|
12
|
+
function part(files, videos) {
|
|
13
|
+
const picture = (file) => IMAGE_TYPES.includes(file.type) || (videos && file.type.startsWith('video/'));
|
|
14
|
+
return { pictures: files.filter(picture), others: files.filter(file => !picture(file)) };
|
|
15
|
+
}
|
|
16
|
+
ComposerDropUtil.part = part;
|
|
17
|
+
/**
|
|
18
|
+
* Writes the files under `uploads/` of the directory of the conversation, a part at a time, and answers where each
|
|
19
|
+
* went, relative to it (ComposerFileUtil.upload, its name as the file system takes it; none over another, not even
|
|
20
|
+
* one of the same drop).
|
|
21
|
+
*/
|
|
22
|
+
async function write(workspace, cwd, files) {
|
|
23
|
+
const taken = new Set();
|
|
24
|
+
const written = [];
|
|
25
|
+
for (const file of files) {
|
|
26
|
+
const path = ComposerFileUtil.place(file.name, taken);
|
|
27
|
+
taken.add(path);
|
|
28
|
+
await ComposerFileUtil.upload(workspace, cwd, path, file, () => undefined);
|
|
29
|
+
written.push(path);
|
|
30
|
+
}
|
|
31
|
+
return written;
|
|
32
|
+
}
|
|
33
|
+
ComposerDropUtil.write = write;
|
|
34
|
+
/** The references of the paths, one after another, each quoted when its path has spaces (ComposerUtil.reference). */
|
|
35
|
+
function references(paths) {
|
|
36
|
+
return paths.map(path => ComposerUtil.reference(path)).join(' ');
|
|
37
|
+
}
|
|
38
|
+
ComposerDropUtil.references = references;
|
|
39
|
+
})(ComposerDropUtil || (ComposerDropUtil = {}));
|
|
40
|
+
//# sourceMappingURL=composer-drop.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type TaWorkspaceServer } from '@celljs/ta-protocol';
|
|
2
|
+
/** The folder of the files picked in the box, under the directory the conversation works in. */
|
|
3
|
+
export declare const UPLOAD_FOLDER = "uploads";
|
|
4
|
+
/** The most bytes of a file picked: a larger one is not sent. */
|
|
5
|
+
export declare const MAX_FILE_BYTES: number;
|
|
6
|
+
/** A file picked in the box, uploaded where the agent reads it, which the message names as an `@` reference. */
|
|
7
|
+
export interface ComposerFile {
|
|
8
|
+
id: string;
|
|
9
|
+
/** As the user's machine names it. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Under the directory of the conversation, with `/`: `uploads/a.pdf`. */
|
|
12
|
+
path: string;
|
|
13
|
+
size: number;
|
|
14
|
+
/** 0 to 1: what was uploaded of it; 1 once it is all there. The message waits for it. */
|
|
15
|
+
done: number;
|
|
16
|
+
}
|
|
17
|
+
/** Why a file picked is not taken. */
|
|
18
|
+
export type ComposerFileRefusal = 'size';
|
|
19
|
+
/**
|
|
20
|
+
* Files of the box other than the pictures a model sees itself (any kind, a picture it cannot see too): they are uploaded under `uploads/` of the directory
|
|
21
|
+
* of the conversation, and the message names them as the `@` references pi reads (the agent opens one with its tools).
|
|
22
|
+
*/
|
|
23
|
+
export declare namespace ComposerFileUtil {
|
|
24
|
+
/** The folder, as a path of a conversation. */
|
|
25
|
+
const FOLDER = "uploads/";
|
|
26
|
+
/** Why the file is not taken; none when it is. */
|
|
27
|
+
function refuse(file: {
|
|
28
|
+
size: number;
|
|
29
|
+
}): ComposerFileRefusal | undefined;
|
|
30
|
+
/** Its name as a path takes it: no folder, none of the characters a path of Windows turns down, not hidden. */
|
|
31
|
+
function name(name: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Its place under `uploads`: its name, then `a-2.pdf` and `a-3.pdf` for a name already in `taken` (what is there,
|
|
34
|
+
* and what was picked before it), so that a file never replaces another.
|
|
35
|
+
*/
|
|
36
|
+
function place(name: string, taken: ReadonlySet<string>): string;
|
|
37
|
+
/** 154 KB, 1.2 MB: the size of a file as the box shows it. */
|
|
38
|
+
function size(bytes: number): string;
|
|
39
|
+
/** The references of the files, one to a line, each quoted when its path has spaces, as pi's terminal writes them. */
|
|
40
|
+
function references(files: readonly ComposerFile[]): string;
|
|
41
|
+
/** What is already in `uploads`, as the paths of its files; none when the folder is not there yet. */
|
|
42
|
+
function taken(workspace: Pick<TaWorkspaceServer, 'listDirectory'>, cwd: string | undefined): Promise<Set<string>>;
|
|
43
|
+
/**
|
|
44
|
+
* Uploads the file at `path` of the conversation, a part at a time, `progress` told how much is there (0 to 1).
|
|
45
|
+
* The folders on the way are made by the server.
|
|
46
|
+
*/
|
|
47
|
+
function upload(workspace: Pick<TaWorkspaceServer, 'uploadFile'>, cwd: string | undefined, path: string, file: Blob, progress: (done: number) => void): Promise<void>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { TA_UPLOAD_PART_BYTES } from '@celljs/ta-protocol';
|
|
2
|
+
import { ComposerUtil } from './composer.js';
|
|
3
|
+
/** The folder of the files picked in the box, under the directory the conversation works in. */
|
|
4
|
+
export const UPLOAD_FOLDER = 'uploads';
|
|
5
|
+
/** The most bytes of a file picked: a larger one is not sent. */
|
|
6
|
+
export const MAX_FILE_BYTES = 50 * 1024 * 1024;
|
|
7
|
+
/**
|
|
8
|
+
* Files of the box other than the pictures a model sees itself (any kind, a picture it cannot see too): they are uploaded under `uploads/` of the directory
|
|
9
|
+
* of the conversation, and the message names them as the `@` references pi reads (the agent opens one with its tools).
|
|
10
|
+
*/
|
|
11
|
+
export var ComposerFileUtil;
|
|
12
|
+
(function (ComposerFileUtil) {
|
|
13
|
+
/** The folder, as a path of a conversation. */
|
|
14
|
+
ComposerFileUtil.FOLDER = `${UPLOAD_FOLDER}/`;
|
|
15
|
+
/** Why the file is not taken; none when it is. */
|
|
16
|
+
function refuse(file) {
|
|
17
|
+
return file.size > MAX_FILE_BYTES ? 'size' : undefined;
|
|
18
|
+
}
|
|
19
|
+
ComposerFileUtil.refuse = refuse;
|
|
20
|
+
/** Its name as a path takes it: no folder, none of the characters a path of Windows turns down, not hidden. */
|
|
21
|
+
function name(name) {
|
|
22
|
+
var _a;
|
|
23
|
+
const last = (_a = name
|
|
24
|
+
.split(/[\\/]+/)
|
|
25
|
+
.filter(Boolean)
|
|
26
|
+
.pop()) !== null && _a !== void 0 ? _a : '';
|
|
27
|
+
const cleaned = [...last]
|
|
28
|
+
.map(character => (character < ' ' || '<>:"|?*'.includes(character) ? '_' : character))
|
|
29
|
+
.join('')
|
|
30
|
+
.replace(/^[.\s]+/, '')
|
|
31
|
+
.slice(-120);
|
|
32
|
+
return cleaned || 'file';
|
|
33
|
+
}
|
|
34
|
+
ComposerFileUtil.name = name;
|
|
35
|
+
/**
|
|
36
|
+
* Its place under `uploads`: its name, then `a-2.pdf` and `a-3.pdf` for a name already in `taken` (what is there,
|
|
37
|
+
* and what was picked before it), so that a file never replaces another.
|
|
38
|
+
*/
|
|
39
|
+
function place(name, taken) {
|
|
40
|
+
const safe = ComposerFileUtil.name(name);
|
|
41
|
+
const dot = safe.lastIndexOf('.');
|
|
42
|
+
const stem = dot > 0 ? safe.slice(0, dot) : safe;
|
|
43
|
+
const extension = dot > 0 ? safe.slice(dot) : '';
|
|
44
|
+
for (let n = 1;; n++) {
|
|
45
|
+
const candidate = `${ComposerFileUtil.FOLDER}${n === 1 ? stem : `${stem}-${n}`}${extension}`;
|
|
46
|
+
if (!taken.has(candidate)) {
|
|
47
|
+
return candidate;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
ComposerFileUtil.place = place;
|
|
52
|
+
/** 154 KB, 1.2 MB: the size of a file as the box shows it. */
|
|
53
|
+
function size(bytes) {
|
|
54
|
+
return bytes < 1024 * 1024 ? `${Math.max(1, Math.round(bytes / 1024))} KB` : `${(bytes / 1024 ** 2).toFixed(bytes < 10 * 1024 ** 2 ? 1 : 0)} MB`;
|
|
55
|
+
}
|
|
56
|
+
ComposerFileUtil.size = size;
|
|
57
|
+
/** The references of the files, one to a line, each quoted when its path has spaces, as pi's terminal writes them. */
|
|
58
|
+
function references(files) {
|
|
59
|
+
return files.map(file => ComposerUtil.reference(file.path)).join('\n');
|
|
60
|
+
}
|
|
61
|
+
ComposerFileUtil.references = references;
|
|
62
|
+
/** What is already in `uploads`, as the paths of its files; none when the folder is not there yet. */
|
|
63
|
+
async function taken(workspace, cwd) {
|
|
64
|
+
try {
|
|
65
|
+
const entries = await workspace.listDirectory(UPLOAD_FOLDER, cwd);
|
|
66
|
+
return new Set(entries.map(entry => `${ComposerFileUtil.FOLDER}${entry.name}`));
|
|
67
|
+
}
|
|
68
|
+
catch (_a) {
|
|
69
|
+
return new Set();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
ComposerFileUtil.taken = taken;
|
|
73
|
+
/**
|
|
74
|
+
* Uploads the file at `path` of the conversation, a part at a time, `progress` told how much is there (0 to 1).
|
|
75
|
+
* The folders on the way are made by the server.
|
|
76
|
+
*/
|
|
77
|
+
async function upload(workspace, cwd, path, file, progress) {
|
|
78
|
+
const parts = Math.max(1, Math.ceil(file.size / TA_UPLOAD_PART_BYTES));
|
|
79
|
+
for (let part = 0; part < parts; part++) {
|
|
80
|
+
const start = part * TA_UPLOAD_PART_BYTES;
|
|
81
|
+
const end = Math.min(file.size, start + TA_UPLOAD_PART_BYTES);
|
|
82
|
+
const bytes = new Uint8Array(await file.slice(start, end).arrayBuffer());
|
|
83
|
+
const options = { cwd, append: part > 0 };
|
|
84
|
+
await workspace.uploadFile(path, base64(bytes), options);
|
|
85
|
+
progress(parts === 1 ? 1 : end / Math.max(1, file.size));
|
|
86
|
+
}
|
|
87
|
+
progress(1);
|
|
88
|
+
}
|
|
89
|
+
ComposerFileUtil.upload = upload;
|
|
90
|
+
/** Bytes in base64, in pieces so that a large buffer does not overflow the arguments of a call. */
|
|
91
|
+
function base64(bytes) {
|
|
92
|
+
let binary = '';
|
|
93
|
+
for (let i = 0; i < bytes.length; i += 0x8000) {
|
|
94
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + 0x8000));
|
|
95
|
+
}
|
|
96
|
+
return btoa(binary);
|
|
97
|
+
}
|
|
98
|
+
})(ComposerFileUtil || (ComposerFileUtil = {}));
|
|
99
|
+
//# sourceMappingURL=composer-files.js.map
|
|
@@ -30,10 +30,14 @@ export interface ComposerAttachment {
|
|
|
30
30
|
preview?: string;
|
|
31
31
|
image?: ComposerImage;
|
|
32
32
|
}
|
|
33
|
-
/** The messages waiting for the agent, as pi's `queue_update` lists them. */
|
|
33
|
+
/** The messages waiting for the agent, as pi's `queue_update` lists them, with how many images each carries (TaQueue). */
|
|
34
34
|
export interface ComposerQueue {
|
|
35
35
|
steering: string[];
|
|
36
36
|
followUp: string[];
|
|
37
|
+
images?: {
|
|
38
|
+
steering: number[];
|
|
39
|
+
followUp: number[];
|
|
40
|
+
};
|
|
37
41
|
}
|
|
38
42
|
/** How a message was sent from the box: Enter or the button, Alt+Enter, or Mod+Enter (⌘ on a Mac, Ctrl elsewhere). */
|
|
39
43
|
export type ComposerSendKey = 'enter' | 'alt' | 'now';
|
|
@@ -42,6 +46,8 @@ export interface ComposerQueued {
|
|
|
42
46
|
kind: 'steering' | 'followUp';
|
|
43
47
|
index: number;
|
|
44
48
|
text: string;
|
|
49
|
+
/** How many images it carries. */
|
|
50
|
+
images: number;
|
|
45
51
|
}
|
|
46
52
|
/** What the models of pi read. */
|
|
47
53
|
export declare const IMAGE_TYPES: string[];
|
|
@@ -78,6 +84,10 @@ export declare namespace ComposerUtil {
|
|
|
78
84
|
function commands<T extends {
|
|
79
85
|
name: string;
|
|
80
86
|
}>(all: T[], query: string, limit?: number): T[];
|
|
87
|
+
/** How long after a send the button, turned to stop under the pointer, does not stop: a double click meant one send. */
|
|
88
|
+
const STOP_GUARD_MS = 400;
|
|
89
|
+
/** A press of the stop button so soon after a send that it was the send pressed twice, not a stop. */
|
|
90
|
+
function accidentalStop(sentAt: number | undefined, now: number): boolean;
|
|
81
91
|
/** One button sends and stops: it stops while the agent works, or the conversation is compacted, and there is nothing to send. */
|
|
82
92
|
function action(working: boolean, sendable: boolean, compacting?: boolean): 'send' | 'stop';
|
|
83
93
|
/**
|
|
@@ -116,6 +126,8 @@ export declare namespace ComposerUtil {
|
|
|
116
126
|
function queued(queue: ComposerQueue): ComposerQueued[];
|
|
117
127
|
/** The queue without one of its messages. */
|
|
118
128
|
function without(queue: ComposerQueue, entry: ComposerQueued): ComposerQueue;
|
|
129
|
+
/** An image as the box takes a file pasted (ComposerBoxHandle.addFiles): one that was sent, back into it. */
|
|
130
|
+
function imageFile({ data, mimeType }: Pick<ComposerImage, 'data' | 'mimeType'>, index: number): File;
|
|
119
131
|
/** The text of messages taken back out of the queue, before what is in the box, or after it (`after`). */
|
|
120
132
|
function restore(queue: ComposerQueue, text: string, after?: boolean): string;
|
|
121
133
|
}
|
|
@@ -82,6 +82,13 @@ export var ComposerUtil;
|
|
|
82
82
|
return [...starts, ...contains].slice(0, limit);
|
|
83
83
|
}
|
|
84
84
|
ComposerUtil.commands = commands;
|
|
85
|
+
/** How long after a send the button, turned to stop under the pointer, does not stop: a double click meant one send. */
|
|
86
|
+
ComposerUtil.STOP_GUARD_MS = 400;
|
|
87
|
+
/** A press of the stop button so soon after a send that it was the send pressed twice, not a stop. */
|
|
88
|
+
function accidentalStop(sentAt, now) {
|
|
89
|
+
return sentAt !== undefined && now - sentAt >= 0 && now - sentAt < ComposerUtil.STOP_GUARD_MS;
|
|
90
|
+
}
|
|
91
|
+
ComposerUtil.accidentalStop = accidentalStop;
|
|
85
92
|
/** One button sends and stops: it stops while the agent works, or the conversation is compacted, and there is nothing to send. */
|
|
86
93
|
function action(working, sendable, compacting = false) {
|
|
87
94
|
return (working || compacting) && !sendable ? 'stop' : 'send';
|
|
@@ -169,18 +176,29 @@ export var ComposerUtil;
|
|
|
169
176
|
ComposerUtil.fileNote = fileNote;
|
|
170
177
|
/** Waiting messages, the steering ones first: they go in before the follow-ups. */
|
|
171
178
|
function queued(queue) {
|
|
172
|
-
return [
|
|
173
|
-
|
|
174
|
-
...queue.followUp.map((text, index) => ({ kind: 'followUp', index, text })),
|
|
175
|
-
];
|
|
179
|
+
const of = (kind) => queue[kind].map((text, index) => { var _a, _b; var _c; return ({ kind, index, text, images: (_c = (_b = (_a = queue.images) === null || _a === void 0 ? void 0 : _a[kind]) === null || _b === void 0 ? void 0 : _b[index]) !== null && _c !== void 0 ? _c : 0 }); });
|
|
180
|
+
return [...of('steering'), ...of('followUp')];
|
|
176
181
|
}
|
|
177
182
|
ComposerUtil.queued = queued;
|
|
178
183
|
/** The queue without one of its messages. */
|
|
179
184
|
function without(queue, entry) {
|
|
180
|
-
const rest = (kind) =>
|
|
181
|
-
|
|
185
|
+
const rest = (kind, of) => of.filter((_, index) => kind !== entry.kind || index !== entry.index);
|
|
186
|
+
const { images } = queue;
|
|
187
|
+
return {
|
|
188
|
+
steering: rest('steering', queue.steering),
|
|
189
|
+
followUp: rest('followUp', queue.followUp),
|
|
190
|
+
...(images ? { images: { steering: rest('steering', images.steering), followUp: rest('followUp', images.followUp) } } : {}),
|
|
191
|
+
};
|
|
182
192
|
}
|
|
183
193
|
ComposerUtil.without = without;
|
|
194
|
+
/** An image as the box takes a file pasted (ComposerBoxHandle.addFiles): one that was sent, back into it. */
|
|
195
|
+
function imageFile({ data, mimeType }, index) {
|
|
196
|
+
var _a;
|
|
197
|
+
const bytes = Uint8Array.from(atob(data), char => char.charCodeAt(0));
|
|
198
|
+
const extension = ((_a = mimeType.split('/')[1]) === null || _a === void 0 ? void 0 : _a.replace('jpeg', 'jpg')) || 'png';
|
|
199
|
+
return new File([bytes], `picked-${index + 1}.${extension}`, { type: mimeType });
|
|
200
|
+
}
|
|
201
|
+
ComposerUtil.imageFile = imageFile;
|
|
184
202
|
/** The text of messages taken back out of the queue, before what is in the box, or after it (`after`). */
|
|
185
203
|
function restore(queue, text, after = false) {
|
|
186
204
|
const taken = [...queue.steering, ...queue.followUp];
|
|
@@ -116,6 +116,11 @@ export type MarkdownInline = {
|
|
|
116
116
|
type: 'media';
|
|
117
117
|
src: string;
|
|
118
118
|
alt: string;
|
|
119
|
+
}
|
|
120
|
+
/** A face of a chat said as its name (`[微笑]`), as WeChat's: its index in ChatEmojiUtil.FACES. */
|
|
121
|
+
| {
|
|
122
|
+
type: 'face';
|
|
123
|
+
index: number;
|
|
119
124
|
};
|
|
120
125
|
/** What a target of `` shows. */
|
|
121
126
|
export type MediaKind = 'image' | 'video' | 'audio';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LocalRefs } from '@celljs/ta-protocol/lib/common/local-refs';
|
|
2
|
+
import { ChatEmojiUtil } from './chat-emoji.js';
|
|
2
3
|
import { LinkUtil } from './link.js';
|
|
3
4
|
export const CALLOUT_KINDS = ['note', 'tip', 'important', 'warning', 'caution'];
|
|
4
5
|
export const MARKDOWN_TINTS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'gray'];
|
|
@@ -47,6 +48,9 @@ const BEFORE_URL = /[\w/.@:-]/;
|
|
|
47
48
|
/** `$x$`: no space inside the dollars, no digit after the closing one, so that `$5 and $10` stays text. */
|
|
48
49
|
const INLINE_MATH = /^\$(?=[^\s$])([^$]*?[^\s$\\])\$(?!\d)/;
|
|
49
50
|
const PUNCTUATION = /[!-/:-@[-`{-~]/;
|
|
51
|
+
/** The entities of HTML that Markdown reads as their characters (> is >), as CommonMark does: the common ones and numeric. */
|
|
52
|
+
const ENTITY = /^&(?:(lt|gt|amp|quot|apos|nbsp)|#(\d{1,7})|#[xX]([0-9a-fA-F]{1,6}));/;
|
|
53
|
+
const ENTITIES = { lt: '<', gt: '>', amp: '&', quot: '"', apos: "'", nbsp: '\u00a0' };
|
|
50
54
|
/**
|
|
51
55
|
* The last line of a reply still coming that may yet turn into something else: the start of a fence, a
|
|
52
56
|
* heading, a list, a rule or a row of a table. It shows once the next character tells what it is.
|
|
@@ -363,6 +367,13 @@ export var MarkdownUtil;
|
|
|
363
367
|
i += marked[0].length;
|
|
364
368
|
continue;
|
|
365
369
|
}
|
|
370
|
+
// A face said as its name ([微笑]), as WeChat says them, drawn as its picture; other brackets stay words.
|
|
371
|
+
const face = ChatEmojiUtil.at(text, i);
|
|
372
|
+
if (face) {
|
|
373
|
+
push({ type: 'face', index: face.index });
|
|
374
|
+
i += face.length;
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
366
377
|
const note = text[i] === '[' ? NOTE_MARK.exec(rest) : null;
|
|
367
378
|
if (note) {
|
|
368
379
|
push({ type: 'note', label: note[1] });
|
|
@@ -404,6 +415,13 @@ export var MarkdownUtil;
|
|
|
404
415
|
i += url.length;
|
|
405
416
|
continue;
|
|
406
417
|
}
|
|
418
|
+
const entity = text[i] === '&' ? ENTITY.exec(rest) : null;
|
|
419
|
+
if (entity) {
|
|
420
|
+
const point = entity[2] ? Number(entity[2]) : entity[3] ? Number.parseInt(entity[3], 16) : undefined;
|
|
421
|
+
plain += point === undefined ? ENTITIES[entity[1]] : point > 0 && point <= 0x10ffff ? String.fromCodePoint(point) : '\ufffd';
|
|
422
|
+
i += entity[0].length;
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
407
425
|
plain += text[i++];
|
|
408
426
|
}
|
|
409
427
|
if (plain) {
|
|
@@ -49,10 +49,15 @@ export declare namespace MessageUtil {
|
|
|
49
49
|
/**
|
|
50
50
|
* The last message of the user while nothing came of it yet: after it only thinking, no words and no tool
|
|
51
51
|
* called. Stopped then, it goes back into the box to change and send again (a rewind to it, as pi's
|
|
52
|
-
* `/tree`)
|
|
52
|
+
* `/tree`), its images with it.
|
|
53
53
|
*/
|
|
54
54
|
function unanswered(messages: readonly SessionMessage[]): SessionMessage | undefined;
|
|
55
55
|
function blocks(message: SessionMessage): ContentBlock[];
|
|
56
|
+
/**
|
|
57
|
+
* The message is the `Continue` of the button under a turn that stopped short (`ta.message.resumeText`, in every
|
|
58
|
+
* language Ta speaks), which the page sent as words of the user: what the turn goes on, not a request of its own.
|
|
59
|
+
*/
|
|
60
|
+
function continued(message: SessionMessage): boolean;
|
|
56
61
|
function text(content: ContentBlock[] | string | undefined): string;
|
|
57
62
|
/**
|
|
58
63
|
* The absolute paths the tool calls of `messages` named (in their arguments: a file, a command's `cd`),
|